@toolbox-web/grid 1.11.0 → 1.12.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.
- package/all.js +1224 -1110
- package/all.js.map +1 -1
- package/index.js +2000 -1700
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +21 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/aria.d.ts +52 -0
- package/lib/core/internal/aria.d.ts.map +1 -0
- package/lib/core/internal/config-manager.d.ts.map +1 -1
- package/lib/core/internal/idle-scheduler.d.ts +0 -27
- package/lib/core/internal/idle-scheduler.d.ts.map +1 -1
- package/lib/core/internal/loading.d.ts +0 -38
- package/lib/core/internal/loading.d.ts.map +1 -1
- package/lib/core/internal/row-animation.d.ts.map +1 -1
- package/lib/core/internal/shell.d.ts +6 -0
- package/lib/core/internal/shell.d.ts.map +1 -1
- package/lib/core/internal/style-injector.d.ts +0 -8
- package/lib/core/internal/style-injector.d.ts.map +1 -1
- package/lib/core/internal/utils.d.ts +6 -4
- package/lib/core/internal/utils.d.ts.map +1 -1
- package/lib/core/internal/validate-config.d.ts.map +1 -1
- package/lib/core/internal/virtualization.d.ts +177 -23
- package/lib/core/internal/virtualization.d.ts.map +1 -1
- package/lib/core/plugin/base-plugin.d.ts +50 -0
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/core/plugin/plugin-manager.d.ts +18 -0
- package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/core/plugin/types.d.ts +16 -0
- package/lib/core/plugin/types.d.ts.map +1 -1
- package/lib/core/types.d.ts +56 -3
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.js +1 -1
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts +7 -5
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +379 -278
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/editing/types.d.ts +14 -1
- package/lib/plugins/editing/types.d.ts.map +1 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +8 -1
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/index.js +59 -60
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +14 -0
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.js +88 -69
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/grouping-rows/types.d.ts +17 -0
- package/lib/plugins/grouping-rows/types.d.ts.map +1 -1
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +24 -0
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -1
- package/lib/plugins/master-detail/index.js +203 -128
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js +2 -2
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js +2 -2
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/ResponsivePlugin.d.ts +13 -0
- package/lib/plugins/responsive/ResponsivePlugin.d.ts.map +1 -1
- package/lib/plugins/responsive/index.js +65 -49
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/index.js +5 -5
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/umd/grid.all.umd.js +27 -25
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +18 -16
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/context-menu.umd.js +1 -1
- package/umd/plugins/context-menu.umd.js.map +1 -1
- package/umd/plugins/editing.umd.js +1 -1
- package/umd/plugins/editing.umd.js.map +1 -1
- package/umd/plugins/grouping-columns.umd.js +1 -1
- package/umd/plugins/grouping-columns.umd.js.map +1 -1
- package/umd/plugins/grouping-rows.umd.js +2 -2
- package/umd/plugins/grouping-rows.umd.js.map +1 -1
- package/umd/plugins/master-detail.umd.js +1 -1
- package/umd/plugins/master-detail.umd.js.map +1 -1
- package/umd/plugins/responsive.umd.js +1 -1
- package/umd/plugins/responsive.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +2 -2
- package/umd/plugins/selection.umd.js.map +1 -1
|
@@ -138,6 +138,8 @@ export declare class ResponsivePlugin<T = unknown> extends BaseGridPlugin<Respon
|
|
|
138
138
|
* actual heights and what the base calculation assumes:
|
|
139
139
|
* - Extra for groups: groupCount * (groupHeight - baseHeight)
|
|
140
140
|
* - Extra for cards: cardCount * (cardHeight - baseHeight)
|
|
141
|
+
*
|
|
142
|
+
* @deprecated Use getRowHeight() instead. This hook will be removed in v3.0.
|
|
141
143
|
*/
|
|
142
144
|
getExtraHeight(): number;
|
|
143
145
|
/**
|
|
@@ -145,7 +147,18 @@ export declare class ResponsivePlugin<T = unknown> extends BaseGridPlugin<Respon
|
|
|
145
147
|
* Used by virtualization to correctly calculate scroll positions.
|
|
146
148
|
*
|
|
147
149
|
* Like getExtraHeight, this accounts for both group and card row heights.
|
|
150
|
+
*
|
|
151
|
+
* @deprecated Use getRowHeight() instead. This hook will be removed in v3.0.
|
|
148
152
|
*/
|
|
149
153
|
getExtraHeightBefore(beforeRowIndex: number): number;
|
|
154
|
+
/**
|
|
155
|
+
* Get the height of a specific row based on its type (group row vs card row).
|
|
156
|
+
* Returns undefined if not in responsive mode.
|
|
157
|
+
*
|
|
158
|
+
* @param row - The row data
|
|
159
|
+
* @param _index - The row index (unused, but part of the interface)
|
|
160
|
+
* @returns The row height in pixels, or undefined if not in responsive mode
|
|
161
|
+
*/
|
|
162
|
+
getRowHeight(row: unknown, _index: number): number | undefined;
|
|
150
163
|
}
|
|
151
164
|
//# sourceMappingURL=ResponsivePlugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponsivePlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/responsive/ResponsivePlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAGxH,OAAO,KAAK,EAAE,gBAAgB,EAA8C,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEpH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,qBAAa,gBAAgB,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,cAAc,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;;IAC1F,QAAQ,CAAC,IAAI,gBAAgB;IAC7B,SAAkB,OAAO,WAAW;IACpC,SAAkB,MAAM,SAAU;IAElC;;OAEG;IACH,gBAAyB,QAAQ,EAAE,cAAc,CAe/C;IAgBF;;;OAGG;IACH,YAAY,IAAI,OAAO;IAIvB;;;;OAIG;IACH,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAYrC;;;OAGG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKlC;;;;OAIG;IACH,eAAe,CAAC,QAAQ,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,GAAG,IAAI;IAQ1E;;;OAGG;IACH,QAAQ,IAAI,MAAM;IAIlB;;;OAGG;IACH,mBAAmB,IAAI,gBAAgB,GAAG,IAAI;IAIrC,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IA+J/B,MAAM,IAAI,IAAI;IAcvB;;;OAGG;IACM,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAOjD;;;;OAIG;IACM,WAAW,IAAI,IAAI;IAyL5B;;;;;;;;;;OAUG;IACM,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI;IAqCtF;;;;;;;;;;;;;OAaG;IACM,SAAS,CAAC,CAAC,EAAE,aAAa,GAAG,OAAO;IAkK7C
|
|
1
|
+
{"version":3,"file":"ResponsivePlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/responsive/ResponsivePlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAGxH,OAAO,KAAK,EAAE,gBAAgB,EAA8C,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEpH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,qBAAa,gBAAgB,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,cAAc,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;;IAC1F,QAAQ,CAAC,IAAI,gBAAgB;IAC7B,SAAkB,OAAO,WAAW;IACpC,SAAkB,MAAM,SAAU;IAElC;;OAEG;IACH,gBAAyB,QAAQ,EAAE,cAAc,CAe/C;IAgBF;;;OAGG;IACH,YAAY,IAAI,OAAO;IAIvB;;;;OAIG;IACH,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAYrC;;;OAGG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKlC;;;;OAIG;IACH,eAAe,CAAC,QAAQ,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,GAAG,IAAI;IAQ1E;;;OAGG;IACH,QAAQ,IAAI,MAAM;IAIlB;;;OAGG;IACH,mBAAmB,IAAI,gBAAgB,GAAG,IAAI;IAIrC,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IA+J/B,MAAM,IAAI,IAAI;IAcvB;;;OAGG;IACM,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAOjD;;;;OAIG;IACM,WAAW,IAAI,IAAI;IAyL5B;;;;;;;;;;OAUG;IACM,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI;IAqCtF;;;;;;;;;;;;;OAaG;IACM,SAAS,CAAC,CAAC,EAAE,aAAa,GAAG,OAAO;IAkK7C;;;;;;;;;;;;OAYG;IACM,cAAc,IAAI,MAAM;IAyBjC;;;;;;;OAOG;IACM,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM;IAmC7D;;;;;;;OAOG;IACM,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CA0GxE"}
|
|
@@ -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 || t?.forceHorizontalScroll)) {
|
|
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")) {
|
|
@@ -546,16 +546,16 @@ class z extends P {
|
|
|
546
546
|
#e;
|
|
547
547
|
#t = !1;
|
|
548
548
|
#n;
|
|
549
|
-
#
|
|
549
|
+
#v = !1;
|
|
550
550
|
#a = 0;
|
|
551
551
|
/** Set of column fields to completely hide */
|
|
552
552
|
#s = /* @__PURE__ */ new Set();
|
|
553
553
|
/** Set of column fields to show value only (no header label) */
|
|
554
554
|
#l = /* @__PURE__ */ new Set();
|
|
555
555
|
/** Currently active breakpoint, or null if none */
|
|
556
|
-
#
|
|
556
|
+
#d = null;
|
|
557
557
|
/** Sorted breakpoints from largest to smallest */
|
|
558
|
-
#
|
|
558
|
+
#c = [];
|
|
559
559
|
/**
|
|
560
560
|
* Check if currently in responsive mode.
|
|
561
561
|
* @returns `true` if the grid is in card layout mode
|
|
@@ -580,7 +580,7 @@ class z extends P {
|
|
|
580
580
|
* @param width - New breakpoint width in pixels
|
|
581
581
|
*/
|
|
582
582
|
setBreakpoint(t) {
|
|
583
|
-
this.config.breakpoint = t, this.#
|
|
583
|
+
this.config.breakpoint = t, this.#b(this.#a);
|
|
584
584
|
}
|
|
585
585
|
/**
|
|
586
586
|
* Set a custom card renderer.
|
|
@@ -602,13 +602,13 @@ class z extends P {
|
|
|
602
602
|
* @returns The active BreakpointConfig, or null if no breakpoint is active
|
|
603
603
|
*/
|
|
604
604
|
getActiveBreakpoint() {
|
|
605
|
-
return this.#
|
|
605
|
+
return this.#d;
|
|
606
606
|
}
|
|
607
607
|
attach(t) {
|
|
608
|
-
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) => {
|
|
609
609
|
const i = e[0]?.contentRect.width ?? 0;
|
|
610
610
|
this.#a = i, clearTimeout(this.#n), this.#n = setTimeout(() => {
|
|
611
|
-
this.#
|
|
611
|
+
this.#b(i);
|
|
612
612
|
}, this.config.debounceMs ?? 100);
|
|
613
613
|
}), this.#e.observe(this.gridElement);
|
|
614
614
|
}
|
|
@@ -642,21 +642,21 @@ class z extends P {
|
|
|
642
642
|
if (!e) return;
|
|
643
643
|
const i = t;
|
|
644
644
|
if (i.__frameworkAdapter?.parseResponsiveCardElement) {
|
|
645
|
-
const
|
|
646
|
-
|
|
645
|
+
const d = i.__frameworkAdapter.parseResponsiveCardElement(e);
|
|
646
|
+
d && (this.config = { ...this.config, cardRenderer: d });
|
|
647
647
|
}
|
|
648
|
-
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 = {};
|
|
649
649
|
if (n !== null) {
|
|
650
|
-
const
|
|
651
|
-
isNaN(
|
|
650
|
+
const d = parseInt(n, 10);
|
|
651
|
+
isNaN(d) || (l.breakpoint = d);
|
|
652
652
|
}
|
|
653
|
-
if (a !== null && (l.cardRowHeight = a === "auto" ? "auto" : parseInt(a, 10)), s !== null && (l.hiddenColumns = s.split(",").map((
|
|
654
|
-
const
|
|
655
|
-
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);
|
|
656
656
|
}
|
|
657
657
|
const h = e.innerHTML.trim();
|
|
658
|
-
h && !this.config.cardRenderer && !i.__frameworkAdapter?.parseResponsiveCardElement && (l.cardRenderer = (
|
|
659
|
-
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");
|
|
660
660
|
return p.className = "tbw-responsive-card-content", p.innerHTML = w, p;
|
|
661
661
|
}), Object.keys(l).length > 0 && (this.config = { ...this.config, ...l });
|
|
662
662
|
}
|
|
@@ -686,7 +686,7 @@ class z extends P {
|
|
|
686
686
|
* In multi-breakpoint mode, applies whenever there's an active breakpoint.
|
|
687
687
|
*/
|
|
688
688
|
afterRender() {
|
|
689
|
-
if (this.#E(), !(this.#
|
|
689
|
+
if (this.#E(), !(this.#c.length > 0 ? this.#d !== null : this.#t))
|
|
690
690
|
return;
|
|
691
691
|
const e = this.#s.size > 0, i = this.#l.size > 0;
|
|
692
692
|
if (!e && !i)
|
|
@@ -701,13 +701,13 @@ class z extends P {
|
|
|
701
701
|
* Check if width has crossed any breakpoint threshold.
|
|
702
702
|
* Handles both single breakpoint (legacy) and multi-breakpoint modes.
|
|
703
703
|
*/
|
|
704
|
-
#
|
|
705
|
-
if (this.#
|
|
704
|
+
#b(t) {
|
|
705
|
+
if (this.#c.length > 0) {
|
|
706
706
|
this.#y(t);
|
|
707
707
|
return;
|
|
708
708
|
}
|
|
709
709
|
const e = this.config.breakpoint ?? 0;
|
|
710
|
-
e === 0 && !this.#
|
|
710
|
+
e === 0 && !this.#v && (this.#v = !0, console.warn(
|
|
711
711
|
"[tbw-grid:ResponsivePlugin] No breakpoint configured. Responsive mode is disabled. Set a breakpoint based on your grid's column count."
|
|
712
712
|
));
|
|
713
713
|
const i = e > 0 && t < e;
|
|
@@ -723,10 +723,10 @@ class z extends P {
|
|
|
723
723
|
*/
|
|
724
724
|
#y(t) {
|
|
725
725
|
let e = null;
|
|
726
|
-
for (const n of this.#
|
|
726
|
+
for (const n of this.#c)
|
|
727
727
|
t <= n.maxWidth && (e = n);
|
|
728
|
-
if (e !== this.#
|
|
729
|
-
this.#
|
|
728
|
+
if (e !== this.#d) {
|
|
729
|
+
this.#d = e, e?.hiddenColumns ? this.#u(e.hiddenColumns) : this.#u(this.config.hiddenColumns);
|
|
730
730
|
const n = e?.cardLayout === !0;
|
|
731
731
|
n !== this.#t && (this.#t = n, this.#h()), this.emit("responsive-change", {
|
|
732
732
|
isResponsive: this.#t,
|
|
@@ -833,7 +833,7 @@ class z extends P {
|
|
|
833
833
|
* Prioritizes DOM-measured height (actual rendered size) over config,
|
|
834
834
|
* since content can overflow the configured height.
|
|
835
835
|
*/
|
|
836
|
-
#
|
|
836
|
+
#f() {
|
|
837
837
|
if (this.#r && this.#r > 0)
|
|
838
838
|
return this.#r;
|
|
839
839
|
const t = this.config.cardRowHeight;
|
|
@@ -843,14 +843,14 @@ class z extends P {
|
|
|
843
843
|
* Get the effective group row height for virtualization calculations.
|
|
844
844
|
* Uses DOM-measured height, falling back to original row height.
|
|
845
845
|
*/
|
|
846
|
-
#
|
|
846
|
+
#p() {
|
|
847
847
|
return this.#o && this.#o > 0 ? this.#o : this.#i ?? 28;
|
|
848
848
|
}
|
|
849
849
|
/**
|
|
850
850
|
* Check if there are any group rows in the current dataset.
|
|
851
851
|
* Used to determine if we have mixed row heights.
|
|
852
852
|
*/
|
|
853
|
-
#
|
|
853
|
+
#w() {
|
|
854
854
|
for (const t of this.rows)
|
|
855
855
|
if (t.__isGroupRow)
|
|
856
856
|
return !0;
|
|
@@ -875,11 +875,13 @@ class z extends P {
|
|
|
875
875
|
* actual heights and what the base calculation assumes:
|
|
876
876
|
* - Extra for groups: groupCount * (groupHeight - baseHeight)
|
|
877
877
|
* - Extra for cards: cardCount * (cardHeight - baseHeight)
|
|
878
|
+
*
|
|
879
|
+
* @deprecated Use getRowHeight() instead. This hook will be removed in v3.0.
|
|
878
880
|
*/
|
|
879
881
|
getExtraHeight() {
|
|
880
|
-
if (!this.#t || !this.config.cardRenderer || !this.#
|
|
882
|
+
if (!this.#t || !this.config.cardRenderer || !this.#w())
|
|
881
883
|
return 0;
|
|
882
|
-
const t = this.#i ?? 28, e = this.#
|
|
884
|
+
const t = this.#i ?? 28, e = this.#p(), i = this.#f(), { groupCount: n, cardCount: a } = this.#_(), s = n * Math.max(0, e - t), o = a * Math.max(0, i - t);
|
|
883
885
|
return s + o;
|
|
884
886
|
}
|
|
885
887
|
/**
|
|
@@ -887,16 +889,30 @@ class z extends P {
|
|
|
887
889
|
* Used by virtualization to correctly calculate scroll positions.
|
|
888
890
|
*
|
|
889
891
|
* Like getExtraHeight, this accounts for both group and card row heights.
|
|
892
|
+
*
|
|
893
|
+
* @deprecated Use getRowHeight() instead. This hook will be removed in v3.0.
|
|
890
894
|
*/
|
|
891
895
|
getExtraHeightBefore(t) {
|
|
892
|
-
if (!this.#t || !this.config.cardRenderer || !this.#
|
|
896
|
+
if (!this.#t || !this.config.cardRenderer || !this.#w())
|
|
893
897
|
return 0;
|
|
894
|
-
const e = this.#i ?? 28, i = this.#
|
|
895
|
-
let o = 0,
|
|
898
|
+
const e = this.#i ?? 28, i = this.#p(), n = this.#f(), a = Math.max(0, i - e), s = Math.max(0, n - e);
|
|
899
|
+
let o = 0, c = 0;
|
|
896
900
|
const l = this.rows, h = Math.min(t, l.length);
|
|
897
|
-
for (let
|
|
898
|
-
l[
|
|
899
|
-
return o * a +
|
|
901
|
+
for (let d = 0; d < h; d++)
|
|
902
|
+
l[d].__isGroupRow ? o++ : c++;
|
|
903
|
+
return o * a + c * s;
|
|
904
|
+
}
|
|
905
|
+
/**
|
|
906
|
+
* Get the height of a specific row based on its type (group row vs card row).
|
|
907
|
+
* Returns undefined if not in responsive mode.
|
|
908
|
+
*
|
|
909
|
+
* @param row - The row data
|
|
910
|
+
* @param _index - The row index (unused, but part of the interface)
|
|
911
|
+
* @returns The row height in pixels, or undefined if not in responsive mode
|
|
912
|
+
*/
|
|
913
|
+
getRowHeight(t, e) {
|
|
914
|
+
if (!(!this.#t || !this.config.cardRenderer))
|
|
915
|
+
return t.__isGroupRow ? this.#p() : this.#f();
|
|
900
916
|
}
|
|
901
917
|
/**
|
|
902
918
|
* Count the number of card rows (non-group rows) in the current dataset.
|
|
@@ -908,7 +924,7 @@ class z extends P {
|
|
|
908
924
|
return t;
|
|
909
925
|
}
|
|
910
926
|
/** Pending refresh scheduled via microtask */
|
|
911
|
-
#
|
|
927
|
+
#m = !1;
|
|
912
928
|
/**
|
|
913
929
|
* Measure card height from DOM after render and detect row count changes.
|
|
914
930
|
* Called in afterRender to ensure scroll calculations are accurate.
|
|
@@ -928,7 +944,7 @@ class z extends P {
|
|
|
928
944
|
if (!this.#t || !this.config.cardRenderer)
|
|
929
945
|
return;
|
|
930
946
|
let t = !1;
|
|
931
|
-
const e = this.grid, i = this.#
|
|
947
|
+
const e = this.grid, i = this.#w(), n = this.#C();
|
|
932
948
|
if (n !== this.#g && (this.#g = n, t = !0), i) {
|
|
933
949
|
const s = this.gridElement.querySelector(".data-grid-row.group-row");
|
|
934
950
|
if (s) {
|
|
@@ -941,8 +957,8 @@ class z extends P {
|
|
|
941
957
|
const s = a.getBoundingClientRect().height;
|
|
942
958
|
s > 0 && s !== this.#r && (this.#r = s, t = !0, !i && e._virtualization && (e._virtualization.rowHeight = s));
|
|
943
959
|
}
|
|
944
|
-
t && !this.#
|
|
945
|
-
this.#
|
|
960
|
+
t && !this.#m && (this.#m = !0, queueMicrotask(() => {
|
|
961
|
+
this.#m = !1, this.grid && this.#t && this.grid.refreshVirtualWindow?.(!0, !0);
|
|
946
962
|
}));
|
|
947
963
|
}
|
|
948
964
|
}
|