@odoo/o-spreadsheet 18.0.35 → 18.0.37
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 +139 -52
- package/dist/o-spreadsheet.d.ts +2 -2
- package/dist/o-spreadsheet.esm.js +139 -52
- package/dist/o-spreadsheet.iife.js +139 -52
- package/dist/o-spreadsheet.iife.min.js +364 -364
- 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.0.
|
|
6
|
-
* @date 2025-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.0.37
|
|
6
|
+
* @date 2025-07-11T11:11:13.394Z
|
|
7
|
+
* @hash bc6f00d
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -819,6 +819,7 @@ const specialWhiteSpaceSpecialCharacters = [
|
|
|
819
819
|
];
|
|
820
820
|
const specialWhiteSpaceRegexp = new RegExp(specialWhiteSpaceSpecialCharacters.join("|"), "g");
|
|
821
821
|
const newLineRegexp = /(\r\n|\r)/g;
|
|
822
|
+
const whiteSpaceCharacters = specialWhiteSpaceSpecialCharacters.concat([" "]);
|
|
822
823
|
/**
|
|
823
824
|
* Replace all different newlines characters by \n
|
|
824
825
|
*/
|
|
@@ -2662,8 +2663,9 @@ const INITIAL_JS_DAY = DateTime.fromTimestamp(0);
|
|
|
2662
2663
|
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY.getTime() - INITIAL_1900_DAY.getTime();
|
|
2663
2664
|
const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
|
|
2664
2665
|
const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
|
|
2665
|
-
const
|
|
2666
|
-
const
|
|
2666
|
+
const whiteSpaceChars = whiteSpaceCharacters.join("");
|
|
2667
|
+
const dateSeparatorsRegex = new RegExp(`\/|-|${whiteSpaceCharacters.join("|")}`);
|
|
2668
|
+
const dateRegexp = new RegExp(`^(\\d{1,4})[\/${whiteSpaceChars}\-](\\d{1,4})([\/${whiteSpaceChars}\-](\\d{1,4}))?$`);
|
|
2667
2669
|
const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
|
|
2668
2670
|
/** Convert a value number representing a date, or return undefined if it isn't possible */
|
|
2669
2671
|
function valueToDateNumber(value, locale) {
|
|
@@ -6366,6 +6368,8 @@ function splitWordToSpecificWidth(ctx, word, width, style) {
|
|
|
6366
6368
|
function splitTextToWidth(ctx, text, style, width) {
|
|
6367
6369
|
if (!style)
|
|
6368
6370
|
style = {};
|
|
6371
|
+
if (isMarkdownLink(text))
|
|
6372
|
+
text = parseMarkdownLink(text).label;
|
|
6369
6373
|
const brokenText = [];
|
|
6370
6374
|
// Checking if text contains NEWLINE before split makes it very slightly slower if text contains it,
|
|
6371
6375
|
// but 5-10x faster if it doesn't
|
|
@@ -8319,6 +8323,10 @@ function toNormalizedPivotValue(dimension, groupValue) {
|
|
|
8319
8323
|
if (groupValue === null || groupValue === "null") {
|
|
8320
8324
|
return null;
|
|
8321
8325
|
}
|
|
8326
|
+
const extractedGroupValue = typeof groupValue === "object" ? groupValue.value : groupValue;
|
|
8327
|
+
if (isEvaluationError(extractedGroupValue)) {
|
|
8328
|
+
return extractedGroupValue;
|
|
8329
|
+
}
|
|
8322
8330
|
const groupValueString = typeof groupValue === "boolean"
|
|
8323
8331
|
? toString(groupValue).toLocaleLowerCase()
|
|
8324
8332
|
: toString(groupValue);
|
|
@@ -12966,38 +12974,111 @@ function convertPivotTableConfig(pivotTable) {
|
|
|
12966
12974
|
* In all the sheets, replace the table-only references in the formula cells with standard references.
|
|
12967
12975
|
*/
|
|
12968
12976
|
function convertTableFormulaReferences(convertedSheets, xlsxSheets) {
|
|
12977
|
+
let deconstructedSheets = null;
|
|
12969
12978
|
for (let tableSheet of convertedSheets) {
|
|
12970
12979
|
const tables = xlsxSheets.find((s) => isSheetNameEqual(s.sheetName, tableSheet.name)).tables;
|
|
12980
|
+
if (!tables || tables.length === 0) {
|
|
12981
|
+
continue;
|
|
12982
|
+
}
|
|
12983
|
+
// Only deconstruct sheets if we are sure there are tables to process
|
|
12984
|
+
if (!deconstructedSheets) {
|
|
12985
|
+
deconstructedSheets = deconstructSheets(convertedSheets);
|
|
12986
|
+
}
|
|
12971
12987
|
for (let table of tables) {
|
|
12972
|
-
|
|
12973
|
-
|
|
12974
|
-
for (let xc in
|
|
12975
|
-
const
|
|
12976
|
-
|
|
12977
|
-
|
|
12978
|
-
|
|
12979
|
-
|
|
12980
|
-
let openBrackets = 1;
|
|
12981
|
-
while (openBrackets > 0 && endIndex < cell.content.length) {
|
|
12982
|
-
if (cell.content[endIndex] === "[") {
|
|
12983
|
-
openBrackets++;
|
|
12984
|
-
}
|
|
12985
|
-
else if (cell.content[endIndex] === "]") {
|
|
12986
|
-
openBrackets--;
|
|
12987
|
-
}
|
|
12988
|
-
endIndex++;
|
|
12989
|
-
}
|
|
12990
|
-
let reference = cell.content.slice(refIndex + tabRef.length, endIndex - 1);
|
|
12991
|
-
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
12992
|
-
const convertedRef = convertTableReference(sheetPrefix, reference, table, xc);
|
|
12993
|
-
cell.content =
|
|
12994
|
-
cell.content.slice(0, refIndex) + convertedRef + cell.content.slice(endIndex);
|
|
12988
|
+
for (let sheetId in deconstructedSheets) {
|
|
12989
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
12990
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
12991
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
12992
|
+
for (let i = deconstructedCell.length - 3; i >= 0; i -= 2) {
|
|
12993
|
+
const possibleTable = deconstructedSheets[sheetId][xc][i];
|
|
12994
|
+
if (!possibleTable.endsWith(table.name)) {
|
|
12995
|
+
continue;
|
|
12995
12996
|
}
|
|
12997
|
+
const possibleRef = deconstructedSheets[sheetId][xc][i + 1];
|
|
12998
|
+
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
12999
|
+
const convertedRef = convertTableReference(sheetPrefix, possibleRef, table, xc);
|
|
13000
|
+
deconstructedSheets[sheetId][xc][i + 2] =
|
|
13001
|
+
possibleTable.slice(0, possibleTable.indexOf(table.name)) +
|
|
13002
|
+
convertedRef +
|
|
13003
|
+
deconstructedSheets[sheetId][xc][i + 2];
|
|
13004
|
+
deconstructedSheets[sheetId][xc].splice(i, 2);
|
|
13005
|
+
}
|
|
13006
|
+
}
|
|
13007
|
+
}
|
|
13008
|
+
}
|
|
13009
|
+
}
|
|
13010
|
+
if (!deconstructedSheets) {
|
|
13011
|
+
return;
|
|
13012
|
+
}
|
|
13013
|
+
for (let sheetId in deconstructedSheets) {
|
|
13014
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
13015
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
13016
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
13017
|
+
if (deconstructedCell.length === 1) {
|
|
13018
|
+
sheet.cells[xc].content = deconstructedCell[0];
|
|
13019
|
+
continue;
|
|
13020
|
+
}
|
|
13021
|
+
let newContent = "";
|
|
13022
|
+
for (let i = 0; i < deconstructedCell.length; i += 2) {
|
|
13023
|
+
newContent += deconstructedCell[i] + "[" + deconstructedCell[i + 1] + "]";
|
|
13024
|
+
}
|
|
13025
|
+
newContent += deconstructedCell[deconstructedCell.length - 1];
|
|
13026
|
+
sheet.cells[xc].content = newContent;
|
|
13027
|
+
}
|
|
13028
|
+
}
|
|
13029
|
+
}
|
|
13030
|
+
/**
|
|
13031
|
+
* Deconstruct the content of the cells in the sheets to extract possible table references.
|
|
13032
|
+
* Example from "=AVERAGE(Table1[colName1])-AVERAGE(Table2[colName2])":
|
|
13033
|
+
* return --> ["=AVERAGE(Table1", "colName1", ")-AVERAGE(Table2", "colName2", ")"]
|
|
13034
|
+
*/
|
|
13035
|
+
function deconstructSheets(convertedSheets) {
|
|
13036
|
+
const deconstructedSheets = {};
|
|
13037
|
+
for (let sheet of convertedSheets) {
|
|
13038
|
+
for (let xc in sheet.cells) {
|
|
13039
|
+
const cellContent = sheet.cells[xc]?.content;
|
|
13040
|
+
if (!cellContent || !cellContent.startsWith("=")) {
|
|
13041
|
+
continue;
|
|
13042
|
+
}
|
|
13043
|
+
const startIndex = cellContent.indexOf("[");
|
|
13044
|
+
if (startIndex === -1) {
|
|
13045
|
+
continue;
|
|
13046
|
+
}
|
|
13047
|
+
const deconstructedCell = [];
|
|
13048
|
+
let possibleTable = cellContent.slice(0, startIndex);
|
|
13049
|
+
let possibleRef = "";
|
|
13050
|
+
let openBrackets = 1;
|
|
13051
|
+
let mainPossibleTableIndex = 0;
|
|
13052
|
+
let mainOpenBracketIndex = startIndex;
|
|
13053
|
+
for (let index = startIndex + 1; index < cellContent.length; index++) {
|
|
13054
|
+
if (cellContent[index] === "[") {
|
|
13055
|
+
if (openBrackets === 0) {
|
|
13056
|
+
possibleTable = cellContent.slice(mainPossibleTableIndex, index);
|
|
13057
|
+
mainOpenBracketIndex = index;
|
|
13058
|
+
}
|
|
13059
|
+
openBrackets++;
|
|
13060
|
+
continue;
|
|
13061
|
+
}
|
|
13062
|
+
if (cellContent[index] === "]") {
|
|
13063
|
+
openBrackets--;
|
|
13064
|
+
if (openBrackets === 0) {
|
|
13065
|
+
possibleRef = cellContent.slice(mainOpenBracketIndex + 1, index);
|
|
13066
|
+
deconstructedCell.push(possibleTable);
|
|
13067
|
+
deconstructedCell.push(possibleRef);
|
|
13068
|
+
mainPossibleTableIndex = index + 1;
|
|
12996
13069
|
}
|
|
12997
13070
|
}
|
|
12998
13071
|
}
|
|
13072
|
+
if (deconstructedCell.length) {
|
|
13073
|
+
if (!deconstructedSheets[sheet.id]) {
|
|
13074
|
+
deconstructedSheets[sheet.id] = {};
|
|
13075
|
+
}
|
|
13076
|
+
deconstructedCell.push(cellContent.slice(mainPossibleTableIndex));
|
|
13077
|
+
deconstructedSheets[sheet.id][xc] = [...deconstructedCell];
|
|
13078
|
+
}
|
|
12999
13079
|
}
|
|
13000
13080
|
}
|
|
13081
|
+
return deconstructedSheets;
|
|
13001
13082
|
}
|
|
13002
13083
|
/**
|
|
13003
13084
|
* Convert table-specific references in formulas into standard references. A table reference is composed of columns names,
|
|
@@ -44568,10 +44649,7 @@ class SpreadsheetPivot {
|
|
|
44568
44649
|
if (finalCell.value === null) {
|
|
44569
44650
|
return { value: _t("(Undefined)") };
|
|
44570
44651
|
}
|
|
44571
|
-
return
|
|
44572
|
-
value: finalCell.value,
|
|
44573
|
-
format: finalCell.format,
|
|
44574
|
-
};
|
|
44652
|
+
return finalCell;
|
|
44575
44653
|
}
|
|
44576
44654
|
getPivotCellValueAndFormat(measureId, domain) {
|
|
44577
44655
|
const dataEntries = this.filterDataEntriesFromDomain(this.dataEntries, domain);
|
|
@@ -44802,7 +44880,6 @@ pivotRegistry.add("SPREADSHEET", {
|
|
|
44802
44880
|
ui: SpreadsheetPivot,
|
|
44803
44881
|
definition: SpreadsheetPivotRuntimeDefinition,
|
|
44804
44882
|
externalData: false,
|
|
44805
|
-
onIterationEndEvaluation: (pivot) => pivot.markAsDirtyForEvaluation(),
|
|
44806
44883
|
dateGranularities: [...dateGranularities],
|
|
44807
44884
|
datetimeGranularities: [...dateGranularities, "hour_number", "minute_number", "second_number"],
|
|
44808
44885
|
isMeasureCandidate: (field) => !["datetime", "boolean"].includes(field.type),
|
|
@@ -57473,7 +57550,7 @@ const onIterationEndEvaluationRegistry = new Registry();
|
|
|
57473
57550
|
onIterationEndEvaluationRegistry.add("pivots", (getters) => {
|
|
57474
57551
|
for (const pivotId of getters.getPivotIds()) {
|
|
57475
57552
|
const pivot = getters.getPivot(pivotId);
|
|
57476
|
-
|
|
57553
|
+
pivot.markAsDirtyForEvaluation?.();
|
|
57477
57554
|
}
|
|
57478
57555
|
});
|
|
57479
57556
|
|
|
@@ -60510,13 +60587,13 @@ function withPivotPresentationLayer (PivotClass) {
|
|
|
60510
60587
|
super(custom, params);
|
|
60511
60588
|
this.getters = params.getters;
|
|
60512
60589
|
}
|
|
60513
|
-
|
|
60590
|
+
markAsDirtyForEvaluation() {
|
|
60514
60591
|
this.cache = {};
|
|
60515
60592
|
this.rankAsc = {};
|
|
60516
60593
|
this.rankDesc = {};
|
|
60517
60594
|
this.runningTotal = {};
|
|
60518
60595
|
this.runningTotalInPercent = {};
|
|
60519
|
-
super.
|
|
60596
|
+
super.markAsDirtyForEvaluation?.();
|
|
60520
60597
|
}
|
|
60521
60598
|
getPivotCellValueAndFormat(measureName, domain) {
|
|
60522
60599
|
return this.getMeasureDisplayValue(measureName, domain);
|
|
@@ -60641,7 +60718,7 @@ function withPivotPresentationLayer (PivotClass) {
|
|
|
60641
60718
|
return this.getSubTreeMatchingDomain(node.children, domain, domainLevel + 1);
|
|
60642
60719
|
}
|
|
60643
60720
|
}
|
|
60644
|
-
return
|
|
60721
|
+
return [];
|
|
60645
60722
|
}
|
|
60646
60723
|
treeToLeafDomains(tree, parentDomain = []) {
|
|
60647
60724
|
const domains = [];
|
|
@@ -71196,26 +71273,28 @@ class SelectionStreamProcessorImpl {
|
|
|
71196
71273
|
bottom: Math.min(this.getters.getNumberRows(sheetId) - 1, bottom),
|
|
71197
71274
|
};
|
|
71198
71275
|
};
|
|
71199
|
-
const {
|
|
71276
|
+
const { cell: refCell, zone: refZone } = this.getReferenceAnchor();
|
|
71277
|
+
const { col: refCol, row: refRow } = refCell;
|
|
71200
71278
|
// check if we can shrink selection
|
|
71201
71279
|
let n = 0;
|
|
71202
71280
|
while (result !== null) {
|
|
71203
71281
|
n++;
|
|
71204
71282
|
if (deltaCol < 0) {
|
|
71205
71283
|
const newRight = this.getNextAvailableCol(deltaCol, right - (n - 1), refRow);
|
|
71206
|
-
result =
|
|
71284
|
+
result = refZone.right <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
|
|
71207
71285
|
}
|
|
71208
71286
|
if (deltaCol > 0) {
|
|
71209
71287
|
const newLeft = this.getNextAvailableCol(deltaCol, left + (n - 1), refRow);
|
|
71210
|
-
result = left + n <=
|
|
71288
|
+
result = left + n <= refZone.left ? expand({ top, left: newLeft, bottom, right }) : null;
|
|
71211
71289
|
}
|
|
71212
71290
|
if (deltaRow < 0) {
|
|
71213
71291
|
const newBottom = this.getNextAvailableRow(deltaRow, refCol, bottom - (n - 1));
|
|
71214
|
-
result =
|
|
71292
|
+
result =
|
|
71293
|
+
refZone.bottom <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
|
|
71215
71294
|
}
|
|
71216
71295
|
if (deltaRow > 0) {
|
|
71217
71296
|
const newTop = this.getNextAvailableRow(deltaRow, refCol, top + (n - 1));
|
|
71218
|
-
result = top + n <=
|
|
71297
|
+
result = top + n <= refZone.top ? expand({ top: newTop, left, bottom, right }) : null;
|
|
71219
71298
|
}
|
|
71220
71299
|
result = result ? reorderZone(result) : result;
|
|
71221
71300
|
if (result && !isEqual(result, anchor.zone)) {
|
|
@@ -71445,18 +71524,26 @@ class SelectionStreamProcessorImpl {
|
|
|
71445
71524
|
* If the anchor is hidden, browses from left to right and top to bottom to
|
|
71446
71525
|
* find a visible cell.
|
|
71447
71526
|
*/
|
|
71448
|
-
|
|
71527
|
+
getReferenceAnchor() {
|
|
71449
71528
|
const sheetId = this.getters.getActiveSheetId();
|
|
71450
71529
|
const anchor = this.anchor;
|
|
71451
71530
|
const { left, right, top, bottom } = anchor.zone;
|
|
71452
71531
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
71532
|
+
const col = this.getters.isColHidden(sheetId, anchorCol)
|
|
71533
|
+
? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
|
|
71534
|
+
: anchorCol;
|
|
71535
|
+
const row = this.getters.isRowHidden(sheetId, anchorRow)
|
|
71536
|
+
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
71537
|
+
: anchorRow;
|
|
71538
|
+
const zone = this.getters.expandZone(sheetId, {
|
|
71539
|
+
left: col,
|
|
71540
|
+
right: col,
|
|
71541
|
+
top: row,
|
|
71542
|
+
bottom: row,
|
|
71543
|
+
});
|
|
71453
71544
|
return {
|
|
71454
|
-
|
|
71455
|
-
|
|
71456
|
-
: anchorCol,
|
|
71457
|
-
row: this.getters.isRowHidden(sheetId, anchorRow)
|
|
71458
|
-
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
71459
|
-
: anchorRow,
|
|
71545
|
+
cell: { col, row },
|
|
71546
|
+
zone,
|
|
71460
71547
|
};
|
|
71461
71548
|
}
|
|
71462
71549
|
deltaToTarget(position, direction, step) {
|
|
@@ -74504,6 +74591,6 @@ exports.tokenColors = tokenColors;
|
|
|
74504
74591
|
exports.tokenize = tokenize;
|
|
74505
74592
|
|
|
74506
74593
|
|
|
74507
|
-
__info__.version = "18.0.
|
|
74508
|
-
__info__.date = "2025-
|
|
74509
|
-
__info__.hash = "
|
|
74594
|
+
__info__.version = "18.0.37";
|
|
74595
|
+
__info__.date = "2025-07-11T11:11:13.394Z";
|
|
74596
|
+
__info__.hash = "bc6f00d";
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -4883,6 +4883,7 @@ interface Pivot<T = PivotRuntimeDefinition> {
|
|
|
4883
4883
|
label: string;
|
|
4884
4884
|
}[];
|
|
4885
4885
|
needsReevaluation: boolean;
|
|
4886
|
+
markAsDirtyForEvaluation?(): void;
|
|
4886
4887
|
}
|
|
4887
4888
|
|
|
4888
4889
|
declare class PivotUIPlugin extends UIPlugin {
|
|
@@ -6185,7 +6186,6 @@ interface PivotRegistryItem {
|
|
|
6185
6186
|
ui: PivotUIConstructor;
|
|
6186
6187
|
definition: PivotDefinitionConstructor;
|
|
6187
6188
|
externalData: boolean;
|
|
6188
|
-
onIterationEndEvaluation: (pivot: Pivot) => void;
|
|
6189
6189
|
dateGranularities: string[];
|
|
6190
6190
|
datetimeGranularities: string[];
|
|
6191
6191
|
isMeasureCandidate: (field: PivotField) => boolean;
|
|
@@ -9761,7 +9761,7 @@ declare function createPivotFormula(formulaId: string, cell: PivotTableCell): st
|
|
|
9761
9761
|
* e.g. given the following formula PIVOT.VALUE("1", "stage_id", "42", "status", "won"),
|
|
9762
9762
|
* the two group values are "42" and "won".
|
|
9763
9763
|
*/
|
|
9764
|
-
declare function toNormalizedPivotValue(dimension: Pick<PivotDimension$1, "type" | "displayName" | "granularity">, groupValue:
|
|
9764
|
+
declare function toNormalizedPivotValue(dimension: Pick<PivotDimension$1, "type" | "displayName" | "granularity">, groupValue: Maybe<CellValue | FunctionResultObject>): CellValue;
|
|
9765
9765
|
|
|
9766
9766
|
interface Props$g {
|
|
9767
9767
|
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.0.
|
|
6
|
-
* @date 2025-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.0.37
|
|
6
|
+
* @date 2025-07-11T11:11:13.394Z
|
|
7
|
+
* @hash bc6f00d
|
|
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';
|
|
@@ -817,6 +817,7 @@ const specialWhiteSpaceSpecialCharacters = [
|
|
|
817
817
|
];
|
|
818
818
|
const specialWhiteSpaceRegexp = new RegExp(specialWhiteSpaceSpecialCharacters.join("|"), "g");
|
|
819
819
|
const newLineRegexp = /(\r\n|\r)/g;
|
|
820
|
+
const whiteSpaceCharacters = specialWhiteSpaceSpecialCharacters.concat([" "]);
|
|
820
821
|
/**
|
|
821
822
|
* Replace all different newlines characters by \n
|
|
822
823
|
*/
|
|
@@ -2660,8 +2661,9 @@ const INITIAL_JS_DAY = DateTime.fromTimestamp(0);
|
|
|
2660
2661
|
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY.getTime() - INITIAL_1900_DAY.getTime();
|
|
2661
2662
|
const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
|
|
2662
2663
|
const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
|
|
2663
|
-
const
|
|
2664
|
-
const
|
|
2664
|
+
const whiteSpaceChars = whiteSpaceCharacters.join("");
|
|
2665
|
+
const dateSeparatorsRegex = new RegExp(`\/|-|${whiteSpaceCharacters.join("|")}`);
|
|
2666
|
+
const dateRegexp = new RegExp(`^(\\d{1,4})[\/${whiteSpaceChars}\-](\\d{1,4})([\/${whiteSpaceChars}\-](\\d{1,4}))?$`);
|
|
2665
2667
|
const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
|
|
2666
2668
|
/** Convert a value number representing a date, or return undefined if it isn't possible */
|
|
2667
2669
|
function valueToDateNumber(value, locale) {
|
|
@@ -6364,6 +6366,8 @@ function splitWordToSpecificWidth(ctx, word, width, style) {
|
|
|
6364
6366
|
function splitTextToWidth(ctx, text, style, width) {
|
|
6365
6367
|
if (!style)
|
|
6366
6368
|
style = {};
|
|
6369
|
+
if (isMarkdownLink(text))
|
|
6370
|
+
text = parseMarkdownLink(text).label;
|
|
6367
6371
|
const brokenText = [];
|
|
6368
6372
|
// Checking if text contains NEWLINE before split makes it very slightly slower if text contains it,
|
|
6369
6373
|
// but 5-10x faster if it doesn't
|
|
@@ -8317,6 +8321,10 @@ function toNormalizedPivotValue(dimension, groupValue) {
|
|
|
8317
8321
|
if (groupValue === null || groupValue === "null") {
|
|
8318
8322
|
return null;
|
|
8319
8323
|
}
|
|
8324
|
+
const extractedGroupValue = typeof groupValue === "object" ? groupValue.value : groupValue;
|
|
8325
|
+
if (isEvaluationError(extractedGroupValue)) {
|
|
8326
|
+
return extractedGroupValue;
|
|
8327
|
+
}
|
|
8320
8328
|
const groupValueString = typeof groupValue === "boolean"
|
|
8321
8329
|
? toString(groupValue).toLocaleLowerCase()
|
|
8322
8330
|
: toString(groupValue);
|
|
@@ -12964,38 +12972,111 @@ function convertPivotTableConfig(pivotTable) {
|
|
|
12964
12972
|
* In all the sheets, replace the table-only references in the formula cells with standard references.
|
|
12965
12973
|
*/
|
|
12966
12974
|
function convertTableFormulaReferences(convertedSheets, xlsxSheets) {
|
|
12975
|
+
let deconstructedSheets = null;
|
|
12967
12976
|
for (let tableSheet of convertedSheets) {
|
|
12968
12977
|
const tables = xlsxSheets.find((s) => isSheetNameEqual(s.sheetName, tableSheet.name)).tables;
|
|
12978
|
+
if (!tables || tables.length === 0) {
|
|
12979
|
+
continue;
|
|
12980
|
+
}
|
|
12981
|
+
// Only deconstruct sheets if we are sure there are tables to process
|
|
12982
|
+
if (!deconstructedSheets) {
|
|
12983
|
+
deconstructedSheets = deconstructSheets(convertedSheets);
|
|
12984
|
+
}
|
|
12969
12985
|
for (let table of tables) {
|
|
12970
|
-
|
|
12971
|
-
|
|
12972
|
-
for (let xc in
|
|
12973
|
-
const
|
|
12974
|
-
|
|
12975
|
-
|
|
12976
|
-
|
|
12977
|
-
|
|
12978
|
-
let openBrackets = 1;
|
|
12979
|
-
while (openBrackets > 0 && endIndex < cell.content.length) {
|
|
12980
|
-
if (cell.content[endIndex] === "[") {
|
|
12981
|
-
openBrackets++;
|
|
12982
|
-
}
|
|
12983
|
-
else if (cell.content[endIndex] === "]") {
|
|
12984
|
-
openBrackets--;
|
|
12985
|
-
}
|
|
12986
|
-
endIndex++;
|
|
12987
|
-
}
|
|
12988
|
-
let reference = cell.content.slice(refIndex + tabRef.length, endIndex - 1);
|
|
12989
|
-
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
12990
|
-
const convertedRef = convertTableReference(sheetPrefix, reference, table, xc);
|
|
12991
|
-
cell.content =
|
|
12992
|
-
cell.content.slice(0, refIndex) + convertedRef + cell.content.slice(endIndex);
|
|
12986
|
+
for (let sheetId in deconstructedSheets) {
|
|
12987
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
12988
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
12989
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
12990
|
+
for (let i = deconstructedCell.length - 3; i >= 0; i -= 2) {
|
|
12991
|
+
const possibleTable = deconstructedSheets[sheetId][xc][i];
|
|
12992
|
+
if (!possibleTable.endsWith(table.name)) {
|
|
12993
|
+
continue;
|
|
12993
12994
|
}
|
|
12995
|
+
const possibleRef = deconstructedSheets[sheetId][xc][i + 1];
|
|
12996
|
+
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
12997
|
+
const convertedRef = convertTableReference(sheetPrefix, possibleRef, table, xc);
|
|
12998
|
+
deconstructedSheets[sheetId][xc][i + 2] =
|
|
12999
|
+
possibleTable.slice(0, possibleTable.indexOf(table.name)) +
|
|
13000
|
+
convertedRef +
|
|
13001
|
+
deconstructedSheets[sheetId][xc][i + 2];
|
|
13002
|
+
deconstructedSheets[sheetId][xc].splice(i, 2);
|
|
13003
|
+
}
|
|
13004
|
+
}
|
|
13005
|
+
}
|
|
13006
|
+
}
|
|
13007
|
+
}
|
|
13008
|
+
if (!deconstructedSheets) {
|
|
13009
|
+
return;
|
|
13010
|
+
}
|
|
13011
|
+
for (let sheetId in deconstructedSheets) {
|
|
13012
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
13013
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
13014
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
13015
|
+
if (deconstructedCell.length === 1) {
|
|
13016
|
+
sheet.cells[xc].content = deconstructedCell[0];
|
|
13017
|
+
continue;
|
|
13018
|
+
}
|
|
13019
|
+
let newContent = "";
|
|
13020
|
+
for (let i = 0; i < deconstructedCell.length; i += 2) {
|
|
13021
|
+
newContent += deconstructedCell[i] + "[" + deconstructedCell[i + 1] + "]";
|
|
13022
|
+
}
|
|
13023
|
+
newContent += deconstructedCell[deconstructedCell.length - 1];
|
|
13024
|
+
sheet.cells[xc].content = newContent;
|
|
13025
|
+
}
|
|
13026
|
+
}
|
|
13027
|
+
}
|
|
13028
|
+
/**
|
|
13029
|
+
* Deconstruct the content of the cells in the sheets to extract possible table references.
|
|
13030
|
+
* Example from "=AVERAGE(Table1[colName1])-AVERAGE(Table2[colName2])":
|
|
13031
|
+
* return --> ["=AVERAGE(Table1", "colName1", ")-AVERAGE(Table2", "colName2", ")"]
|
|
13032
|
+
*/
|
|
13033
|
+
function deconstructSheets(convertedSheets) {
|
|
13034
|
+
const deconstructedSheets = {};
|
|
13035
|
+
for (let sheet of convertedSheets) {
|
|
13036
|
+
for (let xc in sheet.cells) {
|
|
13037
|
+
const cellContent = sheet.cells[xc]?.content;
|
|
13038
|
+
if (!cellContent || !cellContent.startsWith("=")) {
|
|
13039
|
+
continue;
|
|
13040
|
+
}
|
|
13041
|
+
const startIndex = cellContent.indexOf("[");
|
|
13042
|
+
if (startIndex === -1) {
|
|
13043
|
+
continue;
|
|
13044
|
+
}
|
|
13045
|
+
const deconstructedCell = [];
|
|
13046
|
+
let possibleTable = cellContent.slice(0, startIndex);
|
|
13047
|
+
let possibleRef = "";
|
|
13048
|
+
let openBrackets = 1;
|
|
13049
|
+
let mainPossibleTableIndex = 0;
|
|
13050
|
+
let mainOpenBracketIndex = startIndex;
|
|
13051
|
+
for (let index = startIndex + 1; index < cellContent.length; index++) {
|
|
13052
|
+
if (cellContent[index] === "[") {
|
|
13053
|
+
if (openBrackets === 0) {
|
|
13054
|
+
possibleTable = cellContent.slice(mainPossibleTableIndex, index);
|
|
13055
|
+
mainOpenBracketIndex = index;
|
|
13056
|
+
}
|
|
13057
|
+
openBrackets++;
|
|
13058
|
+
continue;
|
|
13059
|
+
}
|
|
13060
|
+
if (cellContent[index] === "]") {
|
|
13061
|
+
openBrackets--;
|
|
13062
|
+
if (openBrackets === 0) {
|
|
13063
|
+
possibleRef = cellContent.slice(mainOpenBracketIndex + 1, index);
|
|
13064
|
+
deconstructedCell.push(possibleTable);
|
|
13065
|
+
deconstructedCell.push(possibleRef);
|
|
13066
|
+
mainPossibleTableIndex = index + 1;
|
|
12994
13067
|
}
|
|
12995
13068
|
}
|
|
12996
13069
|
}
|
|
13070
|
+
if (deconstructedCell.length) {
|
|
13071
|
+
if (!deconstructedSheets[sheet.id]) {
|
|
13072
|
+
deconstructedSheets[sheet.id] = {};
|
|
13073
|
+
}
|
|
13074
|
+
deconstructedCell.push(cellContent.slice(mainPossibleTableIndex));
|
|
13075
|
+
deconstructedSheets[sheet.id][xc] = [...deconstructedCell];
|
|
13076
|
+
}
|
|
12997
13077
|
}
|
|
12998
13078
|
}
|
|
13079
|
+
return deconstructedSheets;
|
|
12999
13080
|
}
|
|
13000
13081
|
/**
|
|
13001
13082
|
* Convert table-specific references in formulas into standard references. A table reference is composed of columns names,
|
|
@@ -44566,10 +44647,7 @@ class SpreadsheetPivot {
|
|
|
44566
44647
|
if (finalCell.value === null) {
|
|
44567
44648
|
return { value: _t("(Undefined)") };
|
|
44568
44649
|
}
|
|
44569
|
-
return
|
|
44570
|
-
value: finalCell.value,
|
|
44571
|
-
format: finalCell.format,
|
|
44572
|
-
};
|
|
44650
|
+
return finalCell;
|
|
44573
44651
|
}
|
|
44574
44652
|
getPivotCellValueAndFormat(measureId, domain) {
|
|
44575
44653
|
const dataEntries = this.filterDataEntriesFromDomain(this.dataEntries, domain);
|
|
@@ -44800,7 +44878,6 @@ pivotRegistry.add("SPREADSHEET", {
|
|
|
44800
44878
|
ui: SpreadsheetPivot,
|
|
44801
44879
|
definition: SpreadsheetPivotRuntimeDefinition,
|
|
44802
44880
|
externalData: false,
|
|
44803
|
-
onIterationEndEvaluation: (pivot) => pivot.markAsDirtyForEvaluation(),
|
|
44804
44881
|
dateGranularities: [...dateGranularities],
|
|
44805
44882
|
datetimeGranularities: [...dateGranularities, "hour_number", "minute_number", "second_number"],
|
|
44806
44883
|
isMeasureCandidate: (field) => !["datetime", "boolean"].includes(field.type),
|
|
@@ -57471,7 +57548,7 @@ const onIterationEndEvaluationRegistry = new Registry();
|
|
|
57471
57548
|
onIterationEndEvaluationRegistry.add("pivots", (getters) => {
|
|
57472
57549
|
for (const pivotId of getters.getPivotIds()) {
|
|
57473
57550
|
const pivot = getters.getPivot(pivotId);
|
|
57474
|
-
|
|
57551
|
+
pivot.markAsDirtyForEvaluation?.();
|
|
57475
57552
|
}
|
|
57476
57553
|
});
|
|
57477
57554
|
|
|
@@ -60508,13 +60585,13 @@ function withPivotPresentationLayer (PivotClass) {
|
|
|
60508
60585
|
super(custom, params);
|
|
60509
60586
|
this.getters = params.getters;
|
|
60510
60587
|
}
|
|
60511
|
-
|
|
60588
|
+
markAsDirtyForEvaluation() {
|
|
60512
60589
|
this.cache = {};
|
|
60513
60590
|
this.rankAsc = {};
|
|
60514
60591
|
this.rankDesc = {};
|
|
60515
60592
|
this.runningTotal = {};
|
|
60516
60593
|
this.runningTotalInPercent = {};
|
|
60517
|
-
super.
|
|
60594
|
+
super.markAsDirtyForEvaluation?.();
|
|
60518
60595
|
}
|
|
60519
60596
|
getPivotCellValueAndFormat(measureName, domain) {
|
|
60520
60597
|
return this.getMeasureDisplayValue(measureName, domain);
|
|
@@ -60639,7 +60716,7 @@ function withPivotPresentationLayer (PivotClass) {
|
|
|
60639
60716
|
return this.getSubTreeMatchingDomain(node.children, domain, domainLevel + 1);
|
|
60640
60717
|
}
|
|
60641
60718
|
}
|
|
60642
|
-
return
|
|
60719
|
+
return [];
|
|
60643
60720
|
}
|
|
60644
60721
|
treeToLeafDomains(tree, parentDomain = []) {
|
|
60645
60722
|
const domains = [];
|
|
@@ -71194,26 +71271,28 @@ class SelectionStreamProcessorImpl {
|
|
|
71194
71271
|
bottom: Math.min(this.getters.getNumberRows(sheetId) - 1, bottom),
|
|
71195
71272
|
};
|
|
71196
71273
|
};
|
|
71197
|
-
const {
|
|
71274
|
+
const { cell: refCell, zone: refZone } = this.getReferenceAnchor();
|
|
71275
|
+
const { col: refCol, row: refRow } = refCell;
|
|
71198
71276
|
// check if we can shrink selection
|
|
71199
71277
|
let n = 0;
|
|
71200
71278
|
while (result !== null) {
|
|
71201
71279
|
n++;
|
|
71202
71280
|
if (deltaCol < 0) {
|
|
71203
71281
|
const newRight = this.getNextAvailableCol(deltaCol, right - (n - 1), refRow);
|
|
71204
|
-
result =
|
|
71282
|
+
result = refZone.right <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
|
|
71205
71283
|
}
|
|
71206
71284
|
if (deltaCol > 0) {
|
|
71207
71285
|
const newLeft = this.getNextAvailableCol(deltaCol, left + (n - 1), refRow);
|
|
71208
|
-
result = left + n <=
|
|
71286
|
+
result = left + n <= refZone.left ? expand({ top, left: newLeft, bottom, right }) : null;
|
|
71209
71287
|
}
|
|
71210
71288
|
if (deltaRow < 0) {
|
|
71211
71289
|
const newBottom = this.getNextAvailableRow(deltaRow, refCol, bottom - (n - 1));
|
|
71212
|
-
result =
|
|
71290
|
+
result =
|
|
71291
|
+
refZone.bottom <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
|
|
71213
71292
|
}
|
|
71214
71293
|
if (deltaRow > 0) {
|
|
71215
71294
|
const newTop = this.getNextAvailableRow(deltaRow, refCol, top + (n - 1));
|
|
71216
|
-
result = top + n <=
|
|
71295
|
+
result = top + n <= refZone.top ? expand({ top: newTop, left, bottom, right }) : null;
|
|
71217
71296
|
}
|
|
71218
71297
|
result = result ? reorderZone(result) : result;
|
|
71219
71298
|
if (result && !isEqual(result, anchor.zone)) {
|
|
@@ -71443,18 +71522,26 @@ class SelectionStreamProcessorImpl {
|
|
|
71443
71522
|
* If the anchor is hidden, browses from left to right and top to bottom to
|
|
71444
71523
|
* find a visible cell.
|
|
71445
71524
|
*/
|
|
71446
|
-
|
|
71525
|
+
getReferenceAnchor() {
|
|
71447
71526
|
const sheetId = this.getters.getActiveSheetId();
|
|
71448
71527
|
const anchor = this.anchor;
|
|
71449
71528
|
const { left, right, top, bottom } = anchor.zone;
|
|
71450
71529
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
71530
|
+
const col = this.getters.isColHidden(sheetId, anchorCol)
|
|
71531
|
+
? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
|
|
71532
|
+
: anchorCol;
|
|
71533
|
+
const row = this.getters.isRowHidden(sheetId, anchorRow)
|
|
71534
|
+
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
71535
|
+
: anchorRow;
|
|
71536
|
+
const zone = this.getters.expandZone(sheetId, {
|
|
71537
|
+
left: col,
|
|
71538
|
+
right: col,
|
|
71539
|
+
top: row,
|
|
71540
|
+
bottom: row,
|
|
71541
|
+
});
|
|
71451
71542
|
return {
|
|
71452
|
-
|
|
71453
|
-
|
|
71454
|
-
: anchorCol,
|
|
71455
|
-
row: this.getters.isRowHidden(sheetId, anchorRow)
|
|
71456
|
-
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
71457
|
-
: anchorRow,
|
|
71543
|
+
cell: { col, row },
|
|
71544
|
+
zone,
|
|
71458
71545
|
};
|
|
71459
71546
|
}
|
|
71460
71547
|
deltaToTarget(position, direction, step) {
|
|
@@ -74459,6 +74546,6 @@ const constants = {
|
|
|
74459
74546
|
export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, 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 };
|
|
74460
74547
|
|
|
74461
74548
|
|
|
74462
|
-
__info__.version = "18.0.
|
|
74463
|
-
__info__.date = "2025-
|
|
74464
|
-
__info__.hash = "
|
|
74549
|
+
__info__.version = "18.0.37";
|
|
74550
|
+
__info__.date = "2025-07-11T11:11:13.394Z";
|
|
74551
|
+
__info__.hash = "bc6f00d";
|