efront 4.24.2 → 4.24.3

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.
@@ -40,6 +40,21 @@
40
40
  - zh-CN: 禁用
41
41
  en: Disable
42
42
 
43
+ - zh-CN: 商店
44
+ en: Store
45
+
46
+ - zh-CN: 订单
47
+ en: Orders
48
+
49
+ - zh-CN: 留言
50
+ en: Messages
51
+
52
+ - zh-CN: 手动输入
53
+ en: Manual input
54
+
55
+ - zh-CN: 请输入完整密钥对,以英文逗号分割
56
+ en: "Please enter the complete key pair, separated by commas in English"
57
+
43
58
  - zh-CN: 拥有注册号的用户可查看商品
44
59
  en: Users with registration numbers can view products
45
60
 
@@ -1,10 +1,10 @@
1
1
  var hosts = data.getItem("hosts");
2
2
  if (!hosts.length) hosts.push({ key: location.host, name: location.host });
3
- var fields = refilm`
4
- 服务器地址/host* select?a ${hosts}
5
- 密码/password* password
6
- `;
7
3
  function main(host) {
4
+ var fields = refilm`
5
+ 服务器地址/host* select?a ${hosts}
6
+ 密码/password* password
7
+ `;
8
8
  var page = view();
9
9
  page.innerHTML = login;
10
10
  drag.on(page);
@@ -1 +1 @@
1
- pedit.bind(null, i18n`证书`, "cert");
1
+ pedit.bind(null, () => i18n`证书`, "cert");
@@ -1,4 +1,4 @@
1
- plist.bind(null, i18n`接口管理`, "cert", refilm`
1
+ return plist.bind(null, () => i18n`接口管理`, "cert", () => refilm`
2
2
  *域名/hostname input/253
3
3
  公钥/private text
4
4
  私钥/public text
@@ -129,7 +129,7 @@
129
129
  fields: refilm`
130
130
  $公钥/public_key/单击生成 ${function (elem) {
131
131
  var { data, field } = elem;
132
- elem.innerHTML = `<a @click=ipt()>手动输入</a>&ensp;&ensp;<a @click="gen()" -if="!data[field.key]">单击生成</a><span -else -bind="data[field.key]"></span>`;
132
+ elem.innerHTML = `<a @click=ipt()>${i18n`手动输入`}</a>&ensp;&ensp;<a @click="gen()" -if="!data[field.key]">${i18n`单击生成`}</a><span -else -bind="data[field.key]"></span>`;
133
133
  render(elem, {
134
134
  data, field, async gen() {
135
135
  await acme2.initUnique();
@@ -137,11 +137,10 @@
137
137
  await saveUnique();
138
138
  },
139
139
  async ipt() {
140
- var data = await prompt('请输入完整密钥对,以英文逗号分割', {
140
+ var data = await prompt(i18n`请输入完整密钥对,以英文逗号分割`, {
141
141
  value: acme2.pickUnique()
142
142
  });
143
143
  acme2.makeUnique(data);
144
- console.log(data);
145
144
  },
146
145
  })
147
146
  }}
@@ -5,15 +5,14 @@ function hash(a) {
5
5
  }
6
6
  return r;
7
7
  }
8
- var fields = refilm`名称/name
9
- 服务器/host
10
- 端口/port
11
- `;
12
8
  return plist.bind({
13
- fields,
9
+ fields: () => refilm`名称/name
10
+ 服务器/host
11
+ 端口/port
12
+ `,
14
13
  type: 'nodes',
15
- title: i18n`DHT服务器管理`,
16
- buttons: [{
14
+ title: () => i18n`DHT服务器管理`,
15
+ buttons: () => [{
17
16
  name: i18n`从文件读取`, async do() {
18
17
  var FileReader = window.FileReader;
19
18
  if (!FileReader) return alert(i18n`当前浏览器无法读取文件`, 'warn')
@@ -1 +1 @@
1
- pedit.bind(null, i18n`字典`, "dict");
1
+ pedit.bind(null, () => i18n`字典`, "dict");
@@ -1,11 +1,13 @@
1
- var types = refilm`
2
- 数值/number
3
- 文本/input
4
- `;
5
1
  model.setModels({
6
- dict: frame$dict.bind(null, types),
2
+ dict() {
3
+ var types = refilm`
4
+ 数值/number
5
+ 文本/input
6
+ `;
7
+ return frame$dict(types, ...arguments);
8
+ }
7
9
  });
8
- return plist.bind(null, i18n`接口管理`, "dict", refilm`
10
+ return plist.bind(null, () => i18n`接口管理`, "dict", () => refilm`
9
11
  *字典ID/key 100
10
12
  字典名/name 100
11
13
  字典数据/options dict
@@ -1,10 +1,10 @@
1
- plist.bind(null, i18n`房间`, "room", refilm`
1
+ return plist.bind(null, () => i18n`房间`, "room", () => refilm`
2
2
  *房间名/name 100
3
3
  / $ ${[{
4
- name: i18n`连接`,
4
+ name: () => i18n`连接`,
5
5
  async do(o) {
6
6
  var linkid = await data.from("room", { id: encode62.packencode(o.name) });
7
7
  popup("/link/chat", { linkid, name: o.name });
8
8
  }
9
9
  }]}
10
- `);
10
+ `);
@@ -1,26 +1,26 @@
1
- var fields = refilm`
2
- 访问量/count money/10
3
- 路径/path html/20
4
- `;
5
- var fields2 = refilm`
6
- 域名/host text/100
7
- 路径/path text/80
8
- 远程地址/remote text/100
9
- 地理位置/address/查看 act/80 ${checkGeo}
10
- 时间/time timestamp
11
- 来源/referer text/100
12
- 客户端/agent text/200
13
- `;
14
- var menus = [
15
- {
16
- name: i18n`计数`,
17
- },
18
- {
19
- name: i18n`千次快照`,
20
- }
21
- ];
22
- menus[state().index || 0].actived = true;
23
1
  function main() {
2
+ var fields = refilm`
3
+ 访问量/count money/10
4
+ 路径/path html/20
5
+ `;
6
+ var fields2 = refilm`
7
+ 域名/host text/100
8
+ 路径/path text/80
9
+ 远程地址/remote text/100
10
+ 地理位置/address/查看 act/80 ${checkGeo}
11
+ 时间/time timestamp
12
+ 来源/referer text/100
13
+ 客户端/agent text/200
14
+ `;
15
+ var menus = [
16
+ {
17
+ name: i18n`计数`,
18
+ },
19
+ {
20
+ name: i18n`千次快照`,
21
+ }
22
+ ];
23
+ menus[state().index || 0].actived = true;
24
24
  var page = div();
25
25
  page.innerHTML = template;
26
26
  var items = data.from("count", a => {
@@ -1,5 +1,11 @@
1
- frame$route.update(await data.fromURL(i18n`menu.yml`));
2
- i18n.setReloader(zimoli.reload);
1
+ var loadMenu = async function () {
2
+ frame$route.update(await data.fromURL(i18n`menu.yml`));
3
+ };
4
+ loadMenu();
5
+ i18n.setReloader(function () {
6
+ loadMenu();
7
+ zimoli.reload(false);
8
+ });
3
9
  data.loadConfig("api.yml");
4
10
  user.loginPath = '/auth/login';
5
11
  var login_queue = [], reject_queue = [];
@@ -1 +1 @@
1
- pedit.bind(null, i18n`短链接`, "proxy");
1
+ pedit.bind(null, () => i18n`短链接`, "proxy");
@@ -1,4 +1,4 @@
1
- var actions = [
1
+ var gtActions = () => [
2
2
  {
3
3
  name: i18n`访问`,
4
4
  do(o) {
@@ -8,12 +8,11 @@ var actions = [
8
8
  }
9
9
  }
10
10
  ];
11
-
12
- var fields = refilm`
11
+ var gtFields = () => refilm`
13
12
  *代理路径/url input/120
14
13
  &二维码/url ${qrcode}
15
14
  真实路径/realpath input/300
16
15
  动作/action select/100 [跳转,转发]
17
16
  状态/status select/100 [启用,禁用]
18
- / $ ${actions}`;
19
- return plist.bind(null, i18n`短链接`, "proxy", fields, "/proxy/edit");
17
+ / $ ${gtActions()}`;
18
+ return plist.bind(null, () => i18n`短链接`, "proxy", gtFields, "/proxy/edit");
@@ -1,7 +1,7 @@
1
- var fields = refilm`
2
- 路径/path
3
- `;
4
1
  function main() {
2
+ var fields = refilm`
3
+ 路径/path
4
+ `;
5
5
  var options = [
6
6
  {
7
7
  name(e) {
@@ -1 +1 @@
1
- pedit.bind(null, i18n`任务`, "task");
1
+ pedit.bind(null, () => i18n`任务`, "task");
@@ -5,7 +5,7 @@ model.setEditor('jscode', function (element) {
5
5
  return element;
6
6
  });
7
7
  model.setReader('jscode', "text");
8
- return plist.bind(null, i18n`任务管理`, "task", refilm`
8
+ return plist.bind(null, () => i18n`任务管理`, "task", () => refilm`
9
9
  *任务ID/key 100
10
10
  *任务名/name 100
11
11
  *是否启用/status radio 不启用#ccc,启用#396
@@ -1 +1 @@
1
- pedit.bind(null, i18n`密钥`, "private");
1
+ pedit.bind(null, () => i18n`密钥`, "private");
@@ -1,4 +1,4 @@
1
- plist.bind(null, i18n`密钥管理`, "private", refilm`
1
+ plist.bind(null, () => i18n`密钥管理`, "private", () => refilm`
2
2
  *键名/key 100
3
3
  显示名/name input/300
4
4
  密钥/value text/100
@@ -1,6 +1,3 @@
1
- var fields = refilm`
2
- 文件
3
- `;
4
1
  var passport = encode62.packencode(encode62.decode62(user._passport, user.session));
5
2
  var pending = [];
6
3
  async function upload(f, dist, token) {
@@ -1,11 +1,16 @@
1
1
  "use strict";
2
+ // 中共命令或纵容腾讯、字节等公司控制中国人的言论,违反中国宪法,侵害中国人的言论自由,使得正义得不到及时申张,为恶之人逍遥法外。
3
+ // 有人说,现在的学历含金量不及恢复高考初期,现在上个大学不如当时上个初中。
4
+ // 在我看来,当时上了大学的人,也不及现在的初中生有文化。
5
+ // 这些没有文化的人占据了要职要位后,执法而不知法守法,滥用职权黑箱操作,又觉得人言可畏,怕人们了解真象,才有意控制言论。
2
6
  var languageMap = {};
3
7
  var languageIndex = 0;
4
8
  function i18n() {
5
9
  var [arg] = arguments;
6
10
  if (typeof arg === 'string' || !isArrayLike(arg)) arg = arguments;
7
- return arg[isFinite(this) ? this : languageIndex];
11
+ return isFinite(this) ? arg[this] : arg[languageIndex];
8
12
  };
13
+
9
14
  i18n.lang = function (type) {
10
15
  var id = getLanguageIndexFromName(type) || 0;
11
16
  return i18n.bind(id);
@@ -38,14 +43,22 @@ i18n.setIndex = function (index) {
38
43
  i18n.supports = supports;
39
44
  i18n.reload();
40
45
  };
41
- var relaods = [];
46
+ var reloads = [];
42
47
  i18n.reload = function () {
43
- relaods.forEach(a => a());
48
+ reloads.forEach(a => a());
44
49
  };
45
50
  i18n.setReloader = function () {
46
- relaods = [];
51
+ reloads = [];
52
+ addReloader(...arguments);
53
+ };
54
+ var addReloader = i18n.addReloader = function () {
55
+ for (var callback of arguments) {
56
+ if (isFunction(callback)) reloads.push(callback);
57
+ }
58
+ }
59
+ i18n.removeReloader = function () {
47
60
  for (var callback of arguments) {
48
- if (isFunction(callback)) relaods.push(callback);
61
+ removeFromList(reloads, callback)
49
62
  }
50
63
  };
51
64
  if (this.navigator) i18n.setLanguage(this.navigator.language);
@@ -0,0 +1,43 @@
1
+ // 将数据复制到目标对象,保持目标节点对应节点的对象不变
2
+ var allsrc, alldst;
3
+ var migrate = function (dst, src) {
4
+ var cap;
5
+ var i = allsrc.indexOf(src);
6
+ if (i >= 0) dst = alldst[i];
7
+ else if (isArray(src)) {
8
+ if (!isArray(dst)) dst = [];
9
+ alldst.push(dst);
10
+ allsrc.push(src);
11
+ cap = dst.splice(0, dst.length);
12
+ for (var cx = 0, dx = src.length; cx < dx; cx++) {
13
+ var s = src[cx];
14
+ var d = cap[cx];
15
+ dst[cx] = migrate(d, s);
16
+ }
17
+ }
18
+ else if (isObject(src)) {
19
+ if (!isObject(dst)) dst = {};
20
+ alldst.push(dst);
21
+ allsrc.push(src);
22
+ cap = {};
23
+ for (var k in dst) {
24
+ cap[k] = dst[k];
25
+ }
26
+ for (var k in cap) delete dst[k];
27
+ for (var k in src) {
28
+ var s = src[k];
29
+ var d = cap[k];
30
+ dst[k] = migrate(d, s);
31
+ }
32
+ }
33
+ else dst = src;
34
+ return dst;
35
+ }
36
+ return function (dst, src) {
37
+ allsrc = [];
38
+ alldst = [];
39
+ dst = migrate(dst, src);
40
+ allsrc = null;
41
+ alldst = null;
42
+ return dst;
43
+ }
@@ -58,7 +58,7 @@ var popupEdit = function ($scope, active) {
58
58
  })
59
59
 
60
60
  };
61
- return extend([
61
+ return () => [
62
62
  {
63
63
  name: i18n`返回` + `(O)`,
64
64
  hotkey: "backspace",
@@ -213,4 +213,4 @@ return extend([
213
213
  $scope.open();
214
214
  }
215
215
  }
216
- ])
216
+ ];
@@ -220,7 +220,7 @@ function main() {
220
220
  renderWithDefaults(page, scope);
221
221
  bind('drop')(scope.listview, ondrop);
222
222
  bindkey(scope.listview);
223
- contextmenu(scope.listview, explorer$context);
223
+ contextmenu(scope.listview, explorer$context());
224
224
  on("pointerdown")(scope.listview, function () {
225
225
  if (document.activeElement !== scope.listview) scope.listview.focus();
226
226
  })
@@ -1,5 +1,5 @@
1
1
  <div head>
2
- <span v-text="origin?'${i18n`修改`}':'${i18n`添加`}'"></span><span -text="title"></span>
2
+ <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>
@@ -1,22 +1,29 @@
1
1
  function main(title, { submit }, { data: origin, fields, }) {
2
2
  var page = view();
3
3
  var item = Object.assign({}, origin);
4
- page.innerHTML = edit;
5
- drag.on(page.firstChild, page);
6
- resize.on(page);
7
4
  page.onback = function () {
8
5
  if (page.querySelector('[dirty]')) return false;
9
6
  };
10
- renderWithDefaults(page, {
7
+ var page_scope = {
11
8
  fields,
12
- title,
9
+ get title() {
10
+ var t = title;
11
+ if (isFunction(t)) t = t();
12
+ t = (origin ? i18n`修改` : i18n`添加`) + t;
13
+ return t;
14
+ },
13
15
  origin,
14
16
  scrollbar,
15
17
  data: item,
16
18
  remove() {
17
19
  remove(page);
18
20
  },
19
- });
21
+ };
22
+ page.innerHTML = template;
23
+ renderWithDefaults(page, page_scope);
24
+ drag.on(page.firstChild, page);
25
+ resize.on(page);
26
+
20
27
  on('submit')(page, async function (e) {
21
28
  e.preventDefault();
22
29
  var res = await submit(item, fields, origin);
@@ -1,6 +1,68 @@
1
- function main(title, { fields, options: options0, load, remove, buttons }, edit_ref) {
1
+ function main(gtTitle, { fields: gtFields, options: gtOptions, load, remove, buttons: gtButtons }, edit_ref) {
2
+ var title, fields, fieldsL, options, options, buttons;
3
+ var gt = function (gt, o) {
4
+ if (isFunction(gt)) gt = gt();
5
+ if (isArray(o)) {
6
+ o.splice(0, o.length);
7
+ o.push.apply(o, gt);
8
+ }
9
+ else o = gt;
10
+ return o;
11
+ }
12
+ var update = function () {
13
+ title = gt(gtTitle, title);
14
+ var options0 = gt(gtOptions);
15
+ var options1 = [
16
+ {
17
+ name: i18n`修改`,
18
+ async do(o) {
19
+ await edit(o);
20
+ },
21
+ },
22
+ {
23
+ type: "danger",
24
+ name(o) {
25
+ return this.confirm === o ? i18n`确认删除` : i18n`删除`;
26
+ },
27
+ type(o) {
28
+ return this.confirm === o ? "dark" : "danger";
29
+ },
30
+ confirm: false,
31
+ timer: 0,
32
+ async do(o) {
33
+ if (this.confirm !== o) {
34
+ this.confirm = o;
35
+ clearTimeout(this.timer);
36
+ var that = this;
37
+ this.timer = setTimeout(function () {
38
+ that.confirm = null;
39
+ render.refresh();
40
+ }, 2000);
41
+ return;
42
+ }
43
+ await remove(o);
44
+ page_scope.load();
45
+ }
46
+ }
47
+ ];
48
+ if (options1) options1.push.apply(options1, options0);
49
+ options = gt(options1, options);
50
+ buttons = gt(gtButtons, buttons);
51
+ fields = gt(gtFields, fields);
52
+ var fields1 = fields.filter(f => !f.hidden && f.inlist !== false).concat({
53
+ name: i18n`操作`,
54
+ options
55
+ })
56
+ fieldsL = gt(fields1, fieldsL);
57
+ };
2
58
  if (isString(edit_ref)) prepare(edit_ref);
3
59
  var page = document.createElement("div");
60
+ on('append')(page, function () {
61
+ i18n.addReloader(update);
62
+ });
63
+ on('remove')(page, function () {
64
+ i18n.removeReloader(update);
65
+ });
4
66
  var edit = async function (o) {
5
67
  if (!edit_ref) {
6
68
  return;
@@ -24,58 +86,29 @@ function main(title, { fields, options: options0, load, remove, buttons }, edit_
24
86
  on("submited")(p, callback);
25
87
  })
26
88
  };
27
- page.innerHTML = template;
28
- var options = [
29
- {
30
- name: i18n`修改`,
31
- async do(o) {
32
- await edit(o);
33
- },
34
- },
35
- {
36
- type: "danger",
37
- name(o) {
38
- return this.confirm === o ? i18n`确认删除` : i18n`删除`;
39
- },
40
- type(o) {
41
- return this.confirm === o ? "dark" : "danger";
42
- },
43
- confirm: false,
44
- timer: 0,
45
- async do(o) {
46
- if (this.confirm !== o) {
47
- this.confirm = o;
48
- clearTimeout(this.timer);
49
- var that = this;
50
- this.timer = setTimeout(function () {
51
- that.confirm = null;
52
- render.refresh();
53
- }, 2000);
54
- return;
55
- }
56
- await remove(o);
57
- page_scope.load();
58
- }
59
- }
60
- ];
61
- if (options0) options = options.concat(options0);
89
+ update();
62
90
  var page_scope = {
63
- title,
91
+ get title() {
92
+ return title
93
+ },
64
94
  load() {
65
95
  this.data = load();
66
96
  },
67
- fields: fields.filter(f => !f.hidden && f.inlist !== false).concat({
68
- name: i18n`操作`,
69
- options
70
- }),
97
+ fields,
71
98
  buttons,
72
99
  hasedit: !!edit_ref,
73
100
  data: [],
74
101
  async add() {
75
102
  await edit();
76
103
  },
77
- }
104
+ };
105
+ page.innerHTML = template;
78
106
  renderWithDefaults(page, page_scope);
107
+ page.reload = function () {
108
+ update();
109
+ page.innerHTML = template;
110
+ renderWithDefaults(page, page_scope);
111
+ };
79
112
  on("append")(page, function () {
80
113
  page_scope.load();
81
114
  });
@@ -138,17 +138,22 @@
138
138
  idmap = Object.create(null);
139
139
  firstMenu = null;
140
140
  items = result.parse(items);
141
- items.map(getChildren);
141
+ migrate(result, items);
142
+ result.map(getChildren);
142
143
  var opened = data.getInstance("menu-opened");
143
144
  var historys = zimoli.getCurrentHistory();
144
145
  var map = {}, mmap = {};
145
146
  historys.forEach((a, i) => map[a] = i + 1);
146
- result.splice(0, result.length);
147
147
  var actived, actived_value = 0;
148
- var a = function (menu) {
148
+ var a = function (menu, i, arr) {
149
149
  var res = checkroles(user.roles, menu.roles);
150
- if (res) {
151
- if (savedChildren[menu.id] instanceof Array) menu.children = savedChildren[menu.id].filter(a);
150
+ if (!res) arr.splice(i, 1);
151
+ else {
152
+ if (savedChildren[menu.id] instanceof Array) {
153
+ var children = savedChildren[menu.id];
154
+ backEach(children, a);
155
+ menu.children = children;
156
+ }
152
157
  if (menu.path) {
153
158
  if (!firstMenu) firstMenu = menu;
154
159
  if (map[menu.path] > actived_value) {
@@ -161,7 +166,7 @@
161
166
  }
162
167
  return res;
163
168
  };
164
- result.push.apply(result, items.filter(a));
169
+ backEach(result, a);
165
170
  result.opened = opened.map(a => mmap[a]).filter(a => !!a);
166
171
  var active = result.active;
167
172
  if (!active || result.indexOf(active) < 0) {
@@ -9,8 +9,7 @@ function plist() {
9
9
  var parse = function (a) {
10
10
  switch (typeof a) {
11
11
  case "string":
12
- if (!title) title = a;
13
- else if (!type) type = a;
12
+ if (!type) type = a;
14
13
  else if (!edit_ref) edit_ref = a;
15
14
  else idkey = a;
16
15
  break;
@@ -31,11 +30,16 @@ function plist() {
31
30
  } = a);
32
31
  }
33
32
  break;
33
+ case "function":
34
+ if (!title) title = a;
35
+ else if (!fields) fields = a;
36
+ else if (!options) options = a;
37
+ else if (!buttons) buttons = a;
34
38
  }
35
39
  }
36
40
  for (var a of arguments) parse(a);
37
41
  if (!fields) parse(this);
38
- if (!idkey) idkey = fields[0].key;
42
+ if (!idkey) idkey = (isFunction(fields) ? fields() : fields)[0].key;
39
43
  return frame$list(title, {
40
44
  load() {
41
45
  return load(type, idkey);
@@ -49,8 +53,7 @@ function plist() {
49
53
  }, edit_ref ? edit_ref : function (o) {
50
54
  var p = pedit(title, type, o);
51
55
  p.initialStyle = popup.style;
52
- popup(p, true);
53
- move.setPosition(p, [.5, .5]);
56
+ popup(p, [.5, .5]);
54
57
  return p;
55
58
  });
56
59
  }
@@ -353,7 +353,11 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
353
353
  var copyZIndex = function (e) {
354
354
  e.style.zIndex = zIndex;
355
355
  var z = zIndex - 1;
356
- if (e.with) for (var w of e.with) w.style.zIndex = z;
356
+ var ws = e.with;
357
+ if (ws){
358
+ if (isNode(ws)) ws = [ws];
359
+ for (var w of ws) w.style.zIndex = z;
360
+ }
357
361
  };
358
362
  if (zIndex > 2) {
359
363
  previousElements.forEach(copyZIndex);
@@ -435,6 +435,7 @@ var ifset = function (shouldMount) {
435
435
  e = c.$template = render(e);
436
436
  e.$comment = c;
437
437
  }
438
+ c.with = [e];
438
439
  }
439
440
  else {
440
441
  remove(c.$template);