efront 3.3.6 → 3.4.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 (66) hide show
  1. package/apps/pivot/api.yml +3 -0
  2. package/apps/pivot/auth/login.html +9 -0
  3. package/apps/pivot/auth/login.js +30 -0
  4. package/apps/pivot/auth/login.less +11 -0
  5. package/apps/pivot/home/short.html +1 -0
  6. package/apps/pivot/home/short.js +5 -0
  7. package/apps/pivot/home/short.less +1 -0
  8. package/apps/pivot/home/welcome.html +14 -0
  9. package/apps/pivot/home/welcome.js +24 -0
  10. package/apps/pivot/home/welcome.less +8 -0
  11. package/apps/pivot/index.html +41 -0
  12. package/apps/pivot/main.js +18 -0
  13. package/apps/pivot/menu.yml +3 -0
  14. package/apps/zimoli/book/main.js +1 -1
  15. package/apps/zimoli/broadcast/main.js +1 -1
  16. package/apps/zimoli/index.html +1 -0
  17. package/apps/zimoli/main.js +1 -1
  18. package/apps/zimoli/nearby/main.js +1 -1
  19. package/apps/zimoli/yuanfen/main.js +1 -1
  20. package/coms/basic/crypt.js +1 -1
  21. package/coms/basic/loader.js +1 -1
  22. package/coms/basic/refilm_decode.js +13 -2
  23. package/coms/basic/valid.js +10 -0
  24. package/coms/compile/common.js +451 -0
  25. package/coms/compile/scanner2.js +8 -405
  26. package/coms/crypt/encode62.js +23 -33
  27. package/coms/crypt/encode62_test.js +2 -1
  28. package/coms/frame/left.html +11 -6
  29. package/coms/frame/left.js +6 -3
  30. package/coms/frame/left.less +38 -36
  31. package/coms/frame/main.js +1 -1
  32. package/coms/frame/route.js +52 -4
  33. package/coms/frame/top.less +12 -13
  34. package/coms/kugou/buildList.js +1 -0
  35. package/coms/kugou/player.js +3 -0
  36. package/coms/layer/glance.less +4 -2
  37. package/coms/zimoli/alert.js +8 -4
  38. package/coms/zimoli/avatar.js +0 -1
  39. package/coms/zimoli/checker.html +1 -1
  40. package/coms/zimoli/checker.less +8 -13
  41. package/coms/zimoli/cross.js +1 -1
  42. package/coms/zimoli/css.js +1 -0
  43. package/coms/zimoli/data.js +8 -3
  44. package/coms/zimoli/encode62.js +13 -0
  45. package/coms/zimoli/field.html +2 -0
  46. package/coms/zimoli/field.js +41 -17
  47. package/coms/zimoli/field.less +19 -0
  48. package/coms/zimoli/form.js +8 -0
  49. package/coms/zimoli/menu.js +11 -1
  50. package/coms/zimoli/menu.less +1 -1
  51. package/coms/zimoli/menuItem.js +4 -1
  52. package/coms/zimoli/model.js +1 -0
  53. package/coms/zimoli/radio.html +1 -3
  54. package/coms/zimoli/radio.less +10 -22
  55. package/coms/zimoli/render.js +34 -63
  56. package/coms/zimoli/renderDefaults.js +1 -0
  57. package/coms/zimoli/submit.js +41 -0
  58. package/coms/zimoli/view.js +0 -5
  59. package/coms/zimoli/view.less +17 -11
  60. package/coms/zimoli/zimoli.js +11 -9
  61. package/data/mime.json +3 -0
  62. package/package.json +1 -1
  63. package/public/efront.js +1 -1
  64. package/coms/zimoli/beian.html +0 -1
  65. package/coms/zimoli/beian.js +0 -5
  66. package/coms/zimoli/beian.less +0 -13
