@odoo/o-spreadsheet 18.2.39 → 18.2.40
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.
- package/dist/o-spreadsheet.cjs.js +93 -44
- package/dist/o-spreadsheet.d.ts +10 -4
- package/dist/o-spreadsheet.esm.js +93 -44
- package/dist/o-spreadsheet.iife.js +93 -44
- package/dist/o-spreadsheet.iife.min.js +5 -5
- package/dist/o_spreadsheet.css +3 -3
- package/dist/o_spreadsheet.xml +5 -4
- package/package.json +1 -1
|
@@ -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.
|
|
6
|
-
* @date
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.2.40
|
|
6
|
+
* @date 2026-01-14T09:59:34.210Z
|
|
7
|
+
* @hash 755a787
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -19118,9 +19118,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
19118
19118
|
throw new EvaluationError(_t("Function PIVOT takes an even number of arguments."));
|
|
19119
19119
|
}
|
|
19120
19120
|
}
|
|
19121
|
-
function addPivotDependencies(evalContext,
|
|
19121
|
+
function addPivotDependencies(evalContext, pivotId, forMeasures) {
|
|
19122
19122
|
//TODO This function can be very costly when used with PIVOT.VALUE and PIVOT.HEADER
|
|
19123
19123
|
const dependencies = [];
|
|
19124
|
+
const coreDefinition = evalContext.getters.getPivotCoreDefinition(pivotId);
|
|
19124
19125
|
if (coreDefinition.type === "SPREADSHEET" && coreDefinition.dataSet) {
|
|
19125
19126
|
const { sheetId, zone } = coreDefinition.dataSet;
|
|
19126
19127
|
const xc = zoneToXc(zone);
|
|
@@ -19137,8 +19138,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
19137
19138
|
}
|
|
19138
19139
|
for (const measure of forMeasures) {
|
|
19139
19140
|
if (measure.computedBy) {
|
|
19140
|
-
|
|
19141
|
-
dependencies.push(...formula.dependencies.filter((range) => !range.invalidXc));
|
|
19141
|
+
dependencies.push(...evalContext.getters.getMeasureFullDependencies(pivotId, measure));
|
|
19142
19142
|
}
|
|
19143
19143
|
}
|
|
19144
19144
|
const originPosition = evalContext.__originCellPosition;
|
|
@@ -19579,7 +19579,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
19579
19579
|
assertDomainLength(domainArgs);
|
|
19580
19580
|
const pivot = this.getters.getPivot(pivotId);
|
|
19581
19581
|
const coreDefinition = this.getters.getPivotCoreDefinition(pivotId);
|
|
19582
|
-
addPivotDependencies(this,
|
|
19582
|
+
addPivotDependencies(this, pivotId, coreDefinition.measures.filter((m) => m.id === _measure));
|
|
19583
19583
|
pivot.init({ reload: pivot.needsReevaluation });
|
|
19584
19584
|
const error = pivot.assertIsValid({ throwOnError: false });
|
|
19585
19585
|
if (error) {
|
|
@@ -19612,8 +19612,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
19612
19612
|
const _pivotId = getPivotId(_pivotFormulaId, this.getters);
|
|
19613
19613
|
assertDomainLength(domainArgs);
|
|
19614
19614
|
const pivot = this.getters.getPivot(_pivotId);
|
|
19615
|
-
|
|
19616
|
-
addPivotDependencies(this, coreDefinition, []);
|
|
19615
|
+
addPivotDependencies(this, _pivotId, []);
|
|
19617
19616
|
pivot.init({ reload: pivot.needsReevaluation });
|
|
19618
19617
|
const error = pivot.assertIsValid({ throwOnError: false });
|
|
19619
19618
|
if (error) {
|
|
@@ -19667,7 +19666,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
19667
19666
|
const pivotId = getPivotId(_pivotFormulaId, this.getters);
|
|
19668
19667
|
const pivot = this.getters.getPivot(pivotId);
|
|
19669
19668
|
const coreDefinition = this.getters.getPivotCoreDefinition(pivotId);
|
|
19670
|
-
addPivotDependencies(this,
|
|
19669
|
+
addPivotDependencies(this, pivotId, coreDefinition.measures);
|
|
19671
19670
|
pivot.init({ reload: pivot.needsReevaluation });
|
|
19672
19671
|
const error = pivot.assertIsValid({ throwOnError: false });
|
|
19673
19672
|
if (error) {
|
|
@@ -21324,7 +21323,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
21324
21323
|
}
|
|
21325
21324
|
captureSelection(zone, col, row) {
|
|
21326
21325
|
this.model.selection.capture(this, {
|
|
21327
|
-
cell: { col: col ?? zone.left, row: row ?? zone.
|
|
21326
|
+
cell: { col: col ?? zone.left, row: row ?? zone.top },
|
|
21328
21327
|
zone,
|
|
21329
21328
|
}, {
|
|
21330
21329
|
handleEvent: this.handleEvent.bind(this),
|
|
@@ -44865,6 +44864,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
44865
44864
|
case "ACTIVATE_SHEET":
|
|
44866
44865
|
this.isSearchDirty = true;
|
|
44867
44866
|
this.shouldFinalizeUpdateSelection = true;
|
|
44867
|
+
if (this.searchOptions.specificRange) {
|
|
44868
|
+
this.searchOptions.specificRange = this.searchOptions.specificRange.clone({
|
|
44869
|
+
sheetId: this.getters.getActiveSheetId(),
|
|
44870
|
+
});
|
|
44871
|
+
}
|
|
44868
44872
|
break;
|
|
44869
44873
|
case "REPLACE_SEARCH":
|
|
44870
44874
|
for (const match of cmd.matches) {
|
|
@@ -45286,9 +45290,20 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
45286
45290
|
const specificRange = this.env.model.getters.getRangeFromSheetXC(this.env.model.getters.getActiveSheetId(), this.state.dataRange);
|
|
45287
45291
|
this.store.updateSearchOptions({ specificRange });
|
|
45288
45292
|
}
|
|
45293
|
+
get specificRange() {
|
|
45294
|
+
const range = this.store.searchOptions.specificRange;
|
|
45295
|
+
return range ? this.env.model.getters.getRangeString(range, "forceSheetReference") : "";
|
|
45296
|
+
}
|
|
45289
45297
|
get pendingSearch() {
|
|
45290
45298
|
return this.updateSearchContent.isDebouncePending();
|
|
45291
45299
|
}
|
|
45300
|
+
get selectionInputKey() {
|
|
45301
|
+
// Selections input are made to work with objects linked to a sheet id. They store the active sheet id at their creation,
|
|
45302
|
+
// and have specific behaviour linked to it (eg. go back to the initial sheet after confirmation).
|
|
45303
|
+
// We don't want all those behaviors here, so we force the recreation of the component when the active sheet changes.
|
|
45304
|
+
// The only drawback is that the input loses focus when changing sheet.
|
|
45305
|
+
return this.env.model.getters.getActiveSheetId();
|
|
45306
|
+
}
|
|
45292
45307
|
}
|
|
45293
45308
|
|
|
45294
45309
|
css /* scss */ `
|
|
@@ -59819,6 +59834,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59819
59834
|
"getMeasureCompiledFormula",
|
|
59820
59835
|
"getPivotName",
|
|
59821
59836
|
"isExistingPivot",
|
|
59837
|
+
"getMeasureFullDependencies",
|
|
59822
59838
|
];
|
|
59823
59839
|
nextFormulaId = 1;
|
|
59824
59840
|
pivots = {};
|
|
@@ -59901,7 +59917,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59901
59917
|
}
|
|
59902
59918
|
case "UPDATE_PIVOT": {
|
|
59903
59919
|
this.history.update("pivots", cmd.pivotId, "definition", this.repairSortedColumn(deepCopy(cmd.pivot)));
|
|
59904
|
-
this.compileCalculatedMeasures(cmd.pivot.measures);
|
|
59920
|
+
this.compileCalculatedMeasures(cmd.pivotId, cmd.pivot.measures);
|
|
59905
59921
|
break;
|
|
59906
59922
|
}
|
|
59907
59923
|
}
|
|
@@ -59919,9 +59935,14 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59919
59935
|
this.history.update("pivots", pivotId, "definition", newDefinition);
|
|
59920
59936
|
}
|
|
59921
59937
|
}
|
|
59922
|
-
for (const
|
|
59923
|
-
for (const
|
|
59924
|
-
const
|
|
59938
|
+
for (const pivotId in this.compiledMeasureFormulas) {
|
|
59939
|
+
for (const measureId in this.compiledMeasureFormulas[pivotId]) {
|
|
59940
|
+
const measure = this.pivots[pivotId]?.definition.measures.find((m) => m.id === measureId);
|
|
59941
|
+
if (!measure || !measure.computedBy) {
|
|
59942
|
+
continue;
|
|
59943
|
+
}
|
|
59944
|
+
const sheetId = measure.computedBy.sheetId;
|
|
59945
|
+
const compiledFormula = this.compiledMeasureFormulas[pivotId][measureId].formula;
|
|
59925
59946
|
const newDependencies = [];
|
|
59926
59947
|
for (const range of compiledFormula.dependencies) {
|
|
59927
59948
|
const change = applyChange(range);
|
|
@@ -59933,8 +59954,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59933
59954
|
}
|
|
59934
59955
|
}
|
|
59935
59956
|
const newFormulaString = this.getters.getFormulaString(sheetId, compiledFormula.tokens, newDependencies);
|
|
59936
|
-
|
|
59937
|
-
|
|
59957
|
+
const oldFormulaString = measure.computedBy.formula;
|
|
59958
|
+
if (newFormulaString !== oldFormulaString) {
|
|
59959
|
+
this.replaceMeasureFormula(pivotId, measure, newFormulaString);
|
|
59938
59960
|
}
|
|
59939
59961
|
}
|
|
59940
59962
|
}
|
|
@@ -59972,12 +59994,17 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59972
59994
|
isExistingPivot(pivotId) {
|
|
59973
59995
|
return pivotId in this.pivots;
|
|
59974
59996
|
}
|
|
59975
|
-
getMeasureCompiledFormula(measure) {
|
|
59997
|
+
getMeasureCompiledFormula(pivotId, measure) {
|
|
59976
59998
|
if (!measure.computedBy) {
|
|
59977
59999
|
throw new Error(`Measure ${measure.fieldName} is not computed by formula`);
|
|
59978
60000
|
}
|
|
59979
|
-
|
|
59980
|
-
|
|
60001
|
+
return this.compiledMeasureFormulas[pivotId][measure.id].formula;
|
|
60002
|
+
}
|
|
60003
|
+
getMeasureFullDependencies(pivotId, measure) {
|
|
60004
|
+
if (!measure.computedBy) {
|
|
60005
|
+
throw new Error(`Measure ${measure.fieldName} is not computed by formula`);
|
|
60006
|
+
}
|
|
60007
|
+
return this.compiledMeasureFormulas[pivotId][measure.id].dependencies;
|
|
59981
60008
|
}
|
|
59982
60009
|
// -------------------------------------------------------------------------
|
|
59983
60010
|
// Private
|
|
@@ -59987,18 +60014,42 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59987
60014
|
definition: this.repairSortedColumn(deepCopy(pivot)),
|
|
59988
60015
|
formulaId,
|
|
59989
60016
|
});
|
|
59990
|
-
this.compileCalculatedMeasures(pivot.measures);
|
|
60017
|
+
this.compileCalculatedMeasures(pivotId, pivot.measures);
|
|
59991
60018
|
this.history.update("formulaIds", formulaId, pivotId);
|
|
59992
60019
|
this.history.update("nextFormulaId", this.nextFormulaId + 1);
|
|
59993
60020
|
}
|
|
59994
|
-
compileCalculatedMeasures(measures) {
|
|
60021
|
+
compileCalculatedMeasures(pivotId, measures) {
|
|
59995
60022
|
for (const measure of measures) {
|
|
59996
60023
|
if (measure.computedBy) {
|
|
59997
|
-
const sheetId = measure.computedBy.sheetId;
|
|
59998
60024
|
const compiledFormula = this.compileMeasureFormula(measure.computedBy.sheetId, measure.computedBy.formula);
|
|
59999
|
-
this.history.update("compiledMeasureFormulas",
|
|
60025
|
+
this.history.update("compiledMeasureFormulas", pivotId, measure.id, "formula", compiledFormula);
|
|
60000
60026
|
}
|
|
60001
60027
|
}
|
|
60028
|
+
for (const measure of measures) {
|
|
60029
|
+
if (measure.computedBy) {
|
|
60030
|
+
const dependencies = this.computeMeasureFullDependencies(pivotId, measure);
|
|
60031
|
+
this.history.update("compiledMeasureFormulas", pivotId, measure.id, "dependencies", dependencies);
|
|
60032
|
+
}
|
|
60033
|
+
}
|
|
60034
|
+
}
|
|
60035
|
+
computeMeasureFullDependencies(pivotId, measure, exploredMeasures = new Set()) {
|
|
60036
|
+
const rangeDependencies = [];
|
|
60037
|
+
const definition = this.getPivotCoreDefinition(pivotId);
|
|
60038
|
+
const formula = this.getMeasureCompiledFormula(pivotId, measure);
|
|
60039
|
+
exploredMeasures.add(measure.id);
|
|
60040
|
+
for (const token of formula.tokens) {
|
|
60041
|
+
if (token.type !== "SYMBOL") {
|
|
60042
|
+
continue;
|
|
60043
|
+
}
|
|
60044
|
+
const otherMeasure = definition.measures.find((measureCandidate) => getCanonicalSymbolName(measureCandidate.id) === token.value &&
|
|
60045
|
+
measure.id !== measureCandidate.id);
|
|
60046
|
+
if (!otherMeasure || exploredMeasures.has(otherMeasure.id) || !otherMeasure.computedBy) {
|
|
60047
|
+
continue;
|
|
60048
|
+
}
|
|
60049
|
+
rangeDependencies.push(...this.computeMeasureFullDependencies(pivotId, otherMeasure, exploredMeasures));
|
|
60050
|
+
}
|
|
60051
|
+
rangeDependencies.push(...formula.dependencies.filter((range) => !range.invalidXc));
|
|
60052
|
+
return rangeDependencies;
|
|
60002
60053
|
}
|
|
60003
60054
|
insertPivot(position, formulaId, table) {
|
|
60004
60055
|
this.resizeSheet(position.sheetId, position, table);
|
|
@@ -60056,21 +60107,17 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
60056
60107
|
dependencies: rangeDependencies,
|
|
60057
60108
|
};
|
|
60058
60109
|
}
|
|
60059
|
-
replaceMeasureFormula(
|
|
60060
|
-
|
|
60061
|
-
|
|
60062
|
-
|
|
60063
|
-
const pivot = this.pivots[pivotId];
|
|
60064
|
-
if (!pivot) {
|
|
60065
|
-
continue;
|
|
60066
|
-
}
|
|
60067
|
-
for (const measure of pivot.definition.measures) {
|
|
60068
|
-
if (measure.computedBy?.formula === formulaString) {
|
|
60069
|
-
const measureIndex = pivot.definition.measures.indexOf(measure);
|
|
60070
|
-
this.history.update("pivots", pivotId, "definition", "measures", measureIndex, "computedBy", { formula: newFormulaString, sheetId });
|
|
60071
|
-
}
|
|
60072
|
-
}
|
|
60110
|
+
replaceMeasureFormula(pivotId, measure, newFormulaString) {
|
|
60111
|
+
const pivot = this.pivots[pivotId];
|
|
60112
|
+
if (!pivot) {
|
|
60113
|
+
return;
|
|
60073
60114
|
}
|
|
60115
|
+
const measureIndex = pivot.definition.measures.indexOf(measure);
|
|
60116
|
+
this.history.update("pivots", pivotId, "definition", "measures", measureIndex, "computedBy", {
|
|
60117
|
+
formula: newFormulaString,
|
|
60118
|
+
sheetId: measure.computedBy.sheetId,
|
|
60119
|
+
});
|
|
60120
|
+
this.compileCalculatedMeasures(pivotId, pivot.definition.measures);
|
|
60074
60121
|
}
|
|
60075
60122
|
checkDuplicatedMeasureIds(definition) {
|
|
60076
60123
|
const uniqueIds = new Set(definition.measures.map((m) => m.id));
|
|
@@ -63335,14 +63382,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63335
63382
|
function withPivotPresentationLayer (PivotClass) {
|
|
63336
63383
|
class PivotPresentationLayer extends PivotClass {
|
|
63337
63384
|
getters;
|
|
63385
|
+
pivotId;
|
|
63338
63386
|
cache = {};
|
|
63339
63387
|
rankAsc = {};
|
|
63340
63388
|
rankDesc = {};
|
|
63341
63389
|
runningTotal = {};
|
|
63342
63390
|
runningTotalInPercent = {};
|
|
63343
|
-
constructor(custom, params) {
|
|
63391
|
+
constructor(pivotId, custom, params) {
|
|
63344
63392
|
super(custom, params);
|
|
63345
63393
|
this.getters = params.getters;
|
|
63394
|
+
this.pivotId = pivotId;
|
|
63346
63395
|
}
|
|
63347
63396
|
markAsDirtyForEvaluation() {
|
|
63348
63397
|
this.cache = {};
|
|
@@ -63392,7 +63441,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63392
63441
|
return handleError(error, measure.aggregator.toUpperCase());
|
|
63393
63442
|
}
|
|
63394
63443
|
}
|
|
63395
|
-
const formula = this.getters.getMeasureCompiledFormula(measure);
|
|
63444
|
+
const formula = this.getters.getMeasureCompiledFormula(this.pivotId, measure);
|
|
63396
63445
|
const getSymbolValue = (symbolName) => {
|
|
63397
63446
|
const { columns, rows } = this.definition;
|
|
63398
63447
|
if (columns.find((col) => col.nameWithGranularity === symbolName)) {
|
|
@@ -64120,7 +64169,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
64120
64169
|
const definition = deepCopy(this.getters.getPivotCoreDefinition(pivotId));
|
|
64121
64170
|
if (!(pivotId in this.pivots)) {
|
|
64122
64171
|
const Pivot = withPivotPresentationLayer(pivotRegistry.get(definition.type).ui);
|
|
64123
|
-
this.pivots[pivotId] = new Pivot(this.custom, { definition, getters: this.getters });
|
|
64172
|
+
this.pivots[pivotId] = new Pivot(pivotId, this.custom, { definition, getters: this.getters });
|
|
64124
64173
|
}
|
|
64125
64174
|
else if (recreate) {
|
|
64126
64175
|
this.pivots[pivotId].onDefinitionChange(definition);
|
|
@@ -77420,9 +77469,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
77420
77469
|
exports.tokenize = tokenize;
|
|
77421
77470
|
|
|
77422
77471
|
|
|
77423
|
-
__info__.version = "18.2.
|
|
77424
|
-
__info__.date = "
|
|
77425
|
-
__info__.hash = "
|
|
77472
|
+
__info__.version = "18.2.40";
|
|
77473
|
+
__info__.date = "2026-01-14T09:59:34.210Z";
|
|
77474
|
+
__info__.hash = "755a787";
|
|
77426
77475
|
|
|
77427
77476
|
|
|
77428
77477
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|