@toolbox-web/grid 0.0.4 → 0.0.6

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 (64) hide show
  1. package/README.md +24 -0
  2. package/all.d.ts +1709 -135
  3. package/all.js +745 -645
  4. package/all.js.map +1 -1
  5. package/index.d.ts +161 -1
  6. package/index.js +1050 -913
  7. package/index.js.map +1 -1
  8. package/lib/plugins/clipboard/index.js +110 -52
  9. package/lib/plugins/clipboard/index.js.map +1 -1
  10. package/lib/plugins/column-virtualization/index.js +78 -20
  11. package/lib/plugins/column-virtualization/index.js.map +1 -1
  12. package/lib/plugins/context-menu/index.js +163 -95
  13. package/lib/plugins/context-menu/index.js.map +1 -1
  14. package/lib/plugins/export/index.js +93 -35
  15. package/lib/plugins/export/index.js.map +1 -1
  16. package/lib/plugins/filtering/index.js +188 -133
  17. package/lib/plugins/filtering/index.js.map +1 -1
  18. package/lib/plugins/grouping-columns/index.js +69 -11
  19. package/lib/plugins/grouping-columns/index.js.map +1 -1
  20. package/lib/plugins/grouping-rows/index.js +111 -55
  21. package/lib/plugins/grouping-rows/index.js.map +1 -1
  22. package/lib/plugins/master-detail/index.js +196 -51
  23. package/lib/plugins/master-detail/index.js.map +1 -1
  24. package/lib/plugins/multi-sort/index.js +104 -46
  25. package/lib/plugins/multi-sort/index.js.map +1 -1
  26. package/lib/plugins/pinned-columns/index.js +74 -16
  27. package/lib/plugins/pinned-columns/index.js.map +1 -1
  28. package/lib/plugins/pinned-rows/index.js +65 -7
  29. package/lib/plugins/pinned-rows/index.js.map +1 -1
  30. package/lib/plugins/pivot/index.js +117 -59
  31. package/lib/plugins/pivot/index.js.map +1 -1
  32. package/lib/plugins/reorder/index.js +103 -45
  33. package/lib/plugins/reorder/index.js.map +1 -1
  34. package/lib/plugins/selection/index.js +139 -81
  35. package/lib/plugins/selection/index.js.map +1 -1
  36. package/lib/plugins/server-side/index.js +96 -38
  37. package/lib/plugins/server-side/index.js.map +1 -1
  38. package/lib/plugins/tree/index.js +108 -47
  39. package/lib/plugins/tree/index.js.map +1 -1
  40. package/lib/plugins/undo-redo/index.js +70 -12
  41. package/lib/plugins/undo-redo/index.js.map +1 -1
  42. package/lib/plugins/visibility/index.js +82 -24
  43. package/lib/plugins/visibility/index.js.map +1 -1
  44. package/package.json +1 -1
  45. package/umd/grid.all.umd.js +31 -31
  46. package/umd/grid.all.umd.js.map +1 -1
  47. package/umd/grid.umd.js +15 -15
  48. package/umd/grid.umd.js.map +1 -1
  49. package/umd/plugins/context-menu.umd.js +2 -2
  50. package/umd/plugins/context-menu.umd.js.map +1 -1
  51. package/umd/plugins/filtering.umd.js +3 -3
  52. package/umd/plugins/filtering.umd.js.map +1 -1
  53. package/umd/plugins/grouping-rows.umd.js +2 -2
  54. package/umd/plugins/grouping-rows.umd.js.map +1 -1
  55. package/umd/plugins/master-detail.umd.js +2 -2
  56. package/umd/plugins/master-detail.umd.js.map +1 -1
  57. package/umd/plugins/multi-sort.umd.js +1 -1
  58. package/umd/plugins/multi-sort.umd.js.map +1 -1
  59. package/umd/plugins/reorder.umd.js +1 -1
  60. package/umd/plugins/reorder.umd.js.map +1 -1
  61. package/umd/plugins/tree.umd.js +2 -2
  62. package/umd/plugins/tree.umd.js.map +1 -1
  63. package/umd/plugins/visibility.umd.js +1 -1
  64. package/umd/plugins/visibility.umd.js.map +1 -1
