@toolbox-web/grid 0.2.8 → 0.3.1

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 (273) hide show
  1. package/README.md +13 -13
  2. package/all.d.ts +25 -5659
  3. package/all.d.ts.map +1 -0
  4. package/all.js +524 -450
  5. package/all.js.map +1 -1
  6. package/index.d.ts +8 -2678
  7. package/index.d.ts.map +1 -0
  8. package/index.js +3929 -25
  9. package/index.js.map +1 -1
  10. package/lib/core/constants.d.ts +114 -0
  11. package/lib/core/constants.d.ts.map +1 -0
  12. package/lib/core/grid.d.ts +337 -0
  13. package/lib/core/grid.d.ts.map +1 -0
  14. package/lib/core/internal/aggregators.d.ts +67 -0
  15. package/lib/core/internal/aggregators.d.ts.map +1 -0
  16. package/lib/core/internal/column-state.d.ts +124 -0
  17. package/lib/core/internal/column-state.d.ts.map +1 -0
  18. package/lib/core/internal/columns.d.ts +107 -0
  19. package/lib/core/internal/columns.d.ts.map +1 -0
  20. package/lib/core/internal/dom-builder.d.ts +115 -0
  21. package/lib/core/internal/dom-builder.d.ts.map +1 -0
  22. package/lib/core/internal/editing.d.ts +76 -0
  23. package/lib/core/internal/editing.d.ts.map +1 -0
  24. package/lib/core/internal/editors.d.ts +8 -0
  25. package/lib/core/internal/editors.d.ts.map +1 -0
  26. package/lib/core/internal/event-delegation.d.ts +11 -0
  27. package/lib/core/internal/event-delegation.d.ts.map +1 -0
  28. package/lib/core/internal/grid-internals.d.ts +83 -0
  29. package/lib/core/internal/grid-internals.d.ts.map +1 -0
  30. package/lib/core/internal/header.d.ts +7 -0
  31. package/lib/core/internal/header.d.ts.map +1 -0
  32. package/lib/core/internal/idle-scheduler.d.ts +65 -0
  33. package/lib/core/internal/idle-scheduler.d.ts.map +1 -0
  34. package/lib/core/internal/inference.d.ts +12 -0
  35. package/lib/core/internal/inference.d.ts.map +1 -0
  36. package/lib/core/internal/keyboard.d.ts +18 -0
  37. package/lib/core/internal/keyboard.d.ts.map +1 -0
  38. package/lib/core/internal/resize.d.ts +3 -0
  39. package/lib/core/internal/resize.d.ts.map +1 -0
  40. package/lib/core/internal/rows.d.ts +35 -0
  41. package/lib/core/internal/rows.d.ts.map +1 -0
  42. package/lib/core/internal/sanitize.d.ts +13 -0
  43. package/lib/core/internal/sanitize.d.ts.map +1 -0
  44. package/lib/core/internal/shell.d.ts +228 -0
  45. package/lib/core/internal/shell.d.ts.map +1 -0
  46. package/lib/core/internal/sorting.d.ts +24 -0
  47. package/lib/core/internal/sorting.d.ts.map +1 -0
  48. package/lib/core/internal/touch-scroll.d.ts +54 -0
  49. package/lib/core/internal/touch-scroll.d.ts.map +1 -0
  50. package/lib/core/internal/utils.d.ts +38 -0
  51. package/lib/core/internal/utils.d.ts.map +1 -0
  52. package/lib/core/internal/virtualization.d.ts +66 -0
  53. package/lib/core/internal/virtualization.d.ts.map +1 -0
  54. package/lib/core/plugin/base-plugin.d.ts +616 -0
  55. package/lib/core/plugin/base-plugin.d.ts.map +1 -0
  56. package/lib/core/plugin/index.d.ts +11 -0
  57. package/lib/core/plugin/index.d.ts.map +1 -0
  58. package/lib/core/plugin/plugin-manager.d.ts +183 -0
  59. package/lib/core/plugin/plugin-manager.d.ts.map +1 -0
  60. package/lib/core/plugin/types.d.ts +196 -0
  61. package/lib/core/plugin/types.d.ts.map +1 -0
  62. package/lib/core/types.d.ts +841 -0
  63. package/lib/core/types.d.ts.map +1 -0
  64. package/lib/plugins/clipboard/ClipboardPlugin.d.ts +46 -0
  65. package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -0
  66. package/lib/plugins/clipboard/copy.d.ts +47 -0
  67. package/lib/plugins/clipboard/copy.d.ts.map +1 -0
  68. package/lib/plugins/clipboard/index.d.ts +7 -0
  69. package/lib/plugins/clipboard/index.d.ts.map +1 -0
  70. package/lib/plugins/clipboard/index.js.map +1 -1
  71. package/lib/plugins/clipboard/paste.d.ts +25 -0
  72. package/lib/plugins/clipboard/paste.d.ts.map +1 -0
  73. package/lib/plugins/clipboard/types.d.ts +40 -0
  74. package/lib/plugins/clipboard/types.d.ts.map +1 -0
  75. package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts +54 -0
  76. package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts.map +1 -0
  77. package/lib/plugins/column-virtualization/column-virtualization.d.ts +53 -0
  78. package/lib/plugins/column-virtualization/column-virtualization.d.ts.map +1 -0
  79. package/lib/plugins/column-virtualization/index.d.ts +7 -0
  80. package/lib/plugins/column-virtualization/index.d.ts.map +1 -0
  81. package/lib/plugins/column-virtualization/index.js.map +1 -1
  82. package/lib/plugins/column-virtualization/types.d.ts +41 -0
  83. package/lib/plugins/column-virtualization/types.d.ts.map +1 -0
  84. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +52 -0
  85. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -0
  86. package/lib/plugins/context-menu/index.d.ts +7 -0
  87. package/lib/plugins/context-menu/index.d.ts.map +1 -0
  88. package/lib/plugins/context-menu/index.js +24 -24
  89. package/lib/plugins/context-menu/index.js.map +1 -1
  90. package/lib/plugins/context-menu/menu.d.ts +38 -0
  91. package/lib/plugins/context-menu/menu.d.ts.map +1 -0
  92. package/lib/plugins/context-menu/types.d.ts +77 -0
  93. package/lib/plugins/context-menu/types.d.ts.map +1 -0
  94. package/lib/plugins/export/ExportPlugin.d.ts +53 -0
  95. package/lib/plugins/export/ExportPlugin.d.ts.map +1 -0
  96. package/lib/plugins/export/csv.d.ts +31 -0
  97. package/lib/plugins/export/csv.d.ts.map +1 -0
  98. package/lib/plugins/export/excel.d.ts +12 -0
  99. package/lib/plugins/export/excel.d.ts.map +1 -0
  100. package/lib/plugins/export/index.d.ts +7 -0
  101. package/lib/plugins/export/index.d.ts.map +1 -0
  102. package/lib/plugins/export/index.js.map +1 -1
  103. package/lib/plugins/export/types.d.ts +57 -0
  104. package/lib/plugins/export/types.d.ts.map +1 -0
  105. package/lib/plugins/filtering/FilteringPlugin.d.ts +128 -0
  106. package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -0
  107. package/lib/plugins/filtering/filter-model.d.ts +38 -0
  108. package/lib/plugins/filtering/filter-model.d.ts.map +1 -0
  109. package/lib/plugins/filtering/index.d.ts +7 -0
  110. package/lib/plugins/filtering/index.d.ts.map +1 -0
  111. package/lib/plugins/filtering/index.js +5 -5
  112. package/lib/plugins/filtering/index.js.map +1 -1
  113. package/lib/plugins/filtering/types.d.ts +157 -0
  114. package/lib/plugins/filtering/types.d.ts.map +1 -0
  115. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +51 -0
  116. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -0
  117. package/lib/plugins/grouping-columns/grouping-columns.d.ts +41 -0
  118. package/lib/plugins/grouping-columns/grouping-columns.d.ts.map +1 -0
  119. package/lib/plugins/grouping-columns/index.d.ts +7 -0
  120. package/lib/plugins/grouping-columns/index.d.ts.map +1 -0
  121. package/lib/plugins/grouping-columns/index.js +58 -42
  122. package/lib/plugins/grouping-columns/index.js.map +1 -1
  123. package/lib/plugins/grouping-columns/types.d.ts +91 -0
  124. package/lib/plugins/grouping-columns/types.d.ts.map +1 -0
  125. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +120 -0
  126. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -0
  127. package/lib/plugins/grouping-rows/grouping-rows.d.ts +51 -0
  128. package/lib/plugins/grouping-rows/grouping-rows.d.ts.map +1 -0
  129. package/lib/plugins/grouping-rows/index.d.ts +7 -0
  130. package/lib/plugins/grouping-rows/index.d.ts.map +1 -0
  131. package/lib/plugins/grouping-rows/index.js +51 -51
  132. package/lib/plugins/grouping-rows/index.js.map +1 -1
  133. package/lib/plugins/grouping-rows/types.d.ts +95 -0
  134. package/lib/plugins/grouping-rows/types.d.ts.map +1 -0
  135. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +147 -0
  136. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -0
  137. package/lib/plugins/master-detail/index.d.ts +7 -0
  138. package/lib/plugins/master-detail/index.d.ts.map +1 -0
  139. package/lib/plugins/master-detail/index.js +235 -78
  140. package/lib/plugins/master-detail/index.js.map +1 -1
  141. package/lib/plugins/master-detail/master-detail.d.ts +30 -0
  142. package/lib/plugins/master-detail/master-detail.d.ts.map +1 -0
  143. package/lib/plugins/master-detail/types.d.ts +40 -0
  144. package/lib/plugins/master-detail/types.d.ts.map +1 -0
  145. package/lib/plugins/multi-sort/MultiSortPlugin.d.ts +58 -0
  146. package/lib/plugins/multi-sort/MultiSortPlugin.d.ts.map +1 -0
  147. package/lib/plugins/multi-sort/index.d.ts +7 -0
  148. package/lib/plugins/multi-sort/index.d.ts.map +1 -0
  149. package/lib/plugins/multi-sort/index.js.map +1 -1
  150. package/lib/plugins/multi-sort/multi-sort.d.ts +51 -0
  151. package/lib/plugins/multi-sort/multi-sort.d.ts.map +1 -0
  152. package/lib/plugins/multi-sort/types.d.ts +25 -0
  153. package/lib/plugins/multi-sort/types.d.ts.map +1 -0
  154. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +58 -0
  155. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -0
  156. package/lib/plugins/pinned-columns/index.d.ts +7 -0
  157. package/lib/plugins/pinned-columns/index.d.ts.map +1 -0
  158. package/lib/plugins/pinned-columns/index.js.map +1 -1
  159. package/lib/plugins/pinned-columns/pinned-columns.d.ts +62 -0
  160. package/lib/plugins/pinned-columns/pinned-columns.d.ts.map +1 -0
  161. package/lib/plugins/pinned-columns/types.d.ts +20 -0
  162. package/lib/plugins/pinned-columns/types.d.ts.map +1 -0
  163. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +64 -0
  164. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -0
  165. package/lib/plugins/pinned-rows/index.d.ts +7 -0
  166. package/lib/plugins/pinned-rows/index.d.ts.map +1 -0
  167. package/lib/plugins/pinned-rows/index.js +1 -1
  168. package/lib/plugins/pinned-rows/index.js.map +1 -1
  169. package/lib/plugins/pinned-rows/pinned-rows.d.ts +43 -0
  170. package/lib/plugins/pinned-rows/pinned-rows.d.ts.map +1 -0
  171. package/lib/plugins/pinned-rows/types.d.ts +95 -0
  172. package/lib/plugins/pinned-rows/types.d.ts.map +1 -0
  173. package/lib/plugins/pivot/PivotPlugin.d.ts +94 -0
  174. package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -0
  175. package/lib/plugins/pivot/index.d.ts +7 -0
  176. package/lib/plugins/pivot/index.d.ts.map +1 -0
  177. package/lib/plugins/pivot/index.js.map +1 -1
  178. package/lib/plugins/pivot/pivot-engine.d.ts +50 -0
  179. package/lib/plugins/pivot/pivot-engine.d.ts.map +1 -0
  180. package/lib/plugins/pivot/pivot-model.d.ts +6 -0
  181. package/lib/plugins/pivot/pivot-model.d.ts.map +1 -0
  182. package/lib/plugins/pivot/pivot-panel.d.ts +25 -0
  183. package/lib/plugins/pivot/pivot-panel.d.ts.map +1 -0
  184. package/lib/plugins/pivot/pivot-rows.d.ts +33 -0
  185. package/lib/plugins/pivot/pivot-rows.d.ts.map +1 -0
  186. package/lib/plugins/pivot/types.d.ts +62 -0
  187. package/lib/plugins/pivot/types.d.ts.map +1 -0
  188. package/lib/plugins/reorder/ReorderPlugin.d.ts +81 -0
  189. package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -0
  190. package/lib/plugins/reorder/column-drag.d.ts +41 -0
  191. package/lib/plugins/reorder/column-drag.d.ts.map +1 -0
  192. package/lib/plugins/reorder/index.d.ts +7 -0
  193. package/lib/plugins/reorder/index.d.ts.map +1 -0
  194. package/lib/plugins/reorder/index.js +51 -48
  195. package/lib/plugins/reorder/index.js.map +1 -1
  196. package/lib/plugins/reorder/types.d.ts +54 -0
  197. package/lib/plugins/reorder/types.d.ts.map +1 -0
  198. package/lib/plugins/selection/SelectionPlugin.d.ts +77 -0
  199. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -0
  200. package/lib/plugins/selection/index.d.ts +8 -0
  201. package/lib/plugins/selection/index.d.ts.map +1 -0
  202. package/lib/plugins/selection/index.js +86 -75
  203. package/lib/plugins/selection/index.js.map +1 -1
  204. package/lib/plugins/selection/range-selection.d.ts +109 -0
  205. package/lib/plugins/selection/range-selection.d.ts.map +1 -0
  206. package/lib/plugins/selection/row-selection.d.ts +48 -0
  207. package/lib/plugins/selection/row-selection.d.ts.map +1 -0
  208. package/lib/plugins/selection/types.d.ts +80 -0
  209. package/lib/plugins/selection/types.d.ts.map +1 -0
  210. package/lib/plugins/server-side/ServerSidePlugin.d.ts +56 -0
  211. package/lib/plugins/server-side/ServerSidePlugin.d.ts.map +1 -0
  212. package/lib/plugins/server-side/cache.d.ts +14 -0
  213. package/lib/plugins/server-side/cache.d.ts.map +1 -0
  214. package/lib/plugins/server-side/datasource.d.ts +12 -0
  215. package/lib/plugins/server-side/datasource.d.ts.map +1 -0
  216. package/lib/plugins/server-side/index.d.ts +7 -0
  217. package/lib/plugins/server-side/index.d.ts.map +1 -0
  218. package/lib/plugins/server-side/index.js.map +1 -1
  219. package/lib/plugins/server-side/types.d.ts +43 -0
  220. package/lib/plugins/server-side/types.d.ts.map +1 -0
  221. package/lib/plugins/tree/TreePlugin.d.ts +49 -0
  222. package/lib/plugins/tree/TreePlugin.d.ts.map +1 -0
  223. package/lib/plugins/tree/index.d.ts +8 -0
  224. package/lib/plugins/tree/index.d.ts.map +1 -0
  225. package/lib/plugins/tree/index.js.map +1 -1
  226. package/lib/plugins/tree/tree-data.d.ts +42 -0
  227. package/lib/plugins/tree/tree-data.d.ts.map +1 -0
  228. package/lib/plugins/tree/tree-detect.d.ts +24 -0
  229. package/lib/plugins/tree/tree-detect.d.ts.map +1 -0
  230. package/lib/plugins/tree/types.d.ts +61 -0
  231. package/lib/plugins/tree/types.d.ts.map +1 -0
  232. package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts +68 -0
  233. package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts.map +1 -0
  234. package/lib/plugins/undo-redo/history.d.ts +64 -0
  235. package/lib/plugins/undo-redo/history.d.ts.map +1 -0
  236. package/lib/plugins/undo-redo/index.d.ts +7 -0
  237. package/lib/plugins/undo-redo/index.d.ts.map +1 -0
  238. package/lib/plugins/undo-redo/index.js.map +1 -1
  239. package/lib/plugins/undo-redo/types.d.ts +41 -0
  240. package/lib/plugins/undo-redo/types.d.ts.map +1 -0
  241. package/lib/plugins/visibility/VisibilityPlugin.d.ts +135 -0
  242. package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -0
  243. package/lib/plugins/visibility/index.d.ts +8 -0
  244. package/lib/plugins/visibility/index.d.ts.map +1 -0
  245. package/lib/plugins/visibility/index.js.map +1 -1
  246. package/lib/plugins/visibility/types.d.ts +33 -0
  247. package/lib/plugins/visibility/types.d.ts.map +1 -0
  248. package/lib/plugins/visibility/visibility.d.ts +30 -0
  249. package/lib/plugins/visibility/visibility.d.ts.map +1 -0
  250. package/package.json +6 -2
  251. package/public.d.ts +52 -0
  252. package/public.d.ts.map +1 -0
  253. package/umd/grid.all.umd.js +32 -74
  254. package/umd/grid.all.umd.js.map +1 -1
  255. package/umd/grid.umd.js +22 -64
  256. package/umd/grid.umd.js.map +1 -1
  257. package/umd/plugins/context-menu.umd.js +1 -1
  258. package/umd/plugins/context-menu.umd.js.map +1 -1
  259. package/umd/plugins/filtering.umd.js +1 -1
  260. package/umd/plugins/filtering.umd.js.map +1 -1
  261. package/umd/plugins/grouping-columns.umd.js +1 -1
  262. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  263. package/umd/plugins/grouping-rows.umd.js +1 -1
  264. package/umd/plugins/grouping-rows.umd.js.map +1 -1
  265. package/umd/plugins/master-detail.umd.js +1 -1
  266. package/umd/plugins/master-detail.umd.js.map +1 -1
  267. package/umd/plugins/pinned-rows.umd.js +1 -1
  268. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  269. package/umd/plugins/pivot.umd.js.map +1 -1
  270. package/umd/plugins/selection.umd.js +1 -1
  271. package/umd/plugins/selection.umd.js.map +1 -1
  272. package/index-YjW60MHD.js +0 -3235
  273. package/index-YjW60MHD.js.map +0 -1
package/all.js CHANGED
@@ -1,6 +1,6 @@
1
- import { B as v, D as Ve, r as se, P as N, g as le, a as Oe, e as Ge } from "./index-YjW60MHD.js";
2
- import { k as Kn, i as Nn, b as qn, F as Dn, o as Hn, G as Vn, p as On, b as Gn, q as Bn, j as zn, c as Wn, d as $n, m as jn, n as Un, l as Yn, f as Zn, h as Xn, u as Jn } from "./index-YjW60MHD.js";
3
- function Be(s, e, t, n) {
1
+ import { BaseGridPlugin as v, DEFAULT_GRID_ICONS as Ge, runAggregator as ae, e as Be, s as ze, PLUGIN_QUERIES as N, getAggregator as de, getValueAggregator as We, a as $e, c as V, g as je } from "./index.js";
2
+ import { DEFAULT_ANIMATION_CONFIG as Hn, DGEvents as Vn, DataGridElement as On, FitModeEnum as Gn, GridCSSVars as Bn, GridClasses as zn, GridDataAttrs as Wn, DataGridElement as $n, GridSelectors as jn, PluginEvents as Un, PluginManager as Yn, builtInSort as Zn, defaultComparator as Xn } from "./index.js";
3
+ function Ue(s, e, t, n) {
4
4
  if (n.processCell)
5
5
  return n.processCell(s, e, t);
6
6
  if (s == null) return "";
@@ -10,13 +10,13 @@ function Be(s, e, t, n) {
10
10
  `;
11
11
  return n.quoteStrings || o.includes(i) || o.includes(r) || o.includes('"') ? `"${o.replace(/"/g, '""')}"` : o;
12
12
  }
