mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Hide single choice required behaviors in compact properties
This commit is contained in:
@@ -132,6 +132,7 @@ const createField = (
|
||||
property.getExtraInfo().size() > 0 ? property.getExtraInfo().at(0) : '';
|
||||
return {
|
||||
name,
|
||||
isHiddenWhenOnlyOneChoice: true,
|
||||
valueType: 'string',
|
||||
getChoices: () => {
|
||||
return !object || behaviorType === ''
|
||||
|
@@ -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') {
|
||||
|
Reference in New Issue
Block a user