@toolbox-web/grid 1.19.0 → 1.19.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 (50) hide show
  1. package/all.js +97 -86
  2. package/all.js.map +1 -1
  3. package/index.js +367 -341
  4. package/index.js.map +1 -1
  5. package/lib/core/grid.d.ts.map +1 -1
  6. package/lib/core/internal/rows.d.ts.map +1 -1
  7. package/lib/core/internal/utils.d.ts +2 -2
  8. package/lib/core/internal/utils.d.ts.map +1 -1
  9. package/lib/core/plugin/types.d.ts +0 -2
  10. package/lib/core/plugin/types.d.ts.map +1 -1
  11. package/lib/core/types.d.ts +11 -0
  12. package/lib/core/types.d.ts.map +1 -1
  13. package/lib/plugins/clipboard/index.js.map +1 -1
  14. package/lib/plugins/column-virtualization/index.js.map +1 -1
  15. package/lib/plugins/context-menu/index.js.map +1 -1
  16. package/lib/plugins/editing/index.js.map +1 -1
  17. package/lib/plugins/export/index.js.map +1 -1
  18. package/lib/plugins/filtering/index.js.map +1 -1
  19. package/lib/plugins/grouping-columns/index.js.map +1 -1
  20. package/lib/plugins/grouping-rows/index.js.map +1 -1
  21. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -1
  22. package/lib/plugins/master-detail/index.js +62 -55
  23. package/lib/plugins/master-detail/index.js.map +1 -1
  24. package/lib/plugins/multi-sort/index.js.map +1 -1
  25. package/lib/plugins/pinned-columns/index.js.map +1 -1
  26. package/lib/plugins/pinned-rows/index.js.map +1 -1
  27. package/lib/plugins/pivot/index.js.map +1 -1
  28. package/lib/plugins/print/index.js.map +1 -1
  29. package/lib/plugins/reorder/index.js.map +1 -1
  30. package/lib/plugins/responsive/index.js.map +1 -1
  31. package/lib/plugins/row-reorder/index.js.map +1 -1
  32. package/lib/plugins/selection/SelectionPlugin.d.ts +3 -0
  33. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
  34. package/lib/plugins/selection/index.js +179 -175
  35. package/lib/plugins/selection/index.js.map +1 -1
  36. package/lib/plugins/selection/types.d.ts +26 -0
  37. package/lib/plugins/selection/types.d.ts.map +1 -1
  38. package/lib/plugins/server-side/index.js.map +1 -1
  39. package/lib/plugins/tree/index.js.map +1 -1
  40. package/lib/plugins/undo-redo/index.js.map +1 -1
  41. package/lib/plugins/visibility/index.js.map +1 -1
  42. package/package.json +1 -1
  43. package/umd/grid.all.umd.js +24 -24
  44. package/umd/grid.all.umd.js.map +1 -1
  45. package/umd/grid.umd.js +11 -11
  46. package/umd/grid.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 +2 -2
  50. package/umd/plugins/selection.umd.js.map +1 -1
package/all.js CHANGED
@@ -113,8 +113,8 @@ class In extends F {
113
113
  e.preventDefault();
114
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;
115
115
  for (let m = 0; m < g && s + m <= c; m++) {
116
- const x = this.columns[s + m];
117
- x && !x.hidden && f.push(x.field);
116
+ const y = this.columns[s + m];
117
+ y && !y.hidden && 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);
@@ -1365,28 +1365,28 @@ class Fn extends F {
1365
1365
  b.stopPropagation(), b.preventDefault(), f(), this.#h(t, !0);
1366
1366
  }
1367
1367
  });
1368
- const p = i, m = p.__editorTemplate, x = zt(this.grid, p) ?? Kt(i), E = d, P = `${t}:${i.field}`, D = [];
1368
+ const p = i, m = p.__editorTemplate, y = zt(this.grid, p) ?? Kt(i), E = d, P = `${t}:${i.field}`, D = [];
1369
1369
  this.#f.set(P, (b) => {
1370
1370
  for (const w of D) w(b);
1371
1371
  });
1372
1372
  const _ = (b) => {
1373
1373
  D.push(b);
1374
1374
  };