@@ -1,43 +1,31 @@
1
- & {
2
- vertical-align: top;
3
- }
4
-
5
1
  >a {
6
2
  line-height: inherit;
7
3
  margin-right: 10px;
8
- vertical-align: top;
9
4
 
10
5
  >r {
6
+ font-family: sans-serif;
11
7
  display: inline-block;
12
- height: 1em;
13
- width: 1em;
14
- border-radius: 50%;
15
- border: .1em solid;
16
8
  position: relative;
17
- vertical-align: middle;
18
9
  margin-right: 4px;
19
-
10
+ line-height: 1;
11
+ text-align: center;
12
+
20
13
  >s {
21
14
  display: none;
22
- border-radius: 50%;
23
- border: .2em solid;
24
- width: .4em;
25
- height: .4em;
26
15
  position: absolute;
27
- margin: -.2em;
28
- top: 50%;
29
- left: 50%;
16
+ text-decoration: none;
17
+ left: 0;
18
+ right: 0;
19
+ top: 0;
20
+ bottom: 0;
30
21
  }
31
22
  }
32
23
 
33
- >span {
34
- vertical-align: middle;
35
- }
36
24
 
37
25
  &.activate {
38
26
  >r {
39
27
  >s {
40
- display: block;
28
+ display: inline;
41
29
  }
42
30
  }
43
31
  }
@@ -71,7 +71,7 @@ var createGetter = function (search, isprop = true) {
71
71
  });
72
72
  }
73
73
  if (isprop) {
74
- return new Function('event', `try{${withContext}with(this.$scope){${ret}${searchContext}}}catch(e){/*console.warn(String(e))*/}`);
74
+ return new Function('event', `${withContext}with(this.$scope){${ret}${searchContext}}`);
75
75
  }
76
76
  return new Function("event", `${withContext}with(this.$scope){${/([\=\(\+\-])/.test(searchContext) ? ret + searchContext : `${ret}${searchContext}.call(this.$scope,event)`}}`);
77
77
  };
@@ -346,13 +346,42 @@ var structures = {
346
346
  };
347
347
  structures["else-if"] = structures.elseif = structures.else;
348
348
  structures["for-each"] = structures.foreach = structures.for = structures.each = structures.repeat;
