@syncfusion/ej2-vue-base 25.2.4 → 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 +214 -144
- package/dist/es6/ej2-vue-base.es2015.js.map +1 -1
- package/dist/es6/ej2-vue-base.es5.js +149 -79
- 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 +26 -9
- package/src/component-base.d.ts +12 -4
- package/src/component-base.js +73 -48
- package/src/template.d.ts +7 -0
- package/src/template.js +81 -26
- 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,11 +191,9 @@ 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.destroyPortals();
|
|
193
197
|
},
|
|
194
198
|
destroyPortals() {
|
|
195
199
|
if (this.portals) {
|
|
@@ -207,8 +211,8 @@ let ComponentBase = vueDefineComponent({
|
|
|
207
211
|
}
|
|
208
212
|
},
|
|
209
213
|
bindProperties() {
|
|
210
|
-
|
|
211
|
-
for (
|
|
214
|
+
const options = {};
|
|
215
|
+
for (const prop of this.propKeys) {
|
|
212
216
|
if (!isNullOrUndefined(this[`${prop}`])) {
|
|
213
217
|
options[`${prop}`] = this[`${prop}`];
|
|
214
218
|
}
|
|
@@ -220,9 +224,9 @@ let ComponentBase = vueDefineComponent({
|
|
|
220
224
|
this.fetchChildPropValues(options);
|
|
221
225
|
}
|
|
222
226
|
if (this.hasInjectedModules) {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
for (
|
|
227
|
+
const prevModule = this.getInjectedServices() || [];
|
|
228
|
+
const curModule = this.ej2Instances.getInjectedModules() || [];
|
|
229
|
+
for (const mod of curModule) {
|
|
226
230
|
if (prevModule.indexOf(mod) === -1) {
|
|
227
231
|
prevModule.push(mod);
|
|
228
232
|
}
|
|
@@ -250,22 +254,22 @@ let ComponentBase = vueDefineComponent({
|
|
|
250
254
|
if (propRef) {
|
|
251
255
|
for (let i = 0; i < propRef.length; i++) {
|
|
252
256
|
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 = (
|
|
257
|
+
const key = propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection' ? 'series-collection' :
|
|
258
|
+
propRef[parseInt(i.toString(), 10)].type.methods.getTag().replace('e-', '');
|
|
259
|
+
const ref = this.resolveArrayDirectives(propRef[parseInt(i.toString(), 10)].children, key);
|
|
260
|
+
const spKeys = key.split('-');
|
|
261
|
+
const controlName = this.ej2Instances.getModuleName().toLowerCase();
|
|
262
|
+
let keyRef = (spKeys.length > 1 && controlName.indexOf(spKeys[0]) > -1) ? spKeys[1] : spKeys[0];
|
|
259
263
|
keyRef = keyRef.replace(controlName, '');
|
|
260
264
|
keyRef = this.tagNameMapper['e-' + key] ? this.tagNameMapper['e-' + key].replace('e-', '') : keyRef;
|
|
261
|
-
if (controlName
|
|
262
|
-
keyRef =
|
|
265
|
+
if (controlName === 'splitter' && keyRef === 'panes') {
|
|
266
|
+
keyRef = 'paneSettings';
|
|
263
267
|
}
|
|
264
|
-
else if (controlName
|
|
265
|
-
keyRef =
|
|
268
|
+
else if (controlName === 'bulletchart' && keyRef === 'range') {
|
|
269
|
+
keyRef = 'ranges';
|
|
266
270
|
}
|
|
267
|
-
else if (controlName
|
|
268
|
-
keyRef =
|
|
271
|
+
else if (controlName === 'schedule' && keyRef === 'header') {
|
|
272
|
+
keyRef = 'headerRows';
|
|
269
273
|
}
|
|
270
274
|
dirProps[`${keyRef}`] = ref[`${key}`];
|
|
271
275
|
}
|
|
@@ -278,7 +282,7 @@ let ComponentBase = vueDefineComponent({
|
|
|
278
282
|
if (!this.childDirObjects) {
|
|
279
283
|
this.childDirObjects = JSON.stringify(dirProps);
|
|
280
284
|
}
|
|
281
|
-
for (
|
|
285
|
+
for (const dirProp of Object.keys(dirProps)) {
|
|
282
286
|
childOption[`${dirProp}`] = dirProps[`${dirProp}`];
|
|
283
287
|
}
|
|
284
288
|
},
|
|
@@ -287,19 +291,19 @@ let ComponentBase = vueDefineComponent({
|
|
|
287
291
|
let innerDirValues;
|
|
288
292
|
slot = slots.default ? slots.default() : slots;
|
|
289
293
|
slot = slot.flatMap((item) => Array.isArray(item.children) ? item.children : item);
|
|
290
|
-
|
|
294
|
+
const items = {};
|
|
291
295
|
items[`${tagName}`] = [];
|
|
292
296
|
for (const childSlot of slot) {
|
|
293
297
|
let tempObj = {};
|
|
294
|
-
|
|
298
|
+
const tagRef = childSlot.type.methods ? childSlot.type.methods.getTag() : tagName;
|
|
295
299
|
if (childSlot.children) {
|
|
296
300
|
let key;
|
|
297
|
-
innerDirValues = this.resolveComplexDirs(childSlot.children, this.tagMapper[
|
|
301
|
+
innerDirValues = this.resolveComplexDirs(childSlot.children, this.tagMapper['e-' + tagName], tagRef);
|
|
298
302
|
if (innerDirValues.length) {
|
|
299
303
|
tempObj = innerDirValues;
|
|
300
304
|
}
|
|
301
305
|
else {
|
|
302
|
-
for (
|
|
306
|
+
for (let i = 0; i < Object.keys(innerDirValues).length; i++) {
|
|
303
307
|
key = Object.keys(innerDirValues)[parseInt(i.toString(), 10)];
|
|
304
308
|
tempObj[`${key}`] = innerDirValues[`${key}`];
|
|
305
309
|
}
|
|
@@ -307,14 +311,19 @@ let ComponentBase = vueDefineComponent({
|
|
|
307
311
|
}
|
|
308
312
|
if (childSlot.props) {
|
|
309
313
|
Object.keys(childSlot.props).forEach((key) => {
|
|
310
|
-
|
|
314
|
+
const propName = key.replace(/-[a-z]/g, (e) => { return e[1].toUpperCase(); });
|
|
311
315
|
if (propName) {
|
|
312
316
|
tempObj[`${propName}`] = childSlot.props[`${key}`];
|
|
313
317
|
}
|
|
314
318
|
});
|
|
315
319
|
}
|
|
316
320
|
if (((/[s]\b/).test(tagRef) && innerDirValues) && (!(/[s]\b/).test(tagName) || innerDirValues.length)) {
|
|
317
|
-
Array.isArray(tempObj)
|
|
321
|
+
if (Array.isArray(tempObj)) {
|
|
322
|
+
tempObj.forEach((item) => { items[`${tagName}`].push(item); });
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
items[`${tagName}`].push(tempObj);
|
|
326
|
+
}
|
|
318
327
|
}
|
|
319
328
|
else if (tempObj && Object.keys(tempObj).length !== 0) {
|
|
320
329
|
items[`${tagName}`].push(tempObj);
|
|
@@ -333,11 +342,10 @@ let ComponentBase = vueDefineComponent({
|
|
|
333
342
|
if (tagObject[`${tagName}`]) {
|
|
334
343
|
tagRef = Object.keys(tagObject[`${tagName}`]);
|
|
335
344
|
tag = tagRef.find((key) => tagObject[`${tagName}`][`${key}`] ===
|
|
336
|
-
childSlot.type.methods.getTag().replace(/[s]\b/,
|
|
337
|
-
const moduleName = this.ej2Instances.getModuleName().toLowerCase();
|
|
345
|
+
childSlot.type.methods.getTag().replace(/[s]\b/, ''));
|
|
338
346
|
tag = tag ? tag : childSlot.type.methods.getTag();
|
|
339
|
-
tag = (this.tagNameMapper[`${tag}`] ? this.tagNameMapper[`${tag}`] : tag).replace(
|
|
340
|
-
if (this.ej2Instances.getModuleName().toLowerCase()
|
|
347
|
+
tag = (this.tagNameMapper[`${tag}`] ? this.tagNameMapper[`${tag}`] : tag).replace('e-', '');
|
|
348
|
+
if (this.ej2Instances.getModuleName().toLowerCase() === 'diagram' && tag.indexOf('annotations') !== -1) {
|
|
341
349
|
tag = 'annotations';
|
|
342
350
|
}
|
|
343
351
|
}
|
|
@@ -357,7 +365,7 @@ let ComponentBase = vueDefineComponent({
|
|
|
357
365
|
childSlot.props = this.getCamelCaseProps(childSlot.props);
|
|
358
366
|
}
|
|
359
367
|
if (slot.length > 1) {
|
|
360
|
-
items = Object.keys(items).length
|
|
368
|
+
items = Object.keys(items).length === 0 && !items.length ? [] : items;
|
|
361
369
|
if (childSlot.props) {
|
|
362
370
|
items.push(childSlot.props);
|
|
363
371
|
}
|
|
@@ -375,7 +383,7 @@ let ComponentBase = vueDefineComponent({
|
|
|
375
383
|
for (const childSlot of slot) {
|
|
376
384
|
let innerDirValues = null;
|
|
377
385
|
let tag = childSlot.type.methods.getTag();
|
|
378
|
-
tag = (this.tagNameMapper[tag] ? this.tagNameMapper[tag] : tag).replace(
|
|
386
|
+
tag = (this.tagNameMapper[`${tag}`] ? this.tagNameMapper[`${tag}`] : tag).replace('e-', '');
|
|
379
387
|
if (childSlot.children) {
|
|
380
388
|
innerDirValues = this.resolveMultilevelComplexInnerDirs(childSlot.children, tagObject[`${tagName}`], childSlot.type.methods.getTag());
|
|
381
389
|
if ((/[s]\b/).test(tag) || slot.length > 1) {
|
|
@@ -423,9 +431,8 @@ let ComponentBase = vueDefineComponent({
|
|
|
423
431
|
let items = slot.length > 1 ? [] : {};
|
|
424
432
|
for (const childSlot of slot) {
|
|
425
433
|
let innerDirValues = null;
|
|
426
|
-
const moduleName = this.ej2Instances.getModuleName().toLowerCase();
|
|
427
434
|
let tag = childSlot.type.methods.getTag();
|
|
428
|
-
tag = (this.tagNameMapper[tag] ? this.tagNameMapper[tag] : tag).replace(
|
|
435
|
+
tag = (this.tagNameMapper[`${tag}`] ? this.tagNameMapper[`${tag}`] : tag).replace('e-', '');
|
|
429
436
|
if (childSlot.children) {
|
|
430
437
|
innerDirValues = this.resolveComplexInnerDirs(childSlot.children, tagObject[`${tagName}`], childSlot.type.methods.getTag());
|
|
431
438
|
}
|
|
@@ -452,20 +459,21 @@ let ComponentBase = vueDefineComponent({
|
|
|
452
459
|
return items;
|
|
453
460
|
},
|
|
454
461
|
getDirectiveValues(tagDirectives, tagMapper, tagNameMapper) {
|
|
455
|
-
|
|
456
|
-
|
|
462
|
+
const keyTags = Object.keys(tagMapper);
|
|
463
|
+
const dir = {};
|
|
457
464
|
if (tagDirectives) {
|
|
458
|
-
for (
|
|
459
|
-
|
|
465
|
+
for (const tagDirective of tagDirectives) {
|
|
466
|
+
const tagCompOption = tagDirective.componentOptions;
|
|
467
|
+
if (tagCompOption && tagCompOption.children && this.getTagName(tagCompOption) ||
|
|
460
468
|
(tagDirective.tag === 'e-seriescollection' && tagDirective.children)) {
|
|
461
|
-
let dirTag =
|
|
469
|
+
let dirTag = tagCompOption ? this.getTagName(tagCompOption) : tagDirective.tag;
|
|
462
470
|
dirTag = (dirTag === 'e-seriescollection') ? 'e-seriesCollection' : dirTag;
|
|
463
471
|
if (keyTags.indexOf(dirTag) !== -1) {
|
|
464
|
-
|
|
472
|
+
const tagName = tagNameMapper[`${dirTag}`] ? tagNameMapper[`${dirTag}`] : dirTag;
|
|
465
473
|
dir[tagName.replace('e-', '')] = [];
|
|
466
|
-
|
|
467
|
-
for (
|
|
468
|
-
|
|
474
|
+
const children = tagCompOption ? tagCompOption.children : tagDirective.children;
|
|
475
|
+
for (const tagDirChild of children) {
|
|
476
|
+
const retObj = this.getVNodeValue(tagDirChild, tagMapper[`${dirTag}`], tagNameMapper);
|
|
469
477
|
if (Object.keys(retObj).length !== 0) {
|
|
470
478
|
dir[tagName.replace('e-', '')].push(retObj);
|
|
471
479
|
}
|
|
@@ -477,8 +485,8 @@ let ComponentBase = vueDefineComponent({
|
|
|
477
485
|
return dir;
|
|
478
486
|
},
|
|
479
487
|
getMultiLevelDirValue(tagDirectories, tagKey, tagNameMapper) {
|
|
480
|
-
|
|
481
|
-
for (
|
|
488
|
+
const mulObj = {};
|
|
489
|
+
for (const tagDir of tagDirectories) {
|
|
482
490
|
let key;
|
|
483
491
|
let children;
|
|
484
492
|
if (tagDir.componentOptions) {
|
|
@@ -492,11 +500,11 @@ let ComponentBase = vueDefineComponent({
|
|
|
492
500
|
children = tagDir.children;
|
|
493
501
|
}
|
|
494
502
|
if (key) {
|
|
495
|
-
|
|
503
|
+
const tagName = tagNameMapper[`${key}`] ? tagNameMapper[`${key}`] : key;
|
|
496
504
|
mulObj[tagName.replace('e-', '')] = [];
|
|
497
505
|
if (children) {
|
|
498
|
-
for (
|
|
499
|
-
|
|
506
|
+
for (const tagDirChild of children) {
|
|
507
|
+
const mulLevObj = this.getVNodeValue(tagDirChild, tagKey[`${key}`], tagNameMapper);
|
|
500
508
|
if (Object.keys(mulLevObj).length !== 0) {
|
|
501
509
|
mulObj[tagName.replace('e-', '')].push(mulLevObj);
|
|
502
510
|
}
|
|
@@ -516,8 +524,9 @@ let ComponentBase = vueDefineComponent({
|
|
|
516
524
|
else {
|
|
517
525
|
dirTag = (tagDirective.tag === 'e-markersettings') ? 'e-markerSettings' : 'e-markerSetting';
|
|
518
526
|
}
|
|
519
|
-
|
|
520
|
-
|
|
527
|
+
const tagData = tagDirective.data;
|
|
528
|
+
if (typeof tagKey === 'string' && dirTag === tagKey && tagData) {
|
|
529
|
+
ret = tagData.attrs ? this.getCamelCaseProps(tagData.attrs) : this.getCamelCaseProps(tagData);
|
|
521
530
|
}
|
|
522
531
|
else if (typeof tagKey === 'object') {
|
|
523
532
|
if (tagDirective.componentOptions.children && (Object.keys(tagKey).indexOf(dirTag) !== -1)) {
|
|
@@ -526,19 +535,22 @@ let ComponentBase = vueDefineComponent({
|
|
|
526
535
|
else if (tagDirective.children && (Object.keys(tagKey).indexOf(dirTag) !== -1) && (dirTag === 'e-markersettings' || dirTag === 'e-markersetting')) {
|
|
527
536
|
ret = this.getMultiLevelDirValue(tagDirective.children, tagKey[`${dirTag}`], tagNameMapper);
|
|
528
537
|
}
|
|
529
|
-
if (
|
|
530
|
-
ret = extend(ret, this.getCamelCaseProps(
|
|
538
|
+
if (tagData && tagData.attrs) {
|
|
539
|
+
ret = extend(ret, this.getCamelCaseProps(tagData.attrs));
|
|
531
540
|
}
|
|
532
541
|
}
|
|
533
542
|
}
|
|
534
543
|
return ret;
|
|
535
544
|
},
|
|
536
545
|
/**
|
|
537
|
-
* convert kebab case directive props to camel case
|
|
546
|
+
* convert kebab case directive props to camel case.
|
|
547
|
+
*
|
|
548
|
+
* @param {Object} props - Objects in kebab case directive props.
|
|
549
|
+
* @returns {Object} Object converted into camel case directive props.
|
|
538
550
|
*/
|
|
539
551
|
getCamelCaseProps(props) {
|
|
540
|
-
|
|
541
|
-
for (
|
|
552
|
+
const retProps = {};
|
|
553
|
+
for (const prop of Object.keys(props)) {
|
|
542
554
|
retProps[prop.replace(/-[a-z]/g, (e) => { return e[1].toUpperCase(); })] = props[`${prop}`];
|
|
543
555
|
}
|
|
544
556
|
return retProps;
|
|
@@ -551,16 +563,23 @@ let ComponentBase = vueDefineComponent({
|
|
|
551
563
|
},
|
|
552
564
|
getTagName(options) {
|
|
553
565
|
let tag = options.tag;
|
|
554
|
-
|
|
566
|
+
const optCtor = options.Ctor;
|
|
567
|
+
if (!tag && optCtor && optCtor.extendOptions && optCtor.extendOptions.methods && optCtor.extendOptions.methods.getTag) {
|
|
555
568
|
tag = options.Ctor.extendOptions.methods.getTag();
|
|
556
569
|
}
|
|
557
570
|
return tag;
|
|
558
571
|
}
|
|
559
572
|
}
|
|
560
573
|
});
|
|
574
|
+
/**
|
|
575
|
+
* Collect public property values for the Vue component.
|
|
576
|
+
*
|
|
577
|
+
* @param {any} options - represents props object.
|
|
578
|
+
* @returns {any} array of props object and `watchobject` respectively.
|
|
579
|
+
*/
|
|
561
580
|
function getProps(options = {}) {
|
|
562
581
|
if (options.props) {
|
|
563
|
-
for (
|
|
582
|
+
for (const prop of options.props) {
|
|
564
583
|
(options.newprops || (options.newprops = {}))[`${prop}`] = {};
|
|
565
584
|
(options.watch || (options.watch = {}))[`${prop}`] = function (newVal) {
|
|
566
585
|
this.ej2Instances[`${prop}`] = newVal;
|
|
@@ -572,31 +591,38 @@ function getProps(options = {}) {
|
|
|
572
591
|
}
|
|
573
592
|
return [options.newprops, options.watch];
|
|
574
593
|
}
|
|
575
|
-
if (!isExecute)
|
|
594
|
+
if (!isExecute) {
|
|
576
595
|
setProxyToRaw(aVue.toRaw);
|
|
596
|
+
}
|
|
577
597
|
|
|
578
|
-
|
|
579
|
-
|
|
598
|
+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types */
|
|
599
|
+
const stringCompiler = getTemplateEngine();
|
|
600
|
+
/**
|
|
601
|
+
* Compiler function that convert the template property to DOM element.
|
|
602
|
+
*
|
|
603
|
+
* @param {any} templateElement - represents value of the template property from the component.
|
|
604
|
+
* @param {Object} helper - represents helper object to utilize on template compilation.
|
|
605
|
+
* @returns {NodeList} template element that append to the component.
|
|
606
|
+
*/
|
|
580
607
|
function compile(templateElement, helper) {
|
|
581
|
-
let that = this;
|
|
582
608
|
return (data, context, propName, element, root) => {
|
|
583
609
|
let returnEle;
|
|
584
610
|
if (context) {
|
|
585
611
|
let plugins = context.vueInstance && context.vueInstance.plugins ? { plugins: context.vueInstance.plugins } : {};
|
|
586
612
|
const vueInstance = context.vueInstance ? context.vueInstance :
|
|
587
613
|
((root && root.vueInstance) ? root.vueInstance : null);
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
614
|
+
const pid = getUniqueID('templateParentDiv');
|
|
615
|
+
const id = getUniqueID('templateDiv');
|
|
616
|
+
const ele = createElement('div', {
|
|
591
617
|
id: pid,
|
|
592
|
-
innerHTML: '<div id="' + id + '"></div>'
|
|
618
|
+
innerHTML: '<div id="' + id + '"></div>'
|
|
593
619
|
});
|
|
594
620
|
document.body.appendChild(ele);
|
|
595
|
-
if (!isExecute && (typeof templateElement ===
|
|
596
|
-
|
|
621
|
+
if (!isExecute && (typeof templateElement === 'string' || (templateElement.prototype && templateElement.prototype.CSPTemplate && typeof templateElement === 'function'))) {
|
|
622
|
+
const vueSlot = getCurrentVueSlot(context.vueInstance, templateElement, root);
|
|
597
623
|
if (vueSlot) {
|
|
598
624
|
// Compilation for Vue 3 slot template
|
|
599
|
-
|
|
625
|
+
const app = aVue.createVNode({
|
|
600
626
|
render() {
|
|
601
627
|
return vueSlot[`${templateElement}`]({ data: data });
|
|
602
628
|
}
|
|
@@ -622,12 +648,12 @@ function compile(templateElement, helper) {
|
|
|
622
648
|
}
|
|
623
649
|
else if (!isExecute) {
|
|
624
650
|
// Compilation for Vue 3 functional template
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
651
|
+
const tempObj = templateElement.call(this, {});
|
|
652
|
+
const object = tempObj;
|
|
653
|
+
const propsData = getValue('template.propsData', tempObj);
|
|
654
|
+
const dataObj = {
|
|
629
655
|
data: { data: extend(tempObj.data || {}, data) },
|
|
630
|
-
parent: context.vueInstance
|
|
656
|
+
parent: context.vueInstance
|
|
631
657
|
};
|
|
632
658
|
if (!object.template) {
|
|
633
659
|
object.template = object[Object.keys(object)[0]];
|
|
@@ -639,7 +665,7 @@ function compile(templateElement, helper) {
|
|
|
639
665
|
else {
|
|
640
666
|
templateCompRef = object.template._context.components[templateElement.name];
|
|
641
667
|
if (!templateCompRef) {
|
|
642
|
-
|
|
668
|
+
const key = Object.keys(object.template._context.components)[0];
|
|
643
669
|
templateCompRef = object.template._context.components[`${key}`];
|
|
644
670
|
}
|
|
645
671
|
}
|
|
@@ -660,13 +686,16 @@ function compile(templateElement, helper) {
|
|
|
660
686
|
tempRef = Object.assign(templateCompRef.data(), dataObj.data);
|
|
661
687
|
}
|
|
662
688
|
if (templateCompRef.components) {
|
|
663
|
-
|
|
664
|
-
for (
|
|
665
|
-
|
|
689
|
+
const objkeys = Object.keys(templateCompRef.components) || [];
|
|
690
|
+
for (const objstring of objkeys) {
|
|
691
|
+
const intComponent = templateCompRef.components[`${objstring}`];
|
|
666
692
|
if (intComponent && intComponent.data) {
|
|
667
|
-
if (!intComponent.__data)
|
|
693
|
+
if (!intComponent.__data) {
|
|
668
694
|
intComponent.__data = intComponent.data;
|
|
669
|
-
|
|
695
|
+
}
|
|
696
|
+
intComponent.data = function (proxy) {
|
|
697
|
+
return Object.assign(intComponent.__data.call(proxy), dataObj.data);
|
|
698
|
+
};
|
|
670
699
|
}
|
|
671
700
|
}
|
|
672
701
|
}
|
|
@@ -675,7 +704,7 @@ function compile(templateElement, helper) {
|
|
|
675
704
|
plugins = Object.assign(plugins, data);
|
|
676
705
|
}
|
|
677
706
|
templateCompRef.data = function () { return tempRef; };
|
|
678
|
-
|
|
707
|
+
const app = aVue.createVNode(templateCompRef, plugins);
|
|
679
708
|
ele.innerHTML = '';
|
|
680
709
|
// Get values for Vue 3 functional template
|
|
681
710
|
getValues(app, context.vueInstance, root);
|
|
@@ -702,30 +731,32 @@ function compile(templateElement, helper) {
|
|
|
702
731
|
}
|
|
703
732
|
detach(ele);
|
|
704
733
|
}
|
|
705
|
-
else if (typeof templateElement ===
|
|
706
|
-
|
|
734
|
+
else if (typeof templateElement === 'string' || (templateElement.prototype && templateElement.prototype.CSPTemplate && typeof templateElement === 'function')) {
|
|
735
|
+
const vueSlot = getVueSlot(context.vueInstance, templateElement, root);
|
|
707
736
|
if (vueSlot) {
|
|
708
737
|
// Get provide values for Vue 2 slot template
|
|
709
738
|
let provided = {};
|
|
710
|
-
|
|
711
|
-
if (vueinstance['$parent'])
|
|
739
|
+
const getProvideValues = (vueinstance) => {
|
|
740
|
+
if (vueinstance['$parent']) {
|
|
712
741
|
getProvideValues(vueinstance.$parent);
|
|
742
|
+
}
|
|
713
743
|
if (vueinstance['_provided'] && Object.keys(vueinstance['_provided']).length > 0) {
|
|
714
744
|
provided = Object.assign({}, provided, vueinstance._provided);
|
|
715
745
|
}
|
|
716
746
|
};
|
|
717
|
-
|
|
747
|
+
const vueInstance = context.vueInstance ? context.vueInstance :
|
|
748
|
+
((root && root.vueInstance) ? root.vueInstance : null);
|
|
718
749
|
if (vueInstance) {
|
|
719
750
|
getProvideValues(vueInstance);
|
|
720
751
|
}
|
|
721
752
|
// Compilation for Vue 2 slot template
|
|
722
|
-
|
|
753
|
+
const vueTemplate = new aVue({
|
|
723
754
|
provide: Object.assign({}, provided),
|
|
724
755
|
render() {
|
|
725
756
|
return vueSlot[`${templateElement}`]({ data: data });
|
|
726
757
|
}
|
|
727
758
|
});
|
|
728
|
-
vueTemplate.$mount(
|
|
759
|
+
vueTemplate.$mount('#' + id);
|
|
729
760
|
if (vueInstance) {
|
|
730
761
|
if (!vueInstance['portals']) {
|
|
731
762
|
vueInstance['portals'] = [];
|
|
@@ -743,27 +774,27 @@ function compile(templateElement, helper) {
|
|
|
743
774
|
}
|
|
744
775
|
else {
|
|
745
776
|
// Compilation for Vue 2 functional template
|
|
746
|
-
|
|
777
|
+
const tempObj = templateElement.call(this, {});
|
|
747
778
|
let templateFunction = tempObj.template;
|
|
748
|
-
|
|
749
|
-
|
|
779
|
+
const propsData = getValue('template.propsData', tempObj);
|
|
780
|
+
const dataObj = {
|
|
750
781
|
data: { data: extend(tempObj.data || {}, data) },
|
|
751
|
-
parent: context.vueInstance
|
|
782
|
+
parent: context.vueInstance
|
|
752
783
|
};
|
|
753
784
|
if (propsData) {
|
|
754
785
|
templateFunction = tempObj.template.extends;
|
|
755
786
|
dataObj.propsData = propsData;
|
|
756
787
|
}
|
|
757
|
-
if (typeof templateFunction !==
|
|
788
|
+
if (typeof templateFunction !== 'function') {
|
|
758
789
|
templateFunction = aVue.extend(templateFunction);
|
|
759
790
|
}
|
|
760
791
|
if (templateFunction.options.setup) {
|
|
761
792
|
dataObj.propsData = Object.assign(dataObj.propsData || {}, data);
|
|
762
793
|
}
|
|
763
|
-
|
|
794
|
+
const templateVue = new templateFunction(dataObj);
|
|
764
795
|
// let templateVue = new Vue(tempObj.template);
|
|
765
796
|
// templateVue.$data.data = extend(tempObj.data, data);
|
|
766
|
-
templateVue.$mount(
|
|
797
|
+
templateVue.$mount('#' + id);
|
|
767
798
|
if (vueInstance) {
|
|
768
799
|
if (!vueInstance['portals']) {
|
|
769
800
|
vueInstance['portals'] = [];
|
|
@@ -791,8 +822,16 @@ function compile(templateElement, helper) {
|
|
|
791
822
|
};
|
|
792
823
|
}
|
|
793
824
|
setTemplateEngine({ compile: compile });
|
|
825
|
+
/**
|
|
826
|
+
* Collect values from the app instance.
|
|
827
|
+
*
|
|
828
|
+
* @param {any} app - represents global application instance
|
|
829
|
+
* @param {any} cInstance - represents Vue component instance
|
|
830
|
+
* @param {any} root - represents parent component instance
|
|
831
|
+
* @returns {void}
|
|
832
|
+
*/
|
|
794
833
|
function getValues(app, cInstance, root) {
|
|
795
|
-
|
|
834
|
+
const vueInstance = cInstance ? cInstance : ((root && root.vueInstance) ? root.vueInstance : null);
|
|
796
835
|
if (!vueInstance) {
|
|
797
836
|
return;
|
|
798
837
|
}
|
|
@@ -800,9 +839,10 @@ function getValues(app, cInstance, root) {
|
|
|
800
839
|
app['appContext'] = vueInstance['$']['appContext'];
|
|
801
840
|
// Get provide value from child component.
|
|
802
841
|
let provided = {};
|
|
803
|
-
|
|
804
|
-
if (vueinstance['$'] && vueinstance['$']['parent'])
|
|
842
|
+
const getProvideValue = (vueinstance) => {
|
|
843
|
+
if (vueinstance['$'] && vueinstance['$']['parent']) {
|
|
805
844
|
getProvideValue(vueinstance.$.parent);
|
|
845
|
+
}
|
|
806
846
|
if (vueinstance['provides'] && Object.keys(vueinstance['provides']).length > 0) {
|
|
807
847
|
provided = Object.assign({}, provided, vueinstance.provides);
|
|
808
848
|
}
|
|
@@ -812,29 +852,43 @@ function getValues(app, cInstance, root) {
|
|
|
812
852
|
app.appContext.provides = Object.assign({}, app.appContext.provides, provided);
|
|
813
853
|
}
|
|
814
854
|
}
|
|
815
|
-
|
|
855
|
+
/**
|
|
856
|
+
* Get the Vue2 slot template from the root or current Vue component.
|
|
857
|
+
*
|
|
858
|
+
* @param {any} vueInstance - represents parent Vue instance.
|
|
859
|
+
* @param {any} templateElement - represents component property value
|
|
860
|
+
* @param {any} root - represents root Vue instance
|
|
861
|
+
* @returns {any} template Vue instance
|
|
862
|
+
*/
|
|
816
863
|
function getVueSlot(vueInstance, templateElement, root) {
|
|
817
864
|
if (!vueInstance && !(root && root.vueInstance)) {
|
|
818
865
|
return undefined;
|
|
819
866
|
}
|
|
820
|
-
|
|
867
|
+
const instance = (root && root.vueInstance) ? root.vueInstance : vueInstance;
|
|
821
868
|
return getVueChildSlot(instance, templateElement);
|
|
822
869
|
}
|
|
870
|
+
/**
|
|
871
|
+
* Get the Vue2 nested slot template from the root or current Vue component.
|
|
872
|
+
*
|
|
873
|
+
* @param {any} vueInstance - represents parent Vue instance.
|
|
874
|
+
* @param {any} templateElement - represents component property value
|
|
875
|
+
* @returns {any} nested template Vue instance
|
|
876
|
+
*/
|
|
823
877
|
function getVueChildSlot(vueInstance, templateElement) {
|
|
824
878
|
if (!vueInstance) {
|
|
825
879
|
return undefined;
|
|
826
880
|
}
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
881
|
+
const slots = vueInstance.$slots;
|
|
882
|
+
const scopedSlots = vueInstance.$scopedSlots;
|
|
883
|
+
const vSlots = vueInstance.scopedSlots;
|
|
884
|
+
const children = vueInstance.children;
|
|
831
885
|
if (scopedSlots && scopedSlots[`${templateElement}`]) {
|
|
832
886
|
return scopedSlots;
|
|
833
887
|
}
|
|
834
888
|
else if (slots && slots.default) {
|
|
835
|
-
|
|
889
|
+
const childSlots = slots.default;
|
|
836
890
|
for (let i = 0; i < childSlots.length; i++) {
|
|
837
|
-
|
|
891
|
+
const slot = getVueChildSlot(getSlot(childSlots[parseInt(i.toString(), 10)]), templateElement);
|
|
838
892
|
if (slot) {
|
|
839
893
|
return slot;
|
|
840
894
|
}
|
|
@@ -845,7 +899,7 @@ function getVueChildSlot(vueInstance, templateElement) {
|
|
|
845
899
|
}
|
|
846
900
|
else if (children) {
|
|
847
901
|
for (let i = 0; i < children.length; i++) {
|
|
848
|
-
|
|
902
|
+
const slot = getVueChildSlot(getSlot(children[parseInt(i.toString(), 10)]), templateElement);
|
|
849
903
|
if (slot) {
|
|
850
904
|
return slot;
|
|
851
905
|
}
|
|
@@ -853,19 +907,39 @@ function getVueChildSlot(vueInstance, templateElement) {
|
|
|
853
907
|
}
|
|
854
908
|
return undefined;
|
|
855
909
|
}
|
|
910
|
+
/**
|
|
911
|
+
* Collect the component slot directive instance.
|
|
912
|
+
*
|
|
913
|
+
* @param {any} vnode - represents Vue components slot instance.
|
|
914
|
+
* @returns {any} the slot instance of the directive.
|
|
915
|
+
*/
|
|
856
916
|
function getSlot(vnode) {
|
|
857
|
-
|
|
917
|
+
const slot = (vnode.componentOptions && vnode.componentOptions.children) ? vnode.componentOptions :
|
|
858
918
|
(!vnode.data && (vnode.tag === 'e-markersettings' || vnode.tag === 'e-markersetting')) ? vnode : vnode.data;
|
|
859
919
|
return vnode.componentInstance ? vnode.componentInstance : slot;
|
|
860
920
|
}
|
|
861
|
-
|
|
921
|
+
/**
|
|
922
|
+
* Get the Vue3 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
|
+
* @param {any} root - represents root Vue instance
|
|
927
|
+
* @returns {any} slot template instance
|
|
928
|
+
*/
|
|
862
929
|
function getCurrentVueSlot(vueInstance, templateElement, root) {
|
|
863
930
|
if (!vueInstance && !(root && root.vueInstance)) {
|
|
864
931
|
return undefined;
|
|
865
932
|
}
|
|
866
|
-
|
|
933
|
+
const slots = (root && root.vueInstance) ? root.vueInstance.$slots : vueInstance.$slots;
|
|
867
934
|
return getChildVueSlot(slots, templateElement);
|
|
868
935
|
}
|
|
936
|
+
/**
|
|
937
|
+
* Get the Vue3 nested slot template from the root or current Vue component.
|
|
938
|
+
*
|
|
939
|
+
* @param {any} slots - represents slot instance.
|
|
940
|
+
* @param {any} templateElement - represents component property value
|
|
941
|
+
* @returns {any} nested template Vue instance
|
|
942
|
+
*/
|
|
869
943
|
function getChildVueSlot(slots, templateElement) {
|
|
870
944
|
if (slots && slots[`${templateElement}`]) {
|
|
871
945
|
return slots;
|
|
@@ -874,7 +948,7 @@ function getChildVueSlot(slots, templateElement) {
|
|
|
874
948
|
let childSlots = slots.default();
|
|
875
949
|
childSlots = childSlots.flatMap((item) => Array.isArray(item.children) ? item.children : item);
|
|
876
950
|
for (let i = 0; i < childSlots.length; i++) {
|
|
877
|
-
|
|
951
|
+
const slot = getChildVueSlot(childSlots[parseInt(i.toString(), 10)].children, templateElement);
|
|
878
952
|
if (slot) {
|
|
879
953
|
return slot;
|
|
880
954
|
}
|
|
@@ -883,9 +957,5 @@ function getChildVueSlot(slots, templateElement) {
|
|
|
883
957
|
return undefined;
|
|
884
958
|
}
|
|
885
959
|
|
|
886
|
-
|
|
887
|
-
* index for component base
|
|
888
|
-
*/
|
|
889
|
-
|
|
890
|
-
export { isExecute, aVue, gh, vueDefineComponent, ComponentBase, getProps, compile };
|
|
960
|
+
export { ComponentBase, aVue, compile, getProps, gh, isExecute, vueDefineComponent };
|
|
891
961
|
//# sourceMappingURL=ej2-vue-base.es2015.js.map
|