@syncfusion/ej2-vue-base 25.2.4 → 26.2.4
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-vue-base.umd.min.js +2 -2
- package/dist/ej2-vue-base.umd.min.js.map +1 -1
- package/dist/es6/ej2-vue-base.es2015.js +260 -184
- package/dist/es6/ej2-vue-base.es2015.js.map +1 -1
- package/dist/es6/ej2-vue-base.es5.js +195 -121
- 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/hotfix/26.1.35_Vol2.txt +1 -0
- package/package.json +27 -9
- package/src/component-base.d.ts +12 -4
- package/src/component-base.js +86 -60
- package/src/template.d.ts +7 -0
- package/src/template.js +114 -56
- package/tslint.json +111 -0
- package/CHANGELOG.md +0 -354
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
import * as Vue from 'vue';
|
|
2
|
-
import {
|
|
2
|
+
import { getValue, isNullOrUndefined, extend, setProxyToRaw, getTemplateEngine, getUniqueID, createElement, detach, setTemplateEngine } from '@syncfusion/ej2-base';
|
|
3
3
|
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
5
|
/**
|
|
5
|
-
* Vue
|
|
6
|
+
* Clone the Vue compiler instance.
|
|
7
|
+
*
|
|
8
|
+
* @param {any} obj - representes the Vue compiler.
|
|
9
|
+
* @returns {any} cloned object of Vue compiler.
|
|
6
10
|
*/
|
|
7
11
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) {
|
|
8
12
|
return obj;
|
|
9
13
|
}
|
|
10
14
|
else {
|
|
11
|
-
|
|
15
|
+
const newObj = {};
|
|
12
16
|
if (obj != null) {
|
|
13
|
-
for (
|
|
14
|
-
if (Object.prototype.hasOwnProperty.call(obj, key))
|
|
17
|
+
for (const key in obj) {
|
|
18
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
15
19
|
newObj[`${key}`] = obj[`${key}`];
|
|
20
|
+
}
|
|
16
21
|
}
|
|
17
22
|
}
|
|
18
23
|
newObj.default = obj;
|
|
19
24
|
return newObj;
|
|
20
25
|
} }
|
|
21
26
|
const curVue = _interopRequireWildcard(Vue);
|
|
22
|
-
const isExecute = (parseInt(curVue['version']) > 2) ? false : true;
|
|
27
|
+
const isExecute = (parseInt(curVue['version'], 10) > 2) ? false : true;
|
|
23
28
|
const aVue = !isExecute ? curVue : (curVue['default']['default'] ? curVue['default']['default'] : curVue['default']);
|
|
24
29
|
const gh = curVue['h'];
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
const vueDefineComponent = (options) => { return !isExecute ? aVue['defineComponent'](options) : aVue['extend'](options); };
|
|
31
|
+
const ComponentBase = vueDefineComponent({
|
|
27
32
|
name: 'ComponentBase',
|
|
28
33
|
data() {
|
|
29
34
|
return {
|
|
@@ -43,12 +48,12 @@ let ComponentBase = vueDefineComponent({
|
|
|
43
48
|
if (!this.propKeys) {
|
|
44
49
|
return;
|
|
45
50
|
}
|
|
46
|
-
for (
|
|
51
|
+
for (const prop of this.propKeys) {
|
|
47
52
|
this.ej2Instances.addEventListener(prop, (args) => {
|
|
48
53
|
this.$emit(prop, args);
|
|
49
54
|
});
|
|
50
55
|
}
|
|
51
|
-
|
|
56
|
+
const injectables = getValue('$root.$options.provide', this);
|
|
52
57
|
let vueInjectables = getValue('$parent.$options.provide', this);
|
|
53
58
|
vueInjectables = !isNullOrUndefined(vueInjectables) ? vueInjectables : getValue('$.parent.provides', this);
|
|
54
59
|
if (this.hasInjectedModules && !isExecute) {
|
|
@@ -63,8 +68,8 @@ let ComponentBase = vueDefineComponent({
|
|
|
63
68
|
else if (vueInjectables) {
|
|
64
69
|
prevModule = this.getInjectedServices() || [];
|
|
65
70
|
}
|
|
66
|
-
|
|
67
|
-
for (
|
|
71
|
+
const curModule = this.ej2Instances.getInjectedModules() || [];
|
|
72
|
+
for (const mod of curModule) {
|
|
68
73
|
if (prevModule.indexOf(mod) === -1) {
|
|
69
74
|
prevModule.push(mod);
|
|
70
75
|
}
|
|
@@ -73,10 +78,13 @@ let ComponentBase = vueDefineComponent({
|
|
|
73
78
|
}
|
|
74
79
|
},
|
|
75
80
|
mounted() {
|
|
76
|
-
|
|
81
|
+
const cusEle = this.$el ? this.$el.querySelectorAll('div.e-directive') : null;
|
|
77
82
|
if (!isExecute && cusEle) {
|
|
78
83
|
for (let i = 0; i < cusEle.length; i++) {
|
|
79
|
-
|
|
84
|
+
const cusElement = cusEle[parseInt(i.toString(), 10)];
|
|
85
|
+
if (cusElement.parentElement) {
|
|
86
|
+
cusElement.parentElement.removeChild(cusElement);
|
|
87
|
+
}
|
|
80
88
|
}
|
|
81
89
|
}
|
|
82
90
|
this.ej2Instances.isVue = true;
|
|
@@ -113,9 +121,9 @@ let ComponentBase = vueDefineComponent({
|
|
|
113
121
|
this.setModelValue();
|
|
114
122
|
}
|
|
115
123
|
if (this.hasChildDirective) {
|
|
116
|
-
|
|
124
|
+
const childKey = {};
|
|
117
125
|
this.fetchChildPropValues(childKey);
|
|
118
|
-
|
|
126
|
+
const curChildDir = JSON.stringify(childKey);
|
|
119
127
|
if (this.childDirObjects !== curChildDir) {
|
|
120
128
|
this.childDirObjects = curChildDir;
|
|
121
129
|
this.assignValueToWrapper(childKey, false);
|
|
@@ -138,12 +146,11 @@ let ComponentBase = vueDefineComponent({
|
|
|
138
146
|
provide = getValue('$.parent.provides', this);
|
|
139
147
|
}
|
|
140
148
|
if (provide) {
|
|
141
|
-
// tslint:disable:no-any
|
|
142
149
|
let injectables = provide;
|
|
143
150
|
if (typeof provide === 'function') {
|
|
144
151
|
if (provide.managed) {
|
|
145
|
-
|
|
146
|
-
|
|
152
|
+
const pKey = provide.managed;
|
|
153
|
+
const pValue = Object.keys(pKey);
|
|
147
154
|
let key;
|
|
148
155
|
if (this.$root && this.isDecorator) {
|
|
149
156
|
key = Object.keys(this.$root);
|
|
@@ -154,24 +161,23 @@ let ComponentBase = vueDefineComponent({
|
|
|
154
161
|
else if (this.$parent) {
|
|
155
162
|
key = Object.keys(this.$parent);
|
|
156
163
|
}
|
|
157
|
-
for (let i = 0; i <
|
|
164
|
+
for (let i = 0; i < pValue.length; i++) {
|
|
158
165
|
for (let j = 0; j < key.length; j++) {
|
|
159
|
-
if ((key[parseInt(j.toString(), 10)].indexOf(
|
|
166
|
+
if ((key[parseInt(j.toString(), 10)].indexOf(pValue[parseInt(i.toString(), 10)])) !== -1) {
|
|
160
167
|
if (this.$root && this.isDecorator) {
|
|
161
|
-
|
|
168
|
+
pKey[pValue[parseInt(j.toString(), 10)]] = this.$root[key[parseInt(i.toString(), 10)]];
|
|
162
169
|
}
|
|
163
170
|
else if (this.$vnode) {
|
|
164
|
-
|
|
171
|
+
pKey[pValue[parseInt(i.toString(), 10)]] = this.$vnode.context[key[parseInt(j.toString(), 10)]];
|
|
165
172
|
}
|
|
166
173
|
else if (this.$parent) {
|
|
167
|
-
|
|
174
|
+
pKey[pValue[parseInt(i.toString(), 10)]] = this.$parent[key[parseInt(j.toString(), 10)]];
|
|
168
175
|
}
|
|
169
|
-
injectables =
|
|
176
|
+
injectables = pKey;
|
|
170
177
|
}
|
|
171
178
|
}
|
|
172
179
|
}
|
|
173
180
|
}
|
|
174
|
-
// tslint:disable:no-any
|
|
175
181
|
else if (this.$vnode) {
|
|
176
182
|
injectables = this.$vnode.context.$options.provide();
|
|
177
183
|
}
|
|
@@ -185,30 +191,30 @@ let ComponentBase = vueDefineComponent({
|
|
|
185
191
|
return ret;
|
|
186
192
|
},
|
|
187
193
|
destroyComponent() {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
tempBeforeDestroyThis.destroyPortals();
|
|
192
|
-
tempBeforeDestroyThis = null;
|
|
194
|
+
this.ej2Instances.destroy();
|
|
195
|
+
this.$el.style.visibility = 'hidden';
|
|
196
|
+
this.clearTemplate();
|
|
193
197
|
},
|
|
194
|
-
destroyPortals() {
|
|
195
|
-
if (
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
198
|
+
destroyPortals(element) {
|
|
199
|
+
if (element) {
|
|
200
|
+
const destroy = getValue('__vue__.$destroy', element);
|
|
201
|
+
if (destroy) {
|
|
202
|
+
element.__vue__.$destroy();
|
|
203
|
+
}
|
|
204
|
+
else if (!isExecute && element._vnode) {
|
|
205
|
+
try {
|
|
206
|
+
aVue.render(null, element);
|
|
204
207
|
}
|
|
208
|
+
catch (e) { /* Handle error */ }
|
|
209
|
+
}
|
|
210
|
+
if (element.innerHTML) {
|
|
211
|
+
element.innerHTML = '';
|
|
205
212
|
}
|
|
206
|
-
this.portals = null;
|
|
207
213
|
}
|
|
208
214
|
},
|
|
209
215
|
bindProperties() {
|
|
210
|
-
|
|
211
|
-
for (
|
|
216
|
+
const options = {};
|
|
217
|
+
for (const prop of this.propKeys) {
|
|
212
218
|
if (!isNullOrUndefined(this[`${prop}`])) {
|
|
213
219
|
options[`${prop}`] = this[`${prop}`];
|
|
214
220
|
}
|
|
@@ -220,9 +226,9 @@ let ComponentBase = vueDefineComponent({
|
|
|
220
226
|
this.fetchChildPropValues(options);
|
|
221
227
|
}
|
|
222
228
|
if (this.hasInjectedModules) {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
for (
|
|
229
|
+
const prevModule = this.getInjectedServices() || [];
|
|
230
|
+
const curModule = this.ej2Instances.getInjectedModules() || [];
|
|
231
|
+
for (const mod of curModule) {
|
|
226
232
|
if (prevModule.indexOf(mod) === -1) {
|
|
227
233
|
prevModule.push(mod);
|
|
228
234
|
}
|
|
@@ -250,22 +256,22 @@ let ComponentBase = vueDefineComponent({
|
|
|
250
256
|
if (propRef) {
|
|
251
257
|
for (let i = 0; i < propRef.length; i++) {
|
|
252
258
|
if (propRef[parseInt(i.toString(), 10)].type.methods || propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection') {
|
|
253
|
-
|
|
254
|
-
propRef[parseInt(i.toString(), 10)].type.methods.getTag().replace(
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
let keyRef = (
|
|
259
|
+
const key = propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection' ? 'series-collection' :
|
|
260
|
+
propRef[parseInt(i.toString(), 10)].type.methods.getTag().replace('e-', '');
|
|
261
|
+
const ref = this.resolveArrayDirectives(propRef[parseInt(i.toString(), 10)].children, key);
|
|
262
|
+
const spKeys = key.split('-');
|
|
263
|
+
const controlName = this.ej2Instances.getModuleName().toLowerCase();
|
|
264
|
+
let keyRef = (spKeys.length > 1 && controlName.indexOf(spKeys[0]) > -1) ? spKeys[1] : spKeys[0];
|
|
259
265
|
keyRef = keyRef.replace(controlName, '');
|
|
260
266
|
keyRef = this.tagNameMapper['e-' + key] ? this.tagNameMapper['e-' + key].replace('e-', '') : keyRef;
|
|
261
|
-
if (controlName
|
|
262
|
-
keyRef =
|
|
267
|
+
if (controlName === 'splitter' && keyRef === 'panes') {
|
|
268
|
+
keyRef = 'paneSettings';
|
|
263
269
|
}
|
|
264
|
-
else if (controlName
|
|
265
|
-
keyRef =
|
|
270
|
+
else if (controlName === 'bulletchart' && keyRef === 'range') {
|
|
271
|
+
keyRef = 'ranges';
|
|
266
272
|
}
|
|
267
|
-
else if (controlName
|
|
268
|
-
keyRef =
|
|
273
|
+
else if (controlName === 'schedule' && keyRef === 'header') {
|
|
274
|
+
keyRef = 'headerRows';
|
|
269
275
|
}
|
|
270
276
|
dirProps[`${keyRef}`] = ref[`${key}`];
|
|
271
277
|
}
|
|
@@ -278,7 +284,7 @@ let ComponentBase = vueDefineComponent({
|
|
|
278
284
|
if (!this.childDirObjects) {
|
|
279
285
|
this.childDirObjects = JSON.stringify(dirProps);
|
|
280
286
|
}
|
|
281
|
-
for (
|
|
287
|
+
for (const dirProp of Object.keys(dirProps)) {
|
|
282
288
|
childOption[`${dirProp}`] = dirProps[`${dirProp}`];
|
|
283
289
|
}
|
|
284
290
|
},
|
|
@@ -287,19 +293,19 @@ let ComponentBase = vueDefineComponent({
|
|
|
287
293
|
let innerDirValues;
|
|
288
294
|
slot = slots.default ? slots.default() : slots;
|
|
289
295
|
slot = slot.flatMap((item) => Array.isArray(item.children) ? item.children : item);
|
|
290
|
-
|
|
296
|
+
const items = {};
|
|
291
297
|
items[`${tagName}`] = [];
|
|
292
298
|
for (const childSlot of slot) {
|
|
293
299
|
let tempObj = {};
|
|
294
|
-
|
|
300
|
+
const tagRef = childSlot.type.methods ? childSlot.type.methods.getTag() : tagName;
|
|
295
301
|
if (childSlot.children) {
|
|
296
302
|
let key;
|
|
297
|
-
innerDirValues = this.resolveComplexDirs(childSlot.children, this.tagMapper[
|
|
303
|
+
innerDirValues = this.resolveComplexDirs(childSlot.children, this.tagMapper['e-' + tagName], tagRef);
|
|
298
304
|
if (innerDirValues.length) {
|
|
299
305
|
tempObj = innerDirValues;
|
|
300
306
|
}
|
|
301
307
|
else {
|
|
302
|
-
for (
|
|
308
|
+
for (let i = 0; i < Object.keys(innerDirValues).length; i++) {
|
|
303
309
|
key = Object.keys(innerDirValues)[parseInt(i.toString(), 10)];
|
|
304
310
|
tempObj[`${key}`] = innerDirValues[`${key}`];
|
|
305
311
|
}
|
|
@@ -307,14 +313,19 @@ let ComponentBase = vueDefineComponent({
|
|
|
307
313
|
}
|
|
308
314
|
if (childSlot.props) {
|
|
309
315
|
Object.keys(childSlot.props).forEach((key) => {
|
|
310
|
-
|
|
316
|
+
const propName = key.replace(/-[a-z]/g, (e) => { return e[1].toUpperCase(); });
|
|
311
317
|
if (propName) {
|
|
312
318
|
tempObj[`${propName}`] = childSlot.props[`${key}`];
|
|
313
319
|
}
|
|
314
320
|
});
|
|
315
321
|
}
|
|
316
322
|
if (((/[s]\b/).test(tagRef) && innerDirValues) && (!(/[s]\b/).test(tagName) || innerDirValues.length)) {
|
|
317
|
-
Array.isArray(tempObj)
|
|
323
|
+
if (Array.isArray(tempObj)) {
|
|
324
|
+
tempObj.forEach((item) => { items[`${tagName}`].push(item); });
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
items[`${tagName}`].push(tempObj);
|
|
328
|
+
}
|
|
318
329
|
}
|
|
319
330
|
else if (tempObj && Object.keys(tempObj).length !== 0) {
|
|
320
331
|
items[`${tagName}`].push(tempObj);
|
|
@@ -333,11 +344,10 @@ let ComponentBase = vueDefineComponent({
|
|
|
333
344
|
if (tagObject[`${tagName}`]) {
|
|
334
345
|
tagRef = Object.keys(tagObject[`${tagName}`]);
|
|
335
346
|
tag = tagRef.find((key) => tagObject[`${tagName}`][`${key}`] ===
|
|
336
|
-
childSlot.type.methods.getTag().replace(/[s]\b/,
|
|
337
|
-
const moduleName = this.ej2Instances.getModuleName().toLowerCase();
|
|
347
|
+
childSlot.type.methods.getTag().replace(/[s]\b/, ''));
|
|
338
348
|
tag = tag ? tag : childSlot.type.methods.getTag();
|
|
339
|
-
tag = (this.tagNameMapper[`${tag}`] ? this.tagNameMapper[`${tag}`] : tag).replace(
|
|
340
|
-
if (this.ej2Instances.getModuleName().toLowerCase()
|
|
349
|
+
tag = (this.tagNameMapper[`${tag}`] ? this.tagNameMapper[`${tag}`] : tag).replace('e-', '');
|
|
350
|
+
if (this.ej2Instances.getModuleName().toLowerCase() === 'diagram' && tag.indexOf('annotations') !== -1) {
|
|
341
351
|
tag = 'annotations';
|
|
342
352
|
}
|
|
343
353
|
}
|
|
@@ -357,7 +367,7 @@ let ComponentBase = vueDefineComponent({
|
|
|
357
367
|
childSlot.props = this.getCamelCaseProps(childSlot.props);
|
|
358
368
|
}
|
|
359
369
|
if (slot.length > 1) {
|
|
360
|
-
items = Object.keys(items).length
|
|
370
|
+
items = Object.keys(items).length === 0 && !items.length ? [] : items;
|
|
361
371
|
if (childSlot.props) {
|
|
362
372
|
items.push(childSlot.props);
|
|
363
373
|
}
|
|
@@ -375,7 +385,7 @@ let ComponentBase = vueDefineComponent({
|
|
|
375
385
|
for (const childSlot of slot) {
|
|
376
386
|
let innerDirValues = null;
|
|
377
387
|
let tag = childSlot.type.methods.getTag();
|
|
378
|
-
tag = (this.tagNameMapper[tag] ? this.tagNameMapper[tag] : tag).replace(
|
|
388
|
+
tag = (this.tagNameMapper[`${tag}`] ? this.tagNameMapper[`${tag}`] : tag).replace('e-', '');
|
|
379
389
|
if (childSlot.children) {
|
|
380
390
|
innerDirValues = this.resolveMultilevelComplexInnerDirs(childSlot.children, tagObject[`${tagName}`], childSlot.type.methods.getTag());
|
|
381
391
|
if ((/[s]\b/).test(tag) || slot.length > 1) {
|
|
@@ -423,9 +433,8 @@ let ComponentBase = vueDefineComponent({
|
|
|
423
433
|
let items = slot.length > 1 ? [] : {};
|
|
424
434
|
for (const childSlot of slot) {
|
|
425
435
|
let innerDirValues = null;
|
|
426
|
-
const moduleName = this.ej2Instances.getModuleName().toLowerCase();
|
|
427
436
|
let tag = childSlot.type.methods.getTag();
|
|
428
|
-
tag = (this.tagNameMapper[tag] ? this.tagNameMapper[tag] : tag).replace(
|
|
437
|
+
tag = (this.tagNameMapper[`${tag}`] ? this.tagNameMapper[`${tag}`] : tag).replace('e-', '');
|
|
429
438
|
if (childSlot.children) {
|
|
430
439
|
innerDirValues = this.resolveComplexInnerDirs(childSlot.children, tagObject[`${tagName}`], childSlot.type.methods.getTag());
|
|
431
440
|
}
|
|
@@ -452,20 +461,21 @@ let ComponentBase = vueDefineComponent({
|
|
|
452
461
|
return items;
|
|
453
462
|
},
|
|
454
463
|
getDirectiveValues(tagDirectives, tagMapper, tagNameMapper) {
|
|
455
|
-
|
|
456
|
-
|
|
464
|
+
const keyTags = Object.keys(tagMapper);
|
|
465
|
+
const dir = {};
|
|
457
466
|
if (tagDirectives) {
|
|
458
|
-
for (
|
|
459
|
-
|
|
467
|
+
for (const tagDirective of tagDirectives) {
|
|
468
|
+
const tagCompOption = tagDirective.componentOptions;
|
|
469
|
+
if (tagCompOption && tagCompOption.children && this.getTagName(tagCompOption) ||
|
|
460
470
|
(tagDirective.tag === 'e-seriescollection' && tagDirective.children)) {
|
|
461
|
-
let dirTag =
|
|
471
|
+
let dirTag = tagCompOption ? this.getTagName(tagCompOption) : tagDirective.tag;
|
|
462
472
|
dirTag = (dirTag === 'e-seriescollection') ? 'e-seriesCollection' : dirTag;
|
|
463
473
|
if (keyTags.indexOf(dirTag) !== -1) {
|
|
464
|
-
|
|
474
|
+
const tagName = tagNameMapper[`${dirTag}`] ? tagNameMapper[`${dirTag}`] : dirTag;
|
|
465
475
|
dir[tagName.replace('e-', '')] = [];
|
|
466
|
-
|
|
467
|
-
for (
|
|
468
|
-
|
|
476
|
+
const children = tagCompOption ? tagCompOption.children : tagDirective.children;
|
|
477
|
+
for (const tagDirChild of children) {
|
|
478
|
+
const retObj = this.getVNodeValue(tagDirChild, tagMapper[`${dirTag}`], tagNameMapper);
|
|
469
479
|
if (Object.keys(retObj).length !== 0) {
|
|
470
480
|
dir[tagName.replace('e-', '')].push(retObj);
|
|
471
481
|
}
|
|
@@ -477,8 +487,8 @@ let ComponentBase = vueDefineComponent({
|
|
|
477
487
|
return dir;
|
|
478
488
|
},
|
|
479
489
|
getMultiLevelDirValue(tagDirectories, tagKey, tagNameMapper) {
|
|
480
|
-
|
|
481
|
-
for (
|
|
490
|
+
const mulObj = {};
|
|
491
|
+
for (const tagDir of tagDirectories) {
|
|
482
492
|
let key;
|
|
483
493
|
let children;
|
|
484
494
|
if (tagDir.componentOptions) {
|
|
@@ -492,11 +502,11 @@ let ComponentBase = vueDefineComponent({
|
|
|
492
502
|
children = tagDir.children;
|
|
493
503
|
}
|
|
494
504
|
if (key) {
|
|
495
|
-
|
|
505
|
+
const tagName = tagNameMapper[`${key}`] ? tagNameMapper[`${key}`] : key;
|
|
496
506
|
mulObj[tagName.replace('e-', '')] = [];
|
|
497
507
|
if (children) {
|
|
498
|
-
for (
|
|
499
|
-
|
|
508
|
+
for (const tagDirChild of children) {
|
|
509
|
+
const mulLevObj = this.getVNodeValue(tagDirChild, tagKey[`${key}`], tagNameMapper);
|
|
500
510
|
if (Object.keys(mulLevObj).length !== 0) {
|
|
501
511
|
mulObj[tagName.replace('e-', '')].push(mulLevObj);
|
|
502
512
|
}
|
|
@@ -516,8 +526,9 @@ let ComponentBase = vueDefineComponent({
|
|
|
516
526
|
else {
|
|
517
527
|
dirTag = (tagDirective.tag === 'e-markersettings') ? 'e-markerSettings' : 'e-markerSetting';
|
|
518
528
|
}
|
|
519
|
-
|
|
520
|
-
|
|
529
|
+
const tagData = tagDirective.data;
|
|
530
|
+
if (typeof tagKey === 'string' && dirTag === tagKey && tagData) {
|
|
531
|
+
ret = tagData.attrs ? this.getCamelCaseProps(tagData.attrs) : this.getCamelCaseProps(tagData);
|
|
521
532
|
}
|
|
522
533
|
else if (typeof tagKey === 'object') {
|
|
523
534
|
if (tagDirective.componentOptions.children && (Object.keys(tagKey).indexOf(dirTag) !== -1)) {
|
|
@@ -526,19 +537,22 @@ let ComponentBase = vueDefineComponent({
|
|
|
526
537
|
else if (tagDirective.children && (Object.keys(tagKey).indexOf(dirTag) !== -1) && (dirTag === 'e-markersettings' || dirTag === 'e-markersetting')) {
|
|
527
538
|
ret = this.getMultiLevelDirValue(tagDirective.children, tagKey[`${dirTag}`], tagNameMapper);
|
|
528
539
|
}
|
|
529
|
-
if (
|
|
530
|
-
ret = extend(ret, this.getCamelCaseProps(
|
|
540
|
+
if (tagData && tagData.attrs) {
|
|
541
|
+
ret = extend(ret, this.getCamelCaseProps(tagData.attrs));
|
|
531
542
|
}
|
|
532
543
|
}
|
|
533
544
|
}
|
|
534
545
|
return ret;
|
|
535
546
|
},
|
|
536
547
|
/**
|
|
537
|
-
* convert kebab case directive props to camel case
|
|
548
|
+
* convert kebab case directive props to camel case.
|
|
549
|
+
*
|
|
550
|
+
* @param {Object} props - Objects in kebab case directive props.
|
|
551
|
+
* @returns {Object} Object converted into camel case directive props.
|
|
538
552
|
*/
|
|
539
553
|
getCamelCaseProps(props) {
|
|
540
|
-
|
|
541
|
-
for (
|
|
554
|
+
const retProps = {};
|
|
555
|
+
for (const prop of Object.keys(props)) {
|
|
542
556
|
retProps[prop.replace(/-[a-z]/g, (e) => { return e[1].toUpperCase(); })] = props[`${prop}`];
|
|
543
557
|
}
|
|
544
558
|
return retProps;
|
|
@@ -551,16 +565,23 @@ let ComponentBase = vueDefineComponent({
|
|
|
551
565
|
},
|
|
552
566
|
getTagName(options) {
|
|
553
567
|
let tag = options.tag;
|
|
554
|
-
|
|
568
|
+
const optCtor = options.Ctor;
|
|
569
|
+
if (!tag && optCtor && optCtor.extendOptions && optCtor.extendOptions.methods && optCtor.extendOptions.methods.getTag) {
|
|
555
570
|
tag = options.Ctor.extendOptions.methods.getTag();
|
|
556
571
|
}
|
|
557
572
|
return tag;
|
|
558
573
|
}
|
|
559
574
|
}
|
|
560
575
|
});
|
|
576
|
+
/**
|
|
577
|
+
* Collect public property values for the Vue component.
|
|
578
|
+
*
|
|
579
|
+
* @param {any} options - represents props object.
|
|
580
|
+
* @returns {any} array of props object and `watchobject` respectively.
|
|
581
|
+
*/
|
|
561
582
|
function getProps(options = {}) {
|
|
562
583
|
if (options.props) {
|
|
563
|
-
for (
|
|
584
|
+
for (const prop of options.props) {
|
|
564
585
|
(options.newprops || (options.newprops = {}))[`${prop}`] = {};
|
|
565
586
|
(options.watch || (options.watch = {}))[`${prop}`] = function (newVal) {
|
|
566
587
|
this.ej2Instances[`${prop}`] = newVal;
|
|
@@ -572,31 +593,38 @@ function getProps(options = {}) {
|
|
|
572
593
|
}
|
|
573
594
|
return [options.newprops, options.watch];
|
|
574
595
|
}
|
|
575
|
-
if (!isExecute)
|
|
596
|
+
if (!isExecute) {
|
|
576
597
|
setProxyToRaw(aVue.toRaw);
|
|
598
|
+
}
|
|
577
599
|
|
|
578
|
-
|
|
579
|
-
|
|
600
|
+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types */
|
|
601
|
+
const stringCompiler = getTemplateEngine();
|
|
602
|
+
/**
|
|
603
|
+
* Compiler function that convert the template property to DOM element.
|
|
604
|
+
*
|
|
605
|
+
* @param {any} templateElement - represents value of the template property from the component.
|
|
606
|
+
* @param {Object} helper - represents helper object to utilize on template compilation.
|
|
607
|
+
* @returns {NodeList} template element that append to the component.
|
|
608
|
+
*/
|
|
580
609
|
function compile(templateElement, helper) {
|
|
581
|
-
let that = this;
|
|
582
610
|
return (data, context, propName, element, root) => {
|
|
583
611
|
let returnEle;
|
|
584
612
|
if (context) {
|
|
585
613
|
let plugins = context.vueInstance && context.vueInstance.plugins ? { plugins: context.vueInstance.plugins } : {};
|
|
586
614
|
const vueInstance = context.vueInstance ? context.vueInstance :
|
|
587
615
|
((root && root.vueInstance) ? root.vueInstance : null);
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
616
|
+
const pid = getUniqueID('templateParentDiv');
|
|
617
|
+
const id = getUniqueID('templateDiv');
|
|
618
|
+
const ele = createElement('div', {
|
|
591
619
|
id: pid,
|
|
592
|
-
innerHTML: '<div id="' + id + '"></div>'
|
|
620
|
+
innerHTML: '<div id="' + id + '"></div>'
|
|
593
621
|
});
|
|
594
622
|
document.body.appendChild(ele);
|
|
595
|
-
if (!isExecute && (typeof templateElement ===
|
|
596
|
-
|
|
623
|
+
if (!isExecute && (typeof templateElement === 'string' || (templateElement.prototype && templateElement.prototype.CSPTemplate && typeof templateElement === 'function'))) {
|
|
624
|
+
const vueSlot = getCurrentVueSlot(context.vueInstance, templateElement, root);
|
|
597
625
|
if (vueSlot) {
|
|
598
626
|
// Compilation for Vue 3 slot template
|
|
599
|
-
|
|
627
|
+
const app = aVue.createVNode({
|
|
600
628
|
render() {
|
|
601
629
|
return vueSlot[`${templateElement}`]({ data: data });
|
|
602
630
|
}
|
|
@@ -605,13 +633,20 @@ function compile(templateElement, helper) {
|
|
|
605
633
|
// Get values for Vue 3 slot template
|
|
606
634
|
getValues(app, context.vueInstance, root);
|
|
607
635
|
aVue.render(app, ele);
|
|
636
|
+
returnEle = ele.childNodes;
|
|
608
637
|
if (vueInstance) {
|
|
609
|
-
|
|
610
|
-
|
|
638
|
+
let templateInstance = vueInstance.templateCollection;
|
|
639
|
+
if (!templateInstance) {
|
|
640
|
+
vueInstance.templateCollection = {};
|
|
641
|
+
templateInstance = vueInstance.templateCollection;
|
|
642
|
+
}
|
|
643
|
+
if (propName) {
|
|
644
|
+
if (!templateInstance[`${propName}`]) {
|
|
645
|
+
templateInstance[`${propName}`] = [];
|
|
646
|
+
}
|
|
647
|
+
templateInstance[`${propName}`].push(ele);
|
|
611
648
|
}
|
|
612
|
-
vueInstance.portals.push(...[].slice.call(ele.children));
|
|
613
649
|
}
|
|
614
|
-
returnEle = ele.childNodes;
|
|
615
650
|
detach(ele);
|
|
616
651
|
}
|
|
617
652
|
else {
|
|
@@ -622,12 +657,12 @@ function compile(templateElement, helper) {
|
|
|
622
657
|
}
|
|
623
658
|
else if (!isExecute) {
|
|
624
659
|
// Compilation for Vue 3 functional template
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
660
|
+
const tempObj = templateElement.call(this, {});
|
|
661
|
+
const object = tempObj;
|
|
662
|
+
const propsData = getValue('template.propsData', tempObj);
|
|
663
|
+
const dataObj = {
|
|
629
664
|
data: { data: extend(tempObj.data || {}, data) },
|
|
630
|
-
parent: context.vueInstance
|
|
665
|
+
parent: context.vueInstance
|
|
631
666
|
};
|
|
632
667
|
if (!object.template) {
|
|
633
668
|
object.template = object[Object.keys(object)[0]];
|
|
@@ -639,7 +674,7 @@ function compile(templateElement, helper) {
|
|
|
639
674
|
else {
|
|
640
675
|
templateCompRef = object.template._context.components[templateElement.name];
|
|
641
676
|
if (!templateCompRef) {
|
|
642
|
-
|
|
677
|
+
const key = Object.keys(object.template._context.components)[0];
|
|
643
678
|
templateCompRef = object.template._context.components[`${key}`];
|
|
644
679
|
}
|
|
645
680
|
}
|
|
@@ -660,13 +695,16 @@ function compile(templateElement, helper) {
|
|
|
660
695
|
tempRef = Object.assign(templateCompRef.data(), dataObj.data);
|
|
661
696
|
}
|
|
662
697
|
if (templateCompRef.components) {
|
|
663
|
-
|
|
664
|
-
for (
|
|
665
|
-
|
|
698
|
+
const objkeys = Object.keys(templateCompRef.components) || [];
|
|
699
|
+
for (const objstring of objkeys) {
|
|
700
|
+
const intComponent = templateCompRef.components[`${objstring}`];
|
|
666
701
|
if (intComponent && intComponent.data) {
|
|
667
|
-
if (!intComponent.__data)
|
|
702
|
+
if (!intComponent.__data) {
|
|
668
703
|
intComponent.__data = intComponent.data;
|
|
669
|
-
|
|
704
|
+
}
|
|
705
|
+
intComponent.data = function (proxy) {
|
|
706
|
+
return Object.assign(intComponent.__data.call(proxy), dataObj.data);
|
|
707
|
+
};
|
|
670
708
|
}
|
|
671
709
|
}
|
|
672
710
|
}
|
|
@@ -675,64 +713,68 @@ function compile(templateElement, helper) {
|
|
|
675
713
|
plugins = Object.assign(plugins, data);
|
|
676
714
|
}
|
|
677
715
|
templateCompRef.data = function () { return tempRef; };
|
|
678
|
-
|
|
716
|
+
const app = aVue.createVNode(templateCompRef, plugins);
|
|
679
717
|
ele.innerHTML = '';
|
|
680
718
|
// Get values for Vue 3 functional template
|
|
681
719
|
getValues(app, context.vueInstance, root);
|
|
682
720
|
aVue.render(app, ele);
|
|
683
|
-
if (vueInstance) {
|
|
684
|
-
if (!vueInstance['portals']) {
|
|
685
|
-
vueInstance['portals'] = [];
|
|
686
|
-
}
|
|
687
|
-
vueInstance.portals.push(...[].slice.call(ele.children));
|
|
688
|
-
}
|
|
689
721
|
returnEle = ele.childNodes;
|
|
690
|
-
|
|
691
|
-
|
|
722
|
+
dataObj.parent = null;
|
|
723
|
+
if (vueInstance) {
|
|
724
|
+
let templateInstance = vueInstance.templateCollection;
|
|
692
725
|
if (!templateInstance) {
|
|
693
|
-
|
|
694
|
-
templateInstance =
|
|
726
|
+
vueInstance.templateCollection = {};
|
|
727
|
+
templateInstance = vueInstance.templateCollection;
|
|
695
728
|
}
|
|
696
729
|
if (propName) {
|
|
697
730
|
if (!templateInstance[`${propName}`]) {
|
|
698
731
|
templateInstance[`${propName}`] = [];
|
|
699
732
|
}
|
|
700
|
-
templateInstance[`${propName}`].push(
|
|
733
|
+
templateInstance[`${propName}`].push(ele);
|
|
701
734
|
}
|
|
702
735
|
}
|
|
703
736
|
detach(ele);
|
|
704
737
|
}
|
|
705
|
-
else if (typeof templateElement ===
|
|
706
|
-
|
|
738
|
+
else if (typeof templateElement === 'string' || (templateElement.prototype && templateElement.prototype.CSPTemplate && typeof templateElement === 'function')) {
|
|
739
|
+
const vueSlot = getVueSlot(context.vueInstance, templateElement, root);
|
|
707
740
|
if (vueSlot) {
|
|
708
741
|
// Get provide values for Vue 2 slot template
|
|
709
742
|
let provided = {};
|
|
710
|
-
|
|
711
|
-
if (vueinstance['$parent'])
|
|
743
|
+
const getProvideValues = (vueinstance) => {
|
|
744
|
+
if (vueinstance['$parent']) {
|
|
712
745
|
getProvideValues(vueinstance.$parent);
|
|
746
|
+
}
|
|
713
747
|
if (vueinstance['_provided'] && Object.keys(vueinstance['_provided']).length > 0) {
|
|
714
748
|
provided = Object.assign({}, provided, vueinstance._provided);
|
|
715
749
|
}
|
|
716
750
|
};
|
|
717
|
-
|
|
751
|
+
const vueInstance = context.vueInstance ? context.vueInstance :
|
|
752
|
+
((root && root.vueInstance) ? root.vueInstance : null);
|
|
718
753
|
if (vueInstance) {
|
|
719
754
|
getProvideValues(vueInstance);
|
|
720
755
|
}
|
|
721
756
|
// Compilation for Vue 2 slot template
|
|
722
|
-
|
|
757
|
+
const vueTemplate = new aVue({
|
|
723
758
|
provide: Object.assign({}, provided),
|
|
724
759
|
render() {
|
|
725
760
|
return vueSlot[`${templateElement}`]({ data: data });
|
|
726
761
|
}
|
|
727
762
|
});
|
|
728
|
-
vueTemplate.$mount(
|
|
763
|
+
vueTemplate.$mount('#' + id);
|
|
764
|
+
returnEle = ele.childNodes;
|
|
729
765
|
if (vueInstance) {
|
|
730
|
-
|
|
731
|
-
|
|
766
|
+
let templateInstance = vueInstance.templateCollection;
|
|
767
|
+
if (!templateInstance) {
|
|
768
|
+
vueInstance.templateCollection = {};
|
|
769
|
+
templateInstance = vueInstance.templateCollection;
|
|
770
|
+
}
|
|
771
|
+
if (propName) {
|
|
772
|
+
if (!templateInstance[`${propName}`]) {
|
|
773
|
+
templateInstance[`${propName}`] = [];
|
|
774
|
+
}
|
|
775
|
+
templateInstance[`${propName}`].push(returnEle[0]);
|
|
732
776
|
}
|
|
733
|
-
vueInstance.portals.push(...[].slice.call(ele.children));
|
|
734
777
|
}
|
|
735
|
-
returnEle = ele.childNodes;
|
|
736
778
|
detach(ele);
|
|
737
779
|
}
|
|
738
780
|
else {
|
|
@@ -743,39 +785,34 @@ function compile(templateElement, helper) {
|
|
|
743
785
|
}
|
|
744
786
|
else {
|
|
745
787
|
// Compilation for Vue 2 functional template
|
|
746
|
-
|
|
788
|
+
const tempObj = templateElement.call(this, {});
|
|
747
789
|
let templateFunction = tempObj.template;
|
|
748
|
-
|
|
749
|
-
|
|
790
|
+
const propsData = getValue('template.propsData', tempObj);
|
|
791
|
+
const dataObj = {
|
|
750
792
|
data: { data: extend(tempObj.data || {}, data) },
|
|
751
|
-
parent: context.vueInstance
|
|
793
|
+
parent: context.vueInstance
|
|
752
794
|
};
|
|
753
795
|
if (propsData) {
|
|
754
796
|
templateFunction = tempObj.template.extends;
|
|
755
797
|
dataObj.propsData = propsData;
|
|
756
798
|
}
|
|
757
|
-
if (typeof templateFunction !==
|
|
799
|
+
if (typeof templateFunction !== 'function') {
|
|
758
800
|
templateFunction = aVue.extend(templateFunction);
|
|
759
801
|
}
|
|
760
802
|
if (templateFunction.options.setup) {
|
|
761
803
|
dataObj.propsData = Object.assign(dataObj.propsData || {}, data);
|
|
762
804
|
}
|
|
763
|
-
|
|
805
|
+
const templateVue = new templateFunction(dataObj);
|
|
764
806
|
// let templateVue = new Vue(tempObj.template);
|
|
765
807
|
// templateVue.$data.data = extend(tempObj.data, data);
|
|
766
|
-
templateVue.$mount(
|
|
767
|
-
if (vueInstance) {
|
|
768
|
-
if (!vueInstance['portals']) {
|
|
769
|
-
vueInstance['portals'] = [];
|
|
770
|
-
}
|
|
771
|
-
vueInstance.portals.push(...[].slice.call(ele.children));
|
|
772
|
-
}
|
|
808
|
+
templateVue.$mount('#' + id);
|
|
773
809
|
returnEle = ele.childNodes;
|
|
774
|
-
|
|
775
|
-
|
|
810
|
+
dataObj.parent = null;
|
|
811
|
+
if (vueInstance) {
|
|
812
|
+
let templateInstance = vueInstance.templateCollection;
|
|
776
813
|
if (!templateInstance) {
|
|
777
|
-
|
|
778
|
-
templateInstance =
|
|
814
|
+
vueInstance.templateCollection = {};
|
|
815
|
+
templateInstance = vueInstance.templateCollection;
|
|
779
816
|
}
|
|
780
817
|
if (propName) {
|
|
781
818
|
if (!templateInstance[`${propName}`]) {
|
|
@@ -791,8 +828,16 @@ function compile(templateElement, helper) {
|
|
|
791
828
|
};
|
|
792
829
|
}
|
|
793
830
|
setTemplateEngine({ compile: compile });
|
|
831
|
+
/**
|
|
832
|
+
* Collect values from the app instance.
|
|
833
|
+
*
|
|
834
|
+
* @param {any} app - represents global application instance
|
|
835
|
+
* @param {any} cInstance - represents Vue component instance
|
|
836
|
+
* @param {any} root - represents parent component instance
|
|
837
|
+
* @returns {void}
|
|
838
|
+
*/
|
|
794
839
|
function getValues(app, cInstance, root) {
|
|
795
|
-
|
|
840
|
+
const vueInstance = cInstance ? cInstance : ((root && root.vueInstance) ? root.vueInstance : null);
|
|
796
841
|
if (!vueInstance) {
|
|
797
842
|
return;
|
|
798
843
|
}
|
|
@@ -800,9 +845,10 @@ function getValues(app, cInstance, root) {
|
|
|
800
845
|
app['appContext'] = vueInstance['$']['appContext'];
|
|
801
846
|
// Get provide value from child component.
|
|
802
847
|
let provided = {};
|
|
803
|
-
|
|
804
|
-
if (vueinstance['$'] && vueinstance['$']['parent'])
|
|
848
|
+
const getProvideValue = (vueinstance) => {
|
|
849
|
+
if (vueinstance['$'] && vueinstance['$']['parent']) {
|
|
805
850
|
getProvideValue(vueinstance.$.parent);
|
|
851
|
+
}
|
|
806
852
|
if (vueinstance['provides'] && Object.keys(vueinstance['provides']).length > 0) {
|
|
807
853
|
provided = Object.assign({}, provided, vueinstance.provides);
|
|
808
854
|
}
|
|
@@ -812,29 +858,43 @@ function getValues(app, cInstance, root) {
|
|
|
812
858
|
app.appContext.provides = Object.assign({}, app.appContext.provides, provided);
|
|
813
859
|
}
|
|
814
860
|
}
|
|
815
|
-
|
|
861
|
+
/**
|
|
862
|
+
* Get the Vue2 slot template from the root or current Vue component.
|
|
863
|
+
*
|
|
864
|
+
* @param {any} vueInstance - represents parent Vue instance.
|
|
865
|
+
* @param {any} templateElement - represents component property value
|
|
866
|
+
* @param {any} root - represents root Vue instance
|
|
867
|
+
* @returns {any} template Vue instance
|
|
868
|
+
*/
|
|
816
869
|
function getVueSlot(vueInstance, templateElement, root) {
|
|
817
870
|
if (!vueInstance && !(root && root.vueInstance)) {
|
|
818
871
|
return undefined;
|
|
819
872
|
}
|
|
820
|
-
|
|
873
|
+
const instance = (root && root.vueInstance) ? root.vueInstance : vueInstance;
|
|
821
874
|
return getVueChildSlot(instance, templateElement);
|
|
822
875
|
}
|
|
876
|
+
/**
|
|
877
|
+
* Get the Vue2 nested slot template from the root or current Vue component.
|
|
878
|
+
*
|
|
879
|
+
* @param {any} vueInstance - represents parent Vue instance.
|
|
880
|
+
* @param {any} templateElement - represents component property value
|
|
881
|
+
* @returns {any} nested template Vue instance
|
|
882
|
+
*/
|
|
823
883
|
function getVueChildSlot(vueInstance, templateElement) {
|
|
824
884
|
if (!vueInstance) {
|
|
825
885
|
return undefined;
|
|
826
886
|
}
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
887
|
+
const slots = vueInstance.$slots;
|
|
888
|
+
const scopedSlots = vueInstance.$scopedSlots;
|
|
889
|
+
const vSlots = vueInstance.scopedSlots;
|
|
890
|
+
const children = vueInstance.children;
|
|
831
891
|
if (scopedSlots && scopedSlots[`${templateElement}`]) {
|
|
832
892
|
return scopedSlots;
|
|
833
893
|
}
|
|
834
894
|
else if (slots && slots.default) {
|
|
835
|
-
|
|
895
|
+
const childSlots = slots.default;
|
|
836
896
|
for (let i = 0; i < childSlots.length; i++) {
|
|
837
|
-
|
|
897
|
+
const slot = getVueChildSlot(getSlot(childSlots[parseInt(i.toString(), 10)]), templateElement);
|
|
838
898
|
if (slot) {
|
|
839
899
|
return slot;
|
|
840
900
|
}
|
|
@@ -845,7 +905,7 @@ function getVueChildSlot(vueInstance, templateElement) {
|
|
|
845
905
|
}
|
|
846
906
|
else if (children) {
|
|
847
907
|
for (let i = 0; i < children.length; i++) {
|
|
848
|
-
|
|
908
|
+
const slot = getVueChildSlot(getSlot(children[parseInt(i.toString(), 10)]), templateElement);
|
|
849
909
|
if (slot) {
|
|
850
910
|
return slot;
|
|
851
911
|
}
|
|
@@ -853,19 +913,39 @@ function getVueChildSlot(vueInstance, templateElement) {
|
|
|
853
913
|
}
|
|
854
914
|
return undefined;
|
|
855
915
|
}
|
|
916
|
+
/**
|
|
917
|
+
* Collect the component slot directive instance.
|
|
918
|
+
*
|
|
919
|
+
* @param {any} vnode - represents Vue components slot instance.
|
|
920
|
+
* @returns {any} the slot instance of the directive.
|
|
921
|
+
*/
|
|
856
922
|
function getSlot(vnode) {
|
|
857
|
-
|
|
923
|
+
const slot = (vnode.componentOptions && vnode.componentOptions.children) ? vnode.componentOptions :
|
|
858
924
|
(!vnode.data && (vnode.tag === 'e-markersettings' || vnode.tag === 'e-markersetting')) ? vnode : vnode.data;
|
|
859
925
|
return vnode.componentInstance ? vnode.componentInstance : slot;
|
|
860
926
|
}
|
|
861
|
-
|
|
927
|
+
/**
|
|
928
|
+
* Get the Vue3 slot template from the root or current Vue component.
|
|
929
|
+
*
|
|
930
|
+
* @param {any} vueInstance - represents parent Vue instance.
|
|
931
|
+
* @param {any} templateElement - represents component property value
|
|
932
|
+
* @param {any} root - represents root Vue instance
|
|
933
|
+
* @returns {any} slot template instance
|
|
934
|
+
*/
|
|
862
935
|
function getCurrentVueSlot(vueInstance, templateElement, root) {
|
|
863
936
|
if (!vueInstance && !(root && root.vueInstance)) {
|
|
864
937
|
return undefined;
|
|
865
938
|
}
|
|
866
|
-
|
|
939
|
+
const slots = (root && root.vueInstance) ? root.vueInstance.$slots : vueInstance.$slots;
|
|
867
940
|
return getChildVueSlot(slots, templateElement);
|
|
868
941
|
}
|
|
942
|
+
/**
|
|
943
|
+
* Get the Vue3 nested slot template from the root or current Vue component.
|
|
944
|
+
*
|
|
945
|
+
* @param {any} slots - represents slot instance.
|
|
946
|
+
* @param {any} templateElement - represents component property value
|
|
947
|
+
* @returns {any} nested template Vue instance
|
|
948
|
+
*/
|
|
869
949
|
function getChildVueSlot(slots, templateElement) {
|
|
870
950
|
if (slots && slots[`${templateElement}`]) {
|
|
871
951
|
return slots;
|
|
@@ -874,7 +954,7 @@ function getChildVueSlot(slots, templateElement) {
|
|
|
874
954
|
let childSlots = slots.default();
|
|
875
955
|
childSlots = childSlots.flatMap((item) => Array.isArray(item.children) ? item.children : item);
|
|
876
956
|
for (let i = 0; i < childSlots.length; i++) {
|
|
877
|
-
|
|
957
|
+
const slot = getChildVueSlot(childSlots[parseInt(i.toString(), 10)].children, templateElement);
|
|
878
958
|
if (slot) {
|
|
879
959
|
return slot;
|
|
880
960
|
}
|
|
@@ -883,9 +963,5 @@ function getChildVueSlot(slots, templateElement) {
|
|
|
883
963
|
return undefined;
|
|
884
964
|
}
|
|
885
965
|
|
|
886
|
-
|
|
887
|
-
* index for component base
|
|
888
|
-
*/
|
|
889
|
-
|
|
890
|
-
export { isExecute, aVue, gh, vueDefineComponent, ComponentBase, getProps, compile };
|
|
966
|
+
export { ComponentBase, aVue, compile, getProps, gh, isExecute, vueDefineComponent };
|
|
891
967
|
//# sourceMappingURL=ej2-vue-base.es2015.js.map
|