@toolbox-web/grid 1.2.0 → 1.3.1

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 (79) hide show
  1. package/README.md +80 -22
  2. package/all.js +619 -571
  3. package/all.js.map +1 -1
  4. package/index.js +362 -302
  5. package/index.js.map +1 -1
  6. package/lib/core/grid.d.ts +64 -1
  7. package/lib/core/grid.d.ts.map +1 -1
  8. package/lib/core/internal/row-animation.d.ts +37 -0
  9. package/lib/core/internal/row-animation.d.ts.map +1 -0
  10. package/lib/core/types.d.ts +17 -0
  11. package/lib/core/types.d.ts.map +1 -1
  12. package/lib/plugins/clipboard/index.js +82 -76
  13. package/lib/plugins/clipboard/index.js.map +1 -1
  14. package/lib/plugins/clipboard/types.d.ts +1 -0
  15. package/lib/plugins/clipboard/types.d.ts.map +1 -1
  16. package/lib/plugins/column-virtualization/index.js +43 -41
  17. package/lib/plugins/column-virtualization/index.js.map +1 -1
  18. package/lib/plugins/context-menu/index.js +24 -22
  19. package/lib/plugins/context-menu/index.js.map +1 -1
  20. package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
  21. package/lib/plugins/editing/index.js +83 -52
  22. package/lib/plugins/editing/index.js.map +1 -1
  23. package/lib/plugins/export/index.js +22 -20
  24. package/lib/plugins/export/index.js.map +1 -1
  25. package/lib/plugins/filtering/FilteringPlugin.d.ts +11 -1
  26. package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
  27. package/lib/plugins/filtering/index.js +160 -125
  28. package/lib/plugins/filtering/index.js.map +1 -1
  29. package/lib/plugins/grouping-columns/index.js +20 -18
  30. package/lib/plugins/grouping-columns/index.js.map +1 -1
  31. package/lib/plugins/grouping-rows/index.js +66 -64
  32. package/lib/plugins/grouping-rows/index.js.map +1 -1
  33. package/lib/plugins/master-detail/index.js +51 -49
  34. package/lib/plugins/master-detail/index.js.map +1 -1
  35. package/lib/plugins/multi-sort/index.js +17 -15
  36. package/lib/plugins/multi-sort/index.js.map +1 -1
  37. package/lib/plugins/pinned-columns/index.js +24 -22
  38. package/lib/plugins/pinned-columns/index.js.map +1 -1
  39. package/lib/plugins/pinned-rows/index.js +25 -23
  40. package/lib/plugins/pinned-rows/index.js.map +1 -1
  41. package/lib/plugins/pivot/index.js +49 -47
  42. package/lib/plugins/pivot/index.js.map +1 -1
  43. package/lib/plugins/reorder/index.js +24 -22
  44. package/lib/plugins/reorder/index.js.map +1 -1
  45. package/lib/plugins/responsive/index.js +19 -17
  46. package/lib/plugins/responsive/index.js.map +1 -1
  47. package/lib/plugins/row-reorder/index.js +38 -36
  48. package/lib/plugins/row-reorder/index.js.map +1 -1
  49. package/lib/plugins/selection/SelectionPlugin.d.ts +13 -0
  50. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
  51. package/lib/plugins/selection/index.d.ts +1 -1
  52. package/lib/plugins/selection/index.d.ts.map +1 -1
  53. package/lib/plugins/selection/index.js +118 -85
  54. package/lib/plugins/selection/index.js.map +1 -1
  55. package/lib/plugins/selection/types.d.ts +50 -6
  56. package/lib/plugins/selection/types.d.ts.map +1 -1
  57. package/lib/plugins/server-side/index.js +34 -32
  58. package/lib/plugins/server-side/index.js.map +1 -1
  59. package/lib/plugins/tree/index.js +25 -23
  60. package/lib/plugins/tree/index.js.map +1 -1
  61. package/lib/plugins/undo-redo/index.js +22 -20
  62. package/lib/plugins/undo-redo/index.js.map +1 -1
  63. package/lib/plugins/visibility/index.js +21 -19
  64. package/lib/plugins/visibility/index.js.map +1 -1
  65. package/package.json +21 -4
  66. package/public.d.ts +1 -1
  67. package/public.d.ts.map +1 -1
  68. package/umd/grid.all.umd.js +19 -19
  69. package/umd/grid.all.umd.js.map +1 -1
  70. package/umd/grid.umd.js +9 -9
  71. package/umd/grid.umd.js.map +1 -1
  72. package/umd/plugins/clipboard.umd.js +5 -5
  73. package/umd/plugins/clipboard.umd.js.map +1 -1
  74. package/umd/plugins/editing.umd.js +1 -1
  75. package/umd/plugins/editing.umd.js.map +1 -1
  76. package/umd/plugins/filtering.umd.js +1 -1
  77. package/umd/plugins/filtering.umd.js.map +1 -1
  78. package/umd/plugins/selection.umd.js +2 -2
  79. package/umd/plugins/selection.umd.js.map +1 -1