package/index.js CHANGED
@@ -9,84 +9,92 @@ function be(o) {
9
9
  function ae(o, e) {
10
10
  const t = o._columns, n = be(o);
11
11
  return {
12
- columns: t.map((s, i) => {
13
- const l = {
14
- field: s.field,
15
- order: i,
12
+ columns: t.map((i, s) => {
13
+ const r = {
14
+ field: i.field,
15
+ order: s,
16
16
  visible: !0
17
17
  // If it's in _columns, it's visible (hidden columns are filtered out)
18
- }, r = s;
19
- r.__renderedWidth !== void 0 ? l.width = r.__renderedWidth : s.width !== void 0 && (l.width = typeof s.width == "string" ? parseFloat(s.width) : s.width);
20
- const a = n.get(s.field);
21
- a && (l.sort = a);
18
+ }, a = i;
19
+ a.__renderedWidth !== void 0 ? r.width = a.__renderedWidth : i.width !== void 0 && (r.width = typeof i.width == "string" ? parseFloat(i.width) : i.width);
20
+ const l = n.get(i.field);
21
+ l && (r.sort = l);
22
22
  for (const f of e)
23
23
  if (f.getColumnState) {
24
- const p = f.getColumnState(s.field);
25
- p && Object.assign(l, p);
24
+ const p = f.getColumnState(i.field);
25
+ p && Object.assign(r, p);
26
26
  }
27
- return l;
27
+ return r;
28
28
  })
29
29
  };
30
30
  }
31
- function ge(o, e, t, n) {
31
+ function me(o, e, t, n) {
32
32
  if (!e.columns || e.columns.length === 0) return;
33
- const s = new Map(e.columns.map((r) => [r.field, r])), i = t.map((r) => {
34
- const a = s.get(r.field);
35
- if (!a) return r;
36
- const f = { ...r };
37
- return a.width !== void 0 && (f.width = a.width, f.__renderedWidth = a.width), a.visible !== void 0 && (f.hidden = !a.visible), f;
33
+ const i = new Map(e.columns.map((a) => [a.field, a])), s = t.map((a) => {
34
+ const l = i.get(a.field);
35
+ if (!l) return a;
36
+ const f = { ...a };
37
+ return l.width !== void 0 && (f.width = l.width, f.__renderedWidth = l.width), l.visible !== void 0 && (f.hidden = !l.visible), f;
38
38
  });
39
- i.sort((r, a) => {
40
- const f = s.get(r.field)?.order ?? 1 / 0, p = s.get(a.field)?.order ?? 1 / 0;
39
+ s.sort((a, l) => {
40
+ const f = i.get(a.field)?.order ?? 1 / 0, p = i.get(l.field)?.order ?? 1 / 0;
41
41
  return f - p;
42
- }), o._columns = i;
43
- const l = e.columns.filter((r) => r.sort !== void 0).sort((r, a) => (r.sort?.priority ?? 0) - (a.sort?.priority ?? 0));
44
- if (l.length > 0) {
45
- const r = l[0];
46
- r.sort && (o.sortState = {
47
- field: r.field,
48
- direction: r.sort.direction === "asc" ? 1 : -1
42
+ }), o._columns = s;
43
+ const r = e.columns.filter((a) => a.sort !== void 0).sort((a, l) => (a.sort?.priority ?? 0) - (l.sort?.priority ?? 0));
44
+ if (r.length > 0) {
45
+ const a = r[0];
46
+ a.sort && (o.sortState = {
47
+ field: a.field,
48
+ direction: a.sort.direction === "asc" ? 1 : -1
49
49
  });
50
50
  } else
51
51
  o.sortState = null;
52
- for (const r of n)
53
- if (r.applyColumnState)
54
- for (const a of e.columns)
55
- r.applyColumnState(a.field, a);
52
+ for (const a of n)
53
+ if (a.applyColumnState)
54
+ for (const l of e.columns)
55
+ a.applyColumnState(l.field, l);
56
56
  }
57
- function me(o, e, t) {
57
+ function ve(o, e, t) {
58
58
  let n = null;
59
59
  return () => {
60
60
  n !== null && clearTimeout(n), n = setTimeout(() => {
61
61
  n = null;
62
- const s = ae(o, e());
63
- t(s);
62
+ const i = ae(o, e());
63
+ t(i);
64
64
  }, 100);
65
65
  };
66
66
  }
67
- const O = {
67
+ const M = {
68
68
  STRETCH: "stretch",
69
69
  FIXED: "fixed"
70
+ }, ce = {
71
+ expand: "▶",
72
+ collapse: "▼",
73
+ sortAsc: "▲",
74
+ sortDesc: "▼",
75
+ sortNone: "⇅",
76
+ submenuArrow: "▶",
77
+ dragHandle: "⋮⋮"
70
78
  };
71
- function ve(o) {
79
+ function Ce(o) {
72
80
  return o == null ? "string" : typeof o == "number" ? "number" : typeof o == "boolean" ? "boolean" : o instanceof Date || typeof o == "string" && /\d{4}-\d{2}-\d{2}/.test(o) && !isNaN(Date.parse(o)) ? "date" : "string";
73
81
  }
74
- function ce(o, e) {
82
+ function de(o, e) {
75
83
  if (e && e.length) {
76
- const i = {};
77
- return e.forEach((l) => {
78
- l.type && (i[l.field] = l.type);
79
- }), { columns: e, typeMap: i };
80
- }
81
- const t = o[0] || {}, n = Object.keys(t).map((i) => {
82
- const l = t[i], r = ve(l);
83
- return { field: i, header: i.charAt(0).toUpperCase() + i.slice(1), type: r };
84
- }), s = {};
85
- return n.forEach((i) => {
86
- s[i.field] = i.type || "string";
87
- }), { columns: n, typeMap: s };
88
- }
89
- const Ce = /{{\s*([^}]+)\s*}}/g, R = "__DG_EMPTY__", ye = /^[\w$. '?+\-*/%:()!<>=,&|]+$/, Ee = /__(proto|defineGetter|defineSetter)|constructor|window|globalThis|global|process|Function|import|eval|Reflect|Proxy|Error|arguments|document|location|cookie|localStorage|sessionStorage|indexedDB|fetch|XMLHttpRequest|WebSocket|Worker|SharedWorker|ServiceWorker|opener|parent|top|frames|self|this\b/, Re = /* @__PURE__ */ new Set([
84
+ const s = {};
85
+ return e.forEach((r) => {
86
+ r.type && (s[r.field] = r.type);
87
+ }), { columns: e, typeMap: s };
88
+ }
89
+ const t = o[0] || {}, n = Object.keys(t).map((s) => {
90
+ const r = t[s], a = Ce(r);
91
+ return { field: s, header: s.charAt(0).toUpperCase() + s.slice(1), type: a };
92
+ }), i = {};
93
+ return n.forEach((s) => {
94
+ i[s.field] = s.type || "string";
95
+ }), { columns: n, typeMap: i };
96
+ }
97
+ const Ee = /{{\s*([^}]+)\s*}}/g, A = "__DG_EMPTY__", ye = /^[\w$. '?+\-*/%:()!<>=,&|]+$/, Re = /__(proto|defineGetter|defineSetter)|constructor|window|globalThis|global|process|Function|import|eval|Reflect|Proxy|Error|arguments|document|location|cookie|localStorage|sessionStorage|indexedDB|fetch|XMLHttpRequest|WebSocket|Worker|SharedWorker|ServiceWorker|opener|parent|top|frames|self|this\b/, _e = /* @__PURE__ */ new Set([
90
98
  "script",
91
99
  "iframe",
92
100
  "object",
@@ -111,76 +119,76 @@ const Ce = /{{\s*([^}]+)\s*}}/g, R = "__DG_EMPTY__", ye = /^[\w$. '?+\-*/%:()!<>
111
119
  "plaintext",
112
120
  "xmp",
113
121
  "listing"
114
- ]), U = /^on\w+$/i, _e = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "srcdoc", "xlink:href", "poster", "srcset"]), Ae = /^\s*(javascript|vbscript|data|blob):/i;
115
- function N(o) {
122
+ ]), U = /^on\w+$/i, Ae = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "srcdoc", "xlink:href", "poster", "srcset"]), Se = /^\s*(javascript|vbscript|data|blob):/i;
123
+ function z(o) {
116
124
  if (!o || typeof o != "string") return "";
117
125
  if (o.indexOf("<") === -1) return o;
118
126
  const e = document.createElement("template");
119
- return e.innerHTML = o, Se(e.content), e.innerHTML;
127
+ return e.innerHTML = o, xe(e.content), e.innerHTML;
120
128
  }
121
- function Se(o) {
129
+ function xe(o) {
122
130
  const e = [], t = o.querySelectorAll("*");
123
131
  for (const n of t) {
124
- const s = n.tagName.toLowerCase();
125
- if (Re.has(s)) {
132
+ const i = n.tagName.toLowerCase();
133
+ if (_e.has(i)) {
126
134
  e.push(n);
127
135
  continue;
128
136
  }
129
- if ((s === "svg" || n.namespaceURI === "http://www.w3.org/2000/svg") && Array.from(n.attributes).some(
130
- (r) => U.test(r.name) || r.name === "href" || r.name === "xlink:href"
137
+ if ((i === "svg" || n.namespaceURI === "http://www.w3.org/2000/svg") && Array.from(n.attributes).some(
138
+ (a) => U.test(a.name) || a.name === "href" || a.name === "xlink:href"
131
139
  )) {
132
140
  e.push(n);
133
141
  continue;
134
142
  }
135
- const i = [];
136
- for (const l of n.attributes) {
137
- const r = l.name.toLowerCase();
138
- if (U.test(r)) {
139
- i.push(l.name);
143
+ const s = [];
144
+ for (const r of n.attributes) {
145
+ const a = r.name.toLowerCase();
146
+ if (U.test(a)) {
147
+ s.push(r.name);
140
148
  continue;
141
149
  }
142
- if (_e.has(r) && Ae.test(l.value)) {
143
- i.push(l.name);
150
+ if (Ae.has(a) && Se.test(r.value)) {
151
+ s.push(r.name);
144
152
  continue;
145
153
  }
146
- if (r === "style" && /expression\s*\(|javascript:|behavior\s*:/i.test(l.value)) {
147
- i.push(l.name);
154
+ if (a === "style" && /expression\s*\(|javascript:|behavior\s*:/i.test(r.value)) {
155
+ s.push(r.name);
148
156
  continue;
149
157
  }
150
158
  }
151
- i.forEach((l) => n.removeAttribute(l));
159
+ s.forEach((r) => n.removeAttribute(r));
152
160
  }
153
161
  e.forEach((n) => n.remove());
154
162
  }
155
- function de(o, e) {
163
+ function he(o, e) {
156
164
  if (!o || o.indexOf("{{") === -1) return o;
157
- const t = [], n = o.replace(Ce, (r, a) => {
158
- const f = xe(a, e);
159
- return t.push({ expr: a.trim(), result: f }), f;
160
- }), s = Te(n), i = t.length && t.every((r) => r.result === "" || r.result === R);
161
- return /Reflect\.|\bProxy\b|ownKeys\(/.test(o) || i ? "" : s;
162
- }
163
- function xe(o, e) {
164
- if (o = (o || "").trim(), !o || /\b(Reflect|Proxy|ownKeys)\b/.test(o)) return R;
165
- if (o === "value") return e.value == null ? R : String(e.value);
165
+ const t = [], n = o.replace(Ee, (a, l) => {
166
+ const f = Te(l, e);
167
+ return t.push({ expr: l.trim(), result: f }), f;
168
+ }), i = Le(n), s = t.length && t.every((a) => a.result === "" || a.result === A);
169
+ return /Reflect\.|\bProxy\b|ownKeys\(/.test(o) || s ? "" : i;
170
+ }
171
+ function Te(o, e) {
172
+ if (o = (o || "").trim(), !o || /\b(Reflect|Proxy|ownKeys)\b/.test(o)) return A;
173
+ if (o === "value") return e.value == null ? A : String(e.value);
166
174
  if (o.startsWith("row.") && !/[()?]/.test(o) && !o.includes(":")) {
167
- const n = o.slice(4), s = e.row ? e.row[n] : void 0;
168
- return s == null ? R : String(s);
175
+ const n = o.slice(4), i = e.row ? e.row[n] : void 0;
176
+ return i == null ? A : String(i);
169
177
  }
170
- if (o.length > 80 || !ye.test(o) || Ee.test(o)) return R;
178
+ if (o.length > 80 || !ye.test(o) || Re.test(o)) return A;
171
179
  const t = o.match(/\./g);
172
- if (t && t.length > 1) return R;
180
+ if (t && t.length > 1) return A;
173
181
  try {
174
- const s = new Function("value", "row", `return (${o});`)(e.value, e.row), i = s == null ? "" : String(s);
175
- return /Reflect|Proxy|ownKeys/.test(i) ? R : i || R;
182
+ const i = new Function("value", "row", `return (${o});`)(e.value, e.row), s = i == null ? "" : String(i);
183
+ return /Reflect|Proxy|ownKeys/.test(s) ? A : s || A;
176
184
  } catch {
177
- return R;
185
+ return A;
178
186
  }
179
187
  }
180
- function Te(o) {
181
- return o && o.replace(new RegExp(R, "g"), "").replace(/Reflect\.[^<>{}\s]+/g, "").replace(/\bProxy\b/g, "").replace(/ownKeys\([^)]*\)/g, "");
182
- }
183
188
  function Le(o) {
189
+ return o && o.replace(new RegExp(A, "g"), "").replace(/Reflect\.[^<>{}\s]+/g, "").replace(/\bProxy\b/g, "").replace(/ownKeys\([^)]*\)/g, "");
190
+ }
191
+ function ke(o) {
184
192
  if (/Reflect|Proxy|ownKeys/.test(o.textContent || "")) {
185
193
  if (Array.from(o.childNodes).forEach((e) => {
186
194
  e.nodeType === Node.TEXT_NODE && /Reflect|Proxy|ownKeys/.test(e.textContent || "") && (e.textContent = "");
@@ -193,37 +201,37 @@ function Le(o) {
193
201
  }
194
202
  }
195
203
  function X(o) {
196
- const e = /Reflect\.|\bProxy\b|ownKeys\(/.test(o), t = (n) => e ? "" : de(o, n);
204
+ const e = /Reflect\.|\bProxy\b|ownKeys\(/.test(o), t = (n) => e ? "" : he(o, n);
197
205
  return t.__blocked = e, t;
198
206
  }
199
- function ke(o) {
207
+ function Pe(o) {
200
208
  return Array.from(o.querySelectorAll("tbw-grid-column")).map((t) => {
201
209
  const n = t.getAttribute("field") || "";
202
210
  if (!n) return null;
203
- const s = t.getAttribute("type") || void 0, l = s && (/* @__PURE__ */ new Set(["number", "string", "date", "boolean", "select", "typeahead"])).has(s) ? s : void 0, r = t.getAttribute("header") || void 0, a = t.hasAttribute("sortable"), f = t.hasAttribute("editable"), p = { field: n, type: l, header: r, sortable: a, editable: f };
211
+ const i = t.getAttribute("type") || void 0, r = i && (/* @__PURE__ */ new Set(["number", "string", "date", "boolean", "select", "typeahead"])).has(i) ? i : void 0, a = t.getAttribute("header") || void 0, l = t.hasAttribute("sortable"), f = t.hasAttribute("editable"), p = { field: n, type: r, header: a, sortable: l, editable: f };
204
212
  t.hasAttribute("resizable") && (p.resizable = !0), t.hasAttribute("sizable") && (p.resizable = !0);
205
- const w = t.getAttribute("options");
206
- w && (p.options = w.split(",").map((u) => {
207
- const [b, y] = u.includes(":") ? u.split(":") : [u.trim(), u.trim()];
208
- return { value: b.trim(), label: y?.trim() || b.trim() };
213
+ const g = t.getAttribute("options");
214
+ g && (p.options = g.split(",").map((d) => {
215
+ const [b, m] = d.includes(":") ? d.split(":") : [d.trim(), d.trim()];
216
+ return { value: b.trim(), label: m?.trim() || b.trim() };
209
217
  }));
210
- const h = t.querySelector("tbw-grid-column-view"), c = t.querySelector("tbw-grid-column-editor"), d = t.querySelector("tbw-grid-column-header");
211
- return h && (p.__viewTemplate = h), c && (p.__editorTemplate = c), d && (p.__headerTemplate = d), p;
218
+ const h = t.querySelector("tbw-grid-column-view"), c = t.querySelector("tbw-grid-column-editor"), u = t.querySelector("tbw-grid-column-header");
219
+ return h && (p.__viewTemplate = h), c && (p.__editorTemplate = c), u && (p.__headerTemplate = u), p;
212
220
  }).filter((t) => !!t);
213
221
  }
214
- function Pe(o, e) {
222
+ function Me(o, e) {
215
223
  if ((!o || !o.length) && (!e || !e.length)) return [];
216
224
  if (!o || !o.length) return e || [];
217
225
  if (!e || !e.length) return o;
218
226
  const t = {};
219
- e.forEach((s) => t[s.field] = s);
220
- const n = o.map((s) => {
221
- const i = t[s.field];
222
- if (!i) return s;
223
- const l = { ...s };
224
- return i.header && !l.header && (l.header = i.header), i.type && !l.type && (l.type = i.type), l.sortable = s.sortable || i.sortable, (s.resizable === !0 || i.resizable === !0) && (l.resizable = !0), l.editable = s.editable || i.editable, i.__viewTemplate && (l.__viewTemplate = i.__viewTemplate), i.__editorTemplate && (l.__editorTemplate = i.__editorTemplate), i.__headerTemplate && (l.__headerTemplate = i.__headerTemplate), delete t[s.field], l;
227
+ e.forEach((i) => t[i.field] = i);
228
+ const n = o.map((i) => {
229
+ const s = t[i.field];
230
+ if (!s) return i;
231
+ const r = { ...i };
232
+ return s.header && !r.header && (r.header = s.header), s.type && !r.type && (r.type = s.type), r.sortable = i.sortable || s.sortable, (i.resizable === !0 || s.resizable === !0) && (r.resizable = !0), r.editable = i.editable || s.editable, s.__viewTemplate && (r.__viewTemplate = s.__viewTemplate), s.__editorTemplate && (r.__editorTemplate = s.__editorTemplate), s.__headerTemplate && (r.__headerTemplate = s.__headerTemplate), delete t[i.field], r;
225
233
  });
226
- return Object.keys(t).forEach((s) => n.push(t[s])), n;
234
+ return Object.keys(t).forEach((i) => n.push(t[i])), n;
227
235
  }
228
236
  function B(o, e) {
229
237
  try {
@@ -233,39 +241,39 @@ function B(o, e) {
233
241
  const t = o.getAttribute("part");
234
242
  t ? t.split(/\s+/).includes(e) || o.setAttribute("part", t + " " + e) : o.setAttribute("part", e);
235
243
  }
236
- function Oe(o) {
244
+ function He(o) {
237
245
  o.__lightDomColumnsCache || (o.__originalColumnNodes = Array.from(
238
246
  o.querySelectorAll("tbw-grid-column")
239
- ), o.__lightDomColumnsCache = o.__originalColumnNodes.length ? ke(o) : []);
240
- const e = o.__lightDomColumnsCache, t = Pe(o._columns, e);
241
- t.forEach((s) => {
242
- s.__viewTemplate && !s.__compiledView && (s.__compiledView = X(s.__viewTemplate.innerHTML)), s.__editorTemplate && !s.__compiledEditor && (s.__compiledEditor = X(s.__editorTemplate.innerHTML));
247
+ ), o.__lightDomColumnsCache = o.__originalColumnNodes.length ? Pe(o) : []);
248
+ const e = o.__lightDomColumnsCache, t = Me(o._columns, e);
249
+ t.forEach((i) => {
250
+ i.__viewTemplate && !i.__compiledView && (i.__compiledView = X(i.__viewTemplate.innerHTML)), i.__editorTemplate && !i.__compiledEditor && (i.__compiledEditor = X(i.__editorTemplate.innerHTML));
243
251
  });
244
- const { columns: n } = ce(o._rows, t);
252
+ const { columns: n } = de(o._rows, t);
245
253
  o._columns = n;
246
254
  }
247
- function Me(o) {
248
- const e = o.effectiveConfig?.fitMode || o.fitMode || O.STRETCH;
249
- if (e !== O.STRETCH && e !== O.FIXED || o.__didInitialAutoSize || !o.isConnected) return;
255
+ function Oe(o) {
256
+ const e = o.effectiveConfig?.fitMode || o.fitMode || M.STRETCH;
257
+ if (e !== M.STRETCH && e !== M.FIXED || o.__didInitialAutoSize || !o.isConnected) return;
250
258
  const t = o.headerRowEl?.children || [];
251
259
  if (!t.length) return;
252
260
  let n = !1;
253
- o.visibleColumns.forEach((s, i) => {
254
- if (s.width) return;
255
- const l = t[i];
256
- let r = l ? l.scrollWidth : 0;
257
- for (const a of o.rowPool) {
258
- const f = a.children[i];
261
+ o.visibleColumns.forEach((i, s) => {
262
+ if (i.width) return;
263
+ const r = t[s];
264
+ let a = r ? r.scrollWidth : 0;
265
+ for (const l of o.rowPool) {
266
+ const f = l.children[s];
259
267
  if (f) {
260
268
  const p = f.scrollWidth;
261
- p > r && (r = p);
269
+ p > a && (a = p);
262
270
  }
263
271
  }
264
- r > 0 && (s.width = r + 2, s.__autoSized = !0, n = !0);
265
- }), n && he(o), o.__didInitialAutoSize = !0;
272
+ a > 0 && (i.width = a + 2, i.__autoSized = !0, n = !0);
273
+ }), n && ue(o), o.__didInitialAutoSize = !0;
266
274
  }
267
- function he(o) {
268
- (o.effectiveConfig?.fitMode || o.fitMode || O.STRETCH) === O.STRETCH ? o.gridTemplate = o.visibleColumns.map((t) => {
275
+ function ue(o) {
276
+ (o.effectiveConfig?.fitMode || o.fitMode || M.STRETCH) === M.STRETCH ? o.gridTemplate = o.visibleColumns.map((t) => {
269
277
  if (t.width) return `${t.width}px`;
270
278
  const n = t.minWidth;
271
279
  return n != null ? `minmax(${n}px, 1fr)` : "1fr";
@@ -296,21 +304,21 @@ function De(o) {
296
304
  case "typeahead":
297
305
  return (e) => {
298
306
  const t = document.createElement("select");
299
- e.column.multi && (t.multiple = !0), (typeof e.column.options == "function" ? e.column.options() : e.column.options || []).forEach((i) => {
300
- const l = document.createElement("option");
301
- l.value = String(i.value), l.textContent = i.label, (e.column.multi && Array.isArray(e.value) && e.value.includes(i.value) || !e.column.multi && e.value === i.value) && (l.selected = !0), t.appendChild(l);
307
+ e.column.multi && (t.multiple = !0), (typeof e.column.options == "function" ? e.column.options() : e.column.options || []).forEach((s) => {
308
+ const r = document.createElement("option");
309
+ r.value = String(s.value), r.textContent = s.label, (e.column.multi && Array.isArray(e.value) && e.value.includes(s.value) || !e.column.multi && e.value === s.value) && (r.selected = !0), t.appendChild(r);
302
310
  });
303
- const s = () => {
311
+ const i = () => {
304
312
  if (e.column.multi) {
305
- const i = [];
306
- Array.from(t.selectedOptions).forEach((l) => {
307
- i.push(l.value);
308
- }), e.commit(i);
313
+ const s = [];
314
+ Array.from(t.selectedOptions).forEach((r) => {
315
+ s.push(r.value);
316
+ }), e.commit(s);
309
317
  } else
310
318
  e.commit(t.value);
311
319
  };
312
- return t.addEventListener("change", s), t.addEventListener("blur", s), t.addEventListener("keydown", (i) => {
313
- i.key === "Escape" && e.cancel();
320
+ return t.addEventListener("change", i), t.addEventListener("blur", i), t.addEventListener("keydown", (s) => {
321
+ s.key === "Escape" && e.cancel();
314
322
  }), t.focus(), t;
315
323
  };
316
324
  default:
@@ -322,25 +330,25 @@ function De(o) {
322
330
  };
323
331
  }
324
332
  }
325
- function He(o, e) {
333
+ function ze(o, e) {
326
334
  if (o.dispatchKeyDown?.(e))
327
335
  return;
328
- const t = o._rows.length - 1, n = o.visibleColumns.length - 1, s = o.activeEditRows !== void 0 && o.activeEditRows !== -1, l = o.visibleColumns[o.focusCol]?.type, r = e.composedPath ? e.composedPath() : [], a = r && r.length ? r[0] : e.target, f = (p) => {
336
+ const t = o._rows.length - 1, n = o.visibleColumns.length - 1, i = o.activeEditRows !== void 0 && o.activeEditRows !== -1, r = o.visibleColumns[o.focusCol]?.type, a = e.composedPath ? e.composedPath() : [], l = a && a.length ? a[0] : e.target, f = (p) => {
329
337
  if (!p) return !1;
330
- const w = p.tagName;
331
- return !!(w === "INPUT" || w === "SELECT" || w === "TEXTAREA" || p.isContentEditable);
338
+ const g = p.tagName;
339
+ return !!(g === "INPUT" || g === "SELECT" || g === "TEXTAREA" || p.isContentEditable);
332
340
  };
333
- if (!(f(a) && (e.key === "Home" || e.key === "End")) && !(f(a) && (e.key === "ArrowUp" || e.key === "ArrowDown") && a.tagName === "INPUT" && a.type === "number") && !(s && (l === "select" || l === "typeahead") && (e.key === "ArrowDown" || e.key === "ArrowUp"))) {
341
+ if (!(f(l) && (e.key === "Home" || e.key === "End")) && !(f(l) && (e.key === "ArrowUp" || e.key === "ArrowDown") && l.tagName === "INPUT" && l.type === "number") && !(i && (r === "select" || r === "typeahead") && (e.key === "ArrowDown" || e.key === "ArrowUp"))) {
334
342
  switch (e.key) {
335
343
  case "Tab": {
336
- e.preventDefault(), !e.shiftKey ? o.focusCol < n ? o.focusCol += 1 : (typeof o.commitActiveRowEdit == "function" && o.commitActiveRowEdit(), o.focusRow < t && (o.focusRow += 1, o.focusCol = 0)) : o.focusCol > 0 ? o.focusCol -= 1 : o.focusRow > 0 && (typeof o.commitActiveRowEdit == "function" && o.activeEditRows === o.focusRow && o.commitActiveRowEdit(), o.focusRow -= 1, o.focusCol = n), M(o);
344
+ e.preventDefault(), !e.shiftKey ? o.focusCol < n ? o.focusCol += 1 : (typeof o.commitActiveRowEdit == "function" && o.commitActiveRowEdit(), o.focusRow < t && (o.focusRow += 1, o.focusCol = 0)) : o.focusCol > 0 ? o.focusCol -= 1 : o.focusRow > 0 && (typeof o.commitActiveRowEdit == "function" && o.activeEditRows === o.focusRow && o.commitActiveRowEdit(), o.focusRow -= 1, o.focusCol = n), H(o);
337
345
  return;
338
346
  }
339
347
  case "ArrowDown":
340
- s && typeof o.commitActiveRowEdit == "function" && o.commitActiveRowEdit(), o.focusRow = Math.min(t, o.focusRow + 1), e.preventDefault();
348
+ i && typeof o.commitActiveRowEdit == "function" && o.commitActiveRowEdit(), o.focusRow = Math.min(t, o.focusRow + 1), e.preventDefault();
341
349
  break;
342
350
  case "ArrowUp":
343
- s && typeof o.commitActiveRowEdit == "function" && o.commitActiveRowEdit(), o.focusRow = Math.max(0, o.focusRow - 1), e.preventDefault();
351
+ i && typeof o.commitActiveRowEdit == "function" && o.commitActiveRowEdit(), o.focusRow = Math.max(0, o.focusRow - 1), e.preventDefault();
344
352
  break;
345
353
  case "ArrowRight":
346
354
  o.focusCol = Math.min(n, o.focusCol + 1), e.preventDefault();
@@ -363,167 +371,173 @@ function He(o, e) {
363
371
  case "Enter":
364
372
  return typeof o.beginBulkEdit == "function" ? o.beginBulkEdit(o.focusRow) : o.dispatchEvent(
365
373
  new CustomEvent("activate-cell", { detail: { row: o.focusRow, col: o.focusCol } })
366
- ), M(o);
374
+ ), H(o);
367
375
  default:
368
376
  return;
369
377
  }
370
- M(o);
378
+ H(o);
371
379
  }
372
380
  }
373
- function M(o) {
381
+ function H(o) {
374
382
  if (o.virtualization?.enabled) {
375
- const { rowHeight: s } = o.virtualization, i = o, l = o.focusRow * s;
376
- l < i.scrollTop ? i.scrollTop = l : l + s > i.scrollTop + i.clientHeight && (i.scrollTop = l - i.clientHeight + s);
383
+ const { rowHeight: i } = o.virtualization, s = o, r = o.focusRow * i;
384
+ r < s.scrollTop ? s.scrollTop = r : r + i > s.scrollTop + s.clientHeight && (s.scrollTop = r - s.clientHeight + i);
377
385
  }
378
- o.refreshVirtualWindow(!1), Array.from(o.bodyEl.querySelectorAll(".cell-focus")).forEach((s) => s.classList.remove("cell-focus")), Array.from(o.bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((s) => {
379
- s.setAttribute("aria-selected", "false");
386
+ o.refreshVirtualWindow(!1), Array.from(o.bodyEl.querySelectorAll(".cell-focus")).forEach((i) => i.classList.remove("cell-focus")), Array.from(o.bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((i) => {
387
+ i.setAttribute("aria-selected", "false");
380
388
  });
381
389
  const e = o.focusRow, t = o.virtualization.start ?? 0, n = o.virtualization.end ?? o._rows.length;
382
390
  if (e >= t && e < n) {
383
- const i = o.bodyEl.querySelectorAll(".data-grid-row")[e - t]?.children[o.focusCol];
384
- if (i) {
385
- if (i.classList.add("cell-focus"), i.setAttribute("aria-selected", "true"), o.activeEditRows !== void 0 && o.activeEditRows !== -1 && i.classList.contains("editing")) {
386
- const l = i.querySelector(
391
+ const s = o.bodyEl.querySelectorAll(".data-grid-row")[e - t]?.children[o.focusCol];
392
+ if (s) {
393
+ if (s.classList.add("cell-focus"), s.setAttribute("aria-selected", "true"), o.activeEditRows !== void 0 && o.activeEditRows !== -1 && s.classList.contains("editing")) {
394
+ const r = s.querySelector(
387
395
  'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])'
388
396
  );
389
- if (l && document.activeElement !== l)
397
+ if (r && document.activeElement !== r)
390
398
  try {
391
- l.focus();
399
+ r.focus();
392
400
  } catch {
393
401
  }
394
- } else if (!i.contains(document.activeElement)) {
395
- i.hasAttribute("tabindex") || i.setAttribute("tabindex", "-1");
402
+ } else if (!s.contains(document.activeElement)) {
403
+ s.hasAttribute("tabindex") || s.setAttribute("tabindex", "-1");
396
404
  try {
397
- i.focus({ preventScroll: !0 });
405
+ s.focus({ preventScroll: !0 });
398
406
  } catch {
399
407
  }
400
408
  }
401
409
  }
402
410
  }
403
411
  }
404
- const ze = "__cellDisplayCache", Ne = "__cellCacheEpoch";
412
+ const Ne = "__cellDisplayCache", Ie = "__cellCacheEpoch";
405
413
  function j(o) {
406
- o[ze] = void 0, o[Ne] = void 0, o.__hasSpecialColumns = void 0;
414
+ o[Ne] = void 0, o[Ie] = void 0, o.__hasSpecialColumns = void 0;
407
415
  }
408
- function qe(o, e, t, n, s) {
409
- const i = Math.max(0, t - e), l = o.bodyEl, r = o.visibleColumns, a = r.length;
416
+ function qe(o, e, t, n, i) {
417
+ const s = Math.max(0, t - e), r = o.bodyEl, a = o.visibleColumns, l = a.length;
410
418
  let f = o.__cachedHeaderRowCount;
411
- for (f === void 0 && (f = o.shadowRoot?.querySelector(".header-group-row") ? 2 : 1, o.__cachedHeaderRowCount = f); o.rowPool.length < i; ) {
412
- const w = document.createElement("div");
413
- w.className = "data-grid-row", w.setAttribute("role", "row"), w.addEventListener("click", (h) => Z(o, h, w, !1)), w.addEventListener("dblclick", (h) => Z(o, h, w, !0)), o.rowPool.push(w);
414
- }
415
- if (o.rowPool.length > i) {
416
- for (let w = i; w < o.rowPool.length; w++) {
417
- const h = o.rowPool[w];
418
- h.parentNode === l && h.remove();
419
- }
420
- o.rowPool.length = i;
421
- }
422
- const p = s && o.__hasRenderRowPlugins !== !1;
423
- for (let w = 0; w < i; w++) {
424
- const h = e + w, c = o._rows[h], d = o.rowPool[w];
425
- if (d.setAttribute("aria-rowindex", String(h + f + 1)), p && s(c, d, h)) {
426
- d.__epoch = n, d.__rowDataRef = c, d.parentNode !== l && l.appendChild(d);
419
+ for (f === void 0 && (f = o.shadowRoot?.querySelector(".header-group-row") ? 2 : 1, o.__cachedHeaderRowCount = f); o.rowPool.length < s; ) {
420
+ const g = document.createElement("div");
421
+ g.className = "data-grid-row", g.setAttribute("role", "row"), g.addEventListener("click", (h) => Z(o, h, g, !1)), g.addEventListener("dblclick", (h) => Z(o, h, g, !0)), o.rowPool.push(g);
422
+ }
423
+ if (o.rowPool.length > s) {
424
+ for (let g = s; g < o.rowPool.length; g++) {
425
+ const h = o.rowPool[g];
426
+ h.parentNode === r && h.remove();
427
+ }
428
+ o.rowPool.length = s;
429
+ }
430
+ const p = i && o.__hasRenderRowPlugins !== !1;
431
+ for (let g = 0; g < s; g++) {
432
+ const h = e + g, c = o._rows[h], u = o.rowPool[g];
433
+ if (u.setAttribute("aria-rowindex", String(h + f + 1)), p && i(c, u, h)) {
434
+ u.__epoch = n, u.__rowDataRef = c, u.parentNode !== r && r.appendChild(u);
427
435
  continue;
428
436
  }
429
- const u = d.__epoch, b = d.__rowDataRef, y = d.children.length, E = u === n && y === a, _ = b !== c;
430
- let x = !1;
431
- if (E && _) {
432
- for (let A = 0; A < a; A++)
433
- if (r[A].externalView && !d.querySelector(`.cell[data-col="${A}"] [data-external-view]`)) {
434
- x = !0;
437
+ const d = u.__epoch, b = u.__rowDataRef, m = u.children.length, R = d === n && m === l, E = b !== c;
438
+ let _ = !1;
439
+ if (R && E) {
440
+ for (let S = 0; S < l; S++)
441
+ if (a[S].externalView && !u.querySelector(`.cell[data-col="${S}"] [data-external-view]`)) {
442
+ _ = !0;
435
443
  break;
436
444
  }
437
445
  }
438
- !E || x ? (d.__isCustomRow && (d.className = "data-grid-row", d.setAttribute("role", "row"), d.__isCustomRow = !1), F(o, d, c, h), d.__epoch = n, d.__rowDataRef = c) : _ ? (Y(o, d, c, h), d.__rowDataRef = c) : Y(o, d, c, h);
439
- const g = o._changedRowIndices.has(h), m = d.classList.contains("changed");
440
- g !== m && d.classList.toggle("changed", g), d.parentNode !== l && l.appendChild(d);
446
+ !R || _ ? (u.__isCustomRow && (u.className = "data-grid-row", u.setAttribute("role", "row"), u.__isCustomRow = !1), F(o, u, c, h), u.__epoch = n, u.__rowDataRef = c) : E ? (Y(o, u, c, h), u.__rowDataRef = c) : Y(o, u, c, h);
447
+ const w = o._changedRowIndices.has(h), v = u.classList.contains("changed");
448
+ w !== v && u.classList.toggle("changed", w), u.parentNode !== r && r.appendChild(u);
441
449
  }
442
450
  }
443
451
  function Y(o, e, t, n) {
444
- const s = e.children, i = o.visibleColumns, l = i.length, r = s.length, a = l < r ? l : r, f = o.focusRow, p = o.focusCol;
445
- let w = o.__hasSpecialColumns;
446
- if (w === void 0) {
447
- w = !1;
448
- for (let c = 0; c < l; c++) {
449
- const d = i[c];
450
- if (d.__viewTemplate || d.__compiledView || d.viewRenderer || d.externalView || d.format || d.type === "date" || d.type === "boolean") {
451
- w = !0;
452
+ const i = e.children, s = o.visibleColumns, r = s.length, a = i.length, l = r < a ? r : a, f = o.focusRow, p = o.focusCol;
453
+ let g = o.__hasSpecialColumns;
454
+ if (g === void 0) {
455
+ g = !1;
456
+ for (let c = 0; c < r; c++) {
457
+ const u = s[c];
458
+ if (u.__viewTemplate || u.__compiledView || u.viewRenderer || u.externalView || u.format || u.type === "date" || u.type === "boolean") {
459
+ g = !0;
452
460
  break;
453
461
  }
454
462
  }
455
- o.__hasSpecialColumns = w;
463
+ o.__hasSpecialColumns = g;
456
464
  }
457
465
  const h = String(n);
458
- if (!w) {
459
- for (let c = 0; c < a; c++) {
460
- const d = s[c], u = t[i[c].field];
461
- d.textContent = u == null ? "" : String(u), d.getAttribute("data-row") !== h && d.setAttribute("data-row", h);
462
- const b = f === n && p === c, y = d.classList.contains("cell-focus");
463
- b !== y && (d.classList.toggle("cell-focus", b), d.setAttribute("aria-selected", String(b)));
466
+ if (!g) {
467
+ for (let c = 0; c < l; c++) {
468
+ const u = i[c], d = t[s[c].field];
469
+ u.textContent = d == null ? "" : String(d), u.getAttribute("data-row") !== h && u.setAttribute("data-row", h);
470
+ const b = f === n && p === c, m = u.classList.contains("cell-focus");
471
+ b !== m && (u.classList.toggle("cell-focus", b), u.setAttribute("aria-selected", String(b)));
464
472
  }
465
473
  return;
466
474
  }
467
- for (let c = 0; c < a; c++)
468
- if (i[c].externalView && !s[c].querySelector("[data-external-view]")) {
475
+ for (let c = 0; c < l; c++)
476
+ if (s[c].externalView && !i[c].querySelector("[data-external-view]")) {
469
477
  F(o, e, t, n);
470
478
  return;
471
479
  }
472
- for (let c = 0; c < a; c++) {
473
- const d = i[c], u = s[c];
474
- u.getAttribute("data-row") !== h && u.setAttribute("data-row", h);
475
- const b = f === n && p === c, y = u.classList.contains("cell-focus");
476
- if (b !== y && (u.classList.toggle("cell-focus", b), u.setAttribute("aria-selected", String(b))), u.classList.contains("editing") || d.__viewTemplate || d.__compiledView || d.viewRenderer || d.externalView)
480
+ for (let c = 0; c < l; c++) {
481
+ const u = s[c], d = i[c];
482
+ d.getAttribute("data-row") !== h && d.setAttribute("data-row", h);
483
+ const b = f === n && p === c, m = d.classList.contains("cell-focus");
484
+ if (b !== m && (d.classList.toggle("cell-focus", b), d.setAttribute("aria-selected", String(b))), d.classList.contains("editing")) continue;
485
+ if (u.viewRenderer) {
486
+ const E = t[u.field], _ = u.viewRenderer({ row: t, value: E, field: u.field, column: u });
487
+ typeof _ == "string" ? d.innerHTML = z(_) : _ ? (d.innerHTML = "", d.appendChild(_)) : d.textContent = E == null ? "" : String(E);
477
488
  continue;
478
- const v = t[d.field];
479
- let E;
480
- if (d.format)
489
+ }
490
+ if (u.__viewTemplate || u.__compiledView || u.externalView)
491
+ continue;
492
+ const C = t[u.field];
493
+ let R;
494
+ if (u.format)
481
495
  try {
482
- const _ = d.format(v, t);
483
- E = _ == null ? "" : String(_);
496
+ const E = u.format(C, t);
497
+ R = E == null ? "" : String(E);
484
498
  } catch {
485
- E = v == null ? "" : String(v);
499
+ R = C == null ? "" : String(C);
486
500
  }
487
- else if (d.type === "date")
488
- if (v == null || v === "")
489
- E = "";
490
- else if (v instanceof Date)
491
- E = isNaN(v.getTime()) ? "" : v.toLocaleDateString();
501
+ else if (u.type === "date")
502
+ if (C == null || C === "")
503
+ R = "";
504
+ else if (C instanceof Date)
505
+ R = isNaN(C.getTime()) ? "" : C.toLocaleDateString();
492
506
  else {
493
- const _ = new Date(v);
494
- E = isNaN(_.getTime()) ? "" : _.toLocaleDateString();
507
+ const E = new Date(C);
508
+ R = isNaN(E.getTime()) ? "" : E.toLocaleDateString();
495
509
  }
496
- else d.type === "boolean" ? (E = v ? "🗹" : "☐", u.setAttribute("aria-checked", String(!!v))) : E = v == null ? "" : String(v);
497
- u.textContent = E;
510
+ else u.type === "boolean" ? (R = C ? "🗹" : "☐", d.setAttribute("aria-checked", String(!!C))) : R = C == null ? "" : String(C);
511
+ d.textContent = R;
498
512
  }
499
513
  }
500
514
  function F(o, e, t, n) {
501
515
  e.innerHTML = "";
502
- const s = o.visibleColumns, i = s.length, l = o.focusRow, r = o.focusCol, a = o.effectiveConfig?.editOn || o.editOn, f = o, p = document.createDocumentFragment();
503
- for (let w = 0; w < i; w++) {
504
- const h = s[w], c = document.createElement("div");
505
- c.className = "cell", B(c, "cell"), h.type !== "boolean" && c.setAttribute("role", "gridcell"), c.setAttribute("data-col", String(w)), c.setAttribute("data-row", String(n)), c.setAttribute("aria-colindex", String(w + 1)), h.type && c.setAttribute("data-type", h.type);
506
- const d = h.sticky;
507
- d === "left" ? c.classList.add("sticky-left") : d === "right" && c.classList.add("sticky-right");
508
- let u = t[h.field];
516
+ const i = o.visibleColumns, s = i.length, r = o.focusRow, a = o.focusCol, l = o.effectiveConfig?.editOn || o.editOn, f = o, p = document.createDocumentFragment();
517
+ for (let g = 0; g < s; g++) {
518
+ const h = i[g], c = document.createElement("div");
519
+ c.className = "cell", B(c, "cell"), h.type !== "boolean" && c.setAttribute("role", "gridcell"), c.setAttribute("data-col", String(g)), c.setAttribute("data-row", String(n)), c.setAttribute("aria-colindex", String(g + 1)), h.type && c.setAttribute("data-type", h.type);
520
+ const u = h.sticky;
521
+ u === "left" ? c.classList.add("sticky-left") : u === "right" && c.classList.add("sticky-right");
522
+ let d = t[h.field];
509
523
  const b = h.format;
510
524
  if (b)
511
525
  try {
512
- u = b(u, t);
526
+ d = b(d, t);
513
527
  } catch {
514
528
  }
515
- const y = h.__compiledView, v = h.__viewTemplate, E = h.viewRenderer, _ = h.externalView;
516
- let x = !1;
517
- if (E) {
518
- const g = E({ row: t, value: u, field: h.field, column: h });
519
- typeof g == "string" ? (c.innerHTML = N(g), x = !0) : g ? c.appendChild(g) : c.textContent = u == null ? "" : String(u);
520
- } else if (_) {
521
- const g = _, m = document.createElement("div");
522
- m.setAttribute("data-external-view", ""), m.setAttribute("data-field", h.field), c.appendChild(m);
523
- const A = { row: t, value: u, field: h.field, column: h };
524
- if (g.mount)
529
+ const m = h.__compiledView, C = h.__viewTemplate, R = h.viewRenderer, E = h.externalView;
530
+ let _ = !1;
531
+ if (R) {
532
+ const w = R({ row: t, value: d, field: h.field, column: h });
533
+ typeof w == "string" ? (c.innerHTML = z(w), _ = !0) : w ? c.appendChild(w) : c.textContent = d == null ? "" : String(d);
534
+ } else if (E) {
535
+ const w = E, v = document.createElement("div");
536
+ v.setAttribute("data-external-view", ""), v.setAttribute("data-field", h.field), c.appendChild(v);
537
+ const S = { row: t, value: d, field: h.field, column: h };
538
+ if (w.mount)
525
539
  try {
526
- g.mount({ placeholder: m, context: A, spec: g });
540
+ w.mount({ placeholder: v, context: S, spec: w });
527
541
  } catch {
528
542
  }
529
543
  else
@@ -533,106 +547,106 @@ function F(o, e, t, n) {
533
547
  new CustomEvent("mount-external-view", {
534
548
  bubbles: !0,
535
549
  composed: !0,
536
- detail: { placeholder: m, spec: g, context: A }
550
+ detail: { placeholder: v, spec: w, context: S }
537
551
  })
538
552
  );
539
553
  } catch {
540
554
  }
541
555
  });
542
- m.setAttribute("data-mounted", "");
543
- } else if (y) {
544
- const g = y({ row: t, value: u, field: h.field, column: h }), m = y.__blocked;
545
- c.innerHTML = m ? "" : N(g), x = !0, m && (c.textContent = "", c.setAttribute("data-blocked-template", ""));
546
- } else if (v) {
547
- const g = v.innerHTML;
548
- /Reflect\.|\bProxy\b|ownKeys\(/.test(g) ? (c.textContent = "", c.setAttribute("data-blocked-template", "")) : (c.innerHTML = N(de(g, { row: t, value: u })), x = !0);
556
+ v.setAttribute("data-mounted", "");
557
+ } else if (m) {
558
+ const w = m({ row: t, value: d, field: h.field, column: h }), v = m.__blocked;
559
+ c.innerHTML = v ? "" : z(w), _ = !0, v && (c.textContent = "", c.setAttribute("data-blocked-template", ""));
560
+ } else if (C) {
561
+ const w = C.innerHTML;
562
+ /Reflect\.|\bProxy\b|ownKeys\(/.test(w) ? (c.textContent = "", c.setAttribute("data-blocked-template", "")) : (c.innerHTML = z(he(w, { row: t, value: d })), _ = !0);
549
563
  } else if (h.type === "date")
550
- if (u == null || u === "")
564
+ if (d == null || d === "")
551
565
  c.textContent = "";
552
566
  else {
553
- let g = null;
554
- if (u instanceof Date) g = u;
555
- else if (typeof u == "number" || typeof u == "string") {
556
- const m = new Date(u);
557
- isNaN(m.getTime()) || (g = m);
567
+ let w = null;
568
+ if (d instanceof Date) w = d;
569
+ else if (typeof d == "number" || typeof d == "string") {
570
+ const v = new Date(d);
571
+ isNaN(v.getTime()) || (w = v);
558
572
  }
559
- c.textContent = g ? g.toLocaleDateString() : "";
573
+ c.textContent = w ? w.toLocaleDateString() : "";
560
574
  }
561
575
  else if (h.type === "boolean") {
562
- const g = !!u;
563
- c.innerHTML = g ? "&#x1F5F9;" : "&#9744;", c.setAttribute("role", "checkbox"), c.setAttribute("aria-checked", String(g)), c.setAttribute("aria-label", String(g));
576
+ const w = !!d;
577
+ c.innerHTML = w ? "&#x1F5F9;" : "&#9744;", c.setAttribute("role", "checkbox"), c.setAttribute("aria-checked", String(w)), c.setAttribute("aria-label", String(w));
564
578
  } else
565
- c.textContent = u == null ? "" : String(u);
566
- if (x) {
567
- Le(c);
568
- const g = c.textContent || "";
569
- /Proxy|Reflect\.ownKeys/.test(g) && (c.textContent = g.replace(/Proxy|Reflect\.ownKeys/g, "").trim(), /Proxy|Reflect\.ownKeys/.test(c.textContent || "") && (c.textContent = ""));
579
+ c.textContent = d == null ? "" : String(d);
580
+ if (_) {
581
+ ke(c);
582
+ const w = c.textContent || "";
583
+ /Proxy|Reflect\.ownKeys/.test(w) && (c.textContent = w.replace(/Proxy|Reflect\.ownKeys/g, "").trim(), /Proxy|Reflect\.ownKeys/.test(c.textContent || "") && (c.textContent = ""));
570
584
  }
571
585
  c.hasAttribute("data-blocked-template") && (c.textContent || "").trim().length && (c.textContent = ""), h.editable ? (c.tabIndex = 0, c.addEventListener("mousedown", () => {
572
- o.focusRow = n, o.focusCol = w, M(o);
573
- }), a === "click" ? c.addEventListener("click", (g) => {
574
- c.classList.contains("editing") || (g.stopPropagation(), o.focusRow = n, o.focusCol = w, L(o, t, n, h, c));
575
- }) : c.addEventListener("dblclick", (g) => {
576
- g.stopPropagation(), T(o, n, t);
577
- const m = o.findRenderedRowElement?.(n);
578
- if (m) {
579
- const A = m.children;
580
- for (let k = 0; k < A.length; k++) {
581
- const D = o.visibleColumns[k];
582
- D && D.editable && L(o, t, n, D, A[k]);
586
+ o.focusRow = n, o.focusCol = g, H(o);
587
+ }), l === "click" ? c.addEventListener("click", (w) => {
588
+ c.classList.contains("editing") || (w.stopPropagation(), o.focusRow = n, o.focusCol = g, L(o, t, n, h, c));
589
+ }) : c.addEventListener("dblclick", (w) => {
590
+ w.stopPropagation(), T(o, n, t);
591
+ const v = o.findRenderedRowElement?.(n);
592
+ if (v) {
593
+ const S = v.children;
594
+ for (let k = 0; k < S.length; k++) {
595
+ const O = o.visibleColumns[k];
596
+ O && O.editable && L(o, t, n, O, S[k]);
583
597
  }
584
598
  }
585
- }), c.addEventListener("keydown", (g) => {
586
- if ((h.type === "select" || h.type === "typeahead") && !c.classList.contains("editing") && g.key === "Enter") {
587
- g.preventDefault(), o.activeEditRows !== n && T(o, n, t), L(o, t, n, h, c), setTimeout(() => {
588
- const m = c.querySelector("select");
599
+ }), c.addEventListener("keydown", (w) => {
600
+ if ((h.type === "select" || h.type === "typeahead") && !c.classList.contains("editing") && w.key === "Enter") {
601
+ w.preventDefault(), o.activeEditRows !== n && T(o, n, t), L(o, t, n, h, c), setTimeout(() => {
602
+ const v = c.querySelector("select");
589
603
  try {
590
- m?.showPicker?.();
604
+ v?.showPicker?.();
591
605
  } catch {
592
606
  }
593
- m?.focus();
607
+ v?.focus();
594
608
  }, 0);
595
609
  return;
596
610
  }
597
- if (h.type === "boolean" && g.key === " " && !c.classList.contains("editing")) {
598
- g.preventDefault(), o.activeEditRows !== n && T(o, n, t);
599
- const m = !t[h.field];
600
- $(o, n, h, m, t), c.innerHTML = m ? "&#x1F5F9;" : "&#9744;", c.setAttribute("aria-label", String(!!m));
611
+ if (h.type === "boolean" && w.key === " " && !c.classList.contains("editing")) {
612
+ w.preventDefault(), o.activeEditRows !== n && T(o, n, t);
613
+ const v = !t[h.field];
614
+ $(o, n, h, v, t), c.innerHTML = v ? "&#x1F5F9;" : "&#9744;", c.setAttribute("aria-label", String(!!v));
601
615
  return;
602
616
  }
603
- if (g.key === "Enter" && !c.classList.contains("editing")) {
604
- g.preventDefault(), o.focusRow = n, o.focusCol = w, typeof o.beginBulkEdit == "function" ? o.beginBulkEdit(n) : L(o, t, n, h, c);
617
+ if (w.key === "Enter" && !c.classList.contains("editing")) {
618
+ w.preventDefault(), o.focusRow = n, o.focusCol = g, typeof o.beginBulkEdit == "function" ? o.beginBulkEdit(n) : L(o, t, n, h, c);
605
619
  return;
606
620
  }
607
- if (g.key === "F2" && !c.classList.contains("editing")) {
608
- g.preventDefault(), L(o, t, n, h, c);
621
+ if (w.key === "F2" && !c.classList.contains("editing")) {
622
+ w.preventDefault(), L(o, t, n, h, c);
609
623
  return;
610
624
  }
611
- })) : h.type === "boolean" && (c.hasAttribute("tabindex") || (c.tabIndex = 0), c.addEventListener("keydown", (g) => {
612
- if (g.key === " ") {
613
- g.preventDefault();
614
- const m = !t[h.field];
615
- o.activeEditRows !== n && T(o, n, t), $(o, n, h, m, t), c.innerHTML = m ? "&#x1F5F9;" : "&#9744;", c.setAttribute("role", "checkbox"), c.setAttribute("aria-checked", String(!!m)), c.setAttribute("aria-label", String(!!m));
625
+ })) : h.type === "boolean" && (c.hasAttribute("tabindex") || (c.tabIndex = 0), c.addEventListener("keydown", (w) => {
626
+ if (w.key === " ") {
627
+ w.preventDefault();
628
+ const v = !t[h.field];
629
+ o.activeEditRows !== n && T(o, n, t), $(o, n, h, v, t), c.innerHTML = v ? "&#x1F5F9;" : "&#9744;", c.setAttribute("role", "checkbox"), c.setAttribute("aria-checked", String(!!v)), c.setAttribute("aria-label", String(!!v));
616
630
  }
617
- })), l === n && r === w ? c.setAttribute("aria-selected", "true") : c.setAttribute("aria-selected", "false"), p.appendChild(c);
631
+ })), r === n && a === g ? c.setAttribute("aria-selected", "true") : c.setAttribute("aria-selected", "false"), p.appendChild(c);
618
632
  }
619
633
  e.appendChild(p);
620
634
  }
621
635
  function Z(o, e, t, n) {
622
636
  if (e.target?.closest(".resize-handle")) return;
623
- const s = t.querySelector(".cell[data-row]");
624
- if (!s) return;
625
- const i = Number(s.getAttribute("data-row"));
626
- if (isNaN(i)) return;
627
- const l = o._rows[i];
628
- if (!l) return;
629
- const r = e.target?.closest(".cell[data-col]");
630
- if (r) {
631
- const f = Number(r.getAttribute("data-col"));
637
+ const i = t.querySelector(".cell[data-row]");
638
+ if (!i) return;
639
+ const s = Number(i.getAttribute("data-row"));
640
+ if (isNaN(s)) return;
641
+ const r = o._rows[s];
642
+ if (!r) return;
643
+ const a = e.target?.closest(".cell[data-col]");
644
+ if (a) {
645
+ const f = Number(a.getAttribute("data-col"));
632
646
  if (!isNaN(f)) {
633
- if (o.dispatchCellClick?.(e, i, f, r))
647
+ if (o.dispatchCellClick?.(e, s, f, a))
634
648
  return;
635
- o.focusRow = i, o.focusCol = f, M(o);
649
+ o.focusRow = s, o.focusCol = f, H(o);
636
650
  }
637
651
  }
638
652
  if (t.querySelector(".cell.editing")) {
@@ -640,13 +654,13 @@ function Z(o, e, t, n) {
640
654
  if (!n) return;
641
655
  f.forEach((p) => p.classList.remove("editing"));
642
656
  }
643
- const a = o.effectiveConfig?.editOn || o.editOn || "doubleClick";
644
- if (a === "click" || a === "doubleClick" && n) T(o, i, l);
657
+ const l = o.effectiveConfig?.editOn || o.editOn || "doubleClick";
658
+ if (l === "click" || l === "doubleClick" && n) T(o, s, r);
645
659
  else return;
646
660
  Array.from(t.children).forEach((f, p) => {
647
- const w = o.visibleColumns[p];
648
- w && w.editable && L(o, l, i, w, f);
649
- }), r && queueMicrotask(() => {
661
+ const g = o.visibleColumns[p];
662
+ g && g.editable && L(o, r, s, g, f);
663
+ }), a && queueMicrotask(() => {
650
664
  const f = t.querySelector(`.cell[data-col="${o.focusCol}"]`);
651
665
  if (f?.classList.contains("editing")) {
652
666
  const p = f.querySelector(
@@ -662,19 +676,19 @@ function Z(o, e, t, n) {
662
676
  function T(o, e, t) {
663
677
  o.activeEditRows !== e && (o.rowEditSnapshots.set(e, { ...t }), o.activeEditRows = e);
664
678
  }
665
- function Ie(o, e, t) {
679
+ function Be(o, e, t) {
666
680
  if (o.activeEditRows !== e) return;
667
- const n = o.rowEditSnapshots.get(e), s = o._rows[e];
668
- if (t && n && s)
669
- Object.keys(n).forEach((l) => s[l] = n[l]), o._changedRowIndices.delete(e);
681
+ const n = o.rowEditSnapshots.get(e), i = o._rows[e];
682
+ if (t && n && i)
683
+ Object.keys(n).forEach((r) => i[r] = n[r]), o._changedRowIndices.delete(e);
670
684
  else if (!t) {
671
- const l = o._changedRowIndices.has(e);
685
+ const r = o._changedRowIndices.has(e);
672
686
  o.dispatchEvent(
673
687
  new CustomEvent("row-commit", {
674
688
  detail: {
675
689
  rowIndex: e,
676
- row: s,
677
- changed: l,
690
+ row: i,
691
+ changed: r,
678
692
  changedRows: o.changedRows,
679
693
  changedRowIndices: o.changedRowIndices
680
694
  }
@@ -682,92 +696,92 @@ function Ie(o, e, t) {
682
696
  );
683
697
  }
684
698
  o.rowEditSnapshots.delete(e), o.activeEditRows = -1;
685
- const i = o.findRenderedRowElement?.(e);
686
- i && (F(o, i, o._rows[e], e), o._changedRowIndices.has(e) ? i.classList.add("changed") : i.classList.remove("changed")), t && queueMicrotask(() => {
699
+ const s = o.findRenderedRowElement?.(e);
700
+ s && (F(o, s, o._rows[e], e), o._changedRowIndices.has(e) ? s.classList.add("changed") : s.classList.remove("changed")), t && queueMicrotask(() => {
687
701
  try {
688
702
  o.focus();
689
- const l = o.focusRow, r = o.focusCol, a = o.findRenderedRowElement?.(l);
690
- if (a) {
703
+ const r = o.focusRow, a = o.focusCol, l = o.findRenderedRowElement?.(r);
704
+ if (l) {
691
705
  Array.from(o.bodyEl.querySelectorAll(".cell-focus")).forEach(
692
706
  (p) => p.classList.remove("cell-focus")
693
707
  );
694
- const f = a.querySelector(`.cell[data-row="${l}"][data-col="${r}"]`);
708
+ const f = l.querySelector(`.cell[data-row="${r}"][data-col="${a}"]`);
695
709
  f && f.classList.add("cell-focus");
696
710
  }
697
711
  } catch {
698
712
  }
699
713
  });
700
714
  }
701
- function $(o, e, t, n, s) {
702
- const i = t.field;
703
- if (s[i] === n) return;
704
- s[i] = n;
705
- const r = !o._changedRowIndices.has(e);
715
+ function $(o, e, t, n, i) {
716
+ const s = t.field;
717
+ if (i[s] === n) return;
718
+ i[s] = n;
719
+ const a = !o._changedRowIndices.has(e);
706
720
  o._changedRowIndices.add(e);
707
- const a = o.findRenderedRowElement?.(e);
708
- a && a.classList.add("changed"), o.dispatchEvent(
721
+ const l = o.findRenderedRowElement?.(e);
722
+ l && l.classList.add("changed"), o.dispatchEvent(
709
723
  new CustomEvent("cell-commit", {
710
724
  detail: {
711
- row: s,
712
- field: i,
725
+ row: i,
726
+ field: s,
713
727
  value: n,
714
728
  rowIndex: e,
715
729
  changedRows: o.changedRows,
716
730
  changedRowIndices: o.changedRowIndices,
717
- firstTimeForRow: r
731
+ firstTimeForRow: a
718
732
  }
719
733
  })
720
734
  );
721
735
  }
722
- function L(o, e, t, n, s) {
723
- if (!n.editable || (o.activeEditRows !== t && T(o, t, e), s.classList.contains("editing"))) return;
724
- const i = e[n.field];
725
- s.classList.add("editing");
726
- const l = (h) => {
736
+ function L(o, e, t, n, i) {
737
+ if (!n.editable || (o.activeEditRows !== t && T(o, t, e), i.classList.contains("editing"))) return;
738
+ const s = e[n.field];
739
+ i.classList.add("editing");
740
+ const r = (h) => {
727
741
  $(o, t, n, h, e);
728
- }, r = () => {
729
- e[n.field] = i;
730
- const h = s.querySelector("input,textarea,select");
731
- h && (typeof HTMLInputElement < "u" && h instanceof HTMLInputElement && h.type === "checkbox" ? h.checked = !!i : "value" in h && (h.value = i ?? ""));
732
- }, a = document.createElement("div");
733
- a.style.display = "contents", s.innerHTML = "", s.appendChild(a);
734
- const f = n.__editorTemplate, p = n.editor || (f ? "template" : De(n)), w = i;
742
+ }, a = () => {
743
+ e[n.field] = s;
744
+ const h = i.querySelector("input,textarea,select");
745
+ h && (typeof HTMLInputElement < "u" && h instanceof HTMLInputElement && h.type === "checkbox" ? h.checked = !!s : "value" in h && (h.value = s ?? ""));
746
+ }, l = document.createElement("div");
747
+ l.style.display = "contents", i.innerHTML = "", i.appendChild(l);
748
+ const f = n.__editorTemplate, p = n.editor || (f ? "template" : De(n)), g = s;
735
749
  if (p === "template" && f) {
736
750
  const h = f.cloneNode(!0), c = n.__compiledEditor;
737
- c ? h.innerHTML = c({ row: e, value: i, field: n.field, column: n }) : h.querySelectorAll("*").forEach((u) => {
738
- u.childNodes.length === 1 && u.firstChild?.nodeType === Node.TEXT_NODE && (u.textContent = u.textContent?.replace(/{{\s*value\s*}}/g, i == null ? "" : String(i)).replace(/{{\s*row\.([a-zA-Z0-9_]+)\s*}}/g, (b, y) => {
739
- const v = e[y];
740
- return v == null ? "" : String(v);
751
+ c ? h.innerHTML = c({ row: e, value: s, field: n.field, column: n }) : h.querySelectorAll("*").forEach((d) => {
752
+ d.childNodes.length === 1 && d.firstChild?.nodeType === Node.TEXT_NODE && (d.textContent = d.textContent?.replace(/{{\s*value\s*}}/g, s == null ? "" : String(s)).replace(/{{\s*row\.([a-zA-Z0-9_]+)\s*}}/g, (b, m) => {
753
+ const C = e[m];
754
+ return C == null ? "" : String(C);
741
755
  }) || "");
742
756
  });
743
- const d = h.querySelector("input,textarea,select");
744
- if (d) {
745
- const u = typeof HTMLInputElement < "u";
746
- u && d instanceof HTMLInputElement && d.type === "checkbox" ? d.checked = !!i : "value" in d && (d.value = i ?? ""), d.addEventListener("blur", () => {
747
- const b = u && d instanceof HTMLInputElement && d.type === "checkbox" ? d.checked : d.value;
748
- l(b);
749
- }), d.addEventListener("keydown", (b) => {
757
+ const u = h.querySelector("input,textarea,select");
758
+ if (u) {
759
+ const d = typeof HTMLInputElement < "u";
760
+ d && u instanceof HTMLInputElement && u.type === "checkbox" ? u.checked = !!s : "value" in u && (u.value = s ?? ""), u.addEventListener("blur", () => {
761
+ const b = d && u instanceof HTMLInputElement && u.type === "checkbox" ? u.checked : u.value;
762
+ r(b);
763
+ }), u.addEventListener("keydown", (b) => {
750
764
  if (b.key === "Enter") {
751
- const y = u && d instanceof HTMLInputElement && d.type === "checkbox" ? d.checked : d.value;
752
- l(y);
765
+ const m = d && u instanceof HTMLInputElement && u.type === "checkbox" ? u.checked : u.value;
766
+ r(m);
753
767
  }
754
- b.key === "Escape" && r();
755
- }), u && d instanceof HTMLInputElement && d.type === "checkbox" && d.addEventListener("change", () => {
756
- const b = d.checked;
757
- l(b);
758
- }), setTimeout(() => d.focus(), 0);
768
+ b.key === "Escape" && a();
769
+ }), d && u instanceof HTMLInputElement && u.type === "checkbox" && u.addEventListener("change", () => {
770
+ const b = u.checked;
771
+ r(b);
772
+ }), setTimeout(() => u.focus(), 0);
759
773
  }
760
- a.appendChild(h);
774
+ l.appendChild(h);
761
775
  } else if (typeof p == "string") {
762
776
  const h = document.createElement(p);
763
- h.value = w, h.addEventListener("change", () => l(h.value)), a.appendChild(h);
777
+ h.value = g, h.addEventListener("change", () => r(h.value)), l.appendChild(h);
764
778
  } else if (typeof p == "function") {
765
- const h = p({ row: e, value: w, field: n.field, column: n, commit: l, cancel: r });
766
- typeof h == "string" ? a.innerHTML = h : a.appendChild(h);
779
+ const h = p({ row: e, value: g, field: n.field, column: n, commit: r, cancel: a });
780
+ typeof h == "string" ? l.innerHTML = h : l.appendChild(h);
767
781
  } else if (p && typeof p == "object") {
768
782
  const h = document.createElement("div");
769
- h.setAttribute("data-external-editor", ""), h.setAttribute("data-field", n.field), a.appendChild(h);
770
- const c = { row: e, value: w, field: n.field, column: n, commit: l, cancel: r };
783
+ h.setAttribute("data-external-editor", ""), h.setAttribute("data-field", n.field), l.appendChild(h);
784
+ const c = { row: e, value: g, field: n.field, column: n, commit: r, cancel: a };
771
785
  if (p.mount)
772
786
  try {
773
787
  p.mount({ placeholder: h, context: c, spec: p });
@@ -788,50 +802,53 @@ function J(o, e) {
788
802
  }
789
803
  function Q(o, e, t) {
790
804
  o.sortState = { field: e.field, direction: t };
791
- const n = e.sortComparator || ((s, i) => s == null && i == null ? 0 : s == null ? -1 : i == null || s > i ? 1 : s < i ? -1 : 0);
792
- o._rows.sort((s, i) => n(s[e.field], i[e.field], s, i) * t), o.__rowRenderEpoch++, o.rowPool.forEach((s) => s.__epoch = -1), V(o), o.refreshVirtualWindow(!0), o.dispatchEvent(
805
+ const n = e.sortComparator || ((i, s) => i == null && s == null ? 0 : i == null ? -1 : s == null || i > s ? 1 : i < s ? -1 : 0);
806
+ o._rows.sort((i, s) => n(i[e.field], s[e.field], i, s) * t), o.__rowRenderEpoch++, o.rowPool.forEach((i) => i.__epoch = -1), V(o), o.refreshVirtualWindow(!0), o.dispatchEvent(
793
807
  new CustomEvent("sort-change", { detail: { field: e.field, direction: t } })
794
808
  ), o.requestStateChange?.();
795
809
  }
810
+ function $e(o, e) {
811
+ typeof e == "string" ? o.textContent = e : e instanceof HTMLElement && (o.innerHTML = "", o.appendChild(e.cloneNode(!0)));
812
+ }
796
813
  function V(o) {
797
814
  o.headerRowEl = o.findHeaderRow();
798
815
  const e = o.headerRowEl;
799
816
  e.innerHTML = "", e.setAttribute("role", "row"), e.setAttribute("aria-rowindex", "1"), o.visibleColumns.forEach((t, n) => {
800
- const s = document.createElement("div");
801
- s.className = "cell", B(s, "header-cell"), s.setAttribute("role", "columnheader"), s.setAttribute("aria-colindex", String(n + 1)), s.setAttribute("data-field", t.field), s.setAttribute("data-col", String(n)), t.sticky === "left" ? s.classList.add("sticky-left") : t.sticky === "right" && s.classList.add("sticky-right");
802
- const i = t.__headerTemplate;
803
- if (i) Array.from(i.childNodes).forEach((l) => s.appendChild(l.cloneNode(!0)));
817
+ const i = document.createElement("div");
818
+ i.className = "cell", B(i, "header-cell"), i.setAttribute("role", "columnheader"), i.setAttribute("aria-colindex", String(n + 1)), i.setAttribute("data-field", t.field), i.setAttribute("data-col", String(n)), t.sticky === "left" ? i.classList.add("sticky-left") : t.sticky === "right" && i.classList.add("sticky-right");
819
+ const s = t.__headerTemplate;
820
+ if (s) Array.from(s.childNodes).forEach((r) => i.appendChild(r.cloneNode(!0)));
804
821
  else {
805
- const l = t.header || t.field, r = document.createElement("span");
806
- r.textContent = l, s.appendChild(r);
822
+ const r = t.header || t.field, a = document.createElement("span");
823
+ a.textContent = r, i.appendChild(a);
807
824
  }
808
825
  if (t.sortable) {
809
- s.classList.add("sortable"), s.tabIndex = 0;
810
- const l = document.createElement("span");
811
- B(l, "sort-indicator"), l.style.opacity = "0.6";
812
- const r = o.sortState?.field === t.field ? o.sortState.direction : 0;
813
- l.textContent = r === 1 ? "▲" : r === -1 ? "▼" : "⇅", s.appendChild(l), s.setAttribute("aria-sort", r === 0 ? "none" : r === 1 ? "ascending" : "descending"), s.addEventListener("click", (a) => {
814
- o.resizeController?.isResizing || o.dispatchHeaderClick?.(a, n, s) || J(o, t);
815
- }), s.addEventListener("keydown", (a) => {
816
- if (a.key === "Enter" || a.key === " ") {
817
- if (a.preventDefault(), o.dispatchHeaderClick?.(a, n, s)) return;
826
+ i.classList.add("sortable"), i.tabIndex = 0;
827
+ const r = document.createElement("span");
828
+ B(r, "sort-indicator"), r.style.opacity = "0.6";
829
+ const a = o.sortState?.field === t.field ? o.sortState.direction : 0, l = { ...ce, ...o.icons }, f = a === 1 ? l.sortAsc : a === -1 ? l.sortDesc : l.sortNone;
830
+ $e(r, f), i.appendChild(r), i.setAttribute("aria-sort", a === 0 ? "none" : a === 1 ? "ascending" : "descending"), i.addEventListener("click", (p) => {
831
+ o.resizeController?.isResizing || o.dispatchHeaderClick?.(p, n, i) || J(o, t);
832
+ }), i.addEventListener("keydown", (p) => {
833
+ if (p.key === "Enter" || p.key === " ") {
834
+ if (p.preventDefault(), o.dispatchHeaderClick?.(p, n, i)) return;
818
835
  J(o, t);
819
836
  }
820
837
  });
821
838
  }
822
839
  if (t.resizable) {
823
- t.sticky || (s.style.position = "relative");
824
- const l = document.createElement("div");
825
- l.className = "resize-handle", l.setAttribute("aria-hidden", "true"), l.addEventListener("mousedown", (r) => {
826
- r.stopPropagation(), r.preventDefault(), o.resizeController.start(r, n, s);
827
- }), s.appendChild(l);
840
+ t.sticky || (i.style.position = "relative");
841
+ const r = document.createElement("div");
842
+ r.className = "resize-handle", r.setAttribute("aria-hidden", "true"), r.addEventListener("mousedown", (a) => {
843
+ a.stopPropagation(), a.preventDefault(), o.resizeController.start(a, n, i);
844
+ }), i.appendChild(r);
828
845
  }
829
- e.appendChild(s);
846
+ e.appendChild(i);
830
847
  });
831
848
  try {
832
849
  const t = o.shadowRoot;
833
- t && t.querySelectorAll(".header-group-row .cell").forEach((s) => {
834
- s.getAttribute("data-group") && s.classList.add("grouped");
850
+ t && t.querySelectorAll(".header-group-row .cell").forEach((i) => {
851
+ i.getAttribute("data-group") && i.classList.add("grouped");
835
852
  });
836
853
  } catch {
837
854
  }
@@ -839,39 +856,39 @@ function V(o) {
839
856
  t.getAttribute("aria-sort") || t.setAttribute("aria-sort", "none");
840
857
  });
841
858
  }
842
- function Be(o) {
843
- let e = null, t = null, n = null, s = null;
844
- const i = (a) => {
859
+ function Ke(o) {
860
+ let e = null, t = null, n = null, i = null;
861
+ const s = (l) => {
845
862
  if (!e) return;
846
- const f = a.clientX - e.startX, p = Math.max(40, e.startWidth + f), w = o.visibleColumns[e.colIndex];
847
- w.width = p, w.__userResized = !0, w.__renderedWidth = p, t == null && (t = requestAnimationFrame(() => {
863
+ const f = l.clientX - e.startX, p = Math.max(40, e.startWidth + f), g = o.visibleColumns[e.colIndex];
864
+ g.width = p, g.__userResized = !0, g.__renderedWidth = p, t == null && (t = requestAnimationFrame(() => {
848
865
  t = null, o.updateTemplate?.();
849
866
  })), o.dispatchEvent(
850
- new CustomEvent("column-resize", { detail: { field: w.field, width: p } })
867
+ new CustomEvent("column-resize", { detail: { field: g.field, width: p } })
851
868
  );
852
869
  };
853
- let l = !1;
854
- const r = () => {
855
- const a = e !== null;
856
- a && (l = !0, requestAnimationFrame(() => {
857
- l = !1;
858
- })), window.removeEventListener("mousemove", i), window.removeEventListener("mouseup", r), n !== null && (document.documentElement.style.cursor = n, n = null), s !== null && (document.body.style.userSelect = s, s = null), e = null, a && o.requestStateChange && o.requestStateChange();
870
+ let r = !1;
871
+ const a = () => {
872
+ const l = e !== null;
873
+ l && (r = !0, requestAnimationFrame(() => {
874
+ r = !1;
875
+ })), window.removeEventListener("mousemove", s), window.removeEventListener("mouseup", a), n !== null && (document.documentElement.style.cursor = n, n = null), i !== null && (document.body.style.userSelect = i, i = null), e = null, l && o.requestStateChange && o.requestStateChange();
859
876
  };
860
877
  return {
861
878
  get isResizing() {
862
- return e !== null || l;
879
+ return e !== null || r;
863
880
  },
864
- start(a, f, p) {
865
- a.preventDefault();
866
- const w = p.getBoundingClientRect();
867
- e = { startX: a.clientX, colIndex: f, startWidth: w.width }, window.addEventListener("mousemove", i), window.addEventListener("mouseup", r), n === null && (n = document.documentElement.style.cursor), document.documentElement.style.cursor = "e-resize", s === null && (s = document.body.style.userSelect), document.body.style.userSelect = "none";
881
+ start(l, f, p) {
882
+ l.preventDefault();
883
+ const g = p.getBoundingClientRect();
884
+ e = { startX: l.clientX, colIndex: f, startWidth: g.width }, window.addEventListener("mousemove", s), window.addEventListener("mouseup", a), n === null && (n = document.documentElement.style.cursor), document.documentElement.style.cursor = "e-resize", i === null && (i = document.body.style.userSelect), document.body.style.userSelect = "none";
868
885
  },
869
886
  dispose() {
870
- r();
887
+ a();
871
888
  }
872
889
  };
873
890
  }
874
- function $e() {
891
+ function We() {
875
892
  return {
876
893
  toolPanels: /* @__PURE__ */ new Map(),
877
894
  headerContents: /* @__PURE__ */ new Map(),
@@ -884,24 +901,24 @@ function $e() {
884
901
  toolbarButtonCleanups: /* @__PURE__ */ new Map()
885
902
  };
886
903
  }
887
- function Ke(o, e) {
904
+ function Fe(o, e) {
888
905
  return !!(o?.header?.title || o?.header?.toolbarButtons?.length || e.toolPanels.size > 0 || e.headerContents.size > 0 || e.toolbarButtons.size > 0 || e.lightDomButtons.length > 0 || e.lightDomHeaderContent.length > 0);
889
906
  }
890
- function We(o, e) {
891
- const t = o?.header?.title ?? "", n = !!t, s = o?.header?.toolbarButtons ?? [], i = s.length > 0, l = e.toolbarButtons.size > 0, r = e.lightDomButtons.length > 0, a = e.toolPanels.size > 0, p = (i || l || r) && a, w = [...s].sort((u, b) => (u.order ?? 100) - (b.order ?? 100)), h = [...e.toolbarButtons.values()].sort((u, b) => (u.order ?? 100) - (b.order ?? 100)), c = [...e.toolPanels.values()].sort((u, b) => (u.order ?? 100) - (b.order ?? 100));
892
- let d = "";
893
- for (const u of w)
894
- u.icon && u.action && (d += `<button class="tbw-toolbar-btn" data-btn="${u.id}" title="${u.label}" aria-label="${u.label}"${u.disabled ? " disabled" : ""}>${u.icon}</button>`);
895
- for (const u of h)
896
- u.icon && u.action && (d += `<button class="tbw-toolbar-btn" data-btn="${u.id}" title="${u.label}" aria-label="${u.label}"${u.disabled ? " disabled" : ""}>${u.icon}</button>`);
897
- for (const u of w)
898
- (u.element || u.render) && (d += `<div class="tbw-toolbar-btn-slot" data-btn-slot="${u.id}"></div>`);
899
- for (const u of h)
900
- (u.element || u.render) && (d += `<div class="tbw-toolbar-btn-slot" data-btn-slot="${u.id}"></div>`);
901
- r && (d += '<slot name="toolbar"></slot>'), p && (d += '<div class="tbw-toolbar-separator"></div>');
902
- for (const u of c) {
903
- const b = e.activePanel === u.id;
904
- d += `<button class="tbw-toolbar-btn${b ? " active" : ""}" data-panel="${u.id}" title="${u.tooltip ?? u.title}" aria-label="${u.tooltip ?? u.title}" aria-pressed="${b}" aria-controls="tbw-panel-${u.id}">${u.icon}</button>`;
907
+ function Ve(o, e) {
908
+ const t = o?.header?.title ?? "", n = !!t, i = o?.header?.toolbarButtons ?? [], s = i.length > 0, r = e.toolbarButtons.size > 0, a = e.lightDomButtons.length > 0, l = e.toolPanels.size > 0, p = (s || r || a) && l, g = [...i].sort((d, b) => (d.order ?? 100) - (b.order ?? 100)), h = [...e.toolbarButtons.values()].sort((d, b) => (d.order ?? 100) - (b.order ?? 100)), c = [...e.toolPanels.values()].sort((d, b) => (d.order ?? 100) - (b.order ?? 100));
909
+ let u = "";
910
+ for (const d of g)
911
+ d.icon && d.action && (u += `<button class="tbw-toolbar-btn" data-btn="${d.id}" title="${d.label}" aria-label="${d.label}"${d.disabled ? " disabled" : ""}>${d.icon}</button>`);
912
+ for (const d of h)
913
+ d.icon && d.action && (u += `<button class="tbw-toolbar-btn" data-btn="${d.id}" title="${d.label}" aria-label="${d.label}"${d.disabled ? " disabled" : ""}>${d.icon}</button>`);
914
+ for (const d of g)
915
+ (d.element || d.render) && (u += `<div class="tbw-toolbar-btn-slot" data-btn-slot="${d.id}"></div>`);
916
+ for (const d of h)
917
+ (d.element || d.render) && (u += `<div class="tbw-toolbar-btn-slot" data-btn-slot="${d.id}"></div>`);
918
+ a && (u += '<slot name="toolbar"></slot>'), p && (u += '<div class="tbw-toolbar-separator"></div>');
919
+ for (const d of c) {
920
+ const b = e.activePanel === d.id;
921
+ u += `<button class="tbw-toolbar-btn${b ? " active" : ""}" data-panel="${d.id}" title="${d.tooltip ?? d.title}" aria-label="${d.tooltip ?? d.title}" aria-pressed="${b}" aria-controls="tbw-panel-${d.id}">${d.icon}</button>`;
905
922
  }
906
923
  return `
907
924
  <div class="tbw-shell-header" part="shell-header" role="banner">
@@ -910,16 +927,16 @@ function We(o, e) {
910
927
  <slot name="header-content"></slot>
911
928
  </div>
912
929
  <div class="tbw-shell-toolbar" part="shell-toolbar" role="toolbar" aria-label="Grid tools">
913
- ${d}
930
+ ${u}
914
931
  </div>
915
932
  </div>
916
933
  `;
917
934
  }
918
- function Fe(o, e, t) {
919
- const n = o?.toolPanel?.position ?? "right", s = e.toolPanels.size > 0, i = e.activePanel !== null, l = e.activePanel ? e.toolPanels.get(e.activePanel) : null, r = s ? `
920
- <aside class="tbw-tool-panel${i ? " open" : ""}" part="tool-panel" data-position="${n}" role="complementary" aria-label="${l?.title ?? "Tool panel"}" id="tbw-panel-${e.activePanel ?? "closed"}">
935
+ function Ge(o, e, t) {
936
+ const n = o?.toolPanel?.position ?? "right", i = e.toolPanels.size > 0, s = e.activePanel !== null, r = e.activePanel ? e.toolPanels.get(e.activePanel) : null, a = i ? `
937
+ <aside class="tbw-tool-panel${s ? " open" : ""}" part="tool-panel" data-position="${n}" role="complementary" aria-label="${r?.title ?? "Tool panel"}" id="tbw-panel-${e.activePanel ?? "closed"}">
921
938
  <div class="tbw-tool-panel-header">
922
- <span class="tbw-tool-panel-title">${l?.title ?? ""}</span>
939
+ <span class="tbw-tool-panel-title">${r?.title ?? ""}</span>
923
940
  <button class="tbw-tool-panel-close" aria-label="Close panel">✕</button>
924
941
  </div>
925
942
  <div class="tbw-tool-panel-content" role="region"></div>
@@ -927,7 +944,7 @@ function Fe(o, e, t) {
927
944
  ` : "";
928
945
  return n === "left" ? `
929
946
  <div class="tbw-shell-body">
930
- ${r}
947
+ ${a}
931
948
  <div class="tbw-grid-content">
932
949
  ${t}
933
950
  </div>
@@ -937,7 +954,7 @@ function Fe(o, e, t) {
937
954
  <div class="tbw-grid-content">
938
955
  ${t}
939
956
  </div>
940
- ${r}
957
+ ${a}
941
958
  </div>
942
959
  `;
943
960
  }
@@ -946,78 +963,78 @@ function ee(o, e) {
946
963
  if (!t) return;
947
964
  t.style.display = "none";
948
965
  const n = t.querySelectorAll("tbw-grid-header-content");
949
- e.lightDomHeaderContent = Array.from(n), e.lightDomHeaderContent.forEach((i, l) => {
950
- i.setAttribute("slot", "header-content");
966
+ e.lightDomHeaderContent = Array.from(n), e.lightDomHeaderContent.forEach((s, r) => {
967
+ s.setAttribute("slot", "header-content");
951
968
  });
952
- const s = t.querySelectorAll("tbw-grid-tool-button");
953
- e.lightDomButtons = Array.from(s), e.lightDomButtons.sort((i, l) => {
954
- const r = parseInt(i.getAttribute("order") ?? "100", 10), a = parseInt(l.getAttribute("order") ?? "100", 10);
955
- return r - a;
956
- }), e.lightDomButtons.forEach((i) => {
957
- i.setAttribute("slot", "toolbar");
969
+ const i = t.querySelectorAll("tbw-grid-tool-button");
970
+ e.lightDomButtons = Array.from(i), e.lightDomButtons.sort((s, r) => {
971
+ const a = parseInt(s.getAttribute("order") ?? "100", 10), l = parseInt(r.getAttribute("order") ?? "100", 10);
972
+ return a - l;
973
+ }), e.lightDomButtons.forEach((s) => {
974
+ s.setAttribute("slot", "toolbar");
958
975
  });
959
976
  }
960
- function Ve(o, e, t, n) {
961
- const s = o.querySelector(".tbw-shell-toolbar");
962
- s && s.addEventListener("click", (l) => {
963
- const r = l.target, a = r.closest("[data-panel]");
964
- if (a) {
965
- const p = a.getAttribute("data-panel");
977
+ function Ue(o, e, t, n) {
978
+ const i = o.querySelector(".tbw-shell-toolbar");
979
+ i && i.addEventListener("click", (r) => {
980
+ const a = r.target, l = a.closest("[data-panel]");
981
+ if (l) {
982
+ const p = l.getAttribute("data-panel");
966
983
  p && n.onPanelToggle(p);
967
984
  return;
968
985
  }
969
- const f = r.closest("[data-btn]");
986
+ const f = a.closest("[data-btn]");
970
987
  if (f) {
971
988
  const p = f.getAttribute("data-btn");
972
989
  p && n.onToolbarButtonClick(p);
973
990
  }
974
991
  });
975
- const i = o.querySelector(".tbw-tool-panel-close");
976
- i && i.addEventListener("click", () => {
992
+ const s = o.querySelector(".tbw-tool-panel-close");
993
+ s && s.addEventListener("click", () => {
977
994
  n.onPanelClose();
978
995
  });
979
996
  }
980
- function Ge(o, e, t) {
997
+ function Xe(o, e, t) {
981
998
  const n = [...e?.header?.toolbarButtons ?? [], ...t.toolbarButtons.values()];
982
- for (const s of n) {
983
- const i = o.querySelector(`[data-btn-slot="${s.id}"]`);
984
- if (!i) continue;
985
- const l = t.toolbarButtonCleanups.get(s.id);
986
- if (l && (l(), t.toolbarButtonCleanups.delete(s.id)), s.element)
987
- i.appendChild(s.element);
988
- else if (s.render) {
989
- const r = s.render(i);
990
- r && t.toolbarButtonCleanups.set(s.id, r);
999
+ for (const i of n) {
1000
+ const s = o.querySelector(`[data-btn-slot="${i.id}"]`);
1001
+ if (!s) continue;
1002
+ const r = t.toolbarButtonCleanups.get(i.id);
1003
+ if (r && (r(), t.toolbarButtonCleanups.delete(i.id)), i.element)
1004
+ s.appendChild(i.element);
1005
+ else if (i.render) {
1006
+ const a = i.render(s);
1007
+ a && t.toolbarButtonCleanups.set(i.id, a);
991
1008
  }
992
1009
  }
993
1010
  }
994
1011
  function te(o, e) {
995
1012
  const t = o.querySelector(".tbw-shell-content");
996
1013
  if (!t) return;
997
- const n = [...e.headerContents.values()].sort((i, l) => (i.order ?? 100) - (l.order ?? 100)), s = t.querySelector('slot[name="header-content"]');
998
- for (const i of n) {
999
- const l = e.headerContentCleanups.get(i.id);
1000
- l && (l(), e.headerContentCleanups.delete(i.id));
1001
- let r = t.querySelector(`[data-header-content="${i.id}"]`);
1002
- r || (r = document.createElement("div"), r.setAttribute("data-header-content", i.id), s ? t.insertBefore(r, s) : t.appendChild(r));
1003
- const a = i.render(r);
1004
- a && e.headerContentCleanups.set(i.id, a);
1014
+ const n = [...e.headerContents.values()].sort((s, r) => (s.order ?? 100) - (r.order ?? 100)), i = t.querySelector('slot[name="header-content"]');
1015
+ for (const s of n) {
1016
+ const r = e.headerContentCleanups.get(s.id);
1017
+ r && (r(), e.headerContentCleanups.delete(s.id));
1018
+ let a = t.querySelector(`[data-header-content="${s.id}"]`);
1019
+ a || (a = document.createElement("div"), a.setAttribute("data-header-content", s.id), i ? t.insertBefore(a, i) : t.appendChild(a));
1020
+ const l = s.render(a);
1021
+ l && e.headerContentCleanups.set(s.id, l);
1005
1022
  }
1006
1023
  }
1007
- function Ue(o, e) {
1024
+ function je(o, e) {
1008
1025
  if (!e.activePanel) return;
1009
1026
  const t = e.toolPanels.get(e.activePanel);
1010
1027
  if (!t) return;
1011
1028
  const n = o.querySelector(".tbw-tool-panel-content");
1012
1029
  if (!n) return;
1013
1030
  e.activePanelCleanup && (e.activePanelCleanup(), e.activePanelCleanup = null), n.innerHTML = "";
1014
- const s = t.render(n);
1015
- s && (e.activePanelCleanup = s);
1031
+ const i = t.render(n);
1032
+ i && (e.activePanelCleanup = i);
1016
1033
  }
1017
1034
  function oe(o, e) {
1018
1035
  o.querySelectorAll("[data-panel]").forEach((n) => {
1019
- const i = n.getAttribute("data-panel") === e.activePanel;
1020
- n.classList.toggle("active", i), n.setAttribute("aria-pressed", String(i));
1036
+ const s = n.getAttribute("data-panel") === e.activePanel;
1037
+ n.classList.toggle("active", s), n.setAttribute("aria-pressed", String(s));
1021
1038
  });
1022
1039
  }
1023
1040
  function ne(o, e) {
@@ -1025,11 +1042,11 @@ function ne(o, e) {
1025
1042
  if (!t) return;
1026
1043
  const n = e.activePanel !== null;
1027
1044
  if (t.classList.toggle("open", n), n && e.activePanel) {
1028
- const s = e.toolPanels.get(e.activePanel), i = t.querySelector(".tbw-tool-panel-title");
1029
- i && (i.textContent = s?.title ?? ""), t.setAttribute("aria-label", `${s?.title ?? "Tool"} panel`), t.id = `tbw-panel-${e.activePanel}`;
1045
+ const i = e.toolPanels.get(e.activePanel), s = t.querySelector(".tbw-tool-panel-title");
1046
+ s && (s.textContent = i?.title ?? ""), t.setAttribute("aria-label", `${i?.title ?? "Tool"} panel`), t.id = `tbw-panel-${e.activePanel}`;
1030
1047
  }
1031
1048
  }
1032
- function Xe(o, e) {
1049
+ function Ye(o, e) {
1033
1050
  const t = [];
1034
1051
  for (const n of o?.header?.toolbarButtons ?? [])
1035
1052
  t.push({
@@ -1046,11 +1063,11 @@ function Xe(o, e) {
1046
1063
  source: "config"
1047
1064
  });
1048
1065
  for (let n = 0; n < e.lightDomButtons.length; n++) {
1049
- const i = e.lightDomButtons[n].querySelector("button");
1066
+ const s = e.lightDomButtons[n].querySelector("button");
1050
1067
  t.push({
1051
1068
  id: `light-dom-${n}`,
1052
- label: i?.getAttribute("title") ?? i?.getAttribute("aria-label") ?? "",
1053
- disabled: i?.disabled ?? !1,
1069
+ label: s?.getAttribute("title") ?? s?.getAttribute("aria-label") ?? "",
1070
+ disabled: s?.disabled ?? !1,
1054
1071
  source: "light-dom"
1055
1072
  });
1056
1073
  }
@@ -1064,7 +1081,7 @@ function Xe(o, e) {
1064
1081
  });
1065
1082
  return t;
1066
1083
  }
1067
- function je(o) {
1084
+ function Ze(o) {
1068
1085
  for (const e of o.headerContentCleanups.values())
1069
1086
  e();
1070
1087
  o.headerContentCleanups.clear(), o.activePanelCleanup && (o.activePanelCleanup(), o.activePanelCleanup = null);
@@ -1072,7 +1089,7 @@ function je(o) {
1072
1089
  e();
1073
1090
  o.toolbarButtonCleanups.clear(), o.activePanel && o.toolPanels.get(o.activePanel)?.onClose?.(), o.toolPanels.clear(), o.headerContents.clear(), o.toolbarButtons.clear(), o.lightDomButtons = [], o.lightDomHeaderContent = [], o.activePanel = null;
1074
1091
  }
1075
- class Ye {
1092
+ class Je {
1076
1093
  constructor(e) {
1077
1094
  this.grid = e;
1078
1095
  }
@@ -1206,13 +1223,46 @@ class Ye {
1206
1223
  for (const e of this.plugins)
1207
1224
  e.onScrollRender?.();
1208
1225
  }
1226
+ /**
1227
+ * Get total extra height contributed by plugins (e.g., expanded detail rows).
1228
+ * Used to adjust scrollbar height calculations.
1229
+ */
1230
+ getExtraHeight() {
1231
+ let e = 0;
1232
+ for (const t of this.plugins)
1233
+ typeof t.getExtraHeight == "function" && (e += t.getExtraHeight());
1234
+ return e;
1235
+ }
1236
+ /**
1237
+ * Get extra height from plugins that appears before a given row index.
1238
+ * Used by virtualization to correctly position the scroll window.
1239
+ */
1240
+ getExtraHeightBefore(e) {
1241
+ let t = 0;
1242
+ for (const n of this.plugins)
1243
+ typeof n.getExtraHeightBefore == "function" && (t += n.getExtraHeightBefore(e));
1244
+ return t;
1245
+ }
1246
+ /**
1247
+ * Adjust the virtualization start index based on plugin needs.
1248
+ * Returns the minimum start index from all plugins.
1249
+ */
1250
+ adjustVirtualStart(e, t, n) {
1251
+ let i = e;
1252
+ for (const s of this.plugins)
1253
+ if (typeof s.adjustVirtualStart == "function") {
1254
+ const r = s.adjustVirtualStart(e, t, n);
1255
+ r < i && (i = r);
1256
+ }
1257
+ return i;
1258
+ }
1209
1259
  /**
1210
1260
  * Execute renderRow hook on all plugins.
1211
1261
  * Returns true if any plugin handled the row.
1212
1262
  */
1213
1263
  renderRow(e, t, n) {
1214
- for (const s of this.plugins)
1215
- if (s.renderRow?.(e, t, n))
1264
+ for (const i of this.plugins)
1265
+ if (i.renderRow?.(e, t, n))
1216
1266
  return !0;
1217
1267
  return !1;
1218
1268
  }
@@ -1299,8 +1349,8 @@ class Ye {
1299
1349
  getContextMenuItems(e) {
1300
1350
  const t = [];
1301
1351
  for (const n of this.plugins) {
1302
- const s = n.getContextMenuItems?.(e);
1303
- s && t.push(...s);
1352
+ const i = n.getContextMenuItems?.(e);
1353
+ i && t.push(...i);
1304
1354
  }
1305
1355
  return t;
1306
1356
  }
@@ -1330,10 +1380,10 @@ class Ye {
1330
1380
  return e.sort((t, n) => (t.content.order ?? 0) - (n.content.order ?? 0));
1331
1381
  }
1332
1382
  }
1333
- class q extends HTMLElement {
1383
+ class I extends HTMLElement {
1334
1384
  // TODO: Rename to 'data-grid' when migration is complete
1335
1385
  static tagName = "tbw-grid";
1336
- #n;
1386
+ #o;
1337
1387
  #i = !1;
1338
1388
  // ---------------- Ready Promise ----------------
1339
1389
  #z;
@@ -1342,37 +1392,37 @@ class q extends HTMLElement {
1342
1392
  // These backing fields store raw user input. They are merged into
1343
1393
  // #effectiveConfig by #mergeEffectiveConfig(). Never read directly
1344
1394
  // for rendering logic - always use effectiveConfig or derived state.
1345
- #l = [];
1346
- #r;
1395
+ #r = [];
1396
+ #l;
1347
1397
  #g;
1398
+ #v;
1348
1399
  #C;
1349
- #y;
1350
1400
  // ================== SINGLE SOURCE OF TRUTH ==================
1351
1401
  // All input sources converge here. This is the canonical config
1352
1402
  // that all rendering and logic should read from.
1353
- #o = {};
1354
- #u = !1;
1355
- #L = 0;
1403
+ #n = {};
1404
+ #f = !1;
1405
+ #p = 0;
1356
1406
  #E = null;
1357
- #R = !1;
1407
+ #y = !1;
1358
1408
  // Cached flag for plugin scroll handlers
1359
1409
  #k;
1360
1410
  // Cached hook to avoid closures
1361
- #f;
1362
- #p;
1363
- #_ = !1;
1364
- #w;
1365
- #b;
1411
+ #R = !1;
1412
+ #_ = null;
1366
1413
  #A = null;
1367
1414
  #S = null;
1415
+ #x = null;
1416
+ #a;
1417
+ #w;
1368
1418
  // ---------------- Plugin System ----------------
1369
1419
  #t;
1370
1420
  // ---------------- Column State ----------------
1371
1421
  #P;
1372
- #d;
1422
+ #h;
1373
1423
  // ---------------- Shell State ----------------
1374
- #e = $e();
1375
- #a = !1;
1424
+ #e = We();
1425
+ #c = !1;
1376
1426
  // ================== DERIVED STATE ==================
1377
1427
  // _rows: result of applying plugin processRows hooks
1378
1428
  _rows = [];
@@ -1380,10 +1430,10 @@ class q extends HTMLElement {
1380
1430
  // This ensures effectiveConfig.columns is the single source of truth for columns
1381
1431
  // _columns always contains ALL columns (including hidden)
1382
1432
  get _columns() {
1383
- return this.#o.columns ?? [];
1433
+ return this.#n.columns ?? [];
1384
1434
  }
1385
1435
  set _columns(e) {
1386
- this.#o.columns = e;
1436
+ this.#n.columns = e;
1387
1437
  }
1388
1438
  // visibleColumns returns only visible columns for rendering
1389
1439
  // This is what header/row rendering should use
@@ -1432,56 +1482,66 @@ class q extends HTMLElement {
1432
1482
  return this._rows;
1433
1483
  }
1434
1484
  set rows(e) {
1435
- const t = this.#l;
1436
- this.#l = e, t !== e && this.#Z();
1485
+ const t = this.#r;
1486
+ this.#r = e, t !== e && this.#Z();
1437
1487
  }
1438
1488
  /**
1439
1489
  * Get the original unfiltered/unprocessed rows.
1440
1490
  * Use this when you need access to all source data regardless of active filters.
1441
1491
  */
1442
1492
  get sourceRows() {
1443
- return this.#l;
1493
+ return this.#r;
1444
1494
  }
1445
1495
  get columns() {
1446
1496
  return [...this._columns];
1447
1497
  }
1448
1498
  set columns(e) {
1449
- const t = this.#r;
1450
- this.#r = e, t !== e && this.#J();
1499
+ const t = this.#l;
1500
+ this.#l = e, t !== e && this.#J();
1451
1501
  }
1452
1502
  get gridConfig() {
1453
- return this.#o;
1503
+ return this.#n;
1454
1504
  }
1455
1505
  set gridConfig(e) {
1456
1506
  const t = this.#g;
1457
1507
  this.#g = e, t !== e && this.#Q();
1458
1508
  }
1459
1509
  get fitMode() {
1460
- return this.#o.fitMode ?? "stretch";
1510
+ return this.#n.fitMode ?? "stretch";
1461
1511
  }
1462
1512
  set fitMode(e) {
1463
- const t = this.#C;
1464
- this.#C = e, t !== e && this.#j();
1513
+ const t = this.#v;
1514
+ this.#v = e, t !== e && this.#j();
1465
1515
  }
1466
1516
  get editOn() {
1467
- return this.#o.editOn;
1517
+ return this.#n.editOn;
1468
1518
  }
1469
1519
  set editOn(e) {
1470
- const t = this.#y;
1471
- this.#y = e, t !== e && this.#Y();
1520
+ const t = this.#C;
1521
+ this.#C = e, t !== e && this.#Y();
1472
1522
  }
1473
1523
  // Effective config accessor for internal modules and plugins
1474
1524
  // Returns the merged config (single source of truth) before plugin processing
1475
1525
  // Use this when you need the raw merged config (e.g., for column definitions including hidden)
1476
1526
  get effectiveConfig() {
1477
- return this.#o;
1527
+ return this.#n;
1528
+ }
1529
+ /**
1530
+ * Get the disconnect signal for event listener cleanup.
1531
+ * This signal is aborted when the grid disconnects from the DOM.
1532
+ * Plugins and internal code can use this for automatic listener cleanup.
1533
+ * @example
1534
+ * element.addEventListener('click', handler, { signal: this.grid.disconnectSignal });
1535
+ */
1536
+ get disconnectSignal() {
1537
+ return this.#a || (this.#a = new AbortController()), this.#a.signal;
1478
1538
  }
1479
1539
  constructor() {
1480
- super(), this.#n = this.attachShadow({ mode: "open" }), this.#V(), this.#z = new Promise((e) => this.#N = e);
1540
+ super(), this.#o = this.attachShadow({ mode: "open" }), this.#V(), this.#z = new Promise((e) => this.#N = e);
1481
1541
  }
1482
1542
  #V() {
1483
1543
  const e = new CSSStyleSheet();
1484
- e.replaceSync(we), this.#n.adoptedStyleSheets = [e];
1544
+ e.replaceSync(we), this.#o.adoptedStyleSheets = [e];
1485
1545
  }
1486
1546
  // ---------------- Plugin System ----------------
1487
1547
  /**
@@ -1504,7 +1564,7 @@ class q extends HTMLElement {
1504
1564
  * Note: This does NOT reset plugin state - just re-processes rows/columns and renders.
1505
1565
  */
1506
1566
  requestRender() {
1507
- this.#T(), this.#O(), this.#x(), this.updateTemplate(), this.refreshVirtualWindow(!0);
1567
+ this.#L(), this.#M(), this.#T(), this.updateTemplate(), this.refreshVirtualWindow(!0);
1508
1568
  }
1509
1569
  /**
1510
1570
  * Request a lightweight style update without rebuilding DOM.
@@ -1512,26 +1572,26 @@ class q extends HTMLElement {
1512
1572
  * This runs all plugin afterRender hooks without rebuilding row/column DOM.
1513
1573
  */
1514
1574
  requestAfterRender() {
1515
- this.#m();
1575
+ this.#b();
1516
1576
  }
1517
1577
  /**
1518
1578
  * Initialize plugin system with instances from config.
1519
1579
  * Plugins are class instances passed in gridConfig.plugins[].
1520
1580
  */
1521
- #q() {
1522
- this.#t = new Ye(this);
1523
- const e = this.#o?.plugins, t = Array.isArray(e) ? e : [];
1581
+ #I() {
1582
+ this.#t = new Je(this);
1583
+ const e = this.#n?.plugins, t = Array.isArray(e) ? e : [];
1524
1584
  this.#t.attachAll(t);
1525
1585
  }
1526
1586
  /**
1527
1587
  * Inject all plugin styles into the shadow DOM.
1528
1588
  * Must be called after #render() since innerHTML wipes existing content.
1529
1589
  */
1530
- #I() {
1590
+ #q() {
1531
1591
  const e = this.#t?.getAllStyles() ?? "";
1532
1592
  if (e) {
1533
1593
  const t = document.createElement("style");
1534
- t.setAttribute("data-plugin", "all"), t.textContent = e, this.#n.appendChild(t);
1594
+ t.setAttribute("data-plugin", "all"), t.textContent = e, this.#o.appendChild(t);
1535
1595
  }
1536
1596
  }
1537
1597
  /**
@@ -1539,7 +1599,7 @@ class q extends HTMLElement {
1539
1599
  * With class-based plugins, we need to detach old and attach new.
1540
1600
  */
1541
1601
  #B() {
1542
- this.#t && this.#t.detachAll(), this.#q(), this.#I(), this.#R = this.#t?.getAll().some((e) => e.onScroll) ?? !1;
1602
+ this.#t && this.#t.detachAll(), this.#I(), this.#q(), this.#y = this.#t?.getAll().some((e) => e.onScroll) ?? !1;
1543
1603
  }
1544
1604
  /**
1545
1605
  * Clean up plugin states when grid disconnects.
@@ -1562,75 +1622,89 @@ class q extends HTMLElement {
1562
1622
  }
1563
1623
  // ---------------- Lifecycle ----------------
1564
1624
  connectedCallback() {
1565
- this.hasAttribute("tabindex") || (this.tabIndex = 0), this._rows = Array.isArray(this.#l) ? [...this.#l] : [], this.#h(), this.#q(), this.#U(), this.#i || (this.#F(), this.#I(), this.#i = !0), this.#$();
1625
+ this.hasAttribute("tabindex") || (this.tabIndex = 0), this._rows = Array.isArray(this.#r) ? [...this.#r] : [], this.#a?.abort(), this.#a = new AbortController(), this.#u(), this.#I(), this.#U(), this.#i || (this.#F(), this.#q(), this.#i = !0), this.#$();
1566
1626
  }
1567
1627
  disconnectedCallback() {
1568
- this.#G(), je(this.#e), this.#a = !1, this.#f && (document.removeEventListener("keydown", this.#f, !0), this.#f = void 0), this.#p && (document.removeEventListener("mousedown", this.#p, !1), this.#p = void 0), this.#w && (document.removeEventListener("mousemove", this.#w), this.#w = void 0), this.#b && (document.removeEventListener("mouseup", this.#b), this.#b = void 0), this.resizeController && this.resizeController.dispose(), this.#u = !1;
1628
+ this.#G(), Ze(this.#e), this.#c = !1, this.#a && (this.#a.abort(), this.#a = void 0), this.resizeController && this.resizeController.dispose(), this.#w && (this.#w.disconnect(), this.#w = void 0), this.#f = !1;
1569
1629
  }
1570
1630
  #$() {
1571
- const t = this.#n.querySelector(".tbw-grid-content") ?? this.#n.querySelector(".tbw-grid-root");
1572
- if (this.headerRowEl = t?.querySelector(".header-row"), this.virtualization.totalHeightEl = t?.querySelector(".faux-vscroll-spacer"), this.virtualization.viewportEl = t?.querySelector(".rows-viewport"), this.bodyEl = t?.querySelector(".rows"), this.#a) {
1573
- te(this.#n, this.#e), Ge(this.#n, this.#o?.shell, this.#e);
1574
- const i = this.#o?.shell?.toolPanel?.defaultOpen;
1575
- i && this.#e.toolPanels.has(i) && this.openToolPanel(i);
1576
- }
1577
- this.setAttribute("data-upgraded", ""), this.hasAttribute("role") || this.setAttribute("role", "grid"), this.#u = !0, this.#c(), this.addEventListener("keydown", (i) => He(this, i)), this.#f || (this.#f = (i) => {
1578
- i.key === "Escape" && this.activeEditRows !== -1 && this.#D(this.activeEditRows, !0);
1579
- }, document.addEventListener("keydown", this.#f, !0)), this.#p || (this.#p = (i) => {
1580
- if (this.activeEditRows === -1) return;
1581
- const l = this.findRenderedRowElement(this.activeEditRows);
1582
- !l || (i.composedPath && i.composedPath() || []).includes(l) || this.#D(this.activeEditRows, !1);
1583
- }, document.addEventListener("mousedown", this.#p, !1));
1584
- const n = t?.querySelector(".faux-vscroll"), s = t?.querySelector(".rows");
1585
- if (this.virtualization.container = n ?? this, this.#R = this.#t?.getAll().some((i) => i.onScroll) ?? !1, n && s) {
1586
- n.addEventListener(
1631
+ const t = this.#o.querySelector(".tbw-grid-content") ?? this.#o.querySelector(".tbw-grid-root");
1632
+ if (this.headerRowEl = t?.querySelector(".header-row"), this.virtualization.totalHeightEl = t?.querySelector(".faux-vscroll-spacer"), this.virtualization.viewportEl = t?.querySelector(".rows-viewport"), this.bodyEl = t?.querySelector(".rows"), this.#c) {
1633
+ te(this.#o, this.#e), Xe(this.#o, this.#n?.shell, this.#e);
1634
+ const r = this.#n?.shell?.toolPanel?.defaultOpen;
1635
+ r && this.#e.toolPanels.has(r) && this.openToolPanel(r);
1636
+ }
1637
+ this.setAttribute("data-upgraded", ""), this.hasAttribute("role") || this.setAttribute("role", "grid"), this.#f = !0;
1638
+ const n = this.disconnectSignal;
1639
+ this.#d(), this.addEventListener("keydown", (r) => ze(this, r), { signal: n }), document.addEventListener(
1640
+ "keydown",
1641
+ (r) => {
1642
+ r.key === "Escape" && this.activeEditRows !== -1 && this.#O(this.activeEditRows, !0);
1643
+ },
1644
+ { capture: !0, signal: n }
1645
+ ), document.addEventListener(
1646
+ "mousedown",
1647
+ (r) => {
1648
+ if (this.activeEditRows === -1) return;
1649
+ const a = this.findRenderedRowElement(this.activeEditRows);
1650
+ !a || (r.composedPath && r.composedPath() || []).includes(a) || this.#O(this.activeEditRows, !1);
1651
+ },
1652
+ { signal: n }
1653
+ );
1654
+ const i = t?.querySelector(".faux-vscroll"), s = t?.querySelector(".rows");
1655
+ if (this.virtualization.container = i ?? this, this.#y = this.#t?.getAll().some((r) => r.onScroll) ?? !1, i && s) {
1656
+ i.addEventListener(
1587
1657
  "scroll",
1588
1658
  () => {
1589
- if (!this.virtualization.enabled && !this.#R) return;
1590
- const l = n.scrollTop, r = this.virtualization.rowHeight, a = -(l % r);
1591
- s.style.transform = `translateY(${a}px)`, this.#E = l, this.#L || (this.#L = requestAnimationFrame(() => {
1592
- this.#L = 0, this.#E !== null && (this.#ne(this.#E), this.#E = null);
1659
+ if (!this.virtualization.enabled && !this.#y) return;
1660
+ const l = i.scrollTop, f = this.virtualization.rowHeight, p = Math.floor(l / f), g = p - p % 2, h = -(l - g * f);
1661
+ s.style.transform = `translateY(${h}px)`, this.#E = l, this.#p || (this.#p = requestAnimationFrame(() => {
1662
+ this.#p = 0, this.#E !== null && (this.#ne(this.#E), this.#E = null);
1593
1663
  }));
1594
1664
  },
1595
- { passive: !0 }
1665
+ { passive: !0, signal: n }
1596
1666
  );
1597
- const i = t?.querySelector(".rows-body");
1598
- i && (i.addEventListener(
1667
+ const r = this.#o.querySelector(".tbw-grid-content"), a = this.#o.querySelector(".tbw-scroll-area");
1668
+ r && (r.addEventListener(
1599
1669
  "wheel",
1600
1670
  (l) => {
1601
- l.preventDefault(), n.scrollTop += l.deltaY;
1671
+ l.preventDefault(), l.shiftKey || Math.abs(l.deltaX) > Math.abs(l.deltaY) ? a && (a.scrollLeft += l.shiftKey ? l.deltaY : l.deltaX) : i.scrollTop += l.deltaY;
1602
1672
  },
1603
- { passive: !1 }
1604
- ), i.addEventListener(
1673
+ { passive: !1, signal: n }
1674
+ ), r.addEventListener(
1605
1675
  "touchstart",
1606
1676
  (l) => {
1607
- l.touches.length === 1 && (this.#A = l.touches[0].clientY, this.#S = n.scrollTop);
1677
+ l.touches.length === 1 && (this.#_ = l.touches[0].clientY, this.#A = l.touches[0].clientX, this.#S = i.scrollTop, this.#x = a?.scrollLeft ?? 0);
1608
1678
  },
1609
- { passive: !0 }
1610
- ), i.addEventListener(
1679
+ { passive: !0, signal: n }
1680
+ ), r.addEventListener(
1611
1681
  "touchmove",
1612
1682
  (l) => {
1613
- if (l.touches.length === 1 && this.#A !== null && this.#S !== null) {
1614
- const r = this.#A - l.touches[0].clientY;
1615
- n.scrollTop = this.#S + r, l.preventDefault();
1683
+ if (l.touches.length === 1 && this.#_ !== null && this.#A !== null && this.#S !== null && this.#x !== null) {
1684
+ const f = this.#_ - l.touches[0].clientY, p = this.#A - l.touches[0].clientX;
1685
+ i.scrollTop = this.#S + f, a && (a.scrollLeft = this.#x + p), l.preventDefault();
1616
1686
  }
1617
1687
  },
1618
- { passive: !1 }
1619
- ), i.addEventListener(
1688
+ { passive: !1, signal: n }
1689
+ ), r.addEventListener(
1620
1690
  "touchend",
1621
1691
  () => {
1622
- this.#A = null, this.#S = null;
1692
+ this.#_ = null, this.#A = null, this.#S = null, this.#x = null;
1623
1693
  },
1624
- { passive: !0 }
1694
+ { passive: !0, signal: n }
1625
1695
  ));
1626
1696
  }
1627
- this.resizeController = Be(this), this.#n.addEventListener("mousedown", (i) => this.#ie(i)), this.#w || (this.#w = (i) => this.#se(i), document.addEventListener("mousemove", this.#w)), this.#b || (this.#b = (i) => this.#le(i), document.addEventListener("mouseup", this.#b)), this.virtualization.enabled && requestAnimationFrame(() => this.refreshVirtualWindow(!0)), requestAnimationFrame(() => {
1628
- const i = this.bodyEl.querySelector(".data-grid-row");
1629
- if (i) {
1630
- const l = i.getBoundingClientRect().height;
1631
- l && Math.abs(l - this.virtualization.rowHeight) > 0.1 && (this.virtualization.rowHeight = l, this.refreshVirtualWindow(!0));
1697
+ this.resizeController = Ke(this), this.#o.addEventListener("mousedown", (r) => this.#ie(r), { signal: n }), document.addEventListener("mousemove", (r) => this.#se(r), { signal: n }), document.addEventListener("mouseup", (r) => this.#re(r), { signal: n }), this.virtualization.enabled && requestAnimationFrame(() => this.refreshVirtualWindow(!0)), requestAnimationFrame(() => {
1698
+ const r = this.bodyEl.querySelector(".data-grid-row");
1699
+ if (r) {
1700
+ const a = r.getBoundingClientRect().height;
1701
+ a && Math.abs(a - this.virtualization.rowHeight) > 0.1 && (this.virtualization.rowHeight = a, this.refreshVirtualWindow(!0));
1632
1702
  }
1633
- }), queueMicrotask(() => this.#X()), requestAnimationFrame(() => requestAnimationFrame(() => this.#N?.()));
1703
+ }), this.virtualization.viewportEl && (this.#w = new ResizeObserver(() => {
1704
+ this.#p || (this.#p = requestAnimationFrame(() => {
1705
+ this.#p = 0, this.refreshVirtualWindow(!0);
1706
+ }));
1707
+ }), this.#w.observe(this.virtualization.viewportEl)), queueMicrotask(() => this.#X()), requestAnimationFrame(() => requestAnimationFrame(() => this.#N?.()));
1634
1708
  }
1635
1709
  // ---------------- Event Emitters ----------------
1636
1710
  #s(e, t) {
@@ -1654,65 +1728,65 @@ class q extends HTMLElement {
1654
1728
  /** Update ARIA selection attributes on rendered rows/cells */
1655
1729
  #X() {
1656
1730
  this.bodyEl?.querySelectorAll(".data-grid-row")?.forEach((t, n) => {
1657
- const s = n === this.focusRow;
1658
- t.setAttribute("aria-selected", String(s)), t.querySelectorAll(".cell").forEach((i, l) => {
1659
- i.setAttribute("aria-selected", String(s && l === this.focusCol));
1731
+ const i = n === this.focusRow;
1732
+ t.setAttribute("aria-selected", String(i)), t.querySelectorAll(".cell").forEach((s, r) => {
1733
+ s.setAttribute("aria-selected", String(i && r === this.focusCol));
1660
1734
  });
1661
1735
  });
1662
1736
  }
1663
1737
  // ---------------- Watch Handlers ----------------
1664
1738
  #j() {
1665
- if (!this.#u) return;
1666
- this.#h(), this.#o.fitMode === "fixed" ? (this.__didInitialAutoSize = !1, this.#K()) : (this._columns.forEach((t) => {
1739
+ if (!this.#f) return;
1740
+ this.#u(), this.#n.fitMode === "fixed" ? (this.__didInitialAutoSize = !1, this.#K()) : (this._columns.forEach((t) => {
1667
1741
  !t.__userResized && t.__autoSized && delete t.width;
1668
1742
  }), this.updateTemplate());
1669
1743
  }
1670
1744
  #Y() {
1671
- this.#u && (this.#h(), this.rowPool.length = 0, this.bodyEl && (this.bodyEl.innerHTML = ""), this.__rowRenderEpoch++, this.refreshVirtualWindow(!0));
1745
+ this.#f && (this.#u(), this.rowPool.length = 0, this.bodyEl && (this.bodyEl.innerHTML = ""), this.__rowRenderEpoch++, this.refreshVirtualWindow(!0));
1672
1746
  }
1673
1747
  #Z() {
1674
- this._rows = Array.isArray(this.#l) ? [...this.#l] : [], this.#T(), !this.#r || Array.isArray(this.#r) && this.#r.length === 0 ? this.#c() : this.refreshVirtualWindow(!0);
1748
+ this._rows = Array.isArray(this.#r) ? [...this.#r] : [], this.#L(), !this.#l || Array.isArray(this.#l) && this.#l.length === 0 ? this.#d() : this.refreshVirtualWindow(!0);
1675
1749
  }
1676
1750
  #J() {
1677
- j(this), this.#u && (this.#h(), this.#c());
1751
+ j(this), this.#f && (this.#u(), this.#d());
1678
1752
  }
1679
1753
  #Q() {
1680
- this.#u && (this.#h(), this.#B(), this.#T(), this.#O(), this.#x(), this.updateTemplate(), this.refreshVirtualWindow(!0));
1754
+ this.#f && (this.#u(), this.#B(), this.#L(), this.#M(), this.#T(), this.updateTemplate(), this.refreshVirtualWindow(!0));
1681
1755
  }
1682
1756
  // ---------------- Helper Wrappers ----------------
1683
1757
  #ee() {
1684
- Oe(this);
1758
+ He(this);
1685
1759
  }
1686
- #x() {
1760
+ #T() {
1687
1761
  V(this);
1688
1762
  }
1689
1763
  updateTemplate() {
1690
- he(this);
1764
+ ue(this);
1691
1765
  }
1692
1766
  #K() {
1693
- Me(this);
1767
+ Oe(this);
1694
1768
  }
1695
- #O() {
1769
+ #M() {
1696
1770
  if (this.#t) {
1697
1771
  const e = this._columns.filter((n) => !n.hidden), t = this.#t.processColumns([...e]);
1698
1772
  if (t !== e) {
1699
- const n = new Map(t.map((i, l) => [i.field, { col: i, order: l }])), s = this._columns.map((i) => {
1700
- if (i.hidden) return i;
1701
- const l = n.get(i.field);
1702
- return l ? l.col : i;
1773
+ const n = new Map(t.map((s, r) => [s.field, { col: s, order: r }])), i = this._columns.map((s) => {
1774
+ if (s.hidden) return s;
1775
+ const r = n.get(s.field);
1776
+ return r ? r.col : s;
1703
1777
  });
1704
- this._columns = s;
1778
+ this._columns = i;
1705
1779
  }
1706
1780
  }
1707
1781
  }
1708
1782
  /** Execute all plugin afterRender hooks */
1709
- #m() {
1783
+ #b() {
1710
1784
  this.#t?.afterRender();
1711
1785
  }
1712
1786
  /** Recompute row model via plugin hooks (grouping, tree, filtering, etc.). */
1713
- #T() {
1787
+ #L() {
1714
1788
  j(this);
1715
- const e = Array.isArray(this.#l) ? [...this.#l] : [], t = this.#t?.processRows(e) ?? e;
1789
+ const e = Array.isArray(this.#r) ? [...this.#r] : [], t = this.#t?.processRows(e) ?? e;
1716
1790
  this._rows = t;
1717
1791
  }
1718
1792
  /**
@@ -1733,75 +1807,75 @@ class q extends HTMLElement {
1733
1807
  * - `_columns` is NOT set here (done by #getColumnConfiguration + #processColumns)
1734
1808
  * - Plugins receive config via their attach() method
1735
1809
  */
1736
- #h() {
1810
+ #u() {
1737
1811
  const e = this.#g ? { ...this.#g } : {};
1738
1812
  let t = Array.isArray(e.columns) ? [...e.columns] : [];
1739
- const n = (this.__lightDomColumnsCache || []).map((s) => ({
1740
- ...s
1813
+ const n = (this.__lightDomColumnsCache || []).map((i) => ({
1814
+ ...i
1741
1815
  }));
1742
1816
  if (n.length) {
1743
- const s = {};
1744
- t.forEach((i) => s[i.field] = i), n.forEach((i) => {
1745
- const l = s[i.field];
1746
- l ? (i.header && !l.header && (l.header = i.header), i.type && !l.type && (l.type = i.type), l.sortable = l.sortable || i.sortable, i.resizable && (l.resizable = !0), i.editable && (l.editable = !0)) : (t.push(i), s[i.field] = i);
1817
+ const i = {};
1818
+ t.forEach((s) => i[s.field] = s), n.forEach((s) => {
1819
+ const r = i[s.field];
1820
+ r ? (s.header && !r.header && (r.header = s.header), s.type && !r.type && (r.type = s.type), r.sortable = r.sortable || s.sortable, s.resizable && (r.resizable = !0), s.editable && (r.editable = !0)) : (t.push(s), i[s.field] = s);
1747
1821
  });
1748
1822
  }
1749
- if (this.#r && this.#r.length && (t = [...this.#r]), (!t || t.length === 0) && this._rows.length && (t = ce(this._rows).columns), t.length) {
1750
- t.forEach((l) => {
1751
- l.sortable === void 0 && (l.sortable = !0), l.resizable === void 0 && (l.resizable = !0);
1823
+ if (this.#l && this.#l.length && (t = [...this.#l]), (!t || t.length === 0) && this._rows.length && (t = de(this._rows).columns), t.length) {
1824
+ t.forEach((r) => {
1825
+ r.sortable === void 0 && (r.sortable = !0), r.resizable === void 0 && (r.resizable = !0);
1752
1826
  });
1753
- const s = this.#o.columns;
1754
- s?.some((l) => l.__compiledView || l.__compiledEditor) ? e.columns = s : e.columns = t;
1827
+ const i = this.#n.columns;
1828
+ i?.some((r) => r.__compiledView || r.__compiledEditor) ? e.columns = i : e.columns = t;
1755
1829
  } else {
1756
- const s = this.#o.columns;
1757
- s?.some((i) => i.__compiledView || i.__compiledEditor) && (e.columns = s);
1830
+ const i = this.#n.columns;
1831
+ i?.some((s) => s.__compiledView || s.__compiledEditor) && (e.columns = i);
1758
1832
  }
1759
- this.#C && (e.fitMode = this.#C), e.fitMode || (e.fitMode = "stretch"), this.#y && (e.editOn = this.#y), e.columnState && !this.#d && (this.#d = e.columnState), this.#o = e, e.fitMode === "fixed" && this._columns.forEach((s) => {
1760
- s.width == null && (s.width = 80);
1833
+ this.#v && (e.fitMode = this.#v), e.fitMode || (e.fitMode = "stretch"), this.#C && (e.editOn = this.#C), e.columnState && !this.#h && (this.#h = e.columnState), this.#n = e, e.fitMode === "fixed" && this._columns.forEach((i) => {
1834
+ i.width == null && (i.width = 80);
1761
1835
  });
1762
1836
  }
1763
1837
  // ---------------- Delegate Wrappers ----------------
1764
- #M(e, t, n = this.__rowRenderEpoch) {
1765
- this.#k || (this.#k = (s, i, l) => this.#t?.renderRow(s, i, l) ?? !1), qe(this, e, t, n, this.#k);
1838
+ #H(e, t, n = this.__rowRenderEpoch) {
1839
+ this.#k || (this.#k = (i, s, r) => this.#t?.renderRow(i, s, r) ?? !1), qe(this, e, t, n, this.#k);
1766
1840
  }
1767
1841
  #te(e, t) {
1768
1842
  T(this, e, t);
1769
1843
  }
1770
- #D(e, t) {
1771
- Ie(this, e, t);
1844
+ #O(e, t) {
1845
+ Be(this, e, t);
1772
1846
  }
1773
1847
  // ---------------- Core Helpers ----------------
1774
- #c() {
1848
+ #d() {
1775
1849
  if (!this.isConnected || !this.headerRowEl || !this.bodyEl)
1776
1850
  return;
1777
- const e = this.#g?.columns || this.#r || [];
1851
+ const e = this.#g?.columns || this.#l || [];
1778
1852
  if (e.length) {
1779
- const n = new Map(this._columns.filter((i) => i.hidden).map((i) => [i.field, !0])), s = e.map((i) => ({
1780
- ...i,
1781
- hidden: n.get(i.field) ?? i.hidden
1853
+ const n = new Map(this._columns.filter((s) => s.hidden).map((s) => [s.field, !0])), i = e.map((s) => ({
1854
+ ...s,
1855
+ hidden: n.get(s.field) ?? s.hidden
1782
1856
  }));
1783
- this._columns = s;
1857
+ this._columns = i;
1784
1858
  }
1785
- if (this.#ee(), this.#h(), this.#B(), this.#T(), this.#O(), this.#d) {
1786
- const n = this.#d;
1787
- this.#d = void 0, this.#W(n);
1859
+ if (this.#ee(), this.#u(), this.#B(), this.#L(), this.#M(), this.#h) {
1860
+ const n = this.#h;
1861
+ this.#h = void 0, this.#W(n);
1788
1862
  }
1789
- this.#x(), this.updateTemplate(), this.refreshVirtualWindow(!0), this.#o.fitMode === "fixed" && !this.__didInitialAutoSize && requestAnimationFrame(() => this.#K()), this.bodyEl && (this.bodyEl.style.display = "", this.bodyEl.style.gridTemplateColumns = ""), queueMicrotask(() => this.#m());
1863
+ this.#T(), this.updateTemplate(), this.refreshVirtualWindow(!0), this.#n.fitMode === "fixed" && !this.__didInitialAutoSize && requestAnimationFrame(() => this.#K()), this.bodyEl && (this.bodyEl.style.display = "", this.bodyEl.style.gridTemplateColumns = ""), queueMicrotask(() => this.#b());
1790
1864
  }
1791
1865
  /** Internal method to apply column state without triggering setup loop */
1792
1866
  #W(e) {
1793
- const t = this.#o.columns ?? [], n = this.#t?.getAll() ?? [];
1794
- ge(this, e, t, n);
1795
- for (const s of e.columns) {
1796
- const i = t.find((l) => l.field === s.field);
1797
- i && (i.hidden = !s.visible);
1867
+ const t = this.#n.columns ?? [], n = this.#t?.getAll() ?? [];
1868
+ me(this, e, t, n);
1869
+ for (const i of e.columns) {
1870
+ const s = t.find((r) => r.field === i.field);
1871
+ s && (s.hidden = !i.visible);
1798
1872
  }
1799
1873
  }
1800
1874
  #oe() {
1801
1875
  return this._rows.length <= this.virtualization.bypassThreshold;
1802
1876
  }
1803
1877
  #ne(e) {
1804
- if (this.refreshVirtualWindow(!1), this.#t?.onScrollRender(), this.#R) {
1878
+ if (this.refreshVirtualWindow(!1), this.#t?.onScrollRender(), this.#y) {
1805
1879
  const t = this.virtualization.container, n = {
1806
1880
  scrollTop: e,
1807
1881
  scrollLeft: t?.scrollLeft ?? 0,
@@ -1815,7 +1889,7 @@ class q extends HTMLElement {
1815
1889
  }
1816
1890
  }
1817
1891
  findHeaderRow() {
1818
- return this.#n.querySelector(".header-row");
1892
+ return this.#o.querySelector(".header-row");
1819
1893
  }
1820
1894
  findRenderedRowElement(e) {
1821
1895
  return Array.from(this.bodyEl.querySelectorAll(".data-grid-row")).find((t) => {
@@ -1827,35 +1901,35 @@ class q extends HTMLElement {
1827
1901
  * Dispatch a cell click event to the plugin system.
1828
1902
  * Returns true if any plugin handled the event.
1829
1903
  */
1830
- dispatchCellClick(e, t, n, s) {
1831
- const i = this._rows[t], l = this._columns[n];
1832
- if (!i || !l) return !1;
1833
- const r = {
1834
- row: i,
1904
+ dispatchCellClick(e, t, n, i) {
1905
+ const s = this._rows[t], r = this._columns[n];
1906
+ if (!s || !r) return !1;
1907
+ const a = {
1908
+ row: s,
1835
1909
  rowIndex: t,
1836
1910
  colIndex: n,
1837
- field: l.field,
1838
- value: i[l.field],
1839
- cellEl: s,
1911
+ field: r.field,
1912
+ value: s[r.field],
1913
+ cellEl: i,
1840
1914
  originalEvent: e
1841
1915
  };
1842
- return this.#t?.onCellClick(r) ?? !1;
1916
+ return this.#t?.onCellClick(a) ?? !1;
1843
1917
  }
1844
1918
  /**
1845
1919
  * Dispatch a header click event to the plugin system.
1846
1920
  * Returns true if any plugin handled the event.
1847
1921
  */
1848
1922
  dispatchHeaderClick(e, t, n) {
1849
- const s = this._columns[t];
1850
- if (!s) return !1;
1851
- const i = {
1923
+ const i = this._columns[t];
1924
+ if (!i) return !1;
1925
+ const s = {
1852
1926
  colIndex: t,
1853
- field: s.field,
1854
- column: s,
1927
+ field: i.field,
1928
+ column: i,
1855
1929
  headerEl: n,
1856
1930
  originalEvent: e
1857
1931
  };
1858
- return this.#t?.onHeaderClick(i) ?? !1;
1932
+ return this.#t?.onHeaderClick(s) ?? !1;
1859
1933
  }
1860
1934
  /**
1861
1935
  * Dispatch a keyboard event to the plugin system.
@@ -1868,52 +1942,52 @@ class q extends HTMLElement {
1868
1942
  * Build a CellMouseEvent from a native MouseEvent.
1869
1943
  * Extracts cell/row information from the event target.
1870
1944
  */
1871
- #H(e, t) {
1945
+ #D(e, t) {
1872
1946
  let n = null;
1873
- const s = e.composedPath?.();
1874
- if (s && s.length > 0 ? n = s[0] : n = e.target, n && !this.#n.contains(n)) {
1875
- const d = this.#n.elementFromPoint(e.clientX, e.clientY);
1876
- d && (n = d);
1877
- }
1878
- const i = n?.closest?.("[data-col]"), l = n?.closest?.(".data-grid-row"), r = n?.closest?.(".header-row");
1879
- let a, f, p, w, h, c;
1880
- return i && (a = parseInt(i.getAttribute("data-row") ?? "-1", 10), f = parseInt(i.getAttribute("data-col") ?? "-1", 10), a >= 0 && f >= 0 && (p = this._rows[a], c = this._columns[f], w = c?.field, h = p && w ? p[w] : void 0)), {
1947
+ const i = e.composedPath?.();
1948
+ if (i && i.length > 0 ? n = i[0] : n = e.target, n && !this.#o.contains(n)) {
1949
+ const u = this.#o.elementFromPoint(e.clientX, e.clientY);
1950
+ u && (n = u);
1951
+ }
1952
+ const s = n?.closest?.("[data-col]"), r = n?.closest?.(".data-grid-row"), a = n?.closest?.(".header-row");
1953
+ let l, f, p, g, h, c;
1954
+ return s && (l = parseInt(s.getAttribute("data-row") ?? "-1", 10), f = parseInt(s.getAttribute("data-col") ?? "-1", 10), l >= 0 && f >= 0 && (p = this._rows[l], c = this._columns[f], g = c?.field, h = p && g ? p[g] : void 0)), {
1881
1955
  type: t,
1882
1956
  row: p,
1883
- rowIndex: a !== void 0 && a >= 0 ? a : void 0,
1957
+ rowIndex: l !== void 0 && l >= 0 ? l : void 0,
1884
1958
  colIndex: f !== void 0 && f >= 0 ? f : void 0,
1885
- field: w,
1959
+ field: g,
1886
1960
  value: h,
1887
1961
  column: c,
1888
1962
  originalEvent: e,
1889
- cellElement: i ?? void 0,
1890
- rowElement: l ?? void 0,
1891
- isHeader: !!r,
1892
- cell: a !== void 0 && f !== void 0 && a >= 0 && f >= 0 ? { row: a, col: f } : void 0
1963
+ cellElement: s ?? void 0,
1964
+ rowElement: r ?? void 0,
1965
+ isHeader: !!a,
1966
+ cell: l !== void 0 && f !== void 0 && l >= 0 && f >= 0 ? { row: l, col: f } : void 0
1893
1967
  };
1894
1968
  }
1895
1969
  /**
1896
1970
  * Handle mousedown events and dispatch to plugin system.
1897
1971
  */
1898
1972
  #ie(e) {
1899
- const t = this.#H(e, "mousedown");
1900
- (this.#t?.onCellMouseDown(t) ?? !1) && (this.#_ = !0);
1973
+ const t = this.#D(e, "mousedown");
1974
+ (this.#t?.onCellMouseDown(t) ?? !1) && (this.#R = !0);
1901
1975
  }
1902
1976
  /**
1903
1977
  * Handle mousemove events (only when dragging).
1904
1978
  */
1905
1979
  #se(e) {
1906
- if (!this.#_) return;
1907
- const t = this.#H(e, "mousemove");
1980
+ if (!this.#R) return;
1981
+ const t = this.#D(e, "mousemove");
1908
1982
  this.#t?.onCellMouseMove(t);
1909
1983
  }
1910
1984
  /**
1911
1985
  * Handle mouseup events.
1912
1986
  */
1913
- #le(e) {
1914
- if (!this.#_) return;
1915
- const t = this.#H(e, "mouseup");
1916
- this.#t?.onCellMouseUp(t), this.#_ = !1;
1987
+ #re(e) {
1988
+ if (!this.#R) return;
1989
+ const t = this.#D(e, "mouseup");
1990
+ this.#t?.onCellMouseUp(t), this.#R = !1;
1917
1991
  }
1918
1992
  // API consumed by internal utils (rows.ts)
1919
1993
  get changedRows() {
@@ -1929,17 +2003,17 @@ class q extends HTMLElement {
1929
2003
  this.#te(e, this._rows[e]);
1930
2004
  }
1931
2005
  async commitActiveRowEdit() {
1932
- this.activeEditRows !== -1 && this.#D(this.activeEditRows, !1);
2006
+ this.activeEditRows !== -1 && this.#O(this.activeEditRows, !1);
1933
2007
  }
1934
2008
  async ready() {
1935
2009
  return this.#z;
1936
2010
  }
1937
2011
  async forceLayout() {
1938
- this.#c(), await new Promise((e) => requestAnimationFrame(() => requestAnimationFrame(e)));
2012
+ this.#d(), await new Promise((e) => requestAnimationFrame(() => requestAnimationFrame(e)));
1939
2013
  }
1940
2014
  /** Public method: returns a frozen snapshot of the merged effective configuration */
1941
2015
  async getConfig() {
1942
- return Object.freeze({ ...this.#o || {} });
2016
+ return Object.freeze({ ...this.#n || {} });
1943
2017
  }
1944
2018
  // ---------------- Column Visibility API ----------------
1945
2019
  /**
@@ -1949,15 +2023,15 @@ class q extends HTMLElement {
1949
2023
  * @returns True if visibility was changed, false if column not found or locked
1950
2024
  */
1951
2025
  setColumnVisible(e, t) {
1952
- const n = this.#o.columns, s = n?.find((r) => r.field === e);
1953
- if (!s || !t && s.lockVisible || !t && (n ?? []).filter((a) => !a.hidden && a.field !== e).length === 0)
2026
+ const n = this.#n.columns, i = n?.find((a) => a.field === e);
2027
+ if (!i || !t && i.lockVisible || !t && (n ?? []).filter((l) => !l.hidden && l.field !== e).length === 0)
1954
2028
  return !1;
1955
- const i = !!s.hidden, l = !t;
1956
- return i !== l ? (s.hidden = l, this.#s("column-visibility", {
2029
+ const s = !!i.hidden, r = !t;
2030
+ return s !== r ? (i.hidden = r, this.#s("column-visibility", {
1957
2031
  field: e,
1958
2032
  visible: t,
1959
- visibleColumns: (n ?? []).filter((r) => !r.hidden).map((r) => r.field)
1960
- }), this.rowPool.length = 0, this.bodyEl && (this.bodyEl.innerHTML = ""), this.__rowRenderEpoch++, this.#c(), this.requestStateChange(), !0) : !1;
2033
+ visibleColumns: (n ?? []).filter((a) => !a.hidden).map((a) => a.field)
2034
+ }), this.rowPool.length = 0, this.bodyEl && (this.bodyEl.innerHTML = ""), this.__rowRenderEpoch++, this.#d(), this.requestStateChange(), !0) : !1;
1961
2035
  }
1962
2036
  /**
1963
2037
  * Toggle the visibility of a column.
@@ -1965,8 +2039,8 @@ class q extends HTMLElement {
1965
2039
  * @returns True if visibility was toggled, false if column not found or locked
1966
2040
  */
1967
2041
  toggleColumnVisibility(e) {
1968
- const s = !!this.#o.columns?.find((i) => i.field === e)?.hidden;
1969
- return this.setColumnVisible(e, s);
2042
+ const i = !!this.#n.columns?.find((s) => s.field === e)?.hidden;
2043
+ return this.setColumnVisible(e, i);
1970
2044
  }
1971
2045
  /**
1972
2046
  * Check if a column is currently visible.
@@ -1974,19 +2048,19 @@ class q extends HTMLElement {
1974
2048
  * @returns True if visible, false if hidden or not found
1975
2049
  */
1976
2050
  isColumnVisible(e) {
1977
- const n = this.#o.columns?.find((s) => s.field === e);
2051
+ const n = this.#n.columns?.find((i) => i.field === e);
1978
2052
  return n ? !n.hidden : !1;
1979
2053
  }
1980
2054
  /**
1981
2055
  * Show all columns.
1982
2056
  */
1983
2057
  showAllColumns() {
1984
- const e = this.#o.columns;
2058
+ const e = this.#n.columns;
1985
2059
  e?.some((n) => n.hidden) && (e?.forEach((n) => {
1986
2060
  n.hidden = !1;
1987
2061
  }), this.#s("column-visibility", {
1988
2062
  visibleColumns: (e ?? []).map((n) => n.field)
1989
- }), this.rowPool.length = 0, this.bodyEl && (this.bodyEl.innerHTML = ""), this.__rowRenderEpoch++, this.#c(), this.requestStateChange());
2063
+ }), this.rowPool.length = 0, this.bodyEl && (this.bodyEl.innerHTML = ""), this.__rowRenderEpoch++, this.#d(), this.requestStateChange());
1990
2064
  }
1991
2065
  /**
1992
2066
  * Get list of all column fields (including hidden).
@@ -1995,7 +2069,7 @@ class q extends HTMLElement {
1995
2069
  * @returns Array of all field names with their visibility status
1996
2070
  */
1997
2071
  getAllColumns() {
1998
- return (this.#o.columns ?? []).map((t) => ({
2072
+ return (this.#n.columns ?? []).map((t) => ({
1999
2073
  field: t.field,
2000
2074
  header: t.header || t.field,
2001
2075
  visible: !t.hidden,
@@ -2009,14 +2083,14 @@ class q extends HTMLElement {
2009
2083
  */
2010
2084
  setColumnOrder(e) {
2011
2085
  if (!e.length) return;
2012
- const t = new Map(this._columns.map((s) => [s.field, s])), n = [];
2013
- for (const s of e) {
2014
- const i = t.get(s);
2015
- i && (n.push(i), t.delete(s));
2086
+ const t = new Map(this._columns.map((i) => [i.field, i])), n = [];
2087
+ for (const i of e) {
2088
+ const s = t.get(i);
2089
+ s && (n.push(s), t.delete(i));
2016
2090
  }
2017
- for (const s of t.values())
2018
- n.push(s);
2019
- this._columns = n, this.#x(), this.updateTemplate(), this.refreshVirtualWindow(!0);
2091
+ for (const i of t.values())
2092
+ n.push(i);
2093
+ this._columns = n, this.#T(), this.updateTemplate(), this.refreshVirtualWindow(!0);
2020
2094
  }
2021
2095
  /**
2022
2096
  * Get the current column order as an array of field names.
@@ -2039,7 +2113,7 @@ class q extends HTMLElement {
2039
2113
  * Use this to restore previously saved column state.
2040
2114
  */
2041
2115
  set columnState(e) {
2042
- e && (this.#d = e, this.#i && this.#re(e));
2116
+ e && (this.#h = e, this.#i && this.#le(e));
2043
2117
  }
2044
2118
  /**
2045
2119
  * Get the current column state.
@@ -2050,10 +2124,10 @@ class q extends HTMLElement {
2050
2124
  /**
2051
2125
  * Apply column state internally.
2052
2126
  */
2053
- #re(e) {
2054
- (this.#o.columns ?? []).forEach((n) => {
2127
+ #le(e) {
2128
+ (this.#n.columns ?? []).forEach((n) => {
2055
2129
  n.hidden = !1;
2056
- }), this.#W(e), this.#c();
2130
+ }), this.#W(e), this.#d();
2057
2131
  }
2058
2132
  /**
2059
2133
  * Request a state change event to be emitted.
@@ -2062,7 +2136,7 @@ class q extends HTMLElement {
2062
2136
  * The event is debounced to avoid excessive events during drag operations.
2063
2137
  */
2064
2138
  requestStateChange() {
2065
- this.#P || (this.#P = me(
2139
+ this.#P || (this.#P = ve(
2066
2140
  this,
2067
2141
  () => this.#t?.getAll() ?? [],
2068
2142
  (e) => this.#s("column-state-change", e)
@@ -2073,15 +2147,15 @@ class q extends HTMLElement {
2073
2147
  * Clears all user modifications (order, width, visibility, sort).
2074
2148
  */
2075
2149
  resetColumnState() {
2076
- this.#d = void 0, (this.#o.columns ?? []).forEach((n) => {
2150
+ this.#h = void 0, (this.#n.columns ?? []).forEach((n) => {
2077
2151
  n.hidden = !1;
2078
- }), this.sortState = null, this.__originalOrder = [], this.#h(), this.#c();
2152
+ }), this.sortState = null, this.__originalOrder = [], this.#u(), this.#d();
2079
2153
  const t = this.#t?.getAll() ?? [];
2080
2154
  for (const n of t)
2081
2155
  if (n.applyColumnState)
2082
- for (const s of this._columns)
2083
- n.applyColumnState(s.field, {
2084
- field: s.field,
2156
+ for (const i of this._columns)
2157
+ n.applyColumnState(i.field, {
2158
+ field: i.field,
2085
2159
  order: 0,
2086
2160
  visible: !0
2087
2161
  });
@@ -2103,7 +2177,7 @@ class q extends HTMLElement {
2103
2177
  console.warn(`[tbw-grid] Tool panel "${e}" not found`);
2104
2178
  return;
2105
2179
  }
2106
- this.#e.activePanel && this.#e.activePanel !== e && this.closeToolPanel(), this.#e.activePanel = e, oe(this.#n, this.#e), ne(this.#n, this.#e), Ue(this.#n, this.#e), this.#s("tool-panel-open", { id: e });
2180
+ this.#e.activePanel && this.#e.activePanel !== e && this.closeToolPanel(), this.#e.activePanel = e, oe(this.#o, this.#e), ne(this.#o, this.#e), je(this.#o, this.#e), this.#s("tool-panel-open", { id: e });
2107
2181
  }
2108
2182
  /**
2109
2183
  * Close the currently open tool panel.
@@ -2111,7 +2185,7 @@ class q extends HTMLElement {
2111
2185
  closeToolPanel() {
2112
2186
  if (!this.#e.activePanel) return;
2113
2187
  const e = this.#e.activePanel, t = this.#e.toolPanels.get(e);
2114
- this.#e.activePanelCleanup && (this.#e.activePanelCleanup(), this.#e.activePanelCleanup = null), t?.onClose?.(), this.#e.activePanel = null, oe(this.#n, this.#e), ne(this.#n, this.#e), this.#s("tool-panel-close", { id: e });
2188
+ this.#e.activePanelCleanup && (this.#e.activePanelCleanup(), this.#e.activePanelCleanup = null), t?.onClose?.(), this.#e.activePanel = null, oe(this.#o, this.#e), ne(this.#o, this.#e), this.#s("tool-panel-close", { id: e });
2115
2189
  }
2116
2190
  /**
2117
2191
  * Toggle a tool panel open/closed.
@@ -2133,13 +2207,13 @@ class q extends HTMLElement {
2133
2207
  console.warn(`[tbw-grid] Tool panel "${e.id}" already registered`);
2134
2208
  return;
2135
2209
  }
2136
- this.#e.toolPanels.set(e.id, e), this.#a && this.#v();
2210
+ this.#e.toolPanels.set(e.id, e), this.#c && this.#m();
2137
2211
  }
2138
2212
  /**
2139
2213
  * Unregister a custom tool panel.
2140
2214
  */
2141
2215
  unregisterToolPanel(e) {
2142
- this.#e.activePanel === e && this.closeToolPanel(), this.#e.toolPanels.delete(e), this.#a && this.#v();
2216
+ this.#e.activePanel === e && this.closeToolPanel(), this.#e.toolPanels.delete(e), this.#c && this.#m();
2143
2217
  }
2144
2218
  /**
2145
2219
  * Get registered header content definitions.
@@ -2155,20 +2229,20 @@ class q extends HTMLElement {
2155
2229
  console.warn(`[tbw-grid] Header content "${e.id}" already registered`);
2156
2230
  return;
2157
2231
  }
2158
- this.#e.headerContents.set(e.id, e), this.#a && te(this.#n, this.#e);
2232
+ this.#e.headerContents.set(e.id, e), this.#c && te(this.#o, this.#e);
2159
2233
  }
2160
2234
  /**
2161
2235
  * Unregister custom header content.
2162
2236
  */
2163
2237
  unregisterHeaderContent(e) {
2164
2238
  const t = this.#e.headerContentCleanups.get(e);
2165
- t && (t(), this.#e.headerContentCleanups.delete(e)), this.#e.headerContents.get(e)?.onDestroy?.(), this.#e.headerContents.delete(e), this.#n.querySelector(`[data-header-content="${e}"]`)?.remove();
2239
+ t && (t(), this.#e.headerContentCleanups.delete(e)), this.#e.headerContents.get(e)?.onDestroy?.(), this.#e.headerContents.delete(e), this.#o.querySelector(`[data-header-content="${e}"]`)?.remove();
2166
2240
  }
2167
2241
  /**
2168
2242
  * Get all registered toolbar buttons.
2169
2243
  */
2170
2244
  getToolbarButtons() {
2171
- return Xe(this.#o?.shell, this.#e);
2245
+ return Ye(this.#n?.shell, this.#e);
2172
2246
  }
2173
2247
  /**
2174
2248
  * Register a custom toolbar button programmatically.
@@ -2178,14 +2252,14 @@ class q extends HTMLElement {
2178
2252
  console.warn(`[tbw-grid] Toolbar button "${e.id}" already registered`);
2179
2253
  return;
2180
2254
  }
2181
- this.#e.toolbarButtons.set(e.id, e), this.#a && this.#v();
2255
+ this.#e.toolbarButtons.set(e.id, e), this.#c && this.#m();
2182
2256
  }
2183
2257
  /**
2184
2258
  * Unregister a custom toolbar button.
2185
2259
  */
2186
2260
  unregisterToolbarButton(e) {
2187
2261
  const t = this.#e.toolbarButtonCleanups.get(e);
2188
- t && (t(), this.#e.toolbarButtonCleanups.delete(e)), this.#e.toolbarButtons.delete(e), this.#a && this.#v();
2262
+ t && (t(), this.#e.toolbarButtonCleanups.delete(e)), this.#e.toolbarButtons.delete(e), this.#c && this.#m();
2189
2263
  }
2190
2264
  /**
2191
2265
  * Enable/disable a toolbar button by ID.
@@ -2193,20 +2267,20 @@ class q extends HTMLElement {
2193
2267
  setToolbarButtonDisabled(e, t) {
2194
2268
  const n = this.#e.toolbarButtons.get(e);
2195
2269
  n && (n.disabled = t);
2196
- const s = this.#n.querySelector(`[data-btn="${e}"]`);
2197
- s && (s.disabled = t);
2270
+ const i = this.#o.querySelector(`[data-btn="${e}"]`);
2271
+ i && (i.disabled = t);
2198
2272
  }
2199
2273
  /**
2200
2274
  * Re-parse light DOM shell elements and refresh shell header.
2201
2275
  * Call this after dynamically modifying <tbw-grid-header> children.
2202
2276
  */
2203
2277
  refreshShellHeader() {
2204
- this.#v();
2278
+ this.#m();
2205
2279
  }
2206
2280
  /**
2207
2281
  * Internal shell header refresh.
2208
2282
  */
2209
- #v() {
2283
+ #m() {
2210
2284
  ee(this, this.#e), this.#F(), this.#$();
2211
2285
  }
2212
2286
  // ---------------- Virtual Window ----------------
@@ -2218,26 +2292,36 @@ class q extends HTMLElement {
2218
2292
  if (!this.bodyEl) return;
2219
2293
  const t = this._rows.length;
2220
2294
  if (!this.virtualization.enabled) {
2221
- this.#M(0, t), this.#m();
2295
+ this.#H(0, t), this.#b();
2222
2296
  return;
2223
2297
  }
2224
2298
  if (this.#oe()) {
2225
- this.virtualization.start = 0, this.virtualization.end = t, this.bodyEl.style.transform = "translateY(0px)", this.#M(0, t, this.__rowRenderEpoch), this.virtualization.totalHeightEl && (this.virtualization.totalHeightEl.style.height = `${t * this.virtualization.rowHeight}px`), this.setAttribute("aria-rowcount", String(t)), this.setAttribute("aria-colcount", String(this.visibleColumns.length)), this.#m();
2299
+ this.virtualization.start = 0, this.virtualization.end = t, this.bodyEl.style.transform = "translateY(0px)", this.#H(0, t, this.__rowRenderEpoch), this.virtualization.totalHeightEl && (this.virtualization.totalHeightEl.style.height = `${t * this.virtualization.rowHeight}px`), this.setAttribute("aria-rowcount", String(t)), this.setAttribute("aria-colcount", String(this.visibleColumns.length)), this.#b();
2226
2300
  return;
2227
2301
  }
2228
- const n = this.virtualization.container ?? this, i = (this.virtualization.viewportEl ?? n).clientHeight, l = this.virtualization.rowHeight, r = n.scrollTop;
2229
- let a = Math.floor(r / l);
2230
- a < 0 && (a = 0);
2231
- const f = Math.ceil(i / l) + 2;
2232
- let p = a + f;
2233
- p > t && (p = t), this.virtualization.start = a, this.virtualization.end = p, this.virtualization.totalHeightEl && (this.virtualization.totalHeightEl.style.height = `${t * l}px`);
2234
- const w = -(r % l);
2235
- this.bodyEl.style.transform = `translateY(${w}px)`, this.#M(a, p, e ? ++this.__rowRenderEpoch : this.__rowRenderEpoch), this.setAttribute("aria-rowcount", String(t)), this.setAttribute("aria-colcount", String(this.visibleColumns.length)), e && this.#m();
2302
+ const n = this.virtualization.container ?? this, s = (this.virtualization.viewportEl ?? n).clientHeight, r = this.virtualization.rowHeight, a = n.scrollTop;
2303
+ let l = Math.floor(a / r), f = 0;
2304
+ const p = 10;
2305
+ for (; f < p; ) {
2306
+ const R = this.#t?.getExtraHeightBefore?.(l) ?? 0, E = Math.floor((a - R) / r);
2307
+ if (E >= l || E < 0) break;
2308
+ l = E, f++;
2309
+ }
2310
+ l = l - l % 2, l < 0 && (l = 0);
2311
+ const g = this.#t?.adjustVirtualStart(l, a, r);
2312
+ g !== void 0 && g < l && (l = g, l = l - l % 2, l < 0 && (l = 0));
2313
+ const h = Math.ceil(s / r) + 3;
2314
+ let c = l + h;
2315
+ c > t && (c = t), this.virtualization.start = l, this.virtualization.end = c;
2316
+ const d = this.#o.querySelector(".tbw-footer")?.offsetHeight ?? 0, b = this.#t?.getExtraHeight() ?? 0;
2317
+ this.virtualization.totalHeightEl && (this.virtualization.totalHeightEl.style.height = `${t * r + r + d + b}px`);
2318
+ const m = this.#t?.getExtraHeightBefore?.(l) ?? 0, C = -(a - l * r - m);
2319
+ this.bodyEl.style.transform = `translateY(${C}px)`, this.#H(l, c, e ? ++this.__rowRenderEpoch : this.__rowRenderEpoch), this.setAttribute("aria-rowcount", String(t)), this.setAttribute("aria-colcount", String(this.visibleColumns.length)), e && this.#b();
2236
2320
  }
2237
2321
  // ---------------- Render ----------------
2238
2322
  #F() {
2239
2323
  ee(this, this.#e);
2240
- const e = this.#o?.shell, t = Ke(e, this.#e), n = `
2324
+ const e = this.#n?.shell, t = Fe(e, this.#e), n = `
2241
2325
  <div class="tbw-scroll-area">
2242
2326
  <div class="rows-body-wrapper">
2243
2327
  <div class="rows-body">
@@ -2257,15 +2341,15 @@ class q extends HTMLElement {
2257
2341
  </div>
2258
2342
  `;
2259
2343
  if (t) {
2260
- const s = We(e, this.#e), i = Fe(e, this.#e, n);
2261
- this.#n.innerHTML = `
2344
+ const i = Ve(e, this.#e), s = Ge(e, this.#e, n);
2345
+ this.#o.innerHTML = `
2262
2346
  <div class="tbw-grid-root has-shell">
2263
- ${s}
2264
2347
  ${i}
2348
+ ${s}
2265
2349
  </div>
2266
- `, this.#ae(), this.#a = !0;
2350
+ `, this.#ae(), this.#c = !0;
2267
2351
  } else
2268
- this.#n.innerHTML = `
2352
+ this.#o.innerHTML = `
2269
2353
  <div class="tbw-grid-root">
2270
2354
  <div class="tbw-grid-content">
2271
2355
  ${n}
@@ -2277,7 +2361,7 @@ class q extends HTMLElement {
2277
2361
  * Set up shell event listeners after render.
2278
2362
  */
2279
2363
  #ae() {
2280
- Ve(this.#n, this.#o?.shell, this.#e, {
2364
+ Ue(this.#o, this.#n?.shell, this.#e, {
2281
2365
  onPanelToggle: (e) => this.toggleToolPanel(e),
2282
2366
  onPanelClose: () => this.closeToolPanel(),
2283
2367
  onToolbarButtonClick: (e) => this.#ce(e)
@@ -2287,17 +2371,17 @@ class q extends HTMLElement {
2287
2371
  * Handle toolbar button click (for config buttons with action).
2288
2372
  */
2289
2373
  #ce(e) {
2290
- const n = (this.#o?.shell?.header?.toolbarButtons ?? []).find((i) => i.id === e);
2374
+ const n = (this.#n?.shell?.header?.toolbarButtons ?? []).find((s) => s.id === e);
2291
2375
  if (n?.action) {
2292
2376
  n.action();
2293
2377
  return;
2294
2378
  }
2295
- const s = this.#e.toolbarButtons.get(e);
2296
- s?.action && s.action();
2379
+ const i = this.#e.toolbarButtons.get(e);
2380
+ i?.action && i.action();
2297
2381
  }
2298
2382
  }
2299
- customElements.get(q.tagName) || customElements.define(q.tagName, q);
2300
- class ue {
2383
+ customElements.get(I.tagName) || customElements.define(I.tagName, I);
2384
+ class fe {
2301
2385
  /** Plugin version - override in subclass if needed */
2302
2386
  version = "1.0.0";
2303
2387
  /** CSS styles to inject into the grid's shadow DOM */
@@ -2396,6 +2480,55 @@ class ue {
2396
2480
  get shadowRoot() {
2397
2481
  return this.grid?.shadowRoot ?? null;
2398
2482
  }
2483
+ /**
2484
+ * Get the disconnect signal for event listener cleanup.
2485
+ * This signal is aborted when the grid disconnects from the DOM.
2486
+ * Use this when adding event listeners that should be cleaned up automatically.
2487
+ *
2488
+ * Best for:
2489
+ * - Document/window-level listeners added in attach()
2490
+ * - Listeners on the grid element itself
2491
+ * - Any listener that should persist across renders
2492
+ *
2493
+ * Not needed for:
2494
+ * - Listeners on elements created in afterRender() (removed with element)
2495
+ *
2496
+ * @example
2497
+ * element.addEventListener('click', handler, { signal: this.disconnectSignal });
2498
+ * document.addEventListener('keydown', handler, { signal: this.disconnectSignal });
2499
+ */
2500
+ get disconnectSignal() {
2501
+ return this.grid?.disconnectSignal;
2502
+ }
2503
+ /**
2504
+ * Get the grid-level icons configuration.
2505
+ * Returns merged icons (user config + defaults).
2506
+ */
2507
+ get gridIcons() {
2508
+ const e = this.grid?.gridConfig?.icons ?? {};
2509
+ return { ...ce, ...e };
2510
+ }
2511
+ /**
2512
+ * Resolve an icon value to string or HTMLElement.
2513
+ * Checks plugin config first, then grid-level icons, then defaults.
2514
+ *
2515
+ * @param iconKey - The icon key in GridIcons (e.g., 'expand', 'collapse')
2516
+ * @param pluginOverride - Optional plugin-level override
2517
+ * @returns The resolved icon value
2518
+ */
2519
+ resolveIcon(e, t) {
2520
+ return t !== void 0 ? t : this.gridIcons[e];
2521
+ }
2522
+ /**
2523
+ * Set an icon value on an element.
2524
+ * Handles both string (text/HTML) and HTMLElement values.
2525
+ *
2526
+ * @param element - The element to set the icon on
2527
+ * @param icon - The icon value (string or HTMLElement)
2528
+ */
2529
+ setIcon(e, t) {
2530
+ typeof t == "string" ? e.innerHTML = t : t instanceof HTMLElement && (e.innerHTML = "", e.appendChild(t.cloneNode(!0)));
2531
+ }
2399
2532
  /**
2400
2533
  * Log a warning message.
2401
2534
  */
@@ -2403,7 +2536,7 @@ class ue {
2403
2536
  console.warn(`[tbw-grid:${this.name}] ${e}`);
2404
2537
  }
2405
2538
  }
2406
- function z(o) {
2539
+ function N(o) {
2407
2540
  return {
2408
2541
  startRow: Math.min(o.startRow, o.endRow),
2409
2542
  startCol: Math.min(o.startCol, o.endCol),
@@ -2411,34 +2544,34 @@ function z(o) {
2411
2544
  endCol: Math.max(o.startCol, o.endCol)
2412
2545
  };
2413
2546
  }
2414
- function Ze(o) {
2415
- const e = z(o);
2547
+ function Qe(o) {
2548
+ const e = N(o);
2416
2549
  return {
2417
2550
  from: { row: e.startRow, col: e.startCol },
2418
2551
  to: { row: e.endRow, col: e.endCol }
2419
2552
  };
2420
2553
  }
2421
2554
  function K(o) {
2422
- return o.map(Ze);
2555
+ return o.map(Qe);
2423
2556
  }
2424
- function Je(o, e, t) {
2425
- const n = z(t);
2557
+ function et(o, e, t) {
2558
+ const n = N(t);
2426
2559
  return o >= n.startRow && o <= n.endRow && e >= n.startCol && e <= n.endCol;
2427
2560
  }
2428
2561
  function ie(o, e, t) {
2429
- return t.some((n) => Je(o, e, n));
2562
+ return t.some((n) => et(o, e, n));
2430
2563
  }
2431
- function Qe(o) {
2432
- const e = [], t = z(o);
2564
+ function tt(o) {
2565
+ const e = [], t = N(o);
2433
2566
  for (let n = t.startRow; n <= t.endRow; n++)
2434
- for (let s = t.startCol; s <= t.endCol; s++)
2435
- e.push({ row: n, col: s });
2567
+ for (let i = t.startCol; i <= t.endCol; i++)
2568
+ e.push({ row: n, col: i });
2436
2569
  return e;
2437
2570
  }
2438
- function et(o) {
2571
+ function ot(o) {
2439
2572
  const e = /* @__PURE__ */ new Map();
2440
2573
  for (const t of o)
2441
- for (const n of Qe(t))
2574
+ for (const n of tt(t))
2442
2575
  e.set(`${n.row},${n.col}`, n);
2443
2576
  return [...e.values()];
2444
2577
  }
@@ -2450,7 +2583,7 @@ function se(o, e) {
2450
2583
  endCol: e.col
2451
2584
  };
2452
2585
  }
2453
- function tt(o, e, t) {
2586
+ function nt(o, e, t) {
2454
2587
  if (o === "cell" && e.selectedCell)
2455
2588
  return {
2456
2589
  mode: o,
@@ -2462,15 +2595,15 @@ function tt(o, e, t) {
2462
2595
  ]
2463
2596
  };
2464
2597
  if (o === "row" && e.selected.size > 0) {
2465
- const n = [...e.selected].map((s) => ({
2466
- from: { row: s, col: 0 },
2467
- to: { row: s, col: t - 1 }
2598
+ const n = [...e.selected].map((i) => ({
2599
+ from: { row: i, col: 0 },
2600
+ to: { row: i, col: t - 1 }
2468
2601
  }));
2469
2602
  return { mode: o, ranges: n };
2470
2603
  }
2471
2604
  return o === "range" && e.ranges.length > 0 ? { mode: o, ranges: K(e.ranges) } : { mode: o, ranges: [] };
2472
2605
  }
2473
- class st extends ue {
2606
+ class lt extends fe {
2474
2607
  name = "selection";
2475
2608
  version = "1.0.0";
2476
2609
  get defaultConfig() {
@@ -2496,32 +2629,32 @@ class st extends ue {
2496
2629
  }
2497
2630
  // ===== Event Handlers =====
2498
2631
  onCellClick(e) {
2499
- const { rowIndex: t, colIndex: n, originalEvent: s } = e, { mode: i } = this.config;
2500
- if (i === "cell")
2632
+ const { rowIndex: t, colIndex: n, originalEvent: i } = e, { mode: s } = this.config;
2633
+ if (s === "cell")
2501
2634
  return this.selectedCell = { row: t, col: n }, this.emit("selection-change", this.#i()), this.requestAfterRender(), !1;
2502
- if (i === "row")
2635
+ if (s === "row")
2503
2636
  return this.selected.clear(), this.selected.add(t), this.lastSelected = t, this.emit("selection-change", this.#i()), this.requestAfterRender(), !1;
2504
- if (i === "range") {
2505
- const l = s.shiftKey, r = s.ctrlKey || s.metaKey;
2506
- if (l && this.cellAnchor) {
2507
- const a = se(this.cellAnchor, { row: t, col: n });
2508
- r ? this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = a : this.ranges.push(a) : this.ranges = [a], this.activeRange = a;
2509
- } else if (r) {
2510
- const a = {
2637
+ if (s === "range") {
2638
+ const r = i.shiftKey, a = i.ctrlKey || i.metaKey;
2639
+ if (r && this.cellAnchor) {
2640
+ const l = se(this.cellAnchor, { row: t, col: n });
2641
+ a ? this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = l : this.ranges.push(l) : this.ranges = [l], this.activeRange = l;
2642
+ } else if (a) {
2643
+ const l = {
2511
2644
  startRow: t,
2512
2645
  startCol: n,
2513
2646
  endRow: t,
2514
2647
  endCol: n
2515
2648
  };
2516
- this.ranges.push(a), this.activeRange = a, this.cellAnchor = { row: t, col: n };
2649
+ this.ranges.push(l), this.activeRange = l, this.cellAnchor = { row: t, col: n };
2517
2650
  } else {
2518
- const a = {
2651
+ const l = {
2519
2652
  startRow: t,
2520
2653
  startCol: n,
2521
2654
  endRow: t,
2522
2655
  endCol: n
2523
2656
  };
2524
- this.ranges = [a], this.activeRange = a, this.cellAnchor = { row: t, col: n };
2657
+ this.ranges = [l], this.activeRange = l, this.cellAnchor = { row: t, col: n };
2525
2658
  }
2526
2659
  return this.emit("selection-change", this.#i()), this.requestAfterRender(), !1;
2527
2660
  }
@@ -2532,15 +2665,15 @@ class st extends ue {
2532
2665
  if (e.key === "Escape")
2533
2666
  return t === "cell" ? this.selectedCell = null : t === "row" ? (this.selected.clear(), this.anchor = null) : t === "range" && (this.ranges = [], this.activeRange = null, this.cellAnchor = null), this.emit("selection-change", this.#i()), this.requestAfterRender(), !0;
2534
2667
  if (t === "range" && e.key === "a" && (e.ctrlKey || e.metaKey)) {
2535
- const n = this.rows.length, s = this.columns.length;
2536
- if (n > 0 && s > 0) {
2537
- const i = {
2668
+ const n = this.rows.length, i = this.columns.length;
2669
+ if (n > 0 && i > 0) {
2670
+ const s = {
2538
2671
  startRow: 0,
2539
2672
  startCol: 0,
2540
2673
  endRow: n - 1,
2541
- endCol: s - 1
2674
+ endCol: i - 1
2542
2675
  };
2543
- return this.ranges = [i], this.activeRange = i, this.emit("selection-change", this.#i()), this.requestAfterRender(), !0;
2676
+ return this.ranges = [s], this.activeRange = s, this.emit("selection-change", this.#i()), this.requestAfterRender(), !0;
2544
2677
  }
2545
2678
  }
2546
2679
  return !1;
@@ -2551,13 +2684,13 @@ class st extends ue {
2551
2684
  this.isDragging = !0;
2552
2685
  const t = e.rowIndex, n = e.colIndex;
2553
2686
  this.cellAnchor = { row: t, col: n }, e.originalEvent.ctrlKey || e.originalEvent.metaKey || (this.ranges = []);
2554
- const i = {
2687
+ const s = {
2555
2688
  startRow: t,
2556
2689
  startCol: n,
2557
2690
  endRow: t,
2558
2691
  endCol: n
2559
2692
  };
2560
- return this.ranges.push(i), this.activeRange = i, this.emit("selection-change", this.#i()), this.requestAfterRender(), !0;
2693
+ return this.ranges.push(s), this.activeRange = s, this.emit("selection-change", this.#i()), this.requestAfterRender(), !0;
2561
2694
  }
2562
2695
  onCellMouseMove(e) {
2563
2696
  if (this.config.mode !== "range" || !this.isDragging || !this.cellAnchor || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
@@ -2572,40 +2705,40 @@ class st extends ue {
2572
2705
  * Apply selection classes to visible cells/rows.
2573
2706
  * Shared by afterRender and onScrollRender.
2574
2707
  */
2575
- #n() {
2708
+ #o() {
2576
2709
  const e = this.shadowRoot;
2577
2710
  if (!e) return;
2578
2711
  const { mode: t } = this.config;
2579
- e.querySelectorAll(".cell").forEach((i) => {
2580
- i.classList.remove("selected", "top", "bottom", "first", "last");
2712
+ e.querySelectorAll(".cell").forEach((s) => {
2713
+ s.classList.remove("selected", "top", "bottom", "first", "last");
2581
2714
  });
2582
- const s = e.querySelectorAll(".data-grid-row");
2583
- if (s.forEach((i) => {
2584
- i.classList.remove("selected", "row-focus");
2585
- }), t === "row" && s.forEach((i) => {
2586
- const l = i.querySelector(".cell[data-row]"), r = parseInt(l?.getAttribute("data-row") ?? "-1", 10);
2587
- r >= 0 && this.selected.has(r) && (i.classList.add("selected", "row-focus"), i.querySelectorAll(".cell-focus").forEach((a) => a.classList.remove("cell-focus")));
2715
+ const i = e.querySelectorAll(".data-grid-row");
2716
+ if (i.forEach((s) => {
2717
+ s.classList.remove("selected", "row-focus");
2718
+ }), t === "row" && i.forEach((s) => {
2719
+ const r = s.querySelector(".cell[data-row]"), a = parseInt(r?.getAttribute("data-row") ?? "-1", 10);
2720
+ a >= 0 && this.selected.has(a) && (s.classList.add("selected", "row-focus"), s.querySelectorAll(".cell-focus").forEach((l) => l.classList.remove("cell-focus")));
2588
2721
  }), t === "range" && this.ranges.length > 0) {
2589
- const i = this.activeRange ? z(this.activeRange) : null;
2590
- e.querySelectorAll(".cell[data-row][data-col]").forEach((r) => {
2591
- const a = parseInt(r.getAttribute("data-row") ?? "-1", 10), f = parseInt(r.getAttribute("data-col") ?? "-1", 10);
2592
- a >= 0 && f >= 0 && ie(a, f, this.ranges) && (r.classList.add("selected"), r.classList.remove("cell-focus"), i && (a === i.startRow && r.classList.add("top"), a === i.endRow && r.classList.add("bottom"), f === i.startCol && r.classList.add("first"), f === i.endCol && r.classList.add("last")));
2722
+ const s = this.activeRange ? N(this.activeRange) : null;
2723
+ e.querySelectorAll(".cell[data-row][data-col]").forEach((a) => {
2724
+ const l = parseInt(a.getAttribute("data-row") ?? "-1", 10), f = parseInt(a.getAttribute("data-col") ?? "-1", 10);
2725
+ l >= 0 && f >= 0 && ie(l, f, this.ranges) && (a.classList.add("selected"), a.classList.remove("cell-focus"), s && (l === s.startRow && a.classList.add("top"), l === s.endRow && a.classList.add("bottom"), f === s.startCol && a.classList.add("first"), f === s.endCol && a.classList.add("last")));
2593
2726
  });
2594
2727
  }
2595
- t === "cell" && this.selectedCell && e.querySelectorAll(".cell-focus").forEach((i) => i.classList.remove("cell-focus"));
2728
+ t === "cell" && this.selectedCell && e.querySelectorAll(".cell-focus").forEach((s) => s.classList.remove("cell-focus"));
2596
2729
  }
2597
2730
  afterRender() {
2598
2731
  const e = this.shadowRoot;
2599
2732
  if (!e) return;
2600
2733
  const t = e.children[0], { mode: n } = this.config;
2601
- this.grid.setAttribute("data-selection-mode", n), t && t.classList.toggle("selecting", this.isDragging), this.#n();
2734
+ this.grid.setAttribute("data-selection-mode", n), t && t.classList.toggle("selecting", this.isDragging), this.#o();
2602
2735
  }
2603
2736
  /**
2604
2737
  * Called after scroll-triggered row rendering.
2605
2738
  * Reapplies selection classes to recycled DOM elements.
2606
2739
  */
2607
2740
  onScrollRender() {
2608
- this.#n();
2741
+ this.#o();
2609
2742
  }
2610
2743
  // ===== Public API =====
2611
2744
  /**
@@ -2630,7 +2763,7 @@ class st extends ue {
2630
2763
  * Get all selected cells across all ranges.
2631
2764
  */
2632
2765
  getSelectedCells() {
2633
- return et(this.ranges);
2766
+ return ot(this.ranges);
2634
2767
  }
2635
2768
  /**
2636
2769
  * Check if a specific cell is in range selection.
@@ -2660,7 +2793,7 @@ class st extends ue {
2660
2793
  }
2661
2794
  // ===== Private Helpers =====
2662
2795
  #i() {
2663
- return tt(
2796
+ return nt(
2664
2797
  this.config.mode,
2665
2798
  {
2666
2799
  selectedCell: this.selectedCell,
@@ -2708,74 +2841,74 @@ class st extends ue {
2708
2841
  function G(o, e, t) {
2709
2842
  return o.id !== void 0 ? String(o.id) : t ? `${t}-${e}` : String(e);
2710
2843
  }
2711
- function fe(o, e, t, n = null, s = 0) {
2712
- const i = e.childrenField ?? "children", l = [];
2713
- for (let r = 0; r < o.length; r++) {
2714
- const a = o[r], f = G(a, r, n), p = a[i], w = Array.isArray(p) && p.length > 0, h = t.has(f);
2715
- if (l.push({
2844
+ function pe(o, e, t, n = null, i = 0) {
2845
+ const s = e.childrenField ?? "children", r = [];
2846
+ for (let a = 0; a < o.length; a++) {
2847
+ const l = o[a], f = G(l, a, n), p = l[s], g = Array.isArray(p) && p.length > 0, h = t.has(f);
2848
+ if (r.push({
2716
2849
  key: f,
2717
- data: a,
2718
- depth: s,
2719
- hasChildren: w,
2850
+ data: l,
2851
+ depth: i,
2852
+ hasChildren: g,
2720
2853
  isExpanded: h,
2721
2854
  parentKey: n
2722
- }), w && h) {
2723
- const c = fe(p, e, t, f, s + 1);
2724
- l.push(...c);
2855
+ }), g && h) {
2856
+ const c = pe(p, e, t, f, i + 1);
2857
+ r.push(...c);
2725
2858
  }
2726
2859
  }
2727
- return l;
2860
+ return r;
2728
2861
  }
2729
- function le(o, e) {
2862
+ function re(o, e) {
2730
2863
  const t = new Set(o);
2731
2864
  return t.has(e) ? t.delete(e) : t.add(e), t;
2732
2865
  }
2733
2866
  function W(o, e, t = null, n = 0) {
2734
- const s = e.childrenField ?? "children", i = /* @__PURE__ */ new Set();
2735
- for (let l = 0; l < o.length; l++) {
2736
- const r = o[l], a = G(r, l, t), f = r[s];
2867
+ const i = e.childrenField ?? "children", s = /* @__PURE__ */ new Set();
2868
+ for (let r = 0; r < o.length; r++) {
2869
+ const a = o[r], l = G(a, r, t), f = a[i];
2737
2870
  if (Array.isArray(f) && f.length > 0) {
2738
- i.add(a);
2739
- const p = W(f, e, a, n + 1);
2740
- for (const w of p) i.add(w);
2871
+ s.add(l);
2872
+ const p = W(f, e, l, n + 1);
2873
+ for (const g of p) s.add(g);
2741
2874
  }
2742
2875
  }
2743
- return i;
2876
+ return s;
2744
2877
  }
2745
- function ot() {
2878
+ function it() {
2746
2879
  return /* @__PURE__ */ new Set();
2747
2880
  }
2748
- function pe(o, e, t, n = null, s = 0) {
2749
- const i = t.childrenField ?? "children";
2750
- for (let l = 0; l < o.length; l++) {
2751
- const r = o[l], a = G(r, l, n);
2752
- if (a === e)
2753
- return [a];
2754
- const f = r[i];
2881
+ function ge(o, e, t, n = null, i = 0) {
2882
+ const s = t.childrenField ?? "children";
2883
+ for (let r = 0; r < o.length; r++) {
2884
+ const a = o[r], l = G(a, r, n);
2885
+ if (l === e)
2886
+ return [l];
2887
+ const f = a[s];
2755
2888
  if (Array.isArray(f) && f.length > 0) {
2756
- const p = pe(f, e, t, a, s + 1);
2889
+ const p = ge(f, e, t, l, i + 1);
2757
2890
  if (p)
2758
- return [a, ...p];
2891
+ return [l, ...p];
2759
2892
  }
2760
2893
  }
2761
2894
  return null;
2762
2895
  }
2763
- function nt(o, e, t, n) {
2764
- const s = pe(o, e, t);
2765
- if (!s) return n;
2766
- const i = new Set(n);
2767
- for (let l = 0; l < s.length - 1; l++)
2768
- i.add(s[l]);
2769
- return i;
2896
+ function st(o, e, t, n) {
2897
+ const i = ge(o, e, t);
2898
+ if (!i) return n;
2899
+ const s = new Set(n);
2900
+ for (let r = 0; r < i.length - 1; r++)
2901
+ s.add(i[r]);
2902
+ return s;
2770
2903
  }
2771
- function re(o, e = "children") {
2904
+ function le(o, e = "children") {
2772
2905
  if (!Array.isArray(o) || o.length === 0) return !1;
2773
2906
  for (const t of o)
2774
2907
  if (t && Array.isArray(t[e]) && t[e].length > 0)
2775
2908
  return !0;
2776
2909
  return !1;
2777
2910
  }
2778
- function it(o) {
2911
+ function rt(o) {
2779
2912
  if (!Array.isArray(o) || o.length === 0) return null;
2780
2913
  const e = ["children", "items", "nodes", "subRows", "nested"];
2781
2914
  for (const t of o)
@@ -2786,7 +2919,7 @@ function it(o) {
2786
2919
  }
2787
2920
  return null;
2788
2921
  }
2789
- class lt extends ue {
2922
+ class at extends fe {
2790
2923
  name = "tree";
2791
2924
  version = "1.0.0";
2792
2925
  get defaultConfig() {
@@ -2819,15 +2952,15 @@ class lt extends ue {
2819
2952
  */
2820
2953
  detect(e) {
2821
2954
  if (!this.config.autoDetect) return !1;
2822
- const t = this.config.childrenField ?? it(e) ?? "children";
2823
- return re(e, t);
2955
+ const t = this.config.childrenField ?? rt(e) ?? "children";
2956
+ return le(e, t);
2824
2957
  }
2825
2958
  // ===== Data Processing =====
2826
2959
  processRows(e) {
2827
2960
  const t = this.config.childrenField ?? "children";
2828
- if (!re(e, t))
2961
+ if (!le(e, t))
2829
2962
  return this.flattenedRows = [], this.rowKeyMap.clear(), [...e];
2830
- this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = W(e, this.config), this.initialExpansionDone = !0), this.flattenedRows = fe(e, this.config, this.expandedKeys), this.rowKeyMap.clear();
2963
+ this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = W(e, this.config), this.initialExpansionDone = !0), this.flattenedRows = pe(e, this.config, this.expandedKeys), this.rowKeyMap.clear();
2831
2964
  for (const n of this.flattenedRows)
2832
2965
  this.rowKeyMap.set(n.key, n);
2833
2966
  return this.flattenedRows.map((n) => ({
@@ -2840,28 +2973,31 @@ class lt extends ue {
2840
2973
  }
2841
2974
  processColumns(e) {
2842
2975
  if (this.flattenedRows.length === 0) return [...e];
2843
- const t = this.config.indentWidth ?? 20, n = this.config.showExpandIcons ?? !0, s = [...e];
2844
- if (s.length > 0) {
2845
- const i = { ...s[0] }, l = i.viewRenderer;
2846
- i.viewRenderer = (r) => {
2847
- const { value: a, row: f, column: p } = r, w = f.__treeDepth ?? 0, h = f.__treeHasChildren ?? !1, c = f.__treeExpanded ?? !1, d = document.createElement("span");
2848
- if (d.style.display = "flex", d.style.alignItems = "center", d.style.paddingLeft = `${w * t}px`, h && n) {
2849
- const b = document.createElement("span");
2850
- b.className = "tree-toggle", b.textContent = c ? "" : "▶", b.style.cursor = "pointer", b.style.marginRight = "4px", b.style.fontSize = "10px", b.setAttribute("data-tree-key", f.__treeKey), d.appendChild(b);
2976
+ const t = this.config.indentWidth ?? 20, n = this.config.showExpandIcons ?? !0, i = [...e];
2977
+ if (i.length > 0) {
2978
+ const s = { ...i[0] }, r = s.viewRenderer;
2979
+ if (r?.__treeWrapped)
2980
+ return i;
2981
+ const a = (l) => {
2982
+ const { value: f, row: p, column: g } = l, h = p.__treeDepth ?? 0, c = p.__treeHasChildren ?? !1, u = p.__treeExpanded ?? !1, d = document.createElement("span");
2983
+ if (d.style.display = "flex", d.style.alignItems = "center", d.style.paddingLeft = `${h * t}px`, c && n) {
2984
+ const m = document.createElement("span");
2985
+ m.className = "tree-toggle", this.setIcon(m, this.resolveIcon(u ? "collapse" : "expand")), m.style.cursor = "pointer", m.style.marginRight = "4px", m.style.fontSize = "10px", m.setAttribute("data-tree-key", p.__treeKey), d.appendChild(m);
2851
2986
  } else if (n) {
2852
- const b = document.createElement("span");
2853
- b.style.width = "14px", b.style.display = "inline-block", d.appendChild(b);
2987
+ const m = document.createElement("span");
2988
+ m.style.width = "14px", m.style.display = "inline-block", d.appendChild(m);
2854
2989
  }
2855
- const u = document.createElement("span");
2856
- if (l) {
2857
- const b = l(r);
2858
- b instanceof Node ? u.appendChild(b) : u.textContent = String(b ?? a ?? "");
2990
+ const b = document.createElement("span");
2991
+ if (r) {
2992
+ const m = r(l);
2993
+ m instanceof Node ? b.appendChild(m) : b.textContent = String(m ?? f ?? "");
2859
2994
  } else
2860
- u.textContent = String(a ?? "");
2861
- return d.appendChild(u), d;
2862
- }, s[0] = i;
2995
+ b.textContent = String(f ?? "");
2996
+ return d.appendChild(b), d;
2997
+ };
2998
+ a.__treeWrapped = !0, s.viewRenderer = a, i[0] = s;
2863
2999
  }
2864
- return s;
3000
+ return i;
2865
3001
  }
2866
3002
  // ===== Event Handlers =====
2867
3003
  onCellClick(e) {
@@ -2869,12 +3005,12 @@ class lt extends ue {
2869
3005
  if (!t?.classList.contains("tree-toggle")) return !1;
2870
3006
  const n = t.getAttribute("data-tree-key");
2871
3007
  if (!n) return !1;
2872
- const s = this.rowKeyMap.get(n);
2873
- return s ? (this.expandedKeys = le(this.expandedKeys, n), this.emit("tree-expand", {
3008
+ const i = this.rowKeyMap.get(n);
3009
+ return i ? (this.expandedKeys = re(this.expandedKeys, n), this.emit("tree-expand", {
2874
3010
  key: n,
2875
- row: s.data,
3011
+ row: i.data,
2876
3012
  expanded: this.expandedKeys.has(n),
2877
- depth: s.depth
3013
+ depth: i.depth
2878
3014
  }), this.requestRender(), !0) : !1;
2879
3015
  }
2880
3016
  // ===== Public API =====
@@ -2894,7 +3030,7 @@ class lt extends ue {
2894
3030
  * Toggle the expansion state of a node.
2895
3031
  */
2896
3032
  toggle(e) {
2897
- this.expandedKeys = le(this.expandedKeys, e), this.requestRender();
3033
+ this.expandedKeys = re(this.expandedKeys, e), this.requestRender();
2898
3034
  }
2899
3035
  /**
2900
3036
  * Expand all nodes in the tree.
@@ -2906,7 +3042,7 @@ class lt extends ue {
2906
3042
  * Collapse all nodes in the tree.
2907
3043
  */
2908
3044
  collapseAll() {
2909
- this.expandedKeys = ot(), this.requestRender();
3045
+ this.expandedKeys = it(), this.requestRender();
2910
3046
  }
2911
3047
  /**
2912
3048
  * Check if a node is currently expanded.
@@ -2936,7 +3072,7 @@ class lt extends ue {
2936
3072
  * Expand all ancestors of a node to make it visible.
2937
3073
  */
2938
3074
  expandToKey(e) {
2939
- this.expandedKeys = nt(this.rows, e, this.config, this.expandedKeys), this.requestRender();
3075
+ this.expandedKeys = st(this.rows, e, this.config, this.expandedKeys), this.requestRender();
2940
3076
  }
2941
3077
  // ===== Styles =====
2942
3078
  styles = `
@@ -2950,7 +3086,7 @@ class lt extends ue {
2950
3086
  }
2951
3087
  `;
2952
3088
  }
2953
- const C = {
3089
+ const y = {
2954
3090
  // Root structure
2955
3091
  ROOT: "tbw-grid-root",
2956
3092
  HEADER: "header",
@@ -2995,31 +3131,31 @@ const C = {
2995
3131
  // Selection
2996
3132
  RANGE_SELECTION: "range-selection",
2997
3133
  SELECTION_OVERLAY: "selection-overlay"
2998
- }, H = {
3134
+ }, D = {
2999
3135
  ROW_INDEX: "data-row-index",
3000
3136
  COL_INDEX: "data-col-index",
3001
3137
  FIELD: "data-field",
3002
3138
  GROUP_KEY: "data-group-key",
3003
3139
  TREE_LEVEL: "data-tree-level",
3004
3140
  STICKY: "data-sticky"
3005
- }, rt = {
3006
- ROOT: `.${C.ROOT}`,
3007
- HEADER: `.${C.HEADER}`,
3008
- HEADER_ROW: `.${C.HEADER_ROW}`,
3009
- HEADER_CELL: `.${C.HEADER_CELL}`,
3010
- ROWS_VIEWPORT: `.${C.ROWS_VIEWPORT}`,
3011
- ROWS_CONTAINER: `.${C.ROWS_CONTAINER}`,
3012
- DATA_ROW: `.${C.DATA_ROW}`,
3013
- DATA_CELL: `.${C.DATA_CELL}`,
3014
- GROUP_ROW: `.${C.GROUP_ROW}`,
3141
+ }, ct = {
3142
+ ROOT: `.${y.ROOT}`,
3143
+ HEADER: `.${y.HEADER}`,
3144
+ HEADER_ROW: `.${y.HEADER_ROW}`,
3145
+ HEADER_CELL: `.${y.HEADER_CELL}`,
3146
+ ROWS_VIEWPORT: `.${y.ROWS_VIEWPORT}`,
3147
+ ROWS_CONTAINER: `.${y.ROWS_CONTAINER}`,
3148
+ DATA_ROW: `.${y.DATA_ROW}`,
3149
+ DATA_CELL: `.${y.DATA_CELL}`,
3150
+ GROUP_ROW: `.${y.GROUP_ROW}`,
3015
3151
  // By data attribute
3016
- ROW_BY_INDEX: (o) => `.${C.DATA_ROW}[${H.ROW_INDEX}="${o}"]`,
3017
- CELL_BY_FIELD: (o) => `.${C.DATA_CELL}[${H.FIELD}="${o}"]`,
3018
- CELL_AT: (o, e) => `.${C.DATA_ROW}[${H.ROW_INDEX}="${o}"] .${C.DATA_CELL}[${H.COL_INDEX}="${e}"]`,
3152
+ ROW_BY_INDEX: (o) => `.${y.DATA_ROW}[${D.ROW_INDEX}="${o}"]`,
3153
+ CELL_BY_FIELD: (o) => `.${y.DATA_CELL}[${D.FIELD}="${o}"]`,
3154
+ CELL_AT: (o, e) => `.${y.DATA_ROW}[${D.ROW_INDEX}="${o}"] .${y.DATA_CELL}[${D.COL_INDEX}="${e}"]`,
3019
3155
  // State selectors
3020
- SELECTED_ROWS: `.${C.DATA_ROW}.${C.SELECTED}`,
3021
- EDITING_CELL: `.${C.DATA_CELL}.${C.EDITING}`
3022
- }, at = {
3156
+ SELECTED_ROWS: `.${y.DATA_ROW}.${y.SELECTED}`,
3157
+ EDITING_CELL: `.${y.DATA_CELL}.${y.EDITING}`
3158
+ }, dt = {
3023
3159
  // Colors
3024
3160
  COLOR_BG: "--tbw-color-bg",
3025
3161
  COLOR_FG: "--tbw-color-fg",
@@ -3041,7 +3177,7 @@ const C = {
3041
3177
  // Borders
3042
3178
  BORDER_RADIUS: "--tbw-border-radius",
3043
3179
  FOCUS_OUTLINE: "--tbw-focus-outline"
3044
- }, ct = {
3180
+ }, ht = {
3045
3181
  CELL_COMMIT: "cell-commit",
3046
3182
  ROW_COMMIT: "row-commit",
3047
3183
  CHANGED_ROWS_RESET: "changed-rows-reset",
@@ -3052,7 +3188,7 @@ const C = {
3052
3188
  ACTIVATE_CELL: "activate-cell",
3053
3189
  GROUP_TOGGLE: "group-toggle",
3054
3190
  COLUMN_STATE_CHANGE: "column-state-change"
3055
- }, dt = {
3191
+ }, ut = {
3056
3192
  // Selection plugin
3057
3193
  SELECTION_CHANGE: "selection-change",
3058
3194
  // Tree plugin
@@ -3083,10 +3219,10 @@ const C = {
3083
3219
  DETAIL_EXPAND: "detail-expand",
3084
3220
  // Grouping rows plugin
3085
3221
  GROUP_EXPAND: "group-expand"
3086
- }, I = {
3222
+ }, q = {
3087
3223
  sum: (o, e) => o.reduce((t, n) => t + (Number(n[e]) || 0), 0),
3088
3224
  avg: (o, e) => {
3089
- const t = o.reduce((n, s) => n + (Number(s[e]) || 0), 0);
3225
+ const t = o.reduce((n, i) => n + (Number(i[e]) || 0), 0);
3090
3226
  return o.length ? t / o.length : 0;
3091
3227
  },
3092
3228
  count: (o) => o.length,
@@ -3094,7 +3230,7 @@ const C = {
3094
3230
  max: (o, e) => Math.max(...o.map((t) => Number(t[e]) || -1 / 0)),
3095
3231
  first: (o, e) => o[0]?.[e],
3096
3232
  last: (o, e) => o[o.length - 1]?.[e]
3097
- }, P = /* @__PURE__ */ new Map(), S = {
3233
+ }, P = /* @__PURE__ */ new Map(), x = {
3098
3234
  /**
3099
3235
  * Register a custom aggregator function.
3100
3236
  */
@@ -3112,47 +3248,48 @@ const C = {
3112
3248
  */
3113
3249
  get(o) {
3114
3250
  if (o !== void 0)
3115
- return typeof o == "function" ? o : P.get(o) ?? I[o];
3251
+ return typeof o == "function" ? o : P.get(o) ?? q[o];
3116
3252
  },
3117
3253
  /**
3118
3254
  * Run an aggregator on a set of rows.
3119
3255
  */
3120
3256
  run(o, e, t, n) {
3121
- const s = this.get(o);
3122
- return s ? s(e, t, n) : void 0;
3257
+ const i = this.get(o);
3258
+ return i ? i(e, t, n) : void 0;
3123
3259
  },
3124
3260
  /**
3125
3261
  * Check if an aggregator exists.
3126
3262
  */
3127
3263
  has(o) {
3128
- return P.has(o) || o in I;
3264
+ return P.has(o) || o in q;
3129
3265
  },
3130
3266
  /**
3131
3267
  * List all available aggregator names.
3132
3268
  */
3133
3269
  list() {
3134
- return [...Object.keys(I), ...P.keys()];
3270
+ return [...Object.keys(q), ...P.keys()];
3135
3271
  }
3136
- }, ht = S.register.bind(S), ut = S.unregister.bind(S), ft = S.get.bind(S), pt = S.run.bind(S), wt = S.list.bind(S);
3272
+ }, ft = x.register.bind(x), pt = x.unregister.bind(x), gt = x.get.bind(x), wt = x.run.bind(x), bt = x.list.bind(x);
3137
3273
  export {
3138
- ue as BaseGridPlugin,
3139
- ct as DGEvents,
3140
- q as DataGridElement,
3141
- O as FitModeEnum,
3142
- at as GridCSSVars,
3143
- C as GridClasses,
3144
- H as GridDataAttrs,
3145
- q as GridElement,
3146
- rt as GridSelectors,
3147
- dt as PluginEvents,
3148
- Ye as PluginManager,
3149
- st as SelectionPlugin,
3150
- lt as TreePlugin,
3151
- S as aggregatorRegistry,
3152
- ft as getAggregator,
3153
- wt as listAggregators,
3154
- ht as registerAggregator,
3155
- pt as runAggregator,
3156
- ut as unregisterAggregator
3274
+ fe as BaseGridPlugin,
3275
+ ce as DEFAULT_GRID_ICONS,
3276
+ ht as DGEvents,
3277
+ I as DataGridElement,
3278
+ M as FitModeEnum,
3279
+ dt as GridCSSVars,
3280
+ y as GridClasses,
3281
+ D as GridDataAttrs,
3282
+ I as GridElement,
3283
+ ct as GridSelectors,
3284
+ ut as PluginEvents,
3285
+ Je as PluginManager,
3286
+ lt as SelectionPlugin,
3287
+ at as TreePlugin,
3288
+ x as aggregatorRegistry,
3289
+ gt as getAggregator,
3290
+ bt as listAggregators,
3291
+ ft as registerAggregator,
3292
+ wt as runAggregator,
3293
+ pt as unregisterAggregator
3157
3294
  };
3158
3295
  //# sourceMappingURL=index.js.map