@odoo/o-spreadsheet 17.3.4 → 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 +39 -15
- package/dist/o-spreadsheet.d.ts +4 -2
- package/dist/o-spreadsheet.esm.js +39 -15
- package/dist/o-spreadsheet.iife.js +39 -15
- 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);
|
|
@@ -34063,6 +34077,7 @@ class FindAndReplaceStore extends SpreadsheetStore {
|
|
|
34063
34077
|
currentSearchRegex = null;
|
|
34064
34078
|
isSearchDirty = false;
|
|
34065
34079
|
initialShowFormulaState;
|
|
34080
|
+
preserveSelectedMatchIndex = false;
|
|
34066
34081
|
// fixme: why do we make selectedMatchIndex on top of a selected
|
|
34067
34082
|
// property in the matches?
|
|
34068
34083
|
selectedMatchIndex = null;
|
|
@@ -34172,7 +34187,9 @@ class FindAndReplaceStore extends SpreadsheetStore {
|
|
|
34172
34187
|
* refresh the matches according to the current search options
|
|
34173
34188
|
*/
|
|
34174
34189
|
refreshSearch(jumpToMatchSheet = true) {
|
|
34175
|
-
this.
|
|
34190
|
+
if (!this.preserveSelectedMatchIndex) {
|
|
34191
|
+
this.selectedMatchIndex = null;
|
|
34192
|
+
}
|
|
34176
34193
|
this.findMatches();
|
|
34177
34194
|
this.selectNextCell(Direction.current, jumpToMatchSheet);
|
|
34178
34195
|
}
|
|
@@ -34271,10 +34288,16 @@ class FindAndReplaceStore extends SpreadsheetStore {
|
|
|
34271
34288
|
const selectedMatch = matches[nextIndex];
|
|
34272
34289
|
// Switch to the sheet where the match is located
|
|
34273
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;
|
|
34274
34296
|
this.model.dispatch("ACTIVATE_SHEET", {
|
|
34275
34297
|
sheetIdFrom: this.getters.getActiveSheetId(),
|
|
34276
34298
|
sheetIdTo: selectedMatch.sheetId,
|
|
34277
34299
|
});
|
|
34300
|
+
this.preserveSelectedMatchIndex = false;
|
|
34278
34301
|
// We do not want to reset the selection at finalize in this case
|
|
34279
34302
|
this.isSearchDirty = false;
|
|
34280
34303
|
}
|
|
@@ -54489,7 +54512,7 @@ class PivotUIPlugin extends UIPlugin {
|
|
|
54489
54512
|
getPivotIdFromPosition(position) {
|
|
54490
54513
|
const cell = this.getters.getCorrespondingFormulaCell(position);
|
|
54491
54514
|
if (cell && cell.isFormula) {
|
|
54492
|
-
const pivotFunction = this.getFirstPivotFunction(cell.compiledFormula.tokens);
|
|
54515
|
+
const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
|
|
54493
54516
|
if (pivotFunction) {
|
|
54494
54517
|
const pivotId = pivotFunction.args[0]?.toString();
|
|
54495
54518
|
return pivotId && this.getters.getPivotId(pivotId);
|
|
@@ -54497,7 +54520,7 @@ class PivotUIPlugin extends UIPlugin {
|
|
|
54497
54520
|
}
|
|
54498
54521
|
return undefined;
|
|
54499
54522
|
}
|
|
54500
|
-
getFirstPivotFunction(tokens) {
|
|
54523
|
+
getFirstPivotFunction(sheetId, tokens) {
|
|
54501
54524
|
const pivotFunction = getFirstPivotFunction(tokens);
|
|
54502
54525
|
if (!pivotFunction) {
|
|
54503
54526
|
return undefined;
|
|
@@ -54513,7 +54536,7 @@ class PivotUIPlugin extends UIPlugin {
|
|
|
54513
54536
|
return argAst.value;
|
|
54514
54537
|
}
|
|
54515
54538
|
const argsString = astToFormula(argAst);
|
|
54516
|
-
return this.getters.evaluateFormula(
|
|
54539
|
+
return this.getters.evaluateFormula(sheetId, argsString);
|
|
54517
54540
|
});
|
|
54518
54541
|
return { functionName, args: evaluatedArgs };
|
|
54519
54542
|
}
|
|
@@ -54536,7 +54559,7 @@ class PivotUIPlugin extends UIPlugin {
|
|
|
54536
54559
|
return undefined;
|
|
54537
54560
|
}
|
|
54538
54561
|
const mainPosition = this.getters.getCellPosition(cell.id);
|
|
54539
|
-
const result = this.getters.getFirstPivotFunction(cell.compiledFormula.tokens);
|
|
54562
|
+
const result = this.getters.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
|
|
54540
54563
|
if (!result) {
|
|
54541
54564
|
return undefined;
|
|
54542
54565
|
}
|
|
@@ -66314,6 +66337,7 @@ class Model extends EventBus {
|
|
|
66314
66337
|
const start = performance.now();
|
|
66315
66338
|
console.group("Model creation");
|
|
66316
66339
|
super();
|
|
66340
|
+
setDefaultTranslationMethod();
|
|
66317
66341
|
stateUpdateMessages = repairInitialMessages(data, stateUpdateMessages);
|
|
66318
66342
|
const workbookData = load(data, verboseImport);
|
|
66319
66343
|
this.state = new StateObserver();
|
|
@@ -66990,6 +67014,6 @@ exports.tokenColors = tokenColors;
|
|
|
66990
67014
|
exports.tokenize = tokenize;
|
|
66991
67015
|
|
|
66992
67016
|
|
|
66993
|
-
__info__.version = "17.3.
|
|
66994
|
-
__info__.date = "2024-06-
|
|
66995
|
-
__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);
|
|
@@ -34061,6 +34075,7 @@ class FindAndReplaceStore extends SpreadsheetStore {
|
|
|
34061
34075
|
currentSearchRegex = null;
|
|
34062
34076
|
isSearchDirty = false;
|
|
34063
34077
|
initialShowFormulaState;
|
|
34078
|
+
preserveSelectedMatchIndex = false;
|
|
34064
34079
|
// fixme: why do we make selectedMatchIndex on top of a selected
|
|
34065
34080
|
// property in the matches?
|
|
34066
34081
|
selectedMatchIndex = null;
|
|
@@ -34170,7 +34185,9 @@ class FindAndReplaceStore extends SpreadsheetStore {
|
|
|
34170
34185
|
* refresh the matches according to the current search options
|
|
34171
34186
|
*/
|
|
34172
34187
|
refreshSearch(jumpToMatchSheet = true) {
|
|
34173
|
-
this.
|
|
34188
|
+
if (!this.preserveSelectedMatchIndex) {
|
|
34189
|
+
this.selectedMatchIndex = null;
|
|
34190
|
+
}
|
|
34174
34191
|
this.findMatches();
|
|
34175
34192
|
this.selectNextCell(Direction.current, jumpToMatchSheet);
|
|
34176
34193
|
}
|
|
@@ -34269,10 +34286,16 @@ class FindAndReplaceStore extends SpreadsheetStore {
|
|
|
34269
34286
|
const selectedMatch = matches[nextIndex];
|
|
34270
34287
|
// Switch to the sheet where the match is located
|
|
34271
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;
|
|
34272
34294
|
this.model.dispatch("ACTIVATE_SHEET", {
|
|
34273
34295
|
sheetIdFrom: this.getters.getActiveSheetId(),
|
|
34274
34296
|
sheetIdTo: selectedMatch.sheetId,
|
|
34275
34297
|
});
|
|
34298
|
+
this.preserveSelectedMatchIndex = false;
|
|
34276
34299
|
// We do not want to reset the selection at finalize in this case
|
|
34277
34300
|
this.isSearchDirty = false;
|
|
34278
34301
|
}
|
|
@@ -54487,7 +54510,7 @@ class PivotUIPlugin extends UIPlugin {
|
|
|
54487
54510
|
getPivotIdFromPosition(position) {
|
|
54488
54511
|
const cell = this.getters.getCorrespondingFormulaCell(position);
|
|
54489
54512
|
if (cell && cell.isFormula) {
|
|
54490
|
-
const pivotFunction = this.getFirstPivotFunction(cell.compiledFormula.tokens);
|
|
54513
|
+
const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
|
|
54491
54514
|
if (pivotFunction) {
|
|
54492
54515
|
const pivotId = pivotFunction.args[0]?.toString();
|
|
54493
54516
|
return pivotId && this.getters.getPivotId(pivotId);
|
|
@@ -54495,7 +54518,7 @@ class PivotUIPlugin extends UIPlugin {
|
|
|
54495
54518
|
}
|
|
54496
54519
|
return undefined;
|
|
54497
54520
|
}
|
|
54498
|
-
getFirstPivotFunction(tokens) {
|
|
54521
|
+
getFirstPivotFunction(sheetId, tokens) {
|
|
54499
54522
|
const pivotFunction = getFirstPivotFunction(tokens);
|
|
54500
54523
|
if (!pivotFunction) {
|
|
54501
54524
|
return undefined;
|
|
@@ -54511,7 +54534,7 @@ class PivotUIPlugin extends UIPlugin {
|
|
|
54511
54534
|
return argAst.value;
|
|
54512
54535
|
}
|
|
54513
54536
|
const argsString = astToFormula(argAst);
|
|
54514
|
-
return this.getters.evaluateFormula(
|
|
54537
|
+
return this.getters.evaluateFormula(sheetId, argsString);
|
|
54515
54538
|
});
|
|
54516
54539
|
return { functionName, args: evaluatedArgs };
|
|
54517
54540
|
}
|
|
@@ -54534,7 +54557,7 @@ class PivotUIPlugin extends UIPlugin {
|
|
|
54534
54557
|
return undefined;
|
|
54535
54558
|
}
|
|
54536
54559
|
const mainPosition = this.getters.getCellPosition(cell.id);
|
|
54537
|
-
const result = this.getters.getFirstPivotFunction(cell.compiledFormula.tokens);
|
|
54560
|
+
const result = this.getters.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
|
|
54538
54561
|
if (!result) {
|
|
54539
54562
|
return undefined;
|
|
54540
54563
|
}
|
|
@@ -66312,6 +66335,7 @@ class Model extends EventBus {
|
|
|
66312
66335
|
const start = performance.now();
|
|
66313
66336
|
console.group("Model creation");
|
|
66314
66337
|
super();
|
|
66338
|
+
setDefaultTranslationMethod();
|
|
66315
66339
|
stateUpdateMessages = repairInitialMessages(data, stateUpdateMessages);
|
|
66316
66340
|
const workbookData = load(data, verboseImport);
|
|
66317
66341
|
this.state = new StateObserver();
|
|
@@ -66945,6 +66969,6 @@ const constants = {
|
|
|
66945
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 };
|
|
66946
66970
|
|
|
66947
66971
|
|
|
66948
|
-
__info__.version = "17.3.
|
|
66949
|
-
__info__.date = "2024-06-
|
|
66950
|
-
__info__.hash = "
|
|
66972
|
+
__info__.version = "17.3.5";
|
|
66973
|
+
__info__.date = "2024-06-26T11:05:50.339Z";
|
|
66974
|
+
__info__.hash = "54eb151";
|
|
@@ -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);
|
|
@@ -34062,6 +34076,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
34062
34076
|
currentSearchRegex = null;
|
|
34063
34077
|
isSearchDirty = false;
|
|
34064
34078
|
initialShowFormulaState;
|
|
34079
|
+
preserveSelectedMatchIndex = false;
|
|
34065
34080
|
// fixme: why do we make selectedMatchIndex on top of a selected
|
|
34066
34081
|
// property in the matches?
|
|
34067
34082
|
selectedMatchIndex = null;
|
|
@@ -34171,7 +34186,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
34171
34186
|
* refresh the matches according to the current search options
|
|
34172
34187
|
*/
|
|
34173
34188
|
refreshSearch(jumpToMatchSheet = true) {
|
|
34174
|
-
this.
|
|
34189
|
+
if (!this.preserveSelectedMatchIndex) {
|
|
34190
|
+
this.selectedMatchIndex = null;
|
|
34191
|
+
}
|
|
34175
34192
|
this.findMatches();
|
|
34176
34193
|
this.selectNextCell(Direction.current, jumpToMatchSheet);
|
|
34177
34194
|
}
|
|
@@ -34270,10 +34287,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
34270
34287
|
const selectedMatch = matches[nextIndex];
|
|
34271
34288
|
// Switch to the sheet where the match is located
|
|
34272
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;
|
|
34273
34295
|
this.model.dispatch("ACTIVATE_SHEET", {
|
|
34274
34296
|
sheetIdFrom: this.getters.getActiveSheetId(),
|
|
34275
34297
|
sheetIdTo: selectedMatch.sheetId,
|
|
34276
34298
|
});
|
|
34299
|
+
this.preserveSelectedMatchIndex = false;
|
|
34277
34300
|
// We do not want to reset the selection at finalize in this case
|
|
34278
34301
|
this.isSearchDirty = false;
|
|
34279
34302
|
}
|
|
@@ -54488,7 +54511,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54488
54511
|
getPivotIdFromPosition(position) {
|
|
54489
54512
|
const cell = this.getters.getCorrespondingFormulaCell(position);
|
|
54490
54513
|
if (cell && cell.isFormula) {
|
|
54491
|
-
const pivotFunction = this.getFirstPivotFunction(cell.compiledFormula.tokens);
|
|
54514
|
+
const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
|
|
54492
54515
|
if (pivotFunction) {
|
|
54493
54516
|
const pivotId = pivotFunction.args[0]?.toString();
|
|
54494
54517
|
return pivotId && this.getters.getPivotId(pivotId);
|
|
@@ -54496,7 +54519,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54496
54519
|
}
|
|
54497
54520
|
return undefined;
|
|
54498
54521
|
}
|
|
54499
|
-
getFirstPivotFunction(tokens) {
|
|
54522
|
+
getFirstPivotFunction(sheetId, tokens) {
|
|
54500
54523
|
const pivotFunction = getFirstPivotFunction(tokens);
|
|
54501
54524
|
if (!pivotFunction) {
|
|
54502
54525
|
return undefined;
|
|
@@ -54512,7 +54535,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54512
54535
|
return argAst.value;
|
|
54513
54536
|
}
|
|
54514
54537
|
const argsString = astToFormula(argAst);
|
|
54515
|
-
return this.getters.evaluateFormula(
|
|
54538
|
+
return this.getters.evaluateFormula(sheetId, argsString);
|
|
54516
54539
|
});
|
|
54517
54540
|
return { functionName, args: evaluatedArgs };
|
|
54518
54541
|
}
|
|
@@ -54535,7 +54558,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54535
54558
|
return undefined;
|
|
54536
54559
|
}
|
|
54537
54560
|
const mainPosition = this.getters.getCellPosition(cell.id);
|
|
54538
|
-
const result = this.getters.getFirstPivotFunction(cell.compiledFormula.tokens);
|
|
54561
|
+
const result = this.getters.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
|
|
54539
54562
|
if (!result) {
|
|
54540
54563
|
return undefined;
|
|
54541
54564
|
}
|
|
@@ -66313,6 +66336,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
66313
66336
|
const start = performance.now();
|
|
66314
66337
|
console.group("Model creation");
|
|
66315
66338
|
super();
|
|
66339
|
+
setDefaultTranslationMethod();
|
|
66316
66340
|
stateUpdateMessages = repairInitialMessages(data, stateUpdateMessages);
|
|
66317
66341
|
const workbookData = load(data, verboseImport);
|
|
66318
66342
|
this.state = new StateObserver();
|
|
@@ -66989,9 +67013,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
66989
67013
|
exports.tokenize = tokenize;
|
|
66990
67014
|
|
|
66991
67015
|
|
|
66992
|
-
__info__.version = "17.3.
|
|
66993
|
-
__info__.date = "2024-06-
|
|
66994
|
-
__info__.hash = "
|
|
67016
|
+
__info__.version = "17.3.5";
|
|
67017
|
+
__info__.date = "2024-06-26T11:05:50.339Z";
|
|
67018
|
+
__info__.hash = "54eb151";
|
|
66995
67019
|
|
|
66996
67020
|
|
|
66997
67021
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|