@trebco/treb 37.0.0 → 37.1.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/build/package.json +119 -0
- package/build/treb-base-types/src/api_types.d.ts +11 -0
- package/build/treb-base-types/src/api_types.js +22 -0
- package/build/treb-base-types/src/api_types.js.map +1 -0
- package/build/treb-base-types/src/area-utils.d.ts +9 -0
- package/build/treb-base-types/src/area-utils.js +50 -0
- package/build/treb-base-types/src/area-utils.js.map +1 -0
- package/build/treb-base-types/src/area.d.ts +182 -0
- package/build/treb-base-types/src/area.js +715 -0
- package/build/treb-base-types/src/area.js.map +1 -0
- package/build/treb-base-types/src/basic_types.d.ts +20 -0
- package/build/treb-base-types/src/basic_types.js +22 -0
- package/build/treb-base-types/src/basic_types.js.map +1 -0
- package/build/treb-base-types/src/cell.d.ts +167 -0
- package/build/treb-base-types/src/cell.js +432 -0
- package/build/treb-base-types/src/cell.js.map +1 -0
- package/build/treb-base-types/src/cells.d.ts +251 -0
- package/build/treb-base-types/src/cells.js +1136 -0
- package/build/treb-base-types/src/cells.js.map +1 -0
- package/build/treb-base-types/src/color.d.ts +35 -0
- package/build/treb-base-types/src/color.js +162 -0
- package/build/treb-base-types/src/color.js.map +1 -0
- package/build/treb-base-types/src/dom-utilities.d.ts +70 -0
- package/build/treb-base-types/src/dom-utilities.js +144 -0
- package/build/treb-base-types/src/dom-utilities.js.map +1 -0
- package/build/treb-base-types/src/evaluate-options.d.ts +35 -0
- package/build/treb-base-types/src/evaluate-options.js +22 -0
- package/build/treb-base-types/src/evaluate-options.js.map +1 -0
- package/build/treb-base-types/src/font-stack.d.ts +37 -0
- package/build/treb-base-types/src/font-stack.js +93 -0
- package/build/treb-base-types/src/font-stack.js.map +1 -0
- package/build/treb-base-types/src/gradient.d.ts +18 -0
- package/build/treb-base-types/src/gradient.js +86 -0
- package/build/treb-base-types/src/gradient.js.map +1 -0
- package/build/treb-base-types/src/import.d.ts +48 -0
- package/build/treb-base-types/src/import.js +22 -0
- package/build/treb-base-types/src/import.js.map +1 -0
- package/build/treb-base-types/src/index-standalone.d.ts +6 -0
- package/build/treb-base-types/src/index-standalone.js +27 -0
- package/build/treb-base-types/src/index-standalone.js.map +1 -0
- package/build/treb-base-types/src/index.d.ts +22 -0
- package/build/treb-base-types/src/index.js +45 -0
- package/build/treb-base-types/src/index.js.map +1 -0
- package/build/treb-base-types/src/layout.d.ts +22 -0
- package/build/treb-base-types/src/layout.js +22 -0
- package/build/treb-base-types/src/layout.js.map +1 -0
- package/build/treb-base-types/src/localization.d.ts +37 -0
- package/build/treb-base-types/src/localization.js +157 -0
- package/build/treb-base-types/src/localization.js.map +1 -0
- package/build/treb-base-types/src/rectangle.d.ts +51 -0
- package/build/treb-base-types/src/rectangle.js +123 -0
- package/build/treb-base-types/src/rectangle.js.map +1 -0
- package/build/treb-base-types/src/render_text.d.ts +34 -0
- package/build/treb-base-types/src/render_text.js +22 -0
- package/build/treb-base-types/src/render_text.js.map +1 -0
- package/build/treb-base-types/src/style.d.ts +214 -0
- package/build/treb-base-types/src/style.js +373 -0
- package/build/treb-base-types/src/style.js.map +1 -0
- package/build/treb-base-types/src/table.d.ts +58 -0
- package/build/treb-base-types/src/table.js +27 -0
- package/build/treb-base-types/src/table.js.map +1 -0
- package/build/treb-base-types/src/text_part.d.ts +26 -0
- package/build/treb-base-types/src/text_part.js +47 -0
- package/build/treb-base-types/src/text_part.js.map +1 -0
- package/build/treb-base-types/src/theme.d.ts +120 -0
- package/build/treb-base-types/src/theme.js +460 -0
- package/build/treb-base-types/src/theme.js.map +1 -0
- package/build/treb-base-types/src/union.d.ts +73 -0
- package/build/treb-base-types/src/union.js +61 -0
- package/build/treb-base-types/src/union.js.map +1 -0
- package/build/treb-base-types/src/value-type.d.ts +86 -0
- package/build/treb-base-types/src/value-type.js +168 -0
- package/build/treb-base-types/src/value-type.js.map +1 -0
- package/build/treb-base-types/src/worker-proxy.d.ts +95 -0
- package/build/treb-base-types/src/worker-proxy.js +221 -0
- package/build/treb-base-types/src/worker-proxy.js.map +1 -0
- package/build/treb-calculator/src/calculator.d.ts +249 -0
- package/build/treb-calculator/src/calculator.js +2755 -0
- package/build/treb-calculator/src/calculator.js.map +1 -0
- package/build/treb-calculator/src/complex-math.d.ts +75 -0
- package/build/treb-calculator/src/complex-math.js +559 -0
- package/build/treb-calculator/src/complex-math.js.map +1 -0
- package/build/treb-calculator/src/dag/array-vertex.d.ts +71 -0
- package/build/treb-calculator/src/dag/array-vertex.js +156 -0
- package/build/treb-calculator/src/dag/array-vertex.js.map +1 -0
- package/build/treb-calculator/src/dag/calculation_leaf_vertex.d.ts +48 -0
- package/build/treb-calculator/src/dag/calculation_leaf_vertex.js +84 -0
- package/build/treb-calculator/src/dag/calculation_leaf_vertex.js.map +1 -0
- package/build/treb-calculator/src/dag/graph.d.ts +134 -0
- package/build/treb-calculator/src/dag/graph.js +842 -0
- package/build/treb-calculator/src/dag/graph.js.map +1 -0
- package/build/treb-calculator/src/dag/spreadsheet_vertex.d.ts +58 -0
- package/build/treb-calculator/src/dag/spreadsheet_vertex.js +232 -0
- package/build/treb-calculator/src/dag/spreadsheet_vertex.js.map +1 -0
- package/build/treb-calculator/src/dag/spreadsheet_vertex_base.d.ts +20 -0
- package/build/treb-calculator/src/dag/spreadsheet_vertex_base.js +25 -0
- package/build/treb-calculator/src/dag/spreadsheet_vertex_base.js.map +1 -0
- package/build/treb-calculator/src/dag/state_leaf_vertex.d.ts +43 -0
- package/build/treb-calculator/src/dag/state_leaf_vertex.js +81 -0
- package/build/treb-calculator/src/dag/state_leaf_vertex.js.map +1 -0
- package/build/treb-calculator/src/dag/vertex.d.ts +71 -0
- package/build/treb-calculator/src/dag/vertex.js +274 -0
- package/build/treb-calculator/src/dag/vertex.js.map +1 -0
- package/build/treb-calculator/src/descriptors.d.ts +189 -0
- package/build/treb-calculator/src/descriptors.js +22 -0
- package/build/treb-calculator/src/descriptors.js.map +1 -0
- package/build/treb-calculator/src/expression-calculator.d.ts +127 -0
- package/build/treb-calculator/src/expression-calculator.js +1033 -0
- package/build/treb-calculator/src/expression-calculator.js.map +1 -0
- package/build/treb-calculator/src/function-error.d.ts +35 -0
- package/build/treb-calculator/src/function-error.js +85 -0
- package/build/treb-calculator/src/function-error.js.map +1 -0
- package/build/treb-calculator/src/function-library.d.ts +22 -0
- package/build/treb-calculator/src/function-library.js +96 -0
- package/build/treb-calculator/src/function-library.js.map +1 -0
- package/build/treb-calculator/src/functions/base-functions.d.ts +7 -0
- package/build/treb-calculator/src/functions/base-functions.js +2611 -0
- package/build/treb-calculator/src/functions/base-functions.js.map +1 -0
- package/build/treb-calculator/src/functions/beta.d.ts +17 -0
- package/build/treb-calculator/src/functions/beta.js +201 -0
- package/build/treb-calculator/src/functions/beta.js.map +1 -0
- package/build/treb-calculator/src/functions/checkbox.d.ts +3 -0
- package/build/treb-calculator/src/functions/checkbox.js +128 -0
- package/build/treb-calculator/src/functions/checkbox.js.map +1 -0
- package/build/treb-calculator/src/functions/complex-functions.d.ts +2 -0
- package/build/treb-calculator/src/functions/complex-functions.js +217 -0
- package/build/treb-calculator/src/functions/complex-functions.js.map +1 -0
- package/build/treb-calculator/src/functions/date-utils.d.ts +3 -0
- package/build/treb-calculator/src/functions/date-utils.js +59 -0
- package/build/treb-calculator/src/functions/date-utils.js.map +1 -0
- package/build/treb-calculator/src/functions/finance-functions.d.ts +2 -0
- package/build/treb-calculator/src/functions/finance-functions.js +547 -0
- package/build/treb-calculator/src/functions/finance-functions.js.map +1 -0
- package/build/treb-calculator/src/functions/fp.d.ts +2 -0
- package/build/treb-calculator/src/functions/fp.js +463 -0
- package/build/treb-calculator/src/functions/fp.js.map +1 -0
- package/build/treb-calculator/src/functions/function-utilities.d.ts +2 -0
- package/build/treb-calculator/src/functions/function-utilities.js +36 -0
- package/build/treb-calculator/src/functions/function-utilities.js.map +1 -0
- package/build/treb-calculator/src/functions/gamma.d.ts +20 -0
- package/build/treb-calculator/src/functions/gamma.js +142 -0
- package/build/treb-calculator/src/functions/gamma.js.map +1 -0
- package/build/treb-calculator/src/functions/information-functions.d.ts +2 -0
- package/build/treb-calculator/src/functions/information-functions.js +71 -0
- package/build/treb-calculator/src/functions/information-functions.js.map +1 -0
- package/build/treb-calculator/src/functions/lambda-functions.d.ts +2 -0
- package/build/treb-calculator/src/functions/lambda-functions.js +85 -0
- package/build/treb-calculator/src/functions/lambda-functions.js.map +1 -0
- package/build/treb-calculator/src/functions/matrix-functions.d.ts +2 -0
- package/build/treb-calculator/src/functions/matrix-functions.js +144 -0
- package/build/treb-calculator/src/functions/matrix-functions.js.map +1 -0
- package/build/treb-calculator/src/functions/normal.d.ts +2 -0
- package/build/treb-calculator/src/functions/normal.js +32 -0
- package/build/treb-calculator/src/functions/normal.js.map +1 -0
- package/build/treb-calculator/src/functions/regex-functions.d.ts +2 -0
- package/build/treb-calculator/src/functions/regex-functions.js +188 -0
- package/build/treb-calculator/src/functions/regex-functions.js.map +1 -0
- package/build/treb-calculator/src/functions/sparkline.d.ts +37 -0
- package/build/treb-calculator/src/functions/sparkline.js +264 -0
- package/build/treb-calculator/src/functions/sparkline.js.map +1 -0
- package/build/treb-calculator/src/functions/statistics-functions.d.ts +6 -0
- package/build/treb-calculator/src/functions/statistics-functions.js +989 -0
- package/build/treb-calculator/src/functions/statistics-functions.js.map +1 -0
- package/build/treb-calculator/src/functions/students-t.d.ts +3 -0
- package/build/treb-calculator/src/functions/students-t.js +64 -0
- package/build/treb-calculator/src/functions/students-t.js.map +1 -0
- package/build/treb-calculator/src/functions/text-functions.d.ts +3 -0
- package/build/treb-calculator/src/functions/text-functions.js +320 -0
- package/build/treb-calculator/src/functions/text-functions.js.map +1 -0
- package/build/treb-calculator/src/index.d.ts +2 -0
- package/build/treb-calculator/src/index.js +22 -0
- package/build/treb-calculator/src/index.js.map +1 -0
- package/build/treb-calculator/src/notifier-types.d.ts +26 -0
- package/build/treb-calculator/src/notifier-types.js +22 -0
- package/build/treb-calculator/src/notifier-types.js.map +1 -0
- package/build/treb-calculator/src/primitives.d.ts +15 -0
- package/build/treb-calculator/src/primitives.js +398 -0
- package/build/treb-calculator/src/primitives.js.map +1 -0
- package/build/treb-calculator/src/utilities.d.ts +68 -0
- package/build/treb-calculator/src/utilities.js +324 -0
- package/build/treb-calculator/src/utilities.js.map +1 -0
- package/build/treb-charts/src/chart-functions.d.ts +8 -0
- package/build/treb-charts/src/chart-functions.js +209 -0
- package/build/treb-charts/src/chart-functions.js.map +1 -0
- package/build/treb-charts/src/chart-types.d.ts +233 -0
- package/build/treb-charts/src/chart-types.js +57 -0
- package/build/treb-charts/src/chart-types.js.map +1 -0
- package/build/treb-charts/src/chart-utils.d.ts +106 -0
- package/build/treb-charts/src/chart-utils.js +1060 -0
- package/build/treb-charts/src/chart-utils.js.map +1 -0
- package/build/treb-charts/src/chart.d.ts +23 -0
- package/build/treb-charts/src/chart.js +94 -0
- package/build/treb-charts/src/chart.js.map +1 -0
- package/build/treb-charts/src/default-chart-renderer.d.ts +16 -0
- package/build/treb-charts/src/default-chart-renderer.js +533 -0
- package/build/treb-charts/src/default-chart-renderer.js.map +1 -0
- package/build/treb-charts/src/index.d.ts +5 -0
- package/build/treb-charts/src/index.js +24 -0
- package/build/treb-charts/src/index.js.map +1 -0
- package/build/treb-charts/src/main.d.ts +1 -0
- package/build/treb-charts/src/main.js +34 -0
- package/build/treb-charts/src/main.js.map +1 -0
- package/build/treb-charts/src/quicksort.d.ts +1 -0
- package/build/treb-charts/src/quicksort.js +49 -0
- package/build/treb-charts/src/quicksort.js.map +1 -0
- package/build/treb-charts/src/rectangle.d.ts +18 -0
- package/build/treb-charts/src/rectangle.js +41 -0
- package/build/treb-charts/src/rectangle.js.map +1 -0
- package/build/treb-charts/src/renderer-type.d.ts +24 -0
- package/build/treb-charts/src/renderer-type.js +22 -0
- package/build/treb-charts/src/renderer-type.js.map +1 -0
- package/build/treb-charts/src/renderer.d.ts +127 -0
- package/build/treb-charts/src/renderer.js +1518 -0
- package/build/treb-charts/src/renderer.js.map +1 -0
- package/build/treb-charts/src/util.d.ts +18 -0
- package/build/treb-charts/src/util.js +71 -0
- package/build/treb-charts/src/util.js.map +1 -0
- package/build/treb-data-model/src/annotation.d.ts +167 -0
- package/build/treb-data-model/src/annotation.js +120 -0
- package/build/treb-data-model/src/annotation.js.map +1 -0
- package/build/treb-data-model/src/conditional_format.d.ts +155 -0
- package/build/treb-data-model/src/conditional_format.js +62 -0
- package/build/treb-data-model/src/conditional_format.js.map +1 -0
- package/build/treb-data-model/src/data-validation.d.ts +28 -0
- package/build/treb-data-model/src/data-validation.js +22 -0
- package/build/treb-data-model/src/data-validation.js.map +1 -0
- package/build/treb-data-model/src/data_model.d.ts +173 -0
- package/build/treb-data-model/src/data_model.js +637 -0
- package/build/treb-data-model/src/data_model.js.map +1 -0
- package/build/treb-data-model/src/index.d.ts +13 -0
- package/build/treb-data-model/src/index.js +28 -0
- package/build/treb-data-model/src/index.js.map +1 -0
- package/build/treb-data-model/src/language-model.d.ts +22 -0
- package/build/treb-data-model/src/language-model.js +22 -0
- package/build/treb-data-model/src/language-model.js.map +1 -0
- package/build/treb-data-model/src/named.d.ts +124 -0
- package/build/treb-data-model/src/named.js +372 -0
- package/build/treb-data-model/src/named.js.map +1 -0
- package/build/treb-data-model/src/serialize_options.d.ts +49 -0
- package/build/treb-data-model/src/serialize_options.js +22 -0
- package/build/treb-data-model/src/serialize_options.js.map +1 -0
- package/build/treb-data-model/src/sheet.d.ts +499 -0
- package/build/treb-data-model/src/sheet.js +2904 -0
- package/build/treb-data-model/src/sheet.js.map +1 -0
- package/build/treb-data-model/src/sheet_collection.d.ts +58 -0
- package/build/treb-data-model/src/sheet_collection.js +112 -0
- package/build/treb-data-model/src/sheet_collection.js.map +1 -0
- package/build/treb-data-model/src/sheet_selection.d.ts +42 -0
- package/build/treb-data-model/src/sheet_selection.js +39 -0
- package/build/treb-data-model/src/sheet_selection.js.map +1 -0
- package/build/treb-data-model/src/sheet_types.d.ts +104 -0
- package/build/treb-data-model/src/sheet_types.js +22 -0
- package/build/treb-data-model/src/sheet_types.js.map +1 -0
- package/build/treb-data-model/src/types.d.ts +59 -0
- package/build/treb-data-model/src/types.js +22 -0
- package/build/treb-data-model/src/types.js.map +1 -0
- package/build/treb-embed/src/custom-element/spreadsheet-constructor.d.ts +75 -0
- package/build/treb-embed/src/custom-element/spreadsheet-constructor.js +1144 -0
- package/build/treb-embed/src/custom-element/spreadsheet-constructor.js.map +1 -0
- package/build/treb-embed/src/custom-element/treb-global.d.ts +36 -0
- package/build/treb-embed/src/custom-element/treb-global.js +64 -0
- package/build/treb-embed/src/custom-element/treb-global.js.map +1 -0
- package/build/treb-embed/src/custom-element/treb-spreadsheet-element.d.ts +1 -0
- package/build/treb-embed/src/custom-element/treb-spreadsheet-element.js +61 -0
- package/build/treb-embed/src/custom-element/treb-spreadsheet-element.js.map +1 -0
- package/build/treb-embed/src/embedded-spreadsheet.d.ts +1358 -0
- package/build/treb-embed/src/embedded-spreadsheet.js +5205 -0
- package/build/treb-embed/src/embedded-spreadsheet.js.map +1 -0
- package/build/treb-embed/src/index.d.ts +12 -0
- package/build/treb-embed/src/index.js +34 -0
- package/build/treb-embed/src/index.js.map +1 -0
- package/build/treb-embed/src/options.d.ts +266 -0
- package/build/treb-embed/src/options.js +56 -0
- package/build/treb-embed/src/options.js.map +1 -0
- package/build/treb-embed/src/plugin.d.ts +9 -0
- package/build/treb-embed/src/plugin.js +22 -0
- package/build/treb-embed/src/plugin.js.map +1 -0
- package/build/treb-embed/src/progress-dialog.d.ts +49 -0
- package/build/treb-embed/src/progress-dialog.js +178 -0
- package/build/treb-embed/src/progress-dialog.js.map +1 -0
- package/build/treb-embed/src/selection-state.d.ts +15 -0
- package/build/treb-embed/src/selection-state.js +22 -0
- package/build/treb-embed/src/selection-state.js.map +1 -0
- package/build/treb-embed/src/spinner.d.ts +8 -0
- package/build/treb-embed/src/spinner.js +40 -0
- package/build/treb-embed/src/spinner.js.map +1 -0
- package/build/treb-embed/src/toolbar-message.d.ts +72 -0
- package/build/treb-embed/src/toolbar-message.js +22 -0
- package/build/treb-embed/src/toolbar-message.js.map +1 -0
- package/build/treb-embed/src/types.d.ts +185 -0
- package/build/treb-embed/src/types.js +45 -0
- package/build/treb-embed/src/types.js.map +1 -0
- package/build/treb-embed/tsconfig.tsbuildinfo +1 -0
- package/build/treb-export/src/address-type.d.ts +34 -0
- package/build/treb-export/src/address-type.js +53 -0
- package/build/treb-export/src/address-type.js.map +1 -0
- package/build/treb-export/src/base-template.d.ts +1 -0
- package/build/treb-export/src/base-template.js +22 -0
- package/build/treb-export/src/base-template.js.map +1 -0
- package/build/treb-export/src/column-width.d.ts +2 -0
- package/build/treb-export/src/column-width.js +80 -0
- package/build/treb-export/src/column-width.js.map +1 -0
- package/build/treb-export/src/drawing/bubble-chart-template.d.ts +514 -0
- package/build/treb-export/src/drawing/bubble-chart-template.js +544 -0
- package/build/treb-export/src/drawing/bubble-chart-template.js.map +1 -0
- package/build/treb-export/src/drawing/chart-template-components2.d.ts +365 -0
- package/build/treb-export/src/drawing/chart-template-components2.js +386 -0
- package/build/treb-export/src/drawing/chart-template-components2.js.map +1 -0
- package/build/treb-export/src/drawing/chart.d.ts +26 -0
- package/build/treb-export/src/drawing/chart.js +247 -0
- package/build/treb-export/src/drawing/chart.js.map +1 -0
- package/build/treb-export/src/drawing/column-chart-template2.d.ts +490 -0
- package/build/treb-export/src/drawing/column-chart-template2.js +518 -0
- package/build/treb-export/src/drawing/column-chart-template2.js.map +1 -0
- package/build/treb-export/src/drawing/donut-chart-template2.d.ts +272 -0
- package/build/treb-export/src/drawing/donut-chart-template2.js +293 -0
- package/build/treb-export/src/drawing/donut-chart-template2.js.map +1 -0
- package/build/treb-export/src/drawing/drawing.d.ts +49 -0
- package/build/treb-export/src/drawing/drawing.js +193 -0
- package/build/treb-export/src/drawing/drawing.js.map +1 -0
- package/build/treb-export/src/drawing/embedded-image.d.ts +12 -0
- package/build/treb-export/src/drawing/embedded-image.js +54 -0
- package/build/treb-export/src/drawing/embedded-image.js.map +1 -0
- package/build/treb-export/src/drawing/scatter-chart-template2.d.ts +520 -0
- package/build/treb-export/src/drawing/scatter-chart-template2.js +551 -0
- package/build/treb-export/src/drawing/scatter-chart-template2.js.map +1 -0
- package/build/treb-export/src/export.d.ts +72 -0
- package/build/treb-export/src/export.js +2039 -0
- package/build/treb-export/src/export.js.map +1 -0
- package/build/treb-export/src/import-export-messages.d.ts +31 -0
- package/build/treb-export/src/import-export-messages.js +22 -0
- package/build/treb-export/src/import-export-messages.js.map +1 -0
- package/build/treb-export/src/import.d.ts +33 -0
- package/build/treb-export/src/import.js +1258 -0
- package/build/treb-export/src/import.js.map +1 -0
- package/build/treb-export/src/index.worker.d.ts +1 -0
- package/build/treb-export/src/index.worker.js +93 -0
- package/build/treb-export/src/index.worker.js.map +1 -0
- package/build/treb-export/src/metadata.d.ts +51 -0
- package/build/treb-export/src/metadata.js +153 -0
- package/build/treb-export/src/metadata.js.map +1 -0
- package/build/treb-export/src/ooxml.d.ts +7 -0
- package/build/treb-export/src/ooxml.js +41 -0
- package/build/treb-export/src/ooxml.js.map +1 -0
- package/build/treb-export/src/relationship.d.ts +8 -0
- package/build/treb-export/src/relationship.js +27 -0
- package/build/treb-export/src/relationship.js.map +1 -0
- package/build/treb-export/src/shared-strings.d.ts +11 -0
- package/build/treb-export/src/shared-strings.js +105 -0
- package/build/treb-export/src/shared-strings.js.map +1 -0
- package/build/treb-export/src/template-2.d.ts +1 -0
- package/build/treb-export/src/template-2.js +22 -0
- package/build/treb-export/src/template-2.js.map +1 -0
- package/build/treb-export/src/unescape_xml.d.ts +1 -0
- package/build/treb-export/src/unescape_xml.js +61 -0
- package/build/treb-export/src/unescape_xml.js.map +1 -0
- package/build/treb-export/src/workbook-sheet.d.ts +75 -0
- package/build/treb-export/src/workbook-sheet.js +128 -0
- package/build/treb-export/src/workbook-sheet.js.map +1 -0
- package/build/treb-export/src/workbook-style.d.ts +110 -0
- package/build/treb-export/src/workbook-style.js +1134 -0
- package/build/treb-export/src/workbook-style.js.map +1 -0
- package/build/treb-export/src/workbook-theme.d.ts +13 -0
- package/build/treb-export/src/workbook-theme.js +85 -0
- package/build/treb-export/src/workbook-theme.js.map +1 -0
- package/build/treb-export/src/workbook.d.ts +123 -0
- package/build/treb-export/src/workbook.js +644 -0
- package/build/treb-export/src/workbook.js.map +1 -0
- package/build/treb-export/src/xml-test.d.ts +9 -0
- package/build/treb-export/src/xml-test.js +52 -0
- package/build/treb-export/src/xml-test.js.map +1 -0
- package/build/treb-export/src/xml-utils.d.ts +76 -0
- package/build/treb-export/src/xml-utils.js +223 -0
- package/build/treb-export/src/xml-utils.js.map +1 -0
- package/build/treb-export/src/zip-wrapper.d.ts +22 -0
- package/build/treb-export/src/zip-wrapper.js +93 -0
- package/build/treb-export/src/zip-wrapper.js.map +1 -0
- package/build/treb-format/src/format.d.ts +130 -0
- package/build/treb-format/src/format.js +805 -0
- package/build/treb-format/src/format.js.map +1 -0
- package/build/treb-format/src/format_cache.d.ts +55 -0
- package/build/treb-format/src/format_cache.js +166 -0
- package/build/treb-format/src/format_cache.js.map +1 -0
- package/build/treb-format/src/format_parser.d.ts +70 -0
- package/build/treb-format/src/format_parser.js +618 -0
- package/build/treb-format/src/format_parser.js.map +1 -0
- package/build/treb-format/src/index.d.ts +4 -0
- package/build/treb-format/src/index.js +25 -0
- package/build/treb-format/src/index.js.map +1 -0
- package/build/treb-format/src/number_format_section.d.ts +58 -0
- package/build/treb-format/src/number_format_section.js +78 -0
- package/build/treb-format/src/number_format_section.js.map +1 -0
- package/build/treb-format/src/value_parser.d.ts +48 -0
- package/build/treb-format/src/value_parser.js +244 -0
- package/build/treb-format/src/value_parser.js.map +1 -0
- package/build/treb-grid/src/editors/autocomplete.d.ts +39 -0
- package/build/treb-grid/src/editors/autocomplete.js +316 -0
- package/build/treb-grid/src/editors/autocomplete.js.map +1 -0
- package/build/treb-grid/src/editors/autocomplete_matcher.d.ts +74 -0
- package/build/treb-grid/src/editors/autocomplete_matcher.js +212 -0
- package/build/treb-grid/src/editors/autocomplete_matcher.js.map +1 -0
- package/build/treb-grid/src/editors/editor.d.ts +214 -0
- package/build/treb-grid/src/editors/editor.js +879 -0
- package/build/treb-grid/src/editors/editor.js.map +1 -0
- package/build/treb-grid/src/editors/external_editor.d.ts +11 -0
- package/build/treb-grid/src/editors/external_editor.js +118 -0
- package/build/treb-grid/src/editors/external_editor.js.map +1 -0
- package/build/treb-grid/src/editors/formula_bar.d.ts +85 -0
- package/build/treb-grid/src/editors/formula_bar.js +444 -0
- package/build/treb-grid/src/editors/formula_bar.js.map +1 -0
- package/build/treb-grid/src/editors/overlay_editor.d.ts +85 -0
- package/build/treb-grid/src/editors/overlay_editor.js +353 -0
- package/build/treb-grid/src/editors/overlay_editor.js.map +1 -0
- package/build/treb-grid/src/index.d.ts +12 -0
- package/build/treb-grid/src/index.js +28 -0
- package/build/treb-grid/src/index.js.map +1 -0
- package/build/treb-grid/src/layout/base_layout.d.ts +346 -0
- package/build/treb-grid/src/layout/base_layout.js +2050 -0
- package/build/treb-grid/src/layout/base_layout.js.map +1 -0
- package/build/treb-grid/src/layout/grid_layout.d.ts +19 -0
- package/build/treb-grid/src/layout/grid_layout.js +235 -0
- package/build/treb-grid/src/layout/grid_layout.js.map +1 -0
- package/build/treb-grid/src/layout/mock-layout.d.ts +10 -0
- package/build/treb-grid/src/layout/mock-layout.js +37 -0
- package/build/treb-grid/src/layout/mock-layout.js.map +1 -0
- package/build/treb-grid/src/render/selection-renderer.d.ts +97 -0
- package/build/treb-grid/src/render/selection-renderer.js +315 -0
- package/build/treb-grid/src/render/selection-renderer.js.map +1 -0
- package/build/treb-grid/src/render/svg_header_overlay.d.ts +20 -0
- package/build/treb-grid/src/render/svg_header_overlay.js +76 -0
- package/build/treb-grid/src/render/svg_header_overlay.js.map +1 -0
- package/build/treb-grid/src/render/svg_selection_block.d.ts +27 -0
- package/build/treb-grid/src/render/svg_selection_block.js +106 -0
- package/build/treb-grid/src/render/svg_selection_block.js.map +1 -0
- package/build/treb-grid/src/render/tile_renderer.d.ts +121 -0
- package/build/treb-grid/src/render/tile_renderer.js +1609 -0
- package/build/treb-grid/src/render/tile_renderer.js.map +1 -0
- package/build/treb-grid/src/types/border_constants.d.ts +9 -0
- package/build/treb-grid/src/types/border_constants.js +34 -0
- package/build/treb-grid/src/types/border_constants.js.map +1 -0
- package/build/treb-grid/src/types/clipboard_data.d.ts +11 -0
- package/build/treb-grid/src/types/clipboard_data.js +22 -0
- package/build/treb-grid/src/types/clipboard_data.js.map +1 -0
- package/build/treb-grid/src/types/clipboard_data2.d.ts +46 -0
- package/build/treb-grid/src/types/clipboard_data2.js +22 -0
- package/build/treb-grid/src/types/clipboard_data2.js.map +1 -0
- package/build/treb-grid/src/types/drag_mask.d.ts +10 -0
- package/build/treb-grid/src/types/drag_mask.js +78 -0
- package/build/treb-grid/src/types/drag_mask.js.map +1 -0
- package/build/treb-grid/src/types/external_editor_config.d.ts +33 -0
- package/build/treb-grid/src/types/external_editor_config.js +22 -0
- package/build/treb-grid/src/types/external_editor_config.js.map +1 -0
- package/build/treb-grid/src/types/grid.d.ts +806 -0
- package/build/treb-grid/src/types/grid.js +6410 -0
- package/build/treb-grid/src/types/grid.js.map +1 -0
- package/build/treb-grid/src/types/grid_base.d.ts +442 -0
- package/build/treb-grid/src/types/grid_base.js +3523 -0
- package/build/treb-grid/src/types/grid_base.js.map +1 -0
- package/build/treb-grid/src/types/grid_command.d.ts +408 -0
- package/build/treb-grid/src/types/grid_command.js +75 -0
- package/build/treb-grid/src/types/grid_command.js.map +1 -0
- package/build/treb-grid/src/types/grid_events.d.ts +93 -0
- package/build/treb-grid/src/types/grid_events.js +36 -0
- package/build/treb-grid/src/types/grid_events.js.map +1 -0
- package/build/treb-grid/src/types/grid_options.d.ts +50 -0
- package/build/treb-grid/src/types/grid_options.js +34 -0
- package/build/treb-grid/src/types/grid_options.js.map +1 -0
- package/build/treb-grid/src/types/scale-control.d.ts +21 -0
- package/build/treb-grid/src/types/scale-control.js +148 -0
- package/build/treb-grid/src/types/scale-control.js.map +1 -0
- package/build/treb-grid/src/types/set_range_options.d.ts +24 -0
- package/build/treb-grid/src/types/set_range_options.js +22 -0
- package/build/treb-grid/src/types/set_range_options.js.map +1 -0
- package/build/treb-grid/src/types/tab_bar.d.ts +84 -0
- package/build/treb-grid/src/types/tab_bar.js +426 -0
- package/build/treb-grid/src/types/tab_bar.js.map +1 -0
- package/build/treb-grid/src/types/tile.d.ts +29 -0
- package/build/treb-grid/src/types/tile.js +22 -0
- package/build/treb-grid/src/types/tile.js.map +1 -0
- package/build/treb-grid/src/types/update_flags.d.ts +48 -0
- package/build/treb-grid/src/types/update_flags.js +22 -0
- package/build/treb-grid/src/types/update_flags.js.map +1 -0
- package/build/treb-grid/src/util/fontmetrics.d.ts +21 -0
- package/build/treb-grid/src/util/fontmetrics.js +82 -0
- package/build/treb-grid/src/util/fontmetrics.js.map +1 -0
- package/build/treb-grid/src/util/ua.d.ts +33 -0
- package/build/treb-grid/src/util/ua.js +86 -0
- package/build/treb-grid/src/util/ua.js.map +1 -0
- package/build/treb-parser/src/csv-parser.d.ts +13 -0
- package/build/treb-parser/src/csv-parser.js +107 -0
- package/build/treb-parser/src/csv-parser.js.map +1 -0
- package/build/treb-parser/src/index.d.ts +4 -0
- package/build/treb-parser/src/index.js +25 -0
- package/build/treb-parser/src/index.js.map +1 -0
- package/build/treb-parser/src/md-parser.d.ts +97 -0
- package/build/treb-parser/src/md-parser.js +403 -0
- package/build/treb-parser/src/md-parser.js.map +1 -0
- package/build/treb-parser/src/parser-types.d.ts +345 -0
- package/build/treb-parser/src/parser-types.js +53 -0
- package/build/treb-parser/src/parser-types.js.map +1 -0
- package/build/treb-parser/src/parser.d.ts +422 -0
- package/build/treb-parser/src/parser.js +2418 -0
- package/build/treb-parser/src/parser.js.map +1 -0
- package/build/treb-utils/src/event_source.d.ts +34 -0
- package/build/treb-utils/src/event_source.js +110 -0
- package/build/treb-utils/src/event_source.js.map +1 -0
- package/build/treb-utils/src/ievent_source.d.ts +9 -0
- package/build/treb-utils/src/ievent_source.js +22 -0
- package/build/treb-utils/src/ievent_source.js.map +1 -0
- package/build/treb-utils/src/index.d.ts +6 -0
- package/build/treb-utils/src/index.js +30 -0
- package/build/treb-utils/src/index.js.map +1 -0
- package/build/treb-utils/src/measurement.d.ts +42 -0
- package/build/treb-utils/src/measurement.js +145 -0
- package/build/treb-utils/src/measurement.js.map +1 -0
- package/build/treb-utils/src/scale.d.ts +16 -0
- package/build/treb-utils/src/scale.js +106 -0
- package/build/treb-utils/src/scale.js.map +1 -0
- package/build/treb-utils/src/serialize_html.d.ts +5 -0
- package/build/treb-utils/src/serialize_html.js +128 -0
- package/build/treb-utils/src/serialize_html.js.map +1 -0
- package/build/treb-utils/src/validate_uri.d.ts +20 -0
- package/build/treb-utils/src/validate_uri.js +55 -0
- package/build/treb-utils/src/validate_uri.js.map +1 -0
- package/dist/{chunk-XD5PEZBZ.mjs → chunk-A2NJA5VB.mjs} +1 -1
- package/dist/treb-export-worker.mjs +2 -2
- package/dist/treb-spreadsheet.mjs +4 -4
- package/dist/treb.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,1258 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of TREB.
|
|
3
|
+
*
|
|
4
|
+
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
+
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
+
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
+
* later version.
|
|
8
|
+
*
|
|
9
|
+
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
+
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
+
* details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License along
|
|
15
|
+
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
*
|
|
17
|
+
* Copyright 2022-2026 trebco, llc.
|
|
18
|
+
* info@treb.app
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
// import JSZip from 'jszip';
|
|
22
|
+
// import UZip from 'uzip';
|
|
23
|
+
import Base64JS from 'base64-js';
|
|
24
|
+
import { ChartType, ConditionalFormatOperators, Workbook } from './workbook';
|
|
25
|
+
import { DecimalMarkType, Parser } from 'treb-parser';
|
|
26
|
+
import { is_range, ShiftRange, InRange, is_address } from './address-type';
|
|
27
|
+
import { Area } from 'treb-base-types';
|
|
28
|
+
import { VisibleState } from './workbook-sheet';
|
|
29
|
+
// import { type GenericDOMElement, XMLUtils } from './xml-utils';
|
|
30
|
+
// import { one_hundred_pixels } from './constants';
|
|
31
|
+
import { ColumnWidthToPixels } from './column-width';
|
|
32
|
+
import { ZipWrapper } from './zip-wrapper';
|
|
33
|
+
import { LookupMetadata } from './metadata';
|
|
34
|
+
import * as OOXML from 'ooxml-types';
|
|
35
|
+
import { EnsureArray, FirstTag, IterateTags } from './ooxml';
|
|
36
|
+
/*
|
|
37
|
+
interface CellElementType {
|
|
38
|
+
a$: {
|
|
39
|
+
r?: string;
|
|
40
|
+
t?: string;
|
|
41
|
+
s?: string;
|
|
42
|
+
cm?: string;
|
|
43
|
+
};
|
|
44
|
+
v?: string|number|{
|
|
45
|
+
t$: string;
|
|
46
|
+
a$?: Record<string, string>; // DOMContent;
|
|
47
|
+
};
|
|
48
|
+
f?: string|{
|
|
49
|
+
t$: string;
|
|
50
|
+
a$?: {
|
|
51
|
+
si?: string;
|
|
52
|
+
t?: string;
|
|
53
|
+
ref?: string;
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
interface ConditionalFormatRule {
|
|
59
|
+
a$: {
|
|
60
|
+
type?: string;
|
|
61
|
+
dxfId?: string;
|
|
62
|
+
priority?: string;
|
|
63
|
+
operator?: string;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
formula?: string|[number,number]|{t$: string};
|
|
67
|
+
|
|
68
|
+
dataBar?: {
|
|
69
|
+
a$?: {
|
|
70
|
+
showValue?: string;
|
|
71
|
+
},
|
|
72
|
+
color?: {
|
|
73
|
+
a$: {
|
|
74
|
+
rgb?: string;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
extLst?: {
|
|
80
|
+
ext?: {
|
|
81
|
+
'x14:id'?: string;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
colorScale?: {
|
|
86
|
+
cfvo?: {
|
|
87
|
+
a$: {
|
|
88
|
+
type?: string;
|
|
89
|
+
val?: string;
|
|
90
|
+
}
|
|
91
|
+
}[];
|
|
92
|
+
color?: {
|
|
93
|
+
a$: {
|
|
94
|
+
rgb?: string;
|
|
95
|
+
theme?: string;
|
|
96
|
+
tint?: string;
|
|
97
|
+
}
|
|
98
|
+
}[];
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const ElementHasTextNode = (test: unknown): test is {t$: string} => {
|
|
103
|
+
return typeof test === 'object' && typeof (test as {$t: string}).$t !== 'undefined';
|
|
104
|
+
}
|
|
105
|
+
*/
|
|
106
|
+
export class Importer {
|
|
107
|
+
// FIXME: need a way to share/pass parser flags
|
|
108
|
+
parser = new Parser();
|
|
109
|
+
workbook;
|
|
110
|
+
// public archive?: JSZip;
|
|
111
|
+
zip;
|
|
112
|
+
Init(data) {
|
|
113
|
+
this.zip = new ZipWrapper(data);
|
|
114
|
+
this.workbook = new Workbook(this.zip);
|
|
115
|
+
this.workbook.Init();
|
|
116
|
+
}
|
|
117
|
+
/** FIXME: accessor */
|
|
118
|
+
SheetCount() {
|
|
119
|
+
return this.workbook?.sheet_count || 0;
|
|
120
|
+
}
|
|
121
|
+
ParseCell(sheet, element, // CellElementType,
|
|
122
|
+
shared_formulae, arrays, dynamic_arrays, merges, links) {
|
|
123
|
+
// must have, at minimum, an address (must be a single cell? FIXME)
|
|
124
|
+
const address_attr = element.$attributes?.r;
|
|
125
|
+
if (address_attr === undefined) {
|
|
126
|
+
console.warn('cell missing address');
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
const address = sheet.TranslateAddress(address_attr);
|
|
130
|
+
if (is_range(address)) {
|
|
131
|
+
console.warn('cell has range address');
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
// metadata
|
|
135
|
+
let metadata_flags = {};
|
|
136
|
+
if (element.$attributes?.cm !== undefined) {
|
|
137
|
+
const cm_index = element.$attributes.cm;
|
|
138
|
+
if (this.workbook?.metadata) {
|
|
139
|
+
metadata_flags = LookupMetadata(this.workbook.metadata, 'cell', cm_index).flags;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// console.info(element);
|
|
143
|
+
let value;
|
|
144
|
+
let type = 'undefined';
|
|
145
|
+
let calculated_value;
|
|
146
|
+
let calculated_type = 'undefined';
|
|
147
|
+
// QUESTIONS:
|
|
148
|
+
//
|
|
149
|
+
// 1. is v always a value, or can it be an object?
|
|
150
|
+
// if it is always a value, we can drop some of the
|
|
151
|
+
// casting stuff below
|
|
152
|
+
//
|
|
153
|
+
// 2. can we reframe f so it's always an object, moving the string
|
|
154
|
+
// inside -- to remove the simple case and remove all the testing?
|
|
155
|
+
//
|
|
156
|
+
// assuming we have single element per tag...
|
|
157
|
+
/*
|
|
158
|
+
const mapped: { [index: string]: ElementTree.Element } = {};
|
|
159
|
+
for (const child of element.getchildren()) {
|
|
160
|
+
if (child.tag) mapped[child.tag.toString()] = child;
|
|
161
|
+
}
|
|
162
|
+
*/
|
|
163
|
+
// console.info(address, 'e', element, 'm', mapped);
|
|
164
|
+
if (element.$attributes?.t === 's') {
|
|
165
|
+
type = 'string';
|
|
166
|
+
if (element.v?.$text !== undefined) {
|
|
167
|
+
const index = Number(element.v.$text);
|
|
168
|
+
if (!isNaN(index) && sheet.shared_strings) {
|
|
169
|
+
value = sheet.shared_strings.Get(index) || '';
|
|
170
|
+
if (value[0] === '=') {
|
|
171
|
+
value = '\'' + value;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
if (element.f !== undefined) {
|
|
178
|
+
type = 'formula';
|
|
179
|
+
const formula = element.f.$text || '';
|
|
180
|
+
if (formula) {
|
|
181
|
+
// doing it like this is sloppy (also does not work properly).
|
|
182
|
+
value = '=' + formula.replace(/^_xll\./g, '');
|
|
183
|
+
// drop the formula if it's a ref error, we can't handle this
|
|
184
|
+
if (/#REF/.test(formula)) {
|
|
185
|
+
value = formula;
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
const parse_result = this.parser.Parse(formula); // l10n?
|
|
189
|
+
if (parse_result.expression) {
|
|
190
|
+
const TrimPrefixes = (name) => {
|
|
191
|
+
if (/^_xll\./.test(name)) {
|
|
192
|
+
name = name.substring(5);
|
|
193
|
+
}
|
|
194
|
+
if (/^_xlfn\./.test(name)) {
|
|
195
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
196
|
+
console.info("xlfn:", name);
|
|
197
|
+
}
|
|
198
|
+
name = name.substring(6);
|
|
199
|
+
}
|
|
200
|
+
if (/^_xlws\./.test(name)) {
|
|
201
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
202
|
+
console.info("xlws:", name);
|
|
203
|
+
}
|
|
204
|
+
name = name.substring(6);
|
|
205
|
+
}
|
|
206
|
+
return name;
|
|
207
|
+
};
|
|
208
|
+
const TreeWalker = (unit) => {
|
|
209
|
+
if (unit.type === 'call') {
|
|
210
|
+
// if we see _xlfn.SINGLE, translate that into
|
|
211
|
+
// @ + the name of the first parameter...
|
|
212
|
+
//
|
|
213
|
+
// this is solving the case where single appears, but it
|
|
214
|
+
// doesn't solve the case where it does not appear -- they
|
|
215
|
+
// may be using the array flag of the cell as an indicator?
|
|
216
|
+
// but how then do they know it _should_ be an array? not
|
|
217
|
+
// sure, and I don't see any other indication.
|
|
218
|
+
if (/^_xlfn\.single/i.test(unit.name)) {
|
|
219
|
+
const first = unit.args[0];
|
|
220
|
+
if (first.type === 'call') {
|
|
221
|
+
// we could do this in place, we don't need to copy...
|
|
222
|
+
// although it seems like a good idea. also watch out,
|
|
223
|
+
// these SINGLEs could be nested.
|
|
224
|
+
const replacement = JSON.parse(JSON.stringify(first));
|
|
225
|
+
replacement.name = '@' + TrimPrefixes(replacement.name);
|
|
226
|
+
for (let i = 0; i < replacement.args.length; i++) {
|
|
227
|
+
replacement.args[i] = this.parser.Walk2(replacement.args[i], TreeWalker);
|
|
228
|
+
}
|
|
229
|
+
return replacement;
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
console.info("_xlfn.SINGLE unexpected argument", unit.args[0]);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
unit.name = TrimPrefixes(unit.name);
|
|
236
|
+
// excel export may be translating dynamic range references
|
|
237
|
+
// (e.g D2#) to `ANCHORARRAY(D2)`. this is for compatibility
|
|
238
|
+
// with older versions of excel, I guess?
|
|
239
|
+
// we can translate these but let's be conservative here and
|
|
240
|
+
// start with just ANCHORARRAY taking a single address --
|
|
241
|
+
// that we know we can handle.
|
|
242
|
+
// so for example, if the formula is `=SUM(ANCHORARRAY(D2))`
|
|
243
|
+
// we can translate that to explicitly `=SUM(D2#)`. in our
|
|
244
|
+
// scheme that's just the address plus a flag bit indicating
|
|
245
|
+
// "take the full dynamic array range".
|
|
246
|
+
if (unit.name === 'ANCHORARRAY') {
|
|
247
|
+
if (unit.args.length === 1 && unit.args[0].type === 'address') {
|
|
248
|
+
return {
|
|
249
|
+
...(unit.args[0]), spill: true,
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return true;
|
|
255
|
+
};
|
|
256
|
+
parse_result.expression = this.parser.Walk2(parse_result.expression, TreeWalker);
|
|
257
|
+
value = '=' + this.parser.Render(parse_result.expression, { missing: '' });
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (element.f.$attributes?.t === 'shared' && element.f.$attributes.si !== undefined) {
|
|
261
|
+
shared_formulae[element.f.$attributes.si] = {
|
|
262
|
+
row: address.row - 1,
|
|
263
|
+
column: address.col - 1,
|
|
264
|
+
formula: value,
|
|
265
|
+
parse_result: this.parser.Parse(value),
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
else if (element.f.$attributes?.t === 'shared' && element.f.$attributes.si !== undefined) {
|
|
270
|
+
const f = shared_formulae[element.f.$attributes.si];
|
|
271
|
+
if (f) {
|
|
272
|
+
if (f.parse_result.expression) {
|
|
273
|
+
value = '=' + this.parser.Render(f.parse_result.expression, {
|
|
274
|
+
offset: {
|
|
275
|
+
rows: address.row - 1 - f.row,
|
|
276
|
+
columns: address.col - 1 - f.column,
|
|
277
|
+
},
|
|
278
|
+
missing: ''
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
else
|
|
282
|
+
value = f.formula;
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
// console.info("MISSING SHARED", mapped.f.attrib.si);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
//
|
|
289
|
+
// arrays and spill/dynamic arrays
|
|
290
|
+
//
|
|
291
|
+
if (element.f.$attributes?.t === 'array') {
|
|
292
|
+
const translated = sheet.TranslateAddress(element.f.$attributes.ref ?? '');
|
|
293
|
+
// why are we checking "is_range" here? this should be valid
|
|
294
|
+
// even if the ref attribute is one cell, if it explicitly
|
|
295
|
+
// says t="array"
|
|
296
|
+
// we will need to adjust it, though? yes, because the lists
|
|
297
|
+
// only accept ranges. note that range type has a superfluous
|
|
298
|
+
// sheet parameter? ...
|
|
299
|
+
let range = translated;
|
|
300
|
+
if (!is_range(range)) {
|
|
301
|
+
range = {
|
|
302
|
+
to: { ...range },
|
|
303
|
+
from: { ...range },
|
|
304
|
+
sheet: range.sheet,
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
// if (is_range(translated))
|
|
308
|
+
{
|
|
309
|
+
if (metadata_flags['dynamic-array']) {
|
|
310
|
+
dynamic_arrays.push(ShiftRange(range, -1, -1));
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
arrays.push(ShiftRange(range, -1, -1));
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
if (element.v !== undefined) {
|
|
318
|
+
const V = element.v?.$text ?? '';
|
|
319
|
+
// FIXME: use parser?
|
|
320
|
+
const num = Number(V);
|
|
321
|
+
if (!isNaN(num)) {
|
|
322
|
+
calculated_type = 'number';
|
|
323
|
+
calculated_value = num;
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
calculated_type = 'string';
|
|
327
|
+
calculated_value = V;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
else if (element.v !== undefined) {
|
|
332
|
+
// FIXME: use parser?
|
|
333
|
+
const num = Number(element.v.$text || '');
|
|
334
|
+
if (!isNaN(num)) {
|
|
335
|
+
type = 'number';
|
|
336
|
+
value = num;
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
type = 'string';
|
|
340
|
+
value = element.v.$text || '';
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
const shifted = { row: address.row - 1, col: address.col - 1 };
|
|
345
|
+
// check if we are in an array. we're relying on the fact that
|
|
346
|
+
// the array head is the top-left, which I _think_ is universal,
|
|
347
|
+
// but perhaps we should check that... although at this point we have
|
|
348
|
+
// already added the array so we need to check for root
|
|
349
|
+
for (const set of [arrays, dynamic_arrays]) {
|
|
350
|
+
for (const array of set) {
|
|
351
|
+
if (InRange(array, shifted) && (shifted.row !== array.from.row || shifted.col !== array.from.col)) {
|
|
352
|
+
calculated_type = type;
|
|
353
|
+
calculated_value = value;
|
|
354
|
+
value = undefined;
|
|
355
|
+
type = 'undefined'; // ValueType.undefined;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
const result = {
|
|
360
|
+
row: shifted.row, column: shifted.col, value, type,
|
|
361
|
+
};
|
|
362
|
+
if (typeof calculated_value !== 'undefined') {
|
|
363
|
+
result.calculated_type = calculated_type;
|
|
364
|
+
result.calculated = calculated_value;
|
|
365
|
+
}
|
|
366
|
+
if (element.$attributes?.s !== undefined) {
|
|
367
|
+
result.style_ref = element.$attributes.s;
|
|
368
|
+
}
|
|
369
|
+
for (const link of links) {
|
|
370
|
+
if (link.address.row === address.row && link.address.col === address.col) {
|
|
371
|
+
result.hyperlink = link.reference;
|
|
372
|
+
// FIXME: pop?
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
/*
|
|
376
|
+
for (const validation of validations) {
|
|
377
|
+
if (validation.address.row === shifted.row && validation.address.column === shifted.col) {
|
|
378
|
+
result.validation = validation.validation;
|
|
379
|
+
break;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
*/
|
|
383
|
+
for (const range of merges) {
|
|
384
|
+
if (InRange(range, shifted)) {
|
|
385
|
+
result.merge_area = {
|
|
386
|
+
start: {
|
|
387
|
+
row: range.from.row,
|
|
388
|
+
column: range.from.col,
|
|
389
|
+
}, end: {
|
|
390
|
+
row: range.to.row,
|
|
391
|
+
column: range.to.col,
|
|
392
|
+
},
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
for (const range of dynamic_arrays) {
|
|
397
|
+
if (InRange(range, shifted)) {
|
|
398
|
+
result.spill = {
|
|
399
|
+
start: {
|
|
400
|
+
row: range.from.row,
|
|
401
|
+
column: range.from.col,
|
|
402
|
+
}, end: {
|
|
403
|
+
row: range.to.row,
|
|
404
|
+
column: range.to.col,
|
|
405
|
+
},
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
for (const range of arrays) {
|
|
410
|
+
if (InRange(range, shifted)) {
|
|
411
|
+
result.area = {
|
|
412
|
+
start: {
|
|
413
|
+
row: range.from.row,
|
|
414
|
+
column: range.from.col,
|
|
415
|
+
}, end: {
|
|
416
|
+
row: range.to.row,
|
|
417
|
+
column: range.to.col,
|
|
418
|
+
},
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
return result;
|
|
423
|
+
}
|
|
424
|
+
AddressToArea(address) {
|
|
425
|
+
const area = is_address(address) ? {
|
|
426
|
+
start: { row: address.row - 1, column: address.col - 1 },
|
|
427
|
+
end: { row: address.row - 1, column: address.col - 1 },
|
|
428
|
+
} : {
|
|
429
|
+
start: { row: address.from.row - 1, column: address.from.col - 1 },
|
|
430
|
+
end: { row: address.to.row - 1, column: address.to.col - 1 },
|
|
431
|
+
};
|
|
432
|
+
return area;
|
|
433
|
+
}
|
|
434
|
+
ParseConditionalFormat(address, rule, // ConditionalFormatRule,
|
|
435
|
+
extensions = []) {
|
|
436
|
+
const area = this.AddressToArea(address);
|
|
437
|
+
const operators = ConditionalFormatOperators;
|
|
438
|
+
// console.info({rule});
|
|
439
|
+
switch (rule.$attributes?.type) {
|
|
440
|
+
case 'duplicateValues':
|
|
441
|
+
case 'uniqueValues':
|
|
442
|
+
{
|
|
443
|
+
let style = {};
|
|
444
|
+
if (rule.$attributes.dxfId !== undefined) {
|
|
445
|
+
style = this.workbook?.style_cache.dxf_styles[rule.$attributes.dxfId] || {};
|
|
446
|
+
}
|
|
447
|
+
return {
|
|
448
|
+
type: 'duplicate-values',
|
|
449
|
+
area,
|
|
450
|
+
style,
|
|
451
|
+
unique: (rule.$attributes.type === 'uniqueValues'),
|
|
452
|
+
priority: rule.$attributes.priority,
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
case 'cellIs':
|
|
456
|
+
if (rule.$attributes.operator && rule.formula) {
|
|
457
|
+
let style = {};
|
|
458
|
+
if (rule.$attributes.dxfId !== undefined) {
|
|
459
|
+
style = this.workbook?.style_cache.dxf_styles[rule.$attributes.dxfId] || {};
|
|
460
|
+
}
|
|
461
|
+
if (rule.$attributes.operator === 'between') {
|
|
462
|
+
if (Array.isArray(rule.formula) && rule.formula.length === 2) {
|
|
463
|
+
// && typeof rule.formula[0] === 'number' && typeof rule.formula[1] === 'number') {
|
|
464
|
+
const between = [
|
|
465
|
+
Number(rule.formula[0]?.$text || ''),
|
|
466
|
+
Number(rule.formula[1]?.$text || ''),
|
|
467
|
+
];
|
|
468
|
+
return {
|
|
469
|
+
type: 'cell-match',
|
|
470
|
+
expression: '',
|
|
471
|
+
between, // : rule.formula, // special case? ugh
|
|
472
|
+
area,
|
|
473
|
+
style,
|
|
474
|
+
priority: rule.$attributes.priority,
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
const operator = operators[rule.$attributes.operator || ''];
|
|
479
|
+
if (!operator) {
|
|
480
|
+
console.info('unhandled cellIs operator:', rule.$attributes.operator, { rule });
|
|
481
|
+
}
|
|
482
|
+
else {
|
|
483
|
+
return {
|
|
484
|
+
type: 'cell-match',
|
|
485
|
+
expression: operator + ' ' + rule.formula,
|
|
486
|
+
area,
|
|
487
|
+
style,
|
|
488
|
+
priority: rule.$attributes.priority,
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
else {
|
|
493
|
+
console.info("miss?", rule);
|
|
494
|
+
}
|
|
495
|
+
break;
|
|
496
|
+
case 'containsErrors':
|
|
497
|
+
case 'notContainsErrors':
|
|
498
|
+
case 'expression':
|
|
499
|
+
if (rule.formula) {
|
|
500
|
+
const first = FirstTag(rule.formula);
|
|
501
|
+
const formula = first?.$text || '';
|
|
502
|
+
/*
|
|
503
|
+
if (typeof rule.formula !== 'string') {
|
|
504
|
+
if (ElementHasTextNode(rule.formula)) {
|
|
505
|
+
|
|
506
|
+
// the only case (to date) we've seen here is that the attribute
|
|
507
|
+
// is "xml:space=preserve", which we can ignore (are you sure?)
|
|
508
|
+
// (should we check that?)
|
|
509
|
+
|
|
510
|
+
rule.formula = rule.formula.t$;
|
|
511
|
+
|
|
512
|
+
}
|
|
513
|
+
else {
|
|
514
|
+
console.info("unexpected conditional expression", {rule});
|
|
515
|
+
rule.formula = '';
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
*/
|
|
519
|
+
let style = {};
|
|
520
|
+
if (rule.$attributes.dxfId !== undefined) {
|
|
521
|
+
style = this.workbook?.style_cache.dxf_styles[rule.$attributes.dxfId] || {};
|
|
522
|
+
}
|
|
523
|
+
if (rule.$attributes.type === 'expression' && (area.start.row !== area.end.row || area.start.column !== area.end.column)) {
|
|
524
|
+
// (1) this is only required if there are relative references
|
|
525
|
+
// in the formula. so we could check and short-circuit.
|
|
526
|
+
//
|
|
527
|
+
// (2) I'd like to find a way to apply this as a single formula,
|
|
528
|
+
// so there's only one rule required.
|
|
529
|
+
this.parser.Save();
|
|
530
|
+
this.parser.SetLocaleSettings(DecimalMarkType.Period);
|
|
531
|
+
const list = [];
|
|
532
|
+
const a2 = new Area(area.start, area.end);
|
|
533
|
+
const parse_result = this.parser.Parse(formula);
|
|
534
|
+
if (parse_result.expression) {
|
|
535
|
+
for (const cell of a2) {
|
|
536
|
+
const f = this.parser.Render(parse_result.expression, {
|
|
537
|
+
missing: '',
|
|
538
|
+
offset: { rows: cell.row - area.start.row, columns: cell.column - area.start.column }
|
|
539
|
+
});
|
|
540
|
+
list.push({
|
|
541
|
+
type: 'expression',
|
|
542
|
+
expression: f,
|
|
543
|
+
style,
|
|
544
|
+
area: { start: cell, end: cell },
|
|
545
|
+
priority: rule.$attributes.priority,
|
|
546
|
+
});
|
|
547
|
+
// console.info(f);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
this.parser.Restore();
|
|
551
|
+
return list;
|
|
552
|
+
}
|
|
553
|
+
return {
|
|
554
|
+
type: 'expression',
|
|
555
|
+
expression: formula,
|
|
556
|
+
area,
|
|
557
|
+
style,
|
|
558
|
+
priority: rule.$attributes.priority,
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
break;
|
|
562
|
+
case 'dataBar':
|
|
563
|
+
{
|
|
564
|
+
const show_value = rule.dataBar?.$attributes?.showValue ?? true; // default true
|
|
565
|
+
// const hide_values = !rule.dataBar?.$attributes?.showValue;
|
|
566
|
+
// let extension: any = undefined;
|
|
567
|
+
let extension;
|
|
568
|
+
IterateTags(rule.extLst?.ext, ext => {
|
|
569
|
+
if (ext.id !== undefined) {
|
|
570
|
+
for (const test of extensions) {
|
|
571
|
+
return IterateTags(test.cfRule, cfRule => {
|
|
572
|
+
if (cfRule.$attributes?.id === ext.id) {
|
|
573
|
+
extension = test;
|
|
574
|
+
return false;
|
|
575
|
+
}
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
if (!extension) {
|
|
581
|
+
console.info("conditional format extension not found");
|
|
582
|
+
}
|
|
583
|
+
if (rule.dataBar?.color?.$attributes?.rgb) {
|
|
584
|
+
let negative = undefined;
|
|
585
|
+
const first = FirstTag(extension?.cfRule);
|
|
586
|
+
const rgb = first?.dataBar?.negativeFillColor?.$attributes?.rgb;
|
|
587
|
+
if (rgb !== undefined) {
|
|
588
|
+
negative = { text: '#' + rgb.toString().substring(2) };
|
|
589
|
+
}
|
|
590
|
+
const fill = { text: '#' + rule.dataBar.color.$attributes.rgb.substring(2) };
|
|
591
|
+
return {
|
|
592
|
+
type: 'data-bar',
|
|
593
|
+
area,
|
|
594
|
+
fill,
|
|
595
|
+
hide_values: !show_value,
|
|
596
|
+
negative,
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
break;
|
|
601
|
+
case 'colorScale':
|
|
602
|
+
if (rule.colorScale && Array.isArray(rule.colorScale.cfvo) && Array.isArray(rule.colorScale.color)) {
|
|
603
|
+
const stops = [];
|
|
604
|
+
for (const [index, entry] of rule.colorScale.cfvo.entries()) {
|
|
605
|
+
let value = 0;
|
|
606
|
+
const color = {};
|
|
607
|
+
const color_element = rule.colorScale.color[index];
|
|
608
|
+
if (color_element.$attributes?.rgb) {
|
|
609
|
+
color.text = '#' + color_element.$attributes.rgb.substring(2);
|
|
610
|
+
}
|
|
611
|
+
else if (color_element.$attributes?.theme) {
|
|
612
|
+
color.theme = Number(color_element.$attributes.theme) || 0;
|
|
613
|
+
if (color_element.$attributes.tint) {
|
|
614
|
+
color.tint = Math.round(Number(color_element.$attributes.tint) * 1000) / 1000;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
switch (entry.$attributes?.type) {
|
|
618
|
+
case 'min':
|
|
619
|
+
value = 0;
|
|
620
|
+
break;
|
|
621
|
+
case 'max':
|
|
622
|
+
value = 1;
|
|
623
|
+
break;
|
|
624
|
+
case 'percentile':
|
|
625
|
+
value = (Number(entry.$attributes.val) || 0) / 100;
|
|
626
|
+
break;
|
|
627
|
+
}
|
|
628
|
+
stops.push({ color, value });
|
|
629
|
+
}
|
|
630
|
+
return {
|
|
631
|
+
type: 'gradient',
|
|
632
|
+
stops,
|
|
633
|
+
color_space: 'RGB',
|
|
634
|
+
area,
|
|
635
|
+
priority: rule.$attributes.priority,
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
else {
|
|
639
|
+
console.info('unexpected colorScale', { rule });
|
|
640
|
+
}
|
|
641
|
+
break;
|
|
642
|
+
default:
|
|
643
|
+
console.info('unhandled cf type:', { rule });
|
|
644
|
+
}
|
|
645
|
+
return undefined;
|
|
646
|
+
}
|
|
647
|
+
GetSheet(index = 0) {
|
|
648
|
+
if (!this.workbook) {
|
|
649
|
+
throw new Error('missing workbook');
|
|
650
|
+
}
|
|
651
|
+
const sheet = this.workbook.sheets[index];
|
|
652
|
+
// console.info(sheet.sheet_data);
|
|
653
|
+
// console.info(sheet.options.name);
|
|
654
|
+
// we want a sparse array
|
|
655
|
+
const data = [];
|
|
656
|
+
const shared_formulae = {};
|
|
657
|
+
const arrays = [];
|
|
658
|
+
const dynamic_arrays = [];
|
|
659
|
+
const merges = [];
|
|
660
|
+
const conditional_formats = [];
|
|
661
|
+
const links = [];
|
|
662
|
+
const row_styles = []; // may be sparse
|
|
663
|
+
/*
|
|
664
|
+
const validations: Array<{
|
|
665
|
+
address: ICellAddress,
|
|
666
|
+
validation: DataValidation,
|
|
667
|
+
}> = [];
|
|
668
|
+
*/
|
|
669
|
+
const validations = [];
|
|
670
|
+
const annotations = [];
|
|
671
|
+
// const FindAll: <T = GenericDOMElement>(path: string) => T[] = XMLUtils.FindAll.bind(XMLUtils, sheet.sheet_data);
|
|
672
|
+
// tab color
|
|
673
|
+
// const tab_color_element = FindAll('worksheet/sheetPr/tabColor');
|
|
674
|
+
const tab_color_element = sheet.root.sheetPr?.tabColor;
|
|
675
|
+
let tab_color;
|
|
676
|
+
if (tab_color_element) {
|
|
677
|
+
if (tab_color_element.$attributes?.theme !== undefined) {
|
|
678
|
+
tab_color = { theme: tab_color_element.$attributes.theme };
|
|
679
|
+
if (tab_color_element.$attributes.tint !== undefined) {
|
|
680
|
+
tab_color.tint = tab_color_element.$attributes.tint;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
if (tab_color_element.$attributes?.rgb !== undefined) {
|
|
684
|
+
const argb = tab_color_element.$attributes.rgb;
|
|
685
|
+
tab_color = {
|
|
686
|
+
text: '#' + (argb.length > 6 ?
|
|
687
|
+
argb.substr(argb.length - 6) :
|
|
688
|
+
argb),
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
// conditionals
|
|
693
|
+
// const conditional_formatting = // FindAll('worksheet/conditionalFormatting');
|
|
694
|
+
// sheet.root.conditionalFormatting;
|
|
695
|
+
// we might need extensions as well? TODO
|
|
696
|
+
// const conditional_formattings = FindAll('worksheet/extLst/ext/x14:conditionalFormattings/x14:conditionalFormatting');
|
|
697
|
+
const extensions = [];
|
|
698
|
+
IterateTags(sheet.root.extLst?.ext, ext => {
|
|
699
|
+
extensions.push(...EnsureArray(ext.conditionalFormattings?.conditionalFormatting));
|
|
700
|
+
});
|
|
701
|
+
IterateTags(sheet.root.conditionalFormatting, element => {
|
|
702
|
+
if (element.$attributes?.sqref) {
|
|
703
|
+
// FIXME: this attribute might include multiple ranges? e.g.:
|
|
704
|
+
//
|
|
705
|
+
// <conditionalFormatting sqref="B31:I31 B10:E30 G10:I30 F14:F15">
|
|
706
|
+
const parts = element.$attributes.sqref.split(/\s+/);
|
|
707
|
+
for (const part of parts) {
|
|
708
|
+
const area = sheet.TranslateAddress(part);
|
|
709
|
+
if (element.cfRule) {
|
|
710
|
+
IterateTags(element.cfRule, rule => {
|
|
711
|
+
const format = this.ParseConditionalFormat(area, rule, extensions);
|
|
712
|
+
if (format) {
|
|
713
|
+
if (Array.isArray(format)) {
|
|
714
|
+
conditional_formats.push(...format);
|
|
715
|
+
}
|
|
716
|
+
else {
|
|
717
|
+
conditional_formats.push(format);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
});
|
|
725
|
+
// merges
|
|
726
|
+
// const merge_cells = FindAll('worksheet/mergeCells/mergeCell');
|
|
727
|
+
IterateTags(sheet.root.mergeCells?.mergeCell, element => {
|
|
728
|
+
if (element.$attributes?.ref) {
|
|
729
|
+
const merge = sheet.TranslateAddress(element.$attributes.ref);
|
|
730
|
+
if (is_range(merge)) {
|
|
731
|
+
merges.push(ShiftRange(merge, -1, -1));
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
});
|
|
735
|
+
// validation
|
|
736
|
+
IterateTags(sheet.root.dataValidations?.dataValidation, entry => {
|
|
737
|
+
const type = entry.$attributes?.type;
|
|
738
|
+
const ref = entry.$attributes?.sqref;
|
|
739
|
+
const formula = entry.formula1?.$text || '';
|
|
740
|
+
if (ref && formula && type === 'list') {
|
|
741
|
+
let validation;
|
|
742
|
+
let parse_result = this.parser.Parse(ref);
|
|
743
|
+
const target = [];
|
|
744
|
+
// apparently these are encoded as ranges for merged cells...
|
|
745
|
+
// NOTE: actually you can have a range, then validation applies
|
|
746
|
+
// to every cell in the range. also you can have multiple ranges,
|
|
747
|
+
// apparently separated by spaces.
|
|
748
|
+
if (parse_result.expression) {
|
|
749
|
+
if (parse_result.expression.type === 'address') {
|
|
750
|
+
target.push({ start: parse_result.expression, end: parse_result.expression });
|
|
751
|
+
}
|
|
752
|
+
else if (parse_result.expression.type === 'range') {
|
|
753
|
+
target.push(parse_result.expression);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
parse_result = this.parser.Parse(formula);
|
|
757
|
+
if (parse_result.expression) {
|
|
758
|
+
if (parse_result.expression.type === 'range') {
|
|
759
|
+
validation = {
|
|
760
|
+
type: 'range',
|
|
761
|
+
area: parse_result.expression,
|
|
762
|
+
target,
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
else if (parse_result.expression.type === 'literal') {
|
|
766
|
+
validation = {
|
|
767
|
+
type: 'list',
|
|
768
|
+
target,
|
|
769
|
+
list: parse_result.expression.value.toString().split(/,/).map(value => {
|
|
770
|
+
// there are no formulas here. value is a string, separated
|
|
771
|
+
// by commas. there is no way to escape a comma (AFAICT; not
|
|
772
|
+
// official, but search). if you did want a comma, you'd need
|
|
773
|
+
// to use a range.
|
|
774
|
+
// but the uptake is split on commas. after that you can try
|
|
775
|
+
// to check for numbers or bools, but they will be in the string.
|
|
776
|
+
// I think excel might sort the entries? not sure. don't do it
|
|
777
|
+
// for now.
|
|
778
|
+
const num = Number(value);
|
|
779
|
+
if (!isNaN(num)) {
|
|
780
|
+
return num;
|
|
781
|
+
}
|
|
782
|
+
if (value.toLowerCase() === 'true') {
|
|
783
|
+
return true;
|
|
784
|
+
}
|
|
785
|
+
if (value.toLowerCase() === 'false') {
|
|
786
|
+
return false;
|
|
787
|
+
}
|
|
788
|
+
return value; // string
|
|
789
|
+
/*
|
|
790
|
+
const tmp = this.parser.Parse(value);
|
|
791
|
+
|
|
792
|
+
// if type is "group", that means we saw some spaces. this
|
|
793
|
+
// is (probably) an unquoted string literal. for the time
|
|
794
|
+
// being let's assume that. need a counterexample.
|
|
795
|
+
|
|
796
|
+
if (tmp.expression?.type === 'group' && /\s/.test(value)) {
|
|
797
|
+
return value;
|
|
798
|
+
}
|
|
799
|
+
if (tmp.expression?.type === 'literal') {
|
|
800
|
+
return tmp.expression.value;
|
|
801
|
+
}
|
|
802
|
+
if (tmp.expression?.type === 'identifier') {
|
|
803
|
+
return tmp.expression.name;
|
|
804
|
+
}
|
|
805
|
+
return undefined;
|
|
806
|
+
*/
|
|
807
|
+
}),
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
if (target.length && validation) {
|
|
812
|
+
// validations.push({address, validation});
|
|
813
|
+
validations.push(validation);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
});
|
|
817
|
+
// links
|
|
818
|
+
// const hyperlinks = FindAll('worksheet/hyperlinks/hyperlink');
|
|
819
|
+
// for (const child of hyperlinks) {
|
|
820
|
+
IterateTags(sheet.root.hyperlinks?.hyperlink, child => {
|
|
821
|
+
let address = sheet.TranslateAddress(child.$attributes?.ref || '');
|
|
822
|
+
if (is_range(address)) {
|
|
823
|
+
address = address.from;
|
|
824
|
+
}
|
|
825
|
+
let text = '';
|
|
826
|
+
let reference = '';
|
|
827
|
+
if (child.$attributes?.id !== undefined) {
|
|
828
|
+
text = 'remote link';
|
|
829
|
+
const relationship = sheet.rels[child.$attributes.id];
|
|
830
|
+
if (relationship) {
|
|
831
|
+
reference = relationship.target || '';
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
else {
|
|
835
|
+
// what's up with these weird attributes? did we change this at
|
|
836
|
+
// some point and not update this block? (probably)
|
|
837
|
+
/*
|
|
838
|
+
reference = typeof child.__location === 'string' ? child.__location : '';
|
|
839
|
+
text = typeof child.__display === 'string' ? child.__display : '';
|
|
840
|
+
*/
|
|
841
|
+
reference = child.$attributes?.location || '';
|
|
842
|
+
text = child.$attributes?.display || '';
|
|
843
|
+
}
|
|
844
|
+
links.push({ address, reference, text });
|
|
845
|
+
});
|
|
846
|
+
// base
|
|
847
|
+
let default_row_height = 21;
|
|
848
|
+
let default_column_width = 100; // ?
|
|
849
|
+
const sheet_format = sheet.root.sheetFormatPr;
|
|
850
|
+
if (sheet_format) {
|
|
851
|
+
if (sheet_format.$attributes?.defaultColWidth !== undefined) {
|
|
852
|
+
default_column_width = ColumnWidthToPixels(sheet_format.$attributes.defaultColWidth);
|
|
853
|
+
}
|
|
854
|
+
if (sheet_format.$attributes?.defaultRowHeight) {
|
|
855
|
+
default_row_height = Math.round((sheet_format.$attributes.defaultRowHeight) * 4 / 3); // ??
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
// data (and row heights)
|
|
859
|
+
const row_heights = [];
|
|
860
|
+
const outline = [];
|
|
861
|
+
// const rows = FindAll('worksheet/sheetData/row');
|
|
862
|
+
// for (const row of rows) {
|
|
863
|
+
IterateTags(sheet.root.sheetData.row, row => {
|
|
864
|
+
const row_index = row.$attributes?.r ?? 1;
|
|
865
|
+
let height = default_row_height;
|
|
866
|
+
if (row.$attributes?.ht !== undefined) {
|
|
867
|
+
height = Math.round((row.$attributes.ht) * 4 / 3); // seems to be the excel unit -> pixel ratio
|
|
868
|
+
}
|
|
869
|
+
if (row.$attributes?.outlineLevel !== undefined) {
|
|
870
|
+
outline[row_index - 1] = row.$attributes?.outlineLevel;
|
|
871
|
+
}
|
|
872
|
+
if (row.$attributes?.s !== undefined) {
|
|
873
|
+
row_styles[row_index - 1] = row.$attributes.s;
|
|
874
|
+
}
|
|
875
|
+
// if there's a height which is not === default height, but
|
|
876
|
+
// the customHeight attribute is not set, then it's been auto-sized.
|
|
877
|
+
// not sure that's something we need to care about necessarily...
|
|
878
|
+
if (height !== default_row_height) {
|
|
879
|
+
row_heights[row_index - 1] = height;
|
|
880
|
+
}
|
|
881
|
+
// const cells = row.c ? Array.isArray(row.c) ? row.c : [row.c] : [];
|
|
882
|
+
// for (const element of cells) {
|
|
883
|
+
IterateTags(row.c, element => {
|
|
884
|
+
const cell = this.ParseCell(sheet, element, shared_formulae, arrays, dynamic_arrays, merges, links);
|
|
885
|
+
if (cell) {
|
|
886
|
+
data.push(cell);
|
|
887
|
+
}
|
|
888
|
+
});
|
|
889
|
+
});
|
|
890
|
+
const column_styles = [];
|
|
891
|
+
let default_column_style = -1;
|
|
892
|
+
const column_widths = [];
|
|
893
|
+
IterateTags(sheet.root.cols, cols => {
|
|
894
|
+
IterateTags(cols.col, child => {
|
|
895
|
+
const min = child.$attributes?.min ?? 0;
|
|
896
|
+
const max = child.$attributes?.max ?? 0;
|
|
897
|
+
if (child.$attributes?.style !== undefined) {
|
|
898
|
+
const style = child.$attributes.style;
|
|
899
|
+
// this is not the way to do this? for the time being
|
|
900
|
+
// it's OK because style doesn't need to extend past
|
|
901
|
+
// extent (but width does)
|
|
902
|
+
if (sheet.extent && max >= sheet.extent.to.col || max - min > 100) { // just spitballing on that last one
|
|
903
|
+
default_column_style = style;
|
|
904
|
+
}
|
|
905
|
+
else {
|
|
906
|
+
for (let i = min; i <= max; i++) {
|
|
907
|
+
column_styles[i] = style;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
if (child.$attributes?.customWidth) {
|
|
912
|
+
let width = child.$attributes.width ?? 0;
|
|
913
|
+
if (max === 16384) {
|
|
914
|
+
// ...
|
|
915
|
+
}
|
|
916
|
+
else {
|
|
917
|
+
// otherwise it will set -> 16384
|
|
918
|
+
// if (sheet.extent) {
|
|
919
|
+
// max = Math.min(max, sheet.extent.to.col + 1);
|
|
920
|
+
// }
|
|
921
|
+
// width = Math.round(width / one_hundred_pixels * 100);
|
|
922
|
+
width = ColumnWidthToPixels(width);
|
|
923
|
+
for (let i = min; i <= max; i++)
|
|
924
|
+
column_widths[i - 1] = width;
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
});
|
|
928
|
+
});
|
|
929
|
+
// --- import tables -------------------------------------------------------
|
|
930
|
+
IterateTags(sheet.root.tableParts, tablePart => {
|
|
931
|
+
IterateTags(tablePart.tablePart, child => {
|
|
932
|
+
const rel = child.$attributes?.id;
|
|
933
|
+
if (rel !== undefined) {
|
|
934
|
+
let reference = '';
|
|
935
|
+
const relationship = sheet.rels[rel];
|
|
936
|
+
if (relationship) {
|
|
937
|
+
reference = relationship.target || '';
|
|
938
|
+
const description = this.workbook?.ReadTable(reference);
|
|
939
|
+
if (description) {
|
|
940
|
+
// console.info({description});
|
|
941
|
+
const ref = sheet.TranslateAddress(description.ref);
|
|
942
|
+
const area = is_address(ref) ? {
|
|
943
|
+
start: { row: ref.row - 1, column: ref.col - 1 },
|
|
944
|
+
end: { row: ref.row - 1, column: ref.col - 1 },
|
|
945
|
+
} : {
|
|
946
|
+
start: { row: ref.from.row - 1, column: ref.from.col - 1 },
|
|
947
|
+
end: { row: ref.to.row - 1, column: ref.to.col - 1 },
|
|
948
|
+
};
|
|
949
|
+
for (const cell of data) {
|
|
950
|
+
if (cell.row === area.start.row && cell.column === area.start.column) {
|
|
951
|
+
cell.table = {
|
|
952
|
+
area,
|
|
953
|
+
name: description.name,
|
|
954
|
+
totals_row: (!!description.totals_row_count),
|
|
955
|
+
// NOTE: column headers are added on first load, we don't
|
|
956
|
+
// read them from here. not super efficient but we do it
|
|
957
|
+
// that way for regular loads as well
|
|
958
|
+
};
|
|
959
|
+
break;
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
});
|
|
966
|
+
});
|
|
967
|
+
// --- import drawings -----------------------------------------------------
|
|
968
|
+
// wip...
|
|
969
|
+
// const drawings = FindAll('worksheet/drawing');
|
|
970
|
+
const chart_descriptors = [];
|
|
971
|
+
const image_descriptors = [];
|
|
972
|
+
const textbox_descriptors = [];
|
|
973
|
+
if (this.workbook) {
|
|
974
|
+
const workbook = this.workbook;
|
|
975
|
+
IterateTags(sheet.root.drawing, child => {
|
|
976
|
+
const rel = child.$attributes?.id;
|
|
977
|
+
if (rel !== undefined) {
|
|
978
|
+
let reference = '';
|
|
979
|
+
const relationship = sheet.rels[rel];
|
|
980
|
+
if (relationship) {
|
|
981
|
+
reference = relationship.target || '';
|
|
982
|
+
}
|
|
983
|
+
if (reference) {
|
|
984
|
+
const drawing = workbook.ReadDrawing(reference);
|
|
985
|
+
if (drawing && drawing.length) {
|
|
986
|
+
for (const entry of drawing) {
|
|
987
|
+
switch (entry.type) {
|
|
988
|
+
case 'chart':
|
|
989
|
+
chart_descriptors.push(entry);
|
|
990
|
+
break;
|
|
991
|
+
case 'image':
|
|
992
|
+
image_descriptors.push(entry);
|
|
993
|
+
break;
|
|
994
|
+
case 'textbox':
|
|
995
|
+
textbox_descriptors.push(entry);
|
|
996
|
+
break;
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
const AnchorToCorner = (anchor) => {
|
|
1005
|
+
const result = {
|
|
1006
|
+
address: {
|
|
1007
|
+
row: anchor.row,
|
|
1008
|
+
column: anchor.column,
|
|
1009
|
+
},
|
|
1010
|
+
offset: {
|
|
1011
|
+
x: 0, // anchor.column_offset || 0, // FIXME: scale
|
|
1012
|
+
y: 0, // anchor.row_offset || 0, // FIXME: scale
|
|
1013
|
+
},
|
|
1014
|
+
};
|
|
1015
|
+
if (anchor.row_offset) {
|
|
1016
|
+
let row_height = row_heights[anchor.row];
|
|
1017
|
+
if (row_height === undefined) {
|
|
1018
|
+
row_height = default_row_height; // FIXME
|
|
1019
|
+
}
|
|
1020
|
+
result.offset.y = (anchor.row_offset / 9525) / row_height;
|
|
1021
|
+
}
|
|
1022
|
+
if (anchor.column_offset) {
|
|
1023
|
+
let column_width = column_widths[anchor.column];
|
|
1024
|
+
if (column_width === undefined) {
|
|
1025
|
+
column_width = default_column_width;
|
|
1026
|
+
}
|
|
1027
|
+
result.offset.x = (anchor.column_offset / 9525) / column_width;
|
|
1028
|
+
}
|
|
1029
|
+
return result;
|
|
1030
|
+
};
|
|
1031
|
+
for (const descriptor of textbox_descriptors) {
|
|
1032
|
+
const layout = {
|
|
1033
|
+
tl: AnchorToCorner(descriptor.anchor.from),
|
|
1034
|
+
br: AnchorToCorner(descriptor.anchor.to),
|
|
1035
|
+
};
|
|
1036
|
+
// console.info({descriptor});
|
|
1037
|
+
const anchored_annotation = {
|
|
1038
|
+
layout,
|
|
1039
|
+
type: 'textbox',
|
|
1040
|
+
data: {
|
|
1041
|
+
style: descriptor.style,
|
|
1042
|
+
paragraphs: descriptor.paragraphs,
|
|
1043
|
+
},
|
|
1044
|
+
};
|
|
1045
|
+
if (descriptor.reference) {
|
|
1046
|
+
anchored_annotation.formula = `=` + descriptor.reference;
|
|
1047
|
+
}
|
|
1048
|
+
annotations.push(anchored_annotation);
|
|
1049
|
+
}
|
|
1050
|
+
for (const descriptor of image_descriptors) {
|
|
1051
|
+
if (descriptor && descriptor.image) {
|
|
1052
|
+
const layout = {
|
|
1053
|
+
tl: AnchorToCorner(descriptor.anchor.from),
|
|
1054
|
+
br: AnchorToCorner(descriptor.anchor.to),
|
|
1055
|
+
};
|
|
1056
|
+
const type = 'image';
|
|
1057
|
+
const data = Base64JS.fromByteArray(descriptor.image);
|
|
1058
|
+
let imagetype = '';
|
|
1059
|
+
if (descriptor.filename) {
|
|
1060
|
+
if (/jpe*g$/i.test(descriptor.filename)) {
|
|
1061
|
+
imagetype = 'jpeg';
|
|
1062
|
+
}
|
|
1063
|
+
else if (/png$/i.test(descriptor.filename)) {
|
|
1064
|
+
imagetype = 'png';
|
|
1065
|
+
}
|
|
1066
|
+
else if (/gif$/i.test(descriptor.filename)) {
|
|
1067
|
+
imagetype = 'gif';
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
if (imagetype && data) {
|
|
1071
|
+
const src = 'data:image/' + imagetype + ';base64,' + data;
|
|
1072
|
+
annotations.push({
|
|
1073
|
+
layout, type, data: { src },
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
for (const descriptor of chart_descriptors) {
|
|
1079
|
+
if (descriptor && descriptor.chart) {
|
|
1080
|
+
// convert the anchor to the annotation type
|
|
1081
|
+
const layout = {
|
|
1082
|
+
tl: AnchorToCorner(descriptor.anchor.from),
|
|
1083
|
+
br: AnchorToCorner(descriptor.anchor.to),
|
|
1084
|
+
};
|
|
1085
|
+
let type;
|
|
1086
|
+
const args = [];
|
|
1087
|
+
let func = '';
|
|
1088
|
+
const series = descriptor.chart?.series;
|
|
1089
|
+
switch (descriptor.chart.type) {
|
|
1090
|
+
case ChartType.Bubble:
|
|
1091
|
+
type = 'treb-chart';
|
|
1092
|
+
func = 'Bubble.Chart';
|
|
1093
|
+
if (series && series.length) {
|
|
1094
|
+
args[0] = `Group(${series.map(s => `Series(${[
|
|
1095
|
+
s.title || '',
|
|
1096
|
+
s.values || '',
|
|
1097
|
+
s.categories || '',
|
|
1098
|
+
s.bubble_size || '',
|
|
1099
|
+
].join(', ')})`).join(', ')})`;
|
|
1100
|
+
}
|
|
1101
|
+
args[1] = descriptor.chart.title;
|
|
1102
|
+
break;
|
|
1103
|
+
case ChartType.Histogram:
|
|
1104
|
+
type = 'treb-chart';
|
|
1105
|
+
func = 'Histogram.Plot';
|
|
1106
|
+
if (series?.length) {
|
|
1107
|
+
// ...
|
|
1108
|
+
}
|
|
1109
|
+
args[1] = descriptor.chart.title;
|
|
1110
|
+
break;
|
|
1111
|
+
case ChartType.Box:
|
|
1112
|
+
type = 'treb-chart';
|
|
1113
|
+
func = 'Box.Plot';
|
|
1114
|
+
if (series?.length) {
|
|
1115
|
+
args[0] = `Group(${series.map(s => `Series(${s.title || ''},,${s.values || ''})`).join(', ')})`;
|
|
1116
|
+
// console.info("S?", {series}, args[0])
|
|
1117
|
+
}
|
|
1118
|
+
args[1] = descriptor.chart.title;
|
|
1119
|
+
break;
|
|
1120
|
+
case ChartType.Scatter:
|
|
1121
|
+
type = 'treb-chart';
|
|
1122
|
+
func = 'Scatter.Line';
|
|
1123
|
+
if (series && series.length) {
|
|
1124
|
+
args[0] = `Group(${series.map(s => `Series(${s.title || ''},${s.categories || ''},${s.values || ''})`).join(', ')})`;
|
|
1125
|
+
}
|
|
1126
|
+
args[1] = descriptor.chart.title;
|
|
1127
|
+
break;
|
|
1128
|
+
case ChartType.Donut:
|
|
1129
|
+
case ChartType.Pie:
|
|
1130
|
+
func = descriptor.chart.type === ChartType.Donut ? 'Donut.Chart' : 'Pie.Chart';
|
|
1131
|
+
type = 'treb-chart';
|
|
1132
|
+
if (series && series[0]) {
|
|
1133
|
+
args[0] = series[0].values;
|
|
1134
|
+
args[1] = series[0]?.categories || '';
|
|
1135
|
+
}
|
|
1136
|
+
args[2] = descriptor.chart.title;
|
|
1137
|
+
break;
|
|
1138
|
+
case ChartType.Bar:
|
|
1139
|
+
case ChartType.Column:
|
|
1140
|
+
case ChartType.Line:
|
|
1141
|
+
args[2] = descriptor.chart.title;
|
|
1142
|
+
type = 'treb-chart';
|
|
1143
|
+
switch (descriptor.chart.type) {
|
|
1144
|
+
case ChartType.Bar:
|
|
1145
|
+
func = 'Bar.Chart';
|
|
1146
|
+
break;
|
|
1147
|
+
case ChartType.Column:
|
|
1148
|
+
func = 'Column.Chart';
|
|
1149
|
+
break;
|
|
1150
|
+
default:
|
|
1151
|
+
func = 'Line.Chart';
|
|
1152
|
+
}
|
|
1153
|
+
if (series) {
|
|
1154
|
+
if (series.length > 1) {
|
|
1155
|
+
args[0] = `Group(${series.map(s => `Series(${s.title || ''},,${s.values || ''})`).join(', ')})`;
|
|
1156
|
+
}
|
|
1157
|
+
else if (series.length === 1) {
|
|
1158
|
+
if (series[0].title) {
|
|
1159
|
+
args[0] = `Series(${series[0].title || ''},,${series[0].values || ''})`;
|
|
1160
|
+
}
|
|
1161
|
+
else {
|
|
1162
|
+
args[0] = series[0].values;
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
args[1] = series[0]?.categories || '';
|
|
1166
|
+
}
|
|
1167
|
+
if (descriptor.chart.type === ChartType.Column && descriptor.chart.flags?.includes('stacked')) {
|
|
1168
|
+
args[3] = '"stacked"';
|
|
1169
|
+
}
|
|
1170
|
+
break;
|
|
1171
|
+
}
|
|
1172
|
+
const formula = `=${func}(${args.join(', ')})`;
|
|
1173
|
+
// console.info('f', formula);
|
|
1174
|
+
if (type && formula) {
|
|
1175
|
+
annotations.push({
|
|
1176
|
+
layout,
|
|
1177
|
+
type,
|
|
1178
|
+
formula,
|
|
1179
|
+
});
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
// /wip
|
|
1184
|
+
IterateTags(sheet.root.extLst?.ext, entry => {
|
|
1185
|
+
IterateTags(entry.sparklineGroups?.sparklineGroup, group => {
|
|
1186
|
+
// const groups = XMLUtils.FindAll(entry, `${prefix}:sparklineGroups/${prefix}:sparklineGroup`);
|
|
1187
|
+
// for (const group of groups) {
|
|
1188
|
+
let func = 'Sparkline.line';
|
|
1189
|
+
let reference = '';
|
|
1190
|
+
let source = '';
|
|
1191
|
+
if (group.$attributes?.type === 'column') {
|
|
1192
|
+
func = 'Sparkline.column';
|
|
1193
|
+
}
|
|
1194
|
+
// TODO: gap optional
|
|
1195
|
+
// TODO: colors
|
|
1196
|
+
IterateTags(group.sparklines.sparkline, sparkline => {
|
|
1197
|
+
source = sparkline.f?.$text ?? '';
|
|
1198
|
+
reference = sparkline.sqref?.$text ?? '';
|
|
1199
|
+
});
|
|
1200
|
+
//
|
|
1201
|
+
if (source && reference) {
|
|
1202
|
+
const constructed_function = `=${func}(${source})`;
|
|
1203
|
+
// 1: merges
|
|
1204
|
+
// 2: maybe already in the list? need to filter
|
|
1205
|
+
const translated = sheet.TranslateAddress(reference);
|
|
1206
|
+
if (is_address(translated)) {
|
|
1207
|
+
const result = {
|
|
1208
|
+
row: translated.row - 1,
|
|
1209
|
+
column: translated.col - 1,
|
|
1210
|
+
value: constructed_function,
|
|
1211
|
+
type: 'formula', // ValueType.formula,
|
|
1212
|
+
};
|
|
1213
|
+
let matched = false;
|
|
1214
|
+
for (const element of data) {
|
|
1215
|
+
if (element.row === result.row && element.column === result.column) {
|
|
1216
|
+
matched = true;
|
|
1217
|
+
element.type = 'formula'; // ValueType.formula;
|
|
1218
|
+
element.value = constructed_function;
|
|
1219
|
+
break;
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
if (!matched) {
|
|
1223
|
+
data.push(result);
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
//
|
|
1228
|
+
});
|
|
1229
|
+
});
|
|
1230
|
+
const result = {
|
|
1231
|
+
name: sheet.options.name,
|
|
1232
|
+
cells: data,
|
|
1233
|
+
default_column_width,
|
|
1234
|
+
column_widths,
|
|
1235
|
+
row_heights,
|
|
1236
|
+
tab_color,
|
|
1237
|
+
row_styles,
|
|
1238
|
+
annotations,
|
|
1239
|
+
conditional_formats,
|
|
1240
|
+
data_validations: validations,
|
|
1241
|
+
styles: this.workbook?.style_cache?.CellXfToStyles() || [],
|
|
1242
|
+
};
|
|
1243
|
+
if (outline.length) {
|
|
1244
|
+
result.outline = outline;
|
|
1245
|
+
}
|
|
1246
|
+
if (sheet.visible_state === VisibleState.hidden || sheet.visible_state === VisibleState.very_hidden) {
|
|
1247
|
+
result.hidden = true;
|
|
1248
|
+
}
|
|
1249
|
+
if (default_column_style >= 0) {
|
|
1250
|
+
result.sheet_style = default_column_style;
|
|
1251
|
+
}
|
|
1252
|
+
if (column_styles.length) {
|
|
1253
|
+
result.column_styles = column_styles;
|
|
1254
|
+
}
|
|
1255
|
+
return result;
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
//# sourceMappingURL=import.js.map
|