@toolbox-web/grid 0.4.1 → 0.5.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 (176) hide show
  1. package/README.md +9 -13
  2. package/all.js +1678 -1588
  3. package/all.js.map +1 -1
  4. package/index.js +762 -568
  5. package/index.js.map +1 -1
  6. package/lib/core/grid.d.ts +21 -0
  7. package/lib/core/grid.d.ts.map +1 -1
  8. package/lib/core/internal/config-manager.d.ts +1 -0
  9. package/lib/core/internal/config-manager.d.ts.map +1 -1
  10. package/lib/core/internal/dom-builder.d.ts +2 -0
  11. package/lib/core/internal/dom-builder.d.ts.map +1 -1
  12. package/lib/core/internal/header.d.ts.map +1 -1
  13. package/lib/core/internal/keyboard.d.ts.map +1 -1
  14. package/lib/core/internal/resize.d.ts.map +1 -1
  15. package/lib/core/internal/rows.d.ts.map +1 -1
  16. package/lib/core/internal/shell.d.ts +19 -13
  17. package/lib/core/internal/shell.d.ts.map +1 -1
  18. package/lib/core/internal/utils.d.ts +1 -0
  19. package/lib/core/internal/utils.d.ts.map +1 -1
  20. package/lib/core/plugin/base-plugin.d.ts +70 -3
  21. package/lib/core/plugin/base-plugin.d.ts.map +1 -1
  22. package/lib/core/plugin/expander-column.d.ts +51 -0
  23. package/lib/core/plugin/expander-column.d.ts.map +1 -0
  24. package/lib/core/plugin/plugin-manager.d.ts +6 -2
  25. package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
  26. package/lib/core/plugin/types.d.ts +117 -1
  27. package/lib/core/plugin/types.d.ts.map +1 -1
  28. package/lib/core/types.d.ts +10 -5
  29. package/lib/core/types.d.ts.map +1 -1
  30. package/lib/plugins/clipboard/ClipboardPlugin.d.ts +5 -4
  31. package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -1
  32. package/lib/plugins/clipboard/index.d.ts +1 -1
  33. package/lib/plugins/clipboard/index.d.ts.map +1 -1
  34. package/lib/plugins/clipboard/index.js +295 -190
  35. package/lib/plugins/clipboard/index.js.map +1 -1
  36. package/lib/plugins/clipboard/types.d.ts +72 -2
  37. package/lib/plugins/clipboard/types.d.ts.map +1 -1
  38. package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts +0 -1
  39. package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts.map +1 -1
  40. package/lib/plugins/column-virtualization/index.js +143 -56
  41. package/lib/plugins/column-virtualization/index.js.map +1 -1
  42. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +0 -1
  43. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
  44. package/lib/plugins/context-menu/index.js +189 -102
  45. package/lib/plugins/context-menu/index.js.map +1 -1
  46. package/lib/plugins/editing/EditingPlugin.d.ts +2 -7
  47. package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
  48. package/lib/plugins/editing/index.js +227 -150
  49. package/lib/plugins/editing/index.js.map +1 -1
  50. package/lib/plugins/export/ExportPlugin.d.ts +0 -1
  51. package/lib/plugins/export/ExportPlugin.d.ts.map +1 -1
  52. package/lib/plugins/export/index.js +184 -97
  53. package/lib/plugins/export/index.js.map +1 -1
  54. package/lib/plugins/filtering/FilteringPlugin.d.ts +14 -3
  55. package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
  56. package/lib/plugins/filtering/index.js +296 -176
  57. package/lib/plugins/filtering/index.js.map +1 -1
  58. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +2 -2
  59. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
  60. package/lib/plugins/grouping-columns/grouping-columns.d.ts +1 -1
  61. package/lib/plugins/grouping-columns/grouping-columns.d.ts.map +1 -1
  62. package/lib/plugins/grouping-columns/index.js +169 -61
  63. package/lib/plugins/grouping-columns/index.js.map +1 -1
  64. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +14 -2
  65. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
  66. package/lib/plugins/grouping-rows/index.js +243 -140
  67. package/lib/plugins/grouping-rows/index.js.map +1 -1
  68. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +13 -11
  69. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -1
  70. package/lib/plugins/master-detail/index.js +278 -196
  71. package/lib/plugins/master-detail/index.js.map +1 -1
  72. package/lib/plugins/master-detail/types.d.ts +0 -10
  73. package/lib/plugins/master-detail/types.d.ts.map +1 -1
  74. package/lib/plugins/multi-sort/MultiSortPlugin.d.ts +1 -2
  75. package/lib/plugins/multi-sort/MultiSortPlugin.d.ts.map +1 -1
  76. package/lib/plugins/multi-sort/index.js +125 -40
  77. package/lib/plugins/multi-sort/index.js.map +1 -1
  78. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +0 -1
  79. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
  80. package/lib/plugins/pinned-columns/index.js +156 -75
  81. package/lib/plugins/pinned-columns/index.js.map +1 -1
  82. package/lib/plugins/pinned-columns/pinned-columns.d.ts +2 -2
  83. package/lib/plugins/pinned-columns/pinned-columns.d.ts.map +1 -1
  84. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +1 -2
  85. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -1
  86. package/lib/plugins/pinned-rows/index.js +202 -117
  87. package/lib/plugins/pinned-rows/index.js.map +1 -1
  88. package/lib/plugins/pivot/PivotPlugin.d.ts +26 -4
  89. package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
  90. package/lib/plugins/pivot/index.js +413 -314
  91. package/lib/plugins/pivot/index.js.map +1 -1
  92. package/lib/plugins/pivot/pivot-rows.d.ts +2 -1
  93. package/lib/plugins/pivot/pivot-rows.d.ts.map +1 -1
  94. package/lib/plugins/reorder/ReorderPlugin.d.ts +13 -10
  95. package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -1
  96. package/lib/plugins/reorder/index.d.ts +1 -1
  97. package/lib/plugins/reorder/index.d.ts.map +1 -1
  98. package/lib/plugins/reorder/index.js +296 -223
  99. package/lib/plugins/reorder/index.js.map +1 -1
  100. package/lib/plugins/selection/SelectionPlugin.d.ts +21 -3
  101. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
  102. package/lib/plugins/selection/index.d.ts +2 -2
  103. package/lib/plugins/selection/index.d.ts.map +1 -1
  104. package/lib/plugins/selection/index.js +282 -141
  105. package/lib/plugins/selection/index.js.map +1 -1
  106. package/lib/plugins/selection/types.d.ts +24 -0
  107. package/lib/plugins/selection/types.d.ts.map +1 -1
  108. package/lib/plugins/server-side/ServerSidePlugin.d.ts +0 -1
  109. package/lib/plugins/server-side/ServerSidePlugin.d.ts.map +1 -1
  110. package/lib/plugins/server-side/index.js +96 -9
  111. package/lib/plugins/server-side/index.js.map +1 -1
  112. package/lib/plugins/tree/TreePlugin.d.ts +5 -1
  113. package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
  114. package/lib/plugins/tree/index.js +209 -113
  115. package/lib/plugins/tree/index.js.map +1 -1
  116. package/lib/plugins/tree/types.d.ts +0 -10
  117. package/lib/plugins/tree/types.d.ts.map +1 -1
  118. package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts +0 -1
  119. package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts.map +1 -1
  120. package/lib/plugins/undo-redo/index.js +98 -11
  121. package/lib/plugins/undo-redo/index.js.map +1 -1
  122. package/lib/plugins/visibility/VisibilityPlugin.d.ts +7 -4
  123. package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -1
  124. package/lib/plugins/visibility/index.js +155 -64
  125. package/lib/plugins/visibility/index.js.map +1 -1
  126. package/package.json +1 -1
  127. package/themes/dg-theme-bootstrap.css +55 -53
  128. package/themes/dg-theme-contrast.css +42 -40
  129. package/themes/dg-theme-large.css +38 -37
  130. package/themes/dg-theme-material.css +54 -52
  131. package/themes/dg-theme-standard.css +19 -17
  132. package/themes/dg-theme-vibrant.css +16 -14
  133. package/umd/grid.all.umd.js +23 -24
  134. package/umd/grid.all.umd.js.map +1 -1
  135. package/umd/grid.umd.js +12 -11
  136. package/umd/grid.umd.js.map +1 -1
  137. package/umd/plugins/clipboard.umd.js +5 -7
  138. package/umd/plugins/clipboard.umd.js.map +1 -1
  139. package/umd/plugins/column-virtualization.umd.js +1 -1
  140. package/umd/plugins/column-virtualization.umd.js.map +1 -1
  141. package/umd/plugins/context-menu.umd.js +1 -1
  142. package/umd/plugins/context-menu.umd.js.map +1 -1
  143. package/umd/plugins/editing.umd.js +1 -1
  144. package/umd/plugins/editing.umd.js.map +1 -1
  145. package/umd/plugins/export.umd.js +1 -1
  146. package/umd/plugins/export.umd.js.map +1 -1
  147. package/umd/plugins/filtering.umd.js +1 -1
  148. package/umd/plugins/filtering.umd.js.map +1 -1
  149. package/umd/plugins/grouping-columns.umd.js +1 -1
  150. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  151. package/umd/plugins/grouping-rows.umd.js +1 -1
  152. package/umd/plugins/grouping-rows.umd.js.map +1 -1
  153. package/umd/plugins/master-detail.umd.js +1 -1
  154. package/umd/plugins/master-detail.umd.js.map +1 -1
  155. package/umd/plugins/multi-sort.umd.js +1 -1
  156. package/umd/plugins/multi-sort.umd.js.map +1 -1
  157. package/umd/plugins/pinned-columns.umd.js +1 -1
  158. package/umd/plugins/pinned-columns.umd.js.map +1 -1
  159. package/umd/plugins/pinned-rows.umd.js +1 -1
  160. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  161. package/umd/plugins/pivot.umd.js +1 -1
  162. package/umd/plugins/pivot.umd.js.map +1 -1
  163. package/umd/plugins/reorder.umd.js +1 -1
  164. package/umd/plugins/reorder.umd.js.map +1 -1
  165. package/umd/plugins/selection.umd.js +1 -1
  166. package/umd/plugins/selection.umd.js.map +1 -1
  167. package/umd/plugins/server-side.umd.js +1 -1
  168. package/umd/plugins/server-side.umd.js.map +1 -1
  169. package/umd/plugins/tree.umd.js +1 -1
  170. package/umd/plugins/tree.umd.js.map +1 -1
  171. package/umd/plugins/undo-redo.umd.js +1 -1
  172. package/umd/plugins/undo-redo.umd.js.map +1 -1
  173. package/umd/plugins/visibility.umd.js +1 -1
  174. package/umd/plugins/visibility.umd.js.map +1 -1
  175. package/lib/core/internal/editing.d.ts +0 -76
  176. package/lib/core/internal/editing.d.ts.map +0 -1
