efront 3.20.1 → 3.20.2
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/wow/root.js +1 -1
- package/coms/{zimoli → basic}/Item.js +0 -0
- package/coms/basic/Tree.js +154 -0
- package/coms/basic/cookie.js +8 -0
- package/coms/basic/cross_.js +44 -24
- package/coms/layer/glance.js +5 -4
- package/coms/pivot/left-header.html +1 -1
- package/coms/pivot/left-header.js +1 -0
- package/coms/reptile/submit.js +1 -0
- package/coms/zimoli/cloneVisible.js +1 -1
- package/coms/zimoli/data.js +10 -0
- package/coms/zimoli/gallery.js +2 -16
- package/coms/zimoli/getTreeFromData.js +1 -53
- package/coms/zimoli/lattice.js +10 -13
- package/coms/zimoli/menu.js +6 -13
- package/coms/zimoli/menu.less +4 -4
- package/coms/zimoli/render.js +32 -26
- package/coms/zimoli/resize.js +5 -7
- package/coms/zimoli/resizingList.js +21 -3
- package/coms/zimoli/select.js +12 -0
- package/coms/zimoli/tree.js +5 -85
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/apps/pivot/wow/root.js
CHANGED
|
@@ -27,7 +27,7 @@ function main() {
|
|
|
27
27
|
$scope.open();
|
|
28
28
|
return false;
|
|
29
29
|
}
|
|
30
|
-
page.setAttribute('
|
|
30
|
+
page.setAttribute('on-contextmenu', 'setActive')
|
|
31
31
|
bind('drop')(page, async function (event) {
|
|
32
32
|
event.preventDefault();
|
|
33
33
|
var files = event.dataTransfer.files;
|
|
File without changes
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
class Tree extends Array {
|
|
2
|
+
constructor(src) {
|
|
3
|
+
if (src instanceof Tree) return src;
|
|
4
|
+
if (src instanceof Array && src[0] && ('tab' in src[0] || 'deep' in src[0])) {
|
|
5
|
+
return Tree.fromArray(src);
|
|
6
|
+
}
|
|
7
|
+
else if (src instanceof Array) {
|
|
8
|
+
return Tree.fromData(src);
|
|
9
|
+
}
|
|
10
|
+
if (src && src.children) {
|
|
11
|
+
return Tree.fromData(src.children);
|
|
12
|
+
}
|
|
13
|
+
super();
|
|
14
|
+
}
|
|
15
|
+
static fromData(array) {
|
|
16
|
+
if (array instanceof Tree) return array;
|
|
17
|
+
var root = new Tree;
|
|
18
|
+
root.tab = -Infinity;
|
|
19
|
+
root.count = 0;
|
|
20
|
+
var map = {};
|
|
21
|
+
array = array.filter(a => !!a);
|
|
22
|
+
var active_item = null;
|
|
23
|
+
var hasIcon = [];
|
|
24
|
+
array.forEach(function (data) {
|
|
25
|
+
var item = new Item(data);
|
|
26
|
+
if (!active_item && item.isActived()) active_item = item;
|
|
27
|
+
if (data.id) {
|
|
28
|
+
map[data.id] = item;
|
|
29
|
+
} else {
|
|
30
|
+
root.push(item);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
array.forEach(function (data) {
|
|
34
|
+
if (!data) return;
|
|
35
|
+
var parent = map[data.parentId];
|
|
36
|
+
if (parent) {
|
|
37
|
+
var item = map[data.id];
|
|
38
|
+
delete map[data.id];
|
|
39
|
+
if (parent) {
|
|
40
|
+
parent.push(item);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
var items = Object.keys(map).map(a => map[a]);
|
|
45
|
+
root.push.apply(root, items);
|
|
46
|
+
var tab = 0;
|
|
47
|
+
var deep = 0;
|
|
48
|
+
var run = function (item, parent) {
|
|
49
|
+
item.tab = tab;
|
|
50
|
+
item.deep = tab;
|
|
51
|
+
var count = 0, total = 0;
|
|
52
|
+
item.parent = parent;
|
|
53
|
+
item.root = root;
|
|
54
|
+
if (item.icon && !hasIcon[deep]) hasIcon[deep] = true;
|
|
55
|
+
if (item.length) {
|
|
56
|
+
tab++;
|
|
57
|
+
if (hasIcon[deep]) tab++;
|
|
58
|
+
deep++;
|
|
59
|
+
for (var cx = 0, dx = item.length; cx < dx; cx++) {
|
|
60
|
+
var i = item[cx];
|
|
61
|
+
run(i, parent);
|
|
62
|
+
count += i.count || 1;
|
|
63
|
+
total += i.total;
|
|
64
|
+
}
|
|
65
|
+
deep--;
|
|
66
|
+
if (hasIcon[deep]) tab--;
|
|
67
|
+
tab--;
|
|
68
|
+
}
|
|
69
|
+
item.total = total + item.length;
|
|
70
|
+
return item.count = count;
|
|
71
|
+
};
|
|
72
|
+
run(root);
|
|
73
|
+
root.hasIcon = hasIcon;
|
|
74
|
+
root.actived = active_item;
|
|
75
|
+
return root;
|
|
76
|
+
}
|
|
77
|
+
static fromArray(array) {
|
|
78
|
+
if (array instanceof Tree) return array;
|
|
79
|
+
var root = new Tree;
|
|
80
|
+
root.tab = -Infinity;
|
|
81
|
+
root.count = 0;
|
|
82
|
+
root.total = 0;
|
|
83
|
+
var path = [root];
|
|
84
|
+
for (var cx = 0, dx = array.length; cx < dx; cx++) {
|
|
85
|
+
var arg = array[cx];
|
|
86
|
+
var item = new Item(arg);
|
|
87
|
+
item.root = root;
|
|
88
|
+
for (var cy = path.length - 1; cy >= 0; cy--) {
|
|
89
|
+
var parentElement = path[cy];
|
|
90
|
+
if (parentElement.tab < arg.tab) {
|
|
91
|
+
item.parent = parentElement;
|
|
92
|
+
parentElement.push(item);
|
|
93
|
+
path.splice(cy + 1, path.length - cy - 1, item);
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
parentElement.parent.count += parentElement.count || parentElement.length || 1;
|
|
97
|
+
parentElement.parent.total += (parentElement.total || parentElement.length) + 1;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
while (path.length > 1) {
|
|
101
|
+
var item = path.pop();
|
|
102
|
+
path[path.length - 1].count += item.count || item.length || 1;
|
|
103
|
+
}
|
|
104
|
+
return root;
|
|
105
|
+
}
|
|
106
|
+
static toArray(root, skipClosed = true) {
|
|
107
|
+
var path = [root], pathcx = [0];
|
|
108
|
+
var result = [];
|
|
109
|
+
var max_deep = 1;
|
|
110
|
+
loop: while (pathcx.length) {
|
|
111
|
+
var pathindex = pathcx.length - 1;
|
|
112
|
+
var cx = pathcx[pathindex];
|
|
113
|
+
var item = path[pathindex];
|
|
114
|
+
if (cx >= item.length) {
|
|
115
|
+
path.pop();
|
|
116
|
+
pathcx.pop();
|
|
117
|
+
continue loop;
|
|
118
|
+
}
|
|
119
|
+
var elem = item[cx];
|
|
120
|
+
elem.parent = item;
|
|
121
|
+
result.push(elem);
|
|
122
|
+
pathcx[pathindex] = ++cx;
|
|
123
|
+
if (!skipClosed || !elem.isClosed()) {
|
|
124
|
+
if (elem.length) {
|
|
125
|
+
path.push(elem);
|
|
126
|
+
pathcx.push(0);
|
|
127
|
+
if (pathcx.length > max_deep) {
|
|
128
|
+
max_deep = pathcx.length;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
result.deep = max_deep;
|
|
134
|
+
return result;
|
|
135
|
+
}
|
|
136
|
+
static appendTo(parent, datas) {
|
|
137
|
+
var tab = parent && parent.tab + 1 || 1;
|
|
138
|
+
var length = parent.length;
|
|
139
|
+
for (var data of datas) {
|
|
140
|
+
if (isObject(data)) {
|
|
141
|
+
data.tab = tab;
|
|
142
|
+
var item = new Item(data);
|
|
143
|
+
item.parent = parent;
|
|
144
|
+
item.root = parent.root;
|
|
145
|
+
parent.push(item);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
var delta = parent.length - length;
|
|
149
|
+
while (parent) {
|
|
150
|
+
parent.count += delta;
|
|
151
|
+
parent = parent.parent;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
package/coms/basic/cookie.js
CHANGED
|
@@ -85,8 +85,16 @@ function getCookies(domainPath) {
|
|
|
85
85
|
} while (domain.length);
|
|
86
86
|
return serialize(cookieObject, ";");
|
|
87
87
|
}
|
|
88
|
+
|
|
89
|
+
function delCookies(domainPath) {
|
|
90
|
+
var splited = domainPath.split("/");
|
|
91
|
+
var domain = splited[0];
|
|
92
|
+
delete cookiesMap[domain];
|
|
93
|
+
}
|
|
94
|
+
|
|
88
95
|
return {
|
|
89
96
|
cookiesMap,
|
|
90
97
|
addCookie,
|
|
91
98
|
getCookies,
|
|
99
|
+
delCookies,
|
|
92
100
|
}
|
package/coms/basic/cross_.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var { getCookies, addCookie } = cookie;
|
|
1
|
+
var { getCookies, addCookie, delCookies } = cookie;
|
|
2
2
|
var { File } = this;
|
|
3
3
|
function isFile(a) {
|
|
4
4
|
if (File) {
|
|
@@ -11,7 +11,7 @@ var encrypt = null;
|
|
|
11
11
|
var domainReg = /^(?:(https?)\:)?\/\/(.*?)(?:\/(.*?))?([\?#].*)?$/i;
|
|
12
12
|
var setHost = function (host) {
|
|
13
13
|
base = host;
|
|
14
|
-
|
|
14
|
+
encrypt = null;
|
|
15
15
|
};
|
|
16
16
|
var HeadersKeys = ["Content-Type"];
|
|
17
17
|
var cors_hosts = [];
|
|
@@ -29,7 +29,7 @@ function isChildPath(relative, path) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
var getCrossUrl = function (domain, headers, encrypt) {
|
|
32
|
-
if (notCross(domain)) return domain;
|
|
32
|
+
if (notCross(domain, !!encrypt)) return domain;
|
|
33
33
|
var originDomain = getDomainPath(domain);
|
|
34
34
|
var _cookies = getCookies(originDomain);
|
|
35
35
|
var _headers = {};
|
|
@@ -45,7 +45,7 @@ var getCrossUrl = function (domain, headers, encrypt) {
|
|
|
45
45
|
.replace(/^(s?)(\/\/)/i, "http$1:$2")
|
|
46
46
|
.replace(domainReg, `$2${_headers}/$3$4`)
|
|
47
47
|
if (ishttps) domain = b + domain;
|
|
48
|
-
if (encrypt) domain = encode62.timeencode(domain);
|
|
48
|
+
if (encrypt) domain = encode62.timeencode(encode62.safeencode(domain, encrypt));
|
|
49
49
|
return base + b + domain;
|
|
50
50
|
};
|
|
51
51
|
function noop() { }
|
|
@@ -70,7 +70,6 @@ function cross_(jsonp, digest = noop, method, url, headers) {
|
|
|
70
70
|
}
|
|
71
71
|
var loaded, errored;
|
|
72
72
|
var onload = function (data) {
|
|
73
|
-
removeFromList(requests, xhr);
|
|
74
73
|
if (xhr.decoder) {
|
|
75
74
|
data = xhr.decoder(data);
|
|
76
75
|
}
|
|
@@ -79,13 +78,13 @@ function cross_(jsonp, digest = noop, method, url, headers) {
|
|
|
79
78
|
digest();
|
|
80
79
|
};
|
|
81
80
|
var onerror1 = function (e) {
|
|
82
|
-
removeFromList(requests, xhr);
|
|
83
81
|
errored = e || "未知错误!";
|
|
84
82
|
flush();
|
|
85
83
|
digest();
|
|
86
84
|
};
|
|
87
85
|
var onerror = async function (e) {
|
|
88
86
|
if (e.type === 'error') {
|
|
87
|
+
removeFromList(requests, e.target);
|
|
89
88
|
e = { response: "无法访问服务器", toString: toResponse };
|
|
90
89
|
}
|
|
91
90
|
for (var r of reforms) {
|
|
@@ -119,8 +118,12 @@ function cross_(jsonp, digest = noop, method, url, headers) {
|
|
|
119
118
|
xhr.onerror = onerror;
|
|
120
119
|
}
|
|
121
120
|
else {
|
|
122
|
-
var
|
|
121
|
+
var isencrypt = /^[夏商周秦xszq]/i.test(method);
|
|
122
|
+
if (isencrypt) method = method.slice(1);
|
|
123
|
+
var nocross = notCross(url, isencrypt);
|
|
124
|
+
if (nocross) isencrypt = false;
|
|
123
125
|
var callback = async function () {
|
|
126
|
+
removeFromList(requests, xhr);
|
|
124
127
|
var exposeHeaders = !nocross && xhr.getResponseHeader("access-control-expose-headers");
|
|
125
128
|
var exposeMap = {};
|
|
126
129
|
if (exposeHeaders) exposeHeaders.split(",").forEach(h => exposeMap[h.toLowerCase()] = true);
|
|
@@ -128,15 +131,30 @@ function cross_(jsonp, digest = noop, method, url, headers) {
|
|
|
128
131
|
var exposekey = nocross ? "set-cookie" : "efront-cookie";
|
|
129
132
|
if (exposeMap[exposekey]) {
|
|
130
133
|
var cookie = xhr.getResponseHeader(exposekey);
|
|
131
|
-
|
|
134
|
+
if (cookie && !xhr.nocookie) {
|
|
135
|
+
try {
|
|
136
|
+
if (isencrypt) cookie = encode62.safedecode(cookie, xhr.encrypt);
|
|
137
|
+
}
|
|
138
|
+
catch (e) {
|
|
139
|
+
onerror({ status: xhr.status, response: "Cookie解析异常!", toString: toResponse });
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
addCookie(cookie, originDomain);
|
|
143
|
+
}
|
|
144
|
+
|
|
132
145
|
}
|
|
133
146
|
}
|
|
134
147
|
if (isencrypt && xhr.response) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
148
|
+
try {
|
|
149
|
+
xhr = {
|
|
150
|
+
status: xhr.status,
|
|
151
|
+
response: encode62.safedecode(xhr.response || xhr.responseText, xhr.encrypt),
|
|
152
|
+
};
|
|
153
|
+
xhr.responseText = xhr.response;
|
|
154
|
+
}
|
|
155
|
+
catch (e) {
|
|
156
|
+
return onerror({ status: xhr.status, response: "数据无法解析!", toString: toResponse })
|
|
157
|
+
}
|
|
140
158
|
};
|
|
141
159
|
switch (xhr.status) {
|
|
142
160
|
case 0:
|
|
@@ -181,10 +199,8 @@ function cross_(jsonp, digest = noop, method, url, headers) {
|
|
|
181
199
|
var xhr = cross(callback, onerror);
|
|
182
200
|
var send = xhr.send;
|
|
183
201
|
xhr.toString = toResponse;
|
|
184
|
-
var isencrypt = /^[夏商周秦xszq]/i.test(method);
|
|
185
|
-
if (isencrypt) method = method.slice(1);
|
|
186
202
|
if (isencrypt && !encrypt) encrypt = cross.getCode();
|
|
187
|
-
xhr.encrypt = encrypt;
|
|
203
|
+
if (isencrypt) xhr.encrypt = encrypt;
|
|
188
204
|
xhr.json = xhr.data = xhr.send = function (data, value) {
|
|
189
205
|
if (!jsondata && !(isEmpty(data) && isEmpty(value))) jsondata = data instanceof Array ? [] : {};
|
|
190
206
|
if (FormData && data instanceof FormData) {
|
|
@@ -255,12 +271,12 @@ function cross_(jsonp, digest = noop, method, url, headers) {
|
|
|
255
271
|
extend(realHeaders, _headers);
|
|
256
272
|
xhr.open(method, url);
|
|
257
273
|
} else {
|
|
258
|
-
xhr.open(method, getCrossUrl(url, _headers, isencrypt));
|
|
274
|
+
xhr.open(method, getCrossUrl(url, _headers, isencrypt && code));
|
|
259
275
|
}
|
|
260
276
|
if (is_gb2312) xhr.overrideMimeType("text/plain; charset=gb2312");
|
|
261
|
-
|
|
277
|
+
delete realHeaders.Cookie;
|
|
262
278
|
Object.keys(realHeaders).forEach(key => setRequestHeader.call(xhr, key, realHeaders[key]));
|
|
263
|
-
if (!isEmpty(datas)) send.call(xhr,
|
|
279
|
+
if (!isEmpty(datas)) send.call(xhr, !isencrypt ? datas : encode62.safeencode(datas, code));
|
|
264
280
|
else send.call(xhr);
|
|
265
281
|
digest();
|
|
266
282
|
};
|
|
@@ -301,6 +317,11 @@ function cross_(jsonp, digest = noop, method, url, headers) {
|
|
|
301
317
|
removeFromList(requests, this);
|
|
302
318
|
if (isFunction(abort)) abort.call(this);
|
|
303
319
|
};
|
|
320
|
+
xhr.delCookies = function () {
|
|
321
|
+
delCookies(originDomain);
|
|
322
|
+
xhr.nocookie = true;
|
|
323
|
+
return xhr;
|
|
324
|
+
};
|
|
304
325
|
requests.push(xhr);
|
|
305
326
|
return xhr;
|
|
306
327
|
}
|
|
@@ -308,11 +329,10 @@ function addDirect(a) {
|
|
|
308
329
|
if (cors_hosts.indexOf(a) >= 0) return;
|
|
309
330
|
if (typeof a === 'string' || a instanceof RegExp) cors_hosts.push(a);
|
|
310
331
|
}
|
|
311
|
-
function notCross(domain) {
|
|
312
|
-
if (!base ||
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
domain.replace(domainReg, '$2') === base.replace(domainReg, '$2')) return true;
|
|
332
|
+
function notCross(domain, encrypt) {
|
|
333
|
+
if (!location_href || !base || !/^https?\:\/\/|^s?\/\//.test(domain)) return true;
|
|
334
|
+
if (location_href === domain.slice(0, location_href.length) ||
|
|
335
|
+
domain.replace(domainReg, '$2') === base.replace(domainReg, '$2')) return !encrypt;
|
|
316
336
|
for (var cx = 0, dx = cors_hosts.length; cx < dx; cx++) {
|
|
317
337
|
var host = cors_hosts[cx];
|
|
318
338
|
if (host instanceof RegExp) {
|
package/coms/layer/glance.js
CHANGED
|
@@ -9,11 +9,11 @@ var dragview = function (dragview) {
|
|
|
9
9
|
offsetWidth = menu.offsetWidth;
|
|
10
10
|
var { target } = event;
|
|
11
11
|
moving = null;
|
|
12
|
-
if (/(input|textarea)/i.test(target.tagName)) {
|
|
12
|
+
if (/(input|textarea|select)/i.test(target.tagName) || getTargetIn(a => a.nodrag || a.hasAttribute('nodrag') || a.dragable === false, event.target)) {
|
|
13
13
|
moving = false;
|
|
14
14
|
} else {
|
|
15
15
|
var { childNodes } = target;
|
|
16
|
-
for (var cx = 0, dx = childNodes.length; cx < dx; cx++) {
|
|
16
|
+
if (getComputedStyle(target).cursor === 'auto') for (var cx = 0, dx = childNodes.length; cx < dx; cx++) {
|
|
17
17
|
var child = childNodes[cx];
|
|
18
18
|
if (child.nodeType === 3) {
|
|
19
19
|
moving = false;
|
|
@@ -27,7 +27,7 @@ var dragview = function (dragview) {
|
|
|
27
27
|
break;
|
|
28
28
|
}
|
|
29
29
|
target = target.parentNode;
|
|
30
|
-
} while (target.nodeType == 1);
|
|
30
|
+
} while (target && target.nodeType == 1);
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
move(event) {
|
|
@@ -38,6 +38,7 @@ var dragview = function (dragview) {
|
|
|
38
38
|
) return;
|
|
39
39
|
var deltaX = savedX - event.clientX;
|
|
40
40
|
var deltaY = savedY - event.clientY;
|
|
41
|
+
event.preventDefault();
|
|
41
42
|
if (!moving) {
|
|
42
43
|
if (Math.abs(deltaX) < MOVELOCK_DELTA && Math.abs(deltaY) < MOVELOCK_DELTA) return;
|
|
43
44
|
if (Math.abs(deltaY) >= Math.abs(deltaX)) {
|
|
@@ -140,7 +141,7 @@ function main(mainPath, historyName = "") {
|
|
|
140
141
|
};
|
|
141
142
|
on("transitionend")(layer, function (event) {
|
|
142
143
|
if (event.target !== this) return;
|
|
143
|
-
dispatch(window, '
|
|
144
|
+
dispatch(window, 'resize');
|
|
144
145
|
});
|
|
145
146
|
layer.closeLeft = function () {
|
|
146
147
|
closed = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<select -model="host" @change="setHost(this.value)" direction=y
|
|
1
|
+
<select -model="host" @change="setHost(this.value)" direction=y editable -src="h in hosts"><option :value=h.key -text="h.name"></option></select>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
submit_
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var cloneProperties = "fontWeight,fontSize,fontFamily,color,textShadow,opacity,writingMode,blockSize,wordSpacing,letterSpacing,whiteSpace".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(",");
|
|
2
|
+
var cloneProperties2 = "position,backdropFilter,float,clear,margin,color,verticalAlign,textAlign,textShadow,opacity,boxShadow,overflow,textOverflow,wordBreak,webkitLineClamp,webkitBoxOrient,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);
|
package/coms/zimoli/data.js
CHANGED
|
@@ -348,6 +348,16 @@ var parseData = function (sourceText) {
|
|
|
348
348
|
};
|
|
349
349
|
|
|
350
350
|
function fixApi(api, href) {
|
|
351
|
+
if (/^\//.test(href)) {
|
|
352
|
+
var { protocol, host } = parseURL(location.href);
|
|
353
|
+
href = protocol + "//" + host + href;
|
|
354
|
+
}
|
|
355
|
+
else if (/^\.\//.test(href)) {
|
|
356
|
+
var { protocol, host, pathname } = parseURL(location.href);
|
|
357
|
+
href = href.slice(1);
|
|
358
|
+
if (pathname) href = pathname.replace(/\/[^\/\\]*$/, '') + href;
|
|
359
|
+
href = protocol + "//" + host + href;
|
|
360
|
+
};
|
|
351
361
|
api.transpile = getTranspile(api.url);
|
|
352
362
|
api.url = api.url.replace(/#[\s\S]*$/, '');
|
|
353
363
|
if (!reg.test(api.url)) {
|
package/coms/zimoli/gallery.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
var mountedGalleries = resizingList;
|
|
2
1
|
var complete_class = "complete";
|
|
3
2
|
var inadequate_class = "lack";
|
|
4
3
|
function bindScroll(elements) {
|
|
@@ -36,6 +35,7 @@ function gallery(element, minWidth, generator) {
|
|
|
36
35
|
|
|
37
36
|
var resize = function () {
|
|
38
37
|
var clientWidth = parseFloat(freePixel(element.clientWidth));
|
|
38
|
+
if (!clientWidth) return;
|
|
39
39
|
boxCount = clientWidth / minWidth | 0;
|
|
40
40
|
if (boxCount < 1) boxCount = 1;
|
|
41
41
|
element.paddingMax = boxCount;
|
|
@@ -47,19 +47,7 @@ function gallery(element, minWidth, generator) {
|
|
|
47
47
|
maxWidth: fromPixel(maxWidth),
|
|
48
48
|
});
|
|
49
49
|
};
|
|
50
|
-
|
|
51
|
-
mountedGalleries.push(element);
|
|
52
|
-
element.resize();
|
|
53
|
-
};
|
|
54
|
-
onappend(element, _onappend);
|
|
55
|
-
|
|
56
|
-
onremove(element, function () {
|
|
57
|
-
for (var cx = mountedGalleries.length - 1; cx >= 0; cx--) {
|
|
58
|
-
if (mountedGalleries[cx] === element) {
|
|
59
|
-
mountedGalleries.splice(cx, 1);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
});
|
|
50
|
+
resizingList.set(element);
|
|
63
51
|
var createColumn = function (id) {
|
|
64
52
|
var _box = list(function (index) {
|
|
65
53
|
var realindex = index * boxCount + id;
|
|
@@ -102,8 +90,6 @@ function gallery(element, minWidth, generator) {
|
|
|
102
90
|
index = realIndex / boxCount || 0;
|
|
103
91
|
element.go(index);
|
|
104
92
|
}, 0);
|
|
105
|
-
if (!element.renders) element.renders = [];
|
|
106
|
-
element.renders.unshift(element.resize);
|
|
107
93
|
care(element, function () {
|
|
108
94
|
var index = this.index();
|
|
109
95
|
this.clean();
|
|
@@ -1,53 +1 @@
|
|
|
1
|
-
|
|
2
|
-
function getTreeFromData(array) {
|
|
3
|
-
var root = [];
|
|
4
|
-
root.tab = -Infinity;
|
|
5
|
-
root.count = 0;
|
|
6
|
-
var map = {};
|
|
7
|
-
array = array.filter(a => !!a);
|
|
8
|
-
var active_item = null;
|
|
9
|
-
array.forEach(function (data) {
|
|
10
|
-
var item = new Item(data);
|
|
11
|
-
if (!active_item && item.isActived()) active_item = item;
|
|
12
|
-
if (data.id) {
|
|
13
|
-
map[data.id] = item;
|
|
14
|
-
} else {
|
|
15
|
-
root.push(item);
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
array.forEach(function (data) {
|
|
19
|
-
if (!data) return;
|
|
20
|
-
var parent = map[data.parentId];
|
|
21
|
-
if (parent) {
|
|
22
|
-
var item = map[data.id];
|
|
23
|
-
delete map[data.id];
|
|
24
|
-
if (parent) {
|
|
25
|
-
parent.push(item);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
var items = Object.keys(map).map(a => map[a]);
|
|
30
|
-
root.push.apply(root, items);
|
|
31
|
-
var tab = 0;
|
|
32
|
-
var run = function (item, parent) {
|
|
33
|
-
item.tab = tab;
|
|
34
|
-
var count = 0, total = 0;
|
|
35
|
-
item.parent = parent;
|
|
36
|
-
item.root = root;
|
|
37
|
-
if (item.length) {
|
|
38
|
-
tab++;
|
|
39
|
-
for (var cx = 0, dx = item.length; cx < dx; cx++) {
|
|
40
|
-
var i = item[cx];
|
|
41
|
-
run(i, parent);
|
|
42
|
-
count += i.count || 1;
|
|
43
|
-
total += i.total;
|
|
44
|
-
}
|
|
45
|
-
tab--;
|
|
46
|
-
}
|
|
47
|
-
item.total = total + item.length;
|
|
48
|
-
return item.count = count;
|
|
49
|
-
};
|
|
50
|
-
run(root);
|
|
51
|
-
root.actived = active_item;
|
|
52
|
-
return root;
|
|
53
|
-
}
|
|
1
|
+
Tree.fromData;
|
package/coms/zimoli/lattice.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
var mountedLattices = resizingList;
|
|
2
1
|
var complete_class = "complete";
|
|
3
2
|
var inadequate_class = "lack";
|
|
4
3
|
function lattice(element, minWidth, maxWidth = minWidth << 1, layers) {
|
|
5
4
|
var boxCount;
|
|
6
5
|
var resize = function () {
|
|
7
6
|
var _layers = layers || _box.src || [];
|
|
7
|
+
if (!_layers.length) return;
|
|
8
8
|
var clientWidth = parseFloat(freePixel(_box.clientWidth));
|
|
9
|
+
if (!clientWidth) return;
|
|
9
10
|
boxCount = clientWidth / minWidth | 0;
|
|
10
11
|
if (boxCount >= _layers.length) {
|
|
11
12
|
boxCount = _layers.length;
|
|
@@ -52,19 +53,16 @@ function lattice(element, minWidth, maxWidth = minWidth << 1, layers) {
|
|
|
52
53
|
if (element.with instanceof Array) element.with.forEach(build);
|
|
53
54
|
else if (isElement(element.with)) build(element.with);
|
|
54
55
|
};
|
|
56
|
+
var go = _box.go;
|
|
57
|
+
_box.go = function (value) {
|
|
58
|
+
resize();
|
|
59
|
+
if (!boxCount) return;
|
|
60
|
+
go.call(_box, value);
|
|
61
|
+
};
|
|
55
62
|
var _onappend = function () {
|
|
56
|
-
mountedLattices.push(_box);
|
|
57
63
|
_box.resize();
|
|
58
64
|
};
|
|
59
65
|
onappend(_box, _onappend);
|
|
60
|
-
|
|
61
|
-
onremove(_box, function () {
|
|
62
|
-
for (var cx = mountedLattices.length - 1; cx >= 0; cx--) {
|
|
63
|
-
if (mountedLattices[cx] === _box) {
|
|
64
|
-
mountedLattices.splice(cx, 1);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
66
|
_box.resize = lazy(function () {
|
|
69
67
|
var savedCount = boxCount;
|
|
70
68
|
var index = _box.index();
|
|
@@ -76,10 +74,9 @@ function lattice(element, minWidth, maxWidth = minWidth << 1, layers) {
|
|
|
76
74
|
[].forEach.call(_box.children, function (c) {
|
|
77
75
|
build(c);
|
|
78
76
|
});
|
|
79
|
-
|
|
77
|
+
go.call(_box, index);
|
|
80
78
|
}, 0);
|
|
81
|
-
|
|
82
|
-
_box.renders.unshift(_box.resize);
|
|
79
|
+
resizingList.set(_box);
|
|
83
80
|
on('resize')(_box, _box.resize);
|
|
84
81
|
return _box;
|
|
85
82
|
}
|
package/coms/zimoli/menu.js
CHANGED
|
@@ -153,22 +153,15 @@ function main(elem, mode) {
|
|
|
153
153
|
tree(elem, function (index, item, menu) {
|
|
154
154
|
var e = generator(index, item);
|
|
155
155
|
if (!e || e.children.length) return e;
|
|
156
|
-
var m = menuItem(null, menu, elem.useIcon);
|
|
156
|
+
var m = menuItem(null, menu, elem.useIcon[0]);
|
|
157
157
|
return m;
|
|
158
158
|
});
|
|
159
|
-
care(elem, function (
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
var src = this.src;
|
|
164
|
-
var hasIcon = false;
|
|
165
|
-
for (var cx = 0, dx = src; cx < dx; cx++) {
|
|
166
|
-
if (src[cx].icon) {
|
|
167
|
-
hasIcon = true;
|
|
168
|
-
break;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
159
|
+
care(elem, function (src) {
|
|
160
|
+
if (src) src = getTreeFromData(src);
|
|
161
|
+
var hasIcon = src.hasIcon;
|
|
162
|
+
JSON.stringify(src);
|
|
171
163
|
elem.useIcon = hasIcon;
|
|
164
|
+
elem.setData(src);
|
|
172
165
|
});
|
|
173
166
|
} else {
|
|
174
167
|
var nodes = getTreeNodes(elem);
|
package/coms/zimoli/menu.less
CHANGED
|
@@ -178,7 +178,7 @@ body:active & {
|
|
|
178
178
|
|
|
179
179
|
&.hover {
|
|
180
180
|
text-shadow: none;
|
|
181
|
-
color: #fff;
|
|
181
|
+
// color: #fff;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
}
|
|
@@ -188,17 +188,17 @@ body:active & {
|
|
|
188
188
|
line-height: 28px;
|
|
189
189
|
|
|
190
190
|
&.open {
|
|
191
|
-
color: #fff;
|
|
192
191
|
background: #1e282c;
|
|
193
|
-
|
|
192
|
+
|
|
194
193
|
& s:after {
|
|
195
194
|
top: -9.2px;
|
|
196
195
|
}
|
|
197
196
|
}
|
|
198
|
-
|
|
197
|
+
|
|
199
198
|
&.checked,
|
|
200
199
|
&.actived,
|
|
201
200
|
&.selected {
|
|
201
|
+
color: #fff;
|
|
202
202
|
border-left-color: #3c8dbc;
|
|
203
203
|
}
|
|
204
204
|
|