@ishibashi0112/spreadsheet-grid-core 1.0.1 → 1.1.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 -2
- package/dist/controllers/clipboardController.d.ts +3 -0
- package/dist/controllers/clipboardController.js +78 -59
- package/dist/controllers/columnAutosizeRunner.cjs +1 -1
- package/dist/controllers/columnAutosizeRunner.d.ts +3 -1
- package/dist/controllers/columnAutosizeRunner.js +12 -10
- package/dist/controllers/columnHeaderDragController.cjs +1 -1
- package/dist/controllers/columnHeaderDragController.js +146 -140
- 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 +4 -1
- package/dist/controllers/contextMenuController.js +55 -38
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.js +78 -78
- package/dist/controllers/escapeClaimController.cjs +1 -1
- package/dist/controllers/escapeClaimController.d.ts +1 -0
- package/dist/controllers/escapeClaimController.js +11 -5
- package/dist/controllers/fillHandleController.cjs +1 -1
- package/dist/controllers/fillHandleController.d.ts +1 -0
- package/dist/controllers/fillHandleController.js +148 -147
- package/dist/controllers/filterPopoverController.cjs +1 -1
- package/dist/controllers/filterPopoverController.js +81 -77
- package/dist/controllers/findController.cjs +1 -1
- package/dist/controllers/findController.d.ts +1 -0
- package/dist/controllers/findController.js +36 -29
- 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/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.d.ts +1 -0
- package/dist/controllers/keyboardController.js +116 -116
- package/dist/controllers/pointerInteractionsController.cjs +1 -1
- package/dist/controllers/pointerInteractionsController.d.ts +1 -0
- package/dist/controllers/pointerInteractionsController.js +142 -142
- package/dist/controllers/popoverSupport.cjs +1 -1
- package/dist/controllers/popoverSupport.d.ts +1 -0
- package/dist/controllers/popoverSupport.js +17 -7
- package/dist/controllers/rowDragController.cjs +1 -1
- package/dist/controllers/rowDragController.d.ts +1 -0
- package/dist/controllers/rowDragController.js +151 -149
- package/dist/controllers/rowEnterController.cjs +1 -1
- package/dist/controllers/rowEnterController.d.ts +1 -0
- package/dist/controllers/rowEnterController.js +47 -42
- 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 +85 -66
- package/dist/controllers/viewportSyncController.cjs +1 -1
- package/dist/controllers/viewportSyncController.d.ts +4 -1
- package/dist/controllers/viewportSyncController.js +89 -30
- package/dist/engine/exportCommands.cjs +1 -1
- package/dist/engine/exportCommands.js +16 -9
- package/dist/engine/filterPopoverCommands.cjs +1 -1
- package/dist/engine/filterPopoverCommands.d.ts +2 -0
- package/dist/engine/filterPopoverCommands.js +15 -15
- package/dist/engine/fullFeatures.cjs +1 -1
- package/dist/engine/fullFeatures.js +17 -17
- package/dist/engine/gridApi.cjs +3 -3
- package/dist/engine/gridApi.d.ts +7 -2
- package/dist/engine/gridApi.js +16 -16
- package/dist/engine/rowSelectionCommands.cjs +1 -1
- package/dist/engine/rowSelectionCommands.d.ts +1 -0
- package/dist/engine/rowSelectionCommands.js +21 -12
- 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 +10 -4
- 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/columnAutosize.cjs +1 -1
- package/dist/logic/columnAutosize.d.ts +8 -2
- package/dist/logic/columnAutosize.js +102 -87
- package/dist/logic/detailRow.cjs +1 -1
- package/dist/logic/detailRow.d.ts +4 -0
- package/dist/logic/detailRow.js +18 -15
- package/dist/logic/editorValues.cjs +1 -1
- package/dist/logic/editorValues.d.ts +1 -0
- package/dist/logic/editorValues.js +37 -34
- package/dist/logic/exportCsv.cjs +3 -3
- package/dist/logic/exportCsv.d.ts +3 -1
- package/dist/logic/exportCsv.js +22 -20
- package/dist/logic/exportData.cjs +1 -1
- package/dist/logic/exportData.d.ts +3 -1
- package/dist/logic/exportData.js +40 -36
- package/dist/logic/filterSummary.cjs +1 -1
- package/dist/logic/filterSummary.js +9 -2
- 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/find.cjs +1 -1
- package/dist/logic/find.d.ts +4 -3
- package/dist/logic/find.js +27 -13
- package/dist/logic/gridAsk.cjs +2 -2
- package/dist/logic/gridAsk.d.ts +7 -7
- package/dist/logic/gridAsk.js +140 -122
- package/dist/logic/gridAskLocaleText.cjs +1 -1
- package/dist/logic/gridAskLocaleText.d.ts +2 -0
- package/dist/logic/gridAskLocaleText.js +1 -0
- package/dist/logic/gridState.d.ts +2 -2
- 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/localeText.cjs +1 -1
- package/dist/logic/localeText.d.ts +2 -0
- package/dist/logic/localeText.js +1 -0
- package/dist/logic/localeTextFeatures.cjs +1 -1
- package/dist/logic/localeTextFeatures.d.ts +4 -0
- package/dist/logic/localeTextFeatures.js +10 -7
- package/dist/logic/localeTextFilters.cjs +1 -1
- package/dist/logic/localeTextFilters.d.ts +1 -0
- package/dist/logic/localeTextFilters.js +1 -0
- package/dist/logic/localeTextPopups.cjs +1 -1
- package/dist/logic/localeTextPopups.d.ts +1 -0
- package/dist/logic/localeTextPopups.js +3 -2
- package/dist/logic/numberFilterCondition.cjs +1 -1
- package/dist/logic/numberFilterCondition.d.ts +1 -1
- package/dist/logic/numberFilterCondition.js +5 -5
- package/dist/logic/scrollTargets.cjs +1 -1
- package/dist/logic/scrollTargets.js +2 -2
- package/dist/logic/selectEditorState.cjs +1 -1
- package/dist/logic/selectEditorState.d.ts +1 -0
- package/dist/logic/selectEditorState.js +8 -1
- 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/valueFormatters.d.ts +5 -5
- package/dist/logic/valueParsers.cjs +1 -0
- package/dist/logic/valueParsers.d.ts +14 -0
- package/dist/logic/valueParsers.js +23 -0
- package/dist/logic/verticalGeometry.cjs +1 -1
- package/dist/logic/verticalGeometry.d.ts +1 -0
- package/dist/logic/verticalGeometry.js +12 -8
- package/dist/model/gridActions.cjs +1 -1
- package/dist/model/gridActions.d.ts +2 -1
- package/dist/model/gridActions.js +3 -2
- package/dist/model/gridReducer.cjs +1 -1
- package/dist/model/gridReducer.js +145 -62
- package/dist/model/gridTypes.core.d.ts +492 -315
- package/dist/utils/clipboard.cjs +4 -6
- package/dist/utils/clipboard.d.ts +15 -2
- package/dist/utils/clipboard.js +103 -48
- package/dist/utils/popupContainer.cjs +1 -0
- package/dist/utils/popupContainer.d.ts +8 -0
- package/dist/utils/popupContainer.js +60 -0
- package/package.json +1 -1
|
@@ -2,78 +2,78 @@ import { nextSortEntries as e } from "../logic/sorting.js";
|
|
|
2
2
|
import { isSyntheticColumnKey as t } from "../logic/detailRow.js";
|
|
3
3
|
import { gridActions as n } from "../model/gridActions.js";
|
|
4
4
|
import { clamp as r, findLogicalIndexFromPaneOffset as i } from "../logic/geometry.js";
|
|
5
|
-
import { clampClientYAboveFooter as a,
|
|
6
|
-
import { resolveElementScale as
|
|
7
|
-
import { clientYToRowIndex as
|
|
5
|
+
import { clampClientYAboveFooter as a, clampClientYBelowHeader as o, computeNextScrollPosition as s, hasPointerLeftActivationRadius as c, resolveAutoScrollAxisDirection as l, resolveScrollContentBox as u, resolveTopAutoScrollStart as d } from "../logic/autoScrollGeometry.js";
|
|
6
|
+
import { resolveElementScale as f } from "../logic/elementScale.js";
|
|
7
|
+
import { clientYToRowIndex as p } from "../logic/verticalGeometry.js";
|
|
8
8
|
//#region src/controllers/pointerInteractionsController.ts
|
|
9
|
-
var
|
|
10
|
-
let
|
|
11
|
-
let t =
|
|
12
|
-
if (t <= 0 || !
|
|
13
|
-
let
|
|
14
|
-
return a(e,
|
|
15
|
-
},
|
|
16
|
-
if (
|
|
17
|
-
let { bodyScrollRef: n, scrollContainerRef: a, leftPaneScrollRef: o, rightPaneScrollRef: s, filteredRowsLength: c, visibleColumnsLength: l, paneLayout:
|
|
9
|
+
var m = 10, h = 300, g = () => {
|
|
10
|
+
let m = null, h = !1, g = !1, _ = null, v = null, y = "mouse", b = null, x = null, S = !1, C = !1, w = () => m?.uiState.dragState ?? null, T = null, E = (e) => {
|
|
11
|
+
let t = m?.footerHeight ?? 0, n = m?.stickyTopHeight ?? 0, r = m?.scrollContainerRef.current ?? null;
|
|
12
|
+
if (t <= 0 && n <= 0 || !r) return e;
|
|
13
|
+
let i = r.getBoundingClientRect(), s = f(r, i);
|
|
14
|
+
return o(a(e, i.top + (r.clientTop + r.clientHeight) * s.y, t * s.y), i.top + r.clientTop * s.y, n * s.y);
|
|
15
|
+
}, D = (e, t) => {
|
|
16
|
+
if (m === null) return null;
|
|
17
|
+
let { bodyScrollRef: n, scrollContainerRef: a, leftPaneScrollRef: o, rightPaneScrollRef: s, filteredRowsLength: c, visibleColumnsLength: l, paneLayout: u, leftLeadingWidth: d, centerLeadingWidth: h, rightLeadingWidth: g, headerHeight: _, rowMetrics: v, verticalScaleFactor: y } = m, b = n.current;
|
|
18
18
|
if (!b || c === 0 || l === 0) return null;
|
|
19
|
-
let x = b.getBoundingClientRect(), S =
|
|
20
|
-
if (
|
|
21
|
-
let t =
|
|
19
|
+
let x = b.getBoundingClientRect(), S = f(b, x), C = p(b.scrollTop + (E(t) - x.top) / S.y - _, a.current?.scrollTop ?? 0, y, v), w = null, T = o.current;
|
|
20
|
+
if (w === null && T && u.left.entries.length > 0) {
|
|
21
|
+
let t = T.getBoundingClientRect();
|
|
22
22
|
if (e < t.right) {
|
|
23
|
-
let n = (e - t.left) / S.x -
|
|
24
|
-
|
|
23
|
+
let n = (e - t.left) / S.x - d;
|
|
24
|
+
w = i(u.left, n);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
let D = s.current;
|
|
28
|
-
if (
|
|
28
|
+
if (w === null && D && u.right.entries.length > 0) {
|
|
29
29
|
let t = D.getBoundingClientRect();
|
|
30
30
|
if (e >= t.left) {
|
|
31
31
|
let n = (e - t.left) / S.x - g;
|
|
32
|
-
|
|
32
|
+
w = i(u.right, n);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
if (
|
|
36
|
-
let t =
|
|
37
|
-
|
|
35
|
+
if (w === null && u.center.entries.length > 0) {
|
|
36
|
+
let t = T && u.left.entries.length === 0 ? Math.max(e, T.getBoundingClientRect().left + d * S.x) : e, n = b.scrollLeft + (t - x.left) / S.x - h;
|
|
37
|
+
w = i(u.center, Math.max(n, 0));
|
|
38
38
|
}
|
|
39
|
-
return
|
|
39
|
+
return w === null ? null : {
|
|
40
40
|
row: C,
|
|
41
|
-
col: r(
|
|
41
|
+
col: r(w, 0, l - 1)
|
|
42
42
|
};
|
|
43
|
-
},
|
|
44
|
-
let r =
|
|
45
|
-
if (
|
|
46
|
-
let i =
|
|
43
|
+
}, O = (e, t) => {
|
|
44
|
+
let r = w();
|
|
45
|
+
if (m === null || !r || r.type !== "selection") return;
|
|
46
|
+
let i = D(e, t);
|
|
47
47
|
if (i) {
|
|
48
48
|
if (r.selectionKind === "cell") {
|
|
49
|
-
|
|
49
|
+
m.dispatch(n.updateSelection(i));
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
if (r.selectionKind === "row") {
|
|
53
|
-
|
|
53
|
+
m.dispatch(n.updateRowSelection(i.row));
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
|
-
r.selectionKind === "col" &&
|
|
56
|
+
r.selectionKind === "col" && m.dispatch(n.updateColumnSelection(i.col));
|
|
57
57
|
}
|
|
58
|
-
},
|
|
58
|
+
}, k = (e, t) => {
|
|
59
59
|
let r = t.timeStamp;
|
|
60
|
-
if (
|
|
61
|
-
let { gridRootRef: i, dispatch: a, enableRangeSelection: o, enableRowSelection: s, onGutterRowSelect: c, onCellDoubleClickRef: l, resolveFirstDataCell: u } =
|
|
60
|
+
if (m === null) return;
|
|
61
|
+
let { gridRootRef: i, dispatch: a, enableRangeSelection: o, enableRowSelection: s, onGutterRowSelect: c, onCellDoubleClickRef: l, resolveFirstDataCell: u } = m;
|
|
62
62
|
i.current?.focus({ preventScroll: !0 });
|
|
63
63
|
let { target: d } = e;
|
|
64
64
|
if (d.kind === "cell") {
|
|
65
|
-
let e =
|
|
65
|
+
let e = v;
|
|
66
66
|
if (e && e.cell.row === d.cell.row && e.cell.col === d.cell.col && r - e.time < 300) {
|
|
67
|
-
|
|
67
|
+
v = null, l.current(d.cell, t);
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
v = {
|
|
71
71
|
cell: d.cell,
|
|
72
72
|
time: r
|
|
73
73
|
}, a(n.activateCell(d.cell)), o && (a(n.startSelection(d.cell)), a(n.endSelection()));
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
if (
|
|
76
|
+
if (v = null, d.kind === "row") {
|
|
77
77
|
if (s) {
|
|
78
78
|
c(d.rowIndex, { shiftKey: !1 });
|
|
79
79
|
return;
|
|
@@ -82,217 +82,217 @@ var f = 10, p = 300, m = () => {
|
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
84
|
a(n.startColumnSelection(d.colIndex, u?.().row)), a(n.endSelection());
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
-
if (
|
|
89
|
-
|
|
85
|
+
}, A = () => {
|
|
86
|
+
m !== null && (g = !1, m.dispatch(n.endSelection()), m.dispatch(n.endColumnResize()));
|
|
87
|
+
}, j = (e) => {
|
|
88
|
+
if (m === null) return;
|
|
89
|
+
m.pointerClientRef.current = {
|
|
90
90
|
x: e.clientX,
|
|
91
91
|
y: e.clientY
|
|
92
92
|
};
|
|
93
|
-
let t =
|
|
93
|
+
let t = w();
|
|
94
94
|
if (t?.type === "columnResize") {
|
|
95
|
-
(
|
|
95
|
+
(T === null || T.drag !== t) && (T = {
|
|
96
96
|
drag: t,
|
|
97
|
-
x:
|
|
97
|
+
x: f(m.scrollContainerRef.current).x
|
|
98
98
|
});
|
|
99
|
-
let r =
|
|
100
|
-
|
|
99
|
+
let r = T.x === 1 ? e.clientX : t.startX + (e.clientX - t.startX) / T.x;
|
|
100
|
+
m.dispatch(n.updateColumnResize(r));
|
|
101
101
|
}
|
|
102
|
-
},
|
|
103
|
-
let t =
|
|
104
|
-
t && (
|
|
105
|
-
}, j = () => {
|
|
106
|
-
h = null, O();
|
|
107
|
-
}, M = () => {
|
|
108
|
-
p || (p = !0, window.addEventListener("pointermove", k), window.addEventListener("pointerup", A), window.addEventListener("pointercancel", j));
|
|
102
|
+
}, M = (e) => {
|
|
103
|
+
let t = _;
|
|
104
|
+
t && (_ = null, e.pointerId === t.pointerId && Math.abs(e.clientX - t.x) < 10 && Math.abs(e.clientY - t.y) < 10 && k(t, e)), A();
|
|
109
105
|
}, N = () => {
|
|
110
|
-
|
|
106
|
+
_ = null, A();
|
|
111
107
|
}, P = () => {
|
|
112
|
-
|
|
108
|
+
h || (h = !0, window.addEventListener("pointermove", j), window.addEventListener("pointerup", M), window.addEventListener("pointercancel", N));
|
|
113
109
|
}, F = () => {
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
h && (h = !1, window.removeEventListener("pointermove", j), window.removeEventListener("pointerup", M), window.removeEventListener("pointercancel", N));
|
|
111
|
+
}, I = () => {
|
|
112
|
+
C = !1, m !== null && m.autoScrollFrameRef.current !== null && (cancelAnimationFrame(m.autoScrollFrameRef.current), m.autoScrollFrameRef.current = null);
|
|
113
|
+
}, L = () => {
|
|
114
|
+
if (m === null || !C) return;
|
|
115
|
+
let { scrollContainerRef: e, pointerClientRef: t, autoScrollFrameRef: n } = m, r = e.current, i = t.current;
|
|
116
116
|
if (!r || !i) {
|
|
117
|
-
n.current = requestAnimationFrame(
|
|
117
|
+
n.current = requestAnimationFrame(L);
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
|
-
if (!
|
|
121
|
-
let e =
|
|
122
|
-
if (e && !
|
|
123
|
-
n.current = requestAnimationFrame(
|
|
120
|
+
if (!S) {
|
|
121
|
+
let e = x;
|
|
122
|
+
if (e && !c(e, i, 6)) {
|
|
123
|
+
n.current = requestAnimationFrame(L);
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
126
|
-
|
|
126
|
+
S = !0;
|
|
127
127
|
}
|
|
128
|
-
let a = r.getBoundingClientRect(),
|
|
128
|
+
let a = r.getBoundingClientRect(), o = f(r, a), p = u({
|
|
129
129
|
rectLeft: a.left,
|
|
130
130
|
rectTop: a.top,
|
|
131
131
|
clientLeft: r.clientLeft,
|
|
132
132
|
clientTop: r.clientTop,
|
|
133
133
|
clientWidth: r.clientWidth,
|
|
134
134
|
clientHeight: r.clientHeight,
|
|
135
|
-
scale:
|
|
136
|
-
}),
|
|
137
|
-
(
|
|
138
|
-
top:
|
|
139
|
-
left:
|
|
135
|
+
scale: o
|
|
136
|
+
}), h = w(), g = h?.type === "selection" && h.selectionKind === "col", _ = h?.type === "selection" && h.selectionKind === "row", v = g ? 0 : l(i.y, d(p.top, (m.stickyTopHeight ?? 0) * o.y, 24), p.bottom - (m.footerHeight ?? 0), 24), y = _ ? 0 : l(i.x, p.left, p.right, 24), b = s(r.scrollTop, v, 18, r.scrollHeight - r.clientHeight), T = s(r.scrollLeft, y, 18, r.scrollWidth - r.clientWidth);
|
|
137
|
+
(b !== r.scrollTop || T !== r.scrollLeft) && (r.scrollTo({
|
|
138
|
+
top: b,
|
|
139
|
+
left: T,
|
|
140
140
|
behavior: "auto"
|
|
141
|
-
}),
|
|
142
|
-
},
|
|
143
|
-
let e =
|
|
144
|
-
e && !
|
|
145
|
-
},
|
|
146
|
-
if (
|
|
141
|
+
}), O(i.x, i.y)), n.current = requestAnimationFrame(L);
|
|
142
|
+
}, R = () => {
|
|
143
|
+
let e = w()?.type === "selection";
|
|
144
|
+
e && !C ? (C = !0, m !== null && (m.autoScrollFrameRef.current = requestAnimationFrame(L))) : !e && C && I();
|
|
145
|
+
}, z = () => {
|
|
146
|
+
if (b !== null) return;
|
|
147
147
|
let e = () => {
|
|
148
|
-
if (!
|
|
149
|
-
|
|
148
|
+
if (!g || m === null) {
|
|
149
|
+
b = null;
|
|
150
150
|
return;
|
|
151
151
|
}
|
|
152
|
-
let { scrollContainerRef: t, pointerClientRef: n, onGutterRowSelectDrag: r } =
|
|
152
|
+
let { scrollContainerRef: t, pointerClientRef: n, onGutterRowSelectDrag: r } = m, i = t.current, a = n.current;
|
|
153
153
|
if (!i || !a) {
|
|
154
|
-
|
|
154
|
+
b = requestAnimationFrame(e);
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
|
-
if (!
|
|
158
|
-
let t =
|
|
159
|
-
if (t && !
|
|
160
|
-
|
|
157
|
+
if (!S) {
|
|
158
|
+
let t = x;
|
|
159
|
+
if (t && !c(t, a, 6)) {
|
|
160
|
+
b = requestAnimationFrame(e);
|
|
161
161
|
return;
|
|
162
162
|
}
|
|
163
|
-
|
|
163
|
+
S = !0;
|
|
164
164
|
}
|
|
165
|
-
let
|
|
166
|
-
rectLeft:
|
|
167
|
-
rectTop:
|
|
165
|
+
let o = i.getBoundingClientRect(), p = f(i, o), h = u({
|
|
166
|
+
rectLeft: o.left,
|
|
167
|
+
rectTop: o.top,
|
|
168
168
|
clientLeft: i.clientLeft,
|
|
169
169
|
clientTop: i.clientTop,
|
|
170
170
|
clientWidth: i.clientWidth,
|
|
171
171
|
clientHeight: i.clientHeight,
|
|
172
|
-
scale:
|
|
173
|
-
}),
|
|
174
|
-
if (
|
|
172
|
+
scale: p
|
|
173
|
+
}), _ = l(a.y, d(h.top, (m.stickyTopHeight ?? 0) * p.y, 24), h.bottom - (m.footerHeight ?? 0), 24), v = s(i.scrollTop, _, 18, i.scrollHeight - i.clientHeight);
|
|
174
|
+
if (v !== i.scrollTop) {
|
|
175
175
|
i.scrollTo({
|
|
176
|
-
top:
|
|
176
|
+
top: v,
|
|
177
177
|
left: i.scrollLeft,
|
|
178
178
|
behavior: "auto"
|
|
179
179
|
});
|
|
180
|
-
let e =
|
|
180
|
+
let e = D(a.x, a.y);
|
|
181
181
|
e && r(e.row);
|
|
182
182
|
}
|
|
183
|
-
|
|
183
|
+
b = requestAnimationFrame(e);
|
|
184
184
|
};
|
|
185
|
-
|
|
186
|
-
},
|
|
185
|
+
b = requestAnimationFrame(e);
|
|
186
|
+
}, B = (e, t) => (e.preventDefault(), m === null || e.button !== 0 ? !1 : (y = e.pointerType, e.pointerType === "touch" ? (_ = {
|
|
187
187
|
pointerId: e.pointerId,
|
|
188
188
|
x: e.clientX,
|
|
189
189
|
y: e.clientY,
|
|
190
190
|
target: t
|
|
191
|
-
}, !1) : (
|
|
191
|
+
}, !1) : (m.gridRootRef.current?.focus({ preventScroll: !0 }), m.pointerClientRef.current = {
|
|
192
192
|
x: e.clientX,
|
|
193
193
|
y: e.clientY
|
|
194
|
-
},
|
|
194
|
+
}, x = {
|
|
195
195
|
x: e.clientX,
|
|
196
196
|
y: e.clientY
|
|
197
|
-
},
|
|
197
|
+
}, S = !1, !0)));
|
|
198
198
|
return {
|
|
199
199
|
update: (e) => {
|
|
200
|
-
|
|
200
|
+
m = e, P(), R();
|
|
201
201
|
},
|
|
202
|
-
getCellCoordFromClientPoint:
|
|
203
|
-
updateSelectionFromPointer:
|
|
202
|
+
getCellCoordFromClientPoint: D,
|
|
203
|
+
updateSelectionFromPointer: O,
|
|
204
204
|
handleCellPointerDown: (e, t) => {
|
|
205
|
-
if (!(!
|
|
205
|
+
if (!(!B(t, {
|
|
206
206
|
kind: "cell",
|
|
207
207
|
cell: e
|
|
208
|
-
}) ||
|
|
209
|
-
if (t.shiftKey &&
|
|
210
|
-
let { selection: t, activeCell: r } =
|
|
208
|
+
}) || m === null)) {
|
|
209
|
+
if (t.shiftKey && m.enableRangeSelection) {
|
|
210
|
+
let { selection: t, activeCell: r } = m.uiState, i = t?.type === "cell" ? t.range.start : r;
|
|
211
211
|
if (i) {
|
|
212
|
-
|
|
212
|
+
m.dispatch(n.startSelection(i)), m.dispatch(n.updateSelection(e));
|
|
213
213
|
return;
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
|
-
|
|
216
|
+
m.dispatch(n.activateCell(e)), m.enableRangeSelection && m.dispatch(n.startSelection(e));
|
|
217
217
|
}
|
|
218
218
|
},
|
|
219
219
|
handleCellDoubleClick: (e, t) => {
|
|
220
|
-
|
|
220
|
+
y === "touch" || m === null || m.onCellDoubleClickRef.current(e, t);
|
|
221
221
|
},
|
|
222
222
|
handleCellPointerEnter: (e, t) => {
|
|
223
|
-
if (
|
|
224
|
-
let r =
|
|
225
|
-
r?.type !== "selection" || r.selectionKind !== "cell" || (
|
|
223
|
+
if (m === null || (m.enableRowHover && m.setHoveredRowIndex(e.row), m.enableColumnHover && m.setHoveredColumnIndex(e.col), !m.enableRangeSelection)) return;
|
|
224
|
+
let r = w();
|
|
225
|
+
r?.type !== "selection" || r.selectionKind !== "cell" || (m.pointerClientRef.current = {
|
|
226
226
|
x: t.clientX,
|
|
227
227
|
y: t.clientY
|
|
228
|
-
},
|
|
228
|
+
}, m.dispatch(n.updateSelection(e)));
|
|
229
229
|
},
|
|
230
230
|
handleNativeDragStart: (e) => {
|
|
231
231
|
e.preventDefault();
|
|
232
232
|
},
|
|
233
233
|
handleRowHeaderPointerDown: (e, t) => {
|
|
234
|
-
if (!(!
|
|
234
|
+
if (!(!B(t, {
|
|
235
235
|
kind: "row",
|
|
236
236
|
rowIndex: e
|
|
237
|
-
}) ||
|
|
238
|
-
if (
|
|
239
|
-
|
|
237
|
+
}) || m === null)) {
|
|
238
|
+
if (m.enableRowSelection) {
|
|
239
|
+
g = !0, m.onGutterRowSelect(e, { shiftKey: t.shiftKey }), z();
|
|
240
240
|
return;
|
|
241
241
|
}
|
|
242
242
|
if (t.shiftKey) {
|
|
243
|
-
let { selection: t, activeCell: r } =
|
|
243
|
+
let { selection: t, activeCell: r } = m.uiState, i = t?.type === "row" ? t.startRow : r?.row;
|
|
244
244
|
if (i !== void 0) {
|
|
245
|
-
|
|
245
|
+
m.dispatch(n.startRowSelection(i, m.resolveFirstDataCell?.().col)), m.dispatch(n.updateRowSelection(e));
|
|
246
246
|
return;
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
|
-
|
|
249
|
+
m.dispatch(n.startRowSelection(e, m.resolveFirstDataCell?.().col));
|
|
250
250
|
}
|
|
251
251
|
},
|
|
252
252
|
handleRowHeaderPointerEnter: (e, t) => {
|
|
253
|
-
if (
|
|
254
|
-
if (
|
|
255
|
-
|
|
253
|
+
if (m === null) return;
|
|
254
|
+
if (m.enableRowHover && m.setHoveredRowIndex(e), g) {
|
|
255
|
+
m.pointerClientRef.current = {
|
|
256
256
|
x: t.clientX,
|
|
257
257
|
y: t.clientY
|
|
258
|
-
},
|
|
258
|
+
}, m.onGutterRowSelectDrag(e);
|
|
259
259
|
return;
|
|
260
260
|
}
|
|
261
|
-
let r =
|
|
262
|
-
r?.type !== "selection" || r.selectionKind !== "row" || (
|
|
261
|
+
let r = w();
|
|
262
|
+
r?.type !== "selection" || r.selectionKind !== "row" || (m.pointerClientRef.current = {
|
|
263
263
|
x: t.clientX,
|
|
264
264
|
y: t.clientY
|
|
265
|
-
},
|
|
265
|
+
}, m.dispatch(n.updateRowSelection(e)));
|
|
266
266
|
},
|
|
267
267
|
handleColumnHeaderPointerDown: (r, i) => {
|
|
268
|
-
if (!(!
|
|
268
|
+
if (!(!B(i, {
|
|
269
269
|
kind: "col",
|
|
270
270
|
colIndex: r
|
|
271
|
-
}) ||
|
|
272
|
-
if (i.shiftKey &&
|
|
273
|
-
let i =
|
|
271
|
+
}) || m === null)) {
|
|
272
|
+
if (i.shiftKey && m.enableSorting) {
|
|
273
|
+
let i = m.orderedColumns[r];
|
|
274
274
|
if (i && !t(i.key)) {
|
|
275
|
-
let t =
|
|
276
|
-
|
|
275
|
+
let t = m.uiState.sort, r = t.find((e) => e.columnKey === i.key)?.direction ? "desc" : "asc", a = e(t, i.key, r, !0);
|
|
276
|
+
m.dispatch(a.length === 0 ? n.clearSort() : n.setSort(a));
|
|
277
277
|
}
|
|
278
278
|
return;
|
|
279
279
|
}
|
|
280
|
-
|
|
280
|
+
m.dispatch(n.startColumnSelection(r, m.resolveFirstDataCell?.().row));
|
|
281
281
|
}
|
|
282
282
|
},
|
|
283
283
|
handleColumnHeaderPointerEnter: (e, t) => {
|
|
284
|
-
if (
|
|
285
|
-
|
|
286
|
-
let r =
|
|
287
|
-
r?.type !== "selection" || r.selectionKind !== "col" || (
|
|
284
|
+
if (m === null) return;
|
|
285
|
+
m.setHoveredRowIndex(null), m.enableColumnHeaderHover && m.setHoveredColumnIndex(e);
|
|
286
|
+
let r = w();
|
|
287
|
+
r?.type !== "selection" || r.selectionKind !== "col" || (m.pointerClientRef.current = {
|
|
288
288
|
x: t.clientX,
|
|
289
289
|
y: t.clientY
|
|
290
|
-
},
|
|
290
|
+
}, m.dispatch(n.updateColumnSelection(e)));
|
|
291
291
|
},
|
|
292
292
|
dispose: () => {
|
|
293
|
-
|
|
293
|
+
F(), I(), b !== null && (cancelAnimationFrame(b), b = null);
|
|
294
294
|
}
|
|
295
295
|
};
|
|
296
296
|
};
|
|
297
297
|
//#endregion
|
|
298
|
-
export {
|
|
298
|
+
export { h as TOUCH_DOUBLE_TAP_MS, m as TOUCH_TAP_SLOP_PX, g as createPointerInteractionsController };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs");var t=e=>{document.activeElement instanceof HTMLElement&&document.activeElement.blur(),e?.blur()},n=t=>{requestAnimationFrame(()=>{let n=t.current;if(n===null||e.isFocusInsideDetailCard())return;let r=n.ownerDocument.activeElement;r!==null&&r!==n&&n.contains(r)&&r.closest(`.ssg-cell-editor`)!==null||n.focus()})},
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs");require("../logic/domGuards.cjs"),require("./escapeClaimController.cjs");var t=e=>{document.activeElement instanceof HTMLElement&&document.activeElement.blur(),e?.blur()},n=`input, textarea, select, [contenteditable]:not([contenteditable="false"])`,r=t=>{let r=t.current,i=r?.ownerDocument.activeElement??null;r!==null&&i!==null&&!r.contains(i)&&i.closest(`.ssg-menu-panel, .ssg-filter-popover, .ssg-toolpanel, .ssg-select-editor-popover`)!==null&&(i.matches(n)?queueMicrotask(()=>{let e=t.current,n=e?.ownerDocument.activeElement??null;e!==null&&(n===null||n===e.ownerDocument.body)&&e.focus({preventScroll:!0})}):r.focus({preventScroll:!0})),requestAnimationFrame(()=>{let n=t.current;if(n===null||e.isFocusInsideDetailCard())return;let r=n.ownerDocument.activeElement;r!==null&&r!==n&&n.contains(r)&&r.closest(`.ssg-cell-editor`)!==null||r!==null&&!n.contains(r)&&r.closest(`.ssg-menu-panel, .ssg-filter-popover, .ssg-toolpanel, .ssg-select-editor-popover`)!==null||n.focus()})},i=(e,t)=>e.current?.contains(t)===!0,a=(e,t,n=`[role="menuitem"]`)=>{let r=document.activeElement,i=r instanceof HTMLElement&&r!==e&&e.contains(r);if(i&&!r.matches(n))return!1;let a=t.key;if(a===`ArrowDown`||a===`ArrowUp`||a===`Home`||a===`End`){t.preventDefault();let o=Array.from(e.querySelectorAll(`${n}:not(:disabled):not([aria-disabled="true"])`));if(o.length===0)return!0;let s=i?o.indexOf(r):-1,c;return c=a===`Home`?0:a===`End`?o.length-1:a===`ArrowDown`?s<0?0:(s+1)%o.length:s<0?o.length-1:(s-1+o.length)%o.length,o[c]?.focus(),!0}return!i&&(a===`PageUp`||a===`PageDown`||a===` `||a===`ArrowLeft`||a===`ArrowRight`)?(t.preventDefault(),!0):!1},o=(e,t)=>{if(e===null||!e.isConnected)return;let n=e.ownerDocument.activeElement,r=n!==null&&t!=null&&(n===t||t.contains(n)&&n.hasAttribute(`data-ssg-ime-input`));(n===null||n===e.ownerDocument.body||r)&&e.focus({preventScroll:!0})},s=e=>{let t=!1,n=()=>e.onResize?.(),r=t=>e.onScroll?.(t),i=t=>{let n=t.target;n&&(e.isInside(n)||e.onOutsidePointerDown(n))},a=t=>e.onKeyDown?.(t),o=null,s=()=>{let n=e.getGridRoot?.()??null,r=e.onGridHidden;!n||!r||typeof ResizeObserver>`u`||(o=new ResizeObserver(e=>{let i=e[e.length-1];if(!t||!i||i.contentRect.width!==0||i.contentRect.height!==0)return;let a=n.getBoundingClientRect();a.width===0&&a.height===0&&r()}),o.observe(n))};return{attach:()=>{t||(t=!0,window.addEventListener(`resize`,n),window.addEventListener(`scroll`,r,!0),window.addEventListener(`pointerdown`,i),window.addEventListener(`keydown`,a,!0),s())},detach:()=>{t&&(t=!1,o?.disconnect(),o=null,window.removeEventListener(`resize`,n),window.removeEventListener(`scroll`,r,!0),window.removeEventListener(`pointerdown`,i),window.removeEventListener(`keydown`,a,!0))},isAttached:()=>t}};exports.blurForPopover=t,exports.createPopoverWindowBindings=s,exports.focusPanelIfIdle=o,exports.handleMenuKeyNavigation=a,exports.isInsideGridRoot=i,exports.restoreGridFocus=r;
|
|
@@ -5,6 +5,7 @@ export declare const blurForPopover: (gridRoot: HTMLElement | null) => void;
|
|
|
5
5
|
export declare const restoreGridFocus: (gridRootRef: ReadonlyElementRef) => void;
|
|
6
6
|
export declare const isInsideGridRoot: (gridRootRef: ReadonlyElementRef, target: Node) => boolean;
|
|
7
7
|
export declare const handleMenuKeyNavigation: (panel: HTMLElement, event: KeyboardEvent, itemSelector?: string) => boolean;
|
|
8
|
+
export declare const focusPanelIfIdle: (panel: HTMLElement | null, gridRoot?: HTMLElement | null) => void;
|
|
8
9
|
export type PopoverWindowHandlers = {
|
|
9
10
|
onResize?: () => void;
|
|
10
11
|
onScroll?: (event: Event) => void;
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { isFocusInsideDetailCard as e } from "../logic/detailRow.js";
|
|
2
|
+
import "../logic/domGuards.js";
|
|
3
|
+
import "./escapeClaimController.js";
|
|
2
4
|
//#region src/controllers/popoverSupport.ts
|
|
3
5
|
var t = (e) => {
|
|
4
6
|
document.activeElement instanceof HTMLElement && document.activeElement.blur(), e?.blur();
|
|
5
|
-
}, n = (t) => {
|
|
6
|
-
|
|
7
|
+
}, n = "input, textarea, select, [contenteditable]:not([contenteditable=\"false\"])", r = (t) => {
|
|
8
|
+
let r = t.current, i = r?.ownerDocument.activeElement ?? null;
|
|
9
|
+
r !== null && i !== null && !r.contains(i) && i.closest(".ssg-menu-panel, .ssg-filter-popover, .ssg-toolpanel, .ssg-select-editor-popover") !== null && (i.matches(n) ? queueMicrotask(() => {
|
|
10
|
+
let e = t.current, n = e?.ownerDocument.activeElement ?? null;
|
|
11
|
+
e !== null && (n === null || n === e.ownerDocument.body) && e.focus({ preventScroll: !0 });
|
|
12
|
+
}) : r.focus({ preventScroll: !0 })), requestAnimationFrame(() => {
|
|
7
13
|
let n = t.current;
|
|
8
14
|
if (n === null || e()) return;
|
|
9
15
|
let r = n.ownerDocument.activeElement;
|
|
10
|
-
r !== null && r !== n && n.contains(r) && r.closest(".ssg-cell-editor") !== null || n.focus();
|
|
16
|
+
r !== null && r !== n && n.contains(r) && r.closest(".ssg-cell-editor") !== null || r !== null && !n.contains(r) && r.closest(".ssg-menu-panel, .ssg-filter-popover, .ssg-toolpanel, .ssg-select-editor-popover") !== null || n.focus();
|
|
11
17
|
});
|
|
12
|
-
},
|
|
13
|
-
let r = document.activeElement, i = r instanceof HTMLElement && e.contains(r);
|
|
18
|
+
}, i = (e, t) => e.current?.contains(t) === !0, a = (e, t, n = "[role=\"menuitem\"]") => {
|
|
19
|
+
let r = document.activeElement, i = r instanceof HTMLElement && r !== e && e.contains(r);
|
|
14
20
|
if (i && !r.matches(n)) return !1;
|
|
15
21
|
let a = t.key;
|
|
16
22
|
if (a === "ArrowDown" || a === "ArrowUp" || a === "Home" || a === "End") {
|
|
@@ -21,7 +27,11 @@ var t = (e) => {
|
|
|
21
27
|
return c = a === "Home" ? 0 : a === "End" ? o.length - 1 : a === "ArrowDown" ? s < 0 ? 0 : (s + 1) % o.length : s < 0 ? o.length - 1 : (s - 1 + o.length) % o.length, o[c]?.focus(), !0;
|
|
22
28
|
}
|
|
23
29
|
return !i && (a === "PageUp" || a === "PageDown" || a === " " || a === "ArrowLeft" || a === "ArrowRight") ? (t.preventDefault(), !0) : !1;
|
|
24
|
-
},
|
|
30
|
+
}, o = (e, t) => {
|
|
31
|
+
if (e === null || !e.isConnected) return;
|
|
32
|
+
let n = e.ownerDocument.activeElement, r = n !== null && t != null && (n === t || t.contains(n) && n.hasAttribute("data-ssg-ime-input"));
|
|
33
|
+
(n === null || n === e.ownerDocument.body || r) && e.focus({ preventScroll: !0 });
|
|
34
|
+
}, s = (e) => {
|
|
25
35
|
let t = !1, n = () => e.onResize?.(), r = (t) => e.onScroll?.(t), i = (t) => {
|
|
26
36
|
let n = t.target;
|
|
27
37
|
n && (e.isInside(n) || e.onOutsidePointerDown(n));
|
|
@@ -45,4 +55,4 @@ var t = (e) => {
|
|
|
45
55
|
};
|
|
46
56
|
};
|
|
47
57
|
//#endregion
|
|
48
|
-
export { t as blurForPopover,
|
|
58
|
+
export { t as blurForPopover, s as createPopoverWindowBindings, o as focusPanelIfIdle, a as handleMenuKeyNavigation, i as isInsideGridRoot, r as restoreGridFocus };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/rowReorder.cjs"),t=require("../logic/detailRow.cjs"),n=require("../logic/autoScrollGeometry.cjs"),r=require("../logic/elementScale.cjs"),i=require("../logic/slotDom.cjs"),a=require("../utils/portalTokens.cjs");var o=14,s=12,c=`0.5`,l=`<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>`,u=`<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>`,d=200,f=`cubic-bezier(0.2, 0.7, 0.3, 1)`,p=`transform 160ms ${f}`,m=`data-ssg-row-dragging`,h=e=>e?.closest(`.ssg-motion-off`)!=null,g=/translateY\((-?[\d.]+)px\)/,_=e=>{let n=[];return e.querySelectorAll(`.ssg-body-row[data-row-index]`).forEach(r=>{t.isInsideDetailCardOf(e,r)||n.push(r)}),n},v=e=>{let n=[],r=new Map;return e.querySelectorAll(`.ssg-detail-band[data-detail-row-index]`).forEach(i=>{if(t.isInsideDetailCardOf(e,i))return;let a=Number(i.getAttribute(`data-detail-row-index`)),o=r.get(a)??0;r.set(a,o+1),n.push({el:i,index:a,key:`band|${o}|${a}`})}),n},y=e=>{e.style.transition=``,e.style.transform=``,e.style.willChange=``,e.style.zIndex=``},b=()=>{let b=null,x=null,S=null,C={x:0,y:0},w=null,T=!1,E=null,D=null,O=null,k=null,A=null,j=null,M=0,N=null,P=()=>b?.motion===`live`,F=null,I=null,L=null,R=()=>[b?.leftIndicatorRef.current??null,b?.centerIndicatorRef.current??null,b?.rightIndicatorRef.current??null],z=()=>{for(let e of R())e&&(e.style.display=`none`)},B=e=>{if(F)return;let t=document.createElement(`div`);t.setAttribute(`data-grid-drag-ghost`,``),b?.scrollContainerRef.current?.closest(`.ssg-theme-dark`)!=null&&t.classList.add(`ssg-theme-dark`),b?.scrollContainerRef.current?.closest(`.ssg-theme-class`)!=null&&t.classList.add(`ssg-theme-class`),b?.scrollContainerRef.current?.closest(`.ssg-motion-off`)!=null&&t.classList.add(`ssg-motion-off`),t.style.cssText=[`position:fixed`,`top:0`,`left:0`,`display:inline-flex`,`align-items:center`,`gap:7px`,`padding:7px 12px 7px 10px`,`border-radius:9px`,`border:1px solid var(--ssg-ghost-border)`,`background:var(--ssg-ghost-bg)`,`color:var(--ssg-ghost-text)`,`font-size:12px`,`font-weight:600`,`line-height:1`,`white-space:nowrap`,`max-width:280px`,`overflow:hidden`,`text-overflow:ellipsis`,`box-shadow:var(--ssg-ghost-shadow)`,`pointer-events:none`,`user-select:none`,`z-index:9999`,`will-change:transform`,`transform:translate(-9999px,-9999px)`].join(`;`),i.applySlotToElement(t,b?.ghostSlot);let n=document.createElement(`span`);n.style.cssText=`display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none`;let r=document.createElement(`span`);r.style.cssText=`overflow:hidden;text-overflow:ellipsis`,r.textContent=e,t.appendChild(n),t.appendChild(r),document.body.appendChild(t),a.syncPortalTokens(b?.scrollContainerRef.current,t),F=t,I=n,L=null},V=e=>{let t=F;if(!t)return;t.style.transform=`translate(`+(C.x+o)+`px,`+(C.y+s)+`px)`;let n=e?`move`:`out`;if(L===n)return;L=n;let r=I;n===`out`?(t.style.opacity=c,r&&(r.innerHTML=u)):(t.style.opacity=`1`,r&&(r.innerHTML=l))},H=()=>{F&&F.parentNode&&F.parentNode.removeChild(F),F=null,I=null,L=null},U=(e,n)=>{let r=b?.scrollContainerRef.current??null;!r||n&&e===null||r.querySelectorAll(n?`.ssg-body-row[data-row-index="${e}"]`:`.ssg-body-row[${m}]`).forEach(e=>{t.isInsideDetailCardOf(r,e)||(n?e.setAttribute(m,P()?`live`:``):e.removeAttribute(m))})},W=()=>{let e=b?.scrollContainerRef.current??null;if(!e)return null;let t=new Map;for(let n of _(e)){let e=g.exec(n.style.transform);e&&t.set(n,{index:Number(n.getAttribute(`data-row-index`)),baseY:parseFloat(e[1])})}return t},G=t=>{let n=j,r=x;if(!n||r===null||b===null)return;let i=b.scrollContainerRef.current;if(!i)return;for(let e of _(i)){if(n.has(e))continue;let t=g.exec(e.style.transform);t&&n.set(e,{index:Number(e.getAttribute(`data-row-index`)),baseY:parseFloat(t[1])})}let a=b.rowMetrics.rowsHeight(r,r),o=(i.scrollTop-M)*b.verticalScaleFactor,s=(w?C.y-w.y:0)+o,c=t===null?null:e.resolveMoveTargetIndex(r,t);n.forEach((e,t)=>{let{index:i,baseY:o}=e;if(!t.isConnected){n.delete(t);return}if(i===r){t.style.transition=`none`,t.style.transform=`translateY(${o+s}px)`,t.style.willChange=`transform`,e.applied=t.style.transform;return}let l=0;c!==null&&(r<i&&i<=c?l=-a:c<=i&&i<r&&(l=a)),t.style.transition=p,t.style.transform=`translateY(${o+l}px)`,e.applied=t.style.transform});let l=N??new Set;N=l;for(let{el:e,index:t}of v(i)){if(l.add(e),t===r){e.style.transition=`none`,e.style.transform=`translateY(${s}px)`,e.style.willChange=`transform`,e.style.zIndex=`10`;continue}let n=0;c!==null&&(r<t&&t<=c?n=-a:c<=t&&t<r&&(n=a)),e.style.transition=p,e.style.transform=`translateY(${n}px)`,e.style.zIndex=``}},K=(t,r)=>{if(b===null)return null;let{scrollContainerRef:i,bodyScrollRef:a,rowMetrics:o,headerHeight:s,verticalScaleFactor:c,windowBaseOffsetPx:l}=b,u=i.current,d=a.current;if(!u||!d)return null;let f=u.getBoundingClientRect();if(t<f.left||t>f.right||r<f.top||r>f.bottom)return null;let p=n.clampClientYAboveFooter(r,f.top+u.clientTop+u.clientHeight,b.footerHeight??0),m=d.getBoundingClientRect(),h=d.scrollTop+p-m.top-s-u.scrollTop*(1-c),g=e.resolveRowDropSlot(h,o),_=x,v=_!==null&&P()?o.detailHeight(_):0;if(_!==null&&v>0){let t=e.resolveRowDropSlot(h+v,o);t>_+1&&(g=t)}let y=e.resolveRowDropSlotTop(g,o);return{slot:g,top:s+y-l}},q=()=>{let t=K(C.x,C.y),n=x;if(P()){t&&n!==null&&(S=e.resolveMoveTargetIndex(n,t.slot)===null?null:t.slot),z(),G(S);return}if(V(t),!t||n===null||e.resolveMoveTargetIndex(n,t.slot)===null){S=null,z();return}S=t.slot;for(let e of R())e&&(e.style.top=`${t.top}px`,e.style.display=`block`)},J=()=>{if(x===null){O=null;return}let e=b?.scrollContainerRef.current??null;if(e&&(T||(!w||n.hasPointerLeftActivationRadius(w,C,6))&&(T=!0),T)){let t=e.getBoundingClientRect(),i=n.resolveScrollContentBox({rectLeft:t.left,rectTop:t.top,clientLeft:e.clientLeft,clientTop:e.clientTop,clientWidth:e.clientWidth,clientHeight:e.clientHeight,scale:r.resolveElementScale(e,t)}),a=n.resolveAutoScrollAxisDirection(C.y,i.top,i.bottom-(b?.footerHeight??0),24),o=n.computeNextScrollPosition(e.scrollTop,a,18,e.scrollHeight-e.clientHeight);o!==e.scrollTop&&e.scrollTo({top:o,behavior:`auto`})}q(),O=requestAnimationFrame(J)},Y=(e,t)=>`${e.getAttribute(`data-pane`)??``}|${t}`,X=()=>{let e=b?.scrollContainerRef.current??null;if(!e)return null;let t=new Map;for(let n of _(e))t.set(Y(n,Number(n.getAttribute(`data-row-index`))),n.getBoundingClientRect().top);for(let n of v(e))t.set(n.key,n.el.getBoundingClientRect().top);return t},Z=t=>{O!==null&&(cancelAnimationFrame(O),O=null),document.body.style.cursor=``,z(),H();let n=x,r=S,i=A;U(n,!1),x=null,A=null,S=null,w=null,D=null;let a=n===null||r===null?null:e.resolveMoveTargetIndex(n,r),o=t&&n!==null&&a!==null&&b!==null,s=j;j=null;let c=s&&o&&b!==null&&!h(b.scrollContainerRef.current)?X():null,l=N;if(N=null,l&&(o?l.forEach(y):(l.forEach(e=>{e.isConnected&&(e.style.transition=p,e.style.transform=`translateY(0px)`,e.style.zIndex=``)}),window.setTimeout(()=>{l.forEach(e=>{N?.has(e)||y(e)})},200))),s)if(o)s.forEach(({baseY:e},t)=>{t.style.transition=``,t.style.willChange=``,t.isConnected&&(t.style.transform=`translateY(${e}px)`)});else{let e=[];s.forEach(({baseY:t},n)=>{n.isConnected&&(n.style.transition=p,n.style.transform=`translateY(${t}px)`,e.push(n))}),window.setTimeout(()=>{for(let t of e)t.style.transition=``,t.style.willChange=``},200)}if(!o||n===null||a===null||b===null)return;let u=c??(h(b.scrollContainerRef.current)?null:X()),d=u?{tops:u,from:n,to:a,row:i}:null;k=d,b.commitRowMove(n,a),d&&requestAnimationFrame(()=>{k===d&&(k=null)})},Q=()=>{let e=k;if(k=null,!e)return;let t=b?.scrollContainerRef.current??null;if(!t)return;let{tops:n,from:r,to:i}=e;if(b?.locateDragRow&&e.row!==null&&b.locateDragRow(e.row,i)!==i)return;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=new Map;_(t).forEach(e=>{let t=n.get(Y(e,a(Number(e.getAttribute(`data-row-index`)))));if(t===void 0)return;let r=t-e.getBoundingClientRect().top;if(Math.abs(r)<.5)return;let i=g.exec(e.style.transform);if(!i)return;let c=parseFloat(i[1]);s.set(e,c),e.style.transition=`none`,e.style.transform=`translateY(${c+r}px)`,e.style.willChange=`transform`,o.push(e)});let c=[];if(v(t).forEach(({el:e,index:t,key:r})=>{let i=a(t),o=n.get(r.slice(0,r.lastIndexOf(`|`)+1)+i);if(o===void 0)return;let s=o-e.getBoundingClientRect().top;Math.abs(s)<.5||(e.style.transition=`none`,e.style.transform=`translateY(${s}px)`,e.style.willChange=`transform`,c.push(e))}),!(o.length===0&&c.length===0)){t.getBoundingClientRect();for(let e of o)e.style.transition=`transform ${d}ms ${f}`,e.style.transform=`translateY(${s.get(e)??0}px)`;for(let e of c)e.style.transition=`transform ${d}ms ${f}`,e.style.transform=`translateY(0px)`;window.setTimeout(()=>{for(let e of o)e.style.transition=``,e.style.willChange=``;for(let e of c)N?.has(e)||y(e)},280)}},$=(e,t)=>{if(b===null||!b.enabled||t.button!==0)return;if(t.stopPropagation(),t.preventDefault(),b.gridRootRef?.current?.focus({preventScroll:!0}),x!==null){if(t.pointerId!==D)return;E?.(),Z(!1)}x=e,A=b.getDragRow?.(e)??null,D=t.pointerId,S=null,C={x:t.clientX,y:t.clientY},w={x:t.clientX,y:t.clientY},T=!1,document.body.style.cursor=`grabbing`,P()?(j=W(),M=b.scrollContainerRef.current?.scrollTop??0):B(b.getRowDragLabel(e)),U(e,!0);let n=t.currentTarget,r=t.pointerId;try{n.setPointerCapture(r)}catch{}let i=e=>{e.pointerId===r&&(C={x:e.clientX,y:e.clientY},q())},a=()=>{window.removeEventListener(`pointermove`,i),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,s),window.removeEventListener(`keydown`,c),window.removeEventListener(`blur`,l),E=null;try{n.releasePointerCapture(r)}catch{}};function o(e){e.pointerId===r&&(a(),Z(!0))}function s(e){e.pointerId===r&&(a(),Z(!1))}function c(e){e.key===`Escape`&&(a(),Z(!1))}function l(){a(),Z(!1)}window.addEventListener(`pointermove`,i),window.addEventListener(`pointerup`,o),window.addEventListener(`pointercancel`,s),window.addEventListener(`keydown`,c),window.addEventListener(`blur`,l),E=a,q(),O=requestAnimationFrame(J)},ee=e=>{if(x===null||A==null||b?.locateDragRow===void 0)return;let t=b.locateDragRow(A,x);if(j&&j.forEach((e,t)=>{if(!t.isConnected){j?.delete(t);return}let n=Number(t.getAttribute(`data-row-index`));if(n===e.index&&(e.applied===void 0||t.style.transform===e.applied))return;let r=g.exec(t.style.transform);if(!r){j?.delete(t);return}e.index=n,e.baseY=parseFloat(r[1]),e.applied=void 0}),t===null){E?.(),Z(!1);return}j&&t!==x&&w!==null&&e!==null&&(w={x:w.x,y:w.y+b.rowMetrics.rowTop(t)-e.rowTop(x)}),t!==x&&(U(null,!1),x=t,U(t,!0)),q()};return{update:e=>{let t=b;b=e,x!==null&&t!==null&&t.locateDragRow!==e.locateDragRow&&ee(t.rowMetrics)},onRowDragHandlePointerDown:$,applyReorderSettle:Q,dispose:()=>{E?.(),E=null,O!==null&&(cancelAnimationFrame(O),O=null),document.body.style.cursor=``,H(),U(x,!1),x=null,A=null,S=null,j=null,N?.forEach(y),N=null,k=null}}};exports.createRowDragController=b;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/rowReorder.cjs"),t=require("../logic/detailRow.cjs"),n=require("../logic/autoScrollGeometry.cjs"),r=require("../logic/elementScale.cjs"),i=require("./escapeClaimController.cjs"),a=require("../logic/slotDom.cjs"),o=require("../utils/portalTokens.cjs"),s=require("../utils/popupContainer.cjs");var c=14,l=12,u=`0.5`,d=`<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>`,f=`<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>`,p=200,m=`cubic-bezier(0.2, 0.7, 0.3, 1)`,h=`transform 160ms ${m}`,g=`data-ssg-row-dragging`,_=e=>e?.closest(`.ssg-motion-off`)!=null,v=/translateY\((-?[\d.]+)px\)/,y=e=>{let n=[];return e.querySelectorAll(`.ssg-body-row[data-row-index]`).forEach(r=>{t.isInsideDetailCardOf(e,r)||n.push(r)}),n},b=e=>{let n=[],r=new Map;return e.querySelectorAll(`.ssg-detail-band[data-detail-row-index]`).forEach(i=>{if(t.isInsideDetailCardOf(e,i))return;let a=Number(i.getAttribute(`data-detail-row-index`)),o=r.get(a)??0;r.set(a,o+1),n.push({el:i,index:a,key:`band|${o}|${a}`})}),n},x=e=>{e.style.transition=``,e.style.transform=``,e.style.willChange=``,e.style.zIndex=``},S=()=>{let S=null,C=null,w=null,T={x:0,y:0},E=null,D=!1,O=null,k=null,A=null,j=null,M=null,N=null,P=0,F=null,I=()=>S?.motion===`live`,L=null,R=null,z=null,B=()=>[S?.leftIndicatorRef.current??null,S?.centerIndicatorRef.current??null,S?.rightIndicatorRef.current??null],V=()=>{for(let e of B())e&&(e.style.display=`none`)},H=e=>{if(L)return;let t=document.createElement(`div`);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-theme-class`)!=null&&t.classList.add(`ssg-theme-class`),S?.scrollContainerRef.current?.closest(`.ssg-motion-off`)!=null&&t.classList.add(`ssg-motion-off`),t.style.cssText=[`position:fixed`,`top:0`,`left:0`,`display:inline-flex`,`align-items:center`,`gap:7px`,`padding:7px 12px 7px 10px`,`border-radius:9px`,`border:1px solid var(--ssg-ghost-border)`,`background:var(--ssg-ghost-bg)`,`color:var(--ssg-ghost-text)`,`font-size:12px`,`font-weight:600`,`line-height:1`,`white-space:nowrap`,`max-width:280px`,`overflow:hidden`,`text-overflow:ellipsis`,`box-shadow:var(--ssg-ghost-shadow)`,`pointer-events:none`,`user-select:none`,`z-index:9999`,`will-change:transform`,`transform:translate(-9999px,-9999px)`].join(`;`),a.applySlotToElement(t,S?.ghostSlot);let n=document.createElement(`span`);n.style.cssText=`display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none`;let r=document.createElement(`span`);r.style.cssText=`overflow:hidden;text-overflow:ellipsis`,r.textContent=e,t.appendChild(n),t.appendChild(r),s.appendToPopupContainer(t,s.getPopupContainerFor(S?.scrollContainerRef.current)),o.syncPortalTokens(S?.scrollContainerRef.current,t),L=t,R=n,z=null},U=e=>{let t=L;if(!t)return;t.style.transform=`translate(`+(T.x+c)+`px,`+(T.y+l)+`px)`;let n=e?`move`:`out`;if(z===n)return;z=n;let r=R;n===`out`?(t.style.opacity=u,r&&(r.innerHTML=f)):(t.style.opacity=`1`,r&&(r.innerHTML=d))},W=()=>{L&&L.parentNode&&L.parentNode.removeChild(L),L=null,R=null,z=null},G=(e,n)=>{let r=S?.scrollContainerRef.current??null;!r||n&&e===null||r.querySelectorAll(n?`.ssg-body-row[data-row-index="${e}"]`:`.ssg-body-row[${g}]`).forEach(e=>{t.isInsideDetailCardOf(r,e)||(n?e.setAttribute(g,I()?`live`:``):e.removeAttribute(g))})},K=()=>{let e=S?.scrollContainerRef.current??null;if(!e)return null;let t=new Map;for(let n of y(e)){let e=v.exec(n.style.transform);e&&t.set(n,{index:Number(n.getAttribute(`data-row-index`)),baseY:parseFloat(e[1])})}return t},q=t=>{let n=N,r=C;if(!n||r===null||S===null)return;let i=S.scrollContainerRef.current;if(!i)return;for(let e of y(i)){if(n.has(e))continue;let t=v.exec(e.style.transform);t&&n.set(e,{index:Number(e.getAttribute(`data-row-index`)),baseY:parseFloat(t[1])})}let a=S.rowMetrics.rowsHeight(r,r),o=(i.scrollTop-P)*S.verticalScaleFactor,s=(E?T.y-E.y:0)+o,c=t===null?null:e.resolveMoveTargetIndex(r,t);n.forEach((e,t)=>{let{index:i,baseY:o}=e;if(!t.isConnected){n.delete(t);return}if(i===r){t.style.transition=`none`,t.style.transform=`translateY(${o+s}px)`,t.style.willChange=`transform`,e.applied=t.style.transform;return}let l=0;c!==null&&(r<i&&i<=c?l=-a:c<=i&&i<r&&(l=a)),t.style.transition=h,t.style.transform=`translateY(${o+l}px)`,e.applied=t.style.transform});let l=F??new Set;F=l;for(let{el:e,index:t}of b(i)){if(l.add(e),t===r){e.style.transition=`none`,e.style.transform=`translateY(${s}px)`,e.style.willChange=`transform`,e.style.zIndex=`10`;continue}let n=0;c!==null&&(r<t&&t<=c?n=-a:c<=t&&t<r&&(n=a)),e.style.transition=h,e.style.transform=`translateY(${n}px)`,e.style.zIndex=``}},J=(t,r)=>{if(S===null)return null;let{scrollContainerRef:i,bodyScrollRef:a,rowMetrics:o,headerHeight:s,verticalScaleFactor:c,windowBaseOffsetPx:l}=S,u=i.current,d=a.current;if(!u||!d)return null;let f=u.getBoundingClientRect();if(t<f.left||t>f.right||r<f.top||r>f.bottom)return null;let p=n.clampClientYBelowHeader(n.clampClientYAboveFooter(r,f.top+u.clientTop+u.clientHeight,S.footerHeight??0),f.top+u.clientTop,S.stickyTopHeight??0),m=d.getBoundingClientRect(),h=d.scrollTop+p-m.top-s-u.scrollTop*(1-c),g=e.resolveRowDropSlot(h,o),_=C,v=_!==null&&I()?o.detailHeight(_):0;if(_!==null&&v>0){let t=e.resolveRowDropSlot(h+v,o);t>_+1&&(g=t)}let y=e.resolveRowDropSlotTop(g,o);return{slot:g,top:s+y-l}},Y=()=>{let t=J(T.x,T.y),n=C;if(I()){t&&n!==null&&(w=e.resolveMoveTargetIndex(n,t.slot)===null?null:t.slot),V(),q(w);return}if(U(t),!t||n===null||e.resolveMoveTargetIndex(n,t.slot)===null){w=null,V();return}w=t.slot;for(let e of B())e&&(e.style.top=`${t.top}px`,e.style.display=`block`)},X=()=>{if(C===null){A=null;return}let e=S?.scrollContainerRef.current??null;if(e&&(D||(!E||n.hasPointerLeftActivationRadius(E,T,6))&&(D=!0),D)){let t=e.getBoundingClientRect(),i=r.resolveElementScale(e,t),a=n.resolveScrollContentBox({rectLeft:t.left,rectTop:t.top,clientLeft:e.clientLeft,clientTop:e.clientTop,clientWidth:e.clientWidth,clientHeight:e.clientHeight,scale:i}),o=n.resolveAutoScrollAxisDirection(T.y,n.resolveTopAutoScrollStart(a.top,(S?.stickyTopHeight??0)*i.y,24),a.bottom-(S?.footerHeight??0),24),s=n.computeNextScrollPosition(e.scrollTop,o,18,e.scrollHeight-e.clientHeight);s!==e.scrollTop&&e.scrollTo({top:s,behavior:`auto`})}Y(),A=requestAnimationFrame(X)},Z=(e,t)=>`${e.getAttribute(`data-pane`)??``}|${t}`,Q=()=>{let e=S?.scrollContainerRef.current??null;if(!e)return null;let t=new Map;for(let n of y(e))t.set(Z(n,Number(n.getAttribute(`data-row-index`))),n.getBoundingClientRect().top);for(let n of b(e))t.set(n.key,n.el.getBoundingClientRect().top);return t},$=t=>{A!==null&&(cancelAnimationFrame(A),A=null),document.body.style.cursor=``,V(),W();let n=C,r=w,i=M;G(n,!1),C=null,M=null,w=null,E=null,k=null;let a=n===null||r===null?null:e.resolveMoveTargetIndex(n,r),o=t&&n!==null&&a!==null&&S!==null,s=N;N=null;let c=s&&o&&S!==null&&!_(S.scrollContainerRef.current)?Q():null,l=F;if(F=null,l&&(o?l.forEach(x):(l.forEach(e=>{e.isConnected&&(e.style.transition=h,e.style.transform=`translateY(0px)`,e.style.zIndex=``)}),window.setTimeout(()=>{l.forEach(e=>{F?.has(e)||x(e)})},200))),s)if(o)s.forEach(({baseY:e},t)=>{t.style.transition=``,t.style.willChange=``,t.isConnected&&(t.style.transform=`translateY(${e}px)`)});else{let e=[];s.forEach(({baseY:t},n)=>{n.isConnected&&(n.style.transition=h,n.style.transform=`translateY(${t}px)`,e.push(n))}),window.setTimeout(()=>{for(let t of e)t.style.transition=``,t.style.willChange=``},200)}if(!o||n===null||a===null||S===null)return;let u=c??(_(S.scrollContainerRef.current)?null:Q()),d=u?{tops:u,from:n,to:a,row:i}:null;j=d,S.commitRowMove(n,a),d&&requestAnimationFrame(()=>{j===d&&(j=null)})},ee=()=>{let e=j;if(j=null,!e)return;let t=S?.scrollContainerRef.current??null;if(!t)return;let{tops:n,from:r,to:i}=e;if(S?.locateDragRow&&e.row!==null&&S.locateDragRow(e.row,i)!==i)return;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=new Map;y(t).forEach(e=>{let t=n.get(Z(e,a(Number(e.getAttribute(`data-row-index`)))));if(t===void 0)return;let r=t-e.getBoundingClientRect().top;if(Math.abs(r)<.5)return;let i=v.exec(e.style.transform);if(!i)return;let c=parseFloat(i[1]);s.set(e,c),e.style.transition=`none`,e.style.transform=`translateY(${c+r}px)`,e.style.willChange=`transform`,o.push(e)});let c=[];if(b(t).forEach(({el:e,index:t,key:r})=>{let i=a(t),o=n.get(r.slice(0,r.lastIndexOf(`|`)+1)+i);if(o===void 0)return;let s=o-e.getBoundingClientRect().top;Math.abs(s)<.5||(e.style.transition=`none`,e.style.transform=`translateY(${s}px)`,e.style.willChange=`transform`,c.push(e))}),!(o.length===0&&c.length===0)){t.getBoundingClientRect();for(let e of o)e.style.transition=`transform ${p}ms ${m}`,e.style.transform=`translateY(${s.get(e)??0}px)`;for(let e of c)e.style.transition=`transform ${p}ms ${m}`,e.style.transform=`translateY(0px)`;window.setTimeout(()=>{for(let e of o)e.style.transition=``,e.style.willChange=``;for(let e of c)F?.has(e)||x(e)},280)}},te=(e,t)=>{if(S===null||!S.enabled||t.button!==0)return;if(t.stopPropagation(),t.preventDefault(),S.gridRootRef?.current?.focus({preventScroll:!0}),C!==null){if(t.pointerId!==k)return;O?.(),$(!1)}C=e,M=S.getDragRow?.(e)??null,k=t.pointerId,w=null,T={x:t.clientX,y:t.clientY},E={x:t.clientX,y:t.clientY},D=!1,document.body.style.cursor=`grabbing`,I()?(N=K(),P=S.scrollContainerRef.current?.scrollTop??0):H(S.getRowDragLabel(e)),G(e,!0);let n=t.currentTarget,r=t.pointerId;try{n.setPointerCapture(r)}catch{}let a=e=>{e.pointerId===r&&(T={x:e.clientX,y:e.clientY},Y())},o=i.beginEscapeCancelableDrag(),s=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,l),window.removeEventListener(`keydown`,u,!0),window.removeEventListener(`blur`,d),o(),O=null;try{n.releasePointerCapture(r)}catch{}};function c(e){e.pointerId===r&&(s(),$(!0))}function l(e){e.pointerId===r&&(s(),$(!1))}function u(e){e.key===`Escape`&&(s(),$(!1))}function d(){s(),$(!1)}window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,l),window.addEventListener(`keydown`,u,!0),window.addEventListener(`blur`,d),O=s,Y(),A=requestAnimationFrame(X)},ne=e=>{if(C===null||M==null||S?.locateDragRow===void 0)return;let t=S.locateDragRow(M,C);if(N&&N.forEach((e,t)=>{if(!t.isConnected){N?.delete(t);return}let n=Number(t.getAttribute(`data-row-index`));if(n===e.index&&(e.applied===void 0||t.style.transform===e.applied))return;let r=v.exec(t.style.transform);if(!r){N?.delete(t);return}e.index=n,e.baseY=parseFloat(r[1]),e.applied=void 0}),t===null){O?.(),$(!1);return}N&&t!==C&&E!==null&&e!==null&&(E={x:E.x,y:E.y+S.rowMetrics.rowTop(t)-e.rowTop(C)}),t!==C&&(G(null,!1),C=t,G(t,!0)),Y()};return{update:e=>{let t=S;S=e,C!==null&&t!==null&&t.locateDragRow!==e.locateDragRow&&ne(t.rowMetrics)},onRowDragHandlePointerDown:te,applyReorderSettle:ee,dispose:()=>{O?.(),O=null,A!==null&&(cancelAnimationFrame(A),A=null),document.body.style.cursor=``,W(),G(C,!1),C=null,M=null,w=null,N=null,F?.forEach(x),F=null,j=null}}};exports.createRowDragController=S;
|