@syncfusion/ej2-vue-base 20.4.48 → 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 +18 -0
- package/dist/ej2-vue-base.umd.min.js +2 -20
- package/dist/ej2-vue-base.umd.min.js.map +1 -1
- package/dist/es6/ej2-vue-base.es2015.js +470 -527
- package/dist/es6/ej2-vue-base.es2015.js.map +1 -1
- package/dist/es6/ej2-vue-base.es5.js +507 -574
- 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 +8 -8
- package/src/component-base.d.ts +4 -46
- package/src/component-base.js +450 -437
- package/src/index.d.ts +0 -1
- package/src/index.js +0 -1
- package/src/template.js +64 -5
- 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,366 +100,434 @@ class ComponentBase extends vueImport {
|
|
|
175
100
|
this.assignValueToWrapper(childKey, false);
|
|
176
101
|
}
|
|
177
102
|
}
|
|
178
|
-
}
|
|
103
|
+
},
|
|
179
104
|
beforeDestroy() {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
let
|
|
197
|
-
let
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
else if (this && this.$ && this.$.slots && this.$.slots.default) {
|
|
221
|
-
propRef = this.$.slots.default();
|
|
222
|
-
}
|
|
223
|
-
if (propRef) {
|
|
224
|
-
for (let i = 0; i < propRef.length; i++) {
|
|
225
|
-
if (propRef[parseInt(i.toString(), 10)].type.methods || propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection') {
|
|
226
|
-
let key = propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection' ? 'series-collection' :
|
|
227
|
-
propRef[parseInt(i.toString(), 10)].type.methods.getTag().replace("e-", "");
|
|
228
|
-
let ref = this.resolveArrayDirectives(propRef[parseInt(i.toString(), 10)].children, key);
|
|
229
|
-
let splitKeys = key.split('-');
|
|
230
|
-
let controlName = this.ej2Instances.getModuleName().toLowerCase();
|
|
231
|
-
let keyRef = (splitKeys.length > 1 && controlName.indexOf(splitKeys[0]) > -1) ? splitKeys[1] : splitKeys[0];
|
|
232
|
-
keyRef = keyRef.replace(controlName, '');
|
|
233
|
-
if (controlName == "splitter" && keyRef == "panes") {
|
|
234
|
-
keyRef = "paneSettings";
|
|
105
|
+
this.destroyComponent();
|
|
106
|
+
},
|
|
107
|
+
beforeUnmount() {
|
|
108
|
+
this.destroyComponent();
|
|
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;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
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);
|
|
235
145
|
}
|
|
236
|
-
else if (
|
|
237
|
-
|
|
146
|
+
else if (this.$vnode) {
|
|
147
|
+
key = Object.keys(this.$vnode.context);
|
|
238
148
|
}
|
|
239
|
-
else if (
|
|
240
|
-
|
|
149
|
+
else if (this.$parent) {
|
|
150
|
+
key = Object.keys(this.$parent);
|
|
241
151
|
}
|
|
242
|
-
|
|
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
|
+
}
|
|
167
|
+
}
|
|
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);
|
|
243
207
|
}
|
|
244
208
|
}
|
|
209
|
+
this.ej2Instances.injectedModules = prevModule;
|
|
245
210
|
}
|
|
246
|
-
|
|
247
|
-
|
|
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 || {});
|
|
248
220
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
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
|
+
}
|
|
271
251
|
}
|
|
272
252
|
else {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
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
|
+
}
|
|
276
283
|
}
|
|
277
|
-
|
|
278
284
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
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';
|
|
285
320
|
}
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
if (((/[s]\b/).test(tagRef) && innerDirValues) && (!(/[s]\b/).test(tagName) || innerDirValues.length)) {
|
|
289
|
-
items[`${tagName}`] = tempObj;
|
|
290
|
-
}
|
|
291
|
-
else if (tempObj && Object.keys(tempObj).length !== 0) {
|
|
292
|
-
items[`${tagName}`].push(tempObj);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
return items;
|
|
296
|
-
}
|
|
297
|
-
resolveComplexDirs(slots, tagObject, tagName) {
|
|
298
|
-
let slot = [];
|
|
299
|
-
let innerDirValues;
|
|
300
|
-
slot = slots.default ? slots.default() : slots;
|
|
301
|
-
let items = {};
|
|
302
|
-
for (const childSlot of slot) {
|
|
303
|
-
let tagRef;
|
|
304
|
-
let tag;
|
|
305
|
-
if (tagObject[`${tagName}`]) {
|
|
306
|
-
tagRef = Object.keys(tagObject[`${tagName}`]);
|
|
307
|
-
tag = tagRef.find((key) => tagObject[`${tagName}`][`${key}`] ===
|
|
308
|
-
childSlot.type.methods.getTag().replace(/[s]\b/, ""));
|
|
309
|
-
tag = tag
|
|
310
|
-
? tag.replace("e-", "")
|
|
311
|
-
: childSlot.type.methods.getTag().replace("e-", "");
|
|
312
|
-
if (this.ej2Instances.getModuleName().toLowerCase() == "diagram" && tag.indexOf('annotations') != -1) {
|
|
313
|
-
tag = 'annotations';
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
if (childSlot.children) {
|
|
317
|
-
innerDirValues = this.resolveComplexInnerDirs(childSlot.children, tagObject[`${tagName}`], childSlot.type.methods.getTag());
|
|
318
|
-
if (!items[`${tag}`]) {
|
|
319
|
-
items[`${tag}`] = [];
|
|
320
|
-
}
|
|
321
|
-
if (innerDirValues.length > 1) {
|
|
322
|
-
items[`${tag}`] = innerDirValues;
|
|
323
321
|
}
|
|
324
|
-
|
|
325
|
-
|
|
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
|
+
}
|
|
326
333
|
}
|
|
327
|
-
}
|
|
328
|
-
if (childSlot.props) {
|
|
329
|
-
childSlot.props = this.getCamelCaseProps(childSlot.props);
|
|
330
|
-
}
|
|
331
|
-
if (slot.length > 1) {
|
|
332
|
-
items = Object.keys(items).length == 0 && !items.length ? [] : items;
|
|
333
334
|
if (childSlot.props) {
|
|
334
|
-
|
|
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;
|
|
335
345
|
}
|
|
336
346
|
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
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
|
+
}
|
|
357
368
|
}
|
|
358
|
-
else {
|
|
359
|
-
items
|
|
369
|
+
else if (innerDirValues && !(isRibbon && innerDirValues.hasOwnProperty('collections'))) {
|
|
370
|
+
items.push(innerDirValues);
|
|
360
371
|
}
|
|
361
372
|
}
|
|
362
|
-
else
|
|
363
|
-
items
|
|
373
|
+
else {
|
|
374
|
+
items = innerDirValues ? innerDirValues : items;
|
|
364
375
|
}
|
|
365
376
|
}
|
|
366
|
-
|
|
367
|
-
|
|
377
|
+
if (childSlot.props) {
|
|
378
|
+
childSlot.props = this.getCamelCaseProps(childSlot.props);
|
|
368
379
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
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
|
+
}
|
|
376
391
|
}
|
|
377
392
|
else {
|
|
378
393
|
items = childSlot.props ? Object.assign(items, childSlot.props) : items;
|
|
379
394
|
}
|
|
380
395
|
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
let tag = childSlot.type.methods.getTag().replace("e-", "");
|
|
394
|
-
if (childSlot.children) {
|
|
395
|
-
innerDirValues = this.resolveComplexInnerDirs(childSlot.children, tagObject[`${tagName}`], childSlot.type.methods.getTag());
|
|
396
|
-
}
|
|
397
|
-
if (childSlot.props) {
|
|
398
|
-
childSlot.props = this.getCamelCaseProps(childSlot.props);
|
|
399
|
-
}
|
|
400
|
-
if ((/[s]\b/).test(tag)) {
|
|
401
|
-
items[`${tag}`] = !items[`${tag}`] ? [] : items[`${tag}`];
|
|
402
|
-
if (innerDirValues.length) {
|
|
403
|
-
items[`${tag}`] = innerDirValues;
|
|
404
|
-
}
|
|
405
|
-
else {
|
|
406
|
-
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());
|
|
407
408
|
}
|
|
408
409
|
if (childSlot.props) {
|
|
409
|
-
|
|
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;
|
|
410
427
|
}
|
|
411
428
|
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
for (let tagDirChild of children) {
|
|
433
|
-
let retObj = this.getVNodeValue(tagDirChild, tagMapper[`${dirTag}`], tagNameMapper);
|
|
434
|
-
if (Object.keys(retObj).length !== 0) {
|
|
435
|
-
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
|
+
}
|
|
436
449
|
}
|
|
437
450
|
}
|
|
438
451
|
}
|
|
439
452
|
}
|
|
440
453
|
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
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
|
+
}
|
|
467
480
|
}
|
|
468
481
|
}
|
|
469
482
|
}
|
|
470
483
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
dirTag = tagDirective.componentOptions.tag;
|
|
480
|
-
}
|
|
481
|
-
else {
|
|
482
|
-
dirTag = (tagDirective.tag === 'e-markersettings') ? 'e-markerSettings' : 'e-markerSetting';
|
|
483
|
-
}
|
|
484
|
-
if (typeof tagKey === 'string' && dirTag === tagKey && tagDirective.data) {
|
|
485
|
-
ret = tagDirective.data.attrs ? this.getCamelCaseProps(tagDirective.data.attrs) : this.getCamelCaseProps(tagDirective.data);
|
|
486
|
-
}
|
|
487
|
-
else if (typeof tagKey === 'object') {
|
|
488
|
-
if (tagDirective.componentOptions.children && (Object.keys(tagKey).indexOf(dirTag) !== -1)) {
|
|
489
|
-
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;
|
|
490
492
|
}
|
|
491
|
-
else
|
|
492
|
-
|
|
493
|
+
else {
|
|
494
|
+
dirTag = (tagDirective.tag === 'e-markersettings') ? 'e-markerSettings' : 'e-markerSetting';
|
|
493
495
|
}
|
|
494
|
-
if (
|
|
495
|
-
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
|
+
}
|
|
496
509
|
}
|
|
497
510
|
}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
/**
|
|
520
|
-
* Vue Component Base
|
|
521
|
-
*/
|
|
522
|
-
// import { Base, Component as EJ2Component, isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
523
|
-
let $internalHooks = [
|
|
524
|
-
'data',
|
|
525
|
-
'beforeCreate',
|
|
526
|
-
'created',
|
|
527
|
-
'beforeMount',
|
|
528
|
-
'mounted',
|
|
529
|
-
'beforeDestroy',
|
|
530
|
-
'destroyed',
|
|
531
|
-
'beforeUpdate',
|
|
532
|
-
'updated',
|
|
533
|
-
'activated',
|
|
534
|
-
'deactivated',
|
|
535
|
-
'render',
|
|
536
|
-
'errorCaptured' // 2.5
|
|
537
|
-
];
|
|
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
|
+
});
|
|
538
531
|
function getProps(options = {}) {
|
|
539
532
|
if (options.props) {
|
|
540
533
|
for (let prop of options.props) {
|
|
@@ -549,105 +542,6 @@ function getProps(options = {}) {
|
|
|
549
542
|
}
|
|
550
543
|
return [options.newprops, options.watch];
|
|
551
544
|
}
|
|
552
|
-
function EJComponentDecorator(options, isExecute$$1) {
|
|
553
|
-
if (!isExecute$$1) {
|
|
554
|
-
return;
|
|
555
|
-
}
|
|
556
|
-
return function (Component) {
|
|
557
|
-
return EJcomponentFactory(Component, options);
|
|
558
|
-
};
|
|
559
|
-
}
|
|
560
|
-
function EJcomponentFactory(Component, options = {}) {
|
|
561
|
-
options.name = options.name || Component._componentTag || Component.name;
|
|
562
|
-
// prototype props.
|
|
563
|
-
const proto = Component.prototype;
|
|
564
|
-
if (options.props) {
|
|
565
|
-
for (let prop of options.props) {
|
|
566
|
-
(options.props || (options.props = {}))[`${prop}`] = {};
|
|
567
|
-
(options.watch || (options.watch = {}))[`${prop}`] = function (newVal) {
|
|
568
|
-
this.ej2Instances[`${prop}`] = newVal;
|
|
569
|
-
if (this.dataBind && (options.name !== 'DateRangePickerComponent')) {
|
|
570
|
-
this.dataBind();
|
|
571
|
-
}
|
|
572
|
-
};
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
Object.getOwnPropertyNames(proto).forEach(function (key) {
|
|
576
|
-
// hooks
|
|
577
|
-
if (key === 'constructor') {
|
|
578
|
-
return;
|
|
579
|
-
}
|
|
580
|
-
if ($internalHooks.indexOf(key) > -1) {
|
|
581
|
-
options[`${key}`] = proto[`${key}`];
|
|
582
|
-
return;
|
|
583
|
-
}
|
|
584
|
-
const descriptor = Object.getOwnPropertyDescriptor(proto, key);
|
|
585
|
-
if (typeof descriptor.value === 'function') {
|
|
586
|
-
// methods
|
|
587
|
-
(options.methods || (options.methods = {}))[`${key}`] = descriptor.value;
|
|
588
|
-
}
|
|
589
|
-
else if (descriptor.get || descriptor.set) {
|
|
590
|
-
// computed properties
|
|
591
|
-
(options.computed || (options.computed = {}))[`${key}`] = {
|
|
592
|
-
get: descriptor.get,
|
|
593
|
-
set: descriptor.set
|
|
594
|
-
};
|
|
595
|
-
}
|
|
596
|
-
});
|
|
597
|
-
Object.getOwnPropertyNames(ComponentBase.prototype).forEach(function (key) {
|
|
598
|
-
if ($internalHooks.indexOf(key) > -1) {
|
|
599
|
-
options[`${key}`] = proto[`${key}`];
|
|
600
|
-
return;
|
|
601
|
-
}
|
|
602
|
-
});
|
|
603
|
-
(options.mixins || (options.mixins = [])).push({
|
|
604
|
-
data() {
|
|
605
|
-
return collectDataFromConstructor(this, Component);
|
|
606
|
-
}
|
|
607
|
-
});
|
|
608
|
-
// decorate options
|
|
609
|
-
const decorators = Component.__decorators__;
|
|
610
|
-
if (decorators) {
|
|
611
|
-
decorators.forEach(Function(options));
|
|
612
|
-
delete Component.__decorators__;
|
|
613
|
-
}
|
|
614
|
-
// find super
|
|
615
|
-
const superProto = Object.getPrototypeOf(Component.prototype);
|
|
616
|
-
const Super = superProto instanceof Vue$1__default
|
|
617
|
-
? superProto.constructor
|
|
618
|
-
: Vue$1__default;
|
|
619
|
-
const Extended = Super.extend(options);
|
|
620
|
-
return Extended;
|
|
621
|
-
}
|
|
622
|
-
function collectDataFromConstructor(vm, Component) {
|
|
623
|
-
Component.prototype._init = function () {
|
|
624
|
-
var _this = this;
|
|
625
|
-
var keys = Object.getOwnPropertyNames(vm);
|
|
626
|
-
if (vm.$options.props) {
|
|
627
|
-
for (var key in vm.$options.props) {
|
|
628
|
-
if (!vm.hasOwnProperty(key)) {
|
|
629
|
-
keys.push(key);
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
keys.forEach(function (key) {
|
|
634
|
-
if (key.charAt(0) !== '_') {
|
|
635
|
-
Object.defineProperty(_this, key, {
|
|
636
|
-
get: function () { return vm[`${key}`]; },
|
|
637
|
-
set: function (value) { return vm[`${key}`] = value; }
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
|
-
});
|
|
641
|
-
};
|
|
642
|
-
var data = new Component();
|
|
643
|
-
var plainData = {};
|
|
644
|
-
Object.keys(data).forEach(function (key) {
|
|
645
|
-
if (data[`${key}`] !== undefined) {
|
|
646
|
-
plainData[`${key}`] = data[`${key}`];
|
|
647
|
-
}
|
|
648
|
-
});
|
|
649
|
-
return plainData;
|
|
650
|
-
}
|
|
651
545
|
|
|
652
546
|
// tslint:disable:no-any
|
|
653
547
|
let stringCompiler = getTemplateEngine();
|
|
@@ -668,7 +562,7 @@ function compile(templateElement, helper) {
|
|
|
668
562
|
let vueSlot = getCurrentVueSlot(context.vueInstance, templateElement, root);
|
|
669
563
|
if (vueSlot) {
|
|
670
564
|
// Compilation for Vue 3 slot template
|
|
671
|
-
let app =
|
|
565
|
+
let app = aVue.createApp({
|
|
672
566
|
render() {
|
|
673
567
|
return vueSlot[`${templateElement}`]({ data: data });
|
|
674
568
|
}
|
|
@@ -678,6 +572,8 @@ function compile(templateElement, helper) {
|
|
|
678
572
|
app.use(plugins[parseInt(i.toString(), 10)]);
|
|
679
573
|
}
|
|
680
574
|
}
|
|
575
|
+
// Get values for Vue 3 slot template
|
|
576
|
+
getValues(app, context.vueInstance, root);
|
|
681
577
|
app.mount((context.getModuleName() === 'grid') ? ("#" + pid) : ("#" + id));
|
|
682
578
|
returnEle = ele.childNodes;
|
|
683
579
|
detach(ele);
|
|
@@ -729,12 +625,14 @@ function compile(templateElement, helper) {
|
|
|
729
625
|
}
|
|
730
626
|
}
|
|
731
627
|
templateCompRef.data = function () { return tempRef; };
|
|
732
|
-
let app =
|
|
628
|
+
let app = aVue.createApp(templateCompRef);
|
|
733
629
|
if (plugins) {
|
|
734
630
|
for (let i = 0; i < plugins.length; i++) {
|
|
735
631
|
app.use(plugins[parseInt(i.toString(), 10)]);
|
|
736
632
|
}
|
|
737
633
|
}
|
|
634
|
+
// Get values for Vue 3 functional template
|
|
635
|
+
getValues(app, context.vueInstance, root);
|
|
738
636
|
app.mount((context.getModuleName() === 'grid') ? ("#" + pid) : ("#" + id));
|
|
739
637
|
returnEle = ele.childNodes;
|
|
740
638
|
detach(ele);
|
|
@@ -742,8 +640,22 @@ function compile(templateElement, helper) {
|
|
|
742
640
|
else if (typeof templateElement === "string") {
|
|
743
641
|
let vueSlot = getVueSlot(context.vueInstance, templateElement, root);
|
|
744
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
|
+
}
|
|
745
656
|
// Compilation for Vue 2 slot template
|
|
746
|
-
let vueTemplate = new
|
|
657
|
+
let vueTemplate = new aVue({
|
|
658
|
+
provide: Object.assign({}, provided),
|
|
747
659
|
render() {
|
|
748
660
|
return vueSlot[`${templateElement}`]({ data: data });
|
|
749
661
|
}
|
|
@@ -772,7 +684,7 @@ function compile(templateElement, helper) {
|
|
|
772
684
|
dataObj.propsData = propsData;
|
|
773
685
|
}
|
|
774
686
|
if (typeof templateFunction !== "function") {
|
|
775
|
-
templateFunction =
|
|
687
|
+
templateFunction = aVue.extend(templateFunction);
|
|
776
688
|
}
|
|
777
689
|
let templateVue = new templateFunction(dataObj);
|
|
778
690
|
// let templateVue = new Vue(tempObj.template);
|
|
@@ -799,6 +711,37 @@ function compile(templateElement, helper) {
|
|
|
799
711
|
};
|
|
800
712
|
}
|
|
801
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
|
+
}
|
|
802
745
|
// Get the Vue2 slot template from the root or current Vue component.
|
|
803
746
|
function getVueSlot(vueInstance, templateElement, root) {
|
|
804
747
|
if (!vueInstance && !(root && root.vueInstance)) {
|
|
@@ -873,5 +816,5 @@ function getChildVueSlot(slots, templateElement) {
|
|
|
873
816
|
* index for component base
|
|
874
817
|
*/
|
|
875
818
|
|
|
876
|
-
export {
|
|
819
|
+
export { isExecute, aVue, gh, vueDefineComponent, ComponentBase, getProps, compile };
|
|
877
820
|
//# sourceMappingURL=ej2-vue-base.es2015.js.map
|