@odoo/o-spreadsheet 17.1.14 → 17.1.16

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.1.14
6
- * @date 2024-05-07T10:41:25.690Z
7
- * @hash 622c47c
5
+ * @version 17.1.16
6
+ * @date 2024-05-24T11:27:23.083Z
7
+ * @hash 3a41c3a
8
8
  */
9
9
 
10
10
  'use strict';
@@ -567,8 +567,9 @@ function deepEquals(o1, o2, ignoreFunctions) {
567
567
  return false;
568
568
  }
569
569
  else {
570
- if (ignoreFunctions && typeOfO1Key === "function")
571
- return true;
570
+ if (ignoreFunctions && typeOfO1Key === "function") {
571
+ continue;
572
+ }
572
573
  if (o1[key] !== o2[key])
573
574
  return false;
574
575
  }
@@ -1802,7 +1803,7 @@ class LazyTranslatedString extends String {
1802
1803
  }
1803
1804
  valueOf() {
1804
1805
  const str = super.valueOf();
1805
- return _loaded() ? sprintf(_translate(str), ...this.values) : str;
1806
+ return _loaded() ? sprintf(_translate(str), ...this.values) : sprintf(str, ...this.values);
1806
1807
  }
1807
1808
  toString() {
1808
1809
  return this.valueOf();
@@ -7578,7 +7579,7 @@ function tokenizeString(chars) {
7578
7579
  }
7579
7580
  return null;
7580
7581
  }
7581
- const separatorRegexp = /^[\w\.!\$]+/;
7582
+ const SYMBOL_CHARS = new Set("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.!$");
7582
7583
  /**
7583
7584
  * A "Symbol" is just basically any word-like element that can appear in a
7584
7585
  * formula, which is not a string. So:
@@ -7618,11 +7619,8 @@ function tokenizeSymbol(chars) {
7618
7619
  };
7619
7620
  }
7620
7621
  }
7621
- const match = chars.remaining().match(separatorRegexp);
7622
- if (match) {
7623
- const value = match[0];
7624
- result += value;
7625
- chars.advanceBy(value.length);
7622
+ while (chars.current && SYMBOL_CHARS.has(chars.current)) {
7623
+ result += chars.shift();
7626
7624
  }
7627
7625
  if (result.length) {
7628
7626
  const value = result;
@@ -27180,7 +27178,7 @@ class Composer extends owl.Component {
27180
27178
  "Ctrl+Enter": this.processNewLineEvent,
27181
27179
  Escape: this.processEscapeKey,
27182
27180
  F2: () => console.warn("Not implemented"),
27183
- F4: this.processF4Key,
27181
+ F4: (ev) => this.processF4Key(ev),
27184
27182
  Tab: (ev) => this.processTabKey(ev, "right"),
27185
27183
  "Shift+Tab": (ev) => this.processTabKey(ev, "left"),
27186
27184
  };
@@ -27294,9 +27292,10 @@ class Composer extends owl.Component {
27294
27292
  processEscapeKey() {
27295
27293
  this.env.model.dispatch("CANCEL_EDITION");
27296
27294
  }
27297
- processF4Key() {
27295
+ processF4Key(ev) {
27298
27296
  this.env.model.dispatch("CYCLE_EDITION_REFERENCES");
27299
27297
  this.processContent();
27298
+ ev.stopPropagation();
27300
27299
  }
27301
27300
  processNumpadDecimal(ev) {
27302
27301
  ev.stopPropagation();
@@ -34085,7 +34084,7 @@ const machine = {
34085
34084
  function matchReference(tokens) {
34086
34085
  let head = 0;
34087
34086
  let transitions = machine[State.LeftRef];
34088
- const matchedTokens = [];
34087
+ let matchedTokens = "";
34089
34088
  while (transitions !== undefined) {
34090
34089
  const token = tokens[head++];
34091
34090
  if (!token) {
@@ -34097,15 +34096,15 @@ function matchReference(tokens) {
34097
34096
  case undefined:
34098
34097
  return null;
34099
34098
  case State.Found:
34100
- matchedTokens.push(token);
34099
+ matchedTokens += token.value;
34101
34100
  tokens.splice(0, head);
34102
34101
  return {
34103
34102
  type: "REFERENCE",
34104
- value: concat(matchedTokens.map((token) => token.value)),
34103
+ value: matchedTokens,
34105
34104
  };
34106
34105
  default:
34107
34106
  transitions = machine[nextState];
34108
- matchedTokens.push(token);
34107
+ matchedTokens += token.value;
34109
34108
  break;
34110
34109
  }
34111
34110
  }
@@ -38457,7 +38456,12 @@ class MergePlugin extends CorePlugin {
38457
38456
  * if they have at least a common cell
38458
38457
  */
