@odoo/o-spreadsheet 17.3.3 → 17.3.4

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.3.3
7
- * @date 2024-06-14T10:02:58.082Z
8
- * @hash c690e9f
6
+ * @version 17.3.4
7
+ * @date 2024-06-21T20:00:08.515Z
8
+ * @hash 6efbf3b
9
9
  */
10
10
 
11
11
  'use strict';
@@ -9461,10 +9461,8 @@ class ComposerStore extends SpreadsheetStore {
9461
9461
  const refRange = this.getters.getRangeFromSheetXC(activeSheetId, xc);
9462
9462
  return isEqual(this.getters.expandZone(activeSheetId, refRange.zone), oldZone);
9463
9463
  });
9464
- // this function assumes that the previous range is always found because
9465
- // it's called when changing a highlight, which exists by definition
9466
9464
  if (!previousRefToken) {
9467
- throw new Error("Previous range not found");
9465
+ return;
9468
9466
  }
9469
9467
  const previousRange = this.getters.getRangeFromSheetXC(activeSheetId, previousRefToken.value);
9470
9468
  this.selectionStart = previousRefToken.start;
@@ -34926,7 +34924,7 @@ function createMeasure(fields, measure) {
34926
34924
  function createPivotDimension(fields, dimension) {
34927
34925
  const field = fields[dimension.name];
34928
34926
  const type = field?.type ?? "integer";
34929
- const granularity = field && isDateField(field) ? dimension.granularity ?? "month_number" : undefined;
34927
+ const granularity = field && isDateField(field) ? dimension.granularity : undefined;
34930
34928
  return {
34931
34929
  /**
34932
34930
  * Get the display name of the dimension
@@ -35329,10 +35327,13 @@ function compareDimensionValues(dimension, a, b) {
35329
35327
  }
35330
35328
 
35331
35329
  function createDate(dimension, value, locale) {
35332
- const granularity = dimension.granularity || "month_number";
35333
- if (!(granularity in MAP_VALUE_DIMENSION_DATE)) {
35330
+ const granularity = dimension.granularity;
35331
+ if (!granularity || !(granularity in MAP_VALUE_DIMENSION_DATE)) {
35334
35332
  throw new Error(`Unknown date granularity: ${granularity}`);
35335
35333
  }
35334
+ if (value === null) {
35335
+ return null;
35336
+ }
35336
35337
  if (!MAP_VALUE_DIMENSION_DATE[granularity].set.has(value)) {
35337
35338
  MAP_VALUE_DIMENSION_DATE[granularity].set.add(value);
35338
35339
  const date = toJsDate(value, locale);
@@ -35559,7 +35560,8 @@ class SpreadsheetPivot {
35559
35560
  if (!finalCell) {
35560
35561
  return { value: "" };
35561
35562
  }
35562
- if (finalCell.value === null) {
35563
+ // Value can be null but stringified (e.g. an empty date, as for now every date is stringified)
35564
+ if (finalCell.value === null || finalCell.value === `${null}`) {
35563
35565
  return { value: _t("(Undefined)") };
35564
35566
  }
35565
35567
  if (dimension.type === "date") {
@@ -35595,10 +35597,15 @@ class SpreadsheetPivot {
35595
35597
  if (!operator) {
35596
35598
  throw new Error(`Aggregator ${aggregator} does not exist`);
35597
35599
  }
35598
- return {
35599
- value: values.length ? operator.fn([values], this.getters.getLocale()) : "",
35600
- format: operator.format(values[0]),
35601
- };
35600
+ try {
35601
+ return {
35602
+ value: values.length ? operator.fn([values], this.getters.getLocale()) : "",
35603
+ format: operator.format(values[0]),
35604
+ };
35605
+ }
35606
+ catch (e) {
35607
+ return handleError(e, aggregator.toUpperCase());
35608
+ }
35602
35609
  }
35603
35610
  getPossibleFieldValues(groupBy) {
35604
35611
  //TODO This method should be implemented for the autocomplete feature
@@ -52840,7 +52847,6 @@ class Evaluator {
52840
52847
  if (!this.blockedArrayFormulas.has(position)) {
52841
52848
  this.invalidateSpreading(position);
52842
52849
  }
52843
- this.spreadingRelations.removeNode(position);
52844
52850
  const cell = this.getters.getCell(position);
52845
52851
  if (cell === undefined) {
52846
52852
  return EMPTY_CELL;
@@ -52882,6 +52888,7 @@ class Evaluator {
52882
52888
  this.assertSheetHasEnoughSpaceToSpreadFormulaResult(formulaPosition, formulaReturn);
52883
52889
  const nbColumns = formulaReturn.length;
52884
52890
  const nbRows = formulaReturn[0].length;
52891
+ this.spreadingRelations.removeNode(formulaPosition);
52885
52892
  forEachSpreadPositionInMatrix(nbColumns, nbRows, this.updateSpreadRelation(formulaPosition));
52886
52893
  this.assertNoMergedCellsInSpreadZone(formulaPosition, formulaReturn);
52887
52894
  forEachSpreadPositionInMatrix(nbColumns, nbRows, this.checkCollision(formulaPosition));
@@ -66983,6 +66990,6 @@ exports.tokenColors = tokenColors;
66983
66990
  exports.tokenize = tokenize;
66984
66991
 
66985
66992
 
66986
- __info__.version = "17.3.3";
66987
- __info__.date = "2024-06-14T10:02:58.082Z";
66988
- __info__.hash = "c690e9f";
66993
+ __info__.version = "17.3.4";
66994
+ __info__.date = "2024-06-21T20:00:08.515Z";
66995
+ __info__.hash = "6efbf3b";
@@ -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.3.3
7
- * @date 2024-06-14T10:02:58.082Z
8
- * @hash c690e9f
6
+ * @version 17.3.4
7
+ * @date 2024-06-21T20:00:08.515Z
8
+ * @hash 6efbf3b
9
9
  */
10
10
 
11
11
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -9459,10 +9459,8 @@ class ComposerStore extends SpreadsheetStore {
9459
9459
  const refRange = this.getters.getRangeFromSheetXC(activeSheetId, xc);
9460
9460
  return isEqual(this.getters.expandZone(activeSheetId, refRange.zone), oldZone);
9461
9461
  });
9462
- // this function assumes that the previous range is always found because
9463
- // it's called when changing a highlight, which exists by definition
9464
9462
  if (!previousRefToken) {
9465
- throw new Error("Previous range not found");
9463
+ return;
9466
9464
  }
9467
9465
  const previousRange = this.getters.getRangeFromSheetXC(activeSheetId, previousRefToken.value);
9468
9466
  this.selectionStart = previousRefToken.start;
@@ -34924,7 +34922,7 @@ function createMeasure(fields, measure) {
34924
34922
  function createPivotDimension(fields, dimension) {
34925
34923
  const field = fields[dimension.name];
34926
34924
  const type = field?.type ?? "integer";
34927
- const granularity = field && isDateField(field) ? dimension.granularity ?? "month_number" : undefined;
34925
+ const granularity = field && isDateField(field) ? dimension.granularity : undefined;
34928
34926
  return {
34929
34927
  /**
34930
34928
  * Get the display name of the dimension
@@ -35327,10 +35325,13 @@ function compareDimensionValues(dimension, a, b) {
35327
35325
  }
35328
35326
 
35329
35327
  function createDate(dimension, value, locale) {
35330
- const granularity = dimension.granularity || "month_number";
35331
- if (!(granularity in MAP_VALUE_DIMENSION_DATE)) {
35328
+ const granularity = dimension.granularity;
35329
+ if (!granularity || !(granularity in MAP_VALUE_DIMENSION_DATE)) {
35332
35330
  throw new Error(`Unknown date granularity: ${granularity}`);
35333
35331
  }
35332
+ if (value === null) {
35333
+ return null;
35334
+ }
35334
35335
  if (!MAP_VALUE_DIMENSION_DATE[granularity].set.has(value)) {
35335
35336
  MAP_VALUE_DIMENSION_DATE[granularity].set.add(value);
35336
35337
  const date = toJsDate(value, locale);
@@ -35557,7 +35558,8 @@ class SpreadsheetPivot {
35557
35558
  if (!finalCell) {
35558
35559
  return { value: "" };
35559
35560
  }
35560
- if (finalCell.value === null) {
35561
+ // Value can be null but stringified (e.g. an empty date, as for now every date is stringified)
35562
+ if (finalCell.value === null || finalCell.value === `${null}`) {
35561
35563
  return { value: _t("(Undefined)") };
35562
35564
  }
35563
35565
  if (dimension.type === "date") {
@@ -35593,10 +35595,15 @@ class SpreadsheetPivot {
35593
35595
  if (!operator) {
35594
35596
  throw new Error(`Aggregator ${aggregator} does not exist`);
35595
35597
  }
35596
- return {
35597
- value: values.length ? operator.fn([values], this.getters.getLocale()) : "",
35598
- format: operator.format(values[0]),
35599
- };
35598
+ try {
35599
+ return {
35600
+ value: values.length ? operator.fn([values], this.getters.getLocale()) : "",
35601
+ format: operator.format(values[0]),
35602
+ };
35603
+ }
35604
+ catch (e) {
35605
+ return handleError(e, aggregator.toUpperCase());
35606
+ }
35600
35607
  }
35601
35608
  getPossibleFieldValues(groupBy) {
35602
35609
  //TODO This method should be implemented for the autocomplete feature
@@ -52838,7 +52845,6 @@ class Evaluator {
52838
52845
  if (!this.blockedArrayFormulas.has(position)) {
52839
52846
  this.invalidateSpreading(position);
52840
52847
  }
52841
- this.spreadingRelations.removeNode(position);
52842
52848
  const cell = this.getters.getCell(position);
52843
52849
  if (cell === undefined) {
52844
52850
  return EMPTY_CELL;
@@ -52880,6 +52886,7 @@ class Evaluator {
52880
52886
  this.assertSheetHasEnoughSpaceToSpreadFormulaResult(formulaPosition, formulaReturn);
52881
52887
  const nbColumns = formulaReturn.length;
52882
52888
  const nbRows = formulaReturn[0].length;
52889
+ this.spreadingRelations.removeNode(formulaPosition);
52883
52890
  forEachSpreadPositionInMatrix(nbColumns, nbRows, this.updateSpreadRelation(formulaPosition));
52884
52891
  this.assertNoMergedCellsInSpreadZone(formulaPosition, formulaReturn);
52885
52892
  forEachSpreadPositionInMatrix(nbColumns, nbRows, this.checkCollision(formulaPosition));
@@ -66938,6 +66945,6 @@ const constants = {
66938
66945
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
66939
66946
 
66940
66947
 
66941
- __info__.version = "17.3.3";
66942
- __info__.date = "2024-06-14T10:02:58.082Z";
66943
- __info__.hash = "c690e9f";
66948
+ __info__.version = "17.3.4";
66949
+ __info__.date = "2024-06-21T20:00:08.515Z";
66950
+ __info__.hash = "6efbf3b";
@@ -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.3.3
7
- * @date 2024-06-14T10:02:58.082Z
8
- * @hash c690e9f
6
+ * @version 17.3.4
7
+ * @date 2024-06-21T20:00:08.515Z
8
+ * @hash 6efbf3b
9
9
  */
10
10
 
11
11
  (function (exports, owl) {
@@ -9460,10 +9460,8 @@ stores.inject(MyMetaStore, storeInstance);
9460
9460
  const refRange = this.getters.getRangeFromSheetXC(activeSheetId, xc);
9461
9461
  return isEqual(this.getters.expandZone(activeSheetId, refRange.zone), oldZone);
9462
9462
  });
9463
- // this function assumes that the previous range is always found because
9464
- // it's called when changing a highlight, which exists by definition
9465
9463
  if (!previousRefToken) {
9466
- throw new Error("Previous range not found");
9464
+ return;
9467
9465
  }
9468
9466
  const previousRange = this.getters.getRangeFromSheetXC(activeSheetId, previousRefToken.value);
9469
9467
  this.selectionStart = previousRefToken.start;
@@ -34925,7 +34923,7 @@ stores.inject(MyMetaStore, storeInstance);
34925
34923
  function createPivotDimension(fields, dimension) {
34926
34924
  const field = fields[dimension.name];
34927
34925
  const type = field?.type ?? "integer";
34928
- const granularity = field && isDateField(field) ? dimension.granularity ?? "month_number" : undefined;
34926
+ const granularity = field && isDateField(field) ? dimension.granularity : undefined;
34929
34927
  return {
34930
34928
  /**
34931
34929
  * Get the display name of the dimension
@@ -35328,10 +35326,13 @@ stores.inject(MyMetaStore, storeInstance);
35328
35326
  }
35329
35327
 
35330
35328
  function createDate(dimension, value, locale) {
35331
- const granularity = dimension.granularity || "month_number";
35332
- if (!(granularity in MAP_VALUE_DIMENSION_DATE)) {
35329
+ const granularity = dimension.granularity;
35330
+ if (!granularity || !(granularity in MAP_VALUE_DIMENSION_DATE)) {
35333
35331
  throw new Error(`Unknown date granularity: ${granularity}`);
35334
35332
  }
35333
+ if (value === null) {
35334
+ return null;
35335
+ }
35335
35336
  if (!MAP_VALUE_DIMENSION_DATE[granularity].set.has(value)) {
35336
35337
  MAP_VALUE_DIMENSION_DATE[granularity].set.add(value);
35337
35338
  const date = toJsDate(value, locale);
@@ -35558,7 +35559,8 @@ stores.inject(MyMetaStore, storeInstance);
35558
35559
  if (!finalCell) {
35559
35560
  return { value: "" };
35560
35561
  }
35561
- if (finalCell.value === null) {
35562
+ // Value can be null but stringified (e.g. an empty date, as for now every date is stringified)
35563
+ if (finalCell.value === null || finalCell.value === `${null}`) {
35562
35564
  return { value: _t("(Undefined)") };
35563
35565
  }
35564
35566
  if (dimension.type === "date") {
@@ -35594,10 +35596,15 @@ stores.inject(MyMetaStore, storeInstance);
35594
35596
  if (!operator) {
35595
35597
  throw new Error(`Aggregator ${aggregator} does not exist`);
35596
35598
  }
35597
- return {
35598
- value: values.length ? operator.fn([values], this.getters.getLocale()) : "",
35599
- format: operator.format(values[0]),
35600
- };
35599
+ try {
35600
+ return {
35601
+ value: values.length ? operator.fn([values], this.getters.getLocale()) : "",
35602
+ format: operator.format(values[0]),
35603
+ };
35604
+ }
35605
+ catch (e) {
35606
+ return handleError(e, aggregator.toUpperCase());
35607
+ }
35601
35608
  }
35602
35609
  getPossibleFieldValues(groupBy) {
35603
35610
  //TODO This method should be implemented for the autocomplete feature
@@ -52839,7 +52846,6 @@ stores.inject(MyMetaStore, storeInstance);
52839
52846
  if (!this.blockedArrayFormulas.has(position)) {
52840
52847
  this.invalidateSpreading(position);
52841
52848
  }
52842
- this.spreadingRelations.removeNode(position);
52843
52849
  const cell = this.getters.getCell(position);
52844
52850
  if (cell === undefined) {
52845
52851
  return EMPTY_CELL;
@@ -52881,6 +52887,7 @@ stores.inject(MyMetaStore, storeInstance);
52881
52887
  this.assertSheetHasEnoughSpaceToSpreadFormulaResult(formulaPosition, formulaReturn);
52882
52888
  const nbColumns = formulaReturn.length;
52883
52889
  const nbRows = formulaReturn[0].length;
52890
+ this.spreadingRelations.removeNode(formulaPosition);
52884
52891
  forEachSpreadPositionInMatrix(nbColumns, nbRows, this.updateSpreadRelation(formulaPosition));
52885
52892
  this.assertNoMergedCellsInSpreadZone(formulaPosition, formulaReturn);
52886
52893
  forEachSpreadPositionInMatrix(nbColumns, nbRows, this.checkCollision(formulaPosition));
@@ -66982,9 +66989,9 @@ stores.inject(MyMetaStore, storeInstance);
66982
66989
  exports.tokenize = tokenize;
66983
66990
 
66984
66991
 
66985
- __info__.version = "17.3.3";
66986
- __info__.date = "2024-06-14T10:02:58.082Z";
66987
- __info__.hash = "c690e9f";
66992
+ __info__.version = "17.3.4";
66993
+ __info__.date = "2024-06-21T20:00:08.515Z";
66994
+ __info__.hash = "6efbf3b";
66988
66995
 
66989
66996
 
66990
66997
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);