efront 4.23.8 → 4.24.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 (85) hide show
  1. package/#/345/233/275/351/231/205/345/214/226.yml +237 -0
  2. package/apps/pivot/#/345/233/275/351/231/205/345/214/226.yml +2 -0
  3. package/apps/pivot/auth/login.html +2 -1
  4. package/apps/pivot/auth/login.js +1 -0
  5. package/apps/pivot/auth/login.less +1 -0
  6. package/apps/pivot/cert/edit.js +1 -1
  7. package/apps/pivot/cert/list.js +1 -1
  8. package/apps/pivot/cert/main.xht +6 -6
  9. package/apps/pivot/cert/orders.xht +8 -8
  10. package/apps/pivot/cert/update.xht +3 -3
  11. package/apps/pivot/db/config.xht +1 -1
  12. package/apps/pivot/db/edit.xht +4 -5
  13. package/apps/pivot/db/list.xht +4 -4
  14. package/apps/pivot/dht/list.js +4 -4
  15. package/apps/pivot/dict/edit.js +1 -1
  16. package/apps/pivot/dict/list.js +1 -1
  17. package/apps/pivot/home/welcome.html +12 -9
  18. package/apps/pivot/home/welcome.js +3 -3
  19. package/apps/pivot/link/index.js +7 -4
  20. package/apps/pivot/link/list.html +2 -2
  21. package/apps/pivot/link/room.js +2 -2
  22. package/apps/pivot/main.js +2 -0
  23. package/apps/pivot/menu-en.yml +16 -0
  24. package/apps/pivot/proxy/edit.js +1 -1
  25. package/apps/pivot/proxy/list.js +2 -2
  26. package/apps/pivot/share/edit.html +3 -3
  27. package/apps/pivot/share/list.js +3 -3
  28. package/apps/pivot/task/edit.js +1 -1
  29. package/apps/pivot/task/invoke.html +1 -1
  30. package/apps/pivot/task/invoke.js +2 -2
  31. package/apps/pivot/task/list.js +3 -3
  32. package/apps/pivot/task/rsync.html +3 -3
  33. package/apps/pivot/task/rsync.js +1 -1
  34. package/apps/pivot/token/edit.js +1 -1
  35. package/apps/pivot/token/list.js +1 -1
  36. package/apps/pivot/wow/root.js +1 -1
  37. package/apps/pivot//344/270/273/351/241/265.html +1 -1
  38. package/coms/basic/#loader.js +7 -0
  39. package/coms/basic/cross_.js +4 -3
  40. package/coms/basic/i18n-chooser.xht +17 -0
  41. package/coms/basic/i18n-supports.js +30 -0
  42. package/coms/basic/i18n.js +25 -1
  43. package/coms/basic_/Promise.js +21 -18
  44. package/coms/basic_/WeakMap.js +12 -6
  45. package/coms/compile/Program.js +4 -4
  46. package/coms/compile/translate.js +11 -3
  47. package/coms/frame/list.html +1 -1
  48. package/coms/frame/list.js +1 -1
  49. package/coms/frame/route.js +22 -9
  50. package/coms/pivot/left-footer.xht +4 -1
  51. package/coms/zimoli/chooseFile.js +1 -1
  52. package/coms/zimoli/cless.js +2 -2
  53. package/coms/zimoli/confirm.js +7 -1
  54. package/coms/zimoli/createUploadURL.js +1 -1
  55. package/coms/zimoli/field.html +1 -1
  56. package/coms/zimoli/field.js +1 -0
  57. package/coms/zimoli/field.less +3 -1
  58. package/coms/zimoli/getCursorPosition.js +1 -1
  59. package/coms/zimoli/menu.js +1 -1
  60. package/coms/zimoli/menuItem.js +3 -1
  61. package/coms/zimoli/prompt.js +19 -26
  62. package/coms/zimoli/prompt.less +20 -7
  63. package/coms/zimoli/render.js +17 -8
  64. package/coms/zimoli/selectList.js +3 -3
  65. package/coms/zimoli/selectListEdit.html +5 -5
  66. package/coms/zimoli/yousure.js +2 -2
  67. package/coms/zimoli/zimoli.js +47 -14
  68. package/coms//350/214/250/350/217/260/tab.js +1 -0
  69. package/coms//350/214/250/350/217/260//347/274/226/350/276/221/346/241/206.xht +50 -11
  70. package/docs/main.xht +19 -6
  71. package/docs//345/267/245/345/205/267//345/233/275/351/231/205/345/214/226.xht +3 -36
  72. package/docs//347/273/204/344/273/266.xht +1 -1
  73. package/package.json +1 -1
  74. package/public/efront.js +1 -1
  75. package/public/pivot/api.yml +0 -46
  76. package/public/pivot/menu.yml +0 -16
  77. package/public/pivot/page/auth/login.txt +0 -1
  78. package/public/pivot/page/cert/main.txt +0 -1
  79. package/public/pivot/page/cert/orders.txt +0 -1
  80. package/public/pivot/page/cert/update.txt +0 -1
  81. package/public/pivot/page/db/act.txt +0 -1
  82. package/public/pivot/page/db/config.txt +0 -1
  83. package/public/pivot/page/db/edit.txt +0 -1
  84. package/public/pivot/page/db/list.txt +0 -1
  85. package/public/pivot//344/270/273/351/241/265.html +0 -46
