@toolbox-web/grid 0.6.0 → 1.0.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 (180) hide show
  1. package/README.md +79 -26
  2. package/all.js +731 -1739
  3. package/all.js.map +1 -1
  4. package/index.js +1382 -2410
  5. package/index.js.map +1 -1
  6. package/lib/core/constants.d.ts +8 -0
  7. package/lib/core/constants.d.ts.map +1 -1
  8. package/lib/core/grid.d.ts +704 -55
  9. package/lib/core/grid.d.ts.map +1 -1
  10. package/lib/core/internal/config-manager.d.ts +3 -7
  11. package/lib/core/internal/config-manager.d.ts.map +1 -1
  12. package/lib/core/internal/dom-builder.d.ts +2 -10
  13. package/lib/core/internal/dom-builder.d.ts.map +1 -1
  14. package/lib/core/internal/inference.d.ts.map +1 -1
  15. package/lib/core/internal/keyboard.d.ts.map +1 -1
  16. package/lib/core/internal/render-scheduler.d.ts +2 -0
  17. package/lib/core/internal/render-scheduler.d.ts.map +1 -1
  18. package/lib/core/internal/rows.d.ts +9 -1
  19. package/lib/core/internal/rows.d.ts.map +1 -1
  20. package/lib/core/internal/shell.d.ts +41 -41
  21. package/lib/core/internal/shell.d.ts.map +1 -1
  22. package/lib/core/internal/validate-config.d.ts.map +1 -1
  23. package/lib/core/plugin/base-plugin.d.ts +2 -15
  24. package/lib/core/plugin/base-plugin.d.ts.map +1 -1
  25. package/lib/core/plugin/types.d.ts +33 -6
  26. package/lib/core/plugin/types.d.ts.map +1 -1
  27. package/lib/core/types.d.ts +376 -68
  28. package/lib/core/types.d.ts.map +1 -1
  29. package/lib/plugins/clipboard/ClipboardPlugin.d.ts +89 -2
  30. package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -1
  31. package/lib/plugins/clipboard/index.d.ts +2 -0
  32. package/lib/plugins/clipboard/index.d.ts.map +1 -1
  33. package/lib/plugins/clipboard/index.js +24 -35
  34. package/lib/plugins/clipboard/index.js.map +1 -1
  35. package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts +57 -2
  36. package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts.map +1 -1
  37. package/lib/plugins/column-virtualization/index.d.ts +2 -0
  38. package/lib/plugins/column-virtualization/index.d.ts.map +1 -1
  39. package/lib/plugins/column-virtualization/index.js +7 -17
  40. package/lib/plugins/column-virtualization/index.js.map +1 -1
  41. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +75 -5
  42. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
  43. package/lib/plugins/context-menu/index.d.ts +3 -1
  44. package/lib/plugins/context-menu/index.d.ts.map +1 -1
  45. package/lib/plugins/context-menu/index.js +15 -27
  46. package/lib/plugins/context-menu/index.js.map +1 -1
  47. package/lib/plugins/editing/EditingPlugin.d.ts +101 -9
  48. package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
  49. package/lib/plugins/editing/editors.d.ts +9 -1
  50. package/lib/plugins/editing/editors.d.ts.map +1 -1
  51. package/lib/plugins/editing/index.d.ts +4 -2
  52. package/lib/plugins/editing/index.d.ts.map +1 -1
  53. package/lib/plugins/editing/index.js +412 -279
  54. package/lib/plugins/editing/index.js.map +1 -1
  55. package/lib/plugins/editing/types.d.ts +88 -0
  56. package/lib/plugins/editing/types.d.ts.map +1 -1
  57. package/lib/plugins/export/ExportPlugin.d.ts +73 -7
  58. package/lib/plugins/export/ExportPlugin.d.ts.map +1 -1
  59. package/lib/plugins/export/index.d.ts +2 -0
  60. package/lib/plugins/export/index.d.ts.map +1 -1
  61. package/lib/plugins/export/index.js +4 -19
  62. package/lib/plugins/export/index.js.map +1 -1
  63. package/lib/plugins/filtering/FilteringPlugin.d.ts +98 -2
  64. package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
  65. package/lib/plugins/filtering/index.d.ts +2 -0
  66. package/lib/plugins/filtering/index.d.ts.map +1 -1
  67. package/lib/plugins/filtering/index.js +50 -58
  68. package/lib/plugins/filtering/index.js.map +1 -1
  69. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +80 -6
  70. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
  71. package/lib/plugins/grouping-columns/index.d.ts +2 -0
  72. package/lib/plugins/grouping-columns/index.d.ts.map +1 -1
  73. package/lib/plugins/grouping-columns/index.js +10 -21
  74. package/lib/plugins/grouping-columns/index.js.map +1 -1
  75. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +81 -5
  76. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
  77. package/lib/plugins/grouping-rows/index.d.ts +3 -1
  78. package/lib/plugins/grouping-rows/index.d.ts.map +1 -1
  79. package/lib/plugins/grouping-rows/index.js +13 -21
  80. package/lib/plugins/grouping-rows/index.js.map +1 -1
  81. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +90 -5
  82. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -1
  83. package/lib/plugins/master-detail/index.d.ts +2 -0
  84. package/lib/plugins/master-detail/index.d.ts.map +1 -1
  85. package/lib/plugins/master-detail/index.js +11 -17
  86. package/lib/plugins/master-detail/index.js.map +1 -1
  87. package/lib/plugins/multi-sort/MultiSortPlugin.d.ts +83 -2
  88. package/lib/plugins/multi-sort/MultiSortPlugin.d.ts.map +1 -1
  89. package/lib/plugins/multi-sort/index.d.ts +2 -0
  90. package/lib/plugins/multi-sort/index.d.ts.map +1 -1
  91. package/lib/plugins/multi-sort/index.js +11 -19
  92. package/lib/plugins/multi-sort/index.js.map +1 -1
  93. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +61 -2
  94. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
  95. package/lib/plugins/pinned-columns/index.d.ts +3 -1
  96. package/lib/plugins/pinned-columns/index.d.ts.map +1 -1
  97. package/lib/plugins/pinned-columns/index.js +7 -17
  98. package/lib/plugins/pinned-columns/index.js.map +1 -1
  99. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +71 -10
  100. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -1
  101. package/lib/plugins/pinned-rows/index.d.ts +3 -1
  102. package/lib/plugins/pinned-rows/index.d.ts.map +1 -1
  103. package/lib/plugins/pinned-rows/index.js +5 -17
  104. package/lib/plugins/pinned-rows/index.js.map +1 -1
  105. package/lib/plugins/pivot/PivotPlugin.d.ts +81 -4
  106. package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
  107. package/lib/plugins/pivot/index.d.ts +2 -0
  108. package/lib/plugins/pivot/index.d.ts.map +1 -1
  109. package/lib/plugins/pivot/index.js +10 -17
  110. package/lib/plugins/pivot/index.js.map +1 -1
  111. package/lib/plugins/reorder/ReorderPlugin.d.ts +71 -3
  112. package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -1
  113. package/lib/plugins/reorder/index.d.ts +2 -0
  114. package/lib/plugins/reorder/index.d.ts.map +1 -1
  115. package/lib/plugins/reorder/index.js +8 -18
  116. package/lib/plugins/reorder/index.js.map +1 -1
  117. package/lib/plugins/reorder/types.d.ts +0 -5
  118. package/lib/plugins/reorder/types.d.ts.map +1 -1
  119. package/lib/plugins/selection/SelectionPlugin.d.ts +84 -20
  120. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
  121. package/lib/plugins/selection/index.d.ts +2 -1
  122. package/lib/plugins/selection/index.d.ts.map +1 -1
  123. package/lib/plugins/selection/index.js +70 -131
  124. package/lib/plugins/selection/index.js.map +1 -1
  125. package/lib/plugins/selection/types.d.ts +25 -4
  126. package/lib/plugins/selection/types.d.ts.map +1 -1
  127. package/lib/plugins/server-side/ServerSidePlugin.d.ts +65 -4
  128. package/lib/plugins/server-side/ServerSidePlugin.d.ts.map +1 -1
  129. package/lib/plugins/server-side/index.d.ts +3 -1
  130. package/lib/plugins/server-side/index.d.ts.map +1 -1
  131. package/lib/plugins/server-side/index.js +5 -17
  132. package/lib/plugins/server-side/index.js.map +1 -1
  133. package/lib/plugins/tree/TreePlugin.d.ts +89 -2
  134. package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
  135. package/lib/plugins/tree/index.d.ts +3 -2
  136. package/lib/plugins/tree/index.d.ts.map +1 -1
  137. package/lib/plugins/tree/index.js +59 -94
  138. package/lib/plugins/tree/index.js.map +1 -1
  139. package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts +66 -3
  140. package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts.map +1 -1
  141. package/lib/plugins/undo-redo/index.d.ts +3 -1
  142. package/lib/plugins/undo-redo/index.d.ts.map +1 -1
  143. package/lib/plugins/undo-redo/index.js +5 -17
  144. package/lib/plugins/undo-redo/index.js.map +1 -1
  145. package/lib/plugins/visibility/VisibilityPlugin.d.ts +86 -2
  146. package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -1
  147. package/lib/plugins/visibility/index.d.ts +2 -0
  148. package/lib/plugins/visibility/index.d.ts.map +1 -1
  149. package/lib/plugins/visibility/index.js +6 -17
  150. package/lib/plugins/visibility/index.js.map +1 -1
  151. package/package.json +1 -1
  152. package/public.d.ts +30 -2
  153. package/public.d.ts.map +1 -1
  154. package/umd/grid.all.umd.js +19 -19
  155. package/umd/grid.all.umd.js.map +1 -1
  156. package/umd/grid.umd.js +11 -11
  157. package/umd/grid.umd.js.map +1 -1
  158. package/umd/plugins/clipboard.umd.js.map +1 -1
  159. package/umd/plugins/column-virtualization.umd.js.map +1 -1
  160. package/umd/plugins/context-menu.umd.js.map +1 -1
  161. package/umd/plugins/editing.umd.js +1 -1
  162. package/umd/plugins/editing.umd.js.map +1 -1
  163. package/umd/plugins/export.umd.js.map +1 -1
  164. package/umd/plugins/filtering.umd.js.map +1 -1
  165. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  166. package/umd/plugins/grouping-rows.umd.js.map +1 -1
  167. package/umd/plugins/master-detail.umd.js.map +1 -1
  168. package/umd/plugins/multi-sort.umd.js.map +1 -1
  169. package/umd/plugins/pinned-columns.umd.js.map +1 -1
  170. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  171. package/umd/plugins/pivot.umd.js.map +1 -1
  172. package/umd/plugins/reorder.umd.js +1 -1
  173. package/umd/plugins/reorder.umd.js.map +1 -1
  174. package/umd/plugins/selection.umd.js +1 -1
  175. package/umd/plugins/selection.umd.js.map +1 -1
  176. package/umd/plugins/server-side.umd.js.map +1 -1
  177. package/umd/plugins/tree.umd.js +1 -1
  178. package/umd/plugins/tree.umd.js.map +1 -1
  179. package/umd/plugins/undo-redo.umd.js.map +1 -1
  180. package/umd/plugins/visibility.umd.js.map +1 -1
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * Tree Plugin Entry Point
3
3
  * Re-exports plugin class and types for tree-shakeable imports.
