efront 3.25.7 → 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/coms/basic/Item.js +13 -3
- package/coms/basic/Speed.js +20 -6
- package/coms/basic/Tree.js +4 -4
- package/coms/basic/loader.js +11 -8
- package/coms/frame/route.js +7 -1
- package/coms/kugou/playList.less +6 -0
- 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 +20 -13
- package/coms/zimoli/menuList.less +0 -1
- package/coms/zimoli/moveupon.js +1 -0
- package/coms/zimoli/render.js +1 -1
- package/coms/zimoli/resize.js +1 -0
- package/coms/zimoli/slider.js +19 -7
- package/coms/zimoli/table.js +7 -1
- package/coms/zimoli/touchList.js +22 -20
- package/coms/zimoli/vbox.js +6 -5
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/apps/_index.html
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<meta charset="utf-8" />
|
|
10
10
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
11
11
|
<link rel="Shortcut Icon" href="/favicon.ico" type="image/x-icon" />
|
|
12
|
-
<meta name="viewport" content="initial-scale=1,maximum-scale=1,width=device-width" />
|
|
12
|
+
<meta name="viewport" content="initial-scale=1,maximum-scale=1,width=device-width,user-scalable=no,initial-scale=1" />
|
|
13
13
|
<title>efront 项目</title>
|
|
14
14
|
<script deleteoncompile efrontloader>
|
|
15
15
|
// 若要在开发环境使用内置组件,请保留此script标签中的代码,在编译发布时,这里的代码会自动删除
|
package/coms/basic/Item.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
var id = 0;
|
|
2
2
|
class Item extends Array {
|
|
3
|
+
extended = false;
|
|
3
4
|
constructor(value) {
|
|
4
5
|
super();
|
|
5
6
|
this.children = this;
|
|
@@ -7,10 +8,11 @@ class Item extends Array {
|
|
|
7
8
|
this.total = 0;//子项中的节点数
|
|
8
9
|
this.crack = 0;
|
|
9
10
|
this.id = ++id;
|
|
10
|
-
this.extends(value);
|
|
11
|
+
this.extends(value, false);
|
|
11
12
|
}
|
|
12
|
-
extends(value) {
|
|
13
|
-
|
|
13
|
+
extends(value, mark) {
|
|
14
|
+
this.extended = mark !== false;
|
|
15
|
+
if (value && value.constructor === Item) this.value = value.value;
|
|
14
16
|
else this.value = value;
|
|
15
17
|
if (value.children instanceof Array) {
|
|
16
18
|
var children = value.children.map(item => new Item(item));
|
|
@@ -33,6 +35,14 @@ class Item extends Array {
|
|
|
33
35
|
this.tab = 1;
|
|
34
36
|
}
|
|
35
37
|
}
|
|
38
|
+
get disabled() {
|
|
39
|
+
if (isObject(this.value)) return this.value.disabled || this.value.enabled === false;
|
|
40
|
+
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
get hotkey() {
|
|
44
|
+
if (isObject(this.value)) return this.value.hotkey;
|
|
45
|
+
}
|
|
36
46
|
|
|
37
47
|
valueOf() {
|
|
38
48
|
return this.value;
|
package/coms/basic/Speed.js
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
function inertia(gun) {
|
|
2
2
|
var _decreased = 0, spd = new Speed;
|
|
3
|
+
var lastTime = 0;
|
|
3
4
|
var _decrease = function () {
|
|
5
|
+
lastTime = Speed.now() - 1;
|
|
6
|
+
_decrease0();
|
|
7
|
+
}
|
|
8
|
+
var _decrease0 = function () {
|
|
4
9
|
if (
|
|
5
10
|
decrease instanceof Function
|
|
6
11
|
) {
|
|
7
12
|
if (!spd.length || _decreased > 0 && spd.filter(a => a !== 0).length === 0) return;
|
|
8
13
|
var id = smooth_timer;
|
|
9
|
-
var
|
|
14
|
+
var now = Speed.now();
|
|
15
|
+
var res = decrease(now - lastTime, spd);
|
|
16
|
+
lastTime = now;
|
|
10
17
|
if (smooth_timer !== id) return;
|
|
11
18
|
if (res === false || isEmpty(res)) {
|
|
12
19
|
spd.unset();
|
|
13
20
|
return;
|
|
14
21
|
}
|
|
15
|
-
smooth_timer = requestAnimationFrame(
|
|
22
|
+
smooth_timer = requestAnimationFrame(_decrease0);
|
|
16
23
|
}
|
|
17
24
|
};
|
|
18
25
|
var _cancel = function () {
|
|
@@ -26,7 +33,7 @@ function inertia(gun) {
|
|
|
26
33
|
_decrease();
|
|
27
34
|
return;
|
|
28
35
|
}
|
|
29
|
-
if (args.filter(a => Math.abs(a) > .5).length === 0) {
|
|
36
|
+
if (!decrease && args.filter(a => Math.abs(a) > .5).length === 0) {
|
|
30
37
|
spd.reset();
|
|
31
38
|
return;
|
|
32
39
|
}
|
|
@@ -63,6 +70,7 @@ function inertia(gun) {
|
|
|
63
70
|
class Speed extends Array {
|
|
64
71
|
cache = [];
|
|
65
72
|
stamp = 0;
|
|
73
|
+
deltat = 0;
|
|
66
74
|
static now() {
|
|
67
75
|
return performance.now ? performance.now() : Date.now();
|
|
68
76
|
}
|
|
@@ -103,20 +111,26 @@ class Speed extends Array {
|
|
|
103
111
|
if (this.stamp) ratio = now - this.stamp;
|
|
104
112
|
else ratio = deltat;
|
|
105
113
|
if (ratio > 160) ratio = 1e-3;
|
|
114
|
+
if (this.deltat) {
|
|
115
|
+
if (deltat > this.deltat * 10) {
|
|
116
|
+
ratio = 1e-3;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
this.deltat = deltat;
|
|
106
120
|
this.stamp = now;
|
|
107
121
|
var sum = 0;
|
|
108
122
|
for (var v of values) sum += v * v;
|
|
109
123
|
v = Math.sqrt(sum) * ratio;
|
|
110
124
|
if (v > 1) {
|
|
111
|
-
v = Math.sqrt(v * (v -
|
|
125
|
+
v = Math.sqrt(v * (v - .996)) / v;
|
|
112
126
|
}
|
|
113
127
|
else {
|
|
114
|
-
v =
|
|
128
|
+
v = .9;
|
|
115
129
|
}
|
|
116
130
|
var r = ratio * v;
|
|
117
131
|
for (var cx = 0, dx = values.length; cx < dx; cx++) {
|
|
118
132
|
values[cx] *= r;
|
|
119
|
-
this[cx] *= v;
|
|
133
|
+
if (Math.abs(this[cx]) > .1) this[cx] *= v;
|
|
120
134
|
}
|
|
121
135
|
return values;
|
|
122
136
|
}
|
package/coms/basic/Tree.js
CHANGED
|
@@ -6,7 +6,7 @@ class Tree extends Array {
|
|
|
6
6
|
count = 0;
|
|
7
7
|
total = 0;
|
|
8
8
|
constructor(src) {
|
|
9
|
-
if (src
|
|
9
|
+
if (src && src.coustructor === Tree) return src;
|
|
10
10
|
if (src instanceof Array && src[0] && ('tab' in src[0] || 'deep' in src[0])) {
|
|
11
11
|
return Tree.fromArray(src);
|
|
12
12
|
}
|
|
@@ -20,7 +20,7 @@ class Tree extends Array {
|
|
|
20
20
|
this.root = this;
|
|
21
21
|
}
|
|
22
22
|
static fromData(array) {
|
|
23
|
-
if (array
|
|
23
|
+
if (array && array.coustructor === Tree) return array;
|
|
24
24
|
var root = new Tree;
|
|
25
25
|
root.tab = -Infinity;
|
|
26
26
|
root.count = 0;
|
|
@@ -82,7 +82,7 @@ class Tree extends Array {
|
|
|
82
82
|
return root;
|
|
83
83
|
}
|
|
84
84
|
static fromArray(array) {
|
|
85
|
-
if (array
|
|
85
|
+
if (array && array.constructor === Tree) return array;
|
|
86
86
|
var root = new Tree;
|
|
87
87
|
root.tab = -Infinity;
|
|
88
88
|
root.count = 0;
|
|
@@ -162,7 +162,7 @@ class Tree extends Array {
|
|
|
162
162
|
var datas = [];
|
|
163
163
|
for (var cx = 1, dx = arguments.length; cx < dx; cx++) {
|
|
164
164
|
var arg = arguments[cx];
|
|
165
|
-
if (arg
|
|
165
|
+
if (arg && arg.constructor === Item) datas.push(arg);
|
|
166
166
|
else if (arg instanceof Array) datas.push.apply(datas, arg);
|
|
167
167
|
else datas.push(arg);
|
|
168
168
|
}
|
package/coms/basic/loader.js
CHANGED
|
@@ -40,6 +40,7 @@ if (PREVENT_FRAMEWORK_MODE !== false) {
|
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
+
var efront_time = +new Date;
|
|
43
44
|
var _devicePixelRatio = devicePixelRatio;
|
|
44
45
|
var request = window.request || function (url, onload, onerror, version) {
|
|
45
46
|
var xhr = new (XMLHttpRequest || ActiveXObject)("Microsoft.XMLHTTP");
|
|
@@ -653,12 +654,7 @@ var removeGlobalProperty = function (property) {
|
|
|
653
654
|
};
|
|
654
655
|
|
|
655
656
|
var renderPixelRatio = !/win/i.test(navigator.platform) && devicePixelRatio > 1 && window.innerWidth > 360 && window.innerHeight > 360 ? .86 : .75;
|
|
656
|
-
|
|
657
|
-
let ratio = +(1000000 / devicePixelRatio + .5 | 0) / 1000000;
|
|
658
|
-
document.querySelector("meta[name=viewport]").setAttribute("content", `width=device-width,target-densitydpi=device-dpi,user-scalable=no,initial-scale=1,maximum-scale=${ratio}`);
|
|
659
|
-
renderPixelRatio *= devicePixelRatio;
|
|
660
|
-
devicePixelRatio = 1;
|
|
661
|
-
}
|
|
657
|
+
|
|
662
658
|
var initPixelDecoder = function () {
|
|
663
659
|
if (pixelDecoder instanceof Function) {
|
|
664
660
|
modules.fromPixel = pixelDecoder;
|
|
@@ -832,8 +828,7 @@ var loadResponseTreeFromStorage = function () {
|
|
|
832
828
|
};
|
|
833
829
|
};
|
|
834
830
|
var preLoad = function () { };
|
|
835
|
-
|
|
836
|
-
var start_time = +new Date / 1000 | 0;
|
|
831
|
+
var start_time = efront_time / 1000 | 0;
|
|
837
832
|
var errored = {};
|
|
838
833
|
var modules = {
|
|
839
834
|
isProduction,
|
|
@@ -868,6 +863,14 @@ var hook = function (requires_count) {
|
|
|
868
863
|
modules.Promise = Promise;
|
|
869
864
|
modules.hook_time = +new Date;
|
|
870
865
|
if (!efrontPath) efrontPath = document.body.getAttribute("main-path") || document.body.getAttribute("path") || document.body.getAttribute("main") || "zimoli";
|
|
866
|
+
if (modules.hook_time - efront_time < (isProduction ? 30 : 5) && document.querySelector && devicePixelRatio > 1 && /Linux/.test(navigator.platform) && navigator.maxTouchPoints > 0) {
|
|
867
|
+
let ratio = +(1000000 / devicePixelRatio + .5 | 0) / 1000000;
|
|
868
|
+
document.querySelector("meta[name=viewport]").setAttribute("content", `width=device-width,target-densitydpi=device-dpi,user-scalable=no,initial-scale=1,maximum-scale=${ratio}`);
|
|
869
|
+
renderPixelRatio *= devicePixelRatio;
|
|
870
|
+
modules.renderPixelRatio = renderPixelRatio;
|
|
871
|
+
devicePixelRatio = modules.devicePixelRatio = 1;
|
|
872
|
+
}
|
|
873
|
+
|
|
871
874
|
init(efrontPath, function (zimoli) {
|
|
872
875
|
if (zimoli instanceof Function) zimoli();
|
|
873
876
|
});
|
package/coms/frame/route.js
CHANGED
|
@@ -108,6 +108,8 @@
|
|
|
108
108
|
if (path) item.path = path;
|
|
109
109
|
if (data) item.params = parseKV(data);
|
|
110
110
|
item.closed = true;
|
|
111
|
+
if (filter) var item0 = filter(item);
|
|
112
|
+
if (item0) item = item0;
|
|
111
113
|
return item;
|
|
112
114
|
});
|
|
113
115
|
return items;
|
|
@@ -231,10 +233,14 @@
|
|
|
231
233
|
result.then = then;
|
|
232
234
|
return result;
|
|
233
235
|
};
|
|
234
|
-
|
|
236
|
+
var filter = null;
|
|
237
|
+
result.parse = function (items, f) {
|
|
238
|
+
filter = f;
|
|
235
239
|
keymap = {};
|
|
236
240
|
items = parseMenuList(items);
|
|
237
241
|
items.keymap = keymap;
|
|
242
|
+
filter = null;
|
|
243
|
+
keymap = null;
|
|
238
244
|
return items;
|
|
239
245
|
};
|
|
240
246
|
var then = function (ok, oh) {
|
package/coms/kugou/playList.less
CHANGED
|
@@ -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
|
@@ -210,7 +210,7 @@ function main() {
|
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
212
|
on("blur")(page, unfocus);
|
|
213
|
-
var template = page.tempalte || document.createElement(
|
|
213
|
+
var template = page.tempalte || document.createElement(page.tagName);
|
|
214
214
|
if (!page.tempalte) {
|
|
215
215
|
template.className = '';
|
|
216
216
|
template.removeAttribute('mode');
|
|
@@ -224,12 +224,11 @@ function main() {
|
|
|
224
224
|
time = +time;
|
|
225
225
|
if (byMousedown && !time) return;
|
|
226
226
|
if (time) byMousedown = false;
|
|
227
|
-
|
|
228
227
|
if (page.ispop || time) popTimer = setTimeout(function () {
|
|
229
228
|
if (time) byMousedown = elem;
|
|
230
229
|
page.setFocus(elem);
|
|
231
230
|
popMenu(elem.menu, elem);
|
|
232
|
-
}, time ||
|
|
231
|
+
}, time || 60);
|
|
233
232
|
};
|
|
234
233
|
var cancel = function () {
|
|
235
234
|
clear();
|
|
@@ -280,7 +279,7 @@ function main() {
|
|
|
280
279
|
};
|
|
281
280
|
var open1 = function (event) {
|
|
282
281
|
if (event.which === 3) event.preventDefault();
|
|
283
|
-
if (istoolbar) open.call(this, event.which === 3 ? 20 :
|
|
282
|
+
if (istoolbar) open.call(this, event.which === 3 ? 20 : 300);
|
|
284
283
|
};
|
|
285
284
|
if (!page.children.length || page.menutype === 1) {
|
|
286
285
|
page.menutype = 1;
|
|
@@ -297,7 +296,7 @@ function main() {
|
|
|
297
296
|
"menu-item"(e, s) {
|
|
298
297
|
if (e && s === e.$scope) s = itemName ? s[itemName] : s.menu;
|
|
299
298
|
var a = button(
|
|
300
|
-
menuItem(e, s
|
|
299
|
+
menuItem(e, s, this.hasIcon)
|
|
301
300
|
);
|
|
302
301
|
if (!page.firstMenu) {
|
|
303
302
|
page.firstMenu = a;
|
|
@@ -325,23 +324,27 @@ function main() {
|
|
|
325
324
|
list(page, function (index) {
|
|
326
325
|
var item = items[index];
|
|
327
326
|
if (!item) return;
|
|
328
|
-
if (
|
|
327
|
+
if (item.constructor !== Item) item = new Item(item);
|
|
329
328
|
var a = $scope["menu-item"](null, item);
|
|
330
329
|
if (src.itemName) a.setAttribute("e-if", notHidden);
|
|
331
330
|
a.setAttribute("e-class", className);
|
|
332
331
|
a.setAttribute("on-mouseleave", "cancel.call(this)");
|
|
333
332
|
a.setAttribute("on-mouseenter", "popMenu.call(this)");
|
|
334
|
-
a.setAttribute("on-pointermove", "popMenu.call(this)");
|
|
335
333
|
a.setAttribute("on-click", "open.call(this)");
|
|
336
334
|
a.setAttribute("_menu", src.itemName);
|
|
337
|
-
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
|
+
}
|
|
338
341
|
a = generator(index, item, a);
|
|
339
342
|
return a;
|
|
340
|
-
});
|
|
343
|
+
}, direction);
|
|
341
344
|
}
|
|
342
345
|
else {
|
|
343
346
|
page.innerHTML = menuList;
|
|
344
|
-
$scope.menus = items.map(i => i
|
|
347
|
+
$scope.menus = items.map(i => i.constructor === Item ? i : new Item(i));
|
|
345
348
|
render(page, $scope);
|
|
346
349
|
vbox(page);
|
|
347
350
|
}
|
|
@@ -359,11 +362,15 @@ function main() {
|
|
|
359
362
|
page.firstMenu = elem;
|
|
360
363
|
page.total = this.src.length;
|
|
361
364
|
}
|
|
362
|
-
elem.menu = this.src[index];
|
|
365
|
+
var menu = elem.menu = this.src[index];
|
|
363
366
|
on("mouseleave")(elem, cancel);
|
|
364
367
|
on("mouseenter")(elem, open);
|
|
365
|
-
|
|
366
|
-
|
|
368
|
+
if (istoolbar) {
|
|
369
|
+
on("pointerdown")(elem, open1);
|
|
370
|
+
if (menu.constructor === Item && menu.length && !menu.extended) {
|
|
371
|
+
menu.extends(menu[0]);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
367
374
|
on("click")(elem, fire);
|
|
368
375
|
return elem;
|
|
369
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/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/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;
|
package/coms/zimoli/table.js
CHANGED
|
@@ -424,10 +424,12 @@ function table(elem) {
|
|
|
424
424
|
var $scope = {
|
|
425
425
|
fields,
|
|
426
426
|
isEmpty,
|
|
427
|
+
tbody0: null,
|
|
427
428
|
tbody(e) {
|
|
428
429
|
var e = list.apply(null, arguments);
|
|
429
430
|
css(e, tbodyHeight(e));
|
|
430
431
|
css(e, { width: this.adapter.offsetWidth, display: 'block' });
|
|
432
|
+
this.tbody0 = e;
|
|
431
433
|
return e;
|
|
432
434
|
},
|
|
433
435
|
thead(t) {
|
|
@@ -440,7 +442,7 @@ function table(elem) {
|
|
|
440
442
|
return tr;
|
|
441
443
|
},
|
|
442
444
|
tbodyHeight,
|
|
443
|
-
data
|
|
445
|
+
data,
|
|
444
446
|
adapter: null,
|
|
445
447
|
resizeT,
|
|
446
448
|
model,
|
|
@@ -455,6 +457,10 @@ function table(elem) {
|
|
|
455
457
|
pagination
|
|
456
458
|
};
|
|
457
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,
|
package/coms/zimoli/touchList.js
CHANGED
|
@@ -24,7 +24,7 @@ var touchstart = function (event) {
|
|
|
24
24
|
}
|
|
25
25
|
if (!target) return;
|
|
26
26
|
cancelAnimationFrame(target.scrollTimer);
|
|
27
|
-
saved_x =
|
|
27
|
+
saved_x = event.clientX, saved_y = event.clientY, moving = false, 0;
|
|
28
28
|
currentTarget = target;
|
|
29
29
|
if (!target.querySelector(".ylife-touch-delete")) {
|
|
30
30
|
css(target, {
|
|
@@ -37,11 +37,10 @@ var touchstart = function (event) {
|
|
|
37
37
|
};
|
|
38
38
|
var moving = false;
|
|
39
39
|
var touchmove = function (event) {
|
|
40
|
-
if (!saved_x) return saved_x = event.clientX, saved_y = event.clientY, moving = false, 0;
|
|
41
40
|
var delta_x = event.clientX - saved_x;
|
|
42
41
|
var delta_y = event.clientY - saved_y;
|
|
43
42
|
if (!moving) {
|
|
44
|
-
if (Math.abs(delta_x) <
|
|
43
|
+
if (Math.abs(delta_x) < MOVELOCK_DELTA && Math.abs(delta_y) < MOVELOCK_DELTA) return;
|
|
45
44
|
if (Math.abs(delta_y) < Math.abs(delta_x)) {
|
|
46
45
|
moving = 1;
|
|
47
46
|
} else {
|
|
@@ -49,28 +48,35 @@ var touchmove = function (event) {
|
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
50
|
if (moving !== 1) return;
|
|
52
|
-
event.
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
event.moveLocked = true;
|
|
52
|
+
var buttonWidth = currentTarget.scrollWidth - currentTarget.clientWidth;
|
|
53
|
+
var scrollLeft = -currentTarget.scrollLeft;
|
|
54
|
+
if (delta_x + scrollLeft > 0) {
|
|
55
|
+
delta_x = -scrollLeft;
|
|
56
56
|
}
|
|
57
|
-
else if (delta_x +
|
|
58
|
-
delta_x = -
|
|
57
|
+
else if (delta_x + scrollLeft < - buttonWidth) {
|
|
58
|
+
delta_x = -buttonWidth - scrollLeft;
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
scrollLeft += delta_x;
|
|
61
61
|
saved_x += delta_x;
|
|
62
62
|
direction = delta_x;
|
|
63
|
-
currentTarget.scrollLeft = -
|
|
63
|
+
currentTarget.scrollLeft = -scrollLeft;
|
|
64
64
|
};
|
|
65
65
|
var scrollTo = function (targetLeft) {
|
|
66
66
|
if (!this) return;
|
|
67
67
|
cancelAnimationFrame(this.scrollTimer);
|
|
68
68
|
var that = this;
|
|
69
|
+
var scrollTime = +Speed.now();
|
|
69
70
|
var reshape = function () {
|
|
70
|
-
var currentLeft =
|
|
71
|
+
var currentLeft = that.scrollLeft;
|
|
71
72
|
if (0 === (0 | currentLeft - targetLeft)) return;
|
|
72
|
-
var
|
|
73
|
-
|
|
73
|
+
var now = +Speed.now();
|
|
74
|
+
var thisTimeLeft = currentLeft;
|
|
75
|
+
while (scrollTime < now) {
|
|
76
|
+
scrollTime += 6;
|
|
77
|
+
thisTimeLeft = (thisTimeLeft * 11 + targetLeft) / 12;
|
|
78
|
+
}
|
|
79
|
+
if (Math.abs(thisTimeLeft - currentLeft) < .5) {
|
|
74
80
|
thisTimeLeft = targetLeft;
|
|
75
81
|
} else {
|
|
76
82
|
that.scrollTimer = requestAnimationFrame(reshape);
|
|
@@ -94,10 +100,10 @@ var scrollToRight = function () {
|
|
|
94
100
|
var touchend = function () {
|
|
95
101
|
var marginLeft = -parseInt(currentTarget.scrollLeft) || 0;
|
|
96
102
|
moving = false;
|
|
97
|
-
if (direction < 0 && marginLeft < -
|
|
103
|
+
if (direction < 0 && marginLeft < -7) {
|
|
98
104
|
scrollToLeft.call(currentTarget);
|
|
99
105
|
}
|
|
100
|
-
else if (direction > 0 && marginLeft > -currentTarget.clientWidth +
|
|
106
|
+
else if (direction > 0 && marginLeft > -currentTarget.clientWidth + 7) {
|
|
101
107
|
scrollToRight.call(currentTarget);
|
|
102
108
|
}
|
|
103
109
|
else if (marginLeft < currentTarget.clientWidth - currentTarget.scrollWidth >> 1) {
|
|
@@ -130,9 +136,5 @@ function touchList(listElement) {
|
|
|
130
136
|
move: touchmove,
|
|
131
137
|
end: touchend
|
|
132
138
|
});
|
|
133
|
-
// ontouchstart(listElement, touchstart);
|
|
134
|
-
// ontouchmove(listElement, touchmove);
|
|
135
|
-
// ontouchend(listElement, touchend);
|
|
136
|
-
// ontouchcancel(listElement, touchend);
|
|
137
139
|
return listElement;
|
|
138
140
|
}
|