render-core 1.0.91 → 1.0.93
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.
|
@@ -10,3 +10,45 @@ export function addLabel(nodes, component) {
|
|
|
10
10
|
addLabel(kk, component);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
+
export function bindModelForUpdater(nodes, data) {
|
|
14
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
15
|
+
if (nodes[i].hasAttribute("v-model")) {
|
|
16
|
+
var dataName = nodes[i].getAttribute("v-model");
|
|
17
|
+
nodes[i].removeAttribute("v-model");
|
|
18
|
+
var tagName = nodes[i].tagName;
|
|
19
|
+
nodes[i].setAttribute("name", dataName);
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
nodes[i].setAttribute("value", data[dataName]);
|
|
22
|
+
if (tagName === "INPUT" || tagName === "SELECT" || tagName === "TEXTAREA") {
|
|
23
|
+
nodes[i].setAttribute("name", dataName);
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
nodes[i].setAttribute("value", data[dataName]);
|
|
26
|
+
//光标定位
|
|
27
|
+
var listener = function (evt) {
|
|
28
|
+
if (!evt.target.hasAttribute("flag")) {
|
|
29
|
+
var element = evt.target;
|
|
30
|
+
var dataName_1 = element.name;
|
|
31
|
+
this[dataName_1] = element.value;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var compositionstart = function (evt) {
|
|
35
|
+
evt.target.setAttribute("flag", "false");
|
|
36
|
+
};
|
|
37
|
+
var compositionend = function (evt) {
|
|
38
|
+
evt.target.setAttribute("flag", "true");
|
|
39
|
+
var element = evt.target;
|
|
40
|
+
var dataName = element.name;
|
|
41
|
+
this[dataName] = element.value;
|
|
42
|
+
};
|
|
43
|
+
nodes[i].addEventListener("input", listener.bind(data));
|
|
44
|
+
nodes[i].addEventListener("compositionstart", compositionstart);
|
|
45
|
+
nodes[i].addEventListener("compositionend", compositionend.bind(data));
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
nodes[i].focus();
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
nodes[i].setSelectionRange(data[dataName].length, data[dataName].length);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
bindModelForUpdater(nodes[i].children, data);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -6,6 +6,7 @@ export function locateInputAddress(controller) {
|
|
|
6
6
|
if (controller.proxyForMethods.hasOwnProperty("origin")) {
|
|
7
7
|
var doc = Reflect.get(controller.proxyForMethods, "origin");
|
|
8
8
|
// @ts-ignore
|
|
9
|
-
document.querySelector(doc.tag.concat("[cpn=".concat(doc.cpn).concat("]").concat("[
|
|
9
|
+
var target = document.querySelector(doc.tag.toLowerCase().concat("[cpn=".concat(doc.cpn).concat("]").concat("[name=".concat(doc.name).concat("]")))).focus();
|
|
10
|
+
target.setSelectionRange(controller.proxyForMethods[doc.name].length, controller.proxyForMethods[doc.name].length);
|
|
10
11
|
}
|
|
11
12
|
}
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Component } from "./class/component/component";
|
|
2
2
|
import { routerController } from "render-security/class/Router";
|
|
3
|
+
import { PageController } from "./class/controller/pageController";
|
|
3
4
|
/**
|
|
4
5
|
* This class is the application class.
|
|
5
6
|
*/
|
|
@@ -9,7 +10,7 @@ export declare class RenderJS {
|
|
|
9
10
|
readonly styleLib: Map<string, Map<string, string>>;
|
|
10
11
|
router: routerController;
|
|
11
12
|
private application;
|
|
12
|
-
|
|
13
|
+
page: PageController;
|
|
13
14
|
constructor();
|
|
14
15
|
/**
|
|
15
16
|
* If you want to hava a permission control to your application,you can
|
package/package.json
CHANGED
package/runtime/tools.js
CHANGED