render-core 1.3.71 → 1.4.0
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/controller/ComponentController.d.ts +29 -0
- package/controller/ComponentController.js +30 -0
- package/controller/ContextController.d.ts +28 -0
- package/controller/ContextController.js +36 -0
- package/core/cmd/data/v-el.d.ts +3 -2
- package/core/cmd/data/v-html.d.ts +3 -2
- package/core/cmd/data/v-txt.d.ts +3 -2
- package/core/cmd/react/v-change.d.ts +6 -0
- package/core/cmd/react/v-change.js +22 -0
- package/core/cmd/solt/v-solt.d.ts +5 -5
- package/core/cmd/solt/v-solt.js +12 -12
- package/core/exexutor/executor.d.ts +7 -0
- package/core/exexutor/executor.js +24 -0
- package/core/inject/inject.d.ts +3 -2
- package/core/inject/inject.js +12 -9
- package/core/inject/injection.d.ts +22 -0
- package/core/inject/injection.js +50 -0
- package/core/lifecycle/afterMethods.d.ts +4 -4
- package/core/lifecycle/afterMethods.js +3 -3
- package/core/lifecycle/controllerCycle.d.ts +16 -7
- package/core/lifecycle/controllerCycle.js +47 -23
- package/core/lifecycle/mount.d.ts +4 -3
- package/core/lifecycle/mount.js +25 -5
- package/core/proxy/getProxy.d.ts +6 -8
- package/core/proxy/getProxy.js +15 -31
- package/core/proxy/proxy.d.ts +9 -0
- package/core/proxy/proxy.js +26 -0
- package/core/render/PostRender.js +7 -7
- package/core/render/delivery.js +1 -1
- package/core/render/initRender.js +3 -3
- package/core/render/rawRender.js +7 -7
- package/core/render/updateRender.js +8 -8
- package/core/resolver/props.js +6 -5
- package/core/utility/checkUtility.js +1 -1
- package/core/utility/cmdUtility.d.ts +4 -3
- package/core/utility/cmdUtility.js +15 -15
- package/core/utility/injectUtility.d.ts +0 -6
- package/core/utility/injectUtility.js +1 -35
- package/core/utility/inputType.d.ts +3 -3
- package/core/utility/inputType.js +5 -5
- package/core/utility/inputUtility.d.ts +1 -0
- package/core/utility/inputUtility.js +8 -0
- package/core/utility/sectionUtility.d.ts +1 -1
- package/core/utility/sectionUtility.js +18 -15
- package/core/utility/styleUtility.d.ts +4 -3
- package/core/utility/styleUtility.js +17 -29
- package/generic/ApplicationGeneric.d.ts +4 -0
- package/generic/ApplicationGeneric.js +1 -0
- package/generic/ConfigGeneric.d.ts +3 -0
- package/generic/ConfigGeneric.js +1 -0
- package/generic/ControllerGeneric.d.ts +22 -0
- package/generic/ControllerGeneric.js +1 -0
- package/generic/RenderGeneric.d.ts +1 -1
- package/generic/StyleGeneric.d.ts +4 -0
- package/generic/StyleGeneric.js +1 -0
- package/generic/originalDataGeneric.d.ts +4 -0
- package/generic/originalDataGeneric.js +1 -0
- package/http/generic/HttpGeneric.d.ts +3 -1
- package/index.d.ts +32 -14
- package/index.js +53 -34
- package/package.json +2 -2
- package/proto/controller/ComponentController.d.ts +11 -8
- package/proto/controller/ComponentController.js +8 -6
- package/proto/controller/PageController.d.ts +5 -5
- package/proto/controller/PageController.js +3 -3
- package/runtime/config/RenderConfig.d.ts +12 -0
- package/runtime/config/RenderConfig.js +11 -0
- package/runtime/config/config.d.ts +4 -0
- package/runtime/config/config.js +4 -0
- package/runtime/config.d.ts +3 -0
- package/runtime/config.js +3 -0
- package/runtime/delivery.d.ts +5 -0
- package/runtime/delivery.js +43 -0
- package/runtime/{Entrance.d.ts → entrance.d.ts} +2 -1
- package/runtime/entrance.js +33 -0
- package/runtime/render/PostRender.d.ts +15 -0
- package/runtime/render/PostRender.js +49 -0
- package/runtime/render/delivery.d.ts +5 -0
- package/runtime/render/delivery.js +42 -0
- package/runtime/render/initRender.d.ts +15 -0
- package/runtime/render/initRender.js +46 -0
- package/runtime/render/rawRender.d.ts +15 -0
- package/runtime/render/rawRender.js +50 -0
- package/runtime/renderProcessor.d.ts +11 -0
- package/runtime/{RenderProcessor.js → renderProcessor.js} +11 -8
- package/runtime/tag/TagProcessor.d.ts +9 -0
- package/runtime/tagProcessor.js +27 -0
- package/runtime/update/updateRender.d.ts +10 -0
- package/runtime/update/updateRender.js +38 -0
- package/runtime/Entrance.js +0 -14
- package/runtime/RenderProcessor.d.ts +0 -7
- /package/runtime/{TagProcessor.js → tag/TagProcessor.js} +0 -0
- /package/runtime/{TagProcessor.d.ts → tagProcessor.d.ts} +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Component } from "../../render-refer/dist";
|
|
2
|
+
import { ControllerGeneric } from "../generic/ControllerGeneric";
|
|
3
|
+
import { ContextController } from "./ContextController";
|
|
4
|
+
export declare class ComponentController implements ControllerGeneric {
|
|
5
|
+
componentAttachedRootElement: ParentNode | Element;
|
|
6
|
+
prototypeOfComponent: Component;
|
|
7
|
+
parentController: ComponentController | ContextController;
|
|
8
|
+
anchor: HTMLElement;
|
|
9
|
+
begin: HTMLElement;
|
|
10
|
+
componentConfig: {
|
|
11
|
+
boxMode: boolean;
|
|
12
|
+
plugins?: Map<string, any>;
|
|
13
|
+
};
|
|
14
|
+
originalData: {};
|
|
15
|
+
dataForMethod: {};
|
|
16
|
+
dataForComputed: {};
|
|
17
|
+
salt: Map<string, any>;
|
|
18
|
+
lazyComponent: Map<string, {}>;
|
|
19
|
+
slaveComponent: ComponentController[];
|
|
20
|
+
method: {};
|
|
21
|
+
computed: {};
|
|
22
|
+
watcher: {};
|
|
23
|
+
constructor(config: {
|
|
24
|
+
boxMode: boolean;
|
|
25
|
+
$plugins?: Map<string, any>;
|
|
26
|
+
});
|
|
27
|
+
receiver(method: string, ...args: any[]): any;
|
|
28
|
+
flush(): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { update_Render } from "../runtime/update/UpdateRender";
|
|
2
|
+
import RenderConfig from "../runtime/config/RenderConfig";
|
|
3
|
+
var ComponentController = /** @class */ (function () {
|
|
4
|
+
//构造函数
|
|
5
|
+
function ComponentController(config) {
|
|
6
|
+
this.originalData = {};
|
|
7
|
+
this.method = {};
|
|
8
|
+
this.dataForMethod = {};
|
|
9
|
+
this.computed = {};
|
|
10
|
+
this.dataForComputed = {};
|
|
11
|
+
this.watcher = {};
|
|
12
|
+
this.lazyComponent = new Map();
|
|
13
|
+
this.slaveComponent = Array();
|
|
14
|
+
this.salt = new Map();
|
|
15
|
+
this.componentConfig = config;
|
|
16
|
+
}
|
|
17
|
+
//接收器
|
|
18
|
+
ComponentController.prototype.receiver = function (method) {
|
|
19
|
+
var args = [];
|
|
20
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
21
|
+
args[_i - 1] = arguments[_i];
|
|
22
|
+
}
|
|
23
|
+
return this.prototypeOfComponent.getMethods()[method].apply(this.dataForMethod, args);
|
|
24
|
+
};
|
|
25
|
+
ComponentController.prototype.flush = function () {
|
|
26
|
+
update_Render(this, RenderConfig["tagLib"], RenderConfig["styleLib"]);
|
|
27
|
+
};
|
|
28
|
+
return ComponentController;
|
|
29
|
+
}());
|
|
30
|
+
export { ComponentController };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ComponentController } from "./ComponentController";
|
|
2
|
+
import { ControllerGeneric } from "../generic/ControllerGeneric";
|
|
3
|
+
import { Component } from "../../render-refer/dist";
|
|
4
|
+
export declare class ContextController implements ControllerGeneric {
|
|
5
|
+
componentAttachedRootElement: ParentNode | Element;
|
|
6
|
+
prototypeOfComponent: Component;
|
|
7
|
+
parentController: ComponentController | ContextController;
|
|
8
|
+
anchor: HTMLElement;
|
|
9
|
+
begin: HTMLElement;
|
|
10
|
+
componentConfig: {
|
|
11
|
+
boxMode: boolean;
|
|
12
|
+
$plugins?: Map<string, any>;
|
|
13
|
+
};
|
|
14
|
+
originalData: {};
|
|
15
|
+
dataForMethod: {};
|
|
16
|
+
dataForComputed: {};
|
|
17
|
+
salt: Map<string, any>;
|
|
18
|
+
lazyComponent: Map<string, {}>;
|
|
19
|
+
slaveComponent: ComponentController[];
|
|
20
|
+
method: {};
|
|
21
|
+
watcher: {};
|
|
22
|
+
computed: {};
|
|
23
|
+
constructor(config: {
|
|
24
|
+
boxMode: boolean;
|
|
25
|
+
});
|
|
26
|
+
receiver(method: string, ...args: any[]): void;
|
|
27
|
+
flush(): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import RenderConfig from "../runtime/config/RenderConfig";
|
|
2
|
+
var ContextController = /** @class */ (function () {
|
|
3
|
+
//构造函数
|
|
4
|
+
function ContextController(config) {
|
|
5
|
+
//注入系统方法
|
|
6
|
+
this.method = {};
|
|
7
|
+
this.originalData = {};
|
|
8
|
+
this.computed = {};
|
|
9
|
+
this.dataForComputed = {};
|
|
10
|
+
this.watcher = {};
|
|
11
|
+
this.lazyComponent = new Map();
|
|
12
|
+
this.slaveComponent = Array();
|
|
13
|
+
this.salt = new Map();
|
|
14
|
+
this.componentConfig = config;
|
|
15
|
+
}
|
|
16
|
+
//接收器
|
|
17
|
+
ContextController.prototype.receiver = function (method) {
|
|
18
|
+
var args = [];
|
|
19
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
20
|
+
args[_i - 1] = arguments[_i];
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
Reflect.get(this.method, method).call(this.dataForMethod, args);
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
console.error("Can not find method: ", method);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
ContextController.prototype.flush = function () {
|
|
30
|
+
if ("getAttribute" in this.componentAttachedRootElement) {
|
|
31
|
+
RenderConfig["render"].run(document.getElementById(this.componentAttachedRootElement.getAttribute("id")));
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return ContextController;
|
|
35
|
+
}());
|
|
36
|
+
export { ContextController };
|
package/core/cmd/data/v-el.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ComponentController } from "../../../
|
|
1
|
+
import { ComponentController } from "../../../controller/ComponentController";
|
|
2
|
+
import { ContextController } from "../../../controller/ContextController";
|
|
2
3
|
/**
|
|
3
4
|
*
|
|
4
5
|
* @param node
|
|
5
6
|
* @param data
|
|
6
7
|
* @param controller
|
|
7
8
|
*/
|
|
8
|
-
export declare function resolver_expression(node: ParentNode, data: {}, controller: ComponentController): void;
|
|
9
|
+
export declare function resolver_expression(node: ParentNode, data: {}, controller: ComponentController | ContextController): void;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ComponentController } from "../../../
|
|
1
|
+
import { ComponentController } from "../../../controller/ComponentController";
|
|
2
|
+
import { ContextController } from "../../../controller/ContextController";
|
|
2
3
|
/**
|
|
3
4
|
*
|
|
4
5
|
* @param elements
|
|
5
6
|
* @param data
|
|
6
7
|
* @param controller
|
|
7
8
|
*/
|
|
8
|
-
export declare function resolver_html(elements: HTMLCollection, data: {}, controller: ComponentController): void;
|
|
9
|
+
export declare function resolver_html(elements: HTMLCollection, data: {}, controller: ComponentController | ContextController): void;
|
package/core/cmd/data/v-txt.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ComponentController } from "../../../
|
|
1
|
+
import { ComponentController } from "../../../controller/ComponentController";
|
|
2
|
+
import { ContextController } from "../../../controller/ContextController";
|
|
2
3
|
/**
|
|
3
4
|
*
|
|
4
5
|
* @param elements
|
|
5
6
|
* @param data
|
|
6
7
|
* @param controller
|
|
7
8
|
*/
|
|
8
|
-
export declare function resolver_txt(elements: HTMLCollection, data: {}, controller: ComponentController): void;
|
|
9
|
+
export declare function resolver_txt(elements: HTMLCollection, data: {}, controller: ComponentController | ContextController): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { compositionend, compositionstart, listener_change } from "../../utility/modelUtility";
|
|
2
|
+
/**
|
|
3
|
+
* 绑定数据模型
|
|
4
|
+
* @param nodes
|
|
5
|
+
* @param data
|
|
6
|
+
*/
|
|
7
|
+
export function resolver_change(nodes, data) {
|
|
8
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
9
|
+
if (nodes[i].hasAttribute("@change")) {
|
|
10
|
+
var dataName = nodes[i].getAttribute("@change");
|
|
11
|
+
nodes[i].removeAttribute("@change");
|
|
12
|
+
var tagName = nodes[i].tagName;
|
|
13
|
+
nodes[i].setAttribute("name", dataName);
|
|
14
|
+
if (tagName === "INPUT" || tagName === "SELECT" || tagName === "TEXTAREA") {
|
|
15
|
+
nodes[i].addEventListener("compositionstart", compositionstart);
|
|
16
|
+
nodes[i].addEventListener("input", listener_change.bind(data));
|
|
17
|
+
nodes[i].addEventListener("compositionend", compositionend.bind(data));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
resolver_change(nodes[i].children, data);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { ComponentController } from "../../../
|
|
2
|
-
import {
|
|
1
|
+
import { ComponentController } from "../../../controller/ComponentController";
|
|
2
|
+
import { ContextController } from "../../../controller/ContextController";
|
|
3
3
|
/**
|
|
4
4
|
* 此函数用于解析自定义元素solt
|
|
5
5
|
* @param tagTemplate
|
|
6
6
|
* @param controller
|
|
7
7
|
*/
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function resolver_salt(tagTemplate: Element, controller: ComponentController | ContextController): void;
|
|
9
9
|
/**
|
|
10
|
-
* 此函数用于展开
|
|
10
|
+
* 此函数用于展开salt
|
|
11
11
|
* @param elements
|
|
12
12
|
* @param controller
|
|
13
13
|
*/
|
|
14
|
-
export declare function
|
|
14
|
+
export declare function extract_salt(elements: HTMLCollection, controller: ComponentController | ContextController): void;
|
package/core/cmd/solt/v-solt.js
CHANGED
|
@@ -3,37 +3,37 @@
|
|
|
3
3
|
* @param tagTemplate
|
|
4
4
|
* @param controller
|
|
5
5
|
*/
|
|
6
|
-
export function
|
|
6
|
+
export function resolver_salt(tagTemplate, controller) {
|
|
7
7
|
if (tagTemplate.hasChildNodes()) {
|
|
8
|
-
var list = tagTemplate.querySelectorAll("
|
|
8
|
+
var list = tagTemplate.querySelectorAll("salt");
|
|
9
9
|
if (list.length !== 0) {
|
|
10
10
|
list.forEach(function (value) {
|
|
11
11
|
if (value.hasAttribute("name")) {
|
|
12
|
-
controller.
|
|
12
|
+
controller.salt.set(value.getAttribute("name"), value.innerHTML);
|
|
13
13
|
}
|
|
14
14
|
else {
|
|
15
|
-
controller.
|
|
15
|
+
controller.salt.set("default", value.innerHTML);
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
else {
|
|
20
|
-
controller.
|
|
20
|
+
controller.salt.set("default", tagTemplate.innerHTML);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* 此函数用于展开
|
|
25
|
+
* 此函数用于展开salt
|
|
26
26
|
* @param elements
|
|
27
27
|
* @param controller
|
|
28
28
|
*/
|
|
29
|
-
export function
|
|
29
|
+
export function extract_salt(elements, controller) {
|
|
30
30
|
for (var i = 0; i < elements.length; i++) {
|
|
31
|
-
var result = elements[i].hasAttribute("@
|
|
31
|
+
var result = elements[i].hasAttribute("@salt");
|
|
32
32
|
if (result) {
|
|
33
|
-
var dataName = elements[i].getAttribute("@
|
|
34
|
-
elements[i].removeAttribute("@
|
|
33
|
+
var dataName = elements[i].getAttribute("@salt");
|
|
34
|
+
elements[i].removeAttribute("@salt");
|
|
35
35
|
if (!dataName) {
|
|
36
|
-
elements[i].innerHTML = controller.
|
|
36
|
+
elements[i].innerHTML = controller.salt.get("default");
|
|
37
37
|
}
|
|
38
38
|
else {
|
|
39
39
|
// @ts-ignore
|
|
@@ -41,6 +41,6 @@ export function extract_solt(elements, controller) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
//深度解析
|
|
44
|
-
|
|
44
|
+
extract_salt(elements[i].children, controller);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HooksGeneric } from "../../../render-refer/dist/generic/HooksGeneric";
|
|
2
|
+
export declare class Executor implements HooksGeneric {
|
|
3
|
+
relocate(position: string): void;
|
|
4
|
+
redirect(url: string, parameters: {}): void;
|
|
5
|
+
changeStyle(tag: string, theme: string): void;
|
|
6
|
+
changeTheme(theme: string): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { changeStyle, changeTheme } from "../utility/styleUtility";
|
|
2
|
+
import { redirect, relocate } from "../../http/Http";
|
|
3
|
+
var Executor = /** @class */ (function () {
|
|
4
|
+
function Executor() {
|
|
5
|
+
}
|
|
6
|
+
//文档hash定位
|
|
7
|
+
Executor.prototype.relocate = function (position) {
|
|
8
|
+
relocate(position);
|
|
9
|
+
};
|
|
10
|
+
//文档URL跳转
|
|
11
|
+
Executor.prototype.redirect = function (url, parameters) {
|
|
12
|
+
redirect(url, parameters);
|
|
13
|
+
};
|
|
14
|
+
//更改tag样式
|
|
15
|
+
Executor.prototype.changeStyle = function (tag, theme) {
|
|
16
|
+
changeStyle(tag, theme);
|
|
17
|
+
};
|
|
18
|
+
//更改主题样式
|
|
19
|
+
Executor.prototype.changeTheme = function (theme) {
|
|
20
|
+
changeTheme(theme);
|
|
21
|
+
};
|
|
22
|
+
return Executor;
|
|
23
|
+
}());
|
|
24
|
+
export { Executor };
|
package/core/inject/inject.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ComponentController } from "../../
|
|
1
|
+
import { ComponentController } from "../../controller/ComponentController";
|
|
2
2
|
import { Component } from "render-refer";
|
|
3
|
+
import { ContextController } from "../../controller/ContextController";
|
|
3
4
|
/**
|
|
4
5
|
* 向raw_data中注入props和Query
|
|
5
6
|
* @param controller
|
|
@@ -9,7 +10,7 @@ export declare function inject(controller: ComponentController): void;
|
|
|
9
10
|
*
|
|
10
11
|
* @param controller
|
|
11
12
|
*/
|
|
12
|
-
export declare function injectRefs(controller: ComponentController): void;
|
|
13
|
+
export declare function injectRefs(controller: ComponentController | ContextController): void;
|
|
13
14
|
/**
|
|
14
15
|
*
|
|
15
16
|
* @param controller
|
package/core/inject/inject.js
CHANGED
|
@@ -2,17 +2,20 @@ import { getCodeSpaceForProps, getCodeSpaceForQuery, getCodeSpaceForRef, } from
|
|
|
2
2
|
import { resolveProps } from "../resolver/props";
|
|
3
3
|
import { resolve_Queries } from "../resolver/query";
|
|
4
4
|
import { resolver_Refs } from "../cmd/ref/v-ref";
|
|
5
|
+
import RenderConfig from "../../runtime/config/RenderConfig";
|
|
5
6
|
/**
|
|
6
7
|
* 向raw_data中注入props和Query
|
|
7
8
|
* @param controller
|
|
8
9
|
*/
|
|
9
10
|
export function inject(controller) {
|
|
10
11
|
//注入name
|
|
11
|
-
Reflect.set(controller.
|
|
12
|
+
Reflect.set(controller.originalData, "$name", controller.prototypeOfComponent.getName());
|
|
13
|
+
//注入context
|
|
14
|
+
Reflect.set(controller.originalData, "$context", RenderConfig["context"]);
|
|
12
15
|
//注入props
|
|
13
|
-
getCodeSpaceForProps(controller.
|
|
16
|
+
getCodeSpaceForProps(controller.originalData, resolveProps(RenderConfig["crt"], controller.prototypeOfComponent.getProps()));
|
|
14
17
|
//注入query
|
|
15
|
-
getCodeSpaceForQuery(controller.
|
|
18
|
+
getCodeSpaceForQuery(controller.originalData, resolve_Queries());
|
|
16
19
|
}
|
|
17
20
|
/**
|
|
18
21
|
*
|
|
@@ -20,8 +23,8 @@ export function inject(controller) {
|
|
|
20
23
|
*/
|
|
21
24
|
export function injectRefs(controller) {
|
|
22
25
|
var refs = new Map();
|
|
23
|
-
resolver_Refs(controller.
|
|
24
|
-
getCodeSpaceForRef(controller.
|
|
26
|
+
resolver_Refs(controller.componentAttachedRootElement.children, refs);
|
|
27
|
+
getCodeSpaceForRef(controller.originalData, refs);
|
|
25
28
|
}
|
|
26
29
|
/**
|
|
27
30
|
*
|
|
@@ -32,10 +35,10 @@ export function injectMethod(controller, proto) {
|
|
|
32
35
|
var methods = Object.getOwnPropertyNames(proto.getMethods());
|
|
33
36
|
methods.forEach(function (value) {
|
|
34
37
|
if (value.match(/^\$\$[a-zA-Z0-9_]*/) !== null) {
|
|
35
|
-
Reflect.set(controller.
|
|
38
|
+
Reflect.set(controller.originalData, value, proto.getMethods()[value].bind(controller.originalData));
|
|
36
39
|
}
|
|
37
40
|
else {
|
|
38
|
-
Reflect.set(controller.
|
|
41
|
+
Reflect.set(controller.originalData, value, proto.getMethods()[value].bind(controller.dataForMethod));
|
|
39
42
|
}
|
|
40
43
|
});
|
|
41
44
|
}
|
|
@@ -47,7 +50,7 @@ export function injectMethod(controller, proto) {
|
|
|
47
50
|
export function injectWatcher(controller, proto) {
|
|
48
51
|
var methods = Object.getOwnPropertyNames(proto.getWatcher());
|
|
49
52
|
methods.forEach(function (value) {
|
|
50
|
-
Reflect.set(controller.watcher, value, proto.getWatcher()[value].bind(controller.
|
|
53
|
+
Reflect.set(controller.watcher, value, proto.getWatcher()[value].bind(controller.originalData));
|
|
51
54
|
});
|
|
52
55
|
}
|
|
53
56
|
/**
|
|
@@ -58,6 +61,6 @@ export function injectWatcher(controller, proto) {
|
|
|
58
61
|
export function injectComputed(controller, proto) {
|
|
59
62
|
var methods = Object.getOwnPropertyNames(proto.getComputed());
|
|
60
63
|
methods.forEach(function (value) {
|
|
61
|
-
Reflect.set(controller.computed, value, proto.getComputed()[value].bind(controller.
|
|
64
|
+
Reflect.set(controller.computed, value, proto.getComputed()[value].bind(controller.originalData));
|
|
62
65
|
});
|
|
63
66
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentController } from "../../controller/ComponentController";
|
|
2
|
+
import { ContextController } from "../../controller/ContextController";
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param controller
|
|
6
|
+
*/
|
|
7
|
+
export declare function getCommitMethod(controller: ComponentController | ContextController): any;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param controller
|
|
11
|
+
*/
|
|
12
|
+
export declare function getSetterMethod(controller: ComponentController | ContextController): any;
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param controller
|
|
16
|
+
*/
|
|
17
|
+
export declare function getGetterMethod(controller: ComponentController | ContextController): any;
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param controller
|
|
21
|
+
*/
|
|
22
|
+
export declare function getPublishMethod(controller: ComponentController | ContextController): any;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param controller
|
|
4
|
+
*/
|
|
5
|
+
export function getCommitMethod(controller) {
|
|
6
|
+
var commit = function (method) {
|
|
7
|
+
var args = [];
|
|
8
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
9
|
+
args[_i - 1] = arguments[_i];
|
|
10
|
+
}
|
|
11
|
+
return this.receiver(method, args);
|
|
12
|
+
};
|
|
13
|
+
return commit.bind(controller);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @param controller
|
|
18
|
+
*/
|
|
19
|
+
export function getSetterMethod(controller) {
|
|
20
|
+
var setter = function (property, value) {
|
|
21
|
+
this["$plugins"].set(property, value);
|
|
22
|
+
};
|
|
23
|
+
return setter.bind(controller.componentConfig);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @param controller
|
|
28
|
+
*/
|
|
29
|
+
export function getGetterMethod(controller) {
|
|
30
|
+
var getter = function (property) {
|
|
31
|
+
return this["$plugins"].get(property);
|
|
32
|
+
};
|
|
33
|
+
return getter.bind(controller.componentConfig);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @param controller
|
|
38
|
+
*/
|
|
39
|
+
export function getPublishMethod(controller) {
|
|
40
|
+
var publisher = function (method) {
|
|
41
|
+
var args = [];
|
|
42
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
43
|
+
args[_i - 1] = arguments[_i];
|
|
44
|
+
}
|
|
45
|
+
for (var i = 0; i < this.to.length; i++) {
|
|
46
|
+
this.to[i].receiver(method, args);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
return publisher.bind(controller);
|
|
50
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ComponentController } from "../../
|
|
2
|
-
import {
|
|
1
|
+
import { ComponentController } from "../../controller/ComponentController";
|
|
2
|
+
import { ContextController } from "../../controller/ContextController";
|
|
3
3
|
/**
|
|
4
4
|
* 该函数用于处理渲染后操作
|
|
5
5
|
* @param controller
|
|
6
6
|
* @param child
|
|
7
7
|
* @param link
|
|
8
8
|
*/
|
|
9
|
-
export declare function afterMethodsTypeOne(controller: ComponentController, child: Element, link: ComponentController |
|
|
9
|
+
export declare function afterMethodsTypeOne(controller: ComponentController, child: Element, link: ComponentController | ContextController): void;
|
|
10
10
|
/**
|
|
11
11
|
* 该函数用于处理渲染后操作
|
|
12
12
|
* @param controller
|
|
13
13
|
* @param child
|
|
14
14
|
* @param link
|
|
15
15
|
*/
|
|
16
|
-
export declare function afterMethodsTypeTwo(controller: ComponentController, child: Element, link: ComponentController |
|
|
16
|
+
export declare function afterMethodsTypeTwo(controller: ComponentController, child: Element, link: ComponentController | ContextController): void;
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export function afterMethodsTypeOne(controller, child, link) {
|
|
8
8
|
//将本控制对象保存到父控制对象的发布数组中
|
|
9
|
-
link.
|
|
9
|
+
link.slaveComponent.push(controller);
|
|
10
10
|
//将执行空间保存到父控制对象
|
|
11
|
-
link.
|
|
11
|
+
link.lazyComponent.set(child.getAttribute("name"), controller.originalData);
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* 该函数用于处理渲染后操作
|
|
@@ -18,5 +18,5 @@ export function afterMethodsTypeOne(controller, child, link) {
|
|
|
18
18
|
*/
|
|
19
19
|
export function afterMethodsTypeTwo(controller, child, link) {
|
|
20
20
|
//将本控制对象保存到父控制对象的发布数组中
|
|
21
|
-
link.
|
|
21
|
+
link.slaveComponent.push(controller);
|
|
22
22
|
}
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
import { ComponentController } from "../../
|
|
2
|
-
import {
|
|
1
|
+
import { ComponentController } from "../../controller/ComponentController";
|
|
2
|
+
import { ContextController } from "../../controller/ContextController";
|
|
3
3
|
import { Component } from "render-refer";
|
|
4
4
|
/**
|
|
5
5
|
* This function is used to initiate the component controller object.
|
|
6
6
|
* @param controller
|
|
7
|
-
* @param
|
|
7
|
+
* @param protoType
|
|
8
8
|
* @param child
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
9
|
+
* @param parentController
|
|
10
|
+
* @param tagLib
|
|
11
|
+
* @param styleLib
|
|
11
12
|
*/
|
|
12
|
-
export declare function controllerCycleTypeOne(controller: ComponentController,
|
|
13
|
-
|
|
13
|
+
export declare function controllerCycleTypeOne(controller: ComponentController, protoType: Component, child: Element, parentController: ComponentController | ContextController, tagLib: Map<string, Component>, styleLib: Map<string, Map<string, string>>): void;
|
|
14
|
+
/**
|
|
15
|
+
* This function is used to initiate the component controller object.
|
|
16
|
+
* @param controller
|
|
17
|
+
* @param protoType
|
|
18
|
+
* @param parentController
|
|
19
|
+
* @param tagLib
|
|
20
|
+
* @param styleLib
|
|
21
|
+
*/
|
|
22
|
+
export declare function controllerCycleTypeTwo(controller: ComponentController, protoType: Component, parentController: ComponentController | ContextController, tagLib: Map<string, Component>, styleLib: Map<string, Map<string, string>>): void;
|
|
@@ -1,42 +1,66 @@
|
|
|
1
1
|
import { inject, injectComputed, injectMethod, injectWatcher } from "../inject/inject";
|
|
2
|
-
import {
|
|
3
|
-
import { getCodeSpaceForCommit, getCodeSpaceForPublish, getCommitMethod, getGetCodeSpaceForProperty, getGetterMethod, getPublishMethod, getSetCodeSpaceForProperty, getSetterMethod } from "../utility/injectUtility";
|
|
2
|
+
import { getCodeSpaceForCommit, getCodeSpaceForPublish, getGetCodeSpaceForProperty, getSetCodeSpaceForProperty, } from "../utility/injectUtility";
|
|
4
3
|
import { dataInject } from "../utility/dataUtility";
|
|
4
|
+
import { getGetterProxy, getSetterProxy } from "../proxy/getProxy";
|
|
5
|
+
import { getCommitMethod, getGetterMethod, getPublishMethod, getSetterMethod } from "../inject/injection";
|
|
5
6
|
/**
|
|
6
7
|
* This function is used to initiate the component controller object.
|
|
7
8
|
* @param controller
|
|
8
|
-
* @param
|
|
9
|
+
* @param protoType
|
|
9
10
|
* @param child
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
11
|
+
* @param parentController
|
|
12
|
+
* @param tagLib
|
|
13
|
+
* @param styleLib
|
|
12
14
|
*/
|
|
13
|
-
export function controllerCycleTypeOne(controller,
|
|
15
|
+
export function controllerCycleTypeOne(controller, protoType, child, parentController, tagLib, styleLib) {
|
|
14
16
|
//复制原始数据对象到控制对象
|
|
15
|
-
controller.
|
|
16
|
-
cycleBridge(controller,
|
|
17
|
+
controller.originalData = parentController.lazyComponent.get(child.getAttribute("name"));
|
|
18
|
+
cycleBridge(controller, protoType, parentController, tagLib, styleLib);
|
|
17
19
|
}
|
|
18
|
-
|
|
20
|
+
/**
|
|
21
|
+
* This function is used to initiate the component controller object.
|
|
22
|
+
* @param controller
|
|
23
|
+
* @param protoType
|
|
24
|
+
* @param parentController
|
|
25
|
+
* @param tagLib
|
|
26
|
+
* @param styleLib
|
|
27
|
+
*/
|
|
28
|
+
export function controllerCycleTypeTwo(controller, protoType, parentController, tagLib, styleLib) {
|
|
19
29
|
//复制原始数据对象到控制对象
|
|
20
|
-
controller.
|
|
21
|
-
cycleBridge(controller,
|
|
30
|
+
controller.originalData = dataInject(protoType.getData());
|
|
31
|
+
cycleBridge(controller, protoType, parentController, tagLib, styleLib);
|
|
22
32
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @param controller
|
|
36
|
+
* @param protoType
|
|
37
|
+
* @param parentController
|
|
38
|
+
* @param tagLib
|
|
39
|
+
* @param styleLib
|
|
40
|
+
*/
|
|
41
|
+
function cycleBridge(controller, protoType, parentController, tagLib, styleLib) {
|
|
42
|
+
//保存控制器模板对象
|
|
43
|
+
controller.prototypeOfComponent = protoType;
|
|
44
|
+
//控制器盒子模型
|
|
45
|
+
controller.componentConfig.boxMode = protoType.getConfig()["mode"];
|
|
27
46
|
//向raw_data中注入元数据
|
|
28
47
|
inject(controller);
|
|
29
48
|
//数据渲染代理对象
|
|
30
|
-
controller.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
49
|
+
controller.dataForMethod = getSetterProxy(controller.originalData, controller, tagLib, styleLib);
|
|
50
|
+
//计算渲染代理对象
|
|
51
|
+
controller.dataForComputed = getGetterProxy(controller.originalData, controller);
|
|
52
|
+
//注入计算
|
|
53
|
+
injectComputed(controller, protoType);
|
|
54
|
+
//注入监视器
|
|
55
|
+
injectWatcher(controller, protoType);
|
|
56
|
+
//注入方法
|
|
57
|
+
injectMethod(controller, protoType);
|
|
34
58
|
//注入commit
|
|
35
|
-
getCodeSpaceForCommit(controller.
|
|
59
|
+
getCodeSpaceForCommit(controller.originalData, getCommitMethod(parentController));
|
|
36
60
|
//注入receiver
|
|
37
|
-
getCodeSpaceForPublish(controller.
|
|
61
|
+
getCodeSpaceForPublish(controller.originalData, getPublishMethod(controller));
|
|
38
62
|
//注入setter
|
|
39
|
-
getSetCodeSpaceForProperty(controller.
|
|
63
|
+
getSetCodeSpaceForProperty(controller.originalData, getSetterMethod(controller));
|
|
40
64
|
//注入getter
|
|
41
|
-
getGetCodeSpaceForProperty(controller.
|
|
65
|
+
getGetCodeSpaceForProperty(controller.originalData, getGetterMethod(controller));
|
|
42
66
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentController } from "../../
|
|
1
|
+
import { ComponentController } from "../../controller/ComponentController";
|
|
2
2
|
import { Component } from "render-refer";
|
|
3
3
|
/**
|
|
4
4
|
* This function is used to mount the dom to the html document.
|
|
@@ -9,8 +9,9 @@ import { Component } from "render-refer";
|
|
|
9
9
|
* @param tagTemplate
|
|
10
10
|
*/
|
|
11
11
|
export declare function mount(controller: ComponentController, proto: Component, parent: ParentNode, child: Element, tagTemplate: Element): void;
|
|
12
|
+
export declare function mountForUpdate(tagTemplate: Element): Element;
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
+
* Insert elements without div element
|
|
14
15
|
* @param root
|
|
15
16
|
*/
|
|
16
|
-
export declare function unBox(root:
|
|
17
|
+
export declare function unBox(root: ComponentController): void;
|