@ricsam/formula-engine 0.2.8 → 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 +515 -166
- 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 +529 -207
- 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 -135
- 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,10 +0,0 @@
|
|
|
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.cjs\";\nimport type { CopyManager } from \"../managers/copy-manager.cjs\";\nimport type {\n CellAddress,\n CopyCellsOptions,\n RangeAddress,\n SerializedCellValue,\n} from \"../types.cjs\";\nimport type {\n EngineCommand,\n EngineAction,\n MutationInvalidation,\n} from \"./types.cjs\";\nimport {\n ActionTypes,\n emptyMutationInvalidation,\n getSerializedCellValueKind,\n} from \"./types.cjs\";\nimport { getCellReference, parseCellReference } from \"../utils.cjs\";\n\nfunction buildTouchedCells(\n cells: Array<{\n address: CellAddress;\n before: SerializedCellValue | undefined;\n after: SerializedCellValue | undefined;\n }>\n): MutationInvalidation[\"touchedCells\"] {\n const deduped = new Map<\n string,\n {\n address: CellAddress;\n beforeKind: ReturnType<typeof getSerializedCellValueKind>;\n afterKind: ReturnType<typeof getSerializedCellValueKind>;\n }\n >();\n\n for (const cell of cells) {\n deduped.set(`${cell.address.workbookName}:${cell.address.sheetName}:${getCellReference(cell.address)}`, {\n address: cell.address,\n beforeKind: getSerializedCellValueKind(cell.before),\n afterKind: getSerializedCellValueKind(cell.after),\n });\n }\n\n return Array.from(deduped.values());\n}\n\nfunction getAddressKey(address: CellAddress): string {\n return `${address.workbookName}:${address.sheetName}:${getCellReference(address)}`;\n}\n\nfunction captureCellContents(\n workbookManager: WorkbookManager,\n addresses: CellAddress[]\n): Map<string, SerializedCellValue | undefined> {\n const contents = new Map<string, SerializedCellValue | undefined>();\n for (const address of addresses) {\n contents.set(getAddressKey(address), workbookManager.getCellContent(address));\n }\n return contents;\n}\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 private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\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 this.executeFootprint = {\n touchedCells: buildTouchedCells([\n {\n address: this.address,\n before: this.previousValue,\n after: this.newContent,\n },\n ]),\n resourceKeys: [],\n };\n this.undoFootprint = {\n touchedCells: buildTouchedCells([\n {\n address: this.address,\n before: this.newContent,\n after: this.hadPreviousValue ? this.previousValue : undefined,\n },\n ]),\n resourceKeys: [],\n };\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 getInvalidationFootprint(phase: \"execute\" | \"undo\"): MutationInvalidation {\n return phase === \"execute\" ? this.executeFootprint : this.undoFootprint;\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 private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\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 const touchedKeys = new Set<string>([\n ...Array.from(this.previousContent?.keys() ?? []),\n ...Array.from(this.newContent.keys()),\n ]);\n const touchedCells = buildTouchedCells(\n Array.from(touchedKeys, (key) => ({\n address: {\n workbookName: this.opts.workbookName,\n sheetName: this.opts.sheetName,\n ...parseCellReference(key),\n },\n before: this.previousContent?.get(key),\n after: this.newContent.get(key),\n }))\n );\n this.executeFootprint = {\n touchedCells,\n resourceKeys: [],\n };\n this.undoFootprint = {\n touchedCells: buildTouchedCells(\n Array.from(touchedKeys, (key) => ({\n address: {\n workbookName: this.opts.workbookName,\n sheetName: this.opts.sheetName,\n ...parseCellReference(key),\n },\n before: this.newContent.get(key),\n after: this.previousContent?.get(key),\n }))\n ),\n resourceKeys: [],\n };\n }\n\n undo(): void {\n if (this.previousContent) {\n this.workbookManager.setSheetContent(this.opts, this.previousContent);\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.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 private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\n\n constructor(\n private workbookManager: WorkbookManager,\n private address: RangeAddress\n ) {}\n\n execute(): void {\n this.clearedCells.clear();\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 this.executeFootprint = {\n touchedCells: buildTouchedCells(\n Array.from(this.clearedCells.entries(), ([key, before]) => ({\n address: {\n workbookName: this.address.workbookName,\n sheetName: this.address.sheetName,\n ...parseCellReference(key),\n },\n before,\n after: undefined,\n }))\n ),\n resourceKeys: [],\n };\n this.undoFootprint = {\n touchedCells: buildTouchedCells(\n Array.from(this.clearedCells.entries(), ([key, after]) => ({\n address: {\n workbookName: this.address.workbookName,\n sheetName: this.address.sheetName,\n ...parseCellReference(key),\n },\n before: undefined,\n after,\n }))\n ),\n resourceKeys: [],\n };\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 getInvalidationFootprint(phase: \"execute\" | \"undo\"): MutationInvalidation {\n return phase === \"execute\" ? this.executeFootprint : this.undoFootprint;\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 private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\n private executedContents: Map<string, SerializedCellValue | undefined> =\n new Map();\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 this.targetSnapshots = [];\n this.sourceSnapshots = [];\n this.executedContents.clear();\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 const touchedAddresses = [\n ...this.targetSnapshots.map((snapshot) => snapshot.address),\n ...this.sourceSnapshots.map((snapshot) => snapshot.address),\n ];\n this.executedContents = captureCellContents(this.workbookManager, touchedAddresses);\n this.executeFootprint = {\n touchedCells: buildTouchedCells(\n touchedAddresses.map((address) => {\n const beforeSnapshot =\n this.targetSnapshots.find(\n (snapshot) =>\n snapshot.address.workbookName === address.workbookName &&\n snapshot.address.sheetName === address.sheetName &&\n snapshot.address.colIndex === address.colIndex &&\n snapshot.address.rowIndex === address.rowIndex\n ) ??\n this.sourceSnapshots.find(\n (snapshot) =>\n snapshot.address.workbookName === address.workbookName &&\n snapshot.address.sheetName === address.sheetName &&\n snapshot.address.colIndex === address.colIndex &&\n snapshot.address.rowIndex === address.rowIndex\n );\n return {\n address,\n before: beforeSnapshot?.content,\n after: this.executedContents.get(getAddressKey(address)),\n };\n })\n ),\n resourceKeys: [],\n };\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 const touchedAddresses = [\n ...this.targetSnapshots.map((snapshot) => snapshot.address),\n ...this.sourceSnapshots.map((snapshot) => snapshot.address),\n ];\n this.undoFootprint = {\n touchedCells: buildTouchedCells(\n touchedAddresses.map((address) => {\n return {\n address,\n before: this.executedContents.get(getAddressKey(address)),\n after: this.workbookManager.getCellContent(address),\n };\n })\n ),\n resourceKeys: [],\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.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 private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\n private executedContents: Map<string, SerializedCellValue | undefined> =\n 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 this.targetSnapshots.clear();\n this.executedContents.clear();\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 const touchedAddresses = Array.from(this.targetSnapshots.values()).map(\n (snapshot) => snapshot.address\n );\n this.executedContents = captureCellContents(this.workbookManager, touchedAddresses);\n this.executeFootprint = {\n touchedCells: buildTouchedCells(\n touchedAddresses.map((address) => ({\n address,\n before: this.targetSnapshots.get(getAddressKey(address))?.content,\n after: this.executedContents.get(getAddressKey(address)),\n }))\n ),\n resourceKeys: [],\n };\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 const touchedAddresses = Array.from(this.targetSnapshots.values()).map(\n (snapshot) => snapshot.address\n );\n this.undoFootprint = {\n touchedCells: buildTouchedCells(\n touchedAddresses.map((address) => ({\n address,\n before: this.executedContents.get(getAddressKey(address)),\n after: this.workbookManager.getCellContent(address),\n }))\n ),\n resourceKeys: [],\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.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 private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\n private executedContents: Map<string, SerializedCellValue | undefined> =\n new Map();\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 this.sourceSnapshot = undefined;\n this.targetSnapshot = undefined;\n this.executedContents.clear();\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 const touchedAddresses = [this.source, this.target];\n this.executedContents = captureCellContents(this.workbookManager, touchedAddresses);\n this.executeFootprint = {\n touchedCells: buildTouchedCells(\n touchedAddresses.map((address) => ({\n address,\n before:\n this.sourceSnapshot?.address === address\n ? this.sourceSnapshot.content\n : this.targetSnapshot?.content,\n after: this.executedContents.get(getAddressKey(address)),\n }))\n ),\n resourceKeys: [],\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 const touchedAddresses = [this.source, this.target];\n this.undoFootprint = {\n touchedCells: buildTouchedCells(\n touchedAddresses.map((address) => ({\n address,\n before: this.executedContents.get(getAddressKey(address)),\n after: this.workbookManager.getCellContent(address),\n }))\n ),\n resourceKeys: [],\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.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 private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\n private executedContents: Map<string, SerializedCellValue | undefined> =\n new Map();\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 this.sourceSnapshots = [];\n this.targetSnapshots = [];\n this.executedContents.clear();\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 const touchedAddresses = [\n ...this.sourceSnapshots.map((snapshot) => snapshot.address),\n ...this.targetSnapshots.map((snapshot) => snapshot.address),\n ];\n this.executedContents = captureCellContents(this.workbookManager, touchedAddresses);\n this.executeFootprint = {\n touchedCells: buildTouchedCells(\n touchedAddresses.map((address) => {\n const snapshot =\n this.sourceSnapshots.find(\n (candidate) => getAddressKey(candidate.address) === getAddressKey(address)\n ) ??\n this.targetSnapshots.find(\n (candidate) => getAddressKey(candidate.address) === getAddressKey(address)\n );\n return {\n address,\n before: snapshot?.content,\n after: this.executedContents.get(getAddressKey(address)),\n };\n })\n ),\n resourceKeys: [],\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 const touchedAddresses = [\n ...this.sourceSnapshots.map((snapshot) => snapshot.address),\n ...this.targetSnapshots.map((snapshot) => snapshot.address),\n ];\n this.undoFootprint = {\n touchedCells: buildTouchedCells(\n touchedAddresses.map((address) => ({\n address,\n before: this.executedContents.get(getAddressKey(address)),\n after: this.workbookManager.getCellContent(address),\n }))\n ),\n resourceKeys: [],\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.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 private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\n private touchedAddresses: CellAddress[] = [];\n private executedContents: Map<string, SerializedCellValue | undefined> =\n new Map();\n\n constructor(\n private workbookManager: WorkbookManager,\n private styleManager: import(\"../managers/style-manager.cjs\").StyleManager,\n private autoFillManager: import(\"../autofill-utils.cjs\").AutoFill,\n private opts: { sheetName: string; workbookName: string },\n private seedRange: import(\"../types.cjs\").SpreadsheetRange,\n private fillRanges: import(\"../types.cjs\").SpreadsheetRange[],\n private direction: import(\"@ricsam/selection-manager\").FillDirection\n ) {}\n\n execute(): void {\n this.previousContent.clear();\n this.previousMetadata.clear();\n this.touchedAddresses = [];\n this.executedContents.clear();\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 this.touchedAddresses.push(address);\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 this.executedContents = captureCellContents(this.workbookManager, this.touchedAddresses);\n this.executeFootprint = {\n touchedCells: buildTouchedCells(\n this.touchedAddresses.map((address) => {\n const key = getCellReference(address);\n return {\n address,\n before: this.previousContent.get(key),\n after: this.executedContents.get(getAddressKey(address)),\n };\n })\n ),\n resourceKeys: [],\n };\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 this.undoFootprint = {\n touchedCells: buildTouchedCells(\n this.touchedAddresses.map((address) => ({\n address,\n before: this.executedContents.get(getAddressKey(address)),\n after: this.workbookManager.getCellContent(address),\n }))\n ),\n resourceKeys: [],\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.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"
|
|
6
|
-
],
|
|
7
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBO,IAJP;AAKqD,IAArD;AAEA,SAAS,iBAAiB,CACxB,OAKsC;AAAA,EACtC,MAAM,UAAU,IAAI;AAAA,EASpB,WAAW,QAAQ,OAAO;AAAA,IACxB,QAAQ,IAAI,GAAG,KAAK,QAAQ,gBAAgB,KAAK,QAAQ,aAAa,8BAAiB,KAAK,OAAO,KAAK;AAAA,MACtG,SAAS,KAAK;AAAA,MACd,YAAY,wCAA2B,KAAK,MAAM;AAAA,MAClD,WAAW,wCAA2B,KAAK,KAAK;AAAA,IAClD,CAAC;AAAA,EACH;AAAA,EAEA,OAAO,MAAM,KAAK,QAAQ,OAAO,CAAC;AAAA;AAGpC,SAAS,aAAa,CAAC,SAA8B;AAAA,EACnD,OAAO,GAAG,QAAQ,gBAAgB,QAAQ,aAAa,8BAAiB,OAAO;AAAA;AAGjF,SAAS,mBAAmB,CAC1B,iBACA,WAC8C;AAAA,EAC9C,MAAM,WAAW,IAAI;AAAA,EACrB,WAAW,WAAW,WAAW;AAAA,IAC/B,SAAS,IAAI,cAAc,OAAO,GAAG,gBAAgB,eAAe,OAAO,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AAA;AAAA,QAE3D;AAAA,MACF;AAAA,IACF;AAAA,IAGA,KAAK,gBAAgB,gBAAgB,KAAK,MAAM,UAAU;AAAA,IAC1D,KAAK,gBAAgB;AAAA,MACnB,cAAc,kBACZ,KAAK,iBAAiB,IAAI,CAAC,aAAa;AAAA,QACtC;AAAA,QACA,QAAQ,KAAK,iBAAiB,IAAI,cAAc,OAAO,CAAC;AAAA,QACxD,OAAO,KAAK,gBAAgB,eAAe,OAAO;AAAA,MACpD,EAAE,CACJ;AAAA,MACA,cAAc,CAAC;AAAA,IACjB;AAAA;AAAA,EAGF,wBAAwB,CAAC,OAAiD;AAAA,IACxE,OAAO,UAAU,YAAY,KAAK,mBAAmB,KAAK;AAAA;AAAA,EAG5D,QAAQ,GAAiB;AAAA,IACvB,OAAO;AAAA,MACL,MAAM,yBAAY;AAAA,MAClB,SAAS;AAAA,QACP,MAAM,KAAK;AAAA,QACX,WAAW,KAAK;AAAA,QAChB,YAAY,KAAK;AAAA,QACjB,WAAW,KAAK;AAAA,MAClB;AAAA,IACF;AAAA;AAEJ;",
|
|
8
|
-
"debugId": "7AAB2F977AF7BA6364756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
function __accessProp(key) {
|
|
6
|
-
return this[key];
|
|
7
|
-
}
|
|
8
|
-
var __toCommonJS = (from) => {
|
|
9
|
-
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
10
|
-
if (entry)
|
|
11
|
-
return entry;
|
|
12
|
-
entry = __defProp({}, "__esModule", { value: true });
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (var key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(entry, key))
|
|
16
|
-
__defProp(entry, key, {
|
|
17
|
-
get: __accessProp.bind(from, key),
|
|
18
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
__moduleCache.set(from, entry);
|
|
22
|
-
return entry;
|
|
23
|
-
};
|
|
24
|
-
var __moduleCache;
|
|
25
|
-
var __returnValue = (v) => v;
|
|
26
|
-
function __exportSetter(name, newValue) {
|
|
27
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
28
|
-
}
|
|
29
|
-
var __export = (target, all) => {
|
|
30
|
-
for (var name in all)
|
|
31
|
-
__defProp(target, name, {
|
|
32
|
-
get: all[name],
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
set: __exportSetter.bind(all, name)
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// src/core/commands/metadata-commands.ts
|
|
40
|
-
var exports_metadata_commands = {};
|
|
41
|
-
__export(exports_metadata_commands, {
|
|
42
|
-
SetWorkbookMetadataCommand: () => SetWorkbookMetadataCommand,
|
|
43
|
-
SetSheetMetadataCommand: () => SetSheetMetadataCommand,
|
|
44
|
-
SetCellMetadataCommand: () => SetCellMetadataCommand
|
|
45
|
-
});
|
|
46
|
-
module.exports = __toCommonJS(exports_metadata_commands);
|
|
47
|
-
var import_types = require("./types.cjs");
|
|
48
|
-
var import_utils = require("../utils.cjs");
|
|
49
|
-
|
|
50
|
-
class SetCellMetadataCommand {
|
|
51
|
-
workbookManager;
|
|
52
|
-
address;
|
|
53
|
-
newMetadata;
|
|
54
|
-
requiresReevaluation = false;
|
|
55
|
-
previousMetadata;
|
|
56
|
-
hadPreviousMetadata = false;
|
|
57
|
-
constructor(workbookManager, address, newMetadata) {
|
|
58
|
-
this.workbookManager = workbookManager;
|
|
59
|
-
this.address = address;
|
|
60
|
-
this.newMetadata = newMetadata;
|
|
61
|
-
}
|
|
62
|
-
execute() {
|
|
63
|
-
const sheet = this.workbookManager.getSheet({
|
|
64
|
-
workbookName: this.address.workbookName,
|
|
65
|
-
sheetName: this.address.sheetName
|
|
66
|
-
});
|
|
67
|
-
if (sheet) {
|
|
68
|
-
const key = import_utils.getCellReference(this.address);
|
|
69
|
-
this.hadPreviousMetadata = sheet.metadata.has(key);
|
|
70
|
-
this.previousMetadata = sheet.metadata.get(key);
|
|
71
|
-
}
|
|
72
|
-
this.workbookManager.setCellMetadata(this.address, this.newMetadata);
|
|
73
|
-
}
|
|
74
|
-
undo() {
|
|
75
|
-
if (this.hadPreviousMetadata) {
|
|
76
|
-
this.workbookManager.setCellMetadata(this.address, this.previousMetadata);
|
|
77
|
-
} else {
|
|
78
|
-
this.workbookManager.setCellMetadata(this.address, undefined);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
toAction() {
|
|
82
|
-
return {
|
|
83
|
-
type: import_types.ActionTypes.SET_CELL_METADATA,
|
|
84
|
-
payload: {
|
|
85
|
-
address: this.address,
|
|
86
|
-
metadata: this.newMetadata
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
class SetSheetMetadataCommand {
|
|
93
|
-
workbookManager;
|
|
94
|
-
opts;
|
|
95
|
-
newMetadata;
|
|
96
|
-
requiresReevaluation = false;
|
|
97
|
-
previousMetadata;
|
|
98
|
-
constructor(workbookManager, opts, newMetadata) {
|
|
99
|
-
this.workbookManager = workbookManager;
|
|
100
|
-
this.opts = opts;
|
|
101
|
-
this.newMetadata = newMetadata;
|
|
102
|
-
}
|
|
103
|
-
execute() {
|
|
104
|
-
const sheet = this.workbookManager.getSheet(this.opts);
|
|
105
|
-
if (sheet) {
|
|
106
|
-
this.previousMetadata = sheet.sheetMetadata;
|
|
107
|
-
}
|
|
108
|
-
this.workbookManager.setSheetMetadata(this.opts, this.newMetadata);
|
|
109
|
-
}
|
|
110
|
-
undo() {
|
|
111
|
-
if (this.previousMetadata !== undefined) {
|
|
112
|
-
this.workbookManager.setSheetMetadata(this.opts, this.previousMetadata);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
toAction() {
|
|
116
|
-
return {
|
|
117
|
-
type: import_types.ActionTypes.SET_SHEET_METADATA,
|
|
118
|
-
payload: {
|
|
119
|
-
opts: this.opts,
|
|
120
|
-
metadata: this.newMetadata
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
class SetWorkbookMetadataCommand {
|
|
127
|
-
workbookManager;
|
|
128
|
-
workbookName;
|
|
129
|
-
newMetadata;
|
|
130
|
-
requiresReevaluation = false;
|
|
131
|
-
previousMetadata;
|
|
132
|
-
constructor(workbookManager, workbookName, newMetadata) {
|
|
133
|
-
this.workbookManager = workbookManager;
|
|
134
|
-
this.workbookName = workbookName;
|
|
135
|
-
this.newMetadata = newMetadata;
|
|
136
|
-
}
|
|
137
|
-
execute() {
|
|
138
|
-
const workbook = this.workbookManager.getWorkbooks().get(this.workbookName);
|
|
139
|
-
if (workbook) {
|
|
140
|
-
this.previousMetadata = workbook.workbookMetadata;
|
|
141
|
-
}
|
|
142
|
-
this.workbookManager.setWorkbookMetadata(this.workbookName, this.newMetadata);
|
|
143
|
-
}
|
|
144
|
-
undo() {
|
|
145
|
-
if (this.previousMetadata !== undefined) {
|
|
146
|
-
this.workbookManager.setWorkbookMetadata(this.workbookName, this.previousMetadata);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
toAction() {
|
|
150
|
-
return {
|
|
151
|
-
type: import_types.ActionTypes.SET_WORKBOOK_METADATA,
|
|
152
|
-
payload: {
|
|
153
|
-
workbookName: this.workbookName,
|
|
154
|
-
metadata: this.newMetadata
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
//# debugId=C465E3A9D09E7A5864756E2164756E21
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/core/commands/metadata-commands.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"/**\n * Metadata Commands - Commands that modify cell/sheet/workbook metadata\n *\n * These commands do NOT require re-evaluation after execution.\n * They only affect metadata, not cell values or formulas.\n */\n\nimport type { WorkbookManager } from \"../managers/workbook-manager.cjs\";\nimport type { CellAddress } from \"../types.cjs\";\nimport type { EngineCommand, EngineAction } from \"./types.cjs\";\nimport { ActionTypes } from \"./types.cjs\";\nimport { getCellReference } from \"../utils.cjs\";\n\n/**\n * Command to set cell metadata.\n */\nexport class SetCellMetadataCommand<TMetadata = unknown> implements EngineCommand {\n readonly requiresReevaluation = false;\n private previousMetadata: TMetadata | undefined;\n private hadPreviousMetadata = false;\n\n constructor(\n private workbookManager: WorkbookManager,\n private address: CellAddress,\n private newMetadata: TMetadata | undefined\n ) {}\n\n execute(): void {\n // Capture previous metadata\n const sheet = this.workbookManager.getSheet({\n workbookName: this.address.workbookName,\n sheetName: this.address.sheetName,\n });\n\n if (sheet) {\n const key = getCellReference(this.address);\n this.hadPreviousMetadata = sheet.metadata.has(key);\n this.previousMetadata = sheet.metadata.get(key) as TMetadata | undefined;\n }\n\n this.workbookManager.setCellMetadata(this.address, this.newMetadata);\n }\n\n undo(): void {\n if (this.hadPreviousMetadata) {\n this.workbookManager.setCellMetadata(this.address, this.previousMetadata);\n } else {\n this.workbookManager.setCellMetadata(this.address, undefined);\n }\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.SET_CELL_METADATA,\n payload: {\n address: this.address,\n metadata: this.newMetadata,\n },\n };\n }\n}\n\n/**\n * Command to set sheet metadata.\n */\nexport class SetSheetMetadataCommand<TMetadata = unknown> implements EngineCommand {\n readonly requiresReevaluation = false;\n private previousMetadata: TMetadata | undefined;\n\n constructor(\n private workbookManager: WorkbookManager,\n private opts: { workbookName: string; sheetName: string },\n private newMetadata: TMetadata\n ) {}\n\n execute(): void {\n // Capture previous metadata\n const sheet = this.workbookManager.getSheet(this.opts);\n if (sheet) {\n this.previousMetadata = sheet.sheetMetadata as TMetadata | undefined;\n }\n\n this.workbookManager.setSheetMetadata(this.opts, this.newMetadata);\n }\n\n undo(): void {\n if (this.previousMetadata !== undefined) {\n this.workbookManager.setSheetMetadata(this.opts, this.previousMetadata);\n }\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.SET_SHEET_METADATA,\n payload: {\n opts: this.opts,\n metadata: this.newMetadata,\n },\n };\n }\n}\n\n/**\n * Command to set workbook metadata.\n */\nexport class SetWorkbookMetadataCommand<TMetadata = unknown> implements EngineCommand {\n readonly requiresReevaluation = false;\n private previousMetadata: TMetadata | undefined;\n\n constructor(\n private workbookManager: WorkbookManager,\n private workbookName: string,\n private newMetadata: TMetadata\n ) {}\n\n execute(): void {\n // Capture previous metadata\n const workbook = this.workbookManager.getWorkbooks().get(this.workbookName);\n if (workbook) {\n this.previousMetadata = workbook.workbookMetadata as TMetadata | undefined;\n }\n\n this.workbookManager.setWorkbookMetadata(this.workbookName, this.newMetadata);\n }\n\n undo(): void {\n if (this.previousMetadata !== undefined) {\n this.workbookManager.setWorkbookMetadata(this.workbookName, this.previousMetadata);\n }\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.SET_WORKBOOK_METADATA,\n payload: {\n workbookName: this.workbookName,\n metadata: this.newMetadata,\n },\n };\n }\n}\n\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAU4B,IAA5B;AACiC,IAAjC;AAAA;AAKO,MAAM,uBAAqE;AAAA,EAMtE;AAAA,EACA;AAAA,EACA;AAAA,EAPD,uBAAuB;AAAA,EACxB;AAAA,EACA,sBAAsB;AAAA,EAE9B,WAAW,CACD,iBACA,SACA,aACR;AAAA,IAHQ;AAAA,IACA;AAAA,IACA;AAAA;AAAA,EAG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B,iBAAiB,KAAK,MAAM,KAAK,gBAAgB;AAAA,IACxE;AAAA;AAAA,EAGF,QAAQ,GAAiB;AAAA,IACvB,OAAO;AAAA,MACL,MAAM,yBAAY;AAAA,MAClB,SAAS;AAAA,QACP,MAAM,KAAK;AAAA,QACX,UAAU,KAAK;AAAA,MACjB;AAAA,IACF;AAAA;AAEJ;AAAA;AAKO,MAAM,2BAAyE;AAAA,EAK1E;AAAA,EACA;AAAA,EACA;AAAA,EAND,uBAAuB;AAAA,EACxB;AAAA,EAER,WAAW,CACD,iBACA,cACA,aACR;AAAA,IAHQ;AAAA,IACA;AAAA,IACA;AAAA;AAAA,EAGV,OAAO,GAAS;AAAA,IAEd,MAAM,WAAW,KAAK,gBAAgB,aAAa,EAAE,IAAI,KAAK,YAAY;AAAA,IAC1E,IAAI,UAAU;AAAA,MACZ,KAAK,mBAAmB,SAAS;AAAA,IACnC;AAAA,IAEA,KAAK,gBAAgB,oBAAoB,KAAK,cAAc,KAAK,WAAW;AAAA;AAAA,EAG9E,IAAI,GAAS;AAAA,IACX,IAAI,KAAK,qBAAqB,WAAW;AAAA,MACvC,KAAK,gBAAgB,oBAAoB,KAAK,cAAc,KAAK,gBAAgB;AAAA,IACnF;AAAA;AAAA,EAGF,QAAQ,GAAiB;AAAA,IACvB,OAAO;AAAA,MACL,MAAM,yBAAY;AAAA,MAClB,SAAS;AAAA,QACP,cAAc,KAAK;AAAA,QACnB,UAAU,KAAK;AAAA,MACjB;AAAA,IACF;AAAA;AAEJ;",
|
|
8
|
-
"debugId": "C465E3A9D09E7A5864756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|
|
@@ -1,363 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
function __accessProp(key) {
|
|
6
|
-
return this[key];
|
|
7
|
-
}
|
|
8
|
-
var __toCommonJS = (from) => {
|
|
9
|
-
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
10
|
-
if (entry)
|
|
11
|
-
return entry;
|
|
12
|
-
entry = __defProp({}, "__esModule", { value: true });
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (var key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(entry, key))
|
|
16
|
-
__defProp(entry, key, {
|
|
17
|
-
get: __accessProp.bind(from, key),
|
|
18
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
__moduleCache.set(from, entry);
|
|
22
|
-
return entry;
|
|
23
|
-
};
|
|
24
|
-
var __moduleCache;
|
|
25
|
-
var __returnValue = (v) => v;
|
|
26
|
-
function __exportSetter(name, newValue) {
|
|
27
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
28
|
-
}
|
|
29
|
-
var __export = (target, all) => {
|
|
30
|
-
for (var name in all)
|
|
31
|
-
__defProp(target, name, {
|
|
32
|
-
get: all[name],
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
set: __exportSetter.bind(all, name)
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// src/core/commands/named-expression-commands.ts
|
|
40
|
-
var exports_named_expression_commands = {};
|
|
41
|
-
__export(exports_named_expression_commands, {
|
|
42
|
-
UpdateNamedExpressionCommand: () => UpdateNamedExpressionCommand,
|
|
43
|
-
SetNamedExpressionsCommand: () => SetNamedExpressionsCommand,
|
|
44
|
-
RenameNamedExpressionCommand: () => RenameNamedExpressionCommand,
|
|
45
|
-
RemoveNamedExpressionCommand: () => RemoveNamedExpressionCommand,
|
|
46
|
-
AddNamedExpressionCommand: () => AddNamedExpressionCommand
|
|
47
|
-
});
|
|
48
|
-
module.exports = __toCommonJS(exports_named_expression_commands);
|
|
49
|
-
var import_types = require("./types.cjs");
|
|
50
|
-
var import_resource_keys = require("../resource-keys.cjs");
|
|
51
|
-
function optsToScope(opts) {
|
|
52
|
-
if (opts.sheetName && opts.workbookName) {
|
|
53
|
-
return {
|
|
54
|
-
name: opts.expressionName,
|
|
55
|
-
scope: {
|
|
56
|
-
type: "sheet",
|
|
57
|
-
workbookName: opts.workbookName,
|
|
58
|
-
sheetName: opts.sheetName
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
} else if (opts.workbookName) {
|
|
62
|
-
return {
|
|
63
|
-
name: opts.expressionName,
|
|
64
|
-
scope: { type: "workbook", workbookName: opts.workbookName }
|
|
65
|
-
};
|
|
66
|
-
} else {
|
|
67
|
-
return {
|
|
68
|
-
name: opts.expressionName,
|
|
69
|
-
scope: { type: "global" }
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
function getNamedExpressionScopeResourceKeys(expressions, opts) {
|
|
74
|
-
return Array.from(new Set(Array.from(expressions, (expressionName) => import_resource_keys.getNamedExpressionResourceKey({
|
|
75
|
-
expressionName,
|
|
76
|
-
workbookName: opts.workbookName,
|
|
77
|
-
sheetName: opts.sheetName
|
|
78
|
-
}))));
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
class AddNamedExpressionCommand {
|
|
82
|
-
deps;
|
|
83
|
-
opts;
|
|
84
|
-
requiresReevaluation = true;
|
|
85
|
-
executeFootprint = import_types.emptyMutationInvalidation();
|
|
86
|
-
undoFootprint = import_types.emptyMutationInvalidation();
|
|
87
|
-
constructor(deps, opts) {
|
|
88
|
-
this.deps = deps;
|
|
89
|
-
this.opts = opts;
|
|
90
|
-
}
|
|
91
|
-
execute() {
|
|
92
|
-
this.deps.namedExpressionManager.addNamedExpression(this.opts);
|
|
93
|
-
const resourceKey = import_resource_keys.getNamedExpressionResourceKey(this.opts);
|
|
94
|
-
this.executeFootprint = {
|
|
95
|
-
touchedCells: [],
|
|
96
|
-
resourceKeys: [resourceKey]
|
|
97
|
-
};
|
|
98
|
-
this.undoFootprint = {
|
|
99
|
-
touchedCells: [],
|
|
100
|
-
resourceKeys: [resourceKey]
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
undo() {
|
|
104
|
-
this.deps.namedExpressionManager.removeNamedExpression({
|
|
105
|
-
expressionName: this.opts.expressionName,
|
|
106
|
-
sheetName: this.opts.sheetName,
|
|
107
|
-
workbookName: this.opts.workbookName
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
getInvalidationFootprint(phase) {
|
|
111
|
-
return phase === "execute" ? this.executeFootprint : this.undoFootprint;
|
|
112
|
-
}
|
|
113
|
-
toAction() {
|
|
114
|
-
return {
|
|
115
|
-
type: import_types.ActionTypes.ADD_NAMED_EXPRESSION,
|
|
116
|
-
payload: this.opts
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
class RemoveNamedExpressionCommand {
|
|
122
|
-
deps;
|
|
123
|
-
opts;
|
|
124
|
-
requiresReevaluation = true;
|
|
125
|
-
removedExpression;
|
|
126
|
-
executeFootprint = import_types.emptyMutationInvalidation();
|
|
127
|
-
undoFootprint = import_types.emptyMutationInvalidation();
|
|
128
|
-
constructor(deps, opts) {
|
|
129
|
-
this.deps = deps;
|
|
130
|
-
this.opts = opts;
|
|
131
|
-
}
|
|
132
|
-
execute() {
|
|
133
|
-
this.removedExpression = this.deps.namedExpressionManager.getNamedExpression(optsToScope(this.opts));
|
|
134
|
-
this.deps.namedExpressionManager.removeNamedExpression(this.opts);
|
|
135
|
-
const resourceKey = import_resource_keys.getNamedExpressionResourceKey(this.opts);
|
|
136
|
-
this.executeFootprint = {
|
|
137
|
-
touchedCells: [],
|
|
138
|
-
resourceKeys: [resourceKey]
|
|
139
|
-
};
|
|
140
|
-
this.undoFootprint = {
|
|
141
|
-
touchedCells: [],
|
|
142
|
-
resourceKeys: [resourceKey]
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
undo() {
|
|
146
|
-
if (!this.removedExpression)
|
|
147
|
-
return;
|
|
148
|
-
this.deps.namedExpressionManager.addNamedExpression({
|
|
149
|
-
expressionName: this.removedExpression.name,
|
|
150
|
-
expression: this.removedExpression.expression,
|
|
151
|
-
sheetName: this.opts.sheetName,
|
|
152
|
-
workbookName: this.opts.workbookName
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
getInvalidationFootprint(phase) {
|
|
156
|
-
return phase === "execute" ? this.executeFootprint : this.undoFootprint;
|
|
157
|
-
}
|
|
158
|
-
toAction() {
|
|
159
|
-
return {
|
|
160
|
-
type: import_types.ActionTypes.REMOVE_NAMED_EXPRESSION,
|
|
161
|
-
payload: this.opts
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
class UpdateNamedExpressionCommand {
|
|
167
|
-
deps;
|
|
168
|
-
opts;
|
|
169
|
-
requiresReevaluation = true;
|
|
170
|
-
previousExpression;
|
|
171
|
-
executeFootprint = import_types.emptyMutationInvalidation();
|
|
172
|
-
undoFootprint = import_types.emptyMutationInvalidation();
|
|
173
|
-
constructor(deps, opts) {
|
|
174
|
-
this.deps = deps;
|
|
175
|
-
this.opts = opts;
|
|
176
|
-
}
|
|
177
|
-
execute() {
|
|
178
|
-
const existing = this.deps.namedExpressionManager.getNamedExpression(optsToScope(this.opts));
|
|
179
|
-
this.previousExpression = existing?.expression;
|
|
180
|
-
this.deps.namedExpressionManager.updateNamedExpression(this.opts);
|
|
181
|
-
const resourceKey = import_resource_keys.getNamedExpressionResourceKey(this.opts);
|
|
182
|
-
this.executeFootprint = {
|
|
183
|
-
touchedCells: [],
|
|
184
|
-
resourceKeys: [resourceKey]
|
|
185
|
-
};
|
|
186
|
-
this.undoFootprint = {
|
|
187
|
-
touchedCells: [],
|
|
188
|
-
resourceKeys: [resourceKey]
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
undo() {
|
|
192
|
-
if (this.previousExpression === undefined)
|
|
193
|
-
return;
|
|
194
|
-
this.deps.namedExpressionManager.updateNamedExpression({
|
|
195
|
-
expressionName: this.opts.expressionName,
|
|
196
|
-
expression: this.previousExpression,
|
|
197
|
-
sheetName: this.opts.sheetName,
|
|
198
|
-
workbookName: this.opts.workbookName
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
getInvalidationFootprint(phase) {
|
|
202
|
-
return phase === "execute" ? this.executeFootprint : this.undoFootprint;
|
|
203
|
-
}
|
|
204
|
-
toAction() {
|
|
205
|
-
return {
|
|
206
|
-
type: import_types.ActionTypes.UPDATE_NAMED_EXPRESSION,
|
|
207
|
-
payload: this.opts
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
class RenameNamedExpressionCommand {
|
|
213
|
-
deps;
|
|
214
|
-
opts;
|
|
215
|
-
requiresReevaluation = true;
|
|
216
|
-
executeFootprint = import_types.emptyMutationInvalidation();
|
|
217
|
-
undoFootprint = import_types.emptyMutationInvalidation();
|
|
218
|
-
constructor(deps, opts) {
|
|
219
|
-
this.deps = deps;
|
|
220
|
-
this.opts = opts;
|
|
221
|
-
}
|
|
222
|
-
execute() {
|
|
223
|
-
this.deps.namedExpressionManager.renameNamedExpression(this.opts);
|
|
224
|
-
const changedCells = this.deps.workbookManager.updateAllFormulas((formula) => this.deps.renameNamedExpressionInFormula(formula, this.opts.expressionName, this.opts.newName));
|
|
225
|
-
const changedNamedExpressions = this.deps.namedExpressionManager.updateAllNamedExpressions((formula) => this.deps.renameNamedExpressionInFormula(formula, this.opts.expressionName, this.opts.newName));
|
|
226
|
-
this.executeFootprint = {
|
|
227
|
-
touchedCells: changedCells.map((address) => ({
|
|
228
|
-
address,
|
|
229
|
-
beforeKind: "formula",
|
|
230
|
-
afterKind: "formula"
|
|
231
|
-
})),
|
|
232
|
-
resourceKeys: [
|
|
233
|
-
import_resource_keys.getNamedExpressionResourceKey({
|
|
234
|
-
expressionName: this.opts.expressionName,
|
|
235
|
-
workbookName: this.opts.workbookName,
|
|
236
|
-
sheetName: this.opts.sheetName
|
|
237
|
-
}),
|
|
238
|
-
import_resource_keys.getNamedExpressionResourceKey({
|
|
239
|
-
expressionName: this.opts.newName,
|
|
240
|
-
workbookName: this.opts.workbookName,
|
|
241
|
-
sheetName: this.opts.sheetName
|
|
242
|
-
}),
|
|
243
|
-
...changedNamedExpressions
|
|
244
|
-
]
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
undo() {
|
|
248
|
-
this.deps.namedExpressionManager.renameNamedExpression({
|
|
249
|
-
expressionName: this.opts.newName,
|
|
250
|
-
sheetName: this.opts.sheetName,
|
|
251
|
-
workbookName: this.opts.workbookName,
|
|
252
|
-
newName: this.opts.expressionName
|
|
253
|
-
});
|
|
254
|
-
const changedCells = this.deps.workbookManager.updateAllFormulas((formula) => this.deps.renameNamedExpressionInFormula(formula, this.opts.newName, this.opts.expressionName));
|
|
255
|
-
const changedNamedExpressions = this.deps.namedExpressionManager.updateAllNamedExpressions((formula) => this.deps.renameNamedExpressionInFormula(formula, this.opts.newName, this.opts.expressionName));
|
|
256
|
-
this.undoFootprint = {
|
|
257
|
-
touchedCells: changedCells.map((address) => ({
|
|
258
|
-
address,
|
|
259
|
-
beforeKind: "formula",
|
|
260
|
-
afterKind: "formula"
|
|
261
|
-
})),
|
|
262
|
-
resourceKeys: [
|
|
263
|
-
import_resource_keys.getNamedExpressionResourceKey({
|
|
264
|
-
expressionName: this.opts.expressionName,
|
|
265
|
-
workbookName: this.opts.workbookName,
|
|
266
|
-
sheetName: this.opts.sheetName
|
|
267
|
-
}),
|
|
268
|
-
import_resource_keys.getNamedExpressionResourceKey({
|
|
269
|
-
expressionName: this.opts.newName,
|
|
270
|
-
workbookName: this.opts.workbookName,
|
|
271
|
-
sheetName: this.opts.sheetName
|
|
272
|
-
}),
|
|
273
|
-
...changedNamedExpressions
|
|
274
|
-
]
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
getInvalidationFootprint(phase) {
|
|
278
|
-
return phase === "execute" ? this.executeFootprint : this.undoFootprint;
|
|
279
|
-
}
|
|
280
|
-
toAction() {
|
|
281
|
-
return {
|
|
282
|
-
type: import_types.ActionTypes.RENAME_NAMED_EXPRESSION,
|
|
283
|
-
payload: this.opts
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
class SetNamedExpressionsCommand {
|
|
289
|
-
deps;
|
|
290
|
-
opts;
|
|
291
|
-
requiresReevaluation = true;
|
|
292
|
-
previousExpressions;
|
|
293
|
-
executeFootprint = import_types.emptyMutationInvalidation();
|
|
294
|
-
undoFootprint = import_types.emptyMutationInvalidation();
|
|
295
|
-
constructor(deps, opts) {
|
|
296
|
-
this.deps = deps;
|
|
297
|
-
this.opts = opts;
|
|
298
|
-
}
|
|
299
|
-
execute() {
|
|
300
|
-
const allExpressions = this.deps.namedExpressionManager.getNamedExpressions();
|
|
301
|
-
if (this.opts.type === "global") {
|
|
302
|
-
this.previousExpressions = new Map(allExpressions.globalExpressions);
|
|
303
|
-
} else if (this.opts.type === "workbook") {
|
|
304
|
-
this.previousExpressions = new Map(allExpressions.workbookExpressions.get(this.opts.workbookName) || []);
|
|
305
|
-
} else if (this.opts.type === "sheet") {
|
|
306
|
-
const sheetExpressions = allExpressions.sheetExpressions.get(this.opts.workbookName)?.get(this.opts.sheetName);
|
|
307
|
-
this.previousExpressions = new Map(sheetExpressions || []);
|
|
308
|
-
}
|
|
309
|
-
this.deps.namedExpressionManager.setNamedExpressions(this.opts);
|
|
310
|
-
const scope = this.opts.type === "global" ? {} : this.opts.type === "workbook" ? { workbookName: this.opts.workbookName } : {
|
|
311
|
-
workbookName: this.opts.workbookName,
|
|
312
|
-
sheetName: this.opts.sheetName
|
|
313
|
-
};
|
|
314
|
-
this.executeFootprint = {
|
|
315
|
-
touchedCells: [],
|
|
316
|
-
resourceKeys: [
|
|
317
|
-
...getNamedExpressionScopeResourceKeys(this.previousExpressions?.keys() ?? [], scope),
|
|
318
|
-
...getNamedExpressionScopeResourceKeys(this.opts.expressions.keys(), scope)
|
|
319
|
-
]
|
|
320
|
-
};
|
|
321
|
-
this.undoFootprint = {
|
|
322
|
-
touchedCells: [],
|
|
323
|
-
resourceKeys: this.executeFootprint.resourceKeys
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
undo() {
|
|
327
|
-
if (!this.previousExpressions)
|
|
328
|
-
return;
|
|
329
|
-
if (this.opts.type === "global") {
|
|
330
|
-
this.deps.namedExpressionManager.setNamedExpressions({
|
|
331
|
-
type: "global",
|
|
332
|
-
expressions: this.previousExpressions
|
|
333
|
-
});
|
|
334
|
-
} else if (this.opts.type === "workbook") {
|
|
335
|
-
this.deps.namedExpressionManager.setNamedExpressions({
|
|
336
|
-
type: "workbook",
|
|
337
|
-
workbookName: this.opts.workbookName,
|
|
338
|
-
expressions: this.previousExpressions
|
|
339
|
-
});
|
|
340
|
-
} else if (this.opts.type === "sheet") {
|
|
341
|
-
this.deps.namedExpressionManager.setNamedExpressions({
|
|
342
|
-
type: "sheet",
|
|
343
|
-
workbookName: this.opts.workbookName,
|
|
344
|
-
sheetName: this.opts.sheetName,
|
|
345
|
-
expressions: this.previousExpressions
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
getInvalidationFootprint(phase) {
|
|
350
|
-
return phase === "execute" ? this.executeFootprint : this.undoFootprint;
|
|
351
|
-
}
|
|
352
|
-
toAction() {
|
|
353
|
-
return {
|
|
354
|
-
type: import_types.ActionTypes.SET_NAMED_EXPRESSIONS,
|
|
355
|
-
payload: {
|
|
356
|
-
...this.opts,
|
|
357
|
-
expressions: Array.from(this.opts.expressions.entries())
|
|
358
|
-
}
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
//# debugId=8ED2CE285A90DE7764756E2164756E21
|