From c59e468a32bfa2987e24430faffe477200a8a2c0 Mon Sep 17 00:00:00 2001 From: Luka Saric Date: Fri, 19 Mar 2021 17:45:39 +0100 Subject: [PATCH 1/9] Meta inputs cleanup :nail_care: - Added validation on checkbox, combobox & select inputs - Meta input formatting & code polishing --- .../meta-inputs/meta-checkbox/Edit.vue | 30 +++++++- .../meta-color/Edit/ColorInput.vue | 24 +++--- .../meta-inputs/meta-color/Edit/index.vue | 30 ++++---- .../meta-inputs/meta-combobox/Edit.vue | 49 ++++++++----- .../components/meta-inputs/meta-file/Edit.vue | 18 ++--- .../components/meta-inputs/meta-html/Edit.vue | 10 +-- .../meta-inputs/meta-input/Edit.vue | 9 +-- .../meta-inputs/meta-select/Edit.vue | 73 ++++++++++--------- .../meta-inputs/meta-switch/Edit.vue | 2 +- .../meta-inputs/meta-textarea/Edit.vue | 9 +-- 10 files changed, 136 insertions(+), 118 deletions(-) diff --git a/client/components/meta-inputs/meta-checkbox/Edit.vue b/client/components/meta-inputs/meta-checkbox/Edit.vue index 9c772556b..e175cdbc0 100644 --- a/client/components/meta-inputs/meta-checkbox/Edit.vue +++ b/client/components/meta-inputs/meta-checkbox/Edit.vue @@ -1,28 +1,50 @@ diff --git a/client/components/meta-inputs/meta-color/Edit/index.vue b/client/components/meta-inputs/meta-color/Edit/index.vue index 97deffc87..861552e4b 100644 --- a/client/components/meta-inputs/meta-color/Edit/index.vue +++ b/client/components/meta-inputs/meta-color/Edit/index.vue @@ -47,17 +47,13 @@ export default { props: { meta: { type: Object, default: () => ({ value: null }) } }, - data() { - return { - showInput: false, - colors: this.meta.colors || DEFAULT_COLORS, - value: this.meta.value - }; - }, + data: ({ meta }) => ({ + showInput: false, + colors: meta.colors || DEFAULT_COLORS, + value: meta.value + }), computed: { - selected() { - return this.value || get(this.colors, '[0][0]', '#000000'); - } + selected: vm => vm.value || get(vm.colors, '[0][0]', '#000000') }, methods: { select(color) { @@ -74,25 +70,25 @@ export default {