@@ -1,8 +1,25 @@
1
+ import { GridElement } from '../../core/plugin/base-plugin';
1
2
  /**
2
- * Clipboard Plugin Types
3
+ * Custom paste handler function.
3
4
  *
4
- * Type definitions for clipboard copy/paste functionality.
5
+ * @param detail - The parsed paste data with target and field info
6
+ * @param grid - The grid element to update
7
+ * @returns `false` to prevent the default paste behavior, or `void`/`true` to allow it
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * // Custom handler that validates before pasting
12
+ * new ClipboardPlugin({
13
+ * pasteHandler: (detail, grid) => {
14
+ * if (!detail.target) return false;
15
+ * // Apply custom validation/transformation...
16
+ * applyPasteData(detail, grid);
17
+ * return false; // We handled it, skip default
18
+ * }
19
+ * })
20
+ * ```
5
21
  */
22
+ export type PasteHandler = (detail: PasteDetail, grid: GridElement) => boolean | void;
6
23
  /** Configuration options for the clipboard plugin */
7
24
  export interface ClipboardConfig {
8
25
  /** Include column headers in copied text (default: false) */
@@ -15,6 +32,17 @@ export interface ClipboardConfig {
15
32
  quoteStrings?: boolean;
16
33
  /** Custom cell value processor for copy operations */
17
34
  processCell?: (value: unknown, field: string, row: unknown) => string;
35
+ /**
36
+ * Custom paste handler. By default, the plugin applies pasted data to `grid.rows`
37
+ * starting at the target cell.
38
+ *
39
+ * - Set to a custom function to handle paste yourself
40
+ * - Set to `null` to disable auto-paste (event still fires)
41
+ * - Return `false` from handler to prevent default behavior
42
+ *
43
+ * @default defaultPasteHandler (auto-applies paste data)
44
+ */
45
+ pasteHandler?: PasteHandler | null;
18
46
  }
19
47
  /** Internal state managed by the clipboard plugin */
20
48
  export interface ClipboardState {
@@ -30,11 +58,53 @@ export interface CopyDetail {
30
58
  /** Number of columns copied */
31
59
  columnCount: number;
32
60
  }
61
+ /** Target cell coordinates and bounds for paste operations */
62
+ export interface PasteTarget {
63
+ /** Target row index (top-left of paste area) */
64
+ row: number;
65
+ /** Target column index (top-left of paste area) */
66
+ col: number;
67
+ /** Target column field name (for easy data mapping) */
68
+ field: string;
69
+ /**
70
+ * Selection bounds that constrain the paste area.
71
+ * If set, paste data will be clipped to fit within these bounds.
72
+ * If null, paste expands freely from the target cell.
73
+ */
74
+ bounds: {
75
+ /** End row index (inclusive) */
76
+ endRow: number;
77
+ /** End column index (inclusive) */
78
+ endCol: number;
79
+ } | null;
80
+ }
33
81
  /** Event detail emitted after a paste operation */
34
82
  export interface PasteDetail {
35
83
  /** Parsed rows from clipboard (2D array of cell values) */
36
84
  rows: string[][];
37
85
  /** Raw text that was pasted */
38
86
  text: string;
87
+ /** The target cell where paste starts (top-left of paste area). Null if no cell is selected. */
88
+ target: PasteTarget | null;
89
+ /**
90
+ * Column fields for each column in the paste range, starting from target.col.
91
+ * Useful for mapping parsed cell values to data fields.
92
+ * Length matches the width of the pasted data (or available columns, whichever is smaller).
93
+ */
94
+ fields: string[];
39
95
  }
96
+ /**
97
+ * Default paste handler that applies pasted data to grid.rows.
98
+ *
99
+ * This is the built-in handler used when no custom `pasteHandler` is configured.
100
+ * It clones the rows array for immutability and applies values starting at the target cell.
101
+ *
102
+ * Behavior:
103
+ * - Single cell selection: paste expands freely, adds new rows if needed
104
+ * - Range/row selection: paste is clipped to fit within selection bounds
105
+ *
106
+ * @param detail - The parsed paste data from clipboard
107
+ * @param grid - The grid element to update
108
+ */
109
+ export declare function defaultPasteHandler(detail: PasteDetail, grid: GridElement): void;
40
110
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/clipboard/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,qDAAq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MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,CAiDhF"}
@@ -11,7 +11,6 @@ import { ColumnVirtualizationConfig } from './types';
11
11
  */
12
12
  export declare class ColumnVirtualizationPlugin extends BaseGridPlugin<ColumnVirtualizationConfig> {
13
13
  readonly name = "columnVirtualization";
14
- readonly version = "1.0.0";
15
14
  protected get defaultConfig(): Partial<ColumnVirtualizationConfig>;
16
15
  private isVirtualized;
17
16
  private startCol;
@@ -1 +1 @@
1
- {"version":3,"file":"ColumnVirtualizationPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAQrD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;;;GAOG;AACH,qBAAa,0BAA2B,SAAQ,cAAc,CAAC,0BAA0B,CAAC;IACxF,QAAQ,CAAC,IAAI,0BAA0B;IACvC,SAAkB,OAAO,WAAW;IAEpC,cAAuB,aAAa,IAAI,OAAO,CAAC,0BAA0B,CAAC,CAM1E;IAGD,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,aAAa,CAAgB;IAK5B,MAAM,CAAC,IAAI,EAAE,OAAO,+BAA+B,EAAE,WAAW,GAAG,IAAI;IAWvE,MAAM,IAAI,IAAI;IAad,cAAc,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,YAAY,EAAE;IAgChE,WAAW,IAAI,IAAI;IA2BnB,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAiB3C;;OAEG;IACH,gBAAgB,IAAI,OAAO;IAI3B;;OAEG;IACH,qBAAqB,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE;IAIvD;;;OAGG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAOzC;;;OAGG;IACH,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAI5C;;OAEG;IACH,aAAa,IAAI,MAAM;CAIxB"}
1
+ {"version":3,"file":"ColumnVirtualizationPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAQrD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;;;GAOG;AACH,qBAAa,0BAA2B,SAAQ,cAAc,CAAC,0BAA0B,CAAC;IACxF,QAAQ,CAAC,IAAI,0BAA0B;IAEvC,cAAuB,aAAa,IAAI,OAAO,CAAC,0BAA0B,CAAC,CAM1E;IAGD,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,aAAa,CAAgB;IAK5B,MAAM,CAAC,IAAI,EAAE,OAAO,+BAA+B,EAAE,WAAW,GAAG,IAAI;IAWvE,MAAM,IAAI,IAAI;IAad,cAAc,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,YAAY,EAAE;IAgChE,WAAW,IAAI,IAAI;IA2BnB,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAiB3C;;OAEG;IACH,gBAAgB,IAAI,OAAO;IAI3B;;OAEG;IACH,qBAAqB,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE;IAIvD;;;OAGG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAOzC;;;OAGG;IACH,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAI5C;;OAEG;IACH,aAAa,IAAI,MAAM;CAIxB"}
@@ -1,4 +1,4 @@
1
- const m = {
1
+ const C = {
2
2
  expand: "▶",
3
3
  collapse: "▼",
4
4
  sortAsc: "▲",
@@ -8,7 +8,7 @@ const m = {
8
8
  dragHandle: "⋮⋮",
9
9
  toolPanel: "☰"
10
10
  };
11
- class p {
11
+ class b {
12
12
  /**
13
13
  * Plugin dependencies - declare other plugins this one requires.
14
14
  *
@@ -25,8 +25,11 @@ class p {
25
25
  * ```
26
26
  */
27
27
  static dependencies;
28
- /** Plugin version - override in subclass if needed */
29
- version = "1.0.0";
28
+ /**
29
+ * Plugin version - defaults to grid version for built-in plugins.
30
+ * Third-party plugins can override with their own semver.
31
+ */
32
+ version = typeof __GRID_VERSION__ < "u" ? __GRID_VERSION__ : "dev";
30
33
  /** CSS styles to inject into the grid's shadow DOM */
31
34
  styles;
32
35
  /** Custom cell renderers keyed by type name */
@@ -113,12 +116,28 @@ class p {
113
116
  emit(t, e) {
114
117
  this.grid?.dispatchEvent?.(new CustomEvent(t, { detail: e, bubbles: !0 }));
115
118
  }
119
+ /**
120
+ * Emit a cancelable custom event from the grid.
121
+ * @returns `true` if the event was cancelled (preventDefault called), `false` otherwise
122
+ */
123
+ emitCancelable(t, e) {
124
+ const i = new CustomEvent(t, { detail: e, bubbles: !0, cancelable: !0 });
125
+ return this.grid?.dispatchEvent?.(i), i.defaultPrevented;
126
+ }
116
127
  /**
117
128
  * Request a re-render of the grid.
118
129
  */
119
130
  requestRender() {
120
131
  this.grid?.requestRender?.();
121
132
  }
133
+ /**
134
+ * Request a re-render and restore focus styling afterward.
135
+ * Use this when a plugin action (like expand/collapse) triggers a render
136
+ * but needs to maintain keyboard navigation focus.
137
+ */
138
+ requestRenderWithFocus() {
139
+ this.grid?.requestRenderWithFocus?.();
140
+ }
122
141
  /**
123
142
  * Request a lightweight style update without rebuilding DOM.
124
143
  * Use this instead of requestRender() when only CSS classes need updating.
@@ -153,10 +172,34 @@ class p {
153
172
  return this.grid?._visibleColumns ?? [];
154
173
  }
155
174
  /**
156
- * Get the shadow root of the grid.
175
+ * Get the grid as an HTMLElement for direct DOM operations.
176
+ * Use sparingly - prefer the typed GridElementRef API when possible.
177
+ *
178
+ * @example
179
+ * ```ts
180
+ * const width = this.gridElement.clientWidth;
181
+ * this.gridElement.classList.add('my-plugin-active');
182
+ * ```
183
+ */
184
+ get gridElement() {
185
+ return this.grid;
186
+ }
187
+ /**
188
+ * Get the render root of the grid for DOM queries.
189
+ * @deprecated Use `gridElement` instead. This getter exists only for backward compatibility.
190
+ *
191
+ * With Shadow DOM removed, the grid element itself is the render root.
192
+ * All new code should use `this.gridElement` for DOM queries.
193
+ *
194
+ * @example
195
+ * // OLD (deprecated)
196
+ * const rows = this.shadowRoot?.querySelector('.rows');
197
+ *
198
+ * // NEW (preferred)
199
+ * const rows = this.gridElement.querySelector('.rows');
157
200
  */
158
201
  get shadowRoot() {
159
- return this.grid?.shadowRoot ?? null;
202
+ return this.gridElement;
160
203
  }
161
204
  /**
162
205
  * Get the disconnect signal for event listener cleanup.
@@ -184,8 +227,53 @@ class p {
184
227
  */
185
228
  get gridIcons() {
186
229
  const t = this.grid?.gridConfig?.icons ?? {};
187
- return { ...m, ...t };
230
+ return { ...C, ...t };
188
231
  }
232
+ // #region Animation Helpers
233
+ /**
234
+ * Check if animations are enabled at the grid level.
235
+ * Respects gridConfig.animation.mode and the CSS variable set by the grid.
236
+ *
237
+ * Plugins should use this to skip animations when:
238
+ * - Animation mode is 'off' or `false`
239
+ * - User prefers reduced motion and mode is 'reduced-motion' (default)
240
+ *
241
+ * @example
242
+ * ```ts
243
+ * private get animationStyle(): 'slide' | 'fade' | false {
244
+ * if (!this.isAnimationEnabled) return false;
245
+ * return this.config.animation ?? 'slide';
246
+ * }
247
+ * ```
248
+ */
249
+ get isAnimationEnabled() {
250
+ const t = this.grid?.effectiveConfig?.animation?.mode ?? "reduced-motion";
251
+ if (t === !1 || t === "off") return !1;
252
+ if (t === !0 || t === "on") return !0;
253
+ const e = this.gridElement;
254
+ return e ? getComputedStyle(e).getPropertyValue("--tbw-animation-enabled").trim() !== "0" : !0;
255
+ }
256
+ /**
257
+ * Get the animation duration in milliseconds from CSS variable.
258
+ * Falls back to 200ms if not set.
259
+ *
260
+ * Plugins can use this for their animation timing to stay consistent
261
+ * with the grid-level animation.duration setting.
262
+ *
263
+ * @example
264
+ * ```ts
265
+ * element.animate(keyframes, { duration: this.animationDuration });
266
+ * ```
267
+ */
268
+ get animationDuration() {
269
+ const t = this.gridElement;
270
+ if (t) {
271
+ const e = getComputedStyle(t).getPropertyValue("--tbw-animation-duration").trim(), i = parseInt(e, 10);
272
+ if (!isNaN(i)) return i;
273
+ }
274
+ return 200;
275
+ }
276
+ // #endregion
189
277
  /**
190
278
  * Resolve an icon value to string or HTMLElement.
191
279
  * Checks plugin config first, then grid-level icons, then defaults.
@@ -215,63 +303,62 @@ class p {
215
303
  }
216
304
  // #endregion
217
305
  }
218
- const d = 100;
219
- function u(s) {
220
- if (s == null)
221
- return d;
222
- if (typeof s == "number")
223
- return s;
224
- const t = parseFloat(s);
225
- return isNaN(t) ? d : t;
306
+ const h = 100;
307
+ function a(r) {
308
+ if (r == null)
309
+ return h;
310
+ if (typeof r == "number")
311
+ return r;
312
+ const t = parseFloat(r);
313
+ return isNaN(t) ? h : t;
226
314
  }
227
- function c(s) {
228
- return s.map((t) => u(t.width));
315
+ function c(r) {
316
+ return r.map((t) => a(t.width));
229
317
  }
230
- function f(s) {
318
+ function f(r) {
231
319
  const t = [];
232
320
  let e = 0;
233
- for (const i of s)
234
- t.push(e), e += u(i.width);
321
+ for (const i of r)
322
+ t.push(e), e += a(i.width);
235
323
  return t;
236
324
  }
237
- function g(s) {
238
- return s.reduce((t, e) => t + u(e.width), 0);
325
+ function g(r) {
326
+ return r.reduce((t, e) => t + a(e.width), 0);
239
327
  }
240
- function w(s, t, e, i, o) {
241
- const r = e.length;
242
- if (r === 0)
328
+ function p(r, t, e, i, n) {
329
+ const s = e.length;
330
+ if (s === 0)
243
331
  return { startCol: 0, endCol: 0, visibleColumns: [] };
244
- let n = b(s, e, i);
245
- n = Math.max(0, n - o);
246
- const C = s + t;
247
- let h = n;
248
- for (let l = n; l < r; l++) {
249
- if (e[l] >= C) {
250
- h = l - 1;
332
+ let o = w(r, e, i);
333
+ o = Math.max(0, o - n);
334
+ const m = r + t;
335
+ let u = o;
336
+ for (let l = o; l < s; l++) {
337
+ if (e[l] >= m) {
338
+ u = l - 1;
251
339
  break;
252
340
  }
253
- h = l;
341
+ u = l;
254
342
  }
255
- h = Math.min(r - 1, h + o);
256
- const a = [];
257
- for (let l = n; l <= h; l++)
258
- a.push(l);
259
- return { startCol: n, endCol: h, visibleColumns: a };
343
+ u = Math.min(s - 1, u + n);
344
+ const d = [];
345
+ for (let l = o; l <= u; l++)
346
+ d.push(l);
347
+ return { startCol: o, endCol: u, visibleColumns: d };
260
348
  }
261
- function b(s, t, e) {
262
- let i = 0, o = t.length - 1;
263
- for (; i < o; ) {
264
- const r = Math.floor((i + o) / 2);
265
- t[r] + e[r] <= s ? i = r + 1 : o = r;
349
+ function w(r, t, e) {
350
+ let i = 0, n = t.length - 1;
351
+ for (; i < n; ) {
352
+ const s = Math.floor((i + n) / 2);
353
+ t[s] + e[s] <= r ? i = s + 1 : n = s;
266
354
  }
267
355
  return i;
268
356
  }
269
- function R(s, t, e) {
270
- return e ? s > t : !1;
357
+ function R(r, t, e) {
358
+ return e ? r > t : !1;
271
359
  }
272
- class W extends p {
360
+ class E extends b {
273
361
  name = "columnVirtualization";
274
- version = "1.0.0";
275
362
  get defaultConfig() {
276
363
  return {
277
364
  autoEnable: !0,
@@ -303,25 +390,25 @@ class W extends p {
303
390
  const e = R(t.length, this.config.threshold ?? 30, this.config.autoEnable ?? !0);
304
391
  if (this.isVirtualized = e ?? !1, this.columnWidths = c(t), this.columnOffsets = f(t), this.totalWidth = g(t), !e)
305
392
  return this.startCol = 0, this.endCol = t.length - 1, [...t];
306
- const i = this.grid.clientWidth || 800, o = w(
393
+ const i = this.grid.clientWidth || 800, n = p(
307
394
  this.scrollLeft,
308
395
  i,
309
396
  this.columnOffsets,
310
397
  this.columnWidths,
311
398
  this.config.overscan ?? 3
312
399
  );
313
- return this.startCol = o.startCol, this.endCol = o.endCol, o.visibleColumns.map((r) => t[r]);
400
+ return this.startCol = n.startCol, this.endCol = n.endCol, n.visibleColumns.map((s) => t[s]);
314
401
  }
315
402
  afterRender() {
316
403
  if (!this.isVirtualized) return;
317
- const t = this.shadowRoot;
404
+ const t = this.gridElement;
318
405
  if (!t) return;
319
- const e = this.columnOffsets[this.startCol] ?? 0, i = t.querySelector(".header-row"), o = t.querySelectorAll(".data-grid-row");
320
- i && (i.style.paddingLeft = `${e}px`), o.forEach((n) => {
321
- n.style.paddingLeft = `${e}px`;
406
+ const e = this.columnOffsets[this.startCol] ?? 0, i = t.querySelector(".header-row"), n = t.querySelectorAll(".data-grid-row");
407
+ i && (i.style.paddingLeft = `${e}px`), n.forEach((o) => {
408
+ o.style.paddingLeft = `${e}px`;
322
409
  });
323
- const r = t.querySelector(".rows-viewport .rows");
324
- r && (r.style.width = `${this.totalWidth}px`);
410
+ const s = t.querySelector(".rows-viewport .rows");
411
+ s && (s.style.width = `${this.totalWidth}px`);
325
412
  }
326
413
  onScroll(t) {
327
414
  !this.isVirtualized || Math.abs(t.scrollLeft - this.scrollLeft) < 1 || (this.scrollLeft = t.scrollLeft, this.requestRender());
@@ -364,6 +451,6 @@ class W extends p {
364
451
  // #endregion
365
452
  }
366
453
  export {
367
- W as ColumnVirtualizationPlugin
454
+ E as ColumnVirtualizationPlugin
368
455
  };
369
456
  //# sourceMappingURL=index.js.map