efront 4.28.3 → 4.29.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.
Files changed (38) hide show
  1. package/#/345/233/275/351/231/205/345/214/226.yml +12 -3
  2. package/apps/pivot/home/welcome.html +3 -1
  3. package/apps/pivot/home/welcome.js +4 -1
  4. package/apps/pivot/home/welcome.less +1 -1
  5. package/apps/pivot/main.js +7 -43
  6. package/apps/pivot/wow/root.js +10 -8
  7. package/apps//346/226/207/344/273/266/347/263/273/347/273/237/main.js +55 -0
  8. package/apps//346/226/207/344/273/266/347/263/273/347/273/237//344/270/273/351/241/265.jsp +42 -0
  9. package/apps//346/226/207/344/273/266/347/263/273/347/273/237//350/265/204/346/272/220/347/256/241/347/220/206/345/231/250.js +1 -0
  10. package/coms/basic/color.js +1 -1
  11. package/coms/basic/extend.js +2 -1
  12. package/coms/basic/extendIfNeeded.js +2 -1
  13. package/coms/basic/extendIfOccurs.js +1 -1
  14. package/coms/basic/mark.js +3 -3
  15. package/coms/basic/sum.js +7 -0
  16. package/coms/basic_/&Array.js +0 -4
  17. package/coms/basic_/&rest.js +3 -4
  18. package/coms/compile//347/264/240/351/246/250.js +47 -6
  19. package/coms/compile//347/264/240/351/246/250_test.js +19 -0
  20. package/coms/docs/helps.js +1 -0
  21. package/coms/explorer/Explorer.js +1 -0
  22. package/coms/explorer/context.js +18 -0
  23. package/coms/frame/login.xht +95 -0
  24. package/coms/zimoli/alert.js +1 -1
  25. package/coms/zimoli/button.less +12 -26
  26. package/coms/zimoli/cless.js +1 -1
  27. package/coms/zimoli/marker.js +4 -3
  28. package/coms/zimoli/pending.less +12 -0
  29. package/coms/zimoli/progbar.xht +85 -15
  30. package/coms/zimoli/relogin.js +43 -0
  31. package/coms/zimoli/script.js +5 -5
  32. package/coms/zimoli/table.less +3 -0
  33. package/coms/zimoli/zimoli.js +15 -7
  34. package/package.json +1 -1
  35. package/public/efront.js +1 -1
  36. package/apps/pivot/auth/login.html +0 -13
  37. package/apps/pivot/auth/login.js +0 -49
  38. package/apps/pivot/auth/login.less +0 -28
@@ -1,6 +1,3 @@
1
- - zh-CN: 路径$1中发现冲突常量$2
2
- en: Conflict constant $2 found in path $1
3
-
4
1
  - zh-CN: 英文
5
2
  en: English
6
3
 
@@ -43,6 +40,18 @@
43
40
  - zh-CN: 禁用
44
41
  en: Disable
45
42
 
43
+ - zh-CN: 无法下载!
44
+ en: Cannot download!
45
+
46
+ - zh-CN: 可以通过浏览器访问打开的端口以查看文件
47
+ en: Open ports can be accessed through a browser to view files
48
+
49
+ - zh-CN: 启动文件服务器
50
+ en: Start the file server
51
+
52
+ - zh-CN: 路径$1中发现冲突常量$2
53
+ en: Conflict constant $2 found in path $1
54
+
46
55
  - zh-CN: 无法打开媒体设备
47
56
  en: Unable to open media device
48
57
 
@@ -60,9 +60,11 @@
60
60
  ${i18n`内存`}:
61
61
  </span>
62
62
  <span>
63
- <progbar danger:="memery[0]/memery[1]<.05" :current="memeryUsed" :total="memery[1]"></progbar>
63
+ <progbar danger:="memery[0]/memery[1]<.05" :pending="maxRss" :current="memeryUsed" :total="memery[1]">
64
+ </progbar>
64
65
  <div>
