efront 4.28.4 → 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.
@@ -11,6 +11,7 @@
11
11
  border-radius: 4px;
12
12
  overflow: hidden;
13
13
  white-space: nowrap;
14
+ cursor: pointer;
14
15
  }
15
16
 
16
17
  &[danger] {
@@ -18,7 +19,7 @@
18
19
 
19
20
  >[value] {
20
21
  color: #c243;
21
- @bgimg(#c24, #fff);
22
+ @pending(#c24, #fff);
22
23
  }
23
24
  }
24
25
 
@@ -35,30 +36,42 @@
35
36
  }
36
37
  }
37
38
 
38
- @bgimg(@line, @back) {
39
- background-image: linear-gradient(58deg, @back, 50%, @line, 50%, @line, 53%, @back, 53%, @back);
40
- }
39
+ @import "pending.less";
41
40
 
42
41
  >[value] {
43
- @bgimg(#3ae, #fff);
44
- background-size: 10px 16px;
45
- background-position: 0 0;
46
- background-repeat: repeat;
42
+ @pending(#0004, #fff3);
43
+ background-position-x: right;
47
44
  background-clip: border-box;
48
45
  color: #3ae2;
46
+
47
+ &:last-child {
48
+ border-radius: inherit;
49
+ }
49
50
  }
50
51
 
51
52
  >[state] {
52
53
  background-clip: content-box;
53
54
  background-color: #6ca;
54
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;
66
+ }
55
67
  </style>
56
68
  <div>
69
+ <span #text></span>
57
70
  <div value -style="{width:value}"></div>
58
71
  <div state -repeat="(s,i) in state" -style="{width:s,color:color.rotate('#f003',i)}"></div>
59
72
  </div>
60
73
  <script>
61
- var { total, current, pending } = this;
74
+ var { total, current, pending = [] } = this;
62
75
  var calc = function (current) {
63
76
  var v = (current / total * 10000 + .5) | 0;
64
77
  if (v < 0) v = 0;
@@ -75,6 +88,14 @@
75
88
  var state = calcAll(pending);
76
89
  var value = calc(current);
77
90
  Object.defineProperties(this, {
91
+ innerText: {
92
+ set(v) {
93
+ text.innerText = v;
94
+ },
95
+ get() {
96
+ return text.innerText;
97
+ },
98
+ },
78
99
  pending: {
79
100
  set(v) {
80
101
  pending = v;
@@ -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
+ }
@@ -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.4",
3
+ "version": "4.29.0",
4
4
  "description": "一个开发环境,提供一种自由的前端开发模式,也可作为辅助工具使用。",
5
5
  "main": "public/efront.js",
6
6
  "directories": {