@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.
- package/.eslintrc.json +2 -1
- package/CHANGELOG.md +641 -677
- package/{README.md → ReadMe.md} +100 -100
- package/dist/ej2-base.umd.min.js +1 -10
- package/dist/ej2-base.umd.min.js.map +1 -1
- package/dist/es6/ej2-base.es2015.js +178 -1025
- package/dist/es6/ej2-base.es2015.js.map +1 -1
- package/dist/es6/ej2-base.es5.js +226 -934
- package/dist/es6/ej2-base.es5.js.map +1 -1
- package/dist/global/ej2-base.min.js +1 -10
- package/dist/global/ej2-base.min.js.map +1 -1
- package/dist/global/index.d.ts +0 -9
- package/dist/ts/ajax.ts +236 -0
- package/dist/ts/animation.ts +544 -0
- package/dist/ts/base.ts +357 -0
- package/dist/ts/browser.ts +387 -0
- package/dist/ts/child-property.ts +192 -0
- package/dist/ts/component.ts +519 -0
- package/dist/ts/dom.ts +488 -0
- package/dist/ts/draggable.ts +1155 -0
- package/dist/ts/droppable.ts +172 -0
- package/dist/ts/event-handler.ts +169 -0
- package/dist/ts/internationalization.ts +369 -0
- package/dist/ts/intl/date-formatter.ts +317 -0
- package/dist/ts/intl/date-parser.ts +426 -0
- package/dist/ts/intl/intl-base.ts +1104 -0
- package/dist/ts/intl/number-formatter.ts +411 -0
- package/dist/ts/intl/number-parser.ts +158 -0
- package/dist/ts/intl/parser-base.ts +394 -0
- package/dist/ts/keyboard.ts +238 -0
- package/dist/ts/l10n.ts +94 -0
- package/dist/ts/module-loader.ts +149 -0
- package/dist/ts/notify-property-change.ts +726 -0
- package/dist/ts/observer.ts +236 -0
- package/dist/ts/sanitize-helper.ts +224 -0
- package/dist/ts/template-engine.ts +191 -0
- package/dist/ts/template.ts +329 -0
- package/dist/ts/touch.ts +544 -0
- package/dist/ts/util.ts +523 -0
- package/dist/ts/validate-lic.ts +0 -0
- package/e2e/crypto.js +16 -16
- package/e2e/m.protractor.config.js +286 -286
- package/e2e/modified-protractor/protractor.config.js +316 -316
- package/e2e/protractor.config.js +389 -332
- package/helpers/e2e/index.js +3 -3
- package/license +10 -10
- package/package.json +225 -174
- package/src/ajax.d.ts +1 -1
- package/src/ajax.js +3 -8
- package/src/animation-model.d.ts +41 -41
- package/src/animation.d.ts +6 -6
- package/src/animation.js +25 -25
- package/src/base.d.ts +2 -1
- package/src/base.js +9 -7
- package/src/component-model.d.ts +16 -16
- package/src/component.d.ts +9 -3
- package/src/component.js +50 -38
- package/src/draggable-model.d.ts +113 -113
- package/src/draggable.d.ts +2 -0
- package/src/draggable.js +45 -29
- package/src/droppable-model.d.ts +23 -23
- package/src/droppable.js +19 -19
- package/src/event-handler.js +2 -1
- package/src/index.d.ts +0 -3
- package/src/index.js +0 -3
- package/src/intl/date-formatter.js +2 -6
- package/src/intl/date-parser.js +1 -20
- package/src/intl/intl-base.js +1 -164
- package/src/intl/number-formatter.d.ts +3 -0
- package/src/intl/number-formatter.js +7 -7
- package/src/intl/number-parser.js +1 -0
- package/src/keyboard-model.d.ts +16 -16
- package/src/keyboard.js +19 -19
- package/src/module-loader.d.ts +12 -0
- package/src/module-loader.js +11 -0
- package/src/notify-property-change.js +3 -2
- package/src/observer.js +2 -0
- package/src/sanitize-helper.js +5 -0
- package/src/template-engine.js +1 -0
- package/src/template.js +3 -2
- package/src/touch-model.d.ts +39 -39
- package/src/touch.js +19 -19
- package/src/validate-lic.d.ts +0 -11
- package/src/validate-lic.js +1 -259
- package/styles/_all.scss +2 -2
- package/styles/_bds-dark-definition.scss +15 -0
- package/styles/_bds-definition.scss +15 -0
- package/styles/_bootstrap-dark-definition.scss +42 -42
- package/styles/_bootstrap-definition.scss +42 -42
- package/styles/_bootstrap4-definition.scss +11 -11
- package/styles/_bootstrap5-dark-definition.scss +9 -9
- package/styles/_bootstrap5-definition.scss +8 -8
- package/styles/_fabric-dark-definition.scss +42 -42
- package/styles/_fabric-definition.scss +42 -42
- package/styles/_fluent-dark-definition.scss +9 -9
- package/styles/_fluent-definition.scss +9 -9
- package/styles/_fluent2-definition.scss +9 -0
- package/styles/_fusionnew-dark-definition.scss +8 -8
- package/styles/_fusionnew-definition.scss +8 -8
- package/styles/_highcontrast-definition.scss +42 -42
- package/styles/_highcontrast-light-definition.scss +42 -42
- package/styles/_material-dark-definition.scss +48 -48
- package/styles/_material-definition.scss +49 -49
- package/styles/_material3-dark-definition.scss +14 -14
- package/styles/_material3-definition.scss +15 -15
- package/styles/_tailwind-dark-definition.scss +15 -15
- package/styles/_tailwind-definition.scss +15 -15
- package/styles/animation/_all.scss +560 -560
- package/styles/bootstrap-dark.css +10 -1
- package/styles/bootstrap.css +10 -1
- package/styles/bootstrap4.css +10 -1
- package/styles/bootstrap5-dark.css +10 -1
- package/styles/bootstrap5.css +10 -1
- package/styles/common/_all.scss +2 -2
- package/styles/common/_core.scss +117 -117
- package/styles/common/_mixin.scss +9 -9
- package/styles/definition/_bds-dark.scss +1179 -0
- package/styles/definition/_bds.scss +1474 -0
- package/styles/definition/_bootstrap-dark.scss +219 -219
- package/styles/definition/_bootstrap.scss +215 -215
- package/styles/definition/_bootstrap4.scss +167 -167
- package/styles/definition/_bootstrap5-dark.scss +493 -493
- package/styles/definition/_bootstrap5.scss +494 -494
- package/styles/definition/_fabric-dark.scss +200 -200
- package/styles/definition/_fabric.scss +198 -198
- package/styles/definition/_fluent-dark.scss +557 -557
- package/styles/definition/_fluent.scss +558 -558
- package/styles/definition/_fluent2.scss +2198 -0
- package/styles/definition/_fusionnew-dark.scss +362 -362
- package/styles/definition/_fusionnew.scss +363 -363
- package/styles/definition/_highcontrast-light.scss +193 -193
- package/styles/definition/_highcontrast.scss +195 -195
- package/styles/definition/_material-dark.scss +198 -198
- package/styles/definition/_material.scss +192 -192
- package/styles/definition/_material3-dark.scss +710 -710
- package/styles/definition/_material3.scss +792 -792
- package/styles/definition/_tailwind-dark.scss +488 -488
- package/styles/definition/_tailwind.scss +485 -485
- package/styles/fabric-dark.css +10 -1
- package/styles/fabric.css +10 -1
- package/styles/fluent-dark.css +10 -1
- package/styles/fluent.css +10 -1
- package/styles/highcontrast-light.css +10 -1
- package/styles/highcontrast.css +10 -1
- package/styles/material-dark.css +10 -1
- package/styles/material.css +10 -1
- package/styles/material3-dark.css +10 -1
- package/styles/material3.css +10 -1
- package/styles/offline-theme/material-dark.css +10 -1
- package/styles/offline-theme/material.css +10 -1
- package/styles/offline-theme/tailwind-dark.css +10 -1
- package/styles/offline-theme/tailwind.css +10 -1
- package/styles/tailwind-dark.css +10 -1
- package/styles/tailwind.css +10 -1
- package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -60
- package/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -42
- package/bin/syncfusion-license.js +0 -2
- package/dist/ej2-base.min.js +0 -10
- package/e2e/index.d.ts +0 -27
- package/src/fetch.d.ts +0 -114
- package/src/fetch.js +0 -116
- package/src/hijri-parser.d.ts +0 -19
- package/src/hijri-parser.js +0 -204
package/dist/ts/util.ts
ADDED
|
@@ -0,0 +1,523 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common utility methods
|
|
3
|
+
*/
|
|
4
|
+
export interface IKeyValue extends CSSStyleDeclaration {
|
|
5
|
+
// eslint-disable-next-line
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
const instances: string = 'ej2_instances';
|
|
9
|
+
declare let window: {
|
|
10
|
+
msCrypto: Crypto;
|
|
11
|
+
} & Window;
|
|
12
|
+
let uid: number = 0;
|
|
13
|
+
let isBlazorPlatform: boolean = false;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Function to check whether the platform is blazor or not.
|
|
17
|
+
*
|
|
18
|
+
* @returns {void} result
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
export function disableBlazorMode(): void {
|
|
22
|
+
isBlazorPlatform = false;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Create Instance from constructor function with desired parameters.
|
|
27
|
+
*
|
|
28
|
+
* @param {Function} classFunction - Class function to which need to create instance
|
|
29
|
+
* @param {any[]} params - Parameters need to passed while creating instance
|
|
30
|
+
* @returns {any} ?
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
// eslint-disable-next-line
|
|
34
|
+
export function createInstance(classFunction: Function, params: any[]): any {
|
|
35
|
+
const arrayParam: Object[] = params;
|
|
36
|
+
arrayParam.unshift(undefined);
|
|
37
|
+
return new (Function.prototype.bind.apply(classFunction, arrayParam));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* To run a callback function immediately after the browser has completed other operations.
|
|
42
|
+
*
|
|
43
|
+
* @param {Function} handler - callback function to be triggered.
|
|
44
|
+
* @returns {Function} ?
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
47
|
+
export function setImmediate(handler: Function): Function {
|
|
48
|
+
let unbind: Function;
|
|
49
|
+
// eslint-disable-next-line
|
|
50
|
+
const num: any = new Uint16Array(5);
|
|
51
|
+
const intCrypto: Crypto = window.msCrypto || window.crypto;
|
|
52
|
+
intCrypto.getRandomValues(num);
|
|
53
|
+
let secret: string = 'ej2' + combineArray(num);
|
|
54
|
+
// eslint-disable-next-line
|
|
55
|
+
let messageHandler: Function = (event: any): void => {
|
|
56
|
+
if (event.source === window && typeof event.data === 'string' && event.data.length <= 32 && event.data === secret) {
|
|
57
|
+
handler();
|
|
58
|
+
unbind();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
window.addEventListener('message', <EventListener>messageHandler, false);
|
|
62
|
+
window.postMessage(secret, '*');
|
|
63
|
+
return unbind = () => {
|
|
64
|
+
window.removeEventListener('message', <EventListener>messageHandler);
|
|
65
|
+
handler = messageHandler = secret = undefined;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* To get nameSpace value from the desired object.
|
|
70
|
+
*
|
|
71
|
+
* @param {string} nameSpace - String value to the get the inner object
|
|
72
|
+
* @param {any} obj - Object to get the inner object value.
|
|
73
|
+
* @returns {any} ?
|
|
74
|
+
* @private
|
|
75
|
+
*/
|
|
76
|
+
// eslint-disable-next-line
|
|
77
|
+
export function getValue(nameSpace: string, obj: any): any {
|
|
78
|
+
// eslint-disable-next-line
|
|
79
|
+
let value: any = obj;
|
|
80
|
+
const splits: string[] = nameSpace.replace(/\[/g, '.').replace(/\]/g, '').split('.');
|
|
81
|
+
|
|
82
|
+
for (let i: number = 0; i < splits.length && !isUndefined(value); i++) {
|
|
83
|
+
value = value[splits[parseInt(i.toString(), 10)]];
|
|
84
|
+
}
|
|
85
|
+
return value;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* To set value for the nameSpace in desired object.
|
|
89
|
+
*
|
|
90
|
+
* @param {string} nameSpace - String value to the get the inner object
|
|
91
|
+
* @param {any} value - Value that you need to set.
|
|
92
|
+
* @param {any} obj - Object to get the inner object value.
|
|
93
|
+
* @returns {any} ?
|
|
94
|
+
* @private
|
|
95
|
+
*/
|
|
96
|
+
// eslint-disable-next-line
|
|
97
|
+
export function setValue(nameSpace: string, value: any, obj: any): any {
|
|
98
|
+
const keys: string[] = nameSpace.replace(/\[/g, '.').replace(/\]/g, '').split('.');
|
|
99
|
+
// eslint-disable-next-line
|
|
100
|
+
const start: any = obj || {};
|
|
101
|
+
// eslint-disable-next-line
|
|
102
|
+
let fromObj: any = start;
|
|
103
|
+
let i: number;
|
|
104
|
+
const length: number = keys.length;
|
|
105
|
+
let key: string;
|
|
106
|
+
|
|
107
|
+
for (i = 0; i < length; i++) {
|
|
108
|
+
key = keys[parseInt(i.toString(), 10)];
|
|
109
|
+
|
|
110
|
+
if (i + 1 === length) {
|
|
111
|
+
fromObj[`${key}`] = value === undefined ? {} : value;
|
|
112
|
+
} else if (isNullOrUndefined(fromObj[`${key}`])) {
|
|
113
|
+
fromObj[`${key}`] = {};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
fromObj = fromObj[`${key}`];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return start;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Delete an item from Object
|
|
123
|
+
*
|
|
124
|
+
* @param {any} obj - Object in which we need to delete an item.
|
|
125
|
+
* @param {string} key - String value to the get the inner object
|
|
126
|
+
* @returns {void} ?
|
|
127
|
+
* @private
|
|
128
|
+
*/
|
|
129
|
+
// eslint-disable-next-line
|
|
130
|
+
export function deleteObject(obj: any, key: string): void {
|
|
131
|
+
delete obj[`${key}`];
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
*@private
|
|
135
|
+
*/
|
|
136
|
+
// eslint-disable-next-line
|
|
137
|
+
export const containerObject: any = typeof window !== 'undefined' ? window : {};
|
|
138
|
+
/**
|
|
139
|
+
* Check weather the given argument is only object.
|
|
140
|
+
*
|
|
141
|
+
* @param {any} obj - Object which is need to check.
|
|
142
|
+
* @returns {boolean} ?
|
|
143
|
+
* @private
|
|
144
|
+
*/
|
|
145
|
+
// eslint-disable-next-line
|
|
146
|
+
export function isObject(obj: any): boolean {
|
|
147
|
+
const objCon: {} = {};
|
|
148
|
+
return (!isNullOrUndefined(obj) && obj.constructor === objCon.constructor);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* To get enum value by giving the string.
|
|
152
|
+
*
|
|
153
|
+
* @param {any} enumObject - Enum object.
|
|
154
|
+
* @param {string} enumValue - Enum value to be searched
|
|
155
|
+
* @returns {any} ?
|
|
156
|
+
* @private
|
|
157
|
+
*/
|
|
158
|
+
// eslint-disable-next-line
|
|
159
|
+
export function getEnumValue(enumObject: any, enumValue: string | number): any {
|
|
160
|
+
// eslint-disable-next-line
|
|
161
|
+
return (<any>enumObject[enumValue]);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Merge the source object into destination object.
|
|
165
|
+
*
|
|
166
|
+
* @param {any} source - source object which is going to merge with destination object
|
|
167
|
+
* @param {any} destination - object need to be merged
|
|
168
|
+
* @returns {void} ?
|
|
169
|
+
* @private
|
|
170
|
+
*/
|
|
171
|
+
export function merge(source: Object, destination: Object): void {
|
|
172
|
+
if (!isNullOrUndefined(destination)) {
|
|
173
|
+
const temrObj: IKeyValue = source as IKeyValue;
|
|
174
|
+
const tempProp: IKeyValue = destination as IKeyValue;
|
|
175
|
+
const keys: string[] = Object.keys(destination);
|
|
176
|
+
const deepmerge: string = 'deepMerge';
|
|
177
|
+
for (const key of keys) {
|
|
178
|
+
if (!isNullOrUndefined(temrObj[`${deepmerge}`]) && (temrObj[`${deepmerge}`].indexOf(key) !== -1) &&
|
|
179
|
+
(isObject(tempProp[`${key}`]) || Array.isArray(tempProp[`${key}`]))) {
|
|
180
|
+
extend(temrObj[`${key}`], temrObj[`${key}`], tempProp[`${key}`], true);
|
|
181
|
+
} else {
|
|
182
|
+
temrObj[`${key}`] = tempProp[`${key}`];
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Extend the two object with newer one.
|
|
189
|
+
*
|
|
190
|
+
* @param {any} copied - Resultant object after merged
|
|
191
|
+
* @param {Object} first - First object need to merge
|
|
192
|
+
* @param {Object} second - Second object need to merge
|
|
193
|
+
* @param {boolean} deep ?
|
|
194
|
+
* @returns {Object} ?
|
|
195
|
+
* @private
|
|
196
|
+
*/
|
|
197
|
+
export function extend(copied: Object, first: Object, second?: Object, deep?: boolean): Object {
|
|
198
|
+
const result: IKeyValue = copied && typeof copied === 'object' ? copied as IKeyValue : {} as IKeyValue;
|
|
199
|
+
let length: number = arguments.length;
|
|
200
|
+
if (deep) {
|
|
201
|
+
length = length - 1;
|
|
202
|
+
}
|
|
203
|
+
for (let i: number = 1; i < length; i++) {
|
|
204
|
+
// eslint-disable-next-line
|
|
205
|
+
if (!arguments[i]) {
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
// eslint-disable-next-line
|
|
209
|
+
let obj1: { [key: string]: Object } = arguments[i];
|
|
210
|
+
Object.keys(obj1).forEach((key: string) => {
|
|
211
|
+
const src: Object = result[`${key}`];
|
|
212
|
+
const copy: Object = obj1[`${key}`];
|
|
213
|
+
let clone: Object;
|
|
214
|
+
const isArrayChanged: boolean = Array.isArray(copy) && Array.isArray(src) && (copy.length !== src.length);
|
|
215
|
+
// eslint-disable-next-line
|
|
216
|
+
const blazorEventExtend: any = isBlazor() ? (!(src instanceof Event) && !isArrayChanged) : true;
|
|
217
|
+
if (deep && blazorEventExtend && (isObject(copy) || Array.isArray(copy))) {
|
|
218
|
+
if (isObject(copy)) {
|
|
219
|
+
clone = src ? src : {};
|
|
220
|
+
// eslint-disable-next-line
|
|
221
|
+
if (Array.isArray(clone) && clone.hasOwnProperty('isComplexArray')) {
|
|
222
|
+
extend(clone, {}, copy, deep);
|
|
223
|
+
} else {
|
|
224
|
+
result[`${key}`] = extend(clone, {}, copy, deep);
|
|
225
|
+
}
|
|
226
|
+
} else {
|
|
227
|
+
/* istanbul ignore next */
|
|
228
|
+
clone = isBlazor() ? src && Object.keys(copy).length : src ? src : [];
|
|
229
|
+
// eslint-disable-next-line
|
|
230
|
+
result[`${key}`] = extend([], clone, copy, (clone && (clone as any).length) || (copy && (copy as any).length));
|
|
231
|
+
}
|
|
232
|
+
} else {
|
|
233
|
+
result[`${key}`] = copy;
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
return result;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* To check whether the object is null or undefined.
|
|
241
|
+
*
|
|
242
|
+
* @param {Object} value - To check the object is null or undefined
|
|
243
|
+
* @returns {boolean} ?
|
|
244
|
+
* @private
|
|
245
|
+
*/
|
|
246
|
+
export function isNullOrUndefined(value: Object): boolean {
|
|
247
|
+
return value === undefined || value === null;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* To check whether the object is undefined.
|
|
251
|
+
*
|
|
252
|
+
* @param {Object} value - To check the object is undefined
|
|
253
|
+
* @returns {boolean} ?
|
|
254
|
+
* @private
|
|
255
|
+
*/
|
|
256
|
+
export function isUndefined(value: Object): boolean {
|
|
257
|
+
return ('undefined' === typeof value);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* To return the generated unique name
|
|
261
|
+
*
|
|
262
|
+
* @param {string} definedName - To concatenate the unique id to provided name
|
|
263
|
+
* @returns {string} ?
|
|
264
|
+
* @private
|
|
265
|
+
*/
|
|
266
|
+
export function getUniqueID(definedName?: string): string {
|
|
267
|
+
return definedName + '_' + uid++;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* It limits the rate at which a function can fire. The function will fire only once every provided second instead of as quickly.
|
|
271
|
+
*
|
|
272
|
+
* @param {Function} eventFunction - Specifies the function to run when the event occurs
|
|
273
|
+
* @param {number} delay - A number that specifies the milliseconds for function delay call option
|
|
274
|
+
* @returns {Function} ?
|
|
275
|
+
* @private
|
|
276
|
+
*/
|
|
277
|
+
export function debounce(eventFunction: Function, delay: number): Function {
|
|
278
|
+
// eslint-disable-next-line
|
|
279
|
+
let out: any;
|
|
280
|
+
return function (): void {
|
|
281
|
+
// eslint-disable-next-line
|
|
282
|
+
const args: Object = arguments;
|
|
283
|
+
const later: TimeoutHandler = () => {
|
|
284
|
+
out = null;
|
|
285
|
+
return eventFunction.apply(this, args);
|
|
286
|
+
};
|
|
287
|
+
clearTimeout(out);
|
|
288
|
+
out = setTimeout(later, delay);
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* To convert the object to string for query url
|
|
294
|
+
*
|
|
295
|
+
* @param {Object} data ?
|
|
296
|
+
* @returns {string} ?
|
|
297
|
+
* @private
|
|
298
|
+
*/
|
|
299
|
+
// eslint-disable-next-line
|
|
300
|
+
export function queryParams(data: any): string {
|
|
301
|
+
const array: string[] = [];
|
|
302
|
+
const keys: string[] = Object.keys(data);
|
|
303
|
+
for (const key of keys) {
|
|
304
|
+
array.push(encodeURIComponent(key) + '=' + encodeURIComponent('' + data[`${key}`]));
|
|
305
|
+
}
|
|
306
|
+
return array.join('&');
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* To check whether the given array contains object.
|
|
310
|
+
*
|
|
311
|
+
* @param {any} value - Specifies the T type array to be checked.
|
|
312
|
+
* @returns {boolean} ?
|
|
313
|
+
* @private
|
|
314
|
+
*/
|
|
315
|
+
export function isObjectArray<T>(value: T[]): boolean {
|
|
316
|
+
const parser: Function = Object.prototype.toString;
|
|
317
|
+
if (parser.call(value) === '[object Array]') {
|
|
318
|
+
if (parser.call(value[0]) === '[object Object]') {
|
|
319
|
+
return true;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* To check whether the child element is descendant to parent element or parent and child are same element.
|
|
326
|
+
*
|
|
327
|
+
* @param {Element} child - Specifies the child element to compare with parent.
|
|
328
|
+
* @param {Element} parent - Specifies the parent element.
|
|
329
|
+
* @returns {boolean} ?
|
|
330
|
+
* @private
|
|
331
|
+
*/
|
|
332
|
+
export function compareElementParent(child: Element, parent: Element): boolean {
|
|
333
|
+
const node: Node = child;
|
|
334
|
+
if (node === parent) {
|
|
335
|
+
return true;
|
|
336
|
+
} else if (node === document || !node) {
|
|
337
|
+
return false;
|
|
338
|
+
} else {
|
|
339
|
+
return compareElementParent(<Element>node.parentNode, parent);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* To throw custom error message.
|
|
344
|
+
*
|
|
345
|
+
* @param {string} message - Specifies the error message to be thrown.
|
|
346
|
+
* @returns {void} ?
|
|
347
|
+
* @private
|
|
348
|
+
*/
|
|
349
|
+
export function throwError(message: string): void {
|
|
350
|
+
try {
|
|
351
|
+
throw new Error(message);
|
|
352
|
+
} catch (e) {
|
|
353
|
+
// eslint-disable-next-line
|
|
354
|
+
throw e.message + '\n' + e.stack;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* This function is used to print given element
|
|
359
|
+
*
|
|
360
|
+
* @param {Element} element - Specifies the print content element.
|
|
361
|
+
* @param {Window} printWindow - Specifies the print window.
|
|
362
|
+
* @returns {Window} ?
|
|
363
|
+
* @private
|
|
364
|
+
*/
|
|
365
|
+
export function print(element: Element, printWindow?: Window): Window {
|
|
366
|
+
const div: Element = document.createElement('div');
|
|
367
|
+
const links: HTMLElement[] = [].slice.call(document.getElementsByTagName('head')[0].querySelectorAll('base, link, style'));
|
|
368
|
+
const blinks: HTMLElement[] = [].slice.call(document.getElementsByTagName('body')[0].querySelectorAll('link, style'));
|
|
369
|
+
if (blinks.length) {
|
|
370
|
+
for (let l: number = 0, len: number = blinks.length; l < len; l++) {
|
|
371
|
+
links.push(blinks[parseInt(l.toString(), 10)]);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
let reference: string = '';
|
|
375
|
+
if (isNullOrUndefined(printWindow)) {
|
|
376
|
+
printWindow = window.open('', 'print', 'height=452,width=1024,tabbar=no');
|
|
377
|
+
}
|
|
378
|
+
div.appendChild(element.cloneNode(true) as Element);
|
|
379
|
+
for (let i: number = 0, len: number = links.length; i < len; i++) {
|
|
380
|
+
reference += links[parseInt(i.toString(), 10)].outerHTML;
|
|
381
|
+
}
|
|
382
|
+
printWindow.document.write('<!DOCTYPE html> <html><head>' + reference + '</head><body>' + div.innerHTML +
|
|
383
|
+
'<script> (function() { window.ready = true; })(); </script>' + '</body></html>');
|
|
384
|
+
printWindow.document.close();
|
|
385
|
+
printWindow.focus();
|
|
386
|
+
// eslint-disable-next-line
|
|
387
|
+
const interval: any = setInterval(
|
|
388
|
+
() => {
|
|
389
|
+
if ((<{ ready: Function } & Window>printWindow).ready) {
|
|
390
|
+
printWindow.print();
|
|
391
|
+
printWindow.close();
|
|
392
|
+
clearInterval(interval);
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
500);
|
|
396
|
+
return printWindow;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Function to normalize the units applied to the element.
|
|
401
|
+
*
|
|
402
|
+
* @param {number|string} value ?
|
|
403
|
+
* @returns {string} result
|
|
404
|
+
* @private
|
|
405
|
+
*/
|
|
406
|
+
export function formatUnit(value: number | string): string {
|
|
407
|
+
const result: string = <string>value + '';
|
|
408
|
+
if (result.match(/auto|cm|mm|in|px|pt|pc|%|em|ex|ch|rem|vw|vh|vmin|vmax/)) {
|
|
409
|
+
return result;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
return result + 'px';
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Function to check whether the platform is blazor or not.
|
|
417
|
+
*
|
|
418
|
+
* @returns {void} result
|
|
419
|
+
* @private
|
|
420
|
+
*/
|
|
421
|
+
export function enableBlazorMode(): void {
|
|
422
|
+
isBlazorPlatform = true;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Function to check whether the platform is blazor or not.
|
|
427
|
+
*
|
|
428
|
+
* @returns {boolean} result
|
|
429
|
+
* @private
|
|
430
|
+
*/
|
|
431
|
+
export function isBlazor(): boolean {
|
|
432
|
+
return isBlazorPlatform;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Function to convert xPath to DOM element in blazor platform
|
|
437
|
+
*
|
|
438
|
+
* @returns {HTMLElement} result
|
|
439
|
+
* @param {HTMLElement | object} element ?
|
|
440
|
+
* @private
|
|
441
|
+
*/
|
|
442
|
+
export function getElement(element: object): HTMLElement {
|
|
443
|
+
const xPath: string = 'xPath';
|
|
444
|
+
if (!(element instanceof Node) && isBlazor() && !isNullOrUndefined(element[`${xPath}`])) {
|
|
445
|
+
return document.evaluate(element[`${xPath}`], document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue as HTMLElement;
|
|
446
|
+
}
|
|
447
|
+
return element as HTMLElement;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Function to fetch the Instances of a HTML element for the given component.
|
|
453
|
+
*
|
|
454
|
+
* @param {string | HTMLElement} element ?
|
|
455
|
+
* @param {any} component ?
|
|
456
|
+
* @returns {Object} ?
|
|
457
|
+
* @private
|
|
458
|
+
*/
|
|
459
|
+
// eslint-disable-next-line
|
|
460
|
+
export function getInstance(element: string | HTMLElement, component: any): Object {
|
|
461
|
+
// eslint-disable-next-line
|
|
462
|
+
let elem: any = (typeof (element) === 'string') ? document.querySelector(element) : element;
|
|
463
|
+
if (elem[`${instances}`]) {
|
|
464
|
+
for (const inst of elem[`${instances}`]) {
|
|
465
|
+
if (inst instanceof component) {
|
|
466
|
+
return inst;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
return null;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Function to add instances for the given element.
|
|
475
|
+
*
|
|
476
|
+
* @param {string | HTMLElement} element ?
|
|
477
|
+
* @param {Object} instance ?
|
|
478
|
+
* @returns {void} ?
|
|
479
|
+
* @private
|
|
480
|
+
*/
|
|
481
|
+
export function addInstance(element: string | HTMLElement, instance: Object): void {
|
|
482
|
+
// eslint-disable-next-line
|
|
483
|
+
let elem: any = (typeof (element) === 'string') ? document.querySelector(element) : element;
|
|
484
|
+
if (elem[`${instances}`]) {
|
|
485
|
+
elem[`${instances}`].push(instance);
|
|
486
|
+
} else {
|
|
487
|
+
elem[`${instances}`] = [instance];
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Function to generate the unique id.
|
|
493
|
+
*
|
|
494
|
+
* @returns {any} ?
|
|
495
|
+
* @private
|
|
496
|
+
*/
|
|
497
|
+
// eslint-disable-next-line
|
|
498
|
+
export function uniqueID(): any {
|
|
499
|
+
if ((typeof window) === 'undefined') {
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
// eslint-disable-next-line
|
|
503
|
+
let num: any = new Uint16Array(5);
|
|
504
|
+
const intCrypto: Crypto = window.msCrypto || window.crypto;
|
|
505
|
+
return intCrypto.getRandomValues(num);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
interface TimeoutHandler {
|
|
509
|
+
(): Function;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
*
|
|
514
|
+
* @param {Int16Array} num ?
|
|
515
|
+
* @returns {string} ?
|
|
516
|
+
*/
|
|
517
|
+
function combineArray(num: Int16Array): string {
|
|
518
|
+
let ret: string = '';
|
|
519
|
+
for (let i: number = 0; i < 5; i++) {
|
|
520
|
+
ret += (i ? ',' : '') + num[parseInt(i.toString(), 10)];
|
|
521
|
+
}
|
|
522
|
+
return ret;
|
|
523
|
+
}
|
|
File without changes
|
package/e2e/crypto.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var crypto = require("crypto");
|
|
2
|
-
global.encrypt_decrypt = {
|
|
3
|
-
"encrypt": function(data) {
|
|
4
|
-
var key = "syncfusion";
|
|
5
|
-
var cipher = crypto.createCipher('aes-256-cbc', key);
|
|
6
|
-
var crypted = cipher.update(data, 'utf-8', 'hex');
|
|
7
|
-
crypted += cipher.final('hex');
|
|
8
|
-
return crypted;
|
|
9
|
-
},
|
|
10
|
-
"decrypt": function(data) {
|
|
11
|
-
var key = "syncfusion";
|
|
12
|
-
var decipher = crypto.createDecipher('aes-256-cbc', key);
|
|
13
|
-
var decrypted = decipher.update(data, 'hex', 'utf-8');
|
|
14
|
-
decrypted += decipher.final('utf-8');
|
|
15
|
-
return decrypted;
|
|
16
|
-
}
|
|
1
|
+
var crypto = require("crypto");
|
|
2
|
+
global.encrypt_decrypt = {
|
|
3
|
+
"encrypt": function(data) {
|
|
4
|
+
var key = "syncfusion";
|
|
5
|
+
var cipher = crypto.createCipher('aes-256-cbc', key);
|
|
6
|
+
var crypted = cipher.update(data, 'utf-8', 'hex');
|
|
7
|
+
crypted += cipher.final('hex');
|
|
8
|
+
return crypted;
|
|
9
|
+
},
|
|
10
|
+
"decrypt": function(data) {
|
|
11
|
+
var key = "syncfusion";
|
|
12
|
+
var decipher = crypto.createDecipher('aes-256-cbc', key);
|
|
13
|
+
var decrypted = decipher.update(data, 'hex', 'utf-8');
|
|
14
|
+
decrypted += decipher.final('utf-8');
|
|
15
|
+
return decrypted;
|
|
16
|
+
}
|
|
17
17
|
};
|