@odoo/o-spreadsheet 18.3.31 → 18.3.33
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 +299 -233
- package/dist/o-spreadsheet.d.ts +224 -212
- package/dist/o-spreadsheet.esm.js +299 -233
- package/dist/o-spreadsheet.iife.js +299 -233
- package/dist/o-spreadsheet.iife.min.js +399 -399
- 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.3.
|
|
6
|
-
* @date
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.3.33
|
|
6
|
+
* @date 2026-01-21T11:05:17.933Z
|
|
7
|
+
* @hash b7e5d91
|
|
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,
|
|
@@ -309,6 +310,7 @@ const DEFAULT_STYLE = {
|
|
|
309
310
|
fillColor: "",
|
|
310
311
|
textColor: "",
|
|
311
312
|
};
|
|
313
|
+
const DEFAULT_NUMBER_STYLE = { ...DEFAULT_STYLE, align: "right" };
|
|
312
314
|
const DEFAULT_VERTICAL_ALIGN = DEFAULT_STYLE.verticalAlign;
|
|
313
315
|
const DEFAULT_WRAPPING_MODE = DEFAULT_STYLE.wrapping;
|
|
314
316
|
// Fonts
|
|
@@ -6181,67 +6183,6 @@ function getFullReference(sheetName, xc) {
|
|
|
6181
6183
|
return sheetName !== undefined ? `${getCanonicalSymbolName(sheetName)}!${xc}` : xc;
|
|
6182
6184
|
}
|
|
6183
6185
|
|
|
6184
|
-
function createDefaultRows(rowNumber) {
|
|
6185
|
-
const rows = [];
|
|
6186
|
-
for (let i = 0; i < rowNumber; i++) {
|
|
6187
|
-
const row = {
|
|
6188
|
-
cells: {},
|
|
6189
|
-
};
|
|
6190
|
-
rows.push(row);
|
|
6191
|
-
}
|
|
6192
|
-
return rows;
|
|
6193
|
-
}
|
|
6194
|
-
function moveHeaderIndexesOnHeaderAddition(indexHeaderAdded, numberAdded, headers) {
|
|
6195
|
-
return headers.map((header) => {
|
|
6196
|
-
if (header >= indexHeaderAdded) {
|
|
6197
|
-
return header + numberAdded;
|
|
6198
|
-
}
|
|
6199
|
-
return header;
|
|
6200
|
-
});
|
|
6201
|
-
}
|
|
6202
|
-
function moveHeaderIndexesOnHeaderDeletion(deletedHeaders, headers) {
|
|
6203
|
-
deletedHeaders = [...deletedHeaders].sort((a, b) => b - a);
|
|
6204
|
-
return headers
|
|
6205
|
-
.map((header) => {
|
|
6206
|
-
for (const deletedHeader of deletedHeaders) {
|
|
6207
|
-
if (header > deletedHeader) {
|
|
6208
|
-
header--;
|
|
6209
|
-
}
|
|
6210
|
-
else if (header === deletedHeader) {
|
|
6211
|
-
return undefined;
|
|
6212
|
-
}
|
|
6213
|
-
}
|
|
6214
|
-
return header;
|
|
6215
|
-
})
|
|
6216
|
-
.filter(isDefined);
|
|
6217
|
-
}
|
|
6218
|
-
function getNextSheetName(existingNames, baseName = "Sheet") {
|
|
6219
|
-
let i = 1;
|
|
6220
|
-
let name = `${baseName}${i}`;
|
|
6221
|
-
while (existingNames.includes(name)) {
|
|
6222
|
-
name = `${baseName}${i}`;
|
|
6223
|
-
i++;
|
|
6224
|
-
}
|
|
6225
|
-
return name;
|
|
6226
|
-
}
|
|
6227
|
-
function getDuplicateSheetName(nameToDuplicate, existingNames) {
|
|
6228
|
-
let i = 1;
|
|
6229
|
-
const baseName = _t("Copy of %s", nameToDuplicate);
|
|
6230
|
-
let name = baseName.toString();
|
|
6231
|
-
while (existingNames.includes(name)) {
|
|
6232
|
-
name = `${baseName} (${i})`;
|
|
6233
|
-
i++;
|
|
6234
|
-
}
|
|
6235
|
-
return name;
|
|
6236
|
-
}
|
|
6237
|
-
function isSheetNameEqual(name1, name2) {
|
|
6238
|
-
if (name1 === undefined || name2 === undefined) {
|
|
6239
|
-
return false;
|
|
6240
|
-
}
|
|
6241
|
-
return (getUnquotedSheetName(name1.trim().toUpperCase()) ===
|
|
6242
|
-
getUnquotedSheetName(name2.trim().toUpperCase()));
|
|
6243
|
-
}
|
|
6244
|
-
|
|
6245
6186
|
function createRange(args, getSheetSize) {
|
|
6246
6187
|
const unboundedZone = args.zone;
|
|
6247
6188
|
const zone = boundUnboundedZone(unboundedZone, getSheetSize(args.sheetId));
|
|
@@ -6536,8 +6477,8 @@ function getApplyRangeChangeRemoveColRow(cmd) {
|
|
|
6536
6477
|
elements.sort((a, b) => b - a);
|
|
6537
6478
|
const groups = groupConsecutive(elements);
|
|
6538
6479
|
return (range) => {
|
|
6539
|
-
if (
|
|
6540
|
-
return { changeType: "NONE" };
|
|
6480
|
+
if (range.sheetId !== cmd.sheetId) {
|
|
6481
|
+
return { changeType: "NONE", range };
|
|
6541
6482
|
}
|
|
6542
6483
|
let newRange = range;
|
|
6543
6484
|
let changeType = "NONE";
|
|
@@ -6564,10 +6505,7 @@ function getApplyRangeChangeRemoveColRow(cmd) {
|
|
|
6564
6505
|
newRange = createAdaptedRange(newRange, dimension, changeType, -(max - min + 1));
|
|
6565
6506
|
}
|
|
6566
6507
|
}
|
|
6567
|
-
|
|
6568
|
-
return { changeType, range: newRange };
|
|
6569
|
-
}
|
|
6570
|
-
return { changeType: "NONE" };
|
|
6508
|
+
return { changeType, range: newRange };
|
|
6571
6509
|
};
|
|
6572
6510
|
}
|
|
6573
6511
|
function getApplyRangeChangeAddColRow(cmd) {
|
|
@@ -6576,7 +6514,7 @@ function getApplyRangeChangeAddColRow(cmd) {
|
|
|
6576
6514
|
let dimension = cmd.dimension === "COL" ? "columns" : "rows";
|
|
6577
6515
|
return (range) => {
|
|
6578
6516
|
if (range.sheetId !== cmd.sheetId) {
|
|
6579
|
-
return { changeType: "NONE" };
|
|
6517
|
+
return { changeType: "NONE", range };
|
|
6580
6518
|
}
|
|
6581
6519
|
if (cmd.position === "after") {
|
|
6582
6520
|
if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) {
|
|
@@ -6606,13 +6544,13 @@ function getApplyRangeChangeAddColRow(cmd) {
|
|
|
6606
6544
|
};
|
|
6607
6545
|
}
|
|
6608
6546
|
}
|
|
6609
|
-
return { changeType: "NONE" };
|
|
6547
|
+
return { changeType: "NONE", range };
|
|
6610
6548
|
};
|
|
6611
6549
|
}
|
|
6612
6550
|
function getApplyRangeChangeDeleteSheet(cmd) {
|
|
6613
6551
|
return (range) => {
|
|
6614
6552
|
if (range.sheetId !== cmd.sheetId && range.invalidSheetName !== cmd.sheetName) {
|
|
6615
|
-
return { changeType: "NONE" };
|
|
6553
|
+
return { changeType: "NONE", range };
|
|
6616
6554
|
}
|
|
6617
6555
|
const invalidSheetName = cmd.sheetName;
|
|
6618
6556
|
range = {
|
|
@@ -6639,14 +6577,14 @@ function getApplyRangeChangeRenameSheet(cmd) {
|
|
|
6639
6577
|
const newRange = { ...range, sheetId, invalidSheetName };
|
|
6640
6578
|
return { changeType: "CHANGE", range: newRange };
|
|
6641
6579
|
}
|
|
6642
|
-
return { changeType: "NONE" };
|
|
6580
|
+
return { changeType: "NONE", range };
|
|
6643
6581
|
};
|
|
6644
6582
|
}
|
|
6645
6583
|
function getApplyRangeChangeMoveRange(cmd) {
|
|
6646
6584
|
const originZone = cmd.target[0];
|
|
6647
6585
|
return (range) => {
|
|
6648
6586
|
if (range.sheetId !== cmd.sheetId || !isZoneInside(range.zone, originZone)) {
|
|
6649
|
-
return { changeType: "NONE" };
|
|
6587
|
+
return { changeType: "NONE", range };
|
|
6650
6588
|
}
|
|
6651
6589
|
const targetSheetId = cmd.targetSheetId;
|
|
6652
6590
|
const offsetX = cmd.col - originZone.left;
|
|
@@ -6743,17 +6681,87 @@ function fuzzyLookup(pattern, list, fn) {
|
|
|
6743
6681
|
return results.map((r) => r.elem);
|
|
6744
6682
|
}
|
|
6745
6683
|
|
|
6684
|
+
function createDefaultRows(rowNumber) {
|
|
6685
|
+
const rows = [];
|
|
6686
|
+
for (let i = 0; i < rowNumber; i++) {
|
|
6687
|
+
const row = {
|
|
6688
|
+
cells: {},
|
|
6689
|
+
};
|
|
6690
|
+
rows.push(row);
|
|
6691
|
+
}
|
|
6692
|
+
return rows;
|
|
6693
|
+
}
|
|
6694
|
+
function moveHeaderIndexesOnHeaderAddition(indexHeaderAdded, numberAdded, headers) {
|
|
6695
|
+
return headers.map((header) => {
|
|
6696
|
+
if (header >= indexHeaderAdded) {
|
|
6697
|
+
return header + numberAdded;
|
|
6698
|
+
}
|
|
6699
|
+
return header;
|
|
6700
|
+
});
|
|
6701
|
+
}
|
|
6702
|
+
function moveHeaderIndexesOnHeaderDeletion(deletedHeaders, headers) {
|
|
6703
|
+
deletedHeaders = [...deletedHeaders].sort((a, b) => b - a);
|
|
6704
|
+
return headers
|
|
6705
|
+
.map((header) => {
|
|
6706
|
+
for (const deletedHeader of deletedHeaders) {
|
|
6707
|
+
if (header > deletedHeader) {
|
|
6708
|
+
header--;
|
|
6709
|
+
}
|
|
6710
|
+
else if (header === deletedHeader) {
|
|
6711
|
+
return undefined;
|
|
6712
|
+
}
|
|
6713
|
+
}
|
|
6714
|
+
return header;
|
|
6715
|
+
})
|
|
6716
|
+
.filter(isDefined);
|
|
6717
|
+
}
|
|
6718
|
+
function getNextSheetName(existingNames, baseName = "Sheet") {
|
|
6719
|
+
let i = 1;
|
|
6720
|
+
let name = `${baseName}${i}`;
|
|
6721
|
+
while (existingNames.includes(name)) {
|
|
6722
|
+
name = `${baseName}${i}`;
|
|
6723
|
+
i++;
|
|
6724
|
+
}
|
|
6725
|
+
return name;
|
|
6726
|
+
}
|
|
6727
|
+
function getDuplicateSheetName(nameToDuplicate, existingNames) {
|
|
6728
|
+
let i = 1;
|
|
6729
|
+
const baseName = _t("Copy of %s", nameToDuplicate);
|
|
6730
|
+
let name = baseName.toString();
|
|
6731
|
+
while (existingNames.includes(name)) {
|
|
6732
|
+
name = `${baseName} (${i})`;
|
|
6733
|
+
i++;
|
|
6734
|
+
}
|
|
6735
|
+
return name;
|
|
6736
|
+
}
|
|
6737
|
+
function isSheetNameEqual(name1, name2) {
|
|
6738
|
+
if (name1 === undefined || name2 === undefined) {
|
|
6739
|
+
return false;
|
|
6740
|
+
}
|
|
6741
|
+
return (getUnquotedSheetName(name1.trim().toUpperCase()) ===
|
|
6742
|
+
getUnquotedSheetName(name2.trim().toUpperCase()));
|
|
6743
|
+
}
|
|
6744
|
+
|
|
6746
6745
|
function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
|
|
6747
6746
|
return numberOfLines * (textLineHeight + MIN_CELL_TEXT_MARGIN) - MIN_CELL_TEXT_MARGIN;
|
|
6748
6747
|
}
|
|
6749
6748
|
/**
|
|
6750
6749
|
* Get the default height of the cell given its style.
|
|
6751
6750
|
*/
|
|
6752
|
-
function getDefaultCellHeight(ctx, cell, colSize) {
|
|
6751
|
+
function getDefaultCellHeight(ctx, cell, locale, colSize) {
|
|
6753
6752
|
if (!cell || (!cell.isFormula && !cell.content)) {
|
|
6754
6753
|
return DEFAULT_CELL_HEIGHT;
|
|
6755
6754
|
}
|
|
6756
|
-
|
|
6755
|
+
let content = "";
|
|
6756
|
+
try {
|
|
6757
|
+
if (!cell.isFormula) {
|
|
6758
|
+
const localeFormat = { format: cell.format, locale };
|
|
6759
|
+
content = formatValue(parseLiteral(cell.content, locale), localeFormat);
|
|
6760
|
+
}
|
|
6761
|
+
}
|
|
6762
|
+
catch {
|
|
6763
|
+
content = CellErrorType.GenericError;
|
|
6764
|
+
}
|
|
6757
6765
|
return getCellContentHeight(ctx, content, cell.style, colSize);
|
|
6758
6766
|
}
|
|
6759
6767
|
function getCellContentHeight(ctx, content, style, colSize) {
|
|
@@ -18415,9 +18423,10 @@ function assertDomainLength(domain) {
|
|
|
18415
18423
|
throw new EvaluationError(_t("Function PIVOT takes an even number of arguments."));
|
|
18416
18424
|
}
|
|
18417
18425
|
}
|
|
18418
|
-
function addPivotDependencies(evalContext,
|
|
18426
|
+
function addPivotDependencies(evalContext, pivotId, forMeasures) {
|
|
18419
18427
|
//TODO This function can be very costly when used with PIVOT.VALUE and PIVOT.HEADER
|
|
18420
18428
|
const dependencies = [];
|
|
18429
|
+
const coreDefinition = evalContext.getters.getPivotCoreDefinition(pivotId);
|
|
18421
18430
|
if (coreDefinition.type === "SPREADSHEET" && coreDefinition.dataSet) {
|
|
18422
18431
|
const { sheetId, zone } = coreDefinition.dataSet;
|
|
18423
18432
|
const xc = zoneToXc(zone);
|
|
@@ -18434,8 +18443,7 @@ function addPivotDependencies(evalContext, coreDefinition, forMeasures) {
|
|
|
18434
18443
|
}
|
|
18435
18444
|
for (const measure of forMeasures) {
|
|
18436
18445
|
if (measure.computedBy) {
|
|
18437
|
-
|
|
18438
|
-
dependencies.push(...formula.dependencies.filter((range) => !range.invalidXc));
|
|
18446
|
+
dependencies.push(...evalContext.getters.getMeasureFullDependencies(pivotId, measure));
|
|
18439
18447
|
}
|
|
18440
18448
|
}
|
|
18441
18449
|
const originPosition = evalContext.__originCellPosition;
|
|
@@ -18870,7 +18878,7 @@ const PIVOT_VALUE = {
|
|
|
18870
18878
|
assertDomainLength(domainArgs);
|
|
18871
18879
|
const pivot = this.getters.getPivot(pivotId);
|
|
18872
18880
|
const coreDefinition = this.getters.getPivotCoreDefinition(pivotId);
|
|
18873
|
-
addPivotDependencies(this,
|
|
18881
|
+
addPivotDependencies(this, pivotId, coreDefinition.measures.filter((m) => m.id === _measure));
|
|
18874
18882
|
pivot.init({ reload: pivot.needsReevaluation });
|
|
18875
18883
|
const error = pivot.assertIsValid({ throwOnError: false });
|
|
18876
18884
|
if (error) {
|
|
@@ -18903,8 +18911,7 @@ const PIVOT_HEADER = {
|
|
|
18903
18911
|
const _pivotId = getPivotId(_pivotFormulaId, this.getters);
|
|
18904
18912
|
assertDomainLength(domainArgs);
|
|
18905
18913
|
const pivot = this.getters.getPivot(_pivotId);
|
|
18906
|
-
|
|
18907
|
-
addPivotDependencies(this, coreDefinition, []);
|
|
18914
|
+
addPivotDependencies(this, _pivotId, []);
|
|
18908
18915
|
pivot.init({ reload: pivot.needsReevaluation });
|
|
18909
18916
|
const error = pivot.assertIsValid({ throwOnError: false });
|
|
18910
18917
|
if (error) {
|
|
@@ -18958,7 +18965,7 @@ const PIVOT = {
|
|
|
18958
18965
|
const pivotId = getPivotId(_pivotFormulaId, this.getters);
|
|
18959
18966
|
const pivot = this.getters.getPivot(pivotId);
|
|
18960
18967
|
const coreDefinition = this.getters.getPivotCoreDefinition(pivotId);
|
|
18961
|
-
addPivotDependencies(this,
|
|
18968
|
+
addPivotDependencies(this, pivotId, coreDefinition.measures);
|
|
18962
18969
|
pivot.init({ reload: pivot.needsReevaluation });
|
|
18963
18970
|
const error = pivot.assertIsValid({ throwOnError: false });
|
|
18964
18971
|
if (error) {
|
|
@@ -20187,7 +20194,16 @@ function createComputeFunction(descr) {
|
|
|
20187
20194
|
}
|
|
20188
20195
|
acceptToVectorize.push(!argDefinition.acceptMatrix);
|
|
20189
20196
|
}
|
|
20190
|
-
return applyVectorization(errorHandlingCompute.bind(this), args, acceptToVectorize);
|
|
20197
|
+
return replaceErrorPlaceholderInResult(applyVectorization(errorHandlingCompute.bind(this), args, acceptToVectorize));
|
|
20198
|
+
}
|
|
20199
|
+
function replaceErrorPlaceholderInResult(result) {
|
|
20200
|
+
if (!isMatrix(result)) {
|
|
20201
|
+
replaceFunctionNamePlaceholder(result, descr.name);
|
|
20202
|
+
}
|
|
20203
|
+
else {
|
|
20204
|
+
matrixForEach(result, (result) => replaceFunctionNamePlaceholder(result, descr.name));
|
|
20205
|
+
}
|
|
20206
|
+
return result;
|
|
20191
20207
|
}
|
|
20192
20208
|
function errorHandlingCompute(...args) {
|
|
20193
20209
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -20215,13 +20231,12 @@ function createComputeFunction(descr) {
|
|
|
20215
20231
|
const result = descr.compute.apply(this, args);
|
|
20216
20232
|
if (!isMatrix(result)) {
|
|
20217
20233
|
if (typeof result === "object" && result !== null && "value" in result) {
|
|
20218
|
-
replaceFunctionNamePlaceholder(result, descr.name);
|
|
20219
20234
|
return result;
|
|
20220
20235
|
}
|
|
20236
|
+
descr.name;
|
|
20221
20237
|
return { value: result };
|
|
20222
20238
|
}
|
|
20223
20239
|
if (typeof result[0][0] === "object" && result[0][0] !== null && "value" in result[0][0]) {
|
|
20224
|
-
matrixForEach(result, (result) => replaceFunctionNamePlaceholder(result, descr.name));
|
|
20225
20240
|
return result;
|
|
20226
20241
|
}
|
|
20227
20242
|
return matrixMap(result, (row) => ({ value: row }));
|
|
@@ -20673,7 +20688,7 @@ function adaptFormulaStringRanges(defaultSheetId, formula, applyChange) {
|
|
|
20673
20688
|
continue;
|
|
20674
20689
|
}
|
|
20675
20690
|
const sheetXC = tokens[tokenIdx].value;
|
|
20676
|
-
const newSheetXC = adaptStringRange(defaultSheetId, sheetXC, applyChange);
|
|
20691
|
+
const newSheetXC = adaptStringRange(defaultSheetId, sheetXC, applyChange).range;
|
|
20677
20692
|
if (sheetXC !== newSheetXC) {
|
|
20678
20693
|
tokens[tokenIdx] = {
|
|
20679
20694
|
value: newSheetXC,
|
|
@@ -20683,23 +20698,30 @@ function adaptFormulaStringRanges(defaultSheetId, formula, applyChange) {
|
|
|
20683
20698
|
}
|
|
20684
20699
|
return concat(tokens.map((token) => token.value));
|
|
20685
20700
|
}
|
|
20686
|
-
function adaptStringRange(defaultSheetId, sheetXC,
|
|
20701
|
+
function adaptStringRange(defaultSheetId, sheetXC, rangeAdapter) {
|
|
20687
20702
|
const sheetName = splitReference(sheetXC).sheetName;
|
|
20688
20703
|
if (sheetName
|
|
20689
|
-
? !isSheetNameEqual(sheetName,
|
|
20690
|
-
: defaultSheetId !==
|
|
20691
|
-
return sheetXC;
|
|
20704
|
+
? !isSheetNameEqual(sheetName, rangeAdapter.sheetName.old)
|
|
20705
|
+
: defaultSheetId !== rangeAdapter.sheetId) {
|
|
20706
|
+
return { changeType: "NONE", range: sheetXC };
|
|
20692
20707
|
}
|
|
20693
|
-
const sheetId = sheetName ?
|
|
20708
|
+
const sheetId = sheetName ? rangeAdapter.sheetId : defaultSheetId;
|
|
20694
20709
|
const range = getRange(sheetXC, sheetId);
|
|
20695
20710
|
if (range.invalidXc) {
|
|
20696
|
-
return sheetXC;
|
|
20711
|
+
return { changeType: "NONE", range: sheetXC };
|
|
20697
20712
|
}
|
|
20698
|
-
const change =
|
|
20713
|
+
const change = rangeAdapter.applyChange(range);
|
|
20699
20714
|
if (change.changeType === "NONE" || change.changeType === "REMOVE") {
|
|
20700
|
-
return sheetXC;
|
|
20715
|
+
return { changeType: change.changeType, range: sheetXC };
|
|
20701
20716
|
}
|
|
20702
|
-
|
|
20717
|
+
const rangeStr = getRangeString(change.range, defaultSheetId, getSheetNameGetter(rangeAdapter));
|
|
20718
|
+
if (rangeStr === CellErrorType.InvalidReference) {
|
|
20719
|
+
return { changeType: "REMOVE", range: rangeStr };
|
|
20720
|
+
}
|
|
20721
|
+
return {
|
|
20722
|
+
changeType: change.changeType,
|
|
20723
|
+
range: rangeStr,
|
|
20724
|
+
};
|
|
20703
20725
|
}
|
|
20704
20726
|
function getSheetNameGetter(applyChange) {
|
|
20705
20727
|
return (sheetId) => {
|
|
@@ -20798,8 +20820,6 @@ function adaptChartRange(range, applyChange) {
|
|
|
20798
20820
|
}
|
|
20799
20821
|
const change = applyChange(range);
|
|
20800
20822
|
switch (change.changeType) {
|
|
20801
|
-
case "NONE":
|
|
20802
|
-
return range;
|
|
20803
20823
|
case "REMOVE":
|
|
20804
20824
|
return undefined;
|
|
20805
20825
|
default:
|
|
@@ -20937,16 +20957,16 @@ function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
|
|
|
20937
20957
|
function transformChartDefinitionWithDataSetsWithZone(chartSheetId, definition, applyChange) {
|
|
20938
20958
|
let labelRange;
|
|
20939
20959
|
if (definition.labelRange) {
|
|
20940
|
-
const adaptedRange = adaptStringRange(chartSheetId, definition.labelRange, applyChange);
|
|
20941
|
-
if (
|
|
20960
|
+
const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, definition.labelRange, applyChange);
|
|
20961
|
+
if (changeType !== "REMOVE") {
|
|
20942
20962
|
labelRange = adaptedRange;
|
|
20943
20963
|
}
|
|
20944
20964
|
}
|
|
20945
20965
|
const dataSets = [];
|
|
20946
20966
|
for (const dataSet of definition.dataSets) {
|
|
20947
20967
|
const newDataSet = { ...dataSet };
|
|
20948
|
-
const adaptedRange = adaptStringRange(chartSheetId, dataSet.dataRange, applyChange);
|
|
20949
|
-
if (
|
|
20968
|
+
const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, dataSet.dataRange, applyChange);
|
|
20969
|
+
if (changeType !== "REMOVE") {
|
|
20950
20970
|
newDataSet.dataRange = adaptedRange;
|
|
20951
20971
|
dataSets.push(newDataSet);
|
|
20952
20972
|
}
|
|
@@ -22272,14 +22292,14 @@ let ScorecardChart$1 = class ScorecardChart extends AbstractChart {
|
|
|
22272
22292
|
let baseline;
|
|
22273
22293
|
let keyValue;
|
|
22274
22294
|
if (definition.baseline) {
|
|
22275
|
-
const adaptedRange = adaptStringRange(chartSheetId, definition.baseline, applyChange);
|
|
22276
|
-
if (
|
|
22295
|
+
const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, definition.baseline, applyChange);
|
|
22296
|
+
if (changeType !== "REMOVE") {
|
|
22277
22297
|
baseline = adaptedRange;
|
|
22278
22298
|
}
|
|
22279
22299
|
}
|
|
22280
22300
|
if (definition.keyValue) {
|
|
22281
|
-
const adaptedRange = adaptStringRange(chartSheetId, definition.keyValue, applyChange);
|
|
22282
|
-
if (
|
|
22301
|
+
const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, definition.keyValue, applyChange);
|
|
22302
|
+
if (changeType !== "REMOVE") {
|
|
22283
22303
|
keyValue = adaptedRange;
|
|
22284
22304
|
}
|
|
22285
22305
|
}
|
|
@@ -22335,7 +22355,7 @@ let ScorecardChart$1 = class ScorecardChart extends AbstractChart {
|
|
|
22335
22355
|
// This kind of graph is not exportable in Excel
|
|
22336
22356
|
return undefined;
|
|
22337
22357
|
}
|
|
22338
|
-
updateRanges(applyChange) {
|
|
22358
|
+
updateRanges({ applyChange }) {
|
|
22339
22359
|
const baseline = adaptChartRange(this.baseline, applyChange);
|
|
22340
22360
|
const keyValue = adaptChartRange(this.keyValue, applyChange);
|
|
22341
22361
|
if (this.baseline === baseline && this.keyValue === keyValue) {
|
|
@@ -23230,7 +23250,7 @@ class AbstractComposerStore extends SpreadsheetStore {
|
|
|
23230
23250
|
}
|
|
23231
23251
|
captureSelection(zone, col, row) {
|
|
23232
23252
|
this.model.selection.capture(this, {
|
|
23233
|
-
cell: { col: col ?? zone.left, row: row ?? zone.
|
|
23253
|
+
cell: { col: col ?? zone.left, row: row ?? zone.top },
|
|
23234
23254
|
zone,
|
|
23235
23255
|
}, {
|
|
23236
23256
|
handleEvent: this.handleEvent.bind(this),
|
|
@@ -27207,7 +27227,7 @@ class BarChart extends AbstractChart {
|
|
|
27207
27227
|
verticalAxis: getDefinedAxis(definition),
|
|
27208
27228
|
};
|
|
27209
27229
|
}
|
|
27210
|
-
updateRanges(applyChange) {
|
|
27230
|
+
updateRanges({ applyChange }) {
|
|
27211
27231
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
27212
27232
|
if (!isStale) {
|
|
27213
27233
|
return this;
|
|
@@ -27328,7 +27348,7 @@ class ComboChart extends AbstractChart {
|
|
|
27328
27348
|
verticalAxis: getDefinedAxis(definition),
|
|
27329
27349
|
};
|
|
27330
27350
|
}
|
|
27331
|
-
updateRanges(applyChange) {
|
|
27351
|
+
updateRanges({ applyChange }) {
|
|
27332
27352
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
27333
27353
|
if (!isStale) {
|
|
27334
27354
|
return this;
|
|
@@ -27499,7 +27519,7 @@ class FunnelChart extends AbstractChart {
|
|
|
27499
27519
|
getDefinitionForExcel() {
|
|
27500
27520
|
return undefined;
|
|
27501
27521
|
}
|
|
27502
|
-
updateRanges(applyChange) {
|
|
27522
|
+
updateRanges({ applyChange }) {
|
|
27503
27523
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
27504
27524
|
if (!isStale) {
|
|
27505
27525
|
return this;
|
|
@@ -27610,8 +27630,8 @@ class GaugeChart extends AbstractChart {
|
|
|
27610
27630
|
static transformDefinition(chartSheetId, definition, applyChange) {
|
|
27611
27631
|
let dataRange;
|
|
27612
27632
|
if (definition.dataRange) {
|
|
27613
|
-
const adaptedRange = adaptStringRange(chartSheetId, definition.dataRange, applyChange);
|
|
27614
|
-
if (
|
|
27633
|
+
const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, definition.dataRange, applyChange);
|
|
27634
|
+
if (changeType !== "REMOVE") {
|
|
27615
27635
|
dataRange = adaptedRange;
|
|
27616
27636
|
}
|
|
27617
27637
|
}
|
|
@@ -27686,13 +27706,9 @@ class GaugeChart extends AbstractChart {
|
|
|
27686
27706
|
: undefined,
|
|
27687
27707
|
};
|
|
27688
27708
|
}
|
|
27689
|
-
updateRanges(applyChange,
|
|
27709
|
+
updateRanges({ applyChange, adaptFormulaString }) {
|
|
27690
27710
|
const dataRange = adaptChartRange(this.dataRange, applyChange);
|
|
27691
|
-
const adaptFormula = (formula) =>
|
|
27692
|
-
applyChange,
|
|
27693
|
-
sheetId,
|
|
27694
|
-
sheetName: adaptSheetName,
|
|
27695
|
-
});
|
|
27711
|
+
const adaptFormula = (formula) => adaptFormulaString(this.sheetId, formula);
|
|
27696
27712
|
const sectionRule = adaptSectionRuleFormulas(this.sectionRule, adaptFormula);
|
|
27697
27713
|
const definition = this.getDefinitionWithSpecificRanges(dataRange, sectionRule);
|
|
27698
27714
|
return new GaugeChart(definition, this.sheetId, this.getters);
|
|
@@ -27912,7 +27928,7 @@ class GeoChart extends AbstractChart {
|
|
|
27912
27928
|
getDefinitionForExcel() {
|
|
27913
27929
|
return undefined;
|
|
27914
27930
|
}
|
|
27915
|
-
updateRanges(applyChange) {
|
|
27931
|
+
updateRanges({ applyChange }) {
|
|
27916
27932
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
27917
27933
|
if (!isStale) {
|
|
27918
27934
|
return this;
|
|
@@ -28044,7 +28060,7 @@ class LineChart extends AbstractChart {
|
|
|
28044
28060
|
: undefined,
|
|
28045
28061
|
};
|
|
28046
28062
|
}
|
|
28047
|
-
updateRanges(applyChange) {
|
|
28063
|
+
updateRanges({ applyChange }) {
|
|
28048
28064
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
28049
28065
|
if (!isStale) {
|
|
28050
28066
|
return this;
|
|
@@ -28201,7 +28217,7 @@ class PieChart extends AbstractChart {
|
|
|
28201
28217
|
labelRange,
|
|
28202
28218
|
};
|
|
28203
28219
|
}
|
|
28204
|
-
updateRanges(applyChange) {
|
|
28220
|
+
updateRanges({ applyChange }) {
|
|
28205
28221
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
28206
28222
|
if (!isStale) {
|
|
28207
28223
|
return this;
|
|
@@ -28337,7 +28353,7 @@ class PyramidChart extends AbstractChart {
|
|
|
28337
28353
|
getDefinitionForExcel() {
|
|
28338
28354
|
return undefined;
|
|
28339
28355
|
}
|
|
28340
|
-
updateRanges(applyChange) {
|
|
28356
|
+
updateRanges({ applyChange }) {
|
|
28341
28357
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
28342
28358
|
if (!isStale) {
|
|
28343
28359
|
return this;
|
|
@@ -28484,7 +28500,7 @@ class RadarChart extends AbstractChart {
|
|
|
28484
28500
|
labelRange,
|
|
28485
28501
|
};
|
|
28486
28502
|
}
|
|
28487
|
-
updateRanges(applyChange) {
|
|
28503
|
+
updateRanges({ applyChange }) {
|
|
28488
28504
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
28489
28505
|
if (!isStale) {
|
|
28490
28506
|
return this;
|
|
@@ -28606,7 +28622,7 @@ class ScatterChart extends AbstractChart {
|
|
|
28606
28622
|
: undefined,
|
|
28607
28623
|
};
|
|
28608
28624
|
}
|
|
28609
|
-
updateRanges(applyChange) {
|
|
28625
|
+
updateRanges({ applyChange }) {
|
|
28610
28626
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
28611
28627
|
if (!isStale) {
|
|
28612
28628
|
return this;
|
|
@@ -28768,7 +28784,7 @@ class SunburstChart extends AbstractChart {
|
|
|
28768
28784
|
getDefinitionForExcel() {
|
|
28769
28785
|
return undefined;
|
|
28770
28786
|
}
|
|
28771
|
-
updateRanges(applyChange) {
|
|
28787
|
+
updateRanges({ applyChange }) {
|
|
28772
28788
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
28773
28789
|
if (!isStale) {
|
|
28774
28790
|
return this;
|
|
@@ -28916,7 +28932,7 @@ class TreeMapChart extends AbstractChart {
|
|
|
28916
28932
|
getDefinitionForExcel() {
|
|
28917
28933
|
return undefined;
|
|
28918
28934
|
}
|
|
28919
|
-
updateRanges(applyChange) {
|
|
28935
|
+
updateRanges({ applyChange }) {
|
|
28920
28936
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
28921
28937
|
if (!isStale) {
|
|
28922
28938
|
return this;
|
|
@@ -29071,7 +29087,7 @@ class WaterfallChart extends AbstractChart {
|
|
|
29071
29087
|
// TODO: implement export excel
|
|
29072
29088
|
return undefined;
|
|
29073
29089
|
}
|
|
29074
|
-
updateRanges(applyChange) {
|
|
29090
|
+
updateRanges({ applyChange }) {
|
|
29075
29091
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
29076
29092
|
if (!isStale) {
|
|
29077
29093
|
return this;
|
|
@@ -31939,6 +31955,7 @@ function extractStyle(data, content, styleId, formatId, borderId) {
|
|
|
31939
31955
|
? V_ALIGNMENT_EXPORT_CONVERSION_MAP[style.verticalAlign]
|
|
31940
31956
|
: undefined,
|
|
31941
31957
|
wrapText: style.wrapping === "wrap" || content?.includes(NEWLINE) ? true : undefined,
|
|
31958
|
+
shrinkToFit: style.wrapping === "clip" ? true : undefined,
|
|
31942
31959
|
},
|
|
31943
31960
|
};
|
|
31944
31961
|
styles.font["strike"] = !!style?.strikethrough || undefined;
|
|
@@ -31959,6 +31976,7 @@ function normalizeStyle(construct, styles) {
|
|
|
31959
31976
|
vertical: styles.alignment.vertical,
|
|
31960
31977
|
horizontal: styles.alignment.horizontal,
|
|
31961
31978
|
wrapText: styles.alignment.wrapText,
|
|
31979
|
+
shrinkToFit: styles.alignment.shrinkToFit,
|
|
31962
31980
|
},
|
|
31963
31981
|
};
|
|
31964
31982
|
return pushElement(style, construct.styles);
|
|
@@ -42963,7 +42981,7 @@ class GaugeChartConfigPanel extends owl.Component {
|
|
|
42963
42981
|
});
|
|
42964
42982
|
dataRange = this.props.definition.dataRange;
|
|
42965
42983
|
get configurationErrorMessages() {
|
|
42966
|
-
const cancelledReasons = [...(this.state.dataRangeDispatchResult?.reasons || [])];
|
|
42984
|
+
const cancelledReasons = [...(this.state.dataRangeDispatchResult?.reasons || [])].filter((reason) => reason !== "NoChanges" /* CommandResult.NoChanges */);
|
|
42967
42985
|
return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
42968
42986
|
}
|
|
42969
42987
|
get isDataRangeInvalid() {
|
|
@@ -44387,7 +44405,7 @@ class GaugeChartDesignPanel extends owl.Component {
|
|
|
44387
44405
|
});
|
|
44388
44406
|
}
|
|
44389
44407
|
get designErrorMessages() {
|
|
44390
|
-
const cancelledReasons = [...(this.state.sectionRuleCancelledReasons || [])];
|
|
44408
|
+
const cancelledReasons = [...(this.state.sectionRuleCancelledReasons || [])].filter((reason) => reason !== "NoChanges" /* CommandResult.NoChanges */);
|
|
44391
44409
|
return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
44392
44410
|
}
|
|
44393
44411
|
get isRangeMinInvalid() {
|
|
@@ -44723,7 +44741,7 @@ class ScorecardChartConfigPanel extends owl.Component {
|
|
|
44723
44741
|
const cancelledReasons = [
|
|
44724
44742
|
...(this.state.keyValueDispatchResult?.reasons || []),
|
|
44725
44743
|
...(this.state.baselineDispatchResult?.reasons || []),
|
|
44726
|
-
];
|
|
44744
|
+
].filter((reason) => reason !== "NoChanges" /* CommandResult.NoChanges */);
|
|
44727
44745
|
return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
44728
44746
|
}
|
|
44729
44747
|
get isKeyValueInvalid() {
|
|
@@ -47618,6 +47636,12 @@ class FindAndReplaceStore extends SpreadsheetStore {
|
|
|
47618
47636
|
case "ACTIVATE_SHEET":
|
|
47619
47637
|
this.isSearchDirty = true;
|
|
47620
47638
|
this.shouldFinalizeUpdateSelection = true;
|
|
47639
|
+
if (this.searchOptions.specificRange) {
|
|
47640
|
+
this.searchOptions.specificRange = {
|
|
47641
|
+
...this.searchOptions.specificRange,
|
|
47642
|
+
sheetId: this.getters.getActiveSheetId(),
|
|
47643
|
+
};
|
|
47644
|
+
}
|
|
47621
47645
|
break;
|
|
47622
47646
|
case "REPLACE_SEARCH":
|
|
47623
47647
|
for (const match of cmd.matches) {
|
|
@@ -48039,9 +48063,20 @@ class FindAndReplacePanel extends owl.Component {
|
|
|
48039
48063
|
const specificRange = this.env.model.getters.getRangeFromSheetXC(this.env.model.getters.getActiveSheetId(), this.state.dataRange);
|
|
48040
48064
|
this.store.updateSearchOptions({ specificRange });
|
|
48041
48065
|
}
|
|
48066
|
+
get specificRange() {
|
|
48067
|
+
const range = this.store.searchOptions.specificRange;
|
|
48068
|
+
return range ? this.env.model.getters.getRangeString(range, "forceSheetReference") : "";
|
|
48069
|
+
}
|
|
48042
48070
|
get pendingSearch() {
|
|
48043
48071
|
return this.updateSearchContent.isDebouncePending();
|
|
48044
48072
|
}
|
|
48073
|
+
get selectionInputKey() {
|
|
48074
|
+
// Selections input are made to work with objects linked to a sheet id. They store the active sheet id at their creation,
|
|
48075
|
+
// and have specific behaviour linked to it (eg. go back to the initial sheet after confirmation).
|
|
48076
|
+
// We don't want all those behaviors here, so we force the recreation of the component when the active sheet changes.
|
|
48077
|
+
// The only drawback is that the input loses focus when changing sheet.
|
|
48078
|
+
return this.env.model.getters.getActiveSheetId();
|
|
48079
|
+
}
|
|
48045
48080
|
}
|
|
48046
48081
|
|
|
48047
48082
|
css /* scss */ `
|
|
@@ -50311,8 +50346,6 @@ function adaptPivotRange(range, applyChange) {
|
|
|
50311
50346
|
}
|
|
50312
50347
|
const change = applyChange(range);
|
|
50313
50348
|
switch (change.changeType) {
|
|
50314
|
-
case "NONE":
|
|
50315
|
-
return range;
|
|
50316
50349
|
case "REMOVE":
|
|
50317
50350
|
return undefined;
|
|
50318
50351
|
default:
|
|
@@ -57375,7 +57408,7 @@ class CorePlugin extends BasePlugin {
|
|
|
57375
57408
|
* @param sheetId an sheetId to adapt either range of that sheet specifically, or ranges pointing to that sheet
|
|
57376
57409
|
* @param sheetName couple of old and new sheet names to adapt ranges pointing to that sheet
|
|
57377
57410
|
*/
|
|
57378
|
-
adaptRanges(
|
|
57411
|
+
adaptRanges(rangeAdapterFunctions, sheetId, sheetName) { }
|
|
57379
57412
|
/**
|
|
57380
57413
|
* Implement this method to clean unused external resources, such as images
|
|
57381
57414
|
* stored on a server which have been deleted.
|
|
@@ -57971,7 +58004,7 @@ class CellPlugin extends CorePlugin {
|
|
|
57971
58004
|
];
|
|
57972
58005
|
nextId = 1;
|
|
57973
58006
|
cells = {};
|
|
57974
|
-
adaptRanges(applyChange, sheetId, sheetName) {
|
|
58007
|
+
adaptRanges({ applyChange }, sheetId, sheetName) {
|
|
57975
58008
|
for (const sheet of Object.keys(this.cells)) {
|
|
57976
58009
|
for (const cell of Object.values(this.cells[sheet] || {})) {
|
|
57977
58010
|
if (cell.isFormula) {
|
|
@@ -58193,7 +58226,7 @@ class CellPlugin extends CorePlugin {
|
|
|
58193
58226
|
for (const position of positions) {
|
|
58194
58227
|
const cell = this.getters.getCell(position);
|
|
58195
58228
|
const xc = toXC(position.col, position.row);
|
|
58196
|
-
const style = this.
|
|
58229
|
+
const style = this.extractCustomStyle(cell);
|
|
58197
58230
|
if (Object.keys(style).length) {
|
|
58198
58231
|
const styleId = getItemId(style, styles);
|
|
58199
58232
|
positionsByStyle[styleId] ??= [];
|
|
@@ -58239,10 +58272,14 @@ class CellPlugin extends CorePlugin {
|
|
|
58239
58272
|
}
|
|
58240
58273
|
}
|
|
58241
58274
|
}
|
|
58242
|
-
|
|
58243
|
-
const cleanedStyle = { ...style };
|
|
58244
|
-
|
|
58245
|
-
|
|
58275
|
+
extractCustomStyle(cell) {
|
|
58276
|
+
const cleanedStyle = { ...cell.style };
|
|
58277
|
+
const defaultStyle = isNumber(cell.content, DEFAULT_LOCALE)
|
|
58278
|
+
? DEFAULT_NUMBER_STYLE
|
|
58279
|
+
: DEFAULT_STYLE;
|
|
58280
|
+
for (const property in cleanedStyle) {
|
|
58281
|
+
if ((property !== "align" || !cell.isFormula) &&
|
|
58282
|
+
cleanedStyle[property] === defaultStyle[property]) {
|
|
58246
58283
|
delete cleanedStyle[property];
|
|
58247
58284
|
}
|
|
58248
58285
|
}
|
|
@@ -58592,9 +58629,9 @@ class ChartPlugin extends CorePlugin {
|
|
|
58592
58629
|
charts = {};
|
|
58593
58630
|
createChart = chartFactory(this.getters);
|
|
58594
58631
|
validateChartDefinition = (cmd) => validateChartDefinition(this, cmd.definition);
|
|
58595
|
-
adaptRanges(
|
|
58632
|
+
adaptRanges(rangeAdapters) {
|
|
58596
58633
|
for (const [chartId, chart] of Object.entries(this.charts)) {
|
|
58597
|
-
this.history.update("charts", chartId, chart?.updateRanges(
|
|
58634
|
+
this.history.update("charts", chartId, chart?.updateRanges(rangeAdapters));
|
|
58598
58635
|
}
|
|
58599
58636
|
}
|
|
58600
58637
|
// ---------------------------------------------------------------------------
|
|
@@ -58784,7 +58821,7 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
58784
58821
|
"getAdaptedCfRanges",
|
|
58785
58822
|
];
|
|
58786
58823
|
cfRules = {};
|
|
58787
|
-
adaptCFFormulas(applyChange) {
|
|
58824
|
+
adaptCFFormulas({ applyChange, adaptFormulaString }) {
|
|
58788
58825
|
for (const sheetId in this.cfRules) {
|
|
58789
58826
|
for (const rule of this.cfRules[sheetId]) {
|
|
58790
58827
|
if (rule.rule.type === "DataBarRule" && rule.rule.rangeValues) {
|
|
@@ -58808,7 +58845,7 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
58808
58845
|
for (let i = 0; i < rule.rule.values.length; i++) {
|
|
58809
58846
|
this.history.update("cfRules", sheetId, this.cfRules[sheetId].indexOf(rule), "rule",
|
|
58810
58847
|
//@ts-expect-error
|
|
58811
|
-
"values", i,
|
|
58848
|
+
"values", i, adaptFormulaString(sheetId, rule.rule.values[i]));
|
|
58812
58849
|
}
|
|
58813
58850
|
}
|
|
58814
58851
|
else if (rule.rule.type === "IconSetRule") {
|
|
@@ -58816,7 +58853,7 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
58816
58853
|
if (rule.rule[inflectionPoint].type === "formula") {
|
|
58817
58854
|
this.history.update("cfRules", sheetId, this.cfRules[sheetId].indexOf(rule), "rule",
|
|
58818
58855
|
//@ts-expect-error
|
|
58819
|
-
inflectionPoint, "value",
|
|
58856
|
+
inflectionPoint, "value", adaptFormulaString(sheetId, rule.rule[inflectionPoint].value));
|
|
58820
58857
|
}
|
|
58821
58858
|
}
|
|
58822
58859
|
}
|
|
@@ -58826,14 +58863,14 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
58826
58863
|
if (ruleValue?.type === "formula" && ruleValue?.value) {
|
|
58827
58864
|
this.history.update("cfRules", sheetId, this.cfRules[sheetId].indexOf(rule), "rule",
|
|
58828
58865
|
//@ts-expect-error
|
|
58829
|
-
value, "value",
|
|
58866
|
+
value, "value", adaptFormulaString(sheetId, ruleValue.value));
|
|
58830
58867
|
}
|
|
58831
58868
|
}
|
|
58832
58869
|
}
|
|
58833
58870
|
}
|
|
58834
58871
|
}
|
|
58835
58872
|
}
|
|
58836
|
-
adaptCFRanges(sheetId, applyChange) {
|
|
58873
|
+
adaptCFRanges(sheetId, { applyChange }) {
|
|
58837
58874
|
for (const rule of this.cfRules[sheetId]) {
|
|
58838
58875
|
for (const range of rule.ranges) {
|
|
58839
58876
|
const change = applyChange(range);
|
|
@@ -58857,12 +58894,12 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
58857
58894
|
}
|
|
58858
58895
|
}
|
|
58859
58896
|
}
|
|
58860
|
-
adaptRanges(
|
|
58897
|
+
adaptRanges(rangeAdapters, sheetId) {
|
|
58861
58898
|
const sheetIds = sheetId ? [sheetId] : Object.keys(this.cfRules);
|
|
58862
58899
|
for (const sheetId of sheetIds) {
|
|
58863
|
-
this.adaptCFRanges(sheetId,
|
|
58900
|
+
this.adaptCFRanges(sheetId, rangeAdapters);
|
|
58864
58901
|
}
|
|
58865
|
-
this.adaptCFFormulas(
|
|
58902
|
+
this.adaptCFFormulas(rangeAdapters);
|
|
58866
58903
|
}
|
|
58867
58904
|
// ---------------------------------------------------------------------------
|
|
58868
58905
|
// Command Handling
|
|
@@ -59253,23 +59290,23 @@ class DataValidationPlugin extends CorePlugin {
|
|
|
59253
59290
|
"getValidationRuleForCell",
|
|
59254
59291
|
];
|
|
59255
59292
|
rules = {};
|
|
59256
|
-
adaptRanges(
|
|
59257
|
-
this.adaptDVRanges(sheetId,
|
|
59258
|
-
this.adaptDVFormulas(
|
|
59293
|
+
adaptRanges(rangeAdapters, sheetId) {
|
|
59294
|
+
this.adaptDVRanges(sheetId, rangeAdapters);
|
|
59295
|
+
this.adaptDVFormulas(rangeAdapters);
|
|
59259
59296
|
}
|
|
59260
|
-
adaptDVFormulas(
|
|
59297
|
+
adaptDVFormulas({ adaptFormulaString }) {
|
|
59261
59298
|
for (const sheetId in this.rules) {
|
|
59262
59299
|
const rules = this.rules[sheetId];
|
|
59263
59300
|
for (let ruleIndex = rules.length - 1; ruleIndex >= 0; ruleIndex--) {
|
|
59264
59301
|
const rule = this.rules[sheetId][ruleIndex];
|
|
59265
59302
|
for (let valueIndex = 0; valueIndex < rule.criterion.values.length; valueIndex++) {
|
|
59266
|
-
const value =
|
|
59303
|
+
const value = adaptFormulaString(sheetId, rule.criterion.values[valueIndex]);
|
|
59267
59304
|
this.history.update("rules", sheetId, ruleIndex, "criterion", "values", valueIndex, value);
|
|
59268
59305
|
}
|
|
59269
59306
|
}
|
|
59270
59307
|
}
|
|
59271
59308
|
}
|
|
59272
|
-
adaptDVRanges(sheetId, applyChange) {
|
|
59309
|
+
adaptDVRanges(sheetId, { applyChange }) {
|
|
59273
59310
|
const rules = this.rules[sheetId];
|
|
59274
59311
|
for (let ruleIndex = rules.length - 1; ruleIndex >= 0; ruleIndex--) {
|
|
59275
59312
|
const rule = this.rules[sheetId][ruleIndex];
|
|
@@ -59543,7 +59580,7 @@ class FigurePlugin extends CorePlugin {
|
|
|
59543
59580
|
// ---------------------------------------------------------------------------
|
|
59544
59581
|
// Command Handling
|
|
59545
59582
|
// ---------------------------------------------------------------------------
|
|
59546
|
-
adaptRanges(applyChange, sheetId) {
|
|
59583
|
+
adaptRanges({ applyChange }, sheetId) {
|
|
59547
59584
|
for (const figure of this.getFigures(sheetId)) {
|
|
59548
59585
|
const change = applyChange(this.getters.getRangeFromZone(sheetId, {
|
|
59549
59586
|
left: figure.col,
|
|
@@ -60350,8 +60387,8 @@ class MergePlugin extends CorePlugin {
|
|
|
60350
60387
|
break;
|
|
60351
60388
|
}
|
|
60352
60389
|
}
|
|
60353
|
-
adaptRanges(
|
|
60354
|
-
this.applyRangeChangeOnSheet(sheetId,
|
|
60390
|
+
adaptRanges(rangeAdapters, sheetId) {
|
|
60391
|
+
this.applyRangeChangeOnSheet(sheetId, rangeAdapters);
|
|
60355
60392
|
}
|
|
60356
60393
|
// ---------------------------------------------------------------------------
|
|
60357
60394
|
// Getters
|
|
@@ -60656,7 +60693,7 @@ class MergePlugin extends CorePlugin {
|
|
|
60656
60693
|
/**
|
|
60657
60694
|
* Apply a range change on merges of a particular sheet.
|
|
60658
60695
|
*/
|
|
60659
|
-
applyRangeChangeOnSheet(sheetId, applyChange) {
|
|
60696
|
+
applyRangeChangeOnSheet(sheetId, { applyChange }) {
|
|
60660
60697
|
const merges = Object.entries(this.merges[sheetId] || {});
|
|
60661
60698
|
for (const [mergeId, range] of merges) {
|
|
60662
60699
|
if (range) {
|
|
@@ -60730,7 +60767,7 @@ function rangeToMerge(mergeId, range) {
|
|
|
60730
60767
|
};
|
|
60731
60768
|
}
|
|
60732
60769
|
|
|
60733
|
-
class
|
|
60770
|
+
class RangeAdapterPlugin {
|
|
60734
60771
|
getters;
|
|
60735
60772
|
providers = [];
|
|
60736
60773
|
isAdaptingRanges = false;
|
|
@@ -60738,7 +60775,6 @@ class RangeAdapter {
|
|
|
60738
60775
|
this.getters = getters;
|
|
60739
60776
|
}
|
|
60740
60777
|
static getters = [
|
|
60741
|
-
"adaptFormulaStringDependencies",
|
|
60742
60778
|
"copyFormulaStringForSheet",
|
|
60743
60779
|
"extendRange",
|
|
60744
60780
|
"getRangeString",
|
|
@@ -60769,8 +60805,8 @@ class RangeAdapter {
|
|
|
60769
60805
|
throw new Error("Plugins cannot dispatch commands during adaptRanges phase");
|
|
60770
60806
|
}
|
|
60771
60807
|
const rangeAdapter = getRangeAdapter(cmd);
|
|
60772
|
-
if (rangeAdapter
|
|
60773
|
-
this.executeOnAllRanges(rangeAdapter
|
|
60808
|
+
if (rangeAdapter) {
|
|
60809
|
+
this.executeOnAllRanges(rangeAdapter);
|
|
60774
60810
|
}
|
|
60775
60811
|
}
|
|
60776
60812
|
finalize() { }
|
|
@@ -60789,11 +60825,15 @@ class RangeAdapter {
|
|
|
60789
60825
|
return result;
|
|
60790
60826
|
};
|
|
60791
60827
|
}
|
|
60792
|
-
executeOnAllRanges(
|
|
60828
|
+
executeOnAllRanges(rangeAdapter) {
|
|
60793
60829
|
this.isAdaptingRanges = true;
|
|
60794
|
-
const
|
|
60830
|
+
const adapterFunctions = {
|
|
60831
|
+
applyChange: this.verifyRangeRemoved(rangeAdapter.applyChange),
|
|
60832
|
+
adaptRangeString: (defaultSheetId, sheetXC) => adaptStringRange(defaultSheetId, sheetXC, rangeAdapter),
|
|
60833
|
+
adaptFormulaString: (defaultSheetId, formula) => adaptFormulaStringRanges(defaultSheetId, formula, rangeAdapter),
|
|
60834
|
+
};
|
|
60795
60835
|
for (const provider of this.providers) {
|
|
60796
|
-
provider(
|
|
60836
|
+
provider(adapterFunctions, rangeAdapter.sheetId, rangeAdapter.sheetName);
|
|
60797
60837
|
}
|
|
60798
60838
|
this.isAdaptingRanges = false;
|
|
60799
60839
|
}
|
|
@@ -60961,18 +61001,6 @@ class RangeAdapter {
|
|
|
60961
61001
|
const unionOfZones = unionUnboundedZones(...zones);
|
|
60962
61002
|
return this.getRangeFromZone(ranges[0].sheetId, unionOfZones);
|
|
60963
61003
|
}
|
|
60964
|
-
adaptFormulaStringDependencies(sheetId, formula, applyChange) {
|
|
60965
|
-
if (!formula.startsWith("=")) {
|
|
60966
|
-
return formula;
|
|
60967
|
-
}
|
|
60968
|
-
const compiledFormula = compile(formula);
|
|
60969
|
-
const updatedDependencies = compiledFormula.dependencies.map((dep) => {
|
|
60970
|
-
const range = this.getters.getRangeFromSheetXC(sheetId, dep);
|
|
60971
|
-
const changedRange = applyChange(range);
|
|
60972
|
-
return changedRange.changeType === "NONE" ? range : changedRange.range;
|
|
60973
|
-
});
|
|
60974
|
-
return this.getters.getFormulaString(sheetId, compiledFormula.tokens, updatedDependencies);
|
|
60975
|
-
}
|
|
60976
61004
|
/**
|
|
60977
61005
|
* Copy a formula string to another sheet.
|
|
60978
61006
|
*
|
|
@@ -61865,7 +61893,7 @@ class TablePlugin extends CorePlugin {
|
|
|
61865
61893
|
static getters = ["getCoreTable", "getCoreTables", "getCoreTableMatchingTopLeft"];
|
|
61866
61894
|
tables = {};
|
|
61867
61895
|
nextTableId = 1;
|
|
61868
|
-
adaptRanges(applyChange, sheetId) {
|
|
61896
|
+
adaptRanges({ applyChange }, sheetId) {
|
|
61869
61897
|
for (const table of this.getCoreTables(sheetId)) {
|
|
61870
61898
|
this.applyRangeChangeOnTable(sheetId, table, applyChange);
|
|
61871
61899
|
}
|
|
@@ -62743,6 +62771,7 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
62743
62771
|
"getMeasureCompiledFormula",
|
|
62744
62772
|
"getPivotName",
|
|
62745
62773
|
"isExistingPivot",
|
|
62774
|
+
"getMeasureFullDependencies",
|
|
62746
62775
|
];
|
|
62747
62776
|
nextFormulaId = 1;
|
|
62748
62777
|
pivots = {};
|
|
@@ -62825,12 +62854,12 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
62825
62854
|
}
|
|
62826
62855
|
case "UPDATE_PIVOT": {
|
|
62827
62856
|
this.history.update("pivots", cmd.pivotId, "definition", this.repairSortedColumn(deepCopy(cmd.pivot)));
|
|
62828
|
-
this.compileCalculatedMeasures(cmd.pivot.measures);
|
|
62857
|
+
this.compileCalculatedMeasures(cmd.pivotId, cmd.pivot.measures);
|
|
62829
62858
|
break;
|
|
62830
62859
|
}
|
|
62831
62860
|
}
|
|
62832
62861
|
}
|
|
62833
|
-
adaptRanges(applyChange) {
|
|
62862
|
+
adaptRanges({ applyChange, adaptFormulaString }) {
|
|
62834
62863
|
for (const pivotId in this.pivots) {
|
|
62835
62864
|
const definition = deepCopy(this.pivots[pivotId]?.definition);
|
|
62836
62865
|
if (!definition) {
|
|
@@ -62843,22 +62872,22 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
62843
62872
|
this.history.update("pivots", pivotId, "definition", newDefinition);
|
|
62844
62873
|
}
|
|
62845
62874
|
}
|
|
62846
|
-
for (const
|
|
62847
|
-
for (const
|
|
62848
|
-
const
|
|
62849
|
-
|
|
62850
|
-
|
|
62851
|
-
const change = applyChange(range);
|
|
62852
|
-
if (change.changeType === "NONE") {
|
|
62853
|
-
newDependencies.push(range);
|
|
62854
|
-
}
|
|
62855
|
-
else {
|
|
62856
|
-
newDependencies.push(change.range);
|
|
62857
|
-
}
|
|
62875
|
+
for (const pivotId in this.compiledMeasureFormulas) {
|
|
62876
|
+
for (const measureId in this.compiledMeasureFormulas[pivotId]) {
|
|
62877
|
+
const measure = this.pivots[pivotId]?.definition.measures.find((m) => m.id === measureId);
|
|
62878
|
+
if (!measure || !measure.computedBy) {
|
|
62879
|
+
continue;
|
|
62858
62880
|
}
|
|
62859
|
-
const
|
|
62860
|
-
|
|
62861
|
-
|
|
62881
|
+
const sheetId = measure.computedBy.sheetId;
|
|
62882
|
+
const { formula: compiledFormula, dependencies: indirectDependencies } = this.compiledMeasureFormulas[pivotId][measureId];
|
|
62883
|
+
// adapt direct dependencies
|
|
62884
|
+
this.history.update("compiledMeasureFormulas", pivotId, measureId, "formula", "dependencies", compiledFormula.dependencies.map((range) => applyChange(range).range));
|
|
62885
|
+
// adapt all dependencies (including indirect)
|
|
62886
|
+
this.history.update("compiledMeasureFormulas", pivotId, measure.id, "dependencies", indirectDependencies.map((range) => applyChange(range).range));
|
|
62887
|
+
const oldFormulaString = measure.computedBy.formula;
|
|
62888
|
+
const newFormulaString = adaptFormulaString(sheetId, oldFormulaString);
|
|
62889
|
+
if (newFormulaString !== oldFormulaString) {
|
|
62890
|
+
this.replaceMeasureFormula(pivotId, measure, newFormulaString);
|
|
62862
62891
|
}
|
|
62863
62892
|
}
|
|
62864
62893
|
}
|
|
@@ -62896,12 +62925,17 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
62896
62925
|
isExistingPivot(pivotId) {
|
|
62897
62926
|
return pivotId in this.pivots;
|
|
62898
62927
|
}
|
|
62899
|
-
getMeasureCompiledFormula(measure) {
|
|
62928
|
+
getMeasureCompiledFormula(pivotId, measure) {
|
|
62929
|
+
if (!measure.computedBy) {
|
|
62930
|
+
throw new Error(`Measure ${measure.fieldName} is not computed by formula`);
|
|
62931
|
+
}
|
|
62932
|
+
return this.compiledMeasureFormulas[pivotId][measure.id].formula;
|
|
62933
|
+
}
|
|
62934
|
+
getMeasureFullDependencies(pivotId, measure) {
|
|
62900
62935
|
if (!measure.computedBy) {
|
|
62901
62936
|
throw new Error(`Measure ${measure.fieldName} is not computed by formula`);
|
|
62902
62937
|
}
|
|
62903
|
-
|
|
62904
|
-
return this.compiledMeasureFormulas[sheetId][measure.computedBy.formula];
|
|
62938
|
+
return this.compiledMeasureFormulas[pivotId][measure.id].dependencies;
|
|
62905
62939
|
}
|
|
62906
62940
|
// -------------------------------------------------------------------------
|
|
62907
62941
|
// Private
|
|
@@ -62911,18 +62945,42 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
62911
62945
|
definition: this.repairSortedColumn(deepCopy(pivot)),
|
|
62912
62946
|
formulaId,
|
|
62913
62947
|
});
|
|
62914
|
-
this.compileCalculatedMeasures(pivot.measures);
|
|
62948
|
+
this.compileCalculatedMeasures(pivotId, pivot.measures);
|
|
62915
62949
|
this.history.update("formulaIds", formulaId, pivotId);
|
|
62916
62950
|
this.history.update("nextFormulaId", this.nextFormulaId + 1);
|
|
62917
62951
|
}
|
|
62918
|
-
compileCalculatedMeasures(measures) {
|
|
62952
|
+
compileCalculatedMeasures(pivotId, measures) {
|
|
62919
62953
|
for (const measure of measures) {
|
|
62920
62954
|
if (measure.computedBy) {
|
|
62921
|
-
const sheetId = measure.computedBy.sheetId;
|
|
62922
62955
|
const compiledFormula = this.compileMeasureFormula(measure.computedBy.sheetId, measure.computedBy.formula);
|
|
62923
|
-
this.history.update("compiledMeasureFormulas",
|
|
62956
|
+
this.history.update("compiledMeasureFormulas", pivotId, measure.id, "formula", compiledFormula);
|
|
62924
62957
|
}
|
|
62925
62958
|
}
|
|
62959
|
+
for (const measure of measures) {
|
|
62960
|
+
if (measure.computedBy) {
|
|
62961
|
+
const dependencies = this.computeMeasureFullDependencies(pivotId, measure);
|
|
62962
|
+
this.history.update("compiledMeasureFormulas", pivotId, measure.id, "dependencies", dependencies);
|
|
62963
|
+
}
|
|
62964
|
+
}
|
|
62965
|
+
}
|
|
62966
|
+
computeMeasureFullDependencies(pivotId, measure, exploredMeasures = new Set()) {
|
|
62967
|
+
const rangeDependencies = [];
|
|
62968
|
+
const definition = this.getPivotCoreDefinition(pivotId);
|
|
62969
|
+
const formula = this.getMeasureCompiledFormula(pivotId, measure);
|
|
62970
|
+
exploredMeasures.add(measure.id);
|
|
62971
|
+
for (const token of formula.tokens) {
|
|
62972
|
+
if (token.type !== "SYMBOL") {
|
|
62973
|
+
continue;
|
|
62974
|
+
}
|
|
62975
|
+
const otherMeasure = definition.measures.find((measureCandidate) => getCanonicalSymbolName(measureCandidate.id) === token.value &&
|
|
62976
|
+
measure.id !== measureCandidate.id);
|
|
62977
|
+
if (!otherMeasure || exploredMeasures.has(otherMeasure.id) || !otherMeasure.computedBy) {
|
|
62978
|
+
continue;
|
|
62979
|
+
}
|
|
62980
|
+
rangeDependencies.push(...this.computeMeasureFullDependencies(pivotId, otherMeasure, exploredMeasures));
|
|
62981
|
+
}
|
|
62982
|
+
rangeDependencies.push(...formula.dependencies.filter((range) => !range.invalidXc));
|
|
62983
|
+
return rangeDependencies;
|
|
62926
62984
|
}
|
|
62927
62985
|
insertPivot(position, formulaId, table) {
|
|
62928
62986
|
this.resizeSheet(position.sheetId, position, table);
|
|
@@ -62982,21 +63040,16 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
62982
63040
|
dependencies: rangeDependencies,
|
|
62983
63041
|
};
|
|
62984
63042
|
}
|
|
62985
|
-
replaceMeasureFormula(
|
|
62986
|
-
|
|
62987
|
-
|
|
62988
|
-
|
|
62989
|
-
const pivot = this.pivots[pivotId];
|
|
62990
|
-
if (!pivot) {
|
|
62991
|
-
continue;
|
|
62992
|
-
}
|
|
62993
|
-
for (const measure of pivot.definition.measures) {
|
|
62994
|
-
if (measure.computedBy?.formula === formulaString) {
|
|
62995
|
-
const measureIndex = pivot.definition.measures.indexOf(measure);
|
|
62996
|
-
this.history.update("pivots", pivotId, "definition", "measures", measureIndex, "computedBy", { formula: newFormulaString, sheetId });
|
|
62997
|
-
}
|
|
62998
|
-
}
|
|
63043
|
+
replaceMeasureFormula(pivotId, measure, newFormulaString) {
|
|
63044
|
+
const pivot = this.pivots[pivotId];
|
|
63045
|
+
if (!pivot) {
|
|
63046
|
+
return;
|
|
62999
63047
|
}
|
|
63048
|
+
const measureIndex = pivot.definition.measures.indexOf(measure);
|
|
63049
|
+
this.history.update("pivots", pivotId, "definition", "measures", measureIndex, "computedBy", {
|
|
63050
|
+
formula: newFormulaString,
|
|
63051
|
+
sheetId: measure.computedBy.sheetId,
|
|
63052
|
+
});
|
|
63000
63053
|
}
|
|
63001
63054
|
checkSortedColumnInMeasures(definition) {
|
|
63002
63055
|
definition = this.repairSortedColumn(definition);
|
|
@@ -64401,11 +64454,16 @@ class SpreadingRelation {
|
|
|
64401
64454
|
return this.arrayFormulasToResults.get(formulasPosition);
|
|
64402
64455
|
}
|
|
64403
64456
|
/**
|
|
64404
|
-
* Remove a
|
|
64457
|
+
* Remove a spreading relation for a given array formula position
|
|
64458
|
+
* and its result zone
|
|
64405
64459
|
*/
|
|
64406
64460
|
removeNode(position) {
|
|
64461
|
+
const resultZone = this.arrayFormulasToResults.get(position);
|
|
64462
|
+
if (!resultZone) {
|
|
64463
|
+
return;
|
|
64464
|
+
}
|
|
64407
64465
|
this.resultsToArrayFormulas.remove({
|
|
64408
|
-
boundingBox: { sheetId: position.sheetId, zone:
|
|
64466
|
+
boundingBox: { sheetId: position.sheetId, zone: resultZone },
|
|
64409
64467
|
data: position,
|
|
64410
64468
|
});
|
|
64411
64469
|
this.arrayFormulasToResults.delete(position);
|
|
@@ -64693,6 +64751,10 @@ class Evaluator {
|
|
|
64693
64751
|
// empty matrix
|
|
64694
64752
|
return createEvaluatedCell({ value: 0 }, this.getters.getLocale(), cellData);
|
|
64695
64753
|
}
|
|
64754
|
+
if (nbRows === 1 && nbColumns === 1) {
|
|
64755
|
+
// single value matrix
|
|
64756
|
+
return createEvaluatedCell(nullValueToZeroValue(formulaReturn[0][0]), this.getters.getLocale(), cellData);
|
|
64757
|
+
}
|
|
64696
64758
|
const resultZone = {
|
|
64697
64759
|
top: formulaPosition.row,
|
|
64698
64760
|
bottom: formulaPosition.row + nbRows - 1,
|
|
@@ -66118,6 +66180,7 @@ class HeaderSizeUIPlugin extends CoreViewPlugin {
|
|
|
66118
66180
|
handle(cmd) {
|
|
66119
66181
|
switch (cmd.type) {
|
|
66120
66182
|
case "START":
|
|
66183
|
+
case "UPDATE_LOCALE":
|
|
66121
66184
|
for (const sheetId of this.getters.getSheetIds()) {
|
|
66122
66185
|
this.initializeSheet(sheetId);
|
|
66123
66186
|
}
|
|
@@ -66239,7 +66302,7 @@ class HeaderSizeUIPlugin extends CoreViewPlugin {
|
|
|
66239
66302
|
}
|
|
66240
66303
|
const cell = this.getters.getCell(position);
|
|
66241
66304
|
const colSize = this.getters.getColSize(position.sheetId, position.col);
|
|
66242
|
-
return getDefaultCellHeight(this.ctx, cell, colSize);
|
|
66305
|
+
return getDefaultCellHeight(this.ctx, cell, this.getters.getLocale(), colSize);
|
|
66243
66306
|
}
|
|
66244
66307
|
isInMultiRowMerge(position) {
|
|
66245
66308
|
const merge = this.getters.getMerge(position);
|
|
@@ -66286,14 +66349,16 @@ const PERCENT_FORMAT = "0.00%";
|
|
|
66286
66349
|
function withPivotPresentationLayer (PivotClass) {
|
|
66287
66350
|
class PivotPresentationLayer extends PivotClass {
|
|
66288
66351
|
getters;
|
|
66352
|
+
pivotId;
|
|
66289
66353
|
cache = {};
|
|
66290
66354
|
rankAsc = {};
|
|
66291
66355
|
rankDesc = {};
|
|
66292
66356
|
runningTotal = {};
|
|
66293
66357
|
runningTotalInPercent = {};
|
|
66294
|
-
constructor(custom, params) {
|
|
66358
|
+
constructor(pivotId, custom, params) {
|
|
66295
66359
|
super(custom, params);
|
|
66296
66360
|
this.getters = params.getters;
|
|
66361
|
+
this.pivotId = pivotId;
|
|
66297
66362
|
}
|
|
66298
66363
|
markAsDirtyForEvaluation() {
|
|
66299
66364
|
this.cache = {};
|
|
@@ -66343,7 +66408,7 @@ function withPivotPresentationLayer (PivotClass) {
|
|
|
66343
66408
|
return handleError(error, measure.aggregator.toUpperCase());
|
|
66344
66409
|
}
|
|
66345
66410
|
}
|
|
66346
|
-
const formula = this.getters.getMeasureCompiledFormula(measure);
|
|
66411
|
+
const formula = this.getters.getMeasureCompiledFormula(this.pivotId, measure);
|
|
66347
66412
|
const getSymbolValue = (symbolName) => {
|
|
66348
66413
|
const { columns, rows } = this.definition;
|
|
66349
66414
|
if (columns.find((col) => col.nameWithGranularity === symbolName)) {
|
|
@@ -67071,7 +67136,7 @@ class PivotUIPlugin extends CoreViewPlugin {
|
|
|
67071
67136
|
const definition = deepCopy(this.getters.getPivotCoreDefinition(pivotId));
|
|
67072
67137
|
if (!(pivotId in this.pivots)) {
|
|
67073
67138
|
const Pivot = withPivotPresentationLayer(pivotRegistry.get(definition.type).ui);
|
|
67074
|
-
this.pivots[pivotId] = new Pivot(this.custom, { definition, getters: this.getters });
|
|
67139
|
+
this.pivots[pivotId] = new Pivot(pivotId, this.custom, { definition, getters: this.getters });
|
|
67075
67140
|
}
|
|
67076
67141
|
else if (recreate) {
|
|
67077
67142
|
this.pivots[pivotId].onDefinitionChange(definition);
|
|
@@ -68126,7 +68191,7 @@ function addConditionalFormatCommandAdaptRange(cmd, applyChange) {
|
|
|
68126
68191
|
cmd.cf.rule = {
|
|
68127
68192
|
...rule,
|
|
68128
68193
|
rangeValues: rule.rangeValues
|
|
68129
|
-
? adaptStringRange(cmd.sheetId, rule.rangeValues, applyChange)
|
|
68194
|
+
? adaptStringRange(cmd.sheetId, rule.rangeValues, applyChange).range
|
|
68130
68195
|
: undefined,
|
|
68131
68196
|
};
|
|
68132
68197
|
}
|
|
@@ -79613,6 +79678,9 @@ function addStyles(styles) {
|
|
|
79613
79678
|
if (style.alignment && style.alignment.wrapText) {
|
|
79614
79679
|
alignAttrs.push(["wrapText", "1"]);
|
|
79615
79680
|
}
|
|
79681
|
+
if (style.alignment && style.alignment.shrinkToFit) {
|
|
79682
|
+
alignAttrs.push(["shrinkToFit", "1"]);
|
|
79683
|
+
}
|
|
79616
79684
|
if (alignAttrs.length > 0) {
|
|
79617
79685
|
attributes.push(["applyAlignment", "1"]); // for Libre Office
|
|
79618
79686
|
styleNodes.push(escapeXml /*xml*/ `<xf ${formatAttributes(attributes)}><alignment ${formatAttributes(alignAttrs)} /></xf> `);
|
|
@@ -80383,7 +80451,7 @@ class Model extends EventBus {
|
|
|
80383
80451
|
this.config = this.setupConfig(config);
|
|
80384
80452
|
this.session = this.setupSession(workbookData.revisionId);
|
|
80385
80453
|
this.coreGetters = {};
|
|
80386
|
-
this.range = new
|
|
80454
|
+
this.range = new RangeAdapterPlugin(this.coreGetters);
|
|
80387
80455
|
this.coreGetters.getRangeString = this.range.getRangeString.bind(this.range);
|
|
80388
80456
|
this.coreGetters.getRangeFromSheetXC = this.range.getRangeFromSheetXC.bind(this.range);
|
|
80389
80457
|
this.coreGetters.createAdaptedRanges = this.range.createAdaptedRanges.bind(this.range);
|
|
@@ -80397,8 +80465,6 @@ class Model extends EventBus {
|
|
|
80397
80465
|
this.coreGetters.extendRange = this.range.extendRange.bind(this.range);
|
|
80398
80466
|
this.coreGetters.getRangesUnion = this.range.getRangesUnion.bind(this.range);
|
|
80399
80467
|
this.coreGetters.removeRangesSheetPrefix = this.range.removeRangesSheetPrefix.bind(this.range);
|
|
80400
|
-
this.coreGetters.adaptFormulaStringDependencies =
|
|
80401
|
-
this.range.adaptFormulaStringDependencies.bind(this.range);
|
|
80402
80468
|
this.coreGetters.copyFormulaStringForSheet = this.range.copyFormulaStringForSheet.bind(this.range);
|
|
80403
80469
|
this.getters = {
|
|
80404
80470
|
isReadonly: () => this.config.mode === "readonly" || this.config.mode === "dashboard",
|
|
@@ -81114,6 +81180,6 @@ exports.tokenColors = tokenColors;
|
|
|
81114
81180
|
exports.tokenize = tokenize;
|
|
81115
81181
|
|
|
81116
81182
|
|
|
81117
|
-
__info__.version = "18.3.
|
|
81118
|
-
__info__.date = "
|
|
81119
|
-
__info__.hash = "
|
|
81183
|
+
__info__.version = "18.3.33";
|
|
81184
|
+
__info__.date = "2026-01-21T11:05:17.933Z";
|
|
81185
|
+
__info__.hash = "b7e5d91";
|