@univerjs/core 1.0.0-alpha.3 → 1.0.0-alpha.5

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.
Files changed (36) hide show
  1. package/lib/cjs/index.js +3899 -92
  2. package/lib/es/index.js +3902 -93
  3. package/lib/index.js +3902 -93
  4. package/lib/types/docs/data-model/index.d.ts +2 -1
  5. package/lib/types/docs/data-model/rich-text-builder.d.ts +186 -0
  6. package/lib/types/docs/data-model/text-x/build-utils/drawings.d.ts +2 -2
  7. package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +1 -0
  8. package/lib/types/shared/numfmt/api.d.ts +82 -0
  9. package/lib/types/shared/numfmt/clamp.d.ts +16 -0
  10. package/lib/types/shared/numfmt/code-to-locale.d.ts +16 -0
  11. package/lib/types/shared/numfmt/constants.d.ts +68 -0
  12. package/lib/types/shared/numfmt/dec-to-frac.d.ts +26 -0
  13. package/lib/types/shared/numfmt/decimal.d.ts +37 -0
  14. package/lib/types/shared/numfmt/format-info.d.ts +21 -0
  15. package/lib/types/shared/numfmt/format-number.d.ts +18 -0
  16. package/lib/types/shared/numfmt/general.d.ts +18 -0
  17. package/lib/types/shared/numfmt/index.d.ts +18 -0
  18. package/lib/types/shared/numfmt/locale.d.ts +89 -0
  19. package/lib/types/shared/numfmt/num-dec.d.ts +17 -0
  20. package/lib/types/shared/numfmt/number-props.d.ts +17 -0
  21. package/lib/types/shared/numfmt/options.d.ts +17 -0
  22. package/lib/types/shared/numfmt/pad.d.ts +22 -0
  23. package/lib/types/shared/numfmt/parse-format-section.d.ts +17 -0
  24. package/lib/types/shared/numfmt/parse-pattern.d.ts +18 -0
  25. package/lib/types/shared/numfmt/parse-value.d.ts +30 -0
  26. package/lib/types/shared/numfmt/round.d.ts +26 -0
  27. package/lib/types/shared/numfmt/run-part.d.ts +18 -0
  28. package/lib/types/shared/numfmt/serial-date.d.ts +32 -0
  29. package/lib/types/shared/numfmt/to-ymd.d.ts +20 -0
  30. package/lib/types/shared/numfmt/tokenize.d.ts +20 -0
  31. package/lib/types/shared/numfmt/types.d.ts +193 -0
  32. package/lib/types/shared/{numfmt.d.ts → numfmt/utils.d.ts} +3 -4
  33. package/lib/types/types/interfaces/i-document-data.d.ts +4 -0
  34. package/lib/types/types/interfaces/i-style-data.d.ts +3 -1
  35. package/lib/umd/index.js +21 -19
  36. package/package.json +4 -5
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { LocaleData, LocaleSettings, LocaleToken } from './types';
17
+ /**
18
+ * @typedef {object} LocaleToken - An object of properties for a locale tag.
19
+ * @property {string} lang - The basic tag such as `zh_CN` or `fi`
20
+ * @property {string} language - The language section (`zh` for `zh_CN`)
21
+ * @property {string} territory - The territory section (`CN` for `zh_CN`)
22
+ */
23
+ /**
24
+ * Parse a regular IETF BCP 47 locale tag and emit an object of its parts.
25
+ * Irregular tags and subtags are not supported.
26
+ *
27
+ * @param {string} locale - A BCP 47 string tag of the locale.
28
+ * @returns {LocaleToken} - An object describing the locale.
29
+ */
30
+ export declare function parseLocale(locale: string): LocaleToken;
31
+ export declare function resolveLocale(locale: string | number): string | null;
32
+ /**
33
+ * Used by the formatter to pull a locate from its registered locales. If
34
+ * subtag isn't available but the base language is, the base language is used.
35
+ * So if `en-CA` is not found, the formatter tries to find `en` else it
36
+ * returns a `null`.
37
+ *
38
+ * @param {string} locale - A BCP 47 string tag of the locale, or an Excel locale code.
39
+ * @returns {LocaleData | null} - An object of format date properties.
40
+ */
41
+ export declare function getLocale(locale: string | number): LocaleData | null;
42
+ export declare function createLocale(settings: LocaleSettings): LocaleData;
43
+ /**
44
+ * Register locale data for a language so for use when formatting.
45
+ *
46
+ * Any partial set of properties may be returned to have the defaults used where properties are missing.
47
+ *
48
+ * @see {LocaleData}
49
+ * @param {object} settings - A collection of settings for a locale.
50
+ * @param {string} [settings.group]
51
+ * Symbol used as a grouping separator (`1,000,000` uses `,`)
52
+ * @param {string} [settings.decimal]
53
+ * Symbol used to separate integers from fractions (usually `.`)
54
+ * @param {string} [settings.positive]
55
+ * Symbol used to indicate positive numbers (usually `+`)
56
+ * @param {string} [settings.negative]
57
+ * Symbol used to indicate positive numbers (usually `-`)
58
+ * @param {string} [settings.percent]
59
+ * Symbol used to indicate a percentage (usually `%`)
60
+ * @param {string} [settings.exponent]
61
+ * Symbol used to indicate an exponent (usually `E`)
62
+ * @param {string} [settings.nan]
63
+ * Symbol used to indicate NaN values (`NaN`)
64
+ * @param {string} [settings.infinity]
65
+ * Symbol used to indicate infinite values (`∞`)
66
+ * @param {Array<string>} [settings.ampm]
67
+ * How AM and PM should be presented.
68
+ * @param {Array<string>} [settings.mmmm6]
69
+ * Long month names for the Islamic calendar (e.g. `Rajab`)
70
+ * @param {Array<string>} [settings.mmm6]
71
+ * Short month names for the Islamic calendar (e.g. `Raj.`)
72
+ * @param {Array<string>} [settings.mmmm]
73
+ * Long month names for the Gregorian calendar (e.g. `November`)
74
+ * @param {Array<string>} [settings.mmm]
75
+ * Short month names for the Gregorian calendar (e.g. `Nov`)
76
+ * @param {Array<string>} [settings.dddd]
77
+ * Long day names (e.g. `Wednesday`)
78
+ * @param {Array<string>} [settings.ddd]
79
+ * Shortened day names (e.g. `Wed`)
80
+ * @param {Array<string>} [settings.bool]
81
+ * How TRUE and FALSE should be presented.
82
+ * @param {boolean} [settings.preferMDY]
83
+ * Is the prefered date format month first (12/31/2025) or day first (31/12/2025)
84
+ * @param {string | LocaleToken} locale - A string BCP 47 tag or parsed locale token.
85
+ * @returns {LocaleData} - A full collection of settings for a locale
86
+ */
87
+ export declare function addLocale(settings: LocaleSettings, locale: string | LocaleToken): LocaleData;
88
+ export declare function listLocales(): string[];
89
+ export declare const defaultLocale: LocaleData;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { NumberDigits } from './types';
17
+ export declare function numDec(value: number, includeSign?: boolean): NumberDigits;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export declare function getExponent(number: number, intMax?: number): number;
17
+ export declare function getSignificand(number: number, exponent?: number): number;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { ResolvedFormatOptions } from './types';
17
+ export declare const defaultOptions: Readonly<ResolvedFormatOptions>;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * @ignore
18
+ * @param {string} char Instruction character (['#', '?', '0'])
19
+ * @param {boolean} [nbsp] Use nonbreaking space or not?
20
+ * @returns {string} Padding character
21
+ */
22
+ export declare function pad(char: string, nbsp?: boolean): string;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { FormatToken, ParsedFormatSection } from './types';
17
+ export declare function parseFormatSection(inputTokens: FormatToken[]): ParsedFormatSection;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { ParsedPattern } from './types';
17
+ export declare function parsePattern(pattern: string): ParsedPattern;
18
+ export declare function parseCatch(pattern: string): ParsedPattern;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { ParseData } from './types';
17
+ export interface ParseOptions {
18
+ locale?: string;
19
+ }
20
+ /** Parse a numeric string and return its value and inferred format. */
21
+ export declare function parseNumber(value: string, options?: ParseOptions): ParseData<number> | null;
22
+ export declare function isValidDate(year: number, month: number, day: number): boolean;
23
+ /** Parse a date or datetime string and return its serial value and format. */
24
+ export declare function parseDate(value: string, options?: ParseOptions): ParseData<number> | null;
25
+ /** Parse a time string and return its day fraction and inferred format. */
26
+ export declare function parseTime(value: string, options?: ParseOptions): ParseData<number> | null;
27
+ /** Parse a localized or English boolean string. */
28
+ export declare function parseBool(value: string, options?: ParseOptions): ParseData<boolean> | null;
29
+ /** Parse a spreadsheet input as a number, date, time, or boolean. */
30
+ export declare function parseValue(value: string, options?: ParseOptions): ParseData | null;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Return a number rounded to the specified amount of places. This is the
18
+ * rounding function used internally by the formatter (symmetric arithmetic
19
+ * rounding).
20
+ *
21
+ * @param {number} number - The number to round.
22
+ * @param {number} [places] - The number of decimals to round to.
23
+ * @returns {number} A rounded number.
24
+ */
25
+ export declare function round(number: number, places?: number): number;
26
+ export declare function round(number: unknown, places?: number): unknown;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { IDecimalValue } from './decimal';
17
+ import type { FormatSection, LocaleData, ResolvedFormatOptions } from './types';
18
+ export declare function runPart(value: unknown, part: FormatSection, options: ResolvedFormatOptions, locale?: LocaleData | null, decimalValue?: IDecimalValue | null): string;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { DateTimeParts } from './types';
17
+ /**
18
+ * Convert a native JavaScript Date, or array to a spreadsheet serial date.
19
+ *
20
+ * Returns a serial date number if input was a Date object or an array of
21
+ * numbers, or null.
22
+ */
23
+ export declare function dateToSerial(date: unknown, options?: {
24
+ ignoreTimezone?: boolean;
25
+ }): number | null;
26
+ /**
27
+ * Convert a spreadsheet serial date to an array of date parts, accurate to a
28
+ * second.
29
+ */
30
+ export declare function dateFromSerial(serial: number, options?: {
31
+ leap1900?: boolean;
32
+ }): DateTimeParts;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { DateParts } from './types';
17
+ export declare function toYMD1900(serial: number, leap1900?: boolean): DateParts;
18
+ export declare function toYMD1904(serial: number): DateParts;
19
+ export declare function toYMD1317(serial: number): DateParts;
20
+ export declare function toYMD(serial: number, system?: number, leap1900?: boolean): DateParts;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { FormatToken } from './types';
17
+ /**
18
+ * Breaks a format pattern string into a list of tokens.
19
+ */
20
+ export declare function tokenize(pattern: string): FormatToken[];
@@ -0,0 +1,193 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export type ConditionOperator = '<' | '<=' | '=' | '>=' | '>' | '<>';
17
+ export type FormatCondition = [ConditionOperator, number];
18
+ export interface LocaleToken {
19
+ lang: string;
20
+ language: string;
21
+ territory: string;
22
+ }
23
+ export interface LocaleData {
24
+ group: string;
25
+ decimal: string;
26
+ positive: string;
27
+ negative: string;
28
+ percent: string;
29
+ exponent: string;
30
+ nan: string;
31
+ infinity: string;
32
+ ampm: string[];
33
+ mmmm6: string[];
34
+ mmm6: string[];
35
+ mmmm: string[];
36
+ mmm: string[];
37
+ dddd: string[];
38
+ ddd: string[];
39
+ bool: string[];
40
+ preferMDY: boolean;
41
+ isDefault?: boolean;
42
+ }
43
+ export type LocaleSettings = Partial<Omit<LocaleData, 'isDefault'>>;
44
+ export interface ParseData<T extends number | boolean = number | boolean> {
45
+ v: T;
46
+ z?: string;
47
+ }
48
+ export interface NumberDigits {
49
+ total: number;
50
+ digits?: number;
51
+ sign: number;
52
+ period: number;
53
+ int: number;
54
+ frac: number;
55
+ }
56
+ export interface FormatOptions {
57
+ overflow?: string;
58
+ dateErrorThrows?: boolean;
59
+ dateErrorNumber?: boolean;
60
+ bigintErrorNumber?: boolean;
61
+ dateSpanLarge?: boolean;
62
+ leap1900?: boolean;
63
+ nbsp?: boolean;
64
+ throws?: boolean;
65
+ invalid?: string;
66
+ locale?: string;
67
+ ignoreTimezone?: boolean;
68
+ grouping?: readonly [number, number?];
69
+ indexColors?: boolean;
70
+ skipChar?: string | boolean;
71
+ fillChar?: string | boolean;
72
+ }
73
+ export interface ResolvedFormatOptions {
74
+ overflow: string;
75
+ dateErrorThrows: boolean;
76
+ dateErrorNumber: boolean;
77
+ bigintErrorNumber: boolean;
78
+ dateSpanLarge: boolean;
79
+ leap1900: boolean;
80
+ nbsp: boolean;
81
+ throws: boolean;
82
+ invalid: string;
83
+ locale: string;
84
+ ignoreTimezone: boolean;
85
+ grouping: readonly [number, number?];
86
+ indexColors: boolean;
87
+ skipChar: string | boolean;
88
+ fillChar: string | boolean;
89
+ }
90
+ export interface FormatToken {
91
+ raw: string;
92
+ type: string;
93
+ value: any;
94
+ short?: boolean;
95
+ }
96
+ export interface RenderToken {
97
+ type: string;
98
+ raw?: string;
99
+ value?: string | string[];
100
+ num?: string;
101
+ rule?: 'num' | 'num+int' | 'den';
102
+ volatile?: boolean;
103
+ plus?: boolean;
104
+ size?: number;
105
+ date?: 1;
106
+ pad?: boolean | number;
107
+ decimals?: number;
108
+ short?: boolean;
109
+ }
110
+ export interface ParsedFormatSection {
111
+ scale: number;
112
+ scaleExponent: number;
113
+ percent: boolean;
114
+ text: boolean;
115
+ date: number;
116
+ date_eval: boolean;
117
+ date_system: number;
118
+ sec_decimals: number;
119
+ general: boolean;
120
+ clock: 12 | 24;
121
+ int_pattern: string[];
122
+ frac_pattern: string[];
123
+ man_pattern: string[];
124
+ den_pattern: string[];
125
+ num_pattern: string[];
126
+ tokens: RenderToken[];
127
+ tokensUsed: number;
128
+ pattern: string;
129
+ int_max: number;
130
+ int_min: number;
131
+ frac_max: number;
132
+ frac_min: number;
133
+ man_max: number;
134
+ man_min: number;
135
+ num_max: number;
136
+ num_min: number;
137
+ den_max: number;
138
+ den_min: number;
139
+ int_p: string;
140
+ man_p: string;
141
+ num_p: string;
142
+ den_p: string;
143
+ integer: boolean;
144
+ parens?: boolean;
145
+ fractions?: boolean;
146
+ grouping?: boolean;
147
+ condition?: FormatCondition | null;
148
+ locale?: string;
149
+ color?: string | number;
150
+ dec_fractions?: boolean;
151
+ exponential?: boolean;
152
+ exp_plus?: boolean;
153
+ denominator?: number;
154
+ }
155
+ export interface ErrorFormatSection {
156
+ tokens: RenderToken[];
157
+ error: string;
158
+ }
159
+ export type FormatSection = ParsedFormatSection | ErrorFormatSection;
160
+ export interface ParsedPattern {
161
+ pattern: string;
162
+ partitions: Array<FormatSection | undefined>;
163
+ locale?: string | null;
164
+ error?: string;
165
+ info?: FormatInfo;
166
+ dateInfo?: FormatDateInfo;
167
+ }
168
+ export interface FormatDateInfo {
169
+ year: boolean;
170
+ month: boolean;
171
+ day: boolean;
172
+ hours: boolean;
173
+ minutes: boolean;
174
+ seconds: boolean;
175
+ clockType: 12 | 24;
176
+ }
177
+ export type FormatInfoType = 'currency' | 'date' | 'datetime' | 'error' | 'fraction' | 'general' | 'grouped' | 'number' | 'percent' | 'scientific' | 'text' | 'time';
178
+ export interface FormatInfo {
179
+ type: FormatInfoType;
180
+ isDate: boolean;
181
+ isText: boolean;
182
+ isPercent: boolean;
183
+ maxDecimals: number;
184
+ color: 0 | 1;
185
+ parentheses: 0 | 1;
186
+ grouped: 0 | 1;
187
+ code: string;
188
+ scale: number;
189
+ level: number;
190
+ }
191
+ export type DateParts = [number, number, number];
192
+ export type DateTimeParts = [number, number, number, number, number, number];
193
+ export type FormatColor = string | number | null;
@@ -13,12 +13,11 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import * as numfmt from 'numfmt';
17
- export * as numfmt from 'numfmt';
16
+ import type { ParseData } from './api';
18
17
  export declare const DEFAULT_TEXT_FORMAT = "@@@";