65
66
  <span -bind="size(memery[1])"></span> \
67
+ <span style="color:#292" -bind="size(maxRss.summary)"></span> +
66
68
  <span -bind="size(memery[0])"></span>
67
69
  </div>
68
70
  </span>
@@ -8,6 +8,7 @@ function main() {
8
8
  filterTime,
9
9
  memeryUsed: 0,
10
10
  memery: [0, 1],
11
+ maxRss: 0,
11
12
  platform: i18n`未知`,
12
13
  arch: i18n`未知`,
13
14
  nodeVersion: i18n`未知`,
@@ -30,12 +31,14 @@ function main() {
30
31
  renderWithDefaults(page, scope);
31
32
  (function (a) {
32
33
  var [mr, mt] = a.memery;
33
- scope.memeryUsed = mt - mr;
34
34
  scope.memery = a.memery;
35
35
  scope.nodeVersion = a.nodeVersion;
36
36
  scope.platform = a.platform;
37
37
  scope.arch = a.arch;
38
38
  scope.usercode = a.userid;
39
+ var rss = scope.maxRss = [].concat(a.maxRSS).map(a => a * 1024);
40
+ rss.summary = sum(rss);
41
+ scope.memeryUsed = mt - mr - rss.summary;
39
42
  }(serverStatus));
40
43
  return page;
41
44
  }
@@ -3,7 +3,7 @@
3
3
  }
4
4
 
5
5
  progbar {
6
- width: 120px;
6
+ width: 180px;
7
7
  }
8
8
 
