@odoo/o-spreadsheet 18.1.28 → 18.1.29
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 +118 -42
- package/dist/o-spreadsheet.d.ts +2 -2
- package/dist/o-spreadsheet.esm.js +118 -42
- package/dist/o-spreadsheet.iife.js +118 -42
- package/dist/o-spreadsheet.iife.min.js +380 -380
- 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.1.
|
|
6
|
-
* @date 2025-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.1.29
|
|
6
|
+
* @date 2025-07-11T11:11:55.442Z
|
|
7
|
+
* @hash 3456a93
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -822,6 +822,7 @@ const specialWhiteSpaceSpecialCharacters = [
|
|
|
822
822
|
];
|
|
823
823
|
const specialWhiteSpaceRegexp = new RegExp(specialWhiteSpaceSpecialCharacters.join("|"), "g");
|
|
824
824
|
const newLineRegexp = /(\r\n|\r)/g;
|
|
825
|
+
const whiteSpaceCharacters = specialWhiteSpaceSpecialCharacters.concat([" "]);
|
|
825
826
|
/**
|
|
826
827
|
* Replace all different newlines characters by \n
|
|
827
828
|
*/
|
|
@@ -2828,8 +2829,9 @@ const INITIAL_JS_DAY = DateTime.fromTimestamp(0);
|
|
|
2828
2829
|
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY.getTime() - INITIAL_1900_DAY.getTime();
|
|
2829
2830
|
const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
|
|
2830
2831
|
const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
|
|
2831
|
-
const
|
|
2832
|
-
const
|
|
2832
|
+
const whiteSpaceChars = whiteSpaceCharacters.join("");
|
|
2833
|
+
const dateSeparatorsRegex = new RegExp(`\/|-|${whiteSpaceCharacters.join("|")}`);
|
|
2834
|
+
const dateRegexp = new RegExp(`^(\\d{1,4})[\/${whiteSpaceChars}\-](\\d{1,4})([\/${whiteSpaceChars}\-](\\d{1,4}))?$`);
|
|
2833
2835
|
const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
|
|
2834
2836
|
/** Convert a value number representing a date, or return undefined if it isn't possible */
|
|
2835
2837
|
function valueToDateNumber(value, locale) {
|
|
@@ -6534,6 +6536,8 @@ function splitWordToSpecificWidth(ctx, word, width, style) {
|
|
|
6534
6536
|
function splitTextToWidth(ctx, text, style, width) {
|
|
6535
6537
|
if (!style)
|
|
6536
6538
|
style = {};
|
|
6539
|
+
if (isMarkdownLink(text))
|
|
6540
|
+
text = parseMarkdownLink(text).label;
|
|
6537
6541
|
const brokenText = [];
|
|
6538
6542
|
// Checking if text contains NEWLINE before split makes it very slightly slower if text contains it,
|
|
6539
6543
|
// but 5-10x faster if it doesn't
|
|
@@ -8497,6 +8501,10 @@ function toNormalizedPivotValue(dimension, groupValue) {
|
|
|
8497
8501
|
if (groupValue === null || groupValue === "null") {
|
|
8498
8502
|
return null;
|
|
8499
8503
|
}
|
|
8504
|
+
const extractedGroupValue = typeof groupValue === "object" ? groupValue.value : groupValue;
|
|
8505
|
+
if (isEvaluationError(extractedGroupValue)) {
|
|
8506
|
+
return extractedGroupValue;
|
|
8507
|
+
}
|
|
8500
8508
|
const groupValueString = typeof groupValue === "boolean"
|
|
8501
8509
|
? toString(groupValue).toLocaleLowerCase()
|
|
8502
8510
|
: toString(groupValue);
|
|
@@ -25787,40 +25795,112 @@ function convertPivotTableConfig(pivotTable) {
|
|
|
25787
25795
|
* In all the sheets, replace the table-only references in the formula cells with standard references.
|
|
25788
25796
|
*/
|
|
25789
25797
|
function convertTableFormulaReferences(convertedSheets, xlsxSheets) {
|
|
25798
|
+
let deconstructedSheets = null;
|
|
25790
25799
|
for (let tableSheet of convertedSheets) {
|
|
25791
25800
|
const tables = xlsxSheets.find((s) => isSheetNameEqual(s.sheetName, tableSheet.name)).tables;
|
|
25801
|
+
if (!tables || tables.length === 0) {
|
|
25802
|
+
continue;
|
|
25803
|
+
}
|
|
25804
|
+
// Only deconstruct sheets if we are sure there are tables to process
|
|
25805
|
+
if (!deconstructedSheets) {
|
|
25806
|
+
deconstructedSheets = deconstructSheets(convertedSheets);
|
|
25807
|
+
}
|
|
25792
25808
|
for (let table of tables) {
|
|
25793
|
-
|
|
25794
|
-
|
|
25795
|
-
for (let xc in
|
|
25796
|
-
const
|
|
25797
|
-
let
|
|
25798
|
-
|
|
25799
|
-
|
|
25800
|
-
|
|
25801
|
-
let endIndex = refIndex + tabRef.length;
|
|
25802
|
-
let openBrackets = 1;
|
|
25803
|
-
while (openBrackets > 0 && endIndex < cellContent.length) {
|
|
25804
|
-
if (cellContent[endIndex] === "[") {
|
|
25805
|
-
openBrackets++;
|
|
25806
|
-
}
|
|
25807
|
-
else if (cellContent[endIndex] === "]") {
|
|
25808
|
-
openBrackets--;
|
|
25809
|
-
}
|
|
25810
|
-
endIndex++;
|
|
25811
|
-
}
|
|
25812
|
-
let reference = cellContent.slice(refIndex + tabRef.length, endIndex - 1);
|
|
25813
|
-
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
25814
|
-
const convertedRef = convertTableReference(sheetPrefix, reference, table, xc);
|
|
25815
|
-
cellContent =
|
|
25816
|
-
cellContent.slice(0, refIndex) + convertedRef + cellContent.slice(endIndex);
|
|
25809
|
+
for (let sheetId in deconstructedSheets) {
|
|
25810
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
25811
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
25812
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
25813
|
+
for (let i = deconstructedCell.length - 3; i >= 0; i -= 2) {
|
|
25814
|
+
const possibleTable = deconstructedSheets[sheetId][xc][i];
|
|
25815
|
+
if (!possibleTable.endsWith(table.name)) {
|
|
25816
|
+
continue;
|
|
25817
25817
|
}
|
|
25818
|
+
const possibleRef = deconstructedSheets[sheetId][xc][i + 1];
|
|
25819
|
+
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
25820
|
+
const convertedRef = convertTableReference(sheetPrefix, possibleRef, table, xc);
|
|
25821
|
+
deconstructedSheets[sheetId][xc][i + 2] =
|
|
25822
|
+
possibleTable.slice(0, possibleTable.indexOf(table.name)) +
|
|
25823
|
+
convertedRef +
|
|
25824
|
+
deconstructedSheets[sheetId][xc][i + 2];
|
|
25825
|
+
deconstructedSheets[sheetId][xc].splice(i, 2);
|
|
25818
25826
|
}
|
|
25819
|
-
sheet.cells[xc] = cellContent;
|
|
25827
|
+
// sheet.cells[xc] = cellContent;
|
|
25820
25828
|
}
|
|
25821
25829
|
}
|
|
25822
25830
|
}
|
|
25823
25831
|
}
|
|
25832
|
+
if (!deconstructedSheets) {
|
|
25833
|
+
return;
|
|
25834
|
+
}
|
|
25835
|
+
for (let sheetId in deconstructedSheets) {
|
|
25836
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
25837
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
25838
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
25839
|
+
if (deconstructedCell.length === 1) {
|
|
25840
|
+
sheet.cells[xc] = deconstructedCell[0];
|
|
25841
|
+
continue;
|
|
25842
|
+
}
|
|
25843
|
+
let newContent = "";
|
|
25844
|
+
for (let i = 0; i < deconstructedCell.length; i += 2) {
|
|
25845
|
+
newContent += deconstructedCell[i] + "[" + deconstructedCell[i + 1] + "]";
|
|
25846
|
+
}
|
|
25847
|
+
newContent += deconstructedCell[deconstructedCell.length - 1];
|
|
25848
|
+
sheet.cells[xc] = newContent;
|
|
25849
|
+
}
|
|
25850
|
+
}
|
|
25851
|
+
}
|
|
25852
|
+
/**
|
|
25853
|
+
* Deconstruct the content of the cells in the sheets to extract possible table references.
|
|
25854
|
+
* Example from "=AVERAGE(Table1[colName1])-AVERAGE(Table2[colName2])":
|
|
25855
|
+
* return --> ["=AVERAGE(Table1", "colName1", ")-AVERAGE(Table2", "colName2", ")"]
|
|
25856
|
+
*/
|
|
25857
|
+
function deconstructSheets(convertedSheets) {
|
|
25858
|
+
const deconstructedSheets = {};
|
|
25859
|
+
for (let sheet of convertedSheets) {
|
|
25860
|
+
for (let xc in sheet.cells) {
|
|
25861
|
+
const cellContent = sheet.cells[xc];
|
|
25862
|
+
if (!cellContent || !cellContent.startsWith("=")) {
|
|
25863
|
+
continue;
|
|
25864
|
+
}
|
|
25865
|
+
const startIndex = cellContent.indexOf("[");
|
|
25866
|
+
if (startIndex === -1) {
|
|
25867
|
+
continue;
|
|
25868
|
+
}
|
|
25869
|
+
const deconstructedCell = [];
|
|
25870
|
+
let possibleTable = cellContent.slice(0, startIndex);
|
|
25871
|
+
let possibleRef = "";
|
|
25872
|
+
let openBrackets = 1;
|
|
25873
|
+
let mainPossibleTableIndex = 0;
|
|
25874
|
+
let mainOpenBracketIndex = startIndex;
|
|
25875
|
+
for (let index = startIndex + 1; index < cellContent.length; index++) {
|
|
25876
|
+
if (cellContent[index] === "[") {
|
|
25877
|
+
if (openBrackets === 0) {
|
|
25878
|
+
possibleTable = cellContent.slice(mainPossibleTableIndex, index);
|
|
25879
|
+
mainOpenBracketIndex = index;
|
|
25880
|
+
}
|
|
25881
|
+
openBrackets++;
|
|
25882
|
+
continue;
|
|
25883
|
+
}
|
|
25884
|
+
if (cellContent[index] === "]") {
|
|
25885
|
+
openBrackets--;
|
|
25886
|
+
if (openBrackets === 0) {
|
|
25887
|
+
possibleRef = cellContent.slice(mainOpenBracketIndex + 1, index);
|
|
25888
|
+
deconstructedCell.push(possibleTable);
|
|
25889
|
+
deconstructedCell.push(possibleRef);
|
|
25890
|
+
mainPossibleTableIndex = index + 1;
|
|
25891
|
+
}
|
|
25892
|
+
}
|
|
25893
|
+
}
|
|
25894
|
+
if (deconstructedCell.length) {
|
|
25895
|
+
if (!deconstructedSheets[sheet.id]) {
|
|
25896
|
+
deconstructedSheets[sheet.id] = {};
|
|
25897
|
+
}
|
|
25898
|
+
deconstructedCell.push(cellContent.slice(mainPossibleTableIndex));
|
|
25899
|
+
deconstructedSheets[sheet.id][xc] = [...deconstructedCell];
|
|
25900
|
+
}
|
|
25901
|
+
}
|
|
25902
|
+
}
|
|
25903
|
+
return deconstructedSheets;
|
|
25824
25904
|
}
|
|
25825
25905
|
/**
|
|
25826
25906
|
* Convert table-specific references in formulas into standard references. A table reference is composed of columns names,
|
|
@@ -46720,10 +46800,7 @@ class SpreadsheetPivot {
|
|
|
46720
46800
|
if (finalCell.value === null) {
|
|
46721
46801
|
return { value: _t("(Undefined)") };
|
|
46722
46802
|
}
|
|
46723
|
-
return
|
|
46724
|
-
value: finalCell.value,
|
|
46725
|
-
format: finalCell.format,
|
|
46726
|
-
};
|
|
46803
|
+
return finalCell;
|
|
46727
46804
|
}
|
|
46728
46805
|
getPivotCellValueAndFormat(measureId, domain) {
|
|
46729
46806
|
const dataEntries = this.filterDataEntriesFromDomain(this.dataEntries, domain);
|
|
@@ -46954,7 +47031,6 @@ pivotRegistry.add("SPREADSHEET", {
|
|
|
46954
47031
|
ui: SpreadsheetPivot,
|
|
46955
47032
|
definition: SpreadsheetPivotRuntimeDefinition,
|
|
46956
47033
|
externalData: false,
|
|
46957
|
-
onIterationEndEvaluation: (pivot) => pivot.markAsDirtyForEvaluation(),
|
|
46958
47034
|
dateGranularities: [...dateGranularities],
|
|
46959
47035
|
datetimeGranularities: [...dateGranularities, "hour_number", "minute_number", "second_number"],
|
|
46960
47036
|
isMeasureCandidate: (field) => !["datetime", "boolean"].includes(field.type),
|
|
@@ -59588,7 +59664,7 @@ const onIterationEndEvaluationRegistry = new Registry();
|
|
|
59588
59664
|
onIterationEndEvaluationRegistry.add("pivots", (getters) => {
|
|
59589
59665
|
for (const pivotId of getters.getPivotIds()) {
|
|
59590
59666
|
const pivot = getters.getPivot(pivotId);
|
|
59591
|
-
|
|
59667
|
+
pivot.markAsDirtyForEvaluation?.();
|
|
59592
59668
|
}
|
|
59593
59669
|
});
|
|
59594
59670
|
|
|
@@ -62587,13 +62663,13 @@ function withPivotPresentationLayer (PivotClass) {
|
|
|
62587
62663
|
super(custom, params);
|
|
62588
62664
|
this.getters = params.getters;
|
|
62589
62665
|
}
|
|
62590
|
-
|
|
62666
|
+
markAsDirtyForEvaluation() {
|
|
62591
62667
|
this.cache = {};
|
|
62592
62668
|
this.rankAsc = {};
|
|
62593
62669
|
this.rankDesc = {};
|
|
62594
62670
|
this.runningTotal = {};
|
|
62595
62671
|
this.runningTotalInPercent = {};
|
|
62596
|
-
super.
|
|
62672
|
+
super.markAsDirtyForEvaluation?.();
|
|
62597
62673
|
}
|
|
62598
62674
|
getPivotCellValueAndFormat(measureName, domain) {
|
|
62599
62675
|
return this.getMeasureDisplayValue(measureName, domain);
|
|
@@ -62718,7 +62794,7 @@ function withPivotPresentationLayer (PivotClass) {
|
|
|
62718
62794
|
return this.getSubTreeMatchingDomain(node.children, domain, domainLevel + 1);
|
|
62719
62795
|
}
|
|
62720
62796
|
}
|
|
62721
|
-
return
|
|
62797
|
+
return [];
|
|
62722
62798
|
}
|
|
62723
62799
|
treeToLeafDomains(tree, parentDomain = []) {
|
|
62724
62800
|
const domains = [];
|
|
@@ -76630,6 +76706,6 @@ exports.tokenColors = tokenColors;
|
|
|
76630
76706
|
exports.tokenize = tokenize;
|
|
76631
76707
|
|
|
76632
76708
|
|
|
76633
|
-
__info__.version = "18.1.
|
|
76634
|
-
__info__.date = "2025-
|
|
76635
|
-
__info__.hash = "
|
|
76709
|
+
__info__.version = "18.1.29";
|
|
76710
|
+
__info__.date = "2025-07-11T11:11:55.442Z";
|
|
76711
|
+
__info__.hash = "3456a93";
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -5415,6 +5415,7 @@ interface Pivot<T = PivotRuntimeDefinition> {
|
|
|
5415
5415
|
label: string;
|
|
5416
5416
|
}[];
|
|
5417
5417
|
needsReevaluation: boolean;
|
|
5418
|
+
markAsDirtyForEvaluation?(): void;
|
|
5418
5419
|
}
|
|
5419
5420
|
|
|
5420
5421
|
declare class PivotUIPlugin extends UIPlugin {
|
|
@@ -6335,7 +6336,6 @@ interface PivotRegistryItem {
|
|
|
6335
6336
|
ui: PivotUIConstructor;
|
|
6336
6337
|
definition: PivotDefinitionConstructor;
|
|
6337
6338
|
externalData: boolean;
|
|
6338
|
-
onIterationEndEvaluation: (pivot: Pivot) => void;
|
|
6339
6339
|
dateGranularities: string[];
|
|
6340
6340
|
datetimeGranularities: string[];
|
|
6341
6341
|
isMeasureCandidate: (field: PivotField) => boolean;
|
|
@@ -10005,7 +10005,7 @@ declare function createPivotFormula(formulaId: string, cell: PivotTableCell): st
|
|
|
10005
10005
|
* e.g. given the following formula PIVOT.VALUE("1", "stage_id", "42", "status", "won"),
|
|
10006
10006
|
* the two group values are "42" and "won".
|
|
10007
10007
|
*/
|
|
10008
|
-
declare function toNormalizedPivotValue(dimension: Pick<PivotDimension$1, "type" | "displayName" | "granularity">, groupValue:
|
|
10008
|
+
declare function toNormalizedPivotValue(dimension: Pick<PivotDimension$1, "type" | "displayName" | "granularity">, groupValue: Maybe<CellValue | FunctionResultObject>): CellValue;
|
|
10009
10009
|
|
|
10010
10010
|
interface Props$j {
|
|
10011
10011
|
onConfirm: (content: string) => void;
|
|
@@ -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.1.
|
|
6
|
-
* @date 2025-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.1.29
|
|
6
|
+
* @date 2025-07-11T11:11:55.442Z
|
|
7
|
+
* @hash 3456a93
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
|
|
@@ -820,6 +820,7 @@ const specialWhiteSpaceSpecialCharacters = [
|
|
|
820
820
|
];
|
|
821
821
|
const specialWhiteSpaceRegexp = new RegExp(specialWhiteSpaceSpecialCharacters.join("|"), "g");
|
|
822
822
|
const newLineRegexp = /(\r\n|\r)/g;
|
|
823
|
+
const whiteSpaceCharacters = specialWhiteSpaceSpecialCharacters.concat([" "]);
|
|
823
824
|
/**
|
|
824
825
|
* Replace all different newlines characters by \n
|
|
825
826
|
*/
|
|
@@ -2826,8 +2827,9 @@ const INITIAL_JS_DAY = DateTime.fromTimestamp(0);
|
|
|
2826
2827
|
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY.getTime() - INITIAL_1900_DAY.getTime();
|
|
2827
2828
|
const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
|
|
2828
2829
|
const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
|
|
2829
|
-
const
|
|
2830
|
-
const
|
|
2830
|
+
const whiteSpaceChars = whiteSpaceCharacters.join("");
|
|
2831
|
+
const dateSeparatorsRegex = new RegExp(`\/|-|${whiteSpaceCharacters.join("|")}`);
|
|
2832
|
+
const dateRegexp = new RegExp(`^(\\d{1,4})[\/${whiteSpaceChars}\-](\\d{1,4})([\/${whiteSpaceChars}\-](\\d{1,4}))?$`);
|
|
2831
2833
|
const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
|
|
2832
2834
|
/** Convert a value number representing a date, or return undefined if it isn't possible */
|
|
2833
2835
|
function valueToDateNumber(value, locale) {
|
|
@@ -6532,6 +6534,8 @@ function splitWordToSpecificWidth(ctx, word, width, style) {
|
|
|
6532
6534
|
function splitTextToWidth(ctx, text, style, width) {
|
|
6533
6535
|
if (!style)
|
|
6534
6536
|
style = {};
|
|
6537
|
+
if (isMarkdownLink(text))
|
|
6538
|
+
text = parseMarkdownLink(text).label;
|
|
6535
6539
|
const brokenText = [];
|
|
6536
6540
|
// Checking if text contains NEWLINE before split makes it very slightly slower if text contains it,
|
|
6537
6541
|
// but 5-10x faster if it doesn't
|
|
@@ -8495,6 +8499,10 @@ function toNormalizedPivotValue(dimension, groupValue) {
|
|
|
8495
8499
|
if (groupValue === null || groupValue === "null") {
|
|
8496
8500
|
return null;
|
|
8497
8501
|
}
|
|
8502
|
+
const extractedGroupValue = typeof groupValue === "object" ? groupValue.value : groupValue;
|
|
8503
|
+
if (isEvaluationError(extractedGroupValue)) {
|
|
8504
|
+
return extractedGroupValue;
|
|
8505
|
+
}
|
|
8498
8506
|
const groupValueString = typeof groupValue === "boolean"
|
|
8499
8507
|
? toString(groupValue).toLocaleLowerCase()
|
|
8500
8508
|
: toString(groupValue);
|
|
@@ -25785,40 +25793,112 @@ function convertPivotTableConfig(pivotTable) {
|
|
|
25785
25793
|
* In all the sheets, replace the table-only references in the formula cells with standard references.
|
|
25786
25794
|
*/
|
|
25787
25795
|
function convertTableFormulaReferences(convertedSheets, xlsxSheets) {
|
|
25796
|
+
let deconstructedSheets = null;
|
|
25788
25797
|
for (let tableSheet of convertedSheets) {
|
|
25789
25798
|
const tables = xlsxSheets.find((s) => isSheetNameEqual(s.sheetName, tableSheet.name)).tables;
|
|
25799
|
+
if (!tables || tables.length === 0) {
|
|
25800
|
+
continue;
|
|
25801
|
+
}
|
|
25802
|
+
// Only deconstruct sheets if we are sure there are tables to process
|
|
25803
|
+
if (!deconstructedSheets) {
|
|
25804
|
+
deconstructedSheets = deconstructSheets(convertedSheets);
|
|
25805
|
+
}
|
|
25790
25806
|
for (let table of tables) {
|
|
25791
|
-
|
|
25792
|
-
|
|
25793
|
-
for (let xc in
|
|
25794
|
-
const
|
|
25795
|
-
let
|
|
25796
|
-
|
|
25797
|
-
|
|
25798
|
-
|
|
25799
|
-
let endIndex = refIndex + tabRef.length;
|
|
25800
|
-
let openBrackets = 1;
|
|
25801
|
-
while (openBrackets > 0 && endIndex < cellContent.length) {
|
|
25802
|
-
if (cellContent[endIndex] === "[") {
|
|
25803
|
-
openBrackets++;
|
|
25804
|
-
}
|
|
25805
|
-
else if (cellContent[endIndex] === "]") {
|
|
25806
|
-
openBrackets--;
|
|
25807
|
-
}
|
|
25808
|
-
endIndex++;
|
|
25809
|
-
}
|
|
25810
|
-
let reference = cellContent.slice(refIndex + tabRef.length, endIndex - 1);
|
|
25811
|
-
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
25812
|
-
const convertedRef = convertTableReference(sheetPrefix, reference, table, xc);
|
|
25813
|
-
cellContent =
|
|
25814
|
-
cellContent.slice(0, refIndex) + convertedRef + cellContent.slice(endIndex);
|
|
25807
|
+
for (let sheetId in deconstructedSheets) {
|
|
25808
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
25809
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
25810
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
25811
|
+
for (let i = deconstructedCell.length - 3; i >= 0; i -= 2) {
|
|
25812
|
+
const possibleTable = deconstructedSheets[sheetId][xc][i];
|
|
25813
|
+
if (!possibleTable.endsWith(table.name)) {
|
|
25814
|
+
continue;
|
|
25815
25815
|
}
|
|
25816
|
+
const possibleRef = deconstructedSheets[sheetId][xc][i + 1];
|
|
25817
|
+
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
25818
|
+
const convertedRef = convertTableReference(sheetPrefix, possibleRef, table, xc);
|
|
25819
|
+
deconstructedSheets[sheetId][xc][i + 2] =
|
|
25820
|
+
possibleTable.slice(0, possibleTable.indexOf(table.name)) +
|
|
25821
|
+
convertedRef +
|
|
25822
|
+
deconstructedSheets[sheetId][xc][i + 2];
|
|
25823
|
+
deconstructedSheets[sheetId][xc].splice(i, 2);
|
|
25816
25824
|
}
|
|
25817
|
-
sheet.cells[xc] = cellContent;
|
|
25825
|
+
// sheet.cells[xc] = cellContent;
|
|
25818
25826
|
}
|
|
25819
25827
|
}
|
|
25820
25828
|
}
|
|
25821
25829
|
}
|
|
25830
|
+
if (!deconstructedSheets) {
|
|
25831
|
+
return;
|
|
25832
|
+
}
|
|
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
|
+
if (deconstructedCell.length === 1) {
|
|
25838
|
+
sheet.cells[xc] = deconstructedCell[0];
|
|
25839
|
+
continue;
|
|
25840
|
+
}
|
|
25841
|
+
let newContent = "";
|
|
25842
|
+
for (let i = 0; i < deconstructedCell.length; i += 2) {
|
|
25843
|
+
newContent += deconstructedCell[i] + "[" + deconstructedCell[i + 1] + "]";
|
|
25844
|
+
}
|
|
25845
|
+
newContent += deconstructedCell[deconstructedCell.length - 1];
|
|
25846
|
+
sheet.cells[xc] = newContent;
|
|
25847
|
+
}
|
|
25848
|
+
}
|
|
25849
|
+
}
|
|
25850
|
+
/**
|
|
25851
|
+
* Deconstruct the content of the cells in the sheets to extract possible table references.
|
|
25852
|
+
* Example from "=AVERAGE(Table1[colName1])-AVERAGE(Table2[colName2])":
|
|
25853
|
+
* return --> ["=AVERAGE(Table1", "colName1", ")-AVERAGE(Table2", "colName2", ")"]
|
|
25854
|
+
*/
|
|
25855
|
+
function deconstructSheets(convertedSheets) {
|
|
25856
|
+
const deconstructedSheets = {};
|
|
25857
|
+
for (let sheet of convertedSheets) {
|
|
25858
|
+
for (let xc in sheet.cells) {
|
|
25859
|
+
const cellContent = sheet.cells[xc];
|
|
25860
|
+
if (!cellContent || !cellContent.startsWith("=")) {
|
|
25861
|
+
continue;
|
|
25862
|
+
}
|
|
25863
|
+
const startIndex = cellContent.indexOf("[");
|
|
25864
|
+
if (startIndex === -1) {
|
|
25865
|
+
continue;
|
|
25866
|
+
}
|
|
25867
|
+
const deconstructedCell = [];
|
|
25868
|
+
let possibleTable = cellContent.slice(0, startIndex);
|
|
25869
|
+
let possibleRef = "";
|
|
25870
|
+
let openBrackets = 1;
|
|
25871
|
+
let mainPossibleTableIndex = 0;
|
|
25872
|
+
let mainOpenBracketIndex = startIndex;
|
|
25873
|
+
for (let index = startIndex + 1; index < cellContent.length; index++) {
|
|
25874
|
+
if (cellContent[index] === "[") {
|
|
25875
|
+
if (openBrackets === 0) {
|
|
25876
|
+
possibleTable = cellContent.slice(mainPossibleTableIndex, index);
|
|
25877
|
+
mainOpenBracketIndex = index;
|
|
25878
|
+
}
|
|
25879
|
+
openBrackets++;
|
|
25880
|
+
continue;
|
|
25881
|
+
}
|
|
25882
|
+
if (cellContent[index] === "]") {
|
|
25883
|
+
openBrackets--;
|
|
25884
|
+
if (openBrackets === 0) {
|
|
25885
|
+
possibleRef = cellContent.slice(mainOpenBracketIndex + 1, index);
|
|
25886
|
+
deconstructedCell.push(possibleTable);
|
|
25887
|
+
deconstructedCell.push(possibleRef);
|
|
25888
|
+
mainPossibleTableIndex = index + 1;
|
|
25889
|
+
}
|
|
25890
|
+
}
|
|
25891
|
+
}
|
|
25892
|
+
if (deconstructedCell.length) {
|
|
25893
|
+
if (!deconstructedSheets[sheet.id]) {
|
|
25894
|
+
deconstructedSheets[sheet.id] = {};
|
|
25895
|
+
}
|
|
25896
|
+
deconstructedCell.push(cellContent.slice(mainPossibleTableIndex));
|
|
25897
|
+
deconstructedSheets[sheet.id][xc] = [...deconstructedCell];
|
|
25898
|
+
}
|
|
25899
|
+
}
|
|
25900
|
+
}
|
|
25901
|
+
return deconstructedSheets;
|
|
25822
25902
|
}
|
|
25823
25903
|
/**
|
|
25824
25904
|
* Convert table-specific references in formulas into standard references. A table reference is composed of columns names,
|
|
@@ -46718,10 +46798,7 @@ class SpreadsheetPivot {
|
|
|
46718
46798
|
if (finalCell.value === null) {
|
|
46719
46799
|
return { value: _t("(Undefined)") };
|
|
46720
46800
|
}
|
|
46721
|
-
return
|
|
46722
|
-
value: finalCell.value,
|
|
46723
|
-
format: finalCell.format,
|
|
46724
|
-
};
|
|
46801
|
+
return finalCell;
|
|
46725
46802
|
}
|
|
46726
46803
|
getPivotCellValueAndFormat(measureId, domain) {
|
|
46727
46804
|
const dataEntries = this.filterDataEntriesFromDomain(this.dataEntries, domain);
|
|
@@ -46952,7 +47029,6 @@ pivotRegistry.add("SPREADSHEET", {
|
|
|
46952
47029
|
ui: SpreadsheetPivot,
|
|
46953
47030
|
definition: SpreadsheetPivotRuntimeDefinition,
|
|
46954
47031
|
externalData: false,
|
|
46955
|
-
onIterationEndEvaluation: (pivot) => pivot.markAsDirtyForEvaluation(),
|
|
46956
47032
|
dateGranularities: [...dateGranularities],
|
|
46957
47033
|
datetimeGranularities: [...dateGranularities, "hour_number", "minute_number", "second_number"],
|
|
46958
47034
|
isMeasureCandidate: (field) => !["datetime", "boolean"].includes(field.type),
|
|
@@ -59586,7 +59662,7 @@ const onIterationEndEvaluationRegistry = new Registry();
|
|
|
59586
59662
|
onIterationEndEvaluationRegistry.add("pivots", (getters) => {
|
|
59587
59663
|
for (const pivotId of getters.getPivotIds()) {
|
|
59588
59664
|
const pivot = getters.getPivot(pivotId);
|
|
59589
|
-
|
|
59665
|
+
pivot.markAsDirtyForEvaluation?.();
|
|
59590
59666
|
}
|
|
59591
59667
|
});
|
|
59592
59668
|
|
|
@@ -62585,13 +62661,13 @@ function withPivotPresentationLayer (PivotClass) {
|
|
|
62585
62661
|
super(custom, params);
|
|
62586
62662
|
this.getters = params.getters;
|
|
62587
62663
|
}
|
|
62588
|
-
|
|
62664
|
+
markAsDirtyForEvaluation() {
|
|
62589
62665
|
this.cache = {};
|
|
62590
62666
|
this.rankAsc = {};
|
|
62591
62667
|
this.rankDesc = {};
|
|
62592
62668
|
this.runningTotal = {};
|
|
62593
62669
|
this.runningTotalInPercent = {};
|
|
62594
|
-
super.
|
|
62670
|
+
super.markAsDirtyForEvaluation?.();
|
|
62595
62671
|
}
|
|
62596
62672
|
getPivotCellValueAndFormat(measureName, domain) {
|
|
62597
62673
|
return this.getMeasureDisplayValue(measureName, domain);
|
|
@@ -62716,7 +62792,7 @@ function withPivotPresentationLayer (PivotClass) {
|
|
|
62716
62792
|
return this.getSubTreeMatchingDomain(node.children, domain, domainLevel + 1);
|
|
62717
62793
|
}
|
|
62718
62794
|
}
|
|
62719
|
-
return
|
|
62795
|
+
return [];
|
|
62720
62796
|
}
|
|
62721
62797
|
treeToLeafDomains(tree, parentDomain = []) {
|
|
62722
62798
|
const domains = [];
|
|
@@ -76584,6 +76660,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
|
|
|
76584
76660
|
export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, 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 };
|
|
76585
76661
|
|
|
76586
76662
|
|
|
76587
|
-
__info__.version = "18.1.
|
|
76588
|
-
__info__.date = "2025-
|
|
76589
|
-
__info__.hash = "
|
|
76663
|
+
__info__.version = "18.1.29";
|
|
76664
|
+
__info__.date = "2025-07-11T11:11:55.442Z";
|
|
76665
|
+
__info__.hash = "3456a93";
|