@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/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 });
|