@syncfusion/ej2-vue-base 19.4.38 → 19.4.52
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/CHANGELOG.md +24 -0
- package/README.md +5 -3
- package/dist/ej2-vue-base.umd.min.js +9 -0
- package/dist/es6/ej2-vue-base.es2015.js +22 -4
- package/dist/es6/ej2-vue-base.es2015.js.map +1 -1
- package/dist/es6/ej2-vue-base.es5.js +22 -4
- 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 +6 -9
- package/postinstall.js +9 -1
- package/src/component-base.d.ts +1 -2
- package/src/component-base.js +22 -4
- package/dist/ts/component-base.ts +0 -406
- package/dist/ts/component-decorator.ts +0 -148
- package/dist/ts/template.ts +0 -118
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_from": "@syncfusion/ej2-vue-base@*",
|
|
3
|
-
"_id": "@syncfusion/ej2-vue-base@19.
|
|
3
|
+
"_id": "@syncfusion/ej2-vue-base@19.4.48",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-Cj4gbvETENmLl3LhmGb1ZqAH66Ho9ntIt3+xwzBfNAgZ+88IwfNntsgcLRhSVX57RvPPc7N+1bLLawdGgIwHbQ==",
|
|
6
6
|
"_location": "/@syncfusion/ej2-vue-base",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"/@syncfusion/ej2-vue-treegrid",
|
|
52
52
|
"/@syncfusion/ej2-vue-treemap"
|
|
53
53
|
],
|
|
54
|
-
"_resolved": "http://nexus.syncfusion.com/repository/ej2-
|
|
55
|
-
"_shasum": "
|
|
54
|
+
"_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-vue-base/-/ej2-vue-base-19.4.48.tgz",
|
|
55
|
+
"_shasum": "b6baa7fbd50df33b261d407c4b3dc62de4c7e471",
|
|
56
56
|
"_spec": "@syncfusion/ej2-vue-base@*",
|
|
57
57
|
"_where": "/jenkins/workspace/automation_release_19.1.0.1-ZPMUBNQ6AUYH6YGEFBPVYMEQLRRW2SLD4XCZ6GATNZJFYJ3RIAOA/packages/included",
|
|
58
58
|
"author": {
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
},
|
|
64
64
|
"bundleDependencies": false,
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@syncfusion/ej2-base": "~19.4.
|
|
66
|
+
"@syncfusion/ej2-base": "~19.4.52",
|
|
67
67
|
"glob": "^7.0.5"
|
|
68
68
|
},
|
|
69
69
|
"deprecated": false,
|
|
@@ -85,9 +85,6 @@
|
|
|
85
85
|
"main": "./dist/ej2-vue-base.umd.min.js",
|
|
86
86
|
"module": "./index.js",
|
|
87
87
|
"name": "@syncfusion/ej2-vue-base",
|
|
88
|
-
"peerDependencies": {
|
|
89
|
-
"vue-class-component": "^8.0.0-rc.1"
|
|
90
|
-
},
|
|
91
88
|
"repository": {
|
|
92
89
|
"type": "git",
|
|
93
90
|
"url": "git+https://github.com/syncfusion/ej2-vue-ui-components.git"
|
|
@@ -96,6 +93,6 @@
|
|
|
96
93
|
"postinstall": "node ./postinstall.js"
|
|
97
94
|
},
|
|
98
95
|
"typings": "index.d.ts",
|
|
99
|
-
"version": "19.4.
|
|
96
|
+
"version": "19.4.52",
|
|
100
97
|
"sideEffects": true
|
|
101
98
|
}
|
package/postinstall.js
CHANGED
|
@@ -21,8 +21,16 @@ if (fs.existsSync("../../vue/package.json")) {
|
|
|
21
21
|
var packJson = JSON.parse(fs.readFileSync("../../vue/package.json", "utf8"));
|
|
22
22
|
var version = parseInt(packJson.version.split(".")[0]);
|
|
23
23
|
console.log("Vue version ---" + version);
|
|
24
|
-
if (version != 3) {
|
|
25
24
|
var files = glob.sync("../ej2-vue-**/src/**/*.{component,directive}.js");
|
|
25
|
+
if (version === 3) {
|
|
26
|
+
files = files.concat(glob.sync('./src/**.js'));
|
|
27
|
+
for (var i = 0; i < files.length; i++){
|
|
28
|
+
var source = fs.readFileSync(files[i], "utf8");
|
|
29
|
+
var vuehead = (source.indexOf(`import Vue from 'vue';`) === -1) ? `import Vue from "vue"` : `import Vue from 'vue'`;
|
|
30
|
+
fs.writeFileSync(files[i], source.replace(vuehead, `import * as Vue from 'vue'`), "utf8");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (version != 3) {
|
|
26
34
|
files.push('./src/component-base.js');
|
|
27
35
|
var file;
|
|
28
36
|
for (var i = 0; i < files.length; i++) {
|
package/src/component-base.d.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Vue Component Base
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
import Vue from 'vue';
|
|
7
6
|
export declare const aVue: any;
|
|
8
7
|
export declare function _interopRequireWildcard(obj: any): any;
|
|
@@ -18,7 +17,7 @@ export declare class ComponentBase extends Vue {
|
|
|
18
17
|
protected hasChildDirective: boolean;
|
|
19
18
|
protected childDirObjects: string;
|
|
20
19
|
protected propKeys: any;
|
|
21
|
-
// //
|
|
20
|
+
// // constructor();
|
|
22
21
|
created(): void;
|
|
23
22
|
mounted(): void;
|
|
24
23
|
getInjectedServices(): Object[];
|
package/src/component-base.js
CHANGED
|
@@ -70,8 +70,15 @@ var ComponentBase = /** @class */ (function (_super) {
|
|
|
70
70
|
_loop_1(prop);
|
|
71
71
|
}
|
|
72
72
|
var injectables = getValue('$root.$options.provide', this);
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
var vueInjectables = getValue('$parent.$options.provide', this);
|
|
74
|
+
if (this.hasInjectedModules && !isExecute) {
|
|
75
|
+
var prevModule = [];
|
|
76
|
+
if (injectables) {
|
|
77
|
+
prevModule = injectables[this.ej2Instances.getModuleName()] || [];
|
|
78
|
+
}
|
|
79
|
+
else if (vueInjectables) {
|
|
80
|
+
prevModule = this.getInjectedServices() || [];
|
|
81
|
+
}
|
|
75
82
|
var curModule = this.ej2Instances.getInjectedModules() || [];
|
|
76
83
|
for (var _b = 0, curModule_1 = curModule; _b < curModule_1.length; _b++) {
|
|
77
84
|
var mod = curModule_1[_b];
|
|
@@ -94,13 +101,24 @@ var ComponentBase = /** @class */ (function (_super) {
|
|
|
94
101
|
};
|
|
95
102
|
ComponentBase.prototype.getInjectedServices = function () {
|
|
96
103
|
var ret = [];
|
|
97
|
-
var provide
|
|
104
|
+
var provide;
|
|
105
|
+
if (this.$vnode) {
|
|
106
|
+
provide = getValue('$vnode.context.$options.provide', this);
|
|
107
|
+
}
|
|
108
|
+
else if (this.$parent) {
|
|
109
|
+
provide = getValue('$parent.$options.provide', this);
|
|
110
|
+
}
|
|
98
111
|
if (provide) {
|
|
99
112
|
// tslint:disable:no-any
|
|
100
113
|
var injectables = provide;
|
|
101
114
|
if (typeof provide === 'function') {
|
|
102
115
|
// tslint:disable:no-any
|
|
103
|
-
|
|
116
|
+
if (this.$vnode) {
|
|
117
|
+
injectables = this.$vnode.context.$options.provide();
|
|
118
|
+
}
|
|
119
|
+
else if (this.$parent) {
|
|
120
|
+
injectables = this.$parent.$options.provide();
|
|
121
|
+
}
|
|
104
122
|
}
|
|
105
123
|
ret = injectables[this.ej2Instances.getModuleName()] || [];
|
|
106
124
|
}
|
|
@@ -1,406 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vue Component Base
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { isNullOrUndefined, extend, getValue } from '@syncfusion/ej2-base';
|
|
6
|
-
|
|
7
|
-
import * as Vue3 from 'vue-class-component';
|
|
8
|
-
import * as Vue2 from 'vue';
|
|
9
|
-
import Vue from 'vue';
|
|
10
|
-
|
|
11
|
-
export const aVue = _interopRequireWildcard(Vue2);
|
|
12
|
-
export function _interopRequireWildcard(obj: any) {
|
|
13
|
-
if (obj && obj.__esModule) {
|
|
14
|
-
return obj;
|
|
15
|
-
} else {
|
|
16
|
-
let newObj: any = {};
|
|
17
|
-
if (obj != null) {
|
|
18
|
-
for (let key in obj) {
|
|
19
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
newObj.default = obj;
|
|
23
|
-
return newObj;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const allVue: any = aVue;
|
|
28
|
-
export const gh: any = allVue.h;
|
|
29
|
-
export const isExecute: any = gh ? false : true;
|
|
30
|
-
|
|
31
|
-
let vueImport: any;
|
|
32
|
-
|
|
33
|
-
if (!isExecute || parseInt(allVue.version) < 3) {
|
|
34
|
-
vueImport = (Vue3 as any).Vue;
|
|
35
|
-
} else {
|
|
36
|
-
vueImport = Vue;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export class ComponentBase extends vueImport {
|
|
40
|
-
|
|
41
|
-
// tslint:disable:no-any
|
|
42
|
-
protected ej2Instances: any;
|
|
43
|
-
protected tagMapper: any;
|
|
44
|
-
protected tagNameMapper: any;
|
|
45
|
-
protected hasInjectedModules: boolean = false;
|
|
46
|
-
protected hasChildDirective: boolean = false;
|
|
47
|
-
protected childDirObjects: string = '';
|
|
48
|
-
protected propKeys: any;
|
|
49
|
-
|
|
50
|
-
constructor() {
|
|
51
|
-
super(arguments);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public created(): void {
|
|
55
|
-
if (!this.propKeys) {
|
|
56
|
-
return
|
|
57
|
-
}
|
|
58
|
-
for (let prop of this.propKeys) {
|
|
59
|
-
this.ej2Instances.addEventListener(prop, (args: object) => {
|
|
60
|
-
this.$emit(prop, args);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
let injectables: any = getValue('$root.$options.provide', this);
|
|
64
|
-
if (this.hasInjectedModules && !isExecute && injectables) {
|
|
65
|
-
let prevModule: Object[] = injectables[this.ej2Instances.getModuleName()] || [];
|
|
66
|
-
let curModule: Object[] = this.ej2Instances.getInjectedModules() || [];
|
|
67
|
-
for (let mod of curModule) {
|
|
68
|
-
if (prevModule.indexOf(mod) === -1) {
|
|
69
|
-
prevModule.push(mod);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
this.ej2Instances.injectedModules = prevModule;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
public mounted(): void {
|
|
77
|
-
this.ej2Instances.isVue = true;
|
|
78
|
-
this.ej2Instances.isVue3 = this.isVue3;
|
|
79
|
-
this.ej2Instances.vueInstance = this;
|
|
80
|
-
if (this.isVue3) {
|
|
81
|
-
this.ej2Instances.ej2Instances = this.ej2Instances;
|
|
82
|
-
this.ej2Instances.referModels = this.models;
|
|
83
|
-
}
|
|
84
|
-
this.ej2Instances.appendTo(this.$el);
|
|
85
|
-
}
|
|
86
|
-
public getInjectedServices(): Object[] {
|
|
87
|
-
let ret = [];
|
|
88
|
-
let provide: any = getValue('$vnode.context.$options.provide', this);
|
|
89
|
-
if (provide) {
|
|
90
|
-
// tslint:disable:no-any
|
|
91
|
-
let injectables: any = provide;
|
|
92
|
-
if (typeof provide === 'function') {
|
|
93
|
-
// tslint:disable:no-any
|
|
94
|
-
injectables = (this.$vnode.context.$options.provide as any)();
|
|
95
|
-
}
|
|
96
|
-
ret = injectables[this.ej2Instances.getModuleName()] || [];
|
|
97
|
-
}
|
|
98
|
-
return ret;
|
|
99
|
-
}
|
|
100
|
-
public updated(): void {
|
|
101
|
-
if (this.hasChildDirective) {
|
|
102
|
-
let childKey: Object = {};
|
|
103
|
-
this.fetchChildPropValues(childKey);
|
|
104
|
-
let curChildDir: string = JSON.stringify(childKey);
|
|
105
|
-
if (this.childDirObjects !== curChildDir) {
|
|
106
|
-
this.childDirObjects = curChildDir;
|
|
107
|
-
this.assignValueToWrapper(childKey, false);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
public beforeDestroy(): void {
|
|
113
|
-
let tempBeforeDestroyThis: any = this;
|
|
114
|
-
tempBeforeDestroyThis.ej2Instances.destroy();
|
|
115
|
-
(tempBeforeDestroyThis.$el as any).style.visibility = 'hidden';
|
|
116
|
-
tempBeforeDestroyThis = null;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
public bindProperties(): void {
|
|
120
|
-
let options: Object = {};
|
|
121
|
-
for (let prop of this.propKeys) {
|
|
122
|
-
if ((!isNullOrUndefined(this[prop]) && !this.isVue3) || (this[0] && !isNullOrUndefined(this[0][0]) && !isNullOrUndefined(this[0][0][prop]))) {
|
|
123
|
-
options[prop] = !this.isVue3 ? this[prop] : this[0][0][prop];
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
if (this.hasChildDirective) {
|
|
127
|
-
this.fetchChildPropValues(options);
|
|
128
|
-
}
|
|
129
|
-
if (this.hasInjectedModules) {
|
|
130
|
-
|
|
131
|
-
let prevModule: Object[] = this.getInjectedServices() || [];
|
|
132
|
-
let curModule: Object[] = this.ej2Instances.getInjectedModules() || [];
|
|
133
|
-
for (let mod of curModule) {
|
|
134
|
-
if (prevModule.indexOf(mod) === -1) {
|
|
135
|
-
prevModule.push(mod);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
this.ej2Instances.injectedModules = prevModule;
|
|
139
|
-
}
|
|
140
|
-
this.assignValueToWrapper(options);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
public assignValueToWrapper(option: Object, silent?: boolean): void {
|
|
144
|
-
this.ej2Instances.setProperties(extend({}, {}, option, true), isNullOrUndefined(silent as any) ? true : silent);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
public fetchChildPropValues(childOption: Object): void {
|
|
148
|
-
let dirProps: Object = {};
|
|
149
|
-
if(!this.isVue3) {
|
|
150
|
-
dirProps = this.getDirectiveValues( this.$slots.default, this.tagMapper || {}, this.tagNameMapper || {});
|
|
151
|
-
} else {
|
|
152
|
-
if (this[0] && this[0][1].slots.default) {
|
|
153
|
-
let propRef: any = this[0][1].slots.default();
|
|
154
|
-
for (let i: number = 0; i < propRef.length; i++) {
|
|
155
|
-
if (propRef[i].type.methods) {
|
|
156
|
-
let key: string = propRef[i].type.methods.getTag().replace("e-", "");
|
|
157
|
-
let ref: any = this.resolveArrayDirectives(propRef[i].children,key);
|
|
158
|
-
let splitKeys: any = key.split('-');
|
|
159
|
-
let controlName: string = this.ej2Instances.getModuleName().toLowerCase();
|
|
160
|
-
let keyRef: string = (splitKeys.length > 1 && controlName.indexOf(splitKeys[0])>-1) ? splitKeys[1]: splitKeys[0];
|
|
161
|
-
keyRef = keyRef.replace(controlName,'');
|
|
162
|
-
if (controlName == "splitter" && keyRef == "panes") {
|
|
163
|
-
keyRef = "paneSettings"
|
|
164
|
-
} else if (controlName == "bulletchart" && keyRef == "range") {
|
|
165
|
-
keyRef = "ranges";
|
|
166
|
-
}
|
|
167
|
-
dirProps[keyRef] = ref[key];
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
} else {
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
if (!this.childDirObjects) {
|
|
176
|
-
this.childDirObjects = JSON.stringify(dirProps);
|
|
177
|
-
}
|
|
178
|
-
for (let dirProp of Object.keys(dirProps)) {
|
|
179
|
-
childOption[dirProp] = dirProps[dirProp];
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
public resolveArrayDirectives(slots: any, tagName: any) {
|
|
184
|
-
let slot: any = [];
|
|
185
|
-
let innerDirValues: any;
|
|
186
|
-
slot = slots.default ? slots.default() : slots;
|
|
187
|
-
let items: any = {};
|
|
188
|
-
items[tagName] = [];
|
|
189
|
-
for (const childSlot of slot) {
|
|
190
|
-
let tempObj: any = {};
|
|
191
|
-
let tagRef: any = childSlot.type.methods ? childSlot.type.methods.getTag() : tagName;
|
|
192
|
-
if (childSlot.children) {
|
|
193
|
-
let key: string;
|
|
194
|
-
innerDirValues = this.resolveComplexDirs(childSlot.children, this.tagMapper["e-" + tagName], tagRef);
|
|
195
|
-
if (innerDirValues.length) {
|
|
196
|
-
tempObj = innerDirValues;
|
|
197
|
-
} else {
|
|
198
|
-
for(var i=0;i< Object.keys(innerDirValues).length;i++){
|
|
199
|
-
key = Object.keys(innerDirValues)[i];
|
|
200
|
-
tempObj[key] = innerDirValues[key];
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
if (childSlot.props) {
|
|
205
|
-
Object.keys(childSlot.props).forEach((key) => {
|
|
206
|
-
tempObj[key] = childSlot.props[key];
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
if ((/[s]\b/).test(tagRef) && innerDirValues) {
|
|
210
|
-
if (!(/[s]\b/).test(tagName) || innerDirValues.length) {
|
|
211
|
-
items[tagName] = tempObj;
|
|
212
|
-
} else {
|
|
213
|
-
items[tagName].push(tempObj);
|
|
214
|
-
}
|
|
215
|
-
} else {
|
|
216
|
-
items[tagName].push(tempObj);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
return items;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
public resolveComplexDirs(slots: any, tagObject: any, tagName: string) {
|
|
223
|
-
let slot: any = [];
|
|
224
|
-
let innerDirValues: any;
|
|
225
|
-
slot = slots.default ? slots.default() : slots;
|
|
226
|
-
let items: any = {};
|
|
227
|
-
for (const childSlot of slot) {
|
|
228
|
-
let tagRef: any;
|
|
229
|
-
let tag: any;
|
|
230
|
-
if (tagObject[tagName]) {
|
|
231
|
-
tagRef= Object.keys(tagObject[tagName]);
|
|
232
|
-
tag= tagRef.find(
|
|
233
|
-
(key: any) =>
|
|
234
|
-
tagObject[tagName][key] ===
|
|
235
|
-
childSlot.type.methods.getTag().replace(/[s]\b/, "")
|
|
236
|
-
);
|
|
237
|
-
tag = tag
|
|
238
|
-
? tag.replace("e-", "")
|
|
239
|
-
: childSlot.type.methods.getTag().replace("e-", "");
|
|
240
|
-
if (this.ej2Instances.getModuleName().toLowerCase() == "diagram" && tag.indexOf('annotations') !=-1) {
|
|
241
|
-
tag = 'annotations';
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
if (childSlot.children) {
|
|
245
|
-
innerDirValues = this.resolveComplexInnerDirs(childSlot.children, tagObject[tagName], childSlot.type.methods.getTag());
|
|
246
|
-
if (!items[tag]) {
|
|
247
|
-
items[tag] = [];
|
|
248
|
-
}
|
|
249
|
-
if (innerDirValues.length >1) {
|
|
250
|
-
items[tag] = innerDirValues;
|
|
251
|
-
} else {
|
|
252
|
-
items[tag].push(innerDirValues);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
if (slot.length > 1) {
|
|
256
|
-
items = Object.keys(items).length == 0 && !items.length ? [] : items;
|
|
257
|
-
if (childSlot.props) { items.push(childSlot.props); }
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
items = childSlot.props ? (<any>Object).assign(items, childSlot.props) : items;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
return items;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
public resolveComplexInnerDirs(slots: any, tagObject: any, tagName: string) {
|
|
267
|
-
let slot: any = [];
|
|
268
|
-
let innerDirValues: any;
|
|
269
|
-
slot = slots.default ? slots.default() : slots;
|
|
270
|
-
let items: any = slot.length > 1 ? [] : {};
|
|
271
|
-
for (const childSlot of slot) {
|
|
272
|
-
let tag: string = childSlot.type.methods.getTag().replace("e-", "");
|
|
273
|
-
if (childSlot.children) {
|
|
274
|
-
innerDirValues = this.resolveMultilevelComplexInnerDirs(childSlot.children, tagObject[tagName], childSlot.type.methods.getTag());
|
|
275
|
-
if ((/[s]\b/).test(tag) || slot.length > 1) {
|
|
276
|
-
if ((/[s]\b/).test(tag)) {
|
|
277
|
-
items[tag] = !items[tag] ? [] : items[tag];
|
|
278
|
-
if (innerDirValues.length) {
|
|
279
|
-
items[tag] = innerDirValues;
|
|
280
|
-
} else {items[tag].push(innerDirValues);}
|
|
281
|
-
} else if (innerDirValues) {
|
|
282
|
-
items.push(innerDirValues)
|
|
283
|
-
}
|
|
284
|
-
} else {
|
|
285
|
-
items = innerDirValues ? innerDirValues : items;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
if (slot.length > 1 && childSlot.props) {
|
|
290
|
-
if (items.length >= 0) {
|
|
291
|
-
items.push(childSlot.props);
|
|
292
|
-
} else {
|
|
293
|
-
items = childSlot.props ? (<any>Object).assign(items, childSlot.props) : items;
|
|
294
|
-
}
|
|
295
|
-
} else {
|
|
296
|
-
items = childSlot.props ? (<any>Object).assign(items, childSlot.props) : items;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
return items;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
public resolveMultilevelComplexInnerDirs(slots: any, tagObject: any, tagName: string) {
|
|
303
|
-
let slot: any = [];
|
|
304
|
-
let innerDirValues: any;
|
|
305
|
-
slot = slots.default ? slots.default() : slots;
|
|
306
|
-
let items: any = slot.length > 1 ? [] : {};
|
|
307
|
-
for (const childSlot of slot) {
|
|
308
|
-
let tag: string = childSlot.type.methods.getTag().replace("e-", "");
|
|
309
|
-
if (childSlot.children) {
|
|
310
|
-
innerDirValues = this.resolveComplexInnerDirs(childSlot.children, tagObject[tagName], childSlot.type.methods.getTag());
|
|
311
|
-
}
|
|
312
|
-
if((/[s]\b/).test(tag)) {
|
|
313
|
-
items[tag] = !items[tag] ? [] : items[tag];
|
|
314
|
-
if(innerDirValues.length) {
|
|
315
|
-
items[tag] = innerDirValues;
|
|
316
|
-
} else { items[tag].push(innerDirValues); }
|
|
317
|
-
if (childSlot.props) {items[tag].push(childSlot.props);}
|
|
318
|
-
} else {
|
|
319
|
-
items = innerDirValues;
|
|
320
|
-
items = childSlot.props ? (<any>Object).assign(items, childSlot.props) : items;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
return items;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
public getDirectiveValues(tagDirectives: any, tagMapper: { [key: string]: Object }, tagNameMapper: Object): Object {
|
|
327
|
-
let keyTags: string[] = Object.keys(tagMapper);
|
|
328
|
-
let dir: Object = {};
|
|
329
|
-
if (tagDirectives) {
|
|
330
|
-
for (let tagDirective of tagDirectives) {
|
|
331
|
-
if (tagDirective.componentOptions && tagDirective.componentOptions.children && tagDirective.componentOptions.tag) {
|
|
332
|
-
let dirTag: string = tagDirective.componentOptions.tag;
|
|
333
|
-
if (keyTags.indexOf(dirTag) !== -1) {
|
|
334
|
-
let tagName: string = tagNameMapper[dirTag] ? tagNameMapper[dirTag] : dirTag;
|
|
335
|
-
dir[tagName.replace('e-', '')] = [];
|
|
336
|
-
for (let tagDirChild of tagDirective.componentOptions.children) {
|
|
337
|
-
let retObj: Object = this.getVNodeValue(tagDirChild, tagMapper[dirTag], tagNameMapper);
|
|
338
|
-
if (Object.keys(retObj).length !== 0) {
|
|
339
|
-
dir[tagName.replace('e-', '')].push(retObj);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
return dir;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
public getMultiLevelDirValue(tagDirectories: any, tagKey: string | Object, tagNameMapper: Object): Object {
|
|
350
|
-
let mulObj: Object = {};
|
|
351
|
-
for (let tagDir of tagDirectories) {
|
|
352
|
-
if (tagDir.componentOptions) {
|
|
353
|
-
let key: string = tagDir.componentOptions.tag;
|
|
354
|
-
let tagName: string = tagNameMapper[key] ? tagNameMapper[key] : key;
|
|
355
|
-
mulObj[tagName.replace('e-', '')] = [];
|
|
356
|
-
if (tagDir.componentOptions && tagDir.componentOptions.children) {
|
|
357
|
-
for (let tagDirChild of tagDir.componentOptions.children) {
|
|
358
|
-
let mulLevObj: Object = this.getVNodeValue(tagDirChild, tagKey[key], tagNameMapper);
|
|
359
|
-
if (Object.keys(mulLevObj).length !== 0) {
|
|
360
|
-
mulObj[tagName.replace('e-', '')].push(mulLevObj);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
return mulObj;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
public getVNodeValue(tagDirective: any, tagKey: string | Object, tagNameMapper: Object): Object {
|
|
370
|
-
let ret: Object = {};
|
|
371
|
-
if (tagDirective.componentOptions) {
|
|
372
|
-
let dirTag: string = tagDirective.componentOptions.tag;
|
|
373
|
-
if (typeof tagKey === 'string' && dirTag === tagKey && tagDirective.data) {
|
|
374
|
-
ret = tagDirective.data.attrs ? this.getCamelCaseProps(tagDirective.data.attrs) : this.getCamelCaseProps(tagDirective.data);
|
|
375
|
-
} else if (typeof tagKey === 'object') {
|
|
376
|
-
if (tagDirective.componentOptions.children && (Object.keys(tagKey).indexOf(dirTag) !== -1)) {
|
|
377
|
-
ret = this.getMultiLevelDirValue(tagDirective.componentOptions.children, tagKey[dirTag], tagNameMapper);
|
|
378
|
-
}
|
|
379
|
-
if (tagDirective.data && tagDirective.data.attrs) {
|
|
380
|
-
ret = extend(ret, this.getCamelCaseProps(tagDirective.data.attrs));
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
return ret;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* convert kebab case directive props to camel case
|
|
389
|
-
*/
|
|
390
|
-
public getCamelCaseProps(props: Object): Object {
|
|
391
|
-
let retProps: Object = {};
|
|
392
|
-
for (let prop of Object.keys(props)) {
|
|
393
|
-
retProps[prop.replace(/-[a-z]/g, (e) => {return e[1].toUpperCase()})] = props[prop];
|
|
394
|
-
}
|
|
395
|
-
return retProps;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
public dataBind() {
|
|
399
|
-
this.ej2Instances.dataBind();
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
public setProperties(arg: Object, muteOnChange?: boolean): void {
|
|
403
|
-
return this.ej2Instances.setProperties(arg, muteOnChange);
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vue Component Base
|
|
3
|
-
*/
|
|
4
|
-
import Vue from 'vue';
|
|
5
|
-
// import { Base, Component as EJ2Component, isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
6
|
-
import { ComponentBase } from './component-base';
|
|
7
|
-
export let $internalHooks = [
|
|
8
|
-
'data',
|
|
9
|
-
'beforeCreate',
|
|
10
|
-
'created',
|
|
11
|
-
'beforeMount',
|
|
12
|
-
'mounted',
|
|
13
|
-
'beforeDestroy',
|
|
14
|
-
'destroyed',
|
|
15
|
-
'beforeUpdate',
|
|
16
|
-
'updated',
|
|
17
|
-
'activated',
|
|
18
|
-
'deactivated',
|
|
19
|
-
'render',
|
|
20
|
-
'errorCaptured' // 2.5
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
export function getProps(
|
|
24
|
-
options: any = {}
|
|
25
|
-
): any {
|
|
26
|
-
if (options.props) {
|
|
27
|
-
for (let prop of options.props) {
|
|
28
|
-
(options.newprops || (options.newprops = {}))[prop] = {
|
|
29
|
-
|
|
30
|
-
};
|
|
31
|
-
(options.watch || (options.watch = {}))[prop] = function (newVal: Object) { // watch it
|
|
32
|
-
this.ej2Instances[prop] = newVal;
|
|
33
|
-
if (this.dataBind && (options.name !== 'DateRangePickerComponent')) {
|
|
34
|
-
this.dataBind();
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return [options.newprops, options.watch];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function EJComponentDecorator(options: any, isExecute?: any): any {
|
|
43
|
-
if(!isExecute) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
return function (Component: any) {
|
|
47
|
-
return EJcomponentFactory(Component, options);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function EJcomponentFactory(
|
|
52
|
-
Component: any,
|
|
53
|
-
options: any = {}
|
|
54
|
-
): any {
|
|
55
|
-
options.name = options.name || (Component as any)._componentTag || (Component as any).name
|
|
56
|
-
// prototype props.
|
|
57
|
-
const proto = Component.prototype
|
|
58
|
-
if (options.props) {
|
|
59
|
-
for (let prop of options.props) {
|
|
60
|
-
(options.props || (options.props = {}))[prop] = {
|
|
61
|
-
|
|
62
|
-
};
|
|
63
|
-
(options.watch || (options.watch = {}))[prop] = function (newVal: Object) { // watch it
|
|
64
|
-
this.ej2Instances[prop] = newVal;
|
|
65
|
-
if (this.dataBind && (options.name !== 'DateRangePickerComponent')) {
|
|
66
|
-
this.dataBind();
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
Object.getOwnPropertyNames(proto).forEach(function (key) {
|
|
72
|
-
// hooks
|
|
73
|
-
if (key === 'constructor') {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
if ($internalHooks.indexOf(key) > -1) {
|
|
77
|
-
options[key] = proto[key]
|
|
78
|
-
return
|
|
79
|
-
}
|
|
80
|
-
const descriptor = Object.getOwnPropertyDescriptor(proto, key)!
|
|
81
|
-
if (typeof descriptor.value === 'function') {
|
|
82
|
-
// methods
|
|
83
|
-
(options.methods || (options.methods = {}))[key] = descriptor.value
|
|
84
|
-
} else if (descriptor.get || descriptor.set) {
|
|
85
|
-
// computed properties
|
|
86
|
-
(options.computed || (options.computed = {}))[key] = {
|
|
87
|
-
get: descriptor.get,
|
|
88
|
-
set: descriptor.set
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
Object.getOwnPropertyNames(ComponentBase.prototype).forEach(function (key) {
|
|
93
|
-
if ($internalHooks.indexOf(key) > -1) {
|
|
94
|
-
options[key] = proto[key]
|
|
95
|
-
return
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
(options.mixins || (options.mixins = [])).push({
|
|
99
|
-
data(this: Vue) {
|
|
100
|
-
return collectDataFromConstructor(this, Component)
|
|
101
|
-
}
|
|
102
|
-
})
|
|
103
|
-
// decorate options
|
|
104
|
-
const decorators = (Component as any).__decorators__
|
|
105
|
-
if (decorators) {
|
|
106
|
-
decorators.forEach(Function(options))
|
|
107
|
-
delete (Component as any).__decorators__
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// find super
|
|
111
|
-
const superProto = Object.getPrototypeOf(Component.prototype)
|
|
112
|
-
const Super = superProto instanceof Vue
|
|
113
|
-
? superProto.constructor as any
|
|
114
|
-
: Vue
|
|
115
|
-
const Extended = Super.extend(options)
|
|
116
|
-
|
|
117
|
-
return Extended
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function collectDataFromConstructor(vm: any, Component: any) {
|
|
121
|
-
Component.prototype._init = function () {
|
|
122
|
-
var _this = this;
|
|
123
|
-
var keys = Object.getOwnPropertyNames(vm);
|
|
124
|
-
if (vm.$options.props) {
|
|
125
|
-
for (var key in vm.$options.props) {
|
|
126
|
-
if (!vm.hasOwnProperty(key)) {
|
|
127
|
-
keys.push(key);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
keys.forEach(function (key) {
|
|
132
|
-
if (key.charAt(0) !== '_') {
|
|
133
|
-
Object.defineProperty(_this, key, {
|
|
134
|
-
get: function () { return vm[key]; },
|
|
135
|
-
set: function (value) { return vm[key] = value; }
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
};
|
|
140
|
-
var data = new Component();
|
|
141
|
-
var plainData = {};
|
|
142
|
-
Object.keys(data).forEach(function (key) {
|
|
143
|
-
if (data[key] !== undefined) {
|
|
144
|
-
plainData[key] = data[key];
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
return plainData;
|
|
148
|
-
}
|