@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
|
'use strict';
|
|
@@ -1898,9 +1898,10 @@ function percentile(values, percent, isInclusive) {
|
|
|
1898
1898
|
sortedValues[indexLow] * (indexSup - percentIndex));
|
|
1899
1899
|
}
|
|
1900
1900
|
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
let
|
|
1901
|
+
const defaultTranslate = (s) => s;
|
|
1902
|
+
const defaultLoaded = () => false;
|
|
1903
|
+
let _translate = defaultTranslate;
|
|
1904
|
+
let _loaded = defaultLoaded;
|
|
1904
1905
|
function sprintf(s, ...values) {
|
|
1905
1906
|
if (values.length === 1 && typeof values[0] === "object" && !(values[0] instanceof String)) {
|
|
1906
1907
|
const valuesDict = values[0];
|
|
@@ -1912,7 +1913,8 @@ function sprintf(s, ...values) {
|
|
|
1912
1913
|
return s;
|
|
1913
1914
|
}
|
|
1914
1915
|
/***
|
|
1915
|
-
* Allow to inject a translation function from outside o-spreadsheet.
|
|
1916
|
+
* Allow to inject a translation function from outside o-spreadsheet. This should be called before instantiating
|
|
1917
|
+
* a model.
|
|
1916
1918
|
* @param tfn the function that will do the translation
|
|
1917
1919
|
* @param loaded a function that returns true when the translation is loaded
|
|
1918
1920
|
*/
|
|
@@ -1920,6 +1922,18 @@ function setTranslationMethod(tfn, loaded = () => true) {
|
|
|
1920
1922
|
_translate = tfn;
|
|
1921
1923
|
_loaded = loaded;
|
|
1922
1924
|
}
|
|
1925
|
+
/**
|
|
1926
|
+
* If no translation function has been set, this will mark the translation are loaded.
|
|
1927
|
+
*
|
|
1928
|
+
* By default, the translations should not be set as loaded, otherwise top-level translated constants will never be
|
|
1929
|
+
* translated. But if by the time the model is instantiated no custom translation function has been set, we can set
|
|
1930
|
+
* the default translation function as loaded so o-spreadsheet can be run in standalone with no translations.
|
|
1931
|
+
*/
|
|
1932
|
+
function setDefaultTranslationMethod() {
|
|
1933
|
+
if (_translate === defaultTranslate && _loaded === defaultLoaded) {
|
|
1934
|
+
_loaded = () => true;
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1923
1937
|
const _t = function (s, ...values) {
|
|
1924
1938
|
if (!_loaded()) {
|
|
1925
1939
|
return new LazyTranslatedString(s, values);
|
|
@@ -9461,10 +9475,8 @@ class ComposerStore extends SpreadsheetStore {
|
|
|
9461
9475
|
const refRange = this.getters.getRangeFromSheetXC(activeSheetId, xc);
|
|
9462
9476
|
return isEqual(this.getters.expandZone(activeSheetId, refRange.zone), oldZone);
|
|
9463
9477
|
});
|
|
9464
|
-
// this function assumes that the previous range is always found because
|
|
9465
|
-
// it's called when changing a highlight, which exists by definition
|
|
9466
9478
|
if (!previousRefToken) {
|
|
9467
|
-
|
|
9479
|
+
return;
|
|
9468
9480
|
}
|
|
9469
9481
|
const previousRange = this.getters.getRangeFromSheetXC(activeSheetId, previousRefToken.value);
|
|
9470
9482
|
this.selectionStart = previousRefToken.start;
|
|
@@ -34065,6 +34077,7 @@ class FindAndReplaceStore extends SpreadsheetStore {
|
|
|
34065
34077
|
currentSearchRegex = null;
|
|
34066
34078
|
isSearchDirty = false;
|
|
34067
34079
|
initialShowFormulaState;
|
|
34080
|
+
preserveSelectedMatchIndex = false;
|
|
34068
34081
|
// fixme: why do we make selectedMatchIndex on top of a selected
|
|
34069
34082
|
// property in the matches?
|
|
34070
34083
|
selectedMatchIndex = null;
|
|
@@ -34174,7 +34187,9 @@ class FindAndReplaceStore extends SpreadsheetStore {
|
|
|
34174
34187
|
* refresh the matches according to the current search options
|
|
34175
34188
|
*/
|
|
34176
34189
|
refreshSearch(jumpToMatchSheet = true) {
|
|
34177
|
-
this.
|
|
34190
|
+
if (!this.preserveSelectedMatchIndex) {
|
|
34191
|
+
this.selectedMatchIndex = null;
|
|
34192
|
+
}
|
|
34178
34193
|
this.findMatches();
|
|
34179
34194
|
this.selectNextCell(Direction.current, jumpToMatchSheet);
|
|
34180
34195
|
}
|
|
@@ -34273,10 +34288,16 @@ class FindAndReplaceStore extends SpreadsheetStore {
|
|
|
34273
34288
|
const selectedMatch = matches[nextIndex];
|
|
34274
34289
|
// Switch to the sheet where the match is located
|
|
34275
34290
|
if (jumpToMatchSheet && this.getters.getActiveSheetId() !== selectedMatch.sheetId) {
|
|
34291
|
+
// We set `preserveSelectedMatchIndex` to true to avoid resetting the selected search
|
|
34292
|
+
// index in the `refreshSearch` function when a new sheet is activated. The reason being
|
|
34293
|
+
// that, when we automatically go back to previous sheet while performing a search, the
|
|
34294
|
+
// search index is reset to the first occurrence each time.
|
|
34295
|
+
this.preserveSelectedMatchIndex = true;
|
|
34276
34296
|
this.model.dispatch("ACTIVATE_SHEET", {
|
|
34277
34297
|
sheetIdFrom: this.getters.getActiveSheetId(),
|
|
34278
34298
|
sheetIdTo: selectedMatch.sheetId,
|
|
34279
34299
|
});
|
|
34300
|
+
this.preserveSelectedMatchIndex = false;
|
|
34280
34301
|
// We do not want to reset the selection at finalize in this case
|
|
34281
34302
|
this.isSearchDirty = false;
|
|
34282
34303
|
}
|
|
@@ -34926,7 +34947,7 @@ function createMeasure(fields, measure) {
|
|
|
34926
34947
|
function createPivotDimension(fields, dimension) {
|
|
34927
34948
|
const field = fields[dimension.name];
|
|
34928
34949
|
const type = field?.type ?? "integer";
|
|
34929
|
-
const granularity = field && isDateField(field) ? dimension.granularity
|
|
34950
|
+
const granularity = field && isDateField(field) ? dimension.granularity : undefined;
|
|
34930
34951
|
return {
|
|
34931
34952
|
/**
|
|
34932
34953
|
* Get the display name of the dimension
|
|
@@ -35329,10 +35350,13 @@ function compareDimensionValues(dimension, a, b) {
|
|
|
35329
35350
|
}
|
|
35330
35351
|
|
|
35331
35352
|
function createDate(dimension, value, locale) {
|
|
35332
|
-
const granularity = dimension.granularity
|
|
35333
|
-
if (!(granularity in MAP_VALUE_DIMENSION_DATE)) {
|
|
35353
|
+
const granularity = dimension.granularity;
|
|
35354
|
+
if (!granularity || !(granularity in MAP_VALUE_DIMENSION_DATE)) {
|
|
35334
35355
|
throw new Error(`Unknown date granularity: ${granularity}`);
|
|
35335
35356
|
}
|
|
35357
|
+
if (value === null) {
|
|
35358
|
+
return null;
|
|
35359
|
+
}
|
|
35336
35360
|
if (!MAP_VALUE_DIMENSION_DATE[granularity].set.has(value)) {
|
|
35337
35361
|
MAP_VALUE_DIMENSION_DATE[granularity].set.add(value);
|
|
35338
35362
|
const date = toJsDate(value, locale);
|
|
@@ -35559,7 +35583,8 @@ class SpreadsheetPivot {
|
|
|
35559
35583
|
if (!finalCell) {
|
|
35560
35584
|
return { value: "" };
|
|
35561
35585
|
}
|
|
35562
|
-
|
|
35586
|
+
// Value can be null but stringified (e.g. an empty date, as for now every date is stringified)
|
|
35587
|
+
if (finalCell.value === null || finalCell.value === `${null}`) {
|
|
35563
35588
|
return { value: _t("(Undefined)") };
|
|
35564
35589
|
}
|
|
35565
35590
|
if (dimension.type === "date") {
|
|
@@ -35595,10 +35620,15 @@ class SpreadsheetPivot {
|
|
|
35595
35620
|
if (!operator) {
|
|
35596
35621
|
throw new Error(`Aggregator ${aggregator} does not exist`);
|
|
35597
35622
|
}
|
|
35598
|
-
|
|
35599
|
-
|
|
35600
|
-
|
|
35601
|
-
|
|
35623
|
+
try {
|
|
35624
|
+
return {
|
|
35625
|
+
value: values.length ? operator.fn([values], this.getters.getLocale()) : "",
|
|
35626
|
+
format: operator.format(values[0]),
|
|
35627
|
+
};
|
|
35628
|
+
}
|
|
35629
|
+
catch (e) {
|
|
35630
|
+
return handleError(e, aggregator.toUpperCase());
|
|
35631
|
+
}
|
|
35602
35632
|
}
|
|
35603
35633
|
getPossibleFieldValues(groupBy) {
|
|
35604
35634
|
//TODO This method should be implemented for the autocomplete feature
|
|
@@ -52840,7 +52870,6 @@ class Evaluator {
|
|
|
52840
52870
|
if (!this.blockedArrayFormulas.has(position)) {
|
|
52841
52871
|
this.invalidateSpreading(position);
|
|
52842
52872
|
}
|
|
52843
|
-
this.spreadingRelations.removeNode(position);
|
|
52844
52873
|
const cell = this.getters.getCell(position);
|
|
52845
52874
|
if (cell === undefined) {
|
|
52846
52875
|
return EMPTY_CELL;
|
|
@@ -52882,6 +52911,7 @@ class Evaluator {
|
|
|
52882
52911
|
this.assertSheetHasEnoughSpaceToSpreadFormulaResult(formulaPosition, formulaReturn);
|
|
52883
52912
|
const nbColumns = formulaReturn.length;
|
|
52884
52913
|
const nbRows = formulaReturn[0].length;
|
|
52914
|
+
this.spreadingRelations.removeNode(formulaPosition);
|
|
52885
52915
|
forEachSpreadPositionInMatrix(nbColumns, nbRows, this.updateSpreadRelation(formulaPosition));
|
|
52886
52916
|
this.assertNoMergedCellsInSpreadZone(formulaPosition, formulaReturn);
|
|
52887
52917
|
forEachSpreadPositionInMatrix(nbColumns, nbRows, this.checkCollision(formulaPosition));
|
|
@@ -54482,7 +54512,7 @@ class PivotUIPlugin extends UIPlugin {
|
|
|
54482
54512
|
getPivotIdFromPosition(position) {
|
|
54483
54513
|
const cell = this.getters.getCorrespondingFormulaCell(position);
|
|
54484
54514
|
if (cell && cell.isFormula) {
|
|
54485
|
-
const pivotFunction = this.getFirstPivotFunction(cell.compiledFormula.tokens);
|
|
54515
|
+
const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
|
|
54486
54516
|
if (pivotFunction) {
|
|
54487
54517
|
const pivotId = pivotFunction.args[0]?.toString();
|
|
54488
54518
|
return pivotId && this.getters.getPivotId(pivotId);
|
|
@@ -54490,7 +54520,7 @@ class PivotUIPlugin extends UIPlugin {
|
|
|
54490
54520
|
}
|
|
54491
54521
|
return undefined;
|
|
54492
54522
|
}
|
|
54493
|
-
getFirstPivotFunction(tokens) {
|
|
54523
|
+
getFirstPivotFunction(sheetId, tokens) {
|
|
54494
54524
|
const pivotFunction = getFirstPivotFunction(tokens);
|
|
54495
54525
|
if (!pivotFunction) {
|
|
54496
54526
|
return undefined;
|
|
@@ -54506,7 +54536,7 @@ class PivotUIPlugin extends UIPlugin {
|
|
|
54506
54536
|
return argAst.value;
|
|
54507
54537
|
}
|
|
54508
54538
|
const argsString = astToFormula(argAst);
|
|
54509
|
-
return this.getters.evaluateFormula(
|
|
54539
|
+
return this.getters.evaluateFormula(sheetId, argsString);
|
|
54510
54540
|
});
|
|
54511
54541
|
return { functionName, args: evaluatedArgs };
|
|
54512
54542
|
}
|
|
@@ -54529,7 +54559,7 @@ class PivotUIPlugin extends UIPlugin {
|
|
|
54529
54559
|
return undefined;
|
|
54530
54560
|
}
|
|
54531
54561
|
const mainPosition = this.getters.getCellPosition(cell.id);
|
|
54532
|
-
const result = this.getters.getFirstPivotFunction(cell.compiledFormula.tokens);
|
|
54562
|
+
const result = this.getters.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
|
|
54533
54563
|
if (!result) {
|
|
54534
54564
|
return undefined;
|
|
54535
54565
|
}
|
|
@@ -66307,6 +66337,7 @@ class Model extends EventBus {
|
|
|
66307
66337
|
const start = performance.now();
|
|
66308
66338
|
console.group("Model creation");
|
|
66309
66339
|
super();
|
|
66340
|
+
setDefaultTranslationMethod();
|
|
66310
66341
|
stateUpdateMessages = repairInitialMessages(data, stateUpdateMessages);
|
|
66311
66342
|
const workbookData = load(data, verboseImport);
|
|
66312
66343
|
this.state = new StateObserver();
|
|
@@ -66983,6 +67014,6 @@ exports.tokenColors = tokenColors;
|
|
|
66983
67014
|
exports.tokenize = tokenize;
|
|
66984
67015
|
|
|
66985
67016
|
|
|
66986
|
-
__info__.version = "17.3.
|
|
66987
|
-
__info__.date = "2024-06-
|
|
66988
|
-
__info__.hash = "
|
|
67017
|
+
__info__.version = "17.3.5";
|
|
67018
|
+
__info__.date = "2024-06-26T11:05:50.339Z";
|
|
67019
|
+
__info__.hash = "54eb151";
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -4255,7 +4255,7 @@ declare class PivotUIPlugin extends UIPlugin {
|
|
|
4255
4255
|
* is no pivot at this position
|
|
4256
4256
|
*/
|
|
4257
4257
|
getPivotIdFromPosition(position: CellPosition): "" | UID | undefined;
|
|
4258
|
-
getFirstPivotFunction(tokens: Token[]): {
|
|
4258
|
+
getFirstPivotFunction(sheetId: UID, tokens: Token[]): {
|
|
4259
4259
|
functionName: string;
|
|
4260
4260
|
args: (CellValue | Matrix<CellValue> | undefined)[];
|
|
4261
4261
|
} | undefined;
|
|
@@ -8899,6 +8899,7 @@ declare class FindAndReplaceStore extends SpreadsheetStore implements HighlightP
|
|
|
8899
8899
|
private currentSearchRegex;
|
|
8900
8900
|
private isSearchDirty;
|
|
8901
8901
|
private initialShowFormulaState;
|
|
8902
|
+
private preserveSelectedMatchIndex;
|
|
8902
8903
|
selectedMatchIndex: number | null;
|
|
8903
8904
|
toSearch: string;
|
|
8904
8905
|
toReplace: string;
|
|
@@ -10180,7 +10181,8 @@ type SprintfValues = (string | String | number)[] | [{
|
|
|
10180
10181
|
}];
|
|
10181
10182
|
type TranslationFunction = (string: string, ...values: SprintfValues) => string;
|
|
10182
10183
|
/***
|
|
10183
|
-
* Allow to inject a translation function from outside o-spreadsheet.
|
|
10184
|
+
* Allow to inject a translation function from outside o-spreadsheet. This should be called before instantiating
|
|
10185
|
+
* a model.
|
|
10184
10186
|
* @param tfn the function that will do the translation
|
|
10185
10187
|
* @param loaded a function that returns true when the translation is loaded
|
|
10186
10188
|
*/
|
|
@@ -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
|
import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
|
|
@@ -1896,9 +1896,10 @@ function percentile(values, percent, isInclusive) {
|
|
|
1896
1896
|
sortedValues[indexLow] * (indexSup - percentIndex));
|
|
1897
1897
|
}
|
|
1898
1898
|
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
let
|
|
1899
|
+
const defaultTranslate = (s) => s;
|
|
1900
|
+
const defaultLoaded = () => false;
|
|
1901
|
+
let _translate = defaultTranslate;
|
|
1902
|
+
let _loaded = defaultLoaded;
|
|
1902
1903
|
function sprintf(s, ...values) {
|
|
1903
1904
|
if (values.length === 1 && typeof values[0] === "object" && !(values[0] instanceof String)) {
|
|
1904
1905
|
const valuesDict = values[0];
|
|
@@ -1910,7 +1911,8 @@ function sprintf(s, ...values) {
|
|
|
1910
1911
|
return s;
|
|
1911
1912
|
}
|
|
1912
1913
|
/***
|
|
1913
|
-
* Allow to inject a translation function from outside o-spreadsheet.
|
|
1914
|
+
* Allow to inject a translation function from outside o-spreadsheet. This should be called before instantiating
|
|
1915
|
+
* a model.
|
|
1914
1916
|
* @param tfn the function that will do the translation
|
|
1915
1917
|
* @param loaded a function that returns true when the translation is loaded
|
|
1916
1918
|
*/
|
|
@@ -1918,6 +1920,18 @@ function setTranslationMethod(tfn, loaded = () => true) {
|
|
|
1918
1920
|
_translate = tfn;
|
|
1919
1921
|
_loaded = loaded;
|
|
1920
1922
|
}
|
|
1923
|
+
/**
|
|
1924
|
+
* If no translation function has been set, this will mark the translation are loaded.
|
|
1925
|
+
*
|
|
1926
|
+
* By default, the translations should not be set as loaded, otherwise top-level translated constants will never be
|
|
1927
|
+
* translated. But if by the time the model is instantiated no custom translation function has been set, we can set
|
|
1928
|
+
* the default translation function as loaded so o-spreadsheet can be run in standalone with no translations.
|
|
1929
|
+
*/
|
|
1930
|
+
function setDefaultTranslationMethod() {
|
|
1931
|
+
if (_translate === defaultTranslate && _loaded === defaultLoaded) {
|
|
1932
|
+
_loaded = () => true;
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1921
1935
|
const _t = function (s, ...values) {
|
|
1922
1936
|
if (!_loaded()) {
|
|
1923
1937
|
return new LazyTranslatedString(s, values);
|
|
@@ -9459,10 +9473,8 @@ class ComposerStore extends SpreadsheetStore {
|
|
|
9459
9473
|
const refRange = this.getters.getRangeFromSheetXC(activeSheetId, xc);
|
|
9460
9474
|
return isEqual(this.getters.expandZone(activeSheetId, refRange.zone), oldZone);
|
|
9461
9475
|
});
|
|
9462
|
-
// this function assumes that the previous range is always found because
|
|
9463
|
-
// it's called when changing a highlight, which exists by definition
|
|
9464
9476
|
if (!previousRefToken) {
|
|
9465
|
-
|
|
9477
|
+
return;
|
|
9466
9478
|
}
|
|
9467
9479
|
const previousRange = this.getters.getRangeFromSheetXC(activeSheetId, previousRefToken.value);
|
|
9468
9480
|
this.selectionStart = previousRefToken.start;
|
|
@@ -34063,6 +34075,7 @@ class FindAndReplaceStore extends SpreadsheetStore {
|
|
|
34063
34075
|
currentSearchRegex = null;
|
|
34064
34076
|
isSearchDirty = false;
|
|
34065
34077
|
initialShowFormulaState;
|
|
34078
|
+
preserveSelectedMatchIndex = false;
|
|
34066
34079
|
// fixme: why do we make selectedMatchIndex on top of a selected
|
|
34067
34080
|
// property in the matches?
|
|
34068
34081
|
selectedMatchIndex = null;
|
|
@@ -34172,7 +34185,9 @@ class FindAndReplaceStore extends SpreadsheetStore {
|
|
|
34172
34185
|
* refresh the matches according to the current search options
|
|
34173
34186
|
*/
|
|
34174
34187
|
refreshSearch(jumpToMatchSheet = true) {
|
|
34175
|
-
this.
|
|
34188
|
+
if (!this.preserveSelectedMatchIndex) {
|
|
34189
|
+
this.selectedMatchIndex = null;
|
|
34190
|
+
}
|
|
34176
34191
|
this.findMatches();
|
|
34177
34192
|
this.selectNextCell(Direction.current, jumpToMatchSheet);
|
|
34178
34193
|
}
|
|
@@ -34271,10 +34286,16 @@ class FindAndReplaceStore extends SpreadsheetStore {
|
|
|
34271
34286
|
const selectedMatch = matches[nextIndex];
|
|
34272
34287
|
// Switch to the sheet where the match is located
|
|
34273
34288
|
if (jumpToMatchSheet && this.getters.getActiveSheetId() !== selectedMatch.sheetId) {
|
|
34289
|
+
// We set `preserveSelectedMatchIndex` to true to avoid resetting the selected search
|
|
34290
|
+
// index in the `refreshSearch` function when a new sheet is activated. The reason being
|
|
34291
|
+
// that, when we automatically go back to previous sheet while performing a search, the
|
|
34292
|
+
// search index is reset to the first occurrence each time.
|
|
34293
|
+
this.preserveSelectedMatchIndex = true;
|
|
34274
34294
|
this.model.dispatch("ACTIVATE_SHEET", {
|
|
34275
34295
|
sheetIdFrom: this.getters.getActiveSheetId(),
|
|
34276
34296
|
sheetIdTo: selectedMatch.sheetId,
|
|
34277
34297
|
});
|
|
34298
|
+
this.preserveSelectedMatchIndex = false;
|
|
34278
34299
|
// We do not want to reset the selection at finalize in this case
|
|
34279
34300
|
this.isSearchDirty = false;
|
|
34280
34301
|
}
|
|
@@ -34924,7 +34945,7 @@ function createMeasure(fields, measure) {
|
|
|
34924
34945
|
function createPivotDimension(fields, dimension) {
|
|
34925
34946
|
const field = fields[dimension.name];
|
|
34926
34947
|
const type = field?.type ?? "integer";
|
|
34927
|
-
const granularity = field && isDateField(field) ? dimension.granularity
|
|
34948
|
+
const granularity = field && isDateField(field) ? dimension.granularity : undefined;
|
|
34928
34949
|
return {
|
|
34929
34950
|
/**
|
|
34930
34951
|
* Get the display name of the dimension
|
|
@@ -35327,10 +35348,13 @@ function compareDimensionValues(dimension, a, b) {
|
|
|
35327
35348
|
}
|
|
35328
35349
|
|
|
35329
35350
|
function createDate(dimension, value, locale) {
|
|
35330
|
-
const granularity = dimension.granularity
|
|
35331
|
-
if (!(granularity in MAP_VALUE_DIMENSION_DATE)) {
|
|
35351
|
+
const granularity = dimension.granularity;
|
|
35352
|
+
if (!granularity || !(granularity in MAP_VALUE_DIMENSION_DATE)) {
|
|
35332
35353
|
throw new Error(`Unknown date granularity: ${granularity}`);
|
|
35333
35354
|
}
|
|
35355
|
+
if (value === null) {
|
|
35356
|
+
return null;
|
|
35357
|
+
}
|
|
35334
35358
|
if (!MAP_VALUE_DIMENSION_DATE[granularity].set.has(value)) {
|
|
35335
35359
|
MAP_VALUE_DIMENSION_DATE[granularity].set.add(value);
|
|
35336
35360
|
const date = toJsDate(value, locale);
|
|
@@ -35557,7 +35581,8 @@ class SpreadsheetPivot {
|
|
|
35557
35581
|
if (!finalCell) {
|
|
35558
35582
|
return { value: "" };
|
|
35559
35583
|
}
|
|
35560
|
-
|
|
35584
|
+
// Value can be null but stringified (e.g. an empty date, as for now every date is stringified)
|
|
35585
|
+
if (finalCell.value === null || finalCell.value === `${null}`) {
|
|
35561
35586
|
return { value: _t("(Undefined)") };
|
|
35562
35587
|
}
|
|
35563
35588
|
if (dimension.type === "date") {
|
|
@@ -35593,10 +35618,15 @@ class SpreadsheetPivot {
|
|
|
35593
35618
|
if (!operator) {
|
|
35594
35619
|
throw new Error(`Aggregator ${aggregator} does not exist`);
|
|
35595
35620
|
}
|
|
35596
|
-
|
|
35597
|
-
|
|
35598
|
-
|
|
35599
|
-
|
|
35621
|
+
try {
|
|
35622
|
+
return {
|
|
35623
|
+
value: values.length ? operator.fn([values], this.getters.getLocale()) : "",
|
|
35624
|
+
format: operator.format(values[0]),
|
|
35625
|
+
};
|
|
35626
|
+
}
|
|
35627
|
+
catch (e) {
|
|
35628
|
+
return handleError(e, aggregator.toUpperCase());
|
|
35629
|
+
}
|
|
35600
35630
|
}
|
|
35601
35631
|
getPossibleFieldValues(groupBy) {
|
|
35602
35632
|
//TODO This method should be implemented for the autocomplete feature
|
|
@@ -52838,7 +52868,6 @@ class Evaluator {
|
|
|
52838
52868
|
if (!this.blockedArrayFormulas.has(position)) {
|
|
52839
52869
|
this.invalidateSpreading(position);
|
|
52840
52870
|
}
|
|
52841
|
-
this.spreadingRelations.removeNode(position);
|
|
52842
52871
|
const cell = this.getters.getCell(position);
|
|
52843
52872
|
if (cell === undefined) {
|
|
52844
52873
|
return EMPTY_CELL;
|
|
@@ -52880,6 +52909,7 @@ class Evaluator {
|
|
|
52880
52909
|
this.assertSheetHasEnoughSpaceToSpreadFormulaResult(formulaPosition, formulaReturn);
|
|
52881
52910
|
const nbColumns = formulaReturn.length;
|
|
52882
52911
|
const nbRows = formulaReturn[0].length;
|
|
52912
|
+
this.spreadingRelations.removeNode(formulaPosition);
|
|
52883
52913
|
forEachSpreadPositionInMatrix(nbColumns, nbRows, this.updateSpreadRelation(formulaPosition));
|
|
52884
52914
|
this.assertNoMergedCellsInSpreadZone(formulaPosition, formulaReturn);
|
|
52885
52915
|
forEachSpreadPositionInMatrix(nbColumns, nbRows, this.checkCollision(formulaPosition));
|
|
@@ -54480,7 +54510,7 @@ class PivotUIPlugin extends UIPlugin {
|
|
|
54480
54510
|
getPivotIdFromPosition(position) {
|
|
54481
54511
|
const cell = this.getters.getCorrespondingFormulaCell(position);
|
|
54482
54512
|
if (cell && cell.isFormula) {
|
|
54483
|
-
const pivotFunction = this.getFirstPivotFunction(cell.compiledFormula.tokens);
|
|
54513
|
+
const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
|
|
54484
54514
|
if (pivotFunction) {
|
|
54485
54515
|
const pivotId = pivotFunction.args[0]?.toString();
|
|
54486
54516
|
return pivotId && this.getters.getPivotId(pivotId);
|
|
@@ -54488,7 +54518,7 @@ class PivotUIPlugin extends UIPlugin {
|
|
|
54488
54518
|
}
|
|
54489
54519
|
return undefined;
|
|
54490
54520
|
}
|
|
54491
|
-
getFirstPivotFunction(tokens) {
|
|
54521
|
+
getFirstPivotFunction(sheetId, tokens) {
|
|
54492
54522
|
const pivotFunction = getFirstPivotFunction(tokens);
|
|
54493
54523
|
if (!pivotFunction) {
|
|
54494
54524
|
return undefined;
|
|
@@ -54504,7 +54534,7 @@ class PivotUIPlugin extends UIPlugin {
|
|
|
54504
54534
|
return argAst.value;
|
|
54505
54535
|
}
|
|
54506
54536
|
const argsString = astToFormula(argAst);
|
|
54507
|
-
return this.getters.evaluateFormula(
|
|
54537
|
+
return this.getters.evaluateFormula(sheetId, argsString);
|
|
54508
54538
|
});
|
|
54509
54539
|
return { functionName, args: evaluatedArgs };
|
|
54510
54540
|
}
|
|
@@ -54527,7 +54557,7 @@ class PivotUIPlugin extends UIPlugin {
|
|
|
54527
54557
|
return undefined;
|
|
54528
54558
|
}
|
|
54529
54559
|
const mainPosition = this.getters.getCellPosition(cell.id);
|
|
54530
|
-
const result = this.getters.getFirstPivotFunction(cell.compiledFormula.tokens);
|
|
54560
|
+
const result = this.getters.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
|
|
54531
54561
|
if (!result) {
|
|
54532
54562
|
return undefined;
|
|
54533
54563
|
}
|
|
@@ -66305,6 +66335,7 @@ class Model extends EventBus {
|
|
|
66305
66335
|
const start = performance.now();
|
|
66306
66336
|
console.group("Model creation");
|
|
66307
66337
|
super();
|
|
66338
|
+
setDefaultTranslationMethod();
|
|
66308
66339
|
stateUpdateMessages = repairInitialMessages(data, stateUpdateMessages);
|
|
66309
66340
|
const workbookData = load(data, verboseImport);
|
|
66310
66341
|
this.state = new StateObserver();
|
|
@@ -66938,6 +66969,6 @@ const constants = {
|
|
|
66938
66969
|
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 };
|
|
66939
66970
|
|
|
66940
66971
|
|
|
66941
|
-
__info__.version = "17.3.
|
|
66942
|
-
__info__.date = "2024-06-
|
|
66943
|
-
__info__.hash = "
|
|
66972
|
+
__info__.version = "17.3.5";
|
|
66973
|
+
__info__.date = "2024-06-26T11:05:50.339Z";
|
|
66974
|
+
__info__.hash = "54eb151";
|