@toolbox-web/grid 1.19.2 → 1.20.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.
Files changed (50) hide show
  1. package/all.js +17 -19
  2. package/all.js.map +1 -1
  3. package/index.js +361 -349
  4. package/index.js.map +1 -1
  5. package/lib/core/grid.d.ts +22 -0
  6. package/lib/core/grid.d.ts.map +1 -1
  7. package/lib/core/internal/event-delegation.d.ts.map +1 -1
  8. package/lib/core/internal/sorting.d.ts +6 -0
  9. package/lib/core/internal/sorting.d.ts.map +1 -1
  10. package/lib/core/types.d.ts +6 -0
  11. package/lib/core/types.d.ts.map +1 -1
  12. package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -1
  13. package/lib/plugins/clipboard/index.js +54 -54
  14. package/lib/plugins/clipboard/index.js.map +1 -1
  15. package/lib/plugins/column-virtualization/index.js.map +1 -1
  16. package/lib/plugins/context-menu/index.js.map +1 -1
  17. package/lib/plugins/editing/index.js.map +1 -1
  18. package/lib/plugins/export/index.js.map +1 -1
  19. package/lib/plugins/filtering/index.js.map +1 -1
  20. package/lib/plugins/grouping-columns/index.js.map +1 -1
  21. package/lib/plugins/grouping-rows/index.js.map +1 -1
  22. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -1
  23. package/lib/plugins/master-detail/index.js +1 -1
  24. package/lib/plugins/master-detail/index.js.map +1 -1
  25. package/lib/plugins/multi-sort/index.js.map +1 -1
  26. package/lib/plugins/pinned-columns/index.js.map +1 -1
  27. package/lib/plugins/pinned-rows/index.js.map +1 -1
  28. package/lib/plugins/pivot/index.js.map +1 -1
  29. package/lib/plugins/print/index.js.map +1 -1
  30. package/lib/plugins/reorder/index.js.map +1 -1
  31. package/lib/plugins/responsive/index.js.map +1 -1
  32. package/lib/plugins/row-reorder/index.js.map +1 -1
  33. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
  34. package/lib/plugins/selection/index.js +93 -95
  35. package/lib/plugins/selection/index.js.map +1 -1
  36. package/lib/plugins/server-side/index.js.map +1 -1
  37. package/lib/plugins/tree/index.js.map +1 -1
  38. package/lib/plugins/undo-redo/index.js.map +1 -1
  39. package/lib/plugins/visibility/index.js.map +1 -1
  40. package/package.json +11 -1
  41. package/umd/grid.all.umd.js +21 -21
  42. package/umd/grid.all.umd.js.map +1 -1
  43. package/umd/grid.umd.js +11 -11
  44. package/umd/grid.umd.js.map +1 -1
  45. package/umd/plugins/clipboard.umd.js +4 -4
  46. package/umd/plugins/clipboard.umd.js.map +1 -1
  47. package/umd/plugins/master-detail.umd.js +1 -1
  48. package/umd/plugins/master-detail.umd.js.map +1 -1
  49. package/umd/plugins/selection.umd.js +1 -1
  50. package/umd/plugins/selection.umd.js.map +1 -1
