@toolbox-web/grid 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +15 -3
  2. package/all.js +2 -2
  3. package/all.js.map +1 -1
  4. package/index.js +1 -1
  5. package/index.js.map +1 -1
  6. package/lib/core/types.d.ts +47 -31
  7. package/lib/plugins/clipboard/index.js.map +1 -1
  8. package/lib/plugins/column-virtualization/index.js.map +1 -1
  9. package/lib/plugins/context-menu/index.js.map +1 -1
  10. package/lib/plugins/editing/index.js.map +1 -1
  11. package/lib/plugins/export/index.js.map +1 -1
  12. package/lib/plugins/filtering/index.js.map +1 -1
  13. package/lib/plugins/grouping-columns/index.js.map +1 -1
  14. package/lib/plugins/grouping-rows/index.js.map +1 -1
  15. package/lib/plugins/master-detail/index.js.map +1 -1
  16. package/lib/plugins/multi-sort/index.js.map +1 -1
  17. package/lib/plugins/pinned-columns/index.js.map +1 -1
  18. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +28 -4
  19. package/lib/plugins/pinned-rows/index.d.ts +3 -2
  20. package/lib/plugins/pinned-rows/index.js +1 -1
  21. package/lib/plugins/pinned-rows/index.js.map +1 -1
  22. package/lib/plugins/pinned-rows/pinned-rows.d.ts +29 -1
  23. package/lib/plugins/pinned-rows/types.d.ts +96 -9
  24. package/lib/plugins/pivot/index.js.map +1 -1
  25. package/lib/plugins/print/index.js.map +1 -1
  26. package/lib/plugins/reorder-columns/index.js.map +1 -1
  27. package/lib/plugins/reorder-rows/index.js.map +1 -1
  28. package/lib/plugins/responsive/index.js +1 -1
  29. package/lib/plugins/responsive/index.js.map +1 -1
  30. package/lib/plugins/row-drag-drop/index.js.map +1 -1
  31. package/lib/plugins/row-drag-drop/types.d.ts +7 -0
  32. package/lib/plugins/selection/index.js.map +1 -1
  33. package/lib/plugins/server-side/index.js.map +1 -1
  34. package/lib/plugins/tooltip/index.js.map +1 -1
  35. package/lib/plugins/tree/index.js.map +1 -1
  36. package/lib/plugins/undo-redo/index.js.map +1 -1
  37. package/lib/plugins/visibility/VisibilityPlugin.d.ts +0 -11
  38. package/lib/plugins/visibility/index.d.ts +1 -2
  39. package/lib/plugins/visibility/index.js.map +1 -1
  40. package/lib/plugins/visibility/types.d.ts +32 -0
  41. package/package.json +1 -1
  42. package/public.d.ts +28 -67
  43. package/umd/grid.all.umd.js +1 -1
  44. package/umd/grid.all.umd.js.map +1 -1
  45. package/umd/grid.umd.js +1 -1
  46. package/umd/grid.umd.js.map +1 -1
  47. package/umd/plugins/pinned-rows.umd.js +1 -1
  48. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  49. package/umd/plugins/responsive.umd.js +1 -1
  50. package/umd/plugins/responsive.umd.js.map +1 -1
  51. package/umd/plugins/visibility.umd.js.map +1 -1
@@ -69,7 +69,39 @@ export interface ColumnGroupInfo {
69
69
  */
70
70
  fields: string[];
71
71
  }
