@odoo/o-spreadsheet 18.4.23 → 18.4.25
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 +300 -234
- package/dist/o-spreadsheet.d.ts +223 -211
- package/dist/o-spreadsheet.esm.js +300 -234
- package/dist/o-spreadsheet.iife.js +300 -234
- package/dist/o-spreadsheet.iife.min.js +416 -416
- 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.4.
|
|
6
|
-
* @date 2026-01-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.4.25
|
|
6
|
+
* @date 2026-01-21T11:06:11.131Z
|
|
7
|
+
* @hash 161472d
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -42,7 +42,8 @@ function createAction(item) {
|
|
|
42
42
|
return children
|
|
43
43
|
.map((child) => (typeof child === "function" ? child(env) : child))
|
|
44
44
|
.flat()
|
|
45
|
-
.map(createAction)
|
|
45
|
+
.map(createAction)
|
|
46
|
+
.sort((a, b) => a.sequence - b.sequence);
|
|
46
47
|
}
|
|
47
48
|
: () => [],
|
|
48
49
|
isReadonlyAllowed: item.isReadonlyAllowed || false,
|
|
@@ -334,6 +335,7 @@ const DEFAULT_STYLE = {
|
|
|
334
335
|
fillColor: "",
|
|
335
336
|
textColor: "",
|
|
336
337
|
};
|
|
338
|
+
const DEFAULT_NUMBER_STYLE = { ...DEFAULT_STYLE, align: "right" };
|
|
337
339
|
const DEFAULT_VERTICAL_ALIGN = DEFAULT_STYLE.verticalAlign;
|
|
338
340
|
const DEFAULT_WRAPPING_MODE = DEFAULT_STYLE.wrapping;
|
|
339
341
|
// Fonts
|
|
@@ -6387,67 +6389,6 @@ function getFullReference(sheetName, xc) {
|
|
|
6387
6389
|
return sheetName !== undefined ? `${getCanonicalSymbolName(sheetName)}!${xc}` : xc;
|
|
6388
6390
|
}
|
|
6389
6391
|
|
|
6390
|
-
function createDefaultRows(rowNumber) {
|
|
6391
|
-
const rows = [];
|
|
6392
|
-
for (let i = 0; i < rowNumber; i++) {
|
|
6393
|
-
const row = {
|
|
6394
|
-
cells: {},
|
|
6395
|
-
};
|
|
6396
|
-
rows.push(row);
|
|
6397
|
-
}
|
|
6398
|
-
return rows;
|
|
6399
|
-
}
|
|
6400
|
-
function moveHeaderIndexesOnHeaderAddition(indexHeaderAdded, numberAdded, headers) {
|
|
6401
|
-
return headers.map((header) => {
|
|
6402
|
-
if (header >= indexHeaderAdded) {
|
|
6403
|
-
return header + numberAdded;
|
|
6404
|
-
}
|
|
6405
|
-
return header;
|
|
6406
|
-
});
|
|
6407
|
-
}
|
|
6408
|
-
function moveHeaderIndexesOnHeaderDeletion(deletedHeaders, headers) {
|
|
6409
|
-
deletedHeaders = [...deletedHeaders].sort((a, b) => b - a);
|
|
6410
|
-
return headers
|
|
6411
|
-
.map((header) => {
|
|
6412
|
-
for (const deletedHeader of deletedHeaders) {
|
|
6413
|
-
if (header > deletedHeader) {
|
|
6414
|
-
header--;
|
|
6415
|
-
}
|
|
6416
|
-
else if (header === deletedHeader) {
|
|
6417
|
-
return undefined;
|
|
6418
|
-
}
|
|
6419
|
-
}
|
|
6420
|
-
return header;
|
|
6421
|
-
})
|
|
6422
|
-
.filter(isDefined);
|
|
6423
|
-
}
|
|
6424
|
-
function getNextSheetName(existingNames, baseName = "Sheet") {
|
|
6425
|
-
let i = 1;
|
|
6426
|
-
let name = `${baseName}${i}`;
|
|
6427
|
-
while (existingNames.includes(name)) {
|
|
6428
|
-
name = `${baseName}${i}`;
|
|
6429
|
-
i++;
|
|
6430
|
-
}
|
|
6431
|
-
return name;
|
|
6432
|
-
}
|
|
6433
|
-
function getDuplicateSheetName(nameToDuplicate, existingNames) {
|
|
6434
|
-
let i = 1;
|
|
6435
|
-
const baseName = _t("Copy of %s", nameToDuplicate);
|
|
6436
|
-
let name = baseName.toString();
|
|
6437
|
-
while (existingNames.includes(name)) {
|
|
6438
|
-
name = `${baseName} (${i})`;
|
|
6439
|
-
i++;
|
|
6440
|
-
}
|
|
6441
|
-
return name;
|
|
6442
|
-
}
|
|
6443
|
-
function isSheetNameEqual(name1, name2) {
|
|
6444
|
-
if (name1 === undefined || name2 === undefined) {
|
|
6445
|
-
return false;
|
|
6446
|
-
}
|
|
6447
|
-
return (getUnquotedSheetName(name1.trim().toUpperCase()) ===
|
|
6448
|
-
getUnquotedSheetName(name2.trim().toUpperCase()));
|
|
6449
|
-
}
|
|
6450
|
-
|
|
6451
6392
|
function createRange(args, getSheetSize) {
|
|
6452
6393
|
const unboundedZone = args.zone;
|
|
6453
6394
|
const zone = boundUnboundedZone(unboundedZone, getSheetSize(args.sheetId));
|
|
@@ -6691,8 +6632,8 @@ function getApplyRangeChangeRemoveColRow(cmd) {
|
|
|
6691
6632
|
elements.sort((a, b) => b - a);
|
|
6692
6633
|
const groups = groupConsecutive(elements);
|
|
6693
6634
|
return (range) => {
|
|
6694
|
-
if (
|
|
6695
|
-
return { changeType: "NONE" };
|
|
6635
|
+
if (range.sheetId !== cmd.sheetId) {
|
|
6636
|
+
return { changeType: "NONE", range };
|
|
6696
6637
|
}
|
|
6697
6638
|
let newRange = range;
|
|
6698
6639
|
let changeType = "NONE";
|
|
@@ -6719,10 +6660,7 @@ function getApplyRangeChangeRemoveColRow(cmd) {
|
|
|
6719
6660
|
newRange = createAdaptedRange(newRange, dimension, changeType, -(max - min + 1));
|
|
6720
6661
|
}
|
|
6721
6662
|
}
|
|
6722
|
-
|
|
6723
|
-
return { changeType, range: newRange };
|
|
6724
|
-
}
|
|
6725
|
-
return { changeType: "NONE" };
|
|
6663
|
+
return { changeType, range: newRange };
|
|
6726
6664
|
};
|
|
6727
6665
|
}
|
|
6728
6666
|
function getApplyRangeChangeAddColRow(cmd) {
|
|
@@ -6731,7 +6669,7 @@ function getApplyRangeChangeAddColRow(cmd) {
|
|
|
6731
6669
|
const dimension = cmd.dimension === "COL" ? "columns" : "rows";
|
|
6732
6670
|
return (range) => {
|
|
6733
6671
|
if (range.sheetId !== cmd.sheetId) {
|
|
6734
|
-
return { changeType: "NONE" };
|
|
6672
|
+
return { changeType: "NONE", range };
|
|
6735
6673
|
}
|
|
6736
6674
|
if (cmd.position === "after") {
|
|
6737
6675
|
if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) {
|
|
@@ -6761,13 +6699,13 @@ function getApplyRangeChangeAddColRow(cmd) {
|
|
|
6761
6699
|
};
|
|
6762
6700
|
}
|
|
6763
6701
|
}
|
|
6764
|
-
return { changeType: "NONE" };
|
|
6702
|
+
return { changeType: "NONE", range };
|
|
6765
6703
|
};
|
|
6766
6704
|
}
|
|
6767
6705
|
function getApplyRangeChangeDeleteSheet(cmd) {
|
|
6768
6706
|
return (range) => {
|
|
6769
6707
|
if (range.sheetId !== cmd.sheetId && range.invalidSheetName !== cmd.sheetName) {
|
|
6770
|
-
return { changeType: "NONE" };
|
|
6708
|
+
return { changeType: "NONE", range };
|
|
6771
6709
|
}
|
|
6772
6710
|
const invalidSheetName = cmd.sheetName;
|
|
6773
6711
|
range = {
|
|
@@ -6794,14 +6732,14 @@ function getApplyRangeChangeRenameSheet(cmd) {
|
|
|
6794
6732
|
const newRange = { ...range, sheetId, invalidSheetName };
|
|
6795
6733
|
return { changeType: "CHANGE", range: newRange };
|
|
6796
6734
|
}
|
|
6797
|
-
return { changeType: "NONE" };
|
|
6735
|
+
return { changeType: "NONE", range };
|
|
6798
6736
|
};
|
|
6799
6737
|
}
|
|
6800
6738
|
function getApplyRangeChangeMoveRange(cmd) {
|
|
6801
6739
|
const originZone = cmd.target[0];
|
|
6802
6740
|
return (range) => {
|
|
6803
6741
|
if (range.sheetId !== cmd.sheetId || !isZoneInside(range.zone, originZone)) {
|
|
6804
|
-
return { changeType: "NONE" };
|
|
6742
|
+
return { changeType: "NONE", range };
|
|
6805
6743
|
}
|
|
6806
6744
|
const targetSheetId = cmd.targetSheetId;
|
|
6807
6745
|
const offsetX = cmd.col - originZone.left;
|
|
@@ -6898,17 +6836,87 @@ function fuzzyLookup(pattern, list, fn) {
|
|
|
6898
6836
|
return results.map((r) => r.elem);
|
|
6899
6837
|
}
|
|
6900
6838
|
|
|
6839
|
+
function createDefaultRows(rowNumber) {
|
|
6840
|
+
const rows = [];
|
|
6841
|
+
for (let i = 0; i < rowNumber; i++) {
|
|
6842
|
+
const row = {
|
|
6843
|
+
cells: {},
|
|
6844
|
+
};
|
|
6845
|
+
rows.push(row);
|
|
6846
|
+
}
|
|
6847
|
+
return rows;
|
|
6848
|
+
}
|
|
6849
|
+
function moveHeaderIndexesOnHeaderAddition(indexHeaderAdded, numberAdded, headers) {
|
|
6850
|
+
return headers.map((header) => {
|
|
6851
|
+
if (header >= indexHeaderAdded) {
|
|
6852
|
+
return header + numberAdded;
|
|
6853
|
+
}
|
|
6854
|
+
return header;
|
|
6855
|
+
});
|
|
6856
|
+
}
|
|
6857
|
+
function moveHeaderIndexesOnHeaderDeletion(deletedHeaders, headers) {
|
|
6858
|
+
deletedHeaders = [...deletedHeaders].sort((a, b) => b - a);
|
|
6859
|
+
return headers
|
|
6860
|
+
.map((header) => {
|
|
6861
|
+
for (const deletedHeader of deletedHeaders) {
|
|
6862
|
+
if (header > deletedHeader) {
|
|
6863
|
+
header--;
|
|
6864
|
+
}
|
|
6865
|
+
else if (header === deletedHeader) {
|
|
6866
|
+
return undefined;
|
|
6867
|
+
}
|
|
6868
|
+
}
|
|
6869
|
+
return header;
|
|
6870
|
+
})
|
|
6871
|
+
.filter(isDefined);
|
|
6872
|
+
}
|
|
6873
|
+
function getNextSheetName(existingNames, baseName = "Sheet") {
|
|
6874
|
+
let i = 1;
|
|
6875
|
+
let name = `${baseName}${i}`;
|
|
6876
|
+
while (existingNames.includes(name)) {
|
|
6877
|
+
name = `${baseName}${i}`;
|
|
6878
|
+
i++;
|
|
6879
|
+
}
|
|
6880
|
+
return name;
|
|
6881
|
+
}
|
|
6882
|
+
function getDuplicateSheetName(nameToDuplicate, existingNames) {
|
|
6883
|
+
let i = 1;
|
|
6884
|
+
const baseName = _t("Copy of %s", nameToDuplicate);
|
|
6885
|
+
let name = baseName.toString();
|
|
6886
|
+
while (existingNames.includes(name)) {
|
|
6887
|
+
name = `${baseName} (${i})`;
|
|
6888
|
+
i++;
|
|
6889
|
+
}
|
|
6890
|
+
return name;
|
|
6891
|
+
}
|
|
6892
|
+
function isSheetNameEqual(name1, name2) {
|
|
6893
|
+
if (name1 === undefined || name2 === undefined) {
|
|
6894
|
+
return false;
|
|
6895
|
+
}
|
|
6896
|
+
return (getUnquotedSheetName(name1.trim().toUpperCase()) ===
|
|
6897
|
+
getUnquotedSheetName(name2.trim().toUpperCase()));
|
|
6898
|
+
}
|
|
6899
|
+
|
|
6901
6900
|
function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
|
|
6902
6901
|
return numberOfLines * (textLineHeight + MIN_CELL_TEXT_MARGIN) - MIN_CELL_TEXT_MARGIN;
|
|
6903
6902
|
}
|
|
6904
6903
|
/**
|
|
6905
6904
|
* Get the default height of the cell given its style.
|
|
6906
6905
|
*/
|
|
6907
|
-
function getDefaultCellHeight(ctx, cell, colSize) {
|
|
6906
|
+
function getDefaultCellHeight(ctx, cell, locale, colSize) {
|
|
6908
6907
|
if (!cell || (!cell.isFormula && !cell.content)) {
|
|
6909
6908
|
return DEFAULT_CELL_HEIGHT;
|
|
6910
6909
|
}
|
|
6911
|
-
|
|
6910
|
+
let content = "";
|
|
6911
|
+
try {
|
|
6912
|
+
if (!cell.isFormula) {
|
|
6913
|
+
const localeFormat = { format: cell.format, locale };
|
|
6914
|
+
content = formatValue(parseLiteral(cell.content, locale), localeFormat);
|
|
6915
|
+
}
|
|
6916
|
+
}
|
|
6917
|
+
catch {
|
|
6918
|
+
content = CellErrorType.GenericError;
|
|
6919
|
+
}
|
|
6912
6920
|
return getCellContentHeight(ctx, content, cell.style, colSize);
|
|
6913
6921
|
}
|
|
6914
6922
|
function getCellContentHeight(ctx, content, style, colSize) {
|
|
@@ -19070,9 +19078,10 @@ function assertDomainLength(domain) {
|
|
|
19070
19078
|
throw new EvaluationError(_t("Function PIVOT takes an even number of arguments."));
|
|
19071
19079
|
}
|
|
19072
19080
|
}
|
|
19073
|
-
function addPivotDependencies(evalContext,
|
|
19081
|
+
function addPivotDependencies(evalContext, pivotId, forMeasures) {
|
|
19074
19082
|
//TODO This function can be very costly when used with PIVOT.VALUE and PIVOT.HEADER
|
|
19075
19083
|
const dependencies = [];
|
|
19084
|
+
const coreDefinition = evalContext.getters.getPivotCoreDefinition(pivotId);
|
|
19076
19085
|
if (coreDefinition.type === "SPREADSHEET" && coreDefinition.dataSet) {
|
|
19077
19086
|
const { sheetId, zone } = coreDefinition.dataSet;
|
|
19078
19087
|
const xc = zoneToXc(zone);
|
|
@@ -19089,8 +19098,7 @@ function addPivotDependencies(evalContext, coreDefinition, forMeasures) {
|
|
|
19089
19098
|
}
|
|
19090
19099
|
for (const measure of forMeasures) {
|
|
19091
19100
|
if (measure.computedBy) {
|
|
19092
|
-
|
|
19093
|
-
dependencies.push(...formula.dependencies.filter((range) => !range.invalidXc));
|
|
19101
|
+
dependencies.push(...evalContext.getters.getMeasureFullDependencies(pivotId, measure));
|
|
19094
19102
|
}
|
|
19095
19103
|
}
|
|
19096
19104
|
const originPosition = evalContext.__originCellPosition;
|
|
@@ -19559,7 +19567,7 @@ const PIVOT_VALUE = {
|
|
|
19559
19567
|
assertDomainLength(domainArgs);
|
|
19560
19568
|
const pivot = this.getters.getPivot(pivotId);
|
|
19561
19569
|
const coreDefinition = this.getters.getPivotCoreDefinition(pivotId);
|
|
19562
|
-
addPivotDependencies(this,
|
|
19570
|
+
addPivotDependencies(this, pivotId, coreDefinition.measures.filter((m) => m.id === _measure));
|
|
19563
19571
|
pivot.init({ reload: pivot.needsReevaluation });
|
|
19564
19572
|
const error = pivot.assertIsValid({ throwOnError: false });
|
|
19565
19573
|
if (error) {
|
|
@@ -19592,8 +19600,7 @@ const PIVOT_HEADER = {
|
|
|
19592
19600
|
const _pivotId = getPivotId(_pivotFormulaId, this.getters);
|
|
19593
19601
|
assertDomainLength(domainArgs);
|
|
19594
19602
|
const pivot = this.getters.getPivot(_pivotId);
|
|
19595
|
-
|
|
19596
|
-
addPivotDependencies(this, coreDefinition, []);
|
|
19603
|
+
addPivotDependencies(this, _pivotId, []);
|
|
19597
19604
|
pivot.init({ reload: pivot.needsReevaluation });
|
|
19598
19605
|
const error = pivot.assertIsValid({ throwOnError: false });
|
|
19599
19606
|
if (error) {
|
|
@@ -19651,7 +19658,7 @@ const PIVOT = {
|
|
|
19651
19658
|
const pivotId = getPivotId(_pivotFormulaId, this.getters);
|
|
19652
19659
|
const pivot = this.getters.getPivot(pivotId);
|
|
19653
19660
|
const coreDefinition = this.getters.getPivotCoreDefinition(pivotId);
|
|
19654
|
-
addPivotDependencies(this,
|
|
19661
|
+
addPivotDependencies(this, pivotId, coreDefinition.measures);
|
|
19655
19662
|
pivot.init({ reload: pivot.needsReevaluation });
|
|
19656
19663
|
const error = pivot.assertIsValid({ throwOnError: false });
|
|
19657
19664
|
if (error) {
|
|
@@ -20990,7 +20997,16 @@ function createComputeFunction(descr) {
|
|
|
20990
20997
|
}
|
|
20991
20998
|
acceptToVectorize.push(!argDefinition.acceptMatrix);
|
|
20992
20999
|
}
|
|
20993
|
-
return applyVectorization(errorHandlingCompute.bind(this), args, acceptToVectorize);
|
|
21000
|
+
return replaceErrorPlaceholderInResult(applyVectorization(errorHandlingCompute.bind(this), args, acceptToVectorize));
|
|
21001
|
+
}
|
|
21002
|
+
function replaceErrorPlaceholderInResult(result) {
|
|
21003
|
+
if (!isMatrix(result)) {
|
|
21004
|
+
replaceFunctionNamePlaceholder(result, descr.name);
|
|
21005
|
+
}
|
|
21006
|
+
else {
|
|
21007
|
+
matrixForEach(result, (result) => replaceFunctionNamePlaceholder(result, descr.name));
|
|
21008
|
+
}
|
|
21009
|
+
return result;
|
|
20994
21010
|
}
|
|
20995
21011
|
function errorHandlingCompute(...args) {
|
|
20996
21012
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -21019,13 +21035,12 @@ function createComputeFunction(descr) {
|
|
|
21019
21035
|
const result = descr.compute.apply(this, args);
|
|
21020
21036
|
if (!isMatrix(result)) {
|
|
21021
21037
|
if (typeof result === "object" && result !== null && "value" in result) {
|
|
21022
|
-
replaceFunctionNamePlaceholder(result, descr.name);
|
|
21023
21038
|
return result;
|
|
21024
21039
|
}
|
|
21040
|
+
descr.name;
|
|
21025
21041
|
return { value: result };
|
|
21026
21042
|
}
|
|
21027
21043
|
if (typeof result[0][0] === "object" && result[0][0] !== null && "value" in result[0][0]) {
|
|
21028
|
-
matrixForEach(result, (result) => replaceFunctionNamePlaceholder(result, descr.name));
|
|
21029
21044
|
return result;
|
|
21030
21045
|
}
|
|
21031
21046
|
return matrixMap(result, (row) => ({ value: row }));
|
|
@@ -21477,7 +21492,7 @@ function adaptFormulaStringRanges(defaultSheetId, formula, applyChange) {
|
|
|
21477
21492
|
continue;
|
|
21478
21493
|
}
|
|
21479
21494
|
const sheetXC = tokens[tokenIdx].value;
|
|
21480
|
-
const newSheetXC = adaptStringRange(defaultSheetId, sheetXC, applyChange);
|
|
21495
|
+
const newSheetXC = adaptStringRange(defaultSheetId, sheetXC, applyChange).range;
|
|
21481
21496
|
if (sheetXC !== newSheetXC) {
|
|
21482
21497
|
tokens[tokenIdx] = {
|
|
21483
21498
|
value: newSheetXC,
|
|
@@ -21487,23 +21502,30 @@ function adaptFormulaStringRanges(defaultSheetId, formula, applyChange) {
|
|
|
21487
21502
|
}
|
|
21488
21503
|
return concat(tokens.map((token) => token.value));
|
|
21489
21504
|
}
|
|
21490
|
-
function adaptStringRange(defaultSheetId, sheetXC,
|
|
21505
|
+
function adaptStringRange(defaultSheetId, sheetXC, rangeAdapter) {
|
|
21491
21506
|
const sheetName = splitReference(sheetXC).sheetName;
|
|
21492
21507
|
if (sheetName
|
|
21493
|
-
? !isSheetNameEqual(sheetName,
|
|
21494
|
-
: defaultSheetId !==
|
|
21495
|
-
return sheetXC;
|
|
21508
|
+
? !isSheetNameEqual(sheetName, rangeAdapter.sheetName.old)
|
|
21509
|
+
: defaultSheetId !== rangeAdapter.sheetId) {
|
|
21510
|
+
return { changeType: "NONE", range: sheetXC };
|
|
21496
21511
|
}
|
|
21497
|
-
const sheetId = sheetName ?
|
|
21512
|
+
const sheetId = sheetName ? rangeAdapter.sheetId : defaultSheetId;
|
|
21498
21513
|
const range = getRange(sheetXC, sheetId);
|
|
21499
21514
|
if (range.invalidXc) {
|
|
21500
|
-
return sheetXC;
|
|
21515
|
+
return { changeType: "NONE", range: sheetXC };
|
|
21501
21516
|
}
|
|
21502
|
-
const change =
|
|
21517
|
+
const change = rangeAdapter.applyChange(range);
|
|
21503
21518
|
if (change.changeType === "NONE" || change.changeType === "REMOVE") {
|
|
21504
|
-
return sheetXC;
|
|
21519
|
+
return { changeType: change.changeType, range: sheetXC };
|
|
21520
|
+
}
|
|
21521
|
+
const rangeStr = getRangeString(change.range, defaultSheetId, getSheetNameGetter(rangeAdapter));
|
|
21522
|
+
if (rangeStr === CellErrorType.InvalidReference) {
|
|
21523
|
+
return { changeType: "REMOVE", range: rangeStr };
|
|
21505
21524
|
}
|
|
21506
|
-
return
|
|
21525
|
+
return {
|
|
21526
|
+
changeType: change.changeType,
|
|
21527
|
+
range: rangeStr,
|
|
21528
|
+
};
|
|
21507
21529
|
}
|
|
21508
21530
|
function getSheetNameGetter(applyChange) {
|
|
21509
21531
|
return (sheetId) => {
|
|
@@ -21608,8 +21630,6 @@ function adaptChartRange(range, applyChange) {
|
|
|
21608
21630
|
}
|
|
21609
21631
|
const change = applyChange(range);
|
|
21610
21632
|
switch (change.changeType) {
|
|
21611
|
-
case "NONE":
|
|
21612
|
-
return range;
|
|
21613
21633
|
case "REMOVE":
|
|
21614
21634
|
return undefined;
|
|
21615
21635
|
default:
|
|
@@ -21761,16 +21781,16 @@ function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
|
|
|
21761
21781
|
function transformChartDefinitionWithDataSetsWithZone(chartSheetId, definition, applyChange) {
|
|
21762
21782
|
let labelRange;
|
|
21763
21783
|
if (definition.labelRange) {
|
|
21764
|
-
const adaptedRange = adaptStringRange(chartSheetId, definition.labelRange, applyChange);
|
|
21765
|
-
if (
|
|
21784
|
+
const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, definition.labelRange, applyChange);
|
|
21785
|
+
if (changeType !== "REMOVE") {
|
|
21766
21786
|
labelRange = adaptedRange;
|
|
21767
21787
|
}
|
|
21768
21788
|
}
|
|
21769
21789
|
const dataSets = [];
|
|
21770
21790
|
for (const dataSet of definition.dataSets) {
|
|
21771
21791
|
const newDataSet = { ...dataSet };
|
|
21772
|
-
const adaptedRange = adaptStringRange(chartSheetId, dataSet.dataRange, applyChange);
|
|
21773
|
-
if (
|
|
21792
|
+
const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, dataSet.dataRange, applyChange);
|
|
21793
|
+
if (changeType !== "REMOVE") {
|
|
21774
21794
|
newDataSet.dataRange = adaptedRange;
|
|
21775
21795
|
dataSets.push(newDataSet);
|
|
21776
21796
|
}
|
|
@@ -23148,14 +23168,14 @@ let ScorecardChart$1 = class ScorecardChart extends AbstractChart {
|
|
|
23148
23168
|
let baseline;
|
|
23149
23169
|
let keyValue;
|
|
23150
23170
|
if (definition.baseline) {
|
|
23151
|
-
const adaptedRange = adaptStringRange(chartSheetId, definition.baseline, applyChange);
|
|
23152
|
-
if (
|
|
23171
|
+
const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, definition.baseline, applyChange);
|
|
23172
|
+
if (changeType !== "REMOVE") {
|
|
23153
23173
|
baseline = adaptedRange;
|
|
23154
23174
|
}
|
|
23155
23175
|
}
|
|
23156
23176
|
if (definition.keyValue) {
|
|
23157
|
-
const adaptedRange = adaptStringRange(chartSheetId, definition.keyValue, applyChange);
|
|
23158
|
-
if (
|
|
23177
|
+
const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, definition.keyValue, applyChange);
|
|
23178
|
+
if (changeType !== "REMOVE") {
|
|
23159
23179
|
keyValue = adaptedRange;
|
|
23160
23180
|
}
|
|
23161
23181
|
}
|
|
@@ -23212,7 +23232,7 @@ let ScorecardChart$1 = class ScorecardChart extends AbstractChart {
|
|
|
23212
23232
|
// This kind of graph is not exportable in Excel
|
|
23213
23233
|
return undefined;
|
|
23214
23234
|
}
|
|
23215
|
-
updateRanges(applyChange) {
|
|
23235
|
+
updateRanges({ applyChange }) {
|
|
23216
23236
|
const baseline = adaptChartRange(this.baseline, applyChange);
|
|
23217
23237
|
const keyValue = adaptChartRange(this.keyValue, applyChange);
|
|
23218
23238
|
if (this.baseline === baseline && this.keyValue === keyValue) {
|
|
@@ -26586,7 +26606,7 @@ class BarChart extends AbstractChart {
|
|
|
26586
26606
|
verticalAxis: getDefinedAxis(definition),
|
|
26587
26607
|
};
|
|
26588
26608
|
}
|
|
26589
|
-
updateRanges(applyChange) {
|
|
26609
|
+
updateRanges({ applyChange }) {
|
|
26590
26610
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
26591
26611
|
if (!isStale) {
|
|
26592
26612
|
return this;
|
|
@@ -27173,7 +27193,7 @@ class ComboChart extends AbstractChart {
|
|
|
27173
27193
|
verticalAxis: getDefinedAxis(definition),
|
|
27174
27194
|
};
|
|
27175
27195
|
}
|
|
27176
|
-
updateRanges(applyChange) {
|
|
27196
|
+
updateRanges({ applyChange }) {
|
|
27177
27197
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
27178
27198
|
if (!isStale) {
|
|
27179
27199
|
return this;
|
|
@@ -27345,7 +27365,7 @@ class FunnelChart extends AbstractChart {
|
|
|
27345
27365
|
getDefinitionForExcel() {
|
|
27346
27366
|
return undefined;
|
|
27347
27367
|
}
|
|
27348
|
-
updateRanges(applyChange) {
|
|
27368
|
+
updateRanges({ applyChange }) {
|
|
27349
27369
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
27350
27370
|
if (!isStale) {
|
|
27351
27371
|
return this;
|
|
@@ -27456,8 +27476,8 @@ class GaugeChart extends AbstractChart {
|
|
|
27456
27476
|
static transformDefinition(chartSheetId, definition, applyChange) {
|
|
27457
27477
|
let dataRange;
|
|
27458
27478
|
if (definition.dataRange) {
|
|
27459
|
-
const adaptedRange = adaptStringRange(chartSheetId, definition.dataRange, applyChange);
|
|
27460
|
-
if (
|
|
27479
|
+
const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, definition.dataRange, applyChange);
|
|
27480
|
+
if (changeType !== "REMOVE") {
|
|
27461
27481
|
dataRange = adaptedRange;
|
|
27462
27482
|
}
|
|
27463
27483
|
}
|
|
@@ -27532,13 +27552,9 @@ class GaugeChart extends AbstractChart {
|
|
|
27532
27552
|
: undefined,
|
|
27533
27553
|
};
|
|
27534
27554
|
}
|
|
27535
|
-
updateRanges(applyChange,
|
|
27555
|
+
updateRanges({ applyChange, adaptFormulaString }) {
|
|
27536
27556
|
const dataRange = adaptChartRange(this.dataRange, applyChange);
|
|
27537
|
-
const adaptFormula = (formula) =>
|
|
27538
|
-
applyChange,
|
|
27539
|
-
sheetId,
|
|
27540
|
-
sheetName: adaptSheetName,
|
|
27541
|
-
});
|
|
27557
|
+
const adaptFormula = (formula) => adaptFormulaString(this.sheetId, formula);
|
|
27542
27558
|
const sectionRule = adaptSectionRuleFormulas(this.sectionRule, adaptFormula);
|
|
27543
27559
|
const definition = this.getDefinitionWithSpecificRanges(dataRange, sectionRule);
|
|
27544
27560
|
return new GaugeChart(definition, this.sheetId, this.getters);
|
|
@@ -27760,7 +27776,7 @@ class GeoChart extends AbstractChart {
|
|
|
27760
27776
|
getDefinitionForExcel() {
|
|
27761
27777
|
return undefined;
|
|
27762
27778
|
}
|
|
27763
|
-
updateRanges(applyChange) {
|
|
27779
|
+
updateRanges({ applyChange }) {
|
|
27764
27780
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
27765
27781
|
if (!isStale) {
|
|
27766
27782
|
return this;
|
|
@@ -27896,7 +27912,7 @@ class LineChart extends AbstractChart {
|
|
|
27896
27912
|
: undefined,
|
|
27897
27913
|
};
|
|
27898
27914
|
}
|
|
27899
|
-
updateRanges(applyChange) {
|
|
27915
|
+
updateRanges({ applyChange }) {
|
|
27900
27916
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
27901
27917
|
if (!isStale) {
|
|
27902
27918
|
return this;
|
|
@@ -28056,7 +28072,7 @@ class PieChart extends AbstractChart {
|
|
|
28056
28072
|
labelRange,
|
|
28057
28073
|
};
|
|
28058
28074
|
}
|
|
28059
|
-
updateRanges(applyChange) {
|
|
28075
|
+
updateRanges({ applyChange }) {
|
|
28060
28076
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
28061
28077
|
if (!isStale) {
|
|
28062
28078
|
return this;
|
|
@@ -28195,7 +28211,7 @@ class PyramidChart extends AbstractChart {
|
|
|
28195
28211
|
getDefinitionForExcel() {
|
|
28196
28212
|
return undefined;
|
|
28197
28213
|
}
|
|
28198
|
-
updateRanges(applyChange) {
|
|
28214
|
+
updateRanges({ applyChange }) {
|
|
28199
28215
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
28200
28216
|
if (!isStale) {
|
|
28201
28217
|
return this;
|
|
@@ -28346,7 +28362,7 @@ class RadarChart extends AbstractChart {
|
|
|
28346
28362
|
labelRange,
|
|
28347
28363
|
};
|
|
28348
28364
|
}
|
|
28349
|
-
updateRanges(applyChange) {
|
|
28365
|
+
updateRanges({ applyChange }) {
|
|
28350
28366
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
28351
28367
|
if (!isStale) {
|
|
28352
28368
|
return this;
|
|
@@ -28468,7 +28484,7 @@ class ScatterChart extends AbstractChart {
|
|
|
28468
28484
|
: undefined,
|
|
28469
28485
|
};
|
|
28470
28486
|
}
|
|
28471
|
-
updateRanges(applyChange) {
|
|
28487
|
+
updateRanges({ applyChange }) {
|
|
28472
28488
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
28473
28489
|
if (!isStale) {
|
|
28474
28490
|
return this;
|
|
@@ -28633,7 +28649,7 @@ class SunburstChart extends AbstractChart {
|
|
|
28633
28649
|
getDefinitionForExcel() {
|
|
28634
28650
|
return undefined;
|
|
28635
28651
|
}
|
|
28636
|
-
updateRanges(applyChange) {
|
|
28652
|
+
updateRanges({ applyChange }) {
|
|
28637
28653
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
28638
28654
|
if (!isStale) {
|
|
28639
28655
|
return this;
|
|
@@ -28781,7 +28797,7 @@ class TreeMapChart extends AbstractChart {
|
|
|
28781
28797
|
getDefinitionForExcel() {
|
|
28782
28798
|
return undefined;
|
|
28783
28799
|
}
|
|
28784
|
-
updateRanges(applyChange) {
|
|
28800
|
+
updateRanges({ applyChange }) {
|
|
28785
28801
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
28786
28802
|
if (!isStale) {
|
|
28787
28803
|
return this;
|
|
@@ -28936,7 +28952,7 @@ class WaterfallChart extends AbstractChart {
|
|
|
28936
28952
|
// TODO: implement export excel
|
|
28937
28953
|
return undefined;
|
|
28938
28954
|
}
|
|
28939
|
-
updateRanges(applyChange) {
|
|
28955
|
+
updateRanges({ applyChange }) {
|
|
28940
28956
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
28941
28957
|
if (!isStale) {
|
|
28942
28958
|
return this;
|
|
@@ -32644,7 +32660,6 @@ class AbstractComposerStore extends SpreadsheetStore {
|
|
|
32644
32660
|
});
|
|
32645
32661
|
}
|
|
32646
32662
|
handleEvent(event) {
|
|
32647
|
-
this.hideHelp();
|
|
32648
32663
|
const sheetId = this.getters.getActiveSheetId();
|
|
32649
32664
|
let unboundedZone;
|
|
32650
32665
|
if (event.options.unbounded) {
|
|
@@ -32905,7 +32920,7 @@ class AbstractComposerStore extends SpreadsheetStore {
|
|
|
32905
32920
|
}
|
|
32906
32921
|
captureSelection(zone, col, row) {
|
|
32907
32922
|
this.model.selection.capture(this, {
|
|
32908
|
-
cell: { col: col ?? zone.left, row: row ?? zone.
|
|
32923
|
+
cell: { col: col ?? zone.left, row: row ?? zone.top },
|
|
32909
32924
|
zone,
|
|
32910
32925
|
}, {
|
|
32911
32926
|
handleEvent: this.handleEvent.bind(this),
|
|
@@ -32998,6 +33013,7 @@ class AbstractComposerStore extends SpreadsheetStore {
|
|
|
32998
33013
|
this.colorIndexByRange = {};
|
|
32999
33014
|
this.hoveredTokens = [];
|
|
33000
33015
|
this.hoveredContentEvaluation = "";
|
|
33016
|
+
this.hideHelp();
|
|
33001
33017
|
}
|
|
33002
33018
|
/**
|
|
33003
33019
|
* Reset the current content to the active cell content
|
|
@@ -38619,6 +38635,7 @@ function extractStyle(data, content, styleId, formatId, borderId) {
|
|
|
38619
38635
|
? V_ALIGNMENT_EXPORT_CONVERSION_MAP[style.verticalAlign]
|
|
38620
38636
|
: undefined,
|
|
38621
38637
|
wrapText: style.wrapping === "wrap" || content?.includes(NEWLINE) ? true : undefined,
|
|
38638
|
+
shrinkToFit: style.wrapping === "clip" ? true : undefined,
|
|
38622
38639
|
},
|
|
38623
38640
|
};
|
|
38624
38641
|
styles.font["strike"] = !!style?.strikethrough || undefined;
|
|
@@ -38639,6 +38656,7 @@ function normalizeStyle(construct, styles) {
|
|
|
38639
38656
|
vertical: styles.alignment.vertical,
|
|
38640
38657
|
horizontal: styles.alignment.horizontal,
|
|
38641
38658
|
wrapText: styles.alignment.wrapText,
|
|
38659
|
+
shrinkToFit: styles.alignment.shrinkToFit,
|
|
38642
38660
|
},
|
|
38643
38661
|
};
|
|
38644
38662
|
return pushElement(style, construct.styles);
|
|
@@ -50822,7 +50840,7 @@ class GaugeChartConfigPanel extends owl.Component {
|
|
|
50822
50840
|
});
|
|
50823
50841
|
dataRange = this.props.definition.dataRange;
|
|
50824
50842
|
get configurationErrorMessages() {
|
|
50825
|
-
const cancelledReasons = [...(this.state.dataRangeDispatchResult?.reasons || [])];
|
|
50843
|
+
const cancelledReasons = [...(this.state.dataRangeDispatchResult?.reasons || [])].filter((reason) => reason !== "NoChanges" /* CommandResult.NoChanges */);
|
|
50826
50844
|
return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
50827
50845
|
}
|
|
50828
50846
|
get isDataRangeInvalid() {
|
|
@@ -50907,7 +50925,7 @@ class GaugeChartDesignPanel extends owl.Component {
|
|
|
50907
50925
|
});
|
|
50908
50926
|
}
|
|
50909
50927
|
get designErrorMessages() {
|
|
50910
|
-
const cancelledReasons = [...(this.state.sectionRuleCancelledReasons || [])];
|
|
50928
|
+
const cancelledReasons = [...(this.state.sectionRuleCancelledReasons || [])].filter((reason) => reason !== "NoChanges" /* CommandResult.NoChanges */);
|
|
50911
50929
|
return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
50912
50930
|
}
|
|
50913
50931
|
get isRangeMinInvalid() {
|
|
@@ -51272,7 +51290,7 @@ class ScorecardChartConfigPanel extends owl.Component {
|
|
|
51272
51290
|
const cancelledReasons = [
|
|
51273
51291
|
...(this.state.keyValueDispatchResult?.reasons || []),
|
|
51274
51292
|
...(this.state.baselineDispatchResult?.reasons || []),
|
|
51275
|
-
];
|
|
51293
|
+
].filter((reason) => reason !== "NoChanges" /* CommandResult.NoChanges */);
|
|
51276
51294
|
return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
51277
51295
|
}
|
|
51278
51296
|
get isKeyValueInvalid() {
|
|
@@ -53205,6 +53223,12 @@ class FindAndReplaceStore extends SpreadsheetStore {
|
|
|
53205
53223
|
case "ACTIVATE_SHEET":
|
|
53206
53224
|
this.isSearchDirty = true;
|
|
53207
53225
|
this.shouldFinalizeUpdateSelection = true;
|
|
53226
|
+
if (this.searchOptions.specificRange) {
|
|
53227
|
+
this.searchOptions.specificRange = {
|
|
53228
|
+
...this.searchOptions.specificRange,
|
|
53229
|
+
sheetId: this.getters.getActiveSheetId(),
|
|
53230
|
+
};
|
|
53231
|
+
}
|
|
53208
53232
|
break;
|
|
53209
53233
|
case "REPLACE_SEARCH":
|
|
53210
53234
|
for (const match of cmd.matches) {
|
|
@@ -53624,9 +53648,20 @@ class FindAndReplacePanel extends owl.Component {
|
|
|
53624
53648
|
const specificRange = this.env.model.getters.getRangeFromSheetXC(this.env.model.getters.getActiveSheetId(), this.state.dataRange);
|
|
53625
53649
|
this.store.updateSearchOptions({ specificRange });
|
|
53626
53650
|
}
|
|
53651
|
+
get specificRange() {
|
|
53652
|
+
const range = this.store.searchOptions.specificRange;
|
|
53653
|
+
return range ? this.env.model.getters.getRangeString(range, "forceSheetReference") : "";
|
|
53654
|
+
}
|
|
53627
53655
|
get pendingSearch() {
|
|
53628
53656
|
return this.updateSearchContent.isDebouncePending();
|
|
53629
53657
|
}
|
|
53658
|
+
get selectionInputKey() {
|
|
53659
|
+
// Selections input are made to work with objects linked to a sheet id. They store the active sheet id at their creation,
|
|
53660
|
+
// and have specific behaviour linked to it (eg. go back to the initial sheet after confirmation).
|
|
53661
|
+
// We don't want all those behaviors here, so we force the recreation of the component when the active sheet changes.
|
|
53662
|
+
// The only drawback is that the input loses focus when changing sheet.
|
|
53663
|
+
return this.env.model.getters.getActiveSheetId();
|
|
53664
|
+
}
|
|
53630
53665
|
}
|
|
53631
53666
|
|
|
53632
53667
|
css /* scss */ `
|
|
@@ -56082,8 +56117,6 @@ function adaptPivotRange(range, applyChange) {
|
|
|
56082
56117
|
}
|
|
56083
56118
|
const change = applyChange(range);
|
|
56084
56119
|
switch (change.changeType) {
|
|
56085
|
-
case "NONE":
|
|
56086
|
-
return range;
|
|
56087
56120
|
case "REMOVE":
|
|
56088
56121
|
return undefined;
|
|
56089
56122
|
default:
|
|
@@ -58901,7 +58934,7 @@ class CorePlugin extends BasePlugin {
|
|
|
58901
58934
|
* @param sheetId an sheetId to adapt either range of that sheet specifically, or ranges pointing to that sheet
|
|
58902
58935
|
* @param sheetName couple of old and new sheet names to adapt ranges pointing to that sheet
|
|
58903
58936
|
*/
|
|
58904
|
-
adaptRanges(
|
|
58937
|
+
adaptRanges(rangeAdapterFunctions, sheetId, sheetName) { }
|
|
58905
58938
|
/**
|
|
58906
58939
|
* Implement this method to clean unused external resources, such as images
|
|
58907
58940
|
* stored on a server which have been deleted.
|
|
@@ -59497,7 +59530,7 @@ class CellPlugin extends CorePlugin {
|
|
|
59497
59530
|
];
|
|
59498
59531
|
nextId = 1;
|
|
59499
59532
|
cells = {};
|
|
59500
|
-
adaptRanges(applyChange, sheetId, sheetName) {
|
|
59533
|
+
adaptRanges({ applyChange }, sheetId, sheetName) {
|
|
59501
59534
|
for (const sheet of Object.keys(this.cells)) {
|
|
59502
59535
|
for (const cell of Object.values(this.cells[sheet] || {})) {
|
|
59503
59536
|
if (cell.isFormula) {
|
|
@@ -59719,7 +59752,7 @@ class CellPlugin extends CorePlugin {
|
|
|
59719
59752
|
for (const position of positions) {
|
|
59720
59753
|
const cell = this.getters.getCell(position);
|
|
59721
59754
|
const xc = toXC(position.col, position.row);
|
|
59722
|
-
const style = this.
|
|
59755
|
+
const style = this.extractCustomStyle(cell);
|
|
59723
59756
|
if (Object.keys(style).length) {
|
|
59724
59757
|
const styleId = getItemId(style, styles);
|
|
59725
59758
|
positionsByStyle[styleId] ??= [];
|
|
@@ -59765,10 +59798,14 @@ class CellPlugin extends CorePlugin {
|
|
|
59765
59798
|
}
|
|
59766
59799
|
}
|
|
59767
59800
|
}
|
|
59768
|
-
|
|
59769
|
-
const cleanedStyle = { ...style };
|
|
59770
|
-
|
|
59771
|
-
|
|
59801
|
+
extractCustomStyle(cell) {
|
|
59802
|
+
const cleanedStyle = { ...cell.style };
|
|
59803
|
+
const defaultStyle = isNumber(cell.content, DEFAULT_LOCALE)
|
|
59804
|
+
? DEFAULT_NUMBER_STYLE
|
|
59805
|
+
: DEFAULT_STYLE;
|
|
59806
|
+
for (const property in cleanedStyle) {
|
|
59807
|
+
if ((property !== "align" || !cell.isFormula) &&
|
|
59808
|
+
cleanedStyle[property] === defaultStyle[property]) {
|
|
59772
59809
|
delete cleanedStyle[property];
|
|
59773
59810
|
}
|
|
59774
59811
|
}
|
|
@@ -60118,9 +60155,9 @@ class ChartPlugin extends CorePlugin {
|
|
|
60118
60155
|
charts = {};
|
|
60119
60156
|
createChart = chartFactory(this.getters);
|
|
60120
60157
|
validateChartDefinition = (cmd) => validateChartDefinition(this, cmd.definition);
|
|
60121
|
-
adaptRanges(
|
|
60158
|
+
adaptRanges(rangeAdapters) {
|
|
60122
60159
|
for (const [chartId, chart] of Object.entries(this.charts)) {
|
|
60123
|
-
this.history.update("charts", chartId, chart?.updateRanges(
|
|
60160
|
+
this.history.update("charts", chartId, chart?.updateRanges(rangeAdapters));
|
|
60124
60161
|
}
|
|
60125
60162
|
}
|
|
60126
60163
|
// ---------------------------------------------------------------------------
|
|
@@ -60310,7 +60347,7 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
60310
60347
|
"getAdaptedCfRanges",
|
|
60311
60348
|
];
|
|
60312
60349
|
cfRules = {};
|
|
60313
|
-
adaptCFFormulas(applyChange) {
|
|
60350
|
+
adaptCFFormulas({ applyChange, adaptFormulaString }) {
|
|
60314
60351
|
for (const sheetId in this.cfRules) {
|
|
60315
60352
|
for (const rule of this.cfRules[sheetId]) {
|
|
60316
60353
|
if (rule.rule.type === "DataBarRule" && rule.rule.rangeValues) {
|
|
@@ -60334,7 +60371,7 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
60334
60371
|
for (let i = 0; i < rule.rule.values.length; i++) {
|
|
60335
60372
|
this.history.update("cfRules", sheetId, this.cfRules[sheetId].indexOf(rule), "rule",
|
|
60336
60373
|
//@ts-expect-error
|
|
60337
|
-
"values", i,
|
|
60374
|
+
"values", i, adaptFormulaString(sheetId, rule.rule.values[i]));
|
|
60338
60375
|
}
|
|
60339
60376
|
}
|
|
60340
60377
|
else if (rule.rule.type === "IconSetRule") {
|
|
@@ -60342,7 +60379,7 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
60342
60379
|
if (rule.rule[inflectionPoint].type === "formula") {
|
|
60343
60380
|
this.history.update("cfRules", sheetId, this.cfRules[sheetId].indexOf(rule), "rule",
|
|
60344
60381
|
//@ts-expect-error
|
|
60345
|
-
inflectionPoint, "value",
|
|
60382
|
+
inflectionPoint, "value", adaptFormulaString(sheetId, rule.rule[inflectionPoint].value));
|
|
60346
60383
|
}
|
|
60347
60384
|
}
|
|
60348
60385
|
}
|
|
@@ -60352,14 +60389,14 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
60352
60389
|
if (ruleValue?.type === "formula" && ruleValue?.value) {
|
|
60353
60390
|
this.history.update("cfRules", sheetId, this.cfRules[sheetId].indexOf(rule), "rule",
|
|
60354
60391
|
//@ts-expect-error
|
|
60355
|
-
value, "value",
|
|
60392
|
+
value, "value", adaptFormulaString(sheetId, ruleValue.value));
|
|
60356
60393
|
}
|
|
60357
60394
|
}
|
|
60358
60395
|
}
|
|
60359
60396
|
}
|
|
60360
60397
|
}
|
|
60361
60398
|
}
|
|
60362
|
-
adaptCFRanges(sheetId, applyChange) {
|
|
60399
|
+
adaptCFRanges(sheetId, { applyChange }) {
|
|
60363
60400
|
for (const rule of this.cfRules[sheetId]) {
|
|
60364
60401
|
for (const range of rule.ranges) {
|
|
60365
60402
|
const change = applyChange(range);
|
|
@@ -60383,12 +60420,12 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
60383
60420
|
}
|
|
60384
60421
|
}
|
|
60385
60422
|
}
|
|
60386
|
-
adaptRanges(
|
|
60423
|
+
adaptRanges(rangeAdapters, sheetId) {
|
|
60387
60424
|
const sheetIds = sheetId ? [sheetId] : Object.keys(this.cfRules);
|
|
60388
60425
|
for (const sheetId of sheetIds) {
|
|
60389
|
-
this.adaptCFRanges(sheetId,
|
|
60426
|
+
this.adaptCFRanges(sheetId, rangeAdapters);
|
|
60390
60427
|
}
|
|
60391
|
-
this.adaptCFFormulas(
|
|
60428
|
+
this.adaptCFFormulas(rangeAdapters);
|
|
60392
60429
|
}
|
|
60393
60430
|
// ---------------------------------------------------------------------------
|
|
60394
60431
|
// Command Handling
|
|
@@ -60765,23 +60802,23 @@ class DataValidationPlugin extends CorePlugin {
|
|
|
60765
60802
|
"getValidationRuleForCell",
|
|
60766
60803
|
];
|
|
60767
60804
|
rules = {};
|
|
60768
|
-
adaptRanges(
|
|
60769
|
-
this.adaptDVRanges(sheetId,
|
|
60770
|
-
this.adaptDVFormulas(
|
|
60805
|
+
adaptRanges(rangeAdapters, sheetId) {
|
|
60806
|
+
this.adaptDVRanges(sheetId, rangeAdapters);
|
|
60807
|
+
this.adaptDVFormulas(rangeAdapters);
|
|
60771
60808
|
}
|
|
60772
|
-
adaptDVFormulas(
|
|
60809
|
+
adaptDVFormulas({ adaptFormulaString }) {
|
|
60773
60810
|
for (const sheetId in this.rules) {
|
|
60774
60811
|
const rules = this.rules[sheetId];
|
|
60775
60812
|
for (let ruleIndex = rules.length - 1; ruleIndex >= 0; ruleIndex--) {
|
|
60776
60813
|
const rule = this.rules[sheetId][ruleIndex];
|
|
60777
60814
|
for (let valueIndex = 0; valueIndex < rule.criterion.values.length; valueIndex++) {
|
|
60778
|
-
const value =
|
|
60815
|
+
const value = adaptFormulaString(sheetId, rule.criterion.values[valueIndex]);
|
|
60779
60816
|
this.history.update("rules", sheetId, ruleIndex, "criterion", "values", valueIndex, value);
|
|
60780
60817
|
}
|
|
60781
60818
|
}
|
|
60782
60819
|
}
|
|
60783
60820
|
}
|
|
60784
|
-
adaptDVRanges(sheetId, applyChange) {
|
|
60821
|
+
adaptDVRanges(sheetId, { applyChange }) {
|
|
60785
60822
|
const rules = this.rules[sheetId];
|
|
60786
60823
|
for (let ruleIndex = rules.length - 1; ruleIndex >= 0; ruleIndex--) {
|
|
60787
60824
|
const rule = this.rules[sheetId][ruleIndex];
|
|
@@ -61055,7 +61092,7 @@ class FigurePlugin extends CorePlugin {
|
|
|
61055
61092
|
// ---------------------------------------------------------------------------
|
|
61056
61093
|
// Command Handling
|
|
61057
61094
|
// ---------------------------------------------------------------------------
|
|
61058
|
-
adaptRanges(applyChange, sheetId) {
|
|
61095
|
+
adaptRanges({ applyChange }, sheetId) {
|
|
61059
61096
|
for (const figure of this.getFigures(sheetId)) {
|
|
61060
61097
|
const change = applyChange(this.getters.getRangeFromZone(sheetId, {
|
|
61061
61098
|
left: figure.col,
|
|
@@ -61863,8 +61900,8 @@ class MergePlugin extends CorePlugin {
|
|
|
61863
61900
|
break;
|
|
61864
61901
|
}
|
|
61865
61902
|
}
|
|
61866
|
-
adaptRanges(
|
|
61867
|
-
this.applyRangeChangeOnSheet(sheetId,
|
|
61903
|
+
adaptRanges(rangeAdapters, sheetId) {
|
|
61904
|
+
this.applyRangeChangeOnSheet(sheetId, rangeAdapters);
|
|
61868
61905
|
}
|
|
61869
61906
|
// ---------------------------------------------------------------------------
|
|
61870
61907
|
// Getters
|
|
@@ -62166,7 +62203,7 @@ class MergePlugin extends CorePlugin {
|
|
|
62166
62203
|
/**
|
|
62167
62204
|
* Apply a range change on merges of a particular sheet.
|
|
62168
62205
|
*/
|
|
62169
|
-
applyRangeChangeOnSheet(sheetId, applyChange) {
|
|
62206
|
+
applyRangeChangeOnSheet(sheetId, { applyChange }) {
|
|
62170
62207
|
const merges = Object.entries(this.merges[sheetId] || {});
|
|
62171
62208
|
for (const [mergeId, range] of merges) {
|
|
62172
62209
|
if (range) {
|
|
@@ -62240,7 +62277,7 @@ function rangeToMerge(mergeId, range) {
|
|
|
62240
62277
|
};
|
|
62241
62278
|
}
|
|
62242
62279
|
|
|
62243
|
-
class
|
|
62280
|
+
class RangeAdapterPlugin {
|
|
62244
62281
|
getters;
|
|
62245
62282
|
providers = [];
|
|
62246
62283
|
isAdaptingRanges = false;
|
|
@@ -62248,7 +62285,6 @@ class RangeAdapter {
|
|
|
62248
62285
|
this.getters = getters;
|
|
62249
62286
|
}
|
|
62250
62287
|
static getters = [
|
|
62251
|
-
"adaptFormulaStringDependencies",
|
|
62252
62288
|
"copyFormulaStringForSheet",
|
|
62253
62289
|
"extendRange",
|
|
62254
62290
|
"getRangeString",
|
|
@@ -62279,8 +62315,8 @@ class RangeAdapter {
|
|
|
62279
62315
|
throw new Error("Plugins cannot dispatch commands during adaptRanges phase");
|
|
62280
62316
|
}
|
|
62281
62317
|
const rangeAdapter = getRangeAdapter(cmd);
|
|
62282
|
-
if (rangeAdapter
|
|
62283
|
-
this.executeOnAllRanges(rangeAdapter
|
|
62318
|
+
if (rangeAdapter) {
|
|
62319
|
+
this.executeOnAllRanges(rangeAdapter);
|
|
62284
62320
|
}
|
|
62285
62321
|
}
|
|
62286
62322
|
finalize() { }
|
|
@@ -62299,11 +62335,15 @@ class RangeAdapter {
|
|
|
62299
62335
|
return result;
|
|
62300
62336
|
};
|
|
62301
62337
|
}
|
|
62302
|
-
executeOnAllRanges(
|
|
62338
|
+
executeOnAllRanges(rangeAdapter) {
|
|
62303
62339
|
this.isAdaptingRanges = true;
|
|
62304
|
-
const
|
|
62340
|
+
const adapterFunctions = {
|
|
62341
|
+
applyChange: this.verifyRangeRemoved(rangeAdapter.applyChange),
|
|
62342
|
+
adaptRangeString: (defaultSheetId, sheetXC) => adaptStringRange(defaultSheetId, sheetXC, rangeAdapter),
|
|
62343
|
+
adaptFormulaString: (defaultSheetId, formula) => adaptFormulaStringRanges(defaultSheetId, formula, rangeAdapter),
|
|
62344
|
+
};
|
|
62305
62345
|
for (const provider of this.providers) {
|
|
62306
|
-
provider(
|
|
62346
|
+
provider(adapterFunctions, rangeAdapter.sheetId, rangeAdapter.sheetName);
|
|
62307
62347
|
}
|
|
62308
62348
|
this.isAdaptingRanges = false;
|
|
62309
62349
|
}
|
|
@@ -62471,18 +62511,6 @@ class RangeAdapter {
|
|
|
62471
62511
|
const unionOfZones = unionUnboundedZones(...zones);
|
|
62472
62512
|
return this.getRangeFromZone(ranges[0].sheetId, unionOfZones);
|
|
62473
62513
|
}
|
|
62474
|
-
adaptFormulaStringDependencies(sheetId, formula, applyChange) {
|
|
62475
|
-
if (!formula.startsWith("=")) {
|
|
62476
|
-
return formula;
|
|
62477
|
-
}
|
|
62478
|
-
const compiledFormula = compile(formula);
|
|
62479
|
-
const updatedDependencies = compiledFormula.dependencies.map((dep) => {
|
|
62480
|
-
const range = this.getters.getRangeFromSheetXC(sheetId, dep);
|
|
62481
|
-
const changedRange = applyChange(range);
|
|
62482
|
-
return changedRange.changeType === "NONE" ? range : changedRange.range;
|
|
62483
|
-
});
|
|
62484
|
-
return this.getters.getFormulaString(sheetId, compiledFormula.tokens, updatedDependencies);
|
|
62485
|
-
}
|
|
62486
62514
|
/**
|
|
62487
62515
|
* Copy a formula string to another sheet.
|
|
62488
62516
|
*
|
|
@@ -63375,7 +63403,7 @@ class TablePlugin extends CorePlugin {
|
|
|
63375
63403
|
static getters = ["getCoreTable", "getCoreTables", "getCoreTableMatchingTopLeft"];
|
|
63376
63404
|
tables = {};
|
|
63377
63405
|
nextTableId = 1;
|
|
63378
|
-
adaptRanges(applyChange, sheetId) {
|
|
63406
|
+
adaptRanges({ applyChange }, sheetId) {
|
|
63379
63407
|
for (const table of this.getCoreTables(sheetId)) {
|
|
63380
63408
|
this.applyRangeChangeOnTable(sheetId, table, applyChange);
|
|
63381
63409
|
}
|
|
@@ -64253,6 +64281,7 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
64253
64281
|
"getMeasureCompiledFormula",
|
|
64254
64282
|
"getPivotName",
|
|
64255
64283
|
"isExistingPivot",
|
|
64284
|
+
"getMeasureFullDependencies",
|
|
64256
64285
|
];
|
|
64257
64286
|
nextFormulaId = 1;
|
|
64258
64287
|
pivots = {};
|
|
@@ -64335,12 +64364,12 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
64335
64364
|
}
|
|
64336
64365
|
case "UPDATE_PIVOT": {
|
|
64337
64366
|
this.history.update("pivots", cmd.pivotId, "definition", deepCopy(cmd.pivot));
|
|
64338
|
-
this.compileCalculatedMeasures(cmd.pivot.measures);
|
|
64367
|
+
this.compileCalculatedMeasures(cmd.pivotId, cmd.pivot.measures);
|
|
64339
64368
|
break;
|
|
64340
64369
|
}
|
|
64341
64370
|
}
|
|
64342
64371
|
}
|
|
64343
|
-
adaptRanges(applyChange) {
|
|
64372
|
+
adaptRanges({ applyChange, adaptFormulaString }) {
|
|
64344
64373
|
for (const pivotId in this.pivots) {
|
|
64345
64374
|
const definition = deepCopy(this.pivots[pivotId]?.definition);
|
|
64346
64375
|
if (!definition) {
|
|
@@ -64353,22 +64382,22 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
64353
64382
|
this.history.update("pivots", pivotId, "definition", newDefinition);
|
|
64354
64383
|
}
|
|
64355
64384
|
}
|
|
64356
|
-
for (const
|
|
64357
|
-
for (const
|
|
64358
|
-
const
|
|
64359
|
-
|
|
64360
|
-
|
|
64361
|
-
const change = applyChange(range);
|
|
64362
|
-
if (change.changeType === "NONE") {
|
|
64363
|
-
newDependencies.push(range);
|
|
64364
|
-
}
|
|
64365
|
-
else {
|
|
64366
|
-
newDependencies.push(change.range);
|
|
64367
|
-
}
|
|
64385
|
+
for (const pivotId in this.compiledMeasureFormulas) {
|
|
64386
|
+
for (const measureId in this.compiledMeasureFormulas[pivotId]) {
|
|
64387
|
+
const measure = this.pivots[pivotId]?.definition.measures.find((m) => m.id === measureId);
|
|
64388
|
+
if (!measure || !measure.computedBy) {
|
|
64389
|
+
continue;
|
|
64368
64390
|
}
|
|
64369
|
-
const
|
|
64370
|
-
|
|
64371
|
-
|
|
64391
|
+
const sheetId = measure.computedBy.sheetId;
|
|
64392
|
+
const { formula: compiledFormula, dependencies: indirectDependencies } = this.compiledMeasureFormulas[pivotId][measureId];
|
|
64393
|
+
// adapt direct dependencies
|
|
64394
|
+
this.history.update("compiledMeasureFormulas", pivotId, measureId, "formula", "dependencies", compiledFormula.dependencies.map((range) => applyChange(range).range));
|
|
64395
|
+
// adapt all dependencies (including indirect)
|
|
64396
|
+
this.history.update("compiledMeasureFormulas", pivotId, measure.id, "dependencies", indirectDependencies.map((range) => applyChange(range).range));
|
|
64397
|
+
const oldFormulaString = measure.computedBy.formula;
|
|
64398
|
+
const newFormulaString = adaptFormulaString(sheetId, oldFormulaString);
|
|
64399
|
+
if (newFormulaString !== oldFormulaString) {
|
|
64400
|
+
this.replaceMeasureFormula(pivotId, measure, newFormulaString);
|
|
64372
64401
|
}
|
|
64373
64402
|
}
|
|
64374
64403
|
}
|
|
@@ -64406,30 +64435,59 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
64406
64435
|
isExistingPivot(pivotId) {
|
|
64407
64436
|
return pivotId in this.pivots;
|
|
64408
64437
|
}
|
|
64409
|
-
getMeasureCompiledFormula(measure) {
|
|
64438
|
+
getMeasureCompiledFormula(pivotId, measure) {
|
|
64439
|
+
if (!measure.computedBy) {
|
|
64440
|
+
throw new Error(`Measure ${measure.fieldName} is not computed by formula`);
|
|
64441
|
+
}
|
|
64442
|
+
return this.compiledMeasureFormulas[pivotId][measure.id].formula;
|
|
64443
|
+
}
|
|
64444
|
+
getMeasureFullDependencies(pivotId, measure) {
|
|
64410
64445
|
if (!measure.computedBy) {
|
|
64411
64446
|
throw new Error(`Measure ${measure.fieldName} is not computed by formula`);
|
|
64412
64447
|
}
|
|
64413
|
-
|
|
64414
|
-
return this.compiledMeasureFormulas[sheetId][measure.computedBy.formula];
|
|
64448
|
+
return this.compiledMeasureFormulas[pivotId][measure.id].dependencies;
|
|
64415
64449
|
}
|
|
64416
64450
|
// -------------------------------------------------------------------------
|
|
64417
64451
|
// Private
|
|
64418
64452
|
// -------------------------------------------------------------------------
|
|
64419
64453
|
addPivot(pivotId, pivot, formulaId = this.nextFormulaId.toString()) {
|
|
64420
64454
|
this.history.update("pivots", pivotId, { definition: deepCopy(pivot), formulaId });
|
|
64421
|
-
this.compileCalculatedMeasures(pivot.measures);
|
|
64455
|
+
this.compileCalculatedMeasures(pivotId, pivot.measures);
|
|
64422
64456
|
this.history.update("formulaIds", formulaId, pivotId);
|
|
64423
64457
|
this.history.update("nextFormulaId", this.nextFormulaId + 1);
|
|
64424
64458
|
}
|
|
64425
|
-
compileCalculatedMeasures(measures) {
|
|
64459
|
+
compileCalculatedMeasures(pivotId, measures) {
|
|
64426
64460
|
for (const measure of measures) {
|
|
64427
64461
|
if (measure.computedBy) {
|
|
64428
|
-
const sheetId = measure.computedBy.sheetId;
|
|
64429
64462
|
const compiledFormula = this.compileMeasureFormula(measure.computedBy.sheetId, measure.computedBy.formula);
|
|
64430
|
-
this.history.update("compiledMeasureFormulas",
|
|
64463
|
+
this.history.update("compiledMeasureFormulas", pivotId, measure.id, "formula", compiledFormula);
|
|
64431
64464
|
}
|
|
64432
64465
|
}
|
|
64466
|
+
for (const measure of measures) {
|
|
64467
|
+
if (measure.computedBy) {
|
|
64468
|
+
const dependencies = this.computeMeasureFullDependencies(pivotId, measure);
|
|
64469
|
+
this.history.update("compiledMeasureFormulas", pivotId, measure.id, "dependencies", dependencies);
|
|
64470
|
+
}
|
|
64471
|
+
}
|
|
64472
|
+
}
|
|
64473
|
+
computeMeasureFullDependencies(pivotId, measure, exploredMeasures = new Set()) {
|
|
64474
|
+
const rangeDependencies = [];
|
|
64475
|
+
const definition = this.getPivotCoreDefinition(pivotId);
|
|
64476
|
+
const formula = this.getMeasureCompiledFormula(pivotId, measure);
|
|
64477
|
+
exploredMeasures.add(measure.id);
|
|
64478
|
+
for (const token of formula.tokens) {
|
|
64479
|
+
if (token.type !== "SYMBOL") {
|
|
64480
|
+
continue;
|
|
64481
|
+
}
|
|
64482
|
+
const otherMeasure = definition.measures.find((measureCandidate) => getCanonicalSymbolName(measureCandidate.id) === token.value &&
|
|
64483
|
+
measure.id !== measureCandidate.id);
|
|
64484
|
+
if (!otherMeasure || exploredMeasures.has(otherMeasure.id) || !otherMeasure.computedBy) {
|
|
64485
|
+
continue;
|
|
64486
|
+
}
|
|
64487
|
+
rangeDependencies.push(...this.computeMeasureFullDependencies(pivotId, otherMeasure, exploredMeasures));
|
|
64488
|
+
}
|
|
64489
|
+
rangeDependencies.push(...formula.dependencies.filter((range) => !range.invalidXc));
|
|
64490
|
+
return rangeDependencies;
|
|
64433
64491
|
}
|
|
64434
64492
|
insertPivot(position, formulaId, table) {
|
|
64435
64493
|
this.resizeSheet(position.sheetId, position, table);
|
|
@@ -64489,21 +64547,16 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
64489
64547
|
dependencies: rangeDependencies,
|
|
64490
64548
|
};
|
|
64491
64549
|
}
|
|
64492
|
-
replaceMeasureFormula(
|
|
64493
|
-
|
|
64494
|
-
|
|
64495
|
-
|
|
64496
|
-
const pivot = this.pivots[pivotId];
|
|
64497
|
-
if (!pivot) {
|
|
64498
|
-
continue;
|
|
64499
|
-
}
|
|
64500
|
-
for (const measure of pivot.definition.measures) {
|
|
64501
|
-
if (measure.computedBy?.formula === formulaString) {
|
|
64502
|
-
const measureIndex = pivot.definition.measures.indexOf(measure);
|
|
64503
|
-
this.history.update("pivots", pivotId, "definition", "measures", measureIndex, "computedBy", { formula: newFormulaString, sheetId });
|
|
64504
|
-
}
|
|
64505
|
-
}
|
|
64550
|
+
replaceMeasureFormula(pivotId, measure, newFormulaString) {
|
|
64551
|
+
const pivot = this.pivots[pivotId];
|
|
64552
|
+
if (!pivot) {
|
|
64553
|
+
return;
|
|
64506
64554
|
}
|
|
64555
|
+
const measureIndex = pivot.definition.measures.indexOf(measure);
|
|
64556
|
+
this.history.update("pivots", pivotId, "definition", "measures", measureIndex, "computedBy", {
|
|
64557
|
+
formula: newFormulaString,
|
|
64558
|
+
sheetId: measure.computedBy.sheetId,
|
|
64559
|
+
});
|
|
64507
64560
|
}
|
|
64508
64561
|
checkSortedColumnInMeasures(definition) {
|
|
64509
64562
|
const measures = definition.measures.map((measure) => measure.id);
|
|
@@ -65885,11 +65938,16 @@ class SpreadingRelation {
|
|
|
65885
65938
|
return this.arrayFormulasToResults.get(formulasPosition);
|
|
65886
65939
|
}
|
|
65887
65940
|
/**
|
|
65888
|
-
* Remove a
|
|
65941
|
+
* Remove a spreading relation for a given array formula position
|
|
65942
|
+
* and its result zone
|
|
65889
65943
|
*/
|
|
65890
65944
|
removeNode(position) {
|
|
65945
|
+
const resultZone = this.arrayFormulasToResults.get(position);
|
|
65946
|
+
if (!resultZone) {
|
|
65947
|
+
return;
|
|
65948
|
+
}
|
|
65891
65949
|
this.resultsToArrayFormulas.remove({
|
|
65892
|
-
boundingBox: { sheetId: position.sheetId, zone:
|
|
65950
|
+
boundingBox: { sheetId: position.sheetId, zone: resultZone },
|
|
65893
65951
|
data: position,
|
|
65894
65952
|
});
|
|
65895
65953
|
this.arrayFormulasToResults.delete(position);
|
|
@@ -66177,6 +66235,10 @@ class Evaluator {
|
|
|
66177
66235
|
// empty matrix
|
|
66178
66236
|
return createEvaluatedCell({ value: 0 }, this.getters.getLocale(), cellData);
|
|
66179
66237
|
}
|
|
66238
|
+
if (nbRows === 1 && nbColumns === 1) {
|
|
66239
|
+
// single value matrix
|
|
66240
|
+
return createEvaluatedCell(nullValueToZeroValue(formulaReturn[0][0]), this.getters.getLocale(), cellData);
|
|
66241
|
+
}
|
|
66180
66242
|
const resultZone = {
|
|
66181
66243
|
top: formulaPosition.row,
|
|
66182
66244
|
bottom: formulaPosition.row + nbRows - 1,
|
|
@@ -67863,6 +67925,7 @@ class HeaderSizeUIPlugin extends CoreViewPlugin {
|
|
|
67863
67925
|
handle(cmd) {
|
|
67864
67926
|
switch (cmd.type) {
|
|
67865
67927
|
case "START":
|
|
67928
|
+
case "UPDATE_LOCALE":
|
|
67866
67929
|
for (const sheetId of this.getters.getSheetIds()) {
|
|
67867
67930
|
this.initializeSheet(sheetId);
|
|
67868
67931
|
}
|
|
@@ -67984,7 +68047,7 @@ class HeaderSizeUIPlugin extends CoreViewPlugin {
|
|
|
67984
68047
|
}
|
|
67985
68048
|
const cell = this.getters.getCell(position);
|
|
67986
68049
|
const colSize = this.getters.getColSize(position.sheetId, position.col);
|
|
67987
|
-
return getDefaultCellHeight(this.ctx, cell, colSize);
|
|
68050
|
+
return getDefaultCellHeight(this.ctx, cell, this.getters.getLocale(), colSize);
|
|
67988
68051
|
}
|
|
67989
68052
|
isInMultiRowMerge(position) {
|
|
67990
68053
|
const merge = this.getters.getMerge(position);
|
|
@@ -68031,14 +68094,16 @@ const PERCENT_FORMAT = "0.00%";
|
|
|
68031
68094
|
function withPivotPresentationLayer (PivotClass) {
|
|
68032
68095
|
class PivotPresentationLayer extends PivotClass {
|
|
68033
68096
|
getters;
|
|
68097
|
+
pivotId;
|
|
68034
68098
|
cache = {};
|
|
68035
68099
|
rankAsc = {};
|
|
68036
68100
|
rankDesc = {};
|
|
68037
68101
|
runningTotal = {};
|
|
68038
68102
|
runningTotalInPercent = {};
|
|
68039
|
-
constructor(custom, params) {
|
|
68103
|
+
constructor(pivotId, custom, params) {
|
|
68040
68104
|
super(custom, params);
|
|
68041
68105
|
this.getters = params.getters;
|
|
68106
|
+
this.pivotId = pivotId;
|
|
68042
68107
|
}
|
|
68043
68108
|
markAsDirtyForEvaluation() {
|
|
68044
68109
|
this.cache = {};
|
|
@@ -68088,7 +68153,7 @@ function withPivotPresentationLayer (PivotClass) {
|
|
|
68088
68153
|
return handleError(error, measure.aggregator.toUpperCase());
|
|
68089
68154
|
}
|
|
68090
68155
|
}
|
|
68091
|
-
const formula = this.getters.getMeasureCompiledFormula(measure);
|
|
68156
|
+
const formula = this.getters.getMeasureCompiledFormula(this.pivotId, measure);
|
|
68092
68157
|
const getSymbolValue = (symbolName) => {
|
|
68093
68158
|
const { columns, rows } = this.definition;
|
|
68094
68159
|
if (columns.find((col) => col.nameWithGranularity === symbolName)) {
|
|
@@ -68828,7 +68893,7 @@ class PivotUIPlugin extends CoreViewPlugin {
|
|
|
68828
68893
|
const definition = deepCopy(this.getters.getPivotCoreDefinition(pivotId));
|
|
68829
68894
|
if (!(pivotId in this.pivots)) {
|
|
68830
68895
|
const Pivot = withPivotPresentationLayer(pivotRegistry.get(definition.type).ui);
|
|
68831
|
-
this.pivots[pivotId] = new Pivot(this.custom, { definition, getters: this.getters });
|
|
68896
|
+
this.pivots[pivotId] = new Pivot(pivotId, this.custom, { definition, getters: this.getters });
|
|
68832
68897
|
}
|
|
68833
68898
|
else if (recreate) {
|
|
68834
68899
|
this.pivots[pivotId].onDefinitionChange(definition);
|
|
@@ -70291,7 +70356,7 @@ function addConditionalFormatCommandAdaptRange(cmd, applyChange) {
|
|
|
70291
70356
|
cmd.cf.rule = {
|
|
70292
70357
|
...rule,
|
|
70293
70358
|
rangeValues: rule.rangeValues
|
|
70294
|
-
? adaptStringRange(cmd.sheetId, rule.rangeValues, applyChange)
|
|
70359
|
+
? adaptStringRange(cmd.sheetId, rule.rangeValues, applyChange).range
|
|
70295
70360
|
: undefined,
|
|
70296
70361
|
};
|
|
70297
70362
|
}
|
|
@@ -83506,6 +83571,9 @@ function addStyles(styles) {
|
|
|
83506
83571
|
if (style.alignment && style.alignment.wrapText) {
|
|
83507
83572
|
alignAttrs.push(["wrapText", "1"]);
|
|
83508
83573
|
}
|
|
83574
|
+
if (style.alignment && style.alignment.shrinkToFit) {
|
|
83575
|
+
alignAttrs.push(["shrinkToFit", "1"]);
|
|
83576
|
+
}
|
|
83509
83577
|
if (alignAttrs.length > 0) {
|
|
83510
83578
|
attributes.push(["applyAlignment", "1"]); // for Libre Office
|
|
83511
83579
|
styleNodes.push(escapeXml /*xml*/ `<xf ${formatAttributes(attributes)}><alignment ${formatAttributes(alignAttrs)} /></xf> `);
|
|
@@ -84276,7 +84344,7 @@ class Model extends EventBus {
|
|
|
84276
84344
|
this.config = this.setupConfig(config);
|
|
84277
84345
|
this.session = this.setupSession(workbookData.revisionId);
|
|
84278
84346
|
this.coreGetters = {};
|
|
84279
|
-
this.range = new
|
|
84347
|
+
this.range = new RangeAdapterPlugin(this.coreGetters);
|
|
84280
84348
|
this.coreGetters.getRangeString = this.range.getRangeString.bind(this.range);
|
|
84281
84349
|
this.coreGetters.getRangeFromSheetXC = this.range.getRangeFromSheetXC.bind(this.range);
|
|
84282
84350
|
this.coreGetters.createAdaptedRanges = this.range.createAdaptedRanges.bind(this.range);
|
|
@@ -84290,8 +84358,6 @@ class Model extends EventBus {
|
|
|
84290
84358
|
this.coreGetters.extendRange = this.range.extendRange.bind(this.range);
|
|
84291
84359
|
this.coreGetters.getRangesUnion = this.range.getRangesUnion.bind(this.range);
|
|
84292
84360
|
this.coreGetters.removeRangesSheetPrefix = this.range.removeRangesSheetPrefix.bind(this.range);
|
|
84293
|
-
this.coreGetters.adaptFormulaStringDependencies =
|
|
84294
|
-
this.range.adaptFormulaStringDependencies.bind(this.range);
|
|
84295
84361
|
this.coreGetters.copyFormulaStringForSheet = this.range.copyFormulaStringForSheet.bind(this.range);
|
|
84296
84362
|
this.getters = {
|
|
84297
84363
|
isReadonly: () => this.config.mode === "readonly" || this.config.mode === "dashboard",
|
|
@@ -85014,6 +85080,6 @@ exports.tokenColors = tokenColors;
|
|
|
85014
85080
|
exports.tokenize = tokenize;
|
|
85015
85081
|
|
|
85016
85082
|
|
|
85017
|
-
__info__.version = "18.4.
|
|
85018
|
-
__info__.date = "2026-01-
|
|
85019
|
-
__info__.hash = "
|
|
85083
|
+
__info__.version = "18.4.25";
|
|
85084
|
+
__info__.date = "2026-01-21T11:06:11.131Z";
|
|
85085
|
+
__info__.hash = "161472d";
|