@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.
- package/dist/controllers/clipboardController.cjs +2 -2
- package/dist/controllers/clipboardController.d.ts +2 -1
- package/dist/controllers/clipboardController.js +78 -62
- package/dist/controllers/columnAutosizeRunner.cjs +1 -1
- package/dist/controllers/columnAutosizeRunner.d.ts +2 -0
- package/dist/controllers/columnAutosizeRunner.js +49 -23
- package/dist/controllers/columnHeaderDragController.cjs +1 -1
- package/dist/controllers/columnHeaderDragController.d.ts +4 -0
- package/dist/controllers/columnHeaderDragController.js +140 -124
- package/dist/controllers/dateRolloverStore.cjs +1 -1
- package/dist/controllers/dateRolloverStore.js +1 -1
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.js +71 -55
- package/dist/controllers/escapeClaimController.cjs +1 -0
- package/dist/controllers/escapeClaimController.d.ts +18 -0
- package/dist/controllers/escapeClaimController.js +30 -0
- package/dist/controllers/fillHandleController.cjs +1 -1
- package/dist/controllers/fillHandleController.js +129 -127
- package/dist/controllers/findController.cjs +1 -1
- package/dist/controllers/findController.d.ts +1 -0
- package/dist/controllers/findController.js +96 -75
- package/dist/controllers/globalFilteredOrder.cjs +1 -1
- package/dist/controllers/globalFilteredOrder.js +52 -21
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.js +98 -97
- package/dist/controllers/pointerInteractionsController.cjs +1 -1
- package/dist/controllers/pointerInteractionsController.js +159 -144
- package/dist/controllers/popoverSupport.cjs +1 -1
- package/dist/controllers/popoverSupport.js +4 -1
- package/dist/controllers/rowDragController.cjs +1 -1
- package/dist/controllers/rowDragController.d.ts +1 -0
- package/dist/controllers/rowDragController.js +122 -120
- package/dist/controllers/scrollSyncController.cjs +1 -1
- package/dist/controllers/scrollSyncController.d.ts +1 -1
- package/dist/controllers/scrollSyncController.js +7 -4
- package/dist/controllers/selectOptionsCollector.cjs +1 -1
- package/dist/controllers/selectOptionsCollector.d.ts +5 -2
- package/dist/controllers/selectOptionsCollector.js +39 -27
- package/dist/controllers/toolPanelController.cjs +1 -1
- package/dist/controllers/toolPanelController.d.ts +6 -0
- package/dist/controllers/toolPanelController.js +69 -59
- package/dist/controllers/tooltipController.cjs +1 -1
- package/dist/controllers/tooltipController.d.ts +2 -0
- package/dist/controllers/tooltipController.js +68 -38
- package/dist/controllers/viewportSyncController.cjs +1 -1
- package/dist/controllers/viewportSyncController.d.ts +4 -0
- package/dist/controllers/viewportSyncController.js +18 -8
- package/dist/engine/columnCommands.cjs +1 -1
- package/dist/engine/columnCommands.js +2 -1
- package/dist/engine/columnLayout.cjs +1 -1
- package/dist/engine/columnLayout.d.ts +2 -0
- package/dist/engine/columnLayout.js +51 -18
- package/dist/engine/exportCommands.cjs +2 -2
- package/dist/engine/exportCommands.js +37 -38
- package/dist/engine/gridApi.cjs +2 -2
- package/dist/engine/gridApi.d.ts +1 -1
- package/dist/engine/gridApi.js +8 -8
- package/dist/engine/rowPipeline.cjs +1 -1
- package/dist/engine/rowPipeline.js +46 -46
- package/dist/engine/rowSelectionCommands.cjs +1 -1
- package/dist/engine/rowSelectionCommands.d.ts +8 -1
- package/dist/engine/rowSelectionCommands.js +36 -25
- package/dist/locales/en.cjs +1 -1
- package/dist/locales/en.js +1 -1
- package/dist/logic/autoScrollGeometry.cjs +1 -1
- package/dist/logic/autoScrollGeometry.d.ts +5 -1
- package/dist/logic/autoScrollGeometry.js +6 -6
- package/dist/logic/clearCells.cjs +1 -1
- package/dist/logic/clearCells.js +13 -13
- package/dist/logic/columnReset.cjs +1 -1
- package/dist/logic/columnReset.d.ts +1 -0
- package/dist/logic/columnReset.js +21 -19
- package/dist/logic/editorValues.cjs +1 -1
- package/dist/logic/editorValues.js +41 -15
- package/dist/logic/elementScale.cjs +1 -0
- package/dist/logic/elementScale.d.ts +8 -0
- package/dist/logic/elementScale.js +14 -0
- package/dist/logic/filtering.cjs +1 -1
- package/dist/logic/filtering.js +14 -11
- package/dist/logic/focusCycle.cjs +1 -0
- package/dist/logic/focusCycle.d.ts +1 -0
- package/dist/logic/focusCycle.js +15 -0
- package/dist/logic/labelRows.cjs +1 -1
- package/dist/logic/labelRows.d.ts +2 -0
- package/dist/logic/labelRows.js +8 -4
- package/dist/logic/localeText.cjs +1 -1
- package/dist/logic/localeText.js +1 -1
- package/dist/logic/rowSelection.cjs +1 -1
- package/dist/logic/rowSelection.d.ts +4 -0
- package/dist/logic/rowSelection.js +31 -8
- package/dist/logic/selectOptions.cjs +1 -1
- package/dist/logic/selectOptions.d.ts +2 -2
- package/dist/logic/selectOptions.js +16 -12
- package/dist/logic/selectionOverlayGeometry.cjs +1 -1
- package/dist/logic/selectionOverlayGeometry.js +12 -12
- package/dist/logic/sorting.cjs +1 -1
- package/dist/logic/sorting.d.ts +1 -0
- package/dist/logic/sorting.js +24 -12
- package/dist/model/gridTypes.core.d.ts +48 -28
- package/dist/utils/deprecation.cjs +1 -1
- package/dist/utils/deprecation.d.ts +1 -30
- package/dist/utils/deprecation.js +1 -30
- package/package.json +1 -1
- package/dist/logic/exportScope.cjs +0 -1
- package/dist/logic/exportScope.d.ts +0 -3
- 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 {
|
|
5
|
-
import {
|
|
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
|
|
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
|
|
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
|
-
|
|
37
|
+
if (!(r < 0)) return r;
|
|
37
38
|
}
|
|
38
39
|
return o.length;
|
|
39
40
|
}
|
|
40
|
-
|
|
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
|
-
},
|
|
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
|
-
],
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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,
|
|
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,
|
|
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
|
-
}),
|
|
77
|
-
for (let e of Object.values(
|
|
78
|
-
},
|
|
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(";"),
|
|
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),
|
|
108
|
-
},
|
|
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 +
|
|
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 =
|
|
117
|
-
},
|
|
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
|
-
},
|
|
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,
|
|
122
|
-
if (
|
|
123
|
-
let t =
|
|
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,
|
|
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 :
|
|
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),
|
|
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 -
|
|
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),
|
|
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
|
|
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:
|
|
165
|
-
leftPx: d + i(a.center,
|
|
179
|
+
slot: c,
|
|
180
|
+
leftPx: d + i(a.center, c)
|
|
166
181
|
};
|
|
167
182
|
}
|
|
168
183
|
return null;
|
|
169
|
-
},
|
|
170
|
-
let t =
|
|
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
|
-
},
|
|
180
|
-
let n =
|
|
181
|
-
n !== void 0 &&
|
|
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
|
-
},
|
|
186
|
-
let r = [], 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 -
|
|
195
|
-
|
|
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" :
|
|
215
|
+
let o = h !== null && !h.has(e) ? "none" : x;
|
|
201
216
|
if (t === a) {
|
|
202
|
-
r.push(e), i.has(e) || (
|
|
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(
|
|
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) ||
|
|
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
|
-
},
|
|
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(
|
|
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
|
-
},
|
|
233
|
+
}, ke = (e) => {
|
|
219
234
|
let t = (e) => {
|
|
220
|
-
for (let t of
|
|
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
|
-
},
|
|
224
|
-
let r =
|
|
238
|
+
}, Ae = (e, t, n) => {
|
|
239
|
+
let r = V;
|
|
225
240
|
if (r === null) {
|
|
226
241
|
let e = document.createElement("div");
|
|
227
|
-
e.className =
|
|
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 =
|
|
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
|
-
},
|
|
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:${
|
|
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
|
-
|
|
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(
|
|
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 =
|
|
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
|
-
},
|
|
277
|
-
let r = e.guide, i = t === null ? null :
|
|
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" &&
|
|
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
|
-
},
|
|
289
|
-
let n = e.layer.getBoundingClientRect(), r = Math.max(e.layerWidth - e.columnWidth, 0), i = Math.min(Math.max(E.x -
|
|
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" ?
|
|
293
|
-
},
|
|
294
|
-
|
|
295
|
-
},
|
|
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 =
|
|
300
|
-
if (
|
|
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
|
-
},
|
|
306
|
-
let e =
|
|
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
|
-
|
|
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 =
|
|
321
|
-
if (
|
|
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 &&
|
|
329
|
-
let e =
|
|
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
|
-
|
|
346
|
+
K(), Pe(e, n.pane);
|
|
332
347
|
return;
|
|
333
348
|
}
|
|
334
349
|
}
|
|
335
|
-
|
|
350
|
+
Y(), we(B), Te(n.pane), q(null, "rest");
|
|
336
351
|
return;
|
|
337
352
|
}
|
|
338
|
-
if (
|
|
339
|
-
|
|
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
|
-
|
|
357
|
+
Y();
|
|
343
358
|
return;
|
|
344
359
|
}
|
|
345
|
-
if (
|
|
346
|
-
w = null,
|
|
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
|
-
},
|
|
353
|
-
},
|
|
354
|
-
if (
|
|
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(
|
|
389
|
+
Z(), j = requestAnimationFrame(Le);
|
|
374
390
|
}, Q = (e) => {
|
|
375
|
-
j !== null && (cancelAnimationFrame(j), j = null), document.body.style.cursor = "",
|
|
376
|
-
let n =
|
|
377
|
-
|
|
378
|
-
let a =
|
|
379
|
-
|
|
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 ?
|
|
381
|
-
if (
|
|
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 =
|
|
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() : (
|
|
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
|
-
},
|
|
414
|
+
}, H = e);
|
|
399
415
|
}
|
|
400
|
-
|
|
401
|
-
|
|
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:
|
|
406
|
-
T = g !== null && g === i.pane && !
|
|
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,
|
|
426
|
+
timer: window.setTimeout(X, ye),
|
|
411
427
|
hiddenCells: []
|
|
412
428
|
});
|
|
413
|
-
let
|
|
414
|
-
|
|
415
|
-
T ===
|
|
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
|
-
},
|
|
418
|
-
|
|
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 ${
|
|
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(),
|
|
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(),
|
|
480
|
+
if ($(), X(), Y(), z?.forEach((e, t) => {
|
|
465
481
|
t.style.visibility = e.visibility;
|
|
466
|
-
}),
|
|
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",
|
|
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),
|
|
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
|
-
|
|
477
|
-
} else
|
|
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(
|
|
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:
|
|
523
|
+
applyReorderSettle: Re,
|
|
508
524
|
dispose: () => {
|
|
509
|
-
k?.(), k = null, j !== null && (cancelAnimationFrame(j), j = null),
|
|
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 {
|
|
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(
|
|
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(
|
|
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,
|
|
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;
|