@odoo/o-spreadsheet 17.0.83 → 17.0.85
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 +328 -307
- package/dist/o-spreadsheet.d.ts +5 -5
- package/dist/o-spreadsheet.esm.js +328 -307
- package/dist/o-spreadsheet.iife.js +328 -307
- package/dist/o-spreadsheet.iife.min.js +274 -274
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +1 -1
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
4
4
|
* @see https://github.com/odoo/o-spreadsheet
|
|
5
|
-
* @version 17.0.
|
|
6
|
-
* @date 2026-01-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.85
|
|
6
|
+
* @date 2026-01-21T11:02:43.920Z
|
|
7
|
+
* @hash 0343060
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -274,6 +274,7 @@ const DEFAULT_STYLE = {
|
|
|
274
274
|
fillColor: "",
|
|
275
275
|
textColor: "",
|
|
276
276
|
};
|
|
277
|
+
const DEFAULT_NUMBER_STYLE = { ...DEFAULT_STYLE, align: "right" };
|
|
277
278
|
const DEFAULT_VERTICAL_ALIGN = DEFAULT_STYLE.verticalAlign;
|
|
278
279
|
const DEFAULT_WRAPPING_MODE = DEFAULT_STYLE.wrapping;
|
|
279
280
|
// Fonts
|
|
@@ -4556,17 +4557,318 @@ function isSheetNameEqual(name1, name2) {
|
|
|
4556
4557
|
getUnquotedSheetName(name2.trim().toUpperCase()));
|
|
4557
4558
|
}
|
|
4558
4559
|
|
|
4560
|
+
/**
|
|
4561
|
+
* Registry
|
|
4562
|
+
*
|
|
4563
|
+
* The Registry class is basically just a mapping from a string key to an object.
|
|
4564
|
+
* It is really not much more than an object. It is however useful for the
|
|
4565
|
+
* following reasons:
|
|
4566
|
+
*
|
|
4567
|
+
* 1. it let us react and execute code when someone add something to the registry
|
|
4568
|
+
* (for example, the FunctionRegistry subclass this for this purpose)
|
|
4569
|
+
* 2. it throws an error when the get operation fails
|
|
4570
|
+
* 3. it provides a chained API to add items to the registry.
|
|
4571
|
+
*/
|
|
4572
|
+
class Registry {
|
|
4573
|
+
content = {};
|
|
4574
|
+
/**
|
|
4575
|
+
* Add an item to the registry
|
|
4576
|
+
*
|
|
4577
|
+
* Note that this also returns the registry, so another add method call can
|
|
4578
|
+
* be chained
|
|
4579
|
+
*/
|
|
4580
|
+
add(key, value) {
|
|
4581
|
+
this.content[key] = value;
|
|
4582
|
+
return this;
|
|
4583
|
+
}
|
|
4584
|
+
/**
|
|
4585
|
+
* Get an item from the registry
|
|
4586
|
+
*/
|
|
4587
|
+
get(key) {
|
|
4588
|
+
/**
|
|
4589
|
+
* Note: key in {} is ~12 times slower than {}[key].
|
|
4590
|
+
* So, we check the absence of key only when the direct access returns
|
|
4591
|
+
* a falsy value. It's done to ensure that the registry can contains falsy values
|
|
4592
|
+
*/
|
|
4593
|
+
const content = this.content[key];
|
|
4594
|
+
if (!content) {
|
|
4595
|
+
if (!(key in this.content)) {
|
|
4596
|
+
throw new Error(`Cannot find ${key} in this registry!`);
|
|
4597
|
+
}
|
|
4598
|
+
}
|
|
4599
|
+
return content;
|
|
4600
|
+
}
|
|
4601
|
+
/**
|
|
4602
|
+
* Check if the key is already in the registry
|
|
4603
|
+
*/
|
|
4604
|
+
contains(key) {
|
|
4605
|
+
return key in this.content;
|
|
4606
|
+
}
|
|
4607
|
+
/**
|
|
4608
|
+
* Get a list of all elements in the registry
|
|
4609
|
+
*/
|
|
4610
|
+
getAll() {
|
|
4611
|
+
return Object.values(this.content);
|
|
4612
|
+
}
|
|
4613
|
+
/**
|
|
4614
|
+
* Get a list of all keys in the registry
|
|
4615
|
+
*/
|
|
4616
|
+
getKeys() {
|
|
4617
|
+
return Object.keys(this.content);
|
|
4618
|
+
}
|
|
4619
|
+
/**
|
|
4620
|
+
* Remove an item from the registry
|
|
4621
|
+
*/
|
|
4622
|
+
remove(key) {
|
|
4623
|
+
delete this.content[key];
|
|
4624
|
+
}
|
|
4625
|
+
}
|
|
4626
|
+
|
|
4627
|
+
/**
|
|
4628
|
+
* Add the `https` prefix to the url if it's missing
|
|
4629
|
+
*/
|
|
4630
|
+
function withHttps(url) {
|
|
4631
|
+
return !/^https?:\/\//i.test(url) ? `https://${url}` : url;
|
|
4632
|
+
}
|
|
4633
|
+
const urlRegistry = new Registry();
|
|
4634
|
+
function createWebLink(url, label) {
|
|
4635
|
+
url = withHttps(url);
|
|
4636
|
+
return {
|
|
4637
|
+
url,
|
|
4638
|
+
label: label || url,
|
|
4639
|
+
isExternal: true,
|
|
4640
|
+
isUrlEditable: true,
|
|
4641
|
+
};
|
|
4642
|
+
}
|
|
4643
|
+
urlRegistry.add("sheet_URL", {
|
|
4644
|
+
match: (url) => isSheetUrl(url),
|
|
4645
|
+
createLink: (url, label) => {
|
|
4646
|
+
return {
|
|
4647
|
+
label,
|
|
4648
|
+
url,
|
|
4649
|
+
isExternal: false,
|
|
4650
|
+
isUrlEditable: false,
|
|
4651
|
+
};
|
|
4652
|
+
},
|
|
4653
|
+
urlRepresentation(url, getters) {
|
|
4654
|
+
const sheetId = parseSheetUrl(url);
|
|
4655
|
+
return getters.tryGetSheetName(sheetId) || _t("Invalid sheet");
|
|
4656
|
+
},
|
|
4657
|
+
open(url, env) {
|
|
4658
|
+
const sheetId = parseSheetUrl(url);
|
|
4659
|
+
env.model.dispatch("ACTIVATE_SHEET", {
|
|
4660
|
+
sheetIdFrom: env.model.getters.getActiveSheetId(),
|
|
4661
|
+
sheetIdTo: sheetId,
|
|
4662
|
+
});
|
|
4663
|
+
},
|
|
4664
|
+
sequence: 0,
|
|
4665
|
+
});
|
|
4666
|
+
const WebUrlSpec = {
|
|
4667
|
+
createLink: createWebLink,
|
|
4668
|
+
match: (url) => isWebLink(url),
|
|
4669
|
+
open: (url) => window.open(url, "_blank"),
|
|
4670
|
+
urlRepresentation: (url) => url,
|
|
4671
|
+
sequence: 0,
|
|
4672
|
+
};
|
|
4673
|
+
function findMatchingSpec(url) {
|
|
4674
|
+
return (urlRegistry
|
|
4675
|
+
.getAll()
|
|
4676
|
+
.sort((a, b) => a.sequence - b.sequence)
|
|
4677
|
+
.find((urlType) => urlType.match(url)) || WebUrlSpec);
|
|
4678
|
+
}
|
|
4679
|
+
function urlRepresentation(link, getters) {
|
|
4680
|
+
return findMatchingSpec(link.url).urlRepresentation(link.url, getters);
|
|
4681
|
+
}
|
|
4682
|
+
function openLink(link, env) {
|
|
4683
|
+
findMatchingSpec(link.url).open(link.url, env);
|
|
4684
|
+
}
|
|
4685
|
+
function detectLink(value) {
|
|
4686
|
+
if (typeof value !== "string") {
|
|
4687
|
+
return undefined;
|
|
4688
|
+
}
|
|
4689
|
+
if (isMarkdownLink(value)) {
|
|
4690
|
+
const { label, url } = parseMarkdownLink(value);
|
|
4691
|
+
return findMatchingSpec(url).createLink(url, label);
|
|
4692
|
+
}
|
|
4693
|
+
else if (isWebLink(value)) {
|
|
4694
|
+
return createWebLink(value);
|
|
4695
|
+
}
|
|
4696
|
+
return undefined;
|
|
4697
|
+
}
|
|
4698
|
+
|
|
4699
|
+
function evaluateLiteral(content, localeFormat) {
|
|
4700
|
+
return createEvaluatedCell(parseLiteral(content || "", localeFormat.locale), localeFormat);
|
|
4701
|
+
}
|
|
4702
|
+
function parseLiteral(content, locale) {
|
|
4703
|
+
if (content.startsWith("=")) {
|
|
4704
|
+
throw new Error(`Cannot parse "${content}" because it's not a literal value. It's a formula`);
|
|
4705
|
+
}
|
|
4706
|
+
if (isNumber(content, DEFAULT_LOCALE)) {
|
|
4707
|
+
return toNumber(content, DEFAULT_LOCALE);
|
|
4708
|
+
}
|
|
4709
|
+
else if (isDateTime(content, locale)) {
|
|
4710
|
+
return toNumber(content, locale);
|
|
4711
|
+
}
|
|
4712
|
+
else if (isBoolean(content)) {
|
|
4713
|
+
return content.toUpperCase() === "TRUE" ? true : false;
|
|
4714
|
+
}
|
|
4715
|
+
return content;
|
|
4716
|
+
}
|
|
4717
|
+
function createEvaluatedCell(value, localeFormat) {
|
|
4718
|
+
const link = detectLink(value);
|
|
4719
|
+
if (link) {
|
|
4720
|
+
return {
|
|
4721
|
+
..._createEvaluatedCell(parseLiteral(link.label, localeFormat.locale), {
|
|
4722
|
+
format: localeFormat.format ||
|
|
4723
|
+
detectDateFormat(link.label, localeFormat.locale) ||
|
|
4724
|
+
detectNumberFormat(link.label),
|
|
4725
|
+
locale: localeFormat.locale,
|
|
4726
|
+
}),
|
|
4727
|
+
link,
|
|
4728
|
+
};
|
|
4729
|
+
}
|
|
4730
|
+
return _createEvaluatedCell(value, localeFormat);
|
|
4731
|
+
}
|
|
4732
|
+
function _createEvaluatedCell(value, localeFormat) {
|
|
4733
|
+
try {
|
|
4734
|
+
for (const builder of builders) {
|
|
4735
|
+
const evaluateCell = builder(value, localeFormat);
|
|
4736
|
+
if (evaluateCell) {
|
|
4737
|
+
return evaluateCell;
|
|
4738
|
+
}
|
|
4739
|
+
}
|
|
4740
|
+
return textCell((value || "").toString(), localeFormat);
|
|
4741
|
+
}
|
|
4742
|
+
catch (error) {
|
|
4743
|
+
return errorCell(new EvaluationError(CellErrorType.GenericError, error.message || DEFAULT_ERROR_MESSAGE));
|
|
4744
|
+
}
|
|
4745
|
+
}
|
|
4746
|
+
function textCell(value, localeFormat) {
|
|
4747
|
+
return {
|
|
4748
|
+
type: CellValueType.text,
|
|
4749
|
+
value,
|
|
4750
|
+
format: localeFormat.format,
|
|
4751
|
+
isAutoSummable: true,
|
|
4752
|
+
defaultAlign: "left",
|
|
4753
|
+
formattedValue: formatValue(value, localeFormat),
|
|
4754
|
+
};
|
|
4755
|
+
}
|
|
4756
|
+
function numberCell(value, localeFormat) {
|
|
4757
|
+
return {
|
|
4758
|
+
type: CellValueType.number,
|
|
4759
|
+
value: value || 0, // necessary to avoid "-0" and NaN values,
|
|
4760
|
+
format: localeFormat.format,
|
|
4761
|
+
isAutoSummable: true,
|
|
4762
|
+
defaultAlign: "right",
|
|
4763
|
+
formattedValue: formatValue(value, localeFormat),
|
|
4764
|
+
};
|
|
4765
|
+
}
|
|
4766
|
+
const EMPTY_EVALUATED_CELL = {
|
|
4767
|
+
type: CellValueType.empty,
|
|
4768
|
+
value: "",
|
|
4769
|
+
format: undefined,
|
|
4770
|
+
isAutoSummable: true,
|
|
4771
|
+
defaultAlign: "left",
|
|
4772
|
+
formattedValue: "",
|
|
4773
|
+
};
|
|
4774
|
+
function emptyCell(localeFormat) {
|
|
4775
|
+
if (localeFormat.format === undefined) {
|
|
4776
|
+
// share the same object to save memory
|
|
4777
|
+
return EMPTY_EVALUATED_CELL;
|
|
4778
|
+
}
|
|
4779
|
+
return {
|
|
4780
|
+
type: CellValueType.empty,
|
|
4781
|
+
value: "",
|
|
4782
|
+
format: localeFormat.format,
|
|
4783
|
+
isAutoSummable: true,
|
|
4784
|
+
defaultAlign: "left",
|
|
4785
|
+
formattedValue: "",
|
|
4786
|
+
};
|
|
4787
|
+
}
|
|
4788
|
+
function dateTimeCell(value, localeFormat) {
|
|
4789
|
+
const formattedValue = formatValue(value, localeFormat);
|
|
4790
|
+
return {
|
|
4791
|
+
type: CellValueType.number,
|
|
4792
|
+
value,
|
|
4793
|
+
format: localeFormat.format,
|
|
4794
|
+
isAutoSummable: false,
|
|
4795
|
+
defaultAlign: "right",
|
|
4796
|
+
formattedValue,
|
|
4797
|
+
};
|
|
4798
|
+
}
|
|
4799
|
+
function booleanCell(value, localeFormat) {
|
|
4800
|
+
const formattedValue = value ? "TRUE" : "FALSE";
|
|
4801
|
+
return {
|
|
4802
|
+
type: CellValueType.boolean,
|
|
4803
|
+
value,
|
|
4804
|
+
format: localeFormat.format,
|
|
4805
|
+
isAutoSummable: false,
|
|
4806
|
+
defaultAlign: "center",
|
|
4807
|
+
formattedValue,
|
|
4808
|
+
};
|
|
4809
|
+
}
|
|
4810
|
+
function errorCell(error) {
|
|
4811
|
+
return {
|
|
4812
|
+
type: CellValueType.error,
|
|
4813
|
+
value: error.errorType,
|
|
4814
|
+
error,
|
|
4815
|
+
isAutoSummable: false,
|
|
4816
|
+
defaultAlign: "center",
|
|
4817
|
+
formattedValue: error.errorType,
|
|
4818
|
+
};
|
|
4819
|
+
}
|
|
4820
|
+
const builders = [
|
|
4821
|
+
function createEmpty(value, localeFormat) {
|
|
4822
|
+
if (value === "") {
|
|
4823
|
+
return emptyCell(localeFormat);
|
|
4824
|
+
}
|
|
4825
|
+
return undefined;
|
|
4826
|
+
},
|
|
4827
|
+
function createDateTime(value, localeFormat) {
|
|
4828
|
+
if (!!localeFormat.format &&
|
|
4829
|
+
typeof value === "number" &&
|
|
4830
|
+
isDateTimeFormat(localeFormat.format)) {
|
|
4831
|
+
return dateTimeCell(value, localeFormat);
|
|
4832
|
+
}
|
|
4833
|
+
return undefined;
|
|
4834
|
+
},
|
|
4835
|
+
function createNumber(value, localeFormat) {
|
|
4836
|
+
if (typeof value === "number") {
|
|
4837
|
+
return numberCell(value, localeFormat);
|
|
4838
|
+
}
|
|
4839
|
+
else if (value === null) {
|
|
4840
|
+
return numberCell(0, localeFormat);
|
|
4841
|
+
}
|
|
4842
|
+
return undefined;
|
|
4843
|
+
},
|
|
4844
|
+
function createBoolean(value, localeFormat) {
|
|
4845
|
+
if (typeof value === "boolean") {
|
|
4846
|
+
return booleanCell(value, localeFormat);
|
|
4847
|
+
}
|
|
4848
|
+
return undefined;
|
|
4849
|
+
},
|
|
4850
|
+
];
|
|
4851
|
+
|
|
4559
4852
|
function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
|
|
4560
4853
|
return numberOfLines * (textLineHeight + MIN_CELL_TEXT_MARGIN) - MIN_CELL_TEXT_MARGIN;
|
|
4561
4854
|
}
|
|
4562
4855
|
/**
|
|
4563
4856
|
* Get the default height of the cell given its style.
|
|
4564
4857
|
*/
|
|
4565
|
-
function getDefaultCellHeight(ctx, cell, colSize) {
|
|
4858
|
+
function getDefaultCellHeight(ctx, cell, locale, colSize) {
|
|
4566
4859
|
if (!cell || (!cell.isFormula && !cell.content)) {
|
|
4567
4860
|
return DEFAULT_CELL_HEIGHT;
|
|
4568
4861
|
}
|
|
4569
|
-
|
|
4862
|
+
let content = "";
|
|
4863
|
+
try {
|
|
4864
|
+
if (!cell.isFormula) {
|
|
4865
|
+
const localeFormat = { format: cell.format, locale };
|
|
4866
|
+
content = formatValue(parseLiteral(cell.content, locale), localeFormat);
|
|
4867
|
+
}
|
|
4868
|
+
}
|
|
4869
|
+
catch {
|
|
4870
|
+
content = CellErrorType.GenericError;
|
|
4871
|
+
}
|
|
4570
4872
|
return getCellContentHeight(ctx, content, cell.style, colSize);
|
|
4571
4873
|
}
|
|
4572
4874
|
function getCellContentHeight(ctx, content, style, colSize) {
|
|
@@ -4870,7 +5172,8 @@ function createAction(item) {
|
|
|
4870
5172
|
return children
|
|
4871
5173
|
.map((child) => (typeof child === "function" ? child(env) : child))
|
|
4872
5174
|
.flat()
|
|
4873
|
-
.map(createAction)
|
|
5175
|
+
.map(createAction)
|
|
5176
|
+
.sort((a, b) => a.sequence - b.sequence);
|
|
4874
5177
|
}
|
|
4875
5178
|
: () => [],
|
|
4876
5179
|
isReadonlyAllowed: item.isReadonlyAllowed || false,
|
|
@@ -5831,298 +6134,6 @@ ScorecardChart.props = {
|
|
|
5831
6134
|
figure: Object,
|
|
5832
6135
|
};
|
|
5833
6136
|
|
|
5834
|
-
/**
|
|
5835
|
-
* Registry
|
|
5836
|
-
*
|
|
5837
|
-
* The Registry class is basically just a mapping from a string key to an object.
|
|
5838
|
-
* It is really not much more than an object. It is however useful for the
|
|
5839
|
-
* following reasons:
|
|
5840
|
-
*
|
|
5841
|
-
* 1. it let us react and execute code when someone add something to the registry
|
|
5842
|
-
* (for example, the FunctionRegistry subclass this for this purpose)
|
|
5843
|
-
* 2. it throws an error when the get operation fails
|
|
5844
|
-
* 3. it provides a chained API to add items to the registry.
|
|
5845
|
-
*/
|
|
5846
|
-
class Registry {
|
|
5847
|
-
content = {};
|
|
5848
|
-
/**
|
|
5849
|
-
* Add an item to the registry
|
|
5850
|
-
*
|
|
5851
|
-
* Note that this also returns the registry, so another add method call can
|
|
5852
|
-
* be chained
|
|
5853
|
-
*/
|
|
5854
|
-
add(key, value) {
|
|
5855
|
-
this.content[key] = value;
|
|
5856
|
-
return this;
|
|
5857
|
-
}
|
|
5858
|
-
/**
|
|
5859
|
-
* Get an item from the registry
|
|
5860
|
-
*/
|
|
5861
|
-
get(key) {
|
|
5862
|
-
/**
|
|
5863
|
-
* Note: key in {} is ~12 times slower than {}[key].
|
|
5864
|
-
* So, we check the absence of key only when the direct access returns
|
|
5865
|
-
* a falsy value. It's done to ensure that the registry can contains falsy values
|
|
5866
|
-
*/
|
|
5867
|
-
const content = this.content[key];
|
|
5868
|
-
if (!content) {
|
|
5869
|
-
if (!(key in this.content)) {
|
|
5870
|
-
throw new Error(`Cannot find ${key} in this registry!`);
|
|
5871
|
-
}
|
|
5872
|
-
}
|
|
5873
|
-
return content;
|
|
5874
|
-
}
|
|
5875
|
-
/**
|
|
5876
|
-
* Check if the key is already in the registry
|
|
5877
|
-
*/
|
|
5878
|
-
contains(key) {
|
|
5879
|
-
return key in this.content;
|
|
5880
|
-
}
|
|
5881
|
-
/**
|
|
5882
|
-
* Get a list of all elements in the registry
|
|
5883
|
-
*/
|
|
5884
|
-
getAll() {
|
|
5885
|
-
return Object.values(this.content);
|
|
5886
|
-
}
|
|
5887
|
-
/**
|
|
5888
|
-
* Get a list of all keys in the registry
|
|
5889
|
-
*/
|
|
5890
|
-
getKeys() {
|
|
5891
|
-
return Object.keys(this.content);
|
|
5892
|
-
}
|
|
5893
|
-
/**
|
|
5894
|
-
* Remove an item from the registry
|
|
5895
|
-
*/
|
|
5896
|
-
remove(key) {
|
|
5897
|
-
delete this.content[key];
|
|
5898
|
-
}
|
|
5899
|
-
}
|
|
5900
|
-
|
|
5901
|
-
/**
|
|
5902
|
-
* Add the `https` prefix to the url if it's missing
|
|
5903
|
-
*/
|
|
5904
|
-
function withHttps(url) {
|
|
5905
|
-
return !/^https?:\/\//i.test(url) ? `https://${url}` : url;
|
|
5906
|
-
}
|
|
5907
|
-
const urlRegistry = new Registry();
|
|
5908
|
-
function createWebLink(url, label) {
|
|
5909
|
-
url = withHttps(url);
|
|
5910
|
-
return {
|
|
5911
|
-
url,
|
|
5912
|
-
label: label || url,
|
|
5913
|
-
isExternal: true,
|
|
5914
|
-
isUrlEditable: true,
|
|
5915
|
-
};
|
|
5916
|
-
}
|
|
5917
|
-
urlRegistry.add("sheet_URL", {
|
|
5918
|
-
match: (url) => isSheetUrl(url),
|
|
5919
|
-
createLink: (url, label) => {
|
|
5920
|
-
return {
|
|
5921
|
-
label,
|
|
5922
|
-
url,
|
|
5923
|
-
isExternal: false,
|
|
5924
|
-
isUrlEditable: false,
|
|
5925
|
-
};
|
|
5926
|
-
},
|
|
5927
|
-
urlRepresentation(url, getters) {
|
|
5928
|
-
const sheetId = parseSheetUrl(url);
|
|
5929
|
-
return getters.tryGetSheetName(sheetId) || _t("Invalid sheet");
|
|
5930
|
-
},
|
|
5931
|
-
open(url, env) {
|
|
5932
|
-
const sheetId = parseSheetUrl(url);
|
|
5933
|
-
env.model.dispatch("ACTIVATE_SHEET", {
|
|
5934
|
-
sheetIdFrom: env.model.getters.getActiveSheetId(),
|
|
5935
|
-
sheetIdTo: sheetId,
|
|
5936
|
-
});
|
|
5937
|
-
},
|
|
5938
|
-
sequence: 0,
|
|
5939
|
-
});
|
|
5940
|
-
const WebUrlSpec = {
|
|
5941
|
-
createLink: createWebLink,
|
|
5942
|
-
match: (url) => isWebLink(url),
|
|
5943
|
-
open: (url) => window.open(url, "_blank"),
|
|
5944
|
-
urlRepresentation: (url) => url,
|
|
5945
|
-
sequence: 0,
|
|
5946
|
-
};
|
|
5947
|
-
function findMatchingSpec(url) {
|
|
5948
|
-
return (urlRegistry
|
|
5949
|
-
.getAll()
|
|
5950
|
-
.sort((a, b) => a.sequence - b.sequence)
|
|
5951
|
-
.find((urlType) => urlType.match(url)) || WebUrlSpec);
|
|
5952
|
-
}
|
|
5953
|
-
function urlRepresentation(link, getters) {
|
|
5954
|
-
return findMatchingSpec(link.url).urlRepresentation(link.url, getters);
|
|
5955
|
-
}
|
|
5956
|
-
function openLink(link, env) {
|
|
5957
|
-
findMatchingSpec(link.url).open(link.url, env);
|
|
5958
|
-
}
|
|
5959
|
-
function detectLink(value) {
|
|
5960
|
-
if (typeof value !== "string") {
|
|
5961
|
-
return undefined;
|
|
5962
|
-
}
|
|
5963
|
-
if (isMarkdownLink(value)) {
|
|
5964
|
-
const { label, url } = parseMarkdownLink(value);
|
|
5965
|
-
return findMatchingSpec(url).createLink(url, label);
|
|
5966
|
-
}
|
|
5967
|
-
else if (isWebLink(value)) {
|
|
5968
|
-
return createWebLink(value);
|
|
5969
|
-
}
|
|
5970
|
-
return undefined;
|
|
5971
|
-
}
|
|
5972
|
-
|
|
5973
|
-
function evaluateLiteral(content, localeFormat) {
|
|
5974
|
-
return createEvaluatedCell(parseLiteral(content || "", localeFormat.locale), localeFormat);
|
|
5975
|
-
}
|
|
5976
|
-
function parseLiteral(content, locale) {
|
|
5977
|
-
if (content.startsWith("=")) {
|
|
5978
|
-
throw new Error(`Cannot parse "${content}" because it's not a literal value. It's a formula`);
|
|
5979
|
-
}
|
|
5980
|
-
if (isNumber(content, DEFAULT_LOCALE)) {
|
|
5981
|
-
return toNumber(content, DEFAULT_LOCALE);
|
|
5982
|
-
}
|
|
5983
|
-
else if (isDateTime(content, locale)) {
|
|
5984
|
-
return toNumber(content, locale);
|
|
5985
|
-
}
|
|
5986
|
-
else if (isBoolean(content)) {
|
|
5987
|
-
return content.toUpperCase() === "TRUE" ? true : false;
|
|
5988
|
-
}
|
|
5989
|
-
return content;
|
|
5990
|
-
}
|
|
5991
|
-
function createEvaluatedCell(value, localeFormat) {
|
|
5992
|
-
const link = detectLink(value);
|
|
5993
|
-
if (link) {
|
|
5994
|
-
return {
|
|
5995
|
-
..._createEvaluatedCell(parseLiteral(link.label, localeFormat.locale), {
|
|
5996
|
-
format: localeFormat.format ||
|
|
5997
|
-
detectDateFormat(link.label, localeFormat.locale) ||
|
|
5998
|
-
detectNumberFormat(link.label),
|
|
5999
|
-
locale: localeFormat.locale,
|
|
6000
|
-
}),
|
|
6001
|
-
link,
|
|
6002
|
-
};
|
|
6003
|
-
}
|
|
6004
|
-
return _createEvaluatedCell(value, localeFormat);
|
|
6005
|
-
}
|
|
6006
|
-
function _createEvaluatedCell(value, localeFormat) {
|
|
6007
|
-
try {
|
|
6008
|
-
for (const builder of builders) {
|
|
6009
|
-
const evaluateCell = builder(value, localeFormat);
|
|
6010
|
-
if (evaluateCell) {
|
|
6011
|
-
return evaluateCell;
|
|
6012
|
-
}
|
|
6013
|
-
}
|
|
6014
|
-
return textCell((value || "").toString(), localeFormat);
|
|
6015
|
-
}
|
|
6016
|
-
catch (error) {
|
|
6017
|
-
return errorCell(new EvaluationError(CellErrorType.GenericError, error.message || DEFAULT_ERROR_MESSAGE));
|
|
6018
|
-
}
|
|
6019
|
-
}
|
|
6020
|
-
function textCell(value, localeFormat) {
|
|
6021
|
-
return {
|
|
6022
|
-
type: CellValueType.text,
|
|
6023
|
-
value,
|
|
6024
|
-
format: localeFormat.format,
|
|
6025
|
-
isAutoSummable: true,
|
|
6026
|
-
defaultAlign: "left",
|
|
6027
|
-
formattedValue: formatValue(value, localeFormat),
|
|
6028
|
-
};
|
|
6029
|
-
}
|
|
6030
|
-
function numberCell(value, localeFormat) {
|
|
6031
|
-
return {
|
|
6032
|
-
type: CellValueType.number,
|
|
6033
|
-
value: value || 0, // necessary to avoid "-0" and NaN values,
|
|
6034
|
-
format: localeFormat.format,
|
|
6035
|
-
isAutoSummable: true,
|
|
6036
|
-
defaultAlign: "right",
|
|
6037
|
-
formattedValue: formatValue(value, localeFormat),
|
|
6038
|
-
};
|
|
6039
|
-
}
|
|
6040
|
-
const EMPTY_EVALUATED_CELL = {
|
|
6041
|
-
type: CellValueType.empty,
|
|
6042
|
-
value: "",
|
|
6043
|
-
format: undefined,
|
|
6044
|
-
isAutoSummable: true,
|
|
6045
|
-
defaultAlign: "left",
|
|
6046
|
-
formattedValue: "",
|
|
6047
|
-
};
|
|
6048
|
-
function emptyCell(localeFormat) {
|
|
6049
|
-
if (localeFormat.format === undefined) {
|
|
6050
|
-
// share the same object to save memory
|
|
6051
|
-
return EMPTY_EVALUATED_CELL;
|
|
6052
|
-
}
|
|
6053
|
-
return {
|
|
6054
|
-
type: CellValueType.empty,
|
|
6055
|
-
value: "",
|
|
6056
|
-
format: localeFormat.format,
|
|
6057
|
-
isAutoSummable: true,
|
|
6058
|
-
defaultAlign: "left",
|
|
6059
|
-
formattedValue: "",
|
|
6060
|
-
};
|
|
6061
|
-
}
|
|
6062
|
-
function dateTimeCell(value, localeFormat) {
|
|
6063
|
-
const formattedValue = formatValue(value, localeFormat);
|
|
6064
|
-
return {
|
|
6065
|
-
type: CellValueType.number,
|
|
6066
|
-
value,
|
|
6067
|
-
format: localeFormat.format,
|
|
6068
|
-
isAutoSummable: false,
|
|
6069
|
-
defaultAlign: "right",
|
|
6070
|
-
formattedValue,
|
|
6071
|
-
};
|
|
6072
|
-
}
|
|
6073
|
-
function booleanCell(value, localeFormat) {
|
|
6074
|
-
const formattedValue = value ? "TRUE" : "FALSE";
|
|
6075
|
-
return {
|
|
6076
|
-
type: CellValueType.boolean,
|
|
6077
|
-
value,
|
|
6078
|
-
format: localeFormat.format,
|
|
6079
|
-
isAutoSummable: false,
|
|
6080
|
-
defaultAlign: "center",
|
|
6081
|
-
formattedValue,
|
|
6082
|
-
};
|
|
6083
|
-
}
|
|
6084
|
-
function errorCell(error) {
|
|
6085
|
-
return {
|
|
6086
|
-
type: CellValueType.error,
|
|
6087
|
-
value: error.errorType,
|
|
6088
|
-
error,
|
|
6089
|
-
isAutoSummable: false,
|
|
6090
|
-
defaultAlign: "center",
|
|
6091
|
-
formattedValue: error.errorType,
|
|
6092
|
-
};
|
|
6093
|
-
}
|
|
6094
|
-
const builders = [
|
|
6095
|
-
function createEmpty(value, localeFormat) {
|
|
6096
|
-
if (value === "") {
|
|
6097
|
-
return emptyCell(localeFormat);
|
|
6098
|
-
}
|
|
6099
|
-
return undefined;
|
|
6100
|
-
},
|
|
6101
|
-
function createDateTime(value, localeFormat) {
|
|
6102
|
-
if (!!localeFormat.format &&
|
|
6103
|
-
typeof value === "number" &&
|
|
6104
|
-
isDateTimeFormat(localeFormat.format)) {
|
|
6105
|
-
return dateTimeCell(value, localeFormat);
|
|
6106
|
-
}
|
|
6107
|
-
return undefined;
|
|
6108
|
-
},
|
|
6109
|
-
function createNumber(value, localeFormat) {
|
|
6110
|
-
if (typeof value === "number") {
|
|
6111
|
-
return numberCell(value, localeFormat);
|
|
6112
|
-
}
|
|
6113
|
-
else if (value === null) {
|
|
6114
|
-
return numberCell(0, localeFormat);
|
|
6115
|
-
}
|
|
6116
|
-
return undefined;
|
|
6117
|
-
},
|
|
6118
|
-
function createBoolean(value, localeFormat) {
|
|
6119
|
-
if (typeof value === "boolean") {
|
|
6120
|
-
return booleanCell(value, localeFormat);
|
|
6121
|
-
}
|
|
6122
|
-
return undefined;
|
|
6123
|
-
},
|
|
6124
|
-
];
|
|
6125
|
-
|
|
6126
6137
|
/**
|
|
6127
6138
|
* An AutofillModifierImplementation is used to describe how to handle a
|
|
6128
6139
|
* AutofillModifier.
|
|
@@ -32644,6 +32655,7 @@ function extractStyle(cell, data) {
|
|
|
32644
32655
|
? V_ALIGNMENT_EXPORT_CONVERSION_MAP[style.verticalAlign]
|
|
32645
32656
|
: undefined,
|
|
32646
32657
|
wrapText: style.wrapping === "wrap" || cell.content?.includes(NEWLINE) ? true : undefined,
|
|
32658
|
+
shrinkToFit: style.wrapping === "clip" ? true : undefined,
|
|
32647
32659
|
},
|
|
32648
32660
|
};
|
|
32649
32661
|
styles.font["strike"] = !!style?.strikethrough || undefined;
|
|
@@ -32670,6 +32682,7 @@ function normalizeStyle(construct, styles) {
|
|
|
32670
32682
|
vertical: styles.alignment.vertical,
|
|
32671
32683
|
horizontal: styles.alignment.horizontal,
|
|
32672
32684
|
wrapText: styles.alignment.wrapText,
|
|
32685
|
+
shrinkToFit: styles.alignment.shrinkToFit,
|
|
32673
32686
|
},
|
|
32674
32687
|
};
|
|
32675
32688
|
return pushElement(style, construct.styles);
|
|
@@ -36413,7 +36426,7 @@ class CellPlugin extends CorePlugin {
|
|
|
36413
36426
|
for (const position of positions) {
|
|
36414
36427
|
const cell = this.getters.getCell(position);
|
|
36415
36428
|
const xc = toXC(position.col, position.row);
|
|
36416
|
-
const style = this.
|
|
36429
|
+
const style = this.extractCustomStyle(cell);
|
|
36417
36430
|
cells[xc] = {
|
|
36418
36431
|
style: Object.keys(style).length ? getItemId(style, styles) : undefined,
|
|
36419
36432
|
format: cell.format ? getItemId(cell.format, formats) : undefined,
|
|
@@ -36434,10 +36447,14 @@ class CellPlugin extends CorePlugin {
|
|
|
36434
36447
|
exportForExcel(data) {
|
|
36435
36448
|
this.export(data);
|
|
36436
36449
|
}
|
|
36437
|
-
|
|
36438
|
-
const cleanedStyle = { ...style };
|
|
36439
|
-
|
|
36440
|
-
|
|
36450
|
+
extractCustomStyle(cell) {
|
|
36451
|
+
const cleanedStyle = { ...cell.style };
|
|
36452
|
+
const defaultStyle = isNumber(cell.content, DEFAULT_LOCALE)
|
|
36453
|
+
? DEFAULT_NUMBER_STYLE
|
|
36454
|
+
: DEFAULT_STYLE;
|
|
36455
|
+
for (const property in cleanedStyle) {
|
|
36456
|
+
if ((property !== "align" || !cell.isFormula) &&
|
|
36457
|
+
cleanedStyle[property] === defaultStyle[property]) {
|
|
36441
36458
|
delete cleanedStyle[property];
|
|
36442
36459
|
}
|
|
36443
36460
|
}
|
|
@@ -43578,6 +43595,7 @@ class HeaderSizeUIPlugin extends UIPlugin {
|
|
|
43578
43595
|
handle(cmd) {
|
|
43579
43596
|
switch (cmd.type) {
|
|
43580
43597
|
case "START":
|
|
43598
|
+
case "UPDATE_LOCALE":
|
|
43581
43599
|
for (const sheetId of this.getters.getSheetIds()) {
|
|
43582
43600
|
this.initializeSheet(sheetId);
|
|
43583
43601
|
}
|
|
@@ -43683,7 +43701,7 @@ class HeaderSizeUIPlugin extends UIPlugin {
|
|
|
43683
43701
|
}
|
|
43684
43702
|
const cell = this.getters.getCell(position);
|
|
43685
43703
|
const colSize = this.getters.getColSize(position.sheetId, position.col);
|
|
43686
|
-
return getDefaultCellHeight(this.ctx, cell, colSize);
|
|
43704
|
+
return getDefaultCellHeight(this.ctx, cell, this.getters.getLocale(), colSize);
|
|
43687
43705
|
}
|
|
43688
43706
|
isInMultiRowMerge(position) {
|
|
43689
43707
|
const merge = this.getters.getMerge(position);
|
|
@@ -57303,6 +57321,9 @@ function addStyles(styles) {
|
|
|
57303
57321
|
if (style.alignment && style.alignment.wrapText) {
|
|
57304
57322
|
alignAttrs.push(["wrapText", "1"]);
|
|
57305
57323
|
}
|
|
57324
|
+
if (style.alignment && style.alignment.shrinkToFit) {
|
|
57325
|
+
alignAttrs.push(["shrinkToFit", "1"]);
|
|
57326
|
+
}
|
|
57306
57327
|
if (alignAttrs.length > 0) {
|
|
57307
57328
|
attributes.push(["applyAlignment", "1"]); // for Libre Office
|
|
57308
57329
|
styleNodes.push(escapeXml /*xml*/ `<xf ${formatAttributes(attributes)}><alignment ${formatAttributes(alignAttrs)} /></xf> `);
|
|
@@ -58539,6 +58560,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
58539
58560
|
exports.tokenize = tokenize;
|
|
58540
58561
|
|
|
58541
58562
|
|
|
58542
|
-
__info__.version = "17.0.
|
|
58543
|
-
__info__.date = "2026-01-
|
|
58544
|
-
__info__.hash = "
|
|
58563
|
+
__info__.version = "17.0.85";
|
|
58564
|
+
__info__.date = "2026-01-21T11:02:43.920Z";
|
|
58565
|
+
__info__.hash = "0343060";
|