fix: allow to set choices for a nullablechoices field (#2462)

fix #2380
This commit is contained in:
Yohan Boniface 2025-01-30 17:14:27 +01:00 committed by GitHub
commit be1fa55e9b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 5 deletions

View file

@ -1191,11 +1191,13 @@ Fields.TernaryChoices = class extends Fields.MultiChoice {
Fields.NullableChoices = class extends Fields.TernaryChoices {
getChoices() {
return [
[true, translate('always')],
[false, translate('never')],
['null', translate('hidden')],
]
return (
this.properties.choices || [
[true, translate('always')],
[false, translate('never')],
['null', translate('hidden')],
]
)
}
}

View file

@ -447,6 +447,11 @@ export const SCHEMA = {
label: translate('Display label'),
inheritable: true,
default: false,
choices: [
[true, translate('always')],
[false, translate('never')],
['null', translate('on hover')],
],
},
slideshow: {
type: Object,