349
- var changed = function () {
350
- if (!this.dirty) this.dirty = true, this.setAttribute('dirty', '');
351
- };
349
+ var createBinder = function (binder) {
350
+ return function (search) {
351
+ var getter = createGetter(search).bind(this);
352
+ var oldValue;
353
+ this.renders.push(function () {
354
+ var value = getter();
355
+ if (deepEqual.shallow(value, oldValue)) return;
356
+ oldValue = value;
357
+ if (isNode(value) || isArray(value)) {
358
+ if (value !== this.firstChild) {
359
+ remove(this.childNodes);
360
+ appendChild(this, value);
361
+ }
362
+ } else {
363
+ if (isEmpty(value)) value = '';
364
+ if (binder(this) !== value) binder(this, value);
365
+ }
366
+ });
367
+
368
+ }
369
+ }
352
370
  var directives = {
371
+ bind: createBinder(text),
372
+ html: createBinder(html),
373
+ hide: createBinder(function (elem, value) {
374
+ if (arguments.length === 1) return elem.style.display === 'none';
375
+ elem.style.display = value ? 'none' : '';
376
+ }),
377
+ show: createBinder(function (elem, value) {
378
+ if (arguments.length === 1) return elem.style.display !== 'none';
379
+ elem.style.display = value ? '' : 'none';
380
+ }),
381
+ style: createBinder(css),
353
382
  src(search) {
354
383
  var getter = createGetter(search).bind(this);
355
- var savedValue, savedOrigin, pending;
384
+ var savedValue, pending;
356
385
  var refresh = function () {
357
386
  that.src = savedValue;
358
387
  removeClass(that, "pending");
@@ -372,10 +401,8 @@ var directives = {
372
401
  }
373
402
  var changes = getChanges(temp, savedValue);
374
403
  if (!changes) return;
375
- savedOrigin = origin;
376
404
  savedValue = temp;
377
405
  if (/^img$/i.test(this.tagName)) {
378
- // this.setAttribute("src", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=");
379
406
  if (!isString(origin)) {
380
407
  return;
381
408
  }
@@ -394,23 +421,6 @@ var directives = {
394
421
  }
395
422
  });
396
423
  },
397
- bind(search) {
398
- var getter = createGetter(search).bind(this);
399
- var oldValue;
400
- this.renders.push(function () {
401
- var value = getter();
402
- if (deepEqual(value, oldValue)) return;
403
- oldValue = value;
404
- if (isNode(value) || isArray(value)) {
405
- if (value !== this.firstChild) {
406
- remove(this.childNodes);
407
- appendChild(this, value);
408
- }
409
- } else {
410
- if (text(this) !== value) text(this, value);
411
- }
412
- });
413
- },
414
424
  model(search) {
415
425
  var getter = createGetter(search).bind(this);
416
426
  var oldValue;
@@ -462,35 +472,6 @@ var directives = {
462
472
  }
463
473
  var onchange = change;
464
474
  eventsHandlers.map(on => on(this, onchange));
465
- eventsHandlers.map(on => on(this, changed));
466
- },
467
- hide(search) {
468
- var getter = createGetter(search).bind(this);
469
- var oldValue;
470
- this.renders.push(function () {
471
- var value = !!getter();
472
- if (deepEqual(oldValue, value)) return;
473
- oldValue = value;
474
- if (value) {
475
- this.style.display = "none";
476
- } else {
477
- this.style.display = "";
478
- }
479
- });
480
- },
481
- show(search) {
482
- var getter = createGetter(search).bind(this);
483
- var oldValue;
484
- this.renders.push(function () {
485
- var value = !!getter();
486
- if (deepEqual(oldValue, value)) return;
487
- oldValue = value;
488
- if (value) {
489
- this.style.display = "";
490
- } else {
491
- this.style.display = "none";
492
- }
493
- });
494
475
  },
495
476
 
496
477
  "class"(search) {
@@ -528,16 +509,6 @@ var directives = {
528
509
  }
529
510
  });
530
511
  },
531
- style(search) {
532
- var getter = createGetter(search).bind(this);
533
- var oldValue;
534
- this.renders.push(function () {
535
- var stylesheet = getter();
536
- if (deepEqual(oldValue, stylesheet)) return;
537
- oldValue = stylesheet;
538
- css(this, stylesheet);
539
- });
540
- }
541
512
  };
542
513
  // property binder
