Skip to content

Commit

Permalink
feat: filter hyper
Browse files Browse the repository at this point in the history
  • Loading branch information
m2a2x committed Nov 13, 2024
1 parent ffc7226 commit 9554909
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* It contains typing information for all components that exist in this project.
*/
import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";
import { AfterEditEvent, AllDimensionType, ApplyFocusEvent, BeforeCellRenderEvent, BeforeEdit, BeforeRangeSaveDataDetails, BeforeRowRenderEvent, BeforeSaveDataDetails, Cell, CellTemplateProp, ChangedRange, ColumnDataSchemaModel, ColumnGrouping, ColumnProp, ColumnRegular, ColumnType, DataFormat, DataType, DimensionCols, DimensionRows, DimensionSettingsState, DimensionType, DimensionTypeCol, DragStartEvent, EditCell, EditorCtr, Editors, ElementScroll, ExtraNodeFuncConfig, FocusAfterRenderEvent, FocusRenderEvent, FocusTemplateFunc, InitialHeaderClick, MultiDimensionType, Nullable, PluginBaseComponent, PositionItem, Providers, RangeArea, RangeClipboardCopyEventProps, RangeClipboardPasteEvent, RowDefinition, RowHeaders, SaveDataDetails, SelectionStoreState, TempRange, Theme, ViewportData, ViewPortResizeEvent, ViewPortScrollEvent, ViewportState, ViewSettingSizeProp } from "./types/index";
import { AfterEditEvent, AllDimensionType, ApplyFocusEvent, BeforeCellRenderEvent, BeforeEdit, BeforeRangeSaveDataDetails, BeforeRowRenderEvent, BeforeSaveDataDetails, Cell, CellTemplateProp, ChangedRange, ColumnDataSchemaModel, ColumnGrouping, ColumnProp, ColumnRegular, ColumnType, DataFormat, DataType, DimensionCols, DimensionRows, DimensionSettingsState, DimensionType, DimensionTypeCol, DragStartEvent, EditCell, EditorCtr, Editors, ElementScroll, ExtraNodeFuncConfig, FocusAfterRenderEvent, FocusRenderEvent, FocusTemplateFunc, HyperFunc, InitialHeaderClick, MultiDimensionType, Nullable, PluginBaseComponent, PositionItem, Providers, RangeArea, RangeClipboardCopyEventProps, RangeClipboardPasteEvent, RowDefinition, RowHeaders, SaveDataDetails, SelectionStoreState, TempRange, Theme, ViewportData, ViewPortResizeEvent, ViewPortScrollEvent, ViewportState, ViewSettingSizeProp } from "./types/index";
import { GridPlugin } from "./plugins/base.plugin";
import { AutoSizeColumnConfig } from "./plugins/column.auto-size.plugin";
import { ColumnFilterConfig, FilterCaptions, FilterCollection, LogicFunction, MultiFilterItem, ShowData } from "./plugins/filter/filter.types";
Expand All @@ -19,7 +19,7 @@ import { DSourceState, Groups } from "./store/index";
import { ResizeProps } from "./components/header/resizable.directive";
import { HeaderRenderProps } from "./components/header/header-renderer";
import { EventData } from "./components/overlay/selection.utils";
export { AfterEditEvent, AllDimensionType, ApplyFocusEvent, BeforeCellRenderEvent, BeforeEdit, BeforeRangeSaveDataDetails, BeforeRowRenderEvent, BeforeSaveDataDetails, Cell, CellTemplateProp, ChangedRange, ColumnDataSchemaModel, ColumnGrouping, ColumnProp, ColumnRegular, ColumnType, DataFormat, DataType, DimensionCols, DimensionRows, DimensionSettingsState, DimensionType, DimensionTypeCol, DragStartEvent, EditCell, EditorCtr, Editors, ElementScroll, ExtraNodeFuncConfig, FocusAfterRenderEvent, FocusRenderEvent, FocusTemplateFunc, InitialHeaderClick, MultiDimensionType, Nullable, PluginBaseComponent, PositionItem, Providers, RangeArea, RangeClipboardCopyEventProps, RangeClipboardPasteEvent, RowDefinition, RowHeaders, SaveDataDetails, SelectionStoreState, TempRange, Theme, ViewportData, ViewPortResizeEvent, ViewPortScrollEvent, ViewportState, ViewSettingSizeProp } from "./types/index";
export { AfterEditEvent, AllDimensionType, ApplyFocusEvent, BeforeCellRenderEvent, BeforeEdit, BeforeRangeSaveDataDetails, BeforeRowRenderEvent, BeforeSaveDataDetails, Cell, CellTemplateProp, ChangedRange, ColumnDataSchemaModel, ColumnGrouping, ColumnProp, ColumnRegular, ColumnType, DataFormat, DataType, DimensionCols, DimensionRows, DimensionSettingsState, DimensionType, DimensionTypeCol, DragStartEvent, EditCell, EditorCtr, Editors, ElementScroll, ExtraNodeFuncConfig, FocusAfterRenderEvent, FocusRenderEvent, FocusTemplateFunc, HyperFunc, InitialHeaderClick, MultiDimensionType, Nullable, PluginBaseComponent, PositionItem, Providers, RangeArea, RangeClipboardCopyEventProps, RangeClipboardPasteEvent, RowDefinition, RowHeaders, SaveDataDetails, SelectionStoreState, TempRange, Theme, ViewportData, ViewPortResizeEvent, ViewPortScrollEvent, ViewportState, ViewSettingSizeProp } from "./types/index";
export { GridPlugin } from "./plugins/base.plugin";
export { AutoSizeColumnConfig } from "./plugins/column.auto-size.plugin";
export { ColumnFilterConfig, FilterCaptions, FilterCollection, LogicFunction, MultiFilterItem, ShowData } from "./plugins/filter/filter.types";
Expand Down Expand Up @@ -434,6 +434,7 @@ export namespace Components {
* Disables dynamic filtering. A way to apply filters on Save only
*/
"disableDynamicFiltering": boolean;
"extraContent"?: (h: HyperFunc<VNode>, data: ShowData) => VNode | VNode[];
"filterCaptions": FilterCaptions | undefined;
"filterEntities": Record<string, LogicFunction>;
"filterNames": Record<string, string>;
Expand Down Expand Up @@ -1812,6 +1813,7 @@ declare namespace LocalJSX {
* Disables dynamic filtering. A way to apply filters on Save only
*/
"disableDynamicFiltering"?: boolean;
"extraContent"?: (h: HyperFunc<VNode>, data: ShowData) => VNode | VNode[];
"filterCaptions"?: FilterCaptions | undefined;
"filterEntities"?: Record<string, LogicFunction>;
"filterNames"?: Record<string, string>;
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/filter/filter.panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
MultiFilterItem,
ShowData,
} from './filter.types';
import { ColumnProp } from '@type';
import { ColumnProp, HyperFunc } from '@type';
import { FilterType } from './filter.indexed';

const defaultType: FilterType = 'none';
Expand Down Expand Up @@ -69,6 +69,8 @@ export class FilterPanel {
*/
@Prop() disableDynamicFiltering = false;

@Prop() extraContent?: (h: HyperFunc<VNode>, data: ShowData) => VNode | VNode[];

@Event() filterChange: EventEmitter<MultiFilterItem>;
@Event() resetChange: EventEmitter<ColumnProp>;

Expand Down Expand Up @@ -442,6 +444,7 @@ export class FilterPanel {
}}
>
<slot slot="header" />
{ this.extraContent?.(h, this.changes) }
<label>{capts.title}</label>
<div class="filter-holder">{this.getFilterItemsList()}</div>

Expand Down
8 changes: 6 additions & 2 deletions src/plugins/filter/filter.plugin.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { h } from '@stencil/core';
import { h, type VNode } from '@stencil/core';

import type { ColumnProp, ColumnRegular, DataType, PluginProviders } from '@type';
import type { ColumnProp, ColumnRegular, DataType, HyperFunc, PluginProviders } from '@type';
import { BasePlugin } from '../base.plugin';
import { FILTER_PROP, isFilterBtn } from './filter.button';
import {
Expand All @@ -14,6 +14,7 @@ import type {
FilterCollection,
LogicFunction,
MultiFilterItem,
ShowData,
} from './filter.types';

import { getCellDataParsed } from '../../utils';
Expand Down Expand Up @@ -57,6 +58,8 @@ export class FilterPlugin extends BasePlugin {

filterProp = FILTER_PROP;

extraHyperContent?: (h: HyperFunc<VNode>, data: ShowData) => VNode | VNode[];

constructor(
public revogrid: HTMLRevoGridElement,
providers: PluginProviders,
Expand All @@ -79,6 +82,7 @@ export class FilterPlugin extends BasePlugin {
onFilterChange={e => this.onFilterChange(e.detail)}
onResetChange={e => this.onFilterReset(e.detail)}
disableDynamicFiltering={config?.disableDynamicFiltering}
extraContent={this.extraHyperContent}
ref={e => (this.pop = e)}
> { this.extraContent() }</revogr-filter-panel>,
];
Expand Down

0 comments on commit 9554909

Please sign in to comment.