efront 3.5.10 → 3.5.11
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/main.js +2 -2
- package/apps/pivot/wow/root.js +1 -1
- package/coms/basic/JSAM.js +1 -1
- package/coms/basic/sortname.js +119 -0
- package/coms/frame/left.js +3 -1
- package/coms/frame/route.js +8 -6
- package/coms/layer/glance.js +2 -2
- package/coms/zimoli/zimoli.js +10 -4
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/apps/pivot/main.js
CHANGED
package/apps/pivot/wow/root.js
CHANGED
|
@@ -24,7 +24,7 @@ function main() {
|
|
|
24
24
|
if (p) p = String(p.name || '').replace(/\/$/, '');
|
|
25
25
|
if (p) this.pathlist.push(p);
|
|
26
26
|
this.data = data.from("folder", { opt: 'list', path: "/" + this.pathlist.join('/') }, files => {
|
|
27
|
-
if (files) return files.map(f => {
|
|
27
|
+
if (files) return sortname(files).map(f => {
|
|
28
28
|
return {
|
|
29
29
|
name: f,
|
|
30
30
|
type: /\/$/.test(f) ? 'folder' : 'file'
|
package/coms/basic/JSAM.js
CHANGED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
var minus = function (d1, d2) {
|
|
2
|
+
d1 = d1.split(".");
|
|
3
|
+
d2 = d2.split(".");
|
|
4
|
+
for (var cx = 0, dx = Math.max(d1.length, d2.length); cx < dx; cx++) {
|
|
5
|
+
var a = +d1[cx] || 0;
|
|
6
|
+
var b = +d2[cx] || 0;
|
|
7
|
+
if (a !== b) {
|
|
8
|
+
return a - b;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return 0;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
var createMap = function (str) {
|
|
15
|
+
str = str.split('');
|
|
16
|
+
var map = {};
|
|
17
|
+
for (var cx = 0, dx = str.length; cx < dx; cx++) {
|
|
18
|
+
map[str[cx]] = cx;
|
|
19
|
+
}
|
|
20
|
+
return map;
|
|
21
|
+
};
|
|
22
|
+
var 甲乙丙丁戊己庚辛壬癸 = "甲乙丙丁戊己庚辛壬癸";
|
|
23
|
+
|
|
24
|
+
var map一二三 = extend(createMap("零一二三四五六七八九"), createMap("〇壹贰叁肆伍陆柒捌玖"));
|
|
25
|
+
var power = {
|
|
26
|
+
拾: 10,
|
|
27
|
+
十: 10,
|
|
28
|
+
佰: 100,
|
|
29
|
+
百: 100,
|
|
30
|
+
仟: 1000,
|
|
31
|
+
千: 1000,
|
|
32
|
+
万: 10000,
|
|
33
|
+
萬: 10000,
|
|
34
|
+
亿: 100000000,
|
|
35
|
+
};
|
|
36
|
+
var parse一二三 = function (a) {
|
|
37
|
+
if (!/[十百千万亿拾佰仟萬]/.test(a)) return parseInt(a.split("").map(a => map一二三[a]).join(''));
|
|
38
|
+
var base = 0;
|
|
39
|
+
a.replace(/([^十百千万亿拾佰仟萬零〇]*)([十百千万亿拾佰仟萬]*)/g, function (_, a, b) {
|
|
40
|
+
if (!_) return;
|
|
41
|
+
if (!a) a = 1;
|
|
42
|
+
else a = map一二三[a];
|
|
43
|
+
var r = 1;
|
|
44
|
+
b.split('').forEach(b => r *= power[b]);
|
|
45
|
+
base += a * r;
|
|
46
|
+
})
|
|
47
|
+
return base;
|
|
48
|
+
};
|
|
49
|
+
var map甲乙丙 = createMap("甲乙丙丁戊己庚辛壬癸");
|
|
50
|
+
var map子丑寅 = createMap("子丑寅卯辰巳午未申酉戌亥");
|
|
51
|
+
|
|
52
|
+
var reg123 = /^(\d+|\d+[\.\d]+\d+)[\s\S]*$/;
|
|
53
|
+
var reg一二三 = /^([一二三四五六七八九十百千万亿壹贰叁肆伍陆柒捌玖拾佰仟萬零〇]+)[\s\S]*$/;
|
|
54
|
+
var reg甲乙丙 = /^([甲乙丙丁戊己庚辛壬癸])[\s\S]*$/;
|
|
55
|
+
var reg子丑寅 = /^([子丑寅卯辰巳午未申酉戌亥])[\s\S]*$/;
|
|
56
|
+
var reg天干地支 = /^([甲乙丙丁戊己庚辛壬癸][子丑寅卯辰巳午未申酉戌亥])[\s\S]*$/;
|
|
57
|
+
|
|
58
|
+
var getDelta = function (a, b, reg, parse) {
|
|
59
|
+
var match1 = reg.exec(a);
|
|
60
|
+
var match2 = reg.exec(b);
|
|
61
|
+
if (match1 && match2) {
|
|
62
|
+
var [, d1] = match1;
|
|
63
|
+
var [, d2] = match2;
|
|
64
|
+
if (parse) {
|
|
65
|
+
d1 = parse(d1);
|
|
66
|
+
d2 = parse(d2);
|
|
67
|
+
var delta = d1 - d2;
|
|
68
|
+
} else {
|
|
69
|
+
|
|
70
|
+
var delta = minus(d1, d2);
|
|
71
|
+
}
|
|
72
|
+
if (delta) return delta;
|
|
73
|
+
}
|
|
74
|
+
if (match1) return -1;
|
|
75
|
+
if (match2) return 1;
|
|
76
|
+
return 0;
|
|
77
|
+
};
|
|
78
|
+
var parse干支 = function (a) {
|
|
79
|
+
var [g, z] = a;
|
|
80
|
+
g = map甲乙丙[g];
|
|
81
|
+
z = map子丑寅[z];
|
|
82
|
+
return (12 + g - z) % 12 / 2 * 10 + g + 1;
|
|
83
|
+
};
|
|
84
|
+
var compare = function (a, b) {
|
|
85
|
+
for (var cx1 = a.length - 1, cx2 = a.length - 1; cx1 >= 0 && cx2 >= 0; cx1--, cx2--) {
|
|
86
|
+
while (/\s\u00a0/.test(a[cx1])) cx1--;
|
|
87
|
+
while (/\s\u00a0/.test(b[cx2])) cx2--;
|
|
88
|
+
if (a[cx1] !== b[cx2] || a[cx1] in map子丑寅 || a[cx1] in map一二三 || a in power) break;
|
|
89
|
+
}
|
|
90
|
+
a = a.slice(0, cx1 + 1);
|
|
91
|
+
b = b.slice(0, cx2 + 1);
|
|
92
|
+
for (var cx1 = 0, cx2 = 0, dx1 = a.length, dx2 = b.length; cx1 < dx1 && cx2 < dx2; cx1++, cx2++) {
|
|
93
|
+
while (/[\s\u00a0]/.test(a[cx1])) cx1++;
|
|
94
|
+
while (/[\s\u00a0]/.test(b[cx2])) cx2++;
|
|
95
|
+
if (a[cx1] !== b[cx2] || a[cx1] in map甲乙丙 || a[cx1] in map一二三 || a in power) break;
|
|
96
|
+
}
|
|
97
|
+
if (cx1) a = a.slice(cx1);
|
|
98
|
+
if (cx2) b = b.slice(cx2);
|
|
99
|
+
if (!a) return -1;
|
|
100
|
+
if (!b) return 1;
|
|
101
|
+
var delta = getDelta(a, b, reg123);
|
|
102
|
+
if (delta) return delta;
|
|
103
|
+
delta = getDelta(a, b, reg一二三, parse一二三);
|
|
104
|
+
if (delta) return delta;
|
|
105
|
+
delta = getDelta(a, b, reg天干地支, parse干支);
|
|
106
|
+
if (delta) return delta;
|
|
107
|
+
delta = getDelta(a, b, reg甲乙丙, d => map甲乙丙[d]);
|
|
108
|
+
if (delta) return delta;
|
|
109
|
+
delta = getDelta(a, b, reg子丑寅, d => map子丑寅[d]);
|
|
110
|
+
if (delta) return delta;
|
|
111
|
+
return 0;
|
|
112
|
+
}
|
|
113
|
+
function sortname(list = this) {
|
|
114
|
+
if (this !== arguments[1] && arguments.length === 2) {
|
|
115
|
+
return compare(arguments[0], arguments[1]);
|
|
116
|
+
}
|
|
117
|
+
list = list.sort(compare);
|
|
118
|
+
return list;
|
|
119
|
+
}
|
package/coms/frame/left.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
var page = document.createElement("都说我负天下人_可你们天下人_又何曾善待过我");
|
|
2
2
|
page.innerHTML = left;
|
|
3
3
|
if (!user.avatar) user.avatar = "user/avatar.png";
|
|
4
|
-
frame$route.fetch('menu.yml')
|
|
5
4
|
render(page, {
|
|
6
5
|
ylist: menu,
|
|
7
6
|
btn: button,
|
|
@@ -11,6 +10,9 @@ render(page, {
|
|
|
11
10
|
popup,
|
|
12
11
|
menus: frame$route,
|
|
13
12
|
});
|
|
13
|
+
on('append')(page, function () {
|
|
14
|
+
frame$route.open();
|
|
15
|
+
});
|
|
14
16
|
function main() {
|
|
15
17
|
return page;
|
|
16
18
|
}
|
package/coms/frame/route.js
CHANGED
|
@@ -98,9 +98,9 @@
|
|
|
98
98
|
if (!active || result.indexOf(active) < 0) {
|
|
99
99
|
actived = mmap[opened.active] || actived;
|
|
100
100
|
if (actived) {
|
|
101
|
-
if (actived_value === historys.length)
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
if (actived_value === historys.length) {
|
|
102
|
+
result.active = actived;
|
|
103
|
+
};
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
return result;
|
|
@@ -133,7 +133,10 @@
|
|
|
133
133
|
}
|
|
134
134
|
});
|
|
135
135
|
result.open = function (menu) {
|
|
136
|
-
if (!menu)
|
|
136
|
+
if (!menu) {
|
|
137
|
+
menu = result.active || result[0];
|
|
138
|
+
delete result.active;
|
|
139
|
+
}
|
|
137
140
|
if (!menu.path) {
|
|
138
141
|
menu.closed = !menu.closed;
|
|
139
142
|
return;
|
|
@@ -176,7 +179,6 @@
|
|
|
176
179
|
data.from(url).loading_promise.then(result.update);
|
|
177
180
|
return result;
|
|
178
181
|
};
|
|
179
|
-
|
|
180
|
-
|
|
182
|
+
result.update(items);
|
|
181
183
|
return result;
|
|
182
184
|
});
|
package/coms/layer/glance.js
CHANGED
|
@@ -104,10 +104,10 @@ function main(mainPath, historyName = "") {
|
|
|
104
104
|
}
|
|
105
105
|
zimoli();
|
|
106
106
|
};
|
|
107
|
-
if (leftPath) {
|
|
107
|
+
if (typeof leftPath === 'string') {
|
|
108
108
|
zimoli.prepare(leftPath, hook);
|
|
109
109
|
} else hook();
|
|
110
|
-
if (topPath) {
|
|
110
|
+
if (typeof topPath === 'string') {
|
|
111
111
|
zimoli.prepare(topPath, hook);
|
|
112
112
|
} else hook();
|
|
113
113
|
});
|
package/coms/zimoli/zimoli.js
CHANGED
|
@@ -337,11 +337,17 @@ function prepare(pgpath, ok) {
|
|
|
337
337
|
}, state);
|
|
338
338
|
}
|
|
339
339
|
function create(pagepath, args, from, needroles) {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
340
|
+
if (typeof pagepath === 'string') {
|
|
341
|
+
var page_object = isObject(pagepath) ? pagepath : page_generators[getpgpath(pagepath)];
|
|
342
|
+
if (!page_object) {
|
|
343
|
+
throw new Error(`调用create前请确保prepare执行完毕:${pagepath}`);
|
|
344
|
+
}
|
|
345
|
+
var { pg, "with": _with_elements, state, onback: _pageback_listener, roles } = page_object;
|
|
346
|
+
}
|
|
347
|
+
else if (isFunction(pagepath)) {
|
|
348
|
+
var pg = pagepath;
|
|
349
|
+
var { with: _with_elements, state = {}, onback: _pageback_listener, roles } = pg;
|
|
343
350
|
}
|
|
344
|
-
var { pg, "with": _with_elements, state, onback: _pageback_listener, roles } = page_object;
|
|
345
351
|
if (!checkroles(user.roles, roles) || !checkroles(user.roles, needroles)) {
|
|
346
352
|
// 检查权限
|
|
347
353
|
if (!user.isLogin && user.loginPath) {
|