@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,230 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bound Expression AST — The output of the compilation (binding) phase.
|
|
3
|
+
*
|
|
4
|
+
* After parsing produces a raw AST, the binder resolves all static symbols:
|
|
5
|
+
* - Defined names → resolved cell/range references or formula expressions
|
|
6
|
+
* - Structured references → resolved cell/range references
|
|
7
|
+
* - Sheet names → validated against the snapshot
|
|
8
|
+
* - Function names → validated against the registry
|
|
9
|
+
*
|
|
10
|
+
* The result is a `BoundExpr` tree where every reference is resolved and
|
|
11
|
+
* every function call is validated. The runtime evaluator only executes
|
|
12
|
+
* `BoundExpr` nodes — it never needs to perform symbol resolution.
|
|
13
|
+
*
|
|
14
|
+
* ## Node Types (compile output)
|
|
15
|
+
*
|
|
16
|
+
* After binding, only these node types exist:
|
|
17
|
+
*
|
|
18
|
+
* - `BoundLiteral` — number, string, boolean, error, null (missing)
|
|
19
|
+
* - `BoundCellRef` — resolved cell reference (sheet + row + col)
|
|
20
|
+
* - `BoundAreaRef` — resolved rectangular range (sheet + bounds)
|
|
21
|
+
* - `BoundColRangeRef` — resolved whole-column range
|
|
22
|
+
* - `BoundRowRangeRef` — resolved whole-row range
|
|
23
|
+
* - `BoundRef3D` — resolved 3D reference (multiple sheets)
|
|
24
|
+
* - `BoundBinaryOp` — binary operation
|
|
25
|
+
* - `BoundUnaryOp` — unary operation (including @)
|
|
26
|
+
* - `BoundPercent` — postfix %
|
|
27
|
+
* - `BoundCall` — function call (eagerly evaluated args)
|
|
28
|
+
* - `BoundSpecialCall` — special form (IF, LET, LAMBDA, etc.) with lazy args
|
|
29
|
+
* - `BoundArray` — array constant {1,2;3,4}
|
|
30
|
+
* - `BoundNameExpr` — UNRESOLVED name (only for names that must be resolved at runtime,
|
|
31
|
+
* e.g. formula-based defined names that produce lambdas, or truly unknown names)
|
|
32
|
+
* - `BoundLambda` — LAMBDA expression (params + body)
|
|
33
|
+
*/
|
|
34
|
+
export declare const enum BoundExprKind {
|
|
35
|
+
Literal = 1,
|
|
36
|
+
CellRef = 2,
|
|
37
|
+
AreaRef = 3,
|
|
38
|
+
ColRangeRef = 4,
|
|
39
|
+
RowRangeRef = 5,
|
|
40
|
+
Ref3D = 6,
|
|
41
|
+
BinaryOp = 7,
|
|
42
|
+
UnaryOp = 8,
|
|
43
|
+
Percent = 9,
|
|
44
|
+
Call = 10,
|
|
45
|
+
SpecialCall = 11,
|
|
46
|
+
Array = 12,
|
|
47
|
+
NameExpr = 13,
|
|
48
|
+
Lambda = 14,
|
|
49
|
+
StructuredRef = 15
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A resolved literal value.
|
|
53
|
+
*/
|
|
54
|
+
export interface BoundLiteral {
|
|
55
|
+
readonly kind: BoundExprKind.Literal;
|
|
56
|
+
/** number | string | boolean | null (for Missing/blank) */
|
|
57
|
+
readonly value: number | string | boolean | null;
|
|
58
|
+
/** If this is an error literal (e.g. #N/A), the error code. */
|
|
59
|
+
readonly errorCode?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A fully resolved cell reference.
|
|
63
|
+
* After binding, sheet is always resolved (never undefined).
|
|
64
|
+
*/
|
|
65
|
+
export interface BoundCellRef {
|
|
66
|
+
readonly kind: BoundExprKind.CellRef;
|
|
67
|
+
/** Resolved sheet name. */
|
|
68
|
+
readonly sheet: string;
|
|
69
|
+
/** 1-based row number. */
|
|
70
|
+
readonly row: number;
|
|
71
|
+
/** 1-based column number. */
|
|
72
|
+
readonly col: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A fully resolved rectangular area reference.
|
|
76
|
+
*/
|
|
77
|
+
export interface BoundAreaRef {
|
|
78
|
+
readonly kind: BoundExprKind.AreaRef;
|
|
79
|
+
/** Resolved sheet name. */
|
|
80
|
+
readonly sheet: string;
|
|
81
|
+
/** 1-based bounds. */
|
|
82
|
+
readonly top: number;
|
|
83
|
+
readonly left: number;
|
|
84
|
+
readonly bottom: number;
|
|
85
|
+
readonly right: number;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* A resolved whole-column range (e.g. A:B).
|
|
89
|
+
* Row bounds are determined at runtime from sheet dimensions.
|
|
90
|
+
*/
|
|
91
|
+
export interface BoundColRangeRef {
|
|
92
|
+
readonly kind: BoundExprKind.ColRangeRef;
|
|
93
|
+
readonly sheet: string;
|
|
94
|
+
readonly leftCol: number;
|
|
95
|
+
readonly rightCol: number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* A resolved whole-row range (e.g. 1:5).
|
|
99
|
+
* Column bounds are determined at runtime from sheet dimensions.
|
|
100
|
+
*/
|
|
101
|
+
export interface BoundRowRangeRef {
|
|
102
|
+
readonly kind: BoundExprKind.RowRangeRef;
|
|
103
|
+
readonly sheet: string;
|
|
104
|
+
readonly topRow: number;
|
|
105
|
+
readonly bottomRow: number;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* A resolved 3D reference spanning multiple sheets.
|
|
109
|
+
* The inner reference is either a cell or an area.
|
|
110
|
+
*/
|
|
111
|
+
export interface BoundRef3D {
|
|
112
|
+
readonly kind: BoundExprKind.Ref3D;
|
|
113
|
+
/** Sheet names in workbook order, from start to end (inclusive). */
|
|
114
|
+
readonly sheets: readonly string[];
|
|
115
|
+
/** The cell/area that is replicated across sheets. */
|
|
116
|
+
readonly inner: BoundCellRef | BoundAreaRef;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Binary operation with two sub-expressions.
|
|
120
|
+
*/
|
|
121
|
+
export interface BoundBinaryOp {
|
|
122
|
+
readonly kind: BoundExprKind.BinaryOp;
|
|
123
|
+
readonly op: string;
|
|
124
|
+
readonly left: BoundExpr;
|
|
125
|
+
readonly right: BoundExpr;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Unary operation (prefix +, -, or @ implicit intersection).
|
|
129
|
+
*/
|
|
130
|
+
export interface BoundUnaryOp {
|
|
131
|
+
readonly kind: BoundExprKind.UnaryOp;
|
|
132
|
+
readonly op: string;
|
|
133
|
+
readonly operand: BoundExpr;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Postfix percent operation.
|
|
137
|
+
*/
|
|
138
|
+
export interface BoundPercent {
|
|
139
|
+
readonly kind: BoundExprKind.Percent;
|
|
140
|
+
readonly operand: BoundExpr;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* A standard (eager) function call.
|
|
144
|
+
* All arguments are evaluated before the function is called.
|
|
145
|
+
*/
|
|
146
|
+
export interface BoundCall {
|
|
147
|
+
readonly kind: BoundExprKind.Call;
|
|
148
|
+
/** Uppercase, canonical function name. */
|
|
149
|
+
readonly name: string;
|
|
150
|
+
/** Bound argument expressions. */
|
|
151
|
+
readonly args: readonly BoundExpr[];
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Special form identifiers for lazy/short-circuit evaluation.
|
|
155
|
+
*/
|
|
156
|
+
export type SpecialFormName = "IF" | "IFERROR" | "IFNA" | "IFS" | "SWITCH" | "CHOOSE" | "LET" | "LAMBDA" | "INDIRECT" | "OFFSET" | "MAP" | "REDUCE" | "SCAN" | "MAKEARRAY" | "BYROW" | "BYCOL";
|
|
157
|
+
/**
|
|
158
|
+
* A special-form function call with lazy argument evaluation.
|
|
159
|
+
* The evaluator handles these with custom logic (short-circuit, binding, etc.).
|
|
160
|
+
*/
|
|
161
|
+
export interface BoundSpecialCall {
|
|
162
|
+
readonly kind: BoundExprKind.SpecialCall;
|
|
163
|
+
readonly name: SpecialFormName;
|
|
164
|
+
/** Argument expressions (evaluated lazily by the evaluator). */
|
|
165
|
+
readonly args: readonly BoundExpr[];
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Array constant: {1,2;3,4}.
|
|
169
|
+
*/
|
|
170
|
+
export interface BoundArray {
|
|
171
|
+
readonly kind: BoundExprKind.Array;
|
|
172
|
+
/** rows[i][j] = element expression. */
|
|
173
|
+
readonly rows: readonly (readonly BoundExpr[])[];
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* An unresolved name reference.
|
|
177
|
+
*
|
|
178
|
+
* This exists for names that cannot be fully resolved at compile time:
|
|
179
|
+
* - Formula-based defined names (e.g. =LAMBDA(x,y,x+y))
|
|
180
|
+
* - Names that resolve to lambdas stored in cells
|
|
181
|
+
* - LET-bound local variables (resolved at runtime from localBindings)
|
|
182
|
+
* - Truly unknown names (#NAME? at runtime)
|
|
183
|
+
*
|
|
184
|
+
* For names that resolve to simple cell/range references, the binder
|
|
185
|
+
* produces `BoundCellRef` or `BoundAreaRef` directly.
|
|
186
|
+
*/
|
|
187
|
+
export interface BoundNameExpr {
|
|
188
|
+
readonly kind: BoundExprKind.NameExpr;
|
|
189
|
+
/** The original name (case-preserved). */
|
|
190
|
+
readonly name: string;
|
|
191
|
+
/** Uppercase name for lookup. */
|
|
192
|
+
readonly upperName: string;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* A LAMBDA expression with parameter names and a body.
|
|
196
|
+
* Produced by the binder when it encounters a LAMBDA special form.
|
|
197
|
+
*/
|
|
198
|
+
export interface BoundLambda {
|
|
199
|
+
readonly kind: BoundExprKind.Lambda;
|
|
200
|
+
/** Parameter names (uppercase). */
|
|
201
|
+
readonly params: readonly string[];
|
|
202
|
+
/** The body expression. */
|
|
203
|
+
readonly body: BoundExpr;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* An unresolved structured reference that requires runtime context.
|
|
207
|
+
*
|
|
208
|
+
* This is produced by the binder when:
|
|
209
|
+
* - The table name is empty (implicit `@` syntax — needs current cell position)
|
|
210
|
+
* - The reference includes `#This Row` (needs current cell's row)
|
|
211
|
+
*
|
|
212
|
+
* The evaluator resolves these at runtime using the current cell address.
|
|
213
|
+
*/
|
|
214
|
+
export interface BoundStructuredRef {
|
|
215
|
+
readonly kind: BoundExprKind.StructuredRef;
|
|
216
|
+
/** Table name (empty string for implicit table). */
|
|
217
|
+
readonly tableName: string;
|
|
218
|
+
/** Column names. */
|
|
219
|
+
readonly columns: readonly string[];
|
|
220
|
+
/** Special items (#Headers, #Data, #Totals, #All, #This Row). */
|
|
221
|
+
readonly specials: readonly string[];
|
|
222
|
+
}
|
|
223
|
+
export type BoundExpr = BoundLiteral | BoundCellRef | BoundAreaRef | BoundColRangeRef | BoundRowRangeRef | BoundRef3D | BoundBinaryOp | BoundUnaryOp | BoundPercent | BoundCall | BoundSpecialCall | BoundArray | BoundNameExpr | BoundLambda | BoundStructuredRef;
|
|
224
|
+
export declare function boundLiteral(value: number | string | boolean | null, errorCode?: string): BoundLiteral;
|
|
225
|
+
export declare function boundCellRef(sheet: string, row: number, col: number): BoundCellRef;
|
|
226
|
+
export declare function boundAreaRef(sheet: string, top: number, left: number, bottom: number, right: number): BoundAreaRef;
|
|
227
|
+
export declare function boundCall(name: string, args: BoundExpr[]): BoundCall;
|
|
228
|
+
export declare function boundSpecialCall(name: SpecialFormName, args: BoundExpr[]): BoundSpecialCall;
|
|
229
|
+
export declare function boundNameExpr(name: string): BoundNameExpr;
|
|
230
|
+
export declare function boundErrorLiteral(errorCode: string): BoundLiteral;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bound Expression AST — The output of the compilation (binding) phase.
|
|
3
|
+
*
|
|
4
|
+
* After parsing produces a raw AST, the binder resolves all static symbols:
|
|
5
|
+
* - Defined names → resolved cell/range references or formula expressions
|
|
6
|
+
* - Structured references → resolved cell/range references
|
|
7
|
+
* - Sheet names → validated against the snapshot
|
|
8
|
+
* - Function names → validated against the registry
|
|
9
|
+
*
|
|
10
|
+
* The result is a `BoundExpr` tree where every reference is resolved and
|
|
11
|
+
* every function call is validated. The runtime evaluator only executes
|
|
12
|
+
* `BoundExpr` nodes — it never needs to perform symbol resolution.
|
|
13
|
+
*
|
|
14
|
+
* ## Node Types (compile output)
|
|
15
|
+
*
|
|
16
|
+
* After binding, only these node types exist:
|
|
17
|
+
*
|
|
18
|
+
* - `BoundLiteral` — number, string, boolean, error, null (missing)
|
|
19
|
+
* - `BoundCellRef` — resolved cell reference (sheet + row + col)
|
|
20
|
+
* - `BoundAreaRef` — resolved rectangular range (sheet + bounds)
|
|
21
|
+
* - `BoundColRangeRef` — resolved whole-column range
|
|
22
|
+
* - `BoundRowRangeRef` — resolved whole-row range
|
|
23
|
+
* - `BoundRef3D` — resolved 3D reference (multiple sheets)
|
|
24
|
+
* - `BoundBinaryOp` — binary operation
|
|
25
|
+
* - `BoundUnaryOp` — unary operation (including @)
|
|
26
|
+
* - `BoundPercent` — postfix %
|
|
27
|
+
* - `BoundCall` — function call (eagerly evaluated args)
|
|
28
|
+
* - `BoundSpecialCall` — special form (IF, LET, LAMBDA, etc.) with lazy args
|
|
29
|
+
* - `BoundArray` — array constant {1,2;3,4}
|
|
30
|
+
* - `BoundNameExpr` — UNRESOLVED name (only for names that must be resolved at runtime,
|
|
31
|
+
* e.g. formula-based defined names that produce lambdas, or truly unknown names)
|
|
32
|
+
* - `BoundLambda` — LAMBDA expression (params + body)
|
|
33
|
+
*/
|
|
34
|
+
// ============================================================================
|
|
35
|
+
// Bound Expression Tag Enum
|
|
36
|
+
// ============================================================================
|
|
37
|
+
export var BoundExprKind;
|
|
38
|
+
(function (BoundExprKind) {
|
|
39
|
+
BoundExprKind[BoundExprKind["Literal"] = 1] = "Literal";
|
|
40
|
+
BoundExprKind[BoundExprKind["CellRef"] = 2] = "CellRef";
|
|
41
|
+
BoundExprKind[BoundExprKind["AreaRef"] = 3] = "AreaRef";
|
|
42
|
+
BoundExprKind[BoundExprKind["ColRangeRef"] = 4] = "ColRangeRef";
|
|
43
|
+
BoundExprKind[BoundExprKind["RowRangeRef"] = 5] = "RowRangeRef";
|
|
44
|
+
BoundExprKind[BoundExprKind["Ref3D"] = 6] = "Ref3D";
|
|
45
|
+
BoundExprKind[BoundExprKind["BinaryOp"] = 7] = "BinaryOp";
|
|
46
|
+
BoundExprKind[BoundExprKind["UnaryOp"] = 8] = "UnaryOp";
|
|
47
|
+
BoundExprKind[BoundExprKind["Percent"] = 9] = "Percent";
|
|
48
|
+
BoundExprKind[BoundExprKind["Call"] = 10] = "Call";
|
|
49
|
+
BoundExprKind[BoundExprKind["SpecialCall"] = 11] = "SpecialCall";
|
|
50
|
+
BoundExprKind[BoundExprKind["Array"] = 12] = "Array";
|
|
51
|
+
BoundExprKind[BoundExprKind["NameExpr"] = 13] = "NameExpr";
|
|
52
|
+
BoundExprKind[BoundExprKind["Lambda"] = 14] = "Lambda";
|
|
53
|
+
BoundExprKind[BoundExprKind["StructuredRef"] = 15] = "StructuredRef";
|
|
54
|
+
})(BoundExprKind || (BoundExprKind = {}));
|
|
55
|
+
// ============================================================================
|
|
56
|
+
// Constructor Helpers
|
|
57
|
+
// ============================================================================
|
|
58
|
+
export function boundLiteral(value, errorCode) {
|
|
59
|
+
return errorCode !== undefined
|
|
60
|
+
? { kind: BoundExprKind.Literal, value, errorCode }
|
|
61
|
+
: { kind: BoundExprKind.Literal, value };
|
|
62
|
+
}
|
|
63
|
+
export function boundCellRef(sheet, row, col) {
|
|
64
|
+
return { kind: BoundExprKind.CellRef, sheet, row, col };
|
|
65
|
+
}
|
|
66
|
+
export function boundAreaRef(sheet, top, left, bottom, right) {
|
|
67
|
+
return { kind: BoundExprKind.AreaRef, sheet, top, left, bottom, right };
|
|
68
|
+
}
|
|
69
|
+
export function boundCall(name, args) {
|
|
70
|
+
return { kind: BoundExprKind.Call, name, args };
|
|
71
|
+
}
|
|
72
|
+
export function boundSpecialCall(name, args) {
|
|
73
|
+
return { kind: BoundExprKind.SpecialCall, name, args };
|
|
74
|
+
}
|
|
75
|
+
export function boundNameExpr(name) {
|
|
76
|
+
return { kind: BoundExprKind.NameExpr, name, upperName: name.toUpperCase() };
|
|
77
|
+
}
|
|
78
|
+
export function boundErrorLiteral(errorCode) {
|
|
79
|
+
return { kind: BoundExprKind.Literal, value: null, errorCode };
|
|
80
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compiled Formula — The output of the full compilation pipeline.
|
|
3
|
+
*
|
|
4
|
+
* A `CompiledFormula` packages together:
|
|
5
|
+
* - The original `FormulaInstance` metadata
|
|
6
|
+
* - The bound expression tree (from the binder)
|
|
7
|
+
* - Static dependency information
|
|
8
|
+
* - Metadata flags (volatile, dynamic refs, etc.)
|
|
9
|
+
*
|
|
10
|
+
* ## Static Dependency Extraction
|
|
11
|
+
*
|
|
12
|
+
* Dependencies are extracted from the `BoundExpr` tree. Since names and
|
|
13
|
+
* structured refs are already resolved by the binder, the dependency
|
|
14
|
+
* extraction is a simple tree walk that collects `BoundCellRef` and
|
|
15
|
+
* `BoundAreaRef` nodes.
|
|
16
|
+
*
|
|
17
|
+
* Runtime-dependent references (INDIRECT, OFFSET) cannot be captured
|
|
18
|
+
* statically — the `hasDynamicRefs` flag marks formulas that may have
|
|
19
|
+
* additional runtime dependencies. Those functions re-parse their dynamic
|
|
20
|
+
* arguments at evaluation time using their own parser invocation (the raw
|
|
21
|
+
* AST is not retained on the CompiledFormula).
|
|
22
|
+
*/
|
|
23
|
+
import type { FormulaInstance } from "../integration/formula-instance.js";
|
|
24
|
+
import type { WorkbookSnapshot } from "../integration/workbook-snapshot.js";
|
|
25
|
+
import type { AstNode } from "../syntax/ast.js";
|
|
26
|
+
import type { BoundExpr } from "./bound-ast.js";
|
|
27
|
+
/**
|
|
28
|
+
* The complete compiled representation of a formula.
|
|
29
|
+
*/
|
|
30
|
+
export interface CompiledFormula {
|
|
31
|
+
/** The original formula instance metadata. */
|
|
32
|
+
readonly instance: FormulaInstance;
|
|
33
|
+
/** The bound expression tree (the evaluator executes this). */
|
|
34
|
+
readonly bound: BoundExpr;
|
|
35
|
+
/** Statically extractable dependencies. */
|
|
36
|
+
readonly staticDeps: StaticDependencySet;
|
|
37
|
+
/** Whether this formula uses volatile functions (RAND, NOW, etc.). */
|
|
38
|
+
readonly isVolatile: boolean;
|
|
39
|
+
/** Whether this formula contains INDIRECT/OFFSET (runtime-dependent refs). */
|
|
40
|
+
readonly hasDynamicRefs: boolean;
|
|
41
|
+
/** Whether this formula contains any lambda expressions. */
|
|
42
|
+
readonly containsLambda: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the top-level function is a known dynamic array function
|
|
45
|
+
* (FILTER, SORT, UNIQUE, SEQUENCE, etc.). Determined once at compile
|
|
46
|
+
* time — consumers should use this flag instead of re-checking the AST
|
|
47
|
+
* or bound expression.
|
|
48
|
+
*/
|
|
49
|
+
readonly isDynamicArrayFunction: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the top-level function is SUBTOTAL or AGGREGATE. When an
|
|
52
|
+
* outer SUBTOTAL/AGGREGATE range aggregates a cell whose formula is
|
|
53
|
+
* itself a SUBTOTAL/AGGREGATE call, that cell must be skipped so its
|
|
54
|
+
* result is not double-counted. This flag lets `buildRangeArray`
|
|
55
|
+
* mark those cells with the array's `subtotalMask`.
|
|
56
|
+
*/
|
|
57
|
+
readonly isSubtotalOutput: boolean;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A single cell dependency.
|
|
61
|
+
*/
|
|
62
|
+
export interface CellDep {
|
|
63
|
+
readonly sheet: string;
|
|
64
|
+
readonly row: number;
|
|
65
|
+
readonly col: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A rectangular area dependency.
|
|
69
|
+
*/
|
|
70
|
+
export interface AreaDep {
|
|
71
|
+
readonly sheet: string;
|
|
72
|
+
readonly top: number;
|
|
73
|
+
readonly left: number;
|
|
74
|
+
readonly bottom: number;
|
|
75
|
+
readonly right: number;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* All statically extractable dependencies of a formula.
|
|
79
|
+
*/
|
|
80
|
+
export interface StaticDependencySet {
|
|
81
|
+
/** Individual cell references. */
|
|
82
|
+
readonly cells: readonly CellDep[];
|
|
83
|
+
/** Range references. */
|
|
84
|
+
readonly areas: readonly AreaDep[];
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Callback to resolve a defined name into its parsed/bound expression
|
|
88
|
+
* for dependency extraction. Returns the bound expression if the name
|
|
89
|
+
* resolves to a formula, or undefined if it can't be resolved.
|
|
90
|
+
*/
|
|
91
|
+
export type NameDepResolver = (name: string) => {
|
|
92
|
+
deps: StaticDependencySet;
|
|
93
|
+
hasDynamicRefs: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Whether the defined-name's formula (transitively) uses a volatile
|
|
96
|
+
* function like NOW/RAND/OFFSET/INDIRECT. The resolver must propagate
|
|
97
|
+
* this so the OUTER formula inherits volatility — otherwise the
|
|
98
|
+
* session result cache would hold stale values across calc runs.
|
|
99
|
+
*/
|
|
100
|
+
isVolatile: boolean;
|
|
101
|
+
} | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Extract static dependencies from a bound expression tree.
|
|
104
|
+
*
|
|
105
|
+
* @param expr - The bound expression tree to analyze
|
|
106
|
+
* @param snapshot - Optional snapshot for resolving structured references
|
|
107
|
+
* @param nameResolver - Optional resolver for formula-based defined name dependencies
|
|
108
|
+
*/
|
|
109
|
+
export declare function extractStaticDeps(expr: BoundExpr, snapshot?: WorkbookSnapshot, nameResolver?: NameDepResolver): StaticDependencySet;
|
|
110
|
+
/**
|
|
111
|
+
* Check if the formula's top-level expression is a known dynamic array
|
|
112
|
+
* function. Checks both the raw AST (for prefixed names like `_XLFN.FILTER`)
|
|
113
|
+
* and the bound expression (for the canonical uppercase name).
|
|
114
|
+
*/
|
|
115
|
+
export declare function detectDynamicArrayFunction(ast: AstNode, bound: BoundExpr): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Check if the formula's top-level expression is SUBTOTAL or AGGREGATE.
|
|
118
|
+
*
|
|
119
|
+
* Excel's SUBTOTAL/AGGREGATE functions deliberately skip any cell whose
|
|
120
|
+
* own source formula is itself a SUBTOTAL or AGGREGATE call — this is
|
|
121
|
+
* what makes the classic "totals row inside a filtered range" case not
|
|
122
|
+
* double-count. `buildRangeArray` reads this flag off the compiled
|
|
123
|
+
* formula to decide whether to set `subtotalMask[r][c]`.
|
|
124
|
+
*/
|
|
125
|
+
export declare function detectSubtotalOutput(ast: AstNode, bound: BoundExpr): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Analyze a bound expression for volatile functions and dynamic references.
|
|
128
|
+
*
|
|
129
|
+
* @param nameResolver - Optional; if a NameExpr resolves to a formula-based
|
|
130
|
+
* defined name containing INDIRECT/OFFSET, the outer formula inherits
|
|
131
|
+
* `hasDynamicRefs = true`.
|
|
132
|
+
*/
|
|
133
|
+
export declare function analyzeExpr(expr: BoundExpr, nameResolver?: NameDepResolver): {
|
|
134
|
+
isVolatile: boolean;
|
|
135
|
+
hasDynamicRefs: boolean;
|
|
136
|
+
containsLambda: boolean;
|
|
137
|
+
};
|