Show only JSON encoding strategy for multi value fields

This commit is contained in:
Jože Fortun
2023-02-10 12:55:37 +01:00
parent ae90e618d2
commit 6401afce36
2 changed files with 16 additions and 8 deletions
@@ -92,6 +92,11 @@ export default {
required: true,
},
isMulti: {
type: Boolean,
default: false,
},
// default store-ident
storeIdent: {
type: String,
@@ -121,17 +126,18 @@ export default {
// strategy before omit
undoOmit: this.defaultStrategy,
// list of available strategies
strategies: [
{ value: types.Plain, text: this.$t('strategies.plain.label') },
{ value: types.Alias, text: this.$t('strategies.alias.label') },
{ value: types.JSON, text: this.$t('strategies.json.label') },
],
}
},
computed: {
strategies () {
return [
{ value: types.Plain, text: this.$t('strategies.plain.label'), disabled: this.isMulti },
{ value: types.Alias, text: this.$t('strategies.alias.label'), disabled: this.isMulti },
{ value: types.JSON, text: this.$t('strategies.json.label') },
].filter(({ disabled }) => !disabled)
},
showIdentInput () {
return [types.JSON, types.Alias, types.Plain].includes(this.strategy)
},
@@ -35,11 +35,12 @@
:description="$t('module-fields.description')"
>
<dal-field-store-encoding
v-for="({ field, storeIdent, label }) in moduleFields"
v-for="({ field, storeIdent, label, isMulti }) in moduleFields"
:key="field"
:config="moduleFieldEncoding[field] || {}"
:field="field"
:label="label"
:is-multi="isMulti"
:default-strategy="moduleFieldDefaultEncodingStrategy"
:store-ident="storeIdent"
@change="applyModuleFieldStrategyConfig(field, $event)"
@@ -162,6 +163,7 @@ export default {
field: f.name,
label: f.label || f.name,
storeIdent: f.name,
isMulti: f.isMulti,
}
// In case of a JSON encoding strategy, default to values