@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
|
import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, App, blockDom, useState, onPatched, useExternalListener, onWillUpdateProps, onWillStart, onWillPatch, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
|
|
@@ -40,7 +40,8 @@ function createAction(item) {
|
|
|
40
40
|
return children
|
|
41
41
|
.map((child) => (typeof child === "function" ? child(env) : child))
|
|
42
42
|
.flat()
|
|
43
|
-
.map(createAction)
|
|
43
|
+
.map(createAction)
|
|
44
|
+
.sort((a, b) => a.sequence - b.sequence);
|
|
44
45
|
}
|
|
45
46
|
: () => [],
|
|
46
47
|
isReadonlyAllowed: item.isReadonlyAllowed || false,
|
|
@@ -332,6 +333,7 @@ const DEFAULT_STYLE = {
|
|
|
332
333
|
fillColor: "",
|
|
333
334
|
textColor: "",
|
|
334
335
|
};
|
|
336
|
+
const DEFAULT_NUMBER_STYLE = { ...DEFAULT_STYLE, align: "right" };
|
|
335
337
|
const DEFAULT_VERTICAL_ALIGN = DEFAULT_STYLE.verticalAlign;
|
|
336
338
|
const DEFAULT_WRAPPING_MODE = DEFAULT_STYLE.wrapping;
|
|
337
339
|
// Fonts
|
|
@@ -6385,67 +6387,6 @@ function getFullReference(sheetName, xc) {
|
|
|
6385
6387
|
return sheetName !== undefined ? `${getCanonicalSymbolName(sheetName)}!${xc}` : xc;
|
|
6386
6388
|
}
|
|
6387
6389
|
|
|
6388
|
-
function createDefaultRows(rowNumber) {
|
|
6389
|
-
const rows = [];
|
|
6390
|
-
for (let i = 0; i < rowNumber; i++) {
|
|
6391
|
-
const row = {
|
|
6392
|
-
cells: {},
|
|
6393
|
-
};
|
|
6394
|
-
rows.push(row);
|
|
6395
|
-
}
|
|
6396
|
-
return rows;
|
|
6397
|
-
}
|
|
6398
|
-
function moveHeaderIndexesOnHeaderAddition(indexHeaderAdded, numberAdded, headers) {
|
|
6399
|
-
return headers.map((header) => {
|
|
6400
|
-
if (header >= indexHeaderAdded) {
|
|
6401
|
-
return header + numberAdded;
|
|
6402
|
-
}
|
|
6403
|
-
return header;
|
|
6404
|
-
});
|
|
6405
|
-
}
|
|
6406
|
-
function moveHeaderIndexesOnHeaderDeletion(deletedHeaders, headers) {
|
|
6407
|
-
deletedHeaders = [...deletedHeaders].sort((a, b) => b - a);
|
|
6408
|
-
return headers
|
|
6409
|
-
.map((header) => {
|
|
6410
|
-
for (const deletedHeader of deletedHeaders) {
|
|
6411
|
-
if (header > deletedHeader) {
|
|
6412
|
-
header--;
|
|
6413
|
-
}
|
|
6414
|
-
else if (header === deletedHeader) {
|
|
6415
|
-
return undefined;
|
|
6416
|
-
}
|
|
6417
|
-
}
|
|
6418
|
-
return header;
|
|
6419
|
-
})
|
|
6420
|
-
.filter(isDefined);
|
|
6421
|
-
}
|
|
6422
|
-
function getNextSheetName(existingNames, baseName = "Sheet") {
|
|
6423
|
-
let i = 1;
|
|
6424
|
-
let name = `${baseName}${i}`;
|
|
6425
|
-
while (existingNames.includes(name)) {
|
|
6426
|
-
name = `${baseName}${i}`;
|
|
6427
|
-
i++;
|
|
6428
|
-
}
|
|
6429
|
-
return name;
|
|
6430
|
-
}
|
|
6431
|
-
function getDuplicateSheetName(nameToDuplicate, existingNames) {
|
|
6432
|
-
let i = 1;
|
|
6433
|
-
const baseName = _t("Copy of %s", nameToDuplicate);
|
|
6434
|
-
let name = baseName.toString();
|
|
6435
|
-
while (existingNames.includes(name)) {
|
|
6436
|
-
name = `${baseName} (${i})`;
|
|
6437
|
-
i++;
|
|
6438
|
-
}
|
|
6439
|
-
return name;
|
|
6440
|
-
}
|
|
6441
|
-
function isSheetNameEqual(name1, name2) {
|
|
6442
|
-
if (name1 === undefined || name2 === undefined) {
|
|
6443
|
-
return false;
|
|
6444
|
-
}
|
|
6445
|
-
return (getUnquotedSheetName(name1.trim().toUpperCase()) ===
|
|
6446
|
-
getUnquotedSheetName(name2.trim().toUpperCase()));
|
|
6447
|
-
}
|
|
6448
|
-
|
|
6449
6390
|
function createRange(args, getSheetSize) {
|
|
6450
6391
|
const unboundedZone = args.zone;
|
|
6451
6392
|
const zone = boundUnboundedZone(unboundedZone, getSheetSize(args.sheetId));
|
|
@@ -6689,8 +6630,8 @@ function getApplyRangeChangeRemoveColRow(cmd) {
|
|
|
6689
6630
|
elements.sort((a, b) => b - a);
|
|
6690
6631
|
const groups = groupConsecutive(elements);
|
|
6691
6632
|
return (range) => {
|
|
6692
|
-
if (
|
|
6693
|
-
return { changeType: "NONE" };
|
|
6633
|
+
if (range.sheetId !== cmd.sheetId) {
|
|
6634
|
+
return { changeType: "NONE", range };
|
|
6694
6635
|
}
|
|
6695
6636
|
let newRange = range;
|
|
6696
6637
|
let changeType = "NONE";
|
|
@@ -6717,10 +6658,7 @@ function getApplyRangeChangeRemoveColRow(cmd) {
|
|
|
6717
6658
|
newRange = createAdaptedRange(newRange, dimension, changeType, -(max - min + 1));
|
|
6718
6659
|
}
|
|
6719
6660
|
}
|
|
6720
|
-
|
|
6721
|
-
return { changeType, range: newRange };
|
|
6722
|
-
}
|
|
6723
|
-
return { changeType: "NONE" };
|
|
6661
|
+
return { changeType, range: newRange };
|
|
6724
6662
|
};
|
|
6725
6663
|
}
|
|
6726
6664
|
function getApplyRangeChangeAddColRow(cmd) {
|
|
@@ -6729,7 +6667,7 @@ function getApplyRangeChangeAddColRow(cmd) {
|
|
|
6729
6667
|
const dimension = cmd.dimension === "COL" ? "columns" : "rows";
|
|
6730
6668
|
return (range) => {
|
|
6731
6669
|
if (range.sheetId !== cmd.sheetId) {
|
|
6732
|
-
return { changeType: "NONE" };
|
|
6670
|
+
return { changeType: "NONE", range };
|
|
6733
6671
|
}
|
|
6734
6672
|
if (cmd.position === "after") {
|
|
6735
6673
|
if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) {
|
|
@@ -6759,13 +6697,13 @@ function getApplyRangeChangeAddColRow(cmd) {
|
|
|
6759
6697
|
};
|
|
6760
6698
|
}
|
|
6761
6699
|
}
|
|
6762
|
-
return { changeType: "NONE" };
|
|
6700
|
+
return { changeType: "NONE", range };
|
|
6763
6701
|
};
|
|
6764
6702
|
}
|
|
6765
6703
|
function getApplyRangeChangeDeleteSheet(cmd) {
|
|
6766
6704
|
return (range) => {
|
|
6767
6705
|
if (range.sheetId !== cmd.sheetId && range.invalidSheetName !== cmd.sheetName) {
|
|
6768
|
-
return { changeType: "NONE" };
|
|
6706
|
+
return { changeType: "NONE", range };
|
|
6769
6707
|
}
|
|
6770
6708
|
const invalidSheetName = cmd.sheetName;
|
|
6771
6709
|
range = {
|
|
@@ -6792,14 +6730,14 @@ function getApplyRangeChangeRenameSheet(cmd) {
|
|
|
6792
6730
|
const newRange = { ...range, sheetId, invalidSheetName };
|
|
6793
6731
|
return { changeType: "CHANGE", range: newRange };
|
|
6794
6732
|
}
|
|
6795
|
-
return { changeType: "NONE" };
|
|
6733
|
+
return { changeType: "NONE", range };
|
|
6796
6734
|
};
|
|
6797
6735
|
}
|
|
6798
6736
|
function getApplyRangeChangeMoveRange(cmd) {
|
|
6799
6737
|
const originZone = cmd.target[0];
|
|
6800
6738
|
return (range) => {
|
|
6801
6739
|
if (range.sheetId !== cmd.sheetId || !isZoneInside(range.zone, originZone)) {
|
|
6802
|
-
return { changeType: "NONE" };
|
|
6740
|
+
return { changeType: "NONE", range };
|
|
6803
6741
|
}
|
|
6804
6742
|
const targetSheetId = cmd.targetSheetId;
|
|
6805
6743
|
const offsetX = cmd.col - originZone.left;
|
|
@@ -6896,17 +6834,87 @@ function fuzzyLookup(pattern, list, fn) {
|
|
|
6896
6834
|
return results.map((r) => r.elem);
|
|
6897
6835
|
}
|
|
6898
6836
|
|
|
6837
|
+
function createDefaultRows(rowNumber) {
|
|
6838
|
+
const rows = [];
|
|
6839
|
+
for (let i = 0; i < rowNumber; i++) {
|
|
6840
|
+
const row = {
|
|
6841
|
+
cells: {},
|
|
6842
|
+
};
|
|
6843
|
+
rows.push(row);
|
|
6844
|
+
}
|
|
6845
|
+
return rows;
|
|
6846
|
+
}
|
|
6847
|
+
function moveHeaderIndexesOnHeaderAddition(indexHeaderAdded, numberAdded, headers) {
|
|
6848
|
+
return headers.map((header) => {
|
|
6849
|
+
if (header >= indexHeaderAdded) {
|
|
6850
|
+
return header + numberAdded;
|
|
6851
|
+
}
|
|
6852
|
+
return header;
|
|
6853
|
+
});
|
|
6854
|
+
}
|
|
6855
|
+
function moveHeaderIndexesOnHeaderDeletion(deletedHeaders, headers) {
|
|
6856
|
+
deletedHeaders = [...deletedHeaders].sort((a, b) => b - a);
|
|
6857
|
+
return headers
|
|
6858
|
+
.map((header) => {
|
|
6859
|
+
for (const deletedHeader of deletedHeaders) {
|
|
6860
|
+
if (header > deletedHeader) {
|
|
6861
|
+
header--;
|
|
6862
|
+
}
|
|
6863
|
+
else if (header === deletedHeader) {
|
|
6864
|
+
return undefined;
|
|
6865
|
+
}
|
|
6866
|
+
}
|
|
6867
|
+
return header;
|
|
6868
|
+
})
|
|
6869
|
+
.filter(isDefined);
|
|
6870
|
+
}
|
|
6871
|
+
function getNextSheetName(existingNames, baseName = "Sheet") {
|
|
6872
|
+
let i = 1;
|
|
6873
|
+
let name = `${baseName}${i}`;
|
|
6874
|
+
while (existingNames.includes(name)) {
|
|
6875
|
+
name = `${baseName}${i}`;
|
|
6876
|
+
i++;
|
|
6877
|
+
}
|
|
6878
|
+
return name;
|
|
6879
|
+
}
|
|
6880
|
+
function getDuplicateSheetName(nameToDuplicate, existingNames) {
|
|
6881
|
+
let i = 1;
|
|
6882
|
+
const baseName = _t("Copy of %s", nameToDuplicate);
|
|
6883
|
+
let name = baseName.toString();
|
|
6884
|
+
while (existingNames.includes(name)) {
|
|
6885
|
+
name = `${baseName} (${i})`;
|
|
6886
|
+
i++;
|
|
6887
|
+
}
|
|
6888
|
+
return name;
|
|
6889
|
+
}
|
|
6890
|
+
function isSheetNameEqual(name1, name2) {
|
|
6891
|
+
if (name1 === undefined || name2 === undefined) {
|
|
6892
|
+
return false;
|
|
6893
|
+
}
|
|
6894
|
+
return (getUnquotedSheetName(name1.trim().toUpperCase()) ===
|
|
6895
|
+
getUnquotedSheetName(name2.trim().toUpperCase()));
|
|
6896
|
+
}
|
|
6897
|
+
|
|
6899
6898
|
function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
|
|
6900
6899
|
return numberOfLines * (textLineHeight + MIN_CELL_TEXT_MARGIN) - MIN_CELL_TEXT_MARGIN;
|
|
6901
6900
|
}
|
|
6902
6901
|
/**
|
|
6903
6902
|
* Get the default height of the cell given its style.
|
|
6904
6903
|
*/
|
|
6905
|
-
function getDefaultCellHeight(ctx, cell, colSize) {
|
|
6904
|
+
function getDefaultCellHeight(ctx, cell, locale, colSize) {
|
|
6906
6905
|
if (!cell || (!cell.isFormula && !cell.content)) {
|
|
6907
6906
|
return DEFAULT_CELL_HEIGHT;
|
|
6908
6907
|
}
|
|
6909
|
-
|
|
6908
|
+
let content = "";
|
|
6909
|
+
try {
|
|
6910
|
+
if (!cell.isFormula) {
|
|
6911
|
+
const localeFormat = { format: cell.format, locale };
|
|
6912
|
+
content = formatValue(parseLiteral(cell.content, locale), localeFormat);
|
|
6913
|
+
}
|
|
6914
|
+
}
|
|
6915
|
+
catch {
|
|
6916
|
+
content = CellErrorType.GenericError;
|
|
6917
|
+
}
|
|
6910
6918
|
return getCellContentHeight(ctx, content, cell.style, colSize);
|
|
6911
6919
|
}
|
|
6912
6920
|
function getCellContentHeight(ctx, content, style, colSize) {
|
|
@@ -19068,9 +19076,10 @@ function assertDomainLength(domain) {
|
|
|
19068
19076
|
throw new EvaluationError(_t("Function PIVOT takes an even number of arguments."));
|
|
19069
19077
|
}
|
|
19070
19078
|
}
|
|
19071
|
-
function addPivotDependencies(evalContext,
|
|
19079
|
+
function addPivotDependencies(evalContext, pivotId, forMeasures) {
|
|
19072
19080
|
//TODO This function can be very costly when used with PIVOT.VALUE and PIVOT.HEADER
|
|
19073
19081
|
const dependencies = [];
|
|
19082
|
+
const coreDefinition = evalContext.getters.getPivotCoreDefinition(pivotId);
|
|
19074
19083
|
if (coreDefinition.type === "SPREADSHEET" && coreDefinition.dataSet) {
|
|
19075
19084
|
const { sheetId, zone } = coreDefinition.dataSet;
|
|
19076
19085
|
const xc = zoneToXc(zone);
|
|
@@ -19087,8 +19096,7 @@ function addPivotDependencies(evalContext, coreDefinition, forMeasures) {
|
|
|
19087
19096
|
}
|
|
19088
19097
|
for (const measure of forMeasures) {
|
|
19089
19098
|
if (measure.computedBy) {
|
|
19090
|
-
|
|
19091
|
-
dependencies.push(...formula.dependencies.filter((range) => !range.invalidXc));
|
|
19099
|
+
dependencies.push(...evalContext.getters.getMeasureFullDependencies(pivotId, measure));
|
|
19092
19100
|
}
|
|
19093
19101
|
}
|
|
19094
19102
|
const originPosition = evalContext.__originCellPosition;
|
|
@@ -19557,7 +19565,7 @@ const PIVOT_VALUE = {
|
|
|
19557
19565
|
assertDomainLength(domainArgs);
|
|
19558
19566
|
const pivot = this.getters.getPivot(pivotId);
|
|
19559
19567
|
const coreDefinition = this.getters.getPivotCoreDefinition(pivotId);
|
|
19560
|
-
addPivotDependencies(this,
|
|
19568
|
+
addPivotDependencies(this, pivotId, coreDefinition.measures.filter((m) => m.id === _measure));
|
|
19561
19569
|
pivot.init({ reload: pivot.needsReevaluation });
|
|
19562
19570
|
const error = pivot.assertIsValid({ throwOnError: false });
|
|
19563
19571
|
if (error) {
|
|
@@ -19590,8 +19598,7 @@ const PIVOT_HEADER = {
|
|
|
19590
19598
|
const _pivotId = getPivotId(_pivotFormulaId, this.getters);
|
|
19591
19599
|
assertDomainLength(domainArgs);
|
|
19592
19600
|
const pivot = this.getters.getPivot(_pivotId);
|
|
19593
|
-
|
|
19594
|
-
addPivotDependencies(this, coreDefinition, []);
|
|
19601
|
+
addPivotDependencies(this, _pivotId, []);
|
|
19595
19602
|
pivot.init({ reload: pivot.needsReevaluation });
|
|
19596
19603
|
const error = pivot.assertIsValid({ throwOnError: false });
|
|
19597
19604
|
if (error) {
|
|
@@ -19649,7 +19656,7 @@ const PIVOT = {
|
|
|
19649
19656
|
const pivotId = getPivotId(_pivotFormulaId, this.getters);
|
|
19650
19657
|
const pivot = this.getters.getPivot(pivotId);
|
|
19651
19658
|
const coreDefinition = this.getters.getPivotCoreDefinition(pivotId);
|
|
19652
|
-
addPivotDependencies(this,
|
|
19659
|
+
addPivotDependencies(this, pivotId, coreDefinition.measures);
|
|
19653
19660
|
pivot.init({ reload: pivot.needsReevaluation });
|
|
19654
19661
|
const error = pivot.assertIsValid({ throwOnError: false });
|
|
19655
19662
|
if (error) {
|
|
@@ -20988,7 +20995,16 @@ function createComputeFunction(descr) {
|
|
|
20988
20995
|
}
|
|
20989
20996
|
acceptToVectorize.push(!argDefinition.acceptMatrix);
|
|
20990
20997
|
}
|
|
20991
|
-
return applyVectorization(errorHandlingCompute.bind(this), args, acceptToVectorize);
|
|
20998
|
+
return replaceErrorPlaceholderInResult(applyVectorization(errorHandlingCompute.bind(this), args, acceptToVectorize));
|
|
20999
|
+
}
|
|
21000
|
+
function replaceErrorPlaceholderInResult(result) {
|
|
21001
|
+
if (!isMatrix(result)) {
|
|
21002
|
+
replaceFunctionNamePlaceholder(result, descr.name);
|
|
21003
|
+
}
|
|
21004
|
+
else {
|
|
21005
|
+
matrixForEach(result, (result) => replaceFunctionNamePlaceholder(result, descr.name));
|
|
21006
|
+
}
|
|
21007
|
+
return result;
|
|
20992
21008
|
}
|
|
20993
21009
|
function errorHandlingCompute(...args) {
|
|
20994
21010
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -21017,13 +21033,12 @@ function createComputeFunction(descr) {
|
|
|
21017
21033
|
const result = descr.compute.apply(this, args);
|
|
21018
21034
|
if (!isMatrix(result)) {
|
|
21019
21035
|
if (typeof result === "object" && result !== null && "value" in result) {
|
|
21020
|
-
replaceFunctionNamePlaceholder(result, descr.name);
|
|
21021
21036
|
return result;
|
|
21022
21037
|
}
|
|
21038
|
+
descr.name;
|
|
21023
21039
|
return { value: result };
|
|
21024
21040
|
}
|
|
21025
21041
|
if (typeof result[0][0] === "object" && result[0][0] !== null && "value" in result[0][0]) {
|
|
21026
|
-
matrixForEach(result, (result) => replaceFunctionNamePlaceholder(result, descr.name));
|
|
21027
21042
|
return result;
|
|
21028
21043
|
}
|
|
21029
21044
|
return matrixMap(result, (row) => ({ value: row }));
|
|
@@ -21475,7 +21490,7 @@ function adaptFormulaStringRanges(defaultSheetId, formula, applyChange) {
|
|
|
21475
21490
|
continue;
|
|
21476
21491
|
}
|
|
21477
21492
|
const sheetXC = tokens[tokenIdx].value;
|
|
21478
|
-
const newSheetXC = adaptStringRange(defaultSheetId, sheetXC, applyChange);
|
|
21493
|
+
const newSheetXC = adaptStringRange(defaultSheetId, sheetXC, applyChange).range;
|
|
21479
21494
|
if (sheetXC !== newSheetXC) {
|
|
21480
21495
|
tokens[tokenIdx] = {
|
|
21481
21496
|
value: newSheetXC,
|
|
@@ -21485,23 +21500,30 @@ function adaptFormulaStringRanges(defaultSheetId, formula, applyChange) {
|
|
|
21485
21500
|
}
|
|
21486
21501
|
return concat(tokens.map((token) => token.value));
|
|
21487
21502
|
}
|
|
21488
|
-
function adaptStringRange(defaultSheetId, sheetXC,
|
|
21503
|
+
function adaptStringRange(defaultSheetId, sheetXC, rangeAdapter) {
|
|
21489
21504
|
const sheetName = splitReference(sheetXC).sheetName;
|
|
21490
21505
|
if (sheetName
|
|
21491
|
-
? !isSheetNameEqual(sheetName,
|
|
21492
|
-
: defaultSheetId !==
|
|
21493
|
-
return sheetXC;
|
|
21506
|
+
? !isSheetNameEqual(sheetName, rangeAdapter.sheetName.old)
|
|
21507
|
+
: defaultSheetId !== rangeAdapter.sheetId) {
|
|
21508
|
+
return { changeType: "NONE", range: sheetXC };
|
|
21494
21509
|
}
|
|
21495
|
-
const sheetId = sheetName ?
|
|
21510
|
+
const sheetId = sheetName ? rangeAdapter.sheetId : defaultSheetId;
|
|
21496
21511
|
const range = getRange(sheetXC, sheetId);
|
|
21497
21512
|
if (range.invalidXc) {
|
|
21498
|
-
return sheetXC;
|
|
21513
|
+
return { changeType: "NONE", range: sheetXC };
|
|
21499
21514
|
}
|
|
21500
|
-
const change =
|
|
21515
|
+
const change = rangeAdapter.applyChange(range);
|
|
21501
21516
|
if (change.changeType === "NONE" || change.changeType === "REMOVE") {
|
|
21502
|
-
return sheetXC;
|
|
21517
|
+
return { changeType: change.changeType, range: sheetXC };
|
|
21518
|
+
}
|
|
21519
|
+
const rangeStr = getRangeString(change.range, defaultSheetId, getSheetNameGetter(rangeAdapter));
|
|
21520
|
+
if (rangeStr === CellErrorType.InvalidReference) {
|
|
21521
|
+
return { changeType: "REMOVE", range: rangeStr };
|
|
21503
21522
|
}
|
|
21504
|
-
return
|
|
21523
|
+
return {
|
|
21524
|
+
changeType: change.changeType,
|
|
21525
|
+
range: rangeStr,
|
|
21526
|
+
};
|
|
21505
21527
|
}
|
|
21506
21528
|
function getSheetNameGetter(applyChange) {
|
|
21507
21529
|
return (sheetId) => {
|
|
@@ -21606,8 +21628,6 @@ function adaptChartRange(range, applyChange) {
|
|
|
21606
21628
|
}
|
|
21607
21629
|
const change = applyChange(range);
|
|
21608
21630
|
switch (change.changeType) {
|
|
21609
|
-
case "NONE":
|
|
21610
|
-
return range;
|
|
21611
21631
|
case "REMOVE":
|
|
21612
21632
|
return undefined;
|
|
21613
21633
|
default:
|
|
@@ -21759,16 +21779,16 @@ function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
|
|
|
21759
21779
|
function transformChartDefinitionWithDataSetsWithZone(chartSheetId, definition, applyChange) {
|
|
21760
21780
|
let labelRange;
|
|
21761
21781
|
if (definition.labelRange) {
|
|
21762
|
-
const adaptedRange = adaptStringRange(chartSheetId, definition.labelRange, applyChange);
|
|
21763
|
-
if (
|
|
21782
|
+
const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, definition.labelRange, applyChange);
|
|
21783
|
+
if (changeType !== "REMOVE") {
|
|
21764
21784
|
labelRange = adaptedRange;
|
|
21765
21785
|
}
|
|
21766
21786
|
}
|
|
21767
21787
|
const dataSets = [];
|
|
21768
21788
|
for (const dataSet of definition.dataSets) {
|
|
21769
21789
|
const newDataSet = { ...dataSet };
|
|
21770
|
-
const adaptedRange = adaptStringRange(chartSheetId, dataSet.dataRange, applyChange);
|
|
21771
|
-
if (
|
|
21790
|
+
const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, dataSet.dataRange, applyChange);
|
|
21791
|
+
if (changeType !== "REMOVE") {
|
|
21772
21792
|
newDataSet.dataRange = adaptedRange;
|
|
21773
21793
|
dataSets.push(newDataSet);
|
|
21774
21794
|
}
|
|
@@ -23146,14 +23166,14 @@ let ScorecardChart$1 = class ScorecardChart extends AbstractChart {
|
|
|
23146
23166
|
let baseline;
|
|
23147
23167
|
let keyValue;
|
|
23148
23168
|
if (definition.baseline) {
|
|
23149
|
-
const adaptedRange = adaptStringRange(chartSheetId, definition.baseline, applyChange);
|
|
23150
|
-
if (
|
|
23169
|
+
const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, definition.baseline, applyChange);
|
|
23170
|
+
if (changeType !== "REMOVE") {
|
|
23151
23171
|
baseline = adaptedRange;
|
|
23152
23172
|
}
|
|
23153
23173
|
}
|
|
23154
23174
|
if (definition.keyValue) {
|
|
23155
|
-
const adaptedRange = adaptStringRange(chartSheetId, definition.keyValue, applyChange);
|
|
23156
|
-
if (
|
|
23175
|
+
const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, definition.keyValue, applyChange);
|
|
23176
|
+
if (changeType !== "REMOVE") {
|
|
23157
23177
|
keyValue = adaptedRange;
|
|
23158
23178
|
}
|
|
23159
23179
|
}
|
|
@@ -23210,7 +23230,7 @@ let ScorecardChart$1 = class ScorecardChart extends AbstractChart {
|
|
|
23210
23230
|
// This kind of graph is not exportable in Excel
|
|
23211
23231
|
return undefined;
|
|
23212
23232
|
}
|
|
23213
|
-
updateRanges(applyChange) {
|
|
23233
|
+
updateRanges({ applyChange }) {
|
|
23214
23234
|
const baseline = adaptChartRange(this.baseline, applyChange);
|
|
23215
23235
|
const keyValue = adaptChartRange(this.keyValue, applyChange);
|
|
23216
23236
|
if (this.baseline === baseline && this.keyValue === keyValue) {
|
|
@@ -26584,7 +26604,7 @@ class BarChart extends AbstractChart {
|
|
|
26584
26604
|
verticalAxis: getDefinedAxis(definition),
|
|
26585
26605
|
};
|
|
26586
26606
|
}
|
|
26587
|
-
updateRanges(applyChange) {
|
|
26607
|
+
updateRanges({ applyChange }) {
|
|
26588
26608
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
26589
26609
|
if (!isStale) {
|
|
26590
26610
|
return this;
|
|
@@ -27171,7 +27191,7 @@ class ComboChart extends AbstractChart {
|
|
|
27171
27191
|
verticalAxis: getDefinedAxis(definition),
|
|
27172
27192
|
};
|
|
27173
27193
|
}
|
|
27174
|
-
updateRanges(applyChange) {
|
|
27194
|
+
updateRanges({ applyChange }) {
|
|
27175
27195
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
27176
27196
|
if (!isStale) {
|
|
27177
27197
|
return this;
|
|
@@ -27343,7 +27363,7 @@ class FunnelChart extends AbstractChart {
|
|
|
27343
27363
|
getDefinitionForExcel() {
|
|
27344
27364
|
return undefined;
|
|
27345
27365
|
}
|
|
27346
|
-
updateRanges(applyChange) {
|
|
27366
|
+
updateRanges({ applyChange }) {
|
|
27347
27367
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
27348
27368
|
if (!isStale) {
|
|
27349
27369
|
return this;
|
|
@@ -27454,8 +27474,8 @@ class GaugeChart extends AbstractChart {
|
|
|
27454
27474
|
static transformDefinition(chartSheetId, definition, applyChange) {
|
|
27455
27475
|
let dataRange;
|
|
27456
27476
|
if (definition.dataRange) {
|
|
27457
|
-
const adaptedRange = adaptStringRange(chartSheetId, definition.dataRange, applyChange);
|
|
27458
|
-
if (
|
|
27477
|
+
const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, definition.dataRange, applyChange);
|
|
27478
|
+
if (changeType !== "REMOVE") {
|
|
27459
27479
|
dataRange = adaptedRange;
|
|
27460
27480
|
}
|
|
27461
27481
|
}
|
|
@@ -27530,13 +27550,9 @@ class GaugeChart extends AbstractChart {
|
|
|
27530
27550
|
: undefined,
|
|
27531
27551
|
};
|
|
27532
27552
|
}
|
|
27533
|
-
updateRanges(applyChange,
|
|
27553
|
+
updateRanges({ applyChange, adaptFormulaString }) {
|
|
27534
27554
|
const dataRange = adaptChartRange(this.dataRange, applyChange);
|
|
27535
|
-
const adaptFormula = (formula) =>
|
|
27536
|
-
applyChange,
|
|
27537
|
-
sheetId,
|
|
27538
|
-
sheetName: adaptSheetName,
|
|
27539
|
-
});
|
|
27555
|
+
const adaptFormula = (formula) => adaptFormulaString(this.sheetId, formula);
|
|
27540
27556
|
const sectionRule = adaptSectionRuleFormulas(this.sectionRule, adaptFormula);
|
|
27541
27557
|
const definition = this.getDefinitionWithSpecificRanges(dataRange, sectionRule);
|
|
27542
27558
|
return new GaugeChart(definition, this.sheetId, this.getters);
|
|
@@ -27758,7 +27774,7 @@ class GeoChart extends AbstractChart {
|
|
|
27758
27774
|
getDefinitionForExcel() {
|
|
27759
27775
|
return undefined;
|
|
27760
27776
|
}
|
|
27761
|
-
updateRanges(applyChange) {
|
|
27777
|
+
updateRanges({ applyChange }) {
|
|
27762
27778
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
27763
27779
|
if (!isStale) {
|
|
27764
27780
|
return this;
|
|
@@ -27894,7 +27910,7 @@ class LineChart extends AbstractChart {
|
|
|
27894
27910
|
: undefined,
|
|
27895
27911
|
};
|
|
27896
27912
|
}
|
|
27897
|
-
updateRanges(applyChange) {
|
|
27913
|
+
updateRanges({ applyChange }) {
|
|
27898
27914
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
27899
27915
|
if (!isStale) {
|
|
27900
27916
|
return this;
|
|
@@ -28054,7 +28070,7 @@ class PieChart extends AbstractChart {
|
|
|
28054
28070
|
labelRange,
|
|
28055
28071
|
};
|
|
28056
28072
|
}
|
|
28057
|
-
updateRanges(applyChange) {
|
|
28073
|
+
updateRanges({ applyChange }) {
|
|
28058
28074
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
28059
28075
|
if (!isStale) {
|
|
28060
28076
|
return this;
|
|
@@ -28193,7 +28209,7 @@ class PyramidChart extends AbstractChart {
|
|
|
28193
28209
|
getDefinitionForExcel() {
|
|
28194
28210
|
return undefined;
|
|
28195
28211
|
}
|
|
28196
|
-
updateRanges(applyChange) {
|
|
28212
|
+
updateRanges({ applyChange }) {
|
|
28197
28213
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
28198
28214
|
if (!isStale) {
|
|
28199
28215
|
return this;
|
|
@@ -28344,7 +28360,7 @@ class RadarChart extends AbstractChart {
|
|
|
28344
28360
|
labelRange,
|
|
28345
28361
|
};
|
|
28346
28362
|
}
|
|
28347
|
-
updateRanges(applyChange) {
|
|
28363
|
+
updateRanges({ applyChange }) {
|
|
28348
28364
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
28349
28365
|
if (!isStale) {
|
|
28350
28366
|
return this;
|
|
@@ -28466,7 +28482,7 @@ class ScatterChart extends AbstractChart {
|
|
|
28466
28482
|
: undefined,
|
|
28467
28483
|
};
|
|
28468
28484
|
}
|
|
28469
|
-
updateRanges(applyChange) {
|
|
28485
|
+
updateRanges({ applyChange }) {
|
|
28470
28486
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
28471
28487
|
if (!isStale) {
|
|
28472
28488
|
return this;
|
|
@@ -28631,7 +28647,7 @@ class SunburstChart extends AbstractChart {
|
|
|
28631
28647
|
getDefinitionForExcel() {
|
|
28632
28648
|
return undefined;
|
|
28633
28649
|
}
|
|
28634
|
-
updateRanges(applyChange) {
|
|
28650
|
+
updateRanges({ applyChange }) {
|
|
28635
28651
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
28636
28652
|
if (!isStale) {
|
|
28637
28653
|
return this;
|
|
@@ -28779,7 +28795,7 @@ class TreeMapChart extends AbstractChart {
|
|
|
28779
28795
|
getDefinitionForExcel() {
|
|
28780
28796
|
return undefined;
|
|
28781
28797
|
}
|
|
28782
|
-
updateRanges(applyChange) {
|
|
28798
|
+
updateRanges({ applyChange }) {
|
|
28783
28799
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
28784
28800
|
if (!isStale) {
|
|
28785
28801
|
return this;
|
|
@@ -28934,7 +28950,7 @@ class WaterfallChart extends AbstractChart {
|
|
|
28934
28950
|
// TODO: implement export excel
|
|
28935
28951
|
return undefined;
|
|
28936
28952
|
}
|
|
28937
|
-
updateRanges(applyChange) {
|
|
28953
|
+
updateRanges({ applyChange }) {
|
|
28938
28954
|
const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
|
|
28939
28955
|
if (!isStale) {
|
|
28940
28956
|
return this;
|
|
@@ -32642,7 +32658,6 @@ class AbstractComposerStore extends SpreadsheetStore {
|
|
|
32642
32658
|
});
|
|
32643
32659
|
}
|
|
32644
32660
|
handleEvent(event) {
|
|
32645
|
-
this.hideHelp();
|
|
32646
32661
|
const sheetId = this.getters.getActiveSheetId();
|
|
32647
32662
|
let unboundedZone;
|
|
32648
32663
|
if (event.options.unbounded) {
|
|
@@ -32903,7 +32918,7 @@ class AbstractComposerStore extends SpreadsheetStore {
|
|
|
32903
32918
|
}
|
|
32904
32919
|
captureSelection(zone, col, row) {
|
|
32905
32920
|
this.model.selection.capture(this, {
|
|
32906
|
-
cell: { col: col ?? zone.left, row: row ?? zone.
|
|
32921
|
+
cell: { col: col ?? zone.left, row: row ?? zone.top },
|
|
32907
32922
|
zone,
|
|
32908
32923
|
}, {
|
|
32909
32924
|
handleEvent: this.handleEvent.bind(this),
|
|
@@ -32996,6 +33011,7 @@ class AbstractComposerStore extends SpreadsheetStore {
|
|
|
32996
33011
|
this.colorIndexByRange = {};
|
|
32997
33012
|
this.hoveredTokens = [];
|
|
32998
33013
|
this.hoveredContentEvaluation = "";
|
|
33014
|
+
this.hideHelp();
|
|
32999
33015
|
}
|
|
33000
33016
|
/**
|
|
33001
33017
|
* Reset the current content to the active cell content
|
|
@@ -38617,6 +38633,7 @@ function extractStyle(data, content, styleId, formatId, borderId) {
|
|
|
38617
38633
|
? V_ALIGNMENT_EXPORT_CONVERSION_MAP[style.verticalAlign]
|
|
38618
38634
|
: undefined,
|
|
38619
38635
|
wrapText: style.wrapping === "wrap" || content?.includes(NEWLINE) ? true : undefined,
|
|
38636
|
+
shrinkToFit: style.wrapping === "clip" ? true : undefined,
|
|
38620
38637
|
},
|
|
38621
38638
|
};
|
|
38622
38639
|
styles.font["strike"] = !!style?.strikethrough || undefined;
|
|
@@ -38637,6 +38654,7 @@ function normalizeStyle(construct, styles) {
|
|
|
38637
38654
|
vertical: styles.alignment.vertical,
|
|
38638
38655
|
horizontal: styles.alignment.horizontal,
|
|
38639
38656
|
wrapText: styles.alignment.wrapText,
|
|
38657
|
+
shrinkToFit: styles.alignment.shrinkToFit,
|
|
38640
38658
|
},
|
|
38641
38659
|
};
|
|
38642
38660
|
return pushElement(style, construct.styles);
|
|
@@ -50820,7 +50838,7 @@ class GaugeChartConfigPanel extends Component {
|
|
|
50820
50838
|
});
|
|
50821
50839
|
dataRange = this.props.definition.dataRange;
|
|
50822
50840
|
get configurationErrorMessages() {
|
|
50823
|
-
const cancelledReasons = [...(this.state.dataRangeDispatchResult?.reasons || [])];
|
|
50841
|
+
const cancelledReasons = [...(this.state.dataRangeDispatchResult?.reasons || [])].filter((reason) => reason !== "NoChanges" /* CommandResult.NoChanges */);
|
|
50824
50842
|
return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
50825
50843
|
}
|
|
50826
50844
|
get isDataRangeInvalid() {
|
|
@@ -50905,7 +50923,7 @@ class GaugeChartDesignPanel extends Component {
|
|
|
50905
50923
|
});
|
|
50906
50924
|
}
|
|
50907
50925
|
get designErrorMessages() {
|
|
50908
|
-
const cancelledReasons = [...(this.state.sectionRuleCancelledReasons || [])];
|
|
50926
|
+
const cancelledReasons = [...(this.state.sectionRuleCancelledReasons || [])].filter((reason) => reason !== "NoChanges" /* CommandResult.NoChanges */);
|
|
50909
50927
|
return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
50910
50928
|
}
|
|
50911
50929
|
get isRangeMinInvalid() {
|
|
@@ -51270,7 +51288,7 @@ class ScorecardChartConfigPanel extends Component {
|
|
|
51270
51288
|
const cancelledReasons = [
|
|
51271
51289
|
...(this.state.keyValueDispatchResult?.reasons || []),
|
|
51272
51290
|
...(this.state.baselineDispatchResult?.reasons || []),
|
|
51273
|
-
];
|
|
51291
|
+
].filter((reason) => reason !== "NoChanges" /* CommandResult.NoChanges */);
|
|
51274
51292
|
return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
51275
51293
|
}
|
|
51276
51294
|
get isKeyValueInvalid() {
|
|
@@ -53203,6 +53221,12 @@ class FindAndReplaceStore extends SpreadsheetStore {
|
|
|
53203
53221
|
case "ACTIVATE_SHEET":
|
|
53204
53222
|
this.isSearchDirty = true;
|
|
53205
53223
|
this.shouldFinalizeUpdateSelection = true;
|
|
53224
|
+
if (this.searchOptions.specificRange) {
|
|
53225
|
+
this.searchOptions.specificRange = {
|
|
53226
|
+
...this.searchOptions.specificRange,
|
|
53227
|
+
sheetId: this.getters.getActiveSheetId(),
|
|
53228
|
+
};
|
|
53229
|
+
}
|
|
53206
53230
|
break;
|
|
53207
53231
|
case "REPLACE_SEARCH":
|
|
53208
53232
|
for (const match of cmd.matches) {
|
|
@@ -53622,9 +53646,20 @@ class FindAndReplacePanel extends Component {
|
|
|
53622
53646
|
const specificRange = this.env.model.getters.getRangeFromSheetXC(this.env.model.getters.getActiveSheetId(), this.state.dataRange);
|
|
53623
53647
|
this.store.updateSearchOptions({ specificRange });
|
|
53624
53648
|
}
|
|
53649
|
+
get specificRange() {
|
|
53650
|
+
const range = this.store.searchOptions.specificRange;
|
|
53651
|
+
return range ? this.env.model.getters.getRangeString(range, "forceSheetReference") : "";
|
|
53652
|
+
}
|
|
53625
53653
|
get pendingSearch() {
|
|
53626
53654
|
return this.updateSearchContent.isDebouncePending();
|
|
53627
53655
|
}
|
|
53656
|
+
get selectionInputKey() {
|
|
53657
|
+
// Selections input are made to work with objects linked to a sheet id. They store the active sheet id at their creation,
|
|
53658
|
+
// and have specific behaviour linked to it (eg. go back to the initial sheet after confirmation).
|
|
53659
|
+
// We don't want all those behaviors here, so we force the recreation of the component when the active sheet changes.
|
|
53660
|
+
// The only drawback is that the input loses focus when changing sheet.
|
|
53661
|
+
return this.env.model.getters.getActiveSheetId();
|
|
53662
|
+
}
|
|
53628
53663
|
}
|
|
53629
53664
|
|
|
53630
53665
|
css /* scss */ `
|
|
@@ -56080,8 +56115,6 @@ function adaptPivotRange(range, applyChange) {
|
|
|
56080
56115
|
}
|
|
56081
56116
|
const change = applyChange(range);
|
|
56082
56117
|
switch (change.changeType) {
|
|
56083
|
-
case "NONE":
|
|
56084
|
-
return range;
|
|
56085
56118
|
case "REMOVE":
|
|
56086
56119
|
return undefined;
|
|
56087
56120
|
default:
|
|
@@ -58899,7 +58932,7 @@ class CorePlugin extends BasePlugin {
|
|
|
58899
58932
|
* @param sheetId an sheetId to adapt either range of that sheet specifically, or ranges pointing to that sheet
|
|
58900
58933
|
* @param sheetName couple of old and new sheet names to adapt ranges pointing to that sheet
|
|
58901
58934
|
*/
|
|
58902
|
-
adaptRanges(
|
|
58935
|
+
adaptRanges(rangeAdapterFunctions, sheetId, sheetName) { }
|
|
58903
58936
|
/**
|
|
58904
58937
|
* Implement this method to clean unused external resources, such as images
|
|
58905
58938
|
* stored on a server which have been deleted.
|
|
@@ -59495,7 +59528,7 @@ class CellPlugin extends CorePlugin {
|
|
|
59495
59528
|
];
|
|
59496
59529
|
nextId = 1;
|
|
59497
59530
|
cells = {};
|
|
59498
|
-
adaptRanges(applyChange, sheetId, sheetName) {
|
|
59531
|
+
adaptRanges({ applyChange }, sheetId, sheetName) {
|
|
59499
59532
|
for (const sheet of Object.keys(this.cells)) {
|
|
59500
59533
|
for (const cell of Object.values(this.cells[sheet] || {})) {
|
|
59501
59534
|
if (cell.isFormula) {
|
|
@@ -59717,7 +59750,7 @@ class CellPlugin extends CorePlugin {
|
|
|
59717
59750
|
for (const position of positions) {
|
|
59718
59751
|
const cell = this.getters.getCell(position);
|
|
59719
59752
|
const xc = toXC(position.col, position.row);
|
|
59720
|
-
const style = this.
|
|
59753
|
+
const style = this.extractCustomStyle(cell);
|
|
59721
59754
|
if (Object.keys(style).length) {
|
|
59722
59755
|
const styleId = getItemId(style, styles);
|
|
59723
59756
|
positionsByStyle[styleId] ??= [];
|
|
@@ -59763,10 +59796,14 @@ class CellPlugin extends CorePlugin {
|
|
|
59763
59796
|
}
|
|
59764
59797
|
}
|
|
59765
59798
|
}
|
|
59766
|
-
|
|
59767
|
-
const cleanedStyle = { ...style };
|
|
59768
|
-
|
|
59769
|
-
|
|
59799
|
+
extractCustomStyle(cell) {
|
|
59800
|
+
const cleanedStyle = { ...cell.style };
|
|
59801
|
+
const defaultStyle = isNumber(cell.content, DEFAULT_LOCALE)
|
|
59802
|
+
? DEFAULT_NUMBER_STYLE
|
|
59803
|
+
: DEFAULT_STYLE;
|
|
59804
|
+
for (const property in cleanedStyle) {
|
|
59805
|
+
if ((property !== "align" || !cell.isFormula) &&
|
|
59806
|
+
cleanedStyle[property] === defaultStyle[property]) {
|
|
59770
59807
|
delete cleanedStyle[property];
|
|
59771
59808
|
}
|
|
59772
59809
|
}
|
|
@@ -60116,9 +60153,9 @@ class ChartPlugin extends CorePlugin {
|
|
|
60116
60153
|
charts = {};
|
|
60117
60154
|
createChart = chartFactory(this.getters);
|
|
60118
60155
|
validateChartDefinition = (cmd) => validateChartDefinition(this, cmd.definition);
|
|
60119
|
-
adaptRanges(
|
|
60156
|
+
adaptRanges(rangeAdapters) {
|
|
60120
60157
|
for (const [chartId, chart] of Object.entries(this.charts)) {
|
|
60121
|
-
this.history.update("charts", chartId, chart?.updateRanges(
|
|
60158
|
+
this.history.update("charts", chartId, chart?.updateRanges(rangeAdapters));
|
|
60122
60159
|
}
|
|
60123
60160
|
}
|
|
60124
60161
|
// ---------------------------------------------------------------------------
|
|
@@ -60308,7 +60345,7 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
60308
60345
|
"getAdaptedCfRanges",
|
|
60309
60346
|
];
|
|
60310
60347
|
cfRules = {};
|
|
60311
|
-
adaptCFFormulas(applyChange) {
|
|
60348
|
+
adaptCFFormulas({ applyChange, adaptFormulaString }) {
|
|
60312
60349
|
for (const sheetId in this.cfRules) {
|
|
60313
60350
|
for (const rule of this.cfRules[sheetId]) {
|
|
60314
60351
|
if (rule.rule.type === "DataBarRule" && rule.rule.rangeValues) {
|
|
@@ -60332,7 +60369,7 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
60332
60369
|
for (let i = 0; i < rule.rule.values.length; i++) {
|
|
60333
60370
|
this.history.update("cfRules", sheetId, this.cfRules[sheetId].indexOf(rule), "rule",
|
|
60334
60371
|
//@ts-expect-error
|
|
60335
|
-
"values", i,
|
|
60372
|
+
"values", i, adaptFormulaString(sheetId, rule.rule.values[i]));
|
|
60336
60373
|
}
|
|
60337
60374
|
}
|
|
60338
60375
|
else if (rule.rule.type === "IconSetRule") {
|
|
@@ -60340,7 +60377,7 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
60340
60377
|
if (rule.rule[inflectionPoint].type === "formula") {
|
|
60341
60378
|
this.history.update("cfRules", sheetId, this.cfRules[sheetId].indexOf(rule), "rule",
|
|
60342
60379
|
//@ts-expect-error
|
|
60343
|
-
inflectionPoint, "value",
|
|
60380
|
+
inflectionPoint, "value", adaptFormulaString(sheetId, rule.rule[inflectionPoint].value));
|
|
60344
60381
|
}
|
|
60345
60382
|
}
|
|
60346
60383
|
}
|
|
@@ -60350,14 +60387,14 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
60350
60387
|
if (ruleValue?.type === "formula" && ruleValue?.value) {
|
|
60351
60388
|
this.history.update("cfRules", sheetId, this.cfRules[sheetId].indexOf(rule), "rule",
|
|
60352
60389
|
//@ts-expect-error
|
|
60353
|
-
value, "value",
|
|
60390
|
+
value, "value", adaptFormulaString(sheetId, ruleValue.value));
|
|
60354
60391
|
}
|
|
60355
60392
|
}
|
|
60356
60393
|
}
|
|
60357
60394
|
}
|
|
60358
60395
|
}
|
|
60359
60396
|
}
|
|
60360
|
-
adaptCFRanges(sheetId, applyChange) {
|
|
60397
|
+
adaptCFRanges(sheetId, { applyChange }) {
|
|
60361
60398
|
for (const rule of this.cfRules[sheetId]) {
|
|
60362
60399
|
for (const range of rule.ranges) {
|
|
60363
60400
|
const change = applyChange(range);
|
|
@@ -60381,12 +60418,12 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
60381
60418
|
}
|
|
60382
60419
|
}
|
|
60383
60420
|
}
|
|
60384
|
-
adaptRanges(
|
|
60421
|
+
adaptRanges(rangeAdapters, sheetId) {
|
|
60385
60422
|
const sheetIds = sheetId ? [sheetId] : Object.keys(this.cfRules);
|
|
60386
60423
|
for (const sheetId of sheetIds) {
|
|
60387
|
-
this.adaptCFRanges(sheetId,
|
|
60424
|
+
this.adaptCFRanges(sheetId, rangeAdapters);
|
|
60388
60425
|
}
|
|
60389
|
-
this.adaptCFFormulas(
|
|
60426
|
+
this.adaptCFFormulas(rangeAdapters);
|
|
60390
60427
|
}
|
|
60391
60428
|
// ---------------------------------------------------------------------------
|
|
60392
60429
|
// Command Handling
|
|
@@ -60763,23 +60800,23 @@ class DataValidationPlugin extends CorePlugin {
|
|
|
60763
60800
|
"getValidationRuleForCell",
|
|
60764
60801
|
];
|
|
60765
60802
|
rules = {};
|
|
60766
|
-
adaptRanges(
|
|
60767
|
-
this.adaptDVRanges(sheetId,
|
|
60768
|
-
this.adaptDVFormulas(
|
|
60803
|
+
adaptRanges(rangeAdapters, sheetId) {
|
|
60804
|
+
this.adaptDVRanges(sheetId, rangeAdapters);
|
|
60805
|
+
this.adaptDVFormulas(rangeAdapters);
|
|
60769
60806
|
}
|
|
60770
|
-
adaptDVFormulas(
|
|
60807
|
+
adaptDVFormulas({ adaptFormulaString }) {
|
|
60771
60808
|
for (const sheetId in this.rules) {
|
|
60772
60809
|
const rules = this.rules[sheetId];
|
|
60773
60810
|
for (let ruleIndex = rules.length - 1; ruleIndex >= 0; ruleIndex--) {
|
|
60774
60811
|
const rule = this.rules[sheetId][ruleIndex];
|
|
60775
60812
|
for (let valueIndex = 0; valueIndex < rule.criterion.values.length; valueIndex++) {
|
|
60776
|
-
const value =
|
|
60813
|
+
const value = adaptFormulaString(sheetId, rule.criterion.values[valueIndex]);
|
|
60777
60814
|
this.history.update("rules", sheetId, ruleIndex, "criterion", "values", valueIndex, value);
|
|
60778
60815
|
}
|
|
60779
60816
|
}
|
|
60780
60817
|
}
|
|
60781
60818
|
}
|
|
60782
|
-
adaptDVRanges(sheetId, applyChange) {
|
|
60819
|
+
adaptDVRanges(sheetId, { applyChange }) {
|
|
60783
60820
|
const rules = this.rules[sheetId];
|
|
60784
60821
|
for (let ruleIndex = rules.length - 1; ruleIndex >= 0; ruleIndex--) {
|
|
60785
60822
|
const rule = this.rules[sheetId][ruleIndex];
|
|
@@ -61053,7 +61090,7 @@ class FigurePlugin extends CorePlugin {
|
|
|
61053
61090
|
// ---------------------------------------------------------------------------
|
|
61054
61091
|
// Command Handling
|
|
61055
61092
|
// ---------------------------------------------------------------------------
|
|
61056
|
-
adaptRanges(applyChange, sheetId) {
|
|
61093
|
+
adaptRanges({ applyChange }, sheetId) {
|
|
61057
61094
|
for (const figure of this.getFigures(sheetId)) {
|
|
61058
61095
|
const change = applyChange(this.getters.getRangeFromZone(sheetId, {
|
|
61059
61096
|
left: figure.col,
|
|
@@ -61861,8 +61898,8 @@ class MergePlugin extends CorePlugin {
|
|
|
61861
61898
|
break;
|
|
61862
61899
|
}
|
|
61863
61900
|
}
|
|
61864
|
-
adaptRanges(
|
|
61865
|
-
this.applyRangeChangeOnSheet(sheetId,
|
|
61901
|
+
adaptRanges(rangeAdapters, sheetId) {
|
|
61902
|
+
this.applyRangeChangeOnSheet(sheetId, rangeAdapters);
|
|
61866
61903
|
}
|
|
61867
61904
|
// ---------------------------------------------------------------------------
|
|
61868
61905
|
// Getters
|
|
@@ -62164,7 +62201,7 @@ class MergePlugin extends CorePlugin {
|
|
|
62164
62201
|
/**
|
|
62165
62202
|
* Apply a range change on merges of a particular sheet.
|
|
62166
62203
|
*/
|
|
62167
|
-
applyRangeChangeOnSheet(sheetId, applyChange) {
|
|
62204
|
+
applyRangeChangeOnSheet(sheetId, { applyChange }) {
|
|
62168
62205
|
const merges = Object.entries(this.merges[sheetId] || {});
|
|
62169
62206
|
for (const [mergeId, range] of merges) {
|
|
62170
62207
|
if (range) {
|
|
@@ -62238,7 +62275,7 @@ function rangeToMerge(mergeId, range) {
|
|
|
62238
62275
|
};
|
|
62239
62276
|
}
|
|
62240
62277
|
|
|
62241
|
-
class
|
|
62278
|
+
class RangeAdapterPlugin {
|
|
62242
62279
|
getters;
|
|
62243
62280
|
providers = [];
|
|
62244
62281
|
isAdaptingRanges = false;
|
|
@@ -62246,7 +62283,6 @@ class RangeAdapter {
|
|
|
62246
62283
|
this.getters = getters;
|
|
62247
62284
|
}
|
|
62248
62285
|
static getters = [
|
|
62249
|
-
"adaptFormulaStringDependencies",
|
|
62250
62286
|
"copyFormulaStringForSheet",
|
|
62251
62287
|
"extendRange",
|
|
62252
62288
|
"getRangeString",
|
|
@@ -62277,8 +62313,8 @@ class RangeAdapter {
|
|
|
62277
62313
|
throw new Error("Plugins cannot dispatch commands during adaptRanges phase");
|
|
62278
62314
|
}
|
|
62279
62315
|
const rangeAdapter = getRangeAdapter(cmd);
|
|
62280
|
-
if (rangeAdapter
|
|
62281
|
-
this.executeOnAllRanges(rangeAdapter
|
|
62316
|
+
if (rangeAdapter) {
|
|
62317
|
+
this.executeOnAllRanges(rangeAdapter);
|
|
62282
62318
|
}
|
|
62283
62319
|
}
|
|
62284
62320
|
finalize() { }
|
|
@@ -62297,11 +62333,15 @@ class RangeAdapter {
|
|
|
62297
62333
|
return result;
|
|
62298
62334
|
};
|
|
62299
62335
|
}
|
|
62300
|
-
executeOnAllRanges(
|
|
62336
|
+
executeOnAllRanges(rangeAdapter) {
|
|
62301
62337
|
this.isAdaptingRanges = true;
|
|
62302
|
-
const
|
|
62338
|
+
const adapterFunctions = {
|
|
62339
|
+
applyChange: this.verifyRangeRemoved(rangeAdapter.applyChange),
|
|
62340
|
+
adaptRangeString: (defaultSheetId, sheetXC) => adaptStringRange(defaultSheetId, sheetXC, rangeAdapter),
|
|
62341
|
+
adaptFormulaString: (defaultSheetId, formula) => adaptFormulaStringRanges(defaultSheetId, formula, rangeAdapter),
|
|
62342
|
+
};
|
|
62303
62343
|
for (const provider of this.providers) {
|
|
62304
|
-
provider(
|
|
62344
|
+
provider(adapterFunctions, rangeAdapter.sheetId, rangeAdapter.sheetName);
|
|
62305
62345
|
}
|
|
62306
62346
|
this.isAdaptingRanges = false;
|
|
62307
62347
|
}
|
|
@@ -62469,18 +62509,6 @@ class RangeAdapter {
|
|
|
62469
62509
|
const unionOfZones = unionUnboundedZones(...zones);
|
|
62470
62510
|
return this.getRangeFromZone(ranges[0].sheetId, unionOfZones);
|
|
62471
62511
|
}
|
|
62472
|
-
adaptFormulaStringDependencies(sheetId, formula, applyChange) {
|
|
62473
|
-
if (!formula.startsWith("=")) {
|
|
62474
|
-
return formula;
|
|
62475
|
-
}
|
|
62476
|
-
const compiledFormula = compile(formula);
|
|
62477
|
-
const updatedDependencies = compiledFormula.dependencies.map((dep) => {
|
|
62478
|
-
const range = this.getters.getRangeFromSheetXC(sheetId, dep);
|
|
62479
|
-
const changedRange = applyChange(range);
|
|
62480
|
-
return changedRange.changeType === "NONE" ? range : changedRange.range;
|
|
62481
|
-
});
|
|
62482
|
-
return this.getters.getFormulaString(sheetId, compiledFormula.tokens, updatedDependencies);
|
|
62483
|
-
}
|
|
62484
62512
|
/**
|
|
62485
62513
|
* Copy a formula string to another sheet.
|
|
62486
62514
|
*
|
|
@@ -63373,7 +63401,7 @@ class TablePlugin extends CorePlugin {
|
|
|
63373
63401
|
static getters = ["getCoreTable", "getCoreTables", "getCoreTableMatchingTopLeft"];
|
|
63374
63402
|
tables = {};
|
|
63375
63403
|
nextTableId = 1;
|
|
63376
|
-
adaptRanges(applyChange, sheetId) {
|
|
63404
|
+
adaptRanges({ applyChange }, sheetId) {
|
|
63377
63405
|
for (const table of this.getCoreTables(sheetId)) {
|
|
63378
63406
|
this.applyRangeChangeOnTable(sheetId, table, applyChange);
|
|
63379
63407
|
}
|
|
@@ -64251,6 +64279,7 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
64251
64279
|
"getMeasureCompiledFormula",
|
|
64252
64280
|
"getPivotName",
|
|
64253
64281
|
"isExistingPivot",
|
|
64282
|
+
"getMeasureFullDependencies",
|
|
64254
64283
|
];
|
|
64255
64284
|
nextFormulaId = 1;
|
|
64256
64285
|
pivots = {};
|
|
@@ -64333,12 +64362,12 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
64333
64362
|
}
|
|
64334
64363
|
case "UPDATE_PIVOT": {
|
|
64335
64364
|
this.history.update("pivots", cmd.pivotId, "definition", deepCopy(cmd.pivot));
|
|
64336
|
-
this.compileCalculatedMeasures(cmd.pivot.measures);
|
|
64365
|
+
this.compileCalculatedMeasures(cmd.pivotId, cmd.pivot.measures);
|
|
64337
64366
|
break;
|
|
64338
64367
|
}
|
|
64339
64368
|
}
|
|
64340
64369
|
}
|
|
64341
|
-
adaptRanges(applyChange) {
|
|
64370
|
+
adaptRanges({ applyChange, adaptFormulaString }) {
|
|
64342
64371
|
for (const pivotId in this.pivots) {
|
|
64343
64372
|
const definition = deepCopy(this.pivots[pivotId]?.definition);
|
|
64344
64373
|
if (!definition) {
|
|
@@ -64351,22 +64380,22 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
64351
64380
|
this.history.update("pivots", pivotId, "definition", newDefinition);
|
|
64352
64381
|
}
|
|
64353
64382
|
}
|
|
64354
|
-
for (const
|
|
64355
|
-
for (const
|
|
64356
|
-
const
|
|
64357
|
-
|
|
64358
|
-
|
|
64359
|
-
const change = applyChange(range);
|
|
64360
|
-
if (change.changeType === "NONE") {
|
|
64361
|
-
newDependencies.push(range);
|
|
64362
|
-
}
|
|
64363
|
-
else {
|
|
64364
|
-
newDependencies.push(change.range);
|
|
64365
|
-
}
|
|
64383
|
+
for (const pivotId in this.compiledMeasureFormulas) {
|
|
64384
|
+
for (const measureId in this.compiledMeasureFormulas[pivotId]) {
|
|
64385
|
+
const measure = this.pivots[pivotId]?.definition.measures.find((m) => m.id === measureId);
|
|
64386
|
+
if (!measure || !measure.computedBy) {
|
|
64387
|
+
continue;
|
|
64366
64388
|
}
|
|
64367
|
-
const
|
|
64368
|
-
|
|
64369
|
-
|
|
64389
|
+
const sheetId = measure.computedBy.sheetId;
|
|
64390
|
+
const { formula: compiledFormula, dependencies: indirectDependencies } = this.compiledMeasureFormulas[pivotId][measureId];
|
|
64391
|
+
// adapt direct dependencies
|
|
64392
|
+
this.history.update("compiledMeasureFormulas", pivotId, measureId, "formula", "dependencies", compiledFormula.dependencies.map((range) => applyChange(range).range));
|
|
64393
|
+
// adapt all dependencies (including indirect)
|
|
64394
|
+
this.history.update("compiledMeasureFormulas", pivotId, measure.id, "dependencies", indirectDependencies.map((range) => applyChange(range).range));
|
|
64395
|
+
const oldFormulaString = measure.computedBy.formula;
|
|
64396
|
+
const newFormulaString = adaptFormulaString(sheetId, oldFormulaString);
|
|
64397
|
+
if (newFormulaString !== oldFormulaString) {
|
|
64398
|
+
this.replaceMeasureFormula(pivotId, measure, newFormulaString);
|
|
64370
64399
|
}
|
|
64371
64400
|
}
|
|
64372
64401
|
}
|
|
@@ -64404,30 +64433,59 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
64404
64433
|
isExistingPivot(pivotId) {
|
|
64405
64434
|
return pivotId in this.pivots;
|
|
64406
64435
|
}
|
|
64407
|
-
getMeasureCompiledFormula(measure) {
|
|
64436
|
+
getMeasureCompiledFormula(pivotId, measure) {
|
|
64437
|
+
if (!measure.computedBy) {
|
|
64438
|
+
throw new Error(`Measure ${measure.fieldName} is not computed by formula`);
|
|
64439
|
+
}
|
|
64440
|
+
return this.compiledMeasureFormulas[pivotId][measure.id].formula;
|
|
64441
|
+
}
|
|
64442
|
+
getMeasureFullDependencies(pivotId, measure) {
|
|
64408
64443
|
if (!measure.computedBy) {
|
|
64409
64444
|
throw new Error(`Measure ${measure.fieldName} is not computed by formula`);
|
|
64410
64445
|
}
|
|
64411
|
-
|
|
64412
|
-
return this.compiledMeasureFormulas[sheetId][measure.computedBy.formula];
|
|
64446
|
+
return this.compiledMeasureFormulas[pivotId][measure.id].dependencies;
|
|
64413
64447
|
}
|
|
64414
64448
|
// -------------------------------------------------------------------------
|
|
64415
64449
|
// Private
|
|
64416
64450
|
// -------------------------------------------------------------------------
|
|
64417
64451
|
addPivot(pivotId, pivot, formulaId = this.nextFormulaId.toString()) {
|
|
64418
64452
|
this.history.update("pivots", pivotId, { definition: deepCopy(pivot), formulaId });
|
|
64419
|
-
this.compileCalculatedMeasures(pivot.measures);
|
|
64453
|
+
this.compileCalculatedMeasures(pivotId, pivot.measures);
|
|
64420
64454
|
this.history.update("formulaIds", formulaId, pivotId);
|
|
64421
64455
|
this.history.update("nextFormulaId", this.nextFormulaId + 1);
|
|
64422
64456
|
}
|
|
64423
|
-
compileCalculatedMeasures(measures) {
|
|
64457
|
+
compileCalculatedMeasures(pivotId, measures) {
|
|
64424
64458
|
for (const measure of measures) {
|
|
64425
64459
|
if (measure.computedBy) {
|
|
64426
|
-
const sheetId = measure.computedBy.sheetId;
|
|
64427
64460
|
const compiledFormula = this.compileMeasureFormula(measure.computedBy.sheetId, measure.computedBy.formula);
|
|
64428
|
-
this.history.update("compiledMeasureFormulas",
|
|
64461
|
+
this.history.update("compiledMeasureFormulas", pivotId, measure.id, "formula", compiledFormula);
|
|
64429
64462
|
}
|
|
64430
64463
|
}
|
|
64464
|
+
for (const measure of measures) {
|
|
64465
|
+
if (measure.computedBy) {
|
|
64466
|
+
const dependencies = this.computeMeasureFullDependencies(pivotId, measure);
|
|
64467
|
+
this.history.update("compiledMeasureFormulas", pivotId, measure.id, "dependencies", dependencies);
|
|
64468
|
+
}
|
|
64469
|
+
}
|
|
64470
|
+
}
|
|
64471
|
+
computeMeasureFullDependencies(pivotId, measure, exploredMeasures = new Set()) {
|
|
64472
|
+
const rangeDependencies = [];
|
|
64473
|
+
const definition = this.getPivotCoreDefinition(pivotId);
|
|
64474
|
+
const formula = this.getMeasureCompiledFormula(pivotId, measure);
|
|
64475
|
+
exploredMeasures.add(measure.id);
|
|
64476
|
+
for (const token of formula.tokens) {
|
|
64477
|
+
if (token.type !== "SYMBOL") {
|
|
64478
|
+
continue;
|
|
64479
|
+
}
|
|
64480
|
+
const otherMeasure = definition.measures.find((measureCandidate) => getCanonicalSymbolName(measureCandidate.id) === token.value &&
|
|
64481
|
+
measure.id !== measureCandidate.id);
|
|
64482
|
+
if (!otherMeasure || exploredMeasures.has(otherMeasure.id) || !otherMeasure.computedBy) {
|
|
64483
|
+
continue;
|
|
64484
|
+
}
|
|
64485
|
+
rangeDependencies.push(...this.computeMeasureFullDependencies(pivotId, otherMeasure, exploredMeasures));
|
|
64486
|
+
}
|
|
64487
|
+
rangeDependencies.push(...formula.dependencies.filter((range) => !range.invalidXc));
|
|
64488
|
+
return rangeDependencies;
|
|
64431
64489
|
}
|
|
64432
64490
|
insertPivot(position, formulaId, table) {
|
|
64433
64491
|
this.resizeSheet(position.sheetId, position, table);
|
|
@@ -64487,21 +64545,16 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
64487
64545
|
dependencies: rangeDependencies,
|
|
64488
64546
|
};
|
|
64489
64547
|
}
|
|
64490
|
-
replaceMeasureFormula(
|
|
64491
|
-
|
|
64492
|
-
|
|
64493
|
-
|
|
64494
|
-
const pivot = this.pivots[pivotId];
|
|
64495
|
-
if (!pivot) {
|
|
64496
|
-
continue;
|
|
64497
|
-
}
|
|
64498
|
-
for (const measure of pivot.definition.measures) {
|
|
64499
|
-
if (measure.computedBy?.formula === formulaString) {
|
|
64500
|
-
const measureIndex = pivot.definition.measures.indexOf(measure);
|
|
64501
|
-
this.history.update("pivots", pivotId, "definition", "measures", measureIndex, "computedBy", { formula: newFormulaString, sheetId });
|
|
64502
|
-
}
|
|
64503
|
-
}
|
|
64548
|
+
replaceMeasureFormula(pivotId, measure, newFormulaString) {
|
|
64549
|
+
const pivot = this.pivots[pivotId];
|
|
64550
|
+
if (!pivot) {
|
|
64551
|
+
return;
|
|
64504
64552
|
}
|
|
64553
|
+
const measureIndex = pivot.definition.measures.indexOf(measure);
|
|
64554
|
+
this.history.update("pivots", pivotId, "definition", "measures", measureIndex, "computedBy", {
|
|
64555
|
+
formula: newFormulaString,
|
|
64556
|
+
sheetId: measure.computedBy.sheetId,
|
|
64557
|
+
});
|
|
64505
64558
|
}
|
|
64506
64559
|
checkSortedColumnInMeasures(definition) {
|
|
64507
64560
|
const measures = definition.measures.map((measure) => measure.id);
|
|
@@ -65883,11 +65936,16 @@ class SpreadingRelation {
|
|
|
65883
65936
|
return this.arrayFormulasToResults.get(formulasPosition);
|
|
65884
65937
|
}
|
|
65885
65938
|
/**
|
|
65886
|
-
* Remove a
|
|
65939
|
+
* Remove a spreading relation for a given array formula position
|
|
65940
|
+
* and its result zone
|
|
65887
65941
|
*/
|
|
65888
65942
|
removeNode(position) {
|
|
65943
|
+
const resultZone = this.arrayFormulasToResults.get(position);
|
|
65944
|
+
if (!resultZone) {
|
|
65945
|
+
return;
|
|
65946
|
+
}
|
|
65889
65947
|
this.resultsToArrayFormulas.remove({
|
|
65890
|
-
boundingBox: { sheetId: position.sheetId, zone:
|
|
65948
|
+
boundingBox: { sheetId: position.sheetId, zone: resultZone },
|
|
65891
65949
|
data: position,
|
|
65892
65950
|
});
|
|
65893
65951
|
this.arrayFormulasToResults.delete(position);
|
|
@@ -66175,6 +66233,10 @@ class Evaluator {
|
|
|
66175
66233
|
// empty matrix
|
|
66176
66234
|
return createEvaluatedCell({ value: 0 }, this.getters.getLocale(), cellData);
|
|
66177
66235
|
}
|
|
66236
|
+
if (nbRows === 1 && nbColumns === 1) {
|
|
66237
|
+
// single value matrix
|
|
66238
|
+
return createEvaluatedCell(nullValueToZeroValue(formulaReturn[0][0]), this.getters.getLocale(), cellData);
|
|
66239
|
+
}
|
|
66178
66240
|
const resultZone = {
|
|
66179
66241
|
top: formulaPosition.row,
|
|
66180
66242
|
bottom: formulaPosition.row + nbRows - 1,
|
|
@@ -67861,6 +67923,7 @@ class HeaderSizeUIPlugin extends CoreViewPlugin {
|
|
|
67861
67923
|
handle(cmd) {
|
|
67862
67924
|
switch (cmd.type) {
|
|
67863
67925
|
case "START":
|
|
67926
|
+
case "UPDATE_LOCALE":
|
|
67864
67927
|
for (const sheetId of this.getters.getSheetIds()) {
|
|
67865
67928
|
this.initializeSheet(sheetId);
|
|
67866
67929
|
}
|
|
@@ -67982,7 +68045,7 @@ class HeaderSizeUIPlugin extends CoreViewPlugin {
|
|
|
67982
68045
|
}
|
|
67983
68046
|
const cell = this.getters.getCell(position);
|
|
67984
68047
|
const colSize = this.getters.getColSize(position.sheetId, position.col);
|
|
67985
|
-
return getDefaultCellHeight(this.ctx, cell, colSize);
|
|
68048
|
+
return getDefaultCellHeight(this.ctx, cell, this.getters.getLocale(), colSize);
|
|
67986
68049
|
}
|
|
67987
68050
|
isInMultiRowMerge(position) {
|
|
67988
68051
|
const merge = this.getters.getMerge(position);
|
|
@@ -68029,14 +68092,16 @@ const PERCENT_FORMAT = "0.00%";
|
|
|
68029
68092
|
function withPivotPresentationLayer (PivotClass) {
|
|
68030
68093
|
class PivotPresentationLayer extends PivotClass {
|
|
68031
68094
|
getters;
|
|
68095
|
+
pivotId;
|
|
68032
68096
|
cache = {};
|
|
68033
68097
|
rankAsc = {};
|
|
68034
68098
|
rankDesc = {};
|
|
68035
68099
|
runningTotal = {};
|
|
68036
68100
|
runningTotalInPercent = {};
|
|
68037
|
-
constructor(custom, params) {
|
|
68101
|
+
constructor(pivotId, custom, params) {
|
|
68038
68102
|
super(custom, params);
|
|
68039
68103
|
this.getters = params.getters;
|
|
68104
|
+
this.pivotId = pivotId;
|
|
68040
68105
|
}
|
|
68041
68106
|
markAsDirtyForEvaluation() {
|
|
68042
68107
|
this.cache = {};
|
|
@@ -68086,7 +68151,7 @@ function withPivotPresentationLayer (PivotClass) {
|
|
|
68086
68151
|
return handleError(error, measure.aggregator.toUpperCase());
|
|
68087
68152
|
}
|
|
68088
68153
|
}
|
|
68089
|
-
const formula = this.getters.getMeasureCompiledFormula(measure);
|
|
68154
|
+
const formula = this.getters.getMeasureCompiledFormula(this.pivotId, measure);
|
|
68090
68155
|
const getSymbolValue = (symbolName) => {
|
|
68091
68156
|
const { columns, rows } = this.definition;
|
|
68092
68157
|
if (columns.find((col) => col.nameWithGranularity === symbolName)) {
|
|
@@ -68826,7 +68891,7 @@ class PivotUIPlugin extends CoreViewPlugin {
|
|
|
68826
68891
|
const definition = deepCopy(this.getters.getPivotCoreDefinition(pivotId));
|
|
68827
68892
|
if (!(pivotId in this.pivots)) {
|
|
68828
68893
|
const Pivot = withPivotPresentationLayer(pivotRegistry.get(definition.type).ui);
|
|
68829
|
-
this.pivots[pivotId] = new Pivot(this.custom, { definition, getters: this.getters });
|
|
68894
|
+
this.pivots[pivotId] = new Pivot(pivotId, this.custom, { definition, getters: this.getters });
|
|
68830
68895
|
}
|
|
68831
68896
|
else if (recreate) {
|
|
68832
68897
|
this.pivots[pivotId].onDefinitionChange(definition);
|
|
@@ -70289,7 +70354,7 @@ function addConditionalFormatCommandAdaptRange(cmd, applyChange) {
|
|
|
70289
70354
|
cmd.cf.rule = {
|
|
70290
70355
|
...rule,
|
|
70291
70356
|
rangeValues: rule.rangeValues
|
|
70292
|
-
? adaptStringRange(cmd.sheetId, rule.rangeValues, applyChange)
|
|
70357
|
+
? adaptStringRange(cmd.sheetId, rule.rangeValues, applyChange).range
|
|
70293
70358
|
: undefined,
|
|
70294
70359
|
};
|
|
70295
70360
|
}
|
|
@@ -83504,6 +83569,9 @@ function addStyles(styles) {
|
|
|
83504
83569
|
if (style.alignment && style.alignment.wrapText) {
|
|
83505
83570
|
alignAttrs.push(["wrapText", "1"]);
|
|
83506
83571
|
}
|
|
83572
|
+
if (style.alignment && style.alignment.shrinkToFit) {
|
|
83573
|
+
alignAttrs.push(["shrinkToFit", "1"]);
|
|
83574
|
+
}
|
|
83507
83575
|
if (alignAttrs.length > 0) {
|
|
83508
83576
|
attributes.push(["applyAlignment", "1"]); // for Libre Office
|
|
83509
83577
|
styleNodes.push(escapeXml /*xml*/ `<xf ${formatAttributes(attributes)}><alignment ${formatAttributes(alignAttrs)} /></xf> `);
|
|
@@ -84274,7 +84342,7 @@ class Model extends EventBus {
|
|
|
84274
84342
|
this.config = this.setupConfig(config);
|
|
84275
84343
|
this.session = this.setupSession(workbookData.revisionId);
|
|
84276
84344
|
this.coreGetters = {};
|
|
84277
|
-
this.range = new
|
|
84345
|
+
this.range = new RangeAdapterPlugin(this.coreGetters);
|
|
84278
84346
|
this.coreGetters.getRangeString = this.range.getRangeString.bind(this.range);
|
|
84279
84347
|
this.coreGetters.getRangeFromSheetXC = this.range.getRangeFromSheetXC.bind(this.range);
|
|
84280
84348
|
this.coreGetters.createAdaptedRanges = this.range.createAdaptedRanges.bind(this.range);
|
|
@@ -84288,8 +84356,6 @@ class Model extends EventBus {
|
|
|
84288
84356
|
this.coreGetters.extendRange = this.range.extendRange.bind(this.range);
|
|
84289
84357
|
this.coreGetters.getRangesUnion = this.range.getRangesUnion.bind(this.range);
|
|
84290
84358
|
this.coreGetters.removeRangesSheetPrefix = this.range.removeRangesSheetPrefix.bind(this.range);
|
|
84291
|
-
this.coreGetters.adaptFormulaStringDependencies =
|
|
84292
|
-
this.range.adaptFormulaStringDependencies.bind(this.range);
|
|
84293
84359
|
this.coreGetters.copyFormulaStringForSheet = this.range.copyFormulaStringForSheet.bind(this.range);
|
|
84294
84360
|
this.getters = {
|
|
84295
84361
|
isReadonly: () => this.config.mode === "readonly" || this.config.mode === "dashboard",
|
|
@@ -84964,6 +85030,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
|
|
|
84964
85030
|
export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, ClientDisconnectedError, CommandResult, CorePlugin, CoreViewPlugin, DispatchResult, EvaluationError, LocalTransportService, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, chartHelpers, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateChartEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
|
|
84965
85031
|
|
|
84966
85032
|
|
|
84967
|
-
__info__.version = "18.4.
|
|
84968
|
-
__info__.date = "2026-01-
|
|
84969
|
-
__info__.hash = "
|
|
85033
|
+
__info__.version = "18.4.25";
|
|
85034
|
+
__info__.date = "2026-01-21T11:06:11.131Z";
|
|
85035
|
+
__info__.hash = "161472d";
|