Skip to content

Commit 78d14b7

Browse files
authored
Merge pull request #644 from revolist/filter-hooks
filter updates
2 parents 10e2104 + bbd2289 commit 78d14b7

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

src/plugins/filter/filter.panel.tsx

+17-12
Original file line numberDiff line numberDiff line change
@@ -459,18 +459,23 @@ export class FilterPanel {
459459
>
460460
<slot slot="header" />
461461
{ this.changes.extraContent?.(this.changes) || '' }
462-
<label>{capts.title}</label>
463-
<div class="filter-holder">{this.getFilterItemsList()}</div>
464-
465-
<div class="add-filter">
466-
<select
467-
id={FILTER_ID}
468-
class="select-css"
469-
onChange={e => this.onAddNewFilter(e)}
470-
>
471-
{this.renderSelectOptions(this.currentFilterType)}
472-
</select>
473-
</div>
462+
463+
{ this.changes?.hideDefaultFilters !== true && (
464+
[
465+
<label>{capts.title}</label>,
466+
<div class="filter-holder">{this.getFilterItemsList()}</div>,
467+
<div class="add-filter">
468+
<select
469+
id={FILTER_ID}
470+
class="select-css"
471+
onChange={e => this.onAddNewFilter(e)}
472+
>
473+
{this.renderSelectOptions(this.currentFilterType)}
474+
</select>
475+
</div>
476+
]
477+
)}
478+
474479
<slot />
475480
<div class="filter-actions">
476481
{this.disableDynamicFiltering && [

src/plugins/filter/filter.plugin.tsx

+7-4
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ export class FilterPlugin extends BasePlugin {
155155
);
156156
}
157157

158+
beforeshow(_: ShowData) {
159+
// used as hook for filter panel
160+
}
161+
158162
extraContent(): any {
159163
return null;
160164
}
@@ -254,11 +258,10 @@ export class FilterPlugin extends BasePlugin {
254258
autoCorrect: true,
255259
filterTypes: this.getColumnFilter(e.detail.filter),
256260
filterItems: this.multiFilterItems,
257-
};
258-
this.pop.show({
259-
...data,
260261
extraContent: this.extraHyperContent,
261-
});
262+
};
263+
this.beforeshow?.(data);
264+
this.pop.show(data);
262265
}
263266

264267
getColumnFilter(

src/plugins/filter/filter.types.ts

+2
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ export type ShowData = {
151151
autoCorrect?: boolean;
152152
filterTypes?: Record<string, string[]>;
153153
filterItems?: MultiFilterItem;
154+
// hide default filters
155+
hideDefaultFilters?: boolean;
154156
// pass vnodes from plugins
155157
extraContent?: (data: ShowData) => any;
156158
} & FilterItem & Omit<ColumnRegular, 'filter'>;

0 commit comments

Comments
 (0)