@rowsncolumns/spreadsheet-state 28.0.76 → 29.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/anchored-objects.d.ts +122 -6
- package/dist/cjs/api/anchored-objects.d.ts.map +1 -1
- package/dist/cjs/api/anchored-objects.js +464 -43
- package/dist/cjs/api/copy-paste.d.ts +8 -2
- package/dist/cjs/api/copy-paste.d.ts.map +1 -1
- package/dist/cjs/api/copy-paste.js +4 -4
- package/dist/cjs/api/filter.d.ts +15 -1
- package/dist/cjs/api/filter.d.ts.map +1 -1
- package/dist/cjs/api/filter.js +32 -2
- package/dist/cjs/api/formula.d.ts +63 -0
- package/dist/cjs/api/formula.d.ts.map +1 -1
- package/dist/cjs/api/formula.js +278 -8
- package/dist/cjs/api/immer-utils.d.ts +11 -1
- package/dist/cjs/api/immer-utils.d.ts.map +1 -1
- package/dist/cjs/api/immer-utils.js +17 -1
- package/dist/cjs/api/insert-cut-cells.d.ts +35 -0
- package/dist/cjs/api/insert-cut-cells.d.ts.map +1 -0
- package/dist/cjs/api/insert-cut-cells.js +60 -0
- package/dist/cjs/api/merges.d.ts +8 -0
- package/dist/cjs/api/merges.d.ts.map +1 -1
- package/dist/cjs/api/merges.js +11 -0
- package/dist/cjs/api/paint-format.d.ts +22 -1
- package/dist/cjs/api/paint-format.d.ts.map +1 -1
- package/dist/cjs/api/paint-format.js +57 -1
- package/dist/cjs/api/sort.d.ts +23 -1
- package/dist/cjs/api/sort.d.ts.map +1 -1
- package/dist/cjs/api/sort.js +52 -6
- package/dist/cjs/api/structural-guards.d.ts +57 -0
- package/dist/cjs/api/structural-guards.d.ts.map +1 -1
- package/dist/cjs/api/structural-guards.js +93 -1
- package/dist/cjs/api/structural-table-refs.d.ts +58 -3
- package/dist/cjs/api/structural-table-refs.d.ts.map +1 -1
- package/dist/cjs/api/structural-table-refs.js +177 -16
- package/dist/cjs/api/subtotal.d.ts +20 -13
- package/dist/cjs/api/subtotal.d.ts.map +1 -1
- package/dist/cjs/api/subtotal.js +26 -19
- package/dist/cjs/api/table.d.ts +26 -2
- package/dist/cjs/api/table.d.ts.map +1 -1
- package/dist/cjs/api/table.js +93 -60
- package/dist/cjs/api/validation.d.ts.map +1 -1
- package/dist/cjs/api/validation.js +53 -8
- package/dist/cjs/atoms/creating-table.atom.d.ts +22 -0
- package/dist/cjs/atoms/creating-table.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/creating-table.atom.js +4 -0
- package/dist/cjs/atoms/dialog-state.atom.d.ts +8 -0
- package/dist/cjs/atoms/dialog-state.atom.d.ts.map +1 -1
- package/dist/cjs/atoms/dialog-state.atom.js +28 -0
- package/dist/cjs/atoms/editing-slicer.atom.d.ts +9 -0
- package/dist/cjs/atoms/editing-slicer.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/editing-slicer.atom.js +6 -0
- package/dist/cjs/atoms/index.d.ts +4 -0
- package/dist/cjs/atoms/index.d.ts.map +1 -1
- package/dist/cjs/atoms/index.js +4 -0
- package/dist/cjs/atoms/inserting-slicer.atom.d.ts +8 -0
- package/dist/cjs/atoms/inserting-slicer.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/inserting-slicer.atom.js +5 -0
- package/dist/cjs/atoms/resizing-table.atom.d.ts +8 -0
- package/dist/cjs/atoms/resizing-table.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/resizing-table.atom.js +5 -0
- package/dist/cjs/commands.d.ts +138 -2
- package/dist/cjs/commands.d.ts.map +1 -1
- package/dist/cjs/components/editors/embed-editor.d.ts +4 -2
- package/dist/cjs/components/editors/embed-editor.d.ts.map +1 -1
- package/dist/cjs/components/editors/embed-editor.js +38 -9
- package/dist/cjs/components/editors/slicer-editor.d.ts +15 -0
- package/dist/cjs/components/editors/slicer-editor.d.ts.map +1 -0
- package/dist/cjs/components/editors/slicer-editor.js +87 -0
- package/dist/cjs/components/editors/table-editor.d.ts +58 -2
- package/dist/cjs/components/editors/table-editor.d.ts.map +1 -1
- package/dist/cjs/components/editors/table-editor.js +261 -20
- package/dist/cjs/components/index.d.ts +1 -0
- package/dist/cjs/components/index.d.ts.map +1 -1
- package/dist/cjs/components/index.js +1 -0
- package/dist/cjs/constants.d.ts +9 -1
- package/dist/cjs/constants.d.ts.map +1 -1
- package/dist/cjs/constants.js +12 -0
- package/dist/cjs/generated-names.d.ts +13 -3
- package/dist/cjs/generated-names.d.ts.map +1 -1
- package/dist/cjs/generated-names.js +3 -1
- package/dist/cjs/helpers.d.ts +5 -0
- package/dist/cjs/helpers.d.ts.map +1 -1
- package/dist/cjs/helpers.js +10 -1
- package/dist/cjs/hooks/use-on-change-batch.d.ts +19 -2
- package/dist/cjs/hooks/use-on-change-batch.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-change-batch.js +43 -35
- package/dist/cjs/hooks/use-on-change-calculated-column.d.ts +10 -1
- package/dist/cjs/hooks/use-on-change-calculated-column.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-change-calculated-column.js +17 -5
- package/dist/cjs/hooks/use-on-change-table-column.d.ts +6 -1
- package/dist/cjs/hooks/use-on-change-table-column.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-change-table-column.js +17 -5
- package/dist/cjs/hooks/use-on-change.d.ts +36 -3
- package/dist/cjs/hooks/use-on-change.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-change.js +218 -136
- package/dist/cjs/hooks/use-on-copy.d.ts +1 -1
- package/dist/cjs/hooks/use-on-copy.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-copy.js +2 -3
- package/dist/cjs/hooks/use-on-create-custom-table-style.d.ts +17 -0
- package/dist/cjs/hooks/use-on-create-custom-table-style.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-create-custom-table-style.js +28 -0
- package/dist/cjs/hooks/use-on-create-named-range.d.ts +4 -2
- package/dist/cjs/hooks/use-on-create-named-range.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-create-named-range.js +11 -1
- package/dist/cjs/hooks/use-on-delete-cells-shift-left.d.ts +2 -1
- package/dist/cjs/hooks/use-on-delete-cells-shift-left.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-delete-cells-shift-left.js +3 -1
- package/dist/cjs/hooks/use-on-delete-cells-shift-up.d.ts +2 -1
- package/dist/cjs/hooks/use-on-delete-cells-shift-up.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-delete-cells-shift-up.js +3 -1
- package/dist/cjs/hooks/use-on-delete-column.d.ts +2 -1
- package/dist/cjs/hooks/use-on-delete-column.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-delete-column.js +3 -1
- package/dist/cjs/hooks/use-on-delete-row.d.ts +2 -1
- package/dist/cjs/hooks/use-on-delete-row.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-delete-row.js +3 -1
- package/dist/cjs/hooks/use-on-delete-sheet.d.ts +9 -1
- package/dist/cjs/hooks/use-on-delete-sheet.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-delete-sheet.js +17 -1
- package/dist/cjs/hooks/use-on-delete-table-row.d.ts +4 -1
- package/dist/cjs/hooks/use-on-delete-table-row.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-delete-table-row.js +19 -1
- package/dist/cjs/hooks/use-on-delete.d.ts +5 -2
- package/dist/cjs/hooks/use-on-delete.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-delete.js +5 -1
- package/dist/cjs/hooks/use-on-embeds.d.ts +7 -4
- package/dist/cjs/hooks/use-on-embeds.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-embeds.js +26 -24
- package/dist/cjs/hooks/use-on-fill.d.ts +17 -2
- package/dist/cjs/hooks/use-on-fill.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-fill.js +29 -15
- package/dist/cjs/hooks/use-on-filter-table.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-filter-table.js +209 -103
- package/dist/cjs/hooks/use-on-import-excel.d.ts +2 -1
- package/dist/cjs/hooks/use-on-import-excel.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-import-excel.js +22 -19
- package/dist/cjs/hooks/use-on-insert-cells-shift-down.d.ts +2 -1
- package/dist/cjs/hooks/use-on-insert-cells-shift-down.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-insert-cells-shift-down.js +3 -1
- package/dist/cjs/hooks/use-on-insert-cells-shift-right.d.ts +2 -1
- package/dist/cjs/hooks/use-on-insert-cells-shift-right.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-insert-cells-shift-right.js +3 -1
- package/dist/cjs/hooks/use-on-insert-column.d.ts +2 -1
- package/dist/cjs/hooks/use-on-insert-column.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-insert-column.js +3 -1
- package/dist/cjs/hooks/use-on-insert-row.d.ts +2 -1
- package/dist/cjs/hooks/use-on-insert-row.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-insert-row.js +3 -1
- package/dist/cjs/hooks/use-on-insert-table-row.d.ts +5 -2
- package/dist/cjs/hooks/use-on-insert-table-row.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-insert-table-row.js +19 -1
- package/dist/cjs/hooks/use-on-merge-unmerge-cells.d.ts +3 -2
- package/dist/cjs/hooks/use-on-merge-unmerge-cells.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-merge-unmerge-cells.js +14 -1
- package/dist/cjs/hooks/use-on-move-columns.d.ts +4 -1
- package/dist/cjs/hooks/use-on-move-columns.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-move-columns.js +28 -6
- package/dist/cjs/hooks/use-on-move-rows.d.ts +18 -1
- package/dist/cjs/hooks/use-on-move-rows.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-move-rows.js +44 -6
- package/dist/cjs/hooks/use-on-move-selection.d.ts +9 -2
- package/dist/cjs/hooks/use-on-move-selection.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-move-selection.js +101 -25
- package/dist/cjs/hooks/use-on-paste.d.ts +33 -2
- package/dist/cjs/hooks/use-on-paste.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-paste.js +1005 -740
- package/dist/cjs/hooks/use-on-remove-duplicates.d.ts +5 -2
- package/dist/cjs/hooks/use-on-remove-duplicates.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-remove-duplicates.js +5 -1
- package/dist/cjs/hooks/use-on-request-create-table.d.ts +13 -0
- package/dist/cjs/hooks/use-on-request-create-table.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-request-create-table.js +44 -0
- package/dist/cjs/hooks/use-on-request-insert-slicer.d.ts +7 -0
- package/dist/cjs/hooks/use-on-request-insert-slicer.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-request-insert-slicer.js +15 -0
- package/dist/cjs/hooks/use-on-request-resize-table.d.ts +7 -0
- package/dist/cjs/hooks/use-on-request-resize-table.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-request-resize-table.js +15 -0
- package/dist/cjs/hooks/use-on-resize-table.d.ts +5 -1
- package/dist/cjs/hooks/use-on-resize-table.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-resize-table.js +110 -33
- package/dist/cjs/hooks/use-on-sort-column.d.ts +28 -3
- package/dist/cjs/hooks/use-on-sort-column.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-sort-column.js +136 -90
- package/dist/cjs/hooks/use-on-sort-range.d.ts +26 -3
- package/dist/cjs/hooks/use-on-sort-range.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-sort-range.js +113 -67
- package/dist/cjs/hooks/use-on-sort-table.d.ts +18 -1
- package/dist/cjs/hooks/use-on-sort-table.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-sort-table.js +128 -98
- package/dist/cjs/hooks/use-on-subtotal.d.ts +10 -3
- package/dist/cjs/hooks/use-on-subtotal.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-subtotal.js +13 -9
- package/dist/cjs/hooks/use-on-table.d.ts +39 -7
- package/dist/cjs/hooks/use-on-table.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-table.js +257 -49
- package/dist/cjs/hooks/use-on-undo-calculated-column.d.ts +23 -0
- package/dist/cjs/hooks/use-on-undo-calculated-column.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-undo-calculated-column.js +70 -0
- package/dist/cjs/hooks/use-on-undo-table-auto-expansion.d.ts +28 -0
- package/dist/cjs/hooks/use-on-undo-table-auto-expansion.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-undo-table-auto-expansion.js +96 -0
- package/dist/cjs/hooks/use-on-update-named-range.d.ts +4 -2
- package/dist/cjs/hooks/use-on-update-named-range.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-update-named-range.js +13 -1
- package/dist/cjs/hooks/use-sheet-properties.d.ts +1 -0
- package/dist/cjs/hooks/use-sheet-properties.d.ts.map +1 -1
- package/dist/cjs/hooks/use-sheet-properties.js +54 -34
- package/dist/cjs/hooks/use-slicers.d.ts +2 -2
- package/dist/cjs/hooks/use-slicers.d.ts.map +1 -1
- package/dist/cjs/hooks/use-slicers.js +17 -26
- package/dist/cjs/hooks/use-sparkline-groups.d.ts +50 -0
- package/dist/cjs/hooks/use-sparkline-groups.d.ts.map +1 -0
- package/dist/cjs/hooks/use-sparkline-groups.js +192 -0
- package/dist/cjs/hooks/use-spreadsheet-state.d.ts +69 -12
- package/dist/cjs/hooks/use-spreadsheet-state.d.ts.map +1 -1
- package/dist/cjs/hooks/use-spreadsheet-state.js +383 -84
- package/dist/cjs/hooks/use-structured-reference.d.ts.map +1 -1
- package/dist/cjs/hooks/use-structured-reference.js +17 -0
- package/dist/cjs/hooks/use-undo-redo-actions.d.ts +2 -1
- package/dist/cjs/hooks/use-undo-redo-actions.d.ts.map +1 -1
- package/dist/cjs/hooks/use-undo-redo-actions.js +10 -2
- package/dist/cjs/hooks/use-undo-redo.d.ts +12 -0
- package/dist/cjs/hooks/use-undo-redo.d.ts.map +1 -1
- package/dist/cjs/hooks/use-undo-redo.js +169 -10
- package/dist/cjs/hooks/utils/sort-rows.d.ts.map +1 -1
- package/dist/cjs/hooks/utils/sort-rows.js +4 -3
- package/dist/cjs/index.d.ts +8 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +9 -0
- package/dist/cjs/interface/apply-fill.d.ts +26 -3
- package/dist/cjs/interface/apply-fill.d.ts.map +1 -1
- package/dist/cjs/interface/apply-fill.js +207 -98
- package/dist/cjs/interface/change-batch.d.ts +1 -1
- package/dist/cjs/interface/change-batch.d.ts.map +1 -1
- package/dist/cjs/interface/change-batch.js +112 -15
- package/dist/cjs/interface/change-calculated-column.d.ts +6 -2
- package/dist/cjs/interface/change-calculated-column.d.ts.map +1 -1
- package/dist/cjs/interface/change-calculated-column.js +87 -17
- package/dist/cjs/interface/change-table-column.d.ts +81 -7
- package/dist/cjs/interface/change-table-column.d.ts.map +1 -1
- package/dist/cjs/interface/change-table-column.js +336 -76
- package/dist/cjs/interface/create-table.d.ts +15 -3
- package/dist/cjs/interface/create-table.d.ts.map +1 -1
- package/dist/cjs/interface/create-table.js +100 -25
- package/dist/cjs/interface/delete-cells-shift-left.d.ts +1 -1
- package/dist/cjs/interface/delete-cells-shift-left.d.ts.map +1 -1
- package/dist/cjs/interface/delete-cells-shift-left.js +10 -1
- package/dist/cjs/interface/delete-cells-shift-up.d.ts +1 -1
- package/dist/cjs/interface/delete-cells-shift-up.d.ts.map +1 -1
- package/dist/cjs/interface/delete-cells-shift-up.js +10 -1
- package/dist/cjs/interface/delete-cells.d.ts +1 -1
- package/dist/cjs/interface/delete-cells.d.ts.map +1 -1
- package/dist/cjs/interface/delete-cells.js +81 -25
- package/dist/cjs/interface/delete-column.d.ts +1 -1
- package/dist/cjs/interface/delete-column.d.ts.map +1 -1
- package/dist/cjs/interface/delete-column.js +29 -22
- package/dist/cjs/interface/delete-row.d.ts +1 -1
- package/dist/cjs/interface/delete-row.d.ts.map +1 -1
- package/dist/cjs/interface/delete-row.js +244 -39
- package/dist/cjs/interface/delete-sheet.d.ts +2 -2
- package/dist/cjs/interface/delete-sheet.d.ts.map +1 -1
- package/dist/cjs/interface/delete-sheet.js +118 -1
- package/dist/cjs/interface/delete-table-column.d.ts +1 -1
- package/dist/cjs/interface/delete-table-column.d.ts.map +1 -1
- package/dist/cjs/interface/delete-table-column.js +11 -1
- package/dist/cjs/interface/delete-table-row.d.ts +1 -1
- package/dist/cjs/interface/delete-table-row.d.ts.map +1 -1
- package/dist/cjs/interface/delete-table-row.js +361 -275
- package/dist/cjs/interface/duplicate-sheet.d.ts.map +1 -1
- package/dist/cjs/interface/duplicate-sheet.js +83 -31
- package/dist/cjs/interface/embeds.d.ts +10 -1
- package/dist/cjs/interface/embeds.d.ts.map +1 -1
- package/dist/cjs/interface/embeds.js +120 -6
- package/dist/cjs/interface/insert-cells-shift-down.d.ts +1 -1
- package/dist/cjs/interface/insert-cells-shift-down.d.ts.map +1 -1
- package/dist/cjs/interface/insert-cells-shift-down.js +10 -1
- package/dist/cjs/interface/insert-cells-shift-right.d.ts +1 -1
- package/dist/cjs/interface/insert-cells-shift-right.d.ts.map +1 -1
- package/dist/cjs/interface/insert-cells-shift-right.js +10 -1
- package/dist/cjs/interface/insert-column.d.ts +2 -2
- package/dist/cjs/interface/insert-column.d.ts.map +1 -1
- package/dist/cjs/interface/insert-column.js +101 -56
- package/dist/cjs/interface/insert-row.d.ts +1 -1
- package/dist/cjs/interface/insert-row.d.ts.map +1 -1
- package/dist/cjs/interface/insert-row.js +25 -7
- package/dist/cjs/interface/insert-table-row.d.ts +2 -1
- package/dist/cjs/interface/insert-table-row.d.ts.map +1 -1
- package/dist/cjs/interface/insert-table-row.js +70 -19
- package/dist/cjs/interface/remove-duplicates.d.ts +1 -1
- package/dist/cjs/interface/remove-duplicates.d.ts.map +1 -1
- package/dist/cjs/interface/remove-duplicates.js +46 -6
- package/dist/cjs/interface/remove-table.d.ts +1 -1
- package/dist/cjs/interface/remove-table.d.ts.map +1 -1
- package/dist/cjs/interface/remove-table.js +72 -16
- package/dist/cjs/interface/slicers.d.ts +12 -1
- package/dist/cjs/interface/slicers.d.ts.map +1 -1
- package/dist/cjs/interface/slicers.js +47 -2
- package/dist/cjs/interface/spreadsheet-interface.d.ts +1 -1
- package/dist/cjs/interface/spreadsheet-interface.d.ts.map +1 -1
- package/dist/cjs/interface/spreadsheet-interface.js +64 -1
- package/dist/cjs/interface/table-totalrow.d.ts +13 -1
- package/dist/cjs/interface/table-totalrow.d.ts.map +1 -1
- package/dist/cjs/interface/table-totalrow.js +107 -73
- package/dist/cjs/interface/table-utils.d.ts +59 -6
- package/dist/cjs/interface/table-utils.d.ts.map +1 -1
- package/dist/cjs/interface/table-utils.js +211 -15
- package/dist/cjs/interface/update-table.d.ts +16 -1
- package/dist/cjs/interface/update-table.d.ts.map +1 -1
- package/dist/cjs/interface/update-table.js +190 -44
- package/dist/cjs/sheet-cell.d.ts.map +1 -1
- package/dist/cjs/test-setup.d.ts.map +1 -1
- package/dist/cjs/test-setup.js +6 -0
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/validation-schema/table.schema.d.ts +11 -0
- package/dist/cjs/validation-schema/table.schema.d.ts.map +1 -1
- package/dist/cjs/validation-schema/table.schema.js +20 -3
- package/dist/esm/api/anchored-objects.d.ts +122 -6
- package/dist/esm/api/anchored-objects.d.ts.map +1 -1
- package/dist/esm/api/anchored-objects.js +375 -15
- package/dist/esm/api/copy-paste.d.ts +8 -2
- package/dist/esm/api/copy-paste.d.ts.map +1 -1
- package/dist/esm/api/copy-paste.js +4 -4
- package/dist/esm/api/filter.d.ts +15 -1
- package/dist/esm/api/filter.d.ts.map +1 -1
- package/dist/esm/api/filter.js +28 -0
- package/dist/esm/api/formula.d.ts +63 -0
- package/dist/esm/api/formula.d.ts.map +1 -1
- package/dist/esm/api/formula.js +235 -8
- package/dist/esm/api/immer-utils.d.ts +11 -1
- package/dist/esm/api/immer-utils.d.ts.map +1 -1
- package/dist/esm/api/immer-utils.js +16 -0
- package/dist/esm/api/insert-cut-cells.d.ts +35 -0
- package/dist/esm/api/insert-cut-cells.d.ts.map +1 -0
- package/dist/esm/api/insert-cut-cells.js +67 -0
- package/dist/esm/api/merges.d.ts +8 -0
- package/dist/esm/api/merges.d.ts.map +1 -1
- package/dist/esm/api/merges.js +9 -0
- package/dist/esm/api/paint-format.d.ts +22 -1
- package/dist/esm/api/paint-format.d.ts.map +1 -1
- package/dist/esm/api/paint-format.js +44 -1
- package/dist/esm/api/sort.d.ts +23 -1
- package/dist/esm/api/sort.d.ts.map +1 -1
- package/dist/esm/api/sort.js +45 -6
- package/dist/esm/api/structural-guards.d.ts +57 -0
- package/dist/esm/api/structural-guards.d.ts.map +1 -1
- package/dist/esm/api/structural-guards.js +85 -0
- package/dist/esm/api/structural-table-refs.d.ts +58 -3
- package/dist/esm/api/structural-table-refs.d.ts.map +1 -1
- package/dist/esm/api/structural-table-refs.js +126 -6
- package/dist/esm/api/subtotal.d.ts +20 -13
- package/dist/esm/api/subtotal.d.ts.map +1 -1
- package/dist/esm/api/subtotal.js +15 -8
- package/dist/esm/api/table.d.ts +26 -2
- package/dist/esm/api/table.d.ts.map +1 -1
- package/dist/esm/api/table.js +70 -48
- package/dist/esm/api/validation.d.ts.map +1 -1
- package/dist/esm/api/validation.js +53 -8
- package/dist/esm/atoms/creating-table.atom.d.ts +22 -0
- package/dist/esm/atoms/creating-table.atom.d.ts.map +1 -0
- package/dist/esm/atoms/creating-table.atom.js +4 -0
- package/dist/esm/atoms/dialog-state.atom.d.ts +8 -0
- package/dist/esm/atoms/dialog-state.atom.d.ts.map +1 -1
- package/dist/esm/atoms/dialog-state.atom.js +12 -0
- package/dist/esm/atoms/editing-slicer.atom.d.ts +9 -0
- package/dist/esm/atoms/editing-slicer.atom.d.ts.map +1 -0
- package/dist/esm/atoms/editing-slicer.atom.js +6 -0
- package/dist/esm/atoms/index.d.ts +4 -0
- package/dist/esm/atoms/index.d.ts.map +1 -1
- package/dist/esm/atoms/index.js +4 -0
- package/dist/esm/atoms/inserting-slicer.atom.d.ts +8 -0
- package/dist/esm/atoms/inserting-slicer.atom.d.ts.map +1 -0
- package/dist/esm/atoms/inserting-slicer.atom.js +5 -0
- package/dist/esm/atoms/resizing-table.atom.d.ts +8 -0
- package/dist/esm/atoms/resizing-table.atom.d.ts.map +1 -0
- package/dist/esm/atoms/resizing-table.atom.js +5 -0
- package/dist/esm/commands.d.ts +138 -2
- package/dist/esm/commands.d.ts.map +1 -1
- package/dist/esm/components/editors/embed-editor.d.ts +4 -2
- package/dist/esm/components/editors/embed-editor.d.ts.map +1 -1
- package/dist/esm/components/editors/embed-editor.js +40 -6
- package/dist/esm/components/editors/slicer-editor.d.ts +15 -0
- package/dist/esm/components/editors/slicer-editor.d.ts.map +1 -0
- package/dist/esm/components/editors/slicer-editor.js +85 -0
- package/dist/esm/components/editors/table-editor.d.ts +58 -2
- package/dist/esm/components/editors/table-editor.d.ts.map +1 -1
- package/dist/esm/components/editors/table-editor.js +243 -19
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/constants.d.ts +9 -1
- package/dist/esm/constants.d.ts.map +1 -1
- package/dist/esm/constants.js +12 -0
- package/dist/esm/generated-names.d.ts +13 -3
- package/dist/esm/generated-names.d.ts.map +1 -1
- package/dist/esm/generated-names.js +3 -1
- package/dist/esm/helpers.d.ts +5 -0
- package/dist/esm/helpers.d.ts.map +1 -1
- package/dist/esm/helpers.js +7 -1
- package/dist/esm/hooks/use-on-change-batch.d.ts +19 -2
- package/dist/esm/hooks/use-on-change-batch.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-change-batch.js +19 -3
- package/dist/esm/hooks/use-on-change-calculated-column.d.ts +10 -1
- package/dist/esm/hooks/use-on-change-calculated-column.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-change-calculated-column.js +17 -5
- package/dist/esm/hooks/use-on-change-table-column.d.ts +6 -1
- package/dist/esm/hooks/use-on-change-table-column.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-change-table-column.js +17 -5
- package/dist/esm/hooks/use-on-change.d.ts +36 -3
- package/dist/esm/hooks/use-on-change.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-change.js +214 -124
- package/dist/esm/hooks/use-on-copy.d.ts +1 -1
- package/dist/esm/hooks/use-on-copy.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-copy.js +2 -3
- package/dist/esm/hooks/use-on-create-custom-table-style.d.ts +17 -0
- package/dist/esm/hooks/use-on-create-custom-table-style.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-create-custom-table-style.js +26 -0
- package/dist/esm/hooks/use-on-create-named-range.d.ts +4 -2
- package/dist/esm/hooks/use-on-create-named-range.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-create-named-range.js +11 -1
- package/dist/esm/hooks/use-on-delete-cells-shift-left.d.ts +2 -1
- package/dist/esm/hooks/use-on-delete-cells-shift-left.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-delete-cells-shift-left.js +3 -1
- package/dist/esm/hooks/use-on-delete-cells-shift-up.d.ts +2 -1
- package/dist/esm/hooks/use-on-delete-cells-shift-up.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-delete-cells-shift-up.js +3 -1
- package/dist/esm/hooks/use-on-delete-column.d.ts +2 -1
- package/dist/esm/hooks/use-on-delete-column.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-delete-column.js +3 -1
- package/dist/esm/hooks/use-on-delete-row.d.ts +2 -1
- package/dist/esm/hooks/use-on-delete-row.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-delete-row.js +3 -1
- package/dist/esm/hooks/use-on-delete-sheet.d.ts +9 -1
- package/dist/esm/hooks/use-on-delete-sheet.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-delete-sheet.js +17 -1
- package/dist/esm/hooks/use-on-delete-table-row.d.ts +4 -1
- package/dist/esm/hooks/use-on-delete-table-row.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-delete-table-row.js +19 -1
- package/dist/esm/hooks/use-on-delete.d.ts +5 -2
- package/dist/esm/hooks/use-on-delete.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-delete.js +5 -1
- package/dist/esm/hooks/use-on-embeds.d.ts +7 -4
- package/dist/esm/hooks/use-on-embeds.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-embeds.js +23 -6
- package/dist/esm/hooks/use-on-fill.d.ts +17 -2
- package/dist/esm/hooks/use-on-fill.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-fill.js +27 -1
- package/dist/esm/hooks/use-on-filter-table.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-filter-table.js +97 -26
- package/dist/esm/hooks/use-on-import-excel.d.ts +2 -1
- package/dist/esm/hooks/use-on-import-excel.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-import-excel.js +4 -1
- package/dist/esm/hooks/use-on-insert-cells-shift-down.d.ts +2 -1
- package/dist/esm/hooks/use-on-insert-cells-shift-down.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-insert-cells-shift-down.js +3 -1
- package/dist/esm/hooks/use-on-insert-cells-shift-right.d.ts +2 -1
- package/dist/esm/hooks/use-on-insert-cells-shift-right.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-insert-cells-shift-right.js +3 -1
- package/dist/esm/hooks/use-on-insert-column.d.ts +2 -1
- package/dist/esm/hooks/use-on-insert-column.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-insert-column.js +3 -1
- package/dist/esm/hooks/use-on-insert-row.d.ts +2 -1
- package/dist/esm/hooks/use-on-insert-row.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-insert-row.js +3 -1
- package/dist/esm/hooks/use-on-insert-table-row.d.ts +5 -2
- package/dist/esm/hooks/use-on-insert-table-row.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-insert-table-row.js +19 -1
- package/dist/esm/hooks/use-on-merge-unmerge-cells.d.ts +3 -2
- package/dist/esm/hooks/use-on-merge-unmerge-cells.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-merge-unmerge-cells.js +12 -1
- package/dist/esm/hooks/use-on-move-columns.d.ts +4 -1
- package/dist/esm/hooks/use-on-move-columns.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-move-columns.js +28 -6
- package/dist/esm/hooks/use-on-move-rows.d.ts +18 -1
- package/dist/esm/hooks/use-on-move-rows.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-move-rows.js +44 -6
- package/dist/esm/hooks/use-on-move-selection.d.ts +9 -2
- package/dist/esm/hooks/use-on-move-selection.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-move-selection.js +57 -1
- package/dist/esm/hooks/use-on-paste.d.ts +33 -2
- package/dist/esm/hooks/use-on-paste.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-paste.js +825 -643
- package/dist/esm/hooks/use-on-remove-duplicates.d.ts +5 -2
- package/dist/esm/hooks/use-on-remove-duplicates.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-remove-duplicates.js +5 -1
- package/dist/esm/hooks/use-on-request-create-table.d.ts +13 -0
- package/dist/esm/hooks/use-on-request-create-table.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-request-create-table.js +43 -0
- package/dist/esm/hooks/use-on-request-insert-slicer.d.ts +7 -0
- package/dist/esm/hooks/use-on-request-insert-slicer.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-request-insert-slicer.js +15 -0
- package/dist/esm/hooks/use-on-request-resize-table.d.ts +7 -0
- package/dist/esm/hooks/use-on-request-resize-table.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-request-resize-table.js +15 -0
- package/dist/esm/hooks/use-on-resize-table.d.ts +5 -1
- package/dist/esm/hooks/use-on-resize-table.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-resize-table.js +107 -27
- package/dist/esm/hooks/use-on-sort-column.d.ts +28 -3
- package/dist/esm/hooks/use-on-sort-column.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-sort-column.js +105 -68
- package/dist/esm/hooks/use-on-sort-range.d.ts +26 -3
- package/dist/esm/hooks/use-on-sort-range.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-sort-range.js +100 -64
- package/dist/esm/hooks/use-on-sort-table.d.ts +18 -1
- package/dist/esm/hooks/use-on-sort-table.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-sort-table.js +107 -86
- package/dist/esm/hooks/use-on-subtotal.d.ts +10 -3
- package/dist/esm/hooks/use-on-subtotal.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-subtotal.js +7 -5
- package/dist/esm/hooks/use-on-table.d.ts +39 -7
- package/dist/esm/hooks/use-on-table.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-table.js +234 -26
- package/dist/esm/hooks/use-on-undo-calculated-column.d.ts +23 -0
- package/dist/esm/hooks/use-on-undo-calculated-column.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-undo-calculated-column.js +62 -0
- package/dist/esm/hooks/use-on-undo-table-auto-expansion.d.ts +28 -0
- package/dist/esm/hooks/use-on-undo-table-auto-expansion.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-undo-table-auto-expansion.js +75 -0
- package/dist/esm/hooks/use-on-update-named-range.d.ts +4 -2
- package/dist/esm/hooks/use-on-update-named-range.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-update-named-range.js +13 -1
- package/dist/esm/hooks/use-sheet-properties.d.ts +1 -0
- package/dist/esm/hooks/use-sheet-properties.d.ts.map +1 -1
- package/dist/esm/hooks/use-sheet-properties.js +38 -19
- package/dist/esm/hooks/use-slicers.d.ts +2 -2
- package/dist/esm/hooks/use-slicers.d.ts.map +1 -1
- package/dist/esm/hooks/use-slicers.js +16 -8
- package/dist/esm/hooks/use-sparkline-groups.d.ts +50 -0
- package/dist/esm/hooks/use-sparkline-groups.d.ts.map +1 -0
- package/dist/esm/hooks/use-sparkline-groups.js +146 -0
- package/dist/esm/hooks/use-spreadsheet-state.d.ts +69 -12
- package/dist/esm/hooks/use-spreadsheet-state.d.ts.map +1 -1
- package/dist/esm/hooks/use-spreadsheet-state.js +321 -14
- package/dist/esm/hooks/use-structured-reference.d.ts.map +1 -1
- package/dist/esm/hooks/use-structured-reference.js +17 -0
- package/dist/esm/hooks/use-undo-redo-actions.d.ts +2 -1
- package/dist/esm/hooks/use-undo-redo-actions.d.ts.map +1 -1
- package/dist/esm/hooks/use-undo-redo-actions.js +8 -2
- package/dist/esm/hooks/use-undo-redo.d.ts +12 -0
- package/dist/esm/hooks/use-undo-redo.d.ts.map +1 -1
- package/dist/esm/hooks/use-undo-redo.js +158 -7
- package/dist/esm/hooks/utils/sort-rows.d.ts.map +1 -1
- package/dist/esm/hooks/utils/sort-rows.js +4 -3
- package/dist/esm/index.d.ts +8 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +9 -0
- package/dist/esm/interface/apply-fill.d.ts +26 -3
- package/dist/esm/interface/apply-fill.d.ts.map +1 -1
- package/dist/esm/interface/apply-fill.js +188 -88
- package/dist/esm/interface/change-batch.d.ts +1 -1
- package/dist/esm/interface/change-batch.d.ts.map +1 -1
- package/dist/esm/interface/change-batch.js +89 -8
- package/dist/esm/interface/change-calculated-column.d.ts +6 -2
- package/dist/esm/interface/change-calculated-column.d.ts.map +1 -1
- package/dist/esm/interface/change-calculated-column.js +81 -16
- package/dist/esm/interface/change-table-column.d.ts +81 -7
- package/dist/esm/interface/change-table-column.d.ts.map +1 -1
- package/dist/esm/interface/change-table-column.js +295 -67
- package/dist/esm/interface/create-table.d.ts +15 -3
- package/dist/esm/interface/create-table.d.ts.map +1 -1
- package/dist/esm/interface/create-table.js +103 -27
- package/dist/esm/interface/delete-cells-shift-left.d.ts +1 -1
- package/dist/esm/interface/delete-cells-shift-left.d.ts.map +1 -1
- package/dist/esm/interface/delete-cells-shift-left.js +10 -1
- package/dist/esm/interface/delete-cells-shift-up.d.ts +1 -1
- package/dist/esm/interface/delete-cells-shift-up.d.ts.map +1 -1
- package/dist/esm/interface/delete-cells-shift-up.js +10 -1
- package/dist/esm/interface/delete-cells.d.ts +1 -1
- package/dist/esm/interface/delete-cells.d.ts.map +1 -1
- package/dist/esm/interface/delete-cells.js +47 -14
- package/dist/esm/interface/delete-column.d.ts +1 -1
- package/dist/esm/interface/delete-column.d.ts.map +1 -1
- package/dist/esm/interface/delete-column.js +26 -30
- package/dist/esm/interface/delete-row.d.ts +1 -1
- package/dist/esm/interface/delete-row.d.ts.map +1 -1
- package/dist/esm/interface/delete-row.js +191 -44
- package/dist/esm/interface/delete-sheet.d.ts +2 -2
- package/dist/esm/interface/delete-sheet.d.ts.map +1 -1
- package/dist/esm/interface/delete-sheet.js +113 -1
- package/dist/esm/interface/delete-table-column.d.ts +1 -1
- package/dist/esm/interface/delete-table-column.d.ts.map +1 -1
- package/dist/esm/interface/delete-table-column.js +11 -1
- package/dist/esm/interface/delete-table-row.d.ts +1 -1
- package/dist/esm/interface/delete-table-row.d.ts.map +1 -1
- package/dist/esm/interface/delete-table-row.js +312 -232
- package/dist/esm/interface/duplicate-sheet.d.ts.map +1 -1
- package/dist/esm/interface/duplicate-sheet.js +73 -26
- package/dist/esm/interface/embeds.d.ts +10 -1
- package/dist/esm/interface/embeds.d.ts.map +1 -1
- package/dist/esm/interface/embeds.js +84 -5
- package/dist/esm/interface/insert-cells-shift-down.d.ts +1 -1
- package/dist/esm/interface/insert-cells-shift-down.d.ts.map +1 -1
- package/dist/esm/interface/insert-cells-shift-down.js +10 -1
- package/dist/esm/interface/insert-cells-shift-right.d.ts +1 -1
- package/dist/esm/interface/insert-cells-shift-right.d.ts.map +1 -1
- package/dist/esm/interface/insert-cells-shift-right.js +10 -1
- package/dist/esm/interface/insert-column.d.ts +2 -2
- package/dist/esm/interface/insert-column.d.ts.map +1 -1
- package/dist/esm/interface/insert-column.js +70 -33
- package/dist/esm/interface/insert-row.d.ts +1 -1
- package/dist/esm/interface/insert-row.d.ts.map +1 -1
- package/dist/esm/interface/insert-row.js +22 -6
- package/dist/esm/interface/insert-table-row.d.ts +2 -1
- package/dist/esm/interface/insert-table-row.d.ts.map +1 -1
- package/dist/esm/interface/insert-table-row.js +67 -12
- package/dist/esm/interface/remove-duplicates.d.ts +1 -1
- package/dist/esm/interface/remove-duplicates.d.ts.map +1 -1
- package/dist/esm/interface/remove-duplicates.js +41 -6
- package/dist/esm/interface/remove-table.d.ts +1 -1
- package/dist/esm/interface/remove-table.d.ts.map +1 -1
- package/dist/esm/interface/remove-table.js +58 -10
- package/dist/esm/interface/slicers.d.ts +12 -1
- package/dist/esm/interface/slicers.d.ts.map +1 -1
- package/dist/esm/interface/slicers.js +44 -2
- package/dist/esm/interface/spreadsheet-interface.d.ts +1 -1
- package/dist/esm/interface/spreadsheet-interface.d.ts.map +1 -1
- package/dist/esm/interface/spreadsheet-interface.js +73 -1
- package/dist/esm/interface/table-totalrow.d.ts +13 -1
- package/dist/esm/interface/table-totalrow.d.ts.map +1 -1
- package/dist/esm/interface/table-totalrow.js +98 -68
- package/dist/esm/interface/table-utils.d.ts +59 -6
- package/dist/esm/interface/table-utils.d.ts.map +1 -1
- package/dist/esm/interface/table-utils.js +155 -14
- package/dist/esm/interface/update-table.d.ts +16 -1
- package/dist/esm/interface/update-table.d.ts.map +1 -1
- package/dist/esm/interface/update-table.js +203 -42
- package/dist/esm/sheet-cell.d.ts.map +1 -1
- package/dist/esm/test-setup.d.ts.map +1 -1
- package/dist/esm/test-setup.js +6 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/validation-schema/table.schema.d.ts +11 -0
- package/dist/esm/validation-schema/table.schema.d.ts.map +1 -1
- package/dist/esm/validation-schema/table.schema.js +15 -2
- package/package.json +25 -17
|
@@ -5,11 +5,12 @@ import { produceWithPatches } from "immer";
|
|
|
5
5
|
import { FILL_UNTOUCHED } from "../api/fill";
|
|
6
6
|
import { createSheetCellIdentifier } from "../api/formula";
|
|
7
7
|
import { createSheetDraft } from "../api/immer-utils";
|
|
8
|
+
import { findAdjacentTable } from "../api/table";
|
|
8
9
|
import { defaultCellCoords, defaultSheetId, SheetCell } from "../sheet-cell";
|
|
9
10
|
import { getFillDirection } from "./../api/selection";
|
|
10
11
|
import { collectDataValidationTarget, extendDataValidationRanges, } from "./data-validation-utils";
|
|
11
12
|
export var applyFill = function (_a) {
|
|
12
|
-
var locale = _a.locale, cellXfsRegistry = _a.cellXfsRegistry, sharedStringRegistry = _a.sharedStringRegistry, getDataValidationById = _a.getDataValidationById, getCellData = _a.getCellData, getEffectiveValue = _a.getEffectiveValue, getFormattedValue = _a.getFormattedValue, getAutoFillValues = _a.getAutoFillValues, getSheetName = _a.getSheetName, enqueueCalculation = _a.enqueueCalculation, enqueueStructureChange = _a.enqueueStructureChange, onChangeSheetData = _a.onChangeSheetData, createHistory = _a.createHistory, onChangeDataValidations = _a.onChangeDataValidations, getMerges = _a.getMerges, onFillMerges = _a.onFillMerges;
|
|
13
|
+
var locale = _a.locale, cellXfsRegistry = _a.cellXfsRegistry, sharedStringRegistry = _a.sharedStringRegistry, getDataValidationById = _a.getDataValidationById, getCellData = _a.getCellData, getEffectiveValue = _a.getEffectiveValue, getFormattedValue = _a.getFormattedValue, getAutoFillValues = _a.getAutoFillValues, getSheetName = _a.getSheetName, enqueueCalculation = _a.enqueueCalculation, enqueueStructureChange = _a.enqueueStructureChange, onChangeSheetData = _a.onChangeSheetData, createHistory = _a.createHistory, onChangeDataValidations = _a.onChangeDataValidations, getMerges = _a.getMerges, onFillMerges = _a.onFillMerges, tables = _a.tables, getUserEnteredValue = _a.getUserEnteredValue, onChangeTableColumn = _a.onChangeTableColumn, _b = _a.batchHistory, batchHistory = _b === void 0 ? function (action) { return action(); } : _b, _c = _a.autoExpandTables, autoExpandTables = _c === void 0 ? true : _c;
|
|
13
14
|
return function (
|
|
14
15
|
// Active sheet ID
|
|
15
16
|
sheetId,
|
|
@@ -23,7 +24,7 @@ export var applyFill = function (_a) {
|
|
|
23
24
|
fillType,
|
|
24
25
|
// Ctrl/Cmd toggle held on the fill handle and/or Series-dialog parameters
|
|
25
26
|
options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
26
|
-
var finalSelections, selection,
|
|
27
|
+
var finalSelections, selection, fillBounds, direction, recalcCells, dataValidationTargets, fillValues, targetBounds, filledArea, tableExpansion, sheetCell, getFillValue, writeCell, writeFilledCell;
|
|
27
28
|
var _a;
|
|
28
29
|
return __generator(this, function (_b) {
|
|
29
30
|
switch (_b.label) {
|
|
@@ -32,7 +33,6 @@ export var applyFill = function (_a) {
|
|
|
32
33
|
? selections
|
|
33
34
|
: selectionFromActiveCell(activeCell);
|
|
34
35
|
selection = finalSelections[finalSelections.length - 1];
|
|
35
|
-
saveHistory = createHistory();
|
|
36
36
|
fillBounds = fillSelection.range;
|
|
37
37
|
direction = getFillDirection(fillSelection, selection);
|
|
38
38
|
recalcCells = new Map();
|
|
@@ -84,6 +84,16 @@ export var applyFill = function (_a) {
|
|
|
84
84
|
startColumnIndex: targetBounds.startColumnIndex,
|
|
85
85
|
endColumnIndex: selection.range.startColumnIndex - 1,
|
|
86
86
|
};
|
|
87
|
+
tableExpansion = autoExpandTables
|
|
88
|
+
? findFillTableExpansion({
|
|
89
|
+
sheetId: sheetId,
|
|
90
|
+
direction: direction,
|
|
91
|
+
selection: selection.range,
|
|
92
|
+
filledArea: filledArea,
|
|
93
|
+
tables: tables,
|
|
94
|
+
getUserEnteredValue: getUserEnteredValue,
|
|
95
|
+
})
|
|
96
|
+
: undefined;
|
|
87
97
|
sheetCell = new SheetCell(defaultSheetId, defaultCellCoords, undefined, { locale: locale, cellXfsRegistry: cellXfsRegistry, getDataValidationById: getDataValidationById });
|
|
88
98
|
getFillValue = function (rowIndex, columnIndex) {
|
|
89
99
|
var _a;
|
|
@@ -133,118 +143,217 @@ export var applyFill = function (_a) {
|
|
|
133
143
|
startColumnIndex: fillBounds.startColumnIndex,
|
|
134
144
|
endColumnIndex: fillBounds.endColumnIndex,
|
|
135
145
|
});
|
|
136
|
-
//
|
|
137
|
-
|
|
138
|
-
var
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
var
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
rowIndex = selection.range.startRowIndex;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
146
|
+
// The fill and the table growth it triggers undo as ONE step.
|
|
147
|
+
batchHistory(function () {
|
|
148
|
+
var saveHistory = createHistory();
|
|
149
|
+
// Copy sheetdata
|
|
150
|
+
onChangeSheetData === null || onChangeSheetData === void 0 ? void 0 : onChangeSheetData(function (prevSheetData) {
|
|
151
|
+
var _a = __read(produceWithPatches(prevSheetData, function (draft) {
|
|
152
|
+
var e_1, _a;
|
|
153
|
+
var _b;
|
|
154
|
+
switch (direction) {
|
|
155
|
+
case Direction.Down: {
|
|
156
|
+
var start = selection.range.endRowIndex + 1;
|
|
157
|
+
var end = targetBounds.endRowIndex;
|
|
158
|
+
var counter = 0;
|
|
159
|
+
for (var i = start; i <= end; i++) {
|
|
160
|
+
var rowIndex = selection.range.startRowIndex + counter;
|
|
161
|
+
if (rowIndex > selection.range.endRowIndex) {
|
|
162
|
+
counter = 0;
|
|
163
|
+
rowIndex = selection.range.startRowIndex;
|
|
164
|
+
}
|
|
165
|
+
var rollingRowIndex = i - start;
|
|
166
|
+
for (var columnIndex = selection.range.startColumnIndex; columnIndex <= selection.range.endColumnIndex; columnIndex++) {
|
|
167
|
+
var rollingColumnIndex = columnIndex - selection.range.startColumnIndex;
|
|
168
|
+
writeFilledCell(draft, i, columnIndex, rollingRowIndex, rollingColumnIndex);
|
|
169
|
+
}
|
|
170
|
+
counter++;
|
|
156
171
|
}
|
|
157
|
-
|
|
172
|
+
break;
|
|
158
173
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
writeFilledCell(draft, i, columnIndex, rollingRowIndex, rollingColumnIndex);
|
|
174
|
+
case Direction.Up: {
|
|
175
|
+
var start = selection.range.startRowIndex - 1;
|
|
176
|
+
var end = targetBounds.startRowIndex;
|
|
177
|
+
for (var i = start; i >= end; i--) {
|
|
178
|
+
var rollingRowIndex = i - targetBounds.startRowIndex;
|
|
179
|
+
for (var columnIndex = selection.range.startColumnIndex; columnIndex <= selection.range.endColumnIndex; columnIndex++) {
|
|
180
|
+
var rollingColumnIndex = columnIndex - selection.range.startColumnIndex;
|
|
181
|
+
writeFilledCell(draft, i, columnIndex, rollingRowIndex, rollingColumnIndex);
|
|
182
|
+
}
|
|
169
183
|
}
|
|
184
|
+
break;
|
|
170
185
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
186
|
+
case Direction.Right: {
|
|
187
|
+
for (var rowIndex = selection.range.startRowIndex; rowIndex <= selection.range.endRowIndex; rowIndex++) {
|
|
188
|
+
var start = selection.range.endColumnIndex + 1;
|
|
189
|
+
var end = targetBounds.endColumnIndex;
|
|
190
|
+
var counter = 0;
|
|
191
|
+
var rollingRowIndex = rowIndex - selection.range.startRowIndex;
|
|
192
|
+
for (var j = start; j <= end; j++) {
|
|
193
|
+
var columnIndex = selection.range.startColumnIndex + counter;
|
|
194
|
+
if (columnIndex > selection.range.endColumnIndex) {
|
|
195
|
+
counter = 0;
|
|
196
|
+
columnIndex = selection.range.startColumnIndex;
|
|
197
|
+
}
|
|
198
|
+
var rollingColumnIndex = j - start;
|
|
199
|
+
writeFilledCell(draft, rowIndex, j, rollingRowIndex, rollingColumnIndex);
|
|
200
|
+
counter++;
|
|
184
201
|
}
|
|
185
|
-
var rollingColumnIndex = j - start;
|
|
186
|
-
writeFilledCell(draft, rowIndex, j, rollingRowIndex, rollingColumnIndex);
|
|
187
|
-
counter++;
|
|
188
202
|
}
|
|
203
|
+
break;
|
|
189
204
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
205
|
+
case Direction.Left: {
|
|
206
|
+
for (var rowIndex = selection.range.startRowIndex; rowIndex <= selection.range.endRowIndex; rowIndex++) {
|
|
207
|
+
var start = selection.range.startColumnIndex - 1;
|
|
208
|
+
var end = targetBounds.startColumnIndex;
|
|
209
|
+
var rollingRowIndex = rowIndex - selection.range.startRowIndex;
|
|
210
|
+
var counter = 0;
|
|
211
|
+
for (var j = start; j >= end; j--) {
|
|
212
|
+
var columnIndex = selection.range.endColumnIndex + counter;
|
|
213
|
+
if (columnIndex < selection.range.startColumnIndex) {
|
|
214
|
+
counter = 0;
|
|
215
|
+
columnIndex = selection.range.endColumnIndex;
|
|
216
|
+
}
|
|
217
|
+
var rollingColumnIndex = j - targetBounds.startColumnIndex;
|
|
218
|
+
writeFilledCell(draft, rowIndex, j, rollingRowIndex, rollingColumnIndex);
|
|
219
|
+
counter--;
|
|
203
220
|
}
|
|
204
|
-
var rollingColumnIndex = j - targetBounds.startColumnIndex;
|
|
205
|
-
writeFilledCell(draft, rowIndex, j, rollingRowIndex, rollingColumnIndex);
|
|
206
|
-
counter--;
|
|
207
221
|
}
|
|
222
|
+
break;
|
|
208
223
|
}
|
|
209
|
-
break;
|
|
210
224
|
}
|
|
211
|
-
}
|
|
212
|
-
try {
|
|
213
|
-
// Series-dialog Trend: the seed cells Excel replaces with the fitted values.
|
|
214
|
-
for (var _c = __values((_b = fillValues.seedCells) !== null && _b !== void 0 ? _b : []), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
215
|
-
var seed = _d.value;
|
|
216
|
-
writeCell(draft, seed.rowIndex, seed.columnIndex, seed.cell);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
220
|
-
finally {
|
|
221
225
|
try {
|
|
222
|
-
|
|
226
|
+
// Series-dialog Trend: the seed cells Excel replaces with the fitted values.
|
|
227
|
+
for (var _c = __values((_b = fillValues.seedCells) !== null && _b !== void 0 ? _b : []), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
228
|
+
var seed = _d.value;
|
|
229
|
+
writeCell(draft, seed.rowIndex, seed.columnIndex, seed.cell);
|
|
230
|
+
}
|
|
223
231
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
232
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
233
|
+
finally {
|
|
234
|
+
try {
|
|
235
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
236
|
+
}
|
|
237
|
+
finally { if (e_1) throw e_1.error; }
|
|
238
|
+
}
|
|
239
|
+
}), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
|
|
240
|
+
// Save history
|
|
241
|
+
saveHistory({
|
|
242
|
+
sheetData: { patches: patches, inversePatches: inversePatches },
|
|
243
|
+
recalcCells: { undo: recalcCells, redo: recalcCells },
|
|
244
|
+
sheetId: { undo: sheetId, redo: sheetId },
|
|
245
|
+
activeCell: { undo: activeCell, redo: activeCell },
|
|
246
|
+
selections: {
|
|
247
|
+
undo: fillableSelections !== null && fillableSelections !== void 0 ? fillableSelections : selections,
|
|
248
|
+
redo: [__assign(__assign({}, fillSelection), { range: targetBounds })],
|
|
249
|
+
},
|
|
250
|
+
});
|
|
251
|
+
extendDataValidationRanges(dataValidationTargets, onChangeDataValidations, saveHistory);
|
|
252
|
+
sharedStringRegistry === null || sharedStringRegistry === void 0 ? void 0 : sharedStringRegistry.getPatches(saveHistory);
|
|
253
|
+
return nextState;
|
|
237
254
|
});
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
255
|
+
// A merged seed replicates its block shape over the filled area (Excel).
|
|
256
|
+
var fillMerges = fillValues.fillMerges;
|
|
257
|
+
if (fillMerges === null || fillMerges === void 0 ? void 0 : fillMerges.length) {
|
|
258
|
+
onFillMerges === null || onFillMerges === void 0 ? void 0 : onFillMerges(sheetId, activeCell, filledArea, fillMerges, targetBounds);
|
|
259
|
+
}
|
|
260
|
+
if (tableExpansion) {
|
|
261
|
+
var table_1 = tableExpansion.table, coords_1 = tableExpansion.coords, isRowExpansion = tableExpansion.isRowExpansion, isColumnExpansion_1 = tableExpansion.isColumnExpansion, range = tableExpansion.range;
|
|
262
|
+
// The header cell of each new column names it (a rightward fill past the table grows it by
|
|
263
|
+
// every filled column); every other expansion needs no value.
|
|
264
|
+
var headerNameAt = function (columnIndex) {
|
|
265
|
+
var _a;
|
|
266
|
+
var headerValue = isColumnExpansion_1 && coords_1.rowIndex === table_1.range.startRowIndex
|
|
267
|
+
? (_a = fillValues[coords_1.rowIndex - selection.range.startRowIndex]) === null || _a === void 0 ? void 0 : _a[columnIndex - (selection.range.endColumnIndex + 1)]
|
|
268
|
+
: undefined;
|
|
269
|
+
var headerName = headerValue === undefined || headerValue === FILL_UNTOUCHED
|
|
270
|
+
? undefined
|
|
271
|
+
: typeof headerValue === "object"
|
|
272
|
+
? new SheetCell(sheetId, { rowIndex: coords_1.rowIndex, columnIndex: columnIndex }, headerValue, { locale: locale }).getUserEnteredValue()
|
|
273
|
+
: headerValue;
|
|
274
|
+
return typeof headerName === "string" || typeof headerName === "boolean"
|
|
275
|
+
? headerName
|
|
276
|
+
: typeof headerName === "number"
|
|
277
|
+
? String(headerName)
|
|
278
|
+
: undefined;
|
|
279
|
+
};
|
|
280
|
+
var headerValues = [];
|
|
281
|
+
for (var columnIndex = coords_1.columnIndex; columnIndex <= range.endColumnIndex; columnIndex++) {
|
|
282
|
+
headerValues.push(headerNameAt(columnIndex));
|
|
283
|
+
}
|
|
284
|
+
onChangeTableColumn === null || onChangeTableColumn === void 0 ? void 0 : onChangeTableColumn(sheetId, coords_1, headerValues[0], table_1, isRowExpansion, isColumnExpansion_1, range, headerValues);
|
|
285
|
+
}
|
|
241
286
|
});
|
|
242
|
-
fillMerges = fillValues.fillMerges;
|
|
243
|
-
if (fillMerges === null || fillMerges === void 0 ? void 0 : fillMerges.length) {
|
|
244
|
-
onFillMerges === null || onFillMerges === void 0 ? void 0 : onFillMerges(sheetId, activeCell, filledArea, fillMerges, targetBounds);
|
|
245
|
-
}
|
|
246
287
|
return [2 /*return*/];
|
|
247
288
|
}
|
|
248
289
|
});
|
|
249
290
|
}); };
|
|
250
291
|
};
|
|
292
|
+
/**
|
|
293
|
+
* The table a fill grows, if any: for a downward fill the first filled row is the row right after a
|
|
294
|
+
* table (within its columns); for a rightward fill the first filled column is the column right after
|
|
295
|
+
* a table (within its rows). The fill may start inside the table — a drag from any body row past the
|
|
296
|
+
* last row grows it from that last row on. Adjacency, the empty-line rule and the totals-row rule
|
|
297
|
+
* (a table with a totals row never auto-grows) are `findAdjacentTable`'s, shared with typing and
|
|
298
|
+
* paste. Fills upward / leftward never grow a table.
|
|
299
|
+
*/
|
|
300
|
+
export var findFillTableExpansion = function (_a) {
|
|
301
|
+
var e_2, _b;
|
|
302
|
+
var sheetId = _a.sheetId, direction = _a.direction, selection = _a.selection, filledArea = _a.filledArea, tables = _a.tables, getUserEnteredValue = _a.getUserEnteredValue;
|
|
303
|
+
if (!(tables === null || tables === void 0 ? void 0 : tables.length) || !getUserEnteredValue) {
|
|
304
|
+
return undefined;
|
|
305
|
+
}
|
|
306
|
+
if (direction !== Direction.Down && direction !== Direction.Right) {
|
|
307
|
+
return undefined;
|
|
308
|
+
}
|
|
309
|
+
try {
|
|
310
|
+
for (var tables_1 = __values(tables), tables_1_1 = tables_1.next(); !tables_1_1.done; tables_1_1 = tables_1.next()) {
|
|
311
|
+
var table = tables_1_1.value;
|
|
312
|
+
if (table.sheetId !== sheetId) {
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
var coords = direction === Direction.Down
|
|
316
|
+
? table.range.endRowIndex + 1 >= filledArea.startRowIndex &&
|
|
317
|
+
table.range.endRowIndex + 1 <= filledArea.endRowIndex &&
|
|
318
|
+
selection.startColumnIndex >= table.range.startColumnIndex &&
|
|
319
|
+
selection.startColumnIndex <= table.range.endColumnIndex
|
|
320
|
+
? {
|
|
321
|
+
rowIndex: table.range.endRowIndex + 1,
|
|
322
|
+
columnIndex: selection.startColumnIndex,
|
|
323
|
+
}
|
|
324
|
+
: undefined
|
|
325
|
+
: table.range.endColumnIndex + 1 >= filledArea.startColumnIndex &&
|
|
326
|
+
table.range.endColumnIndex + 1 <= filledArea.endColumnIndex &&
|
|
327
|
+
selection.startRowIndex >= table.range.startRowIndex &&
|
|
328
|
+
selection.startRowIndex <= table.range.endRowIndex
|
|
329
|
+
? {
|
|
330
|
+
rowIndex: selection.startRowIndex,
|
|
331
|
+
columnIndex: table.range.endColumnIndex + 1,
|
|
332
|
+
}
|
|
333
|
+
: undefined;
|
|
334
|
+
if (!coords) {
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
337
|
+
var _c = __read(findAdjacentTable(sheetId, coords, tables, getUserEnteredValue), 3), adjacentTable = _c[0], isRowExpansion = _c[1], isColumnExpansion = _c[2];
|
|
338
|
+
if (!adjacentTable || !(isRowExpansion || isColumnExpansion)) {
|
|
339
|
+
continue;
|
|
340
|
+
}
|
|
341
|
+
return {
|
|
342
|
+
table: adjacentTable,
|
|
343
|
+
coords: coords,
|
|
344
|
+
isRowExpansion: isRowExpansion,
|
|
345
|
+
isColumnExpansion: isColumnExpansion,
|
|
346
|
+
range: direction === Direction.Down
|
|
347
|
+
? __assign(__assign({}, filledArea), { startRowIndex: coords.rowIndex }) : __assign(__assign({}, filledArea), { startColumnIndex: coords.columnIndex }),
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
352
|
+
finally {
|
|
353
|
+
try {
|
|
354
|
+
if (tables_1_1 && !tables_1_1.done && (_b = tables_1.return)) _b.call(tables_1);
|
|
355
|
+
}
|
|
356
|
+
finally { if (e_2) throw e_2.error; }
|
|
357
|
+
}
|
|
358
|
+
return undefined;
|
|
359
|
+
};
|
|
@@ -35,5 +35,5 @@ export interface ChangeBatchOptions {
|
|
|
35
35
|
*/
|
|
36
36
|
disableTypeInference?: boolean;
|
|
37
37
|
}
|
|
38
|
-
export declare const changeBatch: <T extends CellData, K extends CellFormat, S extends Sheet = Sheet>({ createHistory, enqueueCalculation, onChangeSheetData, onChangeSheets, onChangeTableColumn, onChangeCalculatedColumn, tokenizer, getEffectiveValuesFromRange, locale, cellXfsRegistry, sharedStringRegistry, getDataValidationById, getFormattedValue, getUserEnteredValue, getCellDimensions, getRowHeight, isMergedCell, tables, onChangeCitations, }: UseOnChangeBatchProps<T, S>) => (sheetId: number, ranges: GridRange[] | GridRange, values: (string | boolean | number | undefined | null)[][] | string | boolean | number | undefined | null, formatting?: (K | undefined | null)[][] | K | null | undefined, citations?: (string | undefined | null)[][] | string | null | undefined, options?: ChangeBatchOptions) => void;
|
|
38
|
+
export declare const changeBatch: <T extends CellData, K extends CellFormat, S extends Sheet = Sheet>({ createHistory, enqueueCalculation, enqueueGraphOperation, onChangeSheetData, onChangeSheets, onChangeTables, onChangeTableColumn, onChangeCalculatedColumn, tokenizer, getEffectiveValuesFromRange, locale, cellXfsRegistry, sharedStringRegistry, getDataValidationById, getFormattedValue, getUserEnteredValue, getCellDimensions, getRowHeight, isMergedCell, tables, onChangeCitations, autoExpandTables, generatedNames, }: UseOnChangeBatchProps<T, S>) => (sheetId: number, ranges: GridRange[] | GridRange, values: (string | boolean | number | undefined | null)[][] | string | boolean | number | undefined | null, formatting?: (K | undefined | null)[][] | K | null | undefined, citations?: (string | undefined | null)[][] | string | null | undefined, options?: ChangeBatchOptions) => void;
|
|
39
39
|
//# sourceMappingURL=change-batch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change-batch.d.ts","sourceRoot":"","sources":["../../../interface/change-batch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EACV,QAAQ,EAER,KAAK,EAEN,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"change-batch.d.ts","sourceRoot":"","sources":["../../../interface/change-batch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EACV,QAAQ,EAER,KAAK,EAEN,MAAM,2BAA2B,CAAC;AAkBnC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAK1E,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;;;;;;;;;;;OAcG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,eAAO,MAAM,WAAW,GACtB,CAAC,SAAS,QAAQ,EAClB,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,KAAK,GAAG,KAAK,EACvB,maAwBC,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,MAE1B,SAAS,MAAM,EACf,QAAQ,SAAS,EAAE,GAAG,SAAS,EAC/B,QACI,CAAC,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,GAClD,MAAM,GACN,OAAO,GACP,MAAM,GACN,SAAS,GACT,IAAI,EACR,aAAa,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS,EAC9D,YAAY,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EACvE,UAAS,kBAAuB,SAggBnC,CAAC"}
|
|
@@ -4,15 +4,17 @@ import { alignmentImpliesWrap, isNil } from "@rowsncolumns/utils";
|
|
|
4
4
|
import { produceWithPatches } from "immer";
|
|
5
5
|
import { createSheetCellIdentifier } from "../api/formula";
|
|
6
6
|
import { createSheetDraft } from "../api/immer-utils";
|
|
7
|
+
import { renameHeaderCellsInFormulas } from "../api/structural-table-refs";
|
|
7
8
|
import { findActiveTableWithinCell, findAdjacentTable, removeTableName, } from "../api/table";
|
|
9
|
+
import { planHeaderCellRenames } from "./change-table-column";
|
|
8
10
|
import { SheetCell } from "../sheet-cell";
|
|
9
11
|
export var changeBatch = function (_a) {
|
|
10
|
-
var createHistory = _a.createHistory, enqueueCalculation = _a.enqueueCalculation, onChangeSheetData = _a.onChangeSheetData, onChangeSheets = _a.onChangeSheets, onChangeTableColumn = _a.onChangeTableColumn, onChangeCalculatedColumn = _a.onChangeCalculatedColumn, tokenizer = _a.tokenizer, getEffectiveValuesFromRange = _a.getEffectiveValuesFromRange, locale = _a.locale, cellXfsRegistry = _a.cellXfsRegistry, sharedStringRegistry = _a.sharedStringRegistry, getDataValidationById = _a.getDataValidationById, getFormattedValue = _a.getFormattedValue, getUserEnteredValue = _a.getUserEnteredValue, getCellDimensions = _a.getCellDimensions, getRowHeight = _a.getRowHeight, isMergedCell = _a.isMergedCell, tables = _a.tables, onChangeCitations = _a.onChangeCitations;
|
|
12
|
+
var createHistory = _a.createHistory, enqueueCalculation = _a.enqueueCalculation, enqueueGraphOperation = _a.enqueueGraphOperation, onChangeSheetData = _a.onChangeSheetData, onChangeSheets = _a.onChangeSheets, onChangeTables = _a.onChangeTables, onChangeTableColumn = _a.onChangeTableColumn, onChangeCalculatedColumn = _a.onChangeCalculatedColumn, tokenizer = _a.tokenizer, getEffectiveValuesFromRange = _a.getEffectiveValuesFromRange, locale = _a.locale, cellXfsRegistry = _a.cellXfsRegistry, sharedStringRegistry = _a.sharedStringRegistry, getDataValidationById = _a.getDataValidationById, getFormattedValue = _a.getFormattedValue, getUserEnteredValue = _a.getUserEnteredValue, getCellDimensions = _a.getCellDimensions, getRowHeight = _a.getRowHeight, isMergedCell = _a.isMergedCell, tables = _a.tables, onChangeCitations = _a.onChangeCitations, _b = _a.autoExpandTables, autoExpandTables = _b === void 0 ? true : _b, generatedNames = _a.generatedNames;
|
|
11
13
|
return function (sheetId, ranges, values, formatting, citations, options) {
|
|
12
14
|
var e_1, _a, _b;
|
|
13
|
-
var _c;
|
|
15
|
+
var _c, _d;
|
|
14
16
|
if (options === void 0) { options = {}; }
|
|
15
|
-
var
|
|
17
|
+
var _e = options.enableEvaluation, enableEvaluation = _e === void 0 ? true : _e, _f = options.enableHistory, enableHistory = _f === void 0 ? true : _f, _g = options.formattingOnly, formattingOnly = _g === void 0 ? false : _g, _h = options.disableTypeInference, disableTypeInference = _h === void 0 ? false : _h;
|
|
16
18
|
var saveHistory = enableHistory ? createHistory() : function () { return undefined; };
|
|
17
19
|
// We need to track this for history. Precedent cells
|
|
18
20
|
var recalcCells = new Map();
|
|
@@ -50,12 +52,43 @@ export var changeBatch = function (_a) {
|
|
|
50
52
|
var isColumnExpansion = false;
|
|
51
53
|
var currentTable;
|
|
52
54
|
if (!formattingOnly && (tables === null || tables === void 0 ? void 0 : tables.length) && coords) {
|
|
53
|
-
|
|
55
|
+
if (autoExpandTables) {
|
|
56
|
+
_b = __read(findAdjacentTable(sheetId, coords, tables, getUserEnteredValue), 3), adjacentTable = _b[0], isRowExpansion = _b[1], isColumnExpansion = _b[2];
|
|
57
|
+
}
|
|
54
58
|
currentTable =
|
|
55
59
|
isColumnExpansion && adjacentTable
|
|
56
60
|
? adjacentTable
|
|
57
61
|
: findActiveTableWithinCell(sheetId, coords, tables);
|
|
58
62
|
}
|
|
63
|
+
// Header cells of existing tables the batch lands on take the typed-header
|
|
64
|
+
// rule: text, de-duplicated, structured references following.
|
|
65
|
+
var headerRenames = !formattingOnly && (tables === null || tables === void 0 ? void 0 : tables.length)
|
|
66
|
+
? planHeaderCellRenames({
|
|
67
|
+
sheetId: sheetId,
|
|
68
|
+
tables: tables,
|
|
69
|
+
generatedNames: generatedNames,
|
|
70
|
+
cells: finalRanges.flatMap(function (range) {
|
|
71
|
+
var _a;
|
|
72
|
+
var cells = [];
|
|
73
|
+
for (var rowIndex = range.startRowIndex; rowIndex <= range.endRowIndex; rowIndex++) {
|
|
74
|
+
for (var columnIndex = range.startColumnIndex; columnIndex <= range.endColumnIndex; columnIndex++) {
|
|
75
|
+
cells.push({
|
|
76
|
+
rowIndex: rowIndex,
|
|
77
|
+
columnIndex: columnIndex,
|
|
78
|
+
value: Array.isArray(values)
|
|
79
|
+
? (_a = values[rowIndex - range.startRowIndex]) === null || _a === void 0 ? void 0 : _a[columnIndex - range.startColumnIndex]
|
|
80
|
+
: values,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return cells;
|
|
85
|
+
}),
|
|
86
|
+
})
|
|
87
|
+
: [];
|
|
88
|
+
var headerRenameAt = new Map(headerRenames.map(function (rename) { return [
|
|
89
|
+
"".concat(rename.rowIndex, ":").concat(rename.columnIndex),
|
|
90
|
+
rename,
|
|
91
|
+
]; }));
|
|
59
92
|
// Update sheet data
|
|
60
93
|
onChangeSheetData === null || onChangeSheetData === void 0 ? void 0 : onChangeSheetData(function (prevSheetData) {
|
|
61
94
|
var _a = __read(produceWithPatches(prevSheetData, function (draft) {
|
|
@@ -87,7 +120,14 @@ export var changeBatch = function (_a) {
|
|
|
87
120
|
});
|
|
88
121
|
// Set text value of the cell
|
|
89
122
|
// Skip value changes if formattingOnly is true
|
|
90
|
-
|
|
123
|
+
var headerRename = headerRenameAt.get("".concat(rowIndex, ":").concat(columnIndex));
|
|
124
|
+
if (headerRename) {
|
|
125
|
+
// A table header cell holds its column name as text.
|
|
126
|
+
sheetCell.setUserEnteredValue(headerRename.newName, undefined, {
|
|
127
|
+
disableTypeInference: true,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
else if (!formattingOnly) {
|
|
91
131
|
if (isNil(value_1)) {
|
|
92
132
|
sheetCell.deleteContents();
|
|
93
133
|
}
|
|
@@ -160,6 +200,16 @@ export var changeBatch = function (_a) {
|
|
|
160
200
|
}
|
|
161
201
|
finally { if (e_2) throw e_2.error; }
|
|
162
202
|
}
|
|
203
|
+
renameHeaderCellsInFormulas({
|
|
204
|
+
draft: draft,
|
|
205
|
+
headerRenames: headerRenames,
|
|
206
|
+
enqueueCalculation: enqueueCalculation,
|
|
207
|
+
enqueueGraphOperation: enqueueGraphOperation,
|
|
208
|
+
recalcCells: recalcCells,
|
|
209
|
+
locale: locale,
|
|
210
|
+
cellXfsRegistry: cellXfsRegistry,
|
|
211
|
+
sharedStringRegistry: sharedStringRegistry,
|
|
212
|
+
});
|
|
163
213
|
}), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
|
|
164
214
|
// Save history
|
|
165
215
|
saveHistory({
|
|
@@ -171,8 +221,55 @@ export var changeBatch = function (_a) {
|
|
|
171
221
|
sheetId: { undo: sheetId, redo: sheetId },
|
|
172
222
|
recalcCells: { undo: recalcCells, redo: recalcCells },
|
|
173
223
|
});
|
|
224
|
+
// Flush the registries HERE, after this updater interned the batch's
|
|
225
|
+
// strings and formats. When `onChangeSheetData` is a React state setter
|
|
226
|
+
// and the slice already has an update queued in this tick (a row insert
|
|
227
|
+
// composed with this write — Data → Subtotal, Insert Cut Cells, agent
|
|
228
|
+
// streams), React defers the updater to the render instead of running it
|
|
229
|
+
// eagerly; a flush issued after the dispatch would run before any string
|
|
230
|
+
// was minted, find the registries empty, and leave every text cell of the
|
|
231
|
+
// batch pointing at an `ss` id no table holds — blank locally and after
|
|
232
|
+
// reload. Inside the updater the strings are always there, and the
|
|
233
|
+
// patches land on this same history pointer.
|
|
234
|
+
cellXfsRegistry === null || cellXfsRegistry === void 0 ? void 0 : cellXfsRegistry.getPatches(saveHistory);
|
|
235
|
+
sharedStringRegistry === null || sharedStringRegistry === void 0 ? void 0 : sharedStringRegistry.getPatches(saveHistory);
|
|
174
236
|
return nextState;
|
|
175
237
|
});
|
|
238
|
+
if (headerRenames.length) {
|
|
239
|
+
onChangeTables === null || onChangeTables === void 0 ? void 0 : onChangeTables(function (prevTables) {
|
|
240
|
+
var _a = __read(produceWithPatches(prevTables, function (draft) {
|
|
241
|
+
var e_3, _a;
|
|
242
|
+
var _b;
|
|
243
|
+
var _loop_1 = function (table, dimensionIndex, newName) {
|
|
244
|
+
var current = draft.find(function (candidate) { return candidate.id === table.id; });
|
|
245
|
+
if (!current)
|
|
246
|
+
return "continue";
|
|
247
|
+
(_b = current.columns) !== null && _b !== void 0 ? _b : (current.columns = []);
|
|
248
|
+
if (current.columns[dimensionIndex]) {
|
|
249
|
+
current.columns[dimensionIndex].name = newName;
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
current.columns[dimensionIndex] = { name: newName };
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
try {
|
|
256
|
+
for (var headerRenames_1 = __values(headerRenames), headerRenames_1_1 = headerRenames_1.next(); !headerRenames_1_1.done; headerRenames_1_1 = headerRenames_1.next()) {
|
|
257
|
+
var _c = headerRenames_1_1.value, table = _c.table, dimensionIndex = _c.dimensionIndex, newName = _c.newName;
|
|
258
|
+
_loop_1(table, dimensionIndex, newName);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
262
|
+
finally {
|
|
263
|
+
try {
|
|
264
|
+
if (headerRenames_1_1 && !headerRenames_1_1.done && (_a = headerRenames_1.return)) _a.call(headerRenames_1);
|
|
265
|
+
}
|
|
266
|
+
finally { if (e_3) throw e_3.error; }
|
|
267
|
+
}
|
|
268
|
+
}), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
|
|
269
|
+
saveHistory({ tables: { patches: patches, inversePatches: inversePatches } });
|
|
270
|
+
return nextState;
|
|
271
|
+
});
|
|
272
|
+
}
|
|
176
273
|
// Update sheet rowCount and columnCount if values were added beyond current bounds
|
|
177
274
|
onChangeSheets === null || onChangeSheets === void 0 ? void 0 : onChangeSheets(function (prevSheets) {
|
|
178
275
|
var _a = __read(produceWithPatches(prevSheets, function (draft) {
|
|
@@ -191,10 +288,6 @@ export var changeBatch = function (_a) {
|
|
|
191
288
|
});
|
|
192
289
|
return nextState;
|
|
193
290
|
});
|
|
194
|
-
// Save cellXfs
|
|
195
|
-
cellXfsRegistry === null || cellXfsRegistry === void 0 ? void 0 : cellXfsRegistry.getPatches(saveHistory);
|
|
196
|
-
// Save shared strings patches
|
|
197
|
-
sharedStringRegistry === null || sharedStringRegistry === void 0 ? void 0 : sharedStringRegistry.getPatches(saveHistory);
|
|
198
291
|
// Update row heights when text format or wrapping changes (Excel's
|
|
199
292
|
// justify / distributed alignments wrap implicitly)
|
|
200
293
|
var affectsRowHeight = function (cellFormat) {
|
|
@@ -215,11 +308,11 @@ export var changeBatch = function (_a) {
|
|
|
215
308
|
if (shouldUpdateRowHeights) {
|
|
216
309
|
onChangeSheets(function (prevSheets) {
|
|
217
310
|
var _a = __read(produceWithPatches(prevSheets, function (draft) {
|
|
218
|
-
var
|
|
311
|
+
var e_4, _a;
|
|
219
312
|
var _b, _c, _d, _e, _f;
|
|
220
313
|
var sheet = draft.find(function (sheet) { return sheet.sheetId === sheetId; });
|
|
221
314
|
if (sheet) {
|
|
222
|
-
var
|
|
315
|
+
var _loop_2 = function (range) {
|
|
223
316
|
var rollingRowIndex = 0;
|
|
224
317
|
for (var rowIndex = range.startRowIndex; rowIndex <= range.endRowIndex; rowIndex++) {
|
|
225
318
|
if (Array.isArray(formatting) &&
|
|
@@ -299,15 +392,15 @@ export var changeBatch = function (_a) {
|
|
|
299
392
|
try {
|
|
300
393
|
for (var finalRanges_3 = __values(finalRanges), finalRanges_3_1 = finalRanges_3.next(); !finalRanges_3_1.done; finalRanges_3_1 = finalRanges_3.next()) {
|
|
301
394
|
var range = finalRanges_3_1.value;
|
|
302
|
-
|
|
395
|
+
_loop_2(range);
|
|
303
396
|
}
|
|
304
397
|
}
|
|
305
|
-
catch (
|
|
398
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
306
399
|
finally {
|
|
307
400
|
try {
|
|
308
401
|
if (finalRanges_3_1 && !finalRanges_3_1.done && (_a = finalRanges_3.return)) _a.call(finalRanges_3);
|
|
309
402
|
}
|
|
310
|
-
finally { if (
|
|
403
|
+
finally { if (e_4) throw e_4.error; }
|
|
311
404
|
}
|
|
312
405
|
}
|
|
313
406
|
}), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
|
|
@@ -319,7 +412,11 @@ export var changeBatch = function (_a) {
|
|
|
319
412
|
}
|
|
320
413
|
if (!formattingOnly && (tables === null || tables === void 0 ? void 0 : tables.length) && primaryRange && coords) {
|
|
321
414
|
if (onChangeTableColumn) {
|
|
322
|
-
|
|
415
|
+
// A block written right of the table names every new column from its header cell.
|
|
416
|
+
var headerValues = isColumnExpansion && Array.isArray(values)
|
|
417
|
+
? (_d = values[0]) === null || _d === void 0 ? void 0 : _d.map(function (cell) { return cell !== null && cell !== void 0 ? cell : undefined; })
|
|
418
|
+
: undefined;
|
|
419
|
+
onChangeTableColumn(sheetId, coords, value, adjacentTable, isRowExpansion, isColumnExpansion, primaryRange, headerValues);
|
|
323
420
|
}
|
|
324
421
|
if (onChangeCalculatedColumn) {
|
|
325
422
|
var isAdjacentColumn = currentTable &&
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { CellInterface } from "@rowsncolumns/common-types";
|
|
2
|
-
import type { CellData, TableView } from "@rowsncolumns/spreadsheet";
|
|
2
|
+
import type { CalculatedColumnFill, CellData, TableView } from "@rowsncolumns/spreadsheet";
|
|
3
3
|
import type { UseOnChangeCalculatedColumnProps } from "../hooks/use-on-change-calculated-column";
|
|
4
|
-
export declare const changeCalculatedColumn: <T extends CellData>({ locale, sharedStringRegistry, cellXfsRegistry, onChangeTables, onChangeSheetData, getUserEnteredValue, getSheetName, createHistory, enqueueCalculation, onCommand, }: UseOnChangeCalculatedColumnProps<T>) => (sheetId: number, coords: CellInterface, value: string | boolean | undefined, currentTable: TableView | undefined) =>
|
|
4
|
+
export declare const changeCalculatedColumn: <T extends CellData>({ locale, sharedStringRegistry, cellXfsRegistry, onChangeTables, onChangeSheetData, getUserEnteredValue, getSheetName, createHistory, enqueueCalculation, onCommand, autoCalculatedColumns, }: UseOnChangeCalculatedColumnProps<T>) => (sheetId: number, coords: CellInterface, value: string | boolean | undefined, currentTable: TableView | undefined, options?: ChangeCalculatedColumnOptions) => CalculatedColumnFill | undefined;
|
|
5
|
+
export type ChangeCalculatedColumnOptions = {
|
|
6
|
+
/** Fill the column even over cells that differ from the typed formula (the smart tag's "Overwrite all cells in this column with this formula"). */
|
|
7
|
+
force?: boolean;
|
|
8
|
+
};
|
|
5
9
|
//# sourceMappingURL=change-calculated-column.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change-calculated-column.d.ts","sourceRoot":"","sources":["../../../interface/change-calculated-column.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,4BAA4B,CAAC;AAC3E,OAAO,KAAK,EAEV,QAAQ,EACR,SAAS,EACV,MAAM,2BAA2B,CAAC;AAOnC,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"change-calculated-column.d.ts","sourceRoot":"","sources":["../../../interface/change-calculated-column.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,4BAA4B,CAAC;AAC3E,OAAO,KAAK,EAEV,oBAAoB,EAEpB,QAAQ,EACR,SAAS,EACV,MAAM,2BAA2B,CAAC;AAOnC,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AAQjG,eAAO,MAAM,sBAAsB,GAChC,CAAC,SAAS,QAAQ,EAAE,+LAYlB,gCAAgC,CAAC,CAAC,CAAC,MAEpC,SAAS,MAAM,EACf,QAAQ,aAAa,EACrB,OAAO,MAAM,GAAG,OAAO,GAAG,SAAS,EACnC,cAAc,SAAS,GAAG,SAAS,EACnC,UAAU,6BAA6B,KACtC,oBAAoB,GAAG,SA8PzB,CAAC;AAEJ,MAAM,MAAM,6BAA6B,GAAG;IAC1C,mJAAmJ;IACnJ,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC"}
|