efront 4.28.3 → 4.29.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 (38) hide show
  1. package/#/345/233/275/351/231/205/345/214/226.yml +12 -3
  2. package/apps/pivot/home/welcome.html +3 -1
  3. package/apps/pivot/home/welcome.js +4 -1
  4. package/apps/pivot/home/welcome.less +1 -1
  5. package/apps/pivot/main.js +7 -43
  6. package/apps/pivot/wow/root.js +10 -8
  7. package/apps//346/226/207/344/273/266/347/263/273/347/273/237/main.js +55 -0
  8. package/apps//346/226/207/344/273/266/347/263/273/347/273/237//344/270/273/351/241/265.jsp +42 -0
  9. package/apps//346/226/207/344/273/266/347/263/273/347/273/237//350/265/204/346/272/220/347/256/241/347/220/206/345/231/250.js +1 -0
  10. package/coms/basic/color.js +1 -1
  11. package/coms/basic/extend.js +2 -1
  12. package/coms/basic/extendIfNeeded.js +2 -1
  13. package/coms/basic/extendIfOccurs.js +1 -1
  14. package/coms/basic/mark.js +3 -3
  15. package/coms/basic/sum.js +7 -0
  16. package/coms/basic_/&Array.js +0 -4
  17. package/coms/basic_/&rest.js +3 -4
  18. package/coms/compile//347/264/240/351/246/250.js +47 -6
  19. package/coms/compile//347/264/240/351/246/250_test.js +19 -0
  20. package/coms/docs/helps.js +1 -0
  21. package/coms/explorer/Explorer.js +1 -0
  22. package/coms/explorer/context.js +18 -0
  23. package/coms/frame/login.xht +95 -0
  24. package/coms/zimoli/alert.js +1 -1
  25. package/coms/zimoli/button.less +12 -26
  26. package/coms/zimoli/cless.js +1 -1
  27. package/coms/zimoli/marker.js +4 -3
  28. package/coms/zimoli/pending.less +12 -0
  29. package/coms/zimoli/progbar.xht +85 -15
  30. package/coms/zimoli/relogin.js +43 -0
  31. package/coms/zimoli/script.js +5 -5
  32. package/coms/zimoli/table.less +3 -0
  33. package/coms/zimoli/zimoli.js +15 -7
  34. package/package.json +1 -1
  35. package/public/efront.js +1 -1
  36. package/apps/pivot/auth/login.html +0 -13
  37. package/apps/pivot/auth/login.js +0 -49
  38. package/apps/pivot/auth/login.less +0 -28
@@ -122,47 +122,33 @@
122
122
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.3) inset;
123
123
  }
124
124
 
125
+ @import "pending.less";
126
+
125
127
  &[pending],
126
128
  &[loading] {
127
129
  @keyframes ltr {
128
130
  0% {
129
- left: -30%;
130
- }
131
-
132
- 30% {
133
- left: -30%;
134
- }
135
-
136
- 60% {
137
- left: 20%;
138
- }
139
-
140
- 90% {
141
- left: 60%;
131
+ background-position-x: 0;
142
132
  }
143
133
 
144
134
  100% {
145
- left: 130%;
135
+ background-position-x: 15px;
146
136
  }
147
137
 
148
138
  }
149
139
 
150
140
  &:before {
151
- transform: rotate(-12deg);
152
141
  display: block;
153
142
  content: "";
154
143
  position: absolute;
155
- left: -30%;
156
- top: -10%;
157
- width: 6px;
158
- margin-left: -2px;
159
- height: 200%;
160
- background: #fff9;
161
- background: inherit;
162
- opacity: 0.9;
163
- border-left: 1px #fff3 solid;
164
- border-right: 3px #fff6 solid;
165
- animation: ltr 2s linear 0s infinite;
144
+ width: auto;
145
+ left: 0;
146
+ top: 0;
147
+ right: 0;
148
+ bottom: 0;
149
+ height: auto;
150
+ animation: ltr 1.2s linear 0s infinite;
151
+ @pending(#fff2, #0002, 50%);
166
152
  }
167
153
 
168
154
  a&,
@@ -59,7 +59,7 @@ function cless(commFactory, innerCss, className) {
59
59
  } else {
60
60
  stylesheet.innerHTML = innerCss;
61
61
  }
62
- if (!stylesheet.parentNode) appendChild(head, stylesheet);
62
+ if (stylesheet.parentNode !== head) appendChild(head, stylesheet);
63
63
  }
64
64
  return _create(commFactory, className, _create);
65
65
  }
