render-core 1.2.24 → 1.2.26
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/core/proxy/getProxy.js +1 -0
- package/core/utility/cmdUtility.js +1 -1
- package/core/utility/inputType.d.ts +2 -0
- package/core/utility/inputType.js +8 -0
- package/core/utility/inputUtility.d.ts +3 -0
- package/core/utility/inputUtility.js +30 -0
- package/core/utility/modelUtility.js +30 -11
- package/core/utility/sectionUtility.js +31 -8
- package/package.json +1 -1
package/core/proxy/getProxy.js
CHANGED
|
@@ -27,7 +27,7 @@ export function cmdUtility(tagTemplate, proto, controller) {
|
|
|
27
27
|
//渲染text
|
|
28
28
|
resolver_txt(tagTemplate.children, controller.proxyForMethods, controller);
|
|
29
29
|
//绑定数据
|
|
30
|
-
resolver_model(tagTemplate.children, controller.
|
|
30
|
+
resolver_model(tagTemplate.children, controller.proxyForMethods);
|
|
31
31
|
//渲染属性
|
|
32
32
|
resolver_bind(tagTemplate.children, controller.proxyForMethods);
|
|
33
33
|
//solt
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export function inputUtility(element, space) {
|
|
2
|
+
switch (element.getAttribute("type")) {
|
|
3
|
+
case "text":
|
|
4
|
+
Reflect.set(this, "origin", {
|
|
5
|
+
tag: element.tagName,
|
|
6
|
+
type: element.getAttribute("type"),
|
|
7
|
+
id: element.getAttribute("id"),
|
|
8
|
+
name: element.getAttribute("name"),
|
|
9
|
+
start: element.selectionStart
|
|
10
|
+
});
|
|
11
|
+
break;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export function selectUtility(element, space) {
|
|
15
|
+
Reflect.set(this, "origin", {
|
|
16
|
+
tag: element.tagName,
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
selected: element.selected,
|
|
19
|
+
id: element.getAttribute("id")
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export function textareaUtiltiy(element, space) {
|
|
23
|
+
Reflect.set(this, "origin", {
|
|
24
|
+
tag: element.tagName,
|
|
25
|
+
id: element.getAttribute("id"),
|
|
26
|
+
name: element.getAttribute("name"),
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
start: element.selectionStart
|
|
29
|
+
});
|
|
30
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { inputUtility, selectUtility, textareaUtiltiy } from "./inputUtility";
|
|
1
2
|
/**
|
|
2
3
|
*
|
|
3
4
|
* @param evt
|
|
@@ -13,14 +14,22 @@ export function listerner(evt) {
|
|
|
13
14
|
if (!evt.target.hasAttribute("flag")) {
|
|
14
15
|
//Get the event element
|
|
15
16
|
var element = evt.target;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
switch (element.nodeName.toUpperCase()) {
|
|
18
|
+
case "INPUT":
|
|
19
|
+
inputUtility(element, this);
|
|
20
|
+
break;
|
|
21
|
+
case "SELECT":
|
|
22
|
+
selectUtility(element, this);
|
|
23
|
+
break;
|
|
24
|
+
case "TEXTAREA":
|
|
25
|
+
textareaUtiltiy(element, this);
|
|
26
|
+
break;
|
|
27
|
+
default:
|
|
28
|
+
console.error("Can`t bind this type input tag!");
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
22
31
|
//Update the value
|
|
23
|
-
this[
|
|
32
|
+
this[element.name] = element.value;
|
|
24
33
|
}
|
|
25
34
|
}
|
|
26
35
|
/**
|
|
@@ -33,10 +42,20 @@ export function compositionend(evt) {
|
|
|
33
42
|
var element = evt.target;
|
|
34
43
|
//Get the name attribute
|
|
35
44
|
var dataName = element.name;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
switch (element.nodeName.toUpperCase()) {
|
|
46
|
+
case "INPUT":
|
|
47
|
+
inputUtility(element, this);
|
|
48
|
+
break;
|
|
49
|
+
case "SELECT":
|
|
50
|
+
selectUtility(element, this);
|
|
51
|
+
break;
|
|
52
|
+
case "TEXTAREA":
|
|
53
|
+
textareaUtiltiy(element, this);
|
|
54
|
+
break;
|
|
55
|
+
default:
|
|
56
|
+
console.error("Can`t bind this type input tag!");
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
40
59
|
//Update the value
|
|
41
60
|
this[dataName] = element.value;
|
|
42
61
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { textType } from "./inputType";
|
|
1
2
|
/**
|
|
2
3
|
*
|
|
3
4
|
* @param controller
|
|
@@ -7,13 +8,35 @@ export function locateInputAddress(controller) {
|
|
|
7
8
|
if (controller.proxyForMethods.hasOwnProperty("origin")) {
|
|
8
9
|
var doc = Reflect.get(controller.proxyForMethods, "origin");
|
|
9
10
|
var target = document.getElementById(doc.id);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
switch (doc.tag) {
|
|
12
|
+
case "INPUT":
|
|
13
|
+
locateInput(target, doc, controller);
|
|
14
|
+
break;
|
|
15
|
+
case "SELECT":
|
|
16
|
+
locateSelect(target, doc, controller);
|
|
17
|
+
break;
|
|
18
|
+
case "TEXTAREA":
|
|
19
|
+
locateTextArea(target, doc, controller);
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
18
22
|
}
|
|
19
23
|
}
|
|
24
|
+
function locateInput(target, doc, controller) {
|
|
25
|
+
switch (doc.type) {
|
|
26
|
+
case "text":
|
|
27
|
+
textType(target, doc, controller);
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function locateTextArea(target, doc, controller) {
|
|
32
|
+
// @ts-ignore
|
|
33
|
+
target.value = controller.proxyForMethods[doc.name];
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
target.focus();
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
target.setSelectionRange(doc.start, doc.start);
|
|
38
|
+
}
|
|
39
|
+
function locateSelect(target, doc, controller) {
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
target.selected = doc.selected;
|
|
42
|
+
}
|