@toolbox-web/grid 0.4.2 → 0.6.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 (123) hide show
  1. package/README.md +2 -3
  2. package/all.js +1063 -1024
  3. package/all.js.map +1 -1
  4. package/index.js +1078 -912
  5. package/index.js.map +1 -1
  6. package/lib/core/grid.d.ts +28 -0
  7. package/lib/core/grid.d.ts.map +1 -1
  8. package/lib/core/internal/dom-builder.d.ts +2 -0
  9. package/lib/core/internal/dom-builder.d.ts.map +1 -1
  10. package/lib/core/internal/event-delegation.d.ts +21 -0
  11. package/lib/core/internal/event-delegation.d.ts.map +1 -1
  12. package/lib/core/internal/header.d.ts.map +1 -1
  13. package/lib/core/internal/resize.d.ts.map +1 -1
  14. package/lib/core/internal/rows.d.ts +1 -1
  15. package/lib/core/internal/rows.d.ts.map +1 -1
  16. package/lib/core/internal/shell.d.ts +19 -13
  17. package/lib/core/internal/shell.d.ts.map +1 -1
  18. package/lib/core/plugin/base-plugin.d.ts +13 -2
  19. package/lib/core/plugin/base-plugin.d.ts.map +1 -1
  20. package/lib/core/plugin/expander-column.d.ts.map +1 -1
  21. package/lib/core/plugin/plugin-manager.d.ts +6 -2
  22. package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
  23. package/lib/core/types.d.ts +41 -3
  24. package/lib/core/types.d.ts.map +1 -1
  25. package/lib/plugins/clipboard/index.js +22 -11
  26. package/lib/plugins/clipboard/index.js.map +1 -1
  27. package/lib/plugins/column-virtualization/index.js +59 -48
  28. package/lib/plugins/column-virtualization/index.js.map +1 -1
  29. package/lib/plugins/context-menu/index.js +71 -60
  30. package/lib/plugins/context-menu/index.js.map +1 -1
  31. package/lib/plugins/editing/EditingPlugin.d.ts +1 -0
  32. package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
  33. package/lib/plugins/editing/index.js +93 -80
  34. package/lib/plugins/editing/index.js.map +1 -1
  35. package/lib/plugins/export/index.js +29 -18
  36. package/lib/plugins/export/index.js.map +1 -1
  37. package/lib/plugins/filtering/FilteringPlugin.d.ts +9 -1
  38. package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
  39. package/lib/plugins/filtering/index.js +199 -165
  40. package/lib/plugins/filtering/index.js.map +1 -1
  41. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +1 -0
  42. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
  43. package/lib/plugins/grouping-columns/index.js +79 -49
  44. package/lib/plugins/grouping-columns/index.js.map +1 -1
  45. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
  46. package/lib/plugins/grouping-rows/index.js +98 -87
  47. package/lib/plugins/grouping-rows/index.js.map +1 -1
  48. package/lib/plugins/master-detail/index.js +70 -57
  49. package/lib/plugins/master-detail/index.js.map +1 -1
  50. package/lib/plugins/multi-sort/index.js +48 -37
  51. package/lib/plugins/multi-sort/index.js.map +1 -1
  52. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
  53. package/lib/plugins/pinned-columns/index.js +71 -66
  54. package/lib/plugins/pinned-columns/index.js.map +1 -1
  55. package/lib/plugins/pinned-columns/pinned-columns.d.ts +2 -2
  56. package/lib/plugins/pinned-columns/pinned-columns.d.ts.map +1 -1
  57. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -1
  58. package/lib/plugins/pinned-rows/index.js +63 -52
  59. package/lib/plugins/pinned-rows/index.js.map +1 -1
  60. package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
  61. package/lib/plugins/pivot/index.js +310 -299
  62. package/lib/plugins/pivot/index.js.map +1 -1
  63. package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -1
  64. package/lib/plugins/reorder/index.d.ts +1 -1
  65. package/lib/plugins/reorder/index.d.ts.map +1 -1
  66. package/lib/plugins/reorder/index.js +79 -68
  67. package/lib/plugins/reorder/index.js.map +1 -1
  68. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
  69. package/lib/plugins/selection/index.js +115 -105
  70. package/lib/plugins/selection/index.js.map +1 -1
  71. package/lib/plugins/server-side/index.js +15 -4
  72. package/lib/plugins/server-side/index.js.map +1 -1
  73. package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
  74. package/lib/plugins/tree/index.js +41 -30
  75. package/lib/plugins/tree/index.js.map +1 -1
  76. package/lib/plugins/undo-redo/index.js +29 -18
  77. package/lib/plugins/undo-redo/index.js.map +1 -1
  78. package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -1
  79. package/lib/plugins/visibility/index.js +59 -47
  80. package/lib/plugins/visibility/index.js.map +1 -1
  81. package/package.json +6 -6
  82. package/public.d.ts +42 -0
  83. package/public.d.ts.map +1 -1
  84. package/themes/dg-theme-bootstrap.css +55 -53
  85. package/themes/dg-theme-contrast.css +42 -40
  86. package/themes/dg-theme-large.css +38 -37
  87. package/themes/dg-theme-material.css +54 -52
  88. package/themes/dg-theme-standard.css +19 -17
  89. package/themes/dg-theme-vibrant.css +16 -14
  90. package/umd/grid.all.umd.js +23 -22
  91. package/umd/grid.all.umd.js.map +1 -1
  92. package/umd/grid.umd.js +15 -14
  93. package/umd/grid.umd.js.map +1 -1
  94. package/umd/plugins/column-virtualization.umd.js +1 -1
  95. package/umd/plugins/column-virtualization.umd.js.map +1 -1
  96. package/umd/plugins/context-menu.umd.js +1 -1
  97. package/umd/plugins/context-menu.umd.js.map +1 -1
  98. package/umd/plugins/editing.umd.js +1 -1
  99. package/umd/plugins/editing.umd.js.map +1 -1
  100. package/umd/plugins/filtering.umd.js +1 -1
  101. package/umd/plugins/filtering.umd.js.map +1 -1
  102. package/umd/plugins/grouping-columns.umd.js +1 -1
  103. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  104. package/umd/plugins/grouping-rows.umd.js +1 -1
  105. package/umd/plugins/grouping-rows.umd.js.map +1 -1
  106. package/umd/plugins/master-detail.umd.js +1 -1
  107. package/umd/plugins/master-detail.umd.js.map +1 -1
  108. package/umd/plugins/multi-sort.umd.js +1 -1
  109. package/umd/plugins/multi-sort.umd.js.map +1 -1
  110. package/umd/plugins/pinned-columns.umd.js +1 -1
  111. package/umd/plugins/pinned-columns.umd.js.map +1 -1
  112. package/umd/plugins/pinned-rows.umd.js +1 -1
  113. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  114. package/umd/plugins/pivot.umd.js +1 -1
  115. package/umd/plugins/pivot.umd.js.map +1 -1
  116. package/umd/plugins/reorder.umd.js +1 -1
  117. package/umd/plugins/reorder.umd.js.map +1 -1
  118. package/umd/plugins/selection.umd.js +1 -1
  119. package/umd/plugins/selection.umd.js.map +1 -1
  120. package/umd/plugins/tree.umd.js +1 -1
  121. package/umd/plugins/tree.umd.js.map +1 -1
  122. package/umd/plugins/visibility.umd.js +1 -1
  123. package/umd/plugins/visibility.umd.js.map +1 -1
