@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.
- package/all.d.ts +1 -0
- package/all.d.ts.map +1 -1
- package/all.js +997 -710
- package/all.js.map +1 -1
- package/index.js +642 -599
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/header.d.ts +7 -0
- package/lib/core/internal/header.d.ts.map +1 -1
- package/lib/core/types.d.ts +151 -0
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +19 -16
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js +42 -39
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +25 -22
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +53 -48
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js +23 -20
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +11 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +186 -150
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js +21 -18
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js +67 -64
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js +52 -49
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +18 -15
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js +25 -22
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js +26 -23
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js +50 -47
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/PrintPlugin.d.ts +98 -0
- package/lib/plugins/print/PrintPlugin.d.ts.map +1 -0
- package/lib/plugins/print/index.d.ts +10 -0
- package/lib/plugins/print/index.d.ts.map +1 -0
- package/lib/plugins/print/index.js +626 -0
- package/lib/plugins/print/index.js.map +1 -0
- package/lib/plugins/print/print-isolated.d.ts +26 -0
- package/lib/plugins/print/print-isolated.d.ts.map +1 -0
- package/lib/plugins/print/types.d.ts +147 -0
- package/lib/plugins/print/types.d.ts.map +1 -0
- package/lib/plugins/reorder/index.js +25 -22
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js +20 -17
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js +39 -36
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +115 -101
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js +35 -32
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js +26 -23
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js +23 -20
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js +22 -19
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/public.d.ts +1 -1
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +98 -24
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +11 -11
- package/umd/grid.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/filtering.umd.js +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
- package/umd/plugins/print.umd.js +76 -0
- package/umd/plugins/print.umd.js.map +1 -0
- package/umd/plugins/selection.umd.js +2 -2
- package/umd/plugins/selection.umd.js.map +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const d = '<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>', p = {
|
|
2
2
|
expand: "▶",
|
|
3
3
|
collapse: "▼",
|
|
4
4
|
sortAsc: "▲",
|
|
@@ -6,7 +6,10 @@ const C = {
|
|
|
6
6
|
sortNone: "⇅",
|
|
7
7
|
submenuArrow: "▶",
|
|
8
8
|
dragHandle: "⋮⋮",
|
|
9
|
-
toolPanel: "☰"
|
|
9
|
+
toolPanel: "☰",
|
|
10
|
+
filter: d,
|
|
11
|
+
filterActive: d,
|
|
12
|
+
print: "🖨️"
|
|
10
13
|
};
|
|
11
14
|
class b {
|
|
12
15
|
/**
|
|
@@ -232,7 +235,7 @@ class b {
|
|
|
232
235
|
*/
|
|
233
236
|
get gridIcons() {
|
|
234
237
|
const t = this.grid?.gridConfig?.icons ?? {};
|
|
235
|
-
return { ...
|
|
238
|
+
return { ...p, ...t };
|
|
236
239
|
}
|
|
237
240
|
// #region Animation Helpers
|
|
238
241
|
/**
|
|
@@ -308,59 +311,59 @@ class b {
|
|
|
308
311
|
}
|
|
309
312
|
// #endregion
|
|
310
313
|
}
|
|
311
|
-
const
|
|
312
|
-
function a(
|
|
313
|
-
if (
|
|
314
|
-
return
|
|
315
|
-
if (typeof
|
|
316
|
-
return
|
|
317
|
-
const t = parseFloat(
|
|
318
|
-
return isNaN(t) ?
|
|
314
|
+
const c = 100;
|
|
315
|
+
function a(r) {
|
|
316
|
+
if (r == null)
|
|
317
|
+
return c;
|
|
318
|
+
if (typeof r == "number")
|
|
319
|
+
return r;
|
|
320
|
+
const t = parseFloat(r);
|
|
321
|
+
return isNaN(t) ? c : t;
|
|
319
322
|
}
|
|
320
|
-
function
|
|
321
|
-
return
|
|
323
|
+
function f(r) {
|
|
324
|
+
return r.map((t) => a(t.width));
|
|
322
325
|
}
|
|
323
|
-
function
|
|
326
|
+
function g(r) {
|
|
324
327
|
const t = [];
|
|
325
328
|
let e = 0;
|
|
326
|
-
for (const i of
|
|
329
|
+
for (const i of r)
|
|
327
330
|
t.push(e), e += a(i.width);
|
|
328
331
|
return t;
|
|
329
332
|
}
|
|
330
|
-
function
|
|
331
|
-
return
|
|
333
|
+
function m(r) {
|
|
334
|
+
return r.reduce((t, e) => t + a(e.width), 0);
|
|
332
335
|
}
|
|
333
|
-
function
|
|
334
|
-
const
|
|
335
|
-
if (
|
|
336
|
+
function w(r, t, e, i, n) {
|
|
337
|
+
const s = e.length;
|
|
338
|
+
if (s === 0)
|
|
336
339
|
return { startCol: 0, endCol: 0, visibleColumns: [] };
|
|
337
|
-
let o =
|
|
340
|
+
let o = v(r, e, i);
|
|
338
341
|
o = Math.max(0, o - n);
|
|
339
|
-
const
|
|
342
|
+
const C = r + t;
|
|
340
343
|
let u = o;
|
|
341
|
-
for (let l = o; l <
|
|
342
|
-
if (e[l] >=
|
|
344
|
+
for (let l = o; l < s; l++) {
|
|
345
|
+
if (e[l] >= C) {
|
|
343
346
|
u = l - 1;
|
|
344
347
|
break;
|
|
345
348
|
}
|
|
346
349
|
u = l;
|
|
347
350
|
}
|
|
348
|
-
u = Math.min(
|
|
349
|
-
const
|
|
351
|
+
u = Math.min(s - 1, u + n);
|
|
352
|
+
const h = [];
|
|
350
353
|
for (let l = o; l <= u; l++)
|
|
351
|
-
|
|
352
|
-
return { startCol: o, endCol: u, visibleColumns:
|
|
354
|
+
h.push(l);
|
|
355
|
+
return { startCol: o, endCol: u, visibleColumns: h };
|
|
353
356
|
}
|
|
354
|
-
function
|
|
357
|
+
function v(r, t, e) {
|
|
355
358
|
let i = 0, n = t.length - 1;
|
|
356
359
|
for (; i < n; ) {
|
|
357
|
-
const
|
|
358
|
-
t[
|
|
360
|
+
const s = Math.floor((i + n) / 2);
|
|
361
|
+
t[s] + e[s] <= r ? i = s + 1 : n = s;
|
|
359
362
|
}
|
|
360
363
|
return i;
|
|
361
364
|
}
|
|
362
|
-
function R(
|
|
363
|
-
return e ?
|
|
365
|
+
function R(r, t, e) {
|
|
366
|
+
return e ? r > t : !1;
|
|
364
367
|
}
|
|
365
368
|
class E extends b {
|
|
366
369
|
/** @internal */
|
|
@@ -387,7 +390,7 @@ class E extends b {
|
|
|
387
390
|
attach(t) {
|
|
388
391
|
super.attach(t);
|
|
389
392
|
const e = this.columns;
|
|
390
|
-
this.columnWidths =
|
|
393
|
+
this.columnWidths = f(e), this.columnOffsets = g(e), this.totalWidth = m(e), this.endCol = e.length - 1;
|
|
391
394
|
}
|
|
392
395
|
/** @internal */
|
|
393
396
|
detach() {
|
|
@@ -398,16 +401,16 @@ class E extends b {
|
|
|
398
401
|
/** @internal */
|
|
399
402
|
processColumns(t) {
|
|
400
403
|
const e = R(t.length, this.config.threshold ?? 30, this.config.autoEnable ?? !0);
|
|
401
|
-
if (this.isVirtualized = e ?? !1, this.columnWidths =
|
|
404
|
+
if (this.isVirtualized = e ?? !1, this.columnWidths = f(t), this.columnOffsets = g(t), this.totalWidth = m(t), !e)
|
|
402
405
|
return this.startCol = 0, this.endCol = t.length - 1, [...t];
|
|
403
|
-
const i = this.grid.clientWidth || 800, n =
|
|
406
|
+
const i = this.grid.clientWidth || 800, n = w(
|
|
404
407
|
this.scrollLeft,
|
|
405
408
|
i,
|
|
406
409
|
this.columnOffsets,
|
|
407
410
|
this.columnWidths,
|
|
408
411
|
this.config.overscan ?? 3
|
|
409
412
|
);
|
|
410
|
-
return this.startCol = n.startCol, this.endCol = n.endCol, n.visibleColumns.map((
|
|
413
|
+
return this.startCol = n.startCol, this.endCol = n.endCol, n.visibleColumns.map((s) => t[s]);
|
|
411
414
|
}
|
|
412
415
|
/** @internal */
|
|
413
416
|
afterRender() {
|
|
@@ -418,8 +421,8 @@ class E extends b {
|
|
|
418
421
|
i && (i.style.paddingLeft = `${e}px`), n.forEach((o) => {
|
|
419
422
|
o.style.paddingLeft = `${e}px`;
|
|
420
423
|
});
|
|
421
|
-
const
|
|
422
|
-
|
|
424
|
+
const s = t.querySelector(".rows-viewport .rows");
|
|
425
|
+
s && (s.style.width = `${this.totalWidth}px`);
|
|
423
426
|
}
|
|
424
427
|
/** @internal */
|
|
425
428
|
onScroll(t) {
|