@syncfusion/ej2-angular-base 25.2.6 → 26.1.35
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 +261 -0
- package/dist/ej2-angular-base.umd.min.js +2 -2
- package/dist/ej2-angular-base.umd.min.js.map +1 -1
- package/dist/es6/ej2-angular-base.es2015.js +232 -212
- package/dist/es6/ej2-angular-base.es2015.js.map +1 -1
- package/dist/es6/ej2-angular-base.es5.js +156 -136
- package/dist/es6/ej2-angular-base.es5.js.map +1 -1
- package/dist/global/ej2-angular-base.min.js +2 -2
- package/dist/global/ej2-angular-base.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +27 -9
- package/schematics/generators/component-builder.d.ts +3 -0
- package/schematics/generators/component-builder.js +23 -22
- package/schematics/generators/index.js +1 -0
- package/schematics/index.d.ts +0 -4
- package/schematics/index.js +21 -9
- package/schematics/ng-add/index.d.ts +3 -0
- package/schematics/ng-add/index.js +14 -12
- package/schematics/ng-add/theme.d.ts +3 -0
- package/schematics/ng-add/theme.js +10 -8
- package/schematics/utils/ast.d.ts +3 -2
- package/schematics/utils/ast.js +8 -8
- package/schematics/utils/get-project.d.ts +4 -2
- package/schematics/utils/get-project.js +3 -2
- package/schematics/utils/helpers/helpers.js +19 -18
- package/schematics/utils/package.js +1 -0
- package/schematics/utils/project-style-file.d.ts +5 -3
- package/schematics/utils/project-style-file.js +4 -3
- package/src/complex-array-base.d.ts +1 -0
- package/src/complex-array-base.js +31 -28
- package/src/component-base.d.ts +1 -0
- package/src/component-base.js +37 -51
- package/src/form-base.d.ts +3 -3
- package/src/form-base.js +0 -4
- package/src/template.d.ts +8 -1
- package/src/template.js +23 -5
- package/src/util.d.ts +26 -3
- package/src/util.js +51 -28
- package/styles/fluent2.css +1033 -0
- package/styles/fluent2.scss +1 -0
- package/styles/material3-dark.css +1 -1
- package/styles/material3.css +1 -1
- package/tslint.json +111 -0
- package/CHANGELOG.md +0 -710
|
@@ -1,38 +1,53 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isNullOrUndefined, getValue, setValue as setValue$1, createElement, attributes, isUndefined, isObject, getTemplateEngine, setTemplateEngine } from '@syncfusion/ej2-base';
|
|
2
2
|
import { EventEmitter } from '@angular/core';
|
|
3
3
|
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types */
|
|
4
5
|
/**
|
|
5
6
|
* Angular Utility Module
|
|
7
|
+
*
|
|
8
|
+
* @param {Function} derivedClass The derived class to which mixins are applied.
|
|
9
|
+
* @param {Function[]} baseClass An array of base classes whose methods are applied as mixins.
|
|
10
|
+
* @returns {void}
|
|
6
11
|
*/
|
|
7
|
-
/* tslint:disable */
|
|
8
12
|
function applyMixins(derivedClass, baseClass) {
|
|
9
|
-
baseClass.forEach(baseClass => {
|
|
10
|
-
Object.getOwnPropertyNames(baseClass.prototype).forEach(name => {
|
|
11
|
-
if (!
|
|
12
|
-
derivedClass.prototype[name] = baseClass.prototype[name];
|
|
13
|
+
baseClass.forEach((baseClass) => {
|
|
14
|
+
Object.getOwnPropertyNames(baseClass.prototype).forEach((name) => {
|
|
15
|
+
if (!Object.prototype.hasOwnProperty.call(derivedClass.prototype, name) || (baseClass.isFormBase && name !== 'constructor')) {
|
|
16
|
+
derivedClass.prototype[`${name}`] = baseClass.prototype[`${name}`];
|
|
13
17
|
}
|
|
14
18
|
});
|
|
15
19
|
});
|
|
16
20
|
}
|
|
17
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Decorator function to apply mixins to a derived class.
|
|
23
|
+
*
|
|
24
|
+
* @param {Function[]} baseClass - An array of mixin classes to be applied to the derived class.
|
|
25
|
+
* @returns {ClassDecorator} The decorator function.
|
|
26
|
+
*/
|
|
18
27
|
function ComponentMixins(baseClass) {
|
|
19
28
|
return function (derivedClass) {
|
|
20
29
|
applyMixins(derivedClass, baseClass);
|
|
21
30
|
};
|
|
22
31
|
}
|
|
23
32
|
/**
|
|
33
|
+
* Registers events.
|
|
34
|
+
*
|
|
24
35
|
* @private
|
|
36
|
+
* @param {string[]} eventList - The list of events to register.
|
|
37
|
+
* @param {any} obj - The object on which to register the events.
|
|
38
|
+
* @param {boolean} [direct] - Whether to register events directly on the object or not.
|
|
39
|
+
* @returns {void}
|
|
25
40
|
*/
|
|
26
41
|
function registerEvents(eventList, obj, direct) {
|
|
27
|
-
|
|
42
|
+
const ngEventsEmitter = {};
|
|
28
43
|
if (eventList && eventList.length) {
|
|
29
|
-
for (
|
|
44
|
+
for (const event of eventList) {
|
|
30
45
|
if (direct === true) {
|
|
31
|
-
obj.propCollection[event] = new EventEmitter(false);
|
|
32
|
-
obj[event] = obj.propCollection[event];
|
|
46
|
+
obj.propCollection[`${event}`] = new EventEmitter(false);
|
|
47
|
+
obj[`${event}`] = obj.propCollection[`${event}`];
|
|
33
48
|
}
|
|
34
49
|
else {
|
|
35
|
-
ngEventsEmitter[event] = new EventEmitter(false);
|
|
50
|
+
ngEventsEmitter[`${event}`] = new EventEmitter(false);
|
|
36
51
|
}
|
|
37
52
|
}
|
|
38
53
|
if (direct !== true) {
|
|
@@ -41,49 +56,55 @@ function registerEvents(eventList, obj, direct) {
|
|
|
41
56
|
}
|
|
42
57
|
}
|
|
43
58
|
/**
|
|
59
|
+
* Clears registered templates.
|
|
60
|
+
*
|
|
44
61
|
* @private
|
|
62
|
+
* @param {any} _this - The context object.
|
|
63
|
+
* @param {string[]} [templateNames] - Optional. An array of template names to clear.
|
|
64
|
+
* @param {any[]} [index] - Optional. An array of indices specifying templates to clear.
|
|
65
|
+
* @returns {void}
|
|
45
66
|
*/
|
|
46
67
|
function clearTemplate(_this, templateNames, index) {
|
|
47
|
-
|
|
68
|
+
const regTemplates = Object.keys(_this.registeredTemplate);
|
|
48
69
|
if (regTemplates.length) {
|
|
49
70
|
/* istanbul ignore next */
|
|
50
|
-
|
|
71
|
+
const regProperties = templateNames && templateNames.filter((val) => {
|
|
51
72
|
return (/\./g.test(val) ? false : true);
|
|
52
73
|
});
|
|
53
|
-
|
|
54
|
-
for (
|
|
74
|
+
const tabaccordionTemp = /tab|accordion|toolbar/.test(_this.getModuleName());
|
|
75
|
+
for (const registeredTemplate of (regProperties && regProperties || regTemplates)) {
|
|
55
76
|
/* istanbul ignore next */
|
|
56
77
|
if (index && index.length) {
|
|
57
78
|
for (let e = 0; e < index.length; e++) {
|
|
58
79
|
if (tabaccordionTemp) {
|
|
59
|
-
for (let m = 0; m < _this.registeredTemplate[registeredTemplate].length; m++) {
|
|
60
|
-
|
|
61
|
-
if (value && value === index[e]) {
|
|
80
|
+
for (let m = 0; m < _this.registeredTemplate[`${registeredTemplate}`].length; m++) {
|
|
81
|
+
const value = _this.registeredTemplate[`${registeredTemplate}`][parseInt(m.toString(), 10)];
|
|
82
|
+
if (value && value === index[`${e}`]) {
|
|
62
83
|
value.destroy();
|
|
63
|
-
_this.registeredTemplate[registeredTemplate].splice(m, 1);
|
|
84
|
+
_this.registeredTemplate[`${registeredTemplate}`].splice(m, 1);
|
|
64
85
|
}
|
|
65
86
|
}
|
|
66
87
|
}
|
|
67
88
|
else {
|
|
68
89
|
for (let m = 0; m < _this.registeredTemplate.template.length; m++) {
|
|
69
|
-
|
|
70
|
-
if (value === index[e]) {
|
|
71
|
-
|
|
72
|
-
rt[m].destroy();
|
|
90
|
+
const value = _this.registeredTemplate.template[parseInt(m.toString(), 10)].rootNodes[0];
|
|
91
|
+
if (value === index[`${e}`]) {
|
|
92
|
+
const rt = _this.registeredTemplate[`${registeredTemplate}`];
|
|
93
|
+
rt[parseInt(m.toString(), 10)].destroy();
|
|
73
94
|
}
|
|
74
95
|
}
|
|
75
96
|
}
|
|
76
97
|
}
|
|
77
98
|
}
|
|
78
99
|
else {
|
|
79
|
-
if (_this.registeredTemplate[registeredTemplate]) {
|
|
80
|
-
for (
|
|
100
|
+
if (_this.registeredTemplate[`${registeredTemplate}`]) {
|
|
101
|
+
for (const rt of _this.registeredTemplate[`${registeredTemplate}`]) {
|
|
81
102
|
if (!rt.destroyed) {
|
|
82
103
|
if (rt._view) {
|
|
83
|
-
|
|
104
|
+
const pNode = rt._view.renderer.parentNode(rt.rootNodes[0]);
|
|
84
105
|
if (!isNullOrUndefined(pNode)) {
|
|
85
106
|
for (let m = 0; m < rt.rootNodes.length; m++) {
|
|
86
|
-
pNode.appendChild(rt.rootNodes[m]);
|
|
107
|
+
pNode.appendChild(rt.rootNodes[parseInt(m.toString(), 10)]);
|
|
87
108
|
}
|
|
88
109
|
}
|
|
89
110
|
}
|
|
@@ -93,40 +114,42 @@ function clearTemplate(_this, templateNames, index) {
|
|
|
93
114
|
}
|
|
94
115
|
}
|
|
95
116
|
if (!tabaccordionTemp || !index) {
|
|
96
|
-
delete _this.registeredTemplate[registeredTemplate];
|
|
117
|
+
delete _this.registeredTemplate[`${registeredTemplate}`];
|
|
97
118
|
}
|
|
98
119
|
}
|
|
99
120
|
}
|
|
100
|
-
for (
|
|
121
|
+
for (const tagObject of _this.tagObjects) {
|
|
101
122
|
if (tagObject.instance) {
|
|
102
123
|
/* istanbul ignore next */
|
|
103
124
|
tagObject.instance.clearTemplate((templateNames && templateNames.filter((val) => {
|
|
104
|
-
|
|
125
|
+
const regExp = RegExp;
|
|
126
|
+
return (new regExp(tagObject.name).test(val) ? true : false);
|
|
105
127
|
})));
|
|
106
128
|
}
|
|
107
129
|
}
|
|
108
130
|
}
|
|
109
131
|
/**
|
|
110
132
|
* To set value for the nameSpace in desired object.
|
|
111
|
-
*
|
|
133
|
+
*
|
|
134
|
+
* @param {string} nameSpace - String value to get the inner object.
|
|
112
135
|
* @param {any} value - Value that you need to set.
|
|
113
|
-
* @param {any}
|
|
114
|
-
* @
|
|
136
|
+
* @param {any} object - Object to get the inner object value.
|
|
137
|
+
* @returns {void}
|
|
115
138
|
* @private
|
|
116
139
|
*/
|
|
117
|
-
function setValue
|
|
118
|
-
|
|
140
|
+
function setValue(nameSpace, value, object) {
|
|
141
|
+
const keys = nameSpace.replace(/\[/g, '.').replace(/\]/g, '').split('.');
|
|
119
142
|
/* istanbul ignore next */
|
|
120
143
|
let fromObj = object || {};
|
|
121
144
|
for (let i = 0; i < keys.length; i++) {
|
|
122
|
-
|
|
145
|
+
const key = keys[parseInt(i.toString(), 10)];
|
|
123
146
|
if (i + 1 === keys.length) {
|
|
124
|
-
fromObj[key] = value === undefined ? {} : value;
|
|
147
|
+
fromObj[`${key}`] = value === undefined ? {} : value;
|
|
125
148
|
}
|
|
126
|
-
else if (fromObj[key] === undefined) {
|
|
127
|
-
fromObj[key] = {};
|
|
149
|
+
else if (fromObj[`${key}`] === undefined) {
|
|
150
|
+
fromObj[`${key}`] = {};
|
|
128
151
|
}
|
|
129
|
-
fromObj = fromObj[key];
|
|
152
|
+
fromObj = fromObj[`${key}`];
|
|
130
153
|
}
|
|
131
154
|
return fromObj;
|
|
132
155
|
}
|
|
@@ -142,22 +165,22 @@ class ComplexBase {
|
|
|
142
165
|
}
|
|
143
166
|
ngOnInit() {
|
|
144
167
|
this.registeredTemplate = {};
|
|
145
|
-
for (
|
|
146
|
-
|
|
168
|
+
for (const tag of this.tags) {
|
|
169
|
+
const objInstance = getValue('child' + tag.substring(0, 1).toUpperCase() + tag.substring(1), this);
|
|
147
170
|
if (objInstance) {
|
|
148
171
|
this.tagObjects.push({ instance: objInstance, name: tag });
|
|
149
172
|
}
|
|
150
173
|
}
|
|
151
174
|
let templateProperties = Object.keys(this);
|
|
152
175
|
for (let i = 0; i < templateProperties.length; i++) {
|
|
153
|
-
|
|
176
|
+
const tempProp = getValue(templateProperties[parseInt(i.toString(), 10)], this);
|
|
154
177
|
if (typeof tempProp === 'object' && tempProp && tempProp.elementRef) {
|
|
155
|
-
if (!getValue(templateProperties[i].indexOf('Ref') !== -1 ? templateProperties[i] : templateProperties[i] + 'Ref', this)) {
|
|
156
|
-
setValue(templateProperties[i].indexOf('Ref') !== -1 ? templateProperties[i] : templateProperties[i] + 'Ref', tempProp, this);
|
|
178
|
+
if (!getValue(templateProperties[parseInt(i.toString(), 10)].indexOf('Ref') !== -1 ? templateProperties[parseInt(i.toString(), 10)] : templateProperties[parseInt(i.toString(), 10)] + 'Ref', this)) {
|
|
179
|
+
setValue$1(templateProperties[parseInt(i.toString(), 10)].indexOf('Ref') !== -1 ? templateProperties[parseInt(i.toString(), 10)] : templateProperties[parseInt(i.toString(), 10)] + 'Ref', tempProp, this);
|
|
157
180
|
}
|
|
158
|
-
if (getValue(
|
|
159
|
-
setValue(
|
|
160
|
-
setValue(
|
|
181
|
+
if (getValue('viewContainerRef', this) && !getValue('_viewContainerRef', tempProp.elementRef.nativeElement) && !getValue('propName', tempProp.elementRef.nativeElement)) {
|
|
182
|
+
setValue$1('_viewContainerRef', getValue('viewContainerRef', this), tempProp.elementRef.nativeElement);
|
|
183
|
+
setValue$1('propName', templateProperties[parseInt(i.toString(), 10)].replace('Ref', ''), tempProp.elementRef.nativeElement);
|
|
161
184
|
}
|
|
162
185
|
}
|
|
163
186
|
}
|
|
@@ -165,19 +188,19 @@ class ComplexBase {
|
|
|
165
188
|
templateProperties = templateProperties.filter((val) => {
|
|
166
189
|
return /Ref$/i.test(val);
|
|
167
190
|
});
|
|
168
|
-
for (
|
|
169
|
-
|
|
170
|
-
setValue(propName.replace('_', '.'), getValue(propName, this), this.propCollection);
|
|
191
|
+
for (const tempName of templateProperties) {
|
|
192
|
+
const propName = tempName.replace('Ref', '');
|
|
193
|
+
setValue$1(propName.replace('_', '.'), getValue(propName, this), this.propCollection);
|
|
171
194
|
}
|
|
172
195
|
// Angular 9 compatibility to overcome ngOnchange not get triggered issue
|
|
173
196
|
// To Update properties to "this.propCollection"
|
|
174
|
-
|
|
197
|
+
const propList = Object.keys(this);
|
|
175
198
|
/* istanbul ignore next */
|
|
176
199
|
if (this.directivePropList) {
|
|
177
200
|
for (let k = 0; k < this.directivePropList.length; k++) {
|
|
178
|
-
|
|
201
|
+
const dirPropName = this.directivePropList[parseInt(k.toString(), 10)];
|
|
179
202
|
if (propList.indexOf(dirPropName) !== -1 && (getValue(dirPropName, this) === false || getValue(dirPropName, this))) {
|
|
180
|
-
setValue(dirPropName, getValue(dirPropName, this), this.propCollection);
|
|
203
|
+
setValue$1(dirPropName, getValue(dirPropName, this), this.propCollection);
|
|
181
204
|
}
|
|
182
205
|
}
|
|
183
206
|
this.hasChanges = true;
|
|
@@ -188,9 +211,9 @@ class ComplexBase {
|
|
|
188
211
|
registerEvents(eventList, this, true);
|
|
189
212
|
}
|
|
190
213
|
ngOnChanges(changes) {
|
|
191
|
-
for (
|
|
192
|
-
|
|
193
|
-
this.propCollection[propName] = changedVal.currentValue;
|
|
214
|
+
for (const propName of Object.keys(changes)) {
|
|
215
|
+
const changedVal = changes[`${propName}`];
|
|
216
|
+
this.propCollection[`${propName}`] = changedVal.currentValue;
|
|
194
217
|
}
|
|
195
218
|
this.isUpdated = false;
|
|
196
219
|
this.hasChanges = true;
|
|
@@ -201,7 +224,7 @@ class ComplexBase {
|
|
|
201
224
|
}
|
|
202
225
|
getProperties() {
|
|
203
226
|
/* istanbul ignore next */
|
|
204
|
-
for (
|
|
227
|
+
for (const tagObject of this.tagObjects) {
|
|
205
228
|
this.propCollection[tagObject.name] = tagObject.instance.getProperties();
|
|
206
229
|
}
|
|
207
230
|
return this.propCollection;
|
|
@@ -209,16 +232,16 @@ class ComplexBase {
|
|
|
209
232
|
isChanged() {
|
|
210
233
|
let result = this.hasChanges;
|
|
211
234
|
if (!isNullOrUndefined(this.propCollection[this.property])) {
|
|
212
|
-
|
|
213
|
-
|
|
235
|
+
const tempProps = this.propCollection[this.property];
|
|
236
|
+
const props = Object.keys(tempProps[0]);
|
|
214
237
|
for (let d = 0; d < props.length; d++) {
|
|
215
|
-
if (!isNullOrUndefined(this.propCollection[props[d]])) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
if (!isNullOrUndefined(val) && this.propCollection[props[d]] !== val
|
|
238
|
+
if (!isNullOrUndefined(this.propCollection[props[parseInt(d.toString(), 10)]])) {
|
|
239
|
+
const val = getValue(props[parseInt(d.toString(), 10)], this);
|
|
240
|
+
const propVal = this.propCollection[this.property][0][props[parseInt(d.toString(), 10)]];
|
|
241
|
+
if (!isNullOrUndefined(val) && this.propCollection[props[parseInt(d.toString(), 10)]] !== val
|
|
219
242
|
&& propVal !== val) {
|
|
220
|
-
setValue(props[d], val, this.propCollection[this.property][0]);
|
|
221
|
-
setValue(props[d], val, this.propCollection);
|
|
243
|
+
setValue$1(props[parseInt(d.toString(), 10)], val, this.propCollection[this.property][0]);
|
|
244
|
+
setValue$1(props[parseInt(d.toString(), 10)], val, this.propCollection);
|
|
222
245
|
this.hasChanges = true;
|
|
223
246
|
this.isUpdated = false;
|
|
224
247
|
}
|
|
@@ -226,7 +249,7 @@ class ComplexBase {
|
|
|
226
249
|
}
|
|
227
250
|
}
|
|
228
251
|
/* istanbul ignore next */
|
|
229
|
-
for (
|
|
252
|
+
for (const item of this.tagObjects) {
|
|
230
253
|
result = result || item.instance.hasChanges;
|
|
231
254
|
}
|
|
232
255
|
return result || this.hasChanges;
|
|
@@ -238,9 +261,9 @@ class ComplexBase {
|
|
|
238
261
|
templateProperties = templateProperties.filter((val) => {
|
|
239
262
|
return refRegex.test(val);
|
|
240
263
|
});
|
|
241
|
-
for (
|
|
242
|
-
|
|
243
|
-
setValue(propName.replace('_', '.'), getValue(propName, this), this.propCollection);
|
|
264
|
+
for (const tempName of templateProperties) {
|
|
265
|
+
const propName = tempName.replace('Ref', '');
|
|
266
|
+
setValue$1(propName.replace('_', '.'), getValue(propName, this), this.propCollection);
|
|
244
267
|
}
|
|
245
268
|
}
|
|
246
269
|
}
|
|
@@ -279,8 +302,8 @@ class ArrayBase {
|
|
|
279
302
|
this.hasChanges = true;
|
|
280
303
|
}
|
|
281
304
|
getProperties() {
|
|
282
|
-
|
|
283
|
-
for (
|
|
305
|
+
const onlyProp = [];
|
|
306
|
+
for (const item of this.list) {
|
|
284
307
|
onlyProp.push(item.getProperties());
|
|
285
308
|
}
|
|
286
309
|
return onlyProp;
|
|
@@ -289,24 +312,26 @@ class ArrayBase {
|
|
|
289
312
|
let result = false;
|
|
290
313
|
let index = 0;
|
|
291
314
|
let isSourceChanged = false;
|
|
292
|
-
|
|
293
|
-
let childrenDataSource = this.children.map((child) => {
|
|
315
|
+
const childrenDataSource = this.children.map((child) => {
|
|
294
316
|
return child;
|
|
295
317
|
});
|
|
296
318
|
/* istanbul ignore next */
|
|
297
319
|
if (this.list.length === this.children.length) {
|
|
298
320
|
for (let i = 0; i < this.list.length; i++) {
|
|
299
|
-
if (this.list[i].propCollection.dataSource) {
|
|
300
|
-
if (this.list[i
|
|
301
|
-
this.list[i].propCollection.dataSource
|
|
302
|
-
|
|
321
|
+
if (this.list[parseInt(i.toString(), 10)].propCollection.dataSource) {
|
|
322
|
+
if (this.list[parseInt(i.toString(), 10)].dataSource &&
|
|
323
|
+
this.list[parseInt(i.toString(), 10)].propCollection.dataSource
|
|
324
|
+
!== this.list[parseInt(i.toString(), 10)].dataSource) {
|
|
325
|
+
this.list[parseInt(i.toString(), 10)].propCollection.dataSource = this.list[parseInt(i.toString(), 10)].dataSource;
|
|
326
|
+
this.list[parseInt(i.toString(), 10)].hasChanges = true;
|
|
303
327
|
}
|
|
304
|
-
if (this.list[i].property !==
|
|
305
|
-
isSourceChanged = (JSON.stringify(this.list[i].propCollection.dataSource) !==
|
|
306
|
-
JSON.stringify(childrenDataSource[i].propCollection.dataSource));
|
|
328
|
+
if (this.list[parseInt(i.toString(), 10)].property !== 'series') {
|
|
329
|
+
isSourceChanged = (JSON.stringify(this.list[parseInt(i.toString(), 10)].propCollection.dataSource) !==
|
|
330
|
+
JSON.stringify(childrenDataSource[parseInt(i.toString(), 10)].propCollection.dataSource));
|
|
307
331
|
}
|
|
308
332
|
}
|
|
309
|
-
isSourceChanged = this.list[i
|
|
333
|
+
isSourceChanged = this.list[parseInt(i.toString(), 10)].hasChanges
|
|
334
|
+
!== childrenDataSource[parseInt(i.toString(), 10)].hasChanges;
|
|
310
335
|
}
|
|
311
336
|
}
|
|
312
337
|
this.hasNewChildren = (this.list.length !== this.children.length || isSourceChanged) ? true : null;
|
|
@@ -318,26 +343,27 @@ class ArrayBase {
|
|
|
318
343
|
});
|
|
319
344
|
}
|
|
320
345
|
/* istanbul ignore end */
|
|
321
|
-
for (
|
|
346
|
+
for (const item of this.list) {
|
|
322
347
|
result = result || item.hasChanges;
|
|
323
348
|
}
|
|
324
349
|
return !!this.list.length && result;
|
|
325
350
|
}
|
|
326
351
|
clearTemplate(templateNames) {
|
|
327
352
|
/* istanbul ignore next */
|
|
328
|
-
for (
|
|
353
|
+
for (const item of this.list) {
|
|
329
354
|
item.clearTemplate(templateNames && templateNames.map((val) => {
|
|
330
|
-
|
|
355
|
+
const regExp = RegExp;
|
|
356
|
+
return new regExp(this.propertyName).test(val) ? val.replace(this.propertyName + '.', '') : val;
|
|
331
357
|
}));
|
|
332
358
|
}
|
|
333
359
|
}
|
|
334
360
|
ngAfterContentChecked() {
|
|
335
361
|
this.hasChanges = this.isChanged();
|
|
336
362
|
for (let i = 0; i < this.list.length; i++) {
|
|
337
|
-
if (getValue('childColumns', this.list[i]) && getValue('property', this.list[i]) === 'columns') {
|
|
338
|
-
setValue('columns', getValue('childColumns', this.list[i]).getProperties(), this.list[i].propCollection);
|
|
363
|
+
if (getValue('childColumns', this.list[parseInt(i.toString(), 10)]) && getValue('property', this.list[parseInt(i.toString(), 10)]) === 'columns') {
|
|
364
|
+
setValue$1('columns', getValue('childColumns', this.list[parseInt(i.toString(), 10)]).getProperties(), this.list[parseInt(i.toString(), 10)].propCollection);
|
|
339
365
|
}
|
|
340
|
-
this.list[i].isUpdated = true;
|
|
366
|
+
this.list[parseInt(i.toString(), 10)].isUpdated = true;
|
|
341
367
|
}
|
|
342
368
|
}
|
|
343
369
|
ngAfterViewInit() {
|
|
@@ -348,9 +374,7 @@ class ArrayBase {
|
|
|
348
374
|
}
|
|
349
375
|
}
|
|
350
376
|
|
|
351
|
-
|
|
352
|
-
* Angular Component Base Module
|
|
353
|
-
*/
|
|
377
|
+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types */
|
|
354
378
|
class ComponentBase {
|
|
355
379
|
constructor() {
|
|
356
380
|
this.isProtectedOnChange = true;
|
|
@@ -360,21 +384,17 @@ class ComponentBase {
|
|
|
360
384
|
if (this.isProtectedOnChange) {
|
|
361
385
|
return;
|
|
362
386
|
}
|
|
363
|
-
this.oldProperties[key] = oldValue;
|
|
364
|
-
this.changedProperties[key] = newValue;
|
|
387
|
+
this.oldProperties[`${key}`] = oldValue;
|
|
388
|
+
this.changedProperties[`${key}`] = newValue;
|
|
365
389
|
this.finalUpdate();
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
let clearUpdate = () => {
|
|
390
|
+
const changeTime = setTimeout(this.dataBind.bind(this));
|
|
391
|
+
const clearUpdate = () => {
|
|
369
392
|
clearTimeout(changeTime);
|
|
370
393
|
};
|
|
371
394
|
this.finalUpdate = clearUpdate;
|
|
372
395
|
}
|
|
373
|
-
;
|
|
374
|
-
// tslint:disable-next-line:no-any
|
|
375
396
|
ngOnInit(isTempRef) {
|
|
376
|
-
|
|
377
|
-
let tempOnThis = isTempRef || this;
|
|
397
|
+
const tempOnThis = isTempRef || this;
|
|
378
398
|
tempOnThis.registeredTemplate = {};
|
|
379
399
|
tempOnThis.ngBoundedEvents = {};
|
|
380
400
|
tempOnThis.isAngular = true;
|
|
@@ -389,8 +409,7 @@ class ComponentBase {
|
|
|
389
409
|
tempOnThis.ngAttr = this.getAngularAttr(tempOnThis.element);
|
|
390
410
|
/* istanbul ignore next */
|
|
391
411
|
tempOnThis.createElement = (tagName, prop) => {
|
|
392
|
-
|
|
393
|
-
let ele = tempOnThis.srenderer ? tempOnThis.srenderer.createElement(tagName) : createElement(tagName);
|
|
412
|
+
const ele = tempOnThis.srenderer ? tempOnThis.srenderer.createElement(tagName) : createElement(tagName);
|
|
394
413
|
if (typeof (prop) === 'undefined') {
|
|
395
414
|
return ele;
|
|
396
415
|
}
|
|
@@ -412,8 +431,8 @@ class ComponentBase {
|
|
|
412
431
|
}
|
|
413
432
|
return ele;
|
|
414
433
|
};
|
|
415
|
-
for (
|
|
416
|
-
|
|
434
|
+
for (const tag of tempOnThis.tags) {
|
|
435
|
+
const tagObject = {
|
|
417
436
|
instance: getValue('child' + tag.substring(0, 1).toUpperCase() + tag.substring(1), tempOnThis),
|
|
418
437
|
name: tag
|
|
419
438
|
};
|
|
@@ -421,46 +440,43 @@ class ComponentBase {
|
|
|
421
440
|
}
|
|
422
441
|
let complexTemplates = Object.keys(tempOnThis);
|
|
423
442
|
for (let i = 0; i < complexTemplates.length; i++) {
|
|
424
|
-
|
|
443
|
+
const compProp = getValue(complexTemplates[parseInt(i.toString(), 10)], tempOnThis);
|
|
425
444
|
if (typeof compProp === 'object' && compProp && compProp.elementRef) {
|
|
426
|
-
if (typeof compProp === 'object' && compProp && compProp.elementRef && complexTemplates[i].indexOf('_') !== -1 && complexTemplates[i].indexOf('Ref') === -1) {
|
|
427
|
-
setValue(complexTemplates[i] + 'Ref', compProp, tempOnThis);
|
|
445
|
+
if (typeof compProp === 'object' && compProp && compProp.elementRef && complexTemplates[parseInt(i.toString(), 10)].indexOf('_') !== -1 && complexTemplates[parseInt(i.toString(), 10)].indexOf('Ref') === -1) {
|
|
446
|
+
setValue$1(complexTemplates[parseInt(i.toString(), 10)] + 'Ref', compProp, tempOnThis);
|
|
428
447
|
}
|
|
429
|
-
if (tempOnThis.viewContainerRef && !getValue(
|
|
430
|
-
setValue(
|
|
431
|
-
setValue(
|
|
448
|
+
if (tempOnThis.viewContainerRef && !getValue('_viewContainerRef', compProp.elementRef.nativeElement) && !getValue('propName', compProp.elementRef.nativeElement)) {
|
|
449
|
+
setValue$1('_viewContainerRef', tempOnThis.viewContainerRef, compProp.elementRef.nativeElement);
|
|
450
|
+
setValue$1('propName', complexTemplates[parseInt(i.toString(), 10)].replace('Ref', ''), compProp.elementRef.nativeElement);
|
|
432
451
|
}
|
|
433
452
|
}
|
|
434
453
|
}
|
|
435
454
|
complexTemplates = Object.keys(tempOnThis);
|
|
436
455
|
complexTemplates = complexTemplates.filter((val) => {
|
|
437
|
-
return /Ref$/i.test(val) &&
|
|
456
|
+
return /Ref$/i.test(val) && /_/i.test(val);
|
|
438
457
|
});
|
|
439
|
-
for (
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
setValue(propName.replace('_', '.'), getValue(propName, tempOnThis), val);
|
|
458
|
+
for (const tempName of complexTemplates) {
|
|
459
|
+
const propName = tempName.replace('Ref', '');
|
|
460
|
+
const val = {};
|
|
461
|
+
setValue$1(propName.replace('_', '.'), getValue(propName, tempOnThis), val);
|
|
443
462
|
tempOnThis.setProperties(val, true);
|
|
444
463
|
}
|
|
445
464
|
}
|
|
446
465
|
getAngularAttr(ele) {
|
|
447
|
-
|
|
448
|
-
|
|
466
|
+
const attributes = ele.attributes;
|
|
467
|
+
const length = attributes.length;
|
|
449
468
|
let ngAr;
|
|
450
469
|
for (let i = 0; i < length; i++) {
|
|
451
470
|
/* istanbul ignore next */
|
|
452
|
-
if (/_ngcontent/g.test(attributes
|
|
453
|
-
ngAr = attributes
|
|
471
|
+
if (/_ngcontent/g.test(attributes[parseInt(i.toString(), 10)].name)) {
|
|
472
|
+
ngAr = attributes[parseInt(i.toString(), 10)].name;
|
|
454
473
|
}
|
|
455
474
|
}
|
|
456
475
|
return ngAr;
|
|
457
476
|
}
|
|
458
|
-
;
|
|
459
|
-
// tslint:disable-next-line:no-any
|
|
460
477
|
ngAfterViewInit(isTempRef) {
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
let regExp = /ejs-tab|ejs-accordion/g;
|
|
478
|
+
const tempAfterViewThis = isTempRef || this;
|
|
479
|
+
const regExp = /ejs-tab|ejs-accordion/g;
|
|
464
480
|
/* istanbul ignore next */
|
|
465
481
|
if (regExp.test(tempAfterViewThis.ngEle.nativeElement.outerHTML)) {
|
|
466
482
|
tempAfterViewThis.ngEle.nativeElement.style.visibility = 'hidden';
|
|
@@ -481,10 +497,10 @@ class ComponentBase {
|
|
|
481
497
|
templateProperties = templateProperties.filter((val) => {
|
|
482
498
|
return /Ref$/i.test(val);
|
|
483
499
|
});
|
|
484
|
-
|
|
485
|
-
for (
|
|
486
|
-
|
|
487
|
-
setValue(propName.replace('_', '.'), getValue(propName + 'Ref', tempAfterViewThis), tempAfterViewThis);
|
|
500
|
+
const ngtempRef = tempAfterViewThis.getModuleName() === 'DocumentEditor';
|
|
501
|
+
for (const tempName of templateProperties) {
|
|
502
|
+
const propName = tempName.replace('Ref', '');
|
|
503
|
+
setValue$1(propName.replace('_', '.'), getValue(propName + 'Ref', tempAfterViewThis), tempAfterViewThis);
|
|
488
504
|
}
|
|
489
505
|
// Used setTimeout for template binding
|
|
490
506
|
// Refer Link: https://github.com/angular/angular/issues/6005
|
|
@@ -504,10 +520,8 @@ class ComponentBase {
|
|
|
504
520
|
appendToComponent(tempAfterViewThis);
|
|
505
521
|
}
|
|
506
522
|
}
|
|
507
|
-
// tslint:disable-next-line:no-any
|
|
508
523
|
ngOnDestroy(isTempRef) {
|
|
509
|
-
|
|
510
|
-
let tempOnDestroyThis = isTempRef || this;
|
|
524
|
+
const tempOnDestroyThis = isTempRef || this;
|
|
511
525
|
/* istanbul ignore else */
|
|
512
526
|
setTimeout(() => {
|
|
513
527
|
if (typeof window !== 'undefined' && (tempOnDestroyThis.element.classList.contains('e-control'))) {
|
|
@@ -515,20 +529,20 @@ class ComponentBase {
|
|
|
515
529
|
tempOnDestroyThis.clearTemplate(null);
|
|
516
530
|
// removing bounded events and tagobjects from component after destroy
|
|
517
531
|
setTimeout(function () {
|
|
518
|
-
for (
|
|
519
|
-
|
|
532
|
+
for (const key of Object.keys(tempOnDestroyThis)) {
|
|
533
|
+
const value = tempOnDestroyThis[`${key}`];
|
|
520
534
|
if (value && /object/.test(typeof value) && Object.keys(value).length !== 0) {
|
|
521
535
|
if (/properties|changedProperties|childChangedProperties|oldProperties|moduleLoader/.test(key)) {
|
|
522
|
-
for (
|
|
523
|
-
|
|
536
|
+
for (const propKey of Object.keys(tempOnDestroyThis[`${key}`])) {
|
|
537
|
+
const propValue = value[`${propKey}`];
|
|
524
538
|
if (propValue && /object/.test(typeof propValue) && Object.keys(propValue).length !== 0 && (propValue.parent || propValue.parentObj)) {
|
|
525
|
-
tempOnDestroyThis[key][propKey] = null;
|
|
539
|
+
tempOnDestroyThis[`${key}`][`${propKey}`] = null;
|
|
526
540
|
}
|
|
527
541
|
}
|
|
528
542
|
}
|
|
529
543
|
else {
|
|
530
544
|
if (value.parent || value.parentObj) {
|
|
531
|
-
tempOnDestroyThis[key] = null;
|
|
545
|
+
tempOnDestroyThis[`${key}`] = null;
|
|
532
546
|
}
|
|
533
547
|
}
|
|
534
548
|
}
|
|
@@ -537,25 +551,21 @@ class ComponentBase {
|
|
|
537
551
|
}
|
|
538
552
|
});
|
|
539
553
|
}
|
|
540
|
-
//tslint:disable-next-line
|
|
541
554
|
clearTemplate(templateNames, index) {
|
|
542
555
|
clearTemplate(this, templateNames, index);
|
|
543
556
|
}
|
|
544
|
-
;
|
|
545
|
-
// tslint:disable-next-line:no-any
|
|
546
557
|
ngAfterContentChecked(isTempRef) {
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
for (let tagObject of tempAfterContentThis.tagObjects) {
|
|
558
|
+
const tempAfterContentThis = isTempRef || this;
|
|
559
|
+
for (const tagObject of tempAfterContentThis.tagObjects) {
|
|
550
560
|
if (!isUndefined(tagObject.instance) &&
|
|
551
561
|
(tagObject.instance.isInitChanges || tagObject.instance.hasChanges || tagObject.instance.hasNewChildren)) {
|
|
552
|
-
|
|
562
|
+
const propObj = {};
|
|
553
563
|
if (tagObject.instance.isInitChanges) {
|
|
554
564
|
// For angular 9 compatibility
|
|
555
565
|
// Not able to get complex directive properties reference ni Onint hook
|
|
556
566
|
// So we have constructed property here and used
|
|
557
567
|
let complexDirProps;
|
|
558
|
-
|
|
568
|
+
const list = getValue('instance.list', tagObject);
|
|
559
569
|
if (list && list.length) {
|
|
560
570
|
complexDirProps = list[0].directivePropList;
|
|
561
571
|
}
|
|
@@ -564,29 +574,30 @@ class ComponentBase {
|
|
|
564
574
|
skip = false;
|
|
565
575
|
}
|
|
566
576
|
if (complexDirProps && skip && complexDirProps.indexOf(tagObject.instance.propertyName) === -1) {
|
|
567
|
-
|
|
577
|
+
const compDirPropList = Object.keys(tagObject.instance.list[0].propCollection);
|
|
568
578
|
for (let h = 0; h < tagObject.instance.list.length; h++) {
|
|
569
|
-
tagObject.instance.list[h].propCollection[tagObject.instance.propertyName] = [];
|
|
570
|
-
|
|
579
|
+
tagObject.instance.list[`${h}`].propCollection[tagObject.instance.propertyName] = [];
|
|
580
|
+
const obj = {};
|
|
571
581
|
for (let k = 0; k < compDirPropList.length; k++) {
|
|
572
|
-
|
|
573
|
-
obj[complexPropName] = tagObject.instance.list[h].propCollection[complexPropName];
|
|
582
|
+
const complexPropName = compDirPropList[parseInt(k.toString(), 10)];
|
|
583
|
+
obj[`${complexPropName}`] = tagObject.instance.list[`${h}`].propCollection[`${complexPropName}`];
|
|
574
584
|
}
|
|
575
|
-
for (let i = 0; i < tagObject.instance.list[h].tags.length; i++) {
|
|
576
|
-
|
|
577
|
-
|
|
585
|
+
for (let i = 0; i < tagObject.instance.list[`${h}`].tags.length; i++) {
|
|
586
|
+
const tag = tagObject.instance.list[`${h}`].tags[parseInt(i.toString(), 10)];
|
|
587
|
+
const childObj = getValue('child' + tag.substring(0, 1).toUpperCase() + tag.substring(1), tagObject.instance.list[`${h}`]);
|
|
578
588
|
if (childObj) {
|
|
579
|
-
|
|
589
|
+
const innerchildObj = tagObject.instance.list[`${h}`]['child' + tag.substring(0, 1).toUpperCase() + tag.substring(1)];
|
|
580
590
|
// Update the inner child tag objects
|
|
581
591
|
const updateChildTag = (innerchild) => {
|
|
582
|
-
|
|
592
|
+
const innerLevelTag = [];
|
|
583
593
|
if (innerchild) {
|
|
584
594
|
for (let j = 0; j < innerchild.list.length; j++) {
|
|
585
|
-
|
|
595
|
+
const innerTag = innerchild.list[0].tags[0];
|
|
586
596
|
if (innerTag) {
|
|
587
|
-
|
|
597
|
+
const innerchildTag = getValue('child' + innerTag.substring(0, 1).toUpperCase() + innerTag.substring(1), innerchild.list[parseInt(j.toString(), 10)]);
|
|
588
598
|
if (innerchildTag) {
|
|
589
|
-
innerchild.list[j
|
|
599
|
+
innerchild.list[parseInt(j.toString(), 10)].tagObjects
|
|
600
|
+
.push({ instance: innerchildTag, name: innerTag });
|
|
590
601
|
innerLevelTag.push(innerchildTag);
|
|
591
602
|
}
|
|
592
603
|
}
|
|
@@ -595,16 +606,15 @@ class ComponentBase {
|
|
|
595
606
|
// check for inner level tag
|
|
596
607
|
if (innerLevelTag.length !== 0) {
|
|
597
608
|
for (let l = 0; l < innerLevelTag.length; l++) {
|
|
598
|
-
updateChildTag(innerLevelTag[l]);
|
|
609
|
+
updateChildTag(innerLevelTag[parseInt(l.toString(), 10)]);
|
|
599
610
|
}
|
|
600
611
|
}
|
|
601
|
-
|
|
602
612
|
};
|
|
603
613
|
updateChildTag(innerchildObj);
|
|
604
|
-
tagObject.instance.list[h].tagObjects.push({ instance: childObj, name: tag });
|
|
614
|
+
tagObject.instance.list[`${h}`].tagObjects.push({ instance: childObj, name: tag });
|
|
605
615
|
}
|
|
606
616
|
}
|
|
607
|
-
tagObject.instance.list[h].propCollection[tagObject.instance.propertyName].push(obj);
|
|
617
|
+
tagObject.instance.list[`${h}`].propCollection[tagObject.instance.propertyName].push(obj);
|
|
608
618
|
}
|
|
609
619
|
}
|
|
610
620
|
// End angular 9 compatibility
|
|
@@ -618,9 +628,9 @@ class ComponentBase {
|
|
|
618
628
|
tempAfterContentThis[tagObject.name] = tagObject.instance.list;
|
|
619
629
|
hasDiffLength = true;
|
|
620
630
|
}
|
|
621
|
-
for (
|
|
622
|
-
|
|
623
|
-
|
|
631
|
+
for (const list of tagObject.instance.list) {
|
|
632
|
+
const curIndex = tagObject.instance.list.indexOf(list);
|
|
633
|
+
const curChild = getValue(tagObject.name, tempAfterContentThis)[`${curIndex}`];
|
|
624
634
|
let complexTemplates = Object.keys(curChild);
|
|
625
635
|
complexTemplates = complexTemplates.filter((val) => {
|
|
626
636
|
return /Ref$/i.test(val);
|
|
@@ -628,8 +638,8 @@ class ComponentBase {
|
|
|
628
638
|
if (curChild.properties && Object.keys(curChild.properties).length !== 0) {
|
|
629
639
|
for (let complexPropName of complexTemplates) {
|
|
630
640
|
complexPropName = complexPropName.replace(/Ref/, '');
|
|
631
|
-
curChild.properties[complexPropName] = !curChild.properties[complexPropName] ?
|
|
632
|
-
curChild.propCollection[complexPropName] : curChild.properties[complexPropName];
|
|
641
|
+
curChild.properties[`${complexPropName}`] = !curChild.properties[`${complexPropName}`] ?
|
|
642
|
+
curChild.propCollection[`${complexPropName}`] : curChild.properties[`${complexPropName}`];
|
|
633
643
|
}
|
|
634
644
|
}
|
|
635
645
|
if (!isUndefined(curChild) && !isUndefined(curChild.setProperties)) {
|
|
@@ -654,16 +664,16 @@ class ComponentBase {
|
|
|
654
664
|
registerEvents(eventList, this);
|
|
655
665
|
}
|
|
656
666
|
twoWaySetter(newVal, prop) {
|
|
657
|
-
|
|
667
|
+
const oldVal = getValue(prop, this.properties);
|
|
658
668
|
if (oldVal === newVal) {
|
|
659
669
|
return;
|
|
660
670
|
}
|
|
661
671
|
this.saveChanges(prop, newVal, oldVal);
|
|
662
|
-
setValue(prop, (isNullOrUndefined(newVal) ? null : newVal), this.properties);
|
|
672
|
+
setValue$1(prop, (isNullOrUndefined(newVal) ? null : newVal), this.properties);
|
|
663
673
|
getValue(prop + 'Change', this).emit(newVal);
|
|
664
674
|
}
|
|
665
675
|
addTwoWay(propList) {
|
|
666
|
-
for (
|
|
676
|
+
for (const prop of propList) {
|
|
667
677
|
getValue(prop, this);
|
|
668
678
|
Object.defineProperty(this, prop, {
|
|
669
679
|
get: () => {
|
|
@@ -671,27 +681,27 @@ class ComponentBase {
|
|
|
671
681
|
},
|
|
672
682
|
set: (newVal) => this.twoWaySetter(newVal, prop)
|
|
673
683
|
});
|
|
674
|
-
setValue(prop + 'Change', new EventEmitter(), this);
|
|
684
|
+
setValue$1(prop + 'Change', new EventEmitter(), this);
|
|
675
685
|
}
|
|
676
686
|
}
|
|
677
687
|
addEventListener(eventName, handler) {
|
|
678
|
-
|
|
688
|
+
const eventObj = getValue(eventName, this);
|
|
679
689
|
if (!isUndefined(eventObj)) {
|
|
680
|
-
if (!this.ngBoundedEvents[eventName]) {
|
|
681
|
-
this.ngBoundedEvents[eventName] = new Map();
|
|
690
|
+
if (!this.ngBoundedEvents[`${eventName}`]) {
|
|
691
|
+
this.ngBoundedEvents[`${eventName}`] = new Map();
|
|
682
692
|
}
|
|
683
|
-
this.ngBoundedEvents[eventName].set(handler, eventObj.subscribe(handler));
|
|
693
|
+
this.ngBoundedEvents[`${eventName}`].set(handler, eventObj.subscribe(handler));
|
|
684
694
|
}
|
|
685
695
|
}
|
|
686
696
|
removeEventListener(eventName, handler) {
|
|
687
|
-
|
|
697
|
+
const eventObj = getValue(eventName, this);
|
|
688
698
|
if (!isUndefined(eventObj)) {
|
|
689
|
-
this.ngBoundedEvents[eventName].get(handler).unsubscribe();
|
|
699
|
+
this.ngBoundedEvents[`${eventName}`].get(handler).unsubscribe();
|
|
690
700
|
}
|
|
691
701
|
}
|
|
692
702
|
trigger(eventName, eventArgs, success) {
|
|
693
|
-
|
|
694
|
-
|
|
703
|
+
const eventObj = getValue(eventName, this);
|
|
704
|
+
const prevDetection = this.isProtectedOnChange;
|
|
695
705
|
this.isProtectedOnChange = false;
|
|
696
706
|
if (eventArgs) {
|
|
697
707
|
eventArgs.name = eventName;
|
|
@@ -699,7 +709,7 @@ class ComponentBase {
|
|
|
699
709
|
if (!isUndefined(eventObj)) {
|
|
700
710
|
eventObj.next(eventArgs);
|
|
701
711
|
}
|
|
702
|
-
|
|
712
|
+
const localEventObj = getValue('local' + eventName.charAt(0).toUpperCase() + eventName.slice(1), this);
|
|
703
713
|
if (!isUndefined(localEventObj)) {
|
|
704
714
|
localEventObj.call(this, eventArgs);
|
|
705
715
|
}
|
|
@@ -720,8 +730,7 @@ class FormBase {
|
|
|
720
730
|
propagateChange(_) { return; }
|
|
721
731
|
propagateTouch() { return; }
|
|
722
732
|
localChange(e) {
|
|
723
|
-
|
|
724
|
-
let value = (e.checked === undefined ? e.value : e.checked);
|
|
733
|
+
const value = (e.checked === undefined ? e.value : e.checked);
|
|
725
734
|
this.objCheck = isObject(value);
|
|
726
735
|
if (this.isUpdated === true) {
|
|
727
736
|
this.angularValue = this.oldValue;
|
|
@@ -744,8 +753,7 @@ class FormBase {
|
|
|
744
753
|
this.angularValue = value;
|
|
745
754
|
}
|
|
746
755
|
else {
|
|
747
|
-
|
|
748
|
-
let optionalValue = value;
|
|
756
|
+
const optionalValue = value;
|
|
749
757
|
this.propagateChange(optionalValue);
|
|
750
758
|
this.angularValue = value;
|
|
751
759
|
}
|
|
@@ -760,20 +768,18 @@ class FormBase {
|
|
|
760
768
|
this.propagateTouch = registerFunction;
|
|
761
769
|
}
|
|
762
770
|
twoWaySetter(newVal, prop) {
|
|
763
|
-
|
|
764
|
-
|
|
771
|
+
const oldVal = this.oldValue || getValue(prop, this.properties);
|
|
772
|
+
const ele = this.inputElement || this.element;
|
|
765
773
|
if (ele && oldVal === newVal && this.value === newVal &&
|
|
766
774
|
(ele.value === undefined || ele.value === '')) {
|
|
767
775
|
return;
|
|
768
776
|
}
|
|
769
777
|
this.saveChanges(prop, newVal, oldVal);
|
|
770
|
-
setValue(prop, (isNullOrUndefined(newVal) ? null : newVal), this.properties);
|
|
778
|
+
setValue$1(prop, (isNullOrUndefined(newVal) ? null : newVal), this.properties);
|
|
771
779
|
getValue(prop + 'Change', this).emit(newVal);
|
|
772
780
|
}
|
|
773
|
-
// tslint:disable-next-line:no-any
|
|
774
781
|
ngAfterViewInit(isTempRef) {
|
|
775
|
-
|
|
776
|
-
let tempFormAfterViewThis = isTempRef || this;
|
|
782
|
+
const tempFormAfterViewThis = isTempRef || this;
|
|
777
783
|
// Used setTimeout for template binding
|
|
778
784
|
// Refer Link: https://github.com/angular/angular/issues/6005
|
|
779
785
|
// Removed setTimeout, Because we have called markForCheck() method in Angular Template Compiler
|
|
@@ -787,7 +793,7 @@ class FormBase {
|
|
|
787
793
|
else {
|
|
788
794
|
tempFormAfterViewThis.appendTo(tempFormAfterViewThis.element);
|
|
789
795
|
}
|
|
790
|
-
|
|
796
|
+
const ele = tempFormAfterViewThis.inputElement || tempFormAfterViewThis.element;
|
|
791
797
|
ele.addEventListener('focus', tempFormAfterViewThis.ngOnFocus.bind(tempFormAfterViewThis));
|
|
792
798
|
ele.addEventListener('blur', tempFormAfterViewThis.ngOnBlur.bind(tempFormAfterViewThis));
|
|
793
799
|
}
|
|
@@ -798,7 +804,7 @@ class FormBase {
|
|
|
798
804
|
this.disabled = disabled;
|
|
799
805
|
}
|
|
800
806
|
writeValue(value) {
|
|
801
|
-
|
|
807
|
+
const regExp = /ejs-radiobutton/g;
|
|
802
808
|
//update control value from angular
|
|
803
809
|
if (this.checked === undefined) {
|
|
804
810
|
this.value = value;
|
|
@@ -848,23 +854,26 @@ class FormBase {
|
|
|
848
854
|
}
|
|
849
855
|
FormBase.isFormBase = true;
|
|
850
856
|
|
|
851
|
-
|
|
857
|
+
const stringCompiler = getTemplateEngine();
|
|
852
858
|
/**
|
|
853
859
|
* Angular Template Compiler
|
|
860
|
+
*
|
|
861
|
+
* @param {AngularElementType} templateEle - The element representing the template.
|
|
862
|
+
* @param {Object} [helper] - Optional helper object.
|
|
863
|
+
* @returns {Function} A function that compiles the template.
|
|
854
864
|
*/
|
|
855
865
|
function compile(templateEle, helper) {
|
|
856
866
|
if (typeof templateEle === 'string' || (typeof templateEle === 'function' && templateEle.prototype && templateEle.prototype.CSPTemplate)) {
|
|
857
867
|
return stringCompiler(templateEle, helper);
|
|
858
868
|
}
|
|
859
869
|
else {
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
//tslint:disable-next-line
|
|
870
|
+
const contRef = templateEle.elementRef.nativeElement._viewContainerRef;
|
|
871
|
+
const pName = templateEle.elementRef.nativeElement.propName;
|
|
863
872
|
return (data, component, propName) => {
|
|
864
|
-
|
|
873
|
+
const context = { $implicit: data };
|
|
865
874
|
/* istanbul ignore next */
|
|
866
|
-
|
|
867
|
-
|
|
875
|
+
const conRef = contRef ? contRef : component.viewContainerRef;
|
|
876
|
+
const viewRef = conRef.createEmbeddedView(templateEle, context);
|
|
868
877
|
if (/EJS-MENTION|EJS-DROPDOWNLIST/.test(getValue('currentInstance.element.nodeName', conRef)) || /E-TABITEM/.test(getValue('element.nativeElement.nodeName', conRef))) {
|
|
869
878
|
viewRef.detectChanges();
|
|
870
879
|
}
|
|
@@ -872,23 +881,26 @@ function compile(templateEle, helper) {
|
|
|
872
881
|
viewRef.markForCheck();
|
|
873
882
|
}
|
|
874
883
|
/* istanbul ignore next */
|
|
875
|
-
|
|
884
|
+
const viewCollection = (component && component.registeredTemplate) ?
|
|
876
885
|
component.registeredTemplate : getValue('currentInstance.registeredTemplate', conRef);
|
|
877
886
|
propName = (propName && component.registeredTemplate) ? propName : pName;
|
|
878
|
-
if (typeof viewCollection[propName] === 'undefined') {
|
|
879
|
-
viewCollection[propName] = [];
|
|
887
|
+
if (typeof viewCollection[`${propName}`] === 'undefined') {
|
|
888
|
+
viewCollection[`${propName}`] = [];
|
|
880
889
|
}
|
|
881
|
-
viewCollection[propName].push(viewRef);
|
|
890
|
+
viewCollection[`${propName}`].push(viewRef);
|
|
882
891
|
return viewRef.rootNodes;
|
|
883
892
|
};
|
|
884
893
|
}
|
|
885
894
|
}
|
|
886
895
|
/**
|
|
887
896
|
* Property decorator for angular.
|
|
897
|
+
*
|
|
898
|
+
* @param {Object} [defaultValue] - Default value for the property.
|
|
899
|
+
* @returns {PropertyDecorator} The decorator function.
|
|
888
900
|
*/
|
|
889
901
|
function Template(defaultValue) {
|
|
890
902
|
return (target, key) => {
|
|
891
|
-
|
|
903
|
+
const propertyDescriptor = {
|
|
892
904
|
set: setter(key),
|
|
893
905
|
get: getter(key, defaultValue),
|
|
894
906
|
enumerable: true,
|
|
@@ -897,12 +909,18 @@ function Template(defaultValue) {
|
|
|
897
909
|
Object.defineProperty(target, key, propertyDescriptor);
|
|
898
910
|
};
|
|
899
911
|
}
|
|
912
|
+
/**
|
|
913
|
+
* Creates a setter function for a given property key.
|
|
914
|
+
*
|
|
915
|
+
* @param {string} key - The property key.
|
|
916
|
+
* @returns {Function} The setter function.
|
|
917
|
+
*/
|
|
900
918
|
function setter(key) {
|
|
901
919
|
return function (val) {
|
|
902
920
|
if (val === undefined) {
|
|
903
921
|
return;
|
|
904
922
|
}
|
|
905
|
-
setValue(key + 'Ref', val, this);
|
|
923
|
+
setValue$1(key + 'Ref', val, this);
|
|
906
924
|
if (typeof val !== 'string') {
|
|
907
925
|
val.elementRef.nativeElement._viewContainerRef = this.viewContainerRef;
|
|
908
926
|
val.elementRef.nativeElement.propName = key;
|
|
@@ -915,18 +933,20 @@ function setter(key) {
|
|
|
915
933
|
}
|
|
916
934
|
};
|
|
917
935
|
}
|
|
936
|
+
/**
|
|
937
|
+
* Returns a getter function for the specified key and default value.
|
|
938
|
+
*
|
|
939
|
+
* @param {string} key - The key for the property.
|
|
940
|
+
* @param {Object} defaultValue - The default value for the property.
|
|
941
|
+
* @returns {Function} The getter function.
|
|
942
|
+
*/
|
|
918
943
|
function getter(key, defaultValue) {
|
|
919
944
|
return function () {
|
|
920
945
|
/* istanbul ignore next */
|
|
921
946
|
return getValue(key + 'Ref', this) || defaultValue;
|
|
922
947
|
};
|
|
923
948
|
}
|
|
924
|
-
//tslint:disable-next-line
|
|
925
949
|
setTemplateEngine({ compile: compile });
|
|
926
950
|
|
|
927
|
-
|
|
928
|
-
* Index
|
|
929
|
-
*/
|
|
930
|
-
|
|
931
|
-
export { ComplexBase, ArrayBase, ComponentBase, FormBase, applyMixins, ComponentMixins, registerEvents, clearTemplate, setValue$1 as setValue, compile, Template };
|
|
951
|
+
export { ArrayBase, ComplexBase, ComponentBase, ComponentMixins, FormBase, Template, applyMixins, clearTemplate, compile, registerEvents, setValue };
|
|
932
952
|
//# sourceMappingURL=ej2-angular-base.es2015.js.map
|