543
514
  var binders = {
@@ -38,4 +38,5 @@ extend(renderDefaults, {
38
38
  swap,
39
39
  password,
40
40
  table,
41
+ form,
41
42
  });
@@ -0,0 +1,41 @@
1
+ function submit(fields, data) {
2
+ var params = {};
3
+ var inputs = [];
4
+ var select = [];
5
+ var checks = [];
6
+ var id = 0;
7
+ for (var f of fields) {
8
+ var error = valid(f, data);
9
+ if (error === "empty") {
10
+ if (f.options || /date|time|range|switch|swap|radio/i.test(f.type)) {
11
+ if (!select.id) select.id = ++id;
12
+ select.push(f);
13
+ }
14
+ else {
15
+ if (!inputs.id) inputs.id = ++id;
16
+ inputs.push(f);
17
+ }
18
+ }
19
+ else if (error) {
20
+ checks.push(f);
21
+ }
22
+ else {
23
+ params[f.key] = data[f.key];
24
+ }
25
+ }
26
+ if (checks.length + select.length + inputs.length) {
27
+ var errors = [];
28
+ if (inputs.length) errors.push("请输入" + inputs.map(f => f.name).join("、"));
29
+ if (select.length) errors.push("请选择" + select.map(f => f.name).join("、"));
30
+ if (select.id < inputs.id) {
31
+ errors = errors.reverse();
32
+ }
33
+ if (checks.length) {
34
+ errors.push(checks.map(f => f.name).join("、") + "格式错误");
35
+ }
36
+ errors = errors.join(",") + "!";
37
+ alert(errors, 'error');
38
+ throw new Error(errors);
39
+ }
40
+ return params;
41
+ }
@@ -94,11 +94,6 @@ var init = function () {
94
94
  function view(element) {
95
95
  var window = isNode(element) ? element : document.createElement("form");
96
96
  init();
97
- if (/form/i.test(window.tagName)) {
98
- on("submit")(window, function (event) {
99
- event.preventDefault();
100
- });
101
- }
102
97
  extend(window, prototype);
103
98
  if (window !== element) {
104
99
  extend(window, element);
@@ -13,13 +13,15 @@ body>& {
13
13
  -ms-user-select: none;
14
14
  -moz-user-select: none;
15
15
  -webkit-user-select: none;
16
+ border: 1px solid #0006;
16
17
  }
17
18
 
18
19
  &[dragable] {
19
20
  position: absolute;
20
21
  }
21
22
 
22
- &>.body {
23
+ &>.body,
24
+ >[body] {
23
25
  padding: 6px 0;
24
26
  background: #f2f4f6;
25
27
  display: block;
@@ -42,7 +44,8 @@ body>& {
42
44
  }
43
45
 
44
46
 
45
- &>.head {
47
+ &>.head,
48
+ >[head] {
46
49
  z-index: 2;
47
50
  background: #fffc;
48
51
  position: relative;
@@ -83,12 +86,14 @@ body>& {
83
86
  }
84
87
  }
85
88
 
86
- &>.foot {
89
+ &>.foot,
90
+ >[foot] {
87
91
  white-space: nowrap;
88
92
  overflow: auto;
89
93
  }
90
94
 
91
- &>.foot {
95
+ &>.foot,
96
+ >[foot] {
92
97
  z-index: 1;
93
98
  text-align: right;
94
99
  line-height: 1;
@@ -101,13 +106,14 @@ body>& {
101
106
  bottom: 0;
102
107
  margin-top: -42px;
103
108
 
104
- .button {
105
- padding: 0 20px;
106
- min-width: 60px;
107
- vertical-align: middle;
109
+ }
108
110
 
109
- &+.button {
110
- margin-left: 10px;
111
- }
111
+ .button {
112
+ padding: 0 20px;
113
+ min-width: 60px;
114
+ vertical-align: middle;
115
+
116
+ &+.button {
117
+ margin-left: 10px;
112
118
  }
113
119
  }
@@ -58,7 +58,7 @@ if (/MSIE\s*[2-7]/.test(navigator.userAgent)) {
58
58
  if (currentHash && currentHash === targetHash) return;
59
59
  var targetHashIndex = targetHash.indexOf("#" + current_history);
60
60
  if (targetHashIndex < 0) return;
61
- var targetpath = targetHash.slice(targetHashIndex + current_history.length + 1);
61
+ var targetpath = targetHash.slice(targetHashIndex + current_history.length);
62
62
  go(targetpath);
63
63
  return;
64
64
  }
@@ -110,7 +110,7 @@ var setZimoliParams = function (pagepath, args) {
110
110
  };
111
111
  var fullfill_is_dispatched = 0;
112
112
  function go(pagepath, args, history_name, oldpagepath) {
113
- if (!history_name)
113
+ if (history_name === undefined)
114
114
  history_name = current_history;
115
115
  if (isNumber(pagepath)) {
116
116
  if (isString(history_name)) {
@@ -297,7 +297,7 @@ function prepare(pgpath, ok) {
297
297
  // rolesA中的role1,role2,...等所有身份都必须具备才可以确定一种访问权限
298
298
  // 符合rolesA,rolesB,rolesC任意一种权限都可以访问
299
299
  if (!roles) roles = [];
300
- for (var cx = 0, dx = arguments.length; cx < dx; cx++) {
300
+ if (arguments.length) for (var cx = 0, dx = arguments.length; cx < dx; cx++) {
301
301
  roles.push(arguments[cx]);
302
302
  }
303
303
  };
@@ -408,6 +408,7 @@ function zimoli(pagepath, args, history_name, oldpagepath) {
408
408
  args = data;
409
409
  oldpagepath = from;
410
410
  }
411
+
411
412
  if (page_generators[pagepath]) return go(pagepath, args, history_name, oldpagepath);
412
413
  return prepare(pagepath, function () {
413
414
  if (isNode(history_name)) {
@@ -418,7 +419,7 @@ function zimoli(pagepath, args, history_name, oldpagepath) {
418
419
  }
419
420
  var global = {};
420
421
  var history = {};
421
- var current_history, default_history = current_history = "zimoli";
422
+ var current_history, default_history = current_history = "";
422
423
  history[current_history] = [];
423
424
  var history_session_object_key = `_zimoli_history_key:${location_pathname}`;
424
425
  try {
@@ -428,7 +429,7 @@ try {
428
429
  var root_path;
429
430
  var pushstate = function (path_name, history_name, oldpagepath) {
430
431
  var isDestroy = false;
431
- if (!history_name) {
432
+ if (history_name === undefined) {
432
433
  history_name = current_history;
433
434
  }
434
435
  if (!isString(history_name)) return;
@@ -454,7 +455,7 @@ var pushstate = function (path_name, history_name, oldpagepath) {
454
455
  return isDestroy;
455
456
  };
456
457
  var popstate = function (path_name, history_name) {
457
- if (!history_name) history_name = current_history;
458
+ if (history_name === undefined) history_name = current_history;
458
459
  if (!isString(history_name)) return;
459
460
  if (!history[history_name]) return;
460
461
  var _history = history[history_name];
@@ -467,11 +468,12 @@ var popstate = function (path_name, history_name) {
467
468
  };
468
469
  var getCurrentHash = function () {
469
470
  var _historylist = history[current_history];
471
+ var history_name = current_history.replace(/\/$/, '');
470
472
  if (rootElements.length) {
471
- return `#${current_history}/`;
473
+ return `#${history_name}/`;
472
474
  }
473
475
  if (_historylist.length < 2) return "";
474
- var targeturl = `#${current_history}${_historylist.length ? _historylist[_historylist.length - 1] : ""}`;
476
+ var targeturl = `#${history_name}${_historylist.length ? _historylist[_historylist.length - 1] : ""}`;
475
477
  return targeturl;
476
478
  };
477
479
 
@@ -575,7 +577,7 @@ function addGlobal(element, name = null, isDestroy) {
575
577
  }
576
578
  var _switch = zimoli.switch = function (history_name = default_history, target_body = document.body, emptyState) {
577
579
  if (isString(history_name))
578
- current_history = history_name;
580
+ current_history = history_name = history_name.replace(/\/$/, '') + "/";
579
581
  if (target_body)
580
582
  body = target_body;
581
583
  if (emptyState !== false && !history[history_name]) root_path = (history[history_name] = [].concat(emptyState || ":empty"))[0];
package/data/mime.json CHANGED
@@ -60,6 +60,9 @@
60
60
  "text/css:css",
61
61
  "application/json:json"
62
62
  ],
63
+ ".yml":[
64
+ "text/plain;charset=utf-8:yml|yaml"
65
+ ],
63
66
  ".tomcat": [
64
67
  "application/vnd.lotus-1-2-3:123",
65
68
  "text/vnd.in3d.3dml:3dml",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.3.6",
3
+ "version": "3.4.1",
4
4
  "description": "一个开发工具,开放源代码,自带组件库和编译环境,可以用来开发web组件,web应用或nodejs模块,或做为已有代码的加密工具,也可以做为静态页面服务器或跨域中转服务器使用",
5
5
  "main": "public/efront.js",
6
6
  "directories": {