@@ -185,10 +185,21 @@ class S {
185
185
  return this.grid;
186
186
  }
187
187
  /**
188
- * Get the shadow root of the grid.
188
+ * Get the render root of the grid for DOM queries.
189
+ * @deprecated Use `gridElement` instead. This getter exists only for backward compatibility.
190
+ *
191
+ * With Shadow DOM removed, the grid element itself is the render root.
192
+ * All new code should use `this.gridElement` for DOM queries.
193
+ *
194
+ * @example
195
+ * // OLD (deprecated)
196
+ * const rows = this.shadowRoot?.querySelector('.rows');
197
+ *
198
+ * // NEW (preferred)
199
+ * const rows = this.gridElement.querySelector('.rows');
189
200
  */
190
201
  get shadowRoot() {
191
- return this.grid?.shadowRoot ?? null;
202
+ return this.gridElement;
192
203
  }
193
204
  /**
194
205
  * Get the disconnect signal for event listener cleanup.
@@ -239,7 +250,7 @@ class S {
239
250
  const e = this.grid?.effectiveConfig?.animation?.mode ?? "reduced-motion";
240
251
  if (e === !1 || e === "off") return !1;
241
252
  if (e === !0 || e === "on") return !0;
242
- const t = this.shadowRoot?.host;
253
+ const t = this.gridElement;
243
254
  return t ? getComputedStyle(t).getPropertyValue("--tbw-animation-enabled").trim() !== "0" : !0;
244
255
  }
245
256
  /**
@@ -255,7 +266,7 @@ class S {
255
266
  * ```
256
267
  */
