@toolbox-web/grid 0.0.3 → 0.0.5

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 (63) hide show
  1. package/all.d.ts +50 -6
  2. package/all.js +101 -98
  3. package/all.js.map +1 -1
  4. package/index.d.ts +54 -0
  5. package/index.js +793 -692
  6. package/index.js.map +1 -1
  7. package/lib/plugins/clipboard/index.js +55 -35
  8. package/lib/plugins/clipboard/index.js.map +1 -1
  9. package/lib/plugins/column-virtualization/index.js +49 -29
  10. package/lib/plugins/column-virtualization/index.js.map +1 -1
  11. package/lib/plugins/context-menu/index.js +35 -15
  12. package/lib/plugins/context-menu/index.js.map +1 -1
  13. package/lib/plugins/export/index.js +52 -32
  14. package/lib/plugins/export/index.js.map +1 -1
  15. package/lib/plugins/filtering/index.js +116 -99
  16. package/lib/plugins/filtering/index.js.map +1 -1
  17. package/lib/plugins/grouping-columns/index.js +42 -22
  18. package/lib/plugins/grouping-columns/index.js.map +1 -1
  19. package/lib/plugins/grouping-rows/index.js +20 -0
  20. package/lib/plugins/grouping-rows/index.js.map +1 -1
  21. package/lib/plugins/master-detail/index.js +50 -27
  22. package/lib/plugins/master-detail/index.js.map +1 -1
  23. package/lib/plugins/multi-sort/index.js +25 -5
  24. package/lib/plugins/multi-sort/index.js.map +1 -1
  25. package/lib/plugins/pinned-columns/index.js +20 -0
  26. package/lib/plugins/pinned-columns/index.js.map +1 -1
  27. package/lib/plugins/pinned-rows/index.js +20 -0
  28. package/lib/plugins/pinned-rows/index.js.map +1 -1
  29. package/lib/plugins/pivot/index.js +20 -0
  30. package/lib/plugins/pivot/index.js.map +1 -1
  31. package/lib/plugins/reorder/index.js +56 -33
  32. package/lib/plugins/reorder/index.js.map +1 -1
  33. package/lib/plugins/selection/index.js +138 -100
  34. package/lib/plugins/selection/index.js.map +1 -1
  35. package/lib/plugins/server-side/index.js +20 -0
  36. package/lib/plugins/server-side/index.js.map +1 -1
  37. package/lib/plugins/tree/index.js +76 -53
  38. package/lib/plugins/tree/index.js.map +1 -1
  39. package/lib/plugins/undo-redo/index.js +20 -0
  40. package/lib/plugins/undo-redo/index.js.map +1 -1
  41. package/lib/plugins/visibility/index.js +20 -0
  42. package/lib/plugins/visibility/index.js.map +1 -1
  43. package/package.json +4 -1
  44. package/themes/dg-theme-contrast.css +43 -43
  45. package/themes/dg-theme-large.css +54 -54
  46. package/themes/dg-theme-standard.css +19 -19
  47. package/themes/dg-theme-vibrant.css +16 -16
  48. package/umd/grid.all.umd.js +24 -24
  49. package/umd/grid.all.umd.js.map +1 -1
  50. package/umd/grid.umd.js +14 -14
  51. package/umd/grid.umd.js.map +1 -1
  52. package/umd/plugins/filtering.umd.js +3 -3
  53. package/umd/plugins/filtering.umd.js.map +1 -1
  54. package/umd/plugins/master-detail.umd.js +2 -2
  55. package/umd/plugins/master-detail.umd.js.map +1 -1
  56. package/umd/plugins/multi-sort.umd.js.map +1 -1
  57. package/umd/plugins/reorder.umd.js +1 -1
  58. package/umd/plugins/reorder.umd.js.map +1 -1
  59. package/umd/plugins/selection.umd.js +2 -2
  60. package/umd/plugins/selection.umd.js.map +1 -1
  61. package/umd/plugins/tree.umd.js +2 -2
  62. package/umd/plugins/tree.umd.js.map +1 -1
  63. package/umd/plugins/visibility.umd.js.map +1 -1
