efront 4.23.9 → 4.24.1

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 (80) hide show
  1. package/#/345/233/275/351/231/205/345/214/226.yml +347 -65
  2. package/apps/pivot/#/345/233/275/351/231/205/345/214/226.yml +2 -0
  3. package/apps/pivot/api.yml +1 -0
  4. package/apps/pivot/auth/login.html +2 -1
  5. package/apps/pivot/auth/login.js +1 -0
  6. package/apps/pivot/auth/login.less +1 -0
  7. package/apps/pivot/cert/edit.js +1 -1
  8. package/apps/pivot/cert/list.js +1 -1
  9. package/apps/pivot/cert/main.xht +6 -6
  10. package/apps/pivot/cert/orders.xht +8 -8
  11. package/apps/pivot/cert/update.xht +3 -3
  12. package/apps/pivot/db/config.xht +1 -1
  13. package/apps/pivot/db/edit.xht +4 -4
  14. package/apps/pivot/db/list.xht +4 -4
  15. package/apps/pivot/dht/list.js +4 -4
  16. package/apps/pivot/dict/edit.js +1 -1
  17. package/apps/pivot/dict/list.js +1 -1
  18. package/apps/pivot/home/welcome.html +47 -12
  19. package/apps/pivot/home/welcome.js +11 -5
  20. package/apps/pivot/home/welcome.less +16 -1
  21. package/apps/pivot/link/index.js +7 -4
  22. package/apps/pivot/link/list.html +2 -2
  23. package/apps/pivot/link/room.js +2 -2
  24. package/apps/pivot/main.js +2 -0
  25. package/apps/pivot/menu-en.yml +16 -0
  26. package/apps/pivot/proxy/edit.js +1 -1
  27. package/apps/pivot/proxy/list.js +2 -2
  28. package/apps/pivot/register.jsp +4 -0
  29. package/apps/pivot/share/edit.html +3 -3
  30. package/apps/pivot/share/list.js +3 -3
  31. package/apps/pivot/task/edit.js +1 -1
  32. package/apps/pivot/task/invoke.html +2 -2
  33. package/apps/pivot/task/invoke.js +11 -3
  34. package/apps/pivot/task/invoke.less +3 -1
  35. package/apps/pivot/task/list.js +3 -3
  36. package/apps/pivot/task/rsync.html +3 -3
  37. package/apps/pivot/task/rsync.js +1 -1
  38. package/apps/pivot/token/edit.js +1 -1
  39. package/apps/pivot/token/list.js +1 -1
  40. package/apps/pivot/wow/root.js +1 -1
  41. package/apps/pivot//344/270/273/351/241/265.html +1 -1
  42. package/coms/basic/#loader.js +7 -0
  43. package/coms/basic/cross_.js +4 -3
  44. package/coms/basic/i18n-chooser.xht +17 -0
  45. package/coms/basic/i18n-supports.js +30 -0
  46. package/coms/basic/i18n.js +25 -1
  47. package/coms/basic/parseURL.js +2 -2
  48. package/coms/basic/parseURL_test.js +2 -1
  49. package/coms/basic_/Promise.js +21 -18
  50. package/coms/basic_/WeakMap.js +12 -6
  51. package/coms/compile/Program.js +4 -4
  52. package/coms/compile/translate.js +23 -0
  53. package/coms/explorer/context.js +11 -11
  54. package/coms/frame/dict.js +1 -1
  55. package/coms/frame/edit.html +3 -3
  56. package/coms/frame/list.html +1 -1
  57. package/coms/frame/list.js +3 -3
  58. package/coms/frame/route.js +21 -9
  59. package/coms/pivot/left-footer.xht +4 -1
  60. package/coms/pivot/server-status.js +1 -0
  61. package/coms/reptile/cross.js +1 -0
  62. package/coms/zimoli/chooseFile.js +1 -1
  63. package/coms/zimoli/cless.js +2 -2
  64. package/coms/zimoli/createUploadURL.js +1 -1
  65. package/coms/zimoli/field.html +1 -1
  66. package/coms/zimoli/field.js +1 -0
  67. package/coms/zimoli/menuItem.js +3 -1
  68. package/coms/zimoli/prompt.less +3 -1
  69. package/coms/zimoli/render.js +3 -2
  70. package/coms/zimoli/selectList.js +3 -3
  71. package/coms/zimoli/selectListEdit.html +5 -5
  72. package/coms/zimoli/table.js +1 -1
  73. package/coms/zimoli/table.less +1 -2
  74. package/coms/zimoli/yousure.js +2 -2
  75. package/coms/zimoli/zimoli.js +46 -15
  76. package/coms//350/214/250/350/217/260//347/274/226/350/276/221/346/241/206.xht +31 -12
  77. package/docs/main.xht +19 -6
  78. package/docs//345/267/245/345/205/267//345/233/275/351/231/205/345/214/226.xht +32 -40
  79. package/package.json +1 -1
  80. package/public/efront.js +1 -1
