@ishibashi0112/spreadsheet-grid-core 0.61.0 → 0.63.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 (132) hide show
  1. package/dist/controllers/autoHeightMeasurer.cjs +1 -1
  2. package/dist/controllers/autoHeightMeasurer.d.ts +1 -0
  3. package/dist/controllers/autoHeightMeasurer.js +59 -48
  4. package/dist/controllers/columnHeaderDragController.cjs +1 -1
  5. package/dist/controllers/columnHeaderDragController.js +119 -115
  6. package/dist/controllers/columnMenuController.cjs +1 -1
  7. package/dist/controllers/columnMenuController.d.ts +2 -0
  8. package/dist/controllers/columnMenuController.js +74 -60
  9. package/dist/controllers/contextMenuController.cjs +1 -1
  10. package/dist/controllers/contextMenuController.js +42 -32
  11. package/dist/controllers/detailTabOrder.cjs +1 -0
  12. package/dist/controllers/detailTabOrder.d.ts +4 -0
  13. package/dist/controllers/detailTabOrder.js +33 -0
  14. package/dist/controllers/fillHandleController.cjs +1 -1
  15. package/dist/controllers/fillHandleController.js +119 -117
  16. package/dist/controllers/filterPopoverController.cjs +1 -1
  17. package/dist/controllers/filterPopoverController.d.ts +1 -0
  18. package/dist/controllers/filterPopoverController.js +4 -2
  19. package/dist/controllers/imeInputController.cjs +1 -1
  20. package/dist/controllers/imeInputController.js +1 -1
  21. package/dist/controllers/keyboardController.cjs +1 -1
  22. package/dist/controllers/keyboardController.d.ts +5 -0
  23. package/dist/controllers/keyboardController.js +182 -86
  24. package/dist/controllers/pointerInteractionsController.cjs +1 -1
  25. package/dist/controllers/pointerInteractionsController.d.ts +1 -0
  26. package/dist/controllers/pointerInteractionsController.js +33 -17
  27. package/dist/controllers/popoverSupport.cjs +1 -1
  28. package/dist/controllers/popoverSupport.d.ts +3 -0
  29. package/dist/controllers/popoverSupport.js +25 -5
  30. package/dist/controllers/rowDragController.cjs +1 -1
  31. package/dist/controllers/rowDragController.js +166 -121
  32. package/dist/controllers/saveStatusController.cjs +1 -1
  33. package/dist/controllers/saveStatusController.js +71 -25
  34. package/dist/controllers/serverSideRowModel.cjs +1 -1
  35. package/dist/controllers/serverSideRowModel.d.ts +1 -0
  36. package/dist/controllers/serverSideRowModel.js +180 -133
  37. package/dist/controllers/toolPanelController.cjs +1 -1
  38. package/dist/controllers/toolPanelController.js +2 -0
  39. package/dist/controllers/tooltipController.cjs +1 -1
  40. package/dist/controllers/tooltipController.js +54 -53
  41. package/dist/controllers/viewportSyncController.cjs +1 -1
  42. package/dist/controllers/viewportSyncController.d.ts +3 -1
  43. package/dist/controllers/viewportSyncController.js +4 -4
  44. package/dist/engine/columnCommands.cjs +1 -1
  45. package/dist/engine/columnCommands.d.ts +2 -0
  46. package/dist/engine/columnCommands.js +71 -31
  47. package/dist/engine/columnLayout.cjs +1 -1
  48. package/dist/engine/columnLayout.js +15 -14
  49. package/dist/engine/createGridEngine.cjs +1 -1
  50. package/dist/engine/createGridEngine.d.ts +3 -1
  51. package/dist/engine/createGridEngine.js +71 -49
  52. package/dist/engine/exportCommands.cjs +1 -1
  53. package/dist/engine/exportCommands.d.ts +2 -1
  54. package/dist/engine/exportCommands.js +117 -92
  55. package/dist/engine/features.d.ts +3 -1
  56. package/dist/engine/fullFeatures.cjs +1 -1
  57. package/dist/engine/fullFeatures.js +23 -21
  58. package/dist/engine/gridApi.cjs +1 -1
  59. package/dist/engine/gridApi.d.ts +10 -2
  60. package/dist/engine/gridApi.js +389 -297
  61. package/dist/engine/notifiers.cjs +1 -1
  62. package/dist/engine/notifiers.d.ts +1 -0
  63. package/dist/engine/notifiers.js +10 -5
  64. package/dist/engine/rowPipeline.cjs +1 -1
  65. package/dist/engine/rowPipeline.d.ts +2 -0
  66. package/dist/engine/rowPipeline.js +6 -6
  67. package/dist/index.cjs +1 -1
  68. package/dist/index.d.ts +1 -0
  69. package/dist/index.js +7 -6
  70. package/dist/logic/columnAutosize.cjs +1 -1
  71. package/dist/logic/columnAutosize.js +84 -84
  72. package/dist/logic/columnWidthState.cjs +1 -1
  73. package/dist/logic/columnWidthState.js +25 -20
  74. package/dist/logic/detailRow.cjs +1 -1
  75. package/dist/logic/detailRow.d.ts +12 -0
  76. package/dist/logic/detailRow.js +42 -4
  77. package/dist/logic/editorValues.cjs +1 -1
  78. package/dist/logic/editorValues.js +14 -13
  79. package/dist/logic/exportCsv.cjs +2 -2
  80. package/dist/logic/exportCsv.d.ts +3 -1
  81. package/dist/logic/exportCsv.js +15 -10
  82. package/dist/logic/exportData.cjs +1 -1
  83. package/dist/logic/exportData.d.ts +3 -1
  84. package/dist/logic/exportData.js +23 -15
  85. package/dist/logic/filterSummary.cjs +1 -1
  86. package/dist/logic/filterSummary.d.ts +9 -3
  87. package/dist/logic/filterSummary.js +39 -13
  88. package/dist/logic/gridAsk.cjs +1 -1
  89. package/dist/logic/gridAsk.js +106 -106
  90. package/dist/logic/gridState.cjs +1 -1
  91. package/dist/logic/gridState.d.ts +19 -0
  92. package/dist/logic/gridState.js +93 -53
  93. package/dist/logic/groupExport.cjs +1 -0
  94. package/dist/logic/groupExport.d.ts +15 -0
  95. package/dist/logic/groupExport.js +40 -0
  96. package/dist/logic/grouping.cjs +1 -1
  97. package/dist/logic/grouping.d.ts +2 -2
  98. package/dist/logic/grouping.js +58 -40
  99. package/dist/logic/localeText.cjs +1 -0
  100. package/dist/logic/localeText.d.ts +4 -0
  101. package/dist/logic/localeText.js +45 -0
  102. package/dist/logic/numberFilterCondition.cjs +1 -1
  103. package/dist/logic/numberFilterCondition.d.ts +1 -1
  104. package/dist/logic/numberFilterCondition.js +12 -9
  105. package/dist/logic/scrollTargets.cjs +1 -1
  106. package/dist/logic/scrollTargets.d.ts +6 -1
  107. package/dist/logic/scrollTargets.js +8 -8
  108. package/dist/logic/theme.cjs +1 -1
  109. package/dist/logic/theme.d.ts +2 -0
  110. package/dist/logic/theme.js +2 -2
  111. package/dist/logic/urgentFilters.cjs +1 -0
  112. package/dist/logic/urgentFilters.d.ts +3 -0
  113. package/dist/logic/urgentFilters.js +6 -0
  114. package/dist/logic/validation.cjs +1 -1
  115. package/dist/logic/validation.d.ts +1 -1
  116. package/dist/logic/validation.js +10 -10
  117. package/dist/logic/valueFormatters.d.ts +2 -1
  118. package/dist/model/gridActions.cjs +1 -1
  119. package/dist/model/gridActions.d.ts +4 -2
  120. package/dist/model/gridActions.js +12 -4
  121. package/dist/model/gridReducer.cjs +1 -1
  122. package/dist/model/gridReducer.js +2 -2
  123. package/dist/model/gridStore.cjs +1 -1
  124. package/dist/model/gridStore.d.ts +1 -0
  125. package/dist/model/gridStore.js +2 -1
  126. package/dist/model/gridTypes.core.d.ts +244 -40
  127. package/dist/utils/permissions.cjs +1 -1
  128. package/dist/utils/permissions.js +5 -3
  129. package/dist/utils/portalTokens.cjs +1 -0
  130. package/dist/utils/portalTokens.d.ts +3 -0
  131. package/dist/utils/portalTokens.js +65 -0
  132. package/package.json +1 -1
@@ -2,8 +2,9 @@ import { isInsideDetailCardOf as e, isSyntheticColumnKey as t } from "../logic/d
2
2
  import { findPaneDropSlot as n, getColumnPane as r, paneDropSlotBoundaryX as i } from "../logic/geometry.js";
3
3
  import { computeNextScrollPosition as a, hasPointerLeftActivationRadius as o, resolveAutoScrollAxisDirection as s, resolveScrollContentBox as c } from "../logic/autoScrollGeometry.js";
4
4
  import { applySlotToElement as l } from "../logic/slotDom.js";
5
+ import { syncPortalTokens as u } from "../utils/portalTokens.js";
5
6
  //#region src/controllers/columnHeaderDragController.ts
6
- function u(e, t, n, i) {
7
+ function d(e, t, n, i) {
7
8
  let a = e.find((e) => e.key === t);
8
9
  if (!a) return null;
9
10
  let o = r(a), s = {
@@ -26,7 +27,7 @@ function u(e, t, n, i) {
26
27
  ...s.right
27
28
  ];
28
29
  }
29
- function d(e, n, i, a) {
30
+ function f(e, n, i, a) {
30
31
  let o = e.filter((e) => r(e) === i && e.visible !== !1).map((e) => e.key), { entries: s } = n;
31
32
  for (let e = Math.max(a, 0); e < s.length; e += 1) {
32
33
  let n = s[e].column.key;
@@ -36,22 +37,22 @@ function d(e, n, i, a) {
36
37
  }
37
38
  return o.length;
38
39
  }
39
- var f = (e) => {
40
+ var p = (e) => {
40
41
  let n = 0;
41
42
  for (; n < e.entries.length && t(e.entries[n].column.key);) n += 1;
42
43
  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, 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
+ }, m = 32, h = 2, g = 14, _ = 12, v = 14, 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\"><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>", ee = (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>", te = y(v), ne = ee(v), re = "<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>", ie = "0.5", ae = 200, b = "cubic-bezier(0.2, 0.7, 0.3, 1)", oe = (e) => e?.closest(".ssg-motion-off") != null, se = 160, ce = `transform ${se}ms ${b}`, x = "data-ssg-col-dragging", le = "4", ue = "9", de = "ssg-col-drag-float", fe = "ssg-col-drag-pin", S = 12, pe = "ssg-col-drop-indicator", me = "ssg-header-cell", he = [
44
45
  "data-ssg-col-key",
45
46
  "data-ssg-tooltip",
46
47
  "data-autoheight-cell",
47
48
  "id",
48
49
  "tabindex"
49
- ], he = 180, ge = 400, C = (t) => {
50
+ ], ge = 180, _e = 400, C = (t) => {
50
51
  let n = [];
51
52
  return t.querySelectorAll("[data-ssg-col-key]").forEach((r) => {
52
53
  e(t, r) || n.push(r);
53
54
  }), n;
54
- }, _e = (t) => {
55
+ }, ve = (t) => {
55
56
  if (!t) return null;
56
57
  let n = /* @__PURE__ */ new Map();
57
58
  return t.querySelectorAll("[data-ssg-col-key]").forEach((r) => {
@@ -59,25 +60,25 @@ var f = (e) => {
59
60
  let i = r.dataset.ssgColKey;
60
61
  i && !n.has(i) && n.set(i, r.getBoundingClientRect().left);
61
62
  }), n;
62
- }, ve = (e) => {
63
+ }, ye = (e) => {
63
64
  let t = getComputedStyle(e).transform, n = /^matrix(3d)?\(([^)]*)\)$/.exec(t);
64
65
  if (n === null) return 0;
65
66
  let r = Number(n[2].split(",")[n[1] === "3d" ? 12 : 4]);
66
67
  return Number.isFinite(r) ? r : 0;
67
68
  }, w = () => {
68
- let t = null, _ = null, w = null, T = null, E = {
69
+ let t = null, v = null, w = null, T = null, E = {
69
70
  x: 0,
70
71
  y: 0
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
+ }, D = null, O = !1, k = null, A = null, j = null, M = null, N = null, P = null, F = null, I = null, be = 0, L = null, R = null, z = "", B = null, xe = 0, V = null, H = null, Se = () => t?.motion === "live", U = () => ({
72
73
  left: t?.leftIndicatorRef.current ?? null,
73
74
  center: t?.centerIndicatorRef.current ?? null,
74
75
  right: t?.rightIndicatorRef.current ?? null
75
- }), G = () => {
76
- for (let e of Object.values(W())) e && (e.style.display = "none");
77
- }, xe = (e) => {
76
+ }), W = () => {
77
+ for (let e of Object.values(U())) e && (e.style.display = "none");
78
+ }, Ce = (e) => {
78
79
  if (N) return;
79
80
  let n = document.createElement("div");
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
+ 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-theme-class") != null && n.classList.add("ssg-theme-class"), t?.scrollContainerRef.current?.closest(".ssg-motion-off") != null && n.classList.add("ssg-motion-off"), n.style.cssText = [
81
82
  "position:fixed",
82
83
  "top:0",
83
84
  "left:0",
@@ -103,35 +104,35 @@ var f = (e) => {
103
104
  let r = document.createElement("span");
104
105
  r.style.cssText = "display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none";
105
106
  let i = document.createElement("span");
106
- i.textContent = e, n.appendChild(r), n.appendChild(i), document.body.appendChild(n), N = n, P = r, F = null;
107
- }, Se = (e) => {
107
+ i.textContent = e, n.appendChild(r), n.appendChild(i), document.body.appendChild(n), u(t?.scrollContainerRef.current, n), N = n, P = r, F = null;
108
+ }, we = (e) => {
108
109
  let t = N;
109
110
  if (!t) return;
110
- t.style.transform = "translate(" + (E.x + h) + "px," + (E.y + g) + "px)";
111
+ t.style.transform = "translate(" + (E.x + g) + "px," + (E.y + _) + "px)";
111
112
  let n = e ?? "out";
112
113
  if (F === n) return;
113
114
  F = n;
114
115
  let r = P;
115
- n === "out" ? (t.style.opacity = re, r && (r.innerHTML = ne)) : (t.style.opacity = "1", r && (r.innerHTML = n === "center" ? ee : te));
116
- }, K = () => {
116
+ n === "out" ? (t.style.opacity = ie, r && (r.innerHTML = re)) : (t.style.opacity = "1", r && (r.innerHTML = n === "center" ? te : ne));
117
+ }, G = () => {
117
118
  N && N.parentNode && N.parentNode.removeChild(N), N = null, P = null, F = null;
118
- }, Ce = (e, r) => {
119
+ }, Te = (e, r) => {
119
120
  if (t === null) return null;
120
- let { paneLayout: a, leftPaneScrollRef: o, rightPaneScrollRef: s, bodyScrollRef: c, scrollContainerRef: l, leftLeadingWidth: u, centerLeadingWidth: d, rightLeadingWidth: h } = t, g = l.current;
121
+ let { paneLayout: a, leftPaneScrollRef: o, rightPaneScrollRef: s, bodyScrollRef: c, scrollContainerRef: l, leftLeadingWidth: u, centerLeadingWidth: d, rightLeadingWidth: f } = t, g = l.current;
121
122
  if (g) {
122
123
  let t = g.getBoundingClientRect();
123
124
  if (e < t.left || e > t.right || r < t.top || r > t.bottom) return null;
124
125
  }
125
126
  let _ = o.current, v = s.current;
126
- if (_ && a.left.entries.length === 0 && e <= _.getBoundingClientRect().left + p) return {
127
+ if (_ && a.left.entries.length === 0 && e <= _.getBoundingClientRect().left + Math.max(u, m)) return {
127
128
  pane: "left",
128
129
  slot: 0,
129
- leftPx: m
130
+ leftPx: u > 0 ? u : h
130
131
  };
131
132
  if (_ && a.left.entries.length > 0) {
132
133
  let t = _.getBoundingClientRect();
133
134
  if (e < t.right) {
134
- let r = e - t.left - u, o = Math.max(n(a.left, r), f(a.left));
135
+ let r = e - t.left - u, o = Math.max(n(a.left, r), p(a.left));
135
136
  return {
136
137
  pane: "left",
137
138
  slot: o,
@@ -139,7 +140,7 @@ var f = (e) => {
139
140
  };
140
141
  }
141
142
  }
142
- if (v && a.right.entries.length === 0 && e >= v.getBoundingClientRect().left - p) return {
143
+ if (v && a.right.entries.length === 0 && e >= v.getBoundingClientRect().left - m) return {
143
144
  pane: "right",
144
145
  slot: 0,
145
146
  leftPx: -2
@@ -147,17 +148,17 @@ var f = (e) => {
147
148
  if (v && a.right.entries.length > 0) {
148
149
  let t = v.getBoundingClientRect();
149
150
  if (e >= t.left) {
150
- let r = e - t.left - h, o = Math.max(n(a.right, r), f(a.right));
151
+ let r = e - t.left - f, o = Math.max(n(a.right, r), p(a.right));
151
152
  return {
152
153
  pane: "right",
153
154
  slot: o,
154
- leftPx: h + i(a.right, o)
155
+ leftPx: f + i(a.right, o)
155
156
  };
156
157
  }
157
158
  }
158
159
  let y = c.current;
159
160
  if (y && a.center.entries.length > 0) {
160
- let t = y.getBoundingClientRect(), r = y.scrollLeft + e - t.left - d, o = Math.max(n(a.center, Math.max(r, 0)), f(a.center));
161
+ let t = y.getBoundingClientRect(), r = y.scrollLeft + e - t.left - d, o = Math.max(n(a.center, Math.max(r, 0)), p(a.center));
161
162
  return {
162
163
  pane: "center",
163
164
  slot: o,
@@ -165,8 +166,8 @@ var f = (e) => {
165
166
  };
166
167
  }
167
168
  return null;
168
- }, we = (e) => {
169
- let t = W();
169
+ }, Ee = (e) => {
170
+ let t = U();
170
171
  for (let n of [
171
172
  "left",
172
173
  "center",
@@ -175,14 +176,14 @@ var f = (e) => {
175
176
  let r = t[n];
176
177
  r && (n === e.pane ? (r.style.left = `${e.leftPx}px`, r.style.display = "block") : r.style.display = "none");
177
178
  }
178
- }, Te = (e, t) => {
179
- let n = z?.get(t);
180
- n !== void 0 && z?.delete(t), e.set(t, n ?? {
179
+ }, De = (e, t) => {
180
+ let n = R?.get(t);
181
+ n !== void 0 && R?.delete(t), e.set(t, n ?? {
181
182
  zIndex: t.style.zIndex,
182
183
  visibility: t.style.visibility
183
184
  });
184
- }, q = (e, n) => {
185
- let r = [], i = R, a = _, o = I;
185
+ }, K = (e, n) => {
186
+ let r = [], i = L, a = v, o = I;
186
187
  if (!i || a === null || o === null || t === null) return r;
187
188
  let s = t.scrollContainerRef.current;
188
189
  if (!s) return r;
@@ -190,44 +191,44 @@ var f = (e) => {
190
191
  if (l < 0) return r;
191
192
  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
193
  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 - L : 0, m = (D ? E.x - D.x : 0) + p, h = U, g = /* @__PURE__ */ new WeakSet();
194
- U = g;
194
+ let p = o === "center" ? s.scrollLeft - be : 0, m = (D ? E.x - D.x : 0) + p, h = H, g = /* @__PURE__ */ new WeakSet();
195
+ H = g;
195
196
  for (let e of C(s)) {
196
197
  let t = e.dataset.ssgColKey;
197
198
  if (t === void 0) continue;
198
199
  g.add(e);
199
- let o = h !== null && !h.has(e) ? "none" : se;
200
+ let o = h !== null && !h.has(e) ? "none" : ce;
200
201
  if (t === a) {
201
- r.push(e), i.has(e) || (Te(i, e), e.style.zIndex = ce, e.style.willChange = "transform");
202
+ r.push(e), i.has(e) || (De(i, e), e.style.zIndex = le, e.style.willChange = "transform");
202
203
  let t = i.get(e);
203
204
  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
205
  continue;
205
206
  }
206
207
  let s = f.get(t) ?? 0;
207
208
  if (s === 0 && !i.has(e)) continue;
208
- i.has(e) || Te(i, e);
209
+ i.has(e) || De(i, e);
209
210
  let c = `translateX(${s}px)`;
210
211
  e.style.transform !== c && (e.style.transition = o, e.style.transform = c);
211
212
  }
212
213
  return r;
213
- }, J = (e) => {
214
+ }, q = (e) => {
214
215
  e.forEach((e, t) => {
215
216
  t.style.transition = "", t.style.transform = "", t.style.willChange = "", t.style.zIndex = e.zIndex, t.style.visibility = e.visibility, t.removeAttribute(x);
216
217
  });
217
- }, Ee = (e) => {
218
+ }, Oe = (e) => {
218
219
  let t = (e) => {
219
- for (let t of me) e.removeAttribute(t);
220
+ for (let t of he) e.removeAttribute(t);
220
221
  };
221
222
  t(e), e.querySelectorAll("*").forEach(t), e.querySelectorAll(".ssg-header-actions").forEach((e) => e.remove());
222
- }, De = (e, t, n) => {
223
- let r = V;
223
+ }, ke = (e, t, n) => {
224
+ let r = B;
224
225
  if (r === null) {
225
226
  let e = document.createElement("div");
226
- e.className = ue, e.setAttribute("aria-hidden", "true"), e.setAttribute("inert", "");
227
+ e.className = de, e.setAttribute("aria-hidden", "true"), e.setAttribute("inert", "");
227
228
  let n = document.createElement("div");
228
229
  n.style.cssText = "position:absolute;top:0;left:0;height:100%;will-change:transform";
229
230
  let i = document.createElement("div");
230
- i.className = fe, i.style.cssText = "position:absolute;display:none", e.append(n, i), t.appendChild(e), r = {
231
+ i.className = pe, i.style.cssText = "position:absolute;display:none", e.append(n, i), t.appendChild(e), r = {
231
232
  layer: e,
232
233
  column: n,
233
234
  guide: i,
@@ -237,7 +238,7 @@ var f = (e) => {
237
238
  columnWidth: 0,
238
239
  scrollTop: 0,
239
240
  cellCount: 0
240
- }, V = r;
241
+ }, B = r;
241
242
  }
242
243
  let i = t.getBoundingClientRect(), a = e.getBoundingClientRect(), o = a.left + e.clientLeft, s = a.top + e.clientTop;
243
244
  r.layer.style.cssText = [
@@ -248,58 +249,61 @@ var f = (e) => {
248
249
  `height:${e.clientHeight}px`,
249
250
  "overflow:hidden",
250
251
  "pointer-events:none",
251
- `z-index:${le}`
252
+ `z-index:${ue}`
252
253
  ].join(";");
253
254
  let c = [], l = [], u = 0;
254
255
  for (let e of n) {
255
256
  let t = e.getBoundingClientRect(), n = e.cloneNode(!0);
256
- Ee(n), n.setAttribute(x, "live");
257
+ Oe(n), n.setAttribute(x, "live");
257
258
  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(pe) ? l : c).push(n);
259
+ 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(me) ? l : c).push(n);
259
260
  }
260
261
  let d = null;
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
+ for (let e of l) e.style.zIndex = "1", d === null && (d = document.createElement("span"), d.className = fe, e.insertBefore(d, e.firstChild));
262
263
  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
- }, Oe = (e) => {
264
+ }, Ae = (e) => {
264
265
  let n = t?.scrollContainerRef.current ?? null, r = n?.parentElement ?? null;
265
- return !n || !r ? null : e.length === 0 || V !== null && V.scrollTop === n.scrollTop && V.cellCount === e.length ? V : De(n, r, e);
266
- }, ke = (e) => {
266
+ return !n || !r ? null : e.length === 0 || B !== null && B.scrollTop === n.scrollTop && B.cellCount === e.length ? B : ke(n, r, e);
267
+ }, je = (e) => {
267
268
  if (t === null) return !1;
268
269
  let n = t.leftPaneScrollRef.current;
269
- if (n && t.paneLayout.left.entries.length > 0 && e < n.getBoundingClientRect().right - .5) return !0;
270
+ if (n) {
271
+ let r = n.getBoundingClientRect();
272
+ if (e < (t.paneLayout.left.entries.length > 0 ? r.right : r.left + t.leftLeadingWidth) - .5) return !0;
273
+ }
270
274
  let r = t.rightPaneScrollRef.current;
271
275
  return !!(r && t.paneLayout.right.entries.length > 0 && e > r.getBoundingClientRect().left + .5);
272
- }, Ae = (e, t, n) => {
273
- let r = e.guide, i = t === null ? null : W()[t];
276
+ }, Me = (e, t, n) => {
277
+ let r = e.guide, i = t === null ? null : U()[t];
274
278
  if (!i || i.style.display !== "block") {
275
279
  r.style.display = "none";
276
280
  return;
277
281
  }
278
282
  let a = i.getBoundingClientRect();
279
- if (t === "center" && ke(a.left + a.width / 2)) {
283
+ if (t === "center" && je(a.left + a.width / 2)) {
280
284
  r.style.display = "none";
281
285
  return;
282
286
  }
283
287
  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
- }, je = (e, t) => {
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);
288
+ }, Ne = (e, t) => {
289
+ let n = e.layer.getBoundingClientRect(), r = Math.max(e.layerWidth - e.columnWidth, 0), i = Math.min(Math.max(E.x - xe - n.left, 0), r);
286
290
  e.column.style.transition = "none", e.column.style.transform = `translateX(${i}px)`;
287
291
  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(S) : y(S), e.badge.style.display = a === "none" ? "none" : ""), Ae(e, t, n);
289
- }, Y = () => {
290
- V?.layer.remove(), V = null;
291
- }, Me = (e, t, n) => {
292
+ e.badge !== null && e.badgeKind !== a && (e.badgeKind = a, e.badge.innerHTML = a === "none" ? "" : a === "move" ? y(S) : ee(S), e.badge.style.display = a === "none" ? "none" : ""), Me(e, t, n);
293
+ }, J = () => {
294
+ B?.layer.remove(), B = null;
295
+ }, Y = (e, t, n) => {
292
296
  let r = e.layer.getBoundingClientRect();
293
297
  e.column.style.transition = `transform ${n}ms ${b}`, e.column.style.transform = `translateX(${t - r.left}px)`, e.badge?.remove(), e.guide.style.display = "none";
294
298
  }, X = () => {
295
- let e = H;
296
- if (H = null, e !== null) {
299
+ let e = V;
300
+ if (V = null, e !== null) {
297
301
  e.timer !== null && window.clearTimeout(e.timer);
298
302
  for (let [t, n] of e.hiddenCells) t.style.visibility = n;
299
303
  e.float.layer.remove();
300
304
  }
301
- }, Ne = () => {
302
- let e = H;
305
+ }, Pe = () => {
306
+ let e = V;
303
307
  if (e === null || e.key === null) return;
304
308
  let n = e.key;
305
309
  if (e.pane !== null && !t?.paneLayout[e.pane].entries.some((e) => e.column.key === n)) return;
@@ -311,43 +315,43 @@ var f = (e) => {
311
315
  }
312
316
  let a = i[0].getBoundingClientRect().left;
313
317
  for (let t of i) e.hiddenCells.push([t, t.style.visibility]), t.style.visibility = "hidden";
314
- Me(e.float, a, he), e.timer !== null && window.clearTimeout(e.timer), e.timer = window.setTimeout(X, 220);
318
+ Y(e.float, a, ge), e.timer !== null && window.clearTimeout(e.timer), e.timer = window.setTimeout(X, 220);
315
319
  }, Z = () => {
316
- let e = Ce(E.x, E.y);
317
- if (be()) {
320
+ let e = Te(E.x, E.y);
321
+ if (Se()) {
318
322
  e && (w = {
319
323
  pane: e.pane,
320
324
  slot: e.slot
321
325
  });
322
326
  let n = w;
323
327
  if (n !== null && n.pane !== I) {
324
- if (e && we(e), (t?.scrollContainerRef.current ?? null)?.parentElement != null) {
325
- let e = Oe(q(null, "lift-out"));
328
+ if (e && Ee(e), (t?.scrollContainerRef.current ?? null)?.parentElement != null) {
329
+ let e = Ae(K(null, "lift-out"));
326
330
  if (e !== null) {
327
- K(), je(e, n.pane);
331
+ G(), Ne(e, n.pane);
328
332
  return;
329
333
  }
330
334
  }
331
- Y(), xe(B), Se(n.pane), q(null, "rest");
335
+ J(), Ce(z), we(n.pane), K(null, "rest");
332
336
  return;
333
337
  }
334
- if (K(), G(), q(n === null ? null : n.slot, "follow").length === 0 && V !== null) {
335
- je(V, null);
338
+ if (G(), W(), K(n === null ? null : n.slot, "follow").length === 0 && B !== null) {
339
+ Ne(B, null);
336
340
  return;
337
341
  }
338
- Y();
342
+ J();
339
343
  return;
340
344
  }
341
- if (Se(e ? e.pane : null), !e) {
342
- w = null, G();
345
+ if (we(e ? e.pane : null), !e) {
346
+ w = null, W();
343
347
  return;
344
348
  }
345
349
  w = {
346
350
  pane: e.pane,
347
351
  slot: e.slot
348
- }, we(e);
349
- }, Pe = () => {
350
- if (_ === null) {
352
+ }, Ee(e);
353
+ }, Fe = () => {
354
+ if (v === null) {
351
355
  j = null;
352
356
  return;
353
357
  }
@@ -366,17 +370,17 @@ var f = (e) => {
366
370
  behavior: "auto"
367
371
  });
368
372
  }
369
- Z(), j = requestAnimationFrame(Pe);
373
+ Z(), j = requestAnimationFrame(Fe);
370
374
  }, Q = (e) => {
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
- let a = R;
375
- R = null, I = null;
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
- if (V = null, a && !c) {
375
+ j !== null && (cancelAnimationFrame(j), j = null), document.body.style.cursor = "", W(), G();
376
+ let n = v, i = w;
377
+ v = null, A = null, H = null, w = null, D = null;
378
+ let a = L;
379
+ L = null, I = null;
380
+ 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 ? d(t.columns, n, i.pane, f(t.columns, t.paneLayout[i.pane], i.pane, i.slot)) : null, l = B;
381
+ if (B = null, a && !c) {
378
382
  a.forEach((e, t) => {
379
- t.isConnected && (t.style.transition = se, t.style.transform = "translateX(0px)");
383
+ t.isConnected && (t.style.transition = ce, t.style.transform = "translateX(0px)");
380
384
  });
381
385
  let e = null;
382
386
  if (l !== null) {
@@ -385,33 +389,33 @@ var f = (e) => {
385
389
  t = e;
386
390
  break;
387
391
  }
388
- t === null ? l.layer.remove() : (Me(l, t.getBoundingClientRect().left, oe), e = {
392
+ t === null ? l.layer.remove() : (Y(l, t.getBoundingClientRect().left, se), e = {
389
393
  float: l,
390
394
  key: null,
391
395
  pane: null,
392
396
  timer: null,
393
397
  hiddenCells: []
394
- }, H = e);
398
+ }, V = e);
395
399
  }
396
- z = a, window.setTimeout(() => {
397
- J(a), z === a && (z = null), e !== null && H === e && X();
400
+ R = a, window.setTimeout(() => {
401
+ q(a), R === a && (R = null), e !== null && V === e && X();
398
402
  }, 200);
399
403
  } else l !== null && !c && l.layer.remove();
400
404
  if (!c || !n || !i || t === null) return;
401
- let { columns: f, applyColumnOrderAndPin: p, scrollContainerRef: m } = t, h = f.find((e) => e.key === n), g = h ? r(h) : null;
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 = {
405
+ let { columns: u, applyColumnOrderAndPin: p, scrollContainerRef: m } = t, h = u.find((e) => e.key === n), g = h ? r(h) : null;
406
+ T = g !== null && g === i.pane && !oe(m.current) ? ve(m.current) : null, a && q(a), l !== null && (l.badge?.remove(), l.guide.style.display = "none", V = {
403
407
  float: l,
404
408
  key: n,
405
409
  pane: i.pane,
406
- timer: window.setTimeout(X, ge),
410
+ timer: window.setTimeout(X, _e),
407
411
  hiddenCells: []
408
412
  });
409
- let v = /* @__PURE__ */ new Map([[n, i.pane === "center" ? void 0 : i.pane]]), y = T;
410
- p(c, v), y !== null && requestAnimationFrame(() => {
413
+ let _ = /* @__PURE__ */ new Map([[n, i.pane === "center" ? void 0 : i.pane]]), y = T;
414
+ p(c, _), y !== null && requestAnimationFrame(() => {
411
415
  T === y && (T = null);
412
416
  });
413
- }, Fe = () => {
414
- Ne();
417
+ }, Ie = () => {
418
+ Pe();
415
419
  let n = T;
416
420
  if (T = null, !n) return;
417
421
  let r = t?.scrollContainerRef.current ?? null;
@@ -432,7 +436,7 @@ var f = (e) => {
432
436
  if (!(Math.abs(s) < .5)) for (let t of e) t.style.transition = "none", t.style.transform = `translateX(${s}px)`, t.style.willChange = "transform", o.push(t);
433
437
  }), o.length === 0) return;
434
438
  r.getBoundingClientRect();
435
- for (let e of o) e.style.transition = `transform ${ie}ms ${b}`, e.style.transform = "translateX(0)";
439
+ for (let e of o) e.style.transition = `transform ${ae}ms ${b}`, e.style.transform = "translateX(0)";
436
440
  $();
437
441
  let s = () => {
438
442
  for (let e of o) e.style.transition = "", e.style.transform = "", e.style.willChange = "";
@@ -453,24 +457,24 @@ var f = (e) => {
453
457
  },
454
458
  onColumnDragHandlePointerDown: (e, n) => {
455
459
  if (t === null || !t.enabled || n.button !== 0) return;
456
- if (n.stopPropagation(), n.preventDefault(), _ !== null) {
460
+ if (n.stopPropagation(), n.preventDefault(), v !== null) {
457
461
  if (n.pointerId !== A) return;
458
462
  k?.(), Q(!1);
459
463
  }
460
- if ($(), X(), Y(), z?.forEach((e, t) => {
464
+ if ($(), X(), J(), R?.forEach((e, t) => {
461
465
  t.style.visibility = e.visibility;
462
- }), _ = e.key, A = n.pointerId, w = null, U = null, E = {
466
+ }), v = e.key, A = n.pointerId, w = null, H = null, E = {
463
467
  x: n.clientX,
464
468
  y: n.clientY
465
469
  }, D = {
466
470
  x: n.clientX,
467
471
  y: n.clientY
468
- }, O = !1, document.body.style.cursor = "grabbing", B = e.title || e.key, be()) {
472
+ }, O = !1, document.body.style.cursor = "grabbing", z = e.title || e.key, Se()) {
469
473
  let i = t.scrollContainerRef.current;
470
- I = r(e), L = i?.scrollLeft ?? 0, R = /* @__PURE__ */ new Map();
474
+ I = r(e), be = i?.scrollLeft ?? 0, L = /* @__PURE__ */ new Map();
471
475
  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;
473
- } else xe(B);
476
+ xe = a ? n.clientX - (a.getBoundingClientRect().left - ye(a)) : (t.paneLayout[I].entries.find((t) => t.column.key === e.key)?.paneLocalSize ?? 0) / 2;
477
+ } else Ce(z);
474
478
  let i = n.currentTarget, a = n.pointerId;
475
479
  try {
476
480
  i.setPointerCapture(a);
@@ -498,13 +502,13 @@ var f = (e) => {
498
502
  function d() {
499
503
  s(), Q(!1);
500
504
  }
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);
505
+ 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(Fe);
502
506
  },
503
- applyReorderSettle: Fe,
507
+ applyReorderSettle: Ie,
504
508
  dispose: () => {
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();
509
+ k?.(), k = null, j !== null && (cancelAnimationFrame(j), j = null), v = null, A = null, w = null, document.body.style.cursor = "", G(), L && q(L), L = null, I = null, J(), X();
506
510
  }
507
511
  };
508
512
  };
509
513
  //#endregion
510
- export { u as computeHeaderReorderedKeys, w as createColumnHeaderDragController, d as resolveConsumerDropSlot };
514
+ export { d as computeHeaderReorderedKeys, w as createColumnHeaderDragController, f 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)),getGridRoot:()=>s?.gridRootRef.current??null,onGridHidden:()=>v(!1),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
  };