@odoo/o-spreadsheet 16.0.68 → 16.0.70

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.
@@ -2380,6 +2380,25 @@ function isSheetNameEqual(name1, name2) {
2380
2380
  }
2381
2381
  return (getUnquotedSheetName(name1.trim().toUpperCase()) ===
2382
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;
2383
2402
  }
2384
2403
 
2385
2404
  /*
@@ -6088,10 +6107,13 @@ sheetMenuRegistry
6088
6107
  sequence: 20,
6089
6108
  action: (env) => {
6090
6109
  const sheetIdFrom = env.model.getters.getActiveSheetId();
6110
+ const sheetNameFrom = env.model.getters.getSheetName(sheetIdFrom);
6091
6111
  const sheetIdTo = env.model.uuidGenerator.smallUuid();
6112
+ const sheetNameTo = env.model.getters.getDuplicateSheetName(sheetNameFrom);
6092
6113
  env.model.dispatch("DUPLICATE_SHEET", {
6093
6114
  sheetId: sheetIdFrom,
6094
6115
  sheetIdTo,
6116
+ sheetNameTo,
6095
6117
  });
6096
6118
  env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom, sheetIdTo });
6097
6119
  },
@@ -22151,7 +22173,7 @@ css /* scss */ `
22151
22173
  position: absolute;
22152
22174
  top: 0;
22153
22175
  left: ${HEADER_WIDTH}px;
22154
- right: 0;
22176
+ right: ${SCROLLBAR_WIDTH}px;
22155
22177
  height: ${HEADER_HEIGHT}px;
22156
22178
  &.o-dragging {
22157
22179
  cursor: grabbing;
@@ -22322,9 +22344,8 @@ css /* scss */ `
22322
22344
  position: absolute;
22323
22345
  top: ${HEADER_HEIGHT}px;
22324
22346
  left: 0;
22325
- right: 0;
22347
+ bottom: ${SCROLLBAR_WIDTH}px;
22326
22348
  width: ${HEADER_WIDTH}px;
22327
- height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH}px);
22328
22349
  &.o-dragging {
22329
22350
  cursor: grabbing;
22330
22351
  }
@@ -27440,6 +27461,7 @@ function repairInitialMessages(data, initialMessages) {
27440
27461
  initialMessages = dropCommands(initialMessages, "SORT_CELLS");
27441
27462
  initialMessages = dropCommands(initialMessages, "SET_DECIMAL");
27442
27463
  initialMessages = fixChartDefinitions(data, initialMessages);
27464
+ initialMessages = fixTranslatedDuplicateSheetName(data, initialMessages);
27443
27465
  return initialMessages;
27444
27466
  }
27445
27467
  /**
@@ -27540,6 +27562,40 @@ function fixChartDefinitions(data, initialMessages) {
27540
27562
  }
27541
27563
  return messages;
27542
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
+ }
27543
27599
  // -----------------------------------------------------------------------------
27544
27600
  // Helpers
27545
27601
  // -----------------------------------------------------------------------------
@@ -28792,9 +28848,7 @@ class ChartPlugin extends CorePlugin {
28792
28848
  : 0 /* CommandResult.Success */;
28793
28849
  }
28794
28850
  checkChartExists(cmd) {
28795
- return this.getters.getFigureSheetId(cmd.id)
28796
- ? 0 /* CommandResult.Success */
28797
- : 86 /* CommandResult.ChartDoesNotExist */;
28851
+ return this.isChartDefined(cmd.id) ? 0 /* CommandResult.Success */ : 86 /* CommandResult.ChartDoesNotExist */;
28798
28852
  }
28799
28853
  }
