efront 3.15.7 → 3.16.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/log/boot.js +32 -3
- package/coms/basic/JSAM.js +54 -15
- package/coms/basic/cross_.js +1 -1
- 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/zimoli/data.js +1 -6
- package/coms/zimoli/dispatch.js +13 -1
- package/coms/zimoli/getValue.js +1 -1
- package/coms/zimoli/menu.js +24 -0
- package/coms/zimoli/menuItem.html +4 -1
- package/coms/zimoli/menuItem.js +7 -0
- package/coms/zimoli/menuItem.less +23 -2
- package/coms/zimoli/menuList.js +24 -18
- package/coms/zimoli/moveupon.js +6 -4
- package/coms/zimoli/on.js +173 -162
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/coms/zimoli/moveupon.js
CHANGED
|
@@ -3,13 +3,15 @@ function mousemove(event) {
|
|
|
3
3
|
moveListeners.forEach(a => a(event));
|
|
4
4
|
}
|
|
5
5
|
function addHookListener(on, hook, isroot) {
|
|
6
|
-
var index = moveListeners.indexOf(hook);
|
|
7
|
-
if (~index) {
|
|
8
|
-
moveListeners.splice(index, 1);
|
|
9
|
-
}
|
|
10
6
|
if (!moveListeners.length) {
|
|
11
7
|
offhook = on(window, mousemove);
|
|
12
8
|
}
|
|
9
|
+
else {
|
|
10
|
+
var index = moveListeners.indexOf(hook);
|
|
11
|
+
if (~index) {
|
|
12
|
+
moveListeners.splice(index, 1);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
13
15
|
if (isroot) {
|
|
14
16
|
moveListeners.unshift(hook);
|
|
15
17
|
} else {
|
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("use ", k, "on document instead of on 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");
|