@syncfusion/ej2-vue-base 25.2.3 → 26.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +261 -0
- package/dist/ej2-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 +255 -143
- package/dist/es6/ej2-vue-base.es2015.js.map +1 -1
- package/dist/es6/ej2-vue-base.es5.js +194 -80
- 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 +11 -8
- package/src/component-base.d.ts +12 -4
- package/src/component-base.js +89 -47
- package/src/template.d.ts +7 -0
- package/src/template.js +110 -28
- package/tslint.json +111 -0
- package/CHANGELOG.md +0 -348
|
@@ -1,8 +1,12 @@
|
|
|
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;
|
|
@@ -11,15 +15,16 @@ else {
|
|
|
11
15
|
var newObj = {};
|
|
12
16
|
if (obj != null) {
|
|
13
17
|
for (var key in obj) {
|
|
14
|
-
if (Object.prototype.hasOwnProperty.call(obj, key))
|
|
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
|
var curVue = _interopRequireWildcard(Vue);
|
|
22
|
-
var isExecute = (parseInt(curVue['version']) > 2) ? false : true;
|
|
27
|
+
var isExecute = (parseInt(curVue['version'], 10) > 2) ? false : true;
|
|
23
28
|
var aVue = !isExecute ? curVue : (curVue['default']['default'] ? curVue['default']['default'] : curVue['default']);
|
|
24
29
|
var gh = curVue['h'];
|
|
25
30
|
var vueDefineComponent = function (options) { return !isExecute ? aVue['defineComponent'](options) : aVue['extend'](options); };
|
|
@@ -80,10 +85,13 @@ var ComponentBase = vueDefineComponent({
|
|
|
80
85
|
}
|
|
81
86
|
},
|
|
82
87
|
mounted: function () {
|
|
83
|
-
var cusEle = this.$el ? this.$el.querySelectorAll(
|
|
88
|
+
var cusEle = this.$el ? this.$el.querySelectorAll('div.e-directive') : null;
|
|
84
89
|
if (!isExecute && cusEle) {
|
|
85
90
|
for (var i = 0; i < cusEle.length; i++) {
|
|
86
|
-
|
|
91
|
+
var cusElement = cusEle[parseInt(i.toString(), 10)];
|
|
92
|
+
if (cusElement.parentElement) {
|
|
93
|
+
cusElement.parentElement.removeChild(cusElement);
|
|
94
|
+
}
|
|
87
95
|
}
|
|
88
96
|
}
|
|
89
97
|
this.ej2Instances.isVue = true;
|
|
@@ -145,12 +153,11 @@ var ComponentBase = vueDefineComponent({
|
|
|
145
153
|
provide = getValue('$.parent.provides', this);
|
|
146
154
|
}
|
|
147
155
|
if (provide) {
|
|
148
|
-
// tslint:disable:no-any
|
|
149
156
|
var injectables = provide;
|
|
150
157
|
if (typeof provide === 'function') {
|
|
151
158
|
if (provide.managed) {
|
|
152
|
-
var
|
|
153
|
-
var
|
|
159
|
+
var pKey = provide.managed;
|
|
160
|
+
var pValue = Object.keys(pKey);
|
|
154
161
|
var key = void 0;
|
|
155
162
|
if (this.$root && this.isDecorator) {
|
|
156
163
|
key = Object.keys(this.$root);
|
|
@@ -161,24 +168,23 @@ var ComponentBase = vueDefineComponent({
|
|
|
161
168
|
else if (this.$parent) {
|
|
162
169
|
key = Object.keys(this.$parent);
|
|
163
170
|
}
|
|
164
|
-
for (var i = 0; i <
|
|
171
|
+
for (var i = 0; i < pValue.length; i++) {
|
|
165
172
|
for (var j = 0; j < key.length; j++) {
|
|
166
|
-
if ((key[parseInt(j.toString(), 10)].indexOf(
|
|
173
|
+
if ((key[parseInt(j.toString(), 10)].indexOf(pValue[parseInt(i.toString(), 10)])) !== -1) {
|
|
167
174
|
if (this.$root && this.isDecorator) {
|
|
168
|
-
|
|
175
|
+
pKey[pValue[parseInt(j.toString(), 10)]] = this.$root[key[parseInt(i.toString(), 10)]];
|
|
169
176
|
}
|
|
170
177
|
else if (this.$vnode) {
|
|
171
|
-
|
|
178
|
+
pKey[pValue[parseInt(i.toString(), 10)]] = this.$vnode.context[key[parseInt(j.toString(), 10)]];
|
|
172
179
|
}
|
|
173
180
|
else if (this.$parent) {
|
|
174
|
-
|
|
181
|
+
pKey[pValue[parseInt(i.toString(), 10)]] = this.$parent[key[parseInt(j.toString(), 10)]];
|
|
175
182
|
}
|
|
176
|
-
injectables =
|
|
183
|
+
injectables = pKey;
|
|
177
184
|
}
|
|
178
185
|
}
|
|
179
186
|
}
|
|
180
187
|
}
|
|
181
|
-
// tslint:disable:no-any
|
|
182
188
|
else if (this.$vnode) {
|
|
183
189
|
injectables = this.$vnode.context.$options.provide();
|
|
184
190
|
}
|
|
@@ -192,10 +198,25 @@ var ComponentBase = vueDefineComponent({
|
|
|
192
198
|
return ret;
|
|
193
199
|
},
|
|
194
200
|
destroyComponent: function () {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
201
|
+
this.ej2Instances.destroy();
|
|
202
|
+
this.$el.style.visibility = 'hidden';
|
|
203
|
+
this.destroyPortals();
|
|
204
|
+
},
|
|
205
|
+
destroyPortals: function () {
|
|
206
|
+
if (this.portals) {
|
|
207
|
+
for (var _i = 0, _a = this.portals; _i < _a.length; _i++) {
|
|
208
|
+
var portal = _a[_i];
|
|
209
|
+
var controls = portal.classList.contains('e-control') ? [portal] : portal.getElementsByClassName('e-control');
|
|
210
|
+
for (var index = 0; index < controls.length; index++) {
|
|
211
|
+
var control = controls[parseInt(index.toString(), 10)];
|
|
212
|
+
if (control.ej2_instances && control.ej2_instances[0]) {
|
|
213
|
+
control.ej2_instances[0].destroy();
|
|
214
|
+
index--;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
this.portals = null;
|
|
219
|
+
}
|
|
199
220
|
},
|
|
200
221
|
bindProperties: function () {
|
|
201
222
|
var options = {};
|
|
@@ -244,21 +265,21 @@ var ComponentBase = vueDefineComponent({
|
|
|
244
265
|
for (var i = 0; i < propRef.length; i++) {
|
|
245
266
|
if (propRef[parseInt(i.toString(), 10)].type.methods || propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection') {
|
|
246
267
|
var key = propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection' ? 'series-collection' :
|
|
247
|
-
propRef[parseInt(i.toString(), 10)].type.methods.getTag().replace(
|
|
268
|
+
propRef[parseInt(i.toString(), 10)].type.methods.getTag().replace('e-', '');
|
|
248
269
|
var ref = this.resolveArrayDirectives(propRef[parseInt(i.toString(), 10)].children, key);
|
|
249
|
-
var
|
|
270
|
+
var spKeys = key.split('-');
|
|
250
271
|
var controlName = this.ej2Instances.getModuleName().toLowerCase();
|
|
251
|
-
var keyRef = (
|
|
272
|
+
var keyRef = (spKeys.length > 1 && controlName.indexOf(spKeys[0]) > -1) ? spKeys[1] : spKeys[0];
|
|
252
273
|
keyRef = keyRef.replace(controlName, '');
|
|
253
274
|
keyRef = this.tagNameMapper['e-' + key] ? this.tagNameMapper['e-' + key].replace('e-', '') : keyRef;
|
|
254
|
-
if (controlName
|
|
255
|
-
keyRef =
|
|
275
|
+
if (controlName === 'splitter' && keyRef === 'panes') {
|
|
276
|
+
keyRef = 'paneSettings';
|
|
256
277
|
}
|
|
257
|
-
else if (controlName
|
|
258
|
-
keyRef =
|
|
278
|
+
else if (controlName === 'bulletchart' && keyRef === 'range') {
|
|
279
|
+
keyRef = 'ranges';
|
|
259
280
|
}
|
|
260
|
-
else if (controlName
|
|
261
|
-
keyRef =
|
|
281
|
+
else if (controlName === 'schedule' && keyRef === 'header') {
|
|
282
|
+
keyRef = 'headerRows';
|
|
262
283
|
}
|
|
263
284
|
dirProps["" + keyRef] = ref["" + key];
|
|
264
285
|
}
|
|
@@ -288,7 +309,7 @@ var ComponentBase = vueDefineComponent({
|
|
|
288
309
|
var tagRef = childSlot.type.methods ? childSlot.type.methods.getTag() : tagName;
|
|
289
310
|
if (childSlot.children) {
|
|
290
311
|
var key = void 0;
|
|
291
|
-
innerDirValues = this_2.resolveComplexDirs(childSlot.children, this_2.tagMapper[
|
|
312
|
+
innerDirValues = this_2.resolveComplexDirs(childSlot.children, this_2.tagMapper['e-' + tagName], tagRef);
|
|
292
313
|
if (innerDirValues.length) {
|
|
293
314
|
tempObj = innerDirValues;
|
|
294
315
|
}
|
|
@@ -308,7 +329,12 @@ var ComponentBase = vueDefineComponent({
|
|
|
308
329
|
});
|
|
309
330
|
}
|
|
310
331
|
if (((/[s]\b/).test(tagRef) && innerDirValues) && (!(/[s]\b/).test(tagName) || innerDirValues.length)) {
|
|
311
|
-
Array.isArray(tempObj)
|
|
332
|
+
if (Array.isArray(tempObj)) {
|
|
333
|
+
tempObj.forEach(function (item) { items["" + tagName].push(item); });
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
items["" + tagName].push(tempObj);
|
|
337
|
+
}
|
|
312
338
|
}
|
|
313
339
|
else if (tempObj && Object.keys(tempObj).length !== 0) {
|
|
314
340
|
items["" + tagName].push(tempObj);
|
|
@@ -333,12 +359,11 @@ var ComponentBase = vueDefineComponent({
|
|
|
333
359
|
tagRef = Object.keys(tagObject["" + tagName]);
|
|
334
360
|
tag = tagRef.find(function (key) {
|
|
335
361
|
return tagObject["" + tagName]["" + key] ===
|
|
336
|
-
childSlot.type.methods.getTag().replace(/[s]\b/,
|
|
362
|
+
childSlot.type.methods.getTag().replace(/[s]\b/, '');
|
|
337
363
|
});
|
|
338
|
-
var moduleName = this_3.ej2Instances.getModuleName().toLowerCase();
|
|
339
364
|
tag = tag ? tag : childSlot.type.methods.getTag();
|
|
340
|
-
tag = (this_3.tagNameMapper["" + tag] ? this_3.tagNameMapper["" + tag] : tag).replace(
|
|
341
|
-
if (this_3.ej2Instances.getModuleName().toLowerCase()
|
|
365
|
+
tag = (this_3.tagNameMapper["" + tag] ? this_3.tagNameMapper["" + tag] : tag).replace('e-', '');
|
|
366
|
+
if (this_3.ej2Instances.getModuleName().toLowerCase() === 'diagram' && tag.indexOf('annotations') !== -1) {
|
|
342
367
|
tag = 'annotations';
|
|
343
368
|
}
|
|
344
369
|
}
|
|
@@ -358,7 +383,7 @@ var ComponentBase = vueDefineComponent({
|
|
|
358
383
|
childSlot.props = this_3.getCamelCaseProps(childSlot.props);
|
|
359
384
|
}
|
|
360
385
|
if (slot.length > 1) {
|
|
361
|
-
items = Object.keys(items).length
|
|
386
|
+
items = Object.keys(items).length === 0 && !items.length ? [] : items;
|
|
362
387
|
if (childSlot.props) {
|
|
363
388
|
items.push(childSlot.props);
|
|
364
389
|
}
|
|
@@ -382,7 +407,7 @@ var ComponentBase = vueDefineComponent({
|
|
|
382
407
|
var childSlot = slot_3[_i];
|
|
383
408
|
var innerDirValues = null;
|
|
384
409
|
var tag = childSlot.type.methods.getTag();
|
|
385
|
-
tag = (this.tagNameMapper[tag] ? this.tagNameMapper[tag] : tag).replace(
|
|
410
|
+
tag = (this.tagNameMapper["" + tag] ? this.tagNameMapper["" + tag] : tag).replace('e-', '');
|
|
386
411
|
if (childSlot.children) {
|
|
387
412
|
innerDirValues = this.resolveMultilevelComplexInnerDirs(childSlot.children, tagObject["" + tagName], childSlot.type.methods.getTag());
|
|
388
413
|
if ((/[s]\b/).test(tag) || slot.length > 1) {
|
|
@@ -431,9 +456,8 @@ var ComponentBase = vueDefineComponent({
|
|
|
431
456
|
for (var _i = 0, slot_4 = slot; _i < slot_4.length; _i++) {
|
|
432
457
|
var childSlot = slot_4[_i];
|
|
433
458
|
var innerDirValues = null;
|
|
434
|
-
var moduleName = this.ej2Instances.getModuleName().toLowerCase();
|
|
435
459
|
var tag = childSlot.type.methods.getTag();
|
|
436
|
-
tag = (this.tagNameMapper[tag] ? this.tagNameMapper[tag] : tag).replace(
|
|
460
|
+
tag = (this.tagNameMapper["" + tag] ? this.tagNameMapper["" + tag] : tag).replace('e-', '');
|
|
437
461
|
if (childSlot.children) {
|
|
438
462
|
innerDirValues = this.resolveComplexInnerDirs(childSlot.children, tagObject["" + tagName], childSlot.type.methods.getTag());
|
|
439
463
|
}
|
|
@@ -465,14 +489,15 @@ var ComponentBase = vueDefineComponent({
|
|
|
465
489
|
if (tagDirectives) {
|
|
466
490
|
for (var _i = 0, tagDirectives_1 = tagDirectives; _i < tagDirectives_1.length; _i++) {
|
|
467
491
|
var tagDirective = tagDirectives_1[_i];
|
|
468
|
-
|
|
492
|
+
var tagCompOption = tagDirective.componentOptions;
|
|
493
|
+
if (tagCompOption && tagCompOption.children && this.getTagName(tagCompOption) ||
|
|
469
494
|
(tagDirective.tag === 'e-seriescollection' && tagDirective.children)) {
|
|
470
|
-
var dirTag =
|
|
495
|
+
var dirTag = tagCompOption ? this.getTagName(tagCompOption) : tagDirective.tag;
|
|
471
496
|
dirTag = (dirTag === 'e-seriescollection') ? 'e-seriesCollection' : dirTag;
|
|
472
497
|
if (keyTags.indexOf(dirTag) !== -1) {
|
|
473
498
|
var tagName = tagNameMapper["" + dirTag] ? tagNameMapper["" + dirTag] : dirTag;
|
|
474
499
|
dir[tagName.replace('e-', '')] = [];
|
|
475
|
-
var children =
|
|
500
|
+
var children = tagCompOption ? tagCompOption.children : tagDirective.children;
|
|
476
501
|
for (var _a = 0, children_1 = children; _a < children_1.length; _a++) {
|
|
477
502
|
var tagDirChild = children_1[_a];
|
|
478
503
|
var retObj = this.getVNodeValue(tagDirChild, tagMapper["" + dirTag], tagNameMapper);
|
|
@@ -528,8 +553,9 @@ var ComponentBase = vueDefineComponent({
|
|
|
528
553
|
else {
|
|
529
554
|
dirTag = (tagDirective.tag === 'e-markersettings') ? 'e-markerSettings' : 'e-markerSetting';
|
|
530
555
|
}
|
|
531
|
-
|
|
532
|
-
|
|
556
|
+
var tagData = tagDirective.data;
|
|
557
|
+
if (typeof tagKey === 'string' && dirTag === tagKey && tagData) {
|
|
558
|
+
ret = tagData.attrs ? this.getCamelCaseProps(tagData.attrs) : this.getCamelCaseProps(tagData);
|
|
533
559
|
}
|
|
534
560
|
else if (typeof tagKey === 'object') {
|
|
535
561
|
if (tagDirective.componentOptions.children && (Object.keys(tagKey).indexOf(dirTag) !== -1)) {
|
|
@@ -538,15 +564,18 @@ var ComponentBase = vueDefineComponent({
|
|
|
538
564
|
else if (tagDirective.children && (Object.keys(tagKey).indexOf(dirTag) !== -1) && (dirTag === 'e-markersettings' || dirTag === 'e-markersetting')) {
|
|
539
565
|
ret = this.getMultiLevelDirValue(tagDirective.children, tagKey["" + dirTag], tagNameMapper);
|
|
540
566
|
}
|
|
541
|
-
if (
|
|
542
|
-
ret = extend(ret, this.getCamelCaseProps(
|
|
567
|
+
if (tagData && tagData.attrs) {
|
|
568
|
+
ret = extend(ret, this.getCamelCaseProps(tagData.attrs));
|
|
543
569
|
}
|
|
544
570
|
}
|
|
545
571
|
}
|
|
546
572
|
return ret;
|
|
547
573
|
},
|
|
548
574
|
/**
|
|
549
|
-
* convert kebab case directive props to camel case
|
|
575
|
+
* convert kebab case directive props to camel case.
|
|
576
|
+
*
|
|
577
|
+
* @param {Object} props - Objects in kebab case directive props.
|
|
578
|
+
* @returns {Object} Object converted into camel case directive props.
|
|
550
579
|
*/
|
|
551
580
|
getCamelCaseProps: function (props) {
|
|
552
581
|
var retProps = {};
|
|
@@ -564,13 +593,20 @@ var ComponentBase = vueDefineComponent({
|
|
|
564
593
|
},
|
|
565
594
|
getTagName: function (options) {
|
|
566
595
|
var tag = options.tag;
|
|
567
|
-
|
|
596
|
+
var optCtor = options.Ctor;
|
|
597
|
+
if (!tag && optCtor && optCtor.extendOptions && optCtor.extendOptions.methods && optCtor.extendOptions.methods.getTag) {
|
|
568
598
|
tag = options.Ctor.extendOptions.methods.getTag();
|
|
569
599
|
}
|
|
570
600
|
return tag;
|
|
571
601
|
}
|
|
572
602
|
}
|
|
573
603
|
});
|
|
604
|
+
/**
|
|
605
|
+
* Collect public property values for the Vue component.
|
|
606
|
+
*
|
|
607
|
+
* @param {any} options - represents props object.
|
|
608
|
+
* @returns {any} array of props object and `watchobject` respectively.
|
|
609
|
+
*/
|
|
574
610
|
function getProps(options) {
|
|
575
611
|
if (options === void 0) { options = {}; }
|
|
576
612
|
if (options.props) {
|
|
@@ -590,8 +626,9 @@ function getProps(options) {
|
|
|
590
626
|
}
|
|
591
627
|
return [options.newprops, options.watch];
|
|
592
628
|
}
|
|
593
|
-
if (!isExecute)
|
|
629
|
+
if (!isExecute) {
|
|
594
630
|
setProxyToRaw(aVue.toRaw);
|
|
631
|
+
}
|
|
595
632
|
|
|
596
633
|
var __assign = (undefined && undefined.__assign) || function () {
|
|
597
634
|
__assign = Object.assign || function(t) {
|
|
@@ -604,22 +641,31 @@ var __assign = (undefined && undefined.__assign) || function () {
|
|
|
604
641
|
};
|
|
605
642
|
return __assign.apply(this, arguments);
|
|
606
643
|
};
|
|
607
|
-
// tslint:disable:no-any
|
|
608
644
|
var stringCompiler = getTemplateEngine();
|
|
645
|
+
/**
|
|
646
|
+
* Compiler function that convert the template property to DOM element.
|
|
647
|
+
*
|
|
648
|
+
* @param {any} templateElement - represents value of the template property from the component.
|
|
649
|
+
* @param {Object} helper - represents helper object to utilize on template compilation.
|
|
650
|
+
* @returns {NodeList} template element that append to the component.
|
|
651
|
+
*/
|
|
609
652
|
function compile(templateElement, helper) {
|
|
610
|
-
var
|
|
653
|
+
var _this = this;
|
|
611
654
|
return function (data, context, propName, element, root) {
|
|
655
|
+
var _a, _b, _c, _d;
|
|
612
656
|
var returnEle;
|
|
613
657
|
if (context) {
|
|
614
658
|
var plugins = context.vueInstance && context.vueInstance.plugins ? { plugins: context.vueInstance.plugins } : {};
|
|
615
|
-
var
|
|
616
|
-
|
|
617
|
-
var
|
|
659
|
+
var vueInstance = context.vueInstance ? context.vueInstance :
|
|
660
|
+
((root && root.vueInstance) ? root.vueInstance : null);
|
|
661
|
+
var pid = getUniqueID('templateParentDiv');
|
|
662
|
+
var id = getUniqueID('templateDiv');
|
|
663
|
+
var ele = createElement('div', {
|
|
618
664
|
id: pid,
|
|
619
|
-
innerHTML: '<div id="' + id + '"></div>'
|
|
665
|
+
innerHTML: '<div id="' + id + '"></div>'
|
|
620
666
|
});
|
|
621
667
|
document.body.appendChild(ele);
|
|
622
|
-
if (!isExecute && (typeof templateElement ===
|
|
668
|
+
if (!isExecute && (typeof templateElement === 'string' || (templateElement.prototype && templateElement.prototype.CSPTemplate && typeof templateElement === 'function'))) {
|
|
623
669
|
var vueSlot_1 = getCurrentVueSlot(context.vueInstance, templateElement, root);
|
|
624
670
|
if (vueSlot_1) {
|
|
625
671
|
// Compilation for Vue 3 slot template
|
|
@@ -632,6 +678,12 @@ function compile(templateElement, helper) {
|
|
|
632
678
|
// Get values for Vue 3 slot template
|
|
633
679
|
getValues(app, context.vueInstance, root);
|
|
634
680
|
aVue.render(app, ele);
|
|
681
|
+
if (vueInstance) {
|
|
682
|
+
if (!vueInstance['portals']) {
|
|
683
|
+
vueInstance['portals'] = [];
|
|
684
|
+
}
|
|
685
|
+
(_a = vueInstance.portals).push.apply(_a, [].slice.call(ele.children));
|
|
686
|
+
}
|
|
635
687
|
returnEle = ele.childNodes;
|
|
636
688
|
detach(ele);
|
|
637
689
|
}
|
|
@@ -643,12 +695,12 @@ function compile(templateElement, helper) {
|
|
|
643
695
|
}
|
|
644
696
|
else if (!isExecute) {
|
|
645
697
|
// Compilation for Vue 3 functional template
|
|
646
|
-
var tempObj = templateElement.call(
|
|
698
|
+
var tempObj = templateElement.call(_this, {});
|
|
647
699
|
var object = tempObj;
|
|
648
|
-
var propsData = getValue(
|
|
700
|
+
var propsData = getValue('template.propsData', tempObj);
|
|
649
701
|
var dataObj_1 = {
|
|
650
702
|
data: { data: extend(tempObj.data || {}, data) },
|
|
651
|
-
parent: context.vueInstance
|
|
703
|
+
parent: context.vueInstance
|
|
652
704
|
};
|
|
653
705
|
if (!object.template) {
|
|
654
706
|
object.template = object[Object.keys(object)[0]];
|
|
@@ -685,9 +737,12 @@ function compile(templateElement, helper) {
|
|
|
685
737
|
var _loop_1 = function (objstring) {
|
|
686
738
|
var intComponent = templateCompRef.components["" + objstring];
|
|
687
739
|
if (intComponent && intComponent.data) {
|
|
688
|
-
if (!intComponent.__data)
|
|
740
|
+
if (!intComponent.__data) {
|
|
689
741
|
intComponent.__data = intComponent.data;
|
|
690
|
-
|
|
742
|
+
}
|
|
743
|
+
intComponent.data = function (proxy) {
|
|
744
|
+
return Object.assign(intComponent.__data.call(proxy), dataObj_1.data);
|
|
745
|
+
};
|
|
691
746
|
}
|
|
692
747
|
};
|
|
693
748
|
for (var _i = 0, objkeys_1 = objkeys; _i < objkeys_1.length; _i++) {
|
|
@@ -705,6 +760,12 @@ function compile(templateElement, helper) {
|
|
|
705
760
|
// Get values for Vue 3 functional template
|
|
706
761
|
getValues(app, context.vueInstance, root);
|
|
707
762
|
aVue.render(app, ele);
|
|
763
|
+
if (vueInstance) {
|
|
764
|
+
if (!vueInstance['portals']) {
|
|
765
|
+
vueInstance['portals'] = [];
|
|
766
|
+
}
|
|
767
|
+
(_b = vueInstance.portals).push.apply(_b, [].slice.call(ele.children));
|
|
768
|
+
}
|
|
708
769
|
returnEle = ele.childNodes;
|
|
709
770
|
if (context.vueInstance) {
|
|
710
771
|
var templateInstance = context.vueInstance.templateCollection;
|
|
@@ -721,21 +782,23 @@ function compile(templateElement, helper) {
|
|
|
721
782
|
}
|
|
722
783
|
detach(ele);
|
|
723
784
|
}
|
|
724
|
-
else if (typeof templateElement ===
|
|
785
|
+
else if (typeof templateElement === 'string' || (templateElement.prototype && templateElement.prototype.CSPTemplate && typeof templateElement === 'function')) {
|
|
725
786
|
var vueSlot_2 = getVueSlot(context.vueInstance, templateElement, root);
|
|
726
787
|
if (vueSlot_2) {
|
|
727
788
|
// Get provide values for Vue 2 slot template
|
|
728
789
|
var provided_1 = {};
|
|
729
790
|
var getProvideValues_1 = function (vueinstance) {
|
|
730
|
-
if (vueinstance['$parent'])
|
|
791
|
+
if (vueinstance['$parent']) {
|
|
731
792
|
getProvideValues_1(vueinstance.$parent);
|
|
793
|
+
}
|
|
732
794
|
if (vueinstance['_provided'] && Object.keys(vueinstance['_provided']).length > 0) {
|
|
733
795
|
provided_1 = __assign({}, provided_1, vueinstance._provided);
|
|
734
796
|
}
|
|
735
797
|
};
|
|
736
|
-
var
|
|
737
|
-
|
|
738
|
-
|
|
798
|
+
var vueInstance_1 = context.vueInstance ? context.vueInstance :
|
|
799
|
+
((root && root.vueInstance) ? root.vueInstance : null);
|
|
800
|
+
if (vueInstance_1) {
|
|
801
|
+
getProvideValues_1(vueInstance_1);
|
|
739
802
|
}
|
|
740
803
|
// Compilation for Vue 2 slot template
|
|
741
804
|
var vueTemplate = new aVue({
|
|
@@ -744,7 +807,13 @@ function compile(templateElement, helper) {
|
|
|
744
807
|
return vueSlot_2["" + templateElement]({ data: data });
|
|
745
808
|
}
|
|
746
809
|
});
|
|
747
|
-
vueTemplate.$mount(
|
|
810
|
+
vueTemplate.$mount('#' + id);
|
|
811
|
+
if (vueInstance_1) {
|
|
812
|
+
if (!vueInstance_1['portals']) {
|
|
813
|
+
vueInstance_1['portals'] = [];
|
|
814
|
+
}
|
|
815
|
+
(_c = vueInstance_1.portals).push.apply(_c, [].slice.call(ele.children));
|
|
816
|
+
}
|
|
748
817
|
returnEle = ele.childNodes;
|
|
749
818
|
detach(ele);
|
|
750
819
|
}
|
|
@@ -756,18 +825,18 @@ function compile(templateElement, helper) {
|
|
|
756
825
|
}
|
|
757
826
|
else {
|
|
758
827
|
// Compilation for Vue 2 functional template
|
|
759
|
-
var tempObj = templateElement.call(
|
|
828
|
+
var tempObj = templateElement.call(_this, {});
|
|
760
829
|
var templateFunction = tempObj.template;
|
|
761
|
-
var propsData = getValue(
|
|
830
|
+
var propsData = getValue('template.propsData', tempObj);
|
|
762
831
|
var dataObj = {
|
|
763
832
|
data: { data: extend(tempObj.data || {}, data) },
|
|
764
|
-
parent: context.vueInstance
|
|
833
|
+
parent: context.vueInstance
|
|
765
834
|
};
|
|
766
835
|
if (propsData) {
|
|
767
836
|
templateFunction = tempObj.template.extends;
|
|
768
837
|
dataObj.propsData = propsData;
|
|
769
838
|
}
|
|
770
|
-
if (typeof templateFunction !==
|
|
839
|
+
if (typeof templateFunction !== 'function') {
|
|
771
840
|
templateFunction = aVue.extend(templateFunction);
|
|
772
841
|
}
|
|
773
842
|
if (templateFunction.options.setup) {
|
|
@@ -776,7 +845,13 @@ function compile(templateElement, helper) {
|
|
|
776
845
|
var templateVue = new templateFunction(dataObj);
|
|
777
846
|
// let templateVue = new Vue(tempObj.template);
|
|
778
847
|
// templateVue.$data.data = extend(tempObj.data, data);
|
|
779
|
-
templateVue.$mount(
|
|
848
|
+
templateVue.$mount('#' + id);
|
|
849
|
+
if (vueInstance) {
|
|
850
|
+
if (!vueInstance['portals']) {
|
|
851
|
+
vueInstance['portals'] = [];
|
|
852
|
+
}
|
|
853
|
+
(_d = vueInstance.portals).push.apply(_d, [].slice.call(ele.children));
|
|
854
|
+
}
|
|
780
855
|
returnEle = ele.childNodes;
|
|
781
856
|
if (context.vueInstance) {
|
|
782
857
|
var templateInstance = context.vueInstance.templateCollection;
|
|
@@ -798,6 +873,14 @@ function compile(templateElement, helper) {
|
|
|
798
873
|
};
|
|
799
874
|
}
|
|
800
875
|
setTemplateEngine({ compile: compile });
|
|
876
|
+
/**
|
|
877
|
+
* Collect values from the app instance.
|
|
878
|
+
*
|
|
879
|
+
* @param {any} app - represents global application instance
|
|
880
|
+
* @param {any} cInstance - represents Vue component instance
|
|
881
|
+
* @param {any} root - represents parent component instance
|
|
882
|
+
* @returns {void}
|
|
883
|
+
*/
|
|
801
884
|
function getValues(app, cInstance, root) {
|
|
802
885
|
var vueInstance = cInstance ? cInstance : ((root && root.vueInstance) ? root.vueInstance : null);
|
|
803
886
|
if (!vueInstance) {
|
|
@@ -808,8 +891,9 @@ function getValues(app, cInstance, root) {
|
|
|
808
891
|
// Get provide value from child component.
|
|
809
892
|
var provided = {};
|
|
810
893
|
var getProvideValue = function (vueinstance) {
|
|
811
|
-
if (vueinstance['$'] && vueinstance['$']['parent'])
|
|
894
|
+
if (vueinstance['$'] && vueinstance['$']['parent']) {
|
|
812
895
|
getProvideValue(vueinstance.$.parent);
|
|
896
|
+
}
|
|
813
897
|
if (vueinstance['provides'] && Object.keys(vueinstance['provides']).length > 0) {
|
|
814
898
|
provided = __assign({}, provided, vueinstance.provides);
|
|
815
899
|
}
|
|
@@ -819,7 +903,14 @@ function getValues(app, cInstance, root) {
|
|
|
819
903
|
app.appContext.provides = __assign({}, app.appContext.provides, provided);
|
|
820
904
|
}
|
|
821
905
|
}
|
|
822
|
-
|
|
906
|
+
/**
|
|
907
|
+
* Get the Vue2 slot template from the root or current Vue component.
|
|
908
|
+
*
|
|
909
|
+
* @param {any} vueInstance - represents parent Vue instance.
|
|
910
|
+
* @param {any} templateElement - represents component property value
|
|
911
|
+
* @param {any} root - represents root Vue instance
|
|
912
|
+
* @returns {any} template Vue instance
|
|
913
|
+
*/
|
|
823
914
|
function getVueSlot(vueInstance, templateElement, root) {
|
|
824
915
|
if (!vueInstance && !(root && root.vueInstance)) {
|
|
825
916
|
return undefined;
|
|
@@ -827,6 +918,13 @@ function getVueSlot(vueInstance, templateElement, root) {
|
|
|
827
918
|
var instance = (root && root.vueInstance) ? root.vueInstance : vueInstance;
|
|
828
919
|
return getVueChildSlot(instance, templateElement);
|
|
829
920
|
}
|
|
921
|
+
/**
|
|
922
|
+
* Get the Vue2 nested slot template from the root or current Vue component.
|
|
923
|
+
*
|
|
924
|
+
* @param {any} vueInstance - represents parent Vue instance.
|
|
925
|
+
* @param {any} templateElement - represents component property value
|
|
926
|
+
* @returns {any} nested template Vue instance
|
|
927
|
+
*/
|
|
830
928
|
function getVueChildSlot(vueInstance, templateElement) {
|
|
831
929
|
if (!vueInstance) {
|
|
832
930
|
return undefined;
|
|
@@ -860,12 +958,25 @@ function getVueChildSlot(vueInstance, templateElement) {
|
|
|
860
958
|
}
|
|
861
959
|
return undefined;
|
|
862
960
|
}
|
|
961
|
+
/**
|
|
962
|
+
* Collect the component slot directive instance.
|
|
963
|
+
*
|
|
964
|
+
* @param {any} vnode - represents Vue components slot instance.
|
|
965
|
+
* @returns {any} the slot instance of the directive.
|
|
966
|
+
*/
|
|
863
967
|
function getSlot(vnode) {
|
|
864
968
|
var slot = (vnode.componentOptions && vnode.componentOptions.children) ? vnode.componentOptions :
|
|
865
969
|
(!vnode.data && (vnode.tag === 'e-markersettings' || vnode.tag === 'e-markersetting')) ? vnode : vnode.data;
|
|
866
970
|
return vnode.componentInstance ? vnode.componentInstance : slot;
|
|
867
971
|
}
|
|
868
|
-
|
|
972
|
+
/**
|
|
973
|
+
* Get the Vue3 slot template from the root or current Vue component.
|
|
974
|
+
*
|
|
975
|
+
* @param {any} vueInstance - represents parent Vue instance.
|
|
976
|
+
* @param {any} templateElement - represents component property value
|
|
977
|
+
* @param {any} root - represents root Vue instance
|
|
978
|
+
* @returns {any} slot template instance
|
|
979
|
+
*/
|
|
869
980
|
function getCurrentVueSlot(vueInstance, templateElement, root) {
|
|
870
981
|
if (!vueInstance && !(root && root.vueInstance)) {
|
|
871
982
|
return undefined;
|
|
@@ -873,6 +984,13 @@ function getCurrentVueSlot(vueInstance, templateElement, root) {
|
|
|
873
984
|
var slots = (root && root.vueInstance) ? root.vueInstance.$slots : vueInstance.$slots;
|
|
874
985
|
return getChildVueSlot(slots, templateElement);
|
|
875
986
|
}
|
|
987
|
+
/**
|
|
988
|
+
* Get the Vue3 nested slot template from the root or current Vue component.
|
|
989
|
+
*
|
|
990
|
+
* @param {any} slots - represents slot instance.
|
|
991
|
+
* @param {any} templateElement - represents component property value
|
|
992
|
+
* @returns {any} nested template Vue instance
|
|
993
|
+
*/
|
|
876
994
|
function getChildVueSlot(slots, templateElement) {
|
|
877
995
|
if (slots && slots["" + templateElement]) {
|
|
878
996
|
return slots;
|
|
@@ -890,9 +1008,5 @@ function getChildVueSlot(slots, templateElement) {
|
|
|
890
1008
|
return undefined;
|
|
891
1009
|
}
|
|
892
1010
|
|
|
893
|
-
|
|
894
|
-
* index for component base
|
|
895
|
-
*/
|
|
896
|
-
|
|
897
|
-
export { isExecute, aVue, gh, vueDefineComponent, ComponentBase, getProps, compile };
|
|
1011
|
+
export { ComponentBase, aVue, compile, getProps, gh, isExecute, vueDefineComponent };
|
|
898
1012
|
//# sourceMappingURL=ej2-vue-base.es5.js.map
|