efront 3.6.0 → 3.7.0
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 +2 -0
- package/apps/pivot/home/welcome.html +5 -1
- package/apps/pivot/main.js +3 -0
- package/apps/pivot/menu.yml +1 -0
- package/apps/pivot/token/edit.js +9 -0
- package/apps/pivot/token/list.js +13 -0
- package/coms/basic/loader.js +42 -17
- package/coms/crypt/encode62.js +3 -1
- package/coms/frame/edit.html +10 -0
- package/coms/frame/edit.js +29 -0
- package/coms/frame/edit.less +0 -0
- package/coms/frame/list.html +4 -0
- package/coms/frame/list.js +64 -0
- package/coms/frame/list.less +3 -0
- package/coms/zimoli/LoadingArray.ts +3 -0
- package/coms/zimoli/data.js +0 -2
- package/coms/zimoli/encode62.js +3 -2
- package/coms/zimoli/table.html +2 -1
- package/coms/zimoli/zimoli.js +22 -2
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/apps/pivot/api.yml
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
<div>
|
|
3
2
|
已登录到服务器,您可以进行如下操作
|
|
4
3
|
</div>
|
|
@@ -7,6 +6,11 @@
|
|
|
7
6
|
清理服务器缓存 <btn @click="run('clear-cache',this)">清理</btn>
|
|
8
7
|
</padding>
|
|
9
8
|
</block>
|
|
9
|
+
<block>
|
|
10
|
+
<padding>
|
|
11
|
+
重启服务器 <btn @click="run('rehost',this)" type="danger">重启</btn>
|
|
12
|
+
</padding>
|
|
13
|
+
</block>
|
|
10
14
|
<block>
|
|
11
15
|
<padding>
|
|
12
16
|
退出登录 <btn @click="logout()">退出</btn>
|
package/apps/pivot/main.js
CHANGED
package/apps/pivot/menu.yml
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
frame$list.bind(null, "密钥管理", {
|
|
2
|
+
load() {
|
|
3
|
+
return data.from("private-list", a => JSAM.parse(encode62.timedecode(a)));
|
|
4
|
+
},
|
|
5
|
+
remove(o) {
|
|
6
|
+
return data.from("private-edit", { key: encode62.timeencode(o.key), value: encode62.timeencode("") }).loading_promise;
|
|
7
|
+
},
|
|
8
|
+
fields: refilm`
|
|
9
|
+
显示名/name input
|
|
10
|
+
*键名/key
|
|
11
|
+
密钥/value
|
|
12
|
+
备注/comment
|
|
13
|
+
`}, "/token/edit");
|
package/coms/basic/loader.js
CHANGED
|
@@ -521,39 +521,63 @@ var createModule = function (exec, originNames, compiledNames, prebuilds = {}) {
|
|
|
521
521
|
return exec.apply(_this, args);
|
|
522
522
|
});
|
|
523
523
|
};
|
|
524
|
-
var bindthen = function (callback) {
|
|
525
|
-
return function (data) {
|
|
526
|
-
if (Promise && data instanceof Promise) {
|
|
527
|
-
data.then(callback);
|
|
528
|
-
} else {
|
|
529
|
-
callback(data);
|
|
530
|
-
}
|
|
531
|
-
};
|
|
532
|
-
};
|
|
533
|
-
|
|
534
524
|
|
|
535
525
|
var init = function (name, then, prebuilds) {
|
|
536
|
-
then = bindthen(then);
|
|
526
|
+
// then = bindthen(then);
|
|
537
527
|
var key = keyprefix + name;
|
|
538
528
|
if (prebuilds) {
|
|
539
529
|
if (name in prebuilds) {
|
|
540
|
-
|
|
530
|
+
if (then) then(prebuilds[name]);
|
|
531
|
+
return prebuilds[name];
|
|
541
532
|
}
|
|
542
533
|
}
|
|
543
534
|
if (hasOwnProperty.call(modules, name)) {
|
|
544
|
-
then(modules[name]);
|
|
545
|
-
return;
|
|
535
|
+
if (then) then(modules[name]);
|
|
536
|
+
return modules[name];
|
|
546
537
|
}
|
|
547
538
|
if (window[name] !== null && window[name] !== void 0 && !hasOwnProperty.call(forceRequest, name)) {
|
|
548
|
-
|
|
549
|
-
|
|
539
|
+
modules[name] = window[name]
|
|
540
|
+
if (then) then(modules[name]);
|
|
541
|
+
return modules[name];
|
|
550
542
|
}
|
|
543
|
+
var oks = [];
|
|
544
|
+
if (then) oks.push(then);
|
|
545
|
+
var ohs = [];
|
|
546
|
+
var res = {
|
|
547
|
+
oks,
|
|
548
|
+
ohs,
|
|
549
|
+
resolved: null,
|
|
550
|
+
errored: null,
|
|
551
|
+
then(ok, oh) {
|
|
552
|
+
if (ok) this.oks.push(ok);
|
|
553
|
+
if (oh) this.ohs.push(oh);
|
|
554
|
+
this.fire();
|
|
555
|
+
},
|
|
556
|
+
fire() {
|
|
557
|
+
if (this.resolved || this.errored) {
|
|
558
|
+
var oks = this.oks.splice(0, this.oks.length);
|
|
559
|
+
var ohs = this.ohs.splice(0, this.ohs.length);
|
|
560
|
+
if (this.resolved) for (var o of oks) o(this.resolved);
|
|
561
|
+
if (this.errored) for (var o of ohs) o(this.errored);
|
|
562
|
+
}
|
|
563
|
+
},
|
|
564
|
+
};
|
|
565
|
+
then = function (created) {
|
|
566
|
+
if (Promise && created instanceof Promise) return created.then(then, crack);
|
|
567
|
+
res.resolved = created;
|
|
568
|
+
res.fire();
|
|
569
|
+
};
|
|
570
|
+
var crack = function (error) {
|
|
571
|
+
res.errored = error;
|
|
572
|
+
res.fire();
|
|
573
|
+
};
|
|
551
574
|
loadModule(name, function (error) {
|
|
552
575
|
if (hasOwnProperty.call(modules, name)) {
|
|
553
576
|
then(modules[name]);
|
|
554
577
|
return;
|
|
555
578
|
}
|
|
556
|
-
if (error) return;
|
|
579
|
+
if (error) return crack(error);
|
|
580
|
+
|
|
557
581
|
var module = loadedModules[key];
|
|
558
582
|
var args = module.args || [];
|
|
559
583
|
|
|
@@ -593,6 +617,7 @@ var init = function (name, then, prebuilds) {
|
|
|
593
617
|
|
|
594
618
|
then(created);
|
|
595
619
|
}, prebuilds);
|
|
620
|
+
return res;
|
|
596
621
|
};
|
|
597
622
|
var forceRequest = {};
|
|
598
623
|
var removeGlobalProperty = function (property) {
|
package/coms/crypt/encode62.js
CHANGED
|
@@ -31,7 +31,8 @@ Object.assign(encode62, {
|
|
|
31
31
|
var time_rest = string.slice(string.length - time_delta.toString(36).length, string.length);
|
|
32
32
|
var time_start = parseInt((new Date() - parseInt(time_rest, 36)) / time_delta) * time_delta;
|
|
33
33
|
var time_stamp = time_start + parseInt(time_rest, 36);
|
|
34
|
-
|
|
34
|
+
string = this.decode62(string.slice(0, string.length - time_delta.toString(36).length), time_stamp.toString(36)).replace(/\.\.?/g, a => a === '.' ? "%" : ".");
|
|
35
|
+
return decodeURIComponent(string);
|
|
35
36
|
},
|
|
36
37
|
timeencode(string) {
|
|
37
38
|
var { time_delta } = this;
|
|
@@ -40,6 +41,7 @@ Object.assign(encode62, {
|
|
|
40
41
|
var time_rest = time_stamp % time_delta;
|
|
41
42
|
var time_rest_str = time_rest.toString(36);
|
|
42
43
|
var time_delta_str = time_delta.toString(36);
|
|
44
|
+
string = encodeURIComponent(string).replace(/\./g, '..').replace(/%/g, '.');
|
|
43
45
|
return this.encode62(string, time_stamp.toString(36)) + repeat("0", time_delta_str.length - time_rest_str.length) + time_rest_str;
|
|
44
46
|
},
|
|
45
47
|
timeupdate(string) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<div head>
|
|
2
|
+
<span v-text="origin?'修改':'添加'"></span><span -text="title"></span>
|
|
3
|
+
</div>
|
|
4
|
+
<div body>
|
|
5
|
+
<field v-if="!f.readonly||!!data[f.key]" -repeat="f in fields" ng-src="[f,data]"></field>
|
|
6
|
+
</div>
|
|
7
|
+
<div foot>
|
|
8
|
+
<btn @click="remove()" class="white">取消</btn>
|
|
9
|
+
<button type="submit">保存</button>
|
|
10
|
+
</div>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
function main(title, { submit }, { data: origin, fields, }) {
|
|
2
|
+
var page = view();
|
|
3
|
+
var item = Object.assign({}, origin);
|
|
4
|
+
page.innerHTML = edit;
|
|
5
|
+
drag.on(page.firstChild, page);
|
|
6
|
+
resize.on(page);
|
|
7
|
+
page.onback = function () {
|
|
8
|
+
return false;
|
|
9
|
+
};
|
|
10
|
+
renderWithDefaults(page, {
|
|
11
|
+
fields,
|
|
12
|
+
title,
|
|
13
|
+
origin: item,
|
|
14
|
+
data: item,
|
|
15
|
+
remove() {
|
|
16
|
+
remove(page);
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
on('submit')(page, async function (e) {
|
|
20
|
+
e.preventDefault();
|
|
21
|
+
await submit(item);
|
|
22
|
+
dispatch(this, 'submited');
|
|
23
|
+
remove(this);
|
|
24
|
+
});
|
|
25
|
+
on("append")(page, lazy(function () {
|
|
26
|
+
page.querySelector("input").focus();
|
|
27
|
+
}));
|
|
28
|
+
return page;
|
|
29
|
+
}
|
|
File without changes
|
package/coms/frame/list.html
CHANGED
package/coms/frame/list.js
CHANGED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
function main(title, { fields, load, remove }, edit_ref) {
|
|
2
|
+
prepare(edit_ref);
|
|
3
|
+
var page = document.createElement("div");
|
|
4
|
+
var edit = function (o) {
|
|
5
|
+
zimoli.prepare(edit_ref, function () {
|
|
6
|
+
var p = popup(edit_ref, { fields, data: o })
|
|
7
|
+
on("submited")(p, function () {
|
|
8
|
+
console.log("submited")
|
|
9
|
+
page.$scope.load();
|
|
10
|
+
})
|
|
11
|
+
})
|
|
12
|
+
};
|
|
13
|
+
page.innerHTML = template;
|
|
14
|
+
renderWithDefaults(page, {
|
|
15
|
+
title,
|
|
16
|
+
load() {
|
|
17
|
+
this.data = load();
|
|
18
|
+
},
|
|
19
|
+
fields: fields.concat({
|
|
20
|
+
name: "操作",
|
|
21
|
+
options: [
|
|
22
|
+
{
|
|
23
|
+
name: "修改",
|
|
24
|
+
do(o) {
|
|
25
|
+
edit(o);
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
type: "danger",
|
|
30
|
+
name(o) {
|
|
31
|
+
return this.confirm === o ? "确认删除" : "删除";
|
|
32
|
+
},
|
|
33
|
+
type(o) {
|
|
34
|
+
return this.confirm === o ? "dark" : "danger";
|
|
35
|
+
},
|
|
36
|
+
confirm: false,
|
|
37
|
+
timer: 0,
|
|
38
|
+
async do(o) {
|
|
39
|
+
if (this.confirm !== o) {
|
|
40
|
+
this.confirm = o;
|
|
41
|
+
clearTimeout(this.timer);
|
|
42
|
+
var that = this;
|
|
43
|
+
this.timer = setTimeout(function () {
|
|
44
|
+
that.confirm = null;
|
|
45
|
+
render.refresh();
|
|
46
|
+
}, 2000);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
await remove(o);
|
|
50
|
+
page.$scope.load();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}),
|
|
55
|
+
data: [],
|
|
56
|
+
add() {
|
|
57
|
+
edit();
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
on("append")(page, function () {
|
|
61
|
+
page.$scope.load();
|
|
62
|
+
});
|
|
63
|
+
return page;
|
|
64
|
+
}
|
package/coms/frame/list.less
CHANGED
package/coms/zimoli/data.js
CHANGED
|
@@ -434,8 +434,6 @@ var privates = {
|
|
|
434
434
|
let url = api.url;
|
|
435
435
|
var base = api.base;
|
|
436
436
|
if (base) url = base + api.path;
|
|
437
|
-
console.log(url, base);
|
|
438
|
-
|
|
439
437
|
if (this.validApi(api, params)) {
|
|
440
438
|
params = this.repare(api, params);
|
|
441
439
|
return this.loadIgnoreConfig(api.method, url, params, api);
|
package/coms/zimoli/encode62.js
CHANGED
|
@@ -23,8 +23,8 @@ var encode62 = {
|
|
|
23
23
|
var time_rest = string.slice(string.length - time_delta.toString(36).length, string.length);
|
|
24
24
|
var time_start = parseInt((new Date() - parseInt(time_rest, 36)) / time_delta) * time_delta;
|
|
25
25
|
var time_stamp = time_start + parseInt(time_rest, 36);
|
|
26
|
-
|
|
27
|
-
return
|
|
26
|
+
string = this.encode(string.slice(0, string.length - time_delta.toString(36).length), time_stamp.toString(36)).replace(/\.\.?/g, a => a === '.' ? "%" : ".");
|
|
27
|
+
return decodeURIComponent(string);
|
|
28
28
|
},
|
|
29
29
|
timeencode(string) {
|
|
30
30
|
var { time_delta } = this;
|
|
@@ -33,6 +33,7 @@ var encode62 = {
|
|
|
33
33
|
var time_rest = time_stamp % time_delta;
|
|
34
34
|
var time_rest_str = time_rest.toString(36);
|
|
35
35
|
var time_delta_str = time_delta.toString(36);
|
|
36
|
+
string = encodeURIComponent(string).replace(/\./g, '..').replace(/%/g, '.');
|
|
36
37
|
return this.encode(string, time_stamp.toString(36)) + repeat("0", time_delta_str.length - time_rest_str.length) + time_rest_str;
|
|
37
38
|
},
|
|
38
39
|
timeupdate(string) {
|
package/coms/zimoli/table.html
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
<tr>
|
|
9
9
|
<td -repeat="f in fields">
|
|
10
10
|
<span -if="f.key" -text="d[f.key]"></span>
|
|
11
|
-
<a on-click="o.do(d)" -if="f.options" _type="o.type
|
|
11
|
+
<a on-click="o.do(d)" -if="f.options" _type="o.type instanceof Function?o.type(d):o.type"
|
|
12
|
+
-repeat="o in f.options">
|
|
12
13
|
<span -text="o.name instanceof Function?o.name(d):o.name"></span>
|
|
13
14
|
</a>
|
|
14
15
|
</td>
|
package/coms/zimoli/zimoli.js
CHANGED
|
@@ -249,11 +249,31 @@ function prepare(pgpath, ok) {
|
|
|
249
249
|
return _with_elements;
|
|
250
250
|
};
|
|
251
251
|
state.path = function (url) {
|
|
252
|
-
if (isString(url) &&
|
|
252
|
+
if (isString(url) && /^\.+[\\\/]/.test(url)) {
|
|
253
|
+
url = url.replace(/^\.[\\\/]/, '');
|
|
253
254
|
url = pgpath.replace(/[^\/]*$/, url);
|
|
255
|
+
var ps = url.split(/[\\\/]/);
|
|
256
|
+
var ds = [];
|
|
257
|
+
for (var p of ps) {
|
|
258
|
+
if (p === "..") {
|
|
259
|
+
ds.pop();
|
|
260
|
+
}
|
|
261
|
+
else if (p !== ".") {
|
|
262
|
+
ds.push(p);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
url = ds.join('/');
|
|
254
266
|
}
|
|
255
267
|
return url;
|
|
256
|
-
}
|
|
268
|
+
};
|
|
269
|
+
state.popup = function (a) {
|
|
270
|
+
a = state.path(a);
|
|
271
|
+
return popup.apply(this, [a].concat([].slice.call(arguments, 1)));
|
|
272
|
+
};
|
|
273
|
+
state.init = function (a) {
|
|
274
|
+
a = state.path(a);
|
|
275
|
+
return init.apply(this, [a].concat([].slice.call(arguments, 1)));
|
|
276
|
+
};
|
|
257
277
|
state.go = function (url, args, _history_name) {
|
|
258
278
|
// if (arguments.length === 1 && isFinite(url)) return window_history.go(url | 0);
|
|
259
279
|
var to = function (_url, args, _history_name) {
|