72
+ /**
73
+ * Detail for `column-reorder-request` events emitted when users drag-drop
74
+ * columns in the visibility sidebar panel.
75
+ *
76
+ * This event is consumed by `ReorderPlugin` to actually perform the column
77
+ * move; if `ReorderPlugin` is not loaded, the event is informational only.
78
+ */
79
+ export interface ColumnReorderRequestDetail {
80
+ /** The field name of the column to move. */
81
+ field: string;
82
+ /** The source index in the column order (before the move). */
83
+ fromIndex: number;
84
+ /** The target index in the column order (after the move). */
85
+ toIndex: number;
86
+ }
72
87
  declare module '../../core/types' {
88
+ interface DataGridEventMap {
89
+ /**
90
+ * Fired when the user drag-reorders columns in the visibility sidebar panel.
91
+ * Consumed by `ReorderPlugin` to perform the actual column move.
92
+ * @group Visibility Events
93
+ */
94
+ 'column-reorder-request': ColumnReorderRequestDetail;
95
+ /**
96
+ * Fired when a column is shown or hidden — either via the visibility
97
+ * sidebar, `grid.toggleColumnVisibility(field)`, `grid.setColumnVisible(field, visible)`,
98
+ * or `grid.showAllColumns()`. The `field` and `visible` properties are
99
+ * present for single-column toggles and undefined for bulk operations
100
+ * (`showAllColumns`); `visibleColumns` always lists the current set.
101
+ * @group Visibility Events
102
+ */
103
+ 'column-visibility': ColumnVisibilityDetail;
104
+ }
73
105
  interface PluginNameMap {
74
106
  visibility: import('./VisibilityPlugin').VisibilityPlugin;
75
107
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolbox-web/grid",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "description": "Zero-dependency, framework-agnostic data grid web component with virtualization, sorting, filtering, editing, and 20+ plugins. Works in vanilla JS, React, Vue, Angular, and any framework.",
5
5
  "type": "module",
6
6
  "main": "./index.js",
package/public.d.ts CHANGED
@@ -79,32 +79,16 @@ export declare function queryGrid<TRow = unknown>(selector: string, parent: Pare
79
79
  export declare function queryGrid<TRow = unknown>(selector: string, awaitUpgrade: true): Promise<DataGridElement<TRow> | null>;
80
80
  export declare function queryGrid<TRow = unknown>(selector: string, parent: ParentNode, awaitUpgrade: true): Promise<DataGridElement<TRow> | null>;
81
81
  /**
82
- * Event name constants for DataGrid (public API).
82
+ * Event-name constants for DataGrid (public API).
83
83
  *
84
- * Use these constants instead of string literals for type-safe event handling.
84
+ * @deprecated Use string literals directly with the typed `DataGridEventMap`
85
+ * (or import a framework adapter that wires events declaratively, such as
86
+ * `EventProps` in `@toolbox-web/grid-react` or output bindings in
87
+ * `@toolbox-web/grid-angular`). This object is unmaintained — entries may
88
+ * reference events that no longer exist or miss new ones. It will be removed
89
+ * in a future major release.
85
90
  *
86
- * @example
87
- * ```typescript
88
- * import { DGEvents } from '@toolbox-web/grid';
89
- *
90
- * // Type-safe event listening
91
- * grid.addEventListener(DGEvents.CELL_CLICK, (e) => {
92
- * console.log('Cell clicked:', e.detail);
93
- * });
94
- *
95
- * grid.addEventListener(DGEvents.SORT_CHANGE, (e) => {
96
- * const { field, direction } = e.detail;
97
- * console.log(`Sorted by ${field}`);
98
- * });
99
- *
100
- * grid.addEventListener(DGEvents.CELL_COMMIT, (e) => {
101
- * // Save edited value
102
- * saveToServer(e.detail.row);
103
- * });
104
- * ```
105
- *
106
- * @see {@link PluginEvents} for plugin-specific events
107
- * @see {@link DataGridEventMap} for event detail types
91
+ * @see {@link DataGridEventMap} — the canonical, type-checked event registry
108
92
  * @category Events
109
93
  */
110
94
  export declare const DGEvents: {
@@ -131,46 +115,27 @@ export declare const DGEvents: {
131
115
  /**
132
116
  * Union type of all DataGrid event names.
133
117
  *
134
- * @example
135
- * ```typescript
136
- * function addListener(grid: DataGridElement, event: DGEventName): void {
137
- * grid.addEventListener(event, (e) => console.log(e));
138
- * }
139
- * ```
118
+ * @deprecated Use `keyof DataGridEventMap` for a maintained, type-checked
119
+ * union that includes plugin events. Will be removed in a future major
120
+ * release alongside {@link DGEvents}.
140
121
  *
141
- * @see {@link DGEvents} for event constants
142
122
  * @category Events
143
123
  */
144
124
  export type DGEventName = (typeof DGEvents)[keyof typeof DGEvents];
145
125
  /**
146
- * Plugin event constants (mirrors DGEvents pattern).
147
- *
148
- * Events emitted by built-in plugins. Import the relevant plugin
149
- * to access these events.
150
- *
151
- * @example
152
- * ```typescript
153
- * import { PluginEvents } from '@toolbox-web/grid';
154
- * import { SelectionPlugin } from '@toolbox-web/grid/all';
155
- *
156
- * // Listen for selection changes
157
- * grid.addEventListener(PluginEvents.SELECTION_CHANGE, (e) => {
158
- * console.log('Selected rows:', e.detail.selectedRows);
159
- * });
160
- *
161
- * // Listen for filter changes
162
- * grid.addEventListener(PluginEvents.FILTER_CHANGE, (e) => {
163
- * console.log('Active filters:', e.detail);
164
- * });
165
- *
166
- * // Listen for tree expand/collapse
167
- * grid.addEventListener(PluginEvents.TREE_EXPAND, (e) => {
168
- * const { row, expanded } = e.detail;
169
- * console.log(`Row ${expanded ? 'expanded' : 'collapsed'}`);
170
- * });
171
- * ```
172
- *
173
- * @see {@link DGEvents} for core grid events
126
+ * Plugin event-name constants (mirrors {@link DGEvents} pattern).
127
+ *
128
+ * @deprecated Use string literals directly with the typed `DataGridEventMap`,
129
+ * which is augmented automatically when plugin modules are imported. This
130
+ * object is unmaintained — several entries here (`TREE_LOAD_START`,
131
+ * `TREE_LOAD_END`, `TREE_LOAD_ERROR`, `SORT_MODEL_CHANGE`, `EXPORT_START`,
132
+ * `CLIPBOARD_COPY`, `CLIPBOARD_PASTE`, `CONTEXT_MENU_CLOSE`,
133
+ * `HISTORY_CHANGE`, `SERVER_LOADING`, `SERVER_ERROR`,
134
+ * `COLUMN_VISIBILITY_CHANGE`, `COLUMN_REORDER`) reference events that are
135
+ * not actually emitted by any plugin. Will be removed in a future major
136
+ * release.
137
+ *
138
+ * @see {@link DataGridEventMap}
174
139
  * @category Events
175
140
  */
176
141
  export declare const PluginEvents: {
@@ -198,18 +163,14 @@ export declare const PluginEvents: {
198
163
  /**
199
164
  * Union type of all plugin event names.
200
165
  *
201
- * @example
202
- * ```typescript
203
- * function addPluginListener(grid: DataGridElement, event: PluginEventName): void {
204
- * grid.addEventListener(event, (e) => console.log(e));
205
- * }
206
- * ```
166
+ * @deprecated Use `keyof DataGridEventMap` (after importing plugin modules)
167
+ * instead. Will be removed alongside {@link PluginEvents} in a future major
168
+ * release.
207
169
  *
208
- * @see {@link PluginEvents} for event constants
209
170
  * @category Events
210
171
  */
211
172
  export type PluginEventName = (typeof PluginEvents)[keyof typeof PluginEvents];
212
- export type { A11yConfig, A11yMessages, AggregatorRef, AnimationConfig, AnimationMode, AnimationStyle, BaseColumnConfig, CellActivateDetail, CellActivateTrigger, CellChangeDetail, CellClickDetail, CellRenderContext, ColumnConfig, ColumnConfigMap, ColumnEditorContext, ColumnEditorSpec, ColumnResizeDetail, ColumnSortState, ColumnState, ColumnType, ColumnViewRenderer, DataChangeDetail, DataGridCustomEvent, DataGridElement as DataGridElementInterface, DataGridEventMap, ExpandCollapseAnimation, ExternalMountEditorDetail, ExternalMountViewDetail, FeatureConfig, FitMode, FrameworkAdapter, GridColumnState, GridConfig, GridIcons, GridPlugin, HeaderCellContext, HeaderContentDefinition, HeaderLabelContext, HeaderLabelRenderer, HeaderRenderer, IconValue, InferredColumnResult, LoadingContext, LoadingRenderer, LoadingSize, PrimitiveColumnType, PublicGrid, RowAnimationType, RowClickDetail, RowGroupRenderConfig, RowTransaction, RowUpdate, ScrollToRowOptions, ShellConfig, ShellHeaderConfig, SortChangeDetail, SortHandler, SortState, TbwScrollDetail, ToolbarContentDefinition, ToolPanelConfig, ToolPanelDefinition, TransactionResult, TypeDefault, UpdateSource, } from './lib/core/types';
173
+ export type { A11yConfig, A11yMessages, AggregatorRef, AnimationConfig, AnimationMode, AnimationStyle, BaseColumnConfig, CellActivateDetail, CellActivateTrigger, CellChangeDetail, CellClickDetail, CellRenderContext, ColumnConfig, ColumnConfigMap, ColumnEditorContext, ColumnEditorSpec, ColumnResizeDetail, ColumnResizeResetDetail, ColumnSortState, ColumnState, ColumnType, ColumnViewRenderer, DataChangeDetail, DataGridCustomEvent, DataGridEventMap, ExpandCollapseAnimation, ExternalMountEditorDetail, ExternalMountViewDetail, FeatureConfig, FitMode, FrameworkAdapter, GridColumnState, GridConfig, GridIcons, GridPlugin, HeaderCellContext, HeaderContentDefinition, HeaderLabelContext, HeaderLabelRenderer, HeaderRenderer, IconValue, InferredColumnResult, LoadingContext, LoadingRenderer, LoadingSize, PrimitiveColumnType, PublicGrid, RowAnimationType, RowClickDetail, RowGroupRenderConfig, RowTransaction, RowUpdate, ScrollToRowOptions, ShellConfig, ShellHeaderConfig, SortChangeDetail, SortHandler, SortState, TbwScrollDetail, ToolbarContentDefinition, ToolPanelConfig, ToolPanelDefinition, TransactionResult, TypeDefault, UpdateSource, } from './lib/core/types';
213
174
  export { DEFAULT_A11Y_MESSAGES, DEFAULT_ANIMATION_CONFIG, DEFAULT_GRID_ICONS, FitModeEnum } from './lib/core/types';
214
175
  export { builtInSort, defaultComparator } from './lib/core/internal/sorting';
215
176
  export { CORE_CONSUMED_ADAPTER_METHODS } from './lib/core/adapter-conformance';