@ricsam/formula-engine 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/core/ast-traverser.cjs +19 -9
- package/dist/cjs/core/ast-traverser.cjs.map +2 -2
- package/dist/cjs/core/autofill-utils.cjs +19 -9
- package/dist/cjs/core/autofill-utils.cjs.map +2 -2
- package/dist/cjs/core/cell-mover.cjs +19 -9
- package/dist/cjs/core/cell-mover.cjs.map +2 -2
- package/dist/cjs/core/commands/command-executor.cjs +24 -13
- package/dist/cjs/core/commands/command-executor.cjs.map +3 -3
- package/dist/cjs/core/commands/content-commands.cjs +292 -9
- package/dist/cjs/core/commands/content-commands.cjs.map +3 -3
- package/dist/cjs/core/commands/metadata-commands.cjs +19 -9
- package/dist/cjs/core/commands/metadata-commands.cjs.map +2 -2
- package/dist/cjs/core/commands/named-expression-commands.cjs +138 -13
- package/dist/cjs/core/commands/named-expression-commands.cjs.map +3 -3
- package/dist/cjs/core/commands/structure-commands.cjs +216 -15
- package/dist/cjs/core/commands/structure-commands.cjs.map +3 -3
- package/dist/cjs/core/commands/style-commands.cjs +19 -9
- package/dist/cjs/core/commands/style-commands.cjs.map +2 -2
- package/dist/cjs/core/commands/table-commands.cjs +134 -13
- package/dist/cjs/core/commands/table-commands.cjs.map +3 -3
- package/dist/cjs/core/commands/types.cjs +36 -9
- package/dist/cjs/core/commands/types.cjs.map +3 -3
- package/dist/cjs/core/engine-snapshot.cjs +51 -0
- package/dist/cjs/core/engine-snapshot.cjs.map +10 -0
- package/dist/cjs/core/engine.cjs +58 -34
- package/dist/cjs/core/engine.cjs.map +3 -3
- package/dist/cjs/core/managers/cache-manager.cjs +123 -9
- package/dist/cjs/core/managers/cache-manager.cjs.map +3 -3
- package/dist/cjs/core/managers/copy-manager.cjs +19 -9
- package/dist/cjs/core/managers/copy-manager.cjs.map +2 -2
- package/dist/cjs/core/managers/dependency-manager.cjs +697 -9
- package/dist/cjs/core/managers/dependency-manager.cjs.map +3 -3
- package/dist/cjs/core/managers/dependency-node.cjs +14 -8
- package/dist/cjs/core/managers/dependency-node.cjs.map +1 -1
- package/dist/cjs/core/managers/evaluation-manager.cjs +296 -11
- package/dist/cjs/core/managers/evaluation-manager.cjs.map +3 -3
- package/dist/cjs/core/managers/event-manager.cjs +19 -9
- package/dist/cjs/core/managers/event-manager.cjs.map +2 -2
- package/dist/cjs/core/managers/frontier-dependency-manager.cjs +65 -12
- package/dist/cjs/core/managers/frontier-dependency-manager.cjs.map +3 -3
- package/dist/cjs/core/managers/isDependencyNode.cjs +19 -9
- package/dist/cjs/core/managers/isDependencyNode.cjs.map +2 -2
- package/dist/cjs/core/managers/named-expression-manager.cjs +121 -29
- package/dist/cjs/core/managers/named-expression-manager.cjs.map +3 -3
- package/dist/cjs/core/managers/range-eval-order-builder.cjs +19 -9
- package/dist/cjs/core/managers/range-eval-order-builder.cjs.map +2 -2
- package/dist/cjs/core/managers/reference-manager.cjs +25 -9
- package/dist/cjs/core/managers/reference-manager.cjs.map +3 -3
- package/dist/cjs/core/managers/schema-manager.cjs +19 -9
- package/dist/cjs/core/managers/schema-manager.cjs.map +2 -2
- package/dist/cjs/core/managers/style-manager.cjs +28 -9
- package/dist/cjs/core/managers/style-manager.cjs.map +3 -3
- package/dist/cjs/core/managers/table-manager.cjs +25 -9
- package/dist/cjs/core/managers/table-manager.cjs.map +3 -3
- package/dist/cjs/core/managers/workbook-manager.cjs +38 -13
- package/dist/cjs/core/managers/workbook-manager.cjs.map +3 -3
- package/dist/cjs/core/map-serializer.cjs +19 -9
- package/dist/cjs/core/map-serializer.cjs.map +2 -2
- package/dist/cjs/core/named-expression-renamer.cjs +19 -9
- package/dist/cjs/core/named-expression-renamer.cjs.map +2 -2
- package/dist/cjs/core/resource-keys.cjs +67 -0
- package/dist/cjs/core/resource-keys.cjs.map +10 -0
- package/dist/cjs/core/schema/cell-orm.cjs +19 -9
- package/dist/cjs/core/schema/cell-orm.cjs.map +2 -2
- package/dist/cjs/core/schema/grid-orm.cjs +19 -9
- package/dist/cjs/core/schema/grid-orm.cjs.map +2 -2
- package/dist/cjs/core/schema/schema-builder.cjs +19 -9
- package/dist/cjs/core/schema/schema-builder.cjs.map +2 -2
- package/dist/cjs/core/schema/schema-helpers.cjs +19 -9
- package/dist/cjs/core/schema/schema-helpers.cjs.map +2 -2
- package/dist/cjs/core/schema/schema.cjs +19 -9
- package/dist/cjs/core/schema/schema.cjs.map +2 -2
- package/dist/cjs/core/schema/table-orm.cjs +19 -9
- package/dist/cjs/core/schema/table-orm.cjs.map +2 -2
- package/dist/cjs/core/sheet-renamer.cjs +19 -9
- package/dist/cjs/core/sheet-renamer.cjs.map +2 -2
- package/dist/cjs/core/sheet-utils.cjs +19 -9
- package/dist/cjs/core/sheet-utils.cjs.map +2 -2
- package/dist/cjs/core/table-renamer.cjs +19 -9
- package/dist/cjs/core/table-renamer.cjs.map +2 -2
- package/dist/cjs/core/types.cjs +19 -9
- package/dist/cjs/core/types.cjs.map +2 -2
- package/dist/cjs/core/utils/color-utils.cjs +19 -9
- package/dist/cjs/core/utils/color-utils.cjs.map +2 -2
- package/dist/cjs/core/utils/range-serializer.cjs +19 -9
- package/dist/cjs/core/utils/range-serializer.cjs.map +2 -2
- package/dist/cjs/core/utils/range-utils.cjs +19 -9
- package/dist/cjs/core/utils/range-utils.cjs.map +2 -2
- package/dist/cjs/core/utils/spreadsheet-visualizer.cjs +19 -9
- package/dist/cjs/core/utils/spreadsheet-visualizer.cjs.map +2 -2
- package/dist/cjs/core/utils.cjs +19 -9
- package/dist/cjs/core/utils.cjs.map +2 -2
- package/dist/cjs/core/workbook-renamer.cjs +19 -9
- package/dist/cjs/core/workbook-renamer.cjs.map +2 -2
- package/dist/cjs/debug/flags.cjs +19 -9
- package/dist/cjs/debug/flags.cjs.map +2 -2
- package/dist/cjs/evaluator/arithmetic/add/add.cjs +19 -9
- package/dist/cjs/evaluator/arithmetic/add/add.cjs.map +2 -2
- package/dist/cjs/evaluator/arithmetic/divide/divide.cjs +19 -9
- package/dist/cjs/evaluator/arithmetic/divide/divide.cjs.map +2 -2
- package/dist/cjs/evaluator/arithmetic/multiply/multiply.cjs +19 -9
- package/dist/cjs/evaluator/arithmetic/multiply/multiply.cjs.map +2 -2
- package/dist/cjs/evaluator/arithmetic/power/power.cjs +19 -9
- package/dist/cjs/evaluator/arithmetic/power/power.cjs.map +2 -2
- package/dist/cjs/evaluator/arithmetic/subtract/subtract.cjs +19 -9
- package/dist/cjs/evaluator/arithmetic/subtract/subtract.cjs.map +2 -2
- package/dist/cjs/evaluator/comparison/equals.cjs +19 -9
- package/dist/cjs/evaluator/comparison/equals.cjs.map +2 -2
- package/dist/cjs/evaluator/comparison/greater-than-or-equal.cjs +19 -9
- package/dist/cjs/evaluator/comparison/greater-than-or-equal.cjs.map +2 -2
- package/dist/cjs/evaluator/comparison/greater-than.cjs +19 -9
- package/dist/cjs/evaluator/comparison/greater-than.cjs.map +2 -2
- package/dist/cjs/evaluator/comparison/less-than-or-equal.cjs +19 -9
- package/dist/cjs/evaluator/comparison/less-than-or-equal.cjs.map +2 -2
- package/dist/cjs/evaluator/comparison/less-than.cjs +19 -9
- package/dist/cjs/evaluator/comparison/less-than.cjs.map +2 -2
- package/dist/cjs/evaluator/comparison/not-equals.cjs +19 -9
- package/dist/cjs/evaluator/comparison/not-equals.cjs.map +2 -2
- package/dist/cjs/evaluator/concatenation/concatenate.cjs +19 -9
- package/dist/cjs/evaluator/concatenation/concatenate.cjs.map +2 -2
- package/dist/cjs/evaluator/dependency-nodes/ast-evaluation-node.cjs +19 -9
- package/dist/cjs/evaluator/dependency-nodes/ast-evaluation-node.cjs.map +2 -2
- package/dist/cjs/evaluator/dependency-nodes/base-eval-node.cjs +35 -9
- package/dist/cjs/evaluator/dependency-nodes/base-eval-node.cjs.map +3 -3
- package/dist/cjs/evaluator/dependency-nodes/cell-value-node.cjs +22 -9
- package/dist/cjs/evaluator/dependency-nodes/cell-value-node.cjs.map +3 -3
- package/dist/cjs/evaluator/dependency-nodes/empty-cell-evaluation-node.cjs +35 -11
- package/dist/cjs/evaluator/dependency-nodes/empty-cell-evaluation-node.cjs.map +3 -3
- package/dist/cjs/evaluator/dependency-nodes/resource-dependency-node.cjs +61 -0
- package/dist/cjs/evaluator/dependency-nodes/resource-dependency-node.cjs.map +10 -0
- package/dist/cjs/evaluator/dependency-nodes/spill-meta-node.cjs +19 -9
- package/dist/cjs/evaluator/dependency-nodes/spill-meta-node.cjs.map +2 -2
- package/dist/cjs/evaluator/dependency-nodes/virtual-cell-value-node.cjs +22 -9
- package/dist/cjs/evaluator/dependency-nodes/virtual-cell-value-node.cjs.map +3 -3
- package/dist/cjs/evaluator/evaluate-scalar-operator.cjs +19 -9
- package/dist/cjs/evaluator/evaluate-scalar-operator.cjs.map +2 -2
- package/dist/cjs/evaluator/evaluation-context.cjs +19 -9
- package/dist/cjs/evaluator/evaluation-context.cjs.map +2 -2
- package/dist/cjs/evaluator/evaluation-error.cjs +19 -9
- package/dist/cjs/evaluator/evaluation-error.cjs.map +2 -2
- package/dist/cjs/evaluator/formula-evaluator.cjs +55 -12
- package/dist/cjs/evaluator/formula-evaluator.cjs.map +3 -3
- package/dist/cjs/evaluator/range-evaluation-node.cjs +35 -11
- package/dist/cjs/evaluator/range-evaluation-node.cjs.map +3 -3
- package/dist/cjs/functions/_template/template.cjs +19 -9
- package/dist/cjs/functions/_template/template.cjs.map +2 -2
- package/dist/cjs/functions/array/sequence/sequence.cjs +19 -9
- package/dist/cjs/functions/array/sequence/sequence.cjs.map +2 -2
- package/dist/cjs/functions/criteria-parser.cjs +19 -9
- package/dist/cjs/functions/criteria-parser.cjs.map +2 -2
- package/dist/cjs/functions/criteria-utils.cjs +19 -9
- package/dist/cjs/functions/criteria-utils.cjs.map +2 -2
- package/dist/cjs/functions/function-registry.cjs +19 -9
- package/dist/cjs/functions/function-registry.cjs.map +2 -2
- package/dist/cjs/functions/function-utils.cjs +19 -9
- package/dist/cjs/functions/function-utils.cjs.map +2 -2
- package/dist/cjs/functions/information/cell/cell.cjs +19 -9
- package/dist/cjs/functions/information/cell/cell.cjs.map +2 -2
- package/dist/cjs/functions/information/column/column.cjs +19 -9
- package/dist/cjs/functions/information/column/column.cjs.map +2 -2
- package/dist/cjs/functions/information/row/row.cjs +19 -9
- package/dist/cjs/functions/information/row/row.cjs.map +2 -2
- package/dist/cjs/functions/logical/and/and.cjs +19 -9
- package/dist/cjs/functions/logical/and/and.cjs.map +2 -2
- package/dist/cjs/functions/logical/if/if.cjs +19 -9
- package/dist/cjs/functions/logical/if/if.cjs.map +2 -2
- package/dist/cjs/functions/logical/iferror/iferror.cjs +19 -9
- package/dist/cjs/functions/logical/iferror/iferror.cjs.map +2 -2
- package/dist/cjs/functions/logical/or/or.cjs +19 -9
- package/dist/cjs/functions/logical/or/or.cjs.map +2 -2
- package/dist/cjs/functions/lookup/count/count-utils.cjs +19 -9
- package/dist/cjs/functions/lookup/count/count-utils.cjs.map +2 -2
- package/dist/cjs/functions/lookup/count/count.cjs +19 -9
- package/dist/cjs/functions/lookup/count/count.cjs.map +2 -2
- package/dist/cjs/functions/lookup/count/countif.cjs +19 -9
- package/dist/cjs/functions/lookup/count/countif.cjs.map +2 -2
- package/dist/cjs/functions/lookup/count/countifs.cjs +19 -9
- package/dist/cjs/functions/lookup/count/countifs.cjs.map +2 -2
- package/dist/cjs/functions/lookup/index-lookup/index-lookup.cjs +19 -9
- package/dist/cjs/functions/lookup/index-lookup/index-lookup.cjs.map +2 -2
- package/dist/cjs/functions/lookup/match/match.cjs +21 -10
- package/dist/cjs/functions/lookup/match/match.cjs.map +3 -3
- package/dist/cjs/functions/lookup/xlookup/xlookup.cjs +19 -9
- package/dist/cjs/functions/lookup/xlookup/xlookup.cjs.map +2 -2
- package/dist/cjs/functions/math/average/average-utils.cjs +19 -9
- package/dist/cjs/functions/math/average/average-utils.cjs.map +2 -2
- package/dist/cjs/functions/math/average/average.cjs +19 -9
- package/dist/cjs/functions/math/average/average.cjs.map +2 -2
- package/dist/cjs/functions/math/average/averageif.cjs +19 -9
- package/dist/cjs/functions/math/average/averageif.cjs.map +2 -2
- package/dist/cjs/functions/math/average/averageifs.cjs +19 -9
- package/dist/cjs/functions/math/average/averageifs.cjs.map +2 -2
- package/dist/cjs/functions/math/ceiling/ceiling.cjs +19 -9
- package/dist/cjs/functions/math/ceiling/ceiling.cjs.map +2 -2
- package/dist/cjs/functions/math/max/max-utils.cjs +19 -9
- package/dist/cjs/functions/math/max/max-utils.cjs.map +2 -2
- package/dist/cjs/functions/math/max/max.cjs +19 -9
- package/dist/cjs/functions/math/max/max.cjs.map +2 -2
- package/dist/cjs/functions/math/max/maxif.cjs +19 -9
- package/dist/cjs/functions/math/max/maxif.cjs.map +2 -2
- package/dist/cjs/functions/math/max/maxifs.cjs +19 -9
- package/dist/cjs/functions/math/max/maxifs.cjs.map +2 -2
- package/dist/cjs/functions/math/min/min-utils.cjs +19 -9
- package/dist/cjs/functions/math/min/min-utils.cjs.map +2 -2
- package/dist/cjs/functions/math/min/min.cjs +19 -9
- package/dist/cjs/functions/math/min/min.cjs.map +2 -2
- package/dist/cjs/functions/math/min/minif.cjs +19 -9
- package/dist/cjs/functions/math/min/minif.cjs.map +2 -2
- package/dist/cjs/functions/math/min/minifs.cjs +19 -9
- package/dist/cjs/functions/math/min/minifs.cjs.map +2 -2
- package/dist/cjs/functions/math/sum/sum.cjs +19 -9
- package/dist/cjs/functions/math/sum/sum.cjs.map +2 -2
- package/dist/cjs/functions/math/sum/sumif.cjs +19 -9
- package/dist/cjs/functions/math/sum/sumif.cjs.map +2 -2
- package/dist/cjs/functions/math/sum/sumifs.cjs +19 -9
- package/dist/cjs/functions/math/sum/sumifs.cjs.map +2 -2
- package/dist/cjs/functions/math/sum/summation-utils.cjs +19 -9
- package/dist/cjs/functions/math/sum/summation-utils.cjs.map +2 -2
- package/dist/cjs/functions/reference/address/address.cjs +19 -9
- package/dist/cjs/functions/reference/address/address.cjs.map +2 -2
- package/dist/cjs/functions/reference/indirect/indirect.cjs +19 -9
- package/dist/cjs/functions/reference/indirect/indirect.cjs.map +2 -2
- package/dist/cjs/functions/reference/offset/offset.cjs +19 -9
- package/dist/cjs/functions/reference/offset/offset.cjs.map +2 -2
- package/dist/cjs/functions/text/concatenate/concatenate.cjs +21 -9
- package/dist/cjs/functions/text/concatenate/concatenate.cjs.map +3 -3
- package/dist/cjs/functions/text/exact/exact.cjs +19 -9
- package/dist/cjs/functions/text/exact/exact.cjs.map +2 -2
- package/dist/cjs/functions/text/find/find.cjs +19 -9
- package/dist/cjs/functions/text/find/find.cjs.map +2 -2
- package/dist/cjs/functions/text/left/left.cjs +19 -9
- package/dist/cjs/functions/text/left/left.cjs.map +2 -2
- package/dist/cjs/functions/text/len/len.cjs +19 -9
- package/dist/cjs/functions/text/len/len.cjs.map +2 -2
- package/dist/cjs/functions/text/mid/mid.cjs +19 -9
- package/dist/cjs/functions/text/mid/mid.cjs.map +2 -2
- package/dist/cjs/functions/text/right/right.cjs +19 -9
- package/dist/cjs/functions/text/right/right.cjs.map +2 -2
- package/dist/cjs/functions/text/text-helpers.cjs +19 -9
- package/dist/cjs/functions/text/text-helpers.cjs.map +2 -2
- package/dist/cjs/functions/text/textjoin/textjoin.cjs +19 -9
- package/dist/cjs/functions/text/textjoin/textjoin.cjs.map +2 -2
- package/dist/cjs/lib.cjs +24 -13
- package/dist/cjs/lib.cjs.map +2 -2
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/parser/ast.cjs +19 -9
- package/dist/cjs/parser/ast.cjs.map +2 -2
- package/dist/cjs/parser/formatter.cjs +19 -9
- package/dist/cjs/parser/formatter.cjs.map +2 -2
- package/dist/cjs/parser/grammar.cjs +19 -9
- package/dist/cjs/parser/grammar.cjs.map +2 -2
- package/dist/cjs/parser/lexer.cjs +19 -9
- package/dist/cjs/parser/lexer.cjs.map +2 -2
- package/dist/cjs/parser/parser.cjs +19 -9
- package/dist/cjs/parser/parser.cjs.map +2 -2
- package/dist/cjs/react/hooks.cjs +31 -10
- package/dist/cjs/react/hooks.cjs.map +2 -2
- package/dist/mjs/core/commands/command-executor.mjs +7 -5
- package/dist/mjs/core/commands/command-executor.mjs.map +3 -3
- package/dist/mjs/core/commands/content-commands.mjs +279 -2
- package/dist/mjs/core/commands/content-commands.mjs.map +3 -3
- package/dist/mjs/core/commands/named-expression-commands.mjs +121 -6
- package/dist/mjs/core/commands/named-expression-commands.mjs.map +3 -3
- package/dist/mjs/core/commands/structure-commands.mjs +204 -8
- package/dist/mjs/core/commands/structure-commands.mjs.map +3 -3
- package/dist/mjs/core/commands/table-commands.mjs +117 -6
- package/dist/mjs/core/commands/table-commands.mjs.map +3 -3
- package/dist/mjs/core/commands/types.mjs +18 -1
- package/dist/mjs/core/commands/types.mjs.map +3 -3
- package/dist/mjs/core/engine-snapshot.mjs +11 -0
- package/dist/mjs/core/engine-snapshot.mjs.map +10 -0
- package/dist/mjs/core/engine.mjs +42 -26
- package/dist/mjs/core/engine.mjs.map +3 -3
- package/dist/mjs/core/managers/cache-manager.mjs +105 -1
- package/dist/mjs/core/managers/cache-manager.mjs.map +3 -3
- package/dist/mjs/core/managers/dependency-manager.mjs +687 -2
- package/dist/mjs/core/managers/dependency-manager.mjs.map +3 -3
- package/dist/mjs/core/managers/evaluation-manager.mjs +283 -4
- package/dist/mjs/core/managers/evaluation-manager.mjs.map +3 -3
- package/dist/mjs/core/managers/frontier-dependency-manager.mjs +47 -4
- package/dist/mjs/core/managers/frontier-dependency-manager.mjs.map +3 -3
- package/dist/mjs/core/managers/named-expression-manager.mjs +104 -21
- package/dist/mjs/core/managers/named-expression-manager.mjs.map +3 -3
- package/dist/mjs/core/managers/reference-manager.mjs +7 -1
- package/dist/mjs/core/managers/reference-manager.mjs.map +3 -3
- package/dist/mjs/core/managers/style-manager.mjs +10 -1
- package/dist/mjs/core/managers/style-manager.mjs.map +3 -3
- package/dist/mjs/core/managers/table-manager.mjs +7 -1
- package/dist/mjs/core/managers/table-manager.mjs.map +3 -3
- package/dist/mjs/core/managers/workbook-manager.mjs +20 -5
- package/dist/mjs/core/managers/workbook-manager.mjs.map +3 -3
- package/dist/mjs/core/resource-keys.mjs +27 -0
- package/dist/mjs/core/resource-keys.mjs.map +10 -0
- package/dist/mjs/evaluator/dependency-nodes/base-eval-node.mjs +17 -1
- package/dist/mjs/evaluator/dependency-nodes/base-eval-node.mjs.map +3 -3
- package/dist/mjs/evaluator/dependency-nodes/cell-value-node.mjs +4 -1
- package/dist/mjs/evaluator/dependency-nodes/cell-value-node.mjs.map +3 -3
- package/dist/mjs/evaluator/dependency-nodes/empty-cell-evaluation-node.mjs +17 -3
- package/dist/mjs/evaluator/dependency-nodes/empty-cell-evaluation-node.mjs.map +3 -3
- package/dist/mjs/evaluator/dependency-nodes/resource-dependency-node.mjs +21 -0
- package/dist/mjs/evaluator/dependency-nodes/resource-dependency-node.mjs.map +10 -0
- package/dist/mjs/evaluator/dependency-nodes/virtual-cell-value-node.mjs +4 -1
- package/dist/mjs/evaluator/dependency-nodes/virtual-cell-value-node.mjs.map +3 -3
- package/dist/mjs/evaluator/formula-evaluator.mjs +42 -4
- package/dist/mjs/evaluator/formula-evaluator.mjs.map +3 -3
- package/dist/mjs/evaluator/range-evaluation-node.mjs +17 -3
- package/dist/mjs/evaluator/range-evaluation-node.mjs.map +3 -3
- package/dist/mjs/functions/lookup/match/match.mjs +3 -2
- package/dist/mjs/functions/lookup/match/match.mjs.map +3 -3
- package/dist/mjs/functions/text/concatenate/concatenate.mjs +3 -1
- package/dist/mjs/functions/text/concatenate/concatenate.mjs.map +3 -3
- package/dist/mjs/package.json +1 -1
- package/dist/types/core/commands/content-commands.d.ts +31 -1
- package/dist/types/core/commands/named-expression-commands.d.ts +16 -1
- package/dist/types/core/commands/structure-commands.d.ts +24 -1
- package/dist/types/core/commands/table-commands.d.ts +16 -1
- package/dist/types/core/commands/types.d.ts +25 -1
- package/dist/types/core/engine-snapshot.d.ts +138 -0
- package/dist/types/core/engine.d.ts +19 -1
- package/dist/types/core/managers/cache-manager.d.ts +9 -0
- package/dist/types/core/managers/dependency-manager.d.ts +56 -1
- package/dist/types/core/managers/dependency-node.d.ts +2 -1
- package/dist/types/core/managers/evaluation-manager.d.ts +21 -1
- package/dist/types/core/managers/frontier-dependency-manager.d.ts +12 -2
- package/dist/types/core/managers/named-expression-manager.d.ts +17 -1
- package/dist/types/core/managers/reference-manager.d.ts +3 -0
- package/dist/types/core/managers/style-manager.d.ts +3 -0
- package/dist/types/core/managers/table-manager.d.ts +3 -0
- package/dist/types/core/managers/workbook-manager.d.ts +4 -1
- package/dist/types/core/resource-keys.d.ts +14 -0
- package/dist/types/evaluator/dependency-nodes/base-eval-node.d.ts +5 -0
- package/dist/types/evaluator/dependency-nodes/cell-value-node.d.ts +1 -0
- package/dist/types/evaluator/dependency-nodes/empty-cell-evaluation-node.d.ts +8 -1
- package/dist/types/evaluator/dependency-nodes/resource-dependency-node.d.ts +8 -0
- package/dist/types/evaluator/dependency-nodes/virtual-cell-value-node.d.ts +1 -0
- package/dist/types/evaluator/range-evaluation-node.d.ts +8 -1
- package/package.json +6 -2
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/core/commands/command-executor.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"/**\n * CommandExecutor - Executes commands with undo/redo support and schema validation\n *\n * Handles:\n * - Command execution with optional re-evaluation\n * - Schema validation after re-evaluation\n * - Automatic rollback on validation failure\n * - Undo/redo stacks\n * - Action serialization for persistence\n */\n\nimport type { SchemaDeclaration } from \"../schema/schema.mjs\";\nimport type { FormulaEngine } from \"../engine.mjs\";\nimport type { EvaluationManager } from \"../managers/evaluation-manager.mjs\";\nimport type { EventManager } from \"../managers/event-manager.mjs\";\nimport type { CellAddress, SerializedCellValue } from \"../types.mjs\";\nimport type {\n EngineCommand,\n EngineAction,\n ExecuteOptions,\n SchemaValidationResult,\n SchemaValidationErrorInfo,\n} from \"./types.mjs\";\n\n/**\n * Error thrown when schema integrity validation fails.\n * Contains all validation errors that occurred.\n */\nexport class SchemaIntegrityError extends Error {\n constructor(public errors: SchemaValidationErrorInfo[]) {\n const messages = errors.map((e) => e.message).join(\"; \");\n super(`Schema integrity violation: ${messages}`);\n this.name = \"SchemaIntegrityError\";\n }\n}\n\n/**\n * CommandExecutor manages command execution with validation and undo/redo support.\n */\nexport class CommandExecutor {\n private undoStack: EngineCommand[] = [];\n private redoStack: EngineCommand[] = [];\n private actionLog: EngineAction[] = [];\n\n constructor(\n private evaluationManager: EvaluationManager,\n private eventManager: EventManager,\n private validateAllSchemas: () => SchemaValidationResult\n ) {}\n\n /**\n * Execute a command with optional schema validation.\n *\n * @param command - The command to execute\n * @param options - Execution options\n * @throws SchemaIntegrityError if validation fails\n */\n execute(command: EngineCommand, options: ExecuteOptions = {}): void {\n const {\n validate = false,\n skipUndoStack = false,\n skipEmitUpdate = false,\n } = options;\n\n // Execute the command\n command.execute();\n\n // Re-evaluate if needed\n if (command.requiresReevaluation) {\n this.evaluationManager.
|
|
5
|
+
"/**\n * CommandExecutor - Executes commands with undo/redo support and schema validation\n *\n * Handles:\n * - Command execution with optional re-evaluation\n * - Schema validation after re-evaluation\n * - Automatic rollback on validation failure\n * - Undo/redo stacks\n * - Action serialization for persistence\n */\n\nimport type { SchemaDeclaration } from \"../schema/schema.mjs\";\nimport type { FormulaEngine } from \"../engine.mjs\";\nimport type { EvaluationManager } from \"../managers/evaluation-manager.mjs\";\nimport type { EventManager } from \"../managers/event-manager.mjs\";\nimport type { CellAddress, SerializedCellValue } from \"../types.mjs\";\nimport type {\n EngineCommand,\n EngineAction,\n ExecuteOptions,\n SchemaValidationResult,\n SchemaValidationErrorInfo,\n} from \"./types.mjs\";\nimport { emptyMutationInvalidation } from \"./types.mjs\";\n\n/**\n * Error thrown when schema integrity validation fails.\n * Contains all validation errors that occurred.\n */\nexport class SchemaIntegrityError extends Error {\n constructor(public errors: SchemaValidationErrorInfo[]) {\n const messages = errors.map((e) => e.message).join(\"; \");\n super(`Schema integrity violation: ${messages}`);\n this.name = \"SchemaIntegrityError\";\n }\n}\n\n/**\n * CommandExecutor manages command execution with validation and undo/redo support.\n */\nexport class CommandExecutor {\n private undoStack: EngineCommand[] = [];\n private redoStack: EngineCommand[] = [];\n private actionLog: EngineAction[] = [];\n\n constructor(\n private evaluationManager: EvaluationManager,\n private eventManager: EventManager,\n private validateAllSchemas: () => SchemaValidationResult\n ) {}\n\n /**\n * Execute a command with optional schema validation.\n *\n * @param command - The command to execute\n * @param options - Execution options\n * @throws SchemaIntegrityError if validation fails\n */\n execute(command: EngineCommand, options: ExecuteOptions = {}): void {\n const {\n validate = false,\n skipUndoStack = false,\n skipEmitUpdate = false,\n } = options;\n\n // Execute the command\n command.execute();\n\n // Re-evaluate if needed\n if (command.requiresReevaluation) {\n this.evaluationManager.invalidateFromMutation(\n command.getInvalidationFootprint?.(\"execute\") ??\n emptyMutationInvalidation()\n );\n\n // Validate schemas if requested\n if (validate) {\n const validation = this.validateAllSchemas();\n\n if (!validation.valid) {\n // Rollback: undo the command and re-evaluate\n command.undo();\n this.evaluationManager.invalidateFromMutation(\n command.getInvalidationFootprint?.(\"undo\") ??\n emptyMutationInvalidation()\n );\n throw new SchemaIntegrityError(validation.errors);\n }\n }\n }\n\n // Add to undo stack\n if (!skipUndoStack) {\n this.undoStack.push(command);\n // Clear redo stack on new action\n this.redoStack = [];\n }\n\n // Log the action\n const action = command.toAction();\n action.timestamp = Date.now();\n this.actionLog.push(action);\n\n // Emit update event\n if (!skipEmitUpdate) {\n this.eventManager.emitUpdate();\n }\n }\n\n /**\n * Undo the last command.\n *\n * @returns true if undo was performed, false if nothing to undo\n */\n undo(): boolean {\n const command = this.undoStack.pop();\n if (!command) {\n return false;\n }\n\n command.undo();\n\n if (command.requiresReevaluation) {\n this.evaluationManager.invalidateFromMutation(\n command.getInvalidationFootprint?.(\"undo\") ??\n emptyMutationInvalidation()\n );\n }\n\n this.redoStack.push(command);\n this.eventManager.emitUpdate();\n\n return true;\n }\n\n /**\n * Redo the last undone command.\n *\n * @returns true if redo was performed, false if nothing to redo\n */\n redo(): boolean {\n const command = this.redoStack.pop();\n if (!command) {\n return false;\n }\n\n command.execute();\n\n if (command.requiresReevaluation) {\n this.evaluationManager.invalidateFromMutation(\n command.getInvalidationFootprint?.(\"execute\") ??\n emptyMutationInvalidation()\n );\n }\n\n this.undoStack.push(command);\n this.eventManager.emitUpdate();\n\n return true;\n }\n\n /**\n * Check if undo is available.\n */\n canUndo(): boolean {\n return this.undoStack.length > 0;\n }\n\n /**\n * Check if redo is available.\n */\n canRedo(): boolean {\n return this.redoStack.length > 0;\n }\n\n /**\n * Get the action log for persistence/collaboration.\n */\n getActionLog(): EngineAction[] {\n return [...this.actionLog];\n }\n\n /**\n * Clear the action log.\n */\n clearActionLog(): void {\n this.actionLog = [];\n }\n\n /**\n * Clear undo/redo stacks.\n */\n clearHistory(): void {\n this.undoStack = [];\n this.redoStack = [];\n }\n\n /**\n * Get the number of commands in the undo stack.\n */\n getUndoStackSize(): number {\n return this.undoStack.length;\n }\n\n /**\n * Get the number of commands in the redo stack.\n */\n getRedoStackSize(): number {\n return this.redoStack.length;\n }\n}\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": ";
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": "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",
|
|
8
|
+
"debugId": "B70925EB1761ED8F64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
// src/core/commands/content-commands.ts
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ActionTypes,
|
|
4
|
+
emptyMutationInvalidation,
|
|
5
|
+
getSerializedCellValueKind
|
|
6
|
+
} from "./types.mjs";
|
|
3
7
|
import { getCellReference, parseCellReference } from "../utils.mjs";
|
|
8
|
+
function buildTouchedCells(cells) {
|
|
9
|
+
const deduped = new Map;
|
|
10
|
+
for (const cell of cells) {
|
|
11
|
+
deduped.set(`${cell.address.workbookName}:${cell.address.sheetName}:${getCellReference(cell.address)}`, {
|
|
12
|
+
address: cell.address,
|
|
13
|
+
beforeKind: getSerializedCellValueKind(cell.before),
|
|
14
|
+
afterKind: getSerializedCellValueKind(cell.after)
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return Array.from(deduped.values());
|
|
18
|
+
}
|
|
19
|
+
function getAddressKey(address) {
|
|
20
|
+
return `${address.workbookName}:${address.sheetName}:${getCellReference(address)}`;
|
|
21
|
+
}
|
|
22
|
+
function captureCellContents(workbookManager, addresses) {
|
|
23
|
+
const contents = new Map;
|
|
24
|
+
for (const address of addresses) {
|
|
25
|
+
contents.set(getAddressKey(address), workbookManager.getCellContent(address));
|
|
26
|
+
}
|
|
27
|
+
return contents;
|
|
28
|
+
}
|
|
4
29
|
|
|
5
30
|
class SetCellContentCommand {
|
|
6
31
|
workbookManager;
|
|
@@ -9,6 +34,8 @@ class SetCellContentCommand {
|
|
|
9
34
|
requiresReevaluation = true;
|
|
10
35
|
previousValue;
|
|
11
36
|
hadPreviousValue = false;
|
|
37
|
+
executeFootprint = emptyMutationInvalidation();
|
|
38
|
+
undoFootprint = emptyMutationInvalidation();
|
|
12
39
|
constructor(workbookManager, address, newContent) {
|
|
13
40
|
this.workbookManager = workbookManager;
|
|
14
41
|
this.address = address;
|
|
@@ -25,6 +52,26 @@ class SetCellContentCommand {
|
|
|
25
52
|
this.previousValue = sheet.content.get(key);
|
|
26
53
|
}
|
|
27
54
|
this.workbookManager.setCellContent(this.address, this.newContent);
|
|
55
|
+
this.executeFootprint = {
|
|
56
|
+
touchedCells: buildTouchedCells([
|
|
57
|
+
{
|
|
58
|
+
address: this.address,
|
|
59
|
+
before: this.previousValue,
|
|
60
|
+
after: this.newContent
|
|
61
|
+
}
|
|
62
|
+
]),
|
|
63
|
+
resourceKeys: []
|
|
64
|
+
};
|
|
65
|
+
this.undoFootprint = {
|
|
66
|
+
touchedCells: buildTouchedCells([
|
|
67
|
+
{
|
|
68
|
+
address: this.address,
|
|
69
|
+
before: this.newContent,
|
|
70
|
+
after: this.hadPreviousValue ? this.previousValue : undefined
|
|
71
|
+
}
|
|
72
|
+
]),
|
|
73
|
+
resourceKeys: []
|
|
74
|
+
};
|
|
28
75
|
}
|
|
29
76
|
undo() {
|
|
30
77
|
if (this.hadPreviousValue) {
|
|
@@ -33,6 +80,9 @@ class SetCellContentCommand {
|
|
|
33
80
|
this.workbookManager.setCellContent(this.address, undefined);
|
|
34
81
|
}
|
|
35
82
|
}
|
|
83
|
+
getInvalidationFootprint(phase) {
|
|
84
|
+
return phase === "execute" ? this.executeFootprint : this.undoFootprint;
|
|
85
|
+
}
|
|
36
86
|
toAction() {
|
|
37
87
|
return {
|
|
38
88
|
type: ActionTypes.SET_CELL_CONTENT,
|
|
@@ -50,6 +100,8 @@ class SetSheetContentCommand {
|
|
|
50
100
|
newContent;
|
|
51
101
|
requiresReevaluation = true;
|
|
52
102
|
previousContent;
|
|
103
|
+
executeFootprint = emptyMutationInvalidation();
|
|
104
|
+
undoFootprint = emptyMutationInvalidation();
|
|
53
105
|
constructor(workbookManager, opts, newContent) {
|
|
54
106
|
this.workbookManager = workbookManager;
|
|
55
107
|
this.opts = opts;
|
|
@@ -61,12 +113,44 @@ class SetSheetContentCommand {
|
|
|
61
113
|
this.previousContent = new Map(sheet.content);
|
|
62
114
|
}
|
|
63
115
|
this.workbookManager.setSheetContent(this.opts, this.newContent);
|
|
116
|
+
const touchedKeys = new Set([
|
|
117
|
+
...Array.from(this.previousContent?.keys() ?? []),
|
|
118
|
+
...Array.from(this.newContent.keys())
|
|
119
|
+
]);
|
|
120
|
+
const touchedCells = buildTouchedCells(Array.from(touchedKeys, (key) => ({
|
|
121
|
+
address: {
|
|
122
|
+
workbookName: this.opts.workbookName,
|
|
123
|
+
sheetName: this.opts.sheetName,
|
|
124
|
+
...parseCellReference(key)
|
|
125
|
+
},
|
|
126
|
+
before: this.previousContent?.get(key),
|
|
127
|
+
after: this.newContent.get(key)
|
|
128
|
+
})));
|
|
129
|
+
this.executeFootprint = {
|
|
130
|
+
touchedCells,
|
|
131
|
+
resourceKeys: []
|
|
132
|
+
};
|
|
133
|
+
this.undoFootprint = {
|
|
134
|
+
touchedCells: buildTouchedCells(Array.from(touchedKeys, (key) => ({
|
|
135
|
+
address: {
|
|
136
|
+
workbookName: this.opts.workbookName,
|
|
137
|
+
sheetName: this.opts.sheetName,
|
|
138
|
+
...parseCellReference(key)
|
|
139
|
+
},
|
|
140
|
+
before: this.newContent.get(key),
|
|
141
|
+
after: this.previousContent?.get(key)
|
|
142
|
+
}))),
|
|
143
|
+
resourceKeys: []
|
|
144
|
+
};
|
|
64
145
|
}
|
|
65
146
|
undo() {
|
|
66
147
|
if (this.previousContent) {
|
|
67
148
|
this.workbookManager.setSheetContent(this.opts, this.previousContent);
|
|
68
149
|
}
|
|
69
150
|
}
|
|
151
|
+
getInvalidationFootprint(phase) {
|
|
152
|
+
return phase === "execute" ? this.executeFootprint : this.undoFootprint;
|
|
153
|
+
}
|
|
70
154
|
toAction() {
|
|
71
155
|
return {
|
|
72
156
|
type: ActionTypes.SET_SHEET_CONTENT,
|
|
@@ -83,11 +167,14 @@ class ClearRangeCommand {
|
|
|
83
167
|
address;
|
|
84
168
|
requiresReevaluation = true;
|
|
85
169
|
clearedCells = new Map;
|
|
170
|
+
executeFootprint = emptyMutationInvalidation();
|
|
171
|
+
undoFootprint = emptyMutationInvalidation();
|
|
86
172
|
constructor(workbookManager, address) {
|
|
87
173
|
this.workbookManager = workbookManager;
|
|
88
174
|
this.address = address;
|
|
89
175
|
}
|
|
90
176
|
execute() {
|
|
177
|
+
this.clearedCells.clear();
|
|
91
178
|
try {
|
|
92
179
|
for (const cellAddress of this.workbookManager.iterateCellsInRange(this.address)) {
|
|
93
180
|
const key = getCellReference(cellAddress);
|
|
@@ -98,6 +185,30 @@ class ClearRangeCommand {
|
|
|
98
185
|
}
|
|
99
186
|
} catch {}
|
|
100
187
|
this.workbookManager.clearSpreadsheetRange(this.address);
|
|
188
|
+
this.executeFootprint = {
|
|
189
|
+
touchedCells: buildTouchedCells(Array.from(this.clearedCells.entries(), ([key, before]) => ({
|
|
190
|
+
address: {
|
|
191
|
+
workbookName: this.address.workbookName,
|
|
192
|
+
sheetName: this.address.sheetName,
|
|
193
|
+
...parseCellReference(key)
|
|
194
|
+
},
|
|
195
|
+
before,
|
|
196
|
+
after: undefined
|
|
197
|
+
}))),
|
|
198
|
+
resourceKeys: []
|
|
199
|
+
};
|
|
200
|
+
this.undoFootprint = {
|
|
201
|
+
touchedCells: buildTouchedCells(Array.from(this.clearedCells.entries(), ([key, after]) => ({
|
|
202
|
+
address: {
|
|
203
|
+
workbookName: this.address.workbookName,
|
|
204
|
+
sheetName: this.address.sheetName,
|
|
205
|
+
...parseCellReference(key)
|
|
206
|
+
},
|
|
207
|
+
before: undefined,
|
|
208
|
+
after
|
|
209
|
+
}))),
|
|
210
|
+
resourceKeys: []
|
|
211
|
+
};
|
|
101
212
|
}
|
|
102
213
|
undo() {
|
|
103
214
|
for (const [key, value] of this.clearedCells) {
|
|
@@ -110,6 +221,9 @@ class ClearRangeCommand {
|
|
|
110
221
|
}, value);
|
|
111
222
|
}
|
|
112
223
|
}
|
|
224
|
+
getInvalidationFootprint(phase) {
|
|
225
|
+
return phase === "execute" ? this.executeFootprint : this.undoFootprint;
|
|
226
|
+
}
|
|
113
227
|
toAction() {
|
|
114
228
|
return {
|
|
115
229
|
type: ActionTypes.CLEAR_RANGE,
|
|
@@ -129,6 +243,9 @@ class PasteCellsCommand {
|
|
|
129
243
|
requiresReevaluation = true;
|
|
130
244
|
targetSnapshots = [];
|
|
131
245
|
sourceSnapshots = [];
|
|
246
|
+
executeFootprint = emptyMutationInvalidation();
|
|
247
|
+
undoFootprint = emptyMutationInvalidation();
|
|
248
|
+
executedContents = new Map;
|
|
132
249
|
constructor(workbookManager, copyManager, source, target, options) {
|
|
133
250
|
this.workbookManager = workbookManager;
|
|
134
251
|
this.copyManager = copyManager;
|
|
@@ -137,6 +254,9 @@ class PasteCellsCommand {
|
|
|
137
254
|
this.options = options;
|
|
138
255
|
}
|
|
139
256
|
execute() {
|
|
257
|
+
this.targetSnapshots = [];
|
|
258
|
+
this.sourceSnapshots = [];
|
|
259
|
+
this.executedContents.clear();
|
|
140
260
|
if (this.source.length > 0) {
|
|
141
261
|
const firstSource = this.source[0];
|
|
142
262
|
const colOffset = this.target.colIndex - firstSource.colIndex;
|
|
@@ -179,6 +299,22 @@ class PasteCellsCommand {
|
|
|
179
299
|
}
|
|
180
300
|
}
|
|
181
301
|
this.copyManager.pasteCells(this.source, this.target, this.options);
|
|
302
|
+
const touchedAddresses = [
|
|
303
|
+
...this.targetSnapshots.map((snapshot) => snapshot.address),
|
|
304
|
+
...this.sourceSnapshots.map((snapshot) => snapshot.address)
|
|
305
|
+
];
|
|
306
|
+
this.executedContents = captureCellContents(this.workbookManager, touchedAddresses);
|
|
307
|
+
this.executeFootprint = {
|
|
308
|
+
touchedCells: buildTouchedCells(touchedAddresses.map((address) => {
|
|
309
|
+
const beforeSnapshot = this.targetSnapshots.find((snapshot) => snapshot.address.workbookName === address.workbookName && snapshot.address.sheetName === address.sheetName && snapshot.address.colIndex === address.colIndex && snapshot.address.rowIndex === address.rowIndex) ?? this.sourceSnapshots.find((snapshot) => snapshot.address.workbookName === address.workbookName && snapshot.address.sheetName === address.sheetName && snapshot.address.colIndex === address.colIndex && snapshot.address.rowIndex === address.rowIndex);
|
|
310
|
+
return {
|
|
311
|
+
address,
|
|
312
|
+
before: beforeSnapshot?.content,
|
|
313
|
+
after: this.executedContents.get(getAddressKey(address))
|
|
314
|
+
};
|
|
315
|
+
})),
|
|
316
|
+
resourceKeys: []
|
|
317
|
+
};
|
|
182
318
|
}
|
|
183
319
|
undo() {
|
|
184
320
|
for (const snapshot of this.targetSnapshots) {
|
|
@@ -195,6 +331,23 @@ class PasteCellsCommand {
|
|
|
195
331
|
}
|
|
196
332
|
}
|
|
197
333
|
}
|
|
334
|
+
const touchedAddresses = [
|
|
335
|
+
...this.targetSnapshots.map((snapshot) => snapshot.address),
|
|
336
|
+
...this.sourceSnapshots.map((snapshot) => snapshot.address)
|
|
337
|
+
];
|
|
338
|
+
this.undoFootprint = {
|
|
339
|
+
touchedCells: buildTouchedCells(touchedAddresses.map((address) => {
|
|
340
|
+
return {
|
|
341
|
+
address,
|
|
342
|
+
before: this.executedContents.get(getAddressKey(address)),
|
|
343
|
+
after: this.workbookManager.getCellContent(address)
|
|
344
|
+
};
|
|
345
|
+
})),
|
|
346
|
+
resourceKeys: []
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
getInvalidationFootprint(phase) {
|
|
350
|
+
return phase === "execute" ? this.executeFootprint : this.undoFootprint;
|
|
198
351
|
}
|
|
199
352
|
toAction() {
|
|
200
353
|
return {
|
|
@@ -216,6 +369,9 @@ class FillAreasCommand {
|
|
|
216
369
|
options;
|
|
217
370
|
requiresReevaluation = true;
|
|
218
371
|
targetSnapshots = new Map;
|
|
372
|
+
executeFootprint = emptyMutationInvalidation();
|
|
373
|
+
undoFootprint = emptyMutationInvalidation();
|
|
374
|
+
executedContents = new Map;
|
|
219
375
|
constructor(workbookManager, copyManager, seedRange, targetRanges, options) {
|
|
220
376
|
this.workbookManager = workbookManager;
|
|
221
377
|
this.copyManager = copyManager;
|
|
@@ -224,6 +380,8 @@ class FillAreasCommand {
|
|
|
224
380
|
this.options = options;
|
|
225
381
|
}
|
|
226
382
|
execute() {
|
|
383
|
+
this.targetSnapshots.clear();
|
|
384
|
+
this.executedContents.clear();
|
|
227
385
|
for (const targetRange of this.targetRanges) {
|
|
228
386
|
const sheet = this.workbookManager.getSheet({
|
|
229
387
|
workbookName: targetRange.workbookName,
|
|
@@ -255,6 +413,16 @@ class FillAreasCommand {
|
|
|
255
413
|
}
|
|
256
414
|
}
|
|
257
415
|
this.copyManager.fillAreas(this.seedRange, this.targetRanges, this.options);
|
|
416
|
+
const touchedAddresses = Array.from(this.targetSnapshots.values()).map((snapshot) => snapshot.address);
|
|
417
|
+
this.executedContents = captureCellContents(this.workbookManager, touchedAddresses);
|
|
418
|
+
this.executeFootprint = {
|
|
419
|
+
touchedCells: buildTouchedCells(touchedAddresses.map((address) => ({
|
|
420
|
+
address,
|
|
421
|
+
before: this.targetSnapshots.get(getAddressKey(address))?.content,
|
|
422
|
+
after: this.executedContents.get(getAddressKey(address))
|
|
423
|
+
}))),
|
|
424
|
+
resourceKeys: []
|
|
425
|
+
};
|
|
258
426
|
}
|
|
259
427
|
undo() {
|
|
260
428
|
for (const snapshot of this.targetSnapshots.values()) {
|
|
@@ -263,6 +431,18 @@ class FillAreasCommand {
|
|
|
263
431
|
this.workbookManager.setCellMetadata(snapshot.address, snapshot.metadata);
|
|
264
432
|
}
|
|
265
433
|
}
|
|
434
|
+
const touchedAddresses = Array.from(this.targetSnapshots.values()).map((snapshot) => snapshot.address);
|
|
435
|
+
this.undoFootprint = {
|
|
436
|
+
touchedCells: buildTouchedCells(touchedAddresses.map((address) => ({
|
|
437
|
+
address,
|
|
438
|
+
before: this.executedContents.get(getAddressKey(address)),
|
|
439
|
+
after: this.workbookManager.getCellContent(address)
|
|
440
|
+
}))),
|
|
441
|
+
resourceKeys: []
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
getInvalidationFootprint(phase) {
|
|
445
|
+
return phase === "execute" ? this.executeFootprint : this.undoFootprint;
|
|
266
446
|
}
|
|
267
447
|
toAction() {
|
|
268
448
|
return {
|
|
@@ -284,6 +464,9 @@ class MoveCellCommand {
|
|
|
284
464
|
requiresReevaluation = true;
|
|
285
465
|
sourceSnapshot;
|
|
286
466
|
targetSnapshot;
|
|
467
|
+
executeFootprint = emptyMutationInvalidation();
|
|
468
|
+
undoFootprint = emptyMutationInvalidation();
|
|
469
|
+
executedContents = new Map;
|
|
287
470
|
constructor(workbookManager, copyManager, source, target) {
|
|
288
471
|
this.workbookManager = workbookManager;
|
|
289
472
|
this.copyManager = copyManager;
|
|
@@ -291,6 +474,9 @@ class MoveCellCommand {
|
|
|
291
474
|
this.target = target;
|
|
292
475
|
}
|
|
293
476
|
execute() {
|
|
477
|
+
this.sourceSnapshot = undefined;
|
|
478
|
+
this.targetSnapshot = undefined;
|
|
479
|
+
this.executedContents.clear();
|
|
294
480
|
const sourceSheet = this.workbookManager.getSheet({
|
|
295
481
|
workbookName: this.source.workbookName,
|
|
296
482
|
sheetName: this.source.sheetName
|
|
@@ -320,6 +506,16 @@ class MoveCellCommand {
|
|
|
320
506
|
type: "formula",
|
|
321
507
|
include: "all"
|
|
322
508
|
});
|
|
509
|
+
const touchedAddresses = [this.source, this.target];
|
|
510
|
+
this.executedContents = captureCellContents(this.workbookManager, touchedAddresses);
|
|
511
|
+
this.executeFootprint = {
|
|
512
|
+
touchedCells: buildTouchedCells(touchedAddresses.map((address) => ({
|
|
513
|
+
address,
|
|
514
|
+
before: this.sourceSnapshot?.address === address ? this.sourceSnapshot.content : this.targetSnapshot?.content,
|
|
515
|
+
after: this.executedContents.get(getAddressKey(address))
|
|
516
|
+
}))),
|
|
517
|
+
resourceKeys: []
|
|
518
|
+
};
|
|
323
519
|
}
|
|
324
520
|
undo() {
|
|
325
521
|
if (this.sourceSnapshot) {
|
|
@@ -334,6 +530,18 @@ class MoveCellCommand {
|
|
|
334
530
|
this.workbookManager.setCellMetadata(this.targetSnapshot.address, this.targetSnapshot.metadata);
|
|
335
531
|
}
|
|
336
532
|
}
|
|
533
|
+
const touchedAddresses = [this.source, this.target];
|
|
534
|
+
this.undoFootprint = {
|
|
535
|
+
touchedCells: buildTouchedCells(touchedAddresses.map((address) => ({
|
|
536
|
+
address,
|
|
537
|
+
before: this.executedContents.get(getAddressKey(address)),
|
|
538
|
+
after: this.workbookManager.getCellContent(address)
|
|
539
|
+
}))),
|
|
540
|
+
resourceKeys: []
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
getInvalidationFootprint(phase) {
|
|
544
|
+
return phase === "execute" ? this.executeFootprint : this.undoFootprint;
|
|
337
545
|
}
|
|
338
546
|
toAction() {
|
|
339
547
|
return {
|
|
@@ -354,6 +562,9 @@ class MoveRangeCommand {
|
|
|
354
562
|
requiresReevaluation = true;
|
|
355
563
|
sourceSnapshots = [];
|
|
356
564
|
targetSnapshots = [];
|
|
565
|
+
executeFootprint = emptyMutationInvalidation();
|
|
566
|
+
undoFootprint = emptyMutationInvalidation();
|
|
567
|
+
executedContents = new Map;
|
|
357
568
|
constructor(workbookManager, copyManager, sourceRange, target) {
|
|
358
569
|
this.workbookManager = workbookManager;
|
|
359
570
|
this.copyManager = copyManager;
|
|
@@ -361,6 +572,9 @@ class MoveRangeCommand {
|
|
|
361
572
|
this.target = target;
|
|
362
573
|
}
|
|
363
574
|
execute() {
|
|
575
|
+
this.sourceSnapshots = [];
|
|
576
|
+
this.targetSnapshots = [];
|
|
577
|
+
this.executedContents.clear();
|
|
364
578
|
const sourceCells = this.copyManager.expandRangeToCells(this.sourceRange);
|
|
365
579
|
for (const cell of sourceCells) {
|
|
366
580
|
const sheet = this.workbookManager.getSheet({
|
|
@@ -406,6 +620,22 @@ class MoveRangeCommand {
|
|
|
406
620
|
type: "formula",
|
|
407
621
|
include: "all"
|
|
408
622
|
});
|
|
623
|
+
const touchedAddresses = [
|
|
624
|
+
...this.sourceSnapshots.map((snapshot) => snapshot.address),
|
|
625
|
+
...this.targetSnapshots.map((snapshot) => snapshot.address)
|
|
626
|
+
];
|
|
627
|
+
this.executedContents = captureCellContents(this.workbookManager, touchedAddresses);
|
|
628
|
+
this.executeFootprint = {
|
|
629
|
+
touchedCells: buildTouchedCells(touchedAddresses.map((address) => {
|
|
630
|
+
const snapshot = this.sourceSnapshots.find((candidate) => getAddressKey(candidate.address) === getAddressKey(address)) ?? this.targetSnapshots.find((candidate) => getAddressKey(candidate.address) === getAddressKey(address));
|
|
631
|
+
return {
|
|
632
|
+
address,
|
|
633
|
+
before: snapshot?.content,
|
|
634
|
+
after: this.executedContents.get(getAddressKey(address))
|
|
635
|
+
};
|
|
636
|
+
})),
|
|
637
|
+
resourceKeys: []
|
|
638
|
+
};
|
|
409
639
|
}
|
|
410
640
|
undo() {
|
|
411
641
|
for (const snapshot of this.sourceSnapshots) {
|
|
@@ -420,6 +650,21 @@ class MoveRangeCommand {
|
|
|
420
650
|
this.workbookManager.setCellMetadata(snapshot.address, snapshot.metadata);
|
|
421
651
|
}
|
|
422
652
|
}
|
|
653
|
+
const touchedAddresses = [
|
|
654
|
+
...this.sourceSnapshots.map((snapshot) => snapshot.address),
|
|
655
|
+
...this.targetSnapshots.map((snapshot) => snapshot.address)
|
|
656
|
+
];
|
|
657
|
+
this.undoFootprint = {
|
|
658
|
+
touchedCells: buildTouchedCells(touchedAddresses.map((address) => ({
|
|
659
|
+
address,
|
|
660
|
+
before: this.executedContents.get(getAddressKey(address)),
|
|
661
|
+
after: this.workbookManager.getCellContent(address)
|
|
662
|
+
}))),
|
|
663
|
+
resourceKeys: []
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
getInvalidationFootprint(phase) {
|
|
667
|
+
return phase === "execute" ? this.executeFootprint : this.undoFootprint;
|
|
423
668
|
}
|
|
424
669
|
toAction() {
|
|
425
670
|
return {
|
|
@@ -443,6 +688,10 @@ class AutoFillCommand {
|
|
|
443
688
|
requiresReevaluation = true;
|
|
444
689
|
previousContent = new Map;
|
|
445
690
|
previousMetadata = new Map;
|
|
691
|
+
executeFootprint = emptyMutationInvalidation();
|
|
692
|
+
undoFootprint = emptyMutationInvalidation();
|
|
693
|
+
touchedAddresses = [];
|
|
694
|
+
executedContents = new Map;
|
|
446
695
|
constructor(workbookManager, styleManager, autoFillManager, opts, seedRange, fillRanges, direction) {
|
|
447
696
|
this.workbookManager = workbookManager;
|
|
448
697
|
this.styleManager = styleManager;
|
|
@@ -453,6 +702,10 @@ class AutoFillCommand {
|
|
|
453
702
|
this.direction = direction;
|
|
454
703
|
}
|
|
455
704
|
execute() {
|
|
705
|
+
this.previousContent.clear();
|
|
706
|
+
this.previousMetadata.clear();
|
|
707
|
+
this.touchedAddresses = [];
|
|
708
|
+
this.executedContents.clear();
|
|
456
709
|
for (const fillRange of this.fillRanges) {
|
|
457
710
|
if (fillRange.end.col.type === "infinity" || fillRange.end.row.type === "infinity") {
|
|
458
711
|
continue;
|
|
@@ -470,6 +723,7 @@ class AutoFillCommand {
|
|
|
470
723
|
colIndex: col,
|
|
471
724
|
rowIndex: row
|
|
472
725
|
};
|
|
726
|
+
this.touchedAddresses.push(address);
|
|
473
727
|
const content = this.workbookManager.getCellContent(address);
|
|
474
728
|
if (content !== undefined) {
|
|
475
729
|
this.previousContent.set(key, content);
|
|
@@ -482,6 +736,18 @@ class AutoFillCommand {
|
|
|
482
736
|
}
|
|
483
737
|
}
|
|
484
738
|
this.autoFillManager.fill(this.opts, this.seedRange, this.fillRanges, this.direction);
|
|
739
|
+
this.executedContents = captureCellContents(this.workbookManager, this.touchedAddresses);
|
|
740
|
+
this.executeFootprint = {
|
|
741
|
+
touchedCells: buildTouchedCells(this.touchedAddresses.map((address) => {
|
|
742
|
+
const key = getCellReference(address);
|
|
743
|
+
return {
|
|
744
|
+
address,
|
|
745
|
+
before: this.previousContent.get(key),
|
|
746
|
+
after: this.executedContents.get(getAddressKey(address))
|
|
747
|
+
};
|
|
748
|
+
})),
|
|
749
|
+
resourceKeys: []
|
|
750
|
+
};
|
|
485
751
|
}
|
|
486
752
|
undo() {
|
|
487
753
|
const currentContent = this.workbookManager.getSheetSerialized(this.opts);
|
|
@@ -517,6 +783,17 @@ class AutoFillCommand {
|
|
|
517
783
|
}
|
|
518
784
|
}
|
|
519
785
|
this.workbookManager.setSheetContent(this.opts, newContent);
|
|
786
|
+
this.undoFootprint = {
|
|
787
|
+
touchedCells: buildTouchedCells(this.touchedAddresses.map((address) => ({
|
|
788
|
+
address,
|
|
789
|
+
before: this.executedContents.get(getAddressKey(address)),
|
|
790
|
+
after: this.workbookManager.getCellContent(address)
|
|
791
|
+
}))),
|
|
792
|
+
resourceKeys: []
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
getInvalidationFootprint(phase) {
|
|
796
|
+
return phase === "execute" ? this.executeFootprint : this.undoFootprint;
|
|
520
797
|
}
|
|
521
798
|
toAction() {
|
|
522
799
|
return {
|
|
@@ -541,4 +818,4 @@ export {
|
|
|
541
818
|
AutoFillCommand
|
|
542
819
|
};
|
|
543
820
|
|
|
544
|
-
//# debugId=
|
|
821
|
+
//# debugId=827AAF04E7067A3964756E2164756E21
|