render-core 1.3.38 → 1.3.40
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 +41 -41
- package/class/component/component.js +108 -108
- package/class/controller/appController.d.ts +17 -44
- package/class/controller/appController.js +25 -132
- package/class/controller/componentController.d.ts +15 -15
- package/class/controller/componentController.js +22 -22
- package/class/controller/pageController.d.ts +23 -23
- package/class/controller/pageController.js +40 -40
- package/class/tips/appTip.d.ts +2 -2
- package/class/tips/appTip.js +1 -1
- package/class/tips/componentTip.d.ts +13 -13
- package/class/tips/componentTip.js +1 -1
- package/class/tips/renderTip.d.ts +3 -5
- package/class/tips/renderTip.js +1 -1
- package/core/cmd/data/v-el.d.ts +8 -8
- package/core/cmd/data/v-el.js +28 -28
- package/core/cmd/data/v-html.d.ts +8 -8
- package/core/cmd/data/v-html.js +26 -26
- package/core/cmd/data/v-txt.d.ts +8 -8
- package/core/cmd/data/v-txt.js +29 -29
- package/core/cmd/justify/v-if.d.ts +6 -6
- package/core/cmd/justify/v-if.js +43 -43
- package/core/cmd/justify/v-render.d.ts +6 -6
- package/core/cmd/justify/v-render.js +26 -26
- package/core/cmd/justify/v-show.d.ts +6 -6
- package/core/cmd/justify/v-show.js +26 -26
- package/core/cmd/justify/v-switch.d.ts +6 -6
- package/core/cmd/justify/v-switch.js +35 -35
- package/core/cmd/loop/v-for.d.ts +12 -12
- package/core/cmd/loop/v-for.js +63 -63
- package/core/cmd/loop/v-index.d.ts +14 -14
- package/core/cmd/loop/v-index.js +80 -79
- package/core/cmd/loop/v-key.d.ts +12 -12
- package/core/cmd/loop/v-key.js +70 -70
- package/core/cmd/method/v-on.d.ts +8 -8
- package/core/cmd/method/v-on.js +40 -40
- package/core/cmd/property/v-bind.d.ts +6 -6
- package/core/cmd/property/v-bind.js +33 -33
- package/core/cmd/react/v-model.d.ts +6 -6
- package/core/cmd/react/v-model.js +22 -22
- package/core/cmd/ref/v-ref.d.ts +6 -6
- package/core/cmd/ref/v-ref.js +16 -16
- package/core/cmd/solt/v-solt.d.ts +14 -14
- package/core/cmd/solt/v-solt.js +46 -46
- package/core/inject/inject.d.ts +30 -35
- package/core/inject/inject.js +63 -70
- package/core/lifecycle/afterMethods.d.ts +16 -16
- package/core/lifecycle/afterMethods.js +22 -22
- package/core/lifecycle/controllerCycle.d.ts +13 -13
- package/core/lifecycle/controllerCycle.js +42 -42
- package/core/lifecycle/mount.d.ts +16 -17
- package/core/lifecycle/mount.js +31 -34
- package/core/loader/loader.d.ts +7 -7
- package/core/loader/loader.js +18 -18
- package/core/proxy/getProxy.d.ts +13 -13
- package/core/proxy/getProxy.js +42 -42
- package/core/render/PostRender.d.ts +12 -12
- package/core/render/PostRender.js +42 -45
- package/core/render/delivery.d.ts +5 -5
- package/core/render/delivery.js +42 -42
- package/core/render/initRender.d.ts +12 -12
- package/core/render/initRender.js +39 -41
- package/core/render/partRender.d.ts +15 -15
- package/core/render/partRender.js +31 -31
- package/core/render/rawRender.d.ts +12 -12
- package/core/render/rawRender.js +43 -45
- package/core/render/updateRender.d.ts +6 -6
- package/core/render/updateRender.js +29 -32
- package/core/resolver/props.d.ts +18 -18
- package/core/resolver/props.js +60 -60
- package/core/resolver/query.d.ts +4 -4
- package/core/resolver/query.js +15 -15
- package/core/utility/checkUtility.d.ts +1 -1
- package/core/utility/checkUtility.js +4 -4
- package/core/utility/cmdUtility.d.ts +16 -16
- package/core/utility/cmdUtility.js +57 -57
- package/core/utility/dataUtility.d.ts +1 -1
- package/core/utility/dataUtility.js +8 -8
- package/core/utility/errorUtility.d.ts +3 -3
- package/core/utility/errorUtility.js +9 -9
- package/core/utility/injectUtility.d.ts +13 -13
- package/core/utility/injectUtility.js +58 -58
- package/core/utility/inputType.d.ts +5 -5
- package/core/utility/inputType.js +20 -20
- package/core/utility/inputUtility.d.ts +4 -4
- package/core/utility/inputUtility.js +100 -100
- package/core/utility/miscUtility.d.ts +6 -6
- package/core/utility/miscUtility.js +12 -12
- package/core/utility/modelUtility.d.ts +15 -15
- package/core/utility/modelUtility.js +66 -66
- package/core/utility/sectionUtility.d.ts +6 -6
- package/core/utility/sectionUtility.js +104 -104
- package/core/utility/styleUtility.d.ts +17 -29
- package/core/utility/styleUtility.js +67 -114
- package/core/utility/templateUtility.d.ts +6 -6
- package/core/utility/templateUtility.js +13 -13
- package/core/utility/vForUtility.d.ts +15 -15
- package/core/utility/vForUtility.js +20 -20
- package/http/redirect/redirect.d.ts +11 -11
- package/http/redirect/redirect.js +36 -36
- package/index.d.ts +44 -71
- package/index.js +70 -130
- package/package.json +3 -8
- package/runtime/metaTagLib.d.ts +2 -2
- package/runtime/metaTagLib.js +27 -27
- package/runtime/runtime.d.ts +7 -7
- package/runtime/runtime.js +26 -26
- package/runtime/tools.d.ts +14 -14
- package/runtime/tools.js +43 -49
- package/README.md +0 -2
- package/class/controller/contextController.d.ts +0 -18
- package/class/controller/contextController.js +0 -79
- package/func/Theme.d.ts +0 -16
- package/func/Theme.js +0 -27
- package/status/read/read.d.ts +0 -10
- package/status/read/read.js +0 -26
- package/status/write/write.d.ts +0 -12
- package/status/write/write.js +0 -92
package/core/cmd/method/v-on.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @param elements
|
|
4
|
-
* @param methods
|
|
5
|
-
* @param data
|
|
6
|
-
* @param rawData
|
|
7
|
-
*/
|
|
8
|
-
export function resolver_event(elements, methods, data, rawData) {
|
|
9
|
-
//遍历所有的元素节点
|
|
10
|
-
for (var i = 0; i < elements.length; i++) {
|
|
11
|
-
//获取元素节点所有属性
|
|
12
|
-
var attributes = elements[i].getAttributeNames();
|
|
13
|
-
//解析元素的所有属性
|
|
14
|
-
for (var j = 0; j < attributes.length; j++) {
|
|
15
|
-
//检查属性名称以及匹配绑定方法
|
|
16
|
-
var result = attributes[j].match(/^@on:([a-z]+)$/g);
|
|
17
|
-
//如何属性匹配
|
|
18
|
-
if (result !== null) {
|
|
19
|
-
for (var k = 0; k < result.length; k++) {
|
|
20
|
-
var action = result[k].substring(4);
|
|
21
|
-
var method = elements[i].getAttribute(result[k]);
|
|
22
|
-
elements[i].removeAttribute(result[k]);
|
|
23
|
-
try {
|
|
24
|
-
if (method.match(/^\$\$[a-zA-Z0-9_]*/) !== null) {
|
|
25
|
-
elements[i].addEventListener(action, methods[method].bind(rawData));
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
elements[i].addEventListener(action, methods[method].bind(data));
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
console.error("Can not find method:" + method + " in the component");
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
//深度解析属性
|
|
38
|
-
resolver_event(elements[i].children, methods, data, rawData);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param elements
|
|
4
|
+
* @param methods
|
|
5
|
+
* @param data
|
|
6
|
+
* @param rawData
|
|
7
|
+
*/
|
|
8
|
+
export function resolver_event(elements, methods, data, rawData) {
|
|
9
|
+
//遍历所有的元素节点
|
|
10
|
+
for (var i = 0; i < elements.length; i++) {
|
|
11
|
+
//获取元素节点所有属性
|
|
12
|
+
var attributes = elements[i].getAttributeNames();
|
|
13
|
+
//解析元素的所有属性
|
|
14
|
+
for (var j = 0; j < attributes.length; j++) {
|
|
15
|
+
//检查属性名称以及匹配绑定方法
|
|
16
|
+
var result = attributes[j].match(/^@on:([a-z]+)$/g);
|
|
17
|
+
//如何属性匹配
|
|
18
|
+
if (result !== null) {
|
|
19
|
+
for (var k = 0; k < result.length; k++) {
|
|
20
|
+
var action = result[k].substring(4);
|
|
21
|
+
var method = elements[i].getAttribute(result[k]);
|
|
22
|
+
elements[i].removeAttribute(result[k]);
|
|
23
|
+
try {
|
|
24
|
+
if (method.match(/^\$\$[a-zA-Z0-9_]*/) !== null) {
|
|
25
|
+
elements[i].addEventListener(action, methods[method].bind(rawData));
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
elements[i].addEventListener(action, methods[method].bind(data));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
console.error("Can not find method:" + method + " in the component");
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//深度解析属性
|
|
38
|
+
resolver_event(elements[i].children, methods, data, rawData);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @param nodes
|
|
4
|
-
* @param data
|
|
5
|
-
*/
|
|
6
|
-
export declare function resolver_bind(nodes: HTMLCollection, data: {}): void;
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param nodes
|
|
4
|
+
* @param data
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolver_bind(nodes: HTMLCollection, data: {}): void;
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { isUnKnown } from "../../utility/checkUtility";
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* @param nodes
|
|
5
|
-
* @param data
|
|
6
|
-
*/
|
|
7
|
-
export function resolver_bind(nodes, data) {
|
|
8
|
-
for (var i = 0; i < nodes.length; i++) {
|
|
9
|
-
//对系统元素进行属性绑定
|
|
10
|
-
if (!isUnKnown(nodes[i].nodeName)) {
|
|
11
|
-
var attributes = nodes[i].getAttributeNames();
|
|
12
|
-
for (var j = 0; j < attributes.length; j++) {
|
|
13
|
-
var result = attributes[j].match(/^@bind:([a-z]+)$/g);
|
|
14
|
-
if (result === null) {
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
for (var k = 0; k < result.length; k++) {
|
|
18
|
-
var property = result[k].substring(6);
|
|
19
|
-
var dataName = nodes[i].getAttribute(result[k]);
|
|
20
|
-
nodes[i].removeAttribute(result[k]);
|
|
21
|
-
try {
|
|
22
|
-
nodes[i].setAttribute(property, data[dataName]);
|
|
23
|
-
}
|
|
24
|
-
catch (e) {
|
|
25
|
-
console.error(e.message);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
resolver_bind(nodes[i].children, data);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
1
|
+
import { isUnKnown } from "../../utility/checkUtility";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param nodes
|
|
5
|
+
* @param data
|
|
6
|
+
*/
|
|
7
|
+
export function resolver_bind(nodes, data) {
|
|
8
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
9
|
+
//对系统元素进行属性绑定
|
|
10
|
+
if (!isUnKnown(nodes[i].nodeName)) {
|
|
11
|
+
var attributes = nodes[i].getAttributeNames();
|
|
12
|
+
for (var j = 0; j < attributes.length; j++) {
|
|
13
|
+
var result = attributes[j].match(/^@bind:([a-z]+)$/g);
|
|
14
|
+
if (result === null) {
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
for (var k = 0; k < result.length; k++) {
|
|
18
|
+
var property = result[k].substring(6);
|
|
19
|
+
var dataName = nodes[i].getAttribute(result[k]);
|
|
20
|
+
nodes[i].removeAttribute(result[k]);
|
|
21
|
+
try {
|
|
22
|
+
nodes[i].setAttribute(property, data[dataName]);
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
console.error(e.message);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
resolver_bind(nodes[i].children, data);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 绑定数据模型
|
|
3
|
-
* @param nodes
|
|
4
|
-
* @param data
|
|
5
|
-
*/
|
|
6
|
-
export declare function resolver_model(nodes: HTMLCollection, data: {}): void;
|
|
1
|
+
/**
|
|
2
|
+
* 绑定数据模型
|
|
3
|
+
* @param nodes
|
|
4
|
+
* @param data
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolver_model(nodes: HTMLCollection, data: {}): void;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { compositionend, compositionstart, listener } from "../../utility/modelUtility";
|
|
2
|
-
/**
|
|
3
|
-
* 绑定数据模型
|
|
4
|
-
* @param nodes
|
|
5
|
-
* @param data
|
|
6
|
-
*/
|
|
7
|
-
export function resolver_model(nodes, data) {
|
|
8
|
-
for (var i = 0; i < nodes.length; i++) {
|
|
9
|
-
if (nodes[i].hasAttribute("@model")) {
|
|
10
|
-
var dataName = nodes[i].getAttribute("@model");
|
|
11
|
-
nodes[i].removeAttribute("@model");
|
|
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.bind(data));
|
|
17
|
-
nodes[i].addEventListener("compositionend", compositionend.bind(data));
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
resolver_model(nodes[i].children, data);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
1
|
+
import { compositionend, compositionstart, listener } from "../../utility/modelUtility";
|
|
2
|
+
/**
|
|
3
|
+
* 绑定数据模型
|
|
4
|
+
* @param nodes
|
|
5
|
+
* @param data
|
|
6
|
+
*/
|
|
7
|
+
export function resolver_model(nodes, data) {
|
|
8
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
9
|
+
if (nodes[i].hasAttribute("@model")) {
|
|
10
|
+
var dataName = nodes[i].getAttribute("@model");
|
|
11
|
+
nodes[i].removeAttribute("@model");
|
|
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.bind(data));
|
|
17
|
+
nodes[i].addEventListener("compositionend", compositionend.bind(data));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
resolver_model(nodes[i].children, data);
|
|
21
|
+
}
|
|
22
|
+
}
|
package/core/cmd/ref/v-ref.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @param el
|
|
4
|
-
* @param refs
|
|
5
|
-
*/
|
|
6
|
-
export declare function resolver_Refs(el: HTMLCollection, refs: Map<string, Element>): void;
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param el
|
|
4
|
+
* @param refs
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolver_Refs(el: HTMLCollection, refs: Map<string, Element>): void;
|
package/core/cmd/ref/v-ref.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @param el
|
|
4
|
-
* @param refs
|
|
5
|
-
*/
|
|
6
|
-
export function resolver_Refs(el, refs) {
|
|
7
|
-
for (var i = 0; i < el.length; i++) {
|
|
8
|
-
if (el[i].hasAttribute("@ref")) {
|
|
9
|
-
refs.set(el[i].getAttribute("@ref"), el[i]);
|
|
10
|
-
el[i].removeAttribute("@ref");
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
resolver_Refs(el[i].children, refs);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param el
|
|
4
|
+
* @param refs
|
|
5
|
+
*/
|
|
6
|
+
export function resolver_Refs(el, refs) {
|
|
7
|
+
for (var i = 0; i < el.length; i++) {
|
|
8
|
+
if (el[i].hasAttribute("@ref")) {
|
|
9
|
+
refs.set(el[i].getAttribute("@ref"), el[i]);
|
|
10
|
+
el[i].removeAttribute("@ref");
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
resolver_Refs(el[i].children, refs);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { ComponentController } from "../../../class/controller/componentController";
|
|
2
|
-
import { PageController } from "../../../class/controller/pageController";
|
|
3
|
-
/**
|
|
4
|
-
* 此函数用于解析自定义元素solt
|
|
5
|
-
* @param tagTemplate
|
|
6
|
-
* @param controller
|
|
7
|
-
*/
|
|
8
|
-
export declare function resolver_solt(tagTemplate: Element, controller: ComponentController | PageController): void;
|
|
9
|
-
/**
|
|
10
|
-
* 此函数用于展开solt
|
|
11
|
-
* @param elements
|
|
12
|
-
* @param controller
|
|
13
|
-
*/
|
|
14
|
-
export declare function extract_solt(elements: HTMLCollection, controller: ComponentController | PageController): void;
|
|
1
|
+
import { ComponentController } from "../../../class/controller/componentController";
|
|
2
|
+
import { PageController } from "../../../class/controller/pageController";
|
|
3
|
+
/**
|
|
4
|
+
* 此函数用于解析自定义元素solt
|
|
5
|
+
* @param tagTemplate
|
|
6
|
+
* @param controller
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolver_solt(tagTemplate: Element, controller: ComponentController | PageController): void;
|
|
9
|
+
/**
|
|
10
|
+
* 此函数用于展开solt
|
|
11
|
+
* @param elements
|
|
12
|
+
* @param controller
|
|
13
|
+
*/
|
|
14
|
+
export declare function extract_solt(elements: HTMLCollection, controller: ComponentController | PageController): void;
|
package/core/cmd/solt/v-solt.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 此函数用于解析自定义元素solt
|
|
3
|
-
* @param tagTemplate
|
|
4
|
-
* @param controller
|
|
5
|
-
*/
|
|
6
|
-
export function resolver_solt(tagTemplate, controller) {
|
|
7
|
-
if (tagTemplate.hasChildNodes()) {
|
|
8
|
-
var list = tagTemplate.querySelectorAll("solt");
|
|
9
|
-
if (list.length !== 0) {
|
|
10
|
-
list.forEach(function (value) {
|
|
11
|
-
if (value.hasAttribute("name")) {
|
|
12
|
-
controller.solt.set(value.getAttribute("name"), value.innerHTML);
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
controller.solt.set("default", value.innerHTML);
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
controller.solt.set("default", tagTemplate.innerHTML);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* 此函数用于展开solt
|
|
26
|
-
* @param elements
|
|
27
|
-
* @param controller
|
|
28
|
-
*/
|
|
29
|
-
export function extract_solt(elements, controller) {
|
|
30
|
-
for (var i = 0; i < elements.length; i++) {
|
|
31
|
-
var result = elements[i].hasAttribute("@solt");
|
|
32
|
-
if (result) {
|
|
33
|
-
var dataName = elements[i].getAttribute("@solt");
|
|
34
|
-
elements[i].removeAttribute("@solt");
|
|
35
|
-
if (!dataName) {
|
|
36
|
-
elements[i].innerHTML = controller.solt.get("default");
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
// @ts-ignore
|
|
40
|
-
elements[i].innerHTML = controller.solt.get(dataName);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
//深度解析
|
|
44
|
-
extract_solt(elements[i].children, controller);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* 此函数用于解析自定义元素solt
|
|
3
|
+
* @param tagTemplate
|
|
4
|
+
* @param controller
|
|
5
|
+
*/
|
|
6
|
+
export function resolver_solt(tagTemplate, controller) {
|
|
7
|
+
if (tagTemplate.hasChildNodes()) {
|
|
8
|
+
var list = tagTemplate.querySelectorAll("solt");
|
|
9
|
+
if (list.length !== 0) {
|
|
10
|
+
list.forEach(function (value) {
|
|
11
|
+
if (value.hasAttribute("name")) {
|
|
12
|
+
controller.solt.set(value.getAttribute("name"), value.innerHTML);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
controller.solt.set("default", value.innerHTML);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
controller.solt.set("default", tagTemplate.innerHTML);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 此函数用于展开solt
|
|
26
|
+
* @param elements
|
|
27
|
+
* @param controller
|
|
28
|
+
*/
|
|
29
|
+
export function extract_solt(elements, controller) {
|
|
30
|
+
for (var i = 0; i < elements.length; i++) {
|
|
31
|
+
var result = elements[i].hasAttribute("@solt");
|
|
32
|
+
if (result) {
|
|
33
|
+
var dataName = elements[i].getAttribute("@solt");
|
|
34
|
+
elements[i].removeAttribute("@solt");
|
|
35
|
+
if (!dataName) {
|
|
36
|
+
elements[i].innerHTML = controller.solt.get("default");
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
elements[i].innerHTML = controller.solt.get(dataName);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//深度解析
|
|
44
|
+
extract_solt(elements[i].children, controller);
|
|
45
|
+
}
|
|
46
|
+
}
|
package/core/inject/inject.d.ts
CHANGED
|
@@ -1,35 +1,30 @@
|
|
|
1
|
-
import { ComponentController } from "../../class/controller/componentController";
|
|
2
|
-
import { Component } from "../../class/component/component";
|
|
3
|
-
/**
|
|
4
|
-
* 向raw_data中注入props和Query
|
|
5
|
-
* @param controller
|
|
6
|
-
*/
|
|
7
|
-
export declare function inject(controller: ComponentController): void;
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* @param controller
|
|
11
|
-
*/
|
|
12
|
-
export declare function injectRefs(controller: ComponentController): void;
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
15
|
-
* @param controller
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*
|
|
21
|
-
* @param
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*
|
|
27
|
-
* @param
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
*
|
|
32
|
-
* @param controller
|
|
33
|
-
* @param proto
|
|
34
|
-
*/
|
|
35
|
-
export declare function injectComputed(controller: ComponentController, proto: Component): void;
|
|
1
|
+
import { ComponentController } from "../../class/controller/componentController";
|
|
2
|
+
import { Component } from "../../class/component/component";
|
|
3
|
+
/**
|
|
4
|
+
* 向raw_data中注入props和Query
|
|
5
|
+
* @param controller
|
|
6
|
+
*/
|
|
7
|
+
export declare function inject(controller: ComponentController): void;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param controller
|
|
11
|
+
*/
|
|
12
|
+
export declare function injectRefs(controller: ComponentController): void;
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param controller
|
|
16
|
+
* @param proto
|
|
17
|
+
*/
|
|
18
|
+
export declare function injectMethod(controller: ComponentController, proto: Component): void;
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @param controller
|
|
22
|
+
* @param proto
|
|
23
|
+
*/
|
|
24
|
+
export declare function injectWatcher(controller: ComponentController, proto: Component): void;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @param controller
|
|
28
|
+
* @param proto
|
|
29
|
+
*/
|
|
30
|
+
export declare function injectComputed(controller: ComponentController, proto: Component): void;
|
package/core/inject/inject.js
CHANGED
|
@@ -1,70 +1,63 @@
|
|
|
1
|
-
import { getCodeSpaceForProps, getCodeSpaceForQuery, getCodeSpaceForRef, } from "../utility/injectUtility";
|
|
2
|
-
import { resolveProps } from "../resolver/props";
|
|
3
|
-
import { resolve_Queries } from "../resolver/query";
|
|
4
|
-
import { resolver_Refs } from "../cmd/ref/v-ref";
|
|
5
|
-
/**
|
|
6
|
-
* 向raw_data中注入props和Query
|
|
7
|
-
* @param controller
|
|
8
|
-
*/
|
|
9
|
-
export function inject(controller) {
|
|
10
|
-
//注入name
|
|
11
|
-
Reflect.set(controller.raw_data, "$name", controller.proto.getName());
|
|
12
|
-
//注入props
|
|
13
|
-
getCodeSpaceForProps(controller.raw_data, resolveProps(Reflect.get(window, "context").crtTag, controller.proto.getProps()));
|
|
14
|
-
//注入query
|
|
15
|
-
getCodeSpaceForQuery(controller.raw_data, resolve_Queries());
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
19
|
-
* @param controller
|
|
20
|
-
*/
|
|
21
|
-
export function injectRefs(controller) {
|
|
22
|
-
var refs = new Map();
|
|
23
|
-
resolver_Refs(controller.root.children, refs);
|
|
24
|
-
getCodeSpaceForRef(controller.raw_data, refs);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @param controller
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
*/
|
|
65
|
-
export function injectComputed(controller, proto) {
|
|
66
|
-
var methods = Object.getOwnPropertyNames(proto.getComputed());
|
|
67
|
-
methods.forEach(function (value) {
|
|
68
|
-
Reflect.set(controller.computed, value, proto.getComputed()[value].bind(controller.raw_data));
|
|
69
|
-
});
|
|
70
|
-
}
|
|
1
|
+
import { getCodeSpaceForProps, getCodeSpaceForQuery, getCodeSpaceForRef, } from "../utility/injectUtility";
|
|
2
|
+
import { resolveProps } from "../resolver/props";
|
|
3
|
+
import { resolve_Queries } from "../resolver/query";
|
|
4
|
+
import { resolver_Refs } from "../cmd/ref/v-ref";
|
|
5
|
+
/**
|
|
6
|
+
* 向raw_data中注入props和Query
|
|
7
|
+
* @param controller
|
|
8
|
+
*/
|
|
9
|
+
export function inject(controller) {
|
|
10
|
+
//注入name
|
|
11
|
+
Reflect.set(controller.raw_data, "$name", controller.proto.getName());
|
|
12
|
+
//注入props
|
|
13
|
+
getCodeSpaceForProps(controller.raw_data, resolveProps(Reflect.get(window, "context").crtTag, controller.proto.getProps()));
|
|
14
|
+
//注入query
|
|
15
|
+
getCodeSpaceForQuery(controller.raw_data, resolve_Queries());
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @param controller
|
|
20
|
+
*/
|
|
21
|
+
export function injectRefs(controller) {
|
|
22
|
+
var refs = new Map();
|
|
23
|
+
resolver_Refs(controller.root.children, refs);
|
|
24
|
+
getCodeSpaceForRef(controller.raw_data, refs);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param controller
|
|
29
|
+
* @param proto
|
|
30
|
+
*/
|
|
31
|
+
export function injectMethod(controller, proto) {
|
|
32
|
+
var methods = Object.getOwnPropertyNames(proto.getMethods());
|
|
33
|
+
methods.forEach(function (value) {
|
|
34
|
+
if (value.match(/^\$\$[a-zA-Z0-9_]*/) !== null) {
|
|
35
|
+
Reflect.set(controller.raw_data, value, proto.getMethods()[value].bind(controller.raw_data));
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
Reflect.set(controller.raw_data, value, proto.getMethods()[value].bind(controller.proxyForMethods));
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @param controller
|
|
45
|
+
* @param proto
|
|
46
|
+
*/
|
|
47
|
+
export function injectWatcher(controller, proto) {
|
|
48
|
+
var methods = Object.getOwnPropertyNames(proto.getWatcher());
|
|
49
|
+
methods.forEach(function (value) {
|
|
50
|
+
Reflect.set(controller.watcher, value, proto.getWatcher()[value].bind(controller.raw_data));
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* @param controller
|
|
56
|
+
* @param proto
|
|
57
|
+
*/
|
|
58
|
+
export function injectComputed(controller, proto) {
|
|
59
|
+
var methods = Object.getOwnPropertyNames(proto.getComputed());
|
|
60
|
+
methods.forEach(function (value) {
|
|
61
|
+
Reflect.set(controller.computed, value, proto.getComputed()[value].bind(controller.raw_data));
|
|
62
|
+
});
|
|
63
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ComponentController } from "../../class/controller/componentController";
|
|
2
|
-
import { PageController } from "../../class/controller/pageController";
|
|
3
|
-
/**
|
|
4
|
-
* 该函数用于处理渲染后操作
|
|
5
|
-
* @param controller
|
|
6
|
-
* @param child
|
|
7
|
-
* @param link
|
|
8
|
-
*/
|
|
9
|
-
export declare function afterMethodsTypeOne(controller: ComponentController, child: Element, link: ComponentController | PageController): void;
|
|
10
|
-
/**
|
|
11
|
-
* 该函数用于处理渲染后操作
|
|
12
|
-
* @param controller
|
|
13
|
-
* @param child
|
|
14
|
-
* @param link
|
|
15
|
-
*/
|
|
16
|
-
export declare function afterMethodsTypeTwo(controller: ComponentController, child: Element, link: ComponentController | PageController): void;
|
|
1
|
+
import { ComponentController } from "../../class/controller/componentController";
|
|
2
|
+
import { PageController } from "../../class/controller/pageController";
|
|
3
|
+
/**
|
|
4
|
+
* 该函数用于处理渲染后操作
|
|
5
|
+
* @param controller
|
|
6
|
+
* @param child
|
|
7
|
+
* @param link
|
|
8
|
+
*/
|
|
9
|
+
export declare function afterMethodsTypeOne(controller: ComponentController, child: Element, link: ComponentController | PageController): void;
|
|
10
|
+
/**
|
|
11
|
+
* 该函数用于处理渲染后操作
|
|
12
|
+
* @param controller
|
|
13
|
+
* @param child
|
|
14
|
+
* @param link
|
|
15
|
+
*/
|
|
16
|
+
export declare function afterMethodsTypeTwo(controller: ComponentController, child: Element, link: ComponentController | PageController): void;
|