@rowsncolumns/spreadsheet-state 29.1.3 → 29.1.6
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/circular-reference.d.ts +31 -0
- package/dist/cjs/api/circular-reference.d.ts.map +1 -0
- package/dist/cjs/api/circular-reference.js +85 -0
- package/dist/cjs/api/copy-paste.d.ts +6 -0
- package/dist/cjs/api/copy-paste.d.ts.map +1 -1
- package/dist/cjs/api/copy-paste.js +24 -15
- package/dist/cjs/api/datatype.d.ts +2 -0
- package/dist/cjs/api/datatype.d.ts.map +1 -1
- package/dist/cjs/api/datatype.js +50 -27
- package/dist/cjs/api/decimals.d.ts +10 -0
- package/dist/cjs/api/decimals.d.ts.map +1 -1
- package/dist/cjs/api/decimals.js +34 -11
- package/dist/cjs/api/dependency.d.ts +19 -1
- package/dist/cjs/api/dependency.d.ts.map +1 -1
- package/dist/cjs/api/dependency.js +30 -14
- package/dist/cjs/api/filter-condition.d.ts +58 -0
- package/dist/cjs/api/filter-condition.d.ts.map +1 -0
- package/dist/cjs/api/filter-condition.js +157 -0
- package/dist/cjs/api/formula.d.ts.map +1 -1
- package/dist/cjs/api/formula.js +9 -7
- package/dist/cjs/api/image-embed.d.ts +41 -0
- package/dist/cjs/api/image-embed.d.ts.map +1 -0
- package/dist/cjs/api/image-embed.js +55 -0
- package/dist/cjs/api/immer-utils.d.ts.map +1 -1
- package/dist/cjs/api/immer-utils.js +43 -15
- package/dist/cjs/api/named-range-structural.d.ts +29 -3
- package/dist/cjs/api/named-range-structural.d.ts.map +1 -1
- package/dist/cjs/api/named-range-structural.js +36 -11
- package/dist/cjs/api/parse-html.d.ts.map +1 -1
- package/dist/cjs/api/parse-html.js +11 -5
- package/dist/cjs/api/structural-formula-update.d.ts +20 -1
- package/dist/cjs/api/structural-formula-update.d.ts.map +1 -1
- package/dist/cjs/api/structural-formula-update.js +264 -90
- package/dist/cjs/api/structural-guards.d.ts +11 -0
- package/dist/cjs/api/structural-guards.d.ts.map +1 -1
- package/dist/cjs/api/structural-guards.js +45 -1
- package/dist/cjs/api/structural-table-refs.d.ts +15 -2
- package/dist/cjs/api/structural-table-refs.d.ts.map +1 -1
- package/dist/cjs/api/structural-table-refs.js +79 -35
- package/dist/cjs/commands.d.ts +17 -3
- package/dist/cjs/commands.d.ts.map +1 -1
- package/dist/cjs/components/editors/conditional-format-rule-editor.d.ts.map +1 -1
- package/dist/cjs/components/editors/conditional-format-rule-editor.js +19 -7
- package/dist/cjs/constants.d.ts +4 -1
- package/dist/cjs/constants.d.ts.map +1 -1
- package/dist/cjs/constants.js +4 -0
- package/dist/cjs/helpers/sheet-title.d.ts +2 -1
- package/dist/cjs/helpers/sheet-title.d.ts.map +1 -1
- package/dist/cjs/helpers/sheet-title.js +3 -1
- package/dist/cjs/hooks/use-can-edit-cellrange.d.ts +1 -1
- package/dist/cjs/hooks/use-can-edit-cellrange.d.ts.map +1 -1
- package/dist/cjs/hooks/use-can-edit-cellrange.js +1 -1
- package/dist/cjs/hooks/use-on-calculation-success.d.ts +5 -1
- package/dist/cjs/hooks/use-on-calculation-success.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-calculation-success.js +20 -3
- package/dist/cjs/hooks/use-on-copy.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-copy.js +23 -25
- package/dist/cjs/hooks/use-on-create-sheet.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-create-sheet.js +11 -1
- package/dist/cjs/hooks/use-on-delete.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-delete.js +15 -3
- package/dist/cjs/hooks/use-on-drag-n-drop.d.ts +5 -0
- package/dist/cjs/hooks/use-on-drag-n-drop.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-drag-n-drop.js +6 -5
- package/dist/cjs/hooks/use-on-filter-table.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-filter-table.js +6 -1
- package/dist/cjs/hooks/use-on-find-replace.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-find-replace.js +111 -23
- package/dist/cjs/hooks/use-on-insert-image.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-insert-image.js +20 -33
- package/dist/cjs/hooks/use-on-paste.d.ts +2 -1
- package/dist/cjs/hooks/use-on-paste.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-paste.js +53 -24
- package/dist/cjs/hooks/use-on-rename-sheet.d.ts +3 -1
- package/dist/cjs/hooks/use-on-rename-sheet.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-rename-sheet.js +19 -9
- package/dist/cjs/hooks/use-on-sort-column.d.ts +7 -1
- package/dist/cjs/hooks/use-on-sort-column.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-sort-column.js +25 -8
- package/dist/cjs/hooks/use-on-sort-range.d.ts +16 -2
- package/dist/cjs/hooks/use-on-sort-range.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-sort-range.js +72 -40
- package/dist/cjs/hooks/use-on-sort-table.d.ts +7 -2
- package/dist/cjs/hooks/use-on-sort-table.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-sort-table.js +25 -4
- package/dist/cjs/hooks/use-spreadsheet-state.d.ts +5 -3
- package/dist/cjs/hooks/use-spreadsheet-state.d.ts.map +1 -1
- package/dist/cjs/hooks/use-spreadsheet-state.js +7 -0
- package/dist/cjs/hooks/utils/sort-rows.d.ts +15 -0
- package/dist/cjs/hooks/utils/sort-rows.d.ts.map +1 -1
- package/dist/cjs/hooks/utils/sort-rows.js +16 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/interface/delete-column.d.ts.map +1 -1
- package/dist/cjs/interface/delete-column.js +254 -101
- package/dist/cjs/interface/delete-row.d.ts.map +1 -1
- package/dist/cjs/interface/delete-row.js +233 -81
- package/dist/cjs/interface/duplicate-sheet.d.ts.map +1 -1
- package/dist/cjs/interface/duplicate-sheet.js +4 -9
- package/dist/cjs/interface/insert-column.d.ts.map +1 -1
- package/dist/cjs/interface/insert-column.js +1 -1
- package/dist/cjs/interface/insert-row.d.ts.map +1 -1
- package/dist/cjs/interface/insert-row.js +1 -1
- package/dist/cjs/interface/new-sheet.d.ts.map +1 -1
- package/dist/cjs/interface/new-sheet.js +6 -13
- package/dist/cjs/sheet-cell.d.ts +9 -0
- package/dist/cjs/sheet-cell.d.ts.map +1 -1
- package/dist/cjs/sheet-cell.js +46 -9
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/api/circular-reference.d.ts +31 -0
- package/dist/esm/api/circular-reference.d.ts.map +1 -0
- package/dist/esm/api/circular-reference.js +55 -0
- package/dist/esm/api/copy-paste.d.ts +6 -0
- package/dist/esm/api/copy-paste.d.ts.map +1 -1
- package/dist/esm/api/copy-paste.js +26 -14
- package/dist/esm/api/datatype.d.ts +2 -0
- package/dist/esm/api/datatype.d.ts.map +1 -1
- package/dist/esm/api/datatype.js +50 -27
- package/dist/esm/api/decimals.d.ts +10 -0
- package/dist/esm/api/decimals.d.ts.map +1 -1
- package/dist/esm/api/decimals.js +31 -10
- package/dist/esm/api/dependency.d.ts +19 -1
- package/dist/esm/api/dependency.d.ts.map +1 -1
- package/dist/esm/api/dependency.js +15 -10
- package/dist/esm/api/filter-condition.d.ts +58 -0
- package/dist/esm/api/filter-condition.d.ts.map +1 -0
- package/dist/esm/api/filter-condition.js +146 -0
- package/dist/esm/api/formula.d.ts.map +1 -1
- package/dist/esm/api/formula.js +9 -7
- package/dist/esm/api/image-embed.d.ts +41 -0
- package/dist/esm/api/image-embed.d.ts.map +1 -0
- package/dist/esm/api/image-embed.js +52 -0
- package/dist/esm/api/immer-utils.d.ts.map +1 -1
- package/dist/esm/api/immer-utils.js +43 -14
- package/dist/esm/api/named-range-structural.d.ts +29 -3
- package/dist/esm/api/named-range-structural.d.ts.map +1 -1
- package/dist/esm/api/named-range-structural.js +35 -11
- package/dist/esm/api/parse-html.d.ts.map +1 -1
- package/dist/esm/api/parse-html.js +14 -5
- package/dist/esm/api/structural-formula-update.d.ts +20 -1
- package/dist/esm/api/structural-formula-update.d.ts.map +1 -1
- package/dist/esm/api/structural-formula-update.js +151 -55
- package/dist/esm/api/structural-guards.d.ts +11 -0
- package/dist/esm/api/structural-guards.d.ts.map +1 -1
- package/dist/esm/api/structural-guards.js +31 -0
- package/dist/esm/api/structural-table-refs.d.ts +15 -2
- package/dist/esm/api/structural-table-refs.d.ts.map +1 -1
- package/dist/esm/api/structural-table-refs.js +49 -18
- package/dist/esm/commands.d.ts +17 -3
- package/dist/esm/commands.d.ts.map +1 -1
- package/dist/esm/components/editors/conditional-format-rule-editor.d.ts.map +1 -1
- package/dist/esm/components/editors/conditional-format-rule-editor.js +18 -7
- package/dist/esm/constants.d.ts +4 -1
- package/dist/esm/constants.d.ts.map +1 -1
- package/dist/esm/constants.js +4 -0
- package/dist/esm/helpers/sheet-title.d.ts +2 -1
- package/dist/esm/helpers/sheet-title.d.ts.map +1 -1
- package/dist/esm/helpers/sheet-title.js +3 -1
- package/dist/esm/hooks/use-can-edit-cellrange.d.ts +1 -1
- package/dist/esm/hooks/use-can-edit-cellrange.d.ts.map +1 -1
- package/dist/esm/hooks/use-can-edit-cellrange.js +1 -1
- package/dist/esm/hooks/use-on-calculation-success.d.ts +5 -1
- package/dist/esm/hooks/use-on-calculation-success.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-calculation-success.js +19 -3
- package/dist/esm/hooks/use-on-copy.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-copy.js +17 -17
- package/dist/esm/hooks/use-on-create-sheet.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-create-sheet.js +11 -1
- package/dist/esm/hooks/use-on-delete.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-delete.js +15 -3
- package/dist/esm/hooks/use-on-drag-n-drop.d.ts +5 -0
- package/dist/esm/hooks/use-on-drag-n-drop.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-drag-n-drop.js +7 -4
- package/dist/esm/hooks/use-on-filter-table.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-filter-table.js +13 -2
- package/dist/esm/hooks/use-on-find-replace.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-find-replace.js +111 -23
- package/dist/esm/hooks/use-on-insert-image.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-insert-image.js +15 -25
- package/dist/esm/hooks/use-on-paste.d.ts +2 -1
- package/dist/esm/hooks/use-on-paste.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-paste.js +46 -15
- package/dist/esm/hooks/use-on-rename-sheet.d.ts +3 -1
- package/dist/esm/hooks/use-on-rename-sheet.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-rename-sheet.js +19 -9
- package/dist/esm/hooks/use-on-sort-column.d.ts +7 -1
- package/dist/esm/hooks/use-on-sort-column.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-sort-column.js +18 -1
- package/dist/esm/hooks/use-on-sort-range.d.ts +16 -2
- package/dist/esm/hooks/use-on-sort-range.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-sort-range.js +30 -3
- package/dist/esm/hooks/use-on-sort-table.d.ts +7 -2
- package/dist/esm/hooks/use-on-sort-table.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-sort-table.js +25 -4
- package/dist/esm/hooks/use-spreadsheet-state.d.ts +5 -3
- package/dist/esm/hooks/use-spreadsheet-state.d.ts.map +1 -1
- package/dist/esm/hooks/use-spreadsheet-state.js +7 -0
- package/dist/esm/hooks/utils/sort-rows.d.ts +15 -0
- package/dist/esm/hooks/utils/sort-rows.d.ts.map +1 -1
- package/dist/esm/hooks/utils/sort-rows.js +15 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +3 -0
- package/dist/esm/interface/delete-column.d.ts.map +1 -1
- package/dist/esm/interface/delete-column.js +111 -80
- package/dist/esm/interface/delete-row.d.ts.map +1 -1
- package/dist/esm/interface/delete-row.js +91 -59
- package/dist/esm/interface/duplicate-sheet.d.ts.map +1 -1
- package/dist/esm/interface/duplicate-sheet.js +4 -9
- package/dist/esm/interface/insert-column.d.ts.map +1 -1
- package/dist/esm/interface/insert-column.js +1 -1
- package/dist/esm/interface/insert-row.d.ts.map +1 -1
- package/dist/esm/interface/insert-row.js +1 -1
- package/dist/esm/interface/new-sheet.d.ts.map +1 -1
- package/dist/esm/interface/new-sheet.js +6 -13
- package/dist/esm/sheet-cell.d.ts +9 -0
- package/dist/esm/sheet-cell.d.ts.map +1 -1
- package/dist/esm/sheet-cell.js +46 -7
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +15 -15
|
@@ -7,7 +7,7 @@ import { updateNamedRangesOnStructuralChange, updatePrintSettingsOnStructuralCha
|
|
|
7
7
|
import { shiftPivotsOnDelete } from "../api/pivot-range";
|
|
8
8
|
import { updateRangedRulesOnStructuralChange } from "../api/range-rule-helpers";
|
|
9
9
|
import { moveFilterView } from "../api/selection";
|
|
10
|
-
import { updateFormulasForStructuralChange } from "../api/structural-formula-update";
|
|
10
|
+
import { contiguousRuns, updateFormulasForStructuralChange, } from "../api/structural-formula-update";
|
|
11
11
|
import { breakStructuredRefsForRemovedTableParts, collectRemovedTableParts, removeSpillsOfDeletedAnchors, renameTableColumnsInFormulas, } from "../api/structural-table-refs";
|
|
12
12
|
import { createSheetCellIdentifier } from "../api/formula";
|
|
13
13
|
import { createSheetDraft } from "../api/immer-utils";
|
|
@@ -37,10 +37,17 @@ export var deleteRow = function (_a) {
|
|
|
37
37
|
if (!rowIndexes.length)
|
|
38
38
|
return;
|
|
39
39
|
// Don't mutate caller's array.
|
|
40
|
-
var sortedRowIndexes = __spreadArray([], __read(rowIndexes), false).sort(function (a, b) { return a - b; });
|
|
40
|
+
var sortedRowIndexes = __spreadArray([], __read(new Set(rowIndexes)), false).sort(function (a, b) { return a - b; });
|
|
41
41
|
var minRowIndex = sortedRowIndexes[0];
|
|
42
42
|
var maxRowIndex = sortedRowIndexes[sortedRowIndexes.length - 1];
|
|
43
43
|
var count = sortedRowIndexes.length;
|
|
44
|
+
// A Ctrl-selected delete (rows 2 and 4) is several contiguous bands. Every
|
|
45
|
+
// band-shaped update below runs once per band, LAST band first, so each
|
|
46
|
+
// band's coordinates are still the original ones when its turn comes —
|
|
47
|
+
// Excel's result: a line loses exactly the deleted lines before it, and a
|
|
48
|
+
// reference into a deleted line breaks (#939 K-09).
|
|
49
|
+
var runs = contiguousRuns(sortedRowIndexes);
|
|
50
|
+
var runsDescending = __spreadArray([], __read(runs), false).reverse();
|
|
44
51
|
var saveHistory = createHistory();
|
|
45
52
|
enqueueStructureChange === null || enqueueStructureChange === void 0 ? void 0 : enqueueStructureChange({
|
|
46
53
|
kind: "delete-row",
|
|
@@ -139,7 +146,20 @@ export var deleteRow = function (_a) {
|
|
|
139
146
|
// Data validations
|
|
140
147
|
onChangeDataValidations === null || onChangeDataValidations === void 0 ? void 0 : onChangeDataValidations(function (prevValidations) {
|
|
141
148
|
var _a = __read(produceWithPatches(prevValidations, function (draft) {
|
|
142
|
-
|
|
149
|
+
var e_1, _a;
|
|
150
|
+
try {
|
|
151
|
+
for (var runsDescending_1 = __values(runsDescending), runsDescending_1_1 = runsDescending_1.next(); !runsDescending_1_1.done; runsDescending_1_1 = runsDescending_1.next()) {
|
|
152
|
+
var run = runsDescending_1_1.value;
|
|
153
|
+
updateRangedRulesOnStructuralChange(draft, "delete", "row", run.start, run.count, sheetId, { getSheetName: getSheetName });
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
157
|
+
finally {
|
|
158
|
+
try {
|
|
159
|
+
if (runsDescending_1_1 && !runsDescending_1_1.done && (_a = runsDescending_1.return)) _a.call(runsDescending_1);
|
|
160
|
+
}
|
|
161
|
+
finally { if (e_1) throw e_1.error; }
|
|
162
|
+
}
|
|
143
163
|
}), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
|
|
144
164
|
saveHistory({ dataValidations: { patches: patches, inversePatches: inversePatches } });
|
|
145
165
|
return nextState;
|
|
@@ -147,7 +167,20 @@ export var deleteRow = function (_a) {
|
|
|
147
167
|
// Conditional formats
|
|
148
168
|
onChangeConditionalFormats === null || onChangeConditionalFormats === void 0 ? void 0 : onChangeConditionalFormats(function (prevConditionalFormats) {
|
|
149
169
|
var _a = __read(produceWithPatches(prevConditionalFormats, function (draft) {
|
|
150
|
-
|
|
170
|
+
var e_2, _a;
|
|
171
|
+
try {
|
|
172
|
+
for (var runsDescending_2 = __values(runsDescending), runsDescending_2_1 = runsDescending_2.next(); !runsDescending_2_1.done; runsDescending_2_1 = runsDescending_2.next()) {
|
|
173
|
+
var run = runsDescending_2_1.value;
|
|
174
|
+
updateRangedRulesOnStructuralChange(draft, "delete", "row", run.start, run.count, sheetId, { getSheetName: getSheetName });
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
178
|
+
finally {
|
|
179
|
+
try {
|
|
180
|
+
if (runsDescending_2_1 && !runsDescending_2_1.done && (_a = runsDescending_2.return)) _a.call(runsDescending_2);
|
|
181
|
+
}
|
|
182
|
+
finally { if (e_2) throw e_2.error; }
|
|
183
|
+
}
|
|
151
184
|
}), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
|
|
152
185
|
saveHistory({ conditionalFormats: { patches: patches, inversePatches: inversePatches } });
|
|
153
186
|
return nextState;
|
|
@@ -156,7 +189,20 @@ export var deleteRow = function (_a) {
|
|
|
156
189
|
// deleted is kept as `#REF!` so its users evaluate `#REF!`, like Excel.
|
|
157
190
|
onChangeNamedRanges === null || onChangeNamedRanges === void 0 ? void 0 : onChangeNamedRanges(function (prevNamedRanges) {
|
|
158
191
|
var _a = __read(produceWithPatches(prevNamedRanges, function (draft) {
|
|
159
|
-
|
|
192
|
+
var e_3, _a;
|
|
193
|
+
try {
|
|
194
|
+
for (var runsDescending_3 = __values(runsDescending), runsDescending_3_1 = runsDescending_3.next(); !runsDescending_3_1.done; runsDescending_3_1 = runsDescending_3.next()) {
|
|
195
|
+
var run = runsDescending_3_1.value;
|
|
196
|
+
updateNamedRangesOnStructuralChange(draft, "row", "delete", run.start, run.count, sheetId, { length: rowCount });
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
200
|
+
finally {
|
|
201
|
+
try {
|
|
202
|
+
if (runsDescending_3_1 && !runsDescending_3_1.done && (_a = runsDescending_3.return)) _a.call(runsDescending_3);
|
|
203
|
+
}
|
|
204
|
+
finally { if (e_3) throw e_3.error; }
|
|
205
|
+
}
|
|
160
206
|
}), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
|
|
161
207
|
saveHistory({ namedRanges: { patches: patches, inversePatches: inversePatches } });
|
|
162
208
|
return nextState;
|
|
@@ -165,7 +211,20 @@ export var deleteRow = function (_a) {
|
|
|
165
211
|
// the start of the deletion when its row falls inside the deletion.
|
|
166
212
|
onChangePivotTables === null || onChangePivotTables === void 0 ? void 0 : onChangePivotTables(function (prevPivots) {
|
|
167
213
|
var _a = __read(produceWithPatches(prevPivots, function (draft) {
|
|
168
|
-
|
|
214
|
+
var e_4, _a;
|
|
215
|
+
try {
|
|
216
|
+
for (var runsDescending_4 = __values(runsDescending), runsDescending_4_1 = runsDescending_4.next(); !runsDescending_4_1.done; runsDescending_4_1 = runsDescending_4.next()) {
|
|
217
|
+
var run = runsDescending_4_1.value;
|
|
218
|
+
shiftPivotsOnDelete(draft, sheetId, "row", run.start, run.count);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
222
|
+
finally {
|
|
223
|
+
try {
|
|
224
|
+
if (runsDescending_4_1 && !runsDescending_4_1.done && (_a = runsDescending_4.return)) _a.call(runsDescending_4);
|
|
225
|
+
}
|
|
226
|
+
finally { if (e_4) throw e_4.error; }
|
|
227
|
+
}
|
|
169
228
|
}), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
|
|
170
229
|
saveHistory({ pivotTables: { patches: patches, inversePatches: inversePatches } });
|
|
171
230
|
return nextState;
|
|
@@ -175,25 +234,38 @@ export var deleteRow = function (_a) {
|
|
|
175
234
|
onChangeCitations === null || onChangeCitations === void 0 ? void 0 : onChangeCitations(function (prevCitations) {
|
|
176
235
|
var updatedAt = new Date().toISOString();
|
|
177
236
|
var _a = __read(produceWithPatches(prevCitations, function (draft) {
|
|
178
|
-
var
|
|
179
|
-
|
|
180
|
-
var
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
237
|
+
var e_5, _a;
|
|
238
|
+
try {
|
|
239
|
+
for (var runsDescending_5 = __values(runsDescending), runsDescending_5_1 = runsDescending_5.next(); !runsDescending_5_1.done; runsDescending_5_1 = runsDescending_5.next()) {
|
|
240
|
+
var run = runsDescending_5_1.value;
|
|
241
|
+
var deleteEnd = run.start + run.count - 1;
|
|
242
|
+
for (var idx = draft.length - 1; idx >= 0; idx--) {
|
|
243
|
+
var citation = draft[idx];
|
|
244
|
+
if (citation.range.sheetId !== sheetId)
|
|
245
|
+
continue;
|
|
246
|
+
var citationStart = citation.range.startRowIndex;
|
|
247
|
+
var citationEnd = citation.range.endRowIndex;
|
|
248
|
+
if (citationStart <= deleteEnd && citationEnd >= run.start) {
|
|
249
|
+
// Soft-delete: keep the record for provenance / undo, hide it from the UI
|
|
250
|
+
if (citation.active !== false) {
|
|
251
|
+
citation.active = false;
|
|
252
|
+
citation.updated_at = updatedAt;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
else if (citationStart > deleteEnd) {
|
|
256
|
+
citation.range.startRowIndex -= run.count;
|
|
257
|
+
citation.range.endRowIndex -= run.count;
|
|
258
|
+
refreshCitationAnchor(citation);
|
|
259
|
+
}
|
|
190
260
|
}
|
|
191
261
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
262
|
+
}
|
|
263
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
264
|
+
finally {
|
|
265
|
+
try {
|
|
266
|
+
if (runsDescending_5_1 && !runsDescending_5_1.done && (_a = runsDescending_5.return)) _a.call(runsDescending_5);
|
|
196
267
|
}
|
|
268
|
+
finally { if (e_5) throw e_5.error; }
|
|
197
269
|
}
|
|
198
270
|
}), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
|
|
199
271
|
saveHistory({ citations: { patches: patches, inversePatches: inversePatches } });
|
|
@@ -205,28 +277,80 @@ export var deleteRow = function (_a) {
|
|
|
205
277
|
// and are deliberately NOT touched here.
|
|
206
278
|
onChangeEmbeds === null || onChangeEmbeds === void 0 ? void 0 : onChangeEmbeds(function (prevEmbeds) {
|
|
207
279
|
var _a = __read(produceWithPatches(prevEmbeds, function (draft) {
|
|
208
|
-
|
|
280
|
+
var e_6, _a;
|
|
281
|
+
try {
|
|
282
|
+
for (var runsDescending_6 = __values(runsDescending), runsDescending_6_1 = runsDescending_6.next(); !runsDescending_6_1.done; runsDescending_6_1 = runsDescending_6.next()) {
|
|
283
|
+
var run = runsDescending_6_1.value;
|
|
284
|
+
shiftEmbedsOnStructuralChange(draft, sheetId, "row", "delete", run.start, run.count);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
288
|
+
finally {
|
|
289
|
+
try {
|
|
290
|
+
if (runsDescending_6_1 && !runsDescending_6_1.done && (_a = runsDescending_6.return)) _a.call(runsDescending_6);
|
|
291
|
+
}
|
|
292
|
+
finally { if (e_6) throw e_6.error; }
|
|
293
|
+
}
|
|
209
294
|
}), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
|
|
210
295
|
saveHistory({ embeds: { patches: patches, inversePatches: inversePatches } });
|
|
211
296
|
return nextState;
|
|
212
297
|
});
|
|
213
298
|
onChangeSlicers === null || onChangeSlicers === void 0 ? void 0 : onChangeSlicers(function (prevSlicers) {
|
|
214
299
|
var _a = __read(produceWithPatches(prevSlicers, function (draft) {
|
|
215
|
-
|
|
300
|
+
var e_7, _a;
|
|
301
|
+
try {
|
|
302
|
+
for (var runsDescending_7 = __values(runsDescending), runsDescending_7_1 = runsDescending_7.next(); !runsDescending_7_1.done; runsDescending_7_1 = runsDescending_7.next()) {
|
|
303
|
+
var run = runsDescending_7_1.value;
|
|
304
|
+
shiftSlicersOnStructuralChange(draft, sheetId, "row", "delete", run.start, run.count);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
308
|
+
finally {
|
|
309
|
+
try {
|
|
310
|
+
if (runsDescending_7_1 && !runsDescending_7_1.done && (_a = runsDescending_7.return)) _a.call(runsDescending_7);
|
|
311
|
+
}
|
|
312
|
+
finally { if (e_7) throw e_7.error; }
|
|
313
|
+
}
|
|
216
314
|
}), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
|
|
217
315
|
saveHistory({ slicers: { patches: patches, inversePatches: inversePatches } });
|
|
218
316
|
return nextState;
|
|
219
317
|
});
|
|
220
318
|
onChangeCharts === null || onChangeCharts === void 0 ? void 0 : onChangeCharts(function (prevCharts) {
|
|
221
319
|
var _a = __read(produceWithPatches(prevCharts, function (draft) {
|
|
222
|
-
|
|
320
|
+
var e_8, _a;
|
|
321
|
+
try {
|
|
322
|
+
for (var runsDescending_8 = __values(runsDescending), runsDescending_8_1 = runsDescending_8.next(); !runsDescending_8_1.done; runsDescending_8_1 = runsDescending_8.next()) {
|
|
323
|
+
var run = runsDescending_8_1.value;
|
|
324
|
+
shiftChartsOnStructuralChange(draft, sheetId, "row", "delete", run.start, run.count);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
328
|
+
finally {
|
|
329
|
+
try {
|
|
330
|
+
if (runsDescending_8_1 && !runsDescending_8_1.done && (_a = runsDescending_8.return)) _a.call(runsDescending_8);
|
|
331
|
+
}
|
|
332
|
+
finally { if (e_8) throw e_8.error; }
|
|
333
|
+
}
|
|
223
334
|
}), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
|
|
224
335
|
saveHistory({ charts: { patches: patches, inversePatches: inversePatches } });
|
|
225
336
|
return nextState;
|
|
226
337
|
});
|
|
227
338
|
onChangeProtectedRanges === null || onChangeProtectedRanges === void 0 ? void 0 : onChangeProtectedRanges(function (prevProtectedRanges) {
|
|
228
339
|
var _a = __read(produceWithPatches(prevProtectedRanges, function (draft) {
|
|
229
|
-
|
|
340
|
+
var e_9, _a;
|
|
341
|
+
try {
|
|
342
|
+
for (var runsDescending_9 = __values(runsDescending), runsDescending_9_1 = runsDescending_9.next(); !runsDescending_9_1.done; runsDescending_9_1 = runsDescending_9.next()) {
|
|
343
|
+
var run = runsDescending_9_1.value;
|
|
344
|
+
shiftProtectedRangesOnStructuralChange(draft, sheetId, "row", "delete", run.start, run.count);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
348
|
+
finally {
|
|
349
|
+
try {
|
|
350
|
+
if (runsDescending_9_1 && !runsDescending_9_1.done && (_a = runsDescending_9.return)) _a.call(runsDescending_9);
|
|
351
|
+
}
|
|
352
|
+
finally { if (e_9) throw e_9.error; }
|
|
353
|
+
}
|
|
230
354
|
}), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
|
|
231
355
|
saveHistory({ protectedRanges: { patches: patches, inversePatches: inversePatches } });
|
|
232
356
|
return nextState;
|
|
@@ -234,35 +358,49 @@ export var deleteRow = function (_a) {
|
|
|
234
358
|
// Sheet metadata
|
|
235
359
|
onChangeSheets === null || onChangeSheets === void 0 ? void 0 : onChangeSheets(function (prevSheets) {
|
|
236
360
|
var _a = __read(produceWithPatches(prevSheets, function (draft) {
|
|
237
|
-
var _a;
|
|
361
|
+
var e_10, _a;
|
|
362
|
+
var _b;
|
|
238
363
|
var sheet = draft.find(function (sheet) { return sheet.sheetId === sheetId; });
|
|
239
364
|
if (!sheet)
|
|
240
365
|
return;
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
366
|
+
try {
|
|
367
|
+
for (var runsDescending_10 = __values(runsDescending), runsDescending_10_1 = runsDescending_10.next(); !runsDescending_10_1.done; runsDescending_10_1 = runsDescending_10.next()) {
|
|
368
|
+
var run = runsDescending_10_1.value;
|
|
369
|
+
var runEnd = run.start + run.count - 1;
|
|
370
|
+
if (sheet.rowMetadata) {
|
|
371
|
+
sheet.rowMetadata.splice(run.start, run.count);
|
|
372
|
+
}
|
|
373
|
+
if (sheet.basicFilter) {
|
|
374
|
+
var _c = sheet.basicFilter.range, startRowIndex = _c.startRowIndex, endRowIndex = _c.endRowIndex;
|
|
375
|
+
if (run.start < startRowIndex) {
|
|
376
|
+
moveFilterView(sheet.basicFilter, run.count, Direction.Up);
|
|
377
|
+
}
|
|
378
|
+
if (run.start > startRowIndex && run.start <= endRowIndex) {
|
|
379
|
+
var delta = Math.min(endRowIndex - run.start + 1, run.count);
|
|
380
|
+
sheet.basicFilter.range.endRowIndex -= delta;
|
|
381
|
+
}
|
|
382
|
+
if (sheet.basicFilter.range.startRowIndex >= run.start &&
|
|
383
|
+
sheet.basicFilter.range.startRowIndex <= runEnd) {
|
|
384
|
+
delete sheet.basicFilter;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
if (sheet.merges) {
|
|
388
|
+
sheet.merges = shrinkMergesOnRowDelete(sheet.merges, run.start, run.count);
|
|
389
|
+
}
|
|
390
|
+
// `_xlnm.Print_Area` / `_xlnm.Print_Titles` follow the defined-name rule.
|
|
391
|
+
if (sheet.printSettings) {
|
|
392
|
+
updatePrintSettingsOnStructuralChange(sheet.printSettings, "row", "delete", run.start, run.count);
|
|
393
|
+
}
|
|
256
394
|
}
|
|
257
395
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
396
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
397
|
+
finally {
|
|
398
|
+
try {
|
|
399
|
+
if (runsDescending_10_1 && !runsDescending_10_1.done && (_a = runsDescending_10.return)) _a.call(runsDescending_10);
|
|
400
|
+
}
|
|
401
|
+
finally { if (e_10) throw e_10.error; }
|
|
264
402
|
}
|
|
265
|
-
sheet.rowCount = Math.max(1, ((
|
|
403
|
+
sheet.rowCount = Math.max(1, ((_b = sheet.rowCount) !== null && _b !== void 0 ? _b : rowCount) - count);
|
|
266
404
|
// Frozen panes are positional: the split stays where it is, only
|
|
267
405
|
// clamped so the freeze never exceeds the shrunk sheet.
|
|
268
406
|
if (sheet.frozenRowCount && sheet.frozenRowCount > sheet.rowCount) {
|
|
@@ -274,31 +412,44 @@ export var deleteRow = function (_a) {
|
|
|
274
412
|
});
|
|
275
413
|
// Tables every row of which goes (dropped above): their structured refs
|
|
276
414
|
// break to `#REF!`, computed from the PRE-edit definitions.
|
|
277
|
-
var removedTableParts = collectRemovedTableParts(tables, sheetId, "row", minRowIndex, maxRowIndex);
|
|
415
|
+
var removedTableParts = collectRemovedTableParts(tables, sheetId, "row", minRowIndex, maxRowIndex, sortedRowIndexes);
|
|
278
416
|
// Sheet data: three-pass formula update, then splice the rows out.
|
|
279
417
|
onChangeSheetData === null || onChangeSheetData === void 0 ? void 0 : onChangeSheetData(function (prevSheetData) {
|
|
280
418
|
var _a = __read(produceWithPatches(prevSheetData, function (draft) {
|
|
281
|
-
var
|
|
282
|
-
var
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
419
|
+
var e_11, _a, e_12, _b, e_13, _c, e_14, _d;
|
|
420
|
+
var _e;
|
|
421
|
+
try {
|
|
422
|
+
// A dynamic array whose anchor row is deleted takes its spill with
|
|
423
|
+
// it — drop the projected cells before the rows close up.
|
|
424
|
+
for (var runsDescending_11 = __values(runsDescending), runsDescending_11_1 = runsDescending_11.next(); !runsDescending_11_1.done; runsDescending_11_1 = runsDescending_11.next()) {
|
|
425
|
+
var run = runsDescending_11_1.value;
|
|
426
|
+
removeSpillsOfDeletedAnchors({
|
|
427
|
+
draft: draft,
|
|
428
|
+
sheetId: sheetId,
|
|
429
|
+
axis: "row",
|
|
430
|
+
minIndex: run.start,
|
|
431
|
+
maxIndex: run.start + run.count - 1,
|
|
432
|
+
getArrayRange: getArrayRange,
|
|
433
|
+
locale: locale,
|
|
434
|
+
cellXfsRegistry: cellXfsRegistry,
|
|
435
|
+
sharedStringRegistry: sharedStringRegistry,
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
440
|
+
finally {
|
|
441
|
+
try {
|
|
442
|
+
if (runsDescending_11_1 && !runsDescending_11_1.done && (_a = runsDescending_11.return)) _a.call(runsDescending_11);
|
|
443
|
+
}
|
|
444
|
+
finally { if (e_11) throw e_11.error; }
|
|
445
|
+
}
|
|
296
446
|
breakStructuredRefsForRemovedTableParts({
|
|
297
447
|
draft: draft,
|
|
298
448
|
sheetId: sheetId,
|
|
299
449
|
axis: "row",
|
|
300
450
|
referenceIndex: minRowIndex,
|
|
301
451
|
count: count,
|
|
452
|
+
indexes: sortedRowIndexes,
|
|
302
453
|
removed: removedTableParts,
|
|
303
454
|
getGraphNodes: getGraphNodes,
|
|
304
455
|
enqueueCalculation: enqueueCalculation,
|
|
@@ -315,6 +466,7 @@ export var deleteRow = function (_a) {
|
|
|
315
466
|
sheetId: sheetId,
|
|
316
467
|
referenceIndex: minRowIndex,
|
|
317
468
|
count: count,
|
|
469
|
+
indexes: sortedRowIndexes,
|
|
318
470
|
rowCount: rowCount,
|
|
319
471
|
columnCount: columnCount,
|
|
320
472
|
getDependents: getDependents,
|
|
@@ -330,7 +482,7 @@ export var deleteRow = function (_a) {
|
|
|
330
482
|
});
|
|
331
483
|
// Splice from the end so indices don't shift mid-loop.
|
|
332
484
|
for (var i = sortedRowIndexes.length - 1; i >= 0; i--) {
|
|
333
|
-
(
|
|
485
|
+
(_e = draft[sheetId]) === null || _e === void 0 ? void 0 : _e.splice(sortedRowIndexes[i], 1);
|
|
334
486
|
}
|
|
335
487
|
try {
|
|
336
488
|
for (var emptiedTotalsTables_1 = __values(emptiedTotalsTables), emptiedTotalsTables_1_1 = emptiedTotalsTables_1.next(); !emptiedTotalsTables_1_1.done; emptiedTotalsTables_1_1 = emptiedTotalsTables_1.next()) {
|
|
@@ -346,8 +498,8 @@ export var deleteRow = function (_a) {
|
|
|
346
498
|
bodyRow[bodyRowIndex].values[columnIndex];
|
|
347
499
|
bodyRow[bodyRowIndex].values[columnIndex] = totalsCell;
|
|
348
500
|
try {
|
|
349
|
-
for (var
|
|
350
|
-
var rowIndex =
|
|
501
|
+
for (var _f = (e_13 = void 0, __values([totalsRowIndex, bodyRowIndex])), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
502
|
+
var rowIndex = _g.value;
|
|
351
503
|
enqueueCalculation === null || enqueueCalculation === void 0 ? void 0 : enqueueCalculation({
|
|
352
504
|
type: "dirty",
|
|
353
505
|
position: { sheetId: sheetId, rowIndex: rowIndex, columnIndex: columnIndex },
|
|
@@ -355,22 +507,22 @@ export var deleteRow = function (_a) {
|
|
|
355
507
|
recalcCells.set(createSheetCellIdentifier(sheetId, rowIndex, columnIndex), { sheetId: sheetId, rowIndex: rowIndex, columnIndex: columnIndex });
|
|
356
508
|
}
|
|
357
509
|
}
|
|
358
|
-
catch (
|
|
510
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
359
511
|
finally {
|
|
360
512
|
try {
|
|
361
|
-
if (
|
|
513
|
+
if (_g && !_g.done && (_c = _f.return)) _c.call(_f);
|
|
362
514
|
}
|
|
363
|
-
finally { if (
|
|
515
|
+
finally { if (e_13) throw e_13.error; }
|
|
364
516
|
}
|
|
365
517
|
}
|
|
366
518
|
}
|
|
367
519
|
}
|
|
368
|
-
catch (
|
|
520
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
369
521
|
finally {
|
|
370
522
|
try {
|
|
371
|
-
if (emptiedTotalsTables_1_1 && !emptiedTotalsTables_1_1.done && (
|
|
523
|
+
if (emptiedTotalsTables_1_1 && !emptiedTotalsTables_1_1.done && (_b = emptiedTotalsTables_1.return)) _b.call(emptiedTotalsTables_1);
|
|
372
524
|
}
|
|
373
|
-
finally { if (
|
|
525
|
+
finally { if (e_12) throw e_12.error; }
|
|
374
526
|
}
|
|
375
527
|
// A table that lost its header row: the row that closed up under
|
|
376
528
|
// it is the header now (Excel) — its cells become the (text,
|
|
@@ -435,16 +587,16 @@ export var deleteRow = function (_a) {
|
|
|
435
587
|
};
|
|
436
588
|
try {
|
|
437
589
|
for (var headerRederivedTables_1 = __values(headerRederivedTables), headerRederivedTables_1_1 = headerRederivedTables_1.next(); !headerRederivedTables_1_1.done; headerRederivedTables_1_1 = headerRederivedTables_1.next()) {
|
|
438
|
-
var
|
|
590
|
+
var _h = headerRederivedTables_1_1.value, table = _h.table, nextRange = _h.nextRange;
|
|
439
591
|
_loop_1(table, nextRange);
|
|
440
592
|
}
|
|
441
593
|
}
|
|
442
|
-
catch (
|
|
594
|
+
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
443
595
|
finally {
|
|
444
596
|
try {
|
|
445
|
-
if (headerRederivedTables_1_1 && !headerRederivedTables_1_1.done && (
|
|
597
|
+
if (headerRederivedTables_1_1 && !headerRederivedTables_1_1.done && (_d = headerRederivedTables_1.return)) _d.call(headerRederivedTables_1);
|
|
446
598
|
}
|
|
447
|
-
finally { if (
|
|
599
|
+
finally { if (e_14) throw e_14.error; }
|
|
448
600
|
}
|
|
449
601
|
}), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
|
|
450
602
|
saveHistory({
|
|
@@ -461,7 +613,7 @@ export var deleteRow = function (_a) {
|
|
|
461
613
|
if (rederivedColumnNames.size) {
|
|
462
614
|
onChangeTables === null || onChangeTables === void 0 ? void 0 : onChangeTables(function (prevTables) {
|
|
463
615
|
var _a = __read(produceWithPatches(prevTables, function (draft) {
|
|
464
|
-
var
|
|
616
|
+
var e_15, _a;
|
|
465
617
|
var _loop_2 = function (table) {
|
|
466
618
|
var names = rederivedColumnNames.get(table.id);
|
|
467
619
|
if (!names)
|
|
@@ -477,12 +629,12 @@ export var deleteRow = function (_a) {
|
|
|
477
629
|
_loop_2(table);
|
|
478
630
|
}
|
|
479
631
|
}
|
|
480
|
-
catch (
|
|
632
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
481
633
|
finally {
|
|
482
634
|
try {
|
|
483
635
|
if (draft_1_1 && !draft_1_1.done && (_a = draft_1.return)) _a.call(draft_1);
|
|
484
636
|
}
|
|
485
|
-
finally { if (
|
|
637
|
+
finally { if (e_15) throw e_15.error; }
|
|
486
638
|
}
|
|
487
639
|
}), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
|
|
488
640
|
saveHistory({ tables: { patches: patches, inversePatches: inversePatches } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duplicate-sheet.d.ts","sourceRoot":"","sources":["../../../interface/duplicate-sheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAc,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"duplicate-sheet.d.ts","sourceRoot":"","sources":["../../../interface/duplicate-sheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAc,MAAM,2BAA2B,CAAC;AAe7E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAGhF,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,sPAejE,wBAAwB,CAAC,CAAC,EAAE,CAAC,CAAC,MACvB,SAAS,MAAM,EAAE,0BAA0B,MAAM,uBAkT1D,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __assign, __read, __spreadArray, __values } from "tslib";
|
|
2
|
-
import { getCellUserEnteredValue, getExtendedValueFormula, getNextTableCopyName, uuid, } from "@rowsncolumns/utils";
|
|
2
|
+
import { getCellUserEnteredValue, getExtendedValueFormula, getNextTableCopyName, uniqueSheetTitle, uuid, } from "@rowsncolumns/utils";
|
|
3
3
|
import { castDraft, produceWithPatches } from "immer";
|
|
4
4
|
import { retargetChartSpecRanges } from "../api/anchored-objects";
|
|
5
5
|
import { renameTablesInFormula } from "../api/formula";
|
|
@@ -273,12 +273,7 @@ export var duplicateSheet = function (_a) {
|
|
|
273
273
|
* @returns
|
|
274
274
|
*/
|
|
275
275
|
function generateUniqueSheetName(existingSheets, originalName, generatedNames) {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
while (existingSheets.includes(newName)) {
|
|
280
|
-
counter++;
|
|
281
|
-
newName = counter === 1 ? baseName : "".concat(baseName, " ").concat(counter - 1);
|
|
282
|
-
}
|
|
283
|
-
return newName;
|
|
276
|
+
// `Copy of X`, then `Copy of X 1`, `Copy of X 2`, … — compared the way Excel compares worksheet
|
|
277
|
+
// names (case-insensitively), so a copy never lands on a title that differs only by case.
|
|
278
|
+
return uniqueSheetTitle(getGeneratedSheetCopyName(originalName, generatedNames), existingSheets);
|
|
284
279
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insert-column.d.ts","sourceRoot":"","sources":["../../../interface/insert-column.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAqC5E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI7D,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,ohBA+B/D,sBAAsB,CAAC,CAAC,EAAE,CAAC,CAAC,MACrB,SAAS,MAAM,EAAE,sBAAsB,MAAM,EAAE,mBAAc,
|
|
1
|
+
{"version":3,"file":"insert-column.d.ts","sourceRoot":"","sources":["../../../interface/insert-column.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAqC5E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI7D,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,ohBA+B/D,sBAAsB,CAAC,CAAC,EAAE,CAAC,CAAC,MACrB,SAAS,MAAM,EAAE,sBAAsB,MAAM,EAAE,mBAAc,SAsbtE,CAAC;AAMF,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,qRAkBpE,IAAI,CACL,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,EACnB,QAAQ,GACR,aAAa,GACb,UAAU,GACV,QAAQ,GACR,iBAAiB,GACjB,sBAAsB,GACtB,eAAe,GACf,gBAAgB,GAChB,gBAAgB,GAChB,mBAAmB,GACnB,gBAAgB,GAChB,oBAAoB,GACpB,wBAAwB,GACxB,uBAAuB,GACvB,eAAe,GACf,cAAc,GACd,gBAAgB,CACnB,MAEG,WAAW,SAAS,EACpB,gBAAgB,MAAM,EACtB,WAAW,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,KAAK,EAC3C,cAAS,SAwXZ,CAAC"}
|
|
@@ -123,7 +123,7 @@ export var insertColumn = function (_a) {
|
|
|
123
123
|
// column C for an insert at A), decided by the sheet the range lives on.
|
|
124
124
|
onChangeNamedRanges === null || onChangeNamedRanges === void 0 ? void 0 : onChangeNamedRanges(function (prevNamedRanges) {
|
|
125
125
|
var _a = __read(produceWithPatches(prevNamedRanges, function (draft) {
|
|
126
|
-
updateNamedRangesOnStructuralChange(draft, "column", "insert", referenceColumnIndex, numColumns, sheetId);
|
|
126
|
+
updateNamedRangesOnStructuralChange(draft, "column", "insert", referenceColumnIndex, numColumns, sheetId, { length: columnCount, max: maxColumnCount });
|
|
127
127
|
}), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
|
|
128
128
|
saveHistory({ namedRanges: { patches: patches, inversePatches: inversePatches } });
|
|
129
129
|
return nextState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insert-row.d.ts","sourceRoot":"","sources":["../../../interface/insert-row.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAwBjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGtE,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,yfA6B5D,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,MAClB,SAAS,MAAM,EAAE,mBAAmB,MAAM,EAAE,gBAAW,
|
|
1
|
+
{"version":3,"file":"insert-row.d.ts","sourceRoot":"","sources":["../../../interface/insert-row.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAwBjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGtE,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,yfA6B5D,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,MAClB,SAAS,MAAM,EAAE,mBAAmB,MAAM,EAAE,gBAAW,SA8UhE,CAAC"}
|
|
@@ -76,7 +76,7 @@ export var insertRow = function (_a) {
|
|
|
76
76
|
// by the sheet its range lives on — not by the name's scope.
|
|
77
77
|
onChangeNamedRanges === null || onChangeNamedRanges === void 0 ? void 0 : onChangeNamedRanges(function (prevNamedRanges) {
|
|
78
78
|
var _a = __read(produceWithPatches(prevNamedRanges, function (draft) {
|
|
79
|
-
updateNamedRangesOnStructuralChange(draft, "row", "insert", referenceRowIndex, numRows, sheetId);
|
|
79
|
+
updateNamedRangesOnStructuralChange(draft, "row", "insert", referenceRowIndex, numRows, sheetId, { length: rowCount, max: maxRowCount });
|
|
80
80
|
}), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
|
|
81
81
|
saveHistory({ namedRanges: { patches: patches, inversePatches: inversePatches } });
|
|
82
82
|
return nextState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-sheet.d.ts","sourceRoot":"","sources":["../../../interface/new-sheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAUjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAmB1E,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,0JAWjE,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,MACpB,YAAY,OAAO,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"new-sheet.d.ts","sourceRoot":"","sources":["../../../interface/new-sheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAUjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAmB1E,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,0JAWjE,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,MACpB,YAAY,OAAO,CAAC,KAAK,CAAC,KAuHT,CAE1B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __assign, __read, __spreadArray } from "tslib";
|
|
2
|
-
import { uuid } from "@rowsncolumns/utils";
|
|
2
|
+
import { uniqueSheetTitle, uuid } from "@rowsncolumns/utils";
|
|
3
3
|
import { produceWithPatches } from "immer";
|
|
4
4
|
import { getGeneratedSheetName } from "../generated-names";
|
|
5
5
|
import { MAX_SHEET_TITLE_LENGTH, truncateSheetTitle, } from "../helpers/sheet-title";
|
|
@@ -40,18 +40,11 @@ export var createNewSheet = function (_a) {
|
|
|
40
40
|
createdSheet = draft.find(function (s) { return s.sheetId === sheetSpec.sheetId; });
|
|
41
41
|
return; // Don't add duplicate
|
|
42
42
|
}
|
|
43
|
-
// Generate unique title
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var finalTitle =
|
|
47
|
-
|
|
48
|
-
var existingTitles = new Set(draft.map(function (s) { return s.title; }));
|
|
49
|
-
while (existingTitles.has(finalTitle)) {
|
|
50
|
-
var suffix = "".concat(counter);
|
|
51
|
-
var titlePrefix = baseTitle.slice(0, Math.max(0, MAX_SHEET_TITLE_LENGTH - suffix.length));
|
|
52
|
-
finalTitle = "".concat(titlePrefix).concat(suffix);
|
|
53
|
-
counter++;
|
|
54
|
-
}
|
|
43
|
+
// Generate a unique title against the CURRENT draft state — compared the way Excel
|
|
44
|
+
// compares worksheet names (case-insensitively), so a requested `sheet1` beside
|
|
45
|
+
// `Sheet1` gets a suffix instead of a case-colliding twin.
|
|
46
|
+
var finalTitle = uniqueSheetTitle(truncateSheetTitle((sheetSpec === null || sheetSpec === void 0 ? void 0 : sheetSpec.title) ||
|
|
47
|
+
getGeneratedSheetName(draft.length + 1, generatedNames)), draft.map(function (s) { return s.title; }), MAX_SHEET_TITLE_LENGTH);
|
|
55
48
|
// Create the new sheet
|
|
56
49
|
var newSheet = createNewSheetHelper(newSheetId, finalTitle, (_d = sheetSpec === null || sheetSpec === void 0 ? void 0 : sheetSpec.rowCount) !== null && _d !== void 0 ? _d : maxRowCount, (_e = sheetSpec === null || sheetSpec === void 0 ? void 0 : sheetSpec.columnCount) !== null && _e !== void 0 ? _e : maxColumnCount, (_f = sheetSpec === null || sheetSpec === void 0 ? void 0 : sheetSpec.hidden) !== null && _f !== void 0 ? _f : false);
|
|
57
50
|
// Determine visual insertion index (after current active sheet) without
|
package/dist/cjs/sheet-cell.d.ts
CHANGED
|
@@ -26,6 +26,14 @@ export declare function isStyleReference(obj: any): obj is StyleReference;
|
|
|
26
26
|
* from cellData without a stringly-typed comparison.
|
|
27
27
|
*/
|
|
28
28
|
export declare const LOADING_VALUE = "Loading...";
|
|
29
|
+
/**
|
|
30
|
+
* Excel's text-entry escape: a leading apostrophe forces the rest of the
|
|
31
|
+
* entry to be stored as text. The prefix is kept in `ue.sv` (`'0123`) so
|
|
32
|
+
* the formula bar shows it and a later re-entry stays text; the effective
|
|
33
|
+
* value / display is the stripped remainder.
|
|
34
|
+
*/
|
|
35
|
+
export declare const hasExcelTextPrefix: (value: unknown) => value is string;
|
|
36
|
+
export declare const stripExcelTextPrefix: (value: string) => string;
|
|
29
37
|
export declare class SheetCell<T extends CellData = CellData> {
|
|
30
38
|
private static defaultSharedStrings;
|
|
31
39
|
private static defaultEnableAtFormula;
|
|
@@ -69,6 +77,7 @@ export declare class SheetCell<T extends CellData = CellData> {
|
|
|
69
77
|
version?: number | undefined | null;
|
|
70
78
|
updatedAt?: number | undefined | null;
|
|
71
79
|
arrayFormulaRef: string | undefined;
|
|
80
|
+
legacyArrayFormula: boolean | undefined;
|
|
72
81
|
sharedFormulaSpec: {
|
|
73
82
|
si: number;
|
|
74
83
|
ref?: string;
|