@toolbox-web/grid 1.20.0 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +40 -14
  2. package/all.js +8 -4
  3. package/all.js.map +1 -1
  4. package/index.js +271 -238
  5. package/index.js.map +1 -1
  6. package/lib/core/grid.d.ts +81 -34
  7. package/lib/core/grid.d.ts.map +1 -1
  8. package/lib/core/internal/row-animation.d.ts +6 -6
  9. package/lib/core/internal/row-animation.d.ts.map +1 -1
  10. package/lib/core/types.d.ts +10 -12
  11. package/lib/core/types.d.ts.map +1 -1
  12. package/lib/plugins/clipboard/index.js.map +1 -1
  13. package/lib/plugins/column-virtualization/index.js.map +1 -1
  14. package/lib/plugins/context-menu/index.js.map +1 -1
  15. package/lib/plugins/editing/index.js.map +1 -1
  16. package/lib/plugins/export/index.js.map +1 -1
  17. package/lib/plugins/filtering/index.js.map +1 -1
  18. package/lib/plugins/grouping-columns/index.js.map +1 -1
  19. package/lib/plugins/grouping-rows/index.js.map +1 -1
  20. package/lib/plugins/master-detail/index.js.map +1 -1
  21. package/lib/plugins/multi-sort/MultiSortPlugin.d.ts +8 -0
  22. package/lib/plugins/multi-sort/MultiSortPlugin.d.ts.map +1 -1
  23. package/lib/plugins/multi-sort/index.js +23 -12
  24. package/lib/plugins/multi-sort/index.js.map +1 -1
  25. package/lib/plugins/pinned-columns/index.js.map +1 -1
  26. package/lib/plugins/pinned-rows/index.js.map +1 -1
  27. package/lib/plugins/pivot/index.js.map +1 -1
  28. package/lib/plugins/print/index.js.map +1 -1
  29. package/lib/plugins/reorder/index.js.map +1 -1
  30. package/lib/plugins/responsive/index.js.map +1 -1
  31. package/lib/plugins/row-reorder/index.js.map +1 -1
  32. package/lib/plugins/selection/index.js.map +1 -1
  33. package/lib/plugins/server-side/index.js.map +1 -1
  34. package/lib/plugins/tree/index.js.map +1 -1
  35. package/lib/plugins/undo-redo/index.js.map +1 -1
  36. package/lib/plugins/visibility/index.js.map +1 -1
  37. package/package.json +1 -1
  38. package/umd/grid.all.umd.js +11 -11
  39. package/umd/grid.all.umd.js.map +1 -1
  40. package/umd/grid.umd.js +12 -12
  41. package/umd/grid.umd.js.map +1 -1
  42. package/umd/plugins/multi-sort.umd.js +1 -1
  43. package/umd/plugins/multi-sort.umd.js.map +1 -1
package/index.js CHANGED
@@ -24,7 +24,7 @@ function gt(t, e, i, o) {
24
24
  const s = i?.gridAriaDescribedBy;
25
25
  return s !== t.ariaDescribedBy && (t.ariaDescribedBy = s, s ? e.setAttribute("aria-describedby", s) : e.removeAttribute("aria-describedby"), n = !0), n;
26
26
  }
27
- const G = {
27
+ const X = {
28
28
  STRETCH: "stretch",
29
29
  FIXED: "fixed"
30
30
  }, pt = {
@@ -114,8 +114,8 @@ function Ye(t, e) {
114
114
  i ? i.split(/\s+/).includes(e) || t.setAttribute("part", i + " " + e) : t.setAttribute("part", e);
115
115
  }
116
116
  function Te(t) {
117
- const e = t.effectiveConfig?.fitMode || t.fitMode || G.STRETCH;
118
- if (e !== G.STRETCH && e !== G.FIXED || t.__didInitialAutoSize || !t.isConnected) return;
117
+ const e = t.effectiveConfig?.fitMode || t.fitMode || X.STRETCH;
118
+ if (e !== X.STRETCH && e !== X.FIXED || t.__didInitialAutoSize || !t.isConnected) return;
119
119
  const i = Array.from(t._headerRowEl?.children || []);
120
120
  if (!i.length) return;
121
121
  let o = !1;
@@ -131,14 +131,14 @@ function Te(t) {
131
131
  }
132
132
  }
133
133
  l > 0 && (n.width = l + 2, n.__autoSized = !0, o = !0);
134
- }), o && V(t), t.__didInitialAutoSize = !0;
134
+ }), o && B(t), t.__didInitialAutoSize = !0;
135
135
  }
136
136
  const bt = /^(?:\d+(?:\.\d+)?(?:px|%|fr|em|rem|ch|vw|vh|vmin|vmax)|calc\(.+\)|min-content|max-content|minmax\(.+\)|fit-content\(.+\)|auto)$/i;
137
137
  function xe(t, e) {
138
138
  return typeof t == "number" ? `${t}px` : (bt.test(t) || console.warn(`[tbw-grid] Column '${e ?? "?"}' has an invalid CSS width value: '${t}'. Expected a number (px) or a valid CSS unit string (e.g. '30%', '2fr', 'calc(...)').`), t);
139
139
  }
