@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
|
(function (exports, owl) {
|
|
@@ -273,6 +273,7 @@
|
|
|
273
273
|
fillColor: "",
|
|
274
274
|
textColor: "",
|
|
275
275
|
};
|
|
276
|
+
const DEFAULT_NUMBER_STYLE = { ...DEFAULT_STYLE, align: "right" };
|
|
276
277
|
const DEFAULT_VERTICAL_ALIGN = DEFAULT_STYLE.verticalAlign;
|
|
277
278
|
const DEFAULT_WRAPPING_MODE = DEFAULT_STYLE.wrapping;
|
|
278
279
|
// Fonts
|
|
@@ -4555,17 +4556,318 @@
|
|
|
4555
4556
|
getUnquotedSheetName(name2.trim().toUpperCase()));
|
|
4556
4557
|
}
|
|
4557
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
|
+
|
|
4558
4851
|
function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
|
|
4559
4852
|
return numberOfLines * (textLineHeight + MIN_CELL_TEXT_MARGIN) - MIN_CELL_TEXT_MARGIN;
|
|
4560
4853
|
}
|
|
4561
4854
|
/**
|
|
4562
4855
|
* Get the default height of the cell given its style.
|
|
4563
4856
|
*/
|
|
4564
|
-
function getDefaultCellHeight(ctx, cell, colSize) {
|
|
4857
|
+
function getDefaultCellHeight(ctx, cell, locale, colSize) {
|
|
4565
4858
|
if (!cell || (!cell.isFormula && !cell.content)) {
|
|
4566
4859
|
return DEFAULT_CELL_HEIGHT;
|
|
4567
4860
|
}
|
|
4568
|
-
|
|
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
|
+
}
|
|
4569
4871
|
return getCellContentHeight(ctx, content, cell.style, colSize);
|
|
4570
4872
|
}
|
|
4571
4873
|
function getCellContentHeight(ctx, content, style, colSize) {
|
|
@@ -4869,7 +5171,8 @@
|
|
|
4869
5171
|
return children
|
|
4870
5172
|
.map((child) => (typeof child === "function" ? child(env) : child))
|
|
4871
5173
|
.flat()
|
|
4872
|
-
.map(createAction)
|
|
5174
|
+
.map(createAction)
|
|
5175
|
+
.sort((a, b) => a.sequence - b.sequence);
|
|
4873
5176
|
}
|
|
4874
5177
|
: () => [],
|
|
4875
5178
|
isReadonlyAllowed: item.isReadonlyAllowed || false,
|
|
@@ -5830,298 +6133,6 @@
|
|
|
5830
6133
|
figure: Object,
|
|
5831
6134
|
};
|
|
5832
6135
|
|
|
5833
|
-
/**
|
|
5834
|
-
* Registry
|
|
5835
|
-
*
|
|
5836
|
-
* The Registry class is basically just a mapping from a string key to an object.
|
|
5837
|
-
* It is really not much more than an object. It is however useful for the
|
|
5838
|
-
* following reasons:
|
|
5839
|
-
*
|
|
5840
|
-
* 1. it let us react and execute code when someone add something to the registry
|
|
5841
|
-
* (for example, the FunctionRegistry subclass this for this purpose)
|
|
5842
|
-
* 2. it throws an error when the get operation fails
|
|
5843
|
-
* 3. it provides a chained API to add items to the registry.
|
|
5844
|
-
*/
|
|
5845
|
-
class Registry {
|
|
5846
|
-
content = {};
|
|
5847
|
-
/**
|
|
5848
|
-
* Add an item to the registry
|
|
5849
|
-
*
|
|
5850
|
-
* Note that this also returns the registry, so another add method call can
|
|
5851
|
-
* be chained
|
|
5852
|
-
*/
|
|
5853
|
-
add(key, value) {
|
|
5854
|
-
this.content[key] = value;
|
|
5855
|
-
return this;
|
|
5856
|
-
}
|
|
5857
|
-
/**
|
|
5858
|
-
* Get an item from the registry
|
|
5859
|
-
*/
|
|
5860
|
-
get(key) {
|
|
5861
|
-
/**
|
|
5862
|
-
* Note: key in {} is ~12 times slower than {}[key].
|
|
5863
|
-
* So, we check the absence of key only when the direct access returns
|
|
5864
|
-
* a falsy value. It's done to ensure that the registry can contains falsy values
|
|
5865
|
-
*/
|
|
5866
|
-
const content = this.content[key];
|
|
5867
|
-
if (!content) {
|
|
5868
|
-
if (!(key in this.content)) {
|
|
5869
|
-
throw new Error(`Cannot find ${key} in this registry!`);
|
|
5870
|
-
}
|
|
5871
|
-
}
|
|
5872
|
-
return content;
|
|
5873
|
-
}
|
|
5874
|
-
/**
|
|
5875
|
-
* Check if the key is already in the registry
|
|
5876
|
-
*/
|
|
5877
|
-
contains(key) {
|
|
5878
|
-
return key in this.content;
|
|
5879
|
-
}
|
|
5880
|
-
/**
|
|
5881
|
-
* Get a list of all elements in the registry
|
|
5882
|
-
*/
|
|
5883
|
-
getAll() {
|
|
5884
|
-
return Object.values(this.content);
|
|
5885
|
-
}
|
|
5886
|
-
/**
|
|
5887
|
-
* Get a list of all keys in the registry
|
|
5888
|
-
*/
|
|
5889
|
-
getKeys() {
|
|
5890
|
-
return Object.keys(this.content);
|
|
5891
|
-
}
|
|
5892
|
-
/**
|
|
5893
|
-
* Remove an item from the registry
|
|
5894
|
-
*/
|
|
5895
|
-
remove(key) {
|
|
5896
|
-
delete this.content[key];
|
|
5897
|
-
}
|
|
5898
|
-
}
|
|
5899
|
-
|
|
5900
|
-
/**
|
|
5901
|
-
* Add the `https` prefix to the url if it's missing
|
|
5902
|
-
*/
|
|
5903
|
-
function withHttps(url) {
|
|
5904
|
-
return !/^https?:\/\//i.test(url) ? `https://${url}` : url;
|
|
5905
|
-
}
|
|
5906
|
-
const urlRegistry = new Registry();
|
|
5907
|
-
function createWebLink(url, label) {
|
|
5908
|
-
url = withHttps(url);
|
|
5909
|
-
return {
|
|
5910
|
-
url,
|
|
5911
|
-
label: label || url,
|
|
5912
|
-
isExternal: true,
|
|
5913
|
-
isUrlEditable: true,
|
|
5914
|
-
};
|
|
5915
|
-
}
|
|
5916
|
-
urlRegistry.add("sheet_URL", {
|
|
5917
|
-
match: (url) => isSheetUrl(url),
|
|
5918
|
-
createLink: (url, label) => {
|
|
5919
|
-
return {
|
|
5920
|
-
label,
|
|
5921
|
-
url,
|
|
5922
|
-
isExternal: false,
|
|
5923
|
-
isUrlEditable: false,
|
|
5924
|
-
};
|
|
5925
|
-
},
|
|
5926
|
-
urlRepresentation(url, getters) {
|
|
5927
|
-
const sheetId = parseSheetUrl(url);
|
|
5928
|
-
return getters.tryGetSheetName(sheetId) || _t("Invalid sheet");
|
|
5929
|
-
},
|
|
5930
|
-
open(url, env) {
|
|
5931
|
-
const sheetId = parseSheetUrl(url);
|
|
5932
|
-
env.model.dispatch("ACTIVATE_SHEET", {
|
|
5933
|
-
sheetIdFrom: env.model.getters.getActiveSheetId(),
|
|
5934
|
-
sheetIdTo: sheetId,
|
|
5935
|
-
});
|
|
5936
|
-
},
|
|
5937
|
-
sequence: 0,
|
|
5938
|
-
});
|
|
5939
|
-
const WebUrlSpec = {
|
|
5940
|
-
createLink: createWebLink,
|
|
5941
|
-
match: (url) => isWebLink(url),
|
|
5942
|
-
open: (url) => window.open(url, "_blank"),
|
|
5943
|
-
urlRepresentation: (url) => url,
|
|
5944
|
-
sequence: 0,
|
|
5945
|
-
};
|
|
5946
|
-
function findMatchingSpec(url) {
|
|
5947
|
-
return (urlRegistry
|
|
5948
|
-
.getAll()
|
|
5949
|
-
.sort((a, b) => a.sequence - b.sequence)
|
|
5950
|
-
.find((urlType) => urlType.match(url)) || WebUrlSpec);
|
|
5951
|
-
}
|
|
5952
|
-
function urlRepresentation(link, getters) {
|
|
5953
|
-
return findMatchingSpec(link.url).urlRepresentation(link.url, getters);
|
|
5954
|
-
}
|
|
5955
|
-
function openLink(link, env) {
|
|
5956
|
-
findMatchingSpec(link.url).open(link.url, env);
|
|
5957
|
-
}
|
|
5958
|
-
function detectLink(value) {
|
|
5959
|
-
if (typeof value !== "string") {
|
|
5960
|
-
return undefined;
|
|
5961
|
-
}
|
|
5962
|
-
if (isMarkdownLink(value)) {
|
|
5963
|
-
const { label, url } = parseMarkdownLink(value);
|
|
5964
|
-
return findMatchingSpec(url).createLink(url, label);
|
|
5965
|
-
}
|
|
5966
|
-
else if (isWebLink(value)) {
|
|
5967
|
-
return createWebLink(value);
|
|
5968
|
-
}
|
|
5969
|
-
return undefined;
|
|
5970
|
-
}
|
|
5971
|
-
|
|
5972
|
-
function evaluateLiteral(content, localeFormat) {
|
|
5973
|
-
return createEvaluatedCell(parseLiteral(content || "", localeFormat.locale), localeFormat);
|
|
5974
|
-
}
|
|
5975
|
-
function parseLiteral(content, locale) {
|
|
5976
|
-
if (content.startsWith("=")) {
|
|
5977
|
-
throw new Error(`Cannot parse "${content}" because it's not a literal value. It's a formula`);
|
|
5978
|
-
}
|
|
5979
|
-
if (isNumber(content, DEFAULT_LOCALE)) {
|
|
5980
|
-
return toNumber(content, DEFAULT_LOCALE);
|
|
5981
|
-
}
|
|
5982
|
-
else if (isDateTime(content, locale)) {
|
|
5983
|
-
return toNumber(content, locale);
|
|
5984
|
-
}
|
|
5985
|
-
else if (isBoolean(content)) {
|
|
5986
|
-
return content.toUpperCase() === "TRUE" ? true : false;
|
|
5987
|
-
}
|
|
5988
|
-
return content;
|
|
5989
|
-
}
|
|
5990
|
-
function createEvaluatedCell(value, localeFormat) {
|
|
5991
|
-
const link = detectLink(value);
|
|
5992
|
-
if (link) {
|
|
5993
|
-
return {
|
|
5994
|
-
..._createEvaluatedCell(parseLiteral(link.label, localeFormat.locale), {
|
|
5995
|
-
format: localeFormat.format ||
|
|
5996
|
-
detectDateFormat(link.label, localeFormat.locale) ||
|
|
5997
|
-
detectNumberFormat(link.label),
|
|
5998
|
-
locale: localeFormat.locale,
|
|
5999
|
-
}),
|
|
6000
|
-
link,
|
|
6001
|
-
};
|
|
6002
|
-
}
|
|
6003
|
-
return _createEvaluatedCell(value, localeFormat);
|
|
6004
|
-
}
|
|
6005
|
-
function _createEvaluatedCell(value, localeFormat) {
|
|
6006
|
-
try {
|
|
6007
|
-
for (const builder of builders) {
|
|
6008
|
-
const evaluateCell = builder(value, localeFormat);
|
|
6009
|
-
if (evaluateCell) {
|
|
6010
|
-
return evaluateCell;
|
|
6011
|
-
}
|
|
6012
|
-
}
|
|
6013
|
-
return textCell((value || "").toString(), localeFormat);
|
|
6014
|
-
}
|
|
6015
|
-
catch (error) {
|
|
6016
|
-
return errorCell(new EvaluationError(CellErrorType.GenericError, error.message || DEFAULT_ERROR_MESSAGE));
|
|
6017
|
-
}
|
|
6018
|
-
}
|
|
6019
|
-
function textCell(value, localeFormat) {
|
|
6020
|
-
return {
|
|
6021
|
-
type: CellValueType.text,
|
|
6022
|
-
value,
|
|
6023
|
-
format: localeFormat.format,
|
|
6024
|
-
isAutoSummable: true,
|
|
6025
|
-
defaultAlign: "left",
|
|
6026
|
-
formattedValue: formatValue(value, localeFormat),
|
|
6027
|
-
};
|
|
6028
|
-
}
|
|
6029
|
-
function numberCell(value, localeFormat) {
|
|
6030
|
-
return {
|
|
6031
|
-
type: CellValueType.number,
|
|
6032
|
-
value: value || 0, // necessary to avoid "-0" and NaN values,
|
|
6033
|
-
format: localeFormat.format,
|
|
6034
|
-
isAutoSummable: true,
|
|
6035
|
-
defaultAlign: "right",
|
|
6036
|
-
formattedValue: formatValue(value, localeFormat),
|
|
6037
|
-
};
|
|
6038
|
-
}
|
|
6039
|
-
const EMPTY_EVALUATED_CELL = {
|
|
6040
|
-
type: CellValueType.empty,
|
|
6041
|
-
value: "",
|
|
6042
|
-
format: undefined,
|
|
6043
|
-
isAutoSummable: true,
|
|
6044
|
-
defaultAlign: "left",
|
|
6045
|
-
formattedValue: "",
|
|
6046
|
-
};
|
|
6047
|
-
function emptyCell(localeFormat) {
|
|
6048
|
-
if (localeFormat.format === undefined) {
|
|
6049
|
-
// share the same object to save memory
|
|
6050
|
-
return EMPTY_EVALUATED_CELL;
|
|
6051
|
-
}
|
|
6052
|
-
return {
|
|
6053
|
-
type: CellValueType.empty,
|
|
6054
|
-
value: "",
|
|
6055
|
-
format: localeFormat.format,
|
|
6056
|
-
isAutoSummable: true,
|
|
6057
|
-
defaultAlign: "left",
|
|
6058
|
-
formattedValue: "",
|
|
6059
|
-
};
|
|
6060
|
-
}
|
|
6061
|
-
function dateTimeCell(value, localeFormat) {
|
|
6062
|
-
const formattedValue = formatValue(value, localeFormat);
|
|
6063
|
-
return {
|
|
6064
|
-
type: CellValueType.number,
|
|
6065
|
-
value,
|
|
6066
|
-
format: localeFormat.format,
|
|
6067
|
-
isAutoSummable: false,
|
|
6068
|
-
defaultAlign: "right",
|
|
6069
|
-
formattedValue,
|
|
6070
|
-
};
|
|
6071
|
-
}
|
|
6072
|
-
function booleanCell(value, localeFormat) {
|
|
6073
|
-
const formattedValue = value ? "TRUE" : "FALSE";
|
|
6074
|
-
return {
|
|
6075
|
-
type: CellValueType.boolean,
|
|
6076
|
-
value,
|
|
6077
|
-
format: localeFormat.format,
|
|
6078
|
-
isAutoSummable: false,
|
|
6079
|
-
defaultAlign: "center",
|
|
6080
|
-
formattedValue,
|
|
6081
|
-
};
|
|
6082
|
-
}
|
|
6083
|
-
function errorCell(error) {
|
|
6084
|
-
return {
|
|
6085
|
-
type: CellValueType.error,
|
|
6086
|
-
value: error.errorType,
|
|
6087
|
-
error,
|
|
6088
|
-
isAutoSummable: false,
|
|
6089
|
-
defaultAlign: "center",
|
|
6090
|
-
formattedValue: error.errorType,
|
|
6091
|
-
};
|
|
6092
|
-
}
|
|
6093
|
-
const builders = [
|
|
6094
|
-
function createEmpty(value, localeFormat) {
|
|
6095
|
-
if (value === "") {
|
|
6096
|
-
return emptyCell(localeFormat);
|
|
6097
|
-
}
|
|
6098
|
-
return undefined;
|
|
6099
|
-
},
|
|
6100
|
-
function createDateTime(value, localeFormat) {
|
|
6101
|
-
if (!!localeFormat.format &&
|
|
6102
|
-
typeof value === "number" &&
|
|
6103
|
-
isDateTimeFormat(localeFormat.format)) {
|
|
6104
|
-
return dateTimeCell(value, localeFormat);
|
|
6105
|
-
}
|
|
6106
|
-
return undefined;
|
|
6107
|
-
},
|
|
6108
|
-
function createNumber(value, localeFormat) {
|
|
6109
|
-
if (typeof value === "number") {
|
|
6110
|
-
return numberCell(value, localeFormat);
|
|
6111
|
-
}
|
|
6112
|
-
else if (value === null) {
|
|
6113
|
-
return numberCell(0, localeFormat);
|
|
6114
|
-
}
|
|
6115
|
-
return undefined;
|
|
6116
|
-
},
|
|
6117
|
-
function createBoolean(value, localeFormat) {
|
|
6118
|
-
if (typeof value === "boolean") {
|
|
6119
|
-
return booleanCell(value, localeFormat);
|
|
6120
|
-
}
|
|
6121
|
-
return undefined;
|
|
6122
|
-
},
|
|
6123
|
-
];
|
|
6124
|
-
|
|
6125
6136
|
/**
|
|
6126
6137
|
* An AutofillModifierImplementation is used to describe how to handle a
|
|
6127
6138
|
* AutofillModifier.
|
|
@@ -32643,6 +32654,7 @@
|
|
|
32643
32654
|
? V_ALIGNMENT_EXPORT_CONVERSION_MAP[style.verticalAlign]
|
|
32644
32655
|
: undefined,
|
|
32645
32656
|
wrapText: style.wrapping === "wrap" || cell.content?.includes(NEWLINE) ? true : undefined,
|
|
32657
|
+
shrinkToFit: style.wrapping === "clip" ? true : undefined,
|
|
32646
32658
|
},
|
|
32647
32659
|
};
|
|
32648
32660
|
styles.font["strike"] = !!style?.strikethrough || undefined;
|
|
@@ -32669,6 +32681,7 @@
|
|
|
32669
32681
|
vertical: styles.alignment.vertical,
|
|
32670
32682
|
horizontal: styles.alignment.horizontal,
|
|
32671
32683
|
wrapText: styles.alignment.wrapText,
|
|
32684
|
+
shrinkToFit: styles.alignment.shrinkToFit,
|
|
32672
32685
|
},
|
|
32673
32686
|
};
|
|
32674
32687
|
return pushElement(style, construct.styles);
|
|
@@ -36412,7 +36425,7 @@
|
|
|
36412
36425
|
for (const position of positions) {
|
|
36413
36426
|
const cell = this.getters.getCell(position);
|
|
36414
36427
|
const xc = toXC(position.col, position.row);
|
|
36415
|
-
const style = this.
|
|
36428
|
+
const style = this.extractCustomStyle(cell);
|
|
36416
36429
|
cells[xc] = {
|
|
36417
36430
|
style: Object.keys(style).length ? getItemId(style, styles) : undefined,
|
|
36418
36431
|
format: cell.format ? getItemId(cell.format, formats) : undefined,
|
|
@@ -36433,10 +36446,14 @@
|
|
|
36433
36446
|
exportForExcel(data) {
|
|
36434
36447
|
this.export(data);
|
|
36435
36448
|
}
|
|
36436
|
-
|
|
36437
|
-
const cleanedStyle = { ...style };
|
|
36438
|
-
|
|
36439
|
-
|
|
36449
|
+
extractCustomStyle(cell) {
|
|
36450
|
+
const cleanedStyle = { ...cell.style };
|
|
36451
|
+
const defaultStyle = isNumber(cell.content, DEFAULT_LOCALE)
|
|
36452
|
+
? DEFAULT_NUMBER_STYLE
|
|
36453
|
+
: DEFAULT_STYLE;
|
|
36454
|
+
for (const property in cleanedStyle) {
|
|
36455
|
+
if ((property !== "align" || !cell.isFormula) &&
|
|
36456
|
+
cleanedStyle[property] === defaultStyle[property]) {
|
|
36440
36457
|
delete cleanedStyle[property];
|
|
36441
36458
|
}
|
|
36442
36459
|
}
|
|
@@ -43577,6 +43594,7 @@
|
|
|
43577
43594
|
handle(cmd) {
|
|
43578
43595
|
switch (cmd.type) {
|
|
43579
43596
|
case "START":
|
|
43597
|
+
case "UPDATE_LOCALE":
|
|
43580
43598
|
for (const sheetId of this.getters.getSheetIds()) {
|
|
43581
43599
|
this.initializeSheet(sheetId);
|
|
43582
43600
|
}
|
|
@@ -43682,7 +43700,7 @@
|
|
|
43682
43700
|
}
|
|
43683
43701
|
const cell = this.getters.getCell(position);
|
|
43684
43702
|
const colSize = this.getters.getColSize(position.sheetId, position.col);
|
|
43685
|
-
return getDefaultCellHeight(this.ctx, cell, colSize);
|
|
43703
|
+
return getDefaultCellHeight(this.ctx, cell, this.getters.getLocale(), colSize);
|
|
43686
43704
|
}
|
|
43687
43705
|
isInMultiRowMerge(position) {
|
|
43688
43706
|
const merge = this.getters.getMerge(position);
|
|
@@ -57302,6 +57320,9 @@
|
|
|
57302
57320
|
if (style.alignment && style.alignment.wrapText) {
|
|
57303
57321
|
alignAttrs.push(["wrapText", "1"]);
|
|
57304
57322
|
}
|
|
57323
|
+
if (style.alignment && style.alignment.shrinkToFit) {
|
|
57324
|
+
alignAttrs.push(["shrinkToFit", "1"]);
|
|
57325
|
+
}
|
|
57305
57326
|
if (alignAttrs.length > 0) {
|
|
57306
57327
|
attributes.push(["applyAlignment", "1"]); // for Libre Office
|
|
57307
57328
|
styleNodes.push(escapeXml /*xml*/ `<xf ${formatAttributes(attributes)}><alignment ${formatAttributes(alignAttrs)} /></xf> `);
|
|
@@ -58538,9 +58559,9 @@
|
|
|
58538
58559
|
exports.tokenize = tokenize;
|
|
58539
58560
|
|
|
58540
58561
|
|
|
58541
|
-
__info__.version = "17.0.
|
|
58542
|
-
__info__.date = "2026-01-
|
|
58543
|
-
__info__.hash = "
|
|
58562
|
+
__info__.version = "17.0.85";
|
|
58563
|
+
__info__.date = "2026-01-21T11:02:43.920Z";
|
|
58564
|
+
__info__.hash = "0343060";
|
|
58544
58565
|
|
|
58545
58566
|
|
|
58546
58567
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|