@toolbox-web/grid 1.12.0 → 1.13.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 (75) hide show
  1. package/all.js +694 -525
  2. package/all.js.map +1 -1
  3. package/index.js +1468 -1449
  4. package/index.js.map +1 -1
  5. package/lib/core/grid.d.ts +2 -1
  6. package/lib/core/grid.d.ts.map +1 -1
  7. package/lib/core/internal/sanitize.d.ts.map +1 -1
  8. package/lib/core/internal/validate-config.d.ts.map +1 -1
  9. package/lib/core/types.d.ts +9 -1
  10. package/lib/core/types.d.ts.map +1 -1
  11. package/lib/plugins/clipboard/index.js.map +1 -1
  12. package/lib/plugins/column-virtualization/index.js.map +1 -1
  13. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
  14. package/lib/plugins/context-menu/index.js +1 -1
  15. package/lib/plugins/context-menu/index.js.map +1 -1
  16. package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
  17. package/lib/plugins/editing/editors.d.ts.map +1 -1
  18. package/lib/plugins/editing/index.d.ts +1 -1
  19. package/lib/plugins/editing/index.d.ts.map +1 -1
  20. package/lib/plugins/editing/index.js +187 -170
  21. package/lib/plugins/editing/index.js.map +1 -1
  22. package/lib/plugins/editing/types.d.ts +44 -0
  23. package/lib/plugins/editing/types.d.ts.map +1 -1
  24. package/lib/plugins/export/index.js.map +1 -1
  25. package/lib/plugins/filtering/index.js +9 -9
  26. package/lib/plugins/filtering/index.js.map +1 -1
  27. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +8 -1
  28. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
  29. package/lib/plugins/grouping-columns/index.js +59 -60
  30. package/lib/plugins/grouping-columns/index.js.map +1 -1
  31. package/lib/plugins/grouping-rows/index.js.map +1 -1
  32. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +7 -0
  33. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -1
  34. package/lib/plugins/master-detail/index.js +185 -145
  35. package/lib/plugins/master-detail/index.js.map +1 -1
  36. package/lib/plugins/multi-sort/index.js.map +1 -1
  37. package/lib/plugins/pinned-columns/index.js.map +1 -1
  38. package/lib/plugins/pinned-rows/index.js.map +1 -1
  39. package/lib/plugins/pivot/index.js.map +1 -1
  40. package/lib/plugins/print/index.js.map +1 -1
  41. package/lib/plugins/reorder/index.js.map +1 -1
  42. package/lib/plugins/responsive/index.js +40 -39
  43. package/lib/plugins/responsive/index.js.map +1 -1
  44. package/lib/plugins/row-reorder/index.js.map +1 -1
  45. package/lib/plugins/selection/SelectionPlugin.d.ts +51 -0
  46. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
  47. package/lib/plugins/selection/index.js +325 -131
  48. package/lib/plugins/selection/index.js.map +1 -1
  49. package/lib/plugins/selection/types.d.ts +18 -0
  50. package/lib/plugins/selection/types.d.ts.map +1 -1
  51. package/lib/plugins/server-side/index.js.map +1 -1
  52. package/lib/plugins/tree/index.js.map +1 -1
  53. package/lib/plugins/undo-redo/index.js.map +1 -1
  54. package/lib/plugins/visibility/index.js.map +1 -1
  55. package/package.json +1 -1
  56. package/public.d.ts +2 -0
  57. package/public.d.ts.map +1 -1
  58. package/themes/dg-theme-bootstrap.css +192 -8
  59. package/themes/dg-theme-material.css +243 -0
  60. package/umd/grid.all.umd.js +43 -43
  61. package/umd/grid.all.umd.js.map +1 -1
  62. package/umd/grid.umd.js +19 -19
  63. package/umd/grid.umd.js.map +1 -1
  64. package/umd/plugins/context-menu.umd.js +1 -1
  65. package/umd/plugins/context-menu.umd.js.map +1 -1
  66. package/umd/plugins/editing.umd.js +1 -1
  67. package/umd/plugins/editing.umd.js.map +1 -1
  68. package/umd/plugins/filtering.umd.js +1 -1
  69. package/umd/plugins/filtering.umd.js.map +1 -1
  70. package/umd/plugins/grouping-columns.umd.js +1 -1
  71. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  72. package/umd/plugins/master-detail.umd.js +1 -1
  73. package/umd/plugins/master-detail.umd.js.map +1 -1
  74. package/umd/plugins/selection.umd.js +2 -2
  75. package/umd/plugins/selection.umd.js.map +1 -1
@@ -1,42 +1,42 @@
1
- function k(s) {
2
- s && s.querySelectorAll(".cell-focus").forEach((e) => e.classList.remove("cell-focus"));
1
+ function k(n) {
2
+ n && n.querySelectorAll(".cell-focus").forEach((e) => e.classList.remove("cell-focus"));
3
3
  }
4
4
  const v = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])', I = document.createElement("template");
5
5
  I.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
6
6
  const T = document.createElement("template");
7
7
  T.innerHTML = '<div class="data-grid-row" role="row" part="row"></div>';