@@ -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,7 +6,9 @@
6
6
  padding: 8px 0;
7
7
  border-bottom: 1px solid #0001;
8
8
  }
9
-
9
+ &:empty{
10
+ display: none;
11
+ }
10
12
  >.head,
11
13
  >.foot {
12
14
  padding: 2px 16px;
@@ -13,9 +13,9 @@ var getCursorPosition = function () {
13
13
  focusNode.nodeValue = nodeValue.slice(0, focusOffset);
14
14
  focusNode.parentNode.insertBefore(cursor, focusNode.nextSibling);
15
15
  position = getScreenPosition(cursor);
16
- cursor.parentNode.removeChild(cursor);
17
16
  focusNode.nodeValue = nodeValue;
18
17
  }
18
+ if (cursor.parentNode) cursor.parentNode.removeChild(cursor);
19
19
  selection.setBaseAndExtent(anchorNode, anchorOffset, focusNode, focusOffset)
20
20
  return position;
21
21
  };
@@ -187,7 +187,7 @@ function main() {
187
187
  if (s.actived) {
188
188
  elem.selected = s.actived;
189
189
  }
190
- else if (direction === 't') {
190
+ else if (direction === 't' || istag) {
191
191
  elem.selected = s[0];
192
192
  if (elem.selected) elem.selected.setActive(true);
193
193
  }
@@ -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
  }
@@ -17,6 +17,18 @@ var validate = function (text, checker, tip) {
17
17
  valid = settip(tip, valid);
18
18
  return valid;
19
19
  };
20
+ var fixContainer = function (elem, ipt) {
21
+ var lastChild = ipt.lastChild;
22
+ if (!lastChild) return;
23
+ var deltaHeight = lastChild.offsetHeight + lastChild.offsetTop - ipt.clientHeight;
24
+ if (Math.abs(deltaHeight) < 1) return;
25
+ var offsetHeight = elem.offsetHeight;
26
+ var targetHeight = offsetHeight + deltaHeight;
27
+ if (targetHeight > innerHeight) targetHeight = +innerHeight;
28
+ else if (offsetHeight > 260 && targetHeight < 260) targetHeight = 260;
29
+ css(elem, { height: targetHeight });
30
+ move.fixPosition(elem);
31
+ };
20
32
  function prompt() {
21
33
  var msg = i18n`请输入`, check, ipt;
22
34
  var opts = [];
@@ -53,30 +65,7 @@ function prompt() {
53
65
  var getValue = () => isFunction(ipt.getValue) ? ipt.getValue() : ipt.value;
54
66
  if (check || wrap) {
55
67
  var setDisable = function (event) {
56
- var bd = c.body;
57
- if (wrap && bd) {
58
- if (p) move.setPosition(c, p);
59
- var cp = getCursorPosition();
60
- var bp = getScreenPosition(bd);
61
- var s = getComputedStyle(ipt);
62
- var pl = parseFloat(s.paddingLeft) * 2 + ipt.clientLeft + ipt.offsetLeft;
63
- var pr = parseFloat(s.borderRightWidth) + parseFloat(s.paddingRight) * 2 + (bd.scrollWidth - ipt.offsetLeft - ipt.offsetWidth);
64
- var pt = parseFloat(s.paddingTop) * 2 + ipt.clientTop + ipt.offsetTop;
65
- var pb = parseFloat(s.borderBottomWidth) + parseFloat(s.paddingBottom) * 2 + (bd.scrollHeight - ipt.offsetTop - ipt.offsetHeight);
66
-
67
- if (cp.left < bp.left + pl) {
68
- bd.scrollLeft -= bp.left + pl - cp.left;
69
- }
70
- if (cp.right > bp.right - pr) {
71
- bd.scrollLeft += cp.right + pr - bp.right;
72
- }
73
- if (cp.top < bp.top + pt) {
74
- bd.scrollTop -= bp.top + pt - cp.top;
75
- }
76
- if (cp.bottom > bp.bottom - pb) {
77
- bd.scrollTop += cp.bottom + pb - cp.bottom;
78
- }
79
- }
68
+ fixContainer(c, ipt);
80
69
  if (!check) return;
81
70
  var valid = validate(getValue(), check, tip);
82
71
  if (event) attr(body, "error", !valid);
@@ -120,11 +109,15 @@ function prompt() {
120
109
  oncemount(c, function () {
121
110
  requestAnimationFrame(function () {
122
111
  p = move.getPosition(c);
112
+ css(c, {
113
+ height: c.offsetHeight
114
+ });
123
115
  });
124
116
  once('dragend')(c, function () {
125
117
  p = move.getPosition(c);
126
- })
127
- })
118
+ });
119
+ });
120
+ resize.on(c);
128
121
  }
129
122
  return c;
130
123
  }