28800
28854
  ChartPlugin.getters = [
@@ -30532,7 +30586,11 @@ class SheetPlugin extends CorePlugin {
30532
30586
  return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
30533
30587
  }
30534
30588
  case "DUPLICATE_SHEET": {
30535
- return this.sheets[cmd.sheetIdTo] ? 12 /* CommandResult.DuplicatedSheetId */ : 0 /* CommandResult.Success */;
30589
+ if (this.sheets[cmd.sheetIdTo])
30590
+ return 12 /* CommandResult.DuplicatedSheetId */;
30591
+ if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo))
30592
+ return 11 /* CommandResult.DuplicatedSheetName */;
30593
+ return 0 /* CommandResult.Success */;
30536
30594
  }
30537
30595
  case "MOVE_SHEET":
30538
30596
  const currentIndex = this.orderedSheetIds.indexOf(cmd.sheetId);
@@ -30618,7 +30676,7 @@ class SheetPlugin extends CorePlugin {
30618
30676
  this.showSheet(cmd.sheetId);
30619
30677
  break;
30620
30678
  case "DUPLICATE_SHEET":
30621
- this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo);
30679
+ this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo, cmd.sheetNameTo);
30622
30680
  break;
30623
30681
  case "DELETE_SHEET":
30624
30682
  this.deleteSheet(this.sheets[cmd.sheetId]);
@@ -30842,14 +30900,8 @@ class SheetPlugin extends CorePlugin {
30842
30900
  return dimension === "COL" ? this.getNumberCols(sheetId) : this.getNumberRows(sheetId);
30843
30901
  }
30844
30902
  getNextSheetName(baseName = "Sheet") {
30845
- let i = 1;
30846
30903
  const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
30847
- let name = `${baseName}${i}`;
30848
- while (names.includes(name)) {
30849
- name = `${baseName}${i}`;
30850
- i++;
30851
- }
30852
- return name;
30904
+ return getNextSheetName(names, baseName);
30853
30905
  }
