@odoo/o-spreadsheet 16.0.68 → 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.
@@ -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
  // -----------------------------------------------------------------------------
@@ -30532,7 +30588,11 @@ class SheetPlugin extends CorePlugin {
30532
30588
  return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
30533
30589
  }
30534
30590
  case "DUPLICATE_SHEET": {
30535
- return this.sheets[cmd.sheetIdTo] ? 12 /* CommandResult.DuplicatedSheetId */ : 0 /* CommandResult.Success */;
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 */;
30536
30596
  }
30537
30597
  case "MOVE_SHEET":
30538
30598
  const currentIndex = this.orderedSheetIds.indexOf(cmd.sheetId);
@@ -30618,7 +30678,7 @@ class SheetPlugin extends CorePlugin {
30618
30678
  this.showSheet(cmd.sheetId);
30619
30679
  break;
30620
30680
  case "DUPLICATE_SHEET":
30621
- this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo);
30681
+ this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo, cmd.sheetNameTo);
30622
30682
  break;
30623
30683
  case "DELETE_SHEET":
30624
30684
  this.deleteSheet(this.sheets[cmd.sheetId]);
@@ -30842,14 +30902,8 @@ class SheetPlugin extends CorePlugin {
30842
30902
  return dimension === "COL" ? this.getNumberCols(sheetId) : this.getNumberRows(sheetId);
30843
30903
  }
30844
30904
  getNextSheetName(baseName = "Sheet") {
30845
- let i = 1;
30846
30905
  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;
30906
+ return getNextSheetName(names, baseName);
30853
30907
  }
