@toolbox-web/grid 1.3.0 → 1.4.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 (82) hide show
  1. package/all.d.ts +1 -0
  2. package/all.d.ts.map +1 -1
  3. package/all.js +997 -710
  4. package/all.js.map +1 -1
  5. package/index.js +642 -599
  6. package/index.js.map +1 -1
  7. package/lib/core/grid.d.ts.map +1 -1
  8. package/lib/core/internal/header.d.ts +7 -0
  9. package/lib/core/internal/header.d.ts.map +1 -1
  10. package/lib/core/types.d.ts +151 -0
  11. package/lib/core/types.d.ts.map +1 -1
  12. package/lib/plugins/clipboard/index.js +19 -16
  13. package/lib/plugins/clipboard/index.js.map +1 -1
  14. package/lib/plugins/column-virtualization/index.js +42 -39
  15. package/lib/plugins/column-virtualization/index.js.map +1 -1
  16. package/lib/plugins/context-menu/index.js +25 -22
  17. package/lib/plugins/context-menu/index.js.map +1 -1
  18. package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
  19. package/lib/plugins/editing/index.js +53 -48
  20. package/lib/plugins/editing/index.js.map +1 -1
  21. package/lib/plugins/export/index.js +23 -20
  22. package/lib/plugins/export/index.js.map +1 -1
  23. package/lib/plugins/filtering/FilteringPlugin.d.ts +11 -1
  24. package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
  25. package/lib/plugins/filtering/index.js +186 -150
  26. package/lib/plugins/filtering/index.js.map +1 -1
  27. package/lib/plugins/grouping-columns/index.js +21 -18
  28. package/lib/plugins/grouping-columns/index.js.map +1 -1
  29. package/lib/plugins/grouping-rows/index.js +67 -64
  30. package/lib/plugins/grouping-rows/index.js.map +1 -1
  31. package/lib/plugins/master-detail/index.js +52 -49
  32. package/lib/plugins/master-detail/index.js.map +1 -1
  33. package/lib/plugins/multi-sort/index.js +18 -15
  34. package/lib/plugins/multi-sort/index.js.map +1 -1
  35. package/lib/plugins/pinned-columns/index.js +25 -22
  36. package/lib/plugins/pinned-columns/index.js.map +1 -1
  37. package/lib/plugins/pinned-rows/index.js +26 -23
  38. package/lib/plugins/pinned-rows/index.js.map +1 -1
  39. package/lib/plugins/pivot/index.js +50 -47
  40. package/lib/plugins/pivot/index.js.map +1 -1
  41. package/lib/plugins/print/PrintPlugin.d.ts +98 -0
  42. package/lib/plugins/print/PrintPlugin.d.ts.map +1 -0
  43. package/lib/plugins/print/index.d.ts +10 -0
  44. package/lib/plugins/print/index.d.ts.map +1 -0
  45. package/lib/plugins/print/index.js +626 -0
  46. package/lib/plugins/print/index.js.map +1 -0
  47. package/lib/plugins/print/print-isolated.d.ts +26 -0
  48. package/lib/plugins/print/print-isolated.d.ts.map +1 -0
  49. package/lib/plugins/print/types.d.ts +147 -0
  50. package/lib/plugins/print/types.d.ts.map +1 -0
  51. package/lib/plugins/reorder/index.js +25 -22
  52. package/lib/plugins/reorder/index.js.map +1 -1
  53. package/lib/plugins/responsive/index.js +20 -17
  54. package/lib/plugins/responsive/index.js.map +1 -1
  55. package/lib/plugins/row-reorder/index.js +39 -36
  56. package/lib/plugins/row-reorder/index.js.map +1 -1
  57. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
  58. package/lib/plugins/selection/index.js +115 -101
  59. package/lib/plugins/selection/index.js.map +1 -1
  60. package/lib/plugins/server-side/index.js +35 -32
  61. package/lib/plugins/server-side/index.js.map +1 -1
  62. package/lib/plugins/tree/index.js +26 -23
  63. package/lib/plugins/tree/index.js.map +1 -1
  64. package/lib/plugins/undo-redo/index.js +23 -20
  65. package/lib/plugins/undo-redo/index.js.map +1 -1
  66. package/lib/plugins/visibility/index.js +22 -19
  67. package/lib/plugins/visibility/index.js.map +1 -1
  68. package/package.json +1 -1
  69. package/public.d.ts +1 -1
  70. package/public.d.ts.map +1 -1
  71. package/umd/grid.all.umd.js +98 -24
  72. package/umd/grid.all.umd.js.map +1 -1
  73. package/umd/grid.umd.js +11 -11
  74. package/umd/grid.umd.js.map +1 -1
  75. package/umd/plugins/editing.umd.js +1 -1
  76. package/umd/plugins/editing.umd.js.map +1 -1
  77. package/umd/plugins/filtering.umd.js +1 -1
  78. package/umd/plugins/filtering.umd.js.map +1 -1
  79. package/umd/plugins/print.umd.js +76 -0
  80. package/umd/plugins/print.umd.js.map +1 -0
  81. package/umd/plugins/selection.umd.js +2 -2
  82. package/umd/plugins/selection.umd.js.map +1 -1
