From d38768fe2ed60a70ad11a03e3a7f40d52c9d3b56 Mon Sep 17 00:00:00 2001 From: Jonne Kats Date: Wed, 9 Sep 2020 11:14:55 +0200 Subject: [PATCH 1/8] Add multi select --- package-lock.json | 41 +++++++++++++----- src/App.vue | 1 + src/components/CommercetoolsSelector.vue | 50 +++++++++++++++++---- src/components/PreviewValue.vue | 37 ++++++---------- src/components/PreviewValueList.vue | 55 ++++++++++++++++++++++++ 5 files changed, 141 insertions(+), 43 deletions(-) create mode 100644 src/components/PreviewValueList.vue diff --git a/package-lock.json b/package-lock.json index 69f7a4c..1ff6700 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4969,7 +4969,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -4990,12 +4991,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -5010,17 +5013,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -5137,7 +5143,8 @@ "inherits": { "version": "2.0.4", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -5149,6 +5156,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -5163,6 +5171,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -5170,12 +5179,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.9.0", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -5194,6 +5205,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -5283,7 +5295,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -5295,6 +5308,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -5380,7 +5394,8 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -5416,6 +5431,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -5435,6 +5451,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -5478,12 +5495,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, diff --git a/src/App.vue b/src/App.vue index 87fb2d0..5c4c238 100644 --- a/src/App.vue +++ b/src/App.vue @@ -78,6 +78,7 @@ export default { this.updateSize(); }, save: function(value) { + // Explicitly using == to match both null and undefined const toSave = value == null ? null : JSON.stringify(value); this.element.value = toSave; diff --git a/src/components/CommercetoolsSelector.vue b/src/components/CommercetoolsSelector.vue index 1781b1f..dc0bb30 100644 --- a/src/components/CommercetoolsSelector.vue +++ b/src/components/CommercetoolsSelector.vue @@ -1,15 +1,23 @@