@@ -12,23 +12,36 @@ tip {
12
12
  }
13
13
  }
14
14
 
15
- [body],
16
- .body {
17
- >div {
15
+ >[body],
16
+ >.body {
17
+ height: 100%;
18
+ >[textarea] {
18
19
  height: 100%;
19
20
  }
20
- }
21
21
 
22
+ >.编辑框 {
23
+ margin: 0 -16px;
24
+ width: auto;
25
+ height: 100%;
26
+ >list{
27
+ min-height: auto;
28
+ }
29
+ }
30
+ }
22
31
  textarea,
23
32
  [textarea] {
24
33
  width: 100%;
25
34
  resize: none;
35
+ border: 1px solid #ddd;
36
+
37
+ &:focus {
38
+ border-color: #09c;
39
+ outline: none;
40
+ }
26
41
  }
27
42
 
28
43
  >[body],
29
- >.body {
30
- max-height: 360px;
31
- }
44
+ >.body {}
32
45
 
33
46
  [textarea] {
34
47
  min-height: 80px;
@@ -32,7 +32,8 @@ var createTemplateNodes = function (text) {
32
32
  this.with = [node];
33
33
  return;
34
34
  } else {
35
- var node = document.createElement(this.parentNode.tagName || "div");
35
+ var parentNode = this.parentNode;
36
+ var node = parentNode ? parentNode.cloneNode(false) : document.createElement("div");
36
37
  node.innerHTML = text;
37
38
  this.with = Array.apply(null, node.childNodes);
38
39
  }
@@ -53,7 +54,10 @@ var createCloner = function (node) {
53
54
  };
54
55
 
55
56
  presets.template = function (t) {
56
- var comment = document.createComment('template');
57
+ var comment = document.createComment('');
58
+ // <!--
59
+ comment = document.createComment('template');
60
+ // -->
57
61
  $scoped.set(comment, $scoped.get(t));
58
62
  $parented.set(comment, $parented.get(t));
59
63
  t.$comment = comment;
@@ -215,7 +219,10 @@ var createGetter = function (target, search, isprop = true) {
215
219
  return toUndefined;
216
220
  };
217
221
  var createComment = function (type, expression) {
218
- var comment = document.createComment(`${type} ${expression}`);
222
+ var comment = document.createComment(``);
223
+ //<!--
224
+ comment = document.createComment(`${type} ${expression}`);
225
+ // -->
219
226
  $scoped.set(comment, $scoped.get(this));
220
227
  $structed.set(comment, $structed.get(this));
221
228
  $parented.set(comment, $parented.get(this));
@@ -402,9 +409,10 @@ var createRepeat = function (search, id = 0, struct) {
402
409
  initialComment(comment, renders, struct);
403
410
  return comment;
404
411
  };
412
+ var $elements = new WeakMap;
405
413
 
406
414
  var ifget = function () {
407
- var elements = this.$elements;
415
+ var elements = $elements.get(this);
408
416
  var shouldMount = -1;
409
417
  for (var cx = 0, dx = elements.length; cx < dx; cx += 2) {
410
418
  var getter = elements[cx + 1];
@@ -416,7 +424,7 @@ var ifget = function () {
416
424
  return shouldMount;
417
425
  }
418
426
  var ifset = function (shouldMount) {
419
- var elements = this.$elements;
427
+ var elements = $elements.get(this);
420
428
  for (var cx = 0, dx = elements.length; cx < dx; cx += 2) {
421
429
  var c = elements[cx];
422
430
  if (cx === shouldMount) {
@@ -444,7 +452,7 @@ var createIf = function (search, id = 0, struct) {
444
452
  var renders = [new Binder2(ifget, ifset)];
445
453
  var comment = elements[0] = createComment.call(element, 'if', search);
446
454
  comment.$id = id;
447
- comment.$elements = elements;
455
+ $elements.set(comment, elements);
448
456
  if (struct.once) renders.r1 = true;
449
457
  initialComment(comment, renders, struct);
450
458
  return comment;
@@ -771,8 +779,9 @@ var directives = {
771
779
  return src2.call(this, parsedSrc && /[\{\[\s]/.test(src) ? parsedSrc.srcName : src);
772
780
  },
773
781
  model(search, target, change) {
774
- var getter = createGetter(this, search);
775
- 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]);
776
785
  var model = new Model(getter, setter, target);
777
786
  return model.hook(this, change !== false);
778
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;
@@ -1,15 +1,15 @@
1
1
  <div head>管理选项</div>
2
2
  <div body>
3
3
  <div>
4
- <input placeholder="搜索或添加" v-model="search" @keydown.enter="add()" /><a @click="add()"
5
- -if="search&&!filtered.hasFullmatch">添加</a>
4
+ <input placeholder="${i18n`搜索或添加`}" v-model="search" @keydown.enter="add()" /><a @click="add()"
5
+ -if="search&&!filtered.hasFullmatch">${i18n`添加`}</a>
6
6
  </div>
7
7
  <div class="item" -repeat="o in (search?filtered:options)">
8
8
  <span -html=o.name||o.innerHTML></span>
9
- <a type="danger" @click="del(o)">删除</a>
9
+ <a type="danger" @click="del(o)">${i18n`删除`}</a>
10
10
  </div>
11
11
  </div>
12
12
  <div foot>
13
- <btn @click="save()">确定</btn>
14
- <btn type="white" @click="remove()">取消</btn>
13
+ <btn @click="save()">${i18n`确定`}</btn>
14
+ <btn type="white" @click="remove()">${i18n`取消`}</btn>
15
15
  </div>
@@ -2,8 +2,8 @@
2
2
  /**
3
3
  * 确定就继续,取消就中断
4
4
  */
5
- function yousure(title = "您确定要这么做吗?", content = "当前操作需要您再次确认") {
6
- var options = [button("确定(Y)"), button("取消(N)", "white")];
5
+ function yousure(title = i18n`您确定要这么做吗?`, content = i18n`当前操作需要您再次确认`) {
6
+ var options = [button(i18n`确定` + "(Y)"), button(i18n`取消` + "(N)", "white")];
7
7
  options[0].tabindex = -1;
8
8
  options[1].tabindex = -1;
9
9
  var changeFocus = function (event) {
@@ -136,7 +136,11 @@ function go(pagepath, args, history_name, oldpagepath) {
136
136
  history_name.activate = pgpath;
137
137
  history_name.activateNode = page;
138
138
  }
139
- else if (isString(pgpath)) {
139
+ if (!page) {
140
+ addGlobal(null, history_name, isRecover);
141
+ return;
142
+ }
143
+ if (isString(pgpath)) {
140
144
  page.disptch();
141
145
  }
142
146
  if (isRecover) setWithStyle(page, false);
@@ -151,6 +155,7 @@ var page_generators = {};
151
155
  */
152
156
  var loading_tree = {};
153
157
  var pathmaped = Object.create(null);
158
+ var realmaped = Object.create(null);
154
159
  var getpgpath = function (pagepath) {
155
160
  pagepath = /^[@#!]/.test(pagepath) ? pagepath.slice(1) : pagepath;
156
161
  if (pagepath === 'main') pagepath = modules.efrontPath || "/main";
@@ -166,8 +171,10 @@ var getpgpath = function (pagepath) {
166
171
  for (var m of mparams) argobj[m] = params.pop();
167
172
  if (params.length) argobj[m] += "/" + params.reverse().join("/");
168
173
  }
174
+ pagepath = realmaped[pagepath] || pagepath;
169
175
  return [pagepath, argobj];
170
176
  }
177
+ pagepath = realmaped[pagepath] || pagepath;
171
178
  return [pagepath];
172
179
  };
173
180
  function createState(pgpath) {
@@ -479,12 +486,19 @@ var history = {};
479
486
  var current_history, default_history = current_history = "";
480
487
  history[current_history] = createEmptyHistory('/main', false);
481
488
  var history_session_object_key = `紫茉莉:${location_pathname}`;
482
- try {
483
- history = JSAM.parse(historyStorage.getItem(history_session_object_key)) || history;
484
- } catch (e) {
485
- }
489
+ var setStorage = function (storage) {
490
+ historyStorage = storage;
491
+ try {
492
+ var history1 = JSAM.parse(historyStorage.getItem(history_session_object_key));
493
+ if (history1 && history1.wlength === window_history.length) history = history1;
494
+ else savestate();
495
+ } catch (e) {
496
+ }
497
+ };
498
+ setStorage(historyStorage);
486
499
  var root_path;
487
500
  var savestate = function () {
501
+ history.wlength = window_history.length;
488
502
  historyStorage.setItem(history_session_object_key, JSAM.stringify(history) || null);
489
503
  };
490
504
  var pushstate = function (path_name, history_name) {
@@ -511,6 +525,7 @@ var pushstate = function (path_name, history_name) {
511
525
  if (_history[_history.index] !== path_name) {
512
526
  _history.splice(_history.index, _history.length - _history.index);
513
527
  _history[_history.index] = path_name;
528
+ index = _history.index;
514
529
  }
515
530
  _history.lastIndex = index;
516
531
  }
@@ -671,7 +686,7 @@ function addGlobal(element, name = null, isBack) {
671
686
  if (oldElement) {
672
687
  var oldPrev = oldElement.previousSibling, oldPare = oldElement.parentNode;
673
688
  remove(oldElement);
674
- oldElement = oldPrev || oldPare.firstChild;
689
+ oldElement = oldPrev || oldPare?.firstChild;
675
690
  }
676
691
  if (isBack || !oldElement) appendChild.insert(body, element);
677
692
  else appendChild.after(oldElement, element);
@@ -750,20 +765,15 @@ remove.transition = transition;
750
765
  zimoli.prepare = prepare;
751
766
  var upwith = [];
752
767
  zimoli.upwith = popup.upwith(upwith);
753
- zimoli.setStorage = function (storage) {
754
- historyStorage = storage;
755
- try {
756
- history = JSAM.parse(historyStorage.getItem(history_session_object_key)) || history;
757
- } catch (e) {
758
- }
759
- };
760
- zimoli.register = function (pathlike) {
768
+ zimoli.setStorage = setStorage;
769
+ zimoli.register = function (pathlike, realpath) {
761
770
  var params = [];
762
771
  pathlike = pathlike.replace(/\/\:([^\/\:\-]+)/g, function (_, id) {
763
772
  params.push(id);
764
773
  return '';
765
774
  });
766
775
  pathmaped[pathlike] = params;
776
+ if (realpath) realmaped[pathlike] = realpath;
767
777
  };
768
778
  zimoli.clearHistory = function () {
769
779
  historyStorage.removeItem(history_session_object_key);
@@ -881,6 +891,29 @@ zimoli.enableTouchBack = function () {
881
891
  }
882
892
  }, 'x')
883
893
  };
894
+ zimoli.reload = function () {
895
+ for (var k in history) {
896
+ var h = history[k];
897
+ if (!h) continue;
898
+ if (h instanceof Array) h.forEach(a => {
899
+ [a] = getpgpath(a);
900
+ delete modules[a];
901
+ delete page_generators[a];
902
+ })
903
+ var g = global[k];
904
+ if (g) remove(g);
905
+ delete global[k];
906
+
907
+ }
908
+ var loginpath = user.loginPath;
909
+ if (loginpath) {
910
+ delete modules[loginpath];
911
+ delete page_generators[loginpath];
912
+ }
913
+ current_history = default_history;
914
+ body = document.body;
915
+ zimoli();
916
+ };
884
917
  zimoli.alert = function () {
885
918
  var ae = alert.apply(this, arguments);
886
919
  zimoli.upwith(ae.parentNode);
@@ -137,6 +137,7 @@ return function (elem, forcetab) {
137
137
  return;
138
138
  }
139
139
  if (forcetab === false) {
140
+ if (!rowNode) return;
140
141
  if (!rowNode.innerText) remove(rowNode.childNodes);
141
142
  [parentNode, child, spaceSize] = getPrevEnsp(rowNode);
142
143
  if (!spaceSize) return;
@@ -5,6 +5,8 @@
5
5
  border-bottom: 0;
6
6
  display: block;
7
7
  padding: 0;
8
+ max-height: 100%;
9
+ min-height: 6em;
8
10
  }
9
11
 
10
12
  &.noinput {
@@ -33,7 +35,6 @@
33
35
  >[clist] {
34
36
  display: inline-block;
35
37
  vertical-align: top;
36
- min-height: 100%;
37
38
  outline: none;
38
39
 
39
40
  >n,
@@ -48,7 +49,7 @@
48
49
  margin-left:-@{w}em;
49
50
  border-left: @{w}em solid transparent;
50
51
  width: 100%;
51
- overflow-x: scroll;
52
+ overflow-x: auto;
52
53
  }
53
54
 
54
55
  >[nlist] {
@@ -73,6 +74,7 @@
73
74
 
74
75
  >list {
75
76
  display: inline-block;
77
+ min-height: 100%;
76
78
  border-top: 6px solid #2c2d2c;
77
79
 
78
80
  &[nlist] {
@@ -80,6 +82,10 @@
80
82
  border-color: #222;
81
83
  }
82
84
 
85
+ &[clist] {
86
+ border-right: 2px solid transparent;
87
+ }
88
+
83
89
  >d {
84
90
  outline: none;
85
91
  border: none;
@@ -104,7 +110,7 @@
104
110
  <list contenteditable="false" nlist# :src="(r,i) in coderows" -style="{height:codeHeight}">
105
111
  <n current:="isCurrent(i)" -bind="i+1"></n>
106
112
  </list>
107
- <list clist# contenteditable="true" :src="(r,i) in coderows" -style="{height:codeHeight}">
113
+ <list clist# body contenteditable="true" :src="(r,i) in coderows" -style="{height:codeHeight}">
108
114
  <d -html="r"></d>
109
115
  </list>
110
116
  </编辑框>
@@ -130,8 +136,10 @@
130
136
  if (typeof text === 'string') coder.innerHTML = 渲染.encode(text);
131
137
  }
132
138
  });
133
- var refresh = function () {
134
- codeHeight = coderows.length * 1.36 + 10 + 'em';
139
+ var reshape = function () {
140
+ codeHeight = coderows.length * 1.36 + 2;
141
+ if (codeHeight < 6) codeHeight = 6;
142
+ codeHeight += 'em';
135
143
  codeSpan = (coderows.length).toString().length;
136
144
  };
137
145
  on('scroll')(coder, function () {
@@ -142,7 +150,7 @@
142
150
  if (!selection) return false;
143
151
  return i >= selection[0] && i <= selection[2];
144
152
  };
145
- var coderows = [], codetext = '';
153
+ var coderows = [""], codetext = '';
146
154
  coder.setValue = async function (text) {
147
155
  codetext = text;
148
156
  var id = ++coderid;
@@ -151,7 +159,7 @@
151
159
  coderows = colored;
152
160
  codeHistory = [[codetext]];
153
161
  historyIndex = 0;
154
- refresh();
162
+ reshape();
155
163
  render.refresh(coder);
156
164
  };
157
165
  coder.getValue = function () {
@@ -200,17 +208,37 @@
200
208
  if (!c) return [d, d.childNodes.length];
201
209
  return [c, col - inc];
202
210
  }
211
+ var anchor = document.createElement('span');
203
212
  var unmarkAnchorOffset = function () {
204
213
  if (!selection) return;
205
214
  var [an, ai, fn, fi] = selection;
206
215
  [fn, fi] = getNodeAt(fn, fi);
207
216
  [an, ai] = fn === an && fi === ai ? [fn, fi] : getNodeAt(an, ai);
208
- document_selection.setBaseAndExtent(an, ai, fn, fi);
217
+ if (an && an === fn && ai === fi) {
218
+ var d = getTargetIn(clist, an, false);
219
+ if (an === d) {
220
+ d.insertBefore(anchor, d.childNodes[ai]);
221
+ }
222
+ else {
223
+ an.parentNode.insertBefore(anchor, an.nextSibling);
224
+ }
225
+ if (anchor.offsetLeft > clist.clientWidth + clist.scrollLeft + d.offsetLeft) {
226
+ clist.scrollLeft = anchor.offsetLeft - clist.clientWidth + 6;
227
+ }
228
+ else if (anchor.offsetLeft < clist.scrollLeft) {
229
+ clist.scrollLeft = anchor.offsetLeft;
230
+ }
231
+ anchor.parentNode.removeChild(anchor);
232
+ if (d.offsetTop < coder.scrollTop + clist.offsetTop) {
233
+ coder.scrollTop = d.offsetTop - clist.offsetTop;
234
+ }
235
+ }
236
+ if (an && fn) document_selection.setBaseAndExtent(an, ai, fn, fi);
209
237
  }
210
238
  var trimspace = (_, a) => a ? "" : " ";
211
239
  var 更新 = function () {
212
240
  var { scrollTop, scrollLeft } = clist;
213
- refresh();
241
+ reshape();
214
242
  render.refresh(coder);
215
243
  clist.scrollTop = scrollTop;
216
244
  clist.scrollLeft = scrollLeft;
@@ -220,6 +248,8 @@
220
248
  var fixpace = function (event) {
221
249
  event.preventDefault();
222
250
  insertText(' ', false);
251
+ markAnchorOffset();
252
+ unmarkAnchorOffset();
223
253
  };
224
254
  var updatechar = function (event) {
225
255
  if (event.defaultPrevented) return;
@@ -242,6 +272,7 @@
242
272
  }
243
273
  else {
244
274
  anchorNode = anchorNode.previousSibling;
275
+ if (!anchorNode) return;
245
276
  if (anchorNode.nodeType === 1) anchorOffset = anchorNode.childNodes.length;
246
277
  else anchorOffset = anchorNode.nodeValue.length;
247
278
  }
@@ -318,7 +349,7 @@
318
349
  var [k, p] = a.split('');
319
350
  pairsmap[k] = p;
320
351
  });
321
- var codeHistory = [""];
352
+ var codeHistory = [[""]];
322
353
  var historyIndex = 0;
323
354
  var getRow = function (node) {
324
355
  var d = getTargetIn(clist, node, false);
@@ -545,5 +576,13 @@
545
576
  on('keydown.ctrl.z.prevent.only')(coder, undo);
546
577
  on('keydown.ctrl.shift.z.prevent.only')(coder, redo);
547
578
  on('keydown.ctrl.y.prevent.only')(coder, redo);
548
- on('keydown')(coder, updatechar)
579
+ on('keydown.backspace')(coder, function (event) {
580
+ var { firstChild, lastChild } = clist;
581
+ if (firstChild === lastChild && !firstChild.childNodes.length) {
582
+ event.preventDefault();
583
+ return;
584
+ }
585
+ });
586
+ on('keydown')(coder, updatechar);
587
+ reshape();
549
588
  </script>
package/docs/main.xht CHANGED
@@ -154,22 +154,33 @@
154
154
  padding: 0px !important;
155
155
  }
156
156
  }
157
+
158
+ &>menu {
159
+ >i18n-chooser {
160
+ display: block;
161
+ z-index: 2;
162
+ position: relative;
163
+ background: inherit;
164
+ }
165
+ }
157
166
  </style>
158
167
 
159
168
  <menu #mulu open@="menued" inline -src="m in menus" @active="openMenu(m)">
169
+ <i18n-chooser insert></i18n-chooser>
160
170
  <div2></div2>
161
171
  </menu>
162
172
  <div1 #content></div1>
163
173
  <open #switch @click="switchMenu()" insert></open>
164
174
  <script>
175
+ i18n.setReloader(zimoli.reload);
165
176
  var menus = [
166
177
  {
167
178
  name: i18n`efront简介`,
168
179
  children: [
169
- { name: i18n`使用说明`, md: i18n`readme.md` },
170
- { name: i18n`兼容性说明`, md: i18n`coms/basic_/readme.md` },
171
- { name: i18n`版本说明`, md: i18n`docs/版本说明.md` },
172
- { name: i18n`与前端框架对比`, md: i18n`docs/compare.md` },
180
+ { name: i18n`使用说明`, id: 'readme', md: i18n`readme.md` },
181
+ { name: i18n`兼容性说明`, id: 'adaption', md: i18n`coms/basic_/readme.md` },
182
+ { name: i18n`版本说明`, id: 'version', md: i18n`docs/版本说明.md` },
183
+ { name: i18n`与前端框架对比`, id: 'compare', md: i18n`docs/compare.md` },
173
184
  // { name: i18n`notive`, md: "docs/notive.md" },
174
185
  ]
175
186
  },
@@ -209,6 +220,7 @@
209
220
  menus[0].name += ` <v>${version[0]}</v>`;
210
221
  };
211
222
  var initCommandsDocs = async function () {
223
+ delete modules['docs$helps'];
212
224
  var helps = await init("docs$helps");
213
225
  var m = {
214
226
  name: i18n`命令参考`,
@@ -225,6 +237,7 @@
225
237
  a.children = helps.helps.filter(h => h.type === a.a);
226
238
  a.children.forEach(c => {
227
239
  c.name = c.info;
240
+ c.id = c.cmds[0];
228
241
  c.path = `/命令/${c.name}`;
229
242
  });
230
243
  a.closed = true;
@@ -274,8 +287,7 @@
274
287
  await initComponentDocs();
275
288
  var route = await init("frame$route");
276
289
  scope.menus = route.update(menus);
277
- zimoli();
278
- render.refresh();
290
+ route.open(route.active);
279
291
  };
280
292
  var scope = {
281
293
  menus,
@@ -286,6 +298,7 @@
286
298
  },
287
299
  grid,
288
300
  menu,
301
+ i18nChooser,
289
302
  menued: false,
290
303
  switchMenu() {
291
304
  scope.menued = !scope.menued;