efront 3.12.0 → 3.12.4
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/coms/basic/{_cross.js → cross_.js} +9 -9
- package/coms/basic/sortname.js +6 -2
- package/coms/kugou/parseSongsList.js +0 -1
- package/coms/reptile/cross.js +1 -1
- package/coms/zimoli/active.js +4 -4
- package/coms/zimoli/button.js +19 -1
- package/coms/zimoli/button.less +7 -0
- package/coms/zimoli/chooseFile.js +3 -1
- package/coms/zimoli/cross.js +3 -3
- package/coms/zimoli/data.js +7 -5
- package/coms/zimoli/encode62.js +6 -3
- package/coms/zimoli/getGenerator.js +3 -3
- package/coms/zimoli/list.js +38 -12
- package/coms/zimoli/list_test.js +2 -2
- package/coms/zimoli/menu.js +14 -3
- package/coms/zimoli/menuList.js +12 -13
- package/coms/zimoli/on.js +2 -2
- package/coms/zimoli/picture.js +9 -3
- package/coms/zimoli/popup.js +4 -4
- package/coms/zimoli/render.js +1 -1
- package/coms/zimoli/select.js +26 -1
- package/coms/zimoli/selectList.js +89 -5
- package/coms/zimoli/selectList.less +1 -1
- package/coms/zimoli/selectList_test.html +7 -3
- package/coms/zimoli/selectList_test.js +9 -3
- package/coms/zimoli/touchList_test.js +2 -2
- package/coms/zimoli/vbox.js +1 -1
- package/package.json +1 -1
- package/public/efront.js +1 -1
- package/readme.md +7 -0
|
@@ -29,8 +29,28 @@ var multipleClick = function () {
|
|
|
29
29
|
dispatch(node, "change");
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
|
|
33
|
+
function main() {
|
|
34
|
+
var children, multiple, addable, generator, page;
|
|
35
|
+
for (let a of arguments) {
|
|
36
|
+
if (a instanceof Array) children = a;
|
|
37
|
+
switch (typeof a) {
|
|
38
|
+
case "function":
|
|
39
|
+
generator = a;
|
|
40
|
+
break;
|
|
41
|
+
case "boolean":
|
|
42
|
+
if (multiple === void 0) multiple = a;
|
|
43
|
+
else addable = a;
|
|
44
|
+
case "object":
|
|
45
|
+
if (isNode(a)) {
|
|
46
|
+
page = a;
|
|
47
|
+
if (!generator) generator = getGenerator(page);
|
|
48
|
+
}
|
|
49
|
+
else if (a.length) children = a;
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (!page) page = div();
|
|
34
54
|
page.value = multiple ? [] : "";
|
|
35
55
|
var clicker = multiple ? multipleClick : singleClick;
|
|
36
56
|
var itemMap = Object.create(null);
|
|
@@ -67,18 +87,28 @@ function main(children, multiple, addable) {
|
|
|
67
87
|
item.setAttribute('disabled', '');
|
|
68
88
|
} else {
|
|
69
89
|
onclick(item, clicker);
|
|
90
|
+
on("mouseenter")(item, mouseenter);
|
|
70
91
|
}
|
|
71
92
|
return item;
|
|
72
93
|
|
|
73
94
|
}
|
|
95
|
+
var mouseenter = function () {
|
|
96
|
+
if (!mouse) return;
|
|
97
|
+
focus = this.index;
|
|
98
|
+
setFocus();
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
|
|
74
102
|
var hasIcon = false, iconed = '';
|
|
75
103
|
var page = list(page, function (i) {
|
|
76
104
|
if (i < 0 || i >= children.length) return;
|
|
77
|
-
return createItem(children[i]);
|
|
105
|
+
return createItem(generator ? generator(i) : children[i]);
|
|
78
106
|
});
|
|
79
|
-
|
|
107
|
+
once("append")(page, function () {
|
|
108
|
+
var index = 0;
|
|
109
|
+
for (var cx = 0, dx = children.length; cx < dx; cx++)if (children[cx].selected) index = cx;
|
|
80
110
|
page.clean();
|
|
81
|
-
page.go(
|
|
111
|
+
page.go(index);
|
|
82
112
|
if (adder) {
|
|
83
113
|
remove(adder);
|
|
84
114
|
appendChild(page, adder);
|
|
@@ -135,6 +165,60 @@ function main(children, multiple, addable) {
|
|
|
135
165
|
adder.setAttribute("adder", '');
|
|
136
166
|
}
|
|
137
167
|
page.icon = iconed;
|
|
168
|
+
var focus = 0, focused, mouse = false;
|
|
169
|
+
var setFocus = function () {
|
|
170
|
+
var e = page.getIndexedElement(focus);
|
|
171
|
+
if (e === focused) return;
|
|
172
|
+
if (focused) removeClass(focused, 'focus');
|
|
173
|
+
focused = e;
|
|
174
|
+
if (e) addClass(e, 'focus');
|
|
175
|
+
mouse = false;
|
|
176
|
+
};
|
|
177
|
+
var setMouse = function () {
|
|
178
|
+
mouse = true;
|
|
179
|
+
}
|
|
180
|
+
onmousemove(page, setMouse);
|
|
181
|
+
onmousewheel(page, setMouse);
|
|
182
|
+
var moveFocus = function (delta) {
|
|
183
|
+
focus += delta;
|
|
184
|
+
if (focus < 0) focus = 0;
|
|
185
|
+
if (focus >= children.length) focus = children.length - 1;
|
|
186
|
+
page.scrollIfNotCover(focus);
|
|
187
|
+
setFocus();
|
|
188
|
+
};
|
|
189
|
+
bind('keydown.up')(page, function () {
|
|
190
|
+
moveFocus(-1);
|
|
191
|
+
});
|
|
192
|
+
bind('keydown.down')(page, function () {
|
|
193
|
+
moveFocus(1);
|
|
194
|
+
});
|
|
195
|
+
bind('keydown.tab')(page, function (event) {
|
|
196
|
+
if (document.activeElement === page.target) event.preventDefault();
|
|
197
|
+
moveFocus(event.shiftKey ? -1 : 1);
|
|
198
|
+
});
|
|
199
|
+
bind("keydown.home")(page, function (e) {
|
|
200
|
+
moveFocus(-focus);
|
|
201
|
+
});
|
|
202
|
+
bind("keydown.end")(page, function (e) {
|
|
203
|
+
moveFocus(children.length - 1 - focus);
|
|
204
|
+
});
|
|
205
|
+
bind("keydown.pagedown")(page, function (e) {
|
|
206
|
+
page.scrollBy(page.clientHeight);
|
|
207
|
+
focus = page.index() | 0;
|
|
208
|
+
moveFocus(0);
|
|
209
|
+
})
|
|
210
|
+
bind("keydown.pageup")(page, function (e) {
|
|
211
|
+
page.scrollBy(-page.clientHeight);
|
|
212
|
+
focus = page.index() | 0;
|
|
213
|
+
moveFocus(0);
|
|
214
|
+
})
|
|
215
|
+
var enter = function (e) {
|
|
216
|
+
e.preventDefault();
|
|
217
|
+
var e = page.getIndexedElement(focus);
|
|
218
|
+
if (e) e.click();
|
|
219
|
+
};
|
|
220
|
+
bind('keydown.enter')(page, enter);
|
|
221
|
+
bind('keydown.space')(page, enter);
|
|
138
222
|
on('mousedown')(page, e => e.preventDefault());
|
|
139
223
|
return page;
|
|
140
224
|
}
|
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
<option>选项一</option>
|
|
3
3
|
<option>选项二</option>
|
|
4
4
|
<option>选项三</option>
|
|
5
|
+
<option selected>简单选项</option>
|
|
5
6
|
</select>
|
|
6
7
|
<select>
|
|
7
|
-
<option
|
|
8
|
-
<option
|
|
9
|
-
<option>选项三</option>
|
|
8
|
+
<option -repeat="(o,i) in options600" -text="'选项'+o">选项</option>
|
|
9
|
+
<option selected>600个选项</option>
|
|
10
10
|
</select>
|
|
11
|
+
<select -src="(o,i) in options6000">
|
|
12
|
+
<option -text="'选项'+o">选项</option>
|
|
13
|
+
<option insert selected>60000个选项</option>
|
|
14
|
+
</select>
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
var page = div();
|
|
2
2
|
page.innerHTML = selectList_test;
|
|
3
|
-
render(page,{
|
|
4
|
-
select
|
|
5
|
-
|
|
3
|
+
render(page, {
|
|
4
|
+
select,
|
|
5
|
+
select2() {
|
|
6
|
+
var sel = document.createElement("select");
|
|
7
|
+
return sel;
|
|
8
|
+
},
|
|
9
|
+
options600: new Array(600).fill(0).map((_, a) => a),
|
|
10
|
+
options6000: new Array(60000).fill(0).map((_, a) => a)
|
|
11
|
+
});
|
|
6
12
|
function main() {
|
|
7
13
|
return page;
|
|
8
14
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var listY = list(function (
|
|
1
|
+
var listY = list(function (index) {
|
|
2
2
|
var item = div();
|
|
3
3
|
css(item, `width:100%;height:${Math.random() * 110 + 30}px;border:1px solid;`);
|
|
4
|
-
text(item,
|
|
4
|
+
text(item, index);
|
|
5
5
|
return item;
|
|
6
6
|
}, "Y");
|
|
7
7
|
onappend(listY, function () {
|
package/coms/zimoli/vbox.js
CHANGED
|
@@ -201,7 +201,7 @@ function ybox(generator) {
|
|
|
201
201
|
}
|
|
202
202
|
this.YScrollBoxId = +scrollId + 1;
|
|
203
203
|
}
|
|
204
|
-
if (_box
|
|
204
|
+
if (isMounted(_box)) initScrollId.call(_box);
|
|
205
205
|
on("append")(_box, initScrollId);
|
|
206
206
|
_box.cancelFrame = function () {
|
|
207
207
|
cancelAnimationFrame(smooth_timer);
|