From bbd22892be05d6708711ca18fe7dc9845ed13d8d Mon Sep 17 00:00:00 2001 From: maks Date: Thu, 28 Nov 2024 15:23:07 +0000 Subject: [PATCH] filter updates --- docs | 2 +- src/plugins/filter/filter.panel.tsx | 29 ++++++++++++++++------------ src/plugins/filter/filter.plugin.tsx | 11 +++++++---- src/plugins/filter/filter.types.ts | 2 ++ 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/docs b/docs index 42aa3844..cde6b70b 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 42aa3844b8c487dc3a1e1957e020a27cff772c3d +Subproject commit cde6b70b4ba63d12d68225531460e4a4aabaf12d diff --git a/src/plugins/filter/filter.panel.tsx b/src/plugins/filter/filter.panel.tsx index 5ba3d078..2abdfd47 100644 --- a/src/plugins/filter/filter.panel.tsx +++ b/src/plugins/filter/filter.panel.tsx @@ -457,18 +457,23 @@ export class FilterPanel { > { this.changes.extraContent?.(this.changes) || '' } - -
{this.getFilterItemsList()}
- -
- -
+ + { this.changes?.hideDefaultFilters !== true && ( + [ + , +
{this.getFilterItemsList()}
, +
+ +
+ ] + )} +
{this.disableDynamicFiltering && [ diff --git a/src/plugins/filter/filter.plugin.tsx b/src/plugins/filter/filter.plugin.tsx index b7e4d3ca..59f1100c 100644 --- a/src/plugins/filter/filter.plugin.tsx +++ b/src/plugins/filter/filter.plugin.tsx @@ -140,6 +140,10 @@ export class FilterPlugin extends BasePlugin { ); } + beforeshow(_: ShowData) { + // used as hook for filter panel + } + extraContent(): any { return null; } @@ -235,11 +239,10 @@ export class FilterPlugin extends BasePlugin { autoCorrect: true, filterTypes: this.getColumnFilter(e.detail.filter), filterItems: this.multiFilterItems, - }; - this.pop.show({ - ...data, extraContent: this.extraHyperContent, - }); + }; + this.beforeshow?.(data); + this.pop.show(data); } getColumnFilter( diff --git a/src/plugins/filter/filter.types.ts b/src/plugins/filter/filter.types.ts index 26bbaa3e..df954985 100644 --- a/src/plugins/filter/filter.types.ts +++ b/src/plugins/filter/filter.types.ts @@ -143,6 +143,8 @@ export type ShowData = { autoCorrect?: boolean; filterTypes?: Record; filterItems?: MultiFilterItem; + // hide default filters + hideDefaultFilters?: boolean; // pass vnodes from plugins extraContent?: (data: ShowData) => any; } & FilterItem & Omit;