@odoo/o-spreadsheet 18.3.20 → 18.3.21

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.3.20
6
- * @date 2025-09-11T08:45:37.934Z
7
- * @hash ef829f4
5
+ * @version 18.3.21
6
+ * @date 2025-09-19T07:25:12.089Z
7
+ * @hash b64ee85
8
8
  */
9
9
 
10
10
  'use strict';
@@ -864,8 +864,19 @@ function memoize(func) {
864
864
  },
865
865
  }[funcName];
866
866
  }
867
+ /**
868
+ * Removes the specified indexes from the array.
869
+ * Sparse (empty) elements are transformed to undefined (unless their index is explicitly removed).
870
+ */
867
871
  function removeIndexesFromArray(array, indexes) {
868
- return array.filter((_, index) => !indexes.includes(index));
872
+ const toRemove = new Set(indexes);
873
+ const newArray = [];
874
+ for (let i = 0; i < array.length; i++) {
875
+ if (!toRemove.has(i)) {
876
+ newArray.push(array[i]);
877
+ }
878
+ }
879
+ return newArray;
869
880
  }
870
881
  function insertItemsAtIndex(array, items, index) {
871
882
  const newArray = [...array];
@@ -14810,8 +14821,9 @@ function interactiveSort(env, sheetId, anchor, zone, sortDirection, sortOptions)
14810
14821
  }
14811
14822
 