13
- function V(s) {
13
+ function O(s) {
14
14
  const { rows: e, columns: t, selectedIndices: n, config: o } = s, i = o.delimiter ?? " ", r = o.newline ?? `
15
15
  `, l = t.filter((u) => !u.hidden && !u.field.startsWith("__")), a = [];
16
16
  if (o.includeHeaders) {
17
17
  const u = l.map((h) => {
18
- const g = h.header || h.field;
19
- return g.includes(i) || g.includes(r) || g.includes('"') ? `"${g.replace(/"/g, '""')}"` : g;
18
+ const f = h.header || h.field;
19
+ return f.includes(i) || f.includes(r) || f.includes('"') ? `"${f.replace(/"/g, '""')}"` : f;
20
20
  });
21
21
  a.push(u.join(i));
22
22
  }
@@ -24,14 +24,14 @@ function V(s) {
24
24
  for (const u of c) {
25
25
  const h = e[u];
26
26
  if (!h) continue;
27
- const g = l.map(
28
- (f) => Be(h[f.field], f.field, h, o)
27
+ const f = l.map(
28
+ (g) => Ue(h[g.field], g.field, h, o)
29
29
  );
30
- a.push(g.join(i));
30
+ a.push(f.join(i));
31
31
  }
32
32
  return a.join(r);
33
33
  }
34
- async function O(s) {
34
+ async function G(s) {
35
35
  try {
36
36
  return await navigator.clipboard.writeText(s), !0;
37
37
  } catch {
@@ -41,7 +41,7 @@ async function O(s) {
41
41
  return document.body.removeChild(e), t;
42
42
  }
43
43
  }
44
- function ae(s, e) {
44
+ function ce(s, e) {
45
45
  const t = e.delimiter ?? " ", n = e.newline ?? `
46
46
  `, o = s.replace(/\r\n/g, `
47
47
  `).replace(/\r/g, `
@@ -53,14 +53,14 @@ function ae(s, e) {
53
53
  }
54
54
  return r.push(l), (r.length > 1 || r.some((d) => d.trim() !== "")) && i.push(r), i;
55
55
  }
56
- async function de() {
56
+ async function ue() {
57
57
  try {
58
58
  return await navigator.clipboard.readText();
59
59
  } catch {
60
60
  return "";
61
61
  }
62
62
  }
63
- class bn extends v {
63
+ class Cn extends v {
64
64
  name = "clipboard";
65
65
  version = "1.0.0";
66
66
  get defaultConfig() {
@@ -95,7 +95,7 @@ class bn extends v {
95
95
  const t = this.#n(), n = t?.getSelectedRows() ?? [], o = n.length > 0, i = t?.getRanges() ?? [], r = i.length > 0, l = t?.getSelectedCell() != null;
96
96
  let a, d, c;
97
97
  if (o && t)
98
- a = V({
98
+ a = O({
99
99
  rows: this.rows,
100
100
  columns: [...this.columns],
101
101
  selectedIndices: n,
@@ -118,7 +118,7 @@ class bn extends v {
118
118
  if (!u) return;
119
119
  a = u.text, d = 1, c = 1;
120
120
  }
121
- O(a).then(() => {
121
+ G(a).then(() => {
122
122
  this.lastCopied = { text: a, timestamp: Date.now() }, this.emit("copy", { text: a, rowCount: d, columnCount: c });
123
123
  });
124
124
  }
@@ -126,9 +126,9 @@ class bn extends v {
126
126
  * Handle paste operation
127
127
  */
128
128
  #e() {
129
- de().then((e) => {
129
+ ue().then((e) => {
130
130
  if (!e) return;
131
- const t = ae(e, this.config);
131
+ const t = ce(e, this.config);
132
132
  this.emit("paste", { rows: t, text: e });
133
133
  });
134
134
  }
@@ -168,15 +168,15 @@ class bn extends v {
168
168
  */
169
169
  #i(e) {
170
170
  const { startRow: t, startCol: n, endRow: o, endCol: i } = e, r = Math.min(t, o), l = Math.max(t, o), a = Math.min(n, i), d = Math.max(n, i), c = this.config.delimiter ?? " ", u = this.config.newline ?? `
171
- `, h = [], g = this.columns.slice(a, d + 1);
171
+ `, h = [], f = this.columns.slice(a, d + 1);
172
172
  if (this.config.includeHeaders) {
173
- const f = g.map((m) => m.header || m.field);
174
- h.push(f.join(c));
173
+ const g = f.map((m) => m.header || m.field);
174
+ h.push(g.join(c));
175
175
  }
176
- for (let f = r; f <= l; f++) {
177
- const m = this.rows[f];
176
+ for (let g = r; g <= l; g++) {
177
+ const m = this.rows[g];
178
178
  if (!m) continue;
179
- const p = g.map((R) => {
179
+ const p = f.map((R) => {
180
180
  const E = m[R.field];
181
181
  return E == null ? "" : E instanceof Date ? E.toISOString() : String(E);
182
182
  });
@@ -219,13 +219,13 @@ class bn extends v {
219
219
  * @returns The copied text
220
220
  */
221
221
  async copy() {
222
- const t = this.#n()?.getSelectedRows() ?? [], n = V({
222
+ const t = this.#n()?.getSelectedRows() ?? [], n = O({
223
223
  rows: this.rows,
224
224
  columns: [...this.columns],
225
225
  selectedIndices: t,
226
226
  config: this.config
227
227
  });
228
- return await O(n), this.lastCopied = { text: n, timestamp: Date.now() }, n;
228
+ return await G(n), this.lastCopied = { text: n, timestamp: Date.now() }, n;
229
229
  }
230
230
  /**
231
231
  * Copy specific rows by index to clipboard.
@@ -233,21 +233,21 @@ class bn extends v {
233
233
  * @returns The copied text
234
234
  */
235
235
  async copyRows(e) {
236
- const t = V({
236
+ const t = O({
237
237
  rows: this.rows,
238
238
  columns: [...this.columns],
239
239
  selectedIndices: e,
240
240
  config: this.config
241
241
  });
242
- return await O(t), this.lastCopied = { text: t, timestamp: Date.now() }, t;
242
+ return await G(t), this.lastCopied = { text: t, timestamp: Date.now() }, t;
243
243
  }
244
244
  /**
245
245
  * Read and parse clipboard content.
246
246
  * @returns Parsed 2D array of cell values, or null if clipboard is empty
247
247
  */
248
248
  async paste() {
249
- const e = await de();
250
- return e ? ae(e, this.config) : null;
249
+ const e = await ue();
250
+ return e ? ce(e, this.config) : null;
251
251
  }
252
252
  /**
253
253
  * Get the last copied text and timestamp.
@@ -258,33 +258,33 @@ class bn extends v {
258
258
  }
259
259
  // #endregion
260
260
  }
261
- const ce = 100;
262
- function ee(s) {
261
+ const he = 100;
262
+ function ne(s) {
263
263
  if (s == null)
264
- return ce;
264
+ return he;
265
265
  if (typeof s == "number")
266
266
  return s;
267
267
  const e = parseFloat(s);
268
- return isNaN(e) ? ce : e;
268
+ return isNaN(e) ? he : e;
269
269
  }
270
- function ue(s) {
271
- return s.map((e) => ee(e.width));
270
+ function fe(s) {
271
+ return s.map((e) => ne(e.width));
272
272
  }
273
- function he(s) {
273
+ function ge(s) {
274
274
  const e = [];
275
275
  let t = 0;
276
276
  for (const n of s)
277
- e.push(t), t += ee(n.width);
277
+ e.push(t), t += ne(n.width);
278
278
  return e;
279
279
  }
280
- function ge(s) {
281
- return s.reduce((e, t) => e + ee(t.width), 0);
280
+ function pe(s) {
281
+ return s.reduce((e, t) => e + ne(t.width), 0);
282
282
  }
283
- function ze(s, e, t, n, o) {
283
+ function Ye(s, e, t, n, o) {
284
284
  const i = t.length;
285
285
  if (i === 0)
286
286
  return { startCol: 0, endCol: 0, visibleColumns: [] };
287
- let r = We(s, t, n);
287
+ let r = Ze(s, t, n);
288
288
  r = Math.max(0, r - o);
289
289
  const l = s + e;
290
290
  let a = r;
@@ -301,7 +301,7 @@ function ze(s, e, t, n, o) {
301
301
  d.push(c);
302
302
  return { startCol: r, endCol: a, visibleColumns: d };
303
303
  }
304
- function We(s, e, t) {
304
+ function Ze(s, e, t) {
305
305
  let n = 0, o = e.length - 1;
306
306
  for (; n < o; ) {
307
307
  const i = Math.floor((n + o) / 2);
@@ -309,10 +309,10 @@ function We(s, e, t) {
309
309
  }
310
310
  return n;
311
311
  }
312
- function $e(s, e, t) {
312
+ function Xe(s, e, t) {
313
313
  return t ? s > e : !1;
314
314
  }
315
- class vn extends v {
315
+ class Rn extends v {
316
316
  name = "columnVirtualization";
317
317
  version = "1.0.0";
318
318
  get defaultConfig() {
@@ -335,7 +335,7 @@ class vn extends v {
335
335
  attach(e) {
336
336
  super.attach(e);
337
337
  const t = this.columns;
338
- this.columnWidths = ue(t), this.columnOffsets = he(t), this.totalWidth = ge(t), this.endCol = t.length - 1;
338
+ this.columnWidths = fe(t), this.columnOffsets = ge(t), this.totalWidth = pe(t), this.endCol = t.length - 1;
339
339
  }
340
340
  detach() {
341
341
  this.columnWidths = [], this.columnOffsets = [], this.isVirtualized = !1, this.startCol = 0, this.endCol = 0, this.scrollLeft = 0, this.totalWidth = 0;
@@ -343,10 +343,10 @@ class vn extends v {
343
343
  // #endregion
344
344
  // #region Hooks
345
345
  processColumns(e) {
346
- const t = $e(e.length, this.config.threshold ?? 30, this.config.autoEnable ?? !0);
347
- if (this.isVirtualized = t ?? !1, this.columnWidths = ue(e), this.columnOffsets = he(e), this.totalWidth = ge(e), !t)
346
+ const t = Xe(e.length, this.config.threshold ?? 30, this.config.autoEnable ?? !0);
347
+ if (this.isVirtualized = t ?? !1, this.columnWidths = fe(e), this.columnOffsets = ge(e), this.totalWidth = pe(e), !t)
348
348
  return this.startCol = 0, this.endCol = e.length - 1, [...e];
349
- const n = this.grid.clientWidth || 800, o = ze(
349
+ const n = this.grid.clientWidth || 800, o = Ye(
350
350
  this.scrollLeft,
351
351
  n,
352
352
  this.columnOffsets,
@@ -406,14 +406,14 @@ class vn extends v {
406
406
  }
407
407
  // #endregion
408
408
  }
409
- const je = ".tbw-context-menu{position:fixed;background:light-dark(#f5f5f5,#2a2a2a);color:light-dark(#222,#eee);border:1px solid light-dark(#d0d0d4,#454545);border-radius:4px;box-shadow:0 2px 10px #00000026;min-width:160px;padding:4px 0;z-index:10000;font-size:13px;font-family:system-ui,sans-serif}.tbw-context-menu-item{display:flex;align-items:center;padding:6px 12px;cursor:pointer;gap:8px}.tbw-context-menu-item:hover:not(.disabled){background:light-dark(#e8e8e8,#3a3a3a)}.tbw-context-menu-item.disabled{opacity:.5;cursor:default}.tbw-context-menu-item.danger{color:light-dark(#c00,#f66)}.tbw-context-menu-icon{width:16px;text-align:center}.tbw-context-menu-label{flex:1}.tbw-context-menu-shortcut{color:light-dark(#888,#888);font-size:11px}.tbw-context-menu-arrow{font-size:10px;color:light-dark(#888,#888)}.tbw-context-menu-separator{height:1px;background:light-dark(#d0d0d4,#454545);margin:4px 0}";
410
- function Z(s, e) {
409
+ const B = ".tbw-context-menu{position:fixed;background:light-dark(#f5f5f5,#2a2a2a);color:light-dark(#222,#eee);border:1px solid light-dark(#d0d0d4,#454545);border-radius:4px;box-shadow:0 2px 10px #00000026;min-width:160px;padding:4px 0;z-index:10000;font-size:13px;font-family:system-ui,sans-serif}.tbw-context-menu-item{display:flex;align-items:center;padding:6px 12px;cursor:pointer;gap:8px}.tbw-context-menu-item:hover:not(.disabled){background:light-dark(#e8e8e8,#3a3a3a)}.tbw-context-menu-item.disabled{opacity:.5;cursor:default}.tbw-context-menu-item.danger{color:light-dark(#c00,#f66)}.tbw-context-menu-icon{width:16px;text-align:center}.tbw-context-menu-label{flex:1}.tbw-context-menu-shortcut{color:light-dark(#888,#888);font-size:11px}.tbw-context-menu-arrow{font-size:10px;color:light-dark(#888,#888)}.tbw-context-menu-separator{height:1px;background:light-dark(#d0d0d4,#454545);margin:4px 0}";
410
+ function J(s, e) {
411
411
  return (typeof s == "function" ? s(e) : s).filter((n) => !(n.hidden === !0 || typeof n.hidden == "function" && n.hidden(e)));
412
412
  }
413
- function Ue(s, e) {
413
+ function Je(s, e) {
414
414
  return s.disabled === !0 ? !0 : typeof s.disabled == "function" ? s.disabled(e) : !1;
415
415
  }
416
- function X(s, e, t, n = Ve.submenuArrow) {
416
+ function Q(s, e, t, n = Ge.submenuArrow) {
417
417
  const o = document.createElement("div");
418
418
  o.className = "tbw-context-menu", o.setAttribute("role", "menu");
419
419
  for (const i of s) {
@@ -424,7 +424,7 @@ function X(s, e, t, n = Ve.submenuArrow) {
424
424
  }
425
425
  const r = document.createElement("div");
426
426
  r.className = "tbw-context-menu-item", i.cssClass && r.classList.add(i.cssClass), r.setAttribute("role", "menuitem"), r.setAttribute("data-id", i.id);
427
- const l = Ue(i, e);
427
+ const l = Je(i, e);
428
428
  if (l && (r.classList.add("disabled"), r.setAttribute("aria-disabled", "true")), i.icon) {
429
429
  const d = document.createElement("span");
430
430
  d.className = "tbw-context-menu-icon", d.innerHTML = i.icon, r.appendChild(d);
@@ -438,7 +438,7 @@ function X(s, e, t, n = Ve.submenuArrow) {
438
438
  const d = document.createElement("span");
439
439
  d.className = "tbw-context-menu-arrow", typeof n == "string" ? d.innerHTML = n : n instanceof HTMLElement && d.appendChild(n.cloneNode(!0)), r.appendChild(d), r.addEventListener("mouseenter", () => {
440
440
  if (r.querySelector(".tbw-context-menu") || !i.subMenu) return;
441
- const u = Z(i.subMenu, e), h = X(u, e, t, n);
441
+ const u = J(i.subMenu, e), h = Q(u, e, t, n);
442
442
  h.classList.add("tbw-context-submenu"), h.style.position = "absolute", h.style.left = "100%", h.style.top = "0", r.style.position = "relative", r.appendChild(h);
443
443
  }), r.addEventListener("mouseleave", () => {
444
444
  const c = r.querySelector(".tbw-context-menu");
@@ -451,14 +451,14 @@ function X(s, e, t, n = Ve.submenuArrow) {
451
451
  }
452
452
  return o;
453
453
  }
454
- function fe(s, e, t) {
454
+ function me(s, e, t) {
455
455
  s.style.position = "fixed", s.style.left = `${e}px`, s.style.top = `${t}px`, s.style.visibility = "hidden", s.style.zIndex = "10000";
456
456
  const n = s.getBoundingClientRect(), o = window.innerWidth, i = window.innerHeight;
457
457
  let r = e, l = t;
458
458
  e + n.width > o && (r = e - n.width), t + n.height > i && (l = t - n.height), r = Math.max(0, r), l = Math.max(0, l), s.style.left = `${r}px`, s.style.top = `${l}px`, s.style.visibility = "visible";
459
459
  }
460
- let _ = null, I = null, k = null, G = 0;
461
- const B = [
460
+ let _ = null, I = null, k = null, z = 0;
461
+ const W = [
462
462
  {
463
463
  id: "copy",
464
464
  name: "Copy",
@@ -476,12 +476,12 @@ const B = [
476
476
  }
477
477
  }
478
478
  ];
479
- class xn extends v {
479
+ class Sn extends v {
480
480
  name = "contextMenu";
481
481
  version = "1.0.0";
482
482
  get defaultConfig() {
483
483
  return {
484
- items: B
484
+ items: W
485
485
  };
486
486
  }
487
487
  // #region Internal State
@@ -492,7 +492,7 @@ class xn extends v {
492
492
  // #endregion
493
493
  // #region Lifecycle
494
494
  attach(e) {
495
- super.attach(e), this.installGlobalHandlers(), G++;
495
+ super.attach(e), this.installGlobalHandlers(), z++;
496
496
  }
497
497
  detach() {
498
498
  this.menuElement && (this.menuElement.remove(), this.menuElement = null), this.isOpen = !1, this.params = null, this.uninstallGlobalHandlers();
@@ -500,7 +500,7 @@ class xn extends v {
500
500
  // #endregion
501
501
  // #region Private Methods
502
502
  installGlobalHandlers() {
503
- !k && typeof document < "u" && (k = document.createElement("style"), k.id = "tbw-context-menu-styles", k.textContent = je, document.head.appendChild(k)), _ || (_ = () => {
503
+ !k && typeof document < "u" && typeof B == "string" && B && (k = document.createElement("style"), k.id = "tbw-context-menu-styles", k.textContent = B, document.head.appendChild(k)), _ || (_ = () => {
504
504
  document.querySelectorAll(".tbw-context-menu").forEach((t) => t.remove());
505
505
  }, document.addEventListener("click", _)), I || (I = (e) => {
506
506
  e.key === "Escape" && document.querySelectorAll(".tbw-context-menu").forEach((n) => n.remove());
@@ -511,7 +511,7 @@ class xn extends v {
511
511
  * Uses reference counting to ensure handlers persist while any grid uses the plugin.
512
512
  */
513
513
  uninstallGlobalHandlers() {
514
- G--, !(G > 0) && (_ && (document.removeEventListener("click", _), _ = null), I && (document.removeEventListener("keydown", I), I = null), k && (k.remove(), k = null));
514
+ z--, !(z > 0) && (_ && (document.removeEventListener("click", _), _ = null), I && (document.removeEventListener("keydown", I), I = null), k && (k.remove(), k = null));
515
515
  }
516
516
  // #endregion
517
517
  // #region Hooks
@@ -525,14 +525,14 @@ class xn extends v {
525
525
  const i = o.target, r = i.closest("[data-row][data-col]"), l = i.closest(".header-cell");
526
526
  let a;
527
527
  if (r) {
528
- const c = parseInt(r.getAttribute("data-row") ?? "-1", 10), u = parseInt(r.getAttribute("data-col") ?? "-1", 10), h = this.columns[u], g = this.rows[c];
528
+ const c = parseInt(r.getAttribute("data-row") ?? "-1", 10), u = parseInt(r.getAttribute("data-col") ?? "-1", 10), h = this.columns[u], f = this.rows[c];
529
529
  a = {
530
- row: g,
530
+ row: f,
531
531
  rowIndex: c,
532
532
  column: h,
533
533
  columnIndex: u,
534
534
  field: h?.field ?? "",
535
- value: g?.[h?.field] ?? null,
535
+ value: f?.[h?.field] ?? null,
536
536
  isHeader: !1,
537
537
  event: o
538
538
  };
@@ -551,15 +551,15 @@ class xn extends v {
551
551
  } else
552
552
  return;
553
553
  this.params = a, this.position = { x: o.clientX, y: o.clientY };
554
- const d = Z(this.config.items ?? B, a);
555
- d.length && (this.menuElement && this.menuElement.remove(), this.menuElement = X(
554
+ const d = J(this.config.items ?? W, a);
555
+ d.length && (this.menuElement && this.menuElement.remove(), this.menuElement = Q(
556
556
  d,
557
557
  a,
558
558
  (c) => {
559
559
  c.action && c.action(a), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
560
560
  },
561
561
  this.gridIcons.submenuArrow
562
- ), document.body.appendChild(this.menuElement), fe(this.menuElement, o.clientX, o.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: a, items: d }));
562
+ ), document.body.appendChild(this.menuElement), me(this.menuElement, o.clientX, o.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: a, items: d }));
563
563
  }));
564
564
  }
565
565
  // #endregion
@@ -580,15 +580,15 @@ class xn extends v {
580
580
  value: n.value ?? null,
581
581
  isHeader: n.isHeader ?? !1,
582
582
  event: n.event ?? new MouseEvent("contextmenu")
583
- }, i = Z(this.config.items ?? B, o);
584
- this.menuElement && this.menuElement.remove(), this.menuElement = X(
583
+ }, i = J(this.config.items ?? W, o);
584
+ this.menuElement && this.menuElement.remove(), this.menuElement = Q(
585
585
  i,
586
586
  o,
587
587
  (r) => {
588
588
  r.action && r.action(o), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
589
589
  },
590
590
  this.gridIcons.submenuArrow
591
- ), document.body.appendChild(this.menuElement), fe(this.menuElement, e, t), this.isOpen = !0;
591
+ ), document.body.appendChild(this.menuElement), me(this.menuElement, e, t), this.isOpen = !0;
592
592
  }
593
593
  /**
594
594
  * Hide the context menu.
@@ -606,7 +606,7 @@ class xn extends v {
606
606
  // #endregion
607
607
  // Styles are injected globally via installGlobalHandlers() since menu renders in document.body
608
608
  }
609
- function pe(s, e = !0) {
609
+ function we(s, e = !0) {
610
610
  if (s == null) return "";
611
611
  if (s instanceof Date) return s.toISOString();
612
612
  if (typeof s == "object") return JSON.stringify(s);
@@ -614,37 +614,37 @@ function pe(s, e = !0) {
614
614
  return e && (t.includes(",") || t.includes('"') || t.includes(`
615
615
  `) || t.includes("\r")) ? `"${t.replace(/"/g, '""')}"` : t;
616
616
  }
617
- function Ye(s, e, t, n = {}) {
617
+ function Qe(s, e, t, n = {}) {
618
618
  const o = n.delimiter ?? ",", i = n.newline ?? `
619
619
  `, r = [], l = n.bom ? "\uFEFF" : "";
620
620
  if (t.includeHeaders !== !1) {
621
621
  const a = e.map((d) => {
622
622
  const c = d.header || d.field, u = t.processHeader ? t.processHeader(c, d.field) : c;
623
- return pe(u);
623
+ return we(u);
624
624
  });
625
625
  r.push(a.join(o));
626
626
  }
627
627
  for (const a of s) {
628
628
  const d = e.map((c) => {
629
629
  let u = a[c.field];
630
- return t.processCell && (u = t.processCell(u, c.field, a)), pe(u);
630
+ return t.processCell && (u = t.processCell(u, c.field, a)), we(u);
631
631
  });
632
632
  r.push(d.join(o));
633
633
  }
634
634
  return l + r.join(i);
635
635
  }
636
- function te(s, e) {
636
+ function oe(s, e) {
637
637
  const t = URL.createObjectURL(s), n = document.createElement("a");
638
638
  n.href = t, n.download = e, n.style.display = "none", document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(t);
639
639
  }
640
- function Ze(s, e) {
640
+ function et(s, e) {
641
641
  const t = new Blob([s], { type: "text/csv;charset=utf-8;" });
642
- te(t, e);
642
+ oe(t, e);
643
643
  }
644
- function me(s) {
644
+ function be(s) {
645
645
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
646
646
  }
647
- function Xe(s, e, t) {
647
+ function tt(s, e, t) {
648
648
  let n = `<?xml version="1.0" encoding="UTF-8"?>
649
649
  <?mso-application progid="Excel.Sheet"?>
650
650
  <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
@@ -656,7 +656,7 @@ function Xe(s, e, t) {
656
656
  <Row>`;
657
657
  for (const o of e) {
658
658
  const i = o.header || o.field, r = t.processHeader ? t.processHeader(i, o.field) : i;
659
- n += `<Cell><Data ss:Type="String">${me(r)}</Data></Cell>`;
659
+ n += `<Cell><Data ss:Type="String">${be(r)}</Data></Cell>`;
660
660
  }
661
661
  n += "</Row>";
662
662
  }
@@ -667,7 +667,7 @@ function Xe(s, e, t) {
667
667
  let r = o[i.field];
668
668
  t.processCell && (r = t.processCell(r, i.field, o));
669
669
  let l = "String", a = "";
670
- r == null ? a = "" : typeof r == "number" && !isNaN(r) ? (l = "Number", a = String(r)) : r instanceof Date ? (l = "DateTime", a = r.toISOString()) : a = me(String(r)), n += `<Cell><Data ss:Type="${l}">${a}</Data></Cell>`;
670
+ r == null ? a = "" : typeof r == "number" && !isNaN(r) ? (l = "Number", a = String(r)) : r instanceof Date ? (l = "DateTime", a = r.toISOString()) : a = be(String(r)), n += `<Cell><Data ss:Type="${l}">${a}</Data></Cell>`;
671
671
  }
672
672
  n += "</Row>";
673
673
  }
@@ -676,13 +676,13 @@ function Xe(s, e, t) {
676
676
  </Worksheet>
677
677
  </Workbook>`, n;
678
678
  }
679
- function Je(s, e) {
679
+ function nt(s, e) {
680
680
  const t = e.endsWith(".xls") ? e : `${e}.xls`, n = new Blob([s], {
681
681
  type: "application/vnd.ms-excel;charset=utf-8;"
682
682
  });
683
- te(n, t);
683
+ oe(n, t);
684
684
  }
685
- class yn extends v {
685
+ class kn extends v {
686
686
  name = "export";
687
687
  version = "1.0.0";
688
688
  get defaultConfig() {
@@ -723,27 +723,27 @@ class yn extends v {
723
723
  try {
724
724
  switch (e) {
725
725
  case "csv": {
726
- const a = Ye(r, i, o, { bom: !0 });
727
- l = l.endsWith(".csv") ? l : `${l}.csv`, Ze(a, l);
726
+ const a = Qe(r, i, o, { bom: !0 });
727
+ l = l.endsWith(".csv") ? l : `${l}.csv`, et(a, l);
728
728
  break;
729
729
  }
730
730
  case "excel": {
731
- const a = Xe(r, i, o);
732
- l = l.endsWith(".xls") ? l : `${l}.xls`, Je(a, l);
731
+ const a = tt(r, i, o);
732
+ l = l.endsWith(".xls") ? l : `${l}.xls`, nt(a, l);
733
733
  break;
734
734
  }
735
735
  case "json": {
736
736
  const a = r.map((u) => {
737
737
  const h = {};
738
- for (const g of i) {
739
- let f = u[g.field];
740
- o.processCell && (f = o.processCell(f, g.field, u)), h[g.field] = f;
738
+ for (const f of i) {
739
+ let g = u[f.field];
740
+ o.processCell && (g = o.processCell(g, f.field, u)), h[f.field] = g;
741
741
  }
742
742
  return h;
743
743
  }), d = JSON.stringify(a, null, 2);
744
744
  l = l.endsWith(".json") ? l : `${l}.json`;
745
745
  const c = new Blob([d], { type: "application/json" });
746
- te(c, l);
746
+ oe(c, l);
747
747
  break;
748
748
  }
749
749
  }
@@ -803,7 +803,7 @@ class yn extends v {
803
803
  }
804
804
  // #endregion
805
805
  }
806
- function Qe(s) {
806
+ function ot(s) {
807
807
  const { totalRows: e, viewportHeight: t, scrollTop: n, rowHeight: o, overscan: i } = s, r = Math.ceil(t / o);
808
808
  let l = Math.floor(n / o) - i;
809
809
  l < 0 && (l = 0);
@@ -815,10 +815,10 @@ function Qe(s) {
815
815
  totalHeight: e * o
816
816
  };
817
817
  }
818
- function et(s, e) {
818
+ function it(s, e) {
819
819
  return s <= e;
820
820
  }
821
- function tt(s, e, t = !1) {
821
+ function rt(s, e, t = !1) {
822
822
  const n = s[e.field];
823
823
  if (e.operator === "blank")
824
824
  return n == null || n === "";
@@ -860,10 +860,10 @@ function tt(s, e, t = !1) {
860
860
  return !0;
861
861
  }
862
862
  }
863
- function nt(s, e, t = !1) {
864
- return e.length ? s.filter((n) => e.every((o) => tt(n, o, t))) : s;
863
+ function st(s, e, t = !1) {
864
+ return e.length ? s.filter((n) => e.every((o) => rt(n, o, t))) : s;
865
865
  }
866
- function ot(s) {
866
+ function lt(s) {
867
867
  return JSON.stringify(
868
868
  s.map((e) => ({
869
869
  field: e.field,
@@ -873,7 +873,7 @@ function ot(s) {
873
873
  }))
874
874
  );
875
875
  }
876
- function we(s, e) {
876
+ function ve(s, e) {
877
877
  const t = /* @__PURE__ */ new Set();
878
878
  for (const n of s) {
879
879
  const o = n[e];
@@ -881,7 +881,7 @@ function we(s, e) {
881
881
  }
882
882
  return [...t].sort((n, o) => typeof n == "number" && typeof o == "number" ? n - o : String(n).localeCompare(String(o)));
883
883
  }
884
- const it = '.header-cell.filtered:before{content:"";position:absolute;top:4px;right:4px;width:6px;height:6px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border-radius:50%}.tbw-filter-btn{display:inline-flex;align-items:center;justify-content:center;background:transparent;border:none;cursor:pointer;padding:2px;margin-left:4px;opacity:.4;transition:opacity .15s;color:inherit;vertical-align:middle}.tbw-filter-btn:hover,.tbw-filter-btn.active{opacity:1}.tbw-filter-btn.active{color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}', rt = ".tbw-filter-panel{position:fixed;background:var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));color:var(--tbw-filter-panel-fg, var(--tbw-color-fg, light-dark(#222222, #eeeeee)));border:1px solid var(--tbw-filter-panel-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-panel-radius, var(--tbw-border-radius, 4px));box-shadow:0 4px 16px var(--tbw-filter-panel-shadow, var(--tbw-color-shadow, light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3))));padding:12px;z-index:10000;min-width:200px;max-width:280px;max-height:350px;display:flex;flex-direction:column;font-family:var(--tbw-font-family, system-ui, sans-serif);font-size:var(--tbw-font-size, 13px)}.tbw-filter-search{margin-bottom:8px}.tbw-filter-search-input{width:100%;padding:6px 10px;background:var(--tbw-filter-input-bg, var(--tbw-color-bg, transparent));color:inherit;border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-input-radius, 4px);font-size:inherit;box-sizing:border-box}.tbw-filter-search-input:focus{outline:none;border-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));box-shadow:0 0 0 2px rgba(from var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6)) r g b / 15%)}.tbw-filter-actions{display:flex;padding:4px 2px;margin-bottom:8px;border-bottom:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-action-btn{background:transparent;border:none;color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));cursor:pointer;font-size:12px;padding:2px 0}.tbw-filter-action-btn:hover{text-decoration:underline}.tbw-filter-values{flex:1;overflow-y:auto;margin-bottom:8px;max-height:180px;position:relative}.tbw-filter-values-spacer{width:1px}.tbw-filter-values-content{position:absolute;top:0;left:0;right:0}.tbw-filter-value-item{display:flex;align-items:center;gap:8px;padding:4px 2px;cursor:pointer;border-radius:3px}.tbw-filter-value-item:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}.tbw-filter-checkbox{margin:0;cursor:pointer;accent-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}.tbw-filter-no-match{color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));padding:8px 0;text-align:center;font-style:italic}.tbw-filter-buttons{display:flex;gap:8px;padding-top:8px;border-top:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-apply-btn{flex:1;padding:6px 12px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));color:var(--tbw-filter-accent-fg, var(--tbw-color-accent-fg, light-dark(#ffffff, #000000)));border:none;border-radius:4px;cursor:pointer;font-size:13px}.tbw-filter-apply-btn:hover{filter:brightness(.9)}.tbw-filter-clear-btn{flex:1;padding:6px 12px;background:transparent;color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:4px;cursor:pointer;font-size:13px}.tbw-filter-clear-btn:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}";
884
+ const at = ':host .tbw-quick-filter-input{flex:1;max-width:300px;height:28px;padding:0 8px;border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);color:var(--tbw-color-fg);font-size:13px}:host .tbw-quick-filter-input:focus{outline:none;border-color:var(--tbw-color-accent)}.header-cell.filtered:before{content:"";position:absolute;top:4px;right:4px;width:6px;height:6px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border-radius:50%}.tbw-filter-btn{display:inline-flex;align-items:center;justify-content:center;background:transparent;border:none;cursor:pointer;padding:2px;margin-left:4px;opacity:.4;transition:opacity .15s;color:inherit;vertical-align:middle}.tbw-filter-btn:hover,.tbw-filter-btn.active{opacity:1}.tbw-filter-btn.active{color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}', dt = ".tbw-filter-panel{position:fixed;background:var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));color:var(--tbw-filter-panel-fg, var(--tbw-color-fg, light-dark(#222222, #eeeeee)));border:1px solid var(--tbw-filter-panel-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-panel-radius, var(--tbw-border-radius, 4px));box-shadow:0 4px 16px var(--tbw-filter-panel-shadow, var(--tbw-color-shadow, light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3))));padding:12px;z-index:10000;min-width:200px;max-width:280px;max-height:350px;display:flex;flex-direction:column;font-family:var(--tbw-font-family, system-ui, sans-serif);font-size:var(--tbw-font-size, 13px)}.tbw-filter-search{margin-bottom:8px}.tbw-filter-search-input{width:100%;padding:6px 10px;background:var(--tbw-filter-input-bg, var(--tbw-color-bg, transparent));color:inherit;border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-input-radius, 4px);font-size:inherit;box-sizing:border-box}.tbw-filter-search-input:focus{outline:none;border-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));box-shadow:0 0 0 2px rgba(from var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6)) r g b / 15%)}.tbw-filter-actions{display:flex;padding:4px 2px;margin-bottom:8px;border-bottom:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-action-btn{background:transparent;border:none;color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));cursor:pointer;font-size:12px;padding:2px 0}.tbw-filter-action-btn:hover{text-decoration:underline}.tbw-filter-values{flex:1;overflow-y:auto;margin-bottom:8px;max-height:180px;position:relative}.tbw-filter-values-spacer{width:1px}.tbw-filter-values-content{position:absolute;top:0;left:0;right:0}.tbw-filter-value-item{display:flex;align-items:center;gap:8px;padding:4px 2px;cursor:pointer;border-radius:3px}.tbw-filter-value-item:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}.tbw-filter-checkbox{margin:0;cursor:pointer;accent-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}.tbw-filter-no-match{color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));padding:8px 0;text-align:center;font-style:italic}.tbw-filter-buttons{display:flex;gap:8px;padding-top:8px;border-top:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-apply-btn{flex:1;padding:6px 12px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));color:var(--tbw-filter-accent-fg, var(--tbw-color-accent-fg, light-dark(#ffffff, #000000)));border:none;border-radius:4px;cursor:pointer;font-size:13px}.tbw-filter-apply-btn:hover{filter:brightness(.9)}.tbw-filter-clear-btn{flex:1;padding:6px 12px;background:transparent;color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:4px;cursor:pointer;font-size:13px}.tbw-filter-clear-btn:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}";
885
885
  class A extends v {
886
886
  name = "filtering";
887
887
  version = "1.0.0";
@@ -924,10 +924,10 @@ class A extends v {
924
924
  if (!t.length) return [...e];
925
925
  if (this.config.filterHandler)
926
926
  return this.cachedResult ? this.cachedResult : [...e];
927
- const n = ot(t);
927
+ const n = lt(t);
928
928
  if (this.cacheKey === n && this.cachedResult)
929
929
  return this.cachedResult;
930
- const o = nt([...e], t, this.config.caseSensitive);
930
+ const o = st([...e], t, this.config.caseSensitive);
931
931
  return this.cachedResult = o, this.cacheKey = n, o;
932
932
  }
933
933
  afterRender() {
@@ -1029,7 +1029,7 @@ class A extends v {
1029
1029
  * Uses sourceRows to include all values regardless of current filter.
1030
1030
  */
1031
1031
  getUniqueValues(e) {
1032
- return we(this.sourceRows, e);
1032
+ return ve(this.sourceRows, e);
1033
1033
  }
1034
1034
  // #endregion
1035
1035
  // #region Private Methods
@@ -1043,7 +1043,7 @@ class A extends v {
1043
1043
  return;
1044
1044
  }
1045
1045
  const e = document.createElement("style");
1046
- e.id = "tbw-filter-panel-styles", e.textContent = rt, document.head.appendChild(e), this.globalStylesInjected = !0;
1046
+ e.id = "tbw-filter-panel-styles", e.textContent = dt, document.head.appendChild(e), this.globalStylesInjected = !0;
1047
1047
  }
1048
1048
  /**
1049
1049
  * Toggle the filter panel for a field
@@ -1061,7 +1061,7 @@ class A extends v {
1061
1061
  });
1062
1062
  return;
1063
1063
  }
1064
- const i = we(this.sourceRows, e);
1064
+ const i = ve(this.sourceRows, e);
1065
1065
  this.renderPanelContent(e, t, o, i), document.body.appendChild(o), this.positionPanel(o, n), this.setupPanelCloseHandler(o, n);
1066
1066
  }
1067
1067
  /**
@@ -1146,12 +1146,12 @@ class A extends v {
1146
1146
  p.set(y, w);
1147
1147
  h(), H();
1148
1148
  }), e.appendChild(a);
1149
- const g = document.createElement("div");
1150
- g.className = "tbw-filter-values";
1151
1149
  const f = document.createElement("div");
1152
- f.className = "tbw-filter-values-spacer", g.appendChild(f);
1150
+ f.className = "tbw-filter-values";
1151
+ const g = document.createElement("div");
1152
+ g.className = "tbw-filter-values-spacer", f.appendChild(g);
1153
1153
  const m = document.createElement("div");
1154
- m.className = "tbw-filter-values-content", g.appendChild(m);
1154
+ m.className = "tbw-filter-values-content", f.appendChild(m);
1155
1155
  const p = /* @__PURE__ */ new Map();
1156
1156
  n.forEach((w) => {
1157
1157
  const y = w == null ? "__null__" : String(w);
@@ -1165,17 +1165,17 @@ class A extends v {
1165
1165
  S.type = "checkbox", S.className = "tbw-filter-checkbox", S.checked = p.get(x) ?? !0, S.dataset.value = x, S.addEventListener("change", () => {
1166
1166
  p.set(x, S.checked), h();
1167
1167
  });
1168
- const re = document.createElement("span");
1169
- return re.textContent = C, b.appendChild(S), b.appendChild(re), b;
1168
+ const le = document.createElement("span");
1169
+ return le.textContent = C, b.appendChild(S), b.appendChild(le), b;
1170
1170
  }, H = () => {
1171
- const w = R.length, y = g.clientHeight, C = g.scrollTop;
1172
- if (f.style.height = `${w * A.LIST_ITEM_HEIGHT}px`, et(w, A.LIST_BYPASS_THRESHOLD / 3)) {
1171
+ const w = R.length, y = f.clientHeight, C = f.scrollTop;
1172
+ if (g.style.height = `${w * A.LIST_ITEM_HEIGHT}px`, it(w, A.LIST_BYPASS_THRESHOLD / 3)) {
1173
1173
  m.innerHTML = "", m.style.transform = "translateY(0px)", R.forEach((b, S) => {
1174
1174
  m.appendChild(E(b, S));
1175
1175
  });
1176
1176
  return;
1177
1177
  }
1178
- const x = Qe({
1178
+ const x = ot({
1179
1179
  totalRows: w,
1180
1180
  viewportHeight: y,
1181
1181
  scrollTop: C,
@@ -1185,36 +1185,36 @@ class A extends v {
1185
1185
  m.style.transform = `translateY(${x.offsetY}px)`, m.innerHTML = "";
1186
1186
  for (let b = x.start; b < x.end; b++)
1187
1187
  m.appendChild(E(R[b], b - x.start));
1188
- }, oe = (w) => {
1188
+ }, re = (w) => {
1189
1189
  const y = w.toLowerCase();
1190
1190
  if (R = n.filter((C) => {
1191
1191
  const x = C == null ? "(Blank)" : String(C);
1192
1192
  return !w || x.toLowerCase().includes(y);
1193
1193
  }), R.length === 0) {
1194
- f.style.height = "0px", m.innerHTML = "";
1194
+ g.style.height = "0px", m.innerHTML = "";
1195
1195
  const C = document.createElement("div");
1196
1196
  C.className = "tbw-filter-no-match", C.textContent = "No matching values", m.appendChild(C);
1197
1197
  return;
1198
1198
  }
1199
1199
  H();
1200
1200
  };
1201
- g.addEventListener(
1201
+ f.addEventListener(
1202
1202
  "scroll",
1203
1203
  () => {
1204
1204
  R.length > 0 && H();
1205
1205
  },
1206
1206
  { passive: !0 }
1207
- ), oe(l.value), e.appendChild(g);
1208
- let ie;
1207
+ ), re(l.value), e.appendChild(f);
1208
+ let se;
1209
1209
  l.addEventListener("input", () => {
1210
- clearTimeout(ie), ie = setTimeout(() => {
1211
- this.searchText.set(i, l.value), oe(l.value);
1210
+ clearTimeout(se), se = setTimeout(() => {
1211
+ this.searchText.set(i, l.value), re(l.value);
1212
1212
  }, this.config.debounceMs ?? 150);
1213
1213
  });
1214
- const P = document.createElement("div");
1215
- P.className = "tbw-filter-buttons";
1216
- const M = document.createElement("button");
1217
- M.className = "tbw-filter-apply-btn", M.textContent = "Apply", M.addEventListener("click", () => {
1214
+ const M = document.createElement("div");
1215
+ M.className = "tbw-filter-buttons";
1216
+ const P = document.createElement("button");
1217
+ P.className = "tbw-filter-apply-btn", P.textContent = "Apply", P.addEventListener("click", () => {
1218
1218
  const w = [];
1219
1219
  for (const [y, C] of p)
1220
1220
  if (!C)
@@ -1225,11 +1225,11 @@ class A extends v {
1225
1225
  w.push(x !== void 0 ? x : y);
1226
1226
  }
1227
1227
  t.applySetFilter(w);
1228
- }), P.appendChild(M);
1228
+ }), M.appendChild(P);
1229
1229
  const K = document.createElement("button");
1230
1230
  K.className = "tbw-filter-clear-btn", K.textContent = "Clear Filter", K.addEventListener("click", () => {
1231
1231
  t.clearFilter();
1232
- }), P.appendChild(K), e.appendChild(P);
1232
+ }), M.appendChild(K), e.appendChild(M);
1233
1233
  }
1234
1234
  /**
1235
1235
  * Apply a set filter (exclude values)
@@ -1313,10 +1313,10 @@ class A extends v {
1313
1313
  }
1314
1314
  // #endregion
1315
1315
  // #region Styles
1316
- styles = it;
1316
+ styles = at;
1317
1317
  // #endregion
1318
1318
  }
1319
- function st(s) {
1319
+ function ct(s) {
1320
1320
  if (!s.length) return [];
1321
1321
  const e = /* @__PURE__ */ new Map(), t = [], n = (r, l) => {
1322
1322
  if (!l.length) return;
@@ -1351,7 +1351,7 @@ function st(s) {
1351
1351
  }, e.set(d, c), t.push(c)), c.columns.push(r);
1352
1352
  }), o.length && n(i, o), t.length === 1 && t[0].implicit && t[0].columns.length === s.length ? [] : t;
1353
1353
  }
1354
- function lt(s, e, t) {
1354
+ function ut(s, e, t) {
1355
1355
  if (!e.length || !s) return;
1356
1356
  const n = /* @__PURE__ */ new Map();
1357
1357
  for (const i of e)
@@ -1367,7 +1367,7 @@ function lt(s, e, t) {
1367
1367
  l && l.classList.add("group-end");
1368
1368
  }
1369
1369
  }
1370
- function at(s, e) {
1370
+ function ht(s, e) {
1371
1371
  if (s.length === 0) return null;
1372
1372
  const t = document.createElement("div");
1373
1373
  t.className = "header-group-row", t.setAttribute("role", "row");
@@ -1377,11 +1377,11 @@ function at(s, e) {
1377
1377
  }
1378
1378
  return t;
1379
1379
  }
1380
- function dt(s) {
1380
+ function ft(s) {
1381
1381
  return s.some((e) => e.group != null);
1382
1382
  }
1383
- const ct = ".header-group-row{display:grid;grid-auto-flow:column;background:var(--tbw-grouping-columns-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-grouping-columns-border, var(--tbw-color-border))}.header-group-cell{display:flex;align-items:center;justify-content:center;padding:4px 8px;font-weight:600;font-size:.9em;text-transform:uppercase;letter-spacing:.5px;border-right:1px solid var(--tbw-grouping-columns-border, var(--tbw-color-border))}.header-group-cell:last-child{border-right:none}.header-row .cell.grouped{border-top:none}.header-row .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong))}.header-row .cell.group-end:last-child{border-right:none}.header-group-row.no-borders{border-bottom:none}.header-group-row.no-borders .header-group-cell{border-right:none}.header-row.no-group-borders .cell.group-end{border-right:1px solid var(--tbw-color-border)}";
1384
- class Cn extends v {
1383
+ const gt = ".header-group-row{display:grid;grid-auto-flow:column;background:var(--tbw-grouping-columns-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-grouping-columns-border, var(--tbw-color-border))}.header-group-cell{display:flex;align-items:center;justify-content:center;padding:4px 8px;font-weight:600;font-size:.9em;text-transform:uppercase;letter-spacing:.5px;border-right:1px solid var(--tbw-grouping-columns-border, var(--tbw-color-border))}.header-group-cell:last-child{border-right:none}.header-row .cell.grouped{border-top:none}.header-row .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong))}.header-row .cell.group-end:last-child{border-right:none}.header-group-row.no-borders{border-bottom:none}.header-group-row.no-borders .header-group-cell{border-right:none}.header-row.no-group-borders .cell.group-end{border-right:1px solid var(--tbw-color-border)}";
1384
+ class En extends v {
1385
1385
  name = "groupingColumns";
1386
1386
  version = "1.0.0";
1387
1387
  get defaultConfig() {
@@ -1401,16 +1401,32 @@ class Cn extends v {
1401
1401
  // #region Static Detection
1402
1402
  /**
1403
1403
  * Auto-detect column groups from column configuration.
1404
+ * Detects both inline `column.group` properties and declarative `columnGroups` config.
1404
1405
  */
1405
1406
  static detect(e, t) {
1407
+ if (t?.columnGroups && Array.isArray(t.columnGroups) && t.columnGroups.length > 0)
1408
+ return !0;
1406
1409
  const n = t?.columns;
1407
- return Array.isArray(n) ? dt(n) : !1;
1410
+ return Array.isArray(n) ? ft(n) : !1;
1408
1411
  }
1409
1412
  // #endregion
1410
1413
  // #region Hooks
1411
1414
  processColumns(e) {
1412
- const t = st(e);
1413
- return t.length === 0 ? (this.isActive = !1, this.groups = [], [...e]) : (this.isActive = !0, this.groups = t, [...e]);
1415
+ const t = this.grid?.gridConfig?.columnGroups;
1416
+ let n;
1417
+ if (t && Array.isArray(t) && t.length > 0) {
1418
+ const i = /* @__PURE__ */ new Map();
1419
+ for (const r of t)
1420
+ for (const l of r.children)
1421
+ i.set(l, { id: r.id, label: r.header });
1422
+ n = e.map((r) => {
1423
+ const l = i.get(r.field);
1424
+ return l && !r.group ? { ...r, group: l } : r;
1425
+ });
1426
+ } else
1427
+ n = [...e];
1428
+ const o = ct(n);
1429
+ return o.length === 0 ? (this.isActive = !1, this.groups = [], n) : (this.isActive = !0, this.groups = o, n);
1414
1430
  }
1415
1431
  afterRender() {
1416
1432
  if (!this.isActive || this.groups.length === 0) {
@@ -1422,14 +1438,14 @@ class Cn extends v {
1422
1438
  if (!e) return;
1423
1439
  const t = e.querySelector(".header-group-row");
1424
1440
  t && t.remove();
1425
- const n = at(this.groups, this.columns);
1441
+ const n = ht(this.groups, this.columns);
1426
1442
  if (n) {
1427
1443
  n.classList.toggle("no-borders", !this.config.showGroupBorders);
1428
1444
  const i = e.querySelector(".header-row");
1429
1445
  i ? e.insertBefore(n, i) : e.appendChild(n);
1430
1446
  }
1431
1447
  const o = e.querySelector(".header-row");
1432
- o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), lt(o, this.groups, this.columns));
1448
+ o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), ut(o, this.groups, this.columns));
1433
1449
  }
1434
1450
  // #endregion
1435
1451
  // #region Public API
@@ -1464,10 +1480,10 @@ class Cn extends v {
1464
1480
  }
1465
1481
  // #endregion
1466
1482
  // #region Styles
1467
- styles = ct;
1483
+ styles = gt;
1468
1484
  // #endregion
1469
1485
  }
1470
- function ut({ rows: s, config: e, expanded: t }) {
1486
+ function pt({ rows: s, config: e, expanded: t }) {
1471
1487
  const n = e.groupOn;
1472
1488
  if (typeof n != "function")
1473
1489
  return [];
@@ -1477,9 +1493,9 @@ function ut({ rows: s, config: e, expanded: t }) {
1477
1493
  a == null || a === !1 ? a = ["__ungrouped__"] : Array.isArray(a) || (a = [a]);
1478
1494
  let d = o;
1479
1495
  a.forEach((c, u) => {
1480
- const h = c == null ? "∅" : String(c), g = d.key === "__root__" ? h : d.key + "||" + h;
1481
- let f = d.children.get(h);
1482
- f || (f = { key: g, value: c, depth: u, rows: [], children: /* @__PURE__ */ new Map(), parent: d }, d.children.set(h, f)), d = f;
1496
+ const h = c == null ? "∅" : String(c), f = d.key === "__root__" ? h : d.key + "||" + h;
1497
+ let g = d.children.get(h);
1498
+ g || (g = { key: f, value: c, depth: u, rows: [], children: /* @__PURE__ */ new Map(), parent: d }, d.children.set(h, g)), d = g;
1483
1499
  }), d.rows.push(l);
1484
1500
  }), o.children.size === 1 && o.children.has("__ungrouped__") && o.children.get("__ungrouped__").rows.length === s.length)
1485
1501
  return [];
@@ -1500,24 +1516,24 @@ function ut({ rows: s, config: e, expanded: t }) {
1500
1516
  };
1501
1517
  return r(o), i;
1502
1518
  }
1503
- function ht(s, e) {
1519
+ function mt(s, e) {
1504
1520
  const t = new Set(s);
1505
1521
  return t.has(e) ? t.delete(e) : t.add(e), t;
1506
1522
  }
1507
- function gt(s) {
1523
+ function wt(s) {
1508
1524
  const e = /* @__PURE__ */ new Set();
1509
1525
  for (const t of s)
1510
1526
  t.kind === "group" && e.add(t.key);
1511
1527
  return e;
1512
1528
  }
1513
- function ft() {
1529
+ function bt() {
1514
1530
  return /* @__PURE__ */ new Set();
1515
1531
  }
1516
- function pt(s) {
1532
+ function vt(s) {
1517
1533
  return s.kind !== "group" ? 0 : s.rows.length;
1518
1534
  }
1519
- const mt = '.group-row{background:var(--tbw-grouping-rows-bg, var(--tbw-color-panel-bg));font-weight:500}.group-row:hover{background:var(--tbw-grouping-rows-bg-hover, var(--tbw-color-row-hover))}.group-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;margin-right:4px}.group-toggle:hover{background:var(--tbw-grouping-rows-toggle-hover, var(--tbw-color-row-hover));border-radius:2px}.group-label{display:inline-flex;align-items:center;gap:8px}.group-count{color:var(--tbw-grouping-rows-count-color, var(--tbw-color-fg-muted));font-size:.85em;font-weight:400}[data-group-depth="0"] .group-label{padding-left:0}[data-group-depth="1"] .group-label{padding-left:20px}[data-group-depth="2"] .group-label{padding-left:40px}[data-group-depth="3"] .group-label{padding-left:60px}[data-group-depth="4"] .group-label{padding-left:80px}.data-grid-row.tbw-group-slide-in{animation:tbw-group-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.data-grid-row.tbw-group-fade-in{animation:tbw-group-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-fade-in{0%{opacity:0}to{opacity:1}}';
1520
- class Rn extends v {
1535
+ const xt = '.group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-grouping-rows-bg, var(--tbw-color-panel-bg));font-weight:500;border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height)}.group-row .cell{display:flex;align-items:center;padding:var(--tbw-cell-padding, 2px 8px)}.group-row:hover{background:var(--tbw-grouping-rows-bg-hover, var(--tbw-color-row-hover))}.group-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;margin-right:4px;background:none;border:0;font:inherit}.group-toggle:hover{background:var(--tbw-grouping-rows-toggle-hover, var(--tbw-color-row-hover));border-radius:2px}.group-label{display:inline-flex;align-items:center;gap:8px}.group-count{color:var(--tbw-grouping-rows-count-color, var(--tbw-color-fg-muted));font-size:.85em;font-weight:400}[data-group-depth="0"] .group-label{padding-left:0}[data-group-depth="1"] .group-label{padding-left:20px}[data-group-depth="2"] .group-label{padding-left:40px}[data-group-depth="3"] .group-label{padding-left:60px}[data-group-depth="4"] .group-label{padding-left:80px}.data-grid-row.tbw-group-slide-in{animation:tbw-group-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.data-grid-row.tbw-group-fade-in{animation:tbw-group-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-fade-in{0%{opacity:0}to{opacity:1}}';
1536
+ class An extends v {
1521
1537
  name = "groupingRows";
1522
1538
  version = "1.0.0";
1523
1539
  get defaultConfig() {
@@ -1565,7 +1581,7 @@ class Rn extends v {
1565
1581
  const t = this.config;
1566
1582
  if (typeof t.groupOn != "function")
1567
1583
  return this.isActive = !1, this.flattenedRows = [], [...e];
1568
- const n = ut({
1584
+ const n = pt({
1569
1585
  rows: e,
1570
1586
  config: t,
1571
1587
  expanded: this.expandedKeys
@@ -1586,7 +1602,7 @@ class Rn extends v {
1586
1602
  __groupDepth: i.depth,
1587
1603
  __groupRows: i.rows,
1588
1604
  __groupExpanded: i.expanded,
1589
- __groupRowCount: pt(i)
1605
+ __groupRowCount: vt(i)
1590
1606
  } : i.row);
1591
1607
  }
1592
1608
  onCellClick(e) {
@@ -1655,27 +1671,27 @@ class Rn extends v {
1655
1671
  d && (t.style.display = "grid", t.style.gridTemplateColumns = d), r.forEach((c, u) => {
1656
1672
  const h = document.createElement("div");
1657
1673
  if (h.className = "cell group-cell", h.setAttribute("data-col", String(u)), h.setAttribute("role", "gridcell"), u === 0) {
1658
- const g = document.createElement("button");
1659
- g.type = "button", g.className = `group-toggle${e.__groupExpanded ? " expanded" : ""}`, g.setAttribute("aria-label", e.__groupExpanded ? "Collapse group" : "Expand group"), this.setIcon(g, this.resolveIcon(e.__groupExpanded ? "collapse" : "expand")), g.addEventListener("click", (p) => {
1674
+ const f = document.createElement("button");
1675
+ f.type = "button", f.className = `group-toggle${e.__groupExpanded ? " expanded" : ""}`, f.setAttribute("aria-label", e.__groupExpanded ? "Collapse group" : "Expand group"), this.setIcon(f, this.resolveIcon(e.__groupExpanded ? "collapse" : "expand")), f.addEventListener("click", (p) => {
1660
1676
  p.stopPropagation(), n();
1661
- }), h.appendChild(g);
1662
- const f = document.createElement("span"), m = i[c.field];
1677
+ }), h.appendChild(f);
1678
+ const g = document.createElement("span"), m = i[c.field];
1663
1679
  if (m) {
1664
- const p = se(m, l, c.field, c);
1665
- f.textContent = p != null ? String(p) : String(e.__groupValue);
1680
+ const p = ae(m, l, c.field, c);
1681
+ g.textContent = p != null ? String(p) : String(e.__groupValue);
1666
1682
  } else {
1667
1683
  const p = o.formatLabel ? o.formatLabel(e.__groupValue, e.__groupDepth || 0, e.__groupKey) : String(e.__groupValue);
1668
- f.textContent = p;
1684
+ g.textContent = p;
1669
1685
  }
1670
- if (h.appendChild(f), o.showRowCount !== !1) {
1686
+ if (h.appendChild(g), o.showRowCount !== !1) {
1671
1687
  const p = document.createElement("span");
1672
1688
  p.className = "group-count", p.textContent = ` (${l.length})`, h.appendChild(p);
1673
1689
  }
1674
1690
  } else {
1675
- const g = i[c.field];
1676
- if (g) {
1677
- const f = se(g, l, c.field, c);
1678
- h.textContent = f != null ? String(f) : "";
1691
+ const f = i[c.field];
1692
+ if (f) {
1693
+ const g = ae(f, l, c.field, c);
1694
+ h.textContent = g != null ? String(g) : "";
1679
1695
  } else
1680
1696
  h.textContent = "";
1681
1697
  }
@@ -1688,20 +1704,20 @@ class Rn extends v {
1688
1704
  * Expand all groups.
1689
1705
  */
1690
1706
  expandAll() {
1691
- this.expandedKeys = gt(this.flattenedRows), this.requestRender();
1707
+ this.expandedKeys = wt(this.flattenedRows), this.requestRender();
1692
1708
  }
1693
1709
  /**
1694
1710
  * Collapse all groups.
1695
1711
  */
1696
1712
  collapseAll() {
1697
- this.expandedKeys = ft(), this.requestRender();
1713
+ this.expandedKeys = bt(), this.requestRender();
1698
1714
  }
1699
1715
  /**
1700
1716
  * Toggle expansion of a specific group.
1701
1717
  * @param key - The group key to toggle
1702
1718
  */
1703
1719
  toggle(e) {
1704
- this.expandedKeys = ht(this.expandedKeys, e);
1720
+ this.expandedKeys = mt(this.expandedKeys, e);
1705
1721
  const t = this.flattenedRows.find((n) => n.kind === "group" && n.key === e);
1706
1722
  this.emit("group-toggle", {
1707
1723
  key: e,
@@ -1792,25 +1808,25 @@ class Rn extends v {
1792
1808
  }
1793
1809
  // #endregion
1794
1810
  // #region Styles
1795
- styles = mt;
1811
+ styles = xt;
1796
1812
  // #endregion
1797
1813
  }
1798
- function z(s, e) {
1814
+ function $(s, e) {
1799
1815
  const t = new Set(s);
1800
1816
  return t.has(e) ? t.delete(e) : t.add(e), t;
1801
1817
  }
1802
- function wt(s, e) {
1818
+ function yt(s, e) {
1803
1819
  const t = new Set(s);
1804
1820
  return t.add(e), t;
1805
1821
  }
1806
- function bt(s, e) {
1822
+ function Ct(s, e) {
1807
1823
  const t = new Set(s);
1808
1824
  return t.delete(e), t;
1809
1825
  }
1810
- function vt(s, e) {
1826
+ function Rt(s, e) {
1811
1827
  return s.has(e);
1812
1828
  }
1813
- function xt(s, e, t, n) {
1829
+ function St(s, e, t, n) {
1814
1830
  const o = document.createElement("div");
1815
1831
  o.className = "master-detail-row", o.setAttribute("data-detail-for", String(e)), o.setAttribute("role", "row");
1816
1832
  const i = document.createElement("div");
@@ -1818,8 +1834,8 @@ function xt(s, e, t, n) {
1818
1834
  const r = t(s, e);
1819
1835
  return typeof r == "string" ? i.innerHTML = r : r instanceof HTMLElement && i.appendChild(r), o.appendChild(i), o;
1820
1836
  }
1821
- const yt = ".master-detail-cell-wrapper{display:flex;align-items:center;gap:4px}.master-detail-toggle{cursor:pointer;opacity:.7;user-select:none;display:inline-flex;align-items:center;justify-content:center}.master-detail-toggle:hover{opacity:1}.master-detail-row{grid-column:1 / -1;display:grid;background:var(--tbw-master-detail-bg, var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border, var(--tbw-color-border));overflow:hidden}.master-detail-cell{padding:16px;overflow:auto}.master-detail-row.tbw-expanding{animation:tbw-detail-expand var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.master-detail-row.tbw-collapsing{animation:tbw-detail-collapse var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-detail-expand{0%{opacity:0;max-height:0;padding-top:0;padding-bottom:0}to{opacity:1;max-height:500px;padding-top:16px;padding-bottom:16px}}@keyframes tbw-detail-collapse{0%{opacity:1;max-height:500px}to{opacity:0;max-height:0}}";
1822
- class Sn extends v {
1837
+ const kt = ".master-detail-cell-wrapper{display:flex;align-items:center;gap:4px}.master-detail-toggle{cursor:pointer;opacity:.7;user-select:none;display:inline-flex;align-items:center;justify-content:center}.master-detail-toggle:hover{opacity:1}.master-detail-row{grid-column:1 / -1;display:grid;background:var(--tbw-master-detail-bg, var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border, var(--tbw-color-border));overflow:hidden}.master-detail-cell{padding:16px;overflow:auto}.master-detail-row.tbw-expanding{animation:tbw-detail-expand var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.master-detail-row.tbw-collapsing{animation:tbw-detail-collapse var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-detail-expand{0%{opacity:0;max-height:0;padding-top:0;padding-bottom:0}to{opacity:1;max-height:500px;padding-top:16px;padding-bottom:16px}}@keyframes tbw-detail-collapse{0%{opacity:1;max-height:500px}to{opacity:0;max-height:0}}";
1838
+ class _n extends v {
1823
1839
  name = "masterDetail";
1824
1840
  version = "1.0.0";
1825
1841
  get defaultConfig() {
@@ -1832,6 +1848,58 @@ class Sn extends v {
1832
1848
  // Plugin's own default
1833
1849
  };
1834
1850
  }
1851
+ // #region Light DOM Parsing
1852
+ /**
1853
+ * Called when plugin is attached to the grid.
1854
+ * Parses light DOM for `<tbw-grid-detail>` elements to configure detail templates.
1855
+ */
1856
+ attach(e) {
1857
+ super.attach(e), this.parseLightDomDetail();
1858
+ }
1859
+ /**
1860
+ * Parse `<tbw-grid-detail>` elements from the grid's light DOM.
1861
+ *
1862
+ * Allows declarative configuration:
1863
+ * ```html
1864
+ * <tbw-grid [rows]="data">
1865
+ * <tbw-grid-detail>
1866
+ * <div class="detail-content">
1867
+ * <p>Name: {{ row.name }}</p>
1868
+ * <p>Email: {{ row.email }}</p>
1869
+ * </div>
1870
+ * </tbw-grid-detail>
1871
+ * </tbw-grid>
1872
+ * ```
1873
+ *
1874
+ * Attributes:
1875
+ * - `animation`: 'slide' | 'fade' | 'false' (default: 'slide')
1876
+ * - `show-expand-column`: 'true' | 'false' (default: 'true')
1877
+ * - `expand-on-row-click`: 'true' | 'false' (default: 'false')
1878
+ * - `collapse-on-click-outside`: 'true' | 'false' (default: 'false')
1879
+ * - `height`: number (pixels) or 'auto' (default: 'auto')
1880
+ */
1881
+ parseLightDomDetail() {
1882
+ const e = this.grid;
1883
+ if (!e || typeof e.querySelector != "function") return;
1884
+ const t = e.querySelector("tbw-grid-detail");
1885
+ if (!t) return;
1886
+ const n = e;
1887
+ if (n.__frameworkAdapter?.parseDetailElement) {
1888
+ const u = n.__frameworkAdapter.parseDetailElement(t);
1889
+ if (u) {
1890
+ this.config = { ...this.config, detailRenderer: u };
1891
+ return;
1892
+ }
1893
+ }
1894
+ const o = t.getAttribute("animation"), i = t.getAttribute("show-expand-column"), r = t.getAttribute("expand-on-row-click"), l = t.getAttribute("collapse-on-click-outside"), a = t.getAttribute("height"), d = {};
1895
+ o !== null && (d.animation = o === "false" ? !1 : o), i !== null && (d.showExpandColumn = i !== "false"), r !== null && (d.expandOnRowClick = r === "true"), l !== null && (d.collapseOnClickOutside = l === "true"), a !== null && (d.detailHeight = a === "auto" ? "auto" : parseInt(a, 10));
1896
+ const c = t.innerHTML.trim();
1897
+ c && !this.config.detailRenderer && (d.detailRenderer = (u, h) => {
1898
+ const f = Be(c, { value: u, row: u });
1899
+ return ze(f);
1900
+ }), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
1901
+ }
1902
+ // #endregion
1835
1903
  // #region Animation Helpers
1836
1904
  /**
1837
1905
  * Check if animations are enabled at the grid level.
@@ -1910,19 +1978,19 @@ class Sn extends v {
1910
1978
  const { value: l, row: a } = r, d = this.expandedRows.has(a), c = document.createElement("span");
1911
1979
  c.className = "master-detail-cell-wrapper";
1912
1980
  const u = document.createElement("span");
1913
- u.className = `master-detail-toggle${d ? " expanded" : ""}`, this.setIcon(u, this.resolveIcon(d ? "collapse" : "expand")), u.setAttribute("role", "button"), u.setAttribute("tabindex", "0"), u.setAttribute("aria-expanded", String(d)), u.setAttribute("aria-label", d ? "Collapse details" : "Expand details"), u.addEventListener("click", (g) => {
1914
- g.stopPropagation();
1915
- const f = this.rows.indexOf(a);
1916
- this.expandedRows = z(this.expandedRows, a), this.emit("detail-expand", {
1917
- rowIndex: f,
1981
+ u.className = `master-detail-toggle${d ? " expanded" : ""}`, this.setIcon(u, this.resolveIcon(d ? "collapse" : "expand")), u.setAttribute("role", "button"), u.setAttribute("tabindex", "0"), u.setAttribute("aria-expanded", String(d)), u.setAttribute("aria-label", d ? "Collapse details" : "Expand details"), u.addEventListener("click", (f) => {
1982
+ f.stopPropagation();
1983
+ const g = this.rows.indexOf(a);
1984
+ this.expandedRows = $(this.expandedRows, a), this.emit("detail-expand", {
1985
+ rowIndex: g,
1918
1986
  row: a,
1919
1987
  expanded: this.expandedRows.has(a)
1920
1988
  }), this.requestRender();
1921
1989
  }), c.appendChild(u);
1922
1990
  const h = document.createElement("span");
1923
1991
  if (o) {
1924
- const g = o(r);
1925
- g instanceof Node ? h.appendChild(g) : h.textContent = String(g ?? l ?? "");
1992
+ const f = o(r);
1993
+ f instanceof Node ? h.appendChild(f) : h.textContent = String(f ?? l ?? "");
1926
1994
  } else
1927
1995
  h.textContent = String(l ?? "");
1928
1996
  return c.appendChild(h), c;
@@ -1933,7 +2001,7 @@ class Sn extends v {
1933
2001
  }
1934
2002
  onRowClick(e) {
1935
2003
  if (!(!this.config.expandOnRowClick || !this.config.detailRenderer))
1936
- return this.expandedRows = z(this.expandedRows, e.row), this.emit("detail-expand", {
2004
+ return this.expandedRows = $(this.expandedRows, e.row), this.emit("detail-expand", {
1937
2005
  rowIndex: e.rowIndex,
1938
2006
  row: e.row,
1939
2007
  expanded: this.expandedRows.has(e.row)
@@ -1978,7 +2046,7 @@ class Sn extends v {
1978
2046
  d.previousElementSibling !== l && l.after(d);
1979
2047
  continue;
1980
2048
  }
1981
- const c = xt(a, r, this.config.detailRenderer, o);
2049
+ const c = St(a, r, this.config.detailRenderer, o);
1982
2050
  typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`), l.after(c), this.detailElements.set(a, c), this.animateExpand(c);
1983
2051
  }
1984
2052
  }
@@ -2046,7 +2114,7 @@ class Sn extends v {
2046
2114
  */
2047
2115
  expand(e) {
2048
2116
  const t = this.rows[e];
2049
- t && (this.expandedRows = wt(this.expandedRows, t), this.requestRender());
2117
+ t && (this.expandedRows = yt(this.expandedRows, t), this.requestRender());
2050
2118
  }
2051
2119
  /**
2052
2120
  * Collapse the detail row at the given index.
@@ -2054,7 +2122,7 @@ class Sn extends v {
2054
2122
  */
2055
2123
  collapse(e) {
2056
2124
  const t = this.rows[e];
2057
- t && (this.expandedRows = bt(this.expandedRows, t), this.requestRender());
2125
+ t && (this.expandedRows = Ct(this.expandedRows, t), this.requestRender());
2058
2126
  }
2059
2127
  /**
2060
2128
  * Toggle the detail row at the given index.
@@ -2062,7 +2130,7 @@ class Sn extends v {
2062
2130
  */
2063
2131
  toggle(e) {
2064
2132
  const t = this.rows[e];
2065
- t && (this.expandedRows = z(this.expandedRows, t), this.requestRender());
2133
+ t && (this.expandedRows = $(this.expandedRows, t), this.requestRender());
2066
2134
  }
2067
2135
  /**
2068
2136
  * Check if the detail row at the given index is expanded.
@@ -2071,7 +2139,7 @@ class Sn extends v {
2071
2139
  */
2072
2140
  isExpanded(e) {
2073
2141
  const t = this.rows[e];
2074
- return t ? vt(this.expandedRows, t) : !1;
2142
+ return t ? Rt(this.expandedRows, t) : !1;
2075
2143
  }
2076
2144
  /**
2077
2145
  * Expand all detail rows.
@@ -2108,37 +2176,48 @@ class Sn extends v {
2108
2176
  const t = this.rows[e];
2109
2177
  return t ? this.detailElements.get(t) : void 0;
2110
2178
  }
2179
+ /**
2180
+ * Re-parse light DOM to refresh the detail renderer.
2181
+ * Call this after framework templates are registered (e.g., Angular ngAfterContentInit).
2182
+ *
2183
+ * This allows frameworks to register templates asynchronously and then
2184
+ * update the plugin's detailRenderer.
2185
+ */
2186
+ refreshDetailRenderer() {
2187
+ const e = this.config.detailRenderer;
2188
+ this.config = { ...this.config, detailRenderer: void 0 }, this.parseLightDomDetail(), !this.config.detailRenderer && e && (this.config = { ...this.config, detailRenderer: e });
2189
+ }
2111
2190
  // #endregion
2112
2191
  // #region Styles
2113
- styles = yt;
2192
+ styles = kt;
2114
2193
  // #endregion
2115
2194
  }
2116
- function Ct(s, e, t) {
2195
+ function Et(s, e, t) {
2117
2196
  return e.length ? [...s].sort((n, o) => {
2118
2197
  for (const i of e) {
2119
- const l = t.find((u) => u.field === i.field)?.sortComparator ?? Rt, a = n[i.field], d = o[i.field], c = l(a, d, n, o);
2198
+ const l = t.find((u) => u.field === i.field)?.sortComparator ?? At, a = n[i.field], d = o[i.field], c = l(a, d, n, o);
2120
2199
  if (c !== 0)
2121
2200
  return i.direction === "asc" ? c : -c;
2122
2201
  }
2123
2202
  return 0;
2124
2203
  }) : [...s];
2125
2204
  }
2126
- function Rt(s, e) {
2205
+ function At(s, e) {
2127
2206
  return s == null && e == null ? 0 : s == null ? 1 : e == null ? -1 : typeof s == "number" && typeof e == "number" ? s - e : s instanceof Date && e instanceof Date ? s.getTime() - e.getTime() : typeof s == "boolean" && typeof e == "boolean" ? s === e ? 0 : s ? -1 : 1 : String(s).localeCompare(String(e));
2128
2207
  }
2129
- function St(s, e, t, n) {
2208
+ function _t(s, e, t, n) {
2130
2209
  const o = s.find((i) => i.field === e);
2131
2210
  return t ? o ? o.direction === "asc" ? s.map((i) => i.field === e ? { ...i, direction: "desc" } : i) : s.filter((i) => i.field !== e) : s.length < n ? [...s, { field: e, direction: "asc" }] : s : o?.direction === "asc" ? [{ field: e, direction: "desc" }] : o?.direction === "desc" ? [] : [{ field: e, direction: "asc" }];
2132
2211
  }
2133
- function be(s, e) {
2212
+ function xe(s, e) {
2134
2213
  const t = s.findIndex((n) => n.field === e);
2135
2214
  return t >= 0 ? t + 1 : void 0;
2136
2215
  }
2137
- function ve(s, e) {
2216
+ function ye(s, e) {
2138
2217
  return s.find((t) => t.field === e)?.direction;
2139
2218
  }
2140
- const kt = '.header-cell[data-sort=asc]:after{content:"↑";margin-left:4px;opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:4px;opacity:.8}.sort-indicator{margin-left:4px;opacity:.8}.sort-index{font-size:10px;background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:14px;height:14px;display:inline-flex;align-items:center;justify-content:center;margin-left:2px;font-weight:600}';
2141
- class kn extends v {
2219
+ const It = '.header-cell[data-sort=asc]:after{content:"↑";margin-left:4px;opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:4px;opacity:.8}.sort-indicator{margin-left:4px;opacity:.8}.sort-index{font-size:10px;background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:14px;height:14px;display:inline-flex;align-items:center;justify-content:center;margin-left:2px;font-weight:600}';
2220
+ class In extends v {
2142
2221
  name = "multiSort";
2143
2222
  version = "1.0.0";
2144
2223
  get defaultConfig() {
@@ -2157,12 +2236,12 @@ class kn extends v {
2157
2236
  // #endregion
2158
2237
  // #region Hooks
2159
2238
  processRows(e) {
2160
- return this.sortModel.length === 0 ? [...e] : Ct([...e], this.sortModel, [...this.columns]);
2239
+ return this.sortModel.length === 0 ? [...e] : Et([...e], this.sortModel, [...this.columns]);
2161
2240
  }
2162
2241
  onHeaderClick(e) {
2163
2242
  if (!this.columns.find((i) => i.field === e.field)?.sortable) return !1;
2164
2243
  const n = e.originalEvent.shiftKey, o = this.config.maxSortColumns ?? 3;
2165
- return this.sortModel = St(this.sortModel, e.field, n, o), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
2244
+ return this.sortModel = _t(this.sortModel, e.field, n, o), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
2166
2245
  }
2167
2246
  afterRender() {
2168
2247
  const e = this.shadowRoot;
@@ -2171,7 +2250,7 @@ class kn extends v {
2171
2250
  e.querySelectorAll(".header-row .cell[data-field]").forEach((o) => {
2172
2251
  const i = o.getAttribute("data-field");
2173
2252
  if (!i) return;
2174
- const r = be(this.sortModel, i), l = ve(this.sortModel, i);
2253
+ const r = xe(this.sortModel, i), l = ye(this.sortModel, i);
2175
2254
  if (o.querySelector(".sort-index")?.remove(), l) {
2176
2255
  o.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), o.setAttribute("data-sort", l);
2177
2256
  const c = document.createElement("span");
@@ -2211,7 +2290,7 @@ class kn extends v {
2211
2290
  * @returns 1-based index or undefined if not sorted
2212
2291
  */
2213
2292
  getSortIndex(e) {
2214
- return be(this.sortModel, e);
2293
+ return xe(this.sortModel, e);
2215
2294
  }
2216
2295
  /**
2217
2296
  * Get the sort direction for a specific field.
@@ -2219,7 +2298,7 @@ class kn extends v {
2219
2298
  * @returns Sort direction or undefined if not sorted
2220
2299
  */
2221
2300
  getSortDirection(e) {
2222
- return ve(this.sortModel, e);
2301
+ return ye(this.sortModel, e);
2223
2302
  }
2224
2303
  // #endregion
2225
2304
  // #region Column State Hooks
@@ -2252,19 +2331,19 @@ class kn extends v {
2252
2331
  }
2253
2332
  // #endregion
2254
2333
  // #region Styles
2255
- styles = kt;
2334
+ styles = It;
2256
2335
  // #endregion
2257
2336
  }
2258
- function Et(s) {
2337
+ function Tt(s) {
2259
2338
  return s.filter((e) => e.sticky === "left");
2260
2339
  }
2261
- function At(s) {
2340
+ function Lt(s) {
2262
2341
  return s.filter((e) => e.sticky === "right");
2263
2342
  }
2264
- function W(s) {
2343
+ function j(s) {
2265
2344
  return s.some((e) => e.sticky === "left" || e.sticky === "right");
2266
2345
  }
2267
- function xe(s, e) {
2346
+ function Ce(s, e) {
2268
2347
  const t = s.shadowRoot;
2269
2348
  if (!t) return;
2270
2349
  const n = Array.from(t.querySelectorAll(".header-row .cell"));
@@ -2290,14 +2369,14 @@ function xe(s, e) {
2290
2369
  }), r += d.offsetWidth);
2291
2370
  }
2292
2371
  }
2293
- function ye(s) {
2372
+ function Re(s) {
2294
2373
  const e = s.shadowRoot;
2295
2374
  if (!e) return;
2296
2375
  e.querySelectorAll(".sticky-left, .sticky-right").forEach((n) => {
2297
2376
  n.classList.remove("sticky-left", "sticky-right"), n.style.position = "", n.style.left = "", n.style.right = "";
2298
2377
  });
2299
2378
  }
2300
- class En extends v {
2379
+ class Tn extends v {
2301
2380
  name = "pinnedColumns";
2302
2381
  version = "1.0.0";
2303
2382
  get defaultConfig() {
@@ -2319,23 +2398,23 @@ class En extends v {
2319
2398
  */
2320
2399
  static detect(e, t) {
2321
2400
  const n = t?.columns;
2322
- return Array.isArray(n) ? W(n) : !1;
2401
+ return Array.isArray(n) ? j(n) : !1;
2323
2402
  }
2324
2403
  // #endregion
2325
2404
  // #region Hooks
2326
2405
  processColumns(e) {
2327
- return this.isApplied = W([...e]), [...e];
2406
+ return this.isApplied = j([...e]), [...e];
2328
2407
  }
2329
2408
  afterRender() {
2330
2409
  if (!this.isApplied)
2331
2410
  return;
2332
2411
  const e = this.grid, t = [...this.columns];
2333
- if (!W(t)) {
2334
- ye(e), this.isApplied = !1;
2412
+ if (!j(t)) {
2413
+ Re(e), this.isApplied = !1;
2335
2414
  return;
2336
2415
  }
2337
2416
  queueMicrotask(() => {
2338
- xe(e, t);
2417
+ Ce(e, t);
2339
2418
  });
2340
2419
  }
2341
2420
  /**
@@ -2361,27 +2440,27 @@ class En extends v {
2361
2440
  */
2362
2441
  refreshStickyOffsets() {
2363
2442
  const e = [...this.columns];
2364
- xe(this.grid, e);
2443
+ Ce(this.grid, e);
2365
2444
  }
2366
2445
  /**
2367
2446
  * Get columns pinned to the left.
2368
2447
  */
2369
2448
  getLeftPinnedColumns() {
2370
2449
  const e = [...this.columns];
2371
- return Et(e);
2450
+ return Tt(e);
2372
2451
  }
2373
2452
  /**
2374
2453
  * Get columns pinned to the right.
2375
2454
  */
2376
2455
  getRightPinnedColumns() {
2377
2456
  const e = [...this.columns];
2378
- return At(e);
2457
+ return Lt(e);
2379
2458
  }
2380
2459
  /**
2381
2460
  * Clear all sticky positioning.
2382
2461
  */
2383
2462
  clearStickyPositions() {
2384
- ye(this.grid);
2463
+ Re(this.grid);
2385
2464
  }
2386
2465
  /**
2387
2466
  * Report horizontal scroll boundary offsets for pinned columns.
@@ -2409,10 +2488,10 @@ class En extends v {
2409
2488
  }
2410
2489
  // #endregion
2411
2490
  }
2412
- function _t(s) {
2491
+ function Ft(s) {
2413
2492
  return typeof s == "object" && s !== null && "aggFunc" in s;
2414
2493
  }
2415
- function $(s, e) {
2494
+ function U(s, e) {
2416
2495
  const t = document.createElement("div");
2417
2496
  t.className = "tbw-pinned-rows", t.setAttribute("role", "presentation"), t.setAttribute("aria-live", "polite");
2418
2497
  const n = document.createElement("div");
@@ -2434,7 +2513,7 @@ function $(s, e) {
2434
2513
  }
2435
2514
  if (s.customPanels)
2436
2515
  for (const r of s.customPanels) {
2437
- const l = It(r, e);
2516
+ const l = Mt(r, e);
2438
2517
  switch (r.position) {
2439
2518
  case "left":
2440
2519
  n.appendChild(l);
@@ -2449,11 +2528,11 @@ function $(s, e) {
2449
2528
  }
2450
2529
  return t.appendChild(n), t.appendChild(o), t.appendChild(i), t;
2451
2530
  }
2452
- function Ce(s) {
2531
+ function Se(s) {
2453
2532
  const e = document.createElement("div");
2454
2533
  return e.className = `tbw-aggregation-rows tbw-aggregation-rows-${s}`, e.setAttribute("role", "presentation"), e;
2455
2534
  }
2456
- function Re(s, e, t, n) {
2535
+ function ke(s, e, t, n) {
2457
2536
  s.innerHTML = "";
2458
2537
  for (const o of e) {
2459
2538
  const i = document.createElement("div");
@@ -2467,11 +2546,11 @@ function Re(s, e, t, n) {
2467
2546
  let a, d;
2468
2547
  const c = o.aggregators?.[r.field];
2469
2548
  if (c)
2470
- if (_t(c)) {
2471
- const u = le(c.aggFunc);
2549
+ if (Ft(c)) {
2550
+ const u = de(c.aggFunc);
2472
2551
  u && (a = u(n, r.field, r)), d = c.formatter;
2473
2552
  } else {
2474
- const u = le(c);
2553
+ const u = de(c);
2475
2554
  u && (a = u(n, r.field, r));
2476
2555
  }
2477
2556
  else if (o.cells && Object.prototype.hasOwnProperty.call(o.cells, r.field)) {
@@ -2483,13 +2562,13 @@ function Re(s, e, t, n) {
2483
2562
  s.appendChild(i);
2484
2563
  }
2485
2564
  }
2486
- function It(s, e) {
2565
+ function Mt(s, e) {
2487
2566
  const t = document.createElement("div");
2488
2567
  t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${s.id}`;
2489
2568
  const n = s.render(e);
2490
2569
  return typeof n == "string" ? t.innerHTML = n : t.appendChild(n), t;
2491
2570
  }
2492
- function Se(s, e, t, n, o) {
2571
+ function Ee(s, e, t, n, o) {
2493
2572
  return {
2494
2573
  totalRows: s.length,
2495
2574
  filteredRows: o?.cachedResult?.length ?? s.length,
@@ -2499,8 +2578,8 @@ function Se(s, e, t, n, o) {
2499
2578
  grid: t
2500
2579
  };
2501
2580
  }
2502
- const Lt = ".tbw-footer{position:sticky;bottom:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-color-panel-bg)}.tbw-pinned-rows{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;background:var(--tbw-pinned-rows-bg, var(--tbw-color-panel-bg));border-top:1px solid var(--tbw-pinned-rows-border, var(--tbw-color-border));font-size:12px;color:var(--tbw-pinned-rows-color, var(--tbw-color-fg-muted));min-height:32px;box-sizing:border-box;min-width:fit-content}.tbw-pinned-rows-left,.tbw-pinned-rows-center,.tbw-pinned-rows-right{display:flex;align-items:center;gap:16px}.tbw-pinned-rows-left{justify-content:flex-start}.tbw-pinned-rows-center{justify-content:center;flex:1}.tbw-pinned-rows-right{justify-content:flex-end}.tbw-status-panel{white-space:nowrap}.tbw-aggregation-rows{min-width:fit-content;background:var(--tbw-aggregation-bg, var(--tbw-color-header-bg))}.tbw-aggregation-rows-top{border-bottom:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-rows-bottom{border-top:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-row{display:grid;grid-template-columns:var(--tbw-column-template);font-size:var(--tbw-aggregation-font-size, .8em);font-weight:var(--tbw-aggregation-font-weight, 600)}.tbw-aggregation-cell{padding:var(--tbw-cell-padding, 2px 8px);min-height:var(--tbw-row-height, 28px);display:flex;align-items:center;border-right:1px solid var(--tbw-color-border-cell)}.tbw-aggregation-cell:last-child{border-right:0}.tbw-aggregation-cell-full{grid-column:1 / -1;border-right:0}";
2503
- class An extends v {
2581
+ const Pt = ".tbw-footer{flex-shrink:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-color-panel-bg)}.tbw-pinned-rows{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;background:var(--tbw-pinned-rows-bg, var(--tbw-color-panel-bg));border-top:1px solid var(--tbw-pinned-rows-border, var(--tbw-color-border));font-size:12px;color:var(--tbw-pinned-rows-color, var(--tbw-color-fg-muted));min-height:32px;box-sizing:border-box;min-width:fit-content}.tbw-pinned-rows-left,.tbw-pinned-rows-center,.tbw-pinned-rows-right{display:flex;align-items:center;gap:16px}.tbw-pinned-rows-left{justify-content:flex-start}.tbw-pinned-rows-center{justify-content:center;flex:1}.tbw-pinned-rows-right{justify-content:flex-end}.tbw-status-panel{white-space:nowrap}.tbw-aggregation-rows{min-width:fit-content;background:var(--tbw-aggregation-bg, var(--tbw-color-header-bg))}.tbw-aggregation-rows-top{border-bottom:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-rows-bottom{border-top:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-row{display:grid;grid-template-columns:var(--tbw-column-template);font-size:var(--tbw-aggregation-font-size, .8em);font-weight:var(--tbw-aggregation-font-weight, 600)}.tbw-aggregation-cell{padding:var(--tbw-cell-padding, 2px 8px);min-height:var(--tbw-row-height, 28px);display:flex;align-items:center;border-right:1px solid var(--tbw-color-border-cell)}.tbw-aggregation-cell:last-child{border-right:0}.tbw-aggregation-cell-full{grid-column:1 / -1;border-right:0}";
2582
+ class Ln extends v {
2504
2583
  name = "pinnedRows";
2505
2584
  version = "1.0.0";
2506
2585
  get defaultConfig() {
@@ -2528,7 +2607,7 @@ class An extends v {
2528
2607
  if (!e) return;
2529
2608
  const t = e.querySelector(".tbw-scroll-area") ?? e.querySelector(".tbw-grid-content") ?? e.children[0];
2530
2609
  if (!t) return;
2531
- const n = this.getSelectionState(), o = this.getFilterState(), i = Se(
2610
+ const n = this.getSelectionState(), o = this.getFilterState(), i = Ee(
2532
2611
  this.rows,
2533
2612
  this.columns,
2534
2613
  this.grid,
@@ -2537,11 +2616,11 @@ class An extends v {
2537
2616
  ), r = this.config.aggregationRows || [], l = r.filter((h) => h.position === "top"), a = r.filter((h) => h.position !== "top");
2538
2617
  if (l.length > 0) {
2539
2618
  if (!this.topAggregationContainer) {
2540
- this.topAggregationContainer = Ce("top");
2619
+ this.topAggregationContainer = Se("top");
2541
2620
  const h = e.querySelector(".header");
2542
2621
  h && h.nextSibling ? t.insertBefore(this.topAggregationContainer, h.nextSibling) : t.appendChild(this.topAggregationContainer);
2543
2622
  }
2544
- Re(
2623
+ ke(
2545
2624
  this.topAggregationContainer,
2546
2625
  l,
2547
2626
  this.visibleColumns,
@@ -2551,18 +2630,18 @@ class An extends v {
2551
2630
  const d = this.config.showRowCount !== !1 || this.config.showSelectedCount && i.selectedRows > 0 || this.config.showFilteredCount && i.filteredRows !== i.totalRows || this.config.customPanels && this.config.customPanels.length > 0, c = d && this.config.position !== "top", u = a.length > 0 || c;
2552
2631
  if (d && this.config.position === "top")
2553
2632
  if (!this.infoBarElement)
2554
- this.infoBarElement = $(this.config, i), t.insertBefore(this.infoBarElement, t.firstChild);
2633
+ this.infoBarElement = U(this.config, i), t.insertBefore(this.infoBarElement, t.firstChild);
2555
2634
  else {
2556
- const h = $(this.config, i);
2635
+ const h = U(this.config, i);
2557
2636
  this.infoBarElement.replaceWith(h), this.infoBarElement = h;
2558
2637
  }
2559
2638
  else this.config.position === "top" && this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null);
2560
- u ? (this.footerWrapper || (this.footerWrapper = document.createElement("div"), this.footerWrapper.className = "tbw-footer", t.appendChild(this.footerWrapper)), this.footerWrapper.innerHTML = "", a.length > 0 && (this.bottomAggregationContainer || (this.bottomAggregationContainer = Ce("bottom")), this.footerWrapper.appendChild(this.bottomAggregationContainer), Re(
2639
+ u ? (this.footerWrapper || (this.footerWrapper = document.createElement("div"), this.footerWrapper.className = "tbw-footer", t.appendChild(this.footerWrapper)), this.footerWrapper.innerHTML = "", a.length > 0 && (this.bottomAggregationContainer || (this.bottomAggregationContainer = Se("bottom")), this.footerWrapper.appendChild(this.bottomAggregationContainer), ke(
2561
2640
  this.bottomAggregationContainer,
2562
2641
  a,
2563
2642
  this.visibleColumns,
2564
2643
  this.rows
2565
- )), c && (this.infoBarElement = $(this.config, i), this.footerWrapper.appendChild(this.infoBarElement))) : this.cleanupFooter();
2644
+ )), c && (this.infoBarElement = U(this.config, i), this.footerWrapper.appendChild(this.infoBarElement))) : this.cleanupFooter();
2566
2645
  }
2567
2646
  // #endregion
2568
2647
  // #region Private Methods
@@ -2600,7 +2679,7 @@ class An extends v {
2600
2679
  */
2601
2680
  getContext() {
2602
2681
  const e = this.getSelectionState(), t = this.getFilterState();
2603
- return Se(
2682
+ return Ee(
2604
2683
  this.rows,
2605
2684
  this.columns,
2606
2685
  this.grid,
@@ -2638,19 +2717,19 @@ class An extends v {
2638
2717
  }
2639
2718
  // #endregion
2640
2719
  // #region Styles
2641
- styles = Lt;
2720
+ styles = Pt;
2642
2721
  // #endregion
2643
2722
  }
2644
- const Tt = Oe;
2645
- function Ft(s) {
2723
+ const Kt = We;
2724
+ function Nt(s) {
2646
2725
  const e = [];
2647
2726
  return !s.rowGroupFields?.length && !s.columnGroupFields?.length && e.push("At least one row or column group field is required"), s.valueFields?.length || e.push("At least one value field is required"), e;
2648
2727
  }
2649
- function ne(s, e) {
2728
+ function ie(s, e) {
2650
2729
  return [...s, e].join("|");
2651
2730
  }
2652
- function Pt(s, e) {
2653
- const t = e.rowGroupFields ?? [], n = e.columnGroupFields ?? [], o = e.valueFields ?? [], i = Mt(s, n), r = qe(
2731
+ function qt(s, e) {
2732
+ const t = e.rowGroupFields ?? [], n = e.columnGroupFields ?? [], o = e.valueFields ?? [], i = Dt(s, n), r = He(
2654
2733
  s,
2655
2734
  t,
2656
2735
  n,
@@ -2660,7 +2739,7 @@ function Pt(s, e) {
2660
2739
  // starting depth
2661
2740
  ""
2662
2741
  // parent key prefix
2663
- ), l = Nt(r, i, o), a = Object.values(l).reduce((d, c) => d + c, 0);
2742
+ ), l = Vt(r, i, o), a = Object.values(l).reduce((d, c) => d + c, 0);
2664
2743
  return {
2665
2744
  rows: r,
2666
2745
  columnKeys: i,
@@ -2668,7 +2747,7 @@ function Pt(s, e) {
2668
2747
  grandTotal: a
2669
2748
  };
2670
2749
  }
2671
- function Mt(s, e) {
2750
+ function Dt(s, e) {
2672
2751
  if (e.length === 0) return ["value"];
2673
2752
  const t = /* @__PURE__ */ new Set();
2674
2753
  for (const n of s) {
@@ -2677,7 +2756,7 @@ function Mt(s, e) {
2677
2756
  }
2678
2757
  return [...t].sort();
2679
2758
  }
2680
- function Kt(s, e) {
2759
+ function Ht(s, e) {
2681
2760
  const t = /* @__PURE__ */ new Map();
2682
2761
  for (const n of s) {
2683
2762
  const o = String(n[e] ?? ""), i = t.get(o);
@@ -2685,75 +2764,75 @@ function Kt(s, e) {
2685
2764
  }
2686
2765
  return t;
2687
2766
  }
2688
- function qe(s, e, t, n, o, i, r) {
2767
+ function He(s, e, t, n, o, i, r) {
2689
2768
  const l = [];
2690
2769
  if (e.length === 0) {
2691
- const h = ke(s, t, n, o), g = Ee(h);
2770
+ const h = Ae(s, t, n, o), f = _e(h);
2692
2771
  return l.push({
2693
2772
  rowKey: r || "all",
2694
2773
  rowLabel: r || "All",
2695
2774
  depth: i,
2696
2775
  values: h,
2697
- total: g,
2776
+ total: f,
2698
2777
  isGroup: !1,
2699
2778
  rowCount: s.length
2700
2779
  }), l;
2701
2780
  }
2702
- const a = e[0], d = e.slice(1), c = d.length > 0, u = Kt(s, a);
2703
- for (const [h, g] of u) {
2704
- const f = r ? `${r}|${h}` : h, m = ke(g, t, n, o), p = Ee(m);
2781
+ const a = e[0], d = e.slice(1), c = d.length > 0, u = Ht(s, a);
2782
+ for (const [h, f] of u) {
2783
+ const g = r ? `${r}|${h}` : h, m = Ae(f, t, n, o), p = _e(m);
2705
2784
  let R;
2706
- c && (R = qe(
2707
- g,
2785
+ c && (R = He(
2786
+ f,
2708
2787
  d,
2709
2788
  t,
2710
2789
  n,
2711
2790
  o,
2712
2791
  i + 1,
2713
- f
2792
+ g
2714
2793
  )), l.push({
2715
- rowKey: f,
2794
+ rowKey: g,
2716
2795
  rowLabel: h || "(blank)",
2717
2796
  depth: i,
2718
2797
  values: m,
2719
2798
  total: p,
2720
2799
  isGroup: c,
2721
2800
  children: R,
2722
- rowCount: g.length
2801
+ rowCount: f.length
2723
2802
  });
2724
2803
  }
2725
2804
  return l;
2726
2805
  }
2727
- function ke(s, e, t, n) {
2806
+ function Ae(s, e, t, n) {
2728
2807
  const o = {};
2729
2808
  for (const i of t)
2730
2809
  for (const r of n) {
2731
- const a = (e.length > 0 ? s.filter((h) => e.map((g) => String(h[g] ?? "")).join("|") === i) : s).map((h) => Number(h[r.field]) || 0), d = Tt(r.aggFunc), c = a.length > 0 ? d(a) : null, u = ne([i], r.field);
2810
+ const a = (e.length > 0 ? s.filter((h) => e.map((f) => String(h[f] ?? "")).join("|") === i) : s).map((h) => Number(h[r.field]) || 0), d = Kt(r.aggFunc), c = a.length > 0 ? d(a) : null, u = ie([i], r.field);
2732
2811
  o[u] = c;
2733
2812
  }
2734
2813
  return o;
2735
2814
  }
2736
- function Ee(s) {
2815
+ function _e(s) {
2737
2816
  let e = 0;
2738
2817
  for (const t of Object.values(s))
2739
2818
  e += t ?? 0;
2740
2819
  return e;
2741
2820
  }
2742
- function Nt(s, e, t) {
2821
+ function Vt(s, e, t) {
2743
2822
  const n = {};
2744
2823
  function o(i) {
2745
2824
  for (const r of i)
2746
2825
  if (!r.isGroup || !r.children?.length)
2747
2826
  for (const l of e)
2748
2827
  for (const a of t) {
2749
- const d = ne([l], a.field);
2828
+ const d = ie([l], a.field);
2750
2829
  n[d] = (n[d] ?? 0) + (r.values[d] ?? 0);
2751
2830
  }
2752
2831
  else r.children && o(r.children);
2753
2832
  }
2754
2833
  return o(s), n;
2755
2834
  }
2756
- function qt(s, e, t = !0) {
2835
+ function Ot(s, e, t = !0) {
2757
2836
  const n = [];
2758
2837
  function o(i) {
2759
2838
  n.push(i);
@@ -2766,7 +2845,7 @@ function qt(s, e, t = !0) {
2766
2845
  o(i);
2767
2846
  return n;
2768
2847
  }
2769
- function j(s) {
2848
+ function Y(s) {
2770
2849
  const e = [];
2771
2850
  function t(n) {
2772
2851
  if (n.isGroup && e.push(n.rowKey), n.children)
@@ -2777,14 +2856,14 @@ function j(s) {
2777
2856
  t(n);
2778
2857
  return e;
2779
2858
  }
2780
- const Dt = ["sum", "avg", "count", "min", "max", "first", "last"];
2781
- function Ht(s, e, t, n) {
2859
+ const Gt = ["sum", "avg", "count", "min", "max", "first", "last"];
2860
+ function Bt(s, e, t, n) {
2782
2861
  const o = new AbortController(), i = { config: e, callbacks: n, signal: o.signal }, r = document.createElement("div");
2783
- return r.className = "tbw-pivot-panel", r.appendChild(L("Options", () => zt(t, i))), r.appendChild(L("Row Groups", () => Ae("rowGroups", i))), r.appendChild(L("Column Groups", () => Ae("columnGroups", i))), r.appendChild(L("Values", () => Ot(i))), r.appendChild(L("Available Fields", () => Bt(i))), s.appendChild(r), () => {
2862
+ return r.className = "tbw-pivot-panel", r.appendChild(T("Options", () => Ut(t, i))), r.appendChild(T("Row Groups", () => Ie("rowGroups", i))), r.appendChild(T("Column Groups", () => Ie("columnGroups", i))), r.appendChild(T("Values", () => Wt(i))), r.appendChild(T("Available Fields", () => jt(i))), s.appendChild(r), () => {
2784
2863
  o.abort(), r.remove();
2785
2864
  };
2786
2865
  }
2787
- function L(s, e) {
2866
+ function T(s, e) {
2788
2867
  const t = document.createElement("div");
2789
2868
  t.className = "tbw-pivot-section";
2790
2869
  const n = document.createElement("div");
@@ -2792,7 +2871,7 @@ function L(s, e) {
2792
2871
  const o = document.createElement("div");
2793
2872
  return o.className = "tbw-pivot-section-content", o.appendChild(e()), t.appendChild(n), t.appendChild(o), t;
2794
2873
  }
2795
- function Ae(s, e) {
2874
+ function Ie(s, e) {
2796
2875
  const { config: t, callbacks: n, signal: o } = e, i = document.createElement("div");
2797
2876
  i.className = "tbw-pivot-drop-zone", i.setAttribute("data-zone", s);
2798
2877
  const r = s === "rowGroups" ? t.rowGroupFields ?? [] : t.columnGroupFields ?? [];
@@ -2801,7 +2880,7 @@ function Ae(s, e) {
2801
2880
  l.className = "tbw-pivot-placeholder", l.textContent = "Drag fields here or click to add", i.appendChild(l);
2802
2881
  } else
2803
2882
  for (const l of r)
2804
- i.appendChild(Vt(l, s, e));
2883
+ i.appendChild(zt(l, s, e));
2805
2884
  return i.addEventListener(
2806
2885
  "dragover",
2807
2886
  (l) => {
@@ -2824,7 +2903,7 @@ function Ae(s, e) {
2824
2903
  { signal: o }
2825
2904
  ), i;
2826
2905
  }
2827
- function Vt(s, e, t) {
2906
+ function zt(s, e, t) {
2828
2907
  const { callbacks: n, signal: o } = t, i = document.createElement("div");
2829
2908
  i.className = "tbw-pivot-field-chip", i.draggable = !0;
2830
2909
  const r = n.getAvailableFields().find((d) => d.field === s), l = document.createElement("span");
@@ -2850,7 +2929,7 @@ function Vt(s, e, t) {
2850
2929
  { signal: o }
2851
2930
  ), i;
2852
2931
  }
2853
- function Ot(s) {
2932
+ function Wt(s) {
2854
2933
  const { config: e, callbacks: t, signal: n } = s, o = document.createElement("div");
2855
2934
  o.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", o.setAttribute("data-zone", "values");
2856
2935
  const i = e.valueFields ?? [];
@@ -2859,7 +2938,7 @@ function Ot(s) {
2859
2938
  r.className = "tbw-pivot-placeholder", r.textContent = "Drag numeric fields here for aggregation", o.appendChild(r);
2860
2939
  } else
2861
2940
  for (const r of i)
2862
- o.appendChild(Gt(r, s));
2941
+ o.appendChild($t(r, s));
2863
2942
  return o.addEventListener(
2864
2943
  "dragover",
2865
2944
  (r) => {
@@ -2882,7 +2961,7 @@ function Ot(s) {
2882
2961
  { signal: n }
2883
2962
  ), o;
2884
2963
  }
2885
- function Gt(s, e) {
2964
+ function $t(s, e) {
2886
2965
  const { callbacks: t, signal: n } = e, o = document.createElement("div");
2887
2966
  o.className = "tbw-pivot-field-chip tbw-pivot-value-chip";
2888
2967
  const i = t.getAvailableFields().find((c) => c.field === s.field), r = document.createElement("div");
@@ -2891,7 +2970,7 @@ function Gt(s, e) {
2891
2970
  l.className = "tbw-pivot-chip-label", l.textContent = i?.header ?? s.field;
2892
2971
  const a = document.createElement("select");
2893
2972
  a.className = "tbw-pivot-agg-select", a.title = "Aggregation function";
2894
- for (const c of Dt) {
2973
+ for (const c of Gt) {
2895
2974
  const u = document.createElement("option");
2896
2975
  u.value = c, u.textContent = c.toUpperCase(), u.selected = c === s.aggFunc, a.appendChild(u);
2897
2976
  }
@@ -2911,7 +2990,7 @@ function Gt(s, e) {
2911
2990
  { signal: n }
2912
2991
  ), r.appendChild(l), r.appendChild(a), o.appendChild(r), o.appendChild(d), o;
2913
2992
  }
2914
- function Bt(s) {
2993
+ function jt(s) {
2915
2994
  const { config: e, callbacks: t, signal: n } = s, o = document.createElement("div");
2916
2995
  o.className = "tbw-pivot-available-fields";
2917
2996
  const i = t.getAvailableFields(), r = /* @__PURE__ */ new Set([
@@ -2941,10 +3020,10 @@ function Bt(s) {
2941
3020
  }
2942
3021
  return o;
2943
3022
  }
2944
- function zt(s, e) {
3023
+ function Ut(s, e) {
2945
3024
  const { config: t, callbacks: n, signal: o } = e, i = document.createElement("div");
2946
3025
  return i.className = "tbw-pivot-options", i.appendChild(
2947
- U(
3026
+ Z(
2948
3027
  "Enable Pivot View",
2949
3028
  s,
2950
3029
  (r) => {
@@ -2953,7 +3032,7 @@ function zt(s, e) {
2953
3032
  o
2954
3033
  )
2955
3034
  ), i.appendChild(
2956
- U(
3035
+ Z(
2957
3036
  "Show Row Totals",
2958
3037
  t.showTotals ?? !0,
2959
3038
  (r) => {
@@ -2962,7 +3041,7 @@ function zt(s, e) {
2962
3041
  o
2963
3042
  )
2964
3043
  ), i.appendChild(
2965
- U(
3044
+ Z(
2966
3045
  "Show Grand Total",
2967
3046
  t.showGrandTotal ?? !0,
2968
3047
  (r) => {
@@ -2972,7 +3051,7 @@ function zt(s, e) {
2972
3051
  )
2973
3052
  ), i;
2974
3053
  }
2975
- function U(s, e, t, n) {
3054
+ function Z(s, e, t, n) {
2976
3055
  const o = document.createElement("label");
2977
3056
  o.className = "tbw-pivot-checkbox";
2978
3057
  const i = document.createElement("input");
@@ -2980,7 +3059,7 @@ function U(s, e, t, n) {
2980
3059
  const r = document.createElement("span");
2981
3060
  return r.textContent = s, o.appendChild(i), o.appendChild(r), o;
2982
3061
  }
2983
- function Wt(s, e, t) {
3062
+ function Yt(s, e, t) {
2984
3063
  return e.className = "pivot-group-row", e.setAttribute("data-pivot-depth", String(s.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(s.__pivotRowKey ?? "")), e.setAttribute("role", "row"), e.innerHTML = "", t.columns.forEach((n, o) => {
2985
3064
  const i = document.createElement("div");
2986
3065
  if (i.className = "cell", i.setAttribute("data-col", String(o)), i.setAttribute("role", "gridcell"), o === 0) {
@@ -3001,7 +3080,7 @@ function Wt(s, e, t) {
3001
3080
  e.appendChild(i);
3002
3081
  }), !0;
3003
3082
  }
3004
- function $t(s, e, t) {
3083
+ function Zt(s, e, t) {
3005
3084
  return e.className = "pivot-leaf-row", e.setAttribute("data-pivot-depth", String(s.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(s.__pivotRowKey ?? "")), e.innerHTML = "", t.forEach((n, o) => {
3006
3085
  const i = document.createElement("div");
3007
3086
  if (i.className = "cell", i.setAttribute("data-col", String(o)), i.setAttribute("role", "gridcell"), o === 0) {
@@ -3016,7 +3095,7 @@ function $t(s, e, t) {
3016
3095
  e.appendChild(i);
3017
3096
  }), !0;
3018
3097
  }
3019
- function jt(s, e, t) {
3098
+ function Xt(s, e, t) {
3020
3099
  return e.className = "pivot-grand-total-row", e.setAttribute("role", "presentation"), e.innerHTML = "", t.forEach((n, o) => {
3021
3100
  const i = document.createElement("div");
3022
3101
  if (i.className = "cell", i.setAttribute("data-col", String(o)), o === 0) {
@@ -3029,8 +3108,8 @@ function jt(s, e, t) {
3029
3108
  e.appendChild(i);
3030
3109
  }), !0;
3031
3110
  }
3032
- const Ut = '.pivot-group-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:600;background:var(--tbw-pivot-group-bg, var(--tbw-color-row-alt));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-group-row:hover{background:var(--tbw-pivot-group-hover, var(--tbw-color-row-hover))}.pivot-leaf-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-pivot-leaf-bg, var(--tbw-color-bg));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-grand-total-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:700;background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-height:var(--tbw-row-height);border-top:2px solid var(--tbw-color-border-strong)}.pivot-grand-total-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-grand-total-row>.cell:last-child{border-right:0}.pivot-grand-total-footer{position:sticky;bottom:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-width:fit-content}.pivot-group-row>.cell,.pivot-leaf-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-group-row>.cell:last-child,.pivot-leaf-row>.cell:last-child{border-right:0}.pivot-toggle{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;margin-right:6px;border:none;background:transparent;cursor:pointer;color:var(--tbw-pivot-toggle-color, var(--tbw-color-fg-muted));border-radius:var(--tbw-border-radius);transition:background .15s,color .15s}.pivot-toggle:hover{background:var(--tbw-pivot-toggle-hover-bg, var(--tbw-color-row-hover));color:var(--tbw-pivot-toggle-hover-color, var(--tbw-color-fg))}.pivot-toggle:focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}.pivot-label{font-weight:inherit}.pivot-count{color:var(--tbw-pivot-count-color, var(--tbw-color-fg-muted));font-size:.9em;font-weight:400}.pivot-total-row{font-weight:700;border-top:2px solid var(--tbw-pivot-border, var(--tbw-color-border-strong))}[data-pivot-depth="1"]{--tbw-pivot-depth: 1}[data-pivot-depth="2"]{--tbw-pivot-depth: 2}[data-pivot-depth="3"]{--tbw-pivot-depth: 3}[data-pivot-depth="4"]{--tbw-pivot-depth: 4}.tbw-pivot-panel{display:flex;flex-direction:column;gap:12px;padding:12px;height:100%;overflow-y:auto;font-size:13px}.tbw-pivot-section{border:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-section-bg, var(--tbw-color-bg))}.tbw-pivot-section-header{padding:8px 12px;font-weight:600;background:var(--tbw-pivot-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius) var(--tbw-border-radius) 0 0}.tbw-pivot-section-content{padding:8px}.tbw-pivot-toggle-wrapper{display:flex;align-items:center}.tbw-pivot-toggle-label{display:flex;align-items:center;gap:8px;cursor:pointer}.tbw-pivot-toggle-label input{width:16px;height:16px;cursor:pointer}.tbw-pivot-drop-zone{min-height:60px;padding:8px;border:2px dashed var(--tbw-pivot-drop-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-drop-bg, var(--tbw-color-row-alt));display:flex;flex-wrap:wrap;gap:6px;align-content:flex-start;transition:all .15s ease}.tbw-pivot-drop-zone.drag-over{border-color:var(--tbw-color-accent);background:var(--tbw-pivot-drop-active, var(--tbw-focus-background))}.tbw-pivot-placeholder{color:var(--tbw-color-fg-muted);font-style:italic;padding:8px;text-align:center;width:100%}.tbw-pivot-field-chip{display:inline-flex;align-items:center;gap:6px;padding:4px 8px;background:var(--tbw-pivot-chip-bg, var(--tbw-color-header-bg));border:1px solid var(--tbw-pivot-chip-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);cursor:grab;font-size:12px;transition:all .15s ease}.tbw-pivot-field-chip:hover{background:var(--tbw-pivot-chip-hover, var(--tbw-color-row-hover));border-color:var(--tbw-color-accent)}.tbw-pivot-field-chip.available{background:var(--tbw-color-bg)}.tbw-pivot-field-chip.dragging{opacity:.5;cursor:grabbing}.tbw-pivot-chip-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:120px}.tbw-pivot-chip-remove{display:flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:none;background:transparent;color:var(--tbw-color-fg-muted);font-size:14px;font-weight:700;cursor:pointer;border-radius:50%;transition:all .15s ease}.tbw-pivot-chip-remove:hover{background:var(--tbw-pivot-chip-remove-hover-bg, var(--tbw-color-accent));color:var(--tbw-pivot-chip-remove-hover-fg, var(--tbw-color-accent-fg))}.tbw-pivot-value-chip{padding:4px 8px}.tbw-pivot-value-label-wrapper{display:flex;align-items:center;gap:8px;flex:1;min-width:0}.tbw-pivot-agg-select{padding:2px 4px;font-size:11px;border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);cursor:pointer}.tbw-pivot-available-fields{display:flex;flex-wrap:wrap;gap:6px;min-height:40px}.tbw-pivot-options{display:flex;flex-direction:column;gap:8px}.tbw-pivot-checkbox{display:flex;align-items:center;gap:8px;cursor:pointer}.tbw-pivot-checkbox input{width:14px;height:14px;cursor:pointer}.pivot-group-row.tbw-pivot-slide-in,.pivot-leaf-row.tbw-pivot-slide-in{animation:tbw-pivot-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.pivot-group-row.tbw-pivot-fade-in,.pivot-leaf-row.tbw-pivot-fade-in{animation:tbw-pivot-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-fade-in{0%{opacity:0}to{opacity:1}}';
3033
- class T extends v {
3111
+ const Jt = '.pivot-group-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:600;background:var(--tbw-pivot-group-bg, var(--tbw-color-row-alt));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-group-row:hover{background:var(--tbw-pivot-group-hover, var(--tbw-color-row-hover))}.pivot-leaf-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-pivot-leaf-bg, var(--tbw-color-bg));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-grand-total-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:700;background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-height:var(--tbw-row-height);border-top:2px solid var(--tbw-color-border-strong)}.pivot-grand-total-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-grand-total-row>.cell:last-child{border-right:0}.pivot-grand-total-footer{position:sticky;bottom:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-width:fit-content}.pivot-group-row>.cell,.pivot-leaf-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-group-row>.cell:last-child,.pivot-leaf-row>.cell:last-child{border-right:0}.pivot-toggle{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;margin-right:6px;border:none;background:transparent;cursor:pointer;color:var(--tbw-pivot-toggle-color, var(--tbw-color-fg-muted));border-radius:var(--tbw-border-radius);transition:background .15s,color .15s}.pivot-toggle:hover{background:var(--tbw-pivot-toggle-hover-bg, var(--tbw-color-row-hover));color:var(--tbw-pivot-toggle-hover-color, var(--tbw-color-fg))}.pivot-toggle:focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}.pivot-label{font-weight:inherit}.pivot-count{color:var(--tbw-pivot-count-color, var(--tbw-color-fg-muted));font-size:.9em;font-weight:400}.pivot-total-row{font-weight:700;border-top:2px solid var(--tbw-pivot-border, var(--tbw-color-border-strong))}[data-pivot-depth="1"]{--tbw-pivot-depth: 1}[data-pivot-depth="2"]{--tbw-pivot-depth: 2}[data-pivot-depth="3"]{--tbw-pivot-depth: 3}[data-pivot-depth="4"]{--tbw-pivot-depth: 4}.tbw-pivot-panel{display:flex;flex-direction:column;gap:12px;padding:12px;height:100%;overflow-y:auto;font-size:13px}.tbw-pivot-section{border:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-section-bg, var(--tbw-color-bg))}.tbw-pivot-section-header{padding:8px 12px;font-weight:600;background:var(--tbw-pivot-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius) var(--tbw-border-radius) 0 0}.tbw-pivot-section-content{padding:8px}.tbw-pivot-toggle-wrapper{display:flex;align-items:center}.tbw-pivot-toggle-label{display:flex;align-items:center;gap:8px;cursor:pointer}.tbw-pivot-toggle-label input{width:16px;height:16px;cursor:pointer}.tbw-pivot-drop-zone{min-height:60px;padding:8px;border:2px dashed var(--tbw-pivot-drop-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-drop-bg, var(--tbw-color-row-alt));display:flex;flex-wrap:wrap;gap:6px;align-content:flex-start;transition:all .15s ease}.tbw-pivot-drop-zone.drag-over{border-color:var(--tbw-color-accent);background:var(--tbw-pivot-drop-active, var(--tbw-focus-background))}.tbw-pivot-placeholder{color:var(--tbw-color-fg-muted);font-style:italic;padding:8px;text-align:center;width:100%}.tbw-pivot-field-chip{display:inline-flex;align-items:center;gap:6px;padding:4px 8px;background:var(--tbw-pivot-chip-bg, var(--tbw-color-header-bg));border:1px solid var(--tbw-pivot-chip-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);cursor:grab;font-size:12px;transition:all .15s ease}.tbw-pivot-field-chip:hover{background:var(--tbw-pivot-chip-hover, var(--tbw-color-row-hover));border-color:var(--tbw-color-accent)}.tbw-pivot-field-chip.available{background:var(--tbw-color-bg)}.tbw-pivot-field-chip.dragging{opacity:.5;cursor:grabbing}.tbw-pivot-chip-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:120px}.tbw-pivot-chip-remove{display:flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:none;background:transparent;color:var(--tbw-color-fg-muted);font-size:14px;font-weight:700;cursor:pointer;border-radius:50%;transition:all .15s ease}.tbw-pivot-chip-remove:hover{background:var(--tbw-pivot-chip-remove-hover-bg, var(--tbw-color-accent));color:var(--tbw-pivot-chip-remove-hover-fg, var(--tbw-color-accent-fg))}.tbw-pivot-value-chip{padding:4px 8px}.tbw-pivot-value-label-wrapper{display:flex;align-items:center;gap:8px;flex:1;min-width:0}.tbw-pivot-agg-select{padding:2px 4px;font-size:11px;border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);cursor:pointer}.tbw-pivot-available-fields{display:flex;flex-wrap:wrap;gap:6px;min-height:40px}.tbw-pivot-options{display:flex;flex-direction:column;gap:8px}.tbw-pivot-checkbox{display:flex;align-items:center;gap:8px;cursor:pointer}.tbw-pivot-checkbox input{width:14px;height:14px;cursor:pointer}.pivot-group-row.tbw-pivot-slide-in,.pivot-leaf-row.tbw-pivot-slide-in{animation:tbw-pivot-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.pivot-group-row.tbw-pivot-fade-in,.pivot-leaf-row.tbw-pivot-fade-in{animation:tbw-pivot-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-fade-in{0%{opacity:0}to{opacity:1}}';
3112
+ class L extends v {
3034
3113
  name = "pivot";
3035
3114
  version = "1.0.0";
3036
3115
  /** Tool panel ID for shell integration */
@@ -3085,7 +3164,7 @@ class T extends v {
3085
3164
  getToolPanel() {
3086
3165
  if ((this.config?.showToolPanel ?? this.userConfig?.showToolPanel ?? !0) !== !1)
3087
3166
  return {
3088
- id: T.PANEL_ID,
3167
+ id: L.PANEL_ID,
3089
3168
  title: "Pivot",
3090
3169
  icon: "⊞",
3091
3170
  tooltip: "Configure pivot table",
@@ -3098,20 +3177,20 @@ class T extends v {
3098
3177
  processRows(e) {
3099
3178
  if (!this.hasInitialized && this.config.active !== !1 && this.hasValidPivotConfig() && (this.hasInitialized = !0, this.isActive = !0), !this.isActive)
3100
3179
  return [...e];
3101
- const t = Ft(this.config);
3180
+ const t = Nt(this.config);
3102
3181
  if (t.length > 0)
3103
3182
  return this.warn(`Config errors: ${t.join(", ")}`), [...e];
3104
3183
  if (this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.expandedKeys.size === 0 && this.defaultExpanded && this.pivotResult) {
3105
- const r = j(this.pivotResult.rows);
3184
+ const r = Y(this.pivotResult.rows);
3106
3185
  for (const l of r)
3107
3186
  this.expandedKeys.add(l);
3108
3187
  }
3109
- if (this.pivotResult = Pt(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded) {
3110
- const r = j(this.pivotResult.rows);
3188
+ if (this.pivotResult = qt(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded) {
3189
+ const r = Y(this.pivotResult.rows);
3111
3190
  for (const l of r)
3112
3191
  this.expandedKeys.add(l);
3113
3192
  }
3114
- const n = this.config.indentWidth ?? 20, o = qt(
3193
+ const n = this.config.indentWidth ?? 20, o = Ot(
3115
3194
  this.pivotResult.rows,
3116
3195
  this.expandedKeys,
3117
3196
  this.defaultExpanded
@@ -3146,7 +3225,7 @@ class T extends v {
3146
3225
  });
3147
3226
  for (const o of this.pivotResult.columnKeys)
3148
3227
  for (const i of this.config.valueFields ?? []) {
3149
- const r = ne([o], i.field), l = i.header || this.fieldHeaderMap.get(i.field) || i.field;
3228
+ const r = ie([o], i.field), l = i.header || this.fieldHeaderMap.get(i.field) || i.field;
3150
3229
  t.push({
3151
3230
  field: r,
3152
3231
  header: `${o} - ${l} (${i.aggFunc})`,
@@ -3163,12 +3242,12 @@ class T extends v {
3163
3242
  }
3164
3243
  renderRow(e, t) {
3165
3244
  const n = e;
3166
- return n.__pivotRowKey && n.__pivotHasChildren ? Wt(n, t, {
3245
+ return n.__pivotRowKey && n.__pivotHasChildren ? Yt(n, t, {
3167
3246
  columns: this.gridColumns,
3168
3247
  onToggle: (o) => this.toggle(o),
3169
3248
  resolveIcon: (o) => this.resolveIcon(o),
3170
3249
  setIcon: (o, i) => this.setIcon(o, i)
3171
- }) : n.__pivotRowKey !== void 0 && this.isActive ? $t(n, t, this.gridColumns) : (this.cleanupPivotStyling(t), !1);
3250
+ }) : n.__pivotRowKey !== void 0 && this.isActive ? Zt(n, t, this.gridColumns) : (this.cleanupPivotStyling(t), !1);
3172
3251
  }
3173
3252
  /**
3174
3253
  * Remove pivot-specific classes, attributes, and inline styles from a row element.
@@ -3208,7 +3287,7 @@ class T extends v {
3208
3287
  __pivotTotal: this.pivotResult.grandTotal,
3209
3288
  ...this.pivotResult.totals
3210
3289
  };
3211
- jt(n, this.grandTotalFooter, this.gridColumns);
3290
+ Xt(n, this.grandTotalFooter, this.gridColumns);
3212
3291
  }
3213
3292
  /**
3214
3293
  * Remove the grand total footer element.
@@ -3229,7 +3308,7 @@ class T extends v {
3229
3308
  }
3230
3309
  expandAll() {
3231
3310
  if (this.pivotResult) {
3232
- const e = j(this.pivotResult.rows);
3311
+ const e = Y(this.pivotResult.rows);
3233
3312
  for (const t of e)
3234
3313
  this.expandedKeys.add(t);
3235
3314
  this.requestRender();
@@ -3270,16 +3349,16 @@ class T extends v {
3270
3349
  // #endregion
3271
3350
  // #region Tool Panel API
3272
3351
  showPanel() {
3273
- this.grid.openToolPanel(T.PANEL_ID);
3352
+ this.grid.openToolPanel(L.PANEL_ID);
3274
3353
  }
3275
3354
  hidePanel() {
3276
3355
  this.grid.closeToolPanel();
3277
3356
  }
3278
3357
  togglePanel() {
3279
- this.grid.toggleToolPanel(T.PANEL_ID);
3358
+ this.grid.toggleToolPanel(L.PANEL_ID);
3280
3359
  }
3281
3360
  isPanelVisible() {
3282
- return this.grid.activeToolPanel === T.PANEL_ID;
3361
+ return this.grid.activeToolPanel === L.PANEL_ID;
3283
3362
  }
3284
3363
  // #endregion
3285
3364
  // #region Private Helpers
@@ -3323,7 +3402,7 @@ class T extends v {
3323
3402
  },
3324
3403
  getAvailableFields: () => this.getAvailableFields()
3325
3404
  };
3326
- return Ht(e, this.config, this.isActive, t);
3405
+ return Bt(e, this.config, this.isActive, t);
3327
3406
  }
3328
3407
  refreshPanel() {
3329
3408
  this.panelContainer && (this.panelContainer.innerHTML = "", this.renderPanel(this.panelContainer));
@@ -3357,20 +3436,20 @@ class T extends v {
3357
3436
  }
3358
3437
  // #endregion
3359
3438
  // #region Styles
3360
- styles = Ut;
3439
+ styles = Jt;
3361
3440
  // #endregion
3362
3441
  }
3363
- function _e(s) {
3442
+ function Te(s) {
3364
3443
  const e = s.meta ?? {};
3365
3444
  return e.lockPosition !== !0 && e.suppressMovable !== !0;
3366
3445
  }
3367
- function Ie(s, e, t) {
3446
+ function Le(s, e, t) {
3368
3447
  if (e === t || e < 0 || e >= s.length || t < 0 || t > s.length) return s;
3369
3448
  const n = [...s], [o] = n.splice(e, 1);
3370
3449
  return n.splice(t, 0, o), n;
3371
3450
  }
3372
- const Yt = '.header-row>.cell[draggable=true]{cursor:grab;position:relative}.header-row>.cell.dragging{opacity:.5;cursor:grabbing}.header-row>.cell.drop-before:before{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.header-row>.cell.drop-after:after{content:"";position:absolute;right:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.cell.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}@keyframes reorder-fade-in{0%{opacity:0}to{opacity:1}}.cell.fade-animating{animation:reorder-fade-in var(--tbw-animation-duration, .2s) ease-out backwards}';
3373
- class _n extends v {
3451
+ const Qt = '.header-row>.cell[draggable=true]{cursor:grab;position:relative}.header-row>.cell.dragging{opacity:.5;cursor:grabbing}.header-row>.cell.drop-before:before{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.header-row>.cell.drop-after:after{content:"";position:absolute;right:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.cell.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}@keyframes reorder-fade-in{0%{opacity:0}to{opacity:1}}.cell.fade-animating{animation:reorder-fade-in var(--tbw-animation-duration, .2s) ease-out backwards}';
3452
+ class Fn extends v {
3374
3453
  name = "reorder";
3375
3454
  version = "1.0.0";
3376
3455
  get defaultConfig() {
@@ -3442,7 +3521,7 @@ class _n extends v {
3442
3521
  type: N.CAN_MOVE_COLUMN,
3443
3522
  context: r
3444
3523
  }).includes(!1);
3445
- if (!r || !_e(r) || !d) {
3524
+ if (!r || !Te(r) || !d) {
3446
3525
  o.draggable = !1;
3447
3526
  return;
3448
3527
  }
@@ -3455,19 +3534,19 @@ class _n extends v {
3455
3534
  });
3456
3535
  }), o.addEventListener("dragover", (c) => {
3457
3536
  if (c.preventDefault(), !this.isDragging || this.draggedField === i) return;
3458
- const u = o.getBoundingClientRect(), h = u.left + u.width / 2, f = this.getColumnOrder().indexOf(i);
3459
- this.dropIndex = c.clientX < h ? f : f + 1, o.classList.add("drop-target"), o.classList.toggle("drop-before", c.clientX < h), o.classList.toggle("drop-after", c.clientX >= h);
3537
+ const u = o.getBoundingClientRect(), h = u.left + u.width / 2, g = this.getColumnOrder().indexOf(i);
3538
+ this.dropIndex = c.clientX < h ? g : g + 1, o.classList.add("drop-target"), o.classList.toggle("drop-before", c.clientX < h), o.classList.toggle("drop-after", c.clientX >= h);
3460
3539
  }), o.addEventListener("dragleave", () => {
3461
3540
  o.classList.remove("drop-target", "drop-before", "drop-after");
3462
3541
  }), o.addEventListener("drop", (c) => {
3463
3542
  c.preventDefault();
3464
- const u = this.draggedField, h = this.draggedIndex, g = this.dropIndex;
3465
- if (!this.isDragging || u === null || h === null || g === null)
3543
+ const u = this.draggedField, h = this.draggedIndex, f = this.dropIndex;
3544
+ if (!this.isDragging || u === null || h === null || f === null)
3466
3545
  return;
3467
- const f = g > h ? g - 1 : g, m = this.getColumnOrder(), p = Ie(m, h, f), R = {
3546
+ const g = f > h ? f - 1 : f, m = this.getColumnOrder(), p = Le(m, h, g), R = {
3468
3547
  field: u,
3469
3548
  fromIndex: h,
3470
- toIndex: f,
3549
+ toIndex: g,
3471
3550
  columnOrder: p
3472
3551
  };
3473
3552
  this.updateColumnOrder(p), this.emit("column-move", R);
@@ -3483,7 +3562,7 @@ class _n extends v {
3483
3562
  const t = this.grid, n = t._focusCol, o = t._visibleColumns;
3484
3563
  if (n < 0 || n >= o.length) return;
3485
3564
  const i = o[n];
3486
- if (!i || !_e(i)) return;
3565
+ if (!i || !Te(i)) return;
3487
3566
  const r = this.grid;
3488
3567
  if (r.queryPlugins({
3489
3568
  type: N.CAN_MOVE_COLUMN,
@@ -3498,7 +3577,7 @@ class _n extends v {
3498
3577
  type: N.CAN_MOVE_COLUMN,
3499
3578
  context: u
3500
3579
  }).includes(!1)))
3501
- return this.moveColumn(i.field, c), t._focusCol = c, Ge(this.grid), e.preventDefault(), e.stopPropagation(), !0;
3580
+ return this.moveColumn(i.field, c), t._focusCol = c, $e(this.grid), e.preventDefault(), e.stopPropagation(), !0;
3502
3581
  }
3503
3582
  // #endregion
3504
3583
  // #region Public API
@@ -3517,7 +3596,7 @@ class _n extends v {
3517
3596
  moveColumn(e, t) {
3518
3597
  const n = this.getColumnOrder(), o = n.indexOf(e);
3519
3598
  if (o === -1) return;
3520
- const i = Ie(n, o, t);
3599
+ const i = Le(n, o, t);
3521
3600
  this.updateColumnOrder(i), this.emit("column-move", {
3522
3601
  field: e,
3523
3602
  fromIndex: o,
@@ -3635,7 +3714,7 @@ class _n extends v {
3635
3714
  }
3636
3715
  // #endregion
3637
3716
  // #region Styles
3638
- styles = Yt;
3717
+ styles = Qt;
3639
3718
  // #endregion
3640
3719
  }
3641
3720
  function D(s) {
@@ -3646,38 +3725,38 @@ function D(s) {
3646
3725
  endCol: Math.max(s.startCol, s.endCol)
3647
3726
  };
3648
3727
  }
3649
- function Zt(s) {
3728
+ function en(s) {
3650
3729
  const e = D(s);
3651
3730
  return {
3652
3731
  from: { row: e.startRow, col: e.startCol },
3653
3732
  to: { row: e.endRow, col: e.endCol }
3654
3733
  };
3655
3734
  }
3656
- function J(s) {
3657
- return s.map(Zt);
3735
+ function ee(s) {
3736
+ return s.map(en);
3658
3737
  }
3659
- function Xt(s, e, t) {
3738
+ function tn(s, e, t) {
3660
3739
  const n = D(t);
3661
3740
  return s >= n.startRow && s <= n.endRow && e >= n.startCol && e <= n.endCol;
3662
3741
  }
3663
- function Le(s, e, t) {
3664
- return t.some((n) => Xt(s, e, n));
3742
+ function Fe(s, e, t) {
3743
+ return t.some((n) => tn(s, e, n));
3665
3744
  }
3666
- function Jt(s) {
3745
+ function nn(s) {
3667
3746
  const e = [], t = D(s);
3668
3747
  for (let n = t.startRow; n <= t.endRow; n++)
3669
3748
  for (let o = t.startCol; o <= t.endCol; o++)
3670
3749
  e.push({ row: n, col: o });
3671
3750
  return e;
3672
3751
  }
3673
- function Qt(s) {
3752
+ function on(s) {
3674
3753
  const e = /* @__PURE__ */ new Map();
3675
3754
  for (const t of s)
3676
- for (const n of Jt(t))
3755
+ for (const n of nn(t))
3677
3756
  e.set(`${n.row},${n.col}`, n);
3678
3757
  return [...e.values()];
3679
3758
  }
3680
- function Y(s, e) {
3759
+ function X(s, e) {
3681
3760
  return {
3682
3761
  startRow: s.row,
3683
3762
  startCol: s.col,
@@ -3685,8 +3764,8 @@ function Y(s, e) {
3685
3764
  endCol: e.col
3686
3765
  };
3687
3766
  }
3688
- const en = ':host .selecting .data-grid-row>.cell{user-select:none}:host .data-grid-row.row-focus{background-color:var(--tbw-focus-background, rgba(from var(--tbw-color-accent) r g b / 12%))}:host([data-selection-mode="row"]) .cell-focus{outline:none}:host .data-grid-row>.cell.selected{background-color:var(--tbw-range-selection-bg)}:host .data-grid-row>.cell.selected.top{border-top:2px solid var(--tbw-range-border-color)}:host .data-grid-row>.cell.selected.bottom{border-bottom:2px solid var(--tbw-range-border-color)}:host .data-grid-row>.cell.selected.first{border-left:2px solid var(--tbw-range-border-color)}:host .data-grid-row>.cell.selected.last{border-right:2px solid var(--tbw-range-border-color)}';
3689
- function tn(s, e, t) {
3767
+ const rn = ':host .selecting .data-grid-row>.cell{user-select:none}:host .data-grid-row.row-focus{background-color:var(--tbw-focus-background, rgba(from var(--tbw-color-accent) r g b / 12%))}:host([data-selection-mode="row"]) .cell-focus{outline:none}:host .data-grid-row>.cell.selected{background-color:var(--tbw-range-selection-bg)}:host .data-grid-row>.cell.selected.top{border-top:2px solid var(--tbw-range-border-color)}:host .data-grid-row>.cell.selected.bottom{border-bottom:2px solid var(--tbw-range-border-color)}:host .data-grid-row>.cell.selected.first{border-left:2px solid var(--tbw-range-border-color)}:host .data-grid-row>.cell.selected.last{border-right:2px solid var(--tbw-range-border-color)}:host .tbw-selection-summary{font-size:13px;color:var(--tbw-color-fg-muted);white-space:nowrap}';
3768
+ function sn(s, e, t) {
3690
3769
  if (s === "cell" && e.selectedCell)
3691
3770
  return {
3692
3771
  mode: s,
@@ -3704,9 +3783,9 @@ function tn(s, e, t) {
3704
3783
  }));
3705
3784
  return { mode: s, ranges: n };
3706
3785
  }
3707
- return s === "range" && e.ranges.length > 0 ? { mode: s, ranges: J(e.ranges) } : { mode: s, ranges: [] };
3786
+ return s === "range" && e.ranges.length > 0 ? { mode: s, ranges: ee(e.ranges) } : { mode: s, ranges: [] };
3708
3787
  }
3709
- class In extends v {
3788
+ class Mn extends v {
3710
3789
  name = "selection";
3711
3790
  version = "1.0.0";
3712
3791
  get defaultConfig() {
@@ -3744,7 +3823,7 @@ class In extends v {
3744
3823
  if (i === "range") {
3745
3824
  const r = o.shiftKey, l = o.ctrlKey || o.metaKey;
3746
3825
  if (r && this.cellAnchor) {
3747
- const a = Y(this.cellAnchor, { row: t, col: n });
3826
+ const a = X(this.cellAnchor, { row: t, col: n });
3748
3827
  l ? this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = a : this.ranges.push(a) : this.ranges = [a], this.activeRange = a;
3749
3828
  } else if (l) {
3750
3829
  const a = {
@@ -3779,8 +3858,10 @@ class In extends v {
3779
3858
  return queueMicrotask(() => {
3780
3859
  this.selected.clear(), this.selected.add(this.grid._focusRow), this.lastSelected = this.grid._focusRow, this.emit("selection-change", this.#e()), this.requestAfterRender();
3781
3860
  }), !1;
3782
- if (t === "range" && o)
3783
- return e.shiftKey && !this.cellAnchor && (this.cellAnchor = { row: this.grid._focusRow, col: this.grid._focusCol }), this.pendingKeyboardUpdate = { shiftKey: e.shiftKey }, queueMicrotask(() => this.requestAfterRender()), !1;
3861
+ if (t === "range" && o) {
3862
+ const i = e.key === "Tab", r = e.shiftKey && !i;
3863
+ return r && !this.cellAnchor && (this.cellAnchor = { row: this.grid._focusRow, col: this.grid._focusCol }), this.pendingKeyboardUpdate = { shiftKey: r }, queueMicrotask(() => this.requestAfterRender()), !1;
3864
+ }
3784
3865
  if (t === "range" && e.key === "a" && (e.ctrlKey || e.metaKey)) {
3785
3866
  const i = this.rows.length, r = this.columns.length;
3786
3867
  if (i > 0 && r > 0) {
@@ -3811,7 +3892,7 @@ class In extends v {
3811
3892
  }
3812
3893
  onCellMouseMove(e) {
3813
3894
  if (this.config.mode !== "range" || !this.isDragging || !this.cellAnchor || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
3814
- const t = Y(this.cellAnchor, { row: e.rowIndex, col: e.colIndex });
3895
+ const t = X(this.cellAnchor, { row: e.rowIndex, col: e.colIndex });
3815
3896
  return this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = t : this.ranges.push(t), this.activeRange = t, this.emit("selection-change", this.#e()), this.requestAfterRender(), !0;
3816
3897
  }
3817
3898
  onCellMouseUp(e) {
@@ -3832,17 +3913,18 @@ class In extends v {
3832
3913
  const o = e.querySelectorAll(".data-grid-row");
3833
3914
  if (o.forEach((i) => {
3834
3915
  i.classList.remove("selected", "row-focus");
3835
- }), t === "row" && (e.querySelectorAll(".cell-focus").forEach((i) => i.classList.remove("cell-focus")), o.forEach((i) => {
3836
- const r = i.querySelector(".cell[data-row]"), l = parseInt(r?.getAttribute("data-row") ?? "-1", 10);
3916
+ }), t === "row" && (V(e), o.forEach((i) => {
3917
+ const r = i.querySelector(".cell[data-row]"), l = je(r);
3837
3918
  l >= 0 && this.selected.has(l) && i.classList.add("selected", "row-focus");
3838
3919
  })), t === "range" && this.ranges.length > 0) {
3920
+ V(e);
3839
3921
  const i = this.activeRange ? D(this.activeRange) : null;
3840
3922
  e.querySelectorAll(".cell[data-row][data-col]").forEach((l) => {
3841
3923
  const a = parseInt(l.getAttribute("data-row") ?? "-1", 10), d = parseInt(l.getAttribute("data-col") ?? "-1", 10);
3842
- a >= 0 && d >= 0 && Le(a, d, this.ranges) && (l.classList.add("selected"), l.classList.remove("cell-focus"), i && (a === i.startRow && l.classList.add("top"), a === i.endRow && l.classList.add("bottom"), d === i.startCol && l.classList.add("first"), d === i.endCol && l.classList.add("last")));
3924
+ a >= 0 && d >= 0 && Fe(a, d, this.ranges) && (l.classList.add("selected"), i && (a === i.startRow && l.classList.add("top"), a === i.endRow && l.classList.add("bottom"), d === i.startCol && l.classList.add("first"), d === i.endCol && l.classList.add("last")));
3843
3925
  });
3844
3926
  }
3845
- t === "cell" && this.selectedCell && e.querySelectorAll(".cell-focus").forEach((i) => i.classList.remove("cell-focus"));
3927
+ t === "cell" && this.selectedCell && V(e);
3846
3928
  }
3847
3929
  afterRender() {
3848
3930
  const e = this.shadowRoot;
@@ -3853,7 +3935,7 @@ class In extends v {
3853
3935
  this.pendingKeyboardUpdate = null;
3854
3936
  const i = this.grid._focusRow, r = this.grid._focusCol;
3855
3937
  if (o && this.cellAnchor) {
3856
- const l = Y(this.cellAnchor, { row: i, col: r });
3938
+ const l = X(this.cellAnchor, { row: i, col: r });
3857
3939
  this.ranges = [l], this.activeRange = l;
3858
3940
  } else o || (this.ranges = [], this.activeRange = null, this.cellAnchor = { row: i, col: r });
3859
3941
  this.emit("selection-change", this.#e());
@@ -3885,19 +3967,19 @@ class In extends v {
3885
3967
  * Get all selected cell ranges in public format.
3886
3968
  */
3887
3969
  getRanges() {
3888
- return J(this.ranges);
3970
+ return ee(this.ranges);
3889
3971
  }
3890
3972
  /**
3891
3973
  * Get all selected cells across all ranges.
3892
3974
  */
3893
3975
  getSelectedCells() {
3894
- return Qt(this.ranges);
3976
+ return on(this.ranges);
3895
3977
  }
3896
3978
  /**
3897
3979
  * Check if a specific cell is in range selection.
3898
3980
  */
3899
3981
  isCellSelected(e, t) {
3900
- return Le(e, t, this.ranges);
3982
+ return Fe(e, t, this.ranges);
3901
3983
  }
3902
3984
  /**
3903
3985
  * Clear all selection.
@@ -3916,13 +3998,13 @@ class In extends v {
3916
3998
  endCol: t.to.col
3917
3999
  })), this.activeRange = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null, this.emit("selection-change", {
3918
4000
  mode: this.config.mode,
3919
- ranges: J(this.ranges)
4001
+ ranges: ee(this.ranges)
3920
4002
  }), this.requestAfterRender();
3921
4003
  }
3922
4004
  // #endregion
3923
4005
  // #region Private Helpers
3924
4006
  #e() {
3925
- return tn(
4007
+ return sn(
3926
4008
  this.config.mode,
3927
4009
  {
3928
4010
  selectedCell: this.selectedCell,
@@ -3934,26 +4016,26 @@ class In extends v {
3934
4016
  }
3935
4017
  // #endregion
3936
4018
  // #region Styles
3937
- styles = en;
4019
+ styles = rn;
3938
4020
  // #endregion
3939
4021
  }
3940
4022
  function q(s, e) {
3941
4023
  return Math.floor(s / e);
3942
4024
  }
3943
- function nn(s, e) {
4025
+ function ln(s, e) {
3944
4026
  return {
3945
4027
  start: s * e,
3946
4028
  end: (s + 1) * e
3947
4029
  };
3948
4030
  }
3949
- function on(s, e, t) {
4031
+ function an(s, e, t) {
3950
4032
  const n = q(s, t), o = q(e - 1, t), i = [];
3951
4033
  for (let r = n; r <= o; r++)
3952
4034
  i.push(r);
3953
4035
  return i;
3954
4036
  }
3955
- async function Te(s, e, t, n) {
3956
- const o = nn(e, t);
4037
+ async function Me(s, e, t, n) {
4038
+ const o = ln(e, t);
3957
4039
  return s.getRows({
3958
4040
  startRow: o.start,
3959
4041
  endRow: o.end,
@@ -3961,14 +4043,14 @@ async function Te(s, e, t, n) {
3961
4043
  filterModel: n.filterModel
3962
4044
  });
3963
4045
  }
3964
- function rn(s, e, t) {
4046
+ function dn(s, e, t) {
3965
4047
  const n = q(s, e), o = t.get(n);
3966
4048
  if (!o) return;
3967
4049
  const i = s % e;
3968
4050
  return o[i];
3969
4051
  }
3970
- const sn = 100;
3971
- class Ln extends v {
4052
+ const cn = 100;
4053
+ class Pn extends v {
3972
4054
  name = "serverSide";
3973
4055
  version = "1.0.0";
3974
4056
  get defaultConfig() {
@@ -3997,12 +4079,12 @@ class Ln extends v {
3997
4079
  */
3998
4080
  loadRequiredBlocks() {
3999
4081
  if (!this.dataSource) return;
4000
- const e = this.grid, t = this.config.cacheBlockSize ?? 100, n = { startRow: e._virtualization.start, endRow: e._virtualization.end }, o = on(n.startRow, n.endRow, t);
4082
+ const e = this.grid, t = this.config.cacheBlockSize ?? 100, n = { startRow: e._virtualization.start, endRow: e._virtualization.end }, o = an(n.startRow, n.endRow, t);
4001
4083
  for (const i of o)
4002
4084
  if (!(this.loadedBlocks.has(i) || this.loadingBlocks.has(i))) {
4003
4085
  if (this.loadingBlocks.size >= (this.config.maxConcurrentRequests ?? 2))
4004
4086
  break;
4005
- this.loadingBlocks.add(i), Te(this.dataSource, i, t, {}).then((r) => {
4087
+ this.loadingBlocks.add(i), Me(this.dataSource, i, t, {}).then((r) => {
4006
4088
  this.loadedBlocks.set(i, r.rows), this.totalRowCount = r.totalRowCount, this.loadingBlocks.delete(i), this.requestRender(), this.loadRequiredBlocks();
4007
4089
  }).catch(() => {
4008
4090
  this.loadingBlocks.delete(i);
@@ -4015,7 +4097,7 @@ class Ln extends v {
4015
4097
  if (!this.dataSource) return [...e];
4016
4098
  const t = [];
4017
4099
  for (let n = 0; n < this.totalRowCount; n++) {
4018
- const o = rn(n, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
4100
+ const o = dn(n, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
4019
4101
  t.push(o ?? { __loading: !0, __index: n });
4020
4102
  }
4021
4103
  return t;
@@ -4023,7 +4105,7 @@ class Ln extends v {
4023
4105
  onScroll(e) {
4024
4106
  this.dataSource && (this.loadRequiredBlocks(), this.scrollDebounceTimer && clearTimeout(this.scrollDebounceTimer), this.scrollDebounceTimer = setTimeout(() => {
4025
4107
  this.loadRequiredBlocks();
4026
- }, sn));
4108
+ }, cn));
4027
4109
  }
4028
4110
  // #endregion
4029
4111
  // #region Public API
@@ -4034,7 +4116,7 @@ class Ln extends v {
4034
4116
  setDataSource(e) {
4035
4117
  this.dataSource = e, this.loadedBlocks.clear(), this.loadingBlocks.clear();
4036
4118
  const t = this.config.cacheBlockSize ?? 100;
4037
- Te(e, 0, t, {}).then((n) => {
4119
+ Me(e, 0, t, {}).then((n) => {
4038
4120
  this.loadedBlocks.set(0, n.rows), this.totalRowCount = n.totalRowCount, this.requestRender();
4039
4121
  });
4040
4122
  }
@@ -4072,59 +4154,59 @@ class Ln extends v {
4072
4154
  }
4073
4155
  // #endregion
4074
4156
  }
4075
- function De(s, e, t) {
4157
+ function Ve(s, e, t) {
4076
4158
  return s.id !== void 0 ? String(s.id) : t ? `${t}-${e}` : String(e);
4077
4159
  }
4078
- function Fe(s, e) {
4160
+ function Pe(s, e) {
4079
4161
  const t = new Set(s);
4080
4162
  return t.has(e) ? t.delete(e) : t.add(e), t;
4081
4163
  }
4082
- function Q(s, e, t = null, n = 0) {
4164
+ function te(s, e, t = null, n = 0) {
4083
4165
  const o = e.childrenField ?? "children", i = /* @__PURE__ */ new Set();
4084
4166
  for (let r = 0; r < s.length; r++) {
4085
- const l = s[r], a = De(l, r, t), d = l[o];
4167
+ const l = s[r], a = Ve(l, r, t), d = l[o];
4086
4168
  if (Array.isArray(d) && d.length > 0) {
4087
4169
  i.add(a);
4088
- const c = Q(d, e, a, n + 1);
4170
+ const c = te(d, e, a, n + 1);
4089
4171
  for (const u of c) i.add(u);
4090
4172
  }
4091
4173
  }
4092
4174
  return i;
4093
4175
  }
4094
- function ln() {
4176
+ function un() {
4095
4177
  return /* @__PURE__ */ new Set();
4096
4178
  }
4097
- function He(s, e, t, n = null, o = 0) {
4179
+ function Oe(s, e, t, n = null, o = 0) {
4098
4180
  const i = t.childrenField ?? "children";
4099
4181
  for (let r = 0; r < s.length; r++) {
4100
- const l = s[r], a = De(l, r, n);
4182
+ const l = s[r], a = Ve(l, r, n);
4101
4183
  if (a === e)
4102
4184
  return [a];
4103
4185
  const d = l[i];
4104
4186
  if (Array.isArray(d) && d.length > 0) {
4105
- const c = He(d, e, t, a, o + 1);
4187
+ const c = Oe(d, e, t, a, o + 1);
4106
4188
  if (c)
4107
4189
  return [a, ...c];
4108
4190
  }
4109
4191
  }
4110
4192
  return null;
4111
4193
  }
4112
- function an(s, e, t, n) {
4113
- const o = He(s, e, t);
4194
+ function hn(s, e, t, n) {
4195
+ const o = Oe(s, e, t);
4114
4196
  if (!o) return n;
4115
4197
  const i = new Set(n);
4116
4198
  for (let r = 0; r < o.length - 1; r++)
4117
4199
  i.add(o[r]);
4118
4200
  return i;
4119
4201
  }
4120
- function Pe(s, e = "children") {
4202
+ function Ke(s, e = "children") {
4121
4203
  if (!Array.isArray(s) || s.length === 0) return !1;
4122
4204
  for (const t of s)
4123
4205
  if (t && Array.isArray(t[e]) && t[e].length > 0)
4124
4206
  return !0;
4125
4207
  return !1;
4126
4208
  }
4127
- function dn(s) {
4209
+ function fn(s) {
4128
4210
  if (!Array.isArray(s) || s.length === 0) return null;
4129
4211
  const e = ["children", "items", "nodes", "subRows", "nested"];
4130
4212
  for (const t of s)
@@ -4135,11 +4217,11 @@ function dn(s) {
4135
4217
  }
4136
4218
  return null;
4137
4219
  }
4138
- const cn = ".tree-cell{display:flex;align-items:center;padding-left:calc(var(--tree-depth, 0) * var(--tbw-tree-indent, 20px))}.tree-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;margin-right:4px}.tree-toggle:hover{color:var(--tbw-tree-accent, var(--tbw-color-accent))}.tree-spacer{width:14px;display:inline-block}.data-grid-row.tbw-tree-slide-in{animation:tbw-tree-slide-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)}}.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-fade-in{0%{opacity:0}to{opacity:1}}";
4139
- class Tn extends v {
4220
+ const gn = ".tree-cell{display:flex;align-items:center;padding-left:calc(var(--tree-depth, 0) * var(--tbw-tree-indent, 20px))}.tree-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;margin-right:4px}.tree-toggle:hover{color:var(--tbw-tree-accent, var(--tbw-color-accent))}.tree-spacer{width:14px;display:inline-block}.data-grid-row.tbw-tree-slide-in{animation:tbw-tree-slide-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)}}.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-fade-in{0%{opacity:0}to{opacity:1}}";
4221
+ class Kn extends v {
4140
4222
  name = "tree";
4141
4223
  version = "1.0.0";
4142
- styles = cn;
4224
+ styles = gn;
4143
4225
  get defaultConfig() {
4144
4226
  return {
4145
4227
  childrenField: "children",
@@ -4177,17 +4259,17 @@ class Tn extends v {
4177
4259
  // #region Auto-Detection
4178
4260
  detect(e) {
4179
4261
  if (!this.config.autoDetect) return !1;
4180
- const t = this.config.childrenField ?? dn(e) ?? "children";
4181
- return Pe(e, t);
4262
+ const t = this.config.childrenField ?? fn(e) ?? "children";
4263
+ return Ke(e, t);
4182
4264
  }
4183
4265
  // #endregion
4184
4266
  // #region Data Processing
4185
4267
  processRows(e) {
4186
4268
  const t = this.config.childrenField ?? "children";
4187
- if (!Pe(e, t))
4269
+ if (!Ke(e, t))
4188
4270
  return this.flattenedRows = [], this.rowKeyMap.clear(), this.previousVisibleKeys.clear(), [...e];
4189
4271
  let n = this.withStableKeys(e);
4190
- this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = Q(n, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(n, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
4272
+ this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = te(n, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(n, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
4191
4273
  const o = /* @__PURE__ */ new Set();
4192
4274
  for (const i of this.flattenedRows)
4193
4275
  this.rowKeyMap.set(i.key, i), o.add(i.key), !this.previousVisibleKeys.has(i.key) && i.depth > 0 && this.keysToAnimate.add(i.key);
@@ -4245,13 +4327,13 @@ class Tn extends v {
4245
4327
  const n = { ...t[0] }, o = n.viewRenderer;
4246
4328
  if (o?.__treeWrapped) return t;
4247
4329
  const i = () => this.config, r = this.setIcon.bind(this), l = this.resolveIcon.bind(this), a = (d) => {
4248
- const { value: c, row: u } = d, { indentWidth: h = 20, showExpandIcons: g = !0 } = i(), f = document.createElement("span");
4249
- if (f.className = "tree-cell", f.style.setProperty("--tree-depth", String(u.__treeDepth ?? 0)), f.style.setProperty("--tbw-tree-indent", `${h}px`), u.__treeHasChildren && g) {
4330
+ const { value: c, row: u } = d, { indentWidth: h = 20, showExpandIcons: f = !0 } = i(), g = document.createElement("span");
4331
+ if (g.className = "tree-cell", g.style.setProperty("--tree-depth", String(u.__treeDepth ?? 0)), g.style.setProperty("--tbw-tree-indent", `${h}px`), u.__treeHasChildren && f) {
4250
4332
  const p = document.createElement("span");
4251
- p.className = `tree-toggle${u.__treeExpanded ? " expanded" : ""}`, r(p, l(u.__treeExpanded ? "collapse" : "expand")), p.setAttribute("data-tree-key", u.__treeKey), f.appendChild(p);
4252
- } else if (g) {
4333
+ p.className = `tree-toggle${u.__treeExpanded ? " expanded" : ""}`, r(p, l(u.__treeExpanded ? "collapse" : "expand")), p.setAttribute("data-tree-key", u.__treeKey), g.appendChild(p);
4334
+ } else if (f) {
4253
4335
  const p = document.createElement("span");
4254
- p.className = "tree-spacer", f.appendChild(p);
4336
+ p.className = "tree-spacer", g.appendChild(p);
4255
4337
  }
4256
4338
  const m = document.createElement("span");
4257
4339
  if (o) {
@@ -4259,7 +4341,7 @@ class Tn extends v {
4259
4341
  p instanceof Node ? m.appendChild(p) : m.textContent = String(p ?? c ?? "");
4260
4342
  } else
4261
4343
  m.textContent = String(c ?? "");
4262
- return f.appendChild(m), f;
4344
+ return g.appendChild(m), g;
4263
4345
  };
4264
4346
  return a.__treeWrapped = !0, n.viewRenderer = a, t[0] = n, t;
4265
4347
  }
@@ -4269,7 +4351,7 @@ class Tn extends v {
4269
4351
  const t = e.originalEvent?.target;
4270
4352
  if (!t?.classList.contains("tree-toggle")) return !1;
4271
4353
  const n = t.getAttribute("data-tree-key"), o = n ? this.rowKeyMap.get(n) : null;
4272
- return o ? (this.expandedKeys = Fe(this.expandedKeys, n), this.emit("tree-expand", {
4354
+ return o ? (this.expandedKeys = Pe(this.expandedKeys, n), this.emit("tree-expand", {
4273
4355
  key: n,
4274
4356
  row: o.data,
4275
4357
  expanded: this.expandedKeys.has(n),
@@ -4304,13 +4386,13 @@ class Tn extends v {
4304
4386
  this.expandedKeys.delete(e), this.requestRender();
4305
4387
  }
4306
4388
  toggle(e) {
4307
- this.expandedKeys = Fe(this.expandedKeys, e), this.requestRender();
4389
+ this.expandedKeys = Pe(this.expandedKeys, e), this.requestRender();
4308
4390
  }
4309
4391
  expandAll() {
4310
- this.expandedKeys = Q(this.rows, this.config), this.requestRender();
4392
+ this.expandedKeys = te(this.rows, this.config), this.requestRender();
4311
4393
  }
4312
4394
  collapseAll() {
4313
- this.expandedKeys = ln(), this.requestRender();
4395
+ this.expandedKeys = un(), this.requestRender();
4314
4396
  }
4315
4397
  isExpanded(e) {
4316
4398
  return this.expandedKeys.has(e);
@@ -4325,11 +4407,11 @@ class Tn extends v {
4325
4407
  return this.rowKeyMap.get(e)?.data;
4326
4408
  }
4327
4409
  expandToKey(e) {
4328
- this.expandedKeys = an(this.rows, e, this.config, this.expandedKeys), this.requestRender();
4410
+ this.expandedKeys = hn(this.rows, e, this.config, this.expandedKeys), this.requestRender();
4329
4411
  }
4330
4412
  // #endregion
4331
4413
  }
4332
- function un(s, e, t) {
4414
+ function pn(s, e, t) {
4333
4415
  const n = [...s.undoStack, e];
4334
4416
  for (; n.length > t; )
4335
4417
  n.shift();
@@ -4339,7 +4421,7 @@ function un(s, e, t) {
4339
4421
  // Clear redo on new action
4340
4422
  };
4341
4423
  }
4342
- function Me(s) {
4424
+ function Ne(s) {
4343
4425
  if (s.undoStack.length === 0)
4344
4426
  return { newState: s, action: null };
4345
4427
  const e = [...s.undoStack], t = e.pop();
@@ -4351,7 +4433,7 @@ function Me(s) {
4351
4433
  action: t
4352
4434
  } : { newState: s, action: null };
4353
4435
  }
4354
- function Ke(s) {
4436
+ function qe(s) {
4355
4437
  if (s.redoStack.length === 0)
4356
4438
  return { newState: s, action: null };
4357
4439
  const e = [...s.redoStack], t = e.pop();
@@ -4363,16 +4445,16 @@ function Ke(s) {
4363
4445
  action: t
4364
4446
  } : { newState: s, action: null };
4365
4447
  }
4366
- function hn(s) {
4448
+ function mn(s) {
4367
4449
  return s.undoStack.length > 0;
4368
4450
  }
4369
- function gn(s) {
4451
+ function wn(s) {
4370
4452
  return s.redoStack.length > 0;
4371
4453
  }
4372
- function fn() {
4454
+ function bn() {
4373
4455
  return { undoStack: [], redoStack: [] };
4374
4456
  }
4375
- function pn(s, e, t, n) {
4457
+ function vn(s, e, t, n) {
4376
4458
  return {
4377
4459
  type: "cell-edit",
4378
4460
  rowIndex: s,
@@ -4382,7 +4464,7 @@ function pn(s, e, t, n) {
4382
4464
  timestamp: Date.now()
4383
4465
  };
4384
4466
  }
4385
- class Fn extends v {
4467
+ class Nn extends v {
4386
4468
  name = "undoRedo";
4387
4469
  version = "1.0.0";
4388
4470
  get defaultConfig() {
@@ -4407,7 +4489,7 @@ class Fn extends v {
4407
4489
  onKeyDown(e) {
4408
4490
  const t = (e.ctrlKey || e.metaKey) && e.key === "z" && !e.shiftKey, n = (e.ctrlKey || e.metaKey) && (e.key === "y" || e.key === "z" && e.shiftKey);
4409
4491
  if (t) {
4410
- const o = Me({ undoStack: this.undoStack, redoStack: this.redoStack });
4492
+ const o = Ne({ undoStack: this.undoStack, redoStack: this.redoStack });
4411
4493
  if (o.action) {
4412
4494
  const i = this.rows;
4413
4495
  i[o.action.rowIndex] && (i[o.action.rowIndex][o.action.field] = o.action.oldValue), this.undoStack = o.newState.undoStack, this.redoStack = o.newState.redoStack, this.emit("undo", {
@@ -4418,7 +4500,7 @@ class Fn extends v {
4418
4500
  return !0;
4419
4501
  }
4420
4502
  if (n) {
4421
- const o = Ke({ undoStack: this.undoStack, redoStack: this.redoStack });
4503
+ const o = qe({ undoStack: this.undoStack, redoStack: this.redoStack });
4422
4504
  if (o.action) {
4423
4505
  const i = this.rows;
4424
4506
  i[o.action.rowIndex] && (i[o.action.rowIndex][o.action.field] = o.action.newValue), this.undoStack = o.newState.undoStack, this.redoStack = o.newState.redoStack, this.emit("redo", {
@@ -4441,7 +4523,7 @@ class Fn extends v {
4441
4523
  * @param newValue - The value after the edit
4442
4524
  */
4443
4525
  recordEdit(e, t, n, o) {
4444
- const i = pn(e, t, n, o), r = un(
4526
+ const i = vn(e, t, n, o), r = pn(
4445
4527
  { undoStack: this.undoStack, redoStack: this.redoStack },
4446
4528
  i,
4447
4529
  this.config.maxHistorySize ?? 100
@@ -4454,7 +4536,7 @@ class Fn extends v {
4454
4536
  * @returns The undone action, or null if nothing to undo
4455
4537
  */
4456
4538
  undo() {
4457
- const e = Me({ undoStack: this.undoStack, redoStack: this.redoStack });
4539
+ const e = Ne({ undoStack: this.undoStack, redoStack: this.redoStack });
4458
4540
  if (e.action) {
4459
4541
  const t = this.rows;
4460
4542
  t[e.action.rowIndex] && (t[e.action.rowIndex][e.action.field] = e.action.oldValue), this.undoStack = e.newState.undoStack, this.redoStack = e.newState.redoStack, this.requestRender();
@@ -4467,7 +4549,7 @@ class Fn extends v {
4467
4549
  * @returns The redone action, or null if nothing to redo
4468
4550
  */
4469
4551
  redo() {
4470
- const e = Ke({ undoStack: this.undoStack, redoStack: this.redoStack });
4552
+ const e = qe({ undoStack: this.undoStack, redoStack: this.redoStack });
4471
4553
  if (e.action) {
4472
4554
  const t = this.rows;
4473
4555
  t[e.action.rowIndex] && (t[e.action.rowIndex][e.action.field] = e.action.newValue), this.undoStack = e.newState.undoStack, this.redoStack = e.newState.redoStack, this.requestRender();
@@ -4478,19 +4560,19 @@ class Fn extends v {
4478
4560
  * Check if there are any actions that can be undone.
4479
4561
  */
4480
4562
  canUndo() {
4481
- return hn({ undoStack: this.undoStack, redoStack: this.redoStack });
4563
+ return mn({ undoStack: this.undoStack, redoStack: this.redoStack });
4482
4564
  }
4483
4565
  /**
4484
4566
  * Check if there are any actions that can be redone.
4485
4567
  */
4486
4568
  canRedo() {
4487
- return gn({ undoStack: this.undoStack, redoStack: this.redoStack });
4569
+ return wn({ undoStack: this.undoStack, redoStack: this.redoStack });
4488
4570
  }
4489
4571
  /**
4490
4572
  * Clear all undo/redo history.
4491
4573
  */
4492
4574
  clearHistory() {
4493
- const e = fn();
4575
+ const e = bn();
4494
4576
  this.undoStack = e.undoStack, this.redoStack = e.redoStack;
4495
4577
  }
4496
4578
  /**
@@ -4507,8 +4589,8 @@ class Fn extends v {
4507
4589
  }
4508
4590
  // #endregion
4509
4591
  }
4510
- const mn = '.tbw-visibility-content{display:flex;flex-direction:column;height:100%}.tbw-visibility-list{flex:1;overflow-y:auto;padding:8px}.tbw-visibility-row{display:flex;align-items:center;gap:8px;padding:6px 4px;cursor:pointer;font-size:13px;border-radius:var(--tbw-border-radius, 4px);position:relative}.tbw-visibility-row:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6))}.tbw-visibility-row input[type=checkbox]{cursor:pointer}.tbw-visibility-row.locked span{color:var(--tbw-color-fg-muted, #888)}.tbw-visibility-handle{cursor:grab;color:var(--tbw-color-fg-muted, #888);font-size:10px;letter-spacing:-2px;user-select:none;flex-shrink:0}.tbw-visibility-row.reorderable:hover .tbw-visibility-handle{color:var(--tbw-color-fg, #1f2937)}.tbw-visibility-label{display:flex;align-items:center;gap:8px;flex:1;cursor:pointer}.tbw-visibility-row.dragging{opacity:.5;cursor:grabbing}.tbw-visibility-row.drop-before:before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-row.drop-after:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-show-all{margin:8px;padding:8px 12px;border:1px solid var(--tbw-visibility-border, var(--tbw-color-border, #e5e7eb));border-radius:var(--tbw-border-radius, 4px);background:var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg, #f9fafb));color:var(--tbw-color-fg, #1f2937);cursor:pointer;font-size:13px}.tbw-visibility-show-all:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6))}';
4511
- function Ne(s) {
4592
+ const xn = '.tbw-visibility-content{display:flex;flex-direction:column;height:100%}.tbw-visibility-list{flex:1;overflow-y:auto;padding:8px}.tbw-visibility-row{display:flex;align-items:center;gap:8px;padding:6px 4px;cursor:pointer;font-size:13px;border-radius:var(--tbw-border-radius, 4px);position:relative}.tbw-visibility-row:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6))}.tbw-visibility-row input[type=checkbox]{cursor:pointer}.tbw-visibility-row.locked span{color:var(--tbw-color-fg-muted, #888)}.tbw-visibility-handle{cursor:grab;color:var(--tbw-color-fg-muted, #888);font-size:10px;letter-spacing:-2px;user-select:none;flex-shrink:0}.tbw-visibility-row.reorderable:hover .tbw-visibility-handle{color:var(--tbw-color-fg, #1f2937)}.tbw-visibility-label{display:flex;align-items:center;gap:8px;flex:1;cursor:pointer}.tbw-visibility-row.dragging{opacity:.5;cursor:grabbing}.tbw-visibility-row.drop-before:before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-row.drop-after:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-show-all{margin:8px;padding:8px 12px;border:1px solid var(--tbw-visibility-border, var(--tbw-color-border, #e5e7eb));border-radius:var(--tbw-border-radius, 4px);background:var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg, #f9fafb));color:var(--tbw-color-fg, #1f2937);cursor:pointer;font-size:13px}.tbw-visibility-show-all:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6))}';
4593
+ function De(s) {
4512
4594
  const e = s.meta ?? {};
4513
4595
  return e.lockPosition !== !0 && e.suppressMovable !== !0;
4514
4596
  }
@@ -4683,7 +4765,7 @@ class F extends v {
4683
4765
  const o = t.getAllColumns();
4684
4766
  for (let i = 0; i < o.length; i++) {
4685
4767
  const r = o[i], l = r.header || r.field, a = document.createElement("div");
4686
- a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(i)), n && Ne(r) && (a.draggable = !0, a.classList.add("reorderable"), this.setupDragListeners(a, r.field, i, e));
4768
+ a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(i)), n && De(r) && (a.draggable = !0, a.classList.add("reorderable"), this.setupDragListeners(a, r.field, i, e));
4687
4769
  const d = document.createElement("label");
4688
4770
  d.className = "tbw-visibility-label";
4689
4771
  const c = document.createElement("input");
@@ -4691,7 +4773,7 @@ class F extends v {
4691
4773
  t.toggleColumnVisibility(r.field), setTimeout(() => this.rebuildToggles(e), 0);
4692
4774
  });
4693
4775
  const u = document.createElement("span");
4694
- if (u.textContent = l, d.appendChild(c), d.appendChild(u), n && Ne(r)) {
4776
+ if (u.textContent = l, d.appendChild(c), d.appendChild(u), n && De(r)) {
4695
4777
  const h = document.createElement("span");
4696
4778
  h.className = "tbw-visibility-handle", this.setIcon(h, this.resolveIcon("dragHandle")), h.title = "Drag to reorder", a.appendChild(h);
4697
4779
  }
@@ -4737,51 +4819,43 @@ class F extends v {
4737
4819
  }
4738
4820
  // #endregion
4739
4821
  // #region Styles
4740
- styles = mn;
4822
+ styles = xn;
4741
4823
  // #endregion
4742
4824
  }
4743
4825
  export {
4744
4826
  v as BaseGridPlugin,
4745
- bn as ClipboardPlugin,
4746
- vn as ColumnVirtualizationPlugin,
4747
- xn as ContextMenuPlugin,
4748
- Kn as DEFAULT_ANIMATION_CONFIG,
4749
- Ve as DEFAULT_GRID_ICONS,
4750
- Nn as DGEvents,
4751
- qn as DataGridElement,
4752
- yn as ExportPlugin,
4827
+ Cn as ClipboardPlugin,
4828
+ Rn as ColumnVirtualizationPlugin,
4829
+ Sn as ContextMenuPlugin,
4830
+ Hn as DEFAULT_ANIMATION_CONFIG,
4831
+ Ge as DEFAULT_GRID_ICONS,
4832
+ Vn as DGEvents,
4833
+ On as DataGridElement,
4834
+ kn as ExportPlugin,
4753
4835
  A as FilteringPlugin,
4754
- Dn as FitModeEnum,
4755
- Hn as GridCSSVars,
4756
- Vn as GridClasses,
4757
- On as GridDataAttrs,
4758
- Gn as GridElement,
4759
- Bn as GridSelectors,
4760
- Cn as GroupingColumnsPlugin,
4761
- Rn as GroupingRowsPlugin,
4762
- Sn as MasterDetailPlugin,
4763
- kn as MultiSortPlugin,
4836
+ Gn as FitModeEnum,
4837
+ Bn as GridCSSVars,
4838
+ zn as GridClasses,
4839
+ Wn as GridDataAttrs,
4840
+ $n as GridElement,
4841
+ jn as GridSelectors,
4842
+ En as GroupingColumnsPlugin,
4843
+ An as GroupingRowsPlugin,
4844
+ _n as MasterDetailPlugin,
4845
+ In as MultiSortPlugin,
4764
4846
  N as PLUGIN_QUERIES,
4765
- En as PinnedColumnsPlugin,
4766
- An as PinnedRowsPlugin,
4767
- T as PivotPlugin,
4768
- zn as PluginEvents,
4769
- Wn as PluginManager,
4770
- _n as ReorderPlugin,
4771
- In as SelectionPlugin,
4772
- Ln as ServerSidePlugin,
4773
- Tn as TreePlugin,
4774
- Fn as UndoRedoPlugin,
4847
+ Tn as PinnedColumnsPlugin,
4848
+ Ln as PinnedRowsPlugin,
4849
+ L as PivotPlugin,
4850
+ Un as PluginEvents,
4851
+ Yn as PluginManager,
4852
+ Fn as ReorderPlugin,
4853
+ Mn as SelectionPlugin,
4854
+ Pn as ServerSidePlugin,
4855
+ Kn as TreePlugin,
4856
+ Nn as UndoRedoPlugin,
4775
4857
  F as VisibilityPlugin,
4776
- $n as aggregatorRegistry,
4777
- jn as builtInSort,
4778
- Un as defaultComparator,
4779
- le as getAggregator,
4780
- Oe as getValueAggregator,
4781
- Yn as listAggregators,
4782
- Zn as registerAggregator,
4783
- se as runAggregator,
4784
- Xn as runValueAggregator,
4785
- Jn as unregisterAggregator
4858
+ Zn as builtInSort,
4859
+ Xn as defaultComparator
4786
4860
  };
4787
4861
  //# sourceMappingURL=all.js.map