@syncfusion/ej2-base 24.2.8 → 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,94 @@
1
+ import { extend, isNullOrUndefined } from './util';
2
+ import { defaultCulture } from './internationalization';
3
+ /**
4
+ * L10n modules provides localized text for different culture.
5
+ * ```typescript
6
+ * import {setCulture} from '@syncfusion/ts-base-library';
7
+ * //load global locale object common for all components.
8
+ * L10n.load({
9
+ * 'fr-BE': {
10
+ * 'button': {
11
+ * 'check': 'vérifié'
12
+ * }
13
+ * }
14
+ * });
15
+ * //set globale default locale culture.
16
+ * setCulture('fr-BE');
17
+ * let instance: L10n = new L10n('button', {
18
+ * check: 'checked'
19
+ * });
20
+ * //Get locale text for current property.
21
+ * instance.getConstant('check');
22
+ * //Change locale culture in a component.
23
+ * instance.setLocale('en-US');
24
+ * ```
25
+ */
26
+
27
+ export class L10n {
28
+ private static locale: Object = {};
29
+ private controlName: string;
30
+ private localeStrings: Object;
31
+ private currentLocale: Object;
32
+ /**
33
+ * Constructor
34
+ *
35
+ * @param {string} controlName ?
36
+ * @param {Object} localeStrings ?
37
+ * @param {string} locale ?
38
+ */
39
+ constructor(controlName: string, localeStrings: Object, locale?: string) {
40
+ this.controlName = controlName;
41
+ this.localeStrings = localeStrings;
42
+ this.setLocale(locale || defaultCulture);
43
+ }
44
+
45
+ /**
46
+ * Sets the locale text
47
+ *
48
+ * @param {string} locale ?
49
+ * @returns {void} ?
50
+ */
51
+
52
+ public setLocale(locale: string): void {
53
+ const intLocale: Object = this.intGetControlConstant(L10n.locale, locale);
54
+ this.currentLocale = intLocale || this.localeStrings;
55
+ }
56
+ /**
57
+ * Sets the global locale for all components.
58
+ *
59
+ * @param {Object} localeObject - specifies the localeObject to be set as global locale.
60
+ * @returns {void} ?
61
+ */
62
+ public static load(localeObject: Object): void {
63
+ this.locale = extend(this.locale, localeObject, {}, true);
64
+ }
65
+ /**
66
+ * Returns current locale text for the property based on the culture name and control name.
67
+ *
68
+ * @param {string} prop - specifies the property for which localize text to be returned.
69
+ * @returns {string} ?
70
+ */
71
+ public getConstant(prop: string): string {
72
+ // Removed conditional operator because this method does not return correct value when passing 0 as value in localization
73
+ if (!isNullOrUndefined(this.currentLocale[`${prop}`])) {
74
+ return this.currentLocale[`${prop}`];
75
+ } else {
76
+ return this.localeStrings[`${prop}`] || '';
77
+ }
78
+ }
79
+
80
+ /**
81
+ * Returns the control constant object for current object and the locale specified.
82
+ *
83
+ * @param {Object} curObject ?
84
+ * @param {string} locale ?
85
+ * @returns {Object} ?
86
+ */
87
+
88
+ private intGetControlConstant(curObject: Object, locale: string): Object {
89
+ if ((curObject)[`${locale}`]) {
90
+ return (curObject)[`${locale}`][this.controlName];
91
+ }
92
+ return null;
93
+ }
94
+ }
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Module loading operations
3
+ */
4
+ import { createInstance, setValue, getValue, deleteObject } from './util';
5
+ const MODULE_SUFFIX: string = 'Module';
6
+
7
+ /**
8
+ * Interface for module declaration.
9
+ */
10
+ export interface ModuleDeclaration {
11
+ /**
12
+ * Specifies the args for module declaration.
13
+ */
14
+ args: Object[];
15
+ /**
16
+ * Specifies the member for module declaration.
17
+ */
18
+ member: string;
19
+ /**
20
+ * Specifies the name for module declaration.
21
+ */
22
+ name?: string;
23
+ /**
24
+ * Specifies whether it is a property or not.
25
+ */
26
+ isProperty?: boolean;
27
+ }
28
+ export interface IParent {
29
+ // eslint-disable-next-line
30
+ [key: string]: any;
31
+ }
32
+
33
+ export class ModuleLoader {
34
+ // eslint-disable-next-line
35
+ private parent: any;
36
+ private loadedModules: ModuleDeclaration[] = [];
37
+ constructor(parent: IParent) {
38
+ this.parent = parent;
39
+ }
40
+
41
+ /**
42
+ * Inject required modules in component library
43
+ *
44
+ * @returns {void} ?
45
+ * @param {ModuleDeclaration[]} requiredModules - Array of modules to be required
46
+ * @param {Function[]} moduleList - Array of modules to be injected from sample side
47
+ */
48
+ public inject(requiredModules: ModuleDeclaration[], moduleList: Function[]): void {
49
+ const reqLength: number = requiredModules.length;
50
+ if (reqLength === 0) {
51
+ this.clean();
52
+ return;
53
+ }
54
+ if (this.loadedModules.length) {
55
+ this.clearUnusedModule(requiredModules);
56
+ }
57
+ for (let i: number = 0; i < reqLength; i++) {
58
+ const modl: ModuleDeclaration = requiredModules[parseInt(i.toString(), 10)];
59
+ for (const module of moduleList) {
60
+ const modName: string = modl.member;
61
+ if ( module && module.prototype.getModuleName() === modl.member && !this.isModuleLoaded(modName)) {
62
+ const moduleObject: Object = createInstance(module, modl.args);
63
+ const memberName: string = this.getMemberName(modName);
64
+ if (modl.isProperty) {
65
+ setValue(memberName, module, this.parent);
66
+ } else {
67
+ setValue(memberName, moduleObject, this.parent);
68
+ }
69
+ const loadedModule: ModuleDeclaration = modl;
70
+ loadedModule.member = memberName;
71
+ this.loadedModules.push(loadedModule);
72
+ }
73
+ }
74
+ }
75
+ }
76
+
77
+ /**
78
+ * To remove the created object while destroying the control
79
+ *
80
+ * @returns {void}
81
+ */
82
+ public clean(): void {
83
+ for (const modules of this.loadedModules) {
84
+ if (!modules.isProperty) {
85
+ getValue(modules.member, this.parent).destroy();
86
+ }
87
+ }
88
+ this.loadedModules = [];
89
+ }
90
+
91
+ /**
92
+ * Returns the array of modules that are not loaded in the component library.
93
+ *
94
+ * @param {ModuleDeclaration[]} requiredModules - Array of modules to be required
95
+ * @returns {ModuleDeclaration[]} ?
96
+ * @private
97
+ */
98
+ public getNonInjectedModules(requiredModules: ModuleDeclaration[]): ModuleDeclaration[] {
99
+ return requiredModules.filter((module: ModuleDeclaration) => !this.isModuleLoaded(module.member));
100
+ }
101
+
102
+ /**
103
+ * Removes all unused modules
104
+ *
105
+ * @param {ModuleDeclaration[]} moduleList ?
106
+ * @returns {void} ?
107
+ */
108
+
109
+ private clearUnusedModule(moduleList: ModuleDeclaration[]): void {
110
+ const usedModules: string[] = moduleList.map((arg: ModuleDeclaration) => { return this.getMemberName(arg.member); });
111
+ const removableModule: ModuleDeclaration[] = this.loadedModules.filter((module: ModuleDeclaration) => {
112
+ return usedModules.indexOf(module.member) === -1;
113
+ });
114
+ for (const mod of removableModule) {
115
+ if (!mod.isProperty) {
116
+ getValue(mod.member, this.parent).destroy();
117
+ }
118
+ this.loadedModules.splice(this.loadedModules.indexOf(mod), 1);
119
+ deleteObject(this.parent, mod.member);
120
+ }
121
+ }
122
+
123
+ /**
124
+ * To get the name of the member.
125
+ *
126
+ * @param {string} name ?
127
+ * @returns {string} ?
128
+ */
129
+
130
+ private getMemberName(name: string): string {
131
+ return name[0].toLowerCase() + name.substring(1) + MODULE_SUFFIX;
132
+ }
133
+
134
+ /**
135
+ * Returns boolean based on whether the module specified is loaded or not
136
+ *
137
+ * @param {string} modName ?
138
+ * @returns {boolean} ?
139
+ */
140
+
141
+ private isModuleLoaded(modName: string): boolean {
142
+ for (const mod of this.loadedModules) {
143
+ if (mod.member === this.getMemberName(modName)) {
144
+ return true;
145
+ }
146
+ }
147
+ return false;
148
+ }
149
+ }