@odoo/o-spreadsheet 17.0.60 → 17.0.61
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 +84 -28
- package/dist/o-spreadsheet.d.ts +4 -2
- package/dist/o-spreadsheet.esm.js +84 -28
- package/dist/o-spreadsheet.iife.js +84 -28
- package/dist/o-spreadsheet.iife.min.js +262 -262
- package/dist/o_spreadsheet.xml +4 -3
- package/package.json +1 -1
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
4
4
|
* @see https://github.com/odoo/o-spreadsheet
|
|
5
|
-
* @version 17.0.
|
|
6
|
-
* @date 2025-05-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.61
|
|
6
|
+
* @date 2025-05-12T05:21:02.159Z
|
|
7
|
+
* @hash 0368641
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -4486,6 +4486,25 @@ function moveHeaderIndexesOnHeaderDeletion(deletedHeaders, headers) {
|
|
|
4486
4486
|
})
|
|
4487
4487
|
.filter(isDefined$1);
|
|
4488
4488
|
}
|
|
4489
|
+
function getNextSheetName(existingNames, baseName = "Sheet") {
|
|
4490
|
+
let i = 1;
|
|
4491
|
+
let name = `${baseName}${i}`;
|
|
4492
|
+
while (existingNames.includes(name)) {
|
|
4493
|
+
name = `${baseName}${i}`;
|
|
4494
|
+
i++;
|
|
4495
|
+
}
|
|
4496
|
+
return name;
|
|
4497
|
+
}
|
|
4498
|
+
function getDuplicateSheetName(nameToDuplicate, existingNames) {
|
|
4499
|
+
let i = 1;
|
|
4500
|
+
const baseName = _t("Copy of %s", nameToDuplicate);
|
|
4501
|
+
let name = baseName.toString();
|
|
4502
|
+
while (existingNames.includes(name)) {
|
|
4503
|
+
name = `${baseName} (${i})`;
|
|
4504
|
+
i++;
|
|
4505
|
+
}
|
|
4506
|
+
return name;
|
|
4507
|
+
}
|
|
4489
4508
|
|
|
4490
4509
|
function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
|
|
4491
4510
|
return numberOfLines * (textLineHeight + MIN_CELL_TEXT_MARGIN) - MIN_CELL_TEXT_MARGIN;
|
|
@@ -8028,10 +8047,13 @@ const duplicateSheet = {
|
|
|
8028
8047
|
name: _t("Duplicate"),
|
|
8029
8048
|
execute: (env) => {
|
|
8030
8049
|
const sheetIdFrom = env.model.getters.getActiveSheetId();
|
|
8050
|
+
const sheetNameFrom = env.model.getters.getSheetName(sheetIdFrom);
|
|
8031
8051
|
const sheetIdTo = env.model.uuidGenerator.smallUuid();
|
|
8052
|
+
const sheetNameTo = env.model.getters.getDuplicateSheetName(sheetNameFrom);
|
|
8032
8053
|
env.model.dispatch("DUPLICATE_SHEET", {
|
|
8033
8054
|
sheetId: sheetIdFrom,
|
|
8034
8055
|
sheetIdTo,
|
|
8056
|
+
sheetNameTo,
|
|
8035
8057
|
});
|
|
8036
8058
|
env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom, sheetIdTo });
|
|
8037
8059
|
},
|
|
@@ -27149,6 +27171,13 @@ class Composer extends owl.Component {
|
|
|
27149
27171
|
this.props.onInputContextMenu?.(ev);
|
|
27150
27172
|
}
|
|
27151
27173
|
}
|
|
27174
|
+
onWheel(event) {
|
|
27175
|
+
// detect if scrollbar is available
|
|
27176
|
+
if (this.composerRef.el &&
|
|
27177
|
+
this.composerRef.el.scrollHeight > this.composerRef.el.clientHeight) {
|
|
27178
|
+
event.stopPropagation();
|
|
27179
|
+
}
|
|
27180
|
+
}
|
|
27152
27181
|
// ---------------------------------------------------------------------------
|
|
27153
27182
|
// Private
|
|
27154
27183
|
// ---------------------------------------------------------------------------
|
|
@@ -27457,12 +27486,15 @@ class GridComposer extends owl.Component {
|
|
|
27457
27486
|
});
|
|
27458
27487
|
}
|
|
27459
27488
|
get composerProps() {
|
|
27489
|
+
// Remove the wrapper border width
|
|
27490
|
+
const maxHeight = this.props.gridDims.height - this.rect.y - 2 * COMPOSER_BORDER_WIDTH;
|
|
27460
27491
|
return {
|
|
27461
27492
|
focus: this.props.focus,
|
|
27462
27493
|
isDefaultFocus: true,
|
|
27463
27494
|
onComposerContentFocused: this.props.onComposerContentFocused,
|
|
27464
27495
|
onComposerCellFocused: this.props.onComposerCellFocused,
|
|
27465
27496
|
onInputContextMenu: this.props.onInputContextMenu,
|
|
27497
|
+
inputStyle: `max-height: ${maxHeight}px;`,
|
|
27466
27498
|
};
|
|
27467
27499
|
}
|
|
27468
27500
|
get containerStyle() {
|
|
@@ -34355,6 +34387,7 @@ function repairInitialMessages(data, initialMessages) {
|
|
|
34355
34387
|
initialMessages = dropCommands(initialMessages, "SORT_CELLS");
|
|
34356
34388
|
initialMessages = dropCommands(initialMessages, "SET_DECIMAL");
|
|
34357
34389
|
initialMessages = fixChartDefinitions(data, initialMessages);
|
|
34390
|
+
initialMessages = fixTranslatedDuplicateSheetName(data, initialMessages);
|
|
34358
34391
|
return initialMessages;
|
|
34359
34392
|
}
|
|
34360
34393
|
/**
|
|
@@ -34474,6 +34507,40 @@ function fixOverlappingFilters(data) {
|
|
|
34474
34507
|
}
|
|
34475
34508
|
return data;
|
|
34476
34509
|
}
|
|
34510
|
+
function fixTranslatedDuplicateSheetName(data, initialMessages) {
|
|
34511
|
+
const sheetNames = {};
|
|
34512
|
+
for (const sheet of data.sheets || []) {
|
|
34513
|
+
sheetNames[sheet.id] = sheet.name;
|
|
34514
|
+
}
|
|
34515
|
+
const messages = [];
|
|
34516
|
+
for (const message of initialMessages) {
|
|
34517
|
+
if (message.type === "REMOTE_REVISION") {
|
|
34518
|
+
const commands = [];
|
|
34519
|
+
for (const cmd of message.commands) {
|
|
34520
|
+
switch (cmd.type) {
|
|
34521
|
+
case "DUPLICATE_SHEET":
|
|
34522
|
+
cmd.sheetNameTo =
|
|
34523
|
+
cmd.sheetNameTo ??
|
|
34524
|
+
getDuplicateSheetName(sheetNames[cmd.sheetId], Object.values(sheetNames));
|
|
34525
|
+
break;
|
|
34526
|
+
case "CREATE_SHEET":
|
|
34527
|
+
case "RENAME_SHEET":
|
|
34528
|
+
sheetNames[cmd.sheetId] = cmd.name || getNextSheetName(Object.values(sheetNames));
|
|
34529
|
+
break;
|
|
34530
|
+
}
|
|
34531
|
+
commands.push(cmd);
|
|
34532
|
+
}
|
|
34533
|
+
messages.push({
|
|
34534
|
+
...message,
|
|
34535
|
+
commands,
|
|
34536
|
+
});
|
|
34537
|
+
}
|
|
34538
|
+
else {
|
|
34539
|
+
messages.push(message);
|
|
34540
|
+
}
|
|
34541
|
+
}
|
|
34542
|
+
return initialMessages;
|
|
34543
|
+
}
|
|
34477
34544
|
// -----------------------------------------------------------------------------
|
|
34478
34545
|
// Helpers
|
|
34479
34546
|
// -----------------------------------------------------------------------------
|
|
@@ -36704,9 +36771,7 @@ class ChartPlugin extends CorePlugin {
|
|
|
36704
36771
|
: "Success" /* CommandResult.Success */;
|
|
36705
36772
|
}
|
|
36706
36773
|
checkChartExists(cmd) {
|
|
36707
|
-
return this.
|
|
36708
|
-
? "Success" /* CommandResult.Success */
|
|
36709
|
-
: "ChartDoesNotExist" /* CommandResult.ChartDoesNotExist */;
|
|
36774
|
+
return this.isChartDefined(cmd.id) ? "Success" /* CommandResult.Success */ : "ChartDoesNotExist" /* CommandResult.ChartDoesNotExist */;
|
|
36710
36775
|
}
|
|
36711
36776
|
}
|
|
36712
36777
|
|
|
@@ -39505,6 +39570,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
39505
39570
|
"getCommandZones",
|
|
39506
39571
|
"getUnboundedZone",
|
|
39507
39572
|
"checkElementsIncludeAllNonFrozenHeaders",
|
|
39573
|
+
"getDuplicateSheetName",
|
|
39508
39574
|
];
|
|
39509
39575
|
sheetIdsMapName = {};
|
|
39510
39576
|
orderedSheetIds = [];
|
|
@@ -39529,7 +39595,11 @@ class SheetPlugin extends CorePlugin {
|
|
|
39529
39595
|
return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
|
|
39530
39596
|
}
|
|
39531
39597
|
case "DUPLICATE_SHEET": {
|
|
39532
|
-
|
|
39598
|
+
if (this.sheets[cmd.sheetIdTo])
|
|
39599
|
+
return "DuplicatedSheetId" /* CommandResult.DuplicatedSheetId */;
|
|
39600
|
+
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo))
|
|
39601
|
+
return "DuplicatedSheetName" /* CommandResult.DuplicatedSheetName */;
|
|
39602
|
+
return "Success" /* CommandResult.Success */;
|
|
39533
39603
|
}
|
|
39534
39604
|
case "MOVE_SHEET":
|
|
39535
39605
|
try {
|
|
@@ -39602,7 +39672,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
39602
39672
|
this.showSheet(cmd.sheetId);
|
|
39603
39673
|
break;
|
|
39604
39674
|
case "DUPLICATE_SHEET":
|
|
39605
|
-
this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo);
|
|
39675
|
+
this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo, cmd.sheetNameTo);
|
|
39606
39676
|
break;
|
|
39607
39677
|
case "DELETE_SHEET":
|
|
39608
39678
|
this.deleteSheet(this.sheets[cmd.sheetId]);
|
|
@@ -39812,14 +39882,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
39812
39882
|
return dimension === "COL" ? this.getNumberCols(sheetId) : this.getNumberRows(sheetId);
|
|
39813
39883
|
}
|
|
39814
39884
|
getNextSheetName(baseName = "Sheet") {
|
|
39815
|
-
let i = 1;
|
|
39816
39885
|
const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
|
|
39817
|
-
|
|
39818
|
-
while (names.includes(name)) {
|
|
39819
|
-
name = `${baseName}${i}`;
|
|
39820
|
-
i++;
|
|
39821
|
-
}
|
|
39822
|
-
return name;
|
|
39886
|
+
return getNextSheetName(names, baseName);
|
|
39823
39887
|
}
|
|
39824
39888
|
getSheetSize(sheetId) {
|
|
39825
39889
|
return {
|
|
@@ -40079,9 +40143,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
40079
40143
|
showSheet(sheetId) {
|
|
40080
40144
|
this.history.update("sheets", sheetId, "isVisible", true);
|
|
40081
40145
|
}
|
|
40082
|
-
duplicateSheet(fromId, toId) {
|
|
40146
|
+
duplicateSheet(fromId, toId, toName) {
|
|
40083
40147
|
const sheet = this.getSheet(fromId);
|
|
40084
|
-
const toName = this.getDuplicateSheetName(sheet.name);
|
|
40085
40148
|
const newSheet = deepCopy(sheet);
|
|
40086
40149
|
newSheet.id = toId;
|
|
40087
40150
|
newSheet.name = toName;
|
|
@@ -40113,15 +40176,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
40113
40176
|
this.history.update("sheetIdsMapName", sheetIdsMapName);
|
|
40114
40177
|
}
|
|
40115
40178
|
getDuplicateSheetName(sheetName) {
|
|
40116
|
-
let i = 1;
|
|
40117
40179
|
const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
|
|
40118
|
-
|
|
40119
|
-
let name = baseName.toString();
|
|
40120
|
-
while (names.includes(name)) {
|
|
40121
|
-
name = `${baseName} (${i})`;
|
|
40122
|
-
i++;
|
|
40123
|
-
}
|
|
40124
|
-
return name;
|
|
40180
|
+
return getDuplicateSheetName(sheetName, names);
|
|
40125
40181
|
}
|
|
40126
40182
|
deleteSheet(sheet) {
|
|
40127
40183
|
const name = sheet.name;
|
|
@@ -58252,6 +58308,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
58252
58308
|
exports.tokenize = tokenize;
|
|
58253
58309
|
|
|
58254
58310
|
|
|
58255
|
-
__info__.version = "17.0.
|
|
58256
|
-
__info__.date = "2025-05-
|
|
58257
|
-
__info__.hash = "
|
|
58311
|
+
__info__.version = "17.0.61";
|
|
58312
|
+
__info__.date = "2025-05-12T05:21:02.159Z";
|
|
58313
|
+
__info__.hash = "0368641";
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -1892,6 +1892,7 @@ interface DeleteSheetCommand extends SheetDependentCommand {
|
|
|
1892
1892
|
interface DuplicateSheetCommand extends SheetDependentCommand {
|
|
1893
1893
|
type: "DUPLICATE_SHEET";
|
|
1894
1894
|
sheetIdTo: UID;
|
|
1895
|
+
sheetNameTo: string;
|
|
1895
1896
|
}
|
|
1896
1897
|
interface MoveSheetCommand extends SheetDependentCommand {
|
|
1897
1898
|
type: "MOVE_SHEET";
|
|
@@ -4030,7 +4031,7 @@ interface SheetState {
|
|
|
4030
4031
|
readonly cellPosition: Record<UID, CellPosition | undefined>;
|
|
4031
4032
|
}
|
|
4032
4033
|
declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
|
|
4033
|
-
static getters: readonly ["getSheetName", "tryGetSheetName", "getSheet", "tryGetSheet", "getSheetIdByName", "getSheetIds", "getVisibleSheetIds", "isSheetVisible", "getEvaluationSheets", "doesHeaderExist", "doesHeadersExist", "getCell", "getCellPosition", "getColsZone", "getRowCells", "getRowsZone", "getNumberCols", "getNumberRows", "getNumberHeaders", "getGridLinesVisibility", "getNextSheetName", "getSheetSize", "getSheetZone", "getPaneDivisions", "checkZonesExistInSheet", "getCommandZones", "getUnboundedZone", "checkElementsIncludeAllNonFrozenHeaders"];
|
|
4034
|
+
static getters: readonly ["getSheetName", "tryGetSheetName", "getSheet", "tryGetSheet", "getSheetIdByName", "getSheetIds", "getVisibleSheetIds", "isSheetVisible", "getEvaluationSheets", "doesHeaderExist", "doesHeadersExist", "getCell", "getCellPosition", "getColsZone", "getRowCells", "getRowsZone", "getNumberCols", "getNumberRows", "getNumberHeaders", "getGridLinesVisibility", "getNextSheetName", "getSheetSize", "getSheetZone", "getPaneDivisions", "checkZonesExistInSheet", "getCommandZones", "getUnboundedZone", "checkElementsIncludeAllNonFrozenHeaders", "getDuplicateSheetName"];
|
|
4034
4035
|
readonly sheetIdsMapName: Record<string, UID | undefined>;
|
|
4035
4036
|
readonly orderedSheetIds: UID[];
|
|
4036
4037
|
readonly sheets: Record<UID, Sheet | undefined>;
|
|
@@ -4110,7 +4111,7 @@ declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
|
|
|
4110
4111
|
private hideSheet;
|
|
4111
4112
|
private showSheet;
|
|
4112
4113
|
private duplicateSheet;
|
|
4113
|
-
|
|
4114
|
+
getDuplicateSheetName(sheetName: string): string;
|
|
4114
4115
|
private deleteSheet;
|
|
4115
4116
|
/**
|
|
4116
4117
|
* Delete column. This requires a lot of handling:
|
|
@@ -7342,6 +7343,7 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
|
|
|
7342
7343
|
onClick(): void;
|
|
7343
7344
|
onDblClick(): void;
|
|
7344
7345
|
onContextMenu(ev: MouseEvent): void;
|
|
7346
|
+
onWheel(event: WheelEvent): void;
|
|
7345
7347
|
private processContent;
|
|
7346
7348
|
/**
|
|
7347
7349
|
* Get the HTML content corresponding to the current composer token, divided by lines.
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
4
4
|
* @see https://github.com/odoo/o-spreadsheet
|
|
5
|
-
* @version 17.0.
|
|
6
|
-
* @date 2025-05-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.61
|
|
6
|
+
* @date 2025-05-12T05:21:02.159Z
|
|
7
|
+
* @hash 0368641
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { Component, useRef, onMounted, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillUnmount, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
|
|
@@ -4484,6 +4484,25 @@ function moveHeaderIndexesOnHeaderDeletion(deletedHeaders, headers) {
|
|
|
4484
4484
|
})
|
|
4485
4485
|
.filter(isDefined$1);
|
|
4486
4486
|
}
|
|
4487
|
+
function getNextSheetName(existingNames, baseName = "Sheet") {
|
|
4488
|
+
let i = 1;
|
|
4489
|
+
let name = `${baseName}${i}`;
|
|
4490
|
+
while (existingNames.includes(name)) {
|
|
4491
|
+
name = `${baseName}${i}`;
|
|
4492
|
+
i++;
|
|
4493
|
+
}
|
|
4494
|
+
return name;
|
|
4495
|
+
}
|
|
4496
|
+
function getDuplicateSheetName(nameToDuplicate, existingNames) {
|
|
4497
|
+
let i = 1;
|
|
4498
|
+
const baseName = _t("Copy of %s", nameToDuplicate);
|
|
4499
|
+
let name = baseName.toString();
|
|
4500
|
+
while (existingNames.includes(name)) {
|
|
4501
|
+
name = `${baseName} (${i})`;
|
|
4502
|
+
i++;
|
|
4503
|
+
}
|
|
4504
|
+
return name;
|
|
4505
|
+
}
|
|
4487
4506
|
|
|
4488
4507
|
function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
|
|
4489
4508
|
return numberOfLines * (textLineHeight + MIN_CELL_TEXT_MARGIN) - MIN_CELL_TEXT_MARGIN;
|
|
@@ -8026,10 +8045,13 @@ const duplicateSheet = {
|
|
|
8026
8045
|
name: _t("Duplicate"),
|
|
8027
8046
|
execute: (env) => {
|
|
8028
8047
|
const sheetIdFrom = env.model.getters.getActiveSheetId();
|
|
8048
|
+
const sheetNameFrom = env.model.getters.getSheetName(sheetIdFrom);
|
|
8029
8049
|
const sheetIdTo = env.model.uuidGenerator.smallUuid();
|
|
8050
|
+
const sheetNameTo = env.model.getters.getDuplicateSheetName(sheetNameFrom);
|
|
8030
8051
|
env.model.dispatch("DUPLICATE_SHEET", {
|
|
8031
8052
|
sheetId: sheetIdFrom,
|
|
8032
8053
|
sheetIdTo,
|
|
8054
|
+
sheetNameTo,
|
|
8033
8055
|
});
|
|
8034
8056
|
env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom, sheetIdTo });
|
|
8035
8057
|
},
|
|
@@ -27147,6 +27169,13 @@ class Composer extends Component {
|
|
|
27147
27169
|
this.props.onInputContextMenu?.(ev);
|
|
27148
27170
|
}
|
|
27149
27171
|
}
|
|
27172
|
+
onWheel(event) {
|
|
27173
|
+
// detect if scrollbar is available
|
|
27174
|
+
if (this.composerRef.el &&
|
|
27175
|
+
this.composerRef.el.scrollHeight > this.composerRef.el.clientHeight) {
|
|
27176
|
+
event.stopPropagation();
|
|
27177
|
+
}
|
|
27178
|
+
}
|
|
27150
27179
|
// ---------------------------------------------------------------------------
|
|
27151
27180
|
// Private
|
|
27152
27181
|
// ---------------------------------------------------------------------------
|
|
@@ -27455,12 +27484,15 @@ class GridComposer extends Component {
|
|
|
27455
27484
|
});
|
|
27456
27485
|
}
|
|
27457
27486
|
get composerProps() {
|
|
27487
|
+
// Remove the wrapper border width
|
|
27488
|
+
const maxHeight = this.props.gridDims.height - this.rect.y - 2 * COMPOSER_BORDER_WIDTH;
|
|
27458
27489
|
return {
|
|
27459
27490
|
focus: this.props.focus,
|
|
27460
27491
|
isDefaultFocus: true,
|
|
27461
27492
|
onComposerContentFocused: this.props.onComposerContentFocused,
|
|
27462
27493
|
onComposerCellFocused: this.props.onComposerCellFocused,
|
|
27463
27494
|
onInputContextMenu: this.props.onInputContextMenu,
|
|
27495
|
+
inputStyle: `max-height: ${maxHeight}px;`,
|
|
27464
27496
|
};
|
|
27465
27497
|
}
|
|
27466
27498
|
get containerStyle() {
|
|
@@ -34353,6 +34385,7 @@ function repairInitialMessages(data, initialMessages) {
|
|
|
34353
34385
|
initialMessages = dropCommands(initialMessages, "SORT_CELLS");
|
|
34354
34386
|
initialMessages = dropCommands(initialMessages, "SET_DECIMAL");
|
|
34355
34387
|
initialMessages = fixChartDefinitions(data, initialMessages);
|
|
34388
|
+
initialMessages = fixTranslatedDuplicateSheetName(data, initialMessages);
|
|
34356
34389
|
return initialMessages;
|
|
34357
34390
|
}
|
|
34358
34391
|
/**
|
|
@@ -34472,6 +34505,40 @@ function fixOverlappingFilters(data) {
|
|
|
34472
34505
|
}
|
|
34473
34506
|
return data;
|
|
34474
34507
|
}
|
|
34508
|
+
function fixTranslatedDuplicateSheetName(data, initialMessages) {
|
|
34509
|
+
const sheetNames = {};
|
|
34510
|
+
for (const sheet of data.sheets || []) {
|
|
34511
|
+
sheetNames[sheet.id] = sheet.name;
|
|
34512
|
+
}
|
|
34513
|
+
const messages = [];
|
|
34514
|
+
for (const message of initialMessages) {
|
|
34515
|
+
if (message.type === "REMOTE_REVISION") {
|
|
34516
|
+
const commands = [];
|
|
34517
|
+
for (const cmd of message.commands) {
|
|
34518
|
+
switch (cmd.type) {
|
|
34519
|
+
case "DUPLICATE_SHEET":
|
|
34520
|
+
cmd.sheetNameTo =
|
|
34521
|
+
cmd.sheetNameTo ??
|
|
34522
|
+
getDuplicateSheetName(sheetNames[cmd.sheetId], Object.values(sheetNames));
|
|
34523
|
+
break;
|
|
34524
|
+
case "CREATE_SHEET":
|
|
34525
|
+
case "RENAME_SHEET":
|
|
34526
|
+
sheetNames[cmd.sheetId] = cmd.name || getNextSheetName(Object.values(sheetNames));
|
|
34527
|
+
break;
|
|
34528
|
+
}
|
|
34529
|
+
commands.push(cmd);
|
|
34530
|
+
}
|
|
34531
|
+
messages.push({
|
|
34532
|
+
...message,
|
|
34533
|
+
commands,
|
|
34534
|
+
});
|
|
34535
|
+
}
|
|
34536
|
+
else {
|
|
34537
|
+
messages.push(message);
|
|
34538
|
+
}
|
|
34539
|
+
}
|
|
34540
|
+
return initialMessages;
|
|
34541
|
+
}
|
|
34475
34542
|
// -----------------------------------------------------------------------------
|
|
34476
34543
|
// Helpers
|
|
34477
34544
|
// -----------------------------------------------------------------------------
|
|
@@ -36702,9 +36769,7 @@ class ChartPlugin extends CorePlugin {
|
|
|
36702
36769
|
: "Success" /* CommandResult.Success */;
|
|
36703
36770
|
}
|
|
36704
36771
|
checkChartExists(cmd) {
|
|
36705
|
-
return this.
|
|
36706
|
-
? "Success" /* CommandResult.Success */
|
|
36707
|
-
: "ChartDoesNotExist" /* CommandResult.ChartDoesNotExist */;
|
|
36772
|
+
return this.isChartDefined(cmd.id) ? "Success" /* CommandResult.Success */ : "ChartDoesNotExist" /* CommandResult.ChartDoesNotExist */;
|
|
36708
36773
|
}
|
|
36709
36774
|
}
|
|
36710
36775
|
|
|
@@ -39503,6 +39568,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
39503
39568
|
"getCommandZones",
|
|
39504
39569
|
"getUnboundedZone",
|
|
39505
39570
|
"checkElementsIncludeAllNonFrozenHeaders",
|
|
39571
|
+
"getDuplicateSheetName",
|
|
39506
39572
|
];
|
|
39507
39573
|
sheetIdsMapName = {};
|
|
39508
39574
|
orderedSheetIds = [];
|
|
@@ -39527,7 +39593,11 @@ class SheetPlugin extends CorePlugin {
|
|
|
39527
39593
|
return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
|
|
39528
39594
|
}
|
|
39529
39595
|
case "DUPLICATE_SHEET": {
|
|
39530
|
-
|
|
39596
|
+
if (this.sheets[cmd.sheetIdTo])
|
|
39597
|
+
return "DuplicatedSheetId" /* CommandResult.DuplicatedSheetId */;
|
|
39598
|
+
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo))
|
|
39599
|
+
return "DuplicatedSheetName" /* CommandResult.DuplicatedSheetName */;
|
|
39600
|
+
return "Success" /* CommandResult.Success */;
|
|
39531
39601
|
}
|
|
39532
39602
|
case "MOVE_SHEET":
|
|
39533
39603
|
try {
|
|
@@ -39600,7 +39670,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
39600
39670
|
this.showSheet(cmd.sheetId);
|
|
39601
39671
|
break;
|
|
39602
39672
|
case "DUPLICATE_SHEET":
|
|
39603
|
-
this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo);
|
|
39673
|
+
this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo, cmd.sheetNameTo);
|
|
39604
39674
|
break;
|
|
39605
39675
|
case "DELETE_SHEET":
|
|
39606
39676
|
this.deleteSheet(this.sheets[cmd.sheetId]);
|
|
@@ -39810,14 +39880,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
39810
39880
|
return dimension === "COL" ? this.getNumberCols(sheetId) : this.getNumberRows(sheetId);
|
|
39811
39881
|
}
|
|
39812
39882
|
getNextSheetName(baseName = "Sheet") {
|
|
39813
|
-
let i = 1;
|
|
39814
39883
|
const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
|
|
39815
|
-
|
|
39816
|
-
while (names.includes(name)) {
|
|
39817
|
-
name = `${baseName}${i}`;
|
|
39818
|
-
i++;
|
|
39819
|
-
}
|
|
39820
|
-
return name;
|
|
39884
|
+
return getNextSheetName(names, baseName);
|
|
39821
39885
|
}
|
|
39822
39886
|
getSheetSize(sheetId) {
|
|
39823
39887
|
return {
|
|
@@ -40077,9 +40141,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
40077
40141
|
showSheet(sheetId) {
|
|
40078
40142
|
this.history.update("sheets", sheetId, "isVisible", true);
|
|
40079
40143
|
}
|
|
40080
|
-
duplicateSheet(fromId, toId) {
|
|
40144
|
+
duplicateSheet(fromId, toId, toName) {
|
|
40081
40145
|
const sheet = this.getSheet(fromId);
|
|
40082
|
-
const toName = this.getDuplicateSheetName(sheet.name);
|
|
40083
40146
|
const newSheet = deepCopy(sheet);
|
|
40084
40147
|
newSheet.id = toId;
|
|
40085
40148
|
newSheet.name = toName;
|
|
@@ -40111,15 +40174,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
40111
40174
|
this.history.update("sheetIdsMapName", sheetIdsMapName);
|
|
40112
40175
|
}
|
|
40113
40176
|
getDuplicateSheetName(sheetName) {
|
|
40114
|
-
let i = 1;
|
|
40115
40177
|
const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
|
|
40116
|
-
|
|
40117
|
-
let name = baseName.toString();
|
|
40118
|
-
while (names.includes(name)) {
|
|
40119
|
-
name = `${baseName} (${i})`;
|
|
40120
|
-
i++;
|
|
40121
|
-
}
|
|
40122
|
-
return name;
|
|
40178
|
+
return getDuplicateSheetName(sheetName, names);
|
|
40123
40179
|
}
|
|
40124
40180
|
deleteSheet(sheet) {
|
|
40125
40181
|
const name = sheet.name;
|
|
@@ -58215,6 +58271,6 @@ const constants = {
|
|
|
58215
58271
|
export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
|
|
58216
58272
|
|
|
58217
58273
|
|
|
58218
|
-
__info__.version = "17.0.
|
|
58219
|
-
__info__.date = "2025-05-
|
|
58220
|
-
__info__.hash = "
|
|
58274
|
+
__info__.version = "17.0.61";
|
|
58275
|
+
__info__.date = "2025-05-12T05:21:02.159Z";
|
|
58276
|
+
__info__.hash = "0368641";
|