package/all.js CHANGED
@@ -111,10 +111,10 @@ class In extends F {
111
111
  const t = e.clipboardData?.getData("text/plain");
112
112
  if (!t) return;
113
113
  e.preventDefault();
114
- const i = _e(t, this.config), n = this.#s(), r = n?.ranges?.[0], o = r?.from.row ?? 0, s = r?.from.col ?? 0, d = r && (n?.mode === "range" || n?.mode === "row") && (r.from.row !== r.to.row || r.from.col !== r.to.col) ? { endRow: r.to.row, endCol: r.to.col } : null, c = d?.endCol ?? this.columns.length - 1, u = this.columns[s], h = u ? { row: o, col: s, field: u.field, bounds: d } : null, f = [], g = i[0]?.length ?? 0;
114
+ const i = _e(t, this.config), n = this.#s(), r = n?.ranges?.[0], o = r?.from.row ?? 0, s = r?.from.col ?? 0, d = r && (n?.mode === "range" || n?.mode === "row") && (r.from.row !== r.to.row || r.from.col !== r.to.col) ? { endRow: r.to.row, endCol: r.to.col } : null, c = d?.endCol ?? this.visibleColumns.length - 1, u = this.visibleColumns[s], h = u ? { row: o, col: s, field: u.field, bounds: d } : null, f = [], g = i[0]?.length ?? 0;
115
115
  for (let m = 0; m < g && s + m <= c; m++) {
116
- const y = this.columns[s + m];
117
- y && !y.hidden && f.push(y.field);
116
+ const y = this.visibleColumns[s + m];
117
+ y && f.push(y.field);
118
118
  }
119
119
  const p = { rows: i, text: t, target: h, fields: f };
120
120
  this.emit("paste", p), this.#o(p);
@@ -135,7 +135,7 @@ class In extends F {
135
135
  i = ie(this.columns, e.columns);
136
136
  else if (t?.ranges.length && t.mode !== "row") {
137
137
  const r = t.ranges[t.ranges.length - 1], o = Math.min(r.from.col, r.to.col), s = Math.max(r.from.col, r.to.col);
138
- i = ie(this.columns.slice(o, s + 1));
138
+ i = ie(this.visibleColumns.slice(o, s + 1));
139
139
  } else
140
140
  i = ie(this.columns);
141
141
  let n;
@@ -3182,7 +3182,7 @@ class ut extends F {
3182
3182
  }
3183
3183
  onKeyDown(e) {
3184
3184
  if (e.key !== " ") return;
3185
- const t = this.grid._focusCol, i = this.grid._focusRow, n = this.columns[t];
3185
+ const t = this.grid._focusCol, i = this.grid._focusRow, n = this.visibleColumns[t];
3186
3186
  if (!n || !se(n)) return;
3187
3187
  const r = this.rows[i];
3188
3188
  if (r)
@@ -5626,7 +5626,7 @@ class Bn extends F {
5626
5626
  if (!i) return !0;
5627
5627
  const n = this.rows[e];
5628
5628
  if (!n) return !1;
5629
- const r = t !== void 0 ? this.columns[t] : void 0;
5629
+ const r = t !== void 0 ? this.visibleColumns[t] : void 0;
5630
5630
  return i(n, e, r, t);
5631
5631
  }
5632
5632
  isRowSelectable(e) {
@@ -5659,7 +5659,7 @@ class Bn extends F {
5659
5659
  const { rowIndex: t, colIndex: i, originalEvent: n } = e, { mode: r, triggerOn: o = "click" } = this.config;
5660
5660
  if (n.type !== o)
5661
5661
  return !1;
5662
- const s = this.columns[i], l = s && W(s);
5662
+ const s = e.column, l = s && W(s);
5663
5663
  if (r === "cell") {
5664
5664
  if (l || !this.isCellSelectable(t, i))
5665
5665
  return !1;
@@ -5752,25 +5752,23 @@ class Bn extends F {
5752
5752
  return t === "range" && this.config.multiSelect !== !1 && e.key === "a" && (e.ctrlKey || e.metaKey) ? this.grid.query("isEditing").some(Boolean) ? !1 : (e.preventDefault(), e.stopPropagation(), this.selectAll(), !0) : !1;
5753
5753
  }
5754
5754
  onCellMouseDown(e) {
5755
- if (!this.isSelectionEnabled() || this.config.mode !== "range" || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
5756
- const t = this.columns[e.colIndex];
5757
- if (t && W(t) || !this.isCellSelectable(e.rowIndex, e.colIndex) || e.originalEvent.shiftKey && this.cellAnchor)
5755
+ if (!this.isSelectionEnabled() || this.config.mode !== "range" || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0 || e.column && W(e.column) || !this.isCellSelectable(e.rowIndex, e.colIndex) || e.originalEvent.shiftKey && this.cellAnchor)
5758
5756
  return;
5759
5757
  this.isDragging = !0;
5760
- const i = e.rowIndex, n = e.colIndex, r = (e.originalEvent.ctrlKey || e.originalEvent.metaKey) && this.config.multiSelect !== !1, o = {
5761
- startRow: i,
5762
- startCol: n,
5763
- endRow: i,
5764
- endCol: n
5758
+ const t = e.rowIndex, i = e.colIndex, n = (e.originalEvent.ctrlKey || e.originalEvent.metaKey) && this.config.multiSelect !== !1, r = {
5759
+ startRow: t,
5760
+ startCol: i,
5761
+ endRow: t,
5762
+ endCol: i
5765
5763
  };
5766
- return !r && this.ranges.length === 1 && ee(this.ranges[0], o) ? (this.cellAnchor = { row: i, col: n }, !0) : (this.cellAnchor = { row: i, col: n }, r || (this.ranges = []), this.ranges.push(o), this.activeRange = o, this.emit("selection-change", this.#i()), this.requestAfterRender(), !0);
5764
+ return !n && this.ranges.length === 1 && ee(this.ranges[0], r) ? (this.cellAnchor = { row: t, col: i }, !0) : (this.cellAnchor = { row: t, col: i }, n || (this.ranges = []), this.ranges.push(r), this.activeRange = r, this.emit("selection-change", this.#i()), this.requestAfterRender(), !0);
5767
5765
  }
5768
5766
  onCellMouseMove(e) {
5769
5767
  if (!this.isSelectionEnabled() || this.config.mode !== "range" || !this.isDragging || !this.cellAnchor || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
5770
5768
  let t = e.colIndex;
5771
- const i = this.columns[t];
5769
+ const i = this.visibleColumns[t];
5772
5770
  if (i && W(i)) {
5773
- const o = this.columns.findIndex((s) => !W(s));
5771
+ const o = this.visibleColumns.findIndex((s) => !W(s));
5774
5772
  o >= 0 && (t = o);
5775
5773
  }
5776
5774
  const n = ge(this.cellAnchor, { row: e.rowIndex, col: t }), r = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
@@ -5887,7 +5885,7 @@ class Bn extends F {
5887
5885
  e.querySelectorAll(".cell[data-row][data-col]").forEach((d) => {
5888
5886
  const c = parseInt(d.getAttribute("data-row") ?? "-1", 10), u = parseInt(d.getAttribute("data-col") ?? "-1", 10);
5889
5887
  if (c >= 0 && u >= 0) {
5890
- const h = this.columns[u];
5888
+ const h = this.visibleColumns[u];
5891
5889
  if (h && W(h))
5892
5890
  return;
5893
5891
  s(c, u) && (d.classList.add("selected"), s(c - 1, u) || d.classList.add("top"), s(c + 1, u) || d.classList.add("bottom"), s(c, u - 1) || d.classList.add("first"), s(c, u + 1) || d.classList.add("last"));