package/index.d.ts CHANGED
@@ -180,6 +180,24 @@ export declare abstract class BaseGridPlugin<TConfig = unknown> {
180
180
  * Get the shadow root of the grid.
181
181
  */
182
182
  protected get shadowRoot(): ShadowRoot | null;
183
+ /**
184
+ * Get the disconnect signal for event listener cleanup.
185
+ * This signal is aborted when the grid disconnects from the DOM.
186
+ * Use this when adding event listeners that should be cleaned up automatically.
187
+ *
188
+ * Best for:
189
+ * - Document/window-level listeners added in attach()
190
+ * - Listeners on the grid element itself
191
+ * - Any listener that should persist across renders
192
+ *
193
+ * Not needed for:
194
+ * - Listeners on elements created in afterRender() (removed with element)
195
+ *
196
+ * @example
197
+ * element.addEventListener('click', handler, { signal: this.disconnectSignal });
198
+ * document.addEventListener('keydown', handler, { signal: this.disconnectSignal });
199
+ */
200
+ protected get disconnectSignal(): AbortSignal;
183
201
  /**
184
202
  * Log a warning message.
185
203
  */
@@ -261,6 +279,22 @@ export declare abstract class BaseGridPlugin<TConfig = unknown> {
261
279
  * ```
262
280
  */
263
281
  afterRender?(): void;
282
+ /**
283
+ * Called after scroll-triggered row rendering completes.
284
+ * This is a lightweight hook for applying visual state to recycled DOM elements.
285
+ * Use this instead of afterRender when you need to reapply styling during scroll.
286
+ *
287
+ * Performance note: This is called frequently during scroll. Keep implementation fast.
288
+ *
289
+ * @example
290
+ * ```ts
291
+ * onScrollRender(): void {
292
+ * // Reapply selection state to visible cells
293
+ * this.applySelectionToVisibleCells();
294
+ * }
295
+ * ```
296
+ */
297
+ onScrollRender?(): void;
264
298
  /**
265
299
  * Render a custom row, bypassing the default row rendering.
266
300
  * Use this for special row types like group headers, detail rows, or footers.
@@ -910,6 +944,14 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
910
944
  get editOn(): string | undefined;
911
945
  set editOn(value: string | undefined);
912
946
  get effectiveConfig(): GridConfig<T>;
947
+ /**
948
+ * Get the disconnect signal for event listener cleanup.
949
+ * This signal is aborted when the grid disconnects from the DOM.
950
+ * Plugins and internal code can use this for automatic listener cleanup.
951
+ * @example
952
+ * element.addEventListener('click', handler, { signal: this.grid.disconnectSignal });
953
+ */
954
+ get disconnectSignal(): AbortSignal;
913
955
  constructor();
914
956
  /**
915
957
  * Get a plugin instance by its class.
@@ -1477,6 +1519,8 @@ export declare interface GridElement {
1477
1519
  rows: any[];
1478
1520
  columns: ColumnConfig[];
1479
1521
  gridConfig: any;
1522
+ /** AbortSignal that is aborted when the grid disconnects from the DOM */
1523
+ disconnectSignal: AbortSignal;
1480
1524
  requestRender(): void;
1481
1525
  requestAfterRender(): void;
1482
1526
  forceLayout(): Promise<void>;
@@ -1844,6 +1888,11 @@ export declare class PluginManager {
1844
1888
  * Execute afterRender hook on all plugins.
1845
1889
  */
1846
1890
  afterRender(): void;
1891
+ /**
1892
+ * Execute onScrollRender hook on all plugins.
1893
+ * Called after scroll-triggered row rendering for lightweight visual state updates.
1894
+ */
1895
+ onScrollRender(): void;
1847
1896
  /**
1848
1897
  * Execute renderRow hook on all plugins.
1849
1898
  * Returns true if any plugin handled the row.
@@ -2077,6 +2126,11 @@ export declare class SelectionPlugin extends BaseGridPlugin<SelectionConfig> {
2077
2126
  onCellMouseMove(event: CellMouseEvent): boolean | void;
2078
2127
  onCellMouseUp(_event: CellMouseEvent): boolean | void;
2079
2128
  afterRender(): void;
2129
+ /**
2130
+ * Called after scroll-triggered row rendering.
2131
+ * Reapplies selection classes to recycled DOM elements.
2132
+ */
2133
+ onScrollRender(): void;
2080
2134
  /**
2081
2135
  * Get the selected cell (cell mode only).
2082
2136
  */