@@ -1,4 +1,4 @@
1
- const x = /{{\s*([^}]+)\s*}}/g, u = "__DG_EMPTY__", R = /^[\w$. '?+\-*/%:()!<>=,&|]+$/, E = /__(proto|defineGetter|defineSetter)|constructor|window|globalThis|global|process|Function|import|eval|Reflect|Proxy|Error|arguments|document|location|cookie|localStorage|sessionStorage|indexedDB|fetch|XMLHttpRequest|WebSocket|Worker|SharedWorker|ServiceWorker|opener|parent|top|frames|self|this\b/, v = /* @__PURE__ */ new Set([
1
+ const R = /{{\s*([^}]+)\s*}}/g, u = "__DG_EMPTY__", E = /^[\w$. '?+\-*/%:()!<>=,&|]+$/, v = /__(proto|defineGetter|defineSetter)|constructor|window|globalThis|global|process|Function|import|eval|Reflect|Proxy|Error|arguments|document|location|cookie|localStorage|sessionStorage|indexedDB|fetch|XMLHttpRequest|WebSocket|Worker|SharedWorker|ServiceWorker|opener|parent|top|frames|self|this\b/, y = /* @__PURE__ */ new Set([
2
2
  "script",
3
3
  "iframe",
4
4
  "object",
@@ -23,23 +23,23 @@ const x = /{{\s*([^}]+)\s*}}/g, u = "__DG_EMPTY__", R = /^[\w$. '?+\-*/%:()!<>=,
23
23
  "plaintext",
24
24
  "xmp",
25
25
  "listing"
26
- ]), g = /^on\w+$/i, y = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "srcdoc", "xlink:href", "poster", "srcset"]), C = /^\s*(javascript|vbscript|data|blob):/i;
27
- function _(n) {
26
+ ]), h = /^on\w+$/i, C = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "srcdoc", "xlink:href", "poster", "srcset"]), _ = /^\s*(javascript|vbscript|data|blob):/i;
27
+ function A(n) {
28
28
  if (!n || typeof n != "string") return "";
29
29
  if (n.indexOf("<") === -1) return n;
30
30
  const e = document.createElement("template");
31
- return e.innerHTML = n, A(e.content), e.innerHTML;
31
+ return e.innerHTML = n, D(e.content), e.innerHTML;
32
32
  }
