@odoo/o-spreadsheet 19.1.3 → 19.1.4
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-engine.d.ts +33 -27
- package/dist/o-spreadsheet-engine.esm.js +121 -101
- package/dist/o-spreadsheet-engine.iife.js +121 -101
- package/dist/o-spreadsheet-engine.min.iife.js +165 -165
- package/dist/o-spreadsheet.d.ts +39 -33
- package/dist/o_spreadsheet.css +3 -3
- package/dist/o_spreadsheet.esm.js +159 -144
- package/dist/o_spreadsheet.iife.js +159 -144
- package/dist/o_spreadsheet.min.iife.js +32 -32
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +1 -1
|
@@ -3,8 +3,8 @@
|
|
|
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
5
|
* @version 19.1.0-alpha.3
|
|
6
|
-
* @date 2026-01-
|
|
7
|
-
* @hash
|
|
6
|
+
* @date 2026-01-21T11:06:38.842Z
|
|
7
|
+
* @hash ceae12a
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports) {
|
|
@@ -2520,7 +2520,11 @@
|
|
|
2520
2520
|
if (operator === "<>" || operator === "=") {
|
|
2521
2521
|
let result;
|
|
2522
2522
|
if (typeof value === typeof operand) {
|
|
2523
|
-
if (
|
|
2523
|
+
if (value === "" && operand === "") {
|
|
2524
|
+
// fast path to avoid regex evaluation
|
|
2525
|
+
result = true;
|
|
2526
|
+
}
|
|
2527
|
+
else if (typeof value === "string" && typeof operand === "string") {
|
|
2524
2528
|
result = wildcardToRegExp(operand).test(value);
|
|
2525
2529
|
}
|
|
2526
2530
|
else {
|
|
@@ -2874,7 +2878,16 @@
|
|
|
2874
2878
|
}
|
|
2875
2879
|
acceptToVectorize.push(!argDefinition.acceptMatrix);
|
|
2876
2880
|
}
|
|
2877
|
-
return applyVectorization(errorHandlingCompute.bind(this), args, acceptToVectorize);
|
|
2881
|
+
return replaceErrorPlaceholderInResult(applyVectorization(errorHandlingCompute.bind(this), args, acceptToVectorize));
|
|
2882
|
+
}
|
|
2883
|
+
function replaceErrorPlaceholderInResult(result) {
|
|
2884
|
+
if (!isMatrix(result)) {
|
|
2885
|
+
replaceFunctionNamePlaceholder(result, descr.name);
|
|
2886
|
+
}
|
|
2887
|
+
else {
|
|
2888
|
+
matrixForEach(result, (result) => replaceFunctionNamePlaceholder(result, descr.name));
|
|
2889
|
+
}
|
|
2890
|
+
return result;
|
|
2878
2891
|
}
|
|
2879
2892
|
function errorHandlingCompute(...args) {
|
|
2880
2893
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -2903,13 +2916,12 @@
|
|
|
2903
2916
|
const result = descr.compute.apply(this, args);
|
|
2904
2917
|
if (!isMatrix(result)) {
|
|
2905
2918
|
if (typeof result === "object" && result !== null && "value" in result) {
|
|
2906
|
-
replaceFunctionNamePlaceholder(result, descr.name);
|
|
2907
2919
|
return result;
|
|
2908
2920
|
}
|
|
2921
|
+
descr.name;
|
|
2909
2922
|
return { value: result };
|
|
2910
2923
|
}
|
|
2911
2924
|
if (typeof result[0][0] === "object" && result[0][0] !== null && "value" in result[0][0]) {
|
|
2912
|
-
matrixForEach(result, (result) => replaceFunctionNamePlaceholder(result, descr.name));
|
|
2913
2925
|
return result;
|
|
2914
2926
|
}
|
|
2915
2927
|
return matrixMap(result, (row) => ({ value: row }));
|
|
@@ -18421,7 +18433,7 @@
|
|
|
18421
18433
|
const groups = groupConsecutive(elements);
|
|
18422
18434
|
return (range) => {
|
|
18423
18435
|
if (range.sheetId !== cmd.sheetId) {
|
|
18424
|
-
return { changeType: "NONE" };
|
|
18436
|
+
return { changeType: "NONE", range };
|
|
18425
18437
|
}
|
|
18426
18438
|
let newRange = range;
|
|
18427
18439
|
let changeType = "NONE";
|
|
@@ -18448,10 +18460,7 @@
|
|
|
18448
18460
|
newRange = createAdaptedRange(newRange, dimension, changeType, -(max - min + 1));
|
|
18449
18461
|
}
|
|
18450
18462
|
}
|
|
18451
|
-
|
|
18452
|
-
return { changeType, range: newRange };
|
|
18453
|
-
}
|
|
18454
|
-
return { changeType: "NONE" };
|
|
18463
|
+
return { changeType, range: newRange };
|
|
18455
18464
|
};
|
|
18456
18465
|
}
|
|
18457
18466
|
function getApplyRangeChangeAddColRow(cmd) {
|
|
@@ -18460,7 +18469,7 @@
|
|
|
18460
18469
|
const dimension = cmd.dimension === "COL" ? "columns" : "rows";
|
|
18461
18470
|
return (range) => {
|
|
18462
18471
|
if (range.sheetId !== cmd.sheetId) {
|
|
18463
|
-
return { changeType: "NONE" };
|
|
18472
|
+
return { changeType: "NONE", range };
|
|
18464
18473
|
}
|
|
18465
18474
|
if (cmd.position === "after") {
|
|
18466
18475
|
if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) {
|
|
@@ -18490,13 +18499,13 @@
|
|
|
18490
18499
|
};
|
|
18491
18500
|
}
|
|
18492
18501
|
}
|
|
18493
|
-
return { changeType: "NONE" };
|
|
18502
|
+
return { changeType: "NONE", range };
|
|
18494
18503
|
};
|
|
18495
18504
|
}
|
|
18496
18505
|
function getApplyRangeChangeDeleteSheet(cmd) {
|
|
18497
18506
|
return (range) => {
|
|
18498
18507
|
if (range.sheetId !== cmd.sheetId && range.invalidSheetName !== cmd.sheetName) {
|
|
18499
|
-
return { changeType: "NONE" };
|
|
18508
|
+
return { changeType: "NONE", range };
|
|
18500
18509
|
}
|
|
18501
18510
|
const invalidSheetName = cmd.sheetName;
|
|
18502
18511
|
range = {
|
|
@@ -18523,14 +18532,14 @@
|
|
|
18523
18532
|
const newRange = { ...range, sheetId, invalidSheetName };
|
|
18524
18533
|
return { changeType: "CHANGE", range: newRange };
|
|
18525
18534
|
}
|
|
18526
|
-
return { changeType: "NONE" };
|
|
18535
|
+
return { changeType: "NONE", range };
|
|
18527
18536
|
};
|
|
18528
18537
|
}
|
|
18529
18538
|
function getApplyRangeChangeMoveRange(cmd) {
|
|
18530
18539
|
const originZone = cmd.target[0];
|
|
18531
18540
|
return (range) => {
|
|
18532
18541
|
if (range.sheetId !== cmd.sheetId || !isZoneInside(range.zone, originZone)) {
|
|
18533
|
-
return { changeType: "NONE" };
|
|
18542
|
+
return { changeType: "NONE", range };
|
|
18534
18543
|
}
|
|
18535
18544
|
const targetSheetId = cmd.targetSheetId;
|
|
18536
18545
|
const offsetX = cmd.col - originZone.left;
|
|
@@ -20062,7 +20071,7 @@
|
|
|
20062
20071
|
continue;
|
|
20063
20072
|
}
|
|
20064
20073
|
const sheetXC = tokens[tokenIdx].value;
|
|
20065
|
-
const newSheetXC = adaptStringRange(defaultSheetId, sheetXC, applyChange);
|
|
20074
|
+
const newSheetXC = adaptStringRange(defaultSheetId, sheetXC, applyChange).range;
|
|
20066
20075
|
if (sheetXC !== newSheetXC) {
|
|
20067
20076
|
tokens[tokenIdx] = {
|
|
20068
20077
|
value: newSheetXC,
|
|
@@ -20072,23 +20081,30 @@
|
|
|
20072
20081
|
}
|
|
20073
20082
|
return concat(tokens.map((token) => token.value));
|
|
20074
20083
|
}
|
|
20075
|
-
function adaptStringRange(defaultSheetId, sheetXC,
|
|
20084
|
+
function adaptStringRange(defaultSheetId, sheetXC, rangeAdapter) {
|
|
20076
20085
|
const sheetName = splitReference(sheetXC).sheetName;
|
|
20077
20086
|
if (sheetName
|
|
20078
|
-
? !isSheetNameEqual(sheetName,
|
|
20079
|
-
: defaultSheetId !==
|
|
20080
|
-
return sheetXC;
|
|
20087
|
+
? !isSheetNameEqual(sheetName, rangeAdapter.sheetName.old)
|
|
20088
|
+
: defaultSheetId !== rangeAdapter.sheetId) {
|
|
20089
|
+
return { changeType: "NONE", range: sheetXC };
|
|
20081
20090
|
}
|
|
20082
|
-
const sheetId = sheetName ?
|
|
20091
|
+
const sheetId = sheetName ? rangeAdapter.sheetId : defaultSheetId;
|
|
20083
20092
|
const range = getRange(sheetXC, sheetId);
|
|
20084
20093
|
if (range.invalidXc) {
|
|
20085
|
-
return sheetXC;
|
|
20094
|
+
return { changeType: "NONE", range: sheetXC };
|
|
20086
20095
|
}
|
|
20087
|
-
const change =
|
|
20096
|
+
const change = rangeAdapter.applyChange(range);
|
|
20088
20097
|
if (change.changeType === "NONE" || change.changeType === "REMOVE") {
|
|
20089
|
-
return sheetXC;
|
|
20098
|
+
return { changeType: change.changeType, range: sheetXC };
|
|
20090
20099
|
}
|
|
20091
|
-
|
|
20100
|
+
const rangeStr = getRangeString(change.range, defaultSheetId, getSheetNameGetter(rangeAdapter));
|
|
20101
|
+
if (rangeStr === CellErrorType.InvalidReference) {
|
|
20102
|
+
return { changeType: "REMOVE", range: rangeStr };
|
|
20103
|
+
}
|
|
20104
|
+
return {
|
|
20105
|
+
changeType: change.changeType,
|
|
20106
|
+
range: rangeStr,
|
|
20107
|
+
};
|
|
20092
20108
|
}
|
|
20093
20109
|
function getSheetNameGetter(applyChange) {
|
|
20094
20110
|
return (sheetId) => {
|
|
@@ -20303,7 +20319,7 @@
|
|
|
20303
20319
|
cmd.cf.rule = {
|
|
20304
20320
|
...rule,
|
|
20305
20321
|
rangeValues: rule.rangeValues
|
|
20306
|
-
? adaptStringRange(cmd.sheetId, rule.rangeValues, applyChange)
|
|
20322
|
+
? adaptStringRange(cmd.sheetId, rule.rangeValues, applyChange).range
|
|
20307
20323
|
: undefined,
|
|
20308
20324
|
};
|
|
20309
20325
|
}
|
|
@@ -22965,6 +22981,7 @@
|
|
|
22965
22981
|
: undefined,
|
|
22966
22982
|
wrapText: style.wrapping === "wrap" || content?.includes(NEWLINE) ? true : undefined,
|
|
22967
22983
|
textRotation: style.rotation ? rotationToXLSX(style.rotation) : undefined,
|
|
22984
|
+
shrinkToFit: style.wrapping === "clip" ? true : undefined,
|
|
22968
22985
|
},
|
|
22969
22986
|
};
|
|
22970
22987
|
styles.font["strike"] = !!style?.strikethrough || undefined;
|
|
@@ -23009,6 +23026,7 @@
|
|
|
23009
23026
|
horizontal: styles.alignment.horizontal,
|
|
23010
23027
|
wrapText: styles.alignment.wrapText,
|
|
23011
23028
|
textRotation: styles.alignment.textRotation,
|
|
23029
|
+
shrinkToFit: styles.alignment.shrinkToFit,
|
|
23012
23030
|
},
|
|
23013
23031
|
};
|
|
23014
23032
|
return pushElement(style, construct.styles);
|
|
@@ -27573,7 +27591,7 @@
|
|
|
27573
27591
|
* @param sheetId an sheetId to adapt either range of that sheet specifically, or ranges pointing to that sheet
|
|
27574
27592
|
* @param sheetName couple of old and new sheet names to adapt ranges pointing to that sheet
|
|
27575
27593
|
*/
|
|
27576
|
-
adaptRanges(
|
|
27594
|
+
adaptRanges(rangeAdapterFunctions, sheetId, sheetName) { }
|
|
27577
27595
|
}
|
|
27578
27596
|
|
|
27579
27597
|
class BordersPlugin extends CorePlugin {
|
|
@@ -27647,7 +27665,7 @@
|
|
|
27647
27665
|
}
|
|
27648
27666
|
}
|
|
27649
27667
|
}
|
|
27650
|
-
adaptRanges(applyChange, sheetId) {
|
|
27668
|
+
adaptRanges({ applyChange }, sheetId) {
|
|
27651
27669
|
const newBorders = [];
|
|
27652
27670
|
for (const border of this.borders[sheetId] ?? []) {
|
|
27653
27671
|
const change = applyChange(this.getters.getRangeFromZone(sheetId, border.zone));
|
|
@@ -28128,7 +28146,7 @@
|
|
|
28128
28146
|
];
|
|
28129
28147
|
nextId = 1;
|
|
28130
28148
|
cells = {};
|
|
28131
|
-
adaptRanges(applyChange, sheetId, sheetName) {
|
|
28149
|
+
adaptRanges({ applyChange }, sheetId, sheetName) {
|
|
28132
28150
|
for (const sheet of Object.keys(this.cells)) {
|
|
28133
28151
|
for (const cell of Object.values(this.cells[sheet] || {})) {
|
|
28134
28152
|
if (cell.isFormula) {
|
|
@@ -28689,12 +28707,12 @@
|
|
|
28689
28707
|
charts = {};
|
|
28690
28708
|
createChart = chartFactory(this.getters);
|
|
28691
28709
|
validateChartDefinition = (cmd) => validateChartDefinition(this, cmd.definition);
|
|
28692
|
-
adaptRanges(
|
|
28710
|
+
adaptRanges(rangeAdapters) {
|
|
28693
28711
|
for (const [chartId, chart] of Object.entries(this.charts)) {
|
|
28694
28712
|
if (!chart) {
|
|
28695
28713
|
continue;
|
|
28696
28714
|
}
|
|
28697
|
-
const newChart = chart.chart.updateRanges(
|
|
28715
|
+
const newChart = chart.chart.updateRanges(rangeAdapters);
|
|
28698
28716
|
this.history.update("charts", chartId, newChart ? { figureId: chart.figureId, chart: newChart } : undefined);
|
|
28699
28717
|
}
|
|
28700
28718
|
}
|
|
@@ -29515,7 +29533,7 @@
|
|
|
29515
29533
|
"getAdaptedCfRanges",
|
|
29516
29534
|
];
|
|
29517
29535
|
cfRules = {};
|
|
29518
|
-
adaptCFFormulas(applyChange) {
|
|
29536
|
+
adaptCFFormulas({ applyChange, adaptFormulaString }) {
|
|
29519
29537
|
for (const sheetId in this.cfRules) {
|
|
29520
29538
|
for (const rule of this.cfRules[sheetId]) {
|
|
29521
29539
|
if (rule.rule.type === "DataBarRule" && rule.rule.rangeValues) {
|
|
@@ -29539,7 +29557,7 @@
|
|
|
29539
29557
|
for (let i = 0; i < rule.rule.values.length; i++) {
|
|
29540
29558
|
this.history.update("cfRules", sheetId, this.cfRules[sheetId].indexOf(rule), "rule",
|
|
29541
29559
|
//@ts-expect-error
|
|
29542
|
-
"values", i,
|
|
29560
|
+
"values", i, adaptFormulaString(sheetId, rule.rule.values[i]));
|
|
29543
29561
|
}
|
|
29544
29562
|
}
|
|
29545
29563
|
else if (rule.rule.type === "IconSetRule") {
|
|
@@ -29547,7 +29565,7 @@
|
|
|
29547
29565
|
if (rule.rule[inflectionPoint].type === "formula") {
|
|
29548
29566
|
this.history.update("cfRules", sheetId, this.cfRules[sheetId].indexOf(rule), "rule",
|
|
29549
29567
|
//@ts-expect-error
|
|
29550
|
-
inflectionPoint, "value",
|
|
29568
|
+
inflectionPoint, "value", adaptFormulaString(sheetId, rule.rule[inflectionPoint].value));
|
|
29551
29569
|
}
|
|
29552
29570
|
}
|
|
29553
29571
|
}
|
|
@@ -29557,14 +29575,14 @@
|
|
|
29557
29575
|
if (ruleValue?.type === "formula" && ruleValue?.value) {
|
|
29558
29576
|
this.history.update("cfRules", sheetId, this.cfRules[sheetId].indexOf(rule), "rule",
|
|
29559
29577
|
//@ts-expect-error
|
|
29560
|
-
value, "value",
|
|
29578
|
+
value, "value", adaptFormulaString(sheetId, ruleValue.value));
|
|
29561
29579
|
}
|
|
29562
29580
|
}
|
|
29563
29581
|
}
|
|
29564
29582
|
}
|
|
29565
29583
|
}
|
|
29566
29584
|
}
|
|
29567
|
-
adaptCFRanges(sheetId, applyChange) {
|
|
29585
|
+
adaptCFRanges(sheetId, { applyChange }) {
|
|
29568
29586
|
for (const rule of this.cfRules[sheetId]) {
|
|
29569
29587
|
for (const range of rule.ranges) {
|
|
29570
29588
|
const change = applyChange(range);
|
|
@@ -29588,12 +29606,12 @@
|
|
|
29588
29606
|
}
|
|
29589
29607
|
}
|
|
29590
29608
|
}
|
|
29591
|
-
adaptRanges(
|
|
29609
|
+
adaptRanges(rangeAdapters, sheetId) {
|
|
29592
29610
|
const sheetIds = sheetId ? [sheetId] : Object.keys(this.cfRules);
|
|
29593
29611
|
for (const sheetId of sheetIds) {
|
|
29594
|
-
this.adaptCFRanges(sheetId,
|
|
29612
|
+
this.adaptCFRanges(sheetId, rangeAdapters);
|
|
29595
29613
|
}
|
|
29596
|
-
this.adaptCFFormulas(
|
|
29614
|
+
this.adaptCFFormulas(rangeAdapters);
|
|
29597
29615
|
}
|
|
29598
29616
|
// ---------------------------------------------------------------------------
|
|
29599
29617
|
// Command Handling
|
|
@@ -29970,23 +29988,23 @@
|
|
|
29970
29988
|
"getValidationRuleForCell",
|
|
29971
29989
|
];
|
|
29972
29990
|
rules = {};
|
|
29973
|
-
adaptRanges(
|
|
29974
|
-
this.adaptDVRanges(sheetId,
|
|
29975
|
-
this.adaptDVFormulas(
|
|
29991
|
+
adaptRanges(rangeAdapters, sheetId) {
|
|
29992
|
+
this.adaptDVRanges(sheetId, rangeAdapters);
|
|
29993
|
+
this.adaptDVFormulas(rangeAdapters);
|
|
29976
29994
|
}
|
|
29977
|
-
adaptDVFormulas(
|
|
29995
|
+
adaptDVFormulas({ adaptFormulaString }) {
|
|
29978
29996
|
for (const sheetId in this.rules) {
|
|
29979
29997
|
const rules = this.rules[sheetId];
|
|
29980
29998
|
for (let ruleIndex = rules.length - 1; ruleIndex >= 0; ruleIndex--) {
|
|
29981
29999
|
const rule = this.rules[sheetId][ruleIndex];
|
|
29982
30000
|
for (let valueIndex = 0; valueIndex < rule.criterion.values.length; valueIndex++) {
|
|
29983
|
-
const value =
|
|
30001
|
+
const value = adaptFormulaString(sheetId, rule.criterion.values[valueIndex]);
|
|
29984
30002
|
this.history.update("rules", sheetId, ruleIndex, "criterion", "values", valueIndex, value);
|
|
29985
30003
|
}
|
|
29986
30004
|
}
|
|
29987
30005
|
}
|
|
29988
30006
|
}
|
|
29989
|
-
adaptDVRanges(sheetId, applyChange) {
|
|
30007
|
+
adaptDVRanges(sheetId, { applyChange }) {
|
|
29990
30008
|
const rules = this.rules[sheetId];
|
|
29991
30009
|
for (let ruleIndex = rules.length - 1; ruleIndex >= 0; ruleIndex--) {
|
|
29992
30010
|
const rule = this.rules[sheetId][ruleIndex];
|
|
@@ -30260,7 +30278,7 @@
|
|
|
30260
30278
|
// ---------------------------------------------------------------------------
|
|
30261
30279
|
// Command Handling
|
|
30262
30280
|
// ---------------------------------------------------------------------------
|
|
30263
|
-
adaptRanges(applyChange, sheetId) {
|
|
30281
|
+
adaptRanges({ applyChange }, sheetId) {
|
|
30264
30282
|
for (const figure of this.getFigures(sheetId)) {
|
|
30265
30283
|
const change = applyChange(this.getters.getRangeFromZone(sheetId, {
|
|
30266
30284
|
left: figure.col,
|
|
@@ -31500,8 +31518,8 @@
|
|
|
31500
31518
|
break;
|
|
31501
31519
|
}
|
|
31502
31520
|
}
|
|
31503
|
-
adaptRanges(
|
|
31504
|
-
this.applyRangeChangeOnSheet(sheetId,
|
|
31521
|
+
adaptRanges(rangeAdapters, sheetId) {
|
|
31522
|
+
this.applyRangeChangeOnSheet(sheetId, rangeAdapters);
|
|
31505
31523
|
}
|
|
31506
31524
|
// ---------------------------------------------------------------------------
|
|
31507
31525
|
// Getters
|
|
@@ -31801,7 +31819,7 @@
|
|
|
31801
31819
|
/**
|
|
31802
31820
|
* Apply a range change on merges of a particular sheet.
|
|
31803
31821
|
*/
|
|
31804
|
-
applyRangeChangeOnSheet(sheetId, applyChange) {
|
|
31822
|
+
applyRangeChangeOnSheet(sheetId, { applyChange }) {
|
|
31805
31823
|
const merges = Object.entries(this.merges[sheetId] || {});
|
|
31806
31824
|
for (const [mergeId, range] of merges) {
|
|
31807
31825
|
if (range) {
|
|
@@ -33420,8 +33438,6 @@
|
|
|
33420
33438
|
}
|
|
33421
33439
|
const change = applyChange(range);
|
|
33422
33440
|
switch (change.changeType) {
|
|
33423
|
-
case "NONE":
|
|
33424
|
-
return range;
|
|
33425
33441
|
case "REMOVE":
|
|
33426
33442
|
return undefined;
|
|
33427
33443
|
default:
|
|
@@ -33530,7 +33546,7 @@
|
|
|
33530
33546
|
}
|
|
33531
33547
|
}
|
|
33532
33548
|
}
|
|
33533
|
-
adaptRanges(applyChange) {
|
|
33549
|
+
adaptRanges({ applyChange, adaptFormulaString }) {
|
|
33534
33550
|
for (const pivotId in this.pivots) {
|
|
33535
33551
|
const definition = deepCopy(this.pivots[pivotId]?.definition);
|
|
33536
33552
|
if (!definition) {
|
|
@@ -33550,19 +33566,13 @@
|
|
|
33550
33566
|
continue;
|
|
33551
33567
|
}
|
|
33552
33568
|
const sheetId = measure.computedBy.sheetId;
|
|
33553
|
-
const compiledFormula = this.compiledMeasureFormulas[pivotId][measureId]
|
|
33554
|
-
|
|
33555
|
-
|
|
33556
|
-
|
|
33557
|
-
|
|
33558
|
-
newDependencies.push(range);
|
|
33559
|
-
}
|
|
33560
|
-
else {
|
|
33561
|
-
newDependencies.push(change.range);
|
|
33562
|
-
}
|
|
33563
|
-
}
|
|
33564
|
-
const newFormulaString = this.getters.getFormulaString(sheetId, compiledFormula.tokens, newDependencies);
|
|
33569
|
+
const { formula: compiledFormula, dependencies: indirectDependencies } = this.compiledMeasureFormulas[pivotId][measureId];
|
|
33570
|
+
// adapt direct dependencies
|
|
33571
|
+
this.history.update("compiledMeasureFormulas", pivotId, measureId, "formula", "dependencies", compiledFormula.dependencies.map((range) => applyChange(range).range));
|
|
33572
|
+
// adapt all dependencies (including indirect)
|
|
33573
|
+
this.history.update("compiledMeasureFormulas", pivotId, measure.id, "dependencies", indirectDependencies.map((range) => applyChange(range).range));
|
|
33565
33574
|
const oldFormulaString = measure.computedBy.formula;
|
|
33575
|
+
const newFormulaString = adaptFormulaString(sheetId, oldFormulaString);
|
|
33566
33576
|
if (newFormulaString !== oldFormulaString) {
|
|
33567
33577
|
this.replaceMeasureFormula(pivotId, measure, newFormulaString);
|
|
33568
33578
|
}
|
|
@@ -33724,7 +33734,6 @@
|
|
|
33724
33734
|
formula: newFormulaString,
|
|
33725
33735
|
sheetId: measure.computedBy.sheetId,
|
|
33726
33736
|
});
|
|
33727
|
-
this.compileCalculatedMeasures(pivotId, pivot.definition.measures);
|
|
33728
33737
|
}
|
|
33729
33738
|
checkSortedColumnInMeasures(definition) {
|
|
33730
33739
|
const measures = definition.measures.map((measure) => measure.id);
|
|
@@ -34811,7 +34820,7 @@
|
|
|
34811
34820
|
break;
|
|
34812
34821
|
}
|
|
34813
34822
|
}
|
|
34814
|
-
adaptRanges(applyChange, sheetId) {
|
|
34823
|
+
adaptRanges({ applyChange }, sheetId) {
|
|
34815
34824
|
const newStyles = [];
|
|
34816
34825
|
for (const style of this.styles[sheetId] ?? []) {
|
|
34817
34826
|
const change = applyChange(this.getters.getRangeFromZone(sheetId, style.zone));
|
|
@@ -35317,7 +35326,7 @@
|
|
|
35317
35326
|
static getters = ["getCoreTable", "getCoreTables", "getCoreTableMatchingTopLeft"];
|
|
35318
35327
|
tables = {};
|
|
35319
35328
|
nextTableId = 1;
|
|
35320
|
-
adaptRanges(applyChange, sheetId) {
|
|
35329
|
+
adaptRanges({ applyChange }, sheetId) {
|
|
35321
35330
|
for (const table of this.getCoreTables(sheetId)) {
|
|
35322
35331
|
this.applyRangeChangeOnTable(sheetId, table, applyChange);
|
|
35323
35332
|
}
|
|
@@ -37183,11 +37192,16 @@
|
|
|
37183
37192
|
return this.arrayFormulasToResults.get(formulasPosition);
|
|
37184
37193
|
}
|
|
37185
37194
|
/**
|
|
37186
|
-
* Remove a
|
|
37195
|
+
* Remove a spreading relation for a given array formula position
|
|
37196
|
+
* and its result zone
|
|
37187
37197
|
*/
|
|
37188
37198
|
removeNode(position) {
|
|
37199
|
+
const resultZone = this.arrayFormulasToResults.get(position);
|
|
37200
|
+
if (!resultZone) {
|
|
37201
|
+
return;
|
|
37202
|
+
}
|
|
37189
37203
|
this.resultsToArrayFormulas.remove({
|
|
37190
|
-
boundingBox: { sheetId: position.sheetId, zone:
|
|
37204
|
+
boundingBox: { sheetId: position.sheetId, zone: resultZone },
|
|
37191
37205
|
data: position,
|
|
37192
37206
|
});
|
|
37193
37207
|
this.arrayFormulasToResults.delete(position);
|
|
@@ -37514,6 +37528,10 @@
|
|
|
37514
37528
|
// empty matrix
|
|
37515
37529
|
return createEvaluatedCell({ value: 0 }, this.getters.getLocale(), cellData);
|
|
37516
37530
|
}
|
|
37531
|
+
if (nbRows === 1 && nbColumns === 1) {
|
|
37532
|
+
// single value matrix
|
|
37533
|
+
return createEvaluatedCell(validateNumberValue(formulaReturn[0][0]), this.getters.getLocale(), cellData);
|
|
37534
|
+
}
|
|
37517
37535
|
const resultZone = {
|
|
37518
37536
|
top: formulaPosition.row,
|
|
37519
37537
|
bottom: formulaPosition.row + nbRows - 1,
|
|
@@ -38029,11 +38047,20 @@
|
|
|
38029
38047
|
/**
|
|
38030
38048
|
* Get the default height of the cell given its style.
|
|
38031
38049
|
*/
|
|
38032
|
-
function getDefaultCellHeight(ctx, cell, style, colSize) {
|
|
38050
|
+
function getDefaultCellHeight(ctx, cell, style, locale, colSize) {
|
|
38033
38051
|
if (!cell || (!cell.isFormula && !cell.content)) {
|
|
38034
38052
|
return DEFAULT_CELL_HEIGHT;
|
|
38035
38053
|
}
|
|
38036
|
-
|
|
38054
|
+
let content = "";
|
|
38055
|
+
try {
|
|
38056
|
+
if (!cell.isFormula) {
|
|
38057
|
+
const localeFormat = { format: cell.format, locale };
|
|
38058
|
+
content = formatValue(parseLiteral(cell.content, locale), localeFormat);
|
|
38059
|
+
}
|
|
38060
|
+
}
|
|
38061
|
+
catch {
|
|
38062
|
+
content = CellErrorType.GenericError;
|
|
38063
|
+
}
|
|
38037
38064
|
return getCellContentHeight(ctx, content, style, colSize);
|
|
38038
38065
|
}
|
|
38039
38066
|
function getCellContentHeight(ctx, content, style, colSize) {
|
|
@@ -39612,15 +39639,15 @@
|
|
|
39612
39639
|
if (!extensionsLoaded) {
|
|
39613
39640
|
registerChartJSExtensions();
|
|
39614
39641
|
}
|
|
39615
|
-
|
|
39616
|
-
|
|
39642
|
+
const config = deepCopy(runtime.chartJsConfig);
|
|
39643
|
+
config.plugins = [backgroundColorChartJSPlugin];
|
|
39644
|
+
if (!globalThis.Chart.registry.controllers.get(config.type)) {
|
|
39645
|
+
console.log(`Chart of type "${config.type}" is not registered in Chart.js library.`);
|
|
39617
39646
|
if (!extensionsLoaded) {
|
|
39618
39647
|
unregisterChartJsExtensions();
|
|
39619
39648
|
}
|
|
39620
39649
|
return imageUrl;
|
|
39621
39650
|
}
|
|
39622
|
-
const config = deepCopy(runtime.chartJsConfig);
|
|
39623
|
-
config.plugins = [backgroundColorChartJSPlugin];
|
|
39624
39651
|
const chart = new globalThis.Chart(canvas, config);
|
|
39625
39652
|
try {
|
|
39626
39653
|
imageUrl = await canvasToObjectUrl(canvas);
|
|
@@ -40286,6 +40313,7 @@
|
|
|
40286
40313
|
handle(cmd) {
|
|
40287
40314
|
switch (cmd.type) {
|
|
40288
40315
|
case "START":
|
|
40316
|
+
case "UPDATE_LOCALE":
|
|
40289
40317
|
for (const sheetId of this.getters.getSheetIds()) {
|
|
40290
40318
|
this.initializeSheet(sheetId);
|
|
40291
40319
|
}
|
|
@@ -40423,7 +40451,7 @@
|
|
|
40423
40451
|
const cell = this.getters.getCell(position);
|
|
40424
40452
|
const style = this.getters.getCellStyle(position);
|
|
40425
40453
|
const colSize = this.getters.getColSize(position.sheetId, position.col);
|
|
40426
|
-
return getDefaultCellHeight(this.ctx, cell, style, colSize);
|
|
40454
|
+
return getDefaultCellHeight(this.ctx, cell, style, this.getters.getLocale(), colSize);
|
|
40427
40455
|
}
|
|
40428
40456
|
isInMultiRowMerge(position) {
|
|
40429
40457
|
const merge = this.getters.getMerge(position);
|
|
@@ -47666,7 +47694,7 @@
|
|
|
47666
47694
|
.add("pivot_ui", PivotUIPlugin)
|
|
47667
47695
|
.add("cell_icon", CellIconPlugin);
|
|
47668
47696
|
|
|
47669
|
-
class
|
|
47697
|
+
class RangeAdapterPlugin {
|
|
47670
47698
|
getters;
|
|
47671
47699
|
providers = [];
|
|
47672
47700
|
isAdaptingRanges = false;
|
|
@@ -47674,7 +47702,6 @@
|
|
|
47674
47702
|
this.getters = getters;
|
|
47675
47703
|
}
|
|
47676
47704
|
static getters = [
|
|
47677
|
-
"adaptFormulaStringDependencies",
|
|
47678
47705
|
"copyFormulaStringForSheet",
|
|
47679
47706
|
"extendRange",
|
|
47680
47707
|
"getRangeString",
|
|
@@ -47705,8 +47732,8 @@
|
|
|
47705
47732
|
throw new Error("Plugins cannot dispatch commands during adaptRanges phase");
|
|
47706
47733
|
}
|
|
47707
47734
|
const rangeAdapter = getRangeAdapter(cmd);
|
|
47708
|
-
if (rangeAdapter
|
|
47709
|
-
this.executeOnAllRanges(rangeAdapter
|
|
47735
|
+
if (rangeAdapter) {
|
|
47736
|
+
this.executeOnAllRanges(rangeAdapter);
|
|
47710
47737
|
}
|
|
47711
47738
|
}
|
|
47712
47739
|
finalize() { }
|
|
@@ -47725,11 +47752,15 @@
|
|
|
47725
47752
|
return result;
|
|
47726
47753
|
};
|
|
47727
47754
|
}
|
|
47728
|
-
executeOnAllRanges(
|
|
47755
|
+
executeOnAllRanges(rangeAdapter) {
|
|
47729
47756
|
this.isAdaptingRanges = true;
|
|
47730
|
-
const
|
|
47757
|
+
const adapterFunctions = {
|
|
47758
|
+
applyChange: this.verifyRangeRemoved(rangeAdapter.applyChange),
|
|
47759
|
+
adaptRangeString: (defaultSheetId, sheetXC) => adaptStringRange(defaultSheetId, sheetXC, rangeAdapter),
|
|
47760
|
+
adaptFormulaString: (defaultSheetId, formula) => adaptFormulaStringRanges(defaultSheetId, formula, rangeAdapter),
|
|
47761
|
+
};
|
|
47731
47762
|
for (const provider of this.providers) {
|
|
47732
|
-
provider(
|
|
47763
|
+
provider(adapterFunctions, rangeAdapter.sheetId, rangeAdapter.sheetName);
|
|
47733
47764
|
}
|
|
47734
47765
|
this.isAdaptingRanges = false;
|
|
47735
47766
|
}
|
|
@@ -47897,18 +47928,6 @@
|
|
|
47897
47928
|
const unionOfZones = unionUnboundedZones(...zones);
|
|
47898
47929
|
return this.getRangeFromZone(ranges[0].sheetId, unionOfZones);
|
|
47899
47930
|
}
|
|
47900
|
-
adaptFormulaStringDependencies(sheetId, formula, applyChange) {
|
|
47901
|
-
if (!formula.startsWith("=")) {
|
|
47902
|
-
return formula;
|
|
47903
|
-
}
|
|
47904
|
-
const compiledFormula = compile(formula);
|
|
47905
|
-
const updatedDependencies = compiledFormula.dependencies.map((dep) => {
|
|
47906
|
-
const range = this.getters.getRangeFromSheetXC(sheetId, dep);
|
|
47907
|
-
const changedRange = applyChange(range);
|
|
47908
|
-
return changedRange.changeType === "NONE" ? range : changedRange.range;
|
|
47909
|
-
});
|
|
47910
|
-
return this.getters.getFormulaString(sheetId, compiledFormula.tokens, updatedDependencies);
|
|
47911
|
-
}
|
|
47912
47931
|
/**
|
|
47913
47932
|
* Copy a formula string to another sheet.
|
|
47914
47933
|
*
|
|
@@ -50353,6 +50372,9 @@
|
|
|
50353
50372
|
if (style.alignment && style.alignment.textRotation) {
|
|
50354
50373
|
alignAttrs.push(["textRotation", style.alignment.textRotation]);
|
|
50355
50374
|
}
|
|
50375
|
+
if (style.alignment && style.alignment.shrinkToFit) {
|
|
50376
|
+
alignAttrs.push(["shrinkToFit", "1"]);
|
|
50377
|
+
}
|
|
50356
50378
|
if (alignAttrs.length > 0) {
|
|
50357
50379
|
attributes.push(["applyAlignment", "1"]); // for Libre Office
|
|
50358
50380
|
styleNodes.push(escapeXml /*xml*/ `<xf ${formatAttributes(attributes)}><alignment ${formatAttributes(alignAttrs)} /></xf> `);
|
|
@@ -51147,7 +51169,7 @@
|
|
|
51147
51169
|
this.config = this.setupConfig(config);
|
|
51148
51170
|
this.session = this.setupSession(workbookData.revisionId);
|
|
51149
51171
|
this.coreGetters = {};
|
|
51150
|
-
this.range = new
|
|
51172
|
+
this.range = new RangeAdapterPlugin(this.coreGetters);
|
|
51151
51173
|
this.coreGetters.getRangeString = this.range.getRangeString.bind(this.range);
|
|
51152
51174
|
this.coreGetters.getRangeFromSheetXC = this.range.getRangeFromSheetXC.bind(this.range);
|
|
51153
51175
|
this.coreGetters.createAdaptedRanges = this.range.createAdaptedRanges.bind(this.range);
|
|
@@ -51161,8 +51183,6 @@
|
|
|
51161
51183
|
this.coreGetters.extendRange = this.range.extendRange.bind(this.range);
|
|
51162
51184
|
this.coreGetters.getRangesUnion = this.range.getRangesUnion.bind(this.range);
|
|
51163
51185
|
this.coreGetters.removeRangesSheetPrefix = this.range.removeRangesSheetPrefix.bind(this.range);
|
|
51164
|
-
this.coreGetters.adaptFormulaStringDependencies =
|
|
51165
|
-
this.range.adaptFormulaStringDependencies.bind(this.range);
|
|
51166
51186
|
this.coreGetters.copyFormulaStringForSheet = this.range.copyFormulaStringForSheet.bind(this.range);
|
|
51167
51187
|
this.getters = {
|
|
51168
51188
|
isReadonly: () => this.config.mode === "readonly" || this.config.mode === "dashboard",
|
|
@@ -51742,8 +51762,8 @@
|
|
|
51742
51762
|
|
|
51743
51763
|
|
|
51744
51764
|
__info__.version = "19.1.0-alpha.3";
|
|
51745
|
-
__info__.date = "2026-01-
|
|
51746
|
-
__info__.hash = "
|
|
51765
|
+
__info__.date = "2026-01-21T11:06:38.842Z";
|
|
51766
|
+
__info__.hash = "ceae12a";
|
|
51747
51767
|
|
|
51748
51768
|
|
|
51749
51769
|
})(this.o_spreadsheet_engine = this.o_spreadsheet_engine || {});
|