@syncfusion/ej2-vue-base 20.4.51 → 21.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/CHANGELOG.md +12 -0
- package/dist/ej2-vue-base.umd.min.js +2 -12
- package/dist/ej2-vue-base.umd.min.js.map +1 -1
- package/dist/es6/ej2-vue-base.es2015.js +465 -528
- package/dist/es6/ej2-vue-base.es2015.js.map +1 -1
- package/dist/es6/ej2-vue-base.es5.js +505 -578
- package/dist/es6/ej2-vue-base.es5.js.map +1 -1
- package/dist/global/ej2-vue-base.min.js +2 -2
- package/dist/global/ej2-vue-base.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +26 -9
- package/src/component-base.d.ts +4 -48
- package/src/component-base.js +448 -441
- package/src/index.d.ts +0 -1
- package/src/index.js +0 -1
- package/src/template.js +64 -5
- package/GitLeaksReport.json +0 -1
- package/gitleaks-ci/gitleaks +0 -0
- package/gitleaks-ci.tar.gz +0 -0
- package/postinstall.js +0 -119
- package/src/component-decorator.d.ts +0 -4
- package/src/component-decorator.js +0 -144
|
@@ -1,46 +1,42 @@
|
|
|
1
|
+
import * as Vue from 'vue';
|
|
1
2
|
import { createElement, detach, extend, getTemplateEngine, getUniqueID, getValue, isNullOrUndefined, setTemplateEngine } from '@syncfusion/ej2-base';
|
|
2
|
-
import { Vue } from 'vue-class-component';
|
|
3
|
-
import * as Vue$1 from 'vue';
|
|
4
|
-
import Vue$1__default from 'vue';
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
5
|
* Vue Component Base
|
|
8
6
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (obj && obj.__esModule) {
|
|
12
|
-
return obj;
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
let newObj = {};
|
|
16
|
-
if (obj != null) {
|
|
17
|
-
for (let key in obj) {
|
|
18
|
-
if (Object.prototype.hasOwnProperty.call(obj, key))
|
|
19
|
-
newObj[`${key}`] = obj[`${key}`];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
newObj.default = obj;
|
|
23
|
-
return newObj;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
const allVue = aVue;
|
|
27
|
-
const gh = allVue.h;
|
|
28
|
-
const isExecute = (parseInt(allVue.version) > 2) ? false : true;
|
|
29
|
-
let vueImport;
|
|
30
|
-
if (!isExecute || parseInt(allVue.version) < 3) {
|
|
31
|
-
vueImport = Vue;
|
|
7
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) {
|
|
8
|
+
return obj;
|
|
32
9
|
}
|
|
33
10
|
else {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
11
|
+
let newObj = {};
|
|
12
|
+
if (obj != null) {
|
|
13
|
+
for (let key in obj) {
|
|
14
|
+
if (Object.prototype.hasOwnProperty.call(obj, key))
|
|
15
|
+
newObj[`${key}`] = obj[`${key}`];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
newObj.default = obj;
|
|
19
|
+
return newObj;
|
|
20
|
+
} }
|
|
21
|
+
const curVue = _interopRequireWildcard(Vue);
|
|
22
|
+
const isExecute = (parseInt(curVue['version']) > 2) ? false : true;
|
|
23
|
+
const aVue = !isExecute ? curVue : curVue['default'];
|
|
24
|
+
const gh = curVue['h'];
|
|
25
|
+
let vueDefineComponent = (options) => { return !isExecute ? aVue['defineComponent'](options) : aVue['extend'](options); };
|
|
26
|
+
let ComponentBase = vueDefineComponent({
|
|
27
|
+
name: 'ComponentBase',
|
|
28
|
+
data() {
|
|
29
|
+
return {
|
|
30
|
+
ej2Instances: {},
|
|
31
|
+
tagMapper: {},
|
|
32
|
+
tagNameMapper: {},
|
|
33
|
+
hasInjectedModules: false,
|
|
34
|
+
hasChildDirective: false,
|
|
35
|
+
childDirObjects: '',
|
|
36
|
+
propKeys: {},
|
|
37
|
+
isDecorator: false
|
|
38
|
+
};
|
|
39
|
+
},
|
|
44
40
|
created() {
|
|
45
41
|
if (!this.propKeys) {
|
|
46
42
|
return;
|
|
@@ -73,7 +69,7 @@ class ComponentBase extends vueImport {
|
|
|
73
69
|
}
|
|
74
70
|
this.ej2Instances.injectedModules = prevModule;
|
|
75
71
|
}
|
|
76
|
-
}
|
|
72
|
+
},
|
|
77
73
|
mounted() {
|
|
78
74
|
let cusEle = this.$el ? this.$el.querySelectorAll("div.e-directive") : null;
|
|
79
75
|
if (!isExecute && cusEle) {
|
|
@@ -90,78 +86,7 @@ class ComponentBase extends vueImport {
|
|
|
90
86
|
this.setModelValue();
|
|
91
87
|
}
|
|
92
88
|
this.ej2Instances.appendTo(this.$el);
|
|
93
|
-
}
|
|
94
|
-
setModelValue() {
|
|
95
|
-
if (!isNullOrUndefined(this.modelValue) || !isNullOrUndefined(this.$attrs.modelValue)) {
|
|
96
|
-
const key = this.models.toString().match(/checked|value/) || [];
|
|
97
|
-
const propKey = key[0];
|
|
98
|
-
if (!isNullOrUndefined(propKey)) {
|
|
99
|
-
this.ej2Instances[`${propKey}`] = !isNullOrUndefined(this.modelValue) ? this.modelValue : this.$attrs.modelValue;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
getInjectedServices() {
|
|
104
|
-
let ret = [];
|
|
105
|
-
let provide;
|
|
106
|
-
if (this.$root && this.isDecorator) {
|
|
107
|
-
provide = getValue('$root.$options.provide', this);
|
|
108
|
-
}
|
|
109
|
-
else if (this.$vnode) {
|
|
110
|
-
provide = getValue('$vnode.context.$options.provide', this);
|
|
111
|
-
}
|
|
112
|
-
else if (this.$parent) {
|
|
113
|
-
provide = getValue('$parent.$options.provide', this);
|
|
114
|
-
}
|
|
115
|
-
if (isNullOrUndefined(provide) && !isNullOrUndefined(this.$)) {
|
|
116
|
-
provide = getValue('$.parent.provides', this);
|
|
117
|
-
}
|
|
118
|
-
if (provide) {
|
|
119
|
-
// tslint:disable:no-any
|
|
120
|
-
let injectables = provide;
|
|
121
|
-
if (typeof provide === 'function') {
|
|
122
|
-
if (provide.managed) {
|
|
123
|
-
let provideKey = provide.managed;
|
|
124
|
-
let provideValue = Object.keys(provideKey);
|
|
125
|
-
let key;
|
|
126
|
-
if (this.$root && this.isDecorator) {
|
|
127
|
-
key = Object.keys(this.$root);
|
|
128
|
-
}
|
|
129
|
-
else if (this.$vnode) {
|
|
130
|
-
key = Object.keys(this.$vnode.context);
|
|
131
|
-
}
|
|
132
|
-
else if (this.$parent) {
|
|
133
|
-
key = Object.keys(this.$parent);
|
|
134
|
-
}
|
|
135
|
-
for (let i = 0; i < provideValue.length; i++) {
|
|
136
|
-
for (let j = 0; j < key.length; j++) {
|
|
137
|
-
if ((key[parseInt(j.toString(), 10)].indexOf(provideValue[parseInt(i.toString(), 10)])) !== -1) {
|
|
138
|
-
if (this.$root && this.isDecorator) {
|
|
139
|
-
provideKey[provideValue[parseInt(j.toString(), 10)]] = this.$root[key[parseInt(i.toString(), 10)]];
|
|
140
|
-
}
|
|
141
|
-
else if (this.$vnode) {
|
|
142
|
-
provideKey[provideValue[parseInt(i.toString(), 10)]] = this.$vnode.context[key[parseInt(j.toString(), 10)]];
|
|
143
|
-
}
|
|
144
|
-
else if (this.$parent) {
|
|
145
|
-
provideKey[provideValue[parseInt(i.toString(), 10)]] = this.$parent[key[parseInt(j.toString(), 10)]];
|
|
146
|
-
}
|
|
147
|
-
injectables = provideKey;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
// tslint:disable:no-any
|
|
153
|
-
else if (this.$vnode) {
|
|
154
|
-
injectables = this.$vnode.context.$options.provide();
|
|
155
|
-
}
|
|
156
|
-
else if (this.$parent) {
|
|
157
|
-
injectables = this.$parent.$options.provide();
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
ret = injectables[this.ej2Instances.getModuleName()] || [];
|
|
161
|
-
}
|
|
162
|
-
this.isDecorator = false;
|
|
163
|
-
return ret;
|
|
164
|
-
}
|
|
89
|
+
},
|
|
165
90
|
updated() {
|
|
166
91
|
if (this.isVue3) {
|
|
167
92
|
this.setModelValue();
|
|
@@ -175,372 +100,434 @@ class ComponentBase extends vueImport {
|
|
|
175
100
|
this.assignValueToWrapper(childKey, false);
|
|
176
101
|
}
|
|
177
102
|
}
|
|
178
|
-
}
|
|
103
|
+
},
|
|
179
104
|
beforeDestroy() {
|
|
180
105
|
this.destroyComponent();
|
|
181
|
-
}
|
|
106
|
+
},
|
|
182
107
|
beforeUnmount() {
|
|
183
108
|
this.destroyComponent();
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
let options = {};
|
|
193
|
-
for (let prop of this.propKeys) {
|
|
194
|
-
if ((!isNullOrUndefined(this[`${prop}`]) && !this.isVue3) || (this[0] && !isNullOrUndefined(this[0][0]) && !isNullOrUndefined(this[0][0][`${prop}`]))) {
|
|
195
|
-
options[`${prop}`] = !this.isVue3 ? this[`${prop}`] : this[0][0][`${prop}`];
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
if (this.hasChildDirective) {
|
|
199
|
-
this.fetchChildPropValues(options);
|
|
200
|
-
}
|
|
201
|
-
if (this.hasInjectedModules) {
|
|
202
|
-
let prevModule = this.getInjectedServices() || [];
|
|
203
|
-
let curModule = this.ej2Instances.getInjectedModules() || [];
|
|
204
|
-
for (let mod of curModule) {
|
|
205
|
-
if (prevModule.indexOf(mod) === -1) {
|
|
206
|
-
prevModule.push(mod);
|
|
109
|
+
},
|
|
110
|
+
methods: {
|
|
111
|
+
setModelValue() {
|
|
112
|
+
if (!isNullOrUndefined(this.modelValue) || !isNullOrUndefined(this.$attrs.modelValue)) {
|
|
113
|
+
const key = this.models.toString().match(/checked|value/) || [];
|
|
114
|
+
const propKey = key[0];
|
|
115
|
+
if (!isNullOrUndefined(propKey)) {
|
|
116
|
+
this.ej2Instances[`${propKey}`] = !isNullOrUndefined(this.modelValue) ? this.modelValue : this.$attrs.modelValue;
|
|
207
117
|
}
|
|
208
118
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
let key
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
keyRef = keyRef.replace(controlName, '');
|
|
239
|
-
if (controlName == "splitter" && keyRef == "panes") {
|
|
240
|
-
keyRef = "paneSettings";
|
|
119
|
+
},
|
|
120
|
+
getInjectedServices() {
|
|
121
|
+
let ret = [];
|
|
122
|
+
let provide;
|
|
123
|
+
if (this.$root && this.isDecorator) {
|
|
124
|
+
provide = getValue('$root.$options.provide', this);
|
|
125
|
+
}
|
|
126
|
+
else if (this.$vnode) {
|
|
127
|
+
provide = getValue('$vnode.context.$options.provide', this);
|
|
128
|
+
}
|
|
129
|
+
else if (this.$parent) {
|
|
130
|
+
provide = getValue('$parent.$options.provide', this);
|
|
131
|
+
}
|
|
132
|
+
if (isNullOrUndefined(provide) && !isNullOrUndefined(this.$)) {
|
|
133
|
+
provide = getValue('$.parent.provides', this);
|
|
134
|
+
}
|
|
135
|
+
if (provide) {
|
|
136
|
+
// tslint:disable:no-any
|
|
137
|
+
let injectables = provide;
|
|
138
|
+
if (typeof provide === 'function') {
|
|
139
|
+
if (provide.managed) {
|
|
140
|
+
let provideKey = provide.managed;
|
|
141
|
+
let provideValue = Object.keys(provideKey);
|
|
142
|
+
let key;
|
|
143
|
+
if (this.$root && this.isDecorator) {
|
|
144
|
+
key = Object.keys(this.$root);
|
|
145
|
+
}
|
|
146
|
+
else if (this.$vnode) {
|
|
147
|
+
key = Object.keys(this.$vnode.context);
|
|
241
148
|
}
|
|
242
|
-
else if (
|
|
243
|
-
|
|
149
|
+
else if (this.$parent) {
|
|
150
|
+
key = Object.keys(this.$parent);
|
|
244
151
|
}
|
|
245
|
-
|
|
246
|
-
|
|
152
|
+
for (let i = 0; i < provideValue.length; i++) {
|
|
153
|
+
for (let j = 0; j < key.length; j++) {
|
|
154
|
+
if ((key[parseInt(j.toString(), 10)].indexOf(provideValue[parseInt(i.toString(), 10)])) !== -1) {
|
|
155
|
+
if (this.$root && this.isDecorator) {
|
|
156
|
+
provideKey[provideValue[parseInt(j.toString(), 10)]] = this.$root[key[parseInt(i.toString(), 10)]];
|
|
157
|
+
}
|
|
158
|
+
else if (this.$vnode) {
|
|
159
|
+
provideKey[provideValue[parseInt(i.toString(), 10)]] = this.$vnode.context[key[parseInt(j.toString(), 10)]];
|
|
160
|
+
}
|
|
161
|
+
else if (this.$parent) {
|
|
162
|
+
provideKey[provideValue[parseInt(i.toString(), 10)]] = this.$parent[key[parseInt(j.toString(), 10)]];
|
|
163
|
+
}
|
|
164
|
+
injectables = provideKey;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
247
167
|
}
|
|
248
|
-
|
|
168
|
+
}
|
|
169
|
+
// tslint:disable:no-any
|
|
170
|
+
else if (this.$vnode) {
|
|
171
|
+
injectables = this.$vnode.context.$options.provide();
|
|
172
|
+
}
|
|
173
|
+
else if (this.$parent) {
|
|
174
|
+
injectables = this.$parent.$options.provide();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
ret = injectables[this.ej2Instances.getModuleName()] || [];
|
|
178
|
+
}
|
|
179
|
+
this.isDecorator = false;
|
|
180
|
+
return ret;
|
|
181
|
+
},
|
|
182
|
+
destroyComponent() {
|
|
183
|
+
let tempBeforeDestroyThis = this;
|
|
184
|
+
tempBeforeDestroyThis.ej2Instances.destroy();
|
|
185
|
+
tempBeforeDestroyThis.$el.style.visibility = 'hidden';
|
|
186
|
+
tempBeforeDestroyThis = null;
|
|
187
|
+
},
|
|
188
|
+
bindProperties() {
|
|
189
|
+
let options = {};
|
|
190
|
+
for (let prop of this.propKeys) {
|
|
191
|
+
if (!isNullOrUndefined(this[`${prop}`])) {
|
|
192
|
+
options[`${prop}`] = this[`${prop}`];
|
|
193
|
+
}
|
|
194
|
+
else if (this[0] && !isNullOrUndefined(this[0][0]) && !isNullOrUndefined(this[0][0][`${prop}`])) {
|
|
195
|
+
options[`${prop}`] = this[0][0][`${prop}`];
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (this.hasChildDirective) {
|
|
199
|
+
this.fetchChildPropValues(options);
|
|
200
|
+
}
|
|
201
|
+
if (this.hasInjectedModules) {
|
|
202
|
+
let prevModule = this.getInjectedServices() || [];
|
|
203
|
+
let curModule = this.ej2Instances.getInjectedModules() || [];
|
|
204
|
+
for (let mod of curModule) {
|
|
205
|
+
if (prevModule.indexOf(mod) === -1) {
|
|
206
|
+
prevModule.push(mod);
|
|
249
207
|
}
|
|
250
208
|
}
|
|
209
|
+
this.ej2Instances.injectedModules = prevModule;
|
|
251
210
|
}
|
|
252
|
-
|
|
253
|
-
|
|
211
|
+
this.assignValueToWrapper(options);
|
|
212
|
+
},
|
|
213
|
+
assignValueToWrapper(option, silent) {
|
|
214
|
+
this.ej2Instances.setProperties(extend({}, {}, option, true), isNullOrUndefined(silent) ? true : silent);
|
|
215
|
+
},
|
|
216
|
+
fetchChildPropValues(childOption) {
|
|
217
|
+
let dirProps = {};
|
|
218
|
+
if (!this.isVue3) {
|
|
219
|
+
dirProps = this.getDirectiveValues(this.$slots.default, this.tagMapper || {}, this.tagNameMapper || {});
|
|
254
220
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
221
|
+
else {
|
|
222
|
+
let propRef;
|
|
223
|
+
if (this[0] && this[0][1].slots.default) {
|
|
224
|
+
propRef = this[0][1].slots.default();
|
|
225
|
+
}
|
|
226
|
+
else if (this && this.$ && this.$.slots && this.$.slots.default) {
|
|
227
|
+
propRef = this.$.slots.default();
|
|
228
|
+
}
|
|
229
|
+
if (propRef) {
|
|
230
|
+
for (let i = 0; i < propRef.length; i++) {
|
|
231
|
+
if (propRef[parseInt(i.toString(), 10)].type.methods || propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection') {
|
|
232
|
+
let key = propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection' ? 'series-collection' :
|
|
233
|
+
propRef[parseInt(i.toString(), 10)].type.methods.getTag().replace("e-", "");
|
|
234
|
+
let ref = this.resolveArrayDirectives(propRef[parseInt(i.toString(), 10)].children, key);
|
|
235
|
+
let splitKeys = key.split('-');
|
|
236
|
+
let controlName = this.ej2Instances.getModuleName().toLowerCase();
|
|
237
|
+
let keyRef = (splitKeys.length > 1 && controlName.indexOf(splitKeys[0]) > -1) ? splitKeys[1] : splitKeys[0];
|
|
238
|
+
keyRef = keyRef.replace(controlName, '');
|
|
239
|
+
if (controlName == "splitter" && keyRef == "panes") {
|
|
240
|
+
keyRef = "paneSettings";
|
|
241
|
+
}
|
|
242
|
+
else if (controlName == "bulletchart" && keyRef == "range") {
|
|
243
|
+
keyRef = "ranges";
|
|
244
|
+
}
|
|
245
|
+
else if (controlName == "schedule" && keyRef == "header") {
|
|
246
|
+
keyRef = "headerRows";
|
|
247
|
+
}
|
|
248
|
+
dirProps[`${keyRef}`] = ref[`${key}`];
|
|
249
|
+
}
|
|
250
|
+
}
|
|
277
251
|
}
|
|
278
252
|
else {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
if (!this.childDirObjects) {
|
|
257
|
+
this.childDirObjects = JSON.stringify(dirProps);
|
|
258
|
+
}
|
|
259
|
+
for (let dirProp of Object.keys(dirProps)) {
|
|
260
|
+
childOption[`${dirProp}`] = dirProps[`${dirProp}`];
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
resolveArrayDirectives(slots, tagName) {
|
|
264
|
+
let slot = [];
|
|
265
|
+
let innerDirValues;
|
|
266
|
+
slot = slots.default ? slots.default() : slots;
|
|
267
|
+
let items = {};
|
|
268
|
+
items[`${tagName}`] = [];
|
|
269
|
+
for (const childSlot of slot) {
|
|
270
|
+
let tempObj = {};
|
|
271
|
+
let tagRef = childSlot.type.methods ? childSlot.type.methods.getTag() : tagName;
|
|
272
|
+
if (childSlot.children) {
|
|
273
|
+
let key;
|
|
274
|
+
innerDirValues = this.resolveComplexDirs(childSlot.children, this.tagMapper["e-" + tagName], tagRef);
|
|
275
|
+
if (innerDirValues.length) {
|
|
276
|
+
tempObj = innerDirValues;
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
for (var i = 0; i < Object.keys(innerDirValues).length; i++) {
|
|
280
|
+
key = Object.keys(innerDirValues)[parseInt(i.toString(), 10)];
|
|
281
|
+
tempObj[`${key}`] = innerDirValues[`${key}`];
|
|
282
|
+
}
|
|
282
283
|
}
|
|
283
|
-
|
|
284
284
|
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
285
|
+
if (childSlot.props) {
|
|
286
|
+
Object.keys(childSlot.props).forEach((key) => {
|
|
287
|
+
let propName = key.replace(/-[a-z]/g, (e) => { return e[1].toUpperCase(); });
|
|
288
|
+
if (propName) {
|
|
289
|
+
tempObj[`${propName}`] = childSlot.props[`${key}`];
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
if (((/[s]\b/).test(tagRef) && innerDirValues) && (!(/[s]\b/).test(tagName) || innerDirValues.length)) {
|
|
294
|
+
items[`${tagName}`] = tempObj;
|
|
295
|
+
}
|
|
296
|
+
else if (tempObj && Object.keys(tempObj).length !== 0) {
|
|
297
|
+
items[`${tagName}`].push(tempObj);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return items;
|
|
301
|
+
},
|
|
302
|
+
resolveComplexDirs(slots, tagObject, tagName) {
|
|
303
|
+
let slot = [];
|
|
304
|
+
let innerDirValues;
|
|
305
|
+
slot = slots.default ? slots.default() : slots;
|
|
306
|
+
let items = {};
|
|
307
|
+
for (const childSlot of slot) {
|
|
308
|
+
let tagRef;
|
|
309
|
+
let tag;
|
|
310
|
+
if (tagObject[`${tagName}`]) {
|
|
311
|
+
tagRef = Object.keys(tagObject[`${tagName}`]);
|
|
312
|
+
tag = tagRef.find((key) => tagObject[`${tagName}`][`${key}`] ===
|
|
313
|
+
childSlot.type.methods.getTag().replace(/[s]\b/, ""));
|
|
314
|
+
const moduleName = this.ej2Instances.getModuleName().toLowerCase();
|
|
315
|
+
tag = tag
|
|
316
|
+
? tag.replace("e-", "")
|
|
317
|
+
: childSlot.type.methods.getTag().replace(moduleName === "ribbon" ? "e-ribbon-" : "e-", "");
|
|
318
|
+
if (this.ej2Instances.getModuleName().toLowerCase() == "diagram" && tag.indexOf('annotations') != -1) {
|
|
319
|
+
tag = 'annotations';
|
|
291
320
|
}
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
if (((/[s]\b/).test(tagRef) && innerDirValues) && (!(/[s]\b/).test(tagName) || innerDirValues.length)) {
|
|
295
|
-
items[`${tagName}`] = tempObj;
|
|
296
|
-
}
|
|
297
|
-
else if (tempObj && Object.keys(tempObj).length !== 0) {
|
|
298
|
-
items[`${tagName}`].push(tempObj);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
return items;
|
|
302
|
-
}
|
|
303
|
-
resolveComplexDirs(slots, tagObject, tagName) {
|
|
304
|
-
let slot = [];
|
|
305
|
-
let innerDirValues;
|
|
306
|
-
slot = slots.default ? slots.default() : slots;
|
|
307
|
-
let items = {};
|
|
308
|
-
for (const childSlot of slot) {
|
|
309
|
-
let tagRef;
|
|
310
|
-
let tag;
|
|
311
|
-
if (tagObject[`${tagName}`]) {
|
|
312
|
-
tagRef = Object.keys(tagObject[`${tagName}`]);
|
|
313
|
-
tag = tagRef.find((key) => tagObject[`${tagName}`][`${key}`] ===
|
|
314
|
-
childSlot.type.methods.getTag().replace(/[s]\b/, ""));
|
|
315
|
-
tag = tag
|
|
316
|
-
? tag.replace("e-", "")
|
|
317
|
-
: childSlot.type.methods.getTag().replace("e-", "");
|
|
318
|
-
if (this.ej2Instances.getModuleName().toLowerCase() == "diagram" && tag.indexOf('annotations') != -1) {
|
|
319
|
-
tag = 'annotations';
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
if (childSlot.children) {
|
|
323
|
-
innerDirValues = this.resolveComplexInnerDirs(childSlot.children, tagObject[`${tagName}`], childSlot.type.methods.getTag());
|
|
324
|
-
if (!items[`${tag}`]) {
|
|
325
|
-
items[`${tag}`] = [];
|
|
326
|
-
}
|
|
327
|
-
if (innerDirValues.length > 1) {
|
|
328
|
-
items[`${tag}`] = innerDirValues;
|
|
329
321
|
}
|
|
330
|
-
|
|
331
|
-
|
|
322
|
+
if (childSlot.children) {
|
|
323
|
+
innerDirValues = this.resolveComplexInnerDirs(childSlot.children, tagObject[`${tagName}`], childSlot.type.methods.getTag());
|
|
324
|
+
if (!items[`${tag}`]) {
|
|
325
|
+
items[`${tag}`] = [];
|
|
326
|
+
}
|
|
327
|
+
if (innerDirValues.length > 1) {
|
|
328
|
+
items[`${tag}`] = innerDirValues;
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
items[`${tag}`].push(innerDirValues);
|
|
332
|
+
}
|
|
332
333
|
}
|
|
333
|
-
}
|
|
334
|
-
if (childSlot.props) {
|
|
335
|
-
childSlot.props = this.getCamelCaseProps(childSlot.props);
|
|
336
|
-
}
|
|
337
|
-
if (slot.length > 1) {
|
|
338
|
-
items = Object.keys(items).length == 0 && !items.length ? [] : items;
|
|
339
334
|
if (childSlot.props) {
|
|
340
|
-
|
|
335
|
+
childSlot.props = this.getCamelCaseProps(childSlot.props);
|
|
336
|
+
}
|
|
337
|
+
if (slot.length > 1) {
|
|
338
|
+
items = Object.keys(items).length == 0 && !items.length ? [] : items;
|
|
339
|
+
if (childSlot.props) {
|
|
340
|
+
items.push(childSlot.props);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
items = childSlot.props ? Object.assign(items, childSlot.props) : items;
|
|
341
345
|
}
|
|
342
346
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
347
|
+
return items;
|
|
348
|
+
},
|
|
349
|
+
resolveComplexInnerDirs(slots, tagObject, tagName) {
|
|
350
|
+
let slot = [];
|
|
351
|
+
let innerDirValues;
|
|
352
|
+
slot = slots.default ? slots.default() : slots;
|
|
353
|
+
let items = slot.length > 1 ? [] : {};
|
|
354
|
+
for (const childSlot of slot) {
|
|
355
|
+
let isRibbon = (this.ej2Instances.getModuleName().toLowerCase() == "ribbon");
|
|
356
|
+
let tag = childSlot.type.methods.getTag().replace(isRibbon ? "e-ribbon-" : "e-", "");
|
|
357
|
+
if (childSlot.children) {
|
|
358
|
+
innerDirValues = this.resolveMultilevelComplexInnerDirs(childSlot.children, tagObject[`${tagName}`], childSlot.type.methods.getTag());
|
|
359
|
+
if ((/[s]\b/).test(tag) || slot.length > 1) {
|
|
360
|
+
if ((/[s]\b/).test(tag)) {
|
|
361
|
+
items[`${tag}`] = !items[`${tag}`] ? [] : items[`${tag}`];
|
|
362
|
+
if (innerDirValues.length) {
|
|
363
|
+
items[`${tag}`] = innerDirValues;
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
items[`${tag}`].push(innerDirValues);
|
|
367
|
+
}
|
|
363
368
|
}
|
|
364
|
-
else {
|
|
365
|
-
items
|
|
369
|
+
else if (innerDirValues && !(isRibbon && innerDirValues.hasOwnProperty('collections'))) {
|
|
370
|
+
items.push(innerDirValues);
|
|
366
371
|
}
|
|
367
372
|
}
|
|
368
|
-
else
|
|
369
|
-
items
|
|
373
|
+
else {
|
|
374
|
+
items = innerDirValues ? innerDirValues : items;
|
|
370
375
|
}
|
|
371
376
|
}
|
|
372
|
-
|
|
373
|
-
|
|
377
|
+
if (childSlot.props) {
|
|
378
|
+
childSlot.props = this.getCamelCaseProps(childSlot.props);
|
|
374
379
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
380
|
+
if (slot.length > 1 && childSlot.props) {
|
|
381
|
+
if (isRibbon && innerDirValues && innerDirValues.hasOwnProperty('collections')) {
|
|
382
|
+
innerDirValues = childSlot.props ? Object.assign(innerDirValues, childSlot.props) : innerDirValues;
|
|
383
|
+
items.push(innerDirValues);
|
|
384
|
+
}
|
|
385
|
+
else if (items.length >= 0) {
|
|
386
|
+
items.push(childSlot.props);
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
items = childSlot.props ? Object.assign(items, childSlot.props) : items;
|
|
390
|
+
}
|
|
382
391
|
}
|
|
383
392
|
else {
|
|
384
393
|
items = childSlot.props ? Object.assign(items, childSlot.props) : items;
|
|
385
394
|
}
|
|
386
395
|
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
let tag = childSlot.type.methods.getTag().replace("e-", "");
|
|
400
|
-
if (childSlot.children) {
|
|
401
|
-
innerDirValues = this.resolveComplexInnerDirs(childSlot.children, tagObject[`${tagName}`], childSlot.type.methods.getTag());
|
|
402
|
-
}
|
|
403
|
-
if (childSlot.props) {
|
|
404
|
-
childSlot.props = this.getCamelCaseProps(childSlot.props);
|
|
405
|
-
}
|
|
406
|
-
if ((/[s]\b/).test(tag)) {
|
|
407
|
-
items[`${tag}`] = !items[`${tag}`] ? [] : items[`${tag}`];
|
|
408
|
-
if (innerDirValues.length) {
|
|
409
|
-
items[`${tag}`] = innerDirValues;
|
|
410
|
-
}
|
|
411
|
-
else {
|
|
412
|
-
items[`${tag}`].push(innerDirValues);
|
|
396
|
+
return items;
|
|
397
|
+
},
|
|
398
|
+
resolveMultilevelComplexInnerDirs(slots, tagObject, tagName) {
|
|
399
|
+
let slot = [];
|
|
400
|
+
let innerDirValues;
|
|
401
|
+
slot = slots.default ? slots.default() : slots;
|
|
402
|
+
let items = slot.length > 1 ? [] : {};
|
|
403
|
+
for (const childSlot of slot) {
|
|
404
|
+
const moduleName = this.ej2Instances.getModuleName().toLowerCase();
|
|
405
|
+
let tag = childSlot.type.methods.getTag().replace(moduleName === "ribbon" ? "e-ribbon-" : "e-", "");
|
|
406
|
+
if (childSlot.children) {
|
|
407
|
+
innerDirValues = this.resolveComplexInnerDirs(childSlot.children, tagObject[`${tagName}`], childSlot.type.methods.getTag());
|
|
413
408
|
}
|
|
414
409
|
if (childSlot.props) {
|
|
415
|
-
|
|
410
|
+
childSlot.props = this.getCamelCaseProps(childSlot.props);
|
|
411
|
+
}
|
|
412
|
+
if ((/[s]\b/).test(tag)) {
|
|
413
|
+
items[`${tag}`] = !items[`${tag}`] ? [] : items[`${tag}`];
|
|
414
|
+
if (innerDirValues.length) {
|
|
415
|
+
items[`${tag}`] = innerDirValues;
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
items[`${tag}`].push(innerDirValues);
|
|
419
|
+
}
|
|
420
|
+
if (childSlot.props) {
|
|
421
|
+
items[`${tag}`].push(childSlot.props);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
else {
|
|
425
|
+
items = innerDirValues;
|
|
426
|
+
items = childSlot.props ? Object.assign(items, childSlot.props) : items;
|
|
416
427
|
}
|
|
417
428
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
for (let tagDirChild of children) {
|
|
439
|
-
let retObj = this.getVNodeValue(tagDirChild, tagMapper[`${dirTag}`], tagNameMapper);
|
|
440
|
-
if (Object.keys(retObj).length !== 0) {
|
|
441
|
-
dir[tagName.replace('e-', '')].push(retObj);
|
|
429
|
+
return items;
|
|
430
|
+
},
|
|
431
|
+
getDirectiveValues(tagDirectives, tagMapper, tagNameMapper) {
|
|
432
|
+
let keyTags = Object.keys(tagMapper);
|
|
433
|
+
let dir = {};
|
|
434
|
+
if (tagDirectives) {
|
|
435
|
+
for (let tagDirective of tagDirectives) {
|
|
436
|
+
if (tagDirective.componentOptions && tagDirective.componentOptions.children && tagDirective.componentOptions.tag ||
|
|
437
|
+
(tagDirective.tag === 'e-seriescollection' && tagDirective.children)) {
|
|
438
|
+
let dirTag = tagDirective.componentOptions ? tagDirective.componentOptions.tag : tagDirective.tag;
|
|
439
|
+
dirTag = (dirTag === 'e-seriescollection') ? 'e-seriesCollection' : dirTag;
|
|
440
|
+
if (keyTags.indexOf(dirTag) !== -1) {
|
|
441
|
+
let tagName = tagNameMapper[`${dirTag}`] ? tagNameMapper[`${dirTag}`] : dirTag;
|
|
442
|
+
dir[tagName.replace('e-', '')] = [];
|
|
443
|
+
let children = tagDirective.componentOptions ? tagDirective.componentOptions.children : tagDirective.children;
|
|
444
|
+
for (let tagDirChild of children) {
|
|
445
|
+
let retObj = this.getVNodeValue(tagDirChild, tagMapper[`${dirTag}`], tagNameMapper);
|
|
446
|
+
if (Object.keys(retObj).length !== 0) {
|
|
447
|
+
dir[tagName.replace('e-', '')].push(retObj);
|
|
448
|
+
}
|
|
442
449
|
}
|
|
443
450
|
}
|
|
444
451
|
}
|
|
445
452
|
}
|
|
446
453
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
454
|
+
return dir;
|
|
455
|
+
},
|
|
456
|
+
getMultiLevelDirValue(tagDirectories, tagKey, tagNameMapper) {
|
|
457
|
+
let mulObj = {};
|
|
458
|
+
for (let tagDir of tagDirectories) {
|
|
459
|
+
let key;
|
|
460
|
+
let children;
|
|
461
|
+
if (tagDir.componentOptions) {
|
|
462
|
+
key = tagDir.componentOptions.tag;
|
|
463
|
+
if (tagDir.componentOptions.children) {
|
|
464
|
+
children = tagDir.componentOptions.children;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
else if ((tagDir.tag === 'e-markersettings' || tagDir.tag === 'e-markersetting') && tagDir.children) {
|
|
468
|
+
key = (tagDir.tag === 'e-markersettings') ? 'e-markerSettings' : 'e-markerSetting';
|
|
469
|
+
children = tagDir.children;
|
|
470
|
+
}
|
|
471
|
+
if (key) {
|
|
472
|
+
let tagName = tagNameMapper[`${key}`] ? tagNameMapper[`${key}`] : key;
|
|
473
|
+
mulObj[tagName.replace('e-', '')] = [];
|
|
474
|
+
if (children) {
|
|
475
|
+
for (let tagDirChild of children) {
|
|
476
|
+
let mulLevObj = this.getVNodeValue(tagDirChild, tagKey[`${key}`], tagNameMapper);
|
|
477
|
+
if (Object.keys(mulLevObj).length !== 0) {
|
|
478
|
+
mulObj[tagName.replace('e-', '')].push(mulLevObj);
|
|
479
|
+
}
|
|
473
480
|
}
|
|
474
481
|
}
|
|
475
482
|
}
|
|
476
483
|
}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
dirTag = tagDirective.componentOptions.tag;
|
|
486
|
-
}
|
|
487
|
-
else {
|
|
488
|
-
dirTag = (tagDirective.tag === 'e-markersettings') ? 'e-markerSettings' : 'e-markerSetting';
|
|
489
|
-
}
|
|
490
|
-
if (typeof tagKey === 'string' && dirTag === tagKey && tagDirective.data) {
|
|
491
|
-
ret = tagDirective.data.attrs ? this.getCamelCaseProps(tagDirective.data.attrs) : this.getCamelCaseProps(tagDirective.data);
|
|
492
|
-
}
|
|
493
|
-
else if (typeof tagKey === 'object') {
|
|
494
|
-
if (tagDirective.componentOptions.children && (Object.keys(tagKey).indexOf(dirTag) !== -1)) {
|
|
495
|
-
ret = this.getMultiLevelDirValue(tagDirective.componentOptions.children, tagKey[`${dirTag}`], tagNameMapper);
|
|
484
|
+
return mulObj;
|
|
485
|
+
},
|
|
486
|
+
getVNodeValue(tagDirective, tagKey, tagNameMapper) {
|
|
487
|
+
let ret = {};
|
|
488
|
+
if (tagDirective.componentOptions || ((tagDirective.tag === 'e-markersettings' || tagDirective.tag === 'e-markersetting') && tagDirective.context)) {
|
|
489
|
+
let dirTag;
|
|
490
|
+
if (tagDirective.componentOptions) {
|
|
491
|
+
dirTag = tagDirective.componentOptions.tag;
|
|
496
492
|
}
|
|
497
|
-
else
|
|
498
|
-
|
|
493
|
+
else {
|
|
494
|
+
dirTag = (tagDirective.tag === 'e-markersettings') ? 'e-markerSettings' : 'e-markerSetting';
|
|
499
495
|
}
|
|
500
|
-
if (
|
|
501
|
-
ret =
|
|
496
|
+
if (typeof tagKey === 'string' && dirTag === tagKey && tagDirective.data) {
|
|
497
|
+
ret = tagDirective.data.attrs ? this.getCamelCaseProps(tagDirective.data.attrs) : this.getCamelCaseProps(tagDirective.data);
|
|
498
|
+
}
|
|
499
|
+
else if (typeof tagKey === 'object') {
|
|
500
|
+
if (tagDirective.componentOptions.children && (Object.keys(tagKey).indexOf(dirTag) !== -1)) {
|
|
501
|
+
ret = this.getMultiLevelDirValue(tagDirective.componentOptions.children, tagKey[`${dirTag}`], tagNameMapper);
|
|
502
|
+
}
|
|
503
|
+
else if (tagDirective.children && (Object.keys(tagKey).indexOf(dirTag) !== -1) && (dirTag === 'e-markersettings' || dirTag === 'e-markersetting')) {
|
|
504
|
+
ret = this.getMultiLevelDirValue(tagDirective.children, tagKey[`${dirTag}`], tagNameMapper);
|
|
505
|
+
}
|
|
506
|
+
if (tagDirective.data && tagDirective.data.attrs) {
|
|
507
|
+
ret = extend(ret, this.getCamelCaseProps(tagDirective.data.attrs));
|
|
508
|
+
}
|
|
502
509
|
}
|
|
503
510
|
}
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
/**
|
|
526
|
-
* Vue Component Base
|
|
527
|
-
*/
|
|
528
|
-
// import { Base, Component as EJ2Component, isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
529
|
-
let $internalHooks = [
|
|
530
|
-
'data',
|
|
531
|
-
'beforeCreate',
|
|
532
|
-
'created',
|
|
533
|
-
'beforeMount',
|
|
534
|
-
'mounted',
|
|
535
|
-
'beforeDestroy',
|
|
536
|
-
'destroyed',
|
|
537
|
-
'beforeUpdate',
|
|
538
|
-
'updated',
|
|
539
|
-
'activated',
|
|
540
|
-
'deactivated',
|
|
541
|
-
'render',
|
|
542
|
-
'errorCaptured' // 2.5
|
|
543
|
-
];
|
|
511
|
+
return ret;
|
|
512
|
+
},
|
|
513
|
+
/**
|
|
514
|
+
* convert kebab case directive props to camel case
|
|
515
|
+
*/
|
|
516
|
+
getCamelCaseProps(props) {
|
|
517
|
+
let retProps = {};
|
|
518
|
+
for (let prop of Object.keys(props)) {
|
|
519
|
+
retProps[prop.replace(/-[a-z]/g, (e) => { return e[1].toUpperCase(); })] = props[`${prop}`];
|
|
520
|
+
}
|
|
521
|
+
return retProps;
|
|
522
|
+
},
|
|
523
|
+
dataBind() {
|
|
524
|
+
this.ej2Instances.dataBind();
|
|
525
|
+
},
|
|
526
|
+
setProperties(arg, muteOnChange) {
|
|
527
|
+
return this.ej2Instances.setProperties(arg, muteOnChange);
|
|
528
|
+
},
|
|
529
|
+
}
|
|
530
|
+
});
|
|
544
531
|
function getProps(options = {}) {
|
|
545
532
|
if (options.props) {
|
|
546
533
|
for (let prop of options.props) {
|
|
@@ -555,105 +542,6 @@ function getProps(options = {}) {
|
|
|
555
542
|
}
|
|
556
543
|
return [options.newprops, options.watch];
|
|
557
544
|
}
|
|
558
|
-
function EJComponentDecorator(options, isExecute$$1) {
|
|
559
|
-
if (!isExecute$$1) {
|
|
560
|
-
return;
|
|
561
|
-
}
|
|
562
|
-
return function (Component) {
|
|
563
|
-
return EJcomponentFactory(Component, options);
|
|
564
|
-
};
|
|
565
|
-
}
|
|
566
|
-
function EJcomponentFactory(Component, options = {}) {
|
|
567
|
-
options.name = options.name || Component._componentTag || Component.name;
|
|
568
|
-
// prototype props.
|
|
569
|
-
const proto = Component.prototype;
|
|
570
|
-
if (options.props) {
|
|
571
|
-
for (let prop of options.props) {
|
|
572
|
-
(options.props || (options.props = {}))[`${prop}`] = {};
|
|
573
|
-
(options.watch || (options.watch = {}))[`${prop}`] = function (newVal) {
|
|
574
|
-
this.ej2Instances[`${prop}`] = newVal;
|
|
575
|
-
if (this.dataBind && (options.name !== 'DateRangePickerComponent')) {
|
|
576
|
-
this.dataBind();
|
|
577
|
-
}
|
|
578
|
-
};
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
Object.getOwnPropertyNames(proto).forEach(function (key) {
|
|
582
|
-
// hooks
|
|
583
|
-
if (key === 'constructor') {
|
|
584
|
-
return;
|
|
585
|
-
}
|
|
586
|
-
if ($internalHooks.indexOf(key) > -1) {
|
|
587
|
-
options[`${key}`] = proto[`${key}`];
|
|
588
|
-
return;
|
|
589
|
-
}
|
|
590
|
-
const descriptor = Object.getOwnPropertyDescriptor(proto, key);
|
|
591
|
-
if (typeof descriptor.value === 'function') {
|
|
592
|
-
// methods
|
|
593
|
-
(options.methods || (options.methods = {}))[`${key}`] = descriptor.value;
|
|
594
|
-
}
|
|
595
|
-
else if (descriptor.get || descriptor.set) {
|
|
596
|
-
// computed properties
|
|
597
|
-
(options.computed || (options.computed = {}))[`${key}`] = {
|
|
598
|
-
get: descriptor.get,
|
|
599
|
-
set: descriptor.set
|
|
600
|
-
};
|
|
601
|
-
}
|
|
602
|
-
});
|
|
603
|
-
Object.getOwnPropertyNames(ComponentBase.prototype).forEach(function (key) {
|
|
604
|
-
if ($internalHooks.indexOf(key) > -1) {
|
|
605
|
-
options[`${key}`] = proto[`${key}`];
|
|
606
|
-
return;
|
|
607
|
-
}
|
|
608
|
-
});
|
|
609
|
-
(options.mixins || (options.mixins = [])).push({
|
|
610
|
-
data() {
|
|
611
|
-
return collectDataFromConstructor(this, Component);
|
|
612
|
-
}
|
|
613
|
-
});
|
|
614
|
-
// decorate options
|
|
615
|
-
const decorators = Component.__decorators__;
|
|
616
|
-
if (decorators) {
|
|
617
|
-
decorators.forEach(Function(options));
|
|
618
|
-
delete Component.__decorators__;
|
|
619
|
-
}
|
|
620
|
-
// find super
|
|
621
|
-
const superProto = Object.getPrototypeOf(Component.prototype);
|
|
622
|
-
const Super = superProto instanceof Vue$1__default
|
|
623
|
-
? superProto.constructor
|
|
624
|
-
: Vue$1__default;
|
|
625
|
-
const Extended = Super.extend(options);
|
|
626
|
-
return Extended;
|
|
627
|
-
}
|
|
628
|
-
function collectDataFromConstructor(vm, Component) {
|
|
629
|
-
Component.prototype._init = function () {
|
|
630
|
-
var _this = this;
|
|
631
|
-
var keys = Object.getOwnPropertyNames(vm);
|
|
632
|
-
if (vm.$options.props) {
|
|
633
|
-
for (var key in vm.$options.props) {
|
|
634
|
-
if (!vm.hasOwnProperty(key)) {
|
|
635
|
-
keys.push(key);
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
keys.forEach(function (key) {
|
|
640
|
-
if (key.charAt(0) !== '_') {
|
|
641
|
-
Object.defineProperty(_this, key, {
|
|
642
|
-
get: function () { return vm[`${key}`]; },
|
|
643
|
-
set: function (value) { return vm[`${key}`] = value; }
|
|
644
|
-
});
|
|
645
|
-
}
|
|
646
|
-
});
|
|
647
|
-
};
|
|
648
|
-
var data = new Component();
|
|
649
|
-
var plainData = {};
|
|
650
|
-
Object.keys(data).forEach(function (key) {
|
|
651
|
-
if (data[`${key}`] !== undefined) {
|
|
652
|
-
plainData[`${key}`] = data[`${key}`];
|
|
653
|
-
}
|
|
654
|
-
});
|
|
655
|
-
return plainData;
|
|
656
|
-
}
|
|
657
545
|
|
|
658
546
|
// tslint:disable:no-any
|
|
659
547
|
let stringCompiler = getTemplateEngine();
|
|
@@ -674,7 +562,7 @@ function compile(templateElement, helper) {
|
|
|
674
562
|
let vueSlot = getCurrentVueSlot(context.vueInstance, templateElement, root);
|
|
675
563
|
if (vueSlot) {
|
|
676
564
|
// Compilation for Vue 3 slot template
|
|
677
|
-
let app =
|
|
565
|
+
let app = aVue.createApp({
|
|
678
566
|
render() {
|
|
679
567
|
return vueSlot[`${templateElement}`]({ data: data });
|
|
680
568
|
}
|
|
@@ -684,6 +572,8 @@ function compile(templateElement, helper) {
|
|
|
684
572
|
app.use(plugins[parseInt(i.toString(), 10)]);
|
|
685
573
|
}
|
|
686
574
|
}
|
|
575
|
+
// Get values for Vue 3 slot template
|
|
576
|
+
getValues(app, context.vueInstance, root);
|
|
687
577
|
app.mount((context.getModuleName() === 'grid') ? ("#" + pid) : ("#" + id));
|
|
688
578
|
returnEle = ele.childNodes;
|
|
689
579
|
detach(ele);
|
|
@@ -735,12 +625,14 @@ function compile(templateElement, helper) {
|
|
|
735
625
|
}
|
|
736
626
|
}
|
|
737
627
|
templateCompRef.data = function () { return tempRef; };
|
|
738
|
-
let app =
|
|
628
|
+
let app = aVue.createApp(templateCompRef);
|
|
739
629
|
if (plugins) {
|
|
740
630
|
for (let i = 0; i < plugins.length; i++) {
|
|
741
631
|
app.use(plugins[parseInt(i.toString(), 10)]);
|
|
742
632
|
}
|
|
743
633
|
}
|
|
634
|
+
// Get values for Vue 3 functional template
|
|
635
|
+
getValues(app, context.vueInstance, root);
|
|
744
636
|
app.mount((context.getModuleName() === 'grid') ? ("#" + pid) : ("#" + id));
|
|
745
637
|
returnEle = ele.childNodes;
|
|
746
638
|
detach(ele);
|
|
@@ -748,8 +640,22 @@ function compile(templateElement, helper) {
|
|
|
748
640
|
else if (typeof templateElement === "string") {
|
|
749
641
|
let vueSlot = getVueSlot(context.vueInstance, templateElement, root);
|
|
750
642
|
if (vueSlot) {
|
|
643
|
+
// Get provide values for Vue 2 slot template
|
|
644
|
+
let provided = {};
|
|
645
|
+
let getProvideValues = (vueinstance) => {
|
|
646
|
+
if (vueinstance['$parent'])
|
|
647
|
+
getProvideValues(vueinstance.$parent);
|
|
648
|
+
if (vueinstance['_provided'] && Object.keys(vueinstance['_provided']).length > 0) {
|
|
649
|
+
provided = Object.assign({}, provided, vueinstance._provided);
|
|
650
|
+
}
|
|
651
|
+
};
|
|
652
|
+
let vueInstance = context.vueInstance ? context.vueInstance : ((root && root.vueInstance) ? root.vueInstance : null);
|
|
653
|
+
if (vueInstance) {
|
|
654
|
+
getProvideValues(vueInstance);
|
|
655
|
+
}
|
|
751
656
|
// Compilation for Vue 2 slot template
|
|
752
|
-
let vueTemplate = new
|
|
657
|
+
let vueTemplate = new aVue({
|
|
658
|
+
provide: Object.assign({}, provided),
|
|
753
659
|
render() {
|
|
754
660
|
return vueSlot[`${templateElement}`]({ data: data });
|
|
755
661
|
}
|
|
@@ -778,7 +684,7 @@ function compile(templateElement, helper) {
|
|
|
778
684
|
dataObj.propsData = propsData;
|
|
779
685
|
}
|
|
780
686
|
if (typeof templateFunction !== "function") {
|
|
781
|
-
templateFunction =
|
|
687
|
+
templateFunction = aVue.extend(templateFunction);
|
|
782
688
|
}
|
|
783
689
|
let templateVue = new templateFunction(dataObj);
|
|
784
690
|
// let templateVue = new Vue(tempObj.template);
|
|
@@ -805,6 +711,37 @@ function compile(templateElement, helper) {
|
|
|
805
711
|
};
|
|
806
712
|
}
|
|
807
713
|
setTemplateEngine({ compile: compile });
|
|
714
|
+
function getValues(app, cInstance, root) {
|
|
715
|
+
let vueInstance = cInstance ? cInstance : ((root && root.vueInstance) ? root.vueInstance : null);
|
|
716
|
+
if (!vueInstance) {
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
// Get globally defined variables.
|
|
720
|
+
let globalVariables = ['components', 'mixins', 'provides'];
|
|
721
|
+
for (let i = 0; i < globalVariables.length; i++) {
|
|
722
|
+
let gVariable = globalVariables[i];
|
|
723
|
+
if (app['_context'][gVariable] && vueInstance['$']['appContext'][gVariable]) {
|
|
724
|
+
app['_context'][gVariable] = vueInstance['$']['appContext'][gVariable];
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
// Get provide value from child component.
|
|
728
|
+
let provided = {};
|
|
729
|
+
let getProvideValue = (vueinstance) => {
|
|
730
|
+
if (vueinstance['$'] && vueinstance['$']['parent'])
|
|
731
|
+
getProvideValue(vueinstance.$.parent);
|
|
732
|
+
if (vueinstance['provides'] && Object.keys(vueinstance['provides']).length > 0) {
|
|
733
|
+
provided = Object.assign({}, provided, vueinstance.provides);
|
|
734
|
+
}
|
|
735
|
+
};
|
|
736
|
+
getProvideValue(vueInstance);
|
|
737
|
+
if (app['_context']['provides']) {
|
|
738
|
+
app._context.provides = Object.assign({}, app._context.provides, provided);
|
|
739
|
+
}
|
|
740
|
+
// Get globally defined properties.
|
|
741
|
+
if (app['_context']['config']['globalProperties'] && vueInstance['$']['appContext']['config']['globalProperties']) {
|
|
742
|
+
app['_context']['config']['globalProperties'] = vueInstance['$']['appContext']['config']['globalProperties'];
|
|
743
|
+
}
|
|
744
|
+
}
|
|
808
745
|
// Get the Vue2 slot template from the root or current Vue component.
|
|
809
746
|
function getVueSlot(vueInstance, templateElement, root) {
|
|
810
747
|
if (!vueInstance && !(root && root.vueInstance)) {
|
|
@@ -879,5 +816,5 @@ function getChildVueSlot(slots, templateElement) {
|
|
|
879
816
|
* index for component base
|
|
880
817
|
*/
|
|
881
818
|
|
|
882
|
-
export {
|
|
819
|
+
export { isExecute, aVue, gh, vueDefineComponent, ComponentBase, getProps, compile };
|
|
883
820
|
//# sourceMappingURL=ej2-vue-base.es2015.js.map
|