render-core 1.0.117 → 1.0.119
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 +4 -4
- package/class/component/component.js +6 -6
- package/class/tips/componentTip.d.ts +1 -1
- package/core/inject/inject.d.ts +1 -2
- package/core/inject/inject.js +2 -3
- package/core/proxy/getProxy.js +2 -2
- package/core/render/PostRender.js +7 -4
- package/core/render/initRender.js +4 -7
- package/core/render/rawRender.js +7 -4
- package/core/render/updateRender.js +1 -4
- package/index.d.ts +2 -3
- package/package.json +1 -2
- package/runtime/tools.d.ts +1 -1
- package/runtime/tools.js +7 -17
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RenderBase } from "../tips/componentTip";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* This is the component class.
|
|
4
4
|
*/
|
|
5
5
|
export declare class Component implements RenderBase {
|
|
6
6
|
private readonly name;
|
|
@@ -16,7 +16,7 @@ export declare class Component implements RenderBase {
|
|
|
16
16
|
private readonly beforeUpdate?;
|
|
17
17
|
private readonly afterUpdate?;
|
|
18
18
|
private readonly beforeMount?;
|
|
19
|
-
private readonly
|
|
19
|
+
private readonly afterMount?;
|
|
20
20
|
constructor(config: {
|
|
21
21
|
name: string;
|
|
22
22
|
template: string;
|
|
@@ -31,7 +31,7 @@ export declare class Component implements RenderBase {
|
|
|
31
31
|
beforeUpdate?: () => void;
|
|
32
32
|
afterUpdate?: () => void;
|
|
33
33
|
beforeMount?: () => void;
|
|
34
|
-
|
|
34
|
+
afterMount?: () => void;
|
|
35
35
|
});
|
|
36
36
|
getName(): string;
|
|
37
37
|
getTemplate(): string;
|
|
@@ -46,5 +46,5 @@ export declare class Component implements RenderBase {
|
|
|
46
46
|
getBeforeUpdate(): () => void;
|
|
47
47
|
getAfterUpdate(): () => void;
|
|
48
48
|
getBeforeMount(): () => void;
|
|
49
|
-
|
|
49
|
+
getAfterMount(): () => void;
|
|
50
50
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* This is the component class.
|
|
3
3
|
*/
|
|
4
4
|
var Component = /** @class */ (function () {
|
|
5
5
|
function Component(config) {
|
|
@@ -80,11 +80,11 @@ var Component = /** @class */ (function () {
|
|
|
80
80
|
else {
|
|
81
81
|
this.beforeMount = config.beforeMount;
|
|
82
82
|
}
|
|
83
|
-
if (typeof config.
|
|
84
|
-
this.
|
|
83
|
+
if (typeof config.afterMount === "undefined") {
|
|
84
|
+
this.afterMount = function () { };
|
|
85
85
|
}
|
|
86
86
|
else {
|
|
87
|
-
this.
|
|
87
|
+
this.afterMount = config.afterMount;
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
Component.prototype.getName = function () {
|
|
@@ -126,8 +126,8 @@ var Component = /** @class */ (function () {
|
|
|
126
126
|
Component.prototype.getBeforeMount = function () {
|
|
127
127
|
return this.beforeMount;
|
|
128
128
|
};
|
|
129
|
-
Component.prototype.
|
|
130
|
-
return this.
|
|
129
|
+
Component.prototype.getAfterMount = function () {
|
|
130
|
+
return this.afterMount;
|
|
131
131
|
};
|
|
132
132
|
return Component;
|
|
133
133
|
}());
|
package/core/inject/inject.d.ts
CHANGED
|
@@ -9,9 +9,8 @@ export declare function inject(controller: ComponentController, tagTemplate: Ele
|
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
11
11
|
* @param controller
|
|
12
|
-
* @param tagTemplate
|
|
13
12
|
*/
|
|
14
|
-
export declare function injectRefs(controller: ComponentController
|
|
13
|
+
export declare function injectRefs(controller: ComponentController): void;
|
|
15
14
|
/**
|
|
16
15
|
*
|
|
17
16
|
* @param controller
|
package/core/inject/inject.js
CHANGED
|
@@ -16,9 +16,8 @@ export function inject(controller, tagTemplate) {
|
|
|
16
16
|
/**
|
|
17
17
|
*
|
|
18
18
|
* @param controller
|
|
19
|
-
* @param tagTemplate
|
|
20
19
|
*/
|
|
21
|
-
export function injectRefs(controller
|
|
20
|
+
export function injectRefs(controller) {
|
|
22
21
|
var refs = new Map();
|
|
23
22
|
resolver_Refs(controller.root.children, refs);
|
|
24
23
|
getCodeSpaceForRef(controller.raw_data, refs);
|
|
@@ -53,6 +52,6 @@ export function injectWatcher(controller, proto) {
|
|
|
53
52
|
export function injectComputed(controller, proto) {
|
|
54
53
|
var methods = Object.getOwnPropertyNames(proto.getComputed());
|
|
55
54
|
methods.forEach(function (value) {
|
|
56
|
-
Reflect.set(controller.computed, value, proto.getComputed()[value].bind(controller.
|
|
55
|
+
Reflect.set(controller.computed, value, proto.getComputed()[value].bind(controller.raw_data));
|
|
57
56
|
});
|
|
58
57
|
}
|
package/core/proxy/getProxy.js
CHANGED
|
@@ -28,11 +28,11 @@ export function getSetter(data, updater) {
|
|
|
28
28
|
//更新值
|
|
29
29
|
obj[prop] = value;
|
|
30
30
|
//更新前操作
|
|
31
|
-
this.proto.getBeforeUpdate();
|
|
31
|
+
this.proto.getBeforeUpdate.call(this.raw_data);
|
|
32
32
|
//执行更新
|
|
33
33
|
update_Render(this);
|
|
34
34
|
//更新后操作
|
|
35
|
-
this.proto.getAfterUpdate();
|
|
35
|
+
this.proto.getAfterUpdate.call(this.raw_data);
|
|
36
36
|
return true;
|
|
37
37
|
};
|
|
38
38
|
return setter.bind(updater);
|
|
@@ -26,17 +26,20 @@ 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();
|
|
29
32
|
//beforeMount
|
|
30
33
|
var beforeMount = proto.getBeforeMount().bind(controller.raw_data);
|
|
31
34
|
beforeMount();
|
|
32
35
|
//mount
|
|
33
36
|
mount(controller, proto, parent, child, tagTemplate);
|
|
34
|
-
|
|
37
|
+
//beforeMount
|
|
38
|
+
var afterMount = proto.getAfterMount().bind(controller.proxyForMethods);
|
|
39
|
+
afterMount();
|
|
40
|
+
injectRefs(controller);
|
|
35
41
|
//渲染后处理
|
|
36
42
|
afterCmd(controller.root, controller.proto, controller);
|
|
37
|
-
//afterRender
|
|
38
|
-
var afterRender = proto.getAfterRender().bind(controller.raw_data);
|
|
39
|
-
afterRender();
|
|
40
43
|
//后处理
|
|
41
44
|
afterMethodsTypeOne(controller, child, link);
|
|
42
45
|
//深度渲染
|
|
@@ -21,9 +21,6 @@ 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
|
-
//beforeRender
|
|
25
|
-
var beforeRender = proto.getBeforeRender().bind(controller.raw_data);
|
|
26
|
-
beforeRender();
|
|
27
24
|
//内存中数据渲染
|
|
28
25
|
cmdUtility(tagTemplate, proto, controller);
|
|
29
26
|
//beforeMount
|
|
@@ -31,13 +28,13 @@ export function init_render(proto, parent, child, link, tagTemplate) {
|
|
|
31
28
|
beforeMount();
|
|
32
29
|
//mount
|
|
33
30
|
mount(controller, proto, parent, child, tagTemplate);
|
|
31
|
+
//afterMount
|
|
32
|
+
var afterMount = proto.getAfterMount().bind(controller.proxyForMethods);
|
|
33
|
+
afterMount();
|
|
34
34
|
//获取
|
|
35
|
-
injectRefs(controller
|
|
35
|
+
injectRefs(controller);
|
|
36
36
|
//渲染后处理
|
|
37
37
|
afterCmd(controller.root, proto, controller);
|
|
38
|
-
//afterRender
|
|
39
|
-
var afterRender = proto.getAfterRender().bind(controller.proxyForMethods);
|
|
40
|
-
afterRender();
|
|
41
38
|
//后处理
|
|
42
39
|
afterMethodsTypeOne(controller, child, link);
|
|
43
40
|
//深度渲染
|
package/core/render/rawRender.js
CHANGED
|
@@ -26,17 +26,20 @@ export function raw_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();
|
|
29
32
|
//beforeMount
|
|
30
33
|
var beforeMount = proto.getBeforeMount().bind(controller.raw_data);
|
|
31
34
|
beforeMount();
|
|
32
35
|
//mount
|
|
33
36
|
mount(controller, proto, parent, child, tagTemplate);
|
|
34
|
-
|
|
37
|
+
//afterMount
|
|
38
|
+
var afterMount = proto.getAfterMount().bind(controller.proxyForMethods);
|
|
39
|
+
afterMount();
|
|
40
|
+
injectRefs(controller);
|
|
35
41
|
//渲染后处理
|
|
36
42
|
afterCmd(controller.root, proto, controller);
|
|
37
|
-
//afterRender
|
|
38
|
-
var afterRender = proto.getAfterRender().bind(controller.raw_data);
|
|
39
|
-
afterRender();
|
|
40
43
|
//后处理
|
|
41
44
|
afterMethodsTypeTwo(controller, child, link);
|
|
42
45
|
//深度渲染
|
|
@@ -18,9 +18,6 @@ export function update_Render(controller) {
|
|
|
18
18
|
beforeRender();
|
|
19
19
|
//解析指令
|
|
20
20
|
cmdUtility(tagTemplate, controller.proto, controller);
|
|
21
|
-
//beforeUnmount
|
|
22
|
-
var beforeUnmount = controller.proto.getBeforeUnmount().bind(controller.raw_data);
|
|
23
|
-
beforeUnmount();
|
|
24
21
|
//unmount
|
|
25
22
|
while (controller.root.hasChildNodes()) {
|
|
26
23
|
controller.root.removeChild(controller.root.firstChild);
|
|
@@ -32,7 +29,7 @@ export function update_Render(controller) {
|
|
|
32
29
|
while (tagTemplate.hasChildNodes()) {
|
|
33
30
|
controller.root.appendChild(tagTemplate.firstChild);
|
|
34
31
|
}
|
|
35
|
-
injectRefs(controller
|
|
32
|
+
injectRefs(controller);
|
|
36
33
|
//渲染后处理
|
|
37
34
|
afterCmd(controller.root, controller.proto, controller);
|
|
38
35
|
//afterRender
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Component } from "./class/component/component";
|
|
2
|
-
import { routerController } from "render-security/class/Router";
|
|
3
2
|
import { PageController } from "./class/controller/pageController";
|
|
4
3
|
import { RenderTip } from "./class/tips/renderTip";
|
|
5
4
|
/**
|
|
@@ -9,7 +8,7 @@ export declare class RenderJS implements RenderTip {
|
|
|
9
8
|
readonly config: {};
|
|
10
9
|
readonly tagLib: Map<string, Component>;
|
|
11
10
|
readonly styleLib: Map<string, Map<string, string>>;
|
|
12
|
-
router:
|
|
11
|
+
router: Object | Function;
|
|
13
12
|
private application;
|
|
14
13
|
private context;
|
|
15
14
|
page: PageController;
|
|
@@ -44,7 +43,7 @@ export declare class RenderJS implements RenderTip {
|
|
|
44
43
|
* use our extra router moudle to define the router.
|
|
45
44
|
* @param router
|
|
46
45
|
*/
|
|
47
|
-
addRouter(router:
|
|
46
|
+
addRouter(router: Object | Function): void;
|
|
48
47
|
/**
|
|
49
48
|
* You can use the method to register your single component or an array of components.
|
|
50
49
|
* @param component
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "render-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.119",
|
|
4
4
|
"description": "The core of render-js",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
},
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"render-security": "^1.0.4",
|
|
18
17
|
"render-status": "^1.0.0"
|
|
19
18
|
}
|
|
20
19
|
}
|
package/runtime/tools.d.ts
CHANGED
package/runtime/tools.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Component } from "../class/component/component";
|
|
2
2
|
import { themeStyle } from "../core/utility/styleUtility";
|
|
3
3
|
import { renderHtml } from "./runtime";
|
|
4
|
-
import { redirect } from "render-security/utility/redirect";
|
|
5
4
|
/**
|
|
6
5
|
* This function is used to save the protype component class in the window object.
|
|
7
6
|
* So, you can hava a tip that we customed a property named 'tagLib' in the window object.
|
|
@@ -43,28 +42,19 @@ export function render(renderjs) {
|
|
|
43
42
|
renderHtml(document.body.children, renderjs.page);
|
|
44
43
|
}
|
|
45
44
|
/**
|
|
46
|
-
*
|
|
45
|
+
* The executor function
|
|
47
46
|
*/
|
|
48
47
|
export function executor(renderjs) {
|
|
49
48
|
// @ts-ignore
|
|
50
49
|
if (window.router) {
|
|
51
|
-
|
|
52
|
-
window.router.data.beforeRouter();
|
|
53
|
-
// @ts-ignore
|
|
54
|
-
if (typeof window.router.getRule(location.href) === "boolean") {
|
|
55
|
-
render(renderjs);
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
50
|
+
try {
|
|
58
51
|
// @ts-ignore
|
|
59
|
-
|
|
60
|
-
render(renderjs);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
redirect("/http/400.html");
|
|
64
|
-
}
|
|
52
|
+
window.router.security();
|
|
65
53
|
}
|
|
66
|
-
|
|
67
|
-
|
|
54
|
+
catch (e) {
|
|
55
|
+
console.log(e.message);
|
|
56
|
+
}
|
|
57
|
+
render(renderjs);
|
|
68
58
|
}
|
|
69
59
|
else {
|
|
70
60
|
render(renderjs);
|