@syncfusion/ej2-vue-base 19.4.38 → 19.4.40
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 +8 -0
- package/README.md +1 -1
- package/dist/ej2-vue-base.umd.min.js +10 -1
- package/dist/global/ej2-vue-base.min.js +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +6 -24
- package/postinstall.js +9 -1
- package/src/component-base.d.ts +1 -2
- package/dist/ts/component-base.ts +0 -406
- package/dist/ts/component-decorator.ts +0 -148
- package/dist/ts/template.ts +0 -118
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
#### Bug Fixes
|
|
8
8
|
|
|
9
|
+
- `I334904`, `I347008` - Compatability support for Vue components in Vite js has been resolved.
|
|
10
|
+
|
|
11
|
+
## 19.4.38 (2021-12-17)
|
|
12
|
+
|
|
13
|
+
### Common
|
|
14
|
+
|
|
15
|
+
#### Bug Fixes
|
|
16
|
+
|
|
9
17
|
- `I348114` - Peer dependencies issue has been resolved.
|
|
10
18
|
|
|
11
19
|
## 19.3.47 (2021-10-26)
|
package/README.md
CHANGED
|
@@ -80,5 +80,5 @@ Check the license detail [here](https://github.com/syncfusion/ej2-vue-ui-compone
|
|
|
80
80
|
|
|
81
81
|
Check the changelog [here](https://ej2.syncfusion.com/vue/documentation/release-notes?utm_source=npm&utm_campaign=ej2-vue-base)
|
|
82
82
|
|
|
83
|
-
© Copyright
|
|
83
|
+
© Copyright 2021 Syncfusion, Inc. All Rights Reserved.
|
|
84
84
|
The Syncfusion Essential Studio license and copyright applies to this distribution.
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: ej2-vue-base.umd.min.js
|
|
3
|
-
* version : 19.4.
|
|
3
|
+
* version : 19.4.40
|
|
4
|
+
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
|
|
5
|
+
* Use of this code is subject to the terms of our license.
|
|
6
|
+
* A copy of the current license can be obtained at any time by e-mailing
|
|
7
|
+
* licensing@syncfusion.com. Any infringement will be prosecuted under
|
|
8
|
+
* applicable laws.
|
|
9
|
+
*/
|
|
10
|
+
/*!
|
|
11
|
+
* filename: ej2-vue-base.umd.min.js
|
|
12
|
+
* version : 19.2.55
|
|
4
13
|
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
|
|
5
14
|
* Use of this code is subject to the terms of our license.
|
|
6
15
|
* A copy of the current license can be obtained at any time by e-mailing
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: ej2-vue-base.min.js
|
|
3
|
-
* version : 19.4.
|
|
3
|
+
* version : 19.4.40
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version : 19.4.
|
|
3
|
+
* version : 19.4.40
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
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.38",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-dJeKjgvq/J0EiEeqZeIUq3eAhcFbDW52hqoAiHo8O98krYfYeytVrBg7hP4sVc8Hj6o7tfrZeCY+JyP2E+QL3A==",
|
|
6
6
|
"_location": "/@syncfusion/ej2-vue-base",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -18,41 +18,23 @@
|
|
|
18
18
|
},
|
|
19
19
|
"_requiredBy": [
|
|
20
20
|
"/",
|
|
21
|
-
"/@syncfusion/ej2-vue-barcode-generator",
|
|
22
|
-
"/@syncfusion/ej2-vue-buttons",
|
|
23
|
-
"/@syncfusion/ej2-vue-calendars",
|
|
24
21
|
"/@syncfusion/ej2-vue-charts",
|
|
25
|
-
"/@syncfusion/ej2-vue-circulargauge",
|
|
26
22
|
"/@syncfusion/ej2-vue-diagrams",
|
|
27
23
|
"/@syncfusion/ej2-vue-documenteditor",
|
|
28
24
|
"/@syncfusion/ej2-vue-dropdowns",
|
|
29
|
-
"/@syncfusion/ej2-vue-filemanager",
|
|
30
25
|
"/@syncfusion/ej2-vue-gantt",
|
|
31
26
|
"/@syncfusion/ej2-vue-grids",
|
|
32
|
-
"/@syncfusion/ej2-vue-heatmap",
|
|
33
|
-
"/@syncfusion/ej2-vue-inplace-editor",
|
|
34
|
-
"/@syncfusion/ej2-vue-inputs",
|
|
35
|
-
"/@syncfusion/ej2-vue-kanban",
|
|
36
|
-
"/@syncfusion/ej2-vue-layouts",
|
|
37
|
-
"/@syncfusion/ej2-vue-lineargauge",
|
|
38
|
-
"/@syncfusion/ej2-vue-lists",
|
|
39
|
-
"/@syncfusion/ej2-vue-maps",
|
|
40
27
|
"/@syncfusion/ej2-vue-navigations",
|
|
41
|
-
"/@syncfusion/ej2-vue-notifications",
|
|
42
28
|
"/@syncfusion/ej2-vue-pdfviewer",
|
|
43
29
|
"/@syncfusion/ej2-vue-pivotview",
|
|
44
|
-
"/@syncfusion/ej2-vue-popups",
|
|
45
|
-
"/@syncfusion/ej2-vue-progressbar",
|
|
46
|
-
"/@syncfusion/ej2-vue-querybuilder",
|
|
47
30
|
"/@syncfusion/ej2-vue-richtexteditor",
|
|
48
31
|
"/@syncfusion/ej2-vue-schedule",
|
|
49
32
|
"/@syncfusion/ej2-vue-splitbuttons",
|
|
50
33
|
"/@syncfusion/ej2-vue-spreadsheet",
|
|
51
|
-
"/@syncfusion/ej2-vue-treegrid"
|
|
52
|
-
"/@syncfusion/ej2-vue-treemap"
|
|
34
|
+
"/@syncfusion/ej2-vue-treegrid"
|
|
53
35
|
],
|
|
54
|
-
"_resolved": "http://nexus.syncfusion.com/repository/ej2-
|
|
55
|
-
"_shasum": "
|
|
36
|
+
"_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-vue-base/-/ej2-vue-base-19.4.38.tgz",
|
|
37
|
+
"_shasum": "c7f2ab36cf30de7b2806684110c31152a49ae15b",
|
|
56
38
|
"_spec": "@syncfusion/ej2-vue-base@*",
|
|
57
39
|
"_where": "/jenkins/workspace/automation_release_19.1.0.1-ZPMUBNQ6AUYH6YGEFBPVYMEQLRRW2SLD4XCZ6GATNZJFYJ3RIAOA/packages/included",
|
|
58
40
|
"author": {
|
|
@@ -96,6 +78,6 @@
|
|
|
96
78
|
"postinstall": "node ./postinstall.js"
|
|
97
79
|
},
|
|
98
80
|
"typings": "index.d.ts",
|
|
99
|
-
"version": "19.4.
|
|
81
|
+
"version": "19.4.40",
|
|
100
82
|
"sideEffects": true
|
|
101
83
|
}
|
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[];
|
|
@@ -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
|
-
}
|
package/dist/ts/template.ts
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import Vue from "vue";
|
|
2
|
-
import {
|
|
3
|
-
setTemplateEngine,
|
|
4
|
-
getTemplateEngine,
|
|
5
|
-
getUniqueID,
|
|
6
|
-
createElement,
|
|
7
|
-
detach,
|
|
8
|
-
extend,
|
|
9
|
-
getValue,
|
|
10
|
-
} from "@syncfusion/ej2-base";
|
|
11
|
-
|
|
12
|
-
import { aVue, allVue, gh } from "./component-base";
|
|
13
|
-
|
|
14
|
-
// tslint:disable:no-any
|
|
15
|
-
let stringCompiler: (
|
|
16
|
-
template: string,
|
|
17
|
-
helper?: object
|
|
18
|
-
) => (data: Object | JSON) => string = getTemplateEngine();
|
|
19
|
-
|
|
20
|
-
export function compile(
|
|
21
|
-
templateElement: any,
|
|
22
|
-
helper?: Object
|
|
23
|
-
): (data: Object | JSON, component?: any, propName?: any) => Object {
|
|
24
|
-
let that = this;
|
|
25
|
-
if (typeof templateElement === "string") {
|
|
26
|
-
return stringCompiler(templateElement, helper);
|
|
27
|
-
} else {
|
|
28
|
-
return (data: any, context: any,propName: any): any => {
|
|
29
|
-
let pid: string = getUniqueID("templateParentDiv");
|
|
30
|
-
let id: string = getUniqueID("templateDiv");
|
|
31
|
-
let ele: HTMLElement = createElement("div", {
|
|
32
|
-
id: pid,
|
|
33
|
-
innerHTML: '<div id="' + id + '"></div>',
|
|
34
|
-
});
|
|
35
|
-
document.body.appendChild(ele);
|
|
36
|
-
|
|
37
|
-
let tempObj: any = templateElement.call(that, {});
|
|
38
|
-
let returnEle: any;
|
|
39
|
-
if (context) {
|
|
40
|
-
if (gh) {
|
|
41
|
-
let object: any = tempObj;
|
|
42
|
-
let propsData: any = getValue("template.propsData", tempObj);
|
|
43
|
-
let dataObj: any = {
|
|
44
|
-
data: { data: extend(tempObj.data || {}, data) },
|
|
45
|
-
parent: context.vueInstance,
|
|
46
|
-
};
|
|
47
|
-
if (!object.template) {
|
|
48
|
-
object.template = object[Object.keys(object)[0]];
|
|
49
|
-
}
|
|
50
|
-
let templateCompRef: any;
|
|
51
|
-
if(object.template.extends) {
|
|
52
|
-
templateCompRef = object.template.extends._context.components.template;
|
|
53
|
-
} else {
|
|
54
|
-
templateCompRef = object.template._context.components[templateElement.name];
|
|
55
|
-
}
|
|
56
|
-
let tempRef: any;
|
|
57
|
-
if (propsData) {
|
|
58
|
-
tempRef = (<any>Object).assign(templateCompRef.data(), propsData);
|
|
59
|
-
} else {
|
|
60
|
-
tempRef = (<any>Object).assign(templateCompRef.data(), dataObj.data);
|
|
61
|
-
if(templateCompRef.components){
|
|
62
|
-
let objkeys: any = Object.keys(templateCompRef.components) || [];
|
|
63
|
-
for(let objstring of objkeys){
|
|
64
|
-
let intComponent: any = templateCompRef.components[objstring]
|
|
65
|
-
if(intComponent && intComponent.data){
|
|
66
|
-
let tempRef2: any = (Object as any).assign(intComponent.data(), dataObj.data);
|
|
67
|
-
intComponent.data = function() {return tempRef2};
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
templateCompRef.data = function () { return tempRef; };
|
|
73
|
-
allVue
|
|
74
|
-
.createApp(templateCompRef)
|
|
75
|
-
.mount("#" + id);
|
|
76
|
-
returnEle = ele.childNodes;
|
|
77
|
-
detach(ele);
|
|
78
|
-
} else {
|
|
79
|
-
let templateFunction = tempObj.template;
|
|
80
|
-
let propsData: any = getValue("template.propsData", tempObj);
|
|
81
|
-
let dataObj: any = {
|
|
82
|
-
data: { data: extend(tempObj.data || {}, data) },
|
|
83
|
-
parent: context.vueInstance,
|
|
84
|
-
};
|
|
85
|
-
if (propsData) {
|
|
86
|
-
templateFunction = tempObj.template.extends;
|
|
87
|
-
dataObj.propsData = propsData;
|
|
88
|
-
}
|
|
89
|
-
if (typeof templateFunction !== "function") {
|
|
90
|
-
templateFunction = Vue.extend(templateFunction);
|
|
91
|
-
}
|
|
92
|
-
let templateVue: any = new templateFunction(dataObj);
|
|
93
|
-
// let templateVue = new Vue(tempObj.template);
|
|
94
|
-
// templateVue.$data.data = extend(tempObj.data, data);
|
|
95
|
-
templateVue.$mount("#" + id);
|
|
96
|
-
returnEle = ele.childNodes;
|
|
97
|
-
if (context.vueInstance) {
|
|
98
|
-
let templateInstance: any = context.vueInstance.templateCollection;
|
|
99
|
-
if (!templateInstance) {
|
|
100
|
-
context.vueInstance.templateCollection = {};
|
|
101
|
-
templateInstance = context.vueInstance.templateCollection;
|
|
102
|
-
}
|
|
103
|
-
if (propName) {
|
|
104
|
-
if (!templateInstance[propName]) {
|
|
105
|
-
templateInstance[propName] = [];
|
|
106
|
-
}
|
|
107
|
-
templateInstance[propName].push(returnEle[0]);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
detach(ele);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return returnEle || [];
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
setTemplateEngine({ compile: compile as any });
|