@odoo/o-spreadsheet 18.2.29 → 18.2.30

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.2.29
6
- * @date 2025-09-11T08:44:31.801Z
7
- * @hash 665bc43
5
+ * @version 18.2.30
6
+ * @date 2025-09-19T07:24:27.894Z
7
+ * @hash 16428fd
8
8
  */
9
9
 
10
10
  'use strict';
@@ -860,8 +860,19 @@ function memoize(func) {
860
860
  },
861
861
  }[funcName];
862
862
  }
863
+ /**
864
+ * Removes the specified indexes from the array.
865
+ * Sparse (empty) elements are transformed to undefined (unless their index is explicitly removed).
866
+ */
863
867
  function removeIndexesFromArray(array, indexes) {
864
- return array.filter((_, index) => !indexes.includes(index));
868
+ const toRemove = new Set(indexes);
869
+ const newArray = [];
870
+ for (let i = 0; i < array.length; i++) {
871
+ if (!toRemove.has(i)) {
872
+ newArray.push(array[i]);
873
+ }
874
+ }
875
+ return newArray;
865
876
  }
866
877
  function insertItemsAtIndex(array, items, index) {
867
878
  const newArray = [...array];
@@ -15620,8 +15631,9 @@ function interactiveSort(env, sheetId, anchor, zone, sortDirection, sortOptions)
15620
15631
  }
15621
15632
 
