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/dispatch.js
CHANGED
|
@@ -8,6 +8,18 @@ var dispatch = "dispatchEvent" in document ? function dispatchEvent(target, even
|
|
|
8
8
|
return target[fire] && target[fire](event);
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* @param {Event} e
|
|
13
|
+
*/
|
|
14
|
+
function dispatch2(t, e) {
|
|
15
|
+
var on = 'on' + e.type;
|
|
16
|
+
var f = t[on];
|
|
17
|
+
var res = dispatch(t, e);
|
|
18
|
+
if (f && (t.nodeType !== 1 || t.constructor === window.HTMLUnknownElement)) {
|
|
19
|
+
return f.call(t, e) !== false;
|
|
20
|
+
}
|
|
21
|
+
return res;
|
|
22
|
+
}
|
|
11
23
|
function main() {
|
|
12
24
|
var target, event, value;
|
|
13
25
|
for (var cx = 0, dx = arguments.length; cx < dx; cx++) {
|
|
@@ -27,7 +39,7 @@ function main() {
|
|
|
27
39
|
event.value = arg;
|
|
28
40
|
}
|
|
29
41
|
}
|
|
30
|
-
if (
|
|
42
|
+
if (dispatch2(target || window, event)) {
|
|
31
43
|
return event;
|
|
32
44
|
};
|
|
33
45
|
return false;
|
package/coms/zimoli/drag.js
CHANGED
|
@@ -22,12 +22,15 @@ var setZIndex = function () {
|
|
|
22
22
|
if (!isElement(target)) return;
|
|
23
23
|
var computed = getComputedStyle(target);
|
|
24
24
|
var z0 = zIndex(0);
|
|
25
|
-
if (!z || computed.zIndex < z0) {
|
|
25
|
+
if (!z || +computed.zIndex < z0) {
|
|
26
26
|
z = zIndex();
|
|
27
27
|
if (/^(absolute|fixed)$/i.test(computed.position)) {
|
|
28
28
|
css(target, { zIndex: z });
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
+
else if (z < +computed.zIndex) {
|
|
32
|
+
z = +computed.zIndex;
|
|
33
|
+
}
|
|
31
34
|
};
|
|
32
35
|
function drag(target, initialEvent, preventOverflow, isMovingSource) {
|
|
33
36
|
if (/^(?:select|input|textarea)$/i.test(initialEvent.target.tagName)) return;
|
|
@@ -39,7 +42,6 @@ function drag(target, initialEvent, preventOverflow, isMovingSource) {
|
|
|
39
42
|
} else {
|
|
40
43
|
var extraTargets = target.with ? [].concat(target.with) : [];
|
|
41
44
|
}
|
|
42
|
-
|
|
43
45
|
var target_offset = getOffset(target);
|
|
44
46
|
var saved_delta = { x: target_offset[0] - initialEvent.screenX, y: target_offset[1] - initialEvent.screenY };
|
|
45
47
|
var clone;
|
|
@@ -47,8 +47,8 @@ var getGenerator = function (container, tagName = 'item') {
|
|
|
47
47
|
[itemName || '$item']: com,
|
|
48
48
|
[indexName || '$index']: index
|
|
49
49
|
};
|
|
50
|
-
var newItem = render(element, newScope, scopes);
|
|
51
|
-
if (element.with) newItem.with = render(element.with, newScope, scopes);
|
|
50
|
+
var newItem = render(element, newScope, scopes, false);
|
|
51
|
+
if (element.with) newItem.with = render(element.with, newScope, scopes, false);
|
|
52
52
|
} else {
|
|
53
53
|
var newScope = container.src[index];
|
|
54
54
|
if (!isObject(newScope)) newScope = {
|
|
@@ -68,8 +68,8 @@ var getGenerator = function (container, tagName = 'item') {
|
|
|
68
68
|
return this.$item;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
var newItem = render(element, newScope, scopes);
|
|
72
|
-
if (element.with) newItem.with = render(newItem.with = element.with, newScope, scopes);
|
|
71
|
+
var newItem = render(element, newScope, scopes, false);
|
|
72
|
+
if (element.with) newItem.with = render(newItem.with = element.with, newScope, scopes, false);
|
|
73
73
|
}
|
|
74
74
|
return newItem;
|
|
75
75
|
};
|
|
@@ -5,8 +5,10 @@ function getTreeFromData(array) {
|
|
|
5
5
|
root.count = 0;
|
|
6
6
|
var map = {};
|
|
7
7
|
array = array.filter(a => !!a);
|
|
8
|
+
var active_item = null;
|
|
8
9
|
array.forEach(function (data) {
|
|
9
10
|
var item = new Item(data);
|
|
11
|
+
if (!active_item && item.isActived()) active_item = item;
|
|
10
12
|
if (data.id) {
|
|
11
13
|
map[data.id] = item;
|
|
12
14
|
} else {
|
|
@@ -46,5 +48,6 @@ function getTreeFromData(array) {
|
|
|
46
48
|
return item.count = count;
|
|
47
49
|
};
|
|
48
50
|
run(root);
|
|
51
|
+
root.actived = active_item;
|
|
49
52
|
return root;
|
|
50
53
|
}
|
package/coms/zimoli/getValue.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var hasOwnProperty = {}.hasOwnProperty;
|
|
2
2
|
function getValue(o = this) {
|
|
3
|
-
if (!o) return o;
|
|
3
|
+
if (!isObject(o) && !isFunction(o)) return o;
|
|
4
4
|
if (isFunction(o.getValue)) return o.getValue();
|
|
5
5
|
if (hasOwnProperty.call(o, 'valueOf')) return o.valueOf();
|
|
6
6
|
if ("key" in o) return o.key;
|
package/coms/zimoli/list.js
CHANGED
|
@@ -381,7 +381,7 @@ function ylist(container, generator, $Y) {
|
|
|
381
381
|
}
|
|
382
382
|
if (deltay < 1) y = target_y;
|
|
383
383
|
else if (deltay > count || deltay > 3) {
|
|
384
|
-
y = last_y + (target_y > last_y ? .8 : -.8);
|
|
384
|
+
y = last_y + Math.max(2 * (target_y > last_y ? .8 : -.8));
|
|
385
385
|
}
|
|
386
386
|
else {
|
|
387
387
|
y = (target_y + last_y) / 2;
|
package/coms/zimoli/menu.js
CHANGED
|
@@ -90,6 +90,31 @@ var getTreeNodes = function (elem) {
|
|
|
90
90
|
[].forEach.call(elem.children, run);
|
|
91
91
|
return nodes;
|
|
92
92
|
};
|
|
93
|
+
function createItemTarget(item) {
|
|
94
|
+
var $scope = {};
|
|
95
|
+
var { itemName } = this.$src;
|
|
96
|
+
if (itemName) $scope[itemName] = item;
|
|
97
|
+
else $scope.menu = item, $scope.$item = item;
|
|
98
|
+
return { $scope };
|
|
99
|
+
}
|
|
100
|
+
var emitEvent = function (item, event) {
|
|
101
|
+
event.preventDefault(true);
|
|
102
|
+
if (item.disabled) return;
|
|
103
|
+
active(this, item, item, createItemTarget.call(this, item));
|
|
104
|
+
}
|
|
105
|
+
function bindGlobalkey(elem, keymap, emit) {
|
|
106
|
+
if (elem.keymap) {
|
|
107
|
+
for (var off of elem.keyoff) {
|
|
108
|
+
off();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (!keymap) return;
|
|
112
|
+
var keyoff = [];
|
|
113
|
+
for (let k in keymap) {
|
|
114
|
+
keyoff.push(bind("keydown." + k)(elem, emitEvent.bind(elem, keymap[k])));
|
|
115
|
+
}
|
|
116
|
+
elem.keyoff = keyoff;
|
|
117
|
+
}
|
|
93
118
|
|
|
94
119
|
function main(elem, mode) {
|
|
95
120
|
if (isElement(elem)) {
|
|
@@ -176,16 +201,24 @@ function main(elem, mode) {
|
|
|
176
201
|
case "y":
|
|
177
202
|
case "vertical":
|
|
178
203
|
if (!direction) mode = "vertical", direction = 'y';
|
|
179
|
-
var emit = function (item
|
|
180
|
-
active(elem, item.value, item,
|
|
204
|
+
var emit = function (item) {
|
|
205
|
+
active(elem, item.value, item, createItemTarget.call(elem, item.value));
|
|
181
206
|
};
|
|
182
207
|
if ("$src" in elem) {
|
|
183
208
|
getGenerator(elem, 'menu-item');
|
|
184
209
|
var src0 = [];
|
|
185
210
|
menuList(elem, src0, emit, direction);
|
|
186
211
|
care(elem, function (src) {
|
|
212
|
+
bindGlobalkey(elem, src.keymap, emit);
|
|
187
213
|
src0.splice(0, src0.length);
|
|
188
214
|
var s = getTreeFromData(src);
|
|
215
|
+
if (s.actived) {
|
|
216
|
+
elem.selected = s.actived;
|
|
217
|
+
}
|
|
218
|
+
else if (direction === 't') {
|
|
219
|
+
elem.selected = s[0];
|
|
220
|
+
if (elem.selected) elem.selected.setActive(true);
|
|
221
|
+
}
|
|
189
222
|
var i = 0;
|
|
190
223
|
while (i < s.length) {
|
|
191
224
|
src0.push.apply(src0, s.slice(i, i += 1000));
|
|
@@ -208,6 +241,7 @@ function main(elem, mode) {
|
|
|
208
241
|
}
|
|
209
242
|
if (!elem.hasAttribute('mode')) elem.setAttribute('mode', mode);
|
|
210
243
|
if (!elem.hasAttribute(mode)) elem.setAttribute(mode, '');
|
|
244
|
+
|
|
211
245
|
return elem;
|
|
212
246
|
|
|
213
247
|
}
|
package/coms/zimoli/menuItem.js
CHANGED
|
@@ -4,14 +4,21 @@ function main(elem, scope, hasIcon) {
|
|
|
4
4
|
item.innerHTML = menuItem;
|
|
5
5
|
if (isObject(scope) && scope !== item.$scope) {
|
|
6
6
|
}
|
|
7
|
-
else {
|
|
7
|
+
else if (item.$scope) {
|
|
8
8
|
var scope = item.$scope;
|
|
9
9
|
}
|
|
10
10
|
if (scope.menu) scope = scope.menu;
|
|
11
11
|
var name = scope.name;
|
|
12
12
|
var icon = scope.icon;
|
|
13
13
|
if (hasIcon === undefined) hasIcon = !!icon;
|
|
14
|
-
|
|
14
|
+
if (scope.disabled || scope.enabled === false) {
|
|
15
|
+
item.setAttribute('disabled', '');
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
item.removeAttribute("disabled");
|
|
19
|
+
}
|
|
20
|
+
render(item.children, scope, hasIcon instanceof Array ? hasIcon : [{ useIcon: hasIcon, hasIcon, name, icon }], false);
|
|
15
21
|
if (scope.line) item.setAttribute("line", ''), on("click")(item, preventDefault);
|
|
22
|
+
if (scope.hotkey) bindAccesskey(item, scope.hotkey);
|
|
16
23
|
return item;
|
|
17
24
|
}
|
|
@@ -1,15 +1,36 @@
|
|
|
1
|
-
i{
|
|
1
|
+
i {
|
|
2
2
|
display: inline-block;
|
|
3
3
|
width: 1em;
|
|
4
4
|
}
|
|
5
|
+
|
|
6
|
+
.hotkey {
|
|
7
|
+
margin-left: 12px;
|
|
8
|
+
font-size: 12px;
|
|
9
|
+
float: right;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&[disabled] {
|
|
13
|
+
background: #0000;
|
|
14
|
+
|
|
15
|
+
&>.track {
|
|
16
|
+
opacity: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
border-radius: 0;
|
|
20
|
+
color: #999;
|
|
21
|
+
}
|
|
22
|
+
|
|
5
23
|
&.line,
|
|
6
24
|
&[line] {
|
|
7
25
|
box-shadow: none;
|
|
8
|
-
|
|
26
|
+
|
|
27
|
+
>.track {
|
|
9
28
|
display: none;
|
|
10
29
|
}
|
|
30
|
+
|
|
11
31
|
line-height: 0;
|
|
12
32
|
font-size: 0;
|
|
33
|
+
|
|
13
34
|
&:after {
|
|
14
35
|
content: "";
|
|
15
36
|
display: block;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<menu-item ng-repeat="menu in menus" ng-if="!menu.hidden" ng-click="open.call(this)" ng-mouseleave="cancel()"
|
|
2
2
|
ng-mouseenter="popMenu.call(this)" ng-mousedown="popMenu1.call(this,event)" ng-class="{'has-children':menu.children&&menu.children.length,
|
|
3
3
|
'warn':menu.type==='danger'||menu.type==='warn'||menu.type==='red',
|
|
4
|
-
'
|
|
4
|
+
'actived':menu.isActived()
|
|
5
5
|
}">
|
|
6
6
|
</menu-item>
|
package/coms/zimoli/menuList.js
CHANGED
|
@@ -14,6 +14,7 @@ var unfocus = function () {
|
|
|
14
14
|
this.setFocus(null);
|
|
15
15
|
};
|
|
16
16
|
var setFocus = function (focused) {
|
|
17
|
+
if (focused && focused.hasAttribute("disabled")) return;
|
|
17
18
|
var page = this;
|
|
18
19
|
if (focused) {
|
|
19
20
|
if (page.focused !== focused) {
|
|
@@ -40,16 +41,17 @@ var moveFocus = function (delta) {
|
|
|
40
41
|
else {
|
|
41
42
|
var newIndex = focused.index + delta;
|
|
42
43
|
var total = page.total;
|
|
43
|
-
if (page !== root_menu) {
|
|
44
|
-
total++;
|
|
45
|
-
}
|
|
46
44
|
if (newIndex < 0) newIndex = total + newIndex;
|
|
47
45
|
if (newIndex > total - 1) newIndex = newIndex - total;
|
|
48
46
|
}
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
do {
|
|
48
|
+
var e = page.getIndexedElement(newIndex);
|
|
49
|
+
if (newIndex < 0) newIndex = total + newIndex;
|
|
50
|
+
newIndex += delta;
|
|
51
|
+
} while (e && (e.hasAttribute("disabled") || e.hasAttribute("line")));
|
|
51
52
|
if (!e) page.setFocus(null);
|
|
52
|
-
else page.open(e);
|
|
53
|
+
else if (page.ispop !== true) page.setFocus(e), page.open(e);
|
|
54
|
+
else page.setFocus(e);
|
|
53
55
|
};
|
|
54
56
|
var openFocus = function () {
|
|
55
57
|
var menu = mounted_menus[mounted_menus.length - 1] || root_menu;
|
|
@@ -68,15 +70,20 @@ var keyAction = function (deltax, deltay) {
|
|
|
68
70
|
|
|
69
71
|
if (menu.direction === 'y') {
|
|
70
72
|
if (deltax === 1) {
|
|
71
|
-
|
|
73
|
+
// right
|
|
74
|
+
if (menu.focused) var fmenu = menu.focused.menu;
|
|
75
|
+
if (fmenu && fmenu.children && fmenu.children.length) {
|
|
76
|
+
openFocus();
|
|
77
|
+
}
|
|
72
78
|
else if (parent && parent.direction !== 'y') {
|
|
73
79
|
parent.moveFocus(deltax);
|
|
74
80
|
}
|
|
75
81
|
}
|
|
76
82
|
else if (deltax === -1) {
|
|
83
|
+
// left
|
|
77
84
|
if (parent) {
|
|
78
85
|
if (parent.direction === 'y') remove(mounted_menus.pop());
|
|
79
|
-
else
|
|
86
|
+
else parent.moveFocus(deltax);
|
|
80
87
|
}
|
|
81
88
|
}
|
|
82
89
|
else {
|
|
@@ -85,15 +92,18 @@ var keyAction = function (deltax, deltay) {
|
|
|
85
92
|
}
|
|
86
93
|
else {
|
|
87
94
|
if (deltay === 1) {
|
|
88
|
-
|
|
95
|
+
// down
|
|
96
|
+
if (menu.focused) var fmenu = menu.focused.menu;
|
|
97
|
+
if (fmenu && fmenu.children && fmenu.children.length) openFocus();
|
|
89
98
|
else if (parent && parent.direction === 'y') {
|
|
90
99
|
parent.moveFocus(deltay);
|
|
91
100
|
}
|
|
92
101
|
}
|
|
93
102
|
else if (deltay === -1) {
|
|
103
|
+
// up
|
|
94
104
|
if (parent) {
|
|
95
105
|
if (parent.direction !== 'y') remove(mounted_menus.pop());
|
|
96
|
-
else
|
|
106
|
+
else parent.moveFocus(deltay);
|
|
97
107
|
}
|
|
98
108
|
}
|
|
99
109
|
else {
|
|
@@ -156,18 +166,19 @@ function register() {
|
|
|
156
166
|
}
|
|
157
167
|
function main(page, items, active, direction = 'y') {
|
|
158
168
|
if (!isNode(page)) {
|
|
159
|
-
var page =
|
|
169
|
+
var page = document.createElement("menu-list");
|
|
160
170
|
}
|
|
161
171
|
var main = this;
|
|
162
172
|
if (direction == 'y') page.ispop = true;
|
|
163
173
|
var istoolbar = direction === 't';
|
|
164
|
-
function popMenu(item, target) {
|
|
174
|
+
function popMenu(item, target, emptyFocus) {
|
|
165
175
|
if (page.actived) {
|
|
166
176
|
clear();
|
|
167
177
|
remove(page.actived);
|
|
168
178
|
}
|
|
179
|
+
if (emptyFocus !== false) page.setFocus(target);
|
|
180
|
+
if (!item.length) return;
|
|
169
181
|
page.setFocus(target);
|
|
170
|
-
if (!item.children || !item.children.length) return;
|
|
171
182
|
var clone = template.cloneNode();
|
|
172
183
|
clone.$parentScopes = page.$parentScopes;
|
|
173
184
|
clone.$scope = page.$scope;
|
|
@@ -179,10 +190,6 @@ function main(page, items, active, direction = 'y') {
|
|
|
179
190
|
menu.root = page.root || page;
|
|
180
191
|
popup(menu, target);
|
|
181
192
|
if (page.ispop === true) {
|
|
182
|
-
var offleave0 = on("mouseleave")(target, release);
|
|
183
|
-
var offleave1 = on("mouseleave")(menu, release);
|
|
184
|
-
var offenter0 = on("mouseenter")(target, clear);
|
|
185
|
-
var offenter1 = on("mouseenter")(menu, clear);
|
|
186
193
|
} else {
|
|
187
194
|
page.ispop = 1;
|
|
188
195
|
page.tabIndex = 0;
|
|
@@ -191,10 +198,6 @@ function main(page, items, active, direction = 'y') {
|
|
|
191
198
|
on("mousedown")(menu, e => e.preventDefault());
|
|
192
199
|
once("remove")(menu, function () {
|
|
193
200
|
removeFromList(mounted_menus, this);
|
|
194
|
-
if (offleave0) offleave0();
|
|
195
|
-
if (offleave1) offleave1();
|
|
196
|
-
if (offenter0) offenter0();
|
|
197
|
-
if (offenter1) offenter1();
|
|
198
201
|
});
|
|
199
202
|
}
|
|
200
203
|
on("blur")(page, unfocus);
|
|
@@ -220,27 +223,30 @@ function main(page, items, active, direction = 'y') {
|
|
|
220
223
|
}, time || 60);
|
|
221
224
|
};
|
|
222
225
|
var cancel = function () {
|
|
226
|
+
clear();
|
|
223
227
|
clearTimeout(popTimer);
|
|
224
228
|
}
|
|
225
229
|
var fire = function () {
|
|
226
230
|
cancel();
|
|
227
231
|
if (this.menu.line) return;
|
|
228
232
|
if (byMousedown) return;
|
|
233
|
+
if (this.hasAttribute("disabled") || this.hasAttribute('line')) return;
|
|
229
234
|
var pop = active(this.menu, this);
|
|
230
235
|
if (pop === false) return;
|
|
231
236
|
var root = page.root || page;
|
|
232
|
-
if (root.direction === 't') {
|
|
237
|
+
if (root.direction === 't' || root.selected) {
|
|
233
238
|
var menu = this.menu;
|
|
239
|
+
if (root.selected) root.selected.setActive(false);
|
|
234
240
|
if (root !== page) {
|
|
235
|
-
delete menu.children;
|
|
236
241
|
var target = root.actived.target;
|
|
237
|
-
|
|
242
|
+
if (isObject(menu.value)) delete menu.value.children;
|
|
243
|
+
target.menu.extends(menu.value);
|
|
244
|
+
menu = target.menu;
|
|
238
245
|
}
|
|
239
246
|
else {
|
|
240
247
|
target = this;
|
|
241
248
|
}
|
|
242
|
-
|
|
243
|
-
menu.selected = true;
|
|
249
|
+
menu.setActive(true);
|
|
244
250
|
root.selected = target.menu;
|
|
245
251
|
}
|
|
246
252
|
if (root.ispop === 1) root.ispop = false;
|
|
@@ -248,7 +254,7 @@ function main(page, items, active, direction = 'y') {
|
|
|
248
254
|
while (mounted_menus.length && mounted_menus[mounted_menus.length - 1] !== page.actived) remove(mounted_menus.pop());
|
|
249
255
|
if (!mounted_menus.length) {
|
|
250
256
|
if (byMousedown === false) return;
|
|
251
|
-
popMenu(this.menu, this);
|
|
257
|
+
popMenu(this.menu, this, false);
|
|
252
258
|
}
|
|
253
259
|
else {
|
|
254
260
|
remove(mounted_menus.pop());
|
|
@@ -257,7 +263,7 @@ function main(page, items, active, direction = 'y') {
|
|
|
257
263
|
else {
|
|
258
264
|
while (mounted_menus.length && mounted_menus[mounted_menus.length - 1] !== page) remove(mounted_menus.pop());
|
|
259
265
|
if (byMousedown === false) return;
|
|
260
|
-
popMenu(this.menu, this);
|
|
266
|
+
popMenu(this.menu, this, false);
|
|
261
267
|
if (!page.actived) {
|
|
262
268
|
(page.root || page).blur();
|
|
263
269
|
}
|
|
@@ -281,10 +287,11 @@ function main(page, items, active, direction = 'y') {
|
|
|
281
287
|
var $scope = {
|
|
282
288
|
"menu-item"(e, s) {
|
|
283
289
|
var a = button(
|
|
284
|
-
menuItem(e, s, this.hasIcon)
|
|
290
|
+
menuItem(e, s.value, this.hasIcon)
|
|
285
291
|
);
|
|
286
292
|
if (!page.firstMenu) {
|
|
287
293
|
page.firstMenu = a;
|
|
294
|
+
page.total = items.length;
|
|
288
295
|
}
|
|
289
296
|
a.menu = s.menu;
|
|
290
297
|
return a;
|
|
@@ -301,14 +308,13 @@ function main(page, items, active, direction = 'y') {
|
|
|
301
308
|
var itemName = src.itemName;
|
|
302
309
|
var className = `{'has-children':${itemName}.children&&${itemName}.children.length,
|
|
303
310
|
'warn':${itemName}.type==='danger'||${itemName}.type==='warn'||${itemName}.type==='red',
|
|
304
|
-
|
|
311
|
+
actived:${itemName}.isActived()
|
|
305
312
|
}`;
|
|
306
313
|
var notHidden = `!${itemName}.hidden`;
|
|
307
314
|
var generator = getGenerator(page, 'menu-item');
|
|
308
315
|
list(page, function (index) {
|
|
309
316
|
var item = items[index];
|
|
310
317
|
if (!item) return;
|
|
311
|
-
if (item instanceof Item) item = item.value;
|
|
312
318
|
var a = $scope["menu-item"](null, item);
|
|
313
319
|
if (src.itemName) a.setAttribute("e-if", notHidden);
|
|
314
320
|
a.setAttribute("e-class", className);
|
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 {
|