@odoo/o-spreadsheet 17.4.16 → 17.4.17

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.4.16
6
- * @date 2024-12-19T07:50:04.021Z
7
- * @hash 6b827fc
5
+ * @version 17.4.17
6
+ * @date 2025-01-14T11:34:44.930Z
7
+ * @hash fd2a7ab
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -20366,6 +20366,17 @@ stores.inject(MyMetaStore, storeInstance);
20366
20366
  },
20367
20367
  isExported: true,
20368
20368
  };
20369
+ // -----------------------------------------------------------------------------
20370
+ // VALUE
20371
+ // -----------------------------------------------------------------------------
20372
+ const VALUE = {
20373
+ description: _t("Converts a string to a numeric value."),
20374
+ args: [arg("value (number)", _t("the string to be converted"))],
20375
+ compute: function (value) {
20376
+ return toNumber(value, this.locale);
20377
+ },
20378
+ isExported: true,
20379
+ };
20369
20380
 
20370
20381
  var text = /*#__PURE__*/Object.freeze({
20371
20382
  __proto__: null,
@@ -20388,7 +20399,8 @@ stores.inject(MyMetaStore, storeInstance);
20388
20399
  TEXT: TEXT,
20389
20400
  TEXTJOIN: TEXTJOIN,
20390
20401
  TRIM: TRIM,
20391
- UPPER: UPPER
20402
+ UPPER: UPPER,
20403
+ VALUE: VALUE
20392
20404
  });
20393
20405
 
20394
20406
  // -----------------------------------------------------------------------------
@@ -20645,14 +20657,11 @@ stores.inject(MyMetaStore, storeInstance);
20645
20657
  });
20646
20658
 
20647
20659
  class DOMFocusableElementStore {
20648
- mutators = ["setFocusableElement", "focus"];
20660
+ mutators = ["setFocusableElement"];
20649
20661
  focusableElement = undefined;
20650
20662
  setFocusableElement(element) {
20651
20663
  this.focusableElement = element;
20652
20664
  }
20653
- focus() {
20654
- this.focusableElement?.focus();
20655
- }
20656
20665
  }
20657
20666
 
20658
20667
  /**
@@ -24680,7 +24689,11 @@ stores.inject(MyMetaStore, storeInstance);
24680
24689
  colors.push(chartColors.upperColor);
24681
24690
  return {
24682
24691
  background: getters.getStyleOfSingleCellChart(chart.background, dataRange).background,
24683
- title: chart.title ?? { text: "" },
24692
+ title: {
24693
+ ...chart.title,
24694
+ // chart titles are extracted from .json files and they are translated at runtime here
24695
+ text: _t(chart.title.text ?? ""),
24696
+ },
24684
24697
  minValue: {
24685
24698
  value: minValue,
24686
24699
  label: formatValue(minValue, { locale, format }),
@@ -39420,7 +39433,7 @@ stores.inject(MyMetaStore, storeInstance);
39420
39433
  this.isEditing = isEditing;
39421
39434
  if (!isEditing) {
39422
39435
  this.rect = this.defaultRect;
39423
- this.DOMFocusableElementStore.focus();
39436
+ this.DOMFocusableElementStore.focusableElement?.focus();
39424
39437
  return;
39425
39438
  }
39426
39439
  const position = this.env.model.getters.getActivePosition();
@@ -42460,7 +42473,7 @@ stores.inject(MyMetaStore, storeInstance);
42460
42473
  this.cellPopovers = useStore(CellPopoverStore);
42461
42474
  owl.useEffect(() => {
42462
42475
  if (!this.sidePanel.isOpen) {
42463
- this.DOMFocusableElementStore.focus();
42476
+ this.DOMFocusableElementStore.focusableElement?.focus();
42464
42477
  }
42465
42478
  }, () => [this.sidePanel.isOpen]);
42466
42479
  }
@@ -42664,7 +42677,7 @@ stores.inject(MyMetaStore, storeInstance);
42664
42677
  focusDefaultElement() {
42665
42678
  if (!this.env.model.getters.getSelectedFigureId() &&
42666
42679
  this.composerStore.editionMode === "inactive") {
42667
- this.DOMFocusableElementStore.focus();
42680
+ this.DOMFocusableElementStore.focusableElement?.focus();
42668
42681
  }
42669
42682
  }
42670
42683
  get gridEl() {
@@ -44281,7 +44294,7 @@ stores.inject(MyMetaStore, storeInstance);
44281
44294
  vertical: style.verticalAlign
44282
44295
  ? V_ALIGNMENT_EXPORT_CONVERSION_MAP[style.verticalAlign]
44283
44296
  : undefined,
44284
- wrapText: style.wrapping === "wrap" || undefined,
44297
+ wrapText: style.wrapping === "wrap" || cell.content?.includes(NEWLINE) ? true : undefined,
44285
44298
  },
44286
44299
  };
44287
44300
  styles.font["strike"] = !!style?.strikethrough || undefined;
@@ -44504,7 +44517,7 @@ stores.inject(MyMetaStore, storeInstance);
44504
44517
  return undefined;
44505
44518
  }
44506
44519
  function isChartData(data) {
44507
- return "dataSets" in data;
44520
+ return "dataSets" in data && data.dataSets.length > 0;
44508
44521
  }
44509
44522
  function isImageData(data) {
44510
44523
  return "imageSrc" in data;
@@ -44742,9 +44755,8 @@ stores.inject(MyMetaStore, storeInstance);
44742
44755
  }
44743
44756
  return rows;
44744
44757
  }
44745
- /** Remove newlines (\n) in shared strings, We do not support them */
44746
44758
  function convertSharedStrings(xlsxSharedStrings) {
44747
- return xlsxSharedStrings.map((str) => str.replace(/\n/g, ""));
44759
+ return xlsxSharedStrings.map(replaceNewLines);
44748
44760
  }
