ooxml.js 2.5.2 → 2.6.1
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 +3 -2
- package/dist/index.cjs +22 -0
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/typed/docx/numbering.cjs +86 -0
- package/dist/typed/docx/numbering.d.cts +23 -0
- package/dist/typed/docx/numbering.d.ts +23 -0
- package/dist/typed/docx/numbering.js +83 -0
- package/dist/typed/docx/read.cjs +115 -15
- package/dist/typed/docx/read.d.cts +8 -0
- package/dist/typed/docx/read.d.ts +8 -0
- package/dist/typed/docx/read.js +117 -17
- package/dist/typed/docx/styles.cjs +26 -2
- package/dist/typed/docx/styles.js +26 -2
- package/dist/typed/pptx/read.cjs +5 -20
- package/dist/typed/pptx/read.js +5 -20
- package/dist/typed/shared/drawingml.cjs +112 -5
- package/dist/typed/shared/drawingml.d.cts +19 -2
- package/dist/typed/shared/drawingml.d.ts +19 -2
- package/dist/typed/shared/drawingml.js +111 -6
- package/dist/typed/shared/units.cjs +10 -0
- package/dist/typed/shared/units.d.cts +4 -1
- package/dist/typed/shared/units.d.ts +4 -1
- package/dist/typed/shared/units.js +8 -1
- package/dist/typed/xlsx/build.cjs +83 -55
- package/dist/typed/xlsx/build.js +83 -55
- package/dist/typed/xlsx/content.cjs +85 -15
- package/dist/typed/xlsx/content.js +85 -15
- package/dist/typed/xlsx/number-format.cjs +324 -0
- package/dist/typed/xlsx/number-format.d.cts +52 -0
- package/dist/typed/xlsx/number-format.d.ts +52 -0
- package/dist/typed/xlsx/number-format.js +312 -0
- package/dist/typed/xlsx/serial.cjs +109 -0
- package/dist/typed/xlsx/serial.d.cts +11 -0
- package/dist/typed/xlsx/serial.d.ts +11 -0
- package/dist/typed/xlsx/serial.js +102 -0
- package/dist/typed/xlsx/styles.cjs +73 -0
- package/dist/typed/xlsx/styles.d.cts +21 -0
- package/dist/typed/xlsx/styles.d.ts +21 -0
- package/dist/typed/xlsx/styles.js +69 -0
- package/package.json +1 -1
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/typed/xlsx/number-format.ts
|
|
3
|
+
const MAX_NUMBER_FORMAT_SECTIONS = 4;
|
|
4
|
+
function at(chars, index) {
|
|
5
|
+
return chars[index] ?? "";
|
|
6
|
+
}
|
|
7
|
+
function tokenizeNumberFormat(formatCode) {
|
|
8
|
+
const chars = [...formatCode];
|
|
9
|
+
const tokens = [];
|
|
10
|
+
let index = 0;
|
|
11
|
+
while (index < chars.length) {
|
|
12
|
+
const char = at(chars, index);
|
|
13
|
+
if (char === "\"") {
|
|
14
|
+
let text = "";
|
|
15
|
+
index += 1;
|
|
16
|
+
while (index < chars.length && at(chars, index) !== "\"") {
|
|
17
|
+
text += at(chars, index);
|
|
18
|
+
index += 1;
|
|
19
|
+
}
|
|
20
|
+
index += 1;
|
|
21
|
+
tokens.push({
|
|
22
|
+
kind: "literal",
|
|
23
|
+
text
|
|
24
|
+
});
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (char === "\\" || char === "_" || char === "*") {
|
|
28
|
+
tokens.push({
|
|
29
|
+
kind: "literal",
|
|
30
|
+
text: at(chars, index + 1)
|
|
31
|
+
});
|
|
32
|
+
index += 2;
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (char === "[") {
|
|
36
|
+
let body = "";
|
|
37
|
+
index += 1;
|
|
38
|
+
while (index < chars.length && at(chars, index) !== "]") {
|
|
39
|
+
body += at(chars, index);
|
|
40
|
+
index += 1;
|
|
41
|
+
}
|
|
42
|
+
index += 1;
|
|
43
|
+
tokens.push({
|
|
44
|
+
kind: "bracket",
|
|
45
|
+
body
|
|
46
|
+
});
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (char === ";") {
|
|
50
|
+
tokens.push({ kind: "separator" });
|
|
51
|
+
index += 1;
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
tokens.push({
|
|
55
|
+
kind: "code",
|
|
56
|
+
char
|
|
57
|
+
});
|
|
58
|
+
index += 1;
|
|
59
|
+
}
|
|
60
|
+
return tokens;
|
|
61
|
+
}
|
|
62
|
+
function splitNumberFormatSections(tokens) {
|
|
63
|
+
const sections = [];
|
|
64
|
+
let current = [];
|
|
65
|
+
for (const token of tokens) {
|
|
66
|
+
if (token.kind === "separator") {
|
|
67
|
+
sections.push(current);
|
|
68
|
+
current = [];
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
current.push(token);
|
|
72
|
+
}
|
|
73
|
+
sections.push(current);
|
|
74
|
+
return sections.slice(0, 4);
|
|
75
|
+
}
|
|
76
|
+
const CURRENCY_SYMBOL = /\p{Sc}/u;
|
|
77
|
+
function containsCurrencySymbol(text) {
|
|
78
|
+
return CURRENCY_SYMBOL.test(text);
|
|
79
|
+
}
|
|
80
|
+
function isIsoCurrencyCodeShape(marker) {
|
|
81
|
+
if (marker.length !== 3) return false;
|
|
82
|
+
for (const char of marker) {
|
|
83
|
+
const upper = char.toUpperCase();
|
|
84
|
+
if (upper < "A" || upper > "Z") return false;
|
|
85
|
+
}
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
function isElapsedBracketBody(body) {
|
|
89
|
+
let letter;
|
|
90
|
+
for (const char of body) {
|
|
91
|
+
const lower = char.toLowerCase();
|
|
92
|
+
if (letter === void 0) {
|
|
93
|
+
if (lower !== "h" && lower !== "m" && lower !== "s") return false;
|
|
94
|
+
letter = lower;
|
|
95
|
+
} else if (lower !== letter) return false;
|
|
96
|
+
}
|
|
97
|
+
return letter !== void 0;
|
|
98
|
+
}
|
|
99
|
+
function classifyBracket(body) {
|
|
100
|
+
if (body.startsWith("$")) {
|
|
101
|
+
const rest = body.slice(1);
|
|
102
|
+
const dashIndex = rest.indexOf("-");
|
|
103
|
+
const marker = dashIndex === -1 ? rest : rest.slice(0, dashIndex);
|
|
104
|
+
if (marker === "") return { kind: "none" };
|
|
105
|
+
return isIsoCurrencyCodeShape(marker) ? {
|
|
106
|
+
kind: "currency",
|
|
107
|
+
code: marker.toUpperCase()
|
|
108
|
+
} : { kind: "currency" };
|
|
109
|
+
}
|
|
110
|
+
return isElapsedBracketBody(body) ? { kind: "elapsed" } : { kind: "none" };
|
|
111
|
+
}
|
|
112
|
+
const AMPM_MARKERS = ["am/pm", "a/p"];
|
|
113
|
+
const AMPM_LETTER = "ampm";
|
|
114
|
+
function matchesAt(chars, index, marker) {
|
|
115
|
+
return [...marker].every((char, offset) => at(chars, index + offset).toLowerCase() === char);
|
|
116
|
+
}
|
|
117
|
+
function codeRunsOf(section) {
|
|
118
|
+
const chars = [];
|
|
119
|
+
for (const token of section) if (token.kind === "code") chars.push(token.char);
|
|
120
|
+
const runs = [];
|
|
121
|
+
let index = 0;
|
|
122
|
+
while (index < chars.length) {
|
|
123
|
+
const marker = AMPM_MARKERS.find((candidate) => matchesAt(chars, index, candidate));
|
|
124
|
+
if (marker !== void 0) {
|
|
125
|
+
runs.push({
|
|
126
|
+
letter: AMPM_LETTER,
|
|
127
|
+
length: marker.length
|
|
128
|
+
});
|
|
129
|
+
index += marker.length;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
const char = at(chars, index).toLowerCase();
|
|
133
|
+
let length = 0;
|
|
134
|
+
while (index + length < chars.length && at(chars, index + length).toLowerCase() === char) length += 1;
|
|
135
|
+
runs.push({
|
|
136
|
+
letter: char,
|
|
137
|
+
length
|
|
138
|
+
});
|
|
139
|
+
index += length;
|
|
140
|
+
}
|
|
141
|
+
return runs;
|
|
142
|
+
}
|
|
143
|
+
const RESOLVING_LETTERS = [
|
|
144
|
+
"y",
|
|
145
|
+
"d",
|
|
146
|
+
"h",
|
|
147
|
+
"s"
|
|
148
|
+
];
|
|
149
|
+
function nearestResolvingLetter(runs, from, step) {
|
|
150
|
+
for (let index = from + step; index >= 0 && index < runs.length; index += step) {
|
|
151
|
+
const run = runs[index];
|
|
152
|
+
if (run !== void 0 && RESOLVING_LETTERS.includes(run.letter)) return run.letter;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function monthRunIsMinutes(runs, index) {
|
|
156
|
+
return nearestResolvingLetter(runs, index, -1) === "h" || nearestResolvingLetter(runs, index, 1) === "s";
|
|
157
|
+
}
|
|
158
|
+
const PLAIN_NUMBER = { kind: "number" };
|
|
159
|
+
const NUMERIC_CODES = [
|
|
160
|
+
"0",
|
|
161
|
+
"#",
|
|
162
|
+
"?",
|
|
163
|
+
".",
|
|
164
|
+
","
|
|
165
|
+
];
|
|
166
|
+
function collectSignals(section) {
|
|
167
|
+
const signals = {
|
|
168
|
+
hasDate: false,
|
|
169
|
+
hasTime: false,
|
|
170
|
+
hasElapsed: false,
|
|
171
|
+
hasPercent: false,
|
|
172
|
+
hasNumeric: false,
|
|
173
|
+
hasText: false,
|
|
174
|
+
hasCurrency: false
|
|
175
|
+
};
|
|
176
|
+
for (const token of section) {
|
|
177
|
+
if (token.kind === "literal" && containsCurrencySymbol(token.text)) signals.hasCurrency = true;
|
|
178
|
+
if (token.kind === "bracket") {
|
|
179
|
+
const meaning = classifyBracket(token.body);
|
|
180
|
+
if (meaning.kind === "elapsed") signals.hasElapsed = true;
|
|
181
|
+
if (meaning.kind === "currency") {
|
|
182
|
+
signals.hasCurrency = true;
|
|
183
|
+
if (signals.currencyCode === void 0 && meaning.code !== void 0) signals.currencyCode = meaning.code;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
const runs = codeRunsOf(section);
|
|
188
|
+
runs.forEach((run, index) => {
|
|
189
|
+
if (run.letter === "y" || run.letter === "d") {
|
|
190
|
+
signals.hasDate = true;
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (run.letter === "h" || run.letter === "s" || run.letter === AMPM_LETTER) {
|
|
194
|
+
signals.hasTime = true;
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (run.letter === "m") {
|
|
198
|
+
if (run.length <= 2 && monthRunIsMinutes(runs, index)) signals.hasTime = true;
|
|
199
|
+
else signals.hasDate = true;
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
if (run.letter === "e") {
|
|
203
|
+
const next = runs[index + 1];
|
|
204
|
+
signals.hasNumeric = signals.hasNumeric || next?.letter === "+" || next?.letter === "-";
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (run.letter === "%") {
|
|
208
|
+
signals.hasPercent = true;
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
if (run.letter === "@") {
|
|
212
|
+
signals.hasText = true;
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (NUMERIC_CODES.includes(run.letter)) {
|
|
216
|
+
signals.hasNumeric = true;
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
if (containsCurrencySymbol(run.letter)) signals.hasCurrency = true;
|
|
220
|
+
});
|
|
221
|
+
return signals;
|
|
222
|
+
}
|
|
223
|
+
function classifySection(section) {
|
|
224
|
+
const signals = collectSignals(section);
|
|
225
|
+
if (signals.hasElapsed) return { kind: "elapsedTime" };
|
|
226
|
+
if (signals.hasDate) return signals.hasTime ? { kind: "dateTime" } : { kind: "date" };
|
|
227
|
+
if (signals.hasTime) return { kind: "time" };
|
|
228
|
+
if (signals.hasPercent) return { kind: "percentage" };
|
|
229
|
+
if (signals.hasCurrency) {
|
|
230
|
+
const code = signals.currencyCode;
|
|
231
|
+
return code === void 0 ? { kind: "currency" } : {
|
|
232
|
+
kind: "currency",
|
|
233
|
+
code
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
if (signals.hasText && !signals.hasNumeric) return { kind: "text" };
|
|
237
|
+
return PLAIN_NUMBER;
|
|
238
|
+
}
|
|
239
|
+
function classifyNumberFormat(formatCode) {
|
|
240
|
+
const first = splitNumberFormatSections(tokenizeNumberFormat(formatCode))[0];
|
|
241
|
+
return first === void 0 ? PLAIN_NUMBER : classifySection(first);
|
|
242
|
+
}
|
|
243
|
+
const BUILTIN_NUMBER_FORMATS = /* @__PURE__ */ new Map([
|
|
244
|
+
[0, "General"],
|
|
245
|
+
[1, "0"],
|
|
246
|
+
[2, "0.00"],
|
|
247
|
+
[3, "#,##0"],
|
|
248
|
+
[4, "#,##0.00"],
|
|
249
|
+
[5, "$#,##0_);($#,##0)"],
|
|
250
|
+
[6, "$#,##0_);[Red]($#,##0)"],
|
|
251
|
+
[7, "$#,##0.00_);($#,##0.00)"],
|
|
252
|
+
[8, "$#,##0.00_);[Red]($#,##0.00)"],
|
|
253
|
+
[9, "0%"],
|
|
254
|
+
[10, "0.00%"],
|
|
255
|
+
[11, "0.00E+00"],
|
|
256
|
+
[12, "# ?/?"],
|
|
257
|
+
[13, "# ??/??"],
|
|
258
|
+
[14, "mm-dd-yy"],
|
|
259
|
+
[15, "d-mmm-yy"],
|
|
260
|
+
[16, "d-mmm"],
|
|
261
|
+
[17, "mmm-yy"],
|
|
262
|
+
[18, "h:mm AM/PM"],
|
|
263
|
+
[19, "h:mm:ss AM/PM"],
|
|
264
|
+
[20, "h:mm"],
|
|
265
|
+
[21, "h:mm:ss"],
|
|
266
|
+
[22, "m/d/yy h:mm"],
|
|
267
|
+
[37, "#,##0 ;(#,##0)"],
|
|
268
|
+
[38, "#,##0 ;[Red](#,##0)"],
|
|
269
|
+
[39, "#,##0.00;(#,##0.00)"],
|
|
270
|
+
[40, "#,##0.00;[Red](#,##0.00)"],
|
|
271
|
+
[41, "_(* #,##0_);_(* \\(#,##0\\);_(* \"-\"_);_(@_)"],
|
|
272
|
+
[42, "_(\"$\"* #,##0_);_(\"$\"* \\(#,##0\\);_(\"$\"* \"-\"_);_(@_)"],
|
|
273
|
+
[43, "_(* #,##0.00_);_(* \\(#,##0.00\\);_(* \"-\"??_);_(@_)"],
|
|
274
|
+
[44, "_(\"$\"* #,##0.00_);_(\"$\"* \\(#,##0.00\\);_(\"$\"* \"-\"??_);_(@_)"],
|
|
275
|
+
[45, "mm:ss"],
|
|
276
|
+
[46, "[h]:mm:ss"],
|
|
277
|
+
[47, "mmss.0"],
|
|
278
|
+
[48, "##0.0E+0"],
|
|
279
|
+
[49, "@"]
|
|
280
|
+
]);
|
|
281
|
+
const PERCENTAGE_NUMBER_FORMAT = {
|
|
282
|
+
kind: "builtin",
|
|
283
|
+
id: 10
|
|
284
|
+
};
|
|
285
|
+
const TIME_NUMBER_FORMAT = {
|
|
286
|
+
kind: "builtin",
|
|
287
|
+
id: 21
|
|
288
|
+
};
|
|
289
|
+
const AMOUNT_NUMBER_FORMAT = {
|
|
290
|
+
kind: "builtin",
|
|
291
|
+
id: 4
|
|
292
|
+
};
|
|
293
|
+
const DATE_NUMBER_FORMAT = {
|
|
294
|
+
kind: "custom",
|
|
295
|
+
code: "yyyy\\-mm\\-dd"
|
|
296
|
+
};
|
|
297
|
+
const DATE_TIME_NUMBER_FORMAT = {
|
|
298
|
+
kind: "custom",
|
|
299
|
+
code: "yyyy\\-mm\\-dd hh:mm:ss"
|
|
300
|
+
};
|
|
301
|
+
const BOOLEAN_NUMBER_FORMAT = {
|
|
302
|
+
kind: "custom",
|
|
303
|
+
code: "\"TRUE\";\"TRUE\";\"FALSE\""
|
|
304
|
+
};
|
|
305
|
+
function currencyNumberFormat(code) {
|
|
306
|
+
if (code === void 0 || !isIsoCurrencyCodeShape(code)) return AMOUNT_NUMBER_FORMAT;
|
|
307
|
+
return {
|
|
308
|
+
kind: "custom",
|
|
309
|
+
code: `[$${code.toUpperCase()}]#,##0.00`
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
//#endregion
|
|
313
|
+
exports.AMOUNT_NUMBER_FORMAT = AMOUNT_NUMBER_FORMAT;
|
|
314
|
+
exports.BOOLEAN_NUMBER_FORMAT = BOOLEAN_NUMBER_FORMAT;
|
|
315
|
+
exports.BUILTIN_NUMBER_FORMATS = BUILTIN_NUMBER_FORMATS;
|
|
316
|
+
exports.DATE_NUMBER_FORMAT = DATE_NUMBER_FORMAT;
|
|
317
|
+
exports.DATE_TIME_NUMBER_FORMAT = DATE_TIME_NUMBER_FORMAT;
|
|
318
|
+
exports.MAX_NUMBER_FORMAT_SECTIONS = MAX_NUMBER_FORMAT_SECTIONS;
|
|
319
|
+
exports.PERCENTAGE_NUMBER_FORMAT = PERCENTAGE_NUMBER_FORMAT;
|
|
320
|
+
exports.TIME_NUMBER_FORMAT = TIME_NUMBER_FORMAT;
|
|
321
|
+
exports.classifyNumberFormat = classifyNumberFormat;
|
|
322
|
+
exports.currencyNumberFormat = currencyNumberFormat;
|
|
323
|
+
exports.splitNumberFormatSections = splitNumberFormatSections;
|
|
324
|
+
exports.tokenizeNumberFormat = tokenizeNumberFormat;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//#region src/typed/xlsx/number-format.d.ts
|
|
2
|
+
type NumberFormatToken = {
|
|
3
|
+
kind: 'literal';
|
|
4
|
+
text: string;
|
|
5
|
+
} | {
|
|
6
|
+
kind: 'bracket';
|
|
7
|
+
body: string;
|
|
8
|
+
} | {
|
|
9
|
+
kind: 'separator';
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'code';
|
|
12
|
+
char: string;
|
|
13
|
+
};
|
|
14
|
+
declare const MAX_NUMBER_FORMAT_SECTIONS = 4;
|
|
15
|
+
declare function tokenizeNumberFormat(formatCode: string): NumberFormatToken[];
|
|
16
|
+
declare function splitNumberFormatSections(tokens: readonly NumberFormatToken[]): NumberFormatToken[][];
|
|
17
|
+
type NumberFormatClass = {
|
|
18
|
+
kind: 'number';
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'text';
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'percentage';
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'currency';
|
|
25
|
+
code?: string;
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'date';
|
|
28
|
+
} | {
|
|
29
|
+
kind: 'time';
|
|
30
|
+
} | {
|
|
31
|
+
kind: 'dateTime';
|
|
32
|
+
} | {
|
|
33
|
+
kind: 'elapsedTime';
|
|
34
|
+
};
|
|
35
|
+
declare function classifyNumberFormat(formatCode: string): NumberFormatClass;
|
|
36
|
+
declare const BUILTIN_NUMBER_FORMATS: ReadonlyMap<number, string>;
|
|
37
|
+
type CellNumberFormat = {
|
|
38
|
+
kind: 'builtin';
|
|
39
|
+
id: number;
|
|
40
|
+
} | {
|
|
41
|
+
kind: 'custom';
|
|
42
|
+
code: string;
|
|
43
|
+
};
|
|
44
|
+
declare const PERCENTAGE_NUMBER_FORMAT: CellNumberFormat;
|
|
45
|
+
declare const TIME_NUMBER_FORMAT: CellNumberFormat;
|
|
46
|
+
declare const AMOUNT_NUMBER_FORMAT: CellNumberFormat;
|
|
47
|
+
declare const DATE_NUMBER_FORMAT: CellNumberFormat;
|
|
48
|
+
declare const DATE_TIME_NUMBER_FORMAT: CellNumberFormat;
|
|
49
|
+
declare const BOOLEAN_NUMBER_FORMAT: CellNumberFormat;
|
|
50
|
+
declare function currencyNumberFormat(code: string | undefined): CellNumberFormat;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { AMOUNT_NUMBER_FORMAT, BOOLEAN_NUMBER_FORMAT, BUILTIN_NUMBER_FORMATS, CellNumberFormat, DATE_NUMBER_FORMAT, DATE_TIME_NUMBER_FORMAT, MAX_NUMBER_FORMAT_SECTIONS, NumberFormatClass, NumberFormatToken, PERCENTAGE_NUMBER_FORMAT, TIME_NUMBER_FORMAT, classifyNumberFormat, currencyNumberFormat, splitNumberFormatSections, tokenizeNumberFormat };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//#region src/typed/xlsx/number-format.d.ts
|
|
2
|
+
type NumberFormatToken = {
|
|
3
|
+
kind: 'literal';
|
|
4
|
+
text: string;
|
|
5
|
+
} | {
|
|
6
|
+
kind: 'bracket';
|
|
7
|
+
body: string;
|
|
8
|
+
} | {
|
|
9
|
+
kind: 'separator';
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'code';
|
|
12
|
+
char: string;
|
|
13
|
+
};
|
|
14
|
+
declare const MAX_NUMBER_FORMAT_SECTIONS = 4;
|
|
15
|
+
declare function tokenizeNumberFormat(formatCode: string): NumberFormatToken[];
|
|
16
|
+
declare function splitNumberFormatSections(tokens: readonly NumberFormatToken[]): NumberFormatToken[][];
|
|
17
|
+
type NumberFormatClass = {
|
|
18
|
+
kind: 'number';
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'text';
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'percentage';
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'currency';
|
|
25
|
+
code?: string;
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'date';
|
|
28
|
+
} | {
|
|
29
|
+
kind: 'time';
|
|
30
|
+
} | {
|
|
31
|
+
kind: 'dateTime';
|
|
32
|
+
} | {
|
|
33
|
+
kind: 'elapsedTime';
|
|
34
|
+
};
|
|
35
|
+
declare function classifyNumberFormat(formatCode: string): NumberFormatClass;
|
|
36
|
+
declare const BUILTIN_NUMBER_FORMATS: ReadonlyMap<number, string>;
|
|
37
|
+
type CellNumberFormat = {
|
|
38
|
+
kind: 'builtin';
|
|
39
|
+
id: number;
|
|
40
|
+
} | {
|
|
41
|
+
kind: 'custom';
|
|
42
|
+
code: string;
|
|
43
|
+
};
|
|
44
|
+
declare const PERCENTAGE_NUMBER_FORMAT: CellNumberFormat;
|
|
45
|
+
declare const TIME_NUMBER_FORMAT: CellNumberFormat;
|
|
46
|
+
declare const AMOUNT_NUMBER_FORMAT: CellNumberFormat;
|
|
47
|
+
declare const DATE_NUMBER_FORMAT: CellNumberFormat;
|
|
48
|
+
declare const DATE_TIME_NUMBER_FORMAT: CellNumberFormat;
|
|
49
|
+
declare const BOOLEAN_NUMBER_FORMAT: CellNumberFormat;
|
|
50
|
+
declare function currencyNumberFormat(code: string | undefined): CellNumberFormat;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { AMOUNT_NUMBER_FORMAT, BOOLEAN_NUMBER_FORMAT, BUILTIN_NUMBER_FORMATS, CellNumberFormat, DATE_NUMBER_FORMAT, DATE_TIME_NUMBER_FORMAT, MAX_NUMBER_FORMAT_SECTIONS, NumberFormatClass, NumberFormatToken, PERCENTAGE_NUMBER_FORMAT, TIME_NUMBER_FORMAT, classifyNumberFormat, currencyNumberFormat, splitNumberFormatSections, tokenizeNumberFormat };
|