diff --git a/client/web/compose/src/components/ModuleFields/Configurator/Record.vue b/client/web/compose/src/components/ModuleFields/Configurator/Record.vue index 81c0628175..dfc26f2b56 100644 --- a/client/web/compose/src/components/ModuleFields/Configurator/Record.vue +++ b/client/web/compose/src/components/ModuleFields/Configurator/Record.vue @@ -79,12 +79,14 @@ stacked @change="onUpdateIsUniqueMultiValue" /> + + + {{ $t('kind.select.allow-duplicates') }} diff --git a/client/web/compose/src/components/ModuleFields/Configurator/Select.vue b/client/web/compose/src/components/ModuleFields/Configurator/Select.vue index 7a364b22f2..b46a9034a6 100644 --- a/client/web/compose/src/components/ModuleFields/Configurator/Select.vue +++ b/client/web/compose/src/components/ModuleFields/Configurator/Select.vue @@ -114,9 +114,11 @@ v-model="f.options.selectType" :options="selectOptions" stacked - @change="onUpdateIsUniqueMultiValue" + @change="updateIsUniqueMultiValue" /> + + o.value === 'list' || o.value === 'default') + const selectOptions = this.options.map((o) => { + if (o.value === 'list') { + o.text = this.$t(`kind.select.optionType.${this.f.isMulti ? 'checkbox' : 'radio'}`) + } + + return o + }) + + if (this.f.isMulti) { + return selectOptions } - return options + + return selectOptions.filter(({ allowMulti }) => allowMulti) }, shouldAllowDuplicates () { - return this.f.options.selectType !== 'multiple' && this.f.isMulti && this.f.options.selectType !== 'list' + if (!this.f.isMulti) return false + + const { allowDuplicates } = this.options.find(({ value }) => value === this.f.options.selectType) || {} + return !!allowDuplicates }, }, @@ -220,10 +229,10 @@ export default { }) }, - onUpdateIsUniqueMultiValue () { - if (this.f.options.selectType === 'multiple') { - this.f.options.isUniqueMultiValue = true - } + updateIsUniqueMultiValue (value) { + const { allowDuplicates = false } = this.options.find(({ value: v }) => v === value) || {} + if (this.f.options.selectType !== 'multiple') return + this.f.options.isUniqueMultiValue = !allowDuplicates }, }, } diff --git a/client/web/compose/src/components/ModuleFields/Configurator/User.vue b/client/web/compose/src/components/ModuleFields/Configurator/User.vue index cf0649a960..d3d281d6a7 100644 --- a/client/web/compose/src/components/ModuleFields/Configurator/User.vue +++ b/client/web/compose/src/components/ModuleFields/Configurator/User.vue @@ -37,12 +37,14 @@ stacked @change="onUpdateIsUniqueMultiValue" /> + + + {{ $t('kind.select.allow-duplicates') }} diff --git a/locale/en/corteza-webapp-compose/field.yaml b/locale/en/corteza-webapp-compose/field.yaml index d55a4c7cbc..69df576125 100644 --- a/locale/en/corteza-webapp-compose/field.yaml +++ b/locale/en/corteza-webapp-compose/field.yaml @@ -119,7 +119,8 @@ kind: each: Input for each value label: Select type multiple: Multiple select - list: List View + checkbox: Checkbox Group + radio: Radio Group optionValuePlaceholder: Value optionsLabel: Options to select from placeholder: Select an option by clicking here