@odoo/o-spreadsheet 18.4.10 → 18.4.11

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.4.10
6
- * @date 2025-09-11T08:45:39.178Z
7
- * @hash 15a11a4
5
+ * @version 18.4.11
6
+ * @date 2025-09-19T07:25:39.033Z
7
+ * @hash c7e71ac
8
8
  */
9
9
 
10
10
  'use strict';
@@ -891,8 +891,19 @@ function memoize(func) {
891
891
  },
892
892
  }[funcName];
893
893
  }
894
+ /**
895
+ * Removes the specified indexes from the array.
896
+ * Sparse (empty) elements are transformed to undefined (unless their index is explicitly removed).
897
+ */
894
898
  function removeIndexesFromArray(array, indexes) {
895
- return array.filter((_, index) => !indexes.includes(index));
899
+ const toRemove = new Set(indexes);
900
+ const newArray = [];
901
+ for (let i = 0; i < array.length; i++) {
902
+ if (!toRemove.has(i)) {
903
+ newArray.push(array[i]);
904
+ }
905
+ }
906
+ return newArray;
896
907
  }
897
908
  function insertItemsAtIndex(array, items, index) {
898
909
  const newArray = [...array];
@@ -15205,8 +15216,9 @@ function interactiveSort(env, sheetId, anchor, zone, sortDirection, sortOptions)
15205
15216
  }
15206
15217
 
