@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
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/selection/SelectionPlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAU/F,OAAO,KAAK,EACV,SAAS,EAGT,eAAe,EAEf,eAAe,EAChB,MAAM,SAAS,CAAC;AAyCjB;;;;;;;GAOG;AACH,qBAAa,eAAgB,SAAQ,cAAc,CAAC,eAAe,CAAC;;IAClE,QAAQ,CAAC,IAAI,eAAe;IAC5B,SAAkB,MAAM,SAAU;IAElC,cAAuB,aAAa,IAAI,OAAO,CAAC,eAAe,CAAC,CAI/D;IAGD,qCAAqC;IACrC,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,MAAM,CAAuB;IAErC,yCAAyC;IACzC,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,WAAW,CAAkC;I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I;IAQtD;;;OAGG;IACH,eAAe,IAAI,MAAM,EAAE;IAQ3B;;;OAGG;IACH,SAAS,IAAI,SAAS,EAAE;IAIxB;;OAEG;IACH,gBAAgB,IAAI,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAIvD;;OAEG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IAIjD;;OAEG;IACH,cAAc,IAAI,IAAI;IAWtB;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI;CAgCrC"}
@@ -1,47 +1,47 @@
1
- function x(n, e, t, s) {
2
- const r = new Set(n.selected);
3
- let o = n.anchor;
1
+ function x(r, e, t, s) {
2
+ const n = new Set(r.selected);
3
+ let o = r.anchor;
4
4
  if (t === "single")
5
- r.clear(), r.add(e), o = e;
5
+ n.clear(), n.add(e), o = e;
6
6
  else if (t === "multiple") {
7
7
  const i = s.ctrlKey || s.metaKey;
8
- if (s.shiftKey && n.anchor !== null) {
9
- const c = Math.min(n.anchor, e), a = Math.max(n.anchor, e);
10
- for (let h = c; h <= a; h++)
11
- r.add(h);
12
- } else i ? (r.has(e) ? r.delete(e) : r.add(e), o = e) : (r.clear(), r.add(e), o = e);
8
+ if (s.shiftKey && r.anchor !== null) {
9
+ const c = Math.min(r.anchor, e), a = Math.max(r.anchor, e);
10
+ for (let d = c; d <= a; d++)
11
+ n.add(d);
12
+ } else i ? (n.has(e) ? n.delete(e) : n.add(e), o = e) : (n.clear(), n.add(e), o = e);
13
13
  }
14
- return { selected: r, lastSelected: e, anchor: o };
14
+ return { selected: n, lastSelected: e, anchor: o };
15
15
  }
16
- function _(n) {
16
+ function _(r) {
17
17
  const e = /* @__PURE__ */ new Set();
18
- for (let t = 0; t < n; t++)
18
+ for (let t = 0; t < r; t++)
19
19
  e.add(t);
20
20
  return e;
21
21
  }
22
- function D(n, e) {
22
+ function D(r, e) {
23
23
  const t = [], s = [];
24
- for (const r of e)
25
- n.has(r) || t.push(r);
26
- for (const r of n)
27
- e.has(r) || s.push(r);
24
+ for (const n of e)
25
+ r.has(n) || t.push(n);
26
+ for (const n of r)
27
+ e.has(n) || s.push(n);
28
28
  return { added: t, removed: s };
29
29
  }
30
- function b(n) {
31
- if (!n) return -1;
32
- const e = n.getAttribute("data-row");
30
+ function b(r) {
31
+ if (!r) return -1;
32
+ const e = r.getAttribute("data-row");
33
33
  if (e) return parseInt(e, 10);
34
- const t = n.closest(".data-grid-row");
34
+ const t = r.closest(".data-grid-row");
35
35
  if (!t) return -1;
36
36
  const s = t.parentElement;
37
37
  if (!s) return -1;
38
- const r = s.querySelectorAll(":scope > .data-grid-row");
39
- for (let o = 0; o < r.length; o++)
40
- if (r[o] === t) return o;
38
+ const n = s.querySelectorAll(":scope > .data-grid-row");
39
+ for (let o = 0; o < n.length; o++)
40
+ if (n[o] === t) return o;
41
41
  return -1;
42
42
  }
43
- function g(n) {
44
- n && n.querySelectorAll(".cell-focus").forEach((e) => e.classList.remove("cell-focus"));
43
+ function w(r) {
44
+ r && r.querySelectorAll(".cell-focus").forEach((e) => e.classList.remove("cell-focus"));
45
45
  }
46
46
  const p = {
47
47
  expand: "▶",
@@ -230,10 +230,21 @@ class y {
230
230
  return this.grid;
231
231
  }
232
232
  /**
233
- * Get the shadow root of the grid.
233
+ * Get the render root of the grid for DOM queries.
234
+ * @deprecated Use `gridElement` instead. This getter exists only for backward compatibility.
235
+ *
236
+ * With Shadow DOM removed, the grid element itself is the render root.
237
+ * All new code should use `this.gridElement` for DOM queries.
238
+ *
239
+ * @example
240
+ * // OLD (deprecated)
241
+ * const rows = this.shadowRoot?.querySelector('.rows');
242
+ *
243
+ * // NEW (preferred)
244
+ * const rows = this.gridElement.querySelector('.rows');
234
245
  */
235
246
  get shadowRoot() {
236
- return this.grid?.shadowRoot ?? null;
247
+ return this.gridElement;
237
248
  }
238
249
  /**
239
250
  * Get the disconnect signal for event listener cleanup.
@@ -284,7 +295,7 @@ class y {
284
295
  const e = this.grid?.effectiveConfig?.animation?.mode ?? "reduced-motion";
285
296
  if (e === !1 || e === "off") return !1;
286
297
  if (e === !0 || e === "on") return !0;
287
- const t = this.shadowRoot?.host;
298
+ const t = this.gridElement;
288
299
  return t ? getComputedStyle(t).getPropertyValue("--tbw-animation-enabled").trim() !== "0" : !0;
289
300
  }
290
301
  /**
@@ -300,7 +311,7 @@ class y {
300
311
  * ```
301
312
  */
302
313
  get animationDuration() {
303
- const e = this.shadowRoot?.host;
314
+ const e = this.gridElement;
304
315
  if (e) {
305
316
  const t = getComputedStyle(e).getPropertyValue("--tbw-animation-duration").trim(), s = parseInt(t, 10);
306
317
  if (!isNaN(s)) return s;
@@ -337,61 +348,61 @@ class y {
337
348
  }
338
349
  // #endregion
339
350
  }
340
- function d(n) {
341
- return n.meta?.utility === !0;
351
+ function h(r) {
352
+ return r.meta?.utility === !0;
342
353
  }
343
- function u(n) {
354
+ function g(r) {
344
355
  return {
345
- startRow: Math.min(n.startRow, n.endRow),
346
- startCol: Math.min(n.startCol, n.endCol),
347
- endRow: Math.max(n.startRow, n.endRow),
348
- endCol: Math.max(n.startCol, n.endCol)
356
+ startRow: Math.min(r.startRow, r.endRow),
357
+ startCol: Math.min(r.startCol, r.endCol),
358
+ endRow: Math.max(r.startRow, r.endRow),
359
+ endCol: Math.max(r.startCol, r.endCol)
349
360
  };
350
361
  }
351
- function A(n) {
352
- const e = u(n);
362
+ function A(r) {
363
+ const e = g(r);
353
364
  return {
354
365
  from: { row: e.startRow, col: e.startCol },
355
366
  to: { row: e.endRow, col: e.endCol }
356
367
  };
357
368
  }
358
- function m(n) {
359
- return n.map(A);
369
+ function R(r) {
370
+ return r.map(A);
360
371
  }
361
- function v(n, e, t) {
362
- const s = u(t);
363
- return n >= s.startRow && n <= s.endRow && e >= s.startCol && e <= s.endCol;
372
+ function v(r, e, t) {
373
+ const s = g(t);
374
+ return r >= s.startRow && r <= s.endRow && e >= s.startCol && e <= s.endCol;
364
375
  }
365
- function R(n, e, t) {
366
- return t.some((s) => v(n, e, s));
376
+ function m(r, e, t) {
377
+ return t.some((s) => v(r, e, s));
367
378
  }
368
- function S(n) {
369
- const e = [], t = u(n);
379
+ function S(r) {
380
+ const e = [], t = g(r);
370
381
  for (let s = t.startRow; s <= t.endRow; s++)
371
- for (let r = t.startCol; r <= t.endCol; r++)
372
- e.push({ row: s, col: r });
382
+ for (let n = t.startCol; n <= t.endCol; n++)
383
+ e.push({ row: s, col: n });
373
384
  return e;
374
385
  }
375
- function I(n) {
386
+ function E(r) {
376
387
  const e = /* @__PURE__ */ new Map();
377
- for (const t of n)
388
+ for (const t of r)
378
389
  for (const s of S(t))
379
390
  e.set(`${s.row},${s.col}`, s);
380
391
  return [...e.values()];
381
392
  }
382
- function f(n, e) {
393
+ function u(r, e) {
383
394
  return {
384
- startRow: n.row,
385
- startCol: n.col,
395
+ startRow: r.row,
396
+ startCol: r.col,
386
397
  endRow: e.row,
387
398
  endCol: e.col
388
399
  };
389
400
  }
390
- const K = ':host .selecting .data-grid-row>.cell{-webkit-user-select:none;user-select:none}:host([data-has-focus]) .data-grid-row.row-focus{background-color:var(--tbw-focus-background, rgba(from var(--tbw-color-accent) r g b / 12%))}:host([data-selection-mode="row"]) .cell-focus{outline:none}:host .data-grid-row>.cell.selected{background-color:var(--tbw-range-selection-bg)}:host .data-grid-row>.cell.selected.top{border-top:2px solid var(--tbw-range-border-color)}:host .data-grid-row>.cell.selected.bottom{border-bottom:2px solid var(--tbw-range-border-color)}:host .data-grid-row>.cell.selected.first{border-left:2px solid var(--tbw-range-border-color)}:host .data-grid-row>.cell.selected.last{border-right:2px solid var(--tbw-range-border-color)}:host .tbw-selection-summary{font-size:13px;color:var(--tbw-color-fg-muted);white-space:nowrap}';
391
- function q(n, e, t) {
392
- if (n === "cell" && e.selectedCell)
401
+ const I = "@layer tbw-plugins{tbw-grid.selecting .data-grid-row>.cell{-webkit-user-select:none;user-select:none}tbw-grid[data-has-focus] .data-grid-row.row-focus{background-color:var(--tbw-focus-background, rgba(from var(--tbw-color-accent) r g b / 12%))}tbw-grid[data-selection-mode=row] .cell-focus{outline:none}tbw-grid .data-grid-row>.cell.selected{background-color:var(--tbw-range-selection-bg)}tbw-grid .data-grid-row>.cell.selected.top{border-top:2px solid var(--tbw-range-border-color)}tbw-grid .data-grid-row>.cell.selected.bottom{border-bottom:2px solid var(--tbw-range-border-color)}tbw-grid .data-grid-row>.cell.selected.first{border-left:2px solid var(--tbw-range-border-color)}tbw-grid .data-grid-row>.cell.selected.last{border-right:2px solid var(--tbw-range-border-color)}tbw-grid .tbw-selection-summary{font-size:var(--tbw-font-size-sm, .8125rem);color:var(--tbw-color-fg-muted);white-space:nowrap}}";
402
+ function K(r, e, t) {
403
+ if (r === "cell" && e.selectedCell)
393
404
  return {
394
- mode: n,
405
+ mode: r,
395
406
  ranges: [
396
407
  {
397
408
  from: { row: e.selectedCell.row, col: e.selectedCell.col },
@@ -399,18 +410,18 @@ function q(n, e, t) {
399
410
  }
400
411
  ]
401
412
  };
402
- if (n === "row" && e.selected.size > 0) {
403
- const s = [...e.selected].map((r) => ({
404
- from: { row: r, col: 0 },
405
- to: { row: r, col: t - 1 }
413
+ if (r === "row" && e.selected.size > 0) {
414
+ const s = [...e.selected].map((n) => ({
415
+ from: { row: n, col: 0 },
416
+ to: { row: n, col: t - 1 }
406
417
  }));
407
- return { mode: n, ranges: s };
418
+ return { mode: r, ranges: s };
408
419
  }
409
- return n === "range" && e.ranges.length > 0 ? { mode: n, ranges: m(e.ranges) } : { mode: n, ranges: [] };
420
+ return r === "range" && e.ranges.length > 0 ? { mode: r, ranges: R(e.ranges) } : { mode: r, ranges: [] };
410
421
  }
411
422
  class M extends y {
412
423
  name = "selection";
413
- styles = K;
424
+ styles = I;
414
425
  get defaultConfig() {
415
426
  return {
416
427
  mode: "cell"
@@ -438,7 +449,7 @@ class M extends y {
438
449
  // #endregion
439
450
  // #region Event Handlers
440
451
  onCellClick(e) {
441
- const { rowIndex: t, colIndex: s, originalEvent: r } = e, { mode: o } = this.config, i = this.columns[s], c = i && d(i);
452
+ const { rowIndex: t, colIndex: s, originalEvent: n } = e, { mode: o } = this.config, i = this.columns[s], c = i && h(i);
442
453
  if (o === "cell")
443
454
  return c || (this.selectedCell = { row: t, col: s }, this.emit("selection-change", this.#e()), this.requestAfterRender()), !1;
444
455
  if (o === "row")
@@ -446,11 +457,11 @@ class M extends y {
446
457
  if (o === "range") {
447
458
  if (c)
448
459
  return !1;
449
- const a = r.shiftKey, h = r.ctrlKey || r.metaKey;
460
+ const a = n.shiftKey, d = n.ctrlKey || n.metaKey;
450
461
  if (a && this.cellAnchor) {
451
- const l = f(this.cellAnchor, { row: t, col: s });
452
- h ? this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = l : this.ranges.push(l) : this.ranges = [l], this.activeRange = l;
453
- } else if (h) {
462
+ const l = u(this.cellAnchor, { row: t, col: s });
463
+ d ? this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = l : this.ranges.push(l) : this.ranges = [l], this.activeRange = l;
464
+ } else if (d) {
454
465
  const l = {
455
466
  startRow: t,
456
467
  startCol: s,
@@ -472,10 +483,10 @@ class M extends y {
472
483
  return !1;
473
484
  }
474
485
  onKeyDown(e) {
475
- const { mode: t } = this.config, r = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Tab", "Home", "End", "PageUp", "PageDown"].includes(e.key);
486
+ const { mode: t } = this.config, n = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Tab", "Home", "End", "PageUp", "PageDown"].includes(e.key);
476
487
  if (e.key === "Escape")
477
488
  return t === "cell" ? this.selectedCell = null : t === "row" ? (this.selected.clear(), this.anchor = null) : t === "range" && (this.ranges = [], this.activeRange = null, this.cellAnchor = null), this.emit("selection-change", this.#e()), this.requestAfterRender(), !0;
478
- if (t === "cell" && r)
489
+ if (t === "cell" && n)
479
490
  return queueMicrotask(() => {
480
491
  this.selectedCell = { row: this.grid._focusRow, col: this.grid._focusCol }, this.emit("selection-change", this.#e()), this.requestAfterRender();
481
492
  }), !1;
@@ -483,7 +494,7 @@ class M extends y {
483
494
  return queueMicrotask(() => {
484
495
  this.selected.clear(), this.selected.add(this.grid._focusRow), this.lastSelected = this.grid._focusRow, this.emit("selection-change", this.#e()), this.requestAfterRender();
485
496
  }), !1;
486
- if (t === "range" && r) {
497
+ if (t === "range" && n) {
487
498
  const o = e.key === "Tab", i = e.shiftKey && !o;
488
499
  return i && !this.cellAnchor && (this.cellAnchor = { row: this.grid._focusRow, col: this.grid._focusCol }), this.pendingKeyboardUpdate = { shiftKey: i }, queueMicrotask(() => this.requestAfterRender()), !1;
489
500
  }
@@ -504,16 +515,16 @@ class M extends y {
504
515
  onCellMouseDown(e) {
505
516
  if (this.config.mode !== "range" || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
506
517
  const t = this.columns[e.colIndex];
507
- if (t && d(t) || e.originalEvent.shiftKey && this.cellAnchor)
518
+ if (t && h(t) || e.originalEvent.shiftKey && this.cellAnchor)
508
519
  return;
509
520
  this.isDragging = !0;
510
- const s = e.rowIndex, r = e.colIndex;
511
- this.cellAnchor = { row: s, col: r }, e.originalEvent.ctrlKey || e.originalEvent.metaKey || (this.ranges = []);
521
+ const s = e.rowIndex, n = e.colIndex;
522
+ this.cellAnchor = { row: s, col: n }, e.originalEvent.ctrlKey || e.originalEvent.metaKey || (this.ranges = []);
512
523
  const i = {
513
524
  startRow: s,
514
- startCol: r,
525
+ startCol: n,
515
526
  endRow: s,
516
- endCol: r
527
+ endCol: n
517
528
  };
518
529
  return this.ranges.push(i), this.activeRange = i, this.emit("selection-change", this.#e()), this.requestAfterRender(), !0;
519
530
  }
@@ -521,12 +532,12 @@ class M extends y {
521
532
  if (this.config.mode !== "range" || !this.isDragging || !this.cellAnchor || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
522
533
  let t = e.colIndex;
523
534
  const s = this.columns[t];
524
- if (s && d(s)) {
525
- const o = this.columns.findIndex((i) => !d(i));
535
+ if (s && h(s)) {
536
+ const o = this.columns.findIndex((i) => !h(i));
526
537
  o >= 0 && (t = o);
527
538
  }
528
- const r = f(this.cellAnchor, { row: e.rowIndex, col: t });
529
- return this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = r : this.ranges.push(r), this.activeRange = r, this.emit("selection-change", this.#e()), this.requestAfterRender(), !0;
539
+ const n = u(this.cellAnchor, { row: e.rowIndex, col: t });
540
+ return this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = n : this.ranges.push(n), this.activeRange = n, this.emit("selection-change", this.#e()), this.requestAfterRender(), !0;
530
541
  }
531
542
  onCellMouseUp(e) {
532
543
  if (this.config.mode === "range" && this.isDragging)
@@ -537,49 +548,48 @@ class M extends y {
537
548
  * Shared by afterRender and onScrollRender.
538
549
  */
539
550
  #t() {
540
- const e = this.shadowRoot;
551
+ const e = this.gridElement;
541
552
  if (!e) return;
542
553
  const { mode: t } = this.config;
543
554
  e.querySelectorAll(".cell").forEach((o) => {
544
555
  o.classList.remove("selected", "top", "bottom", "first", "last");
545
556
  });
546
- const r = e.querySelectorAll(".data-grid-row");
547
- if (r.forEach((o) => {
557
+ const n = e.querySelectorAll(".data-grid-row");
558
+ if (n.forEach((o) => {
548
559
  o.classList.remove("selected", "row-focus");
549
- }), t === "row" && (g(e), r.forEach((o) => {
560
+ }), t === "row" && (w(e), n.forEach((o) => {
550
561
  const i = o.querySelector(".cell[data-row]"), c = b(i);
551
562
  c >= 0 && this.selected.has(c) && o.classList.add("selected", "row-focus");
552
563
  })), t === "range" && this.ranges.length > 0) {
553
- g(e);
554
- const o = this.activeRange ? u(this.activeRange) : null, i = this.columns.findIndex((a) => !d(a));
564
+ w(e);
565
+ const o = this.activeRange ? g(this.activeRange) : null, i = this.columns.findIndex((a) => !h(a));
555
566
  this.columns.length - 1, e.querySelectorAll(".cell[data-row][data-col]").forEach((a) => {
556
- const h = parseInt(a.getAttribute("data-row") ?? "-1", 10), l = parseInt(a.getAttribute("data-col") ?? "-1", 10);
557
- if (h >= 0 && l >= 0) {
558
- const w = this.columns[l];
559
- if (w && d(w))
567
+ const d = parseInt(a.getAttribute("data-row") ?? "-1", 10), l = parseInt(a.getAttribute("data-col") ?? "-1", 10);
568
+ if (d >= 0 && l >= 0) {
569
+ const f = this.columns[l];
570
+ if (f && h(f))
560
571
  return;
561
- if (R(h, l, this.ranges) && (a.classList.add("selected"), o)) {
562
- h === o.startRow && a.classList.add("top"), h === o.endRow && a.classList.add("bottom");
572
+ if (m(d, l, this.ranges) && (a.classList.add("selected"), o)) {
573
+ d === o.startRow && a.classList.add("top"), d === o.endRow && a.classList.add("bottom");
563
574
  const C = Math.max(o.startCol, i);
564
575
  l === C && a.classList.add("first"), l === o.endCol && a.classList.add("last");
565
576
  }
566
577
  }
567
578
  });
568
579
  }
569
- t === "cell" && this.selectedCell && g(e);
570
580
  }
571
581
  afterRender() {
572
- const e = this.shadowRoot;
582
+ const e = this.gridElement;
573
583
  if (!e) return;
574
584
  const t = e.children[0], { mode: s } = this.config;
575
585
  if (this.pendingKeyboardUpdate && s === "range") {
576
- const { shiftKey: r } = this.pendingKeyboardUpdate;
586
+ const { shiftKey: n } = this.pendingKeyboardUpdate;
577
587
  this.pendingKeyboardUpdate = null;
578
588
  const o = this.grid._focusRow, i = this.grid._focusCol;
579
- if (r && this.cellAnchor) {
580
- const c = f(this.cellAnchor, { row: o, col: i });
589
+ if (n && this.cellAnchor) {
590
+ const c = u(this.cellAnchor, { row: o, col: i });
581
591
  this.ranges = [c], this.activeRange = c;
582
- } else r || (this.ranges = [], this.activeRange = null, this.cellAnchor = { row: o, col: i });
592
+ } else n || (this.ranges = [], this.activeRange = null, this.cellAnchor = { row: o, col: i });
583
593
  this.emit("selection-change", this.#e());
584
594
  }
585
595
  this.grid.setAttribute("data-selection-mode", s), t && t.classList.toggle("selecting", this.isDragging), this.#t();
@@ -642,13 +652,13 @@ class M extends y {
642
652
  * Get all selected cells across all ranges.
643
653
  */
644
654
  getSelectedCells() {
645
- return I(this.ranges);
655
+ return E(this.ranges);
646
656
  }
647
657
  /**
648
658
  * Check if a specific cell is in range selection.
649
659
  */
650
660
  isCellSelected(e, t) {
651
- return R(e, t, this.ranges);
661
+ return m(e, t, this.ranges);
652
662
  }
653
663
  /**
654
664
  * Clear all selection.
@@ -667,13 +677,13 @@ class M extends y {
667
677
  endCol: t.to.col
668
678
  })), this.activeRange = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null, this.emit("selection-change", {
669
679
  mode: this.config.mode,
670
- ranges: m(this.ranges)
680
+ ranges: R(this.ranges)
671
681
  }), this.requestAfterRender();
672
682
  }
673
683
  // #endregion
674
684
  // #region Private Helpers
675
685
  #e() {
676
- return q(
686
+ return K(
677
687
  this.config.mode,
678
688
  {
679
689
  selectedCell: this.selectedCell,