@odoo/o-spreadsheet 18.0.44 → 18.0.45

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 18.0.44
6
- * @date 2025-09-11T08:43:01.459Z
7
- * @hash 7e6662c
5
+ * @version 18.0.45
6
+ * @date 2025-09-19T07:24:19.143Z
7
+ * @hash 54e799a
8
8
  */
9
9
 
10
10
  'use strict';
@@ -856,8 +856,19 @@ function memoize(func) {
856
856
  },
857
857
  }[funcName];
858
858
  }
859
+ /**
860
+ * Removes the specified indexes from the array.
861
+ * Sparse (empty) elements are transformed to undefined (unless their index is explicitly removed).
862
+ */
859
863
  function removeIndexesFromArray(array, indexes) {
860
- return array.filter((_, index) => !indexes.includes(index));
864
+ const toRemove = new Set(indexes);
865
+ const newArray = [];
866
+ for (let i = 0; i < array.length; i++) {
867
+ if (!toRemove.has(i)) {
868
+ newArray.push(array[i]);
869
+ }
870
+ }
871
+ return newArray;
861
872
  }
862
873
  function insertItemsAtIndex(array, items, index) {
863
874
  const newArray = [...array];
@@ -15099,8 +15110,9 @@ function interactiveSortSelection(env, sheetId, anchor, zone, sortDirection) {
15099
15110
  }
15100
15111
 
15101
15112
  function sortMatrix(matrix, locale, ...criteria) {
15102
- for (const [i, value] of criteria.entries()) {
15103
- assert(() => value !== undefined, _t("Value for parameter %d is missing, while the function [[FUNCTION_NAME]] expect a number or a range.", i + 1));
15113
+ for (let i = 0; i < criteria.length; i++) {
15114
+ const param = i % 2 === 0 ? "sort_column" : "is_ascending";
15115
+ assert(() => criteria[i] !== undefined, _t("Value for parameter %s is missing in [[FUNCTION_NAME]].", param));
15104
15116
  }
15105
15117
  const sortingOrders = [];
15106
15118
  const sortColumns = [];
@@ -43465,7 +43477,7 @@ class PivotMeasureEditor extends owl.Component {
43465
43477
  });
43466
43478
  }
43467
43479
  get isCalculatedMeasureInvalid() {
43468
- return this.env.model.getters.getMeasureCompiledFormula(this.props.measure).isBadExpression;
43480
+ return compile(this.props.measure.computedBy?.formula ?? "").isBadExpression;
43469
43481
  }
43470
43482
  }
43471
43483
 