44749
44761
  function convertCells(sheet, data, sheetDims, warningManager) {
44750
44762
  const cells = {};
@@ -45513,15 +45525,10 @@ stores.inject(MyMetaStore, storeInstance);
45513
45525
  getSharedStrings() {
45514
45526
  return this.mapOnElements({ parent: this.rootFile.file.xml, query: "si" }, (ssElement) => {
45515
45527
  // Shared string can either be a simple text, or a rich text (text with formatting, possibly in multiple parts)
45516
- if (ssElement.children[0].tagName === "t") {
45517
- return this.extractTextContent(ssElement) || "";
45518
- }
45519
45528
  // We don't support rich text formatting, we'll only extract the text
45520
- else {
45521
- return this.mapOnElements({ parent: ssElement, query: "t" }, (textElement) => {
45522
- return this.extractTextContent(textElement) || "";
45523
- }).join("");
45524
- }
45529
+ return this.mapOnElements({ parent: ssElement, query: "t" }, (textElement) => {
45530
+ return this.extractTextContent(textElement) || "";
45531
+ }).join("");
45525
45532
  });
45526
45533
  }
45527
45534
  }
@@ -47395,10 +47402,34 @@ stores.inject(MyMetaStore, storeInstance);
47395
47402
  const elements = [...cmd.elements].sort((a, b) => b - a);
47396
47403
  for (const group of groupConsecutive(elements)) {
47397
47404
  if (cmd.dimension === "COL") {
47398
- this.shiftBordersHorizontally(cmd.sheetId, group[group.length - 1] + 1, -group.length);
47405
+ if (group[0] >= this.getters.getNumberCols(cmd.sheetId)) {
47406
+ for (let row = 0; row < this.getters.getNumberRows(cmd.sheetId); row++) {
47407
+ this.history.update("borders", cmd.sheetId, group[0] + 1, row, "vertical", undefined);
47408
+ }
47409
+ }
47410
+ if (group[group.length - 1] === 0) {
47411
+ for (let row = 0; row < this.getters.getNumberRows(cmd.sheetId); row++) {
47412
+ this.history.update("borders", cmd.sheetId, 0, row, "vertical", undefined);
47413
+ }
47414
+ }
47415
+ const zone = this.getters.getColsZone(cmd.sheetId, group[group.length - 1] + 1, group[0]);
47416
+ this.clearInsideBorders(cmd.sheetId, [zone]);
47417
+ this.shiftBordersHorizontally(cmd.sheetId, group[0] + 1, -group.length);
47399
47418
  }
47400
47419
  else {
47401
- this.shiftBordersVertically(cmd.sheetId, group[group.length - 1] + 1, -group.length);
47420
+ if (group[0] >= this.getters.getNumberRows(cmd.sheetId)) {
47421
+ for (let col = 0; col < this.getters.getNumberCols(cmd.sheetId); col++) {
47422
+ this.history.update("borders", cmd.sheetId, col, group[0] + 1, "horizontal", undefined);
47423
+ }
47424
+ }
47425
+ if (group[group.length - 1] === 0) {
47426
+ for (let col = 0; col < this.getters.getNumberCols(cmd.sheetId); col++) {
47427
+ this.history.update("borders", cmd.sheetId, col, 0, "horizontal", undefined);
47428
+ }
47429
+ }
47430
+ const zone = this.getters.getRowsZone(cmd.sheetId, group[group.length - 1] + 1, group[0]);
47431
+ this.clearInsideBorders(cmd.sheetId, [zone]);
47432
+ this.shiftBordersVertically(cmd.sheetId, group[0] + 1, -group.length);
47402
47433
  }
47403
47434
  }
47404
47435
  break;
@@ -47705,6 +47736,18 @@ stores.inject(MyMetaStore, storeInstance);
47705
47736
  }
47706
47737
  }
47707
47738
  }
47739
+ /**
47740
+ * Remove the borders inside of a zone
47741
+ */
47742
+ clearInsideBorders(sheetId, zones) {
47743
+ for (let zone of zones) {
47744
+ for (let row = zone.top; row <= zone.bottom; row++) {
47745
+ for (let col = zone.left; col <= zone.right; col++) {
47746
+ this.history.update("borders", sheetId, col, row, undefined);
47747
+ }
47748
+ }
47749
+ }
47750
+ }
47708
47751
  /**
47709
47752
  * Add a border to the existing one to a cell
47710
47753
  */
