diff --git a/packages/filter/src/filter-rule/index.tsx b/packages/filter/src/filter-rule/index.tsx index 3860ddd..559ad2a 100644 --- a/packages/filter/src/filter-rule/index.tsx +++ b/packages/filter/src/filter-rule/index.tsx @@ -27,23 +27,20 @@ export const FilterRule = ({ rule }: FilterRuleProps) => { return (
({ - value: JSON.stringify(field.path), + value: field, label: mapFieldName(field), }))} - onChange={(pathStr) => { + onChange={(newField) => { updateRule({ ...rule, // Clear filter name when field changed name: undefined, + // name: newField.filterList[0].name, // Reset arguments when field changed arguments: [], - path: JSON.parse(pathStr), + path: newField.path, }); }} /> diff --git a/packages/filter/src/specs/preset.tsx b/packages/filter/src/specs/preset.tsx index 4116498..73ca17c 100644 --- a/packages/filter/src/specs/preset.tsx +++ b/packages/filter/src/specs/preset.tsx @@ -139,7 +139,7 @@ const SelectView = ({ ); return ( - + {options.map(({ label }, index) => ( {label}