Skip to content

Commit

Permalink
filter updates
Browse files Browse the repository at this point in the history
  • Loading branch information
m2a2x committed Nov 28, 2024
1 parent faaf594 commit bbd2289
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 17 deletions.
29 changes: 17 additions & 12 deletions src/plugins/filter/filter.panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -457,18 +457,23 @@ export class FilterPanel {
>
<slot slot="header" />
{ this.changes.extraContent?.(this.changes) || '' }
<label>{capts.title}</label>
<div class="filter-holder">{this.getFilterItemsList()}</div>

<div class="add-filter">
<select
id={FILTER_ID}
class="select-css"
onChange={e => this.onAddNewFilter(e)}
>
{this.renderSelectOptions(this.currentFilterType)}
</select>
</div>

{ this.changes?.hideDefaultFilters !== true && (
[
<label>{capts.title}</label>,
<div class="filter-holder">{this.getFilterItemsList()}</div>,
<div class="add-filter">
<select
id={FILTER_ID}
class="select-css"
onChange={e => this.onAddNewFilter(e)}
>
{this.renderSelectOptions(this.currentFilterType)}
</select>
</div>
]
)}

<slot />
<div class="filter-actions">
{this.disableDynamicFiltering && [
Expand Down
11 changes: 7 additions & 4 deletions src/plugins/filter/filter.plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ export class FilterPlugin extends BasePlugin {
);
}

beforeshow(_: ShowData) {
// used as hook for filter panel
}

extraContent(): any {
return null;
}
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/filter/filter.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ export type ShowData = {
autoCorrect?: boolean;
filterTypes?: Record<string, string[]>;
filterItems?: MultiFilterItem;
// hide default filters
hideDefaultFilters?: boolean;
// pass vnodes from plugins
extraContent?: (data: ShowData) => any;
} & FilterItem & Omit<ColumnRegular, 'filter'>;

0 comments on commit bbd2289

Please sign in to comment.