@odoo/o-spreadsheet 15.0.21 → 15.0.23

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.
@@ -8308,16 +8308,7 @@ class DateTimeCell extends NumberCell {
8308
8308
  }
8309
8309
  class LinkCell extends AbstractCell {
8310
8310
  constructor(id, content, properties = {}) {
8311
- var _a;
8312
8311
  const link = parseMarkdownLink(content);
8313
- properties = {
8314
- ...properties,
8315
- style: {
8316
- ...properties.style,
8317
- textColor: ((_a = properties.style) === null || _a === void 0 ? void 0 : _a.textColor) || LINK_COLOR,
8318
- underline: true,
8319
- },
8320
- };
8321
8312
  super(id, { value: link.label, type: CellValueType.text }, properties);
8322
8313
  this.link = link;
8323
8314
  this.content = content;
@@ -9542,6 +9533,7 @@ class BordersPlugin extends CorePlugin {
9542
9533
  BordersPlugin.getters = ["getCellBorder"];
9543
9534
 
9544
9535
  const nbspRegexp = new RegExp(String.fromCharCode(160), "g");
9536
+ const LINK_STYLE = { textColor: LINK_COLOR, underline: true };
9545
9537
  /**
9546
9538
  * Core Plugin
9547
9539
  *
@@ -9788,7 +9780,8 @@ class CellPlugin extends CorePlugin {
9788
9780
  return this.buildFormulaContent(sheetId, cell.normalizedText, cell.dependencies);
9789
9781
  }
9790
9782
  getCellStyle(cell) {
9791
- return cell.style || {};
9783
+ const linkStyle = cell.isLink() ? LINK_STYLE : {};
9784
+ return { ...linkStyle, ...cell.style };
9792
9785
  }
9793
9786
  /**
9794
9787
  * Converts a zone to a XC coordinate system
@@ -16764,7 +16757,7 @@ class ClipboardPlugin extends UIPlugin {
16764
16757
  return 0 /* Success */;
16765
16758
  }
16766
16759
  handle(cmd) {
16767
- var _a, _b;
16760
+ var _a, _b, _c, _d;
16768
16761
  switch (cmd.type) {
16769
16762
  case "COPY":
16770
16763
  case "CUT":
@@ -16819,7 +16812,7 @@ class ClipboardPlugin extends UIPlugin {
16819
16812
  case "ADD_COLUMNS_ROWS": {
16820
16813
  this.status = "invisible";
16821
16814
  // If we add a col/row inside or before the cut area, we invalidate the clipboard
16822
- if (((_a = this.state) === null || _a === void 0 ? void 0 : _a.operation) !== "CUT") {
16815
+ if (((_a = this.state) === null || _a === void 0 ? void 0 : _a.operation) !== "CUT" || cmd.sheetId !== ((_b = this.state) === null || _b === void 0 ? void 0 : _b.sheetId)) {
16823
16816
  return;
16824
16817
  }
16825
16818
  const isClipboardDirty = this.isColRowDirtyingClipboard(cmd.position === "before" ? cmd.base : cmd.base + 1, cmd.dimension);
@@ -16831,7 +16824,7 @@ class ClipboardPlugin extends UIPlugin {
16831
16824
  case "REMOVE_COLUMNS_ROWS": {
16832
16825
  this.status = "invisible";
16833
16826
  // If we remove a col/row inside or before the cut area, we invalidate the clipboard
16834
- if (((_b = this.state) === null || _b === void 0 ? void 0 : _b.operation) !== "CUT") {
16827
+ if (((_c = this.state) === null || _c === void 0 ? void 0 : _c.operation) !== "CUT" || cmd.sheetId !== ((_d = this.state) === null || _d === void 0 ? void 0 : _d.sheetId)) {
16835
16828
  return;
16836
16829
  }
16837
16830
  for (let el of cmd.elements) {
@@ -24900,6 +24893,12 @@ function addFormula(cell) {
24900
24893
  else {
24901
24894
  // Shouldn't we always output the value then ?
24902
24895
  const value = cell.value;
24896
+ // If the cell contains a non-exported formula and that is evaluates to
24897
+ // nothing* ,we don't export it.
24898
+ // * non-falsy value are relevant and so are 0 and FALSE, which only leaves
24899
+ // the empty string.
24900
+ if (value === "")
24901
+ return undefined;
24903
24902
  const type = getCellType(value);
24904
24903
  attrs.push(["t", type]);
24905
24904
  node = escapeXml /*xml*/ `<v>${value}</v>`;
@@ -25559,7 +25558,11 @@ function addRows(construct, data, sheet) {
25559
25558
  let cellNode = escapeXml ``;
25560
25559
  // Either formula or static value inside the cell
25561
25560
  if (cell.isFormula) {
25562
- ({ attrs: additionalAttrs, node: cellNode } = addFormula(cell));
25561
+ const res = addFormula(cell);
25562
+ if (!res) {
25563
+ continue;
25564
+ }
25565
+ ({ attrs: additionalAttrs, node: cellNode } = res);
25563
25566
  }
25564
25567
  else if (cell.content && isMarkdownLink(cell.content)) {
25565
25568
  const { label } = parseMarkdownLink(cell.content);
@@ -31523,6 +31526,6 @@ exports.registries = registries;
31523
31526
  exports.setTranslationMethod = setTranslationMethod;
31524
31527
 
31525
31528
 
31526
- __info__.version = '15.0.21';
31527
- __info__.date = '2024-04-10T12:08:56.252Z';
31528
- __info__.hash = '4d672af';
31529
+ __info__.version = '15.0.23';
31530
+ __info__.date = '2024-06-03T14:48:01.637Z';
31531
+ __info__.hash = '60a0171';
@@ -8285,16 +8285,7 @@ class DateTimeCell extends NumberCell {
8285
8285
  }
8286
8286
  class LinkCell extends AbstractCell {
8287
8287
  constructor(id, content, properties = {}) {
8288
- var _a;
8289
8288
  const link = parseMarkdownLink(content);
8290
- properties = {
8291
- ...properties,
8292
- style: {
8293
- ...properties.style,
8294
- textColor: ((_a = properties.style) === null || _a === void 0 ? void 0 : _a.textColor) || LINK_COLOR,
8295
- underline: true,
8296
- },
8297
- };
8298
8289
  super(id, { value: link.label, type: CellValueType.text }, properties);
8299
8290
  this.link = link;
8300
8291
  this.content = content;
@@ -9519,6 +9510,7 @@ class BordersPlugin extends CorePlugin {
9519
9510
  BordersPlugin.getters = ["getCellBorder"];
9520
9511
 
9521
9512
  const nbspRegexp = new RegExp(String.fromCharCode(160), "g");
9513
+ const LINK_STYLE = { textColor: LINK_COLOR, underline: true };
9522
9514
  /**
9523
9515
  * Core Plugin
9524
9516
  *
@@ -9765,7 +9757,8 @@ class CellPlugin extends CorePlugin {
9765
9757
  return this.buildFormulaContent(sheetId, cell.normalizedText, cell.dependencies);
9766
9758
  }
9767
9759
  getCellStyle(cell) {
9768
- return cell.style || {};
9760
+ const linkStyle = cell.isLink() ? LINK_STYLE : {};
9761
+ return { ...linkStyle, ...cell.style };
9769
9762
  }
9770
9763
  /**
9771
9764
  * Converts a zone to a XC coordinate system
@@ -16741,7 +16734,7 @@ class ClipboardPlugin extends UIPlugin {
16741
16734
  return 0 /* Success */;
16742
16735
  }
16743
16736
  handle(cmd) {
16744
- var _a, _b;
16737
+ var _a, _b, _c, _d;
16745
16738
  switch (cmd.type) {
16746
16739
  case "COPY":
16747
16740
  case "CUT":
@@ -16796,7 +16789,7 @@ class ClipboardPlugin extends UIPlugin {
16796
16789
  case "ADD_COLUMNS_ROWS": {
16797
16790
  this.status = "invisible";
16798
16791
  // If we add a col/row inside or before the cut area, we invalidate the clipboard
16799
- if (((_a = this.state) === null || _a === void 0 ? void 0 : _a.operation) !== "CUT") {
16792
+ if (((_a = this.state) === null || _a === void 0 ? void 0 : _a.operation) !== "CUT" || cmd.sheetId !== ((_b = this.state) === null || _b === void 0 ? void 0 : _b.sheetId)) {
16800
16793
  return;
16801
16794
  }
16802
16795
  const isClipboardDirty = this.isColRowDirtyingClipboard(cmd.position === "before" ? cmd.base : cmd.base + 1, cmd.dimension);
@@ -16808,7 +16801,7 @@ class ClipboardPlugin extends UIPlugin {
16808
16801
  case "REMOVE_COLUMNS_ROWS": {
16809
16802
  this.status = "invisible";
16810
16803
  // If we remove a col/row inside or before the cut area, we invalidate the clipboard
16811
- if (((_b = this.state) === null || _b === void 0 ? void 0 : _b.operation) !== "CUT") {
16804
+ if (((_c = this.state) === null || _c === void 0 ? void 0 : _c.operation) !== "CUT" || cmd.sheetId !== ((_d = this.state) === null || _d === void 0 ? void 0 : _d.sheetId)) {
16812
16805
  return;
16813
16806
  }
16814
16807
  for (let el of cmd.elements) {
@@ -24877,6 +24870,12 @@ function addFormula(cell) {
24877
24870
  else {
24878
24871
  // Shouldn't we always output the value then ?
24879
24872
  const value = cell.value;
24873
+ // If the cell contains a non-exported formula and that is evaluates to
24874
+ // nothing* ,we don't export it.
24875
+ // * non-falsy value are relevant and so are 0 and FALSE, which only leaves
24876
+ // the empty string.
24877
+ if (value === "")
24878
+ return undefined;
24880
24879
  const type = getCellType(value);
24881
24880
  attrs.push(["t", type]);
24882
24881
  node = escapeXml /*xml*/ `<v>${value}</v>`;
@@ -25536,7 +25535,11 @@ function addRows(construct, data, sheet) {
25536
25535
  let cellNode = escapeXml ``;
25537
25536
  // Either formula or static value inside the cell
25538
25537
  if (cell.isFormula) {
25539
- ({ attrs: additionalAttrs, node: cellNode } = addFormula(cell));
25538
+ const res = addFormula(cell);
25539
+ if (!res) {
25540
+ continue;
25541
+ }
25542
+ ({ attrs: additionalAttrs, node: cellNode } = res);
25540
25543
  }
25541
25544
  else if (cell.content && isMarkdownLink(cell.content)) {
25542
25545
  const { label } = parseMarkdownLink(cell.content);
@@ -31478,6 +31481,6 @@ const helpers = {
31478
31481
  export { CommandResult, CorePlugin, DATETIME_FORMAT, DataSource, DispatchResult, Model, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, DEBUG as __DEBUG__, __info__, astToFormula, cellTypes, convertAstNodes, coreTypes, functionCache, helpers, invalidateEvaluationCommands, normalize, parse, readonlyAllowedCommands, registries, setTranslationMethod };
31479
31482
 
31480
31483
 
31481
- __info__.version = '15.0.21';
31482
- __info__.date = '2024-04-10T12:08:56.252Z';
31483
- __info__.hash = '4d672af';
31484
+ __info__.version = '15.0.23';
31485
+ __info__.date = '2024-06-03T14:48:01.637Z';
31486
+ __info__.hash = '60a0171';
@@ -8305,16 +8305,7 @@
8305
8305
  }
8306
8306
  class LinkCell extends AbstractCell {
8307
8307
  constructor(id, content, properties = {}) {
8308
- var _a;
8309
8308
  const link = parseMarkdownLink(content);
8310
- properties = {
8311
- ...properties,
8312
- style: {
8313
- ...properties.style,
8314
- textColor: ((_a = properties.style) === null || _a === void 0 ? void 0 : _a.textColor) || LINK_COLOR,
8315
- underline: true,
8316
- },
8317
- };
8318
8309
  super(id, { value: link.label, type: CellValueType.text }, properties);
8319
8310
  this.link = link;
8320
8311
  this.content = content;
@@ -9539,6 +9530,7 @@
9539
9530
  BordersPlugin.getters = ["getCellBorder"];
9540
9531
 
9541
9532
  const nbspRegexp = new RegExp(String.fromCharCode(160), "g");
9533
+ const LINK_STYLE = { textColor: LINK_COLOR, underline: true };
9542
9534
  /**
9543
9535
  * Core Plugin
9544
9536
  *
@@ -9785,7 +9777,8 @@
9785
9777
  return this.buildFormulaContent(sheetId, cell.normalizedText, cell.dependencies);
9786
9778
  }
9787
9779
  getCellStyle(cell) {
9788
- return cell.style || {};
9780
+ const linkStyle = cell.isLink() ? LINK_STYLE : {};
9781
+ return { ...linkStyle, ...cell.style };
9789
9782
  }
9790
9783
  /**
9791
9784
  * Converts a zone to a XC coordinate system
@@ -16761,7 +16754,7 @@
16761
16754
  return 0 /* Success */;
16762
16755
  }
16763
16756
  handle(cmd) {
16764
- var _a, _b;
16757
+ var _a, _b, _c, _d;
16765
16758
  switch (cmd.type) {
16766
16759
  case "COPY":
16767
16760
  case "CUT":
@@ -16816,7 +16809,7 @@
16816
16809
  case "ADD_COLUMNS_ROWS": {
16817
16810
  this.status = "invisible";
16818
16811
  // If we add a col/row inside or before the cut area, we invalidate the clipboard
16819
- if (((_a = this.state) === null || _a === void 0 ? void 0 : _a.operation) !== "CUT") {
16812
+ if (((_a = this.state) === null || _a === void 0 ? void 0 : _a.operation) !== "CUT" || cmd.sheetId !== ((_b = this.state) === null || _b === void 0 ? void 0 : _b.sheetId)) {
16820
16813
  return;
16821
16814
  }
16822
16815
  const isClipboardDirty = this.isColRowDirtyingClipboard(cmd.position === "before" ? cmd.base : cmd.base + 1, cmd.dimension);
@@ -16828,7 +16821,7 @@
16828
16821
  case "REMOVE_COLUMNS_ROWS": {
16829
16822
  this.status = "invisible";
16830
16823
  // If we remove a col/row inside or before the cut area, we invalidate the clipboard
16831
- if (((_b = this.state) === null || _b === void 0 ? void 0 : _b.operation) !== "CUT") {
16824
+ if (((_c = this.state) === null || _c === void 0 ? void 0 : _c.operation) !== "CUT" || cmd.sheetId !== ((_d = this.state) === null || _d === void 0 ? void 0 : _d.sheetId)) {
16832
16825
  return;
16833
16826
  }
16834
16827
  for (let el of cmd.elements) {
@@ -24897,6 +24890,12 @@
24897
24890
  else {
24898
24891
  // Shouldn't we always output the value then ?
24899
24892
  const value = cell.value;
24893
+ // If the cell contains a non-exported formula and that is evaluates to
24894
+ // nothing* ,we don't export it.
24895
+ // * non-falsy value are relevant and so are 0 and FALSE, which only leaves
24896
+ // the empty string.
24897
+ if (value === "")
24898
+ return undefined;
24900
24899
  const type = getCellType(value);
24901
24900
  attrs.push(["t", type]);
24902
24901
  node = escapeXml /*xml*/ `<v>${value}</v>`;
@@ -25556,7 +25555,11 @@
25556
25555
  let cellNode = escapeXml ``;
25557
25556
  // Either formula or static value inside the cell
25558
25557
  if (cell.isFormula) {
25559
- ({ attrs: additionalAttrs, node: cellNode } = addFormula(cell));
25558
+ const res = addFormula(cell);
25559
+ if (!res) {
25560
+ continue;
25561
+ }
25562
+ ({ attrs: additionalAttrs, node: cellNode } = res);
25560
25563
  }
25561
25564
  else if (cell.content && isMarkdownLink(cell.content)) {
25562
25565
  const { label } = parseMarkdownLink(cell.content);
@@ -31522,9 +31525,9 @@
31522
31525
  Object.defineProperty(exports, '__esModule', { value: true });
31523
31526
 
31524
31527
 
31525
- __info__.version = '15.0.21';
31526
- __info__.date = '2024-04-10T12:08:56.252Z';
31527
- __info__.hash = '4d672af';
31528
+ __info__.version = '15.0.23';
31529
+ __info__.date = '2024-06-03T14:48:01.637Z';
31530
+ __info__.hash = '60a0171';
31528
31531
 
31529
31532
 
31530
31533
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);