@ishibashi0112/spreadsheet-grid-core 0.61.0 → 0.62.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/columnMenuController.cjs +1 -1
- package/dist/controllers/columnMenuController.d.ts +2 -0
- package/dist/controllers/columnMenuController.js +72 -60
- package/dist/controllers/contextMenuController.cjs +1 -1
- package/dist/controllers/contextMenuController.js +40 -32
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.d.ts +3 -0
- package/dist/controllers/keyboardController.js +184 -91
- package/dist/controllers/pointerInteractionsController.cjs +1 -1
- package/dist/controllers/pointerInteractionsController.js +11 -2
- package/dist/controllers/popoverSupport.cjs +1 -1
- package/dist/controllers/popoverSupport.d.ts +1 -0
- package/dist/controllers/popoverSupport.js +14 -2
- package/dist/controllers/rowDragController.cjs +1 -1
- package/dist/controllers/rowDragController.js +153 -109
- package/dist/controllers/saveStatusController.cjs +1 -1
- package/dist/controllers/saveStatusController.js +71 -25
- package/dist/controllers/serverSideRowModel.cjs +1 -1
- package/dist/controllers/serverSideRowModel.d.ts +1 -0
- package/dist/controllers/serverSideRowModel.js +180 -133
- package/dist/engine/gridApi.cjs +1 -1
- package/dist/engine/gridApi.d.ts +4 -1
- package/dist/engine/gridApi.js +173 -127
- package/dist/engine/notifiers.cjs +1 -1
- package/dist/engine/notifiers.d.ts +1 -0
- package/dist/engine/notifiers.js +10 -5
- package/dist/logic/detailRow.cjs +1 -1
- package/dist/logic/detailRow.d.ts +1 -0
- package/dist/logic/detailRow.js +9 -4
- package/dist/logic/editorValues.cjs +1 -1
- package/dist/logic/editorValues.js +14 -13
- package/dist/logic/filterSummary.cjs +1 -1
- package/dist/logic/filterSummary.d.ts +9 -3
- package/dist/logic/filterSummary.js +39 -13
- package/dist/logic/gridAsk.cjs +1 -1
- package/dist/logic/gridAsk.js +106 -106
- package/dist/logic/gridState.cjs +1 -1
- package/dist/logic/gridState.d.ts +14 -0
- package/dist/logic/gridState.js +80 -45
- package/dist/logic/numberFilterCondition.cjs +1 -1
- package/dist/logic/numberFilterCondition.d.ts +1 -1
- package/dist/logic/numberFilterCondition.js +12 -9
- package/dist/logic/urgentFilters.cjs +1 -0
- package/dist/logic/urgentFilters.d.ts +3 -0
- package/dist/logic/urgentFilters.js +6 -0
- package/dist/logic/validation.cjs +1 -1
- package/dist/logic/validation.d.ts +1 -1
- package/dist/logic/validation.js +10 -10
- package/dist/logic/valueFormatters.d.ts +2 -1
- package/dist/model/gridStore.cjs +1 -1
- package/dist/model/gridStore.d.ts +1 -0
- package/dist/model/gridStore.js +2 -1
- package/dist/model/gridTypes.core.d.ts +86 -13
- package/dist/utils/permissions.cjs +1 -1
- package/dist/utils/permissions.js +5 -3
- package/package.json +1 -1
|
@@ -1,123 +1,216 @@
|
|
|
1
1
|
import { isViewCellEditable as e } from "../utils/permissions.js";
|
|
2
|
+
import "../logic/rowReorder.js";
|
|
3
|
+
import "../logic/detailRow.js";
|
|
2
4
|
import { gridActions as t } from "../model/gridActions.js";
|
|
3
5
|
import { clamp as n } from "../logic/geometry.js";
|
|
4
6
|
import { isImeInputTarget as r, isPrintableKey as i, shouldIgnoreGridKeydown as a } from "../logic/domGuards.js";
|
|
5
7
|
//#region src/controllers/keyboardController.ts
|
|
6
|
-
var o = () => {
|
|
7
|
-
let
|
|
8
|
-
|
|
9
|
-
},
|
|
10
|
-
if (
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
var o = (e) => e === "__ssg_row_drag_handle__" || e === "__ssg_detail_toggle__", s = 10, c = () => {
|
|
9
|
+
let c = null, l = (e) => {
|
|
10
|
+
c = e;
|
|
11
|
+
}, u = (e, t, n, r) => {
|
|
12
|
+
if (!e.getLabelRow) return t;
|
|
13
|
+
let i = e.getRowCount(), a = t;
|
|
14
|
+
for (; a >= 0 && a < i && e.getLabelRow(a);) a += n;
|
|
15
|
+
return a >= 0 && a < i ? a : r;
|
|
16
|
+
}, d = (e, t) => u(e, t, -1, u(e, t, 1, t)), f = (e) => u(e, 0, 1, 0), p = (e) => {
|
|
17
|
+
let t = e.getRowCount() - 1;
|
|
18
|
+
return u(e, t, -1, t);
|
|
19
|
+
}, m = (e) => {
|
|
20
|
+
let t = e.findIndex((e) => !o(e.key));
|
|
21
|
+
return t < 0 ? 0 : t;
|
|
22
|
+
}, h = (e, n, r) => {
|
|
23
|
+
if (c === null) return;
|
|
24
|
+
let { uiState: i, dispatch: a } = c;
|
|
25
|
+
if (r) {
|
|
26
|
+
let r = i.selection?.type === "cell" ? i.selection.range.start : e;
|
|
27
|
+
a(t.startSelection(r)), a(t.updateSelection(n)), a(t.endSelection()), a(t.activateCell(n));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
a(t.startSelection(n)), a(t.endSelection()), a(t.activateCell(n));
|
|
31
|
+
}, g = () => {
|
|
32
|
+
if (c === null || c.uiState.activeCell) return !1;
|
|
33
|
+
let { rowModel: e, visibleColumns: t } = c;
|
|
34
|
+
if (e.getRowCount() === 0 || t.length === 0) return !0;
|
|
35
|
+
let n = {
|
|
36
|
+
row: f(e),
|
|
37
|
+
col: m(t)
|
|
38
|
+
};
|
|
39
|
+
return h(n, n, !1), !0;
|
|
40
|
+
}, _ = (e) => {
|
|
41
|
+
let t = c?.uiState;
|
|
42
|
+
return e && t?.selection?.type === "cell" ? t.selection.range.end : t?.activeCell ?? {
|
|
14
43
|
row: 0,
|
|
15
44
|
col: 0
|
|
16
|
-
}, f = n(d.row + e, 0, u - 1);
|
|
17
|
-
if (e !== 0 && s.getLabelRow) {
|
|
18
|
-
let t = e > 0 ? 1 : -1, n = f;
|
|
19
|
-
for (; n >= 0 && n < u && s.getLabelRow(n);) n += t;
|
|
20
|
-
f = n >= 0 && n < u ? n : d.row;
|
|
21
|
-
}
|
|
22
|
-
let p = {
|
|
23
|
-
row: f,
|
|
24
|
-
col: n(d.col + r, 0, c.length - 1)
|
|
25
45
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
l(
|
|
46
|
+
}, v = (e, t, r) => {
|
|
47
|
+
if (c === null) return;
|
|
48
|
+
let { rowModel: i, visibleColumns: a } = c, o = i.getRowCount();
|
|
49
|
+
if (o === 0 || a.length === 0 || g()) return;
|
|
50
|
+
let s = _(r), l = n(s.row + e, 0, o - 1);
|
|
51
|
+
l = e === 0 ? d(i, l) : u(i, l, e > 0 ? 1 : -1, s.row);
|
|
52
|
+
let f = {
|
|
53
|
+
row: l,
|
|
54
|
+
col: n(s.col + t, 0, a.length - 1)
|
|
55
|
+
};
|
|
56
|
+
h(s, f, r);
|
|
57
|
+
}, y = (e, t) => {
|
|
58
|
+
if (c === null) return;
|
|
59
|
+
let { uiState: r, rowModel: i, visibleColumns: a } = c;
|
|
60
|
+
if (i.getRowCount() === 0 || a.length === 0) return;
|
|
61
|
+
let o = r.activeCell ? _(t) : {
|
|
62
|
+
row: f(i),
|
|
63
|
+
col: m(a)
|
|
64
|
+
}, s = e(o, i, a);
|
|
65
|
+
h(o, {
|
|
66
|
+
row: d(i, n(s.row, 0, i.getRowCount() - 1)),
|
|
67
|
+
col: n(s.col, 0, a.length - 1)
|
|
68
|
+
}, t && r.activeCell !== null);
|
|
69
|
+
}, b = (e, t, r) => {
|
|
70
|
+
let i = t.getRowCount(), a = c?.resolvePageRow ? c.resolvePageRow(e.row, r) : e.row + r * s, o = n(r > 0 ? Math.max(a, e.row + 1) : Math.min(a, e.row - 1), 0, i - 1), l = u(t, o, r, -1);
|
|
71
|
+
return l >= 0 ? l : u(t, o, r > 0 ? -1 : 1, e.row);
|
|
32
72
|
};
|
|
33
73
|
return {
|
|
34
|
-
update:
|
|
74
|
+
update: l,
|
|
35
75
|
handleKeyDown: async (n) => {
|
|
36
|
-
if (
|
|
37
|
-
let { uiState:
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
y();
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if ((n.ctrlKey || n.metaKey) && !n.isComposing) {
|
|
56
|
-
if (n.key.toLowerCase() === "z") {
|
|
57
|
-
n.preventDefault(), n.shiftKey ? x() : b();
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (n.key.toLowerCase() === "y" && !n.shiftKey) {
|
|
61
|
-
n.preventDefault(), x();
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
if (n.key === "ArrowUp") {
|
|
66
|
-
n.preventDefault(), c(-1, 0, n.shiftKey);
|
|
76
|
+
if (c === null) return;
|
|
77
|
+
let { uiState: o, rowModel: s, visibleColumns: l, readOnly: u, canEditCell: d, setEditorInitialValue: h, dispatch: _, handleCopy: x, openFind: S, handleCellDoubleClick: C, isWholeGridSelected: w, selectEntireGrid: T, onUndo: E, onRedo: D, onClearSelection: O, enableClearOnDelete: k, onToggleCheckboxCell: A, onToggleGroup: j, onToggleDetailRow: M } = c;
|
|
78
|
+
if (a(n.target) || o.editingCell || n.isComposing && r(n.target)) return;
|
|
79
|
+
if ((n.ctrlKey || n.metaKey) && n.key.toLowerCase() === "c") {
|
|
80
|
+
n.preventDefault(), await x();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if ((n.ctrlKey || n.metaKey) && n.key.toLowerCase() === "f" && S) {
|
|
84
|
+
n.preventDefault(), S();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if ((n.ctrlKey || n.metaKey) && n.key.toLowerCase() === "a") {
|
|
88
|
+
if (n.preventDefault(), w) {
|
|
89
|
+
_(t.clearSelection()), _(t.activateCell(null));
|
|
67
90
|
return;
|
|
68
91
|
}
|
|
69
|
-
|
|
70
|
-
|
|
92
|
+
T();
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if ((n.ctrlKey || n.metaKey) && !n.isComposing) {
|
|
96
|
+
if (n.key.toLowerCase() === "z") {
|
|
97
|
+
n.preventDefault(), n.shiftKey ? D() : E();
|
|
71
98
|
return;
|
|
72
99
|
}
|
|
73
|
-
if (n.key === "
|
|
74
|
-
n.preventDefault(),
|
|
100
|
+
if (n.key.toLowerCase() === "y" && !n.shiftKey) {
|
|
101
|
+
n.preventDefault(), D();
|
|
75
102
|
return;
|
|
76
103
|
}
|
|
77
|
-
|
|
78
|
-
|
|
104
|
+
}
|
|
105
|
+
let N = n.ctrlKey || n.metaKey;
|
|
106
|
+
if (n.key === "ArrowDown" && n.altKey && !N && !n.shiftKey && o.activeCell && c.openColumnMenu?.(o.activeCell.col)) {
|
|
107
|
+
n.preventDefault();
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (N && !n.altKey && (n.key === "ArrowUp" || n.key === "ArrowDown")) {
|
|
111
|
+
n.preventDefault();
|
|
112
|
+
let e = n.key === "ArrowDown";
|
|
113
|
+
y((t, n) => ({
|
|
114
|
+
row: e ? p(n) : f(n),
|
|
115
|
+
col: t.col
|
|
116
|
+
}), n.shiftKey);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (N && !n.altKey && (n.key === "ArrowLeft" || n.key === "ArrowRight")) {
|
|
120
|
+
n.preventDefault();
|
|
121
|
+
let e = n.key === "ArrowRight";
|
|
122
|
+
y((t, n, r) => ({
|
|
123
|
+
row: t.row,
|
|
124
|
+
col: e ? r.length - 1 : m(r)
|
|
125
|
+
}), n.shiftKey);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if ((n.key === "Home" || n.key === "End") && !n.altKey) {
|
|
129
|
+
n.preventDefault();
|
|
130
|
+
let e = n.key === "End";
|
|
131
|
+
y((t, n, r) => ({
|
|
132
|
+
row: N ? e ? p(n) : f(n) : t.row,
|
|
133
|
+
col: e ? r.length - 1 : m(r)
|
|
134
|
+
}), n.shiftKey);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if ((n.key === "PageDown" || n.key === "PageUp") && !N && !n.altKey) {
|
|
138
|
+
if (n.preventDefault(), g()) return;
|
|
139
|
+
let e = n.key === "PageDown" ? 1 : -1;
|
|
140
|
+
y((t, n) => ({
|
|
141
|
+
row: b(t, n, e),
|
|
142
|
+
col: t.col
|
|
143
|
+
}), n.shiftKey);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (n.key === "ArrowUp") {
|
|
147
|
+
n.preventDefault(), v(-1, 0, n.shiftKey);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (n.key === "ArrowDown") {
|
|
151
|
+
n.preventDefault(), v(1, 0, n.shiftKey);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (n.key === "ArrowLeft") {
|
|
155
|
+
n.preventDefault(), v(0, -1, n.shiftKey);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (n.key === "ArrowRight") {
|
|
159
|
+
n.preventDefault(), v(0, 1, n.shiftKey);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (n.key === "Tab") {
|
|
163
|
+
if (!o.activeCell && !n.shiftKey) {
|
|
164
|
+
if (c.rowModel.getRowCount() === 0 || c.visibleColumns.length === 0) return;
|
|
165
|
+
n.preventDefault(), g();
|
|
79
166
|
return;
|
|
80
167
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
168
|
+
let e = o.activeCell?.col ?? 0;
|
|
169
|
+
if (n.shiftKey ? e <= 0 : e >= c.visibleColumns.length - 1) return;
|
|
170
|
+
n.preventDefault(), v(0, n.shiftKey ? -1 : 1, !1);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (n.key === "Escape") {
|
|
174
|
+
n.preventDefault(), _(t.clearSelection());
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if ((n.key === "Delete" || n.key === "Backspace") && k) {
|
|
178
|
+
n.preventDefault(), O();
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if ((n.key === "Enter" || n.key === " ") && o.activeCell) {
|
|
182
|
+
let e = s.getGroupRow?.(o.activeCell.row);
|
|
183
|
+
if (e) {
|
|
184
|
+
n.preventDefault(), j(e.groupKey);
|
|
85
185
|
return;
|
|
86
186
|
}
|
|
87
|
-
if (
|
|
88
|
-
n.preventDefault()
|
|
187
|
+
if (M && l[o.activeCell.col]?.key === "__ssg_detail_toggle__" && M(o.activeCell)) {
|
|
188
|
+
n.preventDefault();
|
|
89
189
|
return;
|
|
90
190
|
}
|
|
91
|
-
|
|
92
|
-
|
|
191
|
+
}
|
|
192
|
+
if (n.key === "Enter" || n.key === "F2") {
|
|
193
|
+
if (n.preventDefault(), o.activeCell) {
|
|
194
|
+
C(o.activeCell);
|
|
93
195
|
return;
|
|
94
196
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
197
|
+
n.key === "Enter" && g();
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (i(n) && o.activeCell) {
|
|
201
|
+
let r = s.getRow(o.activeCell.row), i = l[o.activeCell.col];
|
|
202
|
+
if (!r || !i || !e({
|
|
203
|
+
readOnly: u,
|
|
204
|
+
canEditCell: d
|
|
205
|
+
}, s, o.activeCell.row, o.activeCell.col, r, i)) return;
|
|
206
|
+
if (i.editor?.type === "checkbox") {
|
|
207
|
+
n.preventDefault(), n.key === " " && A(o.activeCell);
|
|
104
208
|
return;
|
|
105
209
|
}
|
|
106
|
-
|
|
107
|
-
let r = l.getRow(s.activeCell.row), i = u[s.activeCell.col];
|
|
108
|
-
if (!r || !i || !e({
|
|
109
|
-
readOnly: d,
|
|
110
|
-
canEditCell: f
|
|
111
|
-
}, l, s.activeCell.row, s.activeCell.col, r, i)) return;
|
|
112
|
-
if (i.editor?.type === "checkbox") {
|
|
113
|
-
n.preventDefault(), n.key === " " && w(s.activeCell);
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
n.preventDefault(), p(n.key), m(t.startEdit(s.activeCell));
|
|
117
|
-
}
|
|
210
|
+
n.preventDefault(), h(n.key), _(t.startEdit(o.activeCell));
|
|
118
211
|
}
|
|
119
212
|
}
|
|
120
213
|
};
|
|
121
214
|
};
|
|
122
215
|
//#endregion
|
|
123
|
-
export {
|
|
216
|
+
export { c as createKeyboardController };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/sorting.cjs"),t=require("../logic/detailRow.cjs"),n=require("../model/gridActions.cjs"),r=require("../logic/geometry.cjs"),i=require("../logic/autoScrollGeometry.cjs"),a=require("../logic/verticalGeometry.cjs");var o=10,s=300,c=()=>{let o=null,s=!1,c=!1,l=null,u=null,d=`mouse`,f=null,p=null,m=!1,h=!1,g=()=>o?.uiState.dragState??null,_=e=>{let t=o?.footerHeight??0,n=o?.scrollContainerRef.current??null;return t<=0||!n?e:i.clampClientYAboveFooter(e,n.getBoundingClientRect().top+n.clientTop+n.clientHeight,t)},v=(e,t)=>{if(o===null)return null;let{bodyScrollRef:n,scrollContainerRef:i,leftPaneScrollRef:s,rightPaneScrollRef:c,filteredRowsLength:l,visibleColumnsLength:u,paneLayout:d,leftLeadingWidth:f,centerLeadingWidth:p,rightLeadingWidth:m,headerHeight:h,rowMetrics:g,verticalScaleFactor:v}=o,y=n.current;if(!y||l===0||u===0)return null;let b=y.getBoundingClientRect(),x=a.clientYToRowIndex(y.scrollTop+_(t)-b.top-h,i.current?.scrollTop??0,v,g),S=null,C=s.current;if(S===null&&C&&d.left.entries.length>0){let t=C.getBoundingClientRect();if(e<t.right){let n=e-t.left-f;S=r.findLogicalIndexFromPaneOffset(d.left,n)}}let w=c.current;if(S===null&&w&&d.right.entries.length>0){let t=w.getBoundingClientRect();if(e>=t.left){let n=e-t.left-m;S=r.findLogicalIndexFromPaneOffset(d.right,n)}}if(S===null&&d.center.entries.length>0){let t=y.scrollLeft+e-b.left-p;S=r.findLogicalIndexFromPaneOffset(d.center,Math.max(t,0))}return S===null?null:{row:x,col:r.clamp(S,0,u-1)}},y=(e,t)=>{let r=g();if(o===null||!r||r.type!==`selection`)return;let i=v(e,t);if(i){if(r.selectionKind===`cell`){o.dispatch(n.gridActions.updateSelection(i));return}if(r.selectionKind===`row`){o.dispatch(n.gridActions.updateRowSelection(i.row));return}r.selectionKind===`col`&&o.dispatch(n.gridActions.updateColumnSelection(i.col))}},b=(e,t)=>{let r=t.timeStamp;if(o===null)return;let{gridRootRef:i,dispatch:a,enableRangeSelection:s,enableRowSelection:c,onGutterRowSelect:l,onCellDoubleClickRef:d}=o;i.current?.focus({preventScroll:!0});let{target:f}=e;if(f.kind===`cell`){let e=u;if(e&&e.cell.row===f.cell.row&&e.cell.col===f.cell.col&&r-e.time<300){u=null,d.current(f.cell,t);return}u={cell:f.cell,time:r},a(n.gridActions.activateCell(f.cell)),s&&(a(n.gridActions.startSelection(f.cell)),a(n.gridActions.endSelection()));return}if(u=null,f.kind===`row`){if(c){l(f.rowIndex,{shiftKey:!1});return}a(n.gridActions.startRowSelection(f.rowIndex)),a(n.gridActions.endSelection());return}a(n.gridActions.startColumnSelection(f.colIndex)),a(n.gridActions.endSelection())},x=()=>{o!==null&&(c=!1,o.dispatch(n.gridActions.endSelection()),o.dispatch(n.gridActions.endColumnResize()))},S=e=>{o!==null&&(o.pointerClientRef.current={x:e.clientX,y:e.clientY},g()?.type===`columnResize`&&o.dispatch(n.gridActions.updateColumnResize(e.clientX)))},C=e=>{let t=l;t&&(l=null,e.pointerId===t.pointerId&&Math.abs(e.clientX-t.x)<10&&Math.abs(e.clientY-t.y)<10&&b(t,e)),x()},w=()=>{l=null,x()},T=()=>{s||(s=!0,window.addEventListener(`pointermove`,S),window.addEventListener(`pointerup`,C),window.addEventListener(`pointercancel`,w))},E=()=>{s&&(s=!1,window.removeEventListener(`pointermove`,S),window.removeEventListener(`pointerup`,C),window.removeEventListener(`pointercancel`,w))},D=()=>{h=!1,o!==null&&o.autoScrollFrameRef.current!==null&&(cancelAnimationFrame(o.autoScrollFrameRef.current),o.autoScrollFrameRef.current=null)},O=()=>{if(o===null||!h)return;let{scrollContainerRef:e,pointerClientRef:t,autoScrollFrameRef:n}=o,r=e.current,a=t.current;if(!r||!a){n.current=requestAnimationFrame(O);return}if(!m){let e=p;if(e&&!i.hasPointerLeftActivationRadius(e,a,6)){n.current=requestAnimationFrame(O);return}m=!0}let s=r.getBoundingClientRect(),c=i.resolveScrollContentBox({rectLeft:s.left,rectTop:s.top,clientLeft:r.clientLeft,clientTop:r.clientTop,clientWidth:r.clientWidth,clientHeight:r.clientHeight}),l=g(),u=l?.type===`selection`&&l.selectionKind===`col`,d=l?.type===`selection`&&l.selectionKind===`row`,f=u?0:i.resolveAutoScrollAxisDirection(a.y,c.top,c.bottom-(o.footerHeight??0),24),_=d?0:i.resolveAutoScrollAxisDirection(a.x,c.left,c.right,24),v=i.computeNextScrollPosition(r.scrollTop,f,18,r.scrollHeight-r.clientHeight),b=i.computeNextScrollPosition(r.scrollLeft,_,18,r.scrollWidth-r.clientWidth);(v!==r.scrollTop||b!==r.scrollLeft)&&(r.scrollTo({top:v,left:b,behavior:`auto`}),y(a.x,a.y)),n.current=requestAnimationFrame(O)},k=()=>{let e=g()?.type===`selection`;e&&!h?(h=!0,o!==null&&(o.autoScrollFrameRef.current=requestAnimationFrame(O))):!e&&h&&D()},A=()=>{if(f!==null)return;let e=()=>{if(!c||o===null){f=null;return}let{scrollContainerRef:t,pointerClientRef:n,onGutterRowSelectDrag:r}=o,a=t.current,s=n.current;if(!a||!s){f=requestAnimationFrame(e);return}if(!m){let t=p;if(t&&!i.hasPointerLeftActivationRadius(t,s,6)){f=requestAnimationFrame(e);return}m=!0}let l=a.getBoundingClientRect(),u=i.resolveScrollContentBox({rectLeft:l.left,rectTop:l.top,clientLeft:a.clientLeft,clientTop:a.clientTop,clientWidth:a.clientWidth,clientHeight:a.clientHeight}),d=i.resolveAutoScrollAxisDirection(s.y,u.top,u.bottom-(o.footerHeight??0),24),h=i.computeNextScrollPosition(a.scrollTop,d,18,a.scrollHeight-a.clientHeight);if(h!==a.scrollTop){a.scrollTo({top:h,left:a.scrollLeft,behavior:`auto`});let e=v(s.x,s.y);e&&r(e.row)}f=requestAnimationFrame(e)};f=requestAnimationFrame(e)},j=(e,t)=>(e.preventDefault(),o===null||e.button!==0?!1:(d=e.pointerType,e.pointerType===`touch`?(l={pointerId:e.pointerId,x:e.clientX,y:e.clientY,target:t},!1):(o.gridRootRef.current?.focus({preventScroll:!0}),o.pointerClientRef.current={x:e.clientX,y:e.clientY},p={x:e.clientX,y:e.clientY},m=!1,!0)));return{update:e=>{o=e,T(),k()},getCellCoordFromClientPoint:v,updateSelectionFromPointer:y,handleCellPointerDown:(e,t)=>{!j(t,{kind:`cell`,cell:e})||o===null
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/sorting.cjs"),t=require("../logic/detailRow.cjs"),n=require("../model/gridActions.cjs"),r=require("../logic/geometry.cjs"),i=require("../logic/autoScrollGeometry.cjs"),a=require("../logic/verticalGeometry.cjs");var o=10,s=300,c=()=>{let o=null,s=!1,c=!1,l=null,u=null,d=`mouse`,f=null,p=null,m=!1,h=!1,g=()=>o?.uiState.dragState??null,_=e=>{let t=o?.footerHeight??0,n=o?.scrollContainerRef.current??null;return t<=0||!n?e:i.clampClientYAboveFooter(e,n.getBoundingClientRect().top+n.clientTop+n.clientHeight,t)},v=(e,t)=>{if(o===null)return null;let{bodyScrollRef:n,scrollContainerRef:i,leftPaneScrollRef:s,rightPaneScrollRef:c,filteredRowsLength:l,visibleColumnsLength:u,paneLayout:d,leftLeadingWidth:f,centerLeadingWidth:p,rightLeadingWidth:m,headerHeight:h,rowMetrics:g,verticalScaleFactor:v}=o,y=n.current;if(!y||l===0||u===0)return null;let b=y.getBoundingClientRect(),x=a.clientYToRowIndex(y.scrollTop+_(t)-b.top-h,i.current?.scrollTop??0,v,g),S=null,C=s.current;if(S===null&&C&&d.left.entries.length>0){let t=C.getBoundingClientRect();if(e<t.right){let n=e-t.left-f;S=r.findLogicalIndexFromPaneOffset(d.left,n)}}let w=c.current;if(S===null&&w&&d.right.entries.length>0){let t=w.getBoundingClientRect();if(e>=t.left){let n=e-t.left-m;S=r.findLogicalIndexFromPaneOffset(d.right,n)}}if(S===null&&d.center.entries.length>0){let t=y.scrollLeft+e-b.left-p;S=r.findLogicalIndexFromPaneOffset(d.center,Math.max(t,0))}return S===null?null:{row:x,col:r.clamp(S,0,u-1)}},y=(e,t)=>{let r=g();if(o===null||!r||r.type!==`selection`)return;let i=v(e,t);if(i){if(r.selectionKind===`cell`){o.dispatch(n.gridActions.updateSelection(i));return}if(r.selectionKind===`row`){o.dispatch(n.gridActions.updateRowSelection(i.row));return}r.selectionKind===`col`&&o.dispatch(n.gridActions.updateColumnSelection(i.col))}},b=(e,t)=>{let r=t.timeStamp;if(o===null)return;let{gridRootRef:i,dispatch:a,enableRangeSelection:s,enableRowSelection:c,onGutterRowSelect:l,onCellDoubleClickRef:d}=o;i.current?.focus({preventScroll:!0});let{target:f}=e;if(f.kind===`cell`){let e=u;if(e&&e.cell.row===f.cell.row&&e.cell.col===f.cell.col&&r-e.time<300){u=null,d.current(f.cell,t);return}u={cell:f.cell,time:r},a(n.gridActions.activateCell(f.cell)),s&&(a(n.gridActions.startSelection(f.cell)),a(n.gridActions.endSelection()));return}if(u=null,f.kind===`row`){if(c){l(f.rowIndex,{shiftKey:!1});return}a(n.gridActions.startRowSelection(f.rowIndex)),a(n.gridActions.endSelection());return}a(n.gridActions.startColumnSelection(f.colIndex)),a(n.gridActions.endSelection())},x=()=>{o!==null&&(c=!1,o.dispatch(n.gridActions.endSelection()),o.dispatch(n.gridActions.endColumnResize()))},S=e=>{o!==null&&(o.pointerClientRef.current={x:e.clientX,y:e.clientY},g()?.type===`columnResize`&&o.dispatch(n.gridActions.updateColumnResize(e.clientX)))},C=e=>{let t=l;t&&(l=null,e.pointerId===t.pointerId&&Math.abs(e.clientX-t.x)<10&&Math.abs(e.clientY-t.y)<10&&b(t,e)),x()},w=()=>{l=null,x()},T=()=>{s||(s=!0,window.addEventListener(`pointermove`,S),window.addEventListener(`pointerup`,C),window.addEventListener(`pointercancel`,w))},E=()=>{s&&(s=!1,window.removeEventListener(`pointermove`,S),window.removeEventListener(`pointerup`,C),window.removeEventListener(`pointercancel`,w))},D=()=>{h=!1,o!==null&&o.autoScrollFrameRef.current!==null&&(cancelAnimationFrame(o.autoScrollFrameRef.current),o.autoScrollFrameRef.current=null)},O=()=>{if(o===null||!h)return;let{scrollContainerRef:e,pointerClientRef:t,autoScrollFrameRef:n}=o,r=e.current,a=t.current;if(!r||!a){n.current=requestAnimationFrame(O);return}if(!m){let e=p;if(e&&!i.hasPointerLeftActivationRadius(e,a,6)){n.current=requestAnimationFrame(O);return}m=!0}let s=r.getBoundingClientRect(),c=i.resolveScrollContentBox({rectLeft:s.left,rectTop:s.top,clientLeft:r.clientLeft,clientTop:r.clientTop,clientWidth:r.clientWidth,clientHeight:r.clientHeight}),l=g(),u=l?.type===`selection`&&l.selectionKind===`col`,d=l?.type===`selection`&&l.selectionKind===`row`,f=u?0:i.resolveAutoScrollAxisDirection(a.y,c.top,c.bottom-(o.footerHeight??0),24),_=d?0:i.resolveAutoScrollAxisDirection(a.x,c.left,c.right,24),v=i.computeNextScrollPosition(r.scrollTop,f,18,r.scrollHeight-r.clientHeight),b=i.computeNextScrollPosition(r.scrollLeft,_,18,r.scrollWidth-r.clientWidth);(v!==r.scrollTop||b!==r.scrollLeft)&&(r.scrollTo({top:v,left:b,behavior:`auto`}),y(a.x,a.y)),n.current=requestAnimationFrame(O)},k=()=>{let e=g()?.type===`selection`;e&&!h?(h=!0,o!==null&&(o.autoScrollFrameRef.current=requestAnimationFrame(O))):!e&&h&&D()},A=()=>{if(f!==null)return;let e=()=>{if(!c||o===null){f=null;return}let{scrollContainerRef:t,pointerClientRef:n,onGutterRowSelectDrag:r}=o,a=t.current,s=n.current;if(!a||!s){f=requestAnimationFrame(e);return}if(!m){let t=p;if(t&&!i.hasPointerLeftActivationRadius(t,s,6)){f=requestAnimationFrame(e);return}m=!0}let l=a.getBoundingClientRect(),u=i.resolveScrollContentBox({rectLeft:l.left,rectTop:l.top,clientLeft:a.clientLeft,clientTop:a.clientTop,clientWidth:a.clientWidth,clientHeight:a.clientHeight}),d=i.resolveAutoScrollAxisDirection(s.y,u.top,u.bottom-(o.footerHeight??0),24),h=i.computeNextScrollPosition(a.scrollTop,d,18,a.scrollHeight-a.clientHeight);if(h!==a.scrollTop){a.scrollTo({top:h,left:a.scrollLeft,behavior:`auto`});let e=v(s.x,s.y);e&&r(e.row)}f=requestAnimationFrame(e)};f=requestAnimationFrame(e)},j=(e,t)=>(e.preventDefault(),o===null||e.button!==0?!1:(d=e.pointerType,e.pointerType===`touch`?(l={pointerId:e.pointerId,x:e.clientX,y:e.clientY,target:t},!1):(o.gridRootRef.current?.focus({preventScroll:!0}),o.pointerClientRef.current={x:e.clientX,y:e.clientY},p={x:e.clientX,y:e.clientY},m=!1,!0)));return{update:e=>{o=e,T(),k()},getCellCoordFromClientPoint:v,updateSelectionFromPointer:y,handleCellPointerDown:(e,t)=>{if(!(!j(t,{kind:`cell`,cell:e})||o===null)){if(t.shiftKey&&o.enableRangeSelection){let{selection:t,activeCell:r}=o.uiState,i=t?.type===`cell`?t.range.start:r;if(i){o.dispatch(n.gridActions.startSelection(i)),o.dispatch(n.gridActions.updateSelection(e));return}}o.dispatch(n.gridActions.activateCell(e)),o.enableRangeSelection&&o.dispatch(n.gridActions.startSelection(e))}},handleCellDoubleClick:(e,t)=>{d===`touch`||o===null||o.onCellDoubleClickRef.current(e,t)},handleCellPointerEnter:(e,t)=>{if(o===null||(o.enableRowHover&&o.setHoveredRowIndex(e.row),o.enableColumnHover&&o.setHoveredColumnIndex(e.col),!o.enableRangeSelection))return;let r=g();r?.type!==`selection`||r.selectionKind!==`cell`||(o.pointerClientRef.current={x:t.clientX,y:t.clientY},o.dispatch(n.gridActions.updateSelection(e)))},handleNativeDragStart:e=>{e.preventDefault()},handleRowHeaderPointerDown:(e,t)=>{if(!(!j(t,{kind:`row`,rowIndex:e})||o===null)){if(o.enableRowSelection){c=!0,o.onGutterRowSelect(e,{shiftKey:t.shiftKey}),A();return}o.dispatch(n.gridActions.startRowSelection(e))}},handleRowHeaderPointerEnter:(e,t)=>{if(o===null)return;if(o.enableRowHover&&o.setHoveredRowIndex(e),c){o.pointerClientRef.current={x:t.clientX,y:t.clientY},o.onGutterRowSelectDrag(e);return}let r=g();r?.type!==`selection`||r.selectionKind!==`row`||(o.pointerClientRef.current={x:t.clientX,y:t.clientY},o.dispatch(n.gridActions.updateRowSelection(e)))},handleColumnHeaderPointerDown:(r,i)=>{if(!(!j(i,{kind:`col`,colIndex:r})||o===null)){if(i.shiftKey&&o.enableSorting){let i=o.orderedColumns[r];if(i&&!t.isSyntheticColumnKey(i.key)){let t=o.uiState.sort,r=t.find(e=>e.columnKey===i.key)?.direction?`desc`:`asc`,a=e.nextSortEntries(t,i.key,r,!0);o.dispatch(a.length===0?n.gridActions.clearSort():n.gridActions.setSort(a))}return}o.dispatch(n.gridActions.startColumnSelection(r))}},handleColumnHeaderPointerEnter:(e,t)=>{if(o===null)return;o.setHoveredRowIndex(null),o.enableColumnHeaderHover&&o.setHoveredColumnIndex(e);let r=g();r?.type!==`selection`||r.selectionKind!==`col`||(o.pointerClientRef.current={x:t.clientX,y:t.clientY},o.dispatch(n.gridActions.updateColumnSelection(e)))},dispose:()=>{E(),D(),f!==null&&(cancelAnimationFrame(f),f=null)}}};exports.TOUCH_DOUBLE_TAP_MS=s,exports.TOUCH_TAP_SLOP_PX=o,exports.createPointerInteractionsController=c;
|
|
@@ -187,10 +187,19 @@ var d = 10, f = 300, p = () => {
|
|
|
187
187
|
getCellCoordFromClientPoint: C,
|
|
188
188
|
updateSelectionFromPointer: w,
|
|
189
189
|
handleCellPointerDown: (e, t) => {
|
|
190
|
-
!I(t, {
|
|
190
|
+
if (!(!I(t, {
|
|
191
191
|
kind: "cell",
|
|
192
192
|
cell: e
|
|
193
|
-
}) || d === null
|
|
193
|
+
}) || d === null)) {
|
|
194
|
+
if (t.shiftKey && d.enableRangeSelection) {
|
|
195
|
+
let { selection: t, activeCell: r } = d.uiState, i = t?.type === "cell" ? t.range.start : r;
|
|
196
|
+
if (i) {
|
|
197
|
+
d.dispatch(n.startSelection(i)), d.dispatch(n.updateSelection(e));
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
d.dispatch(n.activateCell(e)), d.enableRangeSelection && d.dispatch(n.startSelection(e));
|
|
202
|
+
}
|
|
194
203
|
},
|
|
195
204
|
handleCellDoubleClick: (e, t) => {
|
|
196
205
|
g === "touch" || d === null || d.onCellDoubleClickRef.current(e, t);
|
|
@@ -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(()=>{e.isFocusInsideDetailCard()||t.current?.focus()})},r=(e,t)=>e.current?.contains(t)===!0,i=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);return{attach:()=>{t||(t=!0,window.addEventListener(`resize`,n),window.addEventListener(`scroll`,r,!0),window.addEventListener(`pointerdown`,i),window.addEventListener(`keydown`,a,!0))},detach:()=>{t&&(t=!1,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=i,exports.isInsideGridRoot=r,exports.restoreGridFocus=n;
|
|
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(()=>{e.isFocusInsideDetailCard()||t.current?.focus()})},r=(e,t)=>e.current?.contains(t)===!0,i=(e,t,n=`[role="menuitem"]`)=>{let r=document.activeElement,i=r instanceof HTMLElement&&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},a=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);return{attach:()=>{t||(t=!0,window.addEventListener(`resize`,n),window.addEventListener(`scroll`,r,!0),window.addEventListener(`pointerdown`,i),window.addEventListener(`keydown`,a,!0))},detach:()=>{t&&(t=!1,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=a,exports.handleMenuKeyNavigation=i,exports.isInsideGridRoot=r,exports.restoreGridFocus=n;
|
|
@@ -4,6 +4,7 @@ export type ReadonlyElementRef<E extends HTMLElement = HTMLElement> = {
|
|
|
4
4
|
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
|
+
export declare const handleMenuKeyNavigation: (panel: HTMLElement, event: KeyboardEvent, itemSelector?: string) => boolean;
|
|
7
8
|
export type PopoverWindowHandlers = {
|
|
8
9
|
onResize?: () => void;
|
|
9
10
|
onScroll?: (event: Event) => void;
|
|
@@ -6,7 +6,19 @@ var t = (e) => {
|
|
|
6
6
|
requestAnimationFrame(() => {
|
|
7
7
|
e() || t.current?.focus();
|
|
8
8
|
});
|
|
9
|
-
}, r = (e, t) => e.current?.contains(t) === !0, i = (e) => {
|
|
9
|
+
}, r = (e, t) => e.current?.contains(t) === !0, i = (e, t, n = "[role=\"menuitem\"]") => {
|
|
10
|
+
let r = document.activeElement, i = r instanceof HTMLElement && e.contains(r);
|
|
11
|
+
if (i && !r.matches(n)) return !1;
|
|
12
|
+
let a = t.key;
|
|
13
|
+
if (a === "ArrowDown" || a === "ArrowUp" || a === "Home" || a === "End") {
|
|
14
|
+
t.preventDefault();
|
|
15
|
+
let o = Array.from(e.querySelectorAll(`${n}:not(:disabled):not([aria-disabled="true"])`));
|
|
16
|
+
if (o.length === 0) return !0;
|
|
17
|
+
let s = i ? o.indexOf(r) : -1, c;
|
|
18
|
+
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;
|
|
19
|
+
}
|
|
20
|
+
return !i && (a === "PageUp" || a === "PageDown" || a === " " || a === "ArrowLeft" || a === "ArrowRight") ? (t.preventDefault(), !0) : !1;
|
|
21
|
+
}, a = (e) => {
|
|
10
22
|
let t = !1, n = () => e.onResize?.(), r = (t) => e.onScroll?.(t), i = (t) => {
|
|
11
23
|
let n = t.target;
|
|
12
24
|
n && (e.isInside(n) || e.onOutsidePointerDown(n));
|
|
@@ -22,4 +34,4 @@ var t = (e) => {
|
|
|
22
34
|
};
|
|
23
35
|
};
|
|
24
36
|
//#endregion
|
|
25
|
-
export { t as blurForPopover,
|
|
37
|
+
export { t as blurForPopover, a as createPopoverWindowBindings, i as handleMenuKeyNavigation, r as isInsideGridRoot, n 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/slotDom.cjs");var i=14,a=12,o=`0.5`,s=`<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>`,c=`<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>`,l=200,u=`cubic-bezier(0.2, 0.7, 0.3, 1)`,d=`transform 160ms ${u}`,f=`data-ssg-row-dragging`,p=e=>e?.closest(`.ssg-motion-off`)!=null,m=/translateY\((-?[\d.]+)px\)/,h=e=>{let n=[];return e.querySelectorAll(`.ssg-body-row[data-row-index]`).forEach(r=>{t.isInsideDetailCardOf(e,r)||n.push(r)}),n},g=()=>{let g=null,_=null,v=null,y={x:0,y:0},b=null,x=!1,S=null,C=null,w=null,T=null,E=null,D=null,O=0,k=()=>g?.motion===`live`,A=null,j=null,M=null,N=()=>[g?.leftIndicatorRef.current??null,g?.centerIndicatorRef.current??null,g?.rightIndicatorRef.current??null],P=()=>{for(let e of N())e&&(e.style.display=`none`)},F=e=>{if(A)return;let t=document.createElement(`div`);t.setAttribute(`data-grid-drag-ghost`,``),g?.scrollContainerRef.current?.closest(`.ssg-theme-dark`)!=null&&t.classList.add(`ssg-theme-dark`),g?.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(`;`),r.applySlotToElement(t,g?.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 i=document.createElement(`span`);i.style.cssText=`overflow:hidden;text-overflow:ellipsis`,i.textContent=e,t.appendChild(n),t.appendChild(i),document.body.appendChild(t),A=t,j=n,M=null},I=e=>{let t=A;if(!t)return;t.style.transform=`translate(`+(y.x+i)+`px,`+(y.y+a)+`px)`;let n=e?`move`:`out`;if(M===n)return;M=n;let r=j;n===`out`?(t.style.opacity=o,r&&(r.innerHTML=c)):(t.style.opacity=`1`,r&&(r.innerHTML=s))},L=()=>{A&&A.parentNode&&A.parentNode.removeChild(A),A=null,j=null,M=null},R=(e,n)=>{let r=g?.scrollContainerRef.current??null;!r||n&&e===null||r.querySelectorAll(n?`.ssg-body-row[data-row-index="${e}"]`:`.ssg-body-row[${f}]`).forEach(e=>{t.isInsideDetailCardOf(r,e)||(n?e.setAttribute(f,k()?`live`:``):e.removeAttribute(f))})},z=()=>{let e=g?.scrollContainerRef.current??null;if(!e)return null;let t=new Map;for(let n of h(e)){let e=m.exec(n.style.transform);e&&t.set(n,{index:Number(n.getAttribute(`data-row-index`)),baseY:parseFloat(e[1])})}return t},B=t=>{let n=D,r=_;if(!n||r===null||g===null)return;let i=g.scrollContainerRef.current;if(!i)return;for(let e of h(i)){if(n.has(e))continue;let t=m.exec(e.style.transform);t&&n.set(e,{index:Number(e.getAttribute(`data-row-index`)),baseY:parseFloat(t[1])})}let a=g.rowMetrics.rowsHeight(r,r),o=(i.scrollTop-O)*g.verticalScaleFactor,s=(b?y.y-b.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=d,t.style.transform=`translateY(${o+l}px)`,e.applied=t.style.transform})},V=(t,r)=>{if(g===null)return null;let{scrollContainerRef:i,bodyScrollRef:a,rowMetrics:o,headerHeight:s,verticalScaleFactor:c,windowBaseOffsetPx:l}=g,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,g.footerHeight??0),m=d.getBoundingClientRect(),h=e.resolveRowDropSlot(d.scrollTop+p-m.top-s-u.scrollTop*(1-c),o);return{slot:h,top:s+e.resolveRowDropSlotTop(h,o)-l}},H=()=>{let t=V(y.x,y.y),n=_;if(k()){t&&n!==null&&(v=e.resolveMoveTargetIndex(n,t.slot)===null?null:t.slot),P(),B(v);return}if(I(t),!t||n===null||e.resolveMoveTargetIndex(n,t.slot)===null){v=null,P();return}v=t.slot;for(let e of N())e&&(e.style.top=`${t.top}px`,e.style.display=`block`)},U=()=>{if(_===null){w=null;return}let e=g?.scrollContainerRef.current??null;if(e&&(x||(!b||n.hasPointerLeftActivationRadius(b,y,6))&&(x=!0),x)){let t=e.getBoundingClientRect(),r=n.resolveScrollContentBox({rectLeft:t.left,rectTop:t.top,clientLeft:e.clientLeft,clientTop:e.clientTop,clientWidth:e.clientWidth,clientHeight:e.clientHeight}),i=n.resolveAutoScrollAxisDirection(y.y,r.top,r.bottom-(g?.footerHeight??0),24),a=n.computeNextScrollPosition(e.scrollTop,i,18,e.scrollHeight-e.clientHeight);a!==e.scrollTop&&e.scrollTo({top:a,behavior:`auto`})}H(),w=requestAnimationFrame(U)},W=(e,t)=>`${e.getAttribute(`data-pane`)??``}|${t}`,G=()=>{let e=g?.scrollContainerRef.current??null;if(!e)return null;let t=new Map;for(let n of h(e))t.set(W(n,Number(n.getAttribute(`data-row-index`))),n.getBoundingClientRect().top);return t},K=t=>{w!==null&&(cancelAnimationFrame(w),w=null),document.body.style.cursor=``,P(),L();let n=_,r=v,i=E;R(n,!1),_=null,E=null,v=null,b=null,C=null;let a=n===null||r===null?null:e.resolveMoveTargetIndex(n,r),o=t&&n!==null&&a!==null&&g!==null,s=D;D=null;let c=s&&o&&g!==null&&!p(g.scrollContainerRef.current)?G():null;if(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=d,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||g===null)return;let l=c??(p(g.scrollContainerRef.current)?null:G()),u=l?{tops:l,from:n,to:a,row:i}:null;T=u,g.commitRowMove(n,a),u&&requestAnimationFrame(()=>{T===u&&(T=null)})},q=()=>{let e=T;if(T=null,!e)return;let t=g?.scrollContainerRef.current??null;if(!t)return;let{tops:n,from:r,to:i}=e;if(g?.locateDragRow&&e.row!==null&&g.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;if(h(t).forEach(e=>{let t=n.get(W(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=m.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)}),o.length!==0){t.getBoundingClientRect();for(let e of o)e.style.transition=`transform ${l}ms ${u}`,e.style.transform=`translateY(${s.get(e)??0}px)`;window.setTimeout(()=>{for(let e of o)e.style.transition=``,e.style.willChange=``},280)}},J=(e,t)=>{if(g===null||!g.enabled||t.button!==0)return;if(t.stopPropagation(),t.preventDefault(),_!==null){if(t.pointerId!==C)return;S?.(),K(!1)}_=e,E=g.getDragRow?.(e)??null,C=t.pointerId,v=null,y={x:t.clientX,y:t.clientY},b={x:t.clientX,y:t.clientY},x=!1,document.body.style.cursor=`grabbing`,k()?(D=z(),O=g.scrollContainerRef.current?.scrollTop??0):F(g.getRowDragLabel(e)),R(e,!0);let n=t.currentTarget,r=t.pointerId;try{n.setPointerCapture(r)}catch{}let i=e=>{e.pointerId===r&&(y={x:e.clientX,y:e.clientY},H())},a=()=>{window.removeEventListener(`pointermove`,i),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,s),window.removeEventListener(`keydown`,c),window.removeEventListener(`blur`,l),S=null;try{n.releasePointerCapture(r)}catch{}};function o(e){e.pointerId===r&&(a(),K(!0))}function s(e){e.pointerId===r&&(a(),K(!1))}function c(e){e.key===`Escape`&&(a(),K(!1))}function l(){a(),K(!1)}window.addEventListener(`pointermove`,i),window.addEventListener(`pointerup`,o),window.addEventListener(`pointercancel`,s),window.addEventListener(`keydown`,c),window.addEventListener(`blur`,l),S=a,H(),w=requestAnimationFrame(U)},Y=e=>{if(_===null||E==null||g?.locateDragRow===void 0)return;let t=g.locateDragRow(E,_);if(D&&D.forEach((e,t)=>{if(!t.isConnected){D?.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=m.exec(t.style.transform);if(!r){D?.delete(t);return}e.index=n,e.baseY=parseFloat(r[1]),e.applied=void 0}),t===null){S?.(),K(!1);return}D&&t!==_&&b!==null&&e!==null&&(b={x:b.x,y:b.y+g.rowMetrics.rowTop(t)-e.rowTop(_)}),t!==_&&(R(null,!1),_=t,R(t,!0)),H()};return{update:e=>{let t=g;g=e,_!==null&&t!==null&&t.locateDragRow!==e.locateDragRow&&Y(t.rowMetrics)},onRowDragHandlePointerDown:J,applyReorderSettle:q,dispose:()=>{S?.(),S=null,w!==null&&(cancelAnimationFrame(w),w=null),document.body.style.cursor=``,L(),R(_,!1),_=null,E=null,v=null,D=null,T=null}}};exports.createRowDragController=g;
|
|
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/slotDom.cjs");var i=14,a=12,o=`0.5`,s=`<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>`,c=`<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>`,l=200,u=`cubic-bezier(0.2, 0.7, 0.3, 1)`,d=`transform 160ms ${u}`,f=`data-ssg-row-dragging`,p=e=>e?.closest(`.ssg-motion-off`)!=null,m=/translateY\((-?[\d.]+)px\)/,h=e=>{let n=[];return e.querySelectorAll(`.ssg-body-row[data-row-index]`).forEach(r=>{t.isInsideDetailCardOf(e,r)||n.push(r)}),n},g=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},_=e=>{e.style.transition=``,e.style.transform=``,e.style.willChange=``,e.style.zIndex=``},v=()=>{let v=null,y=null,b=null,x={x:0,y:0},S=null,C=!1,w=null,T=null,E=null,D=null,O=null,k=null,A=0,j=null,M=()=>v?.motion===`live`,N=null,P=null,F=null,I=()=>[v?.leftIndicatorRef.current??null,v?.centerIndicatorRef.current??null,v?.rightIndicatorRef.current??null],L=()=>{for(let e of I())e&&(e.style.display=`none`)},R=e=>{if(N)return;let t=document.createElement(`div`);t.setAttribute(`data-grid-drag-ghost`,``),v?.scrollContainerRef.current?.closest(`.ssg-theme-dark`)!=null&&t.classList.add(`ssg-theme-dark`),v?.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(`;`),r.applySlotToElement(t,v?.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 i=document.createElement(`span`);i.style.cssText=`overflow:hidden;text-overflow:ellipsis`,i.textContent=e,t.appendChild(n),t.appendChild(i),document.body.appendChild(t),N=t,P=n,F=null},z=e=>{let t=N;if(!t)return;t.style.transform=`translate(`+(x.x+i)+`px,`+(x.y+a)+`px)`;let n=e?`move`:`out`;if(F===n)return;F=n;let r=P;n===`out`?(t.style.opacity=o,r&&(r.innerHTML=c)):(t.style.opacity=`1`,r&&(r.innerHTML=s))},B=()=>{N&&N.parentNode&&N.parentNode.removeChild(N),N=null,P=null,F=null},V=(e,n)=>{let r=v?.scrollContainerRef.current??null;!r||n&&e===null||r.querySelectorAll(n?`.ssg-body-row[data-row-index="${e}"]`:`.ssg-body-row[${f}]`).forEach(e=>{t.isInsideDetailCardOf(r,e)||(n?e.setAttribute(f,M()?`live`:``):e.removeAttribute(f))})},H=()=>{let e=v?.scrollContainerRef.current??null;if(!e)return null;let t=new Map;for(let n of h(e)){let e=m.exec(n.style.transform);e&&t.set(n,{index:Number(n.getAttribute(`data-row-index`)),baseY:parseFloat(e[1])})}return t},U=t=>{let n=k,r=y;if(!n||r===null||v===null)return;let i=v.scrollContainerRef.current;if(!i)return;for(let e of h(i)){if(n.has(e))continue;let t=m.exec(e.style.transform);t&&n.set(e,{index:Number(e.getAttribute(`data-row-index`)),baseY:parseFloat(t[1])})}let a=v.rowMetrics.rowsHeight(r,r),o=(i.scrollTop-A)*v.verticalScaleFactor,s=(S?x.y-S.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=d,t.style.transform=`translateY(${o+l}px)`,e.applied=t.style.transform});let l=j??new Set;j=l;for(let{el:e,index:t}of g(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=d,e.style.transform=`translateY(${n}px)`,e.style.zIndex=``}},W=(t,r)=>{if(v===null)return null;let{scrollContainerRef:i,bodyScrollRef:a,rowMetrics:o,headerHeight:s,verticalScaleFactor:c,windowBaseOffsetPx:l}=v,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,v.footerHeight??0),m=d.getBoundingClientRect(),h=d.scrollTop+p-m.top-s-u.scrollTop*(1-c),g=e.resolveRowDropSlot(h,o),_=y,b=_!==null&&M()?o.detailHeight(_):0;if(_!==null&&b>0){let t=e.resolveRowDropSlot(h+b,o);t>_+1&&(g=t)}let x=e.resolveRowDropSlotTop(g,o);return{slot:g,top:s+x-l}},G=()=>{let t=W(x.x,x.y),n=y;if(M()){t&&n!==null&&(b=e.resolveMoveTargetIndex(n,t.slot)===null?null:t.slot),L(),U(b);return}if(z(t),!t||n===null||e.resolveMoveTargetIndex(n,t.slot)===null){b=null,L();return}b=t.slot;for(let e of I())e&&(e.style.top=`${t.top}px`,e.style.display=`block`)},K=()=>{if(y===null){E=null;return}let e=v?.scrollContainerRef.current??null;if(e&&(C||(!S||n.hasPointerLeftActivationRadius(S,x,6))&&(C=!0),C)){let t=e.getBoundingClientRect(),r=n.resolveScrollContentBox({rectLeft:t.left,rectTop:t.top,clientLeft:e.clientLeft,clientTop:e.clientTop,clientWidth:e.clientWidth,clientHeight:e.clientHeight}),i=n.resolveAutoScrollAxisDirection(x.y,r.top,r.bottom-(v?.footerHeight??0),24),a=n.computeNextScrollPosition(e.scrollTop,i,18,e.scrollHeight-e.clientHeight);a!==e.scrollTop&&e.scrollTo({top:a,behavior:`auto`})}G(),E=requestAnimationFrame(K)},q=(e,t)=>`${e.getAttribute(`data-pane`)??``}|${t}`,J=()=>{let e=v?.scrollContainerRef.current??null;if(!e)return null;let t=new Map;for(let n of h(e))t.set(q(n,Number(n.getAttribute(`data-row-index`))),n.getBoundingClientRect().top);for(let n of g(e))t.set(n.key,n.el.getBoundingClientRect().top);return t},Y=t=>{E!==null&&(cancelAnimationFrame(E),E=null),document.body.style.cursor=``,L(),B();let n=y,r=b,i=O;V(n,!1),y=null,O=null,b=null,S=null,T=null;let a=n===null||r===null?null:e.resolveMoveTargetIndex(n,r),o=t&&n!==null&&a!==null&&v!==null,s=k;k=null;let c=s&&o&&v!==null&&!p(v.scrollContainerRef.current)?J():null,l=j;if(j=null,l&&(o?l.forEach(_):(l.forEach(e=>{e.isConnected&&(e.style.transition=d,e.style.transform=`translateY(0px)`,e.style.zIndex=``)}),window.setTimeout(()=>{l.forEach(e=>{j?.has(e)||_(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=d,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||v===null)return;let u=c??(p(v.scrollContainerRef.current)?null:J()),f=u?{tops:u,from:n,to:a,row:i}:null;D=f,v.commitRowMove(n,a),f&&requestAnimationFrame(()=>{D===f&&(D=null)})},X=()=>{let e=D;if(D=null,!e)return;let t=v?.scrollContainerRef.current??null;if(!t)return;let{tops:n,from:r,to:i}=e;if(v?.locateDragRow&&e.row!==null&&v.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;h(t).forEach(e=>{let t=n.get(q(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=m.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(g(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 ${l}ms ${u}`,e.style.transform=`translateY(${s.get(e)??0}px)`;for(let e of c)e.style.transition=`transform ${l}ms ${u}`,e.style.transform=`translateY(0px)`;window.setTimeout(()=>{for(let e of o)e.style.transition=``,e.style.willChange=``;for(let e of c)j?.has(e)||_(e)},280)}},Z=(e,t)=>{if(v===null||!v.enabled||t.button!==0)return;if(t.stopPropagation(),t.preventDefault(),y!==null){if(t.pointerId!==T)return;w?.(),Y(!1)}y=e,O=v.getDragRow?.(e)??null,T=t.pointerId,b=null,x={x:t.clientX,y:t.clientY},S={x:t.clientX,y:t.clientY},C=!1,document.body.style.cursor=`grabbing`,M()?(k=H(),A=v.scrollContainerRef.current?.scrollTop??0):R(v.getRowDragLabel(e)),V(e,!0);let n=t.currentTarget,r=t.pointerId;try{n.setPointerCapture(r)}catch{}let i=e=>{e.pointerId===r&&(x={x:e.clientX,y:e.clientY},G())},a=()=>{window.removeEventListener(`pointermove`,i),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,s),window.removeEventListener(`keydown`,c),window.removeEventListener(`blur`,l),w=null;try{n.releasePointerCapture(r)}catch{}};function o(e){e.pointerId===r&&(a(),Y(!0))}function s(e){e.pointerId===r&&(a(),Y(!1))}function c(e){e.key===`Escape`&&(a(),Y(!1))}function l(){a(),Y(!1)}window.addEventListener(`pointermove`,i),window.addEventListener(`pointerup`,o),window.addEventListener(`pointercancel`,s),window.addEventListener(`keydown`,c),window.addEventListener(`blur`,l),w=a,G(),E=requestAnimationFrame(K)},Q=e=>{if(y===null||O==null||v?.locateDragRow===void 0)return;let t=v.locateDragRow(O,y);if(k&&k.forEach((e,t)=>{if(!t.isConnected){k?.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=m.exec(t.style.transform);if(!r){k?.delete(t);return}e.index=n,e.baseY=parseFloat(r[1]),e.applied=void 0}),t===null){w?.(),Y(!1);return}k&&t!==y&&S!==null&&e!==null&&(S={x:S.x,y:S.y+v.rowMetrics.rowTop(t)-e.rowTop(y)}),t!==y&&(V(null,!1),y=t,V(t,!0)),G()};return{update:e=>{let t=v;v=e,y!==null&&t!==null&&t.locateDragRow!==e.locateDragRow&&Q(t.rowMetrics)},onRowDragHandlePointerDown:Z,applyReorderSettle:X,dispose:()=>{w?.(),w=null,E!==null&&(cancelAnimationFrame(E),E=null),document.body.style.cursor=``,B(),V(y,!1),y=null,O=null,b=null,k=null,j?.forEach(_),j=null,D=null}}};exports.createRowDragController=v;
|