@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.
@@ -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.60
6
- * @date 2025-05-02T12:28:49.842Z
7
- * @hash 29510cc
5
+ * @version 17.0.61
6
+ * @date 2025-05-12T05:21:02.159Z
7
+ * @hash 0368641
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -4485,6 +4485,25 @@
4485
4485
  })
4486
4486
  .filter(isDefined$1);
4487
4487
  }
4488
+ function getNextSheetName(existingNames, baseName = "Sheet") {
4489
+ let i = 1;
4490
+ let name = `${baseName}${i}`;
4491
+ while (existingNames.includes(name)) {
4492
+ name = `${baseName}${i}`;
4493
+ i++;
4494
+ }
4495
+ return name;
4496
+ }
4497
+ function getDuplicateSheetName(nameToDuplicate, existingNames) {
4498
+ let i = 1;
4499
+ const baseName = _t("Copy of %s", nameToDuplicate);
4500
+ let name = baseName.toString();
4501
+ while (existingNames.includes(name)) {
4502
+ name = `${baseName} (${i})`;
4503
+ i++;
4504
+ }
4505
+ return name;
4506
+ }
4488
4507
 
4489
4508
  function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
4490
4509
  return numberOfLines * (textLineHeight + MIN_CELL_TEXT_MARGIN) - MIN_CELL_TEXT_MARGIN;
@@ -8027,10 +8046,13 @@
8027
8046
  name: _t("Duplicate"),
8028
8047
  execute: (env) => {
8029
8048
  const sheetIdFrom = env.model.getters.getActiveSheetId();
8049
+ const sheetNameFrom = env.model.getters.getSheetName(sheetIdFrom);
8030
8050
  const sheetIdTo = env.model.uuidGenerator.smallUuid();
8051
+ const sheetNameTo = env.model.getters.getDuplicateSheetName(sheetNameFrom);
8031
8052
  env.model.dispatch("DUPLICATE_SHEET", {
8032
8053
  sheetId: sheetIdFrom,
8033
8054
  sheetIdTo,
8055
+ sheetNameTo,
8034
8056
  });
8035
8057
  env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom, sheetIdTo });
8036
8058
  },
@@ -27148,6 +27170,13 @@
27148
27170
  this.props.onInputContextMenu?.(ev);
27149
27171
  }
27150
27172
  }
27173
+ onWheel(event) {
27174
+ // detect if scrollbar is available
27175
+ if (this.composerRef.el &&
27176
+ this.composerRef.el.scrollHeight > this.composerRef.el.clientHeight) {
27177
+ event.stopPropagation();
27178
+ }
27179
+ }
27151
27180
  // ---------------------------------------------------------------------------
27152
27181
  // Private
27153
27182
  // ---------------------------------------------------------------------------
@@ -27456,12 +27485,15 @@
27456
27485
  });
27457
27486
  }
27458
27487
  get composerProps() {
27488
+ // Remove the wrapper border width
27489
+ const maxHeight = this.props.gridDims.height - this.rect.y - 2 * COMPOSER_BORDER_WIDTH;
27459
27490
  return {
27460
27491
  focus: this.props.focus,
27461
27492
  isDefaultFocus: true,
27462
27493
  onComposerContentFocused: this.props.onComposerContentFocused,
27463
27494
  onComposerCellFocused: this.props.onComposerCellFocused,
27464
27495
  onInputContextMenu: this.props.onInputContextMenu,
27496
+ inputStyle: `max-height: ${maxHeight}px;`,
27465
27497
  };
27466
27498
  }
27467
27499
  get containerStyle() {
@@ -34354,6 +34386,7 @@
34354
34386
  initialMessages = dropCommands(initialMessages, "SORT_CELLS");
34355
34387
  initialMessages = dropCommands(initialMessages, "SET_DECIMAL");
34356
34388
  initialMessages = fixChartDefinitions(data, initialMessages);
34389
+ initialMessages = fixTranslatedDuplicateSheetName(data, initialMessages);
34357
34390
  return initialMessages;
34358
34391
  }
34359
34392
  /**
@@ -34473,6 +34506,40 @@
34473
34506
  }
34474
34507
  return data;
34475
34508
  }
34509
+ function fixTranslatedDuplicateSheetName(data, initialMessages) {
34510
+ const sheetNames = {};
34511
+ for (const sheet of data.sheets || []) {
34512
+ sheetNames[sheet.id] = sheet.name;
34513
+ }
34514
+ const messages = [];
34515
+ for (const message of initialMessages) {
34516
+ if (message.type === "REMOTE_REVISION") {
34517
+ const commands = [];
34518
+ for (const cmd of message.commands) {
34519
+ switch (cmd.type) {
34520
+ case "DUPLICATE_SHEET":
34521
+ cmd.sheetNameTo =
34522
+ cmd.sheetNameTo ??
34523
+ getDuplicateSheetName(sheetNames[cmd.sheetId], Object.values(sheetNames));
34524
+ break;
34525
+ case "CREATE_SHEET":
34526
+ case "RENAME_SHEET":
34527
+ sheetNames[cmd.sheetId] = cmd.name || getNextSheetName(Object.values(sheetNames));
34528
+ break;
34529
+ }
34530
+ commands.push(cmd);
34531
+ }
34532
+ messages.push({
34533
+ ...message,
34534
+ commands,
34535
+ });
34536
+ }
34537
+ else {
34538
+ messages.push(message);
34539
+ }
34540
+ }
34541
+ return initialMessages;
34542
+ }
34476
34543
  // -----------------------------------------------------------------------------
34477
34544
  // Helpers
34478
34545
  // -----------------------------------------------------------------------------
@@ -36703,9 +36770,7 @@
36703
36770
  : "Success" /* CommandResult.Success */;
