@ishibashi0112/spreadsheet-grid-core 0.60.0 → 0.61.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 (61) hide show
  1. package/README.md +2 -2
  2. package/dist/controllers/changeHighlightController.cjs +1 -1
  3. package/dist/controllers/changeHighlightController.js +54 -49
  4. package/dist/controllers/clipboardController.cjs +2 -2
  5. package/dist/controllers/clipboardController.js +71 -76
  6. package/dist/controllers/columnHeaderDragController.cjs +1 -1
  7. package/dist/controllers/columnHeaderDragController.js +74 -70
  8. package/dist/controllers/editController.cjs +1 -1
  9. package/dist/controllers/editController.js +90 -84
  10. package/dist/controllers/findController.cjs +1 -1
  11. package/dist/controllers/findController.js +71 -71
  12. package/dist/controllers/imeInputController.cjs +1 -1
  13. package/dist/controllers/imeInputController.js +68 -65
  14. package/dist/controllers/rowDragController.cjs +1 -1
  15. package/dist/controllers/rowDragController.d.ts +2 -0
  16. package/dist/controllers/rowDragController.js +153 -113
  17. package/dist/controllers/rowEnterController.cjs +1 -1
  18. package/dist/controllers/rowEnterController.js +49 -47
  19. package/dist/controllers/saveStatusController.cjs +1 -1
  20. package/dist/controllers/saveStatusController.js +54 -47
  21. package/dist/controllers/serverSideRowModel.cjs +1 -1
  22. package/dist/controllers/serverSideRowModel.js +42 -20
  23. package/dist/controllers/tooltipController.cjs +1 -1
  24. package/dist/controllers/tooltipController.js +38 -21
  25. package/dist/controllers/viewportSyncController.cjs +1 -1
  26. package/dist/controllers/viewportSyncController.d.ts +2 -1
  27. package/dist/controllers/viewportSyncController.js +3 -2
  28. package/dist/engine/columnLayout.cjs +1 -1
  29. package/dist/engine/columnLayout.d.ts +1 -0
  30. package/dist/engine/columnLayout.js +12 -11
  31. package/dist/engine/exportCommands.cjs +1 -1
  32. package/dist/engine/exportCommands.js +27 -25
  33. package/dist/engine/filterPopoverCommands.cjs +1 -1
  34. package/dist/engine/filterPopoverCommands.js +12 -7
  35. package/dist/engine/gridApi.cjs +1 -1
  36. package/dist/engine/gridApi.js +2 -2
  37. package/dist/logic/conditionalFormat.cjs +1 -1
  38. package/dist/logic/conditionalFormat.js +2 -2
  39. package/dist/logic/domGuards.cjs +1 -1
  40. package/dist/logic/domGuards.d.ts +4 -0
  41. package/dist/logic/domGuards.js +2 -2
  42. package/dist/logic/editorValues.cjs +1 -1
  43. package/dist/logic/editorValues.d.ts +2 -0
  44. package/dist/logic/editorValues.js +11 -2
  45. package/dist/logic/fillSeries.cjs +1 -1
  46. package/dist/logic/fillSeries.js +43 -36
  47. package/dist/logic/find.cjs +1 -1
  48. package/dist/logic/find.d.ts +1 -0
  49. package/dist/logic/find.js +6 -6
  50. package/dist/logic/gridState.cjs +1 -1
  51. package/dist/logic/gridState.js +72 -55
  52. package/dist/logic/selectionAggregates.cjs +1 -1
  53. package/dist/logic/selectionAggregates.js +5 -2
  54. package/dist/logic/serverSideEdits.cjs +1 -1
  55. package/dist/logic/serverSideEdits.d.ts +16 -2
  56. package/dist/logic/serverSideEdits.js +60 -14
  57. package/dist/model/gridTypes.core.d.ts +8 -5
  58. package/dist/utils/clipboard.cjs +5 -5
  59. package/dist/utils/clipboard.d.ts +3 -0
  60. package/dist/utils/clipboard.js +58 -65
  61. package/package.json +1 -6
