@rowsncolumns/spreadsheet-state 28.0.66
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/LICENSE.md +100 -0
- package/Readme.md +65 -0
- package/dist/cjs/api/border.d.ts +9 -0
- package/dist/cjs/api/border.d.ts.map +1 -0
- package/dist/cjs/api/border.js +25 -0
- package/dist/cjs/api/conditional-format.d.ts +2 -0
- package/dist/cjs/api/conditional-format.d.ts.map +1 -0
- package/dist/cjs/api/conditional-format.js +5 -0
- package/dist/cjs/api/copy-paste.d.ts +20 -0
- package/dist/cjs/api/copy-paste.d.ts.map +1 -0
- package/dist/cjs/api/copy-paste.js +384 -0
- package/dist/cjs/api/data-validation.d.ts +2 -0
- package/dist/cjs/api/data-validation.d.ts.map +1 -0
- package/dist/cjs/api/data-validation.js +5 -0
- package/dist/cjs/api/datatype.d.ts +89 -0
- package/dist/cjs/api/datatype.d.ts.map +1 -0
- package/dist/cjs/api/datatype.js +671 -0
- package/dist/cjs/api/date.d.ts +27 -0
- package/dist/cjs/api/date.d.ts.map +1 -0
- package/dist/cjs/api/date.js +222 -0
- package/dist/cjs/api/decimals.d.ts +10 -0
- package/dist/cjs/api/decimals.d.ts.map +1 -0
- package/dist/cjs/api/decimals.js +192 -0
- package/dist/cjs/api/dependency.d.ts +64 -0
- package/dist/cjs/api/dependency.d.ts.map +1 -0
- package/dist/cjs/api/dependency.js +279 -0
- package/dist/cjs/api/fill.d.ts +88 -0
- package/dist/cjs/api/fill.d.ts.map +1 -0
- package/dist/cjs/api/fill.js +959 -0
- package/dist/cjs/api/filter-range.d.ts +4 -0
- package/dist/cjs/api/filter-range.d.ts.map +1 -0
- package/dist/cjs/api/filter-range.js +101 -0
- package/dist/cjs/api/filter.d.ts +24 -0
- package/dist/cjs/api/filter.d.ts.map +1 -0
- package/dist/cjs/api/filter.js +66 -0
- package/dist/cjs/api/format-caches.d.ts +43 -0
- package/dist/cjs/api/format-caches.d.ts.map +1 -0
- package/dist/cjs/api/format-caches.js +107 -0
- package/dist/cjs/api/formula.d.ts +69 -0
- package/dist/cjs/api/formula.d.ts.map +1 -0
- package/dist/cjs/api/formula.js +458 -0
- package/dist/cjs/api/immer-utils.d.ts +66 -0
- package/dist/cjs/api/immer-utils.d.ts.map +1 -0
- package/dist/cjs/api/immer-utils.js +1633 -0
- package/dist/cjs/api/intl.d.ts +51 -0
- package/dist/cjs/api/intl.d.ts.map +1 -0
- package/dist/cjs/api/intl.js +261 -0
- package/dist/cjs/api/merges.d.ts +7 -0
- package/dist/cjs/api/merges.d.ts.map +1 -0
- package/dist/cjs/api/merges.js +134 -0
- package/dist/cjs/api/outline.d.ts +33 -0
- package/dist/cjs/api/outline.d.ts.map +1 -0
- package/dist/cjs/api/outline.js +70 -0
- package/dist/cjs/api/parse-html.d.ts +15 -0
- package/dist/cjs/api/parse-html.d.ts.map +1 -0
- package/dist/cjs/api/parse-html.js +1066 -0
- package/dist/cjs/api/patches.d.ts +11 -0
- package/dist/cjs/api/patches.d.ts.map +1 -0
- package/dist/cjs/api/patches.js +218 -0
- package/dist/cjs/api/pivot-range.d.ts +8 -0
- package/dist/cjs/api/pivot-range.d.ts.map +1 -0
- package/dist/cjs/api/pivot-range.js +130 -0
- package/dist/cjs/api/range-rule-helpers.d.ts +65 -0
- package/dist/cjs/api/range-rule-helpers.d.ts.map +1 -0
- package/dist/cjs/api/range-rule-helpers.js +142 -0
- package/dist/cjs/api/range.d.ts +19 -0
- package/dist/cjs/api/range.d.ts.map +1 -0
- package/dist/cjs/api/range.js +183 -0
- package/dist/cjs/api/rename-sheet.d.ts +22 -0
- package/dist/cjs/api/rename-sheet.d.ts.map +1 -0
- package/dist/cjs/api/rename-sheet.js +54 -0
- package/dist/cjs/api/selection.d.ts +36 -0
- package/dist/cjs/api/selection.d.ts.map +1 -0
- package/dist/cjs/api/selection.js +133 -0
- package/dist/cjs/api/sort.d.ts +3 -0
- package/dist/cjs/api/sort.d.ts.map +1 -0
- package/dist/cjs/api/sort.js +33 -0
- package/dist/cjs/api/split-text.d.ts +2 -0
- package/dist/cjs/api/split-text.d.ts.map +1 -0
- package/dist/cjs/api/split-text.js +25 -0
- package/dist/cjs/api/structural-formula-update.d.ts +75 -0
- package/dist/cjs/api/structural-formula-update.d.ts.map +1 -0
- package/dist/cjs/api/structural-formula-update.js +508 -0
- package/dist/cjs/api/table.d.ts +39 -0
- package/dist/cjs/api/table.d.ts.map +1 -0
- package/dist/cjs/api/table.js +337 -0
- package/dist/cjs/api/validation.d.ts +12 -0
- package/dist/cjs/api/validation.d.ts.map +1 -0
- package/dist/cjs/api/validation.js +306 -0
- package/dist/cjs/api/xlsx-source.d.ts +22 -0
- package/dist/cjs/api/xlsx-source.d.ts.map +1 -0
- package/dist/cjs/api/xlsx-source.js +31 -0
- package/dist/cjs/atoms/delete-sheet-atom.d.ts +6 -0
- package/dist/cjs/atoms/delete-sheet-atom.d.ts.map +1 -0
- package/dist/cjs/atoms/delete-sheet-atom.js +4 -0
- package/dist/cjs/atoms/dialog-state.atom.d.ts +23 -0
- package/dist/cjs/atoms/dialog-state.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/dialog-state.atom.js +72 -0
- package/dist/cjs/atoms/editing-data-validation-id.atom.d.ts +7 -0
- package/dist/cjs/atoms/editing-data-validation-id.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/editing-data-validation-id.atom.js +12 -0
- package/dist/cjs/atoms/editing-embed.atom.d.ts +8 -0
- package/dist/cjs/atoms/editing-embed.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/editing-embed.atom.js +5 -0
- package/dist/cjs/atoms/editing-table.atom.d.ts +8 -0
- package/dist/cjs/atoms/editing-table.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/editing-table.atom.js +6 -0
- package/dist/cjs/atoms/error-state.atom.d.ts +10 -0
- package/dist/cjs/atoms/error-state.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/error-state.atom.js +5 -0
- package/dist/cjs/atoms/index.d.ts +5 -0
- package/dist/cjs/atoms/index.d.ts.map +1 -0
- package/dist/cjs/atoms/index.js +4 -0
- package/dist/cjs/atoms/insert-image-state.atom.d.ts +6 -0
- package/dist/cjs/atoms/insert-image-state.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/insert-image-state.atom.js +9 -0
- package/dist/cjs/atoms/named-range.atom.d.ts +8 -0
- package/dist/cjs/atoms/named-range.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/named-range.atom.js +6 -0
- package/dist/cjs/atoms/resize-dimension.atom.d.ts +12 -0
- package/dist/cjs/atoms/resize-dimension.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/resize-dimension.atom.js +5 -0
- package/dist/cjs/atoms/sheet-observer.atom.d.ts +16 -0
- package/dist/cjs/atoms/sheet-observer.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/sheet-observer.atom.js +19 -0
- package/dist/cjs/cellxfs-registry.d.ts +37 -0
- package/dist/cjs/cellxfs-registry.d.ts.map +1 -0
- package/dist/cjs/cellxfs-registry.js +175 -0
- package/dist/cjs/commands.d.ts +691 -0
- package/dist/cjs/commands.d.ts.map +1 -0
- package/dist/cjs/commands.js +1 -0
- package/dist/cjs/components/dialogs/delete-sheet-confirmation.d.ts +7 -0
- package/dist/cjs/components/dialogs/delete-sheet-confirmation.d.ts.map +1 -0
- package/dist/cjs/components/dialogs/delete-sheet-confirmation.js +31 -0
- package/dist/cjs/components/dialogs/error-state.d.ts +3 -0
- package/dist/cjs/components/dialogs/error-state.d.ts.map +1 -0
- package/dist/cjs/components/dialogs/error-state.js +24 -0
- package/dist/cjs/components/editors/cell-format-editor.d.ts +26 -0
- package/dist/cjs/components/editors/cell-format-editor.d.ts.map +1 -0
- package/dist/cjs/components/editors/cell-format-editor.js +671 -0
- package/dist/cjs/components/editors/conditional-format-editor.d.ts +43 -0
- package/dist/cjs/components/editors/conditional-format-editor.d.ts.map +1 -0
- package/dist/cjs/components/editors/conditional-format-editor.js +176 -0
- package/dist/cjs/components/editors/conditional-format-rule-editor.d.ts +27 -0
- package/dist/cjs/components/editors/conditional-format-rule-editor.d.ts.map +1 -0
- package/dist/cjs/components/editors/conditional-format-rule-editor.js +640 -0
- package/dist/cjs/components/editors/data-validation-editor.d.ts +27 -0
- package/dist/cjs/components/editors/data-validation-editor.d.ts.map +1 -0
- package/dist/cjs/components/editors/data-validation-editor.js +163 -0
- package/dist/cjs/components/editors/data-validation-rule-editor.d.ts +17 -0
- package/dist/cjs/components/editors/data-validation-rule-editor.d.ts.map +1 -0
- package/dist/cjs/components/editors/data-validation-rule-editor.js +217 -0
- package/dist/cjs/components/editors/embed-editor.d.ts +19 -0
- package/dist/cjs/components/editors/embed-editor.d.ts.map +1 -0
- package/dist/cjs/components/editors/embed-editor.js +80 -0
- package/dist/cjs/components/editors/insert-image-editor.d.ts +20 -0
- package/dist/cjs/components/editors/insert-image-editor.d.ts.map +1 -0
- package/dist/cjs/components/editors/insert-image-editor.js +78 -0
- package/dist/cjs/components/editors/insert-link-editor.d.ts +20 -0
- package/dist/cjs/components/editors/insert-link-editor.d.ts.map +1 -0
- package/dist/cjs/components/editors/insert-link-editor.js +64 -0
- package/dist/cjs/components/editors/named-range-editor.d.ts +13 -0
- package/dist/cjs/components/editors/named-range-editor.d.ts.map +1 -0
- package/dist/cjs/components/editors/named-range-editor.js +106 -0
- package/dist/cjs/components/editors/resize-dimension-editor.d.ts +9 -0
- package/dist/cjs/components/editors/resize-dimension-editor.d.ts.map +1 -0
- package/dist/cjs/components/editors/resize-dimension-editor.js +62 -0
- package/dist/cjs/components/editors/sheet-filter.d.ts +59 -0
- package/dist/cjs/components/editors/sheet-filter.d.ts.map +1 -0
- package/dist/cjs/components/editors/sheet-filter.js +119 -0
- package/dist/cjs/components/editors/table-editor.d.ts +12 -0
- package/dist/cjs/components/editors/table-editor.d.ts.map +1 -0
- package/dist/cjs/components/editors/table-editor.js +105 -0
- package/dist/cjs/components/index.d.ts +13 -0
- package/dist/cjs/components/index.d.ts.map +1 -0
- package/dist/cjs/components/index.js +12 -0
- package/dist/cjs/generated-names.d.ts +51 -0
- package/dist/cjs/generated-names.d.ts.map +1 -0
- package/dist/cjs/generated-names.js +5 -0
- package/dist/cjs/helpers/iterative-calculation.d.ts +4 -0
- package/dist/cjs/helpers/iterative-calculation.d.ts.map +1 -0
- package/dist/cjs/helpers/iterative-calculation.js +44 -0
- package/dist/cjs/helpers/sheet-title.d.ts +5 -0
- package/dist/cjs/helpers/sheet-title.d.ts.map +1 -0
- package/dist/cjs/helpers/sheet-title.js +11 -0
- package/dist/cjs/helpers.d.ts +45 -0
- package/dist/cjs/helpers.d.ts.map +1 -0
- package/dist/cjs/helpers.js +154 -0
- package/dist/cjs/hooks/use-async-datasource.d.ts +57 -0
- package/dist/cjs/hooks/use-async-datasource.d.ts.map +1 -0
- package/dist/cjs/hooks/use-async-datasource.js +329 -0
- package/dist/cjs/hooks/use-calculation-initialize.d.ts +61 -0
- package/dist/cjs/hooks/use-calculation-initialize.d.ts.map +1 -0
- package/dist/cjs/hooks/use-calculation-initialize.js +800 -0
- package/dist/cjs/hooks/use-calculation-process-array.d.ts +20 -0
- package/dist/cjs/hooks/use-calculation-process-array.d.ts.map +1 -0
- package/dist/cjs/hooks/use-calculation-process-array.js +331 -0
- package/dist/cjs/hooks/use-calculation-queue.d.ts +10 -0
- package/dist/cjs/hooks/use-calculation-queue.d.ts.map +1 -0
- package/dist/cjs/hooks/use-calculation-queue.js +15 -0
- package/dist/cjs/hooks/use-calculation-worker.d.ts +37 -0
- package/dist/cjs/hooks/use-calculation-worker.d.ts.map +1 -0
- package/dist/cjs/hooks/use-calculation-worker.js +1868 -0
- package/dist/cjs/hooks/use-calculation.d.ts +173 -0
- package/dist/cjs/hooks/use-calculation.d.ts.map +1 -0
- package/dist/cjs/hooks/use-calculation.js +2735 -0
- package/dist/cjs/hooks/use-can-edit-cellrange.d.ts +31 -0
- package/dist/cjs/hooks/use-can-edit-cellrange.d.ts.map +1 -0
- package/dist/cjs/hooks/use-can-edit-cellrange.js +86 -0
- package/dist/cjs/hooks/use-cellxfs-registry.d.ts +6 -0
- package/dist/cjs/hooks/use-cellxfs-registry.d.ts.map +1 -0
- package/dist/cjs/hooks/use-cellxfs-registry.js +22 -0
- package/dist/cjs/hooks/use-citations.d.ts +19 -0
- package/dist/cjs/hooks/use-citations.d.ts.map +1 -0
- package/dist/cjs/hooks/use-citations.js +62 -0
- package/dist/cjs/hooks/use-comments.d.ts +14 -0
- package/dist/cjs/hooks/use-comments.d.ts.map +1 -0
- package/dist/cjs/hooks/use-comments.js +49 -0
- package/dist/cjs/hooks/use-conditional-formatting-rules.d.ts +22 -0
- package/dist/cjs/hooks/use-conditional-formatting-rules.d.ts.map +1 -0
- package/dist/cjs/hooks/use-conditional-formatting-rules.js +95 -0
- package/dist/cjs/hooks/use-data-validation-rules.d.ts +54 -0
- package/dist/cjs/hooks/use-data-validation-rules.d.ts.map +1 -0
- package/dist/cjs/hooks/use-data-validation-rules.js +151 -0
- package/dist/cjs/hooks/use-deferred-calculation-flush.d.ts +14 -0
- package/dist/cjs/hooks/use-deferred-calculation-flush.d.ts.map +1 -0
- package/dist/cjs/hooks/use-deferred-calculation-flush.js +81 -0
- package/dist/cjs/hooks/use-idle-scheduler.d.ts +5 -0
- package/dist/cjs/hooks/use-idle-scheduler.d.ts.map +1 -0
- package/dist/cjs/hooks/use-idle-scheduler.js +46 -0
- package/dist/cjs/hooks/use-indent.d.ts +23 -0
- package/dist/cjs/hooks/use-indent.d.ts.map +1 -0
- package/dist/cjs/hooks/use-indent.js +98 -0
- package/dist/cjs/hooks/use-named-range.d.ts +7 -0
- package/dist/cjs/hooks/use-named-range.d.ts.map +1 -0
- package/dist/cjs/hooks/use-named-range.js +70 -0
- package/dist/cjs/hooks/use-on-adjust-row-height.d.ts +11 -0
- package/dist/cjs/hooks/use-on-adjust-row-height.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-adjust-row-height.js +66 -0
- package/dist/cjs/hooks/use-on-autoresize.d.ts +17 -0
- package/dist/cjs/hooks/use-on-autoresize.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-autoresize.js +39 -0
- package/dist/cjs/hooks/use-on-banded-ranges.d.ts +15 -0
- package/dist/cjs/hooks/use-on-banded-ranges.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-banded-ranges.js +38 -0
- package/dist/cjs/hooks/use-on-calculation-begin.d.ts +14 -0
- package/dist/cjs/hooks/use-on-calculation-begin.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-calculation-begin.js +36 -0
- package/dist/cjs/hooks/use-on-calculation-success.d.ts +22 -0
- package/dist/cjs/hooks/use-on-calculation-success.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-calculation-success.js +182 -0
- package/dist/cjs/hooks/use-on-change-batch-stream.d.ts +7 -0
- package/dist/cjs/hooks/use-on-change-batch-stream.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-change-batch-stream.js +59 -0
- package/dist/cjs/hooks/use-on-change-batch.d.ts +54 -0
- package/dist/cjs/hooks/use-on-change-batch.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-change-batch.js +124 -0
- package/dist/cjs/hooks/use-on-change-calculated-column.d.ts +23 -0
- package/dist/cjs/hooks/use-on-change-calculated-column.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-change-calculated-column.js +30 -0
- package/dist/cjs/hooks/use-on-change-decimals.d.ts +22 -0
- package/dist/cjs/hooks/use-on-change-decimals.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-change-decimals.js +47 -0
- package/dist/cjs/hooks/use-on-change-formatting.d.ts +44 -0
- package/dist/cjs/hooks/use-on-change-formatting.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-change-formatting.js +165 -0
- package/dist/cjs/hooks/use-on-change-sheet-tabcolor.d.ts +11 -0
- package/dist/cjs/hooks/use-on-change-sheet-tabcolor.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-change-sheet-tabcolor.js +27 -0
- package/dist/cjs/hooks/use-on-change-table-column.d.ts +25 -0
- package/dist/cjs/hooks/use-on-change-table-column.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-change-table-column.js +53 -0
- package/dist/cjs/hooks/use-on-change-theme.d.ts +11 -0
- package/dist/cjs/hooks/use-on-change-theme.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-change-theme.js +20 -0
- package/dist/cjs/hooks/use-on-change.d.ts +61 -0
- package/dist/cjs/hooks/use-on-change.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-change.js +298 -0
- package/dist/cjs/hooks/use-on-clear-formatting.d.ts +17 -0
- package/dist/cjs/hooks/use-on-clear-formatting.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-clear-formatting.js +46 -0
- package/dist/cjs/hooks/use-on-collapse-column-group.d.ts +11 -0
- package/dist/cjs/hooks/use-on-collapse-column-group.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-collapse-column-group.js +47 -0
- package/dist/cjs/hooks/use-on-collapse-row-group.d.ts +18 -0
- package/dist/cjs/hooks/use-on-collapse-row-group.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-collapse-row-group.js +57 -0
- package/dist/cjs/hooks/use-on-copy.d.ts +49 -0
- package/dist/cjs/hooks/use-on-copy.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-copy.js +325 -0
- package/dist/cjs/hooks/use-on-create-named-range.d.ts +13 -0
- package/dist/cjs/hooks/use-on-create-named-range.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-create-named-range.js +33 -0
- package/dist/cjs/hooks/use-on-create-sheet.d.ts +23 -0
- package/dist/cjs/hooks/use-on-create-sheet.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-create-sheet.js +66 -0
- package/dist/cjs/hooks/use-on-delete-cells-shift-left.d.ts +28 -0
- package/dist/cjs/hooks/use-on-delete-cells-shift-left.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-delete-cells-shift-left.js +66 -0
- package/dist/cjs/hooks/use-on-delete-cells-shift-up.d.ts +28 -0
- package/dist/cjs/hooks/use-on-delete-cells-shift-up.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-delete-cells-shift-up.js +66 -0
- package/dist/cjs/hooks/use-on-delete-column.d.ts +38 -0
- package/dist/cjs/hooks/use-on-delete-column.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-delete-column.js +87 -0
- package/dist/cjs/hooks/use-on-delete-named-range.d.ts +14 -0
- package/dist/cjs/hooks/use-on-delete-named-range.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-delete-named-range.js +23 -0
- package/dist/cjs/hooks/use-on-delete-row.d.ts +38 -0
- package/dist/cjs/hooks/use-on-delete-row.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-delete-row.js +87 -0
- package/dist/cjs/hooks/use-on-delete-sheet.d.ts +16 -0
- package/dist/cjs/hooks/use-on-delete-sheet.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-delete-sheet.js +37 -0
- package/dist/cjs/hooks/use-on-delete-table-row.d.ts +29 -0
- package/dist/cjs/hooks/use-on-delete-table-row.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-delete-table-row.js +56 -0
- package/dist/cjs/hooks/use-on-delete.d.ts +33 -0
- package/dist/cjs/hooks/use-on-delete.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-delete.js +60 -0
- package/dist/cjs/hooks/use-on-drag-n-drop.d.ts +55 -0
- package/dist/cjs/hooks/use-on-drag-n-drop.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-drag-n-drop.js +191 -0
- package/dist/cjs/hooks/use-on-duplicate-sheet.d.ts +29 -0
- package/dist/cjs/hooks/use-on-duplicate-sheet.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-duplicate-sheet.js +65 -0
- package/dist/cjs/hooks/use-on-embeds.d.ts +19 -0
- package/dist/cjs/hooks/use-on-embeds.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-embeds.js +87 -0
- package/dist/cjs/hooks/use-on-expand-column-group.d.ts +11 -0
- package/dist/cjs/hooks/use-on-expand-column-group.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-expand-column-group.js +45 -0
- package/dist/cjs/hooks/use-on-expand-row-group.d.ts +18 -0
- package/dist/cjs/hooks/use-on-expand-row-group.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-expand-row-group.js +52 -0
- package/dist/cjs/hooks/use-on-fill-range.d.ts +9 -0
- package/dist/cjs/hooks/use-on-fill-range.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-fill-range.js +55 -0
- package/dist/cjs/hooks/use-on-fill.d.ts +29 -0
- package/dist/cjs/hooks/use-on-fill.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-fill.js +78 -0
- package/dist/cjs/hooks/use-on-filter-table.d.ts +76 -0
- package/dist/cjs/hooks/use-on-filter-table.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-filter-table.js +429 -0
- package/dist/cjs/hooks/use-on-find-replace.d.ts +19 -0
- package/dist/cjs/hooks/use-on-find-replace.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-find-replace.js +150 -0
- package/dist/cjs/hooks/use-on-freeze.d.ts +13 -0
- package/dist/cjs/hooks/use-on-freeze.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-freeze.js +56 -0
- package/dist/cjs/hooks/use-on-group-columns.d.ts +11 -0
- package/dist/cjs/hooks/use-on-group-columns.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-group-columns.js +49 -0
- package/dist/cjs/hooks/use-on-group-rows.d.ts +17 -0
- package/dist/cjs/hooks/use-on-group-rows.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-group-rows.js +55 -0
- package/dist/cjs/hooks/use-on-hide-column.d.ts +23 -0
- package/dist/cjs/hooks/use-on-hide-column.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-hide-column.js +55 -0
- package/dist/cjs/hooks/use-on-hide-row.d.ts +32 -0
- package/dist/cjs/hooks/use-on-hide-row.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-hide-row.js +58 -0
- package/dist/cjs/hooks/use-on-hide-show-sheet.d.ts +18 -0
- package/dist/cjs/hooks/use-on-hide-show-sheet.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-hide-show-sheet.js +90 -0
- package/dist/cjs/hooks/use-on-import-csv-legacy.d.ts +8 -0
- package/dist/cjs/hooks/use-on-import-csv-legacy.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-import-csv-legacy.js +165 -0
- package/dist/cjs/hooks/use-on-import-csv.d.ts +28 -0
- package/dist/cjs/hooks/use-on-import-csv.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-import-csv.js +332 -0
- package/dist/cjs/hooks/use-on-import-excel.d.ts +67 -0
- package/dist/cjs/hooks/use-on-import-excel.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-import-excel.js +689 -0
- package/dist/cjs/hooks/use-on-insert-autosum.d.ts +9 -0
- package/dist/cjs/hooks/use-on-insert-autosum.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-insert-autosum.js +105 -0
- package/dist/cjs/hooks/use-on-insert-cells-shift-down.d.ts +28 -0
- package/dist/cjs/hooks/use-on-insert-cells-shift-down.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-insert-cells-shift-down.js +66 -0
- package/dist/cjs/hooks/use-on-insert-cells-shift-right.d.ts +28 -0
- package/dist/cjs/hooks/use-on-insert-cells-shift-right.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-insert-cells-shift-right.js +66 -0
- package/dist/cjs/hooks/use-on-insert-checkbox.d.ts +17 -0
- package/dist/cjs/hooks/use-on-insert-checkbox.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-insert-checkbox.js +87 -0
- package/dist/cjs/hooks/use-on-insert-column.d.ts +40 -0
- package/dist/cjs/hooks/use-on-insert-column.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-insert-column.js +93 -0
- package/dist/cjs/hooks/use-on-insert-date-time.d.ts +4 -0
- package/dist/cjs/hooks/use-on-insert-date-time.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-insert-date-time.js +12 -0
- package/dist/cjs/hooks/use-on-insert-date.d.ts +4 -0
- package/dist/cjs/hooks/use-on-insert-date.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-insert-date.js +13 -0
- package/dist/cjs/hooks/use-on-insert-image.d.ts +24 -0
- package/dist/cjs/hooks/use-on-insert-image.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-insert-image.js +145 -0
- package/dist/cjs/hooks/use-on-insert-link.d.ts +25 -0
- package/dist/cjs/hooks/use-on-insert-link.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-insert-link.js +220 -0
- package/dist/cjs/hooks/use-on-insert-note.d.ts +4 -0
- package/dist/cjs/hooks/use-on-insert-note.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-insert-note.js +14 -0
- package/dist/cjs/hooks/use-on-insert-row.d.ts +38 -0
- package/dist/cjs/hooks/use-on-insert-row.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-insert-row.js +106 -0
- package/dist/cjs/hooks/use-on-insert-table-row.d.ts +31 -0
- package/dist/cjs/hooks/use-on-insert-table-row.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-insert-table-row.js +60 -0
- package/dist/cjs/hooks/use-on-insert-time.d.ts +4 -0
- package/dist/cjs/hooks/use-on-insert-time.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-insert-time.js +12 -0
- package/dist/cjs/hooks/use-on-locale-change.d.ts +35 -0
- package/dist/cjs/hooks/use-on-locale-change.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-locale-change.js +314 -0
- package/dist/cjs/hooks/use-on-merge-unmerge-cells.d.ts +28 -0
- package/dist/cjs/hooks/use-on-merge-unmerge-cells.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-merge-unmerge-cells.js +366 -0
- package/dist/cjs/hooks/use-on-move-columns.d.ts +28 -0
- package/dist/cjs/hooks/use-on-move-columns.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-move-columns.js +378 -0
- package/dist/cjs/hooks/use-on-move-rows.d.ts +30 -0
- package/dist/cjs/hooks/use-on-move-rows.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-move-rows.js +293 -0
- package/dist/cjs/hooks/use-on-move-selection.d.ts +35 -0
- package/dist/cjs/hooks/use-on-move-selection.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-move-selection.js +477 -0
- package/dist/cjs/hooks/use-on-move-sheet.d.ts +12 -0
- package/dist/cjs/hooks/use-on-move-sheet.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-move-sheet.js +68 -0
- package/dist/cjs/hooks/use-on-move-table-columns.d.ts +21 -0
- package/dist/cjs/hooks/use-on-move-table-columns.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-move-table-columns.js +249 -0
- package/dist/cjs/hooks/use-on-paste.d.ts +79 -0
- package/dist/cjs/hooks/use-on-paste.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-paste.js +985 -0
- package/dist/cjs/hooks/use-on-protect-range.d.ts +20 -0
- package/dist/cjs/hooks/use-on-protect-range.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-protect-range.js +67 -0
- package/dist/cjs/hooks/use-on-protect-sheet.d.ts +19 -0
- package/dist/cjs/hooks/use-on-protect-sheet.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-protect-sheet.js +65 -0
- package/dist/cjs/hooks/use-on-remove-duplicates.d.ts +21 -0
- package/dist/cjs/hooks/use-on-remove-duplicates.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-remove-duplicates.js +40 -0
- package/dist/cjs/hooks/use-on-rename-sheet.d.ts +21 -0
- package/dist/cjs/hooks/use-on-rename-sheet.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-rename-sheet.js +80 -0
- package/dist/cjs/hooks/use-on-request-calculate-wrapper.d.ts +30 -0
- package/dist/cjs/hooks/use-on-request-calculate-wrapper.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-request-calculate-wrapper.js +90 -0
- package/dist/cjs/hooks/use-on-request-conditional-format.d.ts +2 -0
- package/dist/cjs/hooks/use-on-request-conditional-format.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-request-conditional-format.js +8 -0
- package/dist/cjs/hooks/use-on-request-data-validation.d.ts +7 -0
- package/dist/cjs/hooks/use-on-request-data-validation.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-request-data-validation.js +23 -0
- package/dist/cjs/hooks/use-on-request-define-named-range.d.ts +8 -0
- package/dist/cjs/hooks/use-on-request-define-named-range.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-request-define-named-range.js +19 -0
- package/dist/cjs/hooks/use-on-request-delete-sheet.d.ts +2 -0
- package/dist/cjs/hooks/use-on-request-delete-sheet.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-request-delete-sheet.js +12 -0
- package/dist/cjs/hooks/use-on-request-edit-table.d.ts +3 -0
- package/dist/cjs/hooks/use-on-request-edit-table.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-request-edit-table.js +11 -0
- package/dist/cjs/hooks/use-on-request-format-cells.d.ts +2 -0
- package/dist/cjs/hooks/use-on-request-format-cells.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-request-format-cells.js +8 -0
- package/dist/cjs/hooks/use-on-request-insert-image.d.ts +3 -0
- package/dist/cjs/hooks/use-on-request-insert-image.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-request-insert-image.js +12 -0
- package/dist/cjs/hooks/use-on-request-insert-link.d.ts +5 -0
- package/dist/cjs/hooks/use-on-request-insert-link.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-request-insert-link.js +9 -0
- package/dist/cjs/hooks/use-on-request-resize.d.ts +3 -0
- package/dist/cjs/hooks/use-on-request-resize.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-request-resize.js +13 -0
- package/dist/cjs/hooks/use-on-request-update-named-range.d.ts +3 -0
- package/dist/cjs/hooks/use-on-request-update-named-range.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-request-update-named-range.js +11 -0
- package/dist/cjs/hooks/use-on-resize-table.d.ts +33 -0
- package/dist/cjs/hooks/use-on-resize-table.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-resize-table.js +218 -0
- package/dist/cjs/hooks/use-on-resize.d.ts +19 -0
- package/dist/cjs/hooks/use-on-resize.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-resize.js +55 -0
- package/dist/cjs/hooks/use-on-set-outline-depth.d.ts +17 -0
- package/dist/cjs/hooks/use-on-set-outline-depth.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-set-outline-depth.js +96 -0
- package/dist/cjs/hooks/use-on-show-column.d.ts +16 -0
- package/dist/cjs/hooks/use-on-show-column.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-show-column.js +96 -0
- package/dist/cjs/hooks/use-on-show-row.d.ts +22 -0
- package/dist/cjs/hooks/use-on-show-row.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-show-row.js +99 -0
- package/dist/cjs/hooks/use-on-sort-column.d.ts +53 -0
- package/dist/cjs/hooks/use-on-sort-column.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-sort-column.js +300 -0
- package/dist/cjs/hooks/use-on-sort-range.d.ts +42 -0
- package/dist/cjs/hooks/use-on-sort-range.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-sort-range.js +252 -0
- package/dist/cjs/hooks/use-on-sort-table.d.ts +59 -0
- package/dist/cjs/hooks/use-on-sort-table.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-sort-table.js +345 -0
- package/dist/cjs/hooks/use-on-table.d.ts +49 -0
- package/dist/cjs/hooks/use-on-table.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-table.js +386 -0
- package/dist/cjs/hooks/use-on-trace-dependents-precedents.d.ts +14 -0
- package/dist/cjs/hooks/use-on-trace-dependents-precedents.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-trace-dependents-precedents.js +146 -0
- package/dist/cjs/hooks/use-on-ungroup-columns.d.ts +11 -0
- package/dist/cjs/hooks/use-on-ungroup-columns.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-ungroup-columns.js +57 -0
- package/dist/cjs/hooks/use-on-ungroup-rows.d.ts +17 -0
- package/dist/cjs/hooks/use-on-ungroup-rows.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-ungroup-rows.js +63 -0
- package/dist/cjs/hooks/use-on-update-named-range.d.ts +19 -0
- package/dist/cjs/hooks/use-on-update-named-range.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-update-named-range.js +133 -0
- package/dist/cjs/hooks/use-on-update-note.d.ts +13 -0
- package/dist/cjs/hooks/use-on-update-note.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-update-note.js +21 -0
- package/dist/cjs/hooks/use-on-update-sheet.d.ts +10 -0
- package/dist/cjs/hooks/use-on-update-sheet.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-update-sheet.js +12 -0
- package/dist/cjs/hooks/use-paint-format.d.ts +17 -0
- package/dist/cjs/hooks/use-paint-format.d.ts.map +1 -0
- package/dist/cjs/hooks/use-paint-format.js +118 -0
- package/dist/cjs/hooks/use-search.d.ts +81 -0
- package/dist/cjs/hooks/use-search.d.ts.map +1 -0
- package/dist/cjs/hooks/use-search.js +261 -0
- package/dist/cjs/hooks/use-select-next-prev-sheet.d.ts +11 -0
- package/dist/cjs/hooks/use-select-next-prev-sheet.d.ts.map +1 -0
- package/dist/cjs/hooks/use-select-next-prev-sheet.js +22 -0
- package/dist/cjs/hooks/use-sheet-observer.d.ts +20 -0
- package/dist/cjs/hooks/use-sheet-observer.d.ts.map +1 -0
- package/dist/cjs/hooks/use-sheet-observer.js +127 -0
- package/dist/cjs/hooks/use-sheet-properties.d.ts +105 -0
- package/dist/cjs/hooks/use-sheet-properties.d.ts.map +1 -0
- package/dist/cjs/hooks/use-sheet-properties.js +1019 -0
- package/dist/cjs/hooks/use-sheet-state.d.ts +17 -0
- package/dist/cjs/hooks/use-sheet-state.d.ts.map +1 -0
- package/dist/cjs/hooks/use-sheet-state.js +84 -0
- package/dist/cjs/hooks/use-sheetdata-subscriber.d.ts +10 -0
- package/dist/cjs/hooks/use-sheetdata-subscriber.d.ts.map +1 -0
- package/dist/cjs/hooks/use-sheetdata-subscriber.js +15 -0
- package/dist/cjs/hooks/use-slicers.d.ts +19 -0
- package/dist/cjs/hooks/use-slicers.d.ts.map +1 -0
- package/dist/cjs/hooks/use-slicers.js +84 -0
- package/dist/cjs/hooks/use-split-text-to-columns.d.ts +19 -0
- package/dist/cjs/hooks/use-split-text-to-columns.d.ts.map +1 -0
- package/dist/cjs/hooks/use-split-text-to-columns.js +32 -0
- package/dist/cjs/hooks/use-spreadsheet-state.d.ts +627 -0
- package/dist/cjs/hooks/use-spreadsheet-state.d.ts.map +1 -0
- package/dist/cjs/hooks/use-spreadsheet-state.js +2038 -0
- package/dist/cjs/hooks/use-ss-registry.d.ts +6 -0
- package/dist/cjs/hooks/use-ss-registry.d.ts.map +1 -0
- package/dist/cjs/hooks/use-ss-registry.js +17 -0
- package/dist/cjs/hooks/use-structured-reference.d.ts +8 -0
- package/dist/cjs/hooks/use-structured-reference.d.ts.map +1 -0
- package/dist/cjs/hooks/use-structured-reference.js +132 -0
- package/dist/cjs/hooks/use-undo-redo-actions.d.ts +40 -0
- package/dist/cjs/hooks/use-undo-redo-actions.d.ts.map +1 -0
- package/dist/cjs/hooks/use-undo-redo-actions.js +209 -0
- package/dist/cjs/hooks/use-undo-redo.d.ts +69 -0
- package/dist/cjs/hooks/use-undo-redo.d.ts.map +1 -0
- package/dist/cjs/hooks/use-undo-redo.js +124 -0
- package/dist/cjs/hooks/utils/frozen-sort.d.ts +9 -0
- package/dist/cjs/hooks/utils/frozen-sort.d.ts.map +1 -0
- package/dist/cjs/hooks/utils/frozen-sort.js +28 -0
- package/dist/cjs/hooks/utils/sort-rows.d.ts +32 -0
- package/dist/cjs/hooks/utils/sort-rows.d.ts.map +1 -0
- package/dist/cjs/hooks/utils/sort-rows.js +113 -0
- package/dist/cjs/index.d.ts +38 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +39 -0
- package/dist/cjs/interface/apply-fill.d.ts +6 -0
- package/dist/cjs/interface/apply-fill.d.ts.map +1 -0
- package/dist/cjs/interface/apply-fill.js +203 -0
- package/dist/cjs/interface/auto-resize.d.ts +4 -0
- package/dist/cjs/interface/auto-resize.d.ts.map +1 -0
- package/dist/cjs/interface/auto-resize.js +63 -0
- package/dist/cjs/interface/calculation-interface.d.ts +67 -0
- package/dist/cjs/interface/calculation-interface.d.ts.map +1 -0
- package/dist/cjs/interface/calculation-interface.js +409 -0
- package/dist/cjs/interface/change-batch-stream.d.ts +25 -0
- package/dist/cjs/interface/change-batch-stream.d.ts.map +1 -0
- package/dist/cjs/interface/change-batch-stream.js +428 -0
- package/dist/cjs/interface/change-batch.d.ts +39 -0
- package/dist/cjs/interface/change-batch.d.ts.map +1 -0
- package/dist/cjs/interface/change-batch.js +329 -0
- package/dist/cjs/interface/change-border.d.ts +5 -0
- package/dist/cjs/interface/change-border.d.ts.map +1 -0
- package/dist/cjs/interface/change-border.js +141 -0
- package/dist/cjs/interface/change-calculated-column.d.ts +5 -0
- package/dist/cjs/interface/change-calculated-column.d.ts.map +1 -0
- package/dist/cjs/interface/change-calculated-column.js +131 -0
- package/dist/cjs/interface/change-decimals.d.ts +7 -0
- package/dist/cjs/interface/change-decimals.d.ts.map +1 -0
- package/dist/cjs/interface/change-decimals.js +82 -0
- package/dist/cjs/interface/change-formatting.d.ts +4 -0
- package/dist/cjs/interface/change-formatting.d.ts.map +1 -0
- package/dist/cjs/interface/change-formatting.js +240 -0
- package/dist/cjs/interface/change-sheet-tabcolor.d.ts +4 -0
- package/dist/cjs/interface/change-sheet-tabcolor.d.ts.map +1 -0
- package/dist/cjs/interface/change-sheet-tabcolor.js +21 -0
- package/dist/cjs/interface/change-table-column.d.ts +49 -0
- package/dist/cjs/interface/change-table-column.d.ts.map +1 -0
- package/dist/cjs/interface/change-table-column.js +267 -0
- package/dist/cjs/interface/change-theme.d.ts +4 -0
- package/dist/cjs/interface/change-theme.d.ts.map +1 -0
- package/dist/cjs/interface/change-theme.js +23 -0
- package/dist/cjs/interface/chart-extensions.d.ts +32 -0
- package/dist/cjs/interface/chart-extensions.d.ts.map +1 -0
- package/dist/cjs/interface/chart-extensions.js +71 -0
- package/dist/cjs/interface/citations.d.ts +33 -0
- package/dist/cjs/interface/citations.d.ts.map +1 -0
- package/dist/cjs/interface/citations.js +142 -0
- package/dist/cjs/interface/clear-formatting.d.ts +5 -0
- package/dist/cjs/interface/clear-formatting.d.ts.map +1 -0
- package/dist/cjs/interface/clear-formatting.js +72 -0
- package/dist/cjs/interface/conditional-formatting-rules.d.ts +7 -0
- package/dist/cjs/interface/conditional-formatting-rules.d.ts.map +1 -0
- package/dist/cjs/interface/conditional-formatting-rules.js +191 -0
- package/dist/cjs/interface/create-table.d.ts +5 -0
- package/dist/cjs/interface/create-table.d.ts.map +1 -0
- package/dist/cjs/interface/create-table.js +96 -0
- package/dist/cjs/interface/data-validation-rules.d.ts +25 -0
- package/dist/cjs/interface/data-validation-rules.d.ts.map +1 -0
- package/dist/cjs/interface/data-validation-rules.js +366 -0
- package/dist/cjs/interface/data-validation-utils.d.ts +12 -0
- package/dist/cjs/interface/data-validation-utils.d.ts.map +1 -0
- package/dist/cjs/interface/data-validation-utils.js +118 -0
- package/dist/cjs/interface/delete-cells-shift-left.d.ts +5 -0
- package/dist/cjs/interface/delete-cells-shift-left.d.ts.map +1 -0
- package/dist/cjs/interface/delete-cells-shift-left.js +160 -0
- package/dist/cjs/interface/delete-cells-shift-up.d.ts +5 -0
- package/dist/cjs/interface/delete-cells-shift-up.d.ts.map +1 -0
- package/dist/cjs/interface/delete-cells-shift-up.js +152 -0
- package/dist/cjs/interface/delete-cells.d.ts +6 -0
- package/dist/cjs/interface/delete-cells.d.ts.map +1 -0
- package/dist/cjs/interface/delete-cells.js +231 -0
- package/dist/cjs/interface/delete-column.d.ts +4 -0
- package/dist/cjs/interface/delete-column.d.ts.map +1 -0
- package/dist/cjs/interface/delete-column.js +306 -0
- package/dist/cjs/interface/delete-row.d.ts +4 -0
- package/dist/cjs/interface/delete-row.d.ts.map +1 -0
- package/dist/cjs/interface/delete-row.js +227 -0
- package/dist/cjs/interface/delete-sheet.d.ts +4 -0
- package/dist/cjs/interface/delete-sheet.d.ts.map +1 -0
- package/dist/cjs/interface/delete-sheet.js +81 -0
- package/dist/cjs/interface/delete-table-column.d.ts +4 -0
- package/dist/cjs/interface/delete-table-column.d.ts.map +1 -0
- package/dist/cjs/interface/delete-table-column.js +349 -0
- package/dist/cjs/interface/delete-table-row.d.ts +4 -0
- package/dist/cjs/interface/delete-table-row.d.ts.map +1 -0
- package/dist/cjs/interface/delete-table-row.js +313 -0
- package/dist/cjs/interface/duplicate-sheet.d.ts +4 -0
- package/dist/cjs/interface/duplicate-sheet.d.ts.map +1 -0
- package/dist/cjs/interface/duplicate-sheet.js +232 -0
- package/dist/cjs/interface/embeds.d.ts +9 -0
- package/dist/cjs/interface/embeds.d.ts.map +1 -0
- package/dist/cjs/interface/embeds.js +121 -0
- package/dist/cjs/interface/freeze.d.ts +5 -0
- package/dist/cjs/interface/freeze.d.ts.map +1 -0
- package/dist/cjs/interface/freeze.js +160 -0
- package/dist/cjs/interface/helpers.d.ts +6 -0
- package/dist/cjs/interface/helpers.d.ts.map +1 -0
- package/dist/cjs/interface/helpers.js +44 -0
- package/dist/cjs/interface/hide-column.d.ts +4 -0
- package/dist/cjs/interface/hide-column.d.ts.map +1 -0
- package/dist/cjs/interface/hide-column.js +68 -0
- package/dist/cjs/interface/hide-row.d.ts +4 -0
- package/dist/cjs/interface/hide-row.d.ts.map +1 -0
- package/dist/cjs/interface/hide-row.js +65 -0
- package/dist/cjs/interface/indent.d.ts +7 -0
- package/dist/cjs/interface/indent.d.ts.map +1 -0
- package/dist/cjs/interface/indent.js +97 -0
- package/dist/cjs/interface/insert-cells-shift-down.d.ts +5 -0
- package/dist/cjs/interface/insert-cells-shift-down.d.ts.map +1 -0
- package/dist/cjs/interface/insert-cells-shift-down.js +154 -0
- package/dist/cjs/interface/insert-cells-shift-right.d.ts +5 -0
- package/dist/cjs/interface/insert-cells-shift-right.d.ts.map +1 -0
- package/dist/cjs/interface/insert-cells-shift-right.js +150 -0
- package/dist/cjs/interface/insert-column.d.ts +7 -0
- package/dist/cjs/interface/insert-column.d.ts.map +1 -0
- package/dist/cjs/interface/insert-column.js +645 -0
- package/dist/cjs/interface/insert-note.d.ts +5 -0
- package/dist/cjs/interface/insert-note.d.ts.map +1 -0
- package/dist/cjs/interface/insert-note.js +27 -0
- package/dist/cjs/interface/insert-row.d.ts +4 -0
- package/dist/cjs/interface/insert-row.d.ts.map +1 -0
- package/dist/cjs/interface/insert-row.js +188 -0
- package/dist/cjs/interface/insert-table-row.d.ts +4 -0
- package/dist/cjs/interface/insert-table-row.d.ts.map +1 -0
- package/dist/cjs/interface/insert-table-row.js +348 -0
- package/dist/cjs/interface/interface-cli.d.ts +3 -0
- package/dist/cjs/interface/interface-cli.d.ts.map +1 -0
- package/dist/cjs/interface/interface-cli.js +76 -0
- package/dist/cjs/interface/named-range-operations.d.ts +19 -0
- package/dist/cjs/interface/named-range-operations.d.ts.map +1 -0
- package/dist/cjs/interface/named-range-operations.js +96 -0
- package/dist/cjs/interface/new-sheet.d.ts +4 -0
- package/dist/cjs/interface/new-sheet.d.ts.map +1 -0
- package/dist/cjs/interface/new-sheet.js +109 -0
- package/dist/cjs/interface/pivot-extensions.d.ts +27 -0
- package/dist/cjs/interface/pivot-extensions.d.ts.map +1 -0
- package/dist/cjs/interface/pivot-extensions.js +62 -0
- package/dist/cjs/interface/remove-duplicates.d.ts +11 -0
- package/dist/cjs/interface/remove-duplicates.d.ts.map +1 -0
- package/dist/cjs/interface/remove-duplicates.js +132 -0
- package/dist/cjs/interface/remove-table.d.ts +4 -0
- package/dist/cjs/interface/remove-table.d.ts.map +1 -0
- package/dist/cjs/interface/remove-table.js +53 -0
- package/dist/cjs/interface/resize-utils.d.ts +18 -0
- package/dist/cjs/interface/resize-utils.d.ts.map +1 -0
- package/dist/cjs/interface/resize-utils.js +60 -0
- package/dist/cjs/interface/resize.d.ts +5 -0
- package/dist/cjs/interface/resize.d.ts.map +1 -0
- package/dist/cjs/interface/resize.js +56 -0
- package/dist/cjs/interface/slicers.d.ts +9 -0
- package/dist/cjs/interface/slicers.d.ts.map +1 -0
- package/dist/cjs/interface/slicers.js +113 -0
- package/dist/cjs/interface/split-text.d.ts +5 -0
- package/dist/cjs/interface/split-text.d.ts.map +1 -0
- package/dist/cjs/interface/split-text.js +120 -0
- package/dist/cjs/interface/spreadsheet-interface.d.ts +642 -0
- package/dist/cjs/interface/spreadsheet-interface.d.ts.map +1 -0
- package/dist/cjs/interface/spreadsheet-interface.js +2787 -0
- package/dist/cjs/interface/table-totalrow.d.ts +20 -0
- package/dist/cjs/interface/table-totalrow.d.ts.map +1 -0
- package/dist/cjs/interface/table-totalrow.js +170 -0
- package/dist/cjs/interface/table-utils.d.ts +21 -0
- package/dist/cjs/interface/table-utils.d.ts.map +1 -0
- package/dist/cjs/interface/table-utils.js +44 -0
- package/dist/cjs/interface/update-sheet.d.ts +16 -0
- package/dist/cjs/interface/update-sheet.d.ts.map +1 -0
- package/dist/cjs/interface/update-sheet.js +63 -0
- package/dist/cjs/interface/update-table.d.ts +4 -0
- package/dist/cjs/interface/update-table.d.ts.map +1 -0
- package/dist/cjs/interface/update-table.js +109 -0
- package/dist/cjs/server-utils.d.ts +8 -0
- package/dist/cjs/server-utils.d.ts.map +1 -0
- package/dist/cjs/server-utils.js +3 -0
- package/dist/cjs/server.browser.d.ts +9 -0
- package/dist/cjs/server.browser.d.ts.map +1 -0
- package/dist/cjs/server.browser.js +5 -0
- package/dist/cjs/server.d.ts +9 -0
- package/dist/cjs/server.d.ts.map +1 -0
- package/dist/cjs/server.js +5 -0
- package/dist/cjs/shared-string-registry.d.ts +35 -0
- package/dist/cjs/shared-string-registry.d.ts.map +1 -0
- package/dist/cjs/shared-string-registry.js +314 -0
- package/dist/cjs/sheet-cell.d.ts +310 -0
- package/dist/cjs/sheet-cell.d.ts.map +1 -0
- package/dist/cjs/sheet-cell.js +1809 -0
- package/dist/cjs/test-setup.d.ts +2 -0
- package/dist/cjs/test-setup.d.ts.map +1 -0
- package/dist/cjs/test-setup.js +3 -0
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/cjs/types.d.ts +44 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +33 -0
- package/dist/cjs/validation-schema/table.schema.d.ts +6 -0
- package/dist/cjs/validation-schema/table.schema.d.ts.map +1 -0
- package/dist/cjs/validation-schema/table.schema.js +4 -0
- package/dist/cjs/vitest.config.d.ts +3 -0
- package/dist/cjs/vitest.config.d.ts.map +1 -0
- package/dist/cjs/vitest.config.js +22 -0
- package/dist/esm/api/border.d.ts +9 -0
- package/dist/esm/api/border.d.ts.map +1 -0
- package/dist/esm/api/border.js +25 -0
- package/dist/esm/api/conditional-format.d.ts +2 -0
- package/dist/esm/api/conditional-format.d.ts.map +1 -0
- package/dist/esm/api/conditional-format.js +5 -0
- package/dist/esm/api/copy-paste.d.ts +20 -0
- package/dist/esm/api/copy-paste.d.ts.map +1 -0
- package/dist/esm/api/copy-paste.js +302 -0
- package/dist/esm/api/data-validation.d.ts +2 -0
- package/dist/esm/api/data-validation.d.ts.map +1 -0
- package/dist/esm/api/data-validation.js +5 -0
- package/dist/esm/api/datatype.d.ts +89 -0
- package/dist/esm/api/datatype.d.ts.map +1 -0
- package/dist/esm/api/datatype.js +639 -0
- package/dist/esm/api/date.d.ts +27 -0
- package/dist/esm/api/date.d.ts.map +1 -0
- package/dist/esm/api/date.js +220 -0
- package/dist/esm/api/decimals.d.ts +10 -0
- package/dist/esm/api/decimals.d.ts.map +1 -0
- package/dist/esm/api/decimals.js +181 -0
- package/dist/esm/api/dependency.d.ts +64 -0
- package/dist/esm/api/dependency.d.ts.map +1 -0
- package/dist/esm/api/dependency.js +251 -0
- package/dist/esm/api/fill.d.ts +88 -0
- package/dist/esm/api/fill.d.ts.map +1 -0
- package/dist/esm/api/fill.js +919 -0
- package/dist/esm/api/filter-range.d.ts +4 -0
- package/dist/esm/api/filter-range.d.ts.map +1 -0
- package/dist/esm/api/filter-range.js +100 -0
- package/dist/esm/api/filter.d.ts +24 -0
- package/dist/esm/api/filter.d.ts.map +1 -0
- package/dist/esm/api/filter.js +62 -0
- package/dist/esm/api/format-caches.d.ts +43 -0
- package/dist/esm/api/format-caches.d.ts.map +1 -0
- package/dist/esm/api/format-caches.js +95 -0
- package/dist/esm/api/formula.d.ts +69 -0
- package/dist/esm/api/formula.d.ts.map +1 -0
- package/dist/esm/api/formula.js +422 -0
- package/dist/esm/api/immer-utils.d.ts +66 -0
- package/dist/esm/api/immer-utils.d.ts.map +1 -0
- package/dist/esm/api/immer-utils.js +1552 -0
- package/dist/esm/api/intl.d.ts +51 -0
- package/dist/esm/api/intl.d.ts.map +1 -0
- package/dist/esm/api/intl.js +257 -0
- package/dist/esm/api/merges.d.ts +7 -0
- package/dist/esm/api/merges.d.ts.map +1 -0
- package/dist/esm/api/merges.js +174 -0
- package/dist/esm/api/outline.d.ts +33 -0
- package/dist/esm/api/outline.d.ts.map +1 -0
- package/dist/esm/api/outline.js +56 -0
- package/dist/esm/api/parse-html.d.ts +15 -0
- package/dist/esm/api/parse-html.d.ts.map +1 -0
- package/dist/esm/api/parse-html.js +865 -0
- package/dist/esm/api/patches.d.ts +11 -0
- package/dist/esm/api/patches.d.ts.map +1 -0
- package/dist/esm/api/patches.js +206 -0
- package/dist/esm/api/pivot-range.d.ts +8 -0
- package/dist/esm/api/pivot-range.d.ts.map +1 -0
- package/dist/esm/api/pivot-range.js +93 -0
- package/dist/esm/api/range-rule-helpers.d.ts +65 -0
- package/dist/esm/api/range-rule-helpers.d.ts.map +1 -0
- package/dist/esm/api/range-rule-helpers.js +138 -0
- package/dist/esm/api/range.d.ts +19 -0
- package/dist/esm/api/range.d.ts.map +1 -0
- package/dist/esm/api/range.js +136 -0
- package/dist/esm/api/rename-sheet.d.ts +22 -0
- package/dist/esm/api/rename-sheet.d.ts.map +1 -0
- package/dist/esm/api/rename-sheet.js +41 -0
- package/dist/esm/api/selection.d.ts +36 -0
- package/dist/esm/api/selection.d.ts.map +1 -0
- package/dist/esm/api/selection.js +138 -0
- package/dist/esm/api/sort.d.ts +3 -0
- package/dist/esm/api/sort.d.ts.map +1 -0
- package/dist/esm/api/sort.js +33 -0
- package/dist/esm/api/split-text.d.ts +2 -0
- package/dist/esm/api/split-text.d.ts.map +1 -0
- package/dist/esm/api/split-text.js +24 -0
- package/dist/esm/api/structural-formula-update.d.ts +75 -0
- package/dist/esm/api/structural-formula-update.d.ts.map +1 -0
- package/dist/esm/api/structural-formula-update.js +431 -0
- package/dist/esm/api/table.d.ts +39 -0
- package/dist/esm/api/table.d.ts.map +1 -0
- package/dist/esm/api/table.js +333 -0
- package/dist/esm/api/validation.d.ts +12 -0
- package/dist/esm/api/validation.d.ts.map +1 -0
- package/dist/esm/api/validation.js +297 -0
- package/dist/esm/api/xlsx-source.d.ts +22 -0
- package/dist/esm/api/xlsx-source.d.ts.map +1 -0
- package/dist/esm/api/xlsx-source.js +30 -0
- package/dist/esm/atoms/delete-sheet-atom.d.ts +6 -0
- package/dist/esm/atoms/delete-sheet-atom.d.ts.map +1 -0
- package/dist/esm/atoms/delete-sheet-atom.js +4 -0
- package/dist/esm/atoms/dialog-state.atom.d.ts +23 -0
- package/dist/esm/atoms/dialog-state.atom.d.ts.map +1 -0
- package/dist/esm/atoms/dialog-state.atom.js +34 -0
- package/dist/esm/atoms/editing-data-validation-id.atom.d.ts +7 -0
- package/dist/esm/atoms/editing-data-validation-id.atom.d.ts.map +1 -0
- package/dist/esm/atoms/editing-data-validation-id.atom.js +6 -0
- package/dist/esm/atoms/editing-embed.atom.d.ts +8 -0
- package/dist/esm/atoms/editing-embed.atom.d.ts.map +1 -0
- package/dist/esm/atoms/editing-embed.atom.js +5 -0
- package/dist/esm/atoms/editing-table.atom.d.ts +8 -0
- package/dist/esm/atoms/editing-table.atom.d.ts.map +1 -0
- package/dist/esm/atoms/editing-table.atom.js +6 -0
- package/dist/esm/atoms/error-state.atom.d.ts +10 -0
- package/dist/esm/atoms/error-state.atom.d.ts.map +1 -0
- package/dist/esm/atoms/error-state.atom.js +5 -0
- package/dist/esm/atoms/index.d.ts +5 -0
- package/dist/esm/atoms/index.d.ts.map +1 -0
- package/dist/esm/atoms/index.js +4 -0
- package/dist/esm/atoms/insert-image-state.atom.d.ts +6 -0
- package/dist/esm/atoms/insert-image-state.atom.d.ts.map +1 -0
- package/dist/esm/atoms/insert-image-state.atom.js +5 -0
- package/dist/esm/atoms/named-range.atom.d.ts +8 -0
- package/dist/esm/atoms/named-range.atom.d.ts.map +1 -0
- package/dist/esm/atoms/named-range.atom.js +6 -0
- package/dist/esm/atoms/resize-dimension.atom.d.ts +12 -0
- package/dist/esm/atoms/resize-dimension.atom.d.ts.map +1 -0
- package/dist/esm/atoms/resize-dimension.atom.js +5 -0
- package/dist/esm/atoms/sheet-observer.atom.d.ts +16 -0
- package/dist/esm/atoms/sheet-observer.atom.d.ts.map +1 -0
- package/dist/esm/atoms/sheet-observer.atom.js +16 -0
- package/dist/esm/cellxfs-registry.d.ts +37 -0
- package/dist/esm/cellxfs-registry.d.ts.map +1 -0
- package/dist/esm/cellxfs-registry.js +147 -0
- package/dist/esm/commands.d.ts +691 -0
- package/dist/esm/commands.d.ts.map +1 -0
- package/dist/esm/commands.js +1 -0
- package/dist/esm/components/dialogs/delete-sheet-confirmation.d.ts +7 -0
- package/dist/esm/components/dialogs/delete-sheet-confirmation.d.ts.map +1 -0
- package/dist/esm/components/dialogs/delete-sheet-confirmation.js +29 -0
- package/dist/esm/components/dialogs/error-state.d.ts +3 -0
- package/dist/esm/components/dialogs/error-state.d.ts.map +1 -0
- package/dist/esm/components/dialogs/error-state.js +22 -0
- package/dist/esm/components/editors/cell-format-editor.d.ts +26 -0
- package/dist/esm/components/editors/cell-format-editor.d.ts.map +1 -0
- package/dist/esm/components/editors/cell-format-editor.js +648 -0
- package/dist/esm/components/editors/conditional-format-editor.d.ts +43 -0
- package/dist/esm/components/editors/conditional-format-editor.d.ts.map +1 -0
- package/dist/esm/components/editors/conditional-format-editor.js +172 -0
- package/dist/esm/components/editors/conditional-format-rule-editor.d.ts +27 -0
- package/dist/esm/components/editors/conditional-format-rule-editor.d.ts.map +1 -0
- package/dist/esm/components/editors/conditional-format-rule-editor.js +608 -0
- package/dist/esm/components/editors/data-validation-editor.d.ts +27 -0
- package/dist/esm/components/editors/data-validation-editor.d.ts.map +1 -0
- package/dist/esm/components/editors/data-validation-editor.js +160 -0
- package/dist/esm/components/editors/data-validation-rule-editor.d.ts +17 -0
- package/dist/esm/components/editors/data-validation-rule-editor.d.ts.map +1 -0
- package/dist/esm/components/editors/data-validation-rule-editor.js +194 -0
- package/dist/esm/components/editors/embed-editor.d.ts +19 -0
- package/dist/esm/components/editors/embed-editor.d.ts.map +1 -0
- package/dist/esm/components/editors/embed-editor.js +75 -0
- package/dist/esm/components/editors/insert-image-editor.d.ts +20 -0
- package/dist/esm/components/editors/insert-image-editor.d.ts.map +1 -0
- package/dist/esm/components/editors/insert-image-editor.js +73 -0
- package/dist/esm/components/editors/insert-link-editor.d.ts +20 -0
- package/dist/esm/components/editors/insert-link-editor.d.ts.map +1 -0
- package/dist/esm/components/editors/insert-link-editor.js +60 -0
- package/dist/esm/components/editors/named-range-editor.d.ts +13 -0
- package/dist/esm/components/editors/named-range-editor.d.ts.map +1 -0
- package/dist/esm/components/editors/named-range-editor.js +103 -0
- package/dist/esm/components/editors/resize-dimension-editor.d.ts +9 -0
- package/dist/esm/components/editors/resize-dimension-editor.d.ts.map +1 -0
- package/dist/esm/components/editors/resize-dimension-editor.js +60 -0
- package/dist/esm/components/editors/sheet-filter.d.ts +59 -0
- package/dist/esm/components/editors/sheet-filter.d.ts.map +1 -0
- package/dist/esm/components/editors/sheet-filter.js +88 -0
- package/dist/esm/components/editors/table-editor.d.ts +12 -0
- package/dist/esm/components/editors/table-editor.d.ts.map +1 -0
- package/dist/esm/components/editors/table-editor.js +106 -0
- package/dist/esm/components/index.d.ts +13 -0
- package/dist/esm/components/index.d.ts.map +1 -0
- package/dist/esm/components/index.js +12 -0
- package/dist/esm/generated-names.d.ts +51 -0
- package/dist/esm/generated-names.d.ts.map +1 -0
- package/dist/esm/generated-names.js +5 -0
- package/dist/esm/helpers/iterative-calculation.d.ts +4 -0
- package/dist/esm/helpers/iterative-calculation.d.ts.map +1 -0
- package/dist/esm/helpers/iterative-calculation.js +44 -0
- package/dist/esm/helpers/sheet-title.d.ts +5 -0
- package/dist/esm/helpers/sheet-title.d.ts.map +1 -0
- package/dist/esm/helpers/sheet-title.js +13 -0
- package/dist/esm/helpers.d.ts +45 -0
- package/dist/esm/helpers.d.ts.map +1 -0
- package/dist/esm/helpers.js +143 -0
- package/dist/esm/hooks/use-async-datasource.d.ts +57 -0
- package/dist/esm/hooks/use-async-datasource.d.ts.map +1 -0
- package/dist/esm/hooks/use-async-datasource.js +276 -0
- package/dist/esm/hooks/use-calculation-initialize.d.ts +61 -0
- package/dist/esm/hooks/use-calculation-initialize.d.ts.map +1 -0
- package/dist/esm/hooks/use-calculation-initialize.js +603 -0
- package/dist/esm/hooks/use-calculation-process-array.d.ts +20 -0
- package/dist/esm/hooks/use-calculation-process-array.d.ts.map +1 -0
- package/dist/esm/hooks/use-calculation-process-array.js +279 -0
- package/dist/esm/hooks/use-calculation-queue.d.ts +10 -0
- package/dist/esm/hooks/use-calculation-queue.d.ts.map +1 -0
- package/dist/esm/hooks/use-calculation-queue.js +13 -0
- package/dist/esm/hooks/use-calculation-worker.d.ts +37 -0
- package/dist/esm/hooks/use-calculation-worker.d.ts.map +1 -0
- package/dist/esm/hooks/use-calculation-worker.js +1688 -0
- package/dist/esm/hooks/use-calculation.d.ts +173 -0
- package/dist/esm/hooks/use-calculation.d.ts.map +1 -0
- package/dist/esm/hooks/use-calculation.js +2069 -0
- package/dist/esm/hooks/use-can-edit-cellrange.d.ts +31 -0
- package/dist/esm/hooks/use-can-edit-cellrange.d.ts.map +1 -0
- package/dist/esm/hooks/use-can-edit-cellrange.js +72 -0
- package/dist/esm/hooks/use-cellxfs-registry.d.ts +6 -0
- package/dist/esm/hooks/use-cellxfs-registry.d.ts.map +1 -0
- package/dist/esm/hooks/use-cellxfs-registry.js +22 -0
- package/dist/esm/hooks/use-citations.d.ts +19 -0
- package/dist/esm/hooks/use-citations.d.ts.map +1 -0
- package/dist/esm/hooks/use-citations.js +61 -0
- package/dist/esm/hooks/use-comments.d.ts +14 -0
- package/dist/esm/hooks/use-comments.d.ts.map +1 -0
- package/dist/esm/hooks/use-comments.js +45 -0
- package/dist/esm/hooks/use-conditional-formatting-rules.d.ts +22 -0
- package/dist/esm/hooks/use-conditional-formatting-rules.d.ts.map +1 -0
- package/dist/esm/hooks/use-conditional-formatting-rules.js +81 -0
- package/dist/esm/hooks/use-data-validation-rules.d.ts +54 -0
- package/dist/esm/hooks/use-data-validation-rules.d.ts.map +1 -0
- package/dist/esm/hooks/use-data-validation-rules.js +135 -0
- package/dist/esm/hooks/use-deferred-calculation-flush.d.ts +14 -0
- package/dist/esm/hooks/use-deferred-calculation-flush.d.ts.map +1 -0
- package/dist/esm/hooks/use-deferred-calculation-flush.js +78 -0
- package/dist/esm/hooks/use-idle-scheduler.d.ts +5 -0
- package/dist/esm/hooks/use-idle-scheduler.d.ts.map +1 -0
- package/dist/esm/hooks/use-idle-scheduler.js +46 -0
- package/dist/esm/hooks/use-indent.d.ts +23 -0
- package/dist/esm/hooks/use-indent.d.ts.map +1 -0
- package/dist/esm/hooks/use-indent.js +97 -0
- package/dist/esm/hooks/use-named-range.d.ts +7 -0
- package/dist/esm/hooks/use-named-range.d.ts.map +1 -0
- package/dist/esm/hooks/use-named-range.js +69 -0
- package/dist/esm/hooks/use-on-adjust-row-height.d.ts +11 -0
- package/dist/esm/hooks/use-on-adjust-row-height.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-adjust-row-height.js +63 -0
- package/dist/esm/hooks/use-on-autoresize.d.ts +17 -0
- package/dist/esm/hooks/use-on-autoresize.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-autoresize.js +38 -0
- package/dist/esm/hooks/use-on-banded-ranges.d.ts +15 -0
- package/dist/esm/hooks/use-on-banded-ranges.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-banded-ranges.js +36 -0
- package/dist/esm/hooks/use-on-calculation-begin.d.ts +14 -0
- package/dist/esm/hooks/use-on-calculation-begin.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-calculation-begin.js +22 -0
- package/dist/esm/hooks/use-on-calculation-success.d.ts +22 -0
- package/dist/esm/hooks/use-on-calculation-success.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-calculation-success.js +167 -0
- package/dist/esm/hooks/use-on-change-batch-stream.d.ts +7 -0
- package/dist/esm/hooks/use-on-change-batch-stream.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-change-batch-stream.js +58 -0
- package/dist/esm/hooks/use-on-change-batch.d.ts +54 -0
- package/dist/esm/hooks/use-on-change-batch.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-change-batch.js +111 -0
- package/dist/esm/hooks/use-on-change-calculated-column.d.ts +23 -0
- package/dist/esm/hooks/use-on-change-calculated-column.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-change-calculated-column.js +29 -0
- package/dist/esm/hooks/use-on-change-decimals.d.ts +22 -0
- package/dist/esm/hooks/use-on-change-decimals.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-change-decimals.js +45 -0
- package/dist/esm/hooks/use-on-change-formatting.d.ts +44 -0
- package/dist/esm/hooks/use-on-change-formatting.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-change-formatting.js +158 -0
- package/dist/esm/hooks/use-on-change-sheet-tabcolor.d.ts +11 -0
- package/dist/esm/hooks/use-on-change-sheet-tabcolor.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-change-sheet-tabcolor.js +26 -0
- package/dist/esm/hooks/use-on-change-table-column.d.ts +25 -0
- package/dist/esm/hooks/use-on-change-table-column.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-change-table-column.js +52 -0
- package/dist/esm/hooks/use-on-change-theme.d.ts +11 -0
- package/dist/esm/hooks/use-on-change-theme.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-change-theme.js +11 -0
- package/dist/esm/hooks/use-on-change.d.ts +61 -0
- package/dist/esm/hooks/use-on-change.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-change.js +281 -0
- package/dist/esm/hooks/use-on-clear-formatting.d.ts +17 -0
- package/dist/esm/hooks/use-on-clear-formatting.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-clear-formatting.js +45 -0
- package/dist/esm/hooks/use-on-collapse-column-group.d.ts +11 -0
- package/dist/esm/hooks/use-on-collapse-column-group.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-collapse-column-group.js +44 -0
- package/dist/esm/hooks/use-on-collapse-row-group.d.ts +18 -0
- package/dist/esm/hooks/use-on-collapse-row-group.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-collapse-row-group.js +54 -0
- package/dist/esm/hooks/use-on-copy.d.ts +49 -0
- package/dist/esm/hooks/use-on-copy.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-copy.js +302 -0
- package/dist/esm/hooks/use-on-create-named-range.d.ts +13 -0
- package/dist/esm/hooks/use-on-create-named-range.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-create-named-range.js +32 -0
- package/dist/esm/hooks/use-on-create-sheet.d.ts +23 -0
- package/dist/esm/hooks/use-on-create-sheet.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-create-sheet.js +64 -0
- package/dist/esm/hooks/use-on-delete-cells-shift-left.d.ts +28 -0
- package/dist/esm/hooks/use-on-delete-cells-shift-left.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-delete-cells-shift-left.js +65 -0
- package/dist/esm/hooks/use-on-delete-cells-shift-up.d.ts +28 -0
- package/dist/esm/hooks/use-on-delete-cells-shift-up.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-delete-cells-shift-up.js +65 -0
- package/dist/esm/hooks/use-on-delete-column.d.ts +38 -0
- package/dist/esm/hooks/use-on-delete-column.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-delete-column.js +86 -0
- package/dist/esm/hooks/use-on-delete-named-range.d.ts +14 -0
- package/dist/esm/hooks/use-on-delete-named-range.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-delete-named-range.js +22 -0
- package/dist/esm/hooks/use-on-delete-row.d.ts +38 -0
- package/dist/esm/hooks/use-on-delete-row.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-delete-row.js +86 -0
- package/dist/esm/hooks/use-on-delete-sheet.d.ts +16 -0
- package/dist/esm/hooks/use-on-delete-sheet.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-delete-sheet.js +36 -0
- package/dist/esm/hooks/use-on-delete-table-row.d.ts +29 -0
- package/dist/esm/hooks/use-on-delete-table-row.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-delete-table-row.js +55 -0
- package/dist/esm/hooks/use-on-delete.d.ts +33 -0
- package/dist/esm/hooks/use-on-delete.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-delete.js +58 -0
- package/dist/esm/hooks/use-on-drag-n-drop.d.ts +55 -0
- package/dist/esm/hooks/use-on-drag-n-drop.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-drag-n-drop.js +160 -0
- package/dist/esm/hooks/use-on-duplicate-sheet.d.ts +29 -0
- package/dist/esm/hooks/use-on-duplicate-sheet.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-duplicate-sheet.js +63 -0
- package/dist/esm/hooks/use-on-embeds.d.ts +19 -0
- package/dist/esm/hooks/use-on-embeds.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-embeds.js +86 -0
- package/dist/esm/hooks/use-on-expand-column-group.d.ts +11 -0
- package/dist/esm/hooks/use-on-expand-column-group.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-expand-column-group.js +42 -0
- package/dist/esm/hooks/use-on-expand-row-group.d.ts +18 -0
- package/dist/esm/hooks/use-on-expand-row-group.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-expand-row-group.js +49 -0
- package/dist/esm/hooks/use-on-fill-range.d.ts +9 -0
- package/dist/esm/hooks/use-on-fill-range.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-fill-range.js +79 -0
- package/dist/esm/hooks/use-on-fill.d.ts +29 -0
- package/dist/esm/hooks/use-on-fill.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-fill.js +66 -0
- package/dist/esm/hooks/use-on-filter-table.d.ts +76 -0
- package/dist/esm/hooks/use-on-filter-table.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-filter-table.js +341 -0
- package/dist/esm/hooks/use-on-find-replace.d.ts +19 -0
- package/dist/esm/hooks/use-on-find-replace.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-find-replace.js +115 -0
- package/dist/esm/hooks/use-on-freeze.d.ts +13 -0
- package/dist/esm/hooks/use-on-freeze.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-freeze.js +55 -0
- package/dist/esm/hooks/use-on-group-columns.d.ts +11 -0
- package/dist/esm/hooks/use-on-group-columns.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-group-columns.js +35 -0
- package/dist/esm/hooks/use-on-group-rows.d.ts +17 -0
- package/dist/esm/hooks/use-on-group-rows.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-group-rows.js +41 -0
- package/dist/esm/hooks/use-on-hide-column.d.ts +23 -0
- package/dist/esm/hooks/use-on-hide-column.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-hide-column.js +54 -0
- package/dist/esm/hooks/use-on-hide-row.d.ts +32 -0
- package/dist/esm/hooks/use-on-hide-row.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-hide-row.js +57 -0
- package/dist/esm/hooks/use-on-hide-show-sheet.d.ts +18 -0
- package/dist/esm/hooks/use-on-hide-show-sheet.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-hide-show-sheet.js +88 -0
- package/dist/esm/hooks/use-on-import-csv-legacy.d.ts +8 -0
- package/dist/esm/hooks/use-on-import-csv-legacy.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-import-csv-legacy.js +148 -0
- package/dist/esm/hooks/use-on-import-csv.d.ts +28 -0
- package/dist/esm/hooks/use-on-import-csv.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-import-csv.js +267 -0
- package/dist/esm/hooks/use-on-import-excel.d.ts +67 -0
- package/dist/esm/hooks/use-on-import-excel.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-import-excel.js +595 -0
- package/dist/esm/hooks/use-on-insert-autosum.d.ts +9 -0
- package/dist/esm/hooks/use-on-insert-autosum.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-insert-autosum.js +91 -0
- package/dist/esm/hooks/use-on-insert-cells-shift-down.d.ts +28 -0
- package/dist/esm/hooks/use-on-insert-cells-shift-down.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-insert-cells-shift-down.js +65 -0
- package/dist/esm/hooks/use-on-insert-cells-shift-right.d.ts +28 -0
- package/dist/esm/hooks/use-on-insert-cells-shift-right.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-insert-cells-shift-right.js +65 -0
- package/dist/esm/hooks/use-on-insert-checkbox.d.ts +17 -0
- package/dist/esm/hooks/use-on-insert-checkbox.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-insert-checkbox.js +73 -0
- package/dist/esm/hooks/use-on-insert-column.d.ts +40 -0
- package/dist/esm/hooks/use-on-insert-column.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-insert-column.js +91 -0
- package/dist/esm/hooks/use-on-insert-date-time.d.ts +4 -0
- package/dist/esm/hooks/use-on-insert-date-time.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-insert-date-time.js +11 -0
- package/dist/esm/hooks/use-on-insert-date.d.ts +4 -0
- package/dist/esm/hooks/use-on-insert-date.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-insert-date.js +12 -0
- package/dist/esm/hooks/use-on-insert-image.d.ts +24 -0
- package/dist/esm/hooks/use-on-insert-image.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-insert-image.js +131 -0
- package/dist/esm/hooks/use-on-insert-link.d.ts +25 -0
- package/dist/esm/hooks/use-on-insert-link.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-insert-link.js +193 -0
- package/dist/esm/hooks/use-on-insert-note.d.ts +4 -0
- package/dist/esm/hooks/use-on-insert-note.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-insert-note.js +14 -0
- package/dist/esm/hooks/use-on-insert-row.d.ts +38 -0
- package/dist/esm/hooks/use-on-insert-row.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-insert-row.js +104 -0
- package/dist/esm/hooks/use-on-insert-table-row.d.ts +31 -0
- package/dist/esm/hooks/use-on-insert-table-row.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-insert-table-row.js +59 -0
- package/dist/esm/hooks/use-on-insert-time.d.ts +4 -0
- package/dist/esm/hooks/use-on-insert-time.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-insert-time.js +11 -0
- package/dist/esm/hooks/use-on-locale-change.d.ts +35 -0
- package/dist/esm/hooks/use-on-locale-change.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-locale-change.js +314 -0
- package/dist/esm/hooks/use-on-merge-unmerge-cells.d.ts +28 -0
- package/dist/esm/hooks/use-on-merge-unmerge-cells.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-merge-unmerge-cells.js +310 -0
- package/dist/esm/hooks/use-on-move-columns.d.ts +28 -0
- package/dist/esm/hooks/use-on-move-columns.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-move-columns.js +295 -0
- package/dist/esm/hooks/use-on-move-rows.d.ts +30 -0
- package/dist/esm/hooks/use-on-move-rows.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-move-rows.js +264 -0
- package/dist/esm/hooks/use-on-move-selection.d.ts +35 -0
- package/dist/esm/hooks/use-on-move-selection.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-move-selection.js +383 -0
- package/dist/esm/hooks/use-on-move-sheet.d.ts +12 -0
- package/dist/esm/hooks/use-on-move-sheet.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-move-sheet.js +65 -0
- package/dist/esm/hooks/use-on-move-table-columns.d.ts +21 -0
- package/dist/esm/hooks/use-on-move-table-columns.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-move-table-columns.js +235 -0
- package/dist/esm/hooks/use-on-paste.d.ts +79 -0
- package/dist/esm/hooks/use-on-paste.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-paste.js +868 -0
- package/dist/esm/hooks/use-on-protect-range.d.ts +20 -0
- package/dist/esm/hooks/use-on-protect-range.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-protect-range.js +67 -0
- package/dist/esm/hooks/use-on-protect-sheet.d.ts +19 -0
- package/dist/esm/hooks/use-on-protect-sheet.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-protect-sheet.js +61 -0
- package/dist/esm/hooks/use-on-remove-duplicates.d.ts +21 -0
- package/dist/esm/hooks/use-on-remove-duplicates.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-remove-duplicates.js +39 -0
- package/dist/esm/hooks/use-on-rename-sheet.d.ts +21 -0
- package/dist/esm/hooks/use-on-rename-sheet.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-rename-sheet.js +78 -0
- package/dist/esm/hooks/use-on-request-calculate-wrapper.d.ts +30 -0
- package/dist/esm/hooks/use-on-request-calculate-wrapper.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-request-calculate-wrapper.js +88 -0
- package/dist/esm/hooks/use-on-request-conditional-format.d.ts +2 -0
- package/dist/esm/hooks/use-on-request-conditional-format.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-request-conditional-format.js +8 -0
- package/dist/esm/hooks/use-on-request-data-validation.d.ts +7 -0
- package/dist/esm/hooks/use-on-request-data-validation.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-request-data-validation.js +21 -0
- package/dist/esm/hooks/use-on-request-define-named-range.d.ts +8 -0
- package/dist/esm/hooks/use-on-request-define-named-range.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-request-define-named-range.js +25 -0
- package/dist/esm/hooks/use-on-request-delete-sheet.d.ts +2 -0
- package/dist/esm/hooks/use-on-request-delete-sheet.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-request-delete-sheet.js +11 -0
- package/dist/esm/hooks/use-on-request-edit-table.d.ts +3 -0
- package/dist/esm/hooks/use-on-request-edit-table.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-request-edit-table.js +11 -0
- package/dist/esm/hooks/use-on-request-format-cells.d.ts +2 -0
- package/dist/esm/hooks/use-on-request-format-cells.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-request-format-cells.js +8 -0
- package/dist/esm/hooks/use-on-request-insert-image.d.ts +3 -0
- package/dist/esm/hooks/use-on-request-insert-image.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-request-insert-image.js +12 -0
- package/dist/esm/hooks/use-on-request-insert-link.d.ts +5 -0
- package/dist/esm/hooks/use-on-request-insert-link.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-request-insert-link.js +9 -0
- package/dist/esm/hooks/use-on-request-resize.d.ts +3 -0
- package/dist/esm/hooks/use-on-request-resize.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-request-resize.js +13 -0
- package/dist/esm/hooks/use-on-request-update-named-range.d.ts +3 -0
- package/dist/esm/hooks/use-on-request-update-named-range.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-request-update-named-range.js +11 -0
- package/dist/esm/hooks/use-on-resize-table.d.ts +33 -0
- package/dist/esm/hooks/use-on-resize-table.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-resize-table.js +212 -0
- package/dist/esm/hooks/use-on-resize.d.ts +19 -0
- package/dist/esm/hooks/use-on-resize.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-resize.js +54 -0
- package/dist/esm/hooks/use-on-set-outline-depth.d.ts +17 -0
- package/dist/esm/hooks/use-on-set-outline-depth.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-set-outline-depth.js +93 -0
- package/dist/esm/hooks/use-on-show-column.d.ts +16 -0
- package/dist/esm/hooks/use-on-show-column.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-show-column.js +82 -0
- package/dist/esm/hooks/use-on-show-row.d.ts +22 -0
- package/dist/esm/hooks/use-on-show-row.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-show-row.js +85 -0
- package/dist/esm/hooks/use-on-sort-column.d.ts +53 -0
- package/dist/esm/hooks/use-on-sort-column.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-sort-column.js +268 -0
- package/dist/esm/hooks/use-on-sort-range.d.ts +42 -0
- package/dist/esm/hooks/use-on-sort-range.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-sort-range.js +247 -0
- package/dist/esm/hooks/use-on-sort-table.d.ts +59 -0
- package/dist/esm/hooks/use-on-sort-table.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-sort-table.js +332 -0
- package/dist/esm/hooks/use-on-table.d.ts +49 -0
- package/dist/esm/hooks/use-on-table.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-table.js +384 -0
- package/dist/esm/hooks/use-on-trace-dependents-precedents.d.ts +14 -0
- package/dist/esm/hooks/use-on-trace-dependents-precedents.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-trace-dependents-precedents.js +144 -0
- package/dist/esm/hooks/use-on-ungroup-columns.d.ts +11 -0
- package/dist/esm/hooks/use-on-ungroup-columns.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-ungroup-columns.js +43 -0
- package/dist/esm/hooks/use-on-ungroup-rows.d.ts +17 -0
- package/dist/esm/hooks/use-on-ungroup-rows.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-ungroup-rows.js +49 -0
- package/dist/esm/hooks/use-on-update-named-range.d.ts +19 -0
- package/dist/esm/hooks/use-on-update-named-range.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-update-named-range.js +108 -0
- package/dist/esm/hooks/use-on-update-note.d.ts +13 -0
- package/dist/esm/hooks/use-on-update-note.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-update-note.js +20 -0
- package/dist/esm/hooks/use-on-update-sheet.d.ts +10 -0
- package/dist/esm/hooks/use-on-update-sheet.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-update-sheet.js +11 -0
- package/dist/esm/hooks/use-paint-format.d.ts +17 -0
- package/dist/esm/hooks/use-paint-format.d.ts.map +1 -0
- package/dist/esm/hooks/use-paint-format.js +110 -0
- package/dist/esm/hooks/use-search.d.ts +81 -0
- package/dist/esm/hooks/use-search.d.ts.map +1 -0
- package/dist/esm/hooks/use-search.js +251 -0
- package/dist/esm/hooks/use-select-next-prev-sheet.d.ts +11 -0
- package/dist/esm/hooks/use-select-next-prev-sheet.d.ts.map +1 -0
- package/dist/esm/hooks/use-select-next-prev-sheet.js +21 -0
- package/dist/esm/hooks/use-sheet-observer.d.ts +20 -0
- package/dist/esm/hooks/use-sheet-observer.d.ts.map +1 -0
- package/dist/esm/hooks/use-sheet-observer.js +120 -0
- package/dist/esm/hooks/use-sheet-properties.d.ts +105 -0
- package/dist/esm/hooks/use-sheet-properties.d.ts.map +1 -0
- package/dist/esm/hooks/use-sheet-properties.js +895 -0
- package/dist/esm/hooks/use-sheet-state.d.ts +17 -0
- package/dist/esm/hooks/use-sheet-state.d.ts.map +1 -0
- package/dist/esm/hooks/use-sheet-state.js +102 -0
- package/dist/esm/hooks/use-sheetdata-subscriber.d.ts +10 -0
- package/dist/esm/hooks/use-sheetdata-subscriber.d.ts.map +1 -0
- package/dist/esm/hooks/use-sheetdata-subscriber.js +14 -0
- package/dist/esm/hooks/use-slicers.d.ts +19 -0
- package/dist/esm/hooks/use-slicers.d.ts.map +1 -0
- package/dist/esm/hooks/use-slicers.js +83 -0
- package/dist/esm/hooks/use-split-text-to-columns.d.ts +19 -0
- package/dist/esm/hooks/use-split-text-to-columns.d.ts.map +1 -0
- package/dist/esm/hooks/use-split-text-to-columns.js +30 -0
- package/dist/esm/hooks/use-spreadsheet-state.d.ts +627 -0
- package/dist/esm/hooks/use-spreadsheet-state.d.ts.map +1 -0
- package/dist/esm/hooks/use-spreadsheet-state.js +2010 -0
- package/dist/esm/hooks/use-ss-registry.d.ts +6 -0
- package/dist/esm/hooks/use-ss-registry.d.ts.map +1 -0
- package/dist/esm/hooks/use-ss-registry.js +17 -0
- package/dist/esm/hooks/use-structured-reference.d.ts +8 -0
- package/dist/esm/hooks/use-structured-reference.d.ts.map +1 -0
- package/dist/esm/hooks/use-structured-reference.js +129 -0
- package/dist/esm/hooks/use-undo-redo-actions.d.ts +40 -0
- package/dist/esm/hooks/use-undo-redo-actions.d.ts.map +1 -0
- package/dist/esm/hooks/use-undo-redo-actions.js +166 -0
- package/dist/esm/hooks/use-undo-redo.d.ts +69 -0
- package/dist/esm/hooks/use-undo-redo.d.ts.map +1 -0
- package/dist/esm/hooks/use-undo-redo.js +113 -0
- package/dist/esm/hooks/utils/frozen-sort.d.ts +9 -0
- package/dist/esm/hooks/utils/frozen-sort.d.ts.map +1 -0
- package/dist/esm/hooks/utils/frozen-sort.js +25 -0
- package/dist/esm/hooks/utils/sort-rows.d.ts +32 -0
- package/dist/esm/hooks/utils/sort-rows.d.ts.map +1 -0
- package/dist/esm/hooks/utils/sort-rows.js +102 -0
- package/dist/esm/index.d.ts +38 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +39 -0
- package/dist/esm/interface/apply-fill.d.ts +6 -0
- package/dist/esm/interface/apply-fill.d.ts.map +1 -0
- package/dist/esm/interface/apply-fill.js +195 -0
- package/dist/esm/interface/auto-resize.d.ts +4 -0
- package/dist/esm/interface/auto-resize.d.ts.map +1 -0
- package/dist/esm/interface/auto-resize.js +50 -0
- package/dist/esm/interface/calculation-interface.d.ts +67 -0
- package/dist/esm/interface/calculation-interface.d.ts.map +1 -0
- package/dist/esm/interface/calculation-interface.js +339 -0
- package/dist/esm/interface/change-batch-stream.d.ts +25 -0
- package/dist/esm/interface/change-batch-stream.d.ts.map +1 -0
- package/dist/esm/interface/change-batch-stream.js +294 -0
- package/dist/esm/interface/change-batch.d.ts +39 -0
- package/dist/esm/interface/change-batch.d.ts.map +1 -0
- package/dist/esm/interface/change-batch.js +282 -0
- package/dist/esm/interface/change-border.d.ts +5 -0
- package/dist/esm/interface/change-border.d.ts.map +1 -0
- package/dist/esm/interface/change-border.js +116 -0
- package/dist/esm/interface/change-calculated-column.d.ts +5 -0
- package/dist/esm/interface/change-calculated-column.d.ts.map +1 -0
- package/dist/esm/interface/change-calculated-column.js +120 -0
- package/dist/esm/interface/change-decimals.d.ts +7 -0
- package/dist/esm/interface/change-decimals.d.ts.map +1 -0
- package/dist/esm/interface/change-decimals.js +58 -0
- package/dist/esm/interface/change-formatting.d.ts +4 -0
- package/dist/esm/interface/change-formatting.d.ts.map +1 -0
- package/dist/esm/interface/change-formatting.js +209 -0
- package/dist/esm/interface/change-sheet-tabcolor.d.ts +4 -0
- package/dist/esm/interface/change-sheet-tabcolor.d.ts.map +1 -0
- package/dist/esm/interface/change-sheet-tabcolor.js +19 -0
- package/dist/esm/interface/change-table-column.d.ts +49 -0
- package/dist/esm/interface/change-table-column.d.ts.map +1 -0
- package/dist/esm/interface/change-table-column.js +247 -0
- package/dist/esm/interface/change-theme.d.ts +4 -0
- package/dist/esm/interface/change-theme.d.ts.map +1 -0
- package/dist/esm/interface/change-theme.js +21 -0
- package/dist/esm/interface/chart-extensions.d.ts +32 -0
- package/dist/esm/interface/chart-extensions.d.ts.map +1 -0
- package/dist/esm/interface/chart-extensions.js +71 -0
- package/dist/esm/interface/citations.d.ts +33 -0
- package/dist/esm/interface/citations.d.ts.map +1 -0
- package/dist/esm/interface/citations.js +123 -0
- package/dist/esm/interface/clear-formatting.d.ts +5 -0
- package/dist/esm/interface/clear-formatting.d.ts.map +1 -0
- package/dist/esm/interface/clear-formatting.js +48 -0
- package/dist/esm/interface/conditional-formatting-rules.d.ts +7 -0
- package/dist/esm/interface/conditional-formatting-rules.d.ts.map +1 -0
- package/dist/esm/interface/conditional-formatting-rules.js +123 -0
- package/dist/esm/interface/create-table.d.ts +5 -0
- package/dist/esm/interface/create-table.d.ts.map +1 -0
- package/dist/esm/interface/create-table.js +105 -0
- package/dist/esm/interface/data-validation-rules.d.ts +25 -0
- package/dist/esm/interface/data-validation-rules.d.ts.map +1 -0
- package/dist/esm/interface/data-validation-rules.js +310 -0
- package/dist/esm/interface/data-validation-utils.d.ts +12 -0
- package/dist/esm/interface/data-validation-utils.d.ts.map +1 -0
- package/dist/esm/interface/data-validation-utils.js +79 -0
- package/dist/esm/interface/delete-cells-shift-left.d.ts +5 -0
- package/dist/esm/interface/delete-cells-shift-left.d.ts.map +1 -0
- package/dist/esm/interface/delete-cells-shift-left.js +146 -0
- package/dist/esm/interface/delete-cells-shift-up.d.ts +5 -0
- package/dist/esm/interface/delete-cells-shift-up.d.ts.map +1 -0
- package/dist/esm/interface/delete-cells-shift-up.js +138 -0
- package/dist/esm/interface/delete-cells.d.ts +6 -0
- package/dist/esm/interface/delete-cells.d.ts.map +1 -0
- package/dist/esm/interface/delete-cells.js +184 -0
- package/dist/esm/interface/delete-column.d.ts +4 -0
- package/dist/esm/interface/delete-column.d.ts.map +1 -0
- package/dist/esm/interface/delete-column.js +254 -0
- package/dist/esm/interface/delete-row.d.ts +4 -0
- package/dist/esm/interface/delete-row.d.ts.map +1 -0
- package/dist/esm/interface/delete-row.js +226 -0
- package/dist/esm/interface/delete-sheet.d.ts +4 -0
- package/dist/esm/interface/delete-sheet.d.ts.map +1 -0
- package/dist/esm/interface/delete-sheet.js +78 -0
- package/dist/esm/interface/delete-table-column.d.ts +4 -0
- package/dist/esm/interface/delete-table-column.d.ts.map +1 -0
- package/dist/esm/interface/delete-table-column.js +274 -0
- package/dist/esm/interface/delete-table-row.d.ts +4 -0
- package/dist/esm/interface/delete-table-row.d.ts.map +1 -0
- package/dist/esm/interface/delete-table-row.js +278 -0
- package/dist/esm/interface/duplicate-sheet.d.ts +4 -0
- package/dist/esm/interface/duplicate-sheet.d.ts.map +1 -0
- package/dist/esm/interface/duplicate-sheet.js +206 -0
- package/dist/esm/interface/embeds.d.ts +9 -0
- package/dist/esm/interface/embeds.d.ts.map +1 -0
- package/dist/esm/interface/embeds.js +115 -0
- package/dist/esm/interface/freeze.d.ts +5 -0
- package/dist/esm/interface/freeze.d.ts.map +1 -0
- package/dist/esm/interface/freeze.js +109 -0
- package/dist/esm/interface/helpers.d.ts +6 -0
- package/dist/esm/interface/helpers.d.ts.map +1 -0
- package/dist/esm/interface/helpers.js +32 -0
- package/dist/esm/interface/hide-column.d.ts +4 -0
- package/dist/esm/interface/hide-column.d.ts.map +1 -0
- package/dist/esm/interface/hide-column.js +59 -0
- package/dist/esm/interface/hide-row.d.ts +4 -0
- package/dist/esm/interface/hide-row.d.ts.map +1 -0
- package/dist/esm/interface/hide-row.js +54 -0
- package/dist/esm/interface/indent.d.ts +7 -0
- package/dist/esm/interface/indent.d.ts.map +1 -0
- package/dist/esm/interface/indent.js +73 -0
- package/dist/esm/interface/insert-cells-shift-down.d.ts +5 -0
- package/dist/esm/interface/insert-cells-shift-down.d.ts.map +1 -0
- package/dist/esm/interface/insert-cells-shift-down.js +143 -0
- package/dist/esm/interface/insert-cells-shift-right.d.ts +5 -0
- package/dist/esm/interface/insert-cells-shift-right.d.ts.map +1 -0
- package/dist/esm/interface/insert-cells-shift-right.js +134 -0
- package/dist/esm/interface/insert-column.d.ts +7 -0
- package/dist/esm/interface/insert-column.d.ts.map +1 -0
- package/dist/esm/interface/insert-column.js +481 -0
- package/dist/esm/interface/insert-note.d.ts +5 -0
- package/dist/esm/interface/insert-note.d.ts.map +1 -0
- package/dist/esm/interface/insert-note.js +23 -0
- package/dist/esm/interface/insert-row.d.ts +4 -0
- package/dist/esm/interface/insert-row.d.ts.map +1 -0
- package/dist/esm/interface/insert-row.js +158 -0
- package/dist/esm/interface/insert-table-row.d.ts +4 -0
- package/dist/esm/interface/insert-table-row.d.ts.map +1 -0
- package/dist/esm/interface/insert-table-row.js +314 -0
- package/dist/esm/interface/interface-cli.d.ts +3 -0
- package/dist/esm/interface/interface-cli.d.ts.map +1 -0
- package/dist/esm/interface/interface-cli.js +62 -0
- package/dist/esm/interface/named-range-operations.d.ts +19 -0
- package/dist/esm/interface/named-range-operations.d.ts.map +1 -0
- package/dist/esm/interface/named-range-operations.js +71 -0
- package/dist/esm/interface/new-sheet.d.ts +4 -0
- package/dist/esm/interface/new-sheet.d.ts.map +1 -0
- package/dist/esm/interface/new-sheet.js +102 -0
- package/dist/esm/interface/pivot-extensions.d.ts +27 -0
- package/dist/esm/interface/pivot-extensions.d.ts.map +1 -0
- package/dist/esm/interface/pivot-extensions.js +60 -0
- package/dist/esm/interface/remove-duplicates.d.ts +11 -0
- package/dist/esm/interface/remove-duplicates.d.ts.map +1 -0
- package/dist/esm/interface/remove-duplicates.js +107 -0
- package/dist/esm/interface/remove-table.d.ts +4 -0
- package/dist/esm/interface/remove-table.d.ts.map +1 -0
- package/dist/esm/interface/remove-table.js +50 -0
- package/dist/esm/interface/resize-utils.d.ts +18 -0
- package/dist/esm/interface/resize-utils.d.ts.map +1 -0
- package/dist/esm/interface/resize-utils.js +34 -0
- package/dist/esm/interface/resize.d.ts +5 -0
- package/dist/esm/interface/resize.d.ts.map +1 -0
- package/dist/esm/interface/resize.js +43 -0
- package/dist/esm/interface/slicers.d.ts +9 -0
- package/dist/esm/interface/slicers.d.ts.map +1 -0
- package/dist/esm/interface/slicers.js +107 -0
- package/dist/esm/interface/split-text.d.ts +5 -0
- package/dist/esm/interface/split-text.d.ts.map +1 -0
- package/dist/esm/interface/split-text.js +94 -0
- package/dist/esm/interface/spreadsheet-interface.d.ts +642 -0
- package/dist/esm/interface/spreadsheet-interface.d.ts.map +1 -0
- package/dist/esm/interface/spreadsheet-interface.js +2442 -0
- package/dist/esm/interface/table-totalrow.d.ts +20 -0
- package/dist/esm/interface/table-totalrow.d.ts.map +1 -0
- package/dist/esm/interface/table-totalrow.js +155 -0
- package/dist/esm/interface/table-utils.d.ts +21 -0
- package/dist/esm/interface/table-utils.d.ts.map +1 -0
- package/dist/esm/interface/table-utils.js +38 -0
- package/dist/esm/interface/update-sheet.d.ts +16 -0
- package/dist/esm/interface/update-sheet.d.ts.map +1 -0
- package/dist/esm/interface/update-sheet.js +64 -0
- package/dist/esm/interface/update-table.d.ts +4 -0
- package/dist/esm/interface/update-table.d.ts.map +1 -0
- package/dist/esm/interface/update-table.js +111 -0
- package/dist/esm/server-utils.d.ts +8 -0
- package/dist/esm/server-utils.d.ts.map +1 -0
- package/dist/esm/server-utils.js +3 -0
- package/dist/esm/server.browser.d.ts +9 -0
- package/dist/esm/server.browser.d.ts.map +1 -0
- package/dist/esm/server.browser.js +5 -0
- package/dist/esm/server.d.ts +9 -0
- package/dist/esm/server.d.ts.map +1 -0
- package/dist/esm/server.js +5 -0
- package/dist/esm/shared-string-registry.d.ts +35 -0
- package/dist/esm/shared-string-registry.d.ts.map +1 -0
- package/dist/esm/shared-string-registry.js +248 -0
- package/dist/esm/sheet-cell.d.ts +310 -0
- package/dist/esm/sheet-cell.d.ts.map +1 -0
- package/dist/esm/sheet-cell.js +1829 -0
- package/dist/esm/test-setup.d.ts +2 -0
- package/dist/esm/test-setup.d.ts.map +1 -0
- package/dist/esm/test-setup.js +3 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/esm/types.d.ts +44 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +33 -0
- package/dist/esm/validation-schema/table.schema.d.ts +6 -0
- package/dist/esm/validation-schema/table.schema.d.ts.map +1 -0
- package/dist/esm/validation-schema/table.schema.js +4 -0
- package/dist/esm/vitest.config.d.ts +3 -0
- package/dist/esm/vitest.config.d.ts.map +1 -0
- package/dist/esm/vitest.config.js +22 -0
- package/package.json +89 -0
|
@@ -0,0 +1,1688 @@
|
|
|
1
|
+
import { CalculationGraph, CalculationWorkerClient, createNamedRangeResolver, createStructuredReferenceResolver, enqueueCalculationOperations, mapOperationToGraphOperation, } from "@rowsncolumns/calculation-worker";
|
|
2
|
+
import { tokenize as formulaTokenizer } from "@rowsncolumns/calculator";
|
|
3
|
+
import { CellNode, CellRangeNode, isCellCoordinate, isCellNode, isCellRangeNode, isStaticNode, makeKey, } from "@rowsncolumns/dag";
|
|
4
|
+
import { FormulaError } from "@rowsncolumns/fast-formula-parser";
|
|
5
|
+
import { isAreasEqual } from "@rowsncolumns/grid";
|
|
6
|
+
import { useCallbackRef } from "@rowsncolumns/spreadsheet";
|
|
7
|
+
import { isAFormula, isNil, scheduleAfterPaint } from "@rowsncolumns/utils";
|
|
8
|
+
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
9
|
+
import { BehaviorSubject } from "rxjs";
|
|
10
|
+
import { parseFilterSourceRange } from "../api/filter-range";
|
|
11
|
+
import { getFunctionNamesFromFormula } from "../api/immer-utils";
|
|
12
|
+
import { generateCollisionError, isEqualPosition } from "../api/range";
|
|
13
|
+
import { AWAITING_CALCULATION } from "../helpers";
|
|
14
|
+
import { SheetCell } from "../sheet-cell";
|
|
15
|
+
import { useDeferredCalculationFlush } from "./use-deferred-calculation-flush";
|
|
16
|
+
const ensureBatchTiming = (store, batchId) => {
|
|
17
|
+
let timing = store.get(batchId);
|
|
18
|
+
if (!timing) {
|
|
19
|
+
timing = {};
|
|
20
|
+
store.set(batchId, timing);
|
|
21
|
+
}
|
|
22
|
+
return timing;
|
|
23
|
+
};
|
|
24
|
+
const getTimestamp = () => typeof performance !== "undefined" && typeof performance.now === "function"
|
|
25
|
+
? performance.now()
|
|
26
|
+
: Date.now();
|
|
27
|
+
class CalculationMetrics {
|
|
28
|
+
histogram = new Map();
|
|
29
|
+
record(phase, duration) {
|
|
30
|
+
if (duration == null || Number.isNaN(duration)) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const bucket = this.histogram.get(phase);
|
|
34
|
+
if (bucket) {
|
|
35
|
+
bucket.push(duration);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
this.histogram.set(phase, [duration]);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
report() {
|
|
42
|
+
const result = {};
|
|
43
|
+
for (const [phase, values] of this.histogram) {
|
|
44
|
+
if (!values.length)
|
|
45
|
+
continue;
|
|
46
|
+
const sorted = [...values].sort((a, b) => a - b);
|
|
47
|
+
result[phase] = {
|
|
48
|
+
p50: this.getPercentileFromSorted(sorted, 0.5),
|
|
49
|
+
p95: this.getPercentileFromSorted(sorted, 0.95),
|
|
50
|
+
p99: this.getPercentileFromSorted(sorted, 0.99),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
getPercentileFromSorted(values, percentile) {
|
|
56
|
+
if (!values.length)
|
|
57
|
+
return 0;
|
|
58
|
+
const index = Math.min(values.length - 1, Math.max(0, Math.floor(percentile * values.length)));
|
|
59
|
+
return values[index];
|
|
60
|
+
}
|
|
61
|
+
clear() {
|
|
62
|
+
this.histogram.clear();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const isSerializedFormulaError = (value) => {
|
|
66
|
+
return Boolean(value &&
|
|
67
|
+
typeof value === "object" &&
|
|
68
|
+
"type" in value &&
|
|
69
|
+
value.type === "FormulaError");
|
|
70
|
+
};
|
|
71
|
+
const toCellRange = (position) => {
|
|
72
|
+
if ("startRowIndex" in position) {
|
|
73
|
+
return position;
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
sheetId: position.sheetId,
|
|
77
|
+
startRowIndex: position.rowIndex,
|
|
78
|
+
endRowIndex: position.rowIndex,
|
|
79
|
+
startColumnIndex: position.columnIndex,
|
|
80
|
+
endColumnIndex: position.columnIndex,
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
const isWorkerFormulaErrorDetails = (details) => {
|
|
84
|
+
return (!!details &&
|
|
85
|
+
typeof details === "object" &&
|
|
86
|
+
"reason" in details &&
|
|
87
|
+
typeof details.reason === "string");
|
|
88
|
+
};
|
|
89
|
+
const normalizeArrayResult = (value) => {
|
|
90
|
+
if (!Array.isArray(value)) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
if (!value.length) {
|
|
94
|
+
return [[undefined]];
|
|
95
|
+
}
|
|
96
|
+
if (Array.isArray(value[0])) {
|
|
97
|
+
return value;
|
|
98
|
+
}
|
|
99
|
+
return [value];
|
|
100
|
+
};
|
|
101
|
+
const getOperationKey = (operation) => {
|
|
102
|
+
return makeKey(operation.position);
|
|
103
|
+
};
|
|
104
|
+
const VOLATILE_FUNCTIONS = new Set([
|
|
105
|
+
"NOW",
|
|
106
|
+
"TODAY",
|
|
107
|
+
"RAND",
|
|
108
|
+
"RANDARRAY",
|
|
109
|
+
"RANDBETWEEN",
|
|
110
|
+
"SHEET",
|
|
111
|
+
"SHEETS",
|
|
112
|
+
"OFFSET",
|
|
113
|
+
"INDIRECT",
|
|
114
|
+
]);
|
|
115
|
+
const MAX_BUFFERED_RESULTS = 2000;
|
|
116
|
+
const mergePendingOperation = (current, incoming) => {
|
|
117
|
+
if (!current) {
|
|
118
|
+
return incoming;
|
|
119
|
+
}
|
|
120
|
+
if (incoming.type === "add" || incoming.type === "remove") {
|
|
121
|
+
return incoming;
|
|
122
|
+
}
|
|
123
|
+
if (incoming.type === "dirty") {
|
|
124
|
+
if (current.type === "add" || current.type === "remove") {
|
|
125
|
+
return current;
|
|
126
|
+
}
|
|
127
|
+
if (current.type === "dirty") {
|
|
128
|
+
return {
|
|
129
|
+
...current,
|
|
130
|
+
force: current.force || incoming.force,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return incoming;
|
|
135
|
+
};
|
|
136
|
+
const createRangeFromMatrix = (anchor, matrix) => {
|
|
137
|
+
const rowCount = Math.max(matrix.length, 1);
|
|
138
|
+
const columnCount = Math.max(matrix[0]?.length ?? 1, 1);
|
|
139
|
+
return {
|
|
140
|
+
sheetId: anchor.sheetId,
|
|
141
|
+
startRowIndex: anchor.rowIndex,
|
|
142
|
+
startColumnIndex: anchor.columnIndex,
|
|
143
|
+
endRowIndex: anchor.rowIndex + rowCount - 1,
|
|
144
|
+
endColumnIndex: anchor.columnIndex + columnCount - 1,
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
const forEachCellInRange = (range, iteratee) => {
|
|
148
|
+
let rowOffset = 0;
|
|
149
|
+
for (let row = range.startRowIndex; row <= range.endRowIndex; row++, rowOffset++) {
|
|
150
|
+
let columnOffset = 0;
|
|
151
|
+
for (let column = range.startColumnIndex; column <= range.endColumnIndex; column++, columnOffset++) {
|
|
152
|
+
const shouldStop = iteratee({ sheetId: range.sheetId, rowIndex: row, columnIndex: column }, { row: rowOffset, column: columnOffset });
|
|
153
|
+
if (shouldStop) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
const isCoordinateWithinRange = (position, range) => {
|
|
160
|
+
return (range.sheetId === position.sheetId &&
|
|
161
|
+
position.rowIndex >= range.startRowIndex &&
|
|
162
|
+
position.rowIndex <= range.endRowIndex &&
|
|
163
|
+
position.columnIndex >= range.startColumnIndex &&
|
|
164
|
+
position.columnIndex <= range.endColumnIndex);
|
|
165
|
+
};
|
|
166
|
+
const rangesOverlap = (left, right) => {
|
|
167
|
+
if (left.sheetId !== right.sheetId) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
return (left.startRowIndex <= right.endRowIndex &&
|
|
171
|
+
left.endRowIndex >= right.startRowIndex &&
|
|
172
|
+
left.startColumnIndex <= right.endColumnIndex &&
|
|
173
|
+
left.endColumnIndex >= right.startColumnIndex);
|
|
174
|
+
};
|
|
175
|
+
export const useCalculationWorker = (props) => {
|
|
176
|
+
const { sheets, worker, createWorker, workerLogger, activeSheetId, getSheetId, getSheetName, getEffectiveValue, getCellData, getUserEnteredValue, getConditionalFormatFormula, getDataValidationFormula, getEffectiveStructuredValue, onSuccess, onBeginCalculation, onChangeStaticReference, locale, tables, namedRanges, onDemandFormulaPattern, coalesceDelayMs = 0, enablePerformanceLogging = false, iterativeCalculation, enableLazyCalculation = true, enabled = true, } = props;
|
|
177
|
+
const onSuccessRef = useCallbackRef(onSuccess);
|
|
178
|
+
const onBeginCalculationRef = useCallbackRef(onBeginCalculation);
|
|
179
|
+
const onChangeStaticReferenceRef = useCallbackRef(onChangeStaticReference);
|
|
180
|
+
const getUserEnteredValueRef = useCallbackRef(getUserEnteredValue);
|
|
181
|
+
const getConditionalFormatFormulaRef = useCallbackRef(getConditionalFormatFormula);
|
|
182
|
+
const getDataValidationFormulaRef = useCallbackRef(getDataValidationFormula);
|
|
183
|
+
const getEffectiveValueRef = useCallbackRef(getEffectiveValue);
|
|
184
|
+
const getEffectiveStructuredValueRef = useCallbackRef(getEffectiveStructuredValue);
|
|
185
|
+
const getSheetIdRef = useCallbackRef(getSheetId);
|
|
186
|
+
const getSheetNameRef = useCallbackRef(getSheetName);
|
|
187
|
+
const onPerformanceEventRef = useCallbackRef(props.onPerformanceEvent);
|
|
188
|
+
const emitPerformanceEvent = useCallback((event) => {
|
|
189
|
+
if (enablePerformanceLogging && typeof console !== "undefined") {
|
|
190
|
+
const logger = console.debug ?? console.log;
|
|
191
|
+
logger.call(console, "[calc-worker]", event);
|
|
192
|
+
}
|
|
193
|
+
onPerformanceEventRef?.(event);
|
|
194
|
+
}, [enablePerformanceLogging, onPerformanceEventRef]);
|
|
195
|
+
const pendingVolatileTrackingRef = useRef(new Map());
|
|
196
|
+
const deferredOperationsBySheetRef = useRef(new Map());
|
|
197
|
+
const completedCountRef = useRef(0);
|
|
198
|
+
const statsSubjectRef = useRef(null);
|
|
199
|
+
if (!statsSubjectRef.current) {
|
|
200
|
+
statsSubjectRef.current = new BehaviorSubject({
|
|
201
|
+
queuedCount: 0,
|
|
202
|
+
inFlightCount: 0,
|
|
203
|
+
completedCount: 0,
|
|
204
|
+
deferredCount: 0,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
const processFrameRef = useRef(null);
|
|
208
|
+
const processingRef = useRef(false);
|
|
209
|
+
const pendingOperationQueueRef = useRef([]);
|
|
210
|
+
const pendingOperationMapRef = useRef(new Map());
|
|
211
|
+
const enqueuePendingOperationRef = useRef(undefined);
|
|
212
|
+
const isFullRecalcRef = useRef(false);
|
|
213
|
+
const computedValuesRef = useRef(new Map());
|
|
214
|
+
const pendingResultsRef = useRef(new Map());
|
|
215
|
+
const resultFrameRef = useRef(null);
|
|
216
|
+
const volatileCellsRef = useRef(new Map());
|
|
217
|
+
const pendingStaticNodesRef = useRef([]);
|
|
218
|
+
const staticFrameRef = useRef(null);
|
|
219
|
+
const beginQueueRef = useRef([]);
|
|
220
|
+
const beginPendingKeysRef = useRef(new Set());
|
|
221
|
+
const pendingArrayDirtyAnchorsRef = useRef(new Map());
|
|
222
|
+
const graphRef = useRef(null);
|
|
223
|
+
const workerInstanceRef = useRef(null);
|
|
224
|
+
const workerErrorPromiseRef = useRef(null);
|
|
225
|
+
const workerErrorRejectRef = useRef(null);
|
|
226
|
+
const workerErrorCleanupRef = useRef(null);
|
|
227
|
+
const tablesRef = useRef(tables);
|
|
228
|
+
const namedRangesRef = useRef(namedRanges);
|
|
229
|
+
const sheetsRef = useRef(sheets);
|
|
230
|
+
tablesRef.current = tables;
|
|
231
|
+
namedRangesRef.current = namedRanges;
|
|
232
|
+
sheetsRef.current = sheets;
|
|
233
|
+
const scheduleVolatileTracking = useCallback((position) => {
|
|
234
|
+
pendingVolatileTrackingRef.current.set(makeKey(position), position);
|
|
235
|
+
}, []);
|
|
236
|
+
const structuredReferenceResolver = useMemo(() => createStructuredReferenceResolver({
|
|
237
|
+
getTables: () => tablesRef.current,
|
|
238
|
+
getSheetName: (sheetId) => getSheetNameRef(sheetId),
|
|
239
|
+
getSheetId: (sheetName) => sheetName ? getSheetIdRef(sheetName) : undefined,
|
|
240
|
+
}), [getSheetNameRef, getSheetIdRef]);
|
|
241
|
+
const namedRangeResolver = useMemo(() => createNamedRangeResolver({
|
|
242
|
+
getNamedRanges: () => namedRangesRef.current,
|
|
243
|
+
getSheetName: (sheetId) => getSheetNameRef(sheetId),
|
|
244
|
+
}), [getSheetNameRef]);
|
|
245
|
+
if (!graphRef.current) {
|
|
246
|
+
graphRef.current = new CalculationGraph({
|
|
247
|
+
getSheetId: (name) => getSheetIdRef(name),
|
|
248
|
+
getSheetName: (id) => getSheetNameRef(id),
|
|
249
|
+
getFormula: (position) => {
|
|
250
|
+
const value = getFinalUserEnteredValue(position);
|
|
251
|
+
return typeof value === "string" ? value : undefined;
|
|
252
|
+
},
|
|
253
|
+
getCellValue: (position, property) => {
|
|
254
|
+
const key = makeKey(position);
|
|
255
|
+
if (computedValuesRef.current.has(key)) {
|
|
256
|
+
const cached = computedValuesRef.current.get(key);
|
|
257
|
+
if (property) {
|
|
258
|
+
if (!getEffectiveStructuredValueRef) {
|
|
259
|
+
return undefined;
|
|
260
|
+
}
|
|
261
|
+
const resolved = getEffectiveStructuredValueRef(cached, property);
|
|
262
|
+
return resolved;
|
|
263
|
+
}
|
|
264
|
+
return cached;
|
|
265
|
+
}
|
|
266
|
+
return getEffectiveValueRef(position.sheetId, position.rowIndex, position.columnIndex, property);
|
|
267
|
+
},
|
|
268
|
+
getSheetProperties: (sheetId) => {
|
|
269
|
+
const sheet = sheetsRef.current.find((s) => s.id === sheetId);
|
|
270
|
+
if (!sheet)
|
|
271
|
+
return undefined;
|
|
272
|
+
return {
|
|
273
|
+
rowCount: sheet.rowCount,
|
|
274
|
+
columnCount: sheet.columnCount,
|
|
275
|
+
};
|
|
276
|
+
},
|
|
277
|
+
depParserConfig: {
|
|
278
|
+
onStructuredReference: structuredReferenceResolver,
|
|
279
|
+
onVariable: namedRangeResolver,
|
|
280
|
+
},
|
|
281
|
+
iterativeCalculation,
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
const graph = graphRef.current;
|
|
285
|
+
useEffect(() => {
|
|
286
|
+
graph.setIterativeCalculationOptions(iterativeCalculation);
|
|
287
|
+
}, [graph, iterativeCalculation]);
|
|
288
|
+
const ensureWorkerInstance = () => {
|
|
289
|
+
if (workerInstanceRef.current) {
|
|
290
|
+
return workerInstanceRef.current;
|
|
291
|
+
}
|
|
292
|
+
const instance = worker ?? createWorker?.();
|
|
293
|
+
if (!instance) {
|
|
294
|
+
throw new Error("Calculation worker not provided. Pass a worker or createWorker factory.");
|
|
295
|
+
}
|
|
296
|
+
workerInstanceRef.current = instance;
|
|
297
|
+
workerErrorPromiseRef.current = new Promise((_, reject) => {
|
|
298
|
+
workerErrorRejectRef.current = reject;
|
|
299
|
+
});
|
|
300
|
+
const handleWorkerError = (event) => {
|
|
301
|
+
const error = event?.error instanceof Error
|
|
302
|
+
? event.error
|
|
303
|
+
: new Error(event?.message ?? "Calculation worker failed to load.");
|
|
304
|
+
workerErrorRejectRef.current?.(error);
|
|
305
|
+
};
|
|
306
|
+
instance.addEventListener("error", handleWorkerError);
|
|
307
|
+
workerErrorCleanupRef.current = () => {
|
|
308
|
+
instance.removeEventListener("error", handleWorkerError);
|
|
309
|
+
};
|
|
310
|
+
return instance;
|
|
311
|
+
};
|
|
312
|
+
const workerClientRef = useRef(null);
|
|
313
|
+
const workerClientStub = useMemo(() => ({
|
|
314
|
+
initialize: async () => { },
|
|
315
|
+
dispose: () => { },
|
|
316
|
+
cancel: () => { },
|
|
317
|
+
evaluate: async () => [],
|
|
318
|
+
}), []);
|
|
319
|
+
if (!workerClientRef.current) {
|
|
320
|
+
workerClientRef.current = enabled
|
|
321
|
+
? new CalculationWorkerClient({
|
|
322
|
+
worker: ensureWorkerInstance(),
|
|
323
|
+
logger: workerLogger,
|
|
324
|
+
enableNumericMatrixTransfer: true,
|
|
325
|
+
})
|
|
326
|
+
: workerClientStub;
|
|
327
|
+
}
|
|
328
|
+
else if (enabled && workerClientRef.current === workerClientStub) {
|
|
329
|
+
workerClientRef.current = new CalculationWorkerClient({
|
|
330
|
+
worker: ensureWorkerInstance(),
|
|
331
|
+
logger: workerLogger,
|
|
332
|
+
enableNumericMatrixTransfer: true,
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
else if (!enabled && workerClientRef.current !== workerClientStub) {
|
|
336
|
+
workerErrorCleanupRef.current?.();
|
|
337
|
+
workerClientRef.current.dispose();
|
|
338
|
+
workerInstanceRef.current = null;
|
|
339
|
+
workerErrorPromiseRef.current = null;
|
|
340
|
+
workerErrorRejectRef.current = null;
|
|
341
|
+
workerClientRef.current = workerClientStub;
|
|
342
|
+
}
|
|
343
|
+
const workerClient = workerClientRef.current;
|
|
344
|
+
const workerReadyRef = useRef(false);
|
|
345
|
+
const pendingUserValueEditsRef = useRef(new Map());
|
|
346
|
+
const getFinalUserEnteredValue = useCallback((position) => {
|
|
347
|
+
const pendingKey = makeKey(position);
|
|
348
|
+
if (pendingUserValueEditsRef.current.has(pendingKey)) {
|
|
349
|
+
return pendingUserValueEditsRef.current.get(pendingKey);
|
|
350
|
+
}
|
|
351
|
+
const { conditionalFormatId, dataValidationId } = position;
|
|
352
|
+
if (!isNil(conditionalFormatId)) {
|
|
353
|
+
return getConditionalFormatFormulaRef(position.sheetId, position.rowIndex, position.columnIndex, conditionalFormatId);
|
|
354
|
+
}
|
|
355
|
+
if (!isNil(dataValidationId)) {
|
|
356
|
+
return getDataValidationFormulaRef(position.sheetId, position.rowIndex, position.columnIndex, dataValidationId);
|
|
357
|
+
}
|
|
358
|
+
return getUserEnteredValueRef(position.sheetId, position.rowIndex, position.columnIndex);
|
|
359
|
+
}, [
|
|
360
|
+
getConditionalFormatFormulaRef,
|
|
361
|
+
getDataValidationFormulaRef,
|
|
362
|
+
getUserEnteredValueRef,
|
|
363
|
+
]);
|
|
364
|
+
const updateVolatileFormulaTracking = useCallback((position) => {
|
|
365
|
+
const userValue = getFinalUserEnteredValue(position);
|
|
366
|
+
const key = makeKey(position);
|
|
367
|
+
volatileCellsRef.current.delete(key);
|
|
368
|
+
if (typeof userValue !== "string") {
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
const normalized = userValue.trim();
|
|
372
|
+
if (!normalized.startsWith("=")) {
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
const formula = normalized.slice(1);
|
|
376
|
+
const fns = getFunctionNamesFromFormula(formula);
|
|
377
|
+
if (fns.some((fn) => VOLATILE_FUNCTIONS.has(fn.toUpperCase()))) {
|
|
378
|
+
volatileCellsRef.current.set(key, position);
|
|
379
|
+
}
|
|
380
|
+
}, [getFinalUserEnteredValue]);
|
|
381
|
+
const flushVolatileTracking = useCallback(() => {
|
|
382
|
+
// Volatile formulas enqueue themselves asynchronously—flush the buffered
|
|
383
|
+
// positions once per processing pass so we only rescan the formulas we saw.
|
|
384
|
+
if (!pendingVolatileTrackingRef.current.size) {
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
pendingVolatileTrackingRef.current.forEach((position) => updateVolatileFormulaTracking(position));
|
|
388
|
+
pendingVolatileTrackingRef.current.clear();
|
|
389
|
+
}, [updateVolatileFormulaTracking]);
|
|
390
|
+
const queueAnchorDirty = useCallback((anchor) => {
|
|
391
|
+
// Array anchors can request a follow-up recalc once spill conflicts clear;
|
|
392
|
+
// track a pending flag so we only enqueue a single dirty op per anchor.
|
|
393
|
+
const key = makeKey(anchor);
|
|
394
|
+
if (collisionAnchorsRef.current.has(key)) {
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
const pending = pendingArrayDirtyAnchorsRef.current;
|
|
398
|
+
if (pending.has(key)) {
|
|
399
|
+
pending.set(key, true);
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
if (!enqueuePendingOperationRef.current) {
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
pending.set(key, false);
|
|
406
|
+
enqueuePendingOperationRef.current({
|
|
407
|
+
type: "dirty",
|
|
408
|
+
position: anchor,
|
|
409
|
+
force: true,
|
|
410
|
+
});
|
|
411
|
+
}, []);
|
|
412
|
+
const markAnchorProcessed = useCallback((anchor) => {
|
|
413
|
+
const key = makeKey(anchor);
|
|
414
|
+
const pending = pendingArrayDirtyAnchorsRef.current;
|
|
415
|
+
const shouldRetry = pending.get(key);
|
|
416
|
+
pending.delete(key);
|
|
417
|
+
if (shouldRetry) {
|
|
418
|
+
queueAnchorDirty(anchor);
|
|
419
|
+
}
|
|
420
|
+
}, [queueAnchorDirty]);
|
|
421
|
+
const graphOperationQueueRef = useRef([]);
|
|
422
|
+
const graphOperationFrameRef = useRef(null);
|
|
423
|
+
const arrayRangeCacheRef = useRef(new Map());
|
|
424
|
+
const findCachedArrayAnchor = useCallback((position) => {
|
|
425
|
+
for (const entry of arrayRangeCacheRef.current.values()) {
|
|
426
|
+
if (isCoordinateWithinRange(position, entry.range)) {
|
|
427
|
+
return entry.anchor;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
return undefined;
|
|
431
|
+
}, []);
|
|
432
|
+
const workerForceRecalcKeysRef = useRef(new Set());
|
|
433
|
+
const activeWorkerKeysRef = useRef(new Set());
|
|
434
|
+
const activeExecutionsRef = useRef(0);
|
|
435
|
+
const emitStats = useCallback(() => {
|
|
436
|
+
const statsSubject = statsSubjectRef.current;
|
|
437
|
+
if (!statsSubject) {
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
let deferredCount = 0;
|
|
441
|
+
deferredOperationsBySheetRef.current.forEach((operations) => {
|
|
442
|
+
deferredCount += operations.size;
|
|
443
|
+
});
|
|
444
|
+
statsSubject.next({
|
|
445
|
+
queuedCount: pendingOperationMapRef.current.size,
|
|
446
|
+
inFlightCount: activeWorkerKeysRef.current.size,
|
|
447
|
+
completedCount: completedCountRef.current,
|
|
448
|
+
deferredCount,
|
|
449
|
+
});
|
|
450
|
+
}, []);
|
|
451
|
+
const deferCalculationNodes = useCallback((positions) => {
|
|
452
|
+
if (!positions.length) {
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
for (const position of positions) {
|
|
456
|
+
const key = makeKey(position);
|
|
457
|
+
const sheetId = position.sheetId;
|
|
458
|
+
const existing = deferredOperationsBySheetRef.current.get(sheetId) ??
|
|
459
|
+
new Map();
|
|
460
|
+
existing.set(key, {
|
|
461
|
+
type: "dirty",
|
|
462
|
+
position,
|
|
463
|
+
force: workerForceRecalcKeysRef.current.has(key),
|
|
464
|
+
});
|
|
465
|
+
deferredOperationsBySheetRef.current.set(sheetId, existing);
|
|
466
|
+
}
|
|
467
|
+
emitStats();
|
|
468
|
+
}, [emitStats]);
|
|
469
|
+
const cancelInflightEvaluation = useCallback((target) => {
|
|
470
|
+
if (!target) {
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
const key = typeof target === "string" ? target : makeKey(target);
|
|
474
|
+
if (activeWorkerKeysRef.current.has(key)) {
|
|
475
|
+
activeWorkerKeysRef.current.delete(key);
|
|
476
|
+
emitStats();
|
|
477
|
+
}
|
|
478
|
+
workerClient.cancel([key]);
|
|
479
|
+
}, [emitStats, workerClient]);
|
|
480
|
+
const onDemandPattern = useMemo(() => {
|
|
481
|
+
if (!onDemandFormulaPattern)
|
|
482
|
+
return undefined;
|
|
483
|
+
return new RegExp(onDemandFormulaPattern, "gi");
|
|
484
|
+
}, [onDemandFormulaPattern]);
|
|
485
|
+
const workerBatchTimingRef = useRef(new Map());
|
|
486
|
+
const batchSizesRef = useRef(new Map());
|
|
487
|
+
const batchesWithFirstResultLoggedRef = useRef(new Set());
|
|
488
|
+
const metricsRef = useRef(new CalculationMetrics());
|
|
489
|
+
const emitBatchPhaseEvent = useCallback((phase, options) => {
|
|
490
|
+
const { batchId } = options;
|
|
491
|
+
if (!batchId) {
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
const size = options.size && options.size > 0
|
|
495
|
+
? options.size
|
|
496
|
+
: batchSizesRef.current.get(batchId) ?? 0;
|
|
497
|
+
const timestamp = options.timestamp ?? getTimestamp();
|
|
498
|
+
const timing = ensureBatchTiming(workerBatchTimingRef.current, batchId);
|
|
499
|
+
// The switch below materializes a pseudo state machine so we can derive
|
|
500
|
+
// durations for every phase even if some events arrive out of order.
|
|
501
|
+
let duration = options.duration;
|
|
502
|
+
switch (phase) {
|
|
503
|
+
case "start":
|
|
504
|
+
timing.start = timestamp;
|
|
505
|
+
break;
|
|
506
|
+
case "plan-built":
|
|
507
|
+
if (!timing.start) {
|
|
508
|
+
timing.start = timestamp;
|
|
509
|
+
}
|
|
510
|
+
duration ??=
|
|
511
|
+
timing.start != null ? timestamp - timing.start : undefined;
|
|
512
|
+
timing.planBuilt = timestamp;
|
|
513
|
+
break;
|
|
514
|
+
case "worker-dispatch":
|
|
515
|
+
duration ??=
|
|
516
|
+
timing.planBuilt != null
|
|
517
|
+
? timestamp - timing.planBuilt
|
|
518
|
+
: timing.start != null
|
|
519
|
+
? timestamp - timing.start
|
|
520
|
+
: undefined;
|
|
521
|
+
timing.workerDispatch = timestamp;
|
|
522
|
+
break;
|
|
523
|
+
case "worker-runtime-complete":
|
|
524
|
+
if (duration == null) {
|
|
525
|
+
duration =
|
|
526
|
+
timing.workerDispatch != null
|
|
527
|
+
? timestamp - timing.workerDispatch
|
|
528
|
+
: undefined;
|
|
529
|
+
}
|
|
530
|
+
timing.workerRuntimeComplete = timestamp;
|
|
531
|
+
break;
|
|
532
|
+
case "first-result":
|
|
533
|
+
if (timing.firstResult) {
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
duration ??=
|
|
537
|
+
timing.workerDispatch != null
|
|
538
|
+
? timestamp - timing.workerDispatch
|
|
539
|
+
: timing.planBuilt != null
|
|
540
|
+
? timestamp - timing.planBuilt
|
|
541
|
+
: undefined;
|
|
542
|
+
timing.firstResult = timestamp;
|
|
543
|
+
break;
|
|
544
|
+
case "worker-complete":
|
|
545
|
+
duration ??=
|
|
546
|
+
timing.workerRuntimeComplete != null
|
|
547
|
+
? timestamp - timing.workerRuntimeComplete
|
|
548
|
+
: undefined;
|
|
549
|
+
timing.workerComplete = timestamp;
|
|
550
|
+
break;
|
|
551
|
+
case "complete":
|
|
552
|
+
duration ??=
|
|
553
|
+
timing.start != null ? timestamp - timing.start : undefined;
|
|
554
|
+
timing.complete = timestamp;
|
|
555
|
+
workerBatchTimingRef.current.delete(batchId);
|
|
556
|
+
batchSizesRef.current.delete(batchId);
|
|
557
|
+
batchesWithFirstResultLoggedRef.current.delete(batchId);
|
|
558
|
+
break;
|
|
559
|
+
}
|
|
560
|
+
metricsRef.current.record(phase, duration);
|
|
561
|
+
if (enablePerformanceLogging && phase === "complete") {
|
|
562
|
+
const report = metricsRef.current.report();
|
|
563
|
+
if (Object.keys(report).length && typeof console !== "undefined") {
|
|
564
|
+
if (typeof console.table === "function") {
|
|
565
|
+
console.table(report);
|
|
566
|
+
}
|
|
567
|
+
else if (typeof console.debug === "function") {
|
|
568
|
+
console.debug("[calc-worker][metrics]", report);
|
|
569
|
+
}
|
|
570
|
+
else if (typeof console.log === "function") {
|
|
571
|
+
console.log("[calc-worker][metrics]", report);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
emitPerformanceEvent({
|
|
576
|
+
type: "worker-batch",
|
|
577
|
+
phase,
|
|
578
|
+
batchId,
|
|
579
|
+
size,
|
|
580
|
+
timestamp,
|
|
581
|
+
duration,
|
|
582
|
+
});
|
|
583
|
+
}, [emitPerformanceEvent, enablePerformanceLogging]);
|
|
584
|
+
const beginBatchTracking = useCallback((plan, size, startTimestamp) => {
|
|
585
|
+
batchSizesRef.current.set(plan.id, size);
|
|
586
|
+
emitBatchPhaseEvent("start", {
|
|
587
|
+
batchId: plan.id,
|
|
588
|
+
size,
|
|
589
|
+
timestamp: startTimestamp,
|
|
590
|
+
});
|
|
591
|
+
}, [emitBatchPhaseEvent]);
|
|
592
|
+
const handlePlanBuilt = useCallback((plan, startTimestamp) => {
|
|
593
|
+
const cellCount = plan.nodes.filter((node) => node.kind === "cell").length;
|
|
594
|
+
if (!cellCount) {
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
beginBatchTracking(plan, cellCount, startTimestamp);
|
|
598
|
+
emitBatchPhaseEvent("plan-built", { batchId: plan.id, size: cellCount });
|
|
599
|
+
}, [emitBatchPhaseEvent, beginBatchTracking]);
|
|
600
|
+
const handleWorkerBatchEvent = useCallback((event, batchId) => {
|
|
601
|
+
if (event.phase === "worker-dispatch") {
|
|
602
|
+
batchSizesRef.current.set(batchId, event.batchSize);
|
|
603
|
+
emitBatchPhaseEvent("worker-dispatch", {
|
|
604
|
+
batchId,
|
|
605
|
+
timestamp: event.timestamp,
|
|
606
|
+
size: event.batchSize,
|
|
607
|
+
});
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
emitBatchPhaseEvent("worker-runtime-complete", {
|
|
611
|
+
batchId,
|
|
612
|
+
timestamp: event.timestamp,
|
|
613
|
+
duration: event.duration,
|
|
614
|
+
size: event.batchSize,
|
|
615
|
+
});
|
|
616
|
+
}, [emitBatchPhaseEvent]);
|
|
617
|
+
const pushPendingOperation = useCallback((operation) => {
|
|
618
|
+
// Prevent stale worker responses from racing the new work by tearing down
|
|
619
|
+
// any inflight evaluations for the affected cells.
|
|
620
|
+
cancelInflightEvaluation(operation.position);
|
|
621
|
+
if (operation.previousPosition) {
|
|
622
|
+
cancelInflightEvaluation(operation.previousPosition);
|
|
623
|
+
}
|
|
624
|
+
if (operation.type !== "dirty") {
|
|
625
|
+
const anchor = graph.getArrayParent(operation.position) ??
|
|
626
|
+
findCachedArrayAnchor(operation.position);
|
|
627
|
+
if (anchor && !isEqualPosition(anchor, operation.position)) {
|
|
628
|
+
queueAnchorDirty(anchor);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
const key = getOperationKey(operation);
|
|
632
|
+
const existing = pendingOperationMapRef.current.get(key);
|
|
633
|
+
// Coalesce successive edits on the same cell so we only schedule the most
|
|
634
|
+
// recent intent and avoid redundant graph rebuilds.
|
|
635
|
+
const merged = mergePendingOperation(existing, operation);
|
|
636
|
+
if (merged === existing) {
|
|
637
|
+
return false;
|
|
638
|
+
}
|
|
639
|
+
pendingOperationMapRef.current.set(key, merged);
|
|
640
|
+
if (!existing) {
|
|
641
|
+
pendingOperationQueueRef.current.push(key);
|
|
642
|
+
}
|
|
643
|
+
if (operation.force) {
|
|
644
|
+
workerForceRecalcKeysRef.current.add(key);
|
|
645
|
+
}
|
|
646
|
+
return true;
|
|
647
|
+
}, [cancelInflightEvaluation, graph, findCachedArrayAnchor, queueAnchorDirty]);
|
|
648
|
+
const enqueueVolatileCells = useCallback(() => {
|
|
649
|
+
// Volatile cells always recalc with the next batch so they can pick up
|
|
650
|
+
// global changes (time, randomization, etc.).
|
|
651
|
+
volatileCellsRef.current.forEach((position) => {
|
|
652
|
+
const key = makeKey(position);
|
|
653
|
+
if (!pendingOperationMapRef.current.has(key)) {
|
|
654
|
+
pushPendingOperation({
|
|
655
|
+
type: "dirty",
|
|
656
|
+
position,
|
|
657
|
+
force: true,
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
}, [pushPendingOperation]);
|
|
662
|
+
const deserializeResultValue = useCallback((value) => {
|
|
663
|
+
if (isSerializedFormulaError(value)) {
|
|
664
|
+
const rawDetails = value.details;
|
|
665
|
+
let structured;
|
|
666
|
+
let summary;
|
|
667
|
+
if (typeof rawDetails === "string") {
|
|
668
|
+
summary = rawDetails;
|
|
669
|
+
}
|
|
670
|
+
else if (isWorkerFormulaErrorDetails(rawDetails)) {
|
|
671
|
+
structured = rawDetails;
|
|
672
|
+
summary = structured.reason;
|
|
673
|
+
}
|
|
674
|
+
else if (rawDetails != null) {
|
|
675
|
+
summary = String(rawDetails.message ?? rawDetails);
|
|
676
|
+
}
|
|
677
|
+
const error = new FormulaError(value.error, summary, summary);
|
|
678
|
+
error.details = structured ?? rawDetails;
|
|
679
|
+
return error;
|
|
680
|
+
}
|
|
681
|
+
return value;
|
|
682
|
+
}, []);
|
|
683
|
+
const flushStaticNotifications = useCallback(() => {
|
|
684
|
+
staticFrameRef.current = null;
|
|
685
|
+
if (!pendingStaticNodesRef.current.length)
|
|
686
|
+
return;
|
|
687
|
+
onChangeStaticReferenceRef?.(pendingStaticNodesRef.current.slice());
|
|
688
|
+
pendingStaticNodesRef.current = [];
|
|
689
|
+
}, [onChangeStaticReferenceRef]);
|
|
690
|
+
const queueStaticNotification = useCallback((node) => {
|
|
691
|
+
pendingStaticNodesRef.current.push(node);
|
|
692
|
+
if (staticFrameRef.current == null) {
|
|
693
|
+
staticFrameRef.current = requestAnimationFrame(flushStaticNotifications);
|
|
694
|
+
}
|
|
695
|
+
}, [flushStaticNotifications]);
|
|
696
|
+
const flushResults = useCallback(() => {
|
|
697
|
+
resultFrameRef.current = null;
|
|
698
|
+
if (!pendingResultsRef.current.size)
|
|
699
|
+
return;
|
|
700
|
+
const isFullRecalc = isFullRecalcRef.current;
|
|
701
|
+
const pendingResults = pendingResultsRef.current;
|
|
702
|
+
onSuccessRef?.(pendingResults.values(), isFullRecalc, {});
|
|
703
|
+
// Once the consumer receives the batch we can drop the temporary cache so
|
|
704
|
+
// large evaluations (e.g. VLOOKUP matrices) don't accumulate in memory.
|
|
705
|
+
for (const key of pendingResults.keys()) {
|
|
706
|
+
computedValuesRef.current.delete(key);
|
|
707
|
+
}
|
|
708
|
+
pendingResults.clear();
|
|
709
|
+
isFullRecalcRef.current = false;
|
|
710
|
+
}, [onSuccessRef]);
|
|
711
|
+
const queueCellValue = useCallback((position, value, formatting) => {
|
|
712
|
+
// Buffer results until the next frame so grid updates stay batched and
|
|
713
|
+
// React state observers only process one consolidated payload.
|
|
714
|
+
const key = makeKey(position);
|
|
715
|
+
pendingUserValueEditsRef.current.delete(key);
|
|
716
|
+
computedValuesRef.current.set(key, value);
|
|
717
|
+
pendingResultsRef.current.set(key, [position, value, formatting]);
|
|
718
|
+
workerForceRecalcKeysRef.current.delete(key);
|
|
719
|
+
beginPendingKeysRef.current.delete(key);
|
|
720
|
+
if (pendingResultsRef.current.size >= MAX_BUFFERED_RESULTS) {
|
|
721
|
+
const frame = resultFrameRef.current;
|
|
722
|
+
if (frame != null) {
|
|
723
|
+
cancelAnimationFrame(frame);
|
|
724
|
+
resultFrameRef.current = null;
|
|
725
|
+
}
|
|
726
|
+
flushResults();
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
if (resultFrameRef.current == null) {
|
|
730
|
+
resultFrameRef.current = requestAnimationFrame(flushResults);
|
|
731
|
+
}
|
|
732
|
+
}, [flushResults]);
|
|
733
|
+
const flushBeginNotifications = useCallback(() => {
|
|
734
|
+
if (!beginQueueRef.current.length)
|
|
735
|
+
return;
|
|
736
|
+
// Swap queue with empty array - O(1) operation
|
|
737
|
+
// This avoids O(n²) complexity from using shift() in a loop
|
|
738
|
+
const operations = beginQueueRef.current;
|
|
739
|
+
beginQueueRef.current = [];
|
|
740
|
+
const pending = [];
|
|
741
|
+
const pendingKeys = beginPendingKeysRef.current;
|
|
742
|
+
// Process all operations - O(n) total
|
|
743
|
+
for (let i = 0; i < operations.length; i++) {
|
|
744
|
+
const position = operations[i];
|
|
745
|
+
if (!position) {
|
|
746
|
+
continue;
|
|
747
|
+
}
|
|
748
|
+
const key = makeKey(position);
|
|
749
|
+
if (pendingKeys.has(key)) {
|
|
750
|
+
pendingKeys.delete(key);
|
|
751
|
+
pending.push(position);
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
if (!pending.length)
|
|
755
|
+
return;
|
|
756
|
+
onBeginCalculationRef?.(pending);
|
|
757
|
+
}, [onBeginCalculationRef]);
|
|
758
|
+
const enqueueBeginPosition = useCallback((position) => {
|
|
759
|
+
const key = makeKey(position);
|
|
760
|
+
if (beginPendingKeysRef.current.has(key)) {
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
beginPendingKeysRef.current.add(key);
|
|
764
|
+
// Ignore other node types
|
|
765
|
+
if (position.conditionalFormatId || position.dataValidationId) {
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
beginQueueRef.current.push(position);
|
|
769
|
+
flushBeginNotifications();
|
|
770
|
+
}, [flushBeginNotifications]);
|
|
771
|
+
const preparePlanForExecution = useCallback((plan) => {
|
|
772
|
+
const cellNodes = plan.nodes.filter((node) => node.kind === "cell");
|
|
773
|
+
if (!cellNodes.length)
|
|
774
|
+
return;
|
|
775
|
+
// Cancel any inflight evaluations for nodes in this plan
|
|
776
|
+
const keysToCancel = [];
|
|
777
|
+
for (const node of cellNodes) {
|
|
778
|
+
const key = makeKey(node.position);
|
|
779
|
+
if (activeWorkerKeysRef.current.has(key)) {
|
|
780
|
+
keysToCancel.push(key);
|
|
781
|
+
activeWorkerKeysRef.current.delete(key);
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
if (keysToCancel.length) {
|
|
785
|
+
workerClient.cancel(keysToCancel);
|
|
786
|
+
}
|
|
787
|
+
const filteredNodes = [];
|
|
788
|
+
for (const node of cellNodes) {
|
|
789
|
+
const key = makeKey(node.position);
|
|
790
|
+
if (onDemandPattern) {
|
|
791
|
+
onDemandPattern.lastIndex = 0;
|
|
792
|
+
}
|
|
793
|
+
const userValue = getFinalUserEnteredValue(node.position);
|
|
794
|
+
if (typeof userValue === "string" &&
|
|
795
|
+
userValue.startsWith("=") &&
|
|
796
|
+
onDemandPattern?.test(userValue) &&
|
|
797
|
+
!workerForceRecalcKeysRef.current.has(key)) {
|
|
798
|
+
// On-demand formulas opt-out of real execution until explicitly
|
|
799
|
+
// forced; they still emit begin/end notifications so the UI shows a
|
|
800
|
+
// deterministic "Awaiting calculation" placeholder.
|
|
801
|
+
beginPendingKeysRef.current.delete(key);
|
|
802
|
+
queueCellValue(node.position, AWAITING_CALCULATION);
|
|
803
|
+
continue;
|
|
804
|
+
}
|
|
805
|
+
filteredNodes.push(node);
|
|
806
|
+
}
|
|
807
|
+
if (filteredNodes.length !== cellNodes.length) {
|
|
808
|
+
const staticNodes = plan.nodes.filter((node) => node.kind === "static");
|
|
809
|
+
plan.nodes = [...staticNodes, ...filteredNodes];
|
|
810
|
+
}
|
|
811
|
+
for (const node of filteredNodes) {
|
|
812
|
+
activeWorkerKeysRef.current.add(makeKey(node.position));
|
|
813
|
+
}
|
|
814
|
+
emitStats();
|
|
815
|
+
}, [
|
|
816
|
+
getFinalUserEnteredValue,
|
|
817
|
+
emitStats,
|
|
818
|
+
workerClient,
|
|
819
|
+
onDemandPattern,
|
|
820
|
+
queueCellValue,
|
|
821
|
+
]);
|
|
822
|
+
const handleNodeBegin = useCallback((node) => {
|
|
823
|
+
// Track inflight keys so late worker responses can be ignored/cancelled.
|
|
824
|
+
activeWorkerKeysRef.current.add(makeKey(node.position));
|
|
825
|
+
if (node.kind === "cell") {
|
|
826
|
+
enqueueBeginPosition(node.position);
|
|
827
|
+
}
|
|
828
|
+
}, [enqueueBeginPosition]);
|
|
829
|
+
const normalizePropertyOverride = useCallback((value, property) => {
|
|
830
|
+
// Property accessors piggyback on the sheet-side structured resolver so
|
|
831
|
+
// worker scopes respect table/object semantics already in place.
|
|
832
|
+
if (value == null || typeof value !== "object" || Array.isArray(value)) {
|
|
833
|
+
return value;
|
|
834
|
+
}
|
|
835
|
+
if (!getEffectiveStructuredValueRef) {
|
|
836
|
+
return undefined;
|
|
837
|
+
}
|
|
838
|
+
return getEffectiveStructuredValueRef(value, property);
|
|
839
|
+
}, [getEffectiveStructuredValueRef]);
|
|
840
|
+
const detectArrayCollision = useCallback((range, anchor, preserve) => {
|
|
841
|
+
// Spills cannot overwrite typed-in values or another array range.
|
|
842
|
+
const anchorKey = makeKey(anchor);
|
|
843
|
+
let conflict;
|
|
844
|
+
forEachCellInRange(range, (cell) => {
|
|
845
|
+
const key = makeKey(cell);
|
|
846
|
+
if (key === anchorKey || preserve?.has(key)) {
|
|
847
|
+
return;
|
|
848
|
+
}
|
|
849
|
+
const userValue = getFinalUserEnteredValue(cell);
|
|
850
|
+
if (userValue != null) {
|
|
851
|
+
conflict = cell;
|
|
852
|
+
return true;
|
|
853
|
+
}
|
|
854
|
+
const parent = graph.getArrayParent(cell);
|
|
855
|
+
if (parent && isEqualPosition(parent, anchor)) {
|
|
856
|
+
return;
|
|
857
|
+
}
|
|
858
|
+
if (parent) {
|
|
859
|
+
conflict = cell;
|
|
860
|
+
return true;
|
|
861
|
+
}
|
|
862
|
+
return;
|
|
863
|
+
});
|
|
864
|
+
return conflict;
|
|
865
|
+
}, [getFinalUserEnteredValue, graph]);
|
|
866
|
+
const pendingSpillDependentAnchorsRef = useRef(new Set());
|
|
867
|
+
const collisionAnchorsRef = useRef(new Set());
|
|
868
|
+
const scheduleSpillDependents = useCallback((range, anchor) => {
|
|
869
|
+
// Any dependent referencing a previously spilled cell must be dirtied so
|
|
870
|
+
// it recomputes with the anchor's new footprint.
|
|
871
|
+
if (!enqueuePendingOperationRef.current)
|
|
872
|
+
return;
|
|
873
|
+
const scheduled = new Set();
|
|
874
|
+
forEachCellInRange(range, (cell) => {
|
|
875
|
+
if (isEqualPosition(cell, anchor)) {
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
const dependents = graph.getDependents(cell);
|
|
879
|
+
for (const dependent of dependents) {
|
|
880
|
+
if (!isCellNode(dependent) || !dependent.position) {
|
|
881
|
+
continue;
|
|
882
|
+
}
|
|
883
|
+
if (isEqualPosition(dependent.position, anchor)) {
|
|
884
|
+
continue;
|
|
885
|
+
}
|
|
886
|
+
const dependentKey = makeKey(dependent.position);
|
|
887
|
+
if (scheduled.has(dependentKey))
|
|
888
|
+
continue;
|
|
889
|
+
scheduled.add(dependentKey);
|
|
890
|
+
enqueuePendingOperationRef.current?.({
|
|
891
|
+
type: "dirty",
|
|
892
|
+
position: dependent.position,
|
|
893
|
+
force: true,
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
});
|
|
897
|
+
}, [graph]);
|
|
898
|
+
const clearArrayValues = useCallback((anchor, options = {}) => {
|
|
899
|
+
// Helper for resetting existing spill results before writing new matrix
|
|
900
|
+
// values, with knobs for preserving user edits/registration metadata.
|
|
901
|
+
const anchorKey = makeKey(anchor);
|
|
902
|
+
const cachedEntry = arrayRangeCacheRef.current.get(anchorKey);
|
|
903
|
+
const range = graph.getArrayRangeFor(anchor) ?? cachedEntry?.range;
|
|
904
|
+
if (range) {
|
|
905
|
+
const preserve = new Set(options.preserveKeys);
|
|
906
|
+
if (options.preserveUserEntries) {
|
|
907
|
+
forEachCellInRange(range, (cell) => {
|
|
908
|
+
if (isEqualPosition(cell, anchor)) {
|
|
909
|
+
return;
|
|
910
|
+
}
|
|
911
|
+
const userValue = getFinalUserEnteredValue(cell);
|
|
912
|
+
if (userValue != null &&
|
|
913
|
+
(typeof userValue !== "string" || !userValue.startsWith("="))) {
|
|
914
|
+
preserve.add(makeKey(cell));
|
|
915
|
+
}
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
forEachCellInRange(range, (cell) => {
|
|
919
|
+
const key = makeKey(cell);
|
|
920
|
+
if ((!options.includeAnchor && key === anchorKey) ||
|
|
921
|
+
preserve.has(key)) {
|
|
922
|
+
return;
|
|
923
|
+
}
|
|
924
|
+
if (options.preserveComputedValues && key !== anchorKey) {
|
|
925
|
+
return;
|
|
926
|
+
}
|
|
927
|
+
queueCellValue(cell, undefined);
|
|
928
|
+
});
|
|
929
|
+
if (options.notifyDependents) {
|
|
930
|
+
scheduleSpillDependents(range, anchor);
|
|
931
|
+
}
|
|
932
|
+
else if (options.deferDependents) {
|
|
933
|
+
pendingSpillDependentAnchorsRef.current.add(anchorKey);
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
if (!options.preserveRegistration) {
|
|
937
|
+
graph.unregisterArrayFormula(anchor);
|
|
938
|
+
}
|
|
939
|
+
if (options.forgetRange) {
|
|
940
|
+
arrayRangeCacheRef.current.delete(anchorKey);
|
|
941
|
+
}
|
|
942
|
+
else if (range) {
|
|
943
|
+
arrayRangeCacheRef.current.set(anchorKey, {
|
|
944
|
+
anchor,
|
|
945
|
+
range,
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
}, [graph, queueCellValue, scheduleSpillDependents, getFinalUserEnteredValue]);
|
|
949
|
+
const handleArrayEvaluation = useCallback((position, rawValue) => {
|
|
950
|
+
// Array formulas emit either matrices or scalars; normalize + register
|
|
951
|
+
// spill metadata before writing values back to cells.
|
|
952
|
+
const matrix = normalizeArrayResult(rawValue);
|
|
953
|
+
if (!matrix) {
|
|
954
|
+
clearArrayValues(position, { preserveUserEntries: true });
|
|
955
|
+
queueCellValue(position, deserializeResultValue(rawValue));
|
|
956
|
+
markAnchorProcessed(position);
|
|
957
|
+
return;
|
|
958
|
+
}
|
|
959
|
+
clearArrayValues(position, {
|
|
960
|
+
preserveUserEntries: true,
|
|
961
|
+
preserveComputedValues: true,
|
|
962
|
+
deferDependents: true,
|
|
963
|
+
});
|
|
964
|
+
const range = createRangeFromMatrix(position, matrix);
|
|
965
|
+
const collision = detectArrayCollision(range, position);
|
|
966
|
+
graph.registerArrayFormula(position, range);
|
|
967
|
+
arrayRangeCacheRef.current.set(makeKey(position), {
|
|
968
|
+
anchor: position,
|
|
969
|
+
range,
|
|
970
|
+
});
|
|
971
|
+
const anchorFormula = getFinalUserEnteredValue(position);
|
|
972
|
+
const filterSourceRange = parseFilterSourceRange(typeof anchorFormula === "string" ? anchorFormula : undefined, position.sheetId, getSheetIdRef, formulaTokenizer);
|
|
973
|
+
const sourceSheetCell = new SheetCell();
|
|
974
|
+
const filterColumnFormattingCache = new Map();
|
|
975
|
+
const getFilterFormatting = (columnOffset, rowOffset) => {
|
|
976
|
+
if (!filterSourceRange) {
|
|
977
|
+
return undefined;
|
|
978
|
+
}
|
|
979
|
+
const sourceColumnIndex = filterSourceRange.startColumnIndex + columnOffset;
|
|
980
|
+
if (sourceColumnIndex < filterSourceRange.startColumnIndex ||
|
|
981
|
+
sourceColumnIndex > filterSourceRange.endColumnIndex) {
|
|
982
|
+
return undefined;
|
|
983
|
+
}
|
|
984
|
+
const cachedFormatting = filterColumnFormattingCache.get(sourceColumnIndex);
|
|
985
|
+
if (cachedFormatting) {
|
|
986
|
+
return cachedFormatting;
|
|
987
|
+
}
|
|
988
|
+
const preferredSourceRowIndex = filterSourceRange.startRowIndex + rowOffset;
|
|
989
|
+
const getSourceNumberFormat = (sourceRowIndex) => {
|
|
990
|
+
const sourceCellData = getCellData(filterSourceRange.sheetId, sourceRowIndex, sourceColumnIndex);
|
|
991
|
+
return sourceSheetCell
|
|
992
|
+
.assign(filterSourceRange.sheetId, {
|
|
993
|
+
rowIndex: sourceRowIndex,
|
|
994
|
+
columnIndex: sourceColumnIndex,
|
|
995
|
+
}, sourceCellData, { locale })
|
|
996
|
+
.getEffectiveCellFormat()?.numberFormat;
|
|
997
|
+
};
|
|
998
|
+
if (preferredSourceRowIndex >= filterSourceRange.startRowIndex &&
|
|
999
|
+
preferredSourceRowIndex <= filterSourceRange.endRowIndex) {
|
|
1000
|
+
const preferredNumberFormat = getSourceNumberFormat(preferredSourceRowIndex);
|
|
1001
|
+
if (preferredNumberFormat) {
|
|
1002
|
+
const formatting = { numberFormat: preferredNumberFormat };
|
|
1003
|
+
filterColumnFormattingCache.set(sourceColumnIndex, formatting);
|
|
1004
|
+
return formatting;
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
for (let sourceRowIndex = filterSourceRange.startRowIndex; sourceRowIndex <= filterSourceRange.endRowIndex; sourceRowIndex += 1) {
|
|
1008
|
+
const sourceNumberFormat = getSourceNumberFormat(sourceRowIndex);
|
|
1009
|
+
if (sourceNumberFormat) {
|
|
1010
|
+
const formatting = { numberFormat: sourceNumberFormat };
|
|
1011
|
+
filterColumnFormattingCache.set(sourceColumnIndex, formatting);
|
|
1012
|
+
return formatting;
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
filterColumnFormattingCache.set(sourceColumnIndex, undefined);
|
|
1016
|
+
return undefined;
|
|
1017
|
+
};
|
|
1018
|
+
if (collision) {
|
|
1019
|
+
const preserve = new Set([makeKey(collision)]);
|
|
1020
|
+
clearArrayValues(position, {
|
|
1021
|
+
preserveKeys: preserve,
|
|
1022
|
+
preserveUserEntries: true,
|
|
1023
|
+
includeAnchor: false,
|
|
1024
|
+
preserveRegistration: true,
|
|
1025
|
+
});
|
|
1026
|
+
let conflictingValue = getFinalUserEnteredValue(collision);
|
|
1027
|
+
const collisionKey = makeKey(collision);
|
|
1028
|
+
let usedPendingUserEdit = false;
|
|
1029
|
+
if (conflictingValue === undefined) {
|
|
1030
|
+
const pendingValue = pendingUserValueEditsRef.current.get(collisionKey);
|
|
1031
|
+
if (pendingValue !== undefined) {
|
|
1032
|
+
conflictingValue = pendingValue;
|
|
1033
|
+
usedPendingUserEdit = true;
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
if (conflictingValue === undefined &&
|
|
1037
|
+
computedValuesRef.current.has(collisionKey)) {
|
|
1038
|
+
conflictingValue = computedValuesRef.current.get(collisionKey);
|
|
1039
|
+
}
|
|
1040
|
+
if (conflictingValue === undefined) {
|
|
1041
|
+
const effective = getEffectiveValueRef(collision.sheetId, collision.rowIndex, collision.columnIndex);
|
|
1042
|
+
if (effective != null) {
|
|
1043
|
+
conflictingValue = effective;
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
if (conflictingValue !== undefined) {
|
|
1047
|
+
queueCellValue(collision, conflictingValue);
|
|
1048
|
+
flushResults();
|
|
1049
|
+
if (usedPendingUserEdit) {
|
|
1050
|
+
pendingUserValueEditsRef.current.delete(collisionKey);
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
queueCellValue(position, generateCollisionError(collision));
|
|
1054
|
+
scheduleSpillDependents(range, position);
|
|
1055
|
+
collisionAnchorsRef.current.add(makeKey(position));
|
|
1056
|
+
pendingSpillDependentAnchorsRef.current.delete(makeKey(position));
|
|
1057
|
+
markAnchorProcessed(position);
|
|
1058
|
+
return;
|
|
1059
|
+
}
|
|
1060
|
+
forEachCellInRange(range, (cell, offsets) => {
|
|
1061
|
+
const value = matrix[offsets.row]?.[offsets.column];
|
|
1062
|
+
queueCellValue(cell, value ?? undefined, getFilterFormatting(offsets.column, offsets.row));
|
|
1063
|
+
});
|
|
1064
|
+
pendingSpillDependentAnchorsRef.current.delete(makeKey(position));
|
|
1065
|
+
scheduleSpillDependents(range, position);
|
|
1066
|
+
collisionAnchorsRef.current.delete(makeKey(position));
|
|
1067
|
+
markAnchorProcessed(position);
|
|
1068
|
+
}, [
|
|
1069
|
+
flushResults,
|
|
1070
|
+
clearArrayValues,
|
|
1071
|
+
detectArrayCollision,
|
|
1072
|
+
graph,
|
|
1073
|
+
queueCellValue,
|
|
1074
|
+
deserializeResultValue,
|
|
1075
|
+
scheduleSpillDependents,
|
|
1076
|
+
getFinalUserEnteredValue,
|
|
1077
|
+
getCellData,
|
|
1078
|
+
getEffectiveValueRef,
|
|
1079
|
+
getSheetIdRef,
|
|
1080
|
+
markAnchorProcessed,
|
|
1081
|
+
locale,
|
|
1082
|
+
]);
|
|
1083
|
+
const resolveFormulaForOperation = useCallback((operation) => {
|
|
1084
|
+
const userValue = getFinalUserEnteredValue(operation.position);
|
|
1085
|
+
return typeof userValue === "string" ? userValue : undefined;
|
|
1086
|
+
}, [getFinalUserEnteredValue]);
|
|
1087
|
+
const flushGraphOperations = useCallback(() => {
|
|
1088
|
+
// Some graph operations (like static reference tweaks) are buffered so we
|
|
1089
|
+
// can batch DAG mutations alongside user edits.
|
|
1090
|
+
graphOperationFrameRef.current = null;
|
|
1091
|
+
if (!graphOperationQueueRef.current.length)
|
|
1092
|
+
return;
|
|
1093
|
+
const operations = graphOperationQueueRef.current;
|
|
1094
|
+
graphOperationQueueRef.current = [];
|
|
1095
|
+
const graphOperations = operations
|
|
1096
|
+
.map((operation) => mapOperationToGraphOperation(operation, resolveFormulaForOperation))
|
|
1097
|
+
.filter((op) => Boolean(op));
|
|
1098
|
+
if (!graphOperations.length)
|
|
1099
|
+
return;
|
|
1100
|
+
graph.applyGraphOperations(graphOperations);
|
|
1101
|
+
}, [graph, resolveFormulaForOperation]);
|
|
1102
|
+
const onAfterCalculation = useCallback(() => {
|
|
1103
|
+
// Once every batch completes we either cleanup immediately or defer if more
|
|
1104
|
+
// dirty anchors/operations are queued, preventing premature cache resets.
|
|
1105
|
+
if (pendingOperationQueueRef.current.length ||
|
|
1106
|
+
pendingArrayDirtyAnchorsRef.current.size) {
|
|
1107
|
+
graph.cleanup();
|
|
1108
|
+
workerForceRecalcKeysRef.current.clear();
|
|
1109
|
+
return;
|
|
1110
|
+
}
|
|
1111
|
+
computedValuesRef.current.clear();
|
|
1112
|
+
graph.cleanup();
|
|
1113
|
+
workerForceRecalcKeysRef.current.clear();
|
|
1114
|
+
}, [graph]);
|
|
1115
|
+
const scheduleProcessingRef = useRef(() => { });
|
|
1116
|
+
const handleResult = useCallback((result, batchId) => {
|
|
1117
|
+
// Record the first payload for perf metrics before we mutate caches.
|
|
1118
|
+
if (batchId && !batchesWithFirstResultLoggedRef.current.has(batchId)) {
|
|
1119
|
+
batchesWithFirstResultLoggedRef.current.add(batchId);
|
|
1120
|
+
emitBatchPhaseEvent("first-result", { batchId });
|
|
1121
|
+
}
|
|
1122
|
+
let shouldEmitStats = false;
|
|
1123
|
+
if (result.key && activeWorkerKeysRef.current.has(result.key)) {
|
|
1124
|
+
activeWorkerKeysRef.current.delete(result.key);
|
|
1125
|
+
shouldEmitStats = true;
|
|
1126
|
+
}
|
|
1127
|
+
if (result.staticReferenceId) {
|
|
1128
|
+
const node = graph.getNodes().get(result.staticReferenceId);
|
|
1129
|
+
if (isStaticNode(node)) {
|
|
1130
|
+
queueStaticNotification(node);
|
|
1131
|
+
}
|
|
1132
|
+
if (shouldEmitStats) {
|
|
1133
|
+
emitStats();
|
|
1134
|
+
}
|
|
1135
|
+
return;
|
|
1136
|
+
}
|
|
1137
|
+
if (!result.position) {
|
|
1138
|
+
if (shouldEmitStats) {
|
|
1139
|
+
emitStats();
|
|
1140
|
+
}
|
|
1141
|
+
return;
|
|
1142
|
+
}
|
|
1143
|
+
completedCountRef.current += 1;
|
|
1144
|
+
shouldEmitStats = true;
|
|
1145
|
+
const enrichedPosition = result.position;
|
|
1146
|
+
if (Array.isArray(result.value)) {
|
|
1147
|
+
// Spilled arrays require special handling: persist matrix values and
|
|
1148
|
+
// dirty downstream dependents tied to the old spill footprint.
|
|
1149
|
+
handleArrayEvaluation(enrichedPosition, result.value);
|
|
1150
|
+
emitStats();
|
|
1151
|
+
return;
|
|
1152
|
+
}
|
|
1153
|
+
clearArrayValues(enrichedPosition, {
|
|
1154
|
+
notifyDependents: true,
|
|
1155
|
+
forgetRange: true,
|
|
1156
|
+
});
|
|
1157
|
+
queueCellValue(enrichedPosition, deserializeResultValue(result.value));
|
|
1158
|
+
markAnchorProcessed(enrichedPosition);
|
|
1159
|
+
if (shouldEmitStats) {
|
|
1160
|
+
emitStats();
|
|
1161
|
+
}
|
|
1162
|
+
}, [
|
|
1163
|
+
clearArrayValues,
|
|
1164
|
+
deserializeResultValue,
|
|
1165
|
+
graph,
|
|
1166
|
+
handleArrayEvaluation,
|
|
1167
|
+
queueCellValue,
|
|
1168
|
+
queueStaticNotification,
|
|
1169
|
+
emitBatchPhaseEvent,
|
|
1170
|
+
markAnchorProcessed,
|
|
1171
|
+
emitStats,
|
|
1172
|
+
]);
|
|
1173
|
+
const processOperations = useCallback(async () => {
|
|
1174
|
+
// This is the main scheduler loop: drain the pending queue, build plans,
|
|
1175
|
+
// and stream results back while accounting for volatile + array mechanics.
|
|
1176
|
+
if (processingRef.current)
|
|
1177
|
+
return;
|
|
1178
|
+
processingRef.current = true;
|
|
1179
|
+
try {
|
|
1180
|
+
flushVolatileTracking();
|
|
1181
|
+
const hasValueAffectingNonVolatileOps = pendingOperationQueueRef.current.some((key) => !volatileCellsRef.current.has(key));
|
|
1182
|
+
if (hasValueAffectingNonVolatileOps) {
|
|
1183
|
+
enqueueVolatileCells();
|
|
1184
|
+
}
|
|
1185
|
+
while (pendingOperationQueueRef.current.length) {
|
|
1186
|
+
const keys = pendingOperationQueueRef.current.splice(0);
|
|
1187
|
+
const operations = [];
|
|
1188
|
+
for (const key of keys) {
|
|
1189
|
+
const operation = pendingOperationMapRef.current.get(key);
|
|
1190
|
+
if (operation) {
|
|
1191
|
+
operations.push(operation);
|
|
1192
|
+
pendingOperationMapRef.current.delete(key);
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
emitStats();
|
|
1196
|
+
if (!operations.length) {
|
|
1197
|
+
continue;
|
|
1198
|
+
}
|
|
1199
|
+
operations.sort((a, b) => {
|
|
1200
|
+
const order = (type) => {
|
|
1201
|
+
if (type === "remove")
|
|
1202
|
+
return 0;
|
|
1203
|
+
if (type === "add")
|
|
1204
|
+
return 1;
|
|
1205
|
+
return 2;
|
|
1206
|
+
};
|
|
1207
|
+
return order(a.type) - order(b.type);
|
|
1208
|
+
});
|
|
1209
|
+
const evaluationOperations = operations;
|
|
1210
|
+
if (!evaluationOperations.length) {
|
|
1211
|
+
continue;
|
|
1212
|
+
}
|
|
1213
|
+
activeExecutionsRef.current++;
|
|
1214
|
+
let currentBatchId = null;
|
|
1215
|
+
const enqueueStartTime = getTimestamp();
|
|
1216
|
+
const forcedPositions = evaluationOperations
|
|
1217
|
+
.filter((operation) => "position" in operation &&
|
|
1218
|
+
Boolean(operation.force) &&
|
|
1219
|
+
isCellCoordinate(operation.position))
|
|
1220
|
+
.map((operation) => operation.position);
|
|
1221
|
+
const onPlanBuiltWrapper = (plan) => {
|
|
1222
|
+
currentBatchId = plan.id;
|
|
1223
|
+
handlePlanBuilt(plan, enqueueStartTime);
|
|
1224
|
+
};
|
|
1225
|
+
const onWorkerBatchWrapper = (event) => {
|
|
1226
|
+
if (currentBatchId) {
|
|
1227
|
+
handleWorkerBatchEvent(event, currentBatchId);
|
|
1228
|
+
}
|
|
1229
|
+
};
|
|
1230
|
+
const onResultWrapper = (result) => {
|
|
1231
|
+
handleResult(result, currentBatchId ?? undefined);
|
|
1232
|
+
};
|
|
1233
|
+
const enqueuePromise = enqueueCalculationOperations({
|
|
1234
|
+
graph,
|
|
1235
|
+
workerClient,
|
|
1236
|
+
operations: evaluationOperations,
|
|
1237
|
+
resolveFormula: resolveFormulaForOperation,
|
|
1238
|
+
onResult: onResultWrapper,
|
|
1239
|
+
onPlan: preparePlanForExecution,
|
|
1240
|
+
onPlanBuilt: onPlanBuiltWrapper,
|
|
1241
|
+
onWorkerBatch: onWorkerBatchWrapper,
|
|
1242
|
+
onNodeBegin: handleNodeBegin,
|
|
1243
|
+
normalizePropertyOverride,
|
|
1244
|
+
planOptions: enableLazyCalculation && typeof activeSheetId === "number"
|
|
1245
|
+
? {
|
|
1246
|
+
rootSheetId: activeSheetId,
|
|
1247
|
+
onDeferredNodes: deferCalculationNodes,
|
|
1248
|
+
includePositions: forcedPositions.length
|
|
1249
|
+
? forcedPositions
|
|
1250
|
+
: undefined,
|
|
1251
|
+
}
|
|
1252
|
+
: undefined,
|
|
1253
|
+
});
|
|
1254
|
+
// Fire and forget (tracked by activeExecutionsRef)
|
|
1255
|
+
enqueuePromise
|
|
1256
|
+
.then(() => {
|
|
1257
|
+
if (currentBatchId) {
|
|
1258
|
+
emitBatchPhaseEvent("worker-complete", {
|
|
1259
|
+
batchId: currentBatchId,
|
|
1260
|
+
});
|
|
1261
|
+
emitBatchPhaseEvent("complete", { batchId: currentBatchId });
|
|
1262
|
+
}
|
|
1263
|
+
})
|
|
1264
|
+
.catch((error) => {
|
|
1265
|
+
console.error("Calculation error: ", error);
|
|
1266
|
+
})
|
|
1267
|
+
.finally(() => {
|
|
1268
|
+
activeExecutionsRef.current--;
|
|
1269
|
+
if (activeExecutionsRef.current === 0) {
|
|
1270
|
+
onAfterCalculation();
|
|
1271
|
+
pendingArrayDirtyAnchorsRef.current.clear();
|
|
1272
|
+
activeWorkerKeysRef.current.clear();
|
|
1273
|
+
emitStats();
|
|
1274
|
+
}
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
finally {
|
|
1279
|
+
processingRef.current = false;
|
|
1280
|
+
if (pendingOperationQueueRef.current.length) {
|
|
1281
|
+
scheduleProcessingRef.current();
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
}, [
|
|
1285
|
+
activeSheetId,
|
|
1286
|
+
enableLazyCalculation,
|
|
1287
|
+
graph,
|
|
1288
|
+
workerClient,
|
|
1289
|
+
resolveFormulaForOperation,
|
|
1290
|
+
handleResult,
|
|
1291
|
+
preparePlanForExecution,
|
|
1292
|
+
handlePlanBuilt,
|
|
1293
|
+
handleWorkerBatchEvent,
|
|
1294
|
+
emitBatchPhaseEvent,
|
|
1295
|
+
emitStats,
|
|
1296
|
+
handleNodeBegin,
|
|
1297
|
+
normalizePropertyOverride,
|
|
1298
|
+
deferCalculationNodes,
|
|
1299
|
+
flushVolatileTracking,
|
|
1300
|
+
enqueueVolatileCells,
|
|
1301
|
+
onAfterCalculation,
|
|
1302
|
+
]);
|
|
1303
|
+
const scheduleProcessing = useCallback(() => {
|
|
1304
|
+
if (!workerReadyRef.current) {
|
|
1305
|
+
return;
|
|
1306
|
+
}
|
|
1307
|
+
if (processFrameRef.current !== null) {
|
|
1308
|
+
return;
|
|
1309
|
+
}
|
|
1310
|
+
const schedule = (cb) => {
|
|
1311
|
+
if (coalesceDelayMs > 0) {
|
|
1312
|
+
return setTimeout(() => scheduleAfterPaint(cb), coalesceDelayMs);
|
|
1313
|
+
}
|
|
1314
|
+
scheduleAfterPaint(cb);
|
|
1315
|
+
return 0;
|
|
1316
|
+
};
|
|
1317
|
+
processFrameRef.current = schedule(() => {
|
|
1318
|
+
processFrameRef.current = null;
|
|
1319
|
+
processOperations();
|
|
1320
|
+
});
|
|
1321
|
+
}, [coalesceDelayMs, processOperations]);
|
|
1322
|
+
scheduleProcessingRef.current = scheduleProcessing;
|
|
1323
|
+
const enqueuePendingOperation = useCallback((operation) => {
|
|
1324
|
+
if (pushPendingOperation(operation)) {
|
|
1325
|
+
emitStats();
|
|
1326
|
+
scheduleProcessing();
|
|
1327
|
+
}
|
|
1328
|
+
}, [emitStats, pushPendingOperation, scheduleProcessing]);
|
|
1329
|
+
useEffect(() => {
|
|
1330
|
+
enqueuePendingOperationRef.current = enqueuePendingOperation;
|
|
1331
|
+
}, [enqueuePendingOperation]);
|
|
1332
|
+
// Deferred activesheetid callbacks
|
|
1333
|
+
useDeferredCalculationFlush({
|
|
1334
|
+
activeSheetId: enableLazyCalculation && typeof activeSheetId === "number"
|
|
1335
|
+
? activeSheetId
|
|
1336
|
+
: undefined,
|
|
1337
|
+
deferredOperationsBySheetRef,
|
|
1338
|
+
enqueueOperation: enqueuePendingOperation,
|
|
1339
|
+
onFlushComplete: emitStats,
|
|
1340
|
+
});
|
|
1341
|
+
// Initialize
|
|
1342
|
+
const workerInitSnapshotRef = useRef(undefined);
|
|
1343
|
+
useEffect(() => {
|
|
1344
|
+
if (!enabled || workerClient === workerClientStub) {
|
|
1345
|
+
return;
|
|
1346
|
+
}
|
|
1347
|
+
const nextSnapshot = { sheets, locale, tables, namedRanges };
|
|
1348
|
+
const prevSnapshot = workerInitSnapshotRef.current;
|
|
1349
|
+
if (prevSnapshot &&
|
|
1350
|
+
prevSnapshot.locale === nextSnapshot.locale &&
|
|
1351
|
+
prevSnapshot.tables === nextSnapshot.tables &&
|
|
1352
|
+
prevSnapshot.namedRanges === nextSnapshot.namedRanges &&
|
|
1353
|
+
prevSnapshot.sheets === nextSnapshot.sheets) {
|
|
1354
|
+
return;
|
|
1355
|
+
}
|
|
1356
|
+
workerInitSnapshotRef.current = nextSnapshot;
|
|
1357
|
+
let cancelled = false;
|
|
1358
|
+
workerReadyRef.current = false;
|
|
1359
|
+
(async () => {
|
|
1360
|
+
try {
|
|
1361
|
+
const initialization = workerErrorPromiseRef.current
|
|
1362
|
+
? Promise.race([
|
|
1363
|
+
workerClient.initialize(nextSnapshot),
|
|
1364
|
+
workerErrorPromiseRef.current,
|
|
1365
|
+
])
|
|
1366
|
+
: workerClient.initialize(nextSnapshot);
|
|
1367
|
+
await initialization;
|
|
1368
|
+
}
|
|
1369
|
+
catch (error) {
|
|
1370
|
+
console.error("Failed to initialize calculation worker", error);
|
|
1371
|
+
return;
|
|
1372
|
+
}
|
|
1373
|
+
if (cancelled) {
|
|
1374
|
+
return;
|
|
1375
|
+
}
|
|
1376
|
+
workerReadyRef.current = true;
|
|
1377
|
+
scheduleProcessing();
|
|
1378
|
+
})();
|
|
1379
|
+
return () => {
|
|
1380
|
+
cancelled = true;
|
|
1381
|
+
workerReadyRef.current = false;
|
|
1382
|
+
};
|
|
1383
|
+
}, [
|
|
1384
|
+
enabled,
|
|
1385
|
+
workerClient,
|
|
1386
|
+
workerClientStub,
|
|
1387
|
+
sheets,
|
|
1388
|
+
locale,
|
|
1389
|
+
tables,
|
|
1390
|
+
namedRanges,
|
|
1391
|
+
scheduleProcessing,
|
|
1392
|
+
]);
|
|
1393
|
+
useEffect(() => {
|
|
1394
|
+
if (workerClient === workerClientStub) {
|
|
1395
|
+
return;
|
|
1396
|
+
}
|
|
1397
|
+
return () => {
|
|
1398
|
+
workerErrorCleanupRef.current?.();
|
|
1399
|
+
workerClient.dispose();
|
|
1400
|
+
};
|
|
1401
|
+
}, [workerClient, workerClientStub]);
|
|
1402
|
+
useEffect(() => {
|
|
1403
|
+
return () => {
|
|
1404
|
+
if (resultFrameRef.current != null) {
|
|
1405
|
+
cancelAnimationFrame(resultFrameRef.current);
|
|
1406
|
+
}
|
|
1407
|
+
};
|
|
1408
|
+
}, []);
|
|
1409
|
+
const prepareArrayOperation = useCallback((operation) => {
|
|
1410
|
+
if (operation.type === "dirty") {
|
|
1411
|
+
return;
|
|
1412
|
+
}
|
|
1413
|
+
const anchor = graph.getArrayParent(operation.position) ??
|
|
1414
|
+
findCachedArrayAnchor(operation.position);
|
|
1415
|
+
if (!anchor) {
|
|
1416
|
+
return;
|
|
1417
|
+
}
|
|
1418
|
+
const anchorKey = makeKey(anchor);
|
|
1419
|
+
const clearedRange = operation.type === "remove" &&
|
|
1420
|
+
isEqualPosition(anchor, operation.position)
|
|
1421
|
+
? graph.getArrayRangeFor(anchor) ??
|
|
1422
|
+
arrayRangeCacheRef.current.get(anchorKey)?.range
|
|
1423
|
+
: undefined;
|
|
1424
|
+
const isAnchorTarget = isEqualPosition(anchor, operation.position);
|
|
1425
|
+
const preserve = new Set();
|
|
1426
|
+
if (!isAnchorTarget) {
|
|
1427
|
+
preserve.add(makeKey(operation.position));
|
|
1428
|
+
}
|
|
1429
|
+
const shouldNotifyDependents = !!isAnchorTarget;
|
|
1430
|
+
clearArrayValues(anchor, {
|
|
1431
|
+
preserveKeys: preserve,
|
|
1432
|
+
includeAnchor: operation.type === "remove" && isAnchorTarget,
|
|
1433
|
+
notifyDependents: shouldNotifyDependents,
|
|
1434
|
+
forgetRange: operation.type === "remove" && isAnchorTarget,
|
|
1435
|
+
preserveUserEntries: !isAnchorTarget,
|
|
1436
|
+
preserveComputedValues: !isAnchorTarget && operation.type !== "remove",
|
|
1437
|
+
deferDependents: !shouldNotifyDependents,
|
|
1438
|
+
preserveRegistration: !isAnchorTarget,
|
|
1439
|
+
});
|
|
1440
|
+
if (clearedRange) {
|
|
1441
|
+
for (const entry of arrayRangeCacheRef.current.values()) {
|
|
1442
|
+
if (!rangesOverlap(entry.range, clearedRange)) {
|
|
1443
|
+
continue;
|
|
1444
|
+
}
|
|
1445
|
+
const key = makeKey(entry.anchor);
|
|
1446
|
+
if (key === anchorKey) {
|
|
1447
|
+
continue;
|
|
1448
|
+
}
|
|
1449
|
+
collisionAnchorsRef.current.delete(key);
|
|
1450
|
+
queueAnchorDirty(entry.anchor);
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
}, [clearArrayValues, findCachedArrayAnchor, graph, queueAnchorDirty]);
|
|
1454
|
+
const enqueueCalculation = useCallbackRef((operation) => {
|
|
1455
|
+
if (operation.type !== "dirty") {
|
|
1456
|
+
const anchor = graph.getArrayParent(operation.position) ??
|
|
1457
|
+
findCachedArrayAnchor(operation.position);
|
|
1458
|
+
if (anchor) {
|
|
1459
|
+
collisionAnchorsRef.current.delete(makeKey(anchor));
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
scheduleVolatileTracking(operation.position);
|
|
1463
|
+
prepareArrayOperation(operation);
|
|
1464
|
+
enqueuePendingOperation(operation);
|
|
1465
|
+
});
|
|
1466
|
+
const enqueueGraphOperation = useCallbackRef((operation) => {
|
|
1467
|
+
graphOperationQueueRef.current.push(operation);
|
|
1468
|
+
if (graphOperationFrameRef.current == null) {
|
|
1469
|
+
graphOperationFrameRef.current =
|
|
1470
|
+
requestAnimationFrame(flushGraphOperations);
|
|
1471
|
+
}
|
|
1472
|
+
});
|
|
1473
|
+
const isArrayFormula = useCallbackRef((position) => {
|
|
1474
|
+
return graph.isArrayFormula(position) || graph.isInArrayRange(position);
|
|
1475
|
+
});
|
|
1476
|
+
const getPrecedents = useCallback((source, includeSource) => {
|
|
1477
|
+
return graph.getPrecedents(source).filter((node) => {
|
|
1478
|
+
if (isStaticNode(node))
|
|
1479
|
+
return true;
|
|
1480
|
+
if (!includeSource && isCellNode(node) && isCellCoordinate(source)) {
|
|
1481
|
+
return !isEqualPosition(node.position, source);
|
|
1482
|
+
}
|
|
1483
|
+
if (!includeSource &&
|
|
1484
|
+
isCellRangeNode(node) &&
|
|
1485
|
+
!isCellCoordinate(source)) {
|
|
1486
|
+
return !isAreasEqual(node.position, source);
|
|
1487
|
+
}
|
|
1488
|
+
return true;
|
|
1489
|
+
});
|
|
1490
|
+
}, [graph]);
|
|
1491
|
+
const getPrecedentsFromFormulaString = useCallback((value, source) => {
|
|
1492
|
+
const dependencies = graph.getDependenciesFromFormula(value, source);
|
|
1493
|
+
return dependencies.map((dependency) => {
|
|
1494
|
+
if (dependency.kind === "cell") {
|
|
1495
|
+
return new CellNode(makeKey(dependency.position), dependency.position);
|
|
1496
|
+
}
|
|
1497
|
+
return new CellRangeNode(makeKey(dependency.range), dependency.range);
|
|
1498
|
+
});
|
|
1499
|
+
}, [graph]);
|
|
1500
|
+
const getDependents = useCallback((source, includeSource) => {
|
|
1501
|
+
return graph.getDependents(source).filter((node) => {
|
|
1502
|
+
if (isStaticNode(node)) {
|
|
1503
|
+
return true;
|
|
1504
|
+
}
|
|
1505
|
+
if ((isCellNode(node) || isCellRangeNode(node)) &&
|
|
1506
|
+
node.position &&
|
|
1507
|
+
isCellCoordinate(node.position) &&
|
|
1508
|
+
isArrayFormula(node.position)) {
|
|
1509
|
+
return true;
|
|
1510
|
+
}
|
|
1511
|
+
if (includeSource &&
|
|
1512
|
+
isCellRangeNode(node) &&
|
|
1513
|
+
!isCellCoordinate(source)) {
|
|
1514
|
+
return !isAreasEqual(node.position, source);
|
|
1515
|
+
}
|
|
1516
|
+
if (!includeSource && isCellCoordinate(source) && isCellNode(node)) {
|
|
1517
|
+
const cellNode = node;
|
|
1518
|
+
return (cellNode.position.rowIndex !== source.rowIndex ||
|
|
1519
|
+
cellNode.position.columnIndex !== source.columnIndex);
|
|
1520
|
+
}
|
|
1521
|
+
return true;
|
|
1522
|
+
});
|
|
1523
|
+
}, [graph, isArrayFormula]);
|
|
1524
|
+
const deleteSheetReferences = useCallback((sheetId) => {
|
|
1525
|
+
graph.deleteSheetReferences(sheetId);
|
|
1526
|
+
}, [graph]);
|
|
1527
|
+
const onRequestCalculate = useCallback(async (value, sheetId, rowIndex, columnIndex, options) => {
|
|
1528
|
+
const disablePreview = options?.disablePreview ?? false;
|
|
1529
|
+
if (!enabled || workerClient === workerClientStub) {
|
|
1530
|
+
return undefined;
|
|
1531
|
+
}
|
|
1532
|
+
const skipOnDemand = options?.skipOnDemand ?? true;
|
|
1533
|
+
if (skipOnDemand && onDemandPattern) {
|
|
1534
|
+
onDemandPattern.lastIndex = 0;
|
|
1535
|
+
}
|
|
1536
|
+
if (skipOnDemand && isAFormula(value) && onDemandPattern?.test(value)) {
|
|
1537
|
+
return undefined;
|
|
1538
|
+
}
|
|
1539
|
+
if (!isAFormula(value)) {
|
|
1540
|
+
return null;
|
|
1541
|
+
}
|
|
1542
|
+
const formula = value.startsWith("=") ? value.slice(1) : value;
|
|
1543
|
+
if (!formula) {
|
|
1544
|
+
return null;
|
|
1545
|
+
}
|
|
1546
|
+
const position = { sheetId, rowIndex, columnIndex };
|
|
1547
|
+
const dependencies = graph.getDependenciesFromFormula(formula, position);
|
|
1548
|
+
if (iterativeCalculation?.enabled && !disablePreview) {
|
|
1549
|
+
const isCircular = dependencies.some((dependency) => {
|
|
1550
|
+
if (dependency.kind === "cell") {
|
|
1551
|
+
return (dependency.position.sheetId === sheetId &&
|
|
1552
|
+
dependency.position.rowIndex === rowIndex &&
|
|
1553
|
+
dependency.position.columnIndex === columnIndex);
|
|
1554
|
+
}
|
|
1555
|
+
const range = dependency.range;
|
|
1556
|
+
return (range.sheetId === sheetId &&
|
|
1557
|
+
rowIndex >= range.startRowIndex &&
|
|
1558
|
+
rowIndex <= range.endRowIndex &&
|
|
1559
|
+
columnIndex >= range.startColumnIndex &&
|
|
1560
|
+
columnIndex <= range.endColumnIndex);
|
|
1561
|
+
});
|
|
1562
|
+
if (isCircular) {
|
|
1563
|
+
return undefined;
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
const scope = graph.collectScope(dependencies);
|
|
1567
|
+
if (options?.overrides?.size) {
|
|
1568
|
+
for (const [key, value] of options.overrides) {
|
|
1569
|
+
scope[key] = value;
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
const plan = {
|
|
1573
|
+
id: `preview-${Date.now()}`,
|
|
1574
|
+
nodes: [
|
|
1575
|
+
{
|
|
1576
|
+
kind: "cell",
|
|
1577
|
+
key: `preview-node-${Date.now()}`,
|
|
1578
|
+
position,
|
|
1579
|
+
formula,
|
|
1580
|
+
precedents: dependencies,
|
|
1581
|
+
isPreview: !disablePreview,
|
|
1582
|
+
},
|
|
1583
|
+
],
|
|
1584
|
+
};
|
|
1585
|
+
const [result] = await workerClient.evaluate(plan, () => scope);
|
|
1586
|
+
const resultValue = deserializeResultValue(result.value);
|
|
1587
|
+
if (resultValue instanceof FormulaError) {
|
|
1588
|
+
return undefined;
|
|
1589
|
+
}
|
|
1590
|
+
return resultValue;
|
|
1591
|
+
}, [
|
|
1592
|
+
enabled,
|
|
1593
|
+
graph,
|
|
1594
|
+
workerClient,
|
|
1595
|
+
workerClientStub,
|
|
1596
|
+
deserializeResultValue,
|
|
1597
|
+
iterativeCalculation,
|
|
1598
|
+
]);
|
|
1599
|
+
const getGraphNodes = useCallback(() => {
|
|
1600
|
+
return graph.getNodes();
|
|
1601
|
+
}, [graph]);
|
|
1602
|
+
const getGraphNodesInSheet = useCallback((sheetId) => graph.getNodesInSheet(sheetId), [graph]);
|
|
1603
|
+
const addStaticReference = useCallback((source, sourcePosition) => {
|
|
1604
|
+
graph.applyOperations([
|
|
1605
|
+
{
|
|
1606
|
+
kind: "static:add",
|
|
1607
|
+
reference: source,
|
|
1608
|
+
range: toCellRange(sourcePosition),
|
|
1609
|
+
},
|
|
1610
|
+
]);
|
|
1611
|
+
}, [graph]);
|
|
1612
|
+
const addFormulaToGraph = useCallbackRef(useCallback((formulaValue, position) => {
|
|
1613
|
+
if (!formulaValue) {
|
|
1614
|
+
return;
|
|
1615
|
+
}
|
|
1616
|
+
const formula = formulaValue.startsWith("=")
|
|
1617
|
+
? formulaValue
|
|
1618
|
+
: `=${formulaValue}`;
|
|
1619
|
+
graph.applyOperations([{ kind: "upsert", position, formula }]);
|
|
1620
|
+
}, [graph]));
|
|
1621
|
+
const removeStaticReference = useCallback((source) => {
|
|
1622
|
+
graph.applyOperations([
|
|
1623
|
+
{
|
|
1624
|
+
kind: "static:remove",
|
|
1625
|
+
reference: source,
|
|
1626
|
+
},
|
|
1627
|
+
]);
|
|
1628
|
+
}, [graph]);
|
|
1629
|
+
const onResetCalculator = useCallbackRef(() => {
|
|
1630
|
+
isFullRecalcRef.current = true;
|
|
1631
|
+
graph.reset();
|
|
1632
|
+
computedValuesRef.current.clear();
|
|
1633
|
+
});
|
|
1634
|
+
const getDependencyGraph = useCallbackRef(() => graph.serialize());
|
|
1635
|
+
const updateDependencyGraph = useCallbackRef((nodes) => graph.hydrate(nodes));
|
|
1636
|
+
const enqueueStructureChange = useCallbackRef((_change) => { });
|
|
1637
|
+
const clearRangeCache = useCallbackRef(() => { });
|
|
1638
|
+
const noopCalculationApi = useMemo(() => ({
|
|
1639
|
+
enqueueCalculation: () => { },
|
|
1640
|
+
enqueueGraphOperation: () => { },
|
|
1641
|
+
getPrecedents: () => [],
|
|
1642
|
+
getPrecedentsFromFormulaString: () => [],
|
|
1643
|
+
getDependents: () => [],
|
|
1644
|
+
enqueueStructureChange: () => { },
|
|
1645
|
+
clearRangeCache: () => { },
|
|
1646
|
+
deleteSheetReferences: () => { },
|
|
1647
|
+
onRequestCalculate: async () => undefined,
|
|
1648
|
+
getGraphNodes: () => new Set(),
|
|
1649
|
+
getGraphNodesInSheet: () => undefined,
|
|
1650
|
+
addStaticReference: () => { },
|
|
1651
|
+
addFormulaToGraph: () => { },
|
|
1652
|
+
removeStaticReference: () => { },
|
|
1653
|
+
onResetCalculator: () => { },
|
|
1654
|
+
getDependencyGraph: () => "[]",
|
|
1655
|
+
updateDependencyGraph: () => { },
|
|
1656
|
+
isArrayFormula: () => false,
|
|
1657
|
+
applyNamedRanges: (_list) => { },
|
|
1658
|
+
stats$: statsSubjectRef.current.asObservable(),
|
|
1659
|
+
}), []);
|
|
1660
|
+
const api = {
|
|
1661
|
+
enqueueCalculation,
|
|
1662
|
+
enqueueGraphOperation,
|
|
1663
|
+
getPrecedents,
|
|
1664
|
+
getPrecedentsFromFormulaString,
|
|
1665
|
+
getDependents,
|
|
1666
|
+
enqueueStructureChange,
|
|
1667
|
+
clearRangeCache,
|
|
1668
|
+
deleteSheetReferences,
|
|
1669
|
+
onRequestCalculate,
|
|
1670
|
+
getGraphNodes,
|
|
1671
|
+
getGraphNodesInSheet,
|
|
1672
|
+
addStaticReference,
|
|
1673
|
+
addFormulaToGraph,
|
|
1674
|
+
removeStaticReference,
|
|
1675
|
+
onResetCalculator,
|
|
1676
|
+
getDependencyGraph,
|
|
1677
|
+
updateDependencyGraph,
|
|
1678
|
+
isArrayFormula,
|
|
1679
|
+
// Worker re-inits on namedRanges change (sent via WorkerInit
|
|
1680
|
+
// payload), so there's no host-side calculator to apply to.
|
|
1681
|
+
// No-op to satisfy the shared API contract.
|
|
1682
|
+
applyNamedRanges: (_list) => { },
|
|
1683
|
+
stats$: statsSubjectRef.current.asObservable(),
|
|
1684
|
+
};
|
|
1685
|
+
return (enabled
|
|
1686
|
+
? api
|
|
1687
|
+
: noopCalculationApi);
|
|
1688
|
+
};
|