@@ -57534,6 +57577,9 @@ stores.inject(MyMetaStore, storeInstance);
57534
57577
  }
57535
57578
  }
57536
57579
  this.acknowledge(message);
57580
+ if (message.type === "REMOTE_REVISION" && message.clientId === this.clientId) {
57581
+ return;
57582
+ }
57537
57583
  this.trigger("collaborative-event-received");
57538
57584
  }
57539
57585
  onClientMoved(message) {
@@ -62287,11 +62333,6 @@ stores.inject(MyMetaStore, storeInstance);
62287
62333
  editionState = "initializing";
62288
62334
  DOMFocusableElementStore;
62289
62335
  setup() {
62290
- owl.onMounted(() => {
62291
- if (this.isSheetActive) {
62292
- this.scrollToSheet();
62293
- }
62294
- });
62295
62336
  owl.onPatched(() => {
62296
62337
  if (this.sheetNameRef.el && this.state.isEditing && this.editionState === "initializing") {
62297
62338
  this.editionState = "editing";
@@ -62299,6 +62340,11 @@ stores.inject(MyMetaStore, storeInstance);
62299
62340
  }
62300
62341
  });
62301
62342
  this.DOMFocusableElementStore = useStore(DOMFocusableElementStore);
62343
+ owl.useEffect((sheetId) => {
62344
+ if (this.props.sheetId === sheetId) {
62345
+ this.scrollToSheet();
62346
+ }
62347
+ }, () => [this.env.model.getters.getActiveSheetId()]);
62302
62348
  }
62303
62349
  focusInputAndSelectContent() {
62304
62350
  if (!this.state.isEditing || !this.sheetNameRef.el)
@@ -62310,7 +62356,10 @@ stores.inject(MyMetaStore, storeInstance);
62310
62356
  }
62311
62357
  }
62312
62358
  scrollToSheet() {
62313
- this.sheetDivRef.el?.scrollIntoView?.();
62359
+ this.sheetDivRef.el?.scrollIntoView?.({
62360
+ behavior: "smooth",
62361
+ inline: "nearest",
62362
+ });
62314
62363
  }
62315
62364
  onFocusOut() {
62316
62365
  if (this.state.isEditing && this.editionState !== "initializing") {
@@ -62340,11 +62389,11 @@ stores.inject(MyMetaStore, storeInstance);
62340
62389
  if (ev.key === "Enter") {
62341
62390
  ev.preventDefault();
62342
62391
  this.stopEdition();
62343
- this.DOMFocusableElementStore.focus();
62392
+ this.DOMFocusableElementStore.focusableElement?.focus();
62344
62393
  }
62345
62394
  if (ev.key === "Escape") {
62346
62395
  this.cancelEdition();
62347
- this.DOMFocusableElementStore.focus();
62396
+ this.DOMFocusableElementStore.focusableElement?.focus();
62348
62397
  }
62349
62398
  }
62350
62399
  onMouseEventSheetName(ev) {
@@ -67879,7 +67928,12 @@ stores.inject(MyMetaStore, storeInstance);
67879
67928
  ["count", strings.length],
67880
67929
  ["uniqueCount", strings.length],
67881
67930
  ];
67882
- const stringNodes = strings.map((string) => escapeXml /*xml*/ `<si><t>${string}</t></si>`);
67931
+ const stringNodes = strings.map((string) => {
67932
+ if (string.trim() !== string) {
67933
+ return escapeXml /*xml*/ `<si><t xml:space="preserve">${string}</t></si>`;
67934
+ }
67935
+ return escapeXml /*xml*/ `<si><t>${string}</t></si>`;
67936
+ });
67883
67937
  const xml = escapeXml /*xml*/ `
67884
67938
  <sst ${formatAttributes(namespaces)}>
67885
67939
  ${joinXmlNodes(stringNodes)}
@@ -68616,6 +68670,8 @@ stores.inject(MyMetaStore, storeInstance);
68616
68670
  areDomainArgsFieldsValid,
68617
68671
  formatTickValue,
68618
68672
  sanitizeSheetName,
68673
+ isNumber,
68674
+ isDateTime,
68619
68675
  };
68620
68676
  const links = {
68621
68677
  isMarkdownLink,
@@ -68746,9 +68802,9 @@ stores.inject(MyMetaStore, storeInstance);
68746
68802
  exports.tokenize = tokenize;
68747
68803
 
68748
68804
 
68749
- __info__.version = "17.4.16";
68750
- __info__.date = "2024-12-19T07:50:04.021Z";
68751
- __info__.hash = "6b827fc";
68805
+ __info__.version = "17.4.17";
68806
+ __info__.date = "2025-01-14T11:34:44.930Z";
68807
+ __info__.hash = "fd2a7ab";
68752
68808
 
68753
68809
 
68754
68810
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);