@@ -40,18 +40,18 @@ var f = (e) => {
40
40
  let n = 0;
41
41
  for (; n < e.entries.length && t(e.entries[n].column.key);) n += 1;
42
42
  return n;
43
- }, p = 32, m = 2, h = 14, g = 12, _ = 14, v = (e) => "<svg viewBox=\"0 0 24 24\" width=\"" + e + "\" height=\"" + e + "\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"5 9 2 12 5 15\"/><polyline points=\"9 5 12 2 15 5\"/><polyline points=\"15 19 12 22 9 19\"/><polyline points=\"19 9 22 12 19 15\"/><line x1=\"2\" y1=\"12\" x2=\"22\" y2=\"12\"/><line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"22\"/></svg>", y = (e) => "<svg viewBox=\"0 0 24 24\" width=\"" + e + "\" height=\"" + e + "\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"12\" y1=\"17\" x2=\"12\" y2=\"22\"/><path d=\"M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z\"/></svg>", ee = v(_), te = y(_), ne = "<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"4.9\" y1=\"4.9\" x2=\"19.1\" y2=\"19.1\"/></svg>", re = "0.5", ie = 200, b = "cubic-bezier(0.2, 0.7, 0.3, 1)", ae = (e) => e?.closest(".ssg-motion-off") != null, oe = 160, x = `transform ${oe}ms ${b}`, S = "data-ssg-col-dragging", se = "4", ce = "9", le = "ssg-col-drag-float", ue = "ssg-col-drag-pin", C = 12, de = "ssg-col-drop-indicator", fe = "ssg-header-cell", pe = [
43
+ }, p = 32, m = 2, h = 14, g = 12, _ = 14, v = (e) => "<svg viewBox=\"0 0 24 24\" width=\"" + e + "\" height=\"" + e + "\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"5 9 2 12 5 15\"/><polyline points=\"9 5 12 2 15 5\"/><polyline points=\"15 19 12 22 9 19\"/><polyline points=\"19 9 22 12 19 15\"/><line x1=\"2\" y1=\"12\" x2=\"22\" y2=\"12\"/><line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"22\"/></svg>", y = (e) => "<svg viewBox=\"0 0 24 24\" width=\"" + e + "\" height=\"" + e + "\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"12\" y1=\"17\" x2=\"12\" y2=\"22\"/><path d=\"M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z\"/></svg>", ee = v(_), te = y(_), ne = "<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"4.9\" y1=\"4.9\" x2=\"19.1\" y2=\"19.1\"/></svg>", re = "0.5", ie = 200, b = "cubic-bezier(0.2, 0.7, 0.3, 1)", ae = (e) => e?.closest(".ssg-motion-off") != null, oe = 160, se = `transform ${oe}ms ${b}`, x = "data-ssg-col-dragging", ce = "4", le = "9", ue = "ssg-col-drag-float", de = "ssg-col-drag-pin", S = 12, fe = "ssg-col-drop-indicator", pe = "ssg-header-cell", me = [
44
44
  "data-ssg-col-key",
45
45
  "data-ssg-tooltip",
46
46
  "data-autoheight-cell",
47
47
  "id",
48
48
  "tabindex"
49
- ], me = 180, he = 400, w = (t) => {
49
+ ], he = 180, ge = 400, C = (t) => {
50
50
  let n = [];
51
51
  return t.querySelectorAll("[data-ssg-col-key]").forEach((r) => {
52
52
  e(t, r) || n.push(r);
53
53
  }), n;
54
- }, ge = (t) => {
54
+ }, _e = (t) => {
55
55
  if (!t) return null;
56
56
  let n = /* @__PURE__ */ new Map();
57
57
  return t.querySelectorAll("[data-ssg-col-key]").forEach((r) => {
@@ -59,23 +59,23 @@ var f = (e) => {
59
59
  let i = r.dataset.ssgColKey;
60
60
  i && !n.has(i) && n.set(i, r.getBoundingClientRect().left);
61
61
  }), n;
62
- }, _e = (e) => {
62
+ }, ve = (e) => {
63
63
  let t = getComputedStyle(e).transform, n = /^matrix(3d)?\(([^)]*)\)$/.exec(t);
64
64
  if (n === null) return 0;
65
65
  let r = Number(n[2].split(",")[n[1] === "3d" ? 12 : 4]);
66
66
  return Number.isFinite(r) ? r : 0;
67
- }, T = () => {
68
- let t = null, _ = null, T = null, E = null, D = {
67
+ }, w = () => {
68
+ let t = null, _ = null, w = null, T = null, E = {
69
69
  x: 0,
70
70
  y: 0
71
- }, O = null, k = !1, A = null, j = null, M = null, N = null, P = null, F = null, I = null, L = null, ve = 0, R = null, z = null, B = "", V = null, ye = 0, H = null, U = null, be = () => t?.motion === "live", W = () => ({
71
+ }, D = null, O = !1, k = null, A = null, j = null, M = null, N = null, P = null, F = null, I = null, L = 0, R = null, z = null, B = "", V = null, ye = 0, H = null, U = null, be = () => t?.motion === "live", W = () => ({
72
72
  left: t?.leftIndicatorRef.current ?? null,
73
73
  center: t?.centerIndicatorRef.current ?? null,
74
74
  right: t?.rightIndicatorRef.current ?? null
75
75
  }), G = () => {
76
76
  for (let e of Object.values(W())) e && (e.style.display = "none");
77
77
  }, xe = (e) => {
78
- if (P) return;
78
+ if (N) return;
79
79
  let n = document.createElement("div");
80
80
  n.setAttribute("data-grid-drag-ghost", ""), t?.scrollContainerRef.current?.closest(".ssg-theme-dark") != null && n.classList.add("ssg-theme-dark"), t?.scrollContainerRef.current?.closest(".ssg-motion-off") != null && n.classList.add("ssg-motion-off"), n.style.cssText = [
81
81
  "position:fixed",
@@ -103,18 +103,18 @@ var f = (e) => {
103
103
  let r = document.createElement("span");
104
104
  r.style.cssText = "display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none";
105
105
  let i = document.createElement("span");
106
- i.textContent = e, n.appendChild(r), n.appendChild(i), document.body.appendChild(n), P = n, F = r, I = null;
106
+ i.textContent = e, n.appendChild(r), n.appendChild(i), document.body.appendChild(n), N = n, P = r, F = null;
107
107
  }, Se = (e) => {
108
- let t = P;
108
+ let t = N;
109
109
  if (!t) return;
110
- t.style.transform = "translate(" + (D.x + h) + "px," + (D.y + g) + "px)";
110
+ t.style.transform = "translate(" + (E.x + h) + "px," + (E.y + g) + "px)";
111
111
  let n = e ?? "out";
112
- if (I === n) return;
113
- I = n;
114
- let r = F;
112
+ if (F === n) return;
113
+ F = n;
114
+ let r = P;
115
115
  n === "out" ? (t.style.opacity = re, r && (r.innerHTML = ne)) : (t.style.opacity = "1", r && (r.innerHTML = n === "center" ? ee : te));
116
116
  }, K = () => {
117
- P && P.parentNode && P.parentNode.removeChild(P), P = null, F = null, I = null;
117
+ N && N.parentNode && N.parentNode.removeChild(N), N = null, P = null, F = null;
118
118
  }, Ce = (e, r) => {
119
119
  if (t === null) return null;
120
120
  let { paneLayout: a, leftPaneScrollRef: o, rightPaneScrollRef: s, bodyScrollRef: c, scrollContainerRef: l, leftLeadingWidth: u, centerLeadingWidth: d, rightLeadingWidth: h } = t, g = l.current;
@@ -182,7 +182,7 @@ var f = (e) => {
182
182
  visibility: t.style.visibility
183
183
  });
184
184
  }, q = (e, n) => {
185
- let r = [], i = R, a = _, o = L;
185
+ let r = [], i = R, a = _, o = I;
186
186
  if (!i || a === null || o === null || t === null) return r;
187
187
  let s = t.scrollContainerRef.current;
188
188
  if (!s) return r;
@@ -190,17 +190,17 @@ var f = (e) => {
190
190
  if (l < 0) return r;
191
191
  let u = c[l].paneLocalSize, d = n === "lift-out" ? c.length - 1 : n === "rest" || e === null ? l : e > l ? e - 1 : e, f = /* @__PURE__ */ new Map();
192
192
  for (let e = Math.min(l, d); e <= Math.max(l, d); e += 1) e !== l && f.set(c[e].column.key, e > l ? -u : u);
193
- let p = o === "center" ? s.scrollLeft - ve : 0, m = (O ? D.x - O.x : 0) + p, h = U, g = /* @__PURE__ */ new WeakSet();
193
+ let p = o === "center" ? s.scrollLeft - L : 0, m = (D ? E.x - D.x : 0) + p, h = U, g = /* @__PURE__ */ new WeakSet();
194
194
  U = g;
195
- for (let e of w(s)) {
195
+ for (let e of C(s)) {
196
196
  let t = e.dataset.ssgColKey;
197
197
  if (t === void 0) continue;
198
198
  g.add(e);
199
- let o = h !== null && !h.has(e) ? "none" : x;
199
+ let o = h !== null && !h.has(e) ? "none" : se;
200
200
  if (t === a) {
201
- r.push(e), i.has(e) || (Te(i, e), e.style.zIndex = se, e.style.willChange = "transform");
201
+ r.push(e), i.has(e) || (Te(i, e), e.style.zIndex = ce, e.style.willChange = "transform");
202
202
  let t = i.get(e);
203
- n === "follow" ? (e.style.visibility = t?.visibility ?? "", e.setAttribute(S, "live"), e.style.transition = "none", e.style.transform = `translateX(${m}px)`) : n === "lift-out" ? (e.style.visibility = "hidden", e.removeAttribute(S), e.style.transition = "none", e.style.transform = "translateX(0px)") : (e.style.visibility = t?.visibility ?? "", e.removeAttribute(S), e.style.transition = o, e.style.transform = "translateX(0px)");
203
+ n === "follow" ? (e.style.visibility = t?.visibility ?? "", e.setAttribute(x, "live"), e.style.transition = "none", e.style.transform = `translateX(${m}px)`) : n === "lift-out" ? (e.style.visibility = "hidden", e.removeAttribute(x), e.style.transition = "none", e.style.transform = "translateX(0px)") : (e.style.visibility = t?.visibility ?? "", e.removeAttribute(x), e.style.transition = o, e.style.transform = "translateX(0px)");
204
204
  continue;
205
205
  }
206
206
  let s = f.get(t) ?? 0;
@@ -212,22 +212,22 @@ var f = (e) => {
212
212
  return r;
213
213
  }, J = (e) => {
214
214
  e.forEach((e, t) => {
215
- t.style.transition = "", t.style.transform = "", t.style.willChange = "", t.style.zIndex = e.zIndex, t.style.visibility = e.visibility, t.removeAttribute(S);
215
+ t.style.transition = "", t.style.transform = "", t.style.willChange = "", t.style.zIndex = e.zIndex, t.style.visibility = e.visibility, t.removeAttribute(x);
216
216
  });
217
217
  }, Ee = (e) => {
218
218
  let t = (e) => {
219
- for (let t of pe) e.removeAttribute(t);
219
+ for (let t of me) e.removeAttribute(t);
220
220
  };
221
221
  t(e), e.querySelectorAll("*").forEach(t), e.querySelectorAll(".ssg-header-actions").forEach((e) => e.remove());
222
222
  }, De = (e, t, n) => {
223
223
  let r = V;
224
224
  if (r === null) {
225
225
  let e = document.createElement("div");
226
- e.className = le, e.setAttribute("aria-hidden", "true"), e.setAttribute("inert", "");
226
+ e.className = ue, e.setAttribute("aria-hidden", "true"), e.setAttribute("inert", "");
227
227
  let n = document.createElement("div");
228
228
  n.style.cssText = "position:absolute;top:0;left:0;height:100%;will-change:transform";
229
229
  let i = document.createElement("div");
230
- i.className = de, i.style.cssText = "position:absolute;display:none", e.append(n, i), t.appendChild(e), r = {
230
+ i.className = fe, i.style.cssText = "position:absolute;display:none", e.append(n, i), t.appendChild(e), r = {
231
231
  layer: e,
232
232
  column: n,
233
233
  guide: i,
@@ -248,17 +248,17 @@ var f = (e) => {
248
248
  `height:${e.clientHeight}px`,
249
249
  "overflow:hidden",
250
250
  "pointer-events:none",
251
- `z-index:${ce}`
251
+ `z-index:${le}`
252
252
  ].join(";");
253
253
  let c = [], l = [], u = 0;
254
254
  for (let e of n) {
255
255
  let t = e.getBoundingClientRect(), n = e.cloneNode(!0);
256
- Ee(n), n.setAttribute(S, "live");
256
+ Ee(n), n.setAttribute(x, "live");
257
257
  let r = n.style;
258
- r.position = "absolute", r.left = "0px", r.top = `${t.top - s}px`, r.width = `${t.width}px`, r.minWidth = `${t.width}px`, r.height = `${t.height}px`, r.transform = "", r.transition = "", r.visibility = "", r.willChange = "", r.zIndex = "", u = Math.max(u, t.width), (n.classList.contains(fe) ? l : c).push(n);
258
+ r.position = "absolute", r.left = "0px", r.top = `${t.top - s}px`, r.width = `${t.width}px`, r.minWidth = `${t.width}px`, r.height = `${t.height}px`, r.transform = "", r.transition = "", r.visibility = "", r.willChange = "", r.zIndex = "", u = Math.max(u, t.width), (n.classList.contains(pe) ? l : c).push(n);
259
259
  }
260
260
  let d = null;
261
- for (let e of l) e.style.zIndex = "1", d === null && (d = document.createElement("span"), d.className = ue, e.insertBefore(d, e.firstChild));
261
+ for (let e of l) e.style.zIndex = "1", d === null && (d = document.createElement("span"), d.className = de, e.insertBefore(d, e.firstChild));
262
262
  return r.column.replaceChildren(...c, ...l), r.column.style.width = `${u}px`, r.badge = d, r.badgeKind = null, r.layerWidth = e.clientWidth, r.columnWidth = u, r.scrollTop = e.scrollTop, r.cellCount = n.length, r;
263
263
  }, Oe = (e) => {
264
264
  let n = t?.scrollContainerRef.current ?? null, r = n?.parentElement ?? null;
@@ -282,10 +282,10 @@ var f = (e) => {
282
282
  }
283
283
  r.style.left = `${a.left - n.left}px`, r.style.top = `${a.top - n.top}px`, r.style.height = `${a.height}px`, r.style.display = "block";
284
284
  }, je = (e, t) => {
285
- let n = e.layer.getBoundingClientRect(), r = Math.max(e.layerWidth - e.columnWidth, 0), i = Math.min(Math.max(D.x - ye - n.left, 0), r);
285
+ let n = e.layer.getBoundingClientRect(), r = Math.max(e.layerWidth - e.columnWidth, 0), i = Math.min(Math.max(E.x - ye - n.left, 0), r);
286
286
  e.column.style.transition = "none", e.column.style.transform = `translateX(${i}px)`;
287
287
  let a = t === null ? "none" : t === "center" ? "move" : "pin";
288
- e.badge !== null && e.badgeKind !== a && (e.badgeKind = a, e.badge.innerHTML = a === "none" ? "" : a === "move" ? v(C) : y(C), e.badge.style.display = a === "none" ? "none" : ""), Ae(e, t, n);
288
+ e.badge !== null && e.badgeKind !== a && (e.badgeKind = a, e.badge.innerHTML = a === "none" ? "" : a === "move" ? v(S) : y(S), e.badge.style.display = a === "none" ? "none" : ""), Ae(e, t, n);
289
289
  }, Y = () => {
290
290
  V?.layer.remove(), V = null;
291
291
  }, Me = (e, t, n) => {
@@ -304,23 +304,23 @@ var f = (e) => {
304
304
  let n = e.key;
305
305
  if (e.pane !== null && !t?.paneLayout[e.pane].entries.some((e) => e.column.key === n)) return;
306
306
  e.key = null;
307
- let r = t?.scrollContainerRef.current ?? null, i = r ? w(r).filter((e) => e.dataset.ssgColKey === n) : [];
307
+ let r = t?.scrollContainerRef.current ?? null, i = r ? C(r).filter((e) => e.dataset.ssgColKey === n) : [];
308
308
  if (i.length === 0) {
309
309
  X();
310
310
  return;
311
311
  }
312
312
  let a = i[0].getBoundingClientRect().left;
313
313
  for (let t of i) e.hiddenCells.push([t, t.style.visibility]), t.style.visibility = "hidden";
314
- Me(e.float, a, me), e.timer !== null && window.clearTimeout(e.timer), e.timer = window.setTimeout(X, 220);
314
+ Me(e.float, a, he), e.timer !== null && window.clearTimeout(e.timer), e.timer = window.setTimeout(X, 220);
315
315
  }, Z = () => {
316
- let e = Ce(D.x, D.y);
316
+ let e = Ce(E.x, E.y);
317
317
  if (be()) {
318
- e && (T = {
318
+ e && (w = {
319
319
  pane: e.pane,
320
320
  slot: e.slot
321
321
  });
322
- let n = T;
323
- if (n !== null && n.pane !== L) {
322
+ let n = w;
323
+ if (n !== null && n.pane !== I) {
324
324
  if (e && we(e), (t?.scrollContainerRef.current ?? null)?.parentElement != null) {
325
325
  let e = Oe(q(null, "lift-out"));
326
326
  if (e !== null) {
@@ -339,20 +339,20 @@ var f = (e) => {
339
339
  return;
340
340
  }
341
341
  if (Se(e ? e.pane : null), !e) {
342
- T = null, G();
342
+ w = null, G();
343
343
  return;
344
344
  }
345
- T = {
345
+ w = {
346
346
  pane: e.pane,
347
347
  slot: e.slot
348
348
  }, we(e);
349
349
  }, Pe = () => {
350
350
  if (_ === null) {
351
- M = null;
351
+ j = null;
352
352
  return;
353
353
  }
354
354
  let e = t?.scrollContainerRef.current ?? null;
355
- if (e && (k || (!O || o(O, D, 6)) && (k = !0), k)) {
355
+ if (e && (O || (!D || o(D, E, 6)) && (O = !0), O)) {
356
356
  let t = e.getBoundingClientRect(), n = c({
357
357
  rectLeft: t.left,
358
358
  rectTop: t.top,
@@ -360,23 +360,23 @@ var f = (e) => {
360
360
  clientTop: e.clientTop,
361
361
  clientWidth: e.clientWidth,
362
362
  clientHeight: e.clientHeight
363
- }), r = s(D.x, n.left, n.right, 24), i = a(e.scrollLeft, r, 18, e.scrollWidth - e.clientWidth);
363
+ }), r = s(E.x, n.left, n.right, 24), i = a(e.scrollLeft, r, 18, e.scrollWidth - e.clientWidth);
364
364
  i !== e.scrollLeft && e.scrollTo({
365
365
  left: i,
366
366
  behavior: "auto"
367
367
  });
368
368
  }
369
- Z(), M = requestAnimationFrame(Pe);
369
+ Z(), j = requestAnimationFrame(Pe);
370
370
  }, Q = (e) => {
371
- M !== null && (cancelAnimationFrame(M), M = null), document.body.style.cursor = "", G(), K();
372
- let n = _, i = T;
373
- _ = null, j = null, U = null, T = null, O = null;
371
+ j !== null && (cancelAnimationFrame(j), j = null), document.body.style.cursor = "", G(), K();
372
+ let n = _, i = w;
373
+ _ = null, A = null, U = null, w = null, D = null;
374
374
  let a = R;
375
- R = null, L = null;
375
+ R = null, I = null;
376
376
  let o = n !== null && i !== null && t !== null ? t.paneLayout[i.pane].entries.findIndex((e) => e.column.key === n) : -1, s = i !== null && o >= 0 && (i.slot === o || i.slot === o + 1), c = e && n && i && t !== null && !s ? u(t.columns, n, i.pane, d(t.columns, t.paneLayout[i.pane], i.pane, i.slot)) : null, l = V;
377
377
  if (V = null, a && !c) {
378
378
  a.forEach((e, t) => {
379
- t.isConnected && (t.style.transition = x, t.style.transform = "translateX(0px)");
379
+ t.isConnected && (t.style.transition = se, t.style.transform = "translateX(0px)");
380
380
  });
381
381
  let e = null;
382
382
  if (l !== null) {
@@ -399,17 +399,21 @@ var f = (e) => {
399
399
  } else l !== null && !c && l.layer.remove();
400
400
  if (!c || !n || !i || t === null) return;
401
401
  let { columns: f, applyColumnOrderAndPin: p, scrollContainerRef: m } = t, h = f.find((e) => e.key === n), g = h ? r(h) : null;
402
- E = g !== null && g === i.pane && !ae(m.current) ? ge(m.current) : null, a && J(a), l !== null && (l.badge?.remove(), l.guide.style.display = "none", H = {
402
+ T = g !== null && g === i.pane && !ae(m.current) ? _e(m.current) : null, a && J(a), l !== null && (l.badge?.remove(), l.guide.style.display = "none", H = {
403
403
  float: l,
404
404
  key: n,
405
405
  pane: i.pane,
406
- timer: window.setTimeout(X, he),
406
+ timer: window.setTimeout(X, ge),
407
407
  hiddenCells: []
408
- }), p(c, /* @__PURE__ */ new Map([[n, i.pane === "center" ? void 0 : i.pane]]));
408
+ });
409
+ let v = /* @__PURE__ */ new Map([[n, i.pane === "center" ? void 0 : i.pane]]), y = T;
410
+ p(c, v), y !== null && requestAnimationFrame(() => {
411
+ T === y && (T = null);
412
+ });
409
413
  }, Fe = () => {
410
414
  Ne();
411
- let n = E;
412
- if (E = null, !n) return;
415
+ let n = T;
416
+ if (T = null, !n) return;
413
417
  let r = t?.scrollContainerRef.current ?? null;
414
418
  if (!r) return;
415
419
  let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
@@ -435,13 +439,13 @@ var f = (e) => {
435
439
  }, c = {
436
440
  run: s,
437
441
  timer: window.setTimeout(() => {
438
- N === c && (N = null), s();
442
+ M === c && (M = null), s();
439
443
  }, 280)
440
444
  };
441
- N = c;
445
+ M = c;
442
446
  }, $ = () => {
443
- let e = N;
444
- N = null, e !== null && (window.clearTimeout(e.timer), e.run());
447
+ let e = M;
448
+ M = null, e !== null && (window.clearTimeout(e.timer), e.run());
445
449
  };
446
450
  return {
447
451
  update: (e) => {
@@ -450,34 +454,34 @@ var f = (e) => {
450
454
  onColumnDragHandlePointerDown: (e, n) => {
451
455
  if (t === null || !t.enabled || n.button !== 0) return;
452
456
  if (n.stopPropagation(), n.preventDefault(), _ !== null) {
453
- if (n.pointerId !== j) return;
454
- A?.(), Q(!1);
457
+ if (n.pointerId !== A) return;
458
+ k?.(), Q(!1);
455
459
  }
456
460
  if ($(), X(), Y(), z?.forEach((e, t) => {
457
461
  t.style.visibility = e.visibility;
458
- }), _ = e.key, j = n.pointerId, T = null, U = null, D = {
462
+ }), _ = e.key, A = n.pointerId, w = null, U = null, E = {
459
463
  x: n.clientX,
460
464
  y: n.clientY
461
- }, O = {
465
+ }, D = {
462
466
  x: n.clientX,
463
467
  y: n.clientY
464
- }, k = !1, document.body.style.cursor = "grabbing", B = e.title || e.key, be()) {
468
+ }, O = !1, document.body.style.cursor = "grabbing", B = e.title || e.key, be()) {
465
469
  let i = t.scrollContainerRef.current;
466
- L = r(e), ve = i?.scrollLeft ?? 0, R = /* @__PURE__ */ new Map();
467
- let a = i ? w(i).find((t) => t.dataset.ssgColKey === e.key) : void 0;
468
- ye = a ? n.clientX - (a.getBoundingClientRect().left - _e(a)) : (t.paneLayout[L].entries.find((t) => t.column.key === e.key)?.paneLocalSize ?? 0) / 2;
470
+ I = r(e), L = i?.scrollLeft ?? 0, R = /* @__PURE__ */ new Map();
471
+ let a = i ? C(i).find((t) => t.dataset.ssgColKey === e.key) : void 0;
472
+ ye = a ? n.clientX - (a.getBoundingClientRect().left - ve(a)) : (t.paneLayout[I].entries.find((t) => t.column.key === e.key)?.paneLocalSize ?? 0) / 2;
469
473
  } else xe(B);
470
474
  let i = n.currentTarget, a = n.pointerId;
471
475
  try {
472
476
  i.setPointerCapture(a);
473
477
  } catch {}
474
478
  let o = (e) => {
475
- e.pointerId === a && (D = {
479
+ e.pointerId === a && (E = {
476
480
  x: e.clientX,
477
481
  y: e.clientY
478
482
  }, Z());
479
483
  }, s = () => {
480
- window.removeEventListener("pointermove", o), window.removeEventListener("pointerup", c), window.removeEventListener("pointercancel", l), window.removeEventListener("keydown", u), window.removeEventListener("blur", d), A = null;
484
+ window.removeEventListener("pointermove", o), window.removeEventListener("pointerup", c), window.removeEventListener("pointercancel", l), window.removeEventListener("keydown", u), window.removeEventListener("blur", d), k = null;
481
485
  try {
482
486
  i.releasePointerCapture(a);
483
487
  } catch {}
@@ -494,13 +498,13 @@ var f = (e) => {
494
498
  function d() {
495
499
  s(), Q(!1);
496
500
  }
497
- window.addEventListener("pointermove", o), window.addEventListener("pointerup", c), window.addEventListener("pointercancel", l), window.addEventListener("keydown", u), window.addEventListener("blur", d), A = s, Z(), M = requestAnimationFrame(Pe);
501
+ window.addEventListener("pointermove", o), window.addEventListener("pointerup", c), window.addEventListener("pointercancel", l), window.addEventListener("keydown", u), window.addEventListener("blur", d), k = s, Z(), j = requestAnimationFrame(Pe);
498
502
  },
499
503
  applyReorderSettle: Fe,
500
504
  dispose: () => {
501
- A?.(), A = null, M !== null && (cancelAnimationFrame(M), M = null), _ = null, j = null, T = null, document.body.style.cursor = "", K(), R && J(R), R = null, L = null, Y(), X();
505
+ k?.(), k = null, j !== null && (cancelAnimationFrame(j), j = null), _ = null, A = null, w = null, document.body.style.cursor = "", K(), R && J(R), R = null, I = null, Y(), X();
502
506
  }
503
507
  };
504
508
  };
505
509
  //#endregion
506
- export { u as computeHeaderReorderedKeys, T as createColumnHeaderDragController, d as resolveConsumerDropSlot };
510
+ export { u as computeHeaderReorderedKeys, w as createColumnHeaderDragController, d as resolveConsumerDropSlot };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/permissions.cjs"),t=require("../logic/detailRow.cjs"),n=require("../model/gridActions.cjs"),r=require("../logic/geometry.cjs"),i=require("../logic/editorValues.cjs"),a=require("../logic/validation.cjs");var o=(e,t)=>t.activeCell!==e.activeCell||t.selection!==e.selection,s=e=>{if(t.isFocusInsideDetailCard())return!1;let n=e.ownerDocument,r=n.activeElement;return r===null||r===n.body||r===n.documentElement||e.contains(r)},c=()=>{let t=null,c=null,l=(e,t)=>{let n=e.visibleColumns[t.col];return!n||t.row<0||t.row>=e.rowModel.getRowCount()||e.rowModel.getRow(t.row)===void 0?null:{rowKey:e.rowModel.getRowKey(t.row),columnKey:n.key}},u=(e,t)=>{let n=e.visibleColumns.findIndex(e=>e.key===t.columnKey);if(n<0)return null;let r=e.rowModel.getRowCount();for(let i=0;i<r;i+=1)if(e.rowModel.getRow(i)!==void 0&&Object.is(e.rowModel.getRowKey(i),t.rowKey))return{row:i,col:n};return null},d=e=>{t=e;let r=e.uiState.editingCell;if(!r){c=null;return}let i=l(e,r);if(c!==null&&i!==null&&Object.is(i.rowKey,c.rowKey)&&i.columnKey===c.columnKey){c={...c,cell:r};return}let a=c!==null&&c.cell.row===r.row&&c.cell.col===r.col;if(c===null||!a){c=i?{...i,cell:r}:null;return}let o=u(e,c);o?(c={...c,cell:o},e.dispatch(n.gridActions.startEdit(o))):(c=null,e.dispatch(n.gridActions.stopEdit()))},f=e=>{t!==null&&(t.dispatch(n.gridActions.startSelection(e)),t.dispatch(n.gridActions.endSelection()),t.dispatch(n.gridActions.activateCell(e)))},p=(e,r)=>{t!==null&&(t.setEditorInitialValue(r),t.dispatch(n.gridActions.startEdit(e)))},m=(e,n=null)=>{let i=t;i!==null&&requestAnimationFrame(()=>{let a=i.gridRootRef.current;if(a!==null&&s(a)&&a.focus(),e!==null&&t!==null&&!(n!==null&&o(n,t.uiState))){let n=t.rowModel.getRowCount(),i=t.visibleColumns.length;f({row:r.clamp(e.row,0,Math.max(n-1,0)),col:r.clamp(e.col,0,Math.max(i-1,0))})}i.editorActionGuardRef.current=!1})};return{update:d,activateSingleCell:f,startEditWithValue:p,commitEdit:(r,o)=>{if(t===null)return{status:`noop`};let{uiState:s,visibleColumns:c,rowModel:l,rows:u,applyServerSideCellEdits:d,onRowsChange:f,dispatch:p,editorActionGuardRef:h}=t;if(h.current||!s.editingCell)return{status:`noop`};let g=s.editingCell,_=o===`down`?{row:g.row+1,col:g.col}:o===`up`?{row:g.row-1,col:g.col}:o===`right`?{row:g.row,col:g.col+1}:o===`left`?{row:g.row,col:g.col-1}:g,v=c[g.col],y=l.getSourceIndex(g.row),b=d?l.getRow(g.row):u[y];if(!v||!b)return p(n.gridActions.stopEdit()),{status:`noop`};if(!e.isViewCellEditable({readOnly:t.readOnly,canEditCell:t.canEditCell},l,g.row,g.col,b,v))return h.current=!0,p(n.gridActions.stopEdit()),m(null),{status:`noop`};if(d){let e=i.parseCommittedValue(v,r,b),t=a.decideCellWrite(v,b,e);if(t.action===`reject`)return{status:`rejected`,message:t.message};d([{viewIndex:g.row,column:v,value:e}])}else if(f){let e=i.parseCommittedValue(v,r,b),t=a.decideCellWrite(v,b,e);if(t.action===`reject`)return{status:`rejected`,message:t.message};f(i.writeRowsCell(u,y,v,e))}return h.current=!0,m(_,o===void 0?{activeCell:s.activeCell,selection:s.selection}:null),p(n.gridActions.stopEdit()),{status:`committed`}},cancelEdit:()=>{t===null||t.editorActionGuardRef.current||(t.editorActionGuardRef.current=!0,t.dispatch(n.gridActions.stopEdit()),m(null))}}};exports.createEditController=c;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/permissions.cjs"),t=require("../logic/detailRow.cjs"),n=require("../model/gridActions.cjs"),r=require("../logic/geometry.cjs"),i=require("../logic/editorValues.cjs"),a=require("../logic/validation.cjs");var o=(e,t)=>t.activeCell!==e.activeCell||t.selection!==e.selection,s=e=>{if(t.isFocusInsideDetailCard())return!1;let n=e.ownerDocument,r=n.activeElement;return r===null||r===n.body||r===n.documentElement||e.contains(r)},c=()=>{let t=null,c=null,l=(e,t)=>{let n=e.visibleColumns[t.col];return!n||t.row<0||t.row>=e.rowModel.getRowCount()||e.rowModel.getRow(t.row)===void 0?null:{rowKey:e.rowModel.getRowKey(t.row),columnKey:n.key}},u=(e,t)=>{let n=e.visibleColumns.findIndex(e=>e.key===t.columnKey);if(n<0)return null;let r=e.rowModel.getRowCount();for(let i=0;i<r;i+=1)if(e.rowModel.getRow(i)!==void 0&&Object.is(e.rowModel.getRowKey(i),t.rowKey))return{row:i,col:n};return null},d=e=>{t=e;let r=e.uiState.editingCell;if(!r){c=null;return}let i=l(e,r);if(c!==null&&i!==null&&Object.is(i.rowKey,c.rowKey)&&i.columnKey===c.columnKey){c={...c,cell:r};return}let a=c!==null&&c.cell.row===r.row&&c.cell.col===r.col;if(c===null||!a){c=i?{...i,cell:r}:null;return}let o=u(e,c);o?(c={...c,cell:o},e.dispatch(n.gridActions.startEdit(o))):(c=null,e.dispatch(n.gridActions.stopEdit()))},f=e=>{t!==null&&(t.dispatch(n.gridActions.startSelection(e)),t.dispatch(n.gridActions.endSelection()),t.dispatch(n.gridActions.activateCell(e)))},p=(e,r)=>{t!==null&&(t.setEditorInitialValue(r),t.dispatch(n.gridActions.startEdit(e)))},m=(e,n=null,i)=>{let a=t;a!==null&&requestAnimationFrame(()=>{let c=a.gridRootRef.current;if(c!==null&&s(c)&&c.focus(),e!==null&&t!==null&&!(n!==null&&o(n,t.uiState))){let n=t.rowModel.getRowCount(),a=t.visibleColumns.length,o=r.clamp(e.row,0,Math.max(n-1,0)),{getLabelRow:s}=t.rowModel;if(s&&i!==void 0&&o!==i){let e=o>i?1:-1;for(;o>=0&&o<n&&s(o);)o+=e;(o<0||o>=n)&&(o=r.clamp(i,0,Math.max(n-1,0)))}f({row:o,col:r.clamp(e.col,0,Math.max(a-1,0))})}a.editorActionGuardRef.current=!1})};return{update:d,activateSingleCell:f,startEditWithValue:p,commitEdit:(r,o)=>{if(t===null)return{status:`noop`};let{uiState:s,visibleColumns:c,rowModel:l,rows:u,applyServerSideCellEdits:d,onRowsChange:f,dispatch:p,editorActionGuardRef:h}=t;if(h.current||!s.editingCell)return{status:`noop`};let g=s.editingCell,_=o===`down`?{row:g.row+1,col:g.col}:o===`up`?{row:g.row-1,col:g.col}:o===`right`?{row:g.row,col:g.col+1}:o===`left`?{row:g.row,col:g.col-1}:g,v=c[g.col],y=l.getSourceIndex(g.row),b=d?l.getRow(g.row):u[y];if(!v||!b)return p(n.gridActions.stopEdit()),{status:`noop`};if(!e.isViewCellEditable({readOnly:t.readOnly,canEditCell:t.canEditCell},l,g.row,g.col,b,v))return h.current=!0,p(n.gridActions.stopEdit()),m(null),{status:`noop`};let x=i.isUnchangedEditorCommit(v,e.getCellValue(b,v),r);if(!x&&d){let e=i.parseCommittedValue(v,r,b),t=a.decideCellWrite(v,b,e);if(t.action===`reject`)return{status:`rejected`,message:t.message};d([{viewIndex:g.row,column:v,value:e}])}else if(!x&&f){let e=i.parseCommittedValue(v,r,b),t=a.decideCellWrite(v,b,e);if(t.action===`reject`)return{status:`rejected`,message:t.message};f(i.writeRowsCell(u,y,v,e))}return h.current=!0,m(_,o===void 0?{activeCell:s.activeCell,selection:s.selection}:null,g.row),p(n.gridActions.stopEdit()),{status:`committed`}},cancelEdit:()=>{t===null||t.editorActionGuardRef.current||(t.editorActionGuardRef.current=!0,t.dispatch(n.gridActions.stopEdit()),m(null))}}};exports.createEditController=c;
@@ -1,22 +1,22 @@
1
- import { isViewCellEditable as e } from "../utils/permissions.js";
2
- import { isFocusInsideDetailCard as t } from "../logic/detailRow.js";
3
- import { gridActions as n } from "../model/gridActions.js";
4
- import { clamp as r } from "../logic/geometry.js";
5
- import { parseCommittedValue as i, writeRowsCell as a } from "../logic/editorValues.js";
6
- import { decideCellWrite as o } from "../logic/validation.js";
1
+ import { getCellValue as e, isViewCellEditable as t } from "../utils/permissions.js";
2
+ import { isFocusInsideDetailCard as n } from "../logic/detailRow.js";
3
+ import { gridActions as r } from "../model/gridActions.js";
4
+ import { clamp as i } from "../logic/geometry.js";
5
+ import { isUnchangedEditorCommit as a, parseCommittedValue as o, writeRowsCell as s } from "../logic/editorValues.js";
6
+ import { decideCellWrite as c } from "../logic/validation.js";
7
7
  //#region src/controllers/editController.ts
8
- var s = (e, t) => t.activeCell !== e.activeCell || t.selection !== e.selection, c = (e) => {
9
- if (t()) return !1;
10
- let n = e.ownerDocument, r = n.activeElement;
11
- return r === null || r === n.body || r === n.documentElement || e.contains(r);
12
- }, l = () => {
13
- let t = null, l = null, u = (e, t) => {
8
+ var l = (e, t) => t.activeCell !== e.activeCell || t.selection !== e.selection, u = (e) => {
9
+ if (n()) return !1;
10
+ let t = e.ownerDocument, r = t.activeElement;
11
+ return r === null || r === t.body || r === t.documentElement || e.contains(r);
12
+ }, d = () => {
13
+ let n = null, d = null, f = (e, t) => {
14
14
  let n = e.visibleColumns[t.col];
15
15
  return !n || t.row < 0 || t.row >= e.rowModel.getRowCount() || e.rowModel.getRow(t.row) === void 0 ? null : {
16
16
  rowKey: e.rowModel.getRowKey(t.row),
17
17
  columnKey: n.key
18
18
  };
19
- }, d = (e, t) => {
19
+ }, p = (e, t) => {
20
20
  let n = e.visibleColumns.findIndex((e) => e.key === t.columnKey);
21
21
  if (n < 0) return null;
22
22
  let r = e.rowModel.getRowCount();
@@ -25,106 +25,112 @@ var s = (e, t) => t.activeCell !== e.activeCell || t.selection !== e.selection,
25
25
  col: n
26
26
  };
27
27
  return null;
28
- }, f = (e) => {
29
- t = e;
30
- let r = e.uiState.editingCell;
31
- if (!r) {
32
- l = null;
28
+ }, m = (e) => {
29
+ n = e;
30
+ let t = e.uiState.editingCell;
31
+ if (!t) {
32
+ d = null;
33
33
  return;
34
34
  }
35
- let i = u(e, r);
36
- if (l !== null && i !== null && Object.is(i.rowKey, l.rowKey) && i.columnKey === l.columnKey) {
37
- l = {
38
- ...l,
39
- cell: r
35
+ let i = f(e, t);
36
+ if (d !== null && i !== null && Object.is(i.rowKey, d.rowKey) && i.columnKey === d.columnKey) {
37
+ d = {
38
+ ...d,
39
+ cell: t
40
40
  };
41
41
  return;
42
42
  }
43
- let a = l !== null && l.cell.row === r.row && l.cell.col === r.col;
44
- if (l === null || !a) {
45
- l = i ? {
43
+ let a = d !== null && d.cell.row === t.row && d.cell.col === t.col;
44
+ if (d === null || !a) {
45
+ d = i ? {
46
46
  ...i,
47
- cell: r
47
+ cell: t
48
48
  } : null;
49
49
  return;
50
50
  }
51
- let o = d(e, l);
52
- o ? (l = {
53
- ...l,
51
+ let o = p(e, d);
52
+ o ? (d = {
53
+ ...d,
54
54
  cell: o
55
- }, e.dispatch(n.startEdit(o))) : (l = null, e.dispatch(n.stopEdit()));
56
- }, p = (e) => {
57
- t !== null && (t.dispatch(n.startSelection(e)), t.dispatch(n.endSelection()), t.dispatch(n.activateCell(e)));
58
- }, m = (e, r) => {
59
- t !== null && (t.setEditorInitialValue(r), t.dispatch(n.startEdit(e)));
60
- }, h = (e, n = null) => {
61
- let i = t;
62
- i !== null && requestAnimationFrame(() => {
63
- let a = i.gridRootRef.current;
64
- if (a !== null && c(a) && a.focus(), e !== null && t !== null && !(n !== null && s(n, t.uiState))) {
65
- let n = t.rowModel.getRowCount(), i = t.visibleColumns.length;
66
- p({
67
- row: r(e.row, 0, Math.max(n - 1, 0)),
68
- col: r(e.col, 0, Math.max(i - 1, 0))
55
+ }, e.dispatch(r.startEdit(o))) : (d = null, e.dispatch(r.stopEdit()));
56
+ }, h = (e) => {
57
+ n !== null && (n.dispatch(r.startSelection(e)), n.dispatch(r.endSelection()), n.dispatch(r.activateCell(e)));
58
+ }, g = (e, t) => {
59
+ n !== null && (n.setEditorInitialValue(t), n.dispatch(r.startEdit(e)));
60
+ }, _ = (e, t = null, r) => {
61
+ let a = n;
62
+ a !== null && requestAnimationFrame(() => {
63
+ let o = a.gridRootRef.current;
64
+ if (o !== null && u(o) && o.focus(), e !== null && n !== null && !(t !== null && l(t, n.uiState))) {
65
+ let t = n.rowModel.getRowCount(), a = n.visibleColumns.length, o = i(e.row, 0, Math.max(t - 1, 0)), { getLabelRow: s } = n.rowModel;
66
+ if (s && r !== void 0 && o !== r) {
67
+ let e = o > r ? 1 : -1;
68
+ for (; o >= 0 && o < t && s(o);) o += e;
69
+ (o < 0 || o >= t) && (o = i(r, 0, Math.max(t - 1, 0)));
70
+ }
71
+ h({
72
+ row: o,
73
+ col: i(e.col, 0, Math.max(a - 1, 0))
69
74
  });
70
75
  }
71
- i.editorActionGuardRef.current = !1;
76
+ a.editorActionGuardRef.current = !1;
72
77
  });
73
78
  };
74
79
  return {
75
- update: f,
76
- activateSingleCell: p,
77
- startEditWithValue: m,
78
- commitEdit: (r, s) => {
79
- if (t === null) return { status: "noop" };
80
- let { uiState: c, visibleColumns: l, rowModel: u, rows: d, applyServerSideCellEdits: f, onRowsChange: p, dispatch: m, editorActionGuardRef: g } = t;
81
- if (g.current || !c.editingCell) return { status: "noop" };
82
- let _ = c.editingCell, v = s === "down" ? {
83
- row: _.row + 1,
84
- col: _.col
85
- } : s === "up" ? {
86
- row: _.row - 1,
87
- col: _.col
88
- } : s === "right" ? {
89
- row: _.row,
90
- col: _.col + 1
91
- } : s === "left" ? {
92
- row: _.row,
93
- col: _.col - 1
94
- } : _, y = l[_.col], b = u.getSourceIndex(_.row), x = f ? u.getRow(_.row) : d[b];
95
- if (!y || !x) return m(n.stopEdit()), { status: "noop" };
96
- if (!e({
97
- readOnly: t.readOnly,
98
- canEditCell: t.canEditCell
99
- }, u, _.row, _.col, x, y)) return g.current = !0, m(n.stopEdit()), h(null), { status: "noop" };
100
- if (f) {
101
- let e = i(y, r, x), t = o(y, x, e);
80
+ update: m,
81
+ activateSingleCell: h,
82
+ startEditWithValue: g,
83
+ commitEdit: (i, l) => {
84
+ if (n === null) return { status: "noop" };
85
+ let { uiState: u, visibleColumns: d, rowModel: f, rows: p, applyServerSideCellEdits: m, onRowsChange: h, dispatch: g, editorActionGuardRef: v } = n;
86
+ if (v.current || !u.editingCell) return { status: "noop" };
87
+ let y = u.editingCell, b = l === "down" ? {
88
+ row: y.row + 1,
89
+ col: y.col
90
+ } : l === "up" ? {
91
+ row: y.row - 1,
92
+ col: y.col
93
+ } : l === "right" ? {
94
+ row: y.row,
95
+ col: y.col + 1
96
+ } : l === "left" ? {
97
+ row: y.row,
98
+ col: y.col - 1
99
+ } : y, x = d[y.col], S = f.getSourceIndex(y.row), C = m ? f.getRow(y.row) : p[S];
100
+ if (!x || !C) return g(r.stopEdit()), { status: "noop" };
101
+ if (!t({
102
+ readOnly: n.readOnly,
103
+ canEditCell: n.canEditCell
104
+ }, f, y.row, y.col, C, x)) return v.current = !0, g(r.stopEdit()), _(null), { status: "noop" };
105
+ let w = a(x, e(C, x), i);
106
+ if (!w && m) {
107
+ let e = o(x, i, C), t = c(x, C, e);
102
108
  if (t.action === "reject") return {
103
109
  status: "rejected",
104
110
  message: t.message
105
111
  };
106
- f([{
107
- viewIndex: _.row,
108
- column: y,
112
+ m([{
113
+ viewIndex: y.row,
114
+ column: x,
109
115
  value: e
110
116
  }]);
111
- } else if (p) {
112
- let e = i(y, r, x), t = o(y, x, e);
117
+ } else if (!w && h) {
118
+ let e = o(x, i, C), t = c(x, C, e);
113
119
  if (t.action === "reject") return {
114
120
  status: "rejected",
115
121
  message: t.message
116
122
  };
117
- p(a(d, b, y, e));
123
+ h(s(p, S, x, e));
118
124
  }
119
- return g.current = !0, h(v, s === void 0 ? {
120
- activeCell: c.activeCell,
121
- selection: c.selection
122
- } : null), m(n.stopEdit()), { status: "committed" };
125
+ return v.current = !0, _(b, l === void 0 ? {
126
+ activeCell: u.activeCell,
127
+ selection: u.selection
128
+ } : null, y.row), g(r.stopEdit()), { status: "committed" };
123
129
  },
124
130
  cancelEdit: () => {
125
- t === null || t.editorActionGuardRef.current || (t.editorActionGuardRef.current = !0, t.dispatch(n.stopEdit()), h(null));
131
+ n === null || n.editorActionGuardRef.current || (n.editorActionGuardRef.current = !0, n.dispatch(r.stopEdit()), _(null));
126
132
  }
127
133
  };
128
134
  };
129
135
  //#endregion
130
- export { l as createEditController };
136
+ export { d as createEditController };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../logic/chunkedLoop.cjs"),n=require("../logic/detailRow.cjs"),r=require("../logic/find.cjs");var i=1e4,a=new Map,o=()=>{let i=null,o=0,s=null,c=e.createValueStore({open:!1,query:``,matches:[],index:a,currentIndex:null,scanning:!1,truncated:!1}),l=e=>{c.setSnapshot({...c.getSnapshot(),...e})},u=null,d=()=>{let e=c.getSnapshot(),t={query:e.query,matchCount:e.matches.length,currentIndex:e.currentIndex,open:e.open};u!==null&&u.query===t.query&&u.matchCount===t.matchCount&&u.currentIndex===t.currentIndex&&u.open===t.open||(u=t,i?.onChange?.(t))},f=()=>{let e=c.getSnapshot();if(e.currentIndex===null)return;let t=e.matches[e.currentIndex];t&&i?.onNavigate(t.rowIndex,t.colIndex)},p=()=>{o+=1,s=null,l({matches:[],index:a,currentIndex:null,scanning:!1,truncated:!1})},m=e=>{let a=i,u=c.getSnapshot();if(!a||!u.open||u.query.length===0){p(),d();return}o+=1;let m=o,{rowModel:h,columns:g,caseSensitive:_}=a,v=u.query;s={rowModel:h,columns:g,query:v,caseSensitive:_};let y=u.currentIndex===null?null:u.matches[u.currentIndex]??null,b=[],x=!1,S=h.getRowCount();l({scanning:!0}),t.runChunked(S,e=>{if(x)return;let t=h.getRow(e);t!==void 0&&g.forEach((i,a)=>{if(x||n.isSyntheticColumnKey(i.key))return;let o=r.resolveFindCellText(i,t);for(let t of r.findRangesInText(o,v,_)){if(b.length>=1e4){x=!0;return}b.push({rowIndex:e,colIndex:a,columnKey:String(i.key),start:t.start,length:t.length})}})},{isCancelled:()=>o!==m}).then(t=>{if(!t||o!==m)return;let n=r.resolveCurrentAfterRescan(b,y);l({matches:b,index:r.buildFindIndex(b),currentIndex:n,scanning:!1,truncated:x}),d(),e&&f()})},h=()=>{let e=c.getSnapshot();return!i||!e.open||e.query.length===0?!1:s===null||s.rowModel!==i.rowModel||s.columns!==i.columns||s.query!==e.query||s.caseSensitive!==i.caseSensitive};return{update:e=>{let t=i;if(i=e,!e.enabled){c.getSnapshot().open&&(l({open:!1,query:``}),p(),d());return}t!==e&&h()&&m(!1)},open:e=>{if(!i?.enabled)return;let t=c.getSnapshot(),n=e??t.query;l({open:!0,query:n}),n!==t.query||!t.open?m(!0):d()},close:()=>{c.getSnapshot().open&&(l({open:!1,query:``}),p(),d())},setQuery:e=>{let t=c.getSnapshot();!t.open||e===t.query||(l({query:e}),m(!0))},next:()=>{let e=c.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,1);l({currentIndex:t}),d(),f()},prev:()=>{let e=c.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,-1);l({currentIndex:t}),d(),f()},subscribe:c.subscribe,getSnapshot:c.getSnapshot,dispose:()=>{o+=1,i=null}}};exports.MAX_FIND_MATCHES=i,exports.createFindController=o;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../logic/chunkedLoop.cjs"),n=require("../logic/detailRow.cjs"),r=require("../logic/find.cjs");var i=1e4,a=new Map,o=()=>{let i=null,o=0,s=null,c=e.createValueStore({open:!1,query:``,matches:[],index:a,currentIndex:null,scanning:!1,truncated:!1}),l=e=>{c.setSnapshot({...c.getSnapshot(),...e})},u=null,d=()=>{let e=c.getSnapshot(),t={query:e.query,matchCount:e.matches.length,currentIndex:e.currentIndex,open:e.open};u!==null&&u.query===t.query&&u.matchCount===t.matchCount&&u.currentIndex===t.currentIndex&&u.open===t.open||(u=t,i?.onChange?.(t))},f=()=>{let e=c.getSnapshot();if(e.currentIndex===null)return;let t=e.matches[e.currentIndex];t&&i?.onNavigate(t.rowIndex,t.colIndex)},p=()=>{o+=1,s=null,l({matches:[],index:a,currentIndex:null,scanning:!1,truncated:!1})},m=e=>{let a=i,u=c.getSnapshot();if(!a||!u.open||u.query.length===0){p(),d();return}o+=1;let m=o,{rowModel:h,columns:g,caseSensitive:_}=a,v=u.query;s={rowModel:h,columns:g,query:v,caseSensitive:_};let y=u.currentIndex===null?null:u.matches[u.currentIndex]??null,b=[],x=!1,S=h.getRowCount();l({scanning:!0}),t.runChunked(S,e=>{if(x)return;let t=h.getRow(e);t!==void 0&&g.forEach((i,a)=>{if(x||n.isSyntheticColumnKey(i.key)||!r.isFindableColumn(i))return;let o=r.resolveFindCellText(i,t);for(let t of r.findRangesInText(o,v,_)){if(b.length>=1e4){x=!0;return}b.push({rowIndex:e,colIndex:a,columnKey:String(i.key),start:t.start,length:t.length})}})},{isCancelled:()=>o!==m}).then(t=>{if(!t||o!==m)return;let n=r.resolveCurrentAfterRescan(b,y);l({matches:b,index:r.buildFindIndex(b),currentIndex:n,scanning:!1,truncated:x}),d(),e&&f()})},h=()=>{let e=c.getSnapshot();return!i||!e.open||e.query.length===0?!1:s===null||s.rowModel!==i.rowModel||s.columns!==i.columns||s.query!==e.query||s.caseSensitive!==i.caseSensitive};return{update:e=>{let t=i;if(i=e,!e.enabled){c.getSnapshot().open&&(l({open:!1,query:``}),p(),d());return}t!==e&&h()&&m(!1)},open:e=>{if(!i?.enabled)return;let t=c.getSnapshot(),n=e??t.query;l({open:!0,query:n}),n!==t.query||!t.open?m(!0):d()},close:()=>{c.getSnapshot().open&&(l({open:!1,query:``}),p(),d())},setQuery:e=>{let t=c.getSnapshot();!t.open||e===t.query||(l({query:e}),m(!0))},next:()=>{let e=c.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,1);l({currentIndex:t}),d(),f()},prev:()=>{let e=c.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,-1);l({currentIndex:t}),d(),f()},subscribe:c.subscribe,getSnapshot:c.getSnapshot,dispose:()=>{o+=1,i=null}}};exports.MAX_FIND_MATCHES=i,exports.createFindController=o;