@ishibashi0112/spreadsheet-grid-core 0.60.0 → 0.62.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 (103) 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/columnMenuController.cjs +1 -1
  9. package/dist/controllers/columnMenuController.d.ts +2 -0
  10. package/dist/controllers/columnMenuController.js +72 -60
  11. package/dist/controllers/contextMenuController.cjs +1 -1
  12. package/dist/controllers/contextMenuController.js +40 -32
  13. package/dist/controllers/editController.cjs +1 -1
  14. package/dist/controllers/editController.js +90 -84
  15. package/dist/controllers/findController.cjs +1 -1
  16. package/dist/controllers/findController.js +71 -71
  17. package/dist/controllers/imeInputController.cjs +1 -1
  18. package/dist/controllers/imeInputController.js +68 -65
  19. package/dist/controllers/keyboardController.cjs +1 -1
  20. package/dist/controllers/keyboardController.d.ts +3 -0
  21. package/dist/controllers/keyboardController.js +184 -91
  22. package/dist/controllers/pointerInteractionsController.cjs +1 -1
  23. package/dist/controllers/pointerInteractionsController.js +11 -2
  24. package/dist/controllers/popoverSupport.cjs +1 -1
  25. package/dist/controllers/popoverSupport.d.ts +1 -0
  26. package/dist/controllers/popoverSupport.js +14 -2
  27. package/dist/controllers/rowDragController.cjs +1 -1
  28. package/dist/controllers/rowDragController.d.ts +2 -0
  29. package/dist/controllers/rowDragController.js +222 -138
  30. package/dist/controllers/rowEnterController.cjs +1 -1
  31. package/dist/controllers/rowEnterController.js +49 -47
  32. package/dist/controllers/saveStatusController.cjs +1 -1
  33. package/dist/controllers/saveStatusController.js +101 -48
  34. package/dist/controllers/serverSideRowModel.cjs +1 -1
  35. package/dist/controllers/serverSideRowModel.d.ts +1 -0
  36. package/dist/controllers/serverSideRowModel.js +199 -130
  37. package/dist/controllers/tooltipController.cjs +1 -1
  38. package/dist/controllers/tooltipController.js +38 -21
  39. package/dist/controllers/viewportSyncController.cjs +1 -1
  40. package/dist/controllers/viewportSyncController.d.ts +2 -1
  41. package/dist/controllers/viewportSyncController.js +3 -2
  42. package/dist/engine/columnLayout.cjs +1 -1
  43. package/dist/engine/columnLayout.d.ts +1 -0
  44. package/dist/engine/columnLayout.js +12 -11
  45. package/dist/engine/exportCommands.cjs +1 -1
  46. package/dist/engine/exportCommands.js +27 -25
  47. package/dist/engine/filterPopoverCommands.cjs +1 -1
  48. package/dist/engine/filterPopoverCommands.js +12 -7
  49. package/dist/engine/gridApi.cjs +1 -1
  50. package/dist/engine/gridApi.d.ts +4 -1
  51. package/dist/engine/gridApi.js +175 -129
  52. package/dist/engine/notifiers.cjs +1 -1
  53. package/dist/engine/notifiers.d.ts +1 -0
  54. package/dist/engine/notifiers.js +10 -5
  55. package/dist/logic/conditionalFormat.cjs +1 -1
  56. package/dist/logic/conditionalFormat.js +2 -2
  57. package/dist/logic/detailRow.cjs +1 -1
  58. package/dist/logic/detailRow.d.ts +1 -0
  59. package/dist/logic/detailRow.js +9 -4
  60. package/dist/logic/domGuards.cjs +1 -1
  61. package/dist/logic/domGuards.d.ts +4 -0
  62. package/dist/logic/domGuards.js +2 -2
  63. package/dist/logic/editorValues.cjs +1 -1
  64. package/dist/logic/editorValues.d.ts +2 -0
  65. package/dist/logic/editorValues.js +19 -9
  66. package/dist/logic/fillSeries.cjs +1 -1
  67. package/dist/logic/fillSeries.js +43 -36
  68. package/dist/logic/filterSummary.cjs +1 -1
  69. package/dist/logic/filterSummary.d.ts +9 -3
  70. package/dist/logic/filterSummary.js +39 -13
  71. package/dist/logic/find.cjs +1 -1
  72. package/dist/logic/find.d.ts +1 -0
  73. package/dist/logic/find.js +6 -6
  74. package/dist/logic/gridAsk.cjs +1 -1
  75. package/dist/logic/gridAsk.js +106 -106
  76. package/dist/logic/gridState.cjs +1 -1
  77. package/dist/logic/gridState.d.ts +14 -0
  78. package/dist/logic/gridState.js +114 -62
  79. package/dist/logic/numberFilterCondition.cjs +1 -1
  80. package/dist/logic/numberFilterCondition.d.ts +1 -1
  81. package/dist/logic/numberFilterCondition.js +12 -9
  82. package/dist/logic/selectionAggregates.cjs +1 -1
  83. package/dist/logic/selectionAggregates.js +5 -2
  84. package/dist/logic/serverSideEdits.cjs +1 -1
  85. package/dist/logic/serverSideEdits.d.ts +16 -2
  86. package/dist/logic/serverSideEdits.js +60 -14
  87. package/dist/logic/urgentFilters.cjs +1 -0
  88. package/dist/logic/urgentFilters.d.ts +3 -0
  89. package/dist/logic/urgentFilters.js +6 -0
  90. package/dist/logic/validation.cjs +1 -1
  91. package/dist/logic/validation.d.ts +1 -1
  92. package/dist/logic/validation.js +10 -10
  93. package/dist/logic/valueFormatters.d.ts +2 -1
  94. package/dist/model/gridStore.cjs +1 -1
  95. package/dist/model/gridStore.d.ts +1 -0
  96. package/dist/model/gridStore.js +2 -1
  97. package/dist/model/gridTypes.core.d.ts +92 -16
  98. package/dist/utils/clipboard.cjs +5 -5
  99. package/dist/utils/clipboard.d.ts +3 -0
  100. package/dist/utils/clipboard.js +58 -65
  101. package/dist/utils/permissions.cjs +1 -1
  102. package/dist/utils/permissions.js +5 -3
  103. 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("../logic/valueStore.cjs"),t=require("./popoverSupport.cjs");var n=200,r=8,i=6,a=289,o=()=>{let o=null,s=e.createValueStore({columnKey:null,layout:null}),c={current:null},l=null,u=null,d=null,f=null,p=e=>{let t=s.getSnapshot(),n=t.layout;n===e||n!==null&&e!==null&&n.top===e.top&&n.left===e.left&&n.width===e.width&&n.maxHeight===e.maxHeight||s.setSnapshot({...t,layout:e})},m=()=>{f!==null&&(cancelAnimationFrame(f),f=null),v.detach(),s.setSnapshot({columnKey:null,layout:null})},h=()=>{if(s.getSnapshot().columnKey===null){p(null);return}let e,t,o,d=c.current,f=d?d.scrollHeight+(d.offsetHeight-d.clientHeight):a;if(l){if(!l.isConnected){l=null,m();return}let r=l.getBoundingClientRect();t=r.right-n,e=r.bottom+i,o=r.top-f-i}else if(u)t=u.x,e=u.y,o=u.y-f;else{p(null);return}t=Math.max(r,t),t=Math.min(t,window.innerWidth-n-r);let h=window.innerHeight-r;e+f>h&&o>=r&&(e=o),e=Math.max(r,e);let g=h-e;p({top:e,left:t,width:n,maxHeight:f>g?Math.max(g,0):void 0})},g=e=>{m(),l=null,u=null,o!==null&&e&&t.restoreGridFocus(o.gridRootRef)},_=()=>g(!0),v=t.createPopoverWindowBindings({onResize:h,onScroll:()=>{if(u){_();return}h()},isInside:e=>c.current?.contains(e)===!0||l?.contains(e)===!0,onOutsidePointerDown:e=>g(o!==null&&t.isInsideGridRoot(o.gridRootRef,e)),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),_())}}),y=e=>{s.setSnapshot({...s.getSnapshot(),columnKey:e}),h(),f!==null&&cancelAnimationFrame(f),f=requestAnimationFrame(()=>{f=null,h()}),v.attach()},b=(e,n)=>{t.blurForPopover(o?.gridRootRef.current??null),l=n,u=null,y(e.key)};return{update:e=>{o=e},subscribe:s.subscribe,getSnapshot:s.getSnapshot,panelRef:c,openFromButton:(e,t)=>{if(t.preventDefault(),t.stopPropagation(),!o?.enableColumnMenu||t.button!==0)return;let n=t.currentTarget;if(s.getSnapshot().columnKey===e.key&&l===n){_();return}if(t.pointerType===`touch`){d=n;return}b(e,n)},openFromButtonClick:(e,t)=>{let n=d;d=null,!(!o?.enableColumnMenu||n!==t.currentTarget)&&(t.preventDefault(),t.stopPropagation(),b(e,t.currentTarget))},openFromContextMenu:(e,n)=>{o?.enableColumnMenu&&(n.preventDefault(),n.stopPropagation(),t.blurForPopover(o.gridRootRef.current),l=null,u={x:n.clientX,y:n.clientY},y(e.key))},close:_,dispose:()=>{f!==null&&(cancelAnimationFrame(f),f=null),v.detach()}}};exports.createColumnMenuController=o;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("./popoverSupport.cjs");var n=200,r=`.ssg-menu-item`,i=8,a=6,o=289,s=()=>{let s=null,c=e.createValueStore({columnKey:null,layout:null}),l={current:null},u=null,d=!1,f=null,p=null,m=null,h=e=>{let t=c.getSnapshot(),n=t.layout;n===e||n!==null&&e!==null&&n.top===e.top&&n.left===e.left&&n.width===e.width&&n.maxHeight===e.maxHeight||c.setSnapshot({...t,layout:e})},g=()=>{m!==null&&(cancelAnimationFrame(m),m=null),b.detach(),c.setSnapshot({columnKey:null,layout:null})},_=()=>{if(c.getSnapshot().columnKey===null){h(null);return}let e,t,r,s=l.current,d=s?s.scrollHeight+(s.offsetHeight-s.clientHeight):o;if(u){if(!u.isConnected){u=null,g();return}let i=u.getBoundingClientRect();t=i.right-n,e=i.bottom+a,r=i.top-d-a}else if(f)t=f.x,e=f.y,r=f.y-d;else{h(null);return}t=Math.max(i,t),t=Math.min(t,window.innerWidth-n-i);let p=window.innerHeight-i;e+d>p&&r>=i&&(e=r),e=Math.max(i,e);let m=p-e;h({top:e,left:t,width:n,maxHeight:d>m?Math.max(m,0):void 0})},v=e=>{g(),u=null,f=null,s!==null&&e&&t.restoreGridFocus(s.gridRootRef)},y=()=>v(!0),b=t.createPopoverWindowBindings({onResize:_,onScroll:()=>{if(f){y();return}_()},isInside:e=>l.current?.contains(e)===!0||u?.contains(e)===!0,onOutsidePointerDown:e=>v(s!==null&&t.isInsideGridRoot(s.gridRootRef,e)),onKeyDown:e=>{if(e.key===`Escape`){e.preventDefault(),y();return}let n=l.current;if(!n||t.handleMenuKeyNavigation(n,e,r))return;let i=document.activeElement;e.key===`Tab`&&i instanceof HTMLElement&&i.matches(r)&&n.contains(i)&&(e.preventDefault(),y())}}),x=e=>{c.setSnapshot({...c.getSnapshot(),columnKey:e}),_(),m!==null&&cancelAnimationFrame(m),m=requestAnimationFrame(()=>{m=null,_(),d&&(d=!1,l.current?.querySelector(r)?.focus())}),b.attach()},S=(e,n,r=!1)=>{t.blurForPopover(s?.gridRootRef.current??null),u=n,f=null,d=r,x(e.key)};return{update:e=>{s=e},subscribe:c.subscribe,getSnapshot:c.getSnapshot,panelRef:l,openFromButton:(e,t)=>{if(t.preventDefault(),t.stopPropagation(),!s?.enableColumnMenu||t.button!==0)return;let n=t.currentTarget;if(c.getSnapshot().columnKey===e.key&&u===n){y();return}if(t.pointerType===`touch`){p=n;return}S(e,n)},openFromButtonClick:(e,t)=>{let n=p;p=null;let r=n===null&&t.detail===0;!s?.enableColumnMenu||n!==t.currentTarget&&!r||(t.preventDefault(),t.stopPropagation(),S(e,t.currentTarget,r))},openFromContextMenu:(e,n)=>{s?.enableColumnMenu&&(n.preventDefault(),n.stopPropagation(),t.blurForPopover(s.gridRootRef.current),u=null,f={x:n.clientX,y:n.clientY},d=!1,x(e.key))},openFromKeyboard:(e,t)=>{s?.enableColumnMenu&&S(e,t,!0)},close:y,dispose:()=>{m!==null&&(cancelAnimationFrame(m),m=null),b.detach()}}};exports.createColumnMenuController=s;