15622
15633
  function sortMatrix(matrix, locale, ...criteria) {
15623
- for (const [i, value] of criteria.entries()) {
15624
- assert(() => value !== undefined, _t("Value for parameter %d is missing, while the function [[FUNCTION_NAME]] expect a number or a range.", i + 1));
15634
+ for (let i = 0; i < criteria.length; i++) {
15635
+ const param = i % 2 === 0 ? "sort_column" : "is_ascending";
15636
+ assert(() => criteria[i] !== undefined, _t("Value for parameter %s is missing in [[FUNCTION_NAME]].", param));
15625
15637
  }
15626
15638
  const sortingOrders = [];
15627
15639
  const sortColumns = [];
@@ -46132,12 +46144,13 @@ class PivotLayoutConfigurator extends owl.Component {
46132
46144
  addCalculatedMeasure() {
46133
46145
  const { measures } = this.props.definition;
46134
46146
  const measureName = this.env.model.getters.generateNewCalculatedMeasureName(measures);
46147
+ const aggregator = "sum";
46135
46148
  this.props.onDimensionsUpdated({
46136
46149
  measures: measures.concat([
46137
46150
  {
46138
- id: this.getMeasureId(measureName),
46151
+ id: this.getMeasureId(measureName, aggregator),
46139
46152
  fieldName: measureName,
46140
- aggregator: "sum",
46153
+ aggregator,
46141
46154
  computedBy: {
46142
46155
  sheetId: this.env.model.getters.getActiveSheetId(),
46143
46156
  formula: "=0",
@@ -63297,7 +63310,7 @@ function withPivotPresentationLayer (PivotClass) {
63297
63310
  return { value: 0 };
63298
63311
  }
63299
63312
  const { columns, rows } = super.definition;
63300
- if (columns.length + rows.length !== domain.length) {
63313
+ if (measure.aggregator && columns.length + rows.length !== domain.length) {
63301
63314
  const values = this.getValuesToAggregate(measure, domain);
63302
63315
  const aggregator = AGGREGATORS_FN[measure.aggregator];
63303
63316
  if (!aggregator) {
@@ -63316,11 +63329,17 @@ function withPivotPresentationLayer (PivotClass) {
63316
63329
  if (columns.find((col) => col.nameWithGranularity === symbolName)) {
63317
63330
  const { colDomain } = domainToColRowDomain(this, domain);
63318
63331
  const symbolIndex = colDomain.findIndex((node) => node.field === symbolName);
63332
+ if (symbolIndex === -1) {
63333
+ return new NotAvailableError();
63334
+ }
63319
63335
  return this.getPivotHeaderValueAndFormat(colDomain.slice(0, symbolIndex + 1));
63320
63336
  }
63321
63337
  if (rows.find((row) => row.nameWithGranularity === symbolName)) {
63322
63338
  const { rowDomain } = domainToColRowDomain(this, domain);
63323
63339
  const symbolIndex = rowDomain.findIndex((row) => row.field === symbolName);
63340
+ if (symbolIndex === -1) {
63341
+ return new NotAvailableError();
63342
+ }
63324
63343
  return this.getPivotHeaderValueAndFormat(rowDomain.slice(0, symbolIndex + 1));
63325
63344
  }
63326
63345
  return this.getPivotCellValueAndFormat(symbolName, domain);
@@ -68883,13 +68902,10 @@ class GridSelectionPlugin extends UIPlugin {
68883
68902
  const deltaCol = isBasedBefore && isCol ? thickness : 0;
68884
68903
  const deltaRow = isBasedBefore && !isCol ? thickness : 0;
68885
68904
  const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
68886
- const originalSize = Object.fromEntries(toRemove.map((element) => {
68887
- const size = isCol
68888
- ? this.getters.getColSize(cmd.sheetId, element)
68889
- : this.getters.getUserRowSize(cmd.sheetId, element);
68890
- const isDefaultCol = isCol && size === DEFAULT_CELL_WIDTH;
68891
- return [element, isDefaultCol ? undefined : size];
68892
- }));
68905
+ const originalSize = {};
68906
+ for (const element of toRemove) {
68907
+ originalSize[element] = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
68908
+ }
68893
68909
  const target = [
68894
68910
  {
68895
68911
  left: isCol ? start + deltaCol : 0,
@@ -68925,11 +68941,11 @@ class GridSelectionPlugin extends UIPlugin {
68925
68941
  for (const element of toRemove) {
68926
68942
  const size = originalSize[element];
68927
68943
  const currentSize = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, currentIndex);
68928
- if (size && size != currentSize) {
68944
+ if (size != currentSize) {
68929
68945
  resizingGroups[size] ??= [];
68930
68946
  resizingGroups[size].push(currentIndex);
68931
- currentIndex += 1;
68932
68947
  }
68948
+ currentIndex += 1;
68933
68949
  }
68934
68950
  for (const size in resizingGroups) {
68935
68951
  this.dispatch("RESIZE_COLUMNS_ROWS", {
@@ -77334,6 +77350,6 @@ exports.tokenColors = tokenColors;
77334
77350
  exports.tokenize = tokenize;
77335
77351
 
77336
77352
 
77337
- __info__.version = "18.2.29";
77338
- __info__.date = "2025-09-11T08:44:31.801Z";
77339
- __info__.hash = "665bc43";
77353
+ __info__.version = "18.2.30";
77354
+ __info__.date = "2025-09-19T07:24:27.894Z";
77355
+ __info__.hash = "16428fd";
@@ -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.2.29
6
- * @date 2025-09-11T08:44:31.801Z
7
- * @hash 665bc43
5
+ * @version 18.2.30
6
+ * @date 2025-09-19T07:24:27.894Z
7
+ * @hash 16428fd
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';
@@ -858,8 +858,19 @@ function memoize(func) {
858
858
  },
859
859
  }[funcName];
860
860
  }
861
+ /**
862
+ * Removes the specified indexes from the array.
863
+ * Sparse (empty) elements are transformed to undefined (unless their index is explicitly removed).
864
+ */
861
865
  function removeIndexesFromArray(array, indexes) {
862
- return array.filter((_, index) => !indexes.includes(index));
866
+ const toRemove = new Set(indexes);
867
+ const newArray = [];
868
+ for (let i = 0; i < array.length; i++) {
869
+ if (!toRemove.has(i)) {
870
+ newArray.push(array[i]);
871
+ }
872
+ }
873
+ return newArray;
863
874
  }
864
875
  function insertItemsAtIndex(array, items, index) {
865
876
  const newArray = [...array];
@@ -15618,8 +15629,9 @@ function interactiveSort(env, sheetId, anchor, zone, sortDirection, sortOptions)
15618
15629
  }
15619
15630
 
15620
15631
  function sortMatrix(matrix, locale, ...criteria) {
15621
- for (const [i, value] of criteria.entries()) {
15622
- assert(() => value !== undefined, _t("Value for parameter %d is missing, while the function [[FUNCTION_NAME]] expect a number or a range.", i + 1));
15632
+ for (let i = 0; i < criteria.length; i++) {
15633
+ const param = i % 2 === 0 ? "sort_column" : "is_ascending";
15634
+ assert(() => criteria[i] !== undefined, _t("Value for parameter %s is missing in [[FUNCTION_NAME]].", param));
15623
15635
  }
15624
15636
  const sortingOrders = [];
15625
15637
  const sortColumns = [];
@@ -46130,12 +46142,13 @@ class PivotLayoutConfigurator extends Component {
46130
46142
  addCalculatedMeasure() {
46131
46143
  const { measures } = this.props.definition;
46132
46144
  const measureName = this.env.model.getters.generateNewCalculatedMeasureName(measures);
46145
+ const aggregator = "sum";
46133
46146
  this.props.onDimensionsUpdated({
46134
46147
  measures: measures.concat([
46135
46148
  {
46136
- id: this.getMeasureId(measureName),
46149
+ id: this.getMeasureId(measureName, aggregator),
46137
46150
  fieldName: measureName,
46138
- aggregator: "sum",
46151
+ aggregator,
46139
46152
  computedBy: {
46140
46153
  sheetId: this.env.model.getters.getActiveSheetId(),
46141
46154
  formula: "=0",
@@ -63295,7 +63308,7 @@ function withPivotPresentationLayer (PivotClass) {
63295
63308
  return { value: 0 };
63296
63309
  }
63297
63310
  const { columns, rows } = super.definition;
63298
- if (columns.length + rows.length !== domain.length) {
63311
+ if (measure.aggregator && columns.length + rows.length !== domain.length) {
63299
63312
  const values = this.getValuesToAggregate(measure, domain);
63300
63313
  const aggregator = AGGREGATORS_FN[measure.aggregator];
63301
63314
  if (!aggregator) {
@@ -63314,11 +63327,17 @@ function withPivotPresentationLayer (PivotClass) {
63314
63327
  if (columns.find((col) => col.nameWithGranularity === symbolName)) {
63315
63328
  const { colDomain } = domainToColRowDomain(this, domain);
63316
63329
  const symbolIndex = colDomain.findIndex((node) => node.field === symbolName);
63330
+ if (symbolIndex === -1) {
63331
+ return new NotAvailableError();
63332
+ }
63317
63333
  return this.getPivotHeaderValueAndFormat(colDomain.slice(0, symbolIndex + 1));
63318
63334
  }
63319
63335
  if (rows.find((row) => row.nameWithGranularity === symbolName)) {
63320
63336
  const { rowDomain } = domainToColRowDomain(this, domain);
63321
63337
  const symbolIndex = rowDomain.findIndex((row) => row.field === symbolName);
63338
+ if (symbolIndex === -1) {
63339
+ return new NotAvailableError();
63340
+ }
63322
63341
  return this.getPivotHeaderValueAndFormat(rowDomain.slice(0, symbolIndex + 1));
63323
63342
  }
63324
63343
  return this.getPivotCellValueAndFormat(symbolName, domain);
@@ -68881,13 +68900,10 @@ class GridSelectionPlugin extends UIPlugin {
68881
68900
  const deltaCol = isBasedBefore && isCol ? thickness : 0;
68882
68901
  const deltaRow = isBasedBefore && !isCol ? thickness : 0;
68883
68902
  const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
68884
- const originalSize = Object.fromEntries(toRemove.map((element) => {
68885
- const size = isCol
68886
- ? this.getters.getColSize(cmd.sheetId, element)
68887
- : this.getters.getUserRowSize(cmd.sheetId, element);
68888
- const isDefaultCol = isCol && size === DEFAULT_CELL_WIDTH;
68889
- return [element, isDefaultCol ? undefined : size];
68890
- }));
68903
+ const originalSize = {};
68904
+ for (const element of toRemove) {
68905
+ originalSize[element] = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
68906
+ }
68891
68907
  const target = [
68892
68908
  {
68893
68909
  left: isCol ? start + deltaCol : 0,
@@ -68923,11 +68939,11 @@ class GridSelectionPlugin extends UIPlugin {
68923
68939
  for (const element of toRemove) {
68924
68940
  const size = originalSize[element];
68925
68941
  const currentSize = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, currentIndex);
68926
- if (size && size != currentSize) {
68942
+ if (size != currentSize) {
68927
68943
  resizingGroups[size] ??= [];
68928
68944
  resizingGroups[size].push(currentIndex);
68929
- currentIndex += 1;
68930
68945
  }
68946
+ currentIndex += 1;
68931
68947
  }
68932
68948
  for (const size in resizingGroups) {
68933
68949
  this.dispatch("RESIZE_COLUMNS_ROWS", {
@@ -77287,6 +77303,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
77287
77303
  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, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
77288
77304
 
77289
77305
 
77290
- __info__.version = "18.2.29";
77291
- __info__.date = "2025-09-11T08:44:31.801Z";
77292
- __info__.hash = "665bc43";
77306
+ __info__.version = "18.2.30";
77307
+ __info__.date = "2025-09-19T07:24:27.894Z";
77308
+ __info__.hash = "16428fd";
@@ -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.2.29
6
- * @date 2025-09-11T08:44:31.801Z
7
- * @hash 665bc43
5
+ * @version 18.2.30
6
+ * @date 2025-09-19T07:24:27.894Z
7
+ * @hash 16428fd
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -859,8 +859,19 @@
859
859
  },
860
860
  }[funcName];
861
861
  }
862
+ /**
863
+ * Removes the specified indexes from the array.
864
+ * Sparse (empty) elements are transformed to undefined (unless their index is explicitly removed).
865
+ */
862
866
  function removeIndexesFromArray(array, indexes) {
863
- return array.filter((_, index) => !indexes.includes(index));
867
+ const toRemove = new Set(indexes);
868
+ const newArray = [];
869
+ for (let i = 0; i < array.length; i++) {
870
+ if (!toRemove.has(i)) {
871
+ newArray.push(array[i]);
872
+ }
873
+ }
874
+ return newArray;
864
875
  }
865
876
  function insertItemsAtIndex(array, items, index) {
866
877
  const newArray = [...array];
@@ -15619,8 +15630,9 @@ stores.inject(MyMetaStore, storeInstance);
15619
15630
  }
15620
15631
 
15621
15632
  function sortMatrix(matrix, locale, ...criteria) {
15622
- for (const [i, value] of criteria.entries()) {
15623
- assert(() => value !== undefined, _t("Value for parameter %d is missing, while the function [[FUNCTION_NAME]] expect a number or a range.", i + 1));
15633
+ for (let i = 0; i < criteria.length; i++) {
15634
+ const param = i % 2 === 0 ? "sort_column" : "is_ascending";
15635
+ assert(() => criteria[i] !== undefined, _t("Value for parameter %s is missing in [[FUNCTION_NAME]].", param));
15624
15636
  }
15625
15637
  const sortingOrders = [];
15626
15638
  const sortColumns = [];
@@ -46131,12 +46143,13 @@ stores.inject(MyMetaStore, storeInstance);
46131
46143
  addCalculatedMeasure() {
46132
46144
  const { measures } = this.props.definition;
46133
46145
  const measureName = this.env.model.getters.generateNewCalculatedMeasureName(measures);
46146
+ const aggregator = "sum";
46134
46147
  this.props.onDimensionsUpdated({
46135
46148
  measures: measures.concat([
46136
46149
  {
46137
- id: this.getMeasureId(measureName),
46150
+ id: this.getMeasureId(measureName, aggregator),
46138
46151
  fieldName: measureName,
46139
- aggregator: "sum",
46152
+ aggregator,
46140
46153
  computedBy: {
46141
46154
  sheetId: this.env.model.getters.getActiveSheetId(),
46142
46155
  formula: "=0",
@@ -63296,7 +63309,7 @@ stores.inject(MyMetaStore, storeInstance);
63296
63309
  return { value: 0 };
63297
63310
  }
63298
63311
  const { columns, rows } = super.definition;
63299
- if (columns.length + rows.length !== domain.length) {
63312
+ if (measure.aggregator && columns.length + rows.length !== domain.length) {
63300
63313
  const values = this.getValuesToAggregate(measure, domain);
63301
63314
  const aggregator = AGGREGATORS_FN[measure.aggregator];
63302
63315
  if (!aggregator) {
@@ -63315,11 +63328,17 @@ stores.inject(MyMetaStore, storeInstance);
63315
63328
  if (columns.find((col) => col.nameWithGranularity === symbolName)) {
63316
63329
  const { colDomain } = domainToColRowDomain(this, domain);
63317
63330
  const symbolIndex = colDomain.findIndex((node) => node.field === symbolName);
63331
+ if (symbolIndex === -1) {
63332
+ return new NotAvailableError();
63333
+ }
63318
63334
  return this.getPivotHeaderValueAndFormat(colDomain.slice(0, symbolIndex + 1));
63319
63335
  }
63320
63336
  if (rows.find((row) => row.nameWithGranularity === symbolName)) {
63321
63337
  const { rowDomain } = domainToColRowDomain(this, domain);
63322
63338
  const symbolIndex = rowDomain.findIndex((row) => row.field === symbolName);
63339
+ if (symbolIndex === -1) {
63340
+ return new NotAvailableError();
63341
+ }
63323
63342
  return this.getPivotHeaderValueAndFormat(rowDomain.slice(0, symbolIndex + 1));
63324
63343
  }
63325
63344
  return this.getPivotCellValueAndFormat(symbolName, domain);
@@ -68882,13 +68901,10 @@ stores.inject(MyMetaStore, storeInstance);
68882
68901
  const deltaCol = isBasedBefore && isCol ? thickness : 0;
68883
68902
  const deltaRow = isBasedBefore && !isCol ? thickness : 0;
68884
68903
  const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
68885
- const originalSize = Object.fromEntries(toRemove.map((element) => {
68886
- const size = isCol
68887
- ? this.getters.getColSize(cmd.sheetId, element)
68888
- : this.getters.getUserRowSize(cmd.sheetId, element);
68889
- const isDefaultCol = isCol && size === DEFAULT_CELL_WIDTH;
68890
- return [element, isDefaultCol ? undefined : size];
68891
- }));
68904
+ const originalSize = {};
68905
+ for (const element of toRemove) {
68906
+ originalSize[element] = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
68907
+ }
68892
68908
  const target = [
68893
68909
  {
68894
68910
  left: isCol ? start + deltaCol : 0,
@@ -68924,11 +68940,11 @@ stores.inject(MyMetaStore, storeInstance);
68924
68940
  for (const element of toRemove) {
68925
68941
  const size = originalSize[element];
68926
68942
  const currentSize = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, currentIndex);
68927
- if (size && size != currentSize) {
68943
+ if (size != currentSize) {
68928
68944
  resizingGroups[size] ??= [];
68929
68945
  resizingGroups[size].push(currentIndex);
68930
- currentIndex += 1;
68931
68946
  }
68947
+ currentIndex += 1;
68932
68948
  }
68933
68949
  for (const size in resizingGroups) {
68934
68950
  this.dispatch("RESIZE_COLUMNS_ROWS", {
@@ -77333,9 +77349,9 @@ stores.inject(MyMetaStore, storeInstance);
77333
77349
  exports.tokenize = tokenize;
77334
77350
 
77335
77351
 
77336
- __info__.version = "18.2.29";
77337
- __info__.date = "2025-09-11T08:44:31.801Z";
77338
- __info__.hash = "665bc43";
77352
+ __info__.version = "18.2.30";
77353
+ __info__.date = "2025-09-19T07:24:27.894Z";
77354
+ __info__.hash = "16428fd";
77339
77355
 
77340
77356
 
77341
77357
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);