fix: fix showLabel wrongly using MultiChoices (#2609)

This commit is contained in:
Yohan Boniface 2025-04-07 20:01:05 +02:00 committed by GitHub
commit 4679742b96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -132,6 +132,9 @@ export class MutatingForm extends Form {
const properties = Object.assign({}, defaults) const properties = Object.assign({}, defaults)
if (properties.type === Array) { if (properties.type === Array) {
properties.handler = 'CheckBoxes' properties.handler = 'CheckBoxes'
} else if (properties.type === Boolean) {
if (properties.nullable) properties.handler = 'NullableChoices'
else properties.handler = 'Switch'
} else if (properties.choices) { } else if (properties.choices) {
const text_length = properties.choices.reduce( const text_length = properties.choices.reduce(
(acc, [_, label]) => acc + label.length, (acc, [_, label]) => acc + label.length,
@ -145,9 +148,6 @@ export class MutatingForm extends Form {
properties.handler = 'Select' properties.handler = 'Select'
properties.selectOptions = properties.choices properties.selectOptions = properties.choices
} }
} else if (properties.type === Boolean) {
if (properties.nullable) properties.handler = 'NullableChoices'
else properties.handler = 'Switch'
} else if (properties.type === 'Text') { } else if (properties.type === 'Text') {
properties.handler = 'Textarea' properties.handler = 'Textarea'
} else if (properties.type === Number) { } else if (properties.type === Number) {