render-core 1.0.71 → 1.0.73
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/apiController.d.ts +1 -0
- package/class/controller/apiController.js +1 -0
- package/class/controller/controller.d.ts +1 -0
- package/class/controller/controller.js +1 -0
- package/class/controller/pageController.d.ts +1 -0
- package/class/controller/pageController.js +1 -0
- package/core/cmd/v-solt.d.ts +15 -0
- package/core/cmd/v-solt.js +47 -0
- package/core/render/PostRender.js +3 -0
- package/core/render/initRender.js +3 -0
- package/core/render/rawRender.js +3 -0
- package/library/cmd/cmd.js +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Controller } from "../../class/controller/controller";
|
|
2
|
+
import { ApiController } from "../../class/controller/apiController";
|
|
3
|
+
import { PageController } from "../../class/controller/pageController";
|
|
4
|
+
/**
|
|
5
|
+
* 此函数用于解析自定义元素solt
|
|
6
|
+
* @param tagTemplate
|
|
7
|
+
* @param controller
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolver_solt(tagTemplate: Element, controller: Controller | ApiController | PageController): void;
|
|
10
|
+
/**
|
|
11
|
+
* 此函数用于展开solt
|
|
12
|
+
* @param elements
|
|
13
|
+
* @param controller
|
|
14
|
+
*/
|
|
15
|
+
export declare function extract_solt(elements: HTMLCollection, controller: Controller | ApiController | PageController): void;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 此函数用于解析自定义元素solt
|
|
3
|
+
* @param tagTemplate
|
|
4
|
+
* @param controller
|
|
5
|
+
*/
|
|
6
|
+
export function resolver_solt(tagTemplate, controller) {
|
|
7
|
+
if (tagTemplate.hasChildNodes()) {
|
|
8
|
+
if (tagTemplate.children) {
|
|
9
|
+
for (var i = 0; i < tagTemplate.children.length; i++) {
|
|
10
|
+
if (tagTemplate.children[i].nodeName.toUpperCase() === "SOLT") {
|
|
11
|
+
if (tagTemplate.children[i].hasAttribute("name")) {
|
|
12
|
+
controller.solt.set(tagTemplate.children[i].getAttribute("name"), tagTemplate.children[i].innerHTML);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
controller.solt.set("default", tagTemplate.children[i].innerHTML);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
controller.solt.set("default", tagTemplate.innerHTML);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 此函数用于展开solt
|
|
27
|
+
* @param elements
|
|
28
|
+
* @param controller
|
|
29
|
+
*/
|
|
30
|
+
export function extract_solt(elements, controller) {
|
|
31
|
+
for (var i = 0; i < elements.length; i++) {
|
|
32
|
+
var result = elements[i].hasAttribute("v-solt");
|
|
33
|
+
if (result) {
|
|
34
|
+
var dataName = elements[i].getAttribute("v-solt");
|
|
35
|
+
elements[i].removeAttribute("v-solt");
|
|
36
|
+
if (!dataName) {
|
|
37
|
+
elements[i].innerHTML = controller.solt.get("default");
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
elements[i].innerHTML = controller.solt.get(dataName);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//深度解析
|
|
45
|
+
extract_solt(elements[i].children, controller);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -5,6 +5,7 @@ import { mount } from "../../library/lifecycle/mount";
|
|
|
5
5
|
import { injectRefs } from "../inject/inject";
|
|
6
6
|
import { afterMethodsTypeOne } from "../../library/lifecycle/afterMethods";
|
|
7
7
|
import { findComponent } from "./delivery";
|
|
8
|
+
import { resolver_solt } from "../cmd/v-solt";
|
|
8
9
|
/**
|
|
9
10
|
* 该函数用于初次渲染需要记录状态的组件
|
|
10
11
|
* @param proto
|
|
@@ -16,6 +17,8 @@ import { findComponent } from "./delivery";
|
|
|
16
17
|
export function post_render(proto, parent, child, link, tagTemplate) {
|
|
17
18
|
//获取控制对象
|
|
18
19
|
var controller = new Controller();
|
|
20
|
+
//解析solt
|
|
21
|
+
resolver_solt(tagTemplate, controller);
|
|
19
22
|
//控制对象预处理
|
|
20
23
|
controllerCycleTypeTwo(controller, proto, child, link, tagTemplate);
|
|
21
24
|
//beforeRender
|
|
@@ -5,6 +5,7 @@ import { mount } from "../../library/lifecycle/mount";
|
|
|
5
5
|
import { injectRefs } from "../inject/inject";
|
|
6
6
|
import { afterMethodsTypeOne } from "../../library/lifecycle/afterMethods";
|
|
7
7
|
import { findComponent } from "./delivery";
|
|
8
|
+
import { resolver_solt } from "../cmd/v-solt";
|
|
8
9
|
/**
|
|
9
10
|
* 该函数用于处理需要更更新时候,需要从父组件提取数据状态的渲染操作
|
|
10
11
|
* @param proto
|
|
@@ -16,6 +17,8 @@ import { findComponent } from "./delivery";
|
|
|
16
17
|
export function init_render(proto, parent, child, link, tagTemplate) {
|
|
17
18
|
//获取控制对象
|
|
18
19
|
var controller = new Controller();
|
|
20
|
+
//解析solt
|
|
21
|
+
resolver_solt(tagTemplate, controller);
|
|
19
22
|
//控制对象预处理
|
|
20
23
|
controllerCycleTypeOne(controller, proto, child, link, tagTemplate);
|
|
21
24
|
//beforeRender
|
package/core/render/rawRender.js
CHANGED
|
@@ -5,6 +5,7 @@ import { mount } from "../../library/lifecycle/mount";
|
|
|
5
5
|
import { injectRefs } from "../inject/inject";
|
|
6
6
|
import { afterMethodsTypeTwo } from "../../library/lifecycle/afterMethods";
|
|
7
7
|
import { findComponent } from "./delivery";
|
|
8
|
+
import { resolver_solt } from "../cmd/v-solt";
|
|
8
9
|
/**
|
|
9
10
|
* 该函数用于渲染不需要记录状态的组件
|
|
10
11
|
* @param proto
|
|
@@ -16,6 +17,8 @@ import { findComponent } from "./delivery";
|
|
|
16
17
|
export function raw_render(proto, parent, child, link, tagTemplate) {
|
|
17
18
|
//获取控制对象
|
|
18
19
|
var controller = new Controller();
|
|
20
|
+
//解析solt
|
|
21
|
+
resolver_solt(tagTemplate, controller);
|
|
19
22
|
//控制对象预处理
|
|
20
23
|
controllerCycleTypeTwo(controller, proto, child, link, tagTemplate);
|
|
21
24
|
//beforeRender
|
package/library/cmd/cmd.js
CHANGED
|
@@ -9,6 +9,7 @@ import { resolver_render } from "../../core/cmd/v-render";
|
|
|
9
9
|
import { resolver_if } from "../../core/cmd/v-if";
|
|
10
10
|
import { resolver_switch } from "../../core/cmd/v-switch";
|
|
11
11
|
import { resolver_for_each, resolver_for_of } from "../../core/cmd/v-for";
|
|
12
|
+
import { extract_solt } from "../../core/cmd/v-solt";
|
|
12
13
|
export function cmd(tagTemplate, proto, controller) {
|
|
13
14
|
//给所有元素添加上npm=tag标志
|
|
14
15
|
addLabel(tagTemplate.children, proto.getName());
|
|
@@ -22,6 +23,8 @@ export function cmd(tagTemplate, proto, controller) {
|
|
|
22
23
|
resolver_model(tagTemplate.children, controller.proxyForMethods);
|
|
23
24
|
//渲染属性
|
|
24
25
|
resolver_bind(tagTemplate.children, controller.proxyForMethods);
|
|
26
|
+
//solt
|
|
27
|
+
extract_solt(tagTemplate.children, controller);
|
|
25
28
|
}
|
|
26
29
|
export function afterCmd(templateSpace, proto, controller) {
|
|
27
30
|
//v-show
|