efront 3.9.8 → 3.9.14
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 -1
- package/apps/pivot/auth/login.js +4 -5
- package/apps/pivot/home/welcome.js +1 -1
- package/apps/pivot/main.js +20 -8
- package/apps/pivot/task/invoke.html +3 -1
- package/apps/pivot/task/invoke.less +18 -6
- package/apps/pivot/wow/root.js +3 -3
- package/coms/basic/loader.js +9 -1
- package/coms/basic/parseURL.js +2 -2
- package/coms/basic/parseURL_test.js +7 -1
- package/coms/basic/seek.js +2 -1
- package/coms/basic/sortname.js +4 -4
- package/coms/frame/left.html +4 -4
- package/coms/frame/left.js +17 -14
- package/coms/frame/left.less +2 -1
- package/coms/pivot/left-header.html +1 -0
- package/coms/pivot/left-header.js +15 -0
- package/coms/pivot/left-header.less +11 -0
- package/coms/zimoli/alert.js +2 -0
- package/coms/zimoli/cless.js +1 -1
- package/coms/zimoli/cross.js +17 -1
- package/coms/zimoli/data.js +20 -10
- package/coms/zimoli/select.js +9 -4
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/apps/pivot/api.yml
CHANGED
package/apps/pivot/auth/login.js
CHANGED
|
@@ -23,14 +23,13 @@ function main() {
|
|
|
23
23
|
this.$scope.pending = true;
|
|
24
24
|
page.disabled = true;
|
|
25
25
|
try {
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
data.
|
|
29
|
-
var info = await data.from(login, {
|
|
26
|
+
var base = location.protocol + "//" + parseURL(this.$scope.data.host).host + "/";
|
|
27
|
+
data.setInstance("base", { base, host: parseURL(base).host });
|
|
28
|
+
var info = await data.from("login", {
|
|
30
29
|
a: encode62.timeencode(encode62.geta(password))
|
|
31
30
|
}).loading_promise;
|
|
32
31
|
info = encode62.timeupdate(info);
|
|
33
|
-
data.setSource(
|
|
32
|
+
data.setSource(base, info);
|
|
34
33
|
user.login({})
|
|
35
34
|
go('/main')
|
|
36
35
|
} catch (e) {
|
package/apps/pivot/main.js
CHANGED
|
@@ -1,26 +1,38 @@
|
|
|
1
1
|
data.loadConfig("api.yml");
|
|
2
2
|
user.loginPath = '/auth/login';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
data.setReporter(function (m, t) {
|
|
4
|
+
alert(m, t);
|
|
5
|
+
var base = data.getInstance("base").base;
|
|
6
|
+
data.setSource(base, '');
|
|
7
|
+
if (m.status === 401) location.reload();
|
|
8
|
+
});
|
|
7
9
|
data.bindInstance("base", async function (base) {
|
|
10
|
+
if (!base.base) return;
|
|
8
11
|
cross.addDirect(base.base);
|
|
9
12
|
var apimap = await data.getConfig();
|
|
10
13
|
for (var k in apimap) {
|
|
11
14
|
apimap[k].base = base.base;
|
|
12
15
|
}
|
|
13
16
|
});
|
|
17
|
+
var base = data.getInstance('base').base;
|
|
18
|
+
var token = base && data.getSource(base);
|
|
19
|
+
if (token) {
|
|
20
|
+
user.login({});
|
|
21
|
+
}
|
|
14
22
|
setInterval(function () {
|
|
15
|
-
var
|
|
16
|
-
if (!
|
|
23
|
+
var base = data.getInstance("base");
|
|
24
|
+
if (!base.base) return user.token = null;
|
|
25
|
+
var auth = data.getSource(base.base);
|
|
26
|
+
if (!auth) return user.token = null;
|
|
17
27
|
var auth1 = encode62.timeupdate(auth);
|
|
18
|
-
if (auth1 !== auth) data.setSource(
|
|
28
|
+
if (auth1 !== auth) data.setSource(base.base, auth1);
|
|
19
29
|
user.token = auth1;
|
|
20
30
|
}, 2000);
|
|
21
31
|
login();
|
|
22
32
|
var layer = layer$glance({
|
|
23
|
-
left: frame$left
|
|
33
|
+
left: frame$left.bind({
|
|
34
|
+
head: await init("left-header")
|
|
35
|
+
}),
|
|
24
36
|
top: frame$top
|
|
25
37
|
});
|
|
26
38
|
on("append")(layer, function () {
|
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
<close @click="remove()"></close>
|
|
5
5
|
</div>
|
|
6
6
|
<div body>
|
|
7
|
-
<div class="
|
|
7
|
+
<div class="top">
|
|
8
8
|
<field -repeat="f in fields" -src="[f,data]"></field>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="left">
|
|
9
11
|
<pre -text="task.code"></pre>
|
|
10
12
|
</div>
|
|
11
13
|
<div class="right" :class="{error:error}">
|
|
@@ -2,22 +2,34 @@
|
|
|
2
2
|
position: absolute;
|
|
3
3
|
width: 800px;
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
>[body]{
|
|
6
|
+
border-top: 50px solid transparent;
|
|
7
|
+
border-bottom: 50px solid transparent;
|
|
8
|
+
}
|
|
6
9
|
>[body]>div {
|
|
7
10
|
display: inline-block;
|
|
8
|
-
width: 50%;
|
|
9
11
|
vertical-align: top;
|
|
10
12
|
overflow: auto;
|
|
11
13
|
font-size: 12px;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
|
|
15
|
+
&.top {
|
|
16
|
+
left: 0;
|
|
17
|
+
top: 0;
|
|
18
|
+
width: 100%;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&.left,
|
|
22
|
+
&.right {
|
|
23
|
+
height: 100%;
|
|
24
|
+
width: 50%;
|
|
25
|
+
}
|
|
14
26
|
|
|
15
27
|
&.right {
|
|
16
28
|
background: #000;
|
|
17
29
|
color: #fff;
|
|
18
|
-
height: 100%;
|
|
19
30
|
}
|
|
20
|
-
|
|
31
|
+
|
|
32
|
+
&.error {
|
|
21
33
|
color: #c26;
|
|
22
34
|
}
|
|
23
35
|
}
|
package/apps/pivot/wow/root.js
CHANGED
|
@@ -10,7 +10,7 @@ function main() {
|
|
|
10
10
|
if (!$scope.pathlist.length) {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
|
-
$scope.pathlist.
|
|
13
|
+
data.setInstance("pathlist", $scope.pathlist.slice(0, -1));
|
|
14
14
|
$scope.open();
|
|
15
15
|
return false;
|
|
16
16
|
}
|
|
@@ -18,11 +18,11 @@ function main() {
|
|
|
18
18
|
|
|
19
19
|
renderWithDefaults(page, {
|
|
20
20
|
lattice,
|
|
21
|
-
pathlist:
|
|
21
|
+
pathlist: data.getInstance("pathlist"),
|
|
22
22
|
active: null,
|
|
23
23
|
open(p) {
|
|
24
24
|
if (p) p = String(p.name || '').replace(/\/$/, '');
|
|
25
|
-
if (p) this.pathlist.
|
|
25
|
+
if (p) data.setInstance("pathlist", this.pathlist.concat(p));
|
|
26
26
|
this.data = data.from("folder", { opt: 'list', path: "/" + this.pathlist.join('/') }, files => {
|
|
27
27
|
if (files) return sortname(files).map(f => {
|
|
28
28
|
return {
|
package/coms/basic/loader.js
CHANGED
|
@@ -503,11 +503,19 @@ var createModule = function (exec, originNames, compiledNames, prebuilds = {}) {
|
|
|
503
503
|
var promise = new Promise(function (ok) {
|
|
504
504
|
_ok = ok;
|
|
505
505
|
});
|
|
506
|
+
if (prebuilds.init) {
|
|
507
|
+
var prebuilds2 = Object.create(null);
|
|
508
|
+
for (var k in prebuilds) prebuilds2[k] = prebuilds[k];
|
|
509
|
+
prebuilds = prebuilds2;
|
|
510
|
+
delete prebuilds.popup;
|
|
511
|
+
delete prebuilds.action;
|
|
512
|
+
delete prebuilds.init;
|
|
513
|
+
}
|
|
506
514
|
init(argName, function (res) {
|
|
507
515
|
result = res;
|
|
508
516
|
created = true;
|
|
509
517
|
_ok(res);
|
|
510
|
-
});
|
|
518
|
+
}, prebuilds);
|
|
511
519
|
if (created) return result;
|
|
512
520
|
return promise;
|
|
513
521
|
});
|
package/coms/basic/parseURL.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// -------/// ---------------1
|
|
2
|
-
var reg = /^([
|
|
1
|
+
// -------/// ---------------1---------------------------------///////////////////2-----3--------//////// ------4----2/////5---------------------------------------------------6-----------------------------------------------------------------------------//////////////-7--5///8-------9----------//10--11---10///--12-----8//
|
|
2
|
+
var reg = /^([^\:\/\\\?#\[]+\:(?![^\:\/\\\?\#]*@|[\/\\][^\/\\]))?(?:\/\/|\\\\)?(?:(([^\:\/\\\?#]+)?(?:\:([^\/\\\?#]+))?)@)?(([^\/\\@\?\#\.]*?[^\/\\@\:\?\#\.\d][^\/\\@\:\?\#\.]*?|[^\/\\@\:\?\#\.]+(?:\:[\@\/\\\?#\.]*[^\d\@\:\/\\\?#\.]+|\.[^\/\\@\:\?\#]+?))?(?:(?:\:|^)(\d+))?)(((?:\/|\\|^)[^\?#]*)?(\?([^#]*))?(#[\s\S]*)?)$/;
|
|
3
3
|
function parseURL(url) {
|
|
4
4
|
if (url === undefined || url === null) url = '';
|
|
5
5
|
var [__, protocol, auth, username, password, host, hostname, port, path, pathname, search, query, hash] = reg.exec(url);
|
|
@@ -36,4 +36,10 @@ test("http://[::]/", "host", "[::]")
|
|
|
36
36
|
test("http://[::%12]/", "host", "[::%12]")
|
|
37
37
|
test("http://[::]:80/", "hostname", "[::]")
|
|
38
38
|
test("[::]:80/", "hostname", "[::]")
|
|
39
|
-
test("[fd64:f52:f52:f52:f52:f52:f52:97]", "hostname", "[fd64:f52:f52:f52:f52:f52:f52:97]")
|
|
39
|
+
test("[fd64:f52:f52:f52:f52:f52:f52:97]", "hostname", "[fd64:f52:f52:f52:f52:f52:f52:97]")
|
|
40
|
+
test("./cluster-opt.html", "pathname", "./cluster-opt.html")
|
|
41
|
+
test(":cluster-opt.html", "pathname", ":cluster-opt.html")
|
|
42
|
+
test("d:/cluster-opt.html", "pathname", "d:/cluster-opt.html")
|
|
43
|
+
test("d:\\cluster-opt.html", "pathname", "d:\\cluster-opt.html")
|
|
44
|
+
test("ftp:\\\\cluster-opt.html", "host", "cluster-opt.html")
|
|
45
|
+
test("\\\\cluster-opt.html", "host", "cluster-opt.html")
|
package/coms/basic/seek.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
var seek = function (object, seeker) {
|
|
2
|
-
if (seeker === null || seeker === undefined ||
|
|
2
|
+
if (seeker === null || seeker === undefined || isEmpty(object)) return;
|
|
3
3
|
if (seeker instanceof Function) {
|
|
4
4
|
return seeker(object);
|
|
5
5
|
}
|
|
6
6
|
if (typeof seeker === "string") {
|
|
7
7
|
if (/^(['"`])[\s\S]*$/i.test(seeker)) return seeker.replace(/^(['"`])([\s\S*])\1?$/, "$2");
|
|
8
|
+
if (seeker === '' || seeker === ".") return object;
|
|
8
9
|
seeker = seeker.split(".");
|
|
9
10
|
}
|
|
10
11
|
if (seeker instanceof Array) {
|
package/coms/basic/sortname.js
CHANGED
|
@@ -82,17 +82,17 @@ var parse干支 = function (a) {
|
|
|
82
82
|
return (12 + g - z) % 12 / 2 * 10 + g + 1;
|
|
83
83
|
};
|
|
84
84
|
var compare = function (a, b) {
|
|
85
|
-
for (var cx1 = a.length - 1, cx2 =
|
|
85
|
+
for (var cx1 = a.length - 1, cx2 = b.length - 1; cx1 >= 0 && cx2 >= 0; cx1--, cx2--) {
|
|
86
86
|
while (/\s\u00a0/.test(a[cx1])) cx1--;
|
|
87
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;
|
|
88
|
+
if (a[cx1] !== b[cx2] || a[cx1] in map子丑寅 || a[cx1] in map一二三 || a in power || /^\d$/.test(a[cx1])) break;
|
|
89
89
|
}
|
|
90
90
|
a = a.slice(0, cx1 + 1);
|
|
91
91
|
b = b.slice(0, cx2 + 1);
|
|
92
|
-
for (var cx1 = 0, cx2 = 0, dx1 =
|
|
92
|
+
for (var cx1 = 0, cx2 = 0, dx1 = b.length, dx2 = b.length; cx1 < dx1 && cx2 < dx2; cx1++, cx2++) {
|
|
93
93
|
while (/[\s\u00a0]/.test(a[cx1])) cx1++;
|
|
94
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;
|
|
95
|
+
if (a[cx1] !== b[cx2] || a[cx1] in map甲乙丙 || a[cx1] in map一二三 || a in power || /^\d/.test(a[cx1])) break;
|
|
96
96
|
}
|
|
97
97
|
if (cx1) a = a.slice(cx1);
|
|
98
98
|
if (cx2) b = b.slice(cx2);
|
package/coms/frame/left.html
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
<
|
|
1
|
+
<header ng-if="!user.isLogin" class="navbar-header">
|
|
2
2
|
<!-- <avatar></avatar> -->
|
|
3
3
|
<a @click="popup('#/user/login')" class="dashboard_text">请登录</a>
|
|
4
|
-
</
|
|
5
|
-
<
|
|
4
|
+
</header>
|
|
5
|
+
<header -else class="navbar-header">
|
|
6
6
|
<span class="dashboard_text" @click="go('/user/profile')">
|
|
7
7
|
<avatar ng-src="user.avatar" size=30></avatar>
|
|
8
8
|
<span ng-bind="user.name"></span>
|
|
9
9
|
<span ng-bind="user.roles"></span>
|
|
10
10
|
</span>
|
|
11
|
-
</
|
|
11
|
+
</header>
|
|
12
12
|
<ylist mode=inline ng-src="menu in menus" class="sidebar-menu" ng-active="menus.open(event.value)">
|
|
13
13
|
</ylist>
|
package/coms/frame/left.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
var page = document.createElement("都说我负天下人_可你们天下人_又何曾善待过我");
|
|
2
|
-
page.innerHTML = left;
|
|
3
1
|
if (!user.avatar) user.avatar = "user/avatar.png";
|
|
4
|
-
render(page, {
|
|
5
|
-
ylist: menu,
|
|
6
|
-
btn: button,
|
|
7
|
-
go,
|
|
8
|
-
user,
|
|
9
|
-
avatar,
|
|
10
|
-
popup,
|
|
11
|
-
menus: frame$route,
|
|
12
|
-
});
|
|
13
|
-
on('append')(page, function () {
|
|
14
|
-
frame$route.open();
|
|
15
|
-
});
|
|
16
2
|
function main() {
|
|
3
|
+
var page = document.createElement("都说我负天下人_可你们天下人_又何曾善待过我");
|
|
4
|
+
page.innerHTML = template;
|
|
5
|
+
var { head, foot, header = head, footer = foot } = this;
|
|
6
|
+
render(page, extend({
|
|
7
|
+
ylist: menu,
|
|
8
|
+
btn: button,
|
|
9
|
+
go,
|
|
10
|
+
user,
|
|
11
|
+
avatar,
|
|
12
|
+
header,
|
|
13
|
+
footer,
|
|
14
|
+
popup,
|
|
15
|
+
menus: frame$route,
|
|
16
|
+
}, this));
|
|
17
|
+
on('append')(page, function () {
|
|
18
|
+
frame$route.open();
|
|
19
|
+
});
|
|
17
20
|
return page;
|
|
18
21
|
}
|
package/coms/frame/left.less
CHANGED
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
.navbar-header {
|
|
7
|
-
height: 50px;
|
|
7
|
+
min-height: 50px;
|
|
8
8
|
padding: 10px 15px 10px 25px;
|
|
9
9
|
font-size: 25px;
|
|
10
10
|
line-height: 25px;
|
|
11
11
|
text-transform: uppercase;
|
|
12
12
|
color: #b8c7ce;
|
|
13
13
|
margin-top: -50px;
|
|
14
|
+
display: block;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
.dashboard_text {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<select -model="host" @change="setHost(this.value)" direction=y addable><option -repeat="h in hosts" :value=h.key -text="h.name"></option></select>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
function main() {
|
|
2
|
+
var a = document.createElement("菜单之上");
|
|
3
|
+
a.innerHTML = template;
|
|
4
|
+
render(a, {
|
|
5
|
+
setHost(a) {
|
|
6
|
+
data.setInstance("base", { base: location.protocol + "//" + a + "/", host: a });
|
|
7
|
+
data.abortAll();
|
|
8
|
+
zimoli();
|
|
9
|
+
},
|
|
10
|
+
host: data.getInstance("base").host,
|
|
11
|
+
select,
|
|
12
|
+
hosts: data.getInstance("hosts")
|
|
13
|
+
});
|
|
14
|
+
return a;
|
|
15
|
+
}
|
package/coms/zimoli/alert.js
CHANGED
package/coms/zimoli/cless.js
CHANGED
|
@@ -8,7 +8,7 @@ function create(commFactory, className) {
|
|
|
8
8
|
}
|
|
9
9
|
if (isFunction(commFactory)) {
|
|
10
10
|
var result = function () {
|
|
11
|
-
var commRelease = commFactory.apply(result, arguments);
|
|
11
|
+
var commRelease = commFactory.apply(this || result, arguments);
|
|
12
12
|
if (commRelease) {
|
|
13
13
|
commRelease = create(commRelease, className);
|
|
14
14
|
}
|
package/coms/zimoli/cross.js
CHANGED
|
@@ -154,13 +154,19 @@ function cross(method, url, headers) {
|
|
|
154
154
|
xhr.onerror = function (e) {
|
|
155
155
|
onerror(e);
|
|
156
156
|
};
|
|
157
|
+
xhr.abort = function () {
|
|
158
|
+
removeFromList(requests, this);
|
|
159
|
+
remove(this);
|
|
160
|
+
};
|
|
157
161
|
} else {
|
|
158
162
|
var nocross = notCross(url);
|
|
159
163
|
var xhr = new XMLHttpRequest;
|
|
160
164
|
var abort = xhr.abort;
|
|
161
165
|
xhr.abort = function () {
|
|
162
166
|
xhr.onreadystatechange = null;
|
|
167
|
+
removeFromList(requests, this);
|
|
163
168
|
abort.call(this);
|
|
169
|
+
clearTimeout(sendtimer);
|
|
164
170
|
};
|
|
165
171
|
|
|
166
172
|
xhr.onreadystatechange = function () {
|
|
@@ -217,7 +223,7 @@ function cross(method, url, headers) {
|
|
|
217
223
|
onerrors.push(oh);
|
|
218
224
|
flush();
|
|
219
225
|
};
|
|
220
|
-
setTimeout(function () {
|
|
226
|
+
var sendtimer = setTimeout(function () {
|
|
221
227
|
digest();
|
|
222
228
|
var isform = /^f/i.test(method);
|
|
223
229
|
if (isform) {
|
|
@@ -252,6 +258,7 @@ function cross(method, url, headers) {
|
|
|
252
258
|
}
|
|
253
259
|
var loaded, errored;
|
|
254
260
|
var onload = function (xhr) {
|
|
261
|
+
removeFromList(requests, xhr);
|
|
255
262
|
if (xhr.decoder) {
|
|
256
263
|
xhr = xhr.decoder(xhr);
|
|
257
264
|
}
|
|
@@ -260,6 +267,7 @@ function cross(method, url, headers) {
|
|
|
260
267
|
digest();
|
|
261
268
|
};
|
|
262
269
|
var onerror = function (xhr) {
|
|
270
|
+
removeFromList(requests, xhr);
|
|
263
271
|
errored = xhr;
|
|
264
272
|
flush();
|
|
265
273
|
digest();
|
|
@@ -317,6 +325,7 @@ function cross(method, url, headers) {
|
|
|
317
325
|
flush();
|
|
318
326
|
return xhr;
|
|
319
327
|
};
|
|
328
|
+
requests.push(xhr);
|
|
320
329
|
return xhr;
|
|
321
330
|
}
|
|
322
331
|
function addDirect(a) {
|
|
@@ -335,7 +344,14 @@ function notCross(domain) {
|
|
|
335
344
|
}
|
|
336
345
|
return false;
|
|
337
346
|
}
|
|
347
|
+
|
|
348
|
+
var requests = [];
|
|
338
349
|
extend(cross, {
|
|
350
|
+
requests,
|
|
351
|
+
abortAll() {
|
|
352
|
+
var rs = requests.splice(0, requests.length);
|
|
353
|
+
for (var r of rs) r.abort();
|
|
354
|
+
},
|
|
339
355
|
setHost,
|
|
340
356
|
getCookies,
|
|
341
357
|
addCookie,
|
package/coms/zimoli/data.js
CHANGED
|
@@ -72,7 +72,13 @@ const formulaters = {
|
|
|
72
72
|
return formulate(data, params);
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
-
|
|
75
|
+
var seekFromSource = function (obj, base) {
|
|
76
|
+
var source = dataSourceMap;
|
|
77
|
+
if (base && base in dataSourceMap) source = source[base];
|
|
78
|
+
obj = seek(source, obj);
|
|
79
|
+
if (isObject(obj)) for (var k in obj) if (obj[k] === dataSourceMap) delete obj[k];
|
|
80
|
+
return obj;
|
|
81
|
+
};
|
|
76
82
|
function getErrorMessage(error = this) {
|
|
77
83
|
if (!isObject(error)) return String(error);
|
|
78
84
|
if (error instanceof Error) return String(error);
|
|
@@ -543,7 +549,7 @@ var privates = {
|
|
|
543
549
|
if (!promise || currentTime - promise.time > 60 || temp !== promise.params || promise.search !== search) {
|
|
544
550
|
var promise = new Promise(function (ok, oh) {
|
|
545
551
|
if (headers) {
|
|
546
|
-
headers =
|
|
552
|
+
headers = seekFromSource(headers, api.base);
|
|
547
553
|
}
|
|
548
554
|
cross(realmethod, uri, headers).send(params).done(e => {
|
|
549
555
|
ok(e.response || e.responseText);
|
|
@@ -555,6 +561,7 @@ var privates = {
|
|
|
555
561
|
oh(error);
|
|
556
562
|
}
|
|
557
563
|
});
|
|
564
|
+
updateLoadingCount();
|
|
558
565
|
});
|
|
559
566
|
promise.search = search;
|
|
560
567
|
promise.params = temp;
|
|
@@ -609,7 +616,6 @@ var loadInstance = function (storage, id) {
|
|
|
609
616
|
};
|
|
610
617
|
|
|
611
618
|
function responseCrash(e, data) {
|
|
612
|
-
if (data.is_loading) this.loading_count--;
|
|
613
619
|
data.is_errored = true;
|
|
614
620
|
data.is_loading = false;
|
|
615
621
|
data.error_message = getErrorMessage(e);
|
|
@@ -619,19 +625,24 @@ function responseCrash(e, data) {
|
|
|
619
625
|
} else {
|
|
620
626
|
data.error = e;
|
|
621
627
|
}
|
|
622
|
-
error_report(
|
|
628
|
+
error_report(e, e.status < 500 ? 'warn' : 'error');
|
|
629
|
+
updateLoadingCount();
|
|
623
630
|
}
|
|
624
631
|
var getData = function () { return this.data };
|
|
632
|
+
var updateLoadingCount = function () {
|
|
633
|
+
data.loading_count = cross.requests.length;
|
|
634
|
+
};
|
|
625
635
|
var data = {
|
|
626
636
|
decodeStructure,
|
|
627
637
|
encodeStructure,
|
|
638
|
+
abortAll: cross.abortAll,
|
|
628
639
|
responseLoaded(response) {
|
|
629
640
|
if (isObject(response)) {
|
|
630
641
|
response.is_loaded = true;
|
|
631
642
|
response.is_loading = false;
|
|
632
643
|
if (response.then === LoadingArray_then) delete response.then;
|
|
633
644
|
}
|
|
634
|
-
|
|
645
|
+
updateLoadingCount();
|
|
635
646
|
},
|
|
636
647
|
responseCrash,
|
|
637
648
|
responseLoading(response) {
|
|
@@ -640,7 +651,6 @@ var data = {
|
|
|
640
651
|
response.is_loading = true;
|
|
641
652
|
response.then = LoadingArray_then;
|
|
642
653
|
}
|
|
643
|
-
this.loading_count++;
|
|
644
654
|
},
|
|
645
655
|
setReporter(report, checker) {
|
|
646
656
|
if (report instanceof Function) {
|
|
@@ -840,7 +850,6 @@ var data = {
|
|
|
840
850
|
if (promise1 !== instance.loading_promise) throw outdate;
|
|
841
851
|
if (instance.loading) {
|
|
842
852
|
instance.loading.abort();
|
|
843
|
-
data.loading_count--;
|
|
844
853
|
}
|
|
845
854
|
this.responseLoading(instance);
|
|
846
855
|
var params = privates.pack(sid, params1);
|
|
@@ -852,7 +861,7 @@ var data = {
|
|
|
852
861
|
var promise = new Promise(function (ok, oh) {
|
|
853
862
|
var headers = api.headers;
|
|
854
863
|
if (headers) {
|
|
855
|
-
headers =
|
|
864
|
+
headers = seekFromSource(headers, api.base);
|
|
856
865
|
}
|
|
857
866
|
instance.loading = cross(method, uri, headers).send(params).done(xhr => {
|
|
858
867
|
if (instance.loading !== xhr) return oh(aborted);
|
|
@@ -862,11 +871,13 @@ var data = {
|
|
|
862
871
|
if (instance.loading !== xhr) return oh(aborted);
|
|
863
872
|
instance.loading = null;
|
|
864
873
|
try {
|
|
865
|
-
|
|
874
|
+
var e = getErrorMessage(parseData(xhr.response || xhr.responseText || xhr.statusText || xhr.status));
|
|
875
|
+
oh({ status: xhr.status, error: e, toString: getErrorMessage })
|
|
866
876
|
} catch (error) {
|
|
867
877
|
oh(error);
|
|
868
878
|
}
|
|
869
879
|
});
|
|
880
|
+
updateLoadingCount();
|
|
870
881
|
}).then(function (response) {
|
|
871
882
|
return transpile(seekResponse(parseData(response), selector), api.transpile, api.root);
|
|
872
883
|
});
|
|
@@ -884,7 +895,6 @@ var data = {
|
|
|
884
895
|
});
|
|
885
896
|
promise1.catch((e) => {
|
|
886
897
|
if (e === outdate) return;
|
|
887
|
-
if (e === aborted) return data.loading_count--;
|
|
888
898
|
this.responseCrash(e, instance);
|
|
889
899
|
});
|
|
890
900
|
|
package/coms/zimoli/select.js
CHANGED
|
@@ -42,6 +42,9 @@ function select(target, list, removeOnSelect, direction) {
|
|
|
42
42
|
direction = removeOnSelect;
|
|
43
43
|
removeOnSelect = arguments[3];
|
|
44
44
|
}
|
|
45
|
+
if (direction === undefined) {
|
|
46
|
+
direction = target.getAttribute("direction") || target.direction;
|
|
47
|
+
}
|
|
45
48
|
if (!target) {
|
|
46
49
|
target = document.createElement("select");
|
|
47
50
|
}
|
|
@@ -63,11 +66,13 @@ function select(target, list, removeOnSelect, direction) {
|
|
|
63
66
|
var onlistchange = function () {
|
|
64
67
|
if (target.multiple) {
|
|
65
68
|
} else {
|
|
66
|
-
if (
|
|
67
|
-
|
|
69
|
+
if (target.value !== this.value) {
|
|
70
|
+
if (!savedOptions) {
|
|
71
|
+
target.innerHTML = `<option selected value="${this.value}">${this.name || this.value}</option>`
|
|
72
|
+
}
|
|
73
|
+
target.value = this.value;
|
|
74
|
+
dispatch(target, "change");
|
|
68
75
|
}
|
|
69
|
-
target.value = this.value;
|
|
70
|
-
dispatch(target, "change");
|
|
71
76
|
}
|
|
72
77
|
};
|
|
73
78
|
var onlistclick = function (event) {
|