15207
15218
  function sortMatrix(matrix, locale, ...criteria) {
15208
- for (const [i, value] of criteria.entries()) {
15209
- assert(value !== undefined, _t("Value for parameter %d is missing, while the function [[FUNCTION_NAME]] expect a number or a range.", i + 1));
15219
+ for (let i = 0; i < criteria.length; i++) {
15220
+ const param = i % 2 === 0 ? "sort_column" : "is_ascending";
15221
+ assert(criteria[i] !== undefined, _t("Value for parameter %s is missing in [[FUNCTION_NAME]].", param));
15210
15222
  }
15211
15223
  const sortingOrders = [];
15212
15224
  const sortColumns = [];
@@ -54492,12 +54504,13 @@ class PivotLayoutConfigurator extends owl.Component {
54492
54504
  addCalculatedMeasure() {
54493
54505
  const { measures } = this.props.definition;
54494
54506
  const measureName = this.env.model.getters.generateNewCalculatedMeasureName(measures);
54507
+ const aggregator = "sum";
54495
54508
  this.props.onDimensionsUpdated({
54496
54509
  measures: measures.concat([
54497
54510
  {
54498
- id: this.getMeasureId(measureName),
54511
+ id: this.getMeasureId(measureName, aggregator),
54499
54512
  fieldName: measureName,
54500
- aggregator: "sum",
54513
+ aggregator,
54501
54514
  computedBy: {
54502
54515
  sheetId: this.env.model.getters.getActiveSheetId(),
54503
54516
  formula: "=0",
@@ -67963,7 +67976,7 @@ function withPivotPresentationLayer (PivotClass) {
67963
67976
  return { value: 0 };
67964
67977
  }
67965
67978
  const { columns, rows } = super.definition;
67966
- if (columns.length + rows.length !== domain.length) {
67979
+ if (measure.aggregator && columns.length + rows.length !== domain.length) {
67967
67980
  const values = this.getValuesToAggregate(measure, domain);
67968
67981
  const aggregator = AGGREGATORS_FN[measure.aggregator];
67969
67982
  if (!aggregator) {
@@ -67982,11 +67995,17 @@ function withPivotPresentationLayer (PivotClass) {
67982
67995
  if (columns.find((col) => col.nameWithGranularity === symbolName)) {
67983
67996
  const { colDomain } = domainToColRowDomain(this, domain);
67984
67997
  const symbolIndex = colDomain.findIndex((node) => node.field === symbolName);
67998
+ if (symbolIndex === -1) {
67999
+ return new NotAvailableError();
68000
+ }
67985
68001
  return this.getPivotHeaderValueAndFormat(colDomain.slice(0, symbolIndex + 1));
67986
68002
  }
67987
68003
  if (rows.find((row) => row.nameWithGranularity === symbolName)) {
67988
68004
  const { rowDomain } = domainToColRowDomain(this, domain);
67989
68005
  const symbolIndex = rowDomain.findIndex((row) => row.field === symbolName);
68006
+ if (symbolIndex === -1) {
68007
+ return new NotAvailableError();
68008
+ }
67990
68009
  return this.getPivotHeaderValueAndFormat(rowDomain.slice(0, symbolIndex + 1));
67991
68010
  }
67992
68011
  return this.getPivotCellValueAndFormat(symbolName, domain);
@@ -74323,13 +74342,10 @@ class GridSelectionPlugin extends UIPlugin {
74323
74342
  const deltaCol = isBasedBefore && isCol ? thickness : 0;
74324
74343
  const deltaRow = isBasedBefore && !isCol ? thickness : 0;
74325
74344
  const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
74326
- const originalSize = Object.fromEntries(toRemove.map((element) => {
74327
- const size = isCol
74328
- ? this.getters.getColSize(cmd.sheetId, element)
74329
- : this.getters.getUserRowSize(cmd.sheetId, element);
74330
- const isDefaultCol = isCol && size === DEFAULT_CELL_WIDTH;
74331
- return [element, isDefaultCol ? undefined : size];
74332
- }));
74345
+ const originalSize = {};
74346
+ for (const element of toRemove) {
74347
+ originalSize[element] = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
74348
+ }
74333
74349
  const target = [
74334
74350
  {
74335
74351
  left: isCol ? start + deltaCol : 0,
@@ -74365,11 +74381,11 @@ class GridSelectionPlugin extends UIPlugin {
74365
74381
  for (const element of toRemove) {
74366
74382
  const size = originalSize[element];
74367
74383
  const currentSize = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, currentIndex);
74368
- if (size && size !== currentSize) {
74384
+ if (size !== currentSize) {
74369
74385
  resizingGroups[size] ??= [];
74370
74386
  resizingGroups[size].push(currentIndex);
74371
- currentIndex += 1;
74372
74387
  }
74388
+ currentIndex += 1;
74373
74389
  }
74374
74390
  for (const size in resizingGroups) {
74375
74391
  this.dispatch("RESIZE_COLUMNS_ROWS", {
@@ -84840,6 +84856,6 @@ exports.tokenColors = tokenColors;
84840
84856
  exports.tokenize = tokenize;
84841
84857
 
84842
84858
 
84843
- __info__.version = "18.4.10";
84844
- __info__.date = "2025-09-11T08:45:39.178Z";
84845
- __info__.hash = "15a11a4";
84859
+ __info__.version = "18.4.11";
84860
+ __info__.date = "2025-09-19T07:25:39.033Z";
84861
+ __info__.hash = "c7e71ac";
@@ -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.4.10
6
- * @date 2025-09-11T08:45:39.178Z
7
- * @hash 15a11a4
5
+ * @version 18.4.11
6
+ * @date 2025-09-19T07:25:39.033Z
7
+ * @hash c7e71ac
8
8
  */
9
9
 
10
10
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, App, blockDom, useState, onPatched, useExternalListener, onWillUpdateProps, onWillStart, onWillPatch, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -889,8 +889,19 @@ function memoize(func) {
889
889
  },
890
890
  }[funcName];
891
891
  }
892
+ /**
893
+ * Removes the specified indexes from the array.
894
+ * Sparse (empty) elements are transformed to undefined (unless their index is explicitly removed).
895
+ */
892
896
  function removeIndexesFromArray(array, indexes) {
893
- return array.filter((_, index) => !indexes.includes(index));
897
+ const toRemove = new Set(indexes);
898
+ const newArray = [];
899
+ for (let i = 0; i < array.length; i++) {
900
+ if (!toRemove.has(i)) {
901
+ newArray.push(array[i]);
902
+ }
903
+ }
904
+ return newArray;
894
905
  }
895
906
  function insertItemsAtIndex(array, items, index) {
896
907
  const newArray = [...array];
@@ -15203,8 +15214,9 @@ function interactiveSort(env, sheetId, anchor, zone, sortDirection, sortOptions)
15203
15214
  }
15204
15215
 
15205
15216
  function sortMatrix(matrix, locale, ...criteria) {
15206
- for (const [i, value] of criteria.entries()) {
15207
- assert(value !== undefined, _t("Value for parameter %d is missing, while the function [[FUNCTION_NAME]] expect a number or a range.", i + 1));
15217
+ for (let i = 0; i < criteria.length; i++) {
15218
+ const param = i % 2 === 0 ? "sort_column" : "is_ascending";
15219
+ assert(criteria[i] !== undefined, _t("Value for parameter %s is missing in [[FUNCTION_NAME]].", param));
15208
15220
  }
15209
15221
  const sortingOrders = [];
15210
15222
  const sortColumns = [];
@@ -54490,12 +54502,13 @@ class PivotLayoutConfigurator extends Component {
54490
54502
  addCalculatedMeasure() {
54491
54503
  const { measures } = this.props.definition;
54492
54504
  const measureName = this.env.model.getters.generateNewCalculatedMeasureName(measures);
54505
+ const aggregator = "sum";
54493
54506
  this.props.onDimensionsUpdated({
54494
54507
  measures: measures.concat([
54495
54508
  {
54496
- id: this.getMeasureId(measureName),
54509
+ id: this.getMeasureId(measureName, aggregator),
54497
54510
  fieldName: measureName,
54498
- aggregator: "sum",
54511
+ aggregator,
54499
54512
  computedBy: {
54500
54513
  sheetId: this.env.model.getters.getActiveSheetId(),
54501
54514
  formula: "=0",
@@ -67961,7 +67974,7 @@ function withPivotPresentationLayer (PivotClass) {
67961
67974
  return { value: 0 };
67962
67975
  }
67963
67976
  const { columns, rows } = super.definition;
67964
- if (columns.length + rows.length !== domain.length) {
67977
+ if (measure.aggregator && columns.length + rows.length !== domain.length) {
67965
67978
  const values = this.getValuesToAggregate(measure, domain);
67966
67979
  const aggregator = AGGREGATORS_FN[measure.aggregator];
67967
67980
  if (!aggregator) {
@@ -67980,11 +67993,17 @@ function withPivotPresentationLayer (PivotClass) {
67980
67993
  if (columns.find((col) => col.nameWithGranularity === symbolName)) {
67981
67994
  const { colDomain } = domainToColRowDomain(this, domain);
67982
67995
  const symbolIndex = colDomain.findIndex((node) => node.field === symbolName);
67996
+ if (symbolIndex === -1) {
67997
+ return new NotAvailableError();
67998
+ }
67983
67999
  return this.getPivotHeaderValueAndFormat(colDomain.slice(0, symbolIndex + 1));
67984
68000
  }
67985
68001
  if (rows.find((row) => row.nameWithGranularity === symbolName)) {
67986
68002
  const { rowDomain } = domainToColRowDomain(this, domain);
67987
68003
  const symbolIndex = rowDomain.findIndex((row) => row.field === symbolName);
68004
+ if (symbolIndex === -1) {
68005
+ return new NotAvailableError();
68006
+ }
67988
68007
  return this.getPivotHeaderValueAndFormat(rowDomain.slice(0, symbolIndex + 1));
67989
68008
  }
67990
68009
  return this.getPivotCellValueAndFormat(symbolName, domain);
@@ -74321,13 +74340,10 @@ class GridSelectionPlugin extends UIPlugin {
74321
74340
  const deltaCol = isBasedBefore && isCol ? thickness : 0;
74322
74341
  const deltaRow = isBasedBefore && !isCol ? thickness : 0;
74323
74342
  const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
74324
- const originalSize = Object.fromEntries(toRemove.map((element) => {
74325
- const size = isCol
74326
- ? this.getters.getColSize(cmd.sheetId, element)
74327
- : this.getters.getUserRowSize(cmd.sheetId, element);
74328
- const isDefaultCol = isCol && size === DEFAULT_CELL_WIDTH;
74329
- return [element, isDefaultCol ? undefined : size];
74330
- }));
74343
+ const originalSize = {};
74344
+ for (const element of toRemove) {
74345
+ originalSize[element] = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
74346
+ }
74331
74347
  const target = [
74332
74348
  {
74333
74349
  left: isCol ? start + deltaCol : 0,
@@ -74363,11 +74379,11 @@ class GridSelectionPlugin extends UIPlugin {
74363
74379
  for (const element of toRemove) {
74364
74380
  const size = originalSize[element];
74365
74381
  const currentSize = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, currentIndex);
74366
- if (size && size !== currentSize) {
74382
+ if (size !== currentSize) {
74367
74383
  resizingGroups[size] ??= [];
74368
74384
  resizingGroups[size].push(currentIndex);
74369
- currentIndex += 1;
74370
74385
  }
74386
+ currentIndex += 1;
74371
74387
  }
74372
74388
  for (const size in resizingGroups) {
74373
74389
  this.dispatch("RESIZE_COLUMNS_ROWS", {
@@ -84790,6 +84806,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
84790
84806
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, ClientDisconnectedError, CommandResult, CorePlugin, CoreViewPlugin, DispatchResult, EvaluationError, LocalTransportService, 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 };
84791
84807
 
84792
84808
 
84793
- __info__.version = "18.4.10";
84794
- __info__.date = "2025-09-11T08:45:39.178Z";
84795
- __info__.hash = "15a11a4";
84809
+ __info__.version = "18.4.11";
84810
+ __info__.date = "2025-09-19T07:25:39.033Z";
84811
+ __info__.hash = "c7e71ac";
@@ -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.4.10
6
- * @date 2025-09-11T08:45:39.178Z
7
- * @hash 15a11a4
5
+ * @version 18.4.11
6
+ * @date 2025-09-19T07:25:39.033Z
7
+ * @hash c7e71ac
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -890,8 +890,19 @@
890
890
  },
891
891
  }[funcName];
892
892
  }
893
+ /**
894
+ * Removes the specified indexes from the array.
895
+ * Sparse (empty) elements are transformed to undefined (unless their index is explicitly removed).
896
+ */
893
897
  function removeIndexesFromArray(array, indexes) {
894
- return array.filter((_, index) => !indexes.includes(index));
898
+ const toRemove = new Set(indexes);
899
+ const newArray = [];
900
+ for (let i = 0; i < array.length; i++) {
901
+ if (!toRemove.has(i)) {
902
+ newArray.push(array[i]);
903
+ }
904
+ }
905
+ return newArray;
895
906
  }
896
907
  function insertItemsAtIndex(array, items, index) {
897
908
  const newArray = [...array];
@@ -15204,8 +15215,9 @@ stores.inject(MyMetaStore, storeInstance);
15204
15215
  }
15205
15216
 
15206
15217
  function sortMatrix(matrix, locale, ...criteria) {
15207
- for (const [i, value] of criteria.entries()) {
15208
- assert(value !== undefined, _t("Value for parameter %d is missing, while the function [[FUNCTION_NAME]] expect a number or a range.", i + 1));
15218
+ for (let i = 0; i < criteria.length; i++) {
15219
+ const param = i % 2 === 0 ? "sort_column" : "is_ascending";
15220
+ assert(criteria[i] !== undefined, _t("Value for parameter %s is missing in [[FUNCTION_NAME]].", param));
15209
15221
  }
15210
15222
  const sortingOrders = [];
15211
15223
  const sortColumns = [];
@@ -54491,12 +54503,13 @@ stores.inject(MyMetaStore, storeInstance);
54491
54503
  addCalculatedMeasure() {
54492
54504
  const { measures } = this.props.definition;
54493
54505
  const measureName = this.env.model.getters.generateNewCalculatedMeasureName(measures);
54506
+ const aggregator = "sum";
54494
54507
  this.props.onDimensionsUpdated({
54495
54508
  measures: measures.concat([
54496
54509
  {
54497
- id: this.getMeasureId(measureName),
54510
+ id: this.getMeasureId(measureName, aggregator),
54498
54511
  fieldName: measureName,
54499
- aggregator: "sum",
54512
+ aggregator,
54500
54513
  computedBy: {
54501
54514
  sheetId: this.env.model.getters.getActiveSheetId(),
54502
54515
  formula: "=0",
@@ -67962,7 +67975,7 @@ stores.inject(MyMetaStore, storeInstance);
67962
67975
  return { value: 0 };
67963
67976
  }
67964
67977
  const { columns, rows } = super.definition;
67965
- if (columns.length + rows.length !== domain.length) {
67978
+ if (measure.aggregator && columns.length + rows.length !== domain.length) {
67966
67979
  const values = this.getValuesToAggregate(measure, domain);
67967
67980
  const aggregator = AGGREGATORS_FN[measure.aggregator];
67968
67981
  if (!aggregator) {
@@ -67981,11 +67994,17 @@ stores.inject(MyMetaStore, storeInstance);
67981
67994
  if (columns.find((col) => col.nameWithGranularity === symbolName)) {
67982
67995
  const { colDomain } = domainToColRowDomain(this, domain);
67983
67996
  const symbolIndex = colDomain.findIndex((node) => node.field === symbolName);
67997
+ if (symbolIndex === -1) {
67998
+ return new NotAvailableError();
67999
+ }
67984
68000
  return this.getPivotHeaderValueAndFormat(colDomain.slice(0, symbolIndex + 1));
67985
68001
  }
67986
68002
  if (rows.find((row) => row.nameWithGranularity === symbolName)) {
67987
68003
  const { rowDomain } = domainToColRowDomain(this, domain);
67988
68004
  const symbolIndex = rowDomain.findIndex((row) => row.field === symbolName);
68005
+ if (symbolIndex === -1) {
68006
+ return new NotAvailableError();
68007
+ }
67989
68008
  return this.getPivotHeaderValueAndFormat(rowDomain.slice(0, symbolIndex + 1));
67990
68009
  }
67991
68010
  return this.getPivotCellValueAndFormat(symbolName, domain);
@@ -74322,13 +74341,10 @@ stores.inject(MyMetaStore, storeInstance);
74322
74341
  const deltaCol = isBasedBefore && isCol ? thickness : 0;
74323
74342
  const deltaRow = isBasedBefore && !isCol ? thickness : 0;
74324
74343
  const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
74325
- const originalSize = Object.fromEntries(toRemove.map((element) => {
74326
- const size = isCol
74327
- ? this.getters.getColSize(cmd.sheetId, element)
74328
- : this.getters.getUserRowSize(cmd.sheetId, element);
74329
- const isDefaultCol = isCol && size === DEFAULT_CELL_WIDTH;
74330
- return [element, isDefaultCol ? undefined : size];
74331
- }));
74344
+ const originalSize = {};
74345
+ for (const element of toRemove) {
74346
+ originalSize[element] = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
74347
+ }
74332
74348
  const target = [
74333
74349
  {
74334
74350
  left: isCol ? start + deltaCol : 0,
@@ -74364,11 +74380,11 @@ stores.inject(MyMetaStore, storeInstance);
74364
74380
  for (const element of toRemove) {
74365
74381
  const size = originalSize[element];
74366
74382
  const currentSize = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, currentIndex);
74367
- if (size && size !== currentSize) {
74383
+ if (size !== currentSize) {
74368
74384
  resizingGroups[size] ??= [];
74369
74385
  resizingGroups[size].push(currentIndex);
74370
- currentIndex += 1;
74371
74386
  }
74387
+ currentIndex += 1;
74372
74388
  }
74373
74389
  for (const size in resizingGroups) {
74374
74390
  this.dispatch("RESIZE_COLUMNS_ROWS", {
@@ -84839,9 +84855,9 @@ stores.inject(MyMetaStore, storeInstance);
84839
84855
  exports.tokenize = tokenize;
84840
84856
 
84841
84857
 
84842
- __info__.version = "18.4.10";
84843
- __info__.date = "2025-09-11T08:45:39.178Z";
84844
- __info__.hash = "15a11a4";
84858
+ __info__.version = "18.4.11";
84859
+ __info__.date = "2025-09-19T07:25:39.033Z";
84860
+ __info__.hash = "c7e71ac";
84845
84861
 
84846
84862
 
84847
84863
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);