render-core 1.0.98 → 1.0.99
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.
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
import { ComponentController } from "../../../class/controller/componentController";
|
|
2
1
|
/**
|
|
3
2
|
* 绑定数据模型
|
|
4
3
|
* @param nodes
|
|
5
4
|
* @param data
|
|
6
5
|
*/
|
|
7
6
|
export declare function resolver_model(nodes: HTMLCollection, data: {}): void;
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* @param nodes
|
|
11
|
-
* @param data
|
|
12
|
-
* @param controller
|
|
13
|
-
*/
|
|
14
|
-
export declare function bindModelForUpdater(nodes: HTMLCollection, data: {}, controller: ComponentController): void;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { locateInputAddress } from "../../utility/sectionUtility";
|
|
2
1
|
/**
|
|
3
2
|
* 绑定数据模型
|
|
4
3
|
* @param nodes
|
|
@@ -44,57 +43,3 @@ export function resolver_model(nodes, data) {
|
|
|
44
43
|
resolver_model(nodes[i].children, data);
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
* @param nodes
|
|
50
|
-
* @param data
|
|
51
|
-
* @param controller
|
|
52
|
-
*/
|
|
53
|
-
export function bindModelForUpdater(nodes, data, controller) {
|
|
54
|
-
for (var i = 0; i < nodes.length; i++) {
|
|
55
|
-
if (nodes[i].hasAttribute("v-model")) {
|
|
56
|
-
var dataName = nodes[i].getAttribute("v-model");
|
|
57
|
-
nodes[i].removeAttribute("v-model");
|
|
58
|
-
var tagName = nodes[i].tagName;
|
|
59
|
-
nodes[i].setAttribute("name", dataName);
|
|
60
|
-
// @ts-ignore
|
|
61
|
-
nodes[i].setAttribute("value", data[dataName]);
|
|
62
|
-
if (tagName === "INPUT" || tagName === "SELECT" || tagName === "TEXTAREA") {
|
|
63
|
-
nodes[i].setAttribute("name", dataName);
|
|
64
|
-
// @ts-ignore
|
|
65
|
-
nodes[i].setAttribute("value", data[dataName]);
|
|
66
|
-
//光标定位
|
|
67
|
-
var listener = function (evt) {
|
|
68
|
-
if (!evt.target.hasAttribute("flag")) {
|
|
69
|
-
//Get the event element
|
|
70
|
-
var element = evt.target;
|
|
71
|
-
//Get the name attribute
|
|
72
|
-
var dataName_2 = element.name;
|
|
73
|
-
Reflect.set(this, "origin", {
|
|
74
|
-
cpn: element.getAttribute("cpn"),
|
|
75
|
-
tag: element.nodeName,
|
|
76
|
-
name: element.getAttribute("name")
|
|
77
|
-
});
|
|
78
|
-
//Update the value
|
|
79
|
-
this[dataName_2] = element.value;
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
var compositionstart = function (evt) {
|
|
83
|
-
evt.target.setAttribute("flag", "false");
|
|
84
|
-
};
|
|
85
|
-
var compositionend = function (evt) {
|
|
86
|
-
evt.target.setAttribute("flag", "true");
|
|
87
|
-
var element = evt.target;
|
|
88
|
-
var dataName = element.name;
|
|
89
|
-
this[dataName] = element.value;
|
|
90
|
-
};
|
|
91
|
-
nodes[i].addEventListener("input", listener.bind(data));
|
|
92
|
-
nodes[i].addEventListener("compositionstart", compositionstart);
|
|
93
|
-
nodes[i].addEventListener("compositionend", compositionend.bind(data));
|
|
94
|
-
// @ts-ignore
|
|
95
|
-
locateInputAddress(controller);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
bindModelForUpdater(nodes[i].children, data, controller);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
@@ -2,7 +2,8 @@ import { afterCmd, cmdForUpdate } from "../../library/cmd/cmd";
|
|
|
2
2
|
import { injectRefs } from "../inject/inject";
|
|
3
3
|
import { findComponent } from "./delivery";
|
|
4
4
|
import { getTemplate } from "../utility/templateUtility";
|
|
5
|
-
import {
|
|
5
|
+
import { resolver_model } from "../cmd/react/v-model";
|
|
6
|
+
import { locateInputAddress } from "../utility/sectionUtility";
|
|
6
7
|
/**
|
|
7
8
|
* 更新渲染方法
|
|
8
9
|
* @param controller
|
|
@@ -37,8 +38,9 @@ export function update_Render(controller) {
|
|
|
37
38
|
//afterRender
|
|
38
39
|
var afterRender = controller.proto.getAfterRender().bind(controller.raw_data);
|
|
39
40
|
afterRender();
|
|
41
|
+
resolver_model(controller.root.children, controller.proxyForMethods);
|
|
40
42
|
//获取定位
|
|
41
|
-
|
|
43
|
+
locateInputAddress(controller);
|
|
42
44
|
//深度渲染
|
|
43
45
|
findComponent(controller.root.children, controller);
|
|
44
46
|
}
|