@ishibashi0112/spreadsheet-grid-core 1.2.1 → 1.3.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/clipboardController.cjs +1 -1
- package/dist/controllers/clipboardController.js +79 -71
- package/dist/controllers/columnMenuController.cjs +1 -1
- package/dist/controllers/columnMenuController.js +75 -73
- package/dist/controllers/contextMenuController.cjs +1 -1
- package/dist/controllers/contextMenuController.js +63 -61
- package/dist/controllers/detailRowController.cjs +1 -1
- package/dist/controllers/detailRowController.js +60 -59
- package/dist/controllers/detailTabOrder.cjs +1 -1
- package/dist/controllers/detailTabOrder.js +17 -16
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.d.ts +4 -1
- package/dist/controllers/editController.js +163 -91
- package/dist/controllers/escapeClaimController.cjs +1 -1
- package/dist/controllers/escapeClaimController.js +23 -19
- package/dist/controllers/fillHandleController.cjs +1 -1
- package/dist/controllers/fillHandleController.js +107 -106
- package/dist/controllers/filterPopoverController.cjs +1 -1
- package/dist/controllers/filterPopoverController.js +1 -0
- package/dist/controllers/imeInputController.cjs +1 -1
- package/dist/controllers/imeInputController.js +87 -76
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.d.ts +3 -0
- package/dist/controllers/keyboardController.js +15 -13
- package/dist/controllers/popoverSupport.cjs +1 -1
- package/dist/controllers/popoverSupport.d.ts +3 -0
- package/dist/controllers/popoverSupport.js +62 -41
- package/dist/controllers/toolPanelController.cjs +1 -1
- package/dist/controllers/toolPanelController.js +74 -73
- package/dist/controllers/tooltipController.cjs +1 -1
- package/dist/controllers/tooltipController.d.ts +1 -1
- package/dist/controllers/tooltipController.js +122 -97
- package/dist/controllers/viewportSyncController.cjs +1 -1
- package/dist/controllers/viewportSyncController.js +55 -54
- package/dist/engine/columnCommands.cjs +1 -1
- package/dist/engine/columnCommands.d.ts +2 -1
- package/dist/engine/columnCommands.js +98 -67
- package/dist/engine/exportCommands.cjs +1 -1
- package/dist/engine/exportCommands.js +2 -2
- package/dist/engine/gridApi.cjs +6 -5
- package/dist/engine/gridApi.d.ts +1 -0
- package/dist/engine/gridApi.js +151 -143
- package/dist/engine/rowSelectionCommands.cjs +1 -1
- package/dist/engine/rowSelectionCommands.d.ts +5 -0
- package/dist/engine/rowSelectionCommands.js +73 -38
- package/dist/locales/en.cjs +1 -1
- package/dist/locales/en.js +2 -2
- package/dist/logic/contextMenuTarget.cjs +1 -1
- package/dist/logic/contextMenuTarget.d.ts +20 -2
- package/dist/logic/contextMenuTarget.js +62 -3
- package/dist/logic/dateFilterCondition.cjs +1 -1
- package/dist/logic/dateFilterCondition.d.ts +1 -0
- package/dist/logic/dateFilterCondition.js +17 -13
- package/dist/logic/detailRow.cjs +1 -1
- package/dist/logic/detailRow.d.ts +2 -1
- package/dist/logic/detailRow.js +19 -18
- package/dist/logic/domGuards.cjs +1 -1
- package/dist/logic/domGuards.d.ts +5 -0
- package/dist/logic/domGuards.js +11 -1
- package/dist/logic/editorValues.cjs +1 -1
- package/dist/logic/editorValues.d.ts +1 -0
- package/dist/logic/editorValues.js +10 -7
- package/dist/logic/gridState.cjs +1 -1
- package/dist/logic/gridState.d.ts +1 -0
- package/dist/logic/gridState.js +19 -16
- package/dist/logic/localeText.cjs +1 -1
- package/dist/logic/localeText.js +2 -2
- package/dist/logic/rowDragTarget.cjs +1 -0
- package/dist/logic/rowDragTarget.d.ts +14 -0
- package/dist/logic/rowDragTarget.js +47 -0
- package/dist/logic/selectEditorState.d.ts +4 -4
- package/dist/logic/valueFormatters.d.ts +8 -3
- package/dist/model/gridTypes.core.d.ts +31 -12
- package/dist/utils/clipboard.cjs +4 -4
- package/dist/utils/clipboard.js +60 -59
- package/dist/utils/popupContainer.cjs +1 -1
- package/dist/utils/popupContainer.js +35 -28
- package/dist/utils/shadowDom.cjs +1 -0
- package/dist/utils/shadowDom.d.ts +5 -0
- package/dist/utils/shadowDom.js +33 -0
- package/package.json +1 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { gridActions as e } from "../model/gridActions.js";
|
|
2
2
|
import { isViewCellEditable as t } from "../utils/permissions.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import { getActiveElement as n } from "../utils/shadowDom.js";
|
|
4
|
+
import { createValueStore as r } from "../logic/valueStore.js";
|
|
5
|
+
import { computeNextScrollPosition as i, hasPointerLeftActivationRadius as a, resolveAutoScrollAxisDirection as o, resolveScrollContentBox as s, resolveTopAutoScrollStart as c } from "../logic/autoScrollGeometry.js";
|
|
6
|
+
import { resolveElementScale as l } from "../logic/elementScale.js";
|
|
7
|
+
import { beginEscapeCancelableDrag as u } from "./escapeClaimController.js";
|
|
8
|
+
import { createPopoverWindowBindings as d, isInsideGridRoot as f, restoreGridFocus as p } from "./popoverSupport.js";
|
|
9
|
+
import { applyFillEditsToRows as m, buildFillEdits as h, isSameFillRange as g, previewFillValue as _, resolveFillColumnBounds as v, resolveFillDoubleClickTarget as y, resolveFillSource as b, resolveFillTarget as x, unionFillRange as S } from "../logic/fillHandle.js";
|
|
9
10
|
//#region src/controllers/fillHandleController.ts
|
|
10
|
-
var
|
|
11
|
+
var ee = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && matchMedia("(pointer: coarse)").matches ? w : C, E = 8, D = { status: "idle" }, O = (e, t, n) => {
|
|
11
12
|
if (e.valueFormatter) try {
|
|
12
13
|
return e.valueFormatter({
|
|
13
14
|
value: n,
|
|
@@ -18,81 +19,81 @@ var S = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && match
|
|
|
18
19
|
return String(n ?? "");
|
|
19
20
|
}
|
|
20
21
|
return String(n ?? "");
|
|
21
|
-
},
|
|
22
|
+
}, k = (e, t) => e === t || e.length === t.length && e.every((e, n) => e.key === t[n].key), A = 500, j = 6, M = 2, N = (e) => {
|
|
22
23
|
let t = e.currentTarget;
|
|
23
24
|
if (!(t instanceof Element)) return !0;
|
|
24
25
|
let n = t.getBoundingClientRect();
|
|
25
|
-
return e.clientX >= n.left -
|
|
26
|
-
},
|
|
27
|
-
let C = null, w =
|
|
26
|
+
return e.clientX >= n.left - M && e.clientX <= n.right + M && e.clientY >= n.top - M && e.clientY <= n.bottom + M;
|
|
27
|
+
}, P = (e, t) => e === t || e !== void 0 && t !== void 0 && e.length === t.length && e.every((e, n) => Object.is(e, t[n])), F = (e, t) => Object.is(e, t) || e instanceof Date && t instanceof Date && e.getTime() === t.getTime(), I = (e, t) => e.length === t.length && e.every((e, n) => e.viewIndex === t[n].viewIndex && e.column.key === t[n].column.key && F(e.value, t[n].value)), L = () => {
|
|
28
|
+
let C = null, w = r(D), M = r(null), F = { current: null }, L = { current: null }, R = null, z = null, B = null, V = (e) => e ? "toggled" : "auto", H = (e) => (n, r, i, a) => t({
|
|
28
29
|
readOnly: e.readOnly,
|
|
29
30
|
canEditCell: e.canEditCell
|
|
30
|
-
}, e.rowModel, n, r, i, a),
|
|
31
|
-
if (
|
|
31
|
+
}, e.rowModel, n, r, i, a), U = () => {
|
|
32
|
+
if (B === null || C === null) return;
|
|
32
33
|
let e = w.getSnapshot();
|
|
33
|
-
if (e.status === "dragging" && e.toggled ===
|
|
34
|
+
if (e.status === "dragging" && e.toggled === B.toggled && (e.target === B.target || e.target !== null && B.target !== null && e.target.direction === B.target.direction && g(e.target.range, B.target.range))) return;
|
|
34
35
|
let t = null;
|
|
35
|
-
if (
|
|
36
|
-
let e =
|
|
36
|
+
if (B.target !== null) {
|
|
37
|
+
let e = _({
|
|
37
38
|
rowModel: C.rowModel,
|
|
38
39
|
columns: C.columns,
|
|
39
|
-
source:
|
|
40
|
-
target:
|
|
41
|
-
request:
|
|
42
|
-
canWriteCell:
|
|
40
|
+
source: B.source,
|
|
41
|
+
target: B.target,
|
|
42
|
+
request: V(B.toggled),
|
|
43
|
+
canWriteCell: H(C),
|
|
43
44
|
getFillValue: C.getFillValue
|
|
44
45
|
});
|
|
45
46
|
t = e && O(e.column, e.row, e.value) || null;
|
|
46
47
|
}
|
|
47
48
|
w.setSnapshot({
|
|
48
49
|
status: "dragging",
|
|
49
|
-
source:
|
|
50
|
-
target:
|
|
51
|
-
toggled:
|
|
50
|
+
source: B.source,
|
|
51
|
+
target: B.target,
|
|
52
|
+
toggled: B.toggled,
|
|
52
53
|
previewText: t
|
|
53
54
|
});
|
|
54
|
-
},
|
|
55
|
-
if (
|
|
56
|
-
let e =
|
|
57
|
-
e === null || t === null || (
|
|
58
|
-
},
|
|
59
|
-
if (
|
|
60
|
-
let e =
|
|
61
|
-
e.rafId = requestAnimationFrame(
|
|
55
|
+
}, W = () => {
|
|
56
|
+
if (B === null || C === null) return;
|
|
57
|
+
let e = v(C.columns), t = C.hitTest(B.pointer.x, B.pointer.y);
|
|
58
|
+
e === null || t === null || (B.target = x(B.source, t, C.rowModel.getRowCount(), e), U());
|
|
59
|
+
}, G = () => {
|
|
60
|
+
if (B === null || C === null) return;
|
|
61
|
+
let e = B;
|
|
62
|
+
e.rafId = requestAnimationFrame(G);
|
|
62
63
|
let t = C.scrollContainerRef.current;
|
|
63
64
|
if (!t) return;
|
|
64
65
|
if (!e.armed) {
|
|
65
|
-
if (!
|
|
66
|
+
if (!a(e.origin, e.pointer, 6)) return;
|
|
66
67
|
e.armed = !0;
|
|
67
68
|
}
|
|
68
|
-
let n = t.getBoundingClientRect(),
|
|
69
|
+
let n = t.getBoundingClientRect(), r = l(t, n), u = s({
|
|
69
70
|
rectLeft: n.left,
|
|
70
71
|
rectTop: n.top,
|
|
71
72
|
clientLeft: t.clientLeft,
|
|
72
73
|
clientTop: t.clientTop,
|
|
73
74
|
clientWidth: t.clientWidth,
|
|
74
75
|
clientHeight: t.clientHeight,
|
|
75
|
-
scale:
|
|
76
|
-
}), d =
|
|
76
|
+
scale: r
|
|
77
|
+
}), d = i(t.scrollTop, o(e.pointer.y, c(u.top, (C.stickyTopHeight ?? 0) * r.y, 24), u.bottom - (C.footerHeight ?? 0), 24), 18, t.scrollHeight - t.clientHeight), f = i(t.scrollLeft, o(e.pointer.x, u.left, u.right, 24), 18, t.scrollWidth - t.clientWidth);
|
|
77
78
|
(d !== t.scrollTop || f !== t.scrollLeft) && (t.scrollTo({
|
|
78
79
|
top: d,
|
|
79
80
|
left: f,
|
|
80
81
|
behavior: "auto"
|
|
81
|
-
}),
|
|
82
|
-
},
|
|
83
|
-
let n =
|
|
82
|
+
}), W());
|
|
83
|
+
}, K = (e, t) => {
|
|
84
|
+
let n = B;
|
|
84
85
|
if (n !== null) {
|
|
85
|
-
if (
|
|
86
|
-
|
|
86
|
+
if (B = null, n.cleanup(), n.rafId !== null && cancelAnimationFrame(n.rafId), M.setSnapshot(null), w.setSnapshot(D), e && n.target !== null) {
|
|
87
|
+
z = null, q(n.source, n.target, V(n.toggled), n.activeCell);
|
|
87
88
|
return;
|
|
88
89
|
}
|
|
89
|
-
|
|
90
|
+
z = e && t !== void 0 && n.onSquare ? {
|
|
90
91
|
time: t,
|
|
91
92
|
x: n.origin.x,
|
|
92
93
|
y: n.origin.y
|
|
93
94
|
} : null;
|
|
94
95
|
}
|
|
95
|
-
},
|
|
96
|
+
}, te = (t, n) => {
|
|
96
97
|
if (C === null) return;
|
|
97
98
|
let { dispatch: r } = C;
|
|
98
99
|
r(e.startSelection({
|
|
@@ -105,33 +106,33 @@ var S = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && match
|
|
|
105
106
|
row: t.startRow,
|
|
106
107
|
col: t.startCol
|
|
107
108
|
}));
|
|
108
|
-
},
|
|
109
|
+
}, ne = (e, t) => {
|
|
109
110
|
let n = [];
|
|
110
111
|
for (let r = t.startRow; r <= t.endRow; r += 1) n.push(e.getRowKey(r));
|
|
111
112
|
return n;
|
|
112
113
|
}, q = (e, t, n, r) => {
|
|
113
114
|
if (C === null || !C.enabled) return;
|
|
114
|
-
let i = C, a =
|
|
115
|
+
let i = C, a = h({
|
|
115
116
|
rowModel: i.rowModel,
|
|
116
117
|
columns: i.columns,
|
|
117
118
|
source: e,
|
|
118
119
|
target: t,
|
|
119
120
|
request: n,
|
|
120
|
-
canWriteCell:
|
|
121
|
+
canWriteCell: H(i),
|
|
121
122
|
getFillValue: i.getFillValue
|
|
122
123
|
});
|
|
123
124
|
if (a.edits.length === 0) return;
|
|
124
|
-
let o =
|
|
125
|
+
let o = S(e, t), s = null, c = [], l = null;
|
|
125
126
|
if (i.isServerSide) {
|
|
126
127
|
if (!i.applyServerSideCellEdits) return;
|
|
127
|
-
l =
|
|
128
|
+
l = ne(i.rowModel, o), i.applyServerSideCellEdits(a.edits);
|
|
128
129
|
} else {
|
|
129
130
|
if (!i.applyRowsChange) return;
|
|
130
|
-
let e =
|
|
131
|
+
let e = m(i.rows, i.rowModel, a.edits);
|
|
131
132
|
if (e === i.rows) return;
|
|
132
133
|
s = i.rows, c.push(e), i.applyRowsChange(e);
|
|
133
134
|
}
|
|
134
|
-
|
|
135
|
+
R = {
|
|
135
136
|
source: e,
|
|
136
137
|
target: t,
|
|
137
138
|
range: o,
|
|
@@ -145,20 +146,20 @@ var S = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && match
|
|
|
145
146
|
baseRowModel: i.isServerSide ? null : i.rowModel,
|
|
146
147
|
emittedRows: c,
|
|
147
148
|
rowKeys: l
|
|
148
|
-
},
|
|
149
|
+
}, te(o, r), w.setSnapshot({
|
|
149
150
|
status: "filled",
|
|
150
151
|
range: o,
|
|
151
152
|
kind: a.kind,
|
|
152
153
|
seriesAvailable: a.seriesAvailable,
|
|
153
154
|
menu: null
|
|
154
155
|
});
|
|
155
|
-
}, J =
|
|
156
|
+
}, J = d({
|
|
156
157
|
onScroll: (e) => {
|
|
157
|
-
e.target instanceof Node &&
|
|
158
|
+
e.target instanceof Node && F.current?.contains(e.target) || X(!1);
|
|
158
159
|
},
|
|
159
160
|
onResize: () => X(!1),
|
|
160
|
-
isInside: (e) =>
|
|
161
|
-
onOutsidePointerDown: (e) => X(C !== null &&
|
|
161
|
+
isInside: (e) => F.current?.contains(e) === !0 || L.current?.contains(e) === !0,
|
|
162
|
+
onOutsidePointerDown: (e) => X(C !== null && f(C.gridRootRef, e)),
|
|
162
163
|
getGridRoot: () => C?.gridRootRef.current ?? null,
|
|
163
164
|
onGridHidden: () => X(!1),
|
|
164
165
|
onKeyDown: (e) => {
|
|
@@ -171,48 +172,48 @@ var S = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && match
|
|
|
171
172
|
menu: e
|
|
172
173
|
});
|
|
173
174
|
}, X = (e) => {
|
|
174
|
-
J.detach(), Y(null), e && C !== null &&
|
|
175
|
+
J.detach(), Y(null), e && C !== null && p(C.gridRootRef);
|
|
175
176
|
}, Z = () => {
|
|
176
|
-
let e = typeof document < "u" &&
|
|
177
|
-
|
|
178
|
-
},
|
|
177
|
+
let e = typeof document < "u" && F.current?.contains(n(F.current)) === !0;
|
|
178
|
+
R = null, J.detach(), w.getSnapshot().status === "filled" && w.setSnapshot(D), e && C !== null && p(C.gridRootRef);
|
|
179
|
+
}, re = (e) => {
|
|
179
180
|
let t = w.getSnapshot();
|
|
180
181
|
if (t.status !== "filled") return;
|
|
181
182
|
if (t.menu !== null) {
|
|
182
183
|
X(!0);
|
|
183
184
|
return;
|
|
184
185
|
}
|
|
185
|
-
let n = Math.min(e.left, window.innerWidth -
|
|
186
|
+
let n = Math.min(e.left, window.innerWidth - ee - E);
|
|
186
187
|
n = Math.max(E, n);
|
|
187
188
|
let r = e.bottom + 4, i = T();
|
|
188
189
|
r + i > window.innerHeight - E && (r = Math.max(E, e.top - 4 - i)), Y({
|
|
189
190
|
top: r,
|
|
190
191
|
left: n
|
|
191
192
|
}), J.attach();
|
|
192
|
-
},
|
|
193
|
+
}, ie = (e, t) => {
|
|
193
194
|
let n = t.rowKeys;
|
|
194
195
|
if (n === null) return !1;
|
|
195
196
|
for (let r = 0; r < n.length; r += 1) if (e.getRowKey(t.range.startRow + r) !== n[r]) return !1;
|
|
196
197
|
return !0;
|
|
197
|
-
},
|
|
198
|
-
let n = w.getSnapshot(), r =
|
|
198
|
+
}, ae = (e) => {
|
|
199
|
+
let n = w.getSnapshot(), r = R;
|
|
199
200
|
if (X(!0), C === null || r === null || n.status !== "filled" || r.request === e) return;
|
|
200
201
|
let i = C;
|
|
201
202
|
if (i.isServerSide) {
|
|
202
|
-
if (!i.applyServerSideCellEdits || !
|
|
203
|
+
if (!i.applyServerSideCellEdits || !ie(i.rowModel, r)) {
|
|
203
204
|
Z();
|
|
204
205
|
return;
|
|
205
206
|
}
|
|
206
|
-
let t =
|
|
207
|
+
let t = h({
|
|
207
208
|
rowModel: i.rowModel,
|
|
208
209
|
columns: r.columns,
|
|
209
210
|
source: r.source,
|
|
210
211
|
target: r.target,
|
|
211
212
|
request: e,
|
|
212
|
-
canWriteCell:
|
|
213
|
+
canWriteCell: H(i),
|
|
213
214
|
getFillValue: i.getFillValue
|
|
214
215
|
});
|
|
215
|
-
r.request = e, t.edits.length > 0 && !
|
|
216
|
+
r.request = e, t.edits.length > 0 && !I(t.edits, r.edits) && i.applyServerSideCellEdits(t.edits), r.edits = t.edits, w.setSnapshot({
|
|
216
217
|
...n,
|
|
217
218
|
kind: t.kind,
|
|
218
219
|
menu: null
|
|
@@ -223,7 +224,7 @@ var S = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && match
|
|
|
223
224
|
Z();
|
|
224
225
|
return;
|
|
225
226
|
}
|
|
226
|
-
let a = r.baseRowModel, o =
|
|
227
|
+
let a = r.baseRowModel, o = h({
|
|
227
228
|
rowModel: a,
|
|
228
229
|
columns: r.columns,
|
|
229
230
|
source: r.source,
|
|
@@ -235,8 +236,8 @@ var S = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && match
|
|
|
235
236
|
}, a, e, n, r, o),
|
|
236
237
|
getFillValue: i.getFillValue
|
|
237
238
|
});
|
|
238
|
-
if (r.request = e, !
|
|
239
|
-
let e =
|
|
239
|
+
if (r.request = e, !I(o.edits, r.edits)) {
|
|
240
|
+
let e = m(r.baseRows, a, o.edits);
|
|
240
241
|
r.emittedRows.push(e), r.edits = o.edits, i.amendRowsChange(e);
|
|
241
242
|
}
|
|
242
243
|
w.setSnapshot({
|
|
@@ -247,16 +248,16 @@ var S = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && match
|
|
|
247
248
|
}, Q = (e, t) => {
|
|
248
249
|
if (e?.type !== "cell") return !1;
|
|
249
250
|
let { start: n, end: r } = e.range;
|
|
250
|
-
return
|
|
251
|
+
return g(t, {
|
|
251
252
|
startRow: Math.min(n.row, r.row),
|
|
252
253
|
endRow: Math.max(n.row, r.row),
|
|
253
254
|
startCol: Math.min(n.col, r.col),
|
|
254
255
|
endCol: Math.max(n.col, r.col)
|
|
255
256
|
});
|
|
256
|
-
},
|
|
257
|
-
let t =
|
|
257
|
+
}, oe = (e) => {
|
|
258
|
+
let t = R;
|
|
258
259
|
if (t !== null) {
|
|
259
|
-
if (!e.enabled || e.editing || !
|
|
260
|
+
if (!e.enabled || e.editing || !k(e.columns, t.columns) || !P(e.viewKey, t.viewKey)) {
|
|
260
261
|
Z();
|
|
261
262
|
return;
|
|
262
263
|
}
|
|
@@ -270,42 +271,42 @@ var S = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && match
|
|
|
270
271
|
}
|
|
271
272
|
!t.selectionConfirmed && Q(e.selection, t.previousSource) || Z();
|
|
272
273
|
}
|
|
273
|
-
},
|
|
274
|
-
if (C === null || e.button !== 0 || (e.preventDefault(),
|
|
275
|
-
let t =
|
|
274
|
+
}, se = (e) => {
|
|
275
|
+
if (C === null || e.button !== 0 || (e.preventDefault(), B !== null || !C.enabled || C.editing)) return;
|
|
276
|
+
let t = b(C.selection, C.activeCell, C.rowModel.getRowCount(), C.columns.length);
|
|
276
277
|
if (t === null) return;
|
|
277
|
-
let n =
|
|
278
|
-
|
|
279
|
-
let r =
|
|
280
|
-
if (n !== null && r && e.timeStamp - n.time <=
|
|
278
|
+
let n = z;
|
|
279
|
+
z = null;
|
|
280
|
+
let r = N(e);
|
|
281
|
+
if (n !== null && r && e.timeStamp - n.time <= A && Math.abs(e.clientX - n.x) <= j && Math.abs(e.clientY - n.y) <= j) {
|
|
281
282
|
C.gridRootRef.current?.focus({ preventScroll: !0 }), $();
|
|
282
283
|
return;
|
|
283
284
|
}
|
|
284
285
|
Z(), C.gridRootRef.current?.focus({ preventScroll: !0 });
|
|
285
286
|
let i = e.pointerId, a = (e) => {
|
|
286
|
-
|
|
287
|
+
B === null || e.pointerId !== i || (B.pointer = {
|
|
287
288
|
x: e.clientX,
|
|
288
289
|
y: e.clientY
|
|
289
|
-
},
|
|
290
|
+
}, B.toggled = e.ctrlKey || e.metaKey, M.setSnapshot(B.pointer), W());
|
|
290
291
|
}, o = (e) => {
|
|
291
|
-
|
|
292
|
+
B === null || e.pointerId !== i || (B.toggled = e.ctrlKey || e.metaKey, K(!0, e.timeStamp));
|
|
292
293
|
}, s = (e) => {
|
|
293
|
-
e.pointerId === i &&
|
|
294
|
+
e.pointerId === i && K(!1);
|
|
294
295
|
}, c = (e) => {
|
|
295
|
-
if (
|
|
296
|
+
if (B === null) return;
|
|
296
297
|
if (e.preventDefault(), e.stopPropagation(), e.type === "keydown" && e.key === "Escape") {
|
|
297
|
-
|
|
298
|
+
K(!1);
|
|
298
299
|
return;
|
|
299
300
|
}
|
|
300
301
|
let t = e.ctrlKey || e.metaKey;
|
|
301
|
-
t !==
|
|
302
|
-
},
|
|
303
|
-
window.addEventListener("pointermove", a), window.addEventListener("pointerup", o), window.addEventListener("pointercancel", s), window.addEventListener("keydown", c, !0), window.addEventListener("keyup", c, !0), window.addEventListener("blur",
|
|
304
|
-
let d =
|
|
302
|
+
t !== B.toggled && (B.toggled = t, U());
|
|
303
|
+
}, l = () => K(!1);
|
|
304
|
+
window.addEventListener("pointermove", a), window.addEventListener("pointerup", o), window.addEventListener("pointercancel", s), window.addEventListener("keydown", c, !0), window.addEventListener("keyup", c, !0), window.addEventListener("blur", l);
|
|
305
|
+
let d = u(), f = {
|
|
305
306
|
x: e.clientX,
|
|
306
307
|
y: e.clientY
|
|
307
308
|
};
|
|
308
|
-
|
|
309
|
+
B = {
|
|
309
310
|
pointerId: i,
|
|
310
311
|
source: t,
|
|
311
312
|
activeCell: C.activeCell,
|
|
@@ -317,35 +318,35 @@ var S = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && match
|
|
|
317
318
|
armed: !1,
|
|
318
319
|
rafId: null,
|
|
319
320
|
cleanup: () => {
|
|
320
|
-
window.removeEventListener("pointermove", a), window.removeEventListener("pointerup", o), window.removeEventListener("pointercancel", s), window.removeEventListener("keydown", c, !0), window.removeEventListener("keyup", c, !0), window.removeEventListener("blur",
|
|
321
|
+
window.removeEventListener("pointermove", a), window.removeEventListener("pointerup", o), window.removeEventListener("pointercancel", s), window.removeEventListener("keydown", c, !0), window.removeEventListener("keyup", c, !0), window.removeEventListener("blur", l), d();
|
|
321
322
|
}
|
|
322
|
-
},
|
|
323
|
+
}, M.setSnapshot(f), U(), B.rafId = requestAnimationFrame(G);
|
|
323
324
|
}, $ = () => {
|
|
324
|
-
if (C === null ||
|
|
325
|
-
let e =
|
|
325
|
+
if (C === null || B !== null || !C.enabled || C.editing) return;
|
|
326
|
+
let e = b(C.selection, C.activeCell, C.rowModel.getRowCount(), C.columns.length);
|
|
326
327
|
if (e === null) return;
|
|
327
|
-
let t =
|
|
328
|
+
let t = y(e, C.rowModel, C.columns);
|
|
328
329
|
t !== null && (Z(), q(e, t, "auto", C.activeCell));
|
|
329
330
|
};
|
|
330
331
|
return {
|
|
331
332
|
update: (e) => {
|
|
332
|
-
C = e,
|
|
333
|
+
C = e, B !== null && (!e.enabled || e.editing) && K(!1), oe(e);
|
|
333
334
|
},
|
|
334
335
|
subscribe: w.subscribe,
|
|
335
336
|
getSnapshot: w.getSnapshot,
|
|
336
|
-
subscribePointer:
|
|
337
|
-
getPointerSnapshot:
|
|
338
|
-
handlePointerDown:
|
|
337
|
+
subscribePointer: M.subscribe,
|
|
338
|
+
getPointerSnapshot: M.getSnapshot,
|
|
339
|
+
handlePointerDown: se,
|
|
339
340
|
handleDoubleClick: $,
|
|
340
|
-
toggleMenu:
|
|
341
|
+
toggleMenu: re,
|
|
341
342
|
closeMenu: () => X(!0),
|
|
342
|
-
chooseKind:
|
|
343
|
-
menuPanel:
|
|
344
|
-
chipElement:
|
|
343
|
+
chooseKind: ae,
|
|
344
|
+
menuPanel: F,
|
|
345
|
+
chipElement: L,
|
|
345
346
|
dispose: () => {
|
|
346
|
-
|
|
347
|
+
K(!1), J.detach(), R = null;
|
|
347
348
|
}
|
|
348
349
|
};
|
|
349
350
|
};
|
|
350
351
|
//#endregion
|
|
351
|
-
export {
|
|
352
|
+
export { L as createFillHandleController };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs"),t=require("../logic/valueStore.cjs"),n=require("./popoverSupport.cjs"),r=require("../logic/filtering.cjs"),i=require("../logic/numberFilterCondition.cjs"),a=require("../logic/textFilterCondition.cjs"),o=require("../logic/dateFilterCondition.cjs"),s=require("../logic/filterPopoverLayout.cjs"),c=require("../logic/filterPopoverOutsideClick.cjs");var l=240,u=8,d=8,f=230,p=340,m=480,h=(e,t)=>{if(!t)return null;let n=e.find(e=>e.key===t.columnKey)??null;return!n||n.filterType===t.filterType?n:{...n,filterType:t.filterType}},g=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(pointer: coarse)`).matches,_=()=>{let _=null,v=t.createValueStore({state:null,layout:null}),y={current:null},b={current:null},x={current:null},S=null,C=null,w=null,T=null,E=null,D=null,O=null,k=null,A=e=>{let t=v.getSnapshot(),n=t.layout;n===e||n!==null&&e!==null&&n.top===e.top&&n.left===e.left&&n.width===e.width&&n.maxHeight===e.maxHeight||v.setSnapshot({...t,layout:e})},j=()=>_===null?null:h(_.visibleColumns,v.getSnapshot().state),M=t=>{let n=_?.gridRootRef.current??null;if(!n)return null;let r=_?.resolveAnchorColumnKey?.(t)??t,i=n.querySelectorAll(`[data-ssg-col-key]`);return Array.from(i).find(t=>t.dataset.ssgColKey===r&&!e.isInsideDetailCardOf(n,t))??null},N=()=>{let e=v.getSnapshot().state;if(!e||!S){A(null);return}if(!S.isConnected){let t=M(e.columnKey);if(t===null)return;S=t}let t=S.getBoundingClientRect(),n=j()?.filterType,r=n===`numberSet`||n===`textSet`||n===`dateSet`?m:n===`set`?p:f,{top:i,left:a,maxHeight:o}=s.computeFilterPopoverPlacement({anchorTop:t.top,anchorBottom:t.bottom,anchorRight:t.right,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,popupWidth:l,popupHeight:C??r,offsetY:d,viewportMargin:u});A({top:i,left:a,width:l,maxHeight:o})},P=()=>{E!==null&&(cancelAnimationFrame(E),E=null),D!==null&&(cancelAnimationFrame(D),D=null)},F=()=>{w?.disconnect(),w=null,T=null},I=e=>{v.setSnapshot({state:null,layout:null}),S=null,b.current=null,x.current=null,C=null,R.detach(),F(),P(),O=null,_!==null&&e&&n.restoreGridFocus(_.gridRootRef)},L=()=>I(!0),R=n.createPopoverWindowBindings({onResize:N,onScroll:N,isInside:e=>!c.isFilterPopoverOutsideTarget(e,y.current),onOutsidePointerDown:e=>I(_!==null&&n.isInsideGridRoot(_.gridRootRef,e)),getGridRoot:()=>_?.gridRootRef.current??null,onGridHidden:()=>I(!1),onKeyDown:e=>{e.key!==`Escape`||y.current!==null||(e.preventDefault(),L())}}),z=e=>{if(_===null||!_.enableColumnFilter)return;let{gridRootRef:t,resolveColumnFilterType:s,columnFilterValues:c}=_;n.blurForPopover(t.current),S=M(e.key);let l=e.filterType===`auto`&&s?s(e):e.filterType??`text`,u=c[e.key],d=l===`number`?i.numberFilterValueToConditionDraft(r.isNumberColumnFilterValue(u)?u:void 0):l===`numberSet`?i.parsedNumberFilterToConditionDraft(r.isNumberSetColumnFilterValue(u)?u.condition:void 0):null,f=l===`textSet`?a.parsedTextFilterToConditionDraft(r.isTextSetColumnFilterValue(u)?u.condition:void 0):null,p=l===`dateSet`?o.parsedDateFilterToConditionDraft(r.isDateSetColumnFilterValue(u)?u.condition:void 0):null;v.setSnapshot({...v.getSnapshot(),state:{columnKey:e.key,filterType:l,draftValue:r.columnFilterValueToDraftText(u),numberDraft:d,textDraft:f,dateDraft:p}}),N(),R.attach()},B=e=>{let t=v.getSnapshot();t.state&&v.setSnapshot({...t,state:{...t.state,...e}})},V=()=>{let e=y.current;if(!(v.getSnapshot().layout!==null&&e!==null)||typeof ResizeObserver>`u`){F();return}T!==e&&(F(),w=new ResizeObserver(()=>{let e=y.current?.getBoundingClientRect().height??null;e===null||e===C||(C=e,N())}),w.observe(e),T=e)},H=()=>{let{state:e,layout:t}=v.getSnapshot(),n=j();if(!e||!n||!t){P(),O=null;return}if(y.current===null){P(),O=null;return}let r=k!==_?.visibleColumns,i=`${e.columnKey}|${e.filterType}|${t.top}|${t.left}|${t.width}`;if(!r&&O===i)return;O=i,k=_?.visibleColumns??null,P();let a=n.filterType??`text`;E=requestAnimationFrame(()=>{E=null,D=requestAnimationFrame(()=>{if(D=null,a===`select`){x.current?.focus();return}if(g()){y.current?.focus({preventScroll:!0});return}let e=b.current;if(e&&(e.focus(),e.type===`text`)){let t=e.value.length;e.setSelectionRange(t,t)}})})};return{update:e=>{_=e,V(),H()},subscribe:v.subscribe,getSnapshot:v.getSnapshot,panelRef:y,textInputRef:b,selectRef:x,open:z,close:L,updateDraft:e=>B({draftValue:e}),updateNumberDraft:e=>B({numberDraft:e}),updateTextDraft:e=>B({textDraft:e}),updateDateDraft:e=>B({dateDraft:e}),dispose:()=>{R.detach(),F(),P()}}};exports.createFilterPopoverController=_,exports.resolveOpenedFilterColumn=h;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs"),t=require("../logic/valueStore.cjs"),n=require("./popoverSupport.cjs"),r=require("../logic/filtering.cjs"),i=require("../logic/numberFilterCondition.cjs"),a=require("../logic/textFilterCondition.cjs"),o=require("../logic/dateFilterCondition.cjs"),s=require("../logic/filterPopoverLayout.cjs"),c=require("../logic/filterPopoverOutsideClick.cjs");var l=240,u=8,d=8,f=230,p=340,m=480,h=(e,t)=>{if(!t)return null;let n=e.find(e=>e.key===t.columnKey)??null;return!n||n.filterType===t.filterType?n:{...n,filterType:t.filterType}},g=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(pointer: coarse)`).matches,_=()=>{let _=null,v=t.createValueStore({state:null,layout:null}),y={current:null},b={current:null},x={current:null},S=null,C=null,w=null,T=null,E=null,D=null,O=null,k=null,A=e=>{let t=v.getSnapshot(),n=t.layout;n===e||n!==null&&e!==null&&n.top===e.top&&n.left===e.left&&n.width===e.width&&n.maxHeight===e.maxHeight||v.setSnapshot({...t,layout:e})},j=()=>_===null?null:h(_.visibleColumns,v.getSnapshot().state),M=t=>{let n=_?.gridRootRef.current??null;if(!n)return null;let r=_?.resolveAnchorColumnKey?.(t)??t,i=n.querySelectorAll(`[data-ssg-col-key]`);return Array.from(i).find(t=>t.dataset.ssgColKey===r&&!e.isInsideDetailCardOf(n,t))??null},N=()=>{let e=v.getSnapshot().state;if(!e||!S){A(null);return}if(!S.isConnected){let t=M(e.columnKey);if(t===null)return;S=t}let t=S.getBoundingClientRect(),n=j()?.filterType,r=n===`numberSet`||n===`textSet`||n===`dateSet`?m:n===`set`?p:f,{top:i,left:a,maxHeight:o}=s.computeFilterPopoverPlacement({anchorTop:t.top,anchorBottom:t.bottom,anchorRight:t.right,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,popupWidth:l,popupHeight:C??r,offsetY:d,viewportMargin:u});A({top:i,left:a,width:l,maxHeight:o})},P=()=>{E!==null&&(cancelAnimationFrame(E),E=null),D!==null&&(cancelAnimationFrame(D),D=null)},F=()=>{w?.disconnect(),w=null,T=null},I=e=>{v.setSnapshot({state:null,layout:null}),S=null,b.current=null,x.current=null,C=null,R.detach(),F(),P(),O=null,_!==null&&e&&n.restoreGridFocus(_.gridRootRef)},L=()=>I(!0),R=n.createPopoverWindowBindings({onResize:N,onScroll:N,isInside:e=>!c.isFilterPopoverOutsideTarget(e,y.current),onOutsidePointerDown:e=>I(_!==null&&n.isInsideGridRoot(_.gridRootRef,e)),getGridRoot:()=>_?.gridRootRef.current??null,onGridHidden:()=>I(!1),onOtherGridPopupOpen:()=>I(!1),onKeyDown:e=>{e.key!==`Escape`||y.current!==null||(e.preventDefault(),L())}}),z=e=>{if(_===null||!_.enableColumnFilter)return;let{gridRootRef:t,resolveColumnFilterType:s,columnFilterValues:c}=_;n.blurForPopover(t.current),S=M(e.key);let l=e.filterType===`auto`&&s?s(e):e.filterType??`text`,u=c[e.key],d=l===`number`?i.numberFilterValueToConditionDraft(r.isNumberColumnFilterValue(u)?u:void 0):l===`numberSet`?i.parsedNumberFilterToConditionDraft(r.isNumberSetColumnFilterValue(u)?u.condition:void 0):null,f=l===`textSet`?a.parsedTextFilterToConditionDraft(r.isTextSetColumnFilterValue(u)?u.condition:void 0):null,p=l===`dateSet`?o.parsedDateFilterToConditionDraft(r.isDateSetColumnFilterValue(u)?u.condition:void 0):null;v.setSnapshot({...v.getSnapshot(),state:{columnKey:e.key,filterType:l,draftValue:r.columnFilterValueToDraftText(u),numberDraft:d,textDraft:f,dateDraft:p}}),N(),R.attach()},B=e=>{let t=v.getSnapshot();t.state&&v.setSnapshot({...t,state:{...t.state,...e}})},V=()=>{let e=y.current;if(!(v.getSnapshot().layout!==null&&e!==null)||typeof ResizeObserver>`u`){F();return}T!==e&&(F(),w=new ResizeObserver(()=>{let e=y.current?.getBoundingClientRect().height??null;e===null||e===C||(C=e,N())}),w.observe(e),T=e)},H=()=>{let{state:e,layout:t}=v.getSnapshot(),n=j();if(!e||!n||!t){P(),O=null;return}if(y.current===null){P(),O=null;return}let r=k!==_?.visibleColumns,i=`${e.columnKey}|${e.filterType}|${t.top}|${t.left}|${t.width}`;if(!r&&O===i)return;O=i,k=_?.visibleColumns??null,P();let a=n.filterType??`text`;E=requestAnimationFrame(()=>{E=null,D=requestAnimationFrame(()=>{if(D=null,a===`select`){x.current?.focus();return}if(g()){y.current?.focus({preventScroll:!0});return}let e=b.current;if(e&&(e.focus(),e.type===`text`)){let t=e.value.length;e.setSelectionRange(t,t)}})})};return{update:e=>{_=e,V(),H()},subscribe:v.subscribe,getSnapshot:v.getSnapshot,panelRef:y,textInputRef:b,selectRef:x,open:z,close:L,updateDraft:e=>B({draftValue:e}),updateNumberDraft:e=>B({numberDraft:e}),updateTextDraft:e=>B({textDraft:e}),updateDateDraft:e=>B({dateDraft:e}),dispose:()=>{R.detach(),F(),P()}}};exports.createFilterPopoverController=_,exports.resolveOpenedFilterColumn=h;
|
|
@@ -74,6 +74,7 @@ var _ = 240, v = 8, y = 8, b = 230, x = 340, S = 480, C = (e, t) => {
|
|
|
74
74
|
onOutsidePointerDown: (e) => W(T !== null && i(T.gridRootRef, e)),
|
|
75
75
|
getGridRoot: () => T?.gridRootRef.current ?? null,
|
|
76
76
|
onGridHidden: () => W(!1),
|
|
77
|
+
onOtherGridPopupOpen: () => W(!1),
|
|
77
78
|
onKeyDown: (e) => {
|
|
78
79
|
e.key !== "Escape" || D.current !== null || (e.preventDefault(), G());
|
|
79
80
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs"),
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/shadowDom.cjs"),t=require("../logic/detailRow.cjs"),n=require("../logic/domGuards.cjs"),r=require("../logic/elementScale.cjs"),i=require("../utils/gridVisibleBand.cjs"),a=require("../utils/topAlignedInput.cjs");var o=24,s=`ssg-ime-input--composing`,c=(e,n,r)=>{let i=e.querySelectorAll(`.ssg-body-row[data-row-index="${n.row}"]`);for(let n of Array.from(i)){if(t.isInsideDetailCardOf(e,n))continue;let i=n.querySelectorAll(`.ssg-body-cell`);for(let e of Array.from(i))if(e.getAttribute(`data-ssg-col-key`)===r)return e}return null},l=(e,t)=>e===t||e!==null&&t!==null&&e.row===t.row&&e.col===t.col,u=()=>{let t=null,u=null,d=null,f=null,p=!1,m=null,h=!1,g=!1,_=!1,v=null,y=null,b=()=>t?.gridRootRef.current??null,x=()=>{u&&e.getActiveElement(u)!==u&&u.focus({preventScroll:!0})},S=(e,n)=>{let s=b(),l=t?.resolveCell(e)??null;if(!u||!s||!l)return!1;let d=c(s,e,l.colKey);if(!d)return!1;let f=s.getBoundingClientRect(),p=d.getBoundingClientRect(),m=r.resolveElementScale(s,f),h=p.top,g=p.bottom;if(n){let e=i.resolveGridVisibleBand(d);if(e!==null){let t=Math.max(h,e.top),n=Math.min(g,e.bottom);n-t>=o*m.y&&(h=t,g=n)}}let _=(g-h)/m.y;return u.style.left=`${(p.left-f.left)/m.x-s.clientLeft}px`,u.style.top=`${(h-f.top)/m.y-s.clientTop}px`,u.style.width=`${p.width/m.x}px`,u.style.height=`${_}px`,u.style.textAlign=n&&l.align?l.align:``,a.alignInputTextToTop(u,n&&d.classList.contains(`ssg-body-cell--valign-top`),_),!0},C=()=>{let e=u?.ownerDocument.defaultView??null;e===null||y!==null||(y={view:e,id:e.requestAnimationFrame(()=>{y=null,!(t===null||!t.enabled||m!==null||h||t.activeCell===null)&&l(v,t.activeCell)&&(S(t.activeCell,!1)||(v=null))})})},w=()=>{y!==null&&(y.view.cancelAnimationFrame(y.id),y=null)},T=()=>{u&&(u.classList.remove(s),u.value=``,u.style.textAlign=``,a.alignInputTextToTop(u,!1,0))},E=e=>{t===null||!t.enabled||t.editing||g||e.target===d&&x()},D=()=>{if(t===null||!t.enabled||t.editing||t.activeCell===null){m=null;return}let e=t.activeCell,n=t.canStartEdit(e);m={cell:e,allowed:n},_=!1,n&&(u?.classList.add(s),S(e,!0),v=e)},O=n=>{let r=m;m=null;let i=_;if(_=!1,!u||r===null||!r.allowed||i){T();return}let a=u.value||n.data||``;queueMicrotask(()=>{let n=u;if(t===null||!t.enabled||!n||a===``||e.getActiveElement(n)!==n||!t.canStartEdit(r.cell)){T();return}let i=t.resolveEditText?t.resolveEditText(r.cell,a):a;if(i===null||i===``){T();return}h=!0,t.startEdit(r.cell,i),requestAnimationFrame(()=>{h&&t!==null&&!t.editing&&(h=!1,T())})})},k=()=>{m===null&&!h&&u&&(u.value=``)},A=t=>{if(e.getEventTarget(t,u)!==u||t.key!==`Tab`||t.defaultPrevented||n.isImeComposingKeyEvent(t)||e.getActiveElement(u)!==u)return;let r=b();if(r){g=!0;try{r.focus({preventScroll:!0})}finally{g=!1}}},j=()=>{m!==null&&(_=!0)},M=e=>{d!==e&&(d?.removeEventListener(`focus`,E),d=e,d?.addEventListener(`focus`,E))},N=e=>{typeof document>`u`||p===e||(p=e,e?(document.addEventListener(`keydown`,A),document.addEventListener(`pointerdown`,j,!0)):(document.removeEventListener(`keydown`,A),document.removeEventListener(`pointerdown`,j,!0)))},P=e=>{f!==e&&(f&&(f.removeEventListener(`compositionstart`,D),f.removeEventListener(`compositionend`,O),f.removeEventListener(`input`,k)),f=e,f&&(f.addEventListener(`compositionstart`,D),f.addEventListener(`compositionend`,O),f.addEventListener(`input`,k)))};return{update:n=>{t=n;let r=n.gridRootRef.current;if(M(n.enabled?r:null),P(n.enabled?u:null),N(n.enabled),!n.enabled){m=null,h=!1,T(),u&&r&&e.getActiveElement(u)===u&&r.focus({preventScroll:!0});return}h&&n.editing&&(h=!1,T()),!(m!==null||h)&&(n.activeCell!==null&&!l(v,n.activeCell)&&S(n.activeCell,!1)&&(v=n.activeCell,C()),!n.editing&&r&&e.getActiveElement(r)===r&&x())},attach:e=>{u!==e&&(u=e,P(t?.enabled?u:null),u&&(typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches&&(u.inputMode=`none`),v=null))},dispose:()=>{w(),P(null),M(null),N(!1),m=null,h=!1,t=null}}};exports.IME_INPUT_COMPOSING_CLASS=s,exports.createImeInputController=u;
|