30854
30906
  getSheetSize(sheetId) {
30855
30907
  return {
@@ -31077,9 +31129,8 @@ class SheetPlugin extends CorePlugin {
31077
31129
  showSheet(sheetId) {
31078
31130
  this.history.update("sheets", sheetId, "isVisible", true);
31079
31131
  }
31080
- duplicateSheet(fromId, toId) {
31132
+ duplicateSheet(fromId, toId, toName) {
31081
31133
  const sheet = this.getSheet(fromId);
31082
- const toName = this.getDuplicateSheetName(sheet.name);
31083
31134
  const newSheet = deepCopy(sheet);
31084
31135
  newSheet.id = toId;
31085
31136
  newSheet.name = toName;
@@ -31111,15 +31162,8 @@ class SheetPlugin extends CorePlugin {
31111
31162
  this.history.update("sheetIdsMapName", sheetIdsMapName);
31112
31163
  }
31113
31164
  getDuplicateSheetName(sheetName) {
31114
- let i = 1;
31115
31165
  const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
31116
- const baseName = _lt("Copy of %s", sheetName);
31117
- let name = baseName.toString();
31118
- while (names.includes(name)) {
31119
- name = `${baseName} (${i})`;
31120
- i++;
31121
- }
31122
- return name;
31166
+ return getDuplicateSheetName(sheetName, names);
31123
31167
  }
31124
31168
  deleteSheet(sheet) {
31125
31169
  const name = sheet.name;
@@ -31406,6 +31450,7 @@ SheetPlugin.getters = [
31406
31450
  "getSheetZone",
31407
31451
  "getPaneDivisions",
31408
31452
  "checkElementsIncludeAllNonFrozenHeaders",
31453
+ "getDuplicateSheetName",
31409
31454
  ];
31410
31455
 
31411
31456
  /**
@@ -43801,6 +43846,6 @@ exports.setTranslationMethod = setTranslationMethod;
43801
43846
  exports.tokenize = tokenize;
43802
43847
 
43803
43848
 
43804
- __info__.version = '16.0.68';
43805
- __info__.date = '2025-04-25T08:02:52.716Z';
43806
- __info__.hash = '682d48e';
43849
+ __info__.version = '16.0.70';
43850
+ __info__.date = '2025-05-12T05:19:22.493Z';
43851
+ __info__.hash = 'bbdc034';
@@ -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
- private getDuplicateSheetName;
3649
+ getDuplicateSheetName(sheetName: string): string;
3649
3650
  private deleteSheet;
3650
3651
  /**
3651
3652
  * Delete column. This requires a lot of handling:
@@ -2376,6 +2376,25 @@ function isSheetNameEqual(name1, name2) {
2376
2376
  }
2377
2377
  return (getUnquotedSheetName(name1.trim().toUpperCase()) ===
2378
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;
2379
2398
  }
2380
2399
 
2381
2400
  /*
@@ -6084,10 +6103,13 @@ sheetMenuRegistry
6084
6103
  sequence: 20,
6085
6104
  action: (env) => {
6086
6105
  const sheetIdFrom = env.model.getters.getActiveSheetId();
6106
+ const sheetNameFrom = env.model.getters.getSheetName(sheetIdFrom);
6087
6107
  const sheetIdTo = env.model.uuidGenerator.smallUuid();
6108
+ const sheetNameTo = env.model.getters.getDuplicateSheetName(sheetNameFrom);
6088
6109
  env.model.dispatch("DUPLICATE_SHEET", {
6089
6110
  sheetId: sheetIdFrom,
6090
6111
  sheetIdTo,
6112
+ sheetNameTo,
6091
6113
  });
6092
6114
  env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom, sheetIdTo });
6093
6115
  },
@@ -22147,7 +22169,7 @@ css /* scss */ `
22147
22169
  position: absolute;
22148
22170
  top: 0;
22149
22171
  left: ${HEADER_WIDTH}px;
22150
- right: 0;
22172
+ right: ${SCROLLBAR_WIDTH}px;
22151
22173
  height: ${HEADER_HEIGHT}px;
22152
22174
  &.o-dragging {
22153
22175
  cursor: grabbing;
@@ -22318,9 +22340,8 @@ css /* scss */ `
22318
22340
  position: absolute;
22319
22341
  top: ${HEADER_HEIGHT}px;
22320
22342
  left: 0;
22321
- right: 0;
22343
+ bottom: ${SCROLLBAR_WIDTH}px;
22322
22344
  width: ${HEADER_WIDTH}px;
22323
- height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH}px);
22324
22345
  &.o-dragging {
22325
22346
  cursor: grabbing;
22326
22347
  }
@@ -27436,6 +27457,7 @@ function repairInitialMessages(data, initialMessages) {
27436
27457
  initialMessages = dropCommands(initialMessages, "SORT_CELLS");
27437
27458
  initialMessages = dropCommands(initialMessages, "SET_DECIMAL");
27438
27459
  initialMessages = fixChartDefinitions(data, initialMessages);
27460
+ initialMessages = fixTranslatedDuplicateSheetName(data, initialMessages);
27439
27461
  return initialMessages;
27440
27462
  }
27441
27463
  /**
@@ -27536,6 +27558,40 @@ function fixChartDefinitions(data, initialMessages) {
27536
27558
  }
27537
27559
  return messages;
27538
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
+ }
27539
27595
  // -----------------------------------------------------------------------------
27540
27596
  // Helpers
27541
27597
  // -----------------------------------------------------------------------------
@@ -28788,9 +28844,7 @@ class ChartPlugin extends CorePlugin {
28788
28844
  : 0 /* CommandResult.Success */;
28789
28845
  }
28790
28846
  checkChartExists(cmd) {
28791
- return this.getters.getFigureSheetId(cmd.id)
28792
- ? 0 /* CommandResult.Success */
28793
- : 86 /* CommandResult.ChartDoesNotExist */;
28847
+ return this.isChartDefined(cmd.id) ? 0 /* CommandResult.Success */ : 86 /* CommandResult.ChartDoesNotExist */;
28794
28848
  }
28795
28849
  }
28796
28850
  ChartPlugin.getters = [
@@ -30528,7 +30582,11 @@ class SheetPlugin extends CorePlugin {
30528
30582
  return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
30529
30583
  }
30530
30584
  case "DUPLICATE_SHEET": {
30531
- return this.sheets[cmd.sheetIdTo] ? 12 /* CommandResult.DuplicatedSheetId */ : 0 /* CommandResult.Success */;
30585
+ if (this.sheets[cmd.sheetIdTo])
30586
+ return 12 /* CommandResult.DuplicatedSheetId */;
30587
+ if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo))
30588
+ return 11 /* CommandResult.DuplicatedSheetName */;
30589
+ return 0 /* CommandResult.Success */;
30532
30590
  }
30533
30591
  case "MOVE_SHEET":
30534
30592
  const currentIndex = this.orderedSheetIds.indexOf(cmd.sheetId);
@@ -30614,7 +30672,7 @@ class SheetPlugin extends CorePlugin {
30614
30672
  this.showSheet(cmd.sheetId);
30615
30673
  break;
30616
30674
  case "DUPLICATE_SHEET":
30617
- this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo);
30675
+ this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo, cmd.sheetNameTo);
30618
30676
  break;
