ooxml.js 6.0.0 → 6.2.0
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/README.md +32 -23
- package/dist/{build-XSm3I8LT.d.cts → build--uPsivid.d.cts} +1 -1
- package/dist/{build-q0qMH_ML.d.ts → build-BOI7rIog.d.ts} +1 -1
- package/dist/{build-D-ldsmtA.d.cts → build-BY9Mn-4K.d.cts} +1 -1
- package/dist/{build-Z1KRkSEB.d.ts → build-DgBE0bmv.d.ts} +1 -1
- package/dist/{codec-DdrBDJSU.d.cts → codec-BBM1RYx7.d.cts} +19 -19
- package/dist/{codec-CHbouqVZ.d.ts → codec-Cva8QD7-.d.ts} +19 -19
- package/dist/codec.d.cts +1 -1
- package/dist/codec.d.ts +1 -1
- package/dist/{color-fFIKAs-Y.d.cts → color-DLoZOrg3.d.cts} +1 -1
- package/dist/{color-fFIKAs-Y.d.ts → color-DLoZOrg3.d.ts} +1 -1
- package/dist/{compact-f0TfhicN.d.ts → compact-CmOeA2dl.d.ts} +2 -2
- package/dist/{compact-B1qg9oex.d.cts → compact-DMCbYORW.d.cts} +2 -2
- package/dist/compact.d.cts +1 -1
- package/dist/compact.d.ts +1 -1
- package/dist/{content-C79O3esU.d.cts → content-BiYr86lr.d.cts} +1 -1
- package/dist/{content-MEmp_Rlx.d.ts → content-D1pmxaUb.d.ts} +1 -1
- package/dist/{document-tree-BV4sMCXO.d.ts → document-tree-B17XbBOR.d.ts} +2 -2
- package/dist/{document-tree-BSPf6fkr.d.cts → document-tree-CjI-Z4Tp.d.cts} +2 -2
- package/dist/{fragment-B1og_8uA.d.cts → fragment-9dNg-m46.d.cts} +1 -1
- package/dist/{fragment-B1ZV7T5Z.d.ts → fragment-ClgCV_if.d.ts} +1 -1
- package/dist/image/sniff.d.cts +1 -1
- package/dist/image/sniff.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +21 -21
- package/dist/index.d.ts +21 -21
- package/dist/index.js +1 -1
- package/dist/{metadata-o_WH9V_I.d.ts → metadata-Bjfa88HQ.d.ts} +1 -1
- package/dist/{metadata-D6o-kLpg.d.cts → metadata-C74-XCrx.d.cts} +1 -1
- package/dist/model/node.d.cts +1 -1
- package/dist/model/node.d.ts +1 -1
- package/dist/model/package.d.cts +1 -1
- package/dist/model/package.d.ts +1 -1
- package/dist/{node-CkBWRjNR.d.cts → node-B6JX5CRX.d.cts} +1 -1
- package/dist/{node-CkBWRjNR.d.ts → node-B6JX5CRX.d.ts} +1 -1
- package/dist/{numbering-D0YfuiOO.d.ts → numbering-CUMTFxfk.d.ts} +1 -1
- package/dist/{numbering-C53LT-Jx.d.cts → numbering-vpq3iLPm.d.cts} +1 -1
- package/dist/{package-L24lkba-.d.cts → package-DMk9fuTI.d.cts} +1 -1
- package/dist/package-io/read.d.cts +1 -1
- package/dist/package-io/read.d.ts +1 -1
- package/dist/package-io/write.d.cts +1 -1
- package/dist/package-io/write.d.ts +1 -1
- package/dist/{package-BUojjTXf.d.ts → package-otZYrxiO.d.ts} +1 -1
- package/dist/{parse-A8_8sdpX.d.ts → parse-BLukZ2z0.d.ts} +1 -1
- package/dist/{parse-CP5FLZqv.d.cts → parse-DcVtB3jT.d.cts} +1 -1
- package/dist/{read-ZWJPDvG-.d.ts → read-B5kexLpc.d.ts} +1 -1
- package/dist/{read-DPR6ihXO.js → read-BZ_jycSX.js} +3 -1
- package/dist/{read-CevviAf2.d.ts → read-BlcKA9Cg.d.ts} +1 -1
- package/dist/{read-BoV9SZy4.d.cts → read-C1h_Q4kx.d.cts} +1 -1
- package/dist/{read-Cj23Gllx.cjs → read-CXksZHJW.cjs} +3 -1
- package/dist/{read-A9CC5Toq.d.cts → read-D6kQeo-T.d.cts} +1 -1
- package/dist/{read-DA55zDgD.d.ts → read-D_kXw2N2.d.ts} +1 -1
- package/dist/{read-VbRhmjOh.d.cts → read-uKN0paUP.d.cts} +1 -1
- package/dist/{sniff-DjpnUZRp.d.cts → sniff-DGOBHA0O.d.cts} +1 -1
- package/dist/{sniff-DjpnUZRp.d.ts → sniff-DGOBHA0O.d.ts} +1 -1
- package/dist/typed/document-tree.cjs +1 -1
- package/dist/typed/document-tree.d.cts +1 -1
- package/dist/typed/document-tree.d.ts +1 -1
- package/dist/typed/document-tree.js +1 -1
- package/dist/typed/docx/constructs.d.cts +3 -3
- package/dist/typed/docx/constructs.d.ts +3 -3
- package/dist/typed/docx/numbering.d.cts +1 -1
- package/dist/typed/docx/numbering.d.ts +1 -1
- package/dist/typed/docx/read.cjs +1 -1
- package/dist/typed/docx/read.d.cts +1 -1
- package/dist/typed/docx/read.d.ts +1 -1
- package/dist/typed/docx/read.js +1 -1
- package/dist/typed/docx/styles.d.cts +1 -1
- package/dist/typed/docx/styles.d.ts +1 -1
- package/dist/typed/docx/write.d.cts +1 -1
- package/dist/typed/docx/write.d.ts +1 -1
- package/dist/typed/embedded.cjs +1 -1
- package/dist/typed/embedded.d.cts +2 -2
- package/dist/typed/embedded.d.ts +2 -2
- package/dist/typed/embedded.js +1 -1
- package/dist/typed/pptx/chart.d.cts +1 -1
- package/dist/typed/pptx/chart.d.ts +1 -1
- package/dist/typed/pptx/diagram.d.cts +1 -1
- package/dist/typed/pptx/diagram.d.ts +1 -1
- package/dist/typed/pptx/inherit.d.cts +2 -2
- package/dist/typed/pptx/inherit.d.ts +2 -2
- package/dist/typed/pptx/read.cjs +1 -1
- package/dist/typed/pptx/read.d.cts +1 -1
- package/dist/typed/pptx/read.d.ts +1 -1
- package/dist/typed/pptx/read.js +1 -1
- package/dist/typed/shared/color.d.cts +1 -1
- package/dist/typed/shared/color.d.ts +1 -1
- package/dist/typed/shared/drawingml.d.cts +1 -1
- package/dist/typed/shared/drawingml.d.ts +1 -1
- package/dist/typed/shared/metadata.d.cts +1 -1
- package/dist/typed/shared/metadata.d.ts +1 -1
- package/dist/typed/util.d.cts +1 -1
- package/dist/typed/util.d.ts +1 -1
- package/dist/typed/xlsx/build.cjs +12 -4
- package/dist/typed/xlsx/build.d.cts +1 -1
- package/dist/typed/xlsx/build.d.ts +1 -1
- package/dist/typed/xlsx/build.js +12 -4
- package/dist/typed/xlsx/comments.d.cts +1 -1
- package/dist/typed/xlsx/comments.d.ts +1 -1
- package/dist/typed/xlsx/conditional-format.cjs +519 -0
- package/dist/typed/xlsx/conditional-format.d.cts +16 -0
- package/dist/typed/xlsx/conditional-format.d.ts +16 -0
- package/dist/typed/xlsx/conditional-format.js +516 -0
- package/dist/typed/xlsx/content.cjs +11 -7
- package/dist/typed/xlsx/content.d.cts +1 -1
- package/dist/typed/xlsx/content.d.ts +1 -1
- package/dist/typed/xlsx/content.js +12 -8
- package/dist/typed/xlsx/data-validation.cjs +116 -0
- package/dist/typed/xlsx/data-validation.d.cts +11 -0
- package/dist/typed/xlsx/data-validation.d.ts +11 -0
- package/dist/typed/xlsx/data-validation.js +114 -0
- package/dist/typed/xlsx/defined-names.d.cts +1 -1
- package/dist/typed/xlsx/defined-names.d.ts +1 -1
- package/dist/typed/xlsx/definitions.d.cts +1 -1
- package/dist/typed/xlsx/definitions.d.ts +1 -1
- package/dist/typed/xlsx/drawings.d.cts +2 -2
- package/dist/typed/xlsx/drawings.d.ts +2 -2
- package/dist/typed/xlsx/number-format.d.cts +14 -14
- package/dist/typed/xlsx/number-format.d.ts +14 -14
- package/dist/typed/xlsx/print-settings.d.cts +1 -1
- package/dist/typed/xlsx/print-settings.d.ts +1 -1
- package/dist/typed/xlsx/rule-residue.cjs +29 -0
- package/dist/typed/xlsx/rule-residue.d.cts +7 -0
- package/dist/typed/xlsx/rule-residue.d.ts +7 -0
- package/dist/typed/xlsx/rule-residue.js +27 -0
- package/dist/typed/xlsx/serial.d.cts +1 -1
- package/dist/typed/xlsx/serial.d.ts +1 -1
- package/dist/typed/xlsx/shared-strings.d.cts +1 -1
- package/dist/typed/xlsx/shared-strings.d.ts +1 -1
- package/dist/typed/xlsx/sqref.cjs +24 -0
- package/dist/typed/xlsx/sqref.d.cts +7 -0
- package/dist/typed/xlsx/sqref.d.ts +7 -0
- package/dist/typed/xlsx/sqref.js +21 -0
- package/dist/typed/xlsx/styles.cjs +14 -2
- package/dist/typed/xlsx/styles.d.cts +10 -6
- package/dist/typed/xlsx/styles.d.ts +10 -6
- package/dist/typed/xlsx/styles.js +12 -3
- package/dist/typed/xlsx.d.cts +1 -1
- package/dist/typed/xlsx.d.ts +1 -1
- package/dist/util/base64.cjs +4 -4
- package/dist/util/base64.js +4 -4
- package/dist/{util-DFe4UbvU.d.ts → util-DKrYuajM.d.ts} +2 -2
- package/dist/{util-M3JJlDhF.d.cts → util-xRsVgH-g.d.cts} +2 -2
- package/dist/{write-Dn_CL8qb.d.cts → write-BGTpp3RS.d.cts} +3 -3
- package/dist/{write-6JmxvaK5.d.cts → write-Ba1IxfDT.d.cts} +1 -1
- package/dist/{write-CT-EgVT7.d.ts → write-C4902scQ.d.ts} +1 -1
- package/dist/{write-inqdKHR3.d.ts → write-Cnfu3zdB.d.ts} +3 -3
- package/dist/{xlsx-DacFqZeF.d.ts → xlsx-B3JGnx0l.d.ts} +1 -1
- package/dist/{xlsx-CpX5nzGV.d.cts → xlsx-DCgJ8IbV.d.cts} +1 -1
- package/dist/xml/build.d.cts +1 -1
- package/dist/xml/build.d.ts +1 -1
- package/dist/xml/fragment.d.cts +1 -1
- package/dist/xml/fragment.d.ts +1 -1
- package/dist/xml/parse.d.cts +1 -1
- package/dist/xml/parse.d.ts +1 -1
- package/package.json +3 -11
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_xml_fragment = require("../../xml/fragment.cjs");
|
|
3
|
+
const require_xml_entities = require("../../xml/entities.cjs");
|
|
4
|
+
const require_typed_util = require("../util.cjs");
|
|
5
|
+
const require_typed_xlsx_util = require("./util.cjs");
|
|
6
|
+
const require_typed_xlsx_rule_residue = require("./rule-residue.cjs");
|
|
7
|
+
const require_typed_xlsx_sqref = require("./sqref.cjs");
|
|
8
|
+
//#region src/typed/xlsx/data-validation.ts
|
|
9
|
+
const DATA_VALIDATION_TYPES = /* @__PURE__ */ new Set([
|
|
10
|
+
"whole",
|
|
11
|
+
"decimal",
|
|
12
|
+
"list",
|
|
13
|
+
"date",
|
|
14
|
+
"time",
|
|
15
|
+
"textLength",
|
|
16
|
+
"custom"
|
|
17
|
+
]);
|
|
18
|
+
function isDataValidationType(value) {
|
|
19
|
+
return value !== void 0 && DATA_VALIDATION_TYPES.has(value);
|
|
20
|
+
}
|
|
21
|
+
function isSheetRuleOperator(value) {
|
|
22
|
+
return value === "between" || value === "notBetween" || value === "equal" || value === "notEqual" || value === "greaterThan" || value === "greaterThanOrEqual" || value === "lessThan" || value === "lessThanOrEqual";
|
|
23
|
+
}
|
|
24
|
+
const TYPES_WITHOUT_OPERATOR = /* @__PURE__ */ new Set(["list", "custom"]);
|
|
25
|
+
const MANAGED_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
26
|
+
"type",
|
|
27
|
+
"errorStyle",
|
|
28
|
+
"operator",
|
|
29
|
+
"allowBlank",
|
|
30
|
+
"showInputMessage",
|
|
31
|
+
"showErrorMessage",
|
|
32
|
+
"promptTitle",
|
|
33
|
+
"prompt",
|
|
34
|
+
"errorTitle",
|
|
35
|
+
"error",
|
|
36
|
+
"sqref"
|
|
37
|
+
]);
|
|
38
|
+
function readDataValidations(worksheet) {
|
|
39
|
+
const validations = [];
|
|
40
|
+
const residueElements = [];
|
|
41
|
+
for (const container of require_typed_util.childrenWithTag(worksheet, "dataValidations")) for (const element of require_typed_util.childrenWithTag(container, "dataValidation")) {
|
|
42
|
+
const promoted = readDataValidation(element);
|
|
43
|
+
if (promoted === void 0) {
|
|
44
|
+
residueElements.push(element);
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
validations.push(promoted);
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
validations,
|
|
51
|
+
residueElements
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function readFormulaChild(element, tag) {
|
|
55
|
+
const child = require_typed_util.childrenWithTag(element, tag)[0];
|
|
56
|
+
return child === void 0 ? void 0 : require_typed_util.textContent(child);
|
|
57
|
+
}
|
|
58
|
+
function readDataValidation(element) {
|
|
59
|
+
const typeRaw = require_typed_util.attr(element, "type");
|
|
60
|
+
if (!isDataValidationType(typeRaw)) return;
|
|
61
|
+
const ranges = require_typed_xlsx_sqref.parseSqref(require_typed_util.attr(element, "sqref"));
|
|
62
|
+
if (ranges.length === 0) return;
|
|
63
|
+
const operatorRaw = require_typed_util.attr(element, "operator");
|
|
64
|
+
const operator = !TYPES_WITHOUT_OPERATOR.has(typeRaw) && isSheetRuleOperator(operatorRaw) ? operatorRaw : void 0;
|
|
65
|
+
const formula1 = readFormulaChild(element, "formula1");
|
|
66
|
+
const formula2 = operator === "between" || operator === "notBetween" ? readFormulaChild(element, "formula2") : void 0;
|
|
67
|
+
const promptTitle = require_typed_util.attr(element, "promptTitle");
|
|
68
|
+
const prompt = require_typed_util.attr(element, "prompt");
|
|
69
|
+
const errorTitle = require_typed_util.attr(element, "errorTitle");
|
|
70
|
+
const error = require_typed_util.attr(element, "error");
|
|
71
|
+
const errorStyleRaw = require_typed_util.attr(element, "errorStyle");
|
|
72
|
+
const errorStyle = errorStyleRaw === "warning" || errorStyleRaw === "information" ? errorStyleRaw : void 0;
|
|
73
|
+
const source = require_typed_xlsx_rule_residue.captureResidualAttributes(element, MANAGED_ATTRIBUTES);
|
|
74
|
+
return {
|
|
75
|
+
ranges,
|
|
76
|
+
type: typeRaw,
|
|
77
|
+
...operator === void 0 ? {} : { operator },
|
|
78
|
+
...formula1 === void 0 ? {} : { formula1 },
|
|
79
|
+
...formula2 === void 0 ? {} : { formula2 },
|
|
80
|
+
...require_typed_xlsx_util.readXmlBool(require_typed_util.attr(element, "allowBlank")) ? { allowBlank: true } : {},
|
|
81
|
+
...require_typed_xlsx_util.readXmlBool(require_typed_util.attr(element, "showInputMessage")) ? { showInputMessage: true } : {},
|
|
82
|
+
...promptTitle === void 0 ? {} : { promptTitle: require_typed_util.decodeEntities(promptTitle) },
|
|
83
|
+
...prompt === void 0 ? {} : { prompt: require_typed_util.decodeEntities(prompt) },
|
|
84
|
+
...require_typed_xlsx_util.readXmlBool(require_typed_util.attr(element, "showErrorMessage")) ? { showErrorMessage: true } : {},
|
|
85
|
+
...errorStyle === void 0 ? {} : { errorStyle },
|
|
86
|
+
...errorTitle === void 0 ? {} : { errorTitle: require_typed_util.decodeEntities(errorTitle) },
|
|
87
|
+
...error === void 0 ? {} : { error: require_typed_util.decodeEntities(error) },
|
|
88
|
+
...source === void 0 ? {} : { source }
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function buildDataValidationsElement(validations) {
|
|
92
|
+
if (validations.length === 0) return;
|
|
93
|
+
const elements = validations.map(buildDataValidationElement);
|
|
94
|
+
return require_xml_fragment.el("dataValidations", { count: String(elements.length) }, elements);
|
|
95
|
+
}
|
|
96
|
+
function buildDataValidationElement(validation) {
|
|
97
|
+
const attrs = require_typed_xlsx_rule_residue.residualAttributesFor(validation.source, "dataValidation");
|
|
98
|
+
attrs.type = validation.type;
|
|
99
|
+
attrs.sqref = require_typed_xlsx_sqref.formatSqref(validation.ranges);
|
|
100
|
+
if (validation.operator !== void 0) attrs.operator = validation.operator;
|
|
101
|
+
attrs.allowBlank = require_typed_xlsx_util.writeXmlBool(validation.allowBlank === true);
|
|
102
|
+
attrs.showInputMessage = require_typed_xlsx_util.writeXmlBool(validation.showInputMessage === true);
|
|
103
|
+
attrs.showErrorMessage = require_typed_xlsx_util.writeXmlBool(validation.showErrorMessage === true);
|
|
104
|
+
attrs.errorStyle = validation.errorStyle ?? "stop";
|
|
105
|
+
if (validation.promptTitle !== void 0) attrs.promptTitle = require_xml_entities.encodeXmlText(validation.promptTitle);
|
|
106
|
+
if (validation.prompt !== void 0) attrs.prompt = require_xml_entities.encodeXmlText(validation.prompt);
|
|
107
|
+
if (validation.errorTitle !== void 0) attrs.errorTitle = require_xml_entities.encodeXmlText(validation.errorTitle);
|
|
108
|
+
if (validation.error !== void 0) attrs.error = require_xml_entities.encodeXmlText(validation.error);
|
|
109
|
+
const children = [];
|
|
110
|
+
if (validation.formula1 !== void 0) children.push(require_xml_fragment.el("formula1", {}, [require_xml_fragment.txt(require_xml_entities.encodeXmlText(validation.formula1))]));
|
|
111
|
+
if (validation.formula2 !== void 0) children.push(require_xml_fragment.el("formula2", {}, [require_xml_fragment.txt(require_xml_entities.encodeXmlText(validation.formula2))]));
|
|
112
|
+
return require_xml_fragment.el("dataValidation", attrs, children);
|
|
113
|
+
}
|
|
114
|
+
//#endregion
|
|
115
|
+
exports.buildDataValidationsElement = buildDataValidationsElement;
|
|
116
|
+
exports.readDataValidations = readDataValidations;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { l as XmlElement } from "../../node-B6JX5CRX.cjs";
|
|
2
|
+
import { ContentSheetDataValidation } from "document-schema.js";
|
|
3
|
+
//#region src/typed/xlsx/data-validation.d.ts
|
|
4
|
+
interface DataValidationReadResult {
|
|
5
|
+
validations: ContentSheetDataValidation[];
|
|
6
|
+
residueElements: XmlElement[];
|
|
7
|
+
}
|
|
8
|
+
declare function readDataValidations(worksheet: XmlElement): DataValidationReadResult;
|
|
9
|
+
declare function buildDataValidationsElement(validations: readonly ContentSheetDataValidation[]): XmlElement | undefined;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { DataValidationReadResult, buildDataValidationsElement, readDataValidations };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { l as XmlElement } from "../../node-B6JX5CRX.js";
|
|
2
|
+
import { ContentSheetDataValidation } from "document-schema.js";
|
|
3
|
+
//#region src/typed/xlsx/data-validation.d.ts
|
|
4
|
+
interface DataValidationReadResult {
|
|
5
|
+
validations: ContentSheetDataValidation[];
|
|
6
|
+
residueElements: XmlElement[];
|
|
7
|
+
}
|
|
8
|
+
declare function readDataValidations(worksheet: XmlElement): DataValidationReadResult;
|
|
9
|
+
declare function buildDataValidationsElement(validations: readonly ContentSheetDataValidation[]): XmlElement | undefined;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { DataValidationReadResult, buildDataValidationsElement, readDataValidations };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { el, txt } from "../../xml/fragment.js";
|
|
2
|
+
import { encodeXmlText } from "../../xml/entities.js";
|
|
3
|
+
import { attr, childrenWithTag, decodeEntities, textContent } from "../util.js";
|
|
4
|
+
import { readXmlBool, writeXmlBool } from "./util.js";
|
|
5
|
+
import { captureResidualAttributes, residualAttributesFor } from "./rule-residue.js";
|
|
6
|
+
import { formatSqref, parseSqref } from "./sqref.js";
|
|
7
|
+
//#region src/typed/xlsx/data-validation.ts
|
|
8
|
+
const DATA_VALIDATION_TYPES = /* @__PURE__ */ new Set([
|
|
9
|
+
"whole",
|
|
10
|
+
"decimal",
|
|
11
|
+
"list",
|
|
12
|
+
"date",
|
|
13
|
+
"time",
|
|
14
|
+
"textLength",
|
|
15
|
+
"custom"
|
|
16
|
+
]);
|
|
17
|
+
function isDataValidationType(value) {
|
|
18
|
+
return value !== void 0 && DATA_VALIDATION_TYPES.has(value);
|
|
19
|
+
}
|
|
20
|
+
function isSheetRuleOperator(value) {
|
|
21
|
+
return value === "between" || value === "notBetween" || value === "equal" || value === "notEqual" || value === "greaterThan" || value === "greaterThanOrEqual" || value === "lessThan" || value === "lessThanOrEqual";
|
|
22
|
+
}
|
|
23
|
+
const TYPES_WITHOUT_OPERATOR = /* @__PURE__ */ new Set(["list", "custom"]);
|
|
24
|
+
const MANAGED_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
25
|
+
"type",
|
|
26
|
+
"errorStyle",
|
|
27
|
+
"operator",
|
|
28
|
+
"allowBlank",
|
|
29
|
+
"showInputMessage",
|
|
30
|
+
"showErrorMessage",
|
|
31
|
+
"promptTitle",
|
|
32
|
+
"prompt",
|
|
33
|
+
"errorTitle",
|
|
34
|
+
"error",
|
|
35
|
+
"sqref"
|
|
36
|
+
]);
|
|
37
|
+
function readDataValidations(worksheet) {
|
|
38
|
+
const validations = [];
|
|
39
|
+
const residueElements = [];
|
|
40
|
+
for (const container of childrenWithTag(worksheet, "dataValidations")) for (const element of childrenWithTag(container, "dataValidation")) {
|
|
41
|
+
const promoted = readDataValidation(element);
|
|
42
|
+
if (promoted === void 0) {
|
|
43
|
+
residueElements.push(element);
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
validations.push(promoted);
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
validations,
|
|
50
|
+
residueElements
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function readFormulaChild(element, tag) {
|
|
54
|
+
const child = childrenWithTag(element, tag)[0];
|
|
55
|
+
return child === void 0 ? void 0 : textContent(child);
|
|
56
|
+
}
|
|
57
|
+
function readDataValidation(element) {
|
|
58
|
+
const typeRaw = attr(element, "type");
|
|
59
|
+
if (!isDataValidationType(typeRaw)) return;
|
|
60
|
+
const ranges = parseSqref(attr(element, "sqref"));
|
|
61
|
+
if (ranges.length === 0) return;
|
|
62
|
+
const operatorRaw = attr(element, "operator");
|
|
63
|
+
const operator = !TYPES_WITHOUT_OPERATOR.has(typeRaw) && isSheetRuleOperator(operatorRaw) ? operatorRaw : void 0;
|
|
64
|
+
const formula1 = readFormulaChild(element, "formula1");
|
|
65
|
+
const formula2 = operator === "between" || operator === "notBetween" ? readFormulaChild(element, "formula2") : void 0;
|
|
66
|
+
const promptTitle = attr(element, "promptTitle");
|
|
67
|
+
const prompt = attr(element, "prompt");
|
|
68
|
+
const errorTitle = attr(element, "errorTitle");
|
|
69
|
+
const error = attr(element, "error");
|
|
70
|
+
const errorStyleRaw = attr(element, "errorStyle");
|
|
71
|
+
const errorStyle = errorStyleRaw === "warning" || errorStyleRaw === "information" ? errorStyleRaw : void 0;
|
|
72
|
+
const source = captureResidualAttributes(element, MANAGED_ATTRIBUTES);
|
|
73
|
+
return {
|
|
74
|
+
ranges,
|
|
75
|
+
type: typeRaw,
|
|
76
|
+
...operator === void 0 ? {} : { operator },
|
|
77
|
+
...formula1 === void 0 ? {} : { formula1 },
|
|
78
|
+
...formula2 === void 0 ? {} : { formula2 },
|
|
79
|
+
...readXmlBool(attr(element, "allowBlank")) ? { allowBlank: true } : {},
|
|
80
|
+
...readXmlBool(attr(element, "showInputMessage")) ? { showInputMessage: true } : {},
|
|
81
|
+
...promptTitle === void 0 ? {} : { promptTitle: decodeEntities(promptTitle) },
|
|
82
|
+
...prompt === void 0 ? {} : { prompt: decodeEntities(prompt) },
|
|
83
|
+
...readXmlBool(attr(element, "showErrorMessage")) ? { showErrorMessage: true } : {},
|
|
84
|
+
...errorStyle === void 0 ? {} : { errorStyle },
|
|
85
|
+
...errorTitle === void 0 ? {} : { errorTitle: decodeEntities(errorTitle) },
|
|
86
|
+
...error === void 0 ? {} : { error: decodeEntities(error) },
|
|
87
|
+
...source === void 0 ? {} : { source }
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function buildDataValidationsElement(validations) {
|
|
91
|
+
if (validations.length === 0) return;
|
|
92
|
+
const elements = validations.map(buildDataValidationElement);
|
|
93
|
+
return el("dataValidations", { count: String(elements.length) }, elements);
|
|
94
|
+
}
|
|
95
|
+
function buildDataValidationElement(validation) {
|
|
96
|
+
const attrs = residualAttributesFor(validation.source, "dataValidation");
|
|
97
|
+
attrs.type = validation.type;
|
|
98
|
+
attrs.sqref = formatSqref(validation.ranges);
|
|
99
|
+
if (validation.operator !== void 0) attrs.operator = validation.operator;
|
|
100
|
+
attrs.allowBlank = writeXmlBool(validation.allowBlank === true);
|
|
101
|
+
attrs.showInputMessage = writeXmlBool(validation.showInputMessage === true);
|
|
102
|
+
attrs.showErrorMessage = writeXmlBool(validation.showErrorMessage === true);
|
|
103
|
+
attrs.errorStyle = validation.errorStyle ?? "stop";
|
|
104
|
+
if (validation.promptTitle !== void 0) attrs.promptTitle = encodeXmlText(validation.promptTitle);
|
|
105
|
+
if (validation.prompt !== void 0) attrs.prompt = encodeXmlText(validation.prompt);
|
|
106
|
+
if (validation.errorTitle !== void 0) attrs.errorTitle = encodeXmlText(validation.errorTitle);
|
|
107
|
+
if (validation.error !== void 0) attrs.error = encodeXmlText(validation.error);
|
|
108
|
+
const children = [];
|
|
109
|
+
if (validation.formula1 !== void 0) children.push(el("formula1", {}, [txt(encodeXmlText(validation.formula1))]));
|
|
110
|
+
if (validation.formula2 !== void 0) children.push(el("formula2", {}, [txt(encodeXmlText(validation.formula2))]));
|
|
111
|
+
return el("dataValidation", attrs, children);
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { buildDataValidationsElement, readDataValidations };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as Package } from "../../package-
|
|
1
|
+
import { r as Package } from "../../package-DMk9fuTI.cjs";
|
|
2
2
|
import { ContentSheetPrintRange, ContentSheetRepeatRange } from "document-schema.js";
|
|
3
3
|
//#region src/typed/xlsx/defined-names.d.ts
|
|
4
4
|
interface SheetDefinedNames {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as Package } from "../../package-
|
|
1
|
+
import { r as Package } from "../../package-otZYrxiO.js";
|
|
2
2
|
import { ContentSheetPrintRange, ContentSheetRepeatRange } from "document-schema.js";
|
|
3
3
|
//#region src/typed/xlsx/defined-names.d.ts
|
|
4
4
|
interface SheetDefinedNames {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as Package } from "../../package-
|
|
1
|
+
import { r as Package } from "../../package-DMk9fuTI.cjs";
|
|
2
2
|
import { DefinitionsTable } from "document-schema.js";
|
|
3
3
|
//#region src/typed/xlsx/definitions.d.ts
|
|
4
4
|
declare function readWorkbookDefinitions(pkg: Package): DefinitionsTable | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as Package } from "../../package-
|
|
1
|
+
import { r as Package } from "../../package-otZYrxiO.js";
|
|
2
2
|
import { DefinitionsTable } from "document-schema.js";
|
|
3
3
|
//#region src/typed/xlsx/definitions.d.ts
|
|
4
4
|
declare function readWorkbookDefinitions(pkg: Package): DefinitionsTable | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as XmlElement } from "../../node-
|
|
2
|
-
import { r as Package } from "../../package-
|
|
1
|
+
import { l as XmlElement } from "../../node-B6JX5CRX.cjs";
|
|
2
|
+
import { r as Package } from "../../package-DMk9fuTI.cjs";
|
|
3
3
|
import { ContentEmbeddedObject, ContentSheetImage } from "document-schema.js";
|
|
4
4
|
//#region src/typed/xlsx/drawings.d.ts
|
|
5
5
|
interface SheetDrawing {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as XmlElement } from "../../node-
|
|
2
|
-
import { r as Package } from "../../package-
|
|
1
|
+
import { l as XmlElement } from "../../node-B6JX5CRX.js";
|
|
2
|
+
import { r as Package } from "../../package-otZYrxiO.js";
|
|
3
3
|
import { ContentEmbeddedObject, ContentSheetImage } from "document-schema.js";
|
|
4
4
|
//#region src/typed/xlsx/drawings.d.ts
|
|
5
5
|
interface SheetDrawing {
|
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
//#region src/typed/xlsx/number-format.d.ts
|
|
2
2
|
type NumberFormatToken = {
|
|
3
|
-
kind:
|
|
3
|
+
kind: "literal";
|
|
4
4
|
text: string;
|
|
5
5
|
} | {
|
|
6
|
-
kind:
|
|
6
|
+
kind: "bracket";
|
|
7
7
|
body: string;
|
|
8
8
|
} | {
|
|
9
|
-
kind:
|
|
9
|
+
kind: "separator";
|
|
10
10
|
} | {
|
|
11
|
-
kind:
|
|
11
|
+
kind: "code";
|
|
12
12
|
char: string;
|
|
13
13
|
};
|
|
14
14
|
declare const MAX_NUMBER_FORMAT_SECTIONS = 4;
|
|
15
15
|
declare function tokenizeNumberFormat(formatCode: string): NumberFormatToken[];
|
|
16
16
|
declare function splitNumberFormatSections(tokens: readonly NumberFormatToken[]): NumberFormatToken[][];
|
|
17
17
|
type NumberFormatClass = {
|
|
18
|
-
kind:
|
|
18
|
+
kind: "number";
|
|
19
19
|
} | {
|
|
20
|
-
kind:
|
|
20
|
+
kind: "text";
|
|
21
21
|
} | {
|
|
22
|
-
kind:
|
|
22
|
+
kind: "percentage";
|
|
23
23
|
} | {
|
|
24
|
-
kind:
|
|
24
|
+
kind: "currency";
|
|
25
25
|
code?: string;
|
|
26
26
|
} | {
|
|
27
|
-
kind:
|
|
27
|
+
kind: "date";
|
|
28
28
|
} | {
|
|
29
|
-
kind:
|
|
29
|
+
kind: "time";
|
|
30
30
|
} | {
|
|
31
|
-
kind:
|
|
31
|
+
kind: "dateTime";
|
|
32
32
|
} | {
|
|
33
|
-
kind:
|
|
33
|
+
kind: "elapsedTime";
|
|
34
34
|
};
|
|
35
35
|
declare function classifyNumberFormat(formatCode: string): NumberFormatClass;
|
|
36
36
|
declare const BUILTIN_NUMBER_FORMATS: ReadonlyMap<number, string>;
|
|
37
37
|
type CellNumberFormat = {
|
|
38
|
-
kind:
|
|
38
|
+
kind: "builtin";
|
|
39
39
|
id: number;
|
|
40
40
|
} | {
|
|
41
|
-
kind:
|
|
41
|
+
kind: "custom";
|
|
42
42
|
code: string;
|
|
43
43
|
};
|
|
44
44
|
declare const PERCENTAGE_NUMBER_FORMAT: CellNumberFormat;
|
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
//#region src/typed/xlsx/number-format.d.ts
|
|
2
2
|
type NumberFormatToken = {
|
|
3
|
-
kind:
|
|
3
|
+
kind: "literal";
|
|
4
4
|
text: string;
|
|
5
5
|
} | {
|
|
6
|
-
kind:
|
|
6
|
+
kind: "bracket";
|
|
7
7
|
body: string;
|
|
8
8
|
} | {
|
|
9
|
-
kind:
|
|
9
|
+
kind: "separator";
|
|
10
10
|
} | {
|
|
11
|
-
kind:
|
|
11
|
+
kind: "code";
|
|
12
12
|
char: string;
|
|
13
13
|
};
|
|
14
14
|
declare const MAX_NUMBER_FORMAT_SECTIONS = 4;
|
|
15
15
|
declare function tokenizeNumberFormat(formatCode: string): NumberFormatToken[];
|
|
16
16
|
declare function splitNumberFormatSections(tokens: readonly NumberFormatToken[]): NumberFormatToken[][];
|
|
17
17
|
type NumberFormatClass = {
|
|
18
|
-
kind:
|
|
18
|
+
kind: "number";
|
|
19
19
|
} | {
|
|
20
|
-
kind:
|
|
20
|
+
kind: "text";
|
|
21
21
|
} | {
|
|
22
|
-
kind:
|
|
22
|
+
kind: "percentage";
|
|
23
23
|
} | {
|
|
24
|
-
kind:
|
|
24
|
+
kind: "currency";
|
|
25
25
|
code?: string;
|
|
26
26
|
} | {
|
|
27
|
-
kind:
|
|
27
|
+
kind: "date";
|
|
28
28
|
} | {
|
|
29
|
-
kind:
|
|
29
|
+
kind: "time";
|
|
30
30
|
} | {
|
|
31
|
-
kind:
|
|
31
|
+
kind: "dateTime";
|
|
32
32
|
} | {
|
|
33
|
-
kind:
|
|
33
|
+
kind: "elapsedTime";
|
|
34
34
|
};
|
|
35
35
|
declare function classifyNumberFormat(formatCode: string): NumberFormatClass;
|
|
36
36
|
declare const BUILTIN_NUMBER_FORMATS: ReadonlyMap<number, string>;
|
|
37
37
|
type CellNumberFormat = {
|
|
38
|
-
kind:
|
|
38
|
+
kind: "builtin";
|
|
39
39
|
id: number;
|
|
40
40
|
} | {
|
|
41
|
-
kind:
|
|
41
|
+
kind: "custom";
|
|
42
42
|
code: string;
|
|
43
43
|
};
|
|
44
44
|
declare const PERCENTAGE_NUMBER_FORMAT: CellNumberFormat;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as XmlElement } from "../../node-
|
|
1
|
+
import { l as XmlElement } from "../../node-B6JX5CRX.cjs";
|
|
2
2
|
import { SheetDefinedNames } from "./defined-names.cjs";
|
|
3
3
|
import { ContentSheetPrintSettings } from "document-schema.js";
|
|
4
4
|
//#region src/typed/xlsx/print-settings.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as XmlElement } from "../../node-
|
|
1
|
+
import { l as XmlElement } from "../../node-B6JX5CRX.js";
|
|
2
2
|
import { SheetDefinedNames } from "./defined-names.js";
|
|
3
3
|
import { ContentSheetPrintSettings } from "document-schema.js";
|
|
4
4
|
//#region src/typed/xlsx/print-settings.d.ts
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_xml_parse = require("../../xml/parse.cjs");
|
|
3
|
+
const require_xml_build = require("../../xml/build.cjs");
|
|
4
|
+
//#region src/typed/xlsx/rule-residue.ts
|
|
5
|
+
function captureResidualAttributes(element, managed) {
|
|
6
|
+
const residual = element.attributes.filter((attribute) => !managed.has(attribute.name));
|
|
7
|
+
if (residual.length === 0) return;
|
|
8
|
+
return {
|
|
9
|
+
format: "xlsx",
|
|
10
|
+
xml: require_xml_build.buildXml([{
|
|
11
|
+
type: "element",
|
|
12
|
+
tag: element.tag,
|
|
13
|
+
attributes: residual,
|
|
14
|
+
children: []
|
|
15
|
+
}])
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function residualAttributesFor(source, expectedTag) {
|
|
19
|
+
if (source?.format !== "xlsx") return {};
|
|
20
|
+
const nodes = require_xml_parse.parseXml(source.xml);
|
|
21
|
+
const first = nodes[0];
|
|
22
|
+
if (nodes.length !== 1 || first?.type !== "element" || first.tag !== expectedTag) return {};
|
|
23
|
+
const result = {};
|
|
24
|
+
for (const attribute of first.attributes) result[attribute.name] = attribute.value;
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.captureResidualAttributes = captureResidualAttributes;
|
|
29
|
+
exports.residualAttributesFor = residualAttributesFor;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { l as XmlElement } from "../../node-B6JX5CRX.cjs";
|
|
2
|
+
import { SourceResidue } from "document-schema.js";
|
|
3
|
+
//#region src/typed/xlsx/rule-residue.d.ts
|
|
4
|
+
declare function captureResidualAttributes(element: XmlElement, managed: ReadonlySet<string>): SourceResidue | undefined;
|
|
5
|
+
declare function residualAttributesFor(source: SourceResidue | undefined, expectedTag: string): Record<string, string>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { captureResidualAttributes, residualAttributesFor };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { l as XmlElement } from "../../node-B6JX5CRX.js";
|
|
2
|
+
import { SourceResidue } from "document-schema.js";
|
|
3
|
+
//#region src/typed/xlsx/rule-residue.d.ts
|
|
4
|
+
declare function captureResidualAttributes(element: XmlElement, managed: ReadonlySet<string>): SourceResidue | undefined;
|
|
5
|
+
declare function residualAttributesFor(source: SourceResidue | undefined, expectedTag: string): Record<string, string>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { captureResidualAttributes, residualAttributesFor };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { parseXml } from "../../xml/parse.js";
|
|
2
|
+
import { buildXml } from "../../xml/build.js";
|
|
3
|
+
//#region src/typed/xlsx/rule-residue.ts
|
|
4
|
+
function captureResidualAttributes(element, managed) {
|
|
5
|
+
const residual = element.attributes.filter((attribute) => !managed.has(attribute.name));
|
|
6
|
+
if (residual.length === 0) return;
|
|
7
|
+
return {
|
|
8
|
+
format: "xlsx",
|
|
9
|
+
xml: buildXml([{
|
|
10
|
+
type: "element",
|
|
11
|
+
tag: element.tag,
|
|
12
|
+
attributes: residual,
|
|
13
|
+
children: []
|
|
14
|
+
}])
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function residualAttributesFor(source, expectedTag) {
|
|
18
|
+
if (source?.format !== "xlsx") return {};
|
|
19
|
+
const nodes = parseXml(source.xml);
|
|
20
|
+
const first = nodes[0];
|
|
21
|
+
if (nodes.length !== 1 || first?.type !== "element" || first.tag !== expectedTag) return {};
|
|
22
|
+
const result = {};
|
|
23
|
+
for (const attribute of first.attributes) result[attribute.name] = attribute.value;
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { captureResidualAttributes, residualAttributesFor };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as Package } from "../../package-
|
|
1
|
+
import { r as Package } from "../../package-DMk9fuTI.cjs";
|
|
2
2
|
//#region src/typed/xlsx/serial.d.ts
|
|
3
3
|
declare function readDate1904(pkg: Package): boolean;
|
|
4
4
|
declare function serialToIsoDate(serial: number, date1904: boolean): string | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as Package } from "../../package-
|
|
1
|
+
import { r as Package } from "../../package-otZYrxiO.js";
|
|
2
2
|
//#region src/typed/xlsx/serial.d.ts
|
|
3
3
|
declare function readDate1904(pkg: Package): boolean;
|
|
4
4
|
declare function serialToIsoDate(serial: number, date1904: boolean): string | undefined;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let document_schema_js = require("document-schema.js");
|
|
3
|
+
//#region src/typed/xlsx/sqref.ts
|
|
4
|
+
function parseSqref(sqref) {
|
|
5
|
+
if (sqref === void 0) return [];
|
|
6
|
+
const ranges = [];
|
|
7
|
+
for (const token of sqref.split(/\s+/)) {
|
|
8
|
+
if (token === "") continue;
|
|
9
|
+
const range = (0, document_schema_js.parseRangeReference)(token);
|
|
10
|
+
if (range !== void 0) ranges.push(range);
|
|
11
|
+
}
|
|
12
|
+
return ranges;
|
|
13
|
+
}
|
|
14
|
+
function formatSqrefRange(range) {
|
|
15
|
+
if (range.startRow === range.endRow && range.startColumn === range.endColumn) return (0, document_schema_js.cellReference)(range.startRow, range.startColumn);
|
|
16
|
+
return (0, document_schema_js.rangeReference)(range);
|
|
17
|
+
}
|
|
18
|
+
function formatSqref(ranges) {
|
|
19
|
+
return ranges.map(formatSqrefRange).join(" ");
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.formatSqref = formatSqref;
|
|
23
|
+
exports.formatSqrefRange = formatSqrefRange;
|
|
24
|
+
exports.parseSqref = parseSqref;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ContentSheetRange } from "document-schema.js";
|
|
2
|
+
//#region src/typed/xlsx/sqref.d.ts
|
|
3
|
+
declare function parseSqref(sqref: string | undefined): ContentSheetRange[];
|
|
4
|
+
declare function formatSqrefRange(range: ContentSheetRange): string;
|
|
5
|
+
declare function formatSqref(ranges: readonly ContentSheetRange[]): string;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { formatSqref, formatSqrefRange, parseSqref };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ContentSheetRange } from "document-schema.js";
|
|
2
|
+
//#region src/typed/xlsx/sqref.d.ts
|
|
3
|
+
declare function parseSqref(sqref: string | undefined): ContentSheetRange[];
|
|
4
|
+
declare function formatSqrefRange(range: ContentSheetRange): string;
|
|
5
|
+
declare function formatSqref(ranges: readonly ContentSheetRange[]): string;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { formatSqref, formatSqrefRange, parseSqref };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { cellReference, parseRangeReference, rangeReference } from "document-schema.js";
|
|
2
|
+
//#region src/typed/xlsx/sqref.ts
|
|
3
|
+
function parseSqref(sqref) {
|
|
4
|
+
if (sqref === void 0) return [];
|
|
5
|
+
const ranges = [];
|
|
6
|
+
for (const token of sqref.split(/\s+/)) {
|
|
7
|
+
if (token === "") continue;
|
|
8
|
+
const range = parseRangeReference(token);
|
|
9
|
+
if (range !== void 0) ranges.push(range);
|
|
10
|
+
}
|
|
11
|
+
return ranges;
|
|
12
|
+
}
|
|
13
|
+
function formatSqrefRange(range) {
|
|
14
|
+
if (range.startRow === range.endRow && range.startColumn === range.endColumn) return cellReference(range.startRow, range.startColumn);
|
|
15
|
+
return rangeReference(range);
|
|
16
|
+
}
|
|
17
|
+
function formatSqref(ranges) {
|
|
18
|
+
return ranges.map(formatSqrefRange).join(" ");
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { formatSqref, formatSqrefRange, parseSqref };
|
|
@@ -83,8 +83,7 @@ const BORDER_WEIGHT_UPPER_PT = {
|
|
|
83
83
|
thin: 1.125,
|
|
84
84
|
medium: 1.875
|
|
85
85
|
};
|
|
86
|
-
function
|
|
87
|
-
const colorEl = require_typed_util.childrenWithTag(container, colorTag)[0];
|
|
86
|
+
function colorFromElement(colorEl) {
|
|
88
87
|
if (colorEl === void 0) return;
|
|
89
88
|
const raw = require_typed_util.attr(colorEl, "rgb");
|
|
90
89
|
if (raw === void 0) return;
|
|
@@ -96,6 +95,9 @@ function readColorRgb(container, colorTag) {
|
|
|
96
95
|
return;
|
|
97
96
|
}
|
|
98
97
|
}
|
|
98
|
+
function readColorRgb(container, colorTag) {
|
|
99
|
+
return colorFromElement(require_typed_util.childrenWithTag(container, colorTag)[0]);
|
|
100
|
+
}
|
|
99
101
|
function readFillBackground(fill) {
|
|
100
102
|
const patternFill = require_typed_util.childrenWithTag(fill, "patternFill")[0];
|
|
101
103
|
if (patternFill === void 0 || require_typed_util.attr(patternFill, "patternType") !== "solid") return;
|
|
@@ -182,6 +184,13 @@ function readCellStyles(pkg) {
|
|
|
182
184
|
return entry;
|
|
183
185
|
});
|
|
184
186
|
}
|
|
187
|
+
function readDxfElements(pkg) {
|
|
188
|
+
const styleSheet = require_typed_util.rootElement(pkg.parts[STYLES_PATH]);
|
|
189
|
+
if (styleSheet === void 0) return [];
|
|
190
|
+
const dxfsEl = require_typed_util.childrenWithTag(styleSheet, "dxfs")[0];
|
|
191
|
+
if (dxfsEl === void 0) return [];
|
|
192
|
+
return require_typed_util.childrenWithTag(dxfsEl, "dxf");
|
|
193
|
+
}
|
|
185
194
|
function parseChildIndex(value) {
|
|
186
195
|
if (value === void 0) return;
|
|
187
196
|
const n = Number.parseInt(value, 10);
|
|
@@ -342,5 +351,8 @@ exports.DEFAULT_CELL_FORMAT_INDEX = DEFAULT_CELL_FORMAT_INDEX;
|
|
|
342
351
|
exports.GENERAL_NUM_FMT_ID = GENERAL_NUM_FMT_ID;
|
|
343
352
|
exports.RESERVED_BORDER_INDICES = RESERVED_BORDER_INDICES;
|
|
344
353
|
exports.RESERVED_FILL_INDICES = RESERVED_FILL_INDICES;
|
|
354
|
+
exports.colorFromElement = colorFromElement;
|
|
345
355
|
exports.readCellFormatCodes = readCellFormatCodes;
|
|
346
356
|
exports.readCellStyles = readCellStyles;
|
|
357
|
+
exports.readColorRgb = readColorRgb;
|
|
358
|
+
exports.readDxfElements = readDxfElements;
|