@rowsncolumns/spreadsheet-state 29.1.12 → 29.1.13
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/hooks/use-on-move-sheet.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-move-sheet.js +9 -29
- package/dist/cjs/interface/duplicate-sheet.d.ts.map +1 -1
- package/dist/cjs/interface/duplicate-sheet.js +3 -2
- package/dist/cjs/interface/new-sheet.d.ts.map +1 -1
- package/dist/cjs/interface/new-sheet.js +6 -30
- package/dist/cjs/interface/sheet-order.d.ts +21 -0
- package/dist/cjs/interface/sheet-order.d.ts.map +1 -0
- package/dist/cjs/interface/sheet-order.js +88 -0
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/hooks/use-on-move-sheet.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-move-sheet.js +9 -28
- package/dist/esm/interface/duplicate-sheet.d.ts.map +1 -1
- package/dist/esm/interface/duplicate-sheet.js +3 -1
- package/dist/esm/interface/new-sheet.d.ts.map +1 -1
- package/dist/esm/interface/new-sheet.js +5 -25
- package/dist/esm/interface/sheet-order.d.ts +21 -0
- package/dist/esm/interface/sheet-order.d.ts.map +1 -0
- package/dist/esm/interface/sheet-order.js +73 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-on-move-sheet.d.ts","sourceRoot":"","sources":["../../../hooks/use-on-move-sheet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,KAAK,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"use-on-move-sheet.d.ts","sourceRoot":"","sources":["../../../hooks/use-on-move-sheet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAItE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,KAAK,mBAAmB,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,IAAI;IAC9D,cAAc,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;IAC5D,aAAa,IAAI,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACrD,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,+CAIjE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,eAId,MAAM,mBAAmB,MAAM,eAAe,MAAM,SAuDjE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __read } from "tslib";
|
|
2
|
-
import { sortSheetsByIndex } from "@rowsncolumns/utils";
|
|
3
2
|
import { produceWithPatches } from "immer";
|
|
4
3
|
import { useCallback } from "react";
|
|
4
|
+
import { moveSheetInOrder } from "../interface/sheet-order";
|
|
5
5
|
import { useCanEditSheet, useCanEditWorkbook } from "./use-can-edit-cellrange";
|
|
6
6
|
export var useOnMoveSheet = function (_a) {
|
|
7
7
|
var onChangeSheets = _a.onChangeSheets, createHistory = _a.createHistory, onCommand = _a.onCommand;
|
|
@@ -21,43 +21,23 @@ export var useOnMoveSheet = function (_a) {
|
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
var saveHistory = createHistory();
|
|
24
|
+
var moved = false;
|
|
24
25
|
onChangeSheets(function (prevSheets) {
|
|
25
26
|
var _a = __read(produceWithPatches(prevSheets, function (draft) {
|
|
26
|
-
|
|
27
|
-
var sheetToMove = sortedSheets[currentPosition];
|
|
28
|
-
var oldIndex = sheetToMove.index;
|
|
29
|
-
var newIndex = sortedSheets[newPosition].index;
|
|
30
|
-
// Determine the direction of movement
|
|
31
|
-
var isMovingDown = newPosition > currentPosition;
|
|
32
|
-
// Update indices of affected sheets
|
|
33
|
-
draft.forEach(function (sheet, arrayIndex) {
|
|
34
|
-
var _a;
|
|
35
|
-
var currentIndex = (_a = sheet.index) !== null && _a !== void 0 ? _a : arrayIndex;
|
|
36
|
-
if (sheet.sheetId === sheetId) {
|
|
37
|
-
sheet.index = newIndex;
|
|
38
|
-
}
|
|
39
|
-
else if (!isMovingDown &&
|
|
40
|
-
currentIndex < oldIndex &&
|
|
41
|
-
currentIndex >= newIndex) {
|
|
42
|
-
sheet.index = currentIndex + 1;
|
|
43
|
-
}
|
|
44
|
-
else if (isMovingDown &&
|
|
45
|
-
currentIndex > oldIndex &&
|
|
46
|
-
currentIndex <= newIndex) {
|
|
47
|
-
sheet.index = currentIndex - 1;
|
|
48
|
-
}
|
|
49
|
-
else if (sheet.index === undefined) {
|
|
50
|
-
// Set index for sheets that didn't have one before
|
|
51
|
-
sheet.index = arrayIndex;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
27
|
+
moved = moveSheetInOrder(draft, sheetId, currentPosition, newPosition);
|
|
54
28
|
}), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
|
|
29
|
+
if (!moved) {
|
|
30
|
+
return prevSheets;
|
|
31
|
+
}
|
|
55
32
|
// Save history
|
|
56
33
|
saveHistory({
|
|
57
34
|
sheets: { patches: patches, inversePatches: inversePatches },
|
|
58
35
|
});
|
|
59
36
|
return nextState;
|
|
60
37
|
});
|
|
38
|
+
if (!moved) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
61
41
|
onCommand === null || onCommand === void 0 ? void 0 : onCommand({
|
|
62
42
|
command: "move-sheet",
|
|
63
43
|
sheetId: sheetId,
|
|
@@ -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;AAe7E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,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;AAIhF,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,uBAmT1D,CAAC"}
|
|
@@ -6,6 +6,7 @@ import { renameTablesInFormula } from "../api/formula";
|
|
|
6
6
|
import { createSheetDraft } from "../api/immer-utils";
|
|
7
7
|
import { getGeneratedSheetCopyName } from "../generated-names";
|
|
8
8
|
import { SheetCell } from "../sheet-cell";
|
|
9
|
+
import { sheetIndexAfter } from "./sheet-order";
|
|
9
10
|
export var duplicateSheet = function (_a) {
|
|
10
11
|
var locale = _a.locale, maxSheetCount = _a.maxSheetCount, sheets = _a.sheets, idCreationStrategy = _a.idCreationStrategy, onChangeSheetData = _a.onChangeSheetData, onChangeSheets = _a.onChangeSheets, onChangeTables = _a.onChangeTables, onChangeCharts = _a.onChangeCharts, onChangeEmbeds = _a.onChangeEmbeds, onChangeConditionalFormats = _a.onChangeConditionalFormats, onChangeDataValidations = _a.onChangeDataValidations, enqueueGraphOperation = _a.enqueueGraphOperation, createHistory = _a.createHistory, generatedNames = _a.generatedNames;
|
|
11
12
|
return function (sheetId, newSheetIdDefinedByUser) {
|
|
@@ -38,8 +39,8 @@ export var duplicateSheet = function (_a) {
|
|
|
38
39
|
sourceChartSheetChartId = sheet.chartId;
|
|
39
40
|
copiedChartSheetChartId = (_c = idCreationStrategy === null || idCreationStrategy === void 0 ? void 0 : idCreationStrategy("chart")) !== null && _c !== void 0 ? _c : uuid();
|
|
40
41
|
}
|
|
41
|
-
/* Update the sheet title */
|
|
42
|
-
var newSheet = __assign(__assign(__assign({}, sheet), { sheetId: newSheetId, title: newTitle }), (copiedChartSheetChartId !== undefined
|
|
42
|
+
/* Update the sheet title; the copy's tab sits right after its source */
|
|
43
|
+
var newSheet = __assign(__assign(__assign({}, sheet), { sheetId: newSheetId, title: newTitle, index: sheetIndexAfter(draft, sheetId) }), (copiedChartSheetChartId !== undefined
|
|
43
44
|
? { chartId: copiedChartSheetChartId }
|
|
44
45
|
: {}));
|
|
45
46
|
draft.push(castDraft(newSheet));
|
|
@@ -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;
|
|
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;AAoB1E,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,KAuFT,CAE1B,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { __assign, __read
|
|
1
|
+
import { __assign, __read } from "tslib";
|
|
2
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";
|
|
6
|
+
import { sheetIndexAfter } from "./sheet-order";
|
|
6
7
|
var createNewSheetHelper = function (sheetId, title, rowCount, columnCount, hidden) {
|
|
7
8
|
if (rowCount === void 0) { rowCount = 1000; }
|
|
8
9
|
if (columnCount === void 0) { columnCount = 100; }
|
|
@@ -47,38 +48,13 @@ export var createNewSheet = function (_a) {
|
|
|
47
48
|
getGeneratedSheetName(draft.length + 1, generatedNames)), draft.map(function (s) { return s.title; }), MAX_SHEET_TITLE_LENGTH);
|
|
48
49
|
// Create the new sheet
|
|
49
50
|
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);
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
var
|
|
53
|
-
.map(function (s, arrayIndex) {
|
|
54
|
-
var _a;
|
|
55
|
-
return ({
|
|
56
|
-
sheet: s,
|
|
57
|
-
effectiveIndex: (_a = s.index) !== null && _a !== void 0 ? _a : arrayIndex,
|
|
58
|
-
arrayIndex: arrayIndex,
|
|
59
|
-
});
|
|
60
|
-
})
|
|
61
|
-
.sort(function (a, b) {
|
|
62
|
-
return a.effectiveIndex - b.effectiveIndex ||
|
|
63
|
-
a.arrayIndex - b.arrayIndex;
|
|
64
|
-
});
|
|
65
|
-
var activeOrderedIndex = orderedSheets.findIndex(function (entry) { return entry.sheet.sheetId === sheetId; });
|
|
66
|
-
var fallbackMaxIndex = orderedSheets.length > 0
|
|
67
|
-
? Math.max.apply(Math, __spreadArray([], __read(orderedSheets.map(function (entry) { return entry.effectiveIndex; })), false)) : -1;
|
|
68
|
-
var computedIndex = activeOrderedIndex === -1
|
|
69
|
-
? fallbackMaxIndex + 1
|
|
70
|
-
: (function () {
|
|
71
|
-
var _a, _b, _c;
|
|
72
|
-
var currentIndex = (_b = (_a = orderedSheets[activeOrderedIndex]) === null || _a === void 0 ? void 0 : _a.effectiveIndex) !== null && _b !== void 0 ? _b : fallbackMaxIndex;
|
|
73
|
-
var nextIndex = (_c = orderedSheets[activeOrderedIndex + 1]) === null || _c === void 0 ? void 0 : _c.effectiveIndex;
|
|
74
|
-
return nextIndex === undefined
|
|
75
|
-
? currentIndex + 1
|
|
76
|
-
: currentIndex + (nextIndex - currentIndex) / 2;
|
|
77
|
-
})();
|
|
51
|
+
// Visual insertion index (after the active sheet) without moving the
|
|
52
|
+
// existing array positions. This keeps ShareDB patches append-only.
|
|
53
|
+
var computedIndex = (_g = sheetSpec === null || sheetSpec === void 0 ? void 0 : sheetSpec.index) !== null && _g !== void 0 ? _g : sheetIndexAfter(draft, sheetId);
|
|
78
54
|
// Merge any additional spec properties
|
|
79
55
|
var sheet = __assign(__assign(__assign({}, newSheet), sheetSpec), {
|
|
80
56
|
// Ensure computed values override spec
|
|
81
|
-
sheetId: newSheetId, title: finalTitle, index:
|
|
57
|
+
sheetId: newSheetId, title: finalTitle, index: computedIndex });
|
|
82
58
|
// Always append physically to keep patches as add-only.
|
|
83
59
|
draft.push(sheet);
|
|
84
60
|
createdSheet = sheet;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Sheet } from "@rowsncolumns/spreadsheet";
|
|
2
|
+
import type { Draft } from "immer";
|
|
3
|
+
type OrderableSheet = Pick<Sheet, "sheetId" | "index" | "hidden" | "title">;
|
|
4
|
+
/**
|
|
5
|
+
* The `index` that places a new sheet right after `anchorSheetId` in tab order — halfway to the next
|
|
6
|
+
* tab, so no existing sheet has to change its `index` (a collab host's patches stay add-only). With
|
|
7
|
+
* no anchor the sheet goes last. When the anchor and its neighbour share an `index` there is no gap
|
|
8
|
+
* to split, so every sheet is renumbered first and the new sheet takes the slot after the anchor.
|
|
9
|
+
*/
|
|
10
|
+
export declare const sheetIndexAfter: <S extends OrderableSheet>(draft: Draft<S>[], anchorSheetId: number) => number;
|
|
11
|
+
/**
|
|
12
|
+
* Move `sheetId` from `currentPosition` to `newPosition` — both positions among the VISIBLE tabs, as
|
|
13
|
+
* the tab strip counts them — and renumber every sheet from the resulting order, hidden tabs keeping
|
|
14
|
+
* their slot. Indices are only ever read as an order here (a created or duplicated sheet carries a
|
|
15
|
+
* fractional one; a host may seed duplicates), so shifting neighbours by ±1 is not an option: the
|
|
16
|
+
* moved tab has to land where it was dropped with the others in their old relative order.
|
|
17
|
+
* Returns false when the move names a sheet or a position that does not exist.
|
|
18
|
+
*/
|
|
19
|
+
export declare const moveSheetInOrder: <S extends OrderableSheet>(draft: Draft<S>[], sheetId: number, currentPosition: number, newPosition: number) => boolean;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=sheet-order.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheet-order.d.ts","sourceRoot":"","sources":["../../../interface/sheet-order.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAEvD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAEnC,KAAK,cAAc,GAAG,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,CAAC;AA+B5E;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,cAAc,EACtD,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,EACjB,eAAe,MAAM,KACpB,MAyBF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,cAAc,EACvD,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,EACjB,SAAS,MAAM,EACf,iBAAiB,MAAM,EACvB,aAAa,MAAM,KAClB,OAmBF,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { __read, __spreadArray, __values } from "tslib";
|
|
2
|
+
import { sortSheetsByIndex } from "@rowsncolumns/utils";
|
|
3
|
+
/**
|
|
4
|
+
* Tab order the way the tab strip renders it — `sortSheetsByIndex` with hidden sheets kept, so a
|
|
5
|
+
* hidden tab keeps its slot between its neighbours.
|
|
6
|
+
*/
|
|
7
|
+
var tabOrder = function (sheets) {
|
|
8
|
+
return sortSheetsByIndex(sheets, true);
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Give every sheet the position it holds in `order` as its `index`, so the indices are contiguous
|
|
12
|
+
* integers again. `shiftFrom` leaves a gap: positions at or after it move up by one, for a sheet that
|
|
13
|
+
* is about to be inserted there.
|
|
14
|
+
*/
|
|
15
|
+
var renumber = function (draft, order, shiftFrom) {
|
|
16
|
+
var e_1, _a;
|
|
17
|
+
if (shiftFrom === void 0) { shiftFrom = Number.POSITIVE_INFINITY; }
|
|
18
|
+
var positionById = new Map();
|
|
19
|
+
order.forEach(function (sheetId, position) {
|
|
20
|
+
positionById.set(sheetId, position >= shiftFrom ? position + 1 : position);
|
|
21
|
+
});
|
|
22
|
+
try {
|
|
23
|
+
for (var draft_1 = __values(draft), draft_1_1 = draft_1.next(); !draft_1_1.done; draft_1_1 = draft_1.next()) {
|
|
24
|
+
var sheet = draft_1_1.value;
|
|
25
|
+
var position = positionById.get(sheet.sheetId);
|
|
26
|
+
if (position !== undefined && sheet.index !== position) {
|
|
27
|
+
sheet.index = position;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
32
|
+
finally {
|
|
33
|
+
try {
|
|
34
|
+
if (draft_1_1 && !draft_1_1.done && (_a = draft_1.return)) _a.call(draft_1);
|
|
35
|
+
}
|
|
36
|
+
finally { if (e_1) throw e_1.error; }
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* The `index` that places a new sheet right after `anchorSheetId` in tab order — halfway to the next
|
|
41
|
+
* tab, so no existing sheet has to change its `index` (a collab host's patches stay add-only). With
|
|
42
|
+
* no anchor the sheet goes last. When the anchor and its neighbour share an `index` there is no gap
|
|
43
|
+
* to split, so every sheet is renumbered first and the new sheet takes the slot after the anchor.
|
|
44
|
+
*/
|
|
45
|
+
export var sheetIndexAfter = function (draft, anchorSheetId) {
|
|
46
|
+
var ordered = tabOrder(draft);
|
|
47
|
+
if (ordered.length === 0) {
|
|
48
|
+
return 0;
|
|
49
|
+
}
|
|
50
|
+
var anchorPosition = ordered.findIndex(function (sheet) { return sheet.sheetId === anchorSheetId; });
|
|
51
|
+
if (anchorPosition === -1) {
|
|
52
|
+
return Math.max.apply(Math, __spreadArray([], __read(ordered.map(function (sheet) { return sheet.index; })), false)) + 1;
|
|
53
|
+
}
|
|
54
|
+
var anchorIndex = ordered[anchorPosition].index;
|
|
55
|
+
var next = ordered[anchorPosition + 1];
|
|
56
|
+
if (next === undefined) {
|
|
57
|
+
return anchorIndex + 1;
|
|
58
|
+
}
|
|
59
|
+
if (next.index > anchorIndex) {
|
|
60
|
+
return anchorIndex + (next.index - anchorIndex) / 2;
|
|
61
|
+
}
|
|
62
|
+
renumber(draft, ordered.map(function (sheet) { return sheet.sheetId; }), anchorPosition + 1);
|
|
63
|
+
return anchorPosition + 1;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Move `sheetId` from `currentPosition` to `newPosition` — both positions among the VISIBLE tabs, as
|
|
67
|
+
* the tab strip counts them — and renumber every sheet from the resulting order, hidden tabs keeping
|
|
68
|
+
* their slot. Indices are only ever read as an order here (a created or duplicated sheet carries a
|
|
69
|
+
* fractional one; a host may seed duplicates), so shifting neighbours by ±1 is not an option: the
|
|
70
|
+
* moved tab has to land where it was dropped with the others in their old relative order.
|
|
71
|
+
* Returns false when the move names a sheet or a position that does not exist.
|
|
72
|
+
*/
|
|
73
|
+
export var moveSheetInOrder = function (draft, sheetId, currentPosition, newPosition) {
|
|
74
|
+
var target = sortSheetsByIndex(draft)[newPosition];
|
|
75
|
+
if (target === undefined || target.sheetId === sheetId) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
var order = tabOrder(draft).map(function (sheet) { return sheet.sheetId; });
|
|
79
|
+
var from = order.indexOf(sheetId);
|
|
80
|
+
if (from === -1) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
order.splice(from, 1);
|
|
84
|
+
var targetPosition = order.indexOf(target.sheetId);
|
|
85
|
+
order.splice(newPosition > currentPosition ? targetPosition + 1 : targetPosition, 0, sheetId);
|
|
86
|
+
renumber(draft, order);
|
|
87
|
+
return true;
|
|
88
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../../cellxfs-registry.ts","../../commands.ts","../../constants.ts","../../generated-names.ts","../../helpers.ts","../../index.ts","../../server-utils.ts","../../server.browser.ts","../../server.ts","../../shared-string-registry.ts","../../sheet-cell.ts","../../test-setup.ts","../../types.ts","../../vitest.config.ts","../../api/advanced-filter.ts","../../api/anchored-objects.ts","../../api/basic-filter.ts","../../api/border.ts","../../api/circular-reference.ts","../../api/conditional-format.ts","../../api/copy-paste.ts","../../api/data-validation.ts","../../api/datatype.ts","../../api/date.ts","../../api/decimals.ts","../../api/dependency.ts","../../api/fill-series-spec.ts","../../api/fill.ts","../../api/filter-condition.ts","../../api/filter-range.ts","../../api/filter.ts","../../api/format-caches.ts","../../api/formula.ts","../../api/goal-seek.ts","../../api/image-embed.ts","../../api/immer-utils.ts","../../api/insert-cut-cells.ts","../../api/intl.ts","../../api/merges.ts","../../api/named-range-structural.ts","../../api/outline.ts","../../api/paint-format.ts","../../api/parse-html.ts","../../api/paste-special.ts","../../api/patches.ts","../../api/pivot-range.ts","../../api/range-rule-helpers.ts","../../api/range.ts","../../api/rename-sheet.ts","../../api/selection.ts","../../api/sort.ts","../../api/split-text.ts","../../api/structural-formula-update.ts","../../api/structural-guards.ts","../../api/structural-table-refs.ts","../../api/subtotal.ts","../../api/table.ts","../../api/validation.ts","../../api/xlsx-source.ts","../../atoms/creating-table.atom.ts","../../atoms/delete-sheet-atom.ts","../../atoms/dialog-state.atom.ts","../../atoms/editing-data-validation-id.atom.ts","../../atoms/editing-embed.atom.ts","../../atoms/editing-slicer.atom.ts","../../atoms/editing-table.atom.ts","../../atoms/error-state.atom.ts","../../atoms/index.ts","../../atoms/insert-image-state.atom.ts","../../atoms/inserting-slicer.atom.ts","../../atoms/named-range.atom.ts","../../atoms/resize-dimension.atom.ts","../../atoms/resizing-table.atom.ts","../../atoms/sheet-observer.atom.ts","../../components/index.tsx","../../components/dialogs/delete-sheet-confirmation.tsx","../../components/dialogs/error-state.tsx","../../components/editors/cell-format-editor.tsx","../../components/editors/conditional-format-editor.tsx","../../components/editors/conditional-format-rule-editor.tsx","../../components/editors/data-validation-editor.tsx","../../components/editors/data-validation-rule-editor.tsx","../../components/editors/embed-editor.tsx","../../components/editors/insert-image-editor.tsx","../../components/editors/insert-link-editor.tsx","../../components/editors/named-range-editor.tsx","../../components/editors/resize-dimension-editor.tsx","../../components/editors/sheet-filter.tsx","../../components/editors/slicer-editor.tsx","../../components/editors/table-editor.tsx","../../helpers/default-cell-format.ts","../../helpers/iterative-calculation.ts","../../helpers/sheet-title.ts","../../hooks/use-async-datasource.ts","../../hooks/use-calculation-initialize.ts","../../hooks/use-calculation-process-array.ts","../../hooks/use-calculation-queue.ts","../../hooks/use-calculation-worker.ts","../../hooks/use-calculation.ts","../../hooks/use-can-edit-cellrange.ts","../../hooks/use-cellxfs-registry.ts","../../hooks/use-citations.ts","../../hooks/use-comments.ts","../../hooks/use-conditional-formatting-rules.ts","../../hooks/use-data-validation-rules.ts","../../hooks/use-deferred-calculation-flush.ts","../../hooks/use-idle-scheduler.ts","../../hooks/use-indent.ts","../../hooks/use-named-range.ts","../../hooks/use-on-adjust-row-height.ts","../../hooks/use-on-advanced-filter.ts","../../hooks/use-on-autoresize.ts","../../hooks/use-on-banded-ranges.ts","../../hooks/use-on-calculation-begin.ts","../../hooks/use-on-calculation-success.ts","../../hooks/use-on-change-batch-stream.ts","../../hooks/use-on-change-batch.ts","../../hooks/use-on-change-calculated-column.ts","../../hooks/use-on-change-decimals.ts","../../hooks/use-on-change-formatting.ts","../../hooks/use-on-change-sheet-tabcolor.ts","../../hooks/use-on-change-table-column.ts","../../hooks/use-on-change-theme.ts","../../hooks/use-on-change.ts","../../hooks/use-on-clear-formatting.ts","../../hooks/use-on-collapse-column-group.ts","../../hooks/use-on-collapse-row-group.ts","../../hooks/use-on-copy.ts","../../hooks/use-on-create-custom-table-style.ts","../../hooks/use-on-create-named-range.ts","../../hooks/use-on-create-sheet.ts","../../hooks/use-on-delete-cells-shift-left.ts","../../hooks/use-on-delete-cells-shift-up.ts","../../hooks/use-on-delete-column.ts","../../hooks/use-on-delete-named-range.ts","../../hooks/use-on-delete-row.ts","../../hooks/use-on-delete-sheet.ts","../../hooks/use-on-delete-table-row.ts","../../hooks/use-on-delete.ts","../../hooks/use-on-drag-n-drop.ts","../../hooks/use-on-duplicate-sheet.ts","../../hooks/use-on-embeds.ts","../../hooks/use-on-expand-column-group.ts","../../hooks/use-on-expand-row-group.ts","../../hooks/use-on-fill-range.ts","../../hooks/use-on-fill.ts","../../hooks/use-on-filter-table.ts","../../hooks/use-on-find-replace.ts","../../hooks/use-on-freeze.ts","../../hooks/use-on-goal-seek.ts","../../hooks/use-on-group-columns.ts","../../hooks/use-on-group-rows.ts","../../hooks/use-on-hide-column.ts","../../hooks/use-on-hide-row.ts","../../hooks/use-on-hide-show-sheet.ts","../../hooks/use-on-import-csv-legacy.ts","../../hooks/use-on-import-csv.ts","../../hooks/use-on-import-excel.ts","../../hooks/use-on-insert-autosum.ts","../../hooks/use-on-insert-cells-shift-down.ts","../../hooks/use-on-insert-cells-shift-right.ts","../../hooks/use-on-insert-checkbox.ts","../../hooks/use-on-insert-column.ts","../../hooks/use-on-insert-date-time.ts","../../hooks/use-on-insert-date.ts","../../hooks/use-on-insert-image.ts","../../hooks/use-on-insert-link.ts","../../hooks/use-on-insert-note.ts","../../hooks/use-on-insert-row.ts","../../hooks/use-on-insert-table-row.ts","../../hooks/use-on-insert-time.ts","../../hooks/use-on-locale-change.ts","../../hooks/use-on-merge-unmerge-cells.ts","../../hooks/use-on-move-columns.ts","../../hooks/use-on-move-rows.ts","../../hooks/use-on-move-selection.ts","../../hooks/use-on-move-sheet.ts","../../hooks/use-on-move-table-columns.ts","../../hooks/use-on-paste.ts","../../hooks/use-on-protect-range.ts","../../hooks/use-on-protect-sheet.ts","../../hooks/use-on-remove-duplicates.ts","../../hooks/use-on-rename-sheet.ts","../../hooks/use-on-request-calculate-wrapper.ts","../../hooks/use-on-request-conditional-format.ts","../../hooks/use-on-request-create-table.ts","../../hooks/use-on-request-data-validation.ts","../../hooks/use-on-request-define-named-range.ts","../../hooks/use-on-request-delete-sheet.ts","../../hooks/use-on-request-edit-table.ts","../../hooks/use-on-request-format-cells.ts","../../hooks/use-on-request-insert-image.ts","../../hooks/use-on-request-insert-link.ts","../../hooks/use-on-request-insert-slicer.ts","../../hooks/use-on-request-resize-table.ts","../../hooks/use-on-request-resize.ts","../../hooks/use-on-request-update-named-range.ts","../../hooks/use-on-resize-table.ts","../../hooks/use-on-resize.ts","../../hooks/use-on-set-outline-depth.ts","../../hooks/use-on-show-column.ts","../../hooks/use-on-show-row.ts","../../hooks/use-on-sort-column.ts","../../hooks/use-on-sort-range.ts","../../hooks/use-on-sort-table.ts","../../hooks/use-on-subtotal.ts","../../hooks/use-on-table.ts","../../hooks/use-on-trace-dependents-precedents.tsx","../../hooks/use-on-undo-calculated-column.ts","../../hooks/use-on-undo-table-auto-expansion.ts","../../hooks/use-on-ungroup-columns.ts","../../hooks/use-on-ungroup-rows.ts","../../hooks/use-on-update-named-range.ts","../../hooks/use-on-update-note.ts","../../hooks/use-on-update-sheet.ts","../../hooks/use-paint-format.ts","../../hooks/use-search.ts","../../hooks/use-select-next-prev-sheet.ts","../../hooks/use-sheet-observer.ts","../../hooks/use-sheet-properties.ts","../../hooks/use-sheet-state.ts","../../hooks/use-sheetdata-subscriber.ts","../../hooks/use-slicers.ts","../../hooks/use-sparkline-groups.ts","../../hooks/use-split-text-to-columns.ts","../../hooks/use-spreadsheet-state.ts","../../hooks/use-ss-registry.ts","../../hooks/use-structured-reference.ts","../../hooks/use-undo-redo-actions.ts","../../hooks/use-undo-redo.ts","../../hooks/utils/frozen-sort.ts","../../hooks/utils/sort-rows.ts","../../interface/apply-fill.ts","../../interface/auto-resize.ts","../../interface/calculation-interface.ts","../../interface/change-batch-stream.ts","../../interface/change-batch.ts","../../interface/change-border.ts","../../interface/change-calculated-column.ts","../../interface/change-decimals.ts","../../interface/change-formatting.ts","../../interface/change-sheet-tabcolor.ts","../../interface/change-table-column.ts","../../interface/change-theme.ts","../../interface/chart-extensions.ts","../../interface/citations.ts","../../interface/clear-formatting.ts","../../interface/conditional-formatting-rules.ts","../../interface/create-table.ts","../../interface/data-validation-rules.ts","../../interface/data-validation-utils.ts","../../interface/delete-cells-shift-left.ts","../../interface/delete-cells-shift-up.ts","../../interface/delete-cells.ts","../../interface/delete-column.ts","../../interface/delete-row.ts","../../interface/delete-sheet.ts","../../interface/delete-table-column.ts","../../interface/delete-table-row.ts","../../interface/duplicate-sheet.ts","../../interface/embeds.ts","../../interface/freeze.ts","../../interface/helpers.ts","../../interface/hide-column.ts","../../interface/hide-row.ts","../../interface/indent.ts","../../interface/insert-cells-shift-down.ts","../../interface/insert-cells-shift-right.ts","../../interface/insert-column.ts","../../interface/insert-note.ts","../../interface/insert-row.ts","../../interface/insert-table-row.ts","../../interface/interface-cli.ts","../../interface/named-range-operations.ts","../../interface/new-sheet.ts","../../interface/pivot-extensions.ts","../../interface/remove-duplicates.ts","../../interface/remove-table.ts","../../interface/resize-utils.ts","../../interface/resize.ts","../../interface/slicers.ts","../../interface/split-text.ts","../../interface/spreadsheet-interface.ts","../../interface/table-totalrow.ts","../../interface/table-utils.ts","../../interface/update-sheet.ts","../../interface/update-table.ts","../../validation-schema/table.schema.ts"],"version":"5.8.3"}
|
|
1
|
+
{"root":["../../cellxfs-registry.ts","../../commands.ts","../../constants.ts","../../generated-names.ts","../../helpers.ts","../../index.ts","../../server-utils.ts","../../server.browser.ts","../../server.ts","../../shared-string-registry.ts","../../sheet-cell.ts","../../test-setup.ts","../../types.ts","../../vitest.config.ts","../../api/advanced-filter.ts","../../api/anchored-objects.ts","../../api/basic-filter.ts","../../api/border.ts","../../api/circular-reference.ts","../../api/conditional-format.ts","../../api/copy-paste.ts","../../api/data-validation.ts","../../api/datatype.ts","../../api/date.ts","../../api/decimals.ts","../../api/dependency.ts","../../api/fill-series-spec.ts","../../api/fill.ts","../../api/filter-condition.ts","../../api/filter-range.ts","../../api/filter.ts","../../api/format-caches.ts","../../api/formula.ts","../../api/goal-seek.ts","../../api/image-embed.ts","../../api/immer-utils.ts","../../api/insert-cut-cells.ts","../../api/intl.ts","../../api/merges.ts","../../api/named-range-structural.ts","../../api/outline.ts","../../api/paint-format.ts","../../api/parse-html.ts","../../api/paste-special.ts","../../api/patches.ts","../../api/pivot-range.ts","../../api/range-rule-helpers.ts","../../api/range.ts","../../api/rename-sheet.ts","../../api/selection.ts","../../api/sort.ts","../../api/split-text.ts","../../api/structural-formula-update.ts","../../api/structural-guards.ts","../../api/structural-table-refs.ts","../../api/subtotal.ts","../../api/table.ts","../../api/validation.ts","../../api/xlsx-source.ts","../../atoms/creating-table.atom.ts","../../atoms/delete-sheet-atom.ts","../../atoms/dialog-state.atom.ts","../../atoms/editing-data-validation-id.atom.ts","../../atoms/editing-embed.atom.ts","../../atoms/editing-slicer.atom.ts","../../atoms/editing-table.atom.ts","../../atoms/error-state.atom.ts","../../atoms/index.ts","../../atoms/insert-image-state.atom.ts","../../atoms/inserting-slicer.atom.ts","../../atoms/named-range.atom.ts","../../atoms/resize-dimension.atom.ts","../../atoms/resizing-table.atom.ts","../../atoms/sheet-observer.atom.ts","../../components/index.tsx","../../components/dialogs/delete-sheet-confirmation.tsx","../../components/dialogs/error-state.tsx","../../components/editors/cell-format-editor.tsx","../../components/editors/conditional-format-editor.tsx","../../components/editors/conditional-format-rule-editor.tsx","../../components/editors/data-validation-editor.tsx","../../components/editors/data-validation-rule-editor.tsx","../../components/editors/embed-editor.tsx","../../components/editors/insert-image-editor.tsx","../../components/editors/insert-link-editor.tsx","../../components/editors/named-range-editor.tsx","../../components/editors/resize-dimension-editor.tsx","../../components/editors/sheet-filter.tsx","../../components/editors/slicer-editor.tsx","../../components/editors/table-editor.tsx","../../helpers/default-cell-format.ts","../../helpers/iterative-calculation.ts","../../helpers/sheet-title.ts","../../hooks/use-async-datasource.ts","../../hooks/use-calculation-initialize.ts","../../hooks/use-calculation-process-array.ts","../../hooks/use-calculation-queue.ts","../../hooks/use-calculation-worker.ts","../../hooks/use-calculation.ts","../../hooks/use-can-edit-cellrange.ts","../../hooks/use-cellxfs-registry.ts","../../hooks/use-citations.ts","../../hooks/use-comments.ts","../../hooks/use-conditional-formatting-rules.ts","../../hooks/use-data-validation-rules.ts","../../hooks/use-deferred-calculation-flush.ts","../../hooks/use-idle-scheduler.ts","../../hooks/use-indent.ts","../../hooks/use-named-range.ts","../../hooks/use-on-adjust-row-height.ts","../../hooks/use-on-advanced-filter.ts","../../hooks/use-on-autoresize.ts","../../hooks/use-on-banded-ranges.ts","../../hooks/use-on-calculation-begin.ts","../../hooks/use-on-calculation-success.ts","../../hooks/use-on-change-batch-stream.ts","../../hooks/use-on-change-batch.ts","../../hooks/use-on-change-calculated-column.ts","../../hooks/use-on-change-decimals.ts","../../hooks/use-on-change-formatting.ts","../../hooks/use-on-change-sheet-tabcolor.ts","../../hooks/use-on-change-table-column.ts","../../hooks/use-on-change-theme.ts","../../hooks/use-on-change.ts","../../hooks/use-on-clear-formatting.ts","../../hooks/use-on-collapse-column-group.ts","../../hooks/use-on-collapse-row-group.ts","../../hooks/use-on-copy.ts","../../hooks/use-on-create-custom-table-style.ts","../../hooks/use-on-create-named-range.ts","../../hooks/use-on-create-sheet.ts","../../hooks/use-on-delete-cells-shift-left.ts","../../hooks/use-on-delete-cells-shift-up.ts","../../hooks/use-on-delete-column.ts","../../hooks/use-on-delete-named-range.ts","../../hooks/use-on-delete-row.ts","../../hooks/use-on-delete-sheet.ts","../../hooks/use-on-delete-table-row.ts","../../hooks/use-on-delete.ts","../../hooks/use-on-drag-n-drop.ts","../../hooks/use-on-duplicate-sheet.ts","../../hooks/use-on-embeds.ts","../../hooks/use-on-expand-column-group.ts","../../hooks/use-on-expand-row-group.ts","../../hooks/use-on-fill-range.ts","../../hooks/use-on-fill.ts","../../hooks/use-on-filter-table.ts","../../hooks/use-on-find-replace.ts","../../hooks/use-on-freeze.ts","../../hooks/use-on-goal-seek.ts","../../hooks/use-on-group-columns.ts","../../hooks/use-on-group-rows.ts","../../hooks/use-on-hide-column.ts","../../hooks/use-on-hide-row.ts","../../hooks/use-on-hide-show-sheet.ts","../../hooks/use-on-import-csv-legacy.ts","../../hooks/use-on-import-csv.ts","../../hooks/use-on-import-excel.ts","../../hooks/use-on-insert-autosum.ts","../../hooks/use-on-insert-cells-shift-down.ts","../../hooks/use-on-insert-cells-shift-right.ts","../../hooks/use-on-insert-checkbox.ts","../../hooks/use-on-insert-column.ts","../../hooks/use-on-insert-date-time.ts","../../hooks/use-on-insert-date.ts","../../hooks/use-on-insert-image.ts","../../hooks/use-on-insert-link.ts","../../hooks/use-on-insert-note.ts","../../hooks/use-on-insert-row.ts","../../hooks/use-on-insert-table-row.ts","../../hooks/use-on-insert-time.ts","../../hooks/use-on-locale-change.ts","../../hooks/use-on-merge-unmerge-cells.ts","../../hooks/use-on-move-columns.ts","../../hooks/use-on-move-rows.ts","../../hooks/use-on-move-selection.ts","../../hooks/use-on-move-sheet.ts","../../hooks/use-on-move-table-columns.ts","../../hooks/use-on-paste.ts","../../hooks/use-on-protect-range.ts","../../hooks/use-on-protect-sheet.ts","../../hooks/use-on-remove-duplicates.ts","../../hooks/use-on-rename-sheet.ts","../../hooks/use-on-request-calculate-wrapper.ts","../../hooks/use-on-request-conditional-format.ts","../../hooks/use-on-request-create-table.ts","../../hooks/use-on-request-data-validation.ts","../../hooks/use-on-request-define-named-range.ts","../../hooks/use-on-request-delete-sheet.ts","../../hooks/use-on-request-edit-table.ts","../../hooks/use-on-request-format-cells.ts","../../hooks/use-on-request-insert-image.ts","../../hooks/use-on-request-insert-link.ts","../../hooks/use-on-request-insert-slicer.ts","../../hooks/use-on-request-resize-table.ts","../../hooks/use-on-request-resize.ts","../../hooks/use-on-request-update-named-range.ts","../../hooks/use-on-resize-table.ts","../../hooks/use-on-resize.ts","../../hooks/use-on-set-outline-depth.ts","../../hooks/use-on-show-column.ts","../../hooks/use-on-show-row.ts","../../hooks/use-on-sort-column.ts","../../hooks/use-on-sort-range.ts","../../hooks/use-on-sort-table.ts","../../hooks/use-on-subtotal.ts","../../hooks/use-on-table.ts","../../hooks/use-on-trace-dependents-precedents.tsx","../../hooks/use-on-undo-calculated-column.ts","../../hooks/use-on-undo-table-auto-expansion.ts","../../hooks/use-on-ungroup-columns.ts","../../hooks/use-on-ungroup-rows.ts","../../hooks/use-on-update-named-range.ts","../../hooks/use-on-update-note.ts","../../hooks/use-on-update-sheet.ts","../../hooks/use-paint-format.ts","../../hooks/use-search.ts","../../hooks/use-select-next-prev-sheet.ts","../../hooks/use-sheet-observer.ts","../../hooks/use-sheet-properties.ts","../../hooks/use-sheet-state.ts","../../hooks/use-sheetdata-subscriber.ts","../../hooks/use-slicers.ts","../../hooks/use-sparkline-groups.ts","../../hooks/use-split-text-to-columns.ts","../../hooks/use-spreadsheet-state.ts","../../hooks/use-ss-registry.ts","../../hooks/use-structured-reference.ts","../../hooks/use-undo-redo-actions.ts","../../hooks/use-undo-redo.ts","../../hooks/utils/frozen-sort.ts","../../hooks/utils/sort-rows.ts","../../interface/apply-fill.ts","../../interface/auto-resize.ts","../../interface/calculation-interface.ts","../../interface/change-batch-stream.ts","../../interface/change-batch.ts","../../interface/change-border.ts","../../interface/change-calculated-column.ts","../../interface/change-decimals.ts","../../interface/change-formatting.ts","../../interface/change-sheet-tabcolor.ts","../../interface/change-table-column.ts","../../interface/change-theme.ts","../../interface/chart-extensions.ts","../../interface/citations.ts","../../interface/clear-formatting.ts","../../interface/conditional-formatting-rules.ts","../../interface/create-table.ts","../../interface/data-validation-rules.ts","../../interface/data-validation-utils.ts","../../interface/delete-cells-shift-left.ts","../../interface/delete-cells-shift-up.ts","../../interface/delete-cells.ts","../../interface/delete-column.ts","../../interface/delete-row.ts","../../interface/delete-sheet.ts","../../interface/delete-table-column.ts","../../interface/delete-table-row.ts","../../interface/duplicate-sheet.ts","../../interface/embeds.ts","../../interface/freeze.ts","../../interface/helpers.ts","../../interface/hide-column.ts","../../interface/hide-row.ts","../../interface/indent.ts","../../interface/insert-cells-shift-down.ts","../../interface/insert-cells-shift-right.ts","../../interface/insert-column.ts","../../interface/insert-note.ts","../../interface/insert-row.ts","../../interface/insert-table-row.ts","../../interface/interface-cli.ts","../../interface/named-range-operations.ts","../../interface/new-sheet.ts","../../interface/pivot-extensions.ts","../../interface/remove-duplicates.ts","../../interface/remove-table.ts","../../interface/resize-utils.ts","../../interface/resize.ts","../../interface/sheet-order.ts","../../interface/slicers.ts","../../interface/split-text.ts","../../interface/spreadsheet-interface.ts","../../interface/table-totalrow.ts","../../interface/table-utils.ts","../../interface/update-sheet.ts","../../interface/update-table.ts","../../validation-schema/table.schema.ts"],"version":"5.8.3"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-on-move-sheet.d.ts","sourceRoot":"","sources":["../../../hooks/use-on-move-sheet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,KAAK,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"use-on-move-sheet.d.ts","sourceRoot":"","sources":["../../../hooks/use-on-move-sheet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAItE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,KAAK,mBAAmB,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,IAAI;IAC9D,cAAc,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;IAC5D,aAAa,IAAI,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACrD,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,+CAIjE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,eAId,MAAM,mBAAmB,MAAM,eAAe,MAAM,SAuDjE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { sortSheetsByIndex } from "@rowsncolumns/utils";
|
|
2
1
|
import { produceWithPatches } from "immer";
|
|
3
2
|
import { useCallback } from "react";
|
|
3
|
+
import { moveSheetInOrder } from "../interface/sheet-order";
|
|
4
4
|
import { useCanEditSheet, useCanEditWorkbook } from "./use-can-edit-cellrange";
|
|
5
5
|
export const useOnMoveSheet = ({ onChangeSheets, createHistory, onCommand, }) => {
|
|
6
6
|
const canEditSheet = useCanEditSheet();
|
|
@@ -19,42 +19,23 @@ export const useOnMoveSheet = ({ onChangeSheets, createHistory, onCommand, }) =>
|
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
const saveHistory = createHistory();
|
|
22
|
+
let moved = false;
|
|
22
23
|
onChangeSheets((prevSheets) => {
|
|
23
24
|
const [nextState, patches, inversePatches] = produceWithPatches(prevSheets, (draft) => {
|
|
24
|
-
|
|
25
|
-
const sheetToMove = sortedSheets[currentPosition];
|
|
26
|
-
const oldIndex = sheetToMove.index;
|
|
27
|
-
const newIndex = sortedSheets[newPosition].index;
|
|
28
|
-
// Determine the direction of movement
|
|
29
|
-
const isMovingDown = newPosition > currentPosition;
|
|
30
|
-
// Update indices of affected sheets
|
|
31
|
-
draft.forEach((sheet, arrayIndex) => {
|
|
32
|
-
const currentIndex = sheet.index ?? arrayIndex;
|
|
33
|
-
if (sheet.sheetId === sheetId) {
|
|
34
|
-
sheet.index = newIndex;
|
|
35
|
-
}
|
|
36
|
-
else if (!isMovingDown &&
|
|
37
|
-
currentIndex < oldIndex &&
|
|
38
|
-
currentIndex >= newIndex) {
|
|
39
|
-
sheet.index = currentIndex + 1;
|
|
40
|
-
}
|
|
41
|
-
else if (isMovingDown &&
|
|
42
|
-
currentIndex > oldIndex &&
|
|
43
|
-
currentIndex <= newIndex) {
|
|
44
|
-
sheet.index = currentIndex - 1;
|
|
45
|
-
}
|
|
46
|
-
else if (sheet.index === undefined) {
|
|
47
|
-
// Set index for sheets that didn't have one before
|
|
48
|
-
sheet.index = arrayIndex;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
25
|
+
moved = moveSheetInOrder(draft, sheetId, currentPosition, newPosition);
|
|
51
26
|
});
|
|
27
|
+
if (!moved) {
|
|
28
|
+
return prevSheets;
|
|
29
|
+
}
|
|
52
30
|
// Save history
|
|
53
31
|
saveHistory({
|
|
54
32
|
sheets: { patches, inversePatches },
|
|
55
33
|
});
|
|
56
34
|
return nextState;
|
|
57
35
|
});
|
|
36
|
+
if (!moved) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
58
39
|
onCommand?.({
|
|
59
40
|
command: "move-sheet",
|
|
60
41
|
sheetId,
|
|
@@ -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;AAe7E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,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;AAIhF,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,uBAmT1D,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { renameTablesInFormula } from "../api/formula";
|
|
|
5
5
|
import { createSheetDraft } from "../api/immer-utils";
|
|
6
6
|
import { getGeneratedSheetCopyName } from "../generated-names";
|
|
7
7
|
import { SheetCell } from "../sheet-cell";
|
|
8
|
+
import { sheetIndexAfter } from "./sheet-order";
|
|
8
9
|
export const duplicateSheet = ({ locale, maxSheetCount, sheets, idCreationStrategy, onChangeSheetData, onChangeSheets, onChangeTables, onChangeCharts, onChangeEmbeds, onChangeConditionalFormats, onChangeDataValidations, enqueueGraphOperation, createHistory, generatedNames, }) => {
|
|
9
10
|
return (sheetId, newSheetIdDefinedByUser) => {
|
|
10
11
|
const saveHistory = createHistory();
|
|
@@ -35,11 +36,12 @@ export const duplicateSheet = ({ locale, maxSheetCount, sheets, idCreationStrate
|
|
|
35
36
|
sourceChartSheetChartId = sheet.chartId;
|
|
36
37
|
copiedChartSheetChartId = idCreationStrategy?.("chart") ?? uuid();
|
|
37
38
|
}
|
|
38
|
-
/* Update the sheet title */
|
|
39
|
+
/* Update the sheet title; the copy's tab sits right after its source */
|
|
39
40
|
const newSheet = {
|
|
40
41
|
...sheet,
|
|
41
42
|
sheetId: newSheetId,
|
|
42
43
|
title: newTitle,
|
|
44
|
+
index: sheetIndexAfter(draft, sheetId),
|
|
43
45
|
...(copiedChartSheetChartId !== undefined
|
|
44
46
|
? { chartId: copiedChartSheetChartId }
|
|
45
47
|
: {}),
|
|
@@ -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;
|
|
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;AAoB1E,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,KAuFT,CAE1B,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { uniqueSheetTitle, uuid } from "@rowsncolumns/utils";
|
|
|
2
2
|
import { produceWithPatches } from "immer";
|
|
3
3
|
import { getGeneratedSheetName } from "../generated-names";
|
|
4
4
|
import { MAX_SHEET_TITLE_LENGTH, truncateSheetTitle, } from "../helpers/sheet-title";
|
|
5
|
+
import { sheetIndexAfter } from "./sheet-order";
|
|
5
6
|
const createNewSheetHelper = (sheetId, title, rowCount = 1000, columnCount = 100, hidden = false) => ({
|
|
6
7
|
title,
|
|
7
8
|
sheetId,
|
|
@@ -39,30 +40,9 @@ export const createNewSheet = ({ sheetId, maxSheetCount, sheets, maxRowCount, ma
|
|
|
39
40
|
getGeneratedSheetName(draft.length + 1, generatedNames)), draft.map((s) => s.title), MAX_SHEET_TITLE_LENGTH);
|
|
40
41
|
// Create the new sheet
|
|
41
42
|
const newSheet = createNewSheetHelper(newSheetId, finalTitle, sheetSpec?.rowCount ?? maxRowCount, sheetSpec?.columnCount ?? maxColumnCount, sheetSpec?.hidden ?? false);
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
-
const
|
|
45
|
-
.map((s, arrayIndex) => ({
|
|
46
|
-
sheet: s,
|
|
47
|
-
effectiveIndex: s.index ?? arrayIndex,
|
|
48
|
-
arrayIndex,
|
|
49
|
-
}))
|
|
50
|
-
.sort((a, b) => a.effectiveIndex - b.effectiveIndex ||
|
|
51
|
-
a.arrayIndex - b.arrayIndex);
|
|
52
|
-
const activeOrderedIndex = orderedSheets.findIndex((entry) => entry.sheet.sheetId === sheetId);
|
|
53
|
-
const fallbackMaxIndex = orderedSheets.length > 0
|
|
54
|
-
? Math.max(...orderedSheets.map((entry) => entry.effectiveIndex))
|
|
55
|
-
: -1;
|
|
56
|
-
const computedIndex = activeOrderedIndex === -1
|
|
57
|
-
? fallbackMaxIndex + 1
|
|
58
|
-
: (() => {
|
|
59
|
-
const currentIndex = orderedSheets[activeOrderedIndex]?.effectiveIndex ??
|
|
60
|
-
fallbackMaxIndex;
|
|
61
|
-
const nextIndex = orderedSheets[activeOrderedIndex + 1]?.effectiveIndex;
|
|
62
|
-
return nextIndex === undefined
|
|
63
|
-
? currentIndex + 1
|
|
64
|
-
: currentIndex + (nextIndex - currentIndex) / 2;
|
|
65
|
-
})();
|
|
43
|
+
// Visual insertion index (after the active sheet) without moving the
|
|
44
|
+
// existing array positions. This keeps ShareDB patches append-only.
|
|
45
|
+
const computedIndex = sheetSpec?.index ?? sheetIndexAfter(draft, sheetId);
|
|
66
46
|
// Merge any additional spec properties
|
|
67
47
|
const sheet = {
|
|
68
48
|
...newSheet,
|
|
@@ -70,7 +50,7 @@ export const createNewSheet = ({ sheetId, maxSheetCount, sheets, maxRowCount, ma
|
|
|
70
50
|
// Ensure computed values override spec
|
|
71
51
|
sheetId: newSheetId,
|
|
72
52
|
title: finalTitle,
|
|
73
|
-
index:
|
|
53
|
+
index: computedIndex,
|
|
74
54
|
};
|
|
75
55
|
// Always append physically to keep patches as add-only.
|
|
76
56
|
draft.push(sheet);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Sheet } from "@rowsncolumns/spreadsheet";
|
|
2
|
+
import type { Draft } from "immer";
|
|
3
|
+
type OrderableSheet = Pick<Sheet, "sheetId" | "index" | "hidden" | "title">;
|
|
4
|
+
/**
|
|
5
|
+
* The `index` that places a new sheet right after `anchorSheetId` in tab order — halfway to the next
|
|
6
|
+
* tab, so no existing sheet has to change its `index` (a collab host's patches stay add-only). With
|
|
7
|
+
* no anchor the sheet goes last. When the anchor and its neighbour share an `index` there is no gap
|
|
8
|
+
* to split, so every sheet is renumbered first and the new sheet takes the slot after the anchor.
|
|
9
|
+
*/
|
|
10
|
+
export declare const sheetIndexAfter: <S extends OrderableSheet>(draft: Draft<S>[], anchorSheetId: number) => number;
|
|
11
|
+
/**
|
|
12
|
+
* Move `sheetId` from `currentPosition` to `newPosition` — both positions among the VISIBLE tabs, as
|
|
13
|
+
* the tab strip counts them — and renumber every sheet from the resulting order, hidden tabs keeping
|
|
14
|
+
* their slot. Indices are only ever read as an order here (a created or duplicated sheet carries a
|
|
15
|
+
* fractional one; a host may seed duplicates), so shifting neighbours by ±1 is not an option: the
|
|
16
|
+
* moved tab has to land where it was dropped with the others in their old relative order.
|
|
17
|
+
* Returns false when the move names a sheet or a position that does not exist.
|
|
18
|
+
*/
|
|
19
|
+
export declare const moveSheetInOrder: <S extends OrderableSheet>(draft: Draft<S>[], sheetId: number, currentPosition: number, newPosition: number) => boolean;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=sheet-order.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheet-order.d.ts","sourceRoot":"","sources":["../../../interface/sheet-order.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAEvD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAEnC,KAAK,cAAc,GAAG,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,CAAC;AA+B5E;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,cAAc,EACtD,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,EACjB,eAAe,MAAM,KACpB,MAyBF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,cAAc,EACvD,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,EACjB,SAAS,MAAM,EACf,iBAAiB,MAAM,EACvB,aAAa,MAAM,KAClB,OAmBF,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { sortSheetsByIndex } from "@rowsncolumns/utils";
|
|
2
|
+
/**
|
|
3
|
+
* Tab order the way the tab strip renders it — `sortSheetsByIndex` with hidden sheets kept, so a
|
|
4
|
+
* hidden tab keeps its slot between its neighbours.
|
|
5
|
+
*/
|
|
6
|
+
const tabOrder = (sheets) => sortSheetsByIndex(sheets, true);
|
|
7
|
+
/**
|
|
8
|
+
* Give every sheet the position it holds in `order` as its `index`, so the indices are contiguous
|
|
9
|
+
* integers again. `shiftFrom` leaves a gap: positions at or after it move up by one, for a sheet that
|
|
10
|
+
* is about to be inserted there.
|
|
11
|
+
*/
|
|
12
|
+
const renumber = (draft, order, shiftFrom = Number.POSITIVE_INFINITY) => {
|
|
13
|
+
const positionById = new Map();
|
|
14
|
+
order.forEach((sheetId, position) => {
|
|
15
|
+
positionById.set(sheetId, position >= shiftFrom ? position + 1 : position);
|
|
16
|
+
});
|
|
17
|
+
for (const sheet of draft) {
|
|
18
|
+
const position = positionById.get(sheet.sheetId);
|
|
19
|
+
if (position !== undefined && sheet.index !== position) {
|
|
20
|
+
sheet.index = position;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The `index` that places a new sheet right after `anchorSheetId` in tab order — halfway to the next
|
|
26
|
+
* tab, so no existing sheet has to change its `index` (a collab host's patches stay add-only). With
|
|
27
|
+
* no anchor the sheet goes last. When the anchor and its neighbour share an `index` there is no gap
|
|
28
|
+
* to split, so every sheet is renumbered first and the new sheet takes the slot after the anchor.
|
|
29
|
+
*/
|
|
30
|
+
export const sheetIndexAfter = (draft, anchorSheetId) => {
|
|
31
|
+
const ordered = tabOrder(draft);
|
|
32
|
+
if (ordered.length === 0) {
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
const anchorPosition = ordered.findIndex((sheet) => sheet.sheetId === anchorSheetId);
|
|
36
|
+
if (anchorPosition === -1) {
|
|
37
|
+
return Math.max(...ordered.map((sheet) => sheet.index)) + 1;
|
|
38
|
+
}
|
|
39
|
+
const anchorIndex = ordered[anchorPosition].index;
|
|
40
|
+
const next = ordered[anchorPosition + 1];
|
|
41
|
+
if (next === undefined) {
|
|
42
|
+
return anchorIndex + 1;
|
|
43
|
+
}
|
|
44
|
+
if (next.index > anchorIndex) {
|
|
45
|
+
return anchorIndex + (next.index - anchorIndex) / 2;
|
|
46
|
+
}
|
|
47
|
+
renumber(draft, ordered.map((sheet) => sheet.sheetId), anchorPosition + 1);
|
|
48
|
+
return anchorPosition + 1;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Move `sheetId` from `currentPosition` to `newPosition` — both positions among the VISIBLE tabs, as
|
|
52
|
+
* the tab strip counts them — and renumber every sheet from the resulting order, hidden tabs keeping
|
|
53
|
+
* their slot. Indices are only ever read as an order here (a created or duplicated sheet carries a
|
|
54
|
+
* fractional one; a host may seed duplicates), so shifting neighbours by ±1 is not an option: the
|
|
55
|
+
* moved tab has to land where it was dropped with the others in their old relative order.
|
|
56
|
+
* Returns false when the move names a sheet or a position that does not exist.
|
|
57
|
+
*/
|
|
58
|
+
export const moveSheetInOrder = (draft, sheetId, currentPosition, newPosition) => {
|
|
59
|
+
const target = sortSheetsByIndex(draft)[newPosition];
|
|
60
|
+
if (target === undefined || target.sheetId === sheetId) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
const order = tabOrder(draft).map((sheet) => sheet.sheetId);
|
|
64
|
+
const from = order.indexOf(sheetId);
|
|
65
|
+
if (from === -1) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
order.splice(from, 1);
|
|
69
|
+
const targetPosition = order.indexOf(target.sheetId);
|
|
70
|
+
order.splice(newPosition > currentPosition ? targetPosition + 1 : targetPosition, 0, sheetId);
|
|
71
|
+
renumber(draft, order);
|
|
72
|
+
return true;
|
|
73
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../../cellxfs-registry.ts","../../commands.ts","../../constants.ts","../../generated-names.ts","../../helpers.ts","../../index.ts","../../server-utils.ts","../../server.browser.ts","../../server.ts","../../shared-string-registry.ts","../../sheet-cell.ts","../../test-setup.ts","../../types.ts","../../vitest.config.ts","../../api/advanced-filter.ts","../../api/anchored-objects.ts","../../api/basic-filter.ts","../../api/border.ts","../../api/circular-reference.ts","../../api/conditional-format.ts","../../api/copy-paste.ts","../../api/data-validation.ts","../../api/datatype.ts","../../api/date.ts","../../api/decimals.ts","../../api/dependency.ts","../../api/fill-series-spec.ts","../../api/fill.ts","../../api/filter-condition.ts","../../api/filter-range.ts","../../api/filter.ts","../../api/format-caches.ts","../../api/formula.ts","../../api/goal-seek.ts","../../api/image-embed.ts","../../api/immer-utils.ts","../../api/insert-cut-cells.ts","../../api/intl.ts","../../api/merges.ts","../../api/named-range-structural.ts","../../api/outline.ts","../../api/paint-format.ts","../../api/parse-html.ts","../../api/paste-special.ts","../../api/patches.ts","../../api/pivot-range.ts","../../api/range-rule-helpers.ts","../../api/range.ts","../../api/rename-sheet.ts","../../api/selection.ts","../../api/sort.ts","../../api/split-text.ts","../../api/structural-formula-update.ts","../../api/structural-guards.ts","../../api/structural-table-refs.ts","../../api/subtotal.ts","../../api/table.ts","../../api/validation.ts","../../api/xlsx-source.ts","../../atoms/creating-table.atom.ts","../../atoms/delete-sheet-atom.ts","../../atoms/dialog-state.atom.ts","../../atoms/editing-data-validation-id.atom.ts","../../atoms/editing-embed.atom.ts","../../atoms/editing-slicer.atom.ts","../../atoms/editing-table.atom.ts","../../atoms/error-state.atom.ts","../../atoms/index.ts","../../atoms/insert-image-state.atom.ts","../../atoms/inserting-slicer.atom.ts","../../atoms/named-range.atom.ts","../../atoms/resize-dimension.atom.ts","../../atoms/resizing-table.atom.ts","../../atoms/sheet-observer.atom.ts","../../components/index.tsx","../../components/dialogs/delete-sheet-confirmation.tsx","../../components/dialogs/error-state.tsx","../../components/editors/cell-format-editor.tsx","../../components/editors/conditional-format-editor.tsx","../../components/editors/conditional-format-rule-editor.tsx","../../components/editors/data-validation-editor.tsx","../../components/editors/data-validation-rule-editor.tsx","../../components/editors/embed-editor.tsx","../../components/editors/insert-image-editor.tsx","../../components/editors/insert-link-editor.tsx","../../components/editors/named-range-editor.tsx","../../components/editors/resize-dimension-editor.tsx","../../components/editors/sheet-filter.tsx","../../components/editors/slicer-editor.tsx","../../components/editors/table-editor.tsx","../../helpers/default-cell-format.ts","../../helpers/iterative-calculation.ts","../../helpers/sheet-title.ts","../../hooks/use-async-datasource.ts","../../hooks/use-calculation-initialize.ts","../../hooks/use-calculation-process-array.ts","../../hooks/use-calculation-queue.ts","../../hooks/use-calculation-worker.ts","../../hooks/use-calculation.ts","../../hooks/use-can-edit-cellrange.ts","../../hooks/use-cellxfs-registry.ts","../../hooks/use-citations.ts","../../hooks/use-comments.ts","../../hooks/use-conditional-formatting-rules.ts","../../hooks/use-data-validation-rules.ts","../../hooks/use-deferred-calculation-flush.ts","../../hooks/use-idle-scheduler.ts","../../hooks/use-indent.ts","../../hooks/use-named-range.ts","../../hooks/use-on-adjust-row-height.ts","../../hooks/use-on-advanced-filter.ts","../../hooks/use-on-autoresize.ts","../../hooks/use-on-banded-ranges.ts","../../hooks/use-on-calculation-begin.ts","../../hooks/use-on-calculation-success.ts","../../hooks/use-on-change-batch-stream.ts","../../hooks/use-on-change-batch.ts","../../hooks/use-on-change-calculated-column.ts","../../hooks/use-on-change-decimals.ts","../../hooks/use-on-change-formatting.ts","../../hooks/use-on-change-sheet-tabcolor.ts","../../hooks/use-on-change-table-column.ts","../../hooks/use-on-change-theme.ts","../../hooks/use-on-change.ts","../../hooks/use-on-clear-formatting.ts","../../hooks/use-on-collapse-column-group.ts","../../hooks/use-on-collapse-row-group.ts","../../hooks/use-on-copy.ts","../../hooks/use-on-create-custom-table-style.ts","../../hooks/use-on-create-named-range.ts","../../hooks/use-on-create-sheet.ts","../../hooks/use-on-delete-cells-shift-left.ts","../../hooks/use-on-delete-cells-shift-up.ts","../../hooks/use-on-delete-column.ts","../../hooks/use-on-delete-named-range.ts","../../hooks/use-on-delete-row.ts","../../hooks/use-on-delete-sheet.ts","../../hooks/use-on-delete-table-row.ts","../../hooks/use-on-delete.ts","../../hooks/use-on-drag-n-drop.ts","../../hooks/use-on-duplicate-sheet.ts","../../hooks/use-on-embeds.ts","../../hooks/use-on-expand-column-group.ts","../../hooks/use-on-expand-row-group.ts","../../hooks/use-on-fill-range.ts","../../hooks/use-on-fill.ts","../../hooks/use-on-filter-table.ts","../../hooks/use-on-find-replace.ts","../../hooks/use-on-freeze.ts","../../hooks/use-on-goal-seek.ts","../../hooks/use-on-group-columns.ts","../../hooks/use-on-group-rows.ts","../../hooks/use-on-hide-column.ts","../../hooks/use-on-hide-row.ts","../../hooks/use-on-hide-show-sheet.ts","../../hooks/use-on-import-csv-legacy.ts","../../hooks/use-on-import-csv.ts","../../hooks/use-on-import-excel.ts","../../hooks/use-on-insert-autosum.ts","../../hooks/use-on-insert-cells-shift-down.ts","../../hooks/use-on-insert-cells-shift-right.ts","../../hooks/use-on-insert-checkbox.ts","../../hooks/use-on-insert-column.ts","../../hooks/use-on-insert-date-time.ts","../../hooks/use-on-insert-date.ts","../../hooks/use-on-insert-image.ts","../../hooks/use-on-insert-link.ts","../../hooks/use-on-insert-note.ts","../../hooks/use-on-insert-row.ts","../../hooks/use-on-insert-table-row.ts","../../hooks/use-on-insert-time.ts","../../hooks/use-on-locale-change.ts","../../hooks/use-on-merge-unmerge-cells.ts","../../hooks/use-on-move-columns.ts","../../hooks/use-on-move-rows.ts","../../hooks/use-on-move-selection.ts","../../hooks/use-on-move-sheet.ts","../../hooks/use-on-move-table-columns.ts","../../hooks/use-on-paste.ts","../../hooks/use-on-protect-range.ts","../../hooks/use-on-protect-sheet.ts","../../hooks/use-on-remove-duplicates.ts","../../hooks/use-on-rename-sheet.ts","../../hooks/use-on-request-calculate-wrapper.ts","../../hooks/use-on-request-conditional-format.ts","../../hooks/use-on-request-create-table.ts","../../hooks/use-on-request-data-validation.ts","../../hooks/use-on-request-define-named-range.ts","../../hooks/use-on-request-delete-sheet.ts","../../hooks/use-on-request-edit-table.ts","../../hooks/use-on-request-format-cells.ts","../../hooks/use-on-request-insert-image.ts","../../hooks/use-on-request-insert-link.ts","../../hooks/use-on-request-insert-slicer.ts","../../hooks/use-on-request-resize-table.ts","../../hooks/use-on-request-resize.ts","../../hooks/use-on-request-update-named-range.ts","../../hooks/use-on-resize-table.ts","../../hooks/use-on-resize.ts","../../hooks/use-on-set-outline-depth.ts","../../hooks/use-on-show-column.ts","../../hooks/use-on-show-row.ts","../../hooks/use-on-sort-column.ts","../../hooks/use-on-sort-range.ts","../../hooks/use-on-sort-table.ts","../../hooks/use-on-subtotal.ts","../../hooks/use-on-table.ts","../../hooks/use-on-trace-dependents-precedents.tsx","../../hooks/use-on-undo-calculated-column.ts","../../hooks/use-on-undo-table-auto-expansion.ts","../../hooks/use-on-ungroup-columns.ts","../../hooks/use-on-ungroup-rows.ts","../../hooks/use-on-update-named-range.ts","../../hooks/use-on-update-note.ts","../../hooks/use-on-update-sheet.ts","../../hooks/use-paint-format.ts","../../hooks/use-search.ts","../../hooks/use-select-next-prev-sheet.ts","../../hooks/use-sheet-observer.ts","../../hooks/use-sheet-properties.ts","../../hooks/use-sheet-state.ts","../../hooks/use-sheetdata-subscriber.ts","../../hooks/use-slicers.ts","../../hooks/use-sparkline-groups.ts","../../hooks/use-split-text-to-columns.ts","../../hooks/use-spreadsheet-state.ts","../../hooks/use-ss-registry.ts","../../hooks/use-structured-reference.ts","../../hooks/use-undo-redo-actions.ts","../../hooks/use-undo-redo.ts","../../hooks/utils/frozen-sort.ts","../../hooks/utils/sort-rows.ts","../../interface/apply-fill.ts","../../interface/auto-resize.ts","../../interface/calculation-interface.ts","../../interface/change-batch-stream.ts","../../interface/change-batch.ts","../../interface/change-border.ts","../../interface/change-calculated-column.ts","../../interface/change-decimals.ts","../../interface/change-formatting.ts","../../interface/change-sheet-tabcolor.ts","../../interface/change-table-column.ts","../../interface/change-theme.ts","../../interface/chart-extensions.ts","../../interface/citations.ts","../../interface/clear-formatting.ts","../../interface/conditional-formatting-rules.ts","../../interface/create-table.ts","../../interface/data-validation-rules.ts","../../interface/data-validation-utils.ts","../../interface/delete-cells-shift-left.ts","../../interface/delete-cells-shift-up.ts","../../interface/delete-cells.ts","../../interface/delete-column.ts","../../interface/delete-row.ts","../../interface/delete-sheet.ts","../../interface/delete-table-column.ts","../../interface/delete-table-row.ts","../../interface/duplicate-sheet.ts","../../interface/embeds.ts","../../interface/freeze.ts","../../interface/helpers.ts","../../interface/hide-column.ts","../../interface/hide-row.ts","../../interface/indent.ts","../../interface/insert-cells-shift-down.ts","../../interface/insert-cells-shift-right.ts","../../interface/insert-column.ts","../../interface/insert-note.ts","../../interface/insert-row.ts","../../interface/insert-table-row.ts","../../interface/interface-cli.ts","../../interface/named-range-operations.ts","../../interface/new-sheet.ts","../../interface/pivot-extensions.ts","../../interface/remove-duplicates.ts","../../interface/remove-table.ts","../../interface/resize-utils.ts","../../interface/resize.ts","../../interface/slicers.ts","../../interface/split-text.ts","../../interface/spreadsheet-interface.ts","../../interface/table-totalrow.ts","../../interface/table-utils.ts","../../interface/update-sheet.ts","../../interface/update-table.ts","../../validation-schema/table.schema.ts"],"version":"5.8.3"}
|
|
1
|
+
{"root":["../../cellxfs-registry.ts","../../commands.ts","../../constants.ts","../../generated-names.ts","../../helpers.ts","../../index.ts","../../server-utils.ts","../../server.browser.ts","../../server.ts","../../shared-string-registry.ts","../../sheet-cell.ts","../../test-setup.ts","../../types.ts","../../vitest.config.ts","../../api/advanced-filter.ts","../../api/anchored-objects.ts","../../api/basic-filter.ts","../../api/border.ts","../../api/circular-reference.ts","../../api/conditional-format.ts","../../api/copy-paste.ts","../../api/data-validation.ts","../../api/datatype.ts","../../api/date.ts","../../api/decimals.ts","../../api/dependency.ts","../../api/fill-series-spec.ts","../../api/fill.ts","../../api/filter-condition.ts","../../api/filter-range.ts","../../api/filter.ts","../../api/format-caches.ts","../../api/formula.ts","../../api/goal-seek.ts","../../api/image-embed.ts","../../api/immer-utils.ts","../../api/insert-cut-cells.ts","../../api/intl.ts","../../api/merges.ts","../../api/named-range-structural.ts","../../api/outline.ts","../../api/paint-format.ts","../../api/parse-html.ts","../../api/paste-special.ts","../../api/patches.ts","../../api/pivot-range.ts","../../api/range-rule-helpers.ts","../../api/range.ts","../../api/rename-sheet.ts","../../api/selection.ts","../../api/sort.ts","../../api/split-text.ts","../../api/structural-formula-update.ts","../../api/structural-guards.ts","../../api/structural-table-refs.ts","../../api/subtotal.ts","../../api/table.ts","../../api/validation.ts","../../api/xlsx-source.ts","../../atoms/creating-table.atom.ts","../../atoms/delete-sheet-atom.ts","../../atoms/dialog-state.atom.ts","../../atoms/editing-data-validation-id.atom.ts","../../atoms/editing-embed.atom.ts","../../atoms/editing-slicer.atom.ts","../../atoms/editing-table.atom.ts","../../atoms/error-state.atom.ts","../../atoms/index.ts","../../atoms/insert-image-state.atom.ts","../../atoms/inserting-slicer.atom.ts","../../atoms/named-range.atom.ts","../../atoms/resize-dimension.atom.ts","../../atoms/resizing-table.atom.ts","../../atoms/sheet-observer.atom.ts","../../components/index.tsx","../../components/dialogs/delete-sheet-confirmation.tsx","../../components/dialogs/error-state.tsx","../../components/editors/cell-format-editor.tsx","../../components/editors/conditional-format-editor.tsx","../../components/editors/conditional-format-rule-editor.tsx","../../components/editors/data-validation-editor.tsx","../../components/editors/data-validation-rule-editor.tsx","../../components/editors/embed-editor.tsx","../../components/editors/insert-image-editor.tsx","../../components/editors/insert-link-editor.tsx","../../components/editors/named-range-editor.tsx","../../components/editors/resize-dimension-editor.tsx","../../components/editors/sheet-filter.tsx","../../components/editors/slicer-editor.tsx","../../components/editors/table-editor.tsx","../../helpers/default-cell-format.ts","../../helpers/iterative-calculation.ts","../../helpers/sheet-title.ts","../../hooks/use-async-datasource.ts","../../hooks/use-calculation-initialize.ts","../../hooks/use-calculation-process-array.ts","../../hooks/use-calculation-queue.ts","../../hooks/use-calculation-worker.ts","../../hooks/use-calculation.ts","../../hooks/use-can-edit-cellrange.ts","../../hooks/use-cellxfs-registry.ts","../../hooks/use-citations.ts","../../hooks/use-comments.ts","../../hooks/use-conditional-formatting-rules.ts","../../hooks/use-data-validation-rules.ts","../../hooks/use-deferred-calculation-flush.ts","../../hooks/use-idle-scheduler.ts","../../hooks/use-indent.ts","../../hooks/use-named-range.ts","../../hooks/use-on-adjust-row-height.ts","../../hooks/use-on-advanced-filter.ts","../../hooks/use-on-autoresize.ts","../../hooks/use-on-banded-ranges.ts","../../hooks/use-on-calculation-begin.ts","../../hooks/use-on-calculation-success.ts","../../hooks/use-on-change-batch-stream.ts","../../hooks/use-on-change-batch.ts","../../hooks/use-on-change-calculated-column.ts","../../hooks/use-on-change-decimals.ts","../../hooks/use-on-change-formatting.ts","../../hooks/use-on-change-sheet-tabcolor.ts","../../hooks/use-on-change-table-column.ts","../../hooks/use-on-change-theme.ts","../../hooks/use-on-change.ts","../../hooks/use-on-clear-formatting.ts","../../hooks/use-on-collapse-column-group.ts","../../hooks/use-on-collapse-row-group.ts","../../hooks/use-on-copy.ts","../../hooks/use-on-create-custom-table-style.ts","../../hooks/use-on-create-named-range.ts","../../hooks/use-on-create-sheet.ts","../../hooks/use-on-delete-cells-shift-left.ts","../../hooks/use-on-delete-cells-shift-up.ts","../../hooks/use-on-delete-column.ts","../../hooks/use-on-delete-named-range.ts","../../hooks/use-on-delete-row.ts","../../hooks/use-on-delete-sheet.ts","../../hooks/use-on-delete-table-row.ts","../../hooks/use-on-delete.ts","../../hooks/use-on-drag-n-drop.ts","../../hooks/use-on-duplicate-sheet.ts","../../hooks/use-on-embeds.ts","../../hooks/use-on-expand-column-group.ts","../../hooks/use-on-expand-row-group.ts","../../hooks/use-on-fill-range.ts","../../hooks/use-on-fill.ts","../../hooks/use-on-filter-table.ts","../../hooks/use-on-find-replace.ts","../../hooks/use-on-freeze.ts","../../hooks/use-on-goal-seek.ts","../../hooks/use-on-group-columns.ts","../../hooks/use-on-group-rows.ts","../../hooks/use-on-hide-column.ts","../../hooks/use-on-hide-row.ts","../../hooks/use-on-hide-show-sheet.ts","../../hooks/use-on-import-csv-legacy.ts","../../hooks/use-on-import-csv.ts","../../hooks/use-on-import-excel.ts","../../hooks/use-on-insert-autosum.ts","../../hooks/use-on-insert-cells-shift-down.ts","../../hooks/use-on-insert-cells-shift-right.ts","../../hooks/use-on-insert-checkbox.ts","../../hooks/use-on-insert-column.ts","../../hooks/use-on-insert-date-time.ts","../../hooks/use-on-insert-date.ts","../../hooks/use-on-insert-image.ts","../../hooks/use-on-insert-link.ts","../../hooks/use-on-insert-note.ts","../../hooks/use-on-insert-row.ts","../../hooks/use-on-insert-table-row.ts","../../hooks/use-on-insert-time.ts","../../hooks/use-on-locale-change.ts","../../hooks/use-on-merge-unmerge-cells.ts","../../hooks/use-on-move-columns.ts","../../hooks/use-on-move-rows.ts","../../hooks/use-on-move-selection.ts","../../hooks/use-on-move-sheet.ts","../../hooks/use-on-move-table-columns.ts","../../hooks/use-on-paste.ts","../../hooks/use-on-protect-range.ts","../../hooks/use-on-protect-sheet.ts","../../hooks/use-on-remove-duplicates.ts","../../hooks/use-on-rename-sheet.ts","../../hooks/use-on-request-calculate-wrapper.ts","../../hooks/use-on-request-conditional-format.ts","../../hooks/use-on-request-create-table.ts","../../hooks/use-on-request-data-validation.ts","../../hooks/use-on-request-define-named-range.ts","../../hooks/use-on-request-delete-sheet.ts","../../hooks/use-on-request-edit-table.ts","../../hooks/use-on-request-format-cells.ts","../../hooks/use-on-request-insert-image.ts","../../hooks/use-on-request-insert-link.ts","../../hooks/use-on-request-insert-slicer.ts","../../hooks/use-on-request-resize-table.ts","../../hooks/use-on-request-resize.ts","../../hooks/use-on-request-update-named-range.ts","../../hooks/use-on-resize-table.ts","../../hooks/use-on-resize.ts","../../hooks/use-on-set-outline-depth.ts","../../hooks/use-on-show-column.ts","../../hooks/use-on-show-row.ts","../../hooks/use-on-sort-column.ts","../../hooks/use-on-sort-range.ts","../../hooks/use-on-sort-table.ts","../../hooks/use-on-subtotal.ts","../../hooks/use-on-table.ts","../../hooks/use-on-trace-dependents-precedents.tsx","../../hooks/use-on-undo-calculated-column.ts","../../hooks/use-on-undo-table-auto-expansion.ts","../../hooks/use-on-ungroup-columns.ts","../../hooks/use-on-ungroup-rows.ts","../../hooks/use-on-update-named-range.ts","../../hooks/use-on-update-note.ts","../../hooks/use-on-update-sheet.ts","../../hooks/use-paint-format.ts","../../hooks/use-search.ts","../../hooks/use-select-next-prev-sheet.ts","../../hooks/use-sheet-observer.ts","../../hooks/use-sheet-properties.ts","../../hooks/use-sheet-state.ts","../../hooks/use-sheetdata-subscriber.ts","../../hooks/use-slicers.ts","../../hooks/use-sparkline-groups.ts","../../hooks/use-split-text-to-columns.ts","../../hooks/use-spreadsheet-state.ts","../../hooks/use-ss-registry.ts","../../hooks/use-structured-reference.ts","../../hooks/use-undo-redo-actions.ts","../../hooks/use-undo-redo.ts","../../hooks/utils/frozen-sort.ts","../../hooks/utils/sort-rows.ts","../../interface/apply-fill.ts","../../interface/auto-resize.ts","../../interface/calculation-interface.ts","../../interface/change-batch-stream.ts","../../interface/change-batch.ts","../../interface/change-border.ts","../../interface/change-calculated-column.ts","../../interface/change-decimals.ts","../../interface/change-formatting.ts","../../interface/change-sheet-tabcolor.ts","../../interface/change-table-column.ts","../../interface/change-theme.ts","../../interface/chart-extensions.ts","../../interface/citations.ts","../../interface/clear-formatting.ts","../../interface/conditional-formatting-rules.ts","../../interface/create-table.ts","../../interface/data-validation-rules.ts","../../interface/data-validation-utils.ts","../../interface/delete-cells-shift-left.ts","../../interface/delete-cells-shift-up.ts","../../interface/delete-cells.ts","../../interface/delete-column.ts","../../interface/delete-row.ts","../../interface/delete-sheet.ts","../../interface/delete-table-column.ts","../../interface/delete-table-row.ts","../../interface/duplicate-sheet.ts","../../interface/embeds.ts","../../interface/freeze.ts","../../interface/helpers.ts","../../interface/hide-column.ts","../../interface/hide-row.ts","../../interface/indent.ts","../../interface/insert-cells-shift-down.ts","../../interface/insert-cells-shift-right.ts","../../interface/insert-column.ts","../../interface/insert-note.ts","../../interface/insert-row.ts","../../interface/insert-table-row.ts","../../interface/interface-cli.ts","../../interface/named-range-operations.ts","../../interface/new-sheet.ts","../../interface/pivot-extensions.ts","../../interface/remove-duplicates.ts","../../interface/remove-table.ts","../../interface/resize-utils.ts","../../interface/resize.ts","../../interface/sheet-order.ts","../../interface/slicers.ts","../../interface/split-text.ts","../../interface/spreadsheet-interface.ts","../../interface/table-totalrow.ts","../../interface/table-utils.ts","../../interface/update-sheet.ts","../../interface/update-table.ts","../../validation-schema/table.schema.ts"],"version":"5.8.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rowsncolumns/spreadsheet-state",
|
|
3
|
-
"version": "29.1.
|
|
3
|
+
"version": "29.1.13",
|
|
4
4
|
"main": "./dist/cjs/index.js",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"types": "./dist/esm/index.d.ts",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@rowsncolumns/fast-formula-parser": ">=6.2.44",
|
|
79
79
|
"@rowsncolumns/grid": ">=13.2.36",
|
|
80
80
|
"@rowsncolumns/icons": ">=7.2.33",
|
|
81
|
-
"@rowsncolumns/spreadsheet": ">=10.5.
|
|
81
|
+
"@rowsncolumns/spreadsheet": ">=10.5.6",
|
|
82
82
|
"@rowsncolumns/ui": ">=16.1.0",
|
|
83
83
|
"@rowsncolumns/utils": ">=9.5.6"
|
|
84
84
|
},
|