Fix: hide options when multi properties exist on every var options
This commit is contained in:
+8
-4
@@ -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} />,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user