@ishibashi0112/spreadsheet-grid-core 1.14.0 → 1.16.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/README.md +2 -2
- package/dist/controllers/clipboardController.cjs +4 -4
- package/dist/controllers/clipboardController.d.ts +5 -0
- package/dist/controllers/clipboardController.js +211 -139
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.d.ts +3 -0
- package/dist/controllers/editController.js +104 -85
- package/dist/controllers/findController.cjs +1 -1
- package/dist/controllers/findController.d.ts +1 -0
- package/dist/controllers/findController.js +5 -4
- package/dist/controllers/findReplaceController.cjs +1 -1
- package/dist/controllers/findReplaceController.d.ts +1 -0
- package/dist/controllers/findReplaceController.js +1 -1
- package/dist/controllers/historyController.cjs +1 -1
- package/dist/controllers/historyController.d.ts +1 -0
- package/dist/controllers/historyController.js +8 -2
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.d.ts +8 -0
- package/dist/controllers/keyboardController.js +115 -57
- package/dist/controllers/rowDragController.cjs +1 -1
- package/dist/controllers/rowDragController.d.ts +1 -0
- package/dist/controllers/rowDragController.js +61 -53
- package/dist/controllers/viewportSyncController.cjs +1 -1
- package/dist/controllers/viewportSyncController.d.ts +2 -1
- package/dist/controllers/viewportSyncController.js +4 -4
- package/dist/engine/cellCommands.cjs +1 -1
- package/dist/engine/cellCommands.d.ts +1 -0
- package/dist/engine/cellCommands.js +19 -9
- package/dist/engine/cellSpanController.cjs +2 -0
- package/dist/engine/cellSpanController.d.ts +42 -0
- package/dist/engine/cellSpanController.js +253 -0
- package/dist/engine/createGridEngine.cjs +3 -3
- package/dist/engine/createGridEngine.d.ts +4 -0
- package/dist/engine/createGridEngine.js +35 -28
- package/dist/engine/exportCommands.cjs +2 -2
- package/dist/engine/exportCommands.js +104 -71
- package/dist/engine/features.cjs +1 -1
- package/dist/engine/features.d.ts +12 -0
- package/dist/engine/features.js +35 -1
- package/dist/engine/fullFeatures.cjs +1 -1
- package/dist/engine/fullFeatures.js +31 -27
- package/dist/engine/gridApi.cjs +10 -10
- package/dist/engine/gridApi.d.ts +10 -0
- package/dist/engine/gridApi.js +504 -333
- package/dist/engine/newRowController.cjs +1 -1
- package/dist/engine/newRowController.js +3 -1
- package/dist/engine/notifiers.cjs +1 -1
- package/dist/engine/notifiers.d.ts +4 -0
- package/dist/engine/notifiers.js +39 -27
- package/dist/engine/paginationController.cjs +1 -0
- package/dist/engine/paginationController.d.ts +38 -0
- package/dist/engine/paginationController.js +162 -0
- package/dist/engine/rowSelectionCommands.cjs +1 -1
- package/dist/engine/rowSelectionCommands.d.ts +1 -0
- package/dist/engine/rowSelectionCommands.js +10 -10
- package/dist/engine/verticalLayout.cjs +1 -1
- package/dist/engine/verticalLayout.d.ts +1 -0
- package/dist/engine/verticalLayout.js +1 -0
- package/dist/locales/en.cjs +1 -1
- package/dist/locales/en.js +9 -0
- package/dist/logic/cellRef.cjs +1 -1
- package/dist/logic/cellRef.js +1 -1
- package/dist/logic/cellSpanLayout.cjs +1 -0
- package/dist/logic/cellSpanLayout.d.ts +48 -0
- package/dist/logic/cellSpanLayout.js +147 -0
- package/dist/logic/cellSpans.cjs +1 -0
- package/dist/logic/cellSpans.d.ts +49 -0
- package/dist/logic/cellSpans.js +301 -0
- package/dist/logic/changeTracking.cjs +1 -1
- package/dist/logic/changeTracking.d.ts +6 -0
- package/dist/logic/changeTracking.js +23 -9
- package/dist/logic/clipboardHtml.cjs +1 -1
- package/dist/logic/clipboardHtml.d.ts +5 -0
- package/dist/logic/clipboardHtml.js +27 -25
- package/dist/logic/contextMenuTarget.cjs +1 -1
- package/dist/logic/contextMenuTarget.js +72 -48
- package/dist/logic/exportData.cjs +1 -1
- package/dist/logic/exportData.d.ts +2 -1
- package/dist/logic/exportData.js +35 -35
- package/dist/logic/featureWarnings.cjs +1 -1
- package/dist/logic/featureWarnings.js +2 -1
- package/dist/logic/fillHandle.cjs +1 -1
- package/dist/logic/fillHandle.js +21 -21
- package/dist/logic/gridState.cjs +1 -1
- package/dist/logic/gridState.d.ts +6 -1
- package/dist/logic/gridState.js +6 -6
- package/dist/logic/localeText.cjs +1 -1
- package/dist/logic/localeText.d.ts +1 -0
- package/dist/logic/localeText.js +1 -0
- package/dist/logic/localeTextFeatures.cjs +1 -1
- package/dist/logic/localeTextFeatures.d.ts +10 -0
- package/dist/logic/localeTextFeatures.js +10 -1
- package/dist/logic/pagination.cjs +1 -0
- package/dist/logic/pagination.d.ts +55 -0
- package/dist/logic/pagination.js +192 -0
- package/dist/logic/rowDragTarget.cjs +1 -1
- package/dist/logic/rowDragTarget.d.ts +1 -1
- package/dist/logic/rowDragTarget.js +10 -10
- package/dist/logic/scrollHint.cjs +1 -1
- package/dist/logic/scrollHint.d.ts +2 -1
- package/dist/logic/scrollHint.js +5 -5
- package/dist/model/gridActions.cjs +1 -1
- package/dist/model/gridActions.d.ts +10 -0
- package/dist/model/gridActions.js +10 -1
- package/dist/model/gridReducer.cjs +1 -1
- package/dist/model/gridReducer.js +32 -0
- package/dist/model/gridStore.cjs +1 -1
- package/dist/model/gridStore.d.ts +1 -0
- package/dist/model/gridStore.js +1 -1
- package/dist/model/gridTypes.core.d.ts +189 -11
- package/dist/utils/pagerFocus.cjs +1 -0
- package/dist/utils/pagerFocus.d.ts +1 -0
- package/dist/utils/pagerFocus.js +15 -0
- package/dist/utils/permissions.cjs +1 -1
- package/dist/utils/permissions.d.ts +1 -1
- package/dist/utils/permissions.js +1 -1
- package/package.json +1 -1
|
@@ -51,14 +51,14 @@ var h = 14, g = 12, _ = "0.5", v = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
51
51
|
}, F = {
|
|
52
52
|
x: 0,
|
|
53
53
|
y: 0
|
|
54
|
-
}, I = null, L = !1, R = null, z = null, B = null, V = null, H = null, U = null, ie = 0,
|
|
54
|
+
}, I = null, L = !1, R = null, z = null, B = null, V = null, H = null, U = 0, W = null, ie = 0, G = null, K = () => A?.motion === "live", q = null, J = null, Y = null, ae = () => [
|
|
55
55
|
A?.leftIndicatorRef.current ?? null,
|
|
56
56
|
A?.centerIndicatorRef.current ?? null,
|
|
57
57
|
A?.rightIndicatorRef.current ?? null
|
|
58
|
-
],
|
|
58
|
+
], X = () => {
|
|
59
59
|
for (let e of ae()) e && (e.style.display = "none");
|
|
60
60
|
}, oe = (e) => {
|
|
61
|
-
if (
|
|
61
|
+
if (q) return;
|
|
62
62
|
let t = document.createElement("div");
|
|
63
63
|
t.setAttribute("data-grid-drag-ghost", ""), A?.scrollContainerRef.current?.closest(".ssg-theme-dark") != null && t.classList.add("ssg-theme-dark"), A?.scrollContainerRef.current?.closest(".ssg-theme-class") != null && t.classList.add("ssg-theme-class"), A?.scrollContainerRef.current?.closest(".ssg-motion-off") != null && t.classList.add("ssg-motion-off"), t.style.cssText = [
|
|
64
64
|
"position:fixed",
|
|
@@ -89,27 +89,27 @@ var h = 14, g = 12, _ = "0.5", v = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
89
89
|
let n = document.createElement("span");
|
|
90
90
|
n.style.cssText = "display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none";
|
|
91
91
|
let r = document.createElement("span");
|
|
92
|
-
r.style.cssText = "overflow:hidden;text-overflow:ellipsis", r.textContent = e, t.appendChild(n), t.appendChild(r), ee(t, te(A?.scrollContainerRef.current)), m(A?.scrollContainerRef.current, t),
|
|
92
|
+
r.style.cssText = "overflow:hidden;text-overflow:ellipsis", r.textContent = e, t.appendChild(n), t.appendChild(r), ee(t, te(A?.scrollContainerRef.current)), m(A?.scrollContainerRef.current, t), q = t, J = n, Y = null;
|
|
93
93
|
}, se = (e) => {
|
|
94
|
-
let t =
|
|
94
|
+
let t = q;
|
|
95
95
|
if (!t) return;
|
|
96
96
|
t.style.transform = "translate(" + (F.x + h) + "px," + (F.y + g) + "px)";
|
|
97
97
|
let n = e ? "move" : "out";
|
|
98
|
-
if (
|
|
99
|
-
|
|
100
|
-
let r =
|
|
98
|
+
if (Y === n) return;
|
|
99
|
+
Y = n;
|
|
100
|
+
let r = J;
|
|
101
101
|
n === "out" ? (t.style.opacity = _, r && (r.innerHTML = y)) : (t.style.opacity = "1", r && (r.innerHTML = v));
|
|
102
102
|
}, ce = () => {
|
|
103
|
-
|
|
104
|
-
},
|
|
103
|
+
q && q.parentNode && q.parentNode.removeChild(q), q = null, J = null, Y = null;
|
|
104
|
+
}, Z = (e, t) => {
|
|
105
105
|
let n = A?.scrollContainerRef.current ?? null;
|
|
106
106
|
!n || t && e === null || n.querySelectorAll(t ? `.ssg-body-row[data-row-index="${e}"]` : `.ssg-body-row[${C}]`).forEach((e) => {
|
|
107
|
-
r(n, e) || (t ? e.setAttribute(C,
|
|
107
|
+
r(n, e) || (t ? e.setAttribute(C, K() ? "live" : "") : e.removeAttribute(C));
|
|
108
108
|
});
|
|
109
109
|
}, le = () => {
|
|
110
110
|
let e = A?.scrollContainerRef.current ?? null;
|
|
111
111
|
if (!e || j === null) return;
|
|
112
|
-
let t = String(j), n =
|
|
112
|
+
let t = String(j), n = K() ? "live" : "";
|
|
113
113
|
e.querySelectorAll(`.ssg-body-row[${C}]`).forEach((n) => {
|
|
114
114
|
n.getAttribute("data-row-index") !== t && !r(e, n) && n.removeAttribute(C);
|
|
115
115
|
}), e.querySelectorAll(`.ssg-body-row[data-row-index="${t}"]`).forEach((t) => {
|
|
@@ -125,7 +125,7 @@ var h = 14, g = 12, _ = "0.5", v = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
125
125
|
}
|
|
126
126
|
return t;
|
|
127
127
|
}, de = (t) => {
|
|
128
|
-
let n =
|
|
128
|
+
let n = W, r = j;
|
|
129
129
|
if (!n || r === null || A === null) return;
|
|
130
130
|
let i = A.scrollContainerRef.current;
|
|
131
131
|
if (!i) return;
|
|
@@ -148,8 +148,8 @@ var h = 14, g = 12, _ = "0.5", v = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
148
148
|
let l = 0;
|
|
149
149
|
c !== null && (r < i && i <= c ? l = -a : c <= i && i < r && (l = a)), t.style.transition = S, t.style.transform = `translateY(${o + l}px)`, e.applied = t.style.transform;
|
|
150
150
|
});
|
|
151
|
-
let l =
|
|
152
|
-
|
|
151
|
+
let l = G ?? /* @__PURE__ */ new Set();
|
|
152
|
+
G = l;
|
|
153
153
|
for (let { el: e, index: t } of D(i)) {
|
|
154
154
|
if (l.add(e), t === r) {
|
|
155
155
|
e.style.transition = "none", e.style.transform = `translateY(${s}px)`, e.style.willChange = "transform", e.style.zIndex = "10";
|
|
@@ -164,7 +164,7 @@ var h = 14, g = 12, _ = "0.5", v = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
164
164
|
if (!f || !p) return null;
|
|
165
165
|
let m = f.getBoundingClientRect();
|
|
166
166
|
if (e < m.left || e > m.right || r < m.top || r > m.bottom) return null;
|
|
167
|
-
let ee = a(i(r, m.top + f.clientTop + f.clientHeight, A.footerHeight ?? 0), m.top + f.clientTop, A.stickyTopHeight ?? 0), te = p.getBoundingClientRect(), h = p.scrollTop + ee - te.top - l - f.scrollTop * (1 - u), g = t(h, c), _ = j, v = _ !== null &&
|
|
167
|
+
let ee = a(i(r, m.top + f.clientTop + f.clientHeight, A.footerHeight ?? 0), m.top + f.clientTop, A.stickyTopHeight ?? 0), te = p.getBoundingClientRect(), h = p.scrollTop + ee - te.top - l - f.scrollTop * (1 - u), g = t(h, c), _ = j, v = _ !== null && K() ? c.detailHeight(_) : 0;
|
|
168
168
|
if (_ !== null && v > 0) {
|
|
169
169
|
let e = t(h + v, c);
|
|
170
170
|
e > _ + 1 && (g = e);
|
|
@@ -175,20 +175,20 @@ var h = 14, g = 12, _ = "0.5", v = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
175
175
|
slot: g,
|
|
176
176
|
top: l + y - d
|
|
177
177
|
};
|
|
178
|
-
},
|
|
178
|
+
}, Q = () => {
|
|
179
179
|
let t = fe(F.x, F.y), n = j;
|
|
180
|
-
if (
|
|
181
|
-
t && n !== null && (e(n, t.slot) === null ? M = null : P(n, t.slot) && (M = t.slot)),
|
|
180
|
+
if (K()) {
|
|
181
|
+
t && n !== null && (e(n, t.slot) === null ? M = null : P(n, t.slot) && (M = t.slot)), X(), de(M);
|
|
182
182
|
return;
|
|
183
183
|
}
|
|
184
184
|
let r = t !== null && n !== null && e(n, t.slot) !== null && !P(n, t.slot);
|
|
185
185
|
if (se(r ? null : t), !t || n === null || r || e(n, t.slot) === null) {
|
|
186
|
-
M = null,
|
|
186
|
+
M = null, X();
|
|
187
187
|
return;
|
|
188
188
|
}
|
|
189
189
|
M = t.slot;
|
|
190
190
|
for (let e of ae()) e && (e.style.top = `${t.top}px`, e.style.display = "block");
|
|
191
|
-
},
|
|
191
|
+
}, pe = () => {
|
|
192
192
|
if (j === null) {
|
|
193
193
|
B = null;
|
|
194
194
|
return;
|
|
@@ -209,30 +209,30 @@ var h = 14, g = 12, _ = "0.5", v = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
209
209
|
behavior: "auto"
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
|
-
le(),
|
|
213
|
-
},
|
|
212
|
+
le(), Q(), B = requestAnimationFrame(pe);
|
|
213
|
+
}, me = (e, t) => `${e.getAttribute("data-pane") ?? ""}|${t}`, he = () => {
|
|
214
214
|
let e = A?.scrollContainerRef.current ?? null;
|
|
215
215
|
if (!e) return null;
|
|
216
216
|
let t = /* @__PURE__ */ new Map();
|
|
217
|
-
for (let n of E(e)) t.set(
|
|
217
|
+
for (let n of E(e)) t.set(me(n, Number(n.getAttribute("data-row-index"))), n.getBoundingClientRect().top);
|
|
218
218
|
for (let n of D(e)) t.set(n.key, n.el.getBoundingClientRect().top);
|
|
219
219
|
return t;
|
|
220
220
|
}, $ = (t) => {
|
|
221
|
-
B !== null && (cancelAnimationFrame(B), B = null), document.body.style.cursor = "",
|
|
221
|
+
B !== null && (cancelAnimationFrame(B), B = null), document.body.style.cursor = "", X(), ce();
|
|
222
222
|
let n = j, r = M, i = H;
|
|
223
|
-
|
|
223
|
+
Z(n, !1), j = null, H = null, M = null, I = null, z = null;
|
|
224
224
|
let a = n === null || r === null ? null : e(n, r), o = a !== null && n !== null && r !== null && t && !P(n, r) ? null : a;
|
|
225
225
|
N = null;
|
|
226
|
-
let s = t && n !== null && o !== null && A !== null, c =
|
|
227
|
-
|
|
226
|
+
let s = t && n !== null && o !== null && A !== null, c = W;
|
|
227
|
+
W = null, c?.forEach((e, t) => {
|
|
228
228
|
t.isConnected && !ne(t, e) && c.delete(t);
|
|
229
229
|
});
|
|
230
|
-
let l = c && s && A !== null && !w(A.scrollContainerRef.current) ?
|
|
231
|
-
if (
|
|
230
|
+
let l = c && s && A !== null && !w(A.scrollContainerRef.current) ? he() : null, u = G;
|
|
231
|
+
if (G = null, u && (s ? u.forEach(O) : (u.forEach((e) => {
|
|
232
232
|
e.isConnected && (e.style.transition = S, e.style.transform = "translateY(0px)", e.style.zIndex = "");
|
|
233
233
|
}), window.setTimeout(() => {
|
|
234
234
|
u.forEach((e) => {
|
|
235
|
-
|
|
235
|
+
G?.has(e) || O(e);
|
|
236
236
|
});
|
|
237
237
|
}, 200))), c) if (s) c.forEach(({ baseY: e }, t) => {
|
|
238
238
|
t.style.transition = "", t.style.willChange = "", t.isConnected && (t.style.transform = `translateY(${e}px)`);
|
|
@@ -245,17 +245,24 @@ var h = 14, g = 12, _ = "0.5", v = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
245
245
|
for (let t of e) t.style.transition = "", t.style.willChange = "";
|
|
246
246
|
}, 200);
|
|
247
247
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
let d = U, f = () => {
|
|
249
|
+
d === U && j === null && A?.onDraggingChange?.(!1);
|
|
250
|
+
};
|
|
251
|
+
if (!s || n === null || o === null || A === null) {
|
|
252
|
+
f();
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
window.setTimeout(f, w(A.scrollContainerRef.current) ? 0 : 200);
|
|
256
|
+
let p = l ?? (w(A.scrollContainerRef.current) ? null : he()), m = p ? {
|
|
257
|
+
tops: p,
|
|
251
258
|
from: n,
|
|
252
259
|
to: o,
|
|
253
260
|
row: i
|
|
254
261
|
} : null;
|
|
255
|
-
V =
|
|
256
|
-
V ===
|
|
262
|
+
V = m, A.commitRowMove(n, o), m && requestAnimationFrame(() => {
|
|
263
|
+
V === m && (V = null);
|
|
257
264
|
});
|
|
258
|
-
},
|
|
265
|
+
}, ge = () => {
|
|
259
266
|
let e = V;
|
|
260
267
|
if (V = null, !e) return;
|
|
261
268
|
let t = A?.scrollContainerRef.current ?? null;
|
|
@@ -264,7 +271,7 @@ var h = 14, g = 12, _ = "0.5", v = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
264
271
|
if (A?.locateDragRow && e.row !== null && A.locateDragRow(e.row, i) !== i) return;
|
|
265
272
|
let a = (e) => e === i ? r : r < i && e >= r && e < i ? e + 1 : i < r && e > i && e <= r ? e - 1 : e, o = [], s = /* @__PURE__ */ new Map();
|
|
266
273
|
E(t).forEach((e) => {
|
|
267
|
-
let t = n.get(
|
|
274
|
+
let t = n.get(me(e, a(Number(e.getAttribute("data-row-index")))));
|
|
268
275
|
if (t === void 0) return;
|
|
269
276
|
let r = t - e.getBoundingClientRect().top;
|
|
270
277
|
if (Math.abs(r) < .5) return;
|
|
@@ -285,22 +292,23 @@ var h = 14, g = 12, _ = "0.5", v = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
285
292
|
for (let e of c) e.style.transition = `transform ${b}ms ${x}`, e.style.transform = "translateY(0px)";
|
|
286
293
|
window.setTimeout(() => {
|
|
287
294
|
for (let e of o) e.style.transition = "", e.style.willChange = "";
|
|
288
|
-
for (let e of c)
|
|
295
|
+
for (let e of c) G?.has(e) || O(e);
|
|
289
296
|
}, 280);
|
|
290
297
|
}
|
|
291
|
-
},
|
|
298
|
+
}, _e = (e, t) => {
|
|
292
299
|
if (A === null || !A.enabled || t.button !== 0) return;
|
|
293
300
|
if (t.stopPropagation(), t.preventDefault(), A.gridRootRef?.current?.focus({ preventScroll: !0 }), A.endEditLeftOpen?.(), j !== null) {
|
|
294
301
|
if (t.pointerId !== z) return;
|
|
295
302
|
R?.(), $(!1);
|
|
296
303
|
}
|
|
304
|
+
if (U += 1, A.onDraggingChange?.(!0), A === null) return;
|
|
297
305
|
j = e, H = A.getDragRow?.(e) ?? null, z = t.pointerId, M = null, F = {
|
|
298
306
|
x: t.clientX,
|
|
299
307
|
y: t.clientY
|
|
300
308
|
}, I = {
|
|
301
309
|
x: t.clientX,
|
|
302
310
|
y: t.clientY
|
|
303
|
-
}, L = !1, document.body.style.cursor = "grabbing",
|
|
311
|
+
}, L = !1, document.body.style.cursor = "grabbing", K() ? (W = ue(), ie = A.scrollContainerRef.current?.scrollTop ?? 0) : oe(A.getRowDragLabel(e)), Z(e, !0);
|
|
304
312
|
let n = t.currentTarget, r = t.pointerId;
|
|
305
313
|
try {
|
|
306
314
|
n.setPointerCapture(r);
|
|
@@ -309,7 +317,7 @@ var h = 14, g = 12, _ = "0.5", v = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
309
317
|
e.pointerId === r && (F = {
|
|
310
318
|
x: e.clientX,
|
|
311
319
|
y: e.clientY
|
|
312
|
-
},
|
|
320
|
+
}, Q());
|
|
313
321
|
}, a = f(), o = () => {
|
|
314
322
|
window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", s), window.removeEventListener("pointercancel", c), window.removeEventListener("keydown", l, !0), window.removeEventListener("blur", u), a(), R = null;
|
|
315
323
|
try {
|
|
@@ -328,20 +336,20 @@ var h = 14, g = 12, _ = "0.5", v = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
328
336
|
function u() {
|
|
329
337
|
o(), $(!1);
|
|
330
338
|
}
|
|
331
|
-
window.addEventListener("pointermove", i), window.addEventListener("pointerup", s), window.addEventListener("pointercancel", c), window.addEventListener("keydown", l, !0), window.addEventListener("blur", u), R = o,
|
|
332
|
-
},
|
|
339
|
+
window.addEventListener("pointermove", i), window.addEventListener("pointerup", s), window.addEventListener("pointercancel", c), window.addEventListener("keydown", l, !0), window.addEventListener("blur", u), R = o, Q(), B = requestAnimationFrame(pe);
|
|
340
|
+
}, ve = (e) => {
|
|
333
341
|
if (j === null || H == null || A?.locateDragRow === void 0) return;
|
|
334
342
|
let t = A.locateDragRow(H, j);
|
|
335
|
-
if (
|
|
343
|
+
if (W && W.forEach((e, t) => {
|
|
336
344
|
if (!t.isConnected) {
|
|
337
|
-
|
|
345
|
+
W?.delete(t);
|
|
338
346
|
return;
|
|
339
347
|
}
|
|
340
348
|
let n = Number(t.getAttribute("data-row-index")), r = t.getAttribute(k);
|
|
341
349
|
if (n === e.index && r === e.key && (e.applied === void 0 || t.style.transform === e.applied)) return;
|
|
342
350
|
let i = T.exec(t.style.transform);
|
|
343
351
|
if (!i) {
|
|
344
|
-
|
|
352
|
+
W?.delete(t);
|
|
345
353
|
return;
|
|
346
354
|
}
|
|
347
355
|
e.index = n, e.baseY = parseFloat(i[1]), e.key = r, e.applied = void 0;
|
|
@@ -349,20 +357,20 @@ var h = 14, g = 12, _ = "0.5", v = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
349
357
|
R?.(), $(!1);
|
|
350
358
|
return;
|
|
351
359
|
}
|
|
352
|
-
|
|
360
|
+
W && t !== j && I !== null && e !== null && (I = {
|
|
353
361
|
x: I.x,
|
|
354
362
|
y: I.y + A.rowMetrics.rowTop(t) - e.rowTop(j)
|
|
355
|
-
}), t !== j && (
|
|
363
|
+
}), t !== j && (Z(null, !1), j = t, Z(t, !0)), Q();
|
|
356
364
|
};
|
|
357
365
|
return {
|
|
358
366
|
update: (e) => {
|
|
359
367
|
let t = A;
|
|
360
|
-
A = e, t?.canDropAt !== e.canDropAt && (N = null), j !== null && t !== null && t.locateDragRow !== e.locateDragRow &&
|
|
368
|
+
A = e, t?.canDropAt !== e.canDropAt && (N = null), j !== null && t !== null && t.locateDragRow !== e.locateDragRow && ve(t.rowMetrics);
|
|
361
369
|
},
|
|
362
|
-
onRowDragHandlePointerDown:
|
|
363
|
-
applyReorderSettle:
|
|
370
|
+
onRowDragHandlePointerDown: _e,
|
|
371
|
+
applyReorderSettle: ge,
|
|
364
372
|
dispose: () => {
|
|
365
|
-
R?.(), R = null, B !== null && (cancelAnimationFrame(B), B = null), document.body.style.cursor = "", ce(),
|
|
373
|
+
R?.(), R = null, B !== null && (cancelAnimationFrame(B), B = null), document.body.style.cursor = "", ce(), Z(j, !1), j = null, H = null, M = null, N = null, W = null, G?.forEach(O), G = null, V = null;
|
|
366
374
|
}
|
|
367
375
|
};
|
|
368
376
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/shadowDom.cjs"),t=require("../logic/verticalGeometry.cjs");var n=(e,t)=>{let n=Math.max(t.totalScrollWidth-e.clientWidth,0),r=Math.max(t.headerHeight+t.physicalBodyHeight+(t.footerHeight??0)-e.clientHeight,0);e.scrollLeft>n&&(e.scrollLeft=n),e.scrollTop>r&&(e.scrollTop=r)},r=(e,n,r)=>{let i=r.headerHeight+n.top,a=i+n.height,o=r.leftPaneWidth+r.centerLeadingWidth+n.left,s=o+n.width,c=t.physicalToLogicalScrollTop(e.scrollTop,r.verticalScaleFactor),l=e.scrollLeft,u=e.clientHeight-(r.footerHeight??0),d=e.clientWidth,f=c,p=l,m=c+r.headerHeight+(r.stickyTopInset?.visibleAt(c)??0),h=c+u,g=()=>Math.max(i-r.headerHeight-(r.stickyTopInset?.coveringRowAt(n.top)??0),0);i<m?f=g():a>h&&(f=n.height>h-m?g():Math.max(a-u,0));let
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/shadowDom.cjs"),t=require("../logic/verticalGeometry.cjs");var n=(e,t)=>{let n=Math.max(t.totalScrollWidth-e.clientWidth,0),r=Math.max(t.headerHeight+t.physicalBodyHeight+(t.footerHeight??0)-e.clientHeight,0);e.scrollLeft>n&&(e.scrollLeft=n),e.scrollTop>r&&(e.scrollTop=r)},r=(e,n,r)=>{let i=r.headerHeight+n.top,a=i+n.height,o=r.leftPaneWidth+r.centerLeadingWidth+n.left,s=o+n.width,c=t.physicalToLogicalScrollTop(e.scrollTop,r.verticalScaleFactor),l=e.scrollLeft,u=e.clientHeight-(r.footerHeight??0),d=e.clientWidth,f=c,p=l,m=c+r.headerHeight+(r.stickyTopInset?.visibleAt(c)??0),h=c+u,g=()=>Math.max(i-r.headerHeight-(r.stickyTopInset?.coveringRowAt(n.top)??0),0),_=e.closest(`.ssg-shell`)?.hasAttribute(`data-ssg-pointer`)===!0;r.activeCellSpanned===!0&&i<h&&a>m&&(_||i>=m)||(i<m?f=g():a>h&&(f=n.height>h-m?g():Math.max(a-u,0)));let v=l+r.leftPaneWidth,y=l+d-r.rightPaneWidth,b=r.activeCellPinned===!0;if(!b&&o<v||!b&&s>y&&n.width>y-v?p=Math.max(o-r.leftPaneWidth,0):!b&&s>y&&(p=Math.max(s-d+r.rightPaneWidth,0)),f!==c||p!==l){let n=t.logicalToPhysicalScrollTop(f,r.verticalScaleFactor);return e.scrollTo({top:f>c?Math.ceil(n):n,left:p,behavior:`auto`}),!0}return!1},i=(e,t,n,r)=>e<n?e-n:t>r?Math.min(t-r,e-n):0,a=(n,r,a)=>{let o=n.ownerDocument,s=o.defaultView,c=n.closest(`.ssg-shell`),l=e.getActiveElement(n);if(!s||!c||!l||l!==c&&!(l.classList.contains(`ssg-ime-input`)&&c.contains(l))||c.hasAttribute(`data-ssg-pointer`))return;let u=n.getBoundingClientRect();if(u.height===0)return;let d=t.physicalToLogicalScrollTop(n.scrollTop,a.verticalScaleFactor),f=u.top+n.clientTop+a.headerHeight+r.top-d,p=f+r.height;for(let e=n.parentElement;e&&e!==o.body&&e!==o.documentElement;e=e.parentElement){let t=e.scrollHeight-e.clientHeight;if(t<=0)continue;let n=s.getComputedStyle(e).overflowY;if(n!==`auto`&&n!==`scroll`&&n!==`overlay`)continue;let r=e.getBoundingClientRect().top+e.clientTop,a=i(f,p,r,r+e.clientHeight);if(a===0)continue;let o=e.scrollTop,c=Math.min(Math.max(o+a,0),t);e.scrollTop=c,f-=c-o,p-=c-o}let m=i(f,p,0,s.innerHeight);m!==0&&s.scrollBy({top:m,behavior:`auto`})},o=()=>{let e=null,n=1,r=0;return{update:(i,a,o)=>{let s=e,c=n,l=r;if(e=i,n=a,r=i!==null&&a!==1?Math.max(i.scrollHeight-i.clientHeight,0):0,i===null||i!==s||c===a)return;let u=i.scrollTop;if(l>0&&u>=l-1)return;let d=t.logicalToPhysicalScrollTop(t.physicalToLogicalScrollTop(u,c),a);Math.abs(d-u)<1||(i.scrollTop=d,i.scrollTop!==u&&o(i.scrollTop))}}},s=1e3,c=[`wheel`,`touchstart`,`pointerdown`,`pointerup`,`pointermove`,`keydown`],l=(e,t)=>e!==null&&e.top===t.top&&e.height===t.height&&e.left===t.left&&e.width===t.width,u=(e,t,n)=>e===null||n.some(n=>!Object.is(e[n],t[n])),d=()=>{let e=null,t=null,i=null,o=null,d=()=>{i=null,o?.(),o=null},f=e=>{e.type===`pointermove`&&!(e.buttons>0)||d()},p=(e,t)=>{d(),i={cell:t,until:Date.now()+s,left:e.scrollLeft};let n=e.ownerDocument,r=setTimeout(d,s);if(typeof n?.addEventListener!=`function`){o=()=>clearTimeout(r);return}for(let e of c)n.addEventListener(e,f,{capture:!0,passive:!0});o=()=>{clearTimeout(r);for(let e of c)n.removeEventListener(e,f,{capture:!0})}};return{update:o=>{if(u(e,o,[`columnVirtualizer`,`columnMeasurements`])&&o.columnVirtualizer.measure(),u(e,o,[`scrollElement`,`totalScrollWidth`,`physicalBodyHeight`,`headerHeight`,`footerHeight`])&&o.scrollElement&&n(o.scrollElement,o),u(e,o,[`scrollElement`,`activeCellRect`,`activeCellPinned`,`activeCell`,`headerHeight`,`leftPaneWidth`,`rightPaneWidth`,`centerLeadingWidth`,`verticalScaleFactor`,`footerHeight`])){let n=t,{activeCell:s}=o,c=n!==null&&s!==null&&n.row===s.row&&n.col===s.col;t=s,!c&&s!==null&&o.isRowFollowMove?.(s)===!0?d():!c&&o.scrollElement&&o.activeCellRect&&s?(r(o.scrollElement,o.activeCellRect,o),a(o.scrollElement,o.activeCellRect,o),p(o.scrollElement,s)):c&&i!==null&&s!==null&&o.scrollElement&&o.activeCellRect&&i.cell.row===s.row&&i.cell.col===s.col&&!l(e?.activeCellRect??null,o.activeCellRect)&&(Date.now()>i.until||Math.abs(o.scrollElement.scrollLeft-i.left)>1?d():(r(o.scrollElement,o.activeCellRect,o),i={...i,left:o.scrollElement.scrollLeft}))}e=o},cancelFollow:d,dispose:d}};exports.clampScrollToContent=n,exports.createScrollScaleAnchor=o,exports.createViewportSyncController=d,exports.revealActiveCellInPage=a,exports.scrollCellIntoView=r;
|
|
@@ -21,6 +21,7 @@ export type ViewportSyncArgs<T> = {
|
|
|
21
21
|
centerLeadingWidth: number;
|
|
22
22
|
activeCellRect: ViewportCellRect | null;
|
|
23
23
|
activeCellPinned?: boolean;
|
|
24
|
+
activeCellSpanned?: boolean | undefined;
|
|
24
25
|
activeCell: CellCoord | null;
|
|
25
26
|
verticalScaleFactor: number;
|
|
26
27
|
footerHeight?: number;
|
|
@@ -33,7 +34,7 @@ export type ViewportSyncController<T> = {
|
|
|
33
34
|
dispose: () => void;
|
|
34
35
|
};
|
|
35
36
|
export declare const clampScrollToContent: (scrollElement: HTMLElement, args: Pick<ViewportSyncArgs<unknown>, "totalScrollWidth" | "physicalBodyHeight" | "headerHeight" | "footerHeight">) => void;
|
|
36
|
-
export declare const scrollCellIntoView: (scrollElement: HTMLElement, rect: ViewportCellRect, args: Pick<ViewportSyncArgs<unknown>, "headerHeight" | "leftPaneWidth" | "rightPaneWidth" | "centerLeadingWidth" | "verticalScaleFactor" | "footerHeight" | "activeCellPinned" | "stickyTopInset">) => boolean;
|
|
37
|
+
export declare const scrollCellIntoView: (scrollElement: HTMLElement, rect: ViewportCellRect, args: Pick<ViewportSyncArgs<unknown>, "headerHeight" | "leftPaneWidth" | "rightPaneWidth" | "centerLeadingWidth" | "verticalScaleFactor" | "footerHeight" | "activeCellPinned" | "activeCellSpanned" | "stickyTopInset">) => boolean;
|
|
37
38
|
export declare const revealActiveCellInPage: (scrollElement: HTMLElement, rect: ViewportCellRect, args: Pick<ViewportSyncArgs<unknown>, "headerHeight" | "verticalScaleFactor">) => void;
|
|
38
39
|
export type ScrollScaleAnchor = {
|
|
39
40
|
update: (scrollElement: HTMLElement | null, verticalScaleFactor: number, onAnchored: (scrollTop: number) => void) => void;
|
|
@@ -5,10 +5,10 @@ var r = (e, t) => {
|
|
|
5
5
|
let n = Math.max(t.totalScrollWidth - e.clientWidth, 0), r = Math.max(t.headerHeight + t.physicalBodyHeight + (t.footerHeight ?? 0) - e.clientHeight, 0);
|
|
6
6
|
e.scrollLeft > n && (e.scrollLeft = n), e.scrollTop > r && (e.scrollTop = r);
|
|
7
7
|
}, i = (e, r, i) => {
|
|
8
|
-
let a = i.headerHeight + r.top, o = a + r.height, s = i.leftPaneWidth + i.centerLeadingWidth + r.left, c = s + r.width, l = n(e.scrollTop, i.verticalScaleFactor), u = e.scrollLeft, d = e.clientHeight - (i.footerHeight ?? 0), f = e.clientWidth, p = l, m = u, h = l + i.headerHeight + (i.stickyTopInset?.visibleAt(l) ?? 0), g = l + d, _ = () => Math.max(a - i.headerHeight - (i.stickyTopInset?.coveringRowAt(r.top) ?? 0), 0);
|
|
9
|
-
a < h ? p = _() : o > g && (p = r.height > g - h ? _() : Math.max(o - d, 0));
|
|
10
|
-
let
|
|
11
|
-
if (!
|
|
8
|
+
let a = i.headerHeight + r.top, o = a + r.height, s = i.leftPaneWidth + i.centerLeadingWidth + r.left, c = s + r.width, l = n(e.scrollTop, i.verticalScaleFactor), u = e.scrollLeft, d = e.clientHeight - (i.footerHeight ?? 0), f = e.clientWidth, p = l, m = u, h = l + i.headerHeight + (i.stickyTopInset?.visibleAt(l) ?? 0), g = l + d, _ = () => Math.max(a - i.headerHeight - (i.stickyTopInset?.coveringRowAt(r.top) ?? 0), 0), v = e.closest(".ssg-shell")?.hasAttribute("data-ssg-pointer") === !0;
|
|
9
|
+
i.activeCellSpanned === !0 && a < g && o > h && (v || a >= h) || (a < h ? p = _() : o > g && (p = r.height > g - h ? _() : Math.max(o - d, 0)));
|
|
10
|
+
let y = u + i.leftPaneWidth, b = u + f - i.rightPaneWidth, x = i.activeCellPinned === !0;
|
|
11
|
+
if (!x && s < y || !x && c > b && r.width > b - y ? m = Math.max(s - i.leftPaneWidth, 0) : !x && c > b && (m = Math.max(c - f + i.rightPaneWidth, 0)), p !== l || m !== u) {
|
|
12
12
|
let n = t(p, i.verticalScaleFactor);
|
|
13
13
|
return e.scrollTo({
|
|
14
14
|
top: p > l ? Math.ceil(n) : n,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../model/gridActions.cjs"),t=require("../utils/permissions.cjs"),n=require("../logic/columnEditor.cjs"),r=require("../logic/checkboxEditor.cjs"),i=require("../logic/editorValues.cjs"),a=require("../logic/validation.cjs"),o=require("../logic/newRow.cjs"),s=require("../logic/clearCells.cjs"),c=require("../controllers/liveUiState.cjs"),l=require("../controllers/keyboardController.cjs");var u=e=>e==null||e===``||Array.isArray(e)&&e.length===0,d=(e,n,r,o,s)=>{let{rows:c,rowModel:l,handleRowsChange:u,applyServerSideCellEdits:d}=e;if(a.decideCellWrite(o,r,s).action===`reject`)return;let f=l.newRow;if(f!==void 0&&f.index===n){let e=f.peekRow()??r;Object.is(t.getCellValue(e,o),s)||f.writeRow(t.setCellValue(e,o,s));return}if(d){d([{viewIndex:n,column:o,value:s}]);return}if(!u)return;let p=l.getSourceIndex(n);p!==void 0&&u(i.writeRowsCell(c,p,o,s))},f=()=>{let f=null,p=e=>{f=e},m=(e,n,r,i,a)=>t.isViewCellEditable({readOnly:e.readOnly,canEditCell:e.canEditCell},e.rowModel,n,r,i,a),h=e=>{
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../model/gridActions.cjs"),t=require("../utils/permissions.cjs"),n=require("../logic/columnEditor.cjs"),r=require("../logic/checkboxEditor.cjs"),i=require("../logic/editorValues.cjs"),a=require("../logic/validation.cjs"),o=require("../logic/newRow.cjs"),s=require("../logic/clearCells.cjs"),c=require("../controllers/liveUiState.cjs"),l=require("../controllers/keyboardController.cjs");var u=e=>e==null||e===``||Array.isArray(e)&&e.length===0,d=(e,n,r,o,s)=>{let{rows:c,rowModel:l,handleRowsChange:u,applyServerSideCellEdits:d}=e;if(a.decideCellWrite(o,r,s).action===`reject`)return;let f=l.newRow;if(f!==void 0&&f.index===n){let e=f.peekRow()??r;Object.is(t.getCellValue(e,o),s)||f.writeRow(t.setCellValue(e,o,s));return}if(d){d([{viewIndex:n,column:o,value:s}]);return}if(!u)return;let p=l.getSourceIndex(n);p!==void 0&&u(i.writeRowsCell(c,p,o,s))},f=()=>{let f=null,p=e=>{f=e},m=(e,n,r,i,a)=>t.isViewCellEditable({readOnly:e.readOnly,canEditCell:e.canEditCell},e.rowModel,n,r,i,a),h=(e,r,i)=>{let a=e.orderedColumns[r.col];if(!a||!n.hasRowEditor(a)&&n.resolveStaticColumnEditor(a)?.type===`checkbox`)return null;let s=o.resolveEditRow(i,r.row,t.isColumnEditable(e.readOnly,a));return!s||n.resolveColumnEditor(a,s)?.type===`checkbox`||!t.isViewCellEditable({readOnly:e.readOnly,canEditCell:e.canEditCell},i,r.row,r.col,s,a)?null:{row:s,column:a}},g=e=>{if(f===null)return!1;let n=h(f,e,f.rowModel);return n===null?!1:(f.startEditWithValue(e,String(t.getCellValue(n.row,n.column)??``)),!0)},_=(e,t)=>f!==null&&h(f,e,t)!==null,v=(e,t,n,r)=>{f!==null&&d(f,e,t,n,r)};return{update:p,tryStartEdit:g,canStartEdit:_,toggleCheckbox:e=>{if(f===null)return;let{rowModel:i,orderedColumns:a,handleRowsChange:s,applyServerSideCellEdits:c}=f;if(!s&&!c)return;let l=a[e.col];if(!l||!n.mayHaveEditorType(l,`checkbox`))return;let u=o.resolveEditRow(i,e.row,t.isColumnEditable(f.readOnly,l)),d=u===void 0?void 0:n.resolveColumnEditor(l,u);!u||d?.type!==`checkbox`||!m(f,e.row,e.col,u,l)||v(e.row,u,l,r.toggleCheckboxValue(t.getCellValue(u,l),d))},writeCellValue:v,clearSelectedCells:()=>{if(f===null)return;let e=f,{rows:n,rowModel:r,orderedColumns:l,handleRowsChange:d,applyServerSideCellEdits:p}=e,{selection:h,activeCell:g}=c.readLiveUiState(e),_=r.getRowCount();if(g!==null&&o.isNewRowAt(r,g.row)&&h?.type!==`col`){let n=l[g.col],o=r.newRow?.hasDraft()?r.newRow.peekRow():void 0;if(n===void 0||o===void 0||!m(e,g.row,g.col,o,n))return;let s=i.resolveCellParser(n)(``,o),c=t.getCellValue(o,n);if(Object.is(c,s)||u(c)&&u(s))return;a.decideCellWrite(n,o,s).action!==`reject`&&r.newRow?.writeRow(t.setCellValue(o,n,s));return}if(p){let t=s.buildClearCellEdits({getRow:e=>r.getRow(e),columns:l,selection:h,activeCell:g,viewRowCount:_,canWriteCell:(t,n,r,i)=>m(e,t,n,r,i)});t.length>0&&p(t);return}if(!d)return;let{nextRows:v,changed:y}=s.clearCellsInSelection({rows:n,resolveSourceIndex:e=>r.getSourceIndex(e),columns:l,selection:h,activeCell:g,viewRowCount:_,canWriteCell:(t,n,r,i,a)=>m(e,a,n,r,i)});y&&d(v)},selectEntireGrid:()=>{if(f===null)return;let{rowModel:t,orderedColumns:n,dispatch:r}=f,i=o.getSelectableRowCount(t);i===0||n.length===0||(r(e.gridActions.startSelection({row:0,col:0})),r(e.gridActions.updateSelection({row:i-1,col:n.length-1})),r(e.gridActions.endSelection()),r(e.gridActions.activateCell(l.resolveFirstDataCell(t,n))))}}};exports.createCellCommands=f,exports.writeCellValueTo=d;
|
|
@@ -19,6 +19,7 @@ export declare const writeCellValueTo: <T extends object>(target: CellWriteTarge
|
|
|
19
19
|
export type CellCommands<T extends object> = {
|
|
20
20
|
update: (args: CellCommandsArgs<T>) => void;
|
|
21
21
|
tryStartEdit: (cell: CellCoord) => boolean;
|
|
22
|
+
canStartEdit: (cell: CellCoord, rowModel: RowModel<T>) => boolean;
|
|
22
23
|
toggleCheckbox: (cell: CellCoord) => void;
|
|
23
24
|
writeCellValue: (viewIndex: number, row: T, column: GridColumn<T>, nextValue: unknown) => void;
|
|
24
25
|
clearSelectedCells: () => void;
|
|
@@ -35,18 +35,28 @@ var b = (e) => e == null || e === "" || Array.isArray(e) && e.length === 0, x =
|
|
|
35
35
|
}, C = (e, t, n, i, a) => r({
|
|
36
36
|
readOnly: e.readOnly,
|
|
37
37
|
canEditCell: e.canEditCell
|
|
38
|
-
}, e.rowModel, t, n, i, a), w = (e) => {
|
|
38
|
+
}, e.rowModel, t, n, i, a), w = (e, t, i) => {
|
|
39
|
+
let o = e.orderedColumns[t.col];
|
|
40
|
+
if (!o || !a(o) && c(o)?.type === "checkbox") return null;
|
|
41
|
+
let l = h(i, t.row, n(e.readOnly, o));
|
|
42
|
+
return !l || s(o, l)?.type === "checkbox" || !r({
|
|
43
|
+
readOnly: e.readOnly,
|
|
44
|
+
canEditCell: e.canEditCell
|
|
45
|
+
}, i, t.row, t.col, l, o) ? null : {
|
|
46
|
+
row: l,
|
|
47
|
+
column: o
|
|
48
|
+
};
|
|
49
|
+
}, T = (e) => {
|
|
39
50
|
if (d === null) return !1;
|
|
40
|
-
let
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return !i || s(r, i)?.type === "checkbox" || !C(d, e.row, e.col, i, r) ? !1 : (d.startEditWithValue(e, String(t(i, r) ?? "")), !0);
|
|
44
|
-
}, T = (e, t, n, r) => {
|
|
51
|
+
let n = w(d, e, d.rowModel);
|
|
52
|
+
return n === null ? !1 : (d.startEditWithValue(e, String(t(n.row, n.column) ?? "")), !0);
|
|
53
|
+
}, E = (e, t) => d !== null && w(d, e, t) !== null, D = (e, t, n, r) => {
|
|
45
54
|
d !== null && x(d, e, t, n, r);
|
|
46
55
|
};
|
|
47
56
|
return {
|
|
48
57
|
update: S,
|
|
49
|
-
tryStartEdit:
|
|
58
|
+
tryStartEdit: T,
|
|
59
|
+
canStartEdit: E,
|
|
50
60
|
toggleCheckbox: (e) => {
|
|
51
61
|
if (d === null) return;
|
|
52
62
|
let { rowModel: r, orderedColumns: i, handleRowsChange: a, applyServerSideCellEdits: c } = d;
|
|
@@ -54,9 +64,9 @@ var b = (e) => e == null || e === "" || Array.isArray(e) && e.length === 0, x =
|
|
|
54
64
|
let u = i[e.col];
|
|
55
65
|
if (!u || !o(u, "checkbox")) return;
|
|
56
66
|
let f = h(r, e.row, n(d.readOnly, u)), p = f === void 0 ? void 0 : s(u, f);
|
|
57
|
-
!f || p?.type !== "checkbox" || !C(d, e.row, e.col, f, u) ||
|
|
67
|
+
!f || p?.type !== "checkbox" || !C(d, e.row, e.col, f, u) || D(e.row, f, u, l(t(f, u), p));
|
|
58
68
|
},
|
|
59
|
-
writeCellValue:
|
|
69
|
+
writeCellValue: D,
|
|
60
70
|
clearSelectedCells: () => {
|
|
61
71
|
if (d === null) return;
|
|
62
72
|
let e = d, { rows: n, rowModel: r, orderedColumns: a, handleRowsChange: o, applyServerSideCellEdits: s } = e, { selection: c, activeCell: l } = v(e), p = r.getRowCount();
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../model/gridActions.cjs"),t=require("../utils/permissions.cjs"),n=require("../logic/validation.cjs"),r=require("../logic/cellSpans.cjs");var i=(e,t)=>e===t||e!==null&&t!==null&&e.row===t.row&&e.col===t.col,a=(e,t)=>{if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e===null||t===null)return!1;let n=Object.keys(e);return n.length===Object.keys(t).length?n.every(n=>Object.prototype.hasOwnProperty.call(t,n)&&Object.is(e[n],t[n])):!1},o=(e,t)=>{let n=Object.keys(e);return n.length===Object.keys(t).length?n.every(n=>e[n]===t[n]):!1},s=()=>{let s=r.INERT_CELL_SPAN_INDEX,c=null,l=null,u=null,d=r.createColSpanCache(),f=new WeakMap,p=new WeakMap,m=null,h=null,g=r.INERT_CELL_SPAN_INDEX,_=new WeakMap,v=e=>{if(h!==null&&h.enabled===e.enabled&&h.rowModel===e.rowModel&&h.columns===e.columns&&h.detailOpenRows===e.detailOpenRows&&h.treeColumnKey===e.treeColumnKey)return g;if(h=e,!e.enabled||!r.hasCellSpanColumns(e.columns))return g=r.INERT_CELL_SPAN_INDEX,g;let t=e.detailOpenRows&&e.detailOpenRows.length>0?new Set(e.detailOpenRows.map(e=>e.index)):null;return g=r.createCellSpanIndex({rowModel:e.rowModel,columns:e.columns,isDetailOpen:t?e=>t.has(e):void 0,treeColumnKey:e.treeColumnKey,rowIndexOffset:e.rowModel.pageStart??0,colSpanCache:d}),_.set(g,e),g},y=null,b=(e,t,n)=>{let i=c;if(i===null||!s.active)return r.INERT_CELL_SPAN_INDEX;let a=n&&n.size>0?n:null,o=i.detailOpenRows!==null&&i.detailOpenRows!==void 0&&i.detailOpenRows.length>0;if(e===i.rowModel&&a===null&&!o)return s;if(y!==null&&y.rowModel===e&&y.pageSize===t&&y.columns===i.columns&&y.detailKeys===a)return y.index;let l=r.createCellSpanIndex({rowModel:e,columns:i.columns,treeColumnKey:i.treeColumnKey,pageSize:t??void 0,isDetailOpen:a?t=>{let n=e.getRowKey(t);return n!==void 0&&a.has(n)}:void 0,colSpanCache:d});return y={rowModel:e,pageSize:t,columns:i.columns,detailKeys:a,index:l},l},x=({index:t,dispatch:n})=>{let r=t!==s;r&&(m=s),s=t,c=_.get(t)??null,t.active||(l=null),r&&t.active&&n!==void 0&&n(e.gridActions.followCellSpans())},S=(e,t)=>{let n=f.get(t.start)??t.start,a=p.get(t.end)??t.end,o=r.expandCellRangeBySpans(e,n===t.start&&a===t.end?t:{...t,start:n,end:a});return i(o.start,t.start)&&i(o.end,t.end)?t:(o.start!==n&&f.set(o.start,n),o.end!==a&&p.set(o.end,a),o)},C=e=>({top:e.row,bottom:e.row,left:e.col,right:e.col});return{resolve:v,resolveFull:b,update:x,current:()=>s,followState:(e,t)=>{let n=s;if(!n.active||e===t)return t;let r=t,a=t.activeCell;if(t.selection!==e.selection&&t.selection?.type===`cell`){let o=t.selection.range,s=f.get(o.start),c=S(n,o);c!==o&&(r={...r,selection:{type:`cell`,range:c}}),s!==void 0&&a===o.start&&(a=s,r={...r,activeCell:i(e.activeCell,s)?e.activeCell:s})}let c=(e,t)=>{let r=n.getSpan(e.row,e.col);if(r===null||r.top===e.row&&r.left===e.col)return null;let a={row:r.top,col:r.left};return t!==null&&i(t,a)?t:a};if(a!==e.activeCell){let t=a,n=t===null?null:c(t,e.activeCell);t!==null&&n!==null?(l={cell:t,anchor:n},r={...r,activeCell:n}):l=null}if(t.editingCell!==e.editingCell&&t.editingCell!==null){let n=c(t.editingCell,e.editingCell);n!==null&&(r={...r,editingCell:n,activeCell:i(r.activeCell,n)?r.activeCell:n})}return r!==t&&o(r,e)?e:r},refollow:e=>{let t=s,n=m;if(m=null,!t.active)return e;let r=e,a=e.activeCell,o=a,c=a===null||e.editingCell!==null?null:t.getSpan(a.row,a.col);if(a!==null&&c!==null&&(c.top!==a.row||c.left!==a.col)){let e={row:c.top,col:c.left};l={cell:a,anchor:e},o=e,r={...r,activeCell:e}}if(e.selection?.type===`cell`){let s=e.selection.range,c,l=n!==null&&a!==null?n.expandRect(C(a)):null;if(l!==null&&o!==null&&Math.min(s.start.row,s.end.row)===l.top&&Math.max(s.start.row,s.end.row)===l.bottom&&Math.min(s.start.col,s.end.col)===l.left&&Math.max(s.start.col,s.end.col)===l.right){let e=t.expandRect(C(o)),n={start:{row:e.top,col:e.left},end:{row:e.bottom,col:e.right}};c=i(n.start,s.start)&&i(n.end,s.end)?s:n}else c=S(t,s);c!==s&&(r={...r,selection:{type:`cell`,range:c}})}return r},entryFor:e=>{if(l===null||!i(l.anchor,e))return null;let t=s.getSpan(e.row,e.col);if(t===null||t.top!==e.row||t.left!==e.col)return null;let{cell:n}=l;return n.row>=t.top&&n.row<=t.bottom&&n.col>=t.left&&n.col<=t.right?n:null},reconcileWrites:(e,i,o)=>{let l=s,d=c;if(!l.active||d===null||e===i)return i;let{rowModel:f,columns:p}=d,m=f.getRowCount(),h=Math.min(e.length,i.length),g=new Map,_=e=>g.get(e)?.row??i[e],v=(e,n,r)=>{let a=g.get(e);a===void 0&&(a=t.createCellWriteDraft(i[e]),g.set(e,a)),t.writeCellValue(a,n,r)},y=e=>{let t=f.getSourceIndex(e);return typeof t==`number`&&t>=0&&t<h?t:-1},b=(e,r,i,a,s)=>o===void 0?!0:t.isViewCellEditable(o,f,e,r,i,a)?n.decideCellWrite(a,i,s,o.validationTexts).action!==`reject`:!1,x=new Set,S=n=>{let a=`${n.top}:${n.left}`;if(x.has(a))return;x.add(a);let o=y(n.top);if(!(o<0)){if(n.left===n.right){let a=p[n.left],s=t.getCellValue(e[o],a),c=t.getCellValue(i[o],a),l=e[o]!==i[o]&&!r.isSameSpanValue(s,c),d=u,f=d===null||n.left>=d.left&&n.left<=d.right;for(let o=n.top+1;o<=n.bottom;o+=1){let s=y(o);if(!(s<0)&&!(l&&d!==null&&(!f||o<d.top||o>d.bottom))){if(l){let l=_(s);if(!r.isSameSpanValue(t.getCellValue(l,a),c)){if(b(o,n.left,l,a,c))v(s,a,c);else if(e[s]!==i[s]){let n=t.getCellValue(e[s],a);r.isSameSpanValue(t.getCellValue(l,a),n)||v(s,a,n)}}}else if(e[s]!==i[s]){let n=t.getCellValue(e[s],a);r.isSameSpanValue(t.getCellValue(_(s),a),n)||v(s,a,n)}}}return}if(e[o]!==i[o])for(let i=n.left+1;i<=n.right;i+=1){let n=p[i],a=t.getCellValue(e[o],n);r.isSameSpanValue(t.getCellValue(_(o),n),a)||v(o,n,a)}}},C=p.length-1;for(let t=0;t<m;t+=1){let n=y(t);n<0||e[n]===i[n]||l.forEachSpan({top:t,bottom:t,left:0,right:C},S)}if(g.size===0)return i;let w=i.slice();for(let[t,n]of g)w[t]=t<e.length&&a(n.row,e[t])?e[t]:n.row;return w.length===e.length&&w.every((t,n)=>t===e[n])?e:w},scopeWrites:(e,t)=>{let n=u;u=e;try{return t()}finally{u=n}},rawStart:e=>f.get(e)??e,rawEnd:e=>p.get(e)??e,warnings:({isServerSide:e,columns:t,treeColumnKey:n})=>{let i=[];e&&r.hasCellSpanColumns(t)&&i.push({id:`cellSpan:serverSide`,message:`[SpreadsheetGrid] 列の spanRows / colSpan は serverSide(dataSource)では効きません(セルを結合せずに描きます)。
|
|
2
|
+
[SpreadsheetGrid] Column spanRows / colSpan have no effect with serverSide (dataSource). Cells are drawn without merging.`});let a=n===void 0||e?void 0:t.find(e=>e.key===n);return a!==void 0&&(a.spanRows||a.colSpan)&&i.push({id:`cellSpan:treeColumn`,message:`[SpreadsheetGrid] ツリーデータの木の列(treeData.column = "${n}")の spanRows / colSpan は効きません(木の列は結合しない)。\n[SpreadsheetGrid] spanRows / colSpan on the tree column (treeData.column = "${n}") have no effect. The tree column is never merged.`}),i},dispose:()=>{l=null,u=null,m=null}}};exports.createCellSpanController=s;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { CellCoord, GridColumn, GridRowKey, GridUiState, RowModel, SpreadsheetGridProps } from '../model/gridTypes.unbound.js';
|
|
2
|
+
import { type GridUiAction } from '../model/gridActions.js';
|
|
3
|
+
import { type CellSpanIndex, type CellSpanRect } from '../logic/cellSpans.js';
|
|
4
|
+
import { type ValidationLocaleText } from '../logic/validation.js';
|
|
5
|
+
export type CellSpanWriteGuard<T> = Pick<SpreadsheetGridProps<T>, 'readOnly' | 'canEditCell'> & {
|
|
6
|
+
validationTexts?: ValidationLocaleText | undefined;
|
|
7
|
+
};
|
|
8
|
+
export type CellSpanResolveInputs<T> = {
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
rowModel: RowModel<T>;
|
|
11
|
+
columns: readonly GridColumn<T>[];
|
|
12
|
+
detailOpenRows?: readonly {
|
|
13
|
+
index: number;
|
|
14
|
+
}[] | null | undefined;
|
|
15
|
+
treeColumnKey?: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
export type CellSpanController<T> = {
|
|
18
|
+
resolve: (inputs: CellSpanResolveInputs<T>) => CellSpanIndex;
|
|
19
|
+
resolveFull: (rowModel: RowModel<T>, pageSize: number | null, expandedDetailRowKeys?: ReadonlySet<GridRowKey> | null | undefined) => CellSpanIndex;
|
|
20
|
+
update: (args: {
|
|
21
|
+
index: CellSpanIndex;
|
|
22
|
+
dispatch?: ((action: GridUiAction) => void) | undefined;
|
|
23
|
+
}) => void;
|
|
24
|
+
current: () => CellSpanIndex;
|
|
25
|
+
followState: (previous: GridUiState, next: GridUiState) => GridUiState;
|
|
26
|
+
refollow: (state: GridUiState) => GridUiState;
|
|
27
|
+
entryFor: (anchor: CellCoord) => CellCoord | null;
|
|
28
|
+
reconcileWrites: (prevRows: readonly T[], nextRows: T[], guard?: CellSpanWriteGuard<T>) => T[];
|
|
29
|
+
scopeWrites: <R>(area: CellSpanRect | null, run: () => R) => R;
|
|
30
|
+
rawStart: (start: CellCoord) => CellCoord;
|
|
31
|
+
rawEnd: (end: CellCoord) => CellCoord;
|
|
32
|
+
warnings: (inputs: {
|
|
33
|
+
isServerSide: boolean;
|
|
34
|
+
columns: readonly GridColumn<T>[];
|
|
35
|
+
treeColumnKey?: string | undefined;
|
|
36
|
+
}) => {
|
|
37
|
+
id: string;
|
|
38
|
+
message: string;
|
|
39
|
+
}[];
|
|
40
|
+
dispose: () => void;
|
|
41
|
+
};
|
|
42
|
+
export declare const createCellSpanController: <T>() => CellSpanController<T>;
|