render-core 1.0.127 → 1.0.128
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/class/component/component.d.ts +0 -12
- package/class/component/component.js +0 -36
- package/class/controller/appController.d.ts +3 -0
- package/class/controller/appController.js +3 -0
- package/class/tips/componentTip.d.ts +0 -4
- package/class/tips/renderTip.d.ts +0 -1
- package/core/lifecycle/afterMethods.js +0 -2
- package/core/lifecycle/controllerCycle.js +5 -17
- package/core/proxy/getProxy.js +0 -4
- package/core/render/PostRender.js +3 -9
- package/core/render/initRender.js +2 -8
- package/core/render/rawRender.js +7 -12
- package/core/render/updateRender.js +0 -9
- package/index.d.ts +1 -8
- package/index.js +2 -13
- package/package.json +1 -1
- package/runtime/tools.d.ts +0 -4
- package/runtime/tools.js +0 -19
|
@@ -13,10 +13,6 @@ export declare class Component implements RenderBase {
|
|
|
13
13
|
private readonly watcher?;
|
|
14
14
|
private readonly beforeRender?;
|
|
15
15
|
private readonly afterRender?;
|
|
16
|
-
private readonly beforeUpdate?;
|
|
17
|
-
private readonly afterUpdate?;
|
|
18
|
-
private readonly beforeMount?;
|
|
19
|
-
private readonly afterMount?;
|
|
20
16
|
constructor(config: {
|
|
21
17
|
name: string;
|
|
22
18
|
template: string;
|
|
@@ -28,10 +24,6 @@ export declare class Component implements RenderBase {
|
|
|
28
24
|
watcher?: {};
|
|
29
25
|
beforeRender?: () => void;
|
|
30
26
|
afterRender?: () => void;
|
|
31
|
-
beforeUpdate?: () => void;
|
|
32
|
-
afterUpdate?: () => void;
|
|
33
|
-
beforeMount?: () => void;
|
|
34
|
-
afterMount?: () => void;
|
|
35
27
|
});
|
|
36
28
|
getName(): string;
|
|
37
29
|
getTemplate(): string;
|
|
@@ -43,8 +35,4 @@ export declare class Component implements RenderBase {
|
|
|
43
35
|
getWatcher(): {};
|
|
44
36
|
getBeforeRender(): () => void;
|
|
45
37
|
getAfterRender(): () => void;
|
|
46
|
-
getBeforeUpdate(): () => void;
|
|
47
|
-
getAfterUpdate(): () => void;
|
|
48
|
-
getBeforeMount(): () => void;
|
|
49
|
-
getAfterMount(): () => void;
|
|
50
38
|
}
|
|
@@ -62,30 +62,6 @@ var Component = /** @class */ (function () {
|
|
|
62
62
|
else {
|
|
63
63
|
this.afterRender = config.afterRender;
|
|
64
64
|
}
|
|
65
|
-
if (typeof config.beforeUpdate === "undefined") {
|
|
66
|
-
this.beforeUpdate = function () { };
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
this.beforeUpdate = config.beforeUpdate;
|
|
70
|
-
}
|
|
71
|
-
if (typeof config.afterUpdate === "undefined") {
|
|
72
|
-
this.afterUpdate = function () { };
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
this.afterUpdate = config.afterUpdate;
|
|
76
|
-
}
|
|
77
|
-
if (typeof config.beforeMount === "undefined") {
|
|
78
|
-
this.beforeMount = function () { };
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
this.beforeMount = config.beforeMount;
|
|
82
|
-
}
|
|
83
|
-
if (typeof config.afterMount === "undefined") {
|
|
84
|
-
this.afterMount = function () { };
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
this.afterMount = config.afterMount;
|
|
88
|
-
}
|
|
89
65
|
}
|
|
90
66
|
Component.prototype.getName = function () {
|
|
91
67
|
return this.name;
|
|
@@ -117,18 +93,6 @@ var Component = /** @class */ (function () {
|
|
|
117
93
|
Component.prototype.getAfterRender = function () {
|
|
118
94
|
return this.afterRender;
|
|
119
95
|
};
|
|
120
|
-
Component.prototype.getBeforeUpdate = function () {
|
|
121
|
-
return this.beforeUpdate;
|
|
122
|
-
};
|
|
123
|
-
Component.prototype.getAfterUpdate = function () {
|
|
124
|
-
return this.afterUpdate;
|
|
125
|
-
};
|
|
126
|
-
Component.prototype.getBeforeMount = function () {
|
|
127
|
-
return this.beforeMount;
|
|
128
|
-
};
|
|
129
|
-
Component.prototype.getAfterMount = function () {
|
|
130
|
-
return this.afterMount;
|
|
131
|
-
};
|
|
132
96
|
return Component;
|
|
133
97
|
}());
|
|
134
98
|
export { Component };
|
|
@@ -19,6 +19,4 @@ export function afterMethodsTypeOne(controller, child, link) {
|
|
|
19
19
|
export function afterMethodsTypeTwo(controller, child, link) {
|
|
20
20
|
//将本控制对象保存到父控制对象的发布数组中
|
|
21
21
|
link.to.push(controller);
|
|
22
|
-
//将执行空间保存到父控制对象
|
|
23
|
-
link.link.set(child.getAttribute("name"), controller.raw_data);
|
|
24
22
|
}
|
|
@@ -10,29 +10,17 @@ import { getCodeSpaceForCommit, getCodeSpaceForProperty, getCodeSpaceForPublish,
|
|
|
10
10
|
* @param tagTemplate
|
|
11
11
|
*/
|
|
12
12
|
export function controllerCycleTypeOne(controller, proto, child, link, tagTemplate) {
|
|
13
|
-
//保持控制器模板对象
|
|
14
|
-
controller.proto = proto;
|
|
15
13
|
//复制原始数据对象到控制对象
|
|
16
14
|
controller.raw_data = link.link.get(child.getAttribute("name"));
|
|
17
|
-
|
|
18
|
-
inject(controller, tagTemplate);
|
|
19
|
-
//数据渲染代理对象
|
|
20
|
-
controller.proxyForMethods = getProxyObject(controller.raw_data, controller);
|
|
21
|
-
injectComputed(controller, proto);
|
|
22
|
-
injectWatcher(controller, proto);
|
|
23
|
-
injectMethod(controller, proto);
|
|
24
|
-
//注入commit
|
|
25
|
-
getCodeSpaceForCommit(controller.raw_data, getCommitMethod(link));
|
|
26
|
-
//注入receiver
|
|
27
|
-
getCodeSpaceForPublish(controller.raw_data, getPublishMethod(controller));
|
|
28
|
-
//注入setter
|
|
29
|
-
getCodeSpaceForProperty(controller.raw_data, getSetterMethod(controller));
|
|
15
|
+
cycleBridge(controller, proto, child, link, tagTemplate);
|
|
30
16
|
}
|
|
31
17
|
export function controllerCycleTypeTwo(controller, proto, child, link, tagTemplate) {
|
|
32
|
-
//保持控制器模板对象
|
|
33
|
-
controller.proto = proto;
|
|
34
18
|
//复制原始数据对象到控制对象
|
|
35
19
|
controller.raw_data = Object.create(proto.getData());
|
|
20
|
+
}
|
|
21
|
+
function cycleBridge(controller, proto, child, link, tagTemplate) {
|
|
22
|
+
//保持控制器模板对象
|
|
23
|
+
controller.proto = proto;
|
|
36
24
|
//向raw_data中注入元数据
|
|
37
25
|
inject(controller, tagTemplate);
|
|
38
26
|
//数据渲染代理对象
|
package/core/proxy/getProxy.js
CHANGED
|
@@ -28,12 +28,8 @@ export function getSetter(data, updater) {
|
|
|
28
28
|
}
|
|
29
29
|
//更新值
|
|
30
30
|
obj[prop] = value;
|
|
31
|
-
//更新前操作
|
|
32
|
-
this.proto.getBeforeUpdate.call(this.raw_data);
|
|
33
31
|
//执行更新
|
|
34
32
|
update_Render(this);
|
|
35
|
-
//更新后操作
|
|
36
|
-
this.proto.getAfterUpdate.call(this.raw_data);
|
|
37
33
|
return true;
|
|
38
34
|
};
|
|
39
35
|
return setter.bind(updater);
|
|
@@ -26,22 +26,16 @@ export function post_render(proto, parent, child, link, tagTemplate) {
|
|
|
26
26
|
beforeRender();
|
|
27
27
|
//解析指令
|
|
28
28
|
cmdUtility(tagTemplate, proto, controller);
|
|
29
|
-
//afterRender
|
|
30
|
-
var afterRender = proto.getAfterRender().bind(controller.raw_data);
|
|
31
|
-
afterRender();
|
|
32
|
-
//beforeMount
|
|
33
|
-
var beforeMount = proto.getBeforeMount().bind(controller.raw_data);
|
|
34
|
-
beforeMount();
|
|
35
29
|
//mount
|
|
36
30
|
mount(controller, proto, parent, child, tagTemplate);
|
|
37
|
-
//beforeMount
|
|
38
|
-
var afterMount = proto.getAfterMount().bind(controller.proxyForMethods);
|
|
39
|
-
afterMount();
|
|
40
31
|
injectRefs(controller);
|
|
41
32
|
//渲染后处理
|
|
42
33
|
afterCmd(controller.root, controller.proto, controller);
|
|
43
34
|
//后处理
|
|
44
35
|
afterMethodsTypeOne(controller, child, link);
|
|
36
|
+
//afterRender
|
|
37
|
+
var afterRender = proto.getAfterRender().bind(controller.raw_data);
|
|
38
|
+
afterRender();
|
|
45
39
|
//深度渲染
|
|
46
40
|
findComponent(controller.root.children, controller);
|
|
47
41
|
}
|
|
@@ -21,19 +21,13 @@ export function init_render(proto, parent, child, link, tagTemplate) {
|
|
|
21
21
|
resolver_solt(child, controller);
|
|
22
22
|
//控制对象预处理
|
|
23
23
|
controllerCycleTypeOne(controller, proto, child, link, tagTemplate);
|
|
24
|
-
|
|
24
|
+
//内存中模板处理
|
|
25
25
|
cmdUtility(tagTemplate, proto, controller);
|
|
26
|
-
//beforeMount
|
|
27
|
-
var beforeMount = proto.getBeforeMount().bind(controller.raw_data);
|
|
28
|
-
beforeMount();
|
|
29
26
|
//mount
|
|
30
27
|
mount(controller, proto, parent, child, tagTemplate);
|
|
31
|
-
//afterMount
|
|
32
|
-
var afterMount = proto.getAfterMount().bind(controller.proxyForMethods);
|
|
33
|
-
afterMount();
|
|
34
28
|
//获取
|
|
35
29
|
injectRefs(controller);
|
|
36
|
-
|
|
30
|
+
//渲染后数据处理
|
|
37
31
|
afterCmd(controller.root, proto, controller);
|
|
38
32
|
//后处理
|
|
39
33
|
afterMethodsTypeOne(controller, child, link);
|
package/core/render/rawRender.js
CHANGED
|
@@ -21,27 +21,22 @@ export function raw_render(proto, parent, child, link, tagTemplate) {
|
|
|
21
21
|
resolver_solt(child, controller);
|
|
22
22
|
//控制对象预处理
|
|
23
23
|
controllerCycleTypeTwo(controller, proto, child, link, tagTemplate);
|
|
24
|
-
//beforeRender
|
|
24
|
+
//beforeRender,可以获取数据而不触发更新
|
|
25
25
|
var beforeRender = proto.getBeforeRender().bind(controller.raw_data);
|
|
26
26
|
beforeRender();
|
|
27
|
-
|
|
27
|
+
//解析指令(模板处理)
|
|
28
28
|
cmdUtility(tagTemplate, proto, controller);
|
|
29
|
-
//afterRender
|
|
30
|
-
var afterRender = proto.getAfterRender().bind(controller.raw_data);
|
|
31
|
-
afterRender();
|
|
32
|
-
//beforeMount
|
|
33
|
-
var beforeMount = proto.getBeforeMount().bind(controller.raw_data);
|
|
34
|
-
beforeMount();
|
|
35
29
|
//mount
|
|
36
30
|
mount(controller, proto, parent, child, tagTemplate);
|
|
37
|
-
|
|
38
|
-
var afterMount = proto.getAfterMount().bind(controller.proxyForMethods);
|
|
39
|
-
afterMount();
|
|
31
|
+
//获取注入引用资源
|
|
40
32
|
injectRefs(controller);
|
|
41
33
|
//渲染后处理
|
|
42
34
|
afterCmd(controller.root, proto, controller);
|
|
43
|
-
|
|
35
|
+
//后处理(数据渲染)
|
|
44
36
|
afterMethodsTypeTwo(controller, child, link);
|
|
37
|
+
//afterRender,可以操作渲染后的dom
|
|
38
|
+
var afterRender = proto.getAfterRender().bind(controller.raw_data);
|
|
39
|
+
afterRender();
|
|
45
40
|
//深度渲染
|
|
46
41
|
findComponent(controller.root.children, controller);
|
|
47
42
|
}
|
|
@@ -13,18 +13,12 @@ export function update_Render(controller) {
|
|
|
13
13
|
var tagTemplate = getTemplate(controller.proto);
|
|
14
14
|
//清除保存的发布对象
|
|
15
15
|
controller.to = [];
|
|
16
|
-
//beforeRender
|
|
17
|
-
var beforeRender = controller.proto.getBeforeRender().bind(controller.raw_data);
|
|
18
|
-
beforeRender();
|
|
19
16
|
//解析指令
|
|
20
17
|
cmdUtility(tagTemplate, controller.proto, controller);
|
|
21
18
|
//unmount
|
|
22
19
|
while (controller.root.hasChildNodes()) {
|
|
23
20
|
controller.root.removeChild(controller.root.firstChild);
|
|
24
21
|
}
|
|
25
|
-
//beforeMount
|
|
26
|
-
var beforeMount = controller.proto.getBeforeMount().bind(controller.raw_data);
|
|
27
|
-
beforeMount();
|
|
28
22
|
//mount
|
|
29
23
|
while (tagTemplate.hasChildNodes()) {
|
|
30
24
|
controller.root.appendChild(tagTemplate.firstChild);
|
|
@@ -32,9 +26,6 @@ export function update_Render(controller) {
|
|
|
32
26
|
injectRefs(controller);
|
|
33
27
|
//渲染后处理
|
|
34
28
|
afterCmd(controller.root, controller.proto, controller);
|
|
35
|
-
//afterRender
|
|
36
|
-
var afterRender = controller.proto.getAfterRender().bind(controller.raw_data);
|
|
37
|
-
afterRender();
|
|
38
29
|
resolver_model(controller.root.children, controller.proxyForMethods);
|
|
39
30
|
//获取定位
|
|
40
31
|
locateInputAddress(controller);
|
package/index.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ export declare class RenderJS implements RenderTip {
|
|
|
8
8
|
readonly config: {};
|
|
9
9
|
readonly tagLib: Map<string, Component>;
|
|
10
10
|
readonly styleLib: Map<string, Map<string, string>>;
|
|
11
|
-
router: Object | Function;
|
|
12
11
|
private application;
|
|
13
12
|
private context;
|
|
14
13
|
page: PageController;
|
|
@@ -38,12 +37,6 @@ export declare class RenderJS implements RenderTip {
|
|
|
38
37
|
* @param mix
|
|
39
38
|
*/
|
|
40
39
|
pageMixin(mix: {}): void;
|
|
41
|
-
/**
|
|
42
|
-
* If you want to hava a permission control to your application,you can
|
|
43
|
-
* use our extra router moudle to define the router.
|
|
44
|
-
* @param router
|
|
45
|
-
*/
|
|
46
|
-
addRouter(router: Object | Function): void;
|
|
47
40
|
/**
|
|
48
41
|
* You can use the method to register your single component or an array of components.
|
|
49
42
|
* @param component
|
|
@@ -52,7 +45,7 @@ export declare class RenderJS implements RenderTip {
|
|
|
52
45
|
/**
|
|
53
46
|
* mount some base object
|
|
54
47
|
*/
|
|
55
|
-
mount
|
|
48
|
+
private mount;
|
|
56
49
|
/**
|
|
57
50
|
* This method is the boster method of the render.
|
|
58
51
|
*/
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PageController } from "./class/controller/pageController";
|
|
2
|
-
import {
|
|
2
|
+
import { registerTagLib, render } from "./runtime/tools";
|
|
3
3
|
import { AppController } from "./class/controller/appController";
|
|
4
4
|
import { ContextController } from "./class/controller/contextController";
|
|
5
5
|
/**
|
|
@@ -59,14 +59,6 @@ var RenderJS = /** @class */ (function () {
|
|
|
59
59
|
RenderJS.prototype.pageMixin = function (mix) {
|
|
60
60
|
this.page.mixin(mix);
|
|
61
61
|
};
|
|
62
|
-
/**
|
|
63
|
-
* If you want to hava a permission control to your application,you can
|
|
64
|
-
* use our extra router moudle to define the router.
|
|
65
|
-
* @param router
|
|
66
|
-
*/
|
|
67
|
-
RenderJS.prototype.addRouter = function (router) {
|
|
68
|
-
this.router = router;
|
|
69
|
-
};
|
|
70
62
|
/**
|
|
71
63
|
* You can use the method to register your single component or an array of components.
|
|
72
64
|
* @param component
|
|
@@ -83,9 +75,6 @@ var RenderJS = /** @class */ (function () {
|
|
|
83
75
|
Reflect.set(window, "appSite", this.application);
|
|
84
76
|
Reflect.set(window, "context", this.context);
|
|
85
77
|
Reflect.set(window, "page", this.page);
|
|
86
|
-
if (this.router) {
|
|
87
|
-
Reflect.set(window, "router", this.router);
|
|
88
|
-
}
|
|
89
78
|
};
|
|
90
79
|
/**
|
|
91
80
|
* This method is the boster method of the render.
|
|
@@ -94,7 +83,7 @@ var RenderJS = /** @class */ (function () {
|
|
|
94
83
|
//挂载对象
|
|
95
84
|
this.mount();
|
|
96
85
|
//execute
|
|
97
|
-
|
|
86
|
+
render(this);
|
|
98
87
|
};
|
|
99
88
|
return RenderJS;
|
|
100
89
|
}());
|
package/package.json
CHANGED
package/runtime/tools.d.ts
CHANGED
|
@@ -12,7 +12,3 @@ export declare function registerTagLib(application: RenderJS, component: Compone
|
|
|
12
12
|
* @param renderjs
|
|
13
13
|
*/
|
|
14
14
|
export declare function render(renderjs: RenderJS): void;
|
|
15
|
-
/**
|
|
16
|
-
* The executor function
|
|
17
|
-
*/
|
|
18
|
-
export declare function executor(renderjs: RenderJS): void;
|
package/runtime/tools.js
CHANGED
|
@@ -41,22 +41,3 @@ export function render(renderjs) {
|
|
|
41
41
|
//开始渲染
|
|
42
42
|
renderHtml(document.body.children, renderjs.page);
|
|
43
43
|
}
|
|
44
|
-
/**
|
|
45
|
-
* The executor function
|
|
46
|
-
*/
|
|
47
|
-
export function executor(renderjs) {
|
|
48
|
-
// @ts-ignore
|
|
49
|
-
if (window.router) {
|
|
50
|
-
try {
|
|
51
|
-
// @ts-ignore
|
|
52
|
-
window.router.security();
|
|
53
|
-
}
|
|
54
|
-
catch (e) {
|
|
55
|
-
console.log(e.message);
|
|
56
|
-
}
|
|
57
|
-
render(renderjs);
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
render(renderjs);
|
|
61
|
-
}
|
|
62
|
-
}
|