Fix: hide options when multi properties exist on every var options

This commit is contained in:
grafakus
2025-11-25 12:11:37 +01:00
parent 18c4f5b875
commit e0c28cfa4c
@@ -46,8 +46,10 @@ export function useVariableSelectionOptionsCategory(variable: MultiValueVariable
),
useShowIf: () => {
const state = variable.useState();
const hasJsonValuesFormat = 'valuesFormat' in state && state.valuesFormat === 'json';
return hasJsonValuesFormat ? false : (state.includeAll ?? false);
const hasMultiProps =
('valuesFormat' in state && state.valuesFormat === 'json') ||
state.options.every((o) => Boolean(o.properties));
return hasMultiProps ? false : (state.includeAll ?? false);
},
render: (descriptor) => <CustomAllValueInput id={descriptor.props.id} variable={variable} />,
})
@@ -62,8 +64,10 @@ export function useVariableSelectionOptionsCategory(variable: MultiValueVariable
),
useShowIf: () => {
const state = variable.useState();
const hasJsonValuesFormat = 'valuesFormat' in state && state.valuesFormat === 'json';
return !hasJsonValuesFormat;
const hasMultiProps =
('valuesFormat' in state && state.valuesFormat === 'json') ||
state.options.every((o) => Boolean(o.properties));
return !hasMultiProps;
},
render: (descriptor) => <AllowCustomSwitch id={descriptor.props.id} variable={variable} />,
})