activate filter on !!val and clear val on !filter
This commit is contained in:
parent
3233b46aec
commit
5a9f7cbaa1
2 changed files with 4 additions and 3 deletions
|
@ -165,13 +165,14 @@ const FilterContent: React.FC<FilterContentProps> = ({
|
|||
filter: IFilterElement<string>
|
||||
) {
|
||||
const switchToActive = action.payload.update.active;
|
||||
|
||||
if (switchToActive && filter.name !== openedFilter?.name) {
|
||||
handleFilterAttributeFocus(filter);
|
||||
} else if (!switchToActive && filter.name === openedFilter?.name) {
|
||||
handleFilterAttributeFocus(undefined);
|
||||
}
|
||||
|
||||
if (!switchToActive) {
|
||||
action.payload.update.value = [];
|
||||
}
|
||||
onFilterPropertyChange(action);
|
||||
};
|
||||
|
||||
|
@ -179,7 +180,6 @@ const FilterContent: React.FC<FilterContentProps> = ({
|
|||
action: FilterReducerAction<T>
|
||||
) {
|
||||
const { update } = action.payload;
|
||||
|
||||
onFilterPropertyChange({
|
||||
...action,
|
||||
payload: { ...action.payload, update: { ...update, active: true } }
|
||||
|
|
|
@ -32,6 +32,7 @@ const FilterOptionField: React.FC<FilterBaseFieldProps> = ({
|
|||
payload: {
|
||||
name: filterField.name,
|
||||
update: {
|
||||
active: true,
|
||||
value: filterField.multiple
|
||||
? toggle(value, filterField.value, (a, b) => a === b)
|
||||
: [value]
|
||||
|
|
Loading…
Reference in a new issue