257
268
  get animationDuration() {
258
- const e = this.shadowRoot?.host;
269
+ const e = this.gridElement;
259
270
  if (e) {
260
271
  const t = getComputedStyle(e).getPropertyValue("--tbw-animation-duration").trim(), i = parseInt(t, 10);
261
272
  if (!isNaN(i)) return i;
@@ -292,7 +303,8 @@ class S {
292
303
  }
293
304
  // #endregion
294
305
  }
295
- function L(l) {
306
+ const L = "@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-grid .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}}";
307
+ function k(l) {
296
308
  switch (l.type) {
297
309
  case "number":
298
310
  return (e) => {
@@ -320,14 +332,14 @@ function L(l) {
320
332
  i.multi && (t.multiple = !0);
321
333
  const s = i.options;
322
334
  (typeof s == "function" ? s() : s || []).forEach((r) => {
323
- const c = document.createElement("option");
324
- c.value = String(r.value), c.textContent = r.label, (i.multi && Array.isArray(e.value) && e.value.includes(r.value) || !i.multi && e.value === r.value) && (c.selected = !0), t.appendChild(c);
335
+ const a = document.createElement("option");
336
+ a.value = String(r.value), a.textContent = r.label, (i.multi && Array.isArray(e.value) && e.value.includes(r.value) || !i.multi && e.value === r.value) && (a.selected = !0), t.appendChild(a);
325
337
  });
326
338
  const o = () => {
327
339
  if (i.multi) {
328
340
  const r = [];
329
- Array.from(t.selectedOptions).forEach((c) => {
330
- r.push(c.value);
341
+ Array.from(t.selectedOptions).forEach((a) => {
342
+ r.push(a.value);
331
343
  }), e.commit(r);
332
344
  } else
333
345
  e.commit(t.value);
@@ -346,30 +358,31 @@ function L(l) {
346
358
  }
347
359
  }
348
360
  const C = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
349
- function b(l) {
361
+ function w(l) {
350
362
  return !(typeof l != "string" || l === "__proto__" || l === "constructor" || l === "prototype");
351
363
  }
352
- function T(l) {
364
+ function O(l) {
353
365
  return (l.__editingCellCount ?? 0) > 0;
354
366
  }
355
- function k(l) {
367
+ function A(l) {
356
368
  const e = (l.__editingCellCount ?? 0) + 1;
357
369
  l.__editingCellCount = e, l.setAttribute("data-has-editing", "");
358
370
  }
359
- function A(l) {
371
+ function q(l) {
360
372
  l.__editingCellCount = 0, l.removeAttribute("data-has-editing");
361
373
  }
362
- function y(l, e) {
374
+ function v(l, e) {
363
375
  return l instanceof HTMLInputElement ? l.type === "checkbox" ? l.checked : l.type === "number" ? l.value === "" ? null : Number(l.value) : l.type === "date" ? l.valueAsDate : l.value : e?.type === "number" && l.value !== "" ? Number(l.value) : l.value;
364
376
  }
365
- function q(l, e, t) {
377
+ function T(l, e, t) {
366
378
  const i = l.querySelector("input,textarea,select");
367
379
  i && (i.addEventListener("blur", () => {
368
- t(y(i, e));
369
- }), i instanceof HTMLInputElement && i.type === "checkbox" ? i.addEventListener("change", () => t(i.checked)) : i instanceof HTMLSelectElement && i.addEventListener("change", () => t(y(i, e))));
380
+ t(v(i, e));
381
+ }), i instanceof HTMLInputElement && i.type === "checkbox" ? i.addEventListener("change", () => t(i.checked)) : i instanceof HTMLSelectElement && i.addEventListener("change", () => t(v(i, e))));
370
382
  }
371
- class O extends S {
383
+ class N extends S {
372
384
  name = "editing";
385
+ styles = L;
373
386
  get defaultConfig() {
374
387
  return {
375
388
  editOn: "click"
@@ -448,9 +461,9 @@ class O extends S {
448
461
  const n = t._visibleColumns[s], o = t._rows[i];
449
462
  if (n?.editable && n.type === "boolean" && o) {
450
463
  const r = n.field;
451
- if (b(r)) {
464
+ if (w(r)) {
452
465
  const f = !o[r];
453
- return this.#c(i, n, f, o), e.preventDefault(), this.requestRender(), !0;
466
+ return this.#a(i, n, f, o), e.preventDefault(), this.requestRender(), !0;
454
467
  }
455
468
  }
456
469
  }
@@ -479,10 +492,10 @@ class O extends S {
479
492
  for (const t of this.#n) {
480
493
  const [i, s] = t.split(":"), n = parseInt(i, 10), o = parseInt(s, 10), r = e.findRenderedRowElement?.(n);
481
494
  if (!r) continue;
482
- const c = r.querySelector(`.cell[data-col="${o}"]`);
483
- if (!c || c.classList.contains("editing")) continue;
495
+ const a = r.querySelector(`.cell[data-col="${o}"]`);
496
+ if (!a || a.classList.contains("editing")) continue;
484
497
  const f = e._rows[n], d = e._visibleColumns[o];
485
- f && d && this.#a(f, n, d, o, c, !0);
498
+ f && d && this.#c(f, n, d, o, a, !0);
486
499
  }
487
500
  }
488
501
  /**
@@ -547,7 +560,7 @@ class O extends S {
547
560
  * Programmatically begin editing a cell.
548
561
  */
549
562
  beginCellEdit(e, t) {
550
- const i = this.grid, s = i._visibleColumns.findIndex((c) => c.field === t);
563
+ const i = this.grid, s = i._visibleColumns.findIndex((a) => a.field === t);
551
564
  if (s === -1 || !i._visibleColumns[s]?.editable) return;
552
565
  const r = i.findRenderedRowElement?.(e)?.querySelector(`.cell[data-col="${s}"]`);
553
566
  r && this.#f(e, s, r);
@@ -561,18 +574,18 @@ class O extends S {
561
574
  const n = t.findRenderedRowElement?.(e);
562
575
  if (!n) return;
563
576
  const o = t._rows[e];
564
- this.#d(e, o), Array.from(n.children).forEach((r, c) => {
565
- const f = t._visibleColumns[c];
577
+ this.#d(e, o), Array.from(n.children).forEach((r, a) => {
578
+ const f = t._visibleColumns[a];
566
579
  if (f?.editable) {
567
580
  const d = r;
568
- d.classList.contains("editing") || this.#a(o, e, f, c, d, !0);
581
+ d.classList.contains("editing") || this.#c(o, e, f, a, d, !0);
569
582
  }
570
583
  }), setTimeout(() => {
571
584
  let r = n.querySelector(`.cell[data-col="${t._focusCol}"]`);
572
585
  if (r?.classList.contains("editing") || (r = n.querySelector(".cell.editing")), r?.classList.contains("editing")) {
573
- const c = r.querySelector(C);
586
+ const a = r.querySelector(C);
574
587
  try {
575
- c?.focus({ preventScroll: !0 });
588
+ a?.focus({ preventScroll: !0 });
576
589
  } catch {
577
590
  }
578
591
  }
@@ -597,7 +610,7 @@ class O extends S {
597
610
  */
598
611
  #f(e, t, i) {
599
612
  const s = this.grid, n = s._rows[e], o = s._visibleColumns[t];
600
- !n || !o?.editable || i.classList.contains("editing") || (this.#e !== e && this.#d(e, n), this.#r = t, this.#a(n, e, o, t, i, !1));
613
+ !n || !o?.editable || i.classList.contains("editing") || (this.#e !== e && this.#d(e, n), this.#r = t, this.#c(n, e, o, t, i, !1));
601
614
  }
602
615
  /**
603
616
  * Sync the internal grid state with the plugin's editing state.
@@ -618,15 +631,15 @@ class O extends S {
618
631
  #i(e, t) {
619
632
  if (this.#e !== e) return;
620
633
  const i = this.grid, s = this.#s.get(e), n = i._rows[e], o = i.findRenderedRowElement?.(e);
621
- if (!t && o && n && o.querySelectorAll(".cell.editing").forEach((c) => {
622
- const f = Number(c.getAttribute("data-col"));
634
+ if (!t && o && n && o.querySelectorAll(".cell.editing").forEach((a) => {
635
+ const f = Number(a.getAttribute("data-col"));
623
636
  if (isNaN(f)) return;
624
637
  const d = i._visibleColumns[f];
625
638
  if (!d) return;
626
- const p = c.querySelector("input,textarea,select");
627
- if (p) {
628
- const a = y(p, d);
629
- n[d.field] !== a && this.#c(e, d, a, n);
639
+ const b = a.querySelector("input,textarea,select");
640
+ if (b) {
641
+ const c = v(b, d);
642
+ n[d.field] !== c && this.#a(e, d, c, n);
630
643
  }
631
644
  }), t && s && n)
632
645
  Object.keys(s).forEach((r) => {
@@ -646,15 +659,15 @@ class O extends S {
646
659
  for (const r of this.#n)
647
660
  r.startsWith(`${e}:`) && this.#n.delete(r);
648
661
  o && (o.querySelectorAll(".cell.editing").forEach((r) => {
649
- r.classList.remove("editing"), A(r.parentElement);
662
+ r.classList.remove("editing"), q(r.parentElement);
650
663
  }), this.requestRender()), this.#o = !0, o || (this.#u(i), this.#o = !1);
651
664
  }
652
665
  /**
653
666
  * Commit a single cell value change.
654
667
  */
655
- #c(e, t, i, s) {
668
+ #a(e, t, i, s) {
656
669
  const n = t.field;
657
- if (!b(n)) return;
670
+ if (!w(n)) return;
658
671
  const o = s[n];
659
672
  if (o === i) return;
660
673
  const r = !this.#t.has(e);
@@ -675,58 +688,58 @@ class O extends S {
675
688
  /**
676
689
  * Inject an editor into a cell.
677
690
  */
678
- #a(e, t, i, s, n, o) {
691
+ #c(e, t, i, s, n, o) {
679
692
  if (!i.editable || n.classList.contains("editing")) return;
680
- const r = b(i.field) ? e[i.field] : void 0;
693
+ const r = w(i.field) ? e[i.field] : void 0;
681
694
  n.classList.add("editing"), this.#n.add(`${t}:${s}`);
682
- const c = n.parentElement;
683
- c && k(c);
695
+ const a = n.parentElement;
696
+ a && A(a);
684
697
  let f = !1;
685
698
  const d = (h) => {
686
- f || this.#e === -1 || this.#c(t, i, h, e);
687
- }, p = () => {
688
- f = !0, b(i.field) && (e[i.field] = r);
689
- }, a = document.createElement("div");
690
- a.className = "tbw-editor-host", n.innerHTML = "", n.appendChild(a), a.addEventListener("keydown", (h) => {
691
- h.key === "Enter" && (h.stopPropagation(), h.preventDefault(), f = !0, this.#i(t, !1)), h.key === "Escape" && (h.stopPropagation(), h.preventDefault(), p(), this.#i(t, !0));
699
+ f || this.#e === -1 || this.#a(t, i, h, e);
700
+ }, b = () => {
701
+ f = !0, w(i.field) && (e[i.field] = r);
702
+ }, c = document.createElement("div");
703
+ c.className = "tbw-editor-host", n.innerHTML = "", n.appendChild(c), c.addEventListener("keydown", (h) => {
704
+ h.key === "Enter" && (h.stopPropagation(), h.preventDefault(), f = !0, this.#i(t, !1)), h.key === "Escape" && (h.stopPropagation(), h.preventDefault(), b(), this.#i(t, !0));
692
705
  });
693
- const g = i, v = g.__editorTemplate, u = g.editor || (v ? "template" : L(i)), m = r;
694
- if (u === "template" && v)
695
- this.#h(a, g, e, r, d, p, o, t);
706
+ const g = i, E = g.__editorTemplate, u = g.editor || (E ? "template" : k(i)), m = r;
707
+ if (u === "template" && E)
708
+ this.#h(c, g, e, r, d, b, o, t);
696
709
  else if (typeof u == "string") {
697
710
  const h = document.createElement(u);
698
- h.value = m, h.addEventListener("change", () => d(h.value)), a.appendChild(h), o || queueMicrotask(() => {
699
- a.querySelector(C)?.focus({ preventScroll: !0 });
711
+ h.value = m, h.addEventListener("change", () => d(h.value)), c.appendChild(h), o || queueMicrotask(() => {
712
+ c.querySelector(C)?.focus({ preventScroll: !0 });
700
713
  });
701
714
  } else if (typeof u == "function") {
702
- const h = { row: e, value: m, field: i.field, column: i, commit: d, cancel: p }, E = u(h);
703
- typeof E == "string" ? (a.innerHTML = E, q(a, i, d)) : E instanceof Node && a.appendChild(E), o || queueMicrotask(() => {
704
- a.querySelector(C)?.focus({ preventScroll: !0 });
715
+ const h = { row: e, value: m, field: i.field, column: i, commit: d, cancel: b }, p = u(h);
716
+ typeof p == "string" ? (c.innerHTML = p, T(c, i, d)) : p instanceof Node && c.appendChild(p), o || queueMicrotask(() => {
717
+ c.querySelector(C)?.focus({ preventScroll: !0 });
705
718
  });
706
719
  } else if (u && typeof u == "object") {
707
- const h = this.grid, E = document.createElement("div");
708
- E.setAttribute("data-external-editor", ""), E.setAttribute("data-field", i.field), a.appendChild(E);
709
- const w = { row: e, value: m, field: i.field, column: i, commit: d, cancel: p };
720
+ const h = this.grid, p = document.createElement("div");
721
+ p.setAttribute("data-external-editor", ""), p.setAttribute("data-field", i.field), c.appendChild(p);
722
+ const y = { row: e, value: m, field: i.field, column: i, commit: d, cancel: b };
710
723
  if (u.mount)
711
724
  try {
712
- u.mount({ placeholder: E, context: w, spec: u });
725
+ u.mount({ placeholder: p, context: y, spec: u });
713
726
  } catch (R) {
714
727
  console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`, R);
715
728
  }
716
729
  else
717
730
  h.dispatchEvent(
718
- new CustomEvent("mount-external-editor", { detail: { placeholder: E, spec: u, context: w } })
731
+ new CustomEvent("mount-external-editor", { detail: { placeholder: p, spec: u, context: y } })
719
732
  );
720
733
  }
721
734
  }
722
735
  /**
723
736
  * Render a template-based editor.
724
737
  */
725
- #h(e, t, i, s, n, o, r, c) {
738
+ #h(e, t, i, s, n, o, r, a) {
726
739
  const f = t.__editorTemplate;
727
740
  if (!f) return;
728
- const d = f.cloneNode(!0), p = t.__compiledEditor;
729
- p ? d.innerHTML = p({
741
+ const d = f.cloneNode(!0), b = t.__compiledEditor;
742
+ b ? d.innerHTML = b({
730
743
  row: i,
731
744
  value: s,
732
745
  field: t.field,
@@ -734,24 +747,24 @@ class O extends S {
734
747
  commit: n,
735
748
  cancel: o
736
749
  }) : d.querySelectorAll("*").forEach((g) => {
737
- g.childNodes.length === 1 && g.firstChild?.nodeType === Node.TEXT_NODE && (g.textContent = g.textContent?.replace(/{{\s*value\s*}}/g, s == null ? "" : String(s)).replace(/{{\s*row\.([a-zA-Z0-9_]+)\s*}}/g, (v, u) => {
738
- if (!b(u)) return "";
750
+ g.childNodes.length === 1 && g.firstChild?.nodeType === Node.TEXT_NODE && (g.textContent = g.textContent?.replace(/{{\s*value\s*}}/g, s == null ? "" : String(s)).replace(/{{\s*row\.([a-zA-Z0-9_]+)\s*}}/g, (E, u) => {
751
+ if (!w(u)) return "";
739
752
  const m = i[u];
740
753
  return m == null ? "" : String(m);
741
754
  }) || "");
742
755
  });
743
- const a = d.querySelector(
756
+ const c = d.querySelector(
744
757
  "input,textarea,select"
745
758
  );
746
- if (a) {
747
- a instanceof HTMLInputElement && a.type === "checkbox" ? a.checked = !!s : a.value = String(s ?? "");
759
+ if (c) {
760
+ c instanceof HTMLInputElement && c.type === "checkbox" ? c.checked = !!s : c.value = String(s ?? "");
748
761
  let g = !1;
749
- a.addEventListener("blur", () => {
750
- g || n(y(a, t));
751
- }), a.addEventListener("keydown", (v) => {
752
- const u = v;
753
- u.key === "Enter" && (u.stopPropagation(), u.preventDefault(), g = !0, n(y(a, t)), this.#i(c, !1)), u.key === "Escape" && (u.stopPropagation(), u.preventDefault(), o(), this.#i(c, !0));
754
- }), a instanceof HTMLInputElement && a.type === "checkbox" && a.addEventListener("change", () => n(a.checked)), r || setTimeout(() => a.focus({ preventScroll: !0 }), 0);
762
+ c.addEventListener("blur", () => {
763
+ g || n(v(c, t));
764
+ }), c.addEventListener("keydown", (E) => {
765
+ const u = E;
766
+ u.key === "Enter" && (u.stopPropagation(), u.preventDefault(), g = !0, n(v(c, t)), this.#i(a, !1)), u.key === "Escape" && (u.stopPropagation(), u.preventDefault(), o(), this.#i(a, !0));
767
+ }), c instanceof HTMLInputElement && c.type === "checkbox" && c.addEventListener("change", () => n(c.checked)), r || setTimeout(() => c.focus({ preventScroll: !0 }), 0);
755
768
  }
756
769
  e.appendChild(d);
757
770
  }
@@ -776,10 +789,10 @@ class O extends S {
776
789
  // #endregion
777
790
  }
778
791
  export {
779
- O as EditingPlugin,
792
+ N as EditingPlugin,
780
793
  C as FOCUSABLE_EDITOR_SELECTOR,
781
- A as clearEditingState,
782
- L as defaultEditorFor,
783
- T as hasEditingCells
794
+ q as clearEditingState,
795
+ k as defaultEditorFor,
796
+ O as hasEditingCells
784
797
  };
785
798
  //# sourceMappingURL=index.js.map