@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,1552 @@
|
|
|
1
|
+
import { isStaticNode } from "@rowsncolumns/dag";
|
|
2
|
+
import { isCellCoordinate } from "@rowsncolumns/dag";
|
|
3
|
+
import { tokenVocabulary } from "@rowsncolumns/fast-formula-parser";
|
|
4
|
+
import { addressToCell, desanitizeSheetName, getDefaultDateFormat, getDefaultDateTimeFormat, getDefaultTimeFormat, isNil, } from "@rowsncolumns/utils";
|
|
5
|
+
import { defaultCellCoords, SheetCell } from "../sheet-cell";
|
|
6
|
+
import { changeDecimals, getCurrentDecimalCountInPattern, getDecimalPlaces, } from "./decimals";
|
|
7
|
+
export const createSheetDraft = (draft, sheetId, rowIndex) => {
|
|
8
|
+
// Get sheet reference once
|
|
9
|
+
let sheet = draft[sheetId];
|
|
10
|
+
if (!sheet) {
|
|
11
|
+
sheet = draft[sheetId] = [];
|
|
12
|
+
}
|
|
13
|
+
if (!isNil(rowIndex)) {
|
|
14
|
+
// Direct assignment, single proxy access
|
|
15
|
+
if (!sheet[rowIndex]?.values) {
|
|
16
|
+
sheet[rowIndex] = { values: [] };
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return sheet;
|
|
20
|
+
};
|
|
21
|
+
// Clone entire row
|
|
22
|
+
export const cloneRowWithFormatting = (rowData) => {
|
|
23
|
+
if (!rowData) {
|
|
24
|
+
return { values: [] };
|
|
25
|
+
}
|
|
26
|
+
const sheetCell = new SheetCell();
|
|
27
|
+
const values = rowData?.values?.map((cellData) => {
|
|
28
|
+
sheetCell.assign(1, defaultCellCoords, cellData);
|
|
29
|
+
return sheetCell.cloneWithFormatting().getCellData();
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
values,
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
// Clone cell
|
|
36
|
+
export const cloneCellWithFormatting = (celLData) => {
|
|
37
|
+
const sheetCell = new SheetCell(1, defaultCellCoords, celLData);
|
|
38
|
+
return sheetCell.cloneWithFormatting().getCellData();
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* "Generic" precedent types — these don't carry styling intent so a
|
|
42
|
+
* later, more specific format can override them. Used by the
|
|
43
|
+
* first-specific-wins merging rule in `processPrecedentCell`.
|
|
44
|
+
*/
|
|
45
|
+
const isGenericNumberFormatType = (type) => !type || type === "NUMBER" || type === "GENERAL";
|
|
46
|
+
/**
|
|
47
|
+
* Date-family types — when the derived (resolved) type is one of these
|
|
48
|
+
* and the precedent's type is also in this set, we preserve the
|
|
49
|
+
* precedent's exact custom pattern instead of synthesizing a locale
|
|
50
|
+
* default. Mirrors Excel's behaviour for date-arithmetic functions
|
|
51
|
+
* (EDATE, EOMONTH, …) where `=EDATE(A1, 1)` keeps A1's custom pattern.
|
|
52
|
+
*/
|
|
53
|
+
const isDateFamilyType = (type) => type === "DATE" || type === "TIME" || type === "DATE_TIME";
|
|
54
|
+
const customNumberFormatMap = {
|
|
55
|
+
COUNT: "NUMBER",
|
|
56
|
+
};
|
|
57
|
+
const formatDerivationRules = {
|
|
58
|
+
SUMIFS: { type: "fixed_index", index: 0 },
|
|
59
|
+
AVERAGEIFS: { type: "fixed_index", index: 0 },
|
|
60
|
+
MINIFS: { type: "fixed_index", index: 0 },
|
|
61
|
+
MAXIFS: { type: "fixed_index", index: 0 },
|
|
62
|
+
FILTER: { type: "fixed_index", index: 0 },
|
|
63
|
+
XLOOKUP: { type: "fixed_index", index: 2 },
|
|
64
|
+
INDEX: { type: "fixed_index", index: 0 },
|
|
65
|
+
SORT: { type: "fixed_index", index: 0 },
|
|
66
|
+
SORTBY: { type: "fixed_index", index: 0 },
|
|
67
|
+
UNIQUE: { type: "fixed_index", index: 0 },
|
|
68
|
+
TAKE: { type: "fixed_index", index: 0 },
|
|
69
|
+
DROP: { type: "fixed_index", index: 0 },
|
|
70
|
+
TOCOL: { type: "fixed_index", index: 0 },
|
|
71
|
+
TOROW: { type: "fixed_index", index: 0 },
|
|
72
|
+
WRAPROWS: { type: "fixed_index", index: 0 },
|
|
73
|
+
WRAPCOLS: { type: "fixed_index", index: 0 },
|
|
74
|
+
CHOOSECOLS: { type: "fixed_index", index: 0 },
|
|
75
|
+
CHOOSEROWS: { type: "fixed_index", index: 0 },
|
|
76
|
+
TRANSPOSE: { type: "fixed_index", index: 0 },
|
|
77
|
+
SUMIF: {
|
|
78
|
+
type: "conditional_index",
|
|
79
|
+
getIndex: (count) => (count >= 3 ? 2 : 0),
|
|
80
|
+
},
|
|
81
|
+
AVERAGEIF: {
|
|
82
|
+
type: "conditional_index",
|
|
83
|
+
getIndex: (count) => (count >= 3 ? 2 : 0),
|
|
84
|
+
},
|
|
85
|
+
VLOOKUP: { type: "vlookup", tableIndex: 1, colIndexArg: 2 },
|
|
86
|
+
HLOOKUP: { type: "hlookup", tableIndex: 1, rowIndexArg: 2 },
|
|
87
|
+
// Statistical functions that inherit format from their data array.
|
|
88
|
+
// Excel renders `MEDIAN(currency_range)` etc. with the data's
|
|
89
|
+
// format. All take the data array as the first arg.
|
|
90
|
+
MEDIAN: { type: "fixed_index", index: 0 },
|
|
91
|
+
MODE: { type: "fixed_index", index: 0 },
|
|
92
|
+
"MODE.SNGL": { type: "fixed_index", index: 0 },
|
|
93
|
+
"MODE.MULT": { type: "fixed_index", index: 0 },
|
|
94
|
+
PERCENTILE: { type: "fixed_index", index: 0 },
|
|
95
|
+
"PERCENTILE.INC": { type: "fixed_index", index: 0 },
|
|
96
|
+
"PERCENTILE.EXC": { type: "fixed_index", index: 0 },
|
|
97
|
+
QUARTILE: { type: "fixed_index", index: 0 },
|
|
98
|
+
"QUARTILE.INC": { type: "fixed_index", index: 0 },
|
|
99
|
+
"QUARTILE.EXC": { type: "fixed_index", index: 0 },
|
|
100
|
+
LARGE: { type: "fixed_index", index: 0 },
|
|
101
|
+
SMALL: { type: "fixed_index", index: 0 },
|
|
102
|
+
TRIMMEAN: { type: "fixed_index", index: 0 },
|
|
103
|
+
GEOMEAN: { type: "fixed_index", index: 0 },
|
|
104
|
+
HARMEAN: { type: "fixed_index", index: 0 },
|
|
105
|
+
AVERAGEA: { type: "fixed_index", index: 0 },
|
|
106
|
+
MINA: { type: "fixed_index", index: 0 },
|
|
107
|
+
MAXA: { type: "fixed_index", index: 0 },
|
|
108
|
+
// VAR and STDEV: Excel keeps the data format on display (units are a
|
|
109
|
+
// formatting concern, not a value-unit concern). VAR is technically
|
|
110
|
+
// squared, but spreadsheets don't track units — match Excel.
|
|
111
|
+
VAR: { type: "fixed_index", index: 0 },
|
|
112
|
+
"VAR.S": { type: "fixed_index", index: 0 },
|
|
113
|
+
"VAR.P": { type: "fixed_index", index: 0 },
|
|
114
|
+
VARA: { type: "fixed_index", index: 0 },
|
|
115
|
+
VARPA: { type: "fixed_index", index: 0 },
|
|
116
|
+
STDEV: { type: "fixed_index", index: 0 },
|
|
117
|
+
"STDEV.S": { type: "fixed_index", index: 0 },
|
|
118
|
+
"STDEV.P": { type: "fixed_index", index: 0 },
|
|
119
|
+
STDEVA: { type: "fixed_index", index: 0 },
|
|
120
|
+
STDEVPA: { type: "fixed_index", index: 0 },
|
|
121
|
+
// FORECAST(x, known_ys, known_xs) — inherits from y values (index 1).
|
|
122
|
+
FORECAST: { type: "fixed_index", index: 1 },
|
|
123
|
+
"FORECAST.LINEAR": { type: "fixed_index", index: 1 },
|
|
124
|
+
"FORECAST.ETS": { type: "fixed_index", index: 1 },
|
|
125
|
+
// Financial functions — inherit CURRENCY from the principal arg
|
|
126
|
+
// (matches Excel's behaviour where `=PMT(rate, n, pv)` on a currency
|
|
127
|
+
// principal renders as currency). Arg positions reference the
|
|
128
|
+
// standard Excel signatures.
|
|
129
|
+
PMT: { type: "fixed_index", index: 2 }, // PMT(rate, nper, pv, [fv], [type])
|
|
130
|
+
PV: { type: "fixed_index", index: 2 }, // PV(rate, nper, pmt, [fv], [type])
|
|
131
|
+
FV: { type: "fixed_index", index: 2 }, // FV(rate, nper, pmt, [pv], [type])
|
|
132
|
+
NPV: { type: "fixed_index", index: 1 }, // NPV(rate, value1, ...)
|
|
133
|
+
XNPV: { type: "fixed_index", index: 1 }, // XNPV(rate, values, dates)
|
|
134
|
+
IPMT: { type: "fixed_index", index: 3 }, // IPMT(rate, per, nper, pv, [fv], [type])
|
|
135
|
+
PPMT: { type: "fixed_index", index: 3 }, // PPMT(rate, per, nper, pv, [fv], [type])
|
|
136
|
+
CUMIPMT: { type: "fixed_index", index: 2 }, // CUMIPMT(rate, nper, pv, start, end, type)
|
|
137
|
+
CUMPRINC: { type: "fixed_index", index: 2 }, // CUMPRINC(rate, nper, pv, start, end, type)
|
|
138
|
+
DDB: { type: "fixed_index", index: 0 }, // DDB(cost, salvage, life, period, [factor])
|
|
139
|
+
SLN: { type: "fixed_index", index: 0 }, // SLN(cost, salvage, life)
|
|
140
|
+
SYD: { type: "fixed_index", index: 0 }, // SYD(cost, salvage, life, per)
|
|
141
|
+
DB: { type: "fixed_index", index: 0 }, // DB(cost, salvage, life, period, [month])
|
|
142
|
+
};
|
|
143
|
+
const functionReturnTypes = {
|
|
144
|
+
// ─── Date/time — extractors (return scalar numbers) ────────────────
|
|
145
|
+
MONTH: "NUMBER",
|
|
146
|
+
YEAR: "NUMBER",
|
|
147
|
+
DAY: "NUMBER",
|
|
148
|
+
DAYS: "NUMBER",
|
|
149
|
+
HOUR: "NUMBER",
|
|
150
|
+
MINUTE: "NUMBER",
|
|
151
|
+
SECOND: "NUMBER",
|
|
152
|
+
WEEKDAY: "NUMBER",
|
|
153
|
+
WEEKNUM: "NUMBER",
|
|
154
|
+
ISOWEEKNUM: "NUMBER",
|
|
155
|
+
YEARFRAC: "NUMBER",
|
|
156
|
+
DATEDIF: "NUMBER",
|
|
157
|
+
DATEVALUE: "NUMBER",
|
|
158
|
+
TIMEVALUE: "NUMBER",
|
|
159
|
+
NETWORKDAYS: "NUMBER",
|
|
160
|
+
"NETWORKDAYS.INTL": "NUMBER",
|
|
161
|
+
DAYS360: "NUMBER",
|
|
162
|
+
// ─── Date/time — date producers (must render as DATE/TIME/DATE_TIME) ─
|
|
163
|
+
NOW: "DATE_TIME",
|
|
164
|
+
TODAY: "DATE",
|
|
165
|
+
DATE: "DATE",
|
|
166
|
+
TIME: "TIME",
|
|
167
|
+
EDATE: "DATE",
|
|
168
|
+
EOMONTH: "DATE",
|
|
169
|
+
// WORKDAY returns a date serial number — must render as DATE, not
|
|
170
|
+
// raw NUMBER (was a bug: cells showed e.g. "45292" instead of the
|
|
171
|
+
// calendar date).
|
|
172
|
+
WORKDAY: "DATE",
|
|
173
|
+
"WORKDAY.INTL": "DATE",
|
|
174
|
+
// ─── Aggregation / rounding (return NUMBER; CURRENCY precedent
|
|
175
|
+
// preserved via the "expectedOutputType === NUMBER + numFormat
|
|
176
|
+
// CURRENCY → keep numFormat" branch) ──────────────────────────
|
|
177
|
+
SUM: "NUMBER",
|
|
178
|
+
SUMPRODUCT: "NUMBER",
|
|
179
|
+
SUMSQ: "NUMBER",
|
|
180
|
+
ROUND: "NUMBER",
|
|
181
|
+
ROUNDUP: "NUMBER",
|
|
182
|
+
ROUNDDOWN: "NUMBER",
|
|
183
|
+
TRUNC: "NUMBER",
|
|
184
|
+
QUOTIENT: "NUMBER",
|
|
185
|
+
CEILING: "NUMBER",
|
|
186
|
+
FLOOR: "NUMBER",
|
|
187
|
+
MROUND: "NUMBER",
|
|
188
|
+
INT: "NUMBER",
|
|
189
|
+
MOD: "NUMBER",
|
|
190
|
+
// ─── Math/trig (return scalar NUMBER) ──────────────────────────────
|
|
191
|
+
POWER: "NUMBER",
|
|
192
|
+
SQRT: "NUMBER",
|
|
193
|
+
EXP: "NUMBER",
|
|
194
|
+
LN: "NUMBER",
|
|
195
|
+
LOG: "NUMBER",
|
|
196
|
+
LOG10: "NUMBER",
|
|
197
|
+
SIGN: "NUMBER",
|
|
198
|
+
SIN: "NUMBER",
|
|
199
|
+
COS: "NUMBER",
|
|
200
|
+
TAN: "NUMBER",
|
|
201
|
+
ASIN: "NUMBER",
|
|
202
|
+
ACOS: "NUMBER",
|
|
203
|
+
ATAN: "NUMBER",
|
|
204
|
+
ATAN2: "NUMBER",
|
|
205
|
+
SINH: "NUMBER",
|
|
206
|
+
COSH: "NUMBER",
|
|
207
|
+
TANH: "NUMBER",
|
|
208
|
+
ASINH: "NUMBER",
|
|
209
|
+
ACOSH: "NUMBER",
|
|
210
|
+
ATANH: "NUMBER",
|
|
211
|
+
DEGREES: "NUMBER",
|
|
212
|
+
RADIANS: "NUMBER",
|
|
213
|
+
PI: "NUMBER",
|
|
214
|
+
FACT: "NUMBER",
|
|
215
|
+
FACTDOUBLE: "NUMBER",
|
|
216
|
+
COMBIN: "NUMBER",
|
|
217
|
+
COMBINA: "NUMBER",
|
|
218
|
+
PERMUT: "NUMBER",
|
|
219
|
+
PERMUTATIONA: "NUMBER",
|
|
220
|
+
GCD: "NUMBER",
|
|
221
|
+
LCM: "NUMBER",
|
|
222
|
+
// ─── Random/value conversion ───────────────────────────────────────
|
|
223
|
+
RAND: "NUMBER",
|
|
224
|
+
RANDBETWEEN: "NUMBER",
|
|
225
|
+
VALUE: "NUMBER",
|
|
226
|
+
N: "NUMBER",
|
|
227
|
+
// ─── Statistical — scalar results (NUMBER) ─────────────────────────
|
|
228
|
+
AVEDEV: "NUMBER",
|
|
229
|
+
DEVSQ: "NUMBER",
|
|
230
|
+
KURT: "NUMBER",
|
|
231
|
+
SKEW: "NUMBER",
|
|
232
|
+
"SKEW.P": "NUMBER",
|
|
233
|
+
COVAR: "NUMBER",
|
|
234
|
+
"COVARIANCE.S": "NUMBER",
|
|
235
|
+
"COVARIANCE.P": "NUMBER",
|
|
236
|
+
CORREL: "NUMBER",
|
|
237
|
+
RSQ: "NUMBER",
|
|
238
|
+
SLOPE: "NUMBER",
|
|
239
|
+
INTERCEPT: "NUMBER",
|
|
240
|
+
STEYX: "NUMBER",
|
|
241
|
+
PEARSON: "NUMBER",
|
|
242
|
+
// ─── Financial — rate/period scalars (NUMBER); CURRENCY-returning
|
|
243
|
+
// financial functions live in `formatDerivationRules` instead ──
|
|
244
|
+
XIRR: "NUMBER",
|
|
245
|
+
IRR: "NUMBER",
|
|
246
|
+
MIRR: "NUMBER",
|
|
247
|
+
RATE: "NUMBER",
|
|
248
|
+
NPER: "NUMBER",
|
|
249
|
+
EFFECT: "NUMBER",
|
|
250
|
+
NOMINAL: "NUMBER",
|
|
251
|
+
// ─── Counts & positions (COUNT, displays as NUMBER) ────────────────
|
|
252
|
+
MATCH: "COUNT",
|
|
253
|
+
XMATCH: "COUNT",
|
|
254
|
+
COUNT: "COUNT",
|
|
255
|
+
COUNTA: "COUNT",
|
|
256
|
+
COUNTBLANK: "COUNT",
|
|
257
|
+
COUNTIF: "COUNT",
|
|
258
|
+
COUNTIFS: "COUNT",
|
|
259
|
+
ROW: "COUNT",
|
|
260
|
+
ROWS: "COUNT",
|
|
261
|
+
COLUMN: "COUNT",
|
|
262
|
+
COLUMNS: "COUNT",
|
|
263
|
+
RANK: "COUNT",
|
|
264
|
+
"RANK.EQ": "COUNT",
|
|
265
|
+
"RANK.AVG": "COUNT",
|
|
266
|
+
FREQUENCY: "COUNT",
|
|
267
|
+
LEN: "COUNT",
|
|
268
|
+
SEARCH: "COUNT",
|
|
269
|
+
SEARCHB: "COUNT",
|
|
270
|
+
FIND: "COUNT",
|
|
271
|
+
FINDB: "COUNT",
|
|
272
|
+
// ─── Text producers ─────────────────────────────────────────────────
|
|
273
|
+
TEXT: "TEXT",
|
|
274
|
+
LEFT: "TEXT",
|
|
275
|
+
LEFTB: "TEXT",
|
|
276
|
+
RIGHT: "TEXT",
|
|
277
|
+
RIGHTB: "TEXT",
|
|
278
|
+
MID: "TEXT",
|
|
279
|
+
MIDB: "TEXT",
|
|
280
|
+
LOWER: "TEXT",
|
|
281
|
+
UPPER: "TEXT",
|
|
282
|
+
PROPER: "TEXT",
|
|
283
|
+
TRIM: "TEXT",
|
|
284
|
+
CLEAN: "TEXT",
|
|
285
|
+
SUBSTITUTE: "TEXT",
|
|
286
|
+
REPLACE: "TEXT",
|
|
287
|
+
REPLACEB: "TEXT",
|
|
288
|
+
REPT: "TEXT",
|
|
289
|
+
CONCAT: "TEXT",
|
|
290
|
+
CONCATENATE: "TEXT",
|
|
291
|
+
TEXTJOIN: "TEXT",
|
|
292
|
+
ADDRESS: "TEXT",
|
|
293
|
+
CHAR: "TEXT",
|
|
294
|
+
UNICHAR: "TEXT",
|
|
295
|
+
T: "TEXT",
|
|
296
|
+
DOLLAR: "TEXT",
|
|
297
|
+
FIXED: "TEXT",
|
|
298
|
+
BAHTTEXT: "TEXT",
|
|
299
|
+
// ─── Aggregation with formatDerivationRules entries (NUMBER base —
|
|
300
|
+
// specific-arg inheritance is in `formatDerivationRules`) ──────
|
|
301
|
+
SUMIFS: "NUMBER",
|
|
302
|
+
SUMIF: "NUMBER",
|
|
303
|
+
AVERAGEIFS: "NUMBER",
|
|
304
|
+
AVERAGEIF: "NUMBER",
|
|
305
|
+
MINIFS: "NUMBER",
|
|
306
|
+
MAXIFS: "NUMBER",
|
|
307
|
+
};
|
|
308
|
+
const currencyDecimalAdjustmentFunctions = new Set([
|
|
309
|
+
"ROUND",
|
|
310
|
+
"ROUNDUP",
|
|
311
|
+
"ROUNDDOWN",
|
|
312
|
+
"TRUNC",
|
|
313
|
+
"INT",
|
|
314
|
+
"MROUND",
|
|
315
|
+
"CEILING",
|
|
316
|
+
"FLOOR",
|
|
317
|
+
"QUOTIENT",
|
|
318
|
+
]);
|
|
319
|
+
// Get all function names from formula
|
|
320
|
+
const functionRegex = /([A-Za-z0-9_]+)\s*\(/g;
|
|
321
|
+
export const getFunctionNamesFromFormula = (formula) => {
|
|
322
|
+
let match;
|
|
323
|
+
const matches = [];
|
|
324
|
+
while ((match = functionRegex.exec(formula))) {
|
|
325
|
+
const [_, functionName] = match;
|
|
326
|
+
if (functionName) {
|
|
327
|
+
matches.push(functionName);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return matches;
|
|
331
|
+
};
|
|
332
|
+
const getSheetNameFromToken = (token) => {
|
|
333
|
+
if (!token)
|
|
334
|
+
return undefined;
|
|
335
|
+
if (token.tokenType.name === tokenVocabulary.Sheet.name) {
|
|
336
|
+
return token.image.slice(0, -1);
|
|
337
|
+
}
|
|
338
|
+
if (token.tokenType.name === tokenVocabulary.SheetQuoted.name) {
|
|
339
|
+
const cleanSheetName = desanitizeSheetName(token.image);
|
|
340
|
+
return cleanSheetName ? cleanSheetName.slice(0, -1) : undefined;
|
|
341
|
+
}
|
|
342
|
+
return undefined;
|
|
343
|
+
};
|
|
344
|
+
const getDirectReferenceBounds = (formula, tokenizer, sheetId, getSheetId) => {
|
|
345
|
+
if (!formula)
|
|
346
|
+
return [];
|
|
347
|
+
const trimmed = formula.trim();
|
|
348
|
+
if (!trimmed.startsWith("="))
|
|
349
|
+
return [];
|
|
350
|
+
const tokens = tokenizer(trimmed.slice(1));
|
|
351
|
+
const bounds = [];
|
|
352
|
+
let pendingSheetId;
|
|
353
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
354
|
+
const token = tokens[i];
|
|
355
|
+
const tokenSheetName = getSheetNameFromToken(token);
|
|
356
|
+
if (tokenSheetName) {
|
|
357
|
+
pendingSheetId = getSheetId(tokenSheetName);
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
if (token.tokenType.name !== tokenVocabulary.Cell.name) {
|
|
361
|
+
continue;
|
|
362
|
+
}
|
|
363
|
+
const refSheetId = token.sheetName
|
|
364
|
+
? getSheetId(token.sheetName)
|
|
365
|
+
: pendingSheetId ?? sheetId;
|
|
366
|
+
pendingSheetId = undefined;
|
|
367
|
+
const startCell = addressToCell(token.image);
|
|
368
|
+
if (!startCell)
|
|
369
|
+
continue;
|
|
370
|
+
if (tokens[i + 1]?.tokenType.name === tokenVocabulary.Colon.name &&
|
|
371
|
+
tokens[i + 2]?.tokenType.name === tokenVocabulary.Cell.name) {
|
|
372
|
+
const endCell = addressToCell(tokens[i + 2]?.image);
|
|
373
|
+
if (endCell) {
|
|
374
|
+
bounds.push({
|
|
375
|
+
sheetId: refSheetId,
|
|
376
|
+
minRow: Math.min(startCell.rowIndex, endCell.rowIndex),
|
|
377
|
+
maxRow: Math.max(startCell.rowIndex, endCell.rowIndex),
|
|
378
|
+
minCol: Math.min(startCell.columnIndex, endCell.columnIndex),
|
|
379
|
+
maxCol: Math.max(startCell.columnIndex, endCell.columnIndex),
|
|
380
|
+
});
|
|
381
|
+
i += 2;
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
bounds.push({
|
|
386
|
+
sheetId: refSheetId,
|
|
387
|
+
minRow: startCell.rowIndex,
|
|
388
|
+
maxRow: startCell.rowIndex,
|
|
389
|
+
minCol: startCell.columnIndex,
|
|
390
|
+
maxCol: startCell.columnIndex,
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
return bounds;
|
|
394
|
+
};
|
|
395
|
+
const filterPrecedentsByBounds = (precedents, bounds) => {
|
|
396
|
+
if (bounds.length === 0)
|
|
397
|
+
return precedents;
|
|
398
|
+
const intersects = (b, row, col) => row >= b.minRow && row <= b.maxRow && col >= b.minCol && col <= b.maxCol;
|
|
399
|
+
const rangeIntersects = (b, startRow, startCol, endRow, endCol) => !(startRow > b.maxRow ||
|
|
400
|
+
endRow < b.minRow ||
|
|
401
|
+
startCol > b.maxCol ||
|
|
402
|
+
endCol < b.minCol);
|
|
403
|
+
const filtered = precedents.filter((p) => {
|
|
404
|
+
if (isStaticNode(p))
|
|
405
|
+
return true;
|
|
406
|
+
for (const b of bounds) {
|
|
407
|
+
if (p.position.sheetId !== b.sheetId) {
|
|
408
|
+
continue;
|
|
409
|
+
}
|
|
410
|
+
if (isCellCoordinate(p.position)) {
|
|
411
|
+
if (intersects(b, p.position.rowIndex, p.position.columnIndex)) {
|
|
412
|
+
return true;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
else if (rangeIntersects(b, p.position.startRowIndex, p.position.startColumnIndex, p.position.endRowIndex, p.position.endColumnIndex)) {
|
|
416
|
+
return true;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return false;
|
|
420
|
+
});
|
|
421
|
+
return filtered.length > 0 ? filtered : precedents;
|
|
422
|
+
};
|
|
423
|
+
const sheetCell = new SheetCell();
|
|
424
|
+
export const deriveEffectiveNumberFormatFromPrecedents = (formula = "", precedents, draft, tokenizer, sheetId, rowIndex, columnIndex, locale, getSheetId, cellXfsRegistry, getDataValidationById, calculatedValue,
|
|
425
|
+
/**
|
|
426
|
+
* Optional resolver for a precedent's effective `numberFormat`. When a
|
|
427
|
+
* precedent is itself a formula cell with no `uf.numberFormat`, its
|
|
428
|
+
* format is derived (not persisted on cellData), so reading
|
|
429
|
+
* `sheetCell.getNumberFormat()` would miss it. The resolver lets the
|
|
430
|
+
* caller recurse through formula chains so `C1 = B1 = A1` inherits A1's
|
|
431
|
+
* format. When omitted, only the precedent's persisted
|
|
432
|
+
* `uf.numberFormat` is consulted.
|
|
433
|
+
*/
|
|
434
|
+
resolvePrecedentNumberFormat) => {
|
|
435
|
+
// Assign sheet cell
|
|
436
|
+
sheetCell.assign(sheetId, defaultCellCoords, draft?.[sheetId]?.[rowIndex]?.values?.[columnIndex], {
|
|
437
|
+
locale,
|
|
438
|
+
cellXfsRegistry,
|
|
439
|
+
getDataValidationById,
|
|
440
|
+
});
|
|
441
|
+
// Check if has user entered format
|
|
442
|
+
// User entered format always has precedence over
|
|
443
|
+
// format derived from precedents
|
|
444
|
+
if (sheetCell.userEnteredFormat?.numberFormat) {
|
|
445
|
+
return sheetCell.userEnteredFormat.numberFormat;
|
|
446
|
+
}
|
|
447
|
+
if (shouldSkipPrecedentFormatInheritance(formula)) {
|
|
448
|
+
return undefined;
|
|
449
|
+
}
|
|
450
|
+
// Priority
|
|
451
|
+
// NUMBER -> PERCENTAGE -> CURRENCY
|
|
452
|
+
let numFormat = undefined;
|
|
453
|
+
// Expected return type from function
|
|
454
|
+
let expectedOutputType = undefined;
|
|
455
|
+
let shouldAdjustCurrencyDecimals = false;
|
|
456
|
+
let maxDecimals = 0;
|
|
457
|
+
let match;
|
|
458
|
+
const isIndirectReference = formula
|
|
459
|
+
.trim()
|
|
460
|
+
.toUpperCase()
|
|
461
|
+
.startsWith("=INDIRECT(");
|
|
462
|
+
functionRegex.lastIndex = 0;
|
|
463
|
+
while ((match = functionRegex.exec(formula))) {
|
|
464
|
+
const [_, functionName] = match;
|
|
465
|
+
const functionDefault = isIndirectReference
|
|
466
|
+
? undefined
|
|
467
|
+
: functionReturnTypes[functionName.toUpperCase()];
|
|
468
|
+
if (currencyDecimalAdjustmentFunctions.has(functionName.toUpperCase())) {
|
|
469
|
+
shouldAdjustCurrencyDecimals = true;
|
|
470
|
+
}
|
|
471
|
+
if (!expectedOutputType) {
|
|
472
|
+
expectedOutputType = functionDefault;
|
|
473
|
+
}
|
|
474
|
+
else if (functionDefault === "NUMBER" && expectedOutputType === "DATE") {
|
|
475
|
+
// if the function returns a number but the expected type is a date,
|
|
476
|
+
// assume the output is a date
|
|
477
|
+
expectedOutputType = "DATE";
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
// Set effective format
|
|
481
|
+
let effectivePrecedents = precedents;
|
|
482
|
+
const indirectCurrentRowAddressMatch = formula
|
|
483
|
+
.trim()
|
|
484
|
+
.match(/^=INDIRECT\(\s*ADDRESS\(\s*ROW\(\)\s*,\s*(\d+)\s*\)\s*\)$/i);
|
|
485
|
+
if (indirectCurrentRowAddressMatch) {
|
|
486
|
+
effectivePrecedents = [
|
|
487
|
+
{
|
|
488
|
+
position: {
|
|
489
|
+
sheetId,
|
|
490
|
+
rowIndex,
|
|
491
|
+
columnIndex: Number(indirectCurrentRowAddressMatch[1]),
|
|
492
|
+
},
|
|
493
|
+
},
|
|
494
|
+
];
|
|
495
|
+
}
|
|
496
|
+
let topLevelFunctionName;
|
|
497
|
+
const directBounds = getDirectReferenceBounds(formula, tokenizer, sheetId, getSheetId);
|
|
498
|
+
effectivePrecedents = filterPrecedentsByBounds(effectivePrecedents, directBounds);
|
|
499
|
+
const upperFormula = formula?.trim().toUpperCase();
|
|
500
|
+
if (upperFormula) {
|
|
501
|
+
const functionNameMatch = upperFormula.match(/^=([A-Z0-9_]+)\(/);
|
|
502
|
+
topLevelFunctionName = functionNameMatch ? functionNameMatch[1] : undefined;
|
|
503
|
+
const rule = topLevelFunctionName
|
|
504
|
+
? formatDerivationRules[topLevelFunctionName]
|
|
505
|
+
: undefined;
|
|
506
|
+
if (rule) {
|
|
507
|
+
const args = extractTopLevelArgs(formula, upperFormula.split("(")[0]);
|
|
508
|
+
if (rule.type === "fixed_index" || rule.type === "conditional_index") {
|
|
509
|
+
const targetIndex = rule.type === "fixed_index"
|
|
510
|
+
? rule.index
|
|
511
|
+
: rule.getIndex(args.length);
|
|
512
|
+
if (targetIndex >= 0 && targetIndex < args.length) {
|
|
513
|
+
effectivePrecedents = filterPrecedentsByAddress(precedents, args[targetIndex], sheetId, getSheetId);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
else if (rule.type === "vlookup" || rule.type === "hlookup") {
|
|
517
|
+
// VLOOKUP / HLOOKUP: Excel returns the format of the matched cell
|
|
518
|
+
// in the literal-numbered column/row of the table range. Restrict
|
|
519
|
+
// derivation to that single column/row so a currency-formatted
|
|
520
|
+
// unrelated column in the table doesn't leak its format into the
|
|
521
|
+
// result.
|
|
522
|
+
const tableArg = args[rule.tableIndex];
|
|
523
|
+
const indexArg = args[rule.type === "vlookup" ? rule.colIndexArg : rule.rowIndexArg];
|
|
524
|
+
const offset = parseLiteralInt(indexArg);
|
|
525
|
+
if (tableArg && offset && offset >= 1) {
|
|
526
|
+
effectivePrecedents = filterPrecedentsByTableOffset(precedents, tableArg, offset, rule.type === "vlookup" ? "column" : "row", sheetId, getSheetId);
|
|
527
|
+
}
|
|
528
|
+
else if (tableArg) {
|
|
529
|
+
// Fallback: literal index unreadable (e.g. formula expression).
|
|
530
|
+
// Filter to the whole table — still better than walking every
|
|
531
|
+
// precedent.
|
|
532
|
+
effectivePrecedents = filterPrecedentsByAddress(precedents, tableArg, sheetId, getSheetId);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
const processPrecedentCell = (precedentSheetId, precedentRowIndex, precedentColumnIndex) => {
|
|
538
|
+
sheetCell.assign(precedentSheetId, {
|
|
539
|
+
rowIndex: precedentRowIndex,
|
|
540
|
+
columnIndex: precedentColumnIndex,
|
|
541
|
+
}, draft?.[precedentSheetId]?.[precedentRowIndex]?.values?.[precedentColumnIndex], {
|
|
542
|
+
locale,
|
|
543
|
+
cellXfsRegistry,
|
|
544
|
+
getDataValidationById,
|
|
545
|
+
});
|
|
546
|
+
// Prefer the resolver: it returns `uf.numberFormat` for plain cells
|
|
547
|
+
// and the recursively-derived format for formula cells, so chains
|
|
548
|
+
// like `C1 = B1 = A1` propagate A1's format through B1 to C1.
|
|
549
|
+
// Falls back to the precedent's persisted `uf.numberFormat` when no
|
|
550
|
+
// resolver is wired (callers without a derive-graph, e.g. exporters).
|
|
551
|
+
const curNumFormat = resolvePrecedentNumberFormat?.(precedentSheetId, precedentRowIndex, precedentColumnIndex) ?? sheetCell.getNumberFormat();
|
|
552
|
+
const currentValue = sheetCell.getEffectiveValue();
|
|
553
|
+
if (typeof currentValue === "number") {
|
|
554
|
+
maxDecimals = Math.max(maxDecimals, getDecimalPlaces(currentValue, locale));
|
|
555
|
+
}
|
|
556
|
+
if (curNumFormat) {
|
|
557
|
+
maxDecimals = Math.max(maxDecimals, getCurrentDecimalCountInPattern(curNumFormat.pattern));
|
|
558
|
+
if (curNumFormat.type === "TEXT" &&
|
|
559
|
+
numFormat &&
|
|
560
|
+
numFormat.type &&
|
|
561
|
+
numFormat.type !== "TEXT") {
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
// Excel's rule: the **first** non-generic precedent format wins.
|
|
565
|
+
// Generic = NUMBER/GENERAL/COUNT (no specific styling intent), so a
|
|
566
|
+
// later CURRENCY/PERCENT/DATE/etc. can upgrade it; but once a
|
|
567
|
+
// specific format is locked in we don't let a different specific
|
|
568
|
+
// format override it (e.g. PERCENT then CURRENCY → keep PERCENT,
|
|
569
|
+
// matching Excel; previously priority-based merging picked the
|
|
570
|
+
// higher-priority one regardless of position).
|
|
571
|
+
if (!numFormat || isGenericNumberFormatType(numFormat.type)) {
|
|
572
|
+
numFormat = curNumFormat;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
for (const precedent of effectivePrecedents) {
|
|
577
|
+
// Ignore static node
|
|
578
|
+
if (isStaticNode(precedent)) {
|
|
579
|
+
continue;
|
|
580
|
+
}
|
|
581
|
+
const precedentSheetId = precedent.position.sheetId;
|
|
582
|
+
if (isCellCoordinate(precedent.position)) {
|
|
583
|
+
processPrecedentCell(precedentSheetId, precedent.position.rowIndex, precedent.position.columnIndex);
|
|
584
|
+
continue;
|
|
585
|
+
}
|
|
586
|
+
// Anchor-only derivation: Excel inherits a range's number format from
|
|
587
|
+
// its first cell (top-left). This makes derivation O(1) per range and
|
|
588
|
+
// keeps it consistent with the anchor-only cache fingerprint so a
|
|
589
|
+
// non-anchor format change doesn't leak a different result than what
|
|
590
|
+
// the cache would return.
|
|
591
|
+
processPrecedentCell(precedentSheetId, precedent.position.startRowIndex, precedent.position.startColumnIndex);
|
|
592
|
+
}
|
|
593
|
+
// Get decimal places from the calculated value
|
|
594
|
+
// This respects ROUND's output - if ROUND(x, 0) gives 456, it has 0 decimals
|
|
595
|
+
const calculatedDecimals = typeof calculatedValue === "number"
|
|
596
|
+
? getDecimalPlaces(calculatedValue, locale)
|
|
597
|
+
: undefined;
|
|
598
|
+
if (typeof calculatedValue === "number") {
|
|
599
|
+
maxDecimals = Math.max(maxDecimals, calculatedDecimals ?? 0);
|
|
600
|
+
}
|
|
601
|
+
if (!numFormat && maxDecimals > 0) {
|
|
602
|
+
numFormat = { type: "NUMBER" };
|
|
603
|
+
}
|
|
604
|
+
const applyDecimalHeuristic = (format) => {
|
|
605
|
+
// `#` is the implicit integer pattern inferred from plain numeric cells,
|
|
606
|
+
// but it suppresses zero. Formula results should still display a derived
|
|
607
|
+
// zero; an explicitly formatted formula cell returned above remains
|
|
608
|
+
// untouched.
|
|
609
|
+
if (calculatedValue === 0 &&
|
|
610
|
+
format?.type === "NUMBER" &&
|
|
611
|
+
format.pattern === "#") {
|
|
612
|
+
return { ...format, pattern: "0" };
|
|
613
|
+
}
|
|
614
|
+
// For CURRENCY type, use the calculated value's decimal places
|
|
615
|
+
// This ensures ROUND(SUM(F9), 0) shows 0 decimals even if precedent has 2
|
|
616
|
+
if (format?.type === "CURRENCY" &&
|
|
617
|
+
shouldAdjustCurrencyDecimals &&
|
|
618
|
+
calculatedDecimals !== undefined &&
|
|
619
|
+
format.pattern) {
|
|
620
|
+
const patternDecimals = getCurrentDecimalCountInPattern(format.pattern);
|
|
621
|
+
// Only adjust if calculated value has fewer decimals than the pattern
|
|
622
|
+
// (respects ROUND's intent to reduce decimals)
|
|
623
|
+
if (calculatedDecimals < patternDecimals) {
|
|
624
|
+
return {
|
|
625
|
+
...format,
|
|
626
|
+
pattern: changeDecimals(format.pattern, calculatedDecimals, false),
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
// Original heuristic for NUMBER type
|
|
631
|
+
if (format?.type === "NUMBER" && maxDecimals > 0) {
|
|
632
|
+
const basePattern = format.pattern ?? "0";
|
|
633
|
+
return {
|
|
634
|
+
...format,
|
|
635
|
+
pattern: changeDecimals(basePattern, Math.min(maxDecimals, 3), false),
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
return format;
|
|
639
|
+
};
|
|
640
|
+
// Useful for Percentages
|
|
641
|
+
// 20% x 50 => number
|
|
642
|
+
if (numFormat) {
|
|
643
|
+
// Does not support structured references as of now
|
|
644
|
+
const astDerivedNumberFormat = getNumberFormatFromFormulaAst(formula, numFormat, draft, tokenizer, sheetId, getSheetId, cellXfsRegistry, getDataValidationById, locale);
|
|
645
|
+
if (astDerivedNumberFormat) {
|
|
646
|
+
return applyDecimalHeuristic(astDerivedNumberFormat);
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
// If we could not derive from function
|
|
650
|
+
if (expectedOutputType === undefined) {
|
|
651
|
+
return applyDecimalHeuristic(numFormat);
|
|
652
|
+
}
|
|
653
|
+
// Number variations
|
|
654
|
+
if (expectedOutputType === "NUMBER" &&
|
|
655
|
+
(numFormat?.type === "CURRENCY" ||
|
|
656
|
+
numFormat?.type === "PERCENT" ||
|
|
657
|
+
numFormat?.type === "SCIENTIFIC")) {
|
|
658
|
+
return numFormat;
|
|
659
|
+
}
|
|
660
|
+
// Date variations
|
|
661
|
+
if (expectedOutputType === "DATE" && numFormat?.type === "DATE_TIME") {
|
|
662
|
+
return numFormat;
|
|
663
|
+
}
|
|
664
|
+
if (expectedOutputType !== numFormat?.type) {
|
|
665
|
+
const resolvedType = expectedOutputType in customNumberFormatMap
|
|
666
|
+
? customNumberFormatMap[expectedOutputType]
|
|
667
|
+
: expectedOutputType;
|
|
668
|
+
const resolvedNumberFormat = {
|
|
669
|
+
type: resolvedType,
|
|
670
|
+
};
|
|
671
|
+
// Date/time types need a concrete pattern — without one the renderer
|
|
672
|
+
// falls back to "General" and shows the serial number (the
|
|
673
|
+
// =TODAY() bug). When the precedent itself is a date-family format
|
|
674
|
+
// with a pattern, inherit that pattern (e.g. `=EDATE(A1, 1)` keeps
|
|
675
|
+
// A1's custom `yyyy-mm-dd` instead of falling back to the locale
|
|
676
|
+
// default). Otherwise mirror the format toolbar's default for the
|
|
677
|
+
// type.
|
|
678
|
+
if (isDateFamilyType(resolvedNumberFormat.type) &&
|
|
679
|
+
isDateFamilyType(numFormat?.type) &&
|
|
680
|
+
numFormat?.pattern) {
|
|
681
|
+
resolvedNumberFormat.pattern = numFormat.pattern;
|
|
682
|
+
}
|
|
683
|
+
else if (resolvedNumberFormat.type === "DATE_TIME") {
|
|
684
|
+
resolvedNumberFormat.pattern = getDefaultDateTimeFormat(locale);
|
|
685
|
+
}
|
|
686
|
+
else if (resolvedNumberFormat.type === "DATE") {
|
|
687
|
+
resolvedNumberFormat.pattern = getDefaultDateFormat(locale);
|
|
688
|
+
}
|
|
689
|
+
else if (resolvedNumberFormat.type === "TIME") {
|
|
690
|
+
resolvedNumberFormat.pattern = getDefaultTimeFormat(locale);
|
|
691
|
+
}
|
|
692
|
+
// Preserve pattern from precedent cells for CURRENCY type
|
|
693
|
+
// This ensures currency symbols (€, $, etc.) are preserved
|
|
694
|
+
if (resolvedNumberFormat.type === "CURRENCY" &&
|
|
695
|
+
numFormat?.type === "CURRENCY" &&
|
|
696
|
+
numFormat.pattern) {
|
|
697
|
+
resolvedNumberFormat.pattern = numFormat.pattern;
|
|
698
|
+
}
|
|
699
|
+
return applyDecimalHeuristic(resolvedNumberFormat);
|
|
700
|
+
}
|
|
701
|
+
return applyDecimalHeuristic(numFormat);
|
|
702
|
+
};
|
|
703
|
+
/**
|
|
704
|
+
* Like `deriveEffectiveNumberFormatFromPrecedents` but synthesizes the
|
|
705
|
+
* `precedents` array from the formula's direct cell/range references —
|
|
706
|
+
* used by the XLSX/ODS/CSV exporters which don't have a calc graph.
|
|
707
|
+
*
|
|
708
|
+
* Internally calls `deriveEffectiveNumberFormatFromPrecedents`, so all the
|
|
709
|
+
* function-specific rules (FILTER source range, ROUND decimals, IFERROR,
|
|
710
|
+
* function return types, etc.) are honored — render and export produce
|
|
711
|
+
* the same format for the same formula.
|
|
712
|
+
*/
|
|
713
|
+
export const deriveEffectiveNumberFormatFromFormula = (formula, sheetId, rowIndex, columnIndex, draft, tokenizer, getSheetId, locale, cellXfsRegistry, getDataValidationById, calculatedValue) => {
|
|
714
|
+
if (!formula || !formula.trim().startsWith("="))
|
|
715
|
+
return undefined;
|
|
716
|
+
const bounds = getDirectReferenceBounds(formula, tokenizer, sheetId, getSheetId);
|
|
717
|
+
// Synthesize precedents — one CellNode per cell in each bound. The
|
|
718
|
+
// existing implementation re-filters precedents by the same bounds, so
|
|
719
|
+
// this produces identical input.
|
|
720
|
+
const precedents = [];
|
|
721
|
+
for (const bound of bounds) {
|
|
722
|
+
for (let r = bound.minRow; r <= bound.maxRow; r++) {
|
|
723
|
+
for (let c = bound.minCol; c <= bound.maxCol; c++) {
|
|
724
|
+
precedents.push({
|
|
725
|
+
position: {
|
|
726
|
+
sheetId: bound.sheetId,
|
|
727
|
+
rowIndex: r,
|
|
728
|
+
columnIndex: c,
|
|
729
|
+
},
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
return deriveEffectiveNumberFormatFromPrecedents(formula, precedents, draft, tokenizer, sheetId, rowIndex, columnIndex, locale, getSheetId, cellXfsRegistry, getDataValidationById, calculatedValue);
|
|
735
|
+
};
|
|
736
|
+
const resolveResultsType = (type) => {
|
|
737
|
+
if (!type)
|
|
738
|
+
return undefined;
|
|
739
|
+
if (type in customNumberFormatMap) {
|
|
740
|
+
return customNumberFormatMap[type];
|
|
741
|
+
}
|
|
742
|
+
return type;
|
|
743
|
+
};
|
|
744
|
+
const parseNumberFormatAst = (formula, tokenizer, sheetId, getSheetId) => {
|
|
745
|
+
if (!formula.startsWith("=")) {
|
|
746
|
+
return undefined;
|
|
747
|
+
}
|
|
748
|
+
const tokens = tokenizer(formula.slice(1));
|
|
749
|
+
let index = 0;
|
|
750
|
+
const emptyStopTokens = new Set();
|
|
751
|
+
const peek = () => tokens[index];
|
|
752
|
+
const next = () => tokens[index++];
|
|
753
|
+
const shouldStop = (stopTokens) => !!peek() && stopTokens.has(peek().tokenType.name);
|
|
754
|
+
const parseCellOrRange = (cellToken, explicitSheetId) => {
|
|
755
|
+
const startCell = addressToCell(cellToken.image);
|
|
756
|
+
if (!startCell)
|
|
757
|
+
return undefined;
|
|
758
|
+
const resolvedSheetId = cellToken.sheetName
|
|
759
|
+
? getSheetId(cellToken.sheetName)
|
|
760
|
+
: explicitSheetId ?? sheetId;
|
|
761
|
+
if (peek()?.tokenType.name === tokenVocabulary.Colon.name &&
|
|
762
|
+
tokens[index + 1]?.tokenType.name === tokenVocabulary.Cell.name) {
|
|
763
|
+
next();
|
|
764
|
+
const endCellToken = next();
|
|
765
|
+
const endCell = addressToCell(endCellToken.image);
|
|
766
|
+
if (!endCell) {
|
|
767
|
+
return {
|
|
768
|
+
kind: "cell_reference",
|
|
769
|
+
sheetId: resolvedSheetId,
|
|
770
|
+
rowIndex: startCell.rowIndex,
|
|
771
|
+
columnIndex: startCell.columnIndex,
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
return {
|
|
775
|
+
kind: "range_reference",
|
|
776
|
+
sheetId: resolvedSheetId,
|
|
777
|
+
startRowIndex: startCell.rowIndex,
|
|
778
|
+
startColumnIndex: startCell.columnIndex,
|
|
779
|
+
endRowIndex: endCell.rowIndex,
|
|
780
|
+
endColumnIndex: endCell.columnIndex,
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
return {
|
|
784
|
+
kind: "cell_reference",
|
|
785
|
+
sheetId: resolvedSheetId,
|
|
786
|
+
rowIndex: startCell.rowIndex,
|
|
787
|
+
columnIndex: startCell.columnIndex,
|
|
788
|
+
};
|
|
789
|
+
};
|
|
790
|
+
const parseExpression = (stopTokens) => parseComparison(stopTokens);
|
|
791
|
+
const parseComparison = (stopTokens) => {
|
|
792
|
+
let left = parseConcat(stopTokens);
|
|
793
|
+
while (left && !shouldStop(stopTokens)) {
|
|
794
|
+
const name = peek()?.tokenType.name;
|
|
795
|
+
if (name === tokenVocabulary.EqOp.name ||
|
|
796
|
+
name === tokenVocabulary.NeqOp.name ||
|
|
797
|
+
name === tokenVocabulary.GtOp.name ||
|
|
798
|
+
name === tokenVocabulary.GteOp.name ||
|
|
799
|
+
name === tokenVocabulary.LtOp.name ||
|
|
800
|
+
name === tokenVocabulary.LteOp.name) {
|
|
801
|
+
next();
|
|
802
|
+
const right = parseConcat(stopTokens);
|
|
803
|
+
if (!right)
|
|
804
|
+
break;
|
|
805
|
+
left = { kind: "binary", op: "COMPARE", left, right };
|
|
806
|
+
continue;
|
|
807
|
+
}
|
|
808
|
+
break;
|
|
809
|
+
}
|
|
810
|
+
return left;
|
|
811
|
+
};
|
|
812
|
+
const parseConcat = (stopTokens) => {
|
|
813
|
+
let left = parseAddSub(stopTokens);
|
|
814
|
+
while (left && !shouldStop(stopTokens)) {
|
|
815
|
+
if (peek()?.tokenType.name === tokenVocabulary.ConcatOp.name) {
|
|
816
|
+
next();
|
|
817
|
+
const right = parseAddSub(stopTokens);
|
|
818
|
+
if (!right)
|
|
819
|
+
break;
|
|
820
|
+
left = { kind: "binary", op: "CONCAT", left, right };
|
|
821
|
+
continue;
|
|
822
|
+
}
|
|
823
|
+
break;
|
|
824
|
+
}
|
|
825
|
+
return left;
|
|
826
|
+
};
|
|
827
|
+
const parseAddSub = (stopTokens) => {
|
|
828
|
+
let left = parseMulDiv(stopTokens);
|
|
829
|
+
while (left && !shouldStop(stopTokens)) {
|
|
830
|
+
const name = peek()?.tokenType.name;
|
|
831
|
+
if (name === tokenVocabulary.PlusOp.name ||
|
|
832
|
+
name === tokenVocabulary.MinOp.name) {
|
|
833
|
+
next();
|
|
834
|
+
const right = parseMulDiv(stopTokens);
|
|
835
|
+
if (!right)
|
|
836
|
+
break;
|
|
837
|
+
left = {
|
|
838
|
+
kind: "binary",
|
|
839
|
+
op: name === tokenVocabulary.PlusOp.name ? "ADD" : "SUB",
|
|
840
|
+
left,
|
|
841
|
+
right,
|
|
842
|
+
};
|
|
843
|
+
continue;
|
|
844
|
+
}
|
|
845
|
+
break;
|
|
846
|
+
}
|
|
847
|
+
return left;
|
|
848
|
+
};
|
|
849
|
+
const parseMulDiv = (stopTokens) => {
|
|
850
|
+
let left = parsePower(stopTokens);
|
|
851
|
+
while (left && !shouldStop(stopTokens)) {
|
|
852
|
+
const name = peek()?.tokenType.name;
|
|
853
|
+
if (name === tokenVocabulary.MulOp.name ||
|
|
854
|
+
name === tokenVocabulary.DivOp.name) {
|
|
855
|
+
next();
|
|
856
|
+
const right = parsePower(stopTokens);
|
|
857
|
+
if (!right)
|
|
858
|
+
break;
|
|
859
|
+
left = {
|
|
860
|
+
kind: "binary",
|
|
861
|
+
op: name === tokenVocabulary.MulOp.name ? "MUL" : "DIV",
|
|
862
|
+
left,
|
|
863
|
+
right,
|
|
864
|
+
};
|
|
865
|
+
continue;
|
|
866
|
+
}
|
|
867
|
+
break;
|
|
868
|
+
}
|
|
869
|
+
return left;
|
|
870
|
+
};
|
|
871
|
+
const parsePower = (stopTokens) => {
|
|
872
|
+
let left = parseUnary(stopTokens);
|
|
873
|
+
while (left && !shouldStop(stopTokens)) {
|
|
874
|
+
if (peek()?.tokenType.name === tokenVocabulary.ExOp.name) {
|
|
875
|
+
next();
|
|
876
|
+
const right = parseUnary(stopTokens);
|
|
877
|
+
if (!right)
|
|
878
|
+
break;
|
|
879
|
+
left = { kind: "binary", op: "EXP", left, right };
|
|
880
|
+
continue;
|
|
881
|
+
}
|
|
882
|
+
break;
|
|
883
|
+
}
|
|
884
|
+
return left;
|
|
885
|
+
};
|
|
886
|
+
const parseUnary = (stopTokens) => {
|
|
887
|
+
const name = peek()?.tokenType.name;
|
|
888
|
+
if (name === tokenVocabulary.PlusOp.name ||
|
|
889
|
+
name === tokenVocabulary.MinOp.name) {
|
|
890
|
+
next();
|
|
891
|
+
const operand = parseUnary(stopTokens);
|
|
892
|
+
if (!operand)
|
|
893
|
+
return undefined;
|
|
894
|
+
return {
|
|
895
|
+
kind: "unary",
|
|
896
|
+
op: name === tokenVocabulary.PlusOp.name ? "PLUS" : "MINUS",
|
|
897
|
+
operand,
|
|
898
|
+
};
|
|
899
|
+
}
|
|
900
|
+
return parsePostfix(stopTokens);
|
|
901
|
+
};
|
|
902
|
+
const parsePostfix = (stopTokens) => {
|
|
903
|
+
let left = parsePrimary(stopTokens);
|
|
904
|
+
while (left && !shouldStop(stopTokens)) {
|
|
905
|
+
if (peek()?.tokenType.name === tokenVocabulary.PercentOp.name) {
|
|
906
|
+
next();
|
|
907
|
+
left = { kind: "postfix_percent", operand: left };
|
|
908
|
+
continue;
|
|
909
|
+
}
|
|
910
|
+
break;
|
|
911
|
+
}
|
|
912
|
+
return left;
|
|
913
|
+
};
|
|
914
|
+
const parseFunction = () => {
|
|
915
|
+
const token = next();
|
|
916
|
+
const functionName = token.image.slice(0, -1).toUpperCase();
|
|
917
|
+
const argStopTokens = new Set([
|
|
918
|
+
tokenVocabulary.Comma.name,
|
|
919
|
+
tokenVocabulary.CloseParen.name,
|
|
920
|
+
]);
|
|
921
|
+
const args = [];
|
|
922
|
+
while (index < tokens.length) {
|
|
923
|
+
if (peek()?.tokenType.name === tokenVocabulary.CloseParen.name) {
|
|
924
|
+
next();
|
|
925
|
+
break;
|
|
926
|
+
}
|
|
927
|
+
const parsedArg = parseExpression(argStopTokens);
|
|
928
|
+
args.push(parsedArg ?? { kind: "unknown" });
|
|
929
|
+
const nextName = peek()?.tokenType.name;
|
|
930
|
+
if (nextName === tokenVocabulary.Comma.name) {
|
|
931
|
+
next();
|
|
932
|
+
continue;
|
|
933
|
+
}
|
|
934
|
+
if (nextName === tokenVocabulary.CloseParen.name) {
|
|
935
|
+
next();
|
|
936
|
+
break;
|
|
937
|
+
}
|
|
938
|
+
if (nextName === undefined) {
|
|
939
|
+
break;
|
|
940
|
+
}
|
|
941
|
+
next();
|
|
942
|
+
}
|
|
943
|
+
return {
|
|
944
|
+
kind: "function_call",
|
|
945
|
+
name: functionName,
|
|
946
|
+
args,
|
|
947
|
+
};
|
|
948
|
+
};
|
|
949
|
+
const parsePrimary = (stopTokens) => {
|
|
950
|
+
if (shouldStop(stopTokens)) {
|
|
951
|
+
return undefined;
|
|
952
|
+
}
|
|
953
|
+
const token = peek();
|
|
954
|
+
if (!token)
|
|
955
|
+
return undefined;
|
|
956
|
+
const name = token.tokenType.name;
|
|
957
|
+
if (name === tokenVocabulary.Number.name) {
|
|
958
|
+
next();
|
|
959
|
+
return { kind: "number_literal" };
|
|
960
|
+
}
|
|
961
|
+
if (name === tokenVocabulary.String.name) {
|
|
962
|
+
next();
|
|
963
|
+
return { kind: "string_literal" };
|
|
964
|
+
}
|
|
965
|
+
if (name === tokenVocabulary.Boolean.name) {
|
|
966
|
+
next();
|
|
967
|
+
return { kind: "boolean_literal" };
|
|
968
|
+
}
|
|
969
|
+
if (name === tokenVocabulary.Cell.name) {
|
|
970
|
+
const cellToken = next();
|
|
971
|
+
return parseCellOrRange(cellToken);
|
|
972
|
+
}
|
|
973
|
+
if (name === tokenVocabulary.Sheet.name ||
|
|
974
|
+
name === tokenVocabulary.SheetQuoted.name) {
|
|
975
|
+
const sheetToken = next();
|
|
976
|
+
const parsedSheetName = getSheetNameFromToken(sheetToken);
|
|
977
|
+
const explicitSheetId = parsedSheetName
|
|
978
|
+
? getSheetId(parsedSheetName)
|
|
979
|
+
: sheetId;
|
|
980
|
+
const cellToken = peek();
|
|
981
|
+
if (cellToken?.tokenType.name !== tokenVocabulary.Cell.name) {
|
|
982
|
+
return { kind: "unknown" };
|
|
983
|
+
}
|
|
984
|
+
next();
|
|
985
|
+
return parseCellOrRange(cellToken, explicitSheetId);
|
|
986
|
+
}
|
|
987
|
+
if (name === tokenVocabulary.Function.name) {
|
|
988
|
+
return parseFunction();
|
|
989
|
+
}
|
|
990
|
+
if (name === tokenVocabulary.OpenParen.name) {
|
|
991
|
+
next();
|
|
992
|
+
const node = parseExpression(new Set([tokenVocabulary.CloseParen.name]));
|
|
993
|
+
if (peek()?.tokenType.name === tokenVocabulary.CloseParen.name) {
|
|
994
|
+
next();
|
|
995
|
+
}
|
|
996
|
+
return node;
|
|
997
|
+
}
|
|
998
|
+
next();
|
|
999
|
+
return { kind: "unknown" };
|
|
1000
|
+
};
|
|
1001
|
+
return parseExpression(emptyStopTokens);
|
|
1002
|
+
};
|
|
1003
|
+
const deriveNumberFormatTypeFromAst = (ast, derivedNumberFormat, draft, getDataValidationById, cellXfsRegistry) => {
|
|
1004
|
+
const getCellFormatType = (targetSheetId, rowIndex, columnIndex) => {
|
|
1005
|
+
sheetCell.assign(targetSheetId, { rowIndex, columnIndex }, draft?.[targetSheetId]?.[rowIndex]?.values?.[columnIndex], { cellXfsRegistry, getDataValidationById });
|
|
1006
|
+
return sheetCell.getNumberFormat()?.type;
|
|
1007
|
+
};
|
|
1008
|
+
const isDateLike = (type) => type === "DATE" || type === "DATE_TIME" || type === "TIME";
|
|
1009
|
+
const isCurrencyLike = (type) => type === "CURRENCY" || type === "ACCOUNTING";
|
|
1010
|
+
const isPercentLike = (type) => type === "PERCENT";
|
|
1011
|
+
const isNumericLike = (type) => type === "NUMBER" ||
|
|
1012
|
+
type === "GENERAL" ||
|
|
1013
|
+
type === "SCIENTIFIC" ||
|
|
1014
|
+
type === "FRACTION" ||
|
|
1015
|
+
type === "SPECIAL" ||
|
|
1016
|
+
isCurrencyLike(type) ||
|
|
1017
|
+
isPercentLike(type);
|
|
1018
|
+
const mergeValueTypes = (types) => {
|
|
1019
|
+
const filtered = types.filter((type) => !!type);
|
|
1020
|
+
if (filtered.length === 0)
|
|
1021
|
+
return undefined;
|
|
1022
|
+
if (filtered.every((type) => type === filtered[0])) {
|
|
1023
|
+
return filtered[0];
|
|
1024
|
+
}
|
|
1025
|
+
if (filtered.some(isCurrencyLike)) {
|
|
1026
|
+
return filtered.find(isCurrencyLike) ?? filtered[0];
|
|
1027
|
+
}
|
|
1028
|
+
if (filtered.every(isPercentLike)) {
|
|
1029
|
+
return "PERCENT";
|
|
1030
|
+
}
|
|
1031
|
+
if (filtered.some(isPercentLike)) {
|
|
1032
|
+
return "NUMBER";
|
|
1033
|
+
}
|
|
1034
|
+
if (filtered.every(isDateLike)) {
|
|
1035
|
+
return filtered[0];
|
|
1036
|
+
}
|
|
1037
|
+
return filtered[0];
|
|
1038
|
+
};
|
|
1039
|
+
const deriveAggregateType = (functionName, argTypes) => {
|
|
1040
|
+
const filtered = argTypes.filter((type) => !!type);
|
|
1041
|
+
if (filtered.length === 0)
|
|
1042
|
+
return undefined;
|
|
1043
|
+
const hasCurrency = filtered.some(isCurrencyLike);
|
|
1044
|
+
const allPercent = filtered.every(isPercentLike);
|
|
1045
|
+
const hasPercent = filtered.some(isPercentLike);
|
|
1046
|
+
const allDate = filtered.every(isDateLike);
|
|
1047
|
+
if (functionName === "MIN" || functionName === "MAX") {
|
|
1048
|
+
if (allDate)
|
|
1049
|
+
return filtered[0];
|
|
1050
|
+
if (hasCurrency)
|
|
1051
|
+
return filtered.find(isCurrencyLike) ?? "NUMBER";
|
|
1052
|
+
if (allPercent)
|
|
1053
|
+
return "PERCENT";
|
|
1054
|
+
if (hasPercent)
|
|
1055
|
+
return "NUMBER";
|
|
1056
|
+
return filtered[0] ?? "NUMBER";
|
|
1057
|
+
}
|
|
1058
|
+
if (functionName === "SUM" || functionName === "AVERAGE") {
|
|
1059
|
+
if (hasCurrency)
|
|
1060
|
+
return filtered.find(isCurrencyLike) ?? "NUMBER";
|
|
1061
|
+
if (allPercent)
|
|
1062
|
+
return "PERCENT";
|
|
1063
|
+
if (hasPercent)
|
|
1064
|
+
return "NUMBER";
|
|
1065
|
+
if (allDate)
|
|
1066
|
+
return "NUMBER";
|
|
1067
|
+
return filtered[0] ?? "NUMBER";
|
|
1068
|
+
}
|
|
1069
|
+
return filtered[0];
|
|
1070
|
+
};
|
|
1071
|
+
const preferNumericType = (left, right) => {
|
|
1072
|
+
if (isCurrencyLike(left))
|
|
1073
|
+
return left;
|
|
1074
|
+
if (isCurrencyLike(right))
|
|
1075
|
+
return right;
|
|
1076
|
+
if (isPercentLike(left) && isPercentLike(right))
|
|
1077
|
+
return "PERCENT";
|
|
1078
|
+
if (isPercentLike(left))
|
|
1079
|
+
return right ?? "NUMBER";
|
|
1080
|
+
if (isPercentLike(right))
|
|
1081
|
+
return left ?? "NUMBER";
|
|
1082
|
+
return left ?? right;
|
|
1083
|
+
};
|
|
1084
|
+
const combineTypes = (op, left, right) => {
|
|
1085
|
+
if (op === "CONCAT")
|
|
1086
|
+
return "TEXT";
|
|
1087
|
+
if (op === "COMPARE")
|
|
1088
|
+
return "GENERAL";
|
|
1089
|
+
if (op === "ADD" || op === "SUB") {
|
|
1090
|
+
if (isDateLike(left) && isDateLike(right))
|
|
1091
|
+
return "NUMBER";
|
|
1092
|
+
if (isDateLike(left) && isNumericLike(right))
|
|
1093
|
+
return left;
|
|
1094
|
+
if (isDateLike(right) && isNumericLike(left))
|
|
1095
|
+
return right;
|
|
1096
|
+
return preferNumericType(left, right);
|
|
1097
|
+
}
|
|
1098
|
+
if (op === "MUL") {
|
|
1099
|
+
if (isPercentLike(left) && isPercentLike(right))
|
|
1100
|
+
return "NUMBER";
|
|
1101
|
+
if (isPercentLike(left) && isNumericLike(right))
|
|
1102
|
+
return right;
|
|
1103
|
+
if (isPercentLike(right) && isNumericLike(left))
|
|
1104
|
+
return left;
|
|
1105
|
+
if (isDateLike(left) || isDateLike(right))
|
|
1106
|
+
return "NUMBER";
|
|
1107
|
+
if (isCurrencyLike(left) && isCurrencyLike(right))
|
|
1108
|
+
return "NUMBER";
|
|
1109
|
+
if (isCurrencyLike(left) && isNumericLike(right))
|
|
1110
|
+
return left;
|
|
1111
|
+
if (isCurrencyLike(right) && isNumericLike(left))
|
|
1112
|
+
return right;
|
|
1113
|
+
return preferNumericType(left, right);
|
|
1114
|
+
}
|
|
1115
|
+
if (op === "DIV") {
|
|
1116
|
+
if (isDateLike(left) || isDateLike(right))
|
|
1117
|
+
return "NUMBER";
|
|
1118
|
+
if (isCurrencyLike(left) && isCurrencyLike(right))
|
|
1119
|
+
return "NUMBER";
|
|
1120
|
+
if (isCurrencyLike(left) && isNumericLike(right))
|
|
1121
|
+
return left;
|
|
1122
|
+
if (isCurrencyLike(right) && isNumericLike(left))
|
|
1123
|
+
return "NUMBER";
|
|
1124
|
+
if (isPercentLike(left) && isPercentLike(right))
|
|
1125
|
+
return "NUMBER";
|
|
1126
|
+
if (isPercentLike(left) && isNumericLike(right))
|
|
1127
|
+
return right;
|
|
1128
|
+
if (isPercentLike(right) && isNumericLike(left))
|
|
1129
|
+
return left;
|
|
1130
|
+
return preferNumericType(left, right);
|
|
1131
|
+
}
|
|
1132
|
+
if (op === "EXP")
|
|
1133
|
+
return "NUMBER";
|
|
1134
|
+
return left ?? right;
|
|
1135
|
+
};
|
|
1136
|
+
const inferNodeType = (node) => {
|
|
1137
|
+
if (!node)
|
|
1138
|
+
return undefined;
|
|
1139
|
+
switch (node.kind) {
|
|
1140
|
+
case "number_literal":
|
|
1141
|
+
return "NUMBER";
|
|
1142
|
+
case "string_literal":
|
|
1143
|
+
return "TEXT";
|
|
1144
|
+
case "boolean_literal":
|
|
1145
|
+
return "NUMBER";
|
|
1146
|
+
case "cell_reference":
|
|
1147
|
+
return (getCellFormatType(node.sheetId, node.rowIndex, node.columnIndex) ??
|
|
1148
|
+
derivedNumberFormat.type);
|
|
1149
|
+
case "range_reference":
|
|
1150
|
+
return (getCellFormatType(node.sheetId, node.startRowIndex, node.startColumnIndex) ?? derivedNumberFormat.type);
|
|
1151
|
+
case "unary":
|
|
1152
|
+
return inferNodeType(node.operand);
|
|
1153
|
+
case "postfix_percent":
|
|
1154
|
+
return "PERCENT";
|
|
1155
|
+
case "binary":
|
|
1156
|
+
return combineTypes(node.op, inferNodeType(node.left), inferNodeType(node.right));
|
|
1157
|
+
case "function_call": {
|
|
1158
|
+
const args = node.args.map((arg) => inferNodeType(arg));
|
|
1159
|
+
const functionName = node.name;
|
|
1160
|
+
if (functionName === "IF") {
|
|
1161
|
+
const trueType = args[1];
|
|
1162
|
+
const falseType = args[2];
|
|
1163
|
+
return (mergeValueTypes([trueType, falseType]) ?? derivedNumberFormat.type);
|
|
1164
|
+
}
|
|
1165
|
+
if (functionName === "IFS") {
|
|
1166
|
+
const valueTypes = [];
|
|
1167
|
+
for (let i = 1; i < args.length; i += 2) {
|
|
1168
|
+
valueTypes.push(args[i]);
|
|
1169
|
+
}
|
|
1170
|
+
return mergeValueTypes(valueTypes) ?? derivedNumberFormat.type;
|
|
1171
|
+
}
|
|
1172
|
+
if (functionName === "IFERROR" || functionName === "IFNA") {
|
|
1173
|
+
return (mergeValueTypes([args[0], args[1]]) ?? derivedNumberFormat.type);
|
|
1174
|
+
}
|
|
1175
|
+
if (functionName === "CHOOSE") {
|
|
1176
|
+
// CHOOSE(index, choice1, choice2, …) — result is one of the
|
|
1177
|
+
// choices, so merge their types like IF/IFS.
|
|
1178
|
+
return (mergeValueTypes(args.slice(1)) ?? derivedNumberFormat.type);
|
|
1179
|
+
}
|
|
1180
|
+
if (functionName === "SWITCH") {
|
|
1181
|
+
// SWITCH(expression, val1, result1, [val2, result2, …], [default]).
|
|
1182
|
+
// Results sit at indices 2, 4, … and an even total arg count
|
|
1183
|
+
// means there's a trailing default at the last position.
|
|
1184
|
+
const valueTypes = [];
|
|
1185
|
+
for (let i = 2; i < args.length; i += 2) {
|
|
1186
|
+
valueTypes.push(args[i]);
|
|
1187
|
+
}
|
|
1188
|
+
if (args.length % 2 === 0) {
|
|
1189
|
+
valueTypes.push(args[args.length - 1]);
|
|
1190
|
+
}
|
|
1191
|
+
return mergeValueTypes(valueTypes) ?? derivedNumberFormat.type;
|
|
1192
|
+
}
|
|
1193
|
+
if (functionName === "ROUND" ||
|
|
1194
|
+
functionName === "ROUNDUP" ||
|
|
1195
|
+
functionName === "ROUNDDOWN" ||
|
|
1196
|
+
functionName === "ABS" ||
|
|
1197
|
+
functionName === "INT") {
|
|
1198
|
+
return args[0] ?? derivedNumberFormat.type;
|
|
1199
|
+
}
|
|
1200
|
+
if (functionName === "MOD" || functionName === "POWER") {
|
|
1201
|
+
return "NUMBER";
|
|
1202
|
+
}
|
|
1203
|
+
if (functionName === "SUMPRODUCT") {
|
|
1204
|
+
const filtered = args.filter((type) => !!type);
|
|
1205
|
+
if (filtered.some(isCurrencyLike)) {
|
|
1206
|
+
return filtered.find(isCurrencyLike) ?? "NUMBER";
|
|
1207
|
+
}
|
|
1208
|
+
return "NUMBER";
|
|
1209
|
+
}
|
|
1210
|
+
if (functionName === "SUM" ||
|
|
1211
|
+
functionName === "AVERAGE" ||
|
|
1212
|
+
functionName === "MIN" ||
|
|
1213
|
+
functionName === "MAX") {
|
|
1214
|
+
return (deriveAggregateType(functionName, args) ?? derivedNumberFormat.type);
|
|
1215
|
+
}
|
|
1216
|
+
const rule = formatDerivationRules[functionName];
|
|
1217
|
+
if (rule) {
|
|
1218
|
+
let targetIndex;
|
|
1219
|
+
if (rule.type === "fixed_index") {
|
|
1220
|
+
targetIndex = rule.index;
|
|
1221
|
+
}
|
|
1222
|
+
else if (rule.type === "conditional_index") {
|
|
1223
|
+
targetIndex = rule.getIndex(args.length);
|
|
1224
|
+
}
|
|
1225
|
+
if (targetIndex !== undefined && args[targetIndex]) {
|
|
1226
|
+
return args[targetIndex];
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
const defaultType = functionReturnTypes[functionName];
|
|
1230
|
+
if (defaultType === "NUMBER") {
|
|
1231
|
+
if (derivedNumberFormat.type === "PERCENT" ||
|
|
1232
|
+
derivedNumberFormat.type === "CURRENCY" ||
|
|
1233
|
+
derivedNumberFormat.type === "ACCOUNTING" ||
|
|
1234
|
+
derivedNumberFormat.type === "SCIENTIFIC") {
|
|
1235
|
+
return derivedNumberFormat.type;
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
return resolveResultsType(defaultType) ?? derivedNumberFormat.type;
|
|
1239
|
+
}
|
|
1240
|
+
case "unknown":
|
|
1241
|
+
return undefined;
|
|
1242
|
+
}
|
|
1243
|
+
};
|
|
1244
|
+
return inferNodeType(ast);
|
|
1245
|
+
};
|
|
1246
|
+
/**
|
|
1247
|
+
* Two phase inference:
|
|
1248
|
+
* 1) parse formula tokens into AST
|
|
1249
|
+
* 2) derive number format type from the AST semantics
|
|
1250
|
+
*/
|
|
1251
|
+
export const getNumberFormatTypeFromFormula = (formula, derivedNumberFormat, draft, tokenizer, sheetId, getSheetId, cellXfsRegistry, getDataValidationById) => {
|
|
1252
|
+
const ast = parseNumberFormatAst(formula, tokenizer, sheetId, getSheetId);
|
|
1253
|
+
if (!ast) {
|
|
1254
|
+
return undefined;
|
|
1255
|
+
}
|
|
1256
|
+
return deriveNumberFormatTypeFromAst(ast, derivedNumberFormat, draft, getDataValidationById, cellXfsRegistry);
|
|
1257
|
+
};
|
|
1258
|
+
/**
|
|
1259
|
+
* AST-based format derivation from formula semantics.
|
|
1260
|
+
* Uses the parser-backed type analysis and preserves source pattern when
|
|
1261
|
+
* the resolved type is unchanged.
|
|
1262
|
+
*/
|
|
1263
|
+
export const getNumberFormatFromFormulaAst = (formula, derivedNumberFormat, draft, tokenizer, sheetId, getSheetId, cellXfsRegistry, getDataValidationById, locale) => {
|
|
1264
|
+
const resolvedType = getNumberFormatTypeFromFormula(formula, derivedNumberFormat, draft, tokenizer, sheetId, getSheetId, cellXfsRegistry, getDataValidationById);
|
|
1265
|
+
if (!resolvedType) {
|
|
1266
|
+
return undefined;
|
|
1267
|
+
}
|
|
1268
|
+
// Keep the exact source pattern for passthrough/same-type formulas
|
|
1269
|
+
// (or when the source is a date-family pattern and the resolved type
|
|
1270
|
+
// is also date-family — keeps `yyyy-mm-dd` etc. through date math).
|
|
1271
|
+
if (resolvedType === derivedNumberFormat.type) {
|
|
1272
|
+
return {
|
|
1273
|
+
type: resolvedType,
|
|
1274
|
+
...(derivedNumberFormat.pattern
|
|
1275
|
+
? { pattern: derivedNumberFormat.pattern }
|
|
1276
|
+
: {}),
|
|
1277
|
+
};
|
|
1278
|
+
}
|
|
1279
|
+
if (isDateFamilyType(resolvedType) &&
|
|
1280
|
+
isDateFamilyType(derivedNumberFormat.type) &&
|
|
1281
|
+
derivedNumberFormat.pattern) {
|
|
1282
|
+
return { type: resolvedType, pattern: derivedNumberFormat.pattern };
|
|
1283
|
+
}
|
|
1284
|
+
// Date-family resolved types without an inheritable pattern need a
|
|
1285
|
+
// concrete default — otherwise the renderer falls back to "General"
|
|
1286
|
+
// and surfaces the serial number (`=NOW()` showed `45000.5` instead
|
|
1287
|
+
// of a date-time string when the calculated-decimals heuristic above
|
|
1288
|
+
// set `numFormat = { type: "NUMBER" }` and the AST then resolved to
|
|
1289
|
+
// DATE_TIME, dropping the pattern).
|
|
1290
|
+
if (resolvedType === "DATE_TIME") {
|
|
1291
|
+
return { type: resolvedType, pattern: getDefaultDateTimeFormat(locale) };
|
|
1292
|
+
}
|
|
1293
|
+
if (resolvedType === "DATE") {
|
|
1294
|
+
return { type: resolvedType, pattern: getDefaultDateFormat(locale) };
|
|
1295
|
+
}
|
|
1296
|
+
if (resolvedType === "TIME") {
|
|
1297
|
+
return { type: resolvedType, pattern: getDefaultTimeFormat(locale) };
|
|
1298
|
+
}
|
|
1299
|
+
return { type: resolvedType };
|
|
1300
|
+
};
|
|
1301
|
+
// Seems hacky ony for percentage
|
|
1302
|
+
export const isPercentageType = (token, sheetId, draft, cellXfsRegistry, getDataValidationById) => {
|
|
1303
|
+
const cell = token ? addressToCell(token.image) : undefined;
|
|
1304
|
+
if (cell) {
|
|
1305
|
+
const sheetCell = new SheetCell(sheetId, cell, draft?.[sheetId]?.[cell.rowIndex]?.values?.[cell.columnIndex], { cellXfsRegistry, getDataValidationById });
|
|
1306
|
+
const curNumFormat = sheetCell.getNumberFormat();
|
|
1307
|
+
return curNumFormat?.type === "PERCENT";
|
|
1308
|
+
}
|
|
1309
|
+
return false;
|
|
1310
|
+
};
|
|
1311
|
+
// Seems hacky ony for percentage
|
|
1312
|
+
export const isDateType = (token, sheetId, draft, cellXfsRegistry, getDataValidationById) => {
|
|
1313
|
+
const cell = token ? addressToCell(token.image) : undefined;
|
|
1314
|
+
if (cell) {
|
|
1315
|
+
const sheetCell = new SheetCell(sheetId, cell, draft?.[sheetId]?.[cell.rowIndex]?.values?.[cell.columnIndex], { cellXfsRegistry, getDataValidationById });
|
|
1316
|
+
const curNumFormat = sheetCell.getNumberFormat();
|
|
1317
|
+
return curNumFormat?.type === "DATE" || curNumFormat?.type === "DATE_TIME";
|
|
1318
|
+
}
|
|
1319
|
+
return false;
|
|
1320
|
+
};
|
|
1321
|
+
const numericLiteralRegex = /^[-+]?(?:\d+(\.\d*)?|\.\d+)$/;
|
|
1322
|
+
const shouldSkipPrecedentFormatInheritance = (formula) => {
|
|
1323
|
+
if (!formula) {
|
|
1324
|
+
return false;
|
|
1325
|
+
}
|
|
1326
|
+
const trimmed = formula.trim();
|
|
1327
|
+
const upper = trimmed.toUpperCase();
|
|
1328
|
+
if (upper.startsWith("=IF(")) {
|
|
1329
|
+
const args = extractTopLevelArgs(trimmed, "=IF");
|
|
1330
|
+
if (args.length < 3) {
|
|
1331
|
+
return false;
|
|
1332
|
+
}
|
|
1333
|
+
const [, trueArg, falseArg] = args;
|
|
1334
|
+
return (numericLiteralRegex.test(trueArg.trim()) &&
|
|
1335
|
+
numericLiteralRegex.test(falseArg.trim()));
|
|
1336
|
+
}
|
|
1337
|
+
if (upper.startsWith("=CHOOSE(")) {
|
|
1338
|
+
const args = extractTopLevelArgs(trimmed, "=CHOOSE");
|
|
1339
|
+
if (args.length < 2) {
|
|
1340
|
+
return false;
|
|
1341
|
+
}
|
|
1342
|
+
const options = args.slice(1);
|
|
1343
|
+
return options.every((option) => numericLiteralRegex.test(option.trim()));
|
|
1344
|
+
}
|
|
1345
|
+
return false;
|
|
1346
|
+
};
|
|
1347
|
+
const extractTopLevelArgs = (formula, prefix) => {
|
|
1348
|
+
const upper = formula.toUpperCase();
|
|
1349
|
+
const startIndex = upper.indexOf(prefix);
|
|
1350
|
+
if (startIndex === -1) {
|
|
1351
|
+
return [];
|
|
1352
|
+
}
|
|
1353
|
+
let parenIndex = startIndex + prefix.length;
|
|
1354
|
+
if (formula[parenIndex] !== "(") {
|
|
1355
|
+
return [];
|
|
1356
|
+
}
|
|
1357
|
+
parenIndex += 1;
|
|
1358
|
+
const args = [];
|
|
1359
|
+
let depth = 0;
|
|
1360
|
+
let current = "";
|
|
1361
|
+
let inString = false;
|
|
1362
|
+
for (let i = parenIndex; i < formula.length; i++) {
|
|
1363
|
+
const char = formula[i];
|
|
1364
|
+
if (char === '"' && formula[i - 1] !== "\\") {
|
|
1365
|
+
inString = !inString;
|
|
1366
|
+
}
|
|
1367
|
+
if (!inString) {
|
|
1368
|
+
if (char === "(") {
|
|
1369
|
+
depth++;
|
|
1370
|
+
}
|
|
1371
|
+
else if (char === ")") {
|
|
1372
|
+
if (depth === 0) {
|
|
1373
|
+
args.push(current);
|
|
1374
|
+
break;
|
|
1375
|
+
}
|
|
1376
|
+
depth--;
|
|
1377
|
+
}
|
|
1378
|
+
else if (char === "," && depth === 0) {
|
|
1379
|
+
args.push(current);
|
|
1380
|
+
current = "";
|
|
1381
|
+
continue;
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
current += char;
|
|
1385
|
+
}
|
|
1386
|
+
return args.map((arg) => arg.trim());
|
|
1387
|
+
};
|
|
1388
|
+
/**
|
|
1389
|
+
* Peek an iterable
|
|
1390
|
+
* @param iterator
|
|
1391
|
+
* @returns
|
|
1392
|
+
*/
|
|
1393
|
+
export const peekIterable = (iterator) => {
|
|
1394
|
+
const items = Array.from(iterator); // Consume entire iterator
|
|
1395
|
+
const peeked = items.length > 0
|
|
1396
|
+
? { done: false, value: items[0] }
|
|
1397
|
+
: { done: true, value: undefined };
|
|
1398
|
+
const rebuiltIterator = function* () {
|
|
1399
|
+
yield* items;
|
|
1400
|
+
};
|
|
1401
|
+
return { peeked, rebuiltIterator };
|
|
1402
|
+
};
|
|
1403
|
+
export const deriveCellFromPrecedents = (formula = "", precedents, draft, sheetId, locale, cellXfsRegistry) => {
|
|
1404
|
+
const trimmedFormula = formula?.trim() ?? "";
|
|
1405
|
+
const directRefRegex = /^=\s*('?[^'!]+?'!)?\$?[A-Z]+\$?\d+$/i;
|
|
1406
|
+
if (!directRefRegex.test(trimmedFormula)) {
|
|
1407
|
+
return undefined;
|
|
1408
|
+
}
|
|
1409
|
+
const sheetCell = new SheetCell(sheetId, defaultCellCoords);
|
|
1410
|
+
for (const precedent of precedents) {
|
|
1411
|
+
// Ignore static node
|
|
1412
|
+
if (isStaticNode(precedent)) {
|
|
1413
|
+
continue;
|
|
1414
|
+
}
|
|
1415
|
+
let rowIndex;
|
|
1416
|
+
let columnIndex;
|
|
1417
|
+
const sheetId = precedent.position.sheetId;
|
|
1418
|
+
// Get the first cell from a range
|
|
1419
|
+
if (isCellCoordinate(precedent.position)) {
|
|
1420
|
+
rowIndex = precedent.position.rowIndex;
|
|
1421
|
+
columnIndex = precedent.position.columnIndex;
|
|
1422
|
+
}
|
|
1423
|
+
else {
|
|
1424
|
+
rowIndex = precedent.position.startRowIndex;
|
|
1425
|
+
columnIndex = precedent.position.startColumnIndex;
|
|
1426
|
+
}
|
|
1427
|
+
sheetCell.assign(sheetId, {
|
|
1428
|
+
rowIndex,
|
|
1429
|
+
columnIndex,
|
|
1430
|
+
}, draft?.[sheetId]?.[rowIndex]?.values?.[columnIndex], {
|
|
1431
|
+
locale,
|
|
1432
|
+
cellXfsRegistry,
|
|
1433
|
+
});
|
|
1434
|
+
return sheetCell.getCellData();
|
|
1435
|
+
}
|
|
1436
|
+
};
|
|
1437
|
+
/**
|
|
1438
|
+
* Parse a literal integer from a VLOOKUP/HLOOKUP col/row-index argument.
|
|
1439
|
+
* Returns undefined for non-literal expressions so the caller can fall
|
|
1440
|
+
* back to a coarser filter.
|
|
1441
|
+
*/
|
|
1442
|
+
const parseLiteralInt = (raw) => {
|
|
1443
|
+
if (!raw)
|
|
1444
|
+
return undefined;
|
|
1445
|
+
const trimmed = raw.trim();
|
|
1446
|
+
if (!/^-?\d+$/.test(trimmed))
|
|
1447
|
+
return undefined;
|
|
1448
|
+
const n = Number(trimmed);
|
|
1449
|
+
return Number.isFinite(n) ? n : undefined;
|
|
1450
|
+
};
|
|
1451
|
+
/**
|
|
1452
|
+
* Filter precedents to a single anchor cell inside a table range, used by
|
|
1453
|
+
* VLOOKUP (`column`) and HLOOKUP (`row`). The anchor is the cell at the
|
|
1454
|
+
* table's start row + selected column (vlookup), or start column +
|
|
1455
|
+
* selected row (hlookup) — matching Excel's first-cell format inheritance
|
|
1456
|
+
* for the looked-up column/row. `offset` is 1-based.
|
|
1457
|
+
*/
|
|
1458
|
+
const filterPrecedentsByTableOffset = (precedents, tableAddress, offset, axis, currentSheetId, getSheetId) => {
|
|
1459
|
+
let targetSheetId = currentSheetId;
|
|
1460
|
+
let rangeStr = tableAddress;
|
|
1461
|
+
if (tableAddress.includes("!")) {
|
|
1462
|
+
const lastBang = tableAddress.lastIndexOf("!");
|
|
1463
|
+
const sheetName = tableAddress
|
|
1464
|
+
.substring(0, lastBang)
|
|
1465
|
+
.replace(/^'|'$/g, "");
|
|
1466
|
+
rangeStr = tableAddress.substring(lastBang + 1);
|
|
1467
|
+
targetSheetId = getSheetId(sheetName);
|
|
1468
|
+
}
|
|
1469
|
+
const parts = rangeStr.split(":");
|
|
1470
|
+
const start = parts.length === 2 ? addressToCell(parts[0]) : addressToCell(rangeStr);
|
|
1471
|
+
const end = parts.length === 2 ? addressToCell(parts[1]) : start;
|
|
1472
|
+
if (!start || !end)
|
|
1473
|
+
return precedents;
|
|
1474
|
+
const minRow = Math.min(start.rowIndex, end.rowIndex);
|
|
1475
|
+
const maxRow = Math.max(start.rowIndex, end.rowIndex);
|
|
1476
|
+
const minCol = Math.min(start.columnIndex, end.columnIndex);
|
|
1477
|
+
const maxCol = Math.max(start.columnIndex, end.columnIndex);
|
|
1478
|
+
// Anchor cell: table-start row × (start col + col_index - 1) for VLOOKUP,
|
|
1479
|
+
// (start row + row_index - 1) × table-start col for HLOOKUP.
|
|
1480
|
+
const anchorRow = axis === "row" ? minRow + (offset - 1) : minRow;
|
|
1481
|
+
const anchorCol = axis === "column" ? minCol + (offset - 1) : minCol;
|
|
1482
|
+
// Out-of-bounds offset → can't form an anchor; fall back to the whole
|
|
1483
|
+
// table so derivation still has something to work with.
|
|
1484
|
+
if (anchorRow < minRow || anchorRow > maxRow || anchorCol < minCol || anchorCol > maxCol) {
|
|
1485
|
+
return filterPrecedentsByAddress(precedents, tableAddress, currentSheetId, getSheetId);
|
|
1486
|
+
}
|
|
1487
|
+
return precedents.filter((p) => {
|
|
1488
|
+
if (isStaticNode(p))
|
|
1489
|
+
return true;
|
|
1490
|
+
if (p.position.sheetId !== targetSheetId)
|
|
1491
|
+
return false;
|
|
1492
|
+
if (isCellCoordinate(p.position)) {
|
|
1493
|
+
return (p.position.rowIndex === anchorRow &&
|
|
1494
|
+
p.position.columnIndex === anchorCol);
|
|
1495
|
+
}
|
|
1496
|
+
const { startRowIndex, startColumnIndex, endRowIndex, endColumnIndex } = p.position;
|
|
1497
|
+
return (startRowIndex <= anchorRow &&
|
|
1498
|
+
endRowIndex >= anchorRow &&
|
|
1499
|
+
startColumnIndex <= anchorCol &&
|
|
1500
|
+
endColumnIndex >= anchorCol);
|
|
1501
|
+
});
|
|
1502
|
+
};
|
|
1503
|
+
const filterPrecedentsByAddress = (precedents, address, currentSheetId, getSheetId) => {
|
|
1504
|
+
let targetSheetId = currentSheetId;
|
|
1505
|
+
let rangeStr = address;
|
|
1506
|
+
if (address.includes("!")) {
|
|
1507
|
+
const lastBang = address.lastIndexOf("!");
|
|
1508
|
+
const sheetName = address.substring(0, lastBang).replace(/^'|'$/g, "");
|
|
1509
|
+
rangeStr = address.substring(lastBang + 1);
|
|
1510
|
+
targetSheetId = getSheetId(sheetName);
|
|
1511
|
+
}
|
|
1512
|
+
const parts = rangeStr.split(":");
|
|
1513
|
+
let start;
|
|
1514
|
+
let end;
|
|
1515
|
+
if (parts.length === 2) {
|
|
1516
|
+
start = addressToCell(parts[0]);
|
|
1517
|
+
end = addressToCell(parts[1]);
|
|
1518
|
+
}
|
|
1519
|
+
else {
|
|
1520
|
+
start = addressToCell(rangeStr);
|
|
1521
|
+
end = start;
|
|
1522
|
+
}
|
|
1523
|
+
if (!start || !end)
|
|
1524
|
+
return precedents;
|
|
1525
|
+
const bounds = {
|
|
1526
|
+
minRow: Math.min(start.rowIndex, end.rowIndex),
|
|
1527
|
+
maxRow: Math.max(start.rowIndex, end.rowIndex),
|
|
1528
|
+
minCol: Math.min(start.columnIndex, end.columnIndex),
|
|
1529
|
+
maxCol: Math.max(start.columnIndex, end.columnIndex),
|
|
1530
|
+
};
|
|
1531
|
+
const filtered = precedents.filter((p) => {
|
|
1532
|
+
if (isStaticNode(p))
|
|
1533
|
+
return true;
|
|
1534
|
+
if (p.position.sheetId !== targetSheetId)
|
|
1535
|
+
return false;
|
|
1536
|
+
if (isCellCoordinate(p.position)) {
|
|
1537
|
+
const { rowIndex, columnIndex } = p.position;
|
|
1538
|
+
return (rowIndex >= bounds.minRow &&
|
|
1539
|
+
rowIndex <= bounds.maxRow &&
|
|
1540
|
+
columnIndex >= bounds.minCol &&
|
|
1541
|
+
columnIndex <= bounds.maxCol);
|
|
1542
|
+
}
|
|
1543
|
+
else {
|
|
1544
|
+
const { startRowIndex, startColumnIndex, endRowIndex, endColumnIndex } = p.position;
|
|
1545
|
+
return !(startRowIndex > bounds.maxRow ||
|
|
1546
|
+
endRowIndex < bounds.minRow ||
|
|
1547
|
+
startColumnIndex > bounds.maxCol ||
|
|
1548
|
+
endColumnIndex < bounds.minCol);
|
|
1549
|
+
}
|
|
1550
|
+
});
|
|
1551
|
+
return filtered.length > 0 ? filtered : precedents;
|
|
1552
|
+
};
|