30619
30677
  case "DELETE_SHEET":
30620
30678
  this.deleteSheet(this.sheets[cmd.sheetId]);
@@ -30838,14 +30896,8 @@ class SheetPlugin extends CorePlugin {
30838
30896
  return dimension === "COL" ? this.getNumberCols(sheetId) : this.getNumberRows(sheetId);
30839
30897
  }
30840
30898
  getNextSheetName(baseName = "Sheet") {
30841
- let i = 1;
30842
30899
  const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
30843
- let name = `${baseName}${i}`;
30844
- while (names.includes(name)) {
30845
- name = `${baseName}${i}`;
30846
- i++;
30847
- }
30848
- return name;
30900
+ return getNextSheetName(names, baseName);
30849
30901
  }
30850
30902
  getSheetSize(sheetId) {
30851
30903
  return {
@@ -31073,9 +31125,8 @@ class SheetPlugin extends CorePlugin {
31073
31125
  showSheet(sheetId) {
31074
31126
  this.history.update("sheets", sheetId, "isVisible", true);
31075
31127
  }
31076
- duplicateSheet(fromId, toId) {
31128
+ duplicateSheet(fromId, toId, toName) {
31077
31129
  const sheet = this.getSheet(fromId);
31078
- const toName = this.getDuplicateSheetName(sheet.name);
31079
31130
  const newSheet = deepCopy(sheet);
31080
31131
  newSheet.id = toId;
31081
31132
  newSheet.name = toName;
@@ -31107,15 +31158,8 @@ class SheetPlugin extends CorePlugin {
31107
31158
  this.history.update("sheetIdsMapName", sheetIdsMapName);
31108
31159
  }
31109
31160
  getDuplicateSheetName(sheetName) {
31110
- let i = 1;
31111
31161
  const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
31112
- const baseName = _lt("Copy of %s", sheetName);
31113
- let name = baseName.toString();
31114
- while (names.includes(name)) {
31115
- name = `${baseName} (${i})`;
31116
- i++;
31117
- }
31118
- return name;
31162
+ return getDuplicateSheetName(sheetName, names);
31119
31163
  }
31120
31164
  deleteSheet(sheet) {
31121
31165
  const name = sheet.name;
@@ -31402,6 +31446,7 @@ SheetPlugin.getters = [
31402
31446
  "getSheetZone",
31403
31447
  "getPaneDivisions",
31404
31448
  "checkElementsIncludeAllNonFrozenHeaders",
31449
+ "getDuplicateSheetName",
31405
31450
  ];
31406
31451
 
31407
31452
  /**
@@ -43769,6 +43814,6 @@ function addFunction(functionName, functionDescription) {
43769
43814
  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 };
43770
43815
 
43771
43816
 
43772
- __info__.version = '16.0.68';
43773
- __info__.date = '2025-04-25T08:02:52.716Z';
43774
- __info__.hash = '682d48e';
43817
+ __info__.version = '16.0.70';
43818
+ __info__.date = '2025-05-12T05:19:22.493Z';
43819
+ __info__.hash = 'bbdc034';
@@ -2377,6 +2377,25 @@
2377
2377
  }
2378
2378
  return (getUnquotedSheetName(name1.trim().toUpperCase()) ===
2379
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;
2380
2399
  }
2381
2400
 
2382
2401
  /*
@@ -6085,10 +6104,13 @@
6085
6104
  sequence: 20,
6086
6105
  action: (env) => {
6087
6106
  const sheetIdFrom = env.model.getters.getActiveSheetId();
6107
+ const sheetNameFrom = env.model.getters.getSheetName(sheetIdFrom);
6088
6108
  const sheetIdTo = env.model.uuidGenerator.smallUuid();
6109
+ const sheetNameTo = env.model.getters.getDuplicateSheetName(sheetNameFrom);
6089
6110
  env.model.dispatch("DUPLICATE_SHEET", {
6090
6111
  sheetId: sheetIdFrom,
6091
6112
  sheetIdTo,
6113
+ sheetNameTo,
6092
6114
  });
6093
6115
  env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom, sheetIdTo });
6094
6116
  },
@@ -22148,7 +22170,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
22148
22170
  position: absolute;
22149
22171
  top: 0;
22150
22172
  left: ${HEADER_WIDTH}px;
22151
- right: 0;
22173
+ right: ${SCROLLBAR_WIDTH}px;
22152
22174
  height: ${HEADER_HEIGHT}px;
22153
22175
  &.o-dragging {
22154
22176
  cursor: grabbing;
@@ -22319,9 +22341,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
22319
22341
  position: absolute;
22320
22342
  top: ${HEADER_HEIGHT}px;
22321
22343
  left: 0;
22322
- right: 0;
22344
+ bottom: ${SCROLLBAR_WIDTH}px;
22323
22345
  width: ${HEADER_WIDTH}px;
22324
- height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH}px);
22325
22346
  &.o-dragging {
22326
22347
  cursor: grabbing;
22327
22348
  }
@@ -27437,6 +27458,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
27437
27458
  initialMessages = dropCommands(initialMessages, "SORT_CELLS");
27438
27459
  initialMessages = dropCommands(initialMessages, "SET_DECIMAL");
27439
27460
  initialMessages = fixChartDefinitions(data, initialMessages);
27461
+ initialMessages = fixTranslatedDuplicateSheetName(data, initialMessages);
27440
27462
  return initialMessages;
27441
27463
  }
27442
27464
  /**
@@ -27537,6 +27559,40 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
27537
27559
  }
27538
27560
  return messages;
27539
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
+ }
27540
27596
  // -----------------------------------------------------------------------------
27541
27597
  // Helpers
27542
27598
  // -----------------------------------------------------------------------------
@@ -28789,9 +28845,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
28789
28845
  : 0 /* CommandResult.Success */;
28790
28846
  }
28791
28847
  checkChartExists(cmd) {
28792
- return this.getters.getFigureSheetId(cmd.id)
28793
- ? 0 /* CommandResult.Success */
28794
- : 86 /* CommandResult.ChartDoesNotExist */;
28848
+ return this.isChartDefined(cmd.id) ? 0 /* CommandResult.Success */ : 86 /* CommandResult.ChartDoesNotExist */;
28795
28849
  }
28796
28850
  }
28797
28851
  ChartPlugin.getters = [
@@ -30529,7 +30583,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
30529
30583
  return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
30530
30584
  }
30531
30585
  case "DUPLICATE_SHEET": {
30532
- return this.sheets[cmd.sheetIdTo] ? 12 /* CommandResult.DuplicatedSheetId */ : 0 /* CommandResult.Success */;
30586
+ if (this.sheets[cmd.sheetIdTo])
30587
+ return 12 /* CommandResult.DuplicatedSheetId */;
30588
+ if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo))
30589
+ return 11 /* CommandResult.DuplicatedSheetName */;
30590
+ return 0 /* CommandResult.Success */;
30533
30591
  }
30534
30592
  case "MOVE_SHEET":
30535
30593
  const currentIndex = this.orderedSheetIds.indexOf(cmd.sheetId);
@@ -30615,7 +30673,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
30615
30673
  this.showSheet(cmd.sheetId);
30616
30674
  break;
30617
30675
  case "DUPLICATE_SHEET":
30618
- this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo);
30676
+ this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo, cmd.sheetNameTo);
30619
30677
  break;
