efront 4.22.8 → 4.22.9

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.
@@ -14,7 +14,6 @@
14
14
  padding-right: 60px;
15
15
  cursor: default;
16
16
  white-space: nowrap;
17
- margin: 0 -6px;
18
17
  width: auto;
19
18
 
20
19
  >tag {
@@ -96,8 +95,17 @@
96
95
  font-size: 16px;
97
96
  width: auto;
98
97
  background: inherit;
99
- border-left: 6px solid transparent;
100
- border-right: 6px solid transparent;
98
+
99
+ &:before {
100
+ content: "";
101
+ z-index: 1;
102
+ position: absolute;
103
+ right: 0;
104
+ top: 0;
105
+ bottom: 0;
106
+ width: 16px;
107
+ display: block;
108
+ }
101
109
  }
102
110
 
103
111
  .search-box {
@@ -28,6 +28,7 @@
28
28
  border: 1px solid #999;
29
29
  padding: 4px 10px;
30
30
  height: 60px;
31
+
31
32
  [a-key] {
32
33
  font-family: 20px;
33
34
  font-style: italic;
@@ -67,7 +68,8 @@
67
68
  动作管理
68
69
  `;
69
70
  var fields = refilm`
70
- 是否公开/open swap`;
71
+ 是否公开/open swap // 允许所有人检索全部内容
72
+ (用户互访/visit/,open=false) swap // 不公开时检查此项`;
71
73
  var [db] = arguments;
72
74
  if (!db.fields) {
73
75
  var [da1] = await data.from('dbfind', { dbid: db.name, size: 1 });
@@ -3,7 +3,7 @@ function writeLEB128(dist, offset, value) {
3
3
  while (b > 127) {
4
4
  var t = b & 0x7f;
5
5
  dist[offset++] = t | 0b10000000;
6
- b = b >> 7;
6
+ b = b >>> 7;
7
7
  }
8
8
  dist[offset++] = b;
9
9
  return offset;
@@ -201,7 +201,7 @@
201
201
  menu = result.active || firstMenu;
202
202
  if (!menu?.path) return;
203
203
  first_opened = true;
204
- zimoli.switch(null, null, menu.path);
204
+ zimoli.switch(null, null, menu);
205
205
  zimoli();
206
206
  return;
207
207
  }
@@ -6,7 +6,7 @@
6
6
  var body = document.body;
7
7
  var onbacks = [];
8
8
  var window_history = window.history || { length: 0, go() { }, back() { } };
9
- var hostoryStorage = sessionStorage;
9
+ var historyStorage = sessionStorage;
10
10
  var getLocationHash = function () {
11
11
  if ('hash' in location) return location.hash;
12
12
  return location.href.replace(/^[^#]+/, '');
@@ -72,7 +72,7 @@ function getReverseStyle(style) {
72
72
  }
73
73
  var getZimoliParams = function (pagepath) {
74
74
  try {
75
- return JSAM.parse(hostoryStorage.getItem(_zimoli_params_key + pagepath)) || {};
75
+ return JSAM.parse(historyStorage.getItem(_zimoli_params_key + pagepath)) || {};
76
76
  } catch (e) {
77
77
  console.warn(i18n`存储空间被破坏`);
78
78
  }
@@ -80,14 +80,19 @@ var getZimoliParams = function (pagepath) {
80
80
  };
81
81
  var setZimoliParams = function (pagepath, args) {
82
82
  try {
83
- var stringified_args = JSAM.stringify(args);
84
- if (stringified_args.length === 2) hostoryStorage.removeItem(_zimoli_params_key + pagepath);
85
- else hostoryStorage.setItem(_zimoli_params_key + pagepath, stringified_args);
83
+ if (!isHandled(args)) {
84
+ historyStorage.removeItem(_zimoli_params_key + pagepath);
85
+ }
86
+ else {
87
+ var stringified_args = JSAM.stringify(args);
88
+ if (stringified_args.length === 2) historyStorage.removeItem(_zimoli_params_key + pagepath);
89
+ else historyStorage.setItem(_zimoli_params_key + pagepath, stringified_args);
90
+ }
86
91
  } catch (e) {
87
92
  console.warn(i18n`写入存储空间失败!`, e);
88
93
  }
89
94
  };
90
- var fullfill_is_dispatched = 0;
95
+ var fullfill_is_dispatched = false;
91
96
  function go(pagepath, args, history_name, oldpagepath) {
92
97
  if (history_name === undefined)
93
98
  history_name = current_history;
@@ -194,7 +199,7 @@ function createState(pgpath) {
194
199
  var [pgpath] = getpgpath(pgpath);
195
200
  var _zimoli_state_key = _zimoli_state_prefix + pgpath;
196
201
  var state = function state(condition, setAsAdditional = condition !== null) {
197
- var state_string = hostoryStorage.getItem(_zimoli_state_key);
202
+ var state_string = historyStorage.getItem(_zimoli_state_key);
198
203
  var state_object;
199
204
  if (state_string) {
200
205
  try {
@@ -219,7 +224,7 @@ function createState(pgpath) {
219
224
  state_object = condition;
220
225
  }
221
226
  if (arguments.length) {
222
- hostoryStorage.setItem(_zimoli_state_key, JSAM.stringify(state_object) || null);
227
+ historyStorage.setItem(_zimoli_state_key, JSAM.stringify(state_object) || null);
223
228
  }
224
229
  return state_object;
225
230
  };
@@ -367,11 +372,14 @@ function create(pagepath, args, from, needroles) {
367
372
  if (!checkroles(user.roles, roles) || !checkroles(user.roles, needroles)) {
368
373
  // 检查权限
369
374
  if (!user.isLogin && user.loginPath) {
370
- return create(user.loginPath);
375
+ var pg = create(user.loginPath);
376
+ history[current_history].wardable = false;
377
+ return pg;
371
378
  }
372
379
  return alert(i18n`没有权限!`, 0);
373
380
  }
374
381
  if (!pg) return;
382
+ history[current_history].wardable = true;
375
383
  var _with_length = _with_elements.length;
376
384
  state.onback = function (handler) {
377
385
  _pageback_listener = handler;
@@ -408,9 +416,10 @@ function create(pagepath, args, from, needroles) {
408
416
  return _page;
409
417
 
410
418
  }
411
- var createEmptyHistory = function (emptyState) {
419
+ var createEmptyHistory = function (emptyState, allowForward = true) {
412
420
  var h = [emptyState];
413
421
  h.index = 0;
422
+ h.wardable = allowForward;
414
423
  return h;
415
424
  }
416
425
  var zimoliid = 0, zimoliad = 0;
@@ -422,7 +431,7 @@ function zimoli(pagepath, args, history_name, oldpagepath) {
422
431
  root_path = _history[0];
423
432
  pagepath = _history[_history.index];
424
433
  try {
425
- var saveddata = JSAM.parse(hostoryStorage.getItem(_zimoli_params_key + pagepath)) || {};
434
+ var saveddata = JSAM.parse(historyStorage.getItem(_zimoli_params_key + pagepath)) || {};
426
435
  } catch (e) {
427
436
  var saveddata = {};
428
437
  }
@@ -443,13 +452,16 @@ function zimoli(pagepath, args, history_name, oldpagepath) {
443
452
  var global = {};
444
453
  var history = {};
445
454
  var current_history, default_history = current_history = "";
446
- history[current_history] = createEmptyHistory('/main');
455
+ history[current_history] = createEmptyHistory('/main', false);
447
456
  var history_session_object_key = `_zimoli_history_key:${location_pathname}`;
448
457
  try {
449
- history = JSAM.parse(hostoryStorage.getItem(history_session_object_key)) || history;
458
+ history = JSAM.parse(historyStorage.getItem(history_session_object_key)) || history;
450
459
  } catch (e) {
451
460
  }
452
461
  var root_path;
462
+ var savestate = function () {
463
+ historyStorage.setItem(history_session_object_key, JSAM.stringify(history) || null);
464
+ };
453
465
  var pushstate = function (path_name, history_name) {
454
466
  var isBack = false;
455
467
  if (history_name === undefined) {
@@ -460,6 +472,7 @@ var pushstate = function (path_name, history_name) {
460
472
  history[history_name] = createEmptyHistory(path_name);
461
473
  } else {
462
474
  var _history = history[history_name];
475
+ var index = _history.index;
463
476
  for (var cx = 0, dx = _history.index + 1; cx < dx; cx++) {
464
477
  if (_history[cx] === path_name) {
465
478
  _history.index = cx;
@@ -471,11 +484,12 @@ var pushstate = function (path_name, history_name) {
471
484
  _history.index++;
472
485
  }
473
486
  if (_history[_history.index] !== path_name) {
487
+ _history.lastIndex = index;
474
488
  _history.splice(_history.index, _history.length - _history.index);
475
489
  _history[_history.index] = path_name;
476
490
  }
477
491
  }
478
- hostoryStorage.setItem(history_session_object_key, JSAM.stringify(history) || null);
492
+ savestate();
479
493
  return isBack;
480
494
  };
481
495
  var popstate = function (path_name, history_name) {
@@ -502,6 +516,7 @@ var getCurrentHash = function () {
502
516
  return encodeURI(targeturl);
503
517
  };
504
518
  var fixurl = function () {
519
+ if (false === fullfill_is_dispatched) return;
505
520
  var zimoli_hash = getCurrentHash();
506
521
  var location_hash = getLocationHash();
507
522
  if (location_hash === zimoli_hash) return;
@@ -534,9 +549,10 @@ var fixurl = function () {
534
549
  }
535
550
  }
536
551
  }
537
- else if (location_hash !== locationInitHash) {
552
+ else if (location_path !== getInitPath()) {
538
553
  var _history = history[current_history];
539
554
  var i = _history.indexOf(location_path);
555
+ if (i === -1) i = _history.lastIndex;
540
556
  if (i > 0) {
541
557
  preventNextHashChange = true;
542
558
  window_history.go(-i);
@@ -562,12 +578,14 @@ put(":empty", function () {
562
578
  });
563
579
  var forward = function (pgpath) {
564
580
  var hty = history[current_history];
581
+ if (hty[hty.index - 1] === pgpath) {
582
+ backward();
583
+ return;
584
+ }
585
+ if (!hty.wardable) return;
565
586
  if (hty[hty.index + 1] === pgpath) {
566
587
  go(1);
567
588
  }
568
- else if (hty[hty.index - 1] === pgpath) {
569
- backward();
570
- }
571
589
  else {
572
590
  go(pgpath);
573
591
  }
@@ -664,6 +682,11 @@ var _switch = zimoli.switch = function (history_name = default_history, target_b
664
682
  if (target_body) body = target_body;
665
683
  }
666
684
  if (isHandled(emptyState) && emptyState !== false) {
685
+ if (isObject(emptyState)) {
686
+ var { path: pagepath, need, roles = need, data: args, id, options } = emptyState;
687
+ setZimoliParams(pagepath, { roles, data: args, id, options });
688
+ emptyState = pagepath;
689
+ }
667
690
  if (!history[current_history]) root_path = (history[current_history] = createEmptyHistory(emptyState))[0];
668
691
  else {
669
692
  var _history = history[current_history];
@@ -695,9 +718,9 @@ appendChild.transition = transition;
695
718
  remove.transition = transition;
696
719
  zimoli.prepare = prepare;
697
720
  zimoli.setStorage = function (storage) {
698
- hostoryStorage = storage;
721
+ historyStorage = storage;
699
722
  try {
700
- history = JSAM.parse(hostoryStorage.getItem(history_session_object_key)) || history;
723
+ history = JSAM.parse(historyStorage.getItem(history_session_object_key)) || history;
701
724
  } catch (e) {
702
725
  }
703
726
  };
@@ -710,7 +733,7 @@ zimoli.register = function (pathlike) {
710
733
  pathmaped[pathlike] = params;
711
734
  };
712
735
  zimoli.clearHistory = function () {
713
- hostoryStorage.removeItem(history_session_object_key);
736
+ historyStorage.removeItem(history_session_object_key);
714
737
  history = {};
715
738
  };
716
739
  zimoli.getCurrentHistory = function () {
@@ -721,8 +744,13 @@ zimoli.getCurrentHistory = function () {
721
744
  };
722
745
  zimoli.inithash = locationInitHash;
723
746
  zimoli.createState = createState;
724
- zimoli.getInitPath = function () {
725
- return pathFromHash(locationInitHash);
747
+ // 赤匪最擅长的是移花接木。别人写好的文章,它改一下作者名,就成了它写的;别人种的粮食,它抢过来,说是别人贡献的。
748
+ // 赤匪在中国设置各种语言陷井,欺压民众,不让民众发声,还说这是民众对它的信任。
749
+ // 家中进了贼,我们是把家让给它,还是找机会把贼杀了。
750
+ var getInitPath = zimoli.getInitPath = function () {
751
+ var h = history[current_history];
752
+ if (h.length < 2) return pathFromHash(locationInitHash);
753
+ return h[0];
726
754
  };
727
755
  var touchEnabled = false;
728
756
  zimoli.enableTouchBack = function () {
@@ -795,6 +823,7 @@ zimoli.enableTouchBack = function () {
795
823
  remove(forwardTarget, false);
796
824
  transition(backwardTarget, 1);
797
825
  global[history_name] = backwardTarget;
826
+ fixurl();
798
827
  }
799
828
  else if (historyList.index < historyList.length - 1 && (deltaX < 0 && ratio < -.1 || deltaX > 0 && ratio < -.9 || deltaX === 0 && ratio < -.4)) {
800
829
  pushstate(historyList[historyList.index + 1], history_name);
@@ -803,6 +832,7 @@ zimoli.enableTouchBack = function () {
803
832
  remove(backwardTarget, false);
804
833
  transition(forwardTarget, 1);
805
834
  global[history_name] = forwardTarget;
835
+ fixurl();
806
836
  }
807
837
  else {
808
838
  if (backwardTarget) setWithStyle(backwardTarget, false), remove(backwardTarget);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.22.8",
3
+ "version": "4.22.9",
4
4
  "description": "一个开发环境,提供一种自由的前端开发模式,也可作为辅助工具使用。",
5
5
  "main": "public/efront.js",
6
6
  "directories": {