@@ -24,6 +24,7 @@ export type MenuButtonPointerEvent = {
24
24
  };
25
25
  export type MenuButtonClickEvent = {
26
26
  currentTarget: HTMLButtonElement;
27
+ detail: number;
27
28
  preventDefault: () => void;
28
29
  stopPropagation: () => void;
29
30
  };
@@ -43,6 +44,7 @@ export type ColumnMenuController<T> = {
43
44
  openFromButton: (column: GridColumn<T>, event: MenuButtonPointerEvent) => void;
44
45
  openFromButtonClick: (column: GridColumn<T>, event: MenuButtonClickEvent) => void;
45
46
  openFromContextMenu: (column: GridColumn<T>, event: MenuContextEvent) => void;
47
+ openFromKeyboard: (column: GridColumn<T>, anchor: HTMLElement) => void;
46
48
  close: () => void;
47
49
  dispose: () => void;
48
50
  };
@@ -1,110 +1,122 @@
1
1
  import { createValueStore as e } from "../logic/valueStore.js";
2
- import { blurForPopover as t, createPopoverWindowBindings as n, isInsideGridRoot as r, restoreGridFocus as i } from "./popoverSupport.js";
2
+ import { blurForPopover as t, createPopoverWindowBindings as n, handleMenuKeyNavigation as r, isInsideGridRoot as i, restoreGridFocus as a } from "./popoverSupport.js";
3
3
  //#region src/controllers/columnMenuController.ts
