efront 3.25.3 → 3.25.8
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/_index.html +1 -1
- package/apps/pivot/log/count.html +2 -2
- package/coms/basic/Field.js +5 -0
- package/coms/basic/Item.js +16 -6
- package/coms/basic/Speed.js +20 -6
- package/coms/basic/Table.js +120 -0
- package/coms/basic/Tree.js +4 -4
- package/coms/basic/loader.js +11 -8
- package/coms/basic/mark.js +7 -5
- package/coms/basic/parseKV.js +1 -1
- package/coms/basic/with_.js +6 -0
- package/coms/basic/withget_.js +6 -0
- package/coms/frame/route.js +7 -1
- package/coms/kugou/playList.less +6 -0
- package/coms/random//350/272/253/344/273/275/350/257/201.js +4 -3
- package/coms/zimoli/alert.js +12 -13
- package/coms/zimoli/autodragchildren.js +4 -1
- package/coms/zimoli/cloneVisible.js +8 -2
- package/coms/zimoli/color.js +9 -4
- package/coms/zimoli/contextmenu.js +1 -1
- package/coms/zimoli/drag.js +1 -1
- package/coms/zimoli/getName.js +14 -6
- package/coms/zimoli/hexagon.js +33 -0
- package/coms/zimoli/list.js +5 -5
- package/coms/zimoli/menuItem.html +5 -2
- package/coms/zimoli/menuItem.less +1 -1
- package/coms/zimoli/menuList.js +30 -15
- package/coms/zimoli/menuList.less +0 -1
- package/coms/zimoli/moveupon.js +1 -0
- package/coms/zimoli/picture_.js +10 -10
- package/coms/zimoli/popup.js +4 -2
- package/coms/zimoli/render.js +1 -1
- package/coms/zimoli/resize.js +1 -0
- package/coms/zimoli/search.js +3 -72
- package/coms/zimoli/selectList.js +2 -1
- package/coms/zimoli/slider.js +21 -9
- package/coms/zimoli/table.js +18 -12
- package/coms/zimoli/table.less +9 -0
- package/coms/zimoli/touchList.js +22 -20
- package/coms/zimoli/tree.js +3 -2
- package/coms/zimoli/tree.less +4 -4
- package/coms/zimoli/vbox.js +6 -5
- package/coms/zimoli/watch.js +26 -0
- package/docs/compare.md +16 -10
- package/docs/main.js +3 -3
- package/package.json +5 -9
- package/public/efront.js +1 -1
- package/coms/zimoli/$objectHash.js +0 -22
- package/coms/zimoli/$objectHash_test.js +0 -15
package/coms/zimoli/getName.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
var hasOwnProperty = {}.hasOwnProperty;
|
|
2
2
|
function getName(o) {
|
|
3
|
-
|
|
4
|
-
if (
|
|
5
|
-
if (
|
|
6
|
-
if (
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
var name;
|
|
4
|
+
if (isEmpty(o)) return '';
|
|
5
|
+
if (!isObject(o)) return String(o);
|
|
6
|
+
if (hasOwnProperty.call(o, 'toString')) {
|
|
7
|
+
name = o.toString();
|
|
8
|
+
if (!isEmpty(name)) return String(name);
|
|
9
|
+
}
|
|
10
|
+
if (!isEmpty(o.name)) return String(o.name);
|
|
11
|
+
if (!isEmpty(o.title)) return String(o.title);
|
|
12
|
+
if (!isEmpty(o.label)) return String(o.label);
|
|
13
|
+
if (!isEmpty(o.value)) return String(o.value);
|
|
14
|
+
if (hasOwnProperty.call(o, 'valueOf')) name = o.valueOf();
|
|
15
|
+
if (!isEmpty(name)) return String(name);
|
|
16
|
+
return String(o);
|
|
9
17
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var hexagon = function (c = "#fff", lineWidth = devicePixelRatio) {
|
|
2
|
+
var image = document.createElement('canvas');
|
|
3
|
+
image.width = 9 * lineWidth;
|
|
4
|
+
image.height = 16 * lineWidth;
|
|
5
|
+
image.src = true;
|
|
6
|
+
var { width, height } = image;
|
|
7
|
+
var w = width;
|
|
8
|
+
var h = height;
|
|
9
|
+
|
|
10
|
+
var ctx = image.getContext("2d");
|
|
11
|
+
ctx.beginPath();
|
|
12
|
+
var cx = lineWidth / 2;
|
|
13
|
+
var cy = 0;
|
|
14
|
+
ctx.moveTo(cx, cy);
|
|
15
|
+
/* | */ctx.lineTo(cx, cy + h / 6);
|
|
16
|
+
/* \ */ctx.lineTo(cx + w / 2, cy + h / 3);
|
|
17
|
+
/* | */ctx.lineTo(cx + w / 2, cy + h * 2 / 3);
|
|
18
|
+
/* / */ctx.lineTo(cx, cy + h * 5 / 6);
|
|
19
|
+
/* | */ctx.lineTo(cx, cy + h);
|
|
20
|
+
ctx.moveTo(cx + w / 2, cy + h / 3);
|
|
21
|
+
/* / */ctx.lineTo(cx + w, cy + h / 6);
|
|
22
|
+
ctx.moveTo(cx + w / 2, cy + h * 2 / 3);
|
|
23
|
+
/* \ */ctx.lineTo(cx + w, cy + h * 5 / 6);
|
|
24
|
+
ctx.moveTo(cx, cy + h / 6);
|
|
25
|
+
ctx.lineTo(cx - w / 2, cy + h / 3);
|
|
26
|
+
ctx.moveTo(cx - w / 2, cy + h * 2 / 3);
|
|
27
|
+
ctx.lineTo(cx, cy + h * 5 / 6);
|
|
28
|
+
ctx.strokeStyle = c;
|
|
29
|
+
ctx.lineWidth = lineWidth;
|
|
30
|
+
ctx.stroke();
|
|
31
|
+
image.complete = true;
|
|
32
|
+
return image;
|
|
33
|
+
}
|
package/coms/zimoli/list.js
CHANGED
|
@@ -365,7 +365,7 @@ function ylist(container, generator, $Y) {
|
|
|
365
365
|
}
|
|
366
366
|
};
|
|
367
367
|
list.getLastVisibleElement = getLastVisibleElement;
|
|
368
|
-
list.$stopY = function (
|
|
368
|
+
list.$stopY = function (t, spd) {
|
|
369
369
|
var firstElement = getFirstVisibleElement();
|
|
370
370
|
var lastElement = getLastVisibleElement();
|
|
371
371
|
if (!firstElement || !lastElement || !list.clientHeight) return false;
|
|
@@ -388,15 +388,15 @@ function ylist(container, generator, $Y) {
|
|
|
388
388
|
}
|
|
389
389
|
var target_y = Math.abs(target_ty - last_y) > Math.abs(target_by - last_y) ? target_by : target_ty;
|
|
390
390
|
var delta = Math.min(calcPixel(60), list.clientHeight >> 2);
|
|
391
|
-
var
|
|
392
|
-
if (
|
|
391
|
+
var absy = Math.abs(target_y - last_y), y;
|
|
392
|
+
if (absy >= delta) {
|
|
393
393
|
return false;
|
|
394
394
|
}
|
|
395
|
-
if (
|
|
395
|
+
if (absy <= 1) y = target_y;
|
|
396
396
|
else {
|
|
397
397
|
var speed = Math.abs(spd.read()[0]);
|
|
398
398
|
if (speed < 1) speed = 1;
|
|
399
|
-
if (
|
|
399
|
+
if (absy < 3) speed = .5;
|
|
400
400
|
y = last_y + (target_y > last_y ? speed : -speed);
|
|
401
401
|
}
|
|
402
402
|
list.$Top(y);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
<
|
|
1
|
+
<template -if='useIcon||hasIcon||icon'>
|
|
2
|
+
<i ng-class="icon?"></i>
|
|
3
|
+
|
|
4
|
+
</template>
|
|
2
5
|
<span ng-html="name?"></span>
|
|
3
|
-
<template -if="hotkey
|
|
6
|
+
<template -if="hotkey?.length">
|
|
4
7
|
<span ng-repeat="k of hotkey" class="hotkey" ng-html="k"></span>
|
|
5
8
|
</template>
|
|
6
9
|
<s></s>
|
package/coms/zimoli/menuList.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _active = action;
|
|
1
2
|
var mounted_menus = [], releaseTimer = 0, root_menu;
|
|
2
3
|
var release = function () {
|
|
3
4
|
clear();
|
|
@@ -164,9 +165,16 @@ function register() {
|
|
|
164
165
|
on('keydown.space')(menu, keyspace);
|
|
165
166
|
on("contextmenu")(menu, e => e.preventDefault());
|
|
166
167
|
}
|
|
167
|
-
function main(
|
|
168
|
+
function main() {
|
|
169
|
+
var page, items, active = _active, direction = 'y';
|
|
170
|
+
for (var a of arguments) {
|
|
171
|
+
if (isNode(a)) page = a;
|
|
172
|
+
else if (a instanceof Function) active = a;
|
|
173
|
+
else if (a instanceof Array) items = a;
|
|
174
|
+
else if (typeof a === 'string') direction = a;
|
|
175
|
+
}
|
|
168
176
|
if (!isNode(page)) {
|
|
169
|
-
|
|
177
|
+
page = document.createElement("menu-list");
|
|
170
178
|
}
|
|
171
179
|
var main = this;
|
|
172
180
|
if (direction == 'y') page.ispop = true;
|
|
@@ -188,6 +196,7 @@ function main(page, items, active, direction = 'y') {
|
|
|
188
196
|
mounted_menus.push(menu);
|
|
189
197
|
page.actived = menu;
|
|
190
198
|
menu.root = page.root || page;
|
|
199
|
+
menu.go(0);
|
|
191
200
|
popup(menu, target);
|
|
192
201
|
if (page.ispop === true) {
|
|
193
202
|
} else {
|
|
@@ -199,10 +208,9 @@ function main(page, items, active, direction = 'y') {
|
|
|
199
208
|
once("remove")(menu, function () {
|
|
200
209
|
removeFromList(mounted_menus, this);
|
|
201
210
|
});
|
|
202
|
-
menu.go(0);
|
|
203
211
|
}
|
|
204
212
|
on("blur")(page, unfocus);
|
|
205
|
-
var template = page.tempalte || document.createElement(
|
|
213
|
+
var template = page.tempalte || document.createElement(page.tagName);
|
|
206
214
|
if (!page.tempalte) {
|
|
207
215
|
template.className = '';
|
|
208
216
|
template.removeAttribute('mode');
|
|
@@ -216,7 +224,6 @@ function main(page, items, active, direction = 'y') {
|
|
|
216
224
|
time = +time;
|
|
217
225
|
if (byMousedown && !time) return;
|
|
218
226
|
if (time) byMousedown = false;
|
|
219
|
-
|
|
220
227
|
if (page.ispop || time) popTimer = setTimeout(function () {
|
|
221
228
|
if (time) byMousedown = elem;
|
|
222
229
|
page.setFocus(elem);
|
|
@@ -272,7 +279,7 @@ function main(page, items, active, direction = 'y') {
|
|
|
272
279
|
};
|
|
273
280
|
var open1 = function (event) {
|
|
274
281
|
if (event.which === 3) event.preventDefault();
|
|
275
|
-
if (istoolbar) open.call(this, event.which === 3 ? 20 :
|
|
282
|
+
if (istoolbar) open.call(this, event.which === 3 ? 20 : 300);
|
|
276
283
|
};
|
|
277
284
|
if (!page.children.length || page.menutype === 1) {
|
|
278
285
|
page.menutype = 1;
|
|
@@ -289,7 +296,7 @@ function main(page, items, active, direction = 'y') {
|
|
|
289
296
|
"menu-item"(e, s) {
|
|
290
297
|
if (e && s === e.$scope) s = itemName ? s[itemName] : s.menu;
|
|
291
298
|
var a = button(
|
|
292
|
-
menuItem(e, s
|
|
299
|
+
menuItem(e, s, this.hasIcon)
|
|
293
300
|
);
|
|
294
301
|
if (!page.firstMenu) {
|
|
295
302
|
page.firstMenu = a;
|
|
@@ -317,23 +324,27 @@ function main(page, items, active, direction = 'y') {
|
|
|
317
324
|
list(page, function (index) {
|
|
318
325
|
var item = items[index];
|
|
319
326
|
if (!item) return;
|
|
320
|
-
if (
|
|
327
|
+
if (item.constructor !== Item) item = new Item(item);
|
|
321
328
|
var a = $scope["menu-item"](null, item);
|
|
322
329
|
if (src.itemName) a.setAttribute("e-if", notHidden);
|
|
323
330
|
a.setAttribute("e-class", className);
|
|
324
331
|
a.setAttribute("on-mouseleave", "cancel.call(this)");
|
|
325
332
|
a.setAttribute("on-mouseenter", "popMenu.call(this)");
|
|
326
|
-
a.setAttribute("on-pointermove", "popMenu.call(this)");
|
|
327
333
|
a.setAttribute("on-click", "open.call(this)");
|
|
328
334
|
a.setAttribute("_menu", src.itemName);
|
|
329
|
-
if (istoolbar)
|
|
335
|
+
if (istoolbar) {
|
|
336
|
+
a.setAttribute("on-pointerdown", "popMenu1.call(this,event)");
|
|
337
|
+
if (item.constructor === Item && item.length && !item.extended) {
|
|
338
|
+
item.extends(item[0]);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
330
341
|
a = generator(index, item, a);
|
|
331
342
|
return a;
|
|
332
|
-
});
|
|
343
|
+
}, direction);
|
|
333
344
|
}
|
|
334
345
|
else {
|
|
335
346
|
page.innerHTML = menuList;
|
|
336
|
-
$scope.menus = items.map(i => i
|
|
347
|
+
$scope.menus = items.map(i => i.constructor === Item ? i : new Item(i));
|
|
337
348
|
render(page, $scope);
|
|
338
349
|
vbox(page);
|
|
339
350
|
}
|
|
@@ -351,11 +362,15 @@ function main(page, items, active, direction = 'y') {
|
|
|
351
362
|
page.firstMenu = elem;
|
|
352
363
|
page.total = this.src.length;
|
|
353
364
|
}
|
|
354
|
-
elem.menu = this.src[index];
|
|
365
|
+
var menu = elem.menu = this.src[index];
|
|
355
366
|
on("mouseleave")(elem, cancel);
|
|
356
367
|
on("mouseenter")(elem, open);
|
|
357
|
-
|
|
358
|
-
|
|
368
|
+
if (istoolbar) {
|
|
369
|
+
on("pointerdown")(elem, open1);
|
|
370
|
+
if (menu.constructor === Item && menu.length && !menu.extended) {
|
|
371
|
+
menu.extends(menu[0]);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
359
374
|
on("click")(elem, fire);
|
|
360
375
|
return elem;
|
|
361
376
|
}, direction);
|
package/coms/zimoli/moveupon.js
CHANGED
|
@@ -30,6 +30,7 @@ if (/Firefox/.test(navigator.userAgent)) on('dragstart')(document, function (e)
|
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
var locktouch = function (target) {
|
|
33
|
+
if (target.resizable) return false;
|
|
33
34
|
if (/(input|textarea|select)/i.test(target.tagName) || getTargetIn(a => String(a.contentEditable) === 'true' || a.draggable, target)) {
|
|
34
35
|
return true;
|
|
35
36
|
} else {
|
package/coms/zimoli/picture_.js
CHANGED
|
@@ -15,7 +15,7 @@ var isequal = (a, b) => a === b || Math.abs(a - b) < .1;
|
|
|
15
15
|
var aimed = (from, to) => (from + from + from + to) / 4;
|
|
16
16
|
function picture_(image = document.createElement("div")) {
|
|
17
17
|
var image_width, image_height;
|
|
18
|
-
var scaled = 1, x = 0, y = 0, min_scale, cover_scale,
|
|
18
|
+
var scaled = 1, x = 0, y = 0, min_scale, cover_scale, isxthin, contain_scale, loaded_scale, click_scale, loaded_x, loaded_y;
|
|
19
19
|
var loaded_width, loaded_height;
|
|
20
20
|
var max_scale = 10 * devicePixelRatio;
|
|
21
21
|
var istouching = false;
|
|
@@ -38,14 +38,14 @@ function picture_(image = document.createElement("div")) {
|
|
|
38
38
|
deltay = y + image_height * scaled / 2 - loaded_height / 2;
|
|
39
39
|
}
|
|
40
40
|
else if (scaled <= cover_scale) {
|
|
41
|
-
if (
|
|
42
|
-
if (
|
|
43
|
-
else if (x + image_width * scaled < loaded_width) deltax = loaded_width - x + image_width * scaled;
|
|
44
|
-
deltay = y + image_height * scaled / 2 - loaded_height / 2;
|
|
45
|
-
} else {
|
|
46
|
-
if (y > 0) deltay = y;
|
|
41
|
+
if (isxthin) {
|
|
42
|
+
if (y >= 0) deltay = y;
|
|
47
43
|
else if (y + image_height * scaled < loaded_height) deltay = y + image_height * scaled - loaded_height;
|
|
48
44
|
deltax = x + image_width * scaled / 2 - loaded_width / 2;
|
|
45
|
+
} else {
|
|
46
|
+
if (x >= 0) deltax = x;
|
|
47
|
+
else if (x + image_width * scaled < loaded_width) deltax = loaded_width - x + image_width * scaled;
|
|
48
|
+
deltay = y + image_height * scaled / 2 - loaded_height / 2;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
@@ -81,9 +81,9 @@ function picture_(image = document.createElement("div")) {
|
|
|
81
81
|
shaped_rotate = 0;
|
|
82
82
|
var y_scale = loaded_height / image_height;
|
|
83
83
|
var x_scale = loaded_width / image_width;
|
|
84
|
-
|
|
85
|
-
cover_scale =
|
|
86
|
-
loaded_scale = contain_scale =
|
|
84
|
+
isxthin = x_scale > y_scale;
|
|
85
|
+
cover_scale = isxthin ? x_scale : y_scale;
|
|
86
|
+
loaded_scale = contain_scale = isxthin ? y_scale : x_scale;
|
|
87
87
|
if (loaded_scale >= 1) {
|
|
88
88
|
if (loaded_scale > devicePixelRatio) {
|
|
89
89
|
loaded_scale = devicePixelRatio;
|
package/coms/zimoli/popup.js
CHANGED
|
@@ -278,6 +278,7 @@ var _as_yextra = function (global, innerWidth, innerHeight, element, target, poi
|
|
|
278
278
|
|
|
279
279
|
css(element, `min-width:auto;`);
|
|
280
280
|
var aimedWidth = getScreenPosition(element).width;
|
|
281
|
+
var originWidth = aimedWidth;
|
|
281
282
|
//如果宽度不足其附着元素的宽度
|
|
282
283
|
if (aimedWidth < position.width) {
|
|
283
284
|
aimedWidth = position.width;
|
|
@@ -288,7 +289,8 @@ var _as_yextra = function (global, innerWidth, innerHeight, element, target, poi
|
|
|
288
289
|
aimedWidth = maxWidth;
|
|
289
290
|
}
|
|
290
291
|
var side;
|
|
291
|
-
if (aimedWidth !==
|
|
292
|
+
if (aimedWidth !== originWidth) {
|
|
293
|
+
console.log(originWidth,aimedWidth)
|
|
292
294
|
css(element, { width: fromOffset(aimedWidth) });
|
|
293
295
|
}
|
|
294
296
|
if (position.top + element.offsetHeight + position.height > innerHeight) {
|
|
@@ -303,7 +305,7 @@ var _as_yextra = function (global, innerWidth, innerHeight, element, target, poi
|
|
|
303
305
|
css(_rhomb, temp);
|
|
304
306
|
_rhomb.setSide(side);
|
|
305
307
|
}
|
|
306
|
-
var targetX = position.left
|
|
308
|
+
var targetX = position.left - parseFloat(getComputedStyle(element).paddingLeft);
|
|
307
309
|
if (targetX < 0) {
|
|
308
310
|
css(element, `left:0;right:auto`);
|
|
309
311
|
if (_rhomb) css(_rhomb, `left:${fromOffset(position.left + position.width / 2)};right:auto`);
|
package/coms/zimoli/render.js
CHANGED
|
@@ -173,7 +173,7 @@ var createRepeat = function (search, id = 0) {
|
|
|
173
173
|
var $parentScopes = element.$parentScopes || [];
|
|
174
174
|
var $struct = element.$struct;
|
|
175
175
|
if (element.$scope) {
|
|
176
|
-
$struct = extend({}, $struct, { context: $struct.context + `with(this.$parentScopes[${$parentScopes.length}])` }), $parentScopes = $parentScopes.
|
|
176
|
+
$struct = extend({}, $struct, { context: $struct.context + `with(this.$parentScopes[${$parentScopes.length}])` }), $parentScopes = $parentScopes.slice(), $parentScopes.push(element.$scope);
|
|
177
177
|
}
|
|
178
178
|
var clonedElements1 = Object.create(null);
|
|
179
179
|
var cloned = keys.map(function (key, cx) {
|
package/coms/zimoli/resize.js
CHANGED
|
@@ -155,6 +155,7 @@ resize.on = function (elem, dragHandle) {
|
|
|
155
155
|
if (elem) {
|
|
156
156
|
elem.dragHandle = dragHandle;
|
|
157
157
|
}
|
|
158
|
+
elem.resizable = true;
|
|
158
159
|
onmounted(elem, function () {
|
|
159
160
|
if (!offmousemove) offmousemove = onmousemove(window, getResizer);
|
|
160
161
|
if (!~resizingElements.indexOf(elem)) {
|
package/coms/zimoli/search.js
CHANGED
|
@@ -1,77 +1,8 @@
|
|
|
1
1
|
function search(seartext, options, path = "name") {
|
|
2
|
-
var a = new
|
|
3
|
-
a.
|
|
2
|
+
var a = new Table;
|
|
3
|
+
a.searchFields = [{ key: path }];
|
|
4
4
|
a.searchText = seartext;
|
|
5
5
|
a.source = options;
|
|
6
|
-
if (a.searchText) a.
|
|
6
|
+
if (a.searchText) a.update();
|
|
7
7
|
return a;
|
|
8
|
-
}
|
|
9
|
-
function minusPower(a, b) {
|
|
10
|
-
return a.power - b.power >= 0;
|
|
11
|
-
}
|
|
12
|
-
function returnName() {
|
|
13
|
-
return this.name;
|
|
14
|
-
}
|
|
15
|
-
class SearchResult extends Array {
|
|
16
|
-
searchPath = 'name';
|
|
17
|
-
searchText = null;
|
|
18
|
-
source = null;
|
|
19
|
-
complete = true;
|
|
20
|
-
searched = 0;
|
|
21
|
-
searchid = 0;
|
|
22
|
-
hasFullmatch = false;
|
|
23
|
-
callback = null;
|
|
24
|
-
addItem(o) {
|
|
25
|
-
var path = this.searchPath;
|
|
26
|
-
var seartext = this.searchText;
|
|
27
|
-
if (isEmpty(o)) return;
|
|
28
|
-
var name = seek(o, path);
|
|
29
|
-
if (name === seartext) this.hasFullmatch = true;
|
|
30
|
-
var [power, m] = mark.power(name, seartext);
|
|
31
|
-
if (isNode(o)) {
|
|
32
|
-
o = extend({
|
|
33
|
-
name: o.name,
|
|
34
|
-
title: o.title,
|
|
35
|
-
value: o.value,
|
|
36
|
-
key: o.key,
|
|
37
|
-
nodeType: o.nodeType,
|
|
38
|
-
tagName: o.tagName,
|
|
39
|
-
nodeValue: o.nodeValue,
|
|
40
|
-
}, o);
|
|
41
|
-
}
|
|
42
|
-
else o = isObject(o) ? Object.create(o) : new o.constructor(o);
|
|
43
|
-
o.power = power;
|
|
44
|
-
if (isString(path)) o[path] = m;
|
|
45
|
-
else o.name = m, o.toString = returnName, o.valueOf = returnName;
|
|
46
|
-
if (o.power > 0) {
|
|
47
|
-
saveToOrderedArray(this, o, minusPower);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
search(text, callback) {
|
|
51
|
-
if (isFunction(callback)) this.callback = callback;
|
|
52
|
-
if (text === this.searchText) return;
|
|
53
|
-
this.searchText = text;
|
|
54
|
-
this.start();
|
|
55
|
-
}
|
|
56
|
-
async start() {
|
|
57
|
-
this.searched = 0;
|
|
58
|
-
this.splice(0, this.length);
|
|
59
|
-
var searchid = ++this.searchid;
|
|
60
|
-
this.complete = false;
|
|
61
|
-
if (this.searchText) for (var o of this.source) {
|
|
62
|
-
this.addItem(o);
|
|
63
|
-
if (++this.searched % 6000 === 0) {
|
|
64
|
-
if (isFunction(this.callback)) this.callback();
|
|
65
|
-
await new Promise(function (ok) {
|
|
66
|
-
setTimeout(ok, 20)
|
|
67
|
-
});
|
|
68
|
-
if (this.searchid !== searchid) break;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
this.complete = true;
|
|
72
|
-
if (isFunction(this.callback)) this.callback();
|
|
73
|
-
}
|
|
74
|
-
abort() {
|
|
75
|
-
this.searchid++;
|
|
76
|
-
}
|
|
77
8
|
}
|
|
@@ -243,7 +243,8 @@ function main() {
|
|
|
243
243
|
moveFocus(-focus);
|
|
244
244
|
});
|
|
245
245
|
bind("keydown.end")(page, function (e) {
|
|
246
|
-
|
|
246
|
+
var coverIndex = children.coverCount > focus + 1 ? children.coverCount - 1 : children.length - 1;
|
|
247
|
+
moveFocus(coverIndex - focus);
|
|
247
248
|
});
|
|
248
249
|
bind("keydown.pagedown")(page, function (e) {
|
|
249
250
|
page.scrollBy(page.clientHeight);
|
package/coms/zimoli/slider.js
CHANGED
|
@@ -112,29 +112,40 @@ function slider(autoplay, circle = true) {
|
|
|
112
112
|
left: round((indexRight - index) * width) + "px"
|
|
113
113
|
});
|
|
114
114
|
};
|
|
115
|
+
var savedtime = 0;
|
|
116
|
+
var animate0 = function () {
|
|
117
|
+
savedtime = Speed.now() - 1;
|
|
118
|
+
animate();
|
|
119
|
+
};
|
|
115
120
|
var animate = function () {
|
|
116
121
|
cancelAnimationFrame(timer_animate);
|
|
117
122
|
var width = outter.clientWidth;
|
|
123
|
+
var now = +Speed.now();
|
|
118
124
|
if (abs(current_index + negative_index) < 1.25 / width)
|
|
119
125
|
return reshape(-negative_index, false);
|
|
120
126
|
timer_animate = requestAnimationFrame(animate);
|
|
121
|
-
|
|
127
|
+
var temp_index = current_index;
|
|
128
|
+
while (savedtime < now) {
|
|
129
|
+
temp_index = (temp_index * 11 - negative_index) / 12;
|
|
130
|
+
savedtime += 6;
|
|
131
|
+
}
|
|
132
|
+
reshape(temp_index);
|
|
122
133
|
};
|
|
123
134
|
var park = function () {
|
|
124
135
|
direction = 0;
|
|
125
136
|
var singleTarget = getSingleTarget();
|
|
126
|
-
var spd = _speed();
|
|
137
|
+
var spd = _speed() * 40;
|
|
127
138
|
if (singleTarget) {
|
|
128
139
|
negative_index = round(negative_index);
|
|
129
140
|
}
|
|
130
141
|
else if (delta_negative_index > 0) {
|
|
131
|
-
if (negative_index - floor(negative_index) >
|
|
142
|
+
if (negative_index - floor(negative_index) > .007 / (.07 + abs(spd)))
|
|
132
143
|
negative_index = ceil(negative_index);
|
|
133
144
|
else
|
|
134
145
|
negative_index = floor(negative_index);
|
|
135
146
|
}
|
|
136
147
|
else if (delta_negative_index < 0) {
|
|
137
|
-
if (ceil(negative_index) - negative_index >
|
|
148
|
+
if (ceil(negative_index) - negative_index > .007 / (.07 + abs(spd)))
|
|
138
149
|
negative_index = floor(negative_index);
|
|
139
150
|
else
|
|
140
151
|
negative_index = ceil(negative_index);
|
|
@@ -142,7 +153,8 @@ function slider(autoplay, circle = true) {
|
|
|
142
153
|
else {
|
|
143
154
|
negative_index = round(negative_index);
|
|
144
155
|
}
|
|
145
|
-
|
|
156
|
+
savedtime = 0;
|
|
157
|
+
animate0();
|
|
146
158
|
var event = createEvent("park");
|
|
147
159
|
event.index = -negative_index;
|
|
148
160
|
dispatch(outter, event);
|
|
@@ -176,7 +188,7 @@ function slider(autoplay, circle = true) {
|
|
|
176
188
|
if (enabled) outter.go(outter.index + count);
|
|
177
189
|
} else {
|
|
178
190
|
if (enabled) negative_index -= count;
|
|
179
|
-
|
|
191
|
+
animate0();
|
|
180
192
|
}
|
|
181
193
|
return enabled;
|
|
182
194
|
};
|
|
@@ -186,7 +198,7 @@ function slider(autoplay, circle = true) {
|
|
|
186
198
|
var singleTarget = getSingleTarget();
|
|
187
199
|
if (singleTarget) {
|
|
188
200
|
var current_Left = singleTarget.offsetLeft;
|
|
189
|
-
var avail_deltaWidth = round(width >> 2);
|
|
201
|
+
var avail_deltaWidth = Math.min(round(width >> 2), 120);
|
|
190
202
|
if (current_Left + deltax > avail_deltaWidth) {
|
|
191
203
|
deltax = avail_deltaWidth - current_Left;
|
|
192
204
|
saved_x += deltax;
|
|
@@ -256,7 +268,7 @@ function slider(autoplay, circle = true) {
|
|
|
256
268
|
}
|
|
257
269
|
})
|
|
258
270
|
|
|
259
|
-
outter.go = function (index, cache) {
|
|
271
|
+
outter.go = lazy(function (index, cache) {
|
|
260
272
|
if (outter.index === index && cache !== false) return;
|
|
261
273
|
negative_index = -index;
|
|
262
274
|
var _removingMain = _imageMain;
|
|
@@ -275,7 +287,7 @@ function slider(autoplay, circle = true) {
|
|
|
275
287
|
setTimeout(() => css(_imageMain, "transform:scale(1);opacity:1;transition:.2s transform ease-out,.4s opacity"), 0);
|
|
276
288
|
if (player.ing) play();
|
|
277
289
|
return outter;
|
|
278
|
-
};
|
|
290
|
+
}, 20);
|
|
279
291
|
outter.play = function (schedule = player.schedule, _isMiss) {
|
|
280
292
|
if (isDefined(_isMiss)) {
|
|
281
293
|
isMiss = _isMiss;
|
package/coms/zimoli/table.js
CHANGED
|
@@ -407,21 +407,29 @@ function table(elem) {
|
|
|
407
407
|
};
|
|
408
408
|
vbox(table, 'x');
|
|
409
409
|
};
|
|
410
|
-
care(table, function ([fields, data]) {
|
|
410
|
+
care(table, async function ([fields, data]) {
|
|
411
411
|
if (_vbox) _vbox(), _vbox = null;
|
|
412
|
+
watch(table, {
|
|
413
|
+
find(text) {
|
|
414
|
+
$scope.data.searchText = text;
|
|
415
|
+
$scope.data.update();
|
|
416
|
+
}
|
|
417
|
+
})
|
|
412
418
|
thead = null;
|
|
413
419
|
fields.forEach(enrichField);
|
|
414
420
|
remove(this.children);
|
|
415
421
|
this.innerHTML = template;
|
|
416
422
|
markedRows = false;
|
|
417
423
|
this.style.display = 'block';
|
|
418
|
-
|
|
424
|
+
var $scope = {
|
|
419
425
|
fields,
|
|
420
426
|
isEmpty,
|
|
427
|
+
tbody0: null,
|
|
421
428
|
tbody(e) {
|
|
422
429
|
var e = list.apply(null, arguments);
|
|
423
430
|
css(e, tbodyHeight(e));
|
|
424
431
|
css(e, { width: this.adapter.offsetWidth, display: 'block' });
|
|
432
|
+
this.tbody0 = e;
|
|
425
433
|
return e;
|
|
426
434
|
},
|
|
427
435
|
thead(t) {
|
|
@@ -439,14 +447,7 @@ function table(elem) {
|
|
|
439
447
|
resizeT,
|
|
440
448
|
model,
|
|
441
449
|
sort(f) {
|
|
442
|
-
|
|
443
|
-
data.sort(function (a, b) {
|
|
444
|
-
a = seek(a, f.key);
|
|
445
|
-
b = seek(b, f.key);
|
|
446
|
-
if (a > b) return f.sign;
|
|
447
|
-
if (a < b) return -f.sign;
|
|
448
|
-
return 0;
|
|
449
|
-
});
|
|
450
|
+
this.data.sort(f);
|
|
450
451
|
},
|
|
451
452
|
setWidth(target, f) {
|
|
452
453
|
css(target, { width: f.width });
|
|
@@ -454,7 +455,12 @@ function table(elem) {
|
|
|
454
455
|
a: button,
|
|
455
456
|
setFixedColumn,
|
|
456
457
|
pagination
|
|
457
|
-
}
|
|
458
|
+
};
|
|
459
|
+
render(this, $scope, this.$parentScopes.concat(this.$scope));
|
|
460
|
+
$scope.data = Table.from(fields, await data);
|
|
461
|
+
$scope.data.callback = function () {
|
|
462
|
+
if ($scope.tbody0) $scope.tbody0.go($scope.tbody0.index());
|
|
463
|
+
};
|
|
458
464
|
})
|
|
459
465
|
autodragchildren(
|
|
460
466
|
table,
|
|
@@ -505,7 +511,7 @@ function table(elem) {
|
|
|
505
511
|
}
|
|
506
512
|
markThead();
|
|
507
513
|
markedRows = true;
|
|
508
|
-
requestAnimationFrame(function(){
|
|
514
|
+
requestAnimationFrame(function () {
|
|
509
515
|
setFixedColumn.call(table)
|
|
510
516
|
})
|
|
511
517
|
}
|