30620
30678
  case "DELETE_SHEET":
30621
30679
  this.deleteSheet(this.sheets[cmd.sheetId]);
@@ -30839,14 +30897,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
30839
30897
  return dimension === "COL" ? this.getNumberCols(sheetId) : this.getNumberRows(sheetId);
30840
30898
  }
30841
30899
  getNextSheetName(baseName = "Sheet") {
30842
- let i = 1;
30843
30900
  const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
30844
- let name = `${baseName}${i}`;
30845
- while (names.includes(name)) {
30846
- name = `${baseName}${i}`;
30847
- i++;
30848
- }
30849
- return name;
30901
+ return getNextSheetName(names, baseName);
30850
30902
  }
30851
30903
  getSheetSize(sheetId) {
30852
30904
  return {
@@ -31074,9 +31126,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
31074
31126
  showSheet(sheetId) {
31075
31127
  this.history.update("sheets", sheetId, "isVisible", true);
31076
31128
  }
31077
- duplicateSheet(fromId, toId) {
31129
+ duplicateSheet(fromId, toId, toName) {
31078
31130
  const sheet = this.getSheet(fromId);
31079
- const toName = this.getDuplicateSheetName(sheet.name);
31080
31131
  const newSheet = deepCopy(sheet);
31081
31132
  newSheet.id = toId;
31082
31133
  newSheet.name = toName;
@@ -31108,15 +31159,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
31108
31159
  this.history.update("sheetIdsMapName", sheetIdsMapName);
31109
31160
  }
31110
31161
  getDuplicateSheetName(sheetName) {
31111
- let i = 1;
31112
31162
  const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
31113
- const baseName = _lt("Copy of %s", sheetName);
31114
- let name = baseName.toString();
31115
- while (names.includes(name)) {
31116
- name = `${baseName} (${i})`;
31117
- i++;
31118
- }
31119
- return name;
31163
+ return getDuplicateSheetName(sheetName, names);
31120
31164
  }
31121
31165
  deleteSheet(sheet) {
31122
31166
  const name = sheet.name;
@@ -31403,6 +31447,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
31403
31447
  "getSheetZone",
31404
31448
  "getPaneDivisions",
31405
31449
  "checkElementsIncludeAllNonFrozenHeaders",
31450
+ "getDuplicateSheetName",
31406
31451
  ];
31407
31452
 
31408
31453
  /**
@@ -43800,9 +43845,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
43800
43845
  Object.defineProperty(exports, '__esModule', { value: true });
43801
43846
 
43802
43847
 
43803
- __info__.version = '16.0.68';
43804
- __info__.date = '2025-04-25T08:02:52.716Z';
43805
- __info__.hash = '682d48e';
43848
+ __info__.version = '16.0.70';
43849
+ __info__.date = '2025-05-12T05:19:22.493Z';
43850
+ __info__.hash = 'bbdc034';
43806
43851
 
43807
43852
 
43808
43853
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);