@odoo/o-spreadsheet 18.0.53 → 18.0.55
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 +144 -58
- package/dist/o-spreadsheet.d.ts +11 -5
- package/dist/o-spreadsheet.esm.js +144 -58
- package/dist/o-spreadsheet.iife.js +144 -58
- package/dist/o-spreadsheet.iife.min.js +378 -378
- 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.0.
|
|
6
|
-
* @date
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.0.55
|
|
6
|
+
* @date 2026-01-21T11:03:48.979Z
|
|
7
|
+
* @hash 0c94015
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -34,7 +34,8 @@ function createAction(item) {
|
|
|
34
34
|
return children
|
|
35
35
|
.map((child) => (typeof child === "function" ? child(env) : child))
|
|
36
36
|
.flat()
|
|
37
|
-
.map(createAction)
|
|
37
|
+
.map(createAction)
|
|
38
|
+
.sort((a, b) => a.sequence - b.sequence);
|
|
38
39
|
}
|
|
39
40
|
: () => [],
|
|
40
41
|
isReadonlyAllowed: item.isReadonlyAllowed || false,
|
|
@@ -302,6 +303,7 @@ const DEFAULT_STYLE = {
|
|
|
302
303
|
fillColor: "",
|
|
303
304
|
textColor: "",
|
|
304
305
|
};
|
|
306
|
+
const DEFAULT_NUMBER_STYLE = { ...DEFAULT_STYLE, align: "right" };
|
|
305
307
|
const DEFAULT_VERTICAL_ALIGN = DEFAULT_STYLE.verticalAlign;
|
|
306
308
|
const DEFAULT_WRAPPING_MODE = DEFAULT_STYLE.wrapping;
|
|
307
309
|
// Fonts
|
|
@@ -6315,11 +6317,20 @@ function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
|
|
|
6315
6317
|
/**
|
|
6316
6318
|
* Get the default height of the cell given its style.
|
|
6317
6319
|
*/
|
|
6318
|
-
function getDefaultCellHeight(ctx, cell, colSize) {
|
|
6320
|
+
function getDefaultCellHeight(ctx, cell, locale, colSize) {
|
|
6319
6321
|
if (!cell || (!cell.isFormula && !cell.content)) {
|
|
6320
6322
|
return DEFAULT_CELL_HEIGHT;
|
|
6321
6323
|
}
|
|
6322
|
-
|
|
6324
|
+
let content = "";
|
|
6325
|
+
try {
|
|
6326
|
+
if (!cell.isFormula) {
|
|
6327
|
+
const localeFormat = { format: cell.format, locale };
|
|
6328
|
+
content = formatValue(parseLiteral(cell.content, locale), localeFormat);
|
|
6329
|
+
}
|
|
6330
|
+
}
|
|
6331
|
+
catch {
|
|
6332
|
+
content = CellErrorType.GenericError;
|
|
6333
|
+
}
|
|
6323
6334
|
return getCellContentHeight(ctx, content, cell.style, colSize);
|
|
6324
6335
|
}
|
|
6325
6336
|
function getCellContentHeight(ctx, content, style, colSize) {
|
|
@@ -18565,9 +18576,10 @@ function assertDomainLength(domain) {
|
|
|
18565
18576
|
throw new EvaluationError(_t("Function PIVOT takes an even number of arguments."));
|
|
18566
18577
|
}
|
|
18567
18578
|
}
|
|
18568
|
-
function addPivotDependencies(evalContext,
|
|
18579
|
+
function addPivotDependencies(evalContext, pivotId, forMeasures) {
|
|
18569
18580
|
//TODO This function can be very costly when used with PIVOT.VALUE and PIVOT.HEADER
|
|
18570
18581
|
const dependencies = [];
|
|
18582
|
+
const coreDefinition = evalContext.getters.getPivotCoreDefinition(pivotId);
|
|
18571
18583
|
if (coreDefinition.type === "SPREADSHEET" && coreDefinition.dataSet) {
|
|
18572
18584
|
const { sheetId, zone } = coreDefinition.dataSet;
|
|
18573
18585
|
const xc = zoneToXc(zone);
|
|
@@ -18584,8 +18596,7 @@ function addPivotDependencies(evalContext, coreDefinition, forMeasures) {
|
|
|
18584
18596
|
}
|
|
18585
18597
|
for (const measure of forMeasures) {
|
|
18586
18598
|
if (measure.computedBy) {
|
|
18587
|
-
|
|
18588
|
-
dependencies.push(...formula.dependencies.filter((range) => !range.invalidXc));
|
|
18599
|
+
dependencies.push(...evalContext.getters.getMeasureFullDependencies(pivotId, measure));
|
|
18589
18600
|
}
|
|
18590
18601
|
}
|
|
18591
18602
|
const originPosition = evalContext.__originCellPosition;
|
|
@@ -19026,7 +19037,7 @@ const PIVOT_VALUE = {
|
|
|
19026
19037
|
assertDomainLength(domainArgs);
|
|
19027
19038
|
const pivot = this.getters.getPivot(pivotId);
|
|
19028
19039
|
const coreDefinition = this.getters.getPivotCoreDefinition(pivotId);
|
|
19029
|
-
addPivotDependencies(this,
|
|
19040
|
+
addPivotDependencies(this, pivotId, coreDefinition.measures.filter((m) => m.id === _measure));
|
|
19030
19041
|
pivot.init({ reload: pivot.needsReevaluation });
|
|
19031
19042
|
const error = pivot.assertIsValid({ throwOnError: false });
|
|
19032
19043
|
if (error) {
|
|
@@ -19059,8 +19070,7 @@ const PIVOT_HEADER = {
|
|
|
19059
19070
|
const _pivotId = getPivotId(_pivotFormulaId, this.getters);
|
|
19060
19071
|
assertDomainLength(domainArgs);
|
|
19061
19072
|
const pivot = this.getters.getPivot(_pivotId);
|
|
19062
|
-
|
|
19063
|
-
addPivotDependencies(this, coreDefinition, []);
|
|
19073
|
+
addPivotDependencies(this, _pivotId, []);
|
|
19064
19074
|
pivot.init({ reload: pivot.needsReevaluation });
|
|
19065
19075
|
const error = pivot.assertIsValid({ throwOnError: false });
|
|
19066
19076
|
if (error) {
|
|
@@ -19114,7 +19124,7 @@ const PIVOT = {
|
|
|
19114
19124
|
const pivotId = getPivotId(_pivotFormulaId, this.getters);
|
|
19115
19125
|
const pivot = this.getters.getPivot(pivotId);
|
|
19116
19126
|
const coreDefinition = this.getters.getPivotCoreDefinition(pivotId);
|
|
19117
|
-
addPivotDependencies(this,
|
|
19127
|
+
addPivotDependencies(this, pivotId, coreDefinition.measures);
|
|
19118
19128
|
pivot.init({ reload: pivot.needsReevaluation });
|
|
19119
19129
|
const error = pivot.assertIsValid({ throwOnError: false });
|
|
19120
19130
|
if (error) {
|
|
@@ -20322,7 +20332,16 @@ function createComputeFunction(descr, functionName) {
|
|
|
20322
20332
|
}
|
|
20323
20333
|
acceptToVectorize.push(!argDefinition.acceptMatrix);
|
|
20324
20334
|
}
|
|
20325
|
-
return applyVectorization(errorHandlingCompute.bind(this), args, acceptToVectorize);
|
|
20335
|
+
return replaceErrorPlaceholderInResult(applyVectorization(errorHandlingCompute.bind(this), args, acceptToVectorize));
|
|
20336
|
+
}
|
|
20337
|
+
function replaceErrorPlaceholderInResult(result) {
|
|
20338
|
+
if (!isMatrix(result)) {
|
|
20339
|
+
replaceFunctionNamePlaceholder(result, functionName);
|
|
20340
|
+
}
|
|
20341
|
+
else {
|
|
20342
|
+
matrixForEach(result, (result) => replaceFunctionNamePlaceholder(result, functionName));
|
|
20343
|
+
}
|
|
20344
|
+
return result;
|
|
20326
20345
|
}
|
|
20327
20346
|
function errorHandlingCompute(...args) {
|
|
20328
20347
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -20346,13 +20365,11 @@ function createComputeFunction(descr, functionName) {
|
|
|
20346
20365
|
const result = descr.compute.apply(this, args);
|
|
20347
20366
|
if (!isMatrix(result)) {
|
|
20348
20367
|
if (typeof result === "object" && result !== null && "value" in result) {
|
|
20349
|
-
replaceFunctionNamePlaceholder(result, functionName);
|
|
20350
20368
|
return result;
|
|
20351
20369
|
}
|
|
20352
20370
|
return { value: result };
|
|
20353
20371
|
}
|
|
20354
20372
|
if (typeof result[0][0] === "object" && result[0][0] !== null && "value" in result[0][0]) {
|
|
20355
|
-
matrixForEach(result, (result) => replaceFunctionNamePlaceholder(result, functionName));
|
|
20356
20373
|
return result;
|
|
20357
20374
|
}
|
|
20358
20375
|
return matrixMap(result, (row) => ({ value: row }));
|
|
@@ -21798,6 +21815,7 @@ function extractStyle(cell, data) {
|
|
|
21798
21815
|
? V_ALIGNMENT_EXPORT_CONVERSION_MAP[style.verticalAlign]
|
|
21799
21816
|
: undefined,
|
|
21800
21817
|
wrapText: style.wrapping === "wrap" || cell.content?.includes(NEWLINE) ? true : undefined,
|
|
21818
|
+
shrinkToFit: style.wrapping === "clip" ? true : undefined,
|
|
21801
21819
|
},
|
|
21802
21820
|
};
|
|
21803
21821
|
styles.font["strike"] = !!style?.strikethrough || undefined;
|
|
@@ -21824,6 +21842,7 @@ function normalizeStyle(construct, styles) {
|
|
|
21824
21842
|
vertical: styles.alignment.vertical,
|
|
21825
21843
|
horizontal: styles.alignment.horizontal,
|
|
21826
21844
|
wrapText: styles.alignment.wrapText,
|
|
21845
|
+
shrinkToFit: styles.alignment.shrinkToFit,
|
|
21827
21846
|
},
|
|
21828
21847
|
};
|
|
21829
21848
|
return pushElement(style, construct.styles);
|
|
@@ -42461,6 +42480,11 @@ class FindAndReplaceStore extends SpreadsheetStore {
|
|
|
42461
42480
|
case "UPDATE_CELL":
|
|
42462
42481
|
case "ACTIVATE_SHEET":
|
|
42463
42482
|
this.isSearchDirty = true;
|
|
42483
|
+
if (this.searchOptions.specificRange) {
|
|
42484
|
+
this.searchOptions.specificRange = this.searchOptions.specificRange.clone({
|
|
42485
|
+
sheetId: this.getters.getActiveSheetId(),
|
|
42486
|
+
});
|
|
42487
|
+
}
|
|
42464
42488
|
break;
|
|
42465
42489
|
case "REPLACE_SEARCH":
|
|
42466
42490
|
for (const match of cmd.matches) {
|
|
@@ -42866,9 +42890,20 @@ class FindAndReplacePanel extends owl.Component {
|
|
|
42866
42890
|
const specificRange = this.env.model.getters.getRangeFromSheetXC(this.env.model.getters.getActiveSheetId(), this.state.dataRange);
|
|
42867
42891
|
this.store.updateSearchOptions({ specificRange });
|
|
42868
42892
|
}
|
|
42893
|
+
get specificRange() {
|
|
42894
|
+
const range = this.store.searchOptions.specificRange;
|
|
42895
|
+
return range ? this.env.model.getters.getRangeString(range, "forceSheetReference") : "";
|
|
42896
|
+
}
|
|
42869
42897
|
get pendingSearch() {
|
|
42870
42898
|
return this.updateSearchContent.isDebouncePending();
|
|
42871
42899
|
}
|
|
42900
|
+
get selectionInputKey() {
|
|
42901
|
+
// Selections input are made to work with objects linked to a sheet id. They store the active sheet id at their creation,
|
|
42902
|
+
// and have specific behaviour linked to it (eg. go back to the initial sheet after confirmation).
|
|
42903
|
+
// We don't want all those behaviors here, so we force the recreation of the component when the active sheet changes.
|
|
42904
|
+
// The only drawback is that the input loses focus when changing sheet.
|
|
42905
|
+
return this.env.model.getters.getActiveSheetId();
|
|
42906
|
+
}
|
|
42872
42907
|
}
|
|
42873
42908
|
|
|
42874
42909
|
css /* scss */ `
|
|
@@ -52615,7 +52650,7 @@ class CellPlugin extends CorePlugin {
|
|
|
52615
52650
|
for (const position of positions) {
|
|
52616
52651
|
const cell = this.getters.getCell(position);
|
|
52617
52652
|
const xc = toXC(position.col, position.row);
|
|
52618
|
-
const style = this.
|
|
52653
|
+
const style = this.extractCustomStyle(cell);
|
|
52619
52654
|
if (Object.keys(style).length) {
|
|
52620
52655
|
const styleId = getItemId(style, styles);
|
|
52621
52656
|
positionsByStyle[styleId] ??= [];
|
|
@@ -52656,7 +52691,7 @@ class CellPlugin extends CorePlugin {
|
|
|
52656
52691
|
}
|
|
52657
52692
|
if (cell?.style) {
|
|
52658
52693
|
sheet.cells[xc] ??= {};
|
|
52659
|
-
sheet.cells[xc].style = getItemId(this.
|
|
52694
|
+
sheet.cells[xc].style = getItemId(this.extractCustomStyle(cell), data.styles);
|
|
52660
52695
|
}
|
|
52661
52696
|
}
|
|
52662
52697
|
}
|
|
@@ -52679,10 +52714,14 @@ class CellPlugin extends CorePlugin {
|
|
|
52679
52714
|
}
|
|
52680
52715
|
}
|
|
52681
52716
|
}
|
|
52682
|
-
|
|
52683
|
-
const cleanedStyle = { ...style };
|
|
52684
|
-
|
|
52685
|
-
|
|
52717
|
+
extractCustomStyle(cell) {
|
|
52718
|
+
const cleanedStyle = { ...cell.style };
|
|
52719
|
+
const defaultStyle = isNumber(cell.content, DEFAULT_LOCALE)
|
|
52720
|
+
? DEFAULT_NUMBER_STYLE
|
|
52721
|
+
: DEFAULT_STYLE;
|
|
52722
|
+
for (const property in cleanedStyle) {
|
|
52723
|
+
if ((property !== "align" || !cell.isFormula) &&
|
|
52724
|
+
cleanedStyle[property] === defaultStyle[property]) {
|
|
52686
52725
|
delete cleanedStyle[property];
|
|
52687
52726
|
}
|
|
52688
52727
|
}
|
|
@@ -57205,6 +57244,7 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
57205
57244
|
"getMeasureCompiledFormula",
|
|
57206
57245
|
"getPivotName",
|
|
57207
57246
|
"isExistingPivot",
|
|
57247
|
+
"getMeasureFullDependencies",
|
|
57208
57248
|
];
|
|
57209
57249
|
nextFormulaId = 1;
|
|
57210
57250
|
pivots = {};
|
|
@@ -57287,7 +57327,7 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
57287
57327
|
}
|
|
57288
57328
|
case "UPDATE_PIVOT": {
|
|
57289
57329
|
this.history.update("pivots", cmd.pivotId, "definition", deepCopy(cmd.pivot));
|
|
57290
|
-
this.compileCalculatedMeasures(cmd.pivot.measures);
|
|
57330
|
+
this.compileCalculatedMeasures(cmd.pivotId, cmd.pivot.measures);
|
|
57291
57331
|
break;
|
|
57292
57332
|
}
|
|
57293
57333
|
}
|
|
@@ -57305,9 +57345,14 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
57305
57345
|
this.history.update("pivots", pivotId, "definition", newDefinition);
|
|
57306
57346
|
}
|
|
57307
57347
|
}
|
|
57308
|
-
for (const
|
|
57309
|
-
for (const
|
|
57310
|
-
const
|
|
57348
|
+
for (const pivotId in this.compiledMeasureFormulas) {
|
|
57349
|
+
for (const measureId in this.compiledMeasureFormulas[pivotId]) {
|
|
57350
|
+
const measure = this.pivots[pivotId]?.definition.measures.find((m) => m.id === measureId);
|
|
57351
|
+
if (!measure || !measure.computedBy) {
|
|
57352
|
+
continue;
|
|
57353
|
+
}
|
|
57354
|
+
const sheetId = measure.computedBy.sheetId;
|
|
57355
|
+
const compiledFormula = this.compiledMeasureFormulas[pivotId][measureId].formula;
|
|
57311
57356
|
const newDependencies = [];
|
|
57312
57357
|
for (const range of compiledFormula.dependencies) {
|
|
57313
57358
|
const change = applyChange(range);
|
|
@@ -57319,8 +57364,9 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
57319
57364
|
}
|
|
57320
57365
|
}
|
|
57321
57366
|
const newFormulaString = this.getters.getFormulaString(sheetId, compiledFormula.tokens, newDependencies);
|
|
57322
|
-
|
|
57323
|
-
|
|
57367
|
+
const oldFormulaString = measure.computedBy.formula;
|
|
57368
|
+
if (newFormulaString !== oldFormulaString) {
|
|
57369
|
+
this.replaceMeasureFormula(pivotId, measure, newFormulaString);
|
|
57324
57370
|
}
|
|
57325
57371
|
}
|
|
57326
57372
|
}
|
|
@@ -57358,31 +57404,60 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
57358
57404
|
isExistingPivot(pivotId) {
|
|
57359
57405
|
return pivotId in this.pivots;
|
|
57360
57406
|
}
|
|
57361
|
-
getMeasureCompiledFormula(measure) {
|
|
57407
|
+
getMeasureCompiledFormula(pivotId, measure) {
|
|
57408
|
+
if (!measure.computedBy) {
|
|
57409
|
+
throw new Error(`Measure ${measure.fieldName} is not computed by formula`);
|
|
57410
|
+
}
|
|
57411
|
+
return this.compiledMeasureFormulas[pivotId][measure.id].formula;
|
|
57412
|
+
}
|
|
57413
|
+
getMeasureFullDependencies(pivotId, measure) {
|
|
57362
57414
|
if (!measure.computedBy) {
|
|
57363
57415
|
throw new Error(`Measure ${measure.fieldName} is not computed by formula`);
|
|
57364
57416
|
}
|
|
57365
|
-
|
|
57366
|
-
return this.compiledMeasureFormulas[sheetId][measure.computedBy.formula];
|
|
57417
|
+
return this.compiledMeasureFormulas[pivotId][measure.id].dependencies;
|
|
57367
57418
|
}
|
|
57368
57419
|
// -------------------------------------------------------------------------
|
|
57369
57420
|
// Private
|
|
57370
57421
|
// -------------------------------------------------------------------------
|
|
57371
57422
|
addPivot(pivotId, pivot, formulaId = this.nextFormulaId.toString()) {
|
|
57372
57423
|
this.history.update("pivots", pivotId, { definition: deepCopy(pivot), formulaId });
|
|
57373
|
-
this.compileCalculatedMeasures(pivot.measures);
|
|
57424
|
+
this.compileCalculatedMeasures(pivotId, pivot.measures);
|
|
57374
57425
|
this.history.update("formulaIds", formulaId, pivotId);
|
|
57375
57426
|
this.history.update("nextFormulaId", this.nextFormulaId + 1);
|
|
57376
57427
|
}
|
|
57377
|
-
compileCalculatedMeasures(measures) {
|
|
57428
|
+
compileCalculatedMeasures(pivotId, measures) {
|
|
57378
57429
|
for (const measure of measures) {
|
|
57379
57430
|
if (measure.computedBy) {
|
|
57380
|
-
const sheetId = measure.computedBy.sheetId;
|
|
57381
57431
|
const compiledFormula = this.compileMeasureFormula(measure.computedBy.sheetId, measure.computedBy.formula);
|
|
57382
|
-
this.history.update("compiledMeasureFormulas",
|
|
57432
|
+
this.history.update("compiledMeasureFormulas", pivotId, measure.id, "formula", compiledFormula);
|
|
57433
|
+
}
|
|
57434
|
+
}
|
|
57435
|
+
for (const measure of measures) {
|
|
57436
|
+
if (measure.computedBy) {
|
|
57437
|
+
const dependencies = this.computeMeasureFullDependencies(pivotId, measure);
|
|
57438
|
+
this.history.update("compiledMeasureFormulas", pivotId, measure.id, "dependencies", dependencies);
|
|
57383
57439
|
}
|
|
57384
57440
|
}
|
|
57385
57441
|
}
|
|
57442
|
+
computeMeasureFullDependencies(pivotId, measure, exploredMeasures = new Set()) {
|
|
57443
|
+
const rangeDependencies = [];
|
|
57444
|
+
const definition = this.getPivotCoreDefinition(pivotId);
|
|
57445
|
+
const formula = this.getMeasureCompiledFormula(pivotId, measure);
|
|
57446
|
+
exploredMeasures.add(measure.id);
|
|
57447
|
+
for (const token of formula.tokens) {
|
|
57448
|
+
if (token.type !== "SYMBOL") {
|
|
57449
|
+
continue;
|
|
57450
|
+
}
|
|
57451
|
+
const otherMeasure = definition.measures.find((measureCandidate) => getCanonicalSymbolName(measureCandidate.id) === token.value &&
|
|
57452
|
+
measure.id !== measureCandidate.id);
|
|
57453
|
+
if (!otherMeasure || exploredMeasures.has(otherMeasure.id) || !otherMeasure.computedBy) {
|
|
57454
|
+
continue;
|
|
57455
|
+
}
|
|
57456
|
+
rangeDependencies.push(...this.computeMeasureFullDependencies(pivotId, otherMeasure, exploredMeasures));
|
|
57457
|
+
}
|
|
57458
|
+
rangeDependencies.push(...formula.dependencies.filter((range) => !range.invalidXc));
|
|
57459
|
+
return rangeDependencies;
|
|
57460
|
+
}
|
|
57386
57461
|
insertPivot(position, formulaId, table) {
|
|
57387
57462
|
this.resizeSheet(position.sheetId, position, table);
|
|
57388
57463
|
const pivotCells = table.getPivotCells();
|
|
@@ -57439,21 +57514,17 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
57439
57514
|
dependencies: rangeDependencies,
|
|
57440
57515
|
};
|
|
57441
57516
|
}
|
|
57442
|
-
replaceMeasureFormula(
|
|
57443
|
-
|
|
57444
|
-
|
|
57445
|
-
|
|
57446
|
-
const pivot = this.pivots[pivotId];
|
|
57447
|
-
if (!pivot) {
|
|
57448
|
-
continue;
|
|
57449
|
-
}
|
|
57450
|
-
for (const measure of pivot.definition.measures) {
|
|
57451
|
-
if (measure.computedBy?.formula === formulaString) {
|
|
57452
|
-
const measureIndex = pivot.definition.measures.indexOf(measure);
|
|
57453
|
-
this.history.update("pivots", pivotId, "definition", "measures", measureIndex, "computedBy", { formula: newFormulaString, sheetId });
|
|
57454
|
-
}
|
|
57455
|
-
}
|
|
57517
|
+
replaceMeasureFormula(pivotId, measure, newFormulaString) {
|
|
57518
|
+
const pivot = this.pivots[pivotId];
|
|
57519
|
+
if (!pivot) {
|
|
57520
|
+
return;
|
|
57456
57521
|
}
|
|
57522
|
+
const measureIndex = pivot.definition.measures.indexOf(measure);
|
|
57523
|
+
this.history.update("pivots", pivotId, "definition", "measures", measureIndex, "computedBy", {
|
|
57524
|
+
formula: newFormulaString,
|
|
57525
|
+
sheetId: measure.computedBy.sheetId,
|
|
57526
|
+
});
|
|
57527
|
+
this.compileCalculatedMeasures(pivotId, pivot.definition.measures);
|
|
57457
57528
|
}
|
|
57458
57529
|
checkDuplicatedMeasureIds(definition) {
|
|
57459
57530
|
const uniqueIds = new Set(definition.measures.map((m) => m.id));
|
|
@@ -58846,11 +58917,16 @@ class SpreadingRelation {
|
|
|
58846
58917
|
return this.arrayFormulasToResults.get(formulasPosition);
|
|
58847
58918
|
}
|
|
58848
58919
|
/**
|
|
58849
|
-
* Remove a
|
|
58920
|
+
* Remove a spreading relation for a given array formula position
|
|
58921
|
+
* and its result zone
|
|
58850
58922
|
*/
|
|
58851
58923
|
removeNode(position) {
|
|
58924
|
+
const resultZone = this.arrayFormulasToResults.get(position);
|
|
58925
|
+
if (!resultZone) {
|
|
58926
|
+
return;
|
|
58927
|
+
}
|
|
58852
58928
|
this.resultsToArrayFormulas.remove({
|
|
58853
|
-
boundingBox: { sheetId: position.sheetId, zone:
|
|
58929
|
+
boundingBox: { sheetId: position.sheetId, zone: resultZone },
|
|
58854
58930
|
data: position,
|
|
58855
58931
|
});
|
|
58856
58932
|
this.arrayFormulasToResults.delete(position);
|
|
@@ -59134,6 +59210,10 @@ class Evaluator {
|
|
|
59134
59210
|
// empty matrix
|
|
59135
59211
|
return createEvaluatedCell({ value: 0 }, this.getters.getLocale(), cellData);
|
|
59136
59212
|
}
|
|
59213
|
+
if (nbRows === 1 && nbColumns === 1) {
|
|
59214
|
+
// single value matrix
|
|
59215
|
+
return createEvaluatedCell(nullValueToZeroValue(formulaReturn[0][0]), this.getters.getLocale(), cellData);
|
|
59216
|
+
}
|
|
59137
59217
|
const resultZone = {
|
|
59138
59218
|
top: formulaPosition.row,
|
|
59139
59219
|
bottom: formulaPosition.row + nbRows - 1,
|
|
@@ -60593,6 +60673,7 @@ class HeaderSizeUIPlugin extends UIPlugin {
|
|
|
60593
60673
|
handle(cmd) {
|
|
60594
60674
|
switch (cmd.type) {
|
|
60595
60675
|
case "START":
|
|
60676
|
+
case "UPDATE_LOCALE":
|
|
60596
60677
|
for (const sheetId of this.getters.getSheetIds()) {
|
|
60597
60678
|
this.initializeSheet(sheetId);
|
|
60598
60679
|
}
|
|
@@ -60698,7 +60779,7 @@ class HeaderSizeUIPlugin extends UIPlugin {
|
|
|
60698
60779
|
}
|
|
60699
60780
|
const cell = this.getters.getCell(position);
|
|
60700
60781
|
const colSize = this.getters.getColSize(position.sheetId, position.col);
|
|
60701
|
-
return getDefaultCellHeight(this.ctx, cell, colSize);
|
|
60782
|
+
return getDefaultCellHeight(this.ctx, cell, this.getters.getLocale(), colSize);
|
|
60702
60783
|
}
|
|
60703
60784
|
isInMultiRowMerge(position) {
|
|
60704
60785
|
const merge = this.getters.getMerge(position);
|
|
@@ -60745,14 +60826,16 @@ const PERCENT_FORMAT = "0.00%";
|
|
|
60745
60826
|
function withPivotPresentationLayer (PivotClass) {
|
|
60746
60827
|
class PivotPresentationLayer extends PivotClass {
|
|
60747
60828
|
getters;
|
|
60829
|
+
pivotId;
|
|
60748
60830
|
cache = {};
|
|
60749
60831
|
rankAsc = {};
|
|
60750
60832
|
rankDesc = {};
|
|
60751
60833
|
runningTotal = {};
|
|
60752
60834
|
runningTotalInPercent = {};
|
|
60753
|
-
constructor(custom, params) {
|
|
60835
|
+
constructor(pivotId, custom, params) {
|
|
60754
60836
|
super(custom, params);
|
|
60755
60837
|
this.getters = params.getters;
|
|
60838
|
+
this.pivotId = pivotId;
|
|
60756
60839
|
}
|
|
60757
60840
|
markAsDirtyForEvaluation() {
|
|
60758
60841
|
this.cache = {};
|
|
@@ -60802,7 +60885,7 @@ function withPivotPresentationLayer (PivotClass) {
|
|
|
60802
60885
|
return handleError(error, measure.aggregator.toUpperCase());
|
|
60803
60886
|
}
|
|
60804
60887
|
}
|
|
60805
|
-
const formula = this.getters.getMeasureCompiledFormula(measure);
|
|
60888
|
+
const formula = this.getters.getMeasureCompiledFormula(this.pivotId, measure);
|
|
60806
60889
|
const getSymbolValue = (symbolName) => {
|
|
60807
60890
|
const { columns, rows } = this.definition;
|
|
60808
60891
|
if (columns.find((col) => col.nameWithGranularity === symbolName)) {
|
|
@@ -61520,7 +61603,7 @@ class PivotUIPlugin extends UIPlugin {
|
|
|
61520
61603
|
const definition = deepCopy(this.getters.getPivotCoreDefinition(pivotId));
|
|
61521
61604
|
if (!(pivotId in this.pivots)) {
|
|
61522
61605
|
const Pivot = withPivotPresentationLayer(pivotRegistry.get(definition.type).ui);
|
|
61523
|
-
this.pivots[pivotId] = new Pivot(this.custom, { definition, getters: this.getters });
|
|
61606
|
+
this.pivots[pivotId] = new Pivot(pivotId, this.custom, { definition, getters: this.getters });
|
|
61524
61607
|
}
|
|
61525
61608
|
else if (recreate) {
|
|
61526
61609
|
this.pivots[pivotId].onDefinitionChange(definition);
|
|
@@ -73327,6 +73410,9 @@ function addStyles(styles) {
|
|
|
73327
73410
|
if (style.alignment && style.alignment.wrapText) {
|
|
73328
73411
|
alignAttrs.push(["wrapText", "1"]);
|
|
73329
73412
|
}
|
|
73413
|
+
if (style.alignment && style.alignment.shrinkToFit) {
|
|
73414
|
+
alignAttrs.push(["shrinkToFit", "1"]);
|
|
73415
|
+
}
|
|
73330
73416
|
if (alignAttrs.length > 0) {
|
|
73331
73417
|
attributes.push(["applyAlignment", "1"]); // for Libre Office
|
|
73332
73418
|
styleNodes.push(escapeXml /*xml*/ `<xf ${formatAttributes(attributes)}><alignment ${formatAttributes(alignAttrs)} /></xf> `);
|
|
@@ -74794,6 +74880,6 @@ exports.tokenColors = tokenColors;
|
|
|
74794
74880
|
exports.tokenize = tokenize;
|
|
74795
74881
|
|
|
74796
74882
|
|
|
74797
|
-
__info__.version = "18.0.
|
|
74798
|
-
__info__.date = "
|
|
74799
|
-
__info__.hash = "
|
|
74883
|
+
__info__.version = "18.0.55";
|
|
74884
|
+
__info__.date = "2026-01-21T11:03:48.979Z";
|
|
74885
|
+
__info__.hash = "0c94015";
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -3764,7 +3764,7 @@ declare class CellPlugin extends CorePlugin<CoreState$1> implements CoreState$1
|
|
|
3764
3764
|
export(data: WorkbookData): void;
|
|
3765
3765
|
importCell(sheetId: UID, content?: string, style?: Style, format?: Format): Cell;
|
|
3766
3766
|
exportForExcel(data: ExcelWorkbookData): void;
|
|
3767
|
-
private
|
|
3767
|
+
private extractCustomStyle;
|
|
3768
3768
|
getCells(sheetId: UID): Record<UID, Cell>;
|
|
3769
3769
|
/**
|
|
3770
3770
|
* get a cell by ID. Used in evaluation when evaluating an async cell, we need to be able to find it back after
|
|
@@ -4255,14 +4255,18 @@ interface Pivot$1 {
|
|
|
4255
4255
|
definition: PivotCoreDefinition;
|
|
4256
4256
|
formulaId: string;
|
|
4257
4257
|
}
|
|
4258
|
+
interface MeasureState {
|
|
4259
|
+
formula: RangeCompiledFormula;
|
|
4260
|
+
dependencies: Range[];
|
|
4261
|
+
}
|
|
4258
4262
|
interface CoreState {
|
|
4259
4263
|
nextFormulaId: number;
|
|
4260
4264
|
pivots: Record<UID, Pivot$1 | undefined>;
|
|
4261
4265
|
formulaIds: Record<UID, string | undefined>;
|
|
4262
|
-
compiledMeasureFormulas: Record<UID, Record<string,
|
|
4266
|
+
compiledMeasureFormulas: Record<UID, Record<string, MeasureState | undefined>>;
|
|
4263
4267
|
}
|
|
4264
4268
|
declare class PivotCorePlugin extends CorePlugin<CoreState> implements CoreState {
|
|
4265
|
-
static getters: readonly ["getPivotCoreDefinition", "getPivotDisplayName", "getPivotId", "getPivotFormulaId", "getPivotIds", "getMeasureCompiledFormula", "getPivotName", "isExistingPivot"];
|
|
4269
|
+
static getters: readonly ["getPivotCoreDefinition", "getPivotDisplayName", "getPivotId", "getPivotFormulaId", "getPivotIds", "getMeasureCompiledFormula", "getPivotName", "isExistingPivot", "getMeasureFullDependencies"];
|
|
4266
4270
|
readonly nextFormulaId: number;
|
|
4267
4271
|
readonly pivots: {
|
|
4268
4272
|
[pivotId: UID]: Pivot$1 | undefined;
|
|
@@ -4270,7 +4274,7 @@ declare class PivotCorePlugin extends CorePlugin<CoreState> implements CoreState
|
|
|
4270
4274
|
readonly formulaIds: {
|
|
4271
4275
|
[formulaId: UID]: UID | undefined;
|
|
4272
4276
|
};
|
|
4273
|
-
readonly compiledMeasureFormulas: Record<UID, Record<string,
|
|
4277
|
+
readonly compiledMeasureFormulas: Record<UID, Record<string, MeasureState>>;
|
|
4274
4278
|
allowDispatch(cmd: CoreCommand): CommandResult.Success | CommandResult.NoChanges | CommandResult.PivotIdNotFound | CommandResult.EmptyName | CommandResult.InvalidDefinition;
|
|
4275
4279
|
handle(cmd: CoreCommand): void;
|
|
4276
4280
|
adaptRanges(applyChange: ApplyRangeChange): void;
|
|
@@ -4289,9 +4293,11 @@ declare class PivotCorePlugin extends CorePlugin<CoreState> implements CoreState
|
|
|
4289
4293
|
getPivotFormulaId(pivotId: UID): string;
|
|
4290
4294
|
getPivotIds(): UID[];
|
|
4291
4295
|
isExistingPivot(pivotId: UID): boolean;
|
|
4292
|
-
getMeasureCompiledFormula(measure: PivotCoreMeasure): RangeCompiledFormula;
|
|
4296
|
+
getMeasureCompiledFormula(pivotId: UID, measure: PivotCoreMeasure): RangeCompiledFormula;
|
|
4297
|
+
getMeasureFullDependencies(pivotId: UID, measure: PivotCoreMeasure): Range[];
|
|
4293
4298
|
private addPivot;
|
|
4294
4299
|
private compileCalculatedMeasures;
|
|
4300
|
+
private computeMeasureFullDependencies;
|
|
4295
4301
|
private insertPivot;
|
|
4296
4302
|
private resizeSheet;
|
|
4297
4303
|
private getPivotCore;
|