@odoo/o-spreadsheet 16.0.67 → 16.0.69
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/o-spreadsheet.cjs.js +104 -38
- package/dist/o-spreadsheet.d.ts +3 -2
- package/dist/o-spreadsheet.esm.js +104 -38
- package/dist/o-spreadsheet.iife.js +104 -38
- package/dist/o-spreadsheet.iife.min.js +240 -241
- package/dist/o_spreadsheet.xml +65 -56
- package/package.json +1 -1
|
@@ -2373,6 +2373,32 @@ function createDefaultRows(rowNumber) {
|
|
|
2373
2373
|
rows.push(row);
|
|
2374
2374
|
}
|
|
2375
2375
|
return rows;
|
|
2376
|
+
}
|
|
2377
|
+
function isSheetNameEqual(name1, name2) {
|
|
2378
|
+
if (name1 === undefined || name2 === undefined) {
|
|
2379
|
+
return false;
|
|
2380
|
+
}
|
|
2381
|
+
return (getUnquotedSheetName(name1.trim().toUpperCase()) ===
|
|
2382
|
+
getUnquotedSheetName(name2.trim().toUpperCase()));
|
|
2383
|
+
}
|
|
2384
|
+
function getNextSheetName(existingNames, baseName = "Sheet") {
|
|
2385
|
+
let i = 1;
|
|
2386
|
+
let name = `${baseName}${i}`;
|
|
2387
|
+
while (existingNames.includes(name)) {
|
|
2388
|
+
name = `${baseName}${i}`;
|
|
2389
|
+
i++;
|
|
2390
|
+
}
|
|
2391
|
+
return name;
|
|
2392
|
+
}
|
|
2393
|
+
function getDuplicateSheetName(nameToDuplicate, existingNames) {
|
|
2394
|
+
let i = 1;
|
|
2395
|
+
const baseName = _lt("Copy of %s", nameToDuplicate);
|
|
2396
|
+
let name = baseName.toString();
|
|
2397
|
+
while (existingNames.includes(name)) {
|
|
2398
|
+
name = `${baseName} (${i})`;
|
|
2399
|
+
i++;
|
|
2400
|
+
}
|
|
2401
|
+
return name;
|
|
2376
2402
|
}
|
|
2377
2403
|
|
|
2378
2404
|
/*
|
|
@@ -6081,10 +6107,13 @@ sheetMenuRegistry
|
|
|
6081
6107
|
sequence: 20,
|
|
6082
6108
|
action: (env) => {
|
|
6083
6109
|
const sheetIdFrom = env.model.getters.getActiveSheetId();
|
|
6110
|
+
const sheetNameFrom = env.model.getters.getSheetName(sheetIdFrom);
|
|
6084
6111
|
const sheetIdTo = env.model.uuidGenerator.smallUuid();
|
|
6112
|
+
const sheetNameTo = env.model.getters.getDuplicateSheetName(sheetNameFrom);
|
|
6085
6113
|
env.model.dispatch("DUPLICATE_SHEET", {
|
|
6086
6114
|
sheetId: sheetIdFrom,
|
|
6087
6115
|
sheetIdTo,
|
|
6116
|
+
sheetNameTo,
|
|
6088
6117
|
});
|
|
6089
6118
|
env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom, sheetIdTo });
|
|
6090
6119
|
},
|
|
@@ -19637,7 +19666,7 @@ class EditionPlugin extends UIPlugin {
|
|
|
19637
19666
|
const { xc, sheetName: sheet } = splitReference(token.value);
|
|
19638
19667
|
const sheetName = sheet || this.getters.getSheetName(this.sheetId);
|
|
19639
19668
|
const activeSheetId = this.getters.getActiveSheetId();
|
|
19640
|
-
if (this.getters.getSheetName(activeSheetId)
|
|
19669
|
+
if (!isSheetNameEqual(this.getters.getSheetName(activeSheetId), sheetName)) {
|
|
19641
19670
|
return false;
|
|
19642
19671
|
}
|
|
19643
19672
|
const refRange = this.getters.getRangeFromSheetXC(activeSheetId, xc);
|
|
@@ -21716,18 +21745,28 @@ figureRegistry.add("chart", { Component: ChartFigure, SidePanelComponent: "Chart
|
|
|
21716
21745
|
function useInterval(callback, delay) {
|
|
21717
21746
|
let intervalId;
|
|
21718
21747
|
const { setInterval, clearInterval } = window;
|
|
21748
|
+
const pause = () => {
|
|
21749
|
+
clearInterval(intervalId);
|
|
21750
|
+
intervalId = undefined;
|
|
21751
|
+
};
|
|
21752
|
+
const safeCallback = () => {
|
|
21753
|
+
try {
|
|
21754
|
+
callback();
|
|
21755
|
+
}
|
|
21756
|
+
catch (e) {
|
|
21757
|
+
pause();
|
|
21758
|
+
throw e;
|
|
21759
|
+
}
|
|
21760
|
+
};
|
|
21719
21761
|
owl.useEffect(() => {
|
|
21720
|
-
intervalId = setInterval(
|
|
21762
|
+
intervalId = setInterval(safeCallback, delay);
|
|
21721
21763
|
return () => clearInterval(intervalId);
|
|
21722
21764
|
}, () => [delay]);
|
|
21723
21765
|
return {
|
|
21724
|
-
pause
|
|
21725
|
-
clearInterval(intervalId);
|
|
21726
|
-
intervalId = undefined;
|
|
21727
|
-
},
|
|
21766
|
+
pause,
|
|
21728
21767
|
resume: () => {
|
|
21729
21768
|
if (intervalId === undefined) {
|
|
21730
|
-
intervalId = setInterval(
|
|
21769
|
+
intervalId = setInterval(safeCallback, delay);
|
|
21731
21770
|
}
|
|
21732
21771
|
},
|
|
21733
21772
|
};
|
|
@@ -22134,7 +22173,7 @@ css /* scss */ `
|
|
|
22134
22173
|
position: absolute;
|
|
22135
22174
|
top: 0;
|
|
22136
22175
|
left: ${HEADER_WIDTH}px;
|
|
22137
|
-
right:
|
|
22176
|
+
right: ${SCROLLBAR_WIDTH}px;
|
|
22138
22177
|
height: ${HEADER_HEIGHT}px;
|
|
22139
22178
|
&.o-dragging {
|
|
22140
22179
|
cursor: grabbing;
|
|
@@ -22305,9 +22344,8 @@ css /* scss */ `
|
|
|
22305
22344
|
position: absolute;
|
|
22306
22345
|
top: ${HEADER_HEIGHT}px;
|
|
22307
22346
|
left: 0;
|
|
22308
|
-
|
|
22347
|
+
bottom: ${SCROLLBAR_WIDTH}px;
|
|
22309
22348
|
width: ${HEADER_WIDTH}px;
|
|
22310
|
-
height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH}px);
|
|
22311
22349
|
&.o-dragging {
|
|
22312
22350
|
cursor: grabbing;
|
|
22313
22351
|
}
|
|
@@ -25032,7 +25070,7 @@ function getRangeSize(reference, defaultSheetIndex, data) {
|
|
|
25032
25070
|
({ xc, sheetName } = splitReference(reference));
|
|
25033
25071
|
let rangeSheetIndex;
|
|
25034
25072
|
if (sheetName) {
|
|
25035
|
-
const index = data.sheets.findIndex((sheet) => sheet.name
|
|
25073
|
+
const index = data.sheets.findIndex((sheet) => isSheetNameEqual(sheet.name, sheetName));
|
|
25036
25074
|
if (index < 0) {
|
|
25037
25075
|
throw new Error("Unable to find a sheet with the name " + sheetName);
|
|
25038
25076
|
}
|
|
@@ -25204,7 +25242,7 @@ function convertFormula(formula, data) {
|
|
|
25204
25242
|
var _a;
|
|
25205
25243
|
externalRefId = Number(externalRefId) - 1;
|
|
25206
25244
|
cellRef = cellRef.replace(/\$/g, "");
|
|
25207
|
-
const sheetIndex = data.externalBooks[externalRefId].sheetNames.findIndex((name) => name
|
|
25245
|
+
const sheetIndex = data.externalBooks[externalRefId].sheetNames.findIndex((name) => isSheetNameEqual(name, sheetName));
|
|
25208
25246
|
if (sheetIndex === -1) {
|
|
25209
25247
|
return match;
|
|
25210
25248
|
}
|
|
@@ -25543,7 +25581,7 @@ function applyStyleToZone(appliedStyle, zone, cells, styles) {
|
|
|
25543
25581
|
*/
|
|
25544
25582
|
function convertTableFormulaReferences(convertedSheets, xlsxSheets) {
|
|
25545
25583
|
for (let tableSheet of convertedSheets) {
|
|
25546
|
-
const tables = xlsxSheets.find((s) => s.sheetName
|
|
25584
|
+
const tables = xlsxSheets.find((s) => isSheetNameEqual(s.sheetName, tableSheet.name)).tables;
|
|
25547
25585
|
for (let table of tables) {
|
|
25548
25586
|
const tabRef = table.name + "[";
|
|
25549
25587
|
for (let sheet of convertedSheets) {
|
|
@@ -27423,6 +27461,7 @@ function repairInitialMessages(data, initialMessages) {
|
|
|
27423
27461
|
initialMessages = dropCommands(initialMessages, "SORT_CELLS");
|
|
27424
27462
|
initialMessages = dropCommands(initialMessages, "SET_DECIMAL");
|
|
27425
27463
|
initialMessages = fixChartDefinitions(data, initialMessages);
|
|
27464
|
+
initialMessages = fixTranslatedDuplicateSheetName(data, initialMessages);
|
|
27426
27465
|
return initialMessages;
|
|
27427
27466
|
}
|
|
27428
27467
|
/**
|
|
@@ -27523,6 +27562,40 @@ function fixChartDefinitions(data, initialMessages) {
|
|
|
27523
27562
|
}
|
|
27524
27563
|
return messages;
|
|
27525
27564
|
}
|
|
27565
|
+
function fixTranslatedDuplicateSheetName(data, initialMessages) {
|
|
27566
|
+
var _a;
|
|
27567
|
+
const sheetNames = {};
|
|
27568
|
+
for (const sheet of data.sheets || []) {
|
|
27569
|
+
sheetNames[sheet.id] = sheet.name;
|
|
27570
|
+
}
|
|
27571
|
+
const messages = [];
|
|
27572
|
+
for (const message of initialMessages) {
|
|
27573
|
+
if (message.type === "REMOTE_REVISION") {
|
|
27574
|
+
const commands = [];
|
|
27575
|
+
for (const cmd of message.commands) {
|
|
27576
|
+
switch (cmd.type) {
|
|
27577
|
+
case "DUPLICATE_SHEET":
|
|
27578
|
+
cmd.sheetNameTo =
|
|
27579
|
+
(_a = cmd.sheetNameTo) !== null && _a !== void 0 ? _a : getDuplicateSheetName(sheetNames[cmd.sheetId], Object.values(sheetNames));
|
|
27580
|
+
break;
|
|
27581
|
+
case "CREATE_SHEET":
|
|
27582
|
+
case "RENAME_SHEET":
|
|
27583
|
+
sheetNames[cmd.sheetId] = cmd.name || getNextSheetName(Object.values(sheetNames));
|
|
27584
|
+
break;
|
|
27585
|
+
}
|
|
27586
|
+
commands.push(cmd);
|
|
27587
|
+
}
|
|
27588
|
+
messages.push({
|
|
27589
|
+
...message,
|
|
27590
|
+
commands,
|
|
27591
|
+
});
|
|
27592
|
+
}
|
|
27593
|
+
else {
|
|
27594
|
+
messages.push(message);
|
|
27595
|
+
}
|
|
27596
|
+
}
|
|
27597
|
+
return initialMessages;
|
|
27598
|
+
}
|
|
27526
27599
|
// -----------------------------------------------------------------------------
|
|
27527
27600
|
// Helpers
|
|
27528
27601
|
// -----------------------------------------------------------------------------
|
|
@@ -30515,7 +30588,11 @@ class SheetPlugin extends CorePlugin {
|
|
|
30515
30588
|
return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
|
|
30516
30589
|
}
|
|
30517
30590
|
case "DUPLICATE_SHEET": {
|
|
30518
|
-
|
|
30591
|
+
if (this.sheets[cmd.sheetIdTo])
|
|
30592
|
+
return 12 /* CommandResult.DuplicatedSheetId */;
|
|
30593
|
+
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo))
|
|
30594
|
+
return 11 /* CommandResult.DuplicatedSheetName */;
|
|
30595
|
+
return 0 /* CommandResult.Success */;
|
|
30519
30596
|
}
|
|
30520
30597
|
case "MOVE_SHEET":
|
|
30521
30598
|
const currentIndex = this.orderedSheetIds.indexOf(cmd.sheetId);
|
|
@@ -30601,7 +30678,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
30601
30678
|
this.showSheet(cmd.sheetId);
|
|
30602
30679
|
break;
|
|
30603
30680
|
case "DUPLICATE_SHEET":
|
|
30604
|
-
this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo);
|
|
30681
|
+
this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo, cmd.sheetNameTo);
|
|
30605
30682
|
break;
|
|
30606
30683
|
case "DELETE_SHEET":
|
|
30607
30684
|
this.deleteSheet(this.sheets[cmd.sheetId]);
|
|
@@ -30741,7 +30818,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
30741
30818
|
if (name) {
|
|
30742
30819
|
const unquotedName = getUnquotedSheetName(name);
|
|
30743
30820
|
for (const key in this.sheetIdsMapName) {
|
|
30744
|
-
if (key
|
|
30821
|
+
if (isSheetNameEqual(key, unquotedName)) {
|
|
30745
30822
|
return this.sheetIdsMapName[key];
|
|
30746
30823
|
}
|
|
30747
30824
|
}
|
|
@@ -30825,14 +30902,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
30825
30902
|
return dimension === "COL" ? this.getNumberCols(sheetId) : this.getNumberRows(sheetId);
|
|
30826
30903
|
}
|
|
30827
30904
|
getNextSheetName(baseName = "Sheet") {
|
|
30828
|
-
let i = 1;
|
|
30829
30905
|
const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
|
|
30830
|
-
|
|
30831
|
-
while (names.includes(name)) {
|
|
30832
|
-
name = `${baseName}${i}`;
|
|
30833
|
-
i++;
|
|
30834
|
-
}
|
|
30835
|
-
return name;
|
|
30906
|
+
return getNextSheetName(names, baseName);
|
|
30836
30907
|
}
|
|
30837
30908
|
getSheetSize(sheetId) {
|
|
30838
30909
|
return {
|
|
@@ -30996,7 +31067,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
30996
31067
|
checkSheetName(cmd) {
|
|
30997
31068
|
const { orderedSheetIds, sheets } = this;
|
|
30998
31069
|
const name = cmd.name && cmd.name.trim().toLowerCase();
|
|
30999
|
-
if (orderedSheetIds.find((id) => { var _a; return ((_a = sheets[id]) === null || _a === void 0 ? void 0 : _a.name
|
|
31070
|
+
if (orderedSheetIds.find((id) => { var _a; return isSheetNameEqual((_a = sheets[id]) === null || _a === void 0 ? void 0 : _a.name, name); })) {
|
|
31000
31071
|
return 11 /* CommandResult.DuplicatedSheetName */;
|
|
31001
31072
|
}
|
|
31002
31073
|
if (FORBIDDEN_IN_EXCEL_REGEX.test(name)) {
|
|
@@ -31060,9 +31131,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
31060
31131
|
showSheet(sheetId) {
|
|
31061
31132
|
this.history.update("sheets", sheetId, "isVisible", true);
|
|
31062
31133
|
}
|
|
31063
|
-
duplicateSheet(fromId, toId) {
|
|
31134
|
+
duplicateSheet(fromId, toId, toName) {
|
|
31064
31135
|
const sheet = this.getSheet(fromId);
|
|
31065
|
-
const toName = this.getDuplicateSheetName(sheet.name);
|
|
31066
31136
|
const newSheet = deepCopy(sheet);
|
|
31067
31137
|
newSheet.id = toId;
|
|
31068
31138
|
newSheet.name = toName;
|
|
@@ -31094,15 +31164,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
31094
31164
|
this.history.update("sheetIdsMapName", sheetIdsMapName);
|
|
31095
31165
|
}
|
|
31096
31166
|
getDuplicateSheetName(sheetName) {
|
|
31097
|
-
let i = 1;
|
|
31098
31167
|
const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
|
|
31099
|
-
|
|
31100
|
-
let name = baseName.toString();
|
|
31101
|
-
while (names.includes(name)) {
|
|
31102
|
-
name = `${baseName} (${i})`;
|
|
31103
|
-
i++;
|
|
31104
|
-
}
|
|
31105
|
-
return name;
|
|
31168
|
+
return getDuplicateSheetName(sheetName, names);
|
|
31106
31169
|
}
|
|
31107
31170
|
deleteSheet(sheet) {
|
|
31108
31171
|
const name = sheet.name;
|
|
@@ -31389,6 +31452,7 @@ SheetPlugin.getters = [
|
|
|
31389
31452
|
"getSheetZone",
|
|
31390
31453
|
"getPaneDivisions",
|
|
31391
31454
|
"checkElementsIncludeAllNonFrozenHeaders",
|
|
31455
|
+
"getDuplicateSheetName",
|
|
31392
31456
|
];
|
|
31393
31457
|
|
|
31394
31458
|
/**
|
|
@@ -35261,6 +35325,8 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
35261
35325
|
const { col, row } = this.getters.getNextVisibleCellPosition(cmd.sheetIdTo, 0, 0);
|
|
35262
35326
|
this.selectCell(col, row);
|
|
35263
35327
|
}
|
|
35328
|
+
const { col, row } = this.gridSelection.anchor.cell;
|
|
35329
|
+
this.moveClient({ sheetId: this.activeSheet.id, col, row });
|
|
35264
35330
|
break;
|
|
35265
35331
|
}
|
|
35266
35332
|
case "REMOVE_COLUMNS_ROWS": {
|
|
@@ -40875,7 +40941,7 @@ class RangeAdapter {
|
|
|
40875
40941
|
if (range.sheetId === cmd.sheetId) {
|
|
40876
40942
|
return { changeType: "CHANGE", range };
|
|
40877
40943
|
}
|
|
40878
|
-
if (
|
|
40944
|
+
if (isSheetNameEqual(range.invalidSheetName, cmd.name)) {
|
|
40879
40945
|
const invalidSheetName = undefined;
|
|
40880
40946
|
const sheetId = cmd.sheetId;
|
|
40881
40947
|
const newRange = range.clone({ sheetId, invalidSheetName });
|
|
@@ -43782,6 +43848,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
43782
43848
|
exports.tokenize = tokenize;
|
|
43783
43849
|
|
|
43784
43850
|
|
|
43785
|
-
__info__.version = '16.0.
|
|
43786
|
-
__info__.date = '2025-
|
|
43787
|
-
__info__.hash = '
|
|
43851
|
+
__info__.version = '16.0.69';
|
|
43852
|
+
__info__.date = '2025-05-02T12:27:49.757Z';
|
|
43853
|
+
__info__.hash = '51188e8';
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -1681,6 +1681,7 @@ interface DeleteSheetCommand extends SheetDependentCommand {
|
|
|
1681
1681
|
interface DuplicateSheetCommand extends SheetDependentCommand {
|
|
1682
1682
|
type: "DUPLICATE_SHEET";
|
|
1683
1683
|
sheetIdTo: UID;
|
|
1684
|
+
sheetNameTo: string;
|
|
1684
1685
|
}
|
|
1685
1686
|
interface MoveSheetCommand extends SheetDependentCommand {
|
|
1686
1687
|
type: "MOVE_SHEET";
|
|
@@ -3563,7 +3564,7 @@ interface SheetState {
|
|
|
3563
3564
|
readonly cellPosition: Record<UID, CellPosition | undefined>;
|
|
3564
3565
|
}
|
|
3565
3566
|
declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
|
|
3566
|
-
static getters: readonly ["getSheetName", "tryGetSheetName", "getSheet", "tryGetSheet", "getSheetIdByName", "getSheetIds", "getVisibleSheetIds", "isSheetVisible", "getEvaluationSheets", "doesHeaderExist", "getCell", "getCellsInZone", "getCellPosition", "getColCells", "getColsZone", "getRowCells", "getRowsZone", "getNumberCols", "getNumberRows", "getNumberHeaders", "getGridLinesVisibility", "getNextSheetName", "isEmpty", "getSheetSize", "getSheetZone", "getPaneDivisions", "checkElementsIncludeAllNonFrozenHeaders"];
|
|
3567
|
+
static getters: readonly ["getSheetName", "tryGetSheetName", "getSheet", "tryGetSheet", "getSheetIdByName", "getSheetIds", "getVisibleSheetIds", "isSheetVisible", "getEvaluationSheets", "doesHeaderExist", "getCell", "getCellsInZone", "getCellPosition", "getColCells", "getColsZone", "getRowCells", "getRowsZone", "getNumberCols", "getNumberRows", "getNumberHeaders", "getGridLinesVisibility", "getNextSheetName", "isEmpty", "getSheetSize", "getSheetZone", "getPaneDivisions", "checkElementsIncludeAllNonFrozenHeaders", "getDuplicateSheetName"];
|
|
3567
3568
|
readonly sheetIdsMapName: Record<string, UID | undefined>;
|
|
3568
3569
|
readonly orderedSheetIds: UID[];
|
|
3569
3570
|
readonly sheets: Record<UID, Sheet | undefined>;
|
|
@@ -3645,7 +3646,7 @@ declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
|
|
|
3645
3646
|
private hideSheet;
|
|
3646
3647
|
private showSheet;
|
|
3647
3648
|
private duplicateSheet;
|
|
3648
|
-
|
|
3649
|
+
getDuplicateSheetName(sheetName: string): string;
|
|
3649
3650
|
private deleteSheet;
|
|
3650
3651
|
/**
|
|
3651
3652
|
* Delete column. This requires a lot of handling:
|
|
@@ -2369,6 +2369,32 @@ function createDefaultRows(rowNumber) {
|
|
|
2369
2369
|
rows.push(row);
|
|
2370
2370
|
}
|
|
2371
2371
|
return rows;
|
|
2372
|
+
}
|
|
2373
|
+
function isSheetNameEqual(name1, name2) {
|
|
2374
|
+
if (name1 === undefined || name2 === undefined) {
|
|
2375
|
+
return false;
|
|
2376
|
+
}
|
|
2377
|
+
return (getUnquotedSheetName(name1.trim().toUpperCase()) ===
|
|
2378
|
+
getUnquotedSheetName(name2.trim().toUpperCase()));
|
|
2379
|
+
}
|
|
2380
|
+
function getNextSheetName(existingNames, baseName = "Sheet") {
|
|
2381
|
+
let i = 1;
|
|
2382
|
+
let name = `${baseName}${i}`;
|
|
2383
|
+
while (existingNames.includes(name)) {
|
|
2384
|
+
name = `${baseName}${i}`;
|
|
2385
|
+
i++;
|
|
2386
|
+
}
|
|
2387
|
+
return name;
|
|
2388
|
+
}
|
|
2389
|
+
function getDuplicateSheetName(nameToDuplicate, existingNames) {
|
|
2390
|
+
let i = 1;
|
|
2391
|
+
const baseName = _lt("Copy of %s", nameToDuplicate);
|
|
2392
|
+
let name = baseName.toString();
|
|
2393
|
+
while (existingNames.includes(name)) {
|
|
2394
|
+
name = `${baseName} (${i})`;
|
|
2395
|
+
i++;
|
|
2396
|
+
}
|
|
2397
|
+
return name;
|
|
2372
2398
|
}
|
|
2373
2399
|
|
|
2374
2400
|
/*
|
|
@@ -6077,10 +6103,13 @@ sheetMenuRegistry
|
|
|
6077
6103
|
sequence: 20,
|
|
6078
6104
|
action: (env) => {
|
|
6079
6105
|
const sheetIdFrom = env.model.getters.getActiveSheetId();
|
|
6106
|
+
const sheetNameFrom = env.model.getters.getSheetName(sheetIdFrom);
|
|
6080
6107
|
const sheetIdTo = env.model.uuidGenerator.smallUuid();
|
|
6108
|
+
const sheetNameTo = env.model.getters.getDuplicateSheetName(sheetNameFrom);
|
|
6081
6109
|
env.model.dispatch("DUPLICATE_SHEET", {
|
|
6082
6110
|
sheetId: sheetIdFrom,
|
|
6083
6111
|
sheetIdTo,
|
|
6112
|
+
sheetNameTo,
|
|
6084
6113
|
});
|
|
6085
6114
|
env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom, sheetIdTo });
|
|
6086
6115
|
},
|
|
@@ -19633,7 +19662,7 @@ class EditionPlugin extends UIPlugin {
|
|
|
19633
19662
|
const { xc, sheetName: sheet } = splitReference(token.value);
|
|
19634
19663
|
const sheetName = sheet || this.getters.getSheetName(this.sheetId);
|
|
19635
19664
|
const activeSheetId = this.getters.getActiveSheetId();
|
|
19636
|
-
if (this.getters.getSheetName(activeSheetId)
|
|
19665
|
+
if (!isSheetNameEqual(this.getters.getSheetName(activeSheetId), sheetName)) {
|
|
19637
19666
|
return false;
|
|
19638
19667
|
}
|
|
19639
19668
|
const refRange = this.getters.getRangeFromSheetXC(activeSheetId, xc);
|
|
@@ -21712,18 +21741,28 @@ figureRegistry.add("chart", { Component: ChartFigure, SidePanelComponent: "Chart
|
|
|
21712
21741
|
function useInterval(callback, delay) {
|
|
21713
21742
|
let intervalId;
|
|
21714
21743
|
const { setInterval, clearInterval } = window;
|
|
21744
|
+
const pause = () => {
|
|
21745
|
+
clearInterval(intervalId);
|
|
21746
|
+
intervalId = undefined;
|
|
21747
|
+
};
|
|
21748
|
+
const safeCallback = () => {
|
|
21749
|
+
try {
|
|
21750
|
+
callback();
|
|
21751
|
+
}
|
|
21752
|
+
catch (e) {
|
|
21753
|
+
pause();
|
|
21754
|
+
throw e;
|
|
21755
|
+
}
|
|
21756
|
+
};
|
|
21715
21757
|
useEffect(() => {
|
|
21716
|
-
intervalId = setInterval(
|
|
21758
|
+
intervalId = setInterval(safeCallback, delay);
|
|
21717
21759
|
return () => clearInterval(intervalId);
|
|
21718
21760
|
}, () => [delay]);
|
|
21719
21761
|
return {
|
|
21720
|
-
pause
|
|
21721
|
-
clearInterval(intervalId);
|
|
21722
|
-
intervalId = undefined;
|
|
21723
|
-
},
|
|
21762
|
+
pause,
|
|
21724
21763
|
resume: () => {
|
|
21725
21764
|
if (intervalId === undefined) {
|
|
21726
|
-
intervalId = setInterval(
|
|
21765
|
+
intervalId = setInterval(safeCallback, delay);
|
|
21727
21766
|
}
|
|
21728
21767
|
},
|
|
21729
21768
|
};
|
|
@@ -22130,7 +22169,7 @@ css /* scss */ `
|
|
|
22130
22169
|
position: absolute;
|
|
22131
22170
|
top: 0;
|
|
22132
22171
|
left: ${HEADER_WIDTH}px;
|
|
22133
|
-
right:
|
|
22172
|
+
right: ${SCROLLBAR_WIDTH}px;
|
|
22134
22173
|
height: ${HEADER_HEIGHT}px;
|
|
22135
22174
|
&.o-dragging {
|
|
22136
22175
|
cursor: grabbing;
|
|
@@ -22301,9 +22340,8 @@ css /* scss */ `
|
|
|
22301
22340
|
position: absolute;
|
|
22302
22341
|
top: ${HEADER_HEIGHT}px;
|
|
22303
22342
|
left: 0;
|
|
22304
|
-
|
|
22343
|
+
bottom: ${SCROLLBAR_WIDTH}px;
|
|
22305
22344
|
width: ${HEADER_WIDTH}px;
|
|
22306
|
-
height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH}px);
|
|
22307
22345
|
&.o-dragging {
|
|
22308
22346
|
cursor: grabbing;
|
|
22309
22347
|
}
|
|
@@ -25028,7 +25066,7 @@ function getRangeSize(reference, defaultSheetIndex, data) {
|
|
|
25028
25066
|
({ xc, sheetName } = splitReference(reference));
|
|
25029
25067
|
let rangeSheetIndex;
|
|
25030
25068
|
if (sheetName) {
|
|
25031
|
-
const index = data.sheets.findIndex((sheet) => sheet.name
|
|
25069
|
+
const index = data.sheets.findIndex((sheet) => isSheetNameEqual(sheet.name, sheetName));
|
|
25032
25070
|
if (index < 0) {
|
|
25033
25071
|
throw new Error("Unable to find a sheet with the name " + sheetName);
|
|
25034
25072
|
}
|
|
@@ -25200,7 +25238,7 @@ function convertFormula(formula, data) {
|
|
|
25200
25238
|
var _a;
|
|
25201
25239
|
externalRefId = Number(externalRefId) - 1;
|
|
25202
25240
|
cellRef = cellRef.replace(/\$/g, "");
|
|
25203
|
-
const sheetIndex = data.externalBooks[externalRefId].sheetNames.findIndex((name) => name
|
|
25241
|
+
const sheetIndex = data.externalBooks[externalRefId].sheetNames.findIndex((name) => isSheetNameEqual(name, sheetName));
|
|
25204
25242
|
if (sheetIndex === -1) {
|
|
25205
25243
|
return match;
|
|
25206
25244
|
}
|
|
@@ -25539,7 +25577,7 @@ function applyStyleToZone(appliedStyle, zone, cells, styles) {
|
|
|
25539
25577
|
*/
|
|
25540
25578
|
function convertTableFormulaReferences(convertedSheets, xlsxSheets) {
|
|
25541
25579
|
for (let tableSheet of convertedSheets) {
|
|
25542
|
-
const tables = xlsxSheets.find((s) => s.sheetName
|
|
25580
|
+
const tables = xlsxSheets.find((s) => isSheetNameEqual(s.sheetName, tableSheet.name)).tables;
|
|
25543
25581
|
for (let table of tables) {
|
|
25544
25582
|
const tabRef = table.name + "[";
|
|
25545
25583
|
for (let sheet of convertedSheets) {
|
|
@@ -27419,6 +27457,7 @@ function repairInitialMessages(data, initialMessages) {
|
|
|
27419
27457
|
initialMessages = dropCommands(initialMessages, "SORT_CELLS");
|
|
27420
27458
|
initialMessages = dropCommands(initialMessages, "SET_DECIMAL");
|
|
27421
27459
|
initialMessages = fixChartDefinitions(data, initialMessages);
|
|
27460
|
+
initialMessages = fixTranslatedDuplicateSheetName(data, initialMessages);
|
|
27422
27461
|
return initialMessages;
|
|
27423
27462
|
}
|
|
27424
27463
|
/**
|
|
@@ -27519,6 +27558,40 @@ function fixChartDefinitions(data, initialMessages) {
|
|
|
27519
27558
|
}
|
|
27520
27559
|
return messages;
|
|
27521
27560
|
}
|
|
27561
|
+
function fixTranslatedDuplicateSheetName(data, initialMessages) {
|
|
27562
|
+
var _a;
|
|
27563
|
+
const sheetNames = {};
|
|
27564
|
+
for (const sheet of data.sheets || []) {
|
|
27565
|
+
sheetNames[sheet.id] = sheet.name;
|
|
27566
|
+
}
|
|
27567
|
+
const messages = [];
|
|
27568
|
+
for (const message of initialMessages) {
|
|
27569
|
+
if (message.type === "REMOTE_REVISION") {
|
|
27570
|
+
const commands = [];
|
|
27571
|
+
for (const cmd of message.commands) {
|
|
27572
|
+
switch (cmd.type) {
|
|
27573
|
+
case "DUPLICATE_SHEET":
|
|
27574
|
+
cmd.sheetNameTo =
|
|
27575
|
+
(_a = cmd.sheetNameTo) !== null && _a !== void 0 ? _a : getDuplicateSheetName(sheetNames[cmd.sheetId], Object.values(sheetNames));
|
|
27576
|
+
break;
|
|
27577
|
+
case "CREATE_SHEET":
|
|
27578
|
+
case "RENAME_SHEET":
|
|
27579
|
+
sheetNames[cmd.sheetId] = cmd.name || getNextSheetName(Object.values(sheetNames));
|
|
27580
|
+
break;
|
|
27581
|
+
}
|
|
27582
|
+
commands.push(cmd);
|
|
27583
|
+
}
|
|
27584
|
+
messages.push({
|
|
27585
|
+
...message,
|
|
27586
|
+
commands,
|
|
27587
|
+
});
|
|
27588
|
+
}
|
|
27589
|
+
else {
|
|
27590
|
+
messages.push(message);
|
|
27591
|
+
}
|
|
27592
|
+
}
|
|
27593
|
+
return initialMessages;
|
|
27594
|
+
}
|
|
27522
27595
|
// -----------------------------------------------------------------------------
|
|
27523
27596
|
// Helpers
|
|
27524
27597
|
// -----------------------------------------------------------------------------
|
|
@@ -30511,7 +30584,11 @@ class SheetPlugin extends CorePlugin {
|
|
|
30511
30584
|
return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
|
|
30512
30585
|
}
|
|
30513
30586
|
case "DUPLICATE_SHEET": {
|
|
30514
|
-
|
|
30587
|
+
if (this.sheets[cmd.sheetIdTo])
|
|
30588
|
+
return 12 /* CommandResult.DuplicatedSheetId */;
|
|
30589
|
+
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo))
|
|
30590
|
+
return 11 /* CommandResult.DuplicatedSheetName */;
|
|
30591
|
+
return 0 /* CommandResult.Success */;
|
|
30515
30592
|
}
|
|
30516
30593
|
case "MOVE_SHEET":
|
|
30517
30594
|
const currentIndex = this.orderedSheetIds.indexOf(cmd.sheetId);
|
|
@@ -30597,7 +30674,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
30597
30674
|
this.showSheet(cmd.sheetId);
|
|
30598
30675
|
break;
|
|
30599
30676
|
case "DUPLICATE_SHEET":
|
|
30600
|
-
this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo);
|
|
30677
|
+
this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo, cmd.sheetNameTo);
|
|
30601
30678
|
break;
|
|
30602
30679
|
case "DELETE_SHEET":
|
|
30603
30680
|
this.deleteSheet(this.sheets[cmd.sheetId]);
|
|
@@ -30737,7 +30814,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
30737
30814
|
if (name) {
|
|
30738
30815
|
const unquotedName = getUnquotedSheetName(name);
|
|
30739
30816
|
for (const key in this.sheetIdsMapName) {
|
|
30740
|
-
if (key
|
|
30817
|
+
if (isSheetNameEqual(key, unquotedName)) {
|
|
30741
30818
|
return this.sheetIdsMapName[key];
|
|
30742
30819
|
}
|
|
30743
30820
|
}
|
|
@@ -30821,14 +30898,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
30821
30898
|
return dimension === "COL" ? this.getNumberCols(sheetId) : this.getNumberRows(sheetId);
|
|
30822
30899
|
}
|
|
30823
30900
|
getNextSheetName(baseName = "Sheet") {
|
|
30824
|
-
let i = 1;
|
|
30825
30901
|
const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
|
|
30826
|
-
|
|
30827
|
-
while (names.includes(name)) {
|
|
30828
|
-
name = `${baseName}${i}`;
|
|
30829
|
-
i++;
|
|
30830
|
-
}
|
|
30831
|
-
return name;
|
|
30902
|
+
return getNextSheetName(names, baseName);
|
|
30832
30903
|
}
|
|
30833
30904
|
getSheetSize(sheetId) {
|
|
30834
30905
|
return {
|
|
@@ -30992,7 +31063,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
30992
31063
|
checkSheetName(cmd) {
|
|
30993
31064
|
const { orderedSheetIds, sheets } = this;
|
|
30994
31065
|
const name = cmd.name && cmd.name.trim().toLowerCase();
|
|
30995
|
-
if (orderedSheetIds.find((id) => { var _a; return ((_a = sheets[id]) === null || _a === void 0 ? void 0 : _a.name
|
|
31066
|
+
if (orderedSheetIds.find((id) => { var _a; return isSheetNameEqual((_a = sheets[id]) === null || _a === void 0 ? void 0 : _a.name, name); })) {
|
|
30996
31067
|
return 11 /* CommandResult.DuplicatedSheetName */;
|
|
30997
31068
|
}
|
|
30998
31069
|
if (FORBIDDEN_IN_EXCEL_REGEX.test(name)) {
|
|
@@ -31056,9 +31127,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
31056
31127
|
showSheet(sheetId) {
|
|
31057
31128
|
this.history.update("sheets", sheetId, "isVisible", true);
|
|
31058
31129
|
}
|
|
31059
|
-
duplicateSheet(fromId, toId) {
|
|
31130
|
+
duplicateSheet(fromId, toId, toName) {
|
|
31060
31131
|
const sheet = this.getSheet(fromId);
|
|
31061
|
-
const toName = this.getDuplicateSheetName(sheet.name);
|
|
31062
31132
|
const newSheet = deepCopy(sheet);
|
|
31063
31133
|
newSheet.id = toId;
|
|
31064
31134
|
newSheet.name = toName;
|
|
@@ -31090,15 +31160,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
31090
31160
|
this.history.update("sheetIdsMapName", sheetIdsMapName);
|
|
31091
31161
|
}
|
|
31092
31162
|
getDuplicateSheetName(sheetName) {
|
|
31093
|
-
let i = 1;
|
|
31094
31163
|
const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
|
|
31095
|
-
|
|
31096
|
-
let name = baseName.toString();
|
|
31097
|
-
while (names.includes(name)) {
|
|
31098
|
-
name = `${baseName} (${i})`;
|
|
31099
|
-
i++;
|
|
31100
|
-
}
|
|
31101
|
-
return name;
|
|
31164
|
+
return getDuplicateSheetName(sheetName, names);
|
|
31102
31165
|
}
|
|
31103
31166
|
deleteSheet(sheet) {
|
|
31104
31167
|
const name = sheet.name;
|
|
@@ -31385,6 +31448,7 @@ SheetPlugin.getters = [
|
|
|
31385
31448
|
"getSheetZone",
|
|
31386
31449
|
"getPaneDivisions",
|
|
31387
31450
|
"checkElementsIncludeAllNonFrozenHeaders",
|
|
31451
|
+
"getDuplicateSheetName",
|
|
31388
31452
|
];
|
|
31389
31453
|
|
|
31390
31454
|
/**
|
|
@@ -35257,6 +35321,8 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
35257
35321
|
const { col, row } = this.getters.getNextVisibleCellPosition(cmd.sheetIdTo, 0, 0);
|
|
35258
35322
|
this.selectCell(col, row);
|
|
35259
35323
|
}
|
|
35324
|
+
const { col, row } = this.gridSelection.anchor.cell;
|
|
35325
|
+
this.moveClient({ sheetId: this.activeSheet.id, col, row });
|
|
35260
35326
|
break;
|
|
35261
35327
|
}
|
|
35262
35328
|
case "REMOVE_COLUMNS_ROWS": {
|
|
@@ -40871,7 +40937,7 @@ class RangeAdapter {
|
|
|
40871
40937
|
if (range.sheetId === cmd.sheetId) {
|
|
40872
40938
|
return { changeType: "CHANGE", range };
|
|
40873
40939
|
}
|
|
40874
|
-
if (
|
|
40940
|
+
if (isSheetNameEqual(range.invalidSheetName, cmd.name)) {
|
|
40875
40941
|
const invalidSheetName = undefined;
|
|
40876
40942
|
const sheetId = cmd.sheetId;
|
|
40877
40943
|
const newRange = range.clone({ sheetId, invalidSheetName });
|
|
@@ -43750,6 +43816,6 @@ function addFunction(functionName, functionDescription) {
|
|
|
43750
43816
|
export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, cellTypes, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
|
|
43751
43817
|
|
|
43752
43818
|
|
|
43753
|
-
__info__.version = '16.0.
|
|
43754
|
-
__info__.date = '2025-
|
|
43755
|
-
__info__.hash = '
|
|
43819
|
+
__info__.version = '16.0.69';
|
|
43820
|
+
__info__.date = '2025-05-02T12:27:49.757Z';
|
|
43821
|
+
__info__.hash = '51188e8';
|