@ishibashi0112/spreadsheet-grid-core 0.65.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/controllers/clipboardController.cjs +2 -2
  2. package/dist/controllers/clipboardController.d.ts +2 -1
  3. package/dist/controllers/clipboardController.js +78 -62
  4. package/dist/controllers/columnAutosizeRunner.cjs +1 -1
  5. package/dist/controllers/columnAutosizeRunner.d.ts +2 -0
  6. package/dist/controllers/columnAutosizeRunner.js +49 -23
  7. package/dist/controllers/columnHeaderDragController.cjs +1 -1
  8. package/dist/controllers/columnHeaderDragController.d.ts +4 -0
  9. package/dist/controllers/columnHeaderDragController.js +140 -124
  10. package/dist/controllers/dateRolloverStore.cjs +1 -1
  11. package/dist/controllers/dateRolloverStore.js +1 -1
  12. package/dist/controllers/editController.cjs +1 -1
  13. package/dist/controllers/editController.js +71 -55
  14. package/dist/controllers/escapeClaimController.cjs +1 -0
  15. package/dist/controllers/escapeClaimController.d.ts +18 -0
  16. package/dist/controllers/escapeClaimController.js +30 -0
  17. package/dist/controllers/fillHandleController.cjs +1 -1
  18. package/dist/controllers/fillHandleController.js +129 -127
  19. package/dist/controllers/findController.cjs +1 -1
  20. package/dist/controllers/findController.d.ts +1 -0
  21. package/dist/controllers/findController.js +96 -75
  22. package/dist/controllers/globalFilteredOrder.cjs +1 -1
  23. package/dist/controllers/globalFilteredOrder.js +52 -21
  24. package/dist/controllers/keyboardController.cjs +1 -1
  25. package/dist/controllers/keyboardController.js +98 -97
  26. package/dist/controllers/pointerInteractionsController.cjs +1 -1
  27. package/dist/controllers/pointerInteractionsController.js +159 -144
  28. package/dist/controllers/popoverSupport.cjs +1 -1
  29. package/dist/controllers/popoverSupport.js +4 -1
  30. package/dist/controllers/rowDragController.cjs +1 -1
  31. package/dist/controllers/rowDragController.d.ts +1 -0
  32. package/dist/controllers/rowDragController.js +122 -120
  33. package/dist/controllers/scrollSyncController.cjs +1 -1
  34. package/dist/controllers/scrollSyncController.d.ts +1 -1
  35. package/dist/controllers/scrollSyncController.js +7 -4
  36. package/dist/controllers/selectOptionsCollector.cjs +1 -1
  37. package/dist/controllers/selectOptionsCollector.d.ts +5 -2
  38. package/dist/controllers/selectOptionsCollector.js +39 -27
  39. package/dist/controllers/toolPanelController.cjs +1 -1
  40. package/dist/controllers/toolPanelController.d.ts +6 -0
  41. package/dist/controllers/toolPanelController.js +69 -59
  42. package/dist/controllers/tooltipController.cjs +1 -1
  43. package/dist/controllers/tooltipController.d.ts +2 -0
  44. package/dist/controllers/tooltipController.js +68 -38
  45. package/dist/controllers/viewportSyncController.cjs +1 -1
  46. package/dist/controllers/viewportSyncController.d.ts +4 -0
  47. package/dist/controllers/viewportSyncController.js +18 -8
  48. package/dist/engine/columnCommands.cjs +1 -1
  49. package/dist/engine/columnCommands.js +2 -1
  50. package/dist/engine/columnLayout.cjs +1 -1
  51. package/dist/engine/columnLayout.d.ts +2 -0
  52. package/dist/engine/columnLayout.js +51 -18
  53. package/dist/engine/exportCommands.cjs +2 -2
  54. package/dist/engine/exportCommands.js +37 -38
  55. package/dist/engine/gridApi.cjs +2 -2
  56. package/dist/engine/gridApi.d.ts +1 -1
  57. package/dist/engine/gridApi.js +8 -8
  58. package/dist/engine/rowPipeline.cjs +1 -1
  59. package/dist/engine/rowPipeline.js +46 -46
  60. package/dist/engine/rowSelectionCommands.cjs +1 -1
  61. package/dist/engine/rowSelectionCommands.d.ts +8 -1
  62. package/dist/engine/rowSelectionCommands.js +36 -25
  63. package/dist/locales/en.cjs +1 -1
  64. package/dist/locales/en.js +1 -1
  65. package/dist/logic/autoScrollGeometry.cjs +1 -1
  66. package/dist/logic/autoScrollGeometry.d.ts +5 -1
  67. package/dist/logic/autoScrollGeometry.js +6 -6
  68. package/dist/logic/clearCells.cjs +1 -1
  69. package/dist/logic/clearCells.js +13 -13
  70. package/dist/logic/columnReset.cjs +1 -1
  71. package/dist/logic/columnReset.d.ts +1 -0
  72. package/dist/logic/columnReset.js +21 -19
  73. package/dist/logic/editorValues.cjs +1 -1
  74. package/dist/logic/editorValues.js +41 -15
  75. package/dist/logic/elementScale.cjs +1 -0
  76. package/dist/logic/elementScale.d.ts +8 -0
  77. package/dist/logic/elementScale.js +14 -0
  78. package/dist/logic/filtering.cjs +1 -1
  79. package/dist/logic/filtering.js +14 -11
  80. package/dist/logic/focusCycle.cjs +1 -0
  81. package/dist/logic/focusCycle.d.ts +1 -0
  82. package/dist/logic/focusCycle.js +15 -0
  83. package/dist/logic/labelRows.cjs +1 -1
  84. package/dist/logic/labelRows.d.ts +2 -0
  85. package/dist/logic/labelRows.js +8 -4
  86. package/dist/logic/localeText.cjs +1 -1
  87. package/dist/logic/localeText.js +1 -1
  88. package/dist/logic/rowSelection.cjs +1 -1
  89. package/dist/logic/rowSelection.d.ts +4 -0
  90. package/dist/logic/rowSelection.js +31 -8
  91. package/dist/logic/selectOptions.cjs +1 -1
  92. package/dist/logic/selectOptions.d.ts +2 -2
  93. package/dist/logic/selectOptions.js +16 -12
  94. package/dist/logic/selectionOverlayGeometry.cjs +1 -1
  95. package/dist/logic/selectionOverlayGeometry.js +12 -12
  96. package/dist/logic/sorting.cjs +1 -1
  97. package/dist/logic/sorting.d.ts +1 -0
  98. package/dist/logic/sorting.js +24 -12
  99. package/dist/model/gridTypes.core.d.ts +48 -28
  100. package/dist/utils/deprecation.cjs +1 -1
  101. package/dist/utils/deprecation.d.ts +1 -30
  102. package/dist/utils/deprecation.js +1 -30
  103. package/package.json +1 -1
  104. package/dist/logic/exportScope.cjs +0 -1
  105. package/dist/logic/exportScope.d.ts +0 -3
  106. package/dist/logic/exportScope.js +0 -5
