@ishibashi0112/spreadsheet-grid-core 0.65.0 → 1.0.1
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 +2 -2
- package/dist/controllers/clipboardController.d.ts +2 -1
- package/dist/controllers/clipboardController.js +78 -62
- package/dist/controllers/columnAutosizeRunner.cjs +1 -1
- package/dist/controllers/columnAutosizeRunner.d.ts +2 -0
- package/dist/controllers/columnAutosizeRunner.js +49 -23
- package/dist/controllers/columnHeaderDragController.cjs +1 -1
- package/dist/controllers/columnHeaderDragController.d.ts +4 -0
- package/dist/controllers/columnHeaderDragController.js +140 -124
- package/dist/controllers/dateRolloverStore.cjs +1 -1
- package/dist/controllers/dateRolloverStore.js +1 -1
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.js +71 -55
- package/dist/controllers/escapeClaimController.cjs +1 -0
- package/dist/controllers/escapeClaimController.d.ts +18 -0
- package/dist/controllers/escapeClaimController.js +30 -0
- package/dist/controllers/fillHandleController.cjs +1 -1
- package/dist/controllers/fillHandleController.js +129 -127
- package/dist/controllers/findController.cjs +1 -1
- package/dist/controllers/findController.d.ts +1 -0
- package/dist/controllers/findController.js +96 -75
- package/dist/controllers/globalFilteredOrder.cjs +1 -1
- package/dist/controllers/globalFilteredOrder.js +52 -21
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.js +98 -97
- package/dist/controllers/pointerInteractionsController.cjs +1 -1
- package/dist/controllers/pointerInteractionsController.js +159 -144
- package/dist/controllers/popoverSupport.cjs +1 -1
- package/dist/controllers/popoverSupport.js +4 -1
- package/dist/controllers/rowDragController.cjs +1 -1
- package/dist/controllers/rowDragController.d.ts +1 -0
- package/dist/controllers/rowDragController.js +122 -120
- package/dist/controllers/scrollSyncController.cjs +1 -1
- package/dist/controllers/scrollSyncController.d.ts +1 -1
- package/dist/controllers/scrollSyncController.js +7 -4
- package/dist/controllers/selectOptionsCollector.cjs +1 -1
- package/dist/controllers/selectOptionsCollector.d.ts +5 -2
- package/dist/controllers/selectOptionsCollector.js +39 -27
- package/dist/controllers/toolPanelController.cjs +1 -1
- package/dist/controllers/toolPanelController.d.ts +6 -0
- package/dist/controllers/toolPanelController.js +69 -59
- package/dist/controllers/tooltipController.cjs +1 -1
- package/dist/controllers/tooltipController.d.ts +2 -0
- package/dist/controllers/tooltipController.js +68 -38
- package/dist/controllers/viewportSyncController.cjs +1 -1
- package/dist/controllers/viewportSyncController.d.ts +4 -0
- package/dist/controllers/viewportSyncController.js +18 -8
- package/dist/engine/columnCommands.cjs +1 -1
- package/dist/engine/columnCommands.js +2 -1
- package/dist/engine/columnLayout.cjs +1 -1
- package/dist/engine/columnLayout.d.ts +2 -0
- package/dist/engine/columnLayout.js +51 -18
- package/dist/engine/exportCommands.cjs +2 -2
- package/dist/engine/exportCommands.js +37 -38
- package/dist/engine/gridApi.cjs +2 -2
- package/dist/engine/gridApi.d.ts +1 -1
- package/dist/engine/gridApi.js +8 -8
- package/dist/engine/rowPipeline.cjs +1 -1
- package/dist/engine/rowPipeline.js +46 -46
- package/dist/engine/rowSelectionCommands.cjs +1 -1
- package/dist/engine/rowSelectionCommands.d.ts +8 -1
- package/dist/engine/rowSelectionCommands.js +36 -25
- package/dist/locales/en.cjs +1 -1
- package/dist/locales/en.js +1 -1
- package/dist/logic/autoScrollGeometry.cjs +1 -1
- package/dist/logic/autoScrollGeometry.d.ts +5 -1
- package/dist/logic/autoScrollGeometry.js +6 -6
- package/dist/logic/clearCells.cjs +1 -1
- package/dist/logic/clearCells.js +13 -13
- package/dist/logic/columnReset.cjs +1 -1
- package/dist/logic/columnReset.d.ts +1 -0
- package/dist/logic/columnReset.js +21 -19
- package/dist/logic/editorValues.cjs +1 -1
- package/dist/logic/editorValues.js +41 -15
- package/dist/logic/elementScale.cjs +1 -0
- package/dist/logic/elementScale.d.ts +8 -0
- package/dist/logic/elementScale.js +14 -0
- package/dist/logic/filtering.cjs +1 -1
- package/dist/logic/filtering.js +14 -11
- package/dist/logic/focusCycle.cjs +1 -0
- package/dist/logic/focusCycle.d.ts +1 -0
- package/dist/logic/focusCycle.js +15 -0
- package/dist/logic/labelRows.cjs +1 -1
- package/dist/logic/labelRows.d.ts +2 -0
- package/dist/logic/labelRows.js +8 -4
- package/dist/logic/localeText.cjs +1 -1
- package/dist/logic/localeText.js +1 -1
- package/dist/logic/rowSelection.cjs +1 -1
- package/dist/logic/rowSelection.d.ts +4 -0
- package/dist/logic/rowSelection.js +31 -8
- package/dist/logic/selectOptions.cjs +1 -1
- package/dist/logic/selectOptions.d.ts +2 -2
- package/dist/logic/selectOptions.js +16 -12
- package/dist/logic/selectionOverlayGeometry.cjs +1 -1
- package/dist/logic/selectionOverlayGeometry.js +12 -12
- package/dist/logic/sorting.cjs +1 -1
- package/dist/logic/sorting.d.ts +1 -0
- package/dist/logic/sorting.js +24 -12
- package/dist/model/gridTypes.core.d.ts +48 -28
- package/dist/utils/deprecation.cjs +1 -1
- package/dist/utils/deprecation.d.ts +1 -30
- package/dist/utils/deprecation.js +1 -30
- package/package.json +1 -1
- package/dist/logic/exportScope.cjs +0 -1
- package/dist/logic/exportScope.d.ts +0 -3
- package/dist/logic/exportScope.js +0 -5
|
@@ -2,10 +2,11 @@ import { createValueStore as e } from "../logic/valueStore.js";
|
|
|
2
2
|
import { isViewCellEditable as t } from "../utils/permissions.js";
|
|
3
3
|
import { gridActions as n } from "../model/gridActions.js";
|
|
4
4
|
import { computeNextScrollPosition as r, hasPointerLeftActivationRadius as i, resolveAutoScrollAxisDirection as a, resolveScrollContentBox as o } from "../logic/autoScrollGeometry.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { resolveElementScale as s } from "../logic/elementScale.js";
|
|
6
|
+
import { createPopoverWindowBindings as c, isInsideGridRoot as l, restoreGridFocus as u } from "./popoverSupport.js";
|
|
7
|
+
import { applyFillEditsToRows as d, buildFillEdits as f, isSameFillRange as p, previewFillValue as m, resolveFillColumnBounds as h, resolveFillDoubleClickTarget as g, resolveFillSource as _, resolveFillTarget as v, unionFillRange as y } from "../logic/fillHandle.js";
|
|
7
8
|
//#region src/controllers/fillHandleController.ts
|
|
8
|
-
var
|
|
9
|
+
var b = 168, x = 84, S = 8, C = { status: "idle" }, w = (e, t, n) => {
|
|
9
10
|
if (e.valueFormatter) try {
|
|
10
11
|
return e.valueFormatter({
|
|
11
12
|
value: n,
|
|
@@ -16,80 +17,81 @@ var y = 168, b = 84, x = 8, S = { status: "idle" }, C = (e, t, n) => {
|
|
|
16
17
|
return String(n ?? "");
|
|
17
18
|
}
|
|
18
19
|
return String(n ?? "");
|
|
19
|
-
},
|
|
20
|
+
}, ee = (e, t) => e === t || e.length === t.length && e.every((e, n) => e.key === t[n].key), T = 500, E = 6, D = 2, te = (e) => {
|
|
20
21
|
let t = e.currentTarget;
|
|
21
22
|
if (!(t instanceof Element)) return !0;
|
|
22
23
|
let n = t.getBoundingClientRect();
|
|
23
24
|
return e.clientX >= n.left - D && e.clientX <= n.right + D && e.clientY >= n.top - D && e.clientY <= n.bottom + D;
|
|
24
|
-
},
|
|
25
|
-
let D = null,
|
|
25
|
+
}, O = (e, t) => e === t || e !== void 0 && t !== void 0 && e.length === t.length && e.every((e, n) => Object.is(e, t[n])), k = (e, t) => Object.is(e, t) || e instanceof Date && t instanceof Date && e.getTime() === t.getTime(), A = (e, t) => e.length === t.length && e.every((e, n) => e.viewIndex === t[n].viewIndex && e.column.key === t[n].column.key && k(e.value, t[n].value)), j = () => {
|
|
26
|
+
let D = null, k = e(C), j = e(null), M = { current: null }, N = { current: null }, P = null, F = null, I = null, L = (e) => e ? "toggled" : "auto", R = (e) => (n, r, i, a) => t({
|
|
26
27
|
readOnly: e.readOnly,
|
|
27
28
|
canEditCell: e.canEditCell
|
|
28
|
-
}, e.rowModel, n, r, i, a),
|
|
29
|
-
if (
|
|
30
|
-
let e =
|
|
31
|
-
if (e.status === "dragging" && e.toggled ===
|
|
29
|
+
}, e.rowModel, n, r, i, a), z = () => {
|
|
30
|
+
if (I === null || D === null) return;
|
|
31
|
+
let e = k.getSnapshot();
|
|
32
|
+
if (e.status === "dragging" && e.toggled === I.toggled && (e.target === I.target || e.target !== null && I.target !== null && e.target.direction === I.target.direction && p(e.target.range, I.target.range))) return;
|
|
32
33
|
let t = null;
|
|
33
|
-
if (
|
|
34
|
-
let e =
|
|
34
|
+
if (I.target !== null) {
|
|
35
|
+
let e = m({
|
|
35
36
|
rowModel: D.rowModel,
|
|
36
37
|
columns: D.columns,
|
|
37
|
-
source:
|
|
38
|
-
target:
|
|
39
|
-
request:
|
|
40
|
-
canWriteCell:
|
|
38
|
+
source: I.source,
|
|
39
|
+
target: I.target,
|
|
40
|
+
request: L(I.toggled),
|
|
41
|
+
canWriteCell: R(D),
|
|
41
42
|
getFillValue: D.getFillValue
|
|
42
43
|
});
|
|
43
|
-
t = e &&
|
|
44
|
+
t = e && w(e.column, e.row, e.value) || null;
|
|
44
45
|
}
|
|
45
|
-
|
|
46
|
+
k.setSnapshot({
|
|
46
47
|
status: "dragging",
|
|
47
|
-
source:
|
|
48
|
-
target:
|
|
49
|
-
toggled:
|
|
48
|
+
source: I.source,
|
|
49
|
+
target: I.target,
|
|
50
|
+
toggled: I.toggled,
|
|
50
51
|
previewText: t
|
|
51
52
|
});
|
|
53
|
+
}, B = () => {
|
|
54
|
+
if (I === null || D === null) return;
|
|
55
|
+
let e = h(D.columns), t = D.hitTest(I.pointer.x, I.pointer.y);
|
|
56
|
+
e === null || t === null || (I.target = v(I.source, t, D.rowModel.getRowCount(), e), z());
|
|
52
57
|
}, V = () => {
|
|
53
|
-
if (
|
|
54
|
-
let e =
|
|
55
|
-
e
|
|
56
|
-
}, H = () => {
|
|
57
|
-
if (L === null || D === null) return;
|
|
58
|
-
let e = L;
|
|
59
|
-
e.rafId = requestAnimationFrame(H);
|
|
58
|
+
if (I === null || D === null) return;
|
|
59
|
+
let e = I;
|
|
60
|
+
e.rafId = requestAnimationFrame(V);
|
|
60
61
|
let t = D.scrollContainerRef.current;
|
|
61
62
|
if (!t) return;
|
|
62
63
|
if (!e.armed) {
|
|
63
64
|
if (!i(e.origin, e.pointer, 6)) return;
|
|
64
65
|
e.armed = !0;
|
|
65
66
|
}
|
|
66
|
-
let n = t.getBoundingClientRect(),
|
|
67
|
+
let n = t.getBoundingClientRect(), c = o({
|
|
67
68
|
rectLeft: n.left,
|
|
68
69
|
rectTop: n.top,
|
|
69
70
|
clientLeft: t.clientLeft,
|
|
70
71
|
clientTop: t.clientTop,
|
|
71
72
|
clientWidth: t.clientWidth,
|
|
72
|
-
clientHeight: t.clientHeight
|
|
73
|
-
|
|
74
|
-
(c
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
clientHeight: t.clientHeight,
|
|
74
|
+
scale: s(t, n)
|
|
75
|
+
}), l = r(t.scrollTop, a(e.pointer.y, c.top, c.bottom - (D.footerHeight ?? 0), 24), 18, t.scrollHeight - t.clientHeight), u = r(t.scrollLeft, a(e.pointer.x, c.left, c.right, 24), 18, t.scrollWidth - t.clientWidth);
|
|
76
|
+
(l !== t.scrollTop || u !== t.scrollLeft) && (t.scrollTo({
|
|
77
|
+
top: l,
|
|
78
|
+
left: u,
|
|
77
79
|
behavior: "auto"
|
|
78
|
-
}),
|
|
79
|
-
},
|
|
80
|
-
let n =
|
|
80
|
+
}), B());
|
|
81
|
+
}, H = (e, t) => {
|
|
82
|
+
let n = I;
|
|
81
83
|
if (n !== null) {
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
+
if (I = null, n.cleanup(), n.rafId !== null && cancelAnimationFrame(n.rafId), j.setSnapshot(null), k.setSnapshot(C), e && n.target !== null) {
|
|
85
|
+
F = null, G(n.source, n.target, L(n.toggled), n.activeCell);
|
|
84
86
|
return;
|
|
85
87
|
}
|
|
86
|
-
|
|
88
|
+
F = e && t !== void 0 && n.onSquare ? {
|
|
87
89
|
time: t,
|
|
88
90
|
x: n.origin.x,
|
|
89
91
|
y: n.origin.y
|
|
90
92
|
} : null;
|
|
91
93
|
}
|
|
92
|
-
},
|
|
94
|
+
}, U = (e, t) => {
|
|
93
95
|
if (D === null) return;
|
|
94
96
|
let { dispatch: r } = D;
|
|
95
97
|
r(n.startSelection({
|
|
@@ -102,33 +104,33 @@ var y = 168, b = 84, x = 8, S = { status: "idle" }, C = (e, t, n) => {
|
|
|
102
104
|
row: e.startRow,
|
|
103
105
|
col: e.startCol
|
|
104
106
|
}));
|
|
105
|
-
},
|
|
107
|
+
}, W = (e, t) => {
|
|
106
108
|
let n = [];
|
|
107
109
|
for (let r = t.startRow; r <= t.endRow; r += 1) n.push(e.getRowKey(r));
|
|
108
110
|
return n;
|
|
109
|
-
},
|
|
111
|
+
}, G = (e, t, n, r) => {
|
|
110
112
|
if (D === null || !D.enabled) return;
|
|
111
|
-
let i = D, a =
|
|
113
|
+
let i = D, a = f({
|
|
112
114
|
rowModel: i.rowModel,
|
|
113
115
|
columns: i.columns,
|
|
114
116
|
source: e,
|
|
115
117
|
target: t,
|
|
116
118
|
request: n,
|
|
117
|
-
canWriteCell:
|
|
119
|
+
canWriteCell: R(i),
|
|
118
120
|
getFillValue: i.getFillValue
|
|
119
121
|
});
|
|
120
122
|
if (a.edits.length === 0) return;
|
|
121
|
-
let o =
|
|
123
|
+
let o = y(e, t), s = null, c = [], l = null;
|
|
122
124
|
if (i.isServerSide) {
|
|
123
125
|
if (!i.applyServerSideCellEdits) return;
|
|
124
|
-
l =
|
|
126
|
+
l = W(i.rowModel, o), i.applyServerSideCellEdits(a.edits);
|
|
125
127
|
} else {
|
|
126
128
|
if (!i.applyRowsChange) return;
|
|
127
|
-
let e =
|
|
129
|
+
let e = d(i.rows, i.rowModel, a.edits);
|
|
128
130
|
if (e === i.rows) return;
|
|
129
131
|
s = i.rows, c.push(e), i.applyRowsChange(e);
|
|
130
132
|
}
|
|
131
|
-
|
|
133
|
+
P = {
|
|
132
134
|
source: e,
|
|
133
135
|
target: t,
|
|
134
136
|
range: o,
|
|
@@ -142,74 +144,74 @@ var y = 168, b = 84, x = 8, S = { status: "idle" }, C = (e, t, n) => {
|
|
|
142
144
|
baseRowModel: i.isServerSide ? null : i.rowModel,
|
|
143
145
|
emittedRows: c,
|
|
144
146
|
rowKeys: l
|
|
145
|
-
},
|
|
147
|
+
}, U(o, r), k.setSnapshot({
|
|
146
148
|
status: "filled",
|
|
147
149
|
range: o,
|
|
148
150
|
kind: a.kind,
|
|
149
151
|
seriesAvailable: a.seriesAvailable,
|
|
150
152
|
menu: null
|
|
151
153
|
});
|
|
152
|
-
},
|
|
154
|
+
}, K = c({
|
|
153
155
|
onScroll: (e) => {
|
|
154
|
-
e.target instanceof Node &&
|
|
156
|
+
e.target instanceof Node && M.current?.contains(e.target) || J(!1);
|
|
155
157
|
},
|
|
156
|
-
onResize: () =>
|
|
157
|
-
isInside: (e) =>
|
|
158
|
-
onOutsidePointerDown: (e) =>
|
|
158
|
+
onResize: () => J(!1),
|
|
159
|
+
isInside: (e) => M.current?.contains(e) === !0 || N.current?.contains(e) === !0,
|
|
160
|
+
onOutsidePointerDown: (e) => J(D !== null && l(D.gridRootRef, e)),
|
|
159
161
|
getGridRoot: () => D?.gridRootRef.current ?? null,
|
|
160
|
-
onGridHidden: () =>
|
|
162
|
+
onGridHidden: () => J(!1),
|
|
161
163
|
onKeyDown: (e) => {
|
|
162
|
-
e.key === "Escape" && (e.preventDefault(), e.stopPropagation(),
|
|
164
|
+
e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), J(!0));
|
|
163
165
|
}
|
|
164
|
-
}),
|
|
165
|
-
let t =
|
|
166
|
-
t.status !== "filled" || t.menu === e ||
|
|
166
|
+
}), q = (e) => {
|
|
167
|
+
let t = k.getSnapshot();
|
|
168
|
+
t.status !== "filled" || t.menu === e || k.setSnapshot({
|
|
167
169
|
...t,
|
|
168
170
|
menu: e
|
|
169
171
|
});
|
|
170
|
-
},
|
|
171
|
-
|
|
172
|
-
},
|
|
173
|
-
let e = typeof document < "u" &&
|
|
174
|
-
|
|
175
|
-
},
|
|
176
|
-
let t =
|
|
172
|
+
}, J = (e) => {
|
|
173
|
+
K.detach(), q(null), e && D !== null && u(D.gridRootRef);
|
|
174
|
+
}, Y = () => {
|
|
175
|
+
let e = typeof document < "u" && M.current?.contains(document.activeElement) === !0;
|
|
176
|
+
P = null, K.detach(), k.getSnapshot().status === "filled" && k.setSnapshot(C), e && D !== null && u(D.gridRootRef);
|
|
177
|
+
}, X = (e) => {
|
|
178
|
+
let t = k.getSnapshot();
|
|
177
179
|
if (t.status !== "filled") return;
|
|
178
180
|
if (t.menu !== null) {
|
|
179
|
-
|
|
181
|
+
J(!0);
|
|
180
182
|
return;
|
|
181
183
|
}
|
|
182
|
-
let n = Math.min(e.left, window.innerWidth -
|
|
183
|
-
n = Math.max(
|
|
184
|
+
let n = Math.min(e.left, window.innerWidth - b - S);
|
|
185
|
+
n = Math.max(S, n);
|
|
184
186
|
let r = e.bottom + 4;
|
|
185
|
-
r +
|
|
187
|
+
r + x > window.innerHeight - S && (r = Math.max(S, e.top - 4 - x)), q({
|
|
186
188
|
top: r,
|
|
187
189
|
left: n
|
|
188
|
-
}),
|
|
189
|
-
},
|
|
190
|
+
}), K.attach();
|
|
191
|
+
}, Z = (e, t) => {
|
|
190
192
|
let n = t.rowKeys;
|
|
191
193
|
if (n === null) return !1;
|
|
192
194
|
for (let r = 0; r < n.length; r += 1) if (e.getRowKey(t.range.startRow + r) !== n[r]) return !1;
|
|
193
195
|
return !0;
|
|
194
|
-
},
|
|
195
|
-
let n =
|
|
196
|
-
if (
|
|
196
|
+
}, ne = (e) => {
|
|
197
|
+
let n = k.getSnapshot(), r = P;
|
|
198
|
+
if (J(!0), D === null || r === null || n.status !== "filled" || r.request === e) return;
|
|
197
199
|
let i = D;
|
|
198
200
|
if (i.isServerSide) {
|
|
199
|
-
if (!i.applyServerSideCellEdits || !
|
|
200
|
-
|
|
201
|
+
if (!i.applyServerSideCellEdits || !Z(i.rowModel, r)) {
|
|
202
|
+
Y();
|
|
201
203
|
return;
|
|
202
204
|
}
|
|
203
|
-
let t =
|
|
205
|
+
let t = f({
|
|
204
206
|
rowModel: i.rowModel,
|
|
205
207
|
columns: r.columns,
|
|
206
208
|
source: r.source,
|
|
207
209
|
target: r.target,
|
|
208
210
|
request: e,
|
|
209
|
-
canWriteCell:
|
|
211
|
+
canWriteCell: R(i),
|
|
210
212
|
getFillValue: i.getFillValue
|
|
211
213
|
});
|
|
212
|
-
r.request = e, t.edits.length > 0 && !
|
|
214
|
+
r.request = e, t.edits.length > 0 && !A(t.edits, r.edits) && i.applyServerSideCellEdits(t.edits), r.edits = t.edits, k.setSnapshot({
|
|
213
215
|
...n,
|
|
214
216
|
kind: t.kind,
|
|
215
217
|
menu: null
|
|
@@ -217,10 +219,10 @@ var y = 168, b = 84, x = 8, S = { status: "idle" }, C = (e, t, n) => {
|
|
|
217
219
|
return;
|
|
218
220
|
}
|
|
219
221
|
if (!i.amendRowsChange || r.baseRows === null || r.baseRowModel === null) {
|
|
220
|
-
|
|
222
|
+
Y();
|
|
221
223
|
return;
|
|
222
224
|
}
|
|
223
|
-
let a = r.baseRowModel, o =
|
|
225
|
+
let a = r.baseRowModel, o = f({
|
|
224
226
|
rowModel: a,
|
|
225
227
|
columns: r.columns,
|
|
226
228
|
source: r.source,
|
|
@@ -232,11 +234,11 @@ var y = 168, b = 84, x = 8, S = { status: "idle" }, C = (e, t, n) => {
|
|
|
232
234
|
}, a, e, n, r, o),
|
|
233
235
|
getFillValue: i.getFillValue
|
|
234
236
|
});
|
|
235
|
-
if (r.request = e, !
|
|
236
|
-
let e =
|
|
237
|
+
if (r.request = e, !A(o.edits, r.edits)) {
|
|
238
|
+
let e = d(r.baseRows, a, o.edits);
|
|
237
239
|
r.emittedRows.push(e), r.edits = o.edits, i.amendRowsChange(e);
|
|
238
240
|
}
|
|
239
|
-
|
|
241
|
+
k.setSnapshot({
|
|
240
242
|
...n,
|
|
241
243
|
kind: o.kind,
|
|
242
244
|
menu: null
|
|
@@ -244,65 +246,65 @@ var y = 168, b = 84, x = 8, S = { status: "idle" }, C = (e, t, n) => {
|
|
|
244
246
|
}, Q = (e, t) => {
|
|
245
247
|
if (e?.type !== "cell") return !1;
|
|
246
248
|
let { start: n, end: r } = e.range;
|
|
247
|
-
return
|
|
249
|
+
return p(t, {
|
|
248
250
|
startRow: Math.min(n.row, r.row),
|
|
249
251
|
endRow: Math.max(n.row, r.row),
|
|
250
252
|
startCol: Math.min(n.col, r.col),
|
|
251
253
|
endCol: Math.max(n.col, r.col)
|
|
252
254
|
});
|
|
253
|
-
},
|
|
254
|
-
let t =
|
|
255
|
+
}, re = (e) => {
|
|
256
|
+
let t = P;
|
|
255
257
|
if (t !== null) {
|
|
256
|
-
if (!e.enabled || e.editing || !
|
|
257
|
-
|
|
258
|
+
if (!e.enabled || e.editing || !ee(e.columns, t.columns) || !O(e.viewKey, t.viewKey)) {
|
|
259
|
+
Y();
|
|
258
260
|
return;
|
|
259
261
|
}
|
|
260
262
|
if (!e.isServerSide && e.rows !== t.baseRows && !t.emittedRows.includes(e.rows)) {
|
|
261
|
-
|
|
263
|
+
Y();
|
|
262
264
|
return;
|
|
263
265
|
}
|
|
264
266
|
if (Q(e.selection, t.range)) {
|
|
265
267
|
t.selectionConfirmed = !0;
|
|
266
268
|
return;
|
|
267
269
|
}
|
|
268
|
-
!t.selectionConfirmed && Q(e.selection, t.previousSource) ||
|
|
270
|
+
!t.selectionConfirmed && Q(e.selection, t.previousSource) || Y();
|
|
269
271
|
}
|
|
270
|
-
},
|
|
271
|
-
if (D === null || e.button !== 0 || (e.preventDefault(),
|
|
272
|
-
let t =
|
|
272
|
+
}, ie = (e) => {
|
|
273
|
+
if (D === null || e.button !== 0 || (e.preventDefault(), I !== null || !D.enabled || D.editing)) return;
|
|
274
|
+
let t = _(D.selection, D.activeCell, D.rowModel.getRowCount(), D.columns.length);
|
|
273
275
|
if (t === null) return;
|
|
274
|
-
let n =
|
|
275
|
-
|
|
276
|
-
let r =
|
|
276
|
+
let n = F;
|
|
277
|
+
F = null;
|
|
278
|
+
let r = te(e);
|
|
277
279
|
if (n !== null && r && e.timeStamp - n.time <= T && Math.abs(e.clientX - n.x) <= E && Math.abs(e.clientY - n.y) <= E) {
|
|
278
280
|
D.gridRootRef.current?.focus({ preventScroll: !0 }), $();
|
|
279
281
|
return;
|
|
280
282
|
}
|
|
281
|
-
|
|
283
|
+
Y(), D.gridRootRef.current?.focus({ preventScroll: !0 });
|
|
282
284
|
let i = e.pointerId, a = (e) => {
|
|
283
|
-
|
|
285
|
+
I === null || e.pointerId !== i || (I.pointer = {
|
|
284
286
|
x: e.clientX,
|
|
285
287
|
y: e.clientY
|
|
286
|
-
},
|
|
288
|
+
}, I.toggled = e.ctrlKey || e.metaKey, j.setSnapshot(I.pointer), B());
|
|
287
289
|
}, o = (e) => {
|
|
288
|
-
|
|
290
|
+
I === null || e.pointerId !== i || (I.toggled = e.ctrlKey || e.metaKey, H(!0, e.timeStamp));
|
|
289
291
|
}, s = (e) => {
|
|
290
|
-
e.pointerId === i &&
|
|
292
|
+
e.pointerId === i && H(!1);
|
|
291
293
|
}, c = (e) => {
|
|
292
|
-
if (
|
|
294
|
+
if (I === null) return;
|
|
293
295
|
if (e.preventDefault(), e.stopPropagation(), e.type === "keydown" && e.key === "Escape") {
|
|
294
|
-
|
|
296
|
+
H(!1);
|
|
295
297
|
return;
|
|
296
298
|
}
|
|
297
299
|
let t = e.ctrlKey || e.metaKey;
|
|
298
|
-
t !==
|
|
299
|
-
}, l = () =>
|
|
300
|
+
t !== I.toggled && (I.toggled = t, z());
|
|
301
|
+
}, l = () => H(!1);
|
|
300
302
|
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);
|
|
301
303
|
let u = {
|
|
302
304
|
x: e.clientX,
|
|
303
305
|
y: e.clientY
|
|
304
306
|
};
|
|
305
|
-
|
|
307
|
+
I = {
|
|
306
308
|
pointerId: i,
|
|
307
309
|
source: t,
|
|
308
310
|
activeCell: D.activeCell,
|
|
@@ -316,33 +318,33 @@ var y = 168, b = 84, x = 8, S = { status: "idle" }, C = (e, t, n) => {
|
|
|
316
318
|
cleanup: () => {
|
|
317
319
|
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);
|
|
318
320
|
}
|
|
319
|
-
},
|
|
321
|
+
}, j.setSnapshot(u), z(), I.rafId = requestAnimationFrame(V);
|
|
320
322
|
}, $ = () => {
|
|
321
|
-
if (D === null ||
|
|
322
|
-
let e =
|
|
323
|
+
if (D === null || I !== null || !D.enabled || D.editing) return;
|
|
324
|
+
let e = _(D.selection, D.activeCell, D.rowModel.getRowCount(), D.columns.length);
|
|
323
325
|
if (e === null) return;
|
|
324
|
-
let t =
|
|
325
|
-
t !== null && (
|
|
326
|
+
let t = g(e, D.rowModel, D.columns);
|
|
327
|
+
t !== null && (Y(), G(e, t, "auto", D.activeCell));
|
|
326
328
|
};
|
|
327
329
|
return {
|
|
328
330
|
update: (e) => {
|
|
329
|
-
D = e,
|
|
331
|
+
D = e, I !== null && (!e.enabled || e.editing) && H(!1), re(e);
|
|
330
332
|
},
|
|
331
|
-
subscribe:
|
|
332
|
-
getSnapshot:
|
|
333
|
-
subscribePointer:
|
|
334
|
-
getPointerSnapshot:
|
|
335
|
-
handlePointerDown:
|
|
333
|
+
subscribe: k.subscribe,
|
|
334
|
+
getSnapshot: k.getSnapshot,
|
|
335
|
+
subscribePointer: j.subscribe,
|
|
336
|
+
getPointerSnapshot: j.getSnapshot,
|
|
337
|
+
handlePointerDown: ie,
|
|
336
338
|
handleDoubleClick: $,
|
|
337
|
-
toggleMenu:
|
|
338
|
-
closeMenu: () =>
|
|
339
|
-
chooseKind:
|
|
340
|
-
menuPanel:
|
|
341
|
-
chipElement:
|
|
339
|
+
toggleMenu: X,
|
|
340
|
+
closeMenu: () => J(!0),
|
|
341
|
+
chooseKind: ne,
|
|
342
|
+
menuPanel: M,
|
|
343
|
+
chipElement: N,
|
|
342
344
|
dispose: () => {
|
|
343
|
-
|
|
345
|
+
H(!1), K.detach(), P = null;
|
|
344
346
|
}
|
|
345
347
|
};
|
|
346
348
|
};
|
|
347
349
|
//#endregion
|
|
348
|
-
export {
|
|
350
|
+
export { j as createFillHandleController };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../logic/chunkedLoop.cjs"),n=require("../logic/detailRow.cjs"),r=require("../logic/find.cjs");var i=1e4,a=new Map,
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../logic/chunkedLoop.cjs"),n=require("../logic/detailRow.cjs"),r=require("../logic/find.cjs");var i=1e4,a=5e4,o=new Map,s=[],c=(e,t)=>e.length===t.length&&e.every((e,n)=>{let r=t[n];return e.rowIndex===r.rowIndex&&e.colIndex===r.colIndex&&e.columnKey===r.columnKey&&e.start===r.start&&e.length===r.length}),l=()=>{let i=null,l=0,u=null,d=!1,f=null,p=e.createValueStore({open:!1,query:``,matches:[],index:o,currentIndex:null,scanning:!1,truncated:!1}),m=e=>{p.setSnapshot({...p.getSnapshot(),...e})},h=null,g=()=>{let e=p.getSnapshot(),t={query:e.query,matchCount:e.matches.length,currentIndex:e.currentIndex,open:e.open};h!==null&&h.query===t.query&&h.matchCount===t.matchCount&&h.currentIndex===t.currentIndex&&h.open===t.open||(h=t,i?.onChange?.(t))},_=()=>{let e=p.getSnapshot();if(e.currentIndex===null)return;let t=e.matches[e.currentIndex];t&&i?.onNavigate(t.rowIndex,t.colIndex)},v=()=>{l+=1,f=null,u=null,d=!1,m({matches:[],index:o,currentIndex:null,scanning:!1,truncated:!1})},y=(e,o=!1)=>{let h=i,b=p.getSnapshot();if(!h||!b.open||b.query.length===0){v(),g();return}l+=1;let x=l,{rowModel:S,columns:C,caseSensitive:w}=h,T=b.query,E=f!==null&&f.query===T&&f.caseSensitive===w;f={rowModel:S,columns:C,query:T,caseSensitive:w},(o||u===null||u.columns!==C||u.query!==T||u.caseSensitive!==w)&&(u={columns:C,query:T,caseSensitive:w,byRow:new WeakMap});let D=u.byRow,O=0,k=e||d;d=k;let A=b.currentIndex===null?null:b.matches[b.currentIndex]??null,j=[],M=!1,N=S.getRowCount(),P=N>a,F=e=>{let t=[];return C.forEach((i,a)=>{if(n.isSyntheticColumnKey(i.key)||!r.isFindableColumn(i))return;let o=r.resolveFindCellText(i,e);for(let e of r.findRangesInText(o,T,w))t.push({colIndex:a,columnKey:String(i.key),start:e.start,length:e.length})}),t.length===0?s:t};!E&&!b.scanning&&m({scanning:!0}),t.runChunked(N,e=>{if(M)return;let t=S.getRow(e);if(t===void 0)return;let n;P&&typeof t==`object`&&t?(n=D.get(t),n===void 0?(n=F(t),D.set(t,n)):O+=1):n=F(t);for(let t of n){if(j.length>=1e4){M=!0;return}j.push({rowIndex:e,colIndex:t.colIndex,columnKey:t.columnKey,start:t.start,length:t.length})}},{isCancelled:()=>l!==x}).then(e=>{if(!e||l!==x||(d=!1,o&&M===p.getSnapshot().truncated&&c(p.getSnapshot().matches,j)))return;let t=r.resolveCurrentAfterRescan(j,A);m({matches:j,index:r.buildFindIndex(j),currentIndex:t,scanning:!1,truncated:M}),g(),k&&_(),!o&&O>0&&y(!1,!0)})},b=()=>{let e=p.getSnapshot();return!i||!e.open||e.query.length===0?!1:f===null||f.rowModel!==i.rowModel||f.columns!==i.columns||f.query!==e.query||f.caseSensitive!==i.caseSensitive};return{update:e=>{let t=i;if(i=e,!e.enabled){p.getSnapshot().open&&(m({open:!1,query:``}),v(),g());return}t!==e&&b()&&y(!1)},open:e=>{if(!i?.enabled)return;let t=p.getSnapshot(),n=e??t.query;m({open:!0,query:n}),n!==t.query||!t.open?y(!0):g()},close:()=>{p.getSnapshot().open&&(m({open:!1,query:``}),v(),g())},setQuery:e=>{let t=p.getSnapshot();!t.open||e===t.query||(m({query:e}),y(!0))},next:()=>{let e=p.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,1);m({currentIndex:t}),g(),_()},prev:()=>{let e=p.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,-1);m({currentIndex:t}),g(),_()},subscribe:p.subscribe,getSnapshot:p.getSnapshot,dispose:()=>{l+=1,i=null}}};exports.FIND_HIT_CACHE_ROW_THRESHOLD=a,exports.MAX_FIND_MATCHES=i,exports.createFindController=l;
|