efront 3.10.7 → 3.11.3
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/coms/basic/parseYML.js +1 -1
- package/coms/frame/route.js +28 -4
- package/coms/zimoli/Item.js +1 -0
- package/coms/zimoli/active.js +5 -1
- package/coms/zimoli/bindAccesskey.js +47 -0
- package/coms/zimoli/button.js +0 -34
- package/coms/zimoli/button.less +3 -2
- package/coms/zimoli/getGenerator.js +20 -17
- package/coms/zimoli/menu.js +11 -6
- package/coms/zimoli/menu.less +59 -83
- package/coms/zimoli/menuItem.html +2 -2
- package/coms/zimoli/menuItem.js +9 -3
- package/coms/zimoli/menuItem.less +16 -0
- package/coms/zimoli/menuList.html +2 -2
- package/coms/zimoli/menuList.js +281 -43
- package/coms/zimoli/menuList.less +12 -3
- package/coms/zimoli/on.js +14 -3
- package/coms/zimoli/render.js +48 -20
- 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 () {
|
|
@@ -8,46 +8,241 @@ var release = function () {
|
|
|
8
8
|
var clear = function () {
|
|
9
9
|
clearTimeout(releaseTimer);
|
|
10
10
|
};
|
|
11
|
+
var unfocus = function () {
|
|
12
|
+
remove(mounted_menus);
|
|
13
|
+
this.ispop = false;
|
|
14
|
+
this.setFocus(null);
|
|
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
|
+
}
|
|
11
157
|
function main(page, items, active, direction = 'y') {
|
|
12
158
|
if (!isNode(page)) {
|
|
13
159
|
var page = div();
|
|
14
160
|
}
|
|
15
161
|
var main = this;
|
|
16
|
-
|
|
17
|
-
|
|
162
|
+
if (direction !== 'x') page.ispop = true;
|
|
163
|
+
function popMenu(item, target) {
|
|
164
|
+
if (page.actived) {
|
|
18
165
|
clear();
|
|
19
|
-
remove(page.
|
|
166
|
+
remove(page.actived);
|
|
20
167
|
}
|
|
168
|
+
page.setFocus(target);
|
|
21
169
|
if (!item.children || !item.children.length) return;
|
|
22
170
|
var clone = template.cloneNode();
|
|
171
|
+
clone.$parentScopes = page.$parentScopes;
|
|
172
|
+
clone.$scope = page.$scope;
|
|
173
|
+
clone.$src = src;
|
|
23
174
|
clone.innerHTML = template.innerHTML;
|
|
24
175
|
var menu = main(clone, item.children, active);
|
|
25
176
|
mounted_menus.push(menu);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
popup(menu,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
177
|
+
page.actived = menu;
|
|
178
|
+
menu.root = page.root || page;
|
|
179
|
+
popup(menu, target);
|
|
180
|
+
if (page.ispop === true) {
|
|
181
|
+
var offleave0 = on("mouseleave")(target, release);
|
|
182
|
+
var offleave1 = on("mouseleave")(menu, release);
|
|
183
|
+
var offenter0 = on("mouseenter")(target, clear);
|
|
184
|
+
var offenter1 = on("mouseenter")(menu, clear);
|
|
185
|
+
} else {
|
|
186
|
+
page.ispop = 1;
|
|
187
|
+
page.tabIndex = 0;
|
|
188
|
+
page.focus();
|
|
189
|
+
}
|
|
190
|
+
on("mousedown")(menu, e => e.preventDefault());
|
|
33
191
|
once("remove")(menu, function () {
|
|
34
|
-
removeFromList(mounted_menus,
|
|
35
|
-
offleave0();
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
offenter1();
|
|
192
|
+
removeFromList(mounted_menus, this);
|
|
193
|
+
if (offleave0) offleave0();
|
|
194
|
+
if (offleave1) offleave1();
|
|
195
|
+
if (offenter0) offenter0();
|
|
196
|
+
if (offenter1) offenter1();
|
|
39
197
|
});
|
|
40
198
|
}
|
|
41
|
-
|
|
42
|
-
var template = page.tempalte ||
|
|
199
|
+
if (!page.ispop) on("blur")(page, unfocus);
|
|
200
|
+
var template = page.tempalte || document.createElement("ylist");
|
|
43
201
|
if (!page.tempalte) {
|
|
44
202
|
template.className = '';
|
|
45
203
|
template.removeAttribute('mode');
|
|
46
204
|
template.innerHTML = page.innerHTML;
|
|
47
205
|
page.tempalte = template;
|
|
48
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
|
+
|
|
49
245
|
if (!page.children.length || page.menutype === 1) {
|
|
50
|
-
page.innerHTML = menuList;
|
|
51
246
|
page.menutype = 1;
|
|
52
247
|
var hasIcon = function () {
|
|
53
248
|
var menus = items;
|
|
@@ -58,42 +253,85 @@ function main(page, items, active, direction = 'y') {
|
|
|
58
253
|
}
|
|
59
254
|
return false;
|
|
60
255
|
};
|
|
61
|
-
|
|
62
|
-
"menu-item"
|
|
63
|
-
|
|
64
|
-
menuItem
|
|
256
|
+
var $scope = {
|
|
257
|
+
"menu-item"(e, s) {
|
|
258
|
+
var a = button(
|
|
259
|
+
menuItem(e, s, this.hasIcon)
|
|
65
260
|
);
|
|
261
|
+
if (!page.firstMenu) {
|
|
262
|
+
page.firstMenu = a;
|
|
263
|
+
}
|
|
264
|
+
return a;
|
|
66
265
|
},
|
|
67
266
|
menus: items,
|
|
68
267
|
hasIcon: hasIcon(),
|
|
69
|
-
open
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
268
|
+
open: fire,
|
|
269
|
+
cancel,
|
|
270
|
+
popMenu: open,
|
|
271
|
+
};
|
|
272
|
+
if (page.$src) {
|
|
273
|
+
var src = page.$src;
|
|
274
|
+
var itemName = src.itemName;
|
|
275
|
+
var className = `{'has-children':${itemName}.children&&${itemName}.children.length,'warn':${itemName}.type==='danger'||${itemName}.type==='warn'||${itemName}.type==='red'}`;
|
|
276
|
+
var notHidden = `!${itemName}.hidden`;
|
|
277
|
+
var generator = getGenerator(page, 'menu-item');
|
|
278
|
+
|
|
279
|
+
list(page, function (index) {
|
|
280
|
+
var item = items[index];
|
|
281
|
+
if (!item) return;
|
|
282
|
+
if (item instanceof Item) item = item.value;
|
|
283
|
+
var a = $scope["menu-item"](null, item);
|
|
284
|
+
if (src.itemName) a.setAttribute("e-if", notHidden);
|
|
285
|
+
a.setAttribute("e-class", className);
|
|
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);
|
|
291
|
+
return a;
|
|
292
|
+
});
|
|
293
|
+
on("append")(page, function () {
|
|
294
|
+
this.go(0);
|
|
295
|
+
})
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
page.innerHTML = menuList;
|
|
299
|
+
render(page, $scope);
|
|
300
|
+
vbox(page);
|
|
301
|
+
}
|
|
302
|
+
page.total = items.length;
|
|
81
303
|
page.renders.unshift(function () {
|
|
82
304
|
this.$scope.hasIcon = hasIcon();
|
|
83
305
|
});
|
|
84
|
-
}
|
|
85
|
-
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
var generator = getGenerator(page, 'menu-item');
|
|
309
|
+
|
|
86
310
|
list(page, function (index) {
|
|
87
311
|
var elem = generator(index);
|
|
88
312
|
if (!elem) return;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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);
|
|
95
321
|
return elem;
|
|
96
322
|
}, direction);
|
|
97
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;
|
|
98
336
|
return page;
|
|
99
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
|
@@ -527,25 +527,53 @@ var binders = {
|
|
|
527
527
|
});
|
|
528
528
|
}
|
|
529
529
|
};
|
|
530
|
-
var
|
|
531
|
-
|
|
532
|
-
var
|
|
530
|
+
var createEmiter = function (on) {
|
|
531
|
+
return function (key, search) {
|
|
532
|
+
var parsedSrc = this.$src;
|
|
533
|
+
var getter0 = createGetter(search, false), getter1;
|
|
534
|
+
if (parsedSrc) {
|
|
535
|
+
var scopes = this.$parentScopes;
|
|
536
|
+
search = search.slice();
|
|
537
|
+
search[0] += `with(this.$parentScopes[${scopes.length}])`;
|
|
538
|
+
getter1 = createGetter(search, false);
|
|
539
|
+
}
|
|
533
540
|
on(key)(this, function (e) {
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
541
|
+
if (parsedSrc) {
|
|
542
|
+
var target = e.currentTarget || e.target;
|
|
543
|
+
var scopes = target && target.$parentScopes;
|
|
544
|
+
if (scopes) {
|
|
545
|
+
var scope = null;
|
|
546
|
+
for (var cx = scopes.length - 1; cx >= 0; cx--) {
|
|
547
|
+
var s = scopes[cx];
|
|
548
|
+
if (s === this.$scope) {
|
|
549
|
+
scope = scopes[cx + 1];
|
|
550
|
+
break;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
if (!scope && target.$scope !== this.$scope) scope = target.$scope;
|
|
555
|
+
}
|
|
556
|
+
var res;
|
|
557
|
+
if (scope) {
|
|
558
|
+
var temp = this.$scope;
|
|
559
|
+
this.$parentScopes.push(temp);
|
|
560
|
+
this.$scope = scope;
|
|
561
|
+
res = getter1.call(this, e);
|
|
562
|
+
this.$parentScopes.pop();
|
|
563
|
+
this.$scope = temp;
|
|
564
|
+
}
|
|
565
|
+
else {
|
|
566
|
+
res = getter0.call(this, e);
|
|
567
|
+
}
|
|
544
568
|
if (res && isFunction(res.then)) res.then(digest, digest);
|
|
545
569
|
digest();
|
|
546
570
|
return res;
|
|
547
571
|
});
|
|
548
|
-
}
|
|
572
|
+
};
|
|
573
|
+
};
|
|
574
|
+
var emiters = {
|
|
575
|
+
on: createEmiter(on),
|
|
576
|
+
once: createEmiter(once),
|
|
549
577
|
};
|
|
550
578
|
emiters.v = emiters.ng = emiters.on;
|
|
551
579
|
|
|
@@ -555,7 +583,7 @@ function getFromScopes(key, scope, parentScopes) {
|
|
|
555
583
|
}
|
|
556
584
|
if (parentScopes) for (var cx = parentScopes.length - 1; cx >= 0; cx--) {
|
|
557
585
|
var o = parentScopes[cx];
|
|
558
|
-
if (key in o) {
|
|
586
|
+
if (o && key in o) {
|
|
559
587
|
return o[key];
|
|
560
588
|
}
|
|
561
589
|
}
|
|
@@ -588,13 +616,13 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
|
|
|
588
616
|
return element;
|
|
589
617
|
}
|
|
590
618
|
var isFirstRender = !element.renderid;
|
|
591
|
-
element.renderid = 1;
|
|
592
|
-
var parentNode = element.parentNode;
|
|
593
|
-
if (parentNode) {
|
|
594
|
-
if (parentNode.renderid > 1 || parentNode.isMounted) element.renderid = 2;
|
|
595
|
-
}
|
|
596
619
|
|
|
597
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
|
+
}
|
|
598
626
|
element.renders = element.renders ? [].concat(element.renders) : [];
|
|
599
627
|
var { ons, copys, attrs, props, binds, context: withContext } = element.$struct;
|
|
600
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
|
|