@odoo/o-spreadsheet 17.0.84 → 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 +313 -302
- package/dist/o-spreadsheet.d.ts +4 -4
- package/dist/o-spreadsheet.esm.js +313 -302
- package/dist/o-spreadsheet.iife.js +313 -302
- package/dist/o-spreadsheet.iife.min.js +25 -25
- 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
|
(function (exports, owl) {
|
|
@@ -4556,17 +4556,318 @@
|
|
|
4556
4556
|
getUnquotedSheetName(name2.trim().toUpperCase()));
|
|
4557
4557
|
}
|
|
4558
4558
|
|
|
4559
|
+
/**
|
|
4560
|
+
* Registry
|
|
4561
|
+
*
|
|
4562
|
+
* The Registry class is basically just a mapping from a string key to an object.
|
|
4563
|
+
* It is really not much more than an object. It is however useful for the
|
|
4564
|
+
* following reasons:
|
|
4565
|
+
*
|
|
4566
|
+
* 1. it let us react and execute code when someone add something to the registry
|
|
4567
|
+
* (for example, the FunctionRegistry subclass this for this purpose)
|
|
4568
|
+
* 2. it throws an error when the get operation fails
|
|
4569
|
+
* 3. it provides a chained API to add items to the registry.
|
|
4570
|
+
*/
|
|
4571
|
+
class Registry {
|
|
4572
|
+
content = {};
|
|
4573
|
+
/**
|
|
4574
|
+
* Add an item to the registry
|
|
4575
|
+
*
|
|
4576
|
+
* Note that this also returns the registry, so another add method call can
|
|
4577
|
+
* be chained
|
|
4578
|
+
*/
|
|
4579
|
+
add(key, value) {
|
|
4580
|
+
this.content[key] = value;
|
|
4581
|
+
return this;
|
|
4582
|
+
}
|
|
4583
|
+
/**
|
|
4584
|
+
* Get an item from the registry
|
|
4585
|
+
*/
|
|
4586
|
+
get(key) {
|
|
4587
|
+
/**
|
|
4588
|
+
* Note: key in {} is ~12 times slower than {}[key].
|
|
4589
|
+
* So, we check the absence of key only when the direct access returns
|
|
4590
|
+
* a falsy value. It's done to ensure that the registry can contains falsy values
|
|
4591
|
+
*/
|
|
4592
|
+
const content = this.content[key];
|
|
4593
|
+
if (!content) {
|
|
4594
|
+
if (!(key in this.content)) {
|
|
4595
|
+
throw new Error(`Cannot find ${key} in this registry!`);
|
|
4596
|
+
}
|
|
4597
|
+
}
|
|
4598
|
+
return content;
|
|
4599
|
+
}
|
|
4600
|
+
/**
|
|
4601
|
+
* Check if the key is already in the registry
|
|
4602
|
+
*/
|
|
4603
|
+
contains(key) {
|
|
4604
|
+
return key in this.content;
|
|
4605
|
+
}
|
|
4606
|
+
/**
|
|
4607
|
+
* Get a list of all elements in the registry
|
|
4608
|
+
*/
|
|
4609
|
+
getAll() {
|
|
4610
|
+
return Object.values(this.content);
|
|
4611
|
+
}
|
|
4612
|
+
/**
|
|
4613
|
+
* Get a list of all keys in the registry
|
|
4614
|
+
*/
|
|
4615
|
+
getKeys() {
|
|
4616
|
+
return Object.keys(this.content);
|
|
4617
|
+
}
|
|
4618
|
+
/**
|
|
4619
|
+
* Remove an item from the registry
|
|
4620
|
+
*/
|
|
4621
|
+
remove(key) {
|
|
4622
|
+
delete this.content[key];
|
|
4623
|
+
}
|
|
4624
|
+
}
|
|
4625
|
+
|
|
4626
|
+
/**
|
|
4627
|
+
* Add the `https` prefix to the url if it's missing
|
|
4628
|
+
*/
|
|
4629
|
+
function withHttps(url) {
|
|
4630
|
+
return !/^https?:\/\//i.test(url) ? `https://${url}` : url;
|
|
4631
|
+
}
|
|
4632
|
+
const urlRegistry = new Registry();
|
|
4633
|
+
function createWebLink(url, label) {
|
|
4634
|
+
url = withHttps(url);
|
|
4635
|
+
return {
|
|
4636
|
+
url,
|
|
4637
|
+
label: label || url,
|
|
4638
|
+
isExternal: true,
|
|
4639
|
+
isUrlEditable: true,
|
|
4640
|
+
};
|
|
4641
|
+
}
|
|
4642
|
+
urlRegistry.add("sheet_URL", {
|
|
4643
|
+
match: (url) => isSheetUrl(url),
|
|
4644
|
+
createLink: (url, label) => {
|
|
4645
|
+
return {
|
|
4646
|
+
label,
|
|
4647
|
+
url,
|
|
4648
|
+
isExternal: false,
|
|
4649
|
+
isUrlEditable: false,
|
|
4650
|
+
};
|
|
4651
|
+
},
|
|
4652
|
+
urlRepresentation(url, getters) {
|
|
4653
|
+
const sheetId = parseSheetUrl(url);
|
|
4654
|
+
return getters.tryGetSheetName(sheetId) || _t("Invalid sheet");
|
|
4655
|
+
},
|
|
4656
|
+
open(url, env) {
|
|
4657
|
+
const sheetId = parseSheetUrl(url);
|
|
4658
|
+
env.model.dispatch("ACTIVATE_SHEET", {
|
|
4659
|
+
sheetIdFrom: env.model.getters.getActiveSheetId(),
|
|
4660
|
+
sheetIdTo: sheetId,
|
|
4661
|
+
});
|
|
4662
|
+
},
|
|
4663
|
+
sequence: 0,
|
|
4664
|
+
});
|
|
4665
|
+
const WebUrlSpec = {
|
|
4666
|
+
createLink: createWebLink,
|
|
4667
|
+
match: (url) => isWebLink(url),
|
|
4668
|
+
open: (url) => window.open(url, "_blank"),
|
|
4669
|
+
urlRepresentation: (url) => url,
|
|
4670
|
+
sequence: 0,
|
|
4671
|
+
};
|
|
4672
|
+
function findMatchingSpec(url) {
|
|
4673
|
+
return (urlRegistry
|
|
4674
|
+
.getAll()
|
|
4675
|
+
.sort((a, b) => a.sequence - b.sequence)
|
|
4676
|
+
.find((urlType) => urlType.match(url)) || WebUrlSpec);
|
|
4677
|
+
}
|
|
4678
|
+
function urlRepresentation(link, getters) {
|
|
4679
|
+
return findMatchingSpec(link.url).urlRepresentation(link.url, getters);
|
|
4680
|
+
}
|
|
4681
|
+
function openLink(link, env) {
|
|
4682
|
+
findMatchingSpec(link.url).open(link.url, env);
|
|
4683
|
+
}
|
|
4684
|
+
function detectLink(value) {
|
|
4685
|
+
if (typeof value !== "string") {
|
|
4686
|
+
return undefined;
|
|
4687
|
+
}
|
|
4688
|
+
if (isMarkdownLink(value)) {
|
|
4689
|
+
const { label, url } = parseMarkdownLink(value);
|
|
4690
|
+
return findMatchingSpec(url).createLink(url, label);
|
|
4691
|
+
}
|
|
4692
|
+
else if (isWebLink(value)) {
|
|
4693
|
+
return createWebLink(value);
|
|
4694
|
+
}
|
|
4695
|
+
return undefined;
|
|
4696
|
+
}
|
|
4697
|
+
|
|
4698
|
+
function evaluateLiteral(content, localeFormat) {
|
|
4699
|
+
return createEvaluatedCell(parseLiteral(content || "", localeFormat.locale), localeFormat);
|
|
4700
|
+
}
|
|
4701
|
+
function parseLiteral(content, locale) {
|
|
4702
|
+
if (content.startsWith("=")) {
|
|
4703
|
+
throw new Error(`Cannot parse "${content}" because it's not a literal value. It's a formula`);
|
|
4704
|
+
}
|
|
4705
|
+
if (isNumber(content, DEFAULT_LOCALE)) {
|
|
4706
|
+
return toNumber(content, DEFAULT_LOCALE);
|
|
4707
|
+
}
|
|
4708
|
+
else if (isDateTime(content, locale)) {
|
|
4709
|
+
return toNumber(content, locale);
|
|
4710
|
+
}
|
|
4711
|
+
else if (isBoolean(content)) {
|
|
4712
|
+
return content.toUpperCase() === "TRUE" ? true : false;
|
|
4713
|
+
}
|
|
4714
|
+
return content;
|
|
4715
|
+
}
|
|
4716
|
+
function createEvaluatedCell(value, localeFormat) {
|
|
4717
|
+
const link = detectLink(value);
|
|
4718
|
+
if (link) {
|
|
4719
|
+
return {
|
|
4720
|
+
..._createEvaluatedCell(parseLiteral(link.label, localeFormat.locale), {
|
|
4721
|
+
format: localeFormat.format ||
|
|
4722
|
+
detectDateFormat(link.label, localeFormat.locale) ||
|
|
4723
|
+
detectNumberFormat(link.label),
|
|
4724
|
+
locale: localeFormat.locale,
|
|
4725
|
+
}),
|
|
4726
|
+
link,
|
|
4727
|
+
};
|
|
4728
|
+
}
|
|
4729
|
+
return _createEvaluatedCell(value, localeFormat);
|
|
4730
|
+
}
|
|
4731
|
+
function _createEvaluatedCell(value, localeFormat) {
|
|
4732
|
+
try {
|
|
4733
|
+
for (const builder of builders) {
|
|
4734
|
+
const evaluateCell = builder(value, localeFormat);
|
|
4735
|
+
if (evaluateCell) {
|
|
4736
|
+
return evaluateCell;
|
|
4737
|
+
}
|
|
4738
|
+
}
|
|
4739
|
+
return textCell((value || "").toString(), localeFormat);
|
|
4740
|
+
}
|
|
4741
|
+
catch (error) {
|
|
4742
|
+
return errorCell(new EvaluationError(CellErrorType.GenericError, error.message || DEFAULT_ERROR_MESSAGE));
|
|
4743
|
+
}
|
|
4744
|
+
}
|
|
4745
|
+
function textCell(value, localeFormat) {
|
|
4746
|
+
return {
|
|
4747
|
+
type: CellValueType.text,
|
|
4748
|
+
value,
|
|
4749
|
+
format: localeFormat.format,
|
|
4750
|
+
isAutoSummable: true,
|
|
4751
|
+
defaultAlign: "left",
|
|
4752
|
+
formattedValue: formatValue(value, localeFormat),
|
|
4753
|
+
};
|
|
4754
|
+
}
|
|
4755
|
+
function numberCell(value, localeFormat) {
|
|
4756
|
+
return {
|
|
4757
|
+
type: CellValueType.number,
|
|
4758
|
+
value: value || 0, // necessary to avoid "-0" and NaN values,
|
|
4759
|
+
format: localeFormat.format,
|
|
4760
|
+
isAutoSummable: true,
|
|
4761
|
+
defaultAlign: "right",
|
|
4762
|
+
formattedValue: formatValue(value, localeFormat),
|
|
4763
|
+
};
|
|
4764
|
+
}
|
|
4765
|
+
const EMPTY_EVALUATED_CELL = {
|
|
4766
|
+
type: CellValueType.empty,
|
|
4767
|
+
value: "",
|
|
4768
|
+
format: undefined,
|
|
4769
|
+
isAutoSummable: true,
|
|
4770
|
+
defaultAlign: "left",
|
|
4771
|
+
formattedValue: "",
|
|
4772
|
+
};
|
|
4773
|
+
function emptyCell(localeFormat) {
|
|
4774
|
+
if (localeFormat.format === undefined) {
|
|
4775
|
+
// share the same object to save memory
|
|
4776
|
+
return EMPTY_EVALUATED_CELL;
|
|
4777
|
+
}
|
|
4778
|
+
return {
|
|
4779
|
+
type: CellValueType.empty,
|
|
4780
|
+
value: "",
|
|
4781
|
+
format: localeFormat.format,
|
|
4782
|
+
isAutoSummable: true,
|
|
4783
|
+
defaultAlign: "left",
|
|
4784
|
+
formattedValue: "",
|
|
4785
|
+
};
|
|
4786
|
+
}
|
|
4787
|
+
function dateTimeCell(value, localeFormat) {
|
|
4788
|
+
const formattedValue = formatValue(value, localeFormat);
|
|
4789
|
+
return {
|
|
4790
|
+
type: CellValueType.number,
|
|
4791
|
+
value,
|
|
4792
|
+
format: localeFormat.format,
|
|
4793
|
+
isAutoSummable: false,
|
|
4794
|
+
defaultAlign: "right",
|
|
4795
|
+
formattedValue,
|
|
4796
|
+
};
|
|
4797
|
+
}
|
|
4798
|
+
function booleanCell(value, localeFormat) {
|
|
4799
|
+
const formattedValue = value ? "TRUE" : "FALSE";
|
|
4800
|
+
return {
|
|
4801
|
+
type: CellValueType.boolean,
|
|
4802
|
+
value,
|
|
4803
|
+
format: localeFormat.format,
|
|
4804
|
+
isAutoSummable: false,
|
|
4805
|
+
defaultAlign: "center",
|
|
4806
|
+
formattedValue,
|
|
4807
|
+
};
|
|
4808
|
+
}
|
|
4809
|
+
function errorCell(error) {
|
|
4810
|
+
return {
|
|
4811
|
+
type: CellValueType.error,
|
|
4812
|
+
value: error.errorType,
|
|
4813
|
+
error,
|
|
4814
|
+
isAutoSummable: false,
|
|
4815
|
+
defaultAlign: "center",
|
|
4816
|
+
formattedValue: error.errorType,
|
|
4817
|
+
};
|
|
4818
|
+
}
|
|
4819
|
+
const builders = [
|
|
4820
|
+
function createEmpty(value, localeFormat) {
|
|
4821
|
+
if (value === "") {
|
|
4822
|
+
return emptyCell(localeFormat);
|
|
4823
|
+
}
|
|
4824
|
+
return undefined;
|
|
4825
|
+
},
|
|
4826
|
+
function createDateTime(value, localeFormat) {
|
|
4827
|
+
if (!!localeFormat.format &&
|
|
4828
|
+
typeof value === "number" &&
|
|
4829
|
+
isDateTimeFormat(localeFormat.format)) {
|
|
4830
|
+
return dateTimeCell(value, localeFormat);
|
|
4831
|
+
}
|
|
4832
|
+
return undefined;
|
|
4833
|
+
},
|
|
4834
|
+
function createNumber(value, localeFormat) {
|
|
4835
|
+
if (typeof value === "number") {
|
|
4836
|
+
return numberCell(value, localeFormat);
|
|
4837
|
+
}
|
|
4838
|
+
else if (value === null) {
|
|
4839
|
+
return numberCell(0, localeFormat);
|
|
4840
|
+
}
|
|
4841
|
+
return undefined;
|
|
4842
|
+
},
|
|
4843
|
+
function createBoolean(value, localeFormat) {
|
|
4844
|
+
if (typeof value === "boolean") {
|
|
4845
|
+
return booleanCell(value, localeFormat);
|
|
4846
|
+
}
|
|
4847
|
+
return undefined;
|
|
4848
|
+
},
|
|
4849
|
+
];
|
|
4850
|
+
|
|
4559
4851
|
function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
|
|
4560
4852
|
return numberOfLines * (textLineHeight + MIN_CELL_TEXT_MARGIN) - MIN_CELL_TEXT_MARGIN;
|
|
4561
4853
|
}
|
|
4562
4854
|
/**
|
|
4563
4855
|
* Get the default height of the cell given its style.
|
|
4564
4856
|
*/
|
|
4565
|
-
function getDefaultCellHeight(ctx, cell, colSize) {
|
|
4857
|
+
function getDefaultCellHeight(ctx, cell, locale, colSize) {
|
|
4566
4858
|
if (!cell || (!cell.isFormula && !cell.content)) {
|
|
4567
4859
|
return DEFAULT_CELL_HEIGHT;
|
|
4568
4860
|
}
|
|
4569
|
-
|
|
4861
|
+
let content = "";
|
|
4862
|
+
try {
|
|
4863
|
+
if (!cell.isFormula) {
|
|
4864
|
+
const localeFormat = { format: cell.format, locale };
|
|
4865
|
+
content = formatValue(parseLiteral(cell.content, locale), localeFormat);
|
|
4866
|
+
}
|
|
4867
|
+
}
|
|
4868
|
+
catch {
|
|
4869
|
+
content = CellErrorType.GenericError;
|
|
4870
|
+
}
|
|
4570
4871
|
return getCellContentHeight(ctx, content, cell.style, colSize);
|
|
4571
4872
|
}
|
|
4572
4873
|
function getCellContentHeight(ctx, content, style, colSize) {
|
|
@@ -4870,7 +5171,8 @@
|
|
|
4870
5171
|
return children
|
|
4871
5172
|
.map((child) => (typeof child === "function" ? child(env) : child))
|
|
4872
5173
|
.flat()
|
|
4873
|
-
.map(createAction)
|
|
5174
|
+
.map(createAction)
|
|
5175
|
+
.sort((a, b) => a.sequence - b.sequence);
|
|
4874
5176
|
}
|
|
4875
5177
|
: () => [],
|
|
4876
5178
|
isReadonlyAllowed: item.isReadonlyAllowed || false,
|
|
@@ -5831,298 +6133,6 @@
|
|
|
5831
6133
|
figure: Object,
|
|
5832
6134
|
};
|
|
5833
6135
|
|
|
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
6136
|
/**
|
|
6127
6137
|
* An AutofillModifierImplementation is used to describe how to handle a
|
|
6128
6138
|
* AutofillModifier.
|
|
@@ -43584,6 +43594,7 @@
|
|
|
43584
43594
|
handle(cmd) {
|
|
43585
43595
|
switch (cmd.type) {
|
|
43586
43596
|
case "START":
|
|
43597
|
+
case "UPDATE_LOCALE":
|
|
43587
43598
|
for (const sheetId of this.getters.getSheetIds()) {
|
|
43588
43599
|
this.initializeSheet(sheetId);
|
|
43589
43600
|
}
|
|
@@ -43689,7 +43700,7 @@
|
|
|
43689
43700
|
}
|
|
43690
43701
|
const cell = this.getters.getCell(position);
|
|
43691
43702
|
const colSize = this.getters.getColSize(position.sheetId, position.col);
|
|
43692
|
-
return getDefaultCellHeight(this.ctx, cell, colSize);
|
|
43703
|
+
return getDefaultCellHeight(this.ctx, cell, this.getters.getLocale(), colSize);
|
|
43693
43704
|
}
|
|
43694
43705
|
isInMultiRowMerge(position) {
|
|
43695
43706
|
const merge = this.getters.getMerge(position);
|
|
@@ -58548,9 +58559,9 @@
|
|
|
58548
58559
|
exports.tokenize = tokenize;
|
|
58549
58560
|
|
|
58550
58561
|
|
|
58551
|
-
__info__.version = "17.0.
|
|
58552
|
-
__info__.date = "2026-01-
|
|
58553
|
-
__info__.hash = "
|
|
58562
|
+
__info__.version = "17.0.85";
|
|
58563
|
+
__info__.date = "2026-01-21T11:02:43.920Z";
|
|
58564
|
+
__info__.hash = "0343060";
|
|
58554
58565
|
|
|
58555
58566
|
|
|
58556
58567
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|