@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
|
@@ -2370,6 +2370,32 @@
|
|
|
2370
2370
|
rows.push(row);
|
|
2371
2371
|
}
|
|
2372
2372
|
return rows;
|
|
2373
|
+
}
|
|
2374
|
+
function isSheetNameEqual(name1, name2) {
|
|
2375
|
+
if (name1 === undefined || name2 === undefined) {
|
|
2376
|
+
return false;
|
|
2377
|
+
}
|
|
2378
|
+
return (getUnquotedSheetName(name1.trim().toUpperCase()) ===
|
|
2379
|
+
getUnquotedSheetName(name2.trim().toUpperCase()));
|
|
2380
|
+
}
|
|
2381
|
+
function getNextSheetName(existingNames, baseName = "Sheet") {
|
|
2382
|
+
let i = 1;
|
|
2383
|
+
let name = `${baseName}${i}`;
|
|
2384
|
+
while (existingNames.includes(name)) {
|
|
2385
|
+
name = `${baseName}${i}`;
|
|
2386
|
+
i++;
|
|
2387
|
+
}
|
|
2388
|
+
return name;
|
|
2389
|
+
}
|
|
2390
|
+
function getDuplicateSheetName(nameToDuplicate, existingNames) {
|
|
2391
|
+
let i = 1;
|
|
2392
|
+
const baseName = _lt("Copy of %s", nameToDuplicate);
|
|
2393
|
+
let name = baseName.toString();
|
|
2394
|
+
while (existingNames.includes(name)) {
|
|
2395
|
+
name = `${baseName} (${i})`;
|
|
2396
|
+
i++;
|
|
2397
|
+
}
|
|
2398
|
+
return name;
|
|
2373
2399
|
}
|
|
2374
2400
|
|
|
2375
2401
|
/*
|
|
@@ -6078,10 +6104,13 @@
|
|
|
6078
6104
|
sequence: 20,
|
|
6079
6105
|
action: (env) => {
|
|
6080
6106
|
const sheetIdFrom = env.model.getters.getActiveSheetId();
|
|
6107
|
+
const sheetNameFrom = env.model.getters.getSheetName(sheetIdFrom);
|
|
6081
6108
|
const sheetIdTo = env.model.uuidGenerator.smallUuid();
|
|
6109
|
+
const sheetNameTo = env.model.getters.getDuplicateSheetName(sheetNameFrom);
|
|
6082
6110
|
env.model.dispatch("DUPLICATE_SHEET", {
|
|
6083
6111
|
sheetId: sheetIdFrom,
|
|
6084
6112
|
sheetIdTo,
|
|
6113
|
+
sheetNameTo,
|
|
6085
6114
|
});
|
|
6086
6115
|
env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom, sheetIdTo });
|
|
6087
6116
|
},
|
|
@@ -19634,7 +19663,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
19634
19663
|
const { xc, sheetName: sheet } = splitReference(token.value);
|
|
19635
19664
|
const sheetName = sheet || this.getters.getSheetName(this.sheetId);
|
|
19636
19665
|
const activeSheetId = this.getters.getActiveSheetId();
|
|
19637
|
-
if (this.getters.getSheetName(activeSheetId)
|
|
19666
|
+
if (!isSheetNameEqual(this.getters.getSheetName(activeSheetId), sheetName)) {
|
|
19638
19667
|
return false;
|
|
19639
19668
|
}
|
|
19640
19669
|
const refRange = this.getters.getRangeFromSheetXC(activeSheetId, xc);
|
|
@@ -21713,18 +21742,28 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
21713
21742
|
function useInterval(callback, delay) {
|
|
21714
21743
|
let intervalId;
|
|
21715
21744
|
const { setInterval, clearInterval } = window;
|
|
21745
|
+
const pause = () => {
|
|
21746
|
+
clearInterval(intervalId);
|
|
21747
|
+
intervalId = undefined;
|
|
21748
|
+
};
|
|
21749
|
+
const safeCallback = () => {
|
|
21750
|
+
try {
|
|
21751
|
+
callback();
|
|
21752
|
+
}
|
|
21753
|
+
catch (e) {
|
|
21754
|
+
pause();
|
|
21755
|
+
throw e;
|
|
21756
|
+
}
|
|
21757
|
+
};
|
|
21716
21758
|
owl.useEffect(() => {
|
|
21717
|
-
intervalId = setInterval(
|
|
21759
|
+
intervalId = setInterval(safeCallback, delay);
|
|
21718
21760
|
return () => clearInterval(intervalId);
|
|
21719
21761
|
}, () => [delay]);
|
|
21720
21762
|
return {
|
|
21721
|
-
pause
|
|
21722
|
-
clearInterval(intervalId);
|
|
21723
|
-
intervalId = undefined;
|
|
21724
|
-
},
|
|
21763
|
+
pause,
|
|
21725
21764
|
resume: () => {
|
|
21726
21765
|
if (intervalId === undefined) {
|
|
21727
|
-
intervalId = setInterval(
|
|
21766
|
+
intervalId = setInterval(safeCallback, delay);
|
|
21728
21767
|
}
|
|
21729
21768
|
},
|
|
21730
21769
|
};
|
|
@@ -22131,7 +22170,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
22131
22170
|
position: absolute;
|
|
22132
22171
|
top: 0;
|
|
22133
22172
|
left: ${HEADER_WIDTH}px;
|
|
22134
|
-
right:
|
|
22173
|
+
right: ${SCROLLBAR_WIDTH}px;
|
|
22135
22174
|
height: ${HEADER_HEIGHT}px;
|
|
22136
22175
|
&.o-dragging {
|
|
22137
22176
|
cursor: grabbing;
|
|
@@ -22302,9 +22341,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
22302
22341
|
position: absolute;
|
|
22303
22342
|
top: ${HEADER_HEIGHT}px;
|
|
22304
22343
|
left: 0;
|
|
22305
|
-
|
|
22344
|
+
bottom: ${SCROLLBAR_WIDTH}px;
|
|
22306
22345
|
width: ${HEADER_WIDTH}px;
|
|
22307
|
-
height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH}px);
|
|
22308
22346
|
&.o-dragging {
|
|
22309
22347
|
cursor: grabbing;
|
|
22310
22348
|
}
|
|
@@ -25029,7 +25067,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
25029
25067
|
({ xc, sheetName } = splitReference(reference));
|
|
25030
25068
|
let rangeSheetIndex;
|
|
25031
25069
|
if (sheetName) {
|
|
25032
|
-
const index = data.sheets.findIndex((sheet) => sheet.name
|
|
25070
|
+
const index = data.sheets.findIndex((sheet) => isSheetNameEqual(sheet.name, sheetName));
|
|
25033
25071
|
if (index < 0) {
|
|
25034
25072
|
throw new Error("Unable to find a sheet with the name " + sheetName);
|
|
25035
25073
|
}
|
|
@@ -25201,7 +25239,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
25201
25239
|
var _a;
|
|
25202
25240
|
externalRefId = Number(externalRefId) - 1;
|
|
25203
25241
|
cellRef = cellRef.replace(/\$/g, "");
|
|
25204
|
-
const sheetIndex = data.externalBooks[externalRefId].sheetNames.findIndex((name) => name
|
|
25242
|
+
const sheetIndex = data.externalBooks[externalRefId].sheetNames.findIndex((name) => isSheetNameEqual(name, sheetName));
|
|
25205
25243
|
if (sheetIndex === -1) {
|
|
25206
25244
|
return match;
|
|
25207
25245
|
}
|
|
@@ -25540,7 +25578,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
25540
25578
|
*/
|
|
25541
25579
|
function convertTableFormulaReferences(convertedSheets, xlsxSheets) {
|
|
25542
25580
|
for (let tableSheet of convertedSheets) {
|
|
25543
|
-
const tables = xlsxSheets.find((s) => s.sheetName
|
|
25581
|
+
const tables = xlsxSheets.find((s) => isSheetNameEqual(s.sheetName, tableSheet.name)).tables;
|
|
25544
25582
|
for (let table of tables) {
|
|
25545
25583
|
const tabRef = table.name + "[";
|
|
25546
25584
|
for (let sheet of convertedSheets) {
|
|
@@ -27420,6 +27458,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
27420
27458
|
initialMessages = dropCommands(initialMessages, "SORT_CELLS");
|
|
27421
27459
|
initialMessages = dropCommands(initialMessages, "SET_DECIMAL");
|
|
27422
27460
|
initialMessages = fixChartDefinitions(data, initialMessages);
|
|
27461
|
+
initialMessages = fixTranslatedDuplicateSheetName(data, initialMessages);
|
|
27423
27462
|
return initialMessages;
|
|
27424
27463
|
}
|
|
27425
27464
|
/**
|
|
@@ -27520,6 +27559,40 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
27520
27559
|
}
|
|
27521
27560
|
return messages;
|
|
27522
27561
|
}
|
|
27562
|
+
function fixTranslatedDuplicateSheetName(data, initialMessages) {
|
|
27563
|
+
var _a;
|
|
27564
|
+
const sheetNames = {};
|
|
27565
|
+
for (const sheet of data.sheets || []) {
|
|
27566
|
+
sheetNames[sheet.id] = sheet.name;
|
|
27567
|
+
}
|
|
27568
|
+
const messages = [];
|
|
27569
|
+
for (const message of initialMessages) {
|
|
27570
|
+
if (message.type === "REMOTE_REVISION") {
|
|
27571
|
+
const commands = [];
|
|
27572
|
+
for (const cmd of message.commands) {
|
|
27573
|
+
switch (cmd.type) {
|
|
27574
|
+
case "DUPLICATE_SHEET":
|
|
27575
|
+
cmd.sheetNameTo =
|
|
27576
|
+
(_a = cmd.sheetNameTo) !== null && _a !== void 0 ? _a : getDuplicateSheetName(sheetNames[cmd.sheetId], Object.values(sheetNames));
|
|
27577
|
+
break;
|
|
27578
|
+
case "CREATE_SHEET":
|
|
27579
|
+
case "RENAME_SHEET":
|
|
27580
|
+
sheetNames[cmd.sheetId] = cmd.name || getNextSheetName(Object.values(sheetNames));
|
|
27581
|
+
break;
|
|
27582
|
+
}
|
|
27583
|
+
commands.push(cmd);
|
|
27584
|
+
}
|
|
27585
|
+
messages.push({
|
|
27586
|
+
...message,
|
|
27587
|
+
commands,
|
|
27588
|
+
});
|
|
27589
|
+
}
|
|
27590
|
+
else {
|
|
27591
|
+
messages.push(message);
|
|
27592
|
+
}
|
|
27593
|
+
}
|
|
27594
|
+
return initialMessages;
|
|
27595
|
+
}
|
|
27523
27596
|
// -----------------------------------------------------------------------------
|
|
27524
27597
|
// Helpers
|
|
27525
27598
|
// -----------------------------------------------------------------------------
|
|
@@ -30512,7 +30585,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
30512
30585
|
return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
|
|
30513
30586
|
}
|
|
30514
30587
|
case "DUPLICATE_SHEET": {
|
|
30515
|
-
|
|
30588
|
+
if (this.sheets[cmd.sheetIdTo])
|
|
30589
|
+
return 12 /* CommandResult.DuplicatedSheetId */;
|
|
30590
|
+
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo))
|
|
30591
|
+
return 11 /* CommandResult.DuplicatedSheetName */;
|
|
30592
|
+
return 0 /* CommandResult.Success */;
|
|
30516
30593
|
}
|
|
30517
30594
|
case "MOVE_SHEET":
|
|
30518
30595
|
const currentIndex = this.orderedSheetIds.indexOf(cmd.sheetId);
|
|
@@ -30598,7 +30675,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
30598
30675
|
this.showSheet(cmd.sheetId);
|
|
30599
30676
|
break;
|
|
30600
30677
|
case "DUPLICATE_SHEET":
|
|
30601
|
-
this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo);
|
|
30678
|
+
this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo, cmd.sheetNameTo);
|
|
30602
30679
|
break;
|
|
30603
30680
|
case "DELETE_SHEET":
|
|
30604
30681
|
this.deleteSheet(this.sheets[cmd.sheetId]);
|
|
@@ -30738,7 +30815,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
30738
30815
|
if (name) {
|
|
30739
30816
|
const unquotedName = getUnquotedSheetName(name);
|
|
30740
30817
|
for (const key in this.sheetIdsMapName) {
|
|
30741
|
-
if (key
|
|
30818
|
+
if (isSheetNameEqual(key, unquotedName)) {
|
|
30742
30819
|
return this.sheetIdsMapName[key];
|
|
30743
30820
|
}
|
|
30744
30821
|
}
|
|
@@ -30822,14 +30899,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
30822
30899
|
return dimension === "COL" ? this.getNumberCols(sheetId) : this.getNumberRows(sheetId);
|
|
30823
30900
|
}
|
|
30824
30901
|
getNextSheetName(baseName = "Sheet") {
|
|
30825
|
-
let i = 1;
|
|
30826
30902
|
const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
|
|
30827
|
-
|
|
30828
|
-
while (names.includes(name)) {
|
|
30829
|
-
name = `${baseName}${i}`;
|
|
30830
|
-
i++;
|
|
30831
|
-
}
|
|
30832
|
-
return name;
|
|
30903
|
+
return getNextSheetName(names, baseName);
|
|
30833
30904
|
}
|
|
30834
30905
|
getSheetSize(sheetId) {
|
|
30835
30906
|
return {
|
|
@@ -30993,7 +31064,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
30993
31064
|
checkSheetName(cmd) {
|
|
30994
31065
|
const { orderedSheetIds, sheets } = this;
|
|
30995
31066
|
const name = cmd.name && cmd.name.trim().toLowerCase();
|
|
30996
|
-
if (orderedSheetIds.find((id) => { var _a; return ((_a = sheets[id]) === null || _a === void 0 ? void 0 : _a.name
|
|
31067
|
+
if (orderedSheetIds.find((id) => { var _a; return isSheetNameEqual((_a = sheets[id]) === null || _a === void 0 ? void 0 : _a.name, name); })) {
|
|
30997
31068
|
return 11 /* CommandResult.DuplicatedSheetName */;
|
|
30998
31069
|
}
|
|
30999
31070
|
if (FORBIDDEN_IN_EXCEL_REGEX.test(name)) {
|
|
@@ -31057,9 +31128,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
31057
31128
|
showSheet(sheetId) {
|
|
31058
31129
|
this.history.update("sheets", sheetId, "isVisible", true);
|
|
31059
31130
|
}
|
|
31060
|
-
duplicateSheet(fromId, toId) {
|
|
31131
|
+
duplicateSheet(fromId, toId, toName) {
|
|
31061
31132
|
const sheet = this.getSheet(fromId);
|
|
31062
|
-
const toName = this.getDuplicateSheetName(sheet.name);
|
|
31063
31133
|
const newSheet = deepCopy(sheet);
|
|
31064
31134
|
newSheet.id = toId;
|
|
31065
31135
|
newSheet.name = toName;
|
|
@@ -31091,15 +31161,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
31091
31161
|
this.history.update("sheetIdsMapName", sheetIdsMapName);
|
|
31092
31162
|
}
|
|
31093
31163
|
getDuplicateSheetName(sheetName) {
|
|
31094
|
-
let i = 1;
|
|
31095
31164
|
const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
|
|
31096
|
-
|
|
31097
|
-
let name = baseName.toString();
|
|
31098
|
-
while (names.includes(name)) {
|
|
31099
|
-
name = `${baseName} (${i})`;
|
|
31100
|
-
i++;
|
|
31101
|
-
}
|
|
31102
|
-
return name;
|
|
31165
|
+
return getDuplicateSheetName(sheetName, names);
|
|
31103
31166
|
}
|
|
31104
31167
|
deleteSheet(sheet) {
|
|
31105
31168
|
const name = sheet.name;
|
|
@@ -31386,6 +31449,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
31386
31449
|
"getSheetZone",
|
|
31387
31450
|
"getPaneDivisions",
|
|
31388
31451
|
"checkElementsIncludeAllNonFrozenHeaders",
|
|
31452
|
+
"getDuplicateSheetName",
|
|
31389
31453
|
];
|
|
31390
31454
|
|
|
31391
31455
|
/**
|
|
@@ -35258,6 +35322,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
35258
35322
|
const { col, row } = this.getters.getNextVisibleCellPosition(cmd.sheetIdTo, 0, 0);
|
|
35259
35323
|
this.selectCell(col, row);
|
|
35260
35324
|
}
|
|
35325
|
+
const { col, row } = this.gridSelection.anchor.cell;
|
|
35326
|
+
this.moveClient({ sheetId: this.activeSheet.id, col, row });
|
|
35261
35327
|
break;
|
|
35262
35328
|
}
|
|
35263
35329
|
case "REMOVE_COLUMNS_ROWS": {
|
|
@@ -40872,7 +40938,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
40872
40938
|
if (range.sheetId === cmd.sheetId) {
|
|
40873
40939
|
return { changeType: "CHANGE", range };
|
|
40874
40940
|
}
|
|
40875
|
-
if (
|
|
40941
|
+
if (isSheetNameEqual(range.invalidSheetName, cmd.name)) {
|
|
40876
40942
|
const invalidSheetName = undefined;
|
|
40877
40943
|
const sheetId = cmd.sheetId;
|
|
40878
40944
|
const newRange = range.clone({ sheetId, invalidSheetName });
|
|
@@ -43781,9 +43847,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
43781
43847
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
43782
43848
|
|
|
43783
43849
|
|
|
43784
|
-
__info__.version = '16.0.
|
|
43785
|
-
__info__.date = '2025-
|
|
43786
|
-
__info__.hash = '
|
|
43850
|
+
__info__.version = '16.0.69';
|
|
43851
|
+
__info__.date = '2025-05-02T12:27:49.757Z';
|
|
43852
|
+
__info__.hash = '51188e8';
|
|
43787
43853
|
|
|
43788
43854
|
|
|
43789
43855
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|