33
- function A(n) {
33
+ function D(n) {
34
34
  const e = [], t = n.querySelectorAll("*");
35
35
  for (const i of t) {
36
36
  const s = i.tagName.toLowerCase();
37
- if (v.has(s)) {
37
+ if (y.has(s)) {
38
38
  e.push(i);
39
39
  continue;
40
40
  }
41
41
  if ((s === "svg" || i.namespaceURI === "http://www.w3.org/2000/svg") && Array.from(i.attributes).some(
42
- (r) => g.test(r.name) || r.name === "href" || r.name === "xlink:href"
42
+ (r) => h.test(r.name) || r.name === "href" || r.name === "xlink:href"
43
43
  )) {
44
44
  e.push(i);
45
45
  continue;
@@ -47,11 +47,11 @@ function A(n) {
47
47
  const l = [];
48
48
  for (const o of i.attributes) {
49
49
  const r = o.name.toLowerCase();
50
- if (g.test(r)) {
50
+ if (h.test(r)) {
51
51
  l.push(o.name);
52
52
  continue;
53
53
  }
54
- if (y.has(r) && C.test(o.value)) {
54
+ if (C.has(r) && _.test(o.value)) {
55
55
  l.push(o.name);
56
56
  continue;
57
57
  }
@@ -64,22 +64,22 @@ function A(n) {
64
64
  }
65
65
  e.forEach((i) => i.remove());
66
66
  }
67
- function D(n, e) {
67
+ function S(n, e) {
68
68
  if (!n || n.indexOf("{{") === -1) return n;
69
- const t = [], i = n.replace(x, (r, a) => {
70
- const d = S(a, e);
69
+ const t = [], i = n.replace(R, (r, a) => {
70
+ const d = L(a, e);
71
71
  return t.push({ expr: a.trim(), result: d }), d;
72
- }), s = L(i), l = t.length && t.every((r) => r.result === "" || r.result === u);
72
+ }), s = I(i), l = t.length && t.every((r) => r.result === "" || r.result === u);
73
73
  return /Reflect\.|\bProxy\b|ownKeys\(/.test(n) || l ? "" : s;
74
74
  }
75
- function S(n, e) {
75
+ function L(n, e) {
76
76
  if (n = (n || "").trim(), !n || /\b(Reflect|Proxy|ownKeys)\b/.test(n)) return u;
77
77
  if (n === "value") return e.value == null ? u : String(e.value);
78
78
  if (n.startsWith("row.") && !/[()?]/.test(n) && !n.includes(":")) {
79
79
  const i = n.slice(4), s = e.row ? e.row[i] : void 0;
80
80
  return s == null ? u : String(s);
81
81
  }
82
- if (n.length > 80 || !R.test(n) || E.test(n)) return u;
82
+ if (n.length > 80 || !E.test(n) || v.test(n)) return u;
83
83
  const t = n.match(/\./g);
84
84
  if (t && t.length > 1) return u;
85
85
  try {
@@ -89,10 +89,10 @@ function S(n, e) {
89
89
  return u;
90
90
  }
91
91
  }
92
- function L(n) {
92
+ function I(n) {
93
93
  return n && n.replace(new RegExp(u, "g"), "").replace(/Reflect\.[^<>{}\s]+/g, "").replace(/\bProxy\b/g, "").replace(/ownKeys\([^)]*\)/g, "");
94
94
  }
95
- const I = {
95
+ const g = '<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>', T = {
96
96
  expand: "▶",
97
97
  collapse: "▼",
98
98
  sortAsc: "▲",
@@ -100,9 +100,11 @@ const I = {
100
100
  sortNone: "⇅",
101
101
  submenuArrow: "▶",
102
102
  dragHandle: "⋮⋮",
103
- toolPanel: "☰"
103
+ toolPanel: "☰",
104
+ filter: g,
105
+ filterActive: g
104
106
  };
105
- class T {
107
+ class H {
106
108
  /**
107
109
  * Plugin dependencies - declare other plugins this one requires.
108
110
  *
@@ -326,7 +328,7 @@ class T {
326
328
  */
327
329
  get gridIcons() {
328
330
  const e = this.grid?.gridConfig?.icons ?? {};
329
- return { ...I, ...e };
331
+ return { ...T, ...e };
330
332
  }
331
333
  // #region Animation Helpers
332
334
  /**
@@ -402,19 +404,19 @@ class T {
402
404
  }
403
405
  // #endregion
404
406
  }
405
- const p = "__tbw_expander", H = 32;
406
- function m(n) {
407
- return n.field === p;
408
- }
409
- function k(n) {
410
- return n.find(m);
407
+ const m = "__tbw_expander", k = 32;
408
+ function w(n) {
409
+ return n.field === m;
411
410
  }
412
411
  function O(n) {
412
+ return n.find(w);
413
+ }
414
+ function N(n) {
413
415
  return {
414
- field: p,
416
+ field: m,
415
417
  header: "",
416
418
  // No header text - visually merges with next column
417
- width: H,
419
+ width: k,
418
420
  resizable: !1,
419
421
  sortable: !1,
420
422
  filterable: !1,
@@ -429,22 +431,22 @@ function O(n) {
429
431
  }
430
432
  };
431
433
  }
432
- function h(n, e) {
434
+ function p(n, e) {
433
435
  const t = new Set(n);
434
436
  return t.has(e) ? t.delete(e) : t.add(e), t;
435
437
  }
436
- function N(n, e) {
438
+ function q(n, e) {
437
439
  const t = new Set(n);
438
440
  return t.add(e), t;
439
441
  }
440
- function q(n, e) {
442
+ function P(n, e) {
441
443
  const t = new Set(n);
442
444
  return t.delete(e), t;
443
445
  }
444
- function P(n, e) {
446
+ function M(n, e) {
445
447
  return n.has(e);
446
448
  }
447
- function M(n, e, t, i) {
449
+ function F(n, e, t, i) {
448
450
  const s = document.createElement("div");
449
451
  s.className = "master-detail-row", s.setAttribute("data-detail-for", String(e)), s.setAttribute("role", "row");
450
452
  const l = document.createElement("div");
@@ -452,12 +454,12 @@ function M(n, e, t, i) {
452
454
  const o = t(n, e);
453
455
  return typeof o == "string" ? l.innerHTML = o : o instanceof HTMLElement && l.appendChild(o), s.appendChild(l), s;
454
456
  }
455
- const F = "@layer tbw-plugins{tbw-grid .cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:center}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 .master-detail-expander{display:flex;align-items:center;justify-content:center;width:100%;height:100%}tbw-grid .master-detail-toggle{cursor:pointer;opacity:.7;-webkit-user-select:none;user-select:none;display:inline-flex;align-items:center;justify-content:center}tbw-grid .master-detail-toggle:hover{opacity:1}tbw-grid .master-detail-row{grid-column:1 / -1;display:grid;background:var(--tbw-master-detail-bg, var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border, var(--tbw-color-border));overflow:hidden}tbw-grid .master-detail-cell{padding:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));overflow:auto}tbw-grid .master-detail-row.tbw-expanding{animation:tbw-detail-expand var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}tbw-grid .master-detail-row.tbw-collapsing{animation:tbw-detail-collapse var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-detail-expand{0%{opacity:0;max-height:0;padding-top:0;padding-bottom:0}to{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem);padding-top:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));padding-bottom:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem))}}@keyframes tbw-detail-collapse{0%{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem)}to{opacity:0;max-height:0}}}";
456
- class w extends T {
457
+ const U = "@layer tbw-plugins{tbw-grid .cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:center}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 .master-detail-expander{display:flex;align-items:center;justify-content:center;width:100%;height:100%}tbw-grid .master-detail-toggle{cursor:pointer;opacity:.7;-webkit-user-select:none;user-select:none;display:inline-flex;align-items:center;justify-content:center}tbw-grid .master-detail-toggle:hover{opacity:1}tbw-grid .master-detail-row{grid-column:1 / -1;display:grid;background:var(--tbw-master-detail-bg, var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border, var(--tbw-color-border));overflow:hidden}tbw-grid .master-detail-cell{padding:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));overflow:auto}tbw-grid .master-detail-row.tbw-expanding{animation:tbw-detail-expand var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}tbw-grid .master-detail-row.tbw-collapsing{animation:tbw-detail-collapse var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-detail-expand{0%{opacity:0;max-height:0;padding-top:0;padding-bottom:0}to{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem);padding-top:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));padding-bottom:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem))}}@keyframes tbw-detail-collapse{0%{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem)}to{opacity:0;max-height:0}}}";
458
+ class b extends H {
457
459
  /** @internal */
458
460
  name = "masterDetail";
459
461
  /** @internal */
460
- styles = F;
462
+ styles = U;
461
463
  /** @internal */
462
464
  get defaultConfig() {
463
465
  return {
@@ -519,8 +521,8 @@ class w extends T {
519
521
  s !== null && (d.animation = s === "false" ? !1 : s), l !== null && (d.showExpandColumn = l !== "false"), o !== null && (d.expandOnRowClick = o === "true"), r !== null && (d.collapseOnClickOutside = r === "true"), a !== null && (d.detailHeight = a === "auto" ? "auto" : parseInt(a, 10));
520
522
  const c = t.innerHTML.trim();
521
523
  c && !this.config.detailRenderer && (d.detailRenderer = (f, G) => {
522
- const b = D(c, { value: f, row: f });
523
- return _(b);
524
+ const x = S(c, { value: f, row: f });
525
+ return A(x);
524
526
  }), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
525
527
  }
526
528
  // #endregion
@@ -569,13 +571,13 @@ class w extends T {
569
571
  */
570
572
  getDetailHeight(e) {
571
573
  const t = this.detailElements.get(e);
572
- return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : w.DEFAULT_DETAIL_HEIGHT;
574
+ return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : b.DEFAULT_DETAIL_HEIGHT;
573
575
  }
574
576
  /**
575
577
  * Toggle a row's detail and emit event.
576
578
  */
577
579
  toggleAndEmit(e, t) {
578
- this.expandedRows = h(this.expandedRows, e), this.emit("detail-expand", {
580
+ this.expandedRows = p(this.expandedRows, e), this.emit("detail-expand", {
579
581
  rowIndex: t,
580
582
  row: e,
581
583
  expanded: this.expandedRows.has(e)
@@ -594,9 +596,9 @@ class w extends T {
594
596
  if (!(this.config.showExpandColumn === !0 || this.config.showExpandColumn !== !1 && !!this.config.detailRenderer))
595
597
  return [...e];
596
598
  const i = [...e];
597
- if (k(i))
599
+ if (O(i))
598
600
  return i;
599
- const l = O(this.name);
601
+ const l = N(this.name);
600
602
  return l.viewRenderer = (o) => {
601
603
  const { row: r } = o, a = this.expandedRows.has(r), d = document.createElement("span");
602
604
  d.className = "master-detail-expander expander-cell";
@@ -619,7 +621,7 @@ class w extends T {
619
621
  onKeyDown(e) {
620
622
  if (e.key !== " ") return;
621
623
  const t = this.grid._focusCol, i = this.grid._focusRow, s = this.columns[t];
622
- if (!s || !m(s)) return;
624
+ if (!s || !w(s)) return;
623
625
  const l = this.rows[i];
624
626
  if (l)
625
627
  return e.preventDefault(), this.toggleAndEmit(l, i), this.requestRenderWithFocus(), !0;
@@ -662,7 +664,7 @@ class w extends T {
662
664
  d.previousElementSibling !== r && r.after(d);
663
665
  continue;
664
666
  }
665
- const c = M(a, o, this.config.detailRenderer, s);
667
+ const c = F(a, o, this.config.detailRenderer, s);
666
668
  typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`), r.after(c), this.detailElements.set(a, c), this.animateExpand(c);
667
669
  }
668
670
  }
@@ -715,7 +717,7 @@ class w extends T {
715
717
  */
716
718
  expand(e) {
717
719
  const t = this.rows[e];
718
- t && (this.expandedRows = N(this.expandedRows, t), this.requestRender());
720
+ t && (this.expandedRows = q(this.expandedRows, t), this.requestRender());
719
721
  }
720
722
  /**
721
723
  * Collapse the detail row at the given index.
@@ -723,7 +725,7 @@ class w extends T {
723
725
  */
724
726
  collapse(e) {
725
727
  const t = this.rows[e];
726
- t && (this.expandedRows = q(this.expandedRows, t), this.requestRender());
728
+ t && (this.expandedRows = P(this.expandedRows, t), this.requestRender());
727
729
  }
728
730
  /**
729
731
  * Toggle the detail row at the given index.
@@ -731,7 +733,7 @@ class w extends T {
731
733
  */
732
734
  toggle(e) {
733
735
  const t = this.rows[e];
734
- t && (this.expandedRows = h(this.expandedRows, t), this.requestRender());
736
+ t && (this.expandedRows = p(this.expandedRows, t), this.requestRender());
735
737
  }
736
738
  /**
737
739
  * Check if the detail row at the given index is expanded.
@@ -740,7 +742,7 @@ class w extends T {
740
742
  */
741
743
  isExpanded(e) {
742
744
  const t = this.rows[e];
743
- return t ? P(this.expandedRows, t) : !1;
745
+ return t ? M(this.expandedRows, t) : !1;
744
746
  }
745
747
  /**
746
748
  * Expand all detail rows.
@@ -794,6 +796,6 @@ class w extends T {
794
796
  // #endregion
795
797
  }
796
798
  export {
797
- w as MasterDetailPlugin
799
+ b as MasterDetailPlugin
798
800
  };
799
801
  //# sourceMappingURL=index.js.map