1375
- if (x === "template" && m)
1375
+ if (y === "template" && m)
1376
1376
  this.#R(g, p, e, d, h, f, o, t), _((b) => {
1377
1377
  const w = g.querySelector(
1378
1378
  "input,textarea,select"
1379
1379
  );
1380
1380
  w && (w instanceof HTMLInputElement && w.type === "checkbox" ? w.checked = !!b : w.value = String(b ?? ""));
1381
1381
  });
1382
- else if (typeof x == "string") {
1383
- const b = document.createElement(x);
1382
+ else if (typeof y == "string") {
1383
+ const b = document.createElement(y);
1384
1384
  b.value = E, b.addEventListener("change", () => h(b.value)), _((w) => {
1385
1385
  b.value = w;
1386
1386
  }), g.appendChild(b), o || queueMicrotask(() => {
1387
1387
  g.querySelector(G)?.focus({ preventScroll: !0 });
1388
1388
  });
1389
- } else if (typeof x == "function") {
1389
+ } else if (typeof y == "function") {
1390
1390
  const b = {
1391
1391
  row: e,
1392
1392
  rowId: s ?? "",
@@ -1397,7 +1397,7 @@ class Fn extends F {
1397
1397
  cancel: f,
1398
1398
  updateRow: l,
1399
1399
  onValueChange: _
1400
- }, w = x(b);
1400
+ }, w = y(b);
1401
1401
  typeof w == "string" ? (g.innerHTML = w, Vt(g, i, h, d), _((I) => {
1402
1402
  const R = g.querySelector(
1403
1403
  "input,textarea,select"
@@ -1408,7 +1408,7 @@ class Fn extends F {
1408
1408
  }) : r.setAttribute("data-editor-managed", "")), o || queueMicrotask(() => {
1409
1409
  g.querySelector(G)?.focus({ preventScroll: !0 });
1410
1410
  });
1411
- } else if (x && typeof x == "object") {
1411
+ } else if (y && typeof y == "object") {
1412
1412
  const b = document.createElement("div");
1413
1413
  b.setAttribute("data-external-editor", ""), b.setAttribute("data-field", i.field), g.appendChild(b), r.setAttribute("data-editor-managed", "");
1414
1414
  const w = {
@@ -1422,15 +1422,15 @@ class Fn extends F {
1422
1422
  updateRow: l,
1423
1423
  onValueChange: _
1424
1424
  };
1425
- if (x.mount)
1425
+ if (y.mount)
1426
1426
  try {
1427
- x.mount({ placeholder: b, context: w, spec: x });
1427
+ y.mount({ placeholder: b, context: w, spec: y });
1428
1428
  } catch (I) {
1429
1429
  console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`, I);
1430
1430
  }
1431
1431
  else
1432
1432
  this.grid.dispatchEvent(
1433
- new CustomEvent("mount-external-editor", { detail: { placeholder: b, spec: x, context: w } })
1433
+ new CustomEvent("mount-external-editor", { detail: { placeholder: b, spec: y, context: w } })
1434
1434
  );
1435
1435
  }
1436
1436
  }
@@ -2159,8 +2159,8 @@ class z extends F {
2159
2159
  }), e.appendChild(u);
2160
2160
  const m = document.createElement("div");
2161
2161
  m.className = "tbw-filter-values";
2162
- const x = document.createElement("div");
2163
- x.className = "tbw-filter-values-spacer", m.appendChild(x);
2162
+ const y = document.createElement("div");
2163
+ y.className = "tbw-filter-values-spacer", m.appendChild(y);
2164
2164
  const E = document.createElement("div");
2165
2165
  E.className = "tbw-filter-values-content", m.appendChild(E);
2166
2166
  const P = /* @__PURE__ */ new Map();
@@ -2176,11 +2176,11 @@ class z extends F {
2176
2176
  M.type = "checkbox", M.className = "tbw-filter-checkbox", M.checked = P.get(S) ?? !0, M.dataset.value = S, M.addEventListener("change", () => {
2177
2177
  P.set(S, M.checked), p();
2178
2178
  });
2179
- const y = document.createElement("span");
2180
- return y.textContent = L, k.appendChild(M), k.appendChild(y), k;
2179
+ const x = document.createElement("span");
2180
+ return x.textContent = L, k.appendChild(M), k.appendChild(x), k;
2181
2181
  }, b = () => {
2182
2182
  const v = D.length, C = m.clientHeight, L = m.scrollTop;
2183
- if (x.style.height = `${v * s}px`, xt(v, z.LIST_BYPASS_THRESHOLD / 3)) {
2183
+ if (y.style.height = `${v * s}px`, xt(v, z.LIST_BYPASS_THRESHOLD / 3)) {
2184
2184
  E.innerHTML = "", E.style.transform = "translateY(0px)", D.forEach((k, M) => {
2185
2185
  E.appendChild(_(k, M));
2186
2186
  });
@@ -2202,7 +2202,7 @@ class z extends F {
2202
2202
  const k = l(S), M = C ? k : k.toLowerCase();
2203
2203
  return !v || M.includes(L);
2204
2204
  }), D.length === 0) {
2205
- x.style.height = "0px", E.innerHTML = "";
2205
+ y.style.height = "0px", E.innerHTML = "";
2206
2206
  const S = document.createElement("div");
2207
2207
  S.className = "tbw-filter-no-match", S.textContent = "No matching values", E.appendChild(S);
2208
2208
  return;
@@ -2251,8 +2251,8 @@ class z extends F {
2251
2251
  }
2252
2252
  return B;
2253
2253
  }, d = i.filter((A) => typeof A == "number" && !isNaN(A)), c = d.length > 0 ? Math.min(...d) : 0, u = d.length > 0 ? Math.max(...d) : 100, h = l(o?.min ?? s?.min, c), f = l(o?.max ?? s?.max, u), g = o?.step ?? s?.step ?? 1, p = this.filters.get(n);
2254
- let m = h, x = f;
2255
- p?.operator === "between" ? (m = l(p.value, h), x = l(p.valueTo, f)) : p?.operator === "greaterThanOrEqual" ? m = l(p.value, h) : p?.operator === "lessThanOrEqual" && (x = l(p.value, f));
2254
+ let m = h, y = f;
2255
+ p?.operator === "between" ? (m = l(p.value, h), y = l(p.valueTo, f)) : p?.operator === "greaterThanOrEqual" ? m = l(p.value, h) : p?.operator === "lessThanOrEqual" && (y = l(p.value, f));
2256
2256
  const E = document.createElement("div");
2257
2257
  E.className = "tbw-filter-range-inputs";
2258
2258
  const P = document.createElement("div");
@@ -2268,7 +2268,7 @@ class z extends F {
2268
2268
  const I = document.createElement("label");
2269
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(I), w.appendChild(R), E.appendChild(w), e.appendChild(E);
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(y), w.appendChild(I), w.appendChild(R), E.appendChild(w), e.appendChild(E);
2272
2272
  const T = document.createElement("div");
2273
2273
  T.className = "tbw-filter-range-slider";
2274
2274
  const N = 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), T.appendChild(N), T.appendChild(v), T.appendChild(C), T.appendChild(L), e.appendChild(T);
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(y), 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}%`;
@@ -2303,16 +2303,16 @@ class z extends F {
2303
2303
  const A = parseFloat(_.value), B = parseFloat(R.value);
2304
2304
  t.applyTextFilter("between", A, B);
2305
2305
  }), k.appendChild(M);
2306
- const y = document.createElement("button");
2307
- y.className = "tbw-filter-clear-btn", y.textContent = "Clear Filter", y.addEventListener("click", () => {
2306
+ const x = document.createElement("button");
2307
+ x.className = "tbw-filter-clear-btn", x.textContent = "Clear Filter", x.addEventListener("click", () => {
2308
2308
  t.clearFilter();
2309
- }), k.appendChild(y), e.appendChild(k);
2309
+ }), k.appendChild(x), e.appendChild(k);
2310
2310
  }
2311
2311
  renderDateFilterPanel(e, t, i) {
2312
- const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = i.filter((y) => y instanceof Date || typeof y == "string" && !isNaN(Date.parse(y))).map((y) => y instanceof Date ? y : new Date(y)).filter((y) => !isNaN(y.getTime())), d = l.length > 0 ? new Date(Math.min(...l.map((y) => y.getTime()))) : null, c = l.length > 0 ? new Date(Math.max(...l.map((y) => y.getTime()))) : null, u = (y) => y ? y.toISOString().split("T")[0] : "", h = (y) => y ? typeof y == "string" ? y : typeof y == "number" ? u(new Date(y)) : "" : "", f = h(o?.min) || h(s?.min) || u(d), g = h(o?.max) || h(s?.max) || u(c), p = this.filters.get(n);
2313
- let m = "", x = "";
2312
+ const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = i.filter((x) => x instanceof Date || typeof x == "string" && !isNaN(Date.parse(x))).map((x) => x instanceof Date ? x : new Date(x)).filter((x) => !isNaN(x.getTime())), d = l.length > 0 ? new Date(Math.min(...l.map((x) => x.getTime()))) : null, c = l.length > 0 ? new Date(Math.max(...l.map((x) => x.getTime()))) : null, u = (x) => x ? x.toISOString().split("T")[0] : "", h = (x) => x ? typeof x == "string" ? x : typeof x == "number" ? u(new Date(x)) : "" : "", f = h(o?.min) || h(s?.min) || u(d), g = h(o?.max) || h(s?.max) || u(c), p = this.filters.get(n);
2313
+ let m = "", y = "";
2314
2314
  const E = p?.operator === "blank";
2315
- p?.operator === "between" ? (m = h(p.value) || "", x = h(p.valueTo) || "") : p?.operator === "greaterThanOrEqual" ? m = h(p.value) || "" : p?.operator === "lessThanOrEqual" && (x = h(p.value) || "");
2315
+ p?.operator === "between" ? (m = h(p.value) || "", y = h(p.valueTo) || "") : p?.operator === "greaterThanOrEqual" ? m = h(p.value) || "" : p?.operator === "lessThanOrEqual" && (y = h(p.value) || "");
2316
2316
  const P = document.createElement("div");
2317
2317
  P.className = "tbw-filter-date-range";
2318
2318
  const D = document.createElement("div");
@@ -2328,15 +2328,15 @@ class z extends F {
2328
2328
  const R = document.createElement("label");
2329
2329
  R.textContent = "To", R.className = "tbw-filter-range-label";
2330
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);
2331
+ T.type = "date", T.className = "tbw-filter-date-input", f && (T.min = f), g && (T.max = g), T.value = y, 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");
2335
2335
  v.type = "checkbox", v.className = "tbw-filter-blank-checkbox", v.checked = E;
2336
2336
  const C = document.createTextNode("Show only blank");
2337
2337
  N.appendChild(v), N.appendChild(C);
2338
- const L = (y) => {
2339
- b.disabled = y, T.disabled = y, P.classList.toggle("tbw-filter-disabled", y);
2338
+ const L = (x) => {
2339
+ b.disabled = x, T.disabled = x, P.classList.toggle("tbw-filter-disabled", x);
2340
2340
  };
2341
2341
  L(E), v.addEventListener("change", () => {
2342
2342
  L(v.checked);
@@ -2349,8 +2349,8 @@ class z extends F {
2349
2349
  t.applyTextFilter("blank", "");
2350
2350
  return;
2351
2351
  }
2352
- const y = b.value, A = T.value;
2353
- y && A ? t.applyTextFilter("between", y, A) : y ? t.applyTextFilter("greaterThanOrEqual", y) : A ? t.applyTextFilter("lessThanOrEqual", A) : t.clearFilter();
2352
+ const x = b.value, A = T.value;
2353
+ x && A ? t.applyTextFilter("between", x, A) : x ? t.applyTextFilter("greaterThanOrEqual", x) : A ? t.applyTextFilter("lessThanOrEqual", A) : t.clearFilter();
2354
2354
  }), S.appendChild(k);
2355
2355
  const M = document.createElement("button");
2356
2356
  M.className = "tbw-filter-clear-btn", M.textContent = "Clear Filter", M.addEventListener("click", () => {
@@ -3214,7 +3214,14 @@ class ut extends F {
3214
3214
  }
3215
3215
  for (const [c, u] of this.detailElements) {
3216
3216
  const h = this.rows.indexOf(c), f = this.expandedRows.has(c), g = h >= 0 && d.has(h);
3217
- (!f || !g) && (u.parentNode && u.remove(), this.detailElements.delete(c));
3217
+ if (!f || !g) {
3218
+ const p = this.grid.__frameworkAdapter;
3219
+ if (p?.unmount) {
3220
+ const y = u.querySelector(".master-detail-cell")?.firstElementChild;
3221
+ y && p.unmount(y);
3222
+ }
3223
+ u.parentNode && u.remove(), this.detailElements.delete(c);
3224
+ }
3218
3225
  }
3219
3226
  for (const [c, u] of d) {
3220
3227
  const h = this.rows[c];
@@ -3956,8 +3963,8 @@ function pt(a, e, t, i, n, r, o) {
3956
3963
  const l = e[0], d = e.slice(1), c = d.length > 0, u = Ni(a, l);
3957
3964
  for (const [h, f] of u) {
3958
3965
  const g = o ? `${o}|${h}` : h, p = Qe(f, t, i, n), m = Ze(p);
3959
- let x;
3960
- c && (x = pt(
3966
+ let y;
3967
+ c && (y = pt(
3961
3968
  f,
3962
3969
  d,
3963
3970
  t,
@@ -3972,7 +3979,7 @@ function pt(a, e, t, i, n, r, o) {
3972
3979
  values: p,
3973
3980
  total: m,
3974
3981
  isGroup: c,
3975
- children: x,
3982
+ children: y,
3976
3983
  rowCount: f.length
3977
3984
  });
3978
3985
  }
@@ -5595,7 +5602,8 @@ class Bn extends F {
5595
5602
  return {
5596
5603
  mode: "cell",
5597
5604
  triggerOn: "click",
5598
- enabled: !0
5605
+ enabled: !0,
5606
+ multiSelect: !0
5599
5607
  };
5600
5608
  }
5601
5609
  selected = /* @__PURE__ */ new Set();
@@ -5661,13 +5669,13 @@ class Bn extends F {
5661
5669
  if (r === "row") {
5662
5670
  if (!this.isRowSelectable(t))
5663
5671
  return !1;
5664
- const d = n.shiftKey, c = n.ctrlKey || n.metaKey, u = s?.meta?.checkboxColumn === !0;
5665
- if (d && this.anchor !== null) {
5666
- const h = Math.min(this.anchor, t), f = Math.max(this.anchor, t);
5667
- c || this.selected.clear();
5668
- for (let g = h; g <= f; g++)
5669
- this.isRowSelectable(g) && this.selected.add(g);
5670
- } else if (c || u)
5672
+ const d = this.config.multiSelect !== !1, c = n.shiftKey && d, u = (n.ctrlKey || n.metaKey) && d, h = s?.meta?.checkboxColumn === !0;
5673
+ if (c && this.anchor !== null) {
5674
+ const f = Math.min(this.anchor, t), g = Math.max(this.anchor, t);
5675
+ u || this.selected.clear();
5676
+ for (let p = f; p <= g; p++)
5677
+ this.isRowSelectable(p) && this.selected.add(p);
5678
+ } else if (u || h && d)
5671
5679
  this.selected.has(t) ? this.selected.delete(t) : this.selected.add(t), this.anchor = t;
5672
5680
  else {
5673
5681
  if (this.selected.size === 1 && this.selected.has(t))
@@ -5679,7 +5687,7 @@ class Bn extends F {
5679
5687
  if (r === "range") {
5680
5688
  if (l || !this.isCellSelectable(t, i))
5681
5689
  return !1;
5682
- const d = n.shiftKey, c = n.ctrlKey || n.metaKey;
5690
+ const d = n.shiftKey, c = (n.ctrlKey || n.metaKey) && this.config.multiSelect !== !1;
5683
5691
  if (d && this.cellAnchor) {
5684
5692
  const u = ge(this.cellAnchor, { row: t, col: i }), h = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
5685
5693
  if (h && ee(h, u))
@@ -5719,28 +5727,29 @@ class Bn extends F {
5719
5727
  this.isCellSelectable(r, o) ? this.selectedCell = { row: r, col: o } : this.selectedCell = null, this.emit("selection-change", this.#i()), this.requestAfterRender();
5720
5728
  }), !1;
5721
5729
  if (t === "row") {
5730
+ const r = this.config.multiSelect !== !1;
5722
5731
  if (e.key === "ArrowUp" || e.key === "ArrowDown") {
5723
- const r = e.shiftKey;
5724
- return r && this.anchor === null && (this.anchor = this.grid._focusRow), queueMicrotask(() => {
5725
- const o = this.grid._focusRow;
5726
- if (r && this.anchor !== null) {
5732
+ const o = e.shiftKey && r;
5733
+ return o && this.anchor === null && (this.anchor = this.grid._focusRow), queueMicrotask(() => {
5734
+ const s = this.grid._focusRow;
5735
+ if (o && this.anchor !== null) {
5727
5736
  this.selected.clear();
5728
- const s = Math.min(this.anchor, o), l = Math.max(this.anchor, o);
5729
- for (let d = s; d <= l; d++)
5730
- this.isRowSelectable(d) && this.selected.add(d);
5737
+ const l = Math.min(this.anchor, s), d = Math.max(this.anchor, s);
5738
+ for (let c = l; c <= d; c++)
5739
+ this.isRowSelectable(c) && this.selected.add(c);
5731
5740
  } else
5732
- this.isRowSelectable(o) ? (this.selected.clear(), this.selected.add(o), this.anchor = o) : this.selected.clear();
5733
- this.lastSelected = o, this.explicitSelection = !0, this.emit("selection-change", this.#i()), this.requestAfterRender();
5741
+ this.isRowSelectable(s) ? (this.selected.clear(), this.selected.add(s), this.anchor = s) : this.selected.clear();
5742
+ this.lastSelected = s, this.explicitSelection = !0, this.emit("selection-change", this.#i()), this.requestAfterRender();
5734
5743
  }), !1;
5735
5744
  }
5736
- if (e.key === "a" && (e.ctrlKey || e.metaKey))
5745
+ if (r && e.key === "a" && (e.ctrlKey || e.metaKey))
5737
5746
  return this.grid.query("isEditing").some(Boolean) ? !1 : (e.preventDefault(), e.stopPropagation(), this.selectAll(), !0);
5738
5747
  }
5739
5748
  if (t === "range" && n) {
5740
5749
  const r = e.key === "Tab", o = e.shiftKey && !r;
5741
5750
  return o && !this.cellAnchor && (this.cellAnchor = { row: this.grid._focusRow, col: this.grid._focusCol }), this.pendingKeyboardUpdate = { shiftKey: o }, queueMicrotask(() => this.requestAfterRender()), !1;
5742
5751
  }
5743
- 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;
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;
5744
5753
  }
5745
5754
  onCellMouseDown(e) {
5746
5755
  if (!this.isSelectionEnabled() || this.config.mode !== "range" || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
@@ -5748,7 +5757,7 @@ class Bn extends F {
5748
5757
  if (t && W(t) || !this.isCellSelectable(e.rowIndex, e.colIndex) || e.originalEvent.shiftKey && this.cellAnchor)
5749
5758
  return;
5750
5759
  this.isDragging = !0;
5751
- const i = e.rowIndex, n = e.colIndex, r = e.originalEvent.ctrlKey || e.originalEvent.metaKey, o = {
5760
+ const i = e.rowIndex, n = e.colIndex, r = (e.originalEvent.ctrlKey || e.originalEvent.metaKey) && this.config.multiSelect !== !1, o = {
5752
5761
  startRow: i,
5753
5762
  startCol: n,
5754
5763
  endRow: i,
@@ -5795,7 +5804,7 @@ class Bn extends F {
5795
5804
  },
5796
5805
  headerRenderer: () => {
5797
5806
  const e = document.createElement("div");
5798
- e.className = "tbw-checkbox-header";
5807
+ if (e.className = "tbw-checkbox-header", this.config.multiSelect === !1) return e;
5799
5808
  const t = document.createElement("input");
5800
5809
  return t.type = "checkbox", t.className = "tbw-select-all-checkbox", t.addEventListener("click", (i) => {
5801
5810
  i.stopPropagation(), i.target.checked ? this.selectAll() : this.clearSelection();
@@ -5920,32 +5929,34 @@ class Bn extends F {
5920
5929
  return cn(e, t, this.ranges);
5921
5930
  }
5922
5931
  selectAll() {
5923
- const { mode: e } = this.config;
5924
- if (e === "row") {
5925
- this.selected.clear();
5926
- for (let t = 0; t < this.rows.length; t++)
5927
- this.isRowSelectable(t) && this.selected.add(t);
5928
- this.explicitSelection = !0, this.emit("selection-change", this.#i()), this.requestAfterRender();
5929
- } else if (e === "range") {
5930
- const t = this.rows.length, i = this.columns.length;
5931
- if (t > 0 && i > 0) {
5932
- const n = {
5933
- startRow: 0,
5934
- startCol: 0,
5935
- endRow: t - 1,
5936
- endCol: i - 1
5937
- };
5938
- this.ranges = [n], this.activeRange = n, this.emit("selection-change", this.#i()), this.requestAfterRender();
5932
+ const { mode: e, multiSelect: t } = this.config;
5933
+ if (t !== !1) {
5934
+ if (e === "row") {
5935
+ this.selected.clear();
5936
+ for (let i = 0; i < this.rows.length; i++)
5937
+ this.isRowSelectable(i) && this.selected.add(i);
5938
+ this.explicitSelection = !0, this.emit("selection-change", this.#i()), this.requestAfterRender();
5939
+ } else if (e === "range") {
5940
+ const i = this.rows.length, n = this.columns.length;
5941
+ if (i > 0 && n > 0) {
5942
+ const r = {
5943
+ startRow: 0,
5944
+ startCol: 0,
5945
+ endRow: i - 1,
5946
+ endCol: n - 1
5947
+ };
5948
+ this.ranges = [r], this.activeRange = r, this.emit("selection-change", this.#i()), this.requestAfterRender();
5949
+ }
5939
5950
  }
5940
5951
  }
5941
5952
  }
5942
5953
  selectRows(e) {
5943
- if (this.config.mode === "row") {
5944
- this.selected.clear();
5945
- for (const t of e)
5946
- t >= 0 && t < this.rows.length && this.isRowSelectable(t) && this.selected.add(t);
5947
- this.anchor = e.length > 0 ? e[e.length - 1] : null, this.explicitSelection = !0, this.emit("selection-change", this.#i()), this.requestAfterRender();
5948
- }
5954
+ if (this.config.mode !== "row") return;
5955
+ const t = this.config.multiSelect === !1 && e.length > 1 ? [e[e.length - 1]] : e;
5956
+ this.selected.clear();
5957
+ for (const i of t)
5958
+ i >= 0 && i < this.rows.length && this.isRowSelectable(i) && this.selected.add(i);
5959
+ this.anchor = t.length > 0 ? t[t.length - 1] : null, this.explicitSelection = !0, this.emit("selection-change", this.#i()), this.requestAfterRender();
5949
5960
  }
5950
5961
  getSelectedRowIndices() {
5951
5962
  return [...this.selected].sort((e, t) => e - t);
@@ -6283,13 +6294,13 @@ class $n extends F {
6283
6294
  const E = document.createElement("span");
6284
6295
  E.className = "tree-spacer", m.appendChild(E);
6285
6296
  }
6286
- const x = document.createElement("span");
6287
- if (x.className = "tree-content", n) {
6297
+ const y = document.createElement("span");
6298
+ if (y.className = "tree-content", n) {
6288
6299
  const E = n(d);
6289
- E instanceof Node ? x.appendChild(E) : typeof E == "string" && (x.innerHTML = E);
6300
+ E instanceof Node ? y.appendChild(E) : typeof E == "string" && (y.innerHTML = E);
6290
6301
  } else
6291
- x.textContent = u != null ? String(u) : "";
6292
- return m.appendChild(x), m;
6302
+ y.textContent = u != null ? String(u) : "";
6303
+ return m.appendChild(y), m;
6293
6304
  };
6294
6305
  return t[0] = { ...i, viewRenderer: l }, t;
6295
6306
  }