@syncfusion/ej2-base 19.2.57 → 19.3.53
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/.eslintrc.json +1 -1
- package/CHANGELOG.md +2 -90
- package/{ReadMe.md → README.md} +1 -1
- package/dist/ej2-base.umd.min.js +10 -1
- package/dist/ej2-base.umd.min.js.map +1 -1
- package/dist/es6/ej2-base.es2015.js +2650 -2401
- package/dist/es6/ej2-base.es2015.js.map +1 -1
- package/dist/es6/ej2-base.es5.js +3186 -2948
- package/dist/es6/ej2-base.es5.js.map +1 -1
- package/dist/global/ej2-base.min.js +10 -1
- package/dist/global/ej2-base.min.js.map +1 -1
- package/dist/global/index.d.ts +9 -0
- package/e2e/crypto.js +1 -1
- package/e2e/index.d.ts +0 -3
- package/e2e/m.protractor.config.js +1 -1
- package/e2e/protractor.config.js +1 -1
- package/helpers/e2e/base.js +3 -3
- package/package.json +212 -212
- package/src/ajax.d.ts +24 -10
- package/src/ajax.js +14 -6
- package/src/animation-model.d.ts +12 -4
- package/src/animation.d.ts +37 -12
- package/src/animation.js +48 -22
- package/src/base.d.ts +31 -11
- package/src/base.js +34 -16
- package/src/browser.d.ts +63 -25
- package/src/browser.js +60 -15
- package/src/child-property.d.ts +21 -10
- package/src/child-property.js +23 -13
- package/src/component-model.d.ts +4 -1
- package/src/component.d.ts +42 -5
- package/src/component.js +52 -35
- package/src/dom.d.ts +76 -25
- package/src/dom.js +126 -121
- package/src/draggable-model.d.ts +5 -0
- package/src/draggable.d.ts +4 -1
- package/src/draggable.js +8 -2
- package/src/droppable-model.d.ts +7 -4
- package/src/droppable.d.ts +7 -3
- package/src/droppable.js +1 -0
- package/src/event-handler.d.ts +10 -6
- package/src/event-handler.js +11 -7
- package/src/hijri-parser.d.ts +12 -0
- package/src/hijri-parser.js +111 -90
- package/src/internationalization.d.ts +54 -21
- package/src/internationalization.js +55 -18
- package/src/intl/date-formatter.d.ts +19 -8
- package/src/intl/date-formatter.js +36 -13
- package/src/intl/date-parser.d.ts +30 -23
- package/src/intl/date-parser.js +61 -42
- package/src/intl/intl-base.d.ts +123 -46
- package/src/intl/intl-base.js +451 -377
- package/src/intl/number-formatter.d.ts +45 -34
- package/src/intl/number-formatter.js +47 -35
- package/src/intl/number-parser.d.ts +11 -8
- package/src/intl/number-parser.js +13 -11
- package/src/intl/parser-base.d.ts +38 -13
- package/src/intl/parser-base.js +45 -16
- package/src/keyboard-model.d.ts +5 -2
- package/src/keyboard.d.ts +26 -8
- package/src/keyboard.js +24 -9
- package/src/l10n.d.ts +16 -7
- package/src/l10n.js +16 -7
- package/src/module-loader.d.ts +13 -8
- package/src/module-loader.js +13 -9
- package/src/notify-property-change.d.ts +19 -7
- package/src/notify-property-change.js +140 -24
- package/src/observer.d.ts +17 -5
- package/src/observer.js +19 -7
- package/src/sanitize-helper.d.ts +1 -0
- package/src/sanitize-helper.js +1 -1
- package/src/template-engine.d.ts +30 -4
- package/src/template-engine.js +37 -12
- package/src/template.d.ts +8 -3
- package/src/template.js +67 -19
- package/src/touch-model.d.ts +11 -4
- package/src/touch.d.ts +51 -9
- package/src/touch.js +45 -13
- package/src/util.d.ts +67 -37
- package/src/util.js +99 -49
- package/styles/_bootstrap-definition.scss +0 -1
- package/styles/_bootstrap5-dark-definition.scss +10 -0
- package/styles/_bootstrap5-definition.scss +9 -0
- package/styles/_fabric-dark-definition.scss +0 -1
- package/styles/_highcontrast-light-definition.scss +1 -0
- package/styles/_material-definition.scss +1 -0
- package/styles/bootstrap-dark.css +2613 -32
- package/styles/bootstrap.css +2613 -32
- package/styles/bootstrap4.css +2149 -32
- package/styles/bootstrap5-dark.css +2161 -0
- package/styles/bootstrap5-dark.scss +3 -0
- package/styles/bootstrap5.css +2161 -0
- package/styles/bootstrap5.scss +3 -0
- package/styles/common/_core.scss +28 -63
- package/styles/definition/_bootstrap-dark.scss +3 -3
- package/styles/definition/_bootstrap.scss +1 -1
- package/styles/definition/_bootstrap5-dark.scss +357 -0
- package/styles/definition/_bootstrap5.scss +356 -0
- package/styles/definition/_material-dark.scss +1 -1
- package/styles/definition/_tailwind-dark.scss +18 -1
- package/styles/definition/_tailwind.scss +17 -0
- package/styles/fabric-dark.css +2589 -32
- package/styles/fabric.css +2589 -32
- package/styles/highcontrast-light.css +2573 -32
- package/styles/highcontrast.css +2573 -32
- package/styles/material-dark.css +2549 -32
- package/styles/material.css +2549 -32
- package/styles/tailwind-dark.css +2221 -32
- package/styles/tailwind.css +2221 -32
- package/src/virtual-dom.d.ts +0 -32
- package/src/virtual-dom.js +0 -449
|
@@ -3,6 +3,7 @@ import { IntlBase as base } from './intl-base';
|
|
|
3
3
|
import { NumberMapper } from './parser-base';
|
|
4
4
|
/**
|
|
5
5
|
* Interface for default formatting options
|
|
6
|
+
*
|
|
6
7
|
* @private
|
|
7
8
|
*/
|
|
8
9
|
export interface FormatParts extends base.NumericSkeleton, NumberFormatOptions {
|
|
@@ -31,79 +32,89 @@ export interface GroupDetails {
|
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
34
|
* Module for number formatting.
|
|
35
|
+
*
|
|
34
36
|
* @private
|
|
35
37
|
*/
|
|
36
38
|
export declare class NumberFormat {
|
|
37
39
|
/**
|
|
38
40
|
* Returns the formatter function for given skeleton.
|
|
41
|
+
*
|
|
39
42
|
* @param {string} culture - Specifies the culture name to be which formatting.
|
|
40
43
|
* @param {NumberFormatOptions} option - Specific the format in which number will format.
|
|
41
|
-
* @param {Object}
|
|
42
|
-
* @
|
|
44
|
+
* @param {Object} cldr - Specifies the global cldr data collection.
|
|
45
|
+
* @returns {Function} ?
|
|
43
46
|
*/
|
|
44
47
|
static numberFormatter(culture: string, option: NumberFormatOptions, cldr: Object): Function;
|
|
45
48
|
/**
|
|
46
49
|
* Returns grouping details for the pattern provided
|
|
47
|
-
*
|
|
48
|
-
* @
|
|
50
|
+
*
|
|
51
|
+
* @param {string} pattern ?
|
|
52
|
+
* @returns {GroupDetails} ?
|
|
49
53
|
*/
|
|
50
54
|
static getGroupingDetails(pattern: string): GroupDetails;
|
|
51
55
|
/**
|
|
52
56
|
* Returns if the provided integer range is valid.
|
|
53
|
-
*
|
|
54
|
-
* @param {number}
|
|
55
|
-
* @param {
|
|
56
|
-
* @param {boolean}
|
|
57
|
-
* @
|
|
57
|
+
*
|
|
58
|
+
* @param {number} val1 ?
|
|
59
|
+
* @param {number} val2 ?
|
|
60
|
+
* @param {boolean} checkbothExist ?
|
|
61
|
+
* @param {boolean} isFraction ?
|
|
62
|
+
* @returns {boolean} ?
|
|
58
63
|
*/
|
|
59
64
|
private static checkValueRange;
|
|
60
65
|
/**
|
|
61
66
|
* Check if the provided fraction range is valid
|
|
62
|
-
*
|
|
63
|
-
* @param {
|
|
64
|
-
* @param {
|
|
65
|
-
* @
|
|
67
|
+
*
|
|
68
|
+
* @param {number} val ?
|
|
69
|
+
* @param {string} text ?
|
|
70
|
+
* @param {boolean} isFraction ?
|
|
71
|
+
* @returns {void} ?
|
|
66
72
|
*/
|
|
67
73
|
private static checkRange;
|
|
68
74
|
/**
|
|
69
75
|
* Returns formatted numeric string for provided formatting options
|
|
70
|
-
*
|
|
71
|
-
* @param {
|
|
72
|
-
* @param {
|
|
73
|
-
* @
|
|
76
|
+
*
|
|
77
|
+
* @param {number} value ?
|
|
78
|
+
* @param {base.GenericFormatOptions} fOptions ?
|
|
79
|
+
* @param {CommonOptions} dOptions ?
|
|
80
|
+
* @returns {string} ?
|
|
74
81
|
*/
|
|
75
82
|
private static intNumberFormatter;
|
|
76
83
|
/**
|
|
77
84
|
* Returns significant digits processed numeric string
|
|
78
|
-
*
|
|
79
|
-
* @param {number}
|
|
80
|
-
* @param {number}
|
|
81
|
-
* @
|
|
85
|
+
*
|
|
86
|
+
* @param {number} value ?
|
|
87
|
+
* @param {number} min ?
|
|
88
|
+
* @param {number} max ?
|
|
89
|
+
* @returns {string} ?
|
|
82
90
|
*/
|
|
83
91
|
private static processSignificantDigits;
|
|
84
92
|
/**
|
|
85
93
|
* Returns grouped numeric string
|
|
86
|
-
*
|
|
87
|
-
* @param {
|
|
88
|
-
* @param {
|
|
89
|
-
* @param {string}
|
|
90
|
-
* @param {
|
|
91
|
-
* @
|
|
94
|
+
*
|
|
95
|
+
* @param {string} val ?
|
|
96
|
+
* @param {number} level1 ?
|
|
97
|
+
* @param {string} sep ?
|
|
98
|
+
* @param {string} decimalSymbol ?
|
|
99
|
+
* @param {number} level2 ?
|
|
100
|
+
* @returns {string} ?
|
|
92
101
|
*/
|
|
93
102
|
private static groupNumbers;
|
|
94
103
|
/**
|
|
95
104
|
* Returns fraction processed numeric string
|
|
96
|
-
*
|
|
97
|
-
* @param {number}
|
|
98
|
-
* @param {number}
|
|
99
|
-
* @
|
|
105
|
+
*
|
|
106
|
+
* @param {number} value ?
|
|
107
|
+
* @param {number} min ?
|
|
108
|
+
* @param {number} max ?
|
|
109
|
+
* @returns {string} ?
|
|
100
110
|
*/
|
|
101
111
|
private static processFraction;
|
|
102
112
|
/**
|
|
103
113
|
* Returns integer processed numeric string
|
|
104
|
-
*
|
|
105
|
-
* @param {
|
|
106
|
-
* @
|
|
114
|
+
*
|
|
115
|
+
* @param {string} value ?
|
|
116
|
+
* @param {number} min ?
|
|
117
|
+
* @returns {string} ?
|
|
107
118
|
*/
|
|
108
119
|
private static processMinimumIntegers;
|
|
109
120
|
}
|
|
@@ -17,6 +17,7 @@ var infinity = 'infinity';
|
|
|
17
17
|
var nan = 'nan';
|
|
18
18
|
/**
|
|
19
19
|
* Module for number formatting.
|
|
20
|
+
*
|
|
20
21
|
* @private
|
|
21
22
|
*/
|
|
22
23
|
var NumberFormat = /** @class */ (function () {
|
|
@@ -24,10 +25,11 @@ var NumberFormat = /** @class */ (function () {
|
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
27
|
* Returns the formatter function for given skeleton.
|
|
28
|
+
*
|
|
27
29
|
* @param {string} culture - Specifies the culture name to be which formatting.
|
|
28
30
|
* @param {NumberFormatOptions} option - Specific the format in which number will format.
|
|
29
|
-
* @param {Object}
|
|
30
|
-
* @
|
|
31
|
+
* @param {Object} cldr - Specifies the global cldr data collection.
|
|
32
|
+
* @returns {Function} ?
|
|
31
33
|
*/
|
|
32
34
|
NumberFormat.numberFormatter = function (culture, option, cldr) {
|
|
33
35
|
var _this = this;
|
|
@@ -40,7 +42,7 @@ var NumberFormat = /** @class */ (function () {
|
|
|
40
42
|
dOptions.numberMapper = isBlazor() ? extend({}, numObject) :
|
|
41
43
|
parser.getNumberMapper(dependable.parserObject, parser.getNumberingSystem(cldr), true);
|
|
42
44
|
dOptions.currencySymbol = isBlazor() ? getValue('currencySymbol', numObject) : base.getCurrencySymbol(dependable.numericObject, fOptions.currency || defaultCurrencyCode, option.altSymbol);
|
|
43
|
-
/*
|
|
45
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
44
46
|
dOptions.percentSymbol = isBlazor() ? getValue('numberSymbols.percentSign', numObject) :
|
|
45
47
|
dOptions.numberMapper.numberSymbols[percentSign];
|
|
46
48
|
dOptions.minusSymbol = isBlazor() ? getValue('numberSymbols.minusSign', numObject) :
|
|
@@ -113,8 +115,9 @@ var NumberFormat = /** @class */ (function () {
|
|
|
113
115
|
};
|
|
114
116
|
/**
|
|
115
117
|
* Returns grouping details for the pattern provided
|
|
116
|
-
*
|
|
117
|
-
* @
|
|
118
|
+
*
|
|
119
|
+
* @param {string} pattern ?
|
|
120
|
+
* @returns {GroupDetails} ?
|
|
118
121
|
*/
|
|
119
122
|
NumberFormat.getGroupingDetails = function (pattern) {
|
|
120
123
|
var ret = {};
|
|
@@ -135,16 +138,18 @@ var NumberFormat = /** @class */ (function () {
|
|
|
135
138
|
};
|
|
136
139
|
/**
|
|
137
140
|
* Returns if the provided integer range is valid.
|
|
138
|
-
*
|
|
139
|
-
* @param {number}
|
|
140
|
-
* @param {
|
|
141
|
-
* @param {boolean}
|
|
142
|
-
* @
|
|
141
|
+
*
|
|
142
|
+
* @param {number} val1 ?
|
|
143
|
+
* @param {number} val2 ?
|
|
144
|
+
* @param {boolean} checkbothExist ?
|
|
145
|
+
* @param {boolean} isFraction ?
|
|
146
|
+
* @returns {boolean} ?
|
|
143
147
|
*/
|
|
144
148
|
NumberFormat.checkValueRange = function (val1, val2, checkbothExist, isFraction) {
|
|
145
149
|
var decide = isFraction ? 'f' : 's';
|
|
146
150
|
var dint = 0;
|
|
147
151
|
var str1 = errorText['l' + decide];
|
|
152
|
+
// eslint-disable-next-line
|
|
148
153
|
var str2 = errorText['m' + decide];
|
|
149
154
|
if (!isUndefined(val1)) {
|
|
150
155
|
this.checkRange(val1, str1, isFraction);
|
|
@@ -169,10 +174,11 @@ var NumberFormat = /** @class */ (function () {
|
|
|
169
174
|
};
|
|
170
175
|
/**
|
|
171
176
|
* Check if the provided fraction range is valid
|
|
172
|
-
*
|
|
173
|
-
* @param {
|
|
174
|
-
* @param {
|
|
175
|
-
* @
|
|
177
|
+
*
|
|
178
|
+
* @param {number} val ?
|
|
179
|
+
* @param {string} text ?
|
|
180
|
+
* @param {boolean} isFraction ?
|
|
181
|
+
* @returns {void} ?
|
|
176
182
|
*/
|
|
177
183
|
NumberFormat.checkRange = function (val, text, isFraction) {
|
|
178
184
|
var range = isFraction ? [0, 20] : [1, 21];
|
|
@@ -182,10 +188,11 @@ var NumberFormat = /** @class */ (function () {
|
|
|
182
188
|
};
|
|
183
189
|
/**
|
|
184
190
|
* Returns formatted numeric string for provided formatting options
|
|
185
|
-
*
|
|
186
|
-
* @param {
|
|
187
|
-
* @param {
|
|
188
|
-
* @
|
|
191
|
+
*
|
|
192
|
+
* @param {number} value ?
|
|
193
|
+
* @param {base.GenericFormatOptions} fOptions ?
|
|
194
|
+
* @param {CommonOptions} dOptions ?
|
|
195
|
+
* @returns {string} ?
|
|
189
196
|
*/
|
|
190
197
|
NumberFormat.intNumberFormatter = function (value, fOptions, dOptions) {
|
|
191
198
|
var curData;
|
|
@@ -222,6 +229,7 @@ var NumberFormat = /** @class */ (function () {
|
|
|
222
229
|
}
|
|
223
230
|
fValue = fValue.replace('.', dOptions.numberMapper.numberSymbols[mapper[3]]);
|
|
224
231
|
if (curData.useGrouping) {
|
|
232
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
225
233
|
fValue = this.groupNumbers(fValue, curData.groupData.primary, curData.groupSeparator || ',', dOptions.numberMapper.numberSymbols[mapper[3]] || '.', curData.groupData.secondary);
|
|
226
234
|
}
|
|
227
235
|
fValue = parser.convertValueParts(fValue, base.latnParseRegex, dOptions.numberMapper.mapper);
|
|
@@ -235,10 +243,11 @@ var NumberFormat = /** @class */ (function () {
|
|
|
235
243
|
};
|
|
236
244
|
/**
|
|
237
245
|
* Returns significant digits processed numeric string
|
|
238
|
-
*
|
|
239
|
-
* @param {number}
|
|
240
|
-
* @param {number}
|
|
241
|
-
* @
|
|
246
|
+
*
|
|
247
|
+
* @param {number} value ?
|
|
248
|
+
* @param {number} min ?
|
|
249
|
+
* @param {number} max ?
|
|
250
|
+
* @returns {string} ?
|
|
242
251
|
*/
|
|
243
252
|
NumberFormat.processSignificantDigits = function (value, min, max) {
|
|
244
253
|
var temp = value + '';
|
|
@@ -255,12 +264,13 @@ var NumberFormat = /** @class */ (function () {
|
|
|
255
264
|
};
|
|
256
265
|
/**
|
|
257
266
|
* Returns grouped numeric string
|
|
258
|
-
*
|
|
259
|
-
* @param {
|
|
260
|
-
* @param {
|
|
261
|
-
* @param {string}
|
|
262
|
-
* @param {
|
|
263
|
-
* @
|
|
267
|
+
*
|
|
268
|
+
* @param {string} val ?
|
|
269
|
+
* @param {number} level1 ?
|
|
270
|
+
* @param {string} sep ?
|
|
271
|
+
* @param {string} decimalSymbol ?
|
|
272
|
+
* @param {number} level2 ?
|
|
273
|
+
* @returns {string} ?
|
|
264
274
|
*/
|
|
265
275
|
NumberFormat.groupNumbers = function (val, level1, sep, decimalSymbol, level2) {
|
|
266
276
|
var flag = !isNullOrUndefined(level2) && level2 !== 0;
|
|
@@ -282,10 +292,11 @@ var NumberFormat = /** @class */ (function () {
|
|
|
282
292
|
};
|
|
283
293
|
/**
|
|
284
294
|
* Returns fraction processed numeric string
|
|
285
|
-
*
|
|
286
|
-
* @param {number}
|
|
287
|
-
* @param {number}
|
|
288
|
-
* @
|
|
295
|
+
*
|
|
296
|
+
* @param {number} value ?
|
|
297
|
+
* @param {number} min ?
|
|
298
|
+
* @param {number} max ?
|
|
299
|
+
* @returns {string} ?
|
|
289
300
|
*/
|
|
290
301
|
NumberFormat.processFraction = function (value, min, max) {
|
|
291
302
|
var temp = (value + '').split('.')[1];
|
|
@@ -311,9 +322,10 @@ var NumberFormat = /** @class */ (function () {
|
|
|
311
322
|
};
|
|
312
323
|
/**
|
|
313
324
|
* Returns integer processed numeric string
|
|
314
|
-
*
|
|
315
|
-
* @param {
|
|
316
|
-
* @
|
|
325
|
+
*
|
|
326
|
+
* @param {string} value ?
|
|
327
|
+
* @param {number} min ?
|
|
328
|
+
* @returns {string} ?
|
|
317
329
|
*/
|
|
318
330
|
NumberFormat.processMinimumIntegers = function (value, min) {
|
|
319
331
|
var temp = value.split('.');
|
|
@@ -16,23 +16,26 @@ export interface NumericParts {
|
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Module for Number Parser.
|
|
19
|
+
*
|
|
19
20
|
* @private
|
|
20
21
|
*/
|
|
21
22
|
export declare class NumberParser {
|
|
22
23
|
/**
|
|
23
24
|
* Returns the parser function for given skeleton.
|
|
24
|
-
*
|
|
25
|
-
* @param {
|
|
26
|
-
* @param {
|
|
27
|
-
* @
|
|
25
|
+
*
|
|
26
|
+
* @param {string} culture - Specifies the culture name to be which formatting.
|
|
27
|
+
* @param {NumberFormatOptions} option - Specific the format in which number will parsed.
|
|
28
|
+
* @param {Object} cldr - Specifies the global cldr data collection.
|
|
29
|
+
* @returns {Function} ?
|
|
28
30
|
*/
|
|
29
31
|
static numberParser(culture: string, option: NumberFormatOptions, cldr: Object): Function;
|
|
30
32
|
/**
|
|
31
33
|
* Returns parsed number for the provided formatting options
|
|
32
|
-
*
|
|
33
|
-
* @param {
|
|
34
|
-
* @param {
|
|
35
|
-
* @
|
|
34
|
+
*
|
|
35
|
+
* @param {string} value ?
|
|
36
|
+
* @param {NumericParts} options ?
|
|
37
|
+
* @param {NumericOptions} numOptions ?
|
|
38
|
+
* @returns {number} ?
|
|
36
39
|
*/
|
|
37
40
|
private static getParsedNumber;
|
|
38
41
|
private static convertMaxFracDigits;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { extend, isNullOrUndefined, isBlazor, getValue } from '../util';
|
|
2
2
|
import { ParserBase as parser } from './parser-base';
|
|
3
3
|
import { IntlBase as base } from './intl-base';
|
|
4
|
-
var formatRegex = /(^[ncpa]{1})([0-1]?[0-9]|20)?$/i;
|
|
5
4
|
var parseRegex = /^([^0-9]*)(([0-9,]*[0-9]+)(\.[0-9]+)?)([Ee][+-]?[0-9]+)?([^0-9]*)$/;
|
|
6
5
|
var groupRegex = /,/g;
|
|
7
|
-
var latnDecimalRegex = /^[0-9]*(\.[0-9]+)?$/;
|
|
8
6
|
var keys = ['minusSign', 'infinity'];
|
|
9
7
|
/**
|
|
10
8
|
* Module for Number Parser.
|
|
9
|
+
*
|
|
11
10
|
* @private
|
|
12
11
|
*/
|
|
13
12
|
var NumberParser = /** @class */ (function () {
|
|
@@ -15,10 +14,11 @@ var NumberParser = /** @class */ (function () {
|
|
|
15
14
|
}
|
|
16
15
|
/**
|
|
17
16
|
* Returns the parser function for given skeleton.
|
|
18
|
-
*
|
|
19
|
-
* @param {
|
|
20
|
-
* @param {
|
|
21
|
-
* @
|
|
17
|
+
*
|
|
18
|
+
* @param {string} culture - Specifies the culture name to be which formatting.
|
|
19
|
+
* @param {NumberFormatOptions} option - Specific the format in which number will parsed.
|
|
20
|
+
* @param {Object} cldr - Specifies the global cldr data collection.
|
|
21
|
+
* @returns {Function} ?
|
|
22
22
|
*/
|
|
23
23
|
NumberParser.numberParser = function (culture, option, cldr) {
|
|
24
24
|
var _this = this;
|
|
@@ -38,9 +38,10 @@ var NumberParser = /** @class */ (function () {
|
|
|
38
38
|
extend(parseOptions, base.customFormat(option.format, null, null));
|
|
39
39
|
}
|
|
40
40
|
var numbers = getValue('numbers', dependable.parserObject);
|
|
41
|
+
// eslint-disable-next-line
|
|
41
42
|
numOptions = parser.getCurrentNumericOptions(dependable.parserObject, parser.getNumberingSystem(cldr), true, isBlazor());
|
|
42
43
|
parseOptions.symbolRegex = parser.getSymbolRegex(Object.keys(numOptions.symbolMatch));
|
|
43
|
-
//
|
|
44
|
+
// eslint-disable-next-line
|
|
44
45
|
parseOptions.infinity = numOptions.symbolNumberSystem[keys[1]];
|
|
45
46
|
var symbolpattern;
|
|
46
47
|
if (!isBlazor()) {
|
|
@@ -65,10 +66,11 @@ var NumberParser = /** @class */ (function () {
|
|
|
65
66
|
};
|
|
66
67
|
/**
|
|
67
68
|
* Returns parsed number for the provided formatting options
|
|
68
|
-
*
|
|
69
|
-
* @param {
|
|
70
|
-
* @param {
|
|
71
|
-
* @
|
|
69
|
+
*
|
|
70
|
+
* @param {string} value ?
|
|
71
|
+
* @param {NumericParts} options ?
|
|
72
|
+
* @param {NumericOptions} numOptions ?
|
|
73
|
+
* @returns {number} ?
|
|
72
74
|
*/
|
|
73
75
|
NumberParser.getParsedNumber = function (value, options, numOptions) {
|
|
74
76
|
var isNegative;
|
|
@@ -30,6 +30,7 @@ export interface NumberMapper {
|
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Interface for parser base
|
|
33
|
+
*
|
|
33
34
|
* @private
|
|
34
35
|
*/
|
|
35
36
|
export declare class ParserBase {
|
|
@@ -38,62 +39,86 @@ export declare class ParserBase {
|
|
|
38
39
|
static numberingSystems: Object;
|
|
39
40
|
/**
|
|
40
41
|
* Returns the cldr object for the culture specifies
|
|
42
|
+
*
|
|
41
43
|
* @param {Object} obj - Specifies the object from which culture object to be acquired.
|
|
42
44
|
* @param {string} cName - Specifies the culture name.
|
|
43
|
-
* @returns {Object}
|
|
45
|
+
* @returns {Object} ?
|
|
44
46
|
*/
|
|
45
47
|
static getMainObject(obj: Object, cName: string): Object;
|
|
46
48
|
/**
|
|
47
49
|
* Returns the numbering system object from given cldr data.
|
|
50
|
+
*
|
|
48
51
|
* @param {Object} obj - Specifies the object from which number system is acquired.
|
|
49
|
-
* @returns {Object}
|
|
52
|
+
* @returns {Object} ?
|
|
50
53
|
*/
|
|
51
54
|
static getNumberingSystem(obj: Object): Object;
|
|
52
55
|
/**
|
|
53
56
|
* Returns the reverse of given object keys or keys specified.
|
|
57
|
+
*
|
|
54
58
|
* @param {Object} prop - Specifies the object to be reversed.
|
|
55
59
|
* @param {number[]} keys - Optional parameter specifies the custom keyList for reversal.
|
|
56
|
-
* @returns {Object}
|
|
60
|
+
* @returns {Object} ?
|
|
57
61
|
*/
|
|
58
62
|
static reverseObject(prop: Object, keys?: number[]): Object;
|
|
59
63
|
/**
|
|
60
64
|
* Returns the symbol regex by skipping the escape sequence.
|
|
65
|
+
*
|
|
61
66
|
* @param {string[]} props - Specifies the array values to be skipped.
|
|
62
|
-
* @returns {RegExp}
|
|
67
|
+
* @returns {RegExp} ?
|
|
63
68
|
*/
|
|
64
69
|
static getSymbolRegex(props: string[]): RegExp;
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
* @param {Object} prop ?
|
|
73
|
+
* @returns {Object} ?
|
|
74
|
+
*/
|
|
65
75
|
private static getSymbolMatch;
|
|
66
76
|
/**
|
|
67
77
|
* Returns regex string for provided value
|
|
68
|
-
*
|
|
69
|
-
* @
|
|
78
|
+
*
|
|
79
|
+
* @param {string} val ?
|
|
80
|
+
* @returns {string} ?
|
|
70
81
|
*/
|
|
71
82
|
private static constructRegex;
|
|
72
83
|
/**
|
|
73
84
|
* Returns the replaced value of matching regex and obj mapper.
|
|
85
|
+
*
|
|
74
86
|
* @param {string} value - Specifies the values to be replaced.
|
|
75
87
|
* @param {RegExp} regex - Specifies the regex to search.
|
|
76
88
|
* @param {Object} obj - Specifies the object matcher to be replace value parts.
|
|
77
|
-
* @returns {string}
|
|
89
|
+
* @returns {string} ?
|
|
78
90
|
*/
|
|
79
91
|
static convertValueParts(value: string, regex: RegExp, obj: Object): string;
|
|
80
92
|
/**
|
|
81
93
|
* Returns default numbering system object for formatting from cldr data
|
|
82
|
-
*
|
|
83
|
-
* @
|
|
94
|
+
*
|
|
95
|
+
* @param {Object} obj ?
|
|
96
|
+
* @returns {NumericObject} ?
|
|
84
97
|
*/
|
|
85
98
|
static getDefaultNumberingSystem(obj: Object): NumericObject;
|
|
86
99
|
/**
|
|
87
100
|
* Returns the replaced value of matching regex and obj mapper.
|
|
101
|
+
*
|
|
102
|
+
* @param {Object} curObj ?
|
|
103
|
+
* @param {Object} numberSystem ?
|
|
104
|
+
* @param {boolean} needSymbols ?
|
|
105
|
+
* @param {boolean} blazorMode ?
|
|
106
|
+
* @returns {Object} ?
|
|
88
107
|
*/
|
|
89
108
|
static getCurrentNumericOptions(curObj: Object, numberSystem: Object, needSymbols?: boolean, blazorMode?: boolean): Object;
|
|
90
109
|
/**
|
|
91
110
|
* Returns number mapper object for the provided cldr data
|
|
92
|
-
*
|
|
93
|
-
* @param {Object}
|
|
94
|
-
* @param {
|
|
95
|
-
* @
|
|
111
|
+
*
|
|
112
|
+
* @param {Object} curObj ?
|
|
113
|
+
* @param {Object} numberSystem ?
|
|
114
|
+
* @param {boolean} isNumber ?
|
|
115
|
+
* @returns {NumberMapper} ?
|
|
96
116
|
*/
|
|
97
117
|
static getNumberMapper(curObj: Object, numberSystem: Object, isNumber?: boolean): NumberMapper;
|
|
98
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
*
|
|
121
|
+
* @param {string} currencyCode ?
|
|
122
|
+
* @returns {string} ?
|
|
123
|
+
*/
|
|
99
124
|
export declare function getBlazorCurrencySymbol(currencyCode: string): string;
|
package/src/intl/parser-base.js
CHANGED
|
@@ -8,7 +8,6 @@ var defaultNumberingSystem = {
|
|
|
8
8
|
}
|
|
9
9
|
};
|
|
10
10
|
import { isUndefined, getValue, isBlazor } from '../util';
|
|
11
|
-
var latnRegex = /^[0-9]*$/;
|
|
12
11
|
var defaultNumberSymbols = {
|
|
13
12
|
'decimal': '.',
|
|
14
13
|
'group': ',',
|
|
@@ -22,6 +21,7 @@ var defaultNumberSymbols = {
|
|
|
22
21
|
var latnNumberSystem = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
|
23
22
|
/**
|
|
24
23
|
* Interface for parser base
|
|
24
|
+
*
|
|
25
25
|
* @private
|
|
26
26
|
*/
|
|
27
27
|
var ParserBase = /** @class */ (function () {
|
|
@@ -29,9 +29,10 @@ var ParserBase = /** @class */ (function () {
|
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Returns the cldr object for the culture specifies
|
|
32
|
+
*
|
|
32
33
|
* @param {Object} obj - Specifies the object from which culture object to be acquired.
|
|
33
34
|
* @param {string} cName - Specifies the culture name.
|
|
34
|
-
* @returns {Object}
|
|
35
|
+
* @returns {Object} ?
|
|
35
36
|
*/
|
|
36
37
|
ParserBase.getMainObject = function (obj, cName) {
|
|
37
38
|
var value = isBlazor() ? cName : 'main.' + cName;
|
|
@@ -39,25 +40,28 @@ var ParserBase = /** @class */ (function () {
|
|
|
39
40
|
};
|
|
40
41
|
/**
|
|
41
42
|
* Returns the numbering system object from given cldr data.
|
|
43
|
+
*
|
|
42
44
|
* @param {Object} obj - Specifies the object from which number system is acquired.
|
|
43
|
-
* @returns {Object}
|
|
45
|
+
* @returns {Object} ?
|
|
44
46
|
*/
|
|
45
47
|
ParserBase.getNumberingSystem = function (obj) {
|
|
46
48
|
return getValue('supplemental.numberingSystems', obj) || this.numberingSystems;
|
|
47
49
|
};
|
|
48
50
|
/**
|
|
49
51
|
* Returns the reverse of given object keys or keys specified.
|
|
52
|
+
*
|
|
50
53
|
* @param {Object} prop - Specifies the object to be reversed.
|
|
51
54
|
* @param {number[]} keys - Optional parameter specifies the custom keyList for reversal.
|
|
52
|
-
* @returns {Object}
|
|
55
|
+
* @returns {Object} ?
|
|
53
56
|
*/
|
|
54
57
|
ParserBase.reverseObject = function (prop, keys) {
|
|
55
58
|
var propKeys = keys || Object.keys(prop);
|
|
56
59
|
var res = {};
|
|
57
60
|
for (var _i = 0, propKeys_1 = propKeys; _i < propKeys_1.length; _i++) {
|
|
58
61
|
var key = propKeys_1[_i];
|
|
59
|
-
|
|
62
|
+
// eslint-disable-next-line
|
|
60
63
|
if (!res.hasOwnProperty(prop[key])) {
|
|
64
|
+
// eslint-disable-next-line
|
|
61
65
|
res[prop[key]] = key;
|
|
62
66
|
}
|
|
63
67
|
}
|
|
@@ -65,28 +69,36 @@ var ParserBase = /** @class */ (function () {
|
|
|
65
69
|
};
|
|
66
70
|
/**
|
|
67
71
|
* Returns the symbol regex by skipping the escape sequence.
|
|
72
|
+
*
|
|
68
73
|
* @param {string[]} props - Specifies the array values to be skipped.
|
|
69
|
-
* @returns {RegExp}
|
|
74
|
+
* @returns {RegExp} ?
|
|
70
75
|
*/
|
|
71
76
|
ParserBase.getSymbolRegex = function (props) {
|
|
72
77
|
var regexStr = props.map(function (str) {
|
|
73
|
-
return str.replace(/([.*+?^=!:${}()
|
|
78
|
+
return str.replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$1');
|
|
74
79
|
}).join('|');
|
|
75
80
|
return new RegExp(regexStr, 'g');
|
|
76
81
|
};
|
|
82
|
+
/**
|
|
83
|
+
*
|
|
84
|
+
* @param {Object} prop ?
|
|
85
|
+
* @returns {Object} ?
|
|
86
|
+
*/
|
|
77
87
|
ParserBase.getSymbolMatch = function (prop) {
|
|
78
88
|
var matchKeys = Object.keys(defaultNumberSymbols);
|
|
79
89
|
var ret = {};
|
|
80
90
|
for (var _i = 0, matchKeys_1 = matchKeys; _i < matchKeys_1.length; _i++) {
|
|
81
91
|
var key = matchKeys_1[_i];
|
|
92
|
+
// eslint-disable-next-line
|
|
82
93
|
ret[prop[key]] = defaultNumberSymbols[key];
|
|
83
94
|
}
|
|
84
95
|
return ret;
|
|
85
96
|
};
|
|
86
97
|
/**
|
|
87
98
|
* Returns regex string for provided value
|
|
88
|
-
*
|
|
89
|
-
* @
|
|
99
|
+
*
|
|
100
|
+
* @param {string} val ?
|
|
101
|
+
* @returns {string} ?
|
|
90
102
|
*/
|
|
91
103
|
ParserBase.constructRegex = function (val) {
|
|
92
104
|
var len = val.length;
|
|
@@ -103,20 +115,23 @@ var ParserBase = /** @class */ (function () {
|
|
|
103
115
|
};
|
|
104
116
|
/**
|
|
105
117
|
* Returns the replaced value of matching regex and obj mapper.
|
|
118
|
+
*
|
|
106
119
|
* @param {string} value - Specifies the values to be replaced.
|
|
107
120
|
* @param {RegExp} regex - Specifies the regex to search.
|
|
108
121
|
* @param {Object} obj - Specifies the object matcher to be replace value parts.
|
|
109
|
-
* @returns {string}
|
|
122
|
+
* @returns {string} ?
|
|
110
123
|
*/
|
|
111
124
|
ParserBase.convertValueParts = function (value, regex, obj) {
|
|
112
125
|
return value.replace(regex, function (str) {
|
|
126
|
+
// eslint-disable-next-line
|
|
113
127
|
return obj[str];
|
|
114
128
|
});
|
|
115
129
|
};
|
|
116
130
|
/**
|
|
117
131
|
* Returns default numbering system object for formatting from cldr data
|
|
118
|
-
*
|
|
119
|
-
* @
|
|
132
|
+
*
|
|
133
|
+
* @param {Object} obj ?
|
|
134
|
+
* @returns {NumericObject} ?
|
|
120
135
|
*/
|
|
121
136
|
ParserBase.getDefaultNumberingSystem = function (obj) {
|
|
122
137
|
var ret = {};
|
|
@@ -126,6 +141,12 @@ var ParserBase = /** @class */ (function () {
|
|
|
126
141
|
};
|
|
127
142
|
/**
|
|
128
143
|
* Returns the replaced value of matching regex and obj mapper.
|
|
144
|
+
*
|
|
145
|
+
* @param {Object} curObj ?
|
|
146
|
+
* @param {Object} numberSystem ?
|
|
147
|
+
* @param {boolean} needSymbols ?
|
|
148
|
+
* @param {boolean} blazorMode ?
|
|
149
|
+
* @returns {Object} ?
|
|
129
150
|
*/
|
|
130
151
|
ParserBase.getCurrentNumericOptions = function (curObj, numberSystem, needSymbols, blazorMode) {
|
|
131
152
|
var ret = {};
|
|
@@ -148,11 +169,13 @@ var ParserBase = /** @class */ (function () {
|
|
|
148
169
|
};
|
|
149
170
|
/**
|
|
150
171
|
* Returns number mapper object for the provided cldr data
|
|
151
|
-
*
|
|
152
|
-
* @param {Object}
|
|
153
|
-
* @param {
|
|
154
|
-
* @
|
|
172
|
+
*
|
|
173
|
+
* @param {Object} curObj ?
|
|
174
|
+
* @param {Object} numberSystem ?
|
|
175
|
+
* @param {boolean} isNumber ?
|
|
176
|
+
* @returns {NumberMapper} ?
|
|
155
177
|
*/
|
|
178
|
+
// eslint-disable-next-line
|
|
156
179
|
ParserBase.getNumberMapper = function (curObj, numberSystem, isNumber) {
|
|
157
180
|
var ret = { mapper: {} };
|
|
158
181
|
var cur = this.getDefaultNumberingSystem(curObj);
|
|
@@ -164,6 +187,7 @@ var ParserBase = /** @class */ (function () {
|
|
|
164
187
|
if (!isUndefined(digits)) {
|
|
165
188
|
for (var _i = 0, latnNumberSystem_1 = latnNumberSystem; _i < latnNumberSystem_1.length; _i++) {
|
|
166
189
|
var i = latnNumberSystem_1[_i];
|
|
190
|
+
// eslint-disable-next-line
|
|
167
191
|
ret.mapper[i] = digits[i];
|
|
168
192
|
}
|
|
169
193
|
}
|
|
@@ -335,6 +359,11 @@ var blazorCurrencyData = {
|
|
|
335
359
|
'VND': '₫',
|
|
336
360
|
'TWD': 'NT$'
|
|
337
361
|
};
|
|
362
|
+
/**
|
|
363
|
+
*
|
|
364
|
+
* @param {string} currencyCode ?
|
|
365
|
+
* @returns {string} ?
|
|
366
|
+
*/
|
|
338
367
|
export function getBlazorCurrencySymbol(currencyCode) {
|
|
339
368
|
return getValue(currencyCode || '', blazorCurrencyData);
|
|
340
369
|
}
|