38459
38458
  doesIntersectMerge(sheetId, zone) {
38460
- return positions(zone).some(({ col, row }) => this.getMerge({ sheetId, col, row }) !== undefined);
38459
+ for (const merge of this.getMerges(sheetId)) {
38460
+ if (overlap(zone, merge)) {
38461
+ return true;
38462
+ }
38463
+ }
38464
+ return false;
38461
38465
  }
38462
38466
  /**
38463
38467
  * Returns true if two columns have at least one merge in common
@@ -48816,7 +48820,7 @@ class ClipboardPlugin extends UIPlugin {
48816
48820
  case "ADD_COLUMNS_ROWS": {
48817
48821
  this.status = "invisible";
48818
48822
  // If we add a col/row inside or before the cut area, we invalidate the clipboard
48819
- if (this.state?.operation !== "CUT") {
48823
+ if (this.state?.operation !== "CUT" || cmd.sheetId !== this.state?.sheetId) {
48820
48824
  return;
48821
48825
  }
48822
48826
  const isClipboardDirty = this.state.isColRowDirtyingClipboard(cmd.position === "before" ? cmd.base : cmd.base + 1, cmd.dimension);
@@ -48828,7 +48832,7 @@ class ClipboardPlugin extends UIPlugin {
48828
48832
  case "REMOVE_COLUMNS_ROWS": {
48829
48833
  this.status = "invisible";
48830
48834
  // If we remove a col/row inside or before the cut area, we invalidate the clipboard
48831
- if (this.state?.operation !== "CUT") {
48835
+ if (this.state?.operation !== "CUT" || cmd.sheetId !== this.state?.sheetId) {
48832
48836
  return;
48833
48837
  }
48834
48838
  for (let el of cmd.elements) {
@@ -53899,6 +53903,10 @@ class Spreadsheet extends owl.Component {
53899
53903
  }, () => [this.env.model.getters.getActiveSheetId()]);
53900
53904
  owl.useExternalListener(window, "resize", () => this.render(true));
53901
53905
  owl.useExternalListener(window, "beforeunload", this.unbindModelEvents.bind(this));
53906
+ // For some reason, the wheel event is not properly registered inside templates
53907
+ // in Chromium-based browsers based on chromium 125
53908
+ // This hack ensures the event declared in the template is properly registered/working
53909
+ owl.useExternalListener(document.body, "wheel", () => { });
53902
53910
  this.bindModelEvents();
53903
53911
  owl.onWillUpdateProps((nextProps) => {
53904
53912
  if (nextProps.model !== this.props.model) {
@@ -57734,6 +57742,6 @@ exports.setTranslationMethod = setTranslationMethod;
57734
57742
  exports.tokenize = tokenize;
57735
57743
 
57736
57744
 
57737
- __info__.version = "17.1.14";
57738
- __info__.date = "2024-05-07T10:41:25.690Z";
57739
- __info__.hash = "622c47c";
57745
+ __info__.version = "17.1.16";
57746
+ __info__.date = "2024-05-24T11:27:23.083Z";
57747
+ __info__.hash = "3a41c3a";
@@ -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.1.14
6
- * @date 2024-05-07T10:41:25.690Z
7
- * @hash 622c47c
5
+ * @version 17.1.16
6
+ * @date 2024-05-24T11:27:23.083Z
7
+ * @hash 3a41c3a
8
8
  */
9
9
 
