efront 3.11.0 → 3.11.4
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/kugou/api.js +10 -7
- package/coms/basic/parseYML.js +1 -1
- package/coms/frame/route.js +28 -3
- package/coms/kugou/parseSongsList.js +24 -10
- package/coms/zimoli/Item.js +1 -0
- package/coms/zimoli/bindAccesskey.js +47 -0
- package/coms/zimoli/button.js +0 -33
- package/coms/zimoli/button.less +3 -2
- package/coms/zimoli/getGenerator.js +20 -17
- package/coms/zimoli/menu.js +5 -2
- package/coms/zimoli/menu.less +49 -80
- package/coms/zimoli/menuItem.js +2 -0
- package/coms/zimoli/menuItem.less +16 -0
- package/coms/zimoli/menuList.html +2 -2
- package/coms/zimoli/menuList.js +229 -65
- package/coms/zimoli/menuList.less +12 -3
- package/coms/zimoli/on.js +14 -3
- package/coms/zimoli/render.js +14 -12
- package/coms/zimoli/tree.js +7 -5
- package/coms/zimoli/tree.less +14 -1
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/coms/zimoli/menuList.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var mounted_menus = [], releaseTimer = 0;
|
|
1
|
+
var mounted_menus = [], releaseTimer = 0, root_menu;
|
|
2
2
|
var release = function () {
|
|
3
3
|
clear();
|
|
4
4
|
releaseTimer = setTimeout(function () {
|
|
@@ -11,7 +11,149 @@ var clear = function () {
|
|
|
11
11
|
var unfocus = function () {
|
|
12
12
|
remove(mounted_menus);
|
|
13
13
|
this.ispop = false;
|
|
14
|
+
this.setFocus(null);
|
|
14
15
|
};
|
|
16
|
+
var setFocus = function (focused) {
|
|
17
|
+
var page = this;
|
|
18
|
+
if (focused) {
|
|
19
|
+
if (page.focused !== focused) {
|
|
20
|
+
if (page.focused) removeClass(page.focused, 'focus');
|
|
21
|
+
if (focused) addClass(focused, "focus");
|
|
22
|
+
page.focused = focused;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
if (page.focused) {
|
|
27
|
+
removeClass(page.focused, 'focus');
|
|
28
|
+
page.focused = null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var moveFocus = function (delta) {
|
|
33
|
+
var page = this;
|
|
34
|
+
var focused = page.focused;
|
|
35
|
+
var newIndex = 0;
|
|
36
|
+
if (!focused) {
|
|
37
|
+
if (delta > 0) newIndex = 0;
|
|
38
|
+
else newIndex = page.total - 1;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
var newIndex = focused.index + delta;
|
|
42
|
+
var total = page.total;
|
|
43
|
+
if (page !== root_menu) {
|
|
44
|
+
total++;
|
|
45
|
+
}
|
|
46
|
+
if (newIndex < 0) newIndex = total + newIndex;
|
|
47
|
+
if (newIndex > total - 1) newIndex = newIndex - total;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
var e = page.getIndexedElement(newIndex);
|
|
51
|
+
if (!e) page.setFocus(null);
|
|
52
|
+
else page.open(e);
|
|
53
|
+
};
|
|
54
|
+
var openFocus = function () {
|
|
55
|
+
var menu = mounted_menus[mounted_menus.length - 1] || root_menu;
|
|
56
|
+
if (!menu.ispop) menu.ispop = 1;
|
|
57
|
+
menu.open(menu.focused);
|
|
58
|
+
};
|
|
59
|
+
var closeFocus = function () {
|
|
60
|
+
var menu = mounted_menus[mounted_menus.length - 1];
|
|
61
|
+
remove(menu);
|
|
62
|
+
};
|
|
63
|
+
var keyAction = function (deltax, deltay) {
|
|
64
|
+
if (root_menu !== document.activeElement) return;
|
|
65
|
+
var menu = mounted_menus[mounted_menus.length - 1];
|
|
66
|
+
if (menu) var parent = mounted_menus[mounted_menus.length - 2] || root_menu;
|
|
67
|
+
else menu = root_menu;
|
|
68
|
+
|
|
69
|
+
if (menu.direction === 'y') {
|
|
70
|
+
if (deltax === 1) {
|
|
71
|
+
if (menu.focused) openFocus();
|
|
72
|
+
else if (parent && parent.direction !== 'y') {
|
|
73
|
+
parent.moveFocus(deltax);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else if (deltax === -1) {
|
|
77
|
+
if (parent) {
|
|
78
|
+
if (parent.direction === 'y') remove(mounted_menus.pop());
|
|
79
|
+
else if (!menu.focused) parent.moveFocus(deltax);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
menu.moveFocus(deltay);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
if (deltay === 1) {
|
|
88
|
+
if (menu.focused) openFocus();
|
|
89
|
+
else if (parent && parent.direction === 'y') {
|
|
90
|
+
parent.moveFocus(deltay);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else if (deltay === -1) {
|
|
94
|
+
if (parent) {
|
|
95
|
+
if (parent.direction !== 'y') remove(mounted_menus.pop());
|
|
96
|
+
else if (!menu.focused) parent.moveFocus(deltay);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
menu.moveFocus(deltax);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
function keyalt() {
|
|
105
|
+
if (root_menu === document.activeElement) root_menu.blur();
|
|
106
|
+
else {
|
|
107
|
+
root_menu.tabIndex = 0;
|
|
108
|
+
root_menu.focus();
|
|
109
|
+
root_menu.setFocus(this.firstMenu);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function keytab(event) {
|
|
113
|
+
if (root_menu !== document.activeElement) return;
|
|
114
|
+
var menu = mounted_menus[mounted_menus.length - 1] || root_menu;
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
menu.moveFocus(1);
|
|
117
|
+
}
|
|
118
|
+
function keyesc() {
|
|
119
|
+
if (root_menu === document.activeElement && !mounted_menus.length) {
|
|
120
|
+
if (!root_menu.ispop) root_menu.blur();
|
|
121
|
+
else root_menu.ispop = false;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function keyup() {
|
|
125
|
+
keyAction(0, -1);
|
|
126
|
+
}
|
|
127
|
+
function keydown() {
|
|
128
|
+
keyAction(0, 1);
|
|
129
|
+
}
|
|
130
|
+
function keyleft() {
|
|
131
|
+
keyAction(-1, 0)
|
|
132
|
+
}
|
|
133
|
+
function keyright() {
|
|
134
|
+
keyAction(1, 0);
|
|
135
|
+
}
|
|
136
|
+
function keyspace() {
|
|
137
|
+
if (root_menu !== document.activeElement) return;
|
|
138
|
+
var menu = mounted_menus[mounted_menus.length - 1];
|
|
139
|
+
if (!menu || !menu.focused) menu = mounted_menus[mounted_menus.length - 2] || root_menu;
|
|
140
|
+
if (menu.focused) {
|
|
141
|
+
menu.focused.click();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function register() {
|
|
145
|
+
// on('keydown.alt')(window, e => e.preventDefault());
|
|
146
|
+
on('keydown.tab')(window, keytab);
|
|
147
|
+
on('keydown.alt.')(window, keyalt);
|
|
148
|
+
on('keydown.esc')(window, keyesc);
|
|
149
|
+
on('keydown.left')(window, keyleft);
|
|
150
|
+
on('keydown.right')(window, keyright);
|
|
151
|
+
on('keydown.up')(window, keyup);
|
|
152
|
+
on('keydown.down')(window, keydown);
|
|
153
|
+
on('keydown.enter')(window, keyspace);
|
|
154
|
+
on('keydown.space')(window, keyspace);
|
|
155
|
+
root_menu = this;
|
|
156
|
+
}
|
|
15
157
|
function main(page, items, active, direction = 'y') {
|
|
16
158
|
if (!isNode(page)) {
|
|
17
159
|
var page = div();
|
|
@@ -19,18 +161,20 @@ function main(page, items, active, direction = 'y') {
|
|
|
19
161
|
var main = this;
|
|
20
162
|
if (direction !== 'x') page.ispop = true;
|
|
21
163
|
function popMenu(item, target) {
|
|
22
|
-
if (page.
|
|
164
|
+
if (page.actived) {
|
|
23
165
|
clear();
|
|
24
|
-
remove(page.
|
|
166
|
+
remove(page.actived);
|
|
25
167
|
}
|
|
168
|
+
page.setFocus(target);
|
|
26
169
|
if (!item.children || !item.children.length) return;
|
|
27
170
|
var clone = template.cloneNode();
|
|
28
171
|
clone.$parentScopes = page.$parentScopes;
|
|
172
|
+
clone.$scope = page.$scope;
|
|
29
173
|
clone.$src = src;
|
|
30
174
|
clone.innerHTML = template.innerHTML;
|
|
31
175
|
var menu = main(clone, item.children, active);
|
|
32
176
|
mounted_menus.push(menu);
|
|
33
|
-
page.
|
|
177
|
+
page.actived = menu;
|
|
34
178
|
menu.root = page.root || page;
|
|
35
179
|
popup(menu, target);
|
|
36
180
|
if (page.ispop === true) {
|
|
@@ -60,6 +204,44 @@ function main(page, items, active, direction = 'y') {
|
|
|
60
204
|
template.innerHTML = page.innerHTML;
|
|
61
205
|
page.tempalte = template;
|
|
62
206
|
}
|
|
207
|
+
var popTimer = 0;
|
|
208
|
+
var open = function () {
|
|
209
|
+
cancel();
|
|
210
|
+
var elem = this;
|
|
211
|
+
page.setFocus(elem);
|
|
212
|
+
if (page.ispop) popTimer = setTimeout(function () {
|
|
213
|
+
popMenu(elem.menu, elem);
|
|
214
|
+
}, 60);
|
|
215
|
+
};
|
|
216
|
+
var cancel = function () {
|
|
217
|
+
clearTimeout(popTimer);
|
|
218
|
+
}
|
|
219
|
+
var fire = function () {
|
|
220
|
+
cancel();
|
|
221
|
+
if (this.menu.line) return;
|
|
222
|
+
var pop = active(this.menu, this);
|
|
223
|
+
if (pop === false) return;
|
|
224
|
+
var root = page.root || page;
|
|
225
|
+
if (root.ispop === 1) root.ispop = false;
|
|
226
|
+
if (page.actived && page.actived.target === this) {
|
|
227
|
+
while (mounted_menus.length && mounted_menus[mounted_menus.length - 1] !== page.actived) remove(mounted_menus.pop());
|
|
228
|
+
if (!mounted_menus.length) {
|
|
229
|
+
popMenu(this.menu, this);
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
remove(mounted_menus.pop());
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
while (mounted_menus.length && mounted_menus[mounted_menus.length - 1] !== page) remove(mounted_menus.pop());
|
|
237
|
+
popMenu(this.menu, this);
|
|
238
|
+
if (!page.actived) {
|
|
239
|
+
(page.root || page).blur();
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
|
|
63
245
|
if (!page.children.length || page.menutype === 1) {
|
|
64
246
|
page.menutype = 1;
|
|
65
247
|
var hasIcon = function () {
|
|
@@ -72,66 +254,40 @@ function main(page, items, active, direction = 'y') {
|
|
|
72
254
|
return false;
|
|
73
255
|
};
|
|
74
256
|
var $scope = {
|
|
75
|
-
"menu-item"
|
|
76
|
-
|
|
77
|
-
menuItem(e, s)
|
|
257
|
+
"menu-item"(e, s) {
|
|
258
|
+
var a = button(
|
|
259
|
+
menuItem(e, s, this.hasIcon)
|
|
78
260
|
);
|
|
261
|
+
if (!page.firstMenu) {
|
|
262
|
+
page.firstMenu = a;
|
|
263
|
+
}
|
|
264
|
+
return a;
|
|
79
265
|
},
|
|
80
266
|
menus: items,
|
|
81
267
|
hasIcon: hasIcon(),
|
|
82
|
-
open
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
var root = page.root || page;
|
|
86
|
-
if (root.ispop === 1) root.ispop = false;
|
|
87
|
-
if (!mounted_menus.length) {
|
|
88
|
-
popMenu.apply(this, arguments);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
unfocus.call(page);
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
popTimer: 0,
|
|
95
|
-
popMenu() {
|
|
96
|
-
if (!page.ispop) return;
|
|
97
|
-
var args = arguments;
|
|
98
|
-
return setTimeout(function () {
|
|
99
|
-
popMenu.apply(null, args);
|
|
100
|
-
}, 60);
|
|
101
|
-
},
|
|
268
|
+
open: fire,
|
|
269
|
+
cancel,
|
|
270
|
+
popMenu: open,
|
|
102
271
|
};
|
|
103
272
|
if (page.$src) {
|
|
104
273
|
var src = page.$src;
|
|
105
|
-
var parentScopes = page.$parentScopes;
|
|
106
274
|
var itemName = src.itemName;
|
|
107
275
|
var className = `{'has-children':${itemName}.children&&${itemName}.children.length,'warn':${itemName}.type==='danger'||${itemName}.type==='warn'||${itemName}.type==='red'}`;
|
|
108
276
|
var notHidden = `!${itemName}.hidden`;
|
|
277
|
+
var generator = getGenerator(page, 'menu-item');
|
|
278
|
+
|
|
109
279
|
list(page, function (index) {
|
|
110
280
|
var item = items[index];
|
|
111
281
|
if (!item) return;
|
|
112
|
-
var a = menuItem(null, item, $scope.hasIcon);
|
|
113
|
-
var scope = {};
|
|
114
282
|
if (item instanceof Item) item = item.value;
|
|
115
|
-
|
|
116
|
-
else scope.$item = item;
|
|
117
|
-
if (src.keyName) scope[src.keyName] = index;
|
|
118
|
-
else scope.$key = index;
|
|
119
|
-
if (src.indexName) scope[src.indexName] = index;
|
|
120
|
-
else scope.$index = index;
|
|
121
|
-
if (src.srcName) scope[src.srcName] = items;
|
|
283
|
+
var a = $scope["menu-item"](null, item);
|
|
122
284
|
if (src.itemName) a.setAttribute("e-if", notHidden);
|
|
123
|
-
on("mouseleave")(a, function () {
|
|
124
|
-
clearTimeout($scope.popTimer);
|
|
125
|
-
});
|
|
126
|
-
on("mouseenter")(a, function () {
|
|
127
|
-
$scope.popTimer = $scope.popMenu(item, this);
|
|
128
|
-
});
|
|
129
|
-
on("click")(a, function () {
|
|
130
|
-
$scope.open(items[index], this);
|
|
131
|
-
});
|
|
132
285
|
a.setAttribute("e-class", className);
|
|
133
|
-
a =
|
|
134
|
-
|
|
286
|
+
a = generator(index, item, a);
|
|
287
|
+
a.menu = item;
|
|
288
|
+
on("mouseleave")(a, cancel);
|
|
289
|
+
on("mouseenter")(a, open);
|
|
290
|
+
on("click")(a, fire);
|
|
135
291
|
return a;
|
|
136
292
|
});
|
|
137
293
|
on("append")(page, function () {
|
|
@@ -143,31 +299,39 @@ function main(page, items, active, direction = 'y') {
|
|
|
143
299
|
render(page, $scope);
|
|
144
300
|
vbox(page);
|
|
145
301
|
}
|
|
302
|
+
page.total = items.length;
|
|
146
303
|
page.renders.unshift(function () {
|
|
147
304
|
this.$scope.hasIcon = hasIcon();
|
|
148
305
|
});
|
|
149
|
-
}
|
|
150
|
-
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
var generator = getGenerator(page, 'menu-item');
|
|
309
|
+
|
|
151
310
|
list(page, function (index) {
|
|
152
311
|
var elem = generator(index);
|
|
153
312
|
if (!elem) return;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
if (!mounted_menus.length) {
|
|
163
|
-
popMenu(this.src[index], this);
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
unfocus.call(page);
|
|
167
|
-
}
|
|
168
|
-
});
|
|
313
|
+
if (!page.firstMenu) {
|
|
314
|
+
page.firstMenu = elem;
|
|
315
|
+
page.total = this.src.length;
|
|
316
|
+
}
|
|
317
|
+
elem.menu = this.src[index];
|
|
318
|
+
on("mouseleave")(elem, cancel);
|
|
319
|
+
on("mouseenter")(elem, open);
|
|
320
|
+
on("click")(elem, fire);
|
|
169
321
|
return elem;
|
|
170
322
|
}, direction);
|
|
171
323
|
}
|
|
324
|
+
page.open = function (a) {
|
|
325
|
+
open.call(a);
|
|
326
|
+
};
|
|
327
|
+
page.active = function (a) {
|
|
328
|
+
fire.call(a);
|
|
329
|
+
};
|
|
330
|
+
page.registerAsRoot = register;
|
|
331
|
+
page.setFocus = setFocus;
|
|
332
|
+
page.moveFocus = moveFocus;
|
|
333
|
+
page.openFocus = openFocus;
|
|
334
|
+
page.closeFocus = closeFocus;
|
|
335
|
+
page.direction = direction;
|
|
172
336
|
return page;
|
|
173
337
|
}
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
background-color: #fff;
|
|
6
6
|
box-shadow: 0 0 20px -6px rgba(0, 0, 0, .1);
|
|
7
7
|
border: 1px solid #0003;
|
|
8
|
-
line-height: 28px;
|
|
9
8
|
padding: 6px 0;
|
|
10
9
|
|
|
11
10
|
>menu-item {
|
|
@@ -17,12 +16,22 @@
|
|
|
17
16
|
color: inherit;
|
|
18
17
|
box-shadow: none;
|
|
19
18
|
text-align: inherit;
|
|
20
|
-
|
|
19
|
+
vertical-align: top;
|
|
20
|
+
line-height: 20px;
|
|
21
|
+
padding-top: 4px;
|
|
22
|
+
padding-bottom: 4px;
|
|
23
|
+
|
|
24
|
+
&.warn {
|
|
21
25
|
color: #c28;
|
|
22
26
|
}
|
|
23
27
|
|
|
28
|
+
&.focus {
|
|
29
|
+
color: #29c;
|
|
30
|
+
}
|
|
31
|
+
|
|
24
32
|
&.has-children {
|
|
25
|
-
padding:
|
|
33
|
+
padding-right: 24px;
|
|
34
|
+
padding-left: 16px;
|
|
26
35
|
|
|
27
36
|
&:after {
|
|
28
37
|
content: ">";
|
package/coms/zimoli/on.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var is_addEventListener_enabled = "addEventListener" in window;
|
|
3
3
|
var handlersMap = {};
|
|
4
4
|
var changes_key = 'changes';
|
|
5
|
-
var eventtypereg = /(?:\.once|\.prevent|\.stop|\.capture|\.self|\.passive|\.[a-z0-9]+)
|
|
5
|
+
var eventtypereg = /(?:\.once|\.prevent|\.stop|\.capture|\.self|\.passive|\.[a-z0-9]+)+\.?$/i;
|
|
6
6
|
var keyCodeMap = {
|
|
7
7
|
backspace: 8,
|
|
8
8
|
tab: 9,
|
|
@@ -118,6 +118,9 @@ var parseEventTypes = function (eventtypes) {
|
|
|
118
118
|
case "ctrl":
|
|
119
119
|
keyneed.push(t);
|
|
120
120
|
break;
|
|
121
|
+
case "":
|
|
122
|
+
if (!types.keyCode) types.keyCode = true;
|
|
123
|
+
break;
|
|
121
124
|
default:
|
|
122
125
|
if (isFinite(t)) {
|
|
123
126
|
types.keyCode = +t;
|
|
@@ -133,12 +136,20 @@ var parseEventTypes = function (eventtypes) {
|
|
|
133
136
|
return types;
|
|
134
137
|
}
|
|
135
138
|
function checkKeyNeed(eventtypes, e) {
|
|
139
|
+
var keyneed = eventtypes.keyNeed;
|
|
136
140
|
if (eventtypes.keyNeed) {
|
|
137
|
-
for (var cx = 0, dx =
|
|
138
|
-
var key =
|
|
141
|
+
for (var cx = 0, dx = keyneed.length; cx < dx; cx++) {
|
|
142
|
+
var key = keyneed[cx];
|
|
139
143
|
if (!e[key + "Key"]) return false;
|
|
140
144
|
}
|
|
141
145
|
}
|
|
146
|
+
if (eventtypes.keyCode === true) {
|
|
147
|
+
for (var cx = 0, dx = keyneed.length; cx < dx; cx++) {
|
|
148
|
+
var key = keyneed[cx];
|
|
149
|
+
if (e.keyCode === keyCodeMap[key]) return true;
|
|
150
|
+
}
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
142
153
|
if (eventtypes.keyCode) {
|
|
143
154
|
return e.keyCode === eventtypes.keyCode;
|
|
144
155
|
}
|
package/coms/zimoli/render.js
CHANGED
|
@@ -529,14 +529,14 @@ var binders = {
|
|
|
529
529
|
};
|
|
530
530
|
var createEmiter = function (on) {
|
|
531
531
|
return function (key, search) {
|
|
532
|
-
|
|
533
|
-
|
|
532
|
+
var parsedSrc = this.$src;
|
|
533
|
+
var getter0 = createGetter(search, false), getter1;
|
|
534
|
+
if (parsedSrc) {
|
|
534
535
|
var scopes = this.$parentScopes;
|
|
535
536
|
search = search.slice();
|
|
536
537
|
search[0] += `with(this.$parentScopes[${scopes.length}])`;
|
|
537
|
-
|
|
538
|
+
getter1 = createGetter(search, false);
|
|
538
539
|
}
|
|
539
|
-
var getter = createGetter(search, false);
|
|
540
540
|
on(key)(this, function (e) {
|
|
541
541
|
if (parsedSrc) {
|
|
542
542
|
var target = e.currentTarget || e.target;
|
|
@@ -556,12 +556,14 @@ var createEmiter = function (on) {
|
|
|
556
556
|
var res;
|
|
557
557
|
if (scope) {
|
|
558
558
|
var temp = this.$scope;
|
|
559
|
+
this.$parentScopes.push(temp);
|
|
559
560
|
this.$scope = scope;
|
|
560
|
-
res =
|
|
561
|
+
res = getter1.call(this, e);
|
|
562
|
+
this.$parentScopes.pop();
|
|
561
563
|
this.$scope = temp;
|
|
562
564
|
}
|
|
563
565
|
else {
|
|
564
|
-
res =
|
|
566
|
+
res = getter0.call(this, e);
|
|
565
567
|
}
|
|
566
568
|
if (res && isFunction(res.then)) res.then(digest, digest);
|
|
567
569
|
digest();
|
|
@@ -581,7 +583,7 @@ function getFromScopes(key, scope, parentScopes) {
|
|
|
581
583
|
}
|
|
582
584
|
if (parentScopes) for (var cx = parentScopes.length - 1; cx >= 0; cx--) {
|
|
583
585
|
var o = parentScopes[cx];
|
|
584
|
-
if (key in o) {
|
|
586
|
+
if (o && key in o) {
|
|
585
587
|
return o[key];
|
|
586
588
|
}
|
|
587
589
|
}
|
|
@@ -614,13 +616,13 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
|
|
|
614
616
|
return element;
|
|
615
617
|
}
|
|
616
618
|
var isFirstRender = !element.renderid;
|
|
617
|
-
element.renderid = 1;
|
|
618
|
-
var parentNode = element.parentNode;
|
|
619
|
-
if (parentNode) {
|
|
620
|
-
if (parentNode.renderid > 1 || parentNode.isMounted) element.renderid = 2;
|
|
621
|
-
}
|
|
622
619
|
|
|
623
620
|
if (isFirstRender) {
|
|
621
|
+
element.renderid = 1;
|
|
622
|
+
var parentNode = element.parentNode;
|
|
623
|
+
if (parentNode) {
|
|
624
|
+
if (parentNode.renderid > 1 || parentNode.isMounted) element.renderid = 2;
|
|
625
|
+
}
|
|
624
626
|
element.renders = element.renders ? [].concat(element.renders) : [];
|
|
625
627
|
var { ons, copys, attrs, props, binds, context: withContext } = element.$struct;
|
|
626
628
|
delete element.$struct;
|
package/coms/zimoli/tree.js
CHANGED
|
@@ -132,16 +132,18 @@ function tree() {
|
|
|
132
132
|
}
|
|
133
133
|
var tabs = new Array(com.tab + 1).join("<t></t>");
|
|
134
134
|
if (isFunction(generator)) {
|
|
135
|
-
var elem = generator(index, com);
|
|
135
|
+
var elem = generator(index, com instanceof Item ? com.value : com);
|
|
136
136
|
if (!elem) return;
|
|
137
|
-
span = document.createElement('
|
|
137
|
+
span = document.createElement('span');
|
|
138
138
|
span.innerHTML = tabs;
|
|
139
|
-
|
|
139
|
+
elem.insertBefore(span, elem.firstChild);
|
|
140
|
+
span = elem;
|
|
140
141
|
} else {
|
|
141
|
-
span =
|
|
142
|
+
span = document.createElement("node");
|
|
142
143
|
html(span, `${tabs}<c>${com.name}</c>${com.test ? "<i>_test</i>" : ""}<a class=count>${com.count}</a>`);
|
|
143
144
|
}
|
|
144
145
|
var _div = button(span);
|
|
146
|
+
_div.setAttribute("node", '');
|
|
145
147
|
_div.index = index;
|
|
146
148
|
|
|
147
149
|
if (!com.saved) {
|
|
@@ -222,7 +224,7 @@ function tree() {
|
|
|
222
224
|
_div.refresh();
|
|
223
225
|
onclick(_div, function () {
|
|
224
226
|
var isClosed = com.isClosed();
|
|
225
|
-
if (!active(banner, com.value, com)) {
|
|
227
|
+
if (!active(banner, com.value, com, _div)) {
|
|
226
228
|
return;
|
|
227
229
|
}
|
|
228
230
|
if (isClosed === com.isClosed() && com.length) {
|
package/coms/zimoli/tree.less
CHANGED
|
@@ -3,13 +3,26 @@
|
|
|
3
3
|
background: #222d32;
|
|
4
4
|
color: #fff;
|
|
5
5
|
|
|
6
|
-
>
|
|
6
|
+
>[node] {
|
|
7
7
|
display: block;
|
|
8
8
|
text-align: left;
|
|
9
9
|
height: auto;
|
|
10
10
|
background-color: inherit;
|
|
11
11
|
color: inherit;
|
|
12
12
|
padding-right: 10px;
|
|
13
|
+
padding-top: 4px;
|
|
14
|
+
padding-bottom: 4px;
|
|
15
|
+
box-shadow: none;
|
|
16
|
+
|
|
17
|
+
&.line,
|
|
18
|
+
&[line] {
|
|
19
|
+
box-shadow: none;
|
|
20
|
+
line-height: 0;
|
|
21
|
+
|
|
22
|
+
>.track {
|
|
23
|
+
display: none;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
13
26
|
}
|
|
14
27
|
}
|
|
15
28
|
|