@odoo/o-spreadsheet 17.0.21 → 17.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.
@@ -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.21
6
- * @date 2024-05-07T10:39:36.750Z
7
- * @hash 998bea0
5
+ * @version 17.0.23
6
+ * @date 2024-05-24T11:27:27.416Z
7
+ * @hash 6c10fec
8
8
  */
9
9
 
10
10
  'use strict';
@@ -47,7 +47,7 @@ class LazyTranslatedString extends String {
47
47
  }
48
48
  valueOf() {
49
49
  const str = super.valueOf();
50
- return _loaded() ? sprintf(_translate(str), ...this.values) : str;
50
+ return _loaded() ? sprintf(_translate(str), ...this.values) : sprintf(str, ...this.values);
51
51
  }
52
52
  toString() {
53
53
  return this.valueOf();
@@ -666,8 +666,9 @@ function deepEquals(o1, o2, ignoreFunctions) {
666
666
  return false;
667
667
  }
668
668
  else {
669
- if (ignoreFunctions && typeOfO1Key === "function")
670
- return true;
669
+ if (ignoreFunctions && typeOfO1Key === "function") {
670
+ continue;
671
+ }
671
672
  if (o1[key] !== o2[key])
672
673
  return false;
673
674
  }
@@ -7512,7 +7513,7 @@ function tokenizeString(chars) {
7512
7513
  }
7513
7514
  return null;
7514
7515
  }
7515
- const separatorRegexp = /^[\w\.!\$]+/;
7516
+ const SYMBOL_CHARS = new Set("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.!$");
7516
7517
  /**
7517
7518
  * A "Symbol" is just basically any word-like element that can appear in a
7518
7519
  * formula, which is not a string. So:
@@ -7552,11 +7553,8 @@ function tokenizeSymbol(chars) {
7552
7553
  };
7553
7554
  }
7554
7555
  }
7555
- const match = chars.remaining().match(separatorRegexp);
7556
- if (match) {
7557
- const value = match[0];
7558
- result += value;
7559
- chars.advanceBy(value.length);
7556
+ while (chars.current && SYMBOL_CHARS.has(chars.current)) {
7557
+ result += chars.shift();
7560
7558
  }
7561
7559
  if (result.length) {
7562
7560
  const value = result;
@@ -26668,7 +26666,7 @@ class Composer extends owl.Component {
26668
26666
  Enter: this.processEnterKey,
26669
26667
  Escape: this.processEscapeKey,
26670
26668
  F2: () => console.warn("Not implemented"),
26671
- F4: this.processF4Key,
26669
+ F4: (ev) => this.processF4Key(ev),
26672
26670
  Tab: (ev) => this.processTabKey(ev),
26673
26671
  };
26674
26672
  keyCodeMapping = {
@@ -26773,9 +26771,10 @@ class Composer extends owl.Component {
26773
26771
  processEscapeKey() {
26774
26772
  this.env.model.dispatch("CANCEL_EDITION");
26775
26773
  }
26776
- processF4Key() {
26774
+ processF4Key(ev) {
26777
26775
  this.env.model.dispatch("CYCLE_EDITION_REFERENCES");
26778
26776
  this.processContent();
26777
+ ev.stopPropagation();
26779
26778
  }
26780
26779
  processNumpadDecimal(ev) {
26781
26780
  ev.stopPropagation();
@@ -33582,7 +33581,7 @@ const machine = {
33582
33581
  function matchReference(tokens) {
33583
33582
  let head = 0;
33584
33583
  let transitions = machine[State.LeftRef];
33585
- const matchedTokens = [];
33584
+ let matchedTokens = "";
33586
33585
  while (transitions !== undefined) {
33587
33586
  const token = tokens[head++];
33588
33587
  if (!token) {
@@ -33594,15 +33593,15 @@ function matchReference(tokens) {
33594
33593
  case undefined:
33595
33594
  return null;
33596
33595
  case State.Found:
33597
- matchedTokens.push(token);
33596
+ matchedTokens += token.value;
33598
33597
  tokens.splice(0, head);
33599
33598
  return {
33600
33599
  type: "REFERENCE",
33601
- value: concat(matchedTokens.map((token) => token.value)),
33600
+ value: matchedTokens,
33602
33601
  };
33603
33602
  default:
33604
33603
  transitions = machine[nextState];
33605
- matchedTokens.push(token);
33604
+ matchedTokens += token.value;
33606
33605
  break;
33607
33606
  }
33608
33607
  }
@@ -37967,7 +37966,12 @@ class MergePlugin extends CorePlugin {
37967
37966
  * if they have at least a common cell
37968
37967
  */
