@odoo/o-spreadsheet 17.1.1 → 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 +154 -115
- package/dist/o-spreadsheet.d.ts +18 -6
- package/dist/o-spreadsheet.esm.js +154 -115
- package/dist/o-spreadsheet.iife.js +154 -115
- package/dist/o-spreadsheet.iife.min.js +258 -265
- 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-
|
|
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';
|
|
@@ -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) {
|
|
@@ -5045,8 +5049,10 @@ function toExcelDataset(getters, ds) {
|
|
|
5045
5049
|
}
|
|
5046
5050
|
const dataRange = ds.dataRange.clone({ zone: dataZone });
|
|
5047
5051
|
return {
|
|
5048
|
-
label: ds.labelCell
|
|
5049
|
-
|
|
5052
|
+
label: ds.labelCell
|
|
5053
|
+
? getters.getRangeString(ds.labelCell, "forceSheetReference", { useFixedReference: true })
|
|
5054
|
+
: undefined,
|
|
5055
|
+
range: getters.getRangeString(dataRange, "forceSheetReference", { useFixedReference: true }),
|
|
5050
5056
|
};
|
|
5051
5057
|
}
|
|
5052
5058
|
function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
|
|
@@ -5059,7 +5065,7 @@ function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
|
|
|
5059
5065
|
zone.top = zone.top + 1;
|
|
5060
5066
|
}
|
|
5061
5067
|
const range = labelRange.clone({ zone });
|
|
5062
|
-
return getters.getRangeString(range, "forceSheetReference");
|
|
5068
|
+
return getters.getRangeString(range, "forceSheetReference", { useFixedReference: true });
|
|
5063
5069
|
}
|
|
5064
5070
|
/**
|
|
5065
5071
|
* Transform a chart definition which supports dataSets (dataSets and LabelRange)
|
|
@@ -6694,6 +6700,7 @@ const FilterMenuPopoverBuilder = {
|
|
|
6694
6700
|
};
|
|
6695
6701
|
|
|
6696
6702
|
const macRegex = /Mac/i;
|
|
6703
|
+
const MODIFIER_KEYS = ["Shift", "Control", "Alt", "Meta"];
|
|
6697
6704
|
/**
|
|
6698
6705
|
* Return true if the event was triggered from
|
|
6699
6706
|
* a child element.
|
|
@@ -6745,14 +6752,14 @@ const letterRegex = /^[a-zA-Z]$/;
|
|
|
6745
6752
|
*/
|
|
6746
6753
|
function keyboardEventToShortcutString(ev, mode = "key") {
|
|
6747
6754
|
let keyDownString = "";
|
|
6748
|
-
if (
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
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
|
+
}
|
|
6756
6763
|
const key = mode === "key" ? ev.key : ev.code;
|
|
6757
6764
|
keyDownString += letterRegex.test(key) ? key.toUpperCase() : key;
|
|
6758
6765
|
return keyDownString;
|
|
@@ -20204,19 +20211,20 @@ const formatNumberPercent = createFormatActionSpec({
|
|
|
20204
20211
|
const formatNumberCurrency = createFormatActionSpec({
|
|
20205
20212
|
name: _t("Currency"),
|
|
20206
20213
|
descriptionValue: 1000.12,
|
|
20207
|
-
format: (env) => env.model.config.defaultCurrencyFormat,
|
|
20214
|
+
format: (env) => env.model.config.defaultCurrencyFormat ?? DEFAULT_CURRENCY_FORMAT,
|
|
20208
20215
|
});
|
|
20209
20216
|
const formatNumberCurrencyRounded = {
|
|
20210
20217
|
...createFormatActionSpec({
|
|
20211
20218
|
name: _t("Currency rounded"),
|
|
20212
20219
|
descriptionValue: 1000,
|
|
20213
|
-
format: (env) => roundFormat(env.model.config.defaultCurrencyFormat),
|
|
20220
|
+
format: (env) => roundFormat(env.model.config.defaultCurrencyFormat ?? DEFAULT_CURRENCY_FORMAT),
|
|
20214
20221
|
}),
|
|
20215
20222
|
isVisible: (env) => {
|
|
20216
20223
|
const currencyFormat = env.model.config.defaultCurrencyFormat;
|
|
20217
|
-
return currencyFormat !== roundFormat(currencyFormat);
|
|
20224
|
+
return currencyFormat !== roundFormat(currencyFormat ?? DEFAULT_CURRENCY_FORMAT);
|
|
20218
20225
|
},
|
|
20219
20226
|
};
|
|
20227
|
+
const DEFAULT_CURRENCY_FORMAT = "[$$]#,##0.00";
|
|
20220
20228
|
const EXAMPLE_DATE = parseLiteral("2023/09/26 10:43:00 PM", DEFAULT_LOCALE);
|
|
20221
20229
|
const formatCustomCurrency = {
|
|
20222
20230
|
name: _t("Custom currency"),
|
|
@@ -27288,6 +27296,9 @@ class Composer extends owl.Component {
|
|
|
27288
27296
|
const token = tokens.filter((token) => token.value.includes(currentSelectedText) &&
|
|
27289
27297
|
token.start <= currentSelection.start &&
|
|
27290
27298
|
token.end >= currentSelection.end)[0];
|
|
27299
|
+
if (!token) {
|
|
27300
|
+
return;
|
|
27301
|
+
}
|
|
27291
27302
|
if (token.type === "REFERENCE") {
|
|
27292
27303
|
this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", {
|
|
27293
27304
|
start: token.start,
|
|
@@ -36023,6 +36034,9 @@ class CellPlugin extends CorePlugin {
|
|
|
36023
36034
|
format: cell.format ? getItemId(cell.format, formats) : undefined,
|
|
36024
36035
|
content: cell.content || undefined,
|
|
36025
36036
|
};
|
|
36037
|
+
if (cell instanceof FormulaCellWithDependencies) {
|
|
36038
|
+
cells[xc].content = cell.contentWithFixedReferences || undefined;
|
|
36039
|
+
}
|
|
36026
36040
|
}
|
|
36027
36041
|
_sheet.cells = cells;
|
|
36028
36042
|
}
|
|
@@ -36066,12 +36080,12 @@ class CellPlugin extends CorePlugin {
|
|
|
36066
36080
|
/*
|
|
36067
36081
|
* Reconstructs the original formula string based on a normalized form and its dependencies
|
|
36068
36082
|
*/
|
|
36069
|
-
getFormulaCellContent(sheetId, compiledFormula, dependencies) {
|
|
36083
|
+
getFormulaCellContent(sheetId, compiledFormula, dependencies, useFixedReference = false) {
|
|
36070
36084
|
let rangeIndex = 0;
|
|
36071
36085
|
return concat(compiledFormula.tokens.map((token) => {
|
|
36072
36086
|
if (token.type === "REFERENCE") {
|
|
36073
36087
|
const range = dependencies[rangeIndex++];
|
|
36074
|
-
return this.getters.getRangeString(range, sheetId);
|
|
36088
|
+
return this.getters.getRangeString(range, sheetId, { useFixedReference });
|
|
36075
36089
|
}
|
|
36076
36090
|
return token.value;
|
|
36077
36091
|
}));
|
|
@@ -36342,6 +36356,18 @@ class FormulaCellWithDependencies {
|
|
|
36342
36356
|
get content() {
|
|
36343
36357
|
return concat(this.compiledFormula.tokens.map((token) => token.value));
|
|
36344
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
|
+
}
|
|
36345
36371
|
}
|
|
36346
36372
|
class RangeReferenceToken {
|
|
36347
36373
|
getValue;
|
|
@@ -36646,7 +36672,13 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
36646
36672
|
}
|
|
36647
36673
|
}
|
|
36648
36674
|
exportForExcel(data) {
|
|
36649
|
-
|
|
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
|
+
}
|
|
36650
36682
|
}
|
|
36651
36683
|
// ---------------------------------------------------------------------------
|
|
36652
36684
|
// Getters
|
|
@@ -36711,11 +36743,11 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
36711
36743
|
// ---------------------------------------------------------------------------
|
|
36712
36744
|
// Private
|
|
36713
36745
|
// ---------------------------------------------------------------------------
|
|
36714
|
-
mapToConditionalFormat(sheetId, cf) {
|
|
36746
|
+
mapToConditionalFormat(sheetId, cf, { useFixedReference } = { useFixedReference: false }) {
|
|
36715
36747
|
return {
|
|
36716
36748
|
...cf,
|
|
36717
36749
|
ranges: cf.ranges.map((range) => {
|
|
36718
|
-
return this.getters.getRangeString(range, sheetId);
|
|
36750
|
+
return this.getters.getRangeString(range, sheetId, { useFixedReference });
|
|
36719
36751
|
}),
|
|
36720
36752
|
};
|
|
36721
36753
|
}
|
|
@@ -38783,8 +38815,10 @@ class RangeAdapter {
|
|
|
38783
38815
|
*
|
|
38784
38816
|
* @param range the range (received from getRangeFromXC or getRangeFromZone)
|
|
38785
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
|
|
38786
38820
|
*/
|
|
38787
|
-
getRangeString(range, forSheetId) {
|
|
38821
|
+
getRangeString(range, forSheetId, options = { useFixedReference: false }) {
|
|
38788
38822
|
if (!range) {
|
|
38789
38823
|
return CellErrorType.InvalidReference;
|
|
38790
38824
|
}
|
|
@@ -38811,7 +38845,7 @@ class RangeAdapter {
|
|
|
38811
38845
|
if (prefixSheet && !sheetName) {
|
|
38812
38846
|
return CellErrorType.InvalidReference;
|
|
38813
38847
|
}
|
|
38814
|
-
let rangeString = this.getRangePartString(rangeImpl, 0);
|
|
38848
|
+
let rangeString = this.getRangePartString(rangeImpl, 0, options);
|
|
38815
38849
|
if (rangeImpl.parts && rangeImpl.parts.length === 2) {
|
|
38816
38850
|
// this if converts A2:A2 into A2 except if any part of the original range had fixed row or column (with $)
|
|
38817
38851
|
if (rangeImpl.zone.top !== rangeImpl.zone.bottom ||
|
|
@@ -38821,7 +38855,7 @@ class RangeAdapter {
|
|
|
38821
38855
|
rangeImpl.parts[1].rowFixed ||
|
|
38822
38856
|
rangeImpl.parts[1].colFixed) {
|
|
38823
38857
|
rangeString += ":";
|
|
38824
|
-
rangeString += this.getRangePartString(rangeImpl, 1);
|
|
38858
|
+
rangeString += this.getRangePartString(rangeImpl, 1, options);
|
|
38825
38859
|
}
|
|
38826
38860
|
}
|
|
38827
38861
|
return `${prefixSheet ? sheetName + "!" : ""}${rangeString}`;
|
|
@@ -38862,13 +38896,13 @@ class RangeAdapter {
|
|
|
38862
38896
|
/**
|
|
38863
38897
|
* Get a Xc string that represent a part of a range
|
|
38864
38898
|
*/
|
|
38865
|
-
getRangePartString(range, part) {
|
|
38899
|
+
getRangePartString(range, part, options = { useFixedReference: false }) {
|
|
38866
38900
|
const colFixed = range.parts && range.parts[part]?.colFixed ? "$" : "";
|
|
38867
38901
|
const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
|
|
38868
38902
|
const rowFixed = range.parts && range.parts[part]?.rowFixed ? "$" : "";
|
|
38869
38903
|
const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
|
|
38870
38904
|
let str = "";
|
|
38871
|
-
if (range.isFullCol) {
|
|
38905
|
+
if (range.isFullCol && !options.useFixedReference) {
|
|
38872
38906
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
38873
38907
|
str = colFixed + col + rowFixed + row;
|
|
38874
38908
|
}
|
|
@@ -38876,7 +38910,7 @@ class RangeAdapter {
|
|
|
38876
38910
|
str = colFixed + col;
|
|
38877
38911
|
}
|
|
38878
38912
|
}
|
|
38879
|
-
else if (range.isFullRow) {
|
|
38913
|
+
else if (range.isFullRow && !options.useFixedReference) {
|
|
38880
38914
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
38881
38915
|
str = colFixed + col + rowFixed + row;
|
|
38882
38916
|
}
|
|
@@ -40297,23 +40331,18 @@ class CompilationParametersBuilder {
|
|
|
40297
40331
|
* The `compute` of the formula's function must process it completely
|
|
40298
40332
|
*/
|
|
40299
40333
|
refFn(range, isMeta, functionName, paramNumber) {
|
|
40334
|
+
this.assertRangeValid(range);
|
|
40300
40335
|
if (isMeta) {
|
|
40301
40336
|
// Use zoneToXc of zone instead of getRangeString to avoid sending unbounded ranges
|
|
40302
40337
|
const sheetName = this.getters.getSheetName(range.sheetId);
|
|
40303
40338
|
return { value: getFullReference(sheetName, zoneToXc(range.zone)) };
|
|
40304
40339
|
}
|
|
40305
|
-
if (!isZoneValid(range.zone)) {
|
|
40306
|
-
throw new InvalidReferenceError();
|
|
40307
|
-
}
|
|
40308
40340
|
// if the formula definition could have accepted a range, we would pass through the _range function and not here
|
|
40309
40341
|
if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
|
|
40310
40342
|
throw new EvaluationError(paramNumber
|
|
40311
40343
|
? _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
40344
|
: _t("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
|
|
40313
40345
|
}
|
|
40314
|
-
if (range.invalidSheetName) {
|
|
40315
|
-
throw new EvaluationError(_t("Invalid sheet name: %s", range.invalidSheetName));
|
|
40316
|
-
}
|
|
40317
40346
|
const position = { sheetId: range.sheetId, col: range.zone.left, row: range.zone.top };
|
|
40318
40347
|
return this.readCell(position);
|
|
40319
40348
|
}
|
|
@@ -40345,10 +40374,10 @@ class CompilationParametersBuilder {
|
|
|
40345
40374
|
* Note that each col is possibly sparse: it only contain the values of cells
|
|
40346
40375
|
* that are actually present in the grid.
|
|
40347
40376
|
*/
|
|
40348
|
-
range(
|
|
40349
|
-
|
|
40350
|
-
|
|
40351
|
-
|
|
40377
|
+
range(range) {
|
|
40378
|
+
this.assertRangeValid(range);
|
|
40379
|
+
const sheetId = range.sheetId;
|
|
40380
|
+
const zone = range.zone;
|
|
40352
40381
|
// Performance issue: Avoid fetching data on positions that are out of the spreadsheet
|
|
40353
40382
|
// e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
|
|
40354
40383
|
const sheetZone = this.getters.getSheetZone(sheetId);
|
|
@@ -40376,6 +40405,14 @@ class CompilationParametersBuilder {
|
|
|
40376
40405
|
this.rangeCache[cacheKey] = matrix;
|
|
40377
40406
|
return matrix;
|
|
40378
40407
|
}
|
|
40408
|
+
assertRangeValid(range) {
|
|
40409
|
+
if (!isZoneValid(range.zone)) {
|
|
40410
|
+
throw new InvalidReferenceError();
|
|
40411
|
+
}
|
|
40412
|
+
if (range.invalidSheetName) {
|
|
40413
|
+
throw new EvaluationError(_t("Invalid sheet name: %s", range.invalidSheetName));
|
|
40414
|
+
}
|
|
40415
|
+
}
|
|
40379
40416
|
}
|
|
40380
40417
|
|
|
40381
40418
|
function quickselect(arr, k, left, right, compare) {
|
|
@@ -45368,12 +45405,8 @@ class FindAndReplacePlugin extends UIPlugin {
|
|
|
45368
45405
|
case "ADD_COLUMNS_ROWS":
|
|
45369
45406
|
case "EVALUATE_CELLS":
|
|
45370
45407
|
case "UPDATE_CELL":
|
|
45371
|
-
this.isSearchDirty = true;
|
|
45372
|
-
break;
|
|
45373
45408
|
case "ACTIVATE_SHEET":
|
|
45374
|
-
|
|
45375
|
-
this.isSearchDirty = true;
|
|
45376
|
-
}
|
|
45409
|
+
this.isSearchDirty = true;
|
|
45377
45410
|
break;
|
|
45378
45411
|
}
|
|
45379
45412
|
}
|
|
@@ -46537,27 +46570,6 @@ class SelectionInputPlugin extends UIPlugin {
|
|
|
46537
46570
|
// ---------------------------------------------------------------------------
|
|
46538
46571
|
// Command Handling
|
|
46539
46572
|
// ---------------------------------------------------------------------------
|
|
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
46573
|
handleEvent(event) {
|
|
46562
46574
|
if (this.focusedRangeIndex === null) {
|
|
46563
46575
|
return;
|
|
@@ -46795,6 +46807,15 @@ class SelectionInputsManagerPlugin extends UIPlugin {
|
|
|
46795
46807
|
// Command Handling
|
|
46796
46808
|
// ---------------------------------------------------------------------------
|
|
46797
46809
|
allowDispatch(cmd) {
|
|
46810
|
+
switch (cmd.type) {
|
|
46811
|
+
case "FOCUS_RANGE":
|
|
46812
|
+
case "CHANGE_RANGE":
|
|
46813
|
+
case "ADD_EMPTY_RANGE":
|
|
46814
|
+
case "REMOVE_RANGE":
|
|
46815
|
+
if (!this.inputs[cmd.id]) {
|
|
46816
|
+
return "InvalidInputId" /* CommandResult.InvalidInputId */;
|
|
46817
|
+
}
|
|
46818
|
+
}
|
|
46798
46819
|
switch (cmd.type) {
|
|
46799
46820
|
case "FOCUS_RANGE":
|
|
46800
46821
|
const index = this.currentInput?.getIndex(cmd.rangeId);
|
|
@@ -46802,9 +46823,25 @@ class SelectionInputsManagerPlugin extends UIPlugin {
|
|
|
46802
46823
|
return "InputAlreadyFocused" /* CommandResult.InputAlreadyFocused */;
|
|
46803
46824
|
}
|
|
46804
46825
|
break;
|
|
46805
|
-
|
|
46806
|
-
|
|
46807
|
-
|
|
46826
|
+
case "ADD_RANGE":
|
|
46827
|
+
case "ADD_EMPTY_RANGE":
|
|
46828
|
+
const input = this.inputs[cmd.id];
|
|
46829
|
+
if (input.inputHasSingleRange && input.ranges.length === 1) {
|
|
46830
|
+
return "MaximumRangesReached" /* CommandResult.MaximumRangesReached */;
|
|
46831
|
+
}
|
|
46832
|
+
break;
|
|
46833
|
+
case "REMOVE_RANGE":
|
|
46834
|
+
if (this.inputs[cmd.id].ranges.length === 1) {
|
|
46835
|
+
return "MinimumRangesReached" /* CommandResult.MinimumRangesReached */;
|
|
46836
|
+
}
|
|
46837
|
+
break;
|
|
46838
|
+
case "CHANGE_RANGE": {
|
|
46839
|
+
const input = this.inputs[cmd.id];
|
|
46840
|
+
if (input.inputHasSingleRange && cmd.value.split(",").length > 1) {
|
|
46841
|
+
return "MaximumRangesReached" /* CommandResult.MaximumRangesReached */;
|
|
46842
|
+
}
|
|
46843
|
+
break;
|
|
46844
|
+
}
|
|
46808
46845
|
}
|
|
46809
46846
|
return "Success" /* CommandResult.Success */;
|
|
46810
46847
|
}
|
|
@@ -48934,9 +48971,10 @@ class EditionPlugin extends UIPlugin {
|
|
|
48934
48971
|
*/
|
|
48935
48972
|
getReferencedRanges() {
|
|
48936
48973
|
const editionSheetId = this.getters.getCurrentEditedCell().sheetId;
|
|
48937
|
-
|
|
48974
|
+
const referenceRanges = this.currentTokens
|
|
48938
48975
|
.filter((token) => token.type === "REFERENCE")
|
|
48939
48976
|
.map((token) => this.getters.getRangeFromSheetXC(editionSheetId, token.value));
|
|
48977
|
+
return referenceRanges.filter((range) => !range.invalidSheetName && !range.invalidXc);
|
|
48940
48978
|
}
|
|
48941
48979
|
getAutoCompleteDataValidationValues() {
|
|
48942
48980
|
if (this.mode === "inactive") {
|
|
@@ -55224,12 +55262,7 @@ function addFormula(cell) {
|
|
|
55224
55262
|
attrs.push(["t", "str"]);
|
|
55225
55263
|
cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
|
|
55226
55264
|
}
|
|
55227
|
-
node = escapeXml /*xml*/
|
|
55228
|
-
<f>
|
|
55229
|
-
${XlsxFormula}
|
|
55230
|
-
</f>
|
|
55231
|
-
${cycle}
|
|
55232
|
-
`;
|
|
55265
|
+
node = escapeXml /*xml*/ `<f>${XlsxFormula}</f>${cycle}`;
|
|
55233
55266
|
return { attrs, node };
|
|
55234
55267
|
}
|
|
55235
55268
|
function addContent(content, sharedStrings, forceString = false) {
|
|
@@ -56049,11 +56082,10 @@ function addRows(construct, data, sheet) {
|
|
|
56049
56082
|
({ attrs: additionalAttrs, node: cellNode } = addContent(cell.content, construct.sharedStrings, isTableHeader || isPlainText));
|
|
56050
56083
|
}
|
|
56051
56084
|
attributes.push(...additionalAttrs);
|
|
56052
|
-
|
|
56053
|
-
|
|
56054
|
-
|
|
56055
|
-
|
|
56056
|
-
`);
|
|
56085
|
+
// prettier-ignore
|
|
56086
|
+
cellNodes.push(escapeXml /*xml*/ `<c ${formatAttributes(attributes)}>
|
|
56087
|
+
${cellNode}
|
|
56088
|
+
</c>`);
|
|
56057
56089
|
}
|
|
56058
56090
|
}
|
|
56059
56091
|
if (cellNodes.length || row.size !== DEFAULT_CELL_HEIGHT || row.isHidden) {
|
|
@@ -56649,7 +56681,6 @@ class Model extends EventBus {
|
|
|
56649
56681
|
...config,
|
|
56650
56682
|
mode: config.mode || "normal",
|
|
56651
56683
|
custom: config.custom || {},
|
|
56652
|
-
defaultCurrencyFormat: config.defaultCurrencyFormat || "[$$]#,##0.00",
|
|
56653
56684
|
external: this.setupExternalConfig(config.external || {}),
|
|
56654
56685
|
transportService,
|
|
56655
56686
|
client,
|
|
@@ -56687,6 +56718,7 @@ class Model extends EventBus {
|
|
|
56687
56718
|
custom: this.config.custom,
|
|
56688
56719
|
uiActions: this.config,
|
|
56689
56720
|
session: this.session,
|
|
56721
|
+
defaultCurrencyFormat: this.config.defaultCurrencyFormat,
|
|
56690
56722
|
};
|
|
56691
56723
|
}
|
|
56692
56724
|
// ---------------------------------------------------------------------------
|
|
@@ -56990,6 +57022,13 @@ const links = {
|
|
|
56990
57022
|
urlRepresentation,
|
|
56991
57023
|
};
|
|
56992
57024
|
const components = {
|
|
57025
|
+
Checkbox,
|
|
57026
|
+
Section,
|
|
57027
|
+
ChartColor,
|
|
57028
|
+
ChartDataSeries,
|
|
57029
|
+
ChartErrorSection,
|
|
57030
|
+
ChartLabelRange,
|
|
57031
|
+
ChartTitle,
|
|
56993
57032
|
ChartPanel,
|
|
56994
57033
|
ChartFigure,
|
|
56995
57034
|
ChartJsComponent,
|
|
@@ -57061,6 +57100,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
57061
57100
|
exports.tokenize = tokenize;
|
|
57062
57101
|
|
|
57063
57102
|
|
|
57064
|
-
__info__.version = "17.1.
|
|
57065
|
-
__info__.date = "2024-
|
|
57066
|
-
__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;
|
|
@@ -2448,7 +2449,8 @@ declare const enum CommandResult {
|
|
|
2448
2449
|
InvalidNumberOfCriterionValues = "InvalidNumberOfCriterionValues",
|
|
2449
2450
|
BlockingValidationRule = "BlockingValidationRule",
|
|
2450
2451
|
InvalidCopyPasteSelection = "InvalidCopyPasteSelection",
|
|
2451
|
-
NoChanges = "NoChanges"
|
|
2452
|
+
NoChanges = "NoChanges",
|
|
2453
|
+
InvalidInputId = "InvalidInputId"
|
|
2452
2454
|
}
|
|
2453
2455
|
interface CommandHandler<T> {
|
|
2454
2456
|
allowDispatch(command: T): CommandResult | CommandResult[];
|
|
@@ -3069,8 +3071,12 @@ declare class RangeAdapter implements CommandHandler<CoreCommand> {
|
|
|
3069
3071
|
*
|
|
3070
3072
|
* @param range the range (received from getRangeFromXC or getRangeFromZone)
|
|
3071
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
|
|
3072
3076
|
*/
|
|
3073
|
-
getRangeString(range: Range, forSheetId: UID
|
|
3077
|
+
getRangeString(range: Range, forSheetId: UID, options?: {
|
|
3078
|
+
useFixedReference: boolean;
|
|
3079
|
+
}): string;
|
|
3074
3080
|
getRangeDataFromXc(sheetId: UID, xc: string): RangeData;
|
|
3075
3081
|
getRangeDataFromZone(sheetId: UID, zone: Zone | UnboundedZone): RangeData;
|
|
3076
3082
|
getRangeFromZone(sheetId: UID, zone: Zone | UnboundedZone): Range;
|
|
@@ -4548,14 +4554,13 @@ interface RangeInputValue {
|
|
|
4548
4554
|
* This plugin handles this internal state.
|
|
4549
4555
|
*/
|
|
4550
4556
|
declare class SelectionInputPlugin extends UIPlugin implements StreamCallbacks<SelectionEvent> {
|
|
4551
|
-
|
|
4557
|
+
readonly inputHasSingleRange: boolean;
|
|
4552
4558
|
static layers: LAYERS[];
|
|
4553
4559
|
static getters: never[];
|
|
4554
4560
|
ranges: RangeInputValue[];
|
|
4555
4561
|
focusedRangeIndex: number | null;
|
|
4556
4562
|
private inputSheetId;
|
|
4557
4563
|
constructor(config: UIPluginConfig, initialRanges: string[], inputHasSingleRange: boolean);
|
|
4558
|
-
allowDispatch(cmd: LocalCommand): CommandResult;
|
|
4559
4564
|
handleEvent(event: SelectionEvent): void;
|
|
4560
4565
|
handle(cmd: Command): void;
|
|
4561
4566
|
getSelectionInputValue(): string[];
|
|
@@ -5578,7 +5583,7 @@ interface Props$L {
|
|
|
5578
5583
|
name: string;
|
|
5579
5584
|
label: string;
|
|
5580
5585
|
value: boolean;
|
|
5581
|
-
|
|
5586
|
+
onChange: (value: boolean) => void;
|
|
5582
5587
|
}>;
|
|
5583
5588
|
}
|
|
5584
5589
|
declare class ChartLabelRange extends Component<Props$L, SpreadsheetChildEnv> {
|
|
@@ -8652,6 +8657,13 @@ declare const links: {
|
|
|
8652
8657
|
urlRepresentation: typeof urlRepresentation;
|
|
8653
8658
|
};
|
|
8654
8659
|
declare const components: {
|
|
8660
|
+
Checkbox: typeof Checkbox;
|
|
8661
|
+
Section: typeof Section;
|
|
8662
|
+
ChartColor: typeof ChartColor;
|
|
8663
|
+
ChartDataSeries: typeof ChartDataSeries;
|
|
8664
|
+
ChartErrorSection: typeof ChartErrorSection;
|
|
8665
|
+
ChartLabelRange: typeof ChartLabelRange;
|
|
8666
|
+
ChartTitle: typeof ChartTitle;
|
|
8655
8667
|
ChartPanel: typeof ChartPanel;
|
|
8656
8668
|
ChartFigure: typeof ChartFigure;
|
|
8657
8669
|
ChartJsComponent: typeof ChartJsComponent;
|