30854
30908
  getSheetSize(sheetId) {
30855
30909
  return {
@@ -31077,9 +31131,8 @@ class SheetPlugin extends CorePlugin {
31077
31131
  showSheet(sheetId) {
31078
31132
  this.history.update("sheets", sheetId, "isVisible", true);
31079
31133
  }
31080
- duplicateSheet(fromId, toId) {
31134
+ duplicateSheet(fromId, toId, toName) {
31081
31135
  const sheet = this.getSheet(fromId);
31082
- const toName = this.getDuplicateSheetName(sheet.name);
31083
31136
  const newSheet = deepCopy(sheet);
31084
31137
  newSheet.id = toId;
31085
31138
  newSheet.name = toName;
@@ -31111,15 +31164,8 @@ class SheetPlugin extends CorePlugin {
31111
31164
  this.history.update("sheetIdsMapName", sheetIdsMapName);
31112
31165
  }
31113
31166
  getDuplicateSheetName(sheetName) {
31114
- let i = 1;
31115
31167
  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;
31168
+ return getDuplicateSheetName(sheetName, names);
31123
31169
  }
31124
31170
  deleteSheet(sheet) {
31125
31171
  const name = sheet.name;
@@ -31406,6 +31452,7 @@ SheetPlugin.getters = [
31406
31452
  "getSheetZone",
31407
31453
  "getPaneDivisions",
31408
31454
  "checkElementsIncludeAllNonFrozenHeaders",
31455
+ "getDuplicateSheetName",
31409
31456
  ];
31410
31457
 
31411
31458
  /**
@@ -43801,6 +43848,6 @@ exports.setTranslationMethod = setTranslationMethod;
43801
43848
  exports.tokenize = tokenize;
43802
43849
 
43803
43850
 
43804
- __info__.version = '16.0.68';
43805
- __info__.date = '2025-04-25T08:02:52.716Z';
43806
- __info__.hash = '682d48e';
43851
+ __info__.version = '16.0.69';
43852
+ __info__.date = '2025-05-02T12:27:49.757Z';
43853
+ __info__.hash = '51188e8';
@@ -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
  // -----------------------------------------------------------------------------
@@ -30528,7 +30584,11 @@ class SheetPlugin extends CorePlugin {
30528
30584
  return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
30529
30585
  }
30530
30586
  case "DUPLICATE_SHEET": {
30531
- return this.sheets[cmd.sheetIdTo] ? 12 /* CommandResult.DuplicatedSheetId */ : 0 /* CommandResult.Success */;
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 */;
30532
30592
  }
30533
30593
  case "MOVE_SHEET":
30534
30594
  const currentIndex = this.orderedSheetIds.indexOf(cmd.sheetId);
@@ -30614,7 +30674,7 @@ class SheetPlugin extends CorePlugin {
30614
30674
  this.showSheet(cmd.sheetId);
30615
30675
  break;
30616
30676
  case "DUPLICATE_SHEET":
30617
- this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo);
30677
+ this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo, cmd.sheetNameTo);
30618
30678
  break;
30619
30679
  case "DELETE_SHEET":
30620
30680
  this.deleteSheet(this.sheets[cmd.sheetId]);
@@ -30838,14 +30898,8 @@ class SheetPlugin extends CorePlugin {
30838
30898
  return dimension === "COL" ? this.getNumberCols(sheetId) : this.getNumberRows(sheetId);
30839
30899
  }
30840
30900
  getNextSheetName(baseName = "Sheet") {
30841
- let i = 1;
30842
30901
  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;
30902
+ return getNextSheetName(names, baseName);
30849
30903
  }
30850
30904
  getSheetSize(sheetId) {
30851
30905
  return {
@@ -31073,9 +31127,8 @@ class SheetPlugin extends CorePlugin {
31073
31127
  showSheet(sheetId) {
31074
31128
  this.history.update("sheets", sheetId, "isVisible", true);
31075
31129
  }
31076
- duplicateSheet(fromId, toId) {
31130
+ duplicateSheet(fromId, toId, toName) {
31077
31131
  const sheet = this.getSheet(fromId);
31078
- const toName = this.getDuplicateSheetName(sheet.name);
31079
31132
  const newSheet = deepCopy(sheet);
31080
31133
  newSheet.id = toId;
31081
31134
  newSheet.name = toName;
@@ -31107,15 +31160,8 @@ class SheetPlugin extends CorePlugin {
31107
31160
  this.history.update("sheetIdsMapName", sheetIdsMapName);
31108
31161
  }
31109
31162
  getDuplicateSheetName(sheetName) {
31110
- let i = 1;
31111
31163
  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;
31164
+ return getDuplicateSheetName(sheetName, names);
31119
31165
  }
31120
31166
  deleteSheet(sheet) {
31121
31167
  const name = sheet.name;
@@ -31402,6 +31448,7 @@ SheetPlugin.getters = [
31402
31448
  "getSheetZone",
31403
31449
  "getPaneDivisions",
31404
31450
  "checkElementsIncludeAllNonFrozenHeaders",
31451
+ "getDuplicateSheetName",
31405
31452
  ];
31406
31453
 
31407
31454
  /**
@@ -43769,6 +43816,6 @@ function addFunction(functionName, functionDescription) {
43769
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 };
43770
43817
 
43771
43818
 
43772
- __info__.version = '16.0.68';
43773
- __info__.date = '2025-04-25T08:02:52.716Z';
43774
- __info__.hash = '682d48e';
43819
+ __info__.version = '16.0.69';
43820
+ __info__.date = '2025-05-02T12:27:49.757Z';
43821
+ __info__.hash = '51188e8';
@@ -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
  // -----------------------------------------------------------------------------
@@ -30529,7 +30585,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
30529
30585
  return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
30530
30586
  }
30531
30587
  case "DUPLICATE_SHEET": {
30532
- return this.sheets[cmd.sheetIdTo] ? 12 /* CommandResult.DuplicatedSheetId */ : 0 /* CommandResult.Success */;
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 */;
30533
30593
  }
30534
30594
  case "MOVE_SHEET":
30535
30595
  const currentIndex = this.orderedSheetIds.indexOf(cmd.sheetId);
@@ -30615,7 +30675,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
30615
30675
  this.showSheet(cmd.sheetId);
30616
30676
  break;
30617
30677
  case "DUPLICATE_SHEET":
30618
- this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo);
30678
+ this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo, cmd.sheetNameTo);
30619
30679
  break;
30620
30680
  case "DELETE_SHEET":
30621
30681
  this.deleteSheet(this.sheets[cmd.sheetId]);
@@ -30839,14 +30899,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
30839
30899
  return dimension === "COL" ? this.getNumberCols(sheetId) : this.getNumberRows(sheetId);
30840
30900
  }
30841
30901
  getNextSheetName(baseName = "Sheet") {
30842
- let i = 1;
30843
30902
  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;
30903
+ return getNextSheetName(names, baseName);
30850
30904
  }
30851
30905
  getSheetSize(sheetId) {
30852
30906
  return {
@@ -31074,9 +31128,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
31074
31128
  showSheet(sheetId) {
31075
31129
  this.history.update("sheets", sheetId, "isVisible", true);
31076
31130
  }
31077
- duplicateSheet(fromId, toId) {
31131
+ duplicateSheet(fromId, toId, toName) {
31078
31132
  const sheet = this.getSheet(fromId);
31079
- const toName = this.getDuplicateSheetName(sheet.name);
31080
31133
  const newSheet = deepCopy(sheet);
31081
31134
  newSheet.id = toId;
31082
31135
  newSheet.name = toName;
@@ -31108,15 +31161,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
31108
31161
  this.history.update("sheetIdsMapName", sheetIdsMapName);
31109
31162
  }
31110
31163
  getDuplicateSheetName(sheetName) {
31111
- let i = 1;
31112
31164
  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;
31165
+ return getDuplicateSheetName(sheetName, names);
31120
31166
  }
31121
31167
  deleteSheet(sheet) {
31122
31168
  const name = sheet.name;
@@ -31403,6 +31449,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
31403
31449
  "getSheetZone",
31404
31450
  "getPaneDivisions",
31405
31451
  "checkElementsIncludeAllNonFrozenHeaders",
31452
+ "getDuplicateSheetName",
31406
31453
  ];
31407
31454
 
31408
31455
  /**
@@ -43800,9 +43847,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
43800
43847
  Object.defineProperty(exports, '__esModule', { value: true });
43801
43848
 
43802
43849
 
43803
- __info__.version = '16.0.68';
43804
- __info__.date = '2025-04-25T08:02:52.716Z';
43805
- __info__.hash = '682d48e';
43850
+ __info__.version = '16.0.69';
43851
+ __info__.date = '2025-05-02T12:27:49.757Z';
43852
+ __info__.hash = '51188e8';
43806
43853
 
43807
43854
 
43808
43855
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);