@@ -1,10 +1,11 @@
1
- var b = function (match) {
1
+ var b = function (match, isFullmatch) {
2
2
  var b = document.createElement('b');
3
3
  b.innerText = match;
4
+ if (isFullmatch) b.setAttribute('fullmatch', '');
4
5
  return b;
5
6
  };
6
- var wrap = function (pre, match, aft) {
7
- return [].concat(pre, b(match), aft);
7
+ var wrap = function (pre, match, aft, search) {
8
+ return [].concat(pre, b(match, match.length === search.length), aft);
8
9
  };
9
10
  function marker(e) {
10
11
  if (!e) e = document.createElement("marker");
@@ -0,0 +1,12 @@
1
+ @pending(@line, @back, @sep: 80%) {
2
+ @hep: @sep / 2;
3
+ @aep: 50% + @hep;
4
+ background-image:
5
+ linear-gradient(53.13deg,
6
+ @back, @hep,
7
+ @line, @hep, @line, 50%,
8
+ @back, 50%, @back, @aep,
9
+ @line, @aep, @line );
10
+ background-size: 15px 20px;
11
+ background-repeat: repeat;
12
+ }
@@ -1,46 +1,116 @@
1
1
  <style>
2
2
  & {
3
+ outline-offset: -3px;
4
+ outline: 1px solid #3ae;
3
5
  display: inline-block;
4
6
  min-width: 60px;
5
7
  height: 14px;
6
- color: #3ae;
7
- border: 3px double;
8
- background: #f2f2f2;
8
+ border: 1px solid;
9
+ background: #eee1;
9
10
  position: relative;
10
11
  border-radius: 4px;
12
+ overflow: hidden;
13
+ white-space: nowrap;
14
+ cursor: pointer;
11
15
  }
12
-
16
+
13
17
  &[danger] {
14
- color: #c24;
18
+ outline: 1px solid #c24;
19
+
20
+ >[value] {
21
+ color: #c243;
22
+ @pending(#c24, #fff);
23
+ }
15
24
  }
16
-
25
+
17
26
  >div {
27
+ vertical-align: top;
28
+ display: inline-block;
18
29
  position: relative;
19
- border-top: 7px solid;
30
+ border-top: 11px solid;
20
31
  border-bottom: 1px solid;
21
- border-left: 2px solid;
22
- border-right: 2px solid;
23
32
  height: 100%;
33
+
34
+ &:first-child {
35
+ border-radius: 4px 0 0 4px;
36
+ }
37
+ }
38
+
39
+ @import "pending.less";
40
+
41
+ >[value] {
42
+ @pending(#0004, #fff3);
43
+ background-position-x: right;
44
+ background-clip: border-box;
45
+ color: #3ae2;
46
+
47
+ &:last-child {
48
+ border-radius: inherit;
49
+ }
50
+ }
51
+
52
+ >[state] {
53
+ background-clip: content-box;
54
+ background-color: #6ca;
55
+ }
56
+
57
+ >span {
58
+ position: absolute;
59
+ display: block;
60
+ left: 0;
61
+ top: 0;
62
+ bottom: 0;
63
+ z-index: 1;
64
+ text-align: center;
65
+ right: 0;
24
66
  }
25
67
  </style>
26
68
  <div>
27
- <div -style="{width:value}"></div>
69
+ <span #text></span>
70
+ <div value -style="{width:value}"></div>
71
+ <div state -repeat="(s,i) in state" -style="{width:s,color:color.rotate('#f003',i)}"></div>
28
72
  </div>
29
73
  <script>
30
- var { total, current } = this;
31
- var calc = function () {
74
+ var { total, current, pending = [] } = this;
75
+ var calc = function (current) {
32
76
  var v = (current / total * 10000 + .5) | 0;
33
77
  if (v < 0) v = 0;
34
78
  if (v > 10000) v = 10000;
35
79
  return v / 100 + "%";
36
80
  };
37
- var value = calc();
81
+ var calcAll = function (pending) {
82
+ var res = [].concat(pending);
83
+ var s = sum(res);
84
+ res = res.map(calc);
85
+ res.summary = calc(s);
86
+ return res;
87
+ };
88
+ var state = calcAll(pending);
89
+ var value = calc(current);
38
90
  Object.defineProperties(this, {
91
+ innerText: {
92
+ set(v) {
93
+ text.innerText = v;
94
+ },
95
+ get() {
96
+ return text.innerText;
97
+ },
98
+ },
99
+ pending: {
100
+ set(v) {
101
+ pending = v;
102
+ state = calcAll(pending);
103
+ },
104
+ get() {
105
+ return pending;
106
+ }
107
+ },
39
108
  total: {
40
109
  set(v) {
41
110
  if (total === v) return;
42
111
  total = v;
43
- value = calc();
112
+ value = calc(current);
113
+ state = calcAll(pending);
44
114
  },
45
115
  get() {
46
116
  return total;
@@ -50,7 +120,7 @@
50
120
  set(v) {
51
121
  if (current === v) return;
52
122
  current = v;
53
- value = calc();
123
+ value = calc(current);
54
124
  },
55
125
  get() {
56
126
  return current;
@@ -0,0 +1,43 @@
1
+ function relogin(auth_login) {
2
+ var login_queue = [], reject_queue = [];
3
+ return async function ({ status, url, headers }, reform, reject) {
4
+ if (status === 401) {
5
+ var xhr = this;
6
+ var abort = xhr.abort;
7
+ xhr.abort = function () {
8
+ removeFromList(login_queue, reform);
9
+ removeFromList(reject_queue, reject);
10
+ if (!login_queue.length) remove(reject_queue.splice(0, 1)[0]);
11
+ abort.call(this);
12
+ };
13
+
14
+ if (login_queue.length) {
15
+ login_queue.push(reform);
16
+ reject_queue.push(reject);
17
+ return false;
18
+ }
19
+ var base = data.getInstance("base").base;
20
+ var { protocol, host } = parseURL(url);
21
+ var base1 = protocol + "//" + host + "/";
22
+ if (base !== base1) {
23
+ data.setSource(base1, null);
24
+ }
25
+ login_queue.push(reform);
26
+ var page = await popup(auth_login, base1);
27
+ if (!login_queue.length) return;
28
+ reject_queue.push(page, reject);
29
+ care(page, "login", function (info) {
30
+ data.setSource(base1, info);
31
+ headers.authorization = info;
32
+ login_queue.splice(0, login_queue.length).forEach(q => q());
33
+ reject_queue.splice(0, reject_queue.length);
34
+ });
35
+ on("remove")(page, function () {
36
+ login_queue.splice(0, login_queue.length);
37
+ if (reject_queue[0] === this) reject_queue.shift();
38
+ reject_queue.splice(0, reject_queue.length).forEach(r => r());
39
+ });
40
+ return false;
41
+ }
42
+ }
43
+ }
@@ -15,7 +15,7 @@ function script(url, judger) {
15
15
  clear();
16
16
  if (!needcallback || needcallback > 1000) return;
17
17
  var res = seek(window, judger);
18
- if (res !== undefined){
18
+ if (res !== undefined) {
19
19
  if (res && res.then instanceof Function) {
20
20
  var proto = Object.getPrototypeOf instanceof Function ? Object.getPrototypeOf(res) : res.__proto__;
21
21
  if (Object.setPrototypeOf instanceof Function) Object.setPrototypeOf(res, null);
@@ -24,7 +24,7 @@ function script(url, judger) {
24
24
  var _then = res.then;
25
25
  res.then = null;
26
26
  if (res.then) _then = null;
27
-
27
+
28
28
  }
29
29
  resolve(res.then instanceof Function ? null : res);
30
30
  if (proto) {
@@ -36,7 +36,7 @@ function script(url, judger) {
36
36
  resolve(res);
37
37
  }
38
38
  return ok(res);
39
- }
39
+ }
40
40
  requestAnimationFrame(onload);
41
41
  needcallback++;
42
42
  };
@@ -60,8 +60,8 @@ function script(url, judger) {
60
60
  if (f instanceof Function) oh = f;
61
61
  return script;
62
62
  };
63
- script.then = function (f) {
64
- return promise.then(f);
63
+ script.then = function (f1, f2) {
64
+ return promise.then(f1, f2);
65
65
  };
66
66
  script.catch = function (f) {
67
67
  return promise.catch(f);
@@ -283,4 +283,7 @@ scrollbar[x] {
283
283
  }
284
284
 
285
285
  width: 100%;
286
+ }
287
+ b[fullmatch]{
288
+ color:#824;
286
289
  }
@@ -171,11 +171,11 @@ var getpgpath = function (pagepath) {
171
171
  for (var m of mparams) argobj[m] = params.pop();
172
172
  if (params.length) argobj[m] += "/" + params.reverse().join("/");
173
173
  }
174
- pagepath = realmaped[pagepath] || pagepath;
175
- return [pagepath, argobj];
174
+ var realpath = realmaped[pagepath] || pagepath;
175
+ return [realpath, argobj, pagepath];
176
176
  }
177
- pagepath = realmaped[pagepath] || pagepath;
178
- return [pagepath];
177
+ var realpath = realmaped[pagepath] || pagepath;
178
+ return [realpath, null, pagepath];
179
179
  };
180
180
  function createState(pgpath) {
181
181
  var [pgpath] = getpgpath(pgpath);
@@ -346,7 +346,7 @@ function create(pagepath, args, from, needroles, zimolidata) {
346
346
  if (!isHandled(needroles)) needroles = zimolidata.roles;
347
347
  }
348
348
  if (typeof pagepath === 'string') {
349
- var [pgpath, args0] = getpgpath(pagepath);
349
+ var [pgpath, args0, bspath] = getpgpath(pagepath);
350
350
  var page_object = page_generators[pgpath];
351
351
  if (!isEmpty(args0)) page_object.state.data = args, args = args0;
352
352
  }
@@ -357,6 +357,9 @@ function create(pagepath, args, from, needroles, zimolidata) {
357
357
  throw new Error(i18n`调用create前请确保prepare执行完毕:${pgpath}`);
358
358
  }
359
359
  var { pg, "with": _with_elements, state, onback: _pageback_listener, roles } = page_object;
360
+ state.realpath = pgpath;
361
+ state.basepath = bspath;
362
+ state.pagepath = pagepath;
360
363
  }
361
364
  else if (isFunction(pgpath)) {
362
365
  var pg = pgpath;
@@ -379,6 +382,9 @@ function create(pagepath, args, from, needroles, zimolidata) {
379
382
  _pageback_listener = handler;
380
383
  };
381
384
  var _page = pg.call(state, args, from);
385
+ _page.realpath = state.realpath;
386
+ _page.basepath = state.basepath;
387
+ _page.pagepath = pagepath;
382
388
  if (undefined === args || null === args) args = {};
383
389
  if (_page) {
384
390
  var page_with = _with_elements.splice(_with_length, _with_elements.length - _with_length);
@@ -454,8 +460,9 @@ var createEmptyHistory = function (emptyState, allowForward = true) {
454
460
  h.wardable = allowForward;
455
461
  return h;
456
462
  }
457
- var zimoliid = 0, zimoliad = 0;
463
+ var zimoliid = 0, zimoliad = 0, zimolicd = 0;
458
464
  function zimoli(pagepath, args, history_name, oldpagepath) {
465
+ zimolicd = 1;
459
466
  if (arguments.length === 0) {
460
467
  if (zimoliid !== zimoliad) return;
461
468
  history_name = current_history;
@@ -722,6 +729,7 @@ var _switch = zimoli.switch = function (history_name = default_history, target_b
722
729
  else {
723
730
  if (isString(history_name)) {
724
731
  current_history = history_name = history_name.replace(/\/$/, '') + "/";
732
+ if (!zimolicd) default_history = current_history;
725
733
  }
726
734
  if (target_body) body = target_body;
727
735
  }
@@ -736,7 +744,7 @@ var _switch = zimoli.switch = function (history_name = default_history, target_b
736
744
  if (!history[current_history]) root_path = (history[current_history] = createEmptyHistory(emptyState))[0];
737
745
  else {
738
746
  var _history = history[current_history];
739
- if (_history.index === 0) root_path = _history[0] = emptyState;
747
+ if (_history.index === 0 && _history.length <= 1) root_path = _history[0] = emptyState;
740
748
  }
741
749
  }
742
750
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.28.3",
3
+ "version": "4.29.0",
4
4
  "description": "一个开发环境,提供一种自由的前端开发模式,也可作为辅助工具使用。",
5
5
  "main": "public/efront.js",
6
6
  "directories": {