@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
|
(function (exports, owl) {
|
|
@@ -2061,6 +2061,7 @@
|
|
|
2061
2061
|
CommandResult["BlockingValidationRule"] = "BlockingValidationRule";
|
|
2062
2062
|
CommandResult["InvalidCopyPasteSelection"] = "InvalidCopyPasteSelection";
|
|
2063
2063
|
CommandResult["NoChanges"] = "NoChanges";
|
|
2064
|
+
CommandResult["InvalidInputId"] = "InvalidInputId";
|
|
2064
2065
|
})(exports.CommandResult || (exports.CommandResult = {}));
|
|
2065
2066
|
|
|
2066
2067
|
const PLAIN_TEXT_FORMAT = "@"; // see OpenXML spec §18.8.31
|
|
@@ -2122,34 +2123,34 @@
|
|
|
2122
2123
|
const errorTypes = new Set(Object.values(CellErrorType));
|
|
2123
2124
|
class EvaluationError extends Error {
|
|
2124
2125
|
value;
|
|
2125
|
-
constructor(message, value = CellErrorType.GenericError) {
|
|
2126
|
-
super(message
|
|
2126
|
+
constructor(message = _t("Error"), value = CellErrorType.GenericError) {
|
|
2127
|
+
super(message);
|
|
2127
2128
|
this.value = value;
|
|
2128
2129
|
}
|
|
2129
2130
|
}
|
|
2130
2131
|
class BadExpressionError extends EvaluationError {
|
|
2131
|
-
constructor(message) {
|
|
2132
|
-
super(message
|
|
2132
|
+
constructor(message = _t("Invalid expression")) {
|
|
2133
|
+
super(message, CellErrorType.BadExpression);
|
|
2133
2134
|
}
|
|
2134
2135
|
}
|
|
2135
2136
|
class CircularDependencyError extends EvaluationError {
|
|
2136
|
-
constructor(message) {
|
|
2137
|
-
super(message
|
|
2137
|
+
constructor(message = _t("Circular reference")) {
|
|
2138
|
+
super(message, CellErrorType.CircularDependency);
|
|
2138
2139
|
}
|
|
2139
2140
|
}
|
|
2140
2141
|
class InvalidReferenceError extends EvaluationError {
|
|
2141
|
-
constructor(message) {
|
|
2142
|
-
super(message
|
|
2142
|
+
constructor(message = _t("Invalid reference")) {
|
|
2143
|
+
super(message, CellErrorType.InvalidReference);
|
|
2143
2144
|
}
|
|
2144
2145
|
}
|
|
2145
2146
|
class NotAvailableError extends EvaluationError {
|
|
2146
|
-
constructor(message) {
|
|
2147
|
-
super(message
|
|
2147
|
+
constructor(message = _t("Data not available")) {
|
|
2148
|
+
super(message, CellErrorType.NotAvailable);
|
|
2148
2149
|
}
|
|
2149
2150
|
}
|
|
2150
2151
|
class UnknownFunctionError extends EvaluationError {
|
|
2151
|
-
constructor(message) {
|
|
2152
|
-
super(message
|
|
2152
|
+
constructor(message = _t("Unknown function")) {
|
|
2153
|
+
super(message, CellErrorType.UnknownFunction);
|
|
2153
2154
|
}
|
|
2154
2155
|
}
|
|
2155
2156
|
|
|
@@ -3315,27 +3316,30 @@
|
|
|
3315
3316
|
}
|
|
3316
3317
|
function createLargeNumberFormat(format, magnitude, postFix, locale) {
|
|
3317
3318
|
const internalFormat = parseFormat(format || "#,##0");
|
|
3318
|
-
const largeNumberFormat =
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
format: {
|
|
3325
|
-
...formatPart.format,
|
|
3326
|
-
magnitude,
|
|
3327
|
-
decimalPart: undefined,
|
|
3328
|
-
},
|
|
3329
|
-
},
|
|
3330
|
-
{
|
|
3331
|
-
type: "STRING",
|
|
3332
|
-
format: postFix,
|
|
3333
|
-
},
|
|
3334
|
-
];
|
|
3319
|
+
const largeNumberFormat = [];
|
|
3320
|
+
for (let i = 0; i < internalFormat.length; i++) {
|
|
3321
|
+
const formatPart = internalFormat[i];
|
|
3322
|
+
if (formatPart.type !== "NUMBER") {
|
|
3323
|
+
largeNumberFormat.push(formatPart);
|
|
3324
|
+
continue;
|
|
3335
3325
|
}
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3326
|
+
largeNumberFormat.push({
|
|
3327
|
+
...formatPart,
|
|
3328
|
+
format: {
|
|
3329
|
+
...formatPart.format,
|
|
3330
|
+
magnitude,
|
|
3331
|
+
decimalPart: undefined,
|
|
3332
|
+
},
|
|
3333
|
+
});
|
|
3334
|
+
largeNumberFormat.push({
|
|
3335
|
+
type: "STRING",
|
|
3336
|
+
format: postFix,
|
|
3337
|
+
});
|
|
3338
|
+
const nextFormatPart = internalFormat[i + 1];
|
|
3339
|
+
if (nextFormatPart?.type === "STRING" && ["k", "m", "b"].includes(nextFormatPart.format)) {
|
|
3340
|
+
i++;
|
|
3341
|
+
}
|
|
3342
|
+
}
|
|
3339
3343
|
return convertInternalFormatToFormat(largeNumberFormat);
|
|
3340
3344
|
}
|
|
3341
3345
|
function changeDecimalPlaces(format, step, locale) {
|
|
@@ -27287,6 +27291,9 @@
|
|
|
27287
27291
|
const token = tokens.filter((token) => token.value.includes(currentSelectedText) &&
|
|
27288
27292
|
token.start <= currentSelection.start &&
|
|
27289
27293
|
token.end >= currentSelection.end)[0];
|
|
27294
|
+
if (!token) {
|
|
27295
|
+
return;
|
|
27296
|
+
}
|
|
27290
27297
|
if (token.type === "REFERENCE") {
|
|
27291
27298
|
this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", {
|
|
27292
27299
|
start: token.start,
|
|
@@ -40296,23 +40303,18 @@
|
|
|
40296
40303
|
* The `compute` of the formula's function must process it completely
|
|
40297
40304
|
*/
|
|
40298
40305
|
refFn(range, isMeta, functionName, paramNumber) {
|
|
40306
|
+
this.assertRangeValid(range);
|
|
40299
40307
|
if (isMeta) {
|
|
40300
40308
|
// Use zoneToXc of zone instead of getRangeString to avoid sending unbounded ranges
|
|
40301
40309
|
const sheetName = this.getters.getSheetName(range.sheetId);
|
|
40302
40310
|
return { value: getFullReference(sheetName, zoneToXc(range.zone)) };
|
|
40303
40311
|
}
|
|
40304
|
-
if (!isZoneValid(range.zone)) {
|
|
40305
|
-
throw new InvalidReferenceError();
|
|
40306
|
-
}
|
|
40307
40312
|
// if the formula definition could have accepted a range, we would pass through the _range function and not here
|
|
40308
40313
|
if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
|
|
40309
40314
|
throw new EvaluationError(paramNumber
|
|
40310
40315
|
? _t("Function %s expects the parameter %s to be a single value or a single cell reference, not a range.", functionName.toString(), paramNumber.toString())
|
|
40311
40316
|
: _t("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
|
|
40312
40317
|
}
|
|
40313
|
-
if (range.invalidSheetName) {
|
|
40314
|
-
throw new EvaluationError(_t("Invalid sheet name: %s", range.invalidSheetName));
|
|
40315
|
-
}
|
|
40316
40318
|
const position = { sheetId: range.sheetId, col: range.zone.left, row: range.zone.top };
|
|
40317
40319
|
return this.readCell(position);
|
|
40318
40320
|
}
|
|
@@ -40344,10 +40346,10 @@
|
|
|
40344
40346
|
* Note that each col is possibly sparse: it only contain the values of cells
|
|
40345
40347
|
* that are actually present in the grid.
|
|
40346
40348
|
*/
|
|
40347
|
-
range(
|
|
40348
|
-
|
|
40349
|
-
|
|
40350
|
-
|
|
40349
|
+
range(range) {
|
|
40350
|
+
this.assertRangeValid(range);
|
|
40351
|
+
const sheetId = range.sheetId;
|
|
40352
|
+
const zone = range.zone;
|
|
40351
40353
|
// Performance issue: Avoid fetching data on positions that are out of the spreadsheet
|
|
40352
40354
|
// e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
|
|
40353
40355
|
const sheetZone = this.getters.getSheetZone(sheetId);
|
|
@@ -40375,6 +40377,14 @@
|
|
|
40375
40377
|
this.rangeCache[cacheKey] = matrix;
|
|
40376
40378
|
return matrix;
|
|
40377
40379
|
}
|
|
40380
|
+
assertRangeValid(range) {
|
|
40381
|
+
if (!isZoneValid(range.zone)) {
|
|
40382
|
+
throw new InvalidReferenceError();
|
|
40383
|
+
}
|
|
40384
|
+
if (range.invalidSheetName) {
|
|
40385
|
+
throw new EvaluationError(_t("Invalid sheet name: %s", range.invalidSheetName));
|
|
40386
|
+
}
|
|
40387
|
+
}
|
|
40378
40388
|
}
|
|
40379
40389
|
|
|
40380
40390
|
function quickselect(arr, k, left, right, compare) {
|
|
@@ -45367,12 +45377,8 @@
|
|
|
45367
45377
|
case "ADD_COLUMNS_ROWS":
|
|
45368
45378
|
case "EVALUATE_CELLS":
|
|
45369
45379
|
case "UPDATE_CELL":
|
|
45370
|
-
this.isSearchDirty = true;
|
|
45371
|
-
break;
|
|
45372
45380
|
case "ACTIVATE_SHEET":
|
|
45373
|
-
|
|
45374
|
-
this.isSearchDirty = true;
|
|
45375
|
-
}
|
|
45381
|
+
this.isSearchDirty = true;
|
|
45376
45382
|
break;
|
|
45377
45383
|
}
|
|
45378
45384
|
}
|
|
@@ -46536,27 +46542,6 @@
|
|
|
46536
46542
|
// ---------------------------------------------------------------------------
|
|
46537
46543
|
// Command Handling
|
|
46538
46544
|
// ---------------------------------------------------------------------------
|
|
46539
|
-
allowDispatch(cmd) {
|
|
46540
|
-
switch (cmd.type) {
|
|
46541
|
-
case "ADD_RANGE":
|
|
46542
|
-
case "ADD_EMPTY_RANGE":
|
|
46543
|
-
if (this.inputHasSingleRange && this.ranges.length === 1) {
|
|
46544
|
-
return "MaximumRangesReached" /* CommandResult.MaximumRangesReached */;
|
|
46545
|
-
}
|
|
46546
|
-
break;
|
|
46547
|
-
case "REMOVE_RANGE":
|
|
46548
|
-
if (this.ranges.length === 1) {
|
|
46549
|
-
return "MinimumRangesReached" /* CommandResult.MinimumRangesReached */;
|
|
46550
|
-
}
|
|
46551
|
-
break;
|
|
46552
|
-
case "CHANGE_RANGE":
|
|
46553
|
-
if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
|
|
46554
|
-
return "MaximumRangesReached" /* CommandResult.MaximumRangesReached */;
|
|
46555
|
-
}
|
|
46556
|
-
break;
|
|
46557
|
-
}
|
|
46558
|
-
return "Success" /* CommandResult.Success */;
|
|
46559
|
-
}
|
|
46560
46545
|
handleEvent(event) {
|
|
46561
46546
|
if (this.focusedRangeIndex === null) {
|
|
46562
46547
|
return;
|
|
@@ -46794,6 +46779,15 @@
|
|
|
46794
46779
|
// Command Handling
|
|
46795
46780
|
// ---------------------------------------------------------------------------
|
|
46796
46781
|
allowDispatch(cmd) {
|
|
46782
|
+
switch (cmd.type) {
|
|
46783
|
+
case "FOCUS_RANGE":
|
|
46784
|
+
case "CHANGE_RANGE":
|
|
46785
|
+
case "ADD_EMPTY_RANGE":
|
|
46786
|
+
case "REMOVE_RANGE":
|
|
46787
|
+
if (!this.inputs[cmd.id]) {
|
|
46788
|
+
return "InvalidInputId" /* CommandResult.InvalidInputId */;
|
|
46789
|
+
}
|
|
46790
|
+
}
|
|
46797
46791
|
switch (cmd.type) {
|
|
46798
46792
|
case "FOCUS_RANGE":
|
|
46799
46793
|
const index = this.currentInput?.getIndex(cmd.rangeId);
|
|
@@ -46801,9 +46795,25 @@
|
|
|
46801
46795
|
return "InputAlreadyFocused" /* CommandResult.InputAlreadyFocused */;
|
|
46802
46796
|
}
|
|
46803
46797
|
break;
|
|
46804
|
-
|
|
46805
|
-
|
|
46806
|
-
|
|
46798
|
+
case "ADD_RANGE":
|
|
46799
|
+
case "ADD_EMPTY_RANGE":
|
|
46800
|
+
const input = this.inputs[cmd.id];
|
|
46801
|
+
if (input.inputHasSingleRange && input.ranges.length === 1) {
|
|
46802
|
+
return "MaximumRangesReached" /* CommandResult.MaximumRangesReached */;
|
|
46803
|
+
}
|
|
46804
|
+
break;
|
|
46805
|
+
case "REMOVE_RANGE":
|
|
46806
|
+
if (this.inputs[cmd.id].ranges.length === 1) {
|
|
46807
|
+
return "MinimumRangesReached" /* CommandResult.MinimumRangesReached */;
|
|
46808
|
+
}
|
|
46809
|
+
break;
|
|
46810
|
+
case "CHANGE_RANGE": {
|
|
46811
|
+
const input = this.inputs[cmd.id];
|
|
46812
|
+
if (input.inputHasSingleRange && cmd.value.split(",").length > 1) {
|
|
46813
|
+
return "MaximumRangesReached" /* CommandResult.MaximumRangesReached */;
|
|
46814
|
+
}
|
|
46815
|
+
break;
|
|
46816
|
+
}
|
|
46807
46817
|
}
|
|
46808
46818
|
return "Success" /* CommandResult.Success */;
|
|
46809
46819
|
}
|
|
@@ -48933,9 +48943,10 @@
|
|
|
48933
48943
|
*/
|
|
48934
48944
|
getReferencedRanges() {
|
|
48935
48945
|
const editionSheetId = this.getters.getCurrentEditedCell().sheetId;
|
|
48936
|
-
|
|
48946
|
+
const referenceRanges = this.currentTokens
|
|
48937
48947
|
.filter((token) => token.type === "REFERENCE")
|
|
48938
48948
|
.map((token) => this.getters.getRangeFromSheetXC(editionSheetId, token.value));
|
|
48949
|
+
return referenceRanges.filter((range) => !range.invalidSheetName && !range.invalidXc);
|
|
48939
48950
|
}
|
|
48940
48951
|
getAutoCompleteDataValidationValues() {
|
|
48941
48952
|
if (this.mode === "inactive") {
|
|
@@ -56989,6 +57000,13 @@
|
|
|
56989
57000
|
urlRepresentation,
|
|
56990
57001
|
};
|
|
56991
57002
|
const components = {
|
|
57003
|
+
Checkbox,
|
|
57004
|
+
Section,
|
|
57005
|
+
ChartColor,
|
|
57006
|
+
ChartDataSeries,
|
|
57007
|
+
ChartErrorSection,
|
|
57008
|
+
ChartLabelRange,
|
|
57009
|
+
ChartTitle,
|
|
56992
57010
|
ChartPanel,
|
|
56993
57011
|
ChartFigure,
|
|
56994
57012
|
ChartJsComponent,
|
|
@@ -57060,9 +57078,9 @@
|
|
|
57060
57078
|
exports.tokenize = tokenize;
|
|
57061
57079
|
|
|
57062
57080
|
|
|
57063
|
-
__info__.version = "17.1.
|
|
57064
|
-
__info__.date = "2024-01-
|
|
57065
|
-
__info__.hash = "
|
|
57081
|
+
__info__.version = "17.1.2";
|
|
57082
|
+
__info__.date = "2024-01-29T13:54:42.679Z";
|
|
57083
|
+
__info__.hash = "043a0d5";
|
|
57066
57084
|
|
|
57067
57085
|
|
|
57068
57086
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|