37969
37968
  doesIntersectMerge(sheetId, zone) {
37970
- return positions(zone).some(({ col, row }) => this.getMerge({ sheetId, col, row }) !== undefined);
37969
+ for (const merge of this.getMerges(sheetId)) {
37970
+ if (overlap(zone, merge)) {
37971
+ return true;
37972
+ }
37973
+ }
37974
+ return false;
37971
37975
  }
37972
37976
  /**
37973
37977
  * Returns true if two columns have at least one merge in common
@@ -48329,7 +48333,7 @@ class ClipboardPlugin extends UIPlugin {
48329
48333
  case "ADD_COLUMNS_ROWS": {
48330
48334
  this.status = "invisible";
48331
48335
  // If we add a col/row inside or before the cut area, we invalidate the clipboard
48332
- if (this.state?.operation !== "CUT") {
48336
+ if (this.state?.operation !== "CUT" || cmd.sheetId !== this.state?.sheetId) {
48333
48337
  return;
48334
48338
  }
48335
48339
  const isClipboardDirty = this.state.isColRowDirtyingClipboard(cmd.position === "before" ? cmd.base : cmd.base + 1, cmd.dimension);
@@ -48341,7 +48345,7 @@ class ClipboardPlugin extends UIPlugin {
48341
48345
  case "REMOVE_COLUMNS_ROWS": {
48342
48346
  this.status = "invisible";
48343
48347
  // If we remove a col/row inside or before the cut area, we invalidate the clipboard
48344
- if (this.state?.operation !== "CUT") {
48348
+ if (this.state?.operation !== "CUT" || cmd.sheetId !== this.state?.sheetId) {
48345
48349
  return;
48346
48350
  }
48347
48351
  for (let el of cmd.elements) {
@@ -53524,6 +53528,10 @@ class Spreadsheet extends owl.Component {
53524
53528
  });
53525
53529
  owl.useExternalListener(window, "resize", () => this.render(true));
53526
53530
  owl.useExternalListener(window, "beforeunload", this.unbindModelEvents.bind(this));
53531
+ // For some reason, the wheel event is not properly registered inside templates
53532
+ // in Chromium-based browsers based on chromium 125
53533
+ // This hack ensures the event declared in the template is properly registered/working
53534
+ owl.useExternalListener(document.body, "wheel", () => { });
53527
53535
  this.bindModelEvents();
53528
53536
  owl.onWillUpdateProps((nextProps) => {
53529
53537
  if (nextProps.model !== this.props.model) {
@@ -57407,6 +57415,6 @@ exports.setTranslationMethod = setTranslationMethod;
57407
57415
  exports.tokenize = tokenize;
57408
57416
 
57409
57417
 
57410
- __info__.version = "17.0.21";
57411
- __info__.date = "2024-05-07T10:39:36.750Z";
57412
- __info__.hash = "998bea0";
57418
+ __info__.version = "17.0.23";
57419
+ __info__.date = "2024-05-24T11:27:27.416Z";
57420
+ __info__.hash = "6c10fec";
@@ -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.21
6
- * @date 2024-05-07T10:39:36.750Z
7
- * @hash 998bea0
5
+ * @version 17.0.23
6
+ * @date 2024-05-24T11:27:27.416Z
7
+ * @hash 6c10fec
8
8
  */
9
9
 
