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
@@ -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>
@@ -627,7 +627,7 @@ function table(elem) {
627
627
  render.digest();
628
628
  };
629
629
  })
630
- var tableScopes = render.getScopes(this);
630
+ var tableScopes = render.getScopes(table);
631
631
  autodragchildren(
632
632
  table,
633
633
  cellMatchManager,
@@ -249,8 +249,7 @@ thead {
249
249
  tbody,
250
250
  [tbody] {
251
251
 
252
- [type=jscode],
253
- [type=function] {
252
+ [type=jscode] {
254
253
  display: -webkit-box;
255
254
  -webkit-box-orient: vertical;
256
255
  -webkit-line-clamp: 2;
@@ -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) {
@@ -128,7 +128,6 @@ function go(pagepath, args, history_name, oldpagepath) {
128
128
  return zimoli(pagepath, args, history_name, oldpagepath);
129
129
  }
130
130
  var page = create(pagepath, args, oldpagepath, roles, params, history_name);
131
- if (!page) return;
132
131
  zimoliad = zimoliid;
133
132
  var isRecover = pushstate(pagepath, history_name, oldpagepath);
134
133
  if (isNode(history_name)) {
@@ -137,7 +136,11 @@ function go(pagepath, args, history_name, oldpagepath) {
137
136
  history_name.activate = pgpath;
138
137
  history_name.activateNode = page;
139
138
  }
140
- else if (isString(pgpath)) {
139
+ if (!page) {
140
+ addGlobal(null, history_name, isRecover);
141
+ return;
142
+ }
143
+ if (isString(pgpath)) {
141
144
  page.disptch();
142
145
  }
143
146
  if (isRecover) setWithStyle(page, false);
@@ -152,6 +155,7 @@ var page_generators = {};
152
155
  */
153
156
  var loading_tree = {};
154
157
  var pathmaped = Object.create(null);
158
+ var realmaped = Object.create(null);
155
159
  var getpgpath = function (pagepath) {
156
160
  pagepath = /^[@#!]/.test(pagepath) ? pagepath.slice(1) : pagepath;
157
161
  if (pagepath === 'main') pagepath = modules.efrontPath || "/main";
@@ -167,8 +171,10 @@ var getpgpath = function (pagepath) {
167
171
  for (var m of mparams) argobj[m] = params.pop();
168
172
  if (params.length) argobj[m] += "/" + params.reverse().join("/");
169
173
  }
174
+ pagepath = realmaped[pagepath] || pagepath;
170
175
  return [pagepath, argobj];
171
176
  }
177
+ pagepath = realmaped[pagepath] || pagepath;
172
178
  return [pagepath];
173
179
  };
174
180
  function createState(pgpath) {
@@ -480,12 +486,19 @@ var history = {};
480
486
  var current_history, default_history = current_history = "";
481
487
  history[current_history] = createEmptyHistory('/main', false);
482
488
  var history_session_object_key = `紫茉莉:${location_pathname}`;
483
- try {
484
- history = JSAM.parse(historyStorage.getItem(history_session_object_key)) || history;
485
- } catch (e) {
486
- }
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);
487
499
  var root_path;
488
500
  var savestate = function () {
501
+ history.wlength = window_history.length;
489
502
  historyStorage.setItem(history_session_object_key, JSAM.stringify(history) || null);
490
503
  };
491
504
  var pushstate = function (path_name, history_name) {
@@ -673,7 +686,7 @@ function addGlobal(element, name = null, isBack) {
673
686
  if (oldElement) {
674
687
  var oldPrev = oldElement.previousSibling, oldPare = oldElement.parentNode;
675
688
  remove(oldElement);
676
- oldElement = oldPrev || oldPare.firstChild;
689
+ oldElement = oldPrev || oldPare?.firstChild;
677
690
  }
678
691
  if (isBack || !oldElement) appendChild.insert(body, element);
679
692
  else appendChild.after(oldElement, element);
@@ -752,20 +765,15 @@ remove.transition = transition;
752
765
  zimoli.prepare = prepare;
753
766
  var upwith = [];
754
767
  zimoli.upwith = popup.upwith(upwith);
755
- zimoli.setStorage = function (storage) {
756
- historyStorage = storage;
757
- try {
758
- history = JSAM.parse(historyStorage.getItem(history_session_object_key)) || history;
759
- } catch (e) {
760
- }
761
- };
762
- zimoli.register = function (pathlike) {
768
+ zimoli.setStorage = setStorage;
769
+ zimoli.register = function (pathlike, realpath) {
763
770
  var params = [];
764
771
  pathlike = pathlike.replace(/\/\:([^\/\:\-]+)/g, function (_, id) {
765
772
  params.push(id);
766
773
  return '';
767
774
  });
768
775
  pathmaped[pathlike] = params;
776
+ if (realpath) realmaped[pathlike] = realpath;
769
777
  };
770
778
  zimoli.clearHistory = function () {
771
779
  historyStorage.removeItem(history_session_object_key);
@@ -883,6 +891,29 @@ zimoli.enableTouchBack = function () {
883
891
  }
884
892
  }, 'x')
885
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
+ };
886
917
  zimoli.alert = function () {
887
918
  var ae = alert.apply(this, arguments);
888
919
  zimoli.upwith(ae.parentNode);
@@ -36,12 +36,6 @@
36
36
  display: inline-block;
37
37
  vertical-align: top;
38
38
  outline: none;
39
-
40
- >n,
41
- >d {
42
- display: block;
43
- }
44
-
45
39
  }
46
40
 
47
41
  >[clist] {
@@ -90,6 +84,14 @@
90
84
  outline: none;
91
85
  border: none;
92
86
 
87
+ &:after {
88
+ content: "";
89
+ pointer-events: none;
90
+ user-select: none;
91
+ display: inline-block;
92
+ width: 16px;
93
+ }
94
+
93
95
  &:focus {
94
96
  outline: 1px solid #fff3;
95
97
  }
@@ -110,13 +112,19 @@
110
112
  <list contenteditable="false" nlist# :src="(r,i) in coderows" -style="{height:codeHeight}">
111
113
  <n current:="isCurrent(i)" -bind="i+1"></n>
112
114
  </list>
113
- <list clist# body contenteditable="true" :src="(r,i) in coderows" -style="{height:codeHeight}">
115
+ <list clist# body contenteditable:="contenteditable" :src="(r,i) in coderows" -style="{height:codeHeight}">
114
116
  <d -html="r"></d>
115
117
  </list>
116
118
  </编辑框>
117
119
  <script>
118
120
  var coder = this;
119
121
  vbox(this);
122
+ var contenteditable = !this.readonly;
123
+ watch(coder, {
124
+ readonly(v) {
125
+ contenteditable = !v;
126
+ }
127
+ })
120
128
  if (!('oninput' in document)) {
121
129
  on('focus')(this, function () {
122
130
  if (this.contentEditable) addClass(this, "noinput");
@@ -170,6 +178,7 @@
170
178
  selection = getSelection();
171
179
  render.refresh(nlist);
172
180
  };
181
+ var spacing = false;
173
182
  var getNodeAt = function (row, col) {
174
183
  var d = clist.at(row);
175
184
  if (!d) return [];
@@ -192,13 +201,13 @@
192
201
  if (inc + tl > col) {
193
202
  col -= inc;
194
203
  inc = 0;
195
- if (t.charAt(col - 1) === " ") {
204
+ if (!spacing && t.charAt(col - 1) === " ") {
196
205
  col++;
197
206
  }
198
207
  break;
199
208
  }
200
209
  else if (inc + tl === col) {
201
- if (t.charAt(col - inc - 1) === " ") col++;
210
+ if (!spacing && t.charAt(col - inc - 1) === " ") col++;
202
211
  else break;
203
212
  }
204
213
  inc += tl;
@@ -246,10 +255,12 @@
246
255
  var anchorChar = null, inText = false;
247
256
  var followChar = null, beforeText = false;
248
257
  var fixpace = function (event) {
258
+ spacing = true;
249
259
  event.preventDefault();
250
260
  insertText(' ', false);
251
261
  markAnchorOffset();
252
262
  unmarkAnchorOffset();
263
+ spacing = false;
253
264
  };
254
265
  var updatechar = function (event) {
255
266
  if (event.defaultPrevented) return;
@@ -413,7 +424,7 @@
413
424
  var patchAfter = '';
414
425
  switch (inputType) {
415
426
  case "insertText":
416
- if (data === ' ') return;
427
+ if (data === ' ') return false;
417
428
  if (anchorChar in pairsmap) {
418
429
  if (followChar === pairsmap[anchorChar] && data === followChar) {
419
430
  document.execCommand('forwardDelete');
@@ -429,6 +440,7 @@
429
440
  patchAfter = pairsmap[data];
430
441
  }
431
442
  }
443
+ spacing = false;
432
444
  break;
433
445
  case "insertParagraph":
434
446
  var i = getFocusRow();
@@ -444,11 +456,14 @@
444
456
  }
445
457
  if (patchAfter) {
446
458
  insertText(patchAfter, true);
459
+ markAnchorOffset();
447
460
  }
448
461
  return patchAfter;
449
462
  };
450
463
  var document_selection = document.getSelection();
464
+ var isInput = false;
451
465
  var insertText = function (text, isPatch) {
466
+ isInput = true;
452
467
  markAnchorOffset();
453
468
  var [an, ai, fn, fi] = selection;
454
469
  var [n, i] = getNodeAt(fn, fi);
@@ -474,7 +489,7 @@
474
489
  [an, ai] = getNodeAt(an, ai);
475
490
  document_selection.setBaseAndExtent(an, ai, n, i + d);
476
491
  }
477
-
492
+ markAnchorOffset();
478
493
  }
479
494
  var removeEndBR = function (d) {
480
495
  var e = d.lastChild;
@@ -512,8 +527,11 @@
512
527
  };
513
528
  on("input")(coder, function (event) {
514
529
  if (event.isComposing) return;
530
+ isInput = true;
515
531
  var id = ++coderid;
516
- if (updatecode(event) == null) {
532
+ spacing = true;
533
+ var patch = updatecode(event);
534
+ if (patch == null) {
517
535
  if (id !== coderid) return;
518
536
  // codetext = getCodeText();
519
537
  updateCodeHtml();
@@ -540,6 +558,7 @@
540
558
  keytab(1);
541
559
  });
542
560
  bind('selectionchange', document)(coder, function () {
561
+ if (isInput) return isInput = false;
543
562
  markAnchorOffset();
544
563
  });
545
564
  var updo = function () {
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;
@@ -371,47 +371,14 @@
371
371
  // "庄,庄": ["za", "Zhuang, Chuang"],
372
372
  // 祖鲁语: ["zu", "Zulu"]
373
373
  // };
374
- var supports = [
375
- { name: `汉语`/*中文简体*/, id: "zh", lang: "zh-CN" },
376
- { name: `漢語`/*中文繁体*/, id: "cht", lang: "zh-TW" },
377
- { name: `English`/*英文*/, id: "en", lang: "en" },
378
- // { name: i18n`文言文`, id: "wyw" },
379
- // { name: i18n`粤语`, id: "yue" },
380
- { name: `日本語`/*日语*/, id: "jp", lang: "ja" },
381
- { name: `Français`/*法语*/, id: "fra", lang: 'fr' },
382
- { name: `Русский язык`/*俄语*/, id: "ru", lang: 'ru' },
383
- { name: `한국어`/*韩语*/, id: "kor", lang: "ko" },
384
- { name: `Deutsch`/*德语*/, id: "de", lang: "de" },
385
- { name: `Italiano`/*意大利语*/, id: "it", lang: 'it' },
386
- { name: `ภาษาไทย`/*泰语*/, id: "th", lang: "th" },
387
- { name: `Tiếng Việt`/*越南语*/, id: "vie", lang: 'vi' },
388
- { name: `بالعربية`/*阿拉伯语*/, id: "ara", lang: "ar" },
389
- { name: `Nederlands`/*荷兰语*/, id: "nl", lang: "nl" },
390
- { name: `suomi`/*芬兰语*/, id: "fin", lang: "fi" },
391
- { name: `Ελληνικά`/*希腊语*/, id: "el", lang: "el" },
392
- { name: `Español`/*西班牙语*/, id: "spa", lang: "es" },
393
- { name: `Português`/*葡萄牙语*/, id: "pt", lang: /pt\-(BR|PT)/ },
394
- { name: `Húngaro`/*匈牙利语*/, id: "hu", lang: 'hu' },
395
- { name: `Svenska`/*瑞典语*/, id: "swe", lang: 'sv' },
396
- { name: `Dansk`/*丹麦语*/, id: "dan", lang: 'da' },
397
- { name: `Čeština`/*捷克语*/, id: "cs", lang: 'cs' },
398
- { name: `Polski`/*波兰语*/, id: "pl" },
399
- { name: `Български`/*保加利亚语*/, id: "bul", lang: "bg" },
400
- { name: `Eesti keel`/*爱沙尼亚语*/, id: "est", lang: 'et' },
401
- { name: `Română`/*罗马尼亚语*/, id: "rom", lang: 'ro' },
402
- { name: `slovenski jezik`/*斯洛文尼亚语*/, id: "slo", lang: 'sl' },
403
- ];
404
- supports.forEach(s => s.key = s.id);
374
+ var supports = i18nSupports;
405
375
  var getAllText = function (data, f) {
406
376
  try {
407
377
  if (/^\s*(\<\!--[\s\S]*?--\>\s*)*<!doctype\s/i.test(data)) return [];
408
- if (/\.(xht|vue)$/i.test(f.name)) {
378
+ if (/\.(xht|html?|jsp|asp|php|vue)$/i.test(f.name)) {
409
379
  var { scripts, innerHTML, outerHTML: htmltext = innerHTML, attributes = '', tagName, styles } = compile$scanner2(data, 'html').scoped;
410
380
  data = compile$wraphtml(htmltext) + ";\r\n" + scripts.join("\r\n");
411
381
  }
412
- else if (/\.html?$/i.test(f.name)) {
413
- data = compile$wraphtml(data);
414
- }
415
382
  var code = compile$scanner2(String(data));
416
383
  return compile$translate.getI18nPrefixed(code);
417
384
  }
@@ -598,7 +565,7 @@
598
565
  }
599
566
  else {
600
567
  if (/^[\.]|^node_modules|_test\.js$/i.test(name)) continue;
601
- if (e.kind === "file" && !/\.([mc]?[tj]sx?|xht|vue|html?)$/i.test(name)) continue;
568
+ if (e.kind === "file" && !/\.([mc]?[tj]sx?|xht|html?|jsp|asp|php|vue)$/i.test(name)) continue;
602
569
  }
603
570
  e.path = path + e.name;
604
571
  if (e.kind === 'directory') {
@@ -637,6 +604,10 @@
637
604
  addTranslate(f.name);
638
605
  addTranslate(f.holder);
639
606
  addTranslate(f.comment);
607
+ var options = f.options;
608
+ if (options instanceof Array) options.forEach(o => {
609
+ addTranslate(o.name);
610
+ })
640
611
  });
641
612
  }
642
613
  }
@@ -644,26 +615,47 @@
644
615
  msg.setText(i18n`提取完成`);
645
616
  var result = [];
646
617
  var preMap = Object.create(null);
618
+ var againstid = 0;
647
619
  for (var e of pretrans) {
648
620
  var data = await readText(e);
649
621
  data = parseYML(data);
650
622
  loop: for (var d of data) {
651
623
  for (var k in d) {
652
- d[k] = d[k].replace(/^\s*([\s\S]*?)([:\:]?\s*)$/, '$1');
624
+ var s = d[k];
625
+ if (typeof s === 'string') d[k] = s.replace(/^\s*([\s\S]*?)([:\:]?\s*)$/, '$1');
653
626
  }
654
627
  var liang = 0, fanyi = {};
655
628
  for (var { lang: k, id } of supports) {
656
629
  if (!d[k]) continue;
657
- if (preMap[d[k]] && preMap[d[k]] !== d) {
658
- console.log(i18n`发现不同的翻译`, k, preMap[d[k]], d);
630
+ var pd = preMap[d[k]];
631
+ if (pd && pd !== d) {
632
+ if (shallowEqual(pd, d)) continue loop;
633
+ if (!pd.against) {
634
+ pd.against = ++againstid;
635
+ }
636
+ d.against = pd.against;
637
+ console.log(i18n`发现不同的翻译`, k, pd, d);
659
638
  }
660
639
  preMap[d[k]] = d;
661
640
  liang++;
662
641
  fanyi[id] = d[k];
663
642
  }
664
- result.push({ text: d[supports[0].lang], fanyi, liang });
643
+ d = { text: d[supports[0].lang], fanyi, liang, d };
644
+ result.push(d);
665
645
  }
666
646
  }
647
+ var againsts = [];
648
+ result = result.filter(a => {
649
+ var ag = a.d.against;
650
+ delete a.d;
651
+ if (!ag) return true;
652
+ var aga = againsts[ag];
653
+ if (!aga) aga = againsts[ag] = [];
654
+ aga.push(a);
655
+ });
656
+ againsts.forEach(a => {
657
+ result.unshift.apply(result, a);
658
+ });
667
659
  var untrans = [];
668
660
  Object.keys(textMap).map(k => {
669
661
  var texts = textMap[k];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.23.9",
3
+ "version": "4.24.1",
4
4
  "description": "一个开发环境,提供一种自由的前端开发模式,也可作为辅助工具使用。",
5
5
  "main": "public/efront.js",
6
6
  "directories": {