9
9
  btn {
@@ -7,48 +7,8 @@ i18n.setReloader(function () {
7
7
  zimoli.reload(false);
8
8
  });
9
9
  data.loadConfig("api.yml");
10
- user.loginPath = '/auth/login';
11
- var login_queue = [], reject_queue = [];
12
- cross.addReform(async function ({ status, url, headers }, reform, reject) {
13
- if (status === 401) {
14
- var xhr = this;
15
- var abort = xhr.abort;
16
- xhr.abort = function () {
17
- removeFromList(login_queue, reform);
18
- removeFromList(reject_queue, reject);
19
- if (!login_queue.length) remove(reject_queue.splice(0, 1)[0]);
20
- abort.call(this);
21
- };
22
-
23
- if (login_queue.length) {
24
- login_queue.push(reform);
25
- reject_queue.push(reject);
26
- return false;
27
- }
28
- var base = data.getInstance("base").base;
29
- var { protocol, host } = parseURL(url);
30
- var base1 = protocol + "//" + host + "/";
31
- if (base !== base1) {
32
- data.setSource(base1, null);
33
- }
34
- login_queue.push(reform);
35
- var page = await popup("/auth/login", base1);
36
- if (!login_queue.length) return;
37
- reject_queue.push(page, reject);
38
- care(page, "login", function (info) {
39
- data.setSource(base1, info);
40
- headers.authorization = info;
41
- login_queue.splice(0, login_queue.length).forEach(q => q());
42
- reject_queue.splice(0, reject_queue.length);
43
- });
44
- on("remove")(page, function () {
45
- login_queue.splice(0, login_queue.length);
46
- if (reject_queue[0] === this) reject_queue.shift();
47
- reject_queue.splice(0, reject_queue.length).forEach(r => r());
48
- });
49
- return false;
50
- }
51
- })
10
+ user.loginPath = 'frame$login';
11
+ cross.addReform(relogin(user.loginPath))
52
12
  data.setReporter(function (m, t) {
53
13
  alert(m, t);
54
14
  });
@@ -95,6 +55,10 @@ on("drop")(document, function (event) {
95
55
  });
96
56
  remove(document.body.childNodes);
97
57
  zimoli.register('/wow/root');
58
+ zimoli.register('/order/create', "/shop/order/create");
59
+ zimoli.register('/order/list', "/shop/order/list");
60
+ zimoli.register('/order/:id', "/shop/order/detail");
61
+ zimoli.register('/mind/list', "/shop/mind/list");
98
62
  function main() {
99
63
  return layer;
100
- }
64
+ }
@@ -75,17 +75,19 @@ function main(path) {
75
75
  var ps = $scoped.get(page);
76
76
  extend(ps, {
77
77
  pathlist: path ? path.split('/') : [],
78
- read(from, start, size) {
79
- var authorization = data.getSource(data.getInstance("base").base);
80
- var xhr = cross("get", from.url, { authorization: authorization });
81
- var end = start + size - 1;
82
- xhr.setRequestHeader('range', `bytes=${start}-${end}`);
83
- xhr.send();
84
- return xhr;
78
+ async download(from) {
79
+ var res = await data.from('folder', { opt: "get", path: encode62.packencode(from) });
80
+ var frame = document.createElement("iframe");
81
+ css(frame, "pointer-events:none;opacity:0;display:none");
82
+ document.body.appendChild(frame);
83
+ frame.src = res;
84
+ setTimeout(function () {
85
+ remove(frame);
86
+ }, 20000);
85
87
  },
86
88
  load(p, force) {
87
89
  if (!force) {
88
- location.href = "#/wow/root" + p;;
90
+ location.href = "#" + page.basepath + p;;
89
91
  return { then() { } };
90
92
  }
91
93
  var base = data.getInstance("base").base;
@@ -0,0 +1,55 @@
1
+ user.loginPath = "frame$login";
2
+ cross.addReform(relogin(user.loginPath));
3
+ data.setConfig(`
4
+ / authorization=:
5
+ folder: options ::file-:opt:::path?:to
6
+ list: options :::type*:idkey
7
+ edit: options :::type-:key?:value
8
+ add: options :::type-:key+:value
9
+ patch: options :::type-:key*:value
10
+ upload: put :path
11
+ login: options ::login-:a
12
+ `);
13
+ zimoli.register('', "/资源管理器");
14
+ zimoli.switch("", null, '/');
15
+ zimoli();
16
+ var outbar = zimoli$progbar();
17
+ outbar.total = 100;
18
+ outbar.current = 0;
19
+ css(outbar, 'z-index:2;border-radius:14px;line-height:26px;outline-color:#fff;background:#d45;color:#fff;position:fixed;height:26px;bottom:20px;left:20px;min-width:26px');
20
+ appendChild(document.body, outbar);
21
+ var cancel = function () {
22
+ clearInterval(interval_id);
23
+ outbar.innerText = '';
24
+ css(outbar, 'width:26px');
25
+ outbar.innerText = '';
26
+ outbar.current = 0;
27
+ render.refresh(outbar);
28
+ };
29
+ var reached = function () {
30
+ outbar.current++;
31
+ render.refresh(outbar);
32
+ if (outbar.current < outbar.total) return;
33
+ data.setSource({});
34
+ zimoli.reload();
35
+ cancel();
36
+ };
37
+ moveupon(outbar, {
38
+ async start() {
39
+ var a = await data.getApi('login');
40
+ if (!data.getSource(a.base)) return;
41
+ css(outbar, 'width:100px');
42
+ outbar.current = 0;
43
+ interval_id = setInterval(reached, 12);
44
+ outbar.innerText = '长按登出';
45
+ },
46
+ move() {
47
+ if (!onclick.preventClick) return;
48
+ cancel();
49
+ },
50
+ end() {
51
+ cancel();
52
+ }
53
+ })
54
+ drag.on(outbar)
55
+ var interval_id = 0;
@@ -0,0 +1,42 @@
1
+ <!DOCTYPE html>
2
+ <!--
3
+ http://efront.cc
4
+ -->
5
+ <html lang="zh-CN">
6
+
7
+ <head>
8
+ <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
9
+ <meta charset="utf-8" />
10
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
11
+ <link rel="Shortcut Icon" href="/favicon.ico" type="image/x-icon" />
12
+ <meta name="viewport" content="initial-scale=1,maximum-scale=1,width=device-width" />
13
+ <title>efront 文件管理器</title>
14
+ <script deleteoncompile efrontloader>
15
+ // 若要在开发环境使用内置组件,请保留此script标签中的代码,在编译发布时,这里的代码会自动删除
16
+ </script>
17
+ <style>
18
+ html {
19
+ height: 100%;
20
+ font-family: "SF Pro SC", "SF Pro Text", "SF Pro Icons", "PingFang SC", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
21
+ }
22
+
23
+ *,
24
+ ::before,
25
+ ::after {
26
+ box-sizing: border-box;
27
+ }
28
+
29
+ body {
30
+ border: none;
31
+ margin: 0;
32
+ padding: 0;
33
+ height: 100%;
34
+ overflow: hidden;
35
+ }
36
+ </style>
37
+ </head>
38
+
39
+ <body scroll=no main-path="/main">
40
+ </body>
41
+
42
+ </html>
@@ -109,7 +109,7 @@ function rotate_rgb(RGBA, theta) {
109
109
  [r, g, b] = rgb4h(r, g, b, h);
110
110
  [r, g, b] = rgb4s(r, g, b, s);
111
111
  [r, g, b] = rgb4v(r, g, b, v);
112
- return [r, g, b];
112
+ return [r, g, b, a];
113
113
  // var s = rgb2s(r, g, b);
114
114
  // var v = rgb2v(r, g, b);
115
115
  // var u = sqrt(3) / 3;
@@ -10,7 +10,8 @@ var extend = Object.assign || function (o1) {
10
10
  for (var cx = 1, dx = arguments.length; cx < dx; cx++) {
11
11
  var o2 = arguments[cx];
12
12
  for (var k in o2) {
13
- if (hasOwnProperty.call(o2, k)) o1[k] = o2[k];
13
+ if (!hasOwnProperty.call(o2, k)) break;
14
+ o1[k] = o2[k];
14
15
  }
15
16
  }
16
17
  return o1;
@@ -4,7 +4,8 @@ function extendIfNeeded(o1) {
4
4
  for (var cx = 1, dx = arguments.length; cx < dx; cx++) {
5
5
  var o2 = arguments[cx];
6
6
  for (var k in o2) {
7
- if (hasOwnProperty.call(o2, k) && !(k in o1)) o1[k] = o2[k];
7
+ if (!hasOwnProperty.call(o2, k)) break;
8
+ if (!(k in o1)) o1[k] = o2[k];
8
9
  }
9
10
  }
10
11
  return o1;
@@ -5,7 +5,7 @@ function extendIfOccurs(o1) {
5
5
  o1 = Object(o1);
6
6
  var ks = [];
7
7
  for (var k in o1) {
8
- if (!hasOwnProperty.call(o1, k)) continue;
8
+ if (!hasOwnProperty.call(o1, k)) break;
9
9
  var f = getOwnPropertyDescriptor(o1, k);
10
10
  if (!f.writable && !f.set) continue;
11
11
  ks.push(k);
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  var MARK_PRE1, MARK_PRE2, _PRE1, _PRE2 = _PRE1 = "<b>";
3
3
  var MARK_AFT1, MARK_AFT2, _AFT1, _AFT2 = _AFT1 = "</b>";
4
- var mark = function (source, search) {
5
- return power(source, search)[1];
4
+ var mark = function (source, search, wrap) {
5
+ return power(source, search, wrap)[1];
6
6
  };
7
7
  var pair = function (source, search, t1, t2, t3, t4) {
8
8
  switch (arguments.length) {
@@ -86,7 +86,7 @@ var power_ = function (source, search, func, mp) {
86
86
  else if (ap >= p) {
87
87
  p += ap / source.length / search.length * .01 - .2;
88
88
  }
89
- return [p, concat1(match_text_pre, match_text, match_text_aft)];
89
+ return [p, concat1(match_text_pre, match_text, match_text_aft, searchText)];
90
90
  }
91
91
  return [0, source];
92
92
  };
@@ -0,0 +1,7 @@
1
+ function sum(numarr) {
2
+ var s = 0;
3
+ for (var n of numarr) {
4
+ s += n;
5
+ }
6
+ return s;
7
+ }
@@ -1,7 +1,3 @@
1
- var hasOwnProperty = {}.__proto__ === Object.prototype ? function (k) {
2
- var proto = this.__proto__;
3
- return k in this && (!proto || !(k in proto));
4
- } : Object.prototype.hasOwnProperty;
5
1
  var setPrototypeOf = Object.setPrototypeOf;
6
2
  var wrapMethod = function (f) {
7
3
  return function () {
@@ -10,10 +10,9 @@ function rest_(o, keys) {
10
10
  for (var k of keys) map[k] = true;
11
11
  var res = {};
12
12
  for (var k in o) {
13
- if (hasOwnProperty.call(o, k)) {
14
- if (k in map) continue;
15
- res[k] = o[k];
16
- }
13
+ if (!hasOwnProperty.call(o, k)) break;
14
+ if (k in map) continue;
15
+ res[k] = o[k];
17
16
  }
18
17
  if (typeof Object.getOwnPropertySymbols === 'function') {
19
18
  for (var k of Object.getOwnPropertySymbols(o)) {
@@ -9,6 +9,7 @@ class 素玉 extends Program {
9
9
  quotes = this.quotes.slice(0, 2).concat();
10
10
  keepspace = true;
11
11
  scopes = [["(", ")"], ["{", "}"]];
12
+ setType() { }
12
13
  }
13
14
 
14
15
  var rarg = new 素玉;
@@ -338,19 +339,19 @@ class 素心 extends Program {
338
339
 
339
340
  var setVarsUsed = function (s) {
340
341
  var vars = null, used = null;
341
- for (var cx = s.length - 1; cx >= 0; cx--) {
342
+ for (var cx = 0, dx = s.length; cx < dx; cx++) {
342
343
  var { p: k, v } = s[cx];
343
344
  if (/^\-\-|^@[^\{]/.test(k) && !("used" in v) && v.length) {
344
345
  if (!vars) vars = Object.create(null);
345
346
  vars[k] = v.join(" ");
346
347
  s.splice(cx, 1);
348
+ cx--; dx--;
347
349
  }
348
350
  else {
349
351
  if (!used) used = [];
350
352
  used.push({ p: k, v });
351
353
  }
352
354
  }
353
- if (used) used.reverse();
354
355
  s.used = used;
355
356
  s.vars = vars;
356
357
  };
@@ -438,6 +439,16 @@ var getFromScopeList = function (name, varsList, value = name) {
438
439
  };
439
440
  var removeSelectorSpace = a => a.trim().replace(/\s*([\+~\>])\s*/g, "$1");
440
441
  var fixBase = function (b, a) {
442
+ if (/@keyframes\s/i.test(a)) {
443
+ var bs = [];
444
+ splitParams(b).forEach(b => {
445
+ b.replace(/@{@[^\}]+}/g, a => {
446
+ if (bs.indexOf(a) < 0) bs.push(a)
447
+ });
448
+ });
449
+ bs.push(`@{${a}}`);
450
+ return bs.join(" ");
451
+ }
441
452
  return splitParams(a).map(a => {
442
453
  if (presets.test(a)) a = `@{${a}}`;
443
454
  var replaced = false;
@@ -505,7 +516,7 @@ var Method = function () {
505
516
  vlist.pop();
506
517
  return body;
507
518
  }
508
- var vlist = [], mlist = [macros], clist = [], base = "";
519
+ var vlist = [], mlist = [macros], clist = [], base = "", kfmap = null;
509
520
  var killneg = function (v, n) {
510
521
  if (n === "-") {
511
522
  if (/^\-/.test(v)) {
@@ -572,10 +583,32 @@ var eval2 = function (props) {
572
583
  var rest = [];
573
584
  var result = [];
574
585
  var methods = Object.create(null);
575
- mlist.push(methods);
576
586
  if (props.maps) clist.push(props.maps);
577
587
 
578
588
  for (var { p: k, v: p } of props) {
589
+ var kfname;
590
+ if (kfname = /^@keyframes\s+([^\s\{\[\]\}\(\)\,\;]+)/i.exec(k)) {
591
+ kfname = kfname[1];
592
+ var ps = getFromScopeList(kfname, mlist);
593
+ if (ps) ps = kfmap[ps];
594
+ if (kfname in kfmap) {
595
+ var tmp = kfname;
596
+ var i = 0;
597
+ while (tmp + i in kfmap) i++;
598
+ tmp = tmp + i;
599
+ methods[kfname] = tmp;
600
+ kfmap[tmp] = p.used;
601
+ kfname = tmp;
602
+ }
603
+ else {
604
+ kfmap[kfname] = p.used;
605
+ methods[kfname] = kfname;
606
+ }
607
+ if (ps) p.used.unshift(...ps);
608
+ p.base = fixBase(base, `@keyframes ${kfname}`);
609
+ p.rooted = true;
610
+ continue;
611
+ }
579
612
  if (p.used) {
580
613
  var match = /^([@\.#][^\s,]+)\s*\(([\s\S]*?)\)\s*$/.exec(k);
581
614
  if (!match) continue;
@@ -593,14 +626,17 @@ var eval2 = function (props) {
593
626
  p.isMethod = true;
594
627
  }
595
628
  }
629
+ mlist.push(methods);
596
630
  for (var { p: k, v: p } of props) {
597
631
  if (p.isMethod) continue;
598
632
  if (p.used) {
599
633
  k = calcvars(k);
600
634
  k = removeSelectorSpace(k);
601
- if (base && !p.rooted) p.base = fixBase(base, k);
635
+ var pvars = p.vars;
636
+ var vars = pvars ? Object.assign(Object.create(null), pvars) : null;
637
+ if (p.rooted);
638
+ else if (base) p.base = fixBase(base, k);
602
639
  else p.base = presets.test(k) ? `@{${k}}` : k;
603
- var vars = shallowClone(p.vars);
604
640
  if (vars) vlist.push(vars);
605
641
  initvars(vars);
606
642
  var value = evalthis(p);
@@ -611,6 +647,9 @@ var eval2 = function (props) {
611
647
  else if (p.length) {
612
648
  k = calcvars(k);
613
649
  p = calcvars(p.join(" "));
650
+ if (/^animation(\-name)?$/i.test(k)) {
651
+ p = p.replace(/^\S+/, a => getFromScopeList(a, mlist, a));
652
+ }
614
653
  p = replace_punc(seprateFunc(p).map(evalproc).join(''));
615
654
  result.push(k, ":", p, ';');
616
655
  }
@@ -639,8 +678,10 @@ function evalscoped(scoped, scopeName = '') {
639
678
  if (and) and.forEach(a => extend(vars, a.vars));
640
679
  vlist.push(vars);
641
680
  clist.push(smaps);
681
+ kfmap = Object.create(null);
642
682
  initvars(vars);
643
683
  var result = eval2(scoped, [vars]);
684
+ kfmap = null;
644
685
  vlist.pop();
645
686
  clist.pop();
646
687
  base = _base;
@@ -17,6 +17,25 @@ test(`a{ &[b]:nth-child(1){a:1}}`, `a[b]:nth-child(1){a:1;}`);
17
17
  test(`a,b{c{a:1}}`, `a c,b c{a:1;}`);
18
18
  test(`@media(){div{a:1}}`, `@media(){div{a:1;}}`);
19
19
  test(`@keyframes a{%1{a:1}}`, `@keyframes a{%1{a:1;}}`);
20
+ test(`
21
+ @keyframes ltr{ 0%{-x:0}}
22
+ b{
23
+ @keyframes ltr{
24
+ 100% {
25
+ -x: -15px;
26
+ }
27
+ }
28
+ animation:ltr 2s linear 0s;
29
+ }
30
+ a{
31
+ @keyframes ltr {
32
+ 100% {
33
+ -x: 15px;
34
+ }
35
+ }
36
+ animation:ltr 2s linear 0s;
37
+ }
38
+ `, `@keyframes ltr{0%{-x:0;}}\r\n@keyframes ltr0{0%{-x:0;}100%{-x:-15px;}}b{animation:ltr0 2s linear 0s;}\r\n@keyframes ltr1{0%{-x:0;}100%{-x:15px;}}a{animation:ltr1 2s linear 0s;}`);
20
39
  test(`@media screen and (max-width: 200px){@keyframes a{%1{a:1}}}`, `@media screen and (max-width: 200px){@keyframes a{%1{a:1;}}}`);
21
40
  test(`@a:1`, ``);
22
41
  test(`@a:1;a{a:@a}`, `a{a:1;}`);
@@ -6,6 +6,7 @@ var helps = [
6
6
  ["f", i18n`显示efront的安装路径`, "path", "--path"],
7
7
  ["f", i18n`显示帮助信息`, "help", "-h", "--help", "help COMMAND", "-h COMMAND", "--help COMMAND"],
8
8
  ["f", i18n`启动文档服务器`, "docs"],
9
+ ["f", i18n`启动文件服务器`, "file|fs|filesystem|wj|文件系统"],
9
10
  ["f", i18n`查看efront自身占用的内存`, "memery", "memory", "-m", "--memery", "--memory"],
10
11
  ["m", i18n`启动示例项目服务器`, "demo", "demo SRCNAME"],
11
12
  ["m", i18n`创建应用,项目目录允许创建第二个应用`, "init", "from SRCNAME", "init APPNAME", "init APPNAME from SRCNAME", "from SRCNAME init APPNAME"],
@@ -39,6 +39,7 @@ e.delete = function () { alert(i18n`无法删除!`) }
39
39
  e.mov = function () { alert(i18n`无法移动!`) }
40
40
  e.copy = function () { alert(i18n`无法复制!`) }
41
41
  e.read = function () { alert(i18n`无法读取文件内容!`) }
42
+ e.download = function () { alert(i18n`无法下载!`) }
42
43
  e.rename = function () { alert(i18n`无法重命名!`) }
43
44
  e.upload = function () { alert(i18n`添加失败!`) }
44
45
  e.getToken = function () { }
@@ -8,6 +8,15 @@ var getStable = e => {
8
8
  if (!a) return;
9
9
  return !$scoped.get(a).d.pending;
10
10
  };
11
+ var pointerFile = e => {
12
+ var a = getActive(e);
13
+ if (!a || a.pending) return;
14
+ var s = $scoped.get(a);
15
+ var d = s.d;
16
+ var ps = getPageScope(a);
17
+ if (ps.selected.length > 1) return;
18
+ return !d.isfolder && !d.pending;
19
+ }
11
20
  var getSelected = function (d) {
12
21
  var p = getPageScope(d);
13
22
  return p.selected;
@@ -77,6 +86,15 @@ return () => [
77
86
  scope.open(scope.selected[0]);
78
87
  }
79
88
  },
89
+ {
90
+ name: i18n`下载` + `(D)`,
91
+ hotkey: "Ctrl + S",
92
+ when: pointerFile,
93
+ async do(d) {
94
+ var $scope = getPageScope(d);
95
+ for (var s of $scope.selected) await $scope.download("/" + $scope.pathlist.concat(s.name).join("/"));
96
+ }
97
+ },
80
98
  {
81
99
  name: i18n`剪切` + `(C)`,
82
100
  hotkey: "Ctrl+X",
@@ -0,0 +1,95 @@
1
+ <style>
2
+ & {
3
+ position: absolute;
4
+ }
5
+
6
+ [foot],
7
+ [head] {
8
+ &::before {
9
+ display: none;
10
+ }
11
+
12
+ text-align: center;
13
+ }
14
+
15
+ [message] {
16
+ padding: 2px 4px;
17
+ line-height: 1.2;
18
+ text-align: center;
19
+ color: #29c;
20
+ border-top: 1px solid #29c;
21
+ background: #29c1;
22
+ margin: 0 auto;
23
+ font-size: 12px;
24
+ }
25
+
26
+
27
+ .button {
28
+ padding: 0px 40px;
29
+ }
30
+ </style>
31
+ <div head>
32
+ ${i18n`请输入服务器密码`}
33
+ </div>
34
+ <div body>
35
+ <field ng-repeat="f in fields" ng-src="[f,data]"></field>
36
+ </div>
37
+ <div foot>
38
+ <button pending.="pending" type="submit">${i18n`登录`}</button>
39
+ </div>
40
+ <div message>
41
+ ${i18n`${i18n`登录`}之前需要使用${`&nbsp;<b>efront password</b>&nbsp;`}命令在${i18n`服务器`}上设置${i18n`密码`}`}
42
+ </div>
43
+ <i18n-chooser></i18n-chooser>
44
+ <script>
45
+
46
+ var hosts = data.getItem("hosts");
47
+ if (!hosts.length) hosts.push({ key: location.host, name: location.host });
48
+ function main(host) {
49
+ var fields = refilm`
50
+ 服务器地址/host* select?a ${hosts}
51
+ 密码/password* password
52
+ `;
53
+ var page = view();
54
+ page.innerHTML = login;
55
+ drag.on(page);
56
+ fields[0].readonly = !!host;
57
+ on("mounted")(page, function () {
58
+ move.bindPosition(page, [.5, .5]);
59
+ });
60
+ renderWithDefaults(page, {
61
+ i18nChooser,
62
+ fields, data: {
63
+ host: host ? parseURL(host).host : data.getInstance("base").host || location.host,
64
+ }, pending: false
65
+ });
66
+ on("submit")(page, async function () {
67
+ data.setInstance("hosts", hosts, true);
68
+ var { password } = submit(fields, $scoped.get(this).data);
69
+ $scoped.get(this).pending = true;
70
+ page.disabled = true;
71
+ try {
72
+ var base = location.protocol + "//" + parseURL($scoped.get(this).data.host).host + "/";
73
+ if (!host) data.setInstance("base", { base, host: parseURL(base).host });
74
+ var api = Object.assign({}, await data.getApi("login"));
75
+ api.base = base;
76
+ var info = await data.from(api, {
77
+ a: encode62.packencode(encode62.geta(password))
78
+ }).loading_promise;
79
+ info = encode62.packupdate(info);
80
+ data.setSource(base, info);
81
+ if (host) {
82
+ cast(page, 'login', info);
83
+ remove(page);
84
+ } else {
85
+ user.login({});
86
+ go('/main');
87
+ }
88
+ } catch (e) {
89
+ console.log(e);
90
+ }
91
+ $scoped.get(this).pending = false;
92
+ })
93
+ return page;
94
+ }
95
+ </script>
@@ -93,7 +93,7 @@ function alert() {
93
93
  if (!isMounted(container)) popup(container);
94
94
  });
95
95
  if (!isMounted(elem)) appendChild(container, elem);
96
- waitclose(autoclose, 400);
96
+ waitclose(autoclose, 900);
97
97
  return elem;
98
98
  };
99
99
  var elem = setContent();