@syncfusion/ej2-vue-base 25.2.3 → 26.1.35-7502

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.
@@ -1,8 +1,15 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1
2
  /**
2
3
  * Vue Component Base
3
4
  */
4
5
  import * as Vue from 'vue';
5
6
  import { isNullOrUndefined, extend, getValue, setProxyToRaw } from '@syncfusion/ej2-base';
7
+ /**
8
+ * Clone the Vue compiler instance.
9
+ *
10
+ * @param {any} obj - representes the Vue compiler.
11
+ * @returns {any} cloned object of Vue compiler.
12
+ */
6
13
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) {
7
14
  return obj;
8
15
  }
@@ -10,15 +17,18 @@ else {
10
17
  var newObj = {};
11
18
  if (obj != null) {
12
19
  for (var key in obj) {
13
- if (Object.prototype.hasOwnProperty.call(obj, key))
20
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
14
21
  newObj["" + key] = obj["" + key];
22
+ }
15
23
  }
16
24
  }
17
25
  newObj.default = obj;
18
26
  return newObj;
19
27
  } }
20
28
  var curVue = _interopRequireWildcard(Vue);
21
- export var isExecute = (parseInt(curVue['version']) > 2) ? false : true, aVue = !isExecute ? curVue : (curVue['default']['default'] ? curVue['default']['default'] : curVue['default']), gh = curVue['h'];
29
+ export var isExecute = (parseInt(curVue['version'], 10) > 2) ? false : true;
30
+ export var aVue = !isExecute ? curVue : (curVue['default']['default'] ? curVue['default']['default'] : curVue['default']);
31
+ export var gh = curVue['h'];
22
32
  export var vueDefineComponent = function (options) { return !isExecute ? aVue['defineComponent'](options) : aVue['extend'](options); };
