@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,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,26 +198,25 @@ var ComponentBase = vueDefineComponent({
|
|
|
192
198
|
return ret;
|
|
193
199
|
},
|
|
194
200
|
destroyComponent: function () {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
tempBeforeDestroyThis.destroyPortals();
|
|
199
|
-
tempBeforeDestroyThis = null;
|
|
201
|
+
this.ej2Instances.destroy();
|
|
202
|
+
this.$el.style.visibility = 'hidden';
|
|
203
|
+
this.clearTemplate();
|
|
200
204
|
},
|
|
201
|
-
destroyPortals: function () {
|
|
202
|
-
if (
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
index--;
|
|
211
|
-
}
|
|
205
|
+
destroyPortals: function (element) {
|
|
206
|
+
if (element) {
|
|
207
|
+
var destroy = getValue('__vue__.$destroy', element);
|
|
208
|
+
if (destroy) {
|
|
209
|
+
element.__vue__.$destroy();
|
|
210
|
+
}
|
|
211
|
+
else if (!isExecute && element._vnode) {
|
|
212
|
+
try {
|
|
213
|
+
aVue.render(null, element);
|
|
212
214
|
}
|
|
215
|
+
catch (e) { /* Handle error */ }
|
|
216
|
+
}
|
|
217
|
+
if (element.innerHTML) {
|
|
218
|
+
element.innerHTML = '';
|
|
213
219
|
}
|
|
214
|
-
this.portals = null;
|
|
215
220
|
}
|
|
216
221
|
},
|
|
217
222
|
bindProperties: function () {
|
|
@@ -261,21 +266,21 @@ var ComponentBase = vueDefineComponent({
|
|
|
261
266
|
for (var i = 0; i < propRef.length; i++) {
|
|
262
267
|
if (propRef[parseInt(i.toString(), 10)].type.methods || propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection') {
|
|
263
268
|
var key = propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection' ? 'series-collection' :
|
|
264
|
-
propRef[parseInt(i.toString(), 10)].type.methods.getTag().replace(
|
|
269
|
+
propRef[parseInt(i.toString(), 10)].type.methods.getTag().replace('e-', '');
|
|
265
270
|
var ref = this.resolveArrayDirectives(propRef[parseInt(i.toString(), 10)].children, key);
|
|
266
|
-
var
|
|
271
|
+
var spKeys = key.split('-');
|
|
267
272
|
var controlName = this.ej2Instances.getModuleName().toLowerCase();
|
|
268
|
-
var keyRef = (
|
|
273
|
+
var keyRef = (spKeys.length > 1 && controlName.indexOf(spKeys[0]) > -1) ? spKeys[1] : spKeys[0];
|
|
269
274
|
keyRef = keyRef.replace(controlName, '');
|
|
270
275
|
keyRef = this.tagNameMapper['e-' + key] ? this.tagNameMapper['e-' + key].replace('e-', '') : keyRef;
|
|
271
|
-
if (controlName
|
|
272
|
-
keyRef =
|
|
276
|
+
if (controlName === 'splitter' && keyRef === 'panes') {
|
|
277
|
+
keyRef = 'paneSettings';
|
|
273
278
|
}
|
|
274
|
-
else if (controlName
|
|
275
|
-
keyRef =
|
|
279
|
+
else if (controlName === 'bulletchart' && keyRef === 'range') {
|
|
280
|
+
keyRef = 'ranges';
|
|
276
281
|
}
|
|
277
|
-
else if (controlName
|
|
278
|
-
keyRef =
|
|
282
|
+
else if (controlName === 'schedule' && keyRef === 'header') {
|
|
283
|
+
keyRef = 'headerRows';
|
|
279
284
|
}
|
|
280
285
|
dirProps["" + keyRef] = ref["" + key];
|
|
281
286
|
}
|
|
@@ -305,7 +310,7 @@ var ComponentBase = vueDefineComponent({
|
|
|
305
310
|
var tagRef = childSlot.type.methods ? childSlot.type.methods.getTag() : tagName;
|
|
306
311
|
if (childSlot.children) {
|
|
307
312
|
var key = void 0;
|
|
308
|
-
innerDirValues = this_2.resolveComplexDirs(childSlot.children, this_2.tagMapper[
|
|
313
|
+
innerDirValues = this_2.resolveComplexDirs(childSlot.children, this_2.tagMapper['e-' + tagName], tagRef);
|
|
309
314
|
if (innerDirValues.length) {
|
|
310
315
|
tempObj = innerDirValues;
|
|
311
316
|
}
|
|
@@ -325,7 +330,12 @@ var ComponentBase = vueDefineComponent({
|
|
|
325
330
|
});
|
|
326
331
|
}
|
|
327
332
|
if (((/[s]\b/).test(tagRef) && innerDirValues) && (!(/[s]\b/).test(tagName) || innerDirValues.length)) {
|
|
328
|
-
Array.isArray(tempObj)
|
|
333
|
+
if (Array.isArray(tempObj)) {
|
|
334
|
+
tempObj.forEach(function (item) { items["" + tagName].push(item); });
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
items["" + tagName].push(tempObj);
|
|
338
|
+
}
|
|
329
339
|
}
|
|
330
340
|
else if (tempObj && Object.keys(tempObj).length !== 0) {
|
|
331
341
|
items["" + tagName].push(tempObj);
|
|
@@ -350,12 +360,11 @@ var ComponentBase = vueDefineComponent({
|
|
|
350
360
|
tagRef = Object.keys(tagObject["" + tagName]);
|
|
351
361
|
tag = tagRef.find(function (key) {
|
|
352
362
|
return tagObject["" + tagName]["" + key] ===
|
|
353
|
-
childSlot.type.methods.getTag().replace(/[s]\b/,
|
|
363
|
+
childSlot.type.methods.getTag().replace(/[s]\b/, '');
|
|
354
364
|
});
|
|
355
|
-
var moduleName = this_3.ej2Instances.getModuleName().toLowerCase();
|
|
356
365
|
tag = tag ? tag : childSlot.type.methods.getTag();
|
|
357
|
-
tag = (this_3.tagNameMapper["" + tag] ? this_3.tagNameMapper["" + tag] : tag).replace(
|
|
358
|
-
if (this_3.ej2Instances.getModuleName().toLowerCase()
|
|
366
|
+
tag = (this_3.tagNameMapper["" + tag] ? this_3.tagNameMapper["" + tag] : tag).replace('e-', '');
|
|
367
|
+
if (this_3.ej2Instances.getModuleName().toLowerCase() === 'diagram' && tag.indexOf('annotations') !== -1) {
|
|
359
368
|
tag = 'annotations';
|
|
360
369
|
}
|
|
361
370
|
}
|
|
@@ -375,7 +384,7 @@ var ComponentBase = vueDefineComponent({
|
|
|
375
384
|
childSlot.props = this_3.getCamelCaseProps(childSlot.props);
|
|
376
385
|
}
|
|
377
386
|
if (slot.length > 1) {
|
|
378
|
-
items = Object.keys(items).length
|
|
387
|
+
items = Object.keys(items).length === 0 && !items.length ? [] : items;
|
|
379
388
|
if (childSlot.props) {
|
|
380
389
|
items.push(childSlot.props);
|
|
381
390
|
}
|
|
@@ -399,7 +408,7 @@ var ComponentBase = vueDefineComponent({
|
|
|
399
408
|
var childSlot = slot_3[_i];
|
|
400
409
|
var innerDirValues = null;
|
|
401
410
|
var tag = childSlot.type.methods.getTag();
|
|
402
|
-
tag = (this.tagNameMapper[tag] ? this.tagNameMapper[tag] : tag).replace(
|
|
411
|
+
tag = (this.tagNameMapper["" + tag] ? this.tagNameMapper["" + tag] : tag).replace('e-', '');
|
|
403
412
|
if (childSlot.children) {
|
|
404
413
|
innerDirValues = this.resolveMultilevelComplexInnerDirs(childSlot.children, tagObject["" + tagName], childSlot.type.methods.getTag());
|
|
405
414
|
if ((/[s]\b/).test(tag) || slot.length > 1) {
|
|
@@ -448,9 +457,8 @@ var ComponentBase = vueDefineComponent({
|
|
|
448
457
|
for (var _i = 0, slot_4 = slot; _i < slot_4.length; _i++) {
|
|
449
458
|
var childSlot = slot_4[_i];
|
|
450
459
|
var innerDirValues = null;
|
|
451
|
-
var moduleName = this.ej2Instances.getModuleName().toLowerCase();
|
|
452
460
|
var tag = childSlot.type.methods.getTag();
|
|
453
|
-
tag = (this.tagNameMapper[tag] ? this.tagNameMapper[tag] : tag).replace(
|
|
461
|
+
tag = (this.tagNameMapper["" + tag] ? this.tagNameMapper["" + tag] : tag).replace('e-', '');
|
|
454
462
|
if (childSlot.children) {
|
|
455
463
|
innerDirValues = this.resolveComplexInnerDirs(childSlot.children, tagObject["" + tagName], childSlot.type.methods.getTag());
|
|
456
464
|
}
|
|
@@ -482,14 +490,15 @@ var ComponentBase = vueDefineComponent({
|
|
|
482
490
|
if (tagDirectives) {
|
|
483
491
|
for (var _i = 0, tagDirectives_1 = tagDirectives; _i < tagDirectives_1.length; _i++) {
|
|
484
492
|
var tagDirective = tagDirectives_1[_i];
|
|
485
|
-
|
|
493
|
+
var tagCompOption = tagDirective.componentOptions;
|
|
494
|
+
if (tagCompOption && tagCompOption.children && this.getTagName(tagCompOption) ||
|
|
486
495
|
(tagDirective.tag === 'e-seriescollection' && tagDirective.children)) {
|
|
487
|
-
var dirTag =
|
|
496
|
+
var dirTag = tagCompOption ? this.getTagName(tagCompOption) : tagDirective.tag;
|
|
488
497
|
dirTag = (dirTag === 'e-seriescollection') ? 'e-seriesCollection' : dirTag;
|
|
489
498
|
if (keyTags.indexOf(dirTag) !== -1) {
|
|
490
499
|
var tagName = tagNameMapper["" + dirTag] ? tagNameMapper["" + dirTag] : dirTag;
|
|
491
500
|
dir[tagName.replace('e-', '')] = [];
|
|
492
|
-
var children =
|
|
501
|
+
var children = tagCompOption ? tagCompOption.children : tagDirective.children;
|
|
493
502
|
for (var _a = 0, children_1 = children; _a < children_1.length; _a++) {
|
|
494
503
|
var tagDirChild = children_1[_a];
|
|
495
504
|
var retObj = this.getVNodeValue(tagDirChild, tagMapper["" + dirTag], tagNameMapper);
|
|
@@ -545,8 +554,9 @@ var ComponentBase = vueDefineComponent({
|
|
|
545
554
|
else {
|
|
546
555
|
dirTag = (tagDirective.tag === 'e-markersettings') ? 'e-markerSettings' : 'e-markerSetting';
|
|
547
556
|
}
|
|
548
|
-
|
|
549
|
-
|
|
557
|
+
var tagData = tagDirective.data;
|
|
558
|
+
if (typeof tagKey === 'string' && dirTag === tagKey && tagData) {
|
|
559
|
+
ret = tagData.attrs ? this.getCamelCaseProps(tagData.attrs) : this.getCamelCaseProps(tagData);
|
|
550
560
|
}
|
|
551
561
|
else if (typeof tagKey === 'object') {
|
|
552
562
|
if (tagDirective.componentOptions.children && (Object.keys(tagKey).indexOf(dirTag) !== -1)) {
|
|
@@ -555,15 +565,18 @@ var ComponentBase = vueDefineComponent({
|
|
|
555
565
|
else if (tagDirective.children && (Object.keys(tagKey).indexOf(dirTag) !== -1) && (dirTag === 'e-markersettings' || dirTag === 'e-markersetting')) {
|
|
556
566
|
ret = this.getMultiLevelDirValue(tagDirective.children, tagKey["" + dirTag], tagNameMapper);
|
|
557
567
|
}
|
|
558
|
-
if (
|
|
559
|
-
ret = extend(ret, this.getCamelCaseProps(
|
|
568
|
+
if (tagData && tagData.attrs) {
|
|
569
|
+
ret = extend(ret, this.getCamelCaseProps(tagData.attrs));
|
|
560
570
|
}
|
|
561
571
|
}
|
|
562
572
|
}
|
|
563
573
|
return ret;
|
|
564
574
|
},
|
|
565
575
|
/**
|
|
566
|
-
* convert kebab case directive props to camel case
|
|
576
|
+
* convert kebab case directive props to camel case.
|
|
577
|
+
*
|
|
578
|
+
* @param {Object} props - Objects in kebab case directive props.
|
|
579
|
+
* @returns {Object} Object converted into camel case directive props.
|
|
567
580
|
*/
|
|
568
581
|
getCamelCaseProps: function (props) {
|
|
569
582
|
var retProps = {};
|
|
@@ -581,13 +594,20 @@ var ComponentBase = vueDefineComponent({
|
|
|
581
594
|
},
|
|
582
595
|
getTagName: function (options) {
|
|
583
596
|
var tag = options.tag;
|
|
584
|
-
|
|
597
|
+
var optCtor = options.Ctor;
|
|
598
|
+
if (!tag && optCtor && optCtor.extendOptions && optCtor.extendOptions.methods && optCtor.extendOptions.methods.getTag) {
|
|
585
599
|
tag = options.Ctor.extendOptions.methods.getTag();
|
|
586
600
|
}
|
|
587
601
|
return tag;
|
|
588
602
|
}
|
|
589
603
|
}
|
|
590
604
|
});
|
|
605
|
+
/**
|
|
606
|
+
* Collect public property values for the Vue component.
|
|
607
|
+
*
|
|
608
|
+
* @param {any} options - represents props object.
|
|
609
|
+
* @returns {any} array of props object and `watchobject` respectively.
|
|
610
|
+
*/
|
|
591
611
|
function getProps(options) {
|
|
592
612
|
if (options === void 0) { options = {}; }
|
|
593
613
|
if (options.props) {
|
|
@@ -607,8 +627,9 @@ function getProps(options) {
|
|
|
607
627
|
}
|
|
608
628
|
return [options.newprops, options.watch];
|
|
609
629
|
}
|
|
610
|
-
if (!isExecute)
|
|
630
|
+
if (!isExecute) {
|
|
611
631
|
setProxyToRaw(aVue.toRaw);
|
|
632
|
+
}
|
|
612
633
|
|
|
613
634
|
var __assign = (undefined && undefined.__assign) || function () {
|
|
614
635
|
__assign = Object.assign || function(t) {
|
|
@@ -621,25 +642,30 @@ var __assign = (undefined && undefined.__assign) || function () {
|
|
|
621
642
|
};
|
|
622
643
|
return __assign.apply(this, arguments);
|
|
623
644
|
};
|
|
624
|
-
// tslint:disable:no-any
|
|
625
645
|
var stringCompiler = getTemplateEngine();
|
|
646
|
+
/**
|
|
647
|
+
* Compiler function that convert the template property to DOM element.
|
|
648
|
+
*
|
|
649
|
+
* @param {any} templateElement - represents value of the template property from the component.
|
|
650
|
+
* @param {Object} helper - represents helper object to utilize on template compilation.
|
|
651
|
+
* @returns {NodeList} template element that append to the component.
|
|
652
|
+
*/
|
|
626
653
|
function compile(templateElement, helper) {
|
|
627
|
-
var
|
|
654
|
+
var _this = this;
|
|
628
655
|
return function (data, context, propName, element, root) {
|
|
629
|
-
var _a, _b, _c, _d;
|
|
630
656
|
var returnEle;
|
|
631
657
|
if (context) {
|
|
632
658
|
var plugins = context.vueInstance && context.vueInstance.plugins ? { plugins: context.vueInstance.plugins } : {};
|
|
633
659
|
var vueInstance = context.vueInstance ? context.vueInstance :
|
|
634
660
|
((root && root.vueInstance) ? root.vueInstance : null);
|
|
635
|
-
var pid = getUniqueID(
|
|
636
|
-
var id = getUniqueID(
|
|
637
|
-
var ele = createElement(
|
|
661
|
+
var pid = getUniqueID('templateParentDiv');
|
|
662
|
+
var id = getUniqueID('templateDiv');
|
|
663
|
+
var ele = createElement('div', {
|
|
638
664
|
id: pid,
|
|
639
|
-
innerHTML: '<div id="' + id + '"></div>'
|
|
665
|
+
innerHTML: '<div id="' + id + '"></div>'
|
|
640
666
|
});
|
|
641
667
|
document.body.appendChild(ele);
|
|
642
|
-
if (!isExecute && (typeof templateElement ===
|
|
668
|
+
if (!isExecute && (typeof templateElement === 'string' || (templateElement.prototype && templateElement.prototype.CSPTemplate && typeof templateElement === 'function'))) {
|
|
643
669
|
var vueSlot_1 = getCurrentVueSlot(context.vueInstance, templateElement, root);
|
|
644
670
|
if (vueSlot_1) {
|
|
645
671
|
// Compilation for Vue 3 slot template
|
|
@@ -652,13 +678,20 @@ function compile(templateElement, helper) {
|
|
|
652
678
|
// Get values for Vue 3 slot template
|
|
653
679
|
getValues(app, context.vueInstance, root);
|
|
654
680
|
aVue.render(app, ele);
|
|
681
|
+
returnEle = ele.childNodes;
|
|
655
682
|
if (vueInstance) {
|
|
656
|
-
|
|
657
|
-
|
|
683
|
+
var templateInstance = vueInstance.templateCollection;
|
|
684
|
+
if (!templateInstance) {
|
|
685
|
+
vueInstance.templateCollection = {};
|
|
686
|
+
templateInstance = vueInstance.templateCollection;
|
|
687
|
+
}
|
|
688
|
+
if (propName) {
|
|
689
|
+
if (!templateInstance["" + propName]) {
|
|
690
|
+
templateInstance["" + propName] = [];
|
|
691
|
+
}
|
|
692
|
+
templateInstance["" + propName].push(ele);
|
|
658
693
|
}
|
|
659
|
-
(_a = vueInstance.portals).push.apply(_a, [].slice.call(ele.children));
|
|
660
694
|
}
|
|
661
|
-
returnEle = ele.childNodes;
|
|
662
695
|
detach(ele);
|
|
663
696
|
}
|
|
664
697
|
else {
|
|
@@ -669,12 +702,12 @@ function compile(templateElement, helper) {
|
|
|
669
702
|
}
|
|
670
703
|
else if (!isExecute) {
|
|
671
704
|
// Compilation for Vue 3 functional template
|
|
672
|
-
var tempObj = templateElement.call(
|
|
705
|
+
var tempObj = templateElement.call(_this, {});
|
|
673
706
|
var object = tempObj;
|
|
674
|
-
var propsData = getValue(
|
|
707
|
+
var propsData = getValue('template.propsData', tempObj);
|
|
675
708
|
var dataObj_1 = {
|
|
676
709
|
data: { data: extend(tempObj.data || {}, data) },
|
|
677
|
-
parent: context.vueInstance
|
|
710
|
+
parent: context.vueInstance
|
|
678
711
|
};
|
|
679
712
|
if (!object.template) {
|
|
680
713
|
object.template = object[Object.keys(object)[0]];
|
|
@@ -711,9 +744,12 @@ function compile(templateElement, helper) {
|
|
|
711
744
|
var _loop_1 = function (objstring) {
|
|
712
745
|
var intComponent = templateCompRef.components["" + objstring];
|
|
713
746
|
if (intComponent && intComponent.data) {
|
|
714
|
-
if (!intComponent.__data)
|
|
747
|
+
if (!intComponent.__data) {
|
|
715
748
|
intComponent.__data = intComponent.data;
|
|
716
|
-
|
|
749
|
+
}
|
|
750
|
+
intComponent.data = function (proxy) {
|
|
751
|
+
return Object.assign(intComponent.__data.call(proxy), dataObj_1.data);
|
|
752
|
+
};
|
|
717
753
|
}
|
|
718
754
|
};
|
|
719
755
|
for (var _i = 0, objkeys_1 = objkeys; _i < objkeys_1.length; _i++) {
|
|
@@ -731,41 +767,38 @@ function compile(templateElement, helper) {
|
|
|
731
767
|
// Get values for Vue 3 functional template
|
|
732
768
|
getValues(app, context.vueInstance, root);
|
|
733
769
|
aVue.render(app, ele);
|
|
734
|
-
if (vueInstance) {
|
|
735
|
-
if (!vueInstance['portals']) {
|
|
736
|
-
vueInstance['portals'] = [];
|
|
737
|
-
}
|
|
738
|
-
(_b = vueInstance.portals).push.apply(_b, [].slice.call(ele.children));
|
|
739
|
-
}
|
|
740
770
|
returnEle = ele.childNodes;
|
|
741
|
-
|
|
742
|
-
|
|
771
|
+
dataObj_1.parent = null;
|
|
772
|
+
if (vueInstance) {
|
|
773
|
+
var templateInstance = vueInstance.templateCollection;
|
|
743
774
|
if (!templateInstance) {
|
|
744
|
-
|
|
745
|
-
templateInstance =
|
|
775
|
+
vueInstance.templateCollection = {};
|
|
776
|
+
templateInstance = vueInstance.templateCollection;
|
|
746
777
|
}
|
|
747
778
|
if (propName) {
|
|
748
779
|
if (!templateInstance["" + propName]) {
|
|
749
780
|
templateInstance["" + propName] = [];
|
|
750
781
|
}
|
|
751
|
-
templateInstance["" + propName].push(
|
|
782
|
+
templateInstance["" + propName].push(ele);
|
|
752
783
|
}
|
|
753
784
|
}
|
|
754
785
|
detach(ele);
|
|
755
786
|
}
|
|
756
|
-
else if (typeof templateElement ===
|
|
787
|
+
else if (typeof templateElement === 'string' || (templateElement.prototype && templateElement.prototype.CSPTemplate && typeof templateElement === 'function')) {
|
|
757
788
|
var vueSlot_2 = getVueSlot(context.vueInstance, templateElement, root);
|
|
758
789
|
if (vueSlot_2) {
|
|
759
790
|
// Get provide values for Vue 2 slot template
|
|
760
791
|
var provided_1 = {};
|
|
761
792
|
var getProvideValues_1 = function (vueinstance) {
|
|
762
|
-
if (vueinstance['$parent'])
|
|
793
|
+
if (vueinstance['$parent']) {
|
|
763
794
|
getProvideValues_1(vueinstance.$parent);
|
|
795
|
+
}
|
|
764
796
|
if (vueinstance['_provided'] && Object.keys(vueinstance['_provided']).length > 0) {
|
|
765
797
|
provided_1 = __assign({}, provided_1, vueinstance._provided);
|
|
766
798
|
}
|
|
767
799
|
};
|
|
768
|
-
var vueInstance_1 = context.vueInstance ? context.vueInstance :
|
|
800
|
+
var vueInstance_1 = context.vueInstance ? context.vueInstance :
|
|
801
|
+
((root && root.vueInstance) ? root.vueInstance : null);
|
|
769
802
|
if (vueInstance_1) {
|
|
770
803
|
getProvideValues_1(vueInstance_1);
|
|
771
804
|
}
|
|
@@ -776,14 +809,21 @@ function compile(templateElement, helper) {
|
|
|
776
809
|
return vueSlot_2["" + templateElement]({ data: data });
|
|
777
810
|
}
|
|
778
811
|
});
|
|
779
|
-
vueTemplate.$mount(
|
|
812
|
+
vueTemplate.$mount('#' + id);
|
|
813
|
+
returnEle = ele.childNodes;
|
|
780
814
|
if (vueInstance_1) {
|
|
781
|
-
|
|
782
|
-
|
|
815
|
+
var templateInstance = vueInstance_1.templateCollection;
|
|
816
|
+
if (!templateInstance) {
|
|
817
|
+
vueInstance_1.templateCollection = {};
|
|
818
|
+
templateInstance = vueInstance_1.templateCollection;
|
|
819
|
+
}
|
|
820
|
+
if (propName) {
|
|
821
|
+
if (!templateInstance["" + propName]) {
|
|
822
|
+
templateInstance["" + propName] = [];
|
|
823
|
+
}
|
|
824
|
+
templateInstance["" + propName].push(returnEle[0]);
|
|
783
825
|
}
|
|
784
|
-
(_c = vueInstance_1.portals).push.apply(_c, [].slice.call(ele.children));
|
|
785
826
|
}
|
|
786
|
-
returnEle = ele.childNodes;
|
|
787
827
|
detach(ele);
|
|
788
828
|
}
|
|
789
829
|
else {
|
|
@@ -794,18 +834,18 @@ function compile(templateElement, helper) {
|
|
|
794
834
|
}
|
|
795
835
|
else {
|
|
796
836
|
// Compilation for Vue 2 functional template
|
|
797
|
-
var tempObj = templateElement.call(
|
|
837
|
+
var tempObj = templateElement.call(_this, {});
|
|
798
838
|
var templateFunction = tempObj.template;
|
|
799
|
-
var propsData = getValue(
|
|
839
|
+
var propsData = getValue('template.propsData', tempObj);
|
|
800
840
|
var dataObj = {
|
|
801
841
|
data: { data: extend(tempObj.data || {}, data) },
|
|
802
|
-
parent: context.vueInstance
|
|
842
|
+
parent: context.vueInstance
|
|
803
843
|
};
|
|
804
844
|
if (propsData) {
|
|
805
845
|
templateFunction = tempObj.template.extends;
|
|
806
846
|
dataObj.propsData = propsData;
|
|
807
847
|
}
|
|
808
|
-
if (typeof templateFunction !==
|
|
848
|
+
if (typeof templateFunction !== 'function') {
|
|
809
849
|
templateFunction = aVue.extend(templateFunction);
|
|
810
850
|
}
|
|
811
851
|
if (templateFunction.options.setup) {
|
|
@@ -814,19 +854,14 @@ function compile(templateElement, helper) {
|
|
|
814
854
|
var templateVue = new templateFunction(dataObj);
|
|
815
855
|
// let templateVue = new Vue(tempObj.template);
|
|
816
856
|
// templateVue.$data.data = extend(tempObj.data, data);
|
|
817
|
-
templateVue.$mount(
|
|
818
|
-
if (vueInstance) {
|
|
819
|
-
if (!vueInstance['portals']) {
|
|
820
|
-
vueInstance['portals'] = [];
|
|
821
|
-
}
|
|
822
|
-
(_d = vueInstance.portals).push.apply(_d, [].slice.call(ele.children));
|
|
823
|
-
}
|
|
857
|
+
templateVue.$mount('#' + id);
|
|
824
858
|
returnEle = ele.childNodes;
|
|
825
|
-
|
|
826
|
-
|
|
859
|
+
dataObj.parent = null;
|
|
860
|
+
if (vueInstance) {
|
|
861
|
+
var templateInstance = vueInstance.templateCollection;
|
|
827
862
|
if (!templateInstance) {
|
|
828
|
-
|
|
829
|
-
templateInstance =
|
|
863
|
+
vueInstance.templateCollection = {};
|
|
864
|
+
templateInstance = vueInstance.templateCollection;
|
|
830
865
|
}
|
|
831
866
|
if (propName) {
|
|
832
867
|
if (!templateInstance["" + propName]) {
|
|
@@ -842,6 +877,14 @@ function compile(templateElement, helper) {
|
|
|
842
877
|
};
|
|
843
878
|
}
|
|
844
879
|
setTemplateEngine({ compile: compile });
|
|
880
|
+
/**
|
|
881
|
+
* Collect values from the app instance.
|
|
882
|
+
*
|
|
883
|
+
* @param {any} app - represents global application instance
|
|
884
|
+
* @param {any} cInstance - represents Vue component instance
|
|
885
|
+
* @param {any} root - represents parent component instance
|
|
886
|
+
* @returns {void}
|
|
887
|
+
*/
|
|
845
888
|
function getValues(app, cInstance, root) {
|
|
846
889
|
var vueInstance = cInstance ? cInstance : ((root && root.vueInstance) ? root.vueInstance : null);
|
|
847
890
|
if (!vueInstance) {
|
|
@@ -852,8 +895,9 @@ function getValues(app, cInstance, root) {
|
|
|
852
895
|
// Get provide value from child component.
|
|
853
896
|
var provided = {};
|
|
854
897
|
var getProvideValue = function (vueinstance) {
|
|
855
|
-
if (vueinstance['$'] && vueinstance['$']['parent'])
|
|
898
|
+
if (vueinstance['$'] && vueinstance['$']['parent']) {
|
|
856
899
|
getProvideValue(vueinstance.$.parent);
|
|
900
|
+
}
|
|
857
901
|
if (vueinstance['provides'] && Object.keys(vueinstance['provides']).length > 0) {
|
|
858
902
|
provided = __assign({}, provided, vueinstance.provides);
|
|
859
903
|
}
|
|
@@ -863,7 +907,14 @@ function getValues(app, cInstance, root) {
|
|
|
863
907
|
app.appContext.provides = __assign({}, app.appContext.provides, provided);
|
|
864
908
|
}
|
|
865
909
|
}
|
|
866
|
-
|
|
910
|
+
/**
|
|
911
|
+
* Get the Vue2 slot template from the root or current Vue component.
|
|
912
|
+
*
|
|
913
|
+
* @param {any} vueInstance - represents parent Vue instance.
|
|
914
|
+
* @param {any} templateElement - represents component property value
|
|
915
|
+
* @param {any} root - represents root Vue instance
|
|
916
|
+
* @returns {any} template Vue instance
|
|
917
|
+
*/
|
|
867
918
|
function getVueSlot(vueInstance, templateElement, root) {
|
|
868
919
|
if (!vueInstance && !(root && root.vueInstance)) {
|
|
869
920
|
return undefined;
|
|
@@ -871,6 +922,13 @@ function getVueSlot(vueInstance, templateElement, root) {
|
|
|
871
922
|
var instance = (root && root.vueInstance) ? root.vueInstance : vueInstance;
|
|
872
923
|
return getVueChildSlot(instance, templateElement);
|
|
873
924
|
}
|
|
925
|
+
/**
|
|
926
|
+
* Get the Vue2 nested slot template from the root or current Vue component.
|
|
927
|
+
*
|
|
928
|
+
* @param {any} vueInstance - represents parent Vue instance.
|
|
929
|
+
* @param {any} templateElement - represents component property value
|
|
930
|
+
* @returns {any} nested template Vue instance
|
|
931
|
+
*/
|
|
874
932
|
function getVueChildSlot(vueInstance, templateElement) {
|
|
875
933
|
if (!vueInstance) {
|
|
876
934
|
return undefined;
|
|
@@ -904,12 +962,25 @@ function getVueChildSlot(vueInstance, templateElement) {
|
|
|
904
962
|
}
|
|
905
963
|
return undefined;
|
|
906
964
|
}
|
|
965
|
+
/**
|
|
966
|
+
* Collect the component slot directive instance.
|
|
967
|
+
*
|
|
968
|
+
* @param {any} vnode - represents Vue components slot instance.
|
|
969
|
+
* @returns {any} the slot instance of the directive.
|
|
970
|
+
*/
|
|
907
971
|
function getSlot(vnode) {
|
|
908
972
|
var slot = (vnode.componentOptions && vnode.componentOptions.children) ? vnode.componentOptions :
|
|
909
973
|
(!vnode.data && (vnode.tag === 'e-markersettings' || vnode.tag === 'e-markersetting')) ? vnode : vnode.data;
|
|
910
974
|
return vnode.componentInstance ? vnode.componentInstance : slot;
|
|
911
975
|
}
|
|
912
|
-
|
|
976
|
+
/**
|
|
977
|
+
* Get the Vue3 slot template from the root or current Vue component.
|
|
978
|
+
*
|
|
979
|
+
* @param {any} vueInstance - represents parent Vue instance.
|
|
980
|
+
* @param {any} templateElement - represents component property value
|
|
981
|
+
* @param {any} root - represents root Vue instance
|
|
982
|
+
* @returns {any} slot template instance
|
|
983
|
+
*/
|
|
913
984
|
function getCurrentVueSlot(vueInstance, templateElement, root) {
|
|
914
985
|
if (!vueInstance && !(root && root.vueInstance)) {
|
|
915
986
|
return undefined;
|
|
@@ -917,6 +988,13 @@ function getCurrentVueSlot(vueInstance, templateElement, root) {
|
|
|
917
988
|
var slots = (root && root.vueInstance) ? root.vueInstance.$slots : vueInstance.$slots;
|
|
918
989
|
return getChildVueSlot(slots, templateElement);
|
|
919
990
|
}
|
|
991
|
+
/**
|
|
992
|
+
* Get the Vue3 nested slot template from the root or current Vue component.
|
|
993
|
+
*
|
|
994
|
+
* @param {any} slots - represents slot instance.
|
|
995
|
+
* @param {any} templateElement - represents component property value
|
|
996
|
+
* @returns {any} nested template Vue instance
|
|
997
|
+
*/
|
|
920
998
|
function getChildVueSlot(slots, templateElement) {
|
|
921
999
|
if (slots && slots["" + templateElement]) {
|
|
922
1000
|
return slots;
|
|
@@ -934,9 +1012,5 @@ function getChildVueSlot(slots, templateElement) {
|
|
|
934
1012
|
return undefined;
|
|
935
1013
|
}
|
|
936
1014
|
|
|
937
|
-
|
|
938
|
-
* index for component base
|
|
939
|
-
*/
|
|
940
|
-
|
|
941
|
-
export { isExecute, aVue, gh, vueDefineComponent, ComponentBase, getProps, compile };
|
|
1015
|
+
export { ComponentBase, aVue, compile, getProps, gh, isExecute, vueDefineComponent };
|
|
942
1016
|
//# sourceMappingURL=ej2-vue-base.es5.js.map
|