@@ -1,4 +1,4 @@
1
- const _ = {
1
+ const m = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>', v = {
2
2
  expand: "▶",
3
3
  collapse: "▼",
4
4
  sortAsc: "▲",
@@ -6,9 +6,12 @@ const _ = {
6
6
  sortNone: "⇅",
7
7
  submenuArrow: "▶",
8
8
  dragHandle: "⋮⋮",
9
- toolPanel: "☰"
9
+ toolPanel: "☰",
10
+ filter: m,
11
+ filterActive: m,
12
+ print: "🖨️"
10
13
  };
11
- class v {
14
+ class A {
12
15
  /**
13
16
  * Plugin dependencies - declare other plugins this one requires.
14
17
  *
@@ -232,7 +235,7 @@ class v {
232
235
  */
233
236
  get gridIcons() {
234
237
  const e = this.grid?.gridConfig?.icons ?? {};
235
- return { ..._, ...e };
238
+ return { ...v, ...e };
236
239
  }
237
240
  // #region Animation Helpers
238
241
  /**
@@ -308,7 +311,7 @@ class v {
308
311
  }
309
312
  // #endregion
310
313
  }
311
- function x(o, e, t) {
314
+ function R(o, e, t) {
312
315
  return o.id !== void 0 ? String(o.id) : t ? `${t}-${e}` : String(e);
313
316
  }
314
317
  function y(o, e) {
@@ -318,7 +321,7 @@ function y(o, e) {
318
321
  function w(o, e, t = null, n = 0) {
319
322
  const i = e.childrenField ?? "children", s = /* @__PURE__ */ new Set();
320
323
  for (let r = 0; r < o.length; r++) {
321
- const l = o[r], a = x(l, r, t), d = l[i];
324
+ const l = o[r], a = R(l, r, t), d = l[i];
322
325
  if (Array.isArray(d) && d.length > 0) {
323
326
  s.add(a);
324
327
  const h = w(d, e, a, n + 1);
@@ -327,33 +330,33 @@ function w(o, e, t = null, n = 0) {
327
330
  }
328
331
  return s;
329
332
  }
330
- function A() {
333
+ function E() {
331
334
  return /* @__PURE__ */ new Set();
332
335
  }
333
- function R(o, e, t, n = null, i = 0) {
336
+ function _(o, e, t, n = null, i = 0) {
334
337
  const s = t.childrenField ?? "children";
335
338
  for (let r = 0; r < o.length; r++) {
336
- const l = o[r], a = x(l, r, n);
339
+ const l = o[r], a = R(l, r, n);
337
340
  if (a === e)
338
341
  return [a];
339
342
  const d = l[s];
340
343
  if (Array.isArray(d) && d.length > 0) {
341
- const h = R(d, e, t, a, i + 1);
344
+ const h = _(d, e, t, a, i + 1);
342
345
  if (h)
343
346
  return [a, ...h];
344
347
  }
345
348
  }
346
349
  return null;
347
350
  }
348
- function E(o, e, t, n) {
349
- const i = R(o, e, t);
351
+ function C(o, e, t, n) {
352
+ const i = _(o, e, t);
350
353
  if (!i) return n;
351
354
  const s = new Set(n);
352
355
  for (let r = 0; r < i.length - 1; r++)
353
356
  s.add(i[r]);
354
357
  return s;
355
358
  }
356
- function m(o, e = "children") {
359
+ function x(o, e = "children") {
357
360
  if (!Array.isArray(o) || o.length === 0) return !1;
358
361
  for (const t of o) {
359
362
  if (!t) continue;
@@ -363,7 +366,7 @@ function m(o, e = "children") {
363
366
  }
364
367
  return !1;
365
368
  }
366
- function C(o) {
369
+ function k(o) {
367
370
  if (!Array.isArray(o) || o.length === 0) return null;
368
371
  const e = ["children", "items", "nodes", "subRows", "nested"];
369
372
  for (const t of o)
@@ -375,12 +378,12 @@ function C(o) {
375
378
  }
376
379
  return null;
377
380
  }
378
- const k = "@layer tbw-plugins{tbw-grid .cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:flex-start}tbw-grid .header-row .cell[data-field=__tbw_expander]{display:none}tbw-grid .header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}tbw-grid .tree-cell-wrapper{display:inline-flex;align-items:center;padding-left:calc(var(--tbw-tree-depth, 0) * var(--tbw-tree-indent-width, var(--tbw-tree-toggle-size, 1.25em)))}tbw-grid .tree-expander{display:flex;align-items:center;justify-content:flex-start;width:100%;height:100%;box-sizing:border-box}tbw-grid .tree-toggle{cursor:pointer;-webkit-user-select:none;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-tree-toggle-size, 1.25em);height:var(--tbw-tree-toggle-size, 1.25em);flex-shrink:0}tbw-grid .tree-toggle:hover{color:var(--tbw-tree-accent, var(--tbw-color-accent))}tbw-grid .tree-spacer{width:var(--tbw-tree-toggle-size, 1.25em);display:inline-block;flex-shrink:0}tbw-grid .data-grid-row.tbw-tree-slide-in{animation:tbw-tree-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}tbw-grid .data-grid-row.tbw-tree-fade-in{animation:tbw-tree-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-tree-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}@keyframes tbw-tree-fade-in{0%{opacity:0}to{opacity:1}}}";
379
- class T extends v {
381
+ const T = "@layer tbw-plugins{tbw-grid .cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:flex-start}tbw-grid .header-row .cell[data-field=__tbw_expander]{display:none}tbw-grid .header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}tbw-grid .tree-cell-wrapper{display:inline-flex;align-items:center;padding-left:calc(var(--tbw-tree-depth, 0) * var(--tbw-tree-indent-width, var(--tbw-tree-toggle-size, 1.25em)))}tbw-grid .tree-expander{display:flex;align-items:center;justify-content:flex-start;width:100%;height:100%;box-sizing:border-box}tbw-grid .tree-toggle{cursor:pointer;-webkit-user-select:none;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-tree-toggle-size, 1.25em);height:var(--tbw-tree-toggle-size, 1.25em);flex-shrink:0}tbw-grid .tree-toggle:hover{color:var(--tbw-tree-accent, var(--tbw-color-accent))}tbw-grid .tree-spacer{width:var(--tbw-tree-toggle-size, 1.25em);display:inline-block;flex-shrink:0}tbw-grid .data-grid-row.tbw-tree-slide-in{animation:tbw-tree-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}tbw-grid .data-grid-row.tbw-tree-fade-in{animation:tbw-tree-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-tree-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}@keyframes tbw-tree-fade-in{0%{opacity:0}to{opacity:1}}}";
382
+ class F extends A {
380
383
  /** @internal */
381
384
  name = "tree";
382
385
  /** @internal */
383
- styles = k;
386
+ styles = T;
384
387
  /** @internal */
385
388
  get defaultConfig() {
386
389
  return {
@@ -417,15 +420,15 @@ class T extends v {
417
420
  // #region Auto-Detection
418
421
  detect(e) {
419
422
  if (!this.config.autoDetect) return !1;
420
- const t = e, n = this.config.childrenField ?? C(t) ?? "children";
421
- return m(t, n);
423
+ const t = e, n = this.config.childrenField ?? k(t) ?? "children";
424
+ return x(t, n);
422
425
  }
423
426
  // #endregion
424
427
  // #region Data Processing
425
428
  /** @internal */
426
429
  processRows(e) {
427
430
  const t = this.config.childrenField ?? "children", n = e;
428
- if (!m(n, t))
431
+ if (!x(n, t))
429
432
  return this.flattenedRows = [], this.rowKeyMap.clear(), this.previousVisibleKeys.clear(), [...e];
430
433
  let i = this.withStableKeys(n);
431
434
  this.sortState && (i = this.sortTree(i, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = w(i, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(i, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
@@ -568,7 +571,7 @@ class T extends v {
568
571
  this.expandedKeys = w(this.rows, this.config), this.requestRender();
569
572
  }
570
573
  collapseAll() {
571
- this.expandedKeys = A(), this.requestRender();
574
+ this.expandedKeys = E(), this.requestRender();
572
575
  }
573
576
  isExpanded(e) {
574
577
  return this.expandedKeys.has(e);
@@ -583,11 +586,11 @@ class T extends v {
583
586
  return this.rowKeyMap.get(e)?.data;
584
587
  }
585
588
  expandToKey(e) {
586
- this.expandedKeys = E(this.rows, e, this.config, this.expandedKeys), this.requestRender();
589
+ this.expandedKeys = C(this.rows, e, this.config, this.expandedKeys), this.requestRender();
587
590
  }
588
591
  // #endregion
589
592
  }
590
593
  export {
591
- T as TreePlugin
594
+ F as TreePlugin
592
595
  };
593
596
  //# sourceMappingURL=index.js.map