efront 4.4.12 → 4.4.14

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 (76) hide show
  1. package/#/345/233/275/351/231/205/345/214/226.yml +885 -66
  2. package/apps/reptile/encode.js +1 -1
  3. package/coms/basic/#loader.js +4 -4
  4. package/coms/basic/BigNumber.js +6 -6
  5. package/coms/basic/BitTree.js +1 -1
  6. package/coms/basic/Enum.js +1 -1
  7. package/coms/basic/Matrix.js +1 -1
  8. package/coms/basic/analyse_test.js +1 -1
  9. package/coms/basic/assert.js +1 -1
  10. package/coms/basic/color.js +1 -1
  11. package/coms/basic/compile.js +1 -1
  12. package/coms/basic/cross_.js +2 -2
  13. package/coms/basic/crypt.js +3 -3
  14. package/coms/basic/decodePack.js +3 -3
  15. package/coms/basic/deepEqual.js +1 -1
  16. package/coms/basic/encodeRange_test.js +1 -1
  17. package/coms/basic/encodeUTF16.js +2 -2
  18. package/coms/basic/encodeUTF8.js +1 -1
  19. package/coms/basic/i18n.md +4 -2
  20. package/coms/basic/parseYML.js +2 -2
  21. package/coms/basic/refilm.js +2 -2
  22. package/coms/basic/repeat.js +1 -1
  23. package/coms/basic/submit_.js +4 -4
  24. package/coms/basic_/Array2.js +2 -2
  25. package/coms/basic_/Promise.js +1 -1
  26. package/coms/basic_/exec_.js +1 -1
  27. package/coms/compile/Javascript.js +2 -2
  28. package/coms/compile/Program.js +1 -1
  29. package/coms/compile/common.js +27 -4
  30. package/coms/compile/downLevel.js +5 -5
  31. package/coms/compile/translate.js +29 -11
  32. package/coms/compile/translate_test.js +8 -0
  33. package/coms/compile/unstruct.js +9 -4
  34. package/coms/compile/unstruct_test.js +2 -1
  35. package/coms/compile/washcode.js +2 -2
  36. package/coms/docs/execute.js +1 -1
  37. package/coms/explorer/Explorer.js +6 -6
  38. package/coms/explorer/context.js +16 -16
  39. package/coms/explorer/deepcp.js +2 -2
  40. package/coms/explorer/edit.html +3 -3
  41. package/coms/frame/chat.html +2 -2
  42. package/coms/frame/route.js +1 -1
  43. package/coms/kugou/parseSongsList.js +1 -1
  44. package/coms/reptile/colored_console.js +8 -2
  45. package/coms/reptile/cross.js +1 -1
  46. package/coms/reptile/decodeHttpResponse.js +1 -1
  47. package/coms/reptile/detectWithExtension.js +1 -1
  48. package/coms/zimoli/Enum.js +1 -1
  49. package/coms/zimoli/api.js +19 -19
  50. package/coms/zimoli/avatarEditor.js +1 -1
  51. package/coms/zimoli/care.js +3 -3
  52. package/coms/zimoli/cast.js +1 -1
  53. package/coms/zimoli/chooseFile.js +2 -2
  54. package/coms/zimoli/clock.js +1 -1
  55. package/coms/zimoli/confirm.js +2 -2
  56. package/coms/zimoli/createElement.js +2 -2
  57. package/coms/zimoli/cross.js +3 -3
  58. package/coms/zimoli/css.js +1 -1
  59. package/coms/zimoli/downloadmap.js +2 -2
  60. package/coms/zimoli/filterTime.js +1 -1
  61. package/coms/zimoli/grid.js +4 -4
  62. package/coms/zimoli/icon.js +1 -1
  63. package/coms/zimoli/list.js +1 -1
  64. package/coms/zimoli/mediaDevices.js +1 -1
  65. package/coms/zimoli/menu.js +1 -1
  66. package/coms/zimoli/on.js +3 -3
  67. package/coms/zimoli/overlap_test.js +1 -1
  68. package/coms/zimoli/popup.js +2 -2
  69. package/coms/zimoli/render.js +10 -10
  70. package/coms/zimoli/table.js +1 -1
  71. package/coms/zimoli/watch.js +1 -1
  72. package/coms/zimoli/zimoli.js +3 -3
  73. package/docs//345/267/245/345/205/267//345/233/275/351/231/205/345/214/226.xht +12 -4
  74. package/package.json +1 -1
  75. package/public/efront.js +1 -1
  76. package/coms/kugou/fxPlayer.js +0 -12474
