efront 3.11.4 → 3.12.0
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/apps/pivot/link/list.js
CHANGED
|
@@ -7,13 +7,13 @@ function main() {
|
|
|
7
7
|
await this.clusters;
|
|
8
8
|
this.active();
|
|
9
9
|
},
|
|
10
|
-
index: data.getInstance("index")
|
|
10
|
+
index: data.getInstance("index"),
|
|
11
11
|
clusters: [],
|
|
12
12
|
filterTime(d) {
|
|
13
13
|
return ((new Date - d) / 1000 | 0) + "秒";
|
|
14
14
|
},
|
|
15
15
|
clients: [],
|
|
16
|
-
active(index = this.index) {
|
|
16
|
+
active(index = this.index.index | 0) {
|
|
17
17
|
data.setInstance('index', { index });
|
|
18
18
|
var clusters = this.clusters;
|
|
19
19
|
if (index >= clusters.length) index = clusters.length - 1;
|
package/coms/zimoli/model.js
CHANGED
|
@@ -91,15 +91,17 @@ var constructors = {
|
|
|
91
91
|
}
|
|
92
92
|
else if (t === 'a') {
|
|
93
93
|
var { field, data } = _;
|
|
94
|
-
var pad = selectList(field.options, field.multi, true);
|
|
95
|
-
var e = document.createElement('select');
|
|
96
94
|
var opt = null;
|
|
97
|
-
for (var
|
|
95
|
+
for (var cx = 0, options = field.options, dx = options.length; cx < dx; cx++) {
|
|
96
|
+
var o = options[cx];
|
|
98
97
|
if (o.key === data[field.key]) {
|
|
99
98
|
opt = o;
|
|
99
|
+
o.selected = true;
|
|
100
100
|
break;
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
+
var pad = selectList(field.options, field.multi, true);
|
|
104
|
+
var e = document.createElement('select');
|
|
103
105
|
e.innerHTML = `<option selected value="${opt ? opt.key : ''}">${opt ? opt.name : '请选择'}</option>`;
|
|
104
106
|
e.value = opt ? opt.key : '';
|
|
105
107
|
elem = select(e, pad);
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
var singleClick = function () {
|
|
2
2
|
var node = this.parentNode;
|
|
3
3
|
if (node.activeNode === this) return;
|
|
4
|
-
if (node.activeNode)
|
|
4
|
+
if (node.activeNode) {
|
|
5
|
+
if (node.activeNode.origin) node.activeNode.origin.selected = false;
|
|
6
|
+
node.activeNode.removeAttribute("selected");
|
|
7
|
+
}
|
|
5
8
|
this.setAttribute("selected", "");
|
|
9
|
+
|
|
6
10
|
node.activeNode = this;
|
|
7
11
|
if (node.value === this.value) return;
|
|
8
12
|
node.value = this.value;
|
|
9
13
|
node.name = this.name;
|
|
14
|
+
if (this.origin) this.origin.selected = true;
|
|
10
15
|
dispatch(node, "change");
|
|
11
16
|
};
|
|
12
17
|
var multipleClick = function () {
|
|
@@ -20,13 +25,13 @@ var multipleClick = function () {
|
|
|
20
25
|
values.splice(index, 1);
|
|
21
26
|
this.removeAttribute("selected");
|
|
22
27
|
}
|
|
28
|
+
if (this.origin) this.origin.selected = true;
|
|
23
29
|
dispatch(node, "change");
|
|
24
30
|
};
|
|
25
31
|
|
|
26
32
|
function main(children, multiple, addable) {
|
|
27
33
|
var page = div();
|
|
28
34
|
page.value = multiple ? [] : "";
|
|
29
|
-
var firstValue = false;
|
|
30
35
|
var clicker = multiple ? multipleClick : singleClick;
|
|
31
36
|
var itemMap = Object.create(null);
|
|
32
37
|
function createItem(option) {
|
|
@@ -36,6 +41,7 @@ function main(children, multiple, addable) {
|
|
|
36
41
|
item.setAttribute("item", '');
|
|
37
42
|
item.innerHTML = option.innerHTML || option.name;
|
|
38
43
|
item.name = option.name || option.innerHTML;
|
|
44
|
+
item.origin = option;
|
|
39
45
|
var icon = option.getAttribute ? option.getAttribute("icon") : option.icon;
|
|
40
46
|
if (icon) {
|
|
41
47
|
if (!hasIcon) {
|
|
@@ -50,10 +56,10 @@ function main(children, multiple, addable) {
|
|
|
50
56
|
if (multiple) {
|
|
51
57
|
item.setAttribute("selected", "");
|
|
52
58
|
page.value.push(option.value);
|
|
53
|
-
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
54
61
|
item.setAttribute("selected", "");
|
|
55
62
|
page.activeNode = item;
|
|
56
|
-
firstValue = true;
|
|
57
63
|
page.value = option.value
|
|
58
64
|
}
|
|
59
65
|
}
|