@cj-tech-master/excelts 9.2.1 → 9.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -2
- package/README_zh.md +29 -6
- package/dist/browser/index.browser.d.ts +1 -1
- package/dist/browser/index.browser.js +4 -0
- package/dist/browser/index.d.ts +1 -1
- package/dist/browser/index.js +4 -0
- package/dist/browser/modules/excel/cell.d.ts +17 -3
- package/dist/browser/modules/excel/cell.js +170 -22
- package/dist/browser/modules/excel/defined-names.d.ts +96 -1
- package/dist/browser/modules/excel/defined-names.js +411 -21
- package/dist/browser/modules/excel/image.d.ts +11 -0
- package/dist/browser/modules/excel/image.js +24 -1
- package/dist/browser/modules/excel/stream/workbook-reader.browser.d.ts +9 -3
- package/dist/browser/modules/excel/stream/workbook-reader.browser.js +14 -0
- package/dist/browser/modules/excel/stream/workbook-reader.d.ts +2 -1
- package/dist/browser/modules/excel/stream/workbook-writer.browser.d.ts +39 -5
- package/dist/browser/modules/excel/stream/workbook-writer.browser.js +48 -1
- package/dist/browser/modules/excel/stream/workbook-writer.d.ts +3 -2
- package/dist/browser/modules/excel/stream/worksheet-reader.js +17 -1
- package/dist/browser/modules/excel/stream/worksheet-writer.d.ts +39 -6
- package/dist/browser/modules/excel/stream/worksheet-writer.js +45 -5
- package/dist/browser/modules/excel/table.js +15 -2
- package/dist/browser/modules/excel/types.d.ts +133 -2
- package/dist/browser/modules/excel/utils/col-cache.d.ts +1 -0
- package/dist/browser/modules/excel/utils/col-cache.js +15 -0
- package/dist/browser/modules/excel/utils/drawing-utils.d.ts +3 -3
- package/dist/browser/modules/excel/utils/drawing-utils.js +4 -0
- package/dist/browser/modules/excel/utils/external-link-formula.d.ts +76 -0
- package/dist/browser/modules/excel/utils/external-link-formula.js +208 -0
- package/dist/browser/modules/excel/utils/iterate-stream.d.ts +9 -3
- package/dist/browser/modules/excel/utils/iterate-stream.js +3 -1
- package/dist/browser/modules/excel/utils/ooxml-paths.d.ts +19 -0
- package/dist/browser/modules/excel/utils/ooxml-paths.js +37 -2
- package/dist/browser/modules/excel/utils/shared-strings.d.ts +8 -3
- package/dist/browser/modules/excel/utils/shared-strings.js +21 -2
- package/dist/browser/modules/excel/utils/workbook-protection.d.ts +30 -0
- package/dist/browser/modules/excel/utils/workbook-protection.js +30 -0
- package/dist/browser/modules/excel/workbook.browser.d.ts +257 -6
- package/dist/browser/modules/excel/workbook.browser.js +318 -34
- package/dist/browser/modules/excel/workbook.d.ts +1 -1
- package/dist/browser/modules/excel/worksheet.d.ts +3 -1
- package/dist/browser/modules/excel/worksheet.js +21 -2
- package/dist/browser/modules/excel/xlsx/rel-type.d.ts +15 -0
- package/dist/browser/modules/excel/xlsx/rel-type.js +16 -1
- package/dist/browser/modules/excel/xlsx/xform/book/defined-name-xform.d.ts +6 -5
- package/dist/browser/modules/excel/xlsx/xform/book/defined-name-xform.js +21 -86
- package/dist/browser/modules/excel/xlsx/xform/book/external-link-xform.d.ts +84 -0
- package/dist/browser/modules/excel/xlsx/xform/book/external-link-xform.js +330 -0
- package/dist/browser/modules/excel/xlsx/xform/book/external-reference-xform.d.ts +17 -0
- package/dist/browser/modules/excel/xlsx/xform/book/external-reference-xform.js +24 -0
- package/dist/browser/modules/excel/xlsx/xform/book/workbook-calc-properties-xform.d.ts +3 -0
- package/dist/browser/modules/excel/xlsx/xform/book/workbook-calc-properties-xform.js +11 -2
- package/dist/browser/modules/excel/xlsx/xform/book/workbook-protection-xform.d.ts +20 -0
- package/dist/browser/modules/excel/xlsx/xform/book/workbook-protection-xform.js +66 -0
- package/dist/browser/modules/excel/xlsx/xform/book/workbook-xform.js +38 -5
- package/dist/browser/modules/excel/xlsx/xform/core/content-types-xform.js +19 -1
- package/dist/browser/modules/excel/xlsx/xform/core/metadata-xform.d.ts +56 -0
- package/dist/browser/modules/excel/xlsx/xform/core/metadata-xform.js +158 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.d.ts +26 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +105 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +3 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/drawing-xform.js +10 -2
- package/dist/browser/modules/excel/xlsx/xform/sheet/cell-xform.d.ts +1 -1
- package/dist/browser/modules/excel/xlsx/xform/sheet/cell-xform.js +166 -8
- package/dist/browser/modules/excel/xlsx/xform/sheet/data-validations-xform.js +1 -1
- package/dist/browser/modules/excel/xlsx/xform/sheet/ignored-errors-xform.d.ts +21 -0
- package/dist/browser/modules/excel/xlsx/xform/sheet/ignored-errors-xform.js +80 -0
- package/dist/browser/modules/excel/xlsx/xform/sheet/worksheet-xform.js +9 -4
- package/dist/browser/modules/excel/xlsx/xform/style/border-xform.js +4 -1
- package/dist/browser/modules/excel/xlsx/xlsx.browser.d.ts +172 -13
- package/dist/browser/modules/excel/xlsx/xlsx.browser.js +410 -20
- package/dist/browser/modules/excel/xlsx/xlsx.d.ts +7 -4
- package/dist/browser/modules/excel/xlsx/xlsx.js +4 -5
- package/dist/browser/modules/formula/compile/address-utils.d.ts +62 -0
- package/dist/browser/modules/formula/compile/address-utils.js +83 -0
- package/dist/browser/modules/formula/compile/binder.d.ts +42 -0
- package/dist/browser/modules/formula/compile/binder.js +487 -0
- package/dist/browser/modules/formula/compile/bound-ast.d.ts +230 -0
- package/dist/browser/modules/formula/compile/bound-ast.js +80 -0
- package/dist/browser/modules/formula/compile/compiled-formula.d.ts +137 -0
- package/dist/browser/modules/formula/compile/compiled-formula.js +383 -0
- package/dist/browser/modules/formula/compile/dependency-analysis.d.ts +93 -0
- package/dist/browser/modules/formula/compile/dependency-analysis.js +432 -0
- package/dist/browser/modules/formula/compile/structured-ref-utils.d.ts +93 -0
- package/dist/browser/modules/formula/compile/structured-ref-utils.js +136 -0
- package/dist/browser/modules/formula/default-syntax-probe.d.ts +79 -0
- package/dist/browser/modules/formula/default-syntax-probe.js +83 -0
- package/dist/browser/modules/formula/functions/_date-context.d.ts +4 -0
- package/dist/browser/modules/formula/functions/_date-context.js +29 -0
- package/dist/browser/modules/formula/functions/_shared.d.ts +121 -0
- package/dist/browser/modules/formula/functions/_shared.js +381 -0
- package/dist/browser/modules/formula/functions/conditional.d.ts +27 -0
- package/dist/browser/modules/formula/functions/conditional.js +343 -0
- package/dist/browser/modules/formula/functions/database.d.ts +37 -0
- package/dist/browser/modules/formula/functions/database.js +274 -0
- package/dist/browser/modules/formula/functions/date.d.ts +61 -0
- package/dist/browser/modules/formula/functions/date.js +855 -0
- package/dist/browser/modules/formula/functions/dynamic-array.d.ts +23 -0
- package/dist/browser/modules/formula/functions/dynamic-array.js +860 -0
- package/dist/browser/modules/formula/functions/engineering.d.ts +57 -0
- package/dist/browser/modules/formula/functions/engineering.js +1128 -0
- package/dist/browser/modules/formula/functions/financial.d.ts +202 -0
- package/dist/browser/modules/formula/functions/financial.js +2296 -0
- package/dist/browser/modules/formula/functions/lookup.d.ts +18 -0
- package/dist/browser/modules/formula/functions/lookup.js +886 -0
- package/dist/browser/modules/formula/functions/math.d.ts +114 -0
- package/dist/browser/modules/formula/functions/math.js +1406 -0
- package/dist/browser/modules/formula/functions/statistical.d.ts +193 -0
- package/dist/browser/modules/formula/functions/statistical.js +3390 -0
- package/dist/browser/modules/formula/functions/text.d.ts +86 -0
- package/dist/browser/modules/formula/functions/text.js +1845 -0
- package/dist/browser/modules/formula/host-registry.d.ts +53 -0
- package/dist/browser/modules/formula/host-registry.js +69 -0
- package/dist/browser/modules/formula/index.d.ts +39 -0
- package/dist/browser/modules/formula/index.js +49 -0
- package/dist/browser/modules/formula/install.d.ts +62 -0
- package/dist/browser/modules/formula/install.js +88 -0
- package/dist/browser/modules/formula/integration/apply-writeback-plan.d.ts +26 -0
- package/dist/browser/modules/formula/integration/apply-writeback-plan.js +210 -0
- package/dist/browser/modules/formula/integration/calculate-formulas-impl.d.ts +30 -0
- package/dist/browser/modules/formula/integration/calculate-formulas-impl.js +616 -0
- package/dist/browser/modules/formula/integration/calculate-formulas.d.ts +67 -0
- package/dist/browser/modules/formula/integration/calculate-formulas.js +68 -0
- package/dist/browser/modules/formula/integration/formula-instance.d.ts +64 -0
- package/dist/browser/modules/formula/integration/formula-instance.js +79 -0
- package/dist/browser/modules/formula/integration/workbook-adapter.d.ts +26 -0
- package/dist/browser/modules/formula/integration/workbook-adapter.js +324 -0
- package/dist/browser/modules/formula/integration/workbook-snapshot.d.ts +267 -0
- package/dist/browser/modules/formula/integration/workbook-snapshot.js +77 -0
- package/dist/browser/modules/formula/materialize/build-writeback-plan.d.ts +34 -0
- package/dist/browser/modules/formula/materialize/build-writeback-plan.js +473 -0
- package/dist/browser/modules/formula/materialize/spill-engine.d.ts +9 -0
- package/dist/browser/modules/formula/materialize/spill-engine.js +38 -0
- package/dist/browser/modules/formula/materialize/types.d.ts +179 -0
- package/dist/browser/modules/formula/materialize/types.js +29 -0
- package/dist/browser/modules/formula/materialize/writeback-plan.d.ts +167 -0
- package/dist/browser/modules/formula/materialize/writeback-plan.js +27 -0
- package/dist/browser/modules/formula/runtime/evaluator.d.ts +151 -0
- package/dist/browser/modules/formula/runtime/evaluator.js +2291 -0
- package/dist/browser/modules/formula/runtime/function-registry.d.ts +47 -0
- package/dist/browser/modules/formula/runtime/function-registry.js +840 -0
- package/dist/browser/modules/formula/runtime/values.d.ts +211 -0
- package/dist/browser/modules/formula/runtime/values.js +385 -0
- package/dist/browser/modules/formula/syntax/ast.d.ts +129 -0
- package/dist/browser/modules/formula/syntax/ast.js +28 -0
- package/dist/browser/modules/formula/syntax/parser.d.ts +18 -0
- package/dist/browser/modules/formula/syntax/parser.js +439 -0
- package/dist/browser/modules/formula/syntax/token-types.d.ts +153 -0
- package/dist/browser/modules/formula/syntax/token-types.js +59 -0
- package/dist/browser/modules/formula/syntax/tokenizer.d.ts +10 -0
- package/dist/browser/modules/formula/syntax/tokenizer.js +1074 -0
- package/dist/browser/modules/pdf/excel-bridge.js +9 -0
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/modules/excel/cell.js +170 -22
- package/dist/cjs/modules/excel/defined-names.js +411 -21
- package/dist/cjs/modules/excel/image.js +24 -1
- package/dist/cjs/modules/excel/stream/workbook-reader.browser.js +14 -0
- package/dist/cjs/modules/excel/stream/workbook-writer.browser.js +48 -1
- package/dist/cjs/modules/excel/stream/worksheet-reader.js +17 -1
- package/dist/cjs/modules/excel/stream/worksheet-writer.js +45 -5
- package/dist/cjs/modules/excel/table.js +15 -2
- package/dist/cjs/modules/excel/utils/col-cache.js +15 -0
- package/dist/cjs/modules/excel/utils/drawing-utils.js +4 -0
- package/dist/cjs/modules/excel/utils/external-link-formula.js +212 -0
- package/dist/cjs/modules/excel/utils/iterate-stream.js +3 -1
- package/dist/cjs/modules/excel/utils/ooxml-paths.js +42 -2
- package/dist/cjs/modules/excel/utils/shared-strings.js +21 -2
- package/dist/cjs/modules/excel/utils/workbook-protection.js +33 -0
- package/dist/cjs/modules/excel/workbook.browser.js +318 -34
- package/dist/cjs/modules/excel/worksheet.js +20 -1
- package/dist/cjs/modules/excel/xlsx/rel-type.js +16 -1
- package/dist/cjs/modules/excel/xlsx/xform/book/defined-name-xform.js +21 -86
- package/dist/cjs/modules/excel/xlsx/xform/book/external-link-xform.js +333 -0
- package/dist/cjs/modules/excel/xlsx/xform/book/external-reference-xform.js +27 -0
- package/dist/cjs/modules/excel/xlsx/xform/book/workbook-calc-properties-xform.js +11 -2
- package/dist/cjs/modules/excel/xlsx/xform/book/workbook-protection-xform.js +69 -0
- package/dist/cjs/modules/excel/xlsx/xform/book/workbook-xform.js +38 -5
- package/dist/cjs/modules/excel/xlsx/xform/core/content-types-xform.js +18 -0
- package/dist/cjs/modules/excel/xlsx/xform/core/metadata-xform.js +161 -0
- package/dist/cjs/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +108 -0
- package/dist/cjs/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +3 -0
- package/dist/cjs/modules/excel/xlsx/xform/drawing/drawing-xform.js +10 -2
- package/dist/cjs/modules/excel/xlsx/xform/sheet/cell-xform.js +166 -8
- package/dist/cjs/modules/excel/xlsx/xform/sheet/data-validations-xform.js +1 -1
- package/dist/cjs/modules/excel/xlsx/xform/sheet/ignored-errors-xform.js +83 -0
- package/dist/cjs/modules/excel/xlsx/xform/sheet/worksheet-xform.js +9 -4
- package/dist/cjs/modules/excel/xlsx/xform/style/border-xform.js +4 -1
- package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +408 -18
- package/dist/cjs/modules/excel/xlsx/xlsx.js +4 -5
- package/dist/cjs/modules/formula/compile/address-utils.js +89 -0
- package/dist/cjs/modules/formula/compile/binder.js +489 -0
- package/dist/cjs/modules/formula/compile/bound-ast.js +68 -0
- package/dist/cjs/modules/formula/compile/compiled-formula.js +387 -0
- package/dist/cjs/modules/formula/compile/dependency-analysis.js +437 -0
- package/dist/cjs/modules/formula/compile/structured-ref-utils.js +141 -0
- package/dist/cjs/modules/formula/default-syntax-probe.js +87 -0
- package/dist/cjs/modules/formula/functions/_date-context.js +33 -0
- package/dist/cjs/modules/formula/functions/_shared.js +396 -0
- package/dist/cjs/modules/formula/functions/conditional.js +354 -0
- package/dist/cjs/modules/formula/functions/database.js +288 -0
- package/dist/cjs/modules/formula/functions/date.js +883 -0
- package/dist/cjs/modules/formula/functions/dynamic-array.js +881 -0
- package/dist/cjs/modules/formula/functions/engineering.js +1183 -0
- package/dist/cjs/modules/formula/functions/financial.js +2348 -0
- package/dist/cjs/modules/formula/functions/lookup.js +902 -0
- package/dist/cjs/modules/formula/functions/math.js +1487 -0
- package/dist/cjs/modules/formula/functions/statistical.js +3488 -0
- package/dist/cjs/modules/formula/functions/text.js +1889 -0
- package/dist/cjs/modules/formula/host-registry.js +75 -0
- package/dist/cjs/modules/formula/index.js +58 -0
- package/dist/cjs/modules/formula/install.js +93 -0
- package/dist/cjs/modules/formula/integration/apply-writeback-plan.js +213 -0
- package/dist/cjs/modules/formula/integration/calculate-formulas-impl.js +619 -0
- package/dist/cjs/modules/formula/integration/calculate-formulas.js +71 -0
- package/dist/cjs/modules/formula/integration/formula-instance.js +82 -0
- package/dist/cjs/modules/formula/integration/workbook-adapter.js +327 -0
- package/dist/cjs/modules/formula/integration/workbook-snapshot.js +84 -0
- package/dist/cjs/modules/formula/materialize/build-writeback-plan.js +475 -0
- package/dist/cjs/modules/formula/materialize/spill-engine.js +42 -0
- package/dist/cjs/modules/formula/materialize/types.js +32 -0
- package/dist/cjs/modules/formula/materialize/writeback-plan.js +28 -0
- package/dist/cjs/modules/formula/runtime/evaluator.js +2298 -0
- package/dist/cjs/modules/formula/runtime/function-registry.js +846 -0
- package/dist/cjs/modules/formula/runtime/values.js +385 -0
- package/dist/cjs/modules/formula/syntax/ast.js +8 -0
- package/dist/cjs/modules/formula/syntax/parser.js +440 -0
- package/dist/cjs/modules/formula/syntax/token-types.js +32 -0
- package/dist/cjs/modules/formula/syntax/tokenizer.js +1076 -0
- package/dist/cjs/modules/pdf/excel-bridge.js +9 -0
- package/dist/esm/index.browser.js +4 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/modules/excel/cell.js +170 -22
- package/dist/esm/modules/excel/defined-names.js +411 -21
- package/dist/esm/modules/excel/image.js +24 -1
- package/dist/esm/modules/excel/stream/workbook-reader.browser.js +14 -0
- package/dist/esm/modules/excel/stream/workbook-writer.browser.js +48 -1
- package/dist/esm/modules/excel/stream/worksheet-reader.js +17 -1
- package/dist/esm/modules/excel/stream/worksheet-writer.js +45 -5
- package/dist/esm/modules/excel/table.js +15 -2
- package/dist/esm/modules/excel/utils/col-cache.js +15 -0
- package/dist/esm/modules/excel/utils/drawing-utils.js +4 -0
- package/dist/esm/modules/excel/utils/external-link-formula.js +208 -0
- package/dist/esm/modules/excel/utils/iterate-stream.js +3 -1
- package/dist/esm/modules/excel/utils/ooxml-paths.js +37 -2
- package/dist/esm/modules/excel/utils/shared-strings.js +21 -2
- package/dist/esm/modules/excel/utils/workbook-protection.js +30 -0
- package/dist/esm/modules/excel/workbook.browser.js +318 -34
- package/dist/esm/modules/excel/worksheet.js +21 -2
- package/dist/esm/modules/excel/xlsx/rel-type.js +16 -1
- package/dist/esm/modules/excel/xlsx/xform/book/defined-name-xform.js +21 -86
- package/dist/esm/modules/excel/xlsx/xform/book/external-link-xform.js +330 -0
- package/dist/esm/modules/excel/xlsx/xform/book/external-reference-xform.js +24 -0
- package/dist/esm/modules/excel/xlsx/xform/book/workbook-calc-properties-xform.js +11 -2
- package/dist/esm/modules/excel/xlsx/xform/book/workbook-protection-xform.js +66 -0
- package/dist/esm/modules/excel/xlsx/xform/book/workbook-xform.js +38 -5
- package/dist/esm/modules/excel/xlsx/xform/core/content-types-xform.js +19 -1
- package/dist/esm/modules/excel/xlsx/xform/core/metadata-xform.js +158 -0
- package/dist/esm/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +105 -0
- package/dist/esm/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +3 -0
- package/dist/esm/modules/excel/xlsx/xform/drawing/drawing-xform.js +10 -2
- package/dist/esm/modules/excel/xlsx/xform/sheet/cell-xform.js +166 -8
- package/dist/esm/modules/excel/xlsx/xform/sheet/data-validations-xform.js +1 -1
- package/dist/esm/modules/excel/xlsx/xform/sheet/ignored-errors-xform.js +80 -0
- package/dist/esm/modules/excel/xlsx/xform/sheet/worksheet-xform.js +9 -4
- package/dist/esm/modules/excel/xlsx/xform/style/border-xform.js +4 -1
- package/dist/esm/modules/excel/xlsx/xlsx.browser.js +410 -20
- package/dist/esm/modules/excel/xlsx/xlsx.js +4 -5
- package/dist/esm/modules/formula/compile/address-utils.js +83 -0
- package/dist/esm/modules/formula/compile/binder.js +487 -0
- package/dist/esm/modules/formula/compile/bound-ast.js +80 -0
- package/dist/esm/modules/formula/compile/compiled-formula.js +383 -0
- package/dist/esm/modules/formula/compile/dependency-analysis.js +432 -0
- package/dist/esm/modules/formula/compile/structured-ref-utils.js +136 -0
- package/dist/esm/modules/formula/default-syntax-probe.js +83 -0
- package/dist/esm/modules/formula/functions/_date-context.js +29 -0
- package/dist/esm/modules/formula/functions/_shared.js +381 -0
- package/dist/esm/modules/formula/functions/conditional.js +343 -0
- package/dist/esm/modules/formula/functions/database.js +274 -0
- package/dist/esm/modules/formula/functions/date.js +855 -0
- package/dist/esm/modules/formula/functions/dynamic-array.js +860 -0
- package/dist/esm/modules/formula/functions/engineering.js +1128 -0
- package/dist/esm/modules/formula/functions/financial.js +2296 -0
- package/dist/esm/modules/formula/functions/lookup.js +886 -0
- package/dist/esm/modules/formula/functions/math.js +1406 -0
- package/dist/esm/modules/formula/functions/statistical.js +3390 -0
- package/dist/esm/modules/formula/functions/text.js +1845 -0
- package/dist/esm/modules/formula/host-registry.js +69 -0
- package/dist/esm/modules/formula/index.js +49 -0
- package/dist/esm/modules/formula/install.js +88 -0
- package/dist/esm/modules/formula/integration/apply-writeback-plan.js +210 -0
- package/dist/esm/modules/formula/integration/calculate-formulas-impl.js +616 -0
- package/dist/esm/modules/formula/integration/calculate-formulas.js +68 -0
- package/dist/esm/modules/formula/integration/formula-instance.js +79 -0
- package/dist/esm/modules/formula/integration/workbook-adapter.js +324 -0
- package/dist/esm/modules/formula/integration/workbook-snapshot.js +77 -0
- package/dist/esm/modules/formula/materialize/build-writeback-plan.js +473 -0
- package/dist/esm/modules/formula/materialize/spill-engine.js +38 -0
- package/dist/esm/modules/formula/materialize/types.js +29 -0
- package/dist/esm/modules/formula/materialize/writeback-plan.js +27 -0
- package/dist/esm/modules/formula/runtime/evaluator.js +2291 -0
- package/dist/esm/modules/formula/runtime/function-registry.js +840 -0
- package/dist/esm/modules/formula/runtime/values.js +385 -0
- package/dist/esm/modules/formula/syntax/ast.js +28 -0
- package/dist/esm/modules/formula/syntax/parser.js +439 -0
- package/dist/esm/modules/formula/syntax/token-types.js +59 -0
- package/dist/esm/modules/formula/syntax/tokenizer.js +1074 -0
- package/dist/esm/modules/pdf/excel-bridge.js +9 -0
- package/dist/iife/excelts.iife.js +2302 -373
- package/dist/iife/excelts.iife.js.map +1 -1
- package/dist/iife/excelts.iife.min.js +34 -34
- package/dist/types/index.browser.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/modules/excel/cell.d.ts +17 -3
- package/dist/types/modules/excel/defined-names.d.ts +96 -1
- package/dist/types/modules/excel/image.d.ts +11 -0
- package/dist/types/modules/excel/stream/workbook-reader.browser.d.ts +9 -3
- package/dist/types/modules/excel/stream/workbook-reader.d.ts +2 -1
- package/dist/types/modules/excel/stream/workbook-writer.browser.d.ts +39 -5
- package/dist/types/modules/excel/stream/workbook-writer.d.ts +3 -2
- package/dist/types/modules/excel/stream/worksheet-writer.d.ts +39 -6
- package/dist/types/modules/excel/types.d.ts +133 -2
- package/dist/types/modules/excel/utils/col-cache.d.ts +1 -0
- package/dist/types/modules/excel/utils/drawing-utils.d.ts +3 -3
- package/dist/types/modules/excel/utils/external-link-formula.d.ts +76 -0
- package/dist/types/modules/excel/utils/iterate-stream.d.ts +9 -3
- package/dist/types/modules/excel/utils/ooxml-paths.d.ts +19 -0
- package/dist/types/modules/excel/utils/shared-strings.d.ts +8 -3
- package/dist/types/modules/excel/utils/workbook-protection.d.ts +30 -0
- package/dist/types/modules/excel/workbook.browser.d.ts +257 -6
- package/dist/types/modules/excel/workbook.d.ts +1 -1
- package/dist/types/modules/excel/worksheet.d.ts +3 -1
- package/dist/types/modules/excel/xlsx/rel-type.d.ts +15 -0
- package/dist/types/modules/excel/xlsx/xform/book/defined-name-xform.d.ts +6 -5
- package/dist/types/modules/excel/xlsx/xform/book/external-link-xform.d.ts +84 -0
- package/dist/types/modules/excel/xlsx/xform/book/external-reference-xform.d.ts +17 -0
- package/dist/types/modules/excel/xlsx/xform/book/workbook-calc-properties-xform.d.ts +3 -0
- package/dist/types/modules/excel/xlsx/xform/book/workbook-protection-xform.d.ts +20 -0
- package/dist/types/modules/excel/xlsx/xform/core/metadata-xform.d.ts +56 -0
- package/dist/types/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.d.ts +26 -0
- package/dist/types/modules/excel/xlsx/xform/sheet/cell-xform.d.ts +1 -1
- package/dist/types/modules/excel/xlsx/xform/sheet/ignored-errors-xform.d.ts +21 -0
- package/dist/types/modules/excel/xlsx/xlsx.browser.d.ts +172 -13
- package/dist/types/modules/excel/xlsx/xlsx.d.ts +7 -4
- package/dist/types/modules/formula/compile/address-utils.d.ts +62 -0
- package/dist/types/modules/formula/compile/binder.d.ts +42 -0
- package/dist/types/modules/formula/compile/bound-ast.d.ts +230 -0
- package/dist/types/modules/formula/compile/compiled-formula.d.ts +137 -0
- package/dist/types/modules/formula/compile/dependency-analysis.d.ts +93 -0
- package/dist/types/modules/formula/compile/structured-ref-utils.d.ts +93 -0
- package/dist/types/modules/formula/default-syntax-probe.d.ts +79 -0
- package/dist/types/modules/formula/functions/_date-context.d.ts +4 -0
- package/dist/types/modules/formula/functions/_shared.d.ts +121 -0
- package/dist/types/modules/formula/functions/conditional.d.ts +27 -0
- package/dist/types/modules/formula/functions/database.d.ts +37 -0
- package/dist/types/modules/formula/functions/date.d.ts +61 -0
- package/dist/types/modules/formula/functions/dynamic-array.d.ts +23 -0
- package/dist/types/modules/formula/functions/engineering.d.ts +57 -0
- package/dist/types/modules/formula/functions/financial.d.ts +202 -0
- package/dist/types/modules/formula/functions/lookup.d.ts +18 -0
- package/dist/types/modules/formula/functions/math.d.ts +114 -0
- package/dist/types/modules/formula/functions/statistical.d.ts +193 -0
- package/dist/types/modules/formula/functions/text.d.ts +86 -0
- package/dist/types/modules/formula/host-registry.d.ts +53 -0
- package/dist/types/modules/formula/index.d.ts +39 -0
- package/dist/types/modules/formula/install.d.ts +62 -0
- package/dist/types/modules/formula/integration/apply-writeback-plan.d.ts +26 -0
- package/dist/types/modules/formula/integration/calculate-formulas-impl.d.ts +30 -0
- package/dist/types/modules/formula/integration/calculate-formulas.d.ts +67 -0
- package/dist/types/modules/formula/integration/formula-instance.d.ts +64 -0
- package/dist/types/modules/formula/integration/workbook-adapter.d.ts +26 -0
- package/dist/types/modules/formula/integration/workbook-snapshot.d.ts +267 -0
- package/dist/types/modules/formula/materialize/build-writeback-plan.d.ts +34 -0
- package/dist/types/modules/formula/materialize/spill-engine.d.ts +9 -0
- package/dist/types/modules/formula/materialize/types.d.ts +179 -0
- package/dist/types/modules/formula/materialize/writeback-plan.d.ts +167 -0
- package/dist/types/modules/formula/runtime/evaluator.d.ts +151 -0
- package/dist/types/modules/formula/runtime/function-registry.d.ts +47 -0
- package/dist/types/modules/formula/runtime/values.d.ts +211 -0
- package/dist/types/modules/formula/syntax/ast.d.ts +129 -0
- package/dist/types/modules/formula/syntax/parser.d.ts +18 -0
- package/dist/types/modules/formula/syntax/token-types.d.ts +153 -0
- package/dist/types/modules/formula/syntax/tokenizer.d.ts +10 -0
- package/package.json +28 -28
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structural interfaces the formula engine consumes.
|
|
3
|
+
*
|
|
4
|
+
* The engine talks to these interfaces only — never to the concrete
|
|
5
|
+
* `Workbook` / `Worksheet` / `Cell` classes from the `excel` module. Any
|
|
6
|
+
* host that wants to drive the engine (including the Node/browser
|
|
7
|
+
* Workbook in `@excel/*`) must implement these shapes.
|
|
8
|
+
*
|
|
9
|
+
* This is what keeps the Layer 3 ↔ Layer 4 dependency one-way: the
|
|
10
|
+
* `excel` module imports from `formula`, never the reverse.
|
|
11
|
+
*/
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// ValueType — numeric mirror of `@excel/enums` ValueType
|
|
14
|
+
// ============================================================================
|
|
15
|
+
/**
|
|
16
|
+
* Numeric cell-type tag exposed by host cells. The engine only compares
|
|
17
|
+
* against `Null` and `Formula`; any other value is treated as a scalar
|
|
18
|
+
* literal.
|
|
19
|
+
*
|
|
20
|
+
* Kept as inline numeric literals (not an enum) so this file stays free
|
|
21
|
+
* of runtime dependencies. The `const` object and `type` alias share a
|
|
22
|
+
* name via TypeScript's declaration merging — the value form
|
|
23
|
+
* (`CellValueTypeLike.Null`, `CellValueTypeLike.Formula`) is used at
|
|
24
|
+
* comparison sites, the type form annotates `CellLike.type`.
|
|
25
|
+
*/
|
|
26
|
+
export const CellValueTypeLike = {
|
|
27
|
+
Null: 0,
|
|
28
|
+
Formula: 6
|
|
29
|
+
};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writeback Plan — Declarative description of formula calculation results.
|
|
3
|
+
*
|
|
4
|
+
* The engine never directly mutates workbook cells. Instead, it produces a
|
|
5
|
+
* `WritebackPlan` — a list of write operations that describe what values
|
|
6
|
+
* should be written where. A thin adapter layer then applies the plan to
|
|
7
|
+
* the live workbook.
|
|
8
|
+
*
|
|
9
|
+
* ## Design Principles
|
|
10
|
+
*
|
|
11
|
+
* 1. **Declarative** — the plan describes *what* to write, not *how*.
|
|
12
|
+
* 2. **Deterministic** — #SPILL! conflicts are detected during plan
|
|
13
|
+
* construction, not during application.
|
|
14
|
+
* 3. **Ordered** — operations are applied in the order they appear.
|
|
15
|
+
* 4. **Independent** — each operation stands alone; the adapter does not
|
|
16
|
+
* need engine internals to apply the plan.
|
|
17
|
+
*
|
|
18
|
+
* ## Operation Types
|
|
19
|
+
*
|
|
20
|
+
* - `ScalarWrite` — write a single value to a formula cell's result.
|
|
21
|
+
* - `CSEWrite` — distribute an array across a CSE formula's target range.
|
|
22
|
+
* - `SpillWrite` — write a dynamic array result to adjacent cells (spill).
|
|
23
|
+
* - `SpillErrorWrite` — write #SPILL! to the source cell (conflict detected).
|
|
24
|
+
* - `CleanupWrite` — clear stale ghost cells from a previous spill.
|
|
25
|
+
* - `PreserveWrite` — keep the cell's existing cached result (unsupported fn).
|
|
26
|
+
*/
|
|
27
|
+
import type { SnapshotCellValue } from "../integration/workbook-snapshot.js";
|
|
28
|
+
import type { SpillRegion } from "./types.js";
|
|
29
|
+
/**
|
|
30
|
+
* Write a scalar value to a formula cell's result.
|
|
31
|
+
*/
|
|
32
|
+
export interface ScalarWrite {
|
|
33
|
+
readonly type: "scalar";
|
|
34
|
+
readonly sheetName: string;
|
|
35
|
+
readonly row: number;
|
|
36
|
+
readonly col: number;
|
|
37
|
+
/** The computed result value. */
|
|
38
|
+
readonly value: SnapshotCellValue;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Distribute an array result across a CSE (Ctrl+Shift+Enter) formula's
|
|
42
|
+
* target range. Each cell in the range gets the corresponding element.
|
|
43
|
+
* If the result is smaller than the target range, excess cells receive
|
|
44
|
+
* the scalar value (or `null` for missing elements).
|
|
45
|
+
*/
|
|
46
|
+
export interface CSEWrite {
|
|
47
|
+
readonly type: "cse";
|
|
48
|
+
readonly sheetName: string;
|
|
49
|
+
/** Top-left corner of the target range. */
|
|
50
|
+
readonly top: number;
|
|
51
|
+
readonly left: number;
|
|
52
|
+
/** Bottom-right corner of the target range. */
|
|
53
|
+
readonly bottom: number;
|
|
54
|
+
readonly right: number;
|
|
55
|
+
/**
|
|
56
|
+
* The result array. `results[r][c]` is the value for row `top + r`,
|
|
57
|
+
* col `left + c`. May be smaller than the target range.
|
|
58
|
+
*/
|
|
59
|
+
readonly results: readonly (readonly SnapshotCellValue[])[];
|
|
60
|
+
/**
|
|
61
|
+
* For scalar CSE results: the single value to fill the entire range.
|
|
62
|
+
* When set, `results` is ignored.
|
|
63
|
+
*/
|
|
64
|
+
readonly scalarFill?: SnapshotCellValue;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Write a dynamic array result to the source cell and adjacent ghost cells.
|
|
68
|
+
* The spill region starts at (row, col) and extends downward/rightward.
|
|
69
|
+
*/
|
|
70
|
+
export interface SpillWrite {
|
|
71
|
+
readonly type: "spill";
|
|
72
|
+
readonly sheetName: string;
|
|
73
|
+
readonly sheetId: number;
|
|
74
|
+
/** Source formula cell position. */
|
|
75
|
+
readonly row: number;
|
|
76
|
+
readonly col: number;
|
|
77
|
+
/**
|
|
78
|
+
* The result array. `results[r][c]` is the value for row `row + r`,
|
|
79
|
+
* col `col + c`. The source cell gets `results[0][0]`.
|
|
80
|
+
*/
|
|
81
|
+
readonly results: readonly (readonly SnapshotCellValue[])[];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Write #SPILL! to the source cell because the target range is occupied.
|
|
85
|
+
*/
|
|
86
|
+
export interface SpillErrorWrite {
|
|
87
|
+
readonly type: "spill-error";
|
|
88
|
+
readonly sheetName: string;
|
|
89
|
+
readonly sheetId: number;
|
|
90
|
+
readonly row: number;
|
|
91
|
+
readonly col: number;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Clear ghost cells from a previous spill that is no longer valid.
|
|
95
|
+
* Each entry in `cells` is a (row, col) pair to clear.
|
|
96
|
+
*/
|
|
97
|
+
export interface CleanupWrite {
|
|
98
|
+
readonly type: "cleanup";
|
|
99
|
+
readonly sheetName: string;
|
|
100
|
+
readonly sheetId: number;
|
|
101
|
+
/**
|
|
102
|
+
* Cells to clear. Each is `{ row, col }`.
|
|
103
|
+
* Only cells that haven't been modified by the user should be cleared —
|
|
104
|
+
* the plan builder checks this against the snapshot.
|
|
105
|
+
*/
|
|
106
|
+
readonly cells: readonly {
|
|
107
|
+
readonly row: number;
|
|
108
|
+
readonly col: number;
|
|
109
|
+
}[];
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Keep the cell's existing cached result.
|
|
113
|
+
* Used when the engine returns #NAME? (unsupported function) but the cell
|
|
114
|
+
* has a usable cached result from the XLSX file.
|
|
115
|
+
*/
|
|
116
|
+
export interface PreserveWrite {
|
|
117
|
+
readonly type: "preserve";
|
|
118
|
+
readonly sheetName: string;
|
|
119
|
+
readonly row: number;
|
|
120
|
+
readonly col: number;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* A single write operation in the plan.
|
|
124
|
+
*/
|
|
125
|
+
export type WriteOperation = ScalarWrite | CSEWrite | SpillWrite | SpillErrorWrite | CleanupWrite | PreserveWrite;
|
|
126
|
+
/**
|
|
127
|
+
* The complete writeback plan produced by the engine.
|
|
128
|
+
*
|
|
129
|
+
* Operations are ordered: cleanups first, then writes, to ensure stale
|
|
130
|
+
* data is removed before new data is written.
|
|
131
|
+
*/
|
|
132
|
+
export interface WritebackPlan {
|
|
133
|
+
/**
|
|
134
|
+
* All write operations in application order.
|
|
135
|
+
* The adapter should apply them sequentially.
|
|
136
|
+
*/
|
|
137
|
+
readonly operations: readonly WriteOperation[];
|
|
138
|
+
/**
|
|
139
|
+
* Spill persistent state changes — spill regions and ghost cell snapshots
|
|
140
|
+
* that the adapter must update in the persistent tracking maps.
|
|
141
|
+
*/
|
|
142
|
+
readonly spillState: SpillStateDelta;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Describes changes to the persistent spill tracking state.
|
|
146
|
+
* The adapter updates the persistent maps accordingly.
|
|
147
|
+
*/
|
|
148
|
+
export interface SpillStateDelta {
|
|
149
|
+
/**
|
|
150
|
+
* New or updated spill region metadata.
|
|
151
|
+
* Key: `"ws:<id>!row:col"` of the source formula cell.
|
|
152
|
+
* Value: the spill region dimensions.
|
|
153
|
+
*/
|
|
154
|
+
readonly spillRegions: ReadonlyMap<string, SpillRegion>;
|
|
155
|
+
/**
|
|
156
|
+
* Ghost cell value snapshots for modification detection.
|
|
157
|
+
* Key: ghost cell key `"ws:<id>!row:col"`.
|
|
158
|
+
* Value: the raw value written to that ghost cell.
|
|
159
|
+
*/
|
|
160
|
+
readonly ghostSnapshots: ReadonlyMap<string, SnapshotCellValue>;
|
|
161
|
+
/**
|
|
162
|
+
* Spill region entries to remove from the persistent map.
|
|
163
|
+
* These are source cell keys whose formulas no longer exist or whose
|
|
164
|
+
* spill was replaced.
|
|
165
|
+
*/
|
|
166
|
+
readonly removedSpillKeys: readonly string[];
|
|
167
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writeback Plan — Declarative description of formula calculation results.
|
|
3
|
+
*
|
|
4
|
+
* The engine never directly mutates workbook cells. Instead, it produces a
|
|
5
|
+
* `WritebackPlan` — a list of write operations that describe what values
|
|
6
|
+
* should be written where. A thin adapter layer then applies the plan to
|
|
7
|
+
* the live workbook.
|
|
8
|
+
*
|
|
9
|
+
* ## Design Principles
|
|
10
|
+
*
|
|
11
|
+
* 1. **Declarative** — the plan describes *what* to write, not *how*.
|
|
12
|
+
* 2. **Deterministic** — #SPILL! conflicts are detected during plan
|
|
13
|
+
* construction, not during application.
|
|
14
|
+
* 3. **Ordered** — operations are applied in the order they appear.
|
|
15
|
+
* 4. **Independent** — each operation stands alone; the adapter does not
|
|
16
|
+
* need engine internals to apply the plan.
|
|
17
|
+
*
|
|
18
|
+
* ## Operation Types
|
|
19
|
+
*
|
|
20
|
+
* - `ScalarWrite` — write a single value to a formula cell's result.
|
|
21
|
+
* - `CSEWrite` — distribute an array across a CSE formula's target range.
|
|
22
|
+
* - `SpillWrite` — write a dynamic array result to adjacent cells (spill).
|
|
23
|
+
* - `SpillErrorWrite` — write #SPILL! to the source cell (conflict detected).
|
|
24
|
+
* - `CleanupWrite` — clear stale ghost cells from a previous spill.
|
|
25
|
+
* - `PreserveWrite` — keep the cell's existing cached result (unsupported fn).
|
|
26
|
+
*/
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evaluator — Execute BoundExpr using the RuntimeValue system.
|
|
3
|
+
*
|
|
4
|
+
* The evaluator operates on BoundExpr (from the compile phase),
|
|
5
|
+
* WorkbookSnapshot (from the snapshot phase), and RuntimeValue
|
|
6
|
+
* (the value system).
|
|
7
|
+
*/
|
|
8
|
+
import type { BoundExpr } from "../compile/bound-ast.js";
|
|
9
|
+
import type { CompiledFormula } from "../compile/compiled-formula.js";
|
|
10
|
+
import type { WorkbookSnapshot } from "../integration/workbook-snapshot.js";
|
|
11
|
+
import type { RuntimeValue } from "./values.js";
|
|
12
|
+
/**
|
|
13
|
+
* Cached formula evaluation result with both scalar and raw forms.
|
|
14
|
+
* The scalar form is used by dependent formulas (implicit intersection applied).
|
|
15
|
+
* The raw form preserves the full array for dynamic array / CSE materialization.
|
|
16
|
+
*/
|
|
17
|
+
interface CachedResult {
|
|
18
|
+
/** Scalar (implicit-intersected, dereferenced) result. */
|
|
19
|
+
readonly scalar: RuntimeValue;
|
|
20
|
+
/** Raw (full array) result. Only differs from scalar for array formulas. */
|
|
21
|
+
readonly raw: RuntimeValue;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Per-calculation mutable state.
|
|
25
|
+
*/
|
|
26
|
+
export declare class EvalSession {
|
|
27
|
+
/** Cells currently on the evaluation call stack (circular-ref detection). */
|
|
28
|
+
readonly evaluating: Set<string>;
|
|
29
|
+
/**
|
|
30
|
+
* Unified formula result cache.
|
|
31
|
+
* Each entry holds both the scalar form (for dependents) and the raw form
|
|
32
|
+
* (for materialize). This replaces the previous separate cache/rawCache
|
|
33
|
+
* pattern with a single, self-documenting structure.
|
|
34
|
+
*/
|
|
35
|
+
readonly resultCache: Map<string, CachedResult>;
|
|
36
|
+
/** Cache for runtime name resolution (defined names that need parsing). */
|
|
37
|
+
readonly nameCache: Map<string, RuntimeValue>;
|
|
38
|
+
/** Fallback values for circular references during iterative calculation. */
|
|
39
|
+
readonly circularFallback: Map<string, RuntimeValue>;
|
|
40
|
+
/**
|
|
41
|
+
* Live spill map: cell key → (masterKey, row-offset, col-offset).
|
|
42
|
+
*
|
|
43
|
+
* Populated as soon as a dynamic-array formula is evaluated and yields
|
|
44
|
+
* an array result. Downstream formulas that read a cell inside the
|
|
45
|
+
* spill region look the master's cached array up via this map and
|
|
46
|
+
* return the correct element — even before materialize has written
|
|
47
|
+
* the ghost cells to the snapshot.
|
|
48
|
+
*
|
|
49
|
+
* This is the fix for "first-pass `=SUM(A1:A5)` over a `=SEQUENCE(5)`
|
|
50
|
+
* spill" — without the live map, `getCellValue("S", 2, 1)` returned
|
|
51
|
+
* BLANK and SUM only counted the master cell.
|
|
52
|
+
*/
|
|
53
|
+
readonly liveSpills: Map<string, {
|
|
54
|
+
masterKey: string;
|
|
55
|
+
rowOffset: number;
|
|
56
|
+
colOffset: number;
|
|
57
|
+
}>;
|
|
58
|
+
/**
|
|
59
|
+
* Runtime dependency recorder — tracks cell accesses made during evaluation.
|
|
60
|
+
*
|
|
61
|
+
* When a formula with `hasDynamicRefs` (INDIRECT/OFFSET) is being evaluated,
|
|
62
|
+
* every `getCellValue` / `buildRangeArray` call records the accessed cell/range
|
|
63
|
+
* key here. After evaluation, these dynamic edges can be merged with the
|
|
64
|
+
* compiled static dependency set to produce a complete dependency graph.
|
|
65
|
+
*
|
|
66
|
+
* Key: formula cell key being evaluated → Set of accessed cell keys.
|
|
67
|
+
* Only populated for formulas that have `hasDynamicRefs === true`.
|
|
68
|
+
*/
|
|
69
|
+
readonly dynamicDeps: Map<string, Set<string>>;
|
|
70
|
+
/**
|
|
71
|
+
* The formula cell key currently being recorded (null if recording is off).
|
|
72
|
+
* Set before evaluating a formula with dynamic refs, cleared after.
|
|
73
|
+
*/
|
|
74
|
+
recordingKey: string | null;
|
|
75
|
+
/**
|
|
76
|
+
* Current LAMBDA invocation depth. Guards against unbounded recursion
|
|
77
|
+
* (e.g. `LAMBDA(x, x(x))(LAMBDA(x, x(x)))`) that would otherwise overflow
|
|
78
|
+
* the JS call stack. Excel documents a recursion limit of ~256.
|
|
79
|
+
*/
|
|
80
|
+
lambdaDepth: number;
|
|
81
|
+
/**
|
|
82
|
+
* AST cache for INDIRECT re-parsing. INDIRECT receives a runtime string
|
|
83
|
+
* describing a reference; re-parsing it per invocation would be wasted
|
|
84
|
+
* work, so we memoise the `bound` expression keyed on the reference
|
|
85
|
+
* text. This belongs to the session (per-calculation lifetime) rather
|
|
86
|
+
* than the snapshot because the bindings depend on the evaluation
|
|
87
|
+
* context.
|
|
88
|
+
*/
|
|
89
|
+
readonly indirectAstCache: Map<string, BoundExpr>;
|
|
90
|
+
makeKey(sheet: string, row: number, col: number): string;
|
|
91
|
+
/**
|
|
92
|
+
* Record a cell access for the currently-recording formula.
|
|
93
|
+
*/
|
|
94
|
+
recordAccess(sheet: string, row: number, col: number): void;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The evaluation context. Carries the snapshot and compiled formula map
|
|
98
|
+
* for the evaluator to access cell values and resolve names at runtime.
|
|
99
|
+
* Short-lived per-calculation state (caches, iteration flags, etc.) lives
|
|
100
|
+
* on `EvalSession` instead.
|
|
101
|
+
*/
|
|
102
|
+
export interface EvalContext {
|
|
103
|
+
/** The workbook snapshot. */
|
|
104
|
+
readonly snapshot: WorkbookSnapshot;
|
|
105
|
+
/** Map from formula cell key to CompiledFormula. */
|
|
106
|
+
readonly compiledFormulas: ReadonlyMap<string, CompiledFormula>;
|
|
107
|
+
/** The current sheet name (for relative references). */
|
|
108
|
+
currentSheet: string;
|
|
109
|
+
/** Current cell address being evaluated. */
|
|
110
|
+
currentAddress?: {
|
|
111
|
+
sheet: string;
|
|
112
|
+
row: number;
|
|
113
|
+
col: number;
|
|
114
|
+
};
|
|
115
|
+
/** Local variable bindings from LET expressions. */
|
|
116
|
+
localBindings?: Map<string, RuntimeValue>;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Evaluate a BoundExpr to produce a RuntimeValue.
|
|
120
|
+
*/
|
|
121
|
+
export declare function evaluate(expr: BoundExpr, ctx: EvalContext, session: EvalSession): RuntimeValue;
|
|
122
|
+
/**
|
|
123
|
+
* Evaluate a compiled formula and return its **scalar** result.
|
|
124
|
+
*
|
|
125
|
+
* This is the standard evaluation path for regular (non-array) formulas.
|
|
126
|
+
* The result is:
|
|
127
|
+
* 1. Evaluated from the bound expression tree
|
|
128
|
+
* 2. Implicit-intersected to a single value/reference
|
|
129
|
+
* 3. Dereferenced if it's a reference
|
|
130
|
+
* 4. Cached for subsequent lookups by dependent formulas
|
|
131
|
+
*
|
|
132
|
+
* Use `evaluateFormulaRaw` instead when the full array result is needed
|
|
133
|
+
* (dynamic array formulas, CSE formulas).
|
|
134
|
+
*/
|
|
135
|
+
export declare function evaluateFormula(compiled: CompiledFormula, ctx: EvalContext, session: EvalSession): RuntimeValue;
|
|
136
|
+
/**
|
|
137
|
+
* Evaluate a compiled formula and return the **raw** (possibly array) result.
|
|
138
|
+
*
|
|
139
|
+
* This is the evaluation path for dynamic array and CSE formulas where
|
|
140
|
+
* the full array shape must be preserved for spill/distribution.
|
|
141
|
+
*
|
|
142
|
+
* Semantics:
|
|
143
|
+
* - Both scalar and raw forms are stored in `session.resultCache` as a
|
|
144
|
+
* `CachedResult{scalar, raw}`. Dependent scalar formulas see the scalar
|
|
145
|
+
* form; the materialize layer retrieves the raw form.
|
|
146
|
+
* - The return value is the full dereferenced result — may be an ArrayValue
|
|
147
|
+
* with height > 1 or width > 1.
|
|
148
|
+
*/
|
|
149
|
+
export declare function evaluateFormulaRaw(compiled: CompiledFormula, ctx: EvalContext, session: EvalSession): RuntimeValue;
|
|
150
|
+
export declare function implicitIntersect(val: RuntimeValue, ctx: EvalContext): RuntimeValue;
|
|
151
|
+
export {};
|