@ishibashi0112/spreadsheet-grid-core 1.11.0 → 1.13.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/changeTracker.cjs +1 -1
- package/dist/controllers/changeTracker.d.ts +9 -0
- package/dist/controllers/changeTracker.js +205 -145
- package/dist/controllers/clipboardController.cjs +3 -1
- package/dist/controllers/clipboardController.d.ts +8 -0
- package/dist/controllers/clipboardController.js +251 -135
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.js +109 -103
- package/dist/controllers/findController.cjs +1 -1
- package/dist/controllers/findController.d.ts +17 -0
- package/dist/controllers/findController.js +149 -93
- 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 +2 -0
- package/dist/controllers/keyboardController.js +13 -1
- package/dist/controllers/rowDiffer.cjs +2 -0
- package/dist/controllers/rowDiffer.d.ts +19 -0
- package/dist/controllers/rowDiffer.js +131 -0
- 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/diffStage.cjs +1 -0
- package/dist/engine/diffStage.d.ts +26 -0
- package/dist/engine/diffStage.js +117 -0
- package/dist/engine/exportCommands.cjs +2 -2
- package/dist/engine/exportCommands.js +10 -10
- package/dist/engine/features.cjs +1 -1
- package/dist/engine/features.d.ts +13 -0
- package/dist/engine/features.js +39 -15
- package/dist/engine/fullFeatures.cjs +1 -1
- package/dist/engine/fullFeatures.js +37 -27
- package/dist/engine/gridApi.cjs +9 -8
- package/dist/engine/gridApi.d.ts +11 -2
- package/dist/engine/gridApi.js +294 -217
- package/dist/engine/newRowController.cjs +1 -1
- package/dist/engine/newRowController.js +1 -0
- package/dist/engine/rowPipeline.cjs +1 -1
- package/dist/engine/rowPipeline.d.ts +8 -1
- package/dist/engine/rowPipeline.js +32 -22
- package/dist/engine/treeStage.cjs +1 -1
- package/dist/engine/treeStage.d.ts +1 -0
- package/dist/engine/treeStage.js +2 -2
- 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 +32 -0
- package/dist/logic/changeNavigation.cjs +1 -0
- package/dist/logic/changeNavigation.d.ts +25 -0
- package/dist/logic/changeNavigation.js +62 -0
- package/dist/logic/changeTracking.cjs +1 -1
- package/dist/logic/changeTracking.d.ts +1 -0
- package/dist/logic/changeTracking.js +8 -5
- 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/diffView.cjs +1 -0
- package/dist/logic/diffView.d.ts +20 -0
- package/dist/logic/diffView.js +51 -0
- package/dist/logic/find.cjs +1 -1
- package/dist/logic/find.js +35 -11
- 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/localeTextFeatures.cjs +1 -1
- package/dist/logic/localeTextFeatures.d.ts +36 -0
- package/dist/logic/localeTextFeatures.js +41 -7
- package/dist/logic/multiSelect.cjs +1 -1
- package/dist/logic/multiSelect.js +1 -1
- package/dist/logic/rangeDecorations.cjs +4 -0
- package/dist/logic/rangeDecorations.d.ts +78 -0
- package/dist/logic/rangeDecorations.js +223 -0
- package/dist/logic/rowDiff.cjs +1 -0
- package/dist/logic/rowDiff.d.ts +57 -0
- package/dist/logic/rowDiff.js +169 -0
- 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.d.ts +1 -0
- package/dist/logic/sorting.js +42 -27
- package/dist/model/gridStore.d.ts +4 -1
- package/dist/model/gridTypes.core.d.ts +218 -26
- package/dist/utils/clipboard.cjs +5 -4
- package/dist/utils/clipboard.d.ts +10 -1
- package/dist/utils/clipboard.js +48 -33
- package/package.json +1 -1
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { getCellValue as e, isCellEditable as t, resolveCanEditCellContext as n } from "../utils/permissions.js";
|
|
2
|
+
import { isSyntheticColumnKey as r } from "../logic/detailRow.js";
|
|
3
|
+
import { createValueStore as i } from "../logic/valueStore.js";
|
|
4
|
+
import { runChunked as a } from "../logic/chunkedLoop.js";
|
|
5
|
+
import { findRangesInCell as o, isFindableColumn as s, resolveFindCellText as c } from "../logic/find.js";
|
|
6
|
+
import { isInFindScope as l } from "./findController.js";
|
|
7
|
+
import { applyFindReplaceWrites as u, resolveCellReplacement as d } from "../logic/findReplace.js";
|
|
8
|
+
//#region src/controllers/findReplaceController.ts
|
|
9
|
+
var f = {
|
|
10
|
+
replaced: 0,
|
|
11
|
+
skipped: 0
|
|
12
|
+
}, p = (e, t, n) => {
|
|
13
|
+
if (e === null || t <= 0 || n <= 0) return null;
|
|
14
|
+
if (e.type === "row") return {
|
|
15
|
+
startRow: Math.max(0, Math.min(e.startRow, e.endRow)),
|
|
16
|
+
endRow: Math.min(t - 1, Math.max(e.startRow, e.endRow)),
|
|
17
|
+
startCol: 0,
|
|
18
|
+
endCol: n - 1
|
|
19
|
+
};
|
|
20
|
+
if (e.type === "col") return {
|
|
21
|
+
startRow: 0,
|
|
22
|
+
endRow: t - 1,
|
|
23
|
+
startCol: Math.max(0, Math.min(e.startCol, e.endCol)),
|
|
24
|
+
endCol: Math.min(n - 1, Math.max(e.startCol, e.endCol))
|
|
25
|
+
};
|
|
26
|
+
let { start: r, end: i } = e.range;
|
|
27
|
+
return {
|
|
28
|
+
startRow: Math.max(0, Math.min(r.row, i.row)),
|
|
29
|
+
endRow: Math.min(t - 1, Math.max(r.row, i.row)),
|
|
30
|
+
startCol: Math.max(0, Math.min(r.col, i.col)),
|
|
31
|
+
endCol: Math.min(n - 1, Math.max(r.col, i.col))
|
|
32
|
+
};
|
|
33
|
+
}, m = (e, r, i, a, o) => {
|
|
34
|
+
let s = e.toViewRow ? e.toViewRow(r) : r;
|
|
35
|
+
return t(e, s >= 0 ? s : r, i, a, o, e.canEditCell ? n(e.rowModel, r) : void 0);
|
|
36
|
+
}, h = (e, t) => e.length === t.length && e.every((e, n) => Object.is(e, t[n])), g = () => {
|
|
37
|
+
let t = null, n = 0, g = null, _ = null, v = "", y = !1, b = null, x = null, S, C = null, w = null, T = i({
|
|
38
|
+
expanded: !1,
|
|
39
|
+
replacement: "",
|
|
40
|
+
scope: null,
|
|
41
|
+
running: !1,
|
|
42
|
+
notice: null,
|
|
43
|
+
noticeId: 0
|
|
44
|
+
}), E = (e) => {
|
|
45
|
+
let t = T.getSnapshot();
|
|
46
|
+
T.setSnapshot({
|
|
47
|
+
...t,
|
|
48
|
+
...e,
|
|
49
|
+
noticeId: e.notice ? t.noticeId + 1 : t.noticeId
|
|
50
|
+
});
|
|
51
|
+
}, D = () => {
|
|
52
|
+
let e = t;
|
|
53
|
+
if (!e?.enabled) return;
|
|
54
|
+
let n = p(e.getSelection(), e.viewRowCount, e.columns.length);
|
|
55
|
+
n !== null && (n.endRow - n.startRow + 1) * (n.endCol - n.startCol + 1) >= 2 && (C = {
|
|
56
|
+
rect: n,
|
|
57
|
+
signature: e.viewSignature
|
|
58
|
+
});
|
|
59
|
+
}, O = (e) => {
|
|
60
|
+
let t = e.getSelection(), n = e.find.getSnapshot(), r = n.currentIndex === null ? void 0 : n.matches[n.currentIndex];
|
|
61
|
+
if (!r) return !1;
|
|
62
|
+
let i = e.toViewRow ? e.toViewRow(r.rowIndex) : r.rowIndex;
|
|
63
|
+
if (t === null) return !0;
|
|
64
|
+
if (t.type !== "cell") return !1;
|
|
65
|
+
let { start: a, end: o } = t.range;
|
|
66
|
+
return a.row === o.row && a.col === o.col && a.row === i && a.col === r.colIndex;
|
|
67
|
+
}, k = () => {
|
|
68
|
+
let e = t?.find;
|
|
69
|
+
if (!e) return;
|
|
70
|
+
let r = e.getSnapshot();
|
|
71
|
+
w !== null && r.matches !== w.matches && (w = null), y && !r.open ? (n += 1, b = null, w = null, C = null, E({
|
|
72
|
+
scope: null,
|
|
73
|
+
notice: null,
|
|
74
|
+
running: !1
|
|
75
|
+
})) : ((r.open && !y || r.query !== v) && D(), r.query !== v && T.getSnapshot().notice !== null && E({ notice: null })), y = r.open, v = r.query;
|
|
76
|
+
}, A = (t, n, i, a, l) => {
|
|
77
|
+
let { rowModel: u, columns: f, caseSensitive: p, multiSelectSeparator: h } = t, g = u.newRow;
|
|
78
|
+
if (g !== void 0 && a >= g.index) return null;
|
|
79
|
+
let _ = u.getRow(a), v = f[l], y = t.conditionalFormat !== !1;
|
|
80
|
+
if (_ === void 0 || !v || r(v.key) || !s(v, y, _)) return null;
|
|
81
|
+
let b = u.getTreeRow?.(a)?.aggregates;
|
|
82
|
+
if (b !== void 0 && v.key in b) return null;
|
|
83
|
+
let x = c(v, _, !y || v.conditionalFormat?.chips === void 0 ? void 0 : {
|
|
84
|
+
rowIndex: a,
|
|
85
|
+
sourceRowIndex: u.getSourceIndex(a) ?? a,
|
|
86
|
+
rowKey: u.getRowKey(a) ?? a,
|
|
87
|
+
colIndex: l
|
|
88
|
+
}, h), S = o(v, _, x, n, p, h), C = d({
|
|
89
|
+
column: v,
|
|
90
|
+
row: _,
|
|
91
|
+
text: x,
|
|
92
|
+
ranges: S,
|
|
93
|
+
replacement: i,
|
|
94
|
+
editable: S.length > 0 && m(t, a, l, _, v),
|
|
95
|
+
separator: h,
|
|
96
|
+
validationTexts: t.validationTexts
|
|
97
|
+
});
|
|
98
|
+
return C === null ? null : C.action === "write" && Object.is(e(_, v), C.value) ? {
|
|
99
|
+
replacement: {
|
|
100
|
+
action: "skip",
|
|
101
|
+
reason: "unchanged",
|
|
102
|
+
count: C.count
|
|
103
|
+
},
|
|
104
|
+
row: _,
|
|
105
|
+
column: v
|
|
106
|
+
} : {
|
|
107
|
+
replacement: C,
|
|
108
|
+
row: _,
|
|
109
|
+
column: v
|
|
110
|
+
};
|
|
111
|
+
}, j = () => {
|
|
112
|
+
let e = t?.find.getSnapshot();
|
|
113
|
+
return e && e.open && e.query.length > 0 ? e.query : null;
|
|
114
|
+
}, M = (e) => (e !== void 0 && e !== T.getSnapshot().replacement && E({ replacement: e }), T.getSnapshot().replacement), N = (e, t, n, r) => t === null || l(t, e.toViewRow ? e.toViewRow(n) : n, r), P = (e) => {
|
|
115
|
+
if (b === null) return null;
|
|
116
|
+
let { rowModel: t, toViewRow: n } = e, r = t.newRow === void 0 ? t.getRowCount() : t.newRow.index, i = /* @__PURE__ */ new Set(), a = Infinity, o = -1;
|
|
117
|
+
for (let e = 0; e < r; e += 1) {
|
|
118
|
+
if (!b.rowKeys.has(t.getRowKey(e))) continue;
|
|
119
|
+
let r = n ? n(e) : e;
|
|
120
|
+
r < 0 || (i.add(r), a = Math.min(a, r), o = Math.max(o, r));
|
|
121
|
+
}
|
|
122
|
+
return o < 0 ? {
|
|
123
|
+
startRow: 0,
|
|
124
|
+
endRow: -1,
|
|
125
|
+
startCol: b.startCol,
|
|
126
|
+
endCol: b.endCol,
|
|
127
|
+
rows: i
|
|
128
|
+
} : {
|
|
129
|
+
startRow: a,
|
|
130
|
+
endRow: o,
|
|
131
|
+
startCol: b.startCol,
|
|
132
|
+
endCol: b.endCol,
|
|
133
|
+
rows: i.size === o - a + 1 ? void 0 : i
|
|
134
|
+
};
|
|
135
|
+
}, F = (e, t) => {
|
|
136
|
+
if (b === null || t === null || t.rows !== void 0 || e.toViewRow !== void 0 || t.endRow - t.startRow + 1 !== b.rowKeys.size) return !1;
|
|
137
|
+
let { rowModel: n } = e, r = n.newRow === void 0 ? n.getRowCount() : n.newRow.index;
|
|
138
|
+
if (t.endRow >= r) return !1;
|
|
139
|
+
for (let e = t.startRow; e <= t.endRow; e += 1) if (!b.rowKeys.has(n.getRowKey(e))) return !1;
|
|
140
|
+
return !0;
|
|
141
|
+
}, I = (e, t) => e === null || t === null ? e === t : e.startRow !== t.startRow || e.endRow !== t.endRow || e.startCol !== t.startCol || e.endCol !== t.endCol ? !1 : e.rows === void 0 || t.rows === void 0 ? e.rows === t.rows : e.rows.size === t.rows.size && [...e.rows].every((e) => t.rows?.has(e) === !0), L = () => {
|
|
142
|
+
b = null, x = null, S = void 0;
|
|
143
|
+
};
|
|
144
|
+
return {
|
|
145
|
+
update: (e) => {
|
|
146
|
+
let r = t;
|
|
147
|
+
if (t = e, _ !== e.find) {
|
|
148
|
+
g?.(), _ = e.find;
|
|
149
|
+
let t = e.find.getSnapshot();
|
|
150
|
+
y = t.open, v = t.query, g = e.find.subscribe(k);
|
|
151
|
+
}
|
|
152
|
+
let i = T.getSnapshot();
|
|
153
|
+
if (!e.enabled) {
|
|
154
|
+
L(), w = null, (i.expanded || i.scope !== null || i.running || i.notice !== null) && (n += 1, E({
|
|
155
|
+
expanded: !1,
|
|
156
|
+
scope: null,
|
|
157
|
+
running: !1,
|
|
158
|
+
notice: null
|
|
159
|
+
}));
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (b !== null) {
|
|
163
|
+
if (r !== null && !h(r.viewSignature, e.viewSignature)) {
|
|
164
|
+
L(), E({ scope: null });
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (e.rowModel !== x || e.toViewRow !== S) {
|
|
168
|
+
if (x = e.rowModel, S = e.toViewRow, F(e, i.scope)) return;
|
|
169
|
+
let t = P(e);
|
|
170
|
+
t === null && L(), I(t, i.scope) || E({ scope: t });
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
open: (e, n) => {
|
|
175
|
+
let r = t;
|
|
176
|
+
if (!r) return;
|
|
177
|
+
let i = r.find.getSnapshot().open;
|
|
178
|
+
i && D(), r.enabled && (e ? E({ expanded: !0 }) : i || E({ expanded: !1 })), r.find.open(n);
|
|
179
|
+
},
|
|
180
|
+
setExpanded: (e) => {
|
|
181
|
+
!t?.enabled || T.getSnapshot().expanded === e || (e || L(), E(e ? { expanded: e } : {
|
|
182
|
+
expanded: e,
|
|
183
|
+
scope: null,
|
|
184
|
+
notice: null
|
|
185
|
+
}));
|
|
186
|
+
},
|
|
187
|
+
setReplacement: (e) => {
|
|
188
|
+
e !== T.getSnapshot().replacement && E({
|
|
189
|
+
replacement: e,
|
|
190
|
+
notice: null
|
|
191
|
+
});
|
|
192
|
+
},
|
|
193
|
+
setScopeEnabled: (e) => {
|
|
194
|
+
let n = t;
|
|
195
|
+
if (!n?.enabled) return !1;
|
|
196
|
+
if (!e) return L(), T.getSnapshot().scope !== null && n.find.navigateAfterRescan(), E({
|
|
197
|
+
scope: null,
|
|
198
|
+
notice: null
|
|
199
|
+
}), !0;
|
|
200
|
+
let r = p(n.getSelection(), n.viewRowCount, n.columns.length), i = (e) => e === null ? 0 : (e.endRow - e.startRow + 1) * (e.endCol - e.startCol + 1);
|
|
201
|
+
if (i(r) < 2 && C !== null && h(C.signature, n.viewSignature) && O(n) && (r = C.rect), r === null || i(r) < 2) return E({ notice: { kind: "scopeNeedsRange" } }), !1;
|
|
202
|
+
let { rowModel: a, toViewRow: o } = n, s = a.newRow === void 0 ? a.getRowCount() : a.newRow.index, c = /* @__PURE__ */ new Set();
|
|
203
|
+
if (o) for (let e = 0; e < s; e += 1) {
|
|
204
|
+
let t = o(e);
|
|
205
|
+
t >= r.startRow && t <= r.endRow && c.add(a.getRowKey(e));
|
|
206
|
+
}
|
|
207
|
+
else for (let e = r.startRow; e <= Math.min(r.endRow, s - 1); e += 1) c.add(a.getRowKey(e));
|
|
208
|
+
b = {
|
|
209
|
+
rowKeys: c,
|
|
210
|
+
startCol: r.startCol,
|
|
211
|
+
endCol: r.endCol
|
|
212
|
+
}, x = a, S = o;
|
|
213
|
+
let l = P(n);
|
|
214
|
+
return l === null ? (L(), E({ notice: { kind: "scopeNeedsRange" } }), !1) : (n.find.navigateAfterRescan(), E({
|
|
215
|
+
scope: l,
|
|
216
|
+
notice: null
|
|
217
|
+
}), !0);
|
|
218
|
+
},
|
|
219
|
+
replaceCurrent: (e) => {
|
|
220
|
+
let n = t, r = M(e), i = j();
|
|
221
|
+
if (!n?.enabled || i === null || T.getSnapshot().running) return f;
|
|
222
|
+
let a = w !== null && n.rows === w.from ? w : null, o = a?.rows ?? n.rows, s = n.find.getSnapshot(), c = s.currentIndex === null ? void 0 : s.matches[s.currentIndex];
|
|
223
|
+
if (c && a !== null && c.columnKey === a.columnKey && n.rowModel.getRowKey(c.rowIndex) === a.rowKey && (n.find.continueAfter(c.rowIndex, c.colIndex, !1), s = n.find.getSnapshot(), c = s.currentIndex === null ? void 0 : s.matches[s.currentIndex], c && c.columnKey === a.columnKey && n.rowModel.getRowKey(c.rowIndex) === a.rowKey)) return f;
|
|
224
|
+
if (!c) return s.matches.length === 0 && !s.scanning && E({ notice: {
|
|
225
|
+
kind: "result",
|
|
226
|
+
replaced: 0,
|
|
227
|
+
skipped: 0
|
|
228
|
+
} }), f;
|
|
229
|
+
let l = A(n, i, r, c.rowIndex, c.colIndex);
|
|
230
|
+
if (l === null) return n.find.continueAfter(c.rowIndex, c.colIndex, !1), f;
|
|
231
|
+
let d = l.replacement;
|
|
232
|
+
if (d.action === "skip") return E({ notice: {
|
|
233
|
+
kind: "cellSkipped",
|
|
234
|
+
reason: d.reason,
|
|
235
|
+
message: d.message
|
|
236
|
+
} }), n.find.continueAfter(c.rowIndex, c.colIndex, !1), {
|
|
237
|
+
replaced: 0,
|
|
238
|
+
skipped: d.count
|
|
239
|
+
};
|
|
240
|
+
let p = n.rowModel.getSourceIndex(c.rowIndex);
|
|
241
|
+
if (p === void 0) return f;
|
|
242
|
+
E({ notice: {
|
|
243
|
+
kind: "result",
|
|
244
|
+
replaced: d.count,
|
|
245
|
+
skipped: 0
|
|
246
|
+
} });
|
|
247
|
+
let m = u(o, [{
|
|
248
|
+
sourceIndex: p,
|
|
249
|
+
column: l.column,
|
|
250
|
+
value: d.value
|
|
251
|
+
}]);
|
|
252
|
+
return m === o ? n.find.continueAfter(c.rowIndex, c.colIndex, !1) : (n.find.continueAfter(c.rowIndex, c.colIndex, !0), w = {
|
|
253
|
+
from: n.rows,
|
|
254
|
+
rows: m,
|
|
255
|
+
rowKey: n.rowModel.getRowKey(c.rowIndex),
|
|
256
|
+
columnKey: c.columnKey,
|
|
257
|
+
matches: s.matches
|
|
258
|
+
}, n.commitRows(m)), {
|
|
259
|
+
replaced: d.count,
|
|
260
|
+
skipped: 0
|
|
261
|
+
};
|
|
262
|
+
},
|
|
263
|
+
replaceAll: async (e) => {
|
|
264
|
+
let r = M(e), i = j();
|
|
265
|
+
if (!t?.enabled || i === null || T.getSnapshot().running) return f;
|
|
266
|
+
n += 1;
|
|
267
|
+
let o = n, s = b, c = () => s !== b;
|
|
268
|
+
E({
|
|
269
|
+
running: !0,
|
|
270
|
+
notice: null
|
|
271
|
+
});
|
|
272
|
+
for (let e = 0; e < 3; e += 1) {
|
|
273
|
+
let e = t;
|
|
274
|
+
if (!e?.enabled || n !== o) return f;
|
|
275
|
+
if (c()) return E({ running: !1 }), f;
|
|
276
|
+
let s = e.rows, l = T.getSnapshot().scope, d = [], p = 0, m = 0, h = e.columns.length, g = await a(e.rowModel.getRowCount(), (t) => {
|
|
277
|
+
for (let n = 0; n < h; n += 1) {
|
|
278
|
+
if (!N(e, l, t, n)) continue;
|
|
279
|
+
let a = A(e, i, r, t, n);
|
|
280
|
+
if (a === null) continue;
|
|
281
|
+
let o = a.replacement;
|
|
282
|
+
if (o.action === "skip") {
|
|
283
|
+
m += o.count;
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
let s = e.rowModel.getSourceIndex(t);
|
|
287
|
+
s !== void 0 && (p += o.count, d.push({
|
|
288
|
+
sourceIndex: s,
|
|
289
|
+
column: a.column,
|
|
290
|
+
value: o.value
|
|
291
|
+
}));
|
|
292
|
+
}
|
|
293
|
+
}, { isCancelled: () => n !== o || c() });
|
|
294
|
+
if (n !== o) return f;
|
|
295
|
+
if (!g || c()) return E({ running: !1 }), f;
|
|
296
|
+
if (t !== null && t.rows !== s) continue;
|
|
297
|
+
E({
|
|
298
|
+
running: !1,
|
|
299
|
+
notice: {
|
|
300
|
+
kind: "result",
|
|
301
|
+
replaced: p,
|
|
302
|
+
skipped: m
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
let _ = u(s, d);
|
|
306
|
+
return _ !== s && e.commitRows(_), {
|
|
307
|
+
replaced: p,
|
|
308
|
+
skipped: m
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
return E({
|
|
312
|
+
running: !1,
|
|
313
|
+
notice: { kind: "interrupted" }
|
|
314
|
+
}), f;
|
|
315
|
+
},
|
|
316
|
+
subscribe: T.subscribe,
|
|
317
|
+
getSnapshot: T.getSnapshot,
|
|
318
|
+
dispose: () => {
|
|
319
|
+
n += 1, L(), w = null, C = null, g?.(), g = null, _ = null, t = null;
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
//#endregion
|
|
324
|
+
export { g as createFindReplaceController, p as resolveFindScopeFromSelection };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../model/gridActions.cjs"),t=require("../utils/permissions.cjs"),n=require("../logic/columnEditor.cjs"),r=require("../logic/detailRow.cjs"),i=require("../logic/geometry.cjs"),a=require("../logic/domGuards.cjs"),o=require("../logic/newRow.cjs"),s=require("./liveUiState.cjs"),c=require("./clipboardController.cjs"),l=require("./escapeClaimController.cjs");var u=10,d=(e,t,n,r)=>{if(!e.getLabelRow)return t;let i=e.getRowCount(),a=t;for(;a>=0&&a<i&&e.getLabelRow(a);)a+=n;return a>=0&&a<i?a:r},f=e=>d(e,0,1,0),p=e=>r.resolveFirstDataColIndex(e),m=(e,t)=>({row:f(e),col:p(t)}),h=()=>{let r=null,h=e=>{r=e},g=(e,t)=>d(e,t,-1,d(e,t,1,t)),_=e=>{let t=o.getSelectableRowCount(e),n=(t>0?t:e.getRowCount())-1;return d(e,n,-1,n)},v=(t,n,i)=>{if(r===null)return;let{dispatch:a}=r,o=s.readLiveUiState(r);if(i){let r=o.selection?.type===`cell`?o.selection.range.start:t;a(e.gridActions.startSelection(r)),a(e.gridActions.updateSelection(n)),a(e.gridActions.endSelection()),a(e.gridActions.activateCell(n));return}a(e.gridActions.startSelection(n)),a(e.gridActions.endSelection()),a(e.gridActions.activateCell(n))},y=()=>{if(r===null||s.readLiveUiState(r).activeCell)return!1;let{rowModel:e,visibleColumns:t}=r;if(e.getRowCount()===0||t.length===0)return!0;let n=m(e,t);return v(n,n,!1),!0},b=e=>{let t=r===null?void 0:s.readLiveUiState(r);return e&&t?.selection?.type===`cell`?t.selection.range.end:t?.activeCell??{row:0,col:0}},x=(e,t,n)=>{if(r===null)return;let{rowModel:a,visibleColumns:o}=r,s=a.getRowCount();if(s===0||o.length===0||y())return;let c=b(n),l=i.clamp(c.row+e,0,s-1);l=e===0?g(a,l):d(a,l,e>0?1:-1,c.row);let u={row:l,col:i.clamp(c.col+t,0,o.length-1)};v(c,u,n)},S=(e,t,n)=>{if(r===null)return;let{rowModel:a,visibleColumns:o}=r,c=s.readLiveUiState(r);if(a.getRowCount()===0||o.length===0)return;let l=c.activeCell?b(t):{row:f(a),col:p(o)},u=e(l,a,o),d=i.clamp(u.col,0,o.length-1);v(l,{row:g(a,i.clamp(u.row,0,a.getRowCount()-1)),col:d},t&&c.activeCell!==null);let m=n===void 0?null:r.scrollContainerRef?.current??null,h=o[d]?.pinned;m!==null&&(n===`start`?h===`left`:h===`right`)&&(m.scrollLeft=n===`start`?0:Math.max(m.scrollWidth-m.clientWidth,0))},C=(e,t,n)=>{let a=t.getRowCount(),o=r?.resolvePageRow?r.resolvePageRow(e.row,n):e.row+n*u,s=i.clamp(n>0?Math.max(o,e.row+1):Math.min(o,e.row-1),0,a-1),c=d(t,s,n,-1);return c>=0?c:d(t,s,n>0?-1:1,e.row)};return{update:h,handleKeyDown:async i=>{if(r===null)return;let{rowModel:u,visibleColumns:d,readOnly:m,canEditCell:h,setEditorInitialValue:g,dispatch:v,handleCopy:b,openFind:w,handleCellDoubleClick:T,selectEntireGrid:E,onUndo:D,onRedo:O,onClearSelection:k,enableClearOnDelete:A,onToggleCheckboxCell:j,onToggleGroup:M,onToggleDetailRow:N}=r,P=s.readLiveUiState(r),F=r.getUiState?c.computeIsWholeGridSelected(P.selection,o.getSelectableRowCount(u),d.length):r.isWholeGridSelected;if(a.shouldIgnoreGridKeydown(i.target)||s.isEditingAtEvent(r)||i.isComposing&&a.isImeInputTarget(i.target))return;if((i.ctrlKey||i.metaKey)&&i.key.toLowerCase()===`c`){i.preventDefault(),await b();return}if((i.ctrlKey||i.metaKey)&&!i.altKey&&i.key.toLowerCase()===`x`&&r.handleCut){i.preventDefault(),await r.handleCut();return}if((i.ctrlKey||i.metaKey)&&i.key.toLowerCase()===`f`&&w){i.preventDefault(),w();return}if((i.ctrlKey||i.metaKey)&&i.key.toLowerCase()===`a`){if(i.preventDefault(),F){v(e.gridActions.clearSelection()),v(e.gridActions.activateCell(null));return}E();return}if((i.ctrlKey||i.metaKey)&&!i.isComposing){if(i.key.toLowerCase()===`z`){i.preventDefault(),i.shiftKey?O():D();return}if(i.key.toLowerCase()===`y`&&!i.shiftKey){i.preventDefault(),O();return}}if(r.onShortcutKeyDown?.(i))return;let I=i.ctrlKey||i.metaKey;if((i.key===`ContextMenu`||i.key===`F10`&&i.shiftKey)&&!I&&!i.altKey&&P.activeCell&&r.openContextMenu?.(P.activeCell)){i.preventDefault();return}if((i.key===`ArrowDown`||i.key===`ArrowUp`)&&i.altKey&&i.shiftKey&&!I&&P.activeCell&&r.onToggleTreeRow?.(P.activeCell,i.key===`ArrowDown`)){i.preventDefault();return}if(i.key===`ArrowDown`&&i.altKey&&!I&&!i.shiftKey&&P.activeCell&&r.openColumnMenu?.(P.activeCell.col)){i.preventDefault();return}if(I&&!i.altKey&&(i.key===`ArrowUp`||i.key===`ArrowDown`)){i.preventDefault();let e=i.key===`ArrowDown`;S((t,n)=>({row:e?_(n):f(n),col:t.col}),i.shiftKey);return}if(I&&!i.altKey&&(i.key===`ArrowLeft`||i.key===`ArrowRight`)){i.preventDefault();let e=i.key===`ArrowRight`;S((t,n,r)=>({row:t.row,col:e?r.length-1:p(r)}),i.shiftKey,e?`end`:`start`);return}if((i.key===`Home`||i.key===`End`)&&!i.altKey){i.preventDefault();let e=i.key===`End`;S((t,n,r)=>({row:I?e?_(n):f(n):t.row,col:e?r.length-1:p(r)}),i.shiftKey,e?`end`:`start`);return}if((i.key===`PageDown`||i.key===`PageUp`)&&!I&&!i.altKey){if(i.preventDefault(),y())return;let e=i.key===`PageDown`?1:-1;S((t,n)=>({row:C(t,n,e),col:t.col}),i.shiftKey);return}if(i.key===`ArrowUp`){i.preventDefault(),x(-1,0,i.shiftKey);return}if(i.key===`ArrowDown`){i.preventDefault(),x(1,0,i.shiftKey);return}if(i.key===`ArrowLeft`){i.preventDefault(),x(0,-1,i.shiftKey);return}if(i.key===`ArrowRight`){i.preventDefault(),x(0,1,i.shiftKey);return}if(i.key===`Tab`){if(!P.activeCell&&!i.shiftKey){if(r.rowModel.getRowCount()===0||r.visibleColumns.length===0)return;i.preventDefault(),y();return}let e=P.activeCell?.col??0;if(i.shiftKey?e<=p(r.visibleColumns):e>=r.visibleColumns.length-1){!i.shiftKey&&P.activeCell&&(r.onTabPastLastColumn?.(P.activeCell.row)||r.onTabPastNewRowDraft?.(P.activeCell,o.resolveFirstEditableColIndex(r.visibleColumns,r.readOnly)))&&i.preventDefault();return}i.preventDefault(),x(0,i.shiftKey?-1:1,!1);return}if(i.key===`Escape`){if(P.activeCell&&r.onEscapeNewRow?.(P.activeCell)){i.preventDefault();return}l.isClearableSelection(P.selection)&&i.preventDefault(),v(e.gridActions.clearSelection());return}if((i.key===`Delete`||i.key===`Backspace`)&&A){i.preventDefault(),k();return}if((i.key===`Enter`||i.key===` `)&&P.activeCell){let e=u.getGroupRow?.(P.activeCell.row);if(e){i.preventDefault(),M(e.groupKey);return}if(N&&d[P.activeCell.col]?.key===`__ssg_detail_toggle__`&&N(P.activeCell)){i.preventDefault();return}}if(i.key===`Enter`||i.key===`F2`){if(i.preventDefault(),P.activeCell){T(P.activeCell);return}i.key===`Enter`&&y();return}if(i.key===` `&&!i.ctrlKey&&!i.metaKey&&!i.altKey&&i.preventDefault(),a.isPrintableKey(i)&&P.activeCell){let r=d[P.activeCell.col],a=o.resolveEditRow(u,P.activeCell.row,r!==void 0&&t.isColumnEditable(m,r));if(!a||!r||!t.isViewCellEditable({readOnly:m,canEditCell:h},u,P.activeCell.row,P.activeCell.col,a,r))return;if(n.resolveColumnEditor(r,a)?.type===`checkbox`){i.preventDefault(),i.key===` `&&j(P.activeCell);return}i.preventDefault(),g(i.key),v(e.gridActions.startEdit(P.activeCell))}}}};exports.createKeyboardController=h,exports.resolveFirstDataCell=m;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../model/gridActions.cjs"),t=require("../utils/permissions.cjs"),n=require("../logic/columnEditor.cjs"),r=require("../logic/detailRow.cjs"),i=require("../logic/geometry.cjs"),a=require("../logic/domGuards.cjs"),o=require("../logic/newRow.cjs"),s=require("./liveUiState.cjs"),c=require("./clipboardController.cjs"),l=require("./escapeClaimController.cjs");var u=10,d=(e,t,n,r)=>{if(!e.getLabelRow)return t;let i=e.getRowCount(),a=t;for(;a>=0&&a<i&&e.getLabelRow(a);)a+=n;return a>=0&&a<i?a:r},f=e=>d(e,0,1,0),p=e=>r.resolveFirstDataColIndex(e),m=(e,t)=>({row:f(e),col:p(t)}),h=()=>{let r=null,h=e=>{r=e},g=(e,t)=>d(e,t,-1,d(e,t,1,t)),_=e=>{let t=o.getSelectableRowCount(e),n=(t>0?t:e.getRowCount())-1;return d(e,n,-1,n)},v=(t,n,i)=>{if(r===null)return;let{dispatch:a}=r,o=s.readLiveUiState(r);if(i){let r=o.selection?.type===`cell`?o.selection.range.start:t;a(e.gridActions.startSelection(r)),a(e.gridActions.updateSelection(n)),a(e.gridActions.endSelection()),a(e.gridActions.activateCell(n));return}a(e.gridActions.startSelection(n)),a(e.gridActions.endSelection()),a(e.gridActions.activateCell(n))},y=()=>{if(r===null||s.readLiveUiState(r).activeCell)return!1;let{rowModel:e,visibleColumns:t}=r;if(e.getRowCount()===0||t.length===0)return!0;let n=m(e,t);return v(n,n,!1),!0},b=e=>{let t=r===null?void 0:s.readLiveUiState(r);return e&&t?.selection?.type===`cell`?t.selection.range.end:t?.activeCell??{row:0,col:0}},x=(e,t,n)=>{if(r===null)return;let{rowModel:a,visibleColumns:o}=r,s=a.getRowCount();if(s===0||o.length===0||y())return;let c=b(n);if(e!==0&&!n){let e=r.getChangeNavOrigin?.()??null;e!==null&&(c={row:e,col:c.col})}let l=i.clamp(c.row+e,0,s-1);l=e===0?g(a,l):d(a,l,e>0?1:-1,c.row);let u={row:l,col:i.clamp(c.col+t,0,o.length-1)};v(c,u,n)},S=(e,t,n)=>{if(r===null)return;let{rowModel:a,visibleColumns:o}=r,c=s.readLiveUiState(r);if(a.getRowCount()===0||o.length===0)return;let l=c.activeCell?b(t):{row:f(a),col:p(o)},u=e(l,a,o),d=i.clamp(u.col,0,o.length-1);v(l,{row:g(a,i.clamp(u.row,0,a.getRowCount()-1)),col:d},t&&c.activeCell!==null);let m=n===void 0?null:r.scrollContainerRef?.current??null,h=o[d]?.pinned;m!==null&&(n===`start`?h===`left`:h===`right`)&&(m.scrollLeft=n===`start`?0:Math.max(m.scrollWidth-m.clientWidth,0))},C=(e,t,n)=>{let a=t.getRowCount(),o=r?.resolvePageRow?r.resolvePageRow(e.row,n):e.row+n*u,s=i.clamp(n>0?Math.max(o,e.row+1):Math.min(o,e.row-1),0,a-1),c=d(t,s,n,-1);return c>=0?c:d(t,s,n>0?-1:1,e.row)};return{update:h,handleKeyDown:async i=>{if(r===null)return;let{rowModel:u,visibleColumns:d,readOnly:m,canEditCell:h,setEditorInitialValue:g,dispatch:v,handleCopy:b,openFind:w,handleCellDoubleClick:T,selectEntireGrid:E,onUndo:D,onRedo:O,onClearSelection:k,enableClearOnDelete:A,onToggleCheckboxCell:j,onToggleGroup:M,onToggleDetailRow:N}=r,P=s.readLiveUiState(r),F=r.getUiState?c.computeIsWholeGridSelected(P.selection,o.getSelectableRowCount(u),d.length):r.isWholeGridSelected;if(a.shouldIgnoreGridKeydown(i.target)||s.isEditingAtEvent(r)||i.isComposing&&a.isImeInputTarget(i.target))return;if((i.ctrlKey||i.metaKey)&&i.key.toLowerCase()===`c`){i.preventDefault(),await b();return}if((i.ctrlKey||i.metaKey)&&!i.altKey&&i.key.toLowerCase()===`x`&&r.handleCut){i.preventDefault(),await r.handleCut();return}if((i.ctrlKey||i.metaKey)&&i.key.toLowerCase()===`f`&&w){i.preventDefault(),w();return}if(i.ctrlKey&&!i.metaKey&&!i.altKey&&i.key.toLowerCase()===`h`&&r.openFindReplace){i.preventDefault(),r.openFindReplace();return}if((i.ctrlKey||i.metaKey)&&i.key.toLowerCase()===`a`){if(i.preventDefault(),F){v(e.gridActions.clearSelection()),v(e.gridActions.activateCell(null));return}E();return}if((i.ctrlKey||i.metaKey)&&!i.isComposing){if(i.key.toLowerCase()===`z`){i.preventDefault(),i.shiftKey?O():D();return}if(i.key.toLowerCase()===`y`&&!i.shiftKey){i.preventDefault(),O();return}}if(r.onShortcutKeyDown?.(i))return;let I=i.ctrlKey||i.metaKey;if((i.key===`ContextMenu`||i.key===`F10`&&i.shiftKey)&&!I&&!i.altKey&&P.activeCell&&r.openContextMenu?.(P.activeCell)){i.preventDefault();return}if((i.key===`ArrowDown`||i.key===`ArrowUp`)&&i.altKey&&i.shiftKey&&!I&&P.activeCell&&r.onToggleTreeRow?.(P.activeCell,i.key===`ArrowDown`)){i.preventDefault();return}if(i.key===`ArrowDown`&&i.altKey&&!I&&!i.shiftKey&&P.activeCell&&r.openColumnMenu?.(P.activeCell.col)){i.preventDefault();return}if(I&&!i.altKey&&(i.key===`ArrowUp`||i.key===`ArrowDown`)){i.preventDefault();let e=i.key===`ArrowDown`;S((t,n)=>({row:e?_(n):f(n),col:t.col}),i.shiftKey);return}if(I&&!i.altKey&&(i.key===`ArrowLeft`||i.key===`ArrowRight`)){i.preventDefault();let e=i.key===`ArrowRight`;S((t,n,r)=>({row:t.row,col:e?r.length-1:p(r)}),i.shiftKey,e?`end`:`start`);return}if((i.key===`Home`||i.key===`End`)&&!i.altKey){i.preventDefault();let e=i.key===`End`;S((t,n,r)=>({row:I?e?_(n):f(n):t.row,col:e?r.length-1:p(r)}),i.shiftKey,e?`end`:`start`);return}if((i.key===`PageDown`||i.key===`PageUp`)&&!I&&!i.altKey){if(i.preventDefault(),y())return;let e=i.key===`PageDown`?1:-1;S((t,n)=>({row:C(t,n,e),col:t.col}),i.shiftKey);return}if(i.key===`ArrowUp`){i.preventDefault(),x(-1,0,i.shiftKey);return}if(i.key===`ArrowDown`){i.preventDefault(),x(1,0,i.shiftKey);return}if(i.key===`ArrowLeft`){i.preventDefault(),x(0,-1,i.shiftKey);return}if(i.key===`ArrowRight`){i.preventDefault(),x(0,1,i.shiftKey);return}if(i.key===`Tab`){if(!P.activeCell&&!i.shiftKey){if(r.rowModel.getRowCount()===0||r.visibleColumns.length===0)return;i.preventDefault(),y();return}let e=P.activeCell?.col??0;if(i.shiftKey?e<=p(r.visibleColumns):e>=r.visibleColumns.length-1){!i.shiftKey&&P.activeCell&&(r.onTabPastLastColumn?.(P.activeCell.row)||r.onTabPastNewRowDraft?.(P.activeCell,o.resolveFirstEditableColIndex(r.visibleColumns,r.readOnly)))&&i.preventDefault();return}i.preventDefault(),x(0,i.shiftKey?-1:1,!1);return}if(i.key===`Escape`){if(P.activeCell&&r.onEscapeNewRow?.(P.activeCell)){i.preventDefault();return}l.isClearableSelection(P.selection)&&i.preventDefault(),v(e.gridActions.clearSelection());return}if((i.key===`Delete`||i.key===`Backspace`)&&A){i.preventDefault(),k();return}if((i.key===`Enter`||i.key===` `)&&P.activeCell){let e=u.getGroupRow?.(P.activeCell.row);if(e){i.preventDefault(),M(e.groupKey);return}if(N&&d[P.activeCell.col]?.key===`__ssg_detail_toggle__`&&N(P.activeCell)){i.preventDefault();return}}if(i.key===`Enter`||i.key===`F2`){if(i.preventDefault(),P.activeCell){T(P.activeCell);return}i.key===`Enter`&&y();return}if(i.key===` `&&!i.ctrlKey&&!i.metaKey&&!i.altKey&&i.preventDefault(),a.isPrintableKey(i)&&P.activeCell){let r=d[P.activeCell.col],a=o.resolveEditRow(u,P.activeCell.row,r!==void 0&&t.isColumnEditable(m,r));if(!a||!r||!t.isViewCellEditable({readOnly:m,canEditCell:h},u,P.activeCell.row,P.activeCell.col,a,r))return;if(n.resolveColumnEditor(r,a)?.type===`checkbox`){i.preventDefault(),i.key===` `&&j(P.activeCell);return}i.preventDefault(),g(i.key),v(e.gridActions.startEdit(P.activeCell))}}}};exports.createKeyboardController=h,exports.resolveFirstDataCell=m;
|
|
@@ -22,9 +22,11 @@ export type KeyboardControllerArgs<T> = {
|
|
|
22
22
|
handleCopy: () => Promise<void>;
|
|
23
23
|
handleCut?: (() => Promise<void>) | undefined;
|
|
24
24
|
onShortcutKeyDown?: ((event: GridKeyboardEventLike) => boolean) | undefined;
|
|
25
|
+
getChangeNavOrigin?: (() => number | null) | undefined;
|
|
25
26
|
onEscapeNewRow?: ((cell: CellCoord) => boolean) | undefined;
|
|
26
27
|
onTabPastNewRowDraft?: ((cell: CellCoord, firstCol: number) => boolean) | undefined;
|
|
27
28
|
openFind?: () => void;
|
|
29
|
+
openFindReplace?: (() => void) | undefined;
|
|
28
30
|
handleCellDoubleClick: (cell: CellCoord) => void;
|
|
29
31
|
isWholeGridSelected: boolean;
|
|
30
32
|
selectEntireGrid: () => void;
|
|
@@ -48,7 +48,15 @@ var g = 10, _ = (e, t, n, r) => {
|
|
|
48
48
|
if (i === null) return;
|
|
49
49
|
let { rowModel: r, visibleColumns: o } = i, s = r.getRowCount();
|
|
50
50
|
if (s === 0 || o.length === 0 || T()) return;
|
|
51
|
-
let c = E(n)
|
|
51
|
+
let c = E(n);
|
|
52
|
+
if (e !== 0 && !n) {
|
|
53
|
+
let e = i.getChangeNavOrigin?.() ?? null;
|
|
54
|
+
e !== null && (c = {
|
|
55
|
+
row: e,
|
|
56
|
+
col: c.col
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
let l = a(c.row + e, 0, s - 1);
|
|
52
60
|
l = e === 0 ? S(r, l) : _(r, l, e > 0 ? 1 : -1, c.row);
|
|
53
61
|
let u = {
|
|
54
62
|
row: l,
|
|
@@ -91,6 +99,10 @@ var g = 10, _ = (e, t, n, r) => {
|
|
|
91
99
|
a.preventDefault(), A();
|
|
92
100
|
return;
|
|
93
101
|
}
|
|
102
|
+
if (a.ctrlKey && !a.metaKey && !a.altKey && a.key.toLowerCase() === "h" && i.openFindReplace) {
|
|
103
|
+
a.preventDefault(), i.openFindReplace();
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
94
106
|
if ((a.ctrlKey || a.metaKey) && a.key.toLowerCase() === "a") {
|
|
95
107
|
if (a.preventDefault(), V) {
|
|
96
108
|
w(e.clearSelection()), w(e.activateCell(null));
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/chunkedLoop.cjs"),t=require("../logic/rowDiff.cjs");var n=8,r=10,i=(e,t)=>{if(e===t)return!0;if(e.size!==t.size)return!1;let n=t.entries();for(let[t,r]of e){let e=n.next();if(e.done)return!1;let[i,a]=e.value;if(t!==i||r.getValue!==a.getValue||r.setValue!==a.setValue||r.editor!==a.editor)return!1}return!0},a=1e3,o=(e,n,r,i,o)=>{let{rows:s,rowKeyGetter:c}=n,l=e.rows;if(e.baseline!==r.baseline||s.length!==l.length)return null;let u=[];for(let e=0;e<s.length;e+=1)if(s[e]!==l[e]&&(u.push(e),u.length>a))return null;if(u.length===0)return{...e,rows:s};let d=null,f=e.cellCount;for(let n of u){let a=s[n],u=c(a,n);if(u!==c(l[n],n))return null;if(e.rowChanges.added.has(u))continue;let p=r.positions.get(u);if(p===void 0)return null;let m=t.diffRowCellsCached(o,a,r.baseline[p],i);d??=new Map(e.records);let h=d.get(u);f-=h?.saved.size??0,m===null?d.delete(u):(d.set(u,{saved:m,index:n,present:!0}),f+=m.size)}return{...e,rows:s,records:d??e.records,cellCount:f}},s=(e,t)=>{console.warn(`[spreadsheet-grid] trackChanges.baseline: baseline の行のキー(${e})と rows の行のキー(${t})の型が違うため、すべての行が追加と削除になりました(数値の 1 と文字列の '1' は別のキーです)。rowKeyGetter が baseline と rows で同じ型のキーを返すようにしてください。
|
|
2
|
+
[spreadsheet-grid] trackChanges.baseline: every row is shown as added and removed because the baseline row keys (${e}) and the rows' keys (${t}) have different types (the number 1 and the string '1' are different keys). Make rowKeyGetter return keys of the same type for the baseline and the rows.`)},c=()=>{let a=null,c=null,l=new WeakMap,u=null,d=null,f=null,p=null,m=null,h=new Set,g=!1,_=()=>{m!==null&&(clearTimeout(m),m=null)},v=e=>{let{removed:n,removedKeys:r}=t.resolveRemovedRows(e.baselineIndex,e.target.seen);if(u={rows:e.args.rows,baseline:e.baselineIndex.baseline,baselineIndex:e.baselineIndex,records:e.target.records,rowChanges:{added:e.target.added,removed:n},removedKeys:r,cellCount:e.target.cellCount},p=null,process.env.NODE_ENV!==`production`&&!g){let{seen:t,added:n}=e.target,i=e.baselineIndex.keys[0],a=t.values().next().value;t.size>0&&n.size===t.size&&r.length>0&&i!==void 0&&a!==void 0&&typeof i!=typeof a&&(g=!0,s(typeof i,typeof a))}},y=n=>{let r=p;if(r===null)return!0;let{rows:i,rowKeyGetter:a}=r.args,o=e.nowMs(),s=i.length;for(;r.next<s;){let c=Math.min(s,r.next+256);for(let e=r.next;e<c;e+=1)t.accumulateRowDiff(r.target,i[e],e,r.baselineIndex,a,r.columns,l);if(r.next=c,n!==1/0&&e.nowMs()-o>=n&&r.next<s)return!1}return v(r),!0},b=()=>{for(let e of[...h])e()},x=()=>{_(),m=setTimeout(()=>{m=null,p!==null&&(y(r)?b():x())},0)},S=e=>{let r=!1;(a===null||a.baseline!==e.baseline)&&(a=t.buildBaselineIndex(e.baseline,e.rowKeyGetter),r=!0);let s=!1;if((c===null||!i(c,e.trackedColumns))&&(c=e.trackedColumns,s=!0,l=new WeakMap),!r&&!s&&e.rows===d)return p!==null&&m===null&&x(),!1;if(d=e.rows,f=e,!r&&!s&&p===null&&u!==null){let t=o(u,e,a,c,l);if(t!==null)return _(),u=t,!0}return _(),p={args:e,baselineIndex:a,columns:c,next:0,target:{records:new Map,added:new Map,seen:new Set,cellCount:0}},y(n)?!0:(x(),!1)},C=()=>{p!==null&&(_(),y(1/0),b())};return{update:S,current:()=>u,flush:C,peek:e=>{if(a===null||c===null||f===null)return null;if(C(),e===d)return u;let n={...f,rows:e};return(u===null?null:o(u,n,a,c,l))??t.computeRowDiff(e,a,n.rowKeyGetter,c,l)},isRunning:()=>p!==null,getBaselineIndex:()=>a,subscribe:e=>(h.add(e),()=>{h.delete(e)}),dispose:_}};exports.createRowDiffer=c;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { GridColumn, GridRowKey } from '../model/gridTypes.unbound.js';
|
|
2
|
+
import { type BaselineIndex, type RowDiffResult } from '../logic/rowDiff.js';
|
|
3
|
+
export type RowDifferArgs<T> = {
|
|
4
|
+
rows: readonly T[];
|
|
5
|
+
baseline: readonly T[];
|
|
6
|
+
rowKeyGetter: (row: T, index: number) => GridRowKey;
|
|
7
|
+
trackedColumns: ReadonlyMap<string, GridColumn<T>>;
|
|
8
|
+
};
|
|
9
|
+
export type RowDiffer<T> = {
|
|
10
|
+
update: (args: RowDifferArgs<T>) => boolean;
|
|
11
|
+
current: () => RowDiffResult<T> | null;
|
|
12
|
+
flush: () => void;
|
|
13
|
+
peek: (rows: readonly T[]) => RowDiffResult<T> | null;
|
|
14
|
+
getBaselineIndex: () => BaselineIndex<T> | null;
|
|
15
|
+
isRunning: () => boolean;
|
|
16
|
+
subscribe: (listener: () => void) => () => void;
|
|
17
|
+
dispose: () => void;
|
|
18
|
+
};
|
|
19
|
+
export declare const createRowDiffer: <T>() => RowDiffer<T>;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { nowMs as e } from "../logic/chunkedLoop.js";
|
|
2
|
+
import { accumulateRowDiff as t, buildBaselineIndex as n, computeRowDiff as r, diffRowCellsCached as i, resolveRemovedRows as a } from "../logic/rowDiff.js";
|
|
3
|
+
//#region src/controllers/rowDiffer.ts
|
|
4
|
+
var o = 8, s = 10, c = (e, t) => {
|
|
5
|
+
if (e === t) return !0;
|
|
6
|
+
if (e.size !== t.size) return !1;
|
|
7
|
+
let n = t.entries();
|
|
8
|
+
for (let [t, r] of e) {
|
|
9
|
+
let e = n.next();
|
|
10
|
+
if (e.done) return !1;
|
|
11
|
+
let [i, a] = e.value;
|
|
12
|
+
if (t !== i || r.getValue !== a.getValue || r.setValue !== a.setValue || r.editor !== a.editor) return !1;
|
|
13
|
+
}
|
|
14
|
+
return !0;
|
|
15
|
+
}, l = 1e3, u = (e, t, n, r, a) => {
|
|
16
|
+
let { rows: o, rowKeyGetter: s } = t, c = e.rows;
|
|
17
|
+
if (e.baseline !== n.baseline || o.length !== c.length) return null;
|
|
18
|
+
let u = [];
|
|
19
|
+
for (let e = 0; e < o.length; e += 1) if (o[e] !== c[e] && (u.push(e), u.length > l)) return null;
|
|
20
|
+
if (u.length === 0) return {
|
|
21
|
+
...e,
|
|
22
|
+
rows: o
|
|
23
|
+
};
|
|
24
|
+
let d = null, f = e.cellCount;
|
|
25
|
+
for (let t of u) {
|
|
26
|
+
let l = o[t], u = s(l, t);
|
|
27
|
+
if (u !== s(c[t], t)) return null;
|
|
28
|
+
if (e.rowChanges.added.has(u)) continue;
|
|
29
|
+
let p = n.positions.get(u);
|
|
30
|
+
if (p === void 0) return null;
|
|
31
|
+
let m = i(a, l, n.baseline[p], r);
|
|
32
|
+
d ??= new Map(e.records);
|
|
33
|
+
let h = d.get(u);
|
|
34
|
+
f -= h?.saved.size ?? 0, m === null ? d.delete(u) : (d.set(u, {
|
|
35
|
+
saved: m,
|
|
36
|
+
index: t,
|
|
37
|
+
present: !0
|
|
38
|
+
}), f += m.size);
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
...e,
|
|
42
|
+
rows: o,
|
|
43
|
+
records: d ?? e.records,
|
|
44
|
+
cellCount: f
|
|
45
|
+
};
|
|
46
|
+
}, d = (e, t) => {
|
|
47
|
+
console.warn(`[spreadsheet-grid] trackChanges.baseline: baseline の行のキー(${e})と rows の行のキー(${t})の型が違うため、すべての行が追加と削除になりました(数値の 1 と文字列の '1' は別のキーです)。rowKeyGetter が baseline と rows で同じ型のキーを返すようにしてください。
|
|
48
|
+
[spreadsheet-grid] trackChanges.baseline: every row is shown as added and removed because the baseline row keys (${e}) and the rows' keys (${t}) have different types (the number 1 and the string '1' are different keys). Make rowKeyGetter return keys of the same type for the baseline and the rows.`);
|
|
49
|
+
}, f = () => {
|
|
50
|
+
let i = null, l = null, f = /* @__PURE__ */ new WeakMap(), p = null, m = null, h = null, g = null, _ = null, v = /* @__PURE__ */ new Set(), y = !1, b = () => {
|
|
51
|
+
_ !== null && (clearTimeout(_), _ = null);
|
|
52
|
+
}, x = (e) => {
|
|
53
|
+
let { removed: t, removedKeys: n } = a(e.baselineIndex, e.target.seen);
|
|
54
|
+
if (p = {
|
|
55
|
+
rows: e.args.rows,
|
|
56
|
+
baseline: e.baselineIndex.baseline,
|
|
57
|
+
baselineIndex: e.baselineIndex,
|
|
58
|
+
records: e.target.records,
|
|
59
|
+
rowChanges: {
|
|
60
|
+
added: e.target.added,
|
|
61
|
+
removed: t
|
|
62
|
+
},
|
|
63
|
+
removedKeys: n,
|
|
64
|
+
cellCount: e.target.cellCount
|
|
65
|
+
}, g = null, process.env.NODE_ENV !== "production" && !y) {
|
|
66
|
+
let { seen: t, added: r } = e.target, i = e.baselineIndex.keys[0], a = t.values().next().value;
|
|
67
|
+
t.size > 0 && r.size === t.size && n.length > 0 && i !== void 0 && a !== void 0 && typeof i != typeof a && (y = !0, d(typeof i, typeof a));
|
|
68
|
+
}
|
|
69
|
+
}, S = (n) => {
|
|
70
|
+
let r = g;
|
|
71
|
+
if (r === null) return !0;
|
|
72
|
+
let { rows: i, rowKeyGetter: a } = r.args, o = e(), s = i.length;
|
|
73
|
+
for (; r.next < s;) {
|
|
74
|
+
let c = Math.min(s, r.next + 256);
|
|
75
|
+
for (let e = r.next; e < c; e += 1) t(r.target, i[e], e, r.baselineIndex, a, r.columns, f);
|
|
76
|
+
if (r.next = c, n !== Infinity && e() - o >= n && r.next < s) return !1;
|
|
77
|
+
}
|
|
78
|
+
return x(r), !0;
|
|
79
|
+
}, C = () => {
|
|
80
|
+
for (let e of [...v]) e();
|
|
81
|
+
}, w = () => {
|
|
82
|
+
b(), _ = setTimeout(() => {
|
|
83
|
+
_ = null, g !== null && (S(s) ? C() : w());
|
|
84
|
+
}, 0);
|
|
85
|
+
}, T = (e) => {
|
|
86
|
+
let t = !1;
|
|
87
|
+
(i === null || i.baseline !== e.baseline) && (i = n(e.baseline, e.rowKeyGetter), t = !0);
|
|
88
|
+
let r = !1;
|
|
89
|
+
if ((l === null || !c(l, e.trackedColumns)) && (l = e.trackedColumns, r = !0, f = /* @__PURE__ */ new WeakMap()), !t && !r && e.rows === m) return g !== null && _ === null && w(), !1;
|
|
90
|
+
if (m = e.rows, h = e, !t && !r && g === null && p !== null) {
|
|
91
|
+
let t = u(p, e, i, l, f);
|
|
92
|
+
if (t !== null) return b(), p = t, !0;
|
|
93
|
+
}
|
|
94
|
+
return b(), g = {
|
|
95
|
+
args: e,
|
|
96
|
+
baselineIndex: i,
|
|
97
|
+
columns: l,
|
|
98
|
+
next: 0,
|
|
99
|
+
target: {
|
|
100
|
+
records: /* @__PURE__ */ new Map(),
|
|
101
|
+
added: /* @__PURE__ */ new Map(),
|
|
102
|
+
seen: /* @__PURE__ */ new Set(),
|
|
103
|
+
cellCount: 0
|
|
104
|
+
}
|
|
105
|
+
}, S(o) ? !0 : (w(), !1);
|
|
106
|
+
}, E = () => {
|
|
107
|
+
g !== null && (b(), S(Infinity), C());
|
|
108
|
+
};
|
|
109
|
+
return {
|
|
110
|
+
update: T,
|
|
111
|
+
current: () => p,
|
|
112
|
+
flush: E,
|
|
113
|
+
peek: (e) => {
|
|
114
|
+
if (i === null || l === null || h === null) return null;
|
|
115
|
+
if (E(), e === m) return p;
|
|
116
|
+
let t = {
|
|
117
|
+
...h,
|
|
118
|
+
rows: e
|
|
119
|
+
};
|
|
120
|
+
return (p === null ? null : u(p, t, i, l, f)) ?? r(e, i, t.rowKeyGetter, l, f);
|
|
121
|
+
},
|
|
122
|
+
isRunning: () => g !== null,
|
|
123
|
+
getBaselineIndex: () => i,
|
|
124
|
+
subscribe: (e) => (v.add(e), () => {
|
|
125
|
+
v.delete(e);
|
|
126
|
+
}),
|
|
127
|
+
dispose: b
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
//#endregion
|
|
131
|
+
export { f as createRowDiffer };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../model/gridActions.cjs"),t=require("../logic/detailRow.cjs"),n=require("../controllers/activeRowFollowController.cjs"),r=require("../controllers/columnAutosizeRunner.cjs"),i=require("../controllers/debouncedValueStore.cjs"),a=require("../controllers/rowEnterController.cjs"),o=require("../controllers/scrollSyncController.cjs"),s=require("./columnCommands.cjs"),c=require("./columnLayout.cjs"),l=require("../logic/gridState.cjs"),u=require("../model/gridReducer.cjs"),d=require("../model/gridStore.cjs"),f=require("./features.cjs"),p=require("./rowPipeline.cjs"),m=require("./verticalLayout.cjs"),h=require("./rowSelectionCommands.cjs"),g=require("./gridApi.cjs"),_=require("./notifiers.cjs");var v=300,y=e=>[...e.filter(e=>e.pinned===`left`),...e.filter(e=>e.pinned!==`left`&&e.pinned!==`right`),...e.filter(e=>e.pinned===`right`)],b=(e,t)=>{let n=new Map(t.map(e=>[e.key,e])),r=new Set(e.map(e=>e.key)),i=y(e.filter(e=>n.has(e.key))),a=y(t.filter(e=>r.has(e.key)));return i.length===a.length&&i.every((e,t)=>{let n=a[t];return n!==void 0&&n.key===e.key&&n.visible!==!1==(e.visible!==!1)&&(n.pinned??null)===(e.pinned??null)&&(e.rowGroup===void 0||n.rowGroup===!0===e.rowGroup)})},x=new WeakSet,S=(t,n)=>{let r=u.createInitialGridUiState();if(t==null)return r;let{patch:i,dropped:a}=l.dropUnknownColumnKeys(l.migrateGridStatePatch(t),new Set(n.map(e=>e.key)));if(process.env.NODE_ENV!==`production`&&!(typeof t==`object`&&x.has(t))){if(typeof t==`object`&&x.add(t),a.length>0){let e=a.map(e=>`\`${e}\``).join(`, `);console.warn(`[spreadsheet-grid] initialState: 今の列定義(columns)に無い列 ${e} の列幅 / フィルター / 並べ替えを捨てました。
|
|
2
2
|
[spreadsheet-grid] initialState: dropped the widths / filters / sort of ${e}, which are not in the current columns.`)}i.columns!==void 0&&!b(i.columns,n)&&console.warn(`[spreadsheet-grid] initialState の columns(列の並び / 表示 / 固定 / グループ化)が columns prop と違いますが、使いません。columns prop で決めてください(保存した値から作るなら restoreColumnsFromState、マウントの後に変えるなら applyState)。
|
|
3
|
-
[spreadsheet-grid] initialState.columns (order / visibility / pinning / grouping) differs from the columns prop and is not used. Set them in the columns prop (build it with restoreColumnsFromState, or use applyState to change them after mounting).`)}return i.columnWidths&&(r=u.gridUiReducer(r,e.gridActions.resetColumnWidths(i.columnWidths))),i.filters&&(r=u.gridUiReducer(r,e.gridActions.setAllFilters({globalText:i.filters.globalText??``,columnFilters:i.filters.columnFilters??{}}))),i.sort&&(r=u.gridUiReducer(r,e.gridActions.setSort(i.sort))),i.collapsedGroups&&(r=u.gridUiReducer(r,e.gridActions.setCollapsedGroupKeys(new Set(i.collapsedGroups)))),i.closedColumnGroups&&(r=u.gridUiReducer(r,e.gridActions.setClosedColumnGroupKeys(new Set(i.closedColumnGroups)))),i.closedTreeRows&&(r=u.gridUiReducer(r,e.gridActions.setClosedTreeRowKeys(i.closedTreeRows))),r},C=e=>{let l=c.createColumnResolver(e.features),v=null,y=null,b=e=>(v=e,l(e)),x=p.createRowPipelineResolver(e.features),C=n.createActiveRowFollowController(),w=e.features.newRow?.createNewRowController()??f.createInertNewRowController(),T=(e,t)=>w.confineSelection(E(e,t)),E=(t,n)=>{let r=u.gridUiReducer(t,n);if(r.treeOpen!==t.treeOpen&&e.features.treeData){let n=x.previewTreeDisplay(t.treeOpen),i=x.previewTreeDisplay(r.treeOpen),a=n&&i?e.features.treeData.followTreeRowsAfterToggle(r,n,i):r;return a.activeCell!==null&&a.activeCell!==r.activeCell&&C.noteFollowMove(a.activeCell),a}let i=v,a=i?.columnGroupFollow;if(r.closedColumnGroupKeys===t.closedColumnGroupKeys||!a||!i)return r;y??=c.createColumnResolver(e.features);let o=y,s=e=>o({...i,collapseColumns:a.collapseFor(e)}).orderedColumns.map(e=>e.key);return a.remap(r,s(t.closedColumnGroupKeys),s(r.closedColumnGroupKeys))},D=c.createPaneLayoutResolver(),O=m.createVerticalLayoutResolver(e.features.autoHeight),k=d.createGridStore(S(e.initialState,e.columnInputs.columns),T),A=k.getState(),j=(e.features.filtering?.createDateRolloverStore??f.createInertDateRolloverStore)(),M=e.features.filtering?.resolveRelativeDateFilterKey,N=i.createDebouncedValueStore(x.resolveServerSideQuery({isServerSide:e.serverSide.isServerSide,globalFilterEnabled:e.serverSide.enableGlobalFilter,globalText:A.filters.globalText,columnFilterEnabled:e.serverSide.enableColumnFilter,columnFilters:A.filters.columnFilters,sortingEnabled:e.serverSide.enableSorting,sort:A.sort,relativeDateKey:e.serverSide.isServerSide&&e.serverSide.enableColumnFilter&&M?M(e.columnInputs.columns,A.filters.columnFilters,j.getSnapshot()):void 0}),300),P=(e.features.autoHeight?.createAutoHeightMeasurer??f.createInertAutoHeightMeasurer)(),F=o.createScrollSyncController(),I=a.createRowEnterController(),L=e.features.motionExtras?.createChangeHighlightController()??f.createInertChangeHighlightController(),R=(e.features.serverSide?.createSaveStatusController??f.createInertSaveStatusController)(),z=e.features.find?.createFindController()??f.createInertFindController(),B=e.features.changeTracking?.createChangeTracker()??f.createInertChangeTracker(),
|
|
3
|
+
[spreadsheet-grid] initialState.columns (order / visibility / pinning / grouping) differs from the columns prop and is not used. Set them in the columns prop (build it with restoreColumnsFromState, or use applyState to change them after mounting).`)}return i.columnWidths&&(r=u.gridUiReducer(r,e.gridActions.resetColumnWidths(i.columnWidths))),i.filters&&(r=u.gridUiReducer(r,e.gridActions.setAllFilters({globalText:i.filters.globalText??``,columnFilters:i.filters.columnFilters??{}}))),i.sort&&(r=u.gridUiReducer(r,e.gridActions.setSort(i.sort))),i.collapsedGroups&&(r=u.gridUiReducer(r,e.gridActions.setCollapsedGroupKeys(new Set(i.collapsedGroups)))),i.closedColumnGroups&&(r=u.gridUiReducer(r,e.gridActions.setClosedColumnGroupKeys(new Set(i.closedColumnGroups)))),i.closedTreeRows&&(r=u.gridUiReducer(r,e.gridActions.setClosedTreeRowKeys(i.closedTreeRows))),r},C=e=>{let l=c.createColumnResolver(e.features),v=null,y=null,b=e=>(v=e,l(e)),x=p.createRowPipelineResolver(e.features),C=n.createActiveRowFollowController(),w=e.features.newRow?.createNewRowController()??f.createInertNewRowController(),T=(e,t)=>w.confineSelection(E(e,t)),E=(t,n)=>{let r=u.gridUiReducer(t,n);if(r.treeOpen!==t.treeOpen&&e.features.treeData){let n=x.previewTreeDisplay(t.treeOpen),i=x.previewTreeDisplay(r.treeOpen),a=n&&i?e.features.treeData.followTreeRowsAfterToggle(r,n,i):r;return a.activeCell!==null&&a.activeCell!==r.activeCell&&C.noteFollowMove(a.activeCell),a}let i=v,a=i?.columnGroupFollow;if(r.closedColumnGroupKeys===t.closedColumnGroupKeys||!a||!i)return r;y??=c.createColumnResolver(e.features);let o=y,s=e=>o({...i,collapseColumns:a.collapseFor(e)}).orderedColumns.map(e=>e.key);return a.remap(r,s(t.closedColumnGroupKeys),s(r.closedColumnGroupKeys))},D=c.createPaneLayoutResolver(),O=m.createVerticalLayoutResolver(e.features.autoHeight),k=d.createGridStore(S(e.initialState,e.columnInputs.columns),T),A=k.getState(),j=(e.features.filtering?.createDateRolloverStore??f.createInertDateRolloverStore)(),M=e.features.filtering?.resolveRelativeDateFilterKey,N=i.createDebouncedValueStore(x.resolveServerSideQuery({isServerSide:e.serverSide.isServerSide,globalFilterEnabled:e.serverSide.enableGlobalFilter,globalText:A.filters.globalText,columnFilterEnabled:e.serverSide.enableColumnFilter,columnFilters:A.filters.columnFilters,sortingEnabled:e.serverSide.enableSorting,sort:A.sort,relativeDateKey:e.serverSide.isServerSide&&e.serverSide.enableColumnFilter&&M?M(e.columnInputs.columns,A.filters.columnFilters,j.getSnapshot()):void 0}),300),P=(e.features.autoHeight?.createAutoHeightMeasurer??f.createInertAutoHeightMeasurer)(),F=o.createScrollSyncController(),I=a.createRowEnterController(),L=e.features.motionExtras?.createChangeHighlightController()??f.createInertChangeHighlightController(),R=(e.features.serverSide?.createSaveStatusController??f.createInertSaveStatusController)(),z=e.features.find?.createFindController()??f.createInertFindController(),B=e.features.findReplace?.createFindReplaceController()??f.createInertFindReplaceController(),V=e.features.changeTracking?.createChangeTracker()??f.createInertChangeTracker(),H=r.createAutoSizeOnDataTrigger(),U=e.features.imeDirectInput?.createImeInputController()??f.createInertImeInputController();return{store:k,resolveColumns:b,resolvePaneLayout:D,rowPipeline:x,resolveVerticalLayout:O,columnCommands:s.createColumnCommands(),rowSelectionCommands:h.createRowSelectionCommands(),gridApi:g.createGridApi(e.features),hoverRowNotifier:_.createHoverRowNotifier(),detailKeysNotifier:_.createDetailKeysNotifier(),stateChangeNotifier:_.createStateChangeNotifier(),columnGroupOpenNotifier:_.createColumnGroupOpenNotifier(),treeRowOpenNotifier:_.createTreeRowOpenNotifier(),cellEventNotifier:_.createCellEventNotifier(),activeCellNotifier:_.createActiveCellNotifier(),activeRowFollow:C,autoHeightMeasurer:P,scrollSync:F,rowEnter:I,changeHighlight:L,saveStatus:R,find:z,findReplace:B,changeTracker:V,excelShortcuts:e.features.excelShortcuts?.createExcelShortcutCommands()??f.createInertExcelShortcutCommands(),newRow:w,resolveConditionalFormatStats:e.features.conditionalFormat?.createConditionalFormatStatsResolver()??f.createInertConditionalFormatStatsResolver(),resolveTotalRowCells:e.features.totalRow?.createTotalRowCellsResolver()??f.createInertTotalRowCellsResolver(),serverSideQueryStore:N,dateRollover:j,autoSizeOnData:H,imeInput:U,detailIndexCache:t.createDetailIndexCacheHolder(),detailKeysPruner:t.createDetailKeysPruner(),dispose:()=>{P.dispose(),F.dispose(),I.dispose(),L.dispose(),R.dispose(),z.dispose(),B.dispose(),V.dispose(),N.dispose(),j.dispose(),U.dispose()}}};exports.SERVER_SIDE_QUERY_DEBOUNCE_MS=v,exports.createGridEngine=C;
|
|
@@ -7,6 +7,7 @@ import { type ActiveRowFollowController } from '../controllers/activeRowFollowCo
|
|
|
7
7
|
import type { ChangeHighlightController } from '../controllers/changeHighlightController.js';
|
|
8
8
|
import type { SaveStatusController } from '../controllers/saveStatusController.js';
|
|
9
9
|
import type { FindController } from '../controllers/findController.js';
|
|
10
|
+
import type { FindReplaceController } from '../controllers/findReplaceController.js';
|
|
10
11
|
import type { ChangeTracker } from '../controllers/changeTracker.js';
|
|
11
12
|
import type { ExcelShortcutCommands } from './excelShortcutCommands.js';
|
|
12
13
|
import type { NewRowController } from './newRowController.js';
|
|
@@ -59,6 +60,7 @@ export type GridEngine<T> = {
|
|
|
59
60
|
changeHighlight: ChangeHighlightController<T>;
|
|
60
61
|
saveStatus: SaveStatusController;
|
|
61
62
|
find: FindController<T>;
|
|
63
|
+
findReplace: FindReplaceController<T>;
|
|
62
64
|
changeTracker: ChangeTracker<T>;
|
|
63
65
|
excelShortcuts: ExcelShortcutCommands<T>;
|
|
64
66
|
newRow: NewRowController<T>;
|