10
10
  import { Component, useRef, onMounted, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillUnmount, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
@@ -45,7 +45,7 @@ class LazyTranslatedString extends String {
45
45
  }
46
46
  valueOf() {
47
47
  const str = super.valueOf();
48
- return _loaded() ? sprintf(_translate(str), ...this.values) : str;
48
+ return _loaded() ? sprintf(_translate(str), ...this.values) : sprintf(str, ...this.values);
49
49
  }
50
50
  toString() {
51
51
  return this.valueOf();
@@ -664,8 +664,9 @@ function deepEquals(o1, o2, ignoreFunctions) {
664
664
  return false;
665
665
  }
666
666
  else {
667
- if (ignoreFunctions && typeOfO1Key === "function")
668
- return true;
667
+ if (ignoreFunctions && typeOfO1Key === "function") {
668
+ continue;
669
+ }
669
670
  if (o1[key] !== o2[key])
670
671
  return false;
671
672
  }
@@ -7510,7 +7511,7 @@ function tokenizeString(chars) {
7510
7511
  }
7511
7512
  return null;
7512
7513
  }
7513
- const separatorRegexp = /^[\w\.!\$]+/;
7514
+ const SYMBOL_CHARS = new Set("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.!$");
7514
7515
  /**
7515
7516
  * A "Symbol" is just basically any word-like element that can appear in a
7516
7517
  * formula, which is not a string. So:
@@ -7550,11 +7551,8 @@ function tokenizeSymbol(chars) {
7550
7551
  };
7551
7552
  }
7552
7553
  }
7553
- const match = chars.remaining().match(separatorRegexp);
7554
- if (match) {
7555
- const value = match[0];
7556
- result += value;
7557
- chars.advanceBy(value.length);
7554
+ while (chars.current && SYMBOL_CHARS.has(chars.current)) {
7555
+ result += chars.shift();
7558
7556
  }
7559
7557
  if (result.length) {
7560
7558
  const value = result;
@@ -26666,7 +26664,7 @@ class Composer extends Component {
26666
26664
  Enter: this.processEnterKey,
26667
26665
  Escape: this.processEscapeKey,
26668
26666
  F2: () => console.warn("Not implemented"),
26669
- F4: this.processF4Key,
26667
+ F4: (ev) => this.processF4Key(ev),
26670
26668
  Tab: (ev) => this.processTabKey(ev),
26671
26669
  };
26672
26670
  keyCodeMapping = {
@@ -26771,9 +26769,10 @@ class Composer extends Component {
26771
26769
  processEscapeKey() {
26772
26770
  this.env.model.dispatch("CANCEL_EDITION");
26773
26771
  }
26774
- processF4Key() {
26772
+ processF4Key(ev) {
26775
26773
  this.env.model.dispatch("CYCLE_EDITION_REFERENCES");
26776
26774
  this.processContent();
26775
+ ev.stopPropagation();
26777
26776
  }
26778
26777
  processNumpadDecimal(ev) {
26779
26778
  ev.stopPropagation();
@@ -33580,7 +33579,7 @@ const machine = {
33580
33579
  function matchReference(tokens) {
33581
33580
  let head = 0;
33582
33581
  let transitions = machine[State.LeftRef];
33583
- const matchedTokens = [];
33582
+ let matchedTokens = "";
33584
33583
  while (transitions !== undefined) {
33585
33584
  const token = tokens[head++];
33586
33585
  if (!token) {
@@ -33592,15 +33591,15 @@ function matchReference(tokens) {
33592
33591
  case undefined:
33593
33592
  return null;
33594
33593
  case State.Found:
33595
- matchedTokens.push(token);
33594
+ matchedTokens += token.value;
33596
33595
  tokens.splice(0, head);
33597
33596
  return {
33598
33597
  type: "REFERENCE",
33599
- value: concat(matchedTokens.map((token) => token.value)),
33598
+ value: matchedTokens,
33600
33599
  };
33601
33600
  default:
33602
33601
  transitions = machine[nextState];
33603
- matchedTokens.push(token);
33602
+ matchedTokens += token.value;
33604
33603
  break;
33605
33604
  }
33606
33605
  }
@@ -37965,7 +37964,12 @@ class MergePlugin extends CorePlugin {
37965
37964
  * if they have at least a common cell
37966
37965
  */
37967
37966
  doesIntersectMerge(sheetId, zone) {
37968
- return positions(zone).some(({ col, row }) => this.getMerge({ sheetId, col, row }) !== undefined);
37967
+ for (const merge of this.getMerges(sheetId)) {
37968
+ if (overlap(zone, merge)) {
37969
+ return true;
37970
+ }
37971
+ }
37972
+ return false;
37969
37973
  }
37970
37974
  /**
37971
37975
  * Returns true if two columns have at least one merge in common
@@ -48327,7 +48331,7 @@ class ClipboardPlugin extends UIPlugin {
48327
48331
  case "ADD_COLUMNS_ROWS": {
48328
48332
  this.status = "invisible";
48329
48333
  // If we add a col/row inside or before the cut area, we invalidate the clipboard
48330
- if (this.state?.operation !== "CUT") {
48334
+ if (this.state?.operation !== "CUT" || cmd.sheetId !== this.state?.sheetId) {
48331
48335
  return;
48332
48336
  }
48333
48337
  const isClipboardDirty = this.state.isColRowDirtyingClipboard(cmd.position === "before" ? cmd.base : cmd.base + 1, cmd.dimension);
@@ -48339,7 +48343,7 @@ class ClipboardPlugin extends UIPlugin {
48339
48343
  case "REMOVE_COLUMNS_ROWS": {
48340
48344
  this.status = "invisible";
48341
48345
  // If we remove a col/row inside or before the cut area, we invalidate the clipboard
48342
- if (this.state?.operation !== "CUT") {
48346
+ if (this.state?.operation !== "CUT" || cmd.sheetId !== this.state?.sheetId) {
48343
48347
  return;
48344
48348
  }
48345
48349
  for (let el of cmd.elements) {
@@ -53522,6 +53526,10 @@ class Spreadsheet extends Component {
53522
53526
  });
53523
53527
  useExternalListener(window, "resize", () => this.render(true));
53524
53528
  useExternalListener(window, "beforeunload", this.unbindModelEvents.bind(this));
53529
+ // For some reason, the wheel event is not properly registered inside templates
53530
+ // in Chromium-based browsers based on chromium 125
53531
+ // This hack ensures the event declared in the template is properly registered/working
53532
+ useExternalListener(document.body, "wheel", () => { });
53525
53533
  this.bindModelEvents();
53526
53534
  onWillUpdateProps((nextProps) => {
53527
53535
  if (nextProps.model !== this.props.model) {
@@ -57370,6 +57378,6 @@ const constants = {
57370
57378
  export { AbstractChart, 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 };
57371
57379
 
57372
57380
 
57373
- __info__.version = "17.0.21";
57374
- __info__.date = "2024-05-07T10:39:36.750Z";
57375
- __info__.hash = "998bea0";
57381
+ __info__.version = "17.0.23";
57382
+ __info__.date = "2024-05-24T11:27:27.416Z";
57383
+ __info__.hash = "6c10fec";
@@ -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.21
6
- * @date 2024-05-07T10:39:36.750Z
7
- * @hash 998bea0
5
+ * @version 17.0.23
6
+ * @date 2024-05-24T11:27:27.416Z
7
+ * @hash 6c10fec
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -46,7 +46,7 @@
46
46
  }
47
47
  valueOf() {
48
48
  const str = super.valueOf();
49
- return _loaded() ? sprintf(_translate(str), ...this.values) : str;
49
+ return _loaded() ? sprintf(_translate(str), ...this.values) : sprintf(str, ...this.values);
50
50
  }
51
51
  toString() {
52
52
  return this.valueOf();
@@ -665,8 +665,9 @@
665
665
  return false;
666
666
  }
667
667
  else {
668
- if (ignoreFunctions && typeOfO1Key === "function")
669
- return true;
668
+ if (ignoreFunctions && typeOfO1Key === "function") {
669
+ continue;
670
+ }
670
671
  if (o1[key] !== o2[key])
671
672
  return false;
672
673
  }
@@ -7511,7 +7512,7 @@
7511
7512
  }
7512
7513
  return null;
7513
7514
  }
7514
- const separatorRegexp = /^[\w\.!\$]+/;
7515
+ const SYMBOL_CHARS = new Set("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.!$");
7515
7516
  /**
7516
7517
  * A "Symbol" is just basically any word-like element that can appear in a
7517
7518
  * formula, which is not a string. So:
@@ -7551,11 +7552,8 @@
7551
7552
  };
7552
7553
  }
7553
7554
  }
7554
- const match = chars.remaining().match(separatorRegexp);
7555
- if (match) {
7556
- const value = match[0];
7557
- result += value;
7558
- chars.advanceBy(value.length);
7555
+ while (chars.current && SYMBOL_CHARS.has(chars.current)) {
7556
+ result += chars.shift();
7559
7557
  }
7560
7558
  if (result.length) {
7561
7559
  const value = result;
@@ -26667,7 +26665,7 @@
26667
26665
  Enter: this.processEnterKey,
26668
26666
  Escape: this.processEscapeKey,
26669
26667
  F2: () => console.warn("Not implemented"),
26670
- F4: this.processF4Key,
26668
+ F4: (ev) => this.processF4Key(ev),
26671
26669
  Tab: (ev) => this.processTabKey(ev),
26672
26670
  };
26673
26671
  keyCodeMapping = {
@@ -26772,9 +26770,10 @@
26772
26770
  processEscapeKey() {
26773
26771
  this.env.model.dispatch("CANCEL_EDITION");
26774
26772
  }
26775
- processF4Key() {
26773
+ processF4Key(ev) {
26776
26774
  this.env.model.dispatch("CYCLE_EDITION_REFERENCES");
26777
26775
  this.processContent();
26776
+ ev.stopPropagation();
26778
26777
  }
26779
26778
  processNumpadDecimal(ev) {
26780
26779
  ev.stopPropagation();
@@ -33581,7 +33580,7 @@
33581
33580
  function matchReference(tokens) {
33582
33581
  let head = 0;
33583
33582
  let transitions = machine[State.LeftRef];
33584
- const matchedTokens = [];
33583
+ let matchedTokens = "";
33585
33584
  while (transitions !== undefined) {
33586
33585
  const token = tokens[head++];
33587
33586
  if (!token) {
@@ -33593,15 +33592,15 @@
33593
33592
  case undefined:
33594
33593
  return null;
33595
33594
  case State.Found:
33596
- matchedTokens.push(token);
33595
+ matchedTokens += token.value;
33597
33596
  tokens.splice(0, head);
33598
33597
  return {
33599
33598
  type: "REFERENCE",
33600
- value: concat(matchedTokens.map((token) => token.value)),
33599
+ value: matchedTokens,
33601
33600
  };
33602
33601
  default:
33603
33602
  transitions = machine[nextState];
33604
- matchedTokens.push(token);
33603
+ matchedTokens += token.value;
33605
33604
  break;
33606
33605
  }
33607
33606
  }
@@ -37966,7 +37965,12 @@
37966
37965
  * if they have at least a common cell
37967
37966
  */
37968
37967
  doesIntersectMerge(sheetId, zone) {
37969
- return positions(zone).some(({ col, row }) => this.getMerge({ sheetId, col, row }) !== undefined);
37968
+ for (const merge of this.getMerges(sheetId)) {
37969
+ if (overlap(zone, merge)) {
37970
+ return true;
37971
+ }
37972
+ }
37973
+ return false;
37970
37974
  }
37971
37975
  /**
37972
37976
  * Returns true if two columns have at least one merge in common
@@ -48328,7 +48332,7 @@
48328
48332
  case "ADD_COLUMNS_ROWS": {
48329
48333
  this.status = "invisible";
48330
48334
  // If we add a col/row inside or before the cut area, we invalidate the clipboard
48331
- if (this.state?.operation !== "CUT") {
48335
+ if (this.state?.operation !== "CUT" || cmd.sheetId !== this.state?.sheetId) {
48332
48336
  return;
48333
48337
  }
48334
48338
  const isClipboardDirty = this.state.isColRowDirtyingClipboard(cmd.position === "before" ? cmd.base : cmd.base + 1, cmd.dimension);
@@ -48340,7 +48344,7 @@
48340
48344
  case "REMOVE_COLUMNS_ROWS": {
48341
48345
  this.status = "invisible";
48342
48346
  // If we remove a col/row inside or before the cut area, we invalidate the clipboard
48343
- if (this.state?.operation !== "CUT") {
48347
+ if (this.state?.operation !== "CUT" || cmd.sheetId !== this.state?.sheetId) {
48344
48348
  return;
48345
48349
  }
48346
48350
  for (let el of cmd.elements) {
@@ -53523,6 +53527,10 @@
53523
53527
  });
53524
53528
  owl.useExternalListener(window, "resize", () => this.render(true));
53525
53529
  owl.useExternalListener(window, "beforeunload", this.unbindModelEvents.bind(this));
53530
+ // For some reason, the wheel event is not properly registered inside templates
53531
+ // in Chromium-based browsers based on chromium 125
53532
+ // This hack ensures the event declared in the template is properly registered/working
53533
+ owl.useExternalListener(document.body, "wheel", () => { });
53526
53534
  this.bindModelEvents();
53527
53535
  owl.onWillUpdateProps((nextProps) => {
53528
53536
  if (nextProps.model !== this.props.model) {
@@ -57406,9 +57414,9 @@
57406
57414
  exports.tokenize = tokenize;
57407
57415
 
57408
57416
 
57409
- __info__.version = "17.0.21";
57410
- __info__.date = "2024-05-07T10:39:36.750Z";
57411
- __info__.hash = "998bea0";
57417
+ __info__.version = "17.0.23";
57418
+ __info__.date = "2024-05-24T11:27:27.416Z";
57419
+ __info__.hash = "6c10fec";
57412
57420
 
57413
57421
 
57414
57422
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);