diff --git a/docs b/docs index bcc98483..9825b688 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit bcc98483c3c385dd062b5ce5b63459e6f1b8d115 +Subproject commit 9825b688ceacb195cdad228d2a189d5bfb4bb256 diff --git a/packages/angular b/packages/angular index e0faf8df..57549cda 160000 --- a/packages/angular +++ b/packages/angular @@ -1 +1 @@ -Subproject commit e0faf8dfcc39ddf2e5d03e594166fd553134be33 +Subproject commit 57549cdac30f4b52662423d2eff620c28625b3ee diff --git a/packages/react b/packages/react index 55e113a9..fe515a9e 160000 --- a/packages/react +++ b/packages/react @@ -1 +1 @@ -Subproject commit 55e113a9805cb6de881d48f856c551090f6a71f5 +Subproject commit fe515a9e2f6f97ffaabe80a8e726c2f4e2f36a29 diff --git a/packages/svelte b/packages/svelte index 898f7071..3f79a4fb 160000 --- a/packages/svelte +++ b/packages/svelte @@ -1 +1 @@ -Subproject commit 898f70718465e8ccdb202a864a085d0c6164f5b0 +Subproject commit 3f79a4fb63feec91af2096e4477564cef0c70cda diff --git a/packages/vue2 b/packages/vue2 index 77886886..fa2c67e6 160000 --- a/packages/vue2 +++ b/packages/vue2 @@ -1 +1 @@ -Subproject commit 77886886e20e7c8ee2ec0a6e99a20a5b36bbc58a +Subproject commit fa2c67e6545a0d055c0b35f94583083149eee9a9 diff --git a/packages/vue3 b/packages/vue3 index 7334976a..9ca46960 160000 --- a/packages/vue3 +++ b/packages/vue3 @@ -1 +1 @@ -Subproject commit 7334976afc28bf540da7b27fd14d67b1d566a9e3 +Subproject commit 9ca46960afc0ad9658ec60fc195788420dca505c diff --git a/src/components.d.ts b/src/components.d.ts index 52919a17..08333b79 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -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"; @@ -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"; @@ -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; @@ -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 }; @@ -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) => void; /** * Emmited when the row headers are changed. */ @@ -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) => void; /** * Row dragged, new range ready to be applied */ diff --git a/src/components/order/revogr-order-editor.tsx b/src/components/order/revogr-order-editor.tsx index a165ba4e..fcf4cb26 100644 --- a/src/components/order/revogr-order-editor.tsx +++ b/src/components/order/revogr-order-editor.tsx @@ -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. @@ -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; /** Row drag ended started */ @Event({ eventName: 'rowdragendinit' }) diff --git a/src/components/revoGrid/revo-grid.tsx b/src/components/revoGrid/revo-grid.tsx index f7b884a1..45d7402b 100644 --- a/src/components/revoGrid/revo-grid.tsx +++ b/src/components/revoGrid/revo-grid.tsx @@ -43,6 +43,7 @@ import type { PluginProviders, FocusAfterRenderEvent, ExtraNodeFuncConfig, + RowDragStartDetails, } from '@type'; import ColumnDataProvider from '../../services/column.data.provider'; @@ -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; /** * On header click. diff --git a/src/plugins/filter/filter.panel.tsx b/src/plugins/filter/filter.panel.tsx index 6ee98fd4..5ba3d078 100644 --- a/src/plugins/filter/filter.panel.tsx +++ b/src/plugins/filter/filter.panel.tsx @@ -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, diff --git a/src/types/plugin.types.ts b/src/types/plugin.types.ts index 8564d052..e3e79586 100644 --- a/src/types/plugin.types.ts +++ b/src/types/plugin.types.ts @@ -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( - pluginClass: new (...args: any[]) => T, - ): T | undefined; + get(): PluginBaseComponent[]; + add(plugin: PluginBaseComponent): void; + remove(plugin: PluginBaseComponent): void; + getByClass( + pluginClass: new (...args: any[]) => T, + ): T | undefined; } /** @@ -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 { - // - } + type CombinedHTMLRevoGridElementEventMap = Record & + HTMLRevogrClipboardElementEventMap & + HTMLRevogrFocusElementEventMap & + HTMLRevogrDataElementEventMap & + HTMLRevogrEditElementEventMap & + HTMLRevogrFilterPanelElementEventMap & + HTMLRevogrHeaderElementEventMap & + HTMLRevogrOrderEditorElementEventMap & + HTMLRevogrOverlaySelectionElementEventMap & + HTMLRevogrRowHeadersElementEventMap & + HTMLRevogrScrollVirtualElementEventMap & + HTMLRevogrViewportScrollElementEventMap & + HTMLVnodeHtmlElementEventMap; + + interface HTMLRevoGridElementEventMap extends CombinedHTMLRevoGridElementEventMap { + // + } } diff --git a/src/types/selection.ts b/src/types/selection.ts index 102e651c..a1410083 100644 --- a/src/types/selection.ts +++ b/src/types/selection.ts @@ -6,6 +6,7 @@ import type { DataLookup, HyperFunc, ColumnDataSchemaModel, + PositionItem, } from './interfaces'; export type RowIndex = number; @@ -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