Hide single choice required behaviors in compact properties

This commit is contained in:
Florian Rival
2024-09-19 09:49:11 +02:00
parent 1f73056ab6
commit b65c5ecbc0
2 changed files with 14 additions and 10 deletions

View File

@@ -132,6 +132,7 @@ const createField = (
property.getExtraInfo().size() > 0 ? property.getExtraInfo().at(0) : '';
return {
name,
isHiddenWhenOnlyOneChoice: true,
valueType: 'string',
getChoices: () => {
return !object || behaviorType === ''

View File

@@ -620,16 +620,19 @@ const CompactPropertiesEditor = ({
(field: ValueField) => {
if (!field.getChoices || !field.getValue) return;
const children = field
.getChoices()
.map(({ value, label, labelIsUserDefined }) => (
<SelectOption
key={value}
value={value}
label={label}
shouldNotTranslate={labelIsUserDefined}
/>
));
const choices = field.getChoices();
if (choices.length < 2 && field.isHiddenWhenOnlyOneChoice) {
return;
}
const children = choices.map(({ value, label, labelIsUserDefined }) => (
<SelectOption
key={value}
value={value}
label={label}
shouldNotTranslate={labelIsUserDefined}
/>
));
let compactSelectField;
if (field.valueType === 'number') {