Skip to content

Commit

Permalink
Merge pull request #636 from revolist/filter-panel
Browse files Browse the repository at this point in the history
Filter panel with no values fixed
  • Loading branch information
revolist authored Nov 18, 2024
2 parents 9dc040d + 93825c3 commit ec9aef3
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 82 deletions.
2 changes: 1 addition & 1 deletion docs
Submodule docs updated 230 files
2 changes: 1 addition & 1 deletion packages/angular
2 changes: 1 addition & 1 deletion packages/react
Submodule react updated 2 files
+1 −1 demo/package.json
+2 −2 package.json
2 changes: 1 addition & 1 deletion packages/svelte
Submodule svelte updated 1 files
+2 −2 package.json
2 changes: 1 addition & 1 deletion packages/vue2
Submodule vue2 updated 2 files
+1 −1 demo/package.json
+2 −2 package.json
2 changes: 1 addition & 1 deletion packages/vue3
Submodule vue3 updated 2 files
+2 −2 demo/package.json
+2 −2 package.json
32 changes: 6 additions & 26 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, InitialHeaderClick, MultiDimensionType, Nullable, PluginBaseComponent, PositionItem, Providers, RangeArea, RangeClipboardCopyEventProps, RangeClipboardPasteEvent, RowDefinition, RowDragStartDetails, 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, InitialHeaderClick, MultiDimensionType, Nullable, PluginBaseComponent, PositionItem, Providers, RangeArea, RangeClipboardCopyEventProps, RangeClipboardPasteEvent, RowDefinition, RowDragStartDetails, 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 @@ -795,10 +795,7 @@ declare global {
order: 'desc' | 'asc';
additive: boolean;
};
"rowdragstart": {
pos: PositionItem;
text: string;
};
"rowdragstart": RowDragStartDetails;
"headerclick": ColumnRegular;
"beforecellfocus": BeforeSaveDataDetails;
"beforefocuslost": FocusedData | null;
Expand Down Expand Up @@ -1063,14 +1060,7 @@ declare global {
new (): HTMLRevogrHeaderElement;
};
interface HTMLRevogrOrderEditorElementEventMap {
"rowdragstartinit": {
cell: Cell;
text: string;
pos: PositionItem;
event: MouseEvent;
rowType: DimensionRows;
model: any;
};
"rowdragstartinit": RowDragStartDetails;
"rowdragendinit": { rowType: DimensionRows };
"rowdragmoveinit": PositionItem & { rowType: DimensionRows };
"rowdragmousemove": Cell & { rowType: DimensionRows };
Expand Down Expand Up @@ -1518,10 +1508,7 @@ declare namespace LocalJSX {
/**
* This event is triggered when the row order change is started. To prevent the default behavior of changing the row order, you can call `e.preventDefault()`. To change the item name at the start of the row order change, you can set `e.text` to the desired new name.
*/
"onRowdragstart"?: (event: RevoGridCustomEvent<{
pos: PositionItem;
text: string;
}>) => void;
"onRowdragstart"?: (event: RevoGridCustomEvent<RowDragStartDetails>) => void;
/**
* Emmited when the row headers are changed.
*/
Expand Down Expand Up @@ -1973,14 +1960,7 @@ declare namespace LocalJSX {
/**
* Row drag started
*/
"onRowdragstartinit"?: (event: RevogrOrderEditorCustomEvent<{
cell: Cell;
text: string;
pos: PositionItem;
event: MouseEvent;
rowType: DimensionRows;
model: any;
}>) => void;
"onRowdragstartinit"?: (event: RevogrOrderEditorCustomEvent<RowDragStartDetails>) => void;
/**
* Row dragged, new range ready to be applied
*/
Expand Down
16 changes: 5 additions & 11 deletions src/components/order/revogr-order-editor.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { Component, Method, Event, EventEmitter, Prop } from '@stencil/core';
import debounce from 'lodash/debounce';

import { DSourceState, getSourceItem } from '@store';
import { type DSourceState, getSourceItem } from '@store';
import { DRAGG_TEXT } from '../../utils/consts';
import RowOrderService from './order-row.service';
import {
import type {
DimensionRows,
DataType,
DimensionSettingsState,
DragStartEvent,
PositionItem,
Cell,
RowDragStartDetails,
} from '@type';
import { Observable } from '../../utils';
import type { Observable } from '../../utils';

/**
* Component for handling row order editor.
Expand All @@ -36,14 +37,7 @@ export class OrderEditor {
// #region Events
/** Row drag started */
@Event({ eventName: 'rowdragstartinit', cancelable: true })
rowDragStart: EventEmitter<{
cell: Cell;
text: string;
pos: PositionItem;
event: MouseEvent;
rowType: DimensionRows;
model: any;
}>;
rowDragStart: EventEmitter<RowDragStartDetails>;

/** Row drag ended started */
@Event({ eventName: 'rowdragendinit' })
Expand Down
6 changes: 2 additions & 4 deletions src/components/revoGrid/revo-grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import type {
PluginProviders,
FocusAfterRenderEvent,
ExtraNodeFuncConfig,
RowDragStartDetails,
} from '@type';

import ColumnDataProvider from '../../services/column.data.provider';
Expand Down Expand Up @@ -386,10 +387,7 @@ export class RevoGridComponent {
* To prevent the default behavior of changing the row order, you can call `e.preventDefault()`.
* To change the item name at the start of the row order change, you can set `e.text` to the desired new name.
*/
@Event() rowdragstart: EventEmitter<{
pos: PositionItem;
text: string;
}>;
@Event() rowdragstart: EventEmitter<RowDragStartDetails>;

/**
* On header click.
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/filter/filter.panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class FilterPanel {
const prop = this.changes?.prop;
if (typeof prop === 'undefined') return '';

const propFilters = this.filterItems[prop];
const propFilters = this.filterItems[prop] ?? [];
const capts = Object.assign(
this.filterCaptionsInternal,
this.filterCaptions,
Expand Down
81 changes: 47 additions & 34 deletions src/types/plugin.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import type { SelectionStoreConnector } from '../services/selection.store.connec
import ViewportProvider from '../services/viewport.provider';

export interface PluginServiceBase {
get(): PluginBaseComponent[];
add(plugin: PluginBaseComponent): void;
remove(plugin: PluginBaseComponent): void;
getByClass<T extends PluginBaseComponent>(
pluginClass: new (...args: any[]) => T,
): T | undefined;
get(): PluginBaseComponent[];
add(plugin: PluginBaseComponent): void;
remove(plugin: PluginBaseComponent): void;
getByClass<T extends PluginBaseComponent>(
pluginClass: new (...args: any[]) => T,
): T | undefined;
}

/**
Expand All @@ -20,37 +20,50 @@ export interface PluginServiceBase {
* by the plugins.
*/
export type PluginProviders = {
/**
* The data service provides access to the grid data.
*/
data: DataProvider;
/**
* The dimension service provides access to the grid's dimensions and settings.
*/
dimension: DimensionProvider;
/**
* The selection service provides access to the grid's selection state.
*/
selection: SelectionStoreConnector;
/**
* The column service provides access to the grid's column data.
*/
column: ColumnDataProvider;
/**
* The viewport service provides access to the grid's viewport state.
*/
viewport: ViewportProvider;
/**
* The data service provides access to the grid data.
*/
data: DataProvider;
/**
* The dimension service provides access to the grid's dimensions and settings.
*/
dimension: DimensionProvider;
/**
* The selection service provides access to the grid's selection state.
*/
selection: SelectionStoreConnector;
/**
* The column service provides access to the grid's column data.
*/
column: ColumnDataProvider;
/**
* The viewport service provides access to the grid's viewport state.
*/
viewport: ViewportProvider;

/**
* Plugin services
*/
/**
* Plugin services
*/

plugins: PluginServiceBase;
plugins: PluginServiceBase;
};


declare global {
interface HTMLRevoGridElementEventMap extends HTMLRevogrClipboardElementEventMap, HTMLRevogrFocusElementEventMap, HTMLRevogrDataElementEventMap, HTMLRevogrEditElementEventMap, HTMLRevogrFilterPanelElementEventMap, HTMLRevogrHeaderElementEventMap, HTMLRevogrOrderEditorElementEventMap, HTMLRevogrOverlaySelectionElementEventMap, HTMLRevogrRowHeadersElementEventMap, HTMLRevogrScrollVirtualElementEventMap, HTMLRevogrViewportScrollElementEventMap, HTMLVnodeHtmlElementEventMap, Record<string, any> {
//
}
type CombinedHTMLRevoGridElementEventMap = Record<string, any> &
HTMLRevogrClipboardElementEventMap &
HTMLRevogrFocusElementEventMap &
HTMLRevogrDataElementEventMap &
HTMLRevogrEditElementEventMap &
HTMLRevogrFilterPanelElementEventMap &
HTMLRevogrHeaderElementEventMap &
HTMLRevogrOrderEditorElementEventMap &
HTMLRevogrOverlaySelectionElementEventMap &
HTMLRevogrRowHeadersElementEventMap &
HTMLRevogrScrollVirtualElementEventMap &
HTMLRevogrViewportScrollElementEventMap &
HTMLVnodeHtmlElementEventMap;

interface HTMLRevoGridElementEventMap extends CombinedHTMLRevoGridElementEventMap {
//
}
}
10 changes: 10 additions & 0 deletions src/types/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {
DataLookup,
HyperFunc,
ColumnDataSchemaModel,
PositionItem,
} from './interfaces';

export type RowIndex = number;
Expand Down Expand Up @@ -102,6 +103,15 @@ export type SaveDataDetails = {

export type BeforeEdit = BeforeSaveDataDetails;

export type RowDragStartDetails = {
cell: Cell;
text: string;
pos: PositionItem;
event: MouseEvent;
rowType: DimensionRows;
model: any;
};

export interface BeforeSaveDataDetails extends ColumnDataSchemaModel {
/**
* Value from editor to save, not part of the model value yet
Expand Down

0 comments on commit ec9aef3

Please sign in to comment.