@syncfusion/ej2-base 24.2.7 → 25.1.35-579988

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 (163) hide show
  1. package/.eslintrc.json +2 -1
  2. package/CHANGELOG.md +641 -677
  3. package/{README.md → ReadMe.md} +100 -100
  4. package/dist/ej2-base.umd.min.js +1 -10
  5. package/dist/ej2-base.umd.min.js.map +1 -1
  6. package/dist/es6/ej2-base.es2015.js +178 -1025
  7. package/dist/es6/ej2-base.es2015.js.map +1 -1
  8. package/dist/es6/ej2-base.es5.js +226 -934
  9. package/dist/es6/ej2-base.es5.js.map +1 -1
  10. package/dist/global/ej2-base.min.js +1 -10
  11. package/dist/global/ej2-base.min.js.map +1 -1
  12. package/dist/global/index.d.ts +0 -9
  13. package/dist/ts/ajax.ts +236 -0
  14. package/dist/ts/animation.ts +544 -0
  15. package/dist/ts/base.ts +357 -0
  16. package/dist/ts/browser.ts +387 -0
  17. package/dist/ts/child-property.ts +192 -0
  18. package/dist/ts/component.ts +519 -0
  19. package/dist/ts/dom.ts +488 -0
  20. package/dist/ts/draggable.ts +1155 -0
  21. package/dist/ts/droppable.ts +172 -0
  22. package/dist/ts/event-handler.ts +169 -0
  23. package/dist/ts/internationalization.ts +369 -0
  24. package/dist/ts/intl/date-formatter.ts +317 -0
  25. package/dist/ts/intl/date-parser.ts +426 -0
  26. package/dist/ts/intl/intl-base.ts +1104 -0
  27. package/dist/ts/intl/number-formatter.ts +411 -0
  28. package/dist/ts/intl/number-parser.ts +158 -0
  29. package/dist/ts/intl/parser-base.ts +394 -0
  30. package/dist/ts/keyboard.ts +238 -0
  31. package/dist/ts/l10n.ts +94 -0
  32. package/dist/ts/module-loader.ts +149 -0
  33. package/dist/ts/notify-property-change.ts +726 -0
  34. package/dist/ts/observer.ts +236 -0
  35. package/dist/ts/sanitize-helper.ts +224 -0
  36. package/dist/ts/template-engine.ts +191 -0
  37. package/dist/ts/template.ts +329 -0
  38. package/dist/ts/touch.ts +544 -0
  39. package/dist/ts/util.ts +523 -0
  40. package/dist/ts/validate-lic.ts +0 -0
  41. package/e2e/crypto.js +16 -16
  42. package/e2e/m.protractor.config.js +286 -286
  43. package/e2e/modified-protractor/protractor.config.js +316 -316
  44. package/e2e/protractor.config.js +389 -332
  45. package/helpers/e2e/index.js +3 -3
  46. package/license +10 -10
  47. package/package.json +225 -174
  48. package/src/ajax.d.ts +1 -1
  49. package/src/ajax.js +3 -8
  50. package/src/animation-model.d.ts +41 -41
  51. package/src/animation.d.ts +6 -6
  52. package/src/animation.js +25 -25
  53. package/src/base.d.ts +2 -1
  54. package/src/base.js +9 -7
  55. package/src/component-model.d.ts +16 -16
  56. package/src/component.d.ts +9 -3
  57. package/src/component.js +50 -38
  58. package/src/draggable-model.d.ts +113 -113
  59. package/src/draggable.d.ts +2 -0
  60. package/src/draggable.js +45 -29
  61. package/src/droppable-model.d.ts +23 -23
  62. package/src/droppable.js +19 -19
  63. package/src/event-handler.js +2 -1
  64. package/src/index.d.ts +0 -3
  65. package/src/index.js +0 -3
  66. package/src/intl/date-formatter.js +2 -6
  67. package/src/intl/date-parser.js +1 -20
  68. package/src/intl/intl-base.js +1 -164
  69. package/src/intl/number-formatter.d.ts +3 -0
  70. package/src/intl/number-formatter.js +7 -7
  71. package/src/intl/number-parser.js +1 -0
  72. package/src/keyboard-model.d.ts +16 -16
  73. package/src/keyboard.js +19 -19
  74. package/src/module-loader.d.ts +12 -0
  75. package/src/module-loader.js +11 -0
  76. package/src/notify-property-change.js +3 -2
  77. package/src/observer.js +2 -0
  78. package/src/sanitize-helper.js +5 -0
  79. package/src/template-engine.js +1 -0
  80. package/src/template.js +3 -2
  81. package/src/touch-model.d.ts +39 -39
  82. package/src/touch.js +19 -19
  83. package/src/validate-lic.d.ts +0 -11
  84. package/src/validate-lic.js +1 -259
  85. package/styles/_all.scss +2 -2
  86. package/styles/_bds-dark-definition.scss +15 -0
  87. package/styles/_bds-definition.scss +15 -0
  88. package/styles/_bootstrap-dark-definition.scss +42 -42
  89. package/styles/_bootstrap-definition.scss +42 -42
  90. package/styles/_bootstrap4-definition.scss +11 -11
  91. package/styles/_bootstrap5-dark-definition.scss +9 -9
  92. package/styles/_bootstrap5-definition.scss +8 -8
  93. package/styles/_fabric-dark-definition.scss +42 -42
  94. package/styles/_fabric-definition.scss +42 -42
  95. package/styles/_fluent-dark-definition.scss +9 -9
  96. package/styles/_fluent-definition.scss +9 -9
  97. package/styles/_fluent2-definition.scss +9 -0
  98. package/styles/_fusionnew-dark-definition.scss +8 -8
  99. package/styles/_fusionnew-definition.scss +8 -8
  100. package/styles/_highcontrast-definition.scss +42 -42
  101. package/styles/_highcontrast-light-definition.scss +42 -42
  102. package/styles/_material-dark-definition.scss +48 -48
  103. package/styles/_material-definition.scss +49 -49
  104. package/styles/_material3-dark-definition.scss +14 -14
  105. package/styles/_material3-definition.scss +15 -15
  106. package/styles/_tailwind-dark-definition.scss +15 -15
  107. package/styles/_tailwind-definition.scss +15 -15
  108. package/styles/animation/_all.scss +560 -560
  109. package/styles/bootstrap-dark.css +10 -1
  110. package/styles/bootstrap.css +10 -1
  111. package/styles/bootstrap4.css +10 -1
  112. package/styles/bootstrap5-dark.css +10 -1
  113. package/styles/bootstrap5.css +10 -1
  114. package/styles/common/_all.scss +2 -2
  115. package/styles/common/_core.scss +117 -117
  116. package/styles/common/_mixin.scss +9 -9
  117. package/styles/definition/_bds-dark.scss +1179 -0
  118. package/styles/definition/_bds.scss +1474 -0
  119. package/styles/definition/_bootstrap-dark.scss +219 -219
  120. package/styles/definition/_bootstrap.scss +215 -215
  121. package/styles/definition/_bootstrap4.scss +167 -167
  122. package/styles/definition/_bootstrap5-dark.scss +493 -493
  123. package/styles/definition/_bootstrap5.scss +494 -494
  124. package/styles/definition/_fabric-dark.scss +200 -200
  125. package/styles/definition/_fabric.scss +198 -198
  126. package/styles/definition/_fluent-dark.scss +557 -557
  127. package/styles/definition/_fluent.scss +558 -558
  128. package/styles/definition/_fluent2.scss +2198 -0
  129. package/styles/definition/_fusionnew-dark.scss +362 -362
  130. package/styles/definition/_fusionnew.scss +363 -363
  131. package/styles/definition/_highcontrast-light.scss +193 -193
  132. package/styles/definition/_highcontrast.scss +195 -195
  133. package/styles/definition/_material-dark.scss +198 -198
  134. package/styles/definition/_material.scss +192 -192
  135. package/styles/definition/_material3-dark.scss +710 -710
  136. package/styles/definition/_material3.scss +792 -792
  137. package/styles/definition/_tailwind-dark.scss +488 -488
  138. package/styles/definition/_tailwind.scss +485 -485
  139. package/styles/fabric-dark.css +10 -1
  140. package/styles/fabric.css +10 -1
  141. package/styles/fluent-dark.css +10 -1
  142. package/styles/fluent.css +10 -1
  143. package/styles/highcontrast-light.css +10 -1
  144. package/styles/highcontrast.css +10 -1
  145. package/styles/material-dark.css +10 -1
  146. package/styles/material.css +10 -1
  147. package/styles/material3-dark.css +10 -1
  148. package/styles/material3.css +10 -1
  149. package/styles/offline-theme/material-dark.css +10 -1
  150. package/styles/offline-theme/material.css +10 -1
  151. package/styles/offline-theme/tailwind-dark.css +10 -1
  152. package/styles/offline-theme/tailwind.css +10 -1
  153. package/styles/tailwind-dark.css +10 -1
  154. package/styles/tailwind.css +10 -1
  155. package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -60
  156. package/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -42
  157. package/bin/syncfusion-license.js +0 -2
  158. package/dist/ej2-base.min.js +0 -10
  159. package/e2e/index.d.ts +0 -27
  160. package/src/fetch.d.ts +0 -114
  161. package/src/fetch.js +0 -116
  162. package/src/hijri-parser.d.ts +0 -19
  163. package/src/hijri-parser.js +0 -204
