@toolbox-web/grid 1.18.0 → 1.19.1

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 CHANGED
@@ -69,7 +69,7 @@ function _t(a, e) {
69
69
  }
70
70
  }), e.rows = d;
71
71
  }
72
- class Tn extends F {
72
+ class In extends F {
73
73
  static dependencies = [
74
74
  { name: "selection", required: !1, reason: "Enables copy/paste of selected cells instead of entire grid" }
75
75
  ];
@@ -210,10 +210,10 @@ function ye(a) {
210
210
  const e = parseFloat(a);
211
211
  return isNaN(e) ? Le : e;
212
212
  }
213
- function Te(a) {
213
+ function Ie(a) {
214
214
  return a.map((e) => ye(e.width));
215
215
  }
216
- function Ie(a) {
216
+ function Te(a) {
217
217
  const e = [];
218
218
  let t = 0;
219
219
  for (const i of a)
@@ -227,7 +227,7 @@ function Lt(a, e, t, i, n) {
227
227
  const r = t.length;
228
228
  if (r === 0)
229
229
  return { startCol: 0, endCol: 0, visibleColumns: [] };
230
- let o = Tt(a, t, i);
230
+ let o = It(a, t, i);
231
231
  o = Math.max(0, o - n);
232
232
  const s = a + e;
233
233
  let l = o;
@@ -244,7 +244,7 @@ function Lt(a, e, t, i, n) {
244
244
  d.push(c);
245
245
  return { startCol: o, endCol: l, visibleColumns: d };
246
246
  }
247
- function Tt(a, e, t) {
247
+ function It(a, e, t) {
248
248
  let i = 0, n = e.length - 1;
249
249
  for (; i < n; ) {
250
250
  const r = Math.floor((i + n) / 2);
@@ -252,10 +252,10 @@ function Tt(a, e, t) {
252
252
  }
253
253
  return i;
254
254
  }
255
- function It(a, e, t) {
255
+ function Tt(a, e, t) {
256
256
  return t ? a > e : !1;
257
257
  }
258
- class In extends F {
258
+ class Tn extends F {
259
259
  name = "columnVirtualization";
260
260
  get defaultConfig() {
261
261
  return {
@@ -275,7 +275,7 @@ class In extends F {
275
275
  attach(e) {
276
276
  super.attach(e);
277
277
  const t = this.columns;
278
- this.columnWidths = Te(t), this.columnOffsets = Ie(t), this.totalWidth = Fe(t), this.endCol = t.length - 1;
278
+ this.columnWidths = Ie(t), this.columnOffsets = Te(t), this.totalWidth = Fe(t), this.endCol = t.length - 1;
279
279
  }
280
280
  detach() {
281
281
  this.#t(), this.columnWidths = [], this.columnOffsets = [], this.originalColumns = [], this.isVirtualized = !1, this.startCol = 0, this.endCol = 0, this.scrollLeft = 0, this.totalWidth = 0;
@@ -293,8 +293,8 @@ class In extends F {
293
293
  r && (r.style.minWidth = "");
294
294
  }
295
295
  processColumns(e) {
296
- (this.originalColumns.length === 0 || e.length >= this.originalColumns.length) && (this.originalColumns = e, this.columnWidths = Te(e), this.columnOffsets = Ie(e), this.totalWidth = Fe(e));
297
- const i = this.originalColumns, n = It(
296
+ (this.originalColumns.length === 0 || e.length >= this.originalColumns.length) && (this.originalColumns = e, this.columnWidths = Ie(e), this.columnOffsets = Te(e), this.totalWidth = Fe(e));
297
+ const i = this.originalColumns, n = Tt(
298
298
  i.length,
299
299
  this.config.threshold ?? 30,
300
300
  this.config.autoEnable ?? !0
@@ -1335,12 +1335,12 @@ class Fn extends F {
1335
1335
  let u = !1;
1336
1336
  const h = (b) => {
1337
1337
  if (u || !this.#t && this.#e === -1) return;
1338
- const w = this.grid, T = s ? w._getRowEntry(s) : void 0, R = T?.row ?? e, I = T?.index ?? t;
1339
- this.#E(I, i, b, R);
1338
+ const w = this.grid, I = s ? w._getRowEntry(s) : void 0, R = I?.row ?? e, T = I?.index ?? t;
1339
+ this.#E(T, i, b, R);
1340
1340
  }, f = () => {
1341
1341
  if (u = !0, Z(i.field)) {
1342
- const b = this.grid, T = (s ? b._getRowEntry(s) : void 0)?.row ?? e;
1343
- T[i.field] = d;
1342
+ const b = this.grid, I = (s ? b._getRowEntry(s) : void 0)?.row ?? e;
1343
+ I[i.field] = d;
1344
1344
  }
1345
1345
  }, g = document.createElement("div");
1346
1346
  g.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(g), g.addEventListener("keydown", (b) => {
@@ -1398,11 +1398,11 @@ class Fn extends F {
1398
1398
  updateRow: l,
1399
1399
  onValueChange: _
1400
1400
  }, w = x(b);
1401
- typeof w == "string" ? (g.innerHTML = w, Vt(g, i, h, d), _((T) => {
1401
+ typeof w == "string" ? (g.innerHTML = w, Vt(g, i, h, d), _((I) => {
1402
1402
  const R = g.querySelector(
1403
1403
  "input,textarea,select"
1404
1404
  );
1405
- R && (R instanceof HTMLInputElement && R.type === "checkbox" ? R.checked = !!T : R.value = String(T ?? ""));
1405
+ R && (R instanceof HTMLInputElement && R.type === "checkbox" ? R.checked = !!I : R.value = String(I ?? ""));
1406
1406
  })) : w instanceof Node && (g.appendChild(w), w instanceof HTMLInputElement || w instanceof HTMLSelectElement || w instanceof HTMLTextAreaElement ? _((R) => {
1407
1407
  w instanceof HTMLInputElement && w.type === "checkbox" ? w.checked = !!R : w.value = String(R ?? "");
1408
1408
  }) : r.setAttribute("data-editor-managed", "")), o || queueMicrotask(() => {
@@ -1425,8 +1425,8 @@ class Fn extends F {
1425
1425
  if (x.mount)
1426
1426
  try {
1427
1427
  x.mount({ placeholder: b, context: w, spec: x });
1428
- } catch (T) {
1429
- console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`, T);
1428
+ } catch (I) {
1429
+ console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`, I);
1430
1430
  }
1431
1431
  else
1432
1432
  this.grid.dispatchEvent(
@@ -2216,16 +2216,16 @@ class z extends F {
2216
2216
  },
2217
2217
  { passive: !0 }
2218
2218
  ), w(c.value), e.appendChild(m);
2219
- let T;
2219
+ let I;
2220
2220
  c.addEventListener("input", () => {
2221
- clearTimeout(T), T = setTimeout(() => {
2221
+ clearTimeout(I), I = setTimeout(() => {
2222
2222
  this.searchText.set(r, c.value), w(c.value);
2223
2223
  }, this.config.debounceMs ?? 150);
2224
2224
  });
2225
2225
  const R = document.createElement("div");
2226
2226
  R.className = "tbw-filter-buttons";
2227
- const I = document.createElement("button");
2228
- I.className = "tbw-filter-apply-btn", I.textContent = "Apply", I.addEventListener("click", () => {
2227
+ const T = document.createElement("button");
2228
+ T.className = "tbw-filter-apply-btn", T.textContent = "Apply", T.addEventListener("click", () => {
2229
2229
  const v = [];
2230
2230
  for (const [C, L] of P)
2231
2231
  if (!L)
@@ -2236,7 +2236,7 @@ class z extends F {
2236
2236
  v.push(S !== void 0 ? S : C);
2237
2237
  }
2238
2238
  t.applySetFilter(v);
2239
- }), R.appendChild(I);
2239
+ }), R.appendChild(T);
2240
2240
  const N = document.createElement("button");
2241
2241
  N.className = "tbw-filter-clear-btn", N.textContent = "Clear Filter", N.addEventListener("click", () => {
2242
2242
  t.clearFilter();
@@ -2265,12 +2265,12 @@ class z extends F {
2265
2265
  b.className = "tbw-filter-range-separator", b.textContent = "–", E.appendChild(b);
2266
2266
  const w = document.createElement("div");
2267
2267
  w.className = "tbw-filter-range-group";
2268
- const T = document.createElement("label");
2269
- T.textContent = "Max", T.className = "tbw-filter-range-label";
2268
+ const I = document.createElement("label");
2269
+ I.textContent = "Max", I.className = "tbw-filter-range-label";
2270
2270
  const R = document.createElement("input");
2271
- R.type = "number", R.className = "tbw-filter-range-input", R.min = String(h), R.max = String(f), R.step = String(g), R.value = String(x), w.appendChild(T), w.appendChild(R), E.appendChild(w), e.appendChild(E);
2272
- const I = document.createElement("div");
2273
- I.className = "tbw-filter-range-slider";
2271
+ R.type = "number", R.className = "tbw-filter-range-input", R.min = String(h), R.max = String(f), R.step = String(g), R.value = String(x), w.appendChild(I), w.appendChild(R), E.appendChild(w), e.appendChild(E);
2272
+ const T = document.createElement("div");
2273
+ T.className = "tbw-filter-range-slider";
2274
2274
  const N = document.createElement("div");
2275
2275
  N.className = "tbw-filter-range-track";
2276
2276
  const v = document.createElement("div");
@@ -2278,7 +2278,7 @@ class z extends F {
2278
2278
  const C = document.createElement("input");
2279
2279
  C.type = "range", C.className = "tbw-filter-range-thumb tbw-filter-range-thumb-min", C.min = String(h), C.max = String(f), C.step = String(g), C.value = String(m);
2280
2280
  const L = document.createElement("input");
2281
- L.type = "range", L.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", L.min = String(h), L.max = String(f), L.step = String(g), L.value = String(x), I.appendChild(N), I.appendChild(v), I.appendChild(C), I.appendChild(L), e.appendChild(I);
2281
+ L.type = "range", L.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", L.min = String(h), L.max = String(f), L.step = String(g), L.value = String(x), T.appendChild(N), T.appendChild(v), T.appendChild(C), T.appendChild(L), e.appendChild(T);
2282
2282
  const S = () => {
2283
2283
  const A = parseFloat(C.value), B = parseFloat(L.value), Q = f - h, Re = (A - h) / Q * 100, vt = (B - h) / Q * 100;
2284
2284
  v.style.left = `${Re}%`, v.style.width = `${vt - Re}%`;
@@ -2323,12 +2323,12 @@ class z extends F {
2323
2323
  b.type = "date", b.className = "tbw-filter-date-input", f && (b.min = f), g && (b.max = g), b.value = m, D.appendChild(_), D.appendChild(b), P.appendChild(D);
2324
2324
  const w = document.createElement("span");
2325
2325
  w.className = "tbw-filter-range-separator", w.textContent = "–", P.appendChild(w);
2326
- const T = document.createElement("div");
2327
- T.className = "tbw-filter-date-group";
2326
+ const I = document.createElement("div");
2327
+ I.className = "tbw-filter-date-group";
2328
2328
  const R = document.createElement("label");
2329
2329
  R.textContent = "To", R.className = "tbw-filter-range-label";
2330
- const I = document.createElement("input");
2331
- I.type = "date", I.className = "tbw-filter-date-input", f && (I.min = f), g && (I.max = g), I.value = x, T.appendChild(R), T.appendChild(I), P.appendChild(T), e.appendChild(P);
2330
+ const T = document.createElement("input");
2331
+ T.type = "date", T.className = "tbw-filter-date-input", f && (T.min = f), g && (T.max = g), T.value = x, I.appendChild(R), I.appendChild(T), P.appendChild(I), e.appendChild(P);
2332
2332
  const N = document.createElement("label");
2333
2333
  N.className = "tbw-filter-blank-option";
2334
2334
  const v = document.createElement("input");
@@ -2336,7 +2336,7 @@ class z extends F {
2336
2336
  const C = document.createTextNode("Show only blank");
2337
2337
  N.appendChild(v), N.appendChild(C);
2338
2338
  const L = (y) => {
2339
- b.disabled = y, I.disabled = y, P.classList.toggle("tbw-filter-disabled", y);
2339
+ b.disabled = y, T.disabled = y, P.classList.toggle("tbw-filter-disabled", y);
2340
2340
  };
2341
2341
  L(E), v.addEventListener("change", () => {
2342
2342
  L(v.checked);
@@ -2349,7 +2349,7 @@ class z extends F {
2349
2349
  t.applyTextFilter("blank", "");
2350
2350
  return;
2351
2351
  }
2352
- const y = b.value, A = I.value;
2352
+ const y = b.value, A = T.value;
2353
2353
  y && A ? t.applyTextFilter("between", y, A) : y ? t.applyTextFilter("greaterThanOrEqual", y) : A ? t.applyTextFilter("lessThanOrEqual", A) : t.clearFilter();
2354
2354
  }), S.appendChild(k);
2355
2355
  const M = document.createElement("button");
@@ -3694,7 +3694,7 @@ function he(a, e) {
3694
3694
  }
3695
3695
  if (a.customPanels)
3696
3696
  for (const o of a.customPanels) {
3697
- const s = Ii(o, e);
3697
+ const s = Ti(o, e);
3698
3698
  switch (o.position) {
3699
3699
  case "left":
3700
3700
  i.appendChild(s);
@@ -3728,7 +3728,7 @@ function _i(a, e, t, i) {
3728
3728
  const s = document.createElement("span");
3729
3729
  s.className = "tbw-aggregation-label", s.textContent = r, n.appendChild(s);
3730
3730
  }
3731
- const o = Ti(e, t, i);
3731
+ const o = Ii(e, t, i);
3732
3732
  o && n.appendChild(o), a.appendChild(n);
3733
3733
  }
3734
3734
  function Li(a, e, t, i) {
@@ -3756,7 +3756,7 @@ function gt(a, e, t) {
3756
3756
  }
3757
3757
  return { value: i, formatter: n };
3758
3758
  }
3759
- function Ti(a, e, t) {
3759
+ function Ii(a, e, t) {
3760
3760
  const i = a.aggregators && Object.keys(a.aggregators).length > 0, n = a.cells && Object.keys(a.cells).length > 0;
3761
3761
  if (!i && !n) return null;
3762
3762
  const r = document.createElement("span");
@@ -3772,7 +3772,7 @@ function Ti(a, e, t) {
3772
3772
  }
3773
3773
  return r.children.length > 0 ? r : null;
3774
3774
  }
3775
- function Ii(a, e) {
3775
+ function Ti(a, e) {
3776
3776
  const t = document.createElement("div");
3777
3777
  t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${a.id}`;
3778
3778
  const i = a.render(e);
@@ -5575,7 +5575,8 @@ class Bn extends F {
5575
5575
  queries: [
5576
5576
  { type: "getSelection", description: "Get the current selection state" },
5577
5577
  { type: "selectRows", description: "Select specific rows by index (row mode only)" },
5578
- { type: "getSelectedRowIndices", description: "Get sorted array of selected row indices" }
5578
+ { type: "getSelectedRowIndices", description: "Get sorted array of selected row indices" },
5579
+ { type: "getSelectedRows", description: "Get actual row objects for the current selection (works in all modes)" }
5579
5580
  ],
5580
5581
  configRules: [
5581
5582
  {
@@ -5594,7 +5595,8 @@ class Bn extends F {
5594
5595
  return {
5595
5596
  mode: "cell",
5596
5597
  triggerOn: "click",
5597
- enabled: !0
5598
+ enabled: !0,
5599
+ multiSelect: !0
5598
5600
  };
5599
5601
  }
5600
5602
  selected = /* @__PURE__ */ new Set();
@@ -5634,6 +5636,8 @@ class Bn extends F {
5634
5636
  return this.getSelection();
5635
5637
  if (e.type === "getSelectedRowIndices")
5636
5638
  return this.getSelectedRowIndices();
5639
+ if (e.type === "getSelectedRows")
5640
+ return this.getSelectedRows();
5637
5641
  if (e.type === "selectRows")
5638
5642
  return this.selectRows(e.context), !0;
5639
5643
  }
@@ -5658,13 +5662,13 @@ class Bn extends F {
5658
5662
  if (r === "row") {
5659
5663
  if (!this.isRowSelectable(t))
5660
5664
  return !1;
5661
- const d = n.shiftKey, c = n.ctrlKey || n.metaKey, u = s?.meta?.checkboxColumn === !0;
5662
- if (d && this.anchor !== null) {
5663
- const h = Math.min(this.anchor, t), f = Math.max(this.anchor, t);
5664
- c || this.selected.clear();
5665
- for (let g = h; g <= f; g++)
5666
- this.isRowSelectable(g) && this.selected.add(g);
5667
- } else if (c || u)
5665
+ const d = this.config.multiSelect !== !1, c = n.shiftKey && d, u = (n.ctrlKey || n.metaKey) && d, h = s?.meta?.checkboxColumn === !0;
5666
+ if (c && this.anchor !== null) {
5667
+ const f = Math.min(this.anchor, t), g = Math.max(this.anchor, t);
5668
+ u || this.selected.clear();
5669
+ for (let p = f; p <= g; p++)
5670
+ this.isRowSelectable(p) && this.selected.add(p);
5671
+ } else if (u || h && d)
5668
5672
  this.selected.has(t) ? this.selected.delete(t) : this.selected.add(t), this.anchor = t;
5669
5673
  else {
5670
5674
  if (this.selected.size === 1 && this.selected.has(t))
@@ -5676,7 +5680,7 @@ class Bn extends F {
5676
5680
  if (r === "range") {
5677
5681
  if (l || !this.isCellSelectable(t, i))
5678
5682
  return !1;
5679
- const d = n.shiftKey, c = n.ctrlKey || n.metaKey;
5683
+ const d = n.shiftKey, c = (n.ctrlKey || n.metaKey) && this.config.multiSelect !== !1;
5680
5684
  if (d && this.cellAnchor) {
5681
5685
  const u = ge(this.cellAnchor, { row: t, col: i }), h = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
5682
5686
  if (h && ee(h, u))
@@ -5716,28 +5720,29 @@ class Bn extends F {
5716
5720
  this.isCellSelectable(r, o) ? this.selectedCell = { row: r, col: o } : this.selectedCell = null, this.emit("selection-change", this.#i()), this.requestAfterRender();
5717
5721
  }), !1;
5718
5722
  if (t === "row") {
5723
+ const r = this.config.multiSelect !== !1;
5719
5724
  if (e.key === "ArrowUp" || e.key === "ArrowDown") {
5720
- const r = e.shiftKey;
5721
- return r && this.anchor === null && (this.anchor = this.grid._focusRow), queueMicrotask(() => {
5722
- const o = this.grid._focusRow;
5723
- if (r && this.anchor !== null) {
5725
+ const o = e.shiftKey && r;
5726
+ return o && this.anchor === null && (this.anchor = this.grid._focusRow), queueMicrotask(() => {
5727
+ const s = this.grid._focusRow;
5728
+ if (o && this.anchor !== null) {
5724
5729
  this.selected.clear();
5725
- const s = Math.min(this.anchor, o), l = Math.max(this.anchor, o);
5726
- for (let d = s; d <= l; d++)
5727
- this.isRowSelectable(d) && this.selected.add(d);
5730
+ const l = Math.min(this.anchor, s), d = Math.max(this.anchor, s);
5731
+ for (let c = l; c <= d; c++)
5732
+ this.isRowSelectable(c) && this.selected.add(c);
5728
5733
  } else
5729
- this.isRowSelectable(o) ? (this.selected.clear(), this.selected.add(o), this.anchor = o) : this.selected.clear();
5730
- this.lastSelected = o, this.explicitSelection = !0, this.emit("selection-change", this.#i()), this.requestAfterRender();
5734
+ this.isRowSelectable(s) ? (this.selected.clear(), this.selected.add(s), this.anchor = s) : this.selected.clear();
5735
+ this.lastSelected = s, this.explicitSelection = !0, this.emit("selection-change", this.#i()), this.requestAfterRender();
5731
5736
  }), !1;
5732
5737
  }
5733
- if (e.key === "a" && (e.ctrlKey || e.metaKey))
5738
+ if (r && e.key === "a" && (e.ctrlKey || e.metaKey))
5734
5739
  return this.grid.query("isEditing").some(Boolean) ? !1 : (e.preventDefault(), e.stopPropagation(), this.selectAll(), !0);
5735
5740
  }
5736
5741
  if (t === "range" && n) {
5737
5742
  const r = e.key === "Tab", o = e.shiftKey && !r;
5738
5743
  return o && !this.cellAnchor && (this.cellAnchor = { row: this.grid._focusRow, col: this.grid._focusCol }), this.pendingKeyboardUpdate = { shiftKey: o }, queueMicrotask(() => this.requestAfterRender()), !1;
5739
5744
  }
5740
- return t === "range" && e.key === "a" && (e.ctrlKey || e.metaKey) ? this.grid.query("isEditing").some(Boolean) ? !1 : (e.preventDefault(), e.stopPropagation(), this.selectAll(), !0) : !1;
5745
+ 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;
5741
5746
  }
5742
5747
  onCellMouseDown(e) {
5743
5748
  if (!this.isSelectionEnabled() || this.config.mode !== "range" || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
@@ -5745,7 +5750,7 @@ class Bn extends F {
5745
5750
  if (t && W(t) || !this.isCellSelectable(e.rowIndex, e.colIndex) || e.originalEvent.shiftKey && this.cellAnchor)
5746
5751
  return;
5747
5752
  this.isDragging = !0;
5748
- const i = e.rowIndex, n = e.colIndex, r = e.originalEvent.ctrlKey || e.originalEvent.metaKey, o = {
5753
+ const i = e.rowIndex, n = e.colIndex, r = (e.originalEvent.ctrlKey || e.originalEvent.metaKey) && this.config.multiSelect !== !1, o = {
5749
5754
  startRow: i,
5750
5755
  startCol: n,
5751
5756
  endRow: i,
@@ -5792,7 +5797,7 @@ class Bn extends F {
5792
5797
  },
5793
5798
  headerRenderer: () => {
5794
5799
  const e = document.createElement("div");
5795
- e.className = "tbw-checkbox-header";
5800
+ if (e.className = "tbw-checkbox-header", this.config.multiSelect === !1) return e;
5796
5801
  const t = document.createElement("input");
5797
5802
  return t.type = "checkbox", t.className = "tbw-select-all-checkbox", t.addEventListener("click", (i) => {
5798
5803
  i.stopPropagation(), i.target.checked ? this.selectAll() : this.clearSelection();
@@ -5917,36 +5922,57 @@ class Bn extends F {
5917
5922
  return cn(e, t, this.ranges);
5918
5923
  }
5919
5924
  selectAll() {
5920
- const { mode: e } = this.config;
5921
- if (e === "row") {
5922
- this.selected.clear();
5923
- for (let t = 0; t < this.rows.length; t++)
5924
- this.isRowSelectable(t) && this.selected.add(t);
5925
- this.explicitSelection = !0, this.emit("selection-change", this.#i()), this.requestAfterRender();
5926
- } else if (e === "range") {
5927
- const t = this.rows.length, i = this.columns.length;
5928
- if (t > 0 && i > 0) {
5929
- const n = {
5930
- startRow: 0,
5931
- startCol: 0,
5932
- endRow: t - 1,
5933
- endCol: i - 1
5934
- };
5935
- this.ranges = [n], this.activeRange = n, this.emit("selection-change", this.#i()), this.requestAfterRender();
5925
+ const { mode: e, multiSelect: t } = this.config;
5926
+ if (t !== !1) {
5927
+ if (e === "row") {
5928
+ this.selected.clear();
5929
+ for (let i = 0; i < this.rows.length; i++)
5930
+ this.isRowSelectable(i) && this.selected.add(i);
5931
+ this.explicitSelection = !0, this.emit("selection-change", this.#i()), this.requestAfterRender();
5932
+ } else if (e === "range") {
5933
+ const i = this.rows.length, n = this.columns.length;
5934
+ if (i > 0 && n > 0) {
5935
+ const r = {
5936
+ startRow: 0,
5937
+ startCol: 0,
5938
+ endRow: i - 1,
5939
+ endCol: n - 1
5940
+ };
5941
+ this.ranges = [r], this.activeRange = r, this.emit("selection-change", this.#i()), this.requestAfterRender();
5942
+ }
5936
5943
  }
5937
5944
  }
5938
5945
  }
5939
5946
  selectRows(e) {
5940
- if (this.config.mode === "row") {
5941
- this.selected.clear();
5942
- for (const t of e)
5943
- t >= 0 && t < this.rows.length && this.isRowSelectable(t) && this.selected.add(t);
5944
- this.anchor = e.length > 0 ? e[e.length - 1] : null, this.explicitSelection = !0, this.emit("selection-change", this.#i()), this.requestAfterRender();
5945
- }
5947
+ if (this.config.mode !== "row") return;
5948
+ const t = this.config.multiSelect === !1 && e.length > 1 ? [e[e.length - 1]] : e;
5949
+ this.selected.clear();
5950
+ for (const i of t)
5951
+ i >= 0 && i < this.rows.length && this.isRowSelectable(i) && this.selected.add(i);
5952
+ this.anchor = t.length > 0 ? t[t.length - 1] : null, this.explicitSelection = !0, this.emit("selection-change", this.#i()), this.requestAfterRender();
5946
5953
  }
5947
5954
  getSelectedRowIndices() {
5948
5955
  return [...this.selected].sort((e, t) => e - t);
5949
5956
  }
5957
+ getSelectedRows() {
5958
+ const { mode: e } = this.config, t = this.rows;
5959
+ if (e === "row")
5960
+ return this.getSelectedRowIndices().filter((i) => i >= 0 && i < t.length).map((i) => t[i]);
5961
+ if (e === "cell" && this.selectedCell) {
5962
+ const { row: i } = this.selectedCell;
5963
+ return i >= 0 && i < t.length ? [t[i]] : [];
5964
+ }
5965
+ if (e === "range" && this.ranges.length > 0) {
5966
+ const i = /* @__PURE__ */ new Set();
5967
+ for (const n of this.ranges) {
5968
+ const r = Math.max(0, Math.min(n.startRow, n.endRow)), o = Math.min(t.length - 1, Math.max(n.startRow, n.endRow));
5969
+ for (let s = r; s <= o; s++)
5970
+ i.add(s);
5971
+ }
5972
+ return [...i].sort((n, r) => n - r).map((n) => t[n]);
5973
+ }
5974
+ return [];
5975
+ }
5950
5976
  clearSelection() {
5951
5977
  this.selectedCell = null, this.selected.clear(), this.anchor = null, this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.emit("selection-change", { mode: this.config.mode, ranges: [] }), this.requestAfterRender();
5952
5978
  }
@@ -6766,8 +6792,8 @@ class U extends F {
6766
6792
  export {
6767
6793
  re as BLANK_FILTER_VALUE,
6768
6794
  F as BaseGridPlugin,
6769
- Tn as ClipboardPlugin,
6770
- In as ColumnVirtualizationPlugin,
6795
+ In as ClipboardPlugin,
6796
+ Tn as ColumnVirtualizationPlugin,
6771
6797
  dt as ContextMenuPlugin,
6772
6798
  Yn as DEFAULT_ANIMATION_CONFIG,
6773
6799
  yt as DEFAULT_GRID_ICONS,