@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.
Files changed (65) hide show
  1. package/all.js +712 -692
  2. package/all.js.map +1 -1
  3. package/index.js +321 -300
  4. package/index.js.map +1 -1
  5. package/lib/core/grid.d.ts +9 -0
  6. package/lib/core/grid.d.ts.map +1 -1
  7. package/lib/core/plugin/base-plugin.d.ts +11 -0
  8. package/lib/core/plugin/base-plugin.d.ts.map +1 -1
  9. package/lib/plugins/clipboard/index.js +9 -0
  10. package/lib/plugins/clipboard/index.js.map +1 -1
  11. package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts +3 -0
  12. package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts.map +1 -1
  13. package/lib/plugins/column-virtualization/index.js +90 -57
  14. package/lib/plugins/column-virtualization/index.js.map +1 -1
  15. package/lib/plugins/context-menu/index.js +9 -0
  16. package/lib/plugins/context-menu/index.js.map +1 -1
  17. package/lib/plugins/editing/index.js +9 -0
  18. package/lib/plugins/editing/index.js.map +1 -1
  19. package/lib/plugins/export/index.js +38 -29
  20. package/lib/plugins/export/index.js.map +1 -1
  21. package/lib/plugins/filtering/index.js +14 -5
  22. package/lib/plugins/filtering/index.js.map +1 -1
  23. package/lib/plugins/grouping-columns/index.js +9 -0
  24. package/lib/plugins/grouping-columns/index.js.map +1 -1
  25. package/lib/plugins/grouping-rows/index.js +63 -54
  26. package/lib/plugins/grouping-rows/index.js.map +1 -1
  27. package/lib/plugins/master-detail/index.js +25 -16
  28. package/lib/plugins/master-detail/index.js.map +1 -1
  29. package/lib/plugins/multi-sort/index.js +13 -4
  30. package/lib/plugins/multi-sort/index.js.map +1 -1
  31. package/lib/plugins/pinned-columns/index.js +13 -4
  32. package/lib/plugins/pinned-columns/index.js.map +1 -1
  33. package/lib/plugins/pinned-rows/index.js +9 -0
  34. package/lib/plugins/pinned-rows/index.js.map +1 -1
  35. package/lib/plugins/pivot/index.js +13 -4
  36. package/lib/plugins/pivot/index.js.map +1 -1
  37. package/lib/plugins/print/index.js +9 -0
  38. package/lib/plugins/print/index.js.map +1 -1
  39. package/lib/plugins/reorder/index.js +13 -4
  40. package/lib/plugins/reorder/index.js.map +1 -1
  41. package/lib/plugins/responsive/index.js +42 -33
  42. package/lib/plugins/responsive/index.js.map +1 -1
  43. package/lib/plugins/row-reorder/index.js +10 -1
  44. package/lib/plugins/row-reorder/index.js.map +1 -1
  45. package/lib/plugins/selection/index.js +10 -1
  46. package/lib/plugins/selection/index.js.map +1 -1
  47. package/lib/plugins/server-side/index.js +29 -20
  48. package/lib/plugins/server-side/index.js.map +1 -1
  49. package/lib/plugins/tree/index.js +20 -11
  50. package/lib/plugins/tree/index.js.map +1 -1
  51. package/lib/plugins/undo-redo/index.js +15 -6
  52. package/lib/plugins/undo-redo/index.js.map +1 -1
  53. package/lib/plugins/visibility/index.js +9 -0
  54. package/lib/plugins/visibility/index.js.map +1 -1
  55. package/package.json +1 -1
  56. package/umd/grid.all.umd.js +14 -14
  57. package/umd/grid.all.umd.js.map +1 -1
  58. package/umd/grid.umd.js +14 -14
  59. package/umd/grid.umd.js.map +1 -1
  60. package/umd/plugins/column-virtualization.umd.js +1 -1
  61. package/umd/plugins/column-virtualization.umd.js.map +1 -1
  62. package/umd/plugins/row-reorder.umd.js +1 -1
  63. package/umd/plugins/row-reorder.umd.js.map +1 -1
  64. package/umd/plugins/selection.umd.js +1 -1
  65. 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>', x = {
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 C {
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 { ...x, ...e };
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
- `, i = [], r = n.bom ? "\uFEFF" : "";
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
- i.push(s.join(c));
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
- i.push(a.join(c));
403
+ r.push(a.join(c));
395
404
  }
396
- return r + i.join(l);
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 w(o) {
415
+ function C(o) {
407
416
  return o.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
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, i = t.processHeader ? t.processHeader(l, c.field) : l;
421
- n += `<Cell><Data ss:Type="String">${w(i)}</Data></Cell>`;
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 i = c[l.field];
430
- t.processCell && (i = t.processCell(i, l.field, c));
431
- let r = "String", s = "";
432
- i == null ? s = "" : typeof i == "number" && !isNaN(i) ? (r = "Number", s = String(i)) : i instanceof Date ? (r = "DateTime", s = i.toISOString()) : s = w(String(i)), n += `<Cell><Data ss:Type="${r}">${s}</Data></Cell>`;
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 I extends C {
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 i = [...this.rows];
488
+ let r = [...this.rows];
480
489
  if (n.onlySelected) {
481
490
  const s = this.getSelectionState();
482
- s?.selected?.size && (i = [...s.selected].sort((d, u) => d - u).map((d) => this.rows[d]).filter(Boolean));
491
+ s?.selected?.size && (r = [...s.selected].sort((d, u) => d - u).map((d) => this.rows[d]).filter(Boolean));
483
492
  }
484
- t?.rowIndices && (i = t.rowIndices.map((s) => this.rows[s]).filter(Boolean)), this.isExportingFlag = !0;
485
- let r = c.fileName;
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(i, l, c, { bom: !0 });
490
- r = r.endsWith(".csv") ? r : `${r}.csv`, S(s, r);
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(i, l, c);
495
- r = r.endsWith(".xls") ? r : `${r}.xls`, y(s, r);
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 = i.map((u) => {
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
- r = r.endsWith(".json") ? r : `${r}.json`;
516
+ i = i.endsWith(".json") ? i : `${i}.json`;
508
517
  const d = new Blob([a], { type: "application/json" });
509
- h(d, r);
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: r,
516
- rowCount: i.length,
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
- I as ExportPlugin
579
+ R as ExportPlugin
571
580
  };
572
581
  //# sourceMappingURL=index.js.map