23
33
  export var ComponentBase = vueDefineComponent({
24
34
  name: 'ComponentBase',
@@ -77,10 +87,13 @@ export var ComponentBase = vueDefineComponent({
77
87
  }
78
88
  },
79
89
  mounted: function () {
80
- var cusEle = this.$el ? this.$el.querySelectorAll("div.e-directive") : null;
90
+ var cusEle = this.$el ? this.$el.querySelectorAll('div.e-directive') : null;
81
91
  if (!isExecute && cusEle) {
82
92
  for (var i = 0; i < cusEle.length; i++) {
83
- cusEle[parseInt(i.toString(), 10)].parentElement && cusEle[parseInt(i.toString(), 10)].parentElement.removeChild(cusEle[parseInt(i.toString(), 10)]);
93
+ var cusElement = cusEle[parseInt(i.toString(), 10)];
94
+ if (cusElement.parentElement) {
95
+ cusElement.parentElement.removeChild(cusElement);
96
+ }
84
97
  }
85
98
  }
86
99
  this.ej2Instances.isVue = true;
@@ -142,12 +155,11 @@ export var ComponentBase = vueDefineComponent({
142
155
  provide = getValue('$.parent.provides', this);
143
156
  }
144
157
  if (provide) {
145
- // tslint:disable:no-any
146
158
  var injectables = provide;
147
159
  if (typeof provide === 'function') {
148
160
  if (provide.managed) {
149
- var provideKey = provide.managed;
150
- var provideValue = Object.keys(provideKey);
161
+ var pKey = provide.managed;
162
+ var pValue = Object.keys(pKey);
151
163
  var key = void 0;
152
164
  if (this.$root && this.isDecorator) {
153
165
  key = Object.keys(this.$root);
@@ -158,24 +170,23 @@ export var ComponentBase = vueDefineComponent({
158
170
  else if (this.$parent) {
159
171
  key = Object.keys(this.$parent);
160
172
  }
161
- for (var i = 0; i < provideValue.length; i++) {
173
+ for (var i = 0; i < pValue.length; i++) {
162
174
  for (var j = 0; j < key.length; j++) {
163
- if ((key[parseInt(j.toString(), 10)].indexOf(provideValue[parseInt(i.toString(), 10)])) !== -1) {
175
+ if ((key[parseInt(j.toString(), 10)].indexOf(pValue[parseInt(i.toString(), 10)])) !== -1) {
164
176
  if (this.$root && this.isDecorator) {
165
- provideKey[provideValue[parseInt(j.toString(), 10)]] = this.$root[key[parseInt(i.toString(), 10)]];
177
+ pKey[pValue[parseInt(j.toString(), 10)]] = this.$root[key[parseInt(i.toString(), 10)]];
166
178
  }
167
179
  else if (this.$vnode) {
168
- provideKey[provideValue[parseInt(i.toString(), 10)]] = this.$vnode.context[key[parseInt(j.toString(), 10)]];
180
+ pKey[pValue[parseInt(i.toString(), 10)]] = this.$vnode.context[key[parseInt(j.toString(), 10)]];
169
181
  }
170
182
  else if (this.$parent) {
171
- provideKey[provideValue[parseInt(i.toString(), 10)]] = this.$parent[key[parseInt(j.toString(), 10)]];
183
+ pKey[pValue[parseInt(i.toString(), 10)]] = this.$parent[key[parseInt(j.toString(), 10)]];
172
184
  }
173
- injectables = provideKey;
185
+ injectables = pKey;
174
186
  }
175
187
  }
176
188
  }
177
189
  }
178
- // tslint:disable:no-any
179
190
  else if (this.$vnode) {
180
191
  injectables = this.$vnode.context.$options.provide();
181
192
  }
@@ -189,10 +200,25 @@ export var ComponentBase = vueDefineComponent({
189
200
  return ret;
190
201
  },
191
202
  destroyComponent: function () {
192
- var tempBeforeDestroyThis = this;
193
- tempBeforeDestroyThis.ej2Instances.destroy();
194
- tempBeforeDestroyThis.$el.style.visibility = 'hidden';
195
- tempBeforeDestroyThis = null;
203
+ this.ej2Instances.destroy();
204
+ this.$el.style.visibility = 'hidden';
205
+ this.destroyPortals();
206
+ },
207
+ destroyPortals: function () {
208
+ if (this.portals) {
209
+ for (var _i = 0, _a = this.portals; _i < _a.length; _i++) {
210
+ var portal = _a[_i];
211
+ var controls = portal.classList.contains('e-control') ? [portal] : portal.getElementsByClassName('e-control');
212
+ for (var index = 0; index < controls.length; index++) {
213
+ var control = controls[parseInt(index.toString(), 10)];
214
+ if (control.ej2_instances && control.ej2_instances[0]) {
215
+ control.ej2_instances[0].destroy();
216
+ index--;
217
+ }
218
+ }
219
+ }
220
+ this.portals = null;
221
+ }
196
222
  },
197
223
  bindProperties: function () {
198
224
  var options = {};
@@ -241,21 +267,21 @@ export var ComponentBase = vueDefineComponent({
241
267
  for (var i = 0; i < propRef.length; i++) {
242
268
  if (propRef[parseInt(i.toString(), 10)].type.methods || propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection') {
243
269
  var key = propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection' ? 'series-collection' :
244
- propRef[parseInt(i.toString(), 10)].type.methods.getTag().replace("e-", "");
270
+ propRef[parseInt(i.toString(), 10)].type.methods.getTag().replace('e-', '');
245
271
  var ref = this.resolveArrayDirectives(propRef[parseInt(i.toString(), 10)].children, key);
246
- var splitKeys = key.split('-');
272
+ var spKeys = key.split('-');
247
273
  var controlName = this.ej2Instances.getModuleName().toLowerCase();
248
- var keyRef = (splitKeys.length > 1 && controlName.indexOf(splitKeys[0]) > -1) ? splitKeys[1] : splitKeys[0];
274
+ var keyRef = (spKeys.length > 1 && controlName.indexOf(spKeys[0]) > -1) ? spKeys[1] : spKeys[0];
249
275
  keyRef = keyRef.replace(controlName, '');
250
276
  keyRef = this.tagNameMapper['e-' + key] ? this.tagNameMapper['e-' + key].replace('e-', '') : keyRef;
251
- if (controlName == "splitter" && keyRef == "panes") {
252
- keyRef = "paneSettings";
277
+ if (controlName === 'splitter' && keyRef === 'panes') {
278
+ keyRef = 'paneSettings';
253
279
  }
254
- else if (controlName == "bulletchart" && keyRef == "range") {
255
- keyRef = "ranges";
280
+ else if (controlName === 'bulletchart' && keyRef === 'range') {
281
+ keyRef = 'ranges';
256
282
  }
257
- else if (controlName == "schedule" && keyRef == "header") {
258
- keyRef = "headerRows";
283
+ else if (controlName === 'schedule' && keyRef === 'header') {
284
+ keyRef = 'headerRows';
259
285
  }
260
286
  dirProps["" + keyRef] = ref["" + key];
261
287
  }
@@ -285,7 +311,7 @@ export var ComponentBase = vueDefineComponent({
285
311
  var tagRef = childSlot.type.methods ? childSlot.type.methods.getTag() : tagName;
286
312
  if (childSlot.children) {
287
313
  var key = void 0;
288
- innerDirValues = this_2.resolveComplexDirs(childSlot.children, this_2.tagMapper["e-" + tagName], tagRef);
314
+ innerDirValues = this_2.resolveComplexDirs(childSlot.children, this_2.tagMapper['e-' + tagName], tagRef);
289
315
  if (innerDirValues.length) {
290
316
  tempObj = innerDirValues;
291
317
  }
@@ -305,7 +331,12 @@ export var ComponentBase = vueDefineComponent({
305
331
  });
306
332
  }
307
333
  if (((/[s]\b/).test(tagRef) && innerDirValues) && (!(/[s]\b/).test(tagName) || innerDirValues.length)) {
308
- Array.isArray(tempObj) ? tempObj.forEach(function (item) { items["" + tagName].push(item); }) : items["" + tagName].push(tempObj);
334
+ if (Array.isArray(tempObj)) {
335
+ tempObj.forEach(function (item) { items["" + tagName].push(item); });
336
+ }
337
+ else {
338
+ items["" + tagName].push(tempObj);
339
+ }
309
340
  }
310
341
  else if (tempObj && Object.keys(tempObj).length !== 0) {
311
342
  items["" + tagName].push(tempObj);
@@ -330,12 +361,11 @@ export var ComponentBase = vueDefineComponent({
330
361
  tagRef = Object.keys(tagObject["" + tagName]);
331
362
  tag = tagRef.find(function (key) {
332
363
  return tagObject["" + tagName]["" + key] ===
333
- childSlot.type.methods.getTag().replace(/[s]\b/, "");
364
+ childSlot.type.methods.getTag().replace(/[s]\b/, '');
334
365
  });
335
- var moduleName = this_3.ej2Instances.getModuleName().toLowerCase();
336
366
  tag = tag ? tag : childSlot.type.methods.getTag();
337
- tag = (this_3.tagNameMapper["" + tag] ? this_3.tagNameMapper["" + tag] : tag).replace("e-", "");
338
- if (this_3.ej2Instances.getModuleName().toLowerCase() == "diagram" && tag.indexOf('annotations') != -1) {
367
+ tag = (this_3.tagNameMapper["" + tag] ? this_3.tagNameMapper["" + tag] : tag).replace('e-', '');
368
+ if (this_3.ej2Instances.getModuleName().toLowerCase() === 'diagram' && tag.indexOf('annotations') !== -1) {
339
369
  tag = 'annotations';
340
370
  }
341
371
  }
@@ -355,7 +385,7 @@ export var ComponentBase = vueDefineComponent({
355
385
  childSlot.props = this_3.getCamelCaseProps(childSlot.props);
356
386
  }
357
387
  if (slot.length > 1) {
358
- items = Object.keys(items).length == 0 && !items.length ? [] : items;
388
+ items = Object.keys(items).length === 0 && !items.length ? [] : items;
359
389
  if (childSlot.props) {
360
390
  items.push(childSlot.props);
361
391
  }
@@ -379,7 +409,7 @@ export var ComponentBase = vueDefineComponent({
379
409
  var childSlot = slot_3[_i];
380
410
  var innerDirValues = null;
381
411
  var tag = childSlot.type.methods.getTag();
382
- tag = (this.tagNameMapper[tag] ? this.tagNameMapper[tag] : tag).replace("e-", "");
412
+ tag = (this.tagNameMapper["" + tag] ? this.tagNameMapper["" + tag] : tag).replace('e-', '');
383
413
  if (childSlot.children) {
384
414
  innerDirValues = this.resolveMultilevelComplexInnerDirs(childSlot.children, tagObject["" + tagName], childSlot.type.methods.getTag());
385
415
  if ((/[s]\b/).test(tag) || slot.length > 1) {
@@ -428,9 +458,8 @@ export var ComponentBase = vueDefineComponent({
428
458
  for (var _i = 0, slot_4 = slot; _i < slot_4.length; _i++) {
429
459
  var childSlot = slot_4[_i];
430
460
  var innerDirValues = null;
431
- var moduleName = this.ej2Instances.getModuleName().toLowerCase();
432
461
  var tag = childSlot.type.methods.getTag();
433
- tag = (this.tagNameMapper[tag] ? this.tagNameMapper[tag] : tag).replace("e-", "");
462
+ tag = (this.tagNameMapper["" + tag] ? this.tagNameMapper["" + tag] : tag).replace('e-', '');
434
463
  if (childSlot.children) {
435
464
  innerDirValues = this.resolveComplexInnerDirs(childSlot.children, tagObject["" + tagName], childSlot.type.methods.getTag());
436
465
  }
@@ -462,14 +491,15 @@ export var ComponentBase = vueDefineComponent({
462
491
  if (tagDirectives) {
463
492
  for (var _i = 0, tagDirectives_1 = tagDirectives; _i < tagDirectives_1.length; _i++) {
464
493
  var tagDirective = tagDirectives_1[_i];
465
- if (tagDirective.componentOptions && tagDirective.componentOptions.children && this.getTagName(tagDirective.componentOptions) ||
494
+ var tagCompOption = tagDirective.componentOptions;
495
+ if (tagCompOption && tagCompOption.children && this.getTagName(tagCompOption) ||
466
496
  (tagDirective.tag === 'e-seriescollection' && tagDirective.children)) {
467
- var dirTag = tagDirective.componentOptions ? this.getTagName(tagDirective.componentOptions) : tagDirective.tag;
497
+ var dirTag = tagCompOption ? this.getTagName(tagCompOption) : tagDirective.tag;
468
498
  dirTag = (dirTag === 'e-seriescollection') ? 'e-seriesCollection' : dirTag;
469
499
  if (keyTags.indexOf(dirTag) !== -1) {
470
500
  var tagName = tagNameMapper["" + dirTag] ? tagNameMapper["" + dirTag] : dirTag;
471
501
  dir[tagName.replace('e-', '')] = [];
472
- var children = tagDirective.componentOptions ? tagDirective.componentOptions.children : tagDirective.children;
502
+ var children = tagCompOption ? tagCompOption.children : tagDirective.children;
473
503
  for (var _a = 0, children_1 = children; _a < children_1.length; _a++) {
474
504
  var tagDirChild = children_1[_a];
475
505
  var retObj = this.getVNodeValue(tagDirChild, tagMapper["" + dirTag], tagNameMapper);
@@ -525,8 +555,9 @@ export var ComponentBase = vueDefineComponent({
525
555
  else {
526
556
  dirTag = (tagDirective.tag === 'e-markersettings') ? 'e-markerSettings' : 'e-markerSetting';
527
557
  }
528
- if (typeof tagKey === 'string' && dirTag === tagKey && tagDirective.data) {
529
- ret = tagDirective.data.attrs ? this.getCamelCaseProps(tagDirective.data.attrs) : this.getCamelCaseProps(tagDirective.data);
558
+ var tagData = tagDirective.data;
559
+ if (typeof tagKey === 'string' && dirTag === tagKey && tagData) {
560
+ ret = tagData.attrs ? this.getCamelCaseProps(tagData.attrs) : this.getCamelCaseProps(tagData);
530
561
  }
531
562
  else if (typeof tagKey === 'object') {
532
563
  if (tagDirective.componentOptions.children && (Object.keys(tagKey).indexOf(dirTag) !== -1)) {
@@ -535,15 +566,18 @@ export var ComponentBase = vueDefineComponent({
535
566
  else if (tagDirective.children && (Object.keys(tagKey).indexOf(dirTag) !== -1) && (dirTag === 'e-markersettings' || dirTag === 'e-markersetting')) {
536
567
  ret = this.getMultiLevelDirValue(tagDirective.children, tagKey["" + dirTag], tagNameMapper);
537
568
  }
538
- if (tagDirective.data && tagDirective.data.attrs) {
539
- ret = extend(ret, this.getCamelCaseProps(tagDirective.data.attrs));
569
+ if (tagData && tagData.attrs) {
570
+ ret = extend(ret, this.getCamelCaseProps(tagData.attrs));
540
571
  }
541
572
  }
542
573
  }
543
574
  return ret;
544
575
  },
545
576
  /**
546
- * convert kebab case directive props to camel case
577
+ * convert kebab case directive props to camel case.
578
+ *
579
+ * @param {Object} props - Objects in kebab case directive props.
580
+ * @returns {Object} Object converted into camel case directive props.
547
581
  */
548
582
  getCamelCaseProps: function (props) {
549
583
  var retProps = {};
@@ -561,13 +595,20 @@ export var ComponentBase = vueDefineComponent({
561
595
  },
562
596
  getTagName: function (options) {
563
597
  var tag = options.tag;
564
- if (!tag && options.Ctor && options.Ctor.extendOptions && options.Ctor.extendOptions.methods && options.Ctor.extendOptions.methods.getTag) {
598
+ var optCtor = options.Ctor;
599
+ if (!tag && optCtor && optCtor.extendOptions && optCtor.extendOptions.methods && optCtor.extendOptions.methods.getTag) {
565
600
  tag = options.Ctor.extendOptions.methods.getTag();
566
601
  }
567
602
  return tag;
568
603
  }
569
604
  }
570
605
  });
606
+ /**
607
+ * Collect public property values for the Vue component.
608
+ *
609
+ * @param {any} options - represents props object.
610
+ * @returns {any} array of props object and `watchobject` respectively.
611
+ */
571
612
  export function getProps(options) {
572
613
  if (options === void 0) { options = {}; }
573
614
  if (options.props) {
@@ -587,5 +628,6 @@ export function getProps(options) {
587
628
  }
588
629
  return [options.newprops, options.watch];
589
630
  }
590
- if (!isExecute)
631
+ if (!isExecute) {
591
632
  setProxyToRaw(aVue.toRaw);
633
+ }
package/src/template.d.ts CHANGED
@@ -1 +1,8 @@
1
+ /**
2
+ * Compiler function that convert the template property to DOM element.
3
+ *
4
+ * @param {any} templateElement - represents value of the template property from the component.
5
+ * @param {Object} helper - represents helper object to utilize on template compilation.
6
+ * @returns {NodeList} template element that append to the component.
7
+ */
1
8
  export declare function compile(templateElement: any, helper?: Object): (data: Object | JSON, component?: any, propName?: any, element?: any, root?: any) => Object;
package/src/template.js CHANGED
@@ -9,24 +9,34 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { setTemplateEngine, getTemplateEngine, getUniqueID, createElement, detach, extend, getValue } from "@syncfusion/ej2-base";
13
- import { aVue as Vue, isExecute } from "./component-base";
14
- // tslint:disable:no-any
12
+ /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types */
13
+ import { setTemplateEngine, getTemplateEngine, getUniqueID, createElement, detach, extend, getValue } from '@syncfusion/ej2-base';
14
+ import { aVue as Vue, isExecute } from './component-base';
15
15
  var stringCompiler = getTemplateEngine();
16
+ /**
17
+ * Compiler function that convert the template property to DOM element.
18
+ *
19
+ * @param {any} templateElement - represents value of the template property from the component.
20
+ * @param {Object} helper - represents helper object to utilize on template compilation.
21
+ * @returns {NodeList} template element that append to the component.
22
+ */
16
23
  export function compile(templateElement, helper) {
17
- var that = this;
24
+ var _this = this;
18
25
  return function (data, context, propName, element, root) {
26
+ var _a, _b, _c, _d;
19
27
  var returnEle;
20
28
  if (context) {
21
29
  var plugins = context.vueInstance && context.vueInstance.plugins ? { plugins: context.vueInstance.plugins } : {};
22
- var pid = getUniqueID("templateParentDiv");
23
- var id = getUniqueID("templateDiv");
24
- var ele = createElement("div", {
30
+ var vueInstance = context.vueInstance ? context.vueInstance :
31
+ ((root && root.vueInstance) ? root.vueInstance : null);
32
+ var pid = getUniqueID('templateParentDiv');
33
+ var id = getUniqueID('templateDiv');
34
+ var ele = createElement('div', {
25
35
  id: pid,
26
- innerHTML: '<div id="' + id + '"></div>',
36
+ innerHTML: '<div id="' + id + '"></div>'
27
37
  });
28
38
  document.body.appendChild(ele);
29
- if (!isExecute && (typeof templateElement === "string" || (templateElement.prototype && templateElement.prototype.CSPTemplate && typeof templateElement === 'function'))) {
39
+ if (!isExecute && (typeof templateElement === 'string' || (templateElement.prototype && templateElement.prototype.CSPTemplate && typeof templateElement === 'function'))) {
30
40
  var vueSlot_1 = getCurrentVueSlot(context.vueInstance, templateElement, root);
31
41
  if (vueSlot_1) {
32
42
  // Compilation for Vue 3 slot template
@@ -39,6 +49,12 @@ export function compile(templateElement, helper) {
39
49
  // Get values for Vue 3 slot template
40
50
  getValues(app, context.vueInstance, root);
41
51
  Vue.render(app, ele);
52
+ if (vueInstance) {
53
+ if (!vueInstance['portals']) {
54
+ vueInstance['portals'] = [];
55
+ }
56
+ (_a = vueInstance.portals).push.apply(_a, [].slice.call(ele.children));
57
+ }
42
58
  returnEle = ele.childNodes;
43
59
  detach(ele);
44
60
  }
@@ -50,12 +66,12 @@ export function compile(templateElement, helper) {
50
66
  }
51
67
  else if (!isExecute) {
52
68
  // Compilation for Vue 3 functional template
53
- var tempObj = templateElement.call(that, {});
69
+ var tempObj = templateElement.call(_this, {});
54
70
  var object = tempObj;
55
- var propsData = getValue("template.propsData", tempObj);
71
+ var propsData = getValue('template.propsData', tempObj);
56
72
  var dataObj_1 = {
57
73
  data: { data: extend(tempObj.data || {}, data) },
58
- parent: context.vueInstance,
74
+ parent: context.vueInstance
59
75
  };
60
76
  if (!object.template) {
61
77
  object.template = object[Object.keys(object)[0]];
@@ -92,9 +108,12 @@ export function compile(templateElement, helper) {
92
108
  var _loop_1 = function (objstring) {
93
109
  var intComponent = templateCompRef.components["" + objstring];
94
110
  if (intComponent && intComponent.data) {
95
- if (!intComponent.__data)
111
+ if (!intComponent.__data) {
96
112
  intComponent.__data = intComponent.data;
97
- intComponent.data = function (proxy) { return Object.assign(intComponent.__data.call(proxy), dataObj_1.data); };
113
+ }
114
+ intComponent.data = function (proxy) {
115
+ return Object.assign(intComponent.__data.call(proxy), dataObj_1.data);
116
+ };
98
117
  }
99
118
  };
100
119
  for (var _i = 0, objkeys_1 = objkeys; _i < objkeys_1.length; _i++) {
@@ -112,6 +131,12 @@ export function compile(templateElement, helper) {
112
131
  // Get values for Vue 3 functional template
113
132
  getValues(app, context.vueInstance, root);
114
133
  Vue.render(app, ele);
134
+ if (vueInstance) {
135
+ if (!vueInstance['portals']) {
136
+ vueInstance['portals'] = [];
137
+ }
138
+ (_b = vueInstance.portals).push.apply(_b, [].slice.call(ele.children));
139
+ }
115
140
  returnEle = ele.childNodes;
116
141
  if (context.vueInstance) {
117
142
  var templateInstance = context.vueInstance.templateCollection;
@@ -128,21 +153,23 @@ export function compile(templateElement, helper) {
128
153
  }
129
154
  detach(ele);
130
155
  }
131
- else if (typeof templateElement === "string" || (templateElement.prototype && templateElement.prototype.CSPTemplate && typeof templateElement === 'function')) {
156
+ else if (typeof templateElement === 'string' || (templateElement.prototype && templateElement.prototype.CSPTemplate && typeof templateElement === 'function')) {
132
157
  var vueSlot_2 = getVueSlot(context.vueInstance, templateElement, root);
133
158
  if (vueSlot_2) {
134
159
  // Get provide values for Vue 2 slot template
135
160
  var provided_1 = {};
136
161
  var getProvideValues_1 = function (vueinstance) {
137
- if (vueinstance['$parent'])
162
+ if (vueinstance['$parent']) {
138
163
  getProvideValues_1(vueinstance.$parent);
164
+ }
139
165
  if (vueinstance['_provided'] && Object.keys(vueinstance['_provided']).length > 0) {
140
166
  provided_1 = __assign({}, provided_1, vueinstance._provided);
141
167
  }
142
168
  };
143
- var vueInstance = context.vueInstance ? context.vueInstance : ((root && root.vueInstance) ? root.vueInstance : null);
144
- if (vueInstance) {
145
- getProvideValues_1(vueInstance);
169
+ var vueInstance_1 = context.vueInstance ? context.vueInstance :
170
+ ((root && root.vueInstance) ? root.vueInstance : null);
171
+ if (vueInstance_1) {
172
+ getProvideValues_1(vueInstance_1);
146
173
  }
147
174
  // Compilation for Vue 2 slot template
148
175
  var vueTemplate = new Vue({
@@ -151,7 +178,13 @@ export function compile(templateElement, helper) {
151
178
  return vueSlot_2["" + templateElement]({ data: data });
152
179
  }
153
180
  });
154
- vueTemplate.$mount("#" + id);
181
+ vueTemplate.$mount('#' + id);
182
+ if (vueInstance_1) {
183
+ if (!vueInstance_1['portals']) {
184
+ vueInstance_1['portals'] = [];
185
+ }
186
+ (_c = vueInstance_1.portals).push.apply(_c, [].slice.call(ele.children));
187
+ }
155
188
  returnEle = ele.childNodes;
156
189
  detach(ele);
157
190
  }
@@ -163,18 +196,18 @@ export function compile(templateElement, helper) {
163
196
  }
164
197
  else {
165
198
  // Compilation for Vue 2 functional template
166
- var tempObj = templateElement.call(that, {});
199
+ var tempObj = templateElement.call(_this, {});
167
200
  var templateFunction = tempObj.template;
168
- var propsData = getValue("template.propsData", tempObj);
201
+ var propsData = getValue('template.propsData', tempObj);
169
202
  var dataObj = {
170
203
  data: { data: extend(tempObj.data || {}, data) },
171
- parent: context.vueInstance,
204
+ parent: context.vueInstance
172
205
  };
173
206
  if (propsData) {
174
207
  templateFunction = tempObj.template.extends;
175
208
  dataObj.propsData = propsData;
176
209
  }
177
- if (typeof templateFunction !== "function") {
210
+ if (typeof templateFunction !== 'function') {
178
211
  templateFunction = Vue.extend(templateFunction);
179
212
  }
180
213
  if (templateFunction.options.setup) {
@@ -183,7 +216,13 @@ export function compile(templateElement, helper) {
183
216
  var templateVue = new templateFunction(dataObj);
184
217
  // let templateVue = new Vue(tempObj.template);
185
218
  // templateVue.$data.data = extend(tempObj.data, data);
186
- templateVue.$mount("#" + id);
219
+ templateVue.$mount('#' + id);
220
+ if (vueInstance) {
221
+ if (!vueInstance['portals']) {
222
+ vueInstance['portals'] = [];
223
+ }
224
+ (_d = vueInstance.portals).push.apply(_d, [].slice.call(ele.children));
225
+ }
187
226
  returnEle = ele.childNodes;
188
227
  if (context.vueInstance) {
189
228
  var templateInstance = context.vueInstance.templateCollection;
@@ -205,6 +244,14 @@ export function compile(templateElement, helper) {
205
244
  };
206
245
  }
207
246
  setTemplateEngine({ compile: compile });
247
+ /**
248
+ * Collect values from the app instance.
249
+ *
250
+ * @param {any} app - represents global application instance
251
+ * @param {any} cInstance - represents Vue component instance
252
+ * @param {any} root - represents parent component instance
253
+ * @returns {void}
254
+ */
208
255
  function getValues(app, cInstance, root) {
209
256
  var vueInstance = cInstance ? cInstance : ((root && root.vueInstance) ? root.vueInstance : null);
210
257
  if (!vueInstance) {
@@ -215,8 +262,9 @@ function getValues(app, cInstance, root) {
215
262
  // Get provide value from child component.
216
263
  var provided = {};
217
264
  var getProvideValue = function (vueinstance) {
218
- if (vueinstance['$'] && vueinstance['$']['parent'])
265
+ if (vueinstance['$'] && vueinstance['$']['parent']) {
219
266
  getProvideValue(vueinstance.$.parent);
267
+ }
220
268
  if (vueinstance['provides'] && Object.keys(vueinstance['provides']).length > 0) {
221
269
  provided = __assign({}, provided, vueinstance.provides);
222
270
  }
@@ -226,7 +274,14 @@ function getValues(app, cInstance, root) {
226
274
  app.appContext.provides = __assign({}, app.appContext.provides, provided);
227
275
  }
228
276
  }
229
- // Get the Vue2 slot template from the root or current Vue component.
277
+ /**
278
+ * Get the Vue2 slot template from the root or current Vue component.
279
+ *
280
+ * @param {any} vueInstance - represents parent Vue instance.
281
+ * @param {any} templateElement - represents component property value
282
+ * @param {any} root - represents root Vue instance
283
+ * @returns {any} template Vue instance
284
+ */
230
285
  function getVueSlot(vueInstance, templateElement, root) {
231
286
  if (!vueInstance && !(root && root.vueInstance)) {
232
287
  return undefined;
@@ -234,6 +289,13 @@ function getVueSlot(vueInstance, templateElement, root) {
234
289
  var instance = (root && root.vueInstance) ? root.vueInstance : vueInstance;
235
290
  return getVueChildSlot(instance, templateElement);
236
291
  }
292
+ /**
293
+ * Get the Vue2 nested slot template from the root or current Vue component.
294
+ *
295
+ * @param {any} vueInstance - represents parent Vue instance.
296
+ * @param {any} templateElement - represents component property value
297
+ * @returns {any} nested template Vue instance
298
+ */
237
299
  function getVueChildSlot(vueInstance, templateElement) {
238
300
  if (!vueInstance) {
239
301
  return undefined;
@@ -267,12 +329,25 @@ function getVueChildSlot(vueInstance, templateElement) {
267
329
  }
268
330
  return undefined;
269
331
  }
332
+ /**
333
+ * Collect the component slot directive instance.
334
+ *
335
+ * @param {any} vnode - represents Vue components slot instance.
336
+ * @returns {any} the slot instance of the directive.
337
+ */
270
338
  function getSlot(vnode) {
271
339
  var slot = (vnode.componentOptions && vnode.componentOptions.children) ? vnode.componentOptions :
272
340
  (!vnode.data && (vnode.tag === 'e-markersettings' || vnode.tag === 'e-markersetting')) ? vnode : vnode.data;
273
341
  return vnode.componentInstance ? vnode.componentInstance : slot;
274
342
  }
275
- // Get the Vue3 slot template from the root or current Vue component.
343
+ /**
344
+ * Get the Vue3 slot template from the root or current Vue component.
345
+ *
346
+ * @param {any} vueInstance - represents parent Vue instance.
347
+ * @param {any} templateElement - represents component property value
348
+ * @param {any} root - represents root Vue instance
349
+ * @returns {any} slot template instance
350
+ */
276
351
  function getCurrentVueSlot(vueInstance, templateElement, root) {
277
352
  if (!vueInstance && !(root && root.vueInstance)) {
278
353
  return undefined;
@@ -280,6 +355,13 @@ function getCurrentVueSlot(vueInstance, templateElement, root) {
280
355
  var slots = (root && root.vueInstance) ? root.vueInstance.$slots : vueInstance.$slots;
281
356
  return getChildVueSlot(slots, templateElement);
282
357
  }
358
+ /**
359
+ * Get the Vue3 nested slot template from the root or current Vue component.
360
+ *
361
+ * @param {any} slots - represents slot instance.
362
+ * @param {any} templateElement - represents component property value
363
+ * @returns {any} nested template Vue instance
364
+ */
283
365
  function getChildVueSlot(slots, templateElement) {
284
366
  if (slots && slots["" + templateElement]) {
285
367
  return slots;