@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
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Direction } from "@rowsncolumns/common-types";
|
|
2
2
|
import { produceWithPatches } from "immer";
|
|
3
|
+
import { shiftChartsOnStructuralChange, shiftEmbedsOnStructuralChange, shiftProtectedRangesOnStructuralChange, } from "../api/anchored-objects";
|
|
3
4
|
import { shrinkMergesOnColumnDelete } from "../api/merges";
|
|
5
|
+
import { updateNamedRangesOnStructuralChange, updatePrintSettingsOnStructuralChange, } from "../api/named-range-structural";
|
|
4
6
|
import { shiftPivotsOnDelete } from "../api/pivot-range";
|
|
5
7
|
import { updateRangedRulesOnStructuralChange } from "../api/range-rule-helpers";
|
|
6
|
-
import { updateSheetRangeOnDelete } from "../api/range";
|
|
7
8
|
import { moveFilterView } from "../api/selection";
|
|
8
9
|
import { updateFormulasForStructuralChange } from "../api/structural-formula-update";
|
|
9
|
-
|
|
10
|
+
import { breakStructuredRefsForRemovedTableParts, collectRemovedTableParts, removeSpillsOfDeletedAnchors, } from "../api/structural-table-refs";
|
|
11
|
+
export const deleteColumn = ({ rowCount, columnCount, locale, cellXfsRegistry, sharedStringRegistry, getSheetName, getActiveCell, getSelections, getDependents, getGraphNodes, getGraphNodesInSheet, createHistory, enqueueGraphOperation, enqueueCalculation, enqueueStructureChange, onChangeSheetData, onChangeSheets, onChangeTables, onChangeActiveCell, onChangeSelections, onChangeConditionalFormats, onChangeDataValidations, onChangeCitations, onChangePivotTables, tables, getArrayRange, onChangeNamedRanges, onChangeEmbeds, onChangeCharts, onChangeProtectedRanges, }) => {
|
|
10
12
|
return (sheetId, columnIndexes) => {
|
|
11
13
|
if (!columnIndexes.length)
|
|
12
14
|
return;
|
|
@@ -27,43 +29,33 @@ export const deleteColumn = ({ rowCount, columnCount, locale, cellXfsRegistry, s
|
|
|
27
29
|
const activeCell = getActiveCell();
|
|
28
30
|
const selections = getSelections();
|
|
29
31
|
const newColumnCount = Math.max(1, columnCount - count);
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
else if (activeCell.columnIndex > maxColumnIndex) {
|
|
38
|
-
nextActiveColumnIndex = Math.max(1, activeCell.columnIndex - count);
|
|
39
|
-
}
|
|
40
|
-
if (nextActiveColumnIndex > newColumnCount) {
|
|
41
|
-
nextActiveColumnIndex = newColumnCount;
|
|
42
|
-
}
|
|
32
|
+
// Excel keeps the selection where it was (UI-02, column twin): after
|
|
33
|
+
// deleting columns C:D the selection still reads C:D — now over the
|
|
34
|
+
// columns that moved left — and the active cell sits in the first deleted
|
|
35
|
+
// column. Every coordinate loses the deleted columns that lie BEFORE it.
|
|
36
|
+
const deletedBefore = (columnIndex) => sortedColumnIndexes.filter((index) => index < columnIndex).length;
|
|
37
|
+
const clampColumn = (columnIndex) => Math.min(Math.max(1, columnIndex), newColumnCount);
|
|
38
|
+
const nextActiveColumnIndex = clampColumn(activeCell.columnIndex - deletedBefore(activeCell.columnIndex));
|
|
43
39
|
const nextActiveCell = nextActiveColumnIndex === activeCell.columnIndex
|
|
44
40
|
? activeCell
|
|
45
41
|
: { ...activeCell, columnIndex: nextActiveColumnIndex };
|
|
46
|
-
const fallbackSelectionColumnIndex = nextActiveCell.columnIndex;
|
|
47
42
|
const nextSelections = selections.map((selection) => {
|
|
48
43
|
if (!selection.range)
|
|
49
44
|
return selection;
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
}
|
|
45
|
+
const { startColumnIndex, endColumnIndex } = selection.range;
|
|
46
|
+
const deletedWithin = sortedColumnIndexes.filter((index) => index >= startColumnIndex && index <= endColumnIndex).length;
|
|
47
|
+
const size = endColumnIndex - startColumnIndex + 1;
|
|
48
|
+
const nextStart = clampColumn(startColumnIndex - deletedBefore(startColumnIndex));
|
|
49
|
+
// A partially covered area shrinks by the columns it lost; an area
|
|
50
|
+
// deleted outright keeps its size (it now frames the columns that moved
|
|
51
|
+
// left).
|
|
52
|
+
const nextSize = deletedWithin < size ? size - deletedWithin : size;
|
|
61
53
|
return {
|
|
62
54
|
...selection,
|
|
63
55
|
range: {
|
|
64
56
|
...selection.range,
|
|
65
|
-
startColumnIndex:
|
|
66
|
-
endColumnIndex:
|
|
57
|
+
startColumnIndex: nextStart,
|
|
58
|
+
endColumnIndex: clampColumn(nextStart + nextSize - 1),
|
|
67
59
|
},
|
|
68
60
|
};
|
|
69
61
|
});
|
|
@@ -118,7 +110,7 @@ export const deleteColumn = ({ rowCount, columnCount, locale, cellXfsRegistry, s
|
|
|
118
110
|
// Data validations
|
|
119
111
|
onChangeDataValidations?.((prevValidations) => {
|
|
120
112
|
const [nextState, patches, inversePatches] = produceWithPatches(prevValidations, (draft) => {
|
|
121
|
-
updateRangedRulesOnStructuralChange(draft, "delete", "column", minColumnIndex, count, sheetId);
|
|
113
|
+
updateRangedRulesOnStructuralChange(draft, "delete", "column", minColumnIndex, count, sheetId, { getSheetName });
|
|
122
114
|
});
|
|
123
115
|
saveHistory({ dataValidations: { patches, inversePatches } });
|
|
124
116
|
return nextState;
|
|
@@ -126,11 +118,20 @@ export const deleteColumn = ({ rowCount, columnCount, locale, cellXfsRegistry, s
|
|
|
126
118
|
// Conditional formats
|
|
127
119
|
onChangeConditionalFormats?.((prevConditionalFormats) => {
|
|
128
120
|
const [nextState, patches, inversePatches] = produceWithPatches(prevConditionalFormats, (draft) => {
|
|
129
|
-
updateRangedRulesOnStructuralChange(draft, "delete", "column", minColumnIndex, count, sheetId);
|
|
121
|
+
updateRangedRulesOnStructuralChange(draft, "delete", "column", minColumnIndex, count, sheetId, { getSheetName });
|
|
130
122
|
});
|
|
131
123
|
saveHistory({ conditionalFormats: { patches, inversePatches } });
|
|
132
124
|
return nextState;
|
|
133
125
|
});
|
|
126
|
+
// Defined names: shift back / shrink; a name whose whole range is
|
|
127
|
+
// deleted is kept as `#REF!` so its users evaluate `#REF!`, like Excel.
|
|
128
|
+
onChangeNamedRanges?.((prevNamedRanges) => {
|
|
129
|
+
const [nextState, patches, inversePatches] = produceWithPatches(prevNamedRanges, (draft) => {
|
|
130
|
+
updateNamedRangesOnStructuralChange(draft, "column", "delete", minColumnIndex, count, sheetId);
|
|
131
|
+
});
|
|
132
|
+
saveHistory({ namedRanges: { patches, inversePatches } });
|
|
133
|
+
return nextState;
|
|
134
|
+
});
|
|
134
135
|
// Shift pivot tables.
|
|
135
136
|
onChangePivotTables?.((prevPivots) => {
|
|
136
137
|
const [nextState, patches, inversePatches] = produceWithPatches(prevPivots, (draft) => {
|
|
@@ -161,6 +162,31 @@ export const deleteColumn = ({ rowCount, columnCount, locale, cellXfsRegistry, s
|
|
|
161
162
|
saveHistory({ citations: { patches, inversePatches } });
|
|
162
163
|
return nextState;
|
|
163
164
|
});
|
|
165
|
+
// Anchored objects (Excel ANC rules): floating charts / embeds move with
|
|
166
|
+
// their anchor cell, chart series ranges and AllowEditRange rectangles
|
|
167
|
+
// shift like references. Frozen panes are a positional viewport split
|
|
168
|
+
// and are deliberately NOT touched here.
|
|
169
|
+
onChangeEmbeds?.((prevEmbeds) => {
|
|
170
|
+
const [nextState, patches, inversePatches] = produceWithPatches(prevEmbeds, (draft) => {
|
|
171
|
+
shiftEmbedsOnStructuralChange(draft, sheetId, "column", "delete", minColumnIndex, count);
|
|
172
|
+
});
|
|
173
|
+
saveHistory({ embeds: { patches, inversePatches } });
|
|
174
|
+
return nextState;
|
|
175
|
+
});
|
|
176
|
+
onChangeCharts?.((prevCharts) => {
|
|
177
|
+
const [nextState, patches, inversePatches] = produceWithPatches(prevCharts, (draft) => {
|
|
178
|
+
shiftChartsOnStructuralChange(draft, sheetId, "column", "delete", minColumnIndex, count);
|
|
179
|
+
});
|
|
180
|
+
saveHistory({ charts: { patches, inversePatches } });
|
|
181
|
+
return nextState;
|
|
182
|
+
});
|
|
183
|
+
onChangeProtectedRanges?.((prevProtectedRanges) => {
|
|
184
|
+
const [nextState, patches, inversePatches] = produceWithPatches(prevProtectedRanges, (draft) => {
|
|
185
|
+
shiftProtectedRangesOnStructuralChange(draft, sheetId, "column", "delete", minColumnIndex, count);
|
|
186
|
+
});
|
|
187
|
+
saveHistory({ protectedRanges: { patches, inversePatches } });
|
|
188
|
+
return nextState;
|
|
189
|
+
});
|
|
164
190
|
// Sheet metadata
|
|
165
191
|
onChangeSheets?.((prevSheets) => {
|
|
166
192
|
const [nextState, patches, inversePatches] = produceWithPatches(prevSheets, (draft) => {
|
|
@@ -195,24 +221,56 @@ export const deleteColumn = ({ rowCount, columnCount, locale, cellXfsRegistry, s
|
|
|
195
221
|
sheet.basicFilter.range.endColumnIndex -= delta;
|
|
196
222
|
}
|
|
197
223
|
}
|
|
198
|
-
if (sheet.frozenColumnCount) {
|
|
199
|
-
for (const columnIndex of sortedColumnIndexes) {
|
|
200
|
-
if (columnIndex <= sheet.frozenColumnCount) {
|
|
201
|
-
sheet.frozenColumnCount--;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
224
|
if (sheet.merges) {
|
|
206
225
|
sheet.merges = shrinkMergesOnColumnDelete(sheet.merges, minColumnIndex, count);
|
|
207
226
|
}
|
|
227
|
+
// `_xlnm.Print_Area` / `_xlnm.Print_Titles` follow the defined-name rule.
|
|
228
|
+
if (sheet.printSettings) {
|
|
229
|
+
updatePrintSettingsOnStructuralChange(sheet.printSettings, "column", "delete", minColumnIndex, count);
|
|
230
|
+
}
|
|
208
231
|
sheet.columnCount = Math.max(1, (sheet.columnCount ?? columnCount) - count);
|
|
232
|
+
// Frozen panes are positional: the split stays where it is, only
|
|
233
|
+
// clamped so the freeze never exceeds the shrunk sheet.
|
|
234
|
+
if (sheet.frozenColumnCount &&
|
|
235
|
+
sheet.frozenColumnCount > sheet.columnCount) {
|
|
236
|
+
sheet.frozenColumnCount = sheet.columnCount;
|
|
237
|
+
}
|
|
209
238
|
});
|
|
210
239
|
saveHistory({ sheets: { patches, inversePatches } });
|
|
211
240
|
return nextState;
|
|
212
241
|
});
|
|
242
|
+
// Table columns spliced out above (and tables dropped whole): their
|
|
243
|
+
// structured refs break to `#REF!`, computed from the PRE-edit definitions.
|
|
244
|
+
const removedTableParts = collectRemovedTableParts(tables, sheetId, "column", minColumnIndex, maxColumnIndex);
|
|
213
245
|
// Sheet data: three-pass formula update, then per-row column splice.
|
|
214
246
|
onChangeSheetData?.((prevSheetData) => {
|
|
215
247
|
const [nextState, patches, inversePatches] = produceWithPatches(prevSheetData, (draft) => {
|
|
248
|
+
removeSpillsOfDeletedAnchors({
|
|
249
|
+
draft,
|
|
250
|
+
sheetId,
|
|
251
|
+
axis: "column",
|
|
252
|
+
minIndex: minColumnIndex,
|
|
253
|
+
maxIndex: maxColumnIndex,
|
|
254
|
+
getArrayRange,
|
|
255
|
+
locale,
|
|
256
|
+
cellXfsRegistry,
|
|
257
|
+
sharedStringRegistry,
|
|
258
|
+
});
|
|
259
|
+
breakStructuredRefsForRemovedTableParts({
|
|
260
|
+
draft,
|
|
261
|
+
sheetId,
|
|
262
|
+
axis: "column",
|
|
263
|
+
referenceIndex: minColumnIndex,
|
|
264
|
+
count,
|
|
265
|
+
removed: removedTableParts,
|
|
266
|
+
getGraphNodes,
|
|
267
|
+
enqueueCalculation,
|
|
268
|
+
enqueueGraphOperation,
|
|
269
|
+
recalcCells,
|
|
270
|
+
locale,
|
|
271
|
+
cellXfsRegistry,
|
|
272
|
+
sharedStringRegistry,
|
|
273
|
+
});
|
|
216
274
|
updateFormulasForStructuralChange({
|
|
217
275
|
draft,
|
|
218
276
|
axis: "column",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { CellData, Sheet } from "@rowsncolumns/spreadsheet";
|
|
2
2
|
import { type UseOnDeleteRowProps } from "../hooks/use-on-delete-row";
|
|
3
|
-
export declare const deleteRow: <T extends CellData, S extends Sheet>({ rowCount, columnCount, locale, cellXfsRegistry, sharedStringRegistry, getSheetName, getActiveCell, getSelections, getDependents, getGraphNodes, getGraphNodesInSheet, createHistory, enqueueGraphOperation, enqueueCalculation, enqueueStructureChange, onChangeSheetData, onChangeSheets, onChangeTables, onChangeActiveCell, onChangeSelections, onChangeConditionalFormats, onChangeDataValidations, onChangeCitations, onChangePivotTables, }: UseOnDeleteRowProps<T, S>) => (sheetId: number, rowIndexes: number[]) => void;
|
|
3
|
+
export declare const deleteRow: <T extends CellData, S extends Sheet>({ rowCount, columnCount, locale, cellXfsRegistry, sharedStringRegistry, getSheetName, getActiveCell, getSelections, getDependents, getGraphNodes, getGraphNodesInSheet, createHistory, enqueueGraphOperation, enqueueCalculation, enqueueStructureChange, onChangeSheetData, onChangeSheets, onChangeTables, onChangeActiveCell, onChangeSelections, onChangeConditionalFormats, onChangeDataValidations, onChangeCitations, onChangePivotTables, tables, getArrayRange, onChangeNamedRanges, onChangeEmbeds, onChangeCharts, onChangeProtectedRanges, }: UseOnDeleteRowProps<T, S>) => (sheetId: number, rowIndexes: number[]) => void;
|
|
4
4
|
//# sourceMappingURL=delete-row.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-row.d.ts","sourceRoot":"","sources":["../../../interface/delete-row.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"delete-row.d.ts","sourceRoot":"","sources":["../../../interface/delete-row.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAsBjE,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGtE,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,0hBA+B5D,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,MAClB,SAAS,MAAM,EAAE,YAAY,MAAM,EAAE,SAyY9C,CAAC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Direction } from "@rowsncolumns/common-types";
|
|
2
2
|
import { produceWithPatches } from "immer";
|
|
3
|
+
import { shiftChartsOnStructuralChange, shiftEmbedsOnStructuralChange, shiftProtectedRangesOnStructuralChange, } from "../api/anchored-objects";
|
|
3
4
|
import { shrinkMergesOnRowDelete } from "../api/merges";
|
|
5
|
+
import { updateNamedRangesOnStructuralChange, updatePrintSettingsOnStructuralChange, } from "../api/named-range-structural";
|
|
4
6
|
import { shiftPivotsOnDelete } from "../api/pivot-range";
|
|
5
7
|
import { updateRangedRulesOnStructuralChange } from "../api/range-rule-helpers";
|
|
6
|
-
import { updateSheetRangeOnDelete } from "../api/range";
|
|
7
8
|
import { moveFilterView } from "../api/selection";
|
|
8
9
|
import { updateFormulasForStructuralChange } from "../api/structural-formula-update";
|
|
9
|
-
|
|
10
|
+
import { breakStructuredRefsForRemovedTableParts, collectRemovedTableParts, removeSpillsOfDeletedAnchors, } from "../api/structural-table-refs";
|
|
11
|
+
export const deleteRow = ({ rowCount, columnCount, locale, cellXfsRegistry, sharedStringRegistry, getSheetName, getActiveCell, getSelections, getDependents, getGraphNodes, getGraphNodesInSheet, createHistory, enqueueGraphOperation, enqueueCalculation, enqueueStructureChange, onChangeSheetData, onChangeSheets, onChangeTables, onChangeActiveCell, onChangeSelections, onChangeConditionalFormats, onChangeDataValidations, onChangeCitations, onChangePivotTables, tables, getArrayRange, onChangeNamedRanges, onChangeEmbeds, onChangeCharts, onChangeProtectedRanges, }) => {
|
|
10
12
|
return (sheetId, rowIndexes) => {
|
|
11
13
|
if (!rowIndexes.length)
|
|
12
14
|
return;
|
|
@@ -28,44 +30,34 @@ export const deleteRow = ({ rowCount, columnCount, locale, cellXfsRegistry, shar
|
|
|
28
30
|
const activeCell = getActiveCell();
|
|
29
31
|
const selections = getSelections();
|
|
30
32
|
const newRowCount = Math.max(1, rowCount - count);
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
nextActiveRowIndex = Math.max(1, activeCell.rowIndex - count);
|
|
41
|
-
}
|
|
42
|
-
if (nextActiveRowIndex > newRowCount) {
|
|
43
|
-
nextActiveRowIndex = newRowCount;
|
|
44
|
-
}
|
|
33
|
+
// Excel keeps the selection where it was (UI-02): after deleting rows 3:4
|
|
34
|
+
// the selection still reads 3:4 — now over the rows that moved up — and
|
|
35
|
+
// the active cell sits in the first deleted row. Every coordinate simply
|
|
36
|
+
// loses the deleted rows that lie BEFORE it, so an area entirely inside
|
|
37
|
+
// the deleted band keeps its place while areas below slide up; partially
|
|
38
|
+
// overlapping areas shrink like any other range.
|
|
39
|
+
const deletedBefore = (rowIndex) => sortedRowIndexes.filter((index) => index < rowIndex).length;
|
|
40
|
+
const clampRow = (rowIndex) => Math.min(Math.max(1, rowIndex), newRowCount);
|
|
41
|
+
const nextActiveRowIndex = clampRow(activeCell.rowIndex - deletedBefore(activeCell.rowIndex));
|
|
45
42
|
const nextActiveCell = nextActiveRowIndex === activeCell.rowIndex
|
|
46
43
|
? activeCell
|
|
47
44
|
: { ...activeCell, rowIndex: nextActiveRowIndex };
|
|
48
|
-
const fallbackSelectionRowIndex = nextActiveCell.rowIndex;
|
|
49
45
|
const nextSelections = selections.map((selection) => {
|
|
50
46
|
if (!selection.range)
|
|
51
47
|
return selection;
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
endRowIndex: updatedRange.endRowIndex,
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
}
|
|
48
|
+
const { startRowIndex, endRowIndex } = selection.range;
|
|
49
|
+
const deletedWithin = sortedRowIndexes.filter((index) => index >= startRowIndex && index <= endRowIndex).length;
|
|
50
|
+
const size = endRowIndex - startRowIndex + 1;
|
|
51
|
+
const nextStart = clampRow(startRowIndex - deletedBefore(startRowIndex));
|
|
52
|
+
// A partially covered area shrinks by the rows it lost; an area deleted
|
|
53
|
+
// outright keeps its size (it now frames the rows that moved up).
|
|
54
|
+
const nextSize = deletedWithin < size ? size - deletedWithin : size;
|
|
63
55
|
return {
|
|
64
56
|
...selection,
|
|
65
57
|
range: {
|
|
66
58
|
...selection.range,
|
|
67
|
-
startRowIndex:
|
|
68
|
-
endRowIndex:
|
|
59
|
+
startRowIndex: nextStart,
|
|
60
|
+
endRowIndex: clampRow(nextStart + nextSize - 1),
|
|
69
61
|
},
|
|
70
62
|
};
|
|
71
63
|
});
|
|
@@ -96,7 +88,7 @@ export const deleteRow = ({ rowCount, columnCount, locale, cellXfsRegistry, shar
|
|
|
96
88
|
// Data validations
|
|
97
89
|
onChangeDataValidations?.((prevValidations) => {
|
|
98
90
|
const [nextState, patches, inversePatches] = produceWithPatches(prevValidations, (draft) => {
|
|
99
|
-
updateRangedRulesOnStructuralChange(draft, "delete", "row", minRowIndex, count, sheetId);
|
|
91
|
+
updateRangedRulesOnStructuralChange(draft, "delete", "row", minRowIndex, count, sheetId, { getSheetName });
|
|
100
92
|
});
|
|
101
93
|
saveHistory({ dataValidations: { patches, inversePatches } });
|
|
102
94
|
return nextState;
|
|
@@ -104,11 +96,20 @@ export const deleteRow = ({ rowCount, columnCount, locale, cellXfsRegistry, shar
|
|
|
104
96
|
// Conditional formats
|
|
105
97
|
onChangeConditionalFormats?.((prevConditionalFormats) => {
|
|
106
98
|
const [nextState, patches, inversePatches] = produceWithPatches(prevConditionalFormats, (draft) => {
|
|
107
|
-
updateRangedRulesOnStructuralChange(draft, "delete", "row", minRowIndex, count, sheetId);
|
|
99
|
+
updateRangedRulesOnStructuralChange(draft, "delete", "row", minRowIndex, count, sheetId, { getSheetName });
|
|
108
100
|
});
|
|
109
101
|
saveHistory({ conditionalFormats: { patches, inversePatches } });
|
|
110
102
|
return nextState;
|
|
111
103
|
});
|
|
104
|
+
// Defined names: shift back / shrink; a name whose whole range is
|
|
105
|
+
// deleted is kept as `#REF!` so its users evaluate `#REF!`, like Excel.
|
|
106
|
+
onChangeNamedRanges?.((prevNamedRanges) => {
|
|
107
|
+
const [nextState, patches, inversePatches] = produceWithPatches(prevNamedRanges, (draft) => {
|
|
108
|
+
updateNamedRangesOnStructuralChange(draft, "row", "delete", minRowIndex, count, sheetId);
|
|
109
|
+
});
|
|
110
|
+
saveHistory({ namedRanges: { patches, inversePatches } });
|
|
111
|
+
return nextState;
|
|
112
|
+
});
|
|
112
113
|
// Shift pivot tables: ranges shrink/shift; targetPosition anchors to
|
|
113
114
|
// the start of the deletion when its row falls inside the deletion.
|
|
114
115
|
onChangePivotTables?.((prevPivots) => {
|
|
@@ -141,6 +142,31 @@ export const deleteRow = ({ rowCount, columnCount, locale, cellXfsRegistry, shar
|
|
|
141
142
|
saveHistory({ citations: { patches, inversePatches } });
|
|
142
143
|
return nextState;
|
|
143
144
|
});
|
|
145
|
+
// Anchored objects (Excel ANC rules): floating charts / embeds move with
|
|
146
|
+
// their anchor cell, chart series ranges and AllowEditRange rectangles
|
|
147
|
+
// shift like references. Frozen panes are a positional viewport split
|
|
148
|
+
// and are deliberately NOT touched here.
|
|
149
|
+
onChangeEmbeds?.((prevEmbeds) => {
|
|
150
|
+
const [nextState, patches, inversePatches] = produceWithPatches(prevEmbeds, (draft) => {
|
|
151
|
+
shiftEmbedsOnStructuralChange(draft, sheetId, "row", "delete", minRowIndex, count);
|
|
152
|
+
});
|
|
153
|
+
saveHistory({ embeds: { patches, inversePatches } });
|
|
154
|
+
return nextState;
|
|
155
|
+
});
|
|
156
|
+
onChangeCharts?.((prevCharts) => {
|
|
157
|
+
const [nextState, patches, inversePatches] = produceWithPatches(prevCharts, (draft) => {
|
|
158
|
+
shiftChartsOnStructuralChange(draft, sheetId, "row", "delete", minRowIndex, count);
|
|
159
|
+
});
|
|
160
|
+
saveHistory({ charts: { patches, inversePatches } });
|
|
161
|
+
return nextState;
|
|
162
|
+
});
|
|
163
|
+
onChangeProtectedRanges?.((prevProtectedRanges) => {
|
|
164
|
+
const [nextState, patches, inversePatches] = produceWithPatches(prevProtectedRanges, (draft) => {
|
|
165
|
+
shiftProtectedRangesOnStructuralChange(draft, sheetId, "row", "delete", minRowIndex, count);
|
|
166
|
+
});
|
|
167
|
+
saveHistory({ protectedRanges: { patches, inversePatches } });
|
|
168
|
+
return nextState;
|
|
169
|
+
});
|
|
144
170
|
// Sheet metadata
|
|
145
171
|
onChangeSheets?.((prevSheets) => {
|
|
146
172
|
const [nextState, patches, inversePatches] = produceWithPatches(prevSheets, (draft) => {
|
|
@@ -164,24 +190,57 @@ export const deleteRow = ({ rowCount, columnCount, locale, cellXfsRegistry, shar
|
|
|
164
190
|
delete sheet.basicFilter;
|
|
165
191
|
}
|
|
166
192
|
}
|
|
167
|
-
if (sheet.frozenRowCount) {
|
|
168
|
-
for (const rowIndex of sortedRowIndexes) {
|
|
169
|
-
if (rowIndex <= sheet.frozenRowCount) {
|
|
170
|
-
sheet.frozenRowCount--;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
193
|
if (sheet.merges) {
|
|
175
194
|
sheet.merges = shrinkMergesOnRowDelete(sheet.merges, minRowIndex, count);
|
|
176
195
|
}
|
|
196
|
+
// `_xlnm.Print_Area` / `_xlnm.Print_Titles` follow the defined-name rule.
|
|
197
|
+
if (sheet.printSettings) {
|
|
198
|
+
updatePrintSettingsOnStructuralChange(sheet.printSettings, "row", "delete", minRowIndex, count);
|
|
199
|
+
}
|
|
177
200
|
sheet.rowCount = Math.max(1, (sheet.rowCount ?? rowCount) - count);
|
|
201
|
+
// Frozen panes are positional: the split stays where it is, only
|
|
202
|
+
// clamped so the freeze never exceeds the shrunk sheet.
|
|
203
|
+
if (sheet.frozenRowCount && sheet.frozenRowCount > sheet.rowCount) {
|
|
204
|
+
sheet.frozenRowCount = sheet.rowCount;
|
|
205
|
+
}
|
|
178
206
|
});
|
|
179
207
|
saveHistory({ sheets: { patches, inversePatches } });
|
|
180
208
|
return nextState;
|
|
181
209
|
});
|
|
210
|
+
// Tables whose header row goes (dropped above): their structured refs
|
|
211
|
+
// break to `#REF!`, computed from the PRE-edit definitions.
|
|
212
|
+
const removedTableParts = collectRemovedTableParts(tables, sheetId, "row", minRowIndex, maxRowIndex);
|
|
182
213
|
// Sheet data: three-pass formula update, then splice the rows out.
|
|
183
214
|
onChangeSheetData?.((prevSheetData) => {
|
|
184
215
|
const [nextState, patches, inversePatches] = produceWithPatches(prevSheetData, (draft) => {
|
|
216
|
+
// A dynamic array whose anchor row is deleted takes its spill with
|
|
217
|
+
// it — drop the projected cells before the rows close up.
|
|
218
|
+
removeSpillsOfDeletedAnchors({
|
|
219
|
+
draft,
|
|
220
|
+
sheetId,
|
|
221
|
+
axis: "row",
|
|
222
|
+
minIndex: minRowIndex,
|
|
223
|
+
maxIndex: maxRowIndex,
|
|
224
|
+
getArrayRange,
|
|
225
|
+
locale,
|
|
226
|
+
cellXfsRegistry,
|
|
227
|
+
sharedStringRegistry,
|
|
228
|
+
});
|
|
229
|
+
breakStructuredRefsForRemovedTableParts({
|
|
230
|
+
draft,
|
|
231
|
+
sheetId,
|
|
232
|
+
axis: "row",
|
|
233
|
+
referenceIndex: minRowIndex,
|
|
234
|
+
count,
|
|
235
|
+
removed: removedTableParts,
|
|
236
|
+
getGraphNodes,
|
|
237
|
+
enqueueCalculation,
|
|
238
|
+
enqueueGraphOperation,
|
|
239
|
+
recalcCells,
|
|
240
|
+
locale,
|
|
241
|
+
cellXfsRegistry,
|
|
242
|
+
sharedStringRegistry,
|
|
243
|
+
});
|
|
185
244
|
updateFormulasForStructuralChange({
|
|
186
245
|
draft,
|
|
187
246
|
axis: "row",
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import type { CellData, CellInterface, SelectionArea } from "@rowsncolumns/common-types";
|
|
2
2
|
import type { SelectionAttributes, Sheet } from "@rowsncolumns/spreadsheet";
|
|
3
3
|
import type { UseOnInsertCellsShiftDown } from "../hooks/use-on-insert-cells-shift-down";
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Insert cells ▸ Shift cells down (SHF-01, SHF-06, SHF-07, SHF-08, FMT-03). Only the selection's
|
|
6
|
+
* columns move: every cell at or below the selection's first row slides down by the selection's
|
|
7
|
+
* height. References that target a shifted cell follow it; a range that lies entirely inside the
|
|
8
|
+
* shifted columns and straddles the insertion row grows by the inserted height (SHF-08); a wider
|
|
9
|
+
* range keeps its address (SHF-07). The vacated cells take the formatting of the cell above the
|
|
10
|
+
* insertion (FMT-03). Refusals (torn merge/table/array, off-sheet push) are decided by the hook via
|
|
11
|
+
* `getShiftCellsRefusal` before this runs.
|
|
12
|
+
*/
|
|
13
|
+
export declare const insertCellsShiftDown: <T extends CellData, S extends Sheet>({ rowCount, columnCount, locale, cellXfsRegistry, sharedStringRegistry, getActiveCell, getSelections, getDependents, getSheetName, createHistory, enqueueGraphOperation, enqueueCalculation, enqueueStructureChange, onChangeSheetData, onChangeSheets, onChangeTables, onChangeCitations, }: UseOnInsertCellsShiftDown<T, S>) => (sheetId: number, activeCell: CellInterface, selections: SelectionArea<SelectionAttributes>[]) => void;
|
|
5
14
|
//# sourceMappingURL=insert-cells-shift-down.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insert-cells-shift-down.d.ts","sourceRoot":"","sources":["../../../interface/insert-cells-shift-down.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,aAAa,EAEb,aAAa,EACd,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"insert-cells-shift-down.d.ts","sourceRoot":"","sources":["../../../interface/insert-cells-shift-down.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,aAAa,EAEb,aAAa,EACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAe5E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAIzF;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,8RAkBvE,yBAAyB,CAAC,CAAC,EAAE,CAAC,CAAC,MAE9B,SAAS,MAAM,EACf,YAAY,aAAa,EACzB,YAAY,aAAa,CAAC,mBAAmB,CAAC,EAAE,SAoQnD,CAAC"}
|