efront 3.15.7 → 3.17.1
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/log/boot.js +36 -4
- package/apps/pivot/main.less +1 -0
- package/coms/basic/JSAM.js +72 -19
- package/coms/basic/Speed.js +2 -2
- package/coms/basic/cross_.js +1 -1
- package/coms/basic/lazy.js +6 -2
- package/coms/basic/loader.js +2 -2
- package/coms/basic/parseYML.js +1 -1
- package/coms/basic/renderExpress.js +3 -3
- package/coms/frame/route.js +54 -17
- package/coms/kugou/song.js +3 -3
- package/coms/zimoli/Item.js +40 -25
- package/coms/zimoli/appendChild.js +6 -8
- package/coms/zimoli/container.js +10 -0
- package/coms/zimoli/data.js +1 -6
- package/coms/zimoli/dispatch.js +13 -1
- package/coms/zimoli/drag.js +4 -2
- package/coms/zimoli/getGenerator.js +4 -4
- package/coms/zimoli/getTreeFromData.js +3 -0
- package/coms/zimoli/getValue.js +1 -1
- package/coms/zimoli/list.js +1 -1
- package/coms/zimoli/menu.js +36 -2
- package/coms/zimoli/menuItem.html +4 -1
- package/coms/zimoli/menuItem.js +9 -2
- package/coms/zimoli/menuItem.less +23 -2
- package/coms/zimoli/menuList.html +1 -1
- package/coms/zimoli/menuList.js +37 -31
- package/coms/zimoli/menuList.less +1 -1
- package/coms/zimoli/moveupon.js +6 -4
- package/coms/zimoli/on.js +173 -162
- package/coms/zimoli/once.js +6 -5
- package/coms/zimoli/onmounted.js +1 -1
- package/coms/zimoli/render.js +19 -6
- package/coms/zimoli/renderDefaults.js +1 -0
- package/coms/zimoli/resize.js +18 -0
- package/coms/zimoli/scrollbar.js +20 -8
- package/coms/zimoli/scrollbar.less +22 -1
- package/coms/zimoli/vbox.js +7 -3
- package/coms/zimoli/zimoli.js +1 -1
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/coms/zimoli/on.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
if (document.efronton) return document.efronton;
|
|
2
3
|
var is_addEventListener_enabled = "addEventListener" in window;
|
|
3
4
|
var handlersMap = {};
|
|
4
5
|
var changes_key = 'changes';
|
|
@@ -6,8 +7,10 @@ var eventtypereg = /(?:\.once|\.prevent|\.stop|\.capture|\.self|\.passive|\.[a-z
|
|
|
6
7
|
var keyCodeMap = {
|
|
7
8
|
backspace: 8,
|
|
8
9
|
tab: 9,
|
|
10
|
+
"⇄": 9,
|
|
9
11
|
ceter: 12,// num5 when numlock is off.
|
|
10
12
|
enter: 13,
|
|
13
|
+
"↵": 13,
|
|
11
14
|
shift: 16,
|
|
12
15
|
ctrl: 17,
|
|
13
16
|
control: 17,
|
|
@@ -23,11 +26,17 @@ var keyCodeMap = {
|
|
|
23
26
|
end: 35,
|
|
24
27
|
home: 36,
|
|
25
28
|
left: 37,
|
|
29
|
+
"←": 37,
|
|
26
30
|
up: 38,
|
|
31
|
+
"↑": 38,
|
|
27
32
|
right: 39,
|
|
33
|
+
"→": 39,
|
|
28
34
|
down: 40,
|
|
35
|
+
"↓": 40,
|
|
29
36
|
insert: 45,
|
|
37
|
+
"ins": 45,
|
|
30
38
|
delete: 46,
|
|
39
|
+
del: 46,
|
|
31
40
|
key0: 47,
|
|
32
41
|
key1: 48,
|
|
33
42
|
key2: 49,
|
|
@@ -54,10 +63,14 @@ var keyCodeMap = {
|
|
|
54
63
|
num8: 104,
|
|
55
64
|
num9: 105,
|
|
56
65
|
times: 106,
|
|
66
|
+
"⨉": 106,
|
|
57
67
|
numplus: 107,
|
|
58
68
|
numminus: 109,
|
|
59
69
|
dot: 110,
|
|
60
|
-
|
|
70
|
+
numdot: 110,
|
|
71
|
+
divide: 111,
|
|
72
|
+
div: 111,
|
|
73
|
+
"/": 111,
|
|
61
74
|
f1: 112,
|
|
62
75
|
f2: 113,
|
|
63
76
|
f3: 114,
|
|
@@ -74,17 +87,39 @@ var keyCodeMap = {
|
|
|
74
87
|
numlock: 144,
|
|
75
88
|
scrolllock: 145,
|
|
76
89
|
semicolon: 186,
|
|
90
|
+
";": 186,
|
|
91
|
+
":": 186,
|
|
77
92
|
equal: 187,
|
|
93
|
+
"=": 187,
|
|
78
94
|
plus: 187,
|
|
95
|
+
"+": 187,
|
|
79
96
|
comma: 188,
|
|
97
|
+
",": 188,
|
|
98
|
+
"<": 188,
|
|
80
99
|
minus: 189,
|
|
100
|
+
"-": 189,
|
|
101
|
+
"_": 189,
|
|
81
102
|
period: 190,
|
|
103
|
+
".": 110,
|
|
104
|
+
">": 110,
|
|
82
105
|
slash: 191,
|
|
106
|
+
"/": 191,
|
|
107
|
+
">": 191,
|
|
83
108
|
backquote: 192,
|
|
109
|
+
"`": 192,
|
|
110
|
+
"~": 192,
|
|
84
111
|
bracketleft: 219,
|
|
112
|
+
"[": 219,
|
|
113
|
+
"{": 219,
|
|
85
114
|
backslash: 220,
|
|
115
|
+
"\\": 220,
|
|
116
|
+
"|": 220,
|
|
86
117
|
bracketright: 221,
|
|
118
|
+
"]": 221,
|
|
119
|
+
"}": 221,
|
|
87
120
|
quote: 222,
|
|
121
|
+
"'": 222,
|
|
122
|
+
"\"": 222,
|
|
88
123
|
bright: 255,
|
|
89
124
|
};
|
|
90
125
|
var parseEventTypes = function (eventtypes) {
|
|
@@ -156,180 +191,158 @@ function checkKeyNeed(eventtypes, e) {
|
|
|
156
191
|
return true;
|
|
157
192
|
}
|
|
158
193
|
var pendingid = 0;
|
|
159
|
-
function
|
|
194
|
+
function pending(h, event) {
|
|
160
195
|
if (h instanceof Function) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
res.then(removePending, removePending);
|
|
170
|
-
}
|
|
171
|
-
return res;
|
|
196
|
+
var res = h.call(this, event);
|
|
197
|
+
if (res && isFunction(res.then) && this.setAttribute) {
|
|
198
|
+
var id = ++pendingid & 0x1fffffffffffff;
|
|
199
|
+
this.setAttribute('pending', id);
|
|
200
|
+
var removePending = () => {
|
|
201
|
+
if (+this.getAttribute('pending') === id) this.removeAttribute('pending');
|
|
202
|
+
};
|
|
203
|
+
res.then(removePending, removePending);
|
|
172
204
|
}
|
|
205
|
+
return res;
|
|
173
206
|
}
|
|
174
207
|
return h;
|
|
175
208
|
}
|
|
176
|
-
|
|
177
|
-
var
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
var
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
if (eventtypes.capture) firstmost = true;
|
|
186
|
-
if (target && element !== target) {
|
|
187
|
-
handler = handler.bind(element);
|
|
188
|
-
element = target;
|
|
209
|
+
var remove = function (k, hk, [eventtypes, handler, context]) {
|
|
210
|
+
var element = this;
|
|
211
|
+
var hs = element[hk];
|
|
212
|
+
if (hs) {
|
|
213
|
+
for (var cx = hs.length - 1; cx >= 0; cx--) {
|
|
214
|
+
var [e, h, c] = hs[cx];
|
|
215
|
+
if (h === handler && e === eventtypes && c === context) {
|
|
216
|
+
hs.splice(cx, 1);
|
|
217
|
+
if (k === changes_key) element.needchanges--;
|
|
189
218
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
219
|
+
}
|
|
220
|
+
if (!hs.length && hs.h) {
|
|
221
|
+
element[hk] = null;
|
|
222
|
+
if (is_addEventListener_enabled) {
|
|
223
|
+
element.removeEventListener(k, hs.h, /1$/.test(hk));
|
|
224
|
+
} else {
|
|
225
|
+
if (element["on" + k] === hs.h) element["on" + k] = null;
|
|
193
226
|
}
|
|
194
|
-
var h = function (e) {
|
|
195
|
-
if (eventtypes.self && e.target !== this) return;
|
|
196
|
-
if (!checkKeyNeed(eventtypes, e)) return;
|
|
197
|
-
if (eventtypes.stop) e.stopPropagation();
|
|
198
|
-
if (eventtypes.passive) e.preventDefault = function () { };
|
|
199
|
-
if (eventtypes.prevent) e.preventDefault();
|
|
200
|
-
if (handler instanceof Array) {
|
|
201
|
-
handler.forEach(function (h) {
|
|
202
|
-
h.call(this, e);
|
|
203
|
-
}, this);
|
|
204
|
-
} else {
|
|
205
|
-
handler.call(this, e);
|
|
206
|
-
}
|
|
207
|
-
if (eventtypes.once) remove();
|
|
208
|
-
};
|
|
209
|
-
var remove = function () {
|
|
210
|
-
if (k === changes_key) element.needchanges--;
|
|
211
|
-
element.removeEventListener(k, h, firstmost);
|
|
212
|
-
};
|
|
213
|
-
element.addEventListener(k, h, firstmost);
|
|
214
|
-
return remove;
|
|
215
227
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
var
|
|
220
|
-
|
|
221
|
-
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
var broadcast = function (k, hk, event) {
|
|
231
|
+
var element = this;
|
|
232
|
+
var handlers = element[hk];
|
|
233
|
+
if (handlers.length > 1) handlers = handlers.slice();
|
|
234
|
+
for (var [eventtypes, handler, context] of handlers) {
|
|
235
|
+
if (eventtypes.self && event.target !== element) continue;
|
|
236
|
+
if (!checkKeyNeed(eventtypes, event)) continue;
|
|
237
|
+
if (eventtypes.stop) event.stopPropagation();
|
|
238
|
+
if (eventtypes.passive) event.preventDefault = function () { };
|
|
239
|
+
if (eventtypes.prevent) event.preventDefault();
|
|
240
|
+
if (handler instanceof Array) {
|
|
241
|
+
for (var h of handler) {
|
|
242
|
+
h.call(context, event);
|
|
243
|
+
}
|
|
244
|
+
} else {
|
|
245
|
+
pending.call(context, handler, event);
|
|
246
|
+
}
|
|
247
|
+
if (eventtypes.once) remove.call(element, k, hk, eventtypes, handler);
|
|
248
|
+
}
|
|
249
|
+
};
|
|
222
250
|
|
|
223
|
-
|
|
224
|
-
|
|
251
|
+
var checkroot = function (element, k) {
|
|
252
|
+
k = "on" + k;
|
|
253
|
+
if (!(k in element)) {
|
|
254
|
+
if (element === window && k in document) {
|
|
255
|
+
element = document;
|
|
256
|
+
if (!checkroot[k]) checkroot[k] = true, console.warn("使用 document 的", k, "替代 window 的");
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return element;
|
|
260
|
+
}
|
|
225
261
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
element.needchanges++;
|
|
241
|
-
}
|
|
242
|
-
// 仅在hack事件中使用firstmost参数
|
|
243
|
-
if (!(on_event_path in element)) {
|
|
244
|
-
if (element === window && on_event_path in document) {
|
|
245
|
-
element = document;
|
|
246
|
-
if (!addhandler.logged) addhandler.logged = true, console.warn("use", on_event_path, "on document instead of on window");
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
if (element[handler_path] instanceof Array) {
|
|
250
|
-
if (~element[handler_path].indexOf(handler)) return;
|
|
251
|
-
if (firstmost) element[handler_path].unshift(handler);
|
|
252
|
-
else element[handler_path].push(handler);
|
|
253
|
-
} else {
|
|
254
|
-
element[handler_path] = element[on_event_path] && element[on_event_path] !== handler ? [element[on_event_path], handler] : [handler];
|
|
255
|
-
element[on_event_path] = function (e) {
|
|
256
|
-
if (!e) e = window.event || {};
|
|
257
|
-
if (!e.target && e.srcElement) {
|
|
258
|
-
e.target = e.srcElement;
|
|
259
|
-
}
|
|
260
|
-
if (eventtypes.self && e.target !== this) return;
|
|
261
|
-
if (!checkKeyNeed(eventtypes, e)) return;
|
|
262
|
-
if (e.stopedPropagation) return;
|
|
263
|
-
if (!e.stopPropagation) {
|
|
264
|
-
e.stopPropagation = function () {
|
|
265
|
-
this.stopedPropagation = true;
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
if (eventtypes.stop) {
|
|
269
|
-
e.stopPropagation();
|
|
270
|
-
}
|
|
271
|
-
if (!e.preventDefault) {
|
|
272
|
-
e.preventDefault = function () {
|
|
273
|
-
e.returnValue = false;
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
if (e.button) {
|
|
277
|
-
if (e.buttons === undefined) e.buttons = e.button;
|
|
278
|
-
if (e.which === undefined) e.which = e.button + 1;
|
|
279
|
-
}
|
|
280
|
-
if (e.keyCode) {
|
|
281
|
-
if (e.which === undefined) e.which = e.keyCode;
|
|
282
|
-
}
|
|
283
|
-
if (eventtypes.passive) {
|
|
284
|
-
e.preventDefault = function () { };
|
|
285
|
-
}
|
|
286
|
-
if (eventtypes.prevent) {
|
|
287
|
-
e.preventDefault();
|
|
288
|
-
}
|
|
262
|
+
var append = function (k, hk, listener2, firstmost) {
|
|
263
|
+
var [eventtypes, handler, context] = listener2;
|
|
264
|
+
var element = this;
|
|
265
|
+
var handlers = element[hk];
|
|
266
|
+
for (var [h, e, c] of handlers) {
|
|
267
|
+
if (h === handler && eventtypes === e && c === context) return;
|
|
268
|
+
}
|
|
269
|
+
if (k === changes_key) {
|
|
270
|
+
if (!element.needchanges) element.needchanges = 0;
|
|
271
|
+
element.needchanges++;
|
|
272
|
+
}
|
|
273
|
+
if (firstmost) handlers.unshift(listener2);
|
|
274
|
+
else handlers.push(listener2);
|
|
275
|
+
};
|
|
289
276
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
277
|
+
var on = document.efronton = function (k) {
|
|
278
|
+
var on_event_path = "on" + k;
|
|
279
|
+
if (handlersMap[on_event_path]) return handlersMap[on_event_path];
|
|
280
|
+
var eventtypes = parseEventTypes(k);
|
|
281
|
+
k = k.replace(eventtypereg, '');
|
|
282
|
+
var handler_path = k + "handlers";
|
|
283
|
+
var hk = handler_path + +!!eventtypes.capture;
|
|
284
|
+
if (is_addEventListener_enabled) var addhandler = function (context, handler, firstmost = false) {
|
|
285
|
+
var target = this || context;
|
|
286
|
+
target = checkroot(target, k);
|
|
287
|
+
if (target[hk] instanceof Array) {
|
|
288
|
+
} else {
|
|
289
|
+
var h = broadcast.bind(target, k, hk);
|
|
290
|
+
target[hk] = [];
|
|
291
|
+
target[hk].h = h;
|
|
292
|
+
target.addEventListener(k, h, eventtypes.capture);
|
|
293
|
+
}
|
|
294
|
+
var listener = [eventtypes, handler, context];
|
|
295
|
+
append.call(target, k, hk, listener, firstmost);
|
|
296
|
+
return remove.bind(target, k, hk, listener);
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
else var addhandler = function (context, handler, firstmost = false) {
|
|
300
|
+
var target = this || context;
|
|
301
|
+
if (eventtypes.capture) {
|
|
302
|
+
console.warn("当前运行环境不支持事件capture");
|
|
303
|
+
firstmost = true;
|
|
304
|
+
}
|
|
305
|
+
target = checkroot(target, k);
|
|
306
|
+
if (target[handler_path] instanceof Array) {
|
|
307
|
+
} else {
|
|
308
|
+
var h = function (e) {
|
|
309
|
+
if (!e) e = window.event || {};
|
|
310
|
+
if (!e.target && e.srcElement) {
|
|
311
|
+
e.target = e.srcElement;
|
|
312
|
+
}
|
|
313
|
+
if (e.stopedPropagation) return;
|
|
314
|
+
if (!e.stopPropagation) {
|
|
315
|
+
e.stopPropagation = function () {
|
|
316
|
+
this.stopedPropagation = true;
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
if (!e.preventDefault) {
|
|
320
|
+
e.preventDefault = function () {
|
|
321
|
+
e.returnValue = false;
|
|
322
|
+
e.defaultPrevented = true;
|
|
323
|
+
};
|
|
313
324
|
}
|
|
314
|
-
if (
|
|
315
|
-
|
|
316
|
-
|
|
325
|
+
if (e.button) {
|
|
326
|
+
if (e.buttons === undefined) e.buttons = e.button;
|
|
327
|
+
if (e.which === undefined) e.which = e.button + 1;
|
|
317
328
|
}
|
|
329
|
+
if (e.keyCode) {
|
|
330
|
+
if (e.which === undefined) e.which = e.keyCode;
|
|
331
|
+
}
|
|
332
|
+
broadcast.call(target, k, handler_path, e);
|
|
333
|
+
return e.returnValue;
|
|
318
334
|
};
|
|
319
|
-
|
|
335
|
+
target[handler_path] = target["on" + k] && target["on" + k] !== handler ? [[{}, target["on" + k]]] : [];
|
|
336
|
+
target[handler_path].h = h;
|
|
337
|
+
target["on" + k] = h;
|
|
320
338
|
}
|
|
321
|
-
|
|
339
|
+
var listener = [eventtypes, handler, context];
|
|
340
|
+
append.call(target, k, handler_path, listener, firstmost);
|
|
341
|
+
return remove.bind(target, k, handler_path, listener);
|
|
322
342
|
};
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
cancelup();
|
|
327
|
-
}, true);
|
|
328
|
-
var cancelmove = on("mousemove")(document, function (event) {
|
|
329
|
-
if (!event.which) dispatch("mouseup", document)/* ,console.warn("dispatch mouseup nanually.")*/;
|
|
330
|
-
}, true);
|
|
331
|
-
});
|
|
332
|
-
}
|
|
343
|
+
handlersMap[on_event_path] = addhandler;
|
|
344
|
+
return addhandler;
|
|
345
|
+
};
|
|
333
346
|
var invoke = function (event, type, pointerType) {
|
|
334
347
|
var target = event.target;
|
|
335
348
|
var touch = event.changedTouches ? event.changedTouches[0] : event;
|
|
@@ -342,7 +355,7 @@ var invoke = function (event, type, pointerType) {
|
|
|
342
355
|
|
|
343
356
|
(function () {
|
|
344
357
|
var pointeractive = null;
|
|
345
|
-
if ("onpointerdown" in window) return;
|
|
358
|
+
if ("onpointerdown" in window || document.efronton) return;
|
|
346
359
|
var getPointerType = function (event) {
|
|
347
360
|
return event.type.replace(/(start|move|end|cancel|down|up|leave|out|over|enter)$/i, '');
|
|
348
361
|
};
|
|
@@ -373,8 +386,6 @@ var invoke = function (event, type, pointerType) {
|
|
|
373
386
|
(function () {
|
|
374
387
|
// fastclick
|
|
375
388
|
if (window.fastclick) return;
|
|
376
|
-
if (document.efronton) return on = document.efronton;
|
|
377
|
-
document.efronton = on;
|
|
378
389
|
var onclick = on("click");
|
|
379
390
|
var onmousedown = on("mousedown");
|
|
380
391
|
var onmousemove = on("mousemove");
|
package/coms/zimoli/once.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var oncetree = {};
|
|
2
3
|
function _once(key) {
|
|
3
4
|
if (oncetree[key]) return oncetree[key];
|
|
4
|
-
return oncetree[key] = function (target, handler) {
|
|
5
|
-
var off = on(key)(target, function (event) {
|
|
5
|
+
return oncetree[key] = function (target, handler, firstmost) {
|
|
6
|
+
var off = on(key).call(this, target, function (event) {
|
|
6
7
|
off();
|
|
7
8
|
return handler.call(this, event);
|
|
8
|
-
});
|
|
9
|
+
}, firstmost);
|
|
9
10
|
return off;
|
|
10
11
|
};
|
|
11
12
|
}
|
|
12
|
-
function once(key, target, handler) {
|
|
13
|
-
if (isFunction(handler) && isNode(target)) return _once(key)(target, handler);
|
|
13
|
+
function once(key, target, handler, firstmost) {
|
|
14
|
+
if (isFunction(handler) && isNode(target)) return _once(key).call(this, target, handler, firstmost);
|
|
14
15
|
return _once(key);
|
|
15
16
|
}
|
package/coms/zimoli/onmounted.js
CHANGED
package/coms/zimoli/render.js
CHANGED
|
@@ -228,7 +228,7 @@ var createIf = function (search, id = 0) {
|
|
|
228
228
|
appendChild.before(this, element);
|
|
229
229
|
if (element.renderid < 0) {
|
|
230
230
|
element.renderid = id;
|
|
231
|
-
elements[cx] = render(element);
|
|
231
|
+
elements[cx] = render(element, this.$scope, this.$parentScopes);
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
else {
|
|
@@ -599,7 +599,7 @@ function getFromScopes(key, scope, parentScopes) {
|
|
|
599
599
|
}
|
|
600
600
|
}
|
|
601
601
|
|
|
602
|
-
function renderElement(element, scope = element.$scope, parentScopes = element.$parentScopes) {
|
|
602
|
+
function renderElement(element, scope = element.$scope, parentScopes = element.$parentScopes, eager) {
|
|
603
603
|
if (!isNode(element) && element.length) {
|
|
604
604
|
return [].concat.apply([], element).map(function (element) {
|
|
605
605
|
return renderElement(element, scope, parentScopes);
|
|
@@ -699,10 +699,10 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
|
|
|
699
699
|
}
|
|
700
700
|
ons.forEach(([on, key, value]) => on.call(element, key, [withContext, value]));
|
|
701
701
|
if (element.renders.length) {
|
|
702
|
-
|
|
703
|
-
onappend(element, addRenderElement);
|
|
702
|
+
onmounted(element, addRenderElement);
|
|
704
703
|
onremove(element, removeRenderElement);
|
|
705
704
|
if (isMounted(element) || element.renderid > 1) addRenderElement.call(element);
|
|
705
|
+
else if (eagermount) rebuild(element);
|
|
706
706
|
}
|
|
707
707
|
if (elementid) scope[elementid] = element;
|
|
708
708
|
for (var id of ids) {
|
|
@@ -797,13 +797,26 @@ function renderStructure(element, scope, parentScopes = []) {
|
|
|
797
797
|
if (!element.$struct) element.$struct = { ons, copys, binds, attrs: attr1, props, context: withContext, ids };
|
|
798
798
|
if (element.renderid <= -1) createStructure.call(element, types.if, types.repeat, withContext);
|
|
799
799
|
}
|
|
800
|
-
|
|
800
|
+
var eagermount = false, renderlock = false;
|
|
801
|
+
function render(element, scope, parentScopes, lazy = true) {
|
|
801
802
|
var if_top_length = if_top.length;
|
|
803
|
+
var haslock = false;
|
|
804
|
+
if (!renderlock) {
|
|
805
|
+
haslock = true;
|
|
806
|
+
renderlock = true;
|
|
807
|
+
if (isBoolean(scope) && arguments.length === 2) lazy = +scope, scope = undefined;
|
|
808
|
+
else if (isBoolean(parentScopes) && arguments.length === 3) lazy = +parentScopes, parentScopes = undefined;
|
|
809
|
+
else lazy = +lazy;
|
|
810
|
+
eagermount = !lazy;
|
|
811
|
+
}
|
|
802
812
|
var e = renderElement(element, scope, parentScopes);
|
|
813
|
+
if (haslock) {
|
|
814
|
+
renderlock = false;
|
|
815
|
+
eagermount = false;
|
|
816
|
+
}
|
|
803
817
|
if (if_top_length < if_top.length) if_top.splice(if_top_length, if_top.length - if_top_length);
|
|
804
818
|
return e;
|
|
805
819
|
}
|
|
806
|
-
|
|
807
820
|
var digest = lazy(refresh, -{});
|
|
808
821
|
render.digest = render.apply = render.refresh = digest;
|
|
809
822
|
render.parseRepeat = parseRepeat;
|
package/coms/zimoli/resize.js
CHANGED
|
@@ -142,6 +142,7 @@ function resize(elem, initialEvent) {
|
|
|
142
142
|
}
|
|
143
143
|
moveupon(window, handle);
|
|
144
144
|
|
|
145
|
+
|
|
145
146
|
resize.on = function (elem, dragHandle) {
|
|
146
147
|
if (elem) {
|
|
147
148
|
elem.dragHandle = dragHandle;
|
|
@@ -150,6 +151,23 @@ resize.on = function (elem, dragHandle) {
|
|
|
150
151
|
var off = onmousemove(window, getResizer);
|
|
151
152
|
onremove(elem, off);
|
|
152
153
|
});
|
|
154
|
+
var computed = getComputedStyle(elem);
|
|
155
|
+
var resizeh = function () {
|
|
156
|
+
var elem = this;
|
|
157
|
+
if (elem.scrollWidth > elem.clientWidth) {
|
|
158
|
+
css(elem, { width: elem.offsetWidth });
|
|
159
|
+
dispatch(elem, 'resize');
|
|
160
|
+
}
|
|
161
|
+
if (elem.scrollHeight > elem.clientHeight) {
|
|
162
|
+
css(elem, { height: elem.offsetHeight });
|
|
163
|
+
dispatch(elem, 'resize');
|
|
164
|
+
}
|
|
165
|
+
if (unbind && parseInt(computed.height) && parseInt(computed.width)) {
|
|
166
|
+
unbind();
|
|
167
|
+
unbind = null;
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
if (!parseInt(computed.height) || !parseInt(computed.width)) var unbind = bind('render')(elem, resizeh);
|
|
153
171
|
if (!~resizingElements.indexOf(elem)) {
|
|
154
172
|
resizingElements.push(elem);
|
|
155
173
|
once('remove')(elem, function () {
|
package/coms/zimoli/scrollbar.js
CHANGED
|
@@ -2,7 +2,7 @@ var scrollbary = function () {
|
|
|
2
2
|
var reshape = function (scrollHeight, offsetHeight) {
|
|
3
3
|
var target = this.target;
|
|
4
4
|
if (target) {
|
|
5
|
-
this
|
|
5
|
+
css(this, { height: target.offsetHeight });
|
|
6
6
|
}
|
|
7
7
|
var scrollbarHeight = this.offsetHeight;
|
|
8
8
|
var ratio = offsetHeight / scrollHeight;
|
|
@@ -10,11 +10,14 @@ var scrollbary = function () {
|
|
|
10
10
|
if (thumbHeight < 14) thumbHeight = 14;
|
|
11
11
|
if (thumbHeight < 0) thumbHeight = 0;
|
|
12
12
|
this.restHeight = scrollHeight - offsetHeight;
|
|
13
|
-
this.thumb
|
|
13
|
+
css(this.thumb, {
|
|
14
|
+
height: thumbHeight
|
|
15
|
+
});
|
|
14
16
|
if (thumbHeight >= this.clientHeight) {
|
|
15
17
|
this.style.opacity = 0;
|
|
16
18
|
} else {
|
|
17
19
|
this.style.opacity = 1;
|
|
20
|
+
this.autoshow();
|
|
18
21
|
}
|
|
19
22
|
};
|
|
20
23
|
var getTop = function () {
|
|
@@ -59,7 +62,7 @@ var scrollbary = function () {
|
|
|
59
62
|
deltaY = targetY - thumbTop;
|
|
60
63
|
moving.y += deltaY;
|
|
61
64
|
if (targetY !== thumbTop) {
|
|
62
|
-
thumb
|
|
65
|
+
css(thumb, { top: targetY });
|
|
63
66
|
dispatch(target, "change");
|
|
64
67
|
}
|
|
65
68
|
};
|
|
@@ -138,7 +141,7 @@ var scrollbary = function () {
|
|
|
138
141
|
return { Height, height };
|
|
139
142
|
};
|
|
140
143
|
|
|
141
|
-
function bindTarget(_container) {
|
|
144
|
+
function bindTarget(_container, followResize = _container) {
|
|
142
145
|
var _scrollbar = this;
|
|
143
146
|
_container.with = _scrollbar;
|
|
144
147
|
onappend(_container, _scrollbar.reshape);
|
|
@@ -146,24 +149,33 @@ var scrollbary = function () {
|
|
|
146
149
|
on("scroll")(_container, function () {
|
|
147
150
|
var top = getTargetTop(_container);
|
|
148
151
|
_scrollbar.scrollTo(top);
|
|
152
|
+
_scrollbar.autoshow();
|
|
149
153
|
});
|
|
150
154
|
on("change")(_scrollbar, function () {
|
|
151
155
|
var top = _scrollbar.Top();
|
|
152
156
|
setTargetTop(_container, top);
|
|
153
157
|
});
|
|
154
|
-
_scrollbar.reshape
|
|
158
|
+
if (followResize) on("resize")(followResize, _scrollbar.reshape);
|
|
155
159
|
}
|
|
156
|
-
function scrollbar() {
|
|
157
|
-
var _scrollbar =
|
|
160
|
+
function scrollbar(elem) {
|
|
161
|
+
var _scrollbar = elem || document.createElement("scrollbar");
|
|
158
162
|
_scrollbar.reshape = function () {
|
|
159
163
|
var _container = _scrollbar.target;
|
|
160
164
|
var { Height, height } = getTargetHeight(_container);
|
|
161
165
|
reshape.call(_scrollbar, Height, height);
|
|
162
166
|
};
|
|
163
167
|
_scrollbar.scrollTo = scrollTo;
|
|
164
|
-
var _handler =
|
|
168
|
+
var _handler = document.createElement("scrollbar-thumb");
|
|
165
169
|
_handler.className = "thumb";
|
|
166
170
|
_scrollbar.Top = getTop;
|
|
171
|
+
_scrollbar.autohide = lazy(function () {
|
|
172
|
+
this.thumb.style.opacity = 0;
|
|
173
|
+
}, 600);
|
|
174
|
+
_scrollbar.autoshow = function () {
|
|
175
|
+
this.autohide();
|
|
176
|
+
this.thumb.style.opacity = 1;
|
|
177
|
+
};
|
|
178
|
+
|
|
167
179
|
moveupon(_handler, {
|
|
168
180
|
start: mousedown,
|
|
169
181
|
move: mousemove,
|
|
@@ -1,10 +1,31 @@
|
|
|
1
1
|
& {
|
|
2
2
|
position: absolute;
|
|
3
|
-
width:
|
|
3
|
+
width: 6px;
|
|
4
4
|
background-color: rgba(0, 0, 0, .1);
|
|
5
5
|
border-radius: 7px;
|
|
6
6
|
height: 100px;
|
|
7
|
+
border-left: 3px solid transparent;
|
|
8
|
+
|
|
9
|
+
&:hover {
|
|
10
|
+
>.thumb {
|
|
11
|
+
opacity: 1 !important;
|
|
12
|
+
overflow: visible;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
7
16
|
>.thumb {
|
|
17
|
+
&:after {
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: 0;
|
|
20
|
+
bottom: 0;
|
|
21
|
+
left: -4px;
|
|
22
|
+
right: -4px;
|
|
23
|
+
width: auto;
|
|
24
|
+
display: block;
|
|
25
|
+
content: "";
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
transition: opacity .2s;
|
|
8
29
|
position: absolute;
|
|
9
30
|
border-radius: 7px;
|
|
10
31
|
height: 100%;
|