@@ -0,0 +1,317 @@
1
+ import { DateFormatOptions } from '../internationalization';
2
+ import { ParserBase as parser, NumberMapper } from './parser-base';
3
+ import { IntlBase as base } from './intl-base';
4
+ import { isUndefined, throwError, getValue, isBlazor } from '../util';
5
+ import { isNullOrUndefined, extend } from '../util';
6
+ const abbreviateRegexGlobal: RegExp = /\/MMMMM|MMMM|MMM|a|LLLL|LLL|EEEEE|EEEE|E|K|cccc|ccc|WW|W|G+|z+/gi;
7
+ const standalone: string = 'stand-alone';
8
+ const weekdayKey: string[] = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
9
+ export const basicPatterns: string[] = ['short', 'medium', 'long', 'full'];
10
+ /**
11
+ * Interface for Date Format Options Modules.
12
+ *
13
+ * @private
14
+ */
15
+ export interface FormatOptions {
16
+ month?: Object;
17
+ weekday?: Object;
18
+ pattern?: string;
19
+ designator?: Object;
20
+ timeZone?: base.TimeZoneOptions;
21
+ era?: Object;
22
+ hour12?: boolean;
23
+ numMapper?: NumberMapper;
24
+ dateSeperator?: string;
25
+ isIslamic?: boolean;
26
+ weekOfYear?: string;
27
+ }
28
+ const timeSetter: Object = {
29
+ m: 'getMinutes',
30
+ h: 'getHours',
31
+ H: 'getHours',
32
+ s: 'getSeconds',
33
+ d: 'getDate',
34
+ f: 'getMilliseconds'
35
+ };
36
+ export const datePartMatcher: { [key: string]: Object } = {
37
+ 'M': 'month',
38
+ 'd': 'day',
39
+ 'E': 'weekday',
40
+ 'c': 'weekday',
41
+ 'y': 'year',
42
+ 'm': 'minute',
43
+ 'h': 'hour',
44
+ 'H': 'hour',
45
+ 's': 'second',
46
+ 'L': 'month',
47
+ 'a': 'designator',
48
+ 'z': 'timeZone',
49
+ 'Z': 'timeZone',
50
+ 'G': 'era',
51
+ 'f': 'milliseconds'
52
+ };
53
+
54
+ const timeSeparator: string = 'timeSeparator';
55
+
56
+ /* tslint:disable no-any */
57
+ /**
58
+ * Date Format is a framework provides support for date formatting.
59
+ *
60
+ * @private
61
+ */
62
+ export class DateFormat {
63
+
64
+ /**
65
+ * Returns the formatter function for given skeleton.
66
+ *
67
+ * @param {string} culture - Specifies the culture name to be which formatting.
68
+ * @param {DateFormatOptions} option - Specific the format in which date will format.
69
+ * @param {Object} cldr - Specifies the global cldr data collection.
70
+ * @returns {Function} ?
71
+ */
72
+ public static dateFormat(culture: string, option: DateFormatOptions, cldr: Object): Function {
73
+ const dependable: base.Dependables = base.getDependables(cldr, culture, option.calendar);
74
+ const numObject: Object = getValue('parserObject.numbers', dependable);
75
+ const dateObject: Object = dependable.dateObject;
76
+ const formatOptions: FormatOptions = { isIslamic: base.islamicRegex.test(option.calendar) };
77
+ if (isBlazor() && option.isServerRendered) {
78
+ option = base.compareBlazorDateFormats(option, culture);
79
+ }
80
+ let resPattern: string = option.format ||
81
+ base.getResultantPattern(option.skeleton, dependable.dateObject, option.type, false, isBlazor() ? culture : '');
82
+ formatOptions.dateSeperator = isBlazor() ? getValue('dateSeperator', dateObject) : base.getDateSeparator(dependable.dateObject);
83
+ if (isUndefined(resPattern)) {
84
+ throwError('Format options or type given must be invalid');
85
+ } else {
86
+ resPattern = base.ConvertDateToWeekFormat(resPattern);
87
+ if (isBlazor()) {
88
+ resPattern = resPattern.replace(/tt/, 'a');
89
+ }
90
+ formatOptions.pattern = resPattern;
91
+ formatOptions.numMapper = isBlazor() ?
92
+ extend({}, numObject) : parser.getNumberMapper(dependable.parserObject, parser.getNumberingSystem(cldr));
93
+ const patternMatch: string[] = resPattern.match(abbreviateRegexGlobal) || [];
94
+ for (const str of patternMatch) {
95
+ const len: number = str.length;
96
+ let char: string = str[0];
97
+ if (char === 'K') {
98
+ char = 'h';
99
+ }
100
+ switch (char) {
101
+ case 'E':
102
+ case 'c':
103
+ if (isBlazor()) {
104
+ // eslint-disable-next-line
105
+ formatOptions.weekday = getValue('days.' + (base as any).monthIndex[len], dateObject);
106
+ } else {
107
+ // eslint-disable-next-line
108
+ formatOptions.weekday = (<any>dependable.dateObject)[base.days][standalone][(<any>base).monthIndex[len]];
109
+ }
110
+ break;
111
+ case 'M':
112
+ case 'L':
113
+ if (isBlazor()) {
114
+ // eslint-disable-next-line
115
+ formatOptions.month = getValue('months.' + (base as any).monthIndex[len], dateObject);
116
+ } else {
117
+ // eslint-disable-next-line
118
+ formatOptions.month = (<any>dependable.dateObject)[base.month][standalone][(<any>base.monthIndex)[len]];
119
+ }
120
+ break;
121
+ case 'a':
122
+ formatOptions.designator = isBlazor() ?
123
+ getValue('dayPeriods', dateObject) : getValue('dayPeriods.format.wide', dateObject);
124
+ break;
125
+ case 'G':
126
+ // eslint-disable-next-line
127
+ const eText: string = (len <= 3) ? 'eraAbbr' : (len === 4) ? 'eraNames' : 'eraNarrow';
128
+ formatOptions.era = isBlazor() ? getValue('eras', dateObject) : getValue('eras.' + eText, dependable.dateObject);
129
+ break;
130
+ case 'z':
131
+ formatOptions.timeZone = getValue('dates.timeZoneNames', dependable.parserObject);
132
+ break;
133
+ }
134
+ }
135
+ }
136
+ return (value: Date): string => {
137
+ if (isNaN(value.getDate())) {
138
+ return null;
139
+ }
140
+ return this.intDateFormatter(value, formatOptions);
141
+ };
142
+ }
143
+ /**
144
+ * Returns formatted date string based on options passed.
145
+ *
146
+ * @param {Date} value ?
147
+ * @param {FormatOptions} options ?
148
+ * @returns {string} ?
149
+ */
150
+ private static intDateFormatter(value: Date, options: FormatOptions): string {
151
+ const pattern: string = options.pattern;
152
+ let ret: string = '';
153
+ const matches: string[] = pattern.match(base.dateParseRegex);
154
+ const dObject: base.DateObject = this.getCurrentDateValue(value);
155
+ for (const match of matches) {
156
+ const length: number = match.length;
157
+ let char: string = match[0];
158
+ if (char === 'K') {
159
+ char = 'h';
160
+ }
161
+ let curval: number;
162
+ let curvalstr: string = '';
163
+ let isNumber: boolean;
164
+ let processNumber: boolean;
165
+ let curstr: string = '';
166
+ switch (char) {
167
+ case 'M':
168
+ case 'L':
169
+ curval = dObject.month;
170
+ if (length > 2) {
171
+ // eslint-disable-next-line
172
+ ret += (<any>options.month)[curval];
173
+ } else {
174
+ isNumber = true;
175
+ }
176
+ break;
177
+ case 'E':
178
+ case 'c':
179
+ // eslint-disable-next-line
180
+ ret += (<any>options.weekday)[weekdayKey[value.getDay()]];
181
+ break;
182
+ case 'H':
183
+ case 'h':
184
+ case 'm':
185
+ case 's':
186
+ case 'd':
187
+ case 'f':
188
+ isNumber = true;
189
+ if (char === 'd') {
190
+ curval = dObject.date;
191
+ } else if (char === 'f') {
192
+ isNumber = false;
193
+ processNumber = true;
194
+ // eslint-disable-next-line
195
+ curvalstr = (<any>value)[(<any>timeSetter)[char]]().toString();
196
+ curvalstr = curvalstr.substring(0, length);
197
+ const curlength: number = curvalstr.length;
198
+ if (length !== curlength) {
199
+ if (length > 3) {
200
+ continue;
201
+ }
202
+ for (let i: number = 0; i < length - curlength; i++) {
203
+ curvalstr = '0' + curvalstr.toString();
204
+ }
205
+ }
206
+ curstr += curvalstr;
207
+ } else {
208
+ // eslint-disable-next-line
209
+ curval = (<any>value)[(<any>timeSetter)[char]]();
210
+ }
211
+ if (char === 'h') {
212
+ curval = curval % 12 || 12;
213
+ }
214
+ break;
215
+ case 'y':
216
+ processNumber = true;
217
+ curstr += dObject.year;
218
+ if (length === 2) {
219
+ curstr = curstr.substr(curstr.length - 2);
220
+ }
221
+ break;
222
+ case 'a':
223
+ // eslint-disable-next-line
224
+ let desig: string = value.getHours() < 12 ? 'am' : 'pm';
225
+ // eslint-disable-next-line
226
+ ret += (<any>options).designator[desig];
227
+ break;
228
+ case 'G':
229
+ // eslint-disable-next-line
230
+ let dec: number = value.getFullYear() < 0 ? 0 : 1;
231
+ // eslint-disable-next-line
232
+ let retu: String = (<any>options).era[dec];
233
+ if (isNullOrUndefined(retu)) {
234
+ // eslint-disable-next-line
235
+ retu = (<any>options).era[dec ? 0 : 1];
236
+ }
237
+ ret += retu || '';
238
+ break;
239
+ case '\'':
240
+ ret += (match === '\'\'') ? '\'' : match.replace(/'/g, '');
241
+ break;
242
+ case 'z':
243
+ // eslint-disable-next-line
244
+ let timezone: number = value.getTimezoneOffset();
245
+ // eslint-disable-next-line
246
+ let pattern: string = (length < 4) ? '+H;-H' : options.timeZone.hourFormat;
247
+ pattern = pattern.replace(/:/g, options.numMapper.timeSeparator);
248
+ if (timezone === 0) {
249
+ ret += options.timeZone.gmtZeroFormat;
250
+ } else {
251
+ processNumber = true;
252
+ curstr = this.getTimeZoneValue(timezone, pattern);
253
+ }
254
+ curstr = options.timeZone.gmtFormat.replace(/\{0\}/, curstr);
255
+ break;
256
+ case ':':
257
+ // eslint-disable-next-line
258
+ ret += (<any>options).numMapper.numberSymbols[timeSeparator];
259
+ break;
260
+ case '/':
261
+ ret += options.dateSeperator;
262
+ break;
263
+ case 'W':
264
+ isNumber = true;
265
+ curval = base.getWeekOfYear(value);
266
+ break;
267
+ default:
268
+ ret += match;
269
+ }
270
+ if (isNumber) {
271
+ processNumber = true;
272
+ curstr = this.checkTwodigitNumber(curval, length);
273
+ }
274
+ if (processNumber) {
275
+ ret += parser.convertValueParts(curstr, base.latnParseRegex, options.numMapper.mapper);
276
+ }
277
+ }
278
+ return ret;
279
+ }
280
+ private static getCurrentDateValue(value: Date): base.DateObject {
281
+ return { year: value.getFullYear(), month: value.getMonth() + 1, date: value.getDate() };
282
+ }
283
+ /**
284
+ * Returns two digit numbers for given value and length
285
+ *
286
+ * @param {number} val ?
287
+ * @param {number} len ?
288
+ * @returns {string} ?
289
+ */
290
+ private static checkTwodigitNumber(val: number, len: number): string {
291
+ const ret: string = val + '';
292
+ if (len === 2 && ret.length !== 2) {
293
+ return '0' + ret;
294
+ }
295
+ return ret;
296
+ }
297
+ /**
298
+ * Returns the value of the Time Zone.
299
+ *
300
+ * @param {number} tVal ?
301
+ * @param {string} pattern ?
302
+ * @returns {string} ?
303
+ * @private
304
+ */
305
+ public static getTimeZoneValue(tVal: number, pattern: string): string {
306
+ const splt: string[] = pattern.split(';');
307
+ let curPattern: string = splt[tVal > 0 ? 1 : 0];
308
+ const no: number = Math.abs(tVal);
309
+ return curPattern = curPattern.replace(/HH?|mm/g, (str: string): string => {
310
+ const len: number = str.length;
311
+ const ishour: boolean = str.indexOf('H') !== -1;
312
+ return this.checkTwodigitNumber(Math.floor(ishour ? (no / 60) : (no % 60)), len);
313
+ }
314
+ );
315
+
316
+ }
317
+ }