efront 2.44.8 → 2.46.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 (54) hide show
  1. package/coms/basic/BitTree.js +1 -1
  2. package/coms/basic/crypt.js +1 -1
  3. package/coms/basic/decodeRange.js +0 -1
  4. package/coms/basic/loader.js +3 -2
  5. package/coms/basic/parseURL_test.js +32 -0
  6. package/coms/basic/refilm_decode.js +13 -2
  7. package/coms/basic/valid.js +10 -0
  8. package/coms/compile/scanner2.js +1 -1
  9. package/coms/zimoli/alert.js +12 -7
  10. package/coms/zimoli/appendChild.js +1 -0
  11. package/coms/zimoli/autodragchildren.js +96 -116
  12. package/coms/zimoli/avatar.js +0 -1
  13. package/coms/zimoli/button.js +5 -0
  14. package/coms/zimoli/button.less +6 -2
  15. package/coms/zimoli/checker.less +13 -14
  16. package/coms/zimoli/color.js +128 -83
  17. package/coms/zimoli/colorpad.js +2 -4
  18. package/coms/zimoli/cross.js +1 -1
  19. package/coms/zimoli/css.js +1 -0
  20. package/coms/zimoli/data.js +16 -9
  21. package/coms/zimoli/drag.js +2 -1
  22. package/coms/zimoli/encode62.js +13 -0
  23. package/coms/zimoli/field.html +2 -0
  24. package/coms/zimoli/field.js +41 -17
  25. package/coms/zimoli/field.less +19 -0
  26. package/coms/zimoli/form.js +8 -0
  27. package/coms/zimoli/gallery.js +2 -12
  28. package/coms/zimoli/getGenerator.js +16 -10
  29. package/coms/zimoli/getTreeFromData.js +9 -3
  30. package/coms/zimoli/image.less +4 -0
  31. package/coms/zimoli/list.js +2 -12
  32. package/coms/zimoli/menu.js +14 -14
  33. package/coms/zimoli/menu.less +1 -1
  34. package/coms/zimoli/menuItem.js +4 -1
  35. package/coms/zimoli/menuList.js +4 -3
  36. package/coms/zimoli/model.js +1 -0
  37. package/coms/zimoli/on.js +18 -0
  38. package/coms/zimoli/radio.html +1 -3
  39. package/coms/zimoli/radio.less +22 -16
  40. package/coms/zimoli/render.js +118 -151
  41. package/coms/zimoli/renderDefaults.js +1 -0
  42. package/coms/zimoli/submit.js +41 -0
  43. package/coms/zimoli/table.html +16 -0
  44. package/coms/zimoli/table.js +23 -1
  45. package/coms/zimoli/table.less +57 -39
  46. package/coms/zimoli/tree.js +4 -4
  47. package/coms/zimoli/view.js +0 -5
  48. package/coms/zimoli/view.less +21 -11
  49. package/coms/zimoli/zimoli.js +21 -13
  50. package/package.json +1 -1
  51. package/public/efront.js +1 -1
  52. package/coms/zimoli/beian.html +0 -1
  53. package/coms/zimoli/beian.js +0 -5
  54. package/coms/zimoli/beian.less +0 -13
@@ -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
+ }
@@ -0,0 +1,16 @@
1
+ <thead>
2
+ <tr>
3
+ <td -repeat="f in fields"><i -if="f.icon" -class="f.icon"></i></span><span -if="f.name" -html="f.name"></span>
4
+ </td>
5
+ </tr>
6
+ </thead>
7
+ <tbody -src="d in data">
8
+ <tr>
9
+ <td -repeat="f in fields">
10
+ <span -if="f.key" -text="d[f.key]"></span>
11
+ <a on-click="o.do(d)" -if="f.options" -repeat="o in f.options">
12
+ <span -text=o.name></span>
13
+ </a>
14
+ </td>
15
+ </tr>
16
+ </tbody>
@@ -91,6 +91,10 @@ var adaptTarget = function (event) {
91
91
  }
92
92
  if (target) target = getFirstSingleColCell(this, target.colend);
