@odoo/o-spreadsheet 16.4.7 → 16.4.9
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 +83 -68
- package/dist/o-spreadsheet.d.ts +1 -1
- package/dist/o-spreadsheet.esm.js +83 -68
- package/dist/o-spreadsheet.iife.js +83 -68
- package/dist/o-spreadsheet.iife.min.js +23 -23
- package/package.json +2 -2
|
@@ -1194,7 +1194,17 @@
|
|
|
1194
1194
|
function isDateTime(str, locale) {
|
|
1195
1195
|
return parseDateTime(str, locale) !== null;
|
|
1196
1196
|
}
|
|
1197
|
+
const CACHE = new Map();
|
|
1197
1198
|
function parseDateTime(str, locale) {
|
|
1199
|
+
if (!CACHE.has(locale)) {
|
|
1200
|
+
CACHE.set(locale, new Map());
|
|
1201
|
+
}
|
|
1202
|
+
if (!CACHE.get(locale).has(str)) {
|
|
1203
|
+
CACHE.get(locale).set(str, _parseDateTime(str, locale));
|
|
1204
|
+
}
|
|
1205
|
+
return CACHE.get(locale).get(str);
|
|
1206
|
+
}
|
|
1207
|
+
function _parseDateTime(str, locale) {
|
|
1198
1208
|
str = str.trim();
|
|
1199
1209
|
let time = null;
|
|
1200
1210
|
const timeMatch = str.match(timeRegexp);
|
|
@@ -3013,8 +3023,9 @@
|
|
|
3013
3023
|
}
|
|
3014
3024
|
get zone() {
|
|
3015
3025
|
const { left, top, bottom, right } = this._zone;
|
|
3016
|
-
if (right !== undefined && bottom !== undefined)
|
|
3017
|
-
return
|
|
3026
|
+
if (right !== undefined && bottom !== undefined) {
|
|
3027
|
+
return this._zone;
|
|
3028
|
+
}
|
|
3018
3029
|
else if (bottom === undefined && right !== undefined) {
|
|
3019
3030
|
return { right, top, left, bottom: this.getSheetSize(this.sheetId).numberOfRows - 1 };
|
|
3020
3031
|
}
|
|
@@ -4284,7 +4295,7 @@
|
|
|
4284
4295
|
const SORT_TYPES_ORDER = ["number", "string", "boolean", "undefined"];
|
|
4285
4296
|
function assert(condition, message) {
|
|
4286
4297
|
if (!condition()) {
|
|
4287
|
-
throw new
|
|
4298
|
+
throw new EvaluationError(CellErrorType.GenericError, message);
|
|
4288
4299
|
}
|
|
4289
4300
|
}
|
|
4290
4301
|
// -----------------------------------------------------------------------------
|
|
@@ -4929,7 +4940,7 @@
|
|
|
4929
4940
|
return textCell((value || "").toString(), localeFormat);
|
|
4930
4941
|
}
|
|
4931
4942
|
catch (error) {
|
|
4932
|
-
return errorCell(
|
|
4943
|
+
return errorCell(new EvaluationError(CellErrorType.GenericError, error.message || DEFAULT_ERROR_MESSAGE));
|
|
4933
4944
|
}
|
|
4934
4945
|
}
|
|
4935
4946
|
function textCell(value, localeFormat) {
|
|
@@ -4996,7 +5007,7 @@
|
|
|
4996
5007
|
formattedValue,
|
|
4997
5008
|
};
|
|
4998
5009
|
}
|
|
4999
|
-
function errorCell(
|
|
5010
|
+
function errorCell(error) {
|
|
5000
5011
|
return {
|
|
5001
5012
|
type: CellValueType.error,
|
|
5002
5013
|
value: error.errorType,
|
|
@@ -5446,6 +5457,9 @@
|
|
|
5446
5457
|
});
|
|
5447
5458
|
this.state.values = this.getFilterValues(this.props.filterPosition);
|
|
5448
5459
|
}
|
|
5460
|
+
get isReadonly() {
|
|
5461
|
+
return this.env.model.getters.isReadonly();
|
|
5462
|
+
}
|
|
5449
5463
|
getFilterValues(position) {
|
|
5450
5464
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
5451
5465
|
const filter = this.env.model.getters.getFilter({ sheetId, ...position });
|
|
@@ -22795,7 +22809,6 @@
|
|
|
22795
22809
|
state = owl.useState(this.initialState());
|
|
22796
22810
|
debounceTimeoutId;
|
|
22797
22811
|
showFormulaState = false;
|
|
22798
|
-
debouncedUpdateSearch;
|
|
22799
22812
|
findAndReplaceRef = owl.useRef("findAndReplace");
|
|
22800
22813
|
get hasSearchResult() {
|
|
22801
22814
|
return this.env.model.getters.getCurrentSelectedMatchIndex() !== null;
|
|
@@ -22805,9 +22818,9 @@
|
|
|
22805
22818
|
}
|
|
22806
22819
|
setup() {
|
|
22807
22820
|
this.showFormulaState = this.env.model.getters.shouldShowFormulas();
|
|
22808
|
-
this.debouncedUpdateSearch = debounce(this.updateSearch.bind(this), 200);
|
|
22809
22821
|
owl.onMounted(() => this.focusInput());
|
|
22810
22822
|
owl.onWillUnmount(() => {
|
|
22823
|
+
clearTimeout(this.debounceTimeoutId);
|
|
22811
22824
|
this.env.model.dispatch("CLEAR_SEARCH");
|
|
22812
22825
|
this.env.model.dispatch("SET_FORMULA_VISIBILITY", { show: this.showFormulaState });
|
|
22813
22826
|
});
|
|
@@ -22852,6 +22865,13 @@
|
|
|
22852
22865
|
searchOptions: this.state.searchOptions,
|
|
22853
22866
|
});
|
|
22854
22867
|
}
|
|
22868
|
+
debouncedUpdateSearch() {
|
|
22869
|
+
clearTimeout(this.debounceTimeoutId);
|
|
22870
|
+
this.debounceTimeoutId = setTimeout(() => {
|
|
22871
|
+
this.updateSearch();
|
|
22872
|
+
this.debounceTimeoutId = undefined;
|
|
22873
|
+
}, 200);
|
|
22874
|
+
}
|
|
22855
22875
|
replace() {
|
|
22856
22876
|
this.env.model.dispatch("REPLACE_SEARCH", {
|
|
22857
22877
|
replaceWith: this.state.replaceWith,
|
|
@@ -31809,10 +31829,11 @@
|
|
|
31809
31829
|
* Reconstructs the original formula string based on a normalized form and its dependencies
|
|
31810
31830
|
*/
|
|
31811
31831
|
buildFormulaContent(sheetId, cell, dependencies) {
|
|
31812
|
-
const ranges = dependencies ||
|
|
31832
|
+
const ranges = dependencies || cell.dependencies;
|
|
31833
|
+
let rangeIndex = 0;
|
|
31813
31834
|
return concat(cell.compiledFormula.tokens.map((token) => {
|
|
31814
31835
|
if (token.type === "REFERENCE") {
|
|
31815
|
-
const range = ranges
|
|
31836
|
+
const range = ranges[rangeIndex++];
|
|
31816
31837
|
return this.getters.getRangeString(range, sheetId);
|
|
31817
31838
|
}
|
|
31818
31839
|
return token.value;
|
|
@@ -35420,7 +35441,7 @@
|
|
|
35420
35441
|
const evaluatedCell = this.getEvaluatedCell(position);
|
|
35421
35442
|
if (evaluatedCell.type === CellValueType.empty) {
|
|
35422
35443
|
const cell = this.getters.getCell(position);
|
|
35423
|
-
if (!cell || cell.content === "") {
|
|
35444
|
+
if (!cell || (!cell.isFormula && cell.content === "")) {
|
|
35424
35445
|
return undefined;
|
|
35425
35446
|
}
|
|
35426
35447
|
}
|
|
@@ -35640,7 +35661,7 @@
|
|
|
35640
35661
|
constructor(context, getters) {
|
|
35641
35662
|
this.context = context;
|
|
35642
35663
|
this.getters = getters;
|
|
35643
|
-
this.compilationParams = buildCompilationParameters(context, getters,
|
|
35664
|
+
this.compilationParams = buildCompilationParameters(this.context, this.getters, this.computeAndSave.bind(this));
|
|
35644
35665
|
}
|
|
35645
35666
|
getEvaluatedCell(position) {
|
|
35646
35667
|
return (this.evaluatedCells.get(this.encodePosition(position)) ||
|
|
@@ -35668,7 +35689,7 @@
|
|
|
35668
35689
|
this.formulaDependencies().addDependencies(positionId, dependencies);
|
|
35669
35690
|
}
|
|
35670
35691
|
updateCompilationParameters() {
|
|
35671
|
-
this.compilationParams = buildCompilationParameters(this.context, this.getters,
|
|
35692
|
+
this.compilationParams = buildCompilationParameters(this.context, this.getters, this.computeAndSave.bind(this));
|
|
35672
35693
|
}
|
|
35673
35694
|
evaluateCells(positions) {
|
|
35674
35695
|
const cells = positions.map(this.encodePosition.bind(this));
|
|
@@ -35784,15 +35805,21 @@
|
|
|
35784
35805
|
this.cellsBeingComputed.delete(cellId);
|
|
35785
35806
|
}
|
|
35786
35807
|
}
|
|
35808
|
+
computeAndSave(position) {
|
|
35809
|
+
const positionId = this.encodePosition(position);
|
|
35810
|
+
const evaluatedCell = this.computeCell(positionId);
|
|
35811
|
+
if (!this.evaluatedCells.has(positionId)) {
|
|
35812
|
+
this.setEvaluatedCell(positionId, evaluatedCell);
|
|
35813
|
+
}
|
|
35814
|
+
return evaluatedCell;
|
|
35815
|
+
}
|
|
35787
35816
|
handleError(e, cell) {
|
|
35788
|
-
if (!(e instanceof
|
|
35789
|
-
e = new
|
|
35817
|
+
if (!(e instanceof EvaluationError)) {
|
|
35818
|
+
e = new EvaluationError(CellErrorType.GenericError, e.message);
|
|
35790
35819
|
}
|
|
35791
|
-
const msg = e?.errorType || CellErrorType.GenericError;
|
|
35792
|
-
// apply function name
|
|
35793
35820
|
const __lastFnCalled = this.compilationParams[2].__lastFnCalled || "";
|
|
35794
|
-
|
|
35795
|
-
return errorCell(
|
|
35821
|
+
e.message = e.message.replace("[[FUNCTION_NAME]]", __lastFnCalled);
|
|
35822
|
+
return errorCell(e);
|
|
35796
35823
|
}
|
|
35797
35824
|
computeFormulaCell(cellData) {
|
|
35798
35825
|
const cellId = cellData.id;
|
|
@@ -38691,14 +38718,10 @@
|
|
|
38691
38718
|
case "REPLACE_ALL_SEARCH":
|
|
38692
38719
|
this.replaceAll(cmd.replaceWith);
|
|
38693
38720
|
break;
|
|
38694
|
-
case "EVALUATE_CELLS":
|
|
38695
|
-
case "UPDATE_CELL":
|
|
38696
|
-
case "REMOVE_FILTER_TABLE":
|
|
38697
|
-
case "UPDATE_FILTER":
|
|
38698
|
-
this.isSearchDirty = true;
|
|
38699
|
-
break;
|
|
38700
38721
|
case "UNDO":
|
|
38701
38722
|
case "REDO":
|
|
38723
|
+
case "REMOVE_FILTER_TABLE":
|
|
38724
|
+
case "UPDATE_FILTER":
|
|
38702
38725
|
case "REMOVE_COLUMNS_ROWS":
|
|
38703
38726
|
case "HIDE_COLUMNS_ROWS":
|
|
38704
38727
|
case "UNHIDE_COLUMNS_ROWS":
|
|
@@ -41359,7 +41382,7 @@
|
|
|
41359
41382
|
});
|
|
41360
41383
|
for (const filterTable of this.copiedTables) {
|
|
41361
41384
|
this.dispatch("REMOVE_FILTER_TABLE", {
|
|
41362
|
-
sheetId: this.
|
|
41385
|
+
sheetId: this.sheetId,
|
|
41363
41386
|
target: [filterTable.zone],
|
|
41364
41387
|
});
|
|
41365
41388
|
}
|
|
@@ -43900,30 +43923,26 @@
|
|
|
43900
43923
|
const { end } = this.getters.getColDimensions(sheetId, targetCol);
|
|
43901
43924
|
const maxCol = this.getters.getNumberCols(sheetId);
|
|
43902
43925
|
if (this.offsetX + this.offsetCorrectionX + this.viewportWidth < end) {
|
|
43903
|
-
|
|
43904
|
-
|
|
43905
|
-
|
|
43906
|
-
}
|
|
43907
|
-
if (this.getters.isColHidden(sheetId, col)) {
|
|
43908
|
-
continue;
|
|
43909
|
-
}
|
|
43910
|
-
this.offsetX = this.getters.getColDimensions(sheetId, col).end - this.offsetCorrectionX;
|
|
43911
|
-
this.offsetScrollbarX = this.offsetX;
|
|
43912
|
-
this.adjustViewportZoneX();
|
|
43926
|
+
let finalTarget = targetCol;
|
|
43927
|
+
while (this.getters.isColHidden(sheetId, finalTarget) && targetCol < maxCol) {
|
|
43928
|
+
finalTarget++;
|
|
43913
43929
|
}
|
|
43930
|
+
const finalTargetEnd = this.getters.getColDimensions(sheetId, finalTarget).end;
|
|
43931
|
+
const startIndex = this.searchHeaderIndex("COL", finalTargetEnd - this.viewportWidth - this.offsetCorrectionX, this.boundaries.left, true);
|
|
43932
|
+
this.offsetX =
|
|
43933
|
+
this.getters.getColDimensions(sheetId, startIndex).end - this.offsetCorrectionX;
|
|
43934
|
+
this.offsetScrollbarX = this.offsetX;
|
|
43935
|
+
this.adjustViewportZoneX();
|
|
43914
43936
|
}
|
|
43915
43937
|
else if (this.left > targetCol) {
|
|
43916
|
-
|
|
43917
|
-
|
|
43918
|
-
|
|
43919
|
-
}
|
|
43920
|
-
if (this.getters.isColHidden(sheetId, col)) {
|
|
43921
|
-
continue;
|
|
43922
|
-
}
|
|
43923
|
-
this.offsetX = this.getters.getColDimensions(sheetId, col).start - this.offsetCorrectionX;
|
|
43924
|
-
this.offsetScrollbarX = this.offsetX;
|
|
43925
|
-
this.adjustViewportZoneX();
|
|
43938
|
+
let finalTarget = targetCol;
|
|
43939
|
+
while (this.getters.isColHidden(sheetId, finalTarget) && targetCol > 0) {
|
|
43940
|
+
finalTarget--;
|
|
43926
43941
|
}
|
|
43942
|
+
this.offsetX =
|
|
43943
|
+
this.getters.getColDimensions(sheetId, finalTarget).start - this.offsetCorrectionX;
|
|
43944
|
+
this.offsetScrollbarX = this.offsetX;
|
|
43945
|
+
this.adjustViewportZoneX();
|
|
43927
43946
|
}
|
|
43928
43947
|
}
|
|
43929
43948
|
adjustPositionY(targetRow) {
|
|
@@ -43931,30 +43950,26 @@
|
|
|
43931
43950
|
const { end } = this.getters.getRowDimensions(sheetId, targetRow);
|
|
43932
43951
|
const maxRow = this.getters.getNumberRows(sheetId);
|
|
43933
43952
|
if (this.offsetY + this.viewportHeight + this.offsetCorrectionY < end) {
|
|
43934
|
-
|
|
43935
|
-
|
|
43936
|
-
|
|
43937
|
-
}
|
|
43938
|
-
if (this.getters.isRowHidden(sheetId, row)) {
|
|
43939
|
-
continue;
|
|
43940
|
-
}
|
|
43941
|
-
this.offsetY = this.getters.getRowDimensions(sheetId, row).end - this.offsetCorrectionY;
|
|
43942
|
-
this.offsetScrollbarY = this.offsetY;
|
|
43943
|
-
this.adjustViewportZoneY();
|
|
43953
|
+
let finalTarget = targetRow;
|
|
43954
|
+
while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow < maxRow) {
|
|
43955
|
+
finalTarget++;
|
|
43944
43956
|
}
|
|
43957
|
+
const finalTargetEnd = this.getters.getRowDimensions(sheetId, finalTarget).end;
|
|
43958
|
+
const startIndex = this.searchHeaderIndex("ROW", finalTargetEnd - this.viewportHeight - this.offsetCorrectionY, this.boundaries.top, true);
|
|
43959
|
+
this.offsetY =
|
|
43960
|
+
this.getters.getRowDimensions(sheetId, startIndex).end - this.offsetCorrectionY;
|
|
43961
|
+
this.offsetScrollbarY = this.offsetY;
|
|
43962
|
+
this.adjustViewportZoneY();
|
|
43945
43963
|
}
|
|
43946
43964
|
else if (this.top > targetRow) {
|
|
43947
|
-
|
|
43948
|
-
|
|
43949
|
-
|
|
43950
|
-
}
|
|
43951
|
-
if (this.getters.isRowHidden(sheetId, row)) {
|
|
43952
|
-
continue;
|
|
43953
|
-
}
|
|
43954
|
-
this.offsetY = this.getters.getRowDimensions(sheetId, row).start - this.offsetCorrectionY;
|
|
43955
|
-
this.offsetScrollbarY = this.offsetY;
|
|
43956
|
-
this.adjustViewportZoneY();
|
|
43965
|
+
let finalTarget = targetRow;
|
|
43966
|
+
while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow > 0) {
|
|
43967
|
+
finalTarget--;
|
|
43957
43968
|
}
|
|
43969
|
+
this.offsetY =
|
|
43970
|
+
this.getters.getRowDimensions(sheetId, finalTarget).start - this.offsetCorrectionY;
|
|
43971
|
+
this.offsetScrollbarY = this.offsetY;
|
|
43972
|
+
this.adjustViewportZoneY();
|
|
43958
43973
|
}
|
|
43959
43974
|
}
|
|
43960
43975
|
setViewportOffset(offsetX, offsetY) {
|
|
@@ -50695,9 +50710,9 @@
|
|
|
50695
50710
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
50696
50711
|
|
|
50697
50712
|
|
|
50698
|
-
__info__.version = '16.4.
|
|
50699
|
-
__info__.date = '2023-
|
|
50700
|
-
__info__.hash = '
|
|
50713
|
+
__info__.version = '16.4.9';
|
|
50714
|
+
__info__.date = '2023-10-10T07:28:12.772Z';
|
|
50715
|
+
__info__.hash = '998c612';
|
|
50701
50716
|
|
|
50702
50717
|
|
|
50703
50718
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|