@ricsam/formula-engine 0.0.17 → 0.0.19

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.
Files changed (96) hide show
  1. package/dist/cjs/core/api/api-builder.cjs +67 -0
  2. package/dist/cjs/core/api/api-builder.cjs.map +10 -0
  3. package/dist/cjs/core/api/api-helpers.cjs +191 -0
  4. package/dist/cjs/core/api/api-helpers.cjs.map +10 -0
  5. package/dist/cjs/core/api/api.cjs +65 -0
  6. package/dist/cjs/core/api/api.cjs.map +10 -0
  7. package/dist/cjs/core/api/cell-orm.cjs +80 -0
  8. package/dist/cjs/core/api/cell-orm.cjs.map +10 -0
  9. package/dist/cjs/core/api/table-orm.cjs +171 -0
  10. package/dist/cjs/core/api/table-orm.cjs.map +10 -0
  11. package/dist/cjs/core/autofill-utils.cjs +3 -5
  12. package/dist/cjs/core/autofill-utils.cjs.map +3 -3
  13. package/dist/cjs/core/commands/command-executor.cjs +140 -0
  14. package/dist/cjs/core/commands/command-executor.cjs.map +10 -0
  15. package/dist/cjs/core/commands/content-commands.cjs +574 -0
  16. package/dist/cjs/core/commands/content-commands.cjs.map +10 -0
  17. package/dist/cjs/core/commands/metadata-commands.cjs +150 -0
  18. package/dist/cjs/core/commands/metadata-commands.cjs.map +10 -0
  19. package/dist/cjs/core/commands/named-expression-commands.cjs +238 -0
  20. package/dist/cjs/core/commands/named-expression-commands.cjs.map +10 -0
  21. package/dist/cjs/core/commands/structure-commands.cjs +495 -0
  22. package/dist/cjs/core/commands/structure-commands.cjs.map +10 -0
  23. package/dist/cjs/core/commands/style-commands.cjs +219 -0
  24. package/dist/cjs/core/commands/style-commands.cjs.map +10 -0
  25. package/dist/cjs/core/commands/table-commands.cjs +226 -0
  26. package/dist/cjs/core/commands/table-commands.cjs.map +10 -0
  27. package/dist/cjs/core/commands/types.cjs +72 -0
  28. package/dist/cjs/core/commands/types.cjs.map +10 -0
  29. package/dist/cjs/core/engine.cjs +170 -297
  30. package/dist/cjs/core/engine.cjs.map +3 -3
  31. package/dist/cjs/core/managers/api-schema-manager.cjs +304 -0
  32. package/dist/cjs/core/managers/api-schema-manager.cjs.map +10 -0
  33. package/dist/cjs/core/managers/copy-manager.cjs +1 -2
  34. package/dist/cjs/core/managers/copy-manager.cjs.map +3 -3
  35. package/dist/cjs/core/types.cjs.map +2 -2
  36. package/dist/cjs/lib.cjs +13 -2
  37. package/dist/cjs/lib.cjs.map +3 -3
  38. package/dist/cjs/package.json +1 -1
  39. package/dist/mjs/core/api/api-builder.mjs +37 -0
  40. package/dist/mjs/core/api/api-builder.mjs.map +10 -0
  41. package/dist/mjs/core/api/api-helpers.mjs +161 -0
  42. package/dist/mjs/core/api/api-helpers.mjs.map +10 -0
  43. package/dist/mjs/core/api/api.mjs +35 -0
  44. package/dist/mjs/core/api/api.mjs.map +10 -0
  45. package/dist/mjs/core/api/cell-orm.mjs +49 -0
  46. package/dist/mjs/core/api/cell-orm.mjs.map +10 -0
  47. package/dist/mjs/core/api/table-orm.mjs +148 -0
  48. package/dist/mjs/core/api/table-orm.mjs.map +10 -0
  49. package/dist/mjs/core/autofill-utils.mjs +3 -5
  50. package/dist/mjs/core/autofill-utils.mjs.map +3 -3
  51. package/dist/mjs/core/commands/command-executor.mjs +109 -0
  52. package/dist/mjs/core/commands/command-executor.mjs.map +10 -0
  53. package/dist/mjs/core/commands/content-commands.mjs +544 -0
  54. package/dist/mjs/core/commands/content-commands.mjs.map +10 -0
  55. package/dist/mjs/core/commands/metadata-commands.mjs +120 -0
  56. package/dist/mjs/core/commands/metadata-commands.mjs.map +10 -0
  57. package/dist/mjs/core/commands/named-expression-commands.mjs +208 -0
  58. package/dist/mjs/core/commands/named-expression-commands.mjs.map +10 -0
  59. package/dist/mjs/core/commands/structure-commands.mjs +465 -0
  60. package/dist/mjs/core/commands/structure-commands.mjs.map +10 -0
  61. package/dist/mjs/core/commands/style-commands.mjs +189 -0
  62. package/dist/mjs/core/commands/style-commands.mjs.map +10 -0
  63. package/dist/mjs/core/commands/table-commands.mjs +196 -0
  64. package/dist/mjs/core/commands/table-commands.mjs.map +10 -0
  65. package/dist/mjs/core/commands/types.mjs +42 -0
  66. package/dist/mjs/core/commands/types.mjs.map +10 -0
  67. package/dist/mjs/core/engine.mjs +213 -297
  68. package/dist/mjs/core/engine.mjs.map +3 -3
  69. package/dist/mjs/core/managers/api-schema-manager.mjs +274 -0
  70. package/dist/mjs/core/managers/api-schema-manager.mjs.map +10 -0
  71. package/dist/mjs/core/managers/copy-manager.mjs +1 -2
  72. package/dist/mjs/core/managers/copy-manager.mjs.map +3 -3
  73. package/dist/mjs/core/types.mjs.map +2 -2
  74. package/dist/mjs/lib.mjs +13 -2
  75. package/dist/mjs/lib.mjs.map +3 -3
  76. package/dist/mjs/package.json +1 -1
  77. package/dist/types/core/api/api-builder.d.ts +16 -0
  78. package/dist/types/core/api/api-helpers.d.ts +37 -0
  79. package/dist/types/core/api/api.d.ts +83 -0
  80. package/dist/types/core/api/api.type-test.d.ts +1 -0
  81. package/dist/types/core/api/cell-orm.d.ts +29 -0
  82. package/dist/types/core/api/table-orm.d.ts +46 -0
  83. package/dist/types/core/autofill-utils.d.ts +2 -9
  84. package/dist/types/core/commands/command-executor.d.ts +83 -0
  85. package/dist/types/core/commands/content-commands.d.ts +142 -0
  86. package/dist/types/core/commands/metadata-commands.d.ts +55 -0
  87. package/dist/types/core/commands/named-expression-commands.d.ts +115 -0
  88. package/dist/types/core/commands/structure-commands.d.ts +132 -0
  89. package/dist/types/core/commands/style-commands.d.ts +76 -0
  90. package/dist/types/core/commands/table-commands.d.ts +104 -0
  91. package/dist/types/core/commands/types.d.ts +114 -0
  92. package/dist/types/core/engine.d.ts +130 -26
  93. package/dist/types/core/managers/api-schema-manager.d.ts +121 -0
  94. package/dist/types/core/types.d.ts +1 -1
  95. package/dist/types/lib.d.ts +8 -0
  96. package/package.json +1 -1