93
93
  if (target) {
94
+ if (position.right >= getSelection(this).right - 7) {
95
+ target = this;
96
+ return;
97
+ }
94
98
  css(this, { 'cursor': 'e-resize' });
95
99
  result = {
96
100
  target,
@@ -142,6 +146,7 @@ function table(elem) {
142
146
  var cellMatchManager = function (element) {
143
147
  if (!thead) [thead] = table.getElementsByTagName("thead");
144
148
  if (table.resizing) return false;
149
+ if (!getTargetIn(thead, element)) return false;
145
150
  if (!tdElementReg.test(element.tagName)) return false;
146
151
  var savedRowDeltas = [];
147
152
  [].map.call(thead.children, function (tr) {
@@ -153,10 +158,27 @@ function table(elem) {
153
158
  table.dragbox = function () {
154
159
  return thead;
155
160
  };
161
+ care(table, function ([fields, data]) {
162
+ this.innerHTML = template;
163
+ render(this, {
164
+ fields,
165
+ tbody: list,
166
+ data,
167
+ a: button,
168
+ }, this.$parentScopes.concat(this.$scope));
169
+ })
156
170
  autodragchildren(
157
171
  table,
158
- cellMatchManager,
172
+ function (a) {
173
+ console.log('match')
174
+ return cellMatchManager.apply(this, arguments);
175
+ },
159
176
  function (src, dst, rel, append, parentNode) {
177
+ if (table.src) {
178
+ var [fields] = table.src;
179
+ var [f] = fields.splice(src, 1);
180
+ fields.splice(dst, 0, f);
181
+ }
160
182
  var children = parentNode.children;
161
183
  var srcElement = children[src];
162
184
  var dstElement = children[rel];
@@ -1,15 +1,17 @@
1
- &.dragging {
2
- box-shadow: 0 0 20px -6px #00000033;
3
-
1
+ &[dragchildren] {
4
2
  >thead,
5
3
  >tbody,
6
4
  & {
7
5
  >tr {
8
6
 
9
7
  >th,
10
- >td {}
8
+ >td {
9
+ box-shadow: 1px 0 0 0 #00000033, -1px 0 0 0 #00000033;
10
+ }
11
+
11
12
  }
12
13
  }
14
+
13
15
  }
14
16
 
15
17
  thead,
@@ -17,10 +19,15 @@ tbody,
17
19
  th,
18
20
  td,
19
21
  tr,
20
- table {
22
+ table,
23
+ & {
21
24
  box-sizing: border-box;
22
25
  }
23
26
 
27
+ & {
28
+ outline: 1px solid #0006;
29
+ }
30
+
24
31
  .y-ing {
25
32
  &:before {
26
33
  content: "";
@@ -45,56 +52,67 @@ table {
45
52
  table-layout: fixed;
46
53
  white-space: nowrap;
47
54
 
48
- >thead {
49
- user-select: none;
50
- line-height: 36px;
55
+ }
51
56
 
52
- >tr {
57
+ >thead {
58
+ user-select: none;
59
+ line-height: 36px;
53
60
 
54
- >td,
55
- >th {
56
- padding: @cell-padding;
57
- position: relative;
58
- color: #fff;
59
- background-color: #999;
60
- }
61
+ >tr {
62
+
63
+ >td,
64
+ >th {
65
+ padding: @cell-padding;
66
+ position: relative;
67
+ color: #fff;
68
+ background-color: #999;
61
69
  }
62
70
  }
71
+ }
63
72
 
64
- >tbody {
65
- line-height: 32px;
73
+ >tbody {
74
+ line-height: 32px;
75
+ height: 100%;
76
+ min-height: 30px;
66
77
 
67
- >tr {
78
+ display: table-row-group;
68
79
 
69
- >td,
70
- >th {
71
- padding: @cell-padding;
72
- position: relative;
73
- }
80
+ >tr {
81
+
82
+ >td,
83
+ >th {
84
+ padding: @cell-padding;
85
+ position: relative;
86
+ }
74
87
 
75
- &:nth-child(even) {
88
+ &:nth-of-type(even) {
76
89
 
77
- >td,
78
- >th {
79
- background-color: #eee;
80
- }
90
+ >td,
91
+ >th {
92
+ background-color: #eee;
81
93
  }
94
+ }
82
95
 
83
- &:nth-child(odd) {
96
+ &:nth-of-type(odd) {
84
97
 
85
- >td,
86
- >th {
87
- background-color: #fff;
88
- }
98
+ >td,
99
+ >th {
100
+ background-color: #fff;
89
101
  }
102
+ }
90
103
 
91
- &:hover {
104
+ &:hover {
92
105
 
93
- >td,
94
- >th {
95
- background: #dddddd;
96
- }
106
+ >td,
107
+ >th {
108
+ background: #dddddd;
97
109
  }
98
110
  }
99
111
  }
112
+ }
113
+
114
+ .button {
115
+ margin-right: 10px;
116
+ vertical-align: middle;
117
+ display: inline-block;
100
118
  }
@@ -251,7 +251,7 @@ function tree() {
251
251
  com.forEach(z);
252
252
  setState();
253
253
  };
254
-
254
+ var time = size => (Math.log(-size / 30 + 2) * 100 | 0) / 1000;
255
255
  if (com.isClosed() && com.length) {
256
256
  z0();
257
257
  setState(true);
@@ -265,7 +265,7 @@ function tree() {
265
265
  marginTop = top.offsetTop - bottom.offsetTop - bottom.offsetHeight;
266
266
  }
267
267
  var res = transition(top, {
268
- transition: 'margin-top .2s ease-out',
268
+ transition: `margin-top ${time(marginTop)}s ease-out`,
269
269
  marginTop: fromOffset(marginTop)
270
270
  }, true);
271
271
  if (res) timeout(refresh, res);
@@ -282,7 +282,7 @@ function tree() {
282
282
  }
283
283
  setState(false);
284
284
  z0();
285
- var res = transition(change_elem, { transition: "margin-top .2s ease-out", marginTop: fromOffset(margin_top) }, false);
285
+ var res = transition(change_elem, { transition: `margin-top ${time(margin_top)}s ease-out`, marginTop: fromOffset(margin_top) }, false);
286
286
  timeout(z1, res);
287
287
  }
288
288
  });
@@ -307,7 +307,7 @@ function tree() {
307
307
  };
308
308
  var refresh = function () {
309
309
  var index = banner.index();
310
- var needremoves = dom.map(d => d.target).filter(d=>!!d);
310
+ var needremoves = dom.map(d => d.target).filter(d => !!d);
311
311
  dom = getArrayFromTree(root, true);
312
312
  needremoves.forEach(_div => {
313
313
  delete _div.initialStyle;
@@ -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,14 +13,17 @@ 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
- padding: 6px 0;
23
+ &>.body,
24
+ >[body] {
25
+ padding: 6px 20px 6px 6px;
26
+ margin-right: -20px;
24
27
  background: #f2f4f6;
25
28
  display: block;
26
29
  width: auto;
@@ -42,7 +45,8 @@ body>& {
42
45
  }
43
46
 
44
47
 
45
- &>.head {
48
+ &>.head,
49
+ >[head] {
46
50
  z-index: 2;
47
51
  background: #fffc;
48
52
  position: relative;
@@ -83,12 +87,14 @@ body>& {
83
87
  }
84
88
  }
85
89
 
86
- &>.foot {
90
+ &>.foot,
91
+ >[foot] {
87
92
  white-space: nowrap;
88
93
  overflow: auto;
89
94
  }
90
95
 
91
- &>.foot {
96
+ &>.foot,
97
+ >[foot] {
92
98
  z-index: 1;
93
99
  text-align: right;
94
100
  line-height: 1;
@@ -101,13 +107,17 @@ body>& {
101
107
  bottom: 0;
102
108
  margin-top: -42px;
103
109
 
110
+ }
111
+
112
+ .button {
113
+ vertical-align: middle;
114
+ }
115
+
116
+ >.foot,
117
+ >[foot] {
104
118
  .button {
105
- padding: 0 20px;
106
119
  min-width: 60px;
107
- vertical-align: middle;
108
-
109
- &+.button {
110
- margin-left: 10px;
111
- }
120
+ padding: 0 20px;
121
+ margin-right: 10px;
112
122
  }
113
123
  }
@@ -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
 
@@ -574,11 +576,17 @@ function addGlobal(element, name = null, isDestroy) {
574
576
  }
575
577
  }
576
578
  var _switch = zimoli.switch = function (history_name = default_history, target_body = document.body, emptyState) {
577
- if (isString(history_name))
578
- current_history = history_name;
579
- if (target_body)
580
- body = target_body;
581
- if (emptyState !== false && !history[history_name]) root_path = (history[history_name] = [].concat(emptyState || ":empty"))[0];
579
+ if (!arguments.length) {
580
+ current_history = default_history;
581
+ body = document.body;
582
+ }
583
+ else {
584
+ if (isString(history_name)) {
585
+ current_history = history_name = history_name.replace(/\/$/, '') + "/";
586
+ }
587
+ if (target_body) body = target_body;
588
+ }
589
+ if (emptyState !== false && !history[current_history]) root_path = (history[current_history] = [].concat(emptyState || ":empty"))[0];
582
590
  };
583
591
  popup.global = zimoli.global = addGlobal;
584
592
  popup.go = zimoli.go = go;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "2.44.8",
3
+ "version": "2.46.0",
4
4
  "description": "一个开发工具,开放源代码,自带组件库和编译环境,可以用来开发web组件,web应用或nodejs模块,或做为已有代码的加密工具,也可以做为静态页面服务器或跨域中转服务器使用",
5
5
  "main": "public/efront.js",
6
6
  "directories": {