19
18
  export declare const DEFAULT_TEXT_FORMAT_EXCEL = "@";
20
19
  export declare const DEFAULT_NUMBER_FORMAT = "General";
21
- export declare function isTextFormat(pattern: string | undefined): pattern is "@@@" | "@";
20
+ export declare function isTextFormat(pattern: string | undefined): pattern is "@" | "@@@";
22
21
  export declare function isDefaultFormat(pattern?: string | null): pattern is "General" | null | undefined;
23
22
  export type INumfmtLocaleTag = 'zh-CN' | 'zh-TW' | 'zh-HK' | 'ar' | 'cs' | 'da' | 'nl' | 'en' | 'fi' | 'fr' | 'de' | 'el' | 'hu' | 'is' | 'id' | 'it' | 'ja' | 'ko' | 'nb' | 'pl' | 'pt' | 'ru' | 'sk' | 'es' | 'sv' | 'th' | 'tr' | 'vi';
24
23
  /**
@@ -31,4 +30,4 @@ export declare const currencySymbols: string[];
31
30
  /**
32
31
  * Get the numfmt parse value, and filter out the parse error.
33
32
  */
34
- export declare const getNumfmtParseValueFilter: (value: string) => numfmt.ParseData | null;
33
+ export declare const getNumfmtParseValueFilter: (value: string) => ParseData | null;
@@ -584,6 +584,10 @@ export interface IDocDrawingPosition {
584
584
  positionH: IObjectPositionH;
585
585
  positionV: IObjectPositionV;
586
586
  angle: number;
587
+ /** Horizontal flip persisted with the document drawing transform. */
588
+ flipX?: boolean;
589
+ /** Vertical flip persisted with the document drawing transform. */
590
+ flipY?: boolean;
587
591
  }
588
592
  /**
589
593
  * ChartProperties
@@ -227,6 +227,8 @@ export interface IStyleBase {
227
227
  * Properties of cell style
228
228
  */
229
229
  export interface IStyleData extends IStyleBase {
230
+ /** Whether the font size should shrink to fit the cell width. */
231
+ stf?: BooleanNumber;
230
232
  /**
231
233
  * textRotation
232
234
  */
@@ -256,7 +258,7 @@ export interface IStyleData extends IStyleBase {
256
258
  /**
257
259
  * Exact keys of {@link IStyleData}.
258
260
  */
259
- export declare const STYLE_KEYS: readonly ["ff", "fs", "it", "bl", "ul", "bbl", "st", "ol", "bg", "bd", "cl", "va", "n", "tr", "td", "ht", "vt", "tb", "pd"];
261
+ export declare const STYLE_KEYS: readonly ["ff", "fs", "it", "bl", "ul", "bbl", "st", "ol", "bg", "bd", "cl", "va", "n", "stf", "tr", "td", "ht", "vt", "tb", "pd"];
260
262
  /**
261
263
  * Key union of {@link IStyleData}.
262
264
  */