@odoo/o-spreadsheet 17.1.1 → 17.1.2
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 +96 -78
- package/dist/o-spreadsheet.d.ts +11 -4
- package/dist/o-spreadsheet.esm.js +96 -78
- package/dist/o-spreadsheet.iife.js +96 -78
- package/dist/o-spreadsheet.iife.min.js +4 -4
- 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.1.
|
|
6
|
-
* @date 2024-01-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.1.2
|
|
6
|
+
* @date 2024-01-29T13:54:42.679Z
|
|
7
|
+
* @hash 043a0d5
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -2062,6 +2062,7 @@ exports.CommandResult = void 0;
|
|
|
2062
2062
|
CommandResult["BlockingValidationRule"] = "BlockingValidationRule";
|
|
2063
2063
|
CommandResult["InvalidCopyPasteSelection"] = "InvalidCopyPasteSelection";
|
|
2064
2064
|
CommandResult["NoChanges"] = "NoChanges";
|
|
2065
|
+
CommandResult["InvalidInputId"] = "InvalidInputId";
|
|
2065
2066
|
})(exports.CommandResult || (exports.CommandResult = {}));
|
|
2066
2067
|
|
|
2067
2068
|
const PLAIN_TEXT_FORMAT = "@"; // see OpenXML spec §18.8.31
|
|
@@ -2123,34 +2124,34 @@ const CellErrorType = {
|
|
|
2123
2124
|
const errorTypes = new Set(Object.values(CellErrorType));
|
|
2124
2125
|
class EvaluationError extends Error {
|
|
2125
2126
|
value;
|
|
2126
|
-
constructor(message, value = CellErrorType.GenericError) {
|
|
2127
|
-
super(message
|
|
2127
|
+
constructor(message = _t("Error"), value = CellErrorType.GenericError) {
|
|
2128
|
+
super(message);
|
|
2128
2129
|
this.value = value;
|
|
2129
2130
|
}
|
|
2130
2131
|
}
|
|
2131
2132
|
class BadExpressionError extends EvaluationError {
|
|
2132
|
-
constructor(message) {
|
|
2133
|
-
super(message
|
|
2133
|
+
constructor(message = _t("Invalid expression")) {
|
|
2134
|
+
super(message, CellErrorType.BadExpression);
|
|
2134
2135
|
}
|
|
2135
2136
|
}
|
|
2136
2137
|
class CircularDependencyError extends EvaluationError {
|
|
2137
|
-
constructor(message) {
|
|
2138
|
-
super(message
|
|
2138
|
+
constructor(message = _t("Circular reference")) {
|
|
2139
|
+
super(message, CellErrorType.CircularDependency);
|
|
2139
2140
|
}
|
|
2140
2141
|
}
|
|
2141
2142
|
class InvalidReferenceError extends EvaluationError {
|
|
2142
|
-
constructor(message) {
|
|
2143
|
-
super(message
|
|
2143
|
+
constructor(message = _t("Invalid reference")) {
|
|
2144
|
+
super(message, CellErrorType.InvalidReference);
|
|
2144
2145
|
}
|
|
2145
2146
|
}
|
|
2146
2147
|
class NotAvailableError extends EvaluationError {
|
|
2147
|
-
constructor(message) {
|
|
2148
|
-
super(message
|
|
2148
|
+
constructor(message = _t("Data not available")) {
|
|
2149
|
+
super(message, CellErrorType.NotAvailable);
|
|
2149
2150
|
}
|
|
2150
2151
|
}
|
|
2151
2152
|
class UnknownFunctionError extends EvaluationError {
|
|
2152
|
-
constructor(message) {
|
|
2153
|
-
super(message
|
|
2153
|
+
constructor(message = _t("Unknown function")) {
|
|
2154
|
+
super(message, CellErrorType.UnknownFunction);
|
|
2154
2155
|
}
|
|
2155
2156
|
}
|
|
2156
2157
|
|
|
@@ -3316,27 +3317,30 @@ function roundFormat(format) {
|
|
|
3316
3317
|
}
|
|
3317
3318
|
function createLargeNumberFormat(format, magnitude, postFix, locale) {
|
|
3318
3319
|
const internalFormat = parseFormat(format || "#,##0");
|
|
3319
|
-
const largeNumberFormat =
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
format: {
|
|
3326
|
-
...formatPart.format,
|
|
3327
|
-
magnitude,
|
|
3328
|
-
decimalPart: undefined,
|
|
3329
|
-
},
|
|
3330
|
-
},
|
|
3331
|
-
{
|
|
3332
|
-
type: "STRING",
|
|
3333
|
-
format: postFix,
|
|
3334
|
-
},
|
|
3335
|
-
];
|
|
3320
|
+
const largeNumberFormat = [];
|
|
3321
|
+
for (let i = 0; i < internalFormat.length; i++) {
|
|
3322
|
+
const formatPart = internalFormat[i];
|
|
3323
|
+
if (formatPart.type !== "NUMBER") {
|
|
3324
|
+
largeNumberFormat.push(formatPart);
|
|
3325
|
+
continue;
|
|
3336
3326
|
}
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3327
|
+
largeNumberFormat.push({
|
|
3328
|
+
...formatPart,
|
|
3329
|
+
format: {
|
|
3330
|
+
...formatPart.format,
|
|
3331
|
+
magnitude,
|
|
3332
|
+
decimalPart: undefined,
|
|
3333
|
+
},
|
|
3334
|
+
});
|
|
3335
|
+
largeNumberFormat.push({
|
|
3336
|
+
type: "STRING",
|
|
3337
|
+
format: postFix,
|
|
3338
|
+
});
|
|
3339
|
+
const nextFormatPart = internalFormat[i + 1];
|
|
3340
|
+
if (nextFormatPart?.type === "STRING" && ["k", "m", "b"].includes(nextFormatPart.format)) {
|
|
3341
|
+
i++;
|
|
3342
|
+
}
|
|
3343
|
+
}
|
|
3340
3344
|
return convertInternalFormatToFormat(largeNumberFormat);
|
|
3341
3345
|
}
|
|
3342
3346
|
function changeDecimalPlaces(format, step, locale) {
|
|
@@ -27288,6 +27292,9 @@ class Composer extends owl.Component {
|
|
|
27288
27292
|
const token = tokens.filter((token) => token.value.includes(currentSelectedText) &&
|
|
27289
27293
|
token.start <= currentSelection.start &&
|
|
27290
27294
|
token.end >= currentSelection.end)[0];
|
|
27295
|
+
if (!token) {
|
|
27296
|
+
return;
|
|
27297
|
+
}
|
|
27291
27298
|
if (token.type === "REFERENCE") {
|
|
27292
27299
|
this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", {
|
|
27293
27300
|
start: token.start,
|
|
@@ -40297,23 +40304,18 @@ class CompilationParametersBuilder {
|
|
|
40297
40304
|
* The `compute` of the formula's function must process it completely
|
|
40298
40305
|
*/
|
|
40299
40306
|
refFn(range, isMeta, functionName, paramNumber) {
|
|
40307
|
+
this.assertRangeValid(range);
|
|
40300
40308
|
if (isMeta) {
|
|
40301
40309
|
// Use zoneToXc of zone instead of getRangeString to avoid sending unbounded ranges
|
|
40302
40310
|
const sheetName = this.getters.getSheetName(range.sheetId);
|
|
40303
40311
|
return { value: getFullReference(sheetName, zoneToXc(range.zone)) };
|
|
40304
40312
|
}
|
|
40305
|
-
if (!isZoneValid(range.zone)) {
|
|
40306
|
-
throw new InvalidReferenceError();
|
|
40307
|
-
}
|
|
40308
40313
|
// if the formula definition could have accepted a range, we would pass through the _range function and not here
|
|
40309
40314
|
if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
|
|
40310
40315
|
throw new EvaluationError(paramNumber
|
|
40311
40316
|
? _t("Function %s expects the parameter %s to be a single value or a single cell reference, not a range.", functionName.toString(), paramNumber.toString())
|
|
40312
40317
|
: _t("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
|
|
40313
40318
|
}
|
|
40314
|
-
if (range.invalidSheetName) {
|
|
40315
|
-
throw new EvaluationError(_t("Invalid sheet name: %s", range.invalidSheetName));
|
|
40316
|
-
}
|
|
40317
40319
|
const position = { sheetId: range.sheetId, col: range.zone.left, row: range.zone.top };
|
|
40318
40320
|
return this.readCell(position);
|
|
40319
40321
|
}
|
|
@@ -40345,10 +40347,10 @@ class CompilationParametersBuilder {
|
|
|
40345
40347
|
* Note that each col is possibly sparse: it only contain the values of cells
|
|
40346
40348
|
* that are actually present in the grid.
|
|
40347
40349
|
*/
|
|
40348
|
-
range(
|
|
40349
|
-
|
|
40350
|
-
|
|
40351
|
-
|
|
40350
|
+
range(range) {
|
|
40351
|
+
this.assertRangeValid(range);
|
|
40352
|
+
const sheetId = range.sheetId;
|
|
40353
|
+
const zone = range.zone;
|
|
40352
40354
|
// Performance issue: Avoid fetching data on positions that are out of the spreadsheet
|
|
40353
40355
|
// e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
|
|
40354
40356
|
const sheetZone = this.getters.getSheetZone(sheetId);
|
|
@@ -40376,6 +40378,14 @@ class CompilationParametersBuilder {
|
|
|
40376
40378
|
this.rangeCache[cacheKey] = matrix;
|
|
40377
40379
|
return matrix;
|
|
40378
40380
|
}
|
|
40381
|
+
assertRangeValid(range) {
|
|
40382
|
+
if (!isZoneValid(range.zone)) {
|
|
40383
|
+
throw new InvalidReferenceError();
|
|
40384
|
+
}
|
|
40385
|
+
if (range.invalidSheetName) {
|
|
40386
|
+
throw new EvaluationError(_t("Invalid sheet name: %s", range.invalidSheetName));
|
|
40387
|
+
}
|
|
40388
|
+
}
|
|
40379
40389
|
}
|
|
40380
40390
|
|
|
40381
40391
|
function quickselect(arr, k, left, right, compare) {
|
|
@@ -45368,12 +45378,8 @@ class FindAndReplacePlugin extends UIPlugin {
|
|
|
45368
45378
|
case "ADD_COLUMNS_ROWS":
|
|
45369
45379
|
case "EVALUATE_CELLS":
|
|
45370
45380
|
case "UPDATE_CELL":
|
|
45371
|
-
this.isSearchDirty = true;
|
|
45372
|
-
break;
|
|
45373
45381
|
case "ACTIVATE_SHEET":
|
|
45374
|
-
|
|
45375
|
-
this.isSearchDirty = true;
|
|
45376
|
-
}
|
|
45382
|
+
this.isSearchDirty = true;
|
|
45377
45383
|
break;
|
|
45378
45384
|
}
|
|
45379
45385
|
}
|
|
@@ -46537,27 +46543,6 @@ class SelectionInputPlugin extends UIPlugin {
|
|
|
46537
46543
|
// ---------------------------------------------------------------------------
|
|
46538
46544
|
// Command Handling
|
|
46539
46545
|
// ---------------------------------------------------------------------------
|
|
46540
|
-
allowDispatch(cmd) {
|
|
46541
|
-
switch (cmd.type) {
|
|
46542
|
-
case "ADD_RANGE":
|
|
46543
|
-
case "ADD_EMPTY_RANGE":
|
|
46544
|
-
if (this.inputHasSingleRange && this.ranges.length === 1) {
|
|
46545
|
-
return "MaximumRangesReached" /* CommandResult.MaximumRangesReached */;
|
|
46546
|
-
}
|
|
46547
|
-
break;
|
|
46548
|
-
case "REMOVE_RANGE":
|
|
46549
|
-
if (this.ranges.length === 1) {
|
|
46550
|
-
return "MinimumRangesReached" /* CommandResult.MinimumRangesReached */;
|
|
46551
|
-
}
|
|
46552
|
-
break;
|
|
46553
|
-
case "CHANGE_RANGE":
|
|
46554
|
-
if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
|
|
46555
|
-
return "MaximumRangesReached" /* CommandResult.MaximumRangesReached */;
|
|
46556
|
-
}
|
|
46557
|
-
break;
|
|
46558
|
-
}
|
|
46559
|
-
return "Success" /* CommandResult.Success */;
|
|
46560
|
-
}
|
|
46561
46546
|
handleEvent(event) {
|
|
46562
46547
|
if (this.focusedRangeIndex === null) {
|
|
46563
46548
|
return;
|
|
@@ -46795,6 +46780,15 @@ class SelectionInputsManagerPlugin extends UIPlugin {
|
|
|
46795
46780
|
// Command Handling
|
|
46796
46781
|
// ---------------------------------------------------------------------------
|
|
46797
46782
|
allowDispatch(cmd) {
|
|
46783
|
+
switch (cmd.type) {
|
|
46784
|
+
case "FOCUS_RANGE":
|
|
46785
|
+
case "CHANGE_RANGE":
|
|
46786
|
+
case "ADD_EMPTY_RANGE":
|
|
46787
|
+
case "REMOVE_RANGE":
|
|
46788
|
+
if (!this.inputs[cmd.id]) {
|
|
46789
|
+
return "InvalidInputId" /* CommandResult.InvalidInputId */;
|
|
46790
|
+
}
|
|
46791
|
+
}
|
|
46798
46792
|
switch (cmd.type) {
|
|
46799
46793
|
case "FOCUS_RANGE":
|
|
46800
46794
|
const index = this.currentInput?.getIndex(cmd.rangeId);
|
|
@@ -46802,9 +46796,25 @@ class SelectionInputsManagerPlugin extends UIPlugin {
|
|
|
46802
46796
|
return "InputAlreadyFocused" /* CommandResult.InputAlreadyFocused */;
|
|
46803
46797
|
}
|
|
46804
46798
|
break;
|
|
46805
|
-
|
|
46806
|
-
|
|
46807
|
-
|
|
46799
|
+
case "ADD_RANGE":
|
|
46800
|
+
case "ADD_EMPTY_RANGE":
|
|
46801
|
+
const input = this.inputs[cmd.id];
|
|
46802
|
+
if (input.inputHasSingleRange && input.ranges.length === 1) {
|
|
46803
|
+
return "MaximumRangesReached" /* CommandResult.MaximumRangesReached */;
|
|
46804
|
+
}
|
|
46805
|
+
break;
|
|
46806
|
+
case "REMOVE_RANGE":
|
|
46807
|
+
if (this.inputs[cmd.id].ranges.length === 1) {
|
|
46808
|
+
return "MinimumRangesReached" /* CommandResult.MinimumRangesReached */;
|
|
46809
|
+
}
|
|
46810
|
+
break;
|
|
46811
|
+
case "CHANGE_RANGE": {
|
|
46812
|
+
const input = this.inputs[cmd.id];
|
|
46813
|
+
if (input.inputHasSingleRange && cmd.value.split(",").length > 1) {
|
|
46814
|
+
return "MaximumRangesReached" /* CommandResult.MaximumRangesReached */;
|
|
46815
|
+
}
|
|
46816
|
+
break;
|
|
46817
|
+
}
|
|
46808
46818
|
}
|
|
46809
46819
|
return "Success" /* CommandResult.Success */;
|
|
46810
46820
|
}
|
|
@@ -48934,9 +48944,10 @@ class EditionPlugin extends UIPlugin {
|
|
|
48934
48944
|
*/
|
|
48935
48945
|
getReferencedRanges() {
|
|
48936
48946
|
const editionSheetId = this.getters.getCurrentEditedCell().sheetId;
|
|
48937
|
-
|
|
48947
|
+
const referenceRanges = this.currentTokens
|
|
48938
48948
|
.filter((token) => token.type === "REFERENCE")
|
|
48939
48949
|
.map((token) => this.getters.getRangeFromSheetXC(editionSheetId, token.value));
|
|
48950
|
+
return referenceRanges.filter((range) => !range.invalidSheetName && !range.invalidXc);
|
|
48940
48951
|
}
|
|
48941
48952
|
getAutoCompleteDataValidationValues() {
|
|
48942
48953
|
if (this.mode === "inactive") {
|
|
@@ -56990,6 +57001,13 @@ const links = {
|
|
|
56990
57001
|
urlRepresentation,
|
|
56991
57002
|
};
|
|
56992
57003
|
const components = {
|
|
57004
|
+
Checkbox,
|
|
57005
|
+
Section,
|
|
57006
|
+
ChartColor,
|
|
57007
|
+
ChartDataSeries,
|
|
57008
|
+
ChartErrorSection,
|
|
57009
|
+
ChartLabelRange,
|
|
57010
|
+
ChartTitle,
|
|
56993
57011
|
ChartPanel,
|
|
56994
57012
|
ChartFigure,
|
|
56995
57013
|
ChartJsComponent,
|
|
@@ -57061,6 +57079,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
57061
57079
|
exports.tokenize = tokenize;
|
|
57062
57080
|
|
|
57063
57081
|
|
|
57064
|
-
__info__.version = "17.1.
|
|
57065
|
-
__info__.date = "2024-01-
|
|
57066
|
-
__info__.hash = "
|
|
57082
|
+
__info__.version = "17.1.2";
|
|
57083
|
+
__info__.date = "2024-01-29T13:54:42.679Z";
|
|
57084
|
+
__info__.hash = "043a0d5";
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -2448,7 +2448,8 @@ declare const enum CommandResult {
|
|
|
2448
2448
|
InvalidNumberOfCriterionValues = "InvalidNumberOfCriterionValues",
|
|
2449
2449
|
BlockingValidationRule = "BlockingValidationRule",
|
|
2450
2450
|
InvalidCopyPasteSelection = "InvalidCopyPasteSelection",
|
|
2451
|
-
NoChanges = "NoChanges"
|
|
2451
|
+
NoChanges = "NoChanges",
|
|
2452
|
+
InvalidInputId = "InvalidInputId"
|
|
2452
2453
|
}
|
|
2453
2454
|
interface CommandHandler<T> {
|
|
2454
2455
|
allowDispatch(command: T): CommandResult | CommandResult[];
|
|
@@ -4548,14 +4549,13 @@ interface RangeInputValue {
|
|
|
4548
4549
|
* This plugin handles this internal state.
|
|
4549
4550
|
*/
|
|
4550
4551
|
declare class SelectionInputPlugin extends UIPlugin implements StreamCallbacks<SelectionEvent> {
|
|
4551
|
-
|
|
4552
|
+
readonly inputHasSingleRange: boolean;
|
|
4552
4553
|
static layers: LAYERS[];
|
|
4553
4554
|
static getters: never[];
|
|
4554
4555
|
ranges: RangeInputValue[];
|
|
4555
4556
|
focusedRangeIndex: number | null;
|
|
4556
4557
|
private inputSheetId;
|
|
4557
4558
|
constructor(config: UIPluginConfig, initialRanges: string[], inputHasSingleRange: boolean);
|
|
4558
|
-
allowDispatch(cmd: LocalCommand): CommandResult;
|
|
4559
4559
|
handleEvent(event: SelectionEvent): void;
|
|
4560
4560
|
handle(cmd: Command): void;
|
|
4561
4561
|
getSelectionInputValue(): string[];
|
|
@@ -5578,7 +5578,7 @@ interface Props$L {
|
|
|
5578
5578
|
name: string;
|
|
5579
5579
|
label: string;
|
|
5580
5580
|
value: boolean;
|
|
5581
|
-
|
|
5581
|
+
onChange: (value: boolean) => void;
|
|
5582
5582
|
}>;
|
|
5583
5583
|
}
|
|
5584
5584
|
declare class ChartLabelRange extends Component<Props$L, SpreadsheetChildEnv> {
|
|
@@ -8652,6 +8652,13 @@ declare const links: {
|
|
|
8652
8652
|
urlRepresentation: typeof urlRepresentation;
|
|
8653
8653
|
};
|
|
8654
8654
|
declare const components: {
|
|
8655
|
+
Checkbox: typeof Checkbox;
|
|
8656
|
+
Section: typeof Section;
|
|
8657
|
+
ChartColor: typeof ChartColor;
|
|
8658
|
+
ChartDataSeries: typeof ChartDataSeries;
|
|
8659
|
+
ChartErrorSection: typeof ChartErrorSection;
|
|
8660
|
+
ChartLabelRange: typeof ChartLabelRange;
|
|
8661
|
+
ChartTitle: typeof ChartTitle;
|
|
8655
8662
|
ChartPanel: typeof ChartPanel;
|
|
8656
8663
|
ChartFigure: typeof ChartFigure;
|
|
8657
8664
|
ChartJsComponent: typeof ChartJsComponent;
|
|
@@ -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-01-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.1.2
|
|
6
|
+
* @date 2024-01-29T13:54:42.679Z
|
|
7
|
+
* @hash 043a0d5
|
|
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';
|
|
@@ -2060,6 +2060,7 @@ var CommandResult;
|
|
|
2060
2060
|
CommandResult["BlockingValidationRule"] = "BlockingValidationRule";
|
|
2061
2061
|
CommandResult["InvalidCopyPasteSelection"] = "InvalidCopyPasteSelection";
|
|
2062
2062
|
CommandResult["NoChanges"] = "NoChanges";
|
|
2063
|
+
CommandResult["InvalidInputId"] = "InvalidInputId";
|
|
2063
2064
|
})(CommandResult || (CommandResult = {}));
|
|
2064
2065
|
|
|
2065
2066
|
const PLAIN_TEXT_FORMAT = "@"; // see OpenXML spec §18.8.31
|
|
@@ -2121,34 +2122,34 @@ const CellErrorType = {
|
|
|
2121
2122
|
const errorTypes = new Set(Object.values(CellErrorType));
|
|
2122
2123
|
class EvaluationError extends Error {
|
|
2123
2124
|
value;
|
|
2124
|
-
constructor(message, value = CellErrorType.GenericError) {
|
|
2125
|
-
super(message
|
|
2125
|
+
constructor(message = _t("Error"), value = CellErrorType.GenericError) {
|
|
2126
|
+
super(message);
|
|
2126
2127
|
this.value = value;
|
|
2127
2128
|
}
|
|
2128
2129
|
}
|
|
2129
2130
|
class BadExpressionError extends EvaluationError {
|
|
2130
|
-
constructor(message) {
|
|
2131
|
-
super(message
|
|
2131
|
+
constructor(message = _t("Invalid expression")) {
|
|
2132
|
+
super(message, CellErrorType.BadExpression);
|
|
2132
2133
|
}
|
|
2133
2134
|
}
|
|
2134
2135
|
class CircularDependencyError extends EvaluationError {
|
|
2135
|
-
constructor(message) {
|
|
2136
|
-
super(message
|
|
2136
|
+
constructor(message = _t("Circular reference")) {
|
|
2137
|
+
super(message, CellErrorType.CircularDependency);
|
|
2137
2138
|
}
|
|
2138
2139
|
}
|
|
2139
2140
|
class InvalidReferenceError extends EvaluationError {
|
|
2140
|
-
constructor(message) {
|
|
2141
|
-
super(message
|
|
2141
|
+
constructor(message = _t("Invalid reference")) {
|
|
2142
|
+
super(message, CellErrorType.InvalidReference);
|
|
2142
2143
|
}
|
|
2143
2144
|
}
|
|
2144
2145
|
class NotAvailableError extends EvaluationError {
|
|
2145
|
-
constructor(message) {
|
|
2146
|
-
super(message
|
|
2146
|
+
constructor(message = _t("Data not available")) {
|
|
2147
|
+
super(message, CellErrorType.NotAvailable);
|
|
2147
2148
|
}
|
|
2148
2149
|
}
|
|
2149
2150
|
class UnknownFunctionError extends EvaluationError {
|
|
2150
|
-
constructor(message) {
|
|
2151
|
-
super(message
|
|
2151
|
+
constructor(message = _t("Unknown function")) {
|
|
2152
|
+
super(message, CellErrorType.UnknownFunction);
|
|
2152
2153
|
}
|
|
2153
2154
|
}
|
|
2154
2155
|
|
|
@@ -3314,27 +3315,30 @@ function roundFormat(format) {
|
|
|
3314
3315
|
}
|
|
3315
3316
|
function createLargeNumberFormat(format, magnitude, postFix, locale) {
|
|
3316
3317
|
const internalFormat = parseFormat(format || "#,##0");
|
|
3317
|
-
const largeNumberFormat =
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
format: {
|
|
3324
|
-
...formatPart.format,
|
|
3325
|
-
magnitude,
|
|
3326
|
-
decimalPart: undefined,
|
|
3327
|
-
},
|
|
3328
|
-
},
|
|
3329
|
-
{
|
|
3330
|
-
type: "STRING",
|
|
3331
|
-
format: postFix,
|
|
3332
|
-
},
|
|
3333
|
-
];
|
|
3318
|
+
const largeNumberFormat = [];
|
|
3319
|
+
for (let i = 0; i < internalFormat.length; i++) {
|
|
3320
|
+
const formatPart = internalFormat[i];
|
|
3321
|
+
if (formatPart.type !== "NUMBER") {
|
|
3322
|
+
largeNumberFormat.push(formatPart);
|
|
3323
|
+
continue;
|
|
3334
3324
|
}
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3325
|
+
largeNumberFormat.push({
|
|
3326
|
+
...formatPart,
|
|
3327
|
+
format: {
|
|
3328
|
+
...formatPart.format,
|
|
3329
|
+
magnitude,
|
|
3330
|
+
decimalPart: undefined,
|
|
3331
|
+
},
|
|
3332
|
+
});
|
|
3333
|
+
largeNumberFormat.push({
|
|
3334
|
+
type: "STRING",
|
|
3335
|
+
format: postFix,
|
|
3336
|
+
});
|
|
3337
|
+
const nextFormatPart = internalFormat[i + 1];
|
|
3338
|
+
if (nextFormatPart?.type === "STRING" && ["k", "m", "b"].includes(nextFormatPart.format)) {
|
|
3339
|
+
i++;
|
|
3340
|
+
}
|
|
3341
|
+
}
|
|
3338
3342
|
return convertInternalFormatToFormat(largeNumberFormat);
|
|
3339
3343
|
}
|
|
3340
3344
|
function changeDecimalPlaces(format, step, locale) {
|
|
@@ -27286,6 +27290,9 @@ class Composer extends Component {
|
|
|
27286
27290
|
const token = tokens.filter((token) => token.value.includes(currentSelectedText) &&
|
|
27287
27291
|
token.start <= currentSelection.start &&
|
|
27288
27292
|
token.end >= currentSelection.end)[0];
|
|
27293
|
+
if (!token) {
|
|
27294
|
+
return;
|
|
27295
|
+
}
|
|
27289
27296
|
if (token.type === "REFERENCE") {
|
|
27290
27297
|
this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", {
|
|
27291
27298
|
start: token.start,
|
|
@@ -40295,23 +40302,18 @@ class CompilationParametersBuilder {
|
|
|
40295
40302
|
* The `compute` of the formula's function must process it completely
|
|
40296
40303
|
*/
|
|
40297
40304
|
refFn(range, isMeta, functionName, paramNumber) {
|
|
40305
|
+
this.assertRangeValid(range);
|
|
40298
40306
|
if (isMeta) {
|
|
40299
40307
|
// Use zoneToXc of zone instead of getRangeString to avoid sending unbounded ranges
|
|
40300
40308
|
const sheetName = this.getters.getSheetName(range.sheetId);
|
|
40301
40309
|
return { value: getFullReference(sheetName, zoneToXc(range.zone)) };
|
|
40302
40310
|
}
|
|
40303
|
-
if (!isZoneValid(range.zone)) {
|
|
40304
|
-
throw new InvalidReferenceError();
|
|
40305
|
-
}
|
|
40306
40311
|
// if the formula definition could have accepted a range, we would pass through the _range function and not here
|
|
40307
40312
|
if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
|
|
40308
40313
|
throw new EvaluationError(paramNumber
|
|
40309
40314
|
? _t("Function %s expects the parameter %s to be a single value or a single cell reference, not a range.", functionName.toString(), paramNumber.toString())
|
|
40310
40315
|
: _t("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
|
|
40311
40316
|
}
|
|
40312
|
-
if (range.invalidSheetName) {
|
|
40313
|
-
throw new EvaluationError(_t("Invalid sheet name: %s", range.invalidSheetName));
|
|
40314
|
-
}
|
|
40315
40317
|
const position = { sheetId: range.sheetId, col: range.zone.left, row: range.zone.top };
|
|
40316
40318
|
return this.readCell(position);
|
|
40317
40319
|
}
|
|
@@ -40343,10 +40345,10 @@ class CompilationParametersBuilder {
|
|
|
40343
40345
|
* Note that each col is possibly sparse: it only contain the values of cells
|
|
40344
40346
|
* that are actually present in the grid.
|
|
40345
40347
|
*/
|
|
40346
|
-
range(
|
|
40347
|
-
|
|
40348
|
-
|
|
40349
|
-
|
|
40348
|
+
range(range) {
|
|
40349
|
+
this.assertRangeValid(range);
|
|
40350
|
+
const sheetId = range.sheetId;
|
|
40351
|
+
const zone = range.zone;
|
|
40350
40352
|
// Performance issue: Avoid fetching data on positions that are out of the spreadsheet
|
|
40351
40353
|
// e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
|
|
40352
40354
|
const sheetZone = this.getters.getSheetZone(sheetId);
|
|
@@ -40374,6 +40376,14 @@ class CompilationParametersBuilder {
|
|
|
40374
40376
|
this.rangeCache[cacheKey] = matrix;
|
|
40375
40377
|
return matrix;
|
|
40376
40378
|
}
|
|
40379
|
+
assertRangeValid(range) {
|
|
40380
|
+
if (!isZoneValid(range.zone)) {
|
|
40381
|
+
throw new InvalidReferenceError();
|
|
40382
|
+
}
|
|
40383
|
+
if (range.invalidSheetName) {
|
|
40384
|
+
throw new EvaluationError(_t("Invalid sheet name: %s", range.invalidSheetName));
|
|
40385
|
+
}
|
|
40386
|
+
}
|
|
40377
40387
|
}
|
|
40378
40388
|
|
|
40379
40389
|
function quickselect(arr, k, left, right, compare) {
|
|
@@ -45366,12 +45376,8 @@ class FindAndReplacePlugin extends UIPlugin {
|
|
|
45366
45376
|
case "ADD_COLUMNS_ROWS":
|
|
45367
45377
|
case "EVALUATE_CELLS":
|
|
45368
45378
|
case "UPDATE_CELL":
|
|
45369
|
-
this.isSearchDirty = true;
|
|
45370
|
-
break;
|
|
45371
45379
|
case "ACTIVATE_SHEET":
|
|
45372
|
-
|
|
45373
|
-
this.isSearchDirty = true;
|
|
45374
|
-
}
|
|
45380
|
+
this.isSearchDirty = true;
|
|
45375
45381
|
break;
|
|
45376
45382
|
}
|
|
45377
45383
|
}
|
|
@@ -46535,27 +46541,6 @@ class SelectionInputPlugin extends UIPlugin {
|
|
|
46535
46541
|
// ---------------------------------------------------------------------------
|
|
46536
46542
|
// Command Handling
|
|
46537
46543
|
// ---------------------------------------------------------------------------
|
|
46538
|
-
allowDispatch(cmd) {
|
|
46539
|
-
switch (cmd.type) {
|
|
46540
|
-
case "ADD_RANGE":
|
|
46541
|
-
case "ADD_EMPTY_RANGE":
|
|
46542
|
-
if (this.inputHasSingleRange && this.ranges.length === 1) {
|
|
46543
|
-
return "MaximumRangesReached" /* CommandResult.MaximumRangesReached */;
|
|
46544
|
-
}
|
|
46545
|
-
break;
|
|
46546
|
-
case "REMOVE_RANGE":
|
|
46547
|
-
if (this.ranges.length === 1) {
|
|
46548
|
-
return "MinimumRangesReached" /* CommandResult.MinimumRangesReached */;
|
|
46549
|
-
}
|
|
46550
|
-
break;
|
|
46551
|
-
case "CHANGE_RANGE":
|
|
46552
|
-
if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
|
|
46553
|
-
return "MaximumRangesReached" /* CommandResult.MaximumRangesReached */;
|
|
46554
|
-
}
|
|
46555
|
-
break;
|
|
46556
|
-
}
|
|
46557
|
-
return "Success" /* CommandResult.Success */;
|
|
46558
|
-
}
|
|
46559
46544
|
handleEvent(event) {
|
|
46560
46545
|
if (this.focusedRangeIndex === null) {
|
|
46561
46546
|
return;
|
|
@@ -46793,6 +46778,15 @@ class SelectionInputsManagerPlugin extends UIPlugin {
|
|
|
46793
46778
|
// Command Handling
|
|
46794
46779
|
// ---------------------------------------------------------------------------
|
|
46795
46780
|
allowDispatch(cmd) {
|
|
46781
|
+
switch (cmd.type) {
|
|
46782
|
+
case "FOCUS_RANGE":
|
|
46783
|
+
case "CHANGE_RANGE":
|
|
46784
|
+
case "ADD_EMPTY_RANGE":
|
|
46785
|
+
case "REMOVE_RANGE":
|
|
46786
|
+
if (!this.inputs[cmd.id]) {
|
|
46787
|
+
return "InvalidInputId" /* CommandResult.InvalidInputId */;
|
|
46788
|
+
}
|
|
46789
|
+
}
|
|
46796
46790
|
switch (cmd.type) {
|
|
46797
46791
|
case "FOCUS_RANGE":
|
|
46798
46792
|
const index = this.currentInput?.getIndex(cmd.rangeId);
|
|
@@ -46800,9 +46794,25 @@ class SelectionInputsManagerPlugin extends UIPlugin {
|
|
|
46800
46794
|
return "InputAlreadyFocused" /* CommandResult.InputAlreadyFocused */;
|
|
46801
46795
|
}
|
|
46802
46796
|
break;
|
|
46803
|
-
|
|
46804
|
-
|
|
46805
|
-
|
|
46797
|
+
case "ADD_RANGE":
|
|
46798
|
+
case "ADD_EMPTY_RANGE":
|
|
46799
|
+
const input = this.inputs[cmd.id];
|
|
46800
|
+
if (input.inputHasSingleRange && input.ranges.length === 1) {
|
|
46801
|
+
return "MaximumRangesReached" /* CommandResult.MaximumRangesReached */;
|
|
46802
|
+
}
|
|
46803
|
+
break;
|
|
46804
|
+
case "REMOVE_RANGE":
|
|
46805
|
+
if (this.inputs[cmd.id].ranges.length === 1) {
|
|
46806
|
+
return "MinimumRangesReached" /* CommandResult.MinimumRangesReached */;
|
|
46807
|
+
}
|
|
46808
|
+
break;
|
|
46809
|
+
case "CHANGE_RANGE": {
|
|
46810
|
+
const input = this.inputs[cmd.id];
|
|
46811
|
+
if (input.inputHasSingleRange && cmd.value.split(",").length > 1) {
|
|
46812
|
+
return "MaximumRangesReached" /* CommandResult.MaximumRangesReached */;
|
|
46813
|
+
}
|
|
46814
|
+
break;
|
|
46815
|
+
}
|
|
46806
46816
|
}
|
|
46807
46817
|
return "Success" /* CommandResult.Success */;
|
|
46808
46818
|
}
|
|
@@ -48932,9 +48942,10 @@ class EditionPlugin extends UIPlugin {
|
|
|
48932
48942
|
*/
|
|
48933
48943
|
getReferencedRanges() {
|
|
48934
48944
|
const editionSheetId = this.getters.getCurrentEditedCell().sheetId;
|
|
48935
|
-
|
|
48945
|
+
const referenceRanges = this.currentTokens
|
|
48936
48946
|
.filter((token) => token.type === "REFERENCE")
|
|
48937
48947
|
.map((token) => this.getters.getRangeFromSheetXC(editionSheetId, token.value));
|
|
48948
|
+
return referenceRanges.filter((range) => !range.invalidSheetName && !range.invalidXc);
|
|
48938
48949
|
}
|
|
48939
48950
|
getAutoCompleteDataValidationValues() {
|
|
48940
48951
|
if (this.mode === "inactive") {
|
|
@@ -56988,6 +56999,13 @@ const links = {
|
|
|
56988
56999
|
urlRepresentation,
|
|
56989
57000
|
};
|
|
56990
57001
|
const components = {
|
|
57002
|
+
Checkbox,
|
|
57003
|
+
Section,
|
|
57004
|
+
ChartColor,
|
|
57005
|
+
ChartDataSeries,
|
|
57006
|
+
ChartErrorSection,
|
|
57007
|
+
ChartLabelRange,
|
|
57008
|
+
ChartTitle,
|
|
56991
57009
|
ChartPanel,
|
|
56992
57010
|
ChartFigure,
|
|
56993
57011
|
ChartJsComponent,
|
|
@@ -57023,6 +57041,6 @@ const constants = {
|
|
|
57023
57041
|
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 };
|
|
57024
57042
|
|
|
57025
57043
|
|
|
57026
|
-
__info__.version = "17.1.
|
|
57027
|
-
__info__.date = "2024-01-
|
|
57028
|
-
__info__.hash = "
|
|
57044
|
+
__info__.version = "17.1.2";
|
|
57045
|
+
__info__.date = "2024-01-29T13:54:42.679Z";
|
|
57046
|
+
__info__.hash = "043a0d5";
|