36704
36771
  }
36705
36772
  checkChartExists(cmd) {
36706
- return this.getters.getFigureSheetId(cmd.id)
36707
- ? "Success" /* CommandResult.Success */
36708
- : "ChartDoesNotExist" /* CommandResult.ChartDoesNotExist */;
36773
+ return this.isChartDefined(cmd.id) ? "Success" /* CommandResult.Success */ : "ChartDoesNotExist" /* CommandResult.ChartDoesNotExist */;
36709
36774
  }
36710
36775
  }
36711
36776
 
@@ -39504,6 +39569,7 @@
39504
39569
  "getCommandZones",
39505
39570
  "getUnboundedZone",
39506
39571
  "checkElementsIncludeAllNonFrozenHeaders",
39572
+ "getDuplicateSheetName",
39507
39573
  ];
39508
39574
  sheetIdsMapName = {};
39509
39575
  orderedSheetIds = [];
@@ -39528,7 +39594,11 @@
39528
39594
  return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
39529
39595
  }
39530
39596
  case "DUPLICATE_SHEET": {
39531
- return this.sheets[cmd.sheetIdTo] ? "DuplicatedSheetId" /* CommandResult.DuplicatedSheetId */ : "Success" /* CommandResult.Success */;
39597
+ if (this.sheets[cmd.sheetIdTo])
39598
+ return "DuplicatedSheetId" /* CommandResult.DuplicatedSheetId */;
39599
+ if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo))
39600
+ return "DuplicatedSheetName" /* CommandResult.DuplicatedSheetName */;
39601
+ return "Success" /* CommandResult.Success */;
39532
39602
  }
39533
39603
  case "MOVE_SHEET":
39534
39604
  try {
@@ -39601,7 +39671,7 @@
39601
39671
  this.showSheet(cmd.sheetId);
39602
39672
  break;
39603
39673
  case "DUPLICATE_SHEET":
39604
- this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo);
39674
+ this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo, cmd.sheetNameTo);
39605
39675
  break;
39606
39676
  case "DELETE_SHEET":
39607
39677
  this.deleteSheet(this.sheets[cmd.sheetId]);
@@ -39811,14 +39881,8 @@
39811
39881
  return dimension === "COL" ? this.getNumberCols(sheetId) : this.getNumberRows(sheetId);
39812
39882
  }
39813
39883
  getNextSheetName(baseName = "Sheet") {
39814
- let i = 1;
39815
39884
  const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
39816
- let name = `${baseName}${i}`;
39817
- while (names.includes(name)) {
39818
- name = `${baseName}${i}`;
39819
- i++;
39820
- }
39821
- return name;
39885
+ return getNextSheetName(names, baseName);
39822
39886
  }
39823
39887
  getSheetSize(sheetId) {
39824
39888
  return {
@@ -40078,9 +40142,8 @@
40078
40142
  showSheet(sheetId) {
40079
40143
  this.history.update("sheets", sheetId, "isVisible", true);
40080
40144
  }
40081
- duplicateSheet(fromId, toId) {
40145
+ duplicateSheet(fromId, toId, toName) {
40082
40146
  const sheet = this.getSheet(fromId);
40083
- const toName = this.getDuplicateSheetName(sheet.name);
40084
40147
  const newSheet = deepCopy(sheet);
40085
40148
  newSheet.id = toId;
40086
40149
  newSheet.name = toName;
@@ -40112,15 +40175,8 @@
40112
40175
  this.history.update("sheetIdsMapName", sheetIdsMapName);
40113
40176
  }
40114
40177
  getDuplicateSheetName(sheetName) {
40115
- let i = 1;
40116
40178
  const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
40117
- const baseName = _t("Copy of %s", sheetName);
40118
- let name = baseName.toString();
40119
- while (names.includes(name)) {
40120
- name = `${baseName} (${i})`;
40121
- i++;
40122
- }
40123
- return name;
40179
+ return getDuplicateSheetName(sheetName, names);
40124
40180
  }
40125
40181
  deleteSheet(sheet) {
40126
40182
  const name = sheet.name;
@@ -58251,9 +58307,9 @@
58251
58307
  exports.tokenize = tokenize;
58252
58308
 
58253
58309
 
58254
- __info__.version = "17.0.60";
58255
- __info__.date = "2025-05-02T12:28:49.842Z";
58256
- __info__.hash = "29510cc";
58310
+ __info__.version = "17.0.61";
58311
+ __info__.date = "2025-05-12T05:21:02.159Z";
58312
+ __info__.hash = "0368641";
58257
58313
 
58258
58314
 
58259
58315
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);