@simplysm/excel 1.0.138 → 13.0.0-beta.2
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/.cache/typecheck-browser.tsbuildinfo +1 -0
- package/.cache/typecheck-node.tsbuildinfo +1 -0
- package/.cache/typecheck-tests-browser.tsbuildinfo +1 -0
- package/.cache/typecheck-tests-node.tsbuildinfo +1 -0
- package/README.md +491 -0
- package/dist/core-common/src/common.types.d.ts +74 -0
- package/dist/core-common/src/common.types.d.ts.map +1 -0
- package/dist/core-common/src/env.d.ts +6 -0
- package/dist/core-common/src/env.d.ts.map +1 -0
- package/dist/core-common/src/errors/argument-error.d.ts +25 -0
- package/dist/core-common/src/errors/argument-error.d.ts.map +1 -0
- package/dist/core-common/src/errors/not-implemented-error.d.ts +29 -0
- package/dist/core-common/src/errors/not-implemented-error.d.ts.map +1 -0
- package/dist/core-common/src/errors/sd-error.d.ts +27 -0
- package/dist/core-common/src/errors/sd-error.d.ts.map +1 -0
- package/dist/core-common/src/errors/timeout-error.d.ts +31 -0
- package/dist/core-common/src/errors/timeout-error.d.ts.map +1 -0
- package/dist/core-common/src/extensions/arr-ext.d.ts +15 -0
- package/dist/core-common/src/extensions/arr-ext.d.ts.map +1 -0
- package/dist/core-common/src/extensions/arr-ext.helpers.d.ts +19 -0
- package/dist/core-common/src/extensions/arr-ext.helpers.d.ts.map +1 -0
- package/dist/core-common/src/extensions/arr-ext.types.d.ts +215 -0
- package/dist/core-common/src/extensions/arr-ext.types.d.ts.map +1 -0
- package/dist/core-common/src/extensions/map-ext.d.ts +57 -0
- package/dist/core-common/src/extensions/map-ext.d.ts.map +1 -0
- package/dist/core-common/src/extensions/set-ext.d.ts +36 -0
- package/dist/core-common/src/extensions/set-ext.d.ts.map +1 -0
- package/dist/core-common/src/features/debounce-queue.d.ts +53 -0
- package/dist/core-common/src/features/debounce-queue.d.ts.map +1 -0
- package/dist/core-common/src/features/event-emitter.d.ts +66 -0
- package/dist/core-common/src/features/event-emitter.d.ts.map +1 -0
- package/dist/core-common/src/features/serial-queue.d.ts +47 -0
- package/dist/core-common/src/features/serial-queue.d.ts.map +1 -0
- package/dist/core-common/src/index.d.ts +32 -0
- package/dist/core-common/src/index.d.ts.map +1 -0
- package/dist/core-common/src/types/date-only.d.ts +152 -0
- package/dist/core-common/src/types/date-only.d.ts.map +1 -0
- package/dist/core-common/src/types/date-time.d.ts +96 -0
- package/dist/core-common/src/types/date-time.d.ts.map +1 -0
- package/dist/core-common/src/types/lazy-gc-map.d.ts +80 -0
- package/dist/core-common/src/types/lazy-gc-map.d.ts.map +1 -0
- package/dist/core-common/src/types/time.d.ts +68 -0
- package/dist/core-common/src/types/time.d.ts.map +1 -0
- package/dist/core-common/src/types/uuid.d.ts +35 -0
- package/dist/core-common/src/types/uuid.d.ts.map +1 -0
- package/dist/core-common/src/utils/bytes.d.ts +51 -0
- package/dist/core-common/src/utils/bytes.d.ts.map +1 -0
- package/dist/core-common/src/utils/date-format.d.ts +90 -0
- package/dist/core-common/src/utils/date-format.d.ts.map +1 -0
- package/dist/core-common/src/utils/json.d.ts +34 -0
- package/dist/core-common/src/utils/json.d.ts.map +1 -0
- package/dist/core-common/src/utils/num.d.ts +60 -0
- package/dist/core-common/src/utils/num.d.ts.map +1 -0
- package/dist/core-common/src/utils/obj.d.ts +258 -0
- package/dist/core-common/src/utils/obj.d.ts.map +1 -0
- package/dist/core-common/src/utils/path.d.ts +23 -0
- package/dist/core-common/src/utils/path.d.ts.map +1 -0
- package/dist/core-common/src/utils/primitive.d.ts +18 -0
- package/dist/core-common/src/utils/primitive.d.ts.map +1 -0
- package/dist/core-common/src/utils/str.d.ts +103 -0
- package/dist/core-common/src/utils/str.d.ts.map +1 -0
- package/dist/core-common/src/utils/template-strings.d.ts +84 -0
- package/dist/core-common/src/utils/template-strings.d.ts.map +1 -0
- package/dist/core-common/src/utils/transferable.d.ts +47 -0
- package/dist/core-common/src/utils/transferable.d.ts.map +1 -0
- package/dist/core-common/src/utils/wait.d.ts +19 -0
- package/dist/core-common/src/utils/wait.d.ts.map +1 -0
- package/dist/core-common/src/utils/xml.d.ts +36 -0
- package/dist/core-common/src/utils/xml.d.ts.map +1 -0
- package/dist/core-common/src/zip/sd-zip.d.ts +80 -0
- package/dist/core-common/src/zip/sd-zip.d.ts.map +1 -0
- package/dist/excel/src/excel-cell.d.ts +68 -0
- package/dist/excel/src/excel-cell.d.ts.map +1 -0
- package/dist/excel/src/excel-col.d.ts +19 -0
- package/dist/excel/src/excel-col.d.ts.map +1 -0
- package/dist/excel/src/excel-row.d.ts +17 -0
- package/dist/excel/src/excel-row.d.ts.map +1 -0
- package/dist/excel/src/excel-workbook.d.ts +66 -0
- package/dist/excel/src/excel-workbook.d.ts.map +1 -0
- package/dist/excel/src/excel-worksheet.d.ts +102 -0
- package/dist/excel/src/excel-worksheet.d.ts.map +1 -0
- package/dist/excel/src/excel-wrapper.d.ts +42 -0
- package/dist/excel/src/excel-wrapper.d.ts.map +1 -0
- package/dist/excel/src/index.d.ts +9 -0
- package/dist/excel/src/index.d.ts.map +1 -0
- package/dist/excel/src/types.d.ts +445 -0
- package/dist/excel/src/types.d.ts.map +1 -0
- package/dist/excel/src/utils/excel-utils.d.ts +50 -0
- package/dist/excel/src/utils/excel-utils.d.ts.map +1 -0
- package/dist/excel/src/utils/zip-cache.d.ts +23 -0
- package/dist/excel/src/utils/zip-cache.d.ts.map +1 -0
- package/dist/excel/src/xml/excel-xml-content-type.d.ts +12 -0
- package/dist/excel/src/xml/excel-xml-content-type.d.ts.map +1 -0
- package/dist/excel/src/xml/excel-xml-drawing.d.ts +26 -0
- package/dist/excel/src/xml/excel-xml-drawing.d.ts.map +1 -0
- package/dist/excel/src/xml/excel-xml-relationship.d.ts +18 -0
- package/dist/excel/src/xml/excel-xml-relationship.d.ts.map +1 -0
- package/dist/excel/src/xml/excel-xml-shared-string.d.ts +19 -0
- package/dist/excel/src/xml/excel-xml-shared-string.d.ts.map +1 -0
- package/dist/excel/src/xml/excel-xml-style.d.ts +31 -0
- package/dist/excel/src/xml/excel-xml-style.d.ts.map +1 -0
- package/dist/excel/src/xml/excel-xml-unknown.d.ts +11 -0
- package/dist/excel/src/xml/excel-xml-unknown.d.ts.map +1 -0
- package/dist/excel/src/xml/excel-xml-workbook.d.ts +22 -0
- package/dist/excel/src/xml/excel-xml-workbook.d.ts.map +1 -0
- package/dist/excel/src/xml/excel-xml-worksheet.d.ts +103 -0
- package/dist/excel/src/xml/excel-xml-worksheet.d.ts.map +1 -0
- package/dist/excel-cell.js +261 -0
- package/dist/excel-cell.js.map +7 -0
- package/dist/excel-col.js +36 -0
- package/dist/excel-col.js.map +7 -0
- package/dist/excel-row.js +31 -0
- package/dist/excel-row.js.map +7 -0
- package/dist/excel-workbook.js +137 -0
- package/dist/excel-workbook.js.map +7 -0
- package/dist/excel-worksheet.js +279 -0
- package/dist/excel-worksheet.js.map +7 -0
- package/dist/excel-wrapper.js +220 -0
- package/dist/excel-wrapper.js.map +7 -0
- package/dist/index.js +9 -15
- package/dist/index.js.map +7 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +7 -0
- package/dist/utils/excel-utils.js +162 -0
- package/dist/utils/excel-utils.js.map +7 -0
- package/dist/utils/zip-cache.js +74 -0
- package/dist/utils/zip-cache.js.map +7 -0
- package/dist/xml/excel-xml-content-type.js +57 -0
- package/dist/xml/excel-xml-content-type.js.map +7 -0
- package/dist/xml/excel-xml-drawing.js +77 -0
- package/dist/xml/excel-xml-drawing.js.map +7 -0
- package/dist/xml/excel-xml-relationship.js +72 -0
- package/dist/xml/excel-xml-relationship.js.map +7 -0
- package/dist/xml/excel-xml-shared-string.js +61 -0
- package/dist/xml/excel-xml-shared-string.js.map +7 -0
- package/dist/xml/excel-xml-style.js +313 -0
- package/dist/xml/excel-xml-style.js.map +7 -0
- package/dist/xml/excel-xml-unknown.js +11 -0
- package/dist/xml/excel-xml-unknown.js.map +7 -0
- package/dist/xml/excel-xml-workbook.js +94 -0
- package/dist/xml/excel-xml-workbook.js.map +7 -0
- package/dist/xml/excel-xml-worksheet.js +405 -0
- package/dist/xml/excel-xml-worksheet.js.map +7 -0
- package/package.json +13 -7
- package/src/excel-cell.ts +326 -0
- package/src/excel-col.ts +43 -0
- package/src/excel-row.ts +37 -0
- package/src/excel-workbook.ts +206 -0
- package/src/excel-worksheet.ts +380 -0
- package/src/excel-wrapper.ts +219 -0
- package/src/index.ts +13 -9
- package/src/types.ts +396 -0
- package/src/utils/excel-utils.ts +201 -0
- package/src/utils/zip-cache.ts +103 -0
- package/src/xml/excel-xml-content-type.ts +64 -0
- package/src/xml/excel-xml-drawing.ts +87 -0
- package/src/xml/excel-xml-relationship.ts +86 -0
- package/src/xml/excel-xml-shared-string.ts +80 -0
- package/src/xml/excel-xml-style.ts +393 -0
- package/src/xml/excel-xml-unknown.ts +11 -0
- package/src/xml/excel-xml-workbook.ts +112 -0
- package/src/xml/excel-xml-worksheet.ts +544 -0
- package/tests/excel-cell.spec.ts +407 -0
- package/tests/excel-col.spec.ts +112 -0
- package/tests/excel-row.spec.ts +71 -0
- package/tests/excel-workbook.spec.ts +166 -0
- package/tests/excel-worksheet.spec.ts +389 -0
- package/tests/excel-wrapper.spec.ts +275 -0
- package/tests/fixtures/logo.png +0 -0
- package/tests/image-insert.spec.ts +188 -0
- package/tests/utils/excel-utils.spec.ts +240 -0
- package/dist/ExcelCell.d.ts +0 -13
- package/dist/ExcelCell.js +0 -161
- package/dist/ExcelCell.js.map +0 -1
- package/dist/ExcelCellStyle.d.ts +0 -31
- package/dist/ExcelCellStyle.js +0 -312
- package/dist/ExcelCellStyle.js.map +0 -1
- package/dist/ExcelColumn.d.ts +0 -8
- package/dist/ExcelColumn.js +0 -49
- package/dist/ExcelColumn.js.map +0 -1
- package/dist/ExcelRow.d.ts +0 -7
- package/dist/ExcelRow.js +0 -21
- package/dist/ExcelRow.js.map +0 -1
- package/dist/ExcelWorkbook.d.ts +0 -24
- package/dist/ExcelWorkbook.js +0 -418
- package/dist/ExcelWorkbook.js.map +0 -1
- package/dist/ExcelWorksheet.d.ts +0 -14
- package/dist/ExcelWorksheet.js +0 -31
- package/dist/ExcelWorksheet.js.map +0 -1
- package/dist/index.d.ts +0 -9
- package/dist/utils/ExcelUtils.d.ts +0 -14
- package/dist/utils/ExcelUtils.js +0 -66
- package/dist/utils/ExcelUtils.js.map +0 -1
- package/dist/utils/XmlConvert.d.ts +0 -4
- package/dist/utils/XmlConvert.js +0 -64
- package/dist/utils/XmlConvert.js.map +0 -1
- package/src/ExcelCell.ts +0 -163
- package/src/ExcelCellStyle.ts +0 -297
- package/src/ExcelColumn.ts +0 -46
- package/src/ExcelRow.ts +0 -17
- package/src/ExcelWorkbook.ts +0 -369
- package/src/ExcelWorksheet.ts +0 -27
- package/src/utils/ExcelUtils.ts +0 -68
- package/src/utils/XmlConvert.ts +0 -20
- package/tsconfig.build.json +0 -18
- package/tsconfig.json +0 -18
- package/tslint.json +0 -5
package/src/types.ts
ADDED
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import type { DateOnly, DateTime, Time } from "@simplysm/core-common";
|
|
2
|
+
|
|
3
|
+
//#region XML Data Types
|
|
4
|
+
|
|
5
|
+
export interface ExcelXmlContentTypeData {
|
|
6
|
+
Types: {
|
|
7
|
+
$: {
|
|
8
|
+
xmlns: string;
|
|
9
|
+
};
|
|
10
|
+
Default: {
|
|
11
|
+
$: {
|
|
12
|
+
Extension: string;
|
|
13
|
+
ContentType: string;
|
|
14
|
+
};
|
|
15
|
+
}[];
|
|
16
|
+
Override: {
|
|
17
|
+
$: {
|
|
18
|
+
PartName: string;
|
|
19
|
+
ContentType: string;
|
|
20
|
+
};
|
|
21
|
+
}[];
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface ExcelXmlRelationshipData {
|
|
26
|
+
Relationships: {
|
|
27
|
+
$: {
|
|
28
|
+
xmlns: string;
|
|
29
|
+
};
|
|
30
|
+
Relationship?: ExcelRelationshipData[];
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface ExcelRelationshipData {
|
|
35
|
+
$: {
|
|
36
|
+
Id: string;
|
|
37
|
+
Target: string;
|
|
38
|
+
Type: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface ExcelXmlWorkbookData {
|
|
43
|
+
workbook: {
|
|
44
|
+
$: {
|
|
45
|
+
"xmlns": string;
|
|
46
|
+
"xmlns:r"?: string;
|
|
47
|
+
};
|
|
48
|
+
bookViews?: [
|
|
49
|
+
{
|
|
50
|
+
workbookView: [{}];
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
sheets?: [
|
|
54
|
+
{
|
|
55
|
+
sheet: {
|
|
56
|
+
$: {
|
|
57
|
+
"name": string;
|
|
58
|
+
"sheetId": string;
|
|
59
|
+
"r:id": string;
|
|
60
|
+
};
|
|
61
|
+
}[];
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface ExcelXmlWorksheetData {
|
|
68
|
+
worksheet: {
|
|
69
|
+
$: { "xmlns": string; "xmlns:r"?: string };
|
|
70
|
+
dimension?: [
|
|
71
|
+
{
|
|
72
|
+
$: {
|
|
73
|
+
ref: string;
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
sheetViews?: [
|
|
78
|
+
{
|
|
79
|
+
sheetView: {
|
|
80
|
+
$: {
|
|
81
|
+
workbookViewId: string;
|
|
82
|
+
zoomScale?: string;
|
|
83
|
+
};
|
|
84
|
+
pane?: [
|
|
85
|
+
{
|
|
86
|
+
$: {
|
|
87
|
+
xSplit?: string;
|
|
88
|
+
ySplit?: string;
|
|
89
|
+
topLeftCell?: string;
|
|
90
|
+
activePane?: string;
|
|
91
|
+
state?: string;
|
|
92
|
+
};
|
|
93
|
+
},
|
|
94
|
+
];
|
|
95
|
+
}[];
|
|
96
|
+
},
|
|
97
|
+
];
|
|
98
|
+
sheetFormatPr?: [
|
|
99
|
+
{
|
|
100
|
+
$: {
|
|
101
|
+
defaultRowHeight: string;
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
];
|
|
105
|
+
cols?: [
|
|
106
|
+
{
|
|
107
|
+
col: {
|
|
108
|
+
$: {
|
|
109
|
+
min: string;
|
|
110
|
+
max: string;
|
|
111
|
+
width?: string;
|
|
112
|
+
bestFit?: string;
|
|
113
|
+
customWidth?: string;
|
|
114
|
+
};
|
|
115
|
+
}[];
|
|
116
|
+
},
|
|
117
|
+
];
|
|
118
|
+
sheetData: [
|
|
119
|
+
{
|
|
120
|
+
row?: ExcelRowData[];
|
|
121
|
+
},
|
|
122
|
+
];
|
|
123
|
+
mergeCells?: [
|
|
124
|
+
{
|
|
125
|
+
$: { count: string };
|
|
126
|
+
mergeCell: {
|
|
127
|
+
$: { ref: string };
|
|
128
|
+
}[];
|
|
129
|
+
},
|
|
130
|
+
];
|
|
131
|
+
drawing?: { $: { "r:id": string } }[];
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface ExcelRowData {
|
|
136
|
+
$: {
|
|
137
|
+
r: string; // address (1~)
|
|
138
|
+
};
|
|
139
|
+
c?: ExcelCellData[];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface ExcelCellData {
|
|
143
|
+
$: {
|
|
144
|
+
r: string; // address (A~)
|
|
145
|
+
s?: string; // styleId
|
|
146
|
+
t?: string; // type: s(sharedString)
|
|
147
|
+
};
|
|
148
|
+
v?: [string];
|
|
149
|
+
f?: [string];
|
|
150
|
+
is?: {
|
|
151
|
+
t?: {
|
|
152
|
+
_?: string;
|
|
153
|
+
}[];
|
|
154
|
+
}[];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export interface ExcelXmlDrawingData {
|
|
158
|
+
wsDr: {
|
|
159
|
+
$: {
|
|
160
|
+
"xmlns": string;
|
|
161
|
+
"xmlns:a"?: string;
|
|
162
|
+
"xmlns:r"?: string;
|
|
163
|
+
};
|
|
164
|
+
twoCellAnchor?: {
|
|
165
|
+
from?: {
|
|
166
|
+
col: string[];
|
|
167
|
+
colOff?: string[];
|
|
168
|
+
row: string[];
|
|
169
|
+
rowOff?: string[];
|
|
170
|
+
}[];
|
|
171
|
+
to?: {
|
|
172
|
+
col: string[];
|
|
173
|
+
colOff?: string[];
|
|
174
|
+
row: string[];
|
|
175
|
+
rowOff?: string[];
|
|
176
|
+
}[];
|
|
177
|
+
pic?: {
|
|
178
|
+
nvPicPr?: {
|
|
179
|
+
cNvPr?: { $: { id: string; name: string; descr?: string } }[];
|
|
180
|
+
cNvPicPr?: Array<{ "a:picLocks"?: Array<{ $: { noChangeAspect?: string } }> }>;
|
|
181
|
+
}[];
|
|
182
|
+
blipFill?: {
|
|
183
|
+
"a:blip"?: Array<{ $: { "r:embed": string } }>;
|
|
184
|
+
"a:stretch"?: Array<{ "a:fillRect": unknown[] }>;
|
|
185
|
+
}[];
|
|
186
|
+
spPr?: {
|
|
187
|
+
"a:xfrm"?: Array<{
|
|
188
|
+
"a:off"?: Array<{ $: { x: string; y: string } }>;
|
|
189
|
+
"a:ext"?: Array<{ $: { cx: string; cy: string } }>;
|
|
190
|
+
}>;
|
|
191
|
+
"a:prstGeom"?: Array<{ "$": { prst: string }; "a:avLst": unknown[] }>;
|
|
192
|
+
}[];
|
|
193
|
+
}[];
|
|
194
|
+
clientData?: unknown[];
|
|
195
|
+
}[];
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export interface ExcelXmlSharedStringData {
|
|
200
|
+
sst: {
|
|
201
|
+
$: { xmlns: string };
|
|
202
|
+
si?: ExcelXmlSharedStringDataSi[];
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export type ExcelXmlSharedStringDataSi =
|
|
207
|
+
| {
|
|
208
|
+
t: ExcelXmlSharedStringDataText;
|
|
209
|
+
}
|
|
210
|
+
| {
|
|
211
|
+
r: {
|
|
212
|
+
t: ExcelXmlSharedStringDataText;
|
|
213
|
+
}[];
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export type ExcelXmlSharedStringDataText = [
|
|
217
|
+
| string
|
|
218
|
+
| {
|
|
219
|
+
$: { space?: "preserve" };
|
|
220
|
+
_?: string;
|
|
221
|
+
},
|
|
222
|
+
];
|
|
223
|
+
|
|
224
|
+
export interface ExcelXmlStyleData {
|
|
225
|
+
styleSheet: {
|
|
226
|
+
$: { xmlns: string };
|
|
227
|
+
numFmts?: [
|
|
228
|
+
{
|
|
229
|
+
$: { count: string };
|
|
230
|
+
numFmt?: {
|
|
231
|
+
$: {
|
|
232
|
+
numFmtId: string;
|
|
233
|
+
formatCode: string;
|
|
234
|
+
};
|
|
235
|
+
}[];
|
|
236
|
+
},
|
|
237
|
+
];
|
|
238
|
+
fonts: [
|
|
239
|
+
{
|
|
240
|
+
$: { count: string };
|
|
241
|
+
font: {}[];
|
|
242
|
+
},
|
|
243
|
+
];
|
|
244
|
+
fills: [
|
|
245
|
+
{
|
|
246
|
+
$: { count: string };
|
|
247
|
+
fill: ExcelXmlStyleDataFill[];
|
|
248
|
+
},
|
|
249
|
+
];
|
|
250
|
+
borders: [
|
|
251
|
+
{
|
|
252
|
+
$: { count: string };
|
|
253
|
+
border: ExcelXmlStyleDataBorder[];
|
|
254
|
+
},
|
|
255
|
+
];
|
|
256
|
+
cellXfs: [
|
|
257
|
+
{
|
|
258
|
+
$: { count: string };
|
|
259
|
+
xf: ExcelXmlStyleDataXf[];
|
|
260
|
+
},
|
|
261
|
+
];
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export interface ExcelXmlStyleDataXf {
|
|
266
|
+
$: {
|
|
267
|
+
numFmtId?: string;
|
|
268
|
+
fontId?: string;
|
|
269
|
+
fillId?: string;
|
|
270
|
+
borderId?: string;
|
|
271
|
+
xfId?: string;
|
|
272
|
+
applyNumberFormat?: string;
|
|
273
|
+
applyFont?: string;
|
|
274
|
+
applyAlignment?: string;
|
|
275
|
+
applyFill?: string;
|
|
276
|
+
applyBorder?: string;
|
|
277
|
+
};
|
|
278
|
+
alignment?: [
|
|
279
|
+
{
|
|
280
|
+
$: { horizontal?: "center" | "left" | "right"; vertical?: "center" | "top" | "bottom" };
|
|
281
|
+
},
|
|
282
|
+
];
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export interface ExcelXmlStyleDataFill {
|
|
286
|
+
patternFill: [
|
|
287
|
+
{
|
|
288
|
+
$: { patternType: "none" | "solid" | "gray125" };
|
|
289
|
+
fgColor?: [{ $: { rgb: string } }];
|
|
290
|
+
},
|
|
291
|
+
];
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export interface ExcelXmlStyleDataBorder {
|
|
295
|
+
top?: [
|
|
296
|
+
{
|
|
297
|
+
$: { style: "thin" | "medium" };
|
|
298
|
+
color?: [{ $: { rgb: string } }];
|
|
299
|
+
},
|
|
300
|
+
];
|
|
301
|
+
left?: [
|
|
302
|
+
{
|
|
303
|
+
$: { style: "thin" | "medium" };
|
|
304
|
+
color?: [{ $: { rgb: string } }];
|
|
305
|
+
},
|
|
306
|
+
];
|
|
307
|
+
right?: [
|
|
308
|
+
{
|
|
309
|
+
$: { style: "thin" | "medium" };
|
|
310
|
+
color?: [{ $: { rgb: string } }];
|
|
311
|
+
},
|
|
312
|
+
];
|
|
313
|
+
bottom?: [
|
|
314
|
+
{
|
|
315
|
+
$: { style: "thin" | "medium" };
|
|
316
|
+
color?: [{ $: { rgb: string } }];
|
|
317
|
+
},
|
|
318
|
+
];
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
//#endregion
|
|
322
|
+
|
|
323
|
+
//#region Value Types
|
|
324
|
+
|
|
325
|
+
export type ExcelValueType = number | string | DateOnly | DateTime | Time | boolean | undefined;
|
|
326
|
+
export type ExcelNumberFormat = "number" | "string" | "DateOnly" | "DateTime" | "Time";
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Excel 셀 타입
|
|
330
|
+
* - s: 공유 문자열 (SharedString)
|
|
331
|
+
* - b: 불리언
|
|
332
|
+
* - str: 수식 결과 문자열
|
|
333
|
+
* - n: 숫자
|
|
334
|
+
* - inlineStr: 인라인 문자열 (리치 텍스트)
|
|
335
|
+
* - e: 에러
|
|
336
|
+
*/
|
|
337
|
+
export type ExcelCellType = "s" | "b" | "str" | "n" | "inlineStr" | "e";
|
|
338
|
+
|
|
339
|
+
//#endregion
|
|
340
|
+
|
|
341
|
+
//#region Address Types
|
|
342
|
+
|
|
343
|
+
export interface ExcelAddressPoint {
|
|
344
|
+
r: number;
|
|
345
|
+
c: number;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export interface ExcelAddressRangePoint {
|
|
349
|
+
s: ExcelAddressPoint;
|
|
350
|
+
e: ExcelAddressPoint;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
//#endregion
|
|
354
|
+
|
|
355
|
+
//#region Excel XML Interface
|
|
356
|
+
|
|
357
|
+
export interface ExcelXml {
|
|
358
|
+
readonly data: unknown;
|
|
359
|
+
cleanup(): void;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
//#endregion
|
|
363
|
+
|
|
364
|
+
//#region Style Types
|
|
365
|
+
|
|
366
|
+
export type ExcelBorderPosition = "left" | "right" | "top" | "bottom";
|
|
367
|
+
export type ExcelHorizontalAlign = "center" | "left" | "right";
|
|
368
|
+
export type ExcelVerticalAlign = "center" | "top" | "bottom";
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* 셀 스타일 옵션
|
|
372
|
+
* @example
|
|
373
|
+
* ```typescript
|
|
374
|
+
* await cell.setStyle({
|
|
375
|
+
* background: "00FF0000", // 빨간색
|
|
376
|
+
* border: ["left", "right", "top", "bottom"],
|
|
377
|
+
* horizontalAlign: "center",
|
|
378
|
+
* verticalAlign: "center",
|
|
379
|
+
* numberFormat: "number",
|
|
380
|
+
* });
|
|
381
|
+
* ```
|
|
382
|
+
*/
|
|
383
|
+
export interface ExcelStyleOptions {
|
|
384
|
+
/** 배경색 (ARGB 형식, 예: "00FF0000") */
|
|
385
|
+
background?: string;
|
|
386
|
+
/** 테두리 위치 */
|
|
387
|
+
border?: ExcelBorderPosition[];
|
|
388
|
+
/** 가로 정렬 */
|
|
389
|
+
horizontalAlign?: ExcelHorizontalAlign;
|
|
390
|
+
/** 세로 정렬 */
|
|
391
|
+
verticalAlign?: ExcelVerticalAlign;
|
|
392
|
+
/** 숫자 형식 */
|
|
393
|
+
numberFormat?: ExcelNumberFormat;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
//#endregion
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { numParseInt } from "@simplysm/core-common";
|
|
2
|
+
import type { ExcelAddressPoint, ExcelAddressRangePoint, ExcelNumberFormat } from "../types";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Excel 관련 유틸리티 함수 모음.
|
|
6
|
+
* 셀 주소 변환, 날짜/숫자 변환, 숫자 형식 처리 등의 기능을 제공한다.
|
|
7
|
+
*/
|
|
8
|
+
export class ExcelUtils {
|
|
9
|
+
/** 셀 좌표를 "A1" 형식 문자열로 변환 */
|
|
10
|
+
static stringifyAddr(point: ExcelAddressPoint): string {
|
|
11
|
+
const rowStr = this.stringifyRowAddr(point.r);
|
|
12
|
+
const colStr = this.stringifyColAddr(point.c);
|
|
13
|
+
return `${colStr}${rowStr}`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** 행 인덱스(0-based)를 행 주소 문자열로 변환 (예: 0 -> "1") */
|
|
17
|
+
static stringifyRowAddr(r: number): string {
|
|
18
|
+
return (r + 1).toString();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** 열 인덱스(0-based)를 열 주소 문자열로 변환 (예: 0 -> "A", 26 -> "AA") */
|
|
22
|
+
static stringifyColAddr(c: number): string {
|
|
23
|
+
if (c < 0 || c > 16383) {
|
|
24
|
+
throw new Error(`열 인덱스는 0~16383 범위여야 합니다: ${c}`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let remained = c;
|
|
28
|
+
let result = String.fromCharCode((remained % 26) + 65);
|
|
29
|
+
remained = Math.floor(remained / 26);
|
|
30
|
+
while (remained !== 0) {
|
|
31
|
+
result = String.fromCharCode((remained % 26) + 64) + result;
|
|
32
|
+
remained = Math.floor(remained / 26);
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** 셀 주소에서 행 인덱스 추출 (예: "A3" -> 2) */
|
|
38
|
+
static parseRowAddrCode(addrCode: string): number {
|
|
39
|
+
const rowAddrCode = /\d*$/.exec(addrCode)?.[0] ?? "";
|
|
40
|
+
const parsed = numParseInt(rowAddrCode);
|
|
41
|
+
if (parsed == null) {
|
|
42
|
+
throw new Error(`잘못된 행 주소 코드: ${addrCode}`);
|
|
43
|
+
}
|
|
44
|
+
return parsed - 1;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** 셀 주소에서 열 인덱스 추출 (예: "B3" -> 1) */
|
|
48
|
+
static parseColAddrCode(addrCode: string): number {
|
|
49
|
+
const colAddrCode = /^[a-zA-Z]*/.exec(addrCode)?.[0] ?? "";
|
|
50
|
+
|
|
51
|
+
let result = 0;
|
|
52
|
+
const revAddr = Array.from(colAddrCode).reverse().join("");
|
|
53
|
+
for (let i = 0; i < revAddr.length; i++) {
|
|
54
|
+
const col = revAddr.charCodeAt(i) - (i === 0 ? 65 : 64);
|
|
55
|
+
result += col * 26 ** i;
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** 셀 주소를 좌표로 변환 (예: "B3" -> {r: 2, c: 1}) */
|
|
61
|
+
static parseCellAddrCode(addr: string): ExcelAddressPoint {
|
|
62
|
+
return {
|
|
63
|
+
r: ExcelUtils.parseRowAddrCode(addr),
|
|
64
|
+
c: ExcelUtils.parseColAddrCode(addr),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** 범위 주소를 좌표로 변환 (예: "A1:C3" -> {s: {r:0,c:0}, e: {r:2,c:2}}) */
|
|
69
|
+
static parseRangeAddrCode(rangeAddr: string): ExcelAddressRangePoint {
|
|
70
|
+
const parts = rangeAddr.split(":");
|
|
71
|
+
return {
|
|
72
|
+
s: ExcelUtils.parseCellAddrCode(parts[0]),
|
|
73
|
+
e: ExcelUtils.parseCellAddrCode(parts[1] ?? parts[0]),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** 범위 좌표를 주소 문자열로 변환 */
|
|
78
|
+
static stringifyRangeAddr(point: ExcelAddressRangePoint): string {
|
|
79
|
+
const sAddr = this.stringifyAddr(point.s);
|
|
80
|
+
const eAddr = this.stringifyAddr(point.e);
|
|
81
|
+
|
|
82
|
+
if (sAddr === eAddr) {
|
|
83
|
+
return sAddr;
|
|
84
|
+
} else {
|
|
85
|
+
return sAddr + ":" + eAddr;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* JavaScript 타임스탬프(ms)를 Excel 날짜 숫자로 변환.
|
|
91
|
+
* Excel은 1900-01-01을 1로 계산한다 (1899-12-30이 날짜 0).
|
|
92
|
+
*/
|
|
93
|
+
static convertTimeTickToNumber(tick: number): number {
|
|
94
|
+
const currDate = new Date(tick);
|
|
95
|
+
currDate.setMinutes(currDate.getMinutes() - currDate.getTimezoneOffset());
|
|
96
|
+
const excelBaseDateNumberUtc = Date.UTC(1899, 11, 31);
|
|
97
|
+
const inputExcelDateNumberUtc = currDate.getTime() - excelBaseDateNumberUtc;
|
|
98
|
+
return inputExcelDateNumberUtc / (24 * 60 * 60 * 1000) + 1;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Excel 날짜 숫자를 JavaScript 타임스탬프(ms)로 변환.
|
|
103
|
+
* Excel은 1900-01-01을 1로 계산한다 (1899-12-30이 날짜 0).
|
|
104
|
+
*/
|
|
105
|
+
static convertNumberToTimeTick(num: number): number {
|
|
106
|
+
const excelBaseDateNumberUtc = Date.UTC(1899, 11, 31);
|
|
107
|
+
const excelDateNumberUtc = (num - 1) * 24 * 60 * 60 * 1000;
|
|
108
|
+
const dateNumberUtc = excelBaseDateNumberUtc + excelDateNumberUtc;
|
|
109
|
+
const date = new Date(dateNumberUtc);
|
|
110
|
+
date.setMinutes(date.getMinutes() + date.getTimezoneOffset());
|
|
111
|
+
return date.getTime();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** 숫자 형식 코드를 형식 이름으로 변환 */
|
|
115
|
+
static convertNumFmtCodeToName(numFmtCode: string): ExcelNumberFormat {
|
|
116
|
+
if (numFmtCode === "General") {
|
|
117
|
+
return "number";
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const hasDate = /yy/i.test(numFmtCode) || /dd/i.test(numFmtCode) || /mm/i.test(numFmtCode);
|
|
121
|
+
const hasTime = /hh/i.test(numFmtCode) || /ss/i.test(numFmtCode);
|
|
122
|
+
|
|
123
|
+
if (hasDate && hasTime) {
|
|
124
|
+
return "DateTime"; // 날짜+시간 = DateTime
|
|
125
|
+
} else if (hasDate) {
|
|
126
|
+
return "DateOnly"; // 날짜만 = DateOnly
|
|
127
|
+
} else if (hasTime) {
|
|
128
|
+
return "Time"; // 시간만 = Time
|
|
129
|
+
}
|
|
130
|
+
// 숫자 형식 패턴: 0, #, 소수점, 천단위 구분자, 음수 구분자, 괄호, 통화, 공백, 지수, 백분율 등
|
|
131
|
+
// "[조건부 서식]실제형식" 구조에서 실제형식 부분만 검사 (split("]").at(-1))
|
|
132
|
+
else if (/^[0.#,_;()\-\\$ @*?"E%+]*$/.test(numFmtCode.split("]").at(-1) ?? "")) {
|
|
133
|
+
return "number";
|
|
134
|
+
} else if ((numFmtCode.split("]").at(-1) ?? "").includes("#,0")) {
|
|
135
|
+
return "number";
|
|
136
|
+
} else {
|
|
137
|
+
throw new Error(`[numFmtCode: ${numFmtCode}]에 대한 형식을 알 수 없습니다.`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* 숫자 형식 ID를 형식 이름으로 변환
|
|
143
|
+
*
|
|
144
|
+
* @remarks
|
|
145
|
+
* Excel 내장 형식 ID 범위:
|
|
146
|
+
* - 0~13, 37~40, 48: 숫자/일반/통화/백분율 형식
|
|
147
|
+
* - 14~17, 27~31, 34~36, 50~58: 날짜 형식 (지역화 포함)
|
|
148
|
+
* - 22: 날짜+시간 형식
|
|
149
|
+
* - 18~21, 32~33, 45~47: 시간 형식
|
|
150
|
+
* - 49: 텍스트 형식
|
|
151
|
+
*/
|
|
152
|
+
static convertNumFmtIdToName(numFmtId: number): ExcelNumberFormat {
|
|
153
|
+
// 숫자/일반/통화/백분율 형식
|
|
154
|
+
if (numFmtId <= 13 || (numFmtId >= 37 && numFmtId <= 40) || numFmtId === 48) {
|
|
155
|
+
return "number";
|
|
156
|
+
}
|
|
157
|
+
// 날짜 형식 (지역화 포함)
|
|
158
|
+
else if (
|
|
159
|
+
(numFmtId >= 14 && numFmtId <= 17) ||
|
|
160
|
+
(numFmtId >= 27 && numFmtId <= 31) ||
|
|
161
|
+
(numFmtId >= 34 && numFmtId <= 36) ||
|
|
162
|
+
(numFmtId >= 50 && numFmtId <= 58)
|
|
163
|
+
) {
|
|
164
|
+
return "DateOnly";
|
|
165
|
+
}
|
|
166
|
+
// 날짜+시간 형식
|
|
167
|
+
else if (numFmtId === 22) {
|
|
168
|
+
return "DateTime";
|
|
169
|
+
}
|
|
170
|
+
// 시간 형식
|
|
171
|
+
else if (
|
|
172
|
+
(numFmtId >= 18 && numFmtId <= 21) ||
|
|
173
|
+
(numFmtId >= 32 && numFmtId <= 33) ||
|
|
174
|
+
(numFmtId >= 45 && numFmtId <= 47)
|
|
175
|
+
) {
|
|
176
|
+
return "Time";
|
|
177
|
+
}
|
|
178
|
+
// 텍스트 형식
|
|
179
|
+
else if (numFmtId === 49) {
|
|
180
|
+
return "string";
|
|
181
|
+
} else {
|
|
182
|
+
throw new Error(`[numFmtId: ${numFmtId}]에 대한 형식을 알 수 없습니다.`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** 숫자 형식 이름을 형식 ID로 변환 */
|
|
187
|
+
static convertNumFmtNameToId(numFmtName: ExcelNumberFormat): number {
|
|
188
|
+
if (numFmtName === "number") {
|
|
189
|
+
return 0;
|
|
190
|
+
} else if (numFmtName === "DateOnly") {
|
|
191
|
+
return 14;
|
|
192
|
+
} else if (numFmtName === "DateTime") {
|
|
193
|
+
return 22;
|
|
194
|
+
} else if (numFmtName === "Time") {
|
|
195
|
+
return 18;
|
|
196
|
+
} else {
|
|
197
|
+
// 마지막 케이스: "string" (TypeScript가 타입 좁히기를 통해 자동으로 확인)
|
|
198
|
+
return 49;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { Bytes } from "@simplysm/core-common";
|
|
2
|
+
import { ZipArchive, xmlStringify, xmlParse } from "@simplysm/core-common";
|
|
3
|
+
import type {
|
|
4
|
+
ExcelXml,
|
|
5
|
+
ExcelXmlContentTypeData,
|
|
6
|
+
ExcelXmlDrawingData,
|
|
7
|
+
ExcelXmlRelationshipData,
|
|
8
|
+
ExcelXmlSharedStringData,
|
|
9
|
+
ExcelXmlStyleData,
|
|
10
|
+
ExcelXmlWorkbookData,
|
|
11
|
+
ExcelXmlWorksheetData,
|
|
12
|
+
} from "../types";
|
|
13
|
+
import { ExcelXmlContentType } from "../xml/excel-xml-content-type";
|
|
14
|
+
import { ExcelXmlDrawing } from "../xml/excel-xml-drawing";
|
|
15
|
+
import { ExcelXmlRelationship } from "../xml/excel-xml-relationship";
|
|
16
|
+
import { ExcelXmlSharedString } from "../xml/excel-xml-shared-string";
|
|
17
|
+
import { ExcelXmlStyle } from "../xml/excel-xml-style";
|
|
18
|
+
import { ExcelXmlUnknown } from "../xml/excel-xml-unknown";
|
|
19
|
+
import { ExcelXmlWorkbook } from "../xml/excel-xml-workbook";
|
|
20
|
+
import { ExcelXmlWorksheet } from "../xml/excel-xml-worksheet";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Excel ZIP 아카이브의 파일 캐시를 관리하는 클래스.
|
|
24
|
+
* XML 파일은 파싱하여 ExcelXml 객체로, 그 외 파일은 바이트 배열로 캐싱한다.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* ## Lazy Loading 캐시 전략
|
|
28
|
+
*
|
|
29
|
+
* - 파일은 첫 접근 시에만 ZIP에서 읽고 파싱한다
|
|
30
|
+
* - 이후 접근은 캐시된 객체를 반환한다
|
|
31
|
+
* - 대용량 Excel 파일에서 필요한 부분만 로드하여 메모리 효율성을 높인다
|
|
32
|
+
*/
|
|
33
|
+
export class ZipCache {
|
|
34
|
+
private readonly _cache = new Map<string, ExcelXml | Bytes | undefined>();
|
|
35
|
+
private readonly _zip: ZipArchive;
|
|
36
|
+
|
|
37
|
+
constructor(arg?: Blob | Bytes) {
|
|
38
|
+
this._zip = new ZipArchive(arg);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async get(filePath: string): Promise<ExcelXml | Bytes | undefined> {
|
|
42
|
+
if (this._cache.has(filePath)) {
|
|
43
|
+
return this._cache.get(filePath);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const fileData = await this._zip.get(filePath);
|
|
47
|
+
if (fileData == null) {
|
|
48
|
+
this._cache.set(filePath, undefined);
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (filePath.endsWith(".xml") || filePath.endsWith(".rels")) {
|
|
53
|
+
const fileText = new TextDecoder().decode(fileData);
|
|
54
|
+
const xml = xmlParse(fileText, { stripTagPrefix: true });
|
|
55
|
+
if (filePath.endsWith(".rels")) {
|
|
56
|
+
this._cache.set(filePath, new ExcelXmlRelationship(xml as ExcelXmlRelationshipData));
|
|
57
|
+
} else if (filePath === "[Content_Types].xml") {
|
|
58
|
+
this._cache.set(filePath, new ExcelXmlContentType(xml as ExcelXmlContentTypeData));
|
|
59
|
+
} else if (filePath === "xl/workbook.xml") {
|
|
60
|
+
this._cache.set(filePath, new ExcelXmlWorkbook(xml as ExcelXmlWorkbookData));
|
|
61
|
+
} else if (filePath.startsWith("xl/worksheets/sheet") && filePath.endsWith(".xml")) {
|
|
62
|
+
this._cache.set(filePath, new ExcelXmlWorksheet(xml as ExcelXmlWorksheetData));
|
|
63
|
+
} else if (filePath.startsWith("xl/drawings/drawing") && filePath.endsWith(".xml")) {
|
|
64
|
+
this._cache.set(filePath, new ExcelXmlDrawing(xml as ExcelXmlDrawingData));
|
|
65
|
+
} else if (filePath === "xl/sharedStrings.xml") {
|
|
66
|
+
this._cache.set(filePath, new ExcelXmlSharedString(xml as ExcelXmlSharedStringData));
|
|
67
|
+
} else if (filePath === "xl/styles.xml") {
|
|
68
|
+
this._cache.set(filePath, new ExcelXmlStyle(xml as ExcelXmlStyleData));
|
|
69
|
+
} else {
|
|
70
|
+
this._cache.set(filePath, new ExcelXmlUnknown(xml as Record<string, unknown>));
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
this._cache.set(filePath, fileData);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return this._cache.get(filePath);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
set(filePath: string, content: ExcelXml | Bytes): void {
|
|
80
|
+
this._cache.set(filePath, content);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async toBytes(): Promise<Bytes> {
|
|
84
|
+
for (const filePath of this._cache.keys()) {
|
|
85
|
+
const content = this._cache.get(filePath);
|
|
86
|
+
if (content == null) continue;
|
|
87
|
+
|
|
88
|
+
if ("cleanup" in content) {
|
|
89
|
+
content.cleanup();
|
|
90
|
+
this._zip.write(filePath, new TextEncoder().encode(xmlStringify(content.data)));
|
|
91
|
+
} else {
|
|
92
|
+
this._zip.write(filePath, content);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return this._zip.compress();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async close(): Promise<void> {
|
|
100
|
+
await this._zip.close();
|
|
101
|
+
this._cache.clear();
|
|
102
|
+
}
|
|
103
|
+
}
|