@@ -28,4 +28,28 @@ var getLanguageIndexFromName = function (language) {
28
28
  i18n.setLanguage = function (language) {
29
29
  languageIndex = getLanguageIndexFromName(language);
30
30
  };
31
- if (this.navigator) i18n.setLanguage(this.navigator.language);
31
+ i18n.getIndex = function () {
32
+ return languageIndex;
33
+ };
34
+ i18n.setIndex = function (index) {
35
+ languageIndex = +index;
36
+ localStorage.setItem('language-index', index);
37
+ supports = [];
38
+ i18n.supports = supports;
39
+ i18n.reload();
40
+ };
41
+ var relaods = [];
42
+ i18n.reload = function () {
43
+ relaods.forEach(a => a());
44
+ };
45
+ i18n.setReloader = function () {
46
+ relaods = [];
47
+ for (var callback of arguments) {
48
+ if (isFunction(callback)) relaods.push(callback);
49
+ }
50
+ };
51
+ if (this.navigator) i18n.setLanguage(this.navigator.language);
52
+ var i = +localStorage.getItem('language-index');
53
+ if (i >= 0) i18n.setIndex(i);
54
+ else i18n.setIndex(languageIndex);
55
+ var supports;
@@ -17,8 +17,8 @@
17
17
  // │ href │
18
18
  // └────────────────────────────────────────────────────────────────────────────────────────────────┘
19
19
 
20
- // -------/// ---------------1---------------------------------///////////////////2-----3--------//////// ------4----2/////5---------------------------------------------------6------------------------------------------------------------------------------------//////////////-7--5///8-------9----------//10--11---10/8/--12----////
21
- var reg = /^([^\:\/\\\?#\[]+\:(?![^\:\/\\\?\#]*@|[\/\\][^\/\\]))?(?:\/\/|\\\\)?(?:(([^\:\/\\\?#]+)?(?:\:([^\/\\\?#]+))?)@)?(([^\/\\@\?\#\.]*?[^\/\\@\:\?\#\.\d][^\/\\@\:\?\#\.]*?|[^\/\\@\:\?\#\.]+(?:\:[^\@\/\\\?#\.]*[^\d\@\:\/\\\?#\.]+|(?:\.[^\/\\@\:\?\#\.]+)+))?(?:(?:\:|^)(\d+))?)(((?:\/|\\|^)[^\?#]*)?(\?([^#]*))?)(#[\s\S]*)?$/;
20
+ // -------/// ----------------1----------------------------------///////////////////2-----3--------//////// ------4----2/////5---------------------------------------------------6----------------------------------------------------------------------------------//////////////-7--5///8-------9----------//10--11---10/8/--12----////
21
+ var reg = /^([^\:\/\\\?#\[\.]+\:(?![^\:\/\\\?\#]*@|[\/\\][^\/\\]))?(?:\/\/|\\\\)?(?:(([^\:\/\\\?#]+)?(?:\:([^\/\\\?#]+))?)@)?(([^\/\\@\?\#\.]*?[^\/\\@\:\?\#\.\d][^\/\\@\:\?\#\.]*?|[^\/\\@\:\?\#\.]+(?:\:[^\@\/\\\?#]*[^\d\@\:\/\\\?#\.]+|(?:\.[^\/\\@\:\?\#\.]+)+))?(?:(?:\:|^)(\d+))?)(((?:\/|\\|^)[^\?#]*)?(\?([^#]*))?)(#[\s\S]*)?$/;
22
22
  class URL {
23
23
  resolve(url) {
24
24
  var u = new URL;
@@ -1,5 +1,5 @@
1
1
  var parseURL = require("./parseURL");
2
- require("../efront/console");
2
+ var console = efront$console;
3
3
  var test = function (url, key, value) {
4
4
  var parsed = parseURL(url);
5
5
  if (parsed[key] !== value) console.log(parsed), console.fail(`url:${url}, key:${key}, expect:${value}, result:${parsed[key]}`);
@@ -50,6 +50,7 @@ test("http://[::]/", "host", "[::]")
50
50
  test("http://[::%12]/", "host", "[::%12]")
51
51
  test("http://[::]:80/", "hostname", "[::]")
52
52
  test("[::]:80/", "hostname", "[::]")
53
+ test("[::ffff:127.0.0.1]:80/", "hostname", "[::ffff:127.0.0.1]")
53
54
  test("[fd64:f52:f52:f52:f52:f52:f52:97]", "hostname", "[fd64:f52:f52:f52:f52:f52:f52:97]")
54
55
  test("./cluster-opt.html", "pathname", "./cluster-opt.html")
55
56
  test(":cluster-opt.html", "pathname", ":cluster-opt.html")
@@ -15,32 +15,35 @@ if (!Promise) {
15
15
  var isThenable = function (pendding) {
16
16
  return pendding instanceof Promise || pendding && isFunction(pendding.then);
17
17
  };
18
+ var thro = function (error) {
19
+ // <!--
20
+ console.error(i18n`在异步过程中发现未处理的异常:`, error);
21
+ // -->
22
+ };
18
23
  var queue = [];
19
24
  var running = false;
20
- var run = function (q) {
25
+ var run = function () {
21
26
  while (queue.length) {
22
27
  var threads = queue.splice(0, queue.length);
23
28
  for (var t of threads) {
24
- var PromiseRejectReactions = t.PromiseRejectReactions.splice(0, t.PromiseRejectReactions.length);
25
- var PromiseFulfillReactions = t.PromiseFulfillReactions.splice(0, t.PromiseFulfillReactions.length);
29
+ var { $j, $s } = t;
30
+ var PromiseRejectReactions = $j.splice(0, $j.length);
31
+ var PromiseFulfillReactions = $s.splice(0, $s.length);
26
32
  if (t.oked) {
33
+ var oked = t.oked[0];
27
34
  for (var r of PromiseFulfillReactions) {
28
- r.call(null, t.oked[0]);
35
+ r(oked);
29
36
  }
30
37
  }
31
38
  if (t.ohed) {
32
39
  var throwed = t.throwed;
33
40
  t.throwed = true;
41
+ var ohed = t.ohed[0];
34
42
  if (!throwed && !PromiseRejectReactions.length) {
35
- // <!--
36
- console.warn(i18n`在异步过程中发现未处理的异常:`, t.ohed[0], t.ohed[1], t.ohed[2]);
37
- // -->
38
- requestAnimationFrame(function () {
39
- throw t.ohed[0];
40
- })
43
+ requestAnimationFrame(thro.bind(null, ohed));
41
44
  }
42
45
  for (var r of PromiseRejectReactions) {
43
- r.apply(null, t.ohed);
46
+ r(ohed);
44
47
  }
45
48
  }
46
49
  }
@@ -54,8 +57,8 @@ if (!Promise) {
54
57
  requestAnimationFrame(run);
55
58
  };
56
59
  var Promise = function (executor) {
57
- this.PromiseFulfillReactions = []; //thens
58
- this.PromiseRejectReactions = []; //catches
60
+ this.$j = []; // rejects
61
+ this.$s = []; // resolves
59
62
  this.oked = this.ohed = null;
60
63
  var p = this;
61
64
  var ResolvingFunctions_resolve = function (result) { //ok
@@ -82,7 +85,7 @@ if (!Promise) {
82
85
  a = onok(a);
83
86
  ok(a);
84
87
  } catch (e) {
85
- oh(e, onok, onoh);
88
+ oh(e);
86
89
  }
87
90
  };
88
91
  else resolve = ok;
@@ -91,13 +94,13 @@ if (!Promise) {
91
94
  a = onoh.apply(null, arguments);
92
95
  ok(a);
93
96
  } catch (e) {
94
- oh(e, onok, onoh);
97
+ oh(e);
95
98
  }
96
99
  };
97
100
  else reject = oh;
98
101
  })
99
- if (resolve) this.PromiseFulfillReactions.push(resolve);
100
- if (reject) this.PromiseRejectReactions.push(reject);
102
+ if (resolve) this.$s.push(resolve);
103
+ if (reject) this.$j.push(reject);
101
104
  if (this.oked || this.ohed) fire(this);
102
105
  return promise;
103
106
  }
@@ -107,7 +110,7 @@ if (!Promise) {
107
110
  Promise.all = function (penddings) {
108
111
  return new Promise(function (ok, oh) {
109
112
  if (!(penddings && penddings.length)) {
110
- return ok();
113
+ return ok([]);
111
114
  }
112
115
  var resolved_count = 0,
113
116
  results = Array(penddings.length);
@@ -4,11 +4,12 @@ var id = 0;
4
4
  WeakMap = class WeakMap {
5
5
  id = "#" + ++id;
6
6
  get(o) {
7
+ if (o == null) return;
7
8
  return o[this.id];
8
9
  }
9
10
  set(o, v) {
10
11
  defineObj.value = v;
11
- Object.defineProperty(o, this.id, defineObj);
12
+ defineProperty(o, this.id, defineObj);
12
13
  }
13
14
  has(o) {
14
15
  return this.id in o;
@@ -19,18 +20,23 @@ WeakMap = class WeakMap {
19
20
  }
20
21
  var defineObj = {
21
22
  value: null,
22
- enumerable: true,
23
+ enumerable: false,
23
24
  writable: true,
24
- configurable: false
25
+ configurable: true
25
26
  }
26
27
  var defineProperty = Object.defineProperty;
27
28
  try {
28
29
  defineProperty(document, '#weakmap', defineObj);
29
30
  delete document["#weakmap"];
30
31
  } catch {
31
- defineProperty = function (o, k, d) {
32
- o[k] = d.value;
32
+ try {
33
+ delete defineObj.enumerable;
34
+ defineProperty(document, '#weakmap', defineObj);
35
+ delete document["#weakmap"];
36
+ } catch {
37
+ defineProperty = function (o, k, d) {
38
+ o[k] = d.value;
39
+ }
33
40
  }
34
- delete defineObj.enumerable;
35
41
  }
36
42
  return WeakMap;
@@ -76,7 +76,7 @@ class Program {
76
76
  ["`", "`", /\\[\s\S]/, ["${", "}"]],
77
77
  ]
78
78
  tags = [
79
- [["<", "</"], /\/?>/, /\\[\s\S]/, "'", '"', "<!--", ["${", "}"]]
79
+ [["<", "</"], /\/?>/, /\\[\s\S]/, "'", '"', "<!--", ["${", "}"], ["<%", "%>"]]
80
80
  ];
81
81
  scriptTags = [];
82
82
  ignoreTags = ["STYLE", "SCRIPT"];
@@ -90,6 +90,7 @@ class Program {
90
90
  ["(", ")"],
91
91
  ["[", "]"],
92
92
  ["{", "}"],
93
+ ["<%", "%>"],
93
94
  ]
94
95
  stamps = "/=+;|:?<>-!~%^&*,".split("");
95
96
  prefix = '&^%?:'.split('');
@@ -1048,8 +1049,7 @@ class Program {
1048
1049
  this.stamps.forEach(s => {
1049
1050
  if (s.length === 1) tokens[s] = true;
1050
1051
  });
1051
- var scopes = this.scopes.map(a => a.join("")).join("");
1052
- scopes = this.compile(scopes);
1052
+ var scopes = this.scopes.map(a => a.map(this.compile).join("|")).join("|");
1053
1053
  tokens = Object.keys(tokens).join("");
1054
1054
  tokens = this.compile(tokens);
1055
1055
  var express = `(?:\\\\u\\{[^\\}]+\\}|${spaceDefined.avoid(tokens, false)})+`;
@@ -1066,7 +1066,7 @@ class Program {
1066
1066
  this.prefix_reg = prefix_reg;
1067
1067
  var numbers = number_reg.source.replace(/^\^|\$$/g, "");
1068
1068
  this.digit_reg = new RegExp(/^[+\-]?/.source + numbers, number_reg.flags);
1069
- this.entry_reg = new RegExp([`${spaceDefined.reg.source}|${quotes_entries}|[${scopes}]|${numbers}(?:${spaceDefined.avoid(tokens)})*|${express}|${powers_entries}|[${stamps}]`], "gi");
1069
+ this.entry_reg = new RegExp([`${spaceDefined.reg.source}|${quotes_entries}|${scopes}|${numbers}(?:${spaceDefined.avoid(tokens)})*|${express}|${powers_entries}|[${stamps}]`], "gi");
1070
1070
  var stamps = this.stamps.slice();
1071
1071
  for (var k in this.powermap) {
1072
1072
  if (k.length === 1 && stamps.indexOf(k) < 0) stamps.push(k);
@@ -158,6 +158,29 @@ function translate([imap, supports], code) {
158
158
  if (a in t) v = t[a];
159
159
  else v = scanner2(`(${JSON.stringify(v)})`)[0];
160
160
  }
161
+ else if (k === 'options') {
162
+ if (v instanceof Array) {
163
+ var a = scanner2(`[]`);
164
+ v.map(function (o) {
165
+ var name = o.name;
166
+ if (!name) return scanner2(`(${JSON.stringify(o)})`)[0];
167
+ delete o.name;
168
+ name = ctn('i18n' + getm(name, t.nodup, t.warn), t);
169
+ o = scanner2(`(${JSON.stringify(o)})`)[0];
170
+ splice(o[0], 0, 0,
171
+ { type: PROPERTY, isprop: true, text: `"name"` },
172
+ { type: STAMP, text: ":" }, ...name,
173
+ { type: STAMP, text: "," });
174
+ setqueue(o);
175
+ return o;
176
+ }).forEach(function (o) {
177
+ a[0].push(...o, { type: STAMP, text: ',' });
178
+ });
179
+ a[0].pop();
180
+ setqueue(a);
181
+ v = a;
182
+ }
183
+ }
161
184
  else if (/^(name|holder|comment)$/.test(k)) v = ctn('i18n' + getm(v, t.nodup, t.warn), t);
162
185
  else v = scanner2(`(${JSON.stringify(v)})`)[0];
163
186
  o.push({
@@ -60,7 +60,7 @@ var popupEdit = function ($scope, active) {
60
60
  };
61
61
  return extend([
62
62
  {
63
- name: i18n`返回(O)`,
63
+ name: i18n`返回` + `(O)`,
64
64
  hotkey: "backspace",
65
65
  when: never,
66
66
  do() {
@@ -68,7 +68,7 @@ return extend([
68
68
  }
69
69
  },
70
70
  {
71
- name: i18n`打开(O)`,
71
+ name: i18n`打开` + `(O)`,
72
72
  hotkey: "Enter",
73
73
  when: never,
74
74
  do(d) {
@@ -78,7 +78,7 @@ return extend([
78
78
  }
79
79
  },
80
80
  {
81
- name: i18n`剪切(C)`,
81
+ name: i18n`剪切` + `(C)`,
82
82
  hotkey: "Ctrl+X",
83
83
  when: getStable,
84
84
  do(d) {
@@ -88,7 +88,7 @@ return extend([
88
88
  }
89
89
  },
90
90
  {
91
- name: i18n`复制(R)`,
91
+ name: i18n`复制` + `(R)`,
92
92
  hotkey: "Ctrl+C",
93
93
  when: getStable,
94
94
  do(d) {
@@ -98,7 +98,7 @@ return extend([
98
98
  }
99
99
  },
100
100
  {
101
- name: i18n`全选(A)`,
101
+ name: i18n`全选` + `(A)`,
102
102
  hotkey: "Ctrl+A",
103
103
  when: never,
104
104
  do(d) {
@@ -108,11 +108,11 @@ return extend([
108
108
  }
109
109
  },
110
110
  {
111
- name: i18n`替换(R)`,
111
+ name: i18n`替换` + `(R)`,
112
112
  when: never,
113
113
  },
114
114
  {
115
- name: i18n`粘贴(V)`,
115
+ name: i18n`粘贴` + `(V)`,
116
116
  hotkey: "Ctrl+V",
117
117
  when(e) {
118
118
  var copyed = getPageScope(e.target).copyed;
@@ -162,12 +162,12 @@ return extend([
162
162
  }
163
163
  },
164
164
  {
165
- name: i18n`新建文件夹(D)`,
165
+ name: i18n`新建文件夹` + `(D)`,
166
166
  when: notGetActive,
167
167
  do: popupAdd
168
168
  },
169
169
  {
170
- name: i18n`添加文件(F)`,
170
+ name: i18n`添加文件` + `(F)`,
171
171
  when: notGetActive,
172
172
  async do(d) {
173
173
  var $scope = getPageScope(d);
@@ -176,13 +176,13 @@ return extend([
176
176
  },
177
177
  {
178
178
  hotkey: "F2",
179
- name: i18n`重命名(R)`,
179
+ name: i18n`重命名` + `(R)`,
180
180
  when: getStable,
181
181
  do: popupRen
182
182
  },
183
183
  {
184
184
  get name() {
185
- return this.confirm ? i18n`确认删除(D)` : i18n`删除(D)`;
185
+ return this.confirm ? i18n`确认删除` + `(D)` : i18n`删除` + `(D)`;
186
186
  },
187
187
  hotkey: "Shift+Del",
188
188
  confirm: false,
@@ -1,6 +1,6 @@
1
1
  function main(types, elem) {
2
2
  var { field, data, readonly } = elem;
3
- elem.innerHTML = `<span -text="text()"></span>` + (readonly ? "" : '<a @click="edit()">修改</a>');
3
+ elem.innerHTML = `<span -text="text()"></span>` + (readonly ? "" : `<a @click="edit()">${i18n`修改`}</a>`);
4
4
  renderWithDefaults(elem.children, {
5
5
  text() {
6
6
  if (data[field.key]) return data[field.key].map(k => `${k.name} ${isEmpty(k.key) ? "" : `(${k.key})`}`).join(", ");
@@ -1,11 +1,11 @@
1
1
  <div head>
2
- <span v-text="origin?'修改':'添加'"></span><span -text="title"></span>
2
+ <span v-text="origin?'${i18n`修改`}':'${i18n`添加`}'"></span><span -text="title"></span>
3
3
  </div>
4
4
  <div body>
5
5
  <field v-if="!f.hidden" -repeat="f in fields" ng-src="[f,data]"></field>
6
6
  </div>
7
7
  <scrollbar></scrollbar>
8
8
  <div foot>
9
- <btn @click="remove()" class="white">取消</btn>
10
- <button type="submit">保存</button>
9
+ <btn @click="remove()" class="white">${i18n`取消`}</btn>
10
+ <button type="submit">${i18n`保存`}</button>
11
11
  </div>
@@ -1,5 +1,5 @@
1
1
  <div>
2
- <btn -if="hasedit" @click="add()">添加</btn>
2
+ <btn -if="hasedit" @click="add()">${i18n`添加`}</btn>
3
3
  <btn -repeat="b in buttons" @click="b.do()">
4
4
  <span -text="b.name"></span>
5
5
  </btn>
@@ -27,7 +27,7 @@ function main(title, { fields, options: options0, load, remove, buttons }, edit_
27
27
  page.innerHTML = template;
28
28
  var options = [
29
29
  {
30
- name: "修改",
30
+ name: i18n`修改`,
31
31
  async do(o) {
32
32
  await edit(o);
33
33
  },
@@ -35,7 +35,7 @@ function main(title, { fields, options: options0, load, remove, buttons }, edit_
35
35
  {
36
36
  type: "danger",
37
37
  name(o) {
38
- return this.confirm === o ? "确认删除" : "删除";
38
+ return this.confirm === o ? i18n`确认删除` : i18n`删除`;
39
39
  },
40
40
  type(o) {
41
41
  return this.confirm === o ? "dark" : "danger";
@@ -65,7 +65,7 @@ function main(title, { fields, options: options0, load, remove, buttons }, edit_
65
65
  this.data = load();
66
66
  },
67
67
  fields: fields.filter(f => !f.hidden && f.inlist !== false).concat({
68
- name: "操作",
68
+ name: i18n`操作`,
69
69
  options
70
70
  }),
71
71
  buttons,
@@ -1,6 +1,15 @@
1
- (document.body.hasAttribute('menu-path') || document.body.hasAttribute("menu") || document.body.hasAttribute("config-path") ? data.fromURL(document.body.getAttribute('menu-path') || document.body.getAttribute('menu') || document.body.getAttribute('config-path') || 'menu.yml').loading_promise : Promise.resolve([])).then(function (items) {
1
+ (document.body.hasAttribute('menu-path')
2
+ || document.body.hasAttribute("menu")
3
+ || document.body.hasAttribute("config-path")
4
+ ? data.fromURL(document.body.getAttribute('menu-path')
5
+ || document.body.getAttribute('menu')
6
+ || document.body.getAttribute('config-path')
7
+ || 'menu.yml'
8
+ ).loading_promise
9
+ : Promise.resolve([])
10
+ ).then(function (items) {
2
11
  var result = [];
3
- var menuid = 0;
12
+ var idmap = Object.create(null);
4
13
  var savedChildren = Object.create(null);
5
14
  var savedMenus = Object.create(null);
6
15
  var keymap = {};
@@ -30,10 +39,6 @@
30
39
  if (!icon && /(?!\.)\.(?=[\w\-])/.test(k)) {
31
40
  icon = k.slice(k.indexOf(/(?!\.)\.(?=[\w\-])/));
32
41
  }
33
- if (!icon && /\s+/.test(k)) {
34
- [icon] = k.split(/\s+/);
35
- k = k.slice(icon.length).trim();
36
- }
37
42
  if (!name) name = k;
38
43
  var item = {};
39
44
  if (icon) item.icon = icon.replace(/\./g, ' ');
@@ -52,7 +57,10 @@
52
57
  }
53
58
  var getChildren = function (menu) {
54
59
  if (!menu.id) {
55
- menu.id = ++menuid;
60
+ var pathid = menu.path;
61
+ if (!idmap[pathid]) idmap[pathid] = 0;
62
+ menu.id = (menu.path || "") + "#" + idmap[pathid];
63
+ idmap[pathid]++;
56
64
  }
57
65
  if (!savedMenus[menu.id]) {
58
66
  savedMenus[menu.id] = menu;
@@ -124,6 +132,10 @@
124
132
  result.update = function (items) {
125
133
  delete result.loading_promise;
126
134
  delete result.then;
135
+ delete result.active;
136
+ savedChildren = Object.create(null);
137
+ savedMenus = Object.create(null);
138
+ idmap = Object.create(null);
127
139
  firstMenu = null;
128
140
  items = result.parse(items);
129
141
  items.map(getChildren);
@@ -158,7 +170,7 @@
158
170
  if (actived_value === historys.length) {
159
171
  setActive(actived, true);
160
172
  result.active = actived;
161
- };
173
+ }
162
174
  }
163
175
  }
164
176
  first_opened = false;
@@ -210,6 +222,7 @@
210
222
  result.open = function (menu) {
211
223
  if (!menu) {
212
224
  if (first_opened && result.active) return;
225
+ if (!result.length) result.update(items);
213
226
  var zimoilPath = zimoli.getInitPath();
214
227
  menu = result.active || findMenu(zimoilPath) || firstMenu;
215
228
  if (!menu?.path) return;
@@ -280,6 +293,5 @@
280
293
  ok(result);
281
294
  result.then = then;
282
295
  };
283
- result.update(items);
284
296
  return result;
285
297
  });
@@ -9,13 +9,16 @@
9
9
  display: block;
10
10
  text-align: center;
11
11
  }
12
+
12
13
  </style>
13
14
  <div>
14
- <a @click="logout">${i18n`退出登录`}</a>
15
+ <i18n-chooser style="float: left;"></i18n-chooser>
16
+ <a @click="logout" -bind="exitLabel()"></a>
15
17
  </div>
16
18
 
17
19
  <script>
18
20
  var a = button;
21
+ var exitLabel = () => i18n`退出登录`;
19
22
  async function logout() {
20
23
  data.setSource({});
21
24
  await user.Logout();
@@ -0,0 +1 @@
1
+ data.from("status");
@@ -44,6 +44,7 @@ var cross = cross_.bind(function (callback, onerror) {
44
44
  data = Buffer.from(data);
45
45
  this.headers["Content-Length"] = data.length;
46
46
  }
47
+ if (/^\[/.test(hostname)) hostname = hostname.replace(/^\[(.*?)\]$/, "$1");
47
48
  var options = {
48
49
  method: this.method,
49
50
  hostname,
@@ -3,7 +3,7 @@ function chooseFile(accept, multiple, extra) {
3
3
  form.innerHTML = `<input tabindex=0 ${extra ? extra + " " : ''}type='file'${accept ? ` accept="${accept}"` : ''}${multiple ? ' multiple' : ''} />`;
4
4
  var [input] = form.children;
5
5
  var result = new Promise(function (ok, oh) {
6
- if (/msie\s+[2-9]/i.test(navigator.userAgent)) return alert("无法在当前浏览器操作!");
6
+ if (/msie\s+[2-9]/i.test(navigator.userAgent)) return alert(i18n`无法在当前浏览器操作!`);
7
7
  input.onfocus = function () {
8
8
  // focus 事件比change事件早40-80毫秒
9
9
  if (opened && document.hasFocus()) {
@@ -50,7 +50,7 @@ var _create = function (commFactory, className, _invoke) {
50
50
  var head = document.getElementsByTagName("head")[0];
51
51
  function cless(commFactory, innerCss, className) {
52
52
  if (innerCss) {
53
- var stylesheet = document.createElement("style");
53
+ var stylesheet = isNode(this) ? this : document.createElement("style");
54
54
  //<!-- stylesheet.setAttribute("scope",className) -->
55
55
  stylesheet.type = "text/css";
56
56
  stylesheet.savedText = innerCss;
@@ -59,7 +59,7 @@ function cless(commFactory, innerCss, className) {
59
59
  } else {
60
60
  stylesheet.innerHTML = innerCss;
61
61
  }
62
- appendChild(head, stylesheet);
62
+ if (!stylesheet.parentNode) appendChild(head, stylesheet);
63
63
  }
64
64
  return _create(commFactory, className, _create);
65
65
  }
@@ -1,7 +1,7 @@
1
1
  var URL = window.URL, Blob = window.Blob;
2
2
  function main(basepath) {
3
3
  if (!URL || !Blob) {
4
- alert("无法在当前浏览器操作!");
4
+ alert(i18n`无法在当前浏览器操作!`);
5
5
  return;
6
6
  }
7
7
  var url = URL.createObjectURL(new Blob);
@@ -8,7 +8,7 @@
8
8
  <model _data=data _field=field _readonly="readonly"></model>
9
9
  <container class="error" -src="error"></container>
10
10
  </div>
11
- <div class="foot" ng-if="field.msg">
11
+ <div ng-if="field.msg">
12
12
  <span ng-bind=field.msg></span>
13
13
  </div>
14
14
  </template>
@@ -27,6 +27,7 @@ var reshape = function () {
27
27
  }
28
28
  if (!body) body = head;
29
29
  if (foot && body) {
30
+ console.log(foot)
30
31
  var right = foot.offsetWidth + 1;
31
32
  if (isInlineBlock && right < (this.break || body.offsetWidth >> 2)) {
32
33
  css(foot, {
@@ -6,6 +6,8 @@ function main(elem, scope, hasIcon) {
6
6
  if (isObject(scope) && scope !== ms) {
7
7
  }
8
8
  else if (ms) {
9
+ var parentScopes = hasIcon;
10
+ hasIcon = null;
9
11
  var scope = ms;
10
12
  }
11
13
  var menu = scope;
@@ -21,7 +23,7 @@ function main(elem, scope, hasIcon) {
21
23
  checker,
22
24
  };
23
25
  if (hasIcon || menu.icon) scope.hasIcon = true;
24
- render(item.children, scope);
26
+ render(item.children, scope, parentScopes);
25
27
  if (menu.line) item.setAttribute("line", ''), on("click")(item, preventDefault);
26
28
  return item;
27
29
  }
@@ -15,6 +15,7 @@ tip {
15
15
  >[body],
16
16
  >.body {
17
17
  height: 100%;
18
+
18
19
  >[textarea] {
19
20
  height: 100%;
20
21
  }
@@ -23,11 +24,12 @@ tip {
23
24
  margin: 0 -16px;
24
25
  width: auto;
25
26
  height: 100%;
26
- >list{
27
+ >list {
27
28
  min-height: auto;
28
29
  }
29
30
  }
30
31
  }
32
+
31
33
  textarea,
32
34
  [textarea] {
33
35
  width: 100%;
@@ -779,8 +779,9 @@ var directives = {
779
779
  return src2.call(this, parsedSrc && /[\{\[\s]/.test(src) ? parsedSrc.srcName : src);
780
780
  },
781
781
  model(search, target, change) {
782
- var getter = createGetter(this, search);
783
- var setter = createSetter(this, search);
782
+ search = search.split(',');
783
+ var getter = search.length > 1 ? createGetter(this, search[0])(this) : createGetter(this, search[0]);
784
+ var setter = search.length > 1 ? createGetter(this, search[1] || search[0])(this) : createSetter(this, search[0]);
784
785
  var model = new Model(getter, setter, target);
785
786
  return model.hook(this, change !== false);
786
787
  },
@@ -173,7 +173,7 @@ function main() {
173
173
  })
174
174
  if (addable) {
175
175
  var adder = document.createElement("div");;
176
- adder.innerHTML = "<a>添加</a><a>管理</a>";
176
+ adder.innerHTML = `<a>${i18n`添加`}</a><a>${i18n`管理`}</a>`;
177
177
  adder.setAttribute('insert', '');
178
178
  button(adder.firstChild);
179
179
  button(adder.children[1]);
@@ -182,10 +182,10 @@ function main() {
182
182
  var target = getTargetIn(this, event.target, false);
183
183
  switch (target) {
184
184
  case this.children[0]:
185
- var a = prompt("请输入", a => {
185
+ var a = prompt(i18n`请输入`, a => {
186
186
  if (!a) return false;
187
187
  if (a in itemMap) {
188
- return `选项 ${a} 已存在!`;
188
+ return i18n`选项 ${a} 已存在!`;
189
189
  }
190
190
  });
191
191
  page.with = a;