@odoo/o-spreadsheet 18.1.27 → 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 +144 -55
- package/dist/o-spreadsheet.d.ts +2 -2
- package/dist/o-spreadsheet.esm.js +144 -55
- package/dist/o-spreadsheet.iife.js +144 -55
- 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
|
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);
|
|
@@ -21025,7 +21033,7 @@ class AbstractComposerStore extends SpreadsheetStore {
|
|
|
21025
21033
|
}
|
|
21026
21034
|
captureSelection(zone, col, row) {
|
|
21027
21035
|
this.model.selection.capture(this, {
|
|
21028
|
-
cell: { col: col
|
|
21036
|
+
cell: { col: col ?? zone.left, row: row ?? zone.right },
|
|
21029
21037
|
zone,
|
|
21030
21038
|
}, {
|
|
21031
21039
|
handleEvent: this.handleEvent.bind(this),
|
|
@@ -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,
|
|
@@ -42797,6 +42877,9 @@ class ConditionalFormattingPanel extends Component {
|
|
|
42797
42877
|
this.switchToList();
|
|
42798
42878
|
}
|
|
42799
42879
|
}
|
|
42880
|
+
else if (!this.editedCF) {
|
|
42881
|
+
this.switchToList();
|
|
42882
|
+
}
|
|
42800
42883
|
});
|
|
42801
42884
|
}
|
|
42802
42885
|
get conditionalFormats() {
|
|
@@ -46715,10 +46798,7 @@ class SpreadsheetPivot {
|
|
|
46715
46798
|
if (finalCell.value === null) {
|
|
46716
46799
|
return { value: _t("(Undefined)") };
|
|
46717
46800
|
}
|
|
46718
|
-
return
|
|
46719
|
-
value: finalCell.value,
|
|
46720
|
-
format: finalCell.format,
|
|
46721
|
-
};
|
|
46801
|
+
return finalCell;
|
|
46722
46802
|
}
|
|
46723
46803
|
getPivotCellValueAndFormat(measureId, domain) {
|
|
46724
46804
|
const dataEntries = this.filterDataEntriesFromDomain(this.dataEntries, domain);
|
|
@@ -46949,7 +47029,6 @@ pivotRegistry.add("SPREADSHEET", {
|
|
|
46949
47029
|
ui: SpreadsheetPivot,
|
|
46950
47030
|
definition: SpreadsheetPivotRuntimeDefinition,
|
|
46951
47031
|
externalData: false,
|
|
46952
|
-
onIterationEndEvaluation: (pivot) => pivot.markAsDirtyForEvaluation(),
|
|
46953
47032
|
dateGranularities: [...dateGranularities],
|
|
46954
47033
|
datetimeGranularities: [...dateGranularities, "hour_number", "minute_number", "second_number"],
|
|
46955
47034
|
isMeasureCandidate: (field) => !["datetime", "boolean"].includes(field.type),
|
|
@@ -59583,7 +59662,7 @@ const onIterationEndEvaluationRegistry = new Registry();
|
|
|
59583
59662
|
onIterationEndEvaluationRegistry.add("pivots", (getters) => {
|
|
59584
59663
|
for (const pivotId of getters.getPivotIds()) {
|
|
59585
59664
|
const pivot = getters.getPivot(pivotId);
|
|
59586
|
-
|
|
59665
|
+
pivot.markAsDirtyForEvaluation?.();
|
|
59587
59666
|
}
|
|
59588
59667
|
});
|
|
59589
59668
|
|
|
@@ -62582,13 +62661,13 @@ function withPivotPresentationLayer (PivotClass) {
|
|
|
62582
62661
|
super(custom, params);
|
|
62583
62662
|
this.getters = params.getters;
|
|
62584
62663
|
}
|
|
62585
|
-
|
|
62664
|
+
markAsDirtyForEvaluation() {
|
|
62586
62665
|
this.cache = {};
|
|
62587
62666
|
this.rankAsc = {};
|
|
62588
62667
|
this.rankDesc = {};
|
|
62589
62668
|
this.runningTotal = {};
|
|
62590
62669
|
this.runningTotalInPercent = {};
|
|
62591
|
-
super.
|
|
62670
|
+
super.markAsDirtyForEvaluation?.();
|
|
62592
62671
|
}
|
|
62593
62672
|
getPivotCellValueAndFormat(measureName, domain) {
|
|
62594
62673
|
return this.getMeasureDisplayValue(measureName, domain);
|
|
@@ -62713,7 +62792,7 @@ function withPivotPresentationLayer (PivotClass) {
|
|
|
62713
62792
|
return this.getSubTreeMatchingDomain(node.children, domain, domainLevel + 1);
|
|
62714
62793
|
}
|
|
62715
62794
|
}
|
|
62716
|
-
return
|
|
62795
|
+
return [];
|
|
62717
62796
|
}
|
|
62718
62797
|
treeToLeafDomains(tree, parentDomain = []) {
|
|
62719
62798
|
const domains = [];
|
|
@@ -73245,26 +73324,28 @@ class SelectionStreamProcessorImpl {
|
|
|
73245
73324
|
bottom: Math.min(this.getters.getNumberRows(sheetId) - 1, bottom),
|
|
73246
73325
|
};
|
|
73247
73326
|
};
|
|
73248
|
-
const {
|
|
73327
|
+
const { cell: refCell, zone: refZone } = this.getReferenceAnchor();
|
|
73328
|
+
const { col: refCol, row: refRow } = refCell;
|
|
73249
73329
|
// check if we can shrink selection
|
|
73250
73330
|
let n = 0;
|
|
73251
73331
|
while (result !== null) {
|
|
73252
73332
|
n++;
|
|
73253
73333
|
if (deltaCol < 0) {
|
|
73254
73334
|
const newRight = this.getNextAvailableCol(deltaCol, right - (n - 1), refRow);
|
|
73255
|
-
result =
|
|
73335
|
+
result = refZone.right <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
|
|
73256
73336
|
}
|
|
73257
73337
|
if (deltaCol > 0) {
|
|
73258
73338
|
const newLeft = this.getNextAvailableCol(deltaCol, left + (n - 1), refRow);
|
|
73259
|
-
result = left + n <=
|
|
73339
|
+
result = left + n <= refZone.left ? expand({ top, left: newLeft, bottom, right }) : null;
|
|
73260
73340
|
}
|
|
73261
73341
|
if (deltaRow < 0) {
|
|
73262
73342
|
const newBottom = this.getNextAvailableRow(deltaRow, refCol, bottom - (n - 1));
|
|
73263
|
-
result =
|
|
73343
|
+
result =
|
|
73344
|
+
refZone.bottom <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
|
|
73264
73345
|
}
|
|
73265
73346
|
if (deltaRow > 0) {
|
|
73266
73347
|
const newTop = this.getNextAvailableRow(deltaRow, refCol, top + (n - 1));
|
|
73267
|
-
result = top + n <=
|
|
73348
|
+
result = top + n <= refZone.top ? expand({ top: newTop, left, bottom, right }) : null;
|
|
73268
73349
|
}
|
|
73269
73350
|
result = result ? reorderZone(result) : result;
|
|
73270
73351
|
if (result && !isEqual(result, anchor.zone)) {
|
|
@@ -73494,18 +73575,26 @@ class SelectionStreamProcessorImpl {
|
|
|
73494
73575
|
* If the anchor is hidden, browses from left to right and top to bottom to
|
|
73495
73576
|
* find a visible cell.
|
|
73496
73577
|
*/
|
|
73497
|
-
|
|
73578
|
+
getReferenceAnchor() {
|
|
73498
73579
|
const sheetId = this.getters.getActiveSheetId();
|
|
73499
73580
|
const anchor = this.anchor;
|
|
73500
73581
|
const { left, right, top, bottom } = anchor.zone;
|
|
73501
73582
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
73583
|
+
const col = this.getters.isColHidden(sheetId, anchorCol)
|
|
73584
|
+
? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
|
|
73585
|
+
: anchorCol;
|
|
73586
|
+
const row = this.getters.isRowHidden(sheetId, anchorRow)
|
|
73587
|
+
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
73588
|
+
: anchorRow;
|
|
73589
|
+
const zone = this.getters.expandZone(sheetId, {
|
|
73590
|
+
left: col,
|
|
73591
|
+
right: col,
|
|
73592
|
+
top: row,
|
|
73593
|
+
bottom: row,
|
|
73594
|
+
});
|
|
73502
73595
|
return {
|
|
73503
|
-
|
|
73504
|
-
|
|
73505
|
-
: anchorCol,
|
|
73506
|
-
row: this.getters.isRowHidden(sheetId, anchorRow)
|
|
73507
|
-
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
73508
|
-
: anchorRow,
|
|
73596
|
+
cell: { col, row },
|
|
73597
|
+
zone,
|
|
73509
73598
|
};
|
|
73510
73599
|
}
|
|
73511
73600
|
deltaToTarget(position, direction, step) {
|
|
@@ -76571,6 +76660,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
|
|
|
76571
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 };
|
|
76572
76661
|
|
|
76573
76662
|
|
|
76574
|
-
__info__.version = "18.1.
|
|
76575
|
-
__info__.date = "2025-
|
|
76576
|
-
__info__.hash = "
|
|
76663
|
+
__info__.version = "18.1.29";
|
|
76664
|
+
__info__.date = "2025-07-11T11:11:55.442Z";
|
|
76665
|
+
__info__.hash = "3456a93";
|