@odoo/o-spreadsheet 17.2.22 → 17.2.24

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.
@@ -3,9 +3,9 @@
3
3
  /**
4
4
  * This file is generated by o-spreadsheet build tools. Do not edit it.
5
5
  * @see https://github.com/odoo/o-spreadsheet
6
- * @version 17.2.22
7
- * @date 2024-08-26T13:48:03.927Z
8
- * @hash 4157fb8
6
+ * @version 17.2.24
7
+ * @date 2024-10-14T07:49:56.845Z
8
+ * @hash 7e88bec
9
9
  */
10
10
 
11
11
  (function (exports, owl) {
@@ -162,7 +162,7 @@
162
162
  underline: false,
163
163
  fontSize: 10,
164
164
  fillColor: "",
165
- textColor: "#000000",
165
+ textColor: "",
166
166
  };
167
167
  const DEFAULT_VERTICAL_ALIGN = DEFAULT_STYLE.verticalAlign;
168
168
  const DEFAULT_WRAPPING_MODE = DEFAULT_STYLE.wrapping;
@@ -5786,9 +5786,11 @@
5786
5786
  const targetCell = this.getters.getEvaluatedCell(target);
5787
5787
  const originFormat = origin.cell?.format ?? origin.evaluatedCell.format;
5788
5788
  if (clipboardOption?.pasteOption === "asValue") {
5789
- const locale = this.getters.getLocale();
5790
- const content = formatValue(origin.evaluatedCell.value, { locale });
5791
- this.dispatch("UPDATE_CELL", { ...target, content, format: originFormat });
5789
+ this.dispatch("UPDATE_CELL", {
5790
+ ...target,
5791
+ content: origin.evaluatedCell.value?.toString() || "",
5792
+ format: originFormat,
5793
+ });
5792
5794
  return;
5793
5795
  }
5794
5796
  if (clipboardOption?.pasteOption === "onlyFormat") {
@@ -6298,25 +6300,26 @@
6298
6300
  for (let col of columnsIndexes) {
6299
6301
  const position = { col, row, sheetId };
6300
6302
  const table = this.getters.getTable(position);
6301
- if (!table || copiedTablesIds.has(table.id)) {
6303
+ if (!table) {
6302
6304
  tableCellsInRow.push({});
6303
6305
  continue;
6304
6306
  }
6307
+ let copiedTable = undefined;
6305
6308
  // Copy whole table
6306
- if (zones.some((z) => isZoneInside(table.range.zone, z))) {
6309
+ if (!copiedTablesIds.has(table.id) &&
6310
+ zones.some((z) => isZoneInside(table.range.zone, z))) {
6307
6311
  copiedTablesIds.add(table.id);
6308
6312
  const values = [];
6309
6313
  for (const col of range(table.range.zone.left, table.range.zone.right + 1)) {
6310
6314
  values.push(this.getters.getFilterHiddenValues({ sheetId, col, row: table.range.zone.top }));
6311
6315
  }
6312
- tableCellsInRow.push({
6313
- table: { filtersValues: values, range: table.range, config: table.config },
6314
- });
6315
- }
6316
- // Copy only style of cell
6317
- else {
6318
- tableCellsInRow.push({ style: this.getTableStyleToCopy(position) });
6316
+ copiedTable = { filtersValues: values, range: table.range, config: table.config };
6319
6317
  }
6318
+ tableCellsInRow.push({
6319
+ table: copiedTable,
6320
+ style: this.getTableStyleToCopy(position),
6321
+ isWholeTableCopied: copiedTablesIds.has(table.id),
6322
+ });
6320
6323
  }
6321
6324
  }
6322
6325
  return {
@@ -6408,8 +6411,12 @@
6408
6411
  }
6409
6412
  }
6410
6413
  // Do not paste table style if we're inside another table
6411
- if (!this.getters.getTable(position)) {
6412
- if (tableCell.style?.style && options?.pasteOption !== "asValue") {
6414
+ if (this.getters.getTable(position) || options?.pasteOption === "asValue") {
6415
+ return;
6416
+ }
6417
+ if ((!options?.pasteOption && !tableCell.isWholeTableCopied) ||
6418
+ options?.pasteOption === "onlyFormat") {
6419
+ if (tableCell.style?.style) {
6413
6420
  this.dispatch("UPDATE_CELL", { ...position, style: tableCell.style.style });
6414
6421
  }
6415
6422
  if (tableCell.style?.border) {
@@ -37589,6 +37596,18 @@ stores.inject(MyMetaStore, storeInstance);
37589
37596
  // -------------------------------------
37590
37597
  // WORKSHEET HELPERS
37591
37598
  // -------------------------------------
37599
+ function getCellType(value) {
37600
+ switch (typeof value) {
37601
+ case "boolean":
37602
+ return "b";
37603
+ case "string":
37604
+ return "str";
37605
+ case "number":
37606
+ return "n";
37607
+ default:
37608
+ return undefined;
37609
+ }
37610
+ }
37592
37611
  function convertHeightToExcel(height) {
37593
37612
  return Math.round(HEIGHT_FACTOR * height * 100) / 100;
37594
37613
  }
@@ -50424,9 +50443,9 @@ stores.inject(MyMetaStore, storeInstance);
50424
50443
  /**
50425
50444
  * Notify the server that the user client left the collaborative session
50426
50445
  */
50427
- leave(data) {
50446
+ async leave(data) {
50428
50447
  if (Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
50429
- this.snapshot(data());
50448
+ await this.snapshot(data());
50430
50449
  }
50431
50450
  delete this.clients[this.clientId];
50432
50451
  this.transportService.leave(this.clientId);
@@ -50439,12 +50458,12 @@ stores.inject(MyMetaStore, storeInstance);
50439
50458
  /**
50440
50459
  * Send a snapshot of the spreadsheet to the collaboration server
50441
50460
  */
50442
- snapshot(data) {
50461
+ async snapshot(data) {
50443
50462
  if (this.pendingMessages.length !== 0) {
50444
50463
  return;
50445
50464
  }
50446
50465
  const snapshotId = this.uuidGenerator.uuidv4();
50447
- this.transportService.sendMessage({
50466
+ await this.transportService.sendMessage({
50448
50467
  type: "SNAPSHOT",
50449
50468
  nextRevisionId: snapshotId,
50450
50469
  serverRevisionId: this.serverRevisionId,
@@ -50658,6 +50677,7 @@ stores.inject(MyMetaStore, storeInstance);
50658
50677
  case "REMOTE_REVISION":
50659
50678
  case "REVISION_REDONE":
50660
50679
  case "REVISION_UNDONE":
50680
+ case "SNAPSHOT_CREATED":
50661
50681
  return this.processedRevisions.has(message.nextRevisionId);
50662
50682
  default:
50663
50683
  return false;
@@ -52124,6 +52144,9 @@ stores.inject(MyMetaStore, storeInstance);
52124
52144
  case "FOLD_HEADER_GROUP":
52125
52145
  case "FOLD_ALL_HEADER_GROUPS":
52126
52146
  case "UNFOLD_ALL_HEADER_GROUPS":
52147
+ case "FOLD_HEADER_GROUPS_IN_ZONE":
52148
+ case "UNFOLD_HEADER_GROUPS_IN_ZONE":
52149
+ case "UNGROUP_HEADERS":
52127
52150
  case "UPDATE_TABLE":
52128
52151
  case "UPDATE_FILTER":
52129
52152
  delete this.tableStyles[cmd.sheetId];
@@ -52819,6 +52842,8 @@ stores.inject(MyMetaStore, storeInstance);
52819
52842
  case "UNFOLD_HEADER_GROUP":
52820
52843
  case "FOLD_ALL_HEADER_GROUPS":
52821
52844
  case "UNFOLD_ALL_HEADER_GROUPS":
52845
+ case "FOLD_HEADER_GROUPS_IN_ZONE":
52846
+ case "UNFOLD_HEADER_GROUPS_IN_ZONE":
52822
52847
  this.updateHiddenRows(cmd.sheetId);
52823
52848
  break;
52824
52849
  case "UPDATE_FILTER":
@@ -53213,6 +53238,8 @@ stores.inject(MyMetaStore, storeInstance);
53213
53238
  this.selectedFigureId = null;
53214
53239
  break;
53215
53240
  }
53241
+ }
53242
+ finalize() {
53216
53243
  /** Any change to the selection has to be reflected in the selection processor. */
53217
53244
  this.selection.resetDefaultAnchor(this, deepCopy(this.gridSelection.anchor));
53218
53245
  }
@@ -54041,7 +54068,6 @@ stores.inject(MyMetaStore, storeInstance);
54041
54068
  }
54042
54069
  }
54043
54070
  handle(cmd) {
54044
- this.cleanViewports();
54045
54071
  // changing the evaluation can hide/show rows because of data filters
54046
54072
  if (invalidateEvaluationCommands.has(cmd.type)) {
54047
54073
  for (const sheetId of this.getters.getSheetIds()) {
@@ -54057,6 +54083,7 @@ stores.inject(MyMetaStore, storeInstance);
54057
54083
  break;
54058
54084
  case "UNDO":
54059
54085
  case "REDO":
54086
+ this.cleanViewports();
54060
54087
  for (const sheetId of this.getters.getSheetIds()) {
54061
54088
  this.sheetsWithDirtyViewports.add(sheetId);
54062
54089
  }
@@ -54111,6 +54138,9 @@ stores.inject(MyMetaStore, storeInstance);
54111
54138
  }
54112
54139
  }
54113
54140
  break;
54141
+ case "DELETE_SHEET":
54142
+ this.cleanViewports();
54143
+ break;
54114
54144
  case "ACTIVATE_SHEET":
54115
54145
  this.sheetsWithDirtyViewports.add(cmd.sheetIdTo);
54116
54146
  break;
@@ -55271,6 +55301,17 @@ stores.inject(MyMetaStore, storeInstance);
55271
55301
  .o-bottom-bar-fade-in {
55272
55302
  background-image: linear-gradient(90deg, #cfcfcf, transparent 1%);
55273
55303
  }
55304
+
55305
+ .o-sheet-list {
55306
+ overflow-y: hidden;
55307
+ overflow-x: auto;
55308
+
55309
+ &::-webkit-scrollbar {
55310
+ display: none; /* Chrome */
55311
+ }
55312
+ -ms-overflow-style: none; /* IE and Edge */
55313
+ scrollbar-width: none; /* Firefox */
55314
+ }
55274
55315
  }
55275
55316
 
55276
55317
  .o-bottom-bar-arrows {
@@ -57167,7 +57208,7 @@ stores.inject(MyMetaStore, storeInstance);
57167
57208
 
57168
57209
  class LocalTransportService {
57169
57210
  listeners = [];
57170
- sendMessage(message) {
57211
+ async sendMessage(message) {
57171
57212
  for (const { callback } of this.listeners) {
57172
57213
  callback(message);
57173
57214
  }
@@ -59004,17 +59045,13 @@ stores.inject(MyMetaStore, storeInstance);
59004
59045
  if (!formula) {
59005
59046
  return { attrs: [], node: escapeXml `` };
59006
59047
  }
59007
- const attrs = [];
59008
- let node = escapeXml ``;
59009
- let cycle = escapeXml ``;
59010
- const XlsxFormula = adaptFormulaToExcel(formula);
59011
- // hack for cycles : if we don't set a value (be it 0 or #VALUE!), it will appear as invisible on excel,
59012
- // Making it very hard for the client to find where the recursion is.
59013
- if (cell.value === CellErrorType.CircularDependency) {
59014
- attrs.push(["t", "str"]);
59015
- cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
59048
+ const type = getCellType(cell.value);
59049
+ if (type === undefined) {
59050
+ return { attrs: [], node: escapeXml `` };
59016
59051
  }
59017
- node = escapeXml /*xml*/ `<f>${XlsxFormula}</f>${cycle}`;
59052
+ const attrs = [["t", type]];
59053
+ const XlsxFormula = adaptFormulaToExcel(formula);
59054
+ const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${cell.value}</v>`;
59018
59055
  return { attrs, node };
59019
59056
  }
59020
59057
  function addContent(content, sharedStrings, forceString = false) {
@@ -60366,8 +60403,8 @@ stores.inject(MyMetaStore, storeInstance);
60366
60403
  joinSession() {
60367
60404
  this.session.join(this.config.client);
60368
60405
  }
60369
- leaveSession() {
60370
- this.session.leave(lazy(() => this.exportData()));
60406
+ async leaveSession() {
60407
+ await this.session.leave(lazy(() => this.exportData()));
60371
60408
  }
60372
60409
  setupUiPlugin(Plugin) {
60373
60410
  const plugin = new Plugin(this.uiPluginConfig);
@@ -60921,9 +60958,9 @@ stores.inject(MyMetaStore, storeInstance);
60921
60958
  exports.tokenize = tokenize;
60922
60959
 
60923
60960
 
60924
- __info__.version = "17.2.22";
60925
- __info__.date = "2024-08-26T13:48:03.927Z";
60926
- __info__.hash = "4157fb8";
60961
+ __info__.version = "17.2.24";
60962
+ __info__.date = "2024-10-14T07:49:56.845Z";
60963
+ __info__.hash = "7e88bec";
60927
60964
 
60928
60965
 
60929
60966
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);