@ishibashi0112/spreadsheet-grid-core 1.8.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/controllers/activeRowFollowController.cjs +1 -1
- package/dist/controllers/activeRowFollowController.d.ts +1 -0
- package/dist/controllers/activeRowFollowController.js +33 -24
- package/dist/controllers/changeTracker.cjs +1 -1
- package/dist/controllers/changeTracker.d.ts +6 -0
- package/dist/controllers/changeTracker.js +338 -160
- package/dist/controllers/clipboardController.cjs +2 -1
- package/dist/controllers/clipboardController.d.ts +5 -1
- package/dist/controllers/clipboardController.js +217 -91
- package/dist/controllers/columnAutosizeRunner.cjs +1 -1
- package/dist/controllers/columnAutosizeRunner.d.ts +3 -1
- package/dist/controllers/columnAutosizeRunner.js +12 -11
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.js +231 -159
- package/dist/controllers/fillHandleController.cjs +1 -1
- package/dist/controllers/fillHandleController.js +114 -113
- package/dist/controllers/findController.cjs +1 -1
- package/dist/controllers/findController.d.ts +3 -1
- package/dist/controllers/findController.js +80 -75
- package/dist/controllers/historyController.cjs +1 -1
- package/dist/controllers/historyController.d.ts +25 -1
- package/dist/controllers/historyController.js +115 -64
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.d.ts +5 -0
- package/dist/controllers/keyboardController.js +154 -140
- package/dist/controllers/rowDragController.cjs +1 -1
- package/dist/controllers/rowDragController.d.ts +1 -0
- package/dist/controllers/rowDragController.js +1 -0
- package/dist/engine/cellCommands.cjs +1 -1
- package/dist/engine/cellCommands.js +81 -62
- package/dist/engine/columnLayout.cjs +1 -1
- package/dist/engine/columnLayout.d.ts +1 -0
- package/dist/engine/columnLayout.js +10 -10
- package/dist/engine/createGridEngine.cjs +1 -1
- package/dist/engine/createGridEngine.d.ts +6 -1
- package/dist/engine/createGridEngine.js +58 -50
- package/dist/engine/excelShortcutCommands.cjs +1 -0
- package/dist/engine/excelShortcutCommands.d.ts +29 -0
- package/dist/engine/excelShortcutCommands.js +256 -0
- package/dist/engine/exportCommands.cjs +2 -2
- package/dist/engine/exportCommands.js +82 -34
- package/dist/engine/features.cjs +1 -1
- package/dist/engine/features.d.ts +21 -0
- package/dist/engine/features.js +23 -2
- package/dist/engine/fullFeatures.cjs +1 -1
- package/dist/engine/fullFeatures.js +24 -10
- package/dist/engine/gridApi.cjs +10 -9
- package/dist/engine/gridApi.d.ts +21 -2
- package/dist/engine/gridApi.js +239 -101
- package/dist/engine/memo.cjs +1 -1
- package/dist/engine/memo.d.ts +1 -1
- package/dist/engine/memo.js +12 -11
- package/dist/engine/newRowController.cjs +1 -0
- package/dist/engine/newRowController.d.ts +31 -0
- package/dist/engine/newRowController.js +157 -0
- package/dist/engine/notifiers.cjs +1 -1
- package/dist/engine/notifiers.d.ts +9 -1
- package/dist/engine/notifiers.js +23 -8
- package/dist/engine/rowPipeline.cjs +1 -1
- package/dist/engine/rowPipeline.d.ts +29 -2
- package/dist/engine/rowPipeline.js +76 -50
- package/dist/engine/treeStage.cjs +1 -0
- package/dist/engine/treeStage.d.ts +46 -0
- package/dist/engine/treeStage.js +171 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/locales/en.cjs +1 -1
- package/dist/locales/en.js +12 -0
- package/dist/logic/cellPlacement.cjs +1 -1
- package/dist/logic/cellPlacement.d.ts +1 -1
- package/dist/logic/cellPlacement.js +1 -1
- package/dist/logic/changeTracking.cjs +1 -1
- package/dist/logic/changeTracking.d.ts +26 -1
- package/dist/logic/changeTracking.js +139 -32
- package/dist/logic/clearCells.cjs +1 -1
- package/dist/logic/clearCells.d.ts +4 -2
- package/dist/logic/clearCells.js +24 -24
- package/dist/logic/columnAutosize.cjs +1 -1
- package/dist/logic/columnAutosize.d.ts +4 -1
- package/dist/logic/columnAutosize.js +89 -72
- package/dist/logic/conditionalFormat.cjs +1 -1
- package/dist/logic/conditionalFormat.js +8 -5
- package/dist/logic/editorKeys.cjs +1 -1
- package/dist/logic/editorKeys.d.ts +9 -1
- package/dist/logic/editorKeys.js +23 -17
- package/dist/logic/excelShortcuts.cjs +1 -0
- package/dist/logic/excelShortcuts.d.ts +13 -0
- package/dist/logic/excelShortcuts.js +36 -0
- package/dist/logic/exportCsv.cjs +2 -2
- package/dist/logic/exportCsv.d.ts +11 -1
- package/dist/logic/exportCsv.js +30 -22
- package/dist/logic/exportData.cjs +1 -1
- package/dist/logic/exportData.d.ts +3 -2
- package/dist/logic/exportData.js +40 -28
- package/dist/logic/featureWarnings.cjs +1 -1
- package/dist/logic/featureWarnings.js +16 -6
- package/dist/logic/fillHandle.cjs +1 -1
- package/dist/logic/fillHandle.js +1 -1
- package/dist/logic/find.cjs +1 -1
- package/dist/logic/find.d.ts +1 -1
- package/dist/logic/find.js +11 -9
- package/dist/logic/gridState.cjs +1 -1
- package/dist/logic/gridState.d.ts +3 -2
- package/dist/logic/gridState.js +6 -6
- package/dist/logic/imeInput.cjs +1 -1
- package/dist/logic/imeInput.js +22 -21
- package/dist/logic/localeTextFeatures.cjs +1 -1
- package/dist/logic/localeTextFeatures.d.ts +16 -0
- package/dist/logic/localeTextFeatures.js +22 -8
- package/dist/logic/newRow.cjs +1 -0
- package/dist/logic/newRow.d.ts +9 -0
- package/dist/logic/newRow.js +69 -0
- package/dist/logic/selectionAggregates.cjs +1 -1
- package/dist/logic/selectionAggregates.js +3 -2
- package/dist/logic/sorting.cjs +1 -1
- package/dist/logic/sorting.d.ts +1 -1
- package/dist/logic/sorting.js +32 -32
- package/dist/logic/treeData.cjs +7 -0
- package/dist/logic/treeData.d.ts +83 -0
- package/dist/logic/treeData.js +438 -0
- package/dist/logic/validation.cjs +1 -1
- package/dist/logic/validation.d.ts +1 -1
- package/dist/logic/validation.js +10 -9
- package/dist/model/gridActions.cjs +1 -1
- package/dist/model/gridActions.d.ts +15 -0
- package/dist/model/gridActions.js +15 -0
- package/dist/model/gridReducer.cjs +1 -1
- package/dist/model/gridReducer.js +175 -156
- package/dist/model/gridStore.cjs +1 -1
- package/dist/model/gridStore.d.ts +17 -1
- package/dist/model/gridStore.js +4 -4
- package/dist/model/gridTypes.core.d.ts +325 -25
- package/dist/model/gridTypes.unbound.d.ts +1 -0
- package/dist/utils/clipboard.cjs +1 -1
- package/dist/utils/clipboard.d.ts +1 -1
- package/dist/utils/clipboard.js +13 -10
- package/dist/utils/permissions.cjs +1 -1
- package/dist/utils/permissions.d.ts +2 -2
- package/dist/utils/permissions.js +1 -1
- package/package.json +1 -1
|
@@ -2,13 +2,14 @@ import { gridActions as e } from "../model/gridActions.js";
|
|
|
2
2
|
import { isViewCellEditable as t } from "../utils/permissions.js";
|
|
3
3
|
import { getActiveElement as n } from "../utils/shadowDom.js";
|
|
4
4
|
import { createValueStore as r } from "../logic/valueStore.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
5
|
+
import { getSelectableRowCount as i } from "../logic/newRow.js";
|
|
6
|
+
import { computeNextScrollPosition as a, hasPointerLeftActivationRadius as o, resolveAutoScrollAxisDirection as s, resolveScrollContentBox as c, resolveTopAutoScrollStart as l } from "../logic/autoScrollGeometry.js";
|
|
7
|
+
import { resolveElementScale as u } from "../logic/elementScale.js";
|
|
8
|
+
import { beginEscapeCancelableDrag as d } from "./escapeClaimController.js";
|
|
9
|
+
import { createPopoverWindowBindings as f, isInsideGridRoot as p, restoreGridFocus as m } from "./popoverSupport.js";
|
|
10
|
+
import { applyFillEditsToRows as h, buildFillEdits as g, isSameFillRange as _, previewFillValue as ee, resolveFillColumnBounds as v, resolveFillDoubleClickTarget as te, resolveFillSource as y, resolveFillTarget as b, unionFillRange as x } from "../logic/fillHandle.js";
|
|
10
11
|
//#region src/controllers/fillHandleController.ts
|
|
11
|
-
var
|
|
12
|
+
var S = 168, C = 84, w = 106, ne = () => typeof matchMedia == "function" && matchMedia("(pointer: coarse)").matches ? w : C, T = 8, E = { status: "idle" }, D = (e, t, n) => {
|
|
12
13
|
if (e.valueFormatter) try {
|
|
13
14
|
return e.valueFormatter({
|
|
14
15
|
value: n,
|
|
@@ -19,54 +20,54 @@ var ee = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && matc
|
|
|
19
20
|
return String(n ?? "");
|
|
20
21
|
}
|
|
21
22
|
return String(n ?? "");
|
|
22
|
-
},
|
|
23
|
+
}, O = (e, t) => e === t || e.length === t.length && e.every((e, n) => e.key === t[n].key), k = 500, A = 6, j = 2, re = (e) => {
|
|
23
24
|
let t = e.currentTarget;
|
|
24
25
|
if (!(t instanceof Element)) return !0;
|
|
25
26
|
let n = t.getBoundingClientRect();
|
|
26
|
-
return e.clientX >= n.left -
|
|
27
|
-
},
|
|
28
|
-
let C = null, w = r(
|
|
27
|
+
return e.clientX >= n.left - j && e.clientX <= n.right + j && e.clientY >= n.top - j && e.clientY <= n.bottom + j;
|
|
28
|
+
}, M = (e, t) => e === t || e !== void 0 && t !== void 0 && e.length === t.length && e.every((e, n) => Object.is(e, t[n])), N = (e, t) => Object.is(e, t) || e instanceof Date && t instanceof Date && e.getTime() === t.getTime(), P = (e, t) => e.length === t.length && e.every((e, n) => e.viewIndex === t[n].viewIndex && e.column.key === t[n].column.key && N(e.value, t[n].value)), F = () => {
|
|
29
|
+
let C = null, w = r(E), j = r(null), N = { current: null }, F = { current: null }, I = null, L = null, R = null, z = (e) => e ? "toggled" : "auto", B = (e) => (n, r, i, a) => t({
|
|
29
30
|
readOnly: e.readOnly,
|
|
30
31
|
canEditCell: e.canEditCell
|
|
31
|
-
}, e.rowModel, n, r, i, a),
|
|
32
|
-
if (
|
|
32
|
+
}, e.rowModel, n, r, i, a), V = () => {
|
|
33
|
+
if (R === null || C === null) return;
|
|
33
34
|
let e = w.getSnapshot();
|
|
34
|
-
if (e.status === "dragging" && e.toggled ===
|
|
35
|
+
if (e.status === "dragging" && e.toggled === R.toggled && (e.target === R.target || e.target !== null && R.target !== null && e.target.direction === R.target.direction && _(e.target.range, R.target.range))) return;
|
|
35
36
|
let t = null;
|
|
36
|
-
if (
|
|
37
|
-
let e =
|
|
37
|
+
if (R.target !== null) {
|
|
38
|
+
let e = ee({
|
|
38
39
|
rowModel: C.rowModel,
|
|
39
40
|
columns: C.columns,
|
|
40
|
-
source:
|
|
41
|
-
target:
|
|
42
|
-
request:
|
|
43
|
-
canWriteCell:
|
|
41
|
+
source: R.source,
|
|
42
|
+
target: R.target,
|
|
43
|
+
request: z(R.toggled),
|
|
44
|
+
canWriteCell: B(C),
|
|
44
45
|
getFillValue: C.getFillValue
|
|
45
46
|
});
|
|
46
|
-
t = e &&
|
|
47
|
+
t = e && D(e.column, e.row, e.value) || null;
|
|
47
48
|
}
|
|
48
49
|
w.setSnapshot({
|
|
49
50
|
status: "dragging",
|
|
50
|
-
source:
|
|
51
|
-
target:
|
|
52
|
-
toggled:
|
|
51
|
+
source: R.source,
|
|
52
|
+
target: R.target,
|
|
53
|
+
toggled: R.toggled,
|
|
53
54
|
previewText: t
|
|
54
55
|
});
|
|
55
|
-
},
|
|
56
|
-
if (
|
|
57
|
-
let e = v(C.columns), t = C.hitTest(
|
|
58
|
-
e === null || t === null || (
|
|
59
|
-
},
|
|
60
|
-
if (
|
|
61
|
-
let e =
|
|
62
|
-
e.rafId = requestAnimationFrame(
|
|
56
|
+
}, H = () => {
|
|
57
|
+
if (R === null || C === null) return;
|
|
58
|
+
let e = v(C.columns), t = C.hitTest(R.pointer.x, R.pointer.y);
|
|
59
|
+
e === null || t === null || (R.target = b(R.source, t, i(C.rowModel), e), V());
|
|
60
|
+
}, U = () => {
|
|
61
|
+
if (R === null || C === null) return;
|
|
62
|
+
let e = R;
|
|
63
|
+
e.rafId = requestAnimationFrame(U);
|
|
63
64
|
let t = C.scrollContainerRef.current;
|
|
64
65
|
if (!t) return;
|
|
65
66
|
if (!e.armed) {
|
|
66
|
-
if (!
|
|
67
|
+
if (!o(e.origin, e.pointer, 6)) return;
|
|
67
68
|
e.armed = !0;
|
|
68
69
|
}
|
|
69
|
-
let n = t.getBoundingClientRect(), r =
|
|
70
|
+
let n = t.getBoundingClientRect(), r = u(t, n), i = c({
|
|
70
71
|
rectLeft: n.left,
|
|
71
72
|
rectTop: n.top,
|
|
72
73
|
clientLeft: t.clientLeft,
|
|
@@ -74,26 +75,26 @@ var ee = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && matc
|
|
|
74
75
|
clientWidth: t.clientWidth,
|
|
75
76
|
clientHeight: t.clientHeight,
|
|
76
77
|
scale: r
|
|
77
|
-
}), d =
|
|
78
|
+
}), d = a(t.scrollTop, s(e.pointer.y, l(i.top, (C.stickyTopHeight ?? 0) * r.y, 24), i.bottom - (C.footerHeight ?? 0), 24), 18, t.scrollHeight - t.clientHeight), f = a(t.scrollLeft, s(e.pointer.x, i.left, i.right, 24), 18, t.scrollWidth - t.clientWidth);
|
|
78
79
|
(d !== t.scrollTop || f !== t.scrollLeft) && (t.scrollTo({
|
|
79
80
|
top: d,
|
|
80
81
|
left: f,
|
|
81
82
|
behavior: "auto"
|
|
82
|
-
}),
|
|
83
|
-
},
|
|
84
|
-
let n =
|
|
83
|
+
}), H());
|
|
84
|
+
}, W = (e, t) => {
|
|
85
|
+
let n = R;
|
|
85
86
|
if (n !== null) {
|
|
86
|
-
if (
|
|
87
|
-
|
|
87
|
+
if (R = null, n.cleanup(), n.rafId !== null && cancelAnimationFrame(n.rafId), j.setSnapshot(null), w.setSnapshot(E), e && n.target !== null) {
|
|
88
|
+
L = null, q(n.source, n.target, z(n.toggled), n.activeCell);
|
|
88
89
|
return;
|
|
89
90
|
}
|
|
90
|
-
|
|
91
|
+
L = e && t !== void 0 && n.onSquare ? {
|
|
91
92
|
time: t,
|
|
92
93
|
x: n.origin.x,
|
|
93
94
|
y: n.origin.y
|
|
94
95
|
} : null;
|
|
95
96
|
}
|
|
96
|
-
},
|
|
97
|
+
}, G = (t, n) => {
|
|
97
98
|
if (C === null) return;
|
|
98
99
|
let { dispatch: r } = C;
|
|
99
100
|
r(e.startSelection({
|
|
@@ -106,33 +107,33 @@ var ee = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && matc
|
|
|
106
107
|
row: t.startRow,
|
|
107
108
|
col: t.startCol
|
|
108
109
|
}));
|
|
109
|
-
},
|
|
110
|
+
}, K = (e, t) => {
|
|
110
111
|
let n = [];
|
|
111
112
|
for (let r = t.startRow; r <= t.endRow; r += 1) n.push(e.getRowKey(r));
|
|
112
113
|
return n;
|
|
113
114
|
}, q = (e, t, n, r) => {
|
|
114
115
|
if (C === null || !C.enabled) return;
|
|
115
|
-
let i = C, a =
|
|
116
|
+
let i = C, a = g({
|
|
116
117
|
rowModel: i.rowModel,
|
|
117
118
|
columns: i.columns,
|
|
118
119
|
source: e,
|
|
119
120
|
target: t,
|
|
120
121
|
request: n,
|
|
121
|
-
canWriteCell:
|
|
122
|
+
canWriteCell: B(i),
|
|
122
123
|
getFillValue: i.getFillValue
|
|
123
124
|
});
|
|
124
125
|
if (a.edits.length === 0) return;
|
|
125
|
-
let o =
|
|
126
|
+
let o = x(e, t), s = null, c = [], l = null;
|
|
126
127
|
if (i.isServerSide) {
|
|
127
128
|
if (!i.applyServerSideCellEdits) return;
|
|
128
|
-
l =
|
|
129
|
+
l = K(i.rowModel, o), i.applyServerSideCellEdits(a.edits);
|
|
129
130
|
} else {
|
|
130
131
|
if (!i.applyRowsChange) return;
|
|
131
|
-
let e =
|
|
132
|
+
let e = h(i.rows, i.rowModel, a.edits);
|
|
132
133
|
if (e === i.rows) return;
|
|
133
134
|
s = i.rows, c.push(e), i.applyRowsChange(e);
|
|
134
135
|
}
|
|
135
|
-
|
|
136
|
+
I = {
|
|
136
137
|
source: e,
|
|
137
138
|
target: t,
|
|
138
139
|
range: o,
|
|
@@ -146,20 +147,20 @@ var ee = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && matc
|
|
|
146
147
|
baseRowModel: i.isServerSide ? null : i.rowModel,
|
|
147
148
|
emittedRows: c,
|
|
148
149
|
rowKeys: l
|
|
149
|
-
},
|
|
150
|
+
}, G(o, r), w.setSnapshot({
|
|
150
151
|
status: "filled",
|
|
151
152
|
range: o,
|
|
152
153
|
kind: a.kind,
|
|
153
154
|
seriesAvailable: a.seriesAvailable,
|
|
154
155
|
menu: null
|
|
155
156
|
});
|
|
156
|
-
}, J =
|
|
157
|
+
}, J = f({
|
|
157
158
|
onScroll: (e) => {
|
|
158
|
-
e.target instanceof Node &&
|
|
159
|
+
e.target instanceof Node && N.current?.contains(e.target) || X(!1);
|
|
159
160
|
},
|
|
160
161
|
onResize: () => X(!1),
|
|
161
|
-
isInside: (e) =>
|
|
162
|
-
onOutsidePointerDown: (e) => X(C !== null &&
|
|
162
|
+
isInside: (e) => N.current?.contains(e) === !0 || F.current?.contains(e) === !0,
|
|
163
|
+
onOutsidePointerDown: (e) => X(C !== null && p(C.gridRootRef, e)),
|
|
163
164
|
getGridRoot: () => C?.gridRootRef.current ?? null,
|
|
164
165
|
onGridHidden: () => X(!1),
|
|
165
166
|
onKeyDown: (e) => {
|
|
@@ -172,48 +173,48 @@ var ee = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && matc
|
|
|
172
173
|
menu: e
|
|
173
174
|
});
|
|
174
175
|
}, X = (e) => {
|
|
175
|
-
J.detach(), Y(null), e && C !== null &&
|
|
176
|
+
J.detach(), Y(null), e && C !== null && m(C.gridRootRef);
|
|
176
177
|
}, Z = () => {
|
|
177
|
-
let e = typeof document < "u" &&
|
|
178
|
-
|
|
179
|
-
},
|
|
178
|
+
let e = typeof document < "u" && N.current?.contains(n(N.current)) === !0;
|
|
179
|
+
I = null, J.detach(), w.getSnapshot().status === "filled" && w.setSnapshot(E), e && C !== null && m(C.gridRootRef);
|
|
180
|
+
}, ie = (e) => {
|
|
180
181
|
let t = w.getSnapshot();
|
|
181
182
|
if (t.status !== "filled") return;
|
|
182
183
|
if (t.menu !== null) {
|
|
183
184
|
X(!0);
|
|
184
185
|
return;
|
|
185
186
|
}
|
|
186
|
-
let n = Math.min(e.left, window.innerWidth -
|
|
187
|
-
n = Math.max(
|
|
188
|
-
let r = e.bottom + 4, i =
|
|
189
|
-
r + i > window.innerHeight -
|
|
187
|
+
let n = Math.min(e.left, window.innerWidth - S - T);
|
|
188
|
+
n = Math.max(T, n);
|
|
189
|
+
let r = e.bottom + 4, i = ne();
|
|
190
|
+
r + i > window.innerHeight - T && (r = Math.max(T, e.top - 4 - i)), Y({
|
|
190
191
|
top: r,
|
|
191
192
|
left: n
|
|
192
193
|
}), J.attach();
|
|
193
|
-
},
|
|
194
|
+
}, ae = (e, t) => {
|
|
194
195
|
let n = t.rowKeys;
|
|
195
196
|
if (n === null) return !1;
|
|
196
197
|
for (let r = 0; r < n.length; r += 1) if (e.getRowKey(t.range.startRow + r) !== n[r]) return !1;
|
|
197
198
|
return !0;
|
|
198
|
-
},
|
|
199
|
-
let n = w.getSnapshot(), r =
|
|
199
|
+
}, oe = (e) => {
|
|
200
|
+
let n = w.getSnapshot(), r = I;
|
|
200
201
|
if (X(!0), C === null || r === null || n.status !== "filled" || r.request === e) return;
|
|
201
202
|
let i = C;
|
|
202
203
|
if (i.isServerSide) {
|
|
203
|
-
if (!i.applyServerSideCellEdits || !
|
|
204
|
+
if (!i.applyServerSideCellEdits || !ae(i.rowModel, r)) {
|
|
204
205
|
Z();
|
|
205
206
|
return;
|
|
206
207
|
}
|
|
207
|
-
let t =
|
|
208
|
+
let t = g({
|
|
208
209
|
rowModel: i.rowModel,
|
|
209
210
|
columns: r.columns,
|
|
210
211
|
source: r.source,
|
|
211
212
|
target: r.target,
|
|
212
213
|
request: e,
|
|
213
|
-
canWriteCell:
|
|
214
|
+
canWriteCell: B(i),
|
|
214
215
|
getFillValue: i.getFillValue
|
|
215
216
|
});
|
|
216
|
-
r.request = e, t.edits.length > 0 && !
|
|
217
|
+
r.request = e, t.edits.length > 0 && !P(t.edits, r.edits) && i.applyServerSideCellEdits(t.edits), r.edits = t.edits, w.setSnapshot({
|
|
217
218
|
...n,
|
|
218
219
|
kind: t.kind,
|
|
219
220
|
menu: null
|
|
@@ -224,7 +225,7 @@ var ee = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && matc
|
|
|
224
225
|
Z();
|
|
225
226
|
return;
|
|
226
227
|
}
|
|
227
|
-
let a = r.baseRowModel, o =
|
|
228
|
+
let a = r.baseRowModel, o = g({
|
|
228
229
|
rowModel: a,
|
|
229
230
|
columns: r.columns,
|
|
230
231
|
source: r.source,
|
|
@@ -236,8 +237,8 @@ var ee = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && matc
|
|
|
236
237
|
}, a, e, n, r, o),
|
|
237
238
|
getFillValue: i.getFillValue
|
|
238
239
|
});
|
|
239
|
-
if (r.request = e, !
|
|
240
|
-
let e =
|
|
240
|
+
if (r.request = e, !P(o.edits, r.edits)) {
|
|
241
|
+
let e = h(r.baseRows, a, o.edits);
|
|
241
242
|
r.emittedRows.push(e), r.edits = o.edits, i.amendRowsChange(e);
|
|
242
243
|
}
|
|
243
244
|
w.setSnapshot({
|
|
@@ -248,16 +249,16 @@ var ee = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && matc
|
|
|
248
249
|
}, Q = (e, t) => {
|
|
249
250
|
if (e?.type !== "cell") return !1;
|
|
250
251
|
let { start: n, end: r } = e.range;
|
|
251
|
-
return
|
|
252
|
+
return _(t, {
|
|
252
253
|
startRow: Math.min(n.row, r.row),
|
|
253
254
|
endRow: Math.max(n.row, r.row),
|
|
254
255
|
startCol: Math.min(n.col, r.col),
|
|
255
256
|
endCol: Math.max(n.col, r.col)
|
|
256
257
|
});
|
|
257
|
-
},
|
|
258
|
-
let t =
|
|
258
|
+
}, se = (e) => {
|
|
259
|
+
let t = I;
|
|
259
260
|
if (t !== null) {
|
|
260
|
-
if (!e.enabled || e.editing || !
|
|
261
|
+
if (!e.enabled || e.editing || !O(e.columns, t.columns) || !M(e.viewKey, t.viewKey)) {
|
|
261
262
|
Z();
|
|
262
263
|
return;
|
|
263
264
|
}
|
|
@@ -271,82 +272,82 @@ var ee = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && matc
|
|
|
271
272
|
}
|
|
272
273
|
!t.selectionConfirmed && Q(e.selection, t.previousSource) || Z();
|
|
273
274
|
}
|
|
274
|
-
},
|
|
275
|
-
if (C === null || e.button !== 0 || (e.preventDefault(),
|
|
276
|
-
let t =
|
|
275
|
+
}, ce = (e) => {
|
|
276
|
+
if (C === null || e.button !== 0 || (e.preventDefault(), R !== null || !C.enabled || C.editing)) return;
|
|
277
|
+
let t = y(C.selection, C.activeCell, i(C.rowModel), C.columns.length);
|
|
277
278
|
if (t === null) return;
|
|
278
|
-
let n =
|
|
279
|
-
|
|
280
|
-
let r =
|
|
281
|
-
if (n !== null && r && e.timeStamp - n.time <=
|
|
279
|
+
let n = L;
|
|
280
|
+
L = null;
|
|
281
|
+
let r = re(e);
|
|
282
|
+
if (n !== null && r && e.timeStamp - n.time <= k && Math.abs(e.clientX - n.x) <= A && Math.abs(e.clientY - n.y) <= A) {
|
|
282
283
|
C.gridRootRef.current?.focus({ preventScroll: !0 }), $();
|
|
283
284
|
return;
|
|
284
285
|
}
|
|
285
286
|
Z(), C.gridRootRef.current?.focus({ preventScroll: !0 });
|
|
286
|
-
let
|
|
287
|
-
|
|
287
|
+
let a = e.pointerId, o = (e) => {
|
|
288
|
+
R === null || e.pointerId !== a || (R.pointer = {
|
|
288
289
|
x: e.clientX,
|
|
289
290
|
y: e.clientY
|
|
290
|
-
},
|
|
291
|
-
}, o = (e) => {
|
|
292
|
-
B === null || e.pointerId !== i || (B.toggled = e.ctrlKey || e.metaKey, K(!0, e.timeStamp));
|
|
291
|
+
}, R.toggled = e.ctrlKey || e.metaKey, j.setSnapshot(R.pointer), H());
|
|
293
292
|
}, s = (e) => {
|
|
294
|
-
e.pointerId
|
|
293
|
+
R === null || e.pointerId !== a || (R.toggled = e.ctrlKey || e.metaKey, W(!0, e.timeStamp));
|
|
295
294
|
}, c = (e) => {
|
|
296
|
-
|
|
295
|
+
e.pointerId === a && W(!1);
|
|
296
|
+
}, l = (e) => {
|
|
297
|
+
if (R === null) return;
|
|
297
298
|
if (e.preventDefault(), e.stopPropagation(), e.type === "keydown" && e.key === "Escape") {
|
|
298
|
-
|
|
299
|
+
W(!1);
|
|
299
300
|
return;
|
|
300
301
|
}
|
|
301
302
|
let t = e.ctrlKey || e.metaKey;
|
|
302
|
-
t !==
|
|
303
|
-
},
|
|
304
|
-
window.addEventListener("pointermove",
|
|
305
|
-
let
|
|
303
|
+
t !== R.toggled && (R.toggled = t, V());
|
|
304
|
+
}, u = () => W(!1);
|
|
305
|
+
window.addEventListener("pointermove", o), window.addEventListener("pointerup", s), window.addEventListener("pointercancel", c), window.addEventListener("keydown", l, !0), window.addEventListener("keyup", l, !0), window.addEventListener("blur", u);
|
|
306
|
+
let f = d(), p = {
|
|
306
307
|
x: e.clientX,
|
|
307
308
|
y: e.clientY
|
|
308
309
|
};
|
|
309
|
-
|
|
310
|
-
pointerId:
|
|
310
|
+
R = {
|
|
311
|
+
pointerId: a,
|
|
311
312
|
source: t,
|
|
312
313
|
activeCell: C.activeCell,
|
|
313
|
-
origin:
|
|
314
|
+
origin: p,
|
|
314
315
|
onSquare: r,
|
|
315
|
-
pointer:
|
|
316
|
+
pointer: p,
|
|
316
317
|
toggled: e.ctrlKey || e.metaKey,
|
|
317
318
|
target: null,
|
|
318
319
|
armed: !1,
|
|
319
320
|
rafId: null,
|
|
320
321
|
cleanup: () => {
|
|
321
|
-
window.removeEventListener("pointermove",
|
|
322
|
+
window.removeEventListener("pointermove", o), window.removeEventListener("pointerup", s), window.removeEventListener("pointercancel", c), window.removeEventListener("keydown", l, !0), window.removeEventListener("keyup", l, !0), window.removeEventListener("blur", u), f();
|
|
322
323
|
}
|
|
323
|
-
},
|
|
324
|
+
}, j.setSnapshot(p), V(), R.rafId = requestAnimationFrame(U);
|
|
324
325
|
}, $ = () => {
|
|
325
|
-
if (C === null ||
|
|
326
|
-
let e =
|
|
326
|
+
if (C === null || R !== null || !C.enabled || C.editing) return;
|
|
327
|
+
let e = y(C.selection, C.activeCell, i(C.rowModel), C.columns.length);
|
|
327
328
|
if (e === null) return;
|
|
328
|
-
let t =
|
|
329
|
+
let t = te(e, C.rowModel, C.columns);
|
|
329
330
|
t !== null && (Z(), q(e, t, "auto", C.activeCell));
|
|
330
331
|
};
|
|
331
332
|
return {
|
|
332
333
|
update: (e) => {
|
|
333
|
-
C = e,
|
|
334
|
+
C = e, R !== null && (!e.enabled || e.editing) && W(!1), se(e);
|
|
334
335
|
},
|
|
335
336
|
subscribe: w.subscribe,
|
|
336
337
|
getSnapshot: w.getSnapshot,
|
|
337
|
-
subscribePointer:
|
|
338
|
-
getPointerSnapshot:
|
|
339
|
-
handlePointerDown:
|
|
338
|
+
subscribePointer: j.subscribe,
|
|
339
|
+
getPointerSnapshot: j.getSnapshot,
|
|
340
|
+
handlePointerDown: ce,
|
|
340
341
|
handleDoubleClick: $,
|
|
341
|
-
toggleMenu:
|
|
342
|
+
toggleMenu: ie,
|
|
342
343
|
closeMenu: () => X(!0),
|
|
343
|
-
chooseKind:
|
|
344
|
-
menuPanel:
|
|
345
|
-
chipElement:
|
|
344
|
+
chooseKind: oe,
|
|
345
|
+
menuPanel: N,
|
|
346
|
+
chipElement: F,
|
|
346
347
|
dispose: () => {
|
|
347
|
-
|
|
348
|
+
W(!1), J.detach(), I = null;
|
|
348
349
|
}
|
|
349
350
|
};
|
|
350
351
|
};
|
|
351
352
|
//#endregion
|
|
352
|
-
export {
|
|
353
|
+
export { F 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("../logic/chunkedLoop.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,
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs"),t=require("../logic/valueStore.cjs"),n=require("../logic/chunkedLoop.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,p=null,m=t.createValueStore({open:!1,query:``,matches:[],index:o,currentIndex:null,scanning:!1,truncated:!1}),h=e=>{m.setSnapshot({...m.getSnapshot(),...e})},g=null,_=()=>{let e=m.getSnapshot(),t={query:e.query,matchCount:e.matches.length,currentIndex:e.currentIndex,open:e.open,truncated:e.truncated};g!==null&&g.query===t.query&&g.matchCount===t.matchCount&&g.currentIndex===t.currentIndex&&g.open===t.open&&g.truncated===t.truncated||(g=t,i?.onChange?.(t))},v=e=>{let t=m.getSnapshot();if(t.currentIndex===null)return;let n=t.matches[t.currentIndex];n&&i?.onNavigate(n.rowIndex,n.colIndex,e)},y=()=>{l+=1,p=null,u=null,d=!1,h({matches:[],index:o,currentIndex:null,scanning:!1,truncated:!1})},b=(t,o=!1)=>{let g=i,x=m.getSnapshot();if(!g||!x.open||x.query.length===0){y(),_();return}l+=1;let S=l,{rowModel:C,columns:w,caseSensitive:T}=g,E=g.conditionalFormat!==!1,D=x.query,O=p!==null&&p.query===D&&p.caseSensitive===T;p={rowModel:C,columns:w,query:D,caseSensitive:T,conditionalFormatShown:E},(o||u===null||u.columns!==w||u.query!==D||u.caseSensitive!==T||u.conditionalFormatShown!==E)&&(u={columns:w,query:D,caseSensitive:T,conditionalFormatShown:E,byRow:new WeakMap});let k=u.byRow,A=0,j=t||d;d=j;let M=x.currentIndex===null?null:x.matches[x.currentIndex]??null,N=[],P=!1,F=C.getRowCount(),I=F>a,L=(t,n)=>{let i=[];return w.forEach((a,o)=>{if(e.isSyntheticColumnKey(a.key)||!r.isFindableColumn(a,E))return;let s=r.resolveFindCellText(a,t,!E||a.conditionalFormat?.chips===void 0?void 0:{rowIndex:n,sourceRowIndex:C.getSourceIndex(n)??n,rowKey:C.getRowKey(n)??n,colIndex:o});for(let e of r.findRangesInText(s,D,T))i.push({colIndex:o,columnKey:String(a.key),start:e.start,length:e.length})}),i.length===0?s:i};!O&&!x.scanning&&h({scanning:!0}),n.runChunked(F,e=>{if(P)return;let t=C.getRow(e);if(t===void 0)return;let n=C.getTreeRow?.(e)?.aggregates,r;I&&typeof t==`object`&&t?(r=k.get(t),r===void 0?(r=L(t,e),k.set(t,r)):A+=1):r=L(t,e);for(let t of r)if(!(n!==void 0&&t.columnKey in n)){if(N.length>=1e4){P=!0;return}N.push({rowIndex:e,colIndex:t.colIndex,columnKey:t.columnKey,start:t.start,length:t.length})}},{isCancelled:()=>l!==S}).then(e=>{if(!e||l!==S||(d=!1,o&&P===m.getSnapshot().truncated&&c(m.getSnapshot().matches,N)))return;let t=r.resolveCurrentAfterRescan(N,M);h({matches:N,index:r.buildFindIndex(N,i?.toViewRow),currentIndex:t,scanning:!1,truncated:P}),f=i?.toViewRow,_(),j&&v(`query`),!o&&A>0&&b(!1,!0)})},x=()=>{let e=m.getSnapshot();return!i||!e.open||e.query.length===0?!1:p===null||p.rowModel!==i.rowModel||p.columns!==i.columns||p.query!==e.query||p.caseSensitive!==i.caseSensitive||p.conditionalFormatShown!==(i.conditionalFormat!==!1)};return{update:e=>{let t=i;if(i=e,!e.enabled){m.getSnapshot().open&&(h({open:!1,query:``}),y(),_());return}if(t!==e&&x()){b(!1);return}let n=m.getSnapshot();e.toViewRow!==f&&!n.scanning&&(f=e.toViewRow,n.matches.length>0&&h({index:r.buildFindIndex(n.matches,e.toViewRow)}))},open:e=>{if(!i?.enabled)return;let t=m.getSnapshot(),n=e??t.query;h({open:!0,query:n}),n!==t.query||!t.open?b(!0):_()},close:()=>{m.getSnapshot().open&&(h({open:!1,query:``}),y(),_())},setQuery:e=>{let t=m.getSnapshot();!t.open||e===t.query||(h({query:e}),b(!0))},next:()=>{let e=m.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,1);h({currentIndex:t}),_(),v(`step`)},prev:()=>{let e=m.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,-1);h({currentIndex:t}),_(),v(`step`)},subscribe:m.subscribe,getSnapshot:m.getSnapshot,dispose:()=>{l+=1,i=null}}};exports.FIND_HIT_CACHE_ROW_THRESHOLD=a,exports.MAX_FIND_MATCHES=i,exports.createFindController=l;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { GridColumn, RowModel } from '../model/gridTypes.unbound.js';
|
|
2
|
+
export type FindNavigateCause = 'query' | 'step';
|
|
2
3
|
import { type FindIndex, type FindMatch } from '../logic/find.js';
|
|
3
4
|
export type FindChangeParams = {
|
|
4
5
|
query: string;
|
|
@@ -12,9 +13,10 @@ export type FindArgs<T> = {
|
|
|
12
13
|
rowModel: RowModel<T>;
|
|
13
14
|
columns: readonly GridColumn<T>[];
|
|
14
15
|
caseSensitive: boolean;
|
|
15
|
-
onNavigate: (rowIndex: number, colIndex: number) => void;
|
|
16
|
+
onNavigate: (rowIndex: number, colIndex: number, cause: FindNavigateCause) => void;
|
|
16
17
|
onChange?: (params: FindChangeParams) => void;
|
|
17
18
|
conditionalFormat?: boolean | undefined;
|
|
19
|
+
toViewRow?: ((rowIndex: number) => number) | undefined;
|
|
18
20
|
};
|
|
19
21
|
export type FindSnapshot = {
|
|
20
22
|
open: boolean;
|