@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
package/src/component-base.js
CHANGED
|
@@ -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
|
|
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(
|
|
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
|
-
|
|
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
|
|
150
|
-
var
|
|
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 <
|
|
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(
|
|
175
|
+
if ((key[parseInt(j.toString(), 10)].indexOf(pValue[parseInt(i.toString(), 10)])) !== -1) {
|
|
164
176
|
if (this.$root && this.isDecorator) {
|
|
165
|
-
|
|
177
|
+
pKey[pValue[parseInt(j.toString(), 10)]] = this.$root[key[parseInt(i.toString(), 10)]];
|
|
166
178
|
}
|
|
167
179
|
else if (this.$vnode) {
|
|
168
|
-
|
|
180
|
+
pKey[pValue[parseInt(i.toString(), 10)]] = this.$vnode.context[key[parseInt(j.toString(), 10)]];
|
|
169
181
|
}
|
|
170
182
|
else if (this.$parent) {
|
|
171
|
-
|
|
183
|
+
pKey[pValue[parseInt(i.toString(), 10)]] = this.$parent[key[parseInt(j.toString(), 10)]];
|
|
172
184
|
}
|
|
173
|
-
injectables =
|
|
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,26 +200,25 @@ export var ComponentBase = vueDefineComponent({
|
|
|
189
200
|
return ret;
|
|
190
201
|
},
|
|
191
202
|
destroyComponent: function () {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
tempBeforeDestroyThis.destroyPortals();
|
|
196
|
-
tempBeforeDestroyThis = null;
|
|
203
|
+
this.ej2Instances.destroy();
|
|
204
|
+
this.$el.style.visibility = 'hidden';
|
|
205
|
+
this.clearTemplate();
|
|
197
206
|
},
|
|
198
|
-
destroyPortals: function () {
|
|
199
|
-
if (
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
index--;
|
|
208
|
-
}
|
|
207
|
+
destroyPortals: function (element) {
|
|
208
|
+
if (element) {
|
|
209
|
+
var destroy = getValue('__vue__.$destroy', element);
|
|
210
|
+
if (destroy) {
|
|
211
|
+
element.__vue__.$destroy();
|
|
212
|
+
}
|
|
213
|
+
else if (!isExecute && element._vnode) {
|
|
214
|
+
try {
|
|
215
|
+
aVue.render(null, element);
|
|
209
216
|
}
|
|
217
|
+
catch (e) { /* Handle error */ }
|
|
218
|
+
}
|
|
219
|
+
if (element.innerHTML) {
|
|
220
|
+
element.innerHTML = '';
|
|
210
221
|
}
|
|
211
|
-
this.portals = null;
|
|
212
222
|
}
|
|
213
223
|
},
|
|
214
224
|
bindProperties: function () {
|
|
@@ -258,21 +268,21 @@ export var ComponentBase = vueDefineComponent({
|
|
|
258
268
|
for (var i = 0; i < propRef.length; i++) {
|
|
259
269
|
if (propRef[parseInt(i.toString(), 10)].type.methods || propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection') {
|
|
260
270
|
var key = propRef[parseInt(i.toString(), 10)].type === 'e-seriescollection' ? 'series-collection' :
|
|
261
|
-
propRef[parseInt(i.toString(), 10)].type.methods.getTag().replace(
|
|
271
|
+
propRef[parseInt(i.toString(), 10)].type.methods.getTag().replace('e-', '');
|
|
262
272
|
var ref = this.resolveArrayDirectives(propRef[parseInt(i.toString(), 10)].children, key);
|
|
263
|
-
var
|
|
273
|
+
var spKeys = key.split('-');
|
|
264
274
|
var controlName = this.ej2Instances.getModuleName().toLowerCase();
|
|
265
|
-
var keyRef = (
|
|
275
|
+
var keyRef = (spKeys.length > 1 && controlName.indexOf(spKeys[0]) > -1) ? spKeys[1] : spKeys[0];
|
|
266
276
|
keyRef = keyRef.replace(controlName, '');
|
|
267
277
|
keyRef = this.tagNameMapper['e-' + key] ? this.tagNameMapper['e-' + key].replace('e-', '') : keyRef;
|
|
268
|
-
if (controlName
|
|
269
|
-
keyRef =
|
|
278
|
+
if (controlName === 'splitter' && keyRef === 'panes') {
|
|
279
|
+
keyRef = 'paneSettings';
|
|
270
280
|
}
|
|
271
|
-
else if (controlName
|
|
272
|
-
keyRef =
|
|
281
|
+
else if (controlName === 'bulletchart' && keyRef === 'range') {
|
|
282
|
+
keyRef = 'ranges';
|
|
273
283
|
}
|
|
274
|
-
else if (controlName
|
|
275
|
-
keyRef =
|
|
284
|
+
else if (controlName === 'schedule' && keyRef === 'header') {
|
|
285
|
+
keyRef = 'headerRows';
|
|
276
286
|
}
|
|
277
287
|
dirProps["" + keyRef] = ref["" + key];
|
|
278
288
|
}
|
|
@@ -302,7 +312,7 @@ export var ComponentBase = vueDefineComponent({
|
|
|
302
312
|
var tagRef = childSlot.type.methods ? childSlot.type.methods.getTag() : tagName;
|
|
303
313
|
if (childSlot.children) {
|
|
304
314
|
var key = void 0;
|
|
305
|
-
innerDirValues = this_2.resolveComplexDirs(childSlot.children, this_2.tagMapper[
|
|
315
|
+
innerDirValues = this_2.resolveComplexDirs(childSlot.children, this_2.tagMapper['e-' + tagName], tagRef);
|
|
306
316
|
if (innerDirValues.length) {
|
|
307
317
|
tempObj = innerDirValues;
|
|
308
318
|
}
|
|
@@ -322,7 +332,12 @@ export var ComponentBase = vueDefineComponent({
|
|
|
322
332
|
});
|
|
323
333
|
}
|
|
324
334
|
if (((/[s]\b/).test(tagRef) && innerDirValues) && (!(/[s]\b/).test(tagName) || innerDirValues.length)) {
|
|
325
|
-
Array.isArray(tempObj)
|
|
335
|
+
if (Array.isArray(tempObj)) {
|
|
336
|
+
tempObj.forEach(function (item) { items["" + tagName].push(item); });
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
items["" + tagName].push(tempObj);
|
|
340
|
+
}
|
|
326
341
|
}
|
|
327
342
|
else if (tempObj && Object.keys(tempObj).length !== 0) {
|
|
328
343
|
items["" + tagName].push(tempObj);
|
|
@@ -347,12 +362,11 @@ export var ComponentBase = vueDefineComponent({
|
|
|
347
362
|
tagRef = Object.keys(tagObject["" + tagName]);
|
|
348
363
|
tag = tagRef.find(function (key) {
|
|
349
364
|
return tagObject["" + tagName]["" + key] ===
|
|
350
|
-
childSlot.type.methods.getTag().replace(/[s]\b/,
|
|
365
|
+
childSlot.type.methods.getTag().replace(/[s]\b/, '');
|
|
351
366
|
});
|
|
352
|
-
var moduleName = this_3.ej2Instances.getModuleName().toLowerCase();
|
|
353
367
|
tag = tag ? tag : childSlot.type.methods.getTag();
|
|
354
|
-
tag = (this_3.tagNameMapper["" + tag] ? this_3.tagNameMapper["" + tag] : tag).replace(
|
|
355
|
-
if (this_3.ej2Instances.getModuleName().toLowerCase()
|
|
368
|
+
tag = (this_3.tagNameMapper["" + tag] ? this_3.tagNameMapper["" + tag] : tag).replace('e-', '');
|
|
369
|
+
if (this_3.ej2Instances.getModuleName().toLowerCase() === 'diagram' && tag.indexOf('annotations') !== -1) {
|
|
356
370
|
tag = 'annotations';
|
|
357
371
|
}
|
|
358
372
|
}
|
|
@@ -372,7 +386,7 @@ export var ComponentBase = vueDefineComponent({
|
|
|
372
386
|
childSlot.props = this_3.getCamelCaseProps(childSlot.props);
|
|
373
387
|
}
|
|
374
388
|
if (slot.length > 1) {
|
|
375
|
-
items = Object.keys(items).length
|
|
389
|
+
items = Object.keys(items).length === 0 && !items.length ? [] : items;
|
|
376
390
|
if (childSlot.props) {
|
|
377
391
|
items.push(childSlot.props);
|
|
378
392
|
}
|
|
@@ -396,7 +410,7 @@ export var ComponentBase = vueDefineComponent({
|
|
|
396
410
|
var childSlot = slot_3[_i];
|
|
397
411
|
var innerDirValues = null;
|
|
398
412
|
var tag = childSlot.type.methods.getTag();
|
|
399
|
-
tag = (this.tagNameMapper[tag] ? this.tagNameMapper[tag] : tag).replace(
|
|
413
|
+
tag = (this.tagNameMapper["" + tag] ? this.tagNameMapper["" + tag] : tag).replace('e-', '');
|
|
400
414
|
if (childSlot.children) {
|
|
401
415
|
innerDirValues = this.resolveMultilevelComplexInnerDirs(childSlot.children, tagObject["" + tagName], childSlot.type.methods.getTag());
|
|
402
416
|
if ((/[s]\b/).test(tag) || slot.length > 1) {
|
|
@@ -445,9 +459,8 @@ export var ComponentBase = vueDefineComponent({
|
|
|
445
459
|
for (var _i = 0, slot_4 = slot; _i < slot_4.length; _i++) {
|
|
446
460
|
var childSlot = slot_4[_i];
|
|
447
461
|
var innerDirValues = null;
|
|
448
|
-
var moduleName = this.ej2Instances.getModuleName().toLowerCase();
|
|
449
462
|
var tag = childSlot.type.methods.getTag();
|
|
450
|
-
tag = (this.tagNameMapper[tag] ? this.tagNameMapper[tag] : tag).replace(
|
|
463
|
+
tag = (this.tagNameMapper["" + tag] ? this.tagNameMapper["" + tag] : tag).replace('e-', '');
|
|
451
464
|
if (childSlot.children) {
|
|
452
465
|
innerDirValues = this.resolveComplexInnerDirs(childSlot.children, tagObject["" + tagName], childSlot.type.methods.getTag());
|
|
453
466
|
}
|
|
@@ -479,14 +492,15 @@ export var ComponentBase = vueDefineComponent({
|
|
|
479
492
|
if (tagDirectives) {
|
|
480
493
|
for (var _i = 0, tagDirectives_1 = tagDirectives; _i < tagDirectives_1.length; _i++) {
|
|
481
494
|
var tagDirective = tagDirectives_1[_i];
|
|
482
|
-
|
|
495
|
+
var tagCompOption = tagDirective.componentOptions;
|
|
496
|
+
if (tagCompOption && tagCompOption.children && this.getTagName(tagCompOption) ||
|
|
483
497
|
(tagDirective.tag === 'e-seriescollection' && tagDirective.children)) {
|
|
484
|
-
var dirTag =
|
|
498
|
+
var dirTag = tagCompOption ? this.getTagName(tagCompOption) : tagDirective.tag;
|
|
485
499
|
dirTag = (dirTag === 'e-seriescollection') ? 'e-seriesCollection' : dirTag;
|
|
486
500
|
if (keyTags.indexOf(dirTag) !== -1) {
|
|
487
501
|
var tagName = tagNameMapper["" + dirTag] ? tagNameMapper["" + dirTag] : dirTag;
|
|
488
502
|
dir[tagName.replace('e-', '')] = [];
|
|
489
|
-
var children =
|
|
503
|
+
var children = tagCompOption ? tagCompOption.children : tagDirective.children;
|
|
490
504
|
for (var _a = 0, children_1 = children; _a < children_1.length; _a++) {
|
|
491
505
|
var tagDirChild = children_1[_a];
|
|
492
506
|
var retObj = this.getVNodeValue(tagDirChild, tagMapper["" + dirTag], tagNameMapper);
|
|
@@ -542,8 +556,9 @@ export var ComponentBase = vueDefineComponent({
|
|
|
542
556
|
else {
|
|
543
557
|
dirTag = (tagDirective.tag === 'e-markersettings') ? 'e-markerSettings' : 'e-markerSetting';
|
|
544
558
|
}
|
|
545
|
-
|
|
546
|
-
|
|
559
|
+
var tagData = tagDirective.data;
|
|
560
|
+
if (typeof tagKey === 'string' && dirTag === tagKey && tagData) {
|
|
561
|
+
ret = tagData.attrs ? this.getCamelCaseProps(tagData.attrs) : this.getCamelCaseProps(tagData);
|
|
547
562
|
}
|
|
548
563
|
else if (typeof tagKey === 'object') {
|
|
549
564
|
if (tagDirective.componentOptions.children && (Object.keys(tagKey).indexOf(dirTag) !== -1)) {
|
|
@@ -552,15 +567,18 @@ export var ComponentBase = vueDefineComponent({
|
|
|
552
567
|
else if (tagDirective.children && (Object.keys(tagKey).indexOf(dirTag) !== -1) && (dirTag === 'e-markersettings' || dirTag === 'e-markersetting')) {
|
|
553
568
|
ret = this.getMultiLevelDirValue(tagDirective.children, tagKey["" + dirTag], tagNameMapper);
|
|
554
569
|
}
|
|
555
|
-
if (
|
|
556
|
-
ret = extend(ret, this.getCamelCaseProps(
|
|
570
|
+
if (tagData && tagData.attrs) {
|
|
571
|
+
ret = extend(ret, this.getCamelCaseProps(tagData.attrs));
|
|
557
572
|
}
|
|
558
573
|
}
|
|
559
574
|
}
|
|
560
575
|
return ret;
|
|
561
576
|
},
|
|
562
577
|
/**
|
|
563
|
-
* convert kebab case directive props to camel case
|
|
578
|
+
* convert kebab case directive props to camel case.
|
|
579
|
+
*
|
|
580
|
+
* @param {Object} props - Objects in kebab case directive props.
|
|
581
|
+
* @returns {Object} Object converted into camel case directive props.
|
|
564
582
|
*/
|
|
565
583
|
getCamelCaseProps: function (props) {
|
|
566
584
|
var retProps = {};
|
|
@@ -578,13 +596,20 @@ export var ComponentBase = vueDefineComponent({
|
|
|
578
596
|
},
|
|
579
597
|
getTagName: function (options) {
|
|
580
598
|
var tag = options.tag;
|
|
581
|
-
|
|
599
|
+
var optCtor = options.Ctor;
|
|
600
|
+
if (!tag && optCtor && optCtor.extendOptions && optCtor.extendOptions.methods && optCtor.extendOptions.methods.getTag) {
|
|
582
601
|
tag = options.Ctor.extendOptions.methods.getTag();
|
|
583
602
|
}
|
|
584
603
|
return tag;
|
|
585
604
|
}
|
|
586
605
|
}
|
|
587
606
|
});
|
|
607
|
+
/**
|
|
608
|
+
* Collect public property values for the Vue component.
|
|
609
|
+
*
|
|
610
|
+
* @param {any} options - represents props object.
|
|
611
|
+
* @returns {any} array of props object and `watchobject` respectively.
|
|
612
|
+
*/
|
|
588
613
|
export function getProps(options) {
|
|
589
614
|
if (options === void 0) { options = {}; }
|
|
590
615
|
if (options.props) {
|
|
@@ -604,5 +629,6 @@ export function getProps(options) {
|
|
|
604
629
|
}
|
|
605
630
|
return [options.newprops, options.watch];
|
|
606
631
|
}
|
|
607
|
-
if (!isExecute)
|
|
632
|
+
if (!isExecute) {
|
|
608
633
|
setProxyToRaw(aVue.toRaw);
|
|
634
|
+
}
|
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;
|