Skip to content

Commit

Permalink
Show only JSON encoding strategy for multi value fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Fajfa committed Feb 10, 2023
1 parent 9acc109 commit ef7e864
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ export default {
required: true,
},
isMulti: {
type: Boolean,
default: false,
},
// default store-ident
storeIdent: {
type: String,
Expand Down Expand Up @@ -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)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ef7e864

Please sign in to comment.