@rowsncolumns/spreadsheet-state 28.0.75 → 29.0.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 +66 -0
- package/dist/cjs/api/anchored-objects.d.ts.map +1 -0
- package/dist/cjs/api/anchored-objects.js +259 -0
- package/dist/cjs/api/copy-paste.d.ts +8 -1
- package/dist/cjs/api/copy-paste.d.ts.map +1 -1
- package/dist/cjs/api/copy-paste.js +4 -2
- package/dist/cjs/api/dependency.d.ts +13 -2
- package/dist/cjs/api/dependency.d.ts.map +1 -1
- package/dist/cjs/api/dependency.js +11 -5
- package/dist/cjs/api/formula.d.ts +61 -4
- package/dist/cjs/api/formula.d.ts.map +1 -1
- package/dist/cjs/api/formula.js +250 -61
- 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 +16 -0
- package/dist/cjs/api/merges.d.ts.map +1 -1
- package/dist/cjs/api/merges.js +75 -1
- package/dist/cjs/api/named-range-structural.d.ts +62 -0
- package/dist/cjs/api/named-range-structural.d.ts.map +1 -0
- package/dist/cjs/api/named-range-structural.js +197 -0
- package/dist/cjs/api/range-rule-helpers.d.ts +45 -1
- package/dist/cjs/api/range-rule-helpers.d.ts.map +1 -1
- package/dist/cjs/api/range-rule-helpers.js +159 -6
- package/dist/cjs/api/structural-formula-update.d.ts.map +1 -1
- package/dist/cjs/api/structural-formula-update.js +24 -6
- package/dist/cjs/api/structural-guards.d.ts +78 -0
- package/dist/cjs/api/structural-guards.d.ts.map +1 -0
- package/dist/cjs/api/structural-guards.js +202 -0
- package/dist/cjs/api/structural-table-refs.d.ts +94 -0
- package/dist/cjs/api/structural-table-refs.d.ts.map +1 -0
- package/dist/cjs/api/structural-table-refs.js +313 -0
- 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/commands.d.ts +9 -0
- package/dist/cjs/commands.d.ts.map +1 -1
- package/dist/cjs/constants.d.ts +25 -0
- package/dist/cjs/constants.d.ts.map +1 -0
- package/dist/cjs/constants.js +26 -0
- package/dist/cjs/hooks/use-calculation-worker.d.ts.map +1 -1
- package/dist/cjs/hooks/use-calculation-worker.js +64 -6
- package/dist/cjs/hooks/use-calculation.d.ts +7 -0
- package/dist/cjs/hooks/use-calculation.d.ts.map +1 -1
- package/dist/cjs/hooks/use-calculation.js +15 -0
- package/dist/cjs/hooks/use-on-calculation-success.d.ts +7 -0
- package/dist/cjs/hooks/use-on-calculation-success.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-calculation-success.js +7 -1
- 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-delete-cells-shift-left.d.ts +13 -3
- 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 +27 -2
- package/dist/cjs/hooks/use-on-delete-cells-shift-up.d.ts +13 -3
- 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 +27 -2
- package/dist/cjs/hooks/use-on-delete-column.d.ts +13 -4
- package/dist/cjs/hooks/use-on-delete-column.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-delete-column.js +14 -2
- package/dist/cjs/hooks/use-on-delete-row.d.ts +13 -4
- package/dist/cjs/hooks/use-on-delete-row.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-delete-row.js +14 -2
- package/dist/cjs/hooks/use-on-insert-cells-shift-down.d.ts +13 -3
- 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 +27 -2
- package/dist/cjs/hooks/use-on-insert-cells-shift-right.d.ts +13 -3
- 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 +27 -2
- package/dist/cjs/hooks/use-on-insert-column.d.ts +10 -3
- package/dist/cjs/hooks/use-on-insert-column.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-insert-column.js +33 -7
- package/dist/cjs/hooks/use-on-insert-row.d.ts +10 -3
- package/dist/cjs/hooks/use-on-insert-row.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-insert-row.js +32 -7
- package/dist/cjs/hooks/use-on-move-columns.d.ts +2 -1
- package/dist/cjs/hooks/use-on-move-columns.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-move-columns.js +14 -5
- package/dist/cjs/hooks/use-on-move-rows.d.ts +16 -1
- package/dist/cjs/hooks/use-on-move-rows.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-move-rows.js +30 -5
- package/dist/cjs/hooks/use-on-move-selection.d.ts +7 -2
- package/dist/cjs/hooks/use-on-move-selection.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-move-selection.js +14 -1
- package/dist/cjs/hooks/use-on-paste.d.ts +12 -2
- package/dist/cjs/hooks/use-on-paste.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-paste.js +56 -8
- package/dist/cjs/hooks/use-spreadsheet-state.d.ts +16 -5
- package/dist/cjs/hooks/use-spreadsheet-state.d.ts.map +1 -1
- package/dist/cjs/hooks/use-spreadsheet-state.js +141 -18
- package/dist/cjs/hooks/use-structured-reference.d.ts.map +1 -1
- package/dist/cjs/hooks/use-structured-reference.js +10 -6
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/interface/calculation-interface.d.ts +9 -0
- package/dist/cjs/interface/calculation-interface.d.ts.map +1 -1
- package/dist/cjs/interface/calculation-interface.js +31 -2
- package/dist/cjs/interface/delete-cells-shift-left.d.ts +8 -1
- package/dist/cjs/interface/delete-cells-shift-left.d.ts.map +1 -1
- package/dist/cjs/interface/delete-cells-shift-left.js +158 -80
- package/dist/cjs/interface/delete-cells-shift-up.d.ts +9 -1
- package/dist/cjs/interface/delete-cells-shift-up.d.ts.map +1 -1
- package/dist/cjs/interface/delete-cells-shift-up.js +155 -73
- 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 +109 -50
- 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 +105 -46
- package/dist/cjs/interface/insert-cells-shift-down.d.ts +10 -1
- package/dist/cjs/interface/insert-cells-shift-down.d.ts.map +1 -1
- package/dist/cjs/interface/insert-cells-shift-down.js +147 -52
- package/dist/cjs/interface/insert-cells-shift-right.d.ts +10 -1
- package/dist/cjs/interface/insert-cells-shift-right.d.ts.map +1 -1
- package/dist/cjs/interface/insert-cells-shift-right.js +154 -58
- package/dist/cjs/interface/insert-column.d.ts +1 -1
- package/dist/cjs/interface/insert-column.d.ts.map +1 -1
- package/dist/cjs/interface/insert-column.js +80 -26
- 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 +63 -15
- package/dist/cjs/interface/spreadsheet-interface.d.ts.map +1 -1
- package/dist/cjs/interface/spreadsheet-interface.js +33 -0
- package/dist/cjs/sheet-cell.d.ts.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/api/anchored-objects.d.ts +66 -0
- package/dist/esm/api/anchored-objects.d.ts.map +1 -0
- package/dist/esm/api/anchored-objects.js +212 -0
- package/dist/esm/api/copy-paste.d.ts +8 -1
- package/dist/esm/api/copy-paste.d.ts.map +1 -1
- package/dist/esm/api/copy-paste.js +4 -2
- package/dist/esm/api/dependency.d.ts +13 -2
- package/dist/esm/api/dependency.d.ts.map +1 -1
- package/dist/esm/api/dependency.js +10 -4
- package/dist/esm/api/formula.d.ts +61 -4
- package/dist/esm/api/formula.d.ts.map +1 -1
- package/dist/esm/api/formula.js +238 -60
- 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 +16 -0
- package/dist/esm/api/merges.d.ts.map +1 -1
- package/dist/esm/api/merges.js +60 -0
- package/dist/esm/api/named-range-structural.d.ts +62 -0
- package/dist/esm/api/named-range-structural.d.ts.map +1 -0
- package/dist/esm/api/named-range-structural.js +176 -0
- package/dist/esm/api/range-rule-helpers.d.ts +45 -1
- package/dist/esm/api/range-rule-helpers.d.ts.map +1 -1
- package/dist/esm/api/range-rule-helpers.js +153 -1
- package/dist/esm/api/structural-formula-update.d.ts.map +1 -1
- package/dist/esm/api/structural-formula-update.js +24 -6
- package/dist/esm/api/structural-guards.d.ts +78 -0
- package/dist/esm/api/structural-guards.d.ts.map +1 -0
- package/dist/esm/api/structural-guards.js +186 -0
- package/dist/esm/api/structural-table-refs.d.ts +94 -0
- package/dist/esm/api/structural-table-refs.d.ts.map +1 -0
- package/dist/esm/api/structural-table-refs.js +219 -0
- 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/commands.d.ts +9 -0
- package/dist/esm/commands.d.ts.map +1 -1
- package/dist/esm/constants.d.ts +25 -0
- package/dist/esm/constants.d.ts.map +1 -0
- package/dist/esm/constants.js +26 -0
- package/dist/esm/hooks/use-calculation-worker.d.ts.map +1 -1
- package/dist/esm/hooks/use-calculation-worker.js +45 -0
- package/dist/esm/hooks/use-calculation.d.ts +7 -0
- package/dist/esm/hooks/use-calculation.d.ts.map +1 -1
- package/dist/esm/hooks/use-calculation.js +15 -0
- package/dist/esm/hooks/use-on-calculation-success.d.ts +7 -0
- package/dist/esm/hooks/use-on-calculation-success.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-calculation-success.js +7 -1
- 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-delete-cells-shift-left.d.ts +13 -3
- 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 +26 -2
- package/dist/esm/hooks/use-on-delete-cells-shift-up.d.ts +13 -3
- 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 +26 -2
- package/dist/esm/hooks/use-on-delete-column.d.ts +13 -4
- package/dist/esm/hooks/use-on-delete-column.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-delete-column.js +14 -2
- package/dist/esm/hooks/use-on-delete-row.d.ts +13 -4
- package/dist/esm/hooks/use-on-delete-row.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-delete-row.js +14 -2
- package/dist/esm/hooks/use-on-insert-cells-shift-down.d.ts +13 -3
- 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 +26 -2
- package/dist/esm/hooks/use-on-insert-cells-shift-right.d.ts +13 -3
- 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 +26 -2
- package/dist/esm/hooks/use-on-insert-column.d.ts +10 -3
- package/dist/esm/hooks/use-on-insert-column.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-insert-column.js +33 -7
- package/dist/esm/hooks/use-on-insert-row.d.ts +10 -3
- package/dist/esm/hooks/use-on-insert-row.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-insert-row.js +32 -7
- package/dist/esm/hooks/use-on-move-columns.d.ts +2 -1
- package/dist/esm/hooks/use-on-move-columns.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-move-columns.js +14 -5
- package/dist/esm/hooks/use-on-move-rows.d.ts +16 -1
- package/dist/esm/hooks/use-on-move-rows.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-move-rows.js +30 -5
- package/dist/esm/hooks/use-on-move-selection.d.ts +7 -2
- package/dist/esm/hooks/use-on-move-selection.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-move-selection.js +14 -1
- package/dist/esm/hooks/use-on-paste.d.ts +12 -2
- package/dist/esm/hooks/use-on-paste.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-paste.js +41 -2
- package/dist/esm/hooks/use-spreadsheet-state.d.ts +16 -5
- package/dist/esm/hooks/use-spreadsheet-state.d.ts.map +1 -1
- package/dist/esm/hooks/use-spreadsheet-state.js +141 -17
- package/dist/esm/hooks/use-structured-reference.d.ts.map +1 -1
- package/dist/esm/hooks/use-structured-reference.js +10 -6
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +4 -0
- package/dist/esm/interface/calculation-interface.d.ts +9 -0
- package/dist/esm/interface/calculation-interface.d.ts.map +1 -1
- package/dist/esm/interface/calculation-interface.js +33 -2
- package/dist/esm/interface/delete-cells-shift-left.d.ts +8 -1
- package/dist/esm/interface/delete-cells-shift-left.d.ts.map +1 -1
- package/dist/esm/interface/delete-cells-shift-left.js +135 -59
- package/dist/esm/interface/delete-cells-shift-up.d.ts +9 -1
- package/dist/esm/interface/delete-cells-shift-up.d.ts.map +1 -1
- package/dist/esm/interface/delete-cells-shift-up.js +133 -53
- 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 +96 -38
- 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 +98 -39
- package/dist/esm/interface/insert-cells-shift-down.d.ts +10 -1
- package/dist/esm/interface/insert-cells-shift-down.d.ts.map +1 -1
- package/dist/esm/interface/insert-cells-shift-down.js +116 -47
- package/dist/esm/interface/insert-cells-shift-right.d.ts +10 -1
- package/dist/esm/interface/insert-cells-shift-right.d.ts.map +1 -1
- package/dist/esm/interface/insert-cells-shift-right.js +120 -51
- package/dist/esm/interface/insert-column.d.ts +1 -1
- package/dist/esm/interface/insert-column.d.ts.map +1 -1
- package/dist/esm/interface/insert-column.js +68 -18
- 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 +60 -14
- package/dist/esm/interface/spreadsheet-interface.d.ts.map +1 -1
- package/dist/esm/interface/spreadsheet-interface.js +29 -0
- package/dist/esm/sheet-cell.d.ts.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +18 -18
|
@@ -4,7 +4,7 @@ import { createNewSheet, DEFAULT_COLUMN_COUNT, DEFAULT_ROW_COUNT, useGetCellDime
|
|
|
4
4
|
import { useFonts } from "@rowsncolumns/spreadsheet";
|
|
5
5
|
import { getBandedCells } from "@rowsncolumns/spreadsheet";
|
|
6
6
|
import { defaultSpreadsheetTheme, useCallbackRef, useSpreadsheetTheme, } from "@rowsncolumns/spreadsheet";
|
|
7
|
-
import { findMatchingBandProperty, getCurrentLocale, isNil, setDefaultEnableAtFormula, uuid, } from "@rowsncolumns/utils";
|
|
7
|
+
import { findMatchingBandProperty, getCurrentLocale, getFormulaLocale, isNil, setDefaultEnableAtFormula, uuid, } from "@rowsncolumns/utils";
|
|
8
8
|
import { enableMapSet, enablePatches, setUseStrictShallowCopy } from "immer";
|
|
9
9
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
10
10
|
import { getAutoFillValues as defaultGetAutoFillValues } from "../api/fill";
|
|
@@ -14,12 +14,13 @@ import { useCalculation } from "./use-calculation";
|
|
|
14
14
|
import { useCalculationInitialize } from "./use-calculation-initialize";
|
|
15
15
|
import { useCalculationWorker } from "./use-calculation-worker";
|
|
16
16
|
import { useCellXfsRegistry } from "./use-cellxfs-registry";
|
|
17
|
-
import { useComments } from "./use-comments";
|
|
18
17
|
import { useCitations } from "./use-citations";
|
|
18
|
+
import { useComments } from "./use-comments";
|
|
19
19
|
import { useConditionalFormattingRules } from "./use-conditional-formatting-rules";
|
|
20
20
|
import { useDataValidationRules } from "./use-data-validation-rules";
|
|
21
21
|
import { useIndent } from "./use-indent";
|
|
22
22
|
import { useNamedRange } from "./use-named-range";
|
|
23
|
+
import { useOnAdvancedFilter } from "./use-on-advanced-filter";
|
|
23
24
|
import { useOnAutoResize } from "./use-on-autoresize";
|
|
24
25
|
import { useOnBandedRanges } from "./use-on-banded-ranges";
|
|
25
26
|
import { useOnCalculationBegin } from "./use-on-calculation-begin";
|
|
@@ -32,6 +33,8 @@ import { useOnChangeFormatting } from "./use-on-change-formatting";
|
|
|
32
33
|
import { useOnChangeSheetTabcolor } from "./use-on-change-sheet-tabcolor";
|
|
33
34
|
import { useOnChangeTheme } from "./use-on-change-theme";
|
|
34
35
|
import { useOnClearFormatting } from "./use-on-clear-formatting";
|
|
36
|
+
import { useOnCollapseColumnGroup } from "./use-on-collapse-column-group";
|
|
37
|
+
import { useOnCollapseRowGroup } from "./use-on-collapse-row-group";
|
|
35
38
|
import { useOnCopy } from "./use-on-copy";
|
|
36
39
|
import { useOnCreateNamedRange } from "./use-on-create-named-range";
|
|
37
40
|
import { useOnCreateNewSheet } from "./use-on-create-sheet";
|
|
@@ -46,23 +49,18 @@ import { useOnDeleteTableRow } from "./use-on-delete-table-row";
|
|
|
46
49
|
import { useOnDragnDrop } from "./use-on-drag-n-drop";
|
|
47
50
|
import { useOnDuplicateSheet } from "./use-on-duplicate-sheet";
|
|
48
51
|
import { useOnEmbeds } from "./use-on-embeds";
|
|
49
|
-
import {
|
|
52
|
+
import { useOnExpandColumnGroup } from "./use-on-expand-column-group";
|
|
53
|
+
import { useOnExpandRowGroup } from "./use-on-expand-row-group";
|
|
50
54
|
import { useOnFill } from "./use-on-fill";
|
|
51
55
|
import { useOnFillRange } from "./use-on-fill-range";
|
|
52
56
|
import { useOnFilterTable } from "./use-on-filter-table";
|
|
53
57
|
import { useOnFindReplace } from "./use-on-find-replace";
|
|
54
58
|
import { useOnFreeze } from "./use-on-freeze";
|
|
55
|
-
import {
|
|
56
|
-
import { useOnCollapseRowGroup } from "./use-on-collapse-row-group";
|
|
57
|
-
import { useOnExpandColumnGroup } from "./use-on-expand-column-group";
|
|
58
|
-
import { useOnExpandRowGroup } from "./use-on-expand-row-group";
|
|
59
|
+
import { useOnGoalSeek } from "./use-on-goal-seek";
|
|
59
60
|
import { useOnGroupColumns } from "./use-on-group-columns";
|
|
60
61
|
import { useOnGroupRows } from "./use-on-group-rows";
|
|
61
|
-
import { useOnSetOutlineDepth } from "./use-on-set-outline-depth";
|
|
62
62
|
import { useOnHideColumn } from "./use-on-hide-column";
|
|
63
63
|
import { useOnHideRow } from "./use-on-hide-row";
|
|
64
|
-
import { useOnUngroupColumns } from "./use-on-ungroup-columns";
|
|
65
|
-
import { useOnUngroupRows } from "./use-on-ungroup-rows";
|
|
66
64
|
import { useOnShowHideSheet } from "./use-on-hide-show-sheet";
|
|
67
65
|
import { useOnImportCSV } from "./use-on-import-csv";
|
|
68
66
|
import { useOnImportCSVLegacy } from "./use-on-import-csv-legacy";
|
|
@@ -80,14 +78,20 @@ import { useOnInsertNote } from "./use-on-insert-note";
|
|
|
80
78
|
import { useOnInsertRow } from "./use-on-insert-row";
|
|
81
79
|
import { useOnInsertTableRow } from "./use-on-insert-table-row";
|
|
82
80
|
import { useOnInsertTime } from "./use-on-insert-time";
|
|
81
|
+
import { useOnLocaleChange } from "./use-on-locale-change";
|
|
83
82
|
import { useOnMergeUnMergeCells } from "./use-on-merge-unmerge-cells";
|
|
84
83
|
import { useOnMoveColumns } from "./use-on-move-columns";
|
|
85
84
|
import { useOnMoveRows } from "./use-on-move-rows";
|
|
86
85
|
import { useOnMoveSelection } from "./use-on-move-selection";
|
|
86
|
+
import { planInsertCutCells } from "../api/insert-cut-cells";
|
|
87
|
+
import { findPartiallyCoveredMerge, MERGED_CELL_MOVE_ERROR } from "../api/merges";
|
|
88
|
+
import { useShowError } from "../atoms/error-state.atom";
|
|
89
|
+
import { SHEET_PROTECTION_ERROR_TITLE, useCanEditCellRange, useCanPerformSheetAction, } from "./use-can-edit-cellrange";
|
|
87
90
|
import { useOnMoveSheet } from "./use-on-move-sheet";
|
|
88
91
|
import { useOnPaste } from "./use-on-paste";
|
|
89
92
|
import { useOnProtectRange } from "./use-on-protect-range";
|
|
90
93
|
import { useOnProtectSheet } from "./use-on-protect-sheet";
|
|
94
|
+
import { useOnRemoveDuplicates } from "./use-on-remove-duplicates";
|
|
91
95
|
import { useOnRenameSheet } from "./use-on-rename-sheet";
|
|
92
96
|
import { useOnRequestCalculateWrapper } from "./use-on-request-calculate-wrapper";
|
|
93
97
|
import { useOnRequestConditionalFormat } from "./use-on-request-conditional-format";
|
|
@@ -102,13 +106,17 @@ import { useOnRequestResize } from "./use-on-request-resize";
|
|
|
102
106
|
import { useOnRequestUpdateNamedRange } from "./use-on-request-update-named-range";
|
|
103
107
|
import { useOnResize } from "./use-on-resize";
|
|
104
108
|
import { useOnResizeTable } from "./use-on-resize-table";
|
|
109
|
+
import { useOnSetOutlineDepth } from "./use-on-set-outline-depth";
|
|
105
110
|
import { useOnShowColumn } from "./use-on-show-column";
|
|
106
111
|
import { useOnShowRow } from "./use-on-show-row";
|
|
107
112
|
import { useOnSortColumn } from "./use-on-sort-column";
|
|
108
113
|
import { useOnSortRange } from "./use-on-sort-range";
|
|
109
114
|
import { useOnSortTable } from "./use-on-sort-table";
|
|
115
|
+
import { useOnSubtotal } from "./use-on-subtotal";
|
|
110
116
|
import { useOnTable } from "./use-on-table";
|
|
111
117
|
import { useOnTraceDependentsPrecedents } from "./use-on-trace-dependents-precedents";
|
|
118
|
+
import { useOnUngroupColumns } from "./use-on-ungroup-columns";
|
|
119
|
+
import { useOnUngroupRows } from "./use-on-ungroup-rows";
|
|
112
120
|
import { useOnUpdateNamedRange } from "./use-on-update-named-range";
|
|
113
121
|
import { useOnUpdateNote } from "./use-on-update-note";
|
|
114
122
|
import { useOnUpdateSheet } from "./use-on-update-sheet";
|
|
@@ -118,12 +126,8 @@ import { useSheetObserver } from "./use-sheet-observer";
|
|
|
118
126
|
import { useSheetProperties } from "./use-sheet-properties";
|
|
119
127
|
import { useSheetState } from "./use-sheet-state";
|
|
120
128
|
import { useSheetDataSubscriber } from "./use-sheetdata-subscriber";
|
|
129
|
+
import { useSlicers } from "./use-slicers";
|
|
121
130
|
import { useSplitTextToColumns } from "./use-split-text-to-columns";
|
|
122
|
-
import { useOnLocaleChange } from "./use-on-locale-change";
|
|
123
|
-
import { useOnRemoveDuplicates } from "./use-on-remove-duplicates";
|
|
124
|
-
import { useOnGoalSeek } from "./use-on-goal-seek";
|
|
125
|
-
import { useOnSubtotal } from "./use-on-subtotal";
|
|
126
|
-
import { useOnAdvancedFilter } from "./use-on-advanced-filter";
|
|
127
131
|
import { useSharedStringRegistry } from "./use-ss-registry";
|
|
128
132
|
import { useStructuredReference } from "./use-structured-reference";
|
|
129
133
|
import { useUndoRedo } from "./use-undo-redo";
|
|
@@ -227,7 +231,7 @@ enableDragnDrop = true,
|
|
|
227
231
|
// Enable undo/redo functionality
|
|
228
232
|
enabledUndoRedo = true,
|
|
229
233
|
// Current locale
|
|
230
|
-
locale = getCurrentLocale(),
|
|
234
|
+
locale = getCurrentLocale(), formulaLocale: formulaLocaleProp,
|
|
231
235
|
// Templates for auto-generated names (sheets, tables, table columns)
|
|
232
236
|
generatedNames: generatedNamesProp, enableAtFormula = false,
|
|
233
237
|
// Preserve data formatting like color, font style on paste
|
|
@@ -528,7 +532,7 @@ sanitizeHtml, }) => {
|
|
|
528
532
|
enabled: calculationMode !== "worker",
|
|
529
533
|
});
|
|
530
534
|
// Use the appropriate calculation hook based on mode
|
|
531
|
-
const { enqueueCalculation, enqueueGraphOperation, enqueueStructureChange, clearRangeCache, onRequestCalculate: onRequestCalculateWithoutFormatting, getPrecedents, getDependents, getPrecedentsFromFormulaString, getGraphNodes, getGraphNodesInSheet, addStaticReference, addFormulaToGraph, removeStaticReference, onResetCalculator, getDependencyGraph, updateDependencyGraph, isArrayFormula, applyNamedRanges, } = calculationMode === "worker" ? workerCalculation : singleCalculation;
|
|
535
|
+
const { enqueueCalculation, enqueueGraphOperation, enqueueStructureChange, clearRangeCache, onRequestCalculate: onRequestCalculateWithoutFormatting, getPrecedents, getDependents, getPrecedentsFromFormulaString, getGraphNodes, getGraphNodesInSheet, addStaticReference, addFormulaToGraph, removeStaticReference, onResetCalculator, getDependencyGraph, updateDependencyGraph, isArrayFormula, getArrayRange, applyNamedRanges, } = calculationMode === "worker" ? workerCalculation : singleCalculation;
|
|
532
536
|
// Bind the forward-ref so `useSheetProperties.getEffectiveFormat` can walk
|
|
533
537
|
// precedents now that the calculator is initialised.
|
|
534
538
|
getPrecedentsRef.current = getPrecedents;
|
|
@@ -960,6 +964,8 @@ sanitizeHtml, }) => {
|
|
|
960
964
|
onCommand,
|
|
961
965
|
});
|
|
962
966
|
// Locale change - regenerate formatted values and normalize validation rules
|
|
967
|
+
// The formula syntax the editors speak — Excel follows the user's language, so `locale` by default.
|
|
968
|
+
const formulaLocale = useMemo(() => getFormulaLocale(formulaLocaleProp ?? locale), [formulaLocaleProp, locale]);
|
|
963
969
|
const onChangeLocale = useOnLocaleChange({
|
|
964
970
|
cellXfsRegistry,
|
|
965
971
|
sharedStringRegistry,
|
|
@@ -1052,8 +1058,14 @@ sanitizeHtml, }) => {
|
|
|
1052
1058
|
onChangeDataValidations,
|
|
1053
1059
|
onChangeCitations,
|
|
1054
1060
|
onChangePivotTables,
|
|
1061
|
+
onChangeNamedRanges,
|
|
1062
|
+
onChangeEmbeds,
|
|
1063
|
+
onChangeCharts,
|
|
1064
|
+
onChangeProtectedRanges,
|
|
1055
1065
|
getSheetName,
|
|
1056
1066
|
onCommand,
|
|
1067
|
+
tables,
|
|
1068
|
+
getArrayRange,
|
|
1057
1069
|
});
|
|
1058
1070
|
// Delete row
|
|
1059
1071
|
const onDeleteColumn = useOnDeleteColumn({
|
|
@@ -1080,8 +1092,14 @@ sanitizeHtml, }) => {
|
|
|
1080
1092
|
onChangeDataValidations,
|
|
1081
1093
|
onChangeCitations,
|
|
1082
1094
|
onChangePivotTables,
|
|
1095
|
+
onChangeNamedRanges,
|
|
1096
|
+
onChangeEmbeds,
|
|
1097
|
+
onChangeCharts,
|
|
1098
|
+
onChangeProtectedRanges,
|
|
1083
1099
|
getSheetName,
|
|
1084
1100
|
onCommand,
|
|
1101
|
+
tables,
|
|
1102
|
+
getArrayRange,
|
|
1085
1103
|
});
|
|
1086
1104
|
// Delete cells shift up
|
|
1087
1105
|
const onDeleteCellsShiftUp = useOnDeleteCellsShiftUp({
|
|
@@ -1093,13 +1111,19 @@ sanitizeHtml, }) => {
|
|
|
1093
1111
|
getActiveCell,
|
|
1094
1112
|
getSelections,
|
|
1095
1113
|
getDependents,
|
|
1114
|
+
getSheetName,
|
|
1096
1115
|
enqueueGraphOperation,
|
|
1097
1116
|
enqueueCalculation,
|
|
1098
1117
|
enqueueStructureChange,
|
|
1099
1118
|
createHistory,
|
|
1100
1119
|
onChangeSheets,
|
|
1101
1120
|
onChangeSheetData,
|
|
1121
|
+
onChangeTables,
|
|
1122
|
+
onChangeCitations,
|
|
1102
1123
|
onCommand,
|
|
1124
|
+
sheetData,
|
|
1125
|
+
sheets,
|
|
1126
|
+
tables,
|
|
1103
1127
|
});
|
|
1104
1128
|
// Delete cells shift left
|
|
1105
1129
|
const onDeleteCellsShiftLeft = useOnDeleteCellsShiftLeft({
|
|
@@ -1111,13 +1135,19 @@ sanitizeHtml, }) => {
|
|
|
1111
1135
|
getActiveCell,
|
|
1112
1136
|
getSelections,
|
|
1113
1137
|
getDependents,
|
|
1138
|
+
getSheetName,
|
|
1114
1139
|
enqueueGraphOperation,
|
|
1115
1140
|
enqueueCalculation,
|
|
1116
1141
|
enqueueStructureChange,
|
|
1117
1142
|
createHistory,
|
|
1118
1143
|
onChangeSheets,
|
|
1119
1144
|
onChangeSheetData,
|
|
1145
|
+
onChangeTables,
|
|
1146
|
+
onChangeCitations,
|
|
1120
1147
|
onCommand,
|
|
1148
|
+
sheetData,
|
|
1149
|
+
sheets,
|
|
1150
|
+
tables,
|
|
1121
1151
|
});
|
|
1122
1152
|
// Insert cells shift right
|
|
1123
1153
|
const onInsertCellsShiftRight = useOnInsertCellsShiftRight({
|
|
@@ -1129,13 +1159,19 @@ sanitizeHtml, }) => {
|
|
|
1129
1159
|
getActiveCell,
|
|
1130
1160
|
getSelections,
|
|
1131
1161
|
getDependents,
|
|
1162
|
+
getSheetName,
|
|
1132
1163
|
enqueueGraphOperation,
|
|
1133
1164
|
enqueueCalculation,
|
|
1134
1165
|
enqueueStructureChange,
|
|
1135
1166
|
createHistory,
|
|
1136
1167
|
onChangeSheets,
|
|
1137
1168
|
onChangeSheetData,
|
|
1169
|
+
onChangeTables,
|
|
1170
|
+
onChangeCitations,
|
|
1138
1171
|
onCommand,
|
|
1172
|
+
sheetData,
|
|
1173
|
+
sheets,
|
|
1174
|
+
tables,
|
|
1139
1175
|
});
|
|
1140
1176
|
// Delete cells shift up
|
|
1141
1177
|
const onInsertCellsShiftDown = useOnInsertCellsShiftDown({
|
|
@@ -1147,13 +1183,19 @@ sanitizeHtml, }) => {
|
|
|
1147
1183
|
getActiveCell,
|
|
1148
1184
|
getSelections,
|
|
1149
1185
|
getDependents,
|
|
1186
|
+
getSheetName,
|
|
1150
1187
|
enqueueGraphOperation,
|
|
1151
1188
|
enqueueCalculation,
|
|
1152
1189
|
enqueueStructureChange,
|
|
1153
1190
|
createHistory,
|
|
1154
1191
|
onChangeSheets,
|
|
1155
1192
|
onChangeSheetData,
|
|
1193
|
+
onChangeTables,
|
|
1194
|
+
onChangeCitations,
|
|
1156
1195
|
onCommand,
|
|
1196
|
+
sheetData,
|
|
1197
|
+
sheets,
|
|
1198
|
+
tables,
|
|
1157
1199
|
});
|
|
1158
1200
|
// Insert row
|
|
1159
1201
|
const onInsertRow = useOnInsertRow({
|
|
@@ -1161,6 +1203,7 @@ sanitizeHtml, }) => {
|
|
|
1161
1203
|
columnCount,
|
|
1162
1204
|
locale,
|
|
1163
1205
|
maxRowCount,
|
|
1206
|
+
sheetData,
|
|
1164
1207
|
cellXfsRegistry,
|
|
1165
1208
|
getActiveCell,
|
|
1166
1209
|
getSelections,
|
|
@@ -1177,6 +1220,10 @@ sanitizeHtml, }) => {
|
|
|
1177
1220
|
onChangeDataValidations,
|
|
1178
1221
|
onChangeCitations,
|
|
1179
1222
|
onChangePivotTables,
|
|
1223
|
+
onChangeNamedRanges,
|
|
1224
|
+
onChangeEmbeds,
|
|
1225
|
+
onChangeCharts,
|
|
1226
|
+
onChangeProtectedRanges,
|
|
1180
1227
|
onChangeTables,
|
|
1181
1228
|
getSheetName,
|
|
1182
1229
|
onCommand,
|
|
@@ -1188,6 +1235,7 @@ sanitizeHtml, }) => {
|
|
|
1188
1235
|
locale,
|
|
1189
1236
|
tables,
|
|
1190
1237
|
maxColumnCount,
|
|
1238
|
+
sheetData,
|
|
1191
1239
|
cellXfsRegistry,
|
|
1192
1240
|
sharedStringRegistry,
|
|
1193
1241
|
getDependents,
|
|
@@ -1204,6 +1252,10 @@ sanitizeHtml, }) => {
|
|
|
1204
1252
|
onChangeDataValidations,
|
|
1205
1253
|
onChangeCitations,
|
|
1206
1254
|
onChangePivotTables,
|
|
1255
|
+
onChangeNamedRanges,
|
|
1256
|
+
onChangeEmbeds,
|
|
1257
|
+
onChangeCharts,
|
|
1258
|
+
onChangeProtectedRanges,
|
|
1207
1259
|
getActiveCell,
|
|
1208
1260
|
getSelections,
|
|
1209
1261
|
getSheetName,
|
|
@@ -1253,6 +1305,7 @@ sanitizeHtml, }) => {
|
|
|
1253
1305
|
const onMoveSelection = useOnMoveSelection({
|
|
1254
1306
|
rowCount,
|
|
1255
1307
|
columnCount,
|
|
1308
|
+
getSheetMerges: getPaintMerges,
|
|
1256
1309
|
enqueueGraphOperation,
|
|
1257
1310
|
enqueueCalculation,
|
|
1258
1311
|
enqueueStructureChange,
|
|
@@ -1273,6 +1326,72 @@ sanitizeHtml, }) => {
|
|
|
1273
1326
|
sharedStringRegistry,
|
|
1274
1327
|
onCommand,
|
|
1275
1328
|
});
|
|
1329
|
+
// Excel "Insert Cut Cells" / Shift+drag for a cell range, as the three structural steps the
|
|
1330
|
+
// hooks above own (`planInsertCutCells`): open the destination band, move the block into the
|
|
1331
|
+
// opening, close the gap it left — so Shift+drag A5 to A2 over r1..r6 gives r1 r5 r2 r3 r4 r6 and
|
|
1332
|
+
// a forward move lands before Excel's pre-removal reference row. The refusals are decided up
|
|
1333
|
+
// front — a merge the block or a shifted band covers only partially, a protected range — so a
|
|
1334
|
+
// refused move never leaves the band opened. Each step records its own undo entry.
|
|
1335
|
+
const showError = useShowError();
|
|
1336
|
+
const canEditCellRange = useCanEditCellRange();
|
|
1337
|
+
const canPerformSheetAction = useCanPerformSheetAction();
|
|
1338
|
+
const onInsertCutCells = useCallback((sheetId, from, to) => {
|
|
1339
|
+
const plan = planInsertCutCells(from.range, to.range);
|
|
1340
|
+
if (!plan) {
|
|
1341
|
+
return;
|
|
1342
|
+
}
|
|
1343
|
+
const merges = getPaintMerges(sheetId);
|
|
1344
|
+
if ([from.range, to.range, ...plan.bands].some((range) => findPartiallyCoveredMerge(range, merges))) {
|
|
1345
|
+
showError({ message: MERGED_CELL_MOVE_ERROR });
|
|
1346
|
+
return;
|
|
1347
|
+
}
|
|
1348
|
+
const vertical = plan.shift === "down";
|
|
1349
|
+
if (!canEditCellRange(sheetId, from.range) ||
|
|
1350
|
+
!canEditCellRange(sheetId, to.range) ||
|
|
1351
|
+
!canPerformSheetAction(sheetId, vertical ? "insertRows" : "insertColumns") ||
|
|
1352
|
+
!canPerformSheetAction(sheetId, vertical ? "deleteRows" : "deleteColumns")) {
|
|
1353
|
+
showError({
|
|
1354
|
+
title: SHEET_PROTECTION_ERROR_TITLE,
|
|
1355
|
+
message: "You can't move cells on a protected sheet.",
|
|
1356
|
+
});
|
|
1357
|
+
return;
|
|
1358
|
+
}
|
|
1359
|
+
const target = {
|
|
1360
|
+
rowIndex: to.range.startRowIndex,
|
|
1361
|
+
columnIndex: to.range.startColumnIndex,
|
|
1362
|
+
};
|
|
1363
|
+
if (vertical) {
|
|
1364
|
+
onInsertCellsShiftDown(sheetId, target, [to]);
|
|
1365
|
+
}
|
|
1366
|
+
else {
|
|
1367
|
+
onInsertCellsShiftRight(sheetId, target, [to]);
|
|
1368
|
+
}
|
|
1369
|
+
const source = {
|
|
1370
|
+
...from,
|
|
1371
|
+
range: plan.shiftedSource,
|
|
1372
|
+
};
|
|
1373
|
+
onMoveSelection(sheetId, source, to);
|
|
1374
|
+
const vacated = {
|
|
1375
|
+
rowIndex: plan.shiftedSource.startRowIndex,
|
|
1376
|
+
columnIndex: plan.shiftedSource.startColumnIndex,
|
|
1377
|
+
};
|
|
1378
|
+
if (vertical) {
|
|
1379
|
+
onDeleteCellsShiftUp(sheetId, vacated, [source]);
|
|
1380
|
+
}
|
|
1381
|
+
else {
|
|
1382
|
+
onDeleteCellsShiftLeft(sheetId, vacated, [source]);
|
|
1383
|
+
}
|
|
1384
|
+
}, [
|
|
1385
|
+
getPaintMerges,
|
|
1386
|
+
showError,
|
|
1387
|
+
canEditCellRange,
|
|
1388
|
+
canPerformSheetAction,
|
|
1389
|
+
onInsertCellsShiftDown,
|
|
1390
|
+
onInsertCellsShiftRight,
|
|
1391
|
+
onDeleteCellsShiftUp,
|
|
1392
|
+
onDeleteCellsShiftLeft,
|
|
1393
|
+
onMoveSelection,
|
|
1394
|
+
]);
|
|
1276
1395
|
// Sort column
|
|
1277
1396
|
const onSortColumn = useOnSortColumn({
|
|
1278
1397
|
rowCount,
|
|
@@ -1368,6 +1487,8 @@ sanitizeHtml, }) => {
|
|
|
1368
1487
|
columnCount,
|
|
1369
1488
|
locale,
|
|
1370
1489
|
sheetData,
|
|
1490
|
+
onChangeNamedRanges,
|
|
1491
|
+
getSheetMerges: getPaintMerges,
|
|
1371
1492
|
getDataValidationById,
|
|
1372
1493
|
preserveFormatting: preserveFormattingOnPaste,
|
|
1373
1494
|
maxColumnCount,
|
|
@@ -1966,6 +2087,7 @@ sanitizeHtml, }) => {
|
|
|
1966
2087
|
onMoveColumns,
|
|
1967
2088
|
onMoveRows,
|
|
1968
2089
|
onMoveSelection,
|
|
2090
|
+
onInsertCutCells,
|
|
1969
2091
|
onSortColumn,
|
|
1970
2092
|
onSortTable,
|
|
1971
2093
|
onFilterTable,
|
|
@@ -2083,6 +2205,8 @@ sanitizeHtml, }) => {
|
|
|
2083
2205
|
onClearHistory,
|
|
2084
2206
|
// Locale change
|
|
2085
2207
|
onChangeLocale,
|
|
2208
|
+
// Resolved formula syntax locale (see the `formulaLocale` option)
|
|
2209
|
+
formulaLocale,
|
|
2086
2210
|
// Comments
|
|
2087
2211
|
onInsertComment,
|
|
2088
2212
|
onRemoveComment,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-structured-reference.d.ts","sourceRoot":"","sources":["../../../hooks/use-structured-reference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAG/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAK3D,eAAO,MAAM,sBAAsB,GAAI,oCAIpC;IACD,MAAM,EAAE,SAAS,EAAE,GAAG,SAAS,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;CACvC,iBAGgB,MAAM,GAAG,SAAS,eAChB,MAAM,EAAE,GAAG,SAAS,WACxB,OAAO,eACH,MAAM,GAAG,SAAS,aACpB,MAAM,QACX,UAAU,KACf,SAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"use-structured-reference.d.ts","sourceRoot":"","sources":["../../../hooks/use-structured-reference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAG/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAK3D,eAAO,MAAM,sBAAsB,GAAI,oCAIpC;IACD,MAAM,EAAE,SAAS,EAAE,GAAG,SAAS,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;CACvC,iBAGgB,MAAM,GAAG,SAAS,eAChB,MAAM,EAAE,GAAG,SAAS,WACxB,OAAO,eACH,MAAM,GAAG,SAAS,aACpB,MAAM,QACX,UAAU,KACf,SAAS,GAAG,UA0JlB,CAAC"}
|
|
@@ -15,8 +15,10 @@ export const useStructuredReference = ({ tables, sheetId, getSheetName, }) => {
|
|
|
15
15
|
});
|
|
16
16
|
// Current row
|
|
17
17
|
const { row: rowIndex } = cell;
|
|
18
|
+
// Excel: a structured reference whose table no longer exists (the table
|
|
19
|
+
// was deleted, or every one of its rows) is `#REF!`, never `#NAME?`.
|
|
18
20
|
if (!table) {
|
|
19
|
-
throw new FormulaError("#
|
|
21
|
+
throw new FormulaError("#REF!", "Table could not be found");
|
|
20
22
|
}
|
|
21
23
|
// Special this row item
|
|
22
24
|
if (specialItem === "#This Row") {
|
|
@@ -30,12 +32,14 @@ export const useStructuredReference = ({ tables, sheetId, getSheetName, }) => {
|
|
|
30
32
|
const [from, to] = columnNames ?? [];
|
|
31
33
|
const startColIndex = getColumnIndexFromColumnName(table, from);
|
|
32
34
|
const endColIndex = getColumnIndexFromColumnName(table, to);
|
|
33
|
-
// Exit early, if column could not be found
|
|
35
|
+
// Exit early, if column could not be found. Excel: a reference to a
|
|
36
|
+
// column the table does not have — including the `#REF!` specifier a
|
|
37
|
+
// column delete writes (`Table1[@#REF!]`) — is `#REF!`.
|
|
34
38
|
if (!isNil(to) && isNil(endColIndex)) {
|
|
35
|
-
throw new FormulaError("#
|
|
39
|
+
throw new FormulaError("#REF!", `Column not found ${to}`);
|
|
36
40
|
}
|
|
37
41
|
if (!isNil(from) && isNil(startColIndex)) {
|
|
38
|
-
throw new FormulaError("#
|
|
42
|
+
throw new FormulaError("#REF!", `Column not found ${from}`);
|
|
39
43
|
}
|
|
40
44
|
const startColumnIndex = isNil(startColIndex)
|
|
41
45
|
? range.startColumnIndex
|
|
@@ -92,10 +96,10 @@ export const useStructuredReference = ({ tables, sheetId, getSheetName, }) => {
|
|
|
92
96
|
}
|
|
93
97
|
// If column is not found, lets not select anything
|
|
94
98
|
if (from && isNil(startColIndex)) {
|
|
95
|
-
throw new FormulaError("#
|
|
99
|
+
throw new FormulaError("#REF!", `Column: ${from} could not be found`);
|
|
96
100
|
}
|
|
97
101
|
if (to && isNil(endColIndex)) {
|
|
98
|
-
throw new FormulaError("#
|
|
102
|
+
throw new FormulaError("#REF!", `Column: ${to} could not be found`);
|
|
99
103
|
}
|
|
100
104
|
// Check if thisrow is active and current cell is in bounds
|
|
101
105
|
if (thisRow &&
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -18,10 +18,14 @@ export * from "./sheet-cell";
|
|
|
18
18
|
export { useSubscribeToSheet, useSubscribeToMultipleRanges, } from "./hooks/use-sheet-observer";
|
|
19
19
|
export * from "./helpers";
|
|
20
20
|
export * from "./api/fill";
|
|
21
|
+
export * from "./api/insert-cut-cells";
|
|
21
22
|
export * from "./api/immer-utils";
|
|
22
23
|
export * from "./api/range";
|
|
24
|
+
export * from "./api/anchored-objects";
|
|
23
25
|
export * from "./atoms";
|
|
24
26
|
export * from "./api/formula";
|
|
27
|
+
export * from "./api/structural-guards";
|
|
28
|
+
export * from "./constants";
|
|
25
29
|
export * from "./types";
|
|
26
30
|
export * from "./commands";
|
|
27
31
|
export type { ClearType } from "./interface/delete-cells";
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,OAAO,EACL,yBAAyB,EACzB,cAAc,EACd,WAAW,EACX,SAAS,EACT,SAAS,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,4BAA4B,EAC5B,yBAAyB,EACzB,sBAAsB,EACtB,0BAA0B,EAC1B,KAAK,2BAA2B,GACjC,MAAM,qBAAqB,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,oCAAoC,CAAC;AACnD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oCAAoC,CAAC;AACnD,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,OAAO,EACL,mBAAmB,EACnB,4BAA4B,GAC7B,MAAM,4BAA4B,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,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nC,cAAc,oCAAoC,CAAC;AACnD,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,OAAO,EACL,mBAAmB,EACnB,4BAA4B,GAC7B,MAAM,4BAA4B,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,YAAY,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAG7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,wCAAwC,CAAC;AACvD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2CAA2C,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -18,10 +18,14 @@ export * from "./sheet-cell";
|
|
|
18
18
|
export { useSubscribeToSheet, useSubscribeToMultipleRanges, } from "./hooks/use-sheet-observer";
|
|
19
19
|
export * from "./helpers";
|
|
20
20
|
export * from "./api/fill";
|
|
21
|
+
export * from "./api/insert-cut-cells";
|
|
21
22
|
export * from "./api/immer-utils";
|
|
22
23
|
export * from "./api/range";
|
|
24
|
+
export * from "./api/anchored-objects";
|
|
23
25
|
export * from "./atoms";
|
|
24
26
|
export * from "./api/formula";
|
|
27
|
+
export * from "./api/structural-guards";
|
|
28
|
+
export * from "./constants";
|
|
25
29
|
export * from "./types";
|
|
26
30
|
export * from "./commands";
|
|
27
31
|
// Register
|
|
@@ -60,6 +60,15 @@ export declare class CalculationInterface {
|
|
|
60
60
|
private ensureWorkerMetadata;
|
|
61
61
|
private isClientOnlyFormula;
|
|
62
62
|
private executeOperations;
|
|
63
|
+
/**
|
|
64
|
+
* Mirror a dynamic-array anchor's spill rectangle on the local graph (a
|
|
65
|
+
* matrix result registers it, a scalar clears it) so structural edits can
|
|
66
|
+
* find the projected cells of an anchor they delete — the same bookkeeping
|
|
67
|
+
* the React worker hook does in `handleArrayEvaluation`.
|
|
68
|
+
*/
|
|
69
|
+
private trackArrayResult;
|
|
70
|
+
/** The spill rectangle currently anchored at `position`, if it is a dynamic array. */
|
|
71
|
+
getArrayRange(position: CellCoordinate): CellCoordinateRange | undefined;
|
|
63
72
|
private createDefaultWorker;
|
|
64
73
|
private ensureWorker;
|
|
65
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculation-interface.d.ts","sourceRoot":"","sources":["../../../interface/calculation-interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"calculation-interface.d.ts","sourceRoot":"","sources":["../../../interface/calculation-interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAEL,KAAK,oBAAoB,EAS1B,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EACV,UAAU,EACV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AAE,cAAc,GAAG,mBAAmB,GAAG,SAAS;IAIxE,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,YAAY;CAuDrB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { resolveSheetSpan } from "@rowsncolumns/utils";
|
|
2
1
|
import { CalculationGraph, CalculationWorkerClient, createNamedRangeResolver, createStructuredReferenceResolver, enqueueCalculationOperations, mapOperationToGraphOperation, } from "@rowsncolumns/calculation-worker/server";
|
|
3
2
|
import { FormulaError } from "@rowsncolumns/fast-formula-parser";
|
|
3
|
+
import { resolveSheetSpan } from "@rowsncolumns/utils";
|
|
4
4
|
const isSerializedFormulaError = (value) => {
|
|
5
5
|
return Boolean(value &&
|
|
6
6
|
typeof value === "object" &&
|
|
@@ -279,12 +279,43 @@ export class CalculationInterface {
|
|
|
279
279
|
return this.options.getEffectiveStructuredValue(value, property);
|
|
280
280
|
},
|
|
281
281
|
});
|
|
282
|
-
const expandedResults = results.flatMap((result) =>
|
|
282
|
+
const expandedResults = results.flatMap((result) => {
|
|
283
|
+
this.trackArrayResult(result);
|
|
284
|
+
return expandWorkerResult(result);
|
|
285
|
+
});
|
|
283
286
|
if (expandedResults.length) {
|
|
284
287
|
this.options.onResults(expandedResults);
|
|
285
288
|
}
|
|
286
289
|
return expandedResults;
|
|
287
290
|
}
|
|
291
|
+
/**
|
|
292
|
+
* Mirror a dynamic-array anchor's spill rectangle on the local graph (a
|
|
293
|
+
* matrix result registers it, a scalar clears it) so structural edits can
|
|
294
|
+
* find the projected cells of an anchor they delete — the same bookkeeping
|
|
295
|
+
* the React worker hook does in `handleArrayEvaluation`.
|
|
296
|
+
*/
|
|
297
|
+
trackArrayResult(result) {
|
|
298
|
+
if (!result.position)
|
|
299
|
+
return;
|
|
300
|
+
const position = result.position;
|
|
301
|
+
const matrix = normalizeMatrixValue(deserializeWorkerValue(result.value));
|
|
302
|
+
if (!matrix) {
|
|
303
|
+
this.graph.unregisterArrayFormula(position);
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
const columns = Math.max(1, ...matrix.map((row) => row.length));
|
|
307
|
+
this.graph.registerArrayFormula(position, {
|
|
308
|
+
sheetId: position.sheetId,
|
|
309
|
+
startRowIndex: position.rowIndex,
|
|
310
|
+
startColumnIndex: position.columnIndex,
|
|
311
|
+
endRowIndex: position.rowIndex + matrix.length - 1,
|
|
312
|
+
endColumnIndex: position.columnIndex + columns - 1,
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
/** The spill rectangle currently anchored at `position`, if it is a dynamic array. */
|
|
316
|
+
getArrayRange(position) {
|
|
317
|
+
return this.graph.getArrayRange(position);
|
|
318
|
+
}
|
|
288
319
|
createDefaultWorker() {
|
|
289
320
|
if (typeof require !== "function") {
|
|
290
321
|
throw new Error("createCalculationWorker must be provided outside of Node.js.");
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { CellInterface, SelectionArea } from "@rowsncolumns/common-types";
|
|
2
2
|
import type { CellData, SelectionAttributes, Sheet } from "@rowsncolumns/spreadsheet";
|
|
3
3
|
import type { UseOnDeleteCellsShiftLeftProps } from "../hooks/use-on-delete-cells-shift-left";
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Delete cells ▸ Shift cells left (SHF-04) — the horizontal twin of `deleteCellsShiftUp`: only the
|
|
6
|
+
* selection's rows move, the selected block is removed and every cell to its right slides left by
|
|
7
|
+
* the block's width. A reference to a deleted cell becomes `#REF!`; one to a cell that slid left
|
|
8
|
+
* follows it; a range entirely inside the block's rows that the block partially covers contracts.
|
|
9
|
+
* Refusals (torn merge/table/array) are decided by the hook before this runs.
|
|
10
|
+
*/
|
|
11
|
+
export declare const deleteCellsShiftLeft: <T extends CellData, S extends Sheet>({ rowCount, columnCount, locale, cellXfsRegistry, sharedStringRegistry, getActiveCell, getSelections, getDependents, getSheetName, createHistory, enqueueGraphOperation, enqueueCalculation, enqueueStructureChange, onChangeSheetData, onChangeSheets, onChangeTables, onChangeCitations, }: UseOnDeleteCellsShiftLeftProps<T, S>) => (sheetId: number, activeCell: CellInterface, selections: SelectionArea<SelectionAttributes>[]) => void;
|
|
5
12
|
//# sourceMappingURL=delete-cells-shift-left.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-cells-shift-left.d.ts","sourceRoot":"","sources":["../../../interface/delete-cells-shift-left.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAEb,aAAa,EACd,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"delete-cells-shift-left.d.ts","sourceRoot":"","sources":["../../../interface/delete-cells-shift-left.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAEb,aAAa,EACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,QAAQ,EACR,mBAAmB,EACnB,KAAK,EACN,MAAM,2BAA2B,CAAC;AAgBnC,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AAI9F;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,8RAkBvE,8BAA8B,CAAC,CAAC,EAAE,CAAC,CAAC,MAEnC,SAAS,MAAM,EACf,YAAY,aAAa,EACzB,YAAY,aAAa,CAAC,mBAAmB,CAAC,EAAE,SAqRnD,CAAC"}
|