@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
|
@@ -58,6 +58,7 @@ import { ColumnVirtualizationConfig } from './types';
|
|
|
58
58
|
* @internal Extends BaseGridPlugin
|
|
59
59
|
*/
|
|
60
60
|
export declare class ColumnVirtualizationPlugin extends BaseGridPlugin<ColumnVirtualizationConfig> {
|
|
61
|
+
#private;
|
|
61
62
|
/** @internal */
|
|
62
63
|
readonly name = "columnVirtualization";
|
|
63
64
|
/** @internal */
|
|
@@ -69,6 +70,8 @@ export declare class ColumnVirtualizationPlugin extends BaseGridPlugin<ColumnVir
|
|
|
69
70
|
private totalWidth;
|
|
70
71
|
private columnWidths;
|
|
71
72
|
private columnOffsets;
|
|
73
|
+
/** Store the original full column set for virtualization calculations */
|
|
74
|
+
private originalColumns;
|
|
72
75
|
/** @internal */
|
|
73
76
|
attach(grid: import('../../core/plugin/base-plugin').GridElement): void;
|
|
74
77
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColumnVirtualizationPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAQrD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,qBAAa,0BAA2B,SAAQ,cAAc,CAAC,0BAA0B,CAAC
|
|
1
|
+
{"version":3,"file":"ColumnVirtualizationPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAQrD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,qBAAa,0BAA2B,SAAQ,cAAc,CAAC,0BAA0B,CAAC;;IACxF,gBAAgB;IAChB,QAAQ,CAAC,IAAI,0BAA0B;IAEvC,gBAAgB;IAChB,cAAuB,aAAa,IAAI,OAAO,CAAC,0BAA0B,CAAC,CAM1E;IAGD,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAK;IACrB,OAA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@@ const d = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentCo
|
|
|
7
7
|
submenuArrow: "▶",
|
|
8
8
|
dragHandle: "⋮⋮",
|
|
9
9
|
toolPanel: "☰",
|
|
10
|
-
filter:
|
|
11
|
-
filterActive:
|
|
10
|
+
filter: c,
|
|
11
|
+
filterActive: c,
|
|
12
12
|
print: "🖨️"
|
|
13
13
|
};
|
|
14
|
-
class
|
|
14
|
+
class b {
|
|
15
15
|
/**
|
|
16
16
|
* Plugin dependencies - declare other plugins this one requires.
|
|
17
17
|
*
|
|
@@ -208,10 +208,19 @@ class p {
|
|
|
208
208
|
}
|
|
209
209
|
/**
|
|
210
210
|
* Request a re-render of the grid.
|
|
211
|
+
* Uses ROWS phase - does NOT trigger processColumns hooks.
|
|
211
212
|
*/
|
|
212
213
|
requestRender() {
|
|
213
214
|
this.grid?.requestRender?.();
|
|
214
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* Request a columns re-render of the grid.
|
|
218
|
+
* Uses COLUMNS phase - triggers processColumns hooks.
|
|
219
|
+
* Use this when your plugin needs to reprocess column configuration.
|
|
220
|
+
*/
|
|
221
|
+
requestColumnsRender() {
|
|
222
|
+
this.grid?.requestColumnsRender?.();
|
|
223
|
+
}
|
|
215
224
|
/**
|
|
216
225
|
* Request a re-render and restore focus styling afterward.
|
|
217
226
|
* Use this when a plugin action (like expand/collapse) triggers a render
|
|
@@ -292,7 +301,7 @@ class p {
|
|
|
292
301
|
*/
|
|
293
302
|
get gridIcons() {
|
|
294
303
|
const t = this.grid?.gridConfig?.icons ?? {};
|
|
295
|
-
return { ...
|
|
304
|
+
return { ...p, ...t };
|
|
296
305
|
}
|
|
297
306
|
// #region Animation Helpers
|
|
298
307
|
/**
|
|
@@ -368,61 +377,61 @@ class p {
|
|
|
368
377
|
}
|
|
369
378
|
// #endregion
|
|
370
379
|
}
|
|
371
|
-
const
|
|
372
|
-
function
|
|
373
|
-
if (
|
|
374
|
-
return
|
|
375
|
-
if (typeof
|
|
376
|
-
return
|
|
377
|
-
const t = parseFloat(
|
|
378
|
-
return isNaN(t) ?
|
|
380
|
+
const g = 100;
|
|
381
|
+
function h(s) {
|
|
382
|
+
if (s == null)
|
|
383
|
+
return g;
|
|
384
|
+
if (typeof s == "number")
|
|
385
|
+
return s;
|
|
386
|
+
const t = parseFloat(s);
|
|
387
|
+
return isNaN(t) ? g : t;
|
|
379
388
|
}
|
|
380
|
-
function f(
|
|
381
|
-
return
|
|
389
|
+
function f(s) {
|
|
390
|
+
return s.map((t) => h(t.width));
|
|
382
391
|
}
|
|
383
|
-
function
|
|
392
|
+
function m(s) {
|
|
384
393
|
const t = [];
|
|
385
394
|
let e = 0;
|
|
386
|
-
for (const i of
|
|
387
|
-
t.push(e), e +=
|
|
395
|
+
for (const i of s)
|
|
396
|
+
t.push(e), e += h(i.width);
|
|
388
397
|
return t;
|
|
389
398
|
}
|
|
390
|
-
function
|
|
391
|
-
return
|
|
399
|
+
function C(s) {
|
|
400
|
+
return s.reduce((t, e) => t + h(e.width), 0);
|
|
392
401
|
}
|
|
393
|
-
function w(
|
|
394
|
-
const
|
|
395
|
-
if (
|
|
402
|
+
function w(s, t, e, i, o) {
|
|
403
|
+
const r = e.length;
|
|
404
|
+
if (r === 0)
|
|
396
405
|
return { startCol: 0, endCol: 0, visibleColumns: [] };
|
|
397
|
-
let
|
|
398
|
-
|
|
399
|
-
const
|
|
400
|
-
let u =
|
|
401
|
-
for (let l =
|
|
402
|
-
if (e[l] >=
|
|
406
|
+
let n = y(s, e, i);
|
|
407
|
+
n = Math.max(0, n - o);
|
|
408
|
+
const a = s + t;
|
|
409
|
+
let u = n;
|
|
410
|
+
for (let l = n; l < r; l++) {
|
|
411
|
+
if (e[l] >= a) {
|
|
403
412
|
u = l - 1;
|
|
404
413
|
break;
|
|
405
414
|
}
|
|
406
415
|
u = l;
|
|
407
416
|
}
|
|
408
|
-
u = Math.min(
|
|
409
|
-
const
|
|
410
|
-
for (let l =
|
|
411
|
-
|
|
412
|
-
return { startCol:
|
|
417
|
+
u = Math.min(r - 1, u + o);
|
|
418
|
+
const d = [];
|
|
419
|
+
for (let l = n; l <= u; l++)
|
|
420
|
+
d.push(l);
|
|
421
|
+
return { startCol: n, endCol: u, visibleColumns: d };
|
|
413
422
|
}
|
|
414
|
-
function
|
|
415
|
-
let i = 0,
|
|
416
|
-
for (; i <
|
|
417
|
-
const
|
|
418
|
-
t[
|
|
423
|
+
function y(s, t, e) {
|
|
424
|
+
let i = 0, o = t.length - 1;
|
|
425
|
+
for (; i < o; ) {
|
|
426
|
+
const r = Math.floor((i + o) / 2);
|
|
427
|
+
t[r] + e[r] <= s ? i = r + 1 : o = r;
|
|
419
428
|
}
|
|
420
429
|
return i;
|
|
421
430
|
}
|
|
422
|
-
function
|
|
423
|
-
return e ?
|
|
431
|
+
function R(s, t, e) {
|
|
432
|
+
return e ? s > t : !1;
|
|
424
433
|
}
|
|
425
|
-
class
|
|
434
|
+
class E extends b {
|
|
426
435
|
/** @internal */
|
|
427
436
|
name = "columnVirtualization";
|
|
428
437
|
/** @internal */
|
|
@@ -441,49 +450,73 @@ class R extends p {
|
|
|
441
450
|
totalWidth = 0;
|
|
442
451
|
columnWidths = [];
|
|
443
452
|
columnOffsets = [];
|
|
453
|
+
/** Store the original full column set for virtualization calculations */
|
|
454
|
+
originalColumns = [];
|
|
444
455
|
// #endregion
|
|
445
456
|
// #region Lifecycle
|
|
446
457
|
/** @internal */
|
|
447
458
|
attach(t) {
|
|
448
459
|
super.attach(t);
|
|
449
460
|
const e = this.columns;
|
|
450
|
-
this.columnWidths = f(e), this.columnOffsets =
|
|
461
|
+
this.columnWidths = f(e), this.columnOffsets = m(e), this.totalWidth = C(e), this.endCol = e.length - 1;
|
|
451
462
|
}
|
|
452
463
|
/** @internal */
|
|
453
464
|
detach() {
|
|
454
|
-
this.columnWidths = [], this.columnOffsets = [], this.isVirtualized = !1, this.startCol = 0, this.endCol = 0, this.scrollLeft = 0, this.totalWidth = 0;
|
|
465
|
+
this.#t(), this.columnWidths = [], this.columnOffsets = [], this.originalColumns = [], this.isVirtualized = !1, this.startCol = 0, this.endCol = 0, this.scrollLeft = 0, this.totalWidth = 0;
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Remove inline styles set by this plugin for proper cleanup.
|
|
469
|
+
*/
|
|
470
|
+
#t() {
|
|
471
|
+
const t = this.gridElement;
|
|
472
|
+
if (!t) return;
|
|
473
|
+
const e = t.querySelector(".header-row");
|
|
474
|
+
e && (e.style.paddingLeft = "", e.style.minWidth = ""), t.querySelectorAll(".data-grid-row").forEach((n) => {
|
|
475
|
+
n.style.paddingLeft = "";
|
|
476
|
+
});
|
|
477
|
+
const o = t.querySelector(".rows-viewport .rows");
|
|
478
|
+
o && (o.style.width = "");
|
|
479
|
+
const r = t.querySelector(".rows-body");
|
|
480
|
+
r && (r.style.minWidth = "");
|
|
455
481
|
}
|
|
456
482
|
// #endregion
|
|
457
483
|
// #region Hooks
|
|
458
484
|
/** @internal */
|
|
459
485
|
processColumns(t) {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
486
|
+
(this.originalColumns.length === 0 || t.length > this.originalColumns.length) && (this.originalColumns = t, this.columnWidths = f(t), this.columnOffsets = m(t), this.totalWidth = C(t));
|
|
487
|
+
const i = this.originalColumns, o = R(
|
|
488
|
+
i.length,
|
|
489
|
+
this.config.threshold ?? 30,
|
|
490
|
+
this.config.autoEnable ?? !0
|
|
491
|
+
);
|
|
492
|
+
if (this.isVirtualized = o ?? !1, !o)
|
|
493
|
+
return this.startCol = 0, this.endCol = i.length - 1, [...i];
|
|
494
|
+
const r = this.grid.clientWidth || 800, n = w(
|
|
464
495
|
this.scrollLeft,
|
|
465
|
-
|
|
496
|
+
r,
|
|
466
497
|
this.columnOffsets,
|
|
467
498
|
this.columnWidths,
|
|
468
499
|
this.config.overscan ?? 3
|
|
469
500
|
);
|
|
470
|
-
return this.startCol = n.startCol, this.endCol = n.endCol, n.visibleColumns.map((
|
|
501
|
+
return this.startCol = n.startCol, this.endCol = n.endCol, n.visibleColumns.map((a) => i[a]);
|
|
471
502
|
}
|
|
472
503
|
/** @internal */
|
|
473
504
|
afterRender() {
|
|
474
505
|
if (!this.isVirtualized) return;
|
|
475
506
|
const t = this.gridElement;
|
|
476
507
|
if (!t) return;
|
|
477
|
-
const e = this.columnOffsets[this.startCol] ?? 0, i = t.querySelector(".header-row"),
|
|
478
|
-
i && (i.style.paddingLeft = `${e}px`),
|
|
479
|
-
|
|
508
|
+
const e = this.columnOffsets[this.startCol] ?? 0, i = t.querySelector(".header-row"), o = t.querySelectorAll(".data-grid-row");
|
|
509
|
+
i && (i.style.paddingLeft = `${e}px`, i.style.minWidth = `${this.totalWidth}px`), o.forEach((a) => {
|
|
510
|
+
a.style.paddingLeft = `${e}px`;
|
|
480
511
|
});
|
|
481
|
-
const
|
|
482
|
-
|
|
512
|
+
const r = t.querySelector(".rows-viewport .rows");
|
|
513
|
+
r && (r.style.width = `${this.totalWidth}px`);
|
|
514
|
+
const n = t.querySelector(".rows-body");
|
|
515
|
+
n && (n.style.minWidth = `${this.totalWidth}px`);
|
|
483
516
|
}
|
|
484
517
|
/** @internal */
|
|
485
518
|
onScroll(t) {
|
|
486
|
-
!this.isVirtualized || Math.abs(t.scrollLeft - this.scrollLeft) < 1 || (this.scrollLeft = t.scrollLeft, this.
|
|
519
|
+
!this.isVirtualized || Math.abs(t.scrollLeft - this.scrollLeft) < 1 || (this.scrollLeft = t.scrollLeft, this.requestColumnsRender());
|
|
487
520
|
}
|
|
488
521
|
// #endregion
|
|
489
522
|
// #region Public API
|
|
@@ -523,6 +556,6 @@ class R extends p {
|
|
|
523
556
|
// #endregion
|
|
524
557
|
}
|
|
525
558
|
export {
|
|
526
|
-
|
|
559
|
+
E as ColumnVirtualizationPlugin
|
|
527
560
|
};
|
|
528
561
|
//# sourceMappingURL=index.js.map
|