@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const m = '<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>',
|
|
1
|
+
const m = '<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>', w = {
|
|
2
2
|
expand: "▶",
|
|
3
3
|
collapse: "▼",
|
|
4
4
|
sortAsc: "▲",
|
|
@@ -11,7 +11,7 @@ const m = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentCo
|
|
|
11
11
|
filterActive: m,
|
|
12
12
|
print: "🖨️"
|
|
13
13
|
};
|
|
14
|
-
class
|
|
14
|
+
class x {
|
|
15
15
|
/**
|
|
16
16
|
* Plugin dependencies - declare other plugins this one requires.
|
|
17
17
|
*
|
|
@@ -208,10 +208,19 @@ class C {
|
|
|
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 C {
|
|
|
292
301
|
*/
|
|
293
302
|
get gridIcons() {
|
|
294
303
|
const e = this.grid?.gridConfig?.icons ?? {};
|
|
295
|
-
return { ...
|
|
304
|
+
return { ...w, ...e };
|
|
296
305
|
}
|
|
297
306
|
// #region Animation Helpers
|
|
298
307
|
/**
|
|
@@ -378,22 +387,22 @@ function b(o, e = !0) {
|
|
|
378
387
|
}
|
|
379
388
|
function E(o, e, t, n = {}) {
|
|
380
389
|
const c = n.delimiter ?? ",", l = n.newline ?? `
|
|
381
|
-
`,
|
|
390
|
+
`, r = [], i = n.bom ? "\uFEFF" : "";
|
|
382
391
|
if (t.includeHeaders !== !1) {
|
|
383
392
|
const s = e.map((a) => {
|
|
384
393
|
const d = a.header || a.field, u = t.processHeader ? t.processHeader(d, a.field) : d;
|
|
385
394
|
return b(u);
|
|
386
395
|
});
|
|
387
|
-
|
|
396
|
+
r.push(s.join(c));
|
|
388
397
|
}
|
|
389
398
|
for (const s of o) {
|
|
390
399
|
const a = e.map((d) => {
|
|
391
400
|
let u = s[d.field];
|
|
392
401
|
return t.processCell && (u = t.processCell(u, d.field, s)), b(u);
|
|
393
402
|
});
|
|
394
|
-
|
|
403
|
+
r.push(a.join(c));
|
|
395
404
|
}
|
|
396
|
-
return
|
|
405
|
+
return i + r.join(l);
|
|
397
406
|
}
|
|
398
407
|
function h(o, e) {
|
|
399
408
|
const t = URL.createObjectURL(o), n = document.createElement("a");
|
|
@@ -403,7 +412,7 @@ function S(o, e) {
|
|
|
403
412
|
const t = new Blob([o], { type: "text/csv;charset=utf-8;" });
|
|
404
413
|
h(t, e);
|
|
405
414
|
}
|
|
406
|
-
function
|
|
415
|
+
function C(o) {
|
|
407
416
|
return o.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
408
417
|
}
|
|
409
418
|
function v(o, e, t) {
|
|
@@ -417,8 +426,8 @@ function v(o, e, t) {
|
|
|
417
426
|
n += `
|
|
418
427
|
<Row>`;
|
|
419
428
|
for (const c of e) {
|
|
420
|
-
const l = c.header || c.field,
|
|
421
|
-
n += `<Cell><Data ss:Type="String">${
|
|
429
|
+
const l = c.header || c.field, r = t.processHeader ? t.processHeader(l, c.field) : l;
|
|
430
|
+
n += `<Cell><Data ss:Type="String">${C(r)}</Data></Cell>`;
|
|
422
431
|
}
|
|
423
432
|
n += "</Row>";
|
|
424
433
|
}
|
|
@@ -426,10 +435,10 @@ function v(o, e, t) {
|
|
|
426
435
|
n += `
|
|
427
436
|
<Row>`;
|
|
428
437
|
for (const l of e) {
|
|
429
|
-
let
|
|
430
|
-
t.processCell && (
|
|
431
|
-
let
|
|
432
|
-
|
|
438
|
+
let r = c[l.field];
|
|
439
|
+
t.processCell && (r = t.processCell(r, l.field, c));
|
|
440
|
+
let i = "String", s = "";
|
|
441
|
+
r == null ? s = "" : typeof r == "number" && !isNaN(r) ? (i = "Number", s = String(r)) : r instanceof Date ? (i = "DateTime", s = r.toISOString()) : s = C(String(r)), n += `<Cell><Data ss:Type="${i}">${s}</Data></Cell>`;
|
|
433
442
|
}
|
|
434
443
|
n += "</Row>";
|
|
435
444
|
}
|
|
@@ -444,7 +453,7 @@ function y(o, e) {
|
|
|
444
453
|
});
|
|
445
454
|
h(n, t);
|
|
446
455
|
}
|
|
447
|
-
class
|
|
456
|
+
class R extends x {
|
|
448
457
|
/** @internal */
|
|
449
458
|
name = "export";
|
|
450
459
|
/** @internal */
|
|
@@ -476,27 +485,27 @@ class I extends C {
|
|
|
476
485
|
const s = new Set(t.columns);
|
|
477
486
|
l = l.filter((a) => s.has(a.field));
|
|
478
487
|
}
|
|
479
|
-
let
|
|
488
|
+
let r = [...this.rows];
|
|
480
489
|
if (n.onlySelected) {
|
|
481
490
|
const s = this.getSelectionState();
|
|
482
|
-
s?.selected?.size && (
|
|
491
|
+
s?.selected?.size && (r = [...s.selected].sort((d, u) => d - u).map((d) => this.rows[d]).filter(Boolean));
|
|
483
492
|
}
|
|
484
|
-
t?.rowIndices && (
|
|
485
|
-
let
|
|
493
|
+
t?.rowIndices && (r = t.rowIndices.map((s) => this.rows[s]).filter(Boolean)), this.isExportingFlag = !0;
|
|
494
|
+
let i = c.fileName;
|
|
486
495
|
try {
|
|
487
496
|
switch (e) {
|
|
488
497
|
case "csv": {
|
|
489
|
-
const s = E(
|
|
490
|
-
|
|
498
|
+
const s = E(r, l, c, { bom: !0 });
|
|
499
|
+
i = i.endsWith(".csv") ? i : `${i}.csv`, S(s, i);
|
|
491
500
|
break;
|
|
492
501
|
}
|
|
493
502
|
case "excel": {
|
|
494
|
-
const s = v(
|
|
495
|
-
|
|
503
|
+
const s = v(r, l, c);
|
|
504
|
+
i = i.endsWith(".xls") ? i : `${i}.xls`, y(s, i);
|
|
496
505
|
break;
|
|
497
506
|
}
|
|
498
507
|
case "json": {
|
|
499
|
-
const s =
|
|
508
|
+
const s = r.map((u) => {
|
|
500
509
|
const p = {};
|
|
501
510
|
for (const f of l) {
|
|
502
511
|
let g = u[f.field];
|
|
@@ -504,16 +513,16 @@ class I extends C {
|
|
|
504
513
|
}
|
|
505
514
|
return p;
|
|
506
515
|
}), a = JSON.stringify(s, null, 2);
|
|
507
|
-
|
|
516
|
+
i = i.endsWith(".json") ? i : `${i}.json`;
|
|
508
517
|
const d = new Blob([a], { type: "application/json" });
|
|
509
|
-
h(d,
|
|
518
|
+
h(d, i);
|
|
510
519
|
break;
|
|
511
520
|
}
|
|
512
521
|
}
|
|
513
522
|
this.lastExportInfo = { format: e, timestamp: /* @__PURE__ */ new Date() }, this.emit("export-complete", {
|
|
514
523
|
format: e,
|
|
515
|
-
fileName:
|
|
516
|
-
rowCount:
|
|
524
|
+
fileName: i,
|
|
525
|
+
rowCount: r.length,
|
|
517
526
|
columnCount: l.length
|
|
518
527
|
});
|
|
519
528
|
} finally {
|
|
@@ -567,6 +576,6 @@ class I extends C {
|
|
|
567
576
|
// #endregion
|
|
568
577
|
}
|
|
569
578
|
export {
|
|
570
|
-
|
|
579
|
+
R as ExportPlugin
|
|
571
580
|
};
|
|
572
581
|
//# sourceMappingURL=index.js.map
|