@rowsncolumns/spreadsheet-state 29.1.16 → 29.1.17

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.
@@ -5,9 +5,9 @@ export type UseOnRequestCreateTableProps = {
5
5
  };
6
6
  /**
7
7
  * Open Excel's "Create Table" dialog (Ctrl+T / Insert → Table / Format as Table): the range
8
- * pre-fills with the selection, else the data region around the active cell (Ctrl+A's region),
9
- * and "My table has headers" is guessed from that range's first row. The dialog submits through
10
- * `onCreateTable`.
8
+ * pre-fills with the selection, else — with none, or one collapsed on a single cell — the data
9
+ * region around the active cell (Ctrl+A's region), and "My table has headers" is guessed from
10
+ * that range's first row. The dialog submits through `onCreateTable`.
11
11
  */
12
12
  export declare const useOnRequestCreateTable: ({ getEffectiveExtendedValue, }: UseOnRequestCreateTableProps) => (sheetId: number, activeCell: CellInterface, selections: SelectionArea<SelectionAttributes>[], theme?: TableTheme, bandedRange?: BandedDefinition) => void;
13
13
  //# sourceMappingURL=use-on-request-create-table.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-on-request-create-table.d.ts","sourceRoot":"","sources":["../../../hooks/use-on-request-create-table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,aAAa,EACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACX,MAAM,2BAA2B,CAAC;AASnC,MAAM,MAAM,4BAA4B,GAAG;IACzC,yBAAyB,EAAE,CACzB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,KAChB,aAAa,GAAG,IAAI,GAAG,SAAS,CAAC;CACvC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,gCAErC,4BAA4B,eAMhB,MAAM,cACH,aAAa,cACb,aAAa,CAAC,mBAAmB,CAAC,EAAE,UACxC,UAAU,gBACJ,gBAAgB,SA6BnC,CAAC"}