4
- var a = 200, o = 8, s = 6, c = 289, l = () => {
5
- let l = null, u = e({
4
+ var o = 200, s = ".ssg-menu-item", c = 8, l = 6, u = 289, d = () => {
5
+ let d = null, f = e({
6
6
  columnKey: null,
7
7
  layout: null
8
- }), d = { current: null }, f = null, p = null, m = null, h = null, g = (e) => {
9
- let t = u.getSnapshot(), n = t.layout;
10
- n === e || n !== null && e !== null && n.top === e.top && n.left === e.left && n.width === e.width && n.maxHeight === e.maxHeight || u.setSnapshot({
8
+ }), p = { current: null }, m = null, h = !1, g = null, _ = null, v = null, y = (e) => {
9
+ let t = f.getSnapshot(), n = t.layout;
10
+ n === e || n !== null && e !== null && n.top === e.top && n.left === e.left && n.width === e.width && n.maxHeight === e.maxHeight || f.setSnapshot({
11
11
  ...t,
12
12
  layout: e
13
13
  });
14
- }, _ = () => {
15
- h !== null && (cancelAnimationFrame(h), h = null), x.detach(), u.setSnapshot({
14
+ }, b = () => {
15
+ v !== null && (cancelAnimationFrame(v), v = null), w.detach(), f.setSnapshot({
16
16
  columnKey: null,
17
17
  layout: null
18
18
  });
19
- }, v = () => {
20
- if (u.getSnapshot().columnKey === null) {
21
- g(null);
19
+ }, x = () => {
20
+ if (f.getSnapshot().columnKey === null) {
21
+ y(null);
22
22
  return;
23
23
  }
24
- let e, t, n, r = d.current, i = r ? r.scrollHeight + (r.offsetHeight - r.clientHeight) : c;
25
- if (f) {
26
- if (!f.isConnected) {
27
- f = null, _();
24
+ let e, t, n, r = p.current, i = r ? r.scrollHeight + (r.offsetHeight - r.clientHeight) : u;
25
+ if (m) {
26
+ if (!m.isConnected) {
27
+ m = null, b();
28
28
  return;
29
29
  }
30
- let r = f.getBoundingClientRect();
31
- t = r.right - a, e = r.bottom + s, n = r.top - i - s;
32
- } else if (p) t = p.x, e = p.y, n = p.y - i;
30
+ let r = m.getBoundingClientRect();
31
+ t = r.right - o, e = r.bottom + l, n = r.top - i - l;
32
+ } else if (g) t = g.x, e = g.y, n = g.y - i;
33
33
  else {
34
- g(null);
34
+ y(null);
35
35
  return;
36
36
  }
37
- t = Math.max(o, t), t = Math.min(t, window.innerWidth - a - o);
38
- let l = window.innerHeight - o;
39
- e + i > l && n >= o && (e = n), e = Math.max(o, e);
40
- let m = l - e;
41
- g({
37
+ t = Math.max(c, t), t = Math.min(t, window.innerWidth - o - c);
38
+ let a = window.innerHeight - c;
39
+ e + i > a && n >= c && (e = n), e = Math.max(c, e);
40
+ let s = a - e;
41
+ y({
42
42
  top: e,
43
43
  left: t,
44
- width: a,
45
- maxHeight: i > m ? Math.max(m, 0) : void 0
44
+ width: o,
45
+ maxHeight: i > s ? Math.max(s, 0) : void 0
46
46
  });
47
- }, y = (e) => {
48
- _(), f = null, p = null, l !== null && e && i(l.gridRootRef);
49
- }, b = () => y(!0), x = n({
50
- onResize: v,
47
+ }, S = (e) => {
48
+ b(), m = null, g = null, d !== null && e && a(d.gridRootRef);
49
+ }, C = () => S(!0), w = n({
50
+ onResize: x,
51
51
  onScroll: () => {
52
- if (p) {
53
- b();
52
+ if (g) {
53
+ C();
54
54
  return;
55
55
  }
56
- v();
56
+ x();
57
57
  },
58
- isInside: (e) => d.current?.contains(e) === !0 || f?.contains(e) === !0,
59
- onOutsidePointerDown: (e) => y(l !== null && r(l.gridRootRef, e)),
58
+ isInside: (e) => p.current?.contains(e) === !0 || m?.contains(e) === !0,
59
+ onOutsidePointerDown: (e) => S(d !== null && i(d.gridRootRef, e)),
60
60
  onKeyDown: (e) => {
61
- e.key === "Escape" && (e.preventDefault(), b());
61
+ if (e.key === "Escape") {
62
+ e.preventDefault(), C();
63
+ return;
64
+ }
65
+ let t = p.current;
66
+ if (!t || r(t, e, s)) return;
67
+ let n = document.activeElement;
68
+ e.key === "Tab" && n instanceof HTMLElement && n.matches(s) && t.contains(n) && (e.preventDefault(), C());
62
69
  }
63
- }), S = (e) => {
64
- u.setSnapshot({
65
- ...u.getSnapshot(),
70
+ }), T = (e) => {
71
+ f.setSnapshot({
72
+ ...f.getSnapshot(),
66
73
  columnKey: e
67
- }), v(), h !== null && cancelAnimationFrame(h), h = requestAnimationFrame(() => {
68
- h = null, v();
69
- }), x.attach();
70
- }, C = (e, n) => {
71
- t(l?.gridRootRef.current ?? null), f = n, p = null, S(e.key);
74
+ }), x(), v !== null && cancelAnimationFrame(v), v = requestAnimationFrame(() => {
75
+ v = null, x(), h && (h = !1, p.current?.querySelector(s)?.focus());
76
+ }), w.attach();
77
+ }, E = (e, n, r = !1) => {
78
+ t(d?.gridRootRef.current ?? null), m = n, g = null, h = r, T(e.key);
72
79
  };
73
80
  return {
74
81
  update: (e) => {
75
- l = e;
82
+ d = e;
76
83
  },
77
- subscribe: u.subscribe,
78
- getSnapshot: u.getSnapshot,
79
- panelRef: d,
84
+ subscribe: f.subscribe,
85
+ getSnapshot: f.getSnapshot,
86
+ panelRef: p,
80
87
  openFromButton: (e, t) => {
81
- if (t.preventDefault(), t.stopPropagation(), !l?.enableColumnMenu || t.button !== 0) return;
88
+ if (t.preventDefault(), t.stopPropagation(), !d?.enableColumnMenu || t.button !== 0) return;
82
89
  let n = t.currentTarget;
83
- if (u.getSnapshot().columnKey === e.key && f === n) {
84
- b();
90
+ if (f.getSnapshot().columnKey === e.key && m === n) {
91
+ C();
85
92
  return;
86
93
  }
87
94
  if (t.pointerType === "touch") {
88
- m = n;
95
+ _ = n;
89
96
  return;
90
97
  }
91
- C(e, n);
98
+ E(e, n);
92
99
  },
93
100
  openFromButtonClick: (e, t) => {
94
- let n = m;
95
- m = null, !(!l?.enableColumnMenu || n !== t.currentTarget) && (t.preventDefault(), t.stopPropagation(), C(e, t.currentTarget));
101
+ let n = _;
102
+ _ = null;
103
+ let r = n === null && t.detail === 0;
104
+ !d?.enableColumnMenu || n !== t.currentTarget && !r || (t.preventDefault(), t.stopPropagation(), E(e, t.currentTarget, r));
96
105
  },
97
106
  openFromContextMenu: (e, n) => {
98
- l?.enableColumnMenu && (n.preventDefault(), n.stopPropagation(), t(l.gridRootRef.current), f = null, p = {
107
+ d?.enableColumnMenu && (n.preventDefault(), n.stopPropagation(), t(d.gridRootRef.current), m = null, g = {
99
108
  x: n.clientX,
100
109
  y: n.clientY
101
- }, S(e.key));
110
+ }, h = !1, T(e.key));
111
+ },
112
+ openFromKeyboard: (e, t) => {
113
+ d?.enableColumnMenu && E(e, t, !0);
102
114
  },
103
- close: b,
115
+ close: C,
104
116
  dispose: () => {
105
- h !== null && (cancelAnimationFrame(h), h = null), x.detach();
117
+ v !== null && (cancelAnimationFrame(v), v = null), w.detach();
106
118
  }
107
119
  };
108
120
  };
109
121
  //#endregion
110
- export { l as createColumnMenuController };
122
+ export { d as createColumnMenuController };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("./popoverSupport.cjs");var n=220,r=8,i=34,a=16,o=()=>{let o=null,s=e.createValueStore({state:null,layout:null}),c={current:null},l=null,u=0,d=e=>{let t=s.getSnapshot();t.layout===e||t.layout!==null&&e!==null&&t.layout.top===e.top&&t.layout.left===e.left&&t.layout.width===e.width||s.setSnapshot({...t,layout:e})},f=()=>{if(!l){d(null);return}let e=u*i+a,t=l.x,o=l.y,s=l.y-e;t=Math.max(r,t),t=Math.min(t,window.innerWidth-n-r),o+e>window.innerHeight-r&&(o=s),o=Math.max(r,o),d({top:o,left:t,width:n})},p=e=>{s.setSnapshot({state:null,layout:null}),l=null,u=0,h.detach(),o!==null&&e&&t.restoreGridFocus(o.gridRootRef)},m=()=>p(!0),h=t.createPopoverWindowBindings({onResize:f,onScroll:m,isInside:e=>c.current?.contains(e)===!0,onOutsidePointerDown:e=>p(o!==null&&t.isInsideGridRoot(o.gridRootRef,e)),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),m())}});return{update:e=>{o=e},subscribe:s.subscribe,getSnapshot:s.getSnapshot,panelRef:c,open:(e,n)=>{t.blurForPopover(o?.gridRootRef.current??null),l={x:e.clientX,y:e.clientY},u=n.length,s.setSnapshot({...s.getSnapshot(),state:{params:e,items:n}}),f(),h.attach()},close:m,dispose:()=>{h.detach()}}};exports.createContextMenuController=o;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("./popoverSupport.cjs");var n=220,r=8,i=34,a=16,o=()=>{let o=null,s=e.createValueStore({state:null,layout:null}),c={current:null},l=null,u=0,d=e=>{let t=s.getSnapshot();t.layout===e||t.layout!==null&&e!==null&&t.layout.top===e.top&&t.layout.left===e.left&&t.layout.width===e.width||s.setSnapshot({...t,layout:e})},f=()=>{if(!l){d(null);return}let e=u*i+a,t=l.x,o=l.y,s=l.y-e;t=Math.max(r,t),t=Math.min(t,window.innerWidth-n-r),o+e>window.innerHeight-r&&(o=s),o=Math.max(r,o),d({top:o,left:t,width:n})},p=e=>{s.setSnapshot({state:null,layout:null}),l=null,u=0,h.detach(),o!==null&&e&&t.restoreGridFocus(o.gridRootRef)},m=()=>p(!0),h=t.createPopoverWindowBindings({onResize:f,onScroll:m,isInside:e=>c.current?.contains(e)===!0,onOutsidePointerDown:e=>p(o!==null&&t.isInsideGridRoot(o.gridRootRef,e)),onKeyDown:e=>{if(e.key===`Escape`){e.preventDefault(),m();return}let n=c.current;if(!(!n||t.handleMenuKeyNavigation(n,e))&&e.key===`Tab`){let t=document.activeElement;(!(t instanceof HTMLElement&&n.contains(t))||t.getAttribute(`role`)===`menuitem`)&&(e.preventDefault(),m())}}});return{update:e=>{o=e},subscribe:s.subscribe,getSnapshot:s.getSnapshot,panelRef:c,open:(e,n)=>{t.blurForPopover(o?.gridRootRef.current??null),l={x:e.clientX,y:e.clientY},u=n.length,s.setSnapshot({...s.getSnapshot(),state:{params:e,items:n}}),f(),h.attach()},close:m,dispose:()=>{h.detach()}}};exports.createContextMenuController=o;