render-core 1.0.99 → 1.0.101
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/controller/contextController.d.ts +4 -0
- package/class/controller/contextController.js +7 -0
- package/class/controller/pageController.d.ts +1 -0
- package/class/controller/pageController.js +2 -0
- package/class/tips/renderTip.d.ts +7 -0
- package/class/tips/renderTip.js +1 -0
- package/core/cmd/react/v-model.js +3 -26
- package/{library → core}/lifecycle/controllerCycle.js +3 -3
- package/{library → core}/loader/loader.js +1 -1
- package/core/render/PostRender.js +5 -5
- package/core/render/initRender.js +5 -5
- package/core/render/rawRender.js +5 -5
- package/core/render/updateRender.js +2 -2
- package/core/utility/checkUtility.js +1 -1
- package/{library/cmd/cmd.d.ts → core/utility/cmdUtility.d.ts} +1 -8
- package/core/utility/cmdUtility.js +57 -0
- package/core/utility/modelUtility.d.ts +15 -0
- package/core/utility/modelUtility.js +36 -0
- package/core/utility/styleUtility.js +1 -1
- package/core/utility/vForUtility.d.ts +13 -0
- package/core/utility/vForUtility.js +13 -0
- package/index.d.ts +27 -1
- package/index.js +48 -24
- package/package.json +1 -1
- package/runtime/tools.d.ts +4 -0
- package/runtime/tools.js +29 -0
- package/library/cmd/cmd.js +0 -77
- /package/{library → core}/lifecycle/afterMethods.d.ts +0 -0
- /package/{library → core}/lifecycle/afterMethods.js +0 -0
- /package/{library → core}/lifecycle/controllerCycle.d.ts +0 -0
- /package/{library → core}/lifecycle/mount.d.ts +0 -0
- /package/{library → core}/lifecycle/mount.js +0 -0
- /package/{library → core}/loader/loader.d.ts +0 -0
- /package/runtime/{database/metaTagLib.d.ts → metaTagLib.d.ts} +0 -0
- /package/runtime/{database/metaTagLib.js → metaTagLib.js} +0 -0
|
@@ -7,6 +7,7 @@ var PageController = /** @class */ (function () {
|
|
|
7
7
|
this.to = Array();
|
|
8
8
|
this.crtTag = null;
|
|
9
9
|
this.solt = new Map();
|
|
10
|
+
this.mixin = {};
|
|
10
11
|
}
|
|
11
12
|
//接收器
|
|
12
13
|
PageController.prototype.receiver = function (method) {
|
|
@@ -14,6 +15,7 @@ var PageController = /** @class */ (function () {
|
|
|
14
15
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
15
16
|
args[_i - 1] = arguments[_i];
|
|
16
17
|
}
|
|
18
|
+
this.methods[method].call(args);
|
|
17
19
|
};
|
|
18
20
|
Object.defineProperty(PageController.prototype, "crtTag", {
|
|
19
21
|
//返回当前页面的渲染元素
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { compositionend, compositionstart, listerner } from "../../utility/modelUtility";
|
|
1
2
|
/**
|
|
2
3
|
* 绑定数据模型
|
|
3
4
|
* @param nodes
|
|
@@ -10,32 +11,8 @@ export function resolver_model(nodes, data) {
|
|
|
10
11
|
nodes[i].removeAttribute("v-model");
|
|
11
12
|
var tagName = nodes[i].tagName;
|
|
12
13
|
nodes[i].setAttribute("name", dataName);
|
|
13
|
-
if (tagName === "INPUT" || tagName === "SELECT" || tagName === "TEXTAREA") {
|
|
14
|
-
|
|
15
|
-
if (!evt.target.hasAttribute("flag")) {
|
|
16
|
-
//Get the event element
|
|
17
|
-
var element = evt.target;
|
|
18
|
-
//Get the name attribute
|
|
19
|
-
var dataName_1 = element.name;
|
|
20
|
-
Reflect.set(this, "origin", {
|
|
21
|
-
cpn: element.getAttribute("cpn"),
|
|
22
|
-
tag: element.nodeName,
|
|
23
|
-
name: element.getAttribute("name")
|
|
24
|
-
});
|
|
25
|
-
//Update the value
|
|
26
|
-
this[dataName_1] = element.value;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
var compositionstart = function (evt) {
|
|
30
|
-
evt.target.setAttribute("flag", "false");
|
|
31
|
-
};
|
|
32
|
-
var compositionend = function (evt) {
|
|
33
|
-
evt.target.setAttribute("flag", "true");
|
|
34
|
-
var element = evt.target;
|
|
35
|
-
var dataName = element.name;
|
|
36
|
-
this[dataName] = element.value;
|
|
37
|
-
};
|
|
38
|
-
nodes[i].addEventListener("input", listener.bind(data));
|
|
14
|
+
if (tagName === "INPUT" || tagName === "SELECT" || tagName === "TEXTAREA" || tagName === "DATALIST") {
|
|
15
|
+
nodes[i].addEventListener("input", listerner.bind(data));
|
|
39
16
|
nodes[i].addEventListener("compositionstart", compositionstart);
|
|
40
17
|
nodes[i].addEventListener("compositionend", compositionend.bind(data));
|
|
41
18
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { inject, injectComputed, injectMethod, injectWatcher } from "
|
|
2
|
-
import { getProxyObject } from "
|
|
3
|
-
import { getCodeSpaceForCommit, getCodeSpaceForProperty, getCodeSpaceForPublish, getCommitMethod, getPublishMethod, getSetterMethod } from "
|
|
1
|
+
import { inject, injectComputed, injectMethod, injectWatcher } from "../inject/inject";
|
|
2
|
+
import { getProxyObject } from "../proxy/getProxy";
|
|
3
|
+
import { getCodeSpaceForCommit, getCodeSpaceForProperty, getCodeSpaceForPublish, getCommitMethod, getPublishMethod, getSetterMethod } from "../utility/injectUtility";
|
|
4
4
|
/**
|
|
5
5
|
* This function is used to initiate the component controller object.
|
|
6
6
|
* @param controller
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ComponentController } from "../../class/controller/componentController";
|
|
2
|
-
import { controllerCycleTypeTwo } from "
|
|
3
|
-
import { afterCmd,
|
|
4
|
-
import { mount } from "
|
|
2
|
+
import { controllerCycleTypeTwo } from "../lifecycle/controllerCycle";
|
|
3
|
+
import { afterCmd, cmdUtility } from "../utility/cmdUtility";
|
|
4
|
+
import { mount } from "../lifecycle/mount";
|
|
5
5
|
import { injectRefs } from "../inject/inject";
|
|
6
|
-
import { afterMethodsTypeOne } from "
|
|
6
|
+
import { afterMethodsTypeOne } from "../lifecycle/afterMethods";
|
|
7
7
|
import { findComponent } from "./delivery";
|
|
8
8
|
import { resolver_solt } from "../cmd/solt/v-solt";
|
|
9
9
|
/**
|
|
@@ -25,7 +25,7 @@ export function post_render(proto, parent, child, link, tagTemplate) {
|
|
|
25
25
|
var beforeRender = proto.getBeforeRender().bind(controller.raw_data);
|
|
26
26
|
beforeRender();
|
|
27
27
|
//解析指令
|
|
28
|
-
|
|
28
|
+
cmdUtility(tagTemplate, proto, controller);
|
|
29
29
|
//beforeMount
|
|
30
30
|
var beforeMount = proto.getBeforeMount().bind(controller.raw_data);
|
|
31
31
|
beforeMount();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ComponentController } from "../../class/controller/componentController";
|
|
2
|
-
import { controllerCycleTypeOne } from "
|
|
3
|
-
import { afterCmd,
|
|
4
|
-
import { mount } from "
|
|
2
|
+
import { controllerCycleTypeOne } from "../lifecycle/controllerCycle";
|
|
3
|
+
import { afterCmd, cmdUtility } from "../utility/cmdUtility";
|
|
4
|
+
import { mount } from "../lifecycle/mount";
|
|
5
5
|
import { injectRefs } from "../inject/inject";
|
|
6
|
-
import { afterMethodsTypeOne } from "
|
|
6
|
+
import { afterMethodsTypeOne } from "../lifecycle/afterMethods";
|
|
7
7
|
import { findComponent } from "./delivery";
|
|
8
8
|
import { resolver_solt } from "../cmd/solt/v-solt";
|
|
9
9
|
/**
|
|
@@ -25,7 +25,7 @@ export function init_render(proto, parent, child, link, tagTemplate) {
|
|
|
25
25
|
var beforeRender = proto.getBeforeRender().bind(controller.raw_data);
|
|
26
26
|
beforeRender();
|
|
27
27
|
//内存中数据渲染
|
|
28
|
-
|
|
28
|
+
cmdUtility(tagTemplate, proto, controller);
|
|
29
29
|
//beforeMount
|
|
30
30
|
var beforeMount = proto.getBeforeMount().bind(controller.raw_data);
|
|
31
31
|
beforeMount();
|
package/core/render/rawRender.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ComponentController } from "../../class/controller/componentController";
|
|
2
|
-
import { controllerCycleTypeTwo } from "
|
|
3
|
-
import { afterCmd,
|
|
4
|
-
import { mount } from "
|
|
2
|
+
import { controllerCycleTypeTwo } from "../lifecycle/controllerCycle";
|
|
3
|
+
import { afterCmd, cmdUtility } from "../utility/cmdUtility";
|
|
4
|
+
import { mount } from "../lifecycle/mount";
|
|
5
5
|
import { injectRefs } from "../inject/inject";
|
|
6
|
-
import { afterMethodsTypeTwo } from "
|
|
6
|
+
import { afterMethodsTypeTwo } from "../lifecycle/afterMethods";
|
|
7
7
|
import { findComponent } from "./delivery";
|
|
8
8
|
import { resolver_solt } from "../cmd/solt/v-solt";
|
|
9
9
|
/**
|
|
@@ -25,7 +25,7 @@ export function raw_render(proto, parent, child, link, tagTemplate) {
|
|
|
25
25
|
var beforeRender = proto.getBeforeRender().bind(controller.raw_data);
|
|
26
26
|
beforeRender();
|
|
27
27
|
//解析指令
|
|
28
|
-
|
|
28
|
+
cmdUtility(tagTemplate, proto, controller);
|
|
29
29
|
//beforeMount
|
|
30
30
|
var beforeMount = proto.getBeforeMount().bind(controller.raw_data);
|
|
31
31
|
beforeMount();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterCmd,
|
|
1
|
+
import { afterCmd, cmdUtility, } from "../utility/cmdUtility";
|
|
2
2
|
import { injectRefs } from "../inject/inject";
|
|
3
3
|
import { findComponent } from "./delivery";
|
|
4
4
|
import { getTemplate } from "../utility/templateUtility";
|
|
@@ -17,7 +17,7 @@ export function update_Render(controller) {
|
|
|
17
17
|
var beforeRender = controller.proto.getBeforeRender().bind(controller.raw_data);
|
|
18
18
|
beforeRender();
|
|
19
19
|
//解析指令
|
|
20
|
-
|
|
20
|
+
cmdUtility(tagTemplate, controller.proto, controller);
|
|
21
21
|
//beforeUnmount
|
|
22
22
|
var beforeUnmount = controller.proto.getBeforeUnmount().bind(controller.raw_data);
|
|
23
23
|
beforeUnmount();
|
|
@@ -6,7 +6,7 @@ import { ComponentController } from "../../class/controller/componentController"
|
|
|
6
6
|
* @param proto
|
|
7
7
|
* @param controller
|
|
8
8
|
*/
|
|
9
|
-
export declare function
|
|
9
|
+
export declare function cmdUtility(tagTemplate: Element, proto: Component, controller: ComponentController): void;
|
|
10
10
|
/**
|
|
11
11
|
* This function is used to resolver those commands which should be executed after mount.
|
|
12
12
|
* @param templateSpace
|
|
@@ -14,10 +14,3 @@ export declare function cmd(tagTemplate: Element, proto: Component, controller:
|
|
|
14
14
|
* @param controller
|
|
15
15
|
*/
|
|
16
16
|
export declare function afterCmd(templateSpace: ParentNode, proto: Component, controller: ComponentController): void;
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
19
|
-
* @param tagTemplate
|
|
20
|
-
* @param proto
|
|
21
|
-
* @param controller
|
|
22
|
-
*/
|
|
23
|
-
export declare function cmdForUpdate(tagTemplate: Element, proto: Component, controller: ComponentController): void;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { addLabel } from "./miscUtility";
|
|
2
|
+
import { resolver_event } from "../cmd/method/v-on";
|
|
3
|
+
import { resolver_html } from "../cmd/data/v-html";
|
|
4
|
+
import { resolver_txt } from "../cmd/data/v-txt";
|
|
5
|
+
import { resolver_model } from "../cmd/react/v-model";
|
|
6
|
+
import { resolver_bind } from "../cmd/property/v-bind";
|
|
7
|
+
import { resolver_show } from "../cmd/justify/v-show";
|
|
8
|
+
import { resolver_render } from "../cmd/justify/v-render";
|
|
9
|
+
import { resolver_if } from "../cmd/justify/v-if";
|
|
10
|
+
import { resolver_switch } from "../cmd/justify/v-switch";
|
|
11
|
+
import { resolver_for_each, resolver_for_of } from "../cmd/loop/v-for";
|
|
12
|
+
import { extract_solt } from "../cmd/solt/v-solt";
|
|
13
|
+
import { resolver_experssion } from "../cmd/data/v-el";
|
|
14
|
+
/**
|
|
15
|
+
* This function is used to resolver those commands which should be executed before mount.
|
|
16
|
+
* @param tagTemplate
|
|
17
|
+
* @param proto
|
|
18
|
+
* @param controller
|
|
19
|
+
*/
|
|
20
|
+
export function cmdUtility(tagTemplate, proto, controller) {
|
|
21
|
+
//给所有元素添加上npm=tag标志
|
|
22
|
+
addLabel(tagTemplate.children, proto.getName());
|
|
23
|
+
//将元素事件绑定到元素上
|
|
24
|
+
resolver_event(tagTemplate.children, proto.getMethods(), controller.proxyForMethods);
|
|
25
|
+
//渲染html
|
|
26
|
+
resolver_html(tagTemplate.children, controller.proxyForMethods, controller);
|
|
27
|
+
//渲染text
|
|
28
|
+
resolver_txt(tagTemplate.children, controller.proxyForMethods, controller);
|
|
29
|
+
//绑定数据
|
|
30
|
+
resolver_model(tagTemplate.children, controller.proxyForMethods);
|
|
31
|
+
//渲染属性
|
|
32
|
+
resolver_bind(tagTemplate.children, controller.proxyForMethods);
|
|
33
|
+
//solt
|
|
34
|
+
extract_solt(tagTemplate.children, controller);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* This function is used to resolver those commands which should be executed after mount.
|
|
38
|
+
* @param templateSpace
|
|
39
|
+
* @param proto
|
|
40
|
+
* @param controller
|
|
41
|
+
*/
|
|
42
|
+
export function afterCmd(templateSpace, proto, controller) {
|
|
43
|
+
//v-show
|
|
44
|
+
resolver_show(templateSpace.children, controller.proxyForMethods);
|
|
45
|
+
//v-render
|
|
46
|
+
resolver_render(templateSpace.children, controller.proxyForMethods);
|
|
47
|
+
//v-if
|
|
48
|
+
resolver_if(templateSpace.children, controller.proxyForMethods);
|
|
49
|
+
//v-switch
|
|
50
|
+
resolver_switch(templateSpace.children, controller.proxyForMethods);
|
|
51
|
+
//v-for-each
|
|
52
|
+
resolver_for_each(templateSpace.children, controller.proxyForMethods);
|
|
53
|
+
//v-for-of
|
|
54
|
+
resolver_for_of(templateSpace.children, controller.proxyForMethods);
|
|
55
|
+
//v-el
|
|
56
|
+
resolver_experssion(controller.root, controller.proxyForMethods, controller);
|
|
57
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param evt
|
|
4
|
+
*/
|
|
5
|
+
export declare function compositionstart(evt: any): void;
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @param evt
|
|
9
|
+
*/
|
|
10
|
+
export declare function listerner(evt: any): void;
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param evt
|
|
14
|
+
*/
|
|
15
|
+
export declare function compositionend(evt: any): void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param evt
|
|
4
|
+
*/
|
|
5
|
+
export function compositionstart(evt) {
|
|
6
|
+
evt.target.setAttribute("flag", "false");
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param evt
|
|
11
|
+
*/
|
|
12
|
+
export function listerner(evt) {
|
|
13
|
+
if (!evt.target.hasAttribute("flag")) {
|
|
14
|
+
//Get the event element
|
|
15
|
+
var element = evt.target;
|
|
16
|
+
//Get the name attribute
|
|
17
|
+
var dataName = element.name;
|
|
18
|
+
Reflect.set(this, "origin", {
|
|
19
|
+
cpn: element.getAttribute("cpn"),
|
|
20
|
+
tag: element.nodeName,
|
|
21
|
+
name: element.getAttribute("name")
|
|
22
|
+
});
|
|
23
|
+
//Update the value
|
|
24
|
+
this[dataName] = element.value;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @param evt
|
|
30
|
+
*/
|
|
31
|
+
export function compositionend(evt) {
|
|
32
|
+
evt.target.setAttribute("flag", "true");
|
|
33
|
+
var element = evt.target;
|
|
34
|
+
var dataName = element.name;
|
|
35
|
+
this[dataName] = element.value;
|
|
36
|
+
}
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param baseRoot
|
|
4
|
+
* @param temp
|
|
5
|
+
* @param index
|
|
6
|
+
* @param data
|
|
7
|
+
*/
|
|
1
8
|
export declare function extractForArray(baseRoot: ParentNode, temp: Node, index: number, data: any): void;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param baseRoot
|
|
12
|
+
* @param temp
|
|
13
|
+
* @param data
|
|
14
|
+
*/
|
|
2
15
|
export declare function extractForMap(baseRoot: ParentNode, temp: Node, data: any): void;
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import { part_render_array, part_render_map } from "../render/partRender";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param baseRoot
|
|
5
|
+
* @param temp
|
|
6
|
+
* @param index
|
|
7
|
+
* @param data
|
|
8
|
+
*/
|
|
2
9
|
export function extractForArray(baseRoot, temp, index, data) {
|
|
3
10
|
part_render_array(baseRoot, temp, index, data);
|
|
4
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param baseRoot
|
|
15
|
+
* @param temp
|
|
16
|
+
* @param data
|
|
17
|
+
*/
|
|
5
18
|
export function extractForMap(baseRoot, temp, data) {
|
|
6
19
|
part_render_map(baseRoot, temp, data);
|
|
7
20
|
}
|
package/index.d.ts
CHANGED
|
@@ -1,17 +1,39 @@
|
|
|
1
1
|
import { Component } from "./class/component/component";
|
|
2
2
|
import { routerController } from "render-security/class/Router";
|
|
3
3
|
import { PageController } from "./class/controller/pageController";
|
|
4
|
+
import { RenderTip } from "./class/tips/renderTip";
|
|
4
5
|
/**
|
|
5
6
|
* This class is the application class.
|
|
6
7
|
*/
|
|
7
|
-
export declare class RenderJS {
|
|
8
|
+
export declare class RenderJS implements RenderTip {
|
|
8
9
|
readonly config: {};
|
|
9
10
|
readonly tagLib: Map<string, Component>;
|
|
10
11
|
readonly styleLib: Map<string, Map<string, string>>;
|
|
11
12
|
router: routerController;
|
|
12
13
|
private application;
|
|
14
|
+
private context;
|
|
13
15
|
page: PageController;
|
|
14
16
|
constructor();
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @param config
|
|
20
|
+
*/
|
|
21
|
+
configApp(config: {}): void;
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param cinfig
|
|
25
|
+
*/
|
|
26
|
+
configContext(cinfig: {}): void;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @param callable
|
|
30
|
+
*/
|
|
31
|
+
use(callable: any): void;
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @param mix
|
|
35
|
+
*/
|
|
36
|
+
mixin(mix: {}): void;
|
|
15
37
|
/**
|
|
16
38
|
* If you want to hava a permission control to your application,you can
|
|
17
39
|
* use our extra router moudle to define the router.
|
|
@@ -23,6 +45,10 @@ export declare class RenderJS {
|
|
|
23
45
|
* @param component
|
|
24
46
|
*/
|
|
25
47
|
addTag(component: Component | Component[]): void;
|
|
48
|
+
/**
|
|
49
|
+
* mount some base object
|
|
50
|
+
*/
|
|
51
|
+
mount(): void;
|
|
26
52
|
/**
|
|
27
53
|
* This method is the boster method of the render.
|
|
28
54
|
*/
|
package/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import meta from "./meta/meta";
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
import { redirect } from "render-security/utility/redirect";
|
|
4
1
|
import { PageController } from "./class/controller/pageController";
|
|
5
|
-
import {
|
|
2
|
+
import { executor, registerTagLib } from "./runtime/tools";
|
|
6
3
|
import { AppController } from "./class/controller/appController";
|
|
4
|
+
import { ContextController } from "./class/controller/contextController";
|
|
7
5
|
/**
|
|
8
6
|
* This class is the application class.
|
|
9
7
|
*/
|
|
@@ -15,13 +13,40 @@ var RenderJS = /** @class */ (function () {
|
|
|
15
13
|
this.styleLib = new Map();
|
|
16
14
|
//initiate the application controller
|
|
17
15
|
this.application = new AppController();
|
|
16
|
+
this.context = new ContextController();
|
|
18
17
|
//initiate the page controller
|
|
19
18
|
this.page = new PageController();
|
|
20
19
|
//initiate the config object
|
|
21
20
|
this.config = {};
|
|
22
|
-
Reflect.set(this.config, "version", meta.version);
|
|
23
|
-
Reflect.set(this.config, "theme", meta.style);
|
|
24
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param config
|
|
25
|
+
*/
|
|
26
|
+
RenderJS.prototype.configApp = function (config) {
|
|
27
|
+
throw new Error("Method not implemented.");
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @param cinfig
|
|
32
|
+
*/
|
|
33
|
+
RenderJS.prototype.configContext = function (cinfig) {
|
|
34
|
+
throw new Error("Method not implemented.");
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @param callable
|
|
39
|
+
*/
|
|
40
|
+
RenderJS.prototype.use = function (callable) {
|
|
41
|
+
callable(this);
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @param mix
|
|
46
|
+
*/
|
|
47
|
+
RenderJS.prototype.mixin = function (mix) {
|
|
48
|
+
this.page.mixin = mix;
|
|
49
|
+
};
|
|
25
50
|
/**
|
|
26
51
|
* If you want to hava a permission control to your application,you can
|
|
27
52
|
* use our extra router moudle to define the router.
|
|
@@ -38,28 +63,27 @@ var RenderJS = /** @class */ (function () {
|
|
|
38
63
|
registerTagLib(this, component);
|
|
39
64
|
};
|
|
40
65
|
/**
|
|
41
|
-
*
|
|
66
|
+
* mount some base object
|
|
42
67
|
*/
|
|
43
|
-
RenderJS.prototype.
|
|
68
|
+
RenderJS.prototype.mount = function () {
|
|
69
|
+
Reflect.set(window, "tagLib", this.tagLib);
|
|
70
|
+
Reflect.set(window, "styleLib", this.styleLib);
|
|
71
|
+
Reflect.set(window, "appSite", this.application);
|
|
72
|
+
Reflect.set(window, "context", this.context);
|
|
73
|
+
Reflect.set(window, "page", this.page);
|
|
44
74
|
if (this.router) {
|
|
45
|
-
this.router
|
|
46
|
-
if (typeof this.router.getRule(location.href) === "boolean") {
|
|
47
|
-
render(this);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
if (this.router.getRule(location.href).beforeRouter()) {
|
|
51
|
-
render(this);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
redirect("/http/400.html");
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
this.router.data.afterRouter();
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
render(this);
|
|
75
|
+
Reflect.set(window, "router", this.router);
|
|
61
76
|
}
|
|
62
77
|
};
|
|
78
|
+
/**
|
|
79
|
+
* This method is the boster method of the render.
|
|
80
|
+
*/
|
|
81
|
+
RenderJS.prototype.run = function () {
|
|
82
|
+
//挂载对象
|
|
83
|
+
this.mount();
|
|
84
|
+
//execute
|
|
85
|
+
executor(this);
|
|
86
|
+
};
|
|
63
87
|
return RenderJS;
|
|
64
88
|
}());
|
|
65
89
|
export { RenderJS };
|
package/package.json
CHANGED
package/runtime/tools.d.ts
CHANGED
package/runtime/tools.js
CHANGED
|
@@ -2,6 +2,7 @@ import { Component } from "../class/component/component";
|
|
|
2
2
|
import { themeStyle } from "../core/utility/styleUtility";
|
|
3
3
|
import { AppController } from "../class/controller/appController";
|
|
4
4
|
import { renderHtml } from "./runtime";
|
|
5
|
+
import { redirect } from "render-security/utility/redirect";
|
|
5
6
|
/**
|
|
6
7
|
* This function is used to save the protype component class in the window object.
|
|
7
8
|
* So, you can hava a tip that we customed a property named 'tagLib' in the window object.
|
|
@@ -48,3 +49,31 @@ export function render(renderjs) {
|
|
|
48
49
|
//开始渲染
|
|
49
50
|
renderHtml(document.body.children, renderjs.page);
|
|
50
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
export function executor(renderjs) {
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
if (window.router) {
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
window.router.data.beforeRouter();
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
if (typeof window.router.getRule(location.href) === "boolean") {
|
|
62
|
+
render(renderjs);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
if (window.router.getRule(location.href).beforeRouter()) {
|
|
67
|
+
render(renderjs);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
redirect("/http/400.html");
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// @ts-ignore
|
|
74
|
+
window.router.data.afterRouter();
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
render(renderjs);
|
|
78
|
+
}
|
|
79
|
+
}
|
package/library/cmd/cmd.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { addLabel } from "../../core/utility/miscUtility";
|
|
2
|
-
import { resolver_event } from "../../core/cmd/method/v-on";
|
|
3
|
-
import { resolver_html } from "../../core/cmd/data/v-html";
|
|
4
|
-
import { resolver_txt } from "../../core/cmd/data/v-txt";
|
|
5
|
-
import { resolver_model } from "../../core/cmd/react/v-model";
|
|
6
|
-
import { resolver_bind } from "../../core/cmd/property/v-bind";
|
|
7
|
-
import { resolver_show } from "../../core/cmd/justify/v-show";
|
|
8
|
-
import { resolver_render } from "../../core/cmd/justify/v-render";
|
|
9
|
-
import { resolver_if } from "../../core/cmd/justify/v-if";
|
|
10
|
-
import { resolver_switch } from "../../core/cmd/justify/v-switch";
|
|
11
|
-
import { resolver_for_each, resolver_for_of } from "../../core/cmd/loop/v-for";
|
|
12
|
-
import { extract_solt } from "../../core/cmd/solt/v-solt";
|
|
13
|
-
import { resolver_experssion } from "../../core/cmd/data/v-el";
|
|
14
|
-
/**
|
|
15
|
-
* This function is used to resolver those commands which should be executed before mount.
|
|
16
|
-
* @param tagTemplate
|
|
17
|
-
* @param proto
|
|
18
|
-
* @param controller
|
|
19
|
-
*/
|
|
20
|
-
export function cmd(tagTemplate, proto, controller) {
|
|
21
|
-
//给所有元素添加上npm=tag标志
|
|
22
|
-
addLabel(tagTemplate.children, proto.getName());
|
|
23
|
-
//将元素事件绑定到元素上
|
|
24
|
-
resolver_event(tagTemplate.children, proto.getMethods(), controller.proxyForMethods);
|
|
25
|
-
//渲染html
|
|
26
|
-
resolver_html(tagTemplate.children, controller.proxyForMethods, controller);
|
|
27
|
-
//渲染text
|
|
28
|
-
resolver_txt(tagTemplate.children, controller.proxyForMethods, controller);
|
|
29
|
-
//绑定数据
|
|
30
|
-
resolver_model(tagTemplate.children, controller.proxyForMethods);
|
|
31
|
-
//渲染属性
|
|
32
|
-
resolver_bind(tagTemplate.children, controller.proxyForMethods);
|
|
33
|
-
//solt
|
|
34
|
-
extract_solt(tagTemplate.children, controller);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* This function is used to resolver those commands which should be executed after mount.
|
|
38
|
-
* @param templateSpace
|
|
39
|
-
* @param proto
|
|
40
|
-
* @param controller
|
|
41
|
-
*/
|
|
42
|
-
export function afterCmd(templateSpace, proto, controller) {
|
|
43
|
-
//v-show
|
|
44
|
-
resolver_show(templateSpace.children, controller.proxyForMethods);
|
|
45
|
-
//v-render
|
|
46
|
-
resolver_render(templateSpace.children, controller.proxyForMethods);
|
|
47
|
-
//v-if
|
|
48
|
-
resolver_if(templateSpace.children, controller.proxyForMethods);
|
|
49
|
-
//v-switch
|
|
50
|
-
resolver_switch(templateSpace.children, controller.proxyForMethods);
|
|
51
|
-
//v-for-each
|
|
52
|
-
resolver_for_each(templateSpace.children, controller.proxyForMethods);
|
|
53
|
-
//v-for-of
|
|
54
|
-
resolver_for_of(templateSpace.children, controller.proxyForMethods);
|
|
55
|
-
//v-el
|
|
56
|
-
resolver_experssion(controller.root, controller.proxyForMethods, controller);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
*
|
|
60
|
-
* @param tagTemplate
|
|
61
|
-
* @param proto
|
|
62
|
-
* @param controller
|
|
63
|
-
*/
|
|
64
|
-
export function cmdForUpdate(tagTemplate, proto, controller) {
|
|
65
|
-
//给所有元素添加上npm=tag标志
|
|
66
|
-
addLabel(tagTemplate.children, proto.getName());
|
|
67
|
-
//将元素事件绑定到元素上
|
|
68
|
-
resolver_event(tagTemplate.children, proto.getMethods(), controller.proxyForMethods);
|
|
69
|
-
//渲染html
|
|
70
|
-
resolver_html(tagTemplate.children, controller.proxyForMethods, controller);
|
|
71
|
-
//渲染text
|
|
72
|
-
resolver_txt(tagTemplate.children, controller.proxyForMethods, controller);
|
|
73
|
-
//v-show
|
|
74
|
-
resolver_show(tagTemplate.children, controller.proxyForMethods);
|
|
75
|
-
//v-render
|
|
76
|
-
resolver_render(tagTemplate.children, controller.proxyForMethods);
|
|
77
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|