@ricsam/formula-engine 0.2.7 → 0.2.9
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/README.md +1 -3
- package/dist/cjs/core/engine.cjs +518 -149
- package/dist/cjs/core/engine.cjs.map +3 -3
- package/dist/cjs/core/managers/dependency-manager.cjs.map +2 -2
- package/dist/cjs/core/managers/evaluation-manager.cjs.map +1 -1
- package/dist/cjs/core/mutation-invalidation.cjs +241 -0
- package/dist/cjs/core/mutation-invalidation.cjs.map +10 -0
- package/dist/cjs/lib.cjs +2 -13
- package/dist/cjs/lib.cjs.map +3 -3
- package/dist/cjs/package.json +1 -1
- package/dist/mjs/core/engine.mjs +532 -190
- package/dist/mjs/core/engine.mjs.map +3 -3
- package/dist/mjs/core/managers/dependency-manager.mjs.map +2 -2
- package/dist/mjs/core/managers/evaluation-manager.mjs.map +1 -1
- package/dist/mjs/core/mutation-invalidation.mjs +201 -0
- package/dist/mjs/core/mutation-invalidation.mjs.map +10 -0
- package/dist/mjs/lib.mjs +2 -13
- package/dist/mjs/lib.mjs.map +3 -3
- package/dist/mjs/package.json +1 -1
- package/dist/types/core/engine.d.ts +17 -116
- package/dist/types/core/managers/dependency-manager.d.ts +1 -1
- package/dist/types/core/managers/evaluation-manager.d.ts +1 -1
- package/dist/types/core/mutation-invalidation.d.ts +46 -0
- package/dist/types/lib.d.ts +0 -8
- package/package.json +1 -1
- package/dist/cjs/core/commands/command-executor.cjs +0 -149
- package/dist/cjs/core/commands/command-executor.cjs.map +0 -10
- package/dist/cjs/core/commands/content-commands.cjs +0 -857
- package/dist/cjs/core/commands/content-commands.cjs.map +0 -10
- package/dist/cjs/core/commands/metadata-commands.cjs +0 -160
- package/dist/cjs/core/commands/metadata-commands.cjs.map +0 -10
- package/dist/cjs/core/commands/named-expression-commands.cjs +0 -363
- package/dist/cjs/core/commands/named-expression-commands.cjs.map +0 -10
- package/dist/cjs/core/commands/structure-commands.cjs +0 -696
- package/dist/cjs/core/commands/structure-commands.cjs.map +0 -10
- package/dist/cjs/core/commands/style-commands.cjs +0 -229
- package/dist/cjs/core/commands/style-commands.cjs.map +0 -10
- package/dist/cjs/core/commands/table-commands.cjs +0 -495
- package/dist/cjs/core/commands/table-commands.cjs.map +0 -10
- package/dist/cjs/core/commands/types.cjs +0 -99
- package/dist/cjs/core/commands/types.cjs.map +0 -10
- package/dist/cjs/core/managers/schema-manager.cjs +0 -374
- package/dist/cjs/core/managers/schema-manager.cjs.map +0 -10
- package/dist/cjs/core/schema/cell-orm.cjs +0 -76
- package/dist/cjs/core/schema/cell-orm.cjs.map +0 -10
- package/dist/cjs/core/schema/grid-orm.cjs +0 -125
- package/dist/cjs/core/schema/grid-orm.cjs.map +0 -10
- package/dist/cjs/core/schema/schema-builder.cjs +0 -74
- package/dist/cjs/core/schema/schema-builder.cjs.map +0 -10
- package/dist/cjs/core/schema/schema-helpers.cjs +0 -200
- package/dist/cjs/core/schema/schema-helpers.cjs.map +0 -10
- package/dist/cjs/core/schema/schema.cjs +0 -91
- package/dist/cjs/core/schema/schema.cjs.map +0 -10
- package/dist/cjs/core/schema/table-orm.cjs +0 -189
- package/dist/cjs/core/schema/table-orm.cjs.map +0 -10
- package/dist/mjs/core/commands/command-executor.mjs +0 -109
- package/dist/mjs/core/commands/command-executor.mjs.map +0 -10
- package/dist/mjs/core/commands/content-commands.mjs +0 -821
- package/dist/mjs/core/commands/content-commands.mjs.map +0 -10
- package/dist/mjs/core/commands/metadata-commands.mjs +0 -120
- package/dist/mjs/core/commands/metadata-commands.mjs.map +0 -10
- package/dist/mjs/core/commands/named-expression-commands.mjs +0 -323
- package/dist/mjs/core/commands/named-expression-commands.mjs.map +0 -10
- package/dist/mjs/core/commands/structure-commands.mjs +0 -661
- package/dist/mjs/core/commands/structure-commands.mjs.map +0 -10
- package/dist/mjs/core/commands/style-commands.mjs +0 -189
- package/dist/mjs/core/commands/style-commands.mjs.map +0 -10
- package/dist/mjs/core/commands/table-commands.mjs +0 -459
- package/dist/mjs/core/commands/table-commands.mjs.map +0 -10
- package/dist/mjs/core/commands/types.mjs +0 -59
- package/dist/mjs/core/commands/types.mjs.map +0 -10
- package/dist/mjs/core/managers/schema-manager.mjs +0 -334
- package/dist/mjs/core/managers/schema-manager.mjs.map +0 -10
- package/dist/mjs/core/schema/cell-orm.mjs +0 -35
- package/dist/mjs/core/schema/cell-orm.mjs.map +0 -10
- package/dist/mjs/core/schema/grid-orm.mjs +0 -84
- package/dist/mjs/core/schema/grid-orm.mjs.map +0 -10
- package/dist/mjs/core/schema/schema-builder.mjs +0 -34
- package/dist/mjs/core/schema/schema-builder.mjs.map +0 -10
- package/dist/mjs/core/schema/schema-helpers.mjs +0 -160
- package/dist/mjs/core/schema/schema-helpers.mjs.map +0 -10
- package/dist/mjs/core/schema/schema.mjs +0 -51
- package/dist/mjs/core/schema/schema.mjs.map +0 -10
- package/dist/mjs/core/schema/table-orm.mjs +0 -156
- package/dist/mjs/core/schema/table-orm.mjs.map +0 -10
- package/dist/types/core/commands/command-executor.d.ts +0 -81
- package/dist/types/core/commands/content-commands.d.ts +0 -172
- package/dist/types/core/commands/metadata-commands.d.ts +0 -55
- package/dist/types/core/commands/named-expression-commands.d.ts +0 -130
- package/dist/types/core/commands/structure-commands.d.ts +0 -155
- package/dist/types/core/commands/style-commands.d.ts +0 -76
- package/dist/types/core/commands/table-commands.d.ts +0 -119
- package/dist/types/core/commands/types.d.ts +0 -143
- package/dist/types/core/managers/schema-manager.d.ts +0 -142
- package/dist/types/core/schema/cell-orm.d.ts +0 -33
- package/dist/types/core/schema/grid-orm.d.ts +0 -63
- package/dist/types/core/schema/schema-builder.d.ts +0 -16
- package/dist/types/core/schema/schema-helpers.d.ts +0 -49
- package/dist/types/core/schema/schema.d.ts +0 -167
- package/dist/types/core/schema/schema.type-test.d.ts +0 -1
- package/dist/types/core/schema/table-orm.d.ts +0 -46
|
@@ -1,459 +0,0 @@
|
|
|
1
|
-
// src/core/commands/table-commands.ts
|
|
2
|
-
import {
|
|
3
|
-
ActionTypes,
|
|
4
|
-
emptyMutationInvalidation,
|
|
5
|
-
getSerializedCellValueKind
|
|
6
|
-
} from "./types.mjs";
|
|
7
|
-
import { getTableResourceKey } from "../resource-keys.mjs";
|
|
8
|
-
import { parseCellReference } from "../utils.mjs";
|
|
9
|
-
function getAddressKey(address) {
|
|
10
|
-
return `${address.workbookName}:${address.sheetName}:${address.rowIndex}:${address.colIndex}`;
|
|
11
|
-
}
|
|
12
|
-
function collectTableFootprintCells(workbookManager, table) {
|
|
13
|
-
const cells = new Map;
|
|
14
|
-
const sheet = workbookManager.getSheet({
|
|
15
|
-
workbookName: table.workbookName,
|
|
16
|
-
sheetName: table.sheetName
|
|
17
|
-
});
|
|
18
|
-
if (!sheet) {
|
|
19
|
-
return [];
|
|
20
|
-
}
|
|
21
|
-
const startColIndex = table.start.colIndex;
|
|
22
|
-
const endColIndex = startColIndex + table.headers.size - 1;
|
|
23
|
-
if (table.endRow.type === "number") {
|
|
24
|
-
for (let rowIndex = table.start.rowIndex;rowIndex <= table.endRow.value; rowIndex++) {
|
|
25
|
-
for (let colIndex = startColIndex;colIndex <= endColIndex; colIndex++) {
|
|
26
|
-
const address = {
|
|
27
|
-
workbookName: table.workbookName,
|
|
28
|
-
sheetName: table.sheetName,
|
|
29
|
-
rowIndex,
|
|
30
|
-
colIndex
|
|
31
|
-
};
|
|
32
|
-
cells.set(getAddressKey(address), {
|
|
33
|
-
address,
|
|
34
|
-
content: workbookManager.getCellContent(address)
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return Array.from(cells.values());
|
|
39
|
-
}
|
|
40
|
-
for (const [ref, content] of sheet.content.entries()) {
|
|
41
|
-
const { rowIndex, colIndex } = parseCellReference(ref);
|
|
42
|
-
if (rowIndex < table.start.rowIndex) {
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
if (colIndex < startColIndex || colIndex > endColIndex) {
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
const address = {
|
|
49
|
-
workbookName: table.workbookName,
|
|
50
|
-
sheetName: table.sheetName,
|
|
51
|
-
rowIndex,
|
|
52
|
-
colIndex
|
|
53
|
-
};
|
|
54
|
-
cells.set(getAddressKey(address), {
|
|
55
|
-
address,
|
|
56
|
-
content
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
return Array.from(cells.values());
|
|
60
|
-
}
|
|
61
|
-
function buildTableTouchedCells(workbookManager, tables) {
|
|
62
|
-
const touchedCells = new Map;
|
|
63
|
-
for (const table of tables) {
|
|
64
|
-
if (!table) {
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
for (const cell of collectTableFootprintCells(workbookManager, table)) {
|
|
68
|
-
touchedCells.set(getAddressKey(cell.address), {
|
|
69
|
-
address: cell.address,
|
|
70
|
-
beforeKind: getSerializedCellValueKind(cell.content),
|
|
71
|
-
afterKind: getSerializedCellValueKind(cell.content)
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return Array.from(touchedCells.values());
|
|
76
|
-
}
|
|
77
|
-
function buildTableContextChangedCells(workbookManager, tables) {
|
|
78
|
-
const changedCells = new Map;
|
|
79
|
-
for (const table of tables) {
|
|
80
|
-
if (!table) {
|
|
81
|
-
continue;
|
|
82
|
-
}
|
|
83
|
-
for (const cell of collectTableFootprintCells(workbookManager, table)) {
|
|
84
|
-
changedCells.set(getAddressKey(cell.address), cell.address);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return Array.from(changedCells.values());
|
|
88
|
-
}
|
|
89
|
-
function mergeTouchedCells(...groups) {
|
|
90
|
-
const precedence = {
|
|
91
|
-
empty: 0,
|
|
92
|
-
scalar: 1,
|
|
93
|
-
formula: 2
|
|
94
|
-
};
|
|
95
|
-
const merged = new Map;
|
|
96
|
-
for (const group of groups) {
|
|
97
|
-
for (const touchedCell of group) {
|
|
98
|
-
const key = getAddressKey(touchedCell.address);
|
|
99
|
-
const existing = merged.get(key);
|
|
100
|
-
if (!existing) {
|
|
101
|
-
merged.set(key, touchedCell);
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
merged.set(key, {
|
|
105
|
-
address: touchedCell.address,
|
|
106
|
-
beforeKind: precedence[touchedCell.beforeKind] >= precedence[existing.beforeKind] ? touchedCell.beforeKind : existing.beforeKind,
|
|
107
|
-
afterKind: precedence[touchedCell.afterKind] >= precedence[existing.afterKind] ? touchedCell.afterKind : existing.afterKind
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return Array.from(merged.values());
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
class AddTableCommand {
|
|
115
|
-
deps;
|
|
116
|
-
props;
|
|
117
|
-
requiresReevaluation = true;
|
|
118
|
-
executeFootprint = emptyMutationInvalidation();
|
|
119
|
-
undoFootprint = emptyMutationInvalidation();
|
|
120
|
-
constructor(deps, props) {
|
|
121
|
-
this.deps = deps;
|
|
122
|
-
this.props = props;
|
|
123
|
-
}
|
|
124
|
-
execute() {
|
|
125
|
-
const table = this.deps.tableManager.addTable({
|
|
126
|
-
...this.props,
|
|
127
|
-
getCellValue: this.deps.getCellValue
|
|
128
|
-
});
|
|
129
|
-
const resourceKey = getTableResourceKey({
|
|
130
|
-
workbookName: this.props.workbookName,
|
|
131
|
-
tableName: this.props.tableName
|
|
132
|
-
});
|
|
133
|
-
this.executeFootprint = {
|
|
134
|
-
touchedCells: buildTableTouchedCells(this.deps.workbookManager, [table]),
|
|
135
|
-
tableContextChangedCells: buildTableContextChangedCells(this.deps.workbookManager, [table]),
|
|
136
|
-
resourceKeys: [resourceKey]
|
|
137
|
-
};
|
|
138
|
-
this.undoFootprint = this.executeFootprint;
|
|
139
|
-
}
|
|
140
|
-
undo() {
|
|
141
|
-
this.deps.tableManager.removeTable({
|
|
142
|
-
workbookName: this.props.workbookName,
|
|
143
|
-
tableName: this.props.tableName
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
getInvalidationFootprint(phase) {
|
|
147
|
-
return phase === "execute" ? this.executeFootprint : this.undoFootprint;
|
|
148
|
-
}
|
|
149
|
-
toAction() {
|
|
150
|
-
return {
|
|
151
|
-
type: ActionTypes.ADD_TABLE,
|
|
152
|
-
payload: this.props
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
class RemoveTableCommand {
|
|
158
|
-
deps;
|
|
159
|
-
opts;
|
|
160
|
-
requiresReevaluation = true;
|
|
161
|
-
removedTable;
|
|
162
|
-
executeFootprint = emptyMutationInvalidation();
|
|
163
|
-
undoFootprint = emptyMutationInvalidation();
|
|
164
|
-
constructor(deps, opts) {
|
|
165
|
-
this.deps = deps;
|
|
166
|
-
this.opts = opts;
|
|
167
|
-
}
|
|
168
|
-
execute() {
|
|
169
|
-
this.removedTable = this.deps.tableManager.getTable({
|
|
170
|
-
workbookName: this.opts.workbookName,
|
|
171
|
-
name: this.opts.tableName
|
|
172
|
-
});
|
|
173
|
-
this.deps.tableManager.removeTable(this.opts);
|
|
174
|
-
const resourceKey = getTableResourceKey({
|
|
175
|
-
workbookName: this.opts.workbookName,
|
|
176
|
-
tableName: this.opts.tableName
|
|
177
|
-
});
|
|
178
|
-
this.executeFootprint = {
|
|
179
|
-
touchedCells: buildTableTouchedCells(this.deps.workbookManager, [
|
|
180
|
-
this.removedTable
|
|
181
|
-
]),
|
|
182
|
-
tableContextChangedCells: buildTableContextChangedCells(this.deps.workbookManager, [this.removedTable]),
|
|
183
|
-
resourceKeys: [resourceKey]
|
|
184
|
-
};
|
|
185
|
-
this.undoFootprint = this.executeFootprint;
|
|
186
|
-
}
|
|
187
|
-
undo() {
|
|
188
|
-
if (!this.removedTable)
|
|
189
|
-
return;
|
|
190
|
-
const { start, endRow, headers, sheetName } = this.removedTable;
|
|
191
|
-
const startRef = `${String.fromCharCode(65 + start.colIndex)}${start.rowIndex + 1}`;
|
|
192
|
-
this.deps.tableManager.addTable({
|
|
193
|
-
workbookName: this.opts.workbookName,
|
|
194
|
-
tableName: this.opts.tableName,
|
|
195
|
-
sheetName,
|
|
196
|
-
start: startRef,
|
|
197
|
-
numRows: endRow,
|
|
198
|
-
numCols: headers.size,
|
|
199
|
-
getCellValue: this.deps.getCellValue
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
getInvalidationFootprint(phase) {
|
|
203
|
-
return phase === "execute" ? this.executeFootprint : this.undoFootprint;
|
|
204
|
-
}
|
|
205
|
-
toAction() {
|
|
206
|
-
return {
|
|
207
|
-
type: ActionTypes.REMOVE_TABLE,
|
|
208
|
-
payload: this.opts
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
class RenameTableCommand {
|
|
214
|
-
deps;
|
|
215
|
-
workbookName;
|
|
216
|
-
oldName;
|
|
217
|
-
newName;
|
|
218
|
-
requiresReevaluation = true;
|
|
219
|
-
executeFootprint = emptyMutationInvalidation();
|
|
220
|
-
undoFootprint = emptyMutationInvalidation();
|
|
221
|
-
constructor(deps, workbookName, oldName, newName) {
|
|
222
|
-
this.deps = deps;
|
|
223
|
-
this.workbookName = workbookName;
|
|
224
|
-
this.oldName = oldName;
|
|
225
|
-
this.newName = newName;
|
|
226
|
-
}
|
|
227
|
-
execute() {
|
|
228
|
-
const previousTable = this.deps.tableManager.getTable({
|
|
229
|
-
workbookName: this.workbookName,
|
|
230
|
-
name: this.oldName
|
|
231
|
-
});
|
|
232
|
-
this.deps.tableManager.renameTable(this.workbookName, {
|
|
233
|
-
oldName: this.oldName,
|
|
234
|
-
newName: this.newName
|
|
235
|
-
});
|
|
236
|
-
const changedCells = this.deps.workbookManager.updateAllFormulas((formula) => this.deps.renameTableInFormula(formula, this.oldName, this.newName));
|
|
237
|
-
const changedNamedExpressions = this.deps.namedExpressionManager.updateAllNamedExpressions((formula) => this.deps.renameTableInFormula(formula, this.oldName, this.newName));
|
|
238
|
-
this.deps.apiSchemaManager.updateForTableRename(this.workbookName, this.oldName, this.newName);
|
|
239
|
-
const renamedTable = this.deps.tableManager.getTable({
|
|
240
|
-
workbookName: this.workbookName,
|
|
241
|
-
name: this.newName
|
|
242
|
-
});
|
|
243
|
-
this.executeFootprint = {
|
|
244
|
-
touchedCells: mergeTouchedCells(buildTableTouchedCells(this.deps.workbookManager, [
|
|
245
|
-
previousTable,
|
|
246
|
-
renamedTable
|
|
247
|
-
]), changedCells.map((address) => ({
|
|
248
|
-
address,
|
|
249
|
-
beforeKind: "formula",
|
|
250
|
-
afterKind: "formula"
|
|
251
|
-
}))),
|
|
252
|
-
tableContextChangedCells: buildTableContextChangedCells(this.deps.workbookManager, [previousTable, renamedTable]),
|
|
253
|
-
resourceKeys: [
|
|
254
|
-
getTableResourceKey({
|
|
255
|
-
workbookName: this.workbookName,
|
|
256
|
-
tableName: this.oldName
|
|
257
|
-
}),
|
|
258
|
-
getTableResourceKey({
|
|
259
|
-
workbookName: this.workbookName,
|
|
260
|
-
tableName: this.newName
|
|
261
|
-
}),
|
|
262
|
-
...changedNamedExpressions
|
|
263
|
-
]
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
undo() {
|
|
267
|
-
const currentTable = this.deps.tableManager.getTable({
|
|
268
|
-
workbookName: this.workbookName,
|
|
269
|
-
name: this.newName
|
|
270
|
-
});
|
|
271
|
-
this.deps.tableManager.renameTable(this.workbookName, {
|
|
272
|
-
oldName: this.newName,
|
|
273
|
-
newName: this.oldName
|
|
274
|
-
});
|
|
275
|
-
const changedCells = this.deps.workbookManager.updateAllFormulas((formula) => this.deps.renameTableInFormula(formula, this.newName, this.oldName));
|
|
276
|
-
const changedNamedExpressions = this.deps.namedExpressionManager.updateAllNamedExpressions((formula) => this.deps.renameTableInFormula(formula, this.newName, this.oldName));
|
|
277
|
-
this.deps.apiSchemaManager.updateForTableRename(this.workbookName, this.newName, this.oldName);
|
|
278
|
-
const restoredTable = this.deps.tableManager.getTable({
|
|
279
|
-
workbookName: this.workbookName,
|
|
280
|
-
name: this.oldName
|
|
281
|
-
});
|
|
282
|
-
this.undoFootprint = {
|
|
283
|
-
touchedCells: mergeTouchedCells(buildTableTouchedCells(this.deps.workbookManager, [
|
|
284
|
-
currentTable,
|
|
285
|
-
restoredTable
|
|
286
|
-
]), changedCells.map((address) => ({
|
|
287
|
-
address,
|
|
288
|
-
beforeKind: "formula",
|
|
289
|
-
afterKind: "formula"
|
|
290
|
-
}))),
|
|
291
|
-
tableContextChangedCells: buildTableContextChangedCells(this.deps.workbookManager, [currentTable, restoredTable]),
|
|
292
|
-
resourceKeys: [
|
|
293
|
-
getTableResourceKey({
|
|
294
|
-
workbookName: this.workbookName,
|
|
295
|
-
tableName: this.oldName
|
|
296
|
-
}),
|
|
297
|
-
getTableResourceKey({
|
|
298
|
-
workbookName: this.workbookName,
|
|
299
|
-
tableName: this.newName
|
|
300
|
-
}),
|
|
301
|
-
...changedNamedExpressions
|
|
302
|
-
]
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
getInvalidationFootprint(phase) {
|
|
306
|
-
return phase === "execute" ? this.executeFootprint : this.undoFootprint;
|
|
307
|
-
}
|
|
308
|
-
toAction() {
|
|
309
|
-
return {
|
|
310
|
-
type: ActionTypes.RENAME_TABLE,
|
|
311
|
-
payload: {
|
|
312
|
-
workbookName: this.workbookName,
|
|
313
|
-
oldName: this.oldName,
|
|
314
|
-
newName: this.newName
|
|
315
|
-
}
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
class UpdateTableCommand {
|
|
321
|
-
deps;
|
|
322
|
-
opts;
|
|
323
|
-
requiresReevaluation = true;
|
|
324
|
-
previousTable;
|
|
325
|
-
executeFootprint = emptyMutationInvalidation();
|
|
326
|
-
undoFootprint = emptyMutationInvalidation();
|
|
327
|
-
constructor(deps, opts) {
|
|
328
|
-
this.deps = deps;
|
|
329
|
-
this.opts = opts;
|
|
330
|
-
}
|
|
331
|
-
execute() {
|
|
332
|
-
this.previousTable = this.deps.tableManager.getTable({
|
|
333
|
-
workbookName: this.opts.workbookName,
|
|
334
|
-
name: this.opts.tableName
|
|
335
|
-
});
|
|
336
|
-
this.deps.tableManager.updateTable({
|
|
337
|
-
...this.opts,
|
|
338
|
-
getCellValue: this.deps.getCellValue
|
|
339
|
-
});
|
|
340
|
-
const resourceKey = getTableResourceKey({
|
|
341
|
-
workbookName: this.opts.workbookName,
|
|
342
|
-
tableName: this.opts.tableName
|
|
343
|
-
});
|
|
344
|
-
const nextTable = this.deps.tableManager.getTable({
|
|
345
|
-
workbookName: this.opts.workbookName,
|
|
346
|
-
name: this.opts.tableName
|
|
347
|
-
});
|
|
348
|
-
this.executeFootprint = {
|
|
349
|
-
touchedCells: buildTableTouchedCells(this.deps.workbookManager, [
|
|
350
|
-
this.previousTable,
|
|
351
|
-
nextTable
|
|
352
|
-
]),
|
|
353
|
-
tableContextChangedCells: buildTableContextChangedCells(this.deps.workbookManager, [this.previousTable, nextTable]),
|
|
354
|
-
resourceKeys: [resourceKey]
|
|
355
|
-
};
|
|
356
|
-
this.undoFootprint = this.executeFootprint;
|
|
357
|
-
}
|
|
358
|
-
undo() {
|
|
359
|
-
if (!this.previousTable)
|
|
360
|
-
return;
|
|
361
|
-
const { start, endRow, headers, sheetName } = this.previousTable;
|
|
362
|
-
const startRef = `${String.fromCharCode(65 + start.colIndex)}${start.rowIndex + 1}`;
|
|
363
|
-
this.deps.tableManager.updateTable({
|
|
364
|
-
workbookName: this.opts.workbookName,
|
|
365
|
-
tableName: this.opts.tableName,
|
|
366
|
-
sheetName,
|
|
367
|
-
start: startRef,
|
|
368
|
-
numRows: endRow,
|
|
369
|
-
numCols: headers.size,
|
|
370
|
-
getCellValue: this.deps.getCellValue
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
getInvalidationFootprint(phase) {
|
|
374
|
-
return phase === "execute" ? this.executeFootprint : this.undoFootprint;
|
|
375
|
-
}
|
|
376
|
-
toAction() {
|
|
377
|
-
return {
|
|
378
|
-
type: ActionTypes.UPDATE_TABLE,
|
|
379
|
-
payload: this.opts
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
class ResetTablesCommand {
|
|
385
|
-
deps;
|
|
386
|
-
newTables;
|
|
387
|
-
requiresReevaluation = true;
|
|
388
|
-
previousTables;
|
|
389
|
-
executeFootprint = emptyMutationInvalidation();
|
|
390
|
-
undoFootprint = emptyMutationInvalidation();
|
|
391
|
-
constructor(deps, newTables) {
|
|
392
|
-
this.deps = deps;
|
|
393
|
-
this.newTables = newTables;
|
|
394
|
-
}
|
|
395
|
-
execute() {
|
|
396
|
-
this.previousTables = new Map;
|
|
397
|
-
for (const [workbookName, tables] of this.deps.tableManager.tables) {
|
|
398
|
-
this.previousTables.set(workbookName, new Map(tables));
|
|
399
|
-
}
|
|
400
|
-
this.deps.tableManager.resetTables(this.newTables);
|
|
401
|
-
const resourceKeys = new Set;
|
|
402
|
-
for (const [workbookName, tables] of this.previousTables ?? []) {
|
|
403
|
-
for (const tableName of tables.keys()) {
|
|
404
|
-
resourceKeys.add(getTableResourceKey({
|
|
405
|
-
workbookName,
|
|
406
|
-
tableName
|
|
407
|
-
}));
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
for (const [workbookName, tables] of this.newTables) {
|
|
411
|
-
for (const tableName of tables.keys()) {
|
|
412
|
-
resourceKeys.add(getTableResourceKey({
|
|
413
|
-
workbookName,
|
|
414
|
-
tableName
|
|
415
|
-
}));
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
this.executeFootprint = {
|
|
419
|
-
touchedCells: buildTableTouchedCells(this.deps.workbookManager, [
|
|
420
|
-
...Array.from(this.previousTables?.values() ?? []).flatMap((tables) => Array.from(tables.values())),
|
|
421
|
-
...Array.from(this.newTables.values()).flatMap((tables) => Array.from(tables.values()))
|
|
422
|
-
]),
|
|
423
|
-
tableContextChangedCells: buildTableContextChangedCells(this.deps.workbookManager, [
|
|
424
|
-
...Array.from(this.previousTables?.values() ?? []).flatMap((tables) => Array.from(tables.values())),
|
|
425
|
-
...Array.from(this.newTables.values()).flatMap((tables) => Array.from(tables.values()))
|
|
426
|
-
]),
|
|
427
|
-
resourceKeys: Array.from(resourceKeys)
|
|
428
|
-
};
|
|
429
|
-
this.undoFootprint = this.executeFootprint;
|
|
430
|
-
}
|
|
431
|
-
undo() {
|
|
432
|
-
if (!this.previousTables)
|
|
433
|
-
return;
|
|
434
|
-
this.deps.tableManager.resetTables(this.previousTables);
|
|
435
|
-
}
|
|
436
|
-
getInvalidationFootprint(phase) {
|
|
437
|
-
return phase === "execute" ? this.executeFootprint : this.undoFootprint;
|
|
438
|
-
}
|
|
439
|
-
toAction() {
|
|
440
|
-
return {
|
|
441
|
-
type: ActionTypes.RESET_TABLES,
|
|
442
|
-
payload: {
|
|
443
|
-
tables: Array.from(this.newTables.entries()).map(([wb, tables]) => [
|
|
444
|
-
wb,
|
|
445
|
-
Array.from(tables.entries())
|
|
446
|
-
])
|
|
447
|
-
}
|
|
448
|
-
};
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
export {
|
|
452
|
-
UpdateTableCommand,
|
|
453
|
-
ResetTablesCommand,
|
|
454
|
-
RenameTableCommand,
|
|
455
|
-
RemoveTableCommand,
|
|
456
|
-
AddTableCommand
|
|
457
|
-
};
|
|
458
|
-
|
|
459
|
-
//# debugId=C2645E9937E12DCB64756E2164756E21
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/core/commands/table-commands.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"/**\n * Table Commands - Commands that modify table definitions\n *\n * These commands all require re-evaluation after execution.\n */\n\nimport type { TableManager } from \"../managers/table-manager.mjs\";\nimport type { NamedExpressionManager } from \"../managers/named-expression-manager.mjs\";\nimport type { WorkbookManager } from \"../managers/workbook-manager.mjs\";\nimport type { SchemaManager } from \"../managers/schema-manager.mjs\";\nimport type {\n CellAddress,\n SerializedCellValue,\n SpreadsheetRangeEnd,\n TableDefinition,\n} from \"../types.mjs\";\nimport type {\n EngineCommand,\n EngineAction,\n MutationInvalidation,\n} from \"./types.mjs\";\nimport {\n ActionTypes,\n emptyMutationInvalidation,\n getSerializedCellValueKind,\n} from \"./types.mjs\";\nimport { getTableResourceKey } from \"../resource-keys.mjs\";\nimport { parseCellReference } from \"../utils.mjs\";\n\nfunction getAddressKey(address: CellAddress): string {\n return `${address.workbookName}:${address.sheetName}:${address.rowIndex}:${address.colIndex}`;\n}\n\nfunction collectTableFootprintCells(\n workbookManager: WorkbookManager,\n table: TableDefinition\n): Array<{\n address: CellAddress;\n content: SerializedCellValue | undefined;\n}> {\n const cells = new Map<\n string,\n {\n address: CellAddress;\n content: SerializedCellValue | undefined;\n }\n >();\n const sheet = workbookManager.getSheet({\n workbookName: table.workbookName,\n sheetName: table.sheetName,\n });\n if (!sheet) {\n return [];\n }\n\n const startColIndex = table.start.colIndex;\n const endColIndex = startColIndex + table.headers.size - 1;\n\n if (table.endRow.type === \"number\") {\n for (let rowIndex = table.start.rowIndex; rowIndex <= table.endRow.value; rowIndex++) {\n for (let colIndex = startColIndex; colIndex <= endColIndex; colIndex++) {\n const address = {\n workbookName: table.workbookName,\n sheetName: table.sheetName,\n rowIndex,\n colIndex,\n };\n cells.set(getAddressKey(address), {\n address,\n content: workbookManager.getCellContent(address),\n });\n }\n }\n return Array.from(cells.values());\n }\n\n for (const [ref, content] of sheet.content.entries()) {\n const { rowIndex, colIndex } = parseCellReference(ref);\n if (rowIndex < table.start.rowIndex) {\n continue;\n }\n if (colIndex < startColIndex || colIndex > endColIndex) {\n continue;\n }\n\n const address = {\n workbookName: table.workbookName,\n sheetName: table.sheetName,\n rowIndex,\n colIndex,\n };\n cells.set(getAddressKey(address), {\n address,\n content,\n });\n }\n\n return Array.from(cells.values());\n}\n\nfunction buildTableTouchedCells(\n workbookManager: WorkbookManager,\n tables: Array<TableDefinition | undefined>\n): MutationInvalidation[\"touchedCells\"] {\n const touchedCells = new Map<\n string,\n {\n address: CellAddress;\n beforeKind: ReturnType<typeof getSerializedCellValueKind>;\n afterKind: ReturnType<typeof getSerializedCellValueKind>;\n }\n >();\n\n for (const table of tables) {\n if (!table) {\n continue;\n }\n for (const cell of collectTableFootprintCells(workbookManager, table)) {\n touchedCells.set(getAddressKey(cell.address), {\n address: cell.address,\n beforeKind: getSerializedCellValueKind(cell.content),\n afterKind: getSerializedCellValueKind(cell.content),\n });\n }\n }\n\n return Array.from(touchedCells.values());\n}\n\nfunction buildTableContextChangedCells(\n workbookManager: WorkbookManager,\n tables: Array<TableDefinition | undefined>\n): CellAddress[] {\n const changedCells = new Map<string, CellAddress>();\n\n for (const table of tables) {\n if (!table) {\n continue;\n }\n for (const cell of collectTableFootprintCells(workbookManager, table)) {\n changedCells.set(getAddressKey(cell.address), cell.address);\n }\n }\n\n return Array.from(changedCells.values());\n}\n\nfunction mergeTouchedCells(\n ...groups: MutationInvalidation[\"touchedCells\"][]\n): MutationInvalidation[\"touchedCells\"] {\n const precedence = {\n empty: 0,\n scalar: 1,\n formula: 2,\n } as const;\n const merged = new Map<\n string,\n MutationInvalidation[\"touchedCells\"][number]\n >();\n\n for (const group of groups) {\n for (const touchedCell of group) {\n const key = getAddressKey(touchedCell.address);\n const existing = merged.get(key);\n if (!existing) {\n merged.set(key, touchedCell);\n continue;\n }\n\n merged.set(key, {\n address: touchedCell.address,\n beforeKind:\n precedence[touchedCell.beforeKind] >= precedence[existing.beforeKind]\n ? touchedCell.beforeKind\n : existing.beforeKind,\n afterKind:\n precedence[touchedCell.afterKind] >= precedence[existing.afterKind]\n ? touchedCell.afterKind\n : existing.afterKind,\n });\n }\n }\n\n return Array.from(merged.values());\n}\n\n/**\n * Dependencies needed for table commands.\n */\nexport interface TableCommandDeps {\n tableManager: TableManager;\n namedExpressionManager: NamedExpressionManager;\n workbookManager: WorkbookManager;\n apiSchemaManager: SchemaManager;\n getCellValue: (cellAddress: CellAddress) => SerializedCellValue;\n renameTableInFormula: (\n formula: string,\n oldName: string,\n newName: string\n ) => string;\n}\n\n/**\n * Command to add a table.\n */\nexport class AddTableCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\n\n constructor(\n private deps: TableCommandDeps,\n private props: {\n tableName: string;\n sheetName: string;\n workbookName: string;\n start: string;\n numRows: SpreadsheetRangeEnd;\n numCols: number;\n }\n ) {}\n\n execute(): void {\n const table = this.deps.tableManager.addTable({\n ...this.props,\n getCellValue: this.deps.getCellValue,\n });\n const resourceKey = getTableResourceKey({\n workbookName: this.props.workbookName,\n tableName: this.props.tableName,\n });\n this.executeFootprint = {\n touchedCells: buildTableTouchedCells(this.deps.workbookManager, [table]),\n tableContextChangedCells: buildTableContextChangedCells(\n this.deps.workbookManager,\n [table]\n ),\n resourceKeys: [resourceKey],\n };\n this.undoFootprint = this.executeFootprint;\n }\n\n undo(): void {\n this.deps.tableManager.removeTable({\n workbookName: this.props.workbookName,\n tableName: this.props.tableName,\n });\n }\n\n getInvalidationFootprint(phase: \"execute\" | \"undo\"): MutationInvalidation {\n return phase === \"execute\" ? this.executeFootprint : this.undoFootprint;\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.ADD_TABLE,\n payload: this.props,\n };\n }\n}\n\n/**\n * Command to remove a table.\n */\nexport class RemoveTableCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private removedTable: TableDefinition | undefined;\n private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\n\n constructor(\n private deps: TableCommandDeps,\n private opts: { tableName: string; workbookName: string }\n ) {}\n\n execute(): void {\n // Capture table before removal\n this.removedTable = this.deps.tableManager.getTable({\n workbookName: this.opts.workbookName,\n name: this.opts.tableName,\n });\n\n this.deps.tableManager.removeTable(this.opts);\n const resourceKey = getTableResourceKey({\n workbookName: this.opts.workbookName,\n tableName: this.opts.tableName,\n });\n this.executeFootprint = {\n touchedCells: buildTableTouchedCells(this.deps.workbookManager, [\n this.removedTable,\n ]),\n tableContextChangedCells: buildTableContextChangedCells(\n this.deps.workbookManager,\n [this.removedTable]\n ),\n resourceKeys: [resourceKey],\n };\n this.undoFootprint = this.executeFootprint;\n }\n\n undo(): void {\n if (!this.removedTable) return;\n\n // Recreate the table\n const { start, endRow, headers, sheetName } = this.removedTable;\n const startRef = `${String.fromCharCode(65 + start.colIndex)}${start.rowIndex + 1}`;\n\n this.deps.tableManager.addTable({\n workbookName: this.opts.workbookName,\n tableName: this.opts.tableName,\n sheetName,\n start: startRef,\n numRows: endRow,\n numCols: headers.size,\n getCellValue: this.deps.getCellValue,\n });\n }\n\n getInvalidationFootprint(phase: \"execute\" | \"undo\"): MutationInvalidation {\n return phase === \"execute\" ? this.executeFootprint : this.undoFootprint;\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.REMOVE_TABLE,\n payload: this.opts,\n };\n }\n}\n\n/**\n * Command to rename a table.\n */\nexport class RenameTableCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\n\n constructor(\n private deps: TableCommandDeps,\n private workbookName: string,\n private oldName: string,\n private newName: string\n ) {}\n\n execute(): void {\n const previousTable = this.deps.tableManager.getTable({\n workbookName: this.workbookName,\n name: this.oldName,\n });\n this.deps.tableManager.renameTable(this.workbookName, {\n oldName: this.oldName,\n newName: this.newName,\n });\n\n // Update formulas in sheet cells\n const changedCells = this.deps.workbookManager.updateAllFormulas((formula) =>\n this.deps.renameTableInFormula(formula, this.oldName, this.newName)\n );\n\n // Update named expressions\n const changedNamedExpressions =\n this.deps.namedExpressionManager.updateAllNamedExpressions((formula) =>\n this.deps.renameTableInFormula(formula, this.oldName, this.newName)\n );\n\n // Update API schemas\n this.deps.apiSchemaManager.updateForTableRename(\n this.workbookName,\n this.oldName,\n this.newName\n );\n const renamedTable = this.deps.tableManager.getTable({\n workbookName: this.workbookName,\n name: this.newName,\n });\n\n this.executeFootprint = {\n touchedCells: mergeTouchedCells(\n buildTableTouchedCells(this.deps.workbookManager, [\n previousTable,\n renamedTable,\n ]),\n changedCells.map((address) => ({\n address,\n beforeKind: \"formula\" as const,\n afterKind: \"formula\" as const,\n }))\n ),\n tableContextChangedCells: buildTableContextChangedCells(\n this.deps.workbookManager,\n [previousTable, renamedTable]\n ),\n resourceKeys: [\n getTableResourceKey({\n workbookName: this.workbookName,\n tableName: this.oldName,\n }),\n getTableResourceKey({\n workbookName: this.workbookName,\n tableName: this.newName,\n }),\n ...changedNamedExpressions,\n ],\n };\n }\n\n undo(): void {\n const currentTable = this.deps.tableManager.getTable({\n workbookName: this.workbookName,\n name: this.newName,\n });\n // Rename back\n this.deps.tableManager.renameTable(this.workbookName, {\n oldName: this.newName,\n newName: this.oldName,\n });\n\n // Update formulas back\n const changedCells = this.deps.workbookManager.updateAllFormulas((formula) =>\n this.deps.renameTableInFormula(formula, this.newName, this.oldName)\n );\n\n // Update named expressions back\n const changedNamedExpressions =\n this.deps.namedExpressionManager.updateAllNamedExpressions((formula) =>\n this.deps.renameTableInFormula(formula, this.newName, this.oldName)\n );\n\n // Update API schemas back\n this.deps.apiSchemaManager.updateForTableRename(\n this.workbookName,\n this.newName,\n this.oldName\n );\n const restoredTable = this.deps.tableManager.getTable({\n workbookName: this.workbookName,\n name: this.oldName,\n });\n\n this.undoFootprint = {\n touchedCells: mergeTouchedCells(\n buildTableTouchedCells(this.deps.workbookManager, [\n currentTable,\n restoredTable,\n ]),\n changedCells.map((address) => ({\n address,\n beforeKind: \"formula\" as const,\n afterKind: \"formula\" as const,\n }))\n ),\n tableContextChangedCells: buildTableContextChangedCells(\n this.deps.workbookManager,\n [currentTable, restoredTable]\n ),\n resourceKeys: [\n getTableResourceKey({\n workbookName: this.workbookName,\n tableName: this.oldName,\n }),\n getTableResourceKey({\n workbookName: this.workbookName,\n tableName: this.newName,\n }),\n ...changedNamedExpressions,\n ],\n };\n }\n\n getInvalidationFootprint(phase: \"execute\" | \"undo\"): MutationInvalidation {\n return phase === \"execute\" ? this.executeFootprint : this.undoFootprint;\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.RENAME_TABLE,\n payload: {\n workbookName: this.workbookName,\n oldName: this.oldName,\n newName: this.newName,\n },\n };\n }\n}\n\n/**\n * Command to update a table.\n */\nexport class UpdateTableCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private previousTable: TableDefinition | undefined;\n private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\n\n constructor(\n private deps: TableCommandDeps,\n private opts: {\n tableName: string;\n sheetName?: string;\n start?: string;\n numRows?: SpreadsheetRangeEnd;\n numCols?: number;\n workbookName: string;\n }\n ) {}\n\n execute(): void {\n // Capture previous table state\n this.previousTable = this.deps.tableManager.getTable({\n workbookName: this.opts.workbookName,\n name: this.opts.tableName,\n });\n\n this.deps.tableManager.updateTable({\n ...this.opts,\n getCellValue: this.deps.getCellValue,\n });\n const resourceKey = getTableResourceKey({\n workbookName: this.opts.workbookName,\n tableName: this.opts.tableName,\n });\n const nextTable = this.deps.tableManager.getTable({\n workbookName: this.opts.workbookName,\n name: this.opts.tableName,\n });\n this.executeFootprint = {\n touchedCells: buildTableTouchedCells(this.deps.workbookManager, [\n this.previousTable,\n nextTable,\n ]),\n tableContextChangedCells: buildTableContextChangedCells(\n this.deps.workbookManager,\n [this.previousTable, nextTable]\n ),\n resourceKeys: [resourceKey],\n };\n this.undoFootprint = this.executeFootprint;\n }\n\n undo(): void {\n if (!this.previousTable) return;\n\n // Restore previous table state\n const { start, endRow, headers, sheetName } = this.previousTable;\n const startRef = `${String.fromCharCode(65 + start.colIndex)}${start.rowIndex + 1}`;\n\n this.deps.tableManager.updateTable({\n workbookName: this.opts.workbookName,\n tableName: this.opts.tableName,\n sheetName,\n start: startRef,\n numRows: endRow,\n numCols: headers.size,\n getCellValue: this.deps.getCellValue,\n });\n }\n\n getInvalidationFootprint(phase: \"execute\" | \"undo\"): MutationInvalidation {\n return phase === \"execute\" ? this.executeFootprint : this.undoFootprint;\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.UPDATE_TABLE,\n payload: this.opts,\n };\n }\n}\n\n/**\n * Command to reset all tables.\n */\nexport class ResetTablesCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private previousTables: Map<string, Map<string, TableDefinition>> | undefined;\n private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\n\n constructor(\n private deps: TableCommandDeps,\n private newTables: Map<string, Map<string, TableDefinition>>\n ) {}\n\n execute(): void {\n // Capture previous tables\n this.previousTables = new Map();\n for (const [workbookName, tables] of this.deps.tableManager.tables) {\n this.previousTables.set(workbookName, new Map(tables));\n }\n\n this.deps.tableManager.resetTables(this.newTables);\n const resourceKeys = new Set<string>();\n for (const [workbookName, tables] of this.previousTables ?? []) {\n for (const tableName of tables.keys()) {\n resourceKeys.add(\n getTableResourceKey({\n workbookName,\n tableName,\n })\n );\n }\n }\n for (const [workbookName, tables] of this.newTables) {\n for (const tableName of tables.keys()) {\n resourceKeys.add(\n getTableResourceKey({\n workbookName,\n tableName,\n })\n );\n }\n }\n this.executeFootprint = {\n touchedCells: buildTableTouchedCells(this.deps.workbookManager, [\n ...Array.from(this.previousTables?.values() ?? []).flatMap((tables) =>\n Array.from(tables.values())\n ),\n ...Array.from(this.newTables.values()).flatMap((tables) =>\n Array.from(tables.values())\n ),\n ]),\n tableContextChangedCells: buildTableContextChangedCells(\n this.deps.workbookManager,\n [\n ...Array.from(this.previousTables?.values() ?? []).flatMap((tables) =>\n Array.from(tables.values())\n ),\n ...Array.from(this.newTables.values()).flatMap((tables) =>\n Array.from(tables.values())\n ),\n ]\n ),\n resourceKeys: Array.from(resourceKeys),\n };\n this.undoFootprint = this.executeFootprint;\n }\n\n undo(): void {\n if (!this.previousTables) return;\n this.deps.tableManager.resetTables(this.previousTables);\n }\n\n getInvalidationFootprint(phase: \"execute\" | \"undo\"): MutationInvalidation {\n return phase === \"execute\" ? this.executeFootprint : this.undoFootprint;\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.RESET_TABLES,\n payload: {\n tables: Array.from(this.newTables.entries()).map(([wb, tables]) => [\n wb,\n Array.from(tables.entries()),\n ]),\n },\n };\n }\n}\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": ";AAqBA;AAAA;AAAA;AAAA;AAAA;AAKA;AACA;AAEA,SAAS,aAAa,CAAC,SAA8B;AAAA,EACnD,OAAO,GAAG,QAAQ,gBAAgB,QAAQ,aAAa,QAAQ,YAAY,QAAQ;AAAA;AAGrF,SAAS,0BAA0B,CACjC,iBACA,OAIC;AAAA,EACD,MAAM,QAAQ,IAAI;AAAA,EAOlB,MAAM,QAAQ,gBAAgB,SAAS;AAAA,IACrC,cAAc,MAAM;AAAA,IACpB,WAAW,MAAM;AAAA,EACnB,CAAC;AAAA,EACD,IAAI,CAAC,OAAO;AAAA,IACV,OAAO,CAAC;AAAA,EACV;AAAA,EAEA,MAAM,gBAAgB,MAAM,MAAM;AAAA,EAClC,MAAM,cAAc,gBAAgB,MAAM,QAAQ,OAAO;AAAA,EAEzD,IAAI,MAAM,OAAO,SAAS,UAAU;AAAA,IAClC,SAAS,WAAW,MAAM,MAAM,SAAU,YAAY,MAAM,OAAO,OAAO,YAAY;AAAA,MACpF,SAAS,WAAW,cAAe,YAAY,aAAa,YAAY;AAAA,QACtE,MAAM,UAAU;AAAA,UACd,cAAc,MAAM;AAAA,UACpB,WAAW,MAAM;AAAA,UACjB;AAAA,UACA;AAAA,QACF;AAAA,QACA,MAAM,IAAI,cAAc,OAAO,GAAG;AAAA,UAChC;AAAA,UACA,SAAS,gBAAgB,eAAe,OAAO;AAAA,QACjD,CAAC;AAAA,MACH;AAAA,IACF;AAAA,IACA,OAAO,MAAM,KAAK,MAAM,OAAO,CAAC;AAAA,EAClC;AAAA,EAEA,YAAY,KAAK,YA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
2
|
-
function getSerializedCellValueKind(value) {
|
|
3
|
-
if (value === undefined || typeof value === "string" && value.length === 0) {
|
|
4
|
-
return "empty";
|
|
5
|
-
}
|
|
6
|
-
if (typeof value === "string" && value.startsWith("=")) {
|
|
7
|
-
return "formula";
|
|
8
|
-
}
|
|
9
|
-
return "scalar";
|
|
10
|
-
}
|
|
11
|
-
function emptyMutationInvalidation() {
|
|
12
|
-
return {
|
|
13
|
-
touchedCells: [],
|
|
14
|
-
resourceKeys: []
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
var ActionTypes = {
|
|
18
|
-
SET_CELL_CONTENT: "SET_CELL_CONTENT",
|
|
19
|
-
SET_SHEET_CONTENT: "SET_SHEET_CONTENT",
|
|
20
|
-
CLEAR_RANGE: "CLEAR_RANGE",
|
|
21
|
-
PASTE_CELLS: "PASTE_CELLS",
|
|
22
|
-
FILL_AREAS: "FILL_AREAS",
|
|
23
|
-
MOVE_CELL: "MOVE_CELL",
|
|
24
|
-
MOVE_RANGE: "MOVE_RANGE",
|
|
25
|
-
AUTO_FILL: "AUTO_FILL",
|
|
26
|
-
ADD_WORKBOOK: "ADD_WORKBOOK",
|
|
27
|
-
REMOVE_WORKBOOK: "REMOVE_WORKBOOK",
|
|
28
|
-
RENAME_WORKBOOK: "RENAME_WORKBOOK",
|
|
29
|
-
CLONE_WORKBOOK: "CLONE_WORKBOOK",
|
|
30
|
-
ADD_SHEET: "ADD_SHEET",
|
|
31
|
-
REMOVE_SHEET: "REMOVE_SHEET",
|
|
32
|
-
RENAME_SHEET: "RENAME_SHEET",
|
|
33
|
-
ADD_TABLE: "ADD_TABLE",
|
|
34
|
-
REMOVE_TABLE: "REMOVE_TABLE",
|
|
35
|
-
RENAME_TABLE: "RENAME_TABLE",
|
|
36
|
-
UPDATE_TABLE: "UPDATE_TABLE",
|
|
37
|
-
RESET_TABLES: "RESET_TABLES",
|
|
38
|
-
ADD_NAMED_EXPRESSION: "ADD_NAMED_EXPRESSION",
|
|
39
|
-
REMOVE_NAMED_EXPRESSION: "REMOVE_NAMED_EXPRESSION",
|
|
40
|
-
UPDATE_NAMED_EXPRESSION: "UPDATE_NAMED_EXPRESSION",
|
|
41
|
-
RENAME_NAMED_EXPRESSION: "RENAME_NAMED_EXPRESSION",
|
|
42
|
-
SET_NAMED_EXPRESSIONS: "SET_NAMED_EXPRESSIONS",
|
|
43
|
-
SET_CELL_METADATA: "SET_CELL_METADATA",
|
|
44
|
-
SET_SHEET_METADATA: "SET_SHEET_METADATA",
|
|
45
|
-
SET_WORKBOOK_METADATA: "SET_WORKBOOK_METADATA",
|
|
46
|
-
ADD_CONDITIONAL_STYLE: "ADD_CONDITIONAL_STYLE",
|
|
47
|
-
REMOVE_CONDITIONAL_STYLE: "REMOVE_CONDITIONAL_STYLE",
|
|
48
|
-
ADD_CELL_STYLE: "ADD_CELL_STYLE",
|
|
49
|
-
REMOVE_CELL_STYLE: "REMOVE_CELL_STYLE",
|
|
50
|
-
CLEAR_CELL_STYLES: "CLEAR_CELL_STYLES",
|
|
51
|
-
RESET_TO_SERIALIZED: "RESET_TO_SERIALIZED"
|
|
52
|
-
};
|
|
53
|
-
export {
|
|
54
|
-
getSerializedCellValueKind,
|
|
55
|
-
emptyMutationInvalidation,
|
|
56
|
-
ActionTypes
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
//# debugId=85D9FD30A9DAB95B64756E2164756E21
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/core/commands/types.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"/**\n * Command Pattern Types for FormulaEngine\n *\n * Commands encapsulate all mutating operations on the engine,\n * enabling undo/redo, schema validation with rollback, and action serialization.\n */\n\nimport type { CellAddress, RangeAddress, SerializedCellValue } from \"../types.mjs\";\n\nexport type CellContentKind = \"empty\" | \"scalar\" | \"formula\";\n\nexport type RemovedScope =\n | { type: \"workbook\"; workbookName: string }\n | { type: \"sheet\"; workbookName: string; sheetName: string };\n\nexport type MutationInvalidation = {\n touchedCells: Array<{\n address: CellAddress;\n beforeKind: CellContentKind;\n afterKind: CellContentKind;\n }>;\n /**\n * Cells whose table membership or implicit current-row table context changed\n * without necessarily changing their formula text.\n */\n tableContextChangedCells?: CellAddress[];\n resourceKeys: string[];\n removedScopes?: RemovedScope[];\n};\n\nexport function getSerializedCellValueKind(\n value: SerializedCellValue | undefined\n): CellContentKind {\n if (\n value === undefined ||\n (typeof value === \"string\" && value.length === 0)\n ) {\n return \"empty\";\n }\n if (typeof value === \"string\" && value.startsWith(\"=\")) {\n return \"formula\";\n }\n return \"scalar\";\n}\n\nexport function emptyMutationInvalidation(): MutationInvalidation {\n return {\n touchedCells: [],\n resourceKeys: [],\n };\n}\n\n/**\n * Serializable action representation of a command.\n * Used for persistence, collaboration, and changelog functionality.\n */\nexport interface EngineAction {\n type: string;\n payload: unknown;\n timestamp?: number;\n}\n\n/**\n * Base interface for all engine commands.\n */\nexport interface EngineCommand {\n /**\n * Whether this command affects cell values/formulas and requires re-evaluation.\n * Commands that only affect metadata or styles don't need re-evaluation.\n */\n readonly requiresReevaluation: boolean;\n\n /**\n * Returns the exact mutation footprint for the last execute/undo pass.\n */\n getInvalidationFootprint?(\n phase: \"execute\" | \"undo\"\n ): MutationInvalidation;\n\n /**\n * Execute the command (forward operation).\n */\n execute(): void;\n\n /**\n * Undo the command (reverse operation).\n */\n undo(): void;\n\n /**\n * Convert the command to a serializable action for persistence/collaboration.\n */\n toAction(): EngineAction;\n}\n\n/**\n * Options for command execution.\n */\nexport interface ExecuteOptions {\n /**\n * Whether to validate schema constraints after execution.\n * Only applies to commands that require re-evaluation.\n */\n validate?: boolean;\n\n /**\n * Whether to skip adding to undo stack (for internal use).\n */\n skipUndoStack?: boolean;\n\n /**\n * Whether to skip emitting update events.\n */\n skipEmitUpdate?: boolean;\n}\n\n/**\n * Result of schema validation.\n */\nexport interface SchemaValidationResult {\n valid: boolean;\n errors: SchemaValidationErrorInfo[];\n}\n\n/**\n * Information about a schema validation error.\n */\nexport interface SchemaValidationErrorInfo {\n message: string;\n cellAddress?: CellAddress;\n schemaNamespace?: string;\n columnName?: string;\n originalError?: Error;\n}\n\n/**\n * Action types for all commands.\n * Used for serialization and deserialization.\n */\nexport const ActionTypes = {\n // Content commands\n SET_CELL_CONTENT: \"SET_CELL_CONTENT\",\n SET_SHEET_CONTENT: \"SET_SHEET_CONTENT\",\n CLEAR_RANGE: \"CLEAR_RANGE\",\n PASTE_CELLS: \"PASTE_CELLS\",\n FILL_AREAS: \"FILL_AREAS\",\n MOVE_CELL: \"MOVE_CELL\",\n MOVE_RANGE: \"MOVE_RANGE\",\n AUTO_FILL: \"AUTO_FILL\",\n\n // Structure commands - Workbook\n ADD_WORKBOOK: \"ADD_WORKBOOK\",\n REMOVE_WORKBOOK: \"REMOVE_WORKBOOK\",\n RENAME_WORKBOOK: \"RENAME_WORKBOOK\",\n CLONE_WORKBOOK: \"CLONE_WORKBOOK\",\n\n // Structure commands - Sheet\n ADD_SHEET: \"ADD_SHEET\",\n REMOVE_SHEET: \"REMOVE_SHEET\",\n RENAME_SHEET: \"RENAME_SHEET\",\n\n // Table commands\n ADD_TABLE: \"ADD_TABLE\",\n REMOVE_TABLE: \"REMOVE_TABLE\",\n RENAME_TABLE: \"RENAME_TABLE\",\n UPDATE_TABLE: \"UPDATE_TABLE\",\n RESET_TABLES: \"RESET_TABLES\",\n\n // Named expression commands\n ADD_NAMED_EXPRESSION: \"ADD_NAMED_EXPRESSION\",\n REMOVE_NAMED_EXPRESSION: \"REMOVE_NAMED_EXPRESSION\",\n UPDATE_NAMED_EXPRESSION: \"UPDATE_NAMED_EXPRESSION\",\n RENAME_NAMED_EXPRESSION: \"RENAME_NAMED_EXPRESSION\",\n SET_NAMED_EXPRESSIONS: \"SET_NAMED_EXPRESSIONS\",\n\n // Metadata commands\n SET_CELL_METADATA: \"SET_CELL_METADATA\",\n SET_SHEET_METADATA: \"SET_SHEET_METADATA\",\n SET_WORKBOOK_METADATA: \"SET_WORKBOOK_METADATA\",\n\n // Style commands\n ADD_CONDITIONAL_STYLE: \"ADD_CONDITIONAL_STYLE\",\n REMOVE_CONDITIONAL_STYLE: \"REMOVE_CONDITIONAL_STYLE\",\n ADD_CELL_STYLE: \"ADD_CELL_STYLE\",\n REMOVE_CELL_STYLE: \"REMOVE_CELL_STYLE\",\n CLEAR_CELL_STYLES: \"CLEAR_CELL_STYLES\",\n\n // State commands\n RESET_TO_SERIALIZED: \"RESET_TO_SERIALIZED\",\n} as const;\n\nexport type ActionType = (typeof ActionTypes)[keyof typeof ActionTypes];\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": ";AA8BO,SAAS,0BAA0B,CACxC,OACiB;AAAA,EACjB,IACE,UAAU,aACT,OAAO,UAAU,YAAY,MAAM,WAAW,GAC/C;AAAA,IACA,OAAO;AAAA,EACT;AAAA,EACA,IAAI,OAAO,UAAU,YAAY,MAAM,WAAW,GAAG,GAAG;AAAA,IACtD,OAAO;AAAA,EACT;AAAA,EACA,OAAO;AAAA;AAGF,SAAS,yBAAyB,GAAyB;AAAA,EAChE,OAAO;AAAA,IACL,cAAc,CAAC;AAAA,IACf,cAAc,CAAC;AAAA,EACjB;AAAA;AA0FK,IAAM,cAAc;AAAA,EAEzB,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,aAAa;AAAA,EACb,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,WAAW;AAAA,EAGX,cAAc;AAAA,EACd,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAGhB,WAAW;AAAA,EACX,cAAc;AAAA,EACd,cAAc;AAAA,EAGd,WAAW;AAAA,EACX,cAAc;AAAA,EACd,cAAc;AAAA,EACd,cAAc;AAAA,EACd,cAAc;AAAA,EAGd,sBAAsB;AAAA,EACtB,yBAAyB;AAAA,EACzB,yBAAyB;AAAA,EACzB,yBAAyB;AAAA,EACzB,uBAAuB;AAAA,EAGvB,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,uBAAuB;AAAA,EAGvB,uBAAuB;AAAA,EACvB,0BAA0B;AAAA,EAC1B,gBAAgB;AAAA,EAChB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EAGnB,qBAAqB;AACvB;",
|
|
8
|
-
"debugId": "85D9FD30A9DAB95B64756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|