10
10
  import { Component, useRef, onMounted, onWillUnmount, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
@@ -565,8 +565,9 @@ function deepEquals(o1, o2, ignoreFunctions) {
565
565
  return false;
566
566
  }
567
567
  else {
568
- if (ignoreFunctions && typeOfO1Key === "function")
569
- return true;
568
+ if (ignoreFunctions && typeOfO1Key === "function") {
569
+ continue;
570
+ }
570
571
  if (o1[key] !== o2[key])
571
572
  return false;
572
573
  }
@@ -1800,7 +1801,7 @@ class LazyTranslatedString extends String {
1800
1801
  }
1801
1802
  valueOf() {
1802
1803
  const str = super.valueOf();
1803
- return _loaded() ? sprintf(_translate(str), ...this.values) : str;
1804
+ return _loaded() ? sprintf(_translate(str), ...this.values) : sprintf(str, ...this.values);
1804
1805
  }
1805
1806
  toString() {
1806
1807
  return this.valueOf();
@@ -7576,7 +7577,7 @@ function tokenizeString(chars) {
7576
7577
  }
7577
7578
  return null;
7578
7579
  }
7579
- const separatorRegexp = /^[\w\.!\$]+/;
7580
+ const SYMBOL_CHARS = new Set("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.!$");
7580
7581
  /**
7581
7582
  * A "Symbol" is just basically any word-like element that can appear in a
7582
7583
  * formula, which is not a string. So:
@@ -7616,11 +7617,8 @@ function tokenizeSymbol(chars) {
7616
7617
  };
7617
7618
  }
7618
7619
  }
7619
- const match = chars.remaining().match(separatorRegexp);
7620
- if (match) {
7621
- const value = match[0];
7622
- result += value;
7623
- chars.advanceBy(value.length);
7620
+ while (chars.current && SYMBOL_CHARS.has(chars.current)) {
7621
+ result += chars.shift();
7624
7622
  }
7625
7623
  if (result.length) {
7626
7624
  const value = result;
@@ -27178,7 +27176,7 @@ class Composer extends Component {
27178
27176
  "Ctrl+Enter": this.processNewLineEvent,
27179
27177
  Escape: this.processEscapeKey,
27180
27178
  F2: () => console.warn("Not implemented"),
27181
- F4: this.processF4Key,
27179
+ F4: (ev) => this.processF4Key(ev),
27182
27180
  Tab: (ev) => this.processTabKey(ev, "right"),
27183
27181
  "Shift+Tab": (ev) => this.processTabKey(ev, "left"),
27184
27182
  };
@@ -27292,9 +27290,10 @@ class Composer extends Component {
27292
27290
  processEscapeKey() {
27293
27291
  this.env.model.dispatch("CANCEL_EDITION");
27294
27292
  }
27295
- processF4Key() {
27293
+ processF4Key(ev) {
27296
27294
  this.env.model.dispatch("CYCLE_EDITION_REFERENCES");
27297
27295
  this.processContent();
27296
+ ev.stopPropagation();
27298
27297
  }
27299
27298
  processNumpadDecimal(ev) {
27300
27299
  ev.stopPropagation();
@@ -34083,7 +34082,7 @@ const machine = {
34083
34082
  function matchReference(tokens) {
34084
34083
  let head = 0;
34085
34084
  let transitions = machine[State.LeftRef];
34086
- const matchedTokens = [];
34085
+ let matchedTokens = "";
34087
34086
  while (transitions !== undefined) {
34088
34087
  const token = tokens[head++];
34089
34088
  if (!token) {
@@ -34095,15 +34094,15 @@ function matchReference(tokens) {
34095
34094
  case undefined:
34096
34095
  return null;
34097
34096
  case State.Found:
34098
- matchedTokens.push(token);
34097
+ matchedTokens += token.value;
34099
34098
  tokens.splice(0, head);
34100
34099
  return {
34101
34100
  type: "REFERENCE",
34102
- value: concat(matchedTokens.map((token) => token.value)),
34101
+ value: matchedTokens,
34103
34102
  };
34104
34103
  default:
34105
34104
  transitions = machine[nextState];
34106
- matchedTokens.push(token);
34105
+ matchedTokens += token.value;
34107
34106
  break;
34108
34107
  }
34109
34108
  }
@@ -38455,7 +38454,12 @@ class MergePlugin extends CorePlugin {
38455
38454
  * if they have at least a common cell
38456
38455
  */
38457
38456
  doesIntersectMerge(sheetId, zone) {
38458
- return positions(zone).some(({ col, row }) => this.getMerge({ sheetId, col, row }) !== undefined);
38457
+ for (const merge of this.getMerges(sheetId)) {
38458
+ if (overlap(zone, merge)) {
38459
+ return true;
38460
+ }
38461
+ }
38462
+ return false;
38459
38463
  }
38460
38464
  /**
38461
38465
  * Returns true if two columns have at least one merge in common
@@ -48814,7 +48818,7 @@ class ClipboardPlugin extends UIPlugin {
48814
48818
  case "ADD_COLUMNS_ROWS": {
48815
48819
  this.status = "invisible";
48816
48820
  // If we add a col/row inside or before the cut area, we invalidate the clipboard
48817
- if (this.state?.operation !== "CUT") {
48821
+ if (this.state?.operation !== "CUT" || cmd.sheetId !== this.state?.sheetId) {
48818
48822
  return;
48819
48823
  }
48820
48824
  const isClipboardDirty = this.state.isColRowDirtyingClipboard(cmd.position === "before" ? cmd.base : cmd.base + 1, cmd.dimension);
@@ -48826,7 +48830,7 @@ class ClipboardPlugin extends UIPlugin {
48826
48830
  case "REMOVE_COLUMNS_ROWS": {
48827
48831
  this.status = "invisible";
48828
48832
  // If we remove a col/row inside or before the cut area, we invalidate the clipboard
48829
- if (this.state?.operation !== "CUT") {
48833
+ if (this.state?.operation !== "CUT" || cmd.sheetId !== this.state?.sheetId) {
48830
48834
  return;
48831
48835
  }
48832
48836
  for (let el of cmd.elements) {
@@ -53897,6 +53901,10 @@ class Spreadsheet extends Component {
53897
53901
  }, () => [this.env.model.getters.getActiveSheetId()]);
53898
53902
  useExternalListener(window, "resize", () => this.render(true));
53899
53903
  useExternalListener(window, "beforeunload", this.unbindModelEvents.bind(this));
53904
+ // For some reason, the wheel event is not properly registered inside templates
53905
+ // in Chromium-based browsers based on chromium 125
53906
+ // This hack ensures the event declared in the template is properly registered/working
53907
+ useExternalListener(document.body, "wheel", () => { });
53900
53908
  this.bindModelEvents();
53901
53909
  onWillUpdateProps((nextProps) => {
53902
53910
  if (nextProps.model !== this.props.model) {
@@ -57696,6 +57704,6 @@ const constants = {
57696
57704
  export { AbstractChart, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
57697
57705
 
57698
57706
 
57699
- __info__.version = "17.1.14";
57700
- __info__.date = "2024-05-07T10:41:25.690Z";
57701
- __info__.hash = "622c47c";
57707
+ __info__.version = "17.1.16";
57708
+ __info__.date = "2024-05-24T11:27:23.083Z";
57709
+ __info__.hash = "3a41c3a";
@@ -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.1.14
6
- * @date 2024-05-07T10:41:25.690Z
7
- * @hash 622c47c
5
+ * @version 17.1.16
6
+ * @date 2024-05-24T11:27:23.083Z
7
+ * @hash 3a41c3a
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -566,8 +566,9 @@
566
566
  return false;
567
567
  }
568
568
  else {
569
- if (ignoreFunctions && typeOfO1Key === "function")
570
- return true;
569
+ if (ignoreFunctions && typeOfO1Key === "function") {
570
+ continue;
571
+ }
571
572
  if (o1[key] !== o2[key])
572
573
  return false;
573
574
  }
@@ -1801,7 +1802,7 @@
1801
1802
  }
1802
1803
  valueOf() {
1803
1804
  const str = super.valueOf();
1804
- return _loaded() ? sprintf(_translate(str), ...this.values) : str;
1805
+ return _loaded() ? sprintf(_translate(str), ...this.values) : sprintf(str, ...this.values);
1805
1806
  }
1806
1807
  toString() {
1807
1808
  return this.valueOf();
@@ -7577,7 +7578,7 @@
7577
7578
  }
7578
7579
  return null;
7579
7580
  }
7580
- const separatorRegexp = /^[\w\.!\$]+/;
7581
+ const SYMBOL_CHARS = new Set("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.!$");
7581
7582
  /**
7582
7583
  * A "Symbol" is just basically any word-like element that can appear in a
7583
7584
  * formula, which is not a string. So:
@@ -7617,11 +7618,8 @@
7617
7618
  };
7618
7619
  }
7619
7620
  }
7620
- const match = chars.remaining().match(separatorRegexp);
7621
- if (match) {
7622
- const value = match[0];
7623
- result += value;
7624
- chars.advanceBy(value.length);
7621
+ while (chars.current && SYMBOL_CHARS.has(chars.current)) {
7622
+ result += chars.shift();
7625
7623
  }
7626
7624
  if (result.length) {
7627
7625
  const value = result;
@@ -27179,7 +27177,7 @@
27179
27177
  "Ctrl+Enter": this.processNewLineEvent,
27180
27178
  Escape: this.processEscapeKey,
27181
27179
  F2: () => console.warn("Not implemented"),
27182
- F4: this.processF4Key,
27180
+ F4: (ev) => this.processF4Key(ev),
27183
27181
  Tab: (ev) => this.processTabKey(ev, "right"),
27184
27182
  "Shift+Tab": (ev) => this.processTabKey(ev, "left"),
27185
27183
  };
@@ -27293,9 +27291,10 @@
27293
27291
  processEscapeKey() {
27294
27292
  this.env.model.dispatch("CANCEL_EDITION");
27295
27293
  }
27296
- processF4Key() {
27294
+ processF4Key(ev) {
27297
27295
  this.env.model.dispatch("CYCLE_EDITION_REFERENCES");
27298
27296
  this.processContent();
27297
+ ev.stopPropagation();
27299
27298
  }
27300
27299
  processNumpadDecimal(ev) {
27301
27300
  ev.stopPropagation();
@@ -34084,7 +34083,7 @@
34084
34083
  function matchReference(tokens) {
34085
34084
  let head = 0;
34086
34085
  let transitions = machine[State.LeftRef];
34087
- const matchedTokens = [];
34086
+ let matchedTokens = "";
34088
34087
  while (transitions !== undefined) {
34089
34088
  const token = tokens[head++];
34090
34089
  if (!token) {
@@ -34096,15 +34095,15 @@
34096
34095
  case undefined:
34097
34096
  return null;
34098
34097
  case State.Found:
34099
- matchedTokens.push(token);
34098
+ matchedTokens += token.value;
34100
34099
  tokens.splice(0, head);
34101
34100
  return {
34102
34101
  type: "REFERENCE",
34103
- value: concat(matchedTokens.map((token) => token.value)),
34102
+ value: matchedTokens,
34104
34103
  };
34105
34104
  default:
34106
34105
  transitions = machine[nextState];
34107
- matchedTokens.push(token);
34106
+ matchedTokens += token.value;
34108
34107
  break;
34109
34108
  }
34110
34109
  }
@@ -38456,7 +38455,12 @@
38456
38455
  * if they have at least a common cell
38457
38456
  */
38458
38457
  doesIntersectMerge(sheetId, zone) {
38459
- return positions(zone).some(({ col, row }) => this.getMerge({ sheetId, col, row }) !== undefined);
38458
+ for (const merge of this.getMerges(sheetId)) {
38459
+ if (overlap(zone, merge)) {
38460
+ return true;
38461
+ }
38462
+ }
38463
+ return false;
38460
38464
  }
38461
38465
  /**
38462
38466
  * Returns true if two columns have at least one merge in common
@@ -48815,7 +48819,7 @@
48815
48819
  case "ADD_COLUMNS_ROWS": {
48816
48820
  this.status = "invisible";
48817
48821
  // If we add a col/row inside or before the cut area, we invalidate the clipboard
48818
- if (this.state?.operation !== "CUT") {
48822
+ if (this.state?.operation !== "CUT" || cmd.sheetId !== this.state?.sheetId) {
48819
48823
  return;
48820
48824
  }
48821
48825
  const isClipboardDirty = this.state.isColRowDirtyingClipboard(cmd.position === "before" ? cmd.base : cmd.base + 1, cmd.dimension);
@@ -48827,7 +48831,7 @@
48827
48831
  case "REMOVE_COLUMNS_ROWS": {
48828
48832
  this.status = "invisible";
48829
48833
  // If we remove a col/row inside or before the cut area, we invalidate the clipboard
48830
- if (this.state?.operation !== "CUT") {
48834
+ if (this.state?.operation !== "CUT" || cmd.sheetId !== this.state?.sheetId) {
48831
48835
  return;
48832
48836
  }
48833
48837
  for (let el of cmd.elements) {
@@ -53898,6 +53902,10 @@
53898
53902
  }, () => [this.env.model.getters.getActiveSheetId()]);
53899
53903
  owl.useExternalListener(window, "resize", () => this.render(true));
53900
53904
  owl.useExternalListener(window, "beforeunload", this.unbindModelEvents.bind(this));
53905
+ // For some reason, the wheel event is not properly registered inside templates
53906
+ // in Chromium-based browsers based on chromium 125
53907
+ // This hack ensures the event declared in the template is properly registered/working
53908
+ owl.useExternalListener(document.body, "wheel", () => { });
53901
53909
  this.bindModelEvents();
53902
53910
  owl.onWillUpdateProps((nextProps) => {
53903
53911
  if (nextProps.model !== this.props.model) {
@@ -57733,9 +57741,9 @@
57733
57741
  exports.tokenize = tokenize;
57734
57742
 
57735
57743
 
57736
- __info__.version = "17.1.14";
57737
- __info__.date = "2024-05-07T10:41:25.690Z";
57738
- __info__.hash = "622c47c";
57744
+ __info__.version = "17.1.16";
57745
+ __info__.date = "2024-05-24T11:27:23.083Z";
57746
+ __info__.hash = "3a41c3a";
57739
57747
 
57740
57748
 
57741
57749
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);