@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
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { resolveMoveTargetIndex as e, resolveRowDropSlot as t, resolveRowDropSlotTop as n } from "../logic/rowReorder.js";
|
|
2
2
|
import { isInsideDetailCardOf as r } from "../logic/detailRow.js";
|
|
3
|
-
import {
|
|
4
|
-
import { applySlotToElement as
|
|
3
|
+
import { clampClientYAboveFooter as i, computeNextScrollPosition as a, hasPointerLeftActivationRadius as o, resolveAutoScrollAxisDirection as s, resolveScrollContentBox as c } from "../logic/autoScrollGeometry.js";
|
|
4
|
+
import { applySlotToElement as l } from "../logic/slotDom.js";
|
|
5
5
|
//#region src/controllers/rowDragController.ts
|
|
6
|
-
var
|
|
6
|
+
var u = 14, d = 12, f = "0.5", p = "<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"8 6 12 2 16 6\"/><polyline points=\"16 18 12 22 8 18\"/><line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"22\"/></svg>", m = "<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>", h = 200, g = "cubic-bezier(0.2, 0.7, 0.3, 1)", _ = `transform 160ms ${g}`, v = "data-ssg-row-dragging", y = (e) => e?.closest(".ssg-motion-off") != null, b = /translateY\((-?[\d.]+)px\)/, x = (e) => {
|
|
7
7
|
let t = [];
|
|
8
8
|
return e.querySelectorAll(".ssg-body-row[data-row-index]").forEach((n) => {
|
|
9
9
|
r(e, n) || t.push(n);
|
|
10
10
|
}), t;
|
|
11
|
-
},
|
|
12
|
-
let
|
|
11
|
+
}, S = () => {
|
|
12
|
+
let S = null, C = null, w = null, T = {
|
|
13
13
|
x: 0,
|
|
14
14
|
y: 0
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
],
|
|
20
|
-
for (let e of
|
|
21
|
-
},
|
|
22
|
-
if (
|
|
15
|
+
}, E = null, D = !1, O = null, k = null, A = null, j = null, M = null, N = 0, P = () => S?.motion === "live", F = null, I = null, L = null, R = () => [
|
|
16
|
+
S?.leftIndicatorRef.current ?? null,
|
|
17
|
+
S?.centerIndicatorRef.current ?? null,
|
|
18
|
+
S?.rightIndicatorRef.current ?? null
|
|
19
|
+
], z = () => {
|
|
20
|
+
for (let e of R()) e && (e.style.display = "none");
|
|
21
|
+
}, B = (e) => {
|
|
22
|
+
if (F) return;
|
|
23
23
|
let t = document.createElement("div");
|
|
24
|
-
t.setAttribute("data-grid-drag-ghost", ""),
|
|
24
|
+
t.setAttribute("data-grid-drag-ghost", ""), S?.scrollContainerRef.current?.closest(".ssg-theme-dark") != null && t.classList.add("ssg-theme-dark"), S?.scrollContainerRef.current?.closest(".ssg-motion-off") != null && t.classList.add("ssg-motion-off"), t.style.cssText = [
|
|
25
25
|
"position:fixed",
|
|
26
26
|
"top:0",
|
|
27
27
|
"left:0",
|
|
@@ -46,53 +46,53 @@ var l = 14, u = 12, d = "0.5", f = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
46
46
|
"z-index:9999",
|
|
47
47
|
"will-change:transform",
|
|
48
48
|
"transform:translate(-9999px,-9999px)"
|
|
49
|
-
].join(";"),
|
|
49
|
+
].join(";"), l(t, S?.ghostSlot);
|
|
50
50
|
let n = document.createElement("span");
|
|
51
51
|
n.style.cssText = "display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none";
|
|
52
52
|
let r = document.createElement("span");
|
|
53
|
-
r.style.cssText = "overflow:hidden;text-overflow:ellipsis", r.textContent = e, t.appendChild(n), t.appendChild(r), document.body.appendChild(t),
|
|
54
|
-
},
|
|
55
|
-
let t =
|
|
53
|
+
r.style.cssText = "overflow:hidden;text-overflow:ellipsis", r.textContent = e, t.appendChild(n), t.appendChild(r), document.body.appendChild(t), F = t, I = n, L = null;
|
|
54
|
+
}, V = (e) => {
|
|
55
|
+
let t = F;
|
|
56
56
|
if (!t) return;
|
|
57
|
-
t.style.transform = "translate(" + (
|
|
57
|
+
t.style.transform = "translate(" + (T.x + u) + "px," + (T.y + d) + "px)";
|
|
58
58
|
let n = e ? "move" : "out";
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
-
let r =
|
|
62
|
-
n === "out" ? (t.style.opacity =
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
let n =
|
|
59
|
+
if (L === n) return;
|
|
60
|
+
L = n;
|
|
61
|
+
let r = I;
|
|
62
|
+
n === "out" ? (t.style.opacity = f, r && (r.innerHTML = m)) : (t.style.opacity = "1", r && (r.innerHTML = p));
|
|
63
|
+
}, H = () => {
|
|
64
|
+
F && F.parentNode && F.parentNode.removeChild(F), F = null, I = null, L = null;
|
|
65
|
+
}, U = (e, t) => {
|
|
66
|
+
let n = S?.scrollContainerRef.current ?? null;
|
|
67
67
|
!n || e === null || n.querySelectorAll(`.ssg-body-row[data-row-index="${e}"]`).forEach((e) => {
|
|
68
|
-
r(n, e) || (t ? e.setAttribute(
|
|
68
|
+
r(n, e) || (t ? e.setAttribute(v, P() ? "live" : "") : e.removeAttribute(v));
|
|
69
69
|
});
|
|
70
|
-
},
|
|
71
|
-
let e =
|
|
70
|
+
}, W = () => {
|
|
71
|
+
let e = S?.scrollContainerRef.current ?? null;
|
|
72
72
|
if (!e) return null;
|
|
73
73
|
let t = /* @__PURE__ */ new Map();
|
|
74
|
-
for (let n of
|
|
75
|
-
let e =
|
|
74
|
+
for (let n of x(e)) {
|
|
75
|
+
let e = b.exec(n.style.transform);
|
|
76
76
|
e && t.set(n, {
|
|
77
77
|
index: Number(n.getAttribute("data-row-index")),
|
|
78
78
|
baseY: parseFloat(e[1])
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
return t;
|
|
82
|
-
},
|
|
83
|
-
let n =
|
|
84
|
-
if (!n || r === null ||
|
|
85
|
-
let i =
|
|
82
|
+
}, G = (t) => {
|
|
83
|
+
let n = M, r = C;
|
|
84
|
+
if (!n || r === null || S === null) return;
|
|
85
|
+
let i = S.scrollContainerRef.current;
|
|
86
86
|
if (!i) return;
|
|
87
|
-
for (let e of
|
|
87
|
+
for (let e of x(i)) {
|
|
88
88
|
if (n.has(e)) continue;
|
|
89
|
-
let t =
|
|
89
|
+
let t = b.exec(e.style.transform);
|
|
90
90
|
t && n.set(e, {
|
|
91
91
|
index: Number(e.getAttribute("data-row-index")),
|
|
92
92
|
baseY: parseFloat(t[1])
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
|
-
let a =
|
|
95
|
+
let a = S.rowMetrics.rowsHeight(r, r), o = (i.scrollTop - N) * S.verticalScaleFactor, s = (E ? T.y - E.y : 0) + o, c = t === null ? null : e(r, t);
|
|
96
96
|
n.forEach(({ index: e, baseY: t }, i) => {
|
|
97
97
|
if (!i.isConnected) {
|
|
98
98
|
n.delete(i);
|
|
@@ -103,141 +103,148 @@ var l = 14, u = 12, d = "0.5", f = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
105
|
let o = 0;
|
|
106
|
-
c !== null && (r < e && e <= c ? o = -a : c <= e && e < r && (o = a)), i.style.transition =
|
|
106
|
+
c !== null && (r < e && e <= c ? o = -a : c <= e && e < r && (o = a)), i.style.transition = _, i.style.transform = `translateY(${t + o}px)`;
|
|
107
107
|
});
|
|
108
|
-
},
|
|
109
|
-
if (
|
|
110
|
-
let { scrollContainerRef:
|
|
111
|
-
if (!
|
|
112
|
-
let
|
|
113
|
-
if (e <
|
|
114
|
-
let
|
|
108
|
+
}, K = (e, r) => {
|
|
109
|
+
if (S === null) return null;
|
|
110
|
+
let { scrollContainerRef: a, bodyScrollRef: o, rowMetrics: s, headerHeight: c, verticalScaleFactor: l, windowBaseOffsetPx: u } = S, d = a.current, f = o.current;
|
|
111
|
+
if (!d || !f) return null;
|
|
112
|
+
let p = d.getBoundingClientRect();
|
|
113
|
+
if (e < p.left || e > p.right || r < p.top || r > p.bottom) return null;
|
|
114
|
+
let m = i(r, p.top + d.clientTop + d.clientHeight, S.footerHeight ?? 0), h = f.getBoundingClientRect(), g = t(f.scrollTop + m - h.top - c - d.scrollTop * (1 - l), s);
|
|
115
115
|
return {
|
|
116
|
-
slot:
|
|
117
|
-
top:
|
|
116
|
+
slot: g,
|
|
117
|
+
top: c + n(g, s) - u
|
|
118
118
|
};
|
|
119
|
-
},
|
|
120
|
-
let t =
|
|
121
|
-
if (
|
|
122
|
-
t && n !== null && (
|
|
119
|
+
}, q = () => {
|
|
120
|
+
let t = K(T.x, T.y), n = C;
|
|
121
|
+
if (P()) {
|
|
122
|
+
t && n !== null && (w = e(n, t.slot) === null ? null : t.slot), z(), G(w);
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
|
-
if (
|
|
126
|
-
|
|
125
|
+
if (V(t), !t || n === null || e(n, t.slot) === null) {
|
|
126
|
+
w = null, z();
|
|
127
127
|
return;
|
|
128
128
|
}
|
|
129
|
-
|
|
130
|
-
for (let e of
|
|
131
|
-
},
|
|
132
|
-
if (
|
|
133
|
-
|
|
129
|
+
w = t.slot;
|
|
130
|
+
for (let e of R()) e && (e.style.top = `${t.top}px`, e.style.display = "block");
|
|
131
|
+
}, J = () => {
|
|
132
|
+
if (C === null) {
|
|
133
|
+
A = null;
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
|
-
let e =
|
|
137
|
-
if (e && (
|
|
138
|
-
let t = e.getBoundingClientRect(), n =
|
|
136
|
+
let e = S?.scrollContainerRef.current ?? null;
|
|
137
|
+
if (e && (D || (!E || o(E, T, 6)) && (D = !0), D)) {
|
|
138
|
+
let t = e.getBoundingClientRect(), n = c({
|
|
139
139
|
rectLeft: t.left,
|
|
140
140
|
rectTop: t.top,
|
|
141
141
|
clientLeft: e.clientLeft,
|
|
142
142
|
clientTop: e.clientTop,
|
|
143
143
|
clientWidth: e.clientWidth,
|
|
144
144
|
clientHeight: e.clientHeight
|
|
145
|
-
}), r =
|
|
146
|
-
|
|
147
|
-
top:
|
|
145
|
+
}), r = s(T.y, n.top, n.bottom - (S?.footerHeight ?? 0), 24), i = a(e.scrollTop, r, 18, e.scrollHeight - e.clientHeight);
|
|
146
|
+
i !== e.scrollTop && e.scrollTo({
|
|
147
|
+
top: i,
|
|
148
148
|
behavior: "auto"
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
|
-
|
|
152
|
-
},
|
|
153
|
-
let e =
|
|
151
|
+
q(), A = requestAnimationFrame(J);
|
|
152
|
+
}, Y = () => {
|
|
153
|
+
let e = S?.scrollContainerRef.current ?? null;
|
|
154
154
|
if (!e) return null;
|
|
155
155
|
let t = /* @__PURE__ */ new Map();
|
|
156
|
-
for (let n of
|
|
156
|
+
for (let n of x(e)) t.set(n, n.getBoundingClientRect().top);
|
|
157
157
|
return t;
|
|
158
|
-
},
|
|
159
|
-
|
|
160
|
-
let n =
|
|
161
|
-
|
|
162
|
-
let i = n === null || r === null ? null : e(n, r), a = t && n !== null && i !== null &&
|
|
163
|
-
if (
|
|
158
|
+
}, X = (t) => {
|
|
159
|
+
A !== null && (cancelAnimationFrame(A), A = null), document.body.style.cursor = "", z(), H();
|
|
160
|
+
let n = C, r = w;
|
|
161
|
+
U(n, !1), C = null, w = null, E = null, k = null;
|
|
162
|
+
let i = n === null || r === null ? null : e(n, r), a = t && n !== null && i !== null && S !== null, o = M;
|
|
163
|
+
if (M = null, o) if (a) o.forEach((e, t) => {
|
|
164
164
|
t.style.transition = "", t.style.willChange = "";
|
|
165
165
|
});
|
|
166
166
|
else {
|
|
167
167
|
let e = [];
|
|
168
168
|
o.forEach(({ baseY: t }, n) => {
|
|
169
|
-
n.isConnected && (n.style.transition =
|
|
169
|
+
n.isConnected && (n.style.transition = _, n.style.transform = `translateY(${t}px)`, e.push(n));
|
|
170
170
|
}), window.setTimeout(() => {
|
|
171
171
|
for (let t of e) t.style.transition = "", t.style.willChange = "";
|
|
172
172
|
}, 200);
|
|
173
173
|
}
|
|
174
|
-
!a || n === null || i === null ||
|
|
174
|
+
!a || n === null || i === null || S === null || (j = y(S.scrollContainerRef.current) ? null : Y(), S.commitRowMove(n, i));
|
|
175
175
|
};
|
|
176
176
|
return {
|
|
177
177
|
update: (e) => {
|
|
178
|
-
|
|
178
|
+
S = e;
|
|
179
179
|
},
|
|
180
180
|
onRowDragHandlePointerDown: (e, t) => {
|
|
181
|
-
if (
|
|
182
|
-
t.stopPropagation(), t.preventDefault(),
|
|
181
|
+
if (S === null || !S.enabled || t.button !== 0) return;
|
|
182
|
+
if (t.stopPropagation(), t.preventDefault(), C !== null) {
|
|
183
|
+
if (t.pointerId !== k) return;
|
|
184
|
+
O?.(), X(!1);
|
|
185
|
+
}
|
|
186
|
+
C = e, k = t.pointerId, w = null, T = {
|
|
183
187
|
x: t.clientX,
|
|
184
188
|
y: t.clientY
|
|
185
|
-
},
|
|
189
|
+
}, E = {
|
|
186
190
|
x: t.clientX,
|
|
187
191
|
y: t.clientY
|
|
188
|
-
},
|
|
192
|
+
}, D = !1, document.body.style.cursor = "grabbing", P() ? (M = W(), N = S.scrollContainerRef.current?.scrollTop ?? 0) : B(S.getRowDragLabel(e)), U(e, !0);
|
|
189
193
|
let n = t.currentTarget, r = t.pointerId;
|
|
190
194
|
try {
|
|
191
195
|
n.setPointerCapture(r);
|
|
192
196
|
} catch {}
|
|
193
197
|
let i = (e) => {
|
|
194
|
-
e.pointerId === r && (
|
|
198
|
+
e.pointerId === r && (T = {
|
|
195
199
|
x: e.clientX,
|
|
196
200
|
y: e.clientY
|
|
197
|
-
},
|
|
201
|
+
}, q());
|
|
198
202
|
}, a = () => {
|
|
199
|
-
window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", o), window.removeEventListener("pointercancel", s), window.removeEventListener("keydown", c),
|
|
203
|
+
window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", o), window.removeEventListener("pointercancel", s), window.removeEventListener("keydown", c), window.removeEventListener("blur", l), O = null;
|
|
200
204
|
try {
|
|
201
205
|
n.releasePointerCapture(r);
|
|
202
206
|
} catch {}
|
|
203
207
|
};
|
|
204
208
|
function o(e) {
|
|
205
|
-
e.pointerId === r && (a(),
|
|
209
|
+
e.pointerId === r && (a(), X(!0));
|
|
206
210
|
}
|
|
207
211
|
function s(e) {
|
|
208
|
-
e.pointerId === r && (a(),
|
|
212
|
+
e.pointerId === r && (a(), X(!1));
|
|
209
213
|
}
|
|
210
214
|
function c(e) {
|
|
211
|
-
e.key === "Escape" && (a(),
|
|
215
|
+
e.key === "Escape" && (a(), X(!1));
|
|
216
|
+
}
|
|
217
|
+
function l() {
|
|
218
|
+
a(), X(!1);
|
|
212
219
|
}
|
|
213
|
-
window.addEventListener("pointermove", i), window.addEventListener("pointerup", o), window.addEventListener("pointercancel", s), window.addEventListener("keydown", c),
|
|
220
|
+
window.addEventListener("pointermove", i), window.addEventListener("pointerup", o), window.addEventListener("pointercancel", s), window.addEventListener("keydown", c), window.addEventListener("blur", l), O = a, q(), A = requestAnimationFrame(J);
|
|
214
221
|
},
|
|
215
222
|
applyReorderSettle: () => {
|
|
216
|
-
let e =
|
|
217
|
-
if (
|
|
218
|
-
let t =
|
|
223
|
+
let e = j;
|
|
224
|
+
if (j = null, !e) return;
|
|
225
|
+
let t = S?.scrollContainerRef.current ?? null;
|
|
219
226
|
if (!t) return;
|
|
220
227
|
let n = [], r = /* @__PURE__ */ new Map();
|
|
221
228
|
if (e.forEach((e, t) => {
|
|
222
229
|
if (!t.isConnected) return;
|
|
223
230
|
let i = e - t.getBoundingClientRect().top;
|
|
224
231
|
if (Math.abs(i) < .5) return;
|
|
225
|
-
let a =
|
|
232
|
+
let a = b.exec(t.style.transform);
|
|
226
233
|
if (!a) return;
|
|
227
234
|
let o = parseFloat(a[1]);
|
|
228
235
|
r.set(t, o), t.style.transition = "none", t.style.transform = `translateY(${o + i}px)`, t.style.willChange = "transform", n.push(t);
|
|
229
236
|
}), n.length !== 0) {
|
|
230
237
|
t.getBoundingClientRect();
|
|
231
|
-
for (let e of n) e.style.transition = `transform ${
|
|
238
|
+
for (let e of n) e.style.transition = `transform ${h}ms ${g}`, e.style.transform = `translateY(${r.get(e) ?? 0}px)`;
|
|
232
239
|
window.setTimeout(() => {
|
|
233
240
|
for (let e of n) e.style.transition = "", e.style.willChange = "";
|
|
234
241
|
}, 280);
|
|
235
242
|
}
|
|
236
243
|
},
|
|
237
244
|
dispose: () => {
|
|
238
|
-
|
|
245
|
+
O?.(), O = null, A !== null && (cancelAnimationFrame(A), A = null), document.body.style.cursor = "", H(), U(C, !1), C = null, w = null, M = null;
|
|
239
246
|
}
|
|
240
247
|
};
|
|
241
248
|
};
|
|
242
249
|
//#endregion
|
|
243
|
-
export {
|
|
250
|
+
export { S as createRowDragController };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`ssg-scroll-container--scrolling`,t=120,n=()=>{let t=null,n=null,r=0,i=null,a=null,o=null,s=()=>{a=null;let e=i;i=null,e&&t?.onScroll?.(e)},
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`ssg-scroll-container--scrolling`,t=120,n=()=>{let t=null,n=null,r=0,i=null,a=null,o=null,s=null,c=()=>{a=null;let e=i;i=null,e&&t?.onScroll?.(e)},l=e=>Math.max(e.clientHeight-(t?.footerHeight??0),0),u=u=>{s=u,t?.setViewState({scrollTop:u.scrollTop,viewportHeight:l(u),viewportWidth:u.clientWidth});let d=()=>{t?.setViewState({scrollTop:u.scrollTop}),u.classList.add(e),o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,u.classList.remove(e)},120);let n=r>0?`api`:`user`;n===`api`&&--r;let s=i;i={top:u.scrollTop,left:u.scrollLeft,source:s?.source===`user`?`user`:n},t?.onScroll&&a===null&&(a=requestAnimationFrame(c))};u.addEventListener(`scroll`,d,{passive:!0});let f=new ResizeObserver(()=>{t?.setViewState({viewportHeight:l(u),viewportWidth:u.clientWidth})});f.observe(u),n=()=>{u.removeEventListener(`scroll`,d),a!==null&&(cancelAnimationFrame(a),a=null),o!==null&&(clearTimeout(o),o=null),u.classList.remove(e),f.disconnect(),s=null}};return{update:e=>{let r=t?.footerHeight??0;if(t=e,n===null){let t=e.scrollContainerRef.current;t&&u(t);return}let i=e.footerHeight??0;if(i!==r&&s){let t=s,n=i-r;if(n>0){let e=t.scrollHeight-n-t.clientHeight;e>0&&t.scrollTop>=e-1&&(t.scrollTop=t.scrollHeight-t.clientHeight)}e.setViewState({viewportHeight:l(t)})}},markApiScroll:()=>{r+=1},dispose:()=>{n?.(),n=null}}};exports.SCROLLING_CLASS_NAME=e,exports.SCROLLING_IDLE_MS=t,exports.createScrollSyncController=n;
|
|
@@ -7,6 +7,7 @@ export type ScrollSyncArgs = {
|
|
|
7
7
|
scrollContainerRef: ReadonlyRef<HTMLElement | null>;
|
|
8
8
|
setViewState: (patch: GridViewStatePatch) => void;
|
|
9
9
|
onScroll: ((params: GridScrollEventParams) => void) | undefined;
|
|
10
|
+
footerHeight?: number;
|
|
10
11
|
};
|
|
11
12
|
export type ScrollSyncController = {
|
|
12
13
|
update: (args: ScrollSyncArgs) => void;
|
|
@@ -1,44 +1,55 @@
|
|
|
1
1
|
//#region src/controllers/scrollSyncController.ts
|
|
2
2
|
var e = "ssg-scroll-container--scrolling", t = 120, n = () => {
|
|
3
|
-
let t = null, n = null, r = 0, i = null, a = null, o = null, s = () => {
|
|
3
|
+
let t = null, n = null, r = 0, i = null, a = null, o = null, s = null, c = () => {
|
|
4
4
|
a = null;
|
|
5
5
|
let e = i;
|
|
6
6
|
i = null, e && t?.onScroll?.(e);
|
|
7
|
-
},
|
|
8
|
-
t?.setViewState({
|
|
9
|
-
scrollTop:
|
|
10
|
-
viewportHeight:
|
|
11
|
-
viewportWidth:
|
|
7
|
+
}, l = (e) => Math.max(e.clientHeight - (t?.footerHeight ?? 0), 0), u = (u) => {
|
|
8
|
+
s = u, t?.setViewState({
|
|
9
|
+
scrollTop: u.scrollTop,
|
|
10
|
+
viewportHeight: l(u),
|
|
11
|
+
viewportWidth: u.clientWidth
|
|
12
12
|
});
|
|
13
|
-
let
|
|
14
|
-
t?.setViewState({ scrollTop:
|
|
15
|
-
o = null,
|
|
13
|
+
let d = () => {
|
|
14
|
+
t?.setViewState({ scrollTop: u.scrollTop }), u.classList.add(e), o !== null && clearTimeout(o), o = setTimeout(() => {
|
|
15
|
+
o = null, u.classList.remove(e);
|
|
16
16
|
}, 120);
|
|
17
17
|
let n = r > 0 ? "api" : "user";
|
|
18
18
|
n === "api" && --r;
|
|
19
|
-
let
|
|
19
|
+
let s = i;
|
|
20
20
|
i = {
|
|
21
|
-
top:
|
|
22
|
-
left:
|
|
23
|
-
source:
|
|
24
|
-
}, t?.onScroll && a === null && (a = requestAnimationFrame(
|
|
21
|
+
top: u.scrollTop,
|
|
22
|
+
left: u.scrollLeft,
|
|
23
|
+
source: s?.source === "user" ? "user" : n
|
|
24
|
+
}, t?.onScroll && a === null && (a = requestAnimationFrame(c));
|
|
25
25
|
};
|
|
26
|
-
|
|
27
|
-
let
|
|
26
|
+
u.addEventListener("scroll", d, { passive: !0 });
|
|
27
|
+
let f = new ResizeObserver(() => {
|
|
28
28
|
t?.setViewState({
|
|
29
|
-
viewportHeight:
|
|
30
|
-
viewportWidth:
|
|
29
|
+
viewportHeight: l(u),
|
|
30
|
+
viewportWidth: u.clientWidth
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
f.observe(u), n = () => {
|
|
34
|
+
u.removeEventListener("scroll", d), a !== null && (cancelAnimationFrame(a), a = null), o !== null && (clearTimeout(o), o = null), u.classList.remove(e), f.disconnect(), s = null;
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
return {
|
|
38
38
|
update: (e) => {
|
|
39
|
+
let r = t?.footerHeight ?? 0;
|
|
39
40
|
if (t = e, n === null) {
|
|
40
41
|
let t = e.scrollContainerRef.current;
|
|
41
|
-
t &&
|
|
42
|
+
t && u(t);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
let i = e.footerHeight ?? 0;
|
|
46
|
+
if (i !== r && s) {
|
|
47
|
+
let t = s, n = i - r;
|
|
48
|
+
if (n > 0) {
|
|
49
|
+
let e = t.scrollHeight - n - t.clientHeight;
|
|
50
|
+
e > 0 && t.scrollTop >= e - 1 && (t.scrollTop = t.scrollHeight - t.clientHeight);
|
|
51
|
+
}
|
|
52
|
+
e.setViewState({ viewportHeight: l(t) });
|
|
42
53
|
}
|
|
43
54
|
},
|
|
44
55
|
markApiScroll: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../logic/chunkedLoop.cjs"),n=require("../logic/selectOptions.cjs");var r=5e4,i=[],a=new Set,o={status:`idle`,options:i,allValues:a,progress:0},s={status:`collecting`,options:i,allValues:a,progress:0},c=e=>new Set(e.map(e=>e.value)),l=e=>e===`select`||e===`set`||e===`numberSet`||e===`textSet`||e===`dateSet`,u=e=>{let t=e?.filterType??null;return t===`select`||t===`set`||t===`numberSet`||t===`textSet`||t===`dateSet`},d=(e,t,r)=>{if(!e||!u(e))return o;let i=e.filterOptions&&e.filterOptions.length>0?e.filterOptions:null;if(i)return{status:`ready`,options:i,allValues:c(i),progress:1};if(t<=5e4){let e=n.collectSelectOptions(t,r);return{status:`ready`,options:e,allValues:c(e),progress:1}}return null},f={source:null,rowCount:0,result:o},p=(e,t,n)=>e.source===n&&e.rowCount===t?e.result:s,m=()=>{let r=e.createValueStore(f),o=null,s=null,l=e=>{let{getRawValueAt:o,rowCount:l}=e,u=n.createSelectOptionsAccumulator(),d=!1
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../logic/chunkedLoop.cjs"),n=require("../logic/selectOptions.cjs");var r=5e4,i=[],a=new Set,o={status:`idle`,options:i,allValues:a,progress:0},s={status:`collecting`,options:i,allValues:a,progress:0},c=e=>new Set(e.map(e=>e.value)),l=e=>e===`select`||e===`set`||e===`numberSet`||e===`textSet`||e===`dateSet`,u=e=>{let t=e?.filterType??null;return t===`select`||t===`set`||t===`numberSet`||t===`textSet`||t===`dateSet`},d=(e,t,r)=>{if(!e||!u(e))return o;let i=e.filterOptions&&e.filterOptions.length>0?e.filterOptions:null;if(i)return{status:`ready`,options:i,allValues:c(i),progress:1};if(t<=5e4){let e=n.collectSelectOptions(t,r);return{status:`ready`,options:e,allValues:c(e),progress:1}}return null},f={source:null,rowCount:0,result:o},p=(e,t,n)=>e.source===n&&e.rowCount===t?e.result:s,m=()=>{let r=e.createValueStore(f),o=null,s=null,l=e=>{let{getRawValueAt:o,rowCount:l}=e,u=n.createSelectOptionsAccumulator(),d=!1,f=()=>{d=!0};s=f,t.runChunked(l,e=>u.collect(o(e)),{isCancelled:()=>d,onYield:(e,t)=>{r.setSnapshot({source:o,rowCount:l,result:{status:`collecting`,options:i,allValues:a,progress:e/t}})}}).then(e=>{if(s===f&&(s=null),!e)return;let t=u.finalize();r.setSnapshot({source:o,rowCount:l,result:{status:`ready`,options:t,allValues:c(t),progress:1}})})};return{update:e=>{let t=o===null||o.needsAsync!==e.needsAsync||o.rowCount!==e.rowCount||o.getRawValueAt!==e.getRawValueAt;o=e,t&&(s?.(),s=null,e.needsAsync&&l(e))},subscribe:r.subscribe,getSnapshot:r.getSnapshot,dispose:()=>{s!==null&&(s(),s=null,o=null)}}};exports.ASYNC_SELECT_COLLECT_ROW_THRESHOLD=r,exports.IDLE_SELECT_OPTIONS_RESULT=o,exports.createSelectOptionsCollector=m,exports.isSelectLikeFilterType=l,exports.resolveSyncSelectOptions=d,exports.selectCollectorResult=p;
|
|
@@ -40,10 +40,10 @@ var i = 5e4, a = [], o = /* @__PURE__ */ new Set(), s = {
|
|
|
40
40
|
result: s
|
|
41
41
|
}, m = (e, t, n) => e.source === n && e.rowCount === t ? e.result : c, h = () => {
|
|
42
42
|
let n = e(p), i = null, s = null, c = (e) => {
|
|
43
|
-
let { getRawValueAt: i, rowCount: c } = e, u = r(), d = !1
|
|
44
|
-
s = () => {
|
|
43
|
+
let { getRawValueAt: i, rowCount: c } = e, u = r(), d = !1, f = () => {
|
|
45
44
|
d = !0;
|
|
46
|
-
}
|
|
45
|
+
};
|
|
46
|
+
s = f, t(c, (e) => u.collect(i(e)), {
|
|
47
47
|
isCancelled: () => d,
|
|
48
48
|
onYield: (e, t) => {
|
|
49
49
|
n.setSnapshot({
|
|
@@ -58,7 +58,7 @@ var i = 5e4, a = [], o = /* @__PURE__ */ new Set(), s = {
|
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
}).then((e) => {
|
|
61
|
-
if (!e) return;
|
|
61
|
+
if (s === f && (s = null), !e) return;
|
|
62
62
|
let t = u.finalize();
|
|
63
63
|
n.setSnapshot({
|
|
64
64
|
source: i,
|
|
@@ -80,7 +80,7 @@ var i = 5e4, a = [], o = /* @__PURE__ */ new Set(), s = {
|
|
|
80
80
|
subscribe: n.subscribe,
|
|
81
81
|
getSnapshot: n.getSnapshot,
|
|
82
82
|
dispose: () => {
|
|
83
|
-
s
|
|
83
|
+
s !== null && (s(), s = null, i = null);
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
86
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../logic/chunkedLoop.cjs"),n=require("../logic/selectionAggregates.cjs");var r=5e4,i=20,a=e=>{if(e.target===null)return null;if(n.estimateSelectionAggregateCells(e.target)<=5e4)return n.computeSelectionAggregates(e.rowModel,e.target)},o=(e,t)=>e.rowModel===t.rowModel&&e.target===t.target,s=(e,t,r)=>e===void 0?t.ready!==null&&o(t.ready,r)||r.target!==null&&t.ready!==null&&t.ready.target===r.target?t.ready.result:n.createComputingSelectionAggregates(t.progress!==null&&t.progress.target===r.target?t.progress.progress:0):e,c=()=>{let r=e.createValueStore({ready:null,progress:null}),a=null,s=null,c=(e,o)=>{let l=n.createSelectionAggregateAccumulator(),u=o.endRow-o.startRow+1,d=!1,f=-1,p={key:e,cancel:()=>{d=!0}};s=p,t.runChunked(u,t=>{n.accumulateSelectionAggregateRow(l,e.rowModel,o.startRow+t,o.columns)},{isCancelled:()=>d,onYield:(t,n)=>{let a=Math.floor(t/n*i);a!==f&&(f=a,r.setSnapshot({...r.getSnapshot(),progress:{...e,progress:a/i}}))}}).then(t=>{if(s===p&&(s=null),!t)return;r.setSnapshot({...r.getSnapshot(),ready:{...e,result:n.finalizeSelectionAggregates(l)}});let i=a;s===null&&i!==null&&i.needsAsync&&i.target===e.target&&i.rowModel!==e.rowModel&&c({rowModel:i.rowModel,target:e.target},o)})};return{update:e=>{let t=a;a=e,!(t!==null&&t.needsAsync===e.needsAsync&&o(t,e))&&(t!==null&&t.needsAsync===e.needsAsync&&e.needsAsync&&s!==null&&s.key.target===e.target||(s?.cancel(),s=null,e.needsAsync&&e.target!==null&&c({rowModel:e.rowModel,target:e.target},e.target)))},subscribe:r.subscribe,getSnapshot:r.getSnapshot,dispose:()=>{s!==null&&(s.cancel(),s=null,a=null)}}};exports.SYNC_SELECTION_AGGREGATE_CELL_LIMIT=r,exports.createSelectionAggregatesRunner=c,exports.resolveSyncSelectionAggregates=a,exports.selectSelectionAggregatesResult=s;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { GridSelectionAggregates, RowModel } from '../model/gridTypes.unbound.js';
|
|
2
|
+
import { type SelectionAggregateTarget } from '../logic/selectionAggregates.js';
|
|
3
|
+
export declare const SYNC_SELECTION_AGGREGATE_CELL_LIMIT = 50000;
|
|
4
|
+
export type SelectionAggregatesKey<T> = {
|
|
5
|
+
rowModel: RowModel<T>;
|
|
6
|
+
target: SelectionAggregateTarget<T> | null;
|
|
7
|
+
};
|
|
8
|
+
export declare const resolveSyncSelectionAggregates: <T>(key: SelectionAggregatesKey<T>) => GridSelectionAggregates | null | undefined;
|
|
9
|
+
export type SelectionAggregatesArgs<T> = SelectionAggregatesKey<T> & {
|
|
10
|
+
needsAsync: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type SelectionAggregatesSnapshot<T> = {
|
|
13
|
+
ready: (SelectionAggregatesKey<T> & {
|
|
14
|
+
result: GridSelectionAggregates;
|
|
15
|
+
}) | null;
|
|
16
|
+
progress: (SelectionAggregatesKey<T> & {
|
|
17
|
+
progress: number;
|
|
18
|
+
}) | null;
|
|
19
|
+
};
|
|
20
|
+
export declare const selectSelectionAggregatesResult: <T>(syncResult: GridSelectionAggregates | null | undefined, snapshot: SelectionAggregatesSnapshot<T>, key: SelectionAggregatesKey<T>) => GridSelectionAggregates | null;
|
|
21
|
+
export type SelectionAggregatesRunner<T> = {
|
|
22
|
+
update: (args: SelectionAggregatesArgs<T>) => void;
|
|
23
|
+
subscribe: (listener: () => void) => () => void;
|
|
24
|
+
getSnapshot: () => SelectionAggregatesSnapshot<T>;
|
|
25
|
+
dispose: () => void;
|
|
26
|
+
};
|
|
27
|
+
export declare const createSelectionAggregatesRunner: <T>() => SelectionAggregatesRunner<T>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { createValueStore as e } from "../logic/valueStore.js";
|
|
2
|
+
import { runChunked as t } from "../logic/chunkedLoop.js";
|
|
3
|
+
import { accumulateSelectionAggregateRow as n, computeSelectionAggregates as r, createComputingSelectionAggregates as i, createSelectionAggregateAccumulator as a, estimateSelectionAggregateCells as o, finalizeSelectionAggregates as s } from "../logic/selectionAggregates.js";
|
|
4
|
+
//#region src/controllers/selectionAggregatesRunner.ts
|
|
5
|
+
var c = 5e4, l = 20, u = (e) => {
|
|
6
|
+
if (e.target === null) return null;
|
|
7
|
+
if (o(e.target) <= 5e4) return r(e.rowModel, e.target);
|
|
8
|
+
}, d = (e, t) => e.rowModel === t.rowModel && e.target === t.target, f = (e, t, n) => e === void 0 ? t.ready !== null && d(t.ready, n) || n.target !== null && t.ready !== null && t.ready.target === n.target ? t.ready.result : i(t.progress !== null && t.progress.target === n.target ? t.progress.progress : 0) : e, p = () => {
|
|
9
|
+
let r = e({
|
|
10
|
+
ready: null,
|
|
11
|
+
progress: null
|
|
12
|
+
}), i = null, o = null, c = (e, u) => {
|
|
13
|
+
let d = a(), f = u.endRow - u.startRow + 1, p = !1, m = -1, h = {
|
|
14
|
+
key: e,
|
|
15
|
+
cancel: () => {
|
|
16
|
+
p = !0;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
o = h, t(f, (t) => {
|
|
20
|
+
n(d, e.rowModel, u.startRow + t, u.columns);
|
|
21
|
+
}, {
|
|
22
|
+
isCancelled: () => p,
|
|
23
|
+
onYield: (t, n) => {
|
|
24
|
+
let i = Math.floor(t / n * l);
|
|
25
|
+
i !== m && (m = i, r.setSnapshot({
|
|
26
|
+
...r.getSnapshot(),
|
|
27
|
+
progress: {
|
|
28
|
+
...e,
|
|
29
|
+
progress: i / l
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
}).then((t) => {
|
|
34
|
+
if (o === h && (o = null), !t) return;
|
|
35
|
+
r.setSnapshot({
|
|
36
|
+
...r.getSnapshot(),
|
|
37
|
+
ready: {
|
|
38
|
+
...e,
|
|
39
|
+
result: s(d)
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
let n = i;
|
|
43
|
+
o === null && n !== null && n.needsAsync && n.target === e.target && n.rowModel !== e.rowModel && c({
|
|
44
|
+
rowModel: n.rowModel,
|
|
45
|
+
target: e.target
|
|
46
|
+
}, u);
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
update: (e) => {
|
|
51
|
+
let t = i;
|
|
52
|
+
i = e, !(t !== null && t.needsAsync === e.needsAsync && d(t, e)) && (t !== null && t.needsAsync === e.needsAsync && e.needsAsync && o !== null && o.key.target === e.target || (o?.cancel(), o = null, e.needsAsync && e.target !== null && c({
|
|
53
|
+
rowModel: e.rowModel,
|
|
54
|
+
target: e.target
|
|
55
|
+
}, e.target)));
|
|
56
|
+
},
|
|
57
|
+
subscribe: r.subscribe,
|
|
58
|
+
getSnapshot: r.getSnapshot,
|
|
59
|
+
dispose: () => {
|
|
60
|
+
o !== null && (o.cancel(), o = null, i = null);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
//#endregion
|
|
65
|
+
export { c as SYNC_SELECTION_AGGREGATE_CELL_LIMIT, p as createSelectionAggregatesRunner, u as resolveSyncSelectionAggregates, f as selectSelectionAggregatesResult };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../logic/serverSideCache.cjs"),n=require("../logic/serverSideBlocks.cjs"),r=require("../logic/serverSideEdits.cjs");var i=100,a=64,o=120,s=s=>{let c=s,l=s.dataSource?.blockSize??i,u=t.createServerSideRowCache({blockSize:l,maxBlocks:s.dataSource?.maxCachedBlocks??a}),d=r.createServerSidePendingEdits(),f=s.dataSource?.initialRowCount??0,p=null,m=null,h=s.rowKeyGetter,g=new Map,_=new Set,v=
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../logic/serverSideCache.cjs"),n=require("../logic/serverSideBlocks.cjs"),r=require("../logic/serverSideEdits.cjs");var i=100,a=64,o=120,s=s=>{let c=s,l=s.dataSource?.blockSize??i,u=t.createServerSideRowCache({blockSize:l,maxBlocks:s.dataSource?.maxCachedBlocks??a}),d=r.createServerSidePendingEdits(),f=s.dataSource?.initialRowCount??0,p=null,m=null,h=s.rowKeyGetter,g=new Map,_=new Set,v=new Set,y=null,b={start:0,end:0},x=0,S=!1,C,w=s.refreshToken,T=e=>d.getRow(e)??u.getRow(e),E=()=>({getRowCount:()=>f,getRow:e=>T(e),getSourceIndex:e=>e,getRowKey:e=>{let t=T(e);return t===void 0?e:h(t,e)}}),D=E(),O=e.createValueStore({rowModel:D,rowCount:f,loadError:p,writeError:m}),k=()=>{let e=O.getSnapshot();e.rowModel===D&&e.rowCount===f&&e.loadError===p&&e.writeError===m||O.setSnapshot({rowModel:D,rowCount:f,loadError:p,writeError:m})},A=()=>{D=E(),k()},j=()=>{x+=1,d.clear(),m=null},M=()=>{let e=_.size;p=e===0?null:{failedBlockCount:e},k()},N=()=>{for(let[,e]of g)e.abort();g.clear()},P=()=>{y!==null&&(clearTimeout(y),y=null)},F=e=>{let{dataSource:t,query:n}=c;if(t==null||u.hasBlock(e)&&!v.has(e)||g.has(e))return;let r=new AbortController;g.set(e,r);let i=e*l,a=i+l;t.getRows({startIndex:i,endIndex:a,query:n,signal:r.signal}).then(t=>{if(!r.signal.aborted&&g.get(e)===r){if(g.delete(e),u.setBlock(e,t.rows),v.delete(e),_.delete(e)&&(p=_.size===0?null:{failedBlockCount:_.size}),t.totalRowCount!==f){let n=Math.floor(f/l);t.totalRowCount>f&&f%l!==0&&n!==e&&u.hasBlock(n)&&v.add(n),f=t.totalRowCount}A()}}).catch(t=>{r.signal.aborted||g.get(e)===r&&(g.delete(e),_.add(e),M(),c.onLoadError?.(t,{startIndex:i,endIndex:a}))})},I=()=>{let{start:e,end:t}=b,r=n.computeBlockIndexes(e,t,l,f),i=new Set(r);for(let[e,t]of g)i.has(e)||(t.abort(),g.delete(e));for(let e of r)_.has(e)||F(e)},L=()=>{P(),y=setTimeout(()=>{y=null,I()},c.debounceMs??o)},R=(e,t)=>{c.dataSource!=null&&(b={start:e,end:t},u.touchBlocks(n.computeBlockIndexes(e,t,l,f)),L())},z=()=>{N(),P(),u.clear(),_.clear(),v.clear(),p=null,j()},B=()=>{if(c.dataSource==null)return;z(),A();let{start:e,end:t}=b;if(n.computeBlockIndexes(e,t,l,f).length===0){F(0);return}I()},V=()=>{if(c.dataSource==null||_.size===0)return;let e=Array.from(_);_.clear(),M();for(let t of e)F(t)},H=e=>{let t=c.dataSource?.updateRows;if(t===void 0||e.length===0)return 0;let n=r.buildServerSideRowUpdates(e,T,c.rowKeyGetter);if(n.length===0)return 0;let i=x,a=n.map(e=>({viewIndex:e.rowIndex,row:e.row,writeId:d.beginWrite(e.rowIndex,e.row)}));A();let o=n.map(e=>({rowKey:e.rowKey,columnKeys:e.changes.map(e=>e.columnKey)})),s=e=>{c.onWriteStateChange?.({state:e,cells:o})};return s(`pending`),t({updates:n}).then(e=>{if(x!==i){s(`cleared`);return}let t=e===void 0?void 0:e.rows;a.forEach((e,n)=>{u.updateRow(e.viewIndex,t?.[n]??e.row),d.settleWrite(e.viewIndex,e.writeId)}),A(),s(`ok`)}).catch(e=>{if(x!==i){s(`cleared`);return}for(let e of a)d.settleWrite(e.viewIndex,e.writeId);m={failedRowCount:n.length},c.onWriteError?.(e,{updates:n}),A(),s(`failed`)}),n.length},U=()=>{if(C!==void 0&&C===c.queryKey)return;C=c.queryKey;let{dataSource:e}=c;if(e==null)return;z();let t=!S;S=!0,A(),t?(e.initialRowCount??0)<=0&&F(0):F(0)},W=()=>{let e=c.refreshToken;if(c.dataSource==null||e===void 0){w=e;return}if(w===void 0){w=e;return}w!==e&&(w=e,B())},G=!1,K=()=>{c.dataSource!=null&&(f===0&&!u.hasBlock(0)&&F(0),b.end>b.start&&I())};return{update:e=>{c=e,e.rowKeyGetter!==h&&(h=e.rowKeyGetter,A()),U(),W(),G&&(G=!1,K())},subscribe:O.subscribe,getSnapshot:O.getSnapshot,isRowLoaded:e=>T(e)!==void 0,requestRange:R,refresh:B,retryFailedBlocks:V,applyCellEdits:H,dispose:()=>{N(),P(),x+=1,d.clear(),G=!0}}};exports.createServerSideRowModel=s;
|