wip(forms): Try to be smart and use MultiChoice only for short labels
This commit is contained in:
parent
a7a854dd74
commit
4cdf682706
1 changed files with 4 additions and 1 deletions
|
@ -999,7 +999,10 @@ U.FormBuilder = L.FormBuilder.extend({
|
||||||
if (schema.step) schema.handler = 'Range'
|
if (schema.step) schema.handler = 'Range'
|
||||||
else schema.handler = 'IntInput'
|
else schema.handler = 'IntInput'
|
||||||
} else if (schema.choices) {
|
} else if (schema.choices) {
|
||||||
if (schema.choices.length <= 5) {
|
const text_length = schema.choices.reduce((acc, [value, label]) => acc + label.length, 0)
|
||||||
|
// Try to be smart and use MultiChoice only
|
||||||
|
// for choices where labels are shorts…
|
||||||
|
if (text_length < 40) {
|
||||||
schema.handler = 'MultiChoice'
|
schema.handler = 'MultiChoice'
|
||||||
} else {
|
} else {
|
||||||
schema.handler = 'Select'
|
schema.handler = 'Select'
|
||||||
|
|
Loading…
Reference in a new issue