@ishibashi0112/spreadsheet-grid-core 0.47.1 → 0.49.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.
- package/dist/controllers/autoHeightMeasurer.cjs +1 -1
- package/dist/controllers/autoHeightMeasurer.js +4 -2
- package/dist/controllers/clipboardController.cjs +1 -1
- package/dist/controllers/clipboardController.d.ts +2 -1
- package/dist/controllers/clipboardController.js +67 -61
- package/dist/controllers/columnAutosizeRunner.cjs +1 -1
- package/dist/controllers/columnAutosizeRunner.d.ts +3 -0
- package/dist/controllers/columnAutosizeRunner.js +40 -24
- package/dist/controllers/columnHeaderDragController.cjs +1 -1
- package/dist/controllers/columnHeaderDragController.js +285 -107
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.js +2 -2
- package/dist/controllers/fillHandleController.cjs +1 -0
- package/dist/controllers/fillHandleController.d.ts +87 -0
- package/dist/controllers/fillHandleController.js +346 -0
- package/dist/controllers/filterPopoverController.cjs +1 -1
- package/dist/controllers/filterPopoverController.js +55 -46
- package/dist/controllers/globalFilteredOrder.cjs +1 -1
- package/dist/controllers/globalFilteredOrder.js +5 -5
- package/dist/controllers/historyController.cjs +1 -1
- package/dist/controllers/historyController.d.ts +1 -0
- package/dist/controllers/historyController.js +8 -5
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.js +2 -2
- package/dist/controllers/pointerInteractionsController.cjs +1 -1
- package/dist/controllers/pointerInteractionsController.d.ts +2 -0
- package/dist/controllers/pointerInteractionsController.js +136 -132
- package/dist/controllers/rowDragController.cjs +1 -1
- package/dist/controllers/rowDragController.d.ts +1 -0
- package/dist/controllers/rowDragController.js +104 -97
- package/dist/controllers/scrollSyncController.cjs +1 -1
- package/dist/controllers/scrollSyncController.d.ts +1 -0
- package/dist/controllers/scrollSyncController.js +32 -21
- package/dist/controllers/selectOptionsCollector.cjs +1 -1
- package/dist/controllers/selectOptionsCollector.js +5 -5
- package/dist/controllers/selectionAggregatesRunner.cjs +1 -0
- package/dist/controllers/selectionAggregatesRunner.d.ts +27 -0
- package/dist/controllers/selectionAggregatesRunner.js +65 -0
- package/dist/controllers/serverSideRowModel.cjs +1 -1
- package/dist/controllers/serverSideRowModel.js +75 -69
- package/dist/controllers/tooltipController.cjs +1 -1
- package/dist/controllers/tooltipController.js +44 -43
- package/dist/controllers/viewportSyncController.cjs +1 -1
- package/dist/controllers/viewportSyncController.d.ts +3 -2
- package/dist/controllers/viewportSyncController.js +6 -4
- package/dist/engine/columnCommands.cjs +1 -1
- package/dist/engine/columnCommands.js +1 -1
- package/dist/engine/columnLayout.cjs +1 -1
- package/dist/engine/columnLayout.js +1 -1
- package/dist/engine/createGridEngine.cjs +1 -1
- package/dist/engine/createGridEngine.d.ts +2 -0
- package/dist/engine/createGridEngine.js +43 -41
- package/dist/engine/gridApi.cjs +1 -1
- package/dist/engine/gridApi.d.ts +6 -0
- package/dist/engine/gridApi.js +134 -123
- package/dist/logic/aggregation.cjs +1 -1
- package/dist/logic/aggregation.d.ts +1 -0
- package/dist/logic/aggregation.js +16 -7
- package/dist/logic/autoScrollGeometry.cjs +1 -1
- package/dist/logic/autoScrollGeometry.d.ts +1 -0
- package/dist/logic/autoScrollGeometry.js +3 -3
- package/dist/logic/clearCells.cjs +1 -1
- package/dist/logic/clearCells.d.ts +1 -1
- package/dist/logic/clearCells.js +7 -7
- package/dist/logic/columnAutosize.cjs +1 -1
- package/dist/logic/columnAutosize.d.ts +6 -0
- package/dist/logic/columnAutosize.js +60 -39
- package/dist/logic/exportCsv.cjs +2 -2
- package/dist/logic/exportCsv.d.ts +5 -1
- package/dist/logic/exportCsv.js +16 -15
- package/dist/logic/exportData.cjs +1 -1
- package/dist/logic/exportData.d.ts +2 -1
- package/dist/logic/exportData.js +27 -21
- package/dist/logic/fillHandle.cjs +1 -0
- package/dist/logic/fillHandle.d.ts +69 -0
- package/dist/logic/fillHandle.js +254 -0
- package/dist/logic/fillSeries.cjs +1 -0
- package/dist/logic/fillSeries.d.ts +11 -0
- package/dist/logic/fillSeries.js +239 -0
- package/dist/logic/filtering.cjs +1 -1
- package/dist/logic/filtering.js +37 -37
- package/dist/logic/gridState.cjs +1 -1
- package/dist/logic/gridState.js +1 -1
- package/dist/logic/imeInput.cjs +1 -1
- package/dist/logic/imeInput.js +2 -2
- package/dist/logic/labelRows.cjs +1 -1
- package/dist/logic/labelRows.js +1 -1
- package/dist/logic/selectOptions.cjs +1 -1
- package/dist/logic/selectOptions.js +1 -1
- package/dist/logic/selectionAggregates.cjs +1 -0
- package/dist/logic/selectionAggregates.d.ts +25 -0
- package/dist/logic/selectionAggregates.js +74 -0
- package/dist/logic/totalRow.cjs +1 -0
- package/dist/logic/totalRow.d.ts +25 -0
- package/dist/logic/totalRow.js +90 -0
- package/dist/model/gridReducer.cjs +1 -1
- package/dist/model/gridReducer.js +1 -1
- package/dist/model/gridTypes.core.d.ts +205 -16
- package/dist/model/gridTypes.unbound.d.ts +4 -0
- package/dist/utils/clipboard.cjs +1 -1
- package/dist/utils/clipboard.d.ts +1 -1
- package/dist/utils/clipboard.js +9 -9
- package/dist/utils/permissions.cjs +1 -1
- package/dist/utils/permissions.d.ts +6 -2
- package/dist/utils/permissions.js +8 -2
- package/package.json +1 -1
|
@@ -40,12 +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, _ = "<svg viewBox=\"0 0 24 24\" width=\"
|
|
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 = [
|
|
44
|
+
"data-ssg-col-key",
|
|
45
|
+
"data-ssg-tooltip",
|
|
46
|
+
"data-autoheight-cell",
|
|
47
|
+
"id",
|
|
48
|
+
"tabindex"
|
|
49
|
+
], me = 180, he = 400, w = (t) => {
|
|
44
50
|
let n = [];
|
|
45
51
|
return t.querySelectorAll("[data-ssg-col-key]").forEach((r) => {
|
|
46
52
|
e(t, r) || n.push(r);
|
|
47
53
|
}), n;
|
|
48
|
-
},
|
|
54
|
+
}, ge = (t) => {
|
|
49
55
|
if (!t) return null;
|
|
50
56
|
let n = /* @__PURE__ */ new Map();
|
|
51
57
|
return t.querySelectorAll("[data-ssg-col-key]").forEach((r) => {
|
|
@@ -53,18 +59,23 @@ var f = (e) => {
|
|
|
53
59
|
let i = r.dataset.ssgColKey;
|
|
54
60
|
i && !n.has(i) && n.set(i, r.getBoundingClientRect().left);
|
|
55
61
|
}), n;
|
|
62
|
+
}, _e = (e) => {
|
|
63
|
+
let t = getComputedStyle(e).transform, n = /^matrix(3d)?\(([^)]*)\)$/.exec(t);
|
|
64
|
+
if (n === null) return 0;
|
|
65
|
+
let r = Number(n[2].split(",")[n[1] === "3d" ? 12 : 4]);
|
|
66
|
+
return Number.isFinite(r) ? r : 0;
|
|
56
67
|
}, T = () => {
|
|
57
|
-
let t = null,
|
|
68
|
+
let t = null, _ = null, T = null, E = null, D = {
|
|
58
69
|
x: 0,
|
|
59
70
|
y: 0
|
|
60
|
-
},
|
|
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 = () => ({
|
|
61
72
|
left: t?.leftIndicatorRef.current ?? null,
|
|
62
73
|
center: t?.centerIndicatorRef.current ?? null,
|
|
63
74
|
right: t?.rightIndicatorRef.current ?? null
|
|
64
|
-
}),
|
|
65
|
-
for (let e of Object.values(
|
|
66
|
-
},
|
|
67
|
-
if (
|
|
75
|
+
}), G = () => {
|
|
76
|
+
for (let e of Object.values(W())) e && (e.style.display = "none");
|
|
77
|
+
}, xe = (e) => {
|
|
78
|
+
if (P) return;
|
|
68
79
|
let n = document.createElement("div");
|
|
69
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 = [
|
|
70
81
|
"position:fixed",
|
|
@@ -92,19 +103,19 @@ var f = (e) => {
|
|
|
92
103
|
let r = document.createElement("span");
|
|
93
104
|
r.style.cssText = "display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none";
|
|
94
105
|
let i = document.createElement("span");
|
|
95
|
-
i.textContent = e, n.appendChild(r), n.appendChild(i), document.body.appendChild(n),
|
|
96
|
-
},
|
|
97
|
-
let t =
|
|
106
|
+
i.textContent = e, n.appendChild(r), n.appendChild(i), document.body.appendChild(n), P = n, F = r, I = null;
|
|
107
|
+
}, Se = (e) => {
|
|
108
|
+
let t = P;
|
|
98
109
|
if (!t) return;
|
|
99
|
-
t.style.transform = "translate(" + (
|
|
110
|
+
t.style.transform = "translate(" + (D.x + h) + "px," + (D.y + g) + "px)";
|
|
100
111
|
let n = e ?? "out";
|
|
101
|
-
if (
|
|
102
|
-
|
|
103
|
-
let r =
|
|
104
|
-
n === "out" ? (t.style.opacity =
|
|
112
|
+
if (I === n) return;
|
|
113
|
+
I = n;
|
|
114
|
+
let r = F;
|
|
115
|
+
n === "out" ? (t.style.opacity = re, r && (r.innerHTML = ne)) : (t.style.opacity = "1", r && (r.innerHTML = n === "center" ? ee : te));
|
|
105
116
|
}, K = () => {
|
|
106
|
-
|
|
107
|
-
},
|
|
117
|
+
P && P.parentNode && P.parentNode.removeChild(P), P = null, F = null, I = null;
|
|
118
|
+
}, Ce = (e, r) => {
|
|
108
119
|
if (t === null) return null;
|
|
109
120
|
let { paneLayout: a, leftPaneScrollRef: o, rightPaneScrollRef: s, bodyScrollRef: c, scrollContainerRef: l, leftLeadingWidth: u, centerLeadingWidth: d, rightLeadingWidth: h } = t, g = l.current;
|
|
110
121
|
if (g) {
|
|
@@ -154,8 +165,8 @@ var f = (e) => {
|
|
|
154
165
|
};
|
|
155
166
|
}
|
|
156
167
|
return null;
|
|
157
|
-
},
|
|
158
|
-
let t =
|
|
168
|
+
}, we = (e) => {
|
|
169
|
+
let t = W();
|
|
159
170
|
for (let n of [
|
|
160
171
|
"left",
|
|
161
172
|
"center",
|
|
@@ -164,66 +175,184 @@ var f = (e) => {
|
|
|
164
175
|
let r = t[n];
|
|
165
176
|
r && (n === e.pane ? (r.style.left = `${e.leftPx}px`, r.style.display = "block") : r.style.display = "none");
|
|
166
177
|
}
|
|
167
|
-
},
|
|
178
|
+
}, Te = (e, t) => {
|
|
168
179
|
let n = z?.get(t);
|
|
169
|
-
n !== void 0 && z?.delete(t), e.set(t, n ??
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
180
|
+
n !== void 0 && z?.delete(t), e.set(t, n ?? {
|
|
181
|
+
zIndex: t.style.zIndex,
|
|
182
|
+
visibility: t.style.visibility
|
|
183
|
+
});
|
|
184
|
+
}, q = (e, n) => {
|
|
185
|
+
let r = [], i = R, a = _, o = L;
|
|
186
|
+
if (!i || a === null || o === null || t === null) return r;
|
|
187
|
+
let s = t.scrollContainerRef.current;
|
|
188
|
+
if (!s) return r;
|
|
189
|
+
let c = t.paneLayout[o].entries, l = c.findIndex((e) => e.column.key === a);
|
|
190
|
+
if (l < 0) return r;
|
|
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
|
+
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();
|
|
194
|
+
U = g;
|
|
195
|
+
for (let e of w(s)) {
|
|
181
196
|
let t = e.dataset.ssgColKey;
|
|
182
197
|
if (t === void 0) continue;
|
|
183
|
-
|
|
184
|
-
|
|
198
|
+
g.add(e);
|
|
199
|
+
let o = h !== null && !h.has(e) ? "none" : x;
|
|
200
|
+
if (t === a) {
|
|
201
|
+
r.push(e), i.has(e) || (Te(i, e), e.style.zIndex = se, e.style.willChange = "transform");
|
|
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)");
|
|
185
204
|
continue;
|
|
186
205
|
}
|
|
187
|
-
let
|
|
188
|
-
if (
|
|
189
|
-
|
|
190
|
-
let
|
|
191
|
-
e.style.transform !==
|
|
206
|
+
let s = f.get(t) ?? 0;
|
|
207
|
+
if (s === 0 && !i.has(e)) continue;
|
|
208
|
+
i.has(e) || Te(i, e);
|
|
209
|
+
let c = `translateX(${s}px)`;
|
|
210
|
+
e.style.transform !== c && (e.style.transition = o, e.style.transform = c);
|
|
192
211
|
}
|
|
193
|
-
|
|
212
|
+
return r;
|
|
213
|
+
}, J = (e) => {
|
|
194
214
|
e.forEach((e, t) => {
|
|
195
|
-
t.style.transition = "", t.style.transform = "", t.style.willChange = "", t.style.zIndex = e, t.removeAttribute(
|
|
215
|
+
t.style.transition = "", t.style.transform = "", t.style.willChange = "", t.style.zIndex = e.zIndex, t.style.visibility = e.visibility, t.removeAttribute(S);
|
|
196
216
|
});
|
|
217
|
+
}, Ee = (e) => {
|
|
218
|
+
let t = (e) => {
|
|
219
|
+
for (let t of pe) e.removeAttribute(t);
|
|
220
|
+
};
|
|
221
|
+
t(e), e.querySelectorAll("*").forEach(t), e.querySelectorAll(".ssg-header-actions").forEach((e) => e.remove());
|
|
222
|
+
}, De = (e, t, n) => {
|
|
223
|
+
let r = V;
|
|
224
|
+
if (r === null) {
|
|
225
|
+
let e = document.createElement("div");
|
|
226
|
+
e.className = le, e.setAttribute("aria-hidden", "true"), e.setAttribute("inert", "");
|
|
227
|
+
let n = document.createElement("div");
|
|
228
|
+
n.style.cssText = "position:absolute;top:0;left:0;height:100%;will-change:transform";
|
|
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 = {
|
|
231
|
+
layer: e,
|
|
232
|
+
column: n,
|
|
233
|
+
guide: i,
|
|
234
|
+
badge: null,
|
|
235
|
+
badgeKind: null,
|
|
236
|
+
layerWidth: 0,
|
|
237
|
+
columnWidth: 0,
|
|
238
|
+
scrollTop: 0,
|
|
239
|
+
cellCount: 0
|
|
240
|
+
}, V = r;
|
|
241
|
+
}
|
|
242
|
+
let i = t.getBoundingClientRect(), a = e.getBoundingClientRect(), o = a.left + e.clientLeft, s = a.top + e.clientTop;
|
|
243
|
+
r.layer.style.cssText = [
|
|
244
|
+
"position:absolute",
|
|
245
|
+
`left:${o - i.left - t.clientLeft + t.scrollLeft}px`,
|
|
246
|
+
`top:${s - i.top - t.clientTop + t.scrollTop}px`,
|
|
247
|
+
`width:${e.clientWidth}px`,
|
|
248
|
+
`height:${e.clientHeight}px`,
|
|
249
|
+
"overflow:hidden",
|
|
250
|
+
"pointer-events:none",
|
|
251
|
+
`z-index:${ce}`
|
|
252
|
+
].join(";");
|
|
253
|
+
let c = [], l = [], u = 0;
|
|
254
|
+
for (let e of n) {
|
|
255
|
+
let t = e.getBoundingClientRect(), n = e.cloneNode(!0);
|
|
256
|
+
Ee(n), n.setAttribute(S, "live");
|
|
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);
|
|
259
|
+
}
|
|
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));
|
|
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
|
+
}, Oe = (e) => {
|
|
264
|
+
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) => {
|
|
267
|
+
if (t === null) return !1;
|
|
268
|
+
let n = t.leftPaneScrollRef.current;
|
|
269
|
+
if (n && t.paneLayout.left.entries.length > 0 && e < n.getBoundingClientRect().right - .5) return !0;
|
|
270
|
+
let r = t.rightPaneScrollRef.current;
|
|
271
|
+
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];
|
|
274
|
+
if (!i || i.style.display !== "block") {
|
|
275
|
+
r.style.display = "none";
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
let a = i.getBoundingClientRect();
|
|
279
|
+
if (t === "center" && ke(a.left + a.width / 2)) {
|
|
280
|
+
r.style.display = "none";
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
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
|
+
}, 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);
|
|
286
|
+
e.column.style.transition = "none", e.column.style.transform = `translateX(${i}px)`;
|
|
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);
|
|
289
|
+
}, Y = () => {
|
|
290
|
+
V?.layer.remove(), V = null;
|
|
291
|
+
}, Me = (e, t, n) => {
|
|
292
|
+
let r = e.layer.getBoundingClientRect();
|
|
293
|
+
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
|
+
}, X = () => {
|
|
295
|
+
let e = H;
|
|
296
|
+
if (H = null, e !== null) {
|
|
297
|
+
e.timer !== null && window.clearTimeout(e.timer);
|
|
298
|
+
for (let [t, n] of e.hiddenCells) t.style.visibility = n;
|
|
299
|
+
e.float.layer.remove();
|
|
300
|
+
}
|
|
301
|
+
}, Ne = () => {
|
|
302
|
+
let e = H;
|
|
303
|
+
if (e === null || e.key === null) return;
|
|
304
|
+
let n = e.key;
|
|
305
|
+
if (e.pane !== null && !t?.paneLayout[e.pane].entries.some((e) => e.column.key === n)) return;
|
|
306
|
+
e.key = null;
|
|
307
|
+
let r = t?.scrollContainerRef.current ?? null, i = r ? w(r).filter((e) => e.dataset.ssgColKey === n) : [];
|
|
308
|
+
if (i.length === 0) {
|
|
309
|
+
X();
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
let a = i[0].getBoundingClientRect().left;
|
|
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);
|
|
197
315
|
}, Z = () => {
|
|
198
|
-
let e =
|
|
199
|
-
if (
|
|
200
|
-
e && (
|
|
316
|
+
let e = Ce(D.x, D.y);
|
|
317
|
+
if (be()) {
|
|
318
|
+
e && (T = {
|
|
201
319
|
pane: e.pane,
|
|
202
320
|
slot: e.slot
|
|
203
321
|
});
|
|
204
|
-
let
|
|
205
|
-
if (
|
|
206
|
-
|
|
322
|
+
let n = T;
|
|
323
|
+
if (n !== null && n.pane !== L) {
|
|
324
|
+
if (e && we(e), (t?.scrollContainerRef.current ?? null)?.parentElement != null) {
|
|
325
|
+
let e = Oe(q(null, "lift-out"));
|
|
326
|
+
if (e !== null) {
|
|
327
|
+
K(), je(e, n.pane);
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
Y(), xe(B), Se(n.pane), q(null, "rest");
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
if (K(), G(), q(n === null ? null : n.slot, "follow").length === 0 && V !== null) {
|
|
335
|
+
je(V, null);
|
|
207
336
|
return;
|
|
208
337
|
}
|
|
209
|
-
|
|
338
|
+
Y();
|
|
210
339
|
return;
|
|
211
340
|
}
|
|
212
|
-
if (
|
|
213
|
-
|
|
341
|
+
if (Se(e ? e.pane : null), !e) {
|
|
342
|
+
T = null, G();
|
|
214
343
|
return;
|
|
215
344
|
}
|
|
216
|
-
|
|
345
|
+
T = {
|
|
217
346
|
pane: e.pane,
|
|
218
347
|
slot: e.slot
|
|
219
|
-
},
|
|
220
|
-
},
|
|
221
|
-
if (
|
|
348
|
+
}, we(e);
|
|
349
|
+
}, Pe = () => {
|
|
350
|
+
if (_ === null) {
|
|
222
351
|
M = null;
|
|
223
352
|
return;
|
|
224
353
|
}
|
|
225
354
|
let e = t?.scrollContainerRef.current ?? null;
|
|
226
|
-
if (e && (
|
|
355
|
+
if (e && (k || (!O || o(O, D, 6)) && (k = !0), k)) {
|
|
227
356
|
let t = e.getBoundingClientRect(), n = c({
|
|
228
357
|
rectLeft: t.left,
|
|
229
358
|
rectTop: t.top,
|
|
@@ -231,27 +360,88 @@ var f = (e) => {
|
|
|
231
360
|
clientTop: e.clientTop,
|
|
232
361
|
clientWidth: e.clientWidth,
|
|
233
362
|
clientHeight: e.clientHeight
|
|
234
|
-
}), r = s(
|
|
363
|
+
}), r = s(D.x, n.left, n.right, 24), i = a(e.scrollLeft, r, 18, e.scrollWidth - e.clientWidth);
|
|
235
364
|
i !== e.scrollLeft && e.scrollTo({
|
|
236
365
|
left: i,
|
|
237
366
|
behavior: "auto"
|
|
238
367
|
});
|
|
239
368
|
}
|
|
240
|
-
Z(), M = requestAnimationFrame(
|
|
241
|
-
},
|
|
242
|
-
M !== null && (cancelAnimationFrame(M), M = null), document.body.style.cursor = "",
|
|
243
|
-
let n =
|
|
244
|
-
|
|
369
|
+
Z(), M = requestAnimationFrame(Pe);
|
|
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;
|
|
245
374
|
let a = R;
|
|
246
|
-
R = null,
|
|
247
|
-
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;
|
|
248
|
-
if (a && !c
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
375
|
+
R = null, L = 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) {
|
|
378
|
+
a.forEach((e, t) => {
|
|
379
|
+
t.isConnected && (t.style.transition = x, t.style.transform = "translateX(0px)");
|
|
380
|
+
});
|
|
381
|
+
let e = null;
|
|
382
|
+
if (l !== null) {
|
|
383
|
+
let t = null;
|
|
384
|
+
for (let e of a.keys()) if (e.isConnected && e.dataset.ssgColKey === n) {
|
|
385
|
+
t = e;
|
|
386
|
+
break;
|
|
387
|
+
}
|
|
388
|
+
t === null ? l.layer.remove() : (Me(l, t.getBoundingClientRect().left, oe), e = {
|
|
389
|
+
float: l,
|
|
390
|
+
key: null,
|
|
391
|
+
pane: null,
|
|
392
|
+
timer: null,
|
|
393
|
+
hiddenCells: []
|
|
394
|
+
}, H = e);
|
|
395
|
+
}
|
|
396
|
+
z = a, window.setTimeout(() => {
|
|
397
|
+
J(a), z === a && (z = null), e !== null && H === e && X();
|
|
398
|
+
}, 200);
|
|
399
|
+
} else l !== null && !c && l.layer.remove();
|
|
400
|
+
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
|
+
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 = {
|
|
403
|
+
float: l,
|
|
404
|
+
key: n,
|
|
405
|
+
pane: i.pane,
|
|
406
|
+
timer: window.setTimeout(X, he),
|
|
407
|
+
hiddenCells: []
|
|
408
|
+
}), p(c, /* @__PURE__ */ new Map([[n, i.pane === "center" ? void 0 : i.pane]]));
|
|
409
|
+
}, Fe = () => {
|
|
410
|
+
Ne();
|
|
411
|
+
let n = E;
|
|
412
|
+
if (E = null, !n) return;
|
|
413
|
+
let r = t?.scrollContainerRef.current ?? null;
|
|
414
|
+
if (!r) return;
|
|
415
|
+
let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
416
|
+
r.querySelectorAll("[data-ssg-col-key]").forEach((t) => {
|
|
417
|
+
if (e(r, t)) return;
|
|
418
|
+
let o = t.dataset.ssgColKey;
|
|
419
|
+
if (!o || !n.has(o)) return;
|
|
420
|
+
let s = i.get(o);
|
|
421
|
+
s ? s.push(t) : (i.set(o, [t]), a.set(o, t.getBoundingClientRect().left));
|
|
422
|
+
});
|
|
423
|
+
let o = [];
|
|
424
|
+
if (i.forEach((e, t) => {
|
|
425
|
+
let r = n.get(t), i = a.get(t);
|
|
426
|
+
if (r === void 0 || i === void 0) return;
|
|
427
|
+
let s = r - i;
|
|
428
|
+
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);
|
|
429
|
+
}), o.length === 0) return;
|
|
430
|
+
r.getBoundingClientRect();
|
|
431
|
+
for (let e of o) e.style.transition = `transform ${ie}ms ${b}`, e.style.transform = "translateX(0)";
|
|
432
|
+
$();
|
|
433
|
+
let s = () => {
|
|
434
|
+
for (let e of o) e.style.transition = "", e.style.transform = "", e.style.willChange = "";
|
|
435
|
+
}, c = {
|
|
436
|
+
run: s,
|
|
437
|
+
timer: window.setTimeout(() => {
|
|
438
|
+
N === c && (N = null), s();
|
|
439
|
+
}, 280)
|
|
440
|
+
};
|
|
441
|
+
N = c;
|
|
442
|
+
}, $ = () => {
|
|
443
|
+
let e = N;
|
|
444
|
+
N = null, e !== null && (window.clearTimeout(e.timer), e.run());
|
|
255
445
|
};
|
|
256
446
|
return {
|
|
257
447
|
update: (e) => {
|
|
@@ -259,68 +449,56 @@ var f = (e) => {
|
|
|
259
449
|
},
|
|
260
450
|
onColumnDragHandlePointerDown: (e, n) => {
|
|
261
451
|
if (t === null || !t.enabled || n.button !== 0) return;
|
|
262
|
-
n.stopPropagation(), n.preventDefault(),
|
|
452
|
+
if (n.stopPropagation(), n.preventDefault(), _ !== null) {
|
|
453
|
+
if (n.pointerId !== j) return;
|
|
454
|
+
A?.(), Q(!1);
|
|
455
|
+
}
|
|
456
|
+
if ($(), X(), Y(), z?.forEach((e, t) => {
|
|
457
|
+
t.style.visibility = e.visibility;
|
|
458
|
+
}), _ = e.key, j = n.pointerId, T = null, U = null, D = {
|
|
263
459
|
x: n.clientX,
|
|
264
460
|
y: n.clientY
|
|
265
|
-
},
|
|
461
|
+
}, O = {
|
|
266
462
|
x: n.clientX,
|
|
267
463
|
y: n.clientY
|
|
268
|
-
},
|
|
464
|
+
}, k = !1, document.body.style.cursor = "grabbing", B = e.title || e.key, be()) {
|
|
465
|
+
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;
|
|
469
|
+
} else xe(B);
|
|
269
470
|
let i = n.currentTarget, a = n.pointerId;
|
|
270
471
|
try {
|
|
271
472
|
i.setPointerCapture(a);
|
|
272
473
|
} catch {}
|
|
273
474
|
let o = (e) => {
|
|
274
|
-
e.pointerId === a && (
|
|
475
|
+
e.pointerId === a && (D = {
|
|
275
476
|
x: e.clientX,
|
|
276
477
|
y: e.clientY
|
|
277
478
|
}, Z());
|
|
278
479
|
}, s = () => {
|
|
279
|
-
window.removeEventListener("pointermove", o), window.removeEventListener("pointerup", c), window.removeEventListener("pointercancel", l), window.removeEventListener("keydown", u),
|
|
480
|
+
window.removeEventListener("pointermove", o), window.removeEventListener("pointerup", c), window.removeEventListener("pointercancel", l), window.removeEventListener("keydown", u), window.removeEventListener("blur", d), A = null;
|
|
280
481
|
try {
|
|
281
482
|
i.releasePointerCapture(a);
|
|
282
483
|
} catch {}
|
|
283
484
|
};
|
|
284
485
|
function c(e) {
|
|
285
|
-
e.pointerId === a && (s(),
|
|
486
|
+
e.pointerId === a && (s(), Q(!0));
|
|
286
487
|
}
|
|
287
488
|
function l(e) {
|
|
288
|
-
e.pointerId === a && (s(),
|
|
489
|
+
e.pointerId === a && (s(), Q(!1));
|
|
289
490
|
}
|
|
290
491
|
function u(e) {
|
|
291
|
-
e.key === "Escape" && (s(),
|
|
492
|
+
e.key === "Escape" && (s(), Q(!1));
|
|
292
493
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
applyReorderSettle: () => {
|
|
296
|
-
let n = D;
|
|
297
|
-
if (D = null, !n) return;
|
|
298
|
-
let r = t?.scrollContainerRef.current ?? null;
|
|
299
|
-
if (!r) return;
|
|
300
|
-
let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
301
|
-
r.querySelectorAll("[data-ssg-col-key]").forEach((t) => {
|
|
302
|
-
if (e(r, t)) return;
|
|
303
|
-
let o = t.dataset.ssgColKey;
|
|
304
|
-
if (!o || !n.has(o)) return;
|
|
305
|
-
let s = i.get(o);
|
|
306
|
-
s ? s.push(t) : (i.set(o, [t]), a.set(o, t.getBoundingClientRect().left));
|
|
307
|
-
});
|
|
308
|
-
let o = [];
|
|
309
|
-
if (i.forEach((e, t) => {
|
|
310
|
-
let r = n.get(t), i = a.get(t);
|
|
311
|
-
if (r === void 0 || i === void 0) return;
|
|
312
|
-
let s = r - i;
|
|
313
|
-
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);
|
|
314
|
-
}), o.length !== 0) {
|
|
315
|
-
r.getBoundingClientRect();
|
|
316
|
-
for (let e of o) e.style.transition = `transform ${te}ms ${b}`, e.style.transform = "translateX(0)";
|
|
317
|
-
window.setTimeout(() => {
|
|
318
|
-
for (let e of o) e.style.transition = "", e.style.transform = "", e.style.willChange = "";
|
|
319
|
-
}, 280);
|
|
494
|
+
function d() {
|
|
495
|
+
s(), Q(!1);
|
|
320
496
|
}
|
|
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);
|
|
321
498
|
},
|
|
499
|
+
applyReorderSettle: Fe,
|
|
322
500
|
dispose: () => {
|
|
323
|
-
|
|
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();
|
|
324
502
|
}
|
|
325
503
|
};
|
|
326
504
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/permissions.cjs"),t=require("../logic/detailRow.cjs"),n=require("../model/gridActions.cjs"),r=require("../logic/geometry.cjs"),i=require("../logic/editorValues.cjs"),a=require("../logic/validation.cjs");var o=(e,t)=>t.activeCell!==e.activeCell||t.selection!==e.selection,s=e=>{if(t.isFocusInsideDetailCard())return!1;let n=e.ownerDocument,r=n.activeElement;return r===null||r===n.body||r===n.documentElement||e.contains(r)},c=()=>{let t=null,c=null,l=(e,t)=>{let n=e.visibleColumns[t.col];return!n||t.row<0||t.row>=e.rowModel.getRowCount()||e.rowModel.getRow(t.row)===void 0?null:{rowKey:e.rowModel.getRowKey(t.row),columnKey:n.key}},u=(e,t)=>{let n=e.visibleColumns.findIndex(e=>e.key===t.columnKey);if(n<0)return null;let r=e.rowModel.getRowCount();for(let i=0;i<r;i+=1)if(e.rowModel.getRow(i)!==void 0&&Object.is(e.rowModel.getRowKey(i),t.rowKey))return{row:i,col:n};return null},d=e=>{t=e;let r=e.uiState.editingCell;if(!r){c=null;return}let i=l(e,r);if(c!==null&&i!==null&&Object.is(i.rowKey,c.rowKey)&&i.columnKey===c.columnKey){c={...c,cell:r};return}let a=c!==null&&c.cell.row===r.row&&c.cell.col===r.col;if(c===null||!a){c=i?{...i,cell:r}:null;return}let o=u(e,c);o?(c={...c,cell:o},e.dispatch(n.gridActions.startEdit(o))):(c=null,e.dispatch(n.gridActions.stopEdit()))},f=e=>{t!==null&&(t.dispatch(n.gridActions.startSelection(e)),t.dispatch(n.gridActions.endSelection()),t.dispatch(n.gridActions.activateCell(e)))},p=(e,r)=>{t!==null&&(t.setEditorInitialValue(r),t.dispatch(n.gridActions.startEdit(e)))},m=(e,n=null)=>{let i=t;i!==null&&requestAnimationFrame(()=>{let a=i.gridRootRef.current;if(a!==null&&s(a)&&a.focus(),e!==null&&t!==null&&!(n!==null&&o(n,t.uiState))){let n=t.rowModel.getRowCount(),i=t.visibleColumns.length;f({row:r.clamp(e.row,0,Math.max(n-1,0)),col:r.clamp(e.col,0,Math.max(i-1,0))})}i.editorActionGuardRef.current=!1})};return{update:d,activateSingleCell:f,startEditWithValue:p,commitEdit:(r,o)=>{if(t===null)return{status:`noop`};let{uiState:s,visibleColumns:c,rowModel:l,rows:u,applyServerSideCellEdits:d,onRowsChange:f,dispatch:p,editorActionGuardRef:h}=t;if(h.current||!s.editingCell)return{status:`noop`};let g=s.editingCell,_=o===`down`?{row:g.row+1,col:g.col}:o===`up`?{row:g.row-1,col:g.col}:o===`right`?{row:g.row,col:g.col+1}:o===`left`?{row:g.row,col:g.col-1}:g,v=c[g.col],y=l.getSourceIndex(g.row),b=d?l.getRow(g.row):u[y];if(!v||!b)return p(n.gridActions.stopEdit()),{status:`noop`};if(!e.
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/permissions.cjs"),t=require("../logic/detailRow.cjs"),n=require("../model/gridActions.cjs"),r=require("../logic/geometry.cjs"),i=require("../logic/editorValues.cjs"),a=require("../logic/validation.cjs");var o=(e,t)=>t.activeCell!==e.activeCell||t.selection!==e.selection,s=e=>{if(t.isFocusInsideDetailCard())return!1;let n=e.ownerDocument,r=n.activeElement;return r===null||r===n.body||r===n.documentElement||e.contains(r)},c=()=>{let t=null,c=null,l=(e,t)=>{let n=e.visibleColumns[t.col];return!n||t.row<0||t.row>=e.rowModel.getRowCount()||e.rowModel.getRow(t.row)===void 0?null:{rowKey:e.rowModel.getRowKey(t.row),columnKey:n.key}},u=(e,t)=>{let n=e.visibleColumns.findIndex(e=>e.key===t.columnKey);if(n<0)return null;let r=e.rowModel.getRowCount();for(let i=0;i<r;i+=1)if(e.rowModel.getRow(i)!==void 0&&Object.is(e.rowModel.getRowKey(i),t.rowKey))return{row:i,col:n};return null},d=e=>{t=e;let r=e.uiState.editingCell;if(!r){c=null;return}let i=l(e,r);if(c!==null&&i!==null&&Object.is(i.rowKey,c.rowKey)&&i.columnKey===c.columnKey){c={...c,cell:r};return}let a=c!==null&&c.cell.row===r.row&&c.cell.col===r.col;if(c===null||!a){c=i?{...i,cell:r}:null;return}let o=u(e,c);o?(c={...c,cell:o},e.dispatch(n.gridActions.startEdit(o))):(c=null,e.dispatch(n.gridActions.stopEdit()))},f=e=>{t!==null&&(t.dispatch(n.gridActions.startSelection(e)),t.dispatch(n.gridActions.endSelection()),t.dispatch(n.gridActions.activateCell(e)))},p=(e,r)=>{t!==null&&(t.setEditorInitialValue(r),t.dispatch(n.gridActions.startEdit(e)))},m=(e,n=null)=>{let i=t;i!==null&&requestAnimationFrame(()=>{let a=i.gridRootRef.current;if(a!==null&&s(a)&&a.focus(),e!==null&&t!==null&&!(n!==null&&o(n,t.uiState))){let n=t.rowModel.getRowCount(),i=t.visibleColumns.length;f({row:r.clamp(e.row,0,Math.max(n-1,0)),col:r.clamp(e.col,0,Math.max(i-1,0))})}i.editorActionGuardRef.current=!1})};return{update:d,activateSingleCell:f,startEditWithValue:p,commitEdit:(r,o)=>{if(t===null)return{status:`noop`};let{uiState:s,visibleColumns:c,rowModel:l,rows:u,applyServerSideCellEdits:d,onRowsChange:f,dispatch:p,editorActionGuardRef:h}=t;if(h.current||!s.editingCell)return{status:`noop`};let g=s.editingCell,_=o===`down`?{row:g.row+1,col:g.col}:o===`up`?{row:g.row-1,col:g.col}:o===`right`?{row:g.row,col:g.col+1}:o===`left`?{row:g.row,col:g.col-1}:g,v=c[g.col],y=l.getSourceIndex(g.row),b=d?l.getRow(g.row):u[y];if(!v||!b)return p(n.gridActions.stopEdit()),{status:`noop`};if(!e.isViewCellEditable({readOnly:t.readOnly,canEditCell:t.canEditCell},l,g.row,g.col,b,v))return h.current=!0,p(n.gridActions.stopEdit()),m(null),{status:`noop`};if(d){let e=i.parseCommittedValue(v,r,b),t=a.decideCellWrite(v,b,e);if(t.action===`reject`)return{status:`rejected`,message:t.message};d([{viewIndex:g.row,column:v,value:e}])}else if(f){let e=i.parseCommittedValue(v,r,b),t=a.decideCellWrite(v,b,e);if(t.action===`reject`)return{status:`rejected`,message:t.message};f(i.writeRowsCell(u,y,v,e))}return h.current=!0,m(_,o===void 0?{activeCell:s.activeCell,selection:s.selection}:null),p(n.gridActions.stopEdit()),{status:`committed`}},cancelEdit:()=>{t===null||t.editorActionGuardRef.current||(t.editorActionGuardRef.current=!0,t.dispatch(n.gridActions.stopEdit()),m(null))}}};exports.createEditController=c;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isViewCellEditable as e } from "../utils/permissions.js";
|
|
2
2
|
import { isFocusInsideDetailCard as t } from "../logic/detailRow.js";
|
|
3
3
|
import { gridActions as n } from "../model/gridActions.js";
|
|
4
4
|
import { clamp as r } from "../logic/geometry.js";
|
|
@@ -96,7 +96,7 @@ var s = (e, t) => t.activeCell !== e.activeCell || t.selection !== e.selection,
|
|
|
96
96
|
if (!e({
|
|
97
97
|
readOnly: t.readOnly,
|
|
98
98
|
canEditCell: t.canEditCell
|
|
99
|
-
}, _.row, _.col, x, y)) return g.current = !0, m(n.stopEdit()), h(null), { status: "noop" };
|
|
99
|
+
}, u, _.row, _.col, x, y)) return g.current = !0, m(n.stopEdit()), h(null), { status: "noop" };
|
|
100
100
|
if (f) {
|
|
101
101
|
let e = i(y, r, x), t = o(y, x, e);
|
|
102
102
|
if (t.action === "reject") return {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../utils/permissions.cjs"),n=require("../model/gridActions.cjs"),r=require("../logic/autoScrollGeometry.cjs"),i=require("./popoverSupport.cjs"),a=require("../logic/fillHandle.cjs");var o=168,s=84,c=8,l={status:`idle`},u=(e,t,n)=>{if(e.valueFormatter)try{return e.valueFormatter({value:n,row:t,column:e})}catch{return String(n??``)}return String(n??``)},d=(e,t)=>e===t||e.length===t.length&&e.every((e,n)=>e.key===t[n].key),f=500,p=6,m=2,h=e=>{let t=e.currentTarget;if(!(t instanceof Element))return!0;let n=t.getBoundingClientRect();return e.clientX>=n.left-m&&e.clientX<=n.right+m&&e.clientY>=n.top-m&&e.clientY<=n.bottom+m},g=(e,t)=>e===t||e!==void 0&&t!==void 0&&e.length===t.length&&e.every((e,n)=>Object.is(e,t[n])),_=(e,t)=>Object.is(e,t)||e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime(),v=(e,t)=>e.length===t.length&&e.every((e,n)=>e.viewIndex===t[n].viewIndex&&e.column.key===t[n].column.key&&_(e.value,t[n].value)),y=()=>{let m=null,_=e.createValueStore(l),y=e.createValueStore(null),b={current:null},x={current:null},S=null,C=null,w=null,T=e=>e?`toggled`:`auto`,E=e=>(n,r,i,a)=>t.isViewCellEditable({readOnly:e.readOnly,canEditCell:e.canEditCell},e.rowModel,n,r,i,a),D=()=>{if(w===null||m===null)return;let e=_.getSnapshot();if(e.status===`dragging`&&e.toggled===w.toggled&&(e.target===w.target||e.target!==null&&w.target!==null&&e.target.direction===w.target.direction&&a.isSameFillRange(e.target.range,w.target.range)))return;let t=null;if(w.target!==null){let e=a.previewFillValue({rowModel:m.rowModel,columns:m.columns,source:w.source,target:w.target,request:T(w.toggled),canWriteCell:E(m),getFillValue:m.getFillValue});t=e&&u(e.column,e.row,e.value)||null}_.setSnapshot({status:`dragging`,source:w.source,target:w.target,toggled:w.toggled,previewText:t})},O=()=>{if(w===null||m===null)return;let e=a.resolveFillColumnBounds(m.columns),t=m.hitTest(w.pointer.x,w.pointer.y);e===null||t===null||(w.target=a.resolveFillTarget(w.source,t,m.rowModel.getRowCount(),e),D())},k=()=>{if(w===null||m===null)return;let e=w;e.rafId=requestAnimationFrame(k);let t=m.scrollContainerRef.current;if(!t)return;if(!e.armed){if(!r.hasPointerLeftActivationRadius(e.origin,e.pointer,6))return;e.armed=!0}let n=t.getBoundingClientRect(),i=r.resolveScrollContentBox({rectLeft:n.left,rectTop:n.top,clientLeft:t.clientLeft,clientTop:t.clientTop,clientWidth:t.clientWidth,clientHeight:t.clientHeight}),a=r.computeNextScrollPosition(t.scrollTop,r.resolveAutoScrollAxisDirection(e.pointer.y,i.top,i.bottom-(m.footerHeight??0),24),18,t.scrollHeight-t.clientHeight),o=r.computeNextScrollPosition(t.scrollLeft,r.resolveAutoScrollAxisDirection(e.pointer.x,i.left,i.right,24),18,t.scrollWidth-t.clientWidth);(a!==t.scrollTop||o!==t.scrollLeft)&&(t.scrollTo({top:a,left:o,behavior:`auto`}),O())},A=(e,t)=>{let n=w;if(n!==null){if(w=null,n.cleanup(),n.rafId!==null&&cancelAnimationFrame(n.rafId),y.setSnapshot(null),_.setSnapshot(l),e&&n.target!==null){C=null,N(n.source,n.target,T(n.toggled),n.activeCell);return}C=e&&t!==void 0&&n.onSquare?{time:t,x:n.origin.x,y:n.origin.y}:null}},j=(e,t)=>{if(m===null)return;let{dispatch:r}=m;r(n.gridActions.startSelection({row:e.startRow,col:e.startCol})),r(n.gridActions.updateSelection({row:e.endRow,col:e.endCol})),r(n.gridActions.endSelection()),r(n.gridActions.activateCell(t??{row:e.startRow,col:e.startCol}))},M=(e,t)=>{let n=[];for(let r=t.startRow;r<=t.endRow;r+=1)n.push(e.getRowKey(r));return n},N=(e,t,n,r)=>{if(m===null||!m.enabled)return;let i=m,o=a.buildFillEdits({rowModel:i.rowModel,columns:i.columns,source:e,target:t,request:n,canWriteCell:E(i),getFillValue:i.getFillValue});if(o.edits.length===0)return;let s=a.unionFillRange(e,t),c=null,l=[],u=null;if(i.isServerSide){if(!i.applyServerSideCellEdits)return;u=M(i.rowModel,s),i.applyServerSideCellEdits(o.edits)}else{if(!i.applyRowsChange)return;let e=a.applyFillEditsToRows(i.rows,i.rowModel,o.edits);if(e===i.rows)return;c=i.rows,l.push(e),i.applyRowsChange(e)}S={source:e,target:t,range:s,previousSource:e,selectionConfirmed:!1,columns:i.columns,viewKey:i.viewKey,request:n,edits:o.edits,baseRows:c,baseRowModel:i.isServerSide?null:i.rowModel,emittedRows:l,rowKeys:u},j(s,r),_.setSnapshot({status:`filled`,range:s,kind:o.kind,seriesAvailable:o.seriesAvailable,menu:null})},P=i.createPopoverWindowBindings({onScroll:e=>{e.target instanceof Node&&b.current?.contains(e.target)||I(!1)},onResize:()=>I(!1),isInside:e=>b.current?.contains(e)===!0||x.current?.contains(e)===!0,onOutsidePointerDown:e=>I(m!==null&&i.isInsideGridRoot(m.gridRootRef,e)),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),I(!0))}}),F=e=>{let t=_.getSnapshot();t.status!==`filled`||t.menu===e||_.setSnapshot({...t,menu:e})},I=e=>{P.detach(),F(null),e&&m!==null&&i.restoreGridFocus(m.gridRootRef)},L=()=>{let e=typeof document<`u`&&b.current?.contains(document.activeElement)===!0;S=null,P.detach(),_.getSnapshot().status===`filled`&&_.setSnapshot(l),e&&m!==null&&i.restoreGridFocus(m.gridRootRef)},R=e=>{let t=_.getSnapshot();if(t.status!==`filled`)return;if(t.menu!==null){I(!0);return}let n=Math.min(e.left,window.innerWidth-o-c);n=Math.max(c,n);let r=e.bottom+4;r+s>window.innerHeight-c&&(r=Math.max(c,e.top-4-s)),F({top:r,left:n}),P.attach()},z=(e,t)=>{let n=t.rowKeys;if(n===null)return!1;for(let r=0;r<n.length;r+=1)if(e.getRowKey(t.range.startRow+r)!==n[r])return!1;return!0},B=e=>{let n=_.getSnapshot(),r=S;if(I(!0),m===null||r===null||n.status!==`filled`||r.request===e)return;let i=m;if(i.isServerSide){if(!i.applyServerSideCellEdits||!z(i.rowModel,r)){L();return}let t=a.buildFillEdits({rowModel:i.rowModel,columns:r.columns,source:r.source,target:r.target,request:e,canWriteCell:E(i),getFillValue:i.getFillValue});r.request=e,t.edits.length>0&&!v(t.edits,r.edits)&&i.applyServerSideCellEdits(t.edits),r.edits=t.edits,_.setSnapshot({...n,kind:t.kind,menu:null});return}if(!i.amendRowsChange||r.baseRows===null||r.baseRowModel===null){L();return}let o=r.baseRowModel,s=a.buildFillEdits({rowModel:o,columns:r.columns,source:r.source,target:r.target,request:e,canWriteCell:(e,n,r,a)=>t.isViewCellEditable({readOnly:i.readOnly,canEditCell:i.canEditCell},o,e,n,r,a),getFillValue:i.getFillValue});if(r.request=e,!v(s.edits,r.edits)){let e=a.applyFillEditsToRows(r.baseRows,o,s.edits);r.emittedRows.push(e),r.edits=s.edits,i.amendRowsChange(e)}_.setSnapshot({...n,kind:s.kind,menu:null})},V=(e,t)=>{if(e?.type!==`cell`)return!1;let{start:n,end:r}=e.range;return a.isSameFillRange(t,{startRow:Math.min(n.row,r.row),endRow:Math.max(n.row,r.row),startCol:Math.min(n.col,r.col),endCol:Math.max(n.col,r.col)})},H=e=>{let t=S;if(t!==null){if(!e.enabled||e.editing||!d(e.columns,t.columns)||!g(e.viewKey,t.viewKey)){L();return}if(!e.isServerSide&&e.rows!==t.baseRows&&!t.emittedRows.includes(e.rows)){L();return}if(V(e.selection,t.range)){t.selectionConfirmed=!0;return}!t.selectionConfirmed&&V(e.selection,t.previousSource)||L()}},U=e=>{if(m===null||e.button!==0||(e.preventDefault(),w!==null||!m.enabled||m.editing))return;let t=a.resolveFillSource(m.selection,m.activeCell,m.rowModel.getRowCount(),m.columns.length);if(t===null)return;let n=C;C=null;let r=h(e);if(n!==null&&r&&e.timeStamp-n.time<=f&&Math.abs(e.clientX-n.x)<=p&&Math.abs(e.clientY-n.y)<=p){m.gridRootRef.current?.focus({preventScroll:!0}),W();return}L(),m.gridRootRef.current?.focus({preventScroll:!0});let i=e.pointerId,o=e=>{w===null||e.pointerId!==i||(w.pointer={x:e.clientX,y:e.clientY},w.toggled=e.ctrlKey||e.metaKey,y.setSnapshot(w.pointer),O())},s=e=>{w===null||e.pointerId!==i||(w.toggled=e.ctrlKey||e.metaKey,A(!0,e.timeStamp))},c=e=>{e.pointerId===i&&A(!1)},l=e=>{if(w===null)return;if(e.preventDefault(),e.stopPropagation(),e.type===`keydown`&&e.key===`Escape`){A(!1);return}let t=e.ctrlKey||e.metaKey;t!==w.toggled&&(w.toggled=t,D())},u=()=>A(!1);window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s),window.addEventListener(`pointercancel`,c),window.addEventListener(`keydown`,l,!0),window.addEventListener(`keyup`,l,!0),window.addEventListener(`blur`,u);let d={x:e.clientX,y:e.clientY};w={pointerId:i,source:t,activeCell:m.activeCell,origin:d,onSquare:r,pointer:d,toggled:e.ctrlKey||e.metaKey,target:null,armed:!1,rafId:null,cleanup:()=>{window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),window.removeEventListener(`keydown`,l,!0),window.removeEventListener(`keyup`,l,!0),window.removeEventListener(`blur`,u)}},y.setSnapshot(d),D(),w.rafId=requestAnimationFrame(k)},W=()=>{if(m===null||w!==null||!m.enabled||m.editing)return;let e=a.resolveFillSource(m.selection,m.activeCell,m.rowModel.getRowCount(),m.columns.length);if(e===null)return;let t=a.resolveFillDoubleClickTarget(e,m.rowModel,m.columns);t!==null&&(L(),N(e,t,`auto`,m.activeCell))};return{update:e=>{m=e,w!==null&&(!e.enabled||e.editing)&&A(!1),H(e)},subscribe:_.subscribe,getSnapshot:_.getSnapshot,subscribePointer:y.subscribe,getPointerSnapshot:y.getSnapshot,handlePointerDown:U,handleDoubleClick:W,toggleMenu:R,closeMenu:()=>I(!0),chooseKind:B,menuPanel:b,chipElement:x,dispose:()=>{A(!1),P.detach(),S=null}}};exports.createFillHandleController=y;
|