efront 3.12.3 → 3.13.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/api.yml +1 -0
- package/apps/pivot/home/welcome.html +1 -1
- package/apps/pivot/home/welcome.js +6 -9
- package/apps/pivot/log/count.html +1 -0
- package/apps/pivot/log/count.js +15 -0
- package/apps/pivot/log/count.less +8 -0
- package/apps/pivot/menu.yml +3 -1
- package/apps/pivot/share/list.less +0 -4
- package/coms/basic/{_cross.js → cross_.js} +9 -9
- package/coms/basic/parseYML.js +1 -1
- package/coms/frame/route.js +1 -0
- package/coms/kugou/parseSongsList.js +0 -1
- package/coms/reptile/cross.js +1 -1
- package/coms/zimoli/AudioContext_test.html +1 -1
- package/coms/zimoli/AudioContext_test.js +3 -3
- package/coms/zimoli/bind.js +4 -2
- package/coms/zimoli/cloneVisible.js +9 -2
- package/coms/zimoli/cross.js +3 -3
- package/coms/zimoli/css.js +13 -5
- package/coms/zimoli/data.js +6 -5
- package/coms/zimoli/drag.js +3 -2
- package/coms/zimoli/list.js +6 -6
- package/coms/zimoli/menu.js +33 -13
- package/coms/zimoli/menu.less +31 -9
- package/coms/zimoli/menuItem.js +1 -1
- package/coms/zimoli/menuList.html +5 -3
- package/coms/zimoli/menuList.js +63 -28
- package/coms/zimoli/menuList.less +5 -0
- package/coms/zimoli/model.js +1 -1
- package/coms/zimoli/on.js +5 -3
- package/coms/zimoli/picture.js +30 -335
- package/coms/zimoli/picture_.js +356 -0
- package/coms/zimoli/render.js +11 -2
- package/coms/zimoli/select.js +5 -5
- package/coms/zimoli/selectList.js +5 -2
- package/coms/zimoli/slider.js +13 -6
- package/coms/zimoli/table.html +6 -8
- package/coms/zimoli/table.js +25 -2
- package/coms/zimoli/table.less +24 -4
- package/coms/zimoli/vbox.js +1 -1
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/apps/pivot/api.yml
CHANGED
|
@@ -6,15 +6,12 @@ function main() {
|
|
|
6
6
|
version: data.from("version"),
|
|
7
7
|
hrtime: data.from("uptime", a => Date.now() - a * 1000),
|
|
8
8
|
filterTime,
|
|
9
|
-
async run(id
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (info) alert(info, 'pass');
|
|
16
|
-
} catch { }
|
|
17
|
-
target.removeAttribute('pending');
|
|
9
|
+
async run(id) {
|
|
10
|
+
await new Promise(ok => setTimeout(ok, 2000));
|
|
11
|
+
var info = await data.from("run", {
|
|
12
|
+
run: id
|
|
13
|
+
}).loading_promise;
|
|
14
|
+
if (info) alert(info, 'pass');
|
|
18
15
|
},
|
|
19
16
|
async logout() {
|
|
20
17
|
data.setSource({});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<table -src="[fields,items]"></talbe>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var fields = refilm`
|
|
2
|
+
路径/path
|
|
3
|
+
访问量/count
|
|
4
|
+
`;
|
|
5
|
+
function main() {
|
|
6
|
+
var page = div();
|
|
7
|
+
page.innerHTML = template;
|
|
8
|
+
renderWithDefaults(page, {
|
|
9
|
+
items: data.from("count", a => {
|
|
10
|
+
return Object.keys(a).map(b => ({ path: b, count: a[b] }));
|
|
11
|
+
}),
|
|
12
|
+
fields
|
|
13
|
+
});
|
|
14
|
+
return page;
|
|
15
|
+
}
|
package/apps/pivot/menu.yml
CHANGED
|
@@ -46,7 +46,7 @@ function toResponse() {
|
|
|
46
46
|
if (this.responseType === 'json') return JSON.stringify(this.response);
|
|
47
47
|
return this.response;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function cross_(jsonp, digest = noop, method, url, headers) {
|
|
50
50
|
var originDomain = getDomainPath(url);
|
|
51
51
|
if (!originDomain) throw new Error("路径格式错误!");
|
|
52
52
|
var _cookies = getCookies(originDomain);
|
|
@@ -149,7 +149,7 @@ function _cross(jsonp, digest = noop, method, url, headers) {
|
|
|
149
149
|
}
|
|
150
150
|
location = getRequestProtocol(url) + "//" + location;
|
|
151
151
|
}
|
|
152
|
-
var crs =
|
|
152
|
+
var crs = cross_("get", location, _headers);
|
|
153
153
|
crs.isRedirected = (xhr.isRedirected || 0) + 1;
|
|
154
154
|
crs.done(onload, false);
|
|
155
155
|
crs.error(onerror, false);
|
|
@@ -304,10 +304,10 @@ function reform(r, info, fire, cancel, e) {
|
|
|
304
304
|
function addReform(r) {
|
|
305
305
|
if (isFunction(r)) reforms.push(r);
|
|
306
306
|
}
|
|
307
|
-
var bind =
|
|
308
|
-
|
|
309
|
-
var
|
|
310
|
-
extend(
|
|
307
|
+
var bind = cross_.bind;
|
|
308
|
+
cross_.bind = function () {
|
|
309
|
+
var cross_ = bind.apply(this, arguments);
|
|
310
|
+
extend(cross_, {
|
|
311
311
|
requests,
|
|
312
312
|
abortAll() {
|
|
313
313
|
var rs = requests.splice(0, requests.length);
|
|
@@ -320,10 +320,10 @@ _cross.bind = function () {
|
|
|
320
320
|
addDirect,
|
|
321
321
|
getCrossUrl
|
|
322
322
|
});
|
|
323
|
-
return
|
|
323
|
+
return cross_;
|
|
324
324
|
}
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
cross_.setHost = setHost;
|
|
326
|
+
cross_.setLocation = function (host) {
|
|
327
327
|
location_href = host;
|
|
328
328
|
if (!base) base = /^https?\:/i.test(location_href) ? '/' : "http://efront.cc/";
|
|
329
329
|
};
|
package/coms/basic/parseYML.js
CHANGED
package/coms/frame/route.js
CHANGED
package/coms/reptile/cross.js
CHANGED
|
@@ -2,8 +2,8 @@ function piano() {
|
|
|
2
2
|
var res = [];
|
|
3
3
|
var yin = [1, 3, 5, 7, 8, 10, 12].reverse();
|
|
4
4
|
var yue = [2, 4, 6, 9, 11].reverse();
|
|
5
|
-
var c=a => 440 * Math.pow(2, cx + (3 - a) / 12);
|
|
6
|
-
for (var cx = -
|
|
5
|
+
var c = a => 440 * Math.pow(2, cx + (3 - a) / 12);
|
|
6
|
+
for (var cx = -12, dx = 8; cx < dx; cx++) {
|
|
7
7
|
var yinjie1 = yin.map(c);
|
|
8
8
|
var yinjie2 = yue.map(c);
|
|
9
9
|
res.push(yinjie1, yinjie2);
|
|
@@ -23,7 +23,7 @@ function main() {
|
|
|
23
23
|
oscillator.connect(gainNode);
|
|
24
24
|
gainNode.connect(audioCtx.destination);
|
|
25
25
|
oscillator.type = 'sine';
|
|
26
|
-
oscillator.frequency.value = hz;
|
|
26
|
+
oscillator.frequency.value = -hz;
|
|
27
27
|
gainNode.gain.setValueAtTime(0, audioCtx.currentTime);
|
|
28
28
|
gainNode.gain.linearRampToValueAtTime(65536 / Math.log2(hz), audioCtx.currentTime + 0.01);
|
|
29
29
|
oscillator.start(audioCtx.currentTime);
|
package/coms/zimoli/bind.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
function bind(eventName, bindTo = window) {
|
|
2
2
|
return function (target, eventListener) {
|
|
3
3
|
var off;
|
|
4
|
-
var
|
|
4
|
+
var mount = function () {
|
|
5
5
|
if (off) off();
|
|
6
6
|
off = on(eventName).call(bindTo, target, eventListener);
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
|
+
if (isMounted(target)) mount();
|
|
9
|
+
var off1 = on("append")(target, mount);
|
|
8
10
|
var off2 = on("remove")(target, function () {
|
|
9
11
|
if (off) off();
|
|
10
12
|
off = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var cloneProperties = "fontWeight,fontSize,fontFamily,color,textShadow,opacity,writingMode,blockSize,wordSpacing,letterSpacing,whiteSpace".split(",");
|
|
2
|
-
var cloneProperties2 = "position,float,clear,margin,color,verticalAlign,textAlign,textShadow,opacity,boxShadow,overflow,writingMode,blockSize,wordSpacing,letterSpacing,textIndent,lineHeight,display,appearance,webkitAppearance,MozAppearance".split(",");
|
|
2
|
+
var cloneProperties2 = "position,backdropFilter,float,clear,margin,color,verticalAlign,textAlign,textShadow,opacity,boxShadow,overflow,writingMode,blockSize,wordSpacing,letterSpacing,textIndent,lineHeight,display,appearance,webkitAppearance,MozAppearance".split(",");
|
|
3
3
|
var pushProperty = function (key, props) {
|
|
4
4
|
props.split(",").forEach(k => {
|
|
5
5
|
cloneProperties2.push(key + k);
|
|
@@ -86,7 +86,13 @@ var isMaybeVisible = function (node) {
|
|
|
86
86
|
if (style.overflow === "hidden") {
|
|
87
87
|
if (node.offsetHeight === 0 || node.offsetWidth === 0) return;
|
|
88
88
|
}
|
|
89
|
-
if (node.offsetParent
|
|
89
|
+
if (node.offsetParent) {
|
|
90
|
+
var parent = node.offsetParent;
|
|
91
|
+
return !(node.offsetLeft + node.offsetWidth - parent.scrollLeft <= parent.clientLeft ||
|
|
92
|
+
node.offsetTop + node.offsetHeight - parent.scrollTop <= parent.clientTop ||
|
|
93
|
+
node.offsetLeft - parent.scrollLeft >= (parent.clientWidth || parent.offsetWidth) ||
|
|
94
|
+
node.offsetTop - parent.scrollTop >= (parent.clientHeight || parent.offsetHeight));
|
|
95
|
+
}
|
|
90
96
|
return true;
|
|
91
97
|
}
|
|
92
98
|
var clonePseudo = function (node, pseudo) {
|
|
@@ -173,6 +179,7 @@ var cloneVisible = function (td) {
|
|
|
173
179
|
};
|
|
174
180
|
clone(td);
|
|
175
181
|
extend(result.style, {
|
|
182
|
+
zIndex: getComputedStyle(td).zIndex,
|
|
176
183
|
position: "absolute",
|
|
177
184
|
left: _left + "px",
|
|
178
185
|
top: _top + "px",
|
package/coms/zimoli/cross.js
CHANGED
|
@@ -5,7 +5,7 @@ var saveCookie = lazy(function () {
|
|
|
5
5
|
var { efrontURI, cross_host = efrontURI } = this;
|
|
6
6
|
var location_href = parseURL(location.href);
|
|
7
7
|
location_href = `${location_href.protocol}//${location_href.host}/`;
|
|
8
|
-
|
|
8
|
+
cross_.setLocation(location_href);
|
|
9
9
|
|
|
10
10
|
var cookieItemsInSessionStorageKey = "--zimoli-coms-cross";
|
|
11
11
|
var cookiesData = sessionStorage.getItem(cookieItemsInSessionStorageKey);
|
|
@@ -21,7 +21,7 @@ var digest = function () {
|
|
|
21
21
|
dispatch('render', window);
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
var cross =
|
|
24
|
+
var cross = cross_.bind(function (callback, onerror) {
|
|
25
25
|
var xhr = new XMLHttpRequest;
|
|
26
26
|
var abort = xhr.abort;
|
|
27
27
|
xhr.abort = function () {
|
|
@@ -55,6 +55,6 @@ cross.setHost = function (host) {
|
|
|
55
55
|
if (!host) return console.error("cross_host格式不正确", host);
|
|
56
56
|
var host = parsed.host + (parsed.pathname || '/');
|
|
57
57
|
host = (/^https/.test(location_href) ? "https://" : "http://") + host;
|
|
58
|
-
|
|
58
|
+
cross_.setHost(host);
|
|
59
59
|
};
|
|
60
60
|
if (cross_host) cross.setHost(cross_host);
|
package/coms/zimoli/css.js
CHANGED
|
@@ -19,9 +19,15 @@ var transfromSimpleValue = function (value) {
|
|
|
19
19
|
};
|
|
20
20
|
var transformValue = function (value, k) {
|
|
21
21
|
if (ratioPropReg.test(k) || !value) return value;
|
|
22
|
-
if (/^[\w\s\.]+$/.test(value)) return isFinite(value) ? transfromSimpleValue(value) : String(value).split(/\s
|
|
22
|
+
if (/^[\w\s\.]+$/.test(value)) return isFinite(value) ? transfromSimpleValue(value) : String(value).split(/\s+/).map(transfromSimpleValue).join(' ');
|
|
23
23
|
return value;
|
|
24
24
|
};
|
|
25
|
+
var partifyValue = function (v) {
|
|
26
|
+
return String(v).toLowerCase().split(/['"`]|\s+/).join(" ");
|
|
27
|
+
};
|
|
28
|
+
var isSameValue = function (v1, v2) {
|
|
29
|
+
return partifyValue(v1) === partifyValue(v2);
|
|
30
|
+
};
|
|
25
31
|
/**
|
|
26
32
|
* 将中划线转成驼峰式
|
|
27
33
|
* @param {string} key
|
|
@@ -86,7 +92,8 @@ var cssTargetNode = function (targetNode, oStyle, oValue) {
|
|
|
86
92
|
var key = transformNodeKey(k);
|
|
87
93
|
if (key in styleobject) {
|
|
88
94
|
try {
|
|
89
|
-
|
|
95
|
+
var value = transformValue(oStyle[k], key);
|
|
96
|
+
if (!isSameValue(value, styleobject[value])) styleobject[key] = transformValue(oStyle[k], key);
|
|
90
97
|
} catch (e) {
|
|
91
98
|
console.warn(key, oStyle[k], "无效");
|
|
92
99
|
}
|
|
@@ -95,7 +102,8 @@ var cssTargetNode = function (targetNode, oStyle, oValue) {
|
|
|
95
102
|
} else {
|
|
96
103
|
for (var k in oStyle) {
|
|
97
104
|
var key = transformNodeKey(k);
|
|
98
|
-
|
|
105
|
+
var value = transformValue(oStyle[k], key);
|
|
106
|
+
if (key in styleobject && !isSameValue(value, styleobject[key])) styleobject[key] = value;
|
|
99
107
|
}
|
|
100
108
|
}
|
|
101
109
|
}
|
|
@@ -153,9 +161,9 @@ function cssTargetStyleSheet(stylesheet, innerCss) {
|
|
|
153
161
|
var styleSheet = stylesheet.styleSheet;
|
|
154
162
|
if (styleSheet) {
|
|
155
163
|
//IE
|
|
156
|
-
styleSheet.cssText = innerCss;
|
|
164
|
+
if (styleSheet.cssText !== innerCss) styleSheet.cssText = innerCss;
|
|
157
165
|
} else {
|
|
158
|
-
stylesheet.innerHTML = innerCss;
|
|
166
|
+
if (stylesheet.innerHTML !== innerCss) stylesheet.innerHTML = innerCss;
|
|
159
167
|
}
|
|
160
168
|
}
|
|
161
169
|
|
package/coms/zimoli/data.js
CHANGED
|
@@ -165,6 +165,7 @@ function getUrlParamsForApi(api, url) {
|
|
|
165
165
|
var params = {};
|
|
166
166
|
url = url.replace(/[\?#]*$/g, function (match) {
|
|
167
167
|
match.split(/[&#\?]+/).forEach(function (s) {
|
|
168
|
+
if (!s) return;
|
|
168
169
|
var [k, v] = s.split("=");
|
|
169
170
|
params[k] = v;
|
|
170
171
|
});
|
|
@@ -176,7 +177,7 @@ function getUrlParamsForApi(api, url) {
|
|
|
176
177
|
});
|
|
177
178
|
});
|
|
178
179
|
params = serialize(params);
|
|
179
|
-
return
|
|
180
|
+
return params;
|
|
180
181
|
}
|
|
181
182
|
|
|
182
183
|
function __seekprop(data, prop) {
|
|
@@ -204,7 +205,7 @@ function seekResponse(data, seeker, apiMap = {}) {
|
|
|
204
205
|
}
|
|
205
206
|
if (data && prop) {
|
|
206
207
|
var reg1 = /[\:\>\\]/, next;
|
|
207
|
-
var getNextValue =
|
|
208
|
+
var getNextValue = !/\:/.test(prop);
|
|
208
209
|
if (reg1.test(prop)) {
|
|
209
210
|
var [prop, next, pick] = prop.split(reg1);
|
|
210
211
|
next = apiMap[next];
|
|
@@ -231,8 +232,8 @@ function seekResponse(data, seeker, apiMap = {}) {
|
|
|
231
232
|
data = JSON.parse(data);
|
|
232
233
|
}
|
|
233
234
|
if (next) {
|
|
234
|
-
data = getUrlParamsForApi(next, data);
|
|
235
|
-
if (
|
|
235
|
+
data = (pick || next.id) + "?" + getUrlParamsForApi(next, data);
|
|
236
|
+
if (getNextValue) {
|
|
236
237
|
data = getParamsFromUrl(data);
|
|
237
238
|
if (pick) data = data[pick];
|
|
238
239
|
}
|
|
@@ -894,7 +895,7 @@ var data = {
|
|
|
894
895
|
return data;
|
|
895
896
|
});
|
|
896
897
|
promise1.catch((e) => {
|
|
897
|
-
if (e === outdate) return;
|
|
898
|
+
if (e === outdate || e === aborted) return;
|
|
898
899
|
this.responseCrash(e, instance);
|
|
899
900
|
});
|
|
900
901
|
|
package/coms/zimoli/drag.js
CHANGED
|
@@ -61,8 +61,9 @@ function drag(target, initialEvent, preventOverflow, isMovingSource) {
|
|
|
61
61
|
saved_delta.x += clone_left - target_left;
|
|
62
62
|
saved_delta.y += clone_top - target_top;
|
|
63
63
|
if (clone.style) {
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
var z = zIndex();
|
|
65
|
+
clone.style.zIndex = z + (+clone.style.zIndex || 0);
|
|
66
|
+
extraClones.map(e => e.style.zIndex = z + (+e.style.zIndex || 0));
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
drag.target = clone;
|
package/coms/zimoli/list.js
CHANGED
|
@@ -404,12 +404,6 @@ function ylist(container, generator, $Y) {
|
|
|
404
404
|
var scrolled = (list.scrollTop - firstElement.offsetTop + parseFloat(getComputedStyle(list).paddingTop) + .5 | 0) / firstElement.offsetHeight;
|
|
405
405
|
return index + scrolled;
|
|
406
406
|
};
|
|
407
|
-
on("remove")(list, function () {
|
|
408
|
-
saved_itemIndex = list.index();
|
|
409
|
-
});
|
|
410
|
-
on("append")(list, function () {
|
|
411
|
-
if (isFinite(saved_itemIndex)) list.go(saved_itemIndex);
|
|
412
|
-
})
|
|
413
407
|
list.topIndex = function () {
|
|
414
408
|
var element = getFirstElement(1);
|
|
415
409
|
return element ? element.index : 0;
|
|
@@ -419,6 +413,12 @@ function ylist(container, generator, $Y) {
|
|
|
419
413
|
list.patchTop = patchTop;
|
|
420
414
|
list.scrollIfNotCover = scrollIfNotCover;
|
|
421
415
|
vbox(list, $Y);
|
|
416
|
+
on("remove")(list, function () {
|
|
417
|
+
saved_itemIndex = list.index();
|
|
418
|
+
});
|
|
419
|
+
on("append")(list, function () {
|
|
420
|
+
if (isFinite(saved_itemIndex)) list.go(saved_itemIndex);
|
|
421
|
+
})
|
|
422
422
|
return list;
|
|
423
423
|
}
|
|
424
424
|
var allArgumentsNames = arguments[arguments.length - 1];
|
package/coms/zimoli/menu.js
CHANGED
|
@@ -101,23 +101,34 @@ function main(elem, mode) {
|
|
|
101
101
|
// }
|
|
102
102
|
// elem.setAttribute('browser', os);
|
|
103
103
|
var mode = elem.getAttribute('mode') || elem.getAttribute('type');
|
|
104
|
+
if (!mode) {
|
|
105
|
+
if (elem.hasAttribute("inline")) mode = 'inline';
|
|
106
|
+
else if (elem.hasAttribute("vertical")) mode = "vertical";
|
|
107
|
+
else if (elem.hasAttribute("horizonal")) mode = "horizonal";
|
|
108
|
+
else if (
|
|
109
|
+
elem.hasAttribute("toolbar")
|
|
110
|
+
|| elem.hasAttribute('tool')
|
|
111
|
+
|| elem.hasAttribute('tools')
|
|
112
|
+
|| elem.hasAttribute('bar')
|
|
113
|
+
) mode = "toolbar";
|
|
114
|
+
}
|
|
104
115
|
if (!mode) {
|
|
105
116
|
if (/^[xyhvtci]/i.test(elem.tagName)) {
|
|
106
117
|
mode = elem.tagName.slice(0, 1);
|
|
118
|
+
if (/^t$/i.test(mode)) mode = elem.tagName.slice(0, 2);
|
|
107
119
|
}
|
|
108
|
-
else if (/[
|
|
109
|
-
mode = elem.tagName.slice(
|
|
120
|
+
else if (/[xyhvci]$/i.test(elem.tagName)) {
|
|
121
|
+
mode = elem.tagName.slice(elem.tagName.length - 1);
|
|
110
122
|
}
|
|
111
123
|
}
|
|
112
124
|
mode = mode ? mode.toLowerCase() : "horizonal";
|
|
113
|
-
|
|
125
|
+
var direction;
|
|
114
126
|
switch (mode) {
|
|
127
|
+
case "tr":
|
|
115
128
|
case "i":
|
|
116
129
|
case "c":
|
|
117
130
|
case "inline":
|
|
118
|
-
|
|
119
|
-
case "tree":
|
|
120
|
-
mode = "tree";
|
|
131
|
+
mode = "inline";
|
|
121
132
|
if (elem) {
|
|
122
133
|
var generator = getGenerator(elem, 'menu-item');
|
|
123
134
|
tree(elem, function (index, item) {
|
|
@@ -145,22 +156,31 @@ function main(elem, mode) {
|
|
|
145
156
|
elem = inlineMenu.call(elem, nodes);
|
|
146
157
|
}
|
|
147
158
|
break;
|
|
159
|
+
case "to":
|
|
160
|
+
case "t":
|
|
161
|
+
case "b":
|
|
162
|
+
case "tool":
|
|
163
|
+
case "tools":
|
|
164
|
+
case "bar":
|
|
165
|
+
case "toolbar":
|
|
166
|
+
direction = 't';
|
|
167
|
+
mode = "toolbar";
|
|
148
168
|
case "h":
|
|
149
169
|
case "x":
|
|
150
170
|
case "horizonal":
|
|
151
|
-
|
|
152
|
-
|
|
171
|
+
if (!direction) {
|
|
172
|
+
direction = 'x';
|
|
173
|
+
mode = "horizonal";
|
|
174
|
+
}
|
|
153
175
|
case "v":
|
|
154
176
|
case "y":
|
|
155
177
|
case "vertical":
|
|
178
|
+
if (!direction) mode = "vertical", direction = 'y';
|
|
156
179
|
var emit = function (item, target) {
|
|
157
180
|
active(elem, item.value, item, target);
|
|
158
181
|
};
|
|
159
182
|
if ("$src" in elem) {
|
|
160
183
|
getGenerator(elem, 'menu-item');
|
|
161
|
-
on("append")(elem, function () {
|
|
162
|
-
elem.registerAsRoot();
|
|
163
|
-
});
|
|
164
184
|
var src0 = [];
|
|
165
185
|
menuList(elem, src0, emit, direction);
|
|
166
186
|
care(elem, function (src) {
|
|
@@ -177,7 +197,6 @@ function main(elem, mode) {
|
|
|
177
197
|
var nodes = getArrayNodes(elem);
|
|
178
198
|
remove(elem.children);
|
|
179
199
|
elem = menuList(elem, nodes, emit, direction);
|
|
180
|
-
elem.registerAsRoot();
|
|
181
200
|
}
|
|
182
201
|
break;
|
|
183
202
|
default:
|
|
@@ -187,7 +206,8 @@ function main(elem, mode) {
|
|
|
187
206
|
mode = mode || "horizonal";
|
|
188
207
|
elem = menu.apply(null, arguments);
|
|
189
208
|
}
|
|
190
|
-
elem.setAttribute('mode', mode);
|
|
209
|
+
if (!elem.hasAttribute('mode')) elem.setAttribute('mode', mode);
|
|
210
|
+
if (!elem.hasAttribute(mode)) elem.setAttribute(mode, '');
|
|
191
211
|
return elem;
|
|
192
212
|
|
|
193
213
|
}
|
package/coms/zimoli/menu.less
CHANGED
|
@@ -82,13 +82,11 @@ body:active & {
|
|
|
82
82
|
width: 100%;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
&[
|
|
86
|
-
&[type=vertical] {
|
|
85
|
+
&[vertical] {
|
|
87
86
|
display: block;
|
|
88
87
|
}
|
|
89
88
|
|
|
90
|
-
&[
|
|
91
|
-
&[type=horizonal] {
|
|
89
|
+
&[horizonal] {
|
|
92
90
|
display: block;
|
|
93
91
|
overflow: hidden;
|
|
94
92
|
text-overflow: hidden;
|
|
@@ -115,11 +113,35 @@ body:active & {
|
|
|
115
113
|
|
|
116
114
|
}
|
|
117
115
|
|
|
118
|
-
&[
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
116
|
+
&[toolbar] {
|
|
117
|
+
>menu-item{
|
|
118
|
+
padding-left: 6px;
|
|
119
|
+
padding-right: 6px;
|
|
120
|
+
text-align: center;
|
|
121
|
+
}
|
|
122
|
+
>menu-item.has-children {
|
|
123
|
+
&::after {
|
|
124
|
+
display: block;
|
|
125
|
+
content: "";
|
|
126
|
+
width: 0;
|
|
127
|
+
height: 0;
|
|
128
|
+
font-size: 0;
|
|
129
|
+
transform: none;
|
|
130
|
+
border: 2px solid;
|
|
131
|
+
border-top-color: transparent;
|
|
132
|
+
border-left-color: transparent;
|
|
133
|
+
position: absolute;
|
|
134
|
+
right: 3px;
|
|
135
|
+
bottom: 3px;
|
|
136
|
+
box-sizing: border-box;
|
|
137
|
+
line-height: 0;
|
|
138
|
+
top: auto;
|
|
139
|
+
margin: 0;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&[inline] {
|
|
123
145
|
height: auto;
|
|
124
146
|
box-shadow: none;
|
|
125
147
|
padding: 0;
|
package/coms/zimoli/menuItem.js
CHANGED
|
@@ -11,7 +11,7 @@ function main(elem, scope, hasIcon) {
|
|
|
11
11
|
var name = scope.name;
|
|
12
12
|
var icon = scope.icon;
|
|
13
13
|
if (hasIcon === undefined) hasIcon = !!icon;
|
|
14
|
-
render(item.children, { useIcon: hasIcon, hasIcon, name, icon });
|
|
14
|
+
render(item.children, scope, hasIcon instanceof Array ? hasIcon : [{ useIcon: hasIcon, hasIcon, name, icon }]);
|
|
15
15
|
if (scope.line) item.setAttribute("line", ''), on("click")(item, preventDefault);
|
|
16
16
|
return item;
|
|
17
17
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
<menu-item ng-repeat="menu in menus" ng-if="!menu.hidden" ng-click="open.call(this)"
|
|
2
|
-
ng-
|
|
3
|
-
|
|
1
|
+
<menu-item ng-repeat="menu in menus" ng-if="!menu.hidden" ng-click="open.call(this)" ng-mouseleave="cancel()"
|
|
2
|
+
ng-mouseenter="popMenu.call(this)" ng-mousedown="popMenu1.call(this,event)" ng-class="{'has-children':menu.children&&menu.children.length,
|
|
3
|
+
'warn':menu.type==='danger'||menu.type==='warn'||menu.type==='red',
|
|
4
|
+
'selected':menu.selected
|
|
5
|
+
}">
|
|
4
6
|
</menu-item>
|