140
- function V(t) {
141
- (t.effectiveConfig?.fitMode || t.fitMode || G.STRETCH) === G.STRETCH ? t._gridTemplate = t._visibleColumns.map((i) => {
140
+ function B(t) {
141
+ (t.effectiveConfig?.fitMode || t.fitMode || X.STRETCH) === X.STRETCH ? t._gridTemplate = t._visibleColumns.map((i) => {
142
142
  if (i.width != null) return xe(i.width, i.field);
143
143
  const o = i.minWidth;
144
144
  return o != null ? `minmax(${o}px, 1fr)` : "1fr";
@@ -268,12 +268,12 @@ function Le(t) {
268
268
  }
269
269
  const Lt = 100;
270
270
  class Pt {
271
- #l;
271
+ #a;
272
272
  #n;
273
273
  #u;
274
274
  #d;
275
275
  #h;
276
- #a = {};
276
+ #l = {};
277
277
  #o = {};
278
278
  #f = !0;
279
279
  #w = [];
@@ -286,7 +286,7 @@ class Pt {
286
286
  this.#r = e;
287
287
  }
288
288
  get original() {
289
- return this.#a;
289
+ return this.#l;
290
290
  }
291
291
  get effective() {
292
292
  return this.#o;
@@ -328,10 +328,10 @@ class Pt {
328
328
  this.#f = !0;
329
329
  }
330
330
  setGridConfig(e) {
331
- this.#l = e, this.#f = !0, this.#d = void 0;
331
+ this.#a = e, this.#f = !0, this.#d = void 0;
332
332
  }
333
333
  getGridConfig() {
334
- return this.#l;
334
+ return this.#a;
335
335
  }
336
336
  setColumns(e) {
337
337
  this.#n = e, this.#f = !0;
@@ -349,8 +349,8 @@ class Pt {
349
349
  const e = (this.#o.columns?.length ?? 0) > 0;
350
350
  if (!this.#f && e)
351
351
  return;
352
- const i = this.#I();
353
- this.#f = !1, this.#a = i, Object.freeze(this.#a), this.#a.columns && Object.freeze(this.#a.columns), this.#o = this.#x(this.#a), this.#m();
352
+ const i = this.#N();
353
+ this.#f = !1, this.#l = i, Object.freeze(this.#l), this.#l.columns && Object.freeze(this.#l.columns), this.#o = this.#x(this.#l), this.#m();
354
354
  }
355
355
  #x(e) {
356
356
  const i = { ...e };
@@ -364,11 +364,11 @@ class Pt {
364
364
  }
365
365
  #m() {
366
366
  const e = this.#o;
367
- this.#z(), typeof e.rowHeight == "number" && e.rowHeight > 0 && this.#r.setRowHeight(e.rowHeight), e.fitMode === "fixed" && this.columns.forEach((o) => {
367
+ this.#O(), typeof e.rowHeight == "number" && e.rowHeight > 0 && this.#r.setRowHeight(e.rowHeight), e.fitMode === "fixed" && this.columns.forEach((o) => {
368
368
  o.width == null && (o.width = 80);
369
369
  }), this.#r.applyAnimationConfig(e);
370
370
  }
371
- #z() {
371
+ #O() {
372
372
  const e = this.#o.typeDefaults;
373
373
  if (!e) return;
374
374
  const i = this.columns;
@@ -378,8 +378,8 @@ class Pt {
378
378
  n && (!o.renderer && !o.viewRenderer && n.renderer && (o.renderer = n.renderer), !o.format && n.format && (o.format = n.format), !o.editor && n.editor && (o.editor = n.editor), !o.editorParams && n.editorParams && (o.editorParams = n.editorParams));
379
379
  }
380
380
  }
381
- #I() {
382
- const e = this.#l ? { ...this.#l } : {}, i = Array.isArray(e.columns) ? [...e.columns] : [], o = (this.#d ?? []).map((s) => ({
381
+ #N() {
382
+ const e = this.#a ? { ...this.#a } : {}, i = Array.isArray(e.columns) ? [...e.columns] : [], o = (this.#d ?? []).map((s) => ({
383
383
  ...s
384
384
  }));
385
385
  let n = Ae(
@@ -413,7 +413,7 @@ class Pt {
413
413
  const f = Array.from(r.values());
414
414
  f.sort((p, g) => (p.order ?? 100) - (g.order ?? 100)), e.shell.headerContents = f;
415
415
  }
416
- const s = this.#r.getShellToolbarContents(), l = Array.from(s.values()), a = this.#l?.shell?.header?.toolbarContents ?? [], c = new Set(a.map((f) => f.id)), h = [...a];
416
+ const s = this.#r.getShellToolbarContents(), l = Array.from(s.values()), a = this.#a?.shell?.header?.toolbarContents ?? [], c = new Set(a.map((f) => f.id)), h = [...a];
417
417
  for (const f of l)
418
418
  c.has(f.id) || h.push(f);
419
419
  h.sort((f, p) => (f.order ?? 0) - (p.order ?? 0)), e.shell.header.toolbarContents = h;
@@ -466,7 +466,7 @@ class Pt {
466
466
  l.applyColumnState(a.field, a);
467
467
  }
468
468
  resetState(e) {
469
- this.#C = void 0, this.#r.setSortState(null), this.#o = this.#x(this.#a), this.#m();
469
+ this.#C = void 0, this.#r.setSortState(null), this.#o = this.#x(this.#l), this.#m();
470
470
  for (const i of e)
471
471
  if (i.applyColumnState)
472
472
  for (const o of this.columns)
@@ -687,7 +687,7 @@ function Dt() {
687
687
  function Mt() {
688
688
  return it.content.firstElementChild.cloneNode(!0);
689
689
  }
690
- function Y(t) {
690
+ function W(t) {
691
691
  t.__cellDisplayCache = void 0, t.__cellCacheEpoch = void 0, t.__hasSpecialColumns = void 0;
692
692
  }
693
693
  function kt(t, e, i, o, n) {
@@ -725,13 +725,13 @@ function kt(t, e, i, o, n) {
725
725
  }
726
726
  if (!R || y) {
727
727
  const S = se(d), L = x || t._activeEditRows === g;
728
- S && !L ? (d.__isCustomRow && (d.className = "data-grid-row", d.setAttribute("role", "row"), d.__isCustomRow = !1), le(d), B(t, d, u, g), d.__epoch = o, d.__rowDataRef = u) : S && L ? (ae(t, d, u, g), d.__rowDataRef = u) : (d.__isCustomRow && (d.className = "data-grid-row", d.setAttribute("role", "row"), d.__isCustomRow = !1), B(t, d, u, g), d.__epoch = o, d.__rowDataRef = u);
728
+ S && !L ? (d.__isCustomRow && (d.className = "data-grid-row", d.setAttribute("role", "row"), d.__isCustomRow = !1), le(d), G(t, d, u, g), d.__epoch = o, d.__rowDataRef = u) : S && L ? (ae(t, d, u, g), d.__rowDataRef = u) : (d.__isCustomRow && (d.className = "data-grid-row", d.setAttribute("role", "row"), d.__isCustomRow = !1), G(t, d, u, g), d.__epoch = o, d.__rowDataRef = u);
729
729
  } else if (E) {
730
730
  const S = se(d), L = x || t._activeEditRows === g;
731
- S && !L ? (le(d), B(t, d, u, g), d.__epoch = o, d.__rowDataRef = u) : (ae(t, d, u, g), d.__rowDataRef = u);
731
+ S && !L ? (le(d), G(t, d, u, g), d.__epoch = o, d.__rowDataRef = u) : (ae(t, d, u, g), d.__rowDataRef = u);
732
732
  } else {
733
733
  const S = se(d), L = x || t._activeEditRows === g;
734
- S && !L ? (le(d), B(t, d, u, g), d.__epoch = o, d.__rowDataRef = u) : ae(t, d, u, g);
734
+ S && !L ? (le(d), G(t, d, u, g), d.__epoch = o, d.__rowDataRef = u) : ae(t, d, u, g);
735
735
  }
736
736
  let v = !1;
737
737
  const b = t.changedRowIds;
@@ -750,8 +750,8 @@ function kt(t, e, i, o, n) {
750
750
  try {
751
751
  const L = N(u);
752
752
  if (L && L.length > 0) {
753
- const re = L.filter((X) => X && typeof X == "string");
754
- re.forEach((X) => d.classList.add(X)), d.setAttribute("data-dynamic-classes", re.join(" "));
753
+ const re = L.filter((Y) => Y && typeof Y == "string");
754
+ re.forEach((Y) => d.classList.add(Y)), d.setAttribute("data-dynamic-classes", re.join(" "));
755
755
  } else
756
756
  d.removeAttribute("data-dynamic-classes");
757
757
  } catch (L) {
@@ -803,7 +803,7 @@ function ae(t, e, i, o) {
803
803
  }
804
804
  for (let u = 0; u < a; u++)
805
805
  if (r[u].externalView && !n[u].querySelector("[data-external-view]")) {
806
- B(t, e, i, o);
806
+ G(t, e, i, o);
807
807
  return;
808
808
  }
809
809
  for (let u = 0; u < a; u++) {
@@ -898,7 +898,7 @@ function ae(t, e, i, o) {
898
898
  });
899
899
  }
900
900
  }
901
- function B(t, e, i, o) {
901
+ function G(t, e, i, o) {
902
902
  e.classList.remove("tbw-row-loading"), e.removeAttribute("aria-busy");
903
903
  const n = t.__frameworkAdapter;
904
904
  if (n?.releaseCell) {
@@ -1009,7 +1009,7 @@ function ze(t, e, i) {
1009
1009
  }
1010
1010
  return;
1011
1011
  }
1012
- W(t);
1012
+ F(t);
1013
1013
  }
1014
1014
  }
1015
1015
  }
@@ -1024,7 +1024,7 @@ function It(t, e) {
1024
1024
  if (!(c(a) && (e.key === "Home" || e.key === "End")) && !(c(a) && (e.key === "ArrowUp" || e.key === "ArrowDown") && a.tagName === "INPUT" && a.type === "number") && !(c(a) && (e.key === "ArrowLeft" || e.key === "ArrowRight")) && !(c(a) && (e.key === "Enter" || e.key === "Escape")) && !(n && s === "select" && (e.key === "ArrowDown" || e.key === "ArrowUp"))) {
1025
1025
  switch (e.key) {
1026
1026
  case "Tab": {
1027
- e.preventDefault(), !e.shiftKey ? t._focusCol < o ? t._focusCol += 1 : (typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow < i && (t._focusRow += 1, t._focusCol = 0)) : t._focusCol > 0 ? t._focusCol -= 1 : t._focusRow > 0 && (typeof t.commitActiveRowEdit == "function" && t._activeEditRows === t._focusRow && t.commitActiveRowEdit(), t._focusRow -= 1, t._focusCol = o), W(t);
1027
+ e.preventDefault(), !e.shiftKey ? t._focusCol < o ? t._focusCol += 1 : (typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow < i && (t._focusRow += 1, t._focusCol = 0)) : t._focusCol > 0 ? t._focusCol -= 1 : t._focusRow > 0 && (typeof t.commitActiveRowEdit == "function" && t._activeEditRows === t._focusRow && t.commitActiveRowEdit(), t._focusRow -= 1, t._focusCol = o), F(t);
1028
1028
  return;
1029
1029
  }
1030
1030
  case "ArrowDown":
@@ -1042,10 +1042,10 @@ function It(t, e) {
1042
1042
  break;
1043
1043
  }
1044
1044
  case "Home":
1045
- (e.ctrlKey || e.metaKey) && (n && typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow = 0), t._focusCol = 0, e.preventDefault(), W(t, { forceScrollLeft: !0 });
1045
+ (e.ctrlKey || e.metaKey) && (n && typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow = 0), t._focusCol = 0, e.preventDefault(), F(t, { forceScrollLeft: !0 });
1046
1046
  return;
1047
1047
  case "End":
1048
- (e.ctrlKey || e.metaKey) && (n && typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow = i), t._focusCol = o, e.preventDefault(), W(t, { forceScrollRight: !0 });
1048
+ (e.ctrlKey || e.metaKey) && (n && typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow = i), t._focusCol = o, e.preventDefault(), F(t, { forceScrollRight: !0 });
1049
1049
  return;
1050
1050
  case "PageDown":
1051
1051
  t._focusRow = Math.min(i, t._focusRow + 20), e.preventDefault();
@@ -1084,10 +1084,10 @@ function It(t, e) {
1084
1084
  default:
1085
1085
  return;
1086
1086
  }
1087
- W(t);
1087
+ F(t);
1088
1088
  }
1089
1089
  }
1090
- function W(t, e) {
1090
+ function F(t, e) {
1091
1091
  if (t._virtualization?.enabled) {
1092
1092
  const { rowHeight: s, container: l, viewportEl: a } = t._virtualization, c = l, h = a?.clientHeight ?? c?.clientHeight ?? 0;
1093
1093
  if (c && h > 0) {
@@ -1211,14 +1211,14 @@ function Ft(t, e, i) {
1211
1211
  { signal: i }
1212
1212
  );
1213
1213
  }
1214
- function Ut(t, e, i, o) {
1214
+ function Vt(t, e, i, o) {
1215
1215
  e.addEventListener("keydown", (n) => It(t, n), { signal: o }), i.addEventListener("mousedown", (n) => qt(t, i, n), { signal: o }), document.addEventListener("mousemove", (n) => $t(t, i, n), { signal: o }), document.addEventListener("mouseup", (n) => Wt(t, i, n), { signal: o });
1216
1216
  }
1217
- function Vt(t, e) {
1217
+ function Ut(t, e) {
1218
1218
  return t == null && e == null ? 0 : t == null ? -1 : e == null || t > e ? 1 : t < e ? -1 : 0;
1219
1219
  }
1220
1220
  function ot(t, e, i) {
1221
- const n = i.find((l) => l.field === e.field)?.sortComparator ?? Vt, { field: r, direction: s } = e;
1221
+ const n = i.find((l) => l.field === e.field)?.sortComparator ?? Ut, { field: r, direction: s } = e;
1222
1222
  return [...t].sort((l, a) => n(l[r], a[r], l, a) * s);
1223
1223
  }
1224
1224
  function Oe(t, e, i, o) {
@@ -1246,7 +1246,7 @@ function Me(t, e, i) {
1246
1246
  Oe(t, l, e, i);
1247
1247
  }) : Oe(t, s, e, i);
1248
1248
  }
1249
- function F(t, e) {
1249
+ function V(t, e) {
1250
1250
  return t.effectiveConfig?.sortable !== !1 && e.sortable === !0;
1251
1251
  }
1252
1252
  function j(t, e) {
@@ -1303,21 +1303,21 @@ function oe(t) {
1303
1303
  sortState: l,
1304
1304
  filterActive: !1,
1305
1305
  cellEl: n,
1306
- renderSortIcon: () => F(t, i) ? K(t, i) : null,
1306
+ renderSortIcon: () => V(t, i) ? K(t, i) : null,
1307
1307
  renderFilterButton: () => null
1308
1308
  }, c = i.headerRenderer(a);
1309
- Xt(n, c), F(t, i) && Z(t, i, o, n), j(t, i) && (n.classList.add("resizable"), n.appendChild(Q(t, o, n)));
1309
+ Xt(n, c), V(t, i) && Z(t, i, o, n), j(t, i) && (n.classList.add("resizable"), n.appendChild(Q(t, o, n)));
1310
1310
  } else if (i.headerLabelRenderer) {
1311
1311
  const a = {
1312
1312
  column: i,
1313
1313
  value: r
1314
1314
  }, c = i.headerLabelRenderer(a), h = document.createElement("span");
1315
- c == null ? h.textContent = r : typeof c == "string" ? h.innerHTML = k(c) : c instanceof Node && h.appendChild(c), n.appendChild(h), F(t, i) && (Z(t, i, o, n), n.appendChild(K(t, i))), j(t, i) && (n.classList.add("resizable"), n.appendChild(Q(t, o, n)));
1315
+ c == null ? h.textContent = r : typeof c == "string" ? h.innerHTML = k(c) : c instanceof Node && h.appendChild(c), n.appendChild(h), V(t, i) && (Z(t, i, o, n), n.appendChild(K(t, i))), j(t, i) && (n.classList.add("resizable"), n.appendChild(Q(t, o, n)));
1316
1316
  } else if (i.__headerTemplate)
1317
- Array.from(i.__headerTemplate.childNodes).forEach((a) => n.appendChild(a.cloneNode(!0))), F(t, i) && (Z(t, i, o, n), n.appendChild(K(t, i))), j(t, i) && (n.classList.add("resizable"), n.appendChild(Q(t, o, n)));
1317
+ Array.from(i.__headerTemplate.childNodes).forEach((a) => n.appendChild(a.cloneNode(!0))), V(t, i) && (Z(t, i, o, n), n.appendChild(K(t, i))), j(t, i) && (n.classList.add("resizable"), n.appendChild(Q(t, o, n)));
1318
1318
  else {
1319
1319
  const a = document.createElement("span");
1320
- a.textContent = r, n.appendChild(a), F(t, i) && (Z(t, i, o, n), n.appendChild(K(t, i))), j(t, i) && (n.classList.add("resizable"), n.appendChild(Q(t, o, n)));
1320
+ a.textContent = r, n.appendChild(a), V(t, i) && (Z(t, i, o, n), n.appendChild(K(t, i))), j(t, i) && (n.classList.add("resizable"), n.appendChild(Q(t, o, n)));
1321
1321
  }
1322
1322
  e.appendChild(n);
1323
1323
  }), e.querySelectorAll(".cell.sortable").forEach((i) => {
@@ -1378,15 +1378,15 @@ function ti(t, e) {
1378
1378
  }
1379
1379
  var A = ((t) => (t[t.STYLE = 1] = "STYLE", t[t.VIRTUALIZATION = 2] = "VIRTUALIZATION", t[t.HEADER = 3] = "HEADER", t[t.ROWS = 4] = "ROWS", t[t.COLUMNS = 5] = "COLUMNS", t[t.FULL = 6] = "FULL", t))(A || {});
1380
1380
  class ii {
1381
- #l;
1381
+ #a;
1382
1382
  #n = 0;
1383
1383
  #u = 0;
1384
1384
  #d = null;
1385
1385
  #h = null;
1386
- #a = null;
1386
+ #l = null;
1387
1387
  #o = !1;
1388
1388
  constructor(e) {
1389
- this.#l = e;
1389
+ this.#a = e;
1390
1390
  }
1391
1391
  requestPhase(e, i) {
1392
1392
  e > this.#n && (this.#n = e), this.#u === 0 && (this.#f(), this.#u = requestAnimationFrame(() => this.#w()));
@@ -1395,7 +1395,7 @@ class ii {
1395
1395
  return this.#d ? this.#d : Promise.resolve();
1396
1396
  }
1397
1397
  setInitialReadyResolver(e) {
1398
- this.#a = e;
1398
+ this.#l = e;
1399
1399
  }
1400
1400
  cancel() {
1401
1401
  this.#u !== 0 && (cancelAnimationFrame(this.#u), this.#u = 0), this.#n = 0, this.#h && (this.#h(), this.#h = null, this.#d = null);
@@ -1412,12 +1412,12 @@ class ii {
1412
1412
  }));
1413
1413
  }
1414
1414
  #w() {
1415
- if (this.#u = 0, !this.#l.isConnected()) {
1415
+ if (this.#u = 0, !this.#a.isConnected()) {
1416
1416
  this.#n = 0, this.#h && (this.#h(), this.#h = null, this.#d = null);
1417
1417
  return;
1418
1418
  }
1419
1419
  const e = this.#n;
1420
- this.#n = 0, e >= 5 && this.#l.mergeConfig(), e >= 4 && this.#l.processRows(), e >= 5 && (this.#l.processColumns(), this.#l.updateTemplate()), e >= 3 && this.#l.renderHeader(), e >= 2 && this.#l.renderVirtualWindow(), e >= 1 && this.#l.afterRender(), !this.#o && this.#a && (this.#o = !0, this.#a()), this.#h && (this.#h(), this.#h = null, this.#d = null);
1420
+ this.#n = 0, e >= 5 && this.#a.mergeConfig(), e >= 4 && this.#a.processRows(), e >= 5 && (this.#a.processColumns(), this.#a.updateTemplate()), e >= 3 && this.#a.renderHeader(), e >= 2 && this.#a.renderVirtualWindow(), e >= 1 && this.#a.afterRender(), !this.#o && this.#l && (this.#o = !0, this.#l()), this.#h && (this.#h(), this.#h = null, this.#d = null);
1421
1421
  }
1422
1422
  }
1423
1423
  function Ie(t) {
@@ -1484,25 +1484,26 @@ function li(t, e, i) {
1484
1484
  t.removeAttribute(ce), t.offsetWidth, t.setAttribute(ce, e);
1485
1485
  const o = si(t, e);
1486
1486
  setTimeout(() => {
1487
- e !== "remove" && t.removeAttribute(ce);
1487
+ e !== "remove" && t.removeAttribute(ce), i?.();
1488
1488
  }, o);
1489
1489
  }
1490
1490
  function Se(t, e, i) {
1491
1491
  if (e < 0)
1492
- return !1;
1492
+ return Promise.resolve(!1);
1493
1493
  const o = t.findRenderedRowElement?.(e);
1494
- return o ? (li(o, i), !0) : !1;
1494
+ return o ? new Promise((n) => {
1495
+ li(o, i, () => n(!0));
1496
+ }) : Promise.resolve(!1);
1495
1497
  }
1496
1498
  function ai(t, e, i) {
1497
- let o = 0;
1498
- for (const n of e)
1499
- Se(t, n, i) && o++;
1500
- return o;
1499
+ return Promise.all(e.map((o) => Se(t, o, i))).then(
1500
+ (o) => o.filter(Boolean).length
1501
+ );
1501
1502
  }
1502
1503
  function ci(t, e, i) {
1503
1504
  const o = t._rows ?? [], n = t.getRowId;
1504
1505
  if (!n)
1505
- return !1;
1506
+ return Promise.resolve(!1);
1506
1507
  const r = o.findIndex((s) => {
1507
1508
  if (s == null) return !1;
1508
1509
  try {
@@ -1511,7 +1512,7 @@ function ci(t, e, i) {
1511
1512
  return !1;
1512
1513
  }
1513
1514
  });
1514
- return r < 0 ? !1 : Se(t, r, i);
1515
+ return r < 0 ? Promise.resolve(!1) : Se(t, r, i);
1515
1516
  }
1516
1517
  function J(t, e, i) {
1517
1518
  const o = document.createElement(t);
@@ -1875,7 +1876,7 @@ function Fe(t, e) {
1875
1876
  const i = t.querySelector("[data-panel-toggle]");
1876
1877
  i && (i.classList.toggle("active", e.isPanelOpen), i.setAttribute("aria-pressed", String(e.isPanelOpen)));
1877
1878
  }
1878
- function Ue(t, e) {
1879
+ function Ve(t, e) {
1879
1880
  const i = t.querySelector(".tbw-tool-panel");
1880
1881
  i && (i.classList.toggle("open", e.isPanelOpen), e.isPanelOpen || (i.style.width = ""));
1881
1882
  }
@@ -1930,7 +1931,7 @@ function vi(t, e) {
1930
1931
  s && t.expandedSections.add(s.id);
1931
1932
  }
1932
1933
  const n = e.getShadow();
1933
- Fe(n, t), Ue(n, t), bi(n, t, e.getAccordionIcons()), e.emit("tool-panel-open", { sections: o.expandedSections });
1934
+ Fe(n, t), Ve(n, t), bi(n, t, e.getAccordionIcons()), e.emit("tool-panel-open", { sections: o.expandedSections });
1934
1935
  },
1935
1936
  closeToolPanel() {
1936
1937
  if (!t.isPanelOpen) return;
@@ -1941,7 +1942,7 @@ function vi(t, e) {
1941
1942
  r.onClose?.();
1942
1943
  t.isPanelOpen = !1;
1943
1944
  const n = e.getShadow();
1944
- Fe(n, t), Ue(n, t), e.emit("tool-panel-close", {});
1945
+ Fe(n, t), Ve(n, t), e.emit("tool-panel-close", {});
1945
1946
  },
1946
1947
  toggleToolPanel() {
1947
1948
  t.isPanelOpen ? o.closeToolPanel() : o.openToolPanel();
@@ -2081,12 +2082,12 @@ function yi(t, e, i, o) {
2081
2082
  }
2082
2083
  return n;
2083
2084
  }
2084
- const Ve = "tbw-grid-styles";
2085
+ const Ue = "tbw-grid-styles";
2085
2086
  let te = "";
2086
2087
  const we = /* @__PURE__ */ new Map();
2087
2088
  function _i() {
2088
- let t = document.getElementById(Ve);
2089
- return t || (t = document.createElement("style"), t.id = Ve, t.setAttribute("data-tbw-grid", "true"), document.head.appendChild(t)), t;
2089
+ let t = document.getElementById(Ue);
2090
+ return t || (t = document.createElement("style"), t.id = Ue, t.setAttribute("data-tbw-grid", "true"), document.head.appendChild(t)), t;
2090
2091
  }
2091
2092
  function be() {
2092
2093
  const t = _i(), e = Array.from(we.values()).join(`
@@ -2412,7 +2413,7 @@ function ve(t, e, i) {
2412
2413
  t[r].offset += n;
2413
2414
  }
2414
2415
  }
2415
- function Ui(t) {
2416
+ function Vi(t) {
2416
2417
  if (t.length === 0) return 0;
2417
2418
  const e = t[t.length - 1];
2418
2419
  return e.offset + e.height;
@@ -2432,7 +2433,7 @@ function Ge(t, e) {
2432
2433
  }
2433
2434
  return Math.max(0, Math.min(i, t.length - 1));
2434
2435
  }
2435
- function Vi(t, e) {
2436
+ function Ui(t, e) {
2436
2437
  let i = 0, o = 0;
2437
2438
  for (const n of t)
2438
2439
  n.measured && (i += n.height, o++);
@@ -2464,7 +2465,7 @@ function Gi(t, e) {
2464
2465
  (!m.measured || Math.abs(m.height - C) > 1) && (ve(i, u, C), Wi(o, d, C, a), c = !0);
2465
2466
  }
2466
2467
  });
2467
- const h = c ? Bi(i) : 0, f = c ? Vi(i, t.defaultHeight) : 0;
2468
+ const h = c ? Bi(i) : 0, f = c ? Ui(i, t.defaultHeight) : 0;
2468
2469
  return { hasChanges: c, measuredCount: h, averageHeight: f };
2469
2470
  }
2470
2471
  function Xi(t, e, i, o) {
@@ -2809,8 +2810,8 @@ ${Zi}
2809
2810
  `;
2810
2811
  class I extends HTMLElement {
2811
2812
  static tagName = "tbw-grid";
2812
- static version = "1.20.0";
2813
- static #l = 0;
2813
+ static version = "1.21.0";
2814
+ static #a = 0;
2814
2815
  static adapters = [];
2815
2816
  static registerAdapter(e) {
2816
2817
  this.adapters.push(e);
@@ -2830,7 +2831,7 @@ class I extends HTMLElement {
2830
2831
  #u = !1;
2831
2832
  #d;
2832
2833
  #h;
2833
- #a = [];
2834
+ #l = [];
2834
2835
  get #o() {
2835
2836
  return this.#i?.effective ?? {};
2836
2837
  }
@@ -2848,13 +2849,13 @@ class I extends HTMLElement {
2848
2849
  #g = !1;
2849
2850
  #x = !1;
2850
2851
  #m = 0;
2851
- #z;
2852
- #I = Ai();
2852
+ #O;
2853
+ #N = Ai();
2853
2854
  #b;
2854
2855
  #y;
2855
2856
  #p;
2856
2857
  #R;
2857
- #te = {
2858
+ #ee = {
2858
2859
  scrollTop: 0,
2859
2860
  scrollLeft: 0,
2860
2861
  scrollHeight: 0,
@@ -2864,19 +2865,19 @@ class I extends HTMLElement {
2864
2865
  };
2865
2866
  #t;
2866
2867
  #_;
2867
- #N = !1;
2868
- #O;
2869
- #G;
2868
+ #q = !1;
2870
2869
  #D;
2870
+ #G;
2871
+ #M;
2871
2872
  #i;
2872
2873
  #e = ui();
2873
2874
  #c;
2874
- #q;
2875
2875
  #$;
2876
- #M = !1;
2876
+ #W;
2877
+ #k = !1;
2877
2878
  #E = /* @__PURE__ */ new Set();
2878
2879
  #H = /* @__PURE__ */ new Map();
2879
- #W;
2880
+ #F;
2880
2881
  #S = /* @__PURE__ */ new Map();
2881
2882
  _rows = [];
2882
2883
  #X = [];
@@ -2919,7 +2920,6 @@ class I extends HTMLElement {
2919
2920
  _focusCol = 0;
2920
2921
  _restoreFocusAfterRender = !1;
2921
2922
  _sortState = null;
2922
- #Y = !1;
2923
2923
  _gridTemplate = "";
2924
2924
  __rowRenderEpoch = 0;
2925
2925
  __didInitialAutoSize = !1;
@@ -2942,48 +2942,48 @@ class I extends HTMLElement {
2942
2942
  return this._rows;
2943
2943
  }
2944
2944
  set rows(e) {
2945
- const i = this.#a;
2946
- this.#a = e, i !== e && this.#V("rows");
2945
+ const i = this.#l;
2946
+ this.#l = e, i !== e && this.#B("rows");
2947
2947
  }
2948
2948
  get sourceRows() {
2949
- return this.#a;
2949
+ return this.#l;
2950
2950
  }
2951
2951
  get columns() {
2952
2952
  return [...this._columns];
2953
2953
  }
2954
2954
  set columns(e) {
2955
2955
  const i = this.#i?.getColumns();
2956
- this.#i?.setColumns(e), i !== e && this.#V("columns");
2956
+ this.#i?.setColumns(e), i !== e && this.#B("columns");
2957
2957
  }
2958
2958
  get gridConfig() {
2959
2959
  return this.#o;
2960
2960
  }
2961
2961
  set gridConfig(e) {
2962
2962
  const i = this.#i?.getGridConfig();
2963
- this.#i?.setGridConfig(e), i !== e && (this.#i.clearLightDomCache(), this.#V("gridConfig"));
2963
+ this.#i?.setGridConfig(e), i !== e && (this.#i.clearLightDomCache(), this.#B("gridConfig"));
2964
2964
  }
2965
2965
  get fitMode() {
2966
2966
  return this.#o.fitMode ?? "stretch";
2967
2967
  }
2968
2968
  set fitMode(e) {
2969
2969
  const i = this.#i?.getFitMode();
2970
- this.#i?.setFitMode(e), i !== e && this.#V("fitMode");
2970
+ this.#i?.setFitMode(e), i !== e && this.#B("fitMode");
2971
2971
  }
2972
2972
  get loading() {
2973
- return this.#M;
2973
+ return this.#k;
2974
2974
  }
2975
2975
  set loading(e) {
2976
- const i = this.#M;
2977
- this.#M = e, e ? this.setAttribute("loading", "") : this.removeAttribute("loading"), i !== e && this.#fe();
2976
+ const i = this.#k;
2977
+ this.#k = e, e ? this.setAttribute("loading", "") : this.removeAttribute("loading"), i !== e && this.#ue();
2978
2978
  }
2979
2979
  setRowLoading(e, i) {
2980
2980
  const o = this.#E.has(e);
2981
- i ? this.#E.add(e) : this.#E.delete(e), o !== i && this.#Q(e, i);
2981
+ i ? this.#E.add(e) : this.#E.delete(e), o !== i && this.#K(e, i);
2982
2982
  }
2983
2983
  setCellLoading(e, i, o) {
2984
2984
  let n = this.#H.get(e);
2985
2985
  const r = n?.has(i) ?? !1;
2986
- o ? (n || (n = /* @__PURE__ */ new Set(), this.#H.set(e, n)), n.add(i)) : (n?.delete(i), n?.size === 0 && this.#H.delete(e)), r !== o && this.#ge(e, i, o);
2986
+ o ? (n || (n = /* @__PURE__ */ new Set(), this.#H.set(e, n)), n.add(i)) : (n?.delete(i), n?.size === 0 && this.#H.delete(e)), r !== o && this.#fe(e, i, o);
2987
2987
  }
2988
2988
  isRowLoading(e) {
2989
2989
  return this.#E.has(e);
@@ -2994,11 +2994,11 @@ class I extends HTMLElement {
2994
2994
  clearAllLoading() {
2995
2995
  this.loading = !1;
2996
2996
  for (const e of this.#E)
2997
- this.#Q(e, !1);
2997
+ this.#K(e, !1);
2998
2998
  this.#E.clear();
2999
2999
  for (const [e, i] of this.#H)
3000
3000
  for (const o of i)
3001
- this.#ge(e, o, !1);
3001
+ this.#fe(e, o, !1);
3002
3002
  this.#H.clear();
3003
3003
  }
3004
3004
  get effectiveConfig() {
@@ -3008,25 +3008,25 @@ class I extends HTMLElement {
3008
3008
  return this.#b || (this.#b = new AbortController()), this.#b.signal;
3009
3009
  }
3010
3010
  constructor() {
3011
- super(), this.#ve(), this.#d = new Promise((e) => this.#h = e), this.#s = new ii({
3011
+ super(), this.#me(), this.#d = new Promise((e) => this.#h = e), this.#s = new ii({
3012
3012
  mergeConfig: () => {
3013
- this.#i.parseLightDomColumns(this), this.#i.merge(), this.#oe(), ki(this.#o, this.#t?.getPlugins() ?? []), Ii(this.#t?.getPlugins() ?? []), qi(this.#t?.getPlugins() ?? []), this.#De(), this.#X = [...this._columns];
3013
+ this.#i.parseLightDomColumns(this), this.#i.merge(), this.#ie(), ki(this.#o, this.#t?.getPlugins() ?? []), Ii(this.#t?.getPlugins() ?? []), qi(this.#t?.getPlugins() ?? []), this.#Oe(), this.#X = [...this._columns];
3014
3014
  },
3015
- processColumns: () => this.#Le(),
3016
- processRows: () => this.#ze(),
3015
+ processColumns: () => this.#He(),
3016
+ processRows: () => this.#Pe(),
3017
3017
  renderHeader: () => oe(this),
3018
- updateTemplate: () => V(this),
3018
+ updateTemplate: () => B(this),
3019
3019
  renderVirtualWindow: () => this.refreshVirtualWindow(!0, !0),
3020
3020
  afterRender: () => {
3021
3021
  this.#t?.afterRender(), this._virtualization.enabled && this._virtualization.totalHeightEl && queueMicrotask(() => {
3022
3022
  if (!this._virtualization.totalHeightEl) return;
3023
3023
  const i = this.#T(this._rows.length);
3024
3024
  this._virtualization.totalHeightEl.style.height = `${i}px`;
3025
- }), this.#o.fitMode === "fixed" && !this.__didInitialAutoSize && (this.__didInitialAutoSize = !0, Te(this)), this._restoreFocusAfterRender && (this._restoreFocusAfterRender = !1, W(this)), this._virtualization.enabled && !this.#U && this.#_e(), this.#x && (this.#x = !1, requestAnimationFrame(() => {
3025
+ }), this.#o.fitMode === "fixed" && !this.__didInitialAutoSize && (this.__didInitialAutoSize = !0, Te(this)), this._restoreFocusAfterRender && (this._restoreFocusAfterRender = !1, F(this)), this._virtualization.enabled && !this.#U && this.#ye(), this.#x && (this.#x = !1, requestAnimationFrame(() => {
3026
3026
  requestAnimationFrame(() => {
3027
- this.#ye();
3027
+ this.#Ce();
3028
3028
  });
3029
- })), this.#M && this.#fe();
3029
+ })), this.#k && this.#ue();
3030
3030
  },
3031
3031
  isConnected: () => this.isConnected && this.#f
3032
3032
  }), this.#s.setInitialReadyResolver(() => this.#h?.()), this.#c = vi(this.#e, {
@@ -3039,7 +3039,7 @@ class I extends HTMLElement {
3039
3039
  emit: (e, i) => this.#L(e, i),
3040
3040
  refreshShellHeader: () => this.refreshShellHeader()
3041
3041
  }), this.#i = new Pt({
3042
- getRows: () => this.#a,
3042
+ getRows: () => this.#l,
3043
3043
  getSortState: () => this._sortState,
3044
3044
  setSortState: (e) => {
3045
3045
  this._sortState = e;
@@ -3051,15 +3051,15 @@ class I extends HTMLElement {
3051
3051
  clearRowPool: () => {
3052
3052
  this._rowPool.length = 0, this._bodyEl && (this._bodyEl.innerHTML = ""), this.__rowRenderEpoch++;
3053
3053
  },
3054
- setup: () => this.#P(),
3054
+ setup: () => this.#z(),
3055
3055
  renderHeader: () => oe(this),
3056
- updateTemplate: () => V(this),
3056
+ updateTemplate: () => B(this),
3057
3057
  refreshVirtualWindow: () => this.#s.requestPhase(A.VIRTUALIZATION, "configManager"),
3058
3058
  getVirtualization: () => this._virtualization,
3059
3059
  setRowHeight: (e) => {
3060
3060
  this._virtualization.rowHeight = e;
3061
3061
  },
3062
- applyAnimationConfig: (e) => this.#Oe(e),
3062
+ applyAnimationConfig: (e) => this.#ze(e),
3063
3063
  getShellLightDomTitle: () => this.#e.lightDomTitle,
3064
3064
  getShellToolPanels: () => this.#e.toolPanels,
3065
3065
  getShellHeaderContents: () => this.#e.headerContents,
@@ -3068,7 +3068,7 @@ class I extends HTMLElement {
3068
3068
  getShellHasToolButtonsContainer: () => this.#e.hasToolButtonsContainer
3069
3069
  });
3070
3070
  }
3071
- async #ve() {
3071
+ async #me() {
3072
3072
  await Ri(oo);
3073
3073
  }
3074
3074
  getPlugin(e) {
@@ -3087,21 +3087,21 @@ class I extends HTMLElement {
3087
3087
  this._restoreFocusAfterRender = !0, this.#s.requestPhase(A.ROWS, "plugin:requestRenderWithFocus");
3088
3088
  }
3089
3089
  updateTemplate() {
3090
- V(this);
3090
+ B(this);
3091
3091
  }
3092
3092
  requestAfterRender() {
3093
3093
  this.#s.requestPhase(A.STYLE, "plugin:requestAfterRender");
3094
3094
  }
3095
- #ie() {
3095
+ #te() {
3096
3096
  this.#t = new ne(this);
3097
3097
  const e = this.#o?.plugins, i = Array.isArray(e) ? e : [];
3098
3098
  this.#t.attachAll(i);
3099
3099
  }
3100
- #F() {
3100
+ #V() {
3101
3101
  const e = this.#t?.getPluginStyles() ?? [];
3102
3102
  Ei(e);
3103
3103
  }
3104
- #oe() {
3104
+ #ie() {
3105
3105
  const e = this.#o?.plugins, i = Array.isArray(e) ? e : [];
3106
3106
  if (this.#_ === i)
3107
3107
  return;
@@ -3121,17 +3121,17 @@ class I extends HTMLElement {
3121
3121
  const r = this.#e.headerContentCleanups.get(n);
3122
3122
  r && (r(), this.#e.headerContentCleanups.delete(n)), this.#e.headerContents.delete(n);
3123
3123
  }
3124
- this.#ie(), this.#F(), this.#_ = i, this.#le(), this.#ne();
3124
+ this.#te(), this.#V(), this.#_ = i, this.#se(), this.#oe();
3125
3125
  const o = this.#g;
3126
3126
  if (this.#g = this.#t?.getAll().some((n) => n.onScroll) ?? !1, !o && this.#g) {
3127
3127
  const r = this.#n.querySelector(".tbw-grid-content") ?? this.#n.querySelector(".tbw-grid-root");
3128
- this.#j(r);
3128
+ this.#Y(r);
3129
3129
  }
3130
3130
  }
3131
- #Ce() {
3131
+ #ve() {
3132
3132
  this.#t?.detachAll();
3133
3133
  }
3134
- #ne() {
3134
+ #oe() {
3135
3135
  if (!this.#t) return;
3136
3136
  const e = this.#t.getToolPanels();
3137
3137
  for (const { panel: o } of e)
@@ -3140,7 +3140,7 @@ class I extends HTMLElement {
3140
3140
  for (const { content: o } of i)
3141
3141
  this.#e.headerContents.has(o.id) || this.#e.headerContents.set(o.id, o);
3142
3142
  }
3143
- #re() {
3143
+ #ne() {
3144
3144
  const e = I.getAdapters();
3145
3145
  if (e.length === 0 && !this.__frameworkAdapter) return;
3146
3146
  const i = this.__frameworkAdapter;
@@ -3157,17 +3157,17 @@ class I extends HTMLElement {
3157
3157
  };
3158
3158
  }
3159
3159
  connectedCallback() {
3160
- this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("version") || this.setAttribute("version", I.version), this.id || (this.id = `tbw-grid-${++I.#l}`), this._rows = Array.isArray(this.#a) ? [...this.#a] : [], this.#b && (this.#b.abort(), this.#N = !1), this.#b = new AbortController(), this.#R && (ke(this.#R), this.#R = void 0), this.#k(), this.#i.parseLightDomColumns(this), this.#i.merge(), this.#ie();
3160
+ this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("version") || this.setAttribute("version", I.version), this.id || (this.id = `tbw-grid-${++I.#a}`), this._rows = Array.isArray(this.#l) ? [...this.#l] : [], this.#b && (this.#b.abort(), this.#q = !1), this.#b = new AbortController(), this.#R && (ke(this.#R), this.#R = void 0), this.#I(), this.#i.parseLightDomColumns(this), this.#i.merge(), this.#te();
3161
3161
  const e = this.#o?.plugins;
3162
- this.#_ = Array.isArray(e) ? e : [], this.#ne(), this.#u || (this.#ee(), this.#F(), this.#u = !0), this.#se(), this.#R = Yt(
3162
+ this.#_ = Array.isArray(e) ? e : [], this.#oe(), this.#u || (this.#J(), this.#V(), this.#u = !0), this.#re(), this.#R = Yt(
3163
3163
  () => {
3164
- this.#Ne();
3164
+ this.#Ie();
3165
3165
  },
3166
3166
  { timeout: 100 }
3167
3167
  );
3168
3168
  }
3169
3169
  disconnectedCallback() {
3170
- this.#R && (ke(this.#R), this.#R = void 0), this.#m && (clearTimeout(this.#m), this.#m = 0), this.#Ce(), mi(this.#e), this.#c.setInitialized(!1), this.#q?.(), this.#q = void 0, this.#$?.(), this.#$ = void 0, ct(this.#I), this.#b && (this.#b.abort(), this.#b = void 0), this.#O?.abort(), this.#O = void 0, this.#N = !1, this._resizeController && this._resizeController.dispose(), this.#y && (this.#y.disconnect(), this.#y = void 0), this.#p && (this.#p.disconnect(), this.#p = void 0, this.#U = !1), Y(this), this.#A.clear(), this.#_ = void 0;
3170
+ this.#R && (ke(this.#R), this.#R = void 0), this.#m && (clearTimeout(this.#m), this.#m = 0), this.#ve(), mi(this.#e), this.#c.setInitialized(!1), this.#$?.(), this.#$ = void 0, this.#W?.(), this.#W = void 0, ct(this.#N), this.#b && (this.#b.abort(), this.#b = void 0), this.#D?.abort(), this.#D = void 0, this.#q = !1, this._resizeController && this._resizeController.dispose(), this.#y && (this.#y.disconnect(), this.#y = void 0), this.#p && (this.#p.disconnect(), this.#p = void 0, this.#U = !1), W(this), this.#A.clear(), this.#_ = void 0;
3171
3171
  for (const e of this._rowPool)
3172
3172
  e.remove();
3173
3173
  this._rowPool.length = 0, this.__rowsBodyEl = null, this.#f = !1;
@@ -3188,24 +3188,24 @@ class I extends HTMLElement {
3188
3188
  }
3189
3189
  else e === "fit-mode" && (this.fitMode = o);
3190
3190
  }
3191
- #se() {
3191
+ #re() {
3192
3192
  const i = this.#n.querySelector(".tbw-grid-content") ?? this.#n.querySelector(".tbw-grid-root");
3193
3193
  if (this._headerRowEl = i?.querySelector(".header-row"), this._virtualization.totalHeightEl = i?.querySelector(".faux-vscroll-spacer"), this._virtualization.viewportEl = i?.querySelector(".rows-viewport"), this._bodyEl = i?.querySelector(".rows"), this.__rowsBodyEl = i?.querySelector(".rows-body"), this.#c.isInitialized) {
3194
3194
  pe(this.#n, this.#e), de(this.#n, this.#o?.shell, this.#e);
3195
3195
  const n = this.#o?.shell?.toolPanel?.defaultOpen;
3196
3196
  n && this.#e.toolPanels.has(n) && (this.openToolPanel(), this.#e.expandedSections.add(n));
3197
3197
  }
3198
- if (this.setAttribute("data-upgraded", ""), this.#f = !0, this._resizeController = Ie(this), this.#P(), this.#j(i), this.#N)
3198
+ if (this.setAttribute("data-upgraded", ""), this.#f = !0, this._resizeController = Ie(this), this.#z(), this.#Y(i), this.#q)
3199
3199
  return;
3200
- this.#N = !0;
3200
+ this.#q = !0;
3201
3201
  const o = this.disconnectSignal;
3202
- Ut(this, this, this.#n, o), this.#le(), queueMicrotask(() => this.#Ee()), this.#s.requestPhase(A.FULL, "afterConnect");
3202
+ Vt(this, this, this.#n, o), this.#se(), queueMicrotask(() => this.#_e()), this.#s.requestPhase(A.FULL, "afterConnect");
3203
3203
  }
3204
- #le() {
3204
+ #se() {
3205
3205
  const e = this.#o.rowHeight, i = this.#t.hasRowHeightPlugin();
3206
- typeof e == "function" || i ? this._virtualization.variableHeights || (this._virtualization.variableHeights = !0, this._virtualization.rowHeight = typeof e == "number" && e > 0 ? e : this._virtualization.rowHeight || 28, this.#J(), typeof e != "function" && (this.#x = !0)) : !i && typeof e != "function" && this._virtualization.variableHeights ? (this._virtualization.variableHeights = !1, this._virtualization.positionCache = null) : typeof e == "number" && e > 0 ? (this._virtualization.rowHeight = e, this._virtualization.variableHeights = !1) : requestAnimationFrame(() => this.#ae());
3206
+ typeof e == "function" || i ? this._virtualization.variableHeights || (this._virtualization.variableHeights = !0, this._virtualization.rowHeight = typeof e == "number" && e > 0 ? e : this._virtualization.rowHeight || 28, this.#Z(), typeof e != "function" && (this.#x = !0)) : !i && typeof e != "function" && this._virtualization.variableHeights ? (this._virtualization.variableHeights = !1, this._virtualization.positionCache = null) : typeof e == "number" && e > 0 ? (this._virtualization.rowHeight = e, this._virtualization.variableHeights = !1) : requestAnimationFrame(() => this.#le());
3207
3207
  }
3208
- #ae() {
3208
+ #le() {
3209
3209
  if (this.#t.hasExtraHeight())
3210
3210
  return;
3211
3211
  const e = this._bodyEl?.querySelector(".data-grid-row");
@@ -3219,7 +3219,7 @@ class I extends HTMLElement {
3219
3219
  const n = e.getBoundingClientRect(), r = Math.max(n.height, o);
3220
3220
  r > 0 && Math.abs(r - this._virtualization.rowHeight) > 1 && (this._virtualization.rowHeight = r, this.#s.requestPhase(A.VIRTUALIZATION, "measureRowHeight"));
3221
3221
  }
3222
- #ye() {
3222
+ #Ce() {
3223
3223
  const e = this._bodyEl?.querySelector(".data-grid-row");
3224
3224
  if (!e) return;
3225
3225
  const i = e.querySelectorAll(".cell");
@@ -3229,14 +3229,14 @@ class I extends HTMLElement {
3229
3229
  l > o && (o = l);
3230
3230
  });
3231
3231
  const n = e.getBoundingClientRect(), r = Math.max(n.height, o);
3232
- if (r > 0 && (Math.abs(r - this._virtualization.rowHeight) > 1 && (this._virtualization.rowHeight = r), this.#J(), this._virtualization.totalHeightEl)) {
3232
+ if (r > 0 && (Math.abs(r - this._virtualization.rowHeight) > 1 && (this._virtualization.rowHeight = r), this.#Z(), this._virtualization.totalHeightEl)) {
3233
3233
  const l = this.#T(this._rows.length);
3234
3234
  this._virtualization.totalHeightEl.style.height = `${l}px`;
3235
3235
  }
3236
3236
  }
3237
- #j(e) {
3238
- this.#O?.abort(), this.#O = new AbortController();
3239
- const i = this.#O.signal, o = e?.querySelector(".faux-vscroll"), n = e?.querySelector(".rows");
3237
+ #Y(e) {
3238
+ this.#D?.abort(), this.#D = new AbortController();
3239
+ const i = this.#D.signal, o = e?.querySelector(".faux-vscroll"), n = e?.querySelector(".rows");
3240
3240
  if (this._virtualization.container = o ?? this, this.#g = this.#t?.getAll().some((r) => r.onScroll) ?? !1, o && n) {
3241
3241
  o.addEventListener(
3242
3242
  "scroll",
@@ -3258,7 +3258,7 @@ class I extends HTMLElement {
3258
3258
  n.style.transform = `translateY(${g}px)`;
3259
3259
  }
3260
3260
  this.#r = a, this.#C || (this.#C = requestAnimationFrame(() => {
3261
- this.#C = 0, this.#r !== null && (this.#Me(this.#r), this.#r = null);
3261
+ this.#C = 0, this.#r !== null && (this.#De(this.#r), this.#r = null);
3262
3262
  }));
3263
3263
  },
3264
3264
  { passive: !0, signal: i }
@@ -3267,7 +3267,7 @@ class I extends HTMLElement {
3267
3267
  this.#G = r, this._virtualization.scrollAreaEl = r, r && this.#g && r.addEventListener(
3268
3268
  "scroll",
3269
3269
  () => {
3270
- const a = this.#te;
3270
+ const a = this.#ee;
3271
3271
  a.scrollTop = o.scrollTop, a.scrollLeft = r.scrollLeft, a.scrollHeight = o.scrollHeight, a.scrollWidth = r.scrollWidth, a.clientHeight = o.clientHeight, a.clientWidth = r.clientWidth, this.#t?.onScroll(a);
3272
3272
  },
3273
3273
  { passive: !0, signal: i }
@@ -3288,13 +3288,13 @@ class I extends HTMLElement {
3288
3288
  { passive: !1, signal: i }
3289
3289
  ), zi(
3290
3290
  s,
3291
- this.#I,
3291
+ this.#N,
3292
3292
  { fauxScrollbar: o, scrollArea: l },
3293
3293
  i
3294
3294
  ));
3295
3295
  }
3296
3296
  this._bodyEl && Ft(this, this._bodyEl, i), this.#y?.disconnect(), this._virtualization.viewportEl && (this.#y = new ResizeObserver(() => {
3297
- this.#qe(), this.#s.requestPhase(A.VIRTUALIZATION, "resize-observer");
3297
+ this.#Ne(), this.#s.requestPhase(A.VIRTUALIZATION, "resize-observer");
3298
3298
  }), this.#y.observe(this._virtualization.viewportEl)), this.#n.addEventListener(
3299
3299
  "focusin",
3300
3300
  () => {
@@ -3311,11 +3311,11 @@ class I extends HTMLElement {
3311
3311
  );
3312
3312
  }
3313
3313
  #U = !1;
3314
- #_e() {
3314
+ #ye() {
3315
3315
  if (this.#U) return;
3316
3316
  const e = this._bodyEl?.querySelector(".data-grid-row");
3317
3317
  e && (this.#U = !0, this.#p?.disconnect(), this.#p = new ResizeObserver(() => {
3318
- this.#ae();
3318
+ this.#le();
3319
3319
  }), this.#p.observe(e));
3320
3320
  }
3321
3321
  addEventListener(e, i, o) {
@@ -3327,7 +3327,7 @@ class I extends HTMLElement {
3327
3327
  #L(e, i) {
3328
3328
  this.dispatchEvent(new CustomEvent(e, { detail: i, bubbles: !0, composed: !0 }));
3329
3329
  }
3330
- #Ee() {
3330
+ #_e() {
3331
3331
  this._bodyEl?.querySelectorAll(".data-grid-row")?.forEach((i, o) => {
3332
3332
  const n = o === this._focusRow;
3333
3333
  i.setAttribute("aria-selected", String(n)), i.querySelectorAll(".cell").forEach((r, s) => {
@@ -3335,10 +3335,10 @@ class I extends HTMLElement {
3335
3335
  });
3336
3336
  });
3337
3337
  }
3338
- #V(e) {
3339
- this.#v[e] = !0, !this.#w && (this.#w = !0, queueMicrotask(() => this.#Se()));
3338
+ #B(e) {
3339
+ this.#v[e] = !0, !this.#w && (this.#w = !0, queueMicrotask(() => this.#Ee()));
3340
3340
  }
3341
- #Se() {
3341
+ #Ee() {
3342
3342
  if (!this.#w || !this.#f) {
3343
3343
  this.#w = !1;
3344
3344
  return;
@@ -3350,69 +3350,69 @@ class I extends HTMLElement {
3350
3350
  gridConfig: !1,
3351
3351
  fitMode: !1
3352
3352
  }, e.gridConfig) {
3353
- this.#xe(), e.rows && this.#ce();
3353
+ this.#Te(), e.rows && this.#ae();
3354
3354
  return;
3355
3355
  }
3356
- e.columns && this.#Ae(), e.rows && this.#ce(), e.fitMode && this.#Te();
3356
+ e.columns && this.#Re(), e.rows && this.#ae(), e.fitMode && this.#Ae();
3357
3357
  }
3358
- #ce() {
3359
- this._rows = Array.isArray(this.#a) ? [...this.#a] : [], this.#B(), this.#s.requestPhase(A.ROWS, "applyRowsUpdate");
3358
+ #ae() {
3359
+ this._rows = Array.isArray(this.#l) ? [...this.#l] : [], this.#P(), this.#s.requestPhase(A.ROWS, "applyRowsUpdate");
3360
3360
  }
3361
- #B() {
3361
+ #P() {
3362
3362
  this.#S.clear();
3363
3363
  const e = this.#o.getRowId;
3364
3364
  this._rows.forEach((i, o) => {
3365
- const n = this.#de(i, e);
3365
+ const n = this.#ce(i, e);
3366
3366
  n !== void 0 && this.#S.set(n, { row: i, index: o });
3367
3367
  });
3368
3368
  }
3369
- #de(e, i) {
3369
+ #ce(e, i) {
3370
3370
  if (i)
3371
3371
  return i(e);
3372
3372
  const o = e;
3373
3373
  if ("id" in o && o.id != null) return String(o.id);
3374
3374
  if ("_id" in o && o._id != null) return String(o._id);
3375
3375
  }
3376
- #Re(e, i) {
3377
- const o = this.#de(e, i);
3376
+ #Se(e, i) {
3377
+ const o = this.#ce(e, i);
3378
3378
  if (o === void 0)
3379
3379
  throw new Error(
3380
3380
  '[tbw-grid] Cannot determine row ID. Configure getRowId in gridConfig or ensure rows have an "id" property.'
3381
3381
  );
3382
3382
  return o;
3383
3383
  }
3384
- #Ae() {
3385
- Y(this), this.#i.merge(), this.#P();
3384
+ #Re() {
3385
+ W(this), this.#i.merge(), this.#z();
3386
3386
  }
3387
- #Te() {
3387
+ #Ae() {
3388
3388
  this.#i.merge(), this.#o.fitMode === "fixed" ? (this.__didInitialAutoSize = !1, Te(this)) : (this._columns.forEach((i) => {
3389
3389
  !i.__userResized && i.__autoSized && delete i.width;
3390
- }), V(this));
3390
+ }), B(this));
3391
3391
  }
3392
- #xe() {
3392
+ #Te() {
3393
3393
  qe(this, this.#e), $e(this, this.#e);
3394
3394
  const e = !!this.#n.querySelector(".has-shell"), i = !!this.#n.querySelector(".tbw-tool-panel"), o = this.#n.querySelectorAll(".tbw-accordion-section").length;
3395
- this.#i.parseLightDomColumns(this), this.#i.merge(), this.#oe(), We(this, this.#e, this.#re()), this.#i.markSourcesChanged(), this.#i.merge();
3395
+ this.#i.parseLightDomColumns(this), this.#i.merge(), this.#ie(), We(this, this.#e, this.#ne()), this.#i.markSourcesChanged(), this.#i.merge();
3396
3396
  const n = at(this.#o?.shell), r = (this.#o?.shell?.toolPanels?.length ?? 0) > 0, s = this.#o?.shell?.toolPanels?.length ?? 0;
3397
3397
  if (e !== n || !i && r || i && s !== o) {
3398
- he(this.#e), this.#ee(), this.#F(), this.#se(), this.#B();
3398
+ he(this.#e), this.#J(), this.#V(), this.#re(), this.#P();
3399
3399
  return;
3400
3400
  }
3401
- e && this.#He(), this.#B(), this.#s.requestPhase(A.COLUMNS, "applyGridConfigUpdate");
3401
+ e && this.#xe(), this.#P(), this.#s.requestPhase(A.COLUMNS, "applyGridConfigUpdate");
3402
3402
  }
3403
- #He() {
3403
+ #xe() {
3404
3404
  const e = this.#n.querySelector(".tbw-shell-header");
3405
3405
  if (!e) return;
3406
3406
  const i = this.#o.shell?.header?.title ?? this.#e.lightDomTitle;
3407
3407
  let o = e.querySelector(".tbw-shell-title");
3408
3408
  i ? (o || (o = document.createElement("h2"), o.className = "tbw-shell-title", o.setAttribute("part", "shell-title"), e.insertBefore(o, e.firstChild)), o.textContent = i) : o && o.remove();
3409
3409
  }
3410
- #Le() {
3410
+ #He() {
3411
3411
  if (this.__rowRenderEpoch++, this.#t) {
3412
3412
  const e = this.#X.length > 0 ? this.#X : this._columns, i = e.filter((r) => !r.hidden), o = e.filter((r) => r.hidden), n = this.#t.processColumns([...i]);
3413
3413
  if (n !== i) {
3414
3414
  const r = new Set(n.map((l) => l.field));
3415
- !i.some((l) => r.has(l.field)) && n.length > 0 ? this._columns = [...n, ...o] : this._columns = this.#Pe(
3415
+ !i.some((l) => r.has(l.field)) && n.length > 0 ? this._columns = [...n, ...o] : this._columns = this.#Le(
3416
3416
  e,
3417
3417
  n,
3418
3418
  o
@@ -3421,7 +3421,7 @@ class I extends HTMLElement {
3421
3421
  this._columns = [...e];
3422
3422
  }
3423
3423
  }
3424
- #Pe(e, i, o) {
3424
+ #Le(e, i, o) {
3425
3425
  if (o.length === 0) return i;
3426
3426
  const n = /* @__PURE__ */ new Map();
3427
3427
  for (const a of i)
@@ -3436,14 +3436,12 @@ class I extends HTMLElement {
3436
3436
  }
3437
3437
  return l.push(...s), l;
3438
3438
  }
3439
- #ze() {
3440
- Y(this);
3441
- const e = Array.isArray(this.#a) ? [...this.#a] : [], i = this.#Y;
3442
- i && (this.#Y = !1);
3443
- const o = i ? e : Bt(this, this.#t?.processRows(e) ?? e);
3444
- this._rows = o, this.#B(), this._virtualization.variableHeights && this.#J();
3439
+ #Pe() {
3440
+ W(this);
3441
+ const e = Array.isArray(this.#l) ? [...this.#l] : [], i = Bt(this, e), o = this.#t?.processRows(i) ?? i;
3442
+ this._rows = o, this.#P(), this._virtualization.variableHeights && this.#Z();
3445
3443
  }
3446
- #Oe(e) {
3444
+ #ze(e) {
3447
3445
  const i = {
3448
3446
  ...pt,
3449
3447
  ...e.animation
@@ -3451,29 +3449,29 @@ class I extends HTMLElement {
3451
3449
  let n = 1;
3452
3450
  o === !1 || o === "off" ? n = 0 : (o === !0 || o === "on") && (n = 1), this.style.setProperty("--tbw-animation-duration", `${i.duration}ms`), this.style.setProperty("--tbw-animation-easing", i.easing ?? "ease-out"), this.style.setProperty("--tbw-animation-enabled", String(n)), this.dataset.animationMode = typeof o == "boolean" ? o ? "on" : "off" : o;
3453
3451
  }
3454
- #K(e, i, o = this.__rowRenderEpoch) {
3455
- if (this.#z || (this.#z = (n, r, s) => this.#t?.renderRow(n, r, s) ?? !1), kt(this, e, i, o, this.#z), this.#E.size > 0)
3452
+ #j(e, i, o = this.__rowRenderEpoch) {
3453
+ if (this.#O || (this.#O = (n, r, s) => this.#t?.renderRow(n, r, s) ?? !1), kt(this, e, i, o, this.#O), this.#E.size > 0)
3456
3454
  for (const n of this.#E)
3457
- this.#Q(n, !0);
3455
+ this.#K(n, !0);
3458
3456
  }
3459
- #he = ht();
3460
- #ue(e, i) {
3461
- ut(this.#he, this.__rowsBodyEl, this._bodyEl, e, i);
3457
+ #de = ht();
3458
+ #he(e, i) {
3459
+ ut(this.#de, this.__rowsBodyEl, this._bodyEl, e, i);
3462
3460
  }
3463
- #De() {
3464
- gt(this.#he, this.__rowsBodyEl, this.#o, this.#e);
3461
+ #Oe() {
3462
+ gt(this.#de, this.__rowsBodyEl, this.#o, this.#e);
3465
3463
  }
3466
- #fe() {
3464
+ #ue() {
3467
3465
  const e = this.querySelector(".tbw-grid-root");
3468
- e && (this.#M ? (this.#W || (this.#W = Qt(this.#o?.loadingRenderer)), Zt(e, this.#W)) : Jt(this.#W));
3466
+ e && (this.#k ? (this.#F || (this.#F = Qt(this.#o?.loadingRenderer)), Zt(e, this.#F)) : Jt(this.#F));
3469
3467
  }
3470
- #Q(e, i) {
3468
+ #K(e, i) {
3471
3469
  const o = this.#S.get(e);
3472
3470
  if (!o) return;
3473
3471
  const n = this.findRenderedRowElement?.(o.index);
3474
3472
  n && ei(n, i);
3475
3473
  }
3476
- #ge(e, i, o) {
3474
+ #fe(e, i, o) {
3477
3475
  const n = this.#S.get(e);
3478
3476
  if (!n) return;
3479
3477
  const r = this.findRenderedRowElement?.(n.index);
@@ -3483,27 +3481,27 @@ class I extends HTMLElement {
3483
3481
  const l = r.children[s];
3484
3482
  l && ti(l, o);
3485
3483
  }
3486
- #P() {
3484
+ #z() {
3487
3485
  if (this.isConnected && !(!this._headerRowEl || !this._bodyEl)) {
3488
- if (this.#i.parseLightDomColumns(this), this.#D) {
3489
- const e = this.#D;
3490
- this.#D = void 0, this.#i.merge();
3486
+ if (this.#i.parseLightDomColumns(this), this.#M) {
3487
+ const e = this.#M;
3488
+ this.#M = void 0, this.#i.merge();
3491
3489
  const i = this.#t?.getAll() ?? [];
3492
3490
  this.#i.applyState(e, i);
3493
3491
  }
3494
3492
  this._bodyEl && (this._bodyEl.style.display = "", this._bodyEl.style.gridTemplateColumns = ""), this.#s.requestPhase(A.FULL, "setup");
3495
3493
  }
3496
3494
  }
3497
- #Me(e) {
3495
+ #De(e) {
3498
3496
  let i = 0, o = 0, n = 0, r = 0, s = 0;
3499
3497
  if (this.#g) {
3500
3498
  const a = this._virtualization.container, c = this.#G;
3501
3499
  i = c?.scrollLeft ?? 0, o = a?.scrollHeight ?? 0, n = c?.scrollWidth ?? 0, r = a?.clientHeight ?? 0, s = c?.clientWidth ?? 0;
3502
3500
  }
3503
3501
  if (this.refreshVirtualWindow(!1) && this.#t?.onScrollRender(), this._virtualization.variableHeights && (this.#m && clearTimeout(this.#m), this.#m = window.setTimeout(() => {
3504
- this.#m = 0, this.#be(this._virtualization.start, this._virtualization.end);
3502
+ this.#m = 0, this.#we(this._virtualization.start, this._virtualization.end);
3505
3503
  }, 100)), this.#g) {
3506
- const a = this.#te;
3504
+ const a = this.#ee;
3507
3505
  a.scrollTop = e, a.scrollLeft = i, a.scrollHeight = o, a.scrollWidth = n, a.clientHeight = r, a.clientWidth = s, this.#t?.onScroll(a);
3508
3506
  }
3509
3507
  }
@@ -3609,14 +3607,11 @@ class I extends HTMLElement {
3609
3607
  async forceLayout() {
3610
3608
  return this.#s.requestPhase(A.FULL, "forceLayout"), this.#s.whenReady();
3611
3609
  }
3612
- suspendProcessing() {
3613
- this.#Y = !0;
3614
- }
3615
3610
  async getConfig() {
3616
3611
  return Object.freeze({ ...this.#o || {} });
3617
3612
  }
3618
3613
  getRowId(e) {
3619
- return this.#Re(e, this.#o.getRowId);
3614
+ return this.#Se(e, this.#o.getRowId);
3620
3615
  }
3621
3616
  getRow(e) {
3622
3617
  return this.#S.get(e)?.row;
@@ -3674,14 +3669,52 @@ class I extends HTMLElement {
3674
3669
  o && this.#s.requestPhase(A.ROWS, "updateRows");
3675
3670
  }
3676
3671
  animateRow(e, i) {
3677
- Se(this, e, i);
3672
+ return Se(this, e, i);
3678
3673
  }
3679
3674
  animateRows(e, i) {
3680
- ai(this, e, i);
3675
+ return ai(this, e, i);
3681
3676
  }
3682
3677
  animateRowById(e, i) {
3683
3678
  return ci(this, e, i);
3684
3679
  }
3680
+ async insertRow(e, i, o = !0) {
3681
+ const n = Math.max(0, Math.min(e, this._rows.length));
3682
+ this.#l = [...this.#l, i];
3683
+ const r = [...this._rows];
3684
+ r.splice(n, 0, i), this._rows = r, this._sortState && (this.__originalOrder = [...this.__originalOrder, i]), W(this), this.#P(), this.__rowRenderEpoch++;
3685
+ for (const s of this._rowPool) s.__epoch = -1;
3686
+ this.refreshVirtualWindow(!0), o && (await new Promise((s) => requestAnimationFrame(() => s())), await this.animateRow(n, "insert"));
3687
+ }
3688
+ async removeRow(e, i = !0) {
3689
+ const o = this._rows[e];
3690
+ if (!o) return;
3691
+ i && await this.animateRow(e, "remove");
3692
+ const n = this._rows.indexOf(o);
3693
+ if (n < 0) return o;
3694
+ const r = [...this._rows];
3695
+ r.splice(n, 1), this._rows = r;
3696
+ const s = this.#l.indexOf(o);
3697
+ if (s >= 0) {
3698
+ const l = [...this.#l];
3699
+ l.splice(s, 1), this.#l = l;
3700
+ }
3701
+ if (this._sortState) {
3702
+ const l = this.__originalOrder.indexOf(o);
3703
+ if (l >= 0) {
3704
+ const a = [...this.__originalOrder];
3705
+ a.splice(l, 1), this.__originalOrder = a;
3706
+ }
3707
+ }
3708
+ W(this), this.#P(), this.__rowRenderEpoch++;
3709
+ for (const l of this._rowPool) l.__epoch = -1;
3710
+ return this.refreshVirtualWindow(!0), i && requestAnimationFrame(() => {
3711
+ this.querySelectorAll('[data-animating="remove"]').forEach((l) => {
3712
+ l.removeAttribute("data-animating");
3713
+ });
3714
+ }), o;
3715
+ }
3716
+ suspendProcessing() {
3717
+ }
3685
3718
  setColumnVisible(e, i) {
3686
3719
  const o = this.#i.setColumnVisible(e, i);
3687
3720
  return o && this.requestStateChange(), o;
@@ -3710,23 +3743,23 @@ class I extends HTMLElement {
3710
3743
  return this.#i.collectState(e);
3711
3744
  }
3712
3745
  set columnState(e) {
3713
- e && (this.#D = e, this.#i.initialColumnState = e, this.#u && this.#ke(e));
3746
+ e && (this.#M = e, this.#i.initialColumnState = e, this.#u && this.#Me(e));
3714
3747
  }
3715
3748
  get columnState() {
3716
3749
  return this.getColumnState();
3717
3750
  }
3718
- #ke(e) {
3751
+ #Me(e) {
3719
3752
  const i = this.#t?.getAll() ?? [];
3720
- this.#i.applyState(e, i), this.#P();
3753
+ this.#i.applyState(e, i), this.#z();
3721
3754
  }
3722
3755
  requestStateChange() {
3723
3756
  const e = this.#t?.getAll() ?? [];
3724
3757
  this.#i.requestStateChange(e);
3725
3758
  }
3726
3759
  resetColumnState() {
3727
- this.#D = void 0, this.__originalOrder = [];
3760
+ this.#M = void 0, this.__originalOrder = [];
3728
3761
  const e = this.#t?.getAll() ?? [];
3729
- this.#i.resetState(e), this.#i.merge(), this.#P();
3762
+ this.#i.resetState(e), this.#i.merge(), this.#z();
3730
3763
  }
3731
3764
  get isToolPanelOpen() {
3732
3765
  return this.#c.isPanelOpen;
@@ -3776,42 +3809,42 @@ class I extends HTMLElement {
3776
3809
  unregisterToolbarContent(e) {
3777
3810
  this.#c.unregisterToolbarContent(e);
3778
3811
  }
3779
- #Z = !1;
3812
+ #Q = !1;
3780
3813
  refreshShellHeader() {
3781
- this.#Z || (this.#Z = !0, queueMicrotask(() => {
3782
- this.#Z = !1, this.isConnected && (this.#k(), this.#i.markSourcesChanged(), this.#i.merge(), he(this.#e), this.#ee(), this.#F(), this.#Ie());
3814
+ this.#Q || (this.#Q = !0, queueMicrotask(() => {
3815
+ this.#Q = !1, this.isConnected && (this.#I(), this.#i.markSourcesChanged(), this.#i.merge(), he(this.#e), this.#J(), this.#V(), this.#ke());
3783
3816
  }));
3784
3817
  }
3785
- #Ie() {
3818
+ #ke() {
3786
3819
  const i = this.#n.querySelector(".tbw-grid-content") ?? this.#n.querySelector(".tbw-grid-root");
3787
3820
  if (this._headerRowEl = i?.querySelector(".header-row"), this._virtualization.totalHeightEl = i?.querySelector(".faux-vscroll-spacer"), this._virtualization.viewportEl = i?.querySelector(".rows-viewport"), this._bodyEl = i?.querySelector(".rows"), this.__rowsBodyEl = i?.querySelector(".rows-body"), this.#c.isInitialized) {
3788
3821
  pe(this.#n, this.#e), de(this.#n, this.#o?.shell, this.#e);
3789
3822
  const o = this.#o?.shell?.toolPanel?.defaultOpen;
3790
3823
  o && this.#e.toolPanels.has(o) && (this.openToolPanel(), this.#e.expandedSections.add(o));
3791
3824
  }
3792
- this._resizeController = Ie(this), this.#j(i), this.#s.requestPhase(A.COLUMNS, "shellRefresh");
3825
+ this._resizeController = Ie(this), this.#Y(i), this.#s.requestPhase(A.COLUMNS, "shellRefresh");
3793
3826
  }
3794
3827
  #A = /* @__PURE__ */ new Map();
3795
3828
  registerStyles(e, i) {
3796
3829
  let o = this.#A.get(e);
3797
- o || (o = new CSSStyleSheet(), this.#A.set(e, o)), o.replaceSync(i), this.#pe();
3830
+ o || (o = new CSSStyleSheet(), this.#A.set(e, o)), o.replaceSync(i), this.#ge();
3798
3831
  }
3799
3832
  unregisterStyles(e) {
3800
- this.#A.delete(e) && this.#pe();
3833
+ this.#A.delete(e) && this.#ge();
3801
3834
  }
3802
3835
  getRegisteredStyles() {
3803
3836
  return Array.from(this.#A.keys());
3804
3837
  }
3805
- #pe() {
3838
+ #ge() {
3806
3839
  const e = Array.from(this.#A.values()), i = document.adoptedStyleSheets.filter(
3807
3840
  (o) => !Array.from(this.#A.values()).includes(o)
3808
3841
  );
3809
3842
  document.adoptedStyleSheets = [...i, ...e];
3810
3843
  }
3811
- #k() {
3812
- qe(this, this.#e), $e(this, this.#e), We(this, this.#e, this.#re());
3844
+ #I() {
3845
+ qe(this, this.#e), $e(this, this.#e), We(this, this.#e, this.#ne());
3813
3846
  }
3814
- #we() {
3847
+ #pe() {
3815
3848
  const e = this.#n.querySelector(".tbw-shell-header");
3816
3849
  if (!e) return;
3817
3850
  he(this.#e);
@@ -3822,27 +3855,27 @@ class I extends HTMLElement {
3822
3855
  ), o = document.createElement("div");
3823
3856
  o.innerHTML = i;
3824
3857
  const n = o.firstElementChild;
3825
- n && (e.replaceWith(n), this.#me(), de(this.#n, this.#o?.shell, this.#e));
3858
+ n && (e.replaceWith(n), this.#be(), de(this.#n, this.#o?.shell, this.#e));
3826
3859
  }
3827
- #Ne() {
3860
+ #Ie() {
3828
3861
  const e = () => {
3829
3862
  const o = this.#e.lightDomTitle, n = this.#e.hasToolButtonsContainer;
3830
- this.#k();
3863
+ this.#I();
3831
3864
  const r = this.#e.lightDomTitle, s = this.#e.hasToolButtonsContainer;
3832
- (r && !o || s && !n) && (this.#i.markSourcesChanged(), this.#i.merge(), this.#we());
3865
+ (r && !o || s && !n) && (this.#i.markSourcesChanged(), this.#i.merge(), this.#pe());
3833
3866
  }, i = () => {
3834
- this.__lightDomColumnsCache = void 0, this.#P();
3867
+ this.__lightDomColumnsCache = void 0, this.#z();
3835
3868
  };
3836
3869
  this.#i.registerLightDomHandler("tbw-grid-header", e), this.#i.registerLightDomHandler("tbw-grid-tool-buttons", e), this.#i.registerLightDomHandler("tbw-grid-tool-panel", e), this.#i.registerLightDomHandler("tbw-grid-column", i), this.#i.registerLightDomHandler("tbw-grid-detail", i), this.#i.observeLightDOM(this);
3837
3870
  }
3838
3871
  refreshColumns() {
3839
- this.__lightDomColumnsCache = void 0, Y(this), this.#i.parseLightDomColumns(this);
3872
+ this.__lightDomColumnsCache = void 0, W(this), this.#i.parseLightDomColumns(this);
3840
3873
  const e = this.#e.lightDomTitle, i = this.#e.hasToolButtonsContainer;
3841
- this.#k();
3874
+ this.#I();
3842
3875
  const o = this.#e.lightDomTitle, n = this.#e.hasToolButtonsContainer;
3843
- (o && !e || n && !i) && (this.#i.markSourcesChanged(), this.#i.merge(), this.#we()), this.#s.requestPhase(A.COLUMNS, "refreshColumns");
3876
+ (o && !e || n && !i) && (this.#i.markSourcesChanged(), this.#i.merge(), this.#pe()), this.#s.requestPhase(A.COLUMNS, "refreshColumns");
3844
3877
  }
3845
- #qe() {
3878
+ #Ne() {
3846
3879
  const e = this._virtualization.container, i = this._virtualization.viewportEl ?? e;
3847
3880
  i && (this._virtualization.cachedViewportHeight = i.clientHeight), e && (this._virtualization.cachedFauxHeight = e.clientHeight);
3848
3881
  const o = this._virtualization.scrollAreaEl;
@@ -3858,9 +3891,9 @@ class I extends HTMLElement {
3858
3891
  n = o.cachedFauxHeight, r = o.cachedViewportHeight, s = o.cachedScrollAreaHeight || n;
3859
3892
  const l = s - r, a = Math.max(0, n - s);
3860
3893
  let c, h = 0;
3861
- return o.variableHeights && o.positionCache ? c = Ui(o.positionCache) : (c = e * o.rowHeight, h = this.#t?.getExtraHeight() ?? 0), c + l + h + a;
3894
+ return o.variableHeights && o.positionCache ? c = Vi(o.positionCache) : (c = e * o.rowHeight, h = this.#t?.getExtraHeight() ?? 0), c + l + h + a;
3862
3895
  }
3863
- #J() {
3896
+ #Z() {
3864
3897
  if (!this._virtualization.variableHeights) return;
3865
3898
  const e = this._rows, i = this._virtualization.rowHeight || 28, o = this.#o.rowHeight, n = this.#o.getRowId, r = n ? (l) => n(l) : void 0;
3866
3899
  this._virtualization.positionCache = Fi(
@@ -3896,7 +3929,7 @@ class I extends HTMLElement {
3896
3929
  this._virtualization.totalHeightEl.style.height = `${l}px`;
3897
3930
  }
3898
3931
  }
3899
- #be(e, i) {
3932
+ #we(e, i) {
3900
3933
  if (!this._virtualization.variableHeights || !this._virtualization.positionCache || !this._bodyEl) return;
3901
3934
  const o = this._bodyEl.querySelectorAll(".data-grid-row"), n = this.#o.getRowId, r = Gi(
3902
3935
  {
@@ -3920,9 +3953,9 @@ class I extends HTMLElement {
3920
3953
  if (!this._bodyEl) return !1;
3921
3954
  const o = this._rows.length;
3922
3955
  if (!this._virtualization.enabled)
3923
- return this.#K(0, o), i || this.#t?.afterRender(), !0;
3956
+ return this.#j(0, o), i || this.#t?.afterRender(), !0;
3924
3957
  if (this._rows.length <= this._virtualization.bypassThreshold)
3925
- return this._virtualization.start = 0, this._virtualization.end = o, e && (this._bodyEl.style.transform = "translateY(0px)"), this.#K(0, o, this.__rowRenderEpoch), e && this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${this.#T(o, !0)}px`), this.#ue(o, this._visibleColumns.length), i || this.#t?.afterRender(), !0;
3958
+ return this._virtualization.start = 0, this._virtualization.end = o, e && (this._bodyEl.style.transform = "translateY(0px)"), this.#j(0, o, this.__rowRenderEpoch), e && this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${this.#T(o, !0)}px`), this.#he(o, this._visibleColumns.length), i || this.#t?.afterRender(), !0;
3926
3959
  const n = this._virtualization.container ?? this, r = this._virtualization.viewportEl ?? n, s = e ? this._virtualization.cachedViewportHeight = r.clientHeight : this._virtualization.cachedViewportHeight || (this._virtualization.cachedViewportHeight = r.clientHeight), l = this._virtualization.rowHeight, a = n.scrollTop;
3927
3960
  let c;
3928
3961
  const h = this._virtualization.positionCache;
@@ -3977,29 +4010,29 @@ class I extends HTMLElement {
3977
4010
  w = c * l + m;
3978
4011
  }
3979
4012
  const C = -(a - w);
3980
- return this._bodyEl.style.transform = `translateY(${C}px)`, this.#K(c, p, this.__rowRenderEpoch), e && this._virtualization.variableHeights && this.#be(c, p), this.#ue(o, this._visibleColumns.length), e && !i && (this.#t?.afterRender(), queueMicrotask(() => {
4013
+ return this._bodyEl.style.transform = `translateY(${C}px)`, this.#j(c, p, this.__rowRenderEpoch), e && this._virtualization.variableHeights && this.#we(c, p), this.#he(o, this._visibleColumns.length), e && !i && (this.#t?.afterRender(), queueMicrotask(() => {
3981
4014
  if (!this._virtualization.totalHeightEl) return;
3982
4015
  const m = this.#T(o);
3983
4016
  this._virtualization.cachedFauxHeight === 0 && this._virtualization.cachedViewportHeight > 0 || (this._virtualization.totalHeightEl.style.height = `${m}px`);
3984
4017
  })), !0;
3985
4018
  }
3986
- #ee() {
3987
- this.#k(), this.#i.markSourcesChanged(), this.#i.merge();
4019
+ #J() {
4020
+ this.#I(), this.#i.markSourcesChanged(), this.#i.merge();
3988
4021
  const e = this.#o?.shell;
3989
4022
  yi(
3990
4023
  this.#n,
3991
4024
  e,
3992
4025
  { isPanelOpen: this.#e.isPanelOpen, expandedSections: this.#e.expandedSections },
3993
4026
  this.#o?.icons
3994
- ) && (this.#me(), this.#c.setInitialized(!0));
4027
+ ) && (this.#be(), this.#c.setInitialized(!0));
3995
4028
  }
3996
- #me() {
4029
+ #be() {
3997
4030
  gi(this.#n, this.#o?.shell, this.#e, {
3998
4031
  onPanelToggle: () => this.toggleToolPanel(),
3999
4032
  onSectionToggle: (e) => this.toggleToolPanelSection(e)
4000
- }), this.#q?.(), this.#q = wi(this.#n, this.#o?.shell, (e) => {
4033
+ }), this.#$?.(), this.#$ = wi(this.#n, this.#o?.shell, (e) => {
4001
4034
  this.style.setProperty("--tbw-tool-panel-width", `${e}px`);
4002
- }), this.#$?.(), this.#$ = pi(
4035
+ }), this.#W?.(), this.#W = pi(
4003
4036
  this,
4004
4037
  this.#o?.shell,
4005
4038
  this.#e,
@@ -4016,7 +4049,7 @@ const ao = {
4016
4049
  class co {
4017
4050
  static dependencies;
4018
4051
  static manifest;
4019
- version = "1.20.0";
4052
+ version = "1.21.0";
4020
4053
  styles;
4021
4054
  cellRenderers;
4022
4055
  headerRenderers;
@@ -4024,7 +4057,7 @@ class co {
4024
4057
  grid;
4025
4058
  config;
4026
4059
  userConfig;
4027
- #l;
4060
+ #a;
4028
4061
  get defaultConfig() {
4029
4062
  return {};
4030
4063
  }
@@ -4032,10 +4065,10 @@ class co {
4032
4065
  this.userConfig = e;
4033
4066
  }
4034
4067
  attach(e) {
4035
- this.#l?.abort(), this.#l = new AbortController(), this.grid = e, this.config = { ...this.defaultConfig, ...this.userConfig };
4068
+ this.#a?.abort(), this.#a = new AbortController(), this.grid = e, this.config = { ...this.defaultConfig, ...this.userConfig };
4036
4069
  }
4037
4070
  detach() {
4038
- this.#l?.abort(), this.#l = void 0;
4071
+ this.#a?.abort(), this.#a = void 0;
4039
4072
  }
4040
4073
  getPlugin(e) {
4041
4074
  return this.grid?.getPlugin(e);
@@ -4084,7 +4117,7 @@ class co {
4084
4117
  return this.grid;
4085
4118
  }
4086
4119
  get disconnectSignal() {
4087
- return this.#l?.signal ?? this.grid?.disconnectSignal;
4120
+ return this.#a?.signal ?? this.grid?.disconnectSignal;
4088
4121
  }
4089
4122
  get gridIcons() {
4090
4123
  const e = this.grid?.gridConfig?.icons ?? {};
@@ -4284,7 +4317,7 @@ export {
4284
4317
  po as DGEvents,
4285
4318
  I as DataGridElement,
4286
4319
  et as F,
4287
- G as FitModeEnum,
4320
+ X as FitModeEnum,
4288
4321
  uo as GridCSSVars,
4289
4322
  H as GridClasses,
4290
4323
  ee as GridDataAttrs,
@@ -4301,8 +4334,8 @@ export {
4301
4334
  so as c,
4302
4335
  fo as createGrid,
4303
4336
  Qe as d,
4304
- Vt as defaultComparator,
4305
- W as e,
4337
+ Ut as defaultComparator,
4338
+ F as e,
4306
4339
  _e as f,
4307
4340
  Ot as g,
4308
4341
  Co as getAggregator,