@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 b {
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 b {
239
250
  const t = this.grid?.effectiveConfig?.animation?.mode ?? "reduced-motion";
240
251
  if (t === !1 || t === "off") return !1;
241
252
  if (t === !0 || t === "on") return !0;
242
- const e = this.shadowRoot?.host;
253
+ const e = this.gridElement;
243
254
  return e ? getComputedStyle(e).getPropertyValue("--tbw-animation-enabled").trim() !== "0" : !0;
244
255
  }
245
256
  /**
@@ -255,7 +266,7 @@ class b {
255
266
  * ```
256
267
  */
257
268
  get animationDuration() {
258
- const t = this.shadowRoot?.host;
269
+ const t = this.gridElement;
259
270
  if (t) {
260
271
  const e = getComputedStyle(t).getPropertyValue("--tbw-animation-duration").trim(), i = parseInt(e, 10);
261
272
  if (!isNaN(i)) return i;
@@ -292,61 +303,61 @@ class b {
292
303
  }
293
304
  // #endregion
294
305
  }
295
- const d = 100;
296
- function a(s) {
297
- if (s == null)
298
- return d;
299
- if (typeof s == "number")
300
- return s;
301
- const t = parseFloat(s);
302
- return isNaN(t) ? d : t;
306
+ const h = 100;
307
+ function a(r) {
308
+ if (r == null)
309
+ return h;
310
+ if (typeof r == "number")
311
+ return r;
312
+ const t = parseFloat(r);
313
+ return isNaN(t) ? h : t;
303
314
  }
304
- function c(s) {
305
- return s.map((t) => a(t.width));
315
+ function c(r) {
316
+ return r.map((t) => a(t.width));
306
317
  }
307
- function f(s) {
318
+ function f(r) {
308
319
  const t = [];
309
320
  let e = 0;
310
- for (const i of s)
321
+ for (const i of r)
311
322
  t.push(e), e += a(i.width);
312
323
  return t;
313
324
  }
314
- function g(s) {
315
- return s.reduce((t, e) => t + a(e.width), 0);
325
+ function g(r) {
326
+ return r.reduce((t, e) => t + a(e.width), 0);
316
327
  }
317
- function p(s, t, e, i, o) {
318
- const r = e.length;
319
- if (r === 0)
328
+ function p(r, t, e, i, n) {
329
+ const s = e.length;
330
+ if (s === 0)
320
331
  return { startCol: 0, endCol: 0, visibleColumns: [] };
321
- let n = w(s, e, i);
322
- n = Math.max(0, n - o);
323
- const m = s + t;
324
- let u = n;
325
- for (let l = n; l < r; l++) {
332
+ let o = w(r, e, i);
333
+ o = Math.max(0, o - n);
334
+ const m = r + t;
335
+ let u = o;
336
+ for (let l = o; l < s; l++) {
326
337
  if (e[l] >= m) {
327
338
  u = l - 1;
328
339
  break;
329
340
  }
330
341
  u = l;
331
342
  }
332
- u = Math.min(r - 1, u + o);
333
- const h = [];
334
- for (let l = n; l <= u; l++)
335
- h.push(l);
336
- return { startCol: n, endCol: u, visibleColumns: h };
343
+ u = Math.min(s - 1, u + n);
344
+ const d = [];
345
+ for (let l = o; l <= u; l++)
346
+ d.push(l);
347
+ return { startCol: o, endCol: u, visibleColumns: d };
337
348
  }
338
- function w(s, t, e) {
339
- let i = 0, o = t.length - 1;
340
- for (; i < o; ) {
341
- const r = Math.floor((i + o) / 2);
342
- t[r] + e[r] <= s ? i = r + 1 : o = r;
349
+ function w(r, t, e) {
350
+ let i = 0, n = t.length - 1;
351
+ for (; i < n; ) {
352
+ const s = Math.floor((i + n) / 2);
353
+ t[s] + e[s] <= r ? i = s + 1 : n = s;
343
354
  }
344
355
  return i;
345
356
  }
346
- function R(s, t, e) {
347
- return e ? s > t : !1;
357
+ function R(r, t, e) {
358
+ return e ? r > t : !1;
348
359
  }
349
- class v extends b {
360
+ class E extends b {
350
361
  name = "columnVirtualization";
351
362
  get defaultConfig() {
352
363
  return {
@@ -379,25 +390,25 @@ class v extends b {
379
390
  const e = R(t.length, this.config.threshold ?? 30, this.config.autoEnable ?? !0);
380
391
  if (this.isVirtualized = e ?? !1, this.columnWidths = c(t), this.columnOffsets = f(t), this.totalWidth = g(t), !e)
381
392
  return this.startCol = 0, this.endCol = t.length - 1, [...t];
382
- const i = this.grid.clientWidth || 800, o = p(
393
+ const i = this.grid.clientWidth || 800, n = p(
383
394
  this.scrollLeft,
384
395
  i,
385
396
  this.columnOffsets,
386
397
  this.columnWidths,
387
398
  this.config.overscan ?? 3
388
399
  );
389
- return this.startCol = o.startCol, this.endCol = o.endCol, o.visibleColumns.map((r) => t[r]);
400
+ return this.startCol = n.startCol, this.endCol = n.endCol, n.visibleColumns.map((s) => t[s]);
390
401
  }
391
402
  afterRender() {
392
403
  if (!this.isVirtualized) return;
393
- const t = this.shadowRoot;
404
+ const t = this.gridElement;
394
405
  if (!t) return;
395
- const e = this.columnOffsets[this.startCol] ?? 0, i = t.querySelector(".header-row"), o = t.querySelectorAll(".data-grid-row");
396
- i && (i.style.paddingLeft = `${e}px`), o.forEach((n) => {
397
- n.style.paddingLeft = `${e}px`;
406
+ const e = this.columnOffsets[this.startCol] ?? 0, i = t.querySelector(".header-row"), n = t.querySelectorAll(".data-grid-row");
407
+ i && (i.style.paddingLeft = `${e}px`), n.forEach((o) => {
408
+ o.style.paddingLeft = `${e}px`;
398
409
  });
399
- const r = t.querySelector(".rows-viewport .rows");
400
- r && (r.style.width = `${this.totalWidth}px`);
410
+ const s = t.querySelector(".rows-viewport .rows");
411
+ s && (s.style.width = `${this.totalWidth}px`);
401
412
  }
402
413
  onScroll(t) {
403
414
  !this.isVirtualized || Math.abs(t.scrollLeft - this.scrollLeft) < 1 || (this.scrollLeft = t.scrollLeft, this.requestRender());
@@ -440,6 +451,6 @@ class v extends b {
440
451
  // #endregion
441
452
  }
442
453
  export {
443
- v as ColumnVirtualizationPlugin
454
+ E as ColumnVirtualizationPlugin
444
455
  };
445
456
  //# sourceMappingURL=index.js.map