@@ -0,0 +1,544 @@
1
+ // src/core/commands/content-commands.ts
2
+ import { ActionTypes } from "./types.mjs";
3
+ import { getCellReference, parseCellReference } from "../utils.mjs";
4
+
5
+ class SetCellContentCommand {
6
+ workbookManager;
7
+ address;
8
+ newContent;
9
+ requiresReevaluation = true;
10
+ previousValue;
11
+ hadPreviousValue = false;
12
+ constructor(workbookManager, address, newContent) {
13
+ this.workbookManager = workbookManager;
14
+ this.address = address;
15
+ this.newContent = newContent;
16
+ }
17
+ execute() {
18
+ const sheet = this.workbookManager.getSheet({
19
+ workbookName: this.address.workbookName,
20
+ sheetName: this.address.sheetName
21
+ });
22
+ if (sheet) {
23
+ const key = getCellReference(this.address);
24
+ this.hadPreviousValue = sheet.content.has(key);
25
+ this.previousValue = sheet.content.get(key);
26
+ }
27
+ this.workbookManager.setCellContent(this.address, this.newContent);
28
+ }
29
+ undo() {
30
+ if (this.hadPreviousValue) {
31
+ this.workbookManager.setCellContent(this.address, this.previousValue);
32
+ } else {
33
+ this.workbookManager.setCellContent(this.address, undefined);
34
+ }
35
+ }
36
+ toAction() {
37
+ return {
38
+ type: ActionTypes.SET_CELL_CONTENT,
39
+ payload: {
40
+ address: this.address,
41
+ content: this.newContent
42
+ }
43
+ };
44
+ }
45
+ }
46
+
47
+ class SetSheetContentCommand {
48
+ workbookManager;
49
+ opts;
50
+ newContent;
51
+ requiresReevaluation = true;
52
+ previousContent;
53
+ constructor(workbookManager, opts, newContent) {
54
+ this.workbookManager = workbookManager;
55
+ this.opts = opts;
56
+ this.newContent = newContent;
57
+ }
58
+ execute() {
59
+ const sheet = this.workbookManager.getSheet(this.opts);
60
+ if (sheet) {
61
+ this.previousContent = new Map(sheet.content);
62
+ }
63
+ this.workbookManager.setSheetContent(this.opts, this.newContent);
64
+ }
65
+ undo() {
66
+ if (this.previousContent) {
67
+ this.workbookManager.setSheetContent(this.opts, this.previousContent);
68
+ }
69
+ }
70
+ toAction() {
71
+ return {
72
+ type: ActionTypes.SET_SHEET_CONTENT,
73
+ payload: {
74
+ opts: this.opts,
75
+ content: Array.from(this.newContent.entries())
76
+ }
77
+ };
78
+ }
79
+ }
80
+
81
+ class ClearRangeCommand {
82
+ workbookManager;
83
+ address;
84
+ requiresReevaluation = true;
85
+ clearedCells = new Map;
86
+ constructor(workbookManager, address) {
87
+ this.workbookManager = workbookManager;
88
+ this.address = address;
89
+ }
90
+ execute() {
91
+ try {
92
+ for (const cellAddress of this.workbookManager.iterateCellsInRange(this.address)) {
93
+ const key = getCellReference(cellAddress);
94
+ const value = this.workbookManager.getCellContent(cellAddress);
95
+ if (value !== undefined) {
96
+ this.clearedCells.set(key, value);
97
+ }
98
+ }
99
+ } catch {}
100
+ this.workbookManager.clearSpreadsheetRange(this.address);
101
+ }
102
+ undo() {
103
+ for (const [key, value] of this.clearedCells) {
104
+ const { colIndex, rowIndex } = parseCellReference(key);
105
+ this.workbookManager.setCellContent({
106
+ workbookName: this.address.workbookName,
107
+ sheetName: this.address.sheetName,
108
+ colIndex,
109
+ rowIndex
110
+ }, value);
111
+ }
112
+ }
113
+ toAction() {
114
+ return {
115
+ type: ActionTypes.CLEAR_RANGE,
116
+ payload: {
117
+ address: this.address
118
+ }
119
+ };
120
+ }
121
+ }
122
+
123
+ class PasteCellsCommand {
124
+ workbookManager;
125
+ copyManager;
126
+ source;
127
+ target;
128
+ options;
129
+ requiresReevaluation = true;
130
+ targetSnapshots = [];
131
+ sourceSnapshots = [];
132
+ constructor(workbookManager, copyManager, source, target, options) {
133
+ this.workbookManager = workbookManager;
134
+ this.copyManager = copyManager;
135
+ this.source = source;
136
+ this.target = target;
137
+ this.options = options;
138
+ }
139
+ execute() {
140
+ if (this.source.length > 0) {
141
+ const firstSource = this.source[0];
142
+ const colOffset = this.target.colIndex - firstSource.colIndex;
143
+ const rowOffset = this.target.rowIndex - firstSource.rowIndex;
144
+ for (const sourceCell of this.source) {
145
+ const targetCell = {
146
+ workbookName: this.target.workbookName,
147
+ sheetName: this.target.sheetName,
148
+ colIndex: sourceCell.colIndex + colOffset,
149
+ rowIndex: sourceCell.rowIndex + rowOffset
150
+ };
151
+ const sheet = this.workbookManager.getSheet({
152
+ workbookName: targetCell.workbookName,
153
+ sheetName: targetCell.sheetName
154
+ });
155
+ if (sheet) {
156
+ const key = getCellReference(targetCell);
157
+ this.targetSnapshots.push({
158
+ address: targetCell,
159
+ content: sheet.content.get(key),
160
+ metadata: sheet.metadata.get(key)
161
+ });
162
+ }
163
+ }
164
+ if (this.options.cut) {
165
+ for (const sourceCell of this.source) {
166
+ const sheet = this.workbookManager.getSheet({
167
+ workbookName: sourceCell.workbookName,
168
+ sheetName: sourceCell.sheetName
169
+ });
170
+ if (sheet) {
171
+ const key = getCellReference(sourceCell);
172
+ this.sourceSnapshots.push({
173
+ address: sourceCell,
174
+ content: sheet.content.get(key),
175
+ metadata: sheet.metadata.get(key)
176
+ });
177
+ }
178
+ }
179
+ }
180
+ }
181
+ this.copyManager.pasteCells(this.source, this.target, this.options);
182
+ }
183
+ undo() {
184
+ for (const snapshot of this.targetSnapshots) {
185
+ this.workbookManager.setCellContent(snapshot.address, snapshot.content);
186
+ if (snapshot.metadata !== undefined) {
187
+ this.workbookManager.setCellMetadata(snapshot.address, snapshot.metadata);
188
+ }
189
+ }
190
+ if (this.options.cut) {
191
+ for (const snapshot of this.sourceSnapshots) {
192
+ this.workbookManager.setCellContent(snapshot.address, snapshot.content);
193
+ if (snapshot.metadata !== undefined) {
194
+ this.workbookManager.setCellMetadata(snapshot.address, snapshot.metadata);
195
+ }
196
+ }
197
+ }
198
+ }
199
+ toAction() {
200
+ return {
201
+ type: ActionTypes.PASTE_CELLS,
202
+ payload: {
203
+ source: this.source,
204
+ target: this.target,
205
+ options: this.options
206
+ }
207
+ };
208
+ }
209
+ }
210
+
211
+ class FillAreasCommand {
212
+ workbookManager;
213
+ copyManager;
214
+ seedRange;
215
+ targetRanges;
216
+ options;
217
+ requiresReevaluation = true;
218
+ targetSnapshots = new Map;
219
+ constructor(workbookManager, copyManager, seedRange, targetRanges, options) {
220
+ this.workbookManager = workbookManager;
221
+ this.copyManager = copyManager;
222
+ this.seedRange = seedRange;
223
+ this.targetRanges = targetRanges;
224
+ this.options = options;
225
+ }
226
+ execute() {
227
+ for (const targetRange of this.targetRanges) {
228
+ const sheet = this.workbookManager.getSheet({
229
+ workbookName: targetRange.workbookName,
230
+ sheetName: targetRange.sheetName
231
+ });
232
+ if (sheet) {
233
+ const { start, end } = targetRange.range;
234
+ const endCol = end.col.type === "number" ? end.col.value : start.col + 100;
235
+ const endRow = end.row.type === "number" ? end.row.value : start.row + 100;
236
+ for (let col = start.col;col <= endCol; col++) {
237
+ for (let row = start.row;row <= endRow; row++) {
238
+ const address = {
239
+ workbookName: targetRange.workbookName,
240
+ sheetName: targetRange.sheetName,
241
+ colIndex: col,
242
+ rowIndex: row
243
+ };
244
+ const key = getCellReference(address);
245
+ const fullKey = `${targetRange.workbookName}:${targetRange.sheetName}:${key}`;
246
+ if (!this.targetSnapshots.has(fullKey)) {
247
+ this.targetSnapshots.set(fullKey, {
248
+ address,
249
+ content: sheet.content.get(key),
250
+ metadata: sheet.metadata.get(key)
251
+ });
252
+ }
253
+ }
254
+ }
255
+ }
256
+ }
257
+ this.copyManager.fillAreas(this.seedRange, this.targetRanges, this.options);
258
+ }
259
+ undo() {
260
+ for (const snapshot of this.targetSnapshots.values()) {
261
+ this.workbookManager.setCellContent(snapshot.address, snapshot.content);
262
+ if (snapshot.metadata !== undefined) {
263
+ this.workbookManager.setCellMetadata(snapshot.address, snapshot.metadata);
264
+ }
265
+ }
266
+ }
267
+ toAction() {
268
+ return {
269
+ type: ActionTypes.FILL_AREAS,
270
+ payload: {
271
+ seedRange: this.seedRange,
272
+ targetRanges: this.targetRanges,
273
+ options: this.options
274
+ }
275
+ };
276
+ }
277
+ }
278
+
279
+ class MoveCellCommand {
280
+ workbookManager;
281
+ copyManager;
282
+ source;
283
+ target;
284
+ requiresReevaluation = true;
285
+ sourceSnapshot;
286
+ targetSnapshot;
287
+ constructor(workbookManager, copyManager, source, target) {
288
+ this.workbookManager = workbookManager;
289
+ this.copyManager = copyManager;
290
+ this.source = source;
291
+ this.target = target;
292
+ }
293
+ execute() {
294
+ const sourceSheet = this.workbookManager.getSheet({
295
+ workbookName: this.source.workbookName,
296
+ sheetName: this.source.sheetName
297
+ });
298
+ if (sourceSheet) {
299
+ const key = getCellReference(this.source);
300
+ this.sourceSnapshot = {
301
+ address: this.source,
302
+ content: sourceSheet.content.get(key),
303
+ metadata: sourceSheet.metadata.get(key)
304
+ };
305
+ }
306
+ const targetSheet = this.workbookManager.getSheet({
307
+ workbookName: this.target.workbookName,
308
+ sheetName: this.target.sheetName
309
+ });
310
+ if (targetSheet) {
311
+ const key = getCellReference(this.target);
312
+ this.targetSnapshot = {
313
+ address: this.target,
314
+ content: targetSheet.content.get(key),
315
+ metadata: targetSheet.metadata.get(key)
316
+ };
317
+ }
318
+ this.copyManager.pasteCells([this.source], this.target, {
319
+ cut: true,
320
+ type: "formula",
321
+ include: "all"
322
+ });
323
+ }
324
+ undo() {
325
+ if (this.sourceSnapshot) {
326
+ this.workbookManager.setCellContent(this.sourceSnapshot.address, this.sourceSnapshot.content);
327
+ if (this.sourceSnapshot.metadata !== undefined) {
328
+ this.workbookManager.setCellMetadata(this.sourceSnapshot.address, this.sourceSnapshot.metadata);
329
+ }
330
+ }
331
+ if (this.targetSnapshot) {
332
+ this.workbookManager.setCellContent(this.targetSnapshot.address, this.targetSnapshot.content);
333
+ if (this.targetSnapshot.metadata !== undefined) {
334
+ this.workbookManager.setCellMetadata(this.targetSnapshot.address, this.targetSnapshot.metadata);
335
+ }
336
+ }
337
+ }
338
+ toAction() {
339
+ return {
340
+ type: ActionTypes.MOVE_CELL,
341
+ payload: {
342
+ source: this.source,
343
+ target: this.target
344
+ }
345
+ };
346
+ }
347
+ }
348
+
349
+ class MoveRangeCommand {
350
+ workbookManager;
351
+ copyManager;
352
+ sourceRange;
353
+ target;
354
+ requiresReevaluation = true;
355
+ sourceSnapshots = [];
356
+ targetSnapshots = [];
357
+ constructor(workbookManager, copyManager, sourceRange, target) {
358
+ this.workbookManager = workbookManager;
359
+ this.copyManager = copyManager;
360
+ this.sourceRange = sourceRange;
361
+ this.target = target;
362
+ }
363
+ execute() {
364
+ const sourceCells = this.copyManager.expandRangeToCells(this.sourceRange);
365
+ for (const cell of sourceCells) {
366
+ const sheet = this.workbookManager.getSheet({
367
+ workbookName: cell.workbookName,
368
+ sheetName: cell.sheetName
369
+ });
370
+ if (sheet) {
371
+ const key = getCellReference(cell);
372
+ this.sourceSnapshots.push({
373
+ address: cell,
374
+ content: sheet.content.get(key),
375
+ metadata: sheet.metadata.get(key)
376
+ });
377
+ }
378
+ }
379
+ if (sourceCells.length > 0) {
380
+ const firstSource = sourceCells[0];
381
+ const colOffset = this.target.colIndex - firstSource.colIndex;
382
+ const rowOffset = this.target.rowIndex - firstSource.rowIndex;
383
+ for (const sourceCell of sourceCells) {
384
+ const targetCell = {
385
+ workbookName: this.target.workbookName,
386
+ sheetName: this.target.sheetName,
387
+ colIndex: sourceCell.colIndex + colOffset,
388
+ rowIndex: sourceCell.rowIndex + rowOffset
389
+ };
390
+ const sheet = this.workbookManager.getSheet({
391
+ workbookName: targetCell.workbookName,
392
+ sheetName: targetCell.sheetName
393
+ });
394
+ if (sheet) {
395
+ const key = getCellReference(targetCell);
396
+ this.targetSnapshots.push({
397
+ address: targetCell,
398
+ content: sheet.content.get(key),
399
+ metadata: sheet.metadata.get(key)
400
+ });
401
+ }
402
+ }
403
+ }
404
+ this.copyManager.pasteCells(sourceCells, this.target, {
405
+ cut: true,
406
+ type: "formula",
407
+ include: "all"
408
+ });
409
+ }
410
+ undo() {
411
+ for (const snapshot of this.sourceSnapshots) {
412
+ this.workbookManager.setCellContent(snapshot.address, snapshot.content);
413
+ if (snapshot.metadata !== undefined) {
414
+ this.workbookManager.setCellMetadata(snapshot.address, snapshot.metadata);
415
+ }
416
+ }
417
+ for (const snapshot of this.targetSnapshots) {
418
+ this.workbookManager.setCellContent(snapshot.address, snapshot.content);
419
+ if (snapshot.metadata !== undefined) {
420
+ this.workbookManager.setCellMetadata(snapshot.address, snapshot.metadata);
421
+ }
422
+ }
423
+ }
424
+ toAction() {
425
+ return {
426
+ type: ActionTypes.MOVE_RANGE,
427
+ payload: {
428
+ sourceRange: this.sourceRange,
429
+ target: this.target
430
+ }
431
+ };
432
+ }
433
+ }
434
+
435
+ class AutoFillCommand {
436
+ workbookManager;
437
+ styleManager;
438
+ autoFillManager;
439
+ opts;
440
+ seedRange;
441
+ fillRanges;
442
+ direction;
443
+ requiresReevaluation = true;
444
+ previousContent = new Map;
445
+ previousMetadata = new Map;
446
+ constructor(workbookManager, styleManager, autoFillManager, opts, seedRange, fillRanges, direction) {
447
+ this.workbookManager = workbookManager;
448
+ this.styleManager = styleManager;
449
+ this.autoFillManager = autoFillManager;
450
+ this.opts = opts;
451
+ this.seedRange = seedRange;
452
+ this.fillRanges = fillRanges;
453
+ this.direction = direction;
454
+ }
455
+ execute() {
456
+ for (const fillRange of this.fillRanges) {
457
+ if (fillRange.end.col.type === "infinity" || fillRange.end.row.type === "infinity") {
458
+ continue;
459
+ }
460
+ const startCol = fillRange.start.col;
461
+ const startRow = fillRange.start.row;
462
+ const endCol = fillRange.end.col.value;
463
+ const endRow = fillRange.end.row.value;
464
+ for (let row = startRow;row <= endRow; row++) {
465
+ for (let col = startCol;col <= endCol; col++) {
466
+ const key = getCellReference({ colIndex: col, rowIndex: row });
467
+ const address = {
468
+ workbookName: this.opts.workbookName,
469
+ sheetName: this.opts.sheetName,
470
+ colIndex: col,
471
+ rowIndex: row
472
+ };
473
+ const content = this.workbookManager.getCellContent(address);
474
+ if (content !== undefined) {
475
+ this.previousContent.set(key, content);
476
+ }
477
+ const metadata = this.workbookManager.getCellMetadata(address);
478
+ if (metadata !== undefined) {
479
+ this.previousMetadata.set(key, metadata);
480
+ }
481
+ }
482
+ }
483
+ }
484
+ this.autoFillManager.fill(this.opts, this.seedRange, this.fillRanges, this.direction);
485
+ }
486
+ undo() {
487
+ const currentContent = this.workbookManager.getSheetSerialized(this.opts);
488
+ const newContent = new Map(currentContent);
489
+ for (const fillRange of this.fillRanges) {
490
+ if (fillRange.end.col.type === "infinity" || fillRange.end.row.type === "infinity") {
491
+ continue;
492
+ }
493
+ const startCol = fillRange.start.col;
494
+ const startRow = fillRange.start.row;
495
+ const endCol = fillRange.end.col.value;
496
+ const endRow = fillRange.end.row.value;
497
+ for (let row = startRow;row <= endRow; row++) {
498
+ for (let col = startCol;col <= endCol; col++) {
499
+ const key = getCellReference({ colIndex: col, rowIndex: row });
500
+ const address = {
501
+ workbookName: this.opts.workbookName,
502
+ sheetName: this.opts.sheetName,
503
+ colIndex: col,
504
+ rowIndex: row
505
+ };
506
+ if (this.previousContent.has(key)) {
507
+ newContent.set(key, this.previousContent.get(key));
508
+ } else {
509
+ newContent.delete(key);
510
+ }
511
+ if (this.previousMetadata.has(key)) {
512
+ this.workbookManager.setCellMetadata(address, this.previousMetadata.get(key));
513
+ } else {
514
+ this.workbookManager.setCellMetadata(address, undefined);
515
+ }
516
+ }
517
+ }
518
+ }
519
+ this.workbookManager.setSheetContent(this.opts, newContent);
520
+ }
521
+ toAction() {
522
+ return {
523
+ type: ActionTypes.AUTO_FILL,
524
+ payload: {
525
+ opts: this.opts,
526
+ seedRange: this.seedRange,
527
+ fillRanges: this.fillRanges,
528
+ direction: this.direction
529
+ }
530
+ };
531
+ }
532
+ }
533
+ export {
534
+ SetSheetContentCommand,
535
+ SetCellContentCommand,
536
+ PasteCellsCommand,
537
+ MoveRangeCommand,
538
+ MoveCellCommand,
539
+ FillAreasCommand,
540
+ ClearRangeCommand,
541
+ AutoFillCommand
542
+ };
543
+
544
+ //# debugId=D1EC078DEF90C73764756E2164756E21
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/core/commands/content-commands.ts"],
4
+ "sourcesContent": [
5
+ "/**\n * Content Commands - Commands that modify cell/sheet content\n *\n * These commands all require re-evaluation after execution.\n */\n\nimport type { WorkbookManager } from \"../managers/workbook-manager.mjs\";\nimport type { CopyManager } from \"../managers/copy-manager.mjs\";\nimport type {\n CellAddress,\n CopyCellsOptions,\n RangeAddress,\n SerializedCellValue,\n} from \"../types.mjs\";\nimport type { EngineCommand, EngineAction } from \"./types.mjs\";\nimport { ActionTypes } from \"./types.mjs\";\nimport { getCellReference, parseCellReference } from \"../utils.mjs\";\n\n/**\n * Command to set a single cell's content.\n */\nexport class SetCellContentCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private previousValue: SerializedCellValue | undefined;\n private hadPreviousValue = false;\n\n constructor(\n private workbookManager: WorkbookManager,\n private address: CellAddress,\n private newContent: SerializedCellValue\n ) {}\n\n execute(): void {\n // Capture previous value\n const sheet = this.workbookManager.getSheet({\n workbookName: this.address.workbookName,\n sheetName: this.address.sheetName,\n });\n if (sheet) {\n const key = getCellReference(this.address);\n this.hadPreviousValue = sheet.content.has(key);\n this.previousValue = sheet.content.get(key);\n }\n\n this.workbookManager.setCellContent(this.address, this.newContent);\n }\n\n undo(): void {\n if (this.hadPreviousValue) {\n this.workbookManager.setCellContent(this.address, this.previousValue);\n } else {\n this.workbookManager.setCellContent(this.address, undefined);\n }\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.SET_CELL_CONTENT,\n payload: {\n address: this.address,\n content: this.newContent,\n },\n };\n }\n}\n\n/**\n * Command to set an entire sheet's content.\n */\nexport class SetSheetContentCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private previousContent: Map<string, SerializedCellValue> | undefined;\n\n constructor(\n private workbookManager: WorkbookManager,\n private opts: { workbookName: string; sheetName: string },\n private newContent: Map<string, SerializedCellValue>\n ) {}\n\n execute(): void {\n // Capture previous content\n const sheet = this.workbookManager.getSheet(this.opts);\n if (sheet) {\n this.previousContent = new Map(sheet.content);\n }\n\n this.workbookManager.setSheetContent(this.opts, this.newContent);\n }\n\n undo(): void {\n if (this.previousContent) {\n this.workbookManager.setSheetContent(this.opts, this.previousContent);\n }\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.SET_SHEET_CONTENT,\n payload: {\n opts: this.opts,\n content: Array.from(this.newContent.entries()),\n },\n };\n }\n}\n\n/**\n * Command to clear a range of cells.\n */\nexport class ClearRangeCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private clearedCells: Map<string, SerializedCellValue> = new Map();\n\n constructor(\n private workbookManager: WorkbookManager,\n private address: RangeAddress\n ) {}\n\n execute(): void {\n // Capture cells before clearing using the optimized iterator\n // This handles infinite ranges by only iterating over cells that actually exist\n try {\n for (const cellAddress of this.workbookManager.iterateCellsInRange(this.address)) {\n const key = getCellReference(cellAddress);\n const value = this.workbookManager.getCellContent(cellAddress);\n if (value !== undefined) {\n this.clearedCells.set(key, value);\n }\n }\n } catch {\n // Sheet doesn't exist, nothing to capture\n }\n\n this.workbookManager.clearSpreadsheetRange(this.address);\n }\n\n undo(): void {\n // Restore cleared cells\n for (const [key, value] of this.clearedCells) {\n const { colIndex, rowIndex } = parseCellReference(key);\n this.workbookManager.setCellContent(\n {\n workbookName: this.address.workbookName,\n sheetName: this.address.sheetName,\n colIndex,\n rowIndex,\n },\n value\n );\n }\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.CLEAR_RANGE,\n payload: {\n address: this.address,\n },\n };\n }\n}\n\n/**\n * Snapshot of a cell for undo purposes.\n */\ninterface CellSnapshot {\n address: CellAddress;\n content: SerializedCellValue | undefined;\n metadata: unknown | undefined;\n}\n\n/**\n * Command to paste cells.\n */\nexport class PasteCellsCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private targetSnapshots: CellSnapshot[] = [];\n private sourceSnapshots: CellSnapshot[] = [];\n\n constructor(\n private workbookManager: WorkbookManager,\n private copyManager: CopyManager,\n private source: CellAddress[],\n private target: CellAddress,\n private options: CopyCellsOptions\n ) {}\n\n execute(): void {\n // Calculate target cells and capture their state\n if (this.source.length > 0) {\n const firstSource = this.source[0]!;\n const colOffset = this.target.colIndex - firstSource.colIndex;\n const rowOffset = this.target.rowIndex - firstSource.rowIndex;\n\n // Capture target cells before paste\n for (const sourceCell of this.source) {\n const targetCell: CellAddress = {\n workbookName: this.target.workbookName,\n sheetName: this.target.sheetName,\n colIndex: sourceCell.colIndex + colOffset,\n rowIndex: sourceCell.rowIndex + rowOffset,\n };\n\n const sheet = this.workbookManager.getSheet({\n workbookName: targetCell.workbookName,\n sheetName: targetCell.sheetName,\n });\n\n if (sheet) {\n const key = getCellReference(targetCell);\n this.targetSnapshots.push({\n address: targetCell,\n content: sheet.content.get(key),\n metadata: sheet.metadata.get(key),\n });\n }\n }\n\n // If cut operation, capture source cells too\n if (this.options.cut) {\n for (const sourceCell of this.source) {\n const sheet = this.workbookManager.getSheet({\n workbookName: sourceCell.workbookName,\n sheetName: sourceCell.sheetName,\n });\n\n if (sheet) {\n const key = getCellReference(sourceCell);\n this.sourceSnapshots.push({\n address: sourceCell,\n content: sheet.content.get(key),\n metadata: sheet.metadata.get(key),\n });\n }\n }\n }\n }\n\n this.copyManager.pasteCells(this.source, this.target, this.options);\n }\n\n undo(): void {\n // Restore target cells\n for (const snapshot of this.targetSnapshots) {\n this.workbookManager.setCellContent(snapshot.address, snapshot.content);\n if (snapshot.metadata !== undefined) {\n this.workbookManager.setCellMetadata(snapshot.address, snapshot.metadata);\n }\n }\n\n // Restore source cells if it was a cut operation\n if (this.options.cut) {\n for (const snapshot of this.sourceSnapshots) {\n this.workbookManager.setCellContent(snapshot.address, snapshot.content);\n if (snapshot.metadata !== undefined) {\n this.workbookManager.setCellMetadata(snapshot.address, snapshot.metadata);\n }\n }\n }\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.PASTE_CELLS,\n payload: {\n source: this.source,\n target: this.target,\n options: this.options,\n },\n };\n }\n}\n\n/**\n * Command to fill areas with a seed range.\n */\nexport class FillAreasCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private targetSnapshots: Map<string, CellSnapshot> = new Map();\n\n constructor(\n private workbookManager: WorkbookManager,\n private copyManager: CopyManager,\n private seedRange: RangeAddress,\n private targetRanges: RangeAddress[],\n private options: CopyCellsOptions\n ) {}\n\n execute(): void {\n // Capture all target cells before filling\n for (const targetRange of this.targetRanges) {\n const sheet = this.workbookManager.getSheet({\n workbookName: targetRange.workbookName,\n sheetName: targetRange.sheetName,\n });\n\n if (sheet) {\n const { start, end } = targetRange.range;\n const endCol = end.col.type === \"number\" ? end.col.value : start.col + 100;\n const endRow = end.row.type === \"number\" ? end.row.value : start.row + 100;\n\n for (let col = start.col; col <= endCol; col++) {\n for (let row = start.row; row <= endRow; row++) {\n const address: CellAddress = {\n workbookName: targetRange.workbookName,\n sheetName: targetRange.sheetName,\n colIndex: col,\n rowIndex: row,\n };\n const key = getCellReference(address);\n const fullKey = `${targetRange.workbookName}:${targetRange.sheetName}:${key}`;\n\n if (!this.targetSnapshots.has(fullKey)) {\n this.targetSnapshots.set(fullKey, {\n address,\n content: sheet.content.get(key),\n metadata: sheet.metadata.get(key),\n });\n }\n }\n }\n }\n }\n\n this.copyManager.fillAreas(this.seedRange, this.targetRanges, this.options);\n }\n\n undo(): void {\n // Restore all target cells\n for (const snapshot of this.targetSnapshots.values()) {\n this.workbookManager.setCellContent(snapshot.address, snapshot.content);\n if (snapshot.metadata !== undefined) {\n this.workbookManager.setCellMetadata(snapshot.address, snapshot.metadata);\n }\n }\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.FILL_AREAS,\n payload: {\n seedRange: this.seedRange,\n targetRanges: this.targetRanges,\n options: this.options,\n },\n };\n }\n}\n\n/**\n * Command to move a single cell.\n */\nexport class MoveCellCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private sourceSnapshot: CellSnapshot | undefined;\n private targetSnapshot: CellSnapshot | undefined;\n\n constructor(\n private workbookManager: WorkbookManager,\n private copyManager: CopyManager,\n private source: CellAddress,\n private target: CellAddress\n ) {}\n\n execute(): void {\n // Capture source cell\n const sourceSheet = this.workbookManager.getSheet({\n workbookName: this.source.workbookName,\n sheetName: this.source.sheetName,\n });\n\n if (sourceSheet) {\n const key = getCellReference(this.source);\n this.sourceSnapshot = {\n address: this.source,\n content: sourceSheet.content.get(key),\n metadata: sourceSheet.metadata.get(key),\n };\n }\n\n // Capture target cell\n const targetSheet = this.workbookManager.getSheet({\n workbookName: this.target.workbookName,\n sheetName: this.target.sheetName,\n });\n\n if (targetSheet) {\n const key = getCellReference(this.target);\n this.targetSnapshot = {\n address: this.target,\n content: targetSheet.content.get(key),\n metadata: targetSheet.metadata.get(key),\n };\n }\n\n // Execute the move via paste with cut option\n this.copyManager.pasteCells([this.source], this.target, {\n cut: true,\n type: \"formula\",\n include: \"all\",\n });\n }\n\n undo(): void {\n // Restore source cell\n if (this.sourceSnapshot) {\n this.workbookManager.setCellContent(\n this.sourceSnapshot.address,\n this.sourceSnapshot.content\n );\n if (this.sourceSnapshot.metadata !== undefined) {\n this.workbookManager.setCellMetadata(\n this.sourceSnapshot.address,\n this.sourceSnapshot.metadata\n );\n }\n }\n\n // Restore target cell\n if (this.targetSnapshot) {\n this.workbookManager.setCellContent(\n this.targetSnapshot.address,\n this.targetSnapshot.content\n );\n if (this.targetSnapshot.metadata !== undefined) {\n this.workbookManager.setCellMetadata(\n this.targetSnapshot.address,\n this.targetSnapshot.metadata\n );\n }\n }\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.MOVE_CELL,\n payload: {\n source: this.source,\n target: this.target,\n },\n };\n }\n}\n\n/**\n * Command to move a range of cells.\n */\nexport class MoveRangeCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private sourceSnapshots: CellSnapshot[] = [];\n private targetSnapshots: CellSnapshot[] = [];\n\n constructor(\n private workbookManager: WorkbookManager,\n private copyManager: CopyManager,\n private sourceRange: RangeAddress,\n private target: CellAddress\n ) {}\n\n execute(): void {\n // Expand source range to cells\n const sourceCells = this.copyManager.expandRangeToCells(this.sourceRange);\n\n // Capture source cells\n for (const cell of sourceCells) {\n const sheet = this.workbookManager.getSheet({\n workbookName: cell.workbookName,\n sheetName: cell.sheetName,\n });\n\n if (sheet) {\n const key = getCellReference(cell);\n this.sourceSnapshots.push({\n address: cell,\n content: sheet.content.get(key),\n metadata: sheet.metadata.get(key),\n });\n }\n }\n\n // Calculate and capture target cells\n if (sourceCells.length > 0) {\n const firstSource = sourceCells[0]!;\n const colOffset = this.target.colIndex - firstSource.colIndex;\n const rowOffset = this.target.rowIndex - firstSource.rowIndex;\n\n for (const sourceCell of sourceCells) {\n const targetCell: CellAddress = {\n workbookName: this.target.workbookName,\n sheetName: this.target.sheetName,\n colIndex: sourceCell.colIndex + colOffset,\n rowIndex: sourceCell.rowIndex + rowOffset,\n };\n\n const sheet = this.workbookManager.getSheet({\n workbookName: targetCell.workbookName,\n sheetName: targetCell.sheetName,\n });\n\n if (sheet) {\n const key = getCellReference(targetCell);\n this.targetSnapshots.push({\n address: targetCell,\n content: sheet.content.get(key),\n metadata: sheet.metadata.get(key),\n });\n }\n }\n }\n\n // Execute the move\n this.copyManager.pasteCells(sourceCells, this.target, {\n cut: true,\n type: \"formula\",\n include: \"all\",\n });\n }\n\n undo(): void {\n // Restore source cells\n for (const snapshot of this.sourceSnapshots) {\n this.workbookManager.setCellContent(snapshot.address, snapshot.content);\n if (snapshot.metadata !== undefined) {\n this.workbookManager.setCellMetadata(snapshot.address, snapshot.metadata);\n }\n }\n\n // Restore target cells\n for (const snapshot of this.targetSnapshots) {\n this.workbookManager.setCellContent(snapshot.address, snapshot.content);\n if (snapshot.metadata !== undefined) {\n this.workbookManager.setCellMetadata(snapshot.address, snapshot.metadata);\n }\n }\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.MOVE_RANGE,\n payload: {\n sourceRange: this.sourceRange,\n target: this.target,\n },\n };\n }\n}\n\n/**\n * Command to auto-fill ranges based on a seed pattern.\n * Captures the entire affected area for undo.\n */\nexport class AutoFillCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private previousContent: Map<string, SerializedCellValue> = new Map();\n private previousMetadata: Map<string, unknown> = new Map();\n\n constructor(\n private workbookManager: WorkbookManager,\n private styleManager: import(\"../managers/style-manager.mjs\").StyleManager,\n private autoFillManager: import(\"../autofill-utils.mjs\").AutoFill,\n private opts: { sheetName: string; workbookName: string },\n private seedRange: import(\"../types.mjs\").SpreadsheetRange,\n private fillRanges: import(\"../types.mjs\").SpreadsheetRange[],\n private direction: import(\"@ricsam/selection-manager\").FillDirection\n ) {}\n\n execute(): void {\n // Capture current content and metadata in fill ranges before modification\n for (const fillRange of this.fillRanges) {\n if (fillRange.end.col.type === \"infinity\" || fillRange.end.row.type === \"infinity\") {\n continue; // Skip infinite ranges\n }\n \n const startCol = fillRange.start.col;\n const startRow = fillRange.start.row;\n const endCol = fillRange.end.col.value;\n const endRow = fillRange.end.row.value;\n\n for (let row = startRow; row <= endRow; row++) {\n for (let col = startCol; col <= endCol; col++) {\n const key = getCellReference({ colIndex: col, rowIndex: row });\n const address = {\n workbookName: this.opts.workbookName,\n sheetName: this.opts.sheetName,\n colIndex: col,\n rowIndex: row,\n };\n \n const content = this.workbookManager.getCellContent(address);\n if (content !== undefined) {\n this.previousContent.set(key, content);\n }\n \n const metadata = this.workbookManager.getCellMetadata(address);\n if (metadata !== undefined) {\n this.previousMetadata.set(key, metadata);\n }\n }\n }\n }\n\n // Execute the auto-fill operation\n this.autoFillManager.fill(this.opts, this.seedRange, this.fillRanges, this.direction);\n }\n\n undo(): void {\n // Get current sheet content\n const currentContent = this.workbookManager.getSheetSerialized(this.opts);\n const newContent = new Map(currentContent);\n\n // Restore all fill range cells to their previous state\n for (const fillRange of this.fillRanges) {\n if (fillRange.end.col.type === \"infinity\" || fillRange.end.row.type === \"infinity\") {\n continue;\n }\n \n const startCol = fillRange.start.col;\n const startRow = fillRange.start.row;\n const endCol = fillRange.end.col.value;\n const endRow = fillRange.end.row.value;\n\n for (let row = startRow; row <= endRow; row++) {\n for (let col = startCol; col <= endCol; col++) {\n const key = getCellReference({ colIndex: col, rowIndex: row });\n const address = {\n workbookName: this.opts.workbookName,\n sheetName: this.opts.sheetName,\n colIndex: col,\n rowIndex: row,\n };\n \n // Restore content\n if (this.previousContent.has(key)) {\n newContent.set(key, this.previousContent.get(key)!);\n } else {\n newContent.delete(key);\n }\n \n // Restore metadata\n if (this.previousMetadata.has(key)) {\n this.workbookManager.setCellMetadata(address, this.previousMetadata.get(key));\n } else {\n this.workbookManager.setCellMetadata(address, undefined);\n }\n }\n }\n }\n\n // Apply restored content\n this.workbookManager.setSheetContent(this.opts, newContent);\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.AUTO_FILL,\n payload: {\n opts: this.opts,\n seedRange: this.seedRange,\n fillRanges: this.fillRanges,\n direction: this.direction,\n },\n };\n }\n}\n\n"
6
+ ],
7
+ "mappings": ";AAeA;AACA;AAAA;AAKO,MAAM,sBAA+C;AAAA,EAMhD;AAAA,EACA;AAAA,EACA;AAAA,EAPD,uBAAuB;AAAA,EACxB;AAAA,EACA,mBAAmB;AAAA,EAE3B,WAAW,CACD,iBACA,SACA,YACR;AAAA,IAHQ;AAAA,IACA;AAAA,IACA;AAAA;AAAA,EAGV,OAAO,GAAS;AAAA,IAEd,MAAM,QAAQ,KAAK,gBAAgB,SAAS;AAAA,MAC1C,cAAc,KAAK,QAAQ;AAAA,MAC3B,WAAW,KAAK,QAAQ;AAAA,IAC1B,CAAC;AAAA,IACD,IAAI,OAAO;AAAA,MACT,MAAM,MAAM,iBAAiB,KAAK,OAAO;AAAA,MACzC,KAAK,mBAAmB,MAAM,QAAQ,IAAI,GAAG;AAAA,MAC7C,KAAK,gBAAgB,MAAM,QAAQ,IAAI,GAAG;AAAA,IAC5C;AAAA,IAEA,KAAK,gBAAgB,eAAe,KAAK,SAAS,KAAK,UAAU;AAAA;AAAA,EAGnE,IAAI,GAAS;AAAA,IACX,IAAI,KAAK,kBAAkB;AAAA,MACzB,KAAK,gBAAgB,eAAe,KAAK,SAAS,KAAK,aAAa;AAAA,IACtE,EAAO;AAAA,MACL,KAAK,gBAAgB,eAAe,KAAK,SAAS,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