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