efront 3.26.8 → 3.26.14
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.jsp +2 -2
- package/apps/pivot/dht/list.js +53 -0
- package/apps/pivot/index.html +3 -1
- package/apps/pivot/main.js +1 -0
- package/apps/pivot/main.less +3 -0
- package/apps/pivot/wow/root.js +138 -104
- package/apps/pivot/wow/root.less +1 -62
- package/coms/basic/Task.js +51 -0
- package/coms/basic/cross_.js +8 -0
- package/coms/basic/keys.js +3 -4
- package/coms/basic/loader.js +42 -17
- package/coms/basic/submit_.js +6 -3
- package/coms/explorer/Explorer.js +85 -0
- package/coms/explorer/context.js +205 -0
- package/coms/explorer/deepcp.js +48 -0
- package/{apps/pivot/wow → coms/explorer}/edit.html +1 -1
- package/{apps/pivot/wow → coms/explorer}/edit.js +17 -9
- package/coms/explorer/fileitem.html +8 -0
- package/coms/explorer/fileitem.js +34 -0
- package/coms/explorer/fileitem.less +65 -0
- package/coms/explorer/filetip.js +10 -0
- package/coms/explorer/filetip.less +5 -0
- package/coms/explorer/main.html +8 -0
- package/coms/explorer/main.js +215 -0
- package/coms/explorer/main.less +78 -0
- package/coms/frame/route.js +1 -1
- package/coms/shapes/file.html +9 -0
- package/coms/shapes/folder.html +7 -0
- package/coms/zimoli/Cleanup.js +9 -8
- package/coms/zimoli/arriswise.js +5 -4
- package/coms/zimoli/attr.js +2 -0
- package/coms/zimoli/bindGlobalkey.js +37 -0
- package/coms/zimoli/confirm.js +8 -8
- package/coms/zimoli/confirm.less +6 -80
- package/coms/zimoli/container.js +19 -6
- package/coms/zimoli/contextmenu.js +35 -15
- package/coms/zimoli/drag.js +7 -3
- package/coms/zimoli/field.html +1 -1
- package/coms/zimoli/field.js +8 -2
- package/coms/zimoli/field.less +0 -1
- package/coms/zimoli/getChanges.js +1 -0
- package/coms/zimoli/list.js +44 -33
- package/coms/zimoli/menu.js +1 -24
- package/coms/zimoli/menuItem.html +4 -1
- package/coms/zimoli/menuList.js +54 -104
- package/coms/zimoli/menuList.less +1 -0
- package/coms/zimoli/moveupon.js +2 -2
- package/coms/zimoli/overpos.js +7 -0
- package/coms/zimoli/popup.js +22 -27
- package/coms/zimoli/prompt.js +43 -5
- package/coms/zimoli/prompt.less +23 -0
- package/coms/zimoli/render.js +149 -107
- package/coms/zimoli/resize.js +12 -5
- package/coms/zimoli/rootElements.js +15 -1
- package/coms/zimoli/view.js +33 -0
- package/coms/zimoli/view.less +8 -8
- package/coms/zimoli/yousure.js +53 -0
- package/coms/zimoli/yousure.less +4 -0
- package/coms/zimoli/zimoli.js +10 -6
- package/package.json +1 -1
- package/public/efront.js +1 -1
- package/apps/pivot/wow/root.html +0 -10
- package/coms/zimoli/explorer.html +0 -5
- package/coms/zimoli/explorer.js +0 -8
- package/coms/zimoli/explorer.less +0 -18
- package/coms/zimoli/explorer_test.js +0 -4
package/coms/zimoli/drag.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
var toCloneTarget = function (target, isMovingSource) {
|
|
2
|
+
target.setAttribute("dragclone", '');
|
|
2
3
|
var clone = cloneVisible(target);
|
|
4
|
+
target.removeAttribute("dragclone");
|
|
3
5
|
var position = getScreenPosition(target);
|
|
4
6
|
css(clone, `position:absolute;left:${fromOffset(position.left)};top:${fromOffset(position.top)};user-select:none;`);
|
|
5
7
|
setOpacity(target, isMovingSource !== false ? 0 : 1);
|
|
@@ -34,9 +36,11 @@ var setZIndex = function () {
|
|
|
34
36
|
};
|
|
35
37
|
function drag(target, initialEvent, preventOverflow, isMovingSource) {
|
|
36
38
|
if (/^(?:select|input|textarea)$/i.test(initialEvent.target.tagName) || getTargetIn(a => a.nodrag || a.hasAttribute('nodrag'), initialEvent.target)) return;
|
|
37
|
-
if (
|
|
38
|
-
var extraTargets =
|
|
39
|
-
|
|
39
|
+
if (isArrayLike(target)) {
|
|
40
|
+
var extraTargets = Array.prototype.slice.call(target, 0);
|
|
41
|
+
var index = extraTargets.length - 1;
|
|
42
|
+
while (index > 0 && !getTargetIn(extraTargets[index], initialEvent.target)) index--;
|
|
43
|
+
[target] = extraTargets.splice(index, 1);
|
|
40
44
|
} else {
|
|
41
45
|
var extraTargets = target.with ? [].concat(target.with) : [];
|
|
42
46
|
}
|
package/coms/zimoli/field.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
</div>
|
|
6
6
|
<div class="body">
|
|
7
7
|
<model _data=data _field=field _readonly="readonly"></model>
|
|
8
|
-
<
|
|
8
|
+
<container class="error" -src="error"></container>
|
|
9
9
|
</div>
|
|
10
10
|
<div class="foot" ng-if="field.msg">
|
|
11
11
|
<span ng-bind=field.msg></span>
|
package/coms/zimoli/field.js
CHANGED
|
@@ -29,10 +29,16 @@ function main(elem) {
|
|
|
29
29
|
this.setAttribute("error", error);
|
|
30
30
|
switch (error) {
|
|
31
31
|
case "empty":
|
|
32
|
-
scope.error =
|
|
32
|
+
scope.error = true;
|
|
33
33
|
break;
|
|
34
34
|
default:
|
|
35
|
-
|
|
35
|
+
if (isNode(error)) {
|
|
36
|
+
scope.error = error;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
scope.error = document.createElement('error');
|
|
40
|
+
scope.error.innerHTML = error;
|
|
41
|
+
}
|
|
36
42
|
}
|
|
37
43
|
}
|
|
38
44
|
else {
|
package/coms/zimoli/field.less
CHANGED
|
@@ -4,6 +4,7 @@ function getChanges(current_props, previous_props) {
|
|
|
4
4
|
if (!isObject(current_props)) current_props = Object.create(null), changes = {};
|
|
5
5
|
if (!isObject(previous_props)) previous_props = Object.create(null), changes = {};
|
|
6
6
|
keys(previous_props, current_props).forEach(function (key) {
|
|
7
|
+
if (key.charAt(0) === "$") return;
|
|
7
8
|
if (!deepEqual.shallow(current_props[key], previous_props[key])) {
|
|
8
9
|
if (!changes) changes = {};
|
|
9
10
|
changes[key] = { previous: previous_props[key], current: current_props[key] };
|
package/coms/zimoli/list.js
CHANGED
|
@@ -380,6 +380,7 @@ function ylist(container, generator, $Y) {
|
|
|
380
380
|
patchBottom(0);
|
|
381
381
|
});
|
|
382
382
|
list.getLastVisibleElement = getLastVisibleElement;
|
|
383
|
+
list.getFirstVisibleElement = getFirstVisibleElement;
|
|
383
384
|
list.$stopY = function (t, spd) {
|
|
384
385
|
var firstElement = getFirstVisibleElement();
|
|
385
386
|
var lastElement = getLastVisibleElement();
|
|
@@ -471,7 +472,15 @@ function ylist(container, generator, $Y) {
|
|
|
471
472
|
* @param {boolean} animate
|
|
472
473
|
*/
|
|
473
474
|
list.setFocus = function (focused, animate) {
|
|
474
|
-
if (focused && (focused.hasAttribute("disabled") || focused.hasAttribute("line"))) return;
|
|
475
|
+
if (isElement(focused) && (focused.hasAttribute("disabled") || focused.hasAttribute("line"))) return;
|
|
476
|
+
if (isFinite(focused)) {
|
|
477
|
+
var index = focused;
|
|
478
|
+
focused = list.getIndexedElement(index);
|
|
479
|
+
if (!focused) {
|
|
480
|
+
list.go(index);
|
|
481
|
+
focused = list.getIndexedElement(index);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
475
484
|
if (!focused) {
|
|
476
485
|
if (list.focused) {
|
|
477
486
|
removeClass(list.focused, 'focus');
|
|
@@ -482,6 +491,9 @@ function ylist(container, generator, $Y) {
|
|
|
482
491
|
if (list.focused === focused) return;
|
|
483
492
|
if (list.focused) removeClass(list.focused, 'focus');
|
|
484
493
|
addClass(focused, "focus");
|
|
494
|
+
list.focused = focused;
|
|
495
|
+
while (focused && focused.parentNode !== list) focused = focused.parentNode;
|
|
496
|
+
if (!focused) return;
|
|
485
497
|
var scrollTop = list.scrollTop;
|
|
486
498
|
var firstElement = getFirstElement(1);
|
|
487
499
|
var sideheight = 0;
|
|
@@ -497,7 +509,6 @@ function ylist(container, generator, $Y) {
|
|
|
497
509
|
scrollTop = focused.offsetTop - sideheight;
|
|
498
510
|
}
|
|
499
511
|
if (scrollTop !== list.scrollTop) scrollBy(scrollTop - list.scrollTop, animate);
|
|
500
|
-
list.focused = focused;
|
|
501
512
|
};
|
|
502
513
|
|
|
503
514
|
/**
|
|
@@ -509,37 +520,37 @@ function ylist(container, generator, $Y) {
|
|
|
509
520
|
var newIndex = 0, total = 0;
|
|
510
521
|
if (delta === 'up') delta = -1;
|
|
511
522
|
if (delta === 'down') delta = 1;
|
|
512
|
-
if (typeof delta === 'string') {
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
523
|
+
if (typeof delta === 'string') switch (delta.toLowerCase()) {
|
|
524
|
+
case "home":
|
|
525
|
+
newIndex = 0;
|
|
526
|
+
delta = 1;
|
|
527
|
+
break;
|
|
528
|
+
case "end":
|
|
529
|
+
var lastElement = getLastElement(1);
|
|
530
|
+
if (!lastElement) return;
|
|
531
|
+
newIndex = lastElement.index;
|
|
532
|
+
delta = -1;
|
|
533
|
+
break;
|
|
534
|
+
case "pageup":
|
|
535
|
+
var firstElement = getFirstVisibleElement();
|
|
536
|
+
if (!firstElement) return;
|
|
537
|
+
newIndex = firstElement.index;
|
|
538
|
+
list.scrollBy(-list.clientHeight + firstElement.offsetHeight);
|
|
539
|
+
var lastElement = getLastVisibleElement();
|
|
540
|
+
if (lastElement.index < newIndex) newIndex = lastElement.index;
|
|
541
|
+
delta = -1;
|
|
542
|
+
break;
|
|
543
|
+
case "pagedown":
|
|
544
|
+
var lastElement = getLastVisibleElement();
|
|
545
|
+
if (!lastElement) return;
|
|
546
|
+
newIndex = lastElement.index;
|
|
547
|
+
list.scrollBy(list.clientHeight - lastElement.offsetHeight);
|
|
548
|
+
var firstElement = getFirstVisibleElement();
|
|
549
|
+
if (firstElement.index > newIndex) newIndex = firstElement.index;
|
|
550
|
+
delta = 1;
|
|
551
|
+
break;
|
|
552
|
+
default:
|
|
553
|
+
return false;
|
|
543
554
|
}
|
|
544
555
|
else if (!focused) {
|
|
545
556
|
var lastElement = getLastElement(1);
|
package/coms/zimoli/menu.js
CHANGED
|
@@ -89,29 +89,6 @@ var getTreeNodes = function (elem) {
|
|
|
89
89
|
[].forEach.call(elem.children, run);
|
|
90
90
|
return nodes;
|
|
91
91
|
};
|
|
92
|
-
/**
|
|
93
|
-
* @param {any} item
|
|
94
|
-
* @param {Event} event
|
|
95
|
-
*/
|
|
96
|
-
var emitEvent = function (item, event) {
|
|
97
|
-
if (event.defaultPrevented) return;
|
|
98
|
-
event.preventDefault(true);
|
|
99
|
-
if (item.disabled) return;
|
|
100
|
-
active(this, item, "global", this.$src ? createItemTarget.call(this, item) : this);
|
|
101
|
-
}
|
|
102
|
-
function bindGlobalkey(elem, keymap, emit) {
|
|
103
|
-
if (elem.keyoff) {
|
|
104
|
-
for (var off of elem.keyoff) {
|
|
105
|
-
off();
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
if (!keymap) return;
|
|
109
|
-
var keyoff = [];
|
|
110
|
-
for (let k in keymap) {
|
|
111
|
-
keyoff.push(bind("keydown.only." + k)(elem, emitEvent.bind(elem, keymap[k])));
|
|
112
|
-
}
|
|
113
|
-
elem.keyoff = keyoff;
|
|
114
|
-
}
|
|
115
92
|
|
|
116
93
|
function main(elem, mode) {
|
|
117
94
|
if (isElement(elem)) {
|
|
@@ -197,7 +174,7 @@ function main(elem, mode) {
|
|
|
197
174
|
if ("$src" in elem) {
|
|
198
175
|
var src0 = [];
|
|
199
176
|
care(elem, function (src) {
|
|
200
|
-
bindGlobalkey(elem, src.keymap
|
|
177
|
+
bindGlobalkey(elem, src.keymap);
|
|
201
178
|
src0.splice(0, src0.length);
|
|
202
179
|
var s = getTreeFromData(src);
|
|
203
180
|
if (s.actived) {
|
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
</template>
|
|
6
6
|
</template>
|
|
7
7
|
<span -html="name?" -style="{color:color?}"></span>
|
|
8
|
-
<template -if="hotkey
|
|
8
|
+
<template -if="typeof hotkey==='string'">
|
|
9
|
+
<span class="hotkey" -html="hotkey"></span>
|
|
10
|
+
</template>
|
|
11
|
+
<template -elseif="hotkey?.length">
|
|
9
12
|
<span ng-repeat="k of hotkey" class="hotkey" ng-html="k"></span>
|
|
10
13
|
</template>
|
|
11
14
|
<s></s>
|
package/coms/zimoli/menuList.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var _active = action;
|
|
2
|
-
var mounted_menus = [], releaseTimer = 0
|
|
2
|
+
var mounted_menus = [], releaseTimer = 0;
|
|
3
3
|
var release = function () {
|
|
4
4
|
clear();
|
|
5
5
|
releaseTimer = setTimeout(function () {
|
|
@@ -10,98 +10,61 @@ var clear = function () {
|
|
|
10
10
|
clearTimeout(releaseTimer);
|
|
11
11
|
};
|
|
12
12
|
var unfocus = lazy(function () {
|
|
13
|
-
if (mounted_menus.indexOf(document.activeElement) >= 0) return;
|
|
14
|
-
remove(mounted_menus);
|
|
15
|
-
if (root_menu) root_menu.setFocus(null);
|
|
16
13
|
var root = this.root || this;
|
|
14
|
+
if (mounted_menus.indexOf(document.activeElement) >= 0 || document.activeElement === root) return;
|
|
15
|
+
remove(mounted_menus);
|
|
17
16
|
if (root.ispop === 1) root.ispop = false;
|
|
18
17
|
root.actived = null;
|
|
19
18
|
root.setFocus(null);
|
|
20
19
|
});
|
|
21
20
|
var unblur = function () {
|
|
22
21
|
if (document.activeElement !== this) {
|
|
23
|
-
this.tabIndex = 0;
|
|
24
22
|
this.focus();
|
|
25
23
|
}
|
|
26
24
|
};
|
|
27
25
|
var openFocus = function () {
|
|
28
|
-
var menu =
|
|
26
|
+
var menu = this;
|
|
29
27
|
if (!menu.ispop) menu.ispop = 1;
|
|
30
28
|
menu.open(menu.focused);
|
|
31
29
|
};
|
|
32
30
|
var closeFocus = function () {
|
|
33
|
-
|
|
34
|
-
remove(menu);
|
|
31
|
+
remove(this.actived);
|
|
35
32
|
};
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (menu) var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
// right
|
|
45
|
-
if (menu.focused) var fmenu = menu.focused.menu;
|
|
46
|
-
if (fmenu && fmenu.children && fmenu.children.length) {
|
|
47
|
-
openFocus();
|
|
48
|
-
}
|
|
49
|
-
else if (parent) {
|
|
50
|
-
var index = mounted_menus.lastIndexOf(parent);
|
|
51
|
-
while (parent && parent.direction === 'y') {
|
|
52
|
-
parent = mounted_menus[--index];
|
|
53
|
-
}
|
|
54
|
-
if (!parent && root_menu.direction !== 'y') parent = root_menu;
|
|
55
|
-
if (parent) parent.moveFocus(deltax, parent.ispop);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
else if (deltax === -1) {
|
|
59
|
-
// left
|
|
60
|
-
if (parent) {
|
|
61
|
-
if (parent.direction === 'y') remove(mounted_menus.pop());
|
|
62
|
-
else parent.moveFocus(deltax, parent.ispop);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
menu.moveFocus(deltay, menu.ispop);
|
|
67
|
-
}
|
|
33
|
+
var keydown = function () {
|
|
34
|
+
var menu = this;
|
|
35
|
+
if (menu.moveFocus("down") !== false) return;
|
|
36
|
+
if (menu.focused) var fmenu = menu.focused.menu;
|
|
37
|
+
if (fmenu && fmenu.children && fmenu.children.length) {
|
|
38
|
+
if (!menu.ispop) menu.ispop = 1;
|
|
39
|
+
menu.open(menu.focused);
|
|
40
|
+
return;
|
|
68
41
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
else if (deltay === -1) {
|
|
84
|
-
// up
|
|
85
|
-
if (parent) {
|
|
86
|
-
if (parent.direction !== 'y') remove(mounted_menus.pop());
|
|
87
|
-
else parent.moveFocus(deltay, parent.ispop);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
menu.moveFocus(deltax, menu.ispop);
|
|
92
|
-
}
|
|
42
|
+
do {
|
|
43
|
+
menu = menu.parent;
|
|
44
|
+
}
|
|
45
|
+
while (menu && (menu.focus(), menu.moveFocus("down") === false));
|
|
46
|
+
if (menu && !menu.actived) menu.focus();
|
|
47
|
+
};
|
|
48
|
+
var keyup = function () {
|
|
49
|
+
var menu = this;
|
|
50
|
+
if (menu && menu.moveFocus("up") !== false) return;
|
|
51
|
+
var parent = menu.parent;
|
|
52
|
+
if (parent && (parent.focus(), parent.moveFocus("up") === false)) {
|
|
53
|
+
parent.focus();
|
|
54
|
+
remove(menu);
|
|
93
55
|
}
|
|
94
56
|
};
|
|
57
|
+
var keyleft = arriswise(keyup, arguments);
|
|
58
|
+
var keyright = arriswise(keydown, arguments);
|
|
95
59
|
function keyalt() {
|
|
96
60
|
if (this === document.activeElement) this.blur();
|
|
97
|
-
else
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
root_menu.setFocus(root_menu.getIndexedElement(0));
|
|
61
|
+
else {
|
|
62
|
+
this.focus();
|
|
63
|
+
this.setFocus(this.getIndexedElement(0));
|
|
101
64
|
}
|
|
102
65
|
}
|
|
103
66
|
function keytab(event) {
|
|
104
|
-
var menu =
|
|
67
|
+
var menu = this;
|
|
105
68
|
event.preventDefault();
|
|
106
69
|
menu.moveFocus(event.shiftKey ? -1 : 1);
|
|
107
70
|
}
|
|
@@ -112,50 +75,28 @@ function keyesc() {
|
|
|
112
75
|
else this.ispop = false;
|
|
113
76
|
}
|
|
114
77
|
}
|
|
115
|
-
function keyup() {
|
|
116
|
-
keyAction(0, -1);
|
|
117
|
-
}
|
|
118
|
-
function keydown() {
|
|
119
|
-
keyAction(0, 1);
|
|
120
|
-
}
|
|
121
|
-
function keyleft() {
|
|
122
|
-
keyAction(-1, 0)
|
|
123
|
-
}
|
|
124
|
-
function keyright() {
|
|
125
|
-
keyAction(1, 0);
|
|
126
|
-
}
|
|
127
|
-
function getFocusedMenu() {
|
|
128
|
-
var menu = mounted_menus[mounted_menus.length - 1];
|
|
129
|
-
if (!menu || !menu.focused) menu = mounted_menus[mounted_menus.length - 2] || root_menu;
|
|
130
|
-
if (mounted_menus.indexOf(document.activeElement) >= 0 || document.activeElement === root_menu) return menu;
|
|
131
|
-
}
|
|
132
78
|
function keyspace() {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
menu.focused.click();
|
|
79
|
+
if (this.focused) {
|
|
80
|
+
this.focused.click();
|
|
136
81
|
}
|
|
137
82
|
}
|
|
138
83
|
function keyhome() {
|
|
139
|
-
|
|
140
|
-
if (menu) menu.moveFocus("home", true);
|
|
84
|
+
this.moveFocus("home", true);
|
|
141
85
|
}
|
|
142
86
|
function keyend() {
|
|
143
|
-
|
|
144
|
-
if (menu) menu.moveFocus("end", true);
|
|
87
|
+
this.moveFocus("end", true);
|
|
145
88
|
}
|
|
146
89
|
function keypagedown() {
|
|
147
|
-
|
|
148
|
-
if (menu) menu.moveFocus("pagedown", true);
|
|
90
|
+
this.moveFocus("pagedown", true);
|
|
149
91
|
}
|
|
150
92
|
function keypageup() {
|
|
151
|
-
|
|
152
|
-
if (menu) menu.moveFocus("pageup", true);
|
|
93
|
+
this.moveFocus("pageup", true);
|
|
153
94
|
}
|
|
154
|
-
function
|
|
155
|
-
var menu = this;
|
|
156
|
-
// if (!root_menu) root_menu = this;
|
|
95
|
+
function registerAlt(menu) {
|
|
157
96
|
bind('keydown.only.alt.')(menu, keyalt);
|
|
158
97
|
bind('keydown.esc.only')(menu, keyesc);
|
|
98
|
+
}
|
|
99
|
+
function registerMenuKeys(menu) {
|
|
159
100
|
on('keydown.pageup.only')(menu, keypageup);
|
|
160
101
|
on('keydown.pagedown.only')(menu, keypagedown);
|
|
161
102
|
on('keydown.home.only')(menu, keyhome);
|
|
@@ -185,6 +126,7 @@ function main() {
|
|
|
185
126
|
function popMenu(item, target) {
|
|
186
127
|
if (page.actived) {
|
|
187
128
|
clear();
|
|
129
|
+
page.focus();
|
|
188
130
|
remove(page.actived);
|
|
189
131
|
}
|
|
190
132
|
if (!item.length) return;
|
|
@@ -200,15 +142,16 @@ function main() {
|
|
|
200
142
|
mounted_menus.push(menu);
|
|
201
143
|
page.actived = menu;
|
|
202
144
|
menu.root = page.root || page;
|
|
145
|
+
menu.parent = page;
|
|
203
146
|
if (menu.go) menu.go(0);
|
|
204
147
|
popup(menu, target);
|
|
148
|
+
unblur.call(menu);
|
|
205
149
|
if (page.ispop === true) {
|
|
206
150
|
} else {
|
|
207
151
|
page.ispop = 1;
|
|
208
152
|
}
|
|
209
153
|
on("remove")(menu, function () {
|
|
210
154
|
removeFromList(mounted_menus, this);
|
|
211
|
-
menu.setFocus(null);
|
|
212
155
|
css(menu, "width:;height:;max-height:;max-width:;");
|
|
213
156
|
});
|
|
214
157
|
return menu;
|
|
@@ -221,7 +164,13 @@ function main() {
|
|
|
221
164
|
template.innerHTML = page.innerHTML;
|
|
222
165
|
page.$template = template;
|
|
223
166
|
}
|
|
167
|
+
var enterMenuEnabled = 0;
|
|
168
|
+
onmousemove(page, function () {
|
|
169
|
+
enterMenuEnabled = Date.now();
|
|
170
|
+
});
|
|
224
171
|
var enterMenu = lazy(function (menu) {
|
|
172
|
+
if (enterMenuEnabled + 200 < Date.now()) return;
|
|
173
|
+
enterMenuEnabled = false;
|
|
225
174
|
if (page.ispop) {
|
|
226
175
|
page.setFocus(menu);
|
|
227
176
|
popMenu(menu.menu, menu);
|
|
@@ -377,7 +326,7 @@ function main() {
|
|
|
377
326
|
});
|
|
378
327
|
on("focused")(page, function () {
|
|
379
328
|
var focused = page.focused;
|
|
380
|
-
if (page.ispop && page
|
|
329
|
+
if (page.ispop && !page.parent) popMenu(focused.menu, focused, false);
|
|
381
330
|
});
|
|
382
331
|
page.openFocus = openFocus;
|
|
383
332
|
page.closeFocus = closeFocus;
|
|
@@ -387,8 +336,9 @@ function main() {
|
|
|
387
336
|
enterMenu.cancel();
|
|
388
337
|
});
|
|
389
338
|
page.registerAsRoot = function () {
|
|
390
|
-
|
|
391
|
-
root_menu = this;
|
|
339
|
+
registerAlt(this);
|
|
392
340
|
};
|
|
341
|
+
page.tabIndex = 0;
|
|
342
|
+
registerMenuKeys(page);
|
|
393
343
|
return page;
|
|
394
344
|
}
|
package/coms/zimoli/moveupon.js
CHANGED
|
@@ -81,8 +81,7 @@ function moveupon(target, { start, move, end }, initialEvent) {
|
|
|
81
81
|
offtouchcancel = ontouchcancel(target, cancel);
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
-
if (
|
|
85
|
-
if (!initialEvent) throw new Error("请传入touchstartEvent或者mousedownEvent");
|
|
84
|
+
if (initialEvent) {
|
|
86
85
|
if (locktouch(initialEvent.target)) return;
|
|
87
86
|
if (initialEvent.type === "touchstart") {
|
|
88
87
|
extendTouchEvent(initialEvent);
|
|
@@ -91,6 +90,7 @@ function moveupon(target, { start, move, end }, initialEvent) {
|
|
|
91
90
|
} else {
|
|
92
91
|
hookmouse();
|
|
93
92
|
}
|
|
93
|
+
if (isFunction(start)) start.call(target, initialEvent);
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
onmousedown(target, function (event) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
function overpos(rect, event) {
|
|
2
|
+
if (isArrayLike(rect)) var [left, top, right, bottom] = rect;
|
|
3
|
+
else if (isElement(rect)) var pos = getScreenPosition(rect), { left, top, right, bottom } = pos;
|
|
4
|
+
if (isArrayLike(event)) var [clientX, clientY] = event;
|
|
5
|
+
else var { clientX, clientY } = event;
|
|
6
|
+
return left < clientX && top < clientY && right > clientX && bottom > clientY;
|
|
7
|
+
}
|
package/coms/zimoli/popup.js
CHANGED
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 弹出层
|
|
3
|
-
*/
|
|
4
|
-
on("keydown.esc.only")(document, function (e) {
|
|
5
|
-
if (e.defaultPrevented) return;
|
|
6
|
-
if (rootElements.length) {
|
|
7
|
-
var r = rootElements.pop();
|
|
8
|
-
if (r) {
|
|
9
|
-
r.blur();
|
|
10
|
-
remove(r);
|
|
11
|
-
e.preventDefault();
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
1
|
var animationStyle = "opacity:0;transform:scale(1.2);transition:.1s opacity ease-out,.2s transform ease-out;";
|
|
16
2
|
var setInitialStyle = function (element) {
|
|
17
3
|
if (!element.initialStyle) element.initialStyle = animationStyle;
|
|
@@ -38,7 +24,7 @@ var popup = function (path) {
|
|
|
38
24
|
if (isNode(path)) {
|
|
39
25
|
return popup_view.apply(null, arguments);
|
|
40
26
|
}
|
|
41
|
-
throw new Error(
|
|
27
|
+
throw new Error(`参数异常:${path}`);
|
|
42
28
|
};
|
|
43
29
|
var popup_path = function (path = "", parameters, target) {
|
|
44
30
|
if (!popup.go || !popup.prepare) throw new Error("当前环境无法使用");
|
|
@@ -129,6 +115,8 @@ var popup_view = function (element, target, style) {
|
|
|
129
115
|
if (target instanceof Event) {
|
|
130
116
|
popup_to_event(element, target);
|
|
131
117
|
} else if (target instanceof Array) {
|
|
118
|
+
if (isNode(style) && style.isMask) addMask(element, style);
|
|
119
|
+
else if (typeof style === 'boolean') addMask(element);
|
|
132
120
|
popup_to_point(element, target);
|
|
133
121
|
} else if (target) {
|
|
134
122
|
popup_with_mask(element);
|
|
@@ -152,22 +140,29 @@ var createMask = function (element) {
|
|
|
152
140
|
mask.isMask = true;
|
|
153
141
|
return mask;
|
|
154
142
|
};
|
|
155
|
-
var
|
|
143
|
+
var mount = function (event) {
|
|
144
|
+
if (!this.parentNode) {
|
|
145
|
+
appendChild.before(event.target, this);
|
|
146
|
+
this.with.push(event.target);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
var addMask = function (element, mask = createMask(element)) {
|
|
150
|
+
if (!mask.with) {
|
|
151
|
+
mask.with = [];
|
|
152
|
+
mask.clean = Cleanup.bind(mask);
|
|
153
|
+
mask.mount = mount.bind(mask);
|
|
154
|
+
}
|
|
155
|
+
element.$mask = mask;
|
|
156
|
+
onmounted(element, mask.mount);
|
|
157
|
+
onremove(element, mask.clean);
|
|
158
|
+
return mask;
|
|
159
|
+
};
|
|
160
|
+
var popup_with_mask = function (element, mask) {
|
|
161
|
+
mask = addMask(element, mask);
|
|
156
162
|
css(element, `z-index:${zIndex()};`);
|
|
157
163
|
if (mask.parentNode) {
|
|
158
164
|
global(element, false);
|
|
159
165
|
}
|
|
160
|
-
if (!element.with) {
|
|
161
|
-
element.with = [mask];
|
|
162
|
-
} else if (element.with instanceof Array) {
|
|
163
|
-
if (!~element.with.indexOf(element)) element.with.push(mask);
|
|
164
|
-
} else {
|
|
165
|
-
if (element.with !== element) element.with = [element.with, mask];
|
|
166
|
-
}
|
|
167
|
-
if (!mask.clean) {
|
|
168
|
-
mask.clean = new Cleanup(element.with);
|
|
169
|
-
}
|
|
170
|
-
onremove(element, mask.clean);
|
|
171
166
|
if (!element.parentNode) global(element, false);
|
|
172
167
|
return element;
|
|
173
168
|
};
|
package/coms/zimoli/prompt.js
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
var validate = function (text, checker, tip) {
|
|
2
|
+
var valid;
|
|
3
|
+
if (checker instanceof RegExp) {
|
|
4
|
+
valid = checker.test(text);
|
|
5
|
+
}
|
|
6
|
+
if (isFunction(checker)) {
|
|
7
|
+
var res = checker(text);
|
|
8
|
+
if (isEmpty(res)) valid = true;
|
|
9
|
+
else if (typeof res === 'boolean') valid = res;
|
|
10
|
+
else if (isNode(res)) remove(tip.childNodes), appendChild(tip, res);
|
|
11
|
+
else html(tip, res), valid = false;
|
|
12
|
+
}
|
|
13
|
+
if (valid) html(tip, '');
|
|
14
|
+
return valid;
|
|
15
|
+
};
|
|
16
|
+
function prompt() {
|
|
17
|
+
var msg = "请输入", check, ipt;
|
|
18
|
+
for (var arg of arguments) {
|
|
19
|
+
if (isNode(arg)) ipt = arg;
|
|
20
|
+
else if (typeof arg === 'string') msg = arg;
|
|
21
|
+
else if (isFunction(arg) || arg instanceof RegExp) check = arg;
|
|
22
|
+
}
|
|
2
23
|
var ipt = input();
|
|
24
|
+
var tip = document.createElement("tip");
|
|
3
25
|
var oked, ohed;
|
|
4
26
|
var oks = [], ohs = [];
|
|
5
27
|
var fire = function () {
|
|
@@ -9,17 +31,33 @@ function prompt(msg = "请输入", check) {
|
|
|
9
31
|
oks.splice(0, oks.length);
|
|
10
32
|
ohs.splice(0, ohs.length);
|
|
11
33
|
};
|
|
12
|
-
var
|
|
34
|
+
var buttons = [button("确认"), button("取消", 'white')];
|
|
35
|
+
if (isFunction(check)) {
|
|
36
|
+
var setDistable = function () {
|
|
37
|
+
var valid = validate(ipt.value, check, tip);
|
|
38
|
+
attr(body, "error", !valid);
|
|
39
|
+
attr(buttons[0], 'disabled', !valid);
|
|
40
|
+
};
|
|
41
|
+
on('keyup')(ipt, setDistable);
|
|
42
|
+
on('keypress')(ipt, setDistable);
|
|
43
|
+
on('cut')(ipt, setDistable);
|
|
44
|
+
on('paste')(ipt, setDistable);
|
|
45
|
+
on('input')(ipt, setDistable);
|
|
46
|
+
}
|
|
47
|
+
var body = div();
|
|
48
|
+
appendChild(body, [ipt, tip]);
|
|
49
|
+
var c = confirm(msg, body, buttons, function (_) {
|
|
13
50
|
if (oked || ohed) return;
|
|
14
|
-
if (_ ===
|
|
15
|
-
if (check &&
|
|
51
|
+
if (_ === buttons[0]) {
|
|
52
|
+
if (check && validate(ipt.value, check, tip)) return false;
|
|
16
53
|
oked = true;
|
|
17
54
|
} else {
|
|
18
55
|
ohed = true;
|
|
19
56
|
}
|
|
20
57
|
fire();
|
|
21
58
|
});
|
|
22
|
-
on('
|
|
59
|
+
on('mounted')(ipt, function () {
|
|
60
|
+
setDistable();
|
|
23
61
|
setTimeout(function () {
|
|
24
62
|
ipt.focus();
|
|
25
63
|
});
|