@odoo/o-spreadsheet 17.0.8 → 17.0.10
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 +138 -109
- package/dist/o-spreadsheet.d.ts +11 -6
- package/dist/o-spreadsheet.esm.js +138 -109
- package/dist/o-spreadsheet.iife.js +138 -109
- package/dist/o-spreadsheet.iife.min.js +252 -259
- package/dist/o_spreadsheet.xml +5 -5
- 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.0.
|
|
6
|
-
* @date 2024-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.10
|
|
6
|
+
* @date 2024-02-02T13:48:28.727Z
|
|
7
|
+
* @hash be06aa9
|
|
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';
|
|
@@ -2120,6 +2120,7 @@ var CommandResult;
|
|
|
2120
2120
|
CommandResult["BlockingValidationRule"] = "BlockingValidationRule";
|
|
2121
2121
|
CommandResult["InvalidCopyPasteSelection"] = "InvalidCopyPasteSelection";
|
|
2122
2122
|
CommandResult["NoChanges"] = "NoChanges";
|
|
2123
|
+
CommandResult["InvalidInputId"] = "InvalidInputId";
|
|
2123
2124
|
})(CommandResult || (CommandResult = {}));
|
|
2124
2125
|
|
|
2125
2126
|
const DEFAULT_LOCALES = [
|
|
@@ -3264,27 +3265,30 @@ function roundFormat(format) {
|
|
|
3264
3265
|
}
|
|
3265
3266
|
function createLargeNumberFormat(format, magnitude, postFix, locale) {
|
|
3266
3267
|
const internalFormat = parseFormat(format || "#,##0");
|
|
3267
|
-
const largeNumberFormat =
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
format: {
|
|
3274
|
-
...formatPart.format,
|
|
3275
|
-
magnitude,
|
|
3276
|
-
decimalPart: undefined,
|
|
3277
|
-
},
|
|
3278
|
-
},
|
|
3279
|
-
{
|
|
3280
|
-
type: "STRING",
|
|
3281
|
-
format: postFix,
|
|
3282
|
-
},
|
|
3283
|
-
];
|
|
3268
|
+
const largeNumberFormat = [];
|
|
3269
|
+
for (let i = 0; i < internalFormat.length; i++) {
|
|
3270
|
+
const formatPart = internalFormat[i];
|
|
3271
|
+
if (formatPart.type !== "NUMBER") {
|
|
3272
|
+
largeNumberFormat.push(formatPart);
|
|
3273
|
+
continue;
|
|
3284
3274
|
}
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3275
|
+
largeNumberFormat.push({
|
|
3276
|
+
...formatPart,
|
|
3277
|
+
format: {
|
|
3278
|
+
...formatPart.format,
|
|
3279
|
+
magnitude,
|
|
3280
|
+
decimalPart: undefined,
|
|
3281
|
+
},
|
|
3282
|
+
});
|
|
3283
|
+
largeNumberFormat.push({
|
|
3284
|
+
type: "STRING",
|
|
3285
|
+
format: postFix,
|
|
3286
|
+
});
|
|
3287
|
+
const nextFormatPart = internalFormat[i + 1];
|
|
3288
|
+
if (nextFormatPart?.type === "STRING" && ["k", "m", "b"].includes(nextFormatPart.format)) {
|
|
3289
|
+
i++;
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3288
3292
|
return convertInternalFormatToFormat(largeNumberFormat);
|
|
3289
3293
|
}
|
|
3290
3294
|
function changeDecimalPlaces(format, step, locale) {
|
|
@@ -4928,14 +4932,8 @@ function createDataSets(getters, dataSetsString, sheetId, dataSetsHaveTitle) {
|
|
|
4928
4932
|
: undefined));
|
|
4929
4933
|
}
|
|
4930
4934
|
}
|
|
4931
|
-
else if (zone.left === zone.right && zone.top === zone.bottom) {
|
|
4932
|
-
// A single cell. If it's only the title, the dataset is not added.
|
|
4933
|
-
if (!dataSetsHaveTitle) {
|
|
4934
|
-
dataSets.push(createDataSet(getters, dataSetSheetId, zone, undefined));
|
|
4935
|
-
}
|
|
4936
|
-
}
|
|
4937
4935
|
else {
|
|
4938
|
-
/* 1 row or 1 column */
|
|
4936
|
+
/* 1 cell, 1 row or 1 column */
|
|
4939
4937
|
dataSets.push(createDataSet(getters, dataSetSheetId, zone, dataSetsHaveTitle
|
|
4940
4938
|
? {
|
|
4941
4939
|
top: zone.top,
|
|
@@ -4984,8 +4982,10 @@ function toExcelDataset(getters, ds) {
|
|
|
4984
4982
|
}
|
|
4985
4983
|
const dataRange = ds.dataRange.clone({ zone: dataZone });
|
|
4986
4984
|
return {
|
|
4987
|
-
label: ds.labelCell
|
|
4988
|
-
|
|
4985
|
+
label: ds.labelCell
|
|
4986
|
+
? getters.getRangeString(ds.labelCell, "forceSheetReference", { useFixedReference: true })
|
|
4987
|
+
: undefined,
|
|
4988
|
+
range: getters.getRangeString(dataRange, "forceSheetReference", { useFixedReference: true }),
|
|
4989
4989
|
};
|
|
4990
4990
|
}
|
|
4991
4991
|
function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
|
|
@@ -4998,7 +4998,7 @@ function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
|
|
|
4998
4998
|
zone.top = zone.top + 1;
|
|
4999
4999
|
}
|
|
5000
5000
|
const range = labelRange.clone({ zone });
|
|
5001
|
-
return getters.getRangeString(range, "forceSheetReference");
|
|
5001
|
+
return getters.getRangeString(range, "forceSheetReference", { useFixedReference: true });
|
|
5002
5002
|
}
|
|
5003
5003
|
/**
|
|
5004
5004
|
* Transform a chart definition which supports dataSets (dataSets and LabelRange)
|
|
@@ -8588,7 +8588,7 @@ class BarChart extends AbstractChart {
|
|
|
8588
8588
|
return undefined;
|
|
8589
8589
|
const dataSets = this.dataSets
|
|
8590
8590
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
8591
|
-
.filter((ds) => ds.range !== ""
|
|
8591
|
+
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
8592
8592
|
const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
|
|
8593
8593
|
return {
|
|
8594
8594
|
...this.getDefinition(),
|
|
@@ -9166,7 +9166,7 @@ class LineChart extends AbstractChart {
|
|
|
9166
9166
|
return undefined;
|
|
9167
9167
|
const dataSets = this.dataSets
|
|
9168
9168
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
9169
|
-
.filter((ds) => ds.range !== ""
|
|
9169
|
+
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
9170
9170
|
const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
|
|
9171
9171
|
return {
|
|
9172
9172
|
...this.getDefinition(),
|
|
@@ -9472,7 +9472,7 @@ class PieChart extends AbstractChart {
|
|
|
9472
9472
|
return undefined;
|
|
9473
9473
|
const dataSets = this.dataSets
|
|
9474
9474
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
9475
|
-
.filter((ds) => ds.range !== ""
|
|
9475
|
+
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
9476
9476
|
const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
|
|
9477
9477
|
return {
|
|
9478
9478
|
...this.getDefinition(),
|
|
@@ -19915,19 +19915,20 @@ const formatNumberPercent = createFormatActionSpec({
|
|
|
19915
19915
|
const formatNumberCurrency = createFormatActionSpec({
|
|
19916
19916
|
name: _t("Currency"),
|
|
19917
19917
|
descriptionValue: 1000.12,
|
|
19918
|
-
format: (env) => env.model.config.defaultCurrencyFormat,
|
|
19918
|
+
format: (env) => env.model.config.defaultCurrencyFormat ?? DEFAULT_CURRENCY_FORMAT,
|
|
19919
19919
|
});
|
|
19920
19920
|
const formatNumberCurrencyRounded = {
|
|
19921
19921
|
...createFormatActionSpec({
|
|
19922
19922
|
name: _t("Currency rounded"),
|
|
19923
19923
|
descriptionValue: 1000,
|
|
19924
|
-
format: (env) => roundFormat(env.model.config.defaultCurrencyFormat),
|
|
19924
|
+
format: (env) => roundFormat(env.model.config.defaultCurrencyFormat ?? DEFAULT_CURRENCY_FORMAT),
|
|
19925
19925
|
}),
|
|
19926
19926
|
isVisible: (env) => {
|
|
19927
19927
|
const currencyFormat = env.model.config.defaultCurrencyFormat;
|
|
19928
|
-
return currencyFormat !== roundFormat(currencyFormat);
|
|
19928
|
+
return currencyFormat !== roundFormat(currencyFormat ?? DEFAULT_CURRENCY_FORMAT);
|
|
19929
19929
|
},
|
|
19930
19930
|
};
|
|
19931
|
+
const DEFAULT_CURRENCY_FORMAT = "[$$]#,##0.00";
|
|
19931
19932
|
const EXAMPLE_DATE = parseLiteral("2023/09/26 10:43:00 PM", DEFAULT_LOCALE);
|
|
19932
19933
|
const formatCustomCurrency = {
|
|
19933
19934
|
name: _t("Custom currency"),
|
|
@@ -26806,6 +26807,9 @@ class Composer extends Component {
|
|
|
26806
26807
|
const token = tokens.filter((token) => token.value.includes(currentSelectedText) &&
|
|
26807
26808
|
token.start <= currentSelection.start &&
|
|
26808
26809
|
token.end >= currentSelection.end)[0];
|
|
26810
|
+
if (!token) {
|
|
26811
|
+
return;
|
|
26812
|
+
}
|
|
26809
26813
|
if (token.type === "REFERENCE") {
|
|
26810
26814
|
this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", {
|
|
26811
26815
|
start: token.start,
|
|
@@ -29344,6 +29348,7 @@ const registries$1 = {
|
|
|
29344
29348
|
GROUP_HEADERS: groupHeadersMenuRegistry,
|
|
29345
29349
|
UNGROUP_HEADERS: unGroupHeadersMenuRegistry,
|
|
29346
29350
|
};
|
|
29351
|
+
const MODIFIER_KEYS = ["Shift", "Control", "Alt", "Meta"];
|
|
29347
29352
|
// -----------------------------------------------------------------------------
|
|
29348
29353
|
// JS
|
|
29349
29354
|
// -----------------------------------------------------------------------------
|
|
@@ -29716,16 +29721,15 @@ class Grid extends Component {
|
|
|
29716
29721
|
}
|
|
29717
29722
|
}
|
|
29718
29723
|
onKeydown(ev) {
|
|
29719
|
-
const eventKey = ev.key.toUpperCase();
|
|
29720
29724
|
let keyDownString = "";
|
|
29721
|
-
if (
|
|
29722
|
-
|
|
29723
|
-
|
|
29724
|
-
|
|
29725
|
-
|
|
29726
|
-
|
|
29727
|
-
|
|
29728
|
-
|
|
29725
|
+
if (!MODIFIER_KEYS.includes(ev.key)) {
|
|
29726
|
+
if (isCtrlKey(ev))
|
|
29727
|
+
keyDownString += "CTRL+";
|
|
29728
|
+
if (ev.altKey)
|
|
29729
|
+
keyDownString += "ALT+";
|
|
29730
|
+
if (ev.shiftKey)
|
|
29731
|
+
keyDownString += "SHIFT+";
|
|
29732
|
+
}
|
|
29729
29733
|
keyDownString += ev.key.toUpperCase();
|
|
29730
29734
|
let handler = this.keyDownMapping[keyDownString];
|
|
29731
29735
|
if (handler) {
|
|
@@ -35563,6 +35567,9 @@ class CellPlugin extends CorePlugin {
|
|
|
35563
35567
|
format: cell.format ? getItemId(cell.format, formats) : undefined,
|
|
35564
35568
|
content: cell.content || undefined,
|
|
35565
35569
|
};
|
|
35570
|
+
if (cell instanceof FormulaCellWithDependencies) {
|
|
35571
|
+
cells[xc].content = cell.contentWithFixedReferences || undefined;
|
|
35572
|
+
}
|
|
35566
35573
|
}
|
|
35567
35574
|
_sheet.cells = cells;
|
|
35568
35575
|
}
|
|
@@ -35606,13 +35613,13 @@ class CellPlugin extends CorePlugin {
|
|
|
35606
35613
|
/*
|
|
35607
35614
|
* Reconstructs the original formula string based on a normalized form and its dependencies
|
|
35608
35615
|
*/
|
|
35609
|
-
getFormulaCellContent(sheetId, compiledFormula, dependencies) {
|
|
35616
|
+
getFormulaCellContent(sheetId, compiledFormula, dependencies, useFixedReference = false) {
|
|
35610
35617
|
const ranges = dependencies || compiledFormula.dependencies;
|
|
35611
35618
|
let rangeIndex = 0;
|
|
35612
35619
|
return concat(compiledFormula.tokens.map((token) => {
|
|
35613
35620
|
if (token.type === "REFERENCE") {
|
|
35614
35621
|
const range = ranges[rangeIndex++];
|
|
35615
|
-
return this.getters.getRangeString(range, sheetId);
|
|
35622
|
+
return this.getters.getRangeString(range, sheetId, { useFixedReference });
|
|
35616
35623
|
}
|
|
35617
35624
|
return token.value;
|
|
35618
35625
|
}));
|
|
@@ -35881,6 +35888,18 @@ class FormulaCellWithDependencies {
|
|
|
35881
35888
|
get content() {
|
|
35882
35889
|
return concat(this.compiledFormula.tokens.map((token) => token.value));
|
|
35883
35890
|
}
|
|
35891
|
+
get contentWithFixedReferences() {
|
|
35892
|
+
let rangeIndex = 0;
|
|
35893
|
+
return concat(this.compiledFormula.tokens.map((token) => {
|
|
35894
|
+
if (token.type === "REFERENCE") {
|
|
35895
|
+
const index = rangeIndex++;
|
|
35896
|
+
return this.getRangeString(this.compiledFormula.dependencies[index], this.sheetId, {
|
|
35897
|
+
useFixedReference: true,
|
|
35898
|
+
});
|
|
35899
|
+
}
|
|
35900
|
+
return token.value;
|
|
35901
|
+
}));
|
|
35902
|
+
}
|
|
35884
35903
|
}
|
|
35885
35904
|
class RangeReferenceToken {
|
|
35886
35905
|
getValue;
|
|
@@ -36185,7 +36204,13 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
36185
36204
|
}
|
|
36186
36205
|
}
|
|
36187
36206
|
exportForExcel(data) {
|
|
36188
|
-
|
|
36207
|
+
if (data.sheets) {
|
|
36208
|
+
for (let sheet of data.sheets) {
|
|
36209
|
+
if (this.cfRules[sheet.id]) {
|
|
36210
|
+
sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, { useFixedReference: true }));
|
|
36211
|
+
}
|
|
36212
|
+
}
|
|
36213
|
+
}
|
|
36189
36214
|
}
|
|
36190
36215
|
// ---------------------------------------------------------------------------
|
|
36191
36216
|
// Getters
|
|
@@ -36250,11 +36275,11 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
36250
36275
|
// ---------------------------------------------------------------------------
|
|
36251
36276
|
// Private
|
|
36252
36277
|
// ---------------------------------------------------------------------------
|
|
36253
|
-
mapToConditionalFormat(sheetId, cf) {
|
|
36278
|
+
mapToConditionalFormat(sheetId, cf, { useFixedReference } = { useFixedReference: false }) {
|
|
36254
36279
|
return {
|
|
36255
36280
|
...cf,
|
|
36256
36281
|
ranges: cf.ranges.map((range) => {
|
|
36257
|
-
return this.getters.getRangeString(range, sheetId);
|
|
36282
|
+
return this.getters.getRangeString(range, sheetId, { useFixedReference });
|
|
36258
36283
|
}),
|
|
36259
36284
|
};
|
|
36260
36285
|
}
|
|
@@ -38322,8 +38347,10 @@ class RangeAdapter {
|
|
|
38322
38347
|
*
|
|
38323
38348
|
* @param range the range (received from getRangeFromXC or getRangeFromZone)
|
|
38324
38349
|
* @param forSheetId the id of the sheet where the range string is supposed to be used.
|
|
38350
|
+
* @param options
|
|
38351
|
+
* @param options.useFixedReference if true, the range will be returned with fixed row and column
|
|
38325
38352
|
*/
|
|
38326
|
-
getRangeString(range, forSheetId) {
|
|
38353
|
+
getRangeString(range, forSheetId, options = { useFixedReference: false }) {
|
|
38327
38354
|
if (!range) {
|
|
38328
38355
|
return INCORRECT_RANGE_STRING;
|
|
38329
38356
|
}
|
|
@@ -38350,7 +38377,7 @@ class RangeAdapter {
|
|
|
38350
38377
|
if (prefixSheet && !sheetName) {
|
|
38351
38378
|
return INCORRECT_RANGE_STRING;
|
|
38352
38379
|
}
|
|
38353
|
-
let rangeString = this.getRangePartString(rangeImpl, 0);
|
|
38380
|
+
let rangeString = this.getRangePartString(rangeImpl, 0, options);
|
|
38354
38381
|
if (rangeImpl.parts && rangeImpl.parts.length === 2) {
|
|
38355
38382
|
// this if converts A2:A2 into A2 except if any part of the original range had fixed row or column (with $)
|
|
38356
38383
|
if (rangeImpl.zone.top !== rangeImpl.zone.bottom ||
|
|
@@ -38360,7 +38387,7 @@ class RangeAdapter {
|
|
|
38360
38387
|
rangeImpl.parts[1].rowFixed ||
|
|
38361
38388
|
rangeImpl.parts[1].colFixed) {
|
|
38362
38389
|
rangeString += ":";
|
|
38363
|
-
rangeString += this.getRangePartString(rangeImpl, 1);
|
|
38390
|
+
rangeString += this.getRangePartString(rangeImpl, 1, options);
|
|
38364
38391
|
}
|
|
38365
38392
|
}
|
|
38366
38393
|
return `${prefixSheet ? sheetName + "!" : ""}${rangeString}`;
|
|
@@ -38401,13 +38428,13 @@ class RangeAdapter {
|
|
|
38401
38428
|
/**
|
|
38402
38429
|
* Get a Xc string that represent a part of a range
|
|
38403
38430
|
*/
|
|
38404
|
-
getRangePartString(range, part) {
|
|
38431
|
+
getRangePartString(range, part, options = { useFixedReference: false }) {
|
|
38405
38432
|
const colFixed = range.parts && range.parts[part]?.colFixed ? "$" : "";
|
|
38406
38433
|
const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
|
|
38407
38434
|
const rowFixed = range.parts && range.parts[part]?.rowFixed ? "$" : "";
|
|
38408
38435
|
const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
|
|
38409
38436
|
let str = "";
|
|
38410
|
-
if (range.isFullCol) {
|
|
38437
|
+
if (range.isFullCol && !options.useFixedReference) {
|
|
38411
38438
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
38412
38439
|
str = colFixed + col + rowFixed + row;
|
|
38413
38440
|
}
|
|
@@ -38415,7 +38442,7 @@ class RangeAdapter {
|
|
|
38415
38442
|
str = colFixed + col;
|
|
38416
38443
|
}
|
|
38417
38444
|
}
|
|
38418
|
-
else if (range.isFullRow) {
|
|
38445
|
+
else if (range.isFullRow && !options.useFixedReference) {
|
|
38419
38446
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
38420
38447
|
str = colFixed + col + rowFixed + row;
|
|
38421
38448
|
}
|
|
@@ -39836,22 +39863,17 @@ class CompilationParametersBuilder {
|
|
|
39836
39863
|
* The `compute` of the formula's function must process it completely
|
|
39837
39864
|
*/
|
|
39838
39865
|
refFn(range, isMeta, functionName, paramNumber) {
|
|
39866
|
+
this.assertRangeValid(range);
|
|
39839
39867
|
if (isMeta) {
|
|
39840
39868
|
// Use zoneToXc of zone instead of getRangeString to avoid sending unbounded ranges
|
|
39841
39869
|
return { value: zoneToXc(range.zone) };
|
|
39842
39870
|
}
|
|
39843
|
-
if (!isZoneValid(range.zone)) {
|
|
39844
|
-
throw new InvalidReferenceError();
|
|
39845
|
-
}
|
|
39846
39871
|
// if the formula definition could have accepted a range, we would pass through the _range function and not here
|
|
39847
39872
|
if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
|
|
39848
39873
|
throw new Error(paramNumber
|
|
39849
39874
|
? _t("Function %s expects the parameter %s to be a single value or a single cell reference, not a range.", functionName.toString(), paramNumber.toString())
|
|
39850
39875
|
: _t("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
|
|
39851
39876
|
}
|
|
39852
|
-
if (range.invalidSheetName) {
|
|
39853
|
-
throw new Error(_t("Invalid sheet name: %s", range.invalidSheetName));
|
|
39854
|
-
}
|
|
39855
39877
|
const position = { sheetId: range.sheetId, col: range.zone.left, row: range.zone.top };
|
|
39856
39878
|
return this.readCell(position);
|
|
39857
39879
|
}
|
|
@@ -39886,10 +39908,10 @@ class CompilationParametersBuilder {
|
|
|
39886
39908
|
* Note that each col is possibly sparse: it only contain the values of cells
|
|
39887
39909
|
* that are actually present in the grid.
|
|
39888
39910
|
*/
|
|
39889
|
-
range(
|
|
39890
|
-
|
|
39891
|
-
|
|
39892
|
-
|
|
39911
|
+
range(range) {
|
|
39912
|
+
this.assertRangeValid(range);
|
|
39913
|
+
const sheetId = range.sheetId;
|
|
39914
|
+
const zone = range.zone;
|
|
39893
39915
|
// Performance issue: Avoid fetching data on positions that are out of the spreadsheet
|
|
39894
39916
|
// e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
|
|
39895
39917
|
const sheetZone = this.getters.getSheetZone(sheetId);
|
|
@@ -39926,6 +39948,14 @@ class CompilationParametersBuilder {
|
|
|
39926
39948
|
this.rangeCache[cacheKey] = matrix;
|
|
39927
39949
|
return matrix;
|
|
39928
39950
|
}
|
|
39951
|
+
assertRangeValid(range) {
|
|
39952
|
+
if (!isZoneValid(range.zone)) {
|
|
39953
|
+
throw new InvalidReferenceError();
|
|
39954
|
+
}
|
|
39955
|
+
if (range.invalidSheetName) {
|
|
39956
|
+
throw new Error(_t("Invalid sheet name: %s", range.invalidSheetName));
|
|
39957
|
+
}
|
|
39958
|
+
}
|
|
39929
39959
|
}
|
|
39930
39960
|
|
|
39931
39961
|
function quickselect(arr, k, left, right, compare) {
|
|
@@ -45998,27 +46028,6 @@ class SelectionInputPlugin extends UIPlugin {
|
|
|
45998
46028
|
// ---------------------------------------------------------------------------
|
|
45999
46029
|
// Command Handling
|
|
46000
46030
|
// ---------------------------------------------------------------------------
|
|
46001
|
-
allowDispatch(cmd) {
|
|
46002
|
-
switch (cmd.type) {
|
|
46003
|
-
case "ADD_RANGE":
|
|
46004
|
-
case "ADD_EMPTY_RANGE":
|
|
46005
|
-
if (this.inputHasSingleRange && this.ranges.length === 1) {
|
|
46006
|
-
return "MaximumRangesReached" /* CommandResult.MaximumRangesReached */;
|
|
46007
|
-
}
|
|
46008
|
-
break;
|
|
46009
|
-
case "REMOVE_RANGE":
|
|
46010
|
-
if (this.ranges.length === 1) {
|
|
46011
|
-
return "MinimumRangesReached" /* CommandResult.MinimumRangesReached */;
|
|
46012
|
-
}
|
|
46013
|
-
break;
|
|
46014
|
-
case "CHANGE_RANGE":
|
|
46015
|
-
if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
|
|
46016
|
-
return "MaximumRangesReached" /* CommandResult.MaximumRangesReached */;
|
|
46017
|
-
}
|
|
46018
|
-
break;
|
|
46019
|
-
}
|
|
46020
|
-
return "Success" /* CommandResult.Success */;
|
|
46021
|
-
}
|
|
46022
46031
|
handleEvent(event) {
|
|
46023
46032
|
if (this.focusedRangeIndex === null) {
|
|
46024
46033
|
return;
|
|
@@ -46256,6 +46265,15 @@ class SelectionInputsManagerPlugin extends UIPlugin {
|
|
|
46256
46265
|
// Command Handling
|
|
46257
46266
|
// ---------------------------------------------------------------------------
|
|
46258
46267
|
allowDispatch(cmd) {
|
|
46268
|
+
switch (cmd.type) {
|
|
46269
|
+
case "FOCUS_RANGE":
|
|
46270
|
+
case "CHANGE_RANGE":
|
|
46271
|
+
case "ADD_EMPTY_RANGE":
|
|
46272
|
+
case "REMOVE_RANGE":
|
|
46273
|
+
if (!this.inputs[cmd.id]) {
|
|
46274
|
+
return "InvalidInputId" /* CommandResult.InvalidInputId */;
|
|
46275
|
+
}
|
|
46276
|
+
}
|
|
46259
46277
|
switch (cmd.type) {
|
|
46260
46278
|
case "FOCUS_RANGE":
|
|
46261
46279
|
const index = this.currentInput?.getIndex(cmd.rangeId);
|
|
@@ -46263,9 +46281,25 @@ class SelectionInputsManagerPlugin extends UIPlugin {
|
|
|
46263
46281
|
return "InputAlreadyFocused" /* CommandResult.InputAlreadyFocused */;
|
|
46264
46282
|
}
|
|
46265
46283
|
break;
|
|
46266
|
-
|
|
46267
|
-
|
|
46268
|
-
|
|
46284
|
+
case "ADD_RANGE":
|
|
46285
|
+
case "ADD_EMPTY_RANGE":
|
|
46286
|
+
const input = this.inputs[cmd.id];
|
|
46287
|
+
if (input.inputHasSingleRange && input.ranges.length === 1) {
|
|
46288
|
+
return "MaximumRangesReached" /* CommandResult.MaximumRangesReached */;
|
|
46289
|
+
}
|
|
46290
|
+
break;
|
|
46291
|
+
case "REMOVE_RANGE":
|
|
46292
|
+
if (this.inputs[cmd.id].ranges.length === 1) {
|
|
46293
|
+
return "MinimumRangesReached" /* CommandResult.MinimumRangesReached */;
|
|
46294
|
+
}
|
|
46295
|
+
break;
|
|
46296
|
+
case "CHANGE_RANGE": {
|
|
46297
|
+
const input = this.inputs[cmd.id];
|
|
46298
|
+
if (input.inputHasSingleRange && cmd.value.split(",").length > 1) {
|
|
46299
|
+
return "MaximumRangesReached" /* CommandResult.MaximumRangesReached */;
|
|
46300
|
+
}
|
|
46301
|
+
break;
|
|
46302
|
+
}
|
|
46269
46303
|
}
|
|
46270
46304
|
return "Success" /* CommandResult.Success */;
|
|
46271
46305
|
}
|
|
@@ -48574,9 +48608,10 @@ class EditionPlugin extends UIPlugin {
|
|
|
48574
48608
|
*/
|
|
48575
48609
|
getReferencedRanges() {
|
|
48576
48610
|
const editionSheetId = this.getters.getCurrentEditedCell().sheetId;
|
|
48577
|
-
|
|
48611
|
+
const referenceRanges = this.currentTokens
|
|
48578
48612
|
.filter((token) => token.type === "REFERENCE")
|
|
48579
48613
|
.map((token) => this.getters.getRangeFromSheetXC(editionSheetId, token.value));
|
|
48614
|
+
return referenceRanges.filter((range) => !range.invalidSheetName && !range.invalidXc);
|
|
48580
48615
|
}
|
|
48581
48616
|
getAutoCompleteDataValidationValues() {
|
|
48582
48617
|
if (this.mode === "inactive") {
|
|
@@ -54934,12 +54969,7 @@ function addFormula(cell) {
|
|
|
54934
54969
|
attrs.push(["t", "str"]);
|
|
54935
54970
|
cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
|
|
54936
54971
|
}
|
|
54937
|
-
node = escapeXml /*xml*/
|
|
54938
|
-
<f>
|
|
54939
|
-
${XlsxFormula}
|
|
54940
|
-
</f>
|
|
54941
|
-
${cycle}
|
|
54942
|
-
`;
|
|
54972
|
+
node = escapeXml /*xml*/ `<f>${XlsxFormula}</f>${cycle}`;
|
|
54943
54973
|
return { attrs, node };
|
|
54944
54974
|
}
|
|
54945
54975
|
function addContent(content, sharedStrings, forceString = false) {
|
|
@@ -55758,11 +55788,10 @@ function addRows(construct, data, sheet) {
|
|
|
55758
55788
|
({ attrs: additionalAttrs, node: cellNode } = addContent(cell.content, construct.sharedStrings, isTableHeader));
|
|
55759
55789
|
}
|
|
55760
55790
|
attributes.push(...additionalAttrs);
|
|
55761
|
-
|
|
55762
|
-
|
|
55763
|
-
|
|
55764
|
-
|
|
55765
|
-
`);
|
|
55791
|
+
// prettier-ignore
|
|
55792
|
+
cellNodes.push(escapeXml /*xml*/ `<c ${formatAttributes(attributes)}>
|
|
55793
|
+
${cellNode}
|
|
55794
|
+
</c>`);
|
|
55766
55795
|
}
|
|
55767
55796
|
}
|
|
55768
55797
|
if (cellNodes.length || row.size !== DEFAULT_CELL_HEIGHT || row.isHidden) {
|
|
@@ -56358,7 +56387,6 @@ class Model extends EventBus {
|
|
|
56358
56387
|
...config,
|
|
56359
56388
|
mode: config.mode || "normal",
|
|
56360
56389
|
custom: config.custom || {},
|
|
56361
|
-
defaultCurrencyFormat: config.defaultCurrencyFormat || "[$$]#,##0.00",
|
|
56362
56390
|
external: this.setupExternalConfig(config.external || {}),
|
|
56363
56391
|
transportService,
|
|
56364
56392
|
client,
|
|
@@ -56396,6 +56424,7 @@ class Model extends EventBus {
|
|
|
56396
56424
|
custom: this.config.custom,
|
|
56397
56425
|
uiActions: this.config,
|
|
56398
56426
|
session: this.session,
|
|
56427
|
+
defaultCurrencyFormat: this.config.defaultCurrencyFormat,
|
|
56399
56428
|
};
|
|
56400
56429
|
}
|
|
56401
56430
|
// ---------------------------------------------------------------------------
|
|
@@ -56733,6 +56762,6 @@ const constants = {
|
|
|
56733
56762
|
export { AbstractChart, 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 };
|
|
56734
56763
|
|
|
56735
56764
|
|
|
56736
|
-
__info__.version = "17.0.
|
|
56737
|
-
__info__.date = "2024-
|
|
56738
|
-
__info__.hash = "
|
|
56765
|
+
__info__.version = "17.0.10";
|
|
56766
|
+
__info__.date = "2024-02-02T13:48:28.727Z";
|
|
56767
|
+
__info__.hash = "be06aa9";
|