@@ -335,7 +335,7 @@ var createPoints = function (values, direction = "x", result = new Point(0)) {
335
335
  for (var cx = 0, dx = values.length; cx < dx; cx++) {
336
336
  var value = values[cx];
337
337
  if (value instanceof Array && value.constructor !== Point) {
338
- if (!result.length) throw new Error("数据转换为grid失败!");
338
+ if (!result.length) throw new Error(i18n`数据转换为grid失败!`);
339
339
  createPoints(value, direction === "x" ? "y" : "x", result[result.length - 1]);
340
340
  } else {
341
341
  var breakpoint = new Point(value);
@@ -401,7 +401,7 @@ var grid_prototype = {
401
401
  targetX = clientX = left + right >> 1;
402
402
  break;
403
403
  default:
404
- throw new Error("参数不支持", side);
404
+ throw new Error(i18n`参数不支持`, side);
405
405
  }
406
406
  this.direction = direction;
407
407
  var e = resizer.call(this, { clientX, clientY, target: cell });
@@ -690,7 +690,7 @@ var createPointsFromElements = function (elements, xList, yList) {
690
690
  var y1 = yList[cx - 1];
691
691
  var y2 = yList[cx];
692
692
  var temp = elements.filter(e => e[3] >= y1 && e[4] <= y2);
693
- if (temp.length === elements.length) throw new Error("遇到不规则布局,无法自动处理!");
693
+ if (temp.length === elements.length) throw new Error(i18n`遇到不规则布局,无法自动处理!`);
694
694
  if (temp.length > 1) {
695
695
  var children = createPointsFromElements(temp, [xList[0], xList[xList.length - 1]], [y1, y2]);
696
696
  if (children.length) {
@@ -711,7 +711,7 @@ var createPointsFromElements = function (elements, xList, yList) {
711
711
  var x1 = xList[cx - 1];
712
712
  var x2 = xList[cx];
713
713
  var temp = elements.filter(e => e[1] >= x1 && e[2] <= x2);
714
- if (temp.length === elements.length) throw new Error("遇到不规则布局,无法自动处理!");
714
+ if (temp.length === elements.length) throw new Error(i18n`遇到不规则布局,无法自动处理!`);
715
715
  if (temp.length > 1) {
716
716
  var children = createPointsFromElements(temp, [x1, x2], [yList[0], yList[yList.length - 1]]);
717
717
  if (children.length) xList.splice(cx, 0, children);
@@ -1,4 +1,4 @@
1
- console.error("图标组件的服务端已从efront移除,请勿使用!");
1
+ console.error(i18n`图标组件的服务端已从efront移除,请勿使用!`);
2
2
  var setBackGround, icon, icn;
3
3
  var binaryImagePathReg = /^https?\:|\.(?:png|gif|bmp|jpe?g)$/i;
4
4
  if (/MSIE\s*[2-8]/.test(navigator.userAgent)) {
@@ -190,7 +190,7 @@ function ylist(container, generator, $Y) {
190
190
  }
191
191
  offsetBottom = bottom_item.offsetTop + bottom_item.offsetHeight;
192
192
  ratioTop = top_item.offsetTop + top_item.offsetHeight * ratio;
193
- if (count++ > 600) throw new Error("多于600个元素需要绘制!");
193
+ if (count++ > 600) throw new Error(i18n`多于600个元素需要绘制!`);
194
194
  }
195
195
  for (var k in childrenMap) {
196
196
  remove(childrenMap[k]);
@@ -30,7 +30,7 @@ var load = function () {
30
30
  });
31
31
  }
32
32
  if (!_mediaDevices) {
33
- console.info("当前环境不支持mediaDevices!");
33
+ console.info(i18n`当前环境不支持mediaDevices!`);
34
34
  } else {
35
35
  _mediaDevices.ondevicechange = load;
36
36
  load();
@@ -197,7 +197,7 @@ function main(elem, mode) {
197
197
  }
198
198
  break;
199
199
  default:
200
- throw new Error(`不支持的菜单类型:${mode}`);
200
+ throw new Error(i18n`不支持的菜单类型:${mode}`);
201
201
  }
202
202
  } else {
203
203
  mode = mode || "horizonal";
package/coms/zimoli/on.js CHANGED
@@ -199,7 +199,7 @@ var parseEventTypes = function (eventtypes) {
199
199
  types.keyCode = keyCodeMap[t];
200
200
  }
201
201
  else {
202
- throw new Error(`绑定事件参数无效${t}`);
202
+ throw new Error(i18n`绑定事件参数无效${t}`);
203
203
  }
204
204
 
205
205
  }
@@ -315,7 +315,7 @@ var checkroot = function (element, k) {
315
315
  if (element === window && k in document) {
316
316
  element = document;
317
317
  // <!--
318
- if (!checkroot[k]) checkroot[k] = true, console.warn("使用 document 的", k, "替代 window 的");
318
+ if (!checkroot[k]) checkroot[k] = true, console.warn(i18n`使用 document 的`, k, "替代 window 的");
319
319
  // -->
320
320
  }
321
321
  }
@@ -365,7 +365,7 @@ var on = document.efronton = function (k) {
365
365
  else {
366
366
  var _addhandler = function (target, context, handler, firstmost = false) {
367
367
  if (eventtypes.capture) {
368
- console.warn("当前运行环境不支持事件capture");
368
+ console.warn(i18n`当前运行环境不支持事件capture`);
369
369
  firstmost = true;
370
370
  }
371
371
  target = checkroot(target, k);
@@ -3,7 +3,7 @@ addClass(sample, "overlap-test");
3
3
  css(".overlap-test", "position:absolute;z-index:10;");
4
4
  var assert = function (a, b) {
5
5
  if (a !== b) return console.error(`${a} is not equal ${b}!`), 0;
6
- else return console.info("验证通过"), 1;
6
+ else return console.info(i18n`验证通过`), 1;
7
7
  }
8
8
  var getElement = function (left, top, width, height) {
9
9
  var element1 = createElement(sample)
@@ -24,10 +24,10 @@ var popup = function (path) {
24
24
  if (isNode(path)) {
25
25
  return popup_view.apply(null, arguments);
26
26
  }
27
- throw new Error(`参数异常:${path}`);
27
+ throw new Error(i18n`参数异常:${path}`);
28
28
  };
29
29
  var popup_path = function (path = "", parameters, target) {
30
- if (!popup.go || !popup.prepare) throw new Error("当前环境无法使用");
30
+ if (!popup.go || !popup.prepare) throw new Error(i18n`当前环境无法使用`);
31
31
  // 3 has mask has view control
32
32
  var element;
33
33
  if (/^[#\+]/.test(path)) {
@@ -209,7 +209,7 @@ var createRepeat = function (search, id = 0) {
209
209
  // throw new Error("repeat is not supported! use list component instead");
210
210
  var expression = search;
211
211
  var repeater = parseRepeat(expression);
212
- if (!repeater) throw new Error(`不能识别循环表达式: ${expression} `);
212
+ if (!repeater) throw new Error(i18n`不能识别循环表达式: ${expression} `);
213
213
  var { srcName, trackBy } = repeater;
214
214
  // 懒渲染
215
215
  var getter = createGetter(this, srcName);
@@ -227,7 +227,7 @@ var createRepeat = function (search, id = 0) {
227
227
  var isArrayResult = result instanceof Array;
228
228
  var keys = isArrayResult ? result.map((_, i) => i) : Object.keys(result);
229
229
  if (keys.length > 600) {
230
- throw new Error("数据量过大,取消绘制!");
230
+ throw new Error(i18n`数据量过大,取消绘制!`);
231
231
  }
232
232
  var $parentScopes = element.$parentScopes || [];
233
233
  var $struct = element.$struct;
@@ -327,7 +327,7 @@ var createIf = function (search, id = 0) {
327
327
  var parseIfWithRepeat = function (ifExpression, repeatExpression) {
328
328
  var repeater = parseRepeat(repeatExpression);
329
329
  if (!repeater) {
330
- throw new Error(`不能识别循环表达式:${repeat}`);
330
+ throw new Error(i18n`不能识别循环表达式: ${repeat}`);
331
331
  }
332
332
  var pair = [];
333
333
  var rest = [], savedIndex = 0;
@@ -359,7 +359,7 @@ var parseIfWithRepeat = function (ifExpression, repeatExpression) {
359
359
  };
360
360
  var inc = 0;
361
361
  while (reg.lastIndex < ifExpression.length) {
362
- if (inc++ > 100) throw new Error("请不要在if表达式中使用太多的条件!");
362
+ if (inc++ > 100) throw new Error(i18n`请不要在if表达式中使用太多的条件!`);
363
363
  if (reg.lastIndex < savedIndex) break;
364
364
  run();
365
365
  }
@@ -423,7 +423,7 @@ var structures = {
423
423
  if (if_top[cx].parent === this.parentNode) break;
424
424
  }
425
425
  if (cx < 0) {
426
- throw new Error("else/elseif前缺少同级if!");
426
+ throw new Error(i18n`else/elseif前缺少同级if!`);
427
427
  }
428
428
  initIf(if_top.splice(cx + 1, if_top.length - cx - 1));
429
429
  var top = if_top[cx];
@@ -757,11 +757,11 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
757
757
  element.$renderid = 0;
758
758
  element.$scope = scope;
759
759
  if (isHandled(parentScopes) && !isArray(parentScopes)) {
760
- throw new Error('父级作用域链应以数组的类型传入');
760
+ throw new Error(i18n`父级作用域链应以数组的类型传入`);
761
761
  }
762
762
  if (parentScopes) {
763
763
  if (element.$renderid && !element.$parentScopes || element.$parentScopes && element.$parentScopes.length !== parentScopes.length) {
764
- throw new Error("父作用域链的长度必须相等着");
764
+ throw new Error(i18n`父作用域链的长度必须相等着`);
765
765
  }
766
766
  }
767
767
  element.$parentScopes = parentScopes || [];
@@ -775,7 +775,7 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
775
775
  return element;
776
776
  }
777
777
  for (var id of element.$struct.ids) {
778
- if (scope[id] && scope[id] !== element) throw new Error("同一个id不能使用两次:" + id);
778
+ if (scope[id] && scope[id] !== element) throw new Error(i18n`同一个id不能使用两次:` + id);
779
779
  scope[id] = element;
780
780
  }
781
781
  var isFirstRender = !element.$renderid;
@@ -937,11 +937,11 @@ function createStructure(element) {
937
937
  if (element.$renderid <= -2) {
938
938
  if (/^if$|^else/i.test(key)) {
939
939
  if (types.if) {
940
- throw new Error(`暂不支持在同一元素上使用多次if结构!`);
940
+ throw new Error(i18n`暂不支持在同一元素上使用多次if结构!`);
941
941
  }
942
942
  } else {
943
943
  if (types.repeat) {
944
- throw new Error(`暂不支持在同一元素上使用多次repeat类型的属性!`);
944
+ throw new Error(i18n`暂不支持在同一元素上使用多次repeat类型的属性!`);
945
945
  }
946
946
  }
947
947
  }
@@ -471,7 +471,7 @@ function table(elem) {
471
471
  else if (src instanceof Array) {
472
472
  var [fields, data] = src;
473
473
  }
474
- else throw new Error("table组件源数据错误!");
474
+ else throw new Error(i18n`table组件源数据错误!`);
475
475
  if (_vbox) _vbox(), _vbox = null;
476
476
  watch(table, {
477
477
  find(text) {
@@ -21,6 +21,6 @@ function watch(elem, prop, handler) {
21
21
  if (!isFunction(prop[k])) e++;
22
22
  else elem.$watches[k] = prop[k];
23
23
  }
24
- if (e > 0) throw new Error("参数不支持!");
24
+ if (e > 0) throw new Error(i18n`参数不支持!`);
25
25
  }
26
26
  }
@@ -96,7 +96,7 @@ var getZimoliParams = function (pagepath) {
96
96
  try {
97
97
  return JSAM.parse(hostoryStorage.getItem(_zimoli_params_key + pagepath)) || {};
98
98
  } catch (e) {
99
- console.warn("存储空间被破坏");
99
+ console.warn(i18n`存储空间被破坏`);
100
100
  }
101
101
  return {};
102
102
  };
@@ -106,7 +106,7 @@ var setZimoliParams = function (pagepath, args) {
106
106
  if (stringified_args.length === 2) hostoryStorage.removeItem(_zimoli_params_key + pagepath);
107
107
  else hostoryStorage.setItem(_zimoli_params_key + pagepath, stringified_args);
108
108
  } catch (e) {
109
- console.warn("写入存储空间失败!", e);
109
+ console.warn(i18n`写入存储空间失败!`, e);
110
110
  }
111
111
  };
112
112
  var fullfill_is_dispatched = 0;
@@ -391,7 +391,7 @@ function create(pagepath, args, from, needroles) {
391
391
  if (typeof pagepath === 'string') {
392
392
  var page_object = page_generators[pagepath];
393
393
  if (!page_object) {
394
- throw new Error(`调用create前请确保prepare执行完毕:${pagepath}`);
394
+ throw new Error(i18n`调用create前请确保prepare执行完毕:${pagepath}`);
395
395
  }
396
396
  var { pg, "with": _with_elements, state, onback: _pageback_listener, roles } = page_object;
397
397
  }
@@ -340,7 +340,7 @@
340
340
  return compile$translate.getI18nPrefixed(code);
341
341
  }
342
342
  catch (e) {
343
- alert("提取文本时存在异常", "error");
343
+ alert(i18n`提取文本时存在异常`, "error");
344
344
  console.error(e, f.path);
345
345
  return [];
346
346
  }
@@ -356,6 +356,14 @@
356
356
  key: "filter",
357
357
  options: [
358
358
  {
359
+ name: i18n`过滤空串`,
360
+ checked: true,
361
+ test(a) {
362
+ return !!a.fanyi || /\S/.test(a.text);
363
+ }
364
+ },
365
+ {
366
+ disabled: true,
359
367
  name: i18n`只看中文`, key: "cnonly", get checked() {
360
368
  return true;
361
369
  },
@@ -366,7 +374,7 @@
366
374
  return !!a.fanyi || /[\u3400-\ufad9\u{20000}-\u{2a6d6}\u{2fa1d}]/u.test(a.text);
367
375
  }
368
376
  }
369
- ]
377
+ ].filter(a => !a.disabled)
370
378
  };
371
379
  var tableData = [];
372
380
  var runFilter = function () {
@@ -481,7 +489,7 @@
481
489
  }
482
490
  var chooseFolder = async function () {
483
491
  var dp = await window.showDirectoryPicker();
484
- var msg = alert("正在读取文件列表,请稍候..", false);
492
+ var msg = alert(i18n`正在读取文件列表,请稍候..`, false);
485
493
  var rest = [dp];
486
494
  var result = [];
487
495
  dp.path = "";
@@ -511,7 +519,7 @@
511
519
  }
512
520
  }
513
521
  }
514
- msg.setText("正在提取字符串..");
522
+ msg.setText(i18n`正在提取字符串..`);
515
523
  css(msg.firstElementChild, 'text-align:left');
516
524
  var textMap = Object.create(null);
517
525
  已找到的字符串.is_loading = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.4.12",
3
+ "version": "4.4.14",
4
4
  "description": "简化前端开发,优化web性能",
5
5
  "main": "public/efront.js",
6
6
  "directories": {