8
- function R(s, e) {
9
- if (s._virtualization?.enabled) {
10
- const { rowHeight: l, container: o, viewportEl: a } = s._virtualization, c = o, d = a?.clientHeight ?? c?.clientHeight ?? 0;
8
+ function R(n, e) {
9
+ if (n._virtualization?.enabled) {
10
+ const { rowHeight: l, container: o, viewportEl: a } = n._virtualization, c = o, d = a?.clientHeight ?? c?.clientHeight ?? 0;
11
11
  if (c && d > 0) {
12
- const h = s._focusRow * l;
12
+ const h = n._focusRow * l;
13
13
  h < c.scrollTop ? c.scrollTop = h : h + l > c.scrollTop + d && (c.scrollTop = h - d + l);
14
14
  }
15
15
  }
16
- const t = s._activeEditRows !== void 0 && s._activeEditRows !== -1;
17
- t || s.refreshVirtualWindow(!1), k(s._bodyEl), Array.from(s._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((l) => {
16
+ const t = n._activeEditRows !== void 0 && n._activeEditRows !== -1;
17
+ t || n.refreshVirtualWindow(!1), k(n._bodyEl), Array.from(n._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((l) => {
18
18
  l.setAttribute("aria-selected", "false");
19
19
  });
20
- const i = s._focusRow, n = s._virtualization.start ?? 0, r = s._virtualization.end ?? s._rows.length;
21
- if (i >= n && i < r) {
22
- const l = s._bodyEl.querySelectorAll(".data-grid-row")[i - n];
23
- let o = l?.children[s._focusCol];
24
- if ((!o || !o.classList?.contains("cell")) && (o = l?.querySelector(`.cell[data-col="${s._focusCol}"]`) ?? l?.querySelector(".cell[data-col]")), o) {
20
+ const i = n._focusRow, s = n._virtualization.start ?? 0, r = n._virtualization.end ?? n._rows.length;
21
+ if (i >= s && i < r) {
22
+ const l = n._bodyEl.querySelectorAll(".data-grid-row")[i - s];
23
+ let o = l?.children[n._focusCol];
24
+ if ((!o || !o.classList?.contains("cell")) && (o = l?.querySelector(`.cell[data-col="${n._focusCol}"]`) ?? l?.querySelector(".cell[data-col]")), o) {
25
25
  o.classList.add("cell-focus"), o.setAttribute("aria-selected", "true");
26
- const a = s.querySelector(".tbw-scroll-area");
26
+ const a = n.querySelector(".tbw-scroll-area");
27
27
  if (a && o && (!t || e?.forceHorizontalScroll))
28
28
  if (e?.forceScrollLeft)
29
29
  a.scrollLeft = 0;
30
30
  else if (e?.forceScrollRight)
31
31
  a.scrollLeft = a.scrollWidth - a.clientWidth;
32
32
  else {
33
- const c = s._getHorizontalScrollOffsets?.(l ?? void 0, o) ?? { left: 0, right: 0 };
33
+ const c = n._getHorizontalScrollOffsets?.(l ?? void 0, o) ?? { left: 0, right: 0 };
34
34
  if (!c.skipScroll) {
35
35
  const d = o.getBoundingClientRect(), h = a.getBoundingClientRect(), u = d.left - h.left + a.scrollLeft, m = u + d.width, p = a.scrollLeft + c.left, g = a.scrollLeft + a.clientWidth - c.right;
36
36
  u < p ? a.scrollLeft = u - c.left : m > g && (a.scrollLeft = m - a.clientWidth + c.right);
37
37
  }
38
38
  }
39
- if (s._activeEditRows !== void 0 && s._activeEditRows !== -1 && o.classList.contains("editing")) {
39
+ if (n._activeEditRows !== void 0 && n._activeEditRows !== -1 && o.classList.contains("editing")) {
40
40
  const c = o.querySelector(v);
41
41
  if (c && document.activeElement !== c)
42
42
  try {
@@ -433,51 +433,51 @@ class P {
433
433
  // #endregion
434
434
  }
435
435
  const M = "@layer tbw-plugins{tbw-grid{--tbw-editing-bg: var(--tbw-color-selection);--tbw-editing-row-bg: var(--tbw-editing-bg);--tbw-editing-border: var(--tbw-border-input, 1px solid var(--tbw-color-border-strong));--tbw-padding-editing-input: var(--tbw-cell-padding-input, 2px 6px);--tbw-font-size-editor: inherit;--tbw-editing-row-outline-color: var(--tbw-color-accent);--tbw-editing-row-outline-width: 1px;--tbw-invalid-bg: light-dark(#fef2f2, #450a0a);--tbw-invalid-border-color: light-dark(#ef4444, #f87171)}tbw-grid:not(.tbw-grid-mode) .data-grid-row:has(.editing){background:var(--tbw-editing-row-bg);outline:var(--tbw-editing-row-outline-width) solid var(--tbw-editing-row-outline-color);outline-offset:calc(-1 * var(--tbw-editing-row-outline-width))}tbw-grid .data-grid-row>.cell.editing{overflow:hidden;padding:0;display:flex;min-height:calc(var(--tbw-row-height) + 2px);align-items:center;justify-content:center}tbw-grid .data-grid-row>.cell.editing input:not([type=checkbox]),tbw-grid .data-grid-row>.cell.editing select,tbw-grid .data-grid-row>.cell.editing textarea{width:100%;height:100%;flex:1 1 auto;min-width:0;border:var(--tbw-editing-border);padding:var(--tbw-padding-editing-input);font-size:var(--tbw-font-size-editor)}tbw-grid .tbw-editor-host{display:contents}tbw-grid .data-grid-row>.cell[data-invalid=true]{background:var(--tbw-invalid-bg);outline:1px solid var(--tbw-invalid-border-color);outline-offset:-1px}}";
436
- function D(s) {
437
- const e = s.options;
436
+ function D(n) {
437
+ const e = n.options;
438
438
  return e ? typeof e == "function" ? e() : e : [];
439
439
  }
440
- function x(s) {
440
+ function H(n) {
441
441
  return (e) => {
442
- const t = s.editorParams, i = document.createElement("input");
442
+ const t = n.editorParams, i = document.createElement("input");
443
443
  i.type = "number", i.value = e.value != null ? String(e.value) : "", t?.min !== void 0 && (i.min = String(t.min)), t?.max !== void 0 && (i.max = String(t.max)), t?.step !== void 0 && (i.step = String(t.step)), t?.placeholder && (i.placeholder = t.placeholder);
444
- const n = () => e.commit(i.value === "" ? null : Number(i.value));
445
- return i.addEventListener("blur", n), i.addEventListener("keydown", (r) => {
446
- r.key === "Enter" && n(), r.key === "Escape" && e.cancel();
444
+ const s = () => e.commit(i.value === "" ? null : Number(i.value));
445
+ return i.addEventListener("blur", s), i.addEventListener("keydown", (r) => {
446
+ r.key === "Enter" && s(), r.key === "Escape" && e.cancel();
447
447
  }), i;
448
448
  };
449
449
  }
450
- function H() {
451
- return (s) => {
450
+ function O() {
451
+ return (n) => {
452
452
  const e = document.createElement("input");
453
- return e.type = "checkbox", e.checked = !!s.value, e.addEventListener("change", () => s.commit(e.checked)), e;
453
+ return e.type = "checkbox", e.checked = !!n.value, e.addEventListener("change", () => n.commit(e.checked)), e;
454
454
  };
455
455
  }
456
- function O(s) {
456
+ function B(n) {
457
457
  return (e) => {
458
- const t = s.editorParams, i = document.createElement("input");
458
+ const t = n.editorParams, i = document.createElement("input");
459
459
  i.type = "date", e.value instanceof Date ? i.valueAsDate = e.value : typeof e.value == "string" && e.value && (i.value = e.value.split("T")[0]), t?.min && (i.min = t.min), t?.max && (i.max = t.max), t?.placeholder && (i.placeholder = t.placeholder);
460
- const n = () => {
460
+ const s = () => {
461
461
  typeof e.value == "string" ? e.commit(i.value) : e.commit(i.valueAsDate);
462
462
  };
463
- return i.addEventListener("change", n), i.addEventListener("keydown", (r) => {
463
+ return i.addEventListener("change", s), i.addEventListener("keydown", (r) => {
464
464
  r.key === "Escape" && e.cancel();
465
465
  }), i;
466
466
  };
467
467
  }
468
- function B(s) {
468
+ function x(n) {
469
469
  return (e) => {
470
- const t = s.editorParams, i = document.createElement("select");
471
- if (s.multi && (i.multiple = !0), t?.includeEmpty) {
470
+ const t = n.editorParams, i = document.createElement("select");
471
+ if (n.multi && (i.multiple = !0), t?.includeEmpty) {
472
472
  const l = document.createElement("option");
473
473
  l.value = "", l.textContent = t.emptyLabel ?? "", i.appendChild(l);
474
474
  }
475
- D(s).forEach((l) => {
475
+ D(n).forEach((l) => {
476
476
  const o = document.createElement("option");
477
- o.value = String(l.value), o.textContent = l.label, (s.multi && Array.isArray(e.value) && e.value.includes(l.value) || !s.multi && e.value === l.value) && (o.selected = !0), i.appendChild(o);
477
+ o.value = String(l.value), o.textContent = l.label, (n.multi && Array.isArray(e.value) && e.value.includes(l.value) || !n.multi && e.value === l.value) && (o.selected = !0), i.appendChild(o);
478
478
  });
479
479
  const r = () => {
480
- if (s.multi) {
480
+ if (n.multi) {
481
481
  const l = Array.from(i.selectedOptions).map((o) => o.value);
482
482
  e.commit(l);
483
483
  } else
@@ -488,67 +488,67 @@ function B(s) {
488
488
  }), i;
489
489
  };
490
490
  }
491
- function N(s) {
491
+ function N(n) {
492
492
  return (e) => {
493
- const t = s.editorParams, i = document.createElement("input");
493
+ const t = n.editorParams, i = document.createElement("input");
494
494
  i.type = "text", i.value = e.value != null ? String(e.value) : "", t?.maxLength !== void 0 && (i.maxLength = t.maxLength), t?.pattern && (i.pattern = t.pattern), t?.placeholder && (i.placeholder = t.placeholder);
495
- const n = () => {
495
+ const s = () => {
496
496
  const r = i.value;
497
- typeof e.value == "number" && r !== "" ? e.commit(Number(r)) : e.commit(r);
497
+ (e.value === null || e.value === void 0) && r === "" || typeof e.value == "string" && r === e.value.replace(/[\n\r]/g, "") || (typeof e.value == "number" && r !== "" ? e.commit(Number(r)) : e.commit(r));
498
498
  };
499
- return i.addEventListener("blur", n), i.addEventListener("keydown", (r) => {
500
- r.key === "Enter" && n(), r.key === "Escape" && e.cancel();
499
+ return i.addEventListener("blur", s), i.addEventListener("keydown", (r) => {
500
+ r.key === "Enter" && s(), r.key === "Escape" && e.cancel();
501
501
  }), i;
502
502
  };
503
503
  }
504
- function z(s) {
505
- switch (s.type) {
504
+ function z(n) {
505
+ switch (n.type) {
506
506
  case "number":
507
- return x(s);
507
+ return H(n);
508
508
  case "boolean":
509
- return H();
509
+ return O();
510
510
  case "date":
511
- return O(s);
511
+ return B(n);
512
512
  case "select":
513
- return B(s);
513
+ return x(n);
514
514
  default:
515
- return N(s);
515
+ return N(n);
516
516
  }
517
517
  }
518
- function G(s, e) {
518
+ function G(n, e) {
519
519
  if (e.editor) return e.editor;
520
520
  if (e.__editorTemplate) return "template";
521
521
  if (!e.type) return;
522
- const i = s.effectiveConfig?.typeDefaults;
522
+ const i = n.effectiveConfig?.typeDefaults;
523
523
  if (i?.[e.type]?.editor)
524
524
  return i[e.type].editor;
525
- const n = s.__frameworkAdapter;
526
- if (n?.getTypeDefault) {
527
- const r = n.getTypeDefault(e.type);
525
+ const s = n.__frameworkAdapter;
526
+ if (s?.getTypeDefault) {
527
+ const r = s.getTypeDefault(e.type);
528
528
  if (r?.editor)
529
529
  return r.editor;
530
530
  }
531
531
  }
532
- function C(s) {
533
- return !(typeof s != "string" || s === "__proto__" || s === "constructor" || s === "prototype");
532
+ function C(n) {
533
+ return !(typeof n != "string" || n === "__proto__" || n === "constructor" || n === "prototype");
534
534
  }
535
- function $(s) {
536
- const e = (s.__editingCellCount ?? 0) + 1;
537
- s.__editingCellCount = e, s.setAttribute("data-has-editing", "");
535
+ function $(n) {
536
+ const e = (n.__editingCellCount ?? 0) + 1;
537
+ n.__editingCellCount = e, n.setAttribute("data-has-editing", "");
538
538
  }
539
- function F(s) {
540
- s.__editingCellCount = 0, s.removeAttribute("data-has-editing");
539
+ function F(n) {
540
+ n.__editingCellCount = 0, n.removeAttribute("data-has-editing");
541
541
  }
542
- function y(s, e, t) {
543
- return s instanceof HTMLInputElement ? s.type === "checkbox" ? s.checked : s.type === "number" ? s.value === "" ? null : Number(s.value) : s.type === "date" ? typeof t == "string" ? s.value : s.valueAsDate : typeof t == "number" ? s.value === "" ? null : Number(s.value) : t == null && s.value === "" ? t : s.value : e?.type === "number" && s.value !== "" || typeof t == "number" && s.value !== "" ? Number(s.value) : t == null && s.value === "" ? t : s.value;
542
+ function y(n, e, t) {
543
+ return n instanceof HTMLInputElement ? n.type === "checkbox" ? n.checked : n.type === "number" ? n.value === "" ? null : Number(n.value) : n.type === "date" ? typeof t == "string" ? n.value : n.valueAsDate : typeof t == "number" ? n.value === "" ? null : Number(n.value) : t == null && n.value === "" || typeof t == "string" && n.value === t.replace(/[\n\r]/g, "") ? t : n.value : e?.type === "number" && n.value !== "" || typeof t == "number" && n.value !== "" ? Number(n.value) : t == null && n.value === "" ? t : n.value;
544
544
  }
545
- function A(s) {
545
+ function A(n) {
546
546
  }
547
- function j(s, e, t, i) {
548
- const n = s.querySelector("input,textarea,select");
549
- n && (n.addEventListener("blur", () => {
550
- t(y(n, e, i));
551
- }), n instanceof HTMLInputElement && n.type === "checkbox" ? n.addEventListener("change", () => t(n.checked)) : n instanceof HTMLSelectElement && n.addEventListener("change", () => t(y(n, e, i))));
547
+ function j(n, e, t, i) {
548
+ const s = n.querySelector("input,textarea,select");
549
+ s && (s.addEventListener("blur", () => {
550
+ t(y(s, e, i));
551
+ }), s instanceof HTMLInputElement && s.type === "checkbox" ? s.addEventListener("change", () => t(s.checked)) : s instanceof HTMLSelectElement && s.addEventListener("change", () => t(y(s, e, i))));
552
552
  }
553
553
  class W extends P {
554
554
  /**
@@ -630,7 +630,7 @@ class W extends P {
630
630
  * When false: arrow keys navigate between cells (navigation mode).
631
631
  * Escape switches to navigation mode, Enter switches to edit mode.
632
632
  */
633
- #s = !1;
633
+ #n = !1;
634
634
  /**
635
635
  * In grid mode, when true, prevents inputs from auto-focusing.
636
636
  * This is set when Escape is pressed (navigation mode) and cleared
@@ -649,68 +649,68 @@ class W extends P {
649
649
  }), Object.defineProperty(e, "changedRowIds", {
650
650
  get: () => this.changedRowIds,
651
651
  configurable: !0
652
- }), e.resetChangedRows = (n) => this.resetChangedRows(n), e.beginBulkEdit = (n, r) => {
653
- r && this.beginCellEdit(n, r);
652
+ }), e.resetChangedRows = (s) => this.resetChangedRows(s), e.beginBulkEdit = (s, r) => {
653
+ r && this.beginCellEdit(s, r);
654
654
  }, document.addEventListener(
655
655
  "keydown",
656
- (n) => {
657
- if (!this.#t && n.key === "Escape" && this.#e !== -1) {
658
- if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(n) === !1)
656
+ (s) => {
657
+ if (!this.#t && s.key === "Escape" && this.#e !== -1) {
658
+ if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(s) === !1)
659
659
  return;
660
- this.#n(this.#e, !0);
660
+ this.#s(this.#e, !0);
661
661
  }
662
662
  },
663
663
  { capture: !0, signal: t }
664
664
  ), document.addEventListener(
665
665
  "mousedown",
666
- (n) => {
666
+ (s) => {
667
667
  if (this.#t || this.#e === -1) return;
668
668
  const r = i.findRenderedRowElement?.(this.#e);
669
- !r || (n.composedPath && n.composedPath() || []).includes(r) || this.config.onBeforeEditClose && this.config.onBeforeEditClose(n) === !1 || queueMicrotask(() => {
670
- this.#e !== -1 && this.#n(this.#e, !1);
669
+ !r || (s.composedPath && s.composedPath() || []).includes(r) || this.config.onBeforeEditClose && this.config.onBeforeEditClose(s) === !1 || queueMicrotask(() => {
670
+ this.#e !== -1 && this.#s(this.#e, !1);
671
671
  });
672
672
  },
673
673
  { signal: t }
674
674
  ), this.#t && (this.gridElement.classList.add("tbw-grid-mode"), this.requestRender(), this.gridElement.addEventListener(
675
675
  "focusin",
676
- (n) => {
677
- const r = n.target;
676
+ (s) => {
677
+ const r = s.target;
678
678
  if (r.matches(v)) {
679
679
  if (this.#a) {
680
680
  r.blur(), this.gridElement.focus();
681
681
  return;
682
682
  }
683
- this.#s = !0;
683
+ this.#n = !0;
684
684
  }
685
685
  },
686
686
  { signal: t }
687
687
  ), this.gridElement.addEventListener(
688
688
  "focusout",
689
- (n) => {
690
- const r = n.relatedTarget;
691
- (!r || !this.gridElement.contains(r) || !r.matches(v)) && (this.#s = !1);
689
+ (s) => {
690
+ const r = s.relatedTarget;
691
+ (!r || !this.gridElement.contains(r) || !r.matches(v)) && (this.#n = !1);
692
692
  },
693
693
  { signal: t }
694
694
  ), this.gridElement.addEventListener(
695
695
  "keydown",
696
- (n) => {
697
- if (n.key === "Escape" && this.#s) {
696
+ (s) => {
697
+ if (s.key === "Escape" && this.#n) {
698
698
  const r = document.activeElement;
699
- r && this.gridElement.contains(r) && (r.blur(), this.gridElement.focus()), this.#s = !1, this.#a = !0, n.preventDefault(), n.stopPropagation();
699
+ r && this.gridElement.contains(r) && (r.blur(), this.gridElement.focus()), this.#n = !1, this.#a = !0, s.preventDefault(), s.stopPropagation();
700
700
  }
701
701
  },
702
702
  { capture: !0, signal: t }
703
703
  ), this.gridElement.addEventListener(
704
704
  "mousedown",
705
- (n) => {
706
- n.target.matches(v) && (this.#a = !1);
705
+ (s) => {
706
+ s.target.matches(v) && (this.#a = !1);
707
707
  },
708
708
  { signal: t }
709
709
  ));
710
710
  }
711
711
  /** @internal */
712
712
  detach() {
713
- this.gridElement.classList.remove("tbw-grid-mode"), this.#e = -1, this.#c = -1, this.#l.clear(), this.#r.clear(), this.#o.clear(), this.#s = !1, this.#a = !1, super.detach();
713
+ this.gridElement.classList.remove("tbw-grid-mode"), this.#e = -1, this.#c = -1, this.#l.clear(), this.#r.clear(), this.#o.clear(), this.#n = !1, this.#a = !1, super.detach();
714
714
  }
715
715
  /**
716
716
  * Handle plugin queries.
@@ -732,8 +732,8 @@ class W extends P {
732
732
  if (this.#t) return !1;
733
733
  const t = this.grid, i = this.config.editOn ?? t.effectiveConfig?.editOn;
734
734
  if (i === !1 || i === "manual" || i !== "click" && i !== "dblclick") return !1;
735
- const n = e.originalEvent.type === "dblclick";
736
- if (i === "click" && n || i === "dblclick" && !n) return !1;
735
+ const s = e.originalEvent.type === "dblclick";
736
+ if (i === "click" && s || i === "dblclick" && !s) return !1;
737
737
  const { rowIndex: r } = e;
738
738
  return t._columns?.some((o) => o.editable) ? (e.originalEvent.stopPropagation(), this.beginBulkEdit(r), !0) : !1;
739
739
  }
@@ -744,20 +744,20 @@ class W extends P {
744
744
  onKeyDown(e) {
745
745
  const t = this.grid;
746
746
  if (e.key === "Escape") {
747
- if (this.#t && this.#s) {
747
+ if (this.#t && this.#n) {
748
748
  const i = document.activeElement;
749
- return i && this.gridElement.contains(i) && i.blur(), this.#s = !1, this.requestAfterRender(), !0;
749
+ return i && this.gridElement.contains(i) && i.blur(), this.#n = !1, this.requestAfterRender(), !0;
750
750
  }
751
751
  if (this.#e !== -1 && !this.#t)
752
- return this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1 || this.#n(this.#e, !0), !0;
752
+ return this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1 || this.#s(this.#e, !0), !0;
753
753
  }
754
- if (this.#t && !this.#s && (e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight"))
754
+ if (this.#t && !this.#n && (e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight"))
755
755
  return !1;
756
756
  if ((e.key === "ArrowUp" || e.key === "ArrowDown") && this.#e !== -1 && !this.#t) {
757
757
  if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1)
758
758
  return !0;
759
- const i = t._rows.length - 1, n = this.#e;
760
- return this.#n(n, !1), e.key === "ArrowDown" ? t._focusRow = Math.min(i, t._focusRow + 1) : t._focusRow = Math.max(0, t._focusRow - 1), e.preventDefault(), R(t), this.requestAfterRender(), !0;
759
+ const i = t._rows.length - 1, s = this.#e;
760
+ return this.#s(s, !1), e.key === "ArrowDown" ? t._focusRow = Math.min(i, t._focusRow + 1) : t._focusRow = Math.max(0, t._focusRow - 1), e.preventDefault(), R(t), this.requestAfterRender(), !0;
761
761
  }
762
762
  if (e.key === "Tab" && (this.#e !== -1 || this.#t)) {
763
763
  e.preventDefault();
@@ -767,9 +767,9 @@ class W extends P {
767
767
  if (e.key === " " || e.key === "Spacebar") {
768
768
  if (this.#e !== -1)
769
769
  return !1;
770
- const i = t._focusRow, n = t._focusCol;
771
- if (i >= 0 && n >= 0) {
772
- const r = t._visibleColumns[n], l = t._rows[i];
770
+ const i = t._focusRow, s = t._focusCol;
771
+ if (i >= 0 && s >= 0) {
772
+ const r = t._visibleColumns[s], l = t._rows[i];
773
773
  if (r?.editable && r.type === "boolean" && l) {
774
774
  const o = r.field;
775
775
  if (C(o)) {
@@ -781,19 +781,19 @@ class W extends P {
781
781
  return !1;
782
782
  }
783
783
  if (e.key === "Enter" && !e.shiftKey) {
784
- if (this.#t && !this.#s)
784
+ if (this.#t && !this.#n)
785
785
  return this.#v(), !0;
786
786
  if (this.#e !== -1)
787
787
  return !!(this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1);
788
788
  const i = this.config.editOn ?? t.effectiveConfig?.editOn;
789
789
  if (i === !1 || i === "manual") return !1;
790
- const n = t._focusRow, r = t._focusCol;
791
- if (n >= 0 && t._columns?.some((o) => o.editable)) {
792
- const o = t._visibleColumns[r], a = t._rows[n], c = o?.field ?? "", d = c && a ? a[c] : void 0, h = this.gridElement.querySelector(`[data-row="${n}"][data-col="${r}"]`), u = new CustomEvent("cell-activate", {
790
+ const s = t._focusRow, r = t._focusCol;
791
+ if (s >= 0 && t._columns?.some((o) => o.editable)) {
792
+ const o = t._visibleColumns[r], a = t._rows[s], c = o?.field ?? "", d = c && a ? a[c] : void 0, h = this.gridElement.querySelector(`[data-row="${s}"][data-col="${r}"]`), u = new CustomEvent("cell-activate", {
793
793
  cancelable: !0,
794
794
  bubbles: !0,
795
795
  detail: {
796
- rowIndex: n,
796
+ rowIndex: s,
797
797
  colIndex: r,
798
798
  field: c,
799
799
  value: d,
@@ -807,9 +807,9 @@ class W extends P {
807
807
  const m = new CustomEvent("activate-cell", {
808
808
  cancelable: !0,
809
809
  bubbles: !0,
810
- detail: { row: n, col: r }
810
+ detail: { row: s, col: r }
811
811
  });
812
- return this.gridElement.dispatchEvent(m), u.defaultPrevented || m.defaultPrevented ? (e.preventDefault(), !0) : (this.beginBulkEdit(n), !0);
812
+ return this.gridElement.dispatchEvent(m), u.defaultPrevented || m.defaultPrevented ? (e.preventDefault(), !0) : (this.beginBulkEdit(s), !0);
813
813
  }
814
814
  return !1;
815
815
  }
@@ -823,12 +823,12 @@ class W extends P {
823
823
  * @internal
824
824
  */
825
825
  processColumns(e) {
826
- const t = this.grid, i = t.effectiveConfig?.typeDefaults, n = t.__frameworkAdapter;
827
- return !i && !n?.getTypeDefault ? e : e.map((r) => {
826
+ const t = this.grid, i = t.effectiveConfig?.typeDefaults, s = t.__frameworkAdapter;
827
+ return !i && !s?.getTypeDefault ? e : e.map((r) => {
828
828
  if (!r.type) return r;
829
829
  let l;
830
- if (i?.[r.type]?.editorParams && (l = i[r.type].editorParams), !l && n?.getTypeDefault) {
831
- const o = n.getTypeDefault(r.type);
830
+ if (i?.[r.type]?.editorParams && (l = i[r.type].editorParams), !l && s?.getTypeDefault) {
831
+ const o = s.getTypeDefault(r.type);
832
832
  o?.editorParams && (l = o.editorParams);
833
833
  }
834
834
  return l ? {
@@ -851,7 +851,7 @@ class W extends P {
851
851
  }
852
852
  if (!this.#t && this.#o.size !== 0)
853
853
  for (const t of this.#o) {
854
- const [i, n] = t.split(":"), r = parseInt(i, 10), l = parseInt(n, 10), o = e.findRenderedRowElement?.(r);
854
+ const [i, s] = t.split(":"), r = parseInt(i, 10), l = parseInt(s, 10), o = e.findRenderedRowElement?.(r);
855
855
  if (!o) continue;
856
856
  const a = o.querySelector(`.cell[data-col="${l}"]`);
857
857
  if (!a || a.classList.contains("editing")) continue;
@@ -866,8 +866,8 @@ class W extends P {
866
866
  */
867
867
  afterCellRender(e) {
868
868
  if (!this.#t) return;
869
- const { row: t, rowIndex: i, column: n, colIndex: r, cellElement: l } = e;
870
- n.editable && (l.classList.contains("editing") || this.#g(t, i, n, r, l, !0));
869
+ const { row: t, rowIndex: i, column: s, colIndex: r, cellElement: l } = e;
870
+ s.editable && (l.classList.contains("editing") || this.#g(t, i, s, r, l, !0));
871
871
  }
872
872
  /**
873
873
  * On scroll render, reapply editors to recycled cells.
@@ -928,8 +928,8 @@ class W extends P {
928
928
  const t = this.grid, i = t._rows[e];
929
929
  if (!i) return !1;
930
930
  try {
931
- const n = t.getRowId?.(i);
932
- return n ? this.#r.has(n) : !1;
931
+ const s = t.getRowId?.(i);
932
+ return s ? this.#r.has(s) : !1;
933
933
  } catch {
934
934
  return !1;
935
935
  }
@@ -964,8 +964,8 @@ class W extends P {
964
964
  * ```
965
965
  */
966
966
  setInvalid(e, t, i = "") {
967
- let n = this.#i.get(e);
968
- n || (n = /* @__PURE__ */ new Map(), this.#i.set(e, n)), n.set(t, i), this.#f(e, t, !0);
967
+ let s = this.#i.get(e);
968
+ s || (s = /* @__PURE__ */ new Map(), this.#i.set(e, s)), s.set(t, i), this.#f(e, t, !0);
969
969
  }
970
970
  /**
971
971
  * Clear the invalid state for a specific cell.
@@ -986,7 +986,7 @@ class W extends P {
986
986
  const t = this.#i.get(e);
987
987
  if (t) {
988
988
  const i = Array.from(t.keys());
989
- this.#i.delete(e), i.forEach((n) => this.#f(e, n, !1));
989
+ this.#i.delete(e), i.forEach((s) => this.#f(e, s, !1));
990
990
  }
991
991
  }
992
992
  /**
@@ -995,7 +995,7 @@ class W extends P {
995
995
  clearAllInvalid() {
996
996
  const e = Array.from(this.#i.entries());
997
997
  this.#i.clear(), e.forEach(([t, i]) => {
998
- i.forEach((n, r) => this.#f(t, r, !1));
998
+ i.forEach((s, r) => this.#f(t, r, !1));
999
999
  });
1000
1000
  }
1001
1001
  /**
@@ -1041,17 +1041,17 @@ class W extends P {
1041
1041
  * Sync the data-invalid attribute on a cell element.
1042
1042
  */
1043
1043
  #f(e, t, i) {
1044
- const n = this.grid, r = n._visibleColumns?.findIndex((d) => d.field === t);
1044
+ const s = this.grid, r = s._visibleColumns?.findIndex((d) => d.field === t);
1045
1045
  if (r === -1 || r === void 0) return;
1046
- const o = n._rows?.findIndex((d) => {
1046
+ const o = s._rows?.findIndex((d) => {
1047
1047
  try {
1048
- return n.getRowId?.(d) === e;
1048
+ return s.getRowId?.(d) === e;
1049
1049
  } catch {
1050
1050
  return !1;
1051
1051
  }
1052
1052
  });
1053
1053
  if (o === -1 || o === void 0) return;
1054
- const c = n.findRenderedRowElement?.(o)?.querySelector(`.cell[data-col="${r}"]`);
1054
+ const c = s.findRenderedRowElement?.(o)?.querySelector(`.cell[data-col="${r}"]`);
1055
1055
  if (c)
1056
1056
  if (i) {
1057
1057
  c.setAttribute("data-invalid", "true");
@@ -1077,10 +1077,10 @@ class W extends P {
1077
1077
  * @fires cell-commit - Emitted when the cell value is committed (on blur or Enter)
1078
1078
  */
1079
1079
  beginCellEdit(e, t) {
1080
- const i = this.grid, n = i._visibleColumns.findIndex((a) => a.field === t);
1081
- if (n === -1 || !i._visibleColumns[n]?.editable) return;
1082
- const o = i.findRenderedRowElement?.(e)?.querySelector(`.cell[data-col="${n}"]`);
1083
- o && this.#w(e, n, o);
1080
+ const i = this.grid, s = i._visibleColumns.findIndex((a) => a.field === t);
1081
+ if (s === -1 || !i._visibleColumns[s]?.editable) return;
1082
+ const o = i.findRenderedRowElement?.(e)?.querySelector(`.cell[data-col="${s}"]`);
1083
+ o && this.#w(e, s, o);
1084
1084
  }
1085
1085
  /**
1086
1086
  * Programmatically begin editing all editable cells in a row.
@@ -1116,13 +1116,13 @@ class W extends P {
1116
1116
  * @fires row-commit - Emitted after the row edit is committed
1117
1117
  */
1118
1118
  commitActiveRowEdit() {
1119
- this.#e !== -1 && this.#n(this.#e, !1);
1119
+ this.#e !== -1 && this.#s(this.#e, !1);
1120
1120
  }
1121
1121
  /**
1122
1122
  * Cancel the currently active row edit.
1123
1123
  */
1124
1124
  cancelActiveRowEdit() {
1125
- this.#e !== -1 && this.#n(this.#e, !0);
1125
+ this.#e !== -1 && this.#s(this.#e, !0);
1126
1126
  }
1127
1127
  // #endregion
1128
1128
  // #region Internal Methods
@@ -1130,7 +1130,7 @@ class W extends P {
1130
1130
  * Begin editing a single cell.
1131
1131
  */
1132
1132
  #w(e, t, i) {
1133
- const n = this.grid, r = n._rows[e], l = n._visibleColumns[t];
1133
+ const s = this.grid, r = s._rows[e], l = s._visibleColumns[t];
1134
1134
  !r || !l?.editable || i.classList.contains("editing") || (this.#e !== e && this.#m(e, r), this.#c = t, this.#g(r, e, l, t, i, !1));
1135
1135
  }
1136
1136
  /**
@@ -1143,7 +1143,7 @@ class W extends P {
1143
1143
  const r = e.findRenderedRowElement?.(t)?.querySelector(`.cell[data-col="${i}"]`);
1144
1144
  if (r?.classList.contains("editing")) {
1145
1145
  const l = r.querySelector(v);
1146
- l && (this.#a = !1, l.focus(), this.#s = !0, l instanceof HTMLInputElement && (l.type === "text" || l.type === "number") && l.select());
1146
+ l && (this.#a = !1, l.focus(), this.#n = !0, l instanceof HTMLInputElement && (l.type === "text" || l.type === "number") && l.select());
1147
1147
  }
1148
1148
  }
1149
1149
  /**
@@ -1152,20 +1152,20 @@ class W extends P {
1152
1152
  * Wraps to next/previous row when reaching row boundaries.
1153
1153
  */
1154
1154
  #b(e) {
1155
- const t = this.grid, i = t._rows, n = this.#t ? t._focusRow : this.#e, r = t._visibleColumns.map((c, d) => c.editable ? d : -1).filter((c) => c >= 0);
1155
+ const t = this.grid, i = t._rows, s = this.#t ? t._focusRow : this.#e, r = t._visibleColumns.map((c, d) => c.editable ? d : -1).filter((c) => c >= 0);
1156
1156
  if (r.length === 0) return;
1157
1157
  const o = r.indexOf(t._focusCol) + (e ? 1 : -1);
1158
1158
  if (o >= 0 && o < r.length) {
1159
1159
  t._focusCol = r[o];
1160
- const d = t.findRenderedRowElement?.(n)?.querySelector(`.cell[data-col="${r[o]}"]`);
1160
+ const d = t.findRenderedRowElement?.(s)?.querySelector(`.cell[data-col="${r[o]}"]`);
1161
1161
  d?.classList.contains("editing") && d.querySelector(v)?.focus({ preventScroll: !0 }), R(t, { forceHorizontalScroll: !0 });
1162
1162
  return;
1163
1163
  }
1164
- const a = n + (e ? 1 : -1);
1164
+ const a = s + (e ? 1 : -1);
1165
1165
  a >= 0 && a < i.length && (this.#t ? (t._focusRow = a, t._focusCol = e ? r[0] : r[r.length - 1], R(t, { forceHorizontalScroll: !0 }), this.requestAfterRender(), setTimeout(() => {
1166
1166
  const d = t.findRenderedRowElement?.(a)?.querySelector(`.cell[data-col="${t._focusCol}"]`);
1167
1167
  d?.classList.contains("editing") && d.querySelector(v)?.focus({ preventScroll: !0 });
1168
- }, 0)) : (this.#n(n, !1), t._focusRow = a, t._focusCol = e ? r[0] : r[r.length - 1], this.beginBulkEdit(a), R(t, { forceHorizontalScroll: !0 })));
1168
+ }, 0)) : (this.#s(s, !1), t._focusRow = a, t._focusCol = e ? r[0] : r[r.length - 1], this.beginBulkEdit(a), R(t, { forceHorizontalScroll: !0 })));
1169
1169
  }
1170
1170
  /**
1171
1171
  * Sync the internal grid state with the plugin's editing state.
@@ -1178,14 +1178,26 @@ class W extends P {
1178
1178
  * Snapshot original row data and mark as editing.
1179
1179
  */
1180
1180
  #m(e, t) {
1181
- this.#e !== e && (this.#l.set(e, { ...t }), this.#e = e, this.#h());
1181
+ if (this.#e !== e && (this.#l.set(e, { ...t }), this.#e = e, this.#h(), !this.#t)) {
1182
+ const i = this.grid;
1183
+ let s = "";
1184
+ try {
1185
+ s = i.getRowId?.(t) ?? "";
1186
+ } catch {
1187
+ }
1188
+ this.emit("edit-open", {
1189
+ rowIndex: e,
1190
+ rowId: s,
1191
+ row: t
1192
+ });
1193
+ }
1182
1194
  }
1183
1195
  /**
1184
1196
  * Exit editing for a row.
1185
1197
  */
1186
- #n(e, t) {
1198
+ #s(e, t) {
1187
1199
  if (this.#e !== e) return;
1188
- const i = this.grid, n = this.#l.get(e), r = i._rows[e], l = i.findRenderedRowElement?.(e);
1200
+ const i = this.grid, s = this.#l.get(e), r = i._rows[e], l = i.findRenderedRowElement?.(e);
1189
1201
  let o;
1190
1202
  if (r)
1191
1203
  try {
@@ -1203,23 +1215,23 @@ class W extends P {
1203
1215
  const m = h.field, p = r[m], g = y(u, h, p);
1204
1216
  p !== g && this.#p(e, h, g, r);
1205
1217
  }
1206
- }), t && n && r)
1207
- Object.keys(n).forEach((a) => {
1208
- r[a] = n[a];
1218
+ }), t && s && r)
1219
+ Object.keys(s).forEach((a) => {
1220
+ r[a] = s[a];
1209
1221
  }), o && (this.#r.delete(o), this.clearRowInvalid(o));
1210
1222
  else if (!t && r) {
1211
- const a = this.#C(n, r), c = o ? this.#r.has(o) : a, d = this.emitCancelable("row-commit", {
1223
+ const a = this.#C(s, r), c = o ? this.#r.has(o) : a, d = this.emitCancelable("row-commit", {
1212
1224
  rowIndex: e,
1213
1225
  rowId: o ?? "",
1214
1226
  row: r,
1215
- oldValue: n,
1227
+ oldValue: s,
1216
1228
  newValue: r,
1217
1229
  changed: c,
1218
1230
  changedRows: this.changedRows,
1219
1231
  changedRowIds: this.changedRowIds
1220
1232
  });
1221
- d && n ? (Object.keys(n).forEach((h) => {
1222
- r[h] = n[h];
1233
+ d && s ? (Object.keys(s).forEach((h) => {
1234
+ r[h] = s[h];
1223
1235
  }), o && (this.#r.delete(o), this.clearRowInvalid(o))) : !d && a && this.isAnimationEnabled && (this.#u = e);
1224
1236
  }
1225
1237
  this.#l.delete(e), this.#e = -1, this.#c = -1, this.#h();
@@ -1227,21 +1239,26 @@ class W extends P {
1227
1239
  a.startsWith(`${e}:`) && this.#o.delete(a);
1228
1240
  l && (l.querySelectorAll(".cell.editing").forEach((a) => {
1229
1241
  a.classList.remove("editing"), F(a.parentElement);
1230
- }), this.requestRender()), this.#d = !0, l || (this.#E(i), this.#d = !1);
1242
+ }), this.requestRender()), this.#d = !0, l || (this.#E(i), this.#d = !1), !this.#t && r && this.emit("edit-close", {
1243
+ rowIndex: e,
1244
+ rowId: o ?? "",
1245
+ row: r,
1246
+ reverted: t
1247
+ });
1231
1248
  }
1232
1249
  /**
1233
1250
  * Commit a single cell value change.
1234
1251
  * Uses ID-based change tracking for stability when rows are reordered.
1235
1252
  */
1236
- #p(e, t, i, n) {
1253
+ #p(e, t, i, s) {
1237
1254
  const r = t.field;
1238
1255
  if (!C(r)) return;
1239
- const l = n[r];
1256
+ const l = s[r];
1240
1257
  if (l === i) return;
1241
1258
  const o = this.grid;
1242
1259
  let a;
1243
1260
  try {
1244
- a = this.grid.getRowId(n);
1261
+ a = this.grid.getRowId(s);
1245
1262
  } catch {
1246
1263
  }
1247
1264
  const c = a ? !this.#r.has(a) : !0, d = a ? (g) => this.grid.updateRow(a, g, "cascade") : A;
@@ -1251,7 +1268,7 @@ class W extends P {
1251
1268
  } : () => {
1252
1269
  };
1253
1270
  if (this.emitCancelable("cell-commit", {
1254
- row: n,
1271
+ row: s,
1255
1272
  rowId: a ?? "",
1256
1273
  field: r,
1257
1274
  oldValue: l,
@@ -1263,7 +1280,7 @@ class W extends P {
1263
1280
  updateRow: d,
1264
1281
  setInvalid: u
1265
1282
  })) return;
1266
- a && !h && this.isCellInvalid(a, r) && this.clearInvalid(a, r), n[r] = i, a && this.#r.add(a), this.#h(), this.emitPluginEvent("cell-edit-committed", {
1283
+ a && !h && this.isCellInvalid(a, r) && this.clearInvalid(a, r), s[r] = i, a && this.#r.add(a), this.#h(), this.emitPluginEvent("cell-edit-committed", {
1267
1284
  rowIndex: e,
1268
1285
  field: r,
1269
1286
  oldValue: l,
@@ -1275,7 +1292,7 @@ class W extends P {
1275
1292
  /**
1276
1293
  * Inject an editor into a cell.
1277
1294
  */
1278
- #g(e, t, i, n, r, l) {
1295
+ #g(e, t, i, s, r, l) {
1279
1296
  if (!i.editable || r.classList.contains("editing")) return;
1280
1297
  let o;
1281
1298
  try {
@@ -1283,7 +1300,7 @@ class W extends P {
1283
1300
  } catch {
1284
1301
  }
1285
1302
  const a = o ? (f) => this.grid.updateRow(o, f, "cascade") : A, c = C(i.field) ? e[i.field] : void 0;
1286
- r.classList.add("editing"), this.#o.add(`${t}:${n}`);
1303
+ r.classList.add("editing"), this.#o.add(`${t}:${s}`);
1287
1304
  const d = r.parentElement;
1288
1305
  d && $(d);
1289
1306
  let h = !1;
@@ -1302,7 +1319,7 @@ class W extends P {
1302
1319
  }
1303
1320
  if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(f) === !1)
1304
1321
  return;
1305
- f.stopPropagation(), f.preventDefault(), h = !0, this.#n(t, !1);
1322
+ f.stopPropagation(), f.preventDefault(), h = !0, this.#s(t, !1);
1306
1323
  }
1307
1324
  if (f.key === "Escape") {
1308
1325
  if (this.#t) {
@@ -1311,7 +1328,7 @@ class W extends P {
1311
1328
  }
1312
1329
  if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(f) === !1)
1313
1330
  return;
1314
- f.stopPropagation(), f.preventDefault(), m(), this.#n(t, !0);
1331
+ f.stopPropagation(), f.preventDefault(), m(), this.#s(t, !0);
1315
1332
  }
1316
1333
  });
1317
1334
  const g = i, b = g.__editorTemplate, w = G(this.grid, g) ?? z(i), _ = c;
@@ -1364,19 +1381,19 @@ class W extends P {
1364
1381
  /**
1365
1382
  * Render a template-based editor.
1366
1383
  */
1367
- #y(e, t, i, n, r, l, o, a) {
1384
+ #y(e, t, i, s, r, l, o, a) {
1368
1385
  const c = t.__editorTemplate;
1369
1386
  if (!c) return;
1370
1387
  const d = c.cloneNode(!0), h = t.__compiledEditor;
1371
1388
  h ? d.innerHTML = h({
1372
1389
  row: i,
1373
- value: n,
1390
+ value: s,
1374
1391
  field: t.field,
1375
1392
  column: t,
1376
1393
  commit: r,
1377
1394
  cancel: l
1378
1395
  }) : d.querySelectorAll("*").forEach((m) => {
1379
- m.childNodes.length === 1 && m.firstChild?.nodeType === Node.TEXT_NODE && (m.textContent = m.textContent?.replace(/{{\s*value\s*}}/g, n == null ? "" : String(n)).replace(/{{\s*row\.([a-zA-Z0-9_]+)\s*}}/g, (p, g) => {
1396
+ m.childNodes.length === 1 && m.firstChild?.nodeType === Node.TEXT_NODE && (m.textContent = m.textContent?.replace(/{{\s*value\s*}}/g, s == null ? "" : String(s)).replace(/{{\s*row\.([a-zA-Z0-9_]+)\s*}}/g, (p, g) => {
1380
1397
  if (!C(g)) return "";
1381
1398
  const b = i[g];
1382
1399
  return b == null ? "" : String(b);
@@ -1386,21 +1403,21 @@ class W extends P {
1386
1403
  "input,textarea,select"
1387
1404
  );
1388
1405
  if (u) {
1389
- u instanceof HTMLInputElement && u.type === "checkbox" ? u.checked = !!n : u.value = String(n ?? "");
1406
+ u instanceof HTMLInputElement && u.type === "checkbox" ? u.checked = !!s : u.value = String(s ?? "");
1390
1407
  let m = !1;
1391
1408
  u.addEventListener("blur", () => {
1392
- m || r(y(u, t, n));
1409
+ m || r(y(u, t, s));
1393
1410
  }), u.addEventListener("keydown", (p) => {
1394
1411
  const g = p;
1395
1412
  if (g.key === "Enter") {
1396
1413
  if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(g) === !1)
1397
1414
  return;
1398
- g.stopPropagation(), g.preventDefault(), m = !0, r(y(u, t, n)), this.#n(a, !1);
1415
+ g.stopPropagation(), g.preventDefault(), m = !0, r(y(u, t, s)), this.#s(a, !1);
1399
1416
  }
1400
1417
  if (g.key === "Escape") {
1401
1418
  if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(g) === !1)
1402
1419
  return;
1403
- g.stopPropagation(), g.preventDefault(), l(), this.#n(a, !0);
1420
+ g.stopPropagation(), g.preventDefault(), l(), this.#s(a, !0);
1404
1421
  }
1405
1422
  }), u instanceof HTMLInputElement && u.type === "checkbox" && u.addEventListener("change", () => r(u.checked)), o || setTimeout(() => u.focus({ preventScroll: !0 }), 0);
1406
1423
  }
@@ -1412,9 +1429,9 @@ class W extends P {
1412
1429
  */
1413
1430
  #C(e, t) {
1414
1431
  if (!e) return !1;
1415
- const i = e, n = t, r = /* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(n)]);
1432
+ const i = e, s = t, r = /* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(s)]);
1416
1433
  for (const l of r)
1417
- if (i[l] !== n[l])
1434
+ if (i[l] !== s[l])
1418
1435
  return !0;
1419
1436
  return !1;
1420
1437
  }
@@ -1424,12 +1441,12 @@ class W extends P {
1424
1441
  #E(e) {
1425
1442
  queueMicrotask(() => {
1426
1443
  try {
1427
- const t = e._focusRow, i = e._focusCol, n = e.findRenderedRowElement?.(t);
1428
- if (n) {
1444
+ const t = e._focusRow, i = e._focusCol, s = e.findRenderedRowElement?.(t);
1445
+ if (s) {
1429
1446
  Array.from(e._bodyEl.querySelectorAll(".cell-focus")).forEach(
1430
1447
  (l) => l.classList.remove("cell-focus")
1431
1448
  );
1432
- const r = n.querySelector(`.cell[data-row="${t}"][data-col="${i}"]`);
1449
+ const r = s.querySelector(`.cell[data-row="${t}"][data-col="${i}"]`);
1433
1450
  r && (r.classList.add("cell-focus"), r.setAttribute("aria-selected", "true"), r.hasAttribute("tabindex") || r.setAttribute("tabindex", "-1"), r.focus({ preventScroll: !0 }));
1434
1451
  }
1435
1452
  } catch {