@odoo/o-spreadsheet 17.3.3 → 17.3.5
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 +58 -27
- package/dist/o-spreadsheet.d.ts +4 -2
- package/dist/o-spreadsheet.esm.js +58 -27
- package/dist/o-spreadsheet.iife.js +58 -27
- package/dist/o-spreadsheet.iife.min.js +343 -343
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +1 -1
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
5
5
|
* @see https://github.com/odoo/o-spreadsheet
|
|
6
|
-
* @version 17.3.
|
|
7
|
-
* @date 2024-06-
|
|
8
|
-
* @hash
|
|
6
|
+
* @version 17.3.5
|
|
7
|
+
* @date 2024-06-26T11:05:50.339Z
|
|
8
|
+
* @hash 54eb151
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
(function (exports, owl) {
|
|
@@ -1897,9 +1897,10 @@
|
|
|
1897
1897
|
sortedValues[indexLow] * (indexSup - percentIndex));
|
|
1898
1898
|
}
|
|
1899
1899
|
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
let
|
|
1900
|
+
const defaultTranslate = (s) => s;
|
|
1901
|
+
const defaultLoaded = () => false;
|
|
1902
|
+
let _translate = defaultTranslate;
|
|
1903
|
+
let _loaded = defaultLoaded;
|
|
1903
1904
|
function sprintf(s, ...values) {
|
|
1904
1905
|
if (values.length === 1 && typeof values[0] === "object" && !(values[0] instanceof String)) {
|
|
1905
1906
|
const valuesDict = values[0];
|
|
@@ -1911,7 +1912,8 @@
|
|
|
1911
1912
|
return s;
|
|
1912
1913
|
}
|
|
1913
1914
|
/***
|
|
1914
|
-
* Allow to inject a translation function from outside o-spreadsheet.
|
|
1915
|
+
* Allow to inject a translation function from outside o-spreadsheet. This should be called before instantiating
|
|
1916
|
+
* a model.
|
|
1915
1917
|
* @param tfn the function that will do the translation
|
|
1916
1918
|
* @param loaded a function that returns true when the translation is loaded
|
|
1917
1919
|
*/
|
|
@@ -1919,6 +1921,18 @@
|
|
|
1919
1921
|
_translate = tfn;
|
|
1920
1922
|
_loaded = loaded;
|
|
1921
1923
|
}
|
|
1924
|
+
/**
|
|
1925
|
+
* If no translation function has been set, this will mark the translation are loaded.
|
|
1926
|
+
*
|
|
1927
|
+
* By default, the translations should not be set as loaded, otherwise top-level translated constants will never be
|
|
1928
|
+
* translated. But if by the time the model is instantiated no custom translation function has been set, we can set
|
|
1929
|
+
* the default translation function as loaded so o-spreadsheet can be run in standalone with no translations.
|
|
1930
|
+
*/
|
|
1931
|
+
function setDefaultTranslationMethod() {
|
|
1932
|
+
if (_translate === defaultTranslate && _loaded === defaultLoaded) {
|
|
1933
|
+
_loaded = () => true;
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1922
1936
|
const _t = function (s, ...values) {
|
|
1923
1937
|
if (!_loaded()) {
|
|
1924
1938
|
return new LazyTranslatedString(s, values);
|
|
@@ -9460,10 +9474,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
9460
9474
|
const refRange = this.getters.getRangeFromSheetXC(activeSheetId, xc);
|
|
9461
9475
|
return isEqual(this.getters.expandZone(activeSheetId, refRange.zone), oldZone);
|
|
9462
9476
|
});
|
|
9463
|
-
// this function assumes that the previous range is always found because
|
|
9464
|
-
// it's called when changing a highlight, which exists by definition
|
|
9465
9477
|
if (!previousRefToken) {
|
|
9466
|
-
|
|
9478
|
+
return;
|
|
9467
9479
|
}
|
|
9468
9480
|
const previousRange = this.getters.getRangeFromSheetXC(activeSheetId, previousRefToken.value);
|
|
9469
9481
|
this.selectionStart = previousRefToken.start;
|
|
@@ -34064,6 +34076,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
34064
34076
|
currentSearchRegex = null;
|
|
34065
34077
|
isSearchDirty = false;
|
|
34066
34078
|
initialShowFormulaState;
|
|
34079
|
+
preserveSelectedMatchIndex = false;
|
|
34067
34080
|
// fixme: why do we make selectedMatchIndex on top of a selected
|
|
34068
34081
|
// property in the matches?
|
|
34069
34082
|
selectedMatchIndex = null;
|
|
@@ -34173,7 +34186,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
34173
34186
|
* refresh the matches according to the current search options
|
|
34174
34187
|
*/
|
|
34175
34188
|
refreshSearch(jumpToMatchSheet = true) {
|
|
34176
|
-
this.
|
|
34189
|
+
if (!this.preserveSelectedMatchIndex) {
|
|
34190
|
+
this.selectedMatchIndex = null;
|
|
34191
|
+
}
|
|
34177
34192
|
this.findMatches();
|
|
34178
34193
|
this.selectNextCell(Direction.current, jumpToMatchSheet);
|
|
34179
34194
|
}
|
|
@@ -34272,10 +34287,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
34272
34287
|
const selectedMatch = matches[nextIndex];
|
|
34273
34288
|
// Switch to the sheet where the match is located
|
|
34274
34289
|
if (jumpToMatchSheet && this.getters.getActiveSheetId() !== selectedMatch.sheetId) {
|
|
34290
|
+
// We set `preserveSelectedMatchIndex` to true to avoid resetting the selected search
|
|
34291
|
+
// index in the `refreshSearch` function when a new sheet is activated. The reason being
|
|
34292
|
+
// that, when we automatically go back to previous sheet while performing a search, the
|
|
34293
|
+
// search index is reset to the first occurrence each time.
|
|
34294
|
+
this.preserveSelectedMatchIndex = true;
|
|
34275
34295
|
this.model.dispatch("ACTIVATE_SHEET", {
|
|
34276
34296
|
sheetIdFrom: this.getters.getActiveSheetId(),
|
|
34277
34297
|
sheetIdTo: selectedMatch.sheetId,
|
|
34278
34298
|
});
|
|
34299
|
+
this.preserveSelectedMatchIndex = false;
|
|
34279
34300
|
// We do not want to reset the selection at finalize in this case
|
|
34280
34301
|
this.isSearchDirty = false;
|
|
34281
34302
|
}
|
|
@@ -34925,7 +34946,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
34925
34946
|
function createPivotDimension(fields, dimension) {
|
|
34926
34947
|
const field = fields[dimension.name];
|
|
34927
34948
|
const type = field?.type ?? "integer";
|
|
34928
|
-
const granularity = field && isDateField(field) ? dimension.granularity
|
|
34949
|
+
const granularity = field && isDateField(field) ? dimension.granularity : undefined;
|
|
34929
34950
|
return {
|
|
34930
34951
|
/**
|
|
34931
34952
|
* Get the display name of the dimension
|
|
@@ -35328,10 +35349,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
35328
35349
|
}
|
|
35329
35350
|
|
|
35330
35351
|
function createDate(dimension, value, locale) {
|
|
35331
|
-
const granularity = dimension.granularity
|
|
35332
|
-
if (!(granularity in MAP_VALUE_DIMENSION_DATE)) {
|
|
35352
|
+
const granularity = dimension.granularity;
|
|
35353
|
+
if (!granularity || !(granularity in MAP_VALUE_DIMENSION_DATE)) {
|
|
35333
35354
|
throw new Error(`Unknown date granularity: ${granularity}`);
|
|
35334
35355
|
}
|
|
35356
|
+
if (value === null) {
|
|
35357
|
+
return null;
|
|
35358
|
+
}
|
|
35335
35359
|
if (!MAP_VALUE_DIMENSION_DATE[granularity].set.has(value)) {
|
|
35336
35360
|
MAP_VALUE_DIMENSION_DATE[granularity].set.add(value);
|
|
35337
35361
|
const date = toJsDate(value, locale);
|
|
@@ -35558,7 +35582,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
35558
35582
|
if (!finalCell) {
|
|
35559
35583
|
return { value: "" };
|
|
35560
35584
|
}
|
|
35561
|
-
|
|
35585
|
+
// Value can be null but stringified (e.g. an empty date, as for now every date is stringified)
|
|
35586
|
+
if (finalCell.value === null || finalCell.value === `${null}`) {
|
|
35562
35587
|
return { value: _t("(Undefined)") };
|
|
35563
35588
|
}
|
|
35564
35589
|
if (dimension.type === "date") {
|
|
@@ -35594,10 +35619,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
35594
35619
|
if (!operator) {
|
|
35595
35620
|
throw new Error(`Aggregator ${aggregator} does not exist`);
|
|
35596
35621
|
}
|
|
35597
|
-
|
|
35598
|
-
|
|
35599
|
-
|
|
35600
|
-
|
|
35622
|
+
try {
|
|
35623
|
+
return {
|
|
35624
|
+
value: values.length ? operator.fn([values], this.getters.getLocale()) : "",
|
|
35625
|
+
format: operator.format(values[0]),
|
|
35626
|
+
};
|
|
35627
|
+
}
|
|
35628
|
+
catch (e) {
|
|
35629
|
+
return handleError(e, aggregator.toUpperCase());
|
|
35630
|
+
}
|
|
35601
35631
|
}
|
|
35602
35632
|
getPossibleFieldValues(groupBy) {
|
|
35603
35633
|
//TODO This method should be implemented for the autocomplete feature
|
|
@@ -52839,7 +52869,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52839
52869
|
if (!this.blockedArrayFormulas.has(position)) {
|
|
52840
52870
|
this.invalidateSpreading(position);
|
|
52841
52871
|
}
|
|
52842
|
-
this.spreadingRelations.removeNode(position);
|
|
52843
52872
|
const cell = this.getters.getCell(position);
|
|
52844
52873
|
if (cell === undefined) {
|
|
52845
52874
|
return EMPTY_CELL;
|
|
@@ -52881,6 +52910,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52881
52910
|
this.assertSheetHasEnoughSpaceToSpreadFormulaResult(formulaPosition, formulaReturn);
|
|
52882
52911
|
const nbColumns = formulaReturn.length;
|
|
52883
52912
|
const nbRows = formulaReturn[0].length;
|
|
52913
|
+
this.spreadingRelations.removeNode(formulaPosition);
|
|
52884
52914
|
forEachSpreadPositionInMatrix(nbColumns, nbRows, this.updateSpreadRelation(formulaPosition));
|
|
52885
52915
|
this.assertNoMergedCellsInSpreadZone(formulaPosition, formulaReturn);
|
|
52886
52916
|
forEachSpreadPositionInMatrix(nbColumns, nbRows, this.checkCollision(formulaPosition));
|
|
@@ -54481,7 +54511,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54481
54511
|
getPivotIdFromPosition(position) {
|
|
54482
54512
|
const cell = this.getters.getCorrespondingFormulaCell(position);
|
|
54483
54513
|
if (cell && cell.isFormula) {
|
|
54484
|
-
const pivotFunction = this.getFirstPivotFunction(cell.compiledFormula.tokens);
|
|
54514
|
+
const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
|
|
54485
54515
|
if (pivotFunction) {
|
|
54486
54516
|
const pivotId = pivotFunction.args[0]?.toString();
|
|
54487
54517
|
return pivotId && this.getters.getPivotId(pivotId);
|
|
@@ -54489,7 +54519,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54489
54519
|
}
|
|
54490
54520
|
return undefined;
|
|
54491
54521
|
}
|
|
54492
|
-
getFirstPivotFunction(tokens) {
|
|
54522
|
+
getFirstPivotFunction(sheetId, tokens) {
|
|
54493
54523
|
const pivotFunction = getFirstPivotFunction(tokens);
|
|
54494
54524
|
if (!pivotFunction) {
|
|
54495
54525
|
return undefined;
|
|
@@ -54505,7 +54535,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54505
54535
|
return argAst.value;
|
|
54506
54536
|
}
|
|
54507
54537
|
const argsString = astToFormula(argAst);
|
|
54508
|
-
return this.getters.evaluateFormula(
|
|
54538
|
+
return this.getters.evaluateFormula(sheetId, argsString);
|
|
54509
54539
|
});
|
|
54510
54540
|
return { functionName, args: evaluatedArgs };
|
|
54511
54541
|
}
|
|
@@ -54528,7 +54558,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54528
54558
|
return undefined;
|
|
54529
54559
|
}
|
|
54530
54560
|
const mainPosition = this.getters.getCellPosition(cell.id);
|
|
54531
|
-
const result = this.getters.getFirstPivotFunction(cell.compiledFormula.tokens);
|
|
54561
|
+
const result = this.getters.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
|
|
54532
54562
|
if (!result) {
|
|
54533
54563
|
return undefined;
|
|
54534
54564
|
}
|
|
@@ -66306,6 +66336,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
66306
66336
|
const start = performance.now();
|
|
66307
66337
|
console.group("Model creation");
|
|
66308
66338
|
super();
|
|
66339
|
+
setDefaultTranslationMethod();
|
|
66309
66340
|
stateUpdateMessages = repairInitialMessages(data, stateUpdateMessages);
|
|
66310
66341
|
const workbookData = load(data, verboseImport);
|
|
66311
66342
|
this.state = new StateObserver();
|
|
@@ -66982,9 +67013,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
66982
67013
|
exports.tokenize = tokenize;
|
|
66983
67014
|
|
|
66984
67015
|
|
|
66985
|
-
__info__.version = "17.3.
|
|
66986
|
-
__info__.date = "2024-06-
|
|
66987
|
-
__info__.hash = "
|
|
67016
|
+
__info__.version = "17.3.5";
|
|
67017
|
+
__info__.date = "2024-06-26T11:05:50.339Z";
|
|
67018
|
+
__info__.hash = "54eb151";
|
|
66988
67019
|
|
|
66989
67020
|
|
|
66990
67021
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|