1
+ {"version":3,"file":"use-on-request-create-table.d.ts","sourceRoot":"","sources":["../../../hooks/use-on-request-create-table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,aAAa,EACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACX,MAAM,2BAA2B,CAAC;AASnC,MAAM,MAAM,4BAA4B,GAAG;IACzC,yBAAyB,EAAE,CACzB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,KAChB,aAAa,GAAG,IAAI,GAAG,SAAS,CAAC;CACvC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,gCAErC,4BAA4B,eAMhB,MAAM,cACH,aAAa,cACb,aAAa,CAAC,mBAAmB,CAAC,EAAE,UACxC,UAAU,gBACJ,gBAAgB,SAkCnC,CAAC"}
@@ -6,9 +6,9 @@ import { useSetCreatingTable } from "../atoms/creating-table.atom";
6
6
  import { useSetCreateTableDialogValue } from "../atoms/dialog-state.atom";
7
7
  /**
8
8
  * Open Excel's "Create Table" dialog (Ctrl+T / Insert → Table / Format as Table): the range
9
- * pre-fills with the selection, else the data region around the active cell (Ctrl+A's region),
10
- * and "My table has headers" is guessed from that range's first row. The dialog submits through
11
- * `onCreateTable`.
9
+ * pre-fills with the selection, else — with none, or one collapsed on a single cell — the data
10
+ * region around the active cell (Ctrl+A's region), and "My table has headers" is guessed from
11
+ * that range's first row. The dialog submits through `onCreateTable`.
12
12
  */
13
13
  export var useOnRequestCreateTable = function (_a) {
14
14
  var getEffectiveExtendedValue = _a.getEffectiveExtendedValue;
@@ -18,7 +18,11 @@ export var useOnRequestCreateTable = function (_a) {
18
18
  return useCallback(function (sheetId, activeCell, selections, theme, bandedRange) {
19
19
  var _a;
20
20
  var lastSelection = selections === null || selections === void 0 ? void 0 : selections[selections.length - 1];
21
- var range = lastSelection
21
+ var collapsed = !lastSelection ||
22
+ (lastSelection.range.startRowIndex === lastSelection.range.endRowIndex &&
23
+ lastSelection.range.startColumnIndex ===
24
+ lastSelection.range.endColumnIndex);
25
+ var range = !collapsed
22
26
  ? lastSelection.range
23
27
  : (_a = getContentfulRangeAroundCell === null || getContentfulRangeAroundCell === void 0 ? void 0 : getContentfulRangeAroundCell(sheetId, activeCell)) !== null && _a !== void 0 ? _a : selectionFromActiveCell(activeCell)[0].range;
24
28
  setCreatingTable({
@@ -1 +1 @@
1
- {"version":3,"file":"delete-cells.d.ts","sourceRoot":"","sources":["../../../interface/delete-cells.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAEb,aAAa,EACd,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EACV,QAAQ,EAER,mBAAmB,EACnB,KAAK,EACN,MAAM,2BAA2B,CAAC;AAKnC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAK/D,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,UAAU,GAAG,SAAS,CAAC;AAEvD,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,gUAoB9D,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,MAErB,SAAS,MAAM,EACf,MAAM,aAAa,EACnB,YAAY,aAAa,CAAC,mBAAmB,CAAC,EAAE,EAChD,YAAW,SAAsB,SAgSpC,CAAC"}
1
+ {"version":3,"file":"delete-cells.d.ts","sourceRoot":"","sources":["../../../interface/delete-cells.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAEb,aAAa,EACd,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EACV,QAAQ,EAER,mBAAmB,EACnB,KAAK,EACN,MAAM,2BAA2B,CAAC;AAKnC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAM/D,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,UAAU,GAAG,SAAS,CAAC;AAEvD,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,gUAoB9D,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,MAErB,SAAS,MAAM,EACf,MAAM,aAAa,EACnB,YAAY,aAAa,CAAC,mBAAmB,CAAC,EAAE,EAChD,YAAW,SAAsB,SA+TpC,CAAC"}
@@ -5,6 +5,7 @@ import { produceWithPatches } from "immer";
5
5
  import { createSheetCellIdentifier } from "../api/formula";
6
6
  import { createSheetDraft } from "../api/immer-utils";
7
7
  import { SheetCell } from "../sheet-cell";
8
+ import { releaseTableFilterRows } from "./remove-table";
8
9
  import { getTableHeaderRefills } from "./table-utils";
9
10
  export var deleteCells = function (_a) {
10
11
  var locale = _a.locale, rowCount = _a.rowCount, cellXfsRegistry = _a.cellXfsRegistry, sharedStringRegistry = _a.sharedStringRegistry, getDataValidationById = _a.getDataValidationById, getDependents = _a.getDependents, getDataRowCount = _a.getDataRowCount, onChangeSheetData = _a.onChangeSheetData, onChangeSheets = _a.onChangeSheets, onChangeTables = _a.onChangeTables, onChangeCitations = _a.onChangeCitations, onChangeActiveCell = _a.onChangeActiveCell, enqueueCalculation = _a.enqueueCalculation, enqueueStructureChange = _a.enqueueStructureChange, createHistory = _a.createHistory, isArrayFormula = _a.isArrayFormula, getRowHeight = _a.getRowHeight, tables = _a.tables, generatedNames = _a.generatedNames;
@@ -18,13 +19,28 @@ export var deleteCells = function (_a) {
18
19
  : selectionFromActiveCell(cell);
19
20
  var saveHistory = createHistory();
20
21
  var maxRowCount = getDataRowCount();
21
- // A table survives Delete / Clear (Excel): only its cells empty out, and
22
- // cleared header cells are re-named `ColumnN` so the header row and
23
- // `columns[]` stay in step.
22
+ // Delete / Clear over a selection that covers a whole table deletes the table (Excel's
23
+ // "select the table and press Delete"): the table, its filter and its style go with the
24
+ // cells, and the structured references into it error as they do for any deleted table
25
+ // (Convert to Range is the path that rewrites them to A1).
26
+ var removedTables = shouldClearContents
27
+ ? (tables !== null && tables !== void 0 ? tables : []).filter(function (table) {
28
+ return table.sheetId === sheetId &&
29
+ finalSelections.some(function (selection) {
30
+ return areaInsideArea(table.range, selection.range);
31
+ });
32
+ })
33
+ : [];
34
+ var keptTables = removedTables.length
35
+ ? tables === null || tables === void 0 ? void 0 : tables.filter(function (table) { return !removedTables.includes(table); })
36
+ : tables;
37
+ // A table survives Delete / Clear over part of it (Excel): only its cells
38
+ // empty out, and cleared header cells are re-named `ColumnN` so the header
39
+ // row and `columns[]` stay in step.
24
40
  var headerRefills = shouldClearContents
25
41
  ? getTableHeaderRefills({
26
42
  sheetId: sheetId,
27
- tables: tables,
43
+ tables: keptTables,
28
44
  selections: finalSelections,
29
45
  generatedNames: generatedNames,
30
46
  })
@@ -170,17 +186,36 @@ export var deleteCells = function (_a) {
170
186
  });
171
187
  return nextState;
172
188
  });
173
- // Rename the columns whose header cells were cleared
174
- if (headerRefills.length) {
189
+ // Drop the tables the selection covered, and rename the columns whose header cells were cleared
190
+ if (headerRefills.length || removedTables.length) {
175
191
  onChangeTables === null || onChangeTables === void 0 ? void 0 : onChangeTables(function (prevTables) {
176
192
  var _a = __read(produceWithPatches(prevTables, function (draft) {
177
- var e_4, _a;
178
- var _b;
179
- var _loop_1 = function (tableId, dimensionIndex, name_2) {
193
+ var e_4, _a, e_5, _b;
194
+ var _c;
195
+ var _loop_1 = function (removed) {
196
+ var tableIndex = draft.findIndex(function (table) { return table.id == removed.id; });
197
+ if (tableIndex !== -1) {
198
+ draft.splice(tableIndex, 1);
199
+ }
200
+ };
201
+ try {
202
+ for (var removedTables_1 = __values(removedTables), removedTables_1_1 = removedTables_1.next(); !removedTables_1_1.done; removedTables_1_1 = removedTables_1.next()) {
203
+ var removed = removedTables_1_1.value;
204
+ _loop_1(removed);
205
+ }
206
+ }
207
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
208
+ finally {
209
+ try {
210
+ if (removedTables_1_1 && !removedTables_1_1.done && (_a = removedTables_1.return)) _a.call(removedTables_1);
211
+ }
212
+ finally { if (e_4) throw e_4.error; }
213
+ }
214
+ var _loop_2 = function (tableId, dimensionIndex, name_2) {
180
215
  var table = draft.find(function (table) { return table.sheetId === sheetId && table.id === tableId; });
181
216
  if (!table)
182
217
  return "continue";
183
- (_b = table.columns) !== null && _b !== void 0 ? _b : (table.columns = []);
218
+ (_c = table.columns) !== null && _c !== void 0 ? _c : (table.columns = []);
184
219
  var column = table.columns[dimensionIndex];
185
220
  if (column) {
186
221
  column.name = name_2;
@@ -191,16 +226,16 @@ export var deleteCells = function (_a) {
191
226
  };
192
227
  try {
193
228
  for (var headerRefills_2 = __values(headerRefills), headerRefills_2_1 = headerRefills_2.next(); !headerRefills_2_1.done; headerRefills_2_1 = headerRefills_2.next()) {
194
- var _c = headerRefills_2_1.value, tableId = _c.tableId, dimensionIndex = _c.dimensionIndex, name_2 = _c.name;
195
- _loop_1(tableId, dimensionIndex, name_2);
229
+ var _d = headerRefills_2_1.value, tableId = _d.tableId, dimensionIndex = _d.dimensionIndex, name_2 = _d.name;
230
+ _loop_2(tableId, dimensionIndex, name_2);
196
231
  }
197
232
  }
198
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
233
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
199
234
  finally {
200
235
  try {
201
- if (headerRefills_2_1 && !headerRefills_2_1.done && (_a = headerRefills_2.return)) _a.call(headerRefills_2);
236
+ if (headerRefills_2_1 && !headerRefills_2_1.done && (_b = headerRefills_2.return)) _b.call(headerRefills_2);
202
237
  }
203
- finally { if (e_4) throw e_4.error; }
238
+ finally { if (e_5) throw e_5.error; }
204
239
  }
205
240
  }), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
206
241
  saveHistory({
@@ -208,6 +243,13 @@ export var deleteCells = function (_a) {
208
243
  });
209
244
  return nextState;
210
245
  });
246
+ releaseTableFilterRows({
247
+ tables: removedTables,
248
+ onChangeSheets: onChangeSheets,
249
+ saveHistory: saveHistory,
250
+ getDependents: getDependents,
251
+ enqueueCalculation: enqueueCalculation,
252
+ });
211
253
  }
212
254
  // Update citations - retire citations whose cited cells lose their contents.
213
255
  // Clearing formats only leaves the cited values in place, so the citations stay.
@@ -215,7 +257,7 @@ export var deleteCells = function (_a) {
215
257
  onChangeCitations === null || onChangeCitations === void 0 ? void 0 : onChangeCitations(function (prevCitations) {
216
258
  var updatedAt = new Date().toISOString();
217
259
  var _a = __read(produceWithPatches(prevCitations, function (draft) {
218
- var _loop_2 = function (idx) {
260
+ var _loop_3 = function (idx) {
219
261
  var citation = draft[idx];
220
262
  // Check if citation is active, on the same sheet and inside a cleared selection
221
263
  if (citation.active !== false &&
@@ -229,7 +271,7 @@ export var deleteCells = function (_a) {
229
271
  }
230
272
  };
231
273
  for (var idx = draft.length - 1; idx >= 0; idx--) {
232
- _loop_2(idx);
274
+ _loop_3(idx);
233
275
  }
234
276
  }), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
235
277
  saveHistory({
@@ -241,11 +283,11 @@ export var deleteCells = function (_a) {
241
283
  // Update banded cells
242
284
  onChangeSheets === null || onChangeSheets === void 0 ? void 0 : onChangeSheets(function (prevSheets) {
243
285
  var _a = __read(produceWithPatches(prevSheets, function (draft) {
244
- var e_5, _a;
286
+ var e_6, _a;
245
287
  var _b, _c, _d, _e, _f;
246
288
  var sheet = draft.find(function (sheet) { return sheet.sheetId === sheetId; });
247
289
  if (sheet) {
248
- var _loop_3 = function (selection) {
290
+ var _loop_4 = function (selection) {
249
291
  for (var rowIndex = selection.range.startRowIndex; rowIndex <=
250
292
  Math.min(maxRowCount !== null && maxRowCount !== void 0 ? maxRowCount : rowCount, selection.range.endRowIndex); rowIndex++) {
251
293
  var isRowResizedByUser = !!((_c = (_b = sheet === null || sheet === void 0 ? void 0 : sheet.rowMetadata) === null || _b === void 0 ? void 0 : _b[rowIndex]) === null || _c === void 0 ? void 0 : _c.resizedByUser);
@@ -270,15 +312,15 @@ export var deleteCells = function (_a) {
270
312
  // Adjust row height
271
313
  for (var finalSelections_3 = __values(finalSelections), finalSelections_3_1 = finalSelections_3.next(); !finalSelections_3_1.done; finalSelections_3_1 = finalSelections_3.next()) {
272
314
  var selection = finalSelections_3_1.value;
273
- _loop_3(selection);
315
+ _loop_4(selection);
274
316
  }
275
317
  }
276
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
318
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
277
319
  finally {
278
320
  try {
279
321
  if (finalSelections_3_1 && !finalSelections_3_1.done && (_a = finalSelections_3.return)) _a.call(finalSelections_3);
280
322
  }
281
- finally { if (e_5) throw e_5.error; }
323
+ finally { if (e_6) throw e_6.error; }
282
324
  }
283
325
  }
284
326
  }), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
@@ -1,4 +1,15 @@
1
1
  import type { CellData, Sheet, TableView } from "@rowsncolumns/spreadsheet";
2
2
  import type { UseOnTableProps } from "../hooks/use-on-table";
3
3
  export declare const removeTable: <T extends CellData, S extends Sheet>({ locale, cellXfsRegistry, sharedStringRegistry, getSheetName, onChangeTables, onChangeSheets, onChangeSheetData, createHistory, getDependents, getGraphNodes, getBandedCells, enqueueCalculation, enqueueGraphOperation, }: Pick<UseOnTableProps<T, S>, "locale" | "cellXfsRegistry" | "sharedStringRegistry" | "getSheetName" | "onChangeTables" | "onChangeSheets" | "onChangeSheetData" | "getDependents" | "getGraphNodes" | "getBandedCells" | "enqueueCalculation" | "enqueueGraphOperation" | "createHistory">) => (tableView: TableView) => void;
4
+ /**
5
+ * A removed table's filter goes with it: the rows it hid become visible again, in the history step
6
+ * of the removal (`saveHistory`). Their values did not change, so only the formulas that read
7
+ * visibility — `SUBTOTAL(101…111)` / `AGGREGATE` over those rows — are stale; dirtying the
8
+ * un-hidden cells recalculates exactly those dependents. Shared by Convert to Range
9
+ * (`removeTable`) and Delete over a whole table (`deleteCells`).
10
+ */
11
+ export declare const releaseTableFilterRows: <T extends CellData, S extends Sheet>({ tables, onChangeSheets, saveHistory, getDependents, enqueueCalculation, }: Pick<UseOnTableProps<T, S>, "onChangeSheets" | "getDependents" | "enqueueCalculation"> & {
12
+ tables: TableView[];
13
+ saveHistory: ReturnType<UseOnTableProps<T, S>["createHistory"]>;
14
+ }) => void;
4
15
  //# sourceMappingURL=remove-table.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"remove-table.d.ts","sourceRoot":"","sources":["../../../interface/remove-table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAK5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI7D,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,6NAc9D,IAAI,CACL,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,EACnB,QAAQ,GACR,iBAAiB,GACjB,sBAAsB,GACtB,cAAc,GACd,gBAAgB,GAChB,gBAAgB,GAChB,mBAAmB,GACnB,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,oBAAoB,GACpB,uBAAuB,GACvB,eAAe,CAClB,MACS,WAAW,SAAS,SAwH7B,CAAC"}
1
+ {"version":3,"file":"remove-table.d.ts","sourceRoot":"","sources":["../../../interface/remove-table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAK5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI7D,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,6NAc9D,IAAI,CACL,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,EACnB,QAAQ,GACR,iBAAiB,GACjB,sBAAsB,GACtB,cAAc,GACd,gBAAgB,GAChB,gBAAgB,GAChB,mBAAmB,GACnB,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,oBAAoB,GACpB,uBAAuB,GACvB,eAAe,CAClB,MACS,WAAW,SAAS,SA0E7B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,6EAMzE,IAAI,CACL,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,EACrB,gBAAgB,GAAG,eAAe,GAAG,oBAAoB,CAC1D,GAAG;IACF,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,WAAW,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC;CACjE,SAoDA,CAAC"}
@@ -59,51 +59,82 @@ export var removeTable = function (_a) {
59
59
  });
60
60
  return nextState;
61
61
  });
62
- // The table's filter goes with it: rows it hid become visible again. Their values did not
63
- // change, so only the formulas that read visibility — `SUBTOTAL(101…111)` / `AGGREGATE` over
64
- // those rows — are stale; dirtying the un-hidden cells recalculates exactly those dependents
65
- // (the rewritten structured references were re-entered above with `force`).
66
- var unhiddenRecalcCells = new Map();
67
- onChangeSheets(function (prevSheets) {
68
- var _a = __read(produceWithPatches(prevSheets, function (draft) {
69
- var e_1, _a;
70
- var _b;
62
+ releaseTableFilterRows({
63
+ tables: [tableView],
64
+ onChangeSheets: onChangeSheets,
65
+ saveHistory: saveHistory,
66
+ getDependents: getDependents,
67
+ enqueueCalculation: enqueueCalculation,
68
+ });
69
+ };
70
+ };
71
+ /**
72
+ * A removed table's filter goes with it: the rows it hid become visible again, in the history step
73
+ * of the removal (`saveHistory`). Their values did not change, so only the formulas that read
74
+ * visibility — `SUBTOTAL(101…111)` / `AGGREGATE` over those rows — are stale; dirtying the
75
+ * un-hidden cells recalculates exactly those dependents. Shared by Convert to Range
76
+ * (`removeTable`) and Delete over a whole table (`deleteCells`).
77
+ */
78
+ export var releaseTableFilterRows = function (_a) {
79
+ var tables = _a.tables, onChangeSheets = _a.onChangeSheets, saveHistory = _a.saveHistory, getDependents = _a.getDependents, enqueueCalculation = _a.enqueueCalculation;
80
+ if (!tables.length)
81
+ return;
82
+ var unhiddenRecalcCells = new Map();
83
+ onChangeSheets(function (prevSheets) {
84
+ var _a = __read(produceWithPatches(prevSheets, function (draft) {
85
+ var e_1, _a;
86
+ var _b;
87
+ var _loop_1 = function (tableView) {
88
+ var e_2, _c;
71
89
  var sheet = draft.find(function (sheet) { return sheet.sheetId === tableView.sheetId; });
72
- if (sheet && tableView) {
73
- if (!sheet.rowMetadata) {
74
- sheet.rowMetadata = [];
75
- }
76
- var range = tableView.range;
77
- for (var rowIndex = range.startRowIndex; rowIndex <= range.endRowIndex; rowIndex++) {
78
- if ((_b = sheet.rowMetadata[rowIndex]) === null || _b === void 0 ? void 0 : _b.hiddenByFilter) {
79
- sheet.rowMetadata[rowIndex].hiddenByFilter = false;
80
- try {
81
- for (var _c = (e_1 = void 0, __values(markTableAsDirty(tableView.sheetId, __assign(__assign({}, range), { startRowIndex: rowIndex, endRowIndex: rowIndex }), getDependents, enqueueCalculation))), _d = _c.next(); !_d.done; _d = _c.next()) {
82
- var _e = __read(_d.value, 2), key = _e[0], position = _e[1];
83
- unhiddenRecalcCells.set(key, position);
84
- }
90
+ if (!sheet)
91
+ return "continue";
92
+ if (!sheet.rowMetadata) {
93
+ sheet.rowMetadata = [];
94
+ }
95
+ var range = tableView.range;
96
+ for (var rowIndex = range.startRowIndex; rowIndex <= range.endRowIndex; rowIndex++) {
97
+ if ((_b = sheet.rowMetadata[rowIndex]) === null || _b === void 0 ? void 0 : _b.hiddenByFilter) {
98
+ sheet.rowMetadata[rowIndex].hiddenByFilter = false;
99
+ try {
100
+ for (var _d = (e_2 = void 0, __values(markTableAsDirty(tableView.sheetId, __assign(__assign({}, range), { startRowIndex: rowIndex, endRowIndex: rowIndex }), getDependents, enqueueCalculation))), _e = _d.next(); !_e.done; _e = _d.next()) {
101
+ var _f = __read(_e.value, 2), key = _f[0], position = _f[1];
102
+ unhiddenRecalcCells.set(key, position);
85
103
  }
86
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
87
- finally {
88
- try {
89
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
90
- }
91
- finally { if (e_1) throw e_1.error; }
104
+ }
105
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
106
+ finally {
107
+ try {
108
+ if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
92
109
  }
110
+ finally { if (e_2) throw e_2.error; }
93
111
  }
94
112
  }
95
113
  }
96
- }), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
97
- // Save to history
98
- saveHistory(__assign({ sheets: { patches: patches, inversePatches: inversePatches } }, (unhiddenRecalcCells.size
99
- ? {
100
- recalcCells: {
101
- undo: unhiddenRecalcCells,
102
- redo: unhiddenRecalcCells,
103
- },
114
+ };
115
+ try {
116
+ for (var tables_1 = __values(tables), tables_1_1 = tables_1.next(); !tables_1_1.done; tables_1_1 = tables_1.next()) {
117
+ var tableView = tables_1_1.value;
118
+ _loop_1(tableView);
104
119
  }
105
- : {})));
106
- return nextState;
107
- });
108
- };
120
+ }
121
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
122
+ finally {
123
+ try {
124
+ if (tables_1_1 && !tables_1_1.done && (_a = tables_1.return)) _a.call(tables_1);
125
+ }
126
+ finally { if (e_1) throw e_1.error; }
127
+ }
128
+ }), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
129
+ // Save to history
130
+ saveHistory(__assign({ sheets: { patches: patches, inversePatches: inversePatches } }, (unhiddenRecalcCells.size
131
+ ? {
132
+ recalcCells: {
133
+ undo: unhiddenRecalcCells,
134
+ redo: unhiddenRecalcCells,
135
+ },
136
+ }
137
+ : {})));
138
+ return nextState;
139
+ });
109
140
  };
@@ -5,9 +5,9 @@ export type UseOnRequestCreateTableProps = {
5
5
  };
6
6
  /**
7
7
  * Open Excel's "Create Table" dialog (Ctrl+T / Insert → Table / Format as Table): the range
8
- * pre-fills with the selection, else the data region around the active cell (Ctrl+A's region),
9
- * and "My table has headers" is guessed from that range's first row. The dialog submits through
10
- * `onCreateTable`.
8
+ * pre-fills with the selection, else — with none, or one collapsed on a single cell — the data
9
+ * region around the active cell (Ctrl+A's region), and "My table has headers" is guessed from
10
+ * that range's first row. The dialog submits through `onCreateTable`.
11
11
  */
12
12
  export declare const useOnRequestCreateTable: ({ getEffectiveExtendedValue, }: UseOnRequestCreateTableProps) => (sheetId: number, activeCell: CellInterface, selections: SelectionArea<SelectionAttributes>[], theme?: TableTheme, bandedRange?: BandedDefinition) => void;
13
13
  //# sourceMappingURL=use-on-request-create-table.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-on-request-create-table.d.ts","sourceRoot":"","sources":["../../../hooks/use-on-request-create-table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,aAAa,EACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACX,MAAM,2BAA2B,CAAC;AASnC,MAAM,MAAM,4BAA4B,GAAG;IACzC,yBAAyB,EAAE,CACzB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,KAChB,aAAa,GAAG,IAAI,GAAG,SAAS,CAAC;CACvC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,gCAErC,4BAA4B,eAMhB,MAAM,cACH,aAAa,cACb,aAAa,CAAC,mBAAmB,CAAC,EAAE,UACxC,UAAU,gBACJ,gBAAgB,SA6BnC,CAAC"}
1
+ {"version":3,"file":"use-on-request-create-table.d.ts","sourceRoot":"","sources":["../../../hooks/use-on-request-create-table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,aAAa,EACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACX,MAAM,2BAA2B,CAAC;AASnC,MAAM,MAAM,4BAA4B,GAAG;IACzC,yBAAyB,EAAE,CACzB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,KAChB,aAAa,GAAG,IAAI,GAAG,SAAS,CAAC;CACvC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,gCAErC,4BAA4B,eAMhB,MAAM,cACH,aAAa,cACb,aAAa,CAAC,mBAAmB,CAAC,EAAE,UACxC,UAAU,gBACJ,gBAAgB,SAkCnC,CAAC"}
@@ -6,9 +6,9 @@ import { useSetCreatingTable } from "../atoms/creating-table.atom";
6
6
  import { useSetCreateTableDialogValue } from "../atoms/dialog-state.atom";
7
7
  /**
8
8
  * Open Excel's "Create Table" dialog (Ctrl+T / Insert → Table / Format as Table): the range
9
- * pre-fills with the selection, else the data region around the active cell (Ctrl+A's region),
10
- * and "My table has headers" is guessed from that range's first row. The dialog submits through
11
- * `onCreateTable`.
9
+ * pre-fills with the selection, else — with none, or one collapsed on a single cell — the data
10
+ * region around the active cell (Ctrl+A's region), and "My table has headers" is guessed from
11
+ * that range's first row. The dialog submits through `onCreateTable`.
12
12
  */
13
13
  export const useOnRequestCreateTable = ({ getEffectiveExtendedValue, }) => {
14
14
  const setCreateDialog = useSetCreateTableDialogValue();
@@ -16,7 +16,11 @@ export const useOnRequestCreateTable = ({ getEffectiveExtendedValue, }) => {
16
16
  const getContentfulRangeAroundCell = useGetContentfulRangeAroundCell();
17
17
  return useCallback((sheetId, activeCell, selections, theme, bandedRange) => {
18
18
  const lastSelection = selections?.[selections.length - 1];
19
- const range = lastSelection
19
+ const collapsed = !lastSelection ||
20
+ (lastSelection.range.startRowIndex === lastSelection.range.endRowIndex &&
21
+ lastSelection.range.startColumnIndex ===
22
+ lastSelection.range.endColumnIndex);
23
+ const range = !collapsed
20
24
  ? lastSelection.range
21
25
  : getContentfulRangeAroundCell?.(sheetId, activeCell) ??
22
26
  selectionFromActiveCell(activeCell)[0].range;
@@ -1 +1 @@
1
- {"version":3,"file":"delete-cells.d.ts","sourceRoot":"","sources":["../../../interface/delete-cells.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAEb,aAAa,EACd,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EACV,QAAQ,EAER,mBAAmB,EACnB,KAAK,EACN,MAAM,2BAA2B,CAAC;AAKnC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAK/D,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,UAAU,GAAG,SAAS,CAAC;AAEvD,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,gUAoB9D,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,MAErB,SAAS,MAAM,EACf,MAAM,aAAa,EACnB,YAAY,aAAa,CAAC,mBAAmB,CAAC,EAAE,EAChD,YAAW,SAAsB,SAgSpC,CAAC"}
1
+ {"version":3,"file":"delete-cells.d.ts","sourceRoot":"","sources":["../../../interface/delete-cells.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAEb,aAAa,EACd,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EACV,QAAQ,EAER,mBAAmB,EACnB,KAAK,EACN,MAAM,2BAA2B,CAAC;AAKnC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAM/D,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,UAAU,GAAG,SAAS,CAAC;AAEvD,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,gUAoB9D,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,MAErB,SAAS,MAAM,EACf,MAAM,aAAa,EACnB,YAAY,aAAa,CAAC,mBAAmB,CAAC,EAAE,EAChD,YAAW,SAAsB,SA+TpC,CAAC"}
@@ -4,6 +4,7 @@ import { produceWithPatches } from "immer";
4
4
  import { createSheetCellIdentifier } from "../api/formula";
5
5
  import { createSheetDraft } from "../api/immer-utils";
6
6
  import { SheetCell } from "../sheet-cell";
7
+ import { releaseTableFilterRows } from "./remove-table";
7
8
  import { getTableHeaderRefills } from "./table-utils";
8
9
  export const deleteCells = ({ locale, rowCount, cellXfsRegistry, sharedStringRegistry, getDataValidationById, getDependents, getDataRowCount, onChangeSheetData, onChangeSheets, onChangeTables, onChangeCitations, onChangeActiveCell, enqueueCalculation, enqueueStructureChange, createHistory, isArrayFormula, getRowHeight, tables, generatedNames, }) => {
9
10
  return (sheetId, cell, selections, clearType = "contents") => {
@@ -14,13 +15,24 @@ export const deleteCells = ({ locale, rowCount, cellXfsRegistry, sharedStringReg
14
15
  : selectionFromActiveCell(cell);
15
16
  const saveHistory = createHistory();
16
17
  const maxRowCount = getDataRowCount();
17
- // A table survives Delete / Clear (Excel): only its cells empty out, and
18
- // cleared header cells are re-named `ColumnN` so the header row and
19
- // `columns[]` stay in step.
18
+ // Delete / Clear over a selection that covers a whole table deletes the table (Excel's
19
+ // "select the table and press Delete"): the table, its filter and its style go with the
20
+ // cells, and the structured references into it error as they do for any deleted table
21
+ // (Convert to Range is the path that rewrites them to A1).
22
+ const removedTables = shouldClearContents
23
+ ? (tables ?? []).filter((table) => table.sheetId === sheetId &&
24
+ finalSelections.some((selection) => areaInsideArea(table.range, selection.range)))
25
+ : [];
26
+ const keptTables = removedTables.length
27
+ ? tables?.filter((table) => !removedTables.includes(table))
28
+ : tables;
29
+ // A table survives Delete / Clear over part of it (Excel): only its cells
30
+ // empty out, and cleared header cells are re-named `ColumnN` so the header
31
+ // row and `columns[]` stay in step.
20
32
  const headerRefills = shouldClearContents
21
33
  ? getTableHeaderRefills({
22
34
  sheetId,
23
- tables,
35
+ tables: keptTables,
24
36
  selections: finalSelections,
25
37
  generatedNames,
26
38
  })
@@ -133,10 +145,16 @@ export const deleteCells = ({ locale, rowCount, cellXfsRegistry, sharedStringReg
133
145
  });
134
146
  return nextState;
135
147
  });
136
- // Rename the columns whose header cells were cleared
137
- if (headerRefills.length) {
148
+ // Drop the tables the selection covered, and rename the columns whose header cells were cleared
149
+ if (headerRefills.length || removedTables.length) {
138
150
  onChangeTables?.((prevTables) => {
139
151
  const [nextState, patches, inversePatches] = produceWithPatches(prevTables, (draft) => {
152
+ for (const removed of removedTables) {
153
+ const tableIndex = draft.findIndex((table) => table.id == removed.id);
154
+ if (tableIndex !== -1) {
155
+ draft.splice(tableIndex, 1);
156
+ }
157
+ }
140
158
  for (const { tableId, dimensionIndex, name } of headerRefills) {
141
159
  const table = draft.find((table) => table.sheetId === sheetId && table.id === tableId);
142
160
  if (!table)
@@ -156,6 +174,13 @@ export const deleteCells = ({ locale, rowCount, cellXfsRegistry, sharedStringReg
156
174
  });
157
175
  return nextState;
158
176
  });
177
+ releaseTableFilterRows({
178
+ tables: removedTables,
179
+ onChangeSheets,
180
+ saveHistory,
181
+ getDependents,
182
+ enqueueCalculation,
183
+ });
159
184
  }
160
185
  // Update citations - retire citations whose cited cells lose their contents.
161
186
  // Clearing formats only leaves the cited values in place, so the citations stay.
@@ -1,4 +1,15 @@
1
1
  import type { CellData, Sheet, TableView } from "@rowsncolumns/spreadsheet";
2
2
  import type { UseOnTableProps } from "../hooks/use-on-table";
3
3
  export declare const removeTable: <T extends CellData, S extends Sheet>({ locale, cellXfsRegistry, sharedStringRegistry, getSheetName, onChangeTables, onChangeSheets, onChangeSheetData, createHistory, getDependents, getGraphNodes, getBandedCells, enqueueCalculation, enqueueGraphOperation, }: Pick<UseOnTableProps<T, S>, "locale" | "cellXfsRegistry" | "sharedStringRegistry" | "getSheetName" | "onChangeTables" | "onChangeSheets" | "onChangeSheetData" | "getDependents" | "getGraphNodes" | "getBandedCells" | "enqueueCalculation" | "enqueueGraphOperation" | "createHistory">) => (tableView: TableView) => void;
4
+ /**
5
+ * A removed table's filter goes with it: the rows it hid become visible again, in the history step
6
+ * of the removal (`saveHistory`). Their values did not change, so only the formulas that read
7
+ * visibility — `SUBTOTAL(101…111)` / `AGGREGATE` over those rows — are stale; dirtying the
8
+ * un-hidden cells recalculates exactly those dependents. Shared by Convert to Range
9
+ * (`removeTable`) and Delete over a whole table (`deleteCells`).
10
+ */
11
+ export declare const releaseTableFilterRows: <T extends CellData, S extends Sheet>({ tables, onChangeSheets, saveHistory, getDependents, enqueueCalculation, }: Pick<UseOnTableProps<T, S>, "onChangeSheets" | "getDependents" | "enqueueCalculation"> & {
12
+ tables: TableView[];
13
+ saveHistory: ReturnType<UseOnTableProps<T, S>["createHistory"]>;
14
+ }) => void;
4
15
  //# sourceMappingURL=remove-table.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"remove-table.d.ts","sourceRoot":"","sources":["../../../interface/remove-table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAK5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI7D,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,6NAc9D,IAAI,CACL,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,EACnB,QAAQ,GACR,iBAAiB,GACjB,sBAAsB,GACtB,cAAc,GACd,gBAAgB,GAChB,gBAAgB,GAChB,mBAAmB,GACnB,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,oBAAoB,GACpB,uBAAuB,GACvB,eAAe,CAClB,MACS,WAAW,SAAS,SAwH7B,CAAC"}
1
+ {"version":3,"file":"remove-table.d.ts","sourceRoot":"","sources":["../../../interface/remove-table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAK5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI7D,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,6NAc9D,IAAI,CACL,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,EACnB,QAAQ,GACR,iBAAiB,GACjB,sBAAsB,GACtB,cAAc,GACd,gBAAgB,GAChB,gBAAgB,GAChB,mBAAmB,GACnB,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,oBAAoB,GACpB,uBAAuB,GACvB,eAAe,CAClB,MACS,WAAW,SAAS,SA0E7B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,6EAMzE,IAAI,CACL,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,EACrB,gBAAgB,GAAG,eAAe,GAAG,oBAAoB,CAC1D,GAAG;IACF,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,WAAW,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC;CACjE,SAoDA,CAAC"}
@@ -57,42 +57,58 @@ export const removeTable = ({ locale, cellXfsRegistry, sharedStringRegistry, get
57
57
  });
58
58
  return nextState;
59
59
  });
60
- // The table's filter goes with it: rows it hid become visible again. Their values did not
61
- // change, so only the formulas that read visibility — `SUBTOTAL(101…111)` / `AGGREGATE` over
62
- // those rows — are stale; dirtying the un-hidden cells recalculates exactly those dependents
63
- // (the rewritten structured references were re-entered above with `force`).
64
- const unhiddenRecalcCells = new Map();
65
- onChangeSheets((prevSheets) => {
66
- const [nextState, patches, inversePatches] = produceWithPatches(prevSheets, (draft) => {
60
+ releaseTableFilterRows({
61
+ tables: [tableView],
62
+ onChangeSheets,
63
+ saveHistory,
64
+ getDependents,
65
+ enqueueCalculation,
66
+ });
67
+ };
68
+ };
69
+ /**
70
+ * A removed table's filter goes with it: the rows it hid become visible again, in the history step
71
+ * of the removal (`saveHistory`). Their values did not change, so only the formulas that read
72
+ * visibility — `SUBTOTAL(101…111)` / `AGGREGATE` over those rows — are stale; dirtying the
73
+ * un-hidden cells recalculates exactly those dependents. Shared by Convert to Range
74
+ * (`removeTable`) and Delete over a whole table (`deleteCells`).
75
+ */
76
+ export const releaseTableFilterRows = ({ tables, onChangeSheets, saveHistory, getDependents, enqueueCalculation, }) => {
77
+ if (!tables.length)
78
+ return;
79
+ const unhiddenRecalcCells = new Map();
80
+ onChangeSheets((prevSheets) => {
81
+ const [nextState, patches, inversePatches] = produceWithPatches(prevSheets, (draft) => {
82
+ for (const tableView of tables) {
67
83
  const sheet = draft.find((sheet) => sheet.sheetId === tableView.sheetId);
68
- if (sheet && tableView) {
69
- if (!sheet.rowMetadata) {
70
- sheet.rowMetadata = [];
71
- }
72
- const { range } = tableView;
73
- for (let rowIndex = range.startRowIndex; rowIndex <= range.endRowIndex; rowIndex++) {
74
- if (sheet.rowMetadata[rowIndex]?.hiddenByFilter) {
75
- sheet.rowMetadata[rowIndex].hiddenByFilter = false;
76
- for (const [key, position] of markTableAsDirty(tableView.sheetId, { ...range, startRowIndex: rowIndex, endRowIndex: rowIndex }, getDependents, enqueueCalculation)) {
77
- unhiddenRecalcCells.set(key, position);
78
- }
84
+ if (!sheet)
85
+ continue;
86
+ if (!sheet.rowMetadata) {
87
+ sheet.rowMetadata = [];
88
+ }
89
+ const { range } = tableView;
90
+ for (let rowIndex = range.startRowIndex; rowIndex <= range.endRowIndex; rowIndex++) {
91
+ if (sheet.rowMetadata[rowIndex]?.hiddenByFilter) {
92
+ sheet.rowMetadata[rowIndex].hiddenByFilter = false;
93
+ for (const [key, position] of markTableAsDirty(tableView.sheetId, { ...range, startRowIndex: rowIndex, endRowIndex: rowIndex }, getDependents, enqueueCalculation)) {
94
+ unhiddenRecalcCells.set(key, position);
79
95
  }
80
96
  }
81
97
  }
82
- });
83
- // Save to history
84
- saveHistory({
85
- sheets: { patches, inversePatches },
86
- ...(unhiddenRecalcCells.size
87
- ? {
88
- recalcCells: {
89
- undo: unhiddenRecalcCells,
90
- redo: unhiddenRecalcCells,
91
- },
92
- }
93
- : {}),
94
- });
95
- return nextState;
98
+ }
96
99
  });
97
- };
100
+ // Save to history
101
+ saveHistory({
102
+ sheets: { patches, inversePatches },
103
+ ...(unhiddenRecalcCells.size
104
+ ? {
105
+ recalcCells: {
106
+ undo: unhiddenRecalcCells,
107
+ redo: unhiddenRecalcCells,
108
+ },
109
+ }
110
+ : {}),
111
+ });
112
+ return nextState;
113
+ });
98
114
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rowsncolumns/spreadsheet-state",
3
- "version": "29.1.16",
3
+ "version": "29.1.17",
4
4
  "main": "./dist/cjs/index.js",
5
5
  "module": "./dist/esm/index.js",
6
6
  "types": "./dist/esm/index.d.ts",