4
+ *
5
+ * @module Plugins/Tree
4
6
  */
5
7
  export { TreePlugin } from './TreePlugin';
6
- export { countNodes, detectTreeStructure, getMaxDepth, inferChildrenField } from './tree-detect';
7
- export type { TreeConfig, TreeState, TreeExpandDetail, FlattenedTreeRow } from './types';
8
+ export type { TreeConfig, TreeExpandDetail } from './types';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACjG,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/tree/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC"}
@@ -1,4 +1,4 @@
1
- const S = {
1
+ const _ = {
2
2
  expand: "▶",
3
3
  collapse: "▼",
4
4
  sortAsc: "▲",
@@ -8,7 +8,7 @@ const S = {
8
8
  dragHandle: "⋮⋮",
9
9
  toolPanel: "☰"
10
10
  };
11
- class _ {
11
+ class v {
12
12
  /**
13
13
  * Plugin dependencies - declare other plugins this one requires.
14
14
  *
@@ -184,23 +184,6 @@ class _ {
184
184
  get gridElement() {
185
185
  return this.grid;
186
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');
200
- */
201
- get shadowRoot() {
202
- return this.gridElement;
203
- }
204
187
  /**
205
188
  * Get the disconnect signal for event listener cleanup.
206
189
  * This signal is aborted when the grid disconnects from the DOM.
@@ -227,7 +210,7 @@ class _ {
227
210
  */
228
211
  get gridIcons() {
229
212
  const e = this.grid?.gridConfig?.icons ?? {};
230
- return { ...S, ...e };
213
+ return { ..._, ...e };
231
214
  }
232
215
  // #region Animation Helpers
233
216
  /**
@@ -303,35 +286,35 @@ class _ {
303
286
  }
304
287
  // #endregion
305
288
  }
306
- function x(s, e, t) {
307
- return s.id !== void 0 ? String(s.id) : t ? `${t}-${e}` : String(e);
289
+ function x(o, e, t) {
290
+ return o.id !== void 0 ? String(o.id) : t ? `${t}-${e}` : String(e);
308
291
  }
309
- function y(s, e) {
310
- const t = new Set(s);
292
+ function y(o, e) {
293
+ const t = new Set(o);
311
294
  return t.has(e) ? t.delete(e) : t.add(e), t;
312
295
  }
313
- function w(s, e, t = null, n = 0) {
314
- const i = e.childrenField ?? "children", o = /* @__PURE__ */ new Set();
315
- for (let r = 0; r < s.length; r++) {
316
- const l = s[r], a = x(l, r, t), d = l[i];
296
+ function w(o, e, t = null, n = 0) {
297
+ const i = e.childrenField ?? "children", s = /* @__PURE__ */ new Set();
298
+ for (let r = 0; r < o.length; r++) {
299
+ const l = o[r], a = x(l, r, t), d = l[i];
317
300
  if (Array.isArray(d) && d.length > 0) {
318
- o.add(a);
301
+ s.add(a);
319
302
  const h = w(d, e, a, n + 1);
320
- for (const u of h) o.add(u);
303
+ for (const u of h) s.add(u);
321
304
  }
322
305
  }
323
- return o;
306
+ return s;
324
307
  }
325
- function v() {
308
+ function A() {
326
309
  return /* @__PURE__ */ new Set();
327
310
  }
328
- function R(s, e, t, n = null, i = 0) {
329
- const o = t.childrenField ?? "children";
330
- for (let r = 0; r < s.length; r++) {
331
- const l = s[r], a = x(l, r, n);
311
+ function R(o, e, t, n = null, i = 0) {
312
+ const s = t.childrenField ?? "children";
313
+ for (let r = 0; r < o.length; r++) {
314
+ const l = o[r], a = x(l, r, n);
332
315
  if (a === e)
333
316
  return [a];
334
- const d = l[o];
317
+ const d = l[s];
335
318
  if (Array.isArray(d) && d.length > 0) {
336
319
  const h = R(d, e, t, a, i + 1);
337
320
  if (h)
@@ -340,17 +323,17 @@ function R(s, e, t, n = null, i = 0) {
340
323
  }
341
324
  return null;
342
325
  }
343
- function E(s, e, t, n) {
344
- const i = R(s, e, t);
326
+ function E(o, e, t, n) {
327
+ const i = R(o, e, t);
345
328
  if (!i) return n;
346
- const o = new Set(n);
329
+ const s = new Set(n);
347
330
  for (let r = 0; r < i.length - 1; r++)
348
- o.add(i[r]);
349
- return o;
331
+ s.add(i[r]);
332
+ return s;
350
333
  }
351
- function m(s, e = "children") {
352
- if (!Array.isArray(s) || s.length === 0) return !1;
353
- for (const t of s) {
334
+ function m(o, e = "children") {
335
+ if (!Array.isArray(o) || o.length === 0) return !1;
336
+ for (const t of o) {
354
337
  if (!t) continue;
355
338
  const n = t[e];
356
339
  if (Array.isArray(n) && n.length > 0)
@@ -358,10 +341,10 @@ function m(s, e = "children") {
358
341
  }
359
342
  return !1;
360
343
  }
361
- function C(s) {
362
- if (!Array.isArray(s) || s.length === 0) return null;
344
+ function C(o) {
345
+ if (!Array.isArray(o) || o.length === 0) return null;
363
346
  const e = ["children", "items", "nodes", "subRows", "nested"];
364
- for (const t of s)
347
+ for (const t of o)
365
348
  if (!(!t || typeof t != "object"))
366
349
  for (const n of e) {
367
350
  const i = t[n];
@@ -370,34 +353,13 @@ function C(s) {
370
353
  }
371
354
  return null;
372
355
  }
373
- function k(s, e = "children", t = 0) {
374
- if (!Array.isArray(s) || s.length === 0) return t;
375
- let n = t;
376
- for (const i of s) {
377
- if (!i) continue;
378
- const o = i[e];
379
- if (Array.isArray(o) && o.length > 0) {
380
- const r = k(o, e, t + 1);
381
- r > n && (n = r);
382
- }
383
- }
384
- return n;
385
- }
386
- function T(s, e = "children") {
387
- if (!Array.isArray(s)) return 0;
388
- let t = 0;
389
- for (const n of s) {
390
- if (!n) continue;
391
- t++;
392
- const i = n[e];
393
- Array.isArray(i) && (t += T(i, e));
394
- }
395
- return t;
396
- }
397
- const I = "@layer tbw-plugins{tbw-grid .cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:flex-start}tbw-grid .header-row .cell[data-field=__tbw_expander]{display:none}tbw-grid .header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}tbw-grid .tree-cell-wrapper{display:inline-flex;align-items:center;padding-left:calc(var(--tbw-tree-depth, 0) * var(--tbw-tree-indent-width, var(--tbw-tree-toggle-size, 1.25em)))}tbw-grid .tree-expander{display:flex;align-items:center;justify-content:flex-start;width:100%;height:100%;box-sizing:border-box}tbw-grid .tree-toggle{cursor:pointer;-webkit-user-select:none;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-tree-toggle-size, 1.25em);height:var(--tbw-tree-toggle-size, 1.25em);flex-shrink:0}tbw-grid .tree-toggle:hover{color:var(--tbw-tree-accent, var(--tbw-color-accent))}tbw-grid .tree-spacer{width:var(--tbw-tree-toggle-size, 1.25em);display:inline-block;flex-shrink:0}tbw-grid .data-grid-row.tbw-tree-slide-in{animation:tbw-tree-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}tbw-grid .data-grid-row.tbw-tree-fade-in{animation:tbw-tree-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-tree-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}@keyframes tbw-tree-fade-in{0%{opacity:0}to{opacity:1}}}";
398
- class F extends _ {
356
+ const k = "@layer tbw-plugins{tbw-grid .cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:flex-start}tbw-grid .header-row .cell[data-field=__tbw_expander]{display:none}tbw-grid .header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}tbw-grid .tree-cell-wrapper{display:inline-flex;align-items:center;padding-left:calc(var(--tbw-tree-depth, 0) * var(--tbw-tree-indent-width, var(--tbw-tree-toggle-size, 1.25em)))}tbw-grid .tree-expander{display:flex;align-items:center;justify-content:flex-start;width:100%;height:100%;box-sizing:border-box}tbw-grid .tree-toggle{cursor:pointer;-webkit-user-select:none;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-tree-toggle-size, 1.25em);height:var(--tbw-tree-toggle-size, 1.25em);flex-shrink:0}tbw-grid .tree-toggle:hover{color:var(--tbw-tree-accent, var(--tbw-color-accent))}tbw-grid .tree-spacer{width:var(--tbw-tree-toggle-size, 1.25em);display:inline-block;flex-shrink:0}tbw-grid .data-grid-row.tbw-tree-slide-in{animation:tbw-tree-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}tbw-grid .data-grid-row.tbw-tree-fade-in{animation:tbw-tree-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-tree-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}@keyframes tbw-tree-fade-in{0%{opacity:0}to{opacity:1}}}";
357
+ class T extends v {
358
+ /** @internal */
399
359
  name = "tree";
400
- styles = I;
360
+ /** @internal */
361
+ styles = k;
362
+ /** @internal */
401
363
  get defaultConfig() {
402
364
  return {
403
365
  childrenField: "children",
@@ -416,6 +378,7 @@ class F extends _ {
416
378
  previousVisibleKeys = /* @__PURE__ */ new Set();
417
379
  keysToAnimate = /* @__PURE__ */ new Set();
418
380
  sortState = null;
381
+ /** @internal */
419
382
  detach() {
420
383
  this.expandedKeys.clear(), this.initialExpansionDone = !1, this.flattenedRows = [], this.rowKeyMap.clear(), this.previousVisibleKeys.clear(), this.keysToAnimate.clear(), this.sortState = null;
421
384
  }
@@ -437,16 +400,17 @@ class F extends _ {
437
400
  }
438
401
  // #endregion
439
402
  // #region Data Processing
403
+ /** @internal */
440
404
  processRows(e) {
441
405
  const t = this.config.childrenField ?? "children", n = e;
442
406
  if (!m(n, t))
443
407
  return this.flattenedRows = [], this.rowKeyMap.clear(), this.previousVisibleKeys.clear(), [...e];
444
408
  let i = this.withStableKeys(n);
445
409
  this.sortState && (i = this.sortTree(i, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = w(i, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(i, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
446
- const o = /* @__PURE__ */ new Set();
410
+ const s = /* @__PURE__ */ new Set();
447
411
  for (const r of this.flattenedRows)
448
- this.rowKeyMap.set(r.key, r), o.add(r.key), !this.previousVisibleKeys.has(r.key) && r.depth > 0 && this.keysToAnimate.add(r.key);
449
- return this.previousVisibleKeys = o, this.flattenedRows.map((r) => ({
412
+ this.rowKeyMap.set(r.key, r), s.add(r.key), !this.previousVisibleKeys.has(r.key) && r.depth > 0 && this.keysToAnimate.add(r.key);
413
+ return this.previousVisibleKeys = s, this.flattenedRows.map((r) => ({
450
414
  ...r.data,
451
415
  __treeKey: r.key,
452
416
  __treeDepth: r.depth,
@@ -457,8 +421,8 @@ class F extends _ {
457
421
  /** Assign stable keys to rows (preserves key across sort operations) */
458
422
  withStableKeys(e, t = null) {
459
423
  const n = this.config.childrenField ?? "children";
460
- return e.map((i, o) => {
461
- const r = i.__stableKey, l = i.id !== void 0 ? String(i.id) : r ?? (t ? `${t}-${o}` : String(o)), a = i[n], d = Array.isArray(a) && a.length > 0;
424
+ return e.map((i, s) => {
425
+ const r = i.__stableKey, l = i.id !== void 0 ? String(i.id) : r ?? (t ? `${t}-${s}` : String(s)), a = i[n], d = Array.isArray(a) && a.length > 0;
462
426
  return {
463
427
  ...i,
464
428
  __stableKey: l,
@@ -468,19 +432,19 @@ class F extends _ {
468
432
  }
469
433
  /** Flatten tree using stable keys */
470
434
  flattenTree(e, t, n = 0) {
471
- const i = this.config.childrenField ?? "children", o = [];
435
+ const i = this.config.childrenField ?? "children", s = [];
472
436
  for (const r of e) {
473
437
  const a = r.__stableKey ?? String(r.id ?? "?"), d = r[i], h = Array.isArray(d) && d.length > 0, u = t.has(a);
474
- o.push({
438
+ s.push({
475
439
  key: a,
476
440
  data: r,
477
441
  depth: n,
478
442
  hasChildren: h,
479
443
  isExpanded: u,
480
444
  parentKey: n > 0 && a.substring(0, a.lastIndexOf("-")) || null
481
- }), h && u && o.push(...this.flattenTree(d, t, n + 1));
445
+ }), h && u && s.push(...this.flattenTree(d, t, n + 1));
482
446
  }
483
- return o;
447
+ return s;
484
448
  }
485
449
  /** Sort tree recursively, keeping children with parents */
486
450
  sortTree(e, t, n) {
@@ -493,13 +457,14 @@ class F extends _ {
493
457
  return Array.isArray(l) && l.length > 0 ? { ...r, [i]: this.sortTree(l, t, n) } : r;
494
458
  });
495
459
  }
460
+ /** @internal */
496
461
  processColumns(e) {
497
462
  if (this.flattenedRows.length === 0) return [...e];
498
463
  const t = [...e];
499
464
  if (t.length === 0) return t;
500
- const n = t[0], i = n.viewRenderer, o = () => this.config, r = this.setIcon.bind(this), l = this.resolveIcon.bind(this), a = (d) => {
501
- const { row: h, value: u } = d, { showExpandIcons: A = !0, indentWidth: b } = o(), g = h, K = g.__treeDepth ?? 0, f = document.createElement("span");
502
- if (f.className = "tree-cell-wrapper", f.style.setProperty("--tbw-tree-depth", String(K)), b !== void 0 && f.style.setProperty("--tbw-tree-indent-width", `${b}px`), A)
465
+ const n = t[0], i = n.viewRenderer, s = () => this.config, r = this.setIcon.bind(this), l = this.resolveIcon.bind(this), a = (d) => {
466
+ const { row: h, value: u } = d, { showExpandIcons: K = !0, indentWidth: b } = s(), g = h, S = g.__treeDepth ?? 0, f = document.createElement("span");
467
+ if (f.className = "tree-cell-wrapper", f.style.setProperty("--tbw-tree-depth", String(S)), b !== void 0 && f.style.setProperty("--tbw-tree-indent-width", `${b}px`), K)
503
468
  if (g.__treeHasChildren) {
504
469
  const c = document.createElement("span");
505
470
  c.className = `tree-toggle${g.__treeExpanded ? " expanded" : ""}`, r(c, l(g.__treeExpanded ? "collapse" : "expand")), c.setAttribute("data-tree-key", String(g.__treeKey ?? "")), f.appendChild(c);
@@ -519,6 +484,7 @@ class F extends _ {
519
484
  }
520
485
  // #endregion
521
486
  // #region Event Handlers
487
+ /** @internal */
522
488
  onCellClick(e) {
523
489
  const t = e.originalEvent?.target;
524
490
  if (!t?.classList.contains("tree-toggle")) return !1;
@@ -532,6 +498,7 @@ class F extends _ {
532
498
  depth: i.depth
533
499
  }), this.requestRender(), !0) : !1;
534
500
  }
501
+ /** @internal */
535
502
  onKeyDown(e) {
536
503
  if (e.key !== " ") return;
537
504
  const t = this.grid._focusRow, n = this.flattenedRows[t];
@@ -543,6 +510,7 @@ class F extends _ {
543
510
  depth: n.depth
544
511
  }), this.requestRenderWithFocus(), !0;
545
512
  }
513
+ /** @internal */
546
514
  onHeaderClick(e) {
547
515
  if (this.flattenedRows.length === 0 || !e.column.sortable) return !1;
548
516
  const { field: t } = e.column;
@@ -550,6 +518,7 @@ class F extends _ {
550
518
  const n = this.grid;
551
519
  return n._sortState !== void 0 && (n._sortState = this.sortState ? { ...this.sortState } : null), this.emit("sort-change", { field: t, direction: this.sortState?.direction ?? 0 }), this.requestRender(), !0;
552
520
  }
521
+ /** @internal */
553
522
  afterRender() {
554
523
  const e = this.animationStyle;
555
524
  if (e === !1 || this.keysToAnimate.size === 0) return;
@@ -557,7 +526,7 @@ class F extends _ {
557
526
  if (!t) return;
558
527
  const n = e === "fade" ? "tbw-tree-fade-in" : "tbw-tree-slide-in";
559
528
  for (const i of t.querySelectorAll(".data-grid-row")) {
560
- const o = i.querySelector(".cell[data-row]"), r = o ? parseInt(o.getAttribute("data-row") ?? "-1", 10) : -1, l = this.flattenedRows[r]?.key;
529
+ const s = i.querySelector(".cell[data-row]"), r = s ? parseInt(s.getAttribute("data-row") ?? "-1", 10) : -1, l = this.flattenedRows[r]?.key;
561
530
  l && this.keysToAnimate.has(l) && (i.classList.add(n), i.addEventListener("animationend", () => i.classList.remove(n), { once: !0 }));
562
531
  }
563
532
  this.keysToAnimate.clear();
@@ -577,7 +546,7 @@ class F extends _ {
577
546
  this.expandedKeys = w(this.rows, this.config), this.requestRender();
578
547
  }
579
548
  collapseAll() {
580
- this.expandedKeys = v(), this.requestRender();
549
+ this.expandedKeys = A(), this.requestRender();
581
550
  }
582
551
  isExpanded(e) {
583
552
  return this.expandedKeys.has(e);
@@ -597,10 +566,6 @@ class F extends _ {
597
566
  // #endregion
598
567
  }
599
568
  export {
600
- F as TreePlugin,
601
- T as countNodes,
602
- m as detectTreeStructure,
603
- k as getMaxDepth,
604
- C as inferChildrenField
569
+ T as TreePlugin
605
570
  };
606
571
  //# sourceMappingURL=index.js.map