@odoo/o-spreadsheet 17.1.2 → 17.1.3
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 +64 -43
- package/dist/o-spreadsheet.d.ts +7 -2
- package/dist/o-spreadsheet.esm.js +64 -43
- package/dist/o-spreadsheet.iife.js +64 -43
- package/dist/o-spreadsheet.iife.min.js +258 -265
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +1 -1
|
@@ -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 17.1.
|
|
6
|
-
* @date 2024-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.1.3
|
|
6
|
+
* @date 2024-02-02T13:46:54.332Z
|
|
7
|
+
* @hash 798f979
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -5049,8 +5049,10 @@ function toExcelDataset(getters, ds) {
|
|
|
5049
5049
|
}
|
|
5050
5050
|
const dataRange = ds.dataRange.clone({ zone: dataZone });
|
|
5051
5051
|
return {
|
|
5052
|
-
label: ds.labelCell
|
|
5053
|
-
|
|
5052
|
+
label: ds.labelCell
|
|
5053
|
+
? getters.getRangeString(ds.labelCell, "forceSheetReference", { useFixedReference: true })
|
|
5054
|
+
: undefined,
|
|
5055
|
+
range: getters.getRangeString(dataRange, "forceSheetReference", { useFixedReference: true }),
|
|
5054
5056
|
};
|
|
5055
5057
|
}
|
|
5056
5058
|
function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
|
|
@@ -5063,7 +5065,7 @@ function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
|
|
|
5063
5065
|
zone.top = zone.top + 1;
|
|
5064
5066
|
}
|
|
5065
5067
|
const range = labelRange.clone({ zone });
|
|
5066
|
-
return getters.getRangeString(range, "forceSheetReference");
|
|
5068
|
+
return getters.getRangeString(range, "forceSheetReference", { useFixedReference: true });
|
|
5067
5069
|
}
|
|
5068
5070
|
/**
|
|
5069
5071
|
* Transform a chart definition which supports dataSets (dataSets and LabelRange)
|
|
@@ -6698,6 +6700,7 @@ const FilterMenuPopoverBuilder = {
|
|
|
6698
6700
|
};
|
|
6699
6701
|
|
|
6700
6702
|
const macRegex = /Mac/i;
|
|
6703
|
+
const MODIFIER_KEYS = ["Shift", "Control", "Alt", "Meta"];
|
|
6701
6704
|
/**
|
|
6702
6705
|
* Return true if the event was triggered from
|
|
6703
6706
|
* a child element.
|
|
@@ -6749,14 +6752,14 @@ const letterRegex = /^[a-zA-Z]$/;
|
|
|
6749
6752
|
*/
|
|
6750
6753
|
function keyboardEventToShortcutString(ev, mode = "key") {
|
|
6751
6754
|
let keyDownString = "";
|
|
6752
|
-
if (
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
|
|
6758
|
-
|
|
6759
|
-
|
|
6755
|
+
if (!MODIFIER_KEYS.includes(ev.key)) {
|
|
6756
|
+
if (isCtrlKey(ev))
|
|
6757
|
+
keyDownString += "Ctrl+";
|
|
6758
|
+
if (ev.altKey)
|
|
6759
|
+
keyDownString += "Alt+";
|
|
6760
|
+
if (ev.shiftKey)
|
|
6761
|
+
keyDownString += "Shift+";
|
|
6762
|
+
}
|
|
6760
6763
|
const key = mode === "key" ? ev.key : ev.code;
|
|
6761
6764
|
keyDownString += letterRegex.test(key) ? key.toUpperCase() : key;
|
|
6762
6765
|
return keyDownString;
|
|
@@ -20208,19 +20211,20 @@ const formatNumberPercent = createFormatActionSpec({
|
|
|
20208
20211
|
const formatNumberCurrency = createFormatActionSpec({
|
|
20209
20212
|
name: _t("Currency"),
|
|
20210
20213
|
descriptionValue: 1000.12,
|
|
20211
|
-
format: (env) => env.model.config.defaultCurrencyFormat,
|
|
20214
|
+
format: (env) => env.model.config.defaultCurrencyFormat ?? DEFAULT_CURRENCY_FORMAT,
|
|
20212
20215
|
});
|
|
20213
20216
|
const formatNumberCurrencyRounded = {
|
|
20214
20217
|
...createFormatActionSpec({
|
|
20215
20218
|
name: _t("Currency rounded"),
|
|
20216
20219
|
descriptionValue: 1000,
|
|
20217
|
-
format: (env) => roundFormat(env.model.config.defaultCurrencyFormat),
|
|
20220
|
+
format: (env) => roundFormat(env.model.config.defaultCurrencyFormat ?? DEFAULT_CURRENCY_FORMAT),
|
|
20218
20221
|
}),
|
|
20219
20222
|
isVisible: (env) => {
|
|
20220
20223
|
const currencyFormat = env.model.config.defaultCurrencyFormat;
|
|
20221
|
-
return currencyFormat !== roundFormat(currencyFormat);
|
|
20224
|
+
return currencyFormat !== roundFormat(currencyFormat ?? DEFAULT_CURRENCY_FORMAT);
|
|
20222
20225
|
},
|
|
20223
20226
|
};
|
|
20227
|
+
const DEFAULT_CURRENCY_FORMAT = "[$$]#,##0.00";
|
|
20224
20228
|
const EXAMPLE_DATE = parseLiteral("2023/09/26 10:43:00 PM", DEFAULT_LOCALE);
|
|
20225
20229
|
const formatCustomCurrency = {
|
|
20226
20230
|
name: _t("Custom currency"),
|
|
@@ -36030,6 +36034,9 @@ class CellPlugin extends CorePlugin {
|
|
|
36030
36034
|
format: cell.format ? getItemId(cell.format, formats) : undefined,
|
|
36031
36035
|
content: cell.content || undefined,
|
|
36032
36036
|
};
|
|
36037
|
+
if (cell instanceof FormulaCellWithDependencies) {
|
|
36038
|
+
cells[xc].content = cell.contentWithFixedReferences || undefined;
|
|
36039
|
+
}
|
|
36033
36040
|
}
|
|
36034
36041
|
_sheet.cells = cells;
|
|
36035
36042
|
}
|
|
@@ -36073,12 +36080,12 @@ class CellPlugin extends CorePlugin {
|
|
|
36073
36080
|
/*
|
|
36074
36081
|
* Reconstructs the original formula string based on a normalized form and its dependencies
|
|
36075
36082
|
*/
|
|
36076
|
-
getFormulaCellContent(sheetId, compiledFormula, dependencies) {
|
|
36083
|
+
getFormulaCellContent(sheetId, compiledFormula, dependencies, useFixedReference = false) {
|
|
36077
36084
|
let rangeIndex = 0;
|
|
36078
36085
|
return concat(compiledFormula.tokens.map((token) => {
|
|
36079
36086
|
if (token.type === "REFERENCE") {
|
|
36080
36087
|
const range = dependencies[rangeIndex++];
|
|
36081
|
-
return this.getters.getRangeString(range, sheetId);
|
|
36088
|
+
return this.getters.getRangeString(range, sheetId, { useFixedReference });
|
|
36082
36089
|
}
|
|
36083
36090
|
return token.value;
|
|
36084
36091
|
}));
|
|
@@ -36349,6 +36356,18 @@ class FormulaCellWithDependencies {
|
|
|
36349
36356
|
get content() {
|
|
36350
36357
|
return concat(this.compiledFormula.tokens.map((token) => token.value));
|
|
36351
36358
|
}
|
|
36359
|
+
get contentWithFixedReferences() {
|
|
36360
|
+
let rangeIndex = 0;
|
|
36361
|
+
return concat(this.compiledFormula.tokens.map((token) => {
|
|
36362
|
+
if (token.type === "REFERENCE") {
|
|
36363
|
+
const index = rangeIndex++;
|
|
36364
|
+
return this.getRangeString(this.compiledFormula.dependencies[index], this.sheetId, {
|
|
36365
|
+
useFixedReference: true,
|
|
36366
|
+
});
|
|
36367
|
+
}
|
|
36368
|
+
return token.value;
|
|
36369
|
+
}));
|
|
36370
|
+
}
|
|
36352
36371
|
}
|
|
36353
36372
|
class RangeReferenceToken {
|
|
36354
36373
|
getValue;
|
|
@@ -36653,7 +36672,13 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
36653
36672
|
}
|
|
36654
36673
|
}
|
|
36655
36674
|
exportForExcel(data) {
|
|
36656
|
-
|
|
36675
|
+
if (data.sheets) {
|
|
36676
|
+
for (let sheet of data.sheets) {
|
|
36677
|
+
if (this.cfRules[sheet.id]) {
|
|
36678
|
+
sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, { useFixedReference: true }));
|
|
36679
|
+
}
|
|
36680
|
+
}
|
|
36681
|
+
}
|
|
36657
36682
|
}
|
|
36658
36683
|
// ---------------------------------------------------------------------------
|
|
36659
36684
|
// Getters
|
|
@@ -36718,11 +36743,11 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
36718
36743
|
// ---------------------------------------------------------------------------
|
|
36719
36744
|
// Private
|
|
36720
36745
|
// ---------------------------------------------------------------------------
|
|
36721
|
-
mapToConditionalFormat(sheetId, cf) {
|
|
36746
|
+
mapToConditionalFormat(sheetId, cf, { useFixedReference } = { useFixedReference: false }) {
|
|
36722
36747
|
return {
|
|
36723
36748
|
...cf,
|
|
36724
36749
|
ranges: cf.ranges.map((range) => {
|
|
36725
|
-
return this.getters.getRangeString(range, sheetId);
|
|
36750
|
+
return this.getters.getRangeString(range, sheetId, { useFixedReference });
|
|
36726
36751
|
}),
|
|
36727
36752
|
};
|
|
36728
36753
|
}
|
|
@@ -38790,8 +38815,10 @@ class RangeAdapter {
|
|
|
38790
38815
|
*
|
|
38791
38816
|
* @param range the range (received from getRangeFromXC or getRangeFromZone)
|
|
38792
38817
|
* @param forSheetId the id of the sheet where the range string is supposed to be used.
|
|
38818
|
+
* @param options
|
|
38819
|
+
* @param options.useFixedReference if true, the range will be returned with fixed row and column
|
|
38793
38820
|
*/
|
|
38794
|
-
getRangeString(range, forSheetId) {
|
|
38821
|
+
getRangeString(range, forSheetId, options = { useFixedReference: false }) {
|
|
38795
38822
|
if (!range) {
|
|
38796
38823
|
return CellErrorType.InvalidReference;
|
|
38797
38824
|
}
|
|
@@ -38818,7 +38845,7 @@ class RangeAdapter {
|
|
|
38818
38845
|
if (prefixSheet && !sheetName) {
|
|
38819
38846
|
return CellErrorType.InvalidReference;
|
|
38820
38847
|
}
|
|
38821
|
-
let rangeString = this.getRangePartString(rangeImpl, 0);
|
|
38848
|
+
let rangeString = this.getRangePartString(rangeImpl, 0, options);
|
|
38822
38849
|
if (rangeImpl.parts && rangeImpl.parts.length === 2) {
|
|
38823
38850
|
// this if converts A2:A2 into A2 except if any part of the original range had fixed row or column (with $)
|
|
38824
38851
|
if (rangeImpl.zone.top !== rangeImpl.zone.bottom ||
|
|
@@ -38828,7 +38855,7 @@ class RangeAdapter {
|
|
|
38828
38855
|
rangeImpl.parts[1].rowFixed ||
|
|
38829
38856
|
rangeImpl.parts[1].colFixed) {
|
|
38830
38857
|
rangeString += ":";
|
|
38831
|
-
rangeString += this.getRangePartString(rangeImpl, 1);
|
|
38858
|
+
rangeString += this.getRangePartString(rangeImpl, 1, options);
|
|
38832
38859
|
}
|
|
38833
38860
|
}
|
|
38834
38861
|
return `${prefixSheet ? sheetName + "!" : ""}${rangeString}`;
|
|
@@ -38869,13 +38896,13 @@ class RangeAdapter {
|
|
|
38869
38896
|
/**
|
|
38870
38897
|
* Get a Xc string that represent a part of a range
|
|
38871
38898
|
*/
|
|
38872
|
-
getRangePartString(range, part) {
|
|
38899
|
+
getRangePartString(range, part, options = { useFixedReference: false }) {
|
|
38873
38900
|
const colFixed = range.parts && range.parts[part]?.colFixed ? "$" : "";
|
|
38874
38901
|
const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
|
|
38875
38902
|
const rowFixed = range.parts && range.parts[part]?.rowFixed ? "$" : "";
|
|
38876
38903
|
const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
|
|
38877
38904
|
let str = "";
|
|
38878
|
-
if (range.isFullCol) {
|
|
38905
|
+
if (range.isFullCol && !options.useFixedReference) {
|
|
38879
38906
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
38880
38907
|
str = colFixed + col + rowFixed + row;
|
|
38881
38908
|
}
|
|
@@ -38883,7 +38910,7 @@ class RangeAdapter {
|
|
|
38883
38910
|
str = colFixed + col;
|
|
38884
38911
|
}
|
|
38885
38912
|
}
|
|
38886
|
-
else if (range.isFullRow) {
|
|
38913
|
+
else if (range.isFullRow && !options.useFixedReference) {
|
|
38887
38914
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
38888
38915
|
str = colFixed + col + rowFixed + row;
|
|
38889
38916
|
}
|
|
@@ -55235,12 +55262,7 @@ function addFormula(cell) {
|
|
|
55235
55262
|
attrs.push(["t", "str"]);
|
|
55236
55263
|
cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
|
|
55237
55264
|
}
|
|
55238
|
-
node = escapeXml /*xml*/
|
|
55239
|
-
<f>
|
|
55240
|
-
${XlsxFormula}
|
|
55241
|
-
</f>
|
|
55242
|
-
${cycle}
|
|
55243
|
-
`;
|
|
55265
|
+
node = escapeXml /*xml*/ `<f>${XlsxFormula}</f>${cycle}`;
|
|
55244
55266
|
return { attrs, node };
|
|
55245
55267
|
}
|
|
55246
55268
|
function addContent(content, sharedStrings, forceString = false) {
|
|
@@ -56060,11 +56082,10 @@ function addRows(construct, data, sheet) {
|
|
|
56060
56082
|
({ attrs: additionalAttrs, node: cellNode } = addContent(cell.content, construct.sharedStrings, isTableHeader || isPlainText));
|
|
56061
56083
|
}
|
|
56062
56084
|
attributes.push(...additionalAttrs);
|
|
56063
|
-
|
|
56064
|
-
|
|
56065
|
-
|
|
56066
|
-
|
|
56067
|
-
`);
|
|
56085
|
+
// prettier-ignore
|
|
56086
|
+
cellNodes.push(escapeXml /*xml*/ `<c ${formatAttributes(attributes)}>
|
|
56087
|
+
${cellNode}
|
|
56088
|
+
</c>`);
|
|
56068
56089
|
}
|
|
56069
56090
|
}
|
|
56070
56091
|
if (cellNodes.length || row.size !== DEFAULT_CELL_HEIGHT || row.isHidden) {
|
|
@@ -56660,7 +56681,6 @@ class Model extends EventBus {
|
|
|
56660
56681
|
...config,
|
|
56661
56682
|
mode: config.mode || "normal",
|
|
56662
56683
|
custom: config.custom || {},
|
|
56663
|
-
defaultCurrencyFormat: config.defaultCurrencyFormat || "[$$]#,##0.00",
|
|
56664
56684
|
external: this.setupExternalConfig(config.external || {}),
|
|
56665
56685
|
transportService,
|
|
56666
56686
|
client,
|
|
@@ -56698,6 +56718,7 @@ class Model extends EventBus {
|
|
|
56698
56718
|
custom: this.config.custom,
|
|
56699
56719
|
uiActions: this.config,
|
|
56700
56720
|
session: this.session,
|
|
56721
|
+
defaultCurrencyFormat: this.config.defaultCurrencyFormat,
|
|
56701
56722
|
};
|
|
56702
56723
|
}
|
|
56703
56724
|
// ---------------------------------------------------------------------------
|
|
@@ -57079,6 +57100,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
57079
57100
|
exports.tokenize = tokenize;
|
|
57080
57101
|
|
|
57081
57102
|
|
|
57082
|
-
__info__.version = "17.1.
|
|
57083
|
-
__info__.date = "2024-
|
|
57084
|
-
__info__.hash = "
|
|
57103
|
+
__info__.version = "17.1.3";
|
|
57104
|
+
__info__.date = "2024-02-02T13:46:54.332Z";
|
|
57105
|
+
__info__.hash = "798f979";
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -1179,7 +1179,7 @@ interface ModelConfig {
|
|
|
1179
1179
|
readonly custom: Readonly<{
|
|
1180
1180
|
[key: string]: any;
|
|
1181
1181
|
}>;
|
|
1182
|
-
readonly defaultCurrencyFormat
|
|
1182
|
+
readonly defaultCurrencyFormat?: Format;
|
|
1183
1183
|
/**
|
|
1184
1184
|
* External dependencies required to enable some features
|
|
1185
1185
|
* such as uploading images.
|
|
@@ -1430,6 +1430,7 @@ interface UIPluginConfig {
|
|
|
1430
1430
|
readonly uiActions: UIActions;
|
|
1431
1431
|
readonly custom: ModelConfig["custom"];
|
|
1432
1432
|
readonly session: Session;
|
|
1433
|
+
readonly defaultCurrencyFormat?: Format;
|
|
1433
1434
|
}
|
|
1434
1435
|
interface UIPluginConstructor {
|
|
1435
1436
|
new (config: UIPluginConfig): UIPlugin;
|
|
@@ -3070,8 +3071,12 @@ declare class RangeAdapter implements CommandHandler<CoreCommand> {
|
|
|
3070
3071
|
*
|
|
3071
3072
|
* @param range the range (received from getRangeFromXC or getRangeFromZone)
|
|
3072
3073
|
* @param forSheetId the id of the sheet where the range string is supposed to be used.
|
|
3074
|
+
* @param options
|
|
3075
|
+
* @param options.useFixedReference if true, the range will be returned with fixed row and column
|
|
3073
3076
|
*/
|
|
3074
|
-
getRangeString(range: Range, forSheetId: UID
|
|
3077
|
+
getRangeString(range: Range, forSheetId: UID, options?: {
|
|
3078
|
+
useFixedReference: boolean;
|
|
3079
|
+
}): string;
|
|
3075
3080
|
getRangeDataFromXc(sheetId: UID, xc: string): RangeData;
|
|
3076
3081
|
getRangeDataFromZone(sheetId: UID, zone: Zone | UnboundedZone): RangeData;
|
|
3077
3082
|
getRangeFromZone(sheetId: UID, zone: Zone | UnboundedZone): Range;
|
|
@@ -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 17.1.
|
|
6
|
-
* @date 2024-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.1.3
|
|
6
|
+
* @date 2024-02-02T13:46:54.332Z
|
|
7
|
+
* @hash 798f979
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { Component, useRef, onMounted, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillUnmount, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
|
|
@@ -5047,8 +5047,10 @@ function toExcelDataset(getters, ds) {
|
|
|
5047
5047
|
}
|
|
5048
5048
|
const dataRange = ds.dataRange.clone({ zone: dataZone });
|
|
5049
5049
|
return {
|
|
5050
|
-
label: ds.labelCell
|
|
5051
|
-
|
|
5050
|
+
label: ds.labelCell
|
|
5051
|
+
? getters.getRangeString(ds.labelCell, "forceSheetReference", { useFixedReference: true })
|
|
5052
|
+
: undefined,
|
|
5053
|
+
range: getters.getRangeString(dataRange, "forceSheetReference", { useFixedReference: true }),
|
|
5052
5054
|
};
|
|
5053
5055
|
}
|
|
5054
5056
|
function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
|
|
@@ -5061,7 +5063,7 @@ function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
|
|
|
5061
5063
|
zone.top = zone.top + 1;
|
|
5062
5064
|
}
|
|
5063
5065
|
const range = labelRange.clone({ zone });
|
|
5064
|
-
return getters.getRangeString(range, "forceSheetReference");
|
|
5066
|
+
return getters.getRangeString(range, "forceSheetReference", { useFixedReference: true });
|
|
5065
5067
|
}
|
|
5066
5068
|
/**
|
|
5067
5069
|
* Transform a chart definition which supports dataSets (dataSets and LabelRange)
|
|
@@ -6696,6 +6698,7 @@ const FilterMenuPopoverBuilder = {
|
|
|
6696
6698
|
};
|
|
6697
6699
|
|
|
6698
6700
|
const macRegex = /Mac/i;
|
|
6701
|
+
const MODIFIER_KEYS = ["Shift", "Control", "Alt", "Meta"];
|
|
6699
6702
|
/**
|
|
6700
6703
|
* Return true if the event was triggered from
|
|
6701
6704
|
* a child element.
|
|
@@ -6747,14 +6750,14 @@ const letterRegex = /^[a-zA-Z]$/;
|
|
|
6747
6750
|
*/
|
|
6748
6751
|
function keyboardEventToShortcutString(ev, mode = "key") {
|
|
6749
6752
|
let keyDownString = "";
|
|
6750
|
-
if (
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
|
|
6753
|
+
if (!MODIFIER_KEYS.includes(ev.key)) {
|
|
6754
|
+
if (isCtrlKey(ev))
|
|
6755
|
+
keyDownString += "Ctrl+";
|
|
6756
|
+
if (ev.altKey)
|
|
6757
|
+
keyDownString += "Alt+";
|
|
6758
|
+
if (ev.shiftKey)
|
|
6759
|
+
keyDownString += "Shift+";
|
|
6760
|
+
}
|
|
6758
6761
|
const key = mode === "key" ? ev.key : ev.code;
|
|
6759
6762
|
keyDownString += letterRegex.test(key) ? key.toUpperCase() : key;
|
|
6760
6763
|
return keyDownString;
|
|
@@ -20206,19 +20209,20 @@ const formatNumberPercent = createFormatActionSpec({
|
|
|
20206
20209
|
const formatNumberCurrency = createFormatActionSpec({
|
|
20207
20210
|
name: _t("Currency"),
|
|
20208
20211
|
descriptionValue: 1000.12,
|
|
20209
|
-
format: (env) => env.model.config.defaultCurrencyFormat,
|
|
20212
|
+
format: (env) => env.model.config.defaultCurrencyFormat ?? DEFAULT_CURRENCY_FORMAT,
|
|
20210
20213
|
});
|
|
20211
20214
|
const formatNumberCurrencyRounded = {
|
|
20212
20215
|
...createFormatActionSpec({
|
|
20213
20216
|
name: _t("Currency rounded"),
|
|
20214
20217
|
descriptionValue: 1000,
|
|
20215
|
-
format: (env) => roundFormat(env.model.config.defaultCurrencyFormat),
|
|
20218
|
+
format: (env) => roundFormat(env.model.config.defaultCurrencyFormat ?? DEFAULT_CURRENCY_FORMAT),
|
|
20216
20219
|
}),
|
|
20217
20220
|
isVisible: (env) => {
|
|
20218
20221
|
const currencyFormat = env.model.config.defaultCurrencyFormat;
|
|
20219
|
-
return currencyFormat !== roundFormat(currencyFormat);
|
|
20222
|
+
return currencyFormat !== roundFormat(currencyFormat ?? DEFAULT_CURRENCY_FORMAT);
|
|
20220
20223
|
},
|
|
20221
20224
|
};
|
|
20225
|
+
const DEFAULT_CURRENCY_FORMAT = "[$$]#,##0.00";
|
|
20222
20226
|
const EXAMPLE_DATE = parseLiteral("2023/09/26 10:43:00 PM", DEFAULT_LOCALE);
|
|
20223
20227
|
const formatCustomCurrency = {
|
|
20224
20228
|
name: _t("Custom currency"),
|
|
@@ -36028,6 +36032,9 @@ class CellPlugin extends CorePlugin {
|
|
|
36028
36032
|
format: cell.format ? getItemId(cell.format, formats) : undefined,
|
|
36029
36033
|
content: cell.content || undefined,
|
|
36030
36034
|
};
|
|
36035
|
+
if (cell instanceof FormulaCellWithDependencies) {
|
|
36036
|
+
cells[xc].content = cell.contentWithFixedReferences || undefined;
|
|
36037
|
+
}
|
|
36031
36038
|
}
|
|
36032
36039
|
_sheet.cells = cells;
|
|
36033
36040
|
}
|
|
@@ -36071,12 +36078,12 @@ class CellPlugin extends CorePlugin {
|
|
|
36071
36078
|
/*
|
|
36072
36079
|
* Reconstructs the original formula string based on a normalized form and its dependencies
|
|
36073
36080
|
*/
|
|
36074
|
-
getFormulaCellContent(sheetId, compiledFormula, dependencies) {
|
|
36081
|
+
getFormulaCellContent(sheetId, compiledFormula, dependencies, useFixedReference = false) {
|
|
36075
36082
|
let rangeIndex = 0;
|
|
36076
36083
|
return concat(compiledFormula.tokens.map((token) => {
|
|
36077
36084
|
if (token.type === "REFERENCE") {
|
|
36078
36085
|
const range = dependencies[rangeIndex++];
|
|
36079
|
-
return this.getters.getRangeString(range, sheetId);
|
|
36086
|
+
return this.getters.getRangeString(range, sheetId, { useFixedReference });
|
|
36080
36087
|
}
|
|
36081
36088
|
return token.value;
|
|
36082
36089
|
}));
|
|
@@ -36347,6 +36354,18 @@ class FormulaCellWithDependencies {
|
|
|
36347
36354
|
get content() {
|
|
36348
36355
|
return concat(this.compiledFormula.tokens.map((token) => token.value));
|
|
36349
36356
|
}
|
|
36357
|
+
get contentWithFixedReferences() {
|
|
36358
|
+
let rangeIndex = 0;
|
|
36359
|
+
return concat(this.compiledFormula.tokens.map((token) => {
|
|
36360
|
+
if (token.type === "REFERENCE") {
|
|
36361
|
+
const index = rangeIndex++;
|
|
36362
|
+
return this.getRangeString(this.compiledFormula.dependencies[index], this.sheetId, {
|
|
36363
|
+
useFixedReference: true,
|
|
36364
|
+
});
|
|
36365
|
+
}
|
|
36366
|
+
return token.value;
|
|
36367
|
+
}));
|
|
36368
|
+
}
|
|
36350
36369
|
}
|
|
36351
36370
|
class RangeReferenceToken {
|
|
36352
36371
|
getValue;
|
|
@@ -36651,7 +36670,13 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
36651
36670
|
}
|
|
36652
36671
|
}
|
|
36653
36672
|
exportForExcel(data) {
|
|
36654
|
-
|
|
36673
|
+
if (data.sheets) {
|
|
36674
|
+
for (let sheet of data.sheets) {
|
|
36675
|
+
if (this.cfRules[sheet.id]) {
|
|
36676
|
+
sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, { useFixedReference: true }));
|
|
36677
|
+
}
|
|
36678
|
+
}
|
|
36679
|
+
}
|
|
36655
36680
|
}
|
|
36656
36681
|
// ---------------------------------------------------------------------------
|
|
36657
36682
|
// Getters
|
|
@@ -36716,11 +36741,11 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
36716
36741
|
// ---------------------------------------------------------------------------
|
|
36717
36742
|
// Private
|
|
36718
36743
|
// ---------------------------------------------------------------------------
|
|
36719
|
-
mapToConditionalFormat(sheetId, cf) {
|
|
36744
|
+
mapToConditionalFormat(sheetId, cf, { useFixedReference } = { useFixedReference: false }) {
|
|
36720
36745
|
return {
|
|
36721
36746
|
...cf,
|
|
36722
36747
|
ranges: cf.ranges.map((range) => {
|
|
36723
|
-
return this.getters.getRangeString(range, sheetId);
|
|
36748
|
+
return this.getters.getRangeString(range, sheetId, { useFixedReference });
|
|
36724
36749
|
}),
|
|
36725
36750
|
};
|
|
36726
36751
|
}
|
|
@@ -38788,8 +38813,10 @@ class RangeAdapter {
|
|
|
38788
38813
|
*
|
|
38789
38814
|
* @param range the range (received from getRangeFromXC or getRangeFromZone)
|
|
38790
38815
|
* @param forSheetId the id of the sheet where the range string is supposed to be used.
|
|
38816
|
+
* @param options
|
|
38817
|
+
* @param options.useFixedReference if true, the range will be returned with fixed row and column
|
|
38791
38818
|
*/
|
|
38792
|
-
getRangeString(range, forSheetId) {
|
|
38819
|
+
getRangeString(range, forSheetId, options = { useFixedReference: false }) {
|
|
38793
38820
|
if (!range) {
|
|
38794
38821
|
return CellErrorType.InvalidReference;
|
|
38795
38822
|
}
|
|
@@ -38816,7 +38843,7 @@ class RangeAdapter {
|
|
|
38816
38843
|
if (prefixSheet && !sheetName) {
|
|
38817
38844
|
return CellErrorType.InvalidReference;
|
|
38818
38845
|
}
|
|
38819
|
-
let rangeString = this.getRangePartString(rangeImpl, 0);
|
|
38846
|
+
let rangeString = this.getRangePartString(rangeImpl, 0, options);
|
|
38820
38847
|
if (rangeImpl.parts && rangeImpl.parts.length === 2) {
|
|
38821
38848
|
// this if converts A2:A2 into A2 except if any part of the original range had fixed row or column (with $)
|
|
38822
38849
|
if (rangeImpl.zone.top !== rangeImpl.zone.bottom ||
|
|
@@ -38826,7 +38853,7 @@ class RangeAdapter {
|
|
|
38826
38853
|
rangeImpl.parts[1].rowFixed ||
|
|
38827
38854
|
rangeImpl.parts[1].colFixed) {
|
|
38828
38855
|
rangeString += ":";
|
|
38829
|
-
rangeString += this.getRangePartString(rangeImpl, 1);
|
|
38856
|
+
rangeString += this.getRangePartString(rangeImpl, 1, options);
|
|
38830
38857
|
}
|
|
38831
38858
|
}
|
|
38832
38859
|
return `${prefixSheet ? sheetName + "!" : ""}${rangeString}`;
|
|
@@ -38867,13 +38894,13 @@ class RangeAdapter {
|
|
|
38867
38894
|
/**
|
|
38868
38895
|
* Get a Xc string that represent a part of a range
|
|
38869
38896
|
*/
|
|
38870
|
-
getRangePartString(range, part) {
|
|
38897
|
+
getRangePartString(range, part, options = { useFixedReference: false }) {
|
|
38871
38898
|
const colFixed = range.parts && range.parts[part]?.colFixed ? "$" : "";
|
|
38872
38899
|
const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
|
|
38873
38900
|
const rowFixed = range.parts && range.parts[part]?.rowFixed ? "$" : "";
|
|
38874
38901
|
const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
|
|
38875
38902
|
let str = "";
|
|
38876
|
-
if (range.isFullCol) {
|
|
38903
|
+
if (range.isFullCol && !options.useFixedReference) {
|
|
38877
38904
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
38878
38905
|
str = colFixed + col + rowFixed + row;
|
|
38879
38906
|
}
|
|
@@ -38881,7 +38908,7 @@ class RangeAdapter {
|
|
|
38881
38908
|
str = colFixed + col;
|
|
38882
38909
|
}
|
|
38883
38910
|
}
|
|
38884
|
-
else if (range.isFullRow) {
|
|
38911
|
+
else if (range.isFullRow && !options.useFixedReference) {
|
|
38885
38912
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
38886
38913
|
str = colFixed + col + rowFixed + row;
|
|
38887
38914
|
}
|
|
@@ -55233,12 +55260,7 @@ function addFormula(cell) {
|
|
|
55233
55260
|
attrs.push(["t", "str"]);
|
|
55234
55261
|
cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
|
|
55235
55262
|
}
|
|
55236
|
-
node = escapeXml /*xml*/
|
|
55237
|
-
<f>
|
|
55238
|
-
${XlsxFormula}
|
|
55239
|
-
</f>
|
|
55240
|
-
${cycle}
|
|
55241
|
-
`;
|
|
55263
|
+
node = escapeXml /*xml*/ `<f>${XlsxFormula}</f>${cycle}`;
|
|
55242
55264
|
return { attrs, node };
|
|
55243
55265
|
}
|
|
55244
55266
|
function addContent(content, sharedStrings, forceString = false) {
|
|
@@ -56058,11 +56080,10 @@ function addRows(construct, data, sheet) {
|
|
|
56058
56080
|
({ attrs: additionalAttrs, node: cellNode } = addContent(cell.content, construct.sharedStrings, isTableHeader || isPlainText));
|
|
56059
56081
|
}
|
|
56060
56082
|
attributes.push(...additionalAttrs);
|
|
56061
|
-
|
|
56062
|
-
|
|
56063
|
-
|
|
56064
|
-
|
|
56065
|
-
`);
|
|
56083
|
+
// prettier-ignore
|
|
56084
|
+
cellNodes.push(escapeXml /*xml*/ `<c ${formatAttributes(attributes)}>
|
|
56085
|
+
${cellNode}
|
|
56086
|
+
</c>`);
|
|
56066
56087
|
}
|
|
56067
56088
|
}
|
|
56068
56089
|
if (cellNodes.length || row.size !== DEFAULT_CELL_HEIGHT || row.isHidden) {
|
|
@@ -56658,7 +56679,6 @@ class Model extends EventBus {
|
|
|
56658
56679
|
...config,
|
|
56659
56680
|
mode: config.mode || "normal",
|
|
56660
56681
|
custom: config.custom || {},
|
|
56661
|
-
defaultCurrencyFormat: config.defaultCurrencyFormat || "[$$]#,##0.00",
|
|
56662
56682
|
external: this.setupExternalConfig(config.external || {}),
|
|
56663
56683
|
transportService,
|
|
56664
56684
|
client,
|
|
@@ -56696,6 +56716,7 @@ class Model extends EventBus {
|
|
|
56696
56716
|
custom: this.config.custom,
|
|
56697
56717
|
uiActions: this.config,
|
|
56698
56718
|
session: this.session,
|
|
56719
|
+
defaultCurrencyFormat: this.config.defaultCurrencyFormat,
|
|
56699
56720
|
};
|
|
56700
56721
|
}
|
|
56701
56722
|
// ---------------------------------------------------------------------------
|
|
@@ -57041,6 +57062,6 @@ const constants = {
|
|
|
57041
57062
|
export { AbstractChart, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
|
|
57042
57063
|
|
|
57043
57064
|
|
|
57044
|
-
__info__.version = "17.1.
|
|
57045
|
-
__info__.date = "2024-
|
|
57046
|
-
__info__.hash = "
|
|
57065
|
+
__info__.version = "17.1.3";
|
|
57066
|
+
__info__.date = "2024-02-02T13:46:54.332Z";
|
|
57067
|
+
__info__.hash = "798f979";
|