14812
14823
  function sortMatrix(matrix, locale, ...criteria) {
14813
- for (const [i, value] of criteria.entries()) {
14814
- assert(() => value !== undefined, _t("Value for parameter %d is missing, while the function [[FUNCTION_NAME]] expect a number or a range.", i + 1));
14824
+ for (let i = 0; i < criteria.length; i++) {
14825
+ const param = i % 2 === 0 ? "sort_column" : "is_ascending";
14826
+ assert(() => criteria[i] !== undefined, _t("Value for parameter %s is missing in [[FUNCTION_NAME]].", param));
14815
14827
  }
14816
14828
  const sortingOrders = [];
14817
14829
  const sortColumns = [];
@@ -48879,12 +48891,13 @@ class PivotLayoutConfigurator extends owl.Component {
48879
48891
  addCalculatedMeasure() {
48880
48892
  const { measures } = this.props.definition;
48881
48893
  const measureName = this.env.model.getters.generateNewCalculatedMeasureName(measures);
48894
+ const aggregator = "sum";
48882
48895
  this.props.onDimensionsUpdated({
48883
48896
  measures: measures.concat([
48884
48897
  {
48885
- id: this.getMeasureId(measureName),
48898
+ id: this.getMeasureId(measureName, aggregator),
48886
48899
  fieldName: measureName,
48887
- aggregator: "sum",
48900
+ aggregator,
48888
48901
  computedBy: {
48889
48902
  sheetId: this.env.model.getters.getActiveSheetId(),
48890
48903
  formula: "=0",
@@ -66235,7 +66248,7 @@ function withPivotPresentationLayer (PivotClass) {
66235
66248
  return { value: 0 };
66236
66249
  }
66237
66250
  const { columns, rows } = super.definition;
66238
- if (columns.length + rows.length !== domain.length) {
66251
+ if (measure.aggregator && columns.length + rows.length !== domain.length) {
66239
66252
  const values = this.getValuesToAggregate(measure, domain);
66240
66253
  const aggregator = AGGREGATORS_FN[measure.aggregator];
66241
66254
  if (!aggregator) {
@@ -66254,11 +66267,17 @@ function withPivotPresentationLayer (PivotClass) {
66254
66267
  if (columns.find((col) => col.nameWithGranularity === symbolName)) {
66255
66268
  const { colDomain } = domainToColRowDomain(this, domain);
66256
66269
  const symbolIndex = colDomain.findIndex((node) => node.field === symbolName);
66270
+ if (symbolIndex === -1) {
66271
+ return new NotAvailableError();
66272
+ }
66257
66273
  return this.getPivotHeaderValueAndFormat(colDomain.slice(0, symbolIndex + 1));
66258
66274
  }
66259
66275
  if (rows.find((row) => row.nameWithGranularity === symbolName)) {
66260
66276
  const { rowDomain } = domainToColRowDomain(this, domain);
66261
66277
  const symbolIndex = rowDomain.findIndex((row) => row.field === symbolName);
66278
+ if (symbolIndex === -1) {
66279
+ return new NotAvailableError();
66280
+ }
66262
66281
  return this.getPivotHeaderValueAndFormat(rowDomain.slice(0, symbolIndex + 1));
66263
66282
  }
66264
66283
  return this.getPivotCellValueAndFormat(symbolName, domain);
@@ -72054,13 +72073,10 @@ class GridSelectionPlugin extends UIPlugin {
72054
72073
  const deltaCol = isBasedBefore && isCol ? thickness : 0;
72055
72074
  const deltaRow = isBasedBefore && !isCol ? thickness : 0;
72056
72075
  const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
72057
- const originalSize = Object.fromEntries(toRemove.map((element) => {
72058
- const size = isCol
72059
- ? this.getters.getColSize(cmd.sheetId, element)
72060
- : this.getters.getUserRowSize(cmd.sheetId, element);
72061
- const isDefaultCol = isCol && size === DEFAULT_CELL_WIDTH;
72062
- return [element, isDefaultCol ? undefined : size];
72063
- }));
72076
+ const originalSize = {};
72077
+ for (const element of toRemove) {
72078
+ originalSize[element] = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
72079
+ }
72064
72080
  const target = [
72065
72081
  {
72066
72082
  left: isCol ? start + deltaCol : 0,
@@ -72096,11 +72112,11 @@ class GridSelectionPlugin extends UIPlugin {
72096
72112
  for (const element of toRemove) {
72097
72113
  const size = originalSize[element];
72098
72114
  const currentSize = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, currentIndex);
72099
- if (size && size != currentSize) {
72115
+ if (size != currentSize) {
72100
72116
  resizingGroups[size] ??= [];
72101
72117
  resizingGroups[size].push(currentIndex);
72102
- currentIndex += 1;
72103
72118
  }
72119
+ currentIndex += 1;
72104
72120
  }
72105
72121
  for (const size in resizingGroups) {
72106
72122
  this.dispatch("RESIZE_COLUMNS_ROWS", {
@@ -81015,6 +81031,6 @@ exports.tokenColors = tokenColors;
81015
81031
  exports.tokenize = tokenize;
81016
81032
 
81017
81033
 
81018
- __info__.version = "18.3.20";
81019
- __info__.date = "2025-09-11T08:45:37.934Z";
81020
- __info__.hash = "ef829f4";
81034
+ __info__.version = "18.3.21";
81035
+ __info__.date = "2025-09-19T07:25:12.089Z";
81036
+ __info__.hash = "b64ee85";
@@ -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.3.20
6
- * @date 2025-09-11T08:45:37.934Z
7
- * @hash ef829f4
5
+ * @version 18.3.21
6
+ * @date 2025-09-19T07:25:12.089Z
7
+ * @hash b64ee85
8
8
  */
9
9
 
10
10
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, App, blockDom, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -862,8 +862,19 @@ function memoize(func) {
862
862
  },
863
863
  }[funcName];
864
864
  }
865
+ /**
866
+ * Removes the specified indexes from the array.
867
+ * Sparse (empty) elements are transformed to undefined (unless their index is explicitly removed).
868
+ */
865
869
  function removeIndexesFromArray(array, indexes) {
866
- return array.filter((_, index) => !indexes.includes(index));
870
+ const toRemove = new Set(indexes);
871
+ const newArray = [];
872
+ for (let i = 0; i < array.length; i++) {
873
+ if (!toRemove.has(i)) {
874
+ newArray.push(array[i]);
875
+ }
876
+ }
877
+ return newArray;
867
878
  }
868
879
  function insertItemsAtIndex(array, items, index) {
869
880
  const newArray = [...array];
@@ -14808,8 +14819,9 @@ function interactiveSort(env, sheetId, anchor, zone, sortDirection, sortOptions)
14808
14819
  }
14809
14820
 
14810
14821
  function sortMatrix(matrix, locale, ...criteria) {
14811
- for (const [i, value] of criteria.entries()) {
14812
- assert(() => value !== undefined, _t("Value for parameter %d is missing, while the function [[FUNCTION_NAME]] expect a number or a range.", i + 1));
14822
+ for (let i = 0; i < criteria.length; i++) {
14823
+ const param = i % 2 === 0 ? "sort_column" : "is_ascending";
14824
+ assert(() => criteria[i] !== undefined, _t("Value for parameter %s is missing in [[FUNCTION_NAME]].", param));
14813
14825
  }
14814
14826
  const sortingOrders = [];
14815
14827
  const sortColumns = [];
@@ -48877,12 +48889,13 @@ class PivotLayoutConfigurator extends Component {
48877
48889
  addCalculatedMeasure() {
48878
48890
  const { measures } = this.props.definition;
48879
48891
  const measureName = this.env.model.getters.generateNewCalculatedMeasureName(measures);
48892
+ const aggregator = "sum";
48880
48893
  this.props.onDimensionsUpdated({
48881
48894
  measures: measures.concat([
48882
48895
  {
48883
- id: this.getMeasureId(measureName),
48896
+ id: this.getMeasureId(measureName, aggregator),
48884
48897
  fieldName: measureName,
48885
- aggregator: "sum",
48898
+ aggregator,
48886
48899
  computedBy: {
48887
48900
  sheetId: this.env.model.getters.getActiveSheetId(),
48888
48901
  formula: "=0",
@@ -66233,7 +66246,7 @@ function withPivotPresentationLayer (PivotClass) {
66233
66246
  return { value: 0 };
66234
66247
  }
66235
66248
  const { columns, rows } = super.definition;
66236
- if (columns.length + rows.length !== domain.length) {
66249
+ if (measure.aggregator && columns.length + rows.length !== domain.length) {
66237
66250
  const values = this.getValuesToAggregate(measure, domain);
66238
66251
  const aggregator = AGGREGATORS_FN[measure.aggregator];
66239
66252
  if (!aggregator) {
@@ -66252,11 +66265,17 @@ function withPivotPresentationLayer (PivotClass) {
66252
66265
  if (columns.find((col) => col.nameWithGranularity === symbolName)) {
66253
66266
  const { colDomain } = domainToColRowDomain(this, domain);
66254
66267
  const symbolIndex = colDomain.findIndex((node) => node.field === symbolName);
66268
+ if (symbolIndex === -1) {
66269
+ return new NotAvailableError();
66270
+ }
66255
66271
  return this.getPivotHeaderValueAndFormat(colDomain.slice(0, symbolIndex + 1));
66256
66272
  }
66257
66273
  if (rows.find((row) => row.nameWithGranularity === symbolName)) {
66258
66274
  const { rowDomain } = domainToColRowDomain(this, domain);
66259
66275
  const symbolIndex = rowDomain.findIndex((row) => row.field === symbolName);
66276
+ if (symbolIndex === -1) {
66277
+ return new NotAvailableError();
66278
+ }
66260
66279
  return this.getPivotHeaderValueAndFormat(rowDomain.slice(0, symbolIndex + 1));
66261
66280
  }
66262
66281
  return this.getPivotCellValueAndFormat(symbolName, domain);
@@ -72052,13 +72071,10 @@ class GridSelectionPlugin extends UIPlugin {
72052
72071
  const deltaCol = isBasedBefore && isCol ? thickness : 0;
72053
72072
  const deltaRow = isBasedBefore && !isCol ? thickness : 0;
72054
72073
  const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
72055
- const originalSize = Object.fromEntries(toRemove.map((element) => {
72056
- const size = isCol
72057
- ? this.getters.getColSize(cmd.sheetId, element)
72058
- : this.getters.getUserRowSize(cmd.sheetId, element);
72059
- const isDefaultCol = isCol && size === DEFAULT_CELL_WIDTH;
72060
- return [element, isDefaultCol ? undefined : size];
72061
- }));
72074
+ const originalSize = {};
72075
+ for (const element of toRemove) {
72076
+ originalSize[element] = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
72077
+ }
72062
72078
  const target = [
72063
72079
  {
72064
72080
  left: isCol ? start + deltaCol : 0,
@@ -72094,11 +72110,11 @@ class GridSelectionPlugin extends UIPlugin {
72094
72110
  for (const element of toRemove) {
72095
72111
  const size = originalSize[element];
72096
72112
  const currentSize = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, currentIndex);
72097
- if (size && size != currentSize) {
72113
+ if (size != currentSize) {
72098
72114
  resizingGroups[size] ??= [];
72099
72115
  resizingGroups[size].push(currentIndex);
72100
- currentIndex += 1;
72101
72116
  }
72117
+ currentIndex += 1;
72102
72118
  }
72103
72119
  for (const size in resizingGroups) {
72104
72120
  this.dispatch("RESIZE_COLUMNS_ROWS", {
@@ -80967,6 +80983,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
80967
80983
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, CoreViewPlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, chartHelpers, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateChartEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
80968
80984
 
80969
80985
 
80970
- __info__.version = "18.3.20";
80971
- __info__.date = "2025-09-11T08:45:37.934Z";
80972
- __info__.hash = "ef829f4";
80986
+ __info__.version = "18.3.21";
80987
+ __info__.date = "2025-09-19T07:25:12.089Z";
80988
+ __info__.hash = "b64ee85";
@@ -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.3.20
6
- * @date 2025-09-11T08:45:37.934Z
7
- * @hash ef829f4
5
+ * @version 18.3.21
6
+ * @date 2025-09-19T07:25:12.089Z
7
+ * @hash b64ee85
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -863,8 +863,19 @@
863
863
  },
864
864
  }[funcName];
865
865
  }
866
+ /**
867
+ * Removes the specified indexes from the array.
868
+ * Sparse (empty) elements are transformed to undefined (unless their index is explicitly removed).
869
+ */
866
870
  function removeIndexesFromArray(array, indexes) {
867
- return array.filter((_, index) => !indexes.includes(index));
871
+ const toRemove = new Set(indexes);
872
+ const newArray = [];
873
+ for (let i = 0; i < array.length; i++) {
874
+ if (!toRemove.has(i)) {
875
+ newArray.push(array[i]);
876
+ }
877
+ }
878
+ return newArray;
868
879
  }
869
880
  function insertItemsAtIndex(array, items, index) {
870
881
  const newArray = [...array];
@@ -14809,8 +14820,9 @@ stores.inject(MyMetaStore, storeInstance);
14809
14820
  }
14810
14821
 
14811
14822
  function sortMatrix(matrix, locale, ...criteria) {
14812
- for (const [i, value] of criteria.entries()) {
14813
- assert(() => value !== undefined, _t("Value for parameter %d is missing, while the function [[FUNCTION_NAME]] expect a number or a range.", i + 1));
14823
+ for (let i = 0; i < criteria.length; i++) {
14824
+ const param = i % 2 === 0 ? "sort_column" : "is_ascending";
14825
+ assert(() => criteria[i] !== undefined, _t("Value for parameter %s is missing in [[FUNCTION_NAME]].", param));
14814
14826
  }
14815
14827
  const sortingOrders = [];
14816
14828
  const sortColumns = [];
@@ -48878,12 +48890,13 @@ stores.inject(MyMetaStore, storeInstance);
48878
48890
  addCalculatedMeasure() {
48879
48891
  const { measures } = this.props.definition;
48880
48892
  const measureName = this.env.model.getters.generateNewCalculatedMeasureName(measures);
48893
+ const aggregator = "sum";
48881
48894
  this.props.onDimensionsUpdated({
48882
48895
  measures: measures.concat([
48883
48896
  {
48884
- id: this.getMeasureId(measureName),
48897
+ id: this.getMeasureId(measureName, aggregator),
48885
48898
  fieldName: measureName,
48886
- aggregator: "sum",
48899
+ aggregator,
48887
48900
  computedBy: {
48888
48901
  sheetId: this.env.model.getters.getActiveSheetId(),
48889
48902
  formula: "=0",
@@ -66234,7 +66247,7 @@ stores.inject(MyMetaStore, storeInstance);
66234
66247
  return { value: 0 };
66235
66248
  }
66236
66249
  const { columns, rows } = super.definition;
66237
- if (columns.length + rows.length !== domain.length) {
66250
+ if (measure.aggregator && columns.length + rows.length !== domain.length) {
66238
66251
  const values = this.getValuesToAggregate(measure, domain);
66239
66252
  const aggregator = AGGREGATORS_FN[measure.aggregator];
66240
66253
  if (!aggregator) {
@@ -66253,11 +66266,17 @@ stores.inject(MyMetaStore, storeInstance);
66253
66266
  if (columns.find((col) => col.nameWithGranularity === symbolName)) {
66254
66267
  const { colDomain } = domainToColRowDomain(this, domain);
66255
66268
  const symbolIndex = colDomain.findIndex((node) => node.field === symbolName);
66269
+ if (symbolIndex === -1) {
66270
+ return new NotAvailableError();
66271
+ }
66256
66272
  return this.getPivotHeaderValueAndFormat(colDomain.slice(0, symbolIndex + 1));
66257
66273
  }
66258
66274
  if (rows.find((row) => row.nameWithGranularity === symbolName)) {
66259
66275
  const { rowDomain } = domainToColRowDomain(this, domain);
66260
66276
  const symbolIndex = rowDomain.findIndex((row) => row.field === symbolName);
66277
+ if (symbolIndex === -1) {
66278
+ return new NotAvailableError();
66279
+ }
66261
66280
  return this.getPivotHeaderValueAndFormat(rowDomain.slice(0, symbolIndex + 1));
66262
66281
  }
66263
66282
  return this.getPivotCellValueAndFormat(symbolName, domain);
@@ -72053,13 +72072,10 @@ stores.inject(MyMetaStore, storeInstance);
72053
72072
  const deltaCol = isBasedBefore && isCol ? thickness : 0;
72054
72073
  const deltaRow = isBasedBefore && !isCol ? thickness : 0;
72055
72074
  const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
72056
- const originalSize = Object.fromEntries(toRemove.map((element) => {
72057
- const size = isCol
72058
- ? this.getters.getColSize(cmd.sheetId, element)
72059
- : this.getters.getUserRowSize(cmd.sheetId, element);
72060
- const isDefaultCol = isCol && size === DEFAULT_CELL_WIDTH;
72061
- return [element, isDefaultCol ? undefined : size];
72062
- }));
72075
+ const originalSize = {};
72076
+ for (const element of toRemove) {
72077
+ originalSize[element] = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
72078
+ }
72063
72079
  const target = [
72064
72080
  {
72065
72081
  left: isCol ? start + deltaCol : 0,
@@ -72095,11 +72111,11 @@ stores.inject(MyMetaStore, storeInstance);
72095
72111
  for (const element of toRemove) {
72096
72112
  const size = originalSize[element];
72097
72113
  const currentSize = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, currentIndex);
72098
- if (size && size != currentSize) {
72114
+ if (size != currentSize) {
72099
72115
  resizingGroups[size] ??= [];
72100
72116
  resizingGroups[size].push(currentIndex);
72101
- currentIndex += 1;
72102
72117
  }
72118
+ currentIndex += 1;
72103
72119
  }
72104
72120
  for (const size in resizingGroups) {
72105
72121
  this.dispatch("RESIZE_COLUMNS_ROWS", {
@@ -81014,9 +81030,9 @@ stores.inject(MyMetaStore, storeInstance);
81014
81030
  exports.tokenize = tokenize;
81015
81031
 
81016
81032
 
81017
- __info__.version = "18.3.20";
81018
- __info__.date = "2025-09-11T08:45:37.934Z";
81019
- __info__.hash = "ef829f4";
81033
+ __info__.version = "18.3.21";
81034
+ __info__.date = "2025-09-19T07:25:12.089Z";
81035
+ __info__.hash = "b64ee85";
81020
81036
 
81021
81037
 
81022
81038
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);