@@ -43660,12 +43672,13 @@ class PivotLayoutConfigurator extends owl.Component {
43660
43672
  addCalculatedMeasure() {
43661
43673
  const { measures } = this.props.definition;
43662
43674
  const measureName = this.env.model.getters.generateNewCalculatedMeasureName(measures);
43675
+ const aggregator = "sum";
43663
43676
  this.props.onDimensionsUpdated({
43664
43677
  measures: measures.concat([
43665
43678
  {
43666
- id: this.getMeasureId(measureName),
43679
+ id: this.getMeasureId(measureName, aggregator),
43667
43680
  fieldName: measureName,
43668
- aggregator: "sum",
43681
+ aggregator,
43669
43682
  computedBy: {
43670
43683
  sheetId: this.env.model.getters.getActiveSheetId(),
43671
43684
  formula: "=0",
@@ -60728,7 +60741,7 @@ function withPivotPresentationLayer (PivotClass) {
60728
60741
  return { value: 0 };
60729
60742
  }
60730
60743
  const { columns, rows } = super.definition;
60731
- if (columns.length + rows.length !== domain.length) {
60744
+ if (measure.aggregator && columns.length + rows.length !== domain.length) {
60732
60745
  const values = this.getValuesToAggregate(measure, domain);
60733
60746
  const aggregator = AGGREGATORS_FN[measure.aggregator];
60734
60747
  if (!aggregator) {
@@ -60747,11 +60760,17 @@ function withPivotPresentationLayer (PivotClass) {
60747
60760
  if (columns.find((col) => col.nameWithGranularity === symbolName)) {
60748
60761
  const { colDomain } = domainToColRowDomain(this, domain);
60749
60762
  const symbolIndex = colDomain.findIndex((node) => node.field === symbolName);
60763
+ if (symbolIndex === -1) {
60764
+ return new NotAvailableError();
60765
+ }
60750
60766
  return this.getPivotHeaderValueAndFormat(colDomain.slice(0, symbolIndex + 1));
60751
60767
  }
60752
60768
  if (rows.find((row) => row.nameWithGranularity === symbolName)) {
60753
60769
  const { rowDomain } = domainToColRowDomain(this, domain);
60754
60770
  const symbolIndex = rowDomain.findIndex((row) => row.field === symbolName);
60771
+ if (symbolIndex === -1) {
60772
+ return new NotAvailableError();
60773
+ }
60755
60774
  return this.getPivotHeaderValueAndFormat(rowDomain.slice(0, symbolIndex + 1));
60756
60775
  }
60757
60776
  return this.getPivotCellValueAndFormat(symbolName, domain);
@@ -74729,6 +74748,6 @@ exports.tokenColors = tokenColors;
74729
74748
  exports.tokenize = tokenize;
74730
74749
 
74731
74750
 
74732
- __info__.version = "18.0.44";
74733
- __info__.date = "2025-09-11T08:43:01.459Z";
74734
- __info__.hash = "7e6662c";
74751
+ __info__.version = "18.0.45";
74752
+ __info__.date = "2025-09-19T07:24:19.143Z";
74753
+ __info__.hash = "54e799a";
@@ -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 18.0.44
6
- * @date 2025-09-11T08:43:01.459Z
7
- * @hash 7e6662c
5
+ * @version 18.0.45
6
+ * @date 2025-09-19T07:24:19.143Z
7
+ * @hash 54e799a
8
8
  */
9
9
 
10
10
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -854,8 +854,19 @@ function memoize(func) {
854
854
  },
855
855
  }[funcName];
856
856
  }
857
+ /**
858
+ * Removes the specified indexes from the array.
859
+ * Sparse (empty) elements are transformed to undefined (unless their index is explicitly removed).
860
+ */
857
861
  function removeIndexesFromArray(array, indexes) {
858
- return array.filter((_, index) => !indexes.includes(index));
862
+ const toRemove = new Set(indexes);
863
+ const newArray = [];
864
+ for (let i = 0; i < array.length; i++) {
865
+ if (!toRemove.has(i)) {
866
+ newArray.push(array[i]);
867
+ }
868
+ }
869
+ return newArray;
859
870
  }
860
871
  function insertItemsAtIndex(array, items, index) {
861
872
  const newArray = [...array];
@@ -15097,8 +15108,9 @@ function interactiveSortSelection(env, sheetId, anchor, zone, sortDirection) {
15097
15108
  }
15098
15109
 
15099
15110
  function sortMatrix(matrix, locale, ...criteria) {
15100
- for (const [i, value] of criteria.entries()) {
15101
- assert(() => value !== undefined, _t("Value for parameter %d is missing, while the function [[FUNCTION_NAME]] expect a number or a range.", i + 1));
15111
+ for (let i = 0; i < criteria.length; i++) {
15112
+ const param = i % 2 === 0 ? "sort_column" : "is_ascending";
15113
+ assert(() => criteria[i] !== undefined, _t("Value for parameter %s is missing in [[FUNCTION_NAME]].", param));
15102
15114
  }
15103
15115
  const sortingOrders = [];
15104
15116
  const sortColumns = [];
@@ -43463,7 +43475,7 @@ class PivotMeasureEditor extends Component {
43463
43475
  });
43464
43476
  }
43465
43477
  get isCalculatedMeasureInvalid() {
43466
- return this.env.model.getters.getMeasureCompiledFormula(this.props.measure).isBadExpression;
43478
+ return compile(this.props.measure.computedBy?.formula ?? "").isBadExpression;
43467
43479
  }
43468
43480
  }
43469
43481
 
@@ -43658,12 +43670,13 @@ class PivotLayoutConfigurator extends Component {
43658
43670
  addCalculatedMeasure() {
43659
43671
  const { measures } = this.props.definition;
43660
43672
  const measureName = this.env.model.getters.generateNewCalculatedMeasureName(measures);
43673
+ const aggregator = "sum";
43661
43674
  this.props.onDimensionsUpdated({
43662
43675
  measures: measures.concat([
43663
43676
  {
43664
- id: this.getMeasureId(measureName),
43677
+ id: this.getMeasureId(measureName, aggregator),
43665
43678
  fieldName: measureName,
43666
- aggregator: "sum",
43679
+ aggregator,
43667
43680
  computedBy: {
43668
43681
  sheetId: this.env.model.getters.getActiveSheetId(),
43669
43682
  formula: "=0",
@@ -60726,7 +60739,7 @@ function withPivotPresentationLayer (PivotClass) {
60726
60739
  return { value: 0 };
60727
60740
  }
60728
60741
  const { columns, rows } = super.definition;
60729
- if (columns.length + rows.length !== domain.length) {
60742
+ if (measure.aggregator && columns.length + rows.length !== domain.length) {
60730
60743
  const values = this.getValuesToAggregate(measure, domain);
60731
60744
  const aggregator = AGGREGATORS_FN[measure.aggregator];
60732
60745
  if (!aggregator) {
@@ -60745,11 +60758,17 @@ function withPivotPresentationLayer (PivotClass) {
60745
60758
  if (columns.find((col) => col.nameWithGranularity === symbolName)) {
60746
60759
  const { colDomain } = domainToColRowDomain(this, domain);
60747
60760
  const symbolIndex = colDomain.findIndex((node) => node.field === symbolName);
60761
+ if (symbolIndex === -1) {
60762
+ return new NotAvailableError();
60763
+ }
60748
60764
  return this.getPivotHeaderValueAndFormat(colDomain.slice(0, symbolIndex + 1));
60749
60765
  }
60750
60766
  if (rows.find((row) => row.nameWithGranularity === symbolName)) {
60751
60767
  const { rowDomain } = domainToColRowDomain(this, domain);
60752
60768
  const symbolIndex = rowDomain.findIndex((row) => row.field === symbolName);
60769
+ if (symbolIndex === -1) {
60770
+ return new NotAvailableError();
60771
+ }
60753
60772
  return this.getPivotHeaderValueAndFormat(rowDomain.slice(0, symbolIndex + 1));
60754
60773
  }
60755
60774
  return this.getPivotCellValueAndFormat(symbolName, domain);
@@ -74684,6 +74703,6 @@ const constants = {
74684
74703
  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 };
74685
74704
 
74686
74705
 
74687
- __info__.version = "18.0.44";
74688
- __info__.date = "2025-09-11T08:43:01.459Z";
74689
- __info__.hash = "7e6662c";
74706
+ __info__.version = "18.0.45";
74707
+ __info__.date = "2025-09-19T07:24:19.143Z";
74708
+ __info__.hash = "54e799a";
@@ -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 18.0.44
6
- * @date 2025-09-11T08:43:01.459Z
7
- * @hash 7e6662c
5
+ * @version 18.0.45
6
+ * @date 2025-09-19T07:24:19.143Z
7
+ * @hash 54e799a
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -855,8 +855,19 @@
855
855
  },
856
856
  }[funcName];
857
857
  }
858
+ /**
859
+ * Removes the specified indexes from the array.
860
+ * Sparse (empty) elements are transformed to undefined (unless their index is explicitly removed).
861
+ */
858
862
  function removeIndexesFromArray(array, indexes) {
859
- return array.filter((_, index) => !indexes.includes(index));
863
+ const toRemove = new Set(indexes);
864
+ const newArray = [];
865
+ for (let i = 0; i < array.length; i++) {
866
+ if (!toRemove.has(i)) {
867
+ newArray.push(array[i]);
868
+ }
869
+ }
870
+ return newArray;
860
871
  }
861
872
  function insertItemsAtIndex(array, items, index) {
862
873
  const newArray = [...array];
@@ -15098,8 +15109,9 @@ stores.inject(MyMetaStore, storeInstance);
15098
15109
  }
15099
15110
 
15100
15111
  function sortMatrix(matrix, locale, ...criteria) {
15101
- for (const [i, value] of criteria.entries()) {
15102
- assert(() => value !== undefined, _t("Value for parameter %d is missing, while the function [[FUNCTION_NAME]] expect a number or a range.", i + 1));
15112
+ for (let i = 0; i < criteria.length; i++) {
15113
+ const param = i % 2 === 0 ? "sort_column" : "is_ascending";
15114
+ assert(() => criteria[i] !== undefined, _t("Value for parameter %s is missing in [[FUNCTION_NAME]].", param));
15103
15115
  }
15104
15116
  const sortingOrders = [];
15105
15117
  const sortColumns = [];
@@ -43464,7 +43476,7 @@ stores.inject(MyMetaStore, storeInstance);
43464
43476
  });
43465
43477
  }
43466
43478
  get isCalculatedMeasureInvalid() {
43467
- return this.env.model.getters.getMeasureCompiledFormula(this.props.measure).isBadExpression;
43479
+ return compile(this.props.measure.computedBy?.formula ?? "").isBadExpression;
43468
43480
  }
43469
43481
  }
43470
43482
 
@@ -43659,12 +43671,13 @@ stores.inject(MyMetaStore, storeInstance);
43659
43671
  addCalculatedMeasure() {
43660
43672
  const { measures } = this.props.definition;
43661
43673
  const measureName = this.env.model.getters.generateNewCalculatedMeasureName(measures);
43674
+ const aggregator = "sum";
43662
43675
  this.props.onDimensionsUpdated({
43663
43676
  measures: measures.concat([
43664
43677
  {
43665
- id: this.getMeasureId(measureName),
43678
+ id: this.getMeasureId(measureName, aggregator),
43666
43679
  fieldName: measureName,
43667
- aggregator: "sum",
43680
+ aggregator,
43668
43681
  computedBy: {
43669
43682
  sheetId: this.env.model.getters.getActiveSheetId(),
43670
43683
  formula: "=0",
@@ -60727,7 +60740,7 @@ stores.inject(MyMetaStore, storeInstance);
60727
60740
  return { value: 0 };
60728
60741
  }
60729
60742
  const { columns, rows } = super.definition;
60730
- if (columns.length + rows.length !== domain.length) {
60743
+ if (measure.aggregator && columns.length + rows.length !== domain.length) {
60731
60744
  const values = this.getValuesToAggregate(measure, domain);
60732
60745
  const aggregator = AGGREGATORS_FN[measure.aggregator];
60733
60746
  if (!aggregator) {
@@ -60746,11 +60759,17 @@ stores.inject(MyMetaStore, storeInstance);
60746
60759
  if (columns.find((col) => col.nameWithGranularity === symbolName)) {
60747
60760
  const { colDomain } = domainToColRowDomain(this, domain);
60748
60761
  const symbolIndex = colDomain.findIndex((node) => node.field === symbolName);
60762
+ if (symbolIndex === -1) {
60763
+ return new NotAvailableError();
60764
+ }
60749
60765
  return this.getPivotHeaderValueAndFormat(colDomain.slice(0, symbolIndex + 1));
60750
60766
  }
60751
60767
  if (rows.find((row) => row.nameWithGranularity === symbolName)) {
60752
60768
  const { rowDomain } = domainToColRowDomain(this, domain);
60753
60769
  const symbolIndex = rowDomain.findIndex((row) => row.field === symbolName);
60770
+ if (symbolIndex === -1) {
60771
+ return new NotAvailableError();
60772
+ }
60754
60773
  return this.getPivotHeaderValueAndFormat(rowDomain.slice(0, symbolIndex + 1));
60755
60774
  }
60756
60775
  return this.getPivotCellValueAndFormat(symbolName, domain);
@@ -74728,9 +74747,9 @@ stores.inject(MyMetaStore, storeInstance);
74728
74747
  exports.tokenize = tokenize;
74729
74748
 
74730
74749
 
74731
- __info__.version = "18.0.44";
74732
- __info__.date = "2025-09-11T08:43:01.459Z";
74733
- __info__.hash = "7e6662c";
74750
+ __info__.version = "18.0.45";
74751
+ __info__.date = "2025-09-19T07:24:19.143Z";
74752
+ __info__.hash = "54e799a";
74734
74753
 
74735
74754
 
74736
74755
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);