@odoo/o-spreadsheet 18.2.20 → 18.2.21
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 +121 -42
- package/dist/o-spreadsheet.d.ts +2 -2
- package/dist/o-spreadsheet.esm.js +121 -42
- package/dist/o-spreadsheet.iife.js +121 -42
- package/dist/o-spreadsheet.iife.min.js +389 -389
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +1 -3
|
@@ -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.2.
|
|
6
|
-
* @date 2025-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.2.21
|
|
6
|
+
* @date 2025-07-11T11:11:48.661Z
|
|
7
|
+
* @hash 1c32303
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -823,6 +823,7 @@ const specialWhiteSpaceSpecialCharacters = [
|
|
|
823
823
|
];
|
|
824
824
|
const specialWhiteSpaceRegexp = new RegExp(specialWhiteSpaceSpecialCharacters.join("|"), "g");
|
|
825
825
|
const newLineRegexp = /(\r\n|\r)/g;
|
|
826
|
+
const whiteSpaceCharacters = specialWhiteSpaceSpecialCharacters.concat([" "]);
|
|
826
827
|
/**
|
|
827
828
|
* Replace all different newlines characters by \n
|
|
828
829
|
*/
|
|
@@ -2839,8 +2840,9 @@ const INITIAL_JS_DAY = DateTime.fromTimestamp(0);
|
|
|
2839
2840
|
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY.getTime() - INITIAL_1900_DAY.getTime();
|
|
2840
2841
|
const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
|
|
2841
2842
|
const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
|
|
2842
|
-
const
|
|
2843
|
-
const
|
|
2843
|
+
const whiteSpaceChars = whiteSpaceCharacters.join("");
|
|
2844
|
+
const dateSeparatorsRegex = new RegExp(`\/|-|${whiteSpaceCharacters.join("|")}`);
|
|
2845
|
+
const dateRegexp = new RegExp(`^(\\d{1,4})[\/${whiteSpaceChars}\-](\\d{1,4})([\/${whiteSpaceChars}\-](\\d{1,4}))?$`);
|
|
2844
2846
|
const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
|
|
2845
2847
|
/** Convert a value number representing a date, or return undefined if it isn't possible */
|
|
2846
2848
|
function valueToDateNumber(value, locale) {
|
|
@@ -6543,6 +6545,8 @@ function splitWordToSpecificWidth(ctx, word, width, style) {
|
|
|
6543
6545
|
function splitTextToWidth(ctx, text, style, width) {
|
|
6544
6546
|
if (!style)
|
|
6545
6547
|
style = {};
|
|
6548
|
+
if (isMarkdownLink(text))
|
|
6549
|
+
text = parseMarkdownLink(text).label;
|
|
6546
6550
|
const brokenText = [];
|
|
6547
6551
|
// Checking if text contains NEWLINE before split makes it very slightly slower if text contains it,
|
|
6548
6552
|
// but 5-10x faster if it doesn't
|
|
@@ -8507,6 +8511,10 @@ function toNormalizedPivotValue(dimension, groupValue) {
|
|
|
8507
8511
|
if (groupValue === null || groupValue === "null") {
|
|
8508
8512
|
return null;
|
|
8509
8513
|
}
|
|
8514
|
+
const extractedGroupValue = typeof groupValue === "object" ? groupValue.value : groupValue;
|
|
8515
|
+
if (isEvaluationError(extractedGroupValue)) {
|
|
8516
|
+
return extractedGroupValue;
|
|
8517
|
+
}
|
|
8510
8518
|
const groupValueString = typeof groupValue === "boolean"
|
|
8511
8519
|
? toString(groupValue).toLocaleLowerCase()
|
|
8512
8520
|
: toString(groupValue);
|
|
@@ -25811,40 +25819,112 @@ function convertPivotTableConfig(pivotTable) {
|
|
|
25811
25819
|
* In all the sheets, replace the table-only references in the formula cells with standard references.
|
|
25812
25820
|
*/
|
|
25813
25821
|
function convertTableFormulaReferences(convertedSheets, xlsxSheets) {
|
|
25822
|
+
let deconstructedSheets = null;
|
|
25814
25823
|
for (let tableSheet of convertedSheets) {
|
|
25815
25824
|
const tables = xlsxSheets.find((s) => isSheetNameEqual(s.sheetName, tableSheet.name)).tables;
|
|
25825
|
+
if (!tables || tables.length === 0) {
|
|
25826
|
+
continue;
|
|
25827
|
+
}
|
|
25828
|
+
// Only deconstruct sheets if we are sure there are tables to process
|
|
25829
|
+
if (!deconstructedSheets) {
|
|
25830
|
+
deconstructedSheets = deconstructSheets(convertedSheets);
|
|
25831
|
+
}
|
|
25816
25832
|
for (let table of tables) {
|
|
25817
|
-
|
|
25818
|
-
|
|
25819
|
-
for (let xc in
|
|
25820
|
-
const
|
|
25821
|
-
let
|
|
25822
|
-
|
|
25823
|
-
|
|
25824
|
-
|
|
25825
|
-
let endIndex = refIndex + tabRef.length;
|
|
25826
|
-
let openBrackets = 1;
|
|
25827
|
-
while (openBrackets > 0 && endIndex < cellContent.length) {
|
|
25828
|
-
if (cellContent[endIndex] === "[") {
|
|
25829
|
-
openBrackets++;
|
|
25830
|
-
}
|
|
25831
|
-
else if (cellContent[endIndex] === "]") {
|
|
25832
|
-
openBrackets--;
|
|
25833
|
-
}
|
|
25834
|
-
endIndex++;
|
|
25835
|
-
}
|
|
25836
|
-
let reference = cellContent.slice(refIndex + tabRef.length, endIndex - 1);
|
|
25837
|
-
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
25838
|
-
const convertedRef = convertTableReference(sheetPrefix, reference, table, xc);
|
|
25839
|
-
cellContent =
|
|
25840
|
-
cellContent.slice(0, refIndex) + convertedRef + cellContent.slice(endIndex);
|
|
25833
|
+
for (let sheetId in deconstructedSheets) {
|
|
25834
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
25835
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
25836
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
25837
|
+
for (let i = deconstructedCell.length - 3; i >= 0; i -= 2) {
|
|
25838
|
+
const possibleTable = deconstructedSheets[sheetId][xc][i];
|
|
25839
|
+
if (!possibleTable.endsWith(table.name)) {
|
|
25840
|
+
continue;
|
|
25841
25841
|
}
|
|
25842
|
+
const possibleRef = deconstructedSheets[sheetId][xc][i + 1];
|
|
25843
|
+
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
25844
|
+
const convertedRef = convertTableReference(sheetPrefix, possibleRef, table, xc);
|
|
25845
|
+
deconstructedSheets[sheetId][xc][i + 2] =
|
|
25846
|
+
possibleTable.slice(0, possibleTable.indexOf(table.name)) +
|
|
25847
|
+
convertedRef +
|
|
25848
|
+
deconstructedSheets[sheetId][xc][i + 2];
|
|
25849
|
+
deconstructedSheets[sheetId][xc].splice(i, 2);
|
|
25842
25850
|
}
|
|
25843
|
-
sheet.cells[xc] = cellContent;
|
|
25851
|
+
// sheet.cells[xc] = cellContent;
|
|
25844
25852
|
}
|
|
25845
25853
|
}
|
|
25846
25854
|
}
|
|
25847
25855
|
}
|
|
25856
|
+
if (!deconstructedSheets) {
|
|
25857
|
+
return;
|
|
25858
|
+
}
|
|
25859
|
+
for (let sheetId in deconstructedSheets) {
|
|
25860
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
25861
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
25862
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
25863
|
+
if (deconstructedCell.length === 1) {
|
|
25864
|
+
sheet.cells[xc] = deconstructedCell[0];
|
|
25865
|
+
continue;
|
|
25866
|
+
}
|
|
25867
|
+
let newContent = "";
|
|
25868
|
+
for (let i = 0; i < deconstructedCell.length; i += 2) {
|
|
25869
|
+
newContent += deconstructedCell[i] + "[" + deconstructedCell[i + 1] + "]";
|
|
25870
|
+
}
|
|
25871
|
+
newContent += deconstructedCell[deconstructedCell.length - 1];
|
|
25872
|
+
sheet.cells[xc] = newContent;
|
|
25873
|
+
}
|
|
25874
|
+
}
|
|
25875
|
+
}
|
|
25876
|
+
/**
|
|
25877
|
+
* Deconstruct the content of the cells in the sheets to extract possible table references.
|
|
25878
|
+
* Example from "=AVERAGE(Table1[colName1])-AVERAGE(Table2[colName2])":
|
|
25879
|
+
* return --> ["=AVERAGE(Table1", "colName1", ")-AVERAGE(Table2", "colName2", ")"]
|
|
25880
|
+
*/
|
|
25881
|
+
function deconstructSheets(convertedSheets) {
|
|
25882
|
+
const deconstructedSheets = {};
|
|
25883
|
+
for (let sheet of convertedSheets) {
|
|
25884
|
+
for (let xc in sheet.cells) {
|
|
25885
|
+
const cellContent = sheet.cells[xc];
|
|
25886
|
+
if (!cellContent || !cellContent.startsWith("=")) {
|
|
25887
|
+
continue;
|
|
25888
|
+
}
|
|
25889
|
+
const startIndex = cellContent.indexOf("[");
|
|
25890
|
+
if (startIndex === -1) {
|
|
25891
|
+
continue;
|
|
25892
|
+
}
|
|
25893
|
+
const deconstructedCell = [];
|
|
25894
|
+
let possibleTable = cellContent.slice(0, startIndex);
|
|
25895
|
+
let possibleRef = "";
|
|
25896
|
+
let openBrackets = 1;
|
|
25897
|
+
let mainPossibleTableIndex = 0;
|
|
25898
|
+
let mainOpenBracketIndex = startIndex;
|
|
25899
|
+
for (let index = startIndex + 1; index < cellContent.length; index++) {
|
|
25900
|
+
if (cellContent[index] === "[") {
|
|
25901
|
+
if (openBrackets === 0) {
|
|
25902
|
+
possibleTable = cellContent.slice(mainPossibleTableIndex, index);
|
|
25903
|
+
mainOpenBracketIndex = index;
|
|
25904
|
+
}
|
|
25905
|
+
openBrackets++;
|
|
25906
|
+
continue;
|
|
25907
|
+
}
|
|
25908
|
+
if (cellContent[index] === "]") {
|
|
25909
|
+
openBrackets--;
|
|
25910
|
+
if (openBrackets === 0) {
|
|
25911
|
+
possibleRef = cellContent.slice(mainOpenBracketIndex + 1, index);
|
|
25912
|
+
deconstructedCell.push(possibleTable);
|
|
25913
|
+
deconstructedCell.push(possibleRef);
|
|
25914
|
+
mainPossibleTableIndex = index + 1;
|
|
25915
|
+
}
|
|
25916
|
+
}
|
|
25917
|
+
}
|
|
25918
|
+
if (deconstructedCell.length) {
|
|
25919
|
+
if (!deconstructedSheets[sheet.id]) {
|
|
25920
|
+
deconstructedSheets[sheet.id] = {};
|
|
25921
|
+
}
|
|
25922
|
+
deconstructedCell.push(cellContent.slice(mainPossibleTableIndex));
|
|
25923
|
+
deconstructedSheets[sheet.id][xc] = [...deconstructedCell];
|
|
25924
|
+
}
|
|
25925
|
+
}
|
|
25926
|
+
}
|
|
25927
|
+
return deconstructedSheets;
|
|
25848
25928
|
}
|
|
25849
25929
|
/**
|
|
25850
25930
|
* Convert table-specific references in formulas into standard references. A table reference is composed of columns names,
|
|
@@ -33288,6 +33368,9 @@ class ErrorToolTip extends owl.Component {
|
|
|
33288
33368
|
return undefined;
|
|
33289
33369
|
}
|
|
33290
33370
|
get errorOriginPositionString() {
|
|
33371
|
+
if (this.env.model.getters.isDashboard()) {
|
|
33372
|
+
return "";
|
|
33373
|
+
}
|
|
33291
33374
|
const evaluationError = this.evaluationError;
|
|
33292
33375
|
const position = evaluationError?.errorOriginPosition;
|
|
33293
33376
|
if (!position || deepEquals(position, this.props.cellPosition)) {
|
|
@@ -47062,10 +47145,7 @@ class SpreadsheetPivot {
|
|
|
47062
47145
|
if (finalCell.value === null) {
|
|
47063
47146
|
return { value: _t("(Undefined)") };
|
|
47064
47147
|
}
|
|
47065
|
-
return
|
|
47066
|
-
value: finalCell.value,
|
|
47067
|
-
format: finalCell.format,
|
|
47068
|
-
};
|
|
47148
|
+
return finalCell;
|
|
47069
47149
|
}
|
|
47070
47150
|
getPivotCellValueAndFormat(measureId, domain) {
|
|
47071
47151
|
const dataEntries = this.filterDataEntriesFromDomain(this.dataEntries, domain);
|
|
@@ -47294,7 +47374,6 @@ pivotRegistry.add("SPREADSHEET", {
|
|
|
47294
47374
|
ui: SpreadsheetPivot,
|
|
47295
47375
|
definition: SpreadsheetPivotRuntimeDefinition,
|
|
47296
47376
|
externalData: false,
|
|
47297
|
-
onIterationEndEvaluation: (pivot) => pivot.markAsDirtyForEvaluation(),
|
|
47298
47377
|
dateGranularities: [...dateGranularities],
|
|
47299
47378
|
datetimeGranularities: [...dateGranularities, "hour_number", "minute_number", "second_number"],
|
|
47300
47379
|
isMeasureCandidate: (field) => field.type !== "boolean",
|
|
@@ -60060,7 +60139,7 @@ const onIterationEndEvaluationRegistry = new Registry();
|
|
|
60060
60139
|
onIterationEndEvaluationRegistry.add("pivots", (getters) => {
|
|
60061
60140
|
for (const pivotId of getters.getPivotIds()) {
|
|
60062
60141
|
const pivot = getters.getPivot(pivotId);
|
|
60063
|
-
|
|
60142
|
+
pivot.markAsDirtyForEvaluation?.();
|
|
60064
60143
|
}
|
|
60065
60144
|
});
|
|
60066
60145
|
|
|
@@ -63066,13 +63145,13 @@ function withPivotPresentationLayer (PivotClass) {
|
|
|
63066
63145
|
super(custom, params);
|
|
63067
63146
|
this.getters = params.getters;
|
|
63068
63147
|
}
|
|
63069
|
-
|
|
63148
|
+
markAsDirtyForEvaluation() {
|
|
63070
63149
|
this.cache = {};
|
|
63071
63150
|
this.rankAsc = {};
|
|
63072
63151
|
this.rankDesc = {};
|
|
63073
63152
|
this.runningTotal = {};
|
|
63074
63153
|
this.runningTotalInPercent = {};
|
|
63075
|
-
super.
|
|
63154
|
+
super.markAsDirtyForEvaluation?.();
|
|
63076
63155
|
}
|
|
63077
63156
|
getPivotCellValueAndFormat(measureName, domain) {
|
|
63078
63157
|
return this.getMeasureDisplayValue(measureName, domain);
|
|
@@ -63197,7 +63276,7 @@ function withPivotPresentationLayer (PivotClass) {
|
|
|
63197
63276
|
return this.getSubTreeMatchingDomain(node.children, domain, domainLevel + 1);
|
|
63198
63277
|
}
|
|
63199
63278
|
}
|
|
63200
|
-
return
|
|
63279
|
+
return [];
|
|
63201
63280
|
}
|
|
63202
63281
|
treeToLeafDomains(tree, parentDomain = []) {
|
|
63203
63282
|
const domains = [];
|
|
@@ -77108,6 +77187,6 @@ exports.tokenColors = tokenColors;
|
|
|
77108
77187
|
exports.tokenize = tokenize;
|
|
77109
77188
|
|
|
77110
77189
|
|
|
77111
|
-
__info__.version = "18.2.
|
|
77112
|
-
__info__.date = "2025-
|
|
77113
|
-
__info__.hash = "
|
|
77190
|
+
__info__.version = "18.2.21";
|
|
77191
|
+
__info__.date = "2025-07-11T11:11:48.661Z";
|
|
77192
|
+
__info__.hash = "1c32303";
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -5453,6 +5453,7 @@ interface Pivot<T = PivotRuntimeDefinition> {
|
|
|
5453
5453
|
label: string;
|
|
5454
5454
|
}[];
|
|
5455
5455
|
needsReevaluation: boolean;
|
|
5456
|
+
markAsDirtyForEvaluation?(): void;
|
|
5456
5457
|
}
|
|
5457
5458
|
|
|
5458
5459
|
declare class PivotUIPlugin extends CoreViewPlugin {
|
|
@@ -6359,7 +6360,6 @@ interface PivotRegistryItem {
|
|
|
6359
6360
|
ui: PivotUIConstructor;
|
|
6360
6361
|
definition: PivotDefinitionConstructor;
|
|
6361
6362
|
externalData: boolean;
|
|
6362
|
-
onIterationEndEvaluation: (pivot: Pivot) => void;
|
|
6363
6363
|
dateGranularities: string[];
|
|
6364
6364
|
datetimeGranularities: string[];
|
|
6365
6365
|
isMeasureCandidate: (field: PivotField) => boolean;
|
|
@@ -10218,7 +10218,7 @@ declare function createPivotFormula(formulaId: string, cell: PivotTableCell): st
|
|
|
10218
10218
|
* e.g. given the following formula PIVOT.VALUE("1", "stage_id", "42", "status", "won"),
|
|
10219
10219
|
* the two group values are "42" and "won".
|
|
10220
10220
|
*/
|
|
10221
|
-
declare function toNormalizedPivotValue(dimension: Pick<PivotDimension$1, "type" | "displayName" | "granularity">, groupValue:
|
|
10221
|
+
declare function toNormalizedPivotValue(dimension: Pick<PivotDimension$1, "type" | "displayName" | "granularity">, groupValue: Maybe<CellValue | FunctionResultObject>): CellValue;
|
|
10222
10222
|
|
|
10223
10223
|
interface Props$i {
|
|
10224
10224
|
pivotId: string;
|
|
@@ -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.2.
|
|
6
|
-
* @date 2025-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.2.21
|
|
6
|
+
* @date 2025-07-11T11:11:48.661Z
|
|
7
|
+
* @hash 1c32303
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, App, blockDom, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
|
|
@@ -821,6 +821,7 @@ const specialWhiteSpaceSpecialCharacters = [
|
|
|
821
821
|
];
|
|
822
822
|
const specialWhiteSpaceRegexp = new RegExp(specialWhiteSpaceSpecialCharacters.join("|"), "g");
|
|
823
823
|
const newLineRegexp = /(\r\n|\r)/g;
|
|
824
|
+
const whiteSpaceCharacters = specialWhiteSpaceSpecialCharacters.concat([" "]);
|
|
824
825
|
/**
|
|
825
826
|
* Replace all different newlines characters by \n
|
|
826
827
|
*/
|
|
@@ -2837,8 +2838,9 @@ const INITIAL_JS_DAY = DateTime.fromTimestamp(0);
|
|
|
2837
2838
|
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY.getTime() - INITIAL_1900_DAY.getTime();
|
|
2838
2839
|
const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
|
|
2839
2840
|
const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
|
|
2840
|
-
const
|
|
2841
|
-
const
|
|
2841
|
+
const whiteSpaceChars = whiteSpaceCharacters.join("");
|
|
2842
|
+
const dateSeparatorsRegex = new RegExp(`\/|-|${whiteSpaceCharacters.join("|")}`);
|
|
2843
|
+
const dateRegexp = new RegExp(`^(\\d{1,4})[\/${whiteSpaceChars}\-](\\d{1,4})([\/${whiteSpaceChars}\-](\\d{1,4}))?$`);
|
|
2842
2844
|
const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
|
|
2843
2845
|
/** Convert a value number representing a date, or return undefined if it isn't possible */
|
|
2844
2846
|
function valueToDateNumber(value, locale) {
|
|
@@ -6541,6 +6543,8 @@ function splitWordToSpecificWidth(ctx, word, width, style) {
|
|
|
6541
6543
|
function splitTextToWidth(ctx, text, style, width) {
|
|
6542
6544
|
if (!style)
|
|
6543
6545
|
style = {};
|
|
6546
|
+
if (isMarkdownLink(text))
|
|
6547
|
+
text = parseMarkdownLink(text).label;
|
|
6544
6548
|
const brokenText = [];
|
|
6545
6549
|
// Checking if text contains NEWLINE before split makes it very slightly slower if text contains it,
|
|
6546
6550
|
// but 5-10x faster if it doesn't
|
|
@@ -8505,6 +8509,10 @@ function toNormalizedPivotValue(dimension, groupValue) {
|
|
|
8505
8509
|
if (groupValue === null || groupValue === "null") {
|
|
8506
8510
|
return null;
|
|
8507
8511
|
}
|
|
8512
|
+
const extractedGroupValue = typeof groupValue === "object" ? groupValue.value : groupValue;
|
|
8513
|
+
if (isEvaluationError(extractedGroupValue)) {
|
|
8514
|
+
return extractedGroupValue;
|
|
8515
|
+
}
|
|
8508
8516
|
const groupValueString = typeof groupValue === "boolean"
|
|
8509
8517
|
? toString(groupValue).toLocaleLowerCase()
|
|
8510
8518
|
: toString(groupValue);
|
|
@@ -25809,40 +25817,112 @@ function convertPivotTableConfig(pivotTable) {
|
|
|
25809
25817
|
* In all the sheets, replace the table-only references in the formula cells with standard references.
|
|
25810
25818
|
*/
|
|
25811
25819
|
function convertTableFormulaReferences(convertedSheets, xlsxSheets) {
|
|
25820
|
+
let deconstructedSheets = null;
|
|
25812
25821
|
for (let tableSheet of convertedSheets) {
|
|
25813
25822
|
const tables = xlsxSheets.find((s) => isSheetNameEqual(s.sheetName, tableSheet.name)).tables;
|
|
25823
|
+
if (!tables || tables.length === 0) {
|
|
25824
|
+
continue;
|
|
25825
|
+
}
|
|
25826
|
+
// Only deconstruct sheets if we are sure there are tables to process
|
|
25827
|
+
if (!deconstructedSheets) {
|
|
25828
|
+
deconstructedSheets = deconstructSheets(convertedSheets);
|
|
25829
|
+
}
|
|
25814
25830
|
for (let table of tables) {
|
|
25815
|
-
|
|
25816
|
-
|
|
25817
|
-
for (let xc in
|
|
25818
|
-
const
|
|
25819
|
-
let
|
|
25820
|
-
|
|
25821
|
-
|
|
25822
|
-
|
|
25823
|
-
let endIndex = refIndex + tabRef.length;
|
|
25824
|
-
let openBrackets = 1;
|
|
25825
|
-
while (openBrackets > 0 && endIndex < cellContent.length) {
|
|
25826
|
-
if (cellContent[endIndex] === "[") {
|
|
25827
|
-
openBrackets++;
|
|
25828
|
-
}
|
|
25829
|
-
else if (cellContent[endIndex] === "]") {
|
|
25830
|
-
openBrackets--;
|
|
25831
|
-
}
|
|
25832
|
-
endIndex++;
|
|
25833
|
-
}
|
|
25834
|
-
let reference = cellContent.slice(refIndex + tabRef.length, endIndex - 1);
|
|
25835
|
-
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
25836
|
-
const convertedRef = convertTableReference(sheetPrefix, reference, table, xc);
|
|
25837
|
-
cellContent =
|
|
25838
|
-
cellContent.slice(0, refIndex) + convertedRef + cellContent.slice(endIndex);
|
|
25831
|
+
for (let sheetId in deconstructedSheets) {
|
|
25832
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
25833
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
25834
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
25835
|
+
for (let i = deconstructedCell.length - 3; i >= 0; i -= 2) {
|
|
25836
|
+
const possibleTable = deconstructedSheets[sheetId][xc][i];
|
|
25837
|
+
if (!possibleTable.endsWith(table.name)) {
|
|
25838
|
+
continue;
|
|
25839
25839
|
}
|
|
25840
|
+
const possibleRef = deconstructedSheets[sheetId][xc][i + 1];
|
|
25841
|
+
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
25842
|
+
const convertedRef = convertTableReference(sheetPrefix, possibleRef, table, xc);
|
|
25843
|
+
deconstructedSheets[sheetId][xc][i + 2] =
|
|
25844
|
+
possibleTable.slice(0, possibleTable.indexOf(table.name)) +
|
|
25845
|
+
convertedRef +
|
|
25846
|
+
deconstructedSheets[sheetId][xc][i + 2];
|
|
25847
|
+
deconstructedSheets[sheetId][xc].splice(i, 2);
|
|
25840
25848
|
}
|
|
25841
|
-
sheet.cells[xc] = cellContent;
|
|
25849
|
+
// sheet.cells[xc] = cellContent;
|
|
25842
25850
|
}
|
|
25843
25851
|
}
|
|
25844
25852
|
}
|
|
25845
25853
|
}
|
|
25854
|
+
if (!deconstructedSheets) {
|
|
25855
|
+
return;
|
|
25856
|
+
}
|
|
25857
|
+
for (let sheetId in deconstructedSheets) {
|
|
25858
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
25859
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
25860
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
25861
|
+
if (deconstructedCell.length === 1) {
|
|
25862
|
+
sheet.cells[xc] = deconstructedCell[0];
|
|
25863
|
+
continue;
|
|
25864
|
+
}
|
|
25865
|
+
let newContent = "";
|
|
25866
|
+
for (let i = 0; i < deconstructedCell.length; i += 2) {
|
|
25867
|
+
newContent += deconstructedCell[i] + "[" + deconstructedCell[i + 1] + "]";
|
|
25868
|
+
}
|
|
25869
|
+
newContent += deconstructedCell[deconstructedCell.length - 1];
|
|
25870
|
+
sheet.cells[xc] = newContent;
|
|
25871
|
+
}
|
|
25872
|
+
}
|
|
25873
|
+
}
|
|
25874
|
+
/**
|
|
25875
|
+
* Deconstruct the content of the cells in the sheets to extract possible table references.
|
|
25876
|
+
* Example from "=AVERAGE(Table1[colName1])-AVERAGE(Table2[colName2])":
|
|
25877
|
+
* return --> ["=AVERAGE(Table1", "colName1", ")-AVERAGE(Table2", "colName2", ")"]
|
|
25878
|
+
*/
|
|
25879
|
+
function deconstructSheets(convertedSheets) {
|
|
25880
|
+
const deconstructedSheets = {};
|
|
25881
|
+
for (let sheet of convertedSheets) {
|
|
25882
|
+
for (let xc in sheet.cells) {
|
|
25883
|
+
const cellContent = sheet.cells[xc];
|
|
25884
|
+
if (!cellContent || !cellContent.startsWith("=")) {
|
|
25885
|
+
continue;
|
|
25886
|
+
}
|
|
25887
|
+
const startIndex = cellContent.indexOf("[");
|
|
25888
|
+
if (startIndex === -1) {
|
|
25889
|
+
continue;
|
|
25890
|
+
}
|
|
25891
|
+
const deconstructedCell = [];
|
|
25892
|
+
let possibleTable = cellContent.slice(0, startIndex);
|
|
25893
|
+
let possibleRef = "";
|
|
25894
|
+
let openBrackets = 1;
|
|
25895
|
+
let mainPossibleTableIndex = 0;
|
|
25896
|
+
let mainOpenBracketIndex = startIndex;
|
|
25897
|
+
for (let index = startIndex + 1; index < cellContent.length; index++) {
|
|
25898
|
+
if (cellContent[index] === "[") {
|
|
25899
|
+
if (openBrackets === 0) {
|
|
25900
|
+
possibleTable = cellContent.slice(mainPossibleTableIndex, index);
|
|
25901
|
+
mainOpenBracketIndex = index;
|
|
25902
|
+
}
|
|
25903
|
+
openBrackets++;
|
|
25904
|
+
continue;
|
|
25905
|
+
}
|
|
25906
|
+
if (cellContent[index] === "]") {
|
|
25907
|
+
openBrackets--;
|
|
25908
|
+
if (openBrackets === 0) {
|
|
25909
|
+
possibleRef = cellContent.slice(mainOpenBracketIndex + 1, index);
|
|
25910
|
+
deconstructedCell.push(possibleTable);
|
|
25911
|
+
deconstructedCell.push(possibleRef);
|
|
25912
|
+
mainPossibleTableIndex = index + 1;
|
|
25913
|
+
}
|
|
25914
|
+
}
|
|
25915
|
+
}
|
|
25916
|
+
if (deconstructedCell.length) {
|
|
25917
|
+
if (!deconstructedSheets[sheet.id]) {
|
|
25918
|
+
deconstructedSheets[sheet.id] = {};
|
|
25919
|
+
}
|
|
25920
|
+
deconstructedCell.push(cellContent.slice(mainPossibleTableIndex));
|
|
25921
|
+
deconstructedSheets[sheet.id][xc] = [...deconstructedCell];
|
|
25922
|
+
}
|
|
25923
|
+
}
|
|
25924
|
+
}
|
|
25925
|
+
return deconstructedSheets;
|
|
25846
25926
|
}
|
|
25847
25927
|
/**
|
|
25848
25928
|
* Convert table-specific references in formulas into standard references. A table reference is composed of columns names,
|
|
@@ -33286,6 +33366,9 @@ class ErrorToolTip extends Component {
|
|
|
33286
33366
|
return undefined;
|
|
33287
33367
|
}
|
|
33288
33368
|
get errorOriginPositionString() {
|
|
33369
|
+
if (this.env.model.getters.isDashboard()) {
|
|
33370
|
+
return "";
|
|
33371
|
+
}
|
|
33289
33372
|
const evaluationError = this.evaluationError;
|
|
33290
33373
|
const position = evaluationError?.errorOriginPosition;
|
|
33291
33374
|
if (!position || deepEquals(position, this.props.cellPosition)) {
|
|
@@ -47060,10 +47143,7 @@ class SpreadsheetPivot {
|
|
|
47060
47143
|
if (finalCell.value === null) {
|
|
47061
47144
|
return { value: _t("(Undefined)") };
|
|
47062
47145
|
}
|
|
47063
|
-
return
|
|
47064
|
-
value: finalCell.value,
|
|
47065
|
-
format: finalCell.format,
|
|
47066
|
-
};
|
|
47146
|
+
return finalCell;
|
|
47067
47147
|
}
|
|
47068
47148
|
getPivotCellValueAndFormat(measureId, domain) {
|
|
47069
47149
|
const dataEntries = this.filterDataEntriesFromDomain(this.dataEntries, domain);
|
|
@@ -47292,7 +47372,6 @@ pivotRegistry.add("SPREADSHEET", {
|
|
|
47292
47372
|
ui: SpreadsheetPivot,
|
|
47293
47373
|
definition: SpreadsheetPivotRuntimeDefinition,
|
|
47294
47374
|
externalData: false,
|
|
47295
|
-
onIterationEndEvaluation: (pivot) => pivot.markAsDirtyForEvaluation(),
|
|
47296
47375
|
dateGranularities: [...dateGranularities],
|
|
47297
47376
|
datetimeGranularities: [...dateGranularities, "hour_number", "minute_number", "second_number"],
|
|
47298
47377
|
isMeasureCandidate: (field) => field.type !== "boolean",
|
|
@@ -60058,7 +60137,7 @@ const onIterationEndEvaluationRegistry = new Registry();
|
|
|
60058
60137
|
onIterationEndEvaluationRegistry.add("pivots", (getters) => {
|
|
60059
60138
|
for (const pivotId of getters.getPivotIds()) {
|
|
60060
60139
|
const pivot = getters.getPivot(pivotId);
|
|
60061
|
-
|
|
60140
|
+
pivot.markAsDirtyForEvaluation?.();
|
|
60062
60141
|
}
|
|
60063
60142
|
});
|
|
60064
60143
|
|
|
@@ -63064,13 +63143,13 @@ function withPivotPresentationLayer (PivotClass) {
|
|
|
63064
63143
|
super(custom, params);
|
|
63065
63144
|
this.getters = params.getters;
|
|
63066
63145
|
}
|
|
63067
|
-
|
|
63146
|
+
markAsDirtyForEvaluation() {
|
|
63068
63147
|
this.cache = {};
|
|
63069
63148
|
this.rankAsc = {};
|
|
63070
63149
|
this.rankDesc = {};
|
|
63071
63150
|
this.runningTotal = {};
|
|
63072
63151
|
this.runningTotalInPercent = {};
|
|
63073
|
-
super.
|
|
63152
|
+
super.markAsDirtyForEvaluation?.();
|
|
63074
63153
|
}
|
|
63075
63154
|
getPivotCellValueAndFormat(measureName, domain) {
|
|
63076
63155
|
return this.getMeasureDisplayValue(measureName, domain);
|
|
@@ -63195,7 +63274,7 @@ function withPivotPresentationLayer (PivotClass) {
|
|
|
63195
63274
|
return this.getSubTreeMatchingDomain(node.children, domain, domainLevel + 1);
|
|
63196
63275
|
}
|
|
63197
63276
|
}
|
|
63198
|
-
return
|
|
63277
|
+
return [];
|
|
63199
63278
|
}
|
|
63200
63279
|
treeToLeafDomains(tree, parentDomain = []) {
|
|
63201
63280
|
const domains = [];
|
|
@@ -77061,6 +77140,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
|
|
|
77061
77140
|
export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, CoreViewPlugin, DispatchResult, EvaluationError, 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, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
|
|
77062
77141
|
|
|
77063
77142
|
|
|
77064
|
-
__info__.version = "18.2.
|
|
77065
|
-
__info__.date = "2025-
|
|
77066
|
-
__info__.hash = "
|
|
77143
|
+
__info__.version = "18.2.21";
|
|
77144
|
+
__info__.date = "2025-07-11T11:11:48.661Z";
|
|
77145
|
+
__info__.hash = "1c32303";
|