@trebco/treb 37.0.0 → 37.0.1
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-E35ONJUS.mjs} +1 -1
- package/dist/treb-export-worker.mjs +2 -2
- package/dist/treb-spreadsheet.mjs +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,842 @@
|
|
|
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 { Color } from './vertex';
|
|
22
|
+
import { SpreadsheetVertex } from './spreadsheet_vertex';
|
|
23
|
+
import { ArrayVertex } from './array-vertex';
|
|
24
|
+
import { Area } from 'treb-base-types';
|
|
25
|
+
import { CalculationLeafVertex } from './calculation_leaf_vertex';
|
|
26
|
+
import { AreaUtils } from 'treb-base-types';
|
|
27
|
+
// FIXME: this is a bad habit if you're testing on falsy for OK.
|
|
28
|
+
export var GraphStatus;
|
|
29
|
+
(function (GraphStatus) {
|
|
30
|
+
GraphStatus[GraphStatus["OK"] = 0] = "OK";
|
|
31
|
+
GraphStatus[GraphStatus["Loop"] = 1] = "Loop";
|
|
32
|
+
GraphStatus[GraphStatus["CalculationError"] = 2] = "CalculationError";
|
|
33
|
+
})(GraphStatus || (GraphStatus = {}));
|
|
34
|
+
/**
|
|
35
|
+
* graph is now abstract, as we are extending it with the calculator.
|
|
36
|
+
*/
|
|
37
|
+
export class Graph {
|
|
38
|
+
/**
|
|
39
|
+
* list of vertices, indexed by address as [sheet id][column][row]
|
|
40
|
+
*/
|
|
41
|
+
vertices = [[]];
|
|
42
|
+
volatile_list = [];
|
|
43
|
+
calculation_list = [];
|
|
44
|
+
// list of spills we have created
|
|
45
|
+
// public spills: IArea[] = [];
|
|
46
|
+
spill_data = [];
|
|
47
|
+
/**
|
|
48
|
+
* where is the loop in the graph (or at least the first one we found)?
|
|
49
|
+
*/
|
|
50
|
+
loop_hint;
|
|
51
|
+
// special
|
|
52
|
+
// public leaf_vertices: LeafVertex[] = [];
|
|
53
|
+
leaf_vertices = new Set();
|
|
54
|
+
/** lock down access */
|
|
55
|
+
dirty_list = [];
|
|
56
|
+
/** flag set on add edge */
|
|
57
|
+
loop_check_required = false;
|
|
58
|
+
/*
|
|
59
|
+
public IsArrayVertex(vertex: Vertex): vertex is ArrayVertex {
|
|
60
|
+
return vertex.type === ArrayVertex.type;
|
|
61
|
+
}
|
|
62
|
+
*/
|
|
63
|
+
IsSpreadsheetVertex(vertex) {
|
|
64
|
+
return vertex.type === SpreadsheetVertex.type;
|
|
65
|
+
}
|
|
66
|
+
/* *
|
|
67
|
+
* we used to attach the data model here, but it's now an instance
|
|
68
|
+
* property (and readonly). we map still need to rebuild the map,
|
|
69
|
+
* so we're retaining the method for the time being (but renamed and
|
|
70
|
+
* reparameterized).
|
|
71
|
+
*
|
|
72
|
+
* if model were a class we wouldn't have to do this...
|
|
73
|
+
* /
|
|
74
|
+
protected RebuildMap(): void {
|
|
75
|
+
this.cells_map = {};
|
|
76
|
+
for (const sheet of this.model.sheets.list) {
|
|
77
|
+
this.cells_map[sheet.id] = sheet.cells;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
*/
|
|
81
|
+
/**
|
|
82
|
+
* flush the graph, calculation tree and cells reference
|
|
83
|
+
*/
|
|
84
|
+
FlushTree() {
|
|
85
|
+
this.dirty_list = [];
|
|
86
|
+
this.volatile_list = [];
|
|
87
|
+
this.vertices = [[]];
|
|
88
|
+
this.leaf_vertices.clear();
|
|
89
|
+
// this.cells_map = {};
|
|
90
|
+
// can we flush spills here without cleaning up? (...)
|
|
91
|
+
// this.spills = [];
|
|
92
|
+
/** array vertex maintains its own list */
|
|
93
|
+
ArrayVertex.Clear();
|
|
94
|
+
}
|
|
95
|
+
ResolveArrayHead(address) {
|
|
96
|
+
if (!address.sheet_id) {
|
|
97
|
+
throw new Error('resolve array head with no sheet id');
|
|
98
|
+
}
|
|
99
|
+
//const cells = this.cells_map[address.sheet_id];
|
|
100
|
+
const cells = this.model.sheets.Find(address.sheet_id)?.cells;
|
|
101
|
+
if (!cells) {
|
|
102
|
+
throw new Error('no cells? sheet id ' + address.sheet_id);
|
|
103
|
+
}
|
|
104
|
+
const row = cells.data[address.row];
|
|
105
|
+
if (row) {
|
|
106
|
+
const cell = row[address.column];
|
|
107
|
+
if (cell && cell.area) {
|
|
108
|
+
const resolved = { row: cell.area.start.row, column: cell.area.start.column, sheet_id: address.sheet_id };
|
|
109
|
+
console.info('array head', address, resolved);
|
|
110
|
+
return resolved;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return address;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* iterate vertices
|
|
117
|
+
* @param area
|
|
118
|
+
*/
|
|
119
|
+
*IterateVertices(area, create = false) {
|
|
120
|
+
// this is wasteful because it repeatedly gets the cells, but
|
|
121
|
+
// for a contiguous area we know they're in the same sheet. we
|
|
122
|
+
// cal also skip the repeated tests. FIXME
|
|
123
|
+
for (const address of AreaUtils.Iterate(area)) {
|
|
124
|
+
const vertex = this.GetVertex(address, create);
|
|
125
|
+
if (vertex) {
|
|
126
|
+
yield vertex;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/** returns the vertex at this address. creates it if necessary. */
|
|
131
|
+
GetVertex(address, create) {
|
|
132
|
+
if (!address.sheet_id) {
|
|
133
|
+
console.info(JSON.stringify({ address, create }));
|
|
134
|
+
console.trace();
|
|
135
|
+
throw new Error('getvertex with no sheet id');
|
|
136
|
+
}
|
|
137
|
+
// if (!this.cells) return undefined;
|
|
138
|
+
//const cells = this.cells_map[address.sheet_id];
|
|
139
|
+
const cells = this.model.sheets.Find(address.sheet_id)?.cells;
|
|
140
|
+
if (!cells) {
|
|
141
|
+
throw new Error('no cells? sheet id ' + address.sheet_id);
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
if (!this.vertices[address.sheet_id]) {
|
|
145
|
+
if (!create) {
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
this.vertices[address.sheet_id] = [];
|
|
149
|
+
}
|
|
150
|
+
if (!this.vertices[address.sheet_id][address.column]) {
|
|
151
|
+
if (!create) {
|
|
152
|
+
return undefined;
|
|
153
|
+
}
|
|
154
|
+
this.vertices[address.sheet_id][address.column] = [];
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
const existing_vertex = this.vertices[address.sheet_id][address.column][address.row];
|
|
158
|
+
if (existing_vertex) {
|
|
159
|
+
return existing_vertex;
|
|
160
|
+
}
|
|
161
|
+
if (!create)
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
const vertex = new SpreadsheetVertex();
|
|
165
|
+
// vertex.address = { ...address };
|
|
166
|
+
// because we are passing in something other than an address, we're
|
|
167
|
+
// collecting a lot of extraneous data here. I am worried that someone
|
|
168
|
+
// is relying on it, so we will force it to be just the address props.
|
|
169
|
+
// see if something breaks.
|
|
170
|
+
vertex.address = {
|
|
171
|
+
row: address.row,
|
|
172
|
+
column: address.column,
|
|
173
|
+
absolute_row: address.absolute_row,
|
|
174
|
+
absolute_column: address.absolute_column,
|
|
175
|
+
sheet_id: address.sheet_id,
|
|
176
|
+
};
|
|
177
|
+
// this breaks if the cell reference does not point to a cell; that
|
|
178
|
+
// happens if a formula references an empty cell, and we run through
|
|
179
|
+
// a serialize/unserialize pass.
|
|
180
|
+
// FIXME: ensuring the cell will work, but that seems like unecessary
|
|
181
|
+
// work; is there a way we can just let this reference dangle? the only
|
|
182
|
+
// thing we need to worry about is maintaining the dependency, so if the
|
|
183
|
+
// cell _is_ created later we get the update. (...)
|
|
184
|
+
// FIXME: the above is not working. recall the BSM model. we had
|
|
185
|
+
//
|
|
186
|
+
// =IF(C3, C3, C4 + x)
|
|
187
|
+
//
|
|
188
|
+
// with no value in C3. as a result if you type something in, it won't
|
|
189
|
+
// update because there's no bound reference. we can ensure the cell,
|
|
190
|
+
// but maybe there's way to get it to work without that.
|
|
191
|
+
// I think the reason is because the reference lookup is closed by
|
|
192
|
+
// the calc routine; so dirty doesn't do it. let's ensure cell, for now.
|
|
193
|
+
/*
|
|
194
|
+
// works ok, maybe a little verbose
|
|
195
|
+
|
|
196
|
+
const row = cells.data2[address.row];
|
|
197
|
+
if (row) {
|
|
198
|
+
const cell = row[address.column];
|
|
199
|
+
if (cell) {
|
|
200
|
+
vertex.reference = cell;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
*/
|
|
204
|
+
vertex.reference = cells.EnsureCell(address);
|
|
205
|
+
this.vertices[address.sheet_id][address.column][address.row] = vertex;
|
|
206
|
+
// if there's an array that contains this cell, we need to create an edge
|
|
207
|
+
// this.CreateImplicitEdgeToArrays(vertex);
|
|
208
|
+
// this is back, in the new form
|
|
209
|
+
ArrayVertex.CreateImplicitEdges(vertex, address);
|
|
210
|
+
return vertex;
|
|
211
|
+
}
|
|
212
|
+
/** deletes the vertex at this address. */
|
|
213
|
+
RemoveVertex(address) {
|
|
214
|
+
if (!address.sheet_id) {
|
|
215
|
+
throw new Error('removevertex with no sheet id');
|
|
216
|
+
}
|
|
217
|
+
const vertex = this.GetVertex(address, false);
|
|
218
|
+
if (!vertex)
|
|
219
|
+
return;
|
|
220
|
+
vertex.Reset();
|
|
221
|
+
this.vertices[address.sheet_id][address.column][address.row] = undefined;
|
|
222
|
+
// ArrayVertex2.CheckOutbound();
|
|
223
|
+
}
|
|
224
|
+
/** removes all edges, for rebuilding. leaves value/formula as-is. */
|
|
225
|
+
ResetVertex(address) {
|
|
226
|
+
const vertex = this.GetVertex(address, false);
|
|
227
|
+
if (vertex)
|
|
228
|
+
vertex.Reset();
|
|
229
|
+
}
|
|
230
|
+
RIBcount = 0;
|
|
231
|
+
/**
|
|
232
|
+
* resets the vertex by removing inbound edges and clearing formula flag.
|
|
233
|
+
* we have an option to set dirty because they get called together
|
|
234
|
+
* frequently, saves a lookup.
|
|
235
|
+
*/
|
|
236
|
+
ResetInbound(address, set_dirty = false, create = true, remove = false) {
|
|
237
|
+
this.RIBcount++;
|
|
238
|
+
const vertex = this.GetVertex(address, create);
|
|
239
|
+
// console.info("RIB", address.row, address.column, 'd?', set_dirty, vertex, 'R?', remove);
|
|
240
|
+
if (!vertex) {
|
|
241
|
+
if (set_dirty) {
|
|
242
|
+
const list = ArrayVertex.GetContainingArrays(address);
|
|
243
|
+
for (const entry of list) {
|
|
244
|
+
this.SetVertexDirty(entry);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
// this vertexes' dependencies might only have one outbound edge
|
|
250
|
+
// (to this); in that case, we could remove the dependency vertex,
|
|
251
|
+
// since it is essentially orphaned
|
|
252
|
+
let dependencies = [];
|
|
253
|
+
// do this conditionally so we avoid the slice if unecessary
|
|
254
|
+
if (remove) {
|
|
255
|
+
// dependencies = vertex.edges_in.slice(0);
|
|
256
|
+
dependencies = Array.from(vertex.edges_in);
|
|
257
|
+
}
|
|
258
|
+
vertex.ClearDependencies();
|
|
259
|
+
if (set_dirty) {
|
|
260
|
+
// this.dirty_list.push(vertex);
|
|
261
|
+
// vertex.SetDirty();
|
|
262
|
+
this.SetVertexDirty(vertex);
|
|
263
|
+
}
|
|
264
|
+
// vertex.expression = { type: 'missing', id: -1 };
|
|
265
|
+
// vertex.expression_error = false;
|
|
266
|
+
// this probably should not happen unless there are no dependents/outbound edges? (...)
|
|
267
|
+
if (remove) {
|
|
268
|
+
if (!vertex.has_outbound_edges) {
|
|
269
|
+
this.RemoveVertex(address);
|
|
270
|
+
}
|
|
271
|
+
for (const dependency of dependencies) {
|
|
272
|
+
if (!dependency.has_inbound_edges && !dependency.has_outbound_edges) {
|
|
273
|
+
const target = dependency;
|
|
274
|
+
if (target.address) {
|
|
275
|
+
this.RemoveVertex(target.address);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
/*
|
|
280
|
+
if (vertex?.has_outbound_edges) {
|
|
281
|
+
console.info('(NOT) removing a vertex with outbound edges...')
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
console.info('removing a vertex')
|
|
285
|
+
this.RemoveVertex(address);
|
|
286
|
+
}
|
|
287
|
+
*/
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
/* * dev * /
|
|
291
|
+
public ForceClean() {
|
|
292
|
+
for (const l1 of this.vertices) {
|
|
293
|
+
if (l1) {
|
|
294
|
+
for (const l2 of l1) {
|
|
295
|
+
if (l2) {
|
|
296
|
+
for (const vertex of l2) {
|
|
297
|
+
if (vertex && vertex.dirty) {
|
|
298
|
+
vertex.dirty = false;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/ * * dev, check if any vertices are dirtices * /
|
|
309
|
+
public CheckDirty() {
|
|
310
|
+
|
|
311
|
+
for (const l1 of this.vertices) {
|
|
312
|
+
if (l1) {
|
|
313
|
+
for (const l2 of l1) {
|
|
314
|
+
if (l2) {
|
|
315
|
+
for (const vertex of l2) {
|
|
316
|
+
if (vertex && vertex.dirty) {
|
|
317
|
+
console.info("DIRTY", `R${vertex.address?.row} C${vertex.address?.column}`, vertex);
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
}
|
|
328
|
+
*/
|
|
329
|
+
/**
|
|
330
|
+
* reset all vertices. this method is used so we can run the loop check
|
|
331
|
+
* as part of the graph calculation, instead of requiring the separate call.
|
|
332
|
+
*/
|
|
333
|
+
ResetLoopState() {
|
|
334
|
+
for (const l1 of this.vertices) {
|
|
335
|
+
if (l1) {
|
|
336
|
+
for (const l2 of l1) {
|
|
337
|
+
if (l2) {
|
|
338
|
+
for (const vertex of l2) {
|
|
339
|
+
if (vertex) {
|
|
340
|
+
// vertex.color = Color.white;
|
|
341
|
+
vertex.color = vertex.edges_out.size ? Color.white : Color.black;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
// this is unecessary
|
|
349
|
+
for (const vertex of this.leaf_vertices) {
|
|
350
|
+
vertex.color = Color.black;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* global check returns true if there is any loop. this is more efficient
|
|
355
|
+
* than detecting loops on every call to AddEdge. uses the color algorithm
|
|
356
|
+
* from CLRS.
|
|
357
|
+
*
|
|
358
|
+
* UPDATE we switched to a stack-based check because we were hitting
|
|
359
|
+
* recursion limits, although that seemed to only happen in workers --
|
|
360
|
+
* perhaps they have different stack [in the malloc sense] sizes? in any
|
|
361
|
+
* event, I think the version below is now stable.
|
|
362
|
+
*
|
|
363
|
+
* @param force force a check, for dev/debug
|
|
364
|
+
*/
|
|
365
|
+
LoopCheck(force = false) {
|
|
366
|
+
// this flag is only set on AddEdge, and only cleared when we successfully
|
|
367
|
+
// get through this function. so if there are no new edges, we can bypass.
|
|
368
|
+
if (!this.loop_check_required && !force) {
|
|
369
|
+
return false;
|
|
370
|
+
}
|
|
371
|
+
// vertices is array [][][]
|
|
372
|
+
// build a list so we can simplify the second loop (waste of space?)
|
|
373
|
+
const list = [];
|
|
374
|
+
for (const l1 of this.vertices) {
|
|
375
|
+
if (l1) {
|
|
376
|
+
for (const l2 of l1) {
|
|
377
|
+
if (l2) {
|
|
378
|
+
for (const vertex of l2) {
|
|
379
|
+
if (vertex) {
|
|
380
|
+
vertex.color = vertex.edges_out.size ? Color.white : Color.black;
|
|
381
|
+
list.push(vertex);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
// we were having problems with large calculation loops (basically long
|
|
389
|
+
// lists of x+1) using a recursive DFS. so we need to switch to a stack,
|
|
390
|
+
// just in case, hopefully it won't be too expensive.
|
|
391
|
+
// ---
|
|
392
|
+
// unwind recursion -> stack. seems to work OK. could we not just
|
|
393
|
+
// use the list as the initial stack? (...)
|
|
394
|
+
// NOTE: I think this method is bugged. I'm fixing it in the vertex
|
|
395
|
+
// version of the loop check routine (because we don't use this anymore)
|
|
396
|
+
// but if this ever comes back it needs to be fixed.
|
|
397
|
+
const stack = [];
|
|
398
|
+
for (const vertex of list) {
|
|
399
|
+
if (vertex.color === Color.white) {
|
|
400
|
+
vertex.color = Color.gray; // testing
|
|
401
|
+
stack.push(vertex);
|
|
402
|
+
while (stack.length) {
|
|
403
|
+
// so leave it on the stack until we're done. we may "recurse", in
|
|
404
|
+
// which case we need to come back to this item when the children
|
|
405
|
+
// have been handled. we will wind up looping again, so there are
|
|
406
|
+
// some wasted checks, although I'm not sure how to deal with that
|
|
407
|
+
// without duplicating the edge list.
|
|
408
|
+
// concept: stack is a list of [edge, skip = 0]
|
|
409
|
+
// when processing an entry, do
|
|
410
|
+
//
|
|
411
|
+
// const x of (skip ? v.edges_out.slice(skip) : v.edges_out)
|
|
412
|
+
//
|
|
413
|
+
// or maybe be efficient and not fancy,
|
|
414
|
+
//
|
|
415
|
+
// for (let i = skip; i < v.edges_out.length; i++)
|
|
416
|
+
//
|
|
417
|
+
// or what you should actually do is use the stack field as the loop
|
|
418
|
+
// variable, so it persists. or put something in the vertex so it
|
|
419
|
+
// persists and applies to things that are placed on the stack more
|
|
420
|
+
// than once.
|
|
421
|
+
const v = stack[stack.length - 1];
|
|
422
|
+
let completed = true;
|
|
423
|
+
if (v.color !== Color.black) {
|
|
424
|
+
for (const edge of v.edges_out) {
|
|
425
|
+
if (edge.color === Color.gray) {
|
|
426
|
+
this.loop_hint = this.RenderAddress(vertex.address);
|
|
427
|
+
console.info('loop detected @', this.loop_hint);
|
|
428
|
+
return true; // exit
|
|
429
|
+
}
|
|
430
|
+
else if (edge.color === Color.white) {
|
|
431
|
+
// here we're pushing onto the stack, so these will be handled
|
|
432
|
+
// next, but since v is still on the stack once those are done
|
|
433
|
+
// we will hit v again.
|
|
434
|
+
// edge.color = Color.gray;
|
|
435
|
+
stack.push(edge);
|
|
436
|
+
completed = false;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
// if we have not pushed anything onto the stack (we have not
|
|
441
|
+
// recursed), then we can clean up; since the stack is still the
|
|
442
|
+
// same we can pop() now.
|
|
443
|
+
if (completed) {
|
|
444
|
+
stack.pop();
|
|
445
|
+
v.color = Color.black; // v is complete, just in case we test it again
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
// OK, tested and complete
|
|
449
|
+
vertex.color = Color.black;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
/*
|
|
453
|
+
|
|
454
|
+
const tail = (vertex: Vertex): boolean => {
|
|
455
|
+
vertex.color = Color.gray;
|
|
456
|
+
for (const edge of vertex.edges_out) {
|
|
457
|
+
if (edge.color === Color.gray) {
|
|
458
|
+
this.loop_hint = this.RenderAddress((vertex as SpreadsheetVertex).address);
|
|
459
|
+
console.info('loop detected @', this.loop_hint);
|
|
460
|
+
return true; // loop
|
|
461
|
+
}
|
|
462
|
+
else if (edge.color === Color.white) {
|
|
463
|
+
if (tail(edge)) {
|
|
464
|
+
return true; // loop
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
vertex.color = Color.black;
|
|
469
|
+
return false;
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
for (const vertex of list) {
|
|
473
|
+
if (vertex.color === Color.white && tail(vertex)) { return true; }
|
|
474
|
+
}
|
|
475
|
+
*/
|
|
476
|
+
this.loop_check_required = false;
|
|
477
|
+
this.loop_hint = undefined;
|
|
478
|
+
return false;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* render address as string; this is for reporting loops
|
|
482
|
+
*/
|
|
483
|
+
RenderAddress(address) {
|
|
484
|
+
if (!address) {
|
|
485
|
+
return 'undefined';
|
|
486
|
+
}
|
|
487
|
+
let sheet_name = '';
|
|
488
|
+
if (address.sheet_id) {
|
|
489
|
+
const sheet = this.model.sheets.Find(address.sheet_id);
|
|
490
|
+
if (sheet) {
|
|
491
|
+
sheet_name = sheet.name + '!';
|
|
492
|
+
}
|
|
493
|
+
/*
|
|
494
|
+
for (const sheet of this.model.sheets.list) {
|
|
495
|
+
if (address.sheet_id === sheet.id) {
|
|
496
|
+
sheet_name = sheet.name + '!';
|
|
497
|
+
break;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
*/
|
|
501
|
+
}
|
|
502
|
+
const area = new Area(address);
|
|
503
|
+
return sheet_name + area.spreadsheet_label;
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* new array vertices
|
|
507
|
+
*/
|
|
508
|
+
CompositeAddArrayEdge(u, vertex) {
|
|
509
|
+
if (!u.start.sheet_id) {
|
|
510
|
+
throw new Error('AddArrayEdge called without sheet ID');
|
|
511
|
+
}
|
|
512
|
+
// create or use existing
|
|
513
|
+
const [array_vertex, created] = ArrayVertex.GetVertex(u);
|
|
514
|
+
// add an edge
|
|
515
|
+
vertex.DependsOn(array_vertex);
|
|
516
|
+
// force a check on next calculation pass
|
|
517
|
+
this.loop_check_required = true;
|
|
518
|
+
if (!created) {
|
|
519
|
+
// console.info('reusing, so not adding edges');
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
// now add edges from/to nodes THAT ALREADY EXIST
|
|
523
|
+
// range can't span sheets, so we only need one set to look up
|
|
524
|
+
const map = this.vertices[u.start.sheet_id];
|
|
525
|
+
// console.info({u});
|
|
526
|
+
// this might happen on create, we can let it go because the
|
|
527
|
+
// references will be added when the relevant sheet is added
|
|
528
|
+
if (!map) {
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
// ...
|
|
532
|
+
if (u.entire_row) {
|
|
533
|
+
// console.group('entire row(s)')
|
|
534
|
+
for (let column = 0; column < map.length; column++) {
|
|
535
|
+
if (map[column]) {
|
|
536
|
+
for (let row = u.start.row; row <= u.end.row; row++) {
|
|
537
|
+
const vertex = map[column][row];
|
|
538
|
+
if (vertex) {
|
|
539
|
+
// console.info('add', column, row);
|
|
540
|
+
array_vertex.DependsOn(vertex);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
// console.groupEnd();
|
|
546
|
+
}
|
|
547
|
+
else if (u.entire_column) {
|
|
548
|
+
// console.group('entire column(s)');
|
|
549
|
+
for (let column = u.start.column; column <= u.end.column; column++) {
|
|
550
|
+
if (map[column]) {
|
|
551
|
+
for (const vertex of map[column]) {
|
|
552
|
+
if (vertex?.address) {
|
|
553
|
+
// console.info('add', vertex.address);
|
|
554
|
+
array_vertex.DependsOn(vertex);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
// console.groupEnd();
|
|
560
|
+
}
|
|
561
|
+
else {
|
|
562
|
+
for (let row = u.start.row; row <= u.end.row; row++) {
|
|
563
|
+
for (let column = u.start.column; column <= u.end.column; column++) {
|
|
564
|
+
if (map[column]) {
|
|
565
|
+
const vertex = map[column][row];
|
|
566
|
+
if (vertex) {
|
|
567
|
+
array_vertex.DependsOn(vertex);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
/*
|
|
571
|
+
else {
|
|
572
|
+
console.info("HERE", column, row);
|
|
573
|
+
}
|
|
574
|
+
*/
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
AddLeafVertexArrayEdge(u, vertex) {
|
|
580
|
+
this.CompositeAddArrayEdge(u, vertex);
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* new array vertices
|
|
584
|
+
*/
|
|
585
|
+
AddArrayEdge(u, v) {
|
|
586
|
+
if (!u.start.sheet_id) {
|
|
587
|
+
throw new Error('AddArrayEdge called without sheet ID');
|
|
588
|
+
}
|
|
589
|
+
// this should have already been added...
|
|
590
|
+
const v_v = this.GetVertex(v, true);
|
|
591
|
+
this.CompositeAddArrayEdge(u, v_v);
|
|
592
|
+
}
|
|
593
|
+
/** adds an edge from u -> v */
|
|
594
|
+
AddEdge(u, v) {
|
|
595
|
+
const v_u = this.GetVertex(u, true);
|
|
596
|
+
const v_v = this.GetVertex(v, true);
|
|
597
|
+
// seems pretty uncommon, not sure it's a useful optimization
|
|
598
|
+
// const already_connected = v_u.edges_out.includes(v_v);
|
|
599
|
+
// if (already_connected)
|
|
600
|
+
// console.info('add edge', u.sheet_id, u.row, u.column, '<-', v.sheet_id, v.row, v.column, tag||'')
|
|
601
|
+
// const status = this.LoopCheck(v_v, v_u);
|
|
602
|
+
// if (status === GraphStatus.Loop) { return status; }
|
|
603
|
+
v_v.DependsOn(v_u);
|
|
604
|
+
// add implicit edge to array head. this is required at start
|
|
605
|
+
// because the array isn't set implicitly (why not?)
|
|
606
|
+
// watch out for missing sheet ID!
|
|
607
|
+
if (v_u.reference && v_u.reference.area && !v_u.array_head) {
|
|
608
|
+
// console.info('add implicit edge -> array head (?), u', u, ', v', v);
|
|
609
|
+
// the old version added an implicit edge from array head -> array
|
|
610
|
+
// member, not sure why that was a good idea (or why it doesn't work);
|
|
611
|
+
// add an implicit edge -> v instead...
|
|
612
|
+
//
|
|
613
|
+
// maybe we thought it was a good idea because it would consolidate
|
|
614
|
+
// all the edges through the member? you still get edges, though...
|
|
615
|
+
this.AddEdge({
|
|
616
|
+
...u,
|
|
617
|
+
row: v_u.reference.area.start.row,
|
|
618
|
+
column: v_u.reference.area.start.column,
|
|
619
|
+
}, v); // , 'implicit');
|
|
620
|
+
}
|
|
621
|
+
this.loop_check_required = true; // because new edges
|
|
622
|
+
}
|
|
623
|
+
/** removes edge from u -> v */
|
|
624
|
+
RemoveEdge(u, v) {
|
|
625
|
+
const v_u = this.GetVertex(u, false);
|
|
626
|
+
const v_v = this.GetVertex(v, false);
|
|
627
|
+
if (!v_u || !v_v)
|
|
628
|
+
return;
|
|
629
|
+
v_u.RemoveDependent(v_v);
|
|
630
|
+
v_v.RemoveDependency(v_u);
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* not used? remove
|
|
634
|
+
* @deprecated
|
|
635
|
+
*/
|
|
636
|
+
SetAreaDirty(area) {
|
|
637
|
+
// console.info("SAD");
|
|
638
|
+
if (area.start.column === Infinity
|
|
639
|
+
|| area.end.column === Infinity
|
|
640
|
+
|| area.start.row === Infinity
|
|
641
|
+
|| area.end.row === Infinity) {
|
|
642
|
+
throw new Error('don\'t iterate over infinite area');
|
|
643
|
+
}
|
|
644
|
+
const sheet_id = area.start.sheet_id;
|
|
645
|
+
if (!sheet_id) {
|
|
646
|
+
throw new Error('invalid area, missing sheet id');
|
|
647
|
+
}
|
|
648
|
+
for (let column = area.start.column; column <= area.end.column; column++) {
|
|
649
|
+
for (let row = area.start.row; row <= area.end.row; row++) {
|
|
650
|
+
const address = { row, column, sheet_id };
|
|
651
|
+
const vertex = this.GetVertex(address, false);
|
|
652
|
+
if (vertex) {
|
|
653
|
+
this.SetDirty(address);
|
|
654
|
+
}
|
|
655
|
+
// this.SetArraysDirty(address);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
SetVertexDirty(vertex) {
|
|
660
|
+
// console.info("SvD", vertex);
|
|
661
|
+
// see below re: concern about relying on this
|
|
662
|
+
if (vertex.dirty) {
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
this.dirty_list.push(vertex);
|
|
666
|
+
vertex.dirty = true;
|
|
667
|
+
for (const edge of vertex.edges_out) {
|
|
668
|
+
this.SetVertexDirty(edge);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
/** sets dirty */
|
|
672
|
+
SetDirty(address) {
|
|
673
|
+
// console.info("SD", address);
|
|
674
|
+
const vertex = this.GetVertex(address, true);
|
|
675
|
+
this.SetVertexDirty(vertex);
|
|
676
|
+
}
|
|
677
|
+
// --- leaf vertex api ---
|
|
678
|
+
/**
|
|
679
|
+
* adds a leaf vertex to the graph. this implies that someone else is
|
|
680
|
+
* managing and maintaining these vertices: we only need references.
|
|
681
|
+
*/
|
|
682
|
+
AddLeafVertex(vertex) {
|
|
683
|
+
/*
|
|
684
|
+
if (this.leaf_vertices.has(vertex)) {
|
|
685
|
+
console.info("TLV already has", vertex);
|
|
686
|
+
}
|
|
687
|
+
*/
|
|
688
|
+
this.leaf_vertices.add(vertex);
|
|
689
|
+
}
|
|
690
|
+
/** removes vertex */
|
|
691
|
+
RemoveLeafVertex(vertex) {
|
|
692
|
+
this.leaf_vertices.delete(vertex);
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* adds an edge from u -> v where v is a leaf vertex. this doesn't use
|
|
696
|
+
* the normal semantics, and you must pass in the actual vertex instead
|
|
697
|
+
* of an address.
|
|
698
|
+
*
|
|
699
|
+
* there is no loop check (leaves are not allowed to have outbound
|
|
700
|
+
* edges).
|
|
701
|
+
*/
|
|
702
|
+
AddLeafVertexEdge(u, v) {
|
|
703
|
+
const v_u = this.GetVertex(u, true);
|
|
704
|
+
v.DependsOn(v_u);
|
|
705
|
+
return GraphStatus.OK;
|
|
706
|
+
}
|
|
707
|
+
/** removes edge from u -> v */
|
|
708
|
+
RemoveLeafVertexEdge(u, v) {
|
|
709
|
+
const v_u = this.GetVertex(u, false);
|
|
710
|
+
if (!v_u)
|
|
711
|
+
return;
|
|
712
|
+
v_u.RemoveDependent(v);
|
|
713
|
+
v.RemoveDependency(v_u);
|
|
714
|
+
}
|
|
715
|
+
// --- for initial load ---
|
|
716
|
+
InitializeGraph() {
|
|
717
|
+
for (const vertex of this.dirty_list) {
|
|
718
|
+
// take reference values for spreadsheet vertices
|
|
719
|
+
if (this.IsSpreadsheetVertex(vertex)) {
|
|
720
|
+
vertex.TakeReferenceValue();
|
|
721
|
+
if (this.CheckVolatile(vertex)) {
|
|
722
|
+
this.volatile_list.push(vertex);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
// clear dirty flag on _all_ vertices
|
|
726
|
+
vertex.dirty = false;
|
|
727
|
+
}
|
|
728
|
+
// reset, essentially saying we're clean
|
|
729
|
+
this.dirty_list = [];
|
|
730
|
+
}
|
|
731
|
+
// --- calculation ---
|
|
732
|
+
/** runs calculation */
|
|
733
|
+
Recalculate() {
|
|
734
|
+
/*
|
|
735
|
+
if (this.GlobalLoopCheck()) {
|
|
736
|
+
return GraphStatus.Loop;
|
|
737
|
+
}
|
|
738
|
+
*/
|
|
739
|
+
// FIXME: volatiles should proabbly be caclucated first,
|
|
740
|
+
// not last, because they're probably primary.
|
|
741
|
+
// for (const vertex of this.volatile_list) {
|
|
742
|
+
// vertex.SetDirty();
|
|
743
|
+
// }
|
|
744
|
+
// we do this using the local function so we can trace back arrays.
|
|
745
|
+
// be sure to do this _before_ checking spills
|
|
746
|
+
for (const vertex of this.volatile_list) {
|
|
747
|
+
this.SetVertexDirty(vertex);
|
|
748
|
+
}
|
|
749
|
+
////////////////////////////////////////
|
|
750
|
+
// (moving this up so it comes before we slice the dirty list)
|
|
751
|
+
// the problem with flushing all the spills here
|
|
752
|
+
// is that if we're not calculating a range that
|
|
753
|
+
// intersects with the spill, it will disappear.
|
|
754
|
+
// options are (1) to dirty the spill root, so it
|
|
755
|
+
// calculates, or (2) to check for intersection.
|
|
756
|
+
// checking for intersection might work because
|
|
757
|
+
// we should have vertices and they should be marked
|
|
758
|
+
// as dirty...
|
|
759
|
+
// eh that's not going to work, because edges point
|
|
760
|
+
// the wrong way. if you edit a cell within a spill
|
|
761
|
+
// range, it won't dirty the spill source because
|
|
762
|
+
// the edge goes from spill source -> spill cell.
|
|
763
|
+
// we could create a special leaf vertex to watch the
|
|
764
|
+
// range. or we could just check here. vertices is
|
|
765
|
+
// more elegant (and more memory), this is clumsier (and
|
|
766
|
+
// more calc).
|
|
767
|
+
this.spill_data = this.spill_data.filter(({ area, vertex }) => {
|
|
768
|
+
if (vertex.dirty) {
|
|
769
|
+
vertex.Reset();
|
|
770
|
+
const cells = area.start.sheet_id ? this.model.sheets.Find(area.start.sheet_id)?.cells : undefined;
|
|
771
|
+
if (cells) {
|
|
772
|
+
for (const { cell, row, column } of cells.IterateRC(new Area(area.start, area.end))) {
|
|
773
|
+
if (cell.spill) {
|
|
774
|
+
cell.spill = undefined;
|
|
775
|
+
if (typeof cell.value === 'undefined') {
|
|
776
|
+
cell.Reset();
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
// this is necessary for non-head cells in case the cell has deps
|
|
780
|
+
this.SetDirty({ row, column, sheet_id: area.start.sheet_id });
|
|
781
|
+
}
|
|
782
|
+
// this.SetDirty(area.start);
|
|
783
|
+
}
|
|
784
|
+
return false; // drop
|
|
785
|
+
}
|
|
786
|
+
return true; // keep
|
|
787
|
+
});
|
|
788
|
+
/*
|
|
789
|
+
this.spills = this.spills.filter(spill => {
|
|
790
|
+
let dirty = false;
|
|
791
|
+
for (const vertex of this.IterateVertices(spill)) {
|
|
792
|
+
if (vertex.dirty) {
|
|
793
|
+
console.info("spill is dirty (it)");
|
|
794
|
+
dirty = true;
|
|
795
|
+
break;
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
if (dirty) {
|
|
800
|
+
const cells = spill.start.sheet_id ? this.model.sheets.Find(spill.start.sheet_id)?.cells : undefined;
|
|
801
|
+
if (cells) {
|
|
802
|
+
for (const {cell, row, column} of cells.IterateRC(new Area(spill.start, spill.end))) {
|
|
803
|
+
if (cell.spill) {
|
|
804
|
+
cell.spill = undefined;
|
|
805
|
+
if (typeof cell.value === 'undefined') {
|
|
806
|
+
cell.Reset();
|
|
807
|
+
}
|
|
808
|
+
else {
|
|
809
|
+
this.SetDirty({row, column, sheet_id: spill.start.sheet_id})
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
return false; // drop
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
return true; // keep
|
|
818
|
+
});
|
|
819
|
+
*/
|
|
820
|
+
//////////////////////////////////////////
|
|
821
|
+
this.calculation_list = this.dirty_list.slice(0);
|
|
822
|
+
// console.info("CL", this.calculation_list);
|
|
823
|
+
this.volatile_list = [];
|
|
824
|
+
this.dirty_list = [];
|
|
825
|
+
if (this.loop_check_required) {
|
|
826
|
+
// console.info('reset loop state');
|
|
827
|
+
this.ResetLoopState();
|
|
828
|
+
this.loop_check_required = false;
|
|
829
|
+
}
|
|
830
|
+
// console.info("CL", calculation_list)
|
|
831
|
+
// recalculate everything that's dirty. FIXME: optimize path
|
|
832
|
+
// so we do fewer wasted checks of "are all my deps clean"?
|
|
833
|
+
// for (const vertex of calculation_list) {
|
|
834
|
+
// vertex.Calculate(this);
|
|
835
|
+
//}
|
|
836
|
+
for (let i = 0; i < this.calculation_list.length; i++) {
|
|
837
|
+
this.calculation_list[i].Calculate(this);
|
|
838
|
+
}
|
|
839
|
+
this.calculation_list = [];
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
//# sourceMappingURL=graph.js.map
|