@@ -1,10 +1,11 @@
1
1
  import { isInsideDetailCardOf as e, isSyntheticColumnKey as t } from "../logic/detailRow.js";
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
- import { applySlotToElement as l } from "../logic/slotDom.js";
5
- import { syncPortalTokens as u } from "../utils/portalTokens.js";
4
+ import { resolveElementScale as l } from "../logic/elementScale.js";
5
+ import { applySlotToElement as u } from "../logic/slotDom.js";
6
+ import { syncPortalTokens as d } from "../utils/portalTokens.js";
6
7
  //#region src/controllers/columnHeaderDragController.ts
7
- function d(e, t, n, i) {
8
+ function f(e, t, n, i) {
8
9
  let a = e.find((e) => e.key === t);
9
10
  if (!a) return null;
10
11
  let o = r(a), s = {
@@ -27,32 +28,46 @@ function d(e, t, n, i) {
27
28
  ...s.right
28
29
  ];
29
30
  }
30
- function f(e, n, i, a) {
31
+ function p(e, n, i, a) {
31
32
  let o = e.filter((e) => r(e) === i && e.visible !== !1).map((e) => e.key), { entries: s } = n;
32
33
  for (let e = Math.max(a, 0); e < s.length; e += 1) {
33
34
  let n = s[e].column.key;
34
35
  if (t(n)) continue;
35
36
  let r = o.indexOf(n);
36
- return r < 0 ? o.length : r;
37
+ if (!(r < 0)) return r;
37
38
  }
38
39
  return o.length;
39
40
  }
40
- var p = (e) => {
41
+ function m(e, n) {
42
+ let i = new Map(e.map((e) => [e.key, r(e)])), { entries: a } = n, o = 0;
43
+ for (; o < a.length;) {
44
+ let e = a[o].column.key;
45
+ if (!t(e) && i.get(e) !== "left") break;
46
+ o += 1;
47
+ }
48
+ let s = a.length;
49
+ for (; s > o && i.get(a[s - 1].column.key) === "right";) --s;
50
+ return {
51
+ min: o,
52
+ max: s
53
+ };
54
+ }
55
+ var h = (e) => {
41
56
  let n = 0;
42
57
  for (; n < e.entries.length && t(e.entries[n].column.key);) n += 1;
43
58
  return n;
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 = [
59
+ }, g = 32, ee = 2, _ = 14, v = 12, y = 14, te = (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>", ne = (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>", re = te(y), ie = ne(y), ae = "<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>", oe = "0.5", se = 200, b = "cubic-bezier(0.2, 0.7, 0.3, 1)", ce = (e) => e?.closest(".ssg-motion-off") != null, le = 160, x = `transform ${le}ms ${b}`, S = "data-ssg-col-dragging", ue = "4", de = "9", fe = "ssg-col-drag-float", pe = "ssg-col-drag-pin", me = 12, he = "ssg-col-drop-indicator", ge = "ssg-header-cell", _e = [
45
60
  "data-ssg-col-key",
46
61
  "data-ssg-tooltip",
47
62
  "data-autoheight-cell",
48
63
  "id",
49
64
  "tabindex"
50
- ], ge = 180, _e = 400, C = (t) => {
65
+ ], ve = 180, ye = 400, C = (t) => {
51
66
  let n = [];
52
67
  return t.querySelectorAll("[data-ssg-col-key]").forEach((r) => {
53
68
  e(t, r) || n.push(r);
54
69
  }), n;
55
- }, ve = (t) => {
70
+ }, be = (t) => {
56
71
  if (!t) return null;
57
72
  let n = /* @__PURE__ */ new Map();
58
73
  return t.querySelectorAll("[data-ssg-col-key]").forEach((r) => {
@@ -60,22 +75,22 @@ var p = (e) => {
60
75
  let i = r.dataset.ssgColKey;
61
76
  i && !n.has(i) && n.set(i, r.getBoundingClientRect().left);
62
77
  }), n;
63
- }, ye = (e) => {
78
+ }, xe = (e) => {
64
79
  let t = getComputedStyle(e).transform, n = /^matrix(3d)?\(([^)]*)\)$/.exec(t);
65
80
  if (n === null) return 0;
66
81
  let r = Number(n[2].split(",")[n[1] === "3d" ? 12 : 4]);
67
82
  return Number.isFinite(r) ? r : 0;
68
83
  }, w = () => {
69
- let t = null, v = null, w = null, T = null, E = {
84
+ let t = null, y = null, w = null, T = null, E = {
70
85
  x: 0,
71
86
  y: 0
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 = () => ({
87
+ }, 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, Se = 0, H = null, U = null, Ce = () => t?.motion === "live", W = () => ({
73
88
  left: t?.leftIndicatorRef.current ?? null,
74
89
  center: t?.centerIndicatorRef.current ?? null,
75
90
  right: t?.rightIndicatorRef.current ?? null
76
- }), W = () => {
77
- for (let e of Object.values(U())) e && (e.style.display = "none");
78
- }, Ce = (e) => {
91
+ }), G = () => {
92
+ for (let e of Object.values(W())) e && (e.style.display = "none");
93
+ }, we = (e) => {
79
94
  if (N) return;
80
95
  let n = document.createElement("div");
81
96
  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 = [
@@ -100,39 +115,39 @@ var p = (e) => {
100
115
  "z-index:9999",
101
116
  "will-change:transform",
102
117
  "transform:translate(-9999px,-9999px)"
103
- ].join(";"), l(n, t?.ghostSlot);
118
+ ].join(";"), u(n, t?.ghostSlot);
104
119
  let r = document.createElement("span");
105
120
  r.style.cssText = "display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none";
106
121
  let i = document.createElement("span");
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) => {
122
+ i.textContent = e, n.appendChild(r), n.appendChild(i), document.body.appendChild(n), d(t?.scrollContainerRef.current, n), N = n, P = r, F = null;
123
+ }, Te = (e) => {
109
124
  let t = N;
110
125
  if (!t) return;
111
- t.style.transform = "translate(" + (E.x + g) + "px," + (E.y + _) + "px)";
126
+ t.style.transform = "translate(" + (E.x + _) + "px," + (E.y + v) + "px)";
112
127
  let n = e ?? "out";
113
128
  if (F === n) return;
114
129
  F = n;
115
130
  let r = P;
116
- n === "out" ? (t.style.opacity = ie, r && (r.innerHTML = re)) : (t.style.opacity = "1", r && (r.innerHTML = n === "center" ? te : ne));
117
- }, G = () => {
131
+ n === "out" ? (t.style.opacity = oe, r && (r.innerHTML = ae)) : (t.style.opacity = "1", r && (r.innerHTML = n === "center" ? re : ie));
132
+ }, K = () => {
118
133
  N && N.parentNode && N.parentNode.removeChild(N), N = null, P = null, F = null;
119
- }, Te = (e, r) => {
134
+ }, Ee = (e, r) => {
120
135
  if (t === null) return null;
121
- let { paneLayout: a, leftPaneScrollRef: o, rightPaneScrollRef: s, bodyScrollRef: c, scrollContainerRef: l, leftLeadingWidth: u, centerLeadingWidth: d, rightLeadingWidth: f } = t, g = l.current;
122
- if (g) {
123
- let t = g.getBoundingClientRect();
136
+ let { paneLayout: a, leftPaneScrollRef: o, rightPaneScrollRef: s, bodyScrollRef: c, scrollContainerRef: l, leftLeadingWidth: u, centerLeadingWidth: d, rightLeadingWidth: f } = t, p = l.current;
137
+ if (p) {
138
+ let t = p.getBoundingClientRect();
124
139
  if (e < t.left || e > t.right || r < t.top || r > t.bottom) return null;
125
140
  }
126
141
  let _ = o.current, v = s.current;
127
- if (_ && a.left.entries.length === 0 && e <= _.getBoundingClientRect().left + Math.max(u, m)) return {
142
+ if (_ && a.left.entries.length === 0 && e <= _.getBoundingClientRect().left + Math.max(u, g)) return {
128
143
  pane: "left",
129
144
  slot: 0,
130
- leftPx: u > 0 ? u : h
145
+ leftPx: u > 0 ? u : ee
131
146
  };
132
147
  if (_ && a.left.entries.length > 0) {
133
148
  let t = _.getBoundingClientRect();
134
149
  if (e < t.right) {
135
- let r = e - t.left - u, o = Math.max(n(a.left, r), p(a.left));
150
+ let r = e - t.left - u, o = Math.max(n(a.left, r), h(a.left));
136
151
  return {
137
152
  pane: "left",
138
153
  slot: o,
@@ -140,7 +155,7 @@ var p = (e) => {
140
155
  };
141
156
  }
142
157
  }
143
- if (v && a.right.entries.length === 0 && e >= v.getBoundingClientRect().left - m) return {
158
+ if (v && a.right.entries.length === 0 && e >= v.getBoundingClientRect().left - g) return {
144
159
  pane: "right",
145
160
  slot: 0,
146
161
  leftPx: -2
@@ -148,7 +163,7 @@ var p = (e) => {
148
163
  if (v && a.right.entries.length > 0) {
149
164
  let t = v.getBoundingClientRect();
150
165
  if (e >= t.left) {
151
- let r = e - t.left - f, o = Math.max(n(a.right, r), p(a.right));
166
+ let r = e - t.left - f, o = Math.max(n(a.right, r), h(a.right));
152
167
  return {
153
168
  pane: "right",
154
169
  slot: o,
@@ -158,16 +173,16 @@ var p = (e) => {
158
173
  }
159
174
  let y = c.current;
160
175
  if (y && a.center.entries.length > 0) {
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));
176
+ let r = y.getBoundingClientRect(), o = y.scrollLeft + e - r.left - d, s = m(t.columns, a.center), c = Math.min(Math.max(n(a.center, Math.max(o, 0)), s.min), s.max);
162
177
  return {
163
178
  pane: "center",
164
- slot: o,
165
- leftPx: d + i(a.center, o)
179
+ slot: c,
180
+ leftPx: d + i(a.center, c)
166
181
  };
167
182
  }
168
183
  return null;
169
- }, Ee = (e) => {
170
- let t = U();
184
+ }, De = (e) => {
185
+ let t = W();
171
186
  for (let n of [
172
187
  "left",
173
188
  "center",
@@ -176,14 +191,14 @@ var p = (e) => {
176
191
  let r = t[n];
177
192
  r && (n === e.pane ? (r.style.left = `${e.leftPx}px`, r.style.display = "block") : r.style.display = "none");
178
193
  }
179
- }, De = (e, t) => {
180
- let n = R?.get(t);
181
- n !== void 0 && R?.delete(t), e.set(t, n ?? {
194
+ }, Oe = (e, t) => {
195
+ let n = z?.get(t);
196
+ n !== void 0 && z?.delete(t), e.set(t, n ?? {
182
197
  zIndex: t.style.zIndex,
183
198
  visibility: t.style.visibility
184
199
  });
185
- }, K = (e, n) => {
186
- let r = [], i = L, a = v, o = I;
200
+ }, q = (e, n) => {
201
+ let r = [], i = R, a = y, o = I;
187
202
  if (!i || a === null || o === null || t === null) return r;
188
203
  let s = t.scrollContainerRef.current;
189
204
  if (!s) return r;
@@ -191,44 +206,44 @@ var p = (e) => {
191
206
  if (l < 0) return r;
192
207
  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();
193
208
  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);
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;
209
+ let p = o === "center" ? s.scrollLeft - L : 0, m = (D ? E.x - D.x : 0) + p, h = U, g = /* @__PURE__ */ new WeakSet();
210
+ U = g;
196
211
  for (let e of C(s)) {
197
212
  let t = e.dataset.ssgColKey;
198
213
  if (t === void 0) continue;
199
214
  g.add(e);
200
- let o = h !== null && !h.has(e) ? "none" : ce;
215
+ let o = h !== null && !h.has(e) ? "none" : x;
201
216
  if (t === a) {
202
- r.push(e), i.has(e) || (De(i, e), e.style.zIndex = le, e.style.willChange = "transform");
217
+ r.push(e), i.has(e) || (Oe(i, e), e.style.zIndex = ue, e.style.willChange = "transform");
203
218
  let t = i.get(e);
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)");
219
+ 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)");
205
220
  continue;
206
221
  }
207
222
  let s = f.get(t) ?? 0;
208
223
  if (s === 0 && !i.has(e)) continue;
209
- i.has(e) || De(i, e);
224
+ i.has(e) || Oe(i, e);
210
225
  let c = `translateX(${s}px)`;
211
226
  e.style.transform !== c && (e.style.transition = o, e.style.transform = c);
212
227
  }
213
228
  return r;
214
- }, q = (e) => {
229
+ }, J = (e) => {
215
230
  e.forEach((e, t) => {
216
- t.style.transition = "", t.style.transform = "", t.style.willChange = "", t.style.zIndex = e.zIndex, t.style.visibility = e.visibility, t.removeAttribute(x);
231
+ t.style.transition = "", t.style.transform = "", t.style.willChange = "", t.style.zIndex = e.zIndex, t.style.visibility = e.visibility, t.removeAttribute(S);
217
232
  });
218
- }, Oe = (e) => {
233
+ }, ke = (e) => {
219
234
  let t = (e) => {
220
- for (let t of he) e.removeAttribute(t);
235
+ for (let t of _e) e.removeAttribute(t);
221
236
  };
222
237
  t(e), e.querySelectorAll("*").forEach(t), e.querySelectorAll(".ssg-header-actions").forEach((e) => e.remove());
223
- }, ke = (e, t, n) => {
224
- let r = B;
238
+ }, Ae = (e, t, n) => {
239
+ let r = V;
225
240
  if (r === null) {
226
241
  let e = document.createElement("div");
227
- e.className = de, e.setAttribute("aria-hidden", "true"), e.setAttribute("inert", "");
242
+ e.className = fe, e.setAttribute("aria-hidden", "true"), e.setAttribute("inert", "");
228
243
  let n = document.createElement("div");
229
244
  n.style.cssText = "position:absolute;top:0;left:0;height:100%;will-change:transform";
230
245
  let i = document.createElement("div");
231
- i.className = pe, i.style.cssText = "position:absolute;display:none", e.append(n, i), t.appendChild(e), r = {
246
+ i.className = he, i.style.cssText = "position:absolute;display:none", e.append(n, i), t.appendChild(e), r = {
232
247
  layer: e,
233
248
  column: n,
234
249
  guide: i,
@@ -238,7 +253,7 @@ var p = (e) => {
238
253
  columnWidth: 0,
239
254
  scrollTop: 0,
240
255
  cellCount: 0
241
- }, B = r;
256
+ }, V = r;
242
257
  }
243
258
  let i = t.getBoundingClientRect(), a = e.getBoundingClientRect(), o = a.left + e.clientLeft, s = a.top + e.clientTop;
244
259
  r.layer.style.cssText = [
@@ -249,22 +264,22 @@ var p = (e) => {
249
264
  `height:${e.clientHeight}px`,
250
265
  "overflow:hidden",
251
266
  "pointer-events:none",
252
- `z-index:${ue}`
267
+ `z-index:${de}`
253
268
  ].join(";");
254
269
  let c = [], l = [], u = 0;
255
270
  for (let e of n) {
256
271
  let t = e.getBoundingClientRect(), n = e.cloneNode(!0);
257
- Oe(n), n.setAttribute(x, "live");
272
+ ke(n), n.setAttribute(S, "live");
258
273
  let r = n.style;
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);
274
+ 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(ge) ? l : c).push(n);
260
275
  }
261
276
  let d = null;
262
- for (let e of l) e.style.zIndex = "1", d === null && (d = document.createElement("span"), d.className = fe, e.insertBefore(d, e.firstChild));
277
+ for (let e of l) e.style.zIndex = "1", d === null && (d = document.createElement("span"), d.className = pe, e.insertBefore(d, e.firstChild));
263
278
  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;
264
- }, Ae = (e) => {
265
- let n = t?.scrollContainerRef.current ?? null, r = n?.parentElement ?? null;
266
- return !n || !r ? null : e.length === 0 || B !== null && B.scrollTop === n.scrollTop && B.cellCount === e.length ? B : ke(n, r, e);
267
279
  }, je = (e) => {
280
+ let n = t?.scrollContainerRef.current ?? null, r = n?.parentElement ?? null;
281
+ return !n || !r ? null : e.length === 0 || V !== null && V.scrollTop === n.scrollTop && V.cellCount === e.length ? V : Ae(n, r, e);
282
+ }, Me = (e) => {
268
283
  if (t === null) return !1;
269
284
  let n = t.leftPaneScrollRef.current;
270
285
  if (n) {
@@ -273,37 +288,37 @@ var p = (e) => {
273
288
  }
274
289
  let r = t.rightPaneScrollRef.current;
275
290
  return !!(r && t.paneLayout.right.entries.length > 0 && e > r.getBoundingClientRect().left + .5);
276
- }, Me = (e, t, n) => {
277
- let r = e.guide, i = t === null ? null : U()[t];
291
+ }, Ne = (e, t, n) => {
292
+ let r = e.guide, i = t === null ? null : W()[t];
278
293
  if (!i || i.style.display !== "block") {
279
294
  r.style.display = "none";
280
295
  return;
281
296
  }
282
297
  let a = i.getBoundingClientRect();
283
- if (t === "center" && je(a.left + a.width / 2)) {
298
+ if (t === "center" && Me(a.left + a.width / 2)) {
284
299
  r.style.display = "none";
285
300
  return;
286
301
  }
287
302
  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";
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);
303
+ }, Pe = (e, t) => {
304
+ let n = e.layer.getBoundingClientRect(), r = Math.max(e.layerWidth - e.columnWidth, 0), i = Math.min(Math.max(E.x - Se - n.left, 0), r);
290
305
  e.column.style.transition = "none", e.column.style.transform = `translateX(${i}px)`;
291
306
  let a = t === null ? "none" : t === "center" ? "move" : "pin";
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) => {
307
+ e.badge !== null && e.badgeKind !== a && (e.badgeKind = a, e.badge.innerHTML = a === "none" ? "" : a === "move" ? te(me) : ne(me), e.badge.style.display = a === "none" ? "none" : ""), Ne(e, t, n);
308
+ }, Y = () => {
309
+ V?.layer.remove(), V = null;
310
+ }, Fe = (e, t, n) => {
296
311
  let r = e.layer.getBoundingClientRect();
297
312
  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";
298
313
  }, X = () => {
299
- let e = V;
300
- if (V = null, e !== null) {
314
+ let e = H;
315
+ if (H = null, e !== null) {
301
316
  e.timer !== null && window.clearTimeout(e.timer);
302
317
  for (let [t, n] of e.hiddenCells) t.style.visibility = n;
303
318
  e.float.layer.remove();
304
319
  }
305
- }, Pe = () => {
306
- let e = V;
320
+ }, Ie = () => {
321
+ let e = H;
307
322
  if (e === null || e.key === null) return;
308
323
  let n = e.key;
309
324
  if (e.pane !== null && !t?.paneLayout[e.pane].entries.some((e) => e.column.key === n)) return;
@@ -315,43 +330,43 @@ var p = (e) => {
315
330
  }
316
331
  let a = i[0].getBoundingClientRect().left;
317
332
  for (let t of i) e.hiddenCells.push([t, t.style.visibility]), t.style.visibility = "hidden";
318
- Y(e.float, a, ge), e.timer !== null && window.clearTimeout(e.timer), e.timer = window.setTimeout(X, 220);
333
+ Fe(e.float, a, ve), e.timer !== null && window.clearTimeout(e.timer), e.timer = window.setTimeout(X, 220);
319
334
  }, Z = () => {
320
- let e = Te(E.x, E.y);
321
- if (Se()) {
335
+ let e = Ee(E.x, E.y);
336
+ if (Ce()) {
322
337
  e && (w = {
323
338
  pane: e.pane,
324
339
  slot: e.slot
325
340
  });
326
341
  let n = w;
327
342
  if (n !== null && n.pane !== I) {
328
- if (e && Ee(e), (t?.scrollContainerRef.current ?? null)?.parentElement != null) {
329
- let e = Ae(K(null, "lift-out"));
343
+ if (e && De(e), (t?.scrollContainerRef.current ?? null)?.parentElement != null) {
344
+ let e = je(q(null, "lift-out"));
330
345
  if (e !== null) {
331
- G(), Ne(e, n.pane);
346
+ K(), Pe(e, n.pane);
332
347
  return;
333
348
  }
334
349
  }
335
- J(), Ce(z), we(n.pane), K(null, "rest");
350
+ Y(), we(B), Te(n.pane), q(null, "rest");
336
351
  return;
337
352
  }
338
- if (G(), W(), K(n === null ? null : n.slot, "follow").length === 0 && B !== null) {
339
- Ne(B, null);
353
+ if (K(), G(), q(n === null ? null : n.slot, "follow").length === 0 && V !== null) {
354
+ Pe(V, null);
340
355
  return;
341
356
  }
342
- J();
357
+ Y();
343
358
  return;
344
359
  }
345
- if (we(e ? e.pane : null), !e) {
346
- w = null, W();
360
+ if (Te(e ? e.pane : null), !e) {
361
+ w = null, G();
347
362
  return;
348
363
  }
349
364
  w = {
350
365
  pane: e.pane,
351
366
  slot: e.slot
352
- }, Ee(e);
353
- }, Fe = () => {
354
- if (v === null) {
367
+ }, De(e);
368
+ }, Le = () => {
369
+ if (y === null) {
355
370
  j = null;
356
371
  return;
357
372
  }
@@ -363,24 +378,25 @@ var p = (e) => {
363
378
  clientLeft: e.clientLeft,
364
379
  clientTop: e.clientTop,
365
380
  clientWidth: e.clientWidth,
366
- clientHeight: e.clientHeight
381
+ clientHeight: e.clientHeight,
382
+ scale: l(e, t)
367
383
  }), r = s(E.x, n.left, n.right, 24), i = a(e.scrollLeft, r, 18, e.scrollWidth - e.clientWidth);
368
384
  i !== e.scrollLeft && e.scrollTo({
369
385
  left: i,
370
386
  behavior: "auto"
371
387
  });
372
388
  }
373
- Z(), j = requestAnimationFrame(Fe);
389
+ Z(), j = requestAnimationFrame(Le);
374
390
  }, Q = (e) => {
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) {
391
+ j !== null && (cancelAnimationFrame(j), j = null), document.body.style.cursor = "", G(), K();
392
+ let n = y, i = w;
393
+ y = null, A = null, U = null, w = null, D = null;
394
+ let a = R;
395
+ R = null, I = null;
396
+ 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 ? f(t.columns, n, i.pane, p(t.columns, t.paneLayout[i.pane], i.pane, i.slot)) : null, l = V;
397
+ if (V = null, a && !c) {
382
398
  a.forEach((e, t) => {
383
- t.isConnected && (t.style.transition = ce, t.style.transform = "translateX(0px)");
399
+ t.isConnected && (t.style.transition = x, t.style.transform = "translateX(0px)");
384
400
  });
385
401
  let e = null;
386
402
  if (l !== null) {
@@ -389,33 +405,33 @@ var p = (e) => {
389
405
  t = e;
390
406
  break;
391
407
  }
392
- t === null ? l.layer.remove() : (Y(l, t.getBoundingClientRect().left, se), e = {
408
+ t === null ? l.layer.remove() : (Fe(l, t.getBoundingClientRect().left, le), e = {
393
409
  float: l,
394
410
  key: null,
395
411
  pane: null,
396
412
  timer: null,
397
413
  hiddenCells: []
398
- }, V = e);
414
+ }, H = e);
399
415
  }
400
- R = a, window.setTimeout(() => {
401
- q(a), R === a && (R = null), e !== null && V === e && X();
416
+ z = a, window.setTimeout(() => {
417
+ J(a), z === a && (z = null), e !== null && H === e && X();
402
418
  }, 200);
403
419
  } else l !== null && !c && l.layer.remove();
404
420
  if (!c || !n || !i || t === null) return;
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 = {
421
+ let { columns: u, applyColumnOrderAndPin: d, scrollContainerRef: m } = t, h = u.find((e) => e.key === n), g = h ? r(h) : null;
422
+ T = g !== null && g === i.pane && !ce(m.current) ? be(m.current) : null, a && J(a), l !== null && (l.badge?.remove(), l.guide.style.display = "none", H = {
407
423
  float: l,
408
424
  key: n,
409
425
  pane: i.pane,
410
- timer: window.setTimeout(X, _e),
426
+ timer: window.setTimeout(X, ye),
411
427
  hiddenCells: []
412
428
  });
413
- let _ = /* @__PURE__ */ new Map([[n, i.pane === "center" ? void 0 : i.pane]]), y = T;
414
- p(c, _), y !== null && requestAnimationFrame(() => {
415
- T === y && (T = null);
429
+ let ee = /* @__PURE__ */ new Map([[n, i.pane === "center" ? void 0 : i.pane]]), _ = T;
430
+ d(c, ee), _ !== null && requestAnimationFrame(() => {
431
+ T === _ && (T = null);
416
432
  });
417
- }, Ie = () => {
418
- Pe();
433
+ }, Re = () => {
434
+ Ie();
419
435
  let n = T;
420
436
  if (T = null, !n) return;
421
437
  let r = t?.scrollContainerRef.current ?? null;
@@ -436,7 +452,7 @@ var p = (e) => {
436
452
  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);
437
453
  }), o.length === 0) return;
438
454
  r.getBoundingClientRect();
439
- for (let e of o) e.style.transition = `transform ${ae}ms ${b}`, e.style.transform = "translateX(0)";
455
+ for (let e of o) e.style.transition = `transform ${se}ms ${b}`, e.style.transform = "translateX(0)";
440
456
  $();
441
457
  let s = () => {
442
458
  for (let e of o) e.style.transition = "", e.style.transform = "", e.style.willChange = "";
@@ -457,24 +473,24 @@ var p = (e) => {
457
473
  },
458
474
  onColumnDragHandlePointerDown: (e, n) => {
459
475
  if (t === null || !t.enabled || n.button !== 0) return;
460
- if (n.stopPropagation(), n.preventDefault(), v !== null) {
476
+ if (n.stopPropagation(), n.preventDefault(), y !== null) {
461
477
  if (n.pointerId !== A) return;
462
478
  k?.(), Q(!1);
463
479
  }
464
- if ($(), X(), J(), R?.forEach((e, t) => {
480
+ if ($(), X(), Y(), z?.forEach((e, t) => {
465
481
  t.style.visibility = e.visibility;
466
- }), v = e.key, A = n.pointerId, w = null, H = null, E = {
482
+ }), y = e.key, A = n.pointerId, w = null, U = null, E = {
467
483
  x: n.clientX,
468
484
  y: n.clientY
469
485
  }, D = {
470
486
  x: n.clientX,
471
487
  y: n.clientY
472
- }, O = !1, document.body.style.cursor = "grabbing", z = e.title || e.key, Se()) {
488
+ }, O = !1, document.body.style.cursor = "grabbing", B = e.title || e.key, Ce()) {
473
489
  let i = t.scrollContainerRef.current;
474
- I = r(e), be = i?.scrollLeft ?? 0, L = /* @__PURE__ */ new Map();
490
+ I = r(e), L = i?.scrollLeft ?? 0, R = /* @__PURE__ */ new Map();
475
491
  let a = i ? C(i).find((t) => t.dataset.ssgColKey === e.key) : void 0;
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);
492
+ Se = a ? n.clientX - (a.getBoundingClientRect().left - xe(a)) : (t.paneLayout[I].entries.find((t) => t.column.key === e.key)?.paneLocalSize ?? 0) / 2;
493
+ } else we(B);
478
494
  let i = n.currentTarget, a = n.pointerId;
479
495
  try {
480
496
  i.setPointerCapture(a);
@@ -502,13 +518,13 @@ var p = (e) => {
502
518
  function d() {
503
519
  s(), Q(!1);
504
520
  }
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);
521
+ 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(Le);
506
522
  },
507
- applyReorderSettle: Ie,
523
+ applyReorderSettle: Re,
508
524
  dispose: () => {
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();
525
+ k?.(), k = null, j !== null && (cancelAnimationFrame(j), j = null), y = null, A = null, w = null, document.body.style.cursor = "", K(), R && J(R), R = null, I = null, Y(), X();
510
526
  }
511
527
  };
512
528
  };
513
529
  //#endregion
514
- export { d as computeHeaderReorderedKeys, w as createColumnHeaderDragController, f as resolveConsumerDropSlot };
530
+ export { f as computeHeaderReorderedKeys, w as createColumnHeaderDragController, m as resolveCenterDropSlotRange, p as resolveConsumerDropSlot };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../logic/filtering.cjs");var n=3600*1e3,r=50,i=e=>{let t=new Date(e.getFullYear(),e.getMonth(),e.getDate()+1).getTime()-e.getTime()+r;return Math.min(Math.max(t,r),n)},a=(n={})=>{let r=n.now??(()=>new Date),a=e.createValueStore(t.formatDateKey(r())),o=!1,s=null,c=!1,l=()=>{s!==null&&(clearTimeout(s),s=null)},u=()=>{a.setSnapshot(t.formatDateKey(r()))},d=()=>{l(),s=setTimeout(()=>{s=null,u(),o&&d()},i(r()))},f=()=>{o&&(typeof document<`u`&&document.visibilityState===`hidden`||(u(),d()))},p=()=>{c||typeof window>`u`||(c=!0,window.addEventListener(`focus`,f),document.addEventListener(`visibilitychange`,f))},m=()=>{c&&(c=!1,window.removeEventListener(`focus`,f),document.removeEventListener(`visibilitychange`,f))},h=()=>{o=!1,l(),m()};return{update:({active:e})=>{if(e!==o){if(!e){h();return}o=!0,u(),d(),p()}},getSnapshot:a.getSnapshot,subscribe:a.subscribe,dispose:h}};exports.createDateRolloverStore=a;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../logic/filtering.cjs");var n=3600*1e3,r=50,i=e=>{let t=new Date(e.getFullYear(),e.getMonth(),e.getDate()+1).getTime()-e.getTime()+r;return Math.min(Math.max(t,r),n)},a=(n={})=>{let r=n.now??(()=>new Date),a=e.createValueStore(``),o=!1,s=null,c=!1,l=()=>{s!==null&&(clearTimeout(s),s=null)},u=()=>{a.setSnapshot(t.formatDateKey(r()))},d=()=>{l(),s=setTimeout(()=>{s=null,u(),o&&d()},i(r()))},f=()=>{o&&(typeof document<`u`&&document.visibilityState===`hidden`||(u(),d()))},p=()=>{c||typeof window>`u`||(c=!0,window.addEventListener(`focus`,f),document.addEventListener(`visibilitychange`,f))},m=()=>{c&&(c=!1,window.removeEventListener(`focus`,f),document.removeEventListener(`visibilitychange`,f))},h=()=>{o=!1,l(),m()};return{update:({active:e})=>{if(e!==o){if(!e){h();return}o=!0,u(),d(),p()}},getSnapshot:a.getSnapshot,subscribe:a.subscribe,dispose:h}};exports.createDateRolloverStore=a;
@@ -5,7 +5,7 @@ var n = 3600 * 1e3, r = 50, i = (e) => {
5
5
  let t = new Date(e.getFullYear(), e.getMonth(), e.getDate() + 1).getTime() - e.getTime() + r;
6
6
  return Math.min(Math.max(t, r), n);
7
7
  }, a = (n = {}) => {
8
- let r = n.now ?? (() => /* @__PURE__ */ new Date()), a = e(t(r())), o = !1, s = null, c = !1, l = () => {
8
+ let r = n.now ?? (() => /* @__PURE__ */ new Date()), a = e(""), o = !1, s = null, c = !1, l = () => {
9
9
  s !== null && (clearTimeout(s), s = null);
10
10
  }, u = () => {
11
11
  a.setSnapshot(t(r()));
@@ -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,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),n=a.decideCellWrite(v,b,e,t.localeTexts);if(n.action===`reject`)return{status:`rejected`,message:n.message};d([{viewIndex:g.row,column:v,value:e}])}else if(!x&&f){let e=i.parseCommittedValue(v,r,b),n=a.decideCellWrite(v,b,e,t.localeTexts);if(n.action===`reject`)return{status:`rejected`,message:n.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
+ 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=e=>{if(e===null)return!1;let n=e.ownerDocument.activeElement;return n!==null&&n!==e&&e.contains(n)&&typeof n.closest==`function`&&n.closest(`.ssg-cell-editor`)!==null&&!t.isFocusInsideDetailCard()},l=()=>{let t=null,l=null,u=(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}},d=(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},f=e=>{t=e;let r=e.uiState.editingCell;if(!r){l=null;return}let i=u(e,r);if(l!==null&&i!==null&&Object.is(i.rowKey,l.rowKey)&&i.columnKey===l.columnKey){l={...l,cell:r};return}let a=l!==null&&l.cell.row===r.row&&l.cell.col===r.col;if(l===null||!a){l=i?{...i,cell:r}:null;return}let o=d(e,l);o?(l={...l,cell:o},e.dispatch(n.gridActions.startEdit(o))):(l=null,e.dispatch(n.gridActions.stopEdit()))},p=e=>{t!==null&&(t.dispatch(n.gridActions.startSelection(e)),t.dispatch(n.gridActions.endSelection()),t.dispatch(n.gridActions.activateCell(e)))},m=(e,r)=>{t!==null&&(t.setEditorInitialValue(r),t.dispatch(n.gridActions.startEdit(e)))},h=(e,n=null,i,a=!1)=>{let c=t;if(c===null)return;let l=!1,u=a=>{if(l||!a&&(t===null||t.uiState.editingCell!==null))return;l=!0;let u=c.gridRootRef.current;if(u!==null&&s(u)&&u.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)))}p({row:o,col:r.clamp(e.col,0,Math.max(a-1,0))})}c.editorActionGuardRef.current=!1};a&&queueMicrotask(()=>u(!1)),requestAnimationFrame(()=>u(!0))},g=()=>{let e=t?.gridRootRef.current??null;return c(e)?(e.focus({preventScroll:!0}),!0):!1};return{update:f,activateSingleCell:p,startEditWithValue:m,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:m}=t;if(m.current||!s.editingCell)return{status:`noop`};let _=s.editingCell,v=o===`down`?{row:_.row+1,col:_.col}:o===`up`?{row:_.row-1,col:_.col}:o===`right`?{row:_.row,col:_.col+1}:o===`left`?{row:_.row,col:_.col-1}:_,y=c[_.col],b=l.getSourceIndex(_.row),x=d?l.getRow(_.row):u[b];if(!y||!x)return p(n.gridActions.stopEdit()),{status:`noop`};if(!e.isViewCellEditable({readOnly:t.readOnly,canEditCell:t.canEditCell},l,_.row,_.col,x,y))return m.current=!0,p(n.gridActions.stopEdit()),h(null),{status:`noop`};let S=i.isUnchangedEditorCommit(y,e.getCellValue(x,y),r);if(!S&&d){let e=i.parseCommittedValue(y,r,x),n=a.decideCellWrite(y,x,e,t.localeTexts);if(n.action===`reject`)return{status:`rejected`,message:n.message};d([{viewIndex:_.row,column:y,value:e}])}else if(!S&&f){let e=i.parseCommittedValue(y,r,x),n=a.decideCellWrite(y,x,e,t.localeTexts);if(n.action===`reject`)return{status:`rejected`,message:n.message};f(i.writeRowsCell(u,b,y,e))}m.current=!0;let C=g();return h(v,o===void 0?{activeCell:s.activeCell,selection:s.selection}:null,_.row,C),p(n.gridActions.stopEdit()),{status:`committed`}},cancelEdit:()=>{if(t===null||t.editorActionGuardRef.current)return;t.editorActionGuardRef.current=!0;let e=g();t.dispatch(n.gridActions.stopEdit()),h(null,null,void 0,e)}}};exports.createEditController=l;