@toolbox-web/grid 1.9.0 → 1.9.2
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.
- package/all.js +712 -692
- package/all.js.map +1 -1
- package/index.js +321 -300
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +9 -0
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/plugin/base-plugin.d.ts +11 -0
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +9 -0
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts +3 -0
- package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts.map +1 -1
- package/lib/plugins/column-virtualization/index.js +90 -57
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +9 -0
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/index.js +9 -0
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js +38 -29
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/index.js +14 -5
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js +9 -0
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js +63 -54
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js +25 -16
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +13 -4
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js +13 -4
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js +9 -0
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js +13 -4
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/index.js +9 -0
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/reorder/index.js +13 -4
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js +42 -33
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js +10 -1
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/index.js +10 -1
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js +29 -20
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js +20 -11
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js +15 -6
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js +9 -0
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/umd/grid.all.umd.js +14 -14
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +14 -14
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/column-virtualization.umd.js +1 -1
- package/umd/plugins/column-virtualization.umd.js.map +1 -1
- package/umd/plugins/row-reorder.umd.js +1 -1
- package/umd/plugins/row-reorder.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +1 -1
- package/umd/plugins/selection.umd.js.map +1 -1
|
@@ -66,9 +66,9 @@ function k(r) {
|
|
|
66
66
|
}
|
|
67
67
|
function H(r, t) {
|
|
68
68
|
if (!r || r.indexOf("{{") === -1) return r;
|
|
69
|
-
const e = [], i = r.replace(R, (o,
|
|
70
|
-
const l = T(
|
|
71
|
-
return e.push({ expr:
|
|
69
|
+
const e = [], i = r.replace(R, (o, c) => {
|
|
70
|
+
const l = T(c, t);
|
|
71
|
+
return e.push({ expr: c.trim(), result: l }), l;
|
|
72
72
|
}), n = L(i), a = e.length && e.every((o) => o.result === "" || o.result === u);
|
|
73
73
|
return /Reflect\.|\bProxy\b|ownKeys\(/.test(r) || a ? "" : n;
|
|
74
74
|
}
|
|
@@ -101,10 +101,10 @@ const q = document.createElement("template");
|
|
|
101
101
|
q.innerHTML = '<div class="data-grid-row" role="row" part="row"></div>';
|
|
102
102
|
function g(r, t) {
|
|
103
103
|
if (r._virtualization?.enabled) {
|
|
104
|
-
const { rowHeight: s, container: o, viewportEl:
|
|
104
|
+
const { rowHeight: s, container: o, viewportEl: c } = r._virtualization, l = o, h = c?.clientHeight ?? l?.clientHeight ?? 0;
|
|
105
105
|
if (l && h > 0) {
|
|
106
|
-
const
|
|
107
|
-
|
|
106
|
+
const d = r._focusRow * s;
|
|
107
|
+
d < l.scrollTop ? l.scrollTop = d : d + s > l.scrollTop + h && (l.scrollTop = d - h + s);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
const e = r._activeEditRows !== void 0 && r._activeEditRows !== -1;
|
|
@@ -117,12 +117,12 @@ function g(r, t) {
|
|
|
117
117
|
let o = s?.children[r._focusCol];
|
|
118
118
|
if ((!o || !o.classList?.contains("cell")) && (o = s?.querySelector(`.cell[data-col="${r._focusCol}"]`) ?? s?.querySelector(".cell[data-col]")), o) {
|
|
119
119
|
o.classList.add("cell-focus"), o.setAttribute("aria-selected", "true");
|
|
120
|
-
const
|
|
121
|
-
if (
|
|
120
|
+
const c = r.querySelector(".tbw-scroll-area");
|
|
121
|
+
if (c && o && !e) {
|
|
122
122
|
const l = r._getHorizontalScrollOffsets?.(s ?? void 0, o) ?? { left: 0, right: 0 };
|
|
123
123
|
if (!l.skipScroll) {
|
|
124
|
-
const h = o.getBoundingClientRect(),
|
|
125
|
-
f < p ?
|
|
124
|
+
const h = o.getBoundingClientRect(), d = c.getBoundingClientRect(), f = h.left - d.left + c.scrollLeft, w = f + h.width, p = c.scrollLeft + l.left, b = c.scrollLeft + c.clientWidth - l.right;
|
|
125
|
+
f < p ? c.scrollLeft = f - l.left : w > b && (c.scrollLeft = w - c.clientWidth + l.right);
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
if (r._activeEditRows !== void 0 && r._activeEditRows !== -1 && o.classList.contains("editing")) {
|
|
@@ -352,10 +352,19 @@ class P {
|
|
|
352
352
|
}
|
|
353
353
|
/**
|
|
354
354
|
* Request a re-render of the grid.
|
|
355
|
+
* Uses ROWS phase - does NOT trigger processColumns hooks.
|
|
355
356
|
*/
|
|
356
357
|
requestRender() {
|
|
357
358
|
this.grid?.requestRender?.();
|
|
358
359
|
}
|
|
360
|
+
/**
|
|
361
|
+
* Request a columns re-render of the grid.
|
|
362
|
+
* Uses COLUMNS phase - triggers processColumns hooks.
|
|
363
|
+
* Use this when your plugin needs to reprocess column configuration.
|
|
364
|
+
*/
|
|
365
|
+
requestColumnsRender() {
|
|
366
|
+
this.grid?.requestColumnsRender?.();
|
|
367
|
+
}
|
|
359
368
|
/**
|
|
360
369
|
* Request a re-render and restore focus styling afterward.
|
|
361
370
|
* Use this when a plugin action (like expand/collapse) triggers a render
|
|
@@ -544,9 +553,9 @@ class B extends P {
|
|
|
544
553
|
/** Set of column fields to show value only (no header label) */
|
|
545
554
|
#l = /* @__PURE__ */ new Set();
|
|
546
555
|
/** Currently active breakpoint, or null if none */
|
|
547
|
-
#
|
|
556
|
+
#d = null;
|
|
548
557
|
/** Sorted breakpoints from largest to smallest */
|
|
549
|
-
#
|
|
558
|
+
#c = [];
|
|
550
559
|
/**
|
|
551
560
|
* Check if currently in responsive mode.
|
|
552
561
|
* @returns `true` if the grid is in card layout mode
|
|
@@ -593,10 +602,10 @@ class B extends P {
|
|
|
593
602
|
* @returns The active BreakpointConfig, or null if no breakpoint is active
|
|
594
603
|
*/
|
|
595
604
|
getActiveBreakpoint() {
|
|
596
|
-
return this.#
|
|
605
|
+
return this.#d;
|
|
597
606
|
}
|
|
598
607
|
attach(t) {
|
|
599
|
-
super.attach(t), this.#R(), this.#u(this.config.hiddenColumns), this.config.breakpoints?.length && (this.#
|
|
608
|
+
super.attach(t), this.#R(), this.#u(this.config.hiddenColumns), this.config.breakpoints?.length && (this.#c = [...this.config.breakpoints].sort((e, i) => i.maxWidth - e.maxWidth)), this.#e = new ResizeObserver((e) => {
|
|
600
609
|
const i = e[0]?.contentRect.width ?? 0;
|
|
601
610
|
this.#a = i, clearTimeout(this.#n), this.#n = setTimeout(() => {
|
|
602
611
|
this.#m(i);
|
|
@@ -633,21 +642,21 @@ class B extends P {
|
|
|
633
642
|
if (!e) return;
|
|
634
643
|
const i = t;
|
|
635
644
|
if (i.__frameworkAdapter?.parseResponsiveCardElement) {
|
|
636
|
-
const
|
|
637
|
-
|
|
645
|
+
const d = i.__frameworkAdapter.parseResponsiveCardElement(e);
|
|
646
|
+
d && (this.config = { ...this.config, cardRenderer: d });
|
|
638
647
|
}
|
|
639
|
-
const n = e.getAttribute("breakpoint"), a = e.getAttribute("card-row-height"), s = e.getAttribute("hidden-columns"), o = e.getAttribute("hide-header"),
|
|
648
|
+
const n = e.getAttribute("breakpoint"), a = e.getAttribute("card-row-height"), s = e.getAttribute("hidden-columns"), o = e.getAttribute("hide-header"), c = e.getAttribute("debounce-ms"), l = {};
|
|
640
649
|
if (n !== null) {
|
|
641
|
-
const
|
|
642
|
-
isNaN(
|
|
650
|
+
const d = parseInt(n, 10);
|
|
651
|
+
isNaN(d) || (l.breakpoint = d);
|
|
643
652
|
}
|
|
644
|
-
if (a !== null && (l.cardRowHeight = a === "auto" ? "auto" : parseInt(a, 10)), s !== null && (l.hiddenColumns = s.split(",").map((
|
|
645
|
-
const
|
|
646
|
-
isNaN(
|
|
653
|
+
if (a !== null && (l.cardRowHeight = a === "auto" ? "auto" : parseInt(a, 10)), s !== null && (l.hiddenColumns = s.split(",").map((d) => d.trim()).filter((d) => d.length > 0)), o !== null && (l.hideHeader = o !== "false"), c !== null) {
|
|
654
|
+
const d = parseInt(c, 10);
|
|
655
|
+
isNaN(d) || (l.debounceMs = d);
|
|
647
656
|
}
|
|
648
657
|
const h = e.innerHTML.trim();
|
|
649
|
-
h && !this.config.cardRenderer && !i.__frameworkAdapter?.parseResponsiveCardElement && (l.cardRenderer = (
|
|
650
|
-
const f = H(h, { value:
|
|
658
|
+
h && !this.config.cardRenderer && !i.__frameworkAdapter?.parseResponsiveCardElement && (l.cardRenderer = (d) => {
|
|
659
|
+
const f = H(h, { value: d, row: d }), w = S(f), p = document.createElement("div");
|
|
651
660
|
return p.className = "tbw-responsive-card-content", p.innerHTML = w, p;
|
|
652
661
|
}), Object.keys(l).length > 0 && (this.config = { ...this.config, ...l });
|
|
653
662
|
}
|
|
@@ -677,7 +686,7 @@ class B extends P {
|
|
|
677
686
|
* In multi-breakpoint mode, applies whenever there's an active breakpoint.
|
|
678
687
|
*/
|
|
679
688
|
afterRender() {
|
|
680
|
-
if (this.#E(), !(this.#
|
|
689
|
+
if (this.#E(), !(this.#c.length > 0 ? this.#d !== null : this.#t))
|
|
681
690
|
return;
|
|
682
691
|
const e = this.#s.size > 0, i = this.#l.size > 0;
|
|
683
692
|
if (!e && !i)
|
|
@@ -693,7 +702,7 @@ class B extends P {
|
|
|
693
702
|
* Handles both single breakpoint (legacy) and multi-breakpoint modes.
|
|
694
703
|
*/
|
|
695
704
|
#m(t) {
|
|
696
|
-
if (this.#
|
|
705
|
+
if (this.#c.length > 0) {
|
|
697
706
|
this.#y(t);
|
|
698
707
|
return;
|
|
699
708
|
}
|
|
@@ -714,10 +723,10 @@ class B extends P {
|
|
|
714
723
|
*/
|
|
715
724
|
#y(t) {
|
|
716
725
|
let e = null;
|
|
717
|
-
for (const n of this.#
|
|
726
|
+
for (const n of this.#c)
|
|
718
727
|
t <= n.maxWidth && (e = n);
|
|
719
|
-
if (e !== this.#
|
|
720
|
-
this.#
|
|
728
|
+
if (e !== this.#d) {
|
|
729
|
+
this.#d = e, e?.hiddenColumns ? this.#u(e.hiddenColumns) : this.#u(this.config.hiddenColumns);
|
|
721
730
|
const n = e?.cardLayout === !0;
|
|
722
731
|
n !== this.#t && (this.#t = n, this.#h()), this.emit("responsive-change", {
|
|
723
732
|
isResponsive: this.#t,
|
|
@@ -883,11 +892,11 @@ class B extends P {
|
|
|
883
892
|
if (!this.#t || !this.config.cardRenderer || !this.#f())
|
|
884
893
|
return 0;
|
|
885
894
|
const e = this.#i ?? 28, i = this.#b(), n = this.#v(), a = Math.max(0, i - e), s = Math.max(0, n - e);
|
|
886
|
-
let o = 0,
|
|
895
|
+
let o = 0, c = 0;
|
|
887
896
|
const l = this.rows, h = Math.min(t, l.length);
|
|
888
|
-
for (let
|
|
889
|
-
l[
|
|
890
|
-
return o * a +
|
|
897
|
+
for (let d = 0; d < h; d++)
|
|
898
|
+
l[d].__isGroupRow ? o++ : c++;
|
|
899
|
+
return o * a + c * s;
|
|
891
900
|
}
|
|
892
901
|
/**
|
|
893
902
|
* Count the number of card rows (non-group rows) in the current dataset.
|