efront 3.5.10 → 3.6.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 (39) hide show
  1. package/apps/pivot/api.yml +6 -5
  2. package/apps/pivot/auth/login.js +20 -4
  3. package/apps/pivot/link/list.html +12 -0
  4. package/apps/pivot/link/list.js +25 -0
  5. package/apps/pivot/link/list.less +9 -0
  6. package/apps/pivot/main.js +2 -2
  7. package/apps/pivot/main.less +1 -0
  8. package/apps/pivot/menu.yml +1 -1
  9. package/apps/pivot/share/edit.html +1 -1
  10. package/apps/pivot/share/edit.js +4 -2
  11. package/apps/pivot/share/list.js +41 -21
  12. package/apps/pivot/share/list.less +7 -0
  13. package/apps/pivot/wow/root.js +1 -1
  14. package/coms/basic/JSAM.js +9 -1
  15. package/coms/basic/loader.js +1 -1
  16. package/coms/basic/refilm_decode.js +2 -2
  17. package/coms/basic/sortname.js +119 -0
  18. package/coms/frame/left.js +3 -1
  19. package/coms/frame/route.js +8 -6
  20. package/coms/layer/glance.js +2 -2
  21. package/coms/zimoli/data.js +12 -8
  22. package/coms/zimoli/dispatch.js +13 -6
  23. package/coms/zimoli/input.js +0 -6
  24. package/coms/zimoli/input.less +6 -6
  25. package/coms/zimoli/model.js +20 -3
  26. package/coms/zimoli/popup.js +15 -10
  27. package/coms/zimoli/prompt.js +40 -0
  28. package/coms/zimoli/rootElements.js +1 -0
  29. package/coms/zimoli/search.js +15 -0
  30. package/coms/zimoli/select.js +26 -12
  31. package/coms/zimoli/selectLIstEdit.less +21 -0
  32. package/coms/zimoli/selectList.js +68 -8
  33. package/coms/zimoli/selectList.less +15 -2
  34. package/coms/zimoli/selectListEdit.html +15 -0
  35. package/coms/zimoli/selectListEdit.js +68 -0
  36. package/coms/zimoli/table.html +2 -2
  37. package/coms/zimoli/zimoli.js +10 -4
  38. package/package.json +1 -1
  39. package/public/efront.js +1 -1
@@ -1,5 +1,6 @@
1
- ./aapi/ authorization:
2
- login: options /::login-:a
3
- run: options /:::run
4
- share: options /::share-:opt
5
- folder: options /::file-:opt:::path?:to
1
+ / authorization:
2
+ login: options ::login-:a
3
+ run: options :::run
4
+ share: options ::share-:opt?:path
5
+ folder: options ::file-:opt:::path?:to
6
+ cluster: options ::cluster-:opt?:id
@@ -1,7 +1,10 @@
1
+ var hosts = data.getItem("hosts");
2
+ if (!hosts.length) hosts.push({ key: location.host, name: location.host });
1
3
  var fields = refilm`
4
+ 服务器地址/host* select?a ${hosts}
2
5
  密码/password* password
3
6
  `;
4
-
7
+ console.log(fields)
5
8
  function main() {
6
9
  var page = view();
7
10
  page.innerHTML = login;
@@ -9,20 +12,33 @@ function main() {
9
12
  on("append")(page, function () {
10
13
  move.bindPosition(page, [.5, .5]);
11
14
  });
12
- renderWithDefaults(page, { fields, data: {}, pending: false });
15
+ renderWithDefaults(page, {
16
+ fields, data: {
17
+ host: location.host,
18
+ }, pending: false
19
+ });
13
20
  on("submit")(page, async function () {
21
+ data.setInstance("hosts", hosts, true);
14
22
  var { password } = submit(fields, this.$scope.data);
15
23
  this.$scope.pending = true;
16
24
  page.disabled = true;
17
25
  try {
18
- var info = await data.from("login", {
26
+ var login = await data.getApi("login");
27
+ login.base = location.protocol + "//" + parseURL(this.$scope.data.host).host + "/";
28
+ cross.addDirect(login.base);
29
+ var info = await data.from(login, {
19
30
  a: encode62.timeencode(encode62.geta(password))
20
31
  }).loading_promise;
32
+ var apimap = await data.getConfig();
33
+ for (var k in apimap) {
34
+ apimap[k].base = login.base;
35
+ }
21
36
  info = encode62.timeupdate(info);
22
37
  data.setSource({ authorization: info });
23
38
  user.login({})
24
39
  go('/main')
25
- } catch {
40
+ } catch (e) {
41
+ console.log(e);
26
42
  }
27
43
  this.$scope.pending = false;
28
44
  })
@@ -0,0 +1,12 @@
1
+ <div class="clusters">
2
+ <a -repeat="(c,i) in clusters" @click="active(i)">
3
+ <span -text="c"></span>
4
+ </a>
5
+ </div>
6
+ <lattice -src="c in clients">
7
+ <padding>
8
+ <span -text=c.id></span>
9
+ <span class="time" -text=filterTime(c.optime)></span>
10
+
11
+ </padding>
12
+ </lattice>
@@ -0,0 +1,25 @@
1
+ function main() {
2
+ var page = div();
3
+ page.innerHTML = template;
4
+ renderWithDefaults(page, {
5
+ async load() {
6
+ var cs = this.clusters = data.from("cluster", { opt: "list" });
7
+ await cs.loading_promise;
8
+ this.active();
9
+ },
10
+ index: 0,
11
+ clusters: [],
12
+ filterTime(d) {
13
+ return ((new Date - d) / 1000 | 0) + "秒";
14
+ },
15
+ clients: [],
16
+ async active() {
17
+ var index = this.index;
18
+ var clusters = this.clusters;
19
+ if (index >= clusters.length) index = clusters.length - 1;
20
+ this.clients = data.lazyInstance("cluster", { opt: "list", id: clusters[index] });
21
+ },
22
+ });
23
+ page.$scope.load();
24
+ return page;
25
+ }
@@ -0,0 +1,9 @@
1
+ .clusters a {
2
+ display: inline-block;
3
+ margin-right: 20px;
4
+ padding: 0 6px;
5
+ }
6
+
7
+ .time {
8
+ color: #bbb;
9
+ }
@@ -13,8 +13,8 @@ setInterval(function () {
13
13
  }, 2000);
14
14
  login();
15
15
  var layer = layer$glance({
16
- left: "frame$left",
17
- top: 'frame$top'
16
+ left: frame$left,
17
+ top: frame$top
18
18
  });
19
19
  function main() {
20
20
  return layer;
@@ -1,3 +1,4 @@
1
1
  >:not([layer]) {
2
2
  padding: 50px 10px 0;
3
+ min-height: 100%;
3
4
  }
@@ -2,5 +2,5 @@
2
2
  共享目录管理: /share/list
3
3
  短链接: /home/short
4
4
  WEB文件管理: /wow/root
5
- # 用户: /home/short
5
+ 长连接管理: /link/list
6
6
  # 用户列表: /user/list
@@ -5,6 +5,6 @@
5
5
  </form>
6
6
  </div>
7
7
  <div foot>
8
- <button white @click="close()">取消</button>
8
+ <btn white @click="close()">取消</btn>
9
9
  <button @click="save()"> 保存 </button>
10
10
  </div>
@@ -6,8 +6,10 @@ function main({ fields, item }) {
6
6
  close() {
7
7
  return remove(page);
8
8
  },
9
- save() {
10
- return data.from("share", { opt: item ? 'update' : 'create', data: this.data }).loading_promise;
9
+ async save() {
10
+ await data.from("share", { opt: 'create', path: this.data.path }).loading_promise;
11
+ dispatch(page, 'submited');
12
+ remove(page);
11
13
  },
12
14
  data: Object.assign({}, item)
13
15
  });
@@ -1,36 +1,56 @@
1
1
  var fields = refilm`
2
2
  路径/path
3
- 挂载点/name
4
3
  `;
5
- var options = [
6
- {
7
- name: "删除",
8
- do(e) {
9
- data.from('share', { opt: 'delete', item: e });
10
- }
11
- },
12
- {
13
- name: "修改",
14
- do(e) {
15
- popup('/share/edit', { fields, item: e });
16
- }
17
- }
18
- ];
19
- console.log(fields)
20
4
  function main() {
5
+ var options = [
6
+ {
7
+ name(e) {
8
+ return this.confirm === e ? "确认取消" : "取消"
9
+ },
10
+ type: 'danger',
11
+ confirm: false,
12
+ timer: 0,
13
+ async do(e) {
14
+ if (this.confirm !== e) {
15
+ this.confirm = e;
16
+ clearTimeout(this.timer);
17
+ this.timer = setTimeout(() => render.refresh(this.confirm = null), 2000);
18
+ return;
19
+ }
20
+ await data.from('share', { opt: 'delete', path: e.path }).loading_promise;
21
+ page.$scope.load();
22
+ }
23
+ }
24
+ ];
21
25
  var page = div();
22
26
  page.innerHTML = list;
23
- var a = data.from("share", { opt: 'list' }, a => {
24
- if (a) return a.map(b => ({ path: b }));
25
- });
26
27
  renderWithDefaults(page, {
27
- data: a,
28
+ data: [],
29
+ load() {
30
+ this.data = data.from("share", { opt: 'list' }, a => {
31
+ if (a) return a.map(b => ({ path: b }));
32
+ });
33
+ },
28
34
  fields: fields.concat({
29
35
  name: "操作",
36
+ width: 200,
30
37
  type: 'button',
31
38
  options,
32
39
  }),
33
40
  });
34
- console.log(a)
41
+ page.$scope.load();
42
+ contextmenu(page, [
43
+ {
44
+ name: "添加",
45
+ do(e) {
46
+ zimoli.prepare("/share/edit", function () {
47
+ var p = popup("/share/edit", { fields });
48
+ on('submited')(p, function () {
49
+ page.$scope.load();
50
+ })
51
+ })
52
+ }
53
+ },
54
+ ])
35
55
  return page;
36
56
  }
@@ -0,0 +1,7 @@
1
+ >table {
2
+ width: 100%;
3
+ }
4
+
5
+ & {
6
+ height: 100%;
7
+ }
@@ -24,7 +24,7 @@ function main() {
24
24
  if (p) p = String(p.name || '').replace(/\/$/, '');
25
25
  if (p) this.pathlist.push(p);
26
26
  this.data = data.from("folder", { opt: 'list', path: "/" + this.pathlist.join('/') }, files => {
27
- if (files) return files.map(f => {
27
+ if (files) return sortname(files).map(f => {
28
28
  return {
29
29
  name: f,
30
30
  type: /\/$/.test(f) ? 'folder' : 'file'
@@ -40,6 +40,10 @@ function stringify(memery) {
40
40
  if (memery instanceof Date) return date(memery);
41
41
  if (memery instanceof RegExp) return regexp(memery);
42
42
  if (!convertReg.test(typeof memery)) return string(memery);
43
+ m: if (typeof memery === 'function') {
44
+ for (var k in memery) break m;
45
+ return '';
46
+ }
43
47
  var dist = [memery];
44
48
  var rest = [memery];
45
49
  var trimed = [memery instanceof Array ? [] : {}];
@@ -51,7 +55,11 @@ function stringify(memery) {
51
55
  o[""] = arr;
52
56
  for (var k in memery) {
53
57
  var m = memery[k];
54
- if (inc === +k) {
58
+ f: if (typeof m === 'function') {
59
+ for (var k in m) break f;
60
+ continue;
61
+ }
62
+ if (inc === +k && k !== '') {
55
63
  var kindex = "";
56
64
  inc++;
57
65
  } else {
@@ -809,7 +809,7 @@ modules.modules = modules;
809
809
  var requires_count = 3;
810
810
  var hook = function (requires_count) {
811
811
  if (requires_count !== 0) return;
812
- "alert confirm innerWidth innerHeight close".split(/\s+/).map(removeGlobalProperty);
812
+ "alert confirm innerWidth innerHeight close prompt".split(/\s+/).map(removeGlobalProperty);
813
813
  initPixelDecoder();
814
814
  modules.Promise = Promise;
815
815
  modules.hook_time = +new Date;
@@ -268,7 +268,7 @@ function parse(piece) {
268
268
  delete_onempty, delete_onsubmit,
269
269
  } = name;
270
270
  } else {
271
- var test = (reg,a) => {
271
+ var test = (reg, a) => {
272
272
  if (reg.test(a)) {
273
273
  return true;
274
274
  }
@@ -388,7 +388,7 @@ function parse(piece) {
388
388
  options = is(options);
389
389
  var needUnfold = /^\[|\]$/.test(options);
390
390
  options = options.replace(/^\[|\]$/g, '');
391
- if (/,/.test(options)) options = scanSlant(options, ',');
391
+ if (needUnfold || /,/.test(options)) options = scanSlant(options, ',');
392
392
  else options = scanSlant(options, "");
393
393
  if (needUnfold) unfoldOptions(size, options);
394
394
  }
@@ -0,0 +1,119 @@
1
+ var minus = function (d1, d2) {
2
+ d1 = d1.split(".");
3
+ d2 = d2.split(".");
4
+ for (var cx = 0, dx = Math.max(d1.length, d2.length); cx < dx; cx++) {
5
+ var a = +d1[cx] || 0;
6
+ var b = +d2[cx] || 0;
7
+ if (a !== b) {
8
+ return a - b;
9
+ }
10
+ }
11
+ return 0;
12
+ };
13
+
14
+ var createMap = function (str) {
15
+ str = str.split('');
16
+ var map = {};
17
+ for (var cx = 0, dx = str.length; cx < dx; cx++) {
18
+ map[str[cx]] = cx;
19
+ }
20
+ return map;
21
+ };
22
+ var 甲乙丙丁戊己庚辛壬癸 = "甲乙丙丁戊己庚辛壬癸";
23
+
24
+ var map一二三 = extend(createMap("零一二三四五六七八九"), createMap("〇壹贰叁肆伍陆柒捌玖"));
25
+ var power = {
26
+ 拾: 10,
27
+ 十: 10,
28
+ 佰: 100,
29
+ 百: 100,
30
+ 仟: 1000,
31
+ 千: 1000,
32
+ 万: 10000,
33
+ 萬: 10000,
34
+ 亿: 100000000,
35
+ };
36
+ var parse一二三 = function (a) {
37
+ if (!/[十百千万亿拾佰仟萬]/.test(a)) return parseInt(a.split("").map(a => map一二三[a]).join(''));
38
+ var base = 0;
39
+ a.replace(/([^十百千万亿拾佰仟萬零〇]*)([十百千万亿拾佰仟萬]*)/g, function (_, a, b) {
40
+ if (!_) return;
41
+ if (!a) a = 1;
42
+ else a = map一二三[a];
43
+ var r = 1;
44
+ b.split('').forEach(b => r *= power[b]);
45
+ base += a * r;
46
+ })
47
+ return base;
48
+ };
49
+ var map甲乙丙 = createMap("甲乙丙丁戊己庚辛壬癸");
50
+ var map子丑寅 = createMap("子丑寅卯辰巳午未申酉戌亥");
51
+
52
+ var reg123 = /^(\d+|\d+[\.\d]+\d+)[\s\S]*$/;
53
+ var reg一二三 = /^([一二三四五六七八九十百千万亿壹贰叁肆伍陆柒捌玖拾佰仟萬零〇]+)[\s\S]*$/;
54
+ var reg甲乙丙 = /^([甲乙丙丁戊己庚辛壬癸])[\s\S]*$/;
55
+ var reg子丑寅 = /^([子丑寅卯辰巳午未申酉戌亥])[\s\S]*$/;
56
+ var reg天干地支 = /^([甲乙丙丁戊己庚辛壬癸][子丑寅卯辰巳午未申酉戌亥])[\s\S]*$/;
57
+
58
+ var getDelta = function (a, b, reg, parse) {
59
+ var match1 = reg.exec(a);
60
+ var match2 = reg.exec(b);
61
+ if (match1 && match2) {
62
+ var [, d1] = match1;
63
+ var [, d2] = match2;
64
+ if (parse) {
65
+ d1 = parse(d1);
66
+ d2 = parse(d2);
67
+ var delta = d1 - d2;
68
+ } else {
69
+
70
+ var delta = minus(d1, d2);
71
+ }
72
+ if (delta) return delta;
73
+ }
74
+ if (match1) return -1;
75
+ if (match2) return 1;
76
+ return 0;
77
+ };
78
+ var parse干支 = function (a) {
79
+ var [g, z] = a;
80
+ g = map甲乙丙[g];
81
+ z = map子丑寅[z];
82
+ return (12 + g - z) % 12 / 2 * 10 + g + 1;
83
+ };
84
+ var compare = function (a, b) {
85
+ for (var cx1 = a.length - 1, cx2 = a.length - 1; cx1 >= 0 && cx2 >= 0; cx1--, cx2--) {
86
+ while (/\s\u00a0/.test(a[cx1])) cx1--;
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;
89
+ }
90
+ a = a.slice(0, cx1 + 1);
91
+ b = b.slice(0, cx2 + 1);
92
+ for (var cx1 = 0, cx2 = 0, dx1 = a.length, dx2 = b.length; cx1 < dx1 && cx2 < dx2; cx1++, cx2++) {
93
+ while (/[\s\u00a0]/.test(a[cx1])) cx1++;
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;
96
+ }
97
+ if (cx1) a = a.slice(cx1);
98
+ if (cx2) b = b.slice(cx2);
99
+ if (!a) return -1;
100
+ if (!b) return 1;
101
+ var delta = getDelta(a, b, reg123);
102
+ if (delta) return delta;
103
+ delta = getDelta(a, b, reg一二三, parse一二三);
104
+ if (delta) return delta;
105
+ delta = getDelta(a, b, reg天干地支, parse干支);
106
+ if (delta) return delta;
107
+ delta = getDelta(a, b, reg甲乙丙, d => map甲乙丙[d]);
108
+ if (delta) return delta;
109
+ delta = getDelta(a, b, reg子丑寅, d => map子丑寅[d]);
110
+ if (delta) return delta;
111
+ return 0;
112
+ }
113
+ function sortname(list = this) {
114
+ if (this !== arguments[1] && arguments.length === 2) {
115
+ return compare(arguments[0], arguments[1]);
116
+ }
117
+ list = list.sort(compare);
118
+ return list;
119
+ }
@@ -1,7 +1,6 @@
1
1
  var page = document.createElement("都说我负天下人_可你们天下人_又何曾善待过我");
2
2
  page.innerHTML = left;
3
3
  if (!user.avatar) user.avatar = "user/avatar.png";
4
- frame$route.fetch('menu.yml')
5
4
  render(page, {
6
5
  ylist: menu,
7
6
  btn: button,
@@ -11,6 +10,9 @@ render(page, {
11
10
  popup,
12
11
  menus: frame$route,
13
12
  });
13
+ on('append')(page, function () {
14
+ frame$route.open();
15
+ });
14
16
  function main() {
15
17
  return page;
16
18
  }
@@ -98,9 +98,9 @@
98
98
  if (!active || result.indexOf(active) < 0) {
99
99
  actived = mmap[opened.active] || actived;
100
100
  if (actived) {
101
- if (actived_value === historys.length) result.open(actived);
102
- } else {
103
- result.open(result[0]);
101
+ if (actived_value === historys.length) {
102
+ result.active = actived;
103
+ };
104
104
  }
105
105
  }
106
106
  return result;
@@ -133,7 +133,10 @@
133
133
  }
134
134
  });
135
135
  result.open = function (menu) {
136
- if (!menu) return;
136
+ if (!menu) {
137
+ menu = result.active || result[0];
138
+ delete result.active;
139
+ }
137
140
  if (!menu.path) {
138
141
  menu.closed = !menu.closed;
139
142
  return;
@@ -176,7 +179,6 @@
176
179
  data.from(url).loading_promise.then(result.update);
177
180
  return result;
178
181
  };
179
- if (items.length) result.update(items);
180
-
182
+ result.update(items);
181
183
  return result;
182
184
  });
@@ -104,10 +104,10 @@ function main(mainPath, historyName = "") {
104
104
  }
105
105
  zimoli();
106
106
  };
107
- if (leftPath) {
107
+ if (typeof leftPath === 'string') {
108
108
  zimoli.prepare(leftPath, hook);
109
109
  } else hook();
110
- if (topPath) {
110
+ if (typeof topPath === 'string') {
111
111
  zimoli.prepare(topPath, hook);
112
112
  } else hook();
113
113
  });
@@ -333,25 +333,23 @@ function fixApi(api, href) {
333
333
  }
334
334
  api.base = href;
335
335
  api.path = api.url;
336
- if (/^\.([\?\#][\s\S]*)?$/.test(api.url)) {
337
- api.url = href + api.url.replace(/^\./, "");
338
- } else {
339
- api.url = href + api.url;
336
+ if (/^\.([\?\#][\s\S]*)?$/.test(api.path)) {
337
+ api.path = api.path.replace(/^\./, "");
340
338
  }
341
339
  if (extraSearch || extraHash) {
342
340
  if (/[\?#]/.test(api.url)) {
343
341
  var [, search, hash] = paramReg.exec(api.url);
344
342
  }
345
- var url = api.url.replace(paramReg, '');
343
+ var path = api.path.replace(paramReg, '');
346
344
  if (extraSearch) {
347
345
  search = search ? extraSearch + '&' + search : extraSearch;
348
346
  }
349
347
  if (extraHash) {
350
348
  hash = hash ? extraHash + '&' + hash : extraHash;
351
349
  }
352
- if (search) url += '?' + search;
353
- if (hash) url += "#" + hash;
354
- api.url = url;
350
+ if (search) path += '?' + search;
351
+ if (hash) path += "#" + hash;
352
+ api.path = path;
355
353
  }
356
354
  }
357
355
  }
@@ -434,6 +432,9 @@ var privates = {
434
432
  },
435
433
  fromApi(api, params) {
436
434
  let url = api.url;
435
+ var base = api.base;
436
+ if (base) url = base + api.path;
437
+ console.log(url, base);
437
438
 
438
439
  if (this.validApi(api, params)) {
439
440
  params = this.repare(api, params);
@@ -657,6 +658,9 @@ var data = {
657
658
  data = this.parseConfig(data);
658
659
  configPormise = Promise.resolve(data);
659
660
  },
661
+ getConfig() {
662
+ return privates.getConfigPromise();
663
+ },
660
664
  parseConfig(o) {
661
665
  if (o instanceof Promise) {
662
666
  return o.then(createApiMap);
@@ -9,15 +9,22 @@ var dispatch = "dispatchEvent" in document ? function dispatchEvent(target, even
9
9
  }
10
10
  };
11
11
  function main() {
12
- var target, event;
12
+ var target, event, value;
13
13
  for (var cx = 0, dx = arguments.length; cx < dx; cx++) {
14
14
  var arg = arguments[cx];
15
- if (isString(arg)) {
16
- event = createEvent(arg);
17
- } else if (isNode(arg) || arg === window || arg === document) {
15
+ if (isNode(arg) || arg === window || arg === document) {
18
16
  target = arg;
19
- } else {
20
- event = arg;
17
+ }
18
+ else if (!event) {
19
+ if (isString(arg)) {
20
+ event = createEvent(arg);
21
+ }
22
+ else {
23
+ event = arg;
24
+ }
25
+ }
26
+ else {
27
+ event.value = arg;
21
28
  }
22
29
  }
23
30
  if (dispatch(target || window, event)) {
@@ -66,12 +66,6 @@ function input(element) {
66
66
  on("keydown")(element, number);
67
67
  break;
68
68
  }
69
- if (format) {
70
- var picker = selectDate(format, input.value);
71
- on("change")(element, picker.update);
72
- select(element, picker);
73
- element.readonly = "readonly";
74
- }
75
69
  }
76
70
  return element;
77
71
  }
@@ -30,13 +30,13 @@
30
30
  display: none;
31
31
  }
32
32
 
33
- &::-webkit-calendar-picker-indicator {
34
- display: none;
35
- }
33
+ // &::-webkit-calendar-picker-indicator {
34
+ // display: none;
35
+ // }
36
36
 
37
- &::-webkit-calendar-picker-indicator:hover {
38
- display: none;
39
- }
37
+ // &::-webkit-calendar-picker-indicator:hover {
38
+ // display: none;
39
+ // }
40
40
 
41
41
  &::-webkit-clear-button {
42
42
  display: none;
@@ -72,9 +72,26 @@ var constructors = {
72
72
  cast(elem, field);
73
73
  return elem;
74
74
  },
75
- select() {
76
- var elem = select();
77
- elem.innerHTML = `<option ng-repeat="(o,i) in field.options" ng-bind="o.name||o" _value="o.key!==undefined?o.key:o"></option>`;
75
+ select(_, t) {
76
+ if (!t) {
77
+ var elem = select();
78
+ elem.innerHTML = `<option ng-repeat="(o,i) in field.options" ng-bind="o.name||o" _value="o.key!==undefined?o.key:o"></option>`;
79
+ }
80
+ else if (t === 'a') {
81
+ var { field, data } = _;
82
+ var pad = selectList(field.options, field.multi, true);
83
+ var e = document.createElement('select');
84
+ var opt = null;
85
+ for (var o of field.options) {
86
+ if (o.key === data[field.key]) {
87
+ opt = o;
88
+ break;
89
+ }
90
+ }
91
+ e.innerHTML = `<option selected value="${opt ? opt.key : ''}">${opt ? opt.name : '请选择'}</option>`;
92
+ e.value = opt ? opt.key : '';
93
+ elem = select(e, pad);
94
+ }
78
95
  return elem;
79
96
  },
80
97
  "repeat"(_, field_type) {