@ishibashi0112/spreadsheet-grid-core 1.0.2 → 1.2.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/activeRowFollowController.cjs +1 -0
- package/dist/controllers/activeRowFollowController.d.ts +18 -0
- package/dist/controllers/activeRowFollowController.js +68 -0
- package/dist/controllers/autoHeightMeasurer.cjs +1 -1
- package/dist/controllers/autoHeightMeasurer.js +17 -17
- package/dist/controllers/clipboardController.cjs +1 -1
- package/dist/controllers/clipboardController.d.ts +4 -0
- package/dist/controllers/clipboardController.js +82 -54
- package/dist/controllers/columnAutosizeRunner.cjs +1 -1
- package/dist/controllers/columnAutosizeRunner.d.ts +1 -0
- package/dist/controllers/columnAutosizeRunner.js +17 -16
- package/dist/controllers/columnHeaderDragController.cjs +1 -1
- package/dist/controllers/columnHeaderDragController.js +169 -168
- package/dist/controllers/columnMenuController.cjs +1 -1
- package/dist/controllers/columnMenuController.js +71 -69
- package/dist/controllers/contextMenuController.cjs +1 -1
- package/dist/controllers/contextMenuController.d.ts +5 -1
- package/dist/controllers/contextMenuController.js +62 -40
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.d.ts +1 -0
- package/dist/controllers/editController.js +106 -99
- package/dist/controllers/fillHandleController.cjs +1 -1
- package/dist/controllers/fillHandleController.d.ts +1 -0
- package/dist/controllers/fillHandleController.js +157 -157
- package/dist/controllers/filterPopoverController.cjs +1 -1
- package/dist/controllers/filterPopoverController.js +6 -6
- package/dist/controllers/findController.cjs +1 -1
- package/dist/controllers/findController.d.ts +1 -0
- package/dist/controllers/findController.js +16 -15
- package/dist/controllers/historyController.cjs +1 -1
- package/dist/controllers/historyController.d.ts +6 -0
- package/dist/controllers/historyController.js +79 -37
- package/dist/controllers/imeInputController.cjs +1 -1
- package/dist/controllers/imeInputController.js +65 -54
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.d.ts +1 -0
- package/dist/controllers/keyboardController.js +46 -42
- package/dist/controllers/pointerInteractionsController.cjs +1 -1
- package/dist/controllers/pointerInteractionsController.d.ts +1 -0
- package/dist/controllers/pointerInteractionsController.js +172 -172
- package/dist/controllers/popoverSupport.cjs +1 -1
- package/dist/controllers/popoverSupport.d.ts +1 -0
- package/dist/controllers/popoverSupport.js +9 -4
- package/dist/controllers/rowDragController.cjs +1 -1
- package/dist/controllers/rowDragController.d.ts +2 -0
- package/dist/controllers/rowDragController.js +160 -146
- package/dist/controllers/scrollSyncController.cjs +1 -1
- package/dist/controllers/scrollSyncController.js +45 -43
- package/dist/controllers/serverSideRowModel.cjs +1 -1
- package/dist/controllers/serverSideRowModel.js +19 -19
- package/dist/controllers/toolPanelController.cjs +1 -1
- package/dist/controllers/toolPanelController.js +26 -14
- package/dist/controllers/tooltipController.cjs +1 -1
- package/dist/controllers/tooltipController.js +74 -72
- package/dist/controllers/viewportSyncController.cjs +1 -1
- package/dist/controllers/viewportSyncController.d.ts +4 -1
- package/dist/controllers/viewportSyncController.js +66 -28
- package/dist/engine/columnCommands.cjs +1 -1
- package/dist/engine/columnCommands.js +113 -113
- package/dist/engine/createGridEngine.cjs +3 -3
- package/dist/engine/createGridEngine.d.ts +2 -0
- package/dist/engine/createGridEngine.js +72 -70
- package/dist/engine/exportCommands.cjs +1 -1
- package/dist/engine/exportCommands.js +18 -9
- package/dist/engine/fullFeatures.cjs +1 -1
- package/dist/engine/fullFeatures.js +6 -6
- package/dist/engine/gridApi.cjs +6 -6
- package/dist/engine/gridApi.d.ts +8 -2
- package/dist/engine/gridApi.js +197 -187
- package/dist/engine/notifiers.cjs +1 -1
- package/dist/engine/notifiers.d.ts +4 -0
- package/dist/engine/notifiers.js +7 -7
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +7 -6
- package/dist/locales/en.cjs +1 -1
- package/dist/locales/en.js +5 -0
- package/dist/logic/autoScrollGeometry.cjs +1 -1
- package/dist/logic/autoScrollGeometry.d.ts +2 -0
- package/dist/logic/autoScrollGeometry.js +3 -3
- package/dist/logic/editorValues.cjs +1 -1
- package/dist/logic/editorValues.js +37 -34
- package/dist/logic/exportCsv.cjs +3 -3
- package/dist/logic/exportCsv.d.ts +4 -1
- package/dist/logic/exportCsv.js +22 -20
- package/dist/logic/exportData.cjs +1 -1
- package/dist/logic/exportData.d.ts +4 -1
- package/dist/logic/exportData.js +40 -36
- package/dist/logic/filtering.cjs +1 -1
- package/dist/logic/filtering.d.ts +2 -1
- package/dist/logic/filtering.js +16 -3
- package/dist/logic/geometry.cjs +1 -1
- package/dist/logic/geometry.d.ts +2 -0
- package/dist/logic/geometry.js +41 -20
- package/dist/logic/gridState.cjs +1 -1
- package/dist/logic/gridState.d.ts +3 -2
- package/dist/logic/gridState.js +32 -23
- package/dist/logic/groupExport.cjs +1 -1
- package/dist/logic/groupExport.js +28 -27
- package/dist/logic/grouping.cjs +1 -1
- package/dist/logic/grouping.d.ts +1 -0
- package/dist/logic/grouping.js +52 -41
- package/dist/logic/historyRebase.cjs +1 -0
- package/dist/logic/historyRebase.d.ts +5 -0
- package/dist/logic/historyRebase.js +36 -0
- package/dist/logic/imeInput.cjs +1 -1
- package/dist/logic/imeInput.js +6 -4
- package/dist/logic/localeTextFeatures.cjs +1 -1
- package/dist/logic/localeTextFeatures.d.ts +8 -0
- package/dist/logic/localeTextFeatures.js +11 -5
- package/dist/logic/localeTextPopups.cjs +1 -1
- package/dist/logic/localeTextPopups.d.ts +1 -0
- package/dist/logic/localeTextPopups.js +1 -0
- package/dist/logic/pasteFill.cjs +1 -0
- package/dist/logic/pasteFill.d.ts +2 -0
- package/dist/logic/pasteFill.js +25 -0
- package/dist/logic/selectEditorState.cjs +1 -1
- package/dist/logic/selectEditorState.d.ts +4 -1
- package/dist/logic/selectEditorState.js +14 -14
- package/dist/logic/selectLabels.cjs +1 -0
- package/dist/logic/selectLabels.d.ts +3 -0
- package/dist/logic/selectLabels.js +41 -0
- package/dist/logic/selectionAggregates.cjs +1 -1
- package/dist/logic/selectionAggregates.js +2 -3
- package/dist/logic/validation.cjs +1 -1
- package/dist/logic/validation.d.ts +1 -1
- package/dist/logic/validation.js +21 -21
- package/dist/logic/valueParsers.cjs +1 -0
- package/dist/logic/valueParsers.d.ts +14 -0
- package/dist/logic/valueParsers.js +23 -0
- package/dist/model/gridActions.cjs +1 -1
- package/dist/model/gridActions.d.ts +13 -0
- package/dist/model/gridActions.js +11 -0
- package/dist/model/gridReducer.cjs +1 -1
- package/dist/model/gridReducer.js +128 -65
- package/dist/model/gridTypes.core.d.ts +345 -43
- package/dist/utils/clipboard.cjs +4 -4
- package/dist/utils/clipboard.d.ts +14 -2
- package/dist/utils/clipboard.js +101 -49
- package/dist/utils/gridVisibleBand.cjs +1 -0
- package/dist/utils/gridVisibleBand.d.ts +4 -0
- package/dist/utils/gridVisibleBand.js +24 -0
- package/dist/utils/popupContainer.cjs +1 -0
- package/dist/utils/popupContainer.d.ts +8 -0
- package/dist/utils/popupContainer.js +60 -0
- package/dist/utils/scrollBottom.cjs +1 -0
- package/dist/utils/scrollBottom.d.ts +1 -0
- package/dist/utils/scrollBottom.js +4 -0
- package/dist/utils/topAlignedInput.cjs +1 -0
- package/dist/utils/topAlignedInput.d.ts +3 -0
- package/dist/utils/topAlignedInput.js +23 -0
- package/package.json +1 -1
|
@@ -1,17 +1,18 @@
|
|
|
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 { clampClientYAboveFooter as i,
|
|
4
|
-
import { resolveElementScale as
|
|
5
|
-
import { beginEscapeCancelableDrag as
|
|
6
|
-
import { applySlotToElement as
|
|
7
|
-
import { syncPortalTokens as
|
|
3
|
+
import { clampClientYAboveFooter as i, clampClientYBelowHeader as a, computeNextScrollPosition as o, hasPointerLeftActivationRadius as s, resolveAutoScrollAxisDirection as c, resolveScrollContentBox as l, resolveTopAutoScrollStart as u } from "../logic/autoScrollGeometry.js";
|
|
4
|
+
import { resolveElementScale as d } from "../logic/elementScale.js";
|
|
5
|
+
import { beginEscapeCancelableDrag as f } from "./escapeClaimController.js";
|
|
6
|
+
import { applySlotToElement as p } from "../logic/slotDom.js";
|
|
7
|
+
import { syncPortalTokens as m } from "../utils/portalTokens.js";
|
|
8
|
+
import { appendToPopupContainer as ee, getPopupContainerFor as h } from "../utils/popupContainer.js";
|
|
8
9
|
//#region src/controllers/rowDragController.ts
|
|
9
|
-
var
|
|
10
|
+
var g = 14, _ = 12, v = "0.5", y = "<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>", te = "<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>", ne = 200, b = "cubic-bezier(0.2, 0.7, 0.3, 1)", x = `transform 160ms ${b}`, S = "data-ssg-row-dragging", C = (e) => e?.closest(".ssg-motion-off") != null, w = /translateY\((-?[\d.]+)px\)/, T = (e) => {
|
|
10
11
|
let t = [];
|
|
11
12
|
return e.querySelectorAll(".ssg-body-row[data-row-index]").forEach((n) => {
|
|
12
13
|
r(e, n) || t.push(n);
|
|
13
14
|
}), t;
|
|
14
|
-
},
|
|
15
|
+
}, E = (e) => {
|
|
15
16
|
let t = [], n = /* @__PURE__ */ new Map();
|
|
16
17
|
return e.querySelectorAll(".ssg-detail-band[data-detail-row-index]").forEach((i) => {
|
|
17
18
|
if (r(e, i)) return;
|
|
@@ -22,22 +23,32 @@ var p = 14, m = 12, h = "0.5", g = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
22
23
|
key: `band|${o}|${a}`
|
|
23
24
|
});
|
|
24
25
|
}), t;
|
|
25
|
-
},
|
|
26
|
+
}, D = (e) => {
|
|
26
27
|
e.style.transition = "", e.style.transform = "", e.style.willChange = "", e.style.zIndex = "";
|
|
27
|
-
},
|
|
28
|
-
let
|
|
28
|
+
}, O = () => {
|
|
29
|
+
let O = null, k = null, A = null, j = null, M = (e, t) => {
|
|
30
|
+
let n = O?.canDropAt;
|
|
31
|
+
if (!n) return !0;
|
|
32
|
+
if (j !== null && j.from === e && j.slot === t) return j.allowed;
|
|
33
|
+
let r = n(e, t);
|
|
34
|
+
return j = {
|
|
35
|
+
from: e,
|
|
36
|
+
slot: t,
|
|
37
|
+
allowed: r
|
|
38
|
+
}, r;
|
|
39
|
+
}, N = {
|
|
29
40
|
x: 0,
|
|
30
41
|
y: 0
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
],
|
|
36
|
-
for (let e of
|
|
37
|
-
},
|
|
38
|
-
if (
|
|
42
|
+
}, P = null, F = !1, I = null, L = null, R = null, z = null, B = null, V = null, H = 0, U = null, W = () => O?.motion === "live", G = null, K = null, q = null, J = () => [
|
|
43
|
+
O?.leftIndicatorRef.current ?? null,
|
|
44
|
+
O?.centerIndicatorRef.current ?? null,
|
|
45
|
+
O?.rightIndicatorRef.current ?? null
|
|
46
|
+
], Y = () => {
|
|
47
|
+
for (let e of J()) e && (e.style.display = "none");
|
|
48
|
+
}, re = (e) => {
|
|
49
|
+
if (G) return;
|
|
39
50
|
let t = document.createElement("div");
|
|
40
|
-
t.setAttribute("data-grid-drag-ghost", ""),
|
|
51
|
+
t.setAttribute("data-grid-drag-ghost", ""), O?.scrollContainerRef.current?.closest(".ssg-theme-dark") != null && t.classList.add("ssg-theme-dark"), O?.scrollContainerRef.current?.closest(".ssg-theme-class") != null && t.classList.add("ssg-theme-class"), O?.scrollContainerRef.current?.closest(".ssg-motion-off") != null && t.classList.add("ssg-motion-off"), t.style.cssText = [
|
|
41
52
|
"position:fixed",
|
|
42
53
|
"top:0",
|
|
43
54
|
"left:0",
|
|
@@ -62,53 +73,53 @@ var p = 14, m = 12, h = "0.5", g = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
62
73
|
"z-index:9999",
|
|
63
74
|
"will-change:transform",
|
|
64
75
|
"transform:translate(-9999px,-9999px)"
|
|
65
|
-
].join(";"),
|
|
76
|
+
].join(";"), p(t, O?.ghostSlot);
|
|
66
77
|
let n = document.createElement("span");
|
|
67
78
|
n.style.cssText = "display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none";
|
|
68
79
|
let r = document.createElement("span");
|
|
69
|
-
r.style.cssText = "overflow:hidden;text-overflow:ellipsis", r.textContent = e, t.appendChild(n), t.appendChild(r),
|
|
70
|
-
},
|
|
71
|
-
let t =
|
|
80
|
+
r.style.cssText = "overflow:hidden;text-overflow:ellipsis", r.textContent = e, t.appendChild(n), t.appendChild(r), ee(t, h(O?.scrollContainerRef.current)), m(O?.scrollContainerRef.current, t), G = t, K = n, q = null;
|
|
81
|
+
}, ie = (e) => {
|
|
82
|
+
let t = G;
|
|
72
83
|
if (!t) return;
|
|
73
|
-
t.style.transform = "translate(" + (
|
|
84
|
+
t.style.transform = "translate(" + (N.x + g) + "px," + (N.y + _) + "px)";
|
|
74
85
|
let n = e ? "move" : "out";
|
|
75
|
-
if (
|
|
76
|
-
|
|
77
|
-
let r =
|
|
78
|
-
n === "out" ? (t.style.opacity =
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
let n =
|
|
83
|
-
!n || t && e === null || n.querySelectorAll(t ? `.ssg-body-row[data-row-index="${e}"]` : `.ssg-body-row[${
|
|
84
|
-
r(n, e) || (t ? e.setAttribute(
|
|
86
|
+
if (q === n) return;
|
|
87
|
+
q = n;
|
|
88
|
+
let r = K;
|
|
89
|
+
n === "out" ? (t.style.opacity = v, r && (r.innerHTML = te)) : (t.style.opacity = "1", r && (r.innerHTML = y));
|
|
90
|
+
}, X = () => {
|
|
91
|
+
G && G.parentNode && G.parentNode.removeChild(G), G = null, K = null, q = null;
|
|
92
|
+
}, Z = (e, t) => {
|
|
93
|
+
let n = O?.scrollContainerRef.current ?? null;
|
|
94
|
+
!n || t && e === null || n.querySelectorAll(t ? `.ssg-body-row[data-row-index="${e}"]` : `.ssg-body-row[${S}]`).forEach((e) => {
|
|
95
|
+
r(n, e) || (t ? e.setAttribute(S, W() ? "live" : "") : e.removeAttribute(S));
|
|
85
96
|
});
|
|
86
|
-
},
|
|
87
|
-
let e =
|
|
97
|
+
}, ae = () => {
|
|
98
|
+
let e = O?.scrollContainerRef.current ?? null;
|
|
88
99
|
if (!e) return null;
|
|
89
100
|
let t = /* @__PURE__ */ new Map();
|
|
90
|
-
for (let n of
|
|
91
|
-
let e =
|
|
101
|
+
for (let n of T(e)) {
|
|
102
|
+
let e = w.exec(n.style.transform);
|
|
92
103
|
e && t.set(n, {
|
|
93
104
|
index: Number(n.getAttribute("data-row-index")),
|
|
94
105
|
baseY: parseFloat(e[1])
|
|
95
106
|
});
|
|
96
107
|
}
|
|
97
108
|
return t;
|
|
98
|
-
},
|
|
99
|
-
let n =
|
|
100
|
-
if (!n || r === null ||
|
|
101
|
-
let i =
|
|
109
|
+
}, oe = (t) => {
|
|
110
|
+
let n = V, r = k;
|
|
111
|
+
if (!n || r === null || O === null) return;
|
|
112
|
+
let i = O.scrollContainerRef.current;
|
|
102
113
|
if (!i) return;
|
|
103
|
-
for (let e of
|
|
114
|
+
for (let e of T(i)) {
|
|
104
115
|
if (n.has(e)) continue;
|
|
105
|
-
let t =
|
|
116
|
+
let t = w.exec(e.style.transform);
|
|
106
117
|
t && n.set(e, {
|
|
107
118
|
index: Number(e.getAttribute("data-row-index")),
|
|
108
119
|
baseY: parseFloat(t[1])
|
|
109
120
|
});
|
|
110
121
|
}
|
|
111
|
-
let a =
|
|
122
|
+
let a = O.rowMetrics.rowsHeight(r, r), o = (i.scrollTop - H) * O.verticalScaleFactor, s = (P ? N.y - P.y : 0) + o, c = t === null ? null : e(r, t);
|
|
112
123
|
n.forEach((e, t) => {
|
|
113
124
|
let { index: i, baseY: o } = e;
|
|
114
125
|
if (!t.isConnected) {
|
|
@@ -120,166 +131,169 @@ var p = 14, m = 12, h = "0.5", g = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
120
131
|
return;
|
|
121
132
|
}
|
|
122
133
|
let l = 0;
|
|
123
|
-
c !== null && (r < i && i <= c ? l = -a : c <= i && i < r && (l = a)), t.style.transition =
|
|
134
|
+
c !== null && (r < i && i <= c ? l = -a : c <= i && i < r && (l = a)), t.style.transition = x, t.style.transform = `translateY(${o + l}px)`, e.applied = t.style.transform;
|
|
124
135
|
});
|
|
125
|
-
let l =
|
|
126
|
-
|
|
127
|
-
for (let { el: e, index: t } of
|
|
136
|
+
let l = U ?? /* @__PURE__ */ new Set();
|
|
137
|
+
U = l;
|
|
138
|
+
for (let { el: e, index: t } of E(i)) {
|
|
128
139
|
if (l.add(e), t === r) {
|
|
129
140
|
e.style.transition = "none", e.style.transform = `translateY(${s}px)`, e.style.willChange = "transform", e.style.zIndex = "10";
|
|
130
141
|
continue;
|
|
131
142
|
}
|
|
132
143
|
let n = 0;
|
|
133
|
-
c !== null && (r < t && t <= c ? n = -a : c <= t && t < r && (n = a)), e.style.transition =
|
|
144
|
+
c !== null && (r < t && t <= c ? n = -a : c <= t && t < r && (n = a)), e.style.transition = x, e.style.transform = `translateY(${n}px)`, e.style.zIndex = "";
|
|
134
145
|
}
|
|
135
|
-
},
|
|
136
|
-
if (
|
|
137
|
-
let { scrollContainerRef:
|
|
138
|
-
if (!
|
|
139
|
-
let
|
|
140
|
-
if (e <
|
|
141
|
-
let
|
|
146
|
+
}, se = (e, r) => {
|
|
147
|
+
if (O === null) return null;
|
|
148
|
+
let { scrollContainerRef: o, bodyScrollRef: s, rowMetrics: c, headerHeight: l, verticalScaleFactor: u, windowBaseOffsetPx: d } = O, f = o.current, p = s.current;
|
|
149
|
+
if (!f || !p) return null;
|
|
150
|
+
let m = f.getBoundingClientRect();
|
|
151
|
+
if (e < m.left || e > m.right || r < m.top || r > m.bottom) return null;
|
|
152
|
+
let ee = a(i(r, m.top + f.clientTop + f.clientHeight, O.footerHeight ?? 0), m.top + f.clientTop, O.stickyTopHeight ?? 0), h = p.getBoundingClientRect(), g = p.scrollTop + ee - h.top - l - f.scrollTop * (1 - u), _ = t(g, c), v = k, y = v !== null && W() ? c.detailHeight(v) : 0;
|
|
142
153
|
if (v !== null && y > 0) {
|
|
143
|
-
let e = t(g + y,
|
|
154
|
+
let e = t(g + y, c);
|
|
144
155
|
e > v + 1 && (_ = e);
|
|
145
156
|
}
|
|
146
|
-
let
|
|
157
|
+
let te = n(_, c);
|
|
147
158
|
return {
|
|
148
159
|
slot: _,
|
|
149
|
-
top:
|
|
160
|
+
top: l + te - d
|
|
150
161
|
};
|
|
151
|
-
},
|
|
152
|
-
let t =
|
|
153
|
-
if (
|
|
154
|
-
t && n !== null && (
|
|
162
|
+
}, Q = () => {
|
|
163
|
+
let t = se(N.x, N.y), n = k;
|
|
164
|
+
if (W()) {
|
|
165
|
+
t && n !== null && (e(n, t.slot) === null ? A = null : M(n, t.slot) && (A = t.slot)), Y(), oe(A);
|
|
155
166
|
return;
|
|
156
167
|
}
|
|
157
|
-
|
|
158
|
-
|
|
168
|
+
let r = t !== null && n !== null && e(n, t.slot) !== null && !M(n, t.slot);
|
|
169
|
+
if (ie(r ? null : t), !t || n === null || r || e(n, t.slot) === null) {
|
|
170
|
+
A = null, Y();
|
|
159
171
|
return;
|
|
160
172
|
}
|
|
161
|
-
|
|
162
|
-
for (let e of
|
|
163
|
-
},
|
|
164
|
-
if (
|
|
165
|
-
|
|
173
|
+
A = t.slot;
|
|
174
|
+
for (let e of J()) e && (e.style.top = `${t.top}px`, e.style.display = "block");
|
|
175
|
+
}, ce = () => {
|
|
176
|
+
if (k === null) {
|
|
177
|
+
R = null;
|
|
166
178
|
return;
|
|
167
179
|
}
|
|
168
|
-
let e =
|
|
169
|
-
if (e && (
|
|
170
|
-
let t = e.getBoundingClientRect(), n =
|
|
180
|
+
let e = O?.scrollContainerRef.current ?? null;
|
|
181
|
+
if (e && (F || (!P || s(P, N, 6)) && (F = !0), F)) {
|
|
182
|
+
let t = e.getBoundingClientRect(), n = d(e, t), r = l({
|
|
171
183
|
rectLeft: t.left,
|
|
172
184
|
rectTop: t.top,
|
|
173
185
|
clientLeft: e.clientLeft,
|
|
174
186
|
clientTop: e.clientTop,
|
|
175
187
|
clientWidth: e.clientWidth,
|
|
176
188
|
clientHeight: e.clientHeight,
|
|
177
|
-
scale:
|
|
178
|
-
}),
|
|
179
|
-
|
|
180
|
-
top:
|
|
189
|
+
scale: n
|
|
190
|
+
}), i = c(N.y, u(r.top, (O?.stickyTopHeight ?? 0) * n.y, 24), r.bottom - (O?.footerHeight ?? 0), 24), a = o(e.scrollTop, i, 18, e.scrollHeight - e.clientHeight);
|
|
191
|
+
a !== e.scrollTop && e.scrollTo({
|
|
192
|
+
top: a,
|
|
181
193
|
behavior: "auto"
|
|
182
194
|
});
|
|
183
195
|
}
|
|
184
|
-
|
|
185
|
-
},
|
|
186
|
-
let e =
|
|
196
|
+
Q(), R = requestAnimationFrame(ce);
|
|
197
|
+
}, le = (e, t) => `${e.getAttribute("data-pane") ?? ""}|${t}`, ue = () => {
|
|
198
|
+
let e = O?.scrollContainerRef.current ?? null;
|
|
187
199
|
if (!e) return null;
|
|
188
200
|
let t = /* @__PURE__ */ new Map();
|
|
189
|
-
for (let n of
|
|
190
|
-
for (let n of
|
|
201
|
+
for (let n of T(e)) t.set(le(n, Number(n.getAttribute("data-row-index"))), n.getBoundingClientRect().top);
|
|
202
|
+
for (let n of E(e)) t.set(n.key, n.el.getBoundingClientRect().top);
|
|
191
203
|
return t;
|
|
192
204
|
}, $ = (t) => {
|
|
193
|
-
|
|
194
|
-
let n =
|
|
195
|
-
|
|
196
|
-
let a = n === null || r === null ? null : e(n, r), o =
|
|
197
|
-
|
|
198
|
-
let
|
|
199
|
-
|
|
200
|
-
|
|
205
|
+
R !== null && (cancelAnimationFrame(R), R = null), document.body.style.cursor = "", Y(), X();
|
|
206
|
+
let n = k, r = A, i = B;
|
|
207
|
+
Z(n, !1), k = null, B = null, A = null, P = null, L = null;
|
|
208
|
+
let a = n === null || r === null ? null : e(n, r), o = a !== null && n !== null && r !== null && t && !M(n, r) ? null : a;
|
|
209
|
+
j = null;
|
|
210
|
+
let s = t && n !== null && o !== null && O !== null, c = V;
|
|
211
|
+
V = null;
|
|
212
|
+
let l = c && s && O !== null && !C(O.scrollContainerRef.current) ? ue() : null, u = U;
|
|
213
|
+
if (U = null, u && (s ? u.forEach(D) : (u.forEach((e) => {
|
|
214
|
+
e.isConnected && (e.style.transition = x, e.style.transform = "translateY(0px)", e.style.zIndex = "");
|
|
201
215
|
}), window.setTimeout(() => {
|
|
202
|
-
|
|
203
|
-
|
|
216
|
+
u.forEach((e) => {
|
|
217
|
+
U?.has(e) || D(e);
|
|
204
218
|
});
|
|
205
|
-
}, 200))),
|
|
219
|
+
}, 200))), c) if (s) c.forEach(({ baseY: e }, t) => {
|
|
206
220
|
t.style.transition = "", t.style.willChange = "", t.isConnected && (t.style.transform = `translateY(${e}px)`);
|
|
207
221
|
});
|
|
208
222
|
else {
|
|
209
223
|
let e = [];
|
|
210
|
-
|
|
211
|
-
n.isConnected && (n.style.transition =
|
|
224
|
+
c.forEach(({ baseY: t }, n) => {
|
|
225
|
+
n.isConnected && (n.style.transition = x, n.style.transform = `translateY(${t}px)`, e.push(n));
|
|
212
226
|
}), window.setTimeout(() => {
|
|
213
227
|
for (let t of e) t.style.transition = "", t.style.willChange = "";
|
|
214
228
|
}, 200);
|
|
215
229
|
}
|
|
216
|
-
if (!
|
|
217
|
-
let
|
|
218
|
-
tops:
|
|
230
|
+
if (!s || n === null || o === null || O === null) return;
|
|
231
|
+
let d = l ?? (C(O.scrollContainerRef.current) ? null : ue()), f = d ? {
|
|
232
|
+
tops: d,
|
|
219
233
|
from: n,
|
|
220
|
-
to:
|
|
234
|
+
to: o,
|
|
221
235
|
row: i
|
|
222
236
|
} : null;
|
|
223
|
-
|
|
224
|
-
|
|
237
|
+
z = f, O.commitRowMove(n, o), f && requestAnimationFrame(() => {
|
|
238
|
+
z === f && (z = null);
|
|
225
239
|
});
|
|
226
|
-
},
|
|
227
|
-
let e =
|
|
228
|
-
if (
|
|
229
|
-
let t =
|
|
240
|
+
}, de = () => {
|
|
241
|
+
let e = z;
|
|
242
|
+
if (z = null, !e) return;
|
|
243
|
+
let t = O?.scrollContainerRef.current ?? null;
|
|
230
244
|
if (!t) return;
|
|
231
245
|
let { tops: n, from: r, to: i } = e;
|
|
232
|
-
if (
|
|
246
|
+
if (O?.locateDragRow && e.row !== null && O.locateDragRow(e.row, i) !== i) return;
|
|
233
247
|
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();
|
|
234
|
-
|
|
235
|
-
let t = n.get(
|
|
248
|
+
T(t).forEach((e) => {
|
|
249
|
+
let t = n.get(le(e, a(Number(e.getAttribute("data-row-index")))));
|
|
236
250
|
if (t === void 0) return;
|
|
237
251
|
let r = t - e.getBoundingClientRect().top;
|
|
238
252
|
if (Math.abs(r) < .5) return;
|
|
239
|
-
let i =
|
|
253
|
+
let i = w.exec(e.style.transform);
|
|
240
254
|
if (!i) return;
|
|
241
255
|
let c = parseFloat(i[1]);
|
|
242
256
|
s.set(e, c), e.style.transition = "none", e.style.transform = `translateY(${c + r}px)`, e.style.willChange = "transform", o.push(e);
|
|
243
257
|
});
|
|
244
258
|
let c = [];
|
|
245
|
-
if (
|
|
259
|
+
if (E(t).forEach(({ el: e, index: t, key: r }) => {
|
|
246
260
|
let i = a(t), o = n.get(r.slice(0, r.lastIndexOf("|") + 1) + i);
|
|
247
261
|
if (o === void 0) return;
|
|
248
262
|
let s = o - e.getBoundingClientRect().top;
|
|
249
263
|
Math.abs(s) < .5 || (e.style.transition = "none", e.style.transform = `translateY(${s}px)`, e.style.willChange = "transform", c.push(e));
|
|
250
264
|
}), !(o.length === 0 && c.length === 0)) {
|
|
251
265
|
t.getBoundingClientRect();
|
|
252
|
-
for (let e of o) e.style.transition = `transform ${
|
|
253
|
-
for (let e of c) e.style.transition = `transform ${
|
|
266
|
+
for (let e of o) e.style.transition = `transform ${ne}ms ${b}`, e.style.transform = `translateY(${s.get(e) ?? 0}px)`;
|
|
267
|
+
for (let e of c) e.style.transition = `transform ${ne}ms ${b}`, e.style.transform = "translateY(0px)";
|
|
254
268
|
window.setTimeout(() => {
|
|
255
269
|
for (let e of o) e.style.transition = "", e.style.willChange = "";
|
|
256
|
-
for (let e of c)
|
|
270
|
+
for (let e of c) U?.has(e) || D(e);
|
|
257
271
|
}, 280);
|
|
258
272
|
}
|
|
259
|
-
},
|
|
260
|
-
if (
|
|
261
|
-
if (t.stopPropagation(), t.preventDefault(),
|
|
262
|
-
if (t.pointerId !==
|
|
263
|
-
|
|
273
|
+
}, fe = (e, t) => {
|
|
274
|
+
if (O === null || !O.enabled || t.button !== 0) return;
|
|
275
|
+
if (t.stopPropagation(), t.preventDefault(), O.gridRootRef?.current?.focus({ preventScroll: !0 }), k !== null) {
|
|
276
|
+
if (t.pointerId !== L) return;
|
|
277
|
+
I?.(), $(!1);
|
|
264
278
|
}
|
|
265
|
-
|
|
279
|
+
k = e, B = O.getDragRow?.(e) ?? null, L = t.pointerId, A = null, N = {
|
|
266
280
|
x: t.clientX,
|
|
267
281
|
y: t.clientY
|
|
268
|
-
},
|
|
282
|
+
}, P = {
|
|
269
283
|
x: t.clientX,
|
|
270
284
|
y: t.clientY
|
|
271
|
-
},
|
|
285
|
+
}, F = !1, document.body.style.cursor = "grabbing", W() ? (V = ae(), H = O.scrollContainerRef.current?.scrollTop ?? 0) : re(O.getRowDragLabel(e)), Z(e, !0);
|
|
272
286
|
let n = t.currentTarget, r = t.pointerId;
|
|
273
287
|
try {
|
|
274
288
|
n.setPointerCapture(r);
|
|
275
289
|
} catch {}
|
|
276
290
|
let i = (e) => {
|
|
277
|
-
e.pointerId === r && (
|
|
291
|
+
e.pointerId === r && (N = {
|
|
278
292
|
x: e.clientX,
|
|
279
293
|
y: e.clientY
|
|
280
|
-
},
|
|
281
|
-
}, a =
|
|
282
|
-
window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", s), window.removeEventListener("pointercancel", c), window.removeEventListener("keydown", l, !0), window.removeEventListener("blur",
|
|
294
|
+
}, Q());
|
|
295
|
+
}, a = f(), o = () => {
|
|
296
|
+
window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", s), window.removeEventListener("pointercancel", c), window.removeEventListener("keydown", l, !0), window.removeEventListener("blur", u), a(), I = null;
|
|
283
297
|
try {
|
|
284
298
|
n.releasePointerCapture(r);
|
|
285
299
|
} catch {}
|
|
@@ -293,46 +307,46 @@ var p = 14, m = 12, h = "0.5", g = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
293
307
|
function l(e) {
|
|
294
308
|
e.key === "Escape" && (o(), $(!1));
|
|
295
309
|
}
|
|
296
|
-
function
|
|
310
|
+
function u() {
|
|
297
311
|
o(), $(!1);
|
|
298
312
|
}
|
|
299
|
-
window.addEventListener("pointermove", i), window.addEventListener("pointerup", s), window.addEventListener("pointercancel", c), window.addEventListener("keydown", l, !0), window.addEventListener("blur",
|
|
300
|
-
},
|
|
301
|
-
if (
|
|
302
|
-
let t =
|
|
303
|
-
if (
|
|
313
|
+
window.addEventListener("pointermove", i), window.addEventListener("pointerup", s), window.addEventListener("pointercancel", c), window.addEventListener("keydown", l, !0), window.addEventListener("blur", u), I = o, Q(), R = requestAnimationFrame(ce);
|
|
314
|
+
}, pe = (e) => {
|
|
315
|
+
if (k === null || B == null || O?.locateDragRow === void 0) return;
|
|
316
|
+
let t = O.locateDragRow(B, k);
|
|
317
|
+
if (V && V.forEach((e, t) => {
|
|
304
318
|
if (!t.isConnected) {
|
|
305
|
-
|
|
319
|
+
V?.delete(t);
|
|
306
320
|
return;
|
|
307
321
|
}
|
|
308
322
|
let n = Number(t.getAttribute("data-row-index"));
|
|
309
323
|
if (n === e.index && (e.applied === void 0 || t.style.transform === e.applied)) return;
|
|
310
|
-
let r =
|
|
324
|
+
let r = w.exec(t.style.transform);
|
|
311
325
|
if (!r) {
|
|
312
|
-
|
|
326
|
+
V?.delete(t);
|
|
313
327
|
return;
|
|
314
328
|
}
|
|
315
329
|
e.index = n, e.baseY = parseFloat(r[1]), e.applied = void 0;
|
|
316
330
|
}), t === null) {
|
|
317
|
-
|
|
331
|
+
I?.(), $(!1);
|
|
318
332
|
return;
|
|
319
333
|
}
|
|
320
|
-
|
|
321
|
-
x:
|
|
322
|
-
y:
|
|
323
|
-
}), t !==
|
|
334
|
+
V && t !== k && P !== null && e !== null && (P = {
|
|
335
|
+
x: P.x,
|
|
336
|
+
y: P.y + O.rowMetrics.rowTop(t) - e.rowTop(k)
|
|
337
|
+
}), t !== k && (Z(null, !1), k = t, Z(t, !0)), Q();
|
|
324
338
|
};
|
|
325
339
|
return {
|
|
326
340
|
update: (e) => {
|
|
327
|
-
let t =
|
|
328
|
-
|
|
341
|
+
let t = O;
|
|
342
|
+
O = e, t?.canDropAt !== e.canDropAt && (j = null), k !== null && t !== null && t.locateDragRow !== e.locateDragRow && pe(t.rowMetrics);
|
|
329
343
|
},
|
|
330
|
-
onRowDragHandlePointerDown:
|
|
331
|
-
applyReorderSettle:
|
|
344
|
+
onRowDragHandlePointerDown: fe,
|
|
345
|
+
applyReorderSettle: de,
|
|
332
346
|
dispose: () => {
|
|
333
|
-
|
|
347
|
+
I?.(), I = null, R !== null && (cancelAnimationFrame(R), R = null), document.body.style.cursor = "", X(), Z(k, !1), k = null, B = null, A = null, j = null, V = null, U?.forEach(D), U = null, z = null;
|
|
334
348
|
}
|
|
335
349
|
};
|
|
336
350
|
};
|
|
337
351
|
//#endregion
|
|
338
|
-
export {
|
|
352
|
+
export { O as createRowDragController };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/scrollBottom.cjs");var t=`ssg-scroll-container--scrolling`,n=120,r=()=>{let n=null,r=null,i=!1,a=null,o=null,s=null,c=null,l=()=>{o=null;let e=a;a=null,e&&n?.onScroll?.(e)},u=e=>Math.max(e.clientHeight-(n?.footerHeight??0),0),d=d=>{c=d,n?.setViewState({scrollTop:d.scrollTop,viewportHeight:u(d),viewportWidth:d.clientWidth});let f=()=>{n?.setViewState({scrollTop:d.scrollTop}),d.classList.add(t),s!==null&&clearTimeout(s),s=setTimeout(()=>{s=null,d.classList.remove(t)},120);let r=i?`api`:`user`;i=!1;let c=a;a={top:d.scrollTop,left:d.scrollLeft,source:c?.source===`user`?`user`:r,atBottom:e.isScrolledToBottom(d)},n?.onScroll&&o===null&&(o=requestAnimationFrame(l))};d.addEventListener(`scroll`,f,{passive:!0});let p=null,m=new ResizeObserver(()=>{p??=requestAnimationFrame(()=>{p=null,d.clientWidth!==0&&n?.setViewState({viewportHeight:u(d),viewportWidth:d.clientWidth})})});m.observe(d),r=()=>{d.removeEventListener(`scroll`,f),o!==null&&(cancelAnimationFrame(o),o=null),s!==null&&(clearTimeout(s),s=null),d.classList.remove(t),m.disconnect(),p!==null&&cancelAnimationFrame(p),c=null}};return{update:e=>{let t=n?.footerHeight??0;if(n=e,r===null){let t=e.scrollContainerRef.current;t&&d(t);return}let i=e.footerHeight??0;if(i!==t&&c?.clientWidth){let n=c,r=i-t;if(r>0){let e=n.scrollHeight-r-n.clientHeight;e>0&&n.scrollTop>=e-1&&(n.scrollTop=n.scrollHeight-n.clientHeight)}e.setViewState({viewportHeight:u(n)})}},markApiScroll:()=>{let e=i;return i=!0,()=>{i=e}},dispose:()=>{r?.(),r=null}}};exports.SCROLLING_CLASS_NAME=t,exports.SCROLLING_IDLE_MS=n,exports.createScrollSyncController=r;
|
|
@@ -1,69 +1,71 @@
|
|
|
1
|
+
import { isScrolledToBottom as e } from "../utils/scrollBottom.js";
|
|
1
2
|
//#region src/controllers/scrollSyncController.ts
|
|
2
|
-
var
|
|
3
|
-
let
|
|
4
|
-
|
|
5
|
-
let e =
|
|
6
|
-
|
|
7
|
-
},
|
|
8
|
-
|
|
9
|
-
scrollTop:
|
|
10
|
-
viewportHeight:
|
|
11
|
-
viewportWidth:
|
|
3
|
+
var t = "ssg-scroll-container--scrolling", n = 120, r = () => {
|
|
4
|
+
let n = null, r = null, i = !1, a = null, o = null, s = null, c = null, l = () => {
|
|
5
|
+
o = null;
|
|
6
|
+
let e = a;
|
|
7
|
+
a = null, e && n?.onScroll?.(e);
|
|
8
|
+
}, u = (e) => Math.max(e.clientHeight - (n?.footerHeight ?? 0), 0), d = (d) => {
|
|
9
|
+
c = d, n?.setViewState({
|
|
10
|
+
scrollTop: d.scrollTop,
|
|
11
|
+
viewportHeight: u(d),
|
|
12
|
+
viewportWidth: d.clientWidth
|
|
12
13
|
});
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
let f = () => {
|
|
15
|
+
n?.setViewState({ scrollTop: d.scrollTop }), d.classList.add(t), s !== null && clearTimeout(s), s = setTimeout(() => {
|
|
16
|
+
s = null, d.classList.remove(t);
|
|
16
17
|
}, 120);
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
top:
|
|
22
|
-
left:
|
|
23
|
-
source:
|
|
24
|
-
|
|
18
|
+
let r = i ? "api" : "user";
|
|
19
|
+
i = !1;
|
|
20
|
+
let c = a;
|
|
21
|
+
a = {
|
|
22
|
+
top: d.scrollTop,
|
|
23
|
+
left: d.scrollLeft,
|
|
24
|
+
source: c?.source === "user" ? "user" : r,
|
|
25
|
+
atBottom: e(d)
|
|
26
|
+
}, n?.onScroll && o === null && (o = requestAnimationFrame(l));
|
|
25
27
|
};
|
|
26
|
-
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
viewportHeight:
|
|
31
|
-
viewportWidth:
|
|
28
|
+
d.addEventListener("scroll", f, { passive: !0 });
|
|
29
|
+
let p = null, m = new ResizeObserver(() => {
|
|
30
|
+
p ??= requestAnimationFrame(() => {
|
|
31
|
+
p = null, d.clientWidth !== 0 && n?.setViewState({
|
|
32
|
+
viewportHeight: u(d),
|
|
33
|
+
viewportWidth: d.clientWidth
|
|
32
34
|
});
|
|
33
35
|
});
|
|
34
36
|
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
m.observe(d), r = () => {
|
|
38
|
+
d.removeEventListener("scroll", f), o !== null && (cancelAnimationFrame(o), o = null), s !== null && (clearTimeout(s), s = null), d.classList.remove(t), m.disconnect(), p !== null && cancelAnimationFrame(p), c = null;
|
|
37
39
|
};
|
|
38
40
|
};
|
|
39
41
|
return {
|
|
40
42
|
update: (e) => {
|
|
41
|
-
let
|
|
42
|
-
if (
|
|
43
|
+
let t = n?.footerHeight ?? 0;
|
|
44
|
+
if (n = e, r === null) {
|
|
43
45
|
let t = e.scrollContainerRef.current;
|
|
44
|
-
t &&
|
|
46
|
+
t && d(t);
|
|
45
47
|
return;
|
|
46
48
|
}
|
|
47
49
|
let i = e.footerHeight ?? 0;
|
|
48
|
-
if (i !==
|
|
49
|
-
let
|
|
50
|
-
if (
|
|
51
|
-
let e =
|
|
52
|
-
e > 0 &&
|
|
50
|
+
if (i !== t && c?.clientWidth) {
|
|
51
|
+
let n = c, r = i - t;
|
|
52
|
+
if (r > 0) {
|
|
53
|
+
let e = n.scrollHeight - r - n.clientHeight;
|
|
54
|
+
e > 0 && n.scrollTop >= e - 1 && (n.scrollTop = n.scrollHeight - n.clientHeight);
|
|
53
55
|
}
|
|
54
|
-
e.setViewState({ viewportHeight:
|
|
56
|
+
e.setViewState({ viewportHeight: u(n) });
|
|
55
57
|
}
|
|
56
58
|
},
|
|
57
59
|
markApiScroll: () => {
|
|
58
|
-
let e =
|
|
59
|
-
return
|
|
60
|
-
|
|
60
|
+
let e = i;
|
|
61
|
+
return i = !0, () => {
|
|
62
|
+
i = e;
|
|
61
63
|
};
|
|
62
64
|
},
|
|
63
65
|
dispose: () => {
|
|
64
|
-
|
|
66
|
+
r?.(), r = null;
|
|
65
67
|
}
|
|
66
68
|
};
|
|
67
69
|
};
|
|
68
70
|
//#endregion
|
|
69
|
-
export {
|
|
71
|
+
export { t as SCROLLING_CLASS_NAME, n as SCROLLING_IDLE_MS, r as createScrollSyncController };
|