efront 4.23.0 → 4.23.4

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 (45) hide show
  1. package/coms/basic/ArrayFill.js +5 -1
  2. package/coms/basic/BigNumber.js +2 -2
  3. package/coms/basic/data.js +11 -10
  4. package/coms/basic/extend.js +18 -1
  5. package/coms/basic/isFinit.js +1 -0
  6. package/coms/basic_/&ArrayFill.js +1 -5
  7. package/coms/basic_/&extend.js +1 -18
  8. package/coms/basic_/WeakMap.js +19 -6
  9. package/coms/reptile/alert.js +5 -1
  10. package/coms/reptile/data.js +3 -0
  11. package/coms/zimoli/$cared.js +1 -0
  12. package/coms/zimoli/$casted.js +1 -0
  13. package/coms/zimoli/$upwith.js +1 -0
  14. package/coms/zimoli/$watches.js +1 -0
  15. package/coms/zimoli/alert.js +4 -2
  16. package/coms/zimoli/care.js +27 -9
  17. package/coms/zimoli/cast.js +13 -14
  18. package/coms/zimoli/data.js +16 -0
  19. package/coms/zimoli/getChanged.js +8 -0
  20. package/coms/zimoli/menuList.js +0 -1
  21. package/coms/zimoli/model.js +7 -4
  22. package/coms/zimoli/on.js +12 -4
  23. package/coms/zimoli/popup.js +5 -5
  24. package/coms/zimoli/render.js +253 -173
  25. package/coms/zimoli/scrollbar.js +1 -1
  26. package/coms/zimoli/view.js +1 -1
  27. package/coms/zimoli/watch.js +7 -5
  28. package/coms/zimoli/zimoli.js +72 -55
  29. package/docs//347/273/204/344/273/266.xht +14 -1
  30. package/package.json +1 -1
  31. package/public/efront.js +1 -1
  32. package/public/pivot/api.yml +46 -0
  33. package/public/pivot/menu.yml +16 -0
  34. package/public/pivot/page/auth/login.txt +1 -0
  35. package/public/pivot/page/cert/main.txt +1 -0
  36. package/public/pivot/page/cert/orders.txt +1 -0
  37. package/public/pivot/page/cert/update.txt +1 -0
  38. package/public/pivot/page/db/act.txt +1 -0
  39. package/public/pivot/page/db/config.txt +1 -0
  40. package/public/pivot/page/db/edit.txt +1 -0
  41. package/public/pivot/page/db/list.txt +1 -0
  42. package/public/pivot//344/270/273/351/241/265.html +46 -0
  43. package/coms/reptile/on.js +0 -4
  44. package/coms/reptile/onmounted.js +0 -1
  45. /package/coms/{zimoli → basic}/encode62.js +0 -0
@@ -185,7 +185,7 @@ var scrollbary = function () {
185
185
  var onscroll = function () {
186
186
  if (moving) return;
187
187
  var top = _scrollbar.getTTop();
188
- if (Number.isFinite(top)) {
188
+ if (isFinit(top)) {
189
189
  _scrollbar.scrollTo(top);
190
190
  _scrollbar.autoshow();
191
191
  }
@@ -119,7 +119,7 @@ var resize2 = function () {
119
119
  marginTop: fromOffset(-height)
120
120
  });
121
121
  css(body, {
122
- paddingBottom: fromOffset(body.clientTop + body.clientHeight + body.offsetTop - foot.offsetTop)
122
+ paddingBottom: fromOffset(foot.offsetHeight)
123
123
  });
124
124
  }
125
125
  };
@@ -1,5 +1,5 @@
1
1
  function watcher({ changes }) {
2
- var watches = this.$watches;
2
+ var watches = $watches.get(this);
3
3
  for (var k in changes) {
4
4
  if (k in watches) {
5
5
  var h = watches[k];
@@ -10,18 +10,20 @@ function watcher({ changes }) {
10
10
  }
11
11
  }
12
12
  function watch(elem, prop, handler) {
13
- if (!elem.$watches) {
14
- elem.$watches = {};
13
+ var w = $watches.get(elem);
14
+ if (!w) {
15
+ w = {};
16
+ $watches.set(elem, w);
15
17
  on("changes")(elem, watcher);
16
18
  }
17
19
  if (isFunction(handler)) {
18
- elem.$watches[prop] = handler;
20
+ w[prop] = handler;
19
21
  }
20
22
  else if (isObject(prop)) {
21
23
  var e = 0;
22
24
  for (var k in prop) {
23
25
  if (!isFunction(prop[k])) e++;
24
- else elem.$watches[k] = prop[k];
26
+ else w[k] = prop[k];
25
27
  }
26
28
  if (e > 0) throw new Error(i18n`参数不支持!`);
27
29
  }
@@ -120,54 +120,28 @@ function go(pagepath, args, history_name, oldpagepath) {
120
120
  return true;
121
121
  }
122
122
  var realpath = getpgpath(pagepath);
123
- if (realpath.length > 1) var [pgpath, args0] = realpath;
123
+ if (realpath.length > 1) var [pgpath] = realpath;
124
124
  else pgpath = pagepath;
125
- setZimoliParams(pagepath, { data: args, from: oldpagepath, options, roles, id });
125
+ var params = { data: args, from: oldpagepath, options, roles, id };
126
+ setZimoliParams(pagepath, params);
126
127
  if (!page_generators[pgpath]) {
127
128
  return zimoli(pagepath, args, history_name, oldpagepath);
128
129
  }
129
- var page_object = page_generators[pgpath];
130
- if (!isEmpty(args0)) page_object.state.data = args, args = args0;
131
- var fullfill = function () {
132
- zimoliad = zimoliid;
133
- var _page = create(pgpath, args, oldpagepath);
134
- var isRecover = pushstate(pagepath, history_name, oldpagepath);
135
- if (isNode(history_name)) {
136
- if (history_name.activate === pagepath && history_name.activateNode === _page) return fullfill_is_dispatched--;
137
- else remove(history_name.activateNode);
138
- history_name.activate = pagepath;
139
- history_name.activateNode = _page;
140
- }
141
- else if (isString(pagepath)) {
142
- if (fullfill_is_dispatched > 0) return;
143
- fullfill_is_dispatched = 1;
144
- var event = createEvent("zimoli");
145
- event.$reload = fullfill;
146
- event.zimoli = {
147
- path: pagepath,
148
- roles,
149
- data: args,
150
- target: _page,
151
- id,
152
- options
153
- };
154
- dispatch(document, event);
155
- fullfill_is_dispatched = 0;
156
- }
157
- if (isRecover) setWithStyle(_page, false);
158
- addGlobal(_page, history_name, isRecover);
159
- page_object.prepares.splice(0, page_object.prepares.length).forEach(function (url) {
160
- if (isNumber(url)) {
161
- url = _history[url < 2 ? _history.index + url : url];
162
- }
163
- if (isString(url)) prepare(url);
164
- });
165
- if (_page) {
166
- _page.$reload = fullfill;
167
- }
168
- return _page;
169
- };
170
- return fullfill();
130
+ var page = create(pagepath, args, oldpagepath, roles, params);
131
+ zimoliad = zimoliid;
132
+ var isRecover = pushstate(pagepath, history_name, oldpagepath);
133
+ if (isNode(history_name)) {
134
+ if (history_name.activate === pgpath && history_name.activateNode === page) return;
135
+ else remove(history_name.activateNode);
136
+ history_name.activate = pgpath;
137
+ history_name.activateNode = page;
138
+ }
139
+ else if (isString(pgpath)) {
140
+ page.disptch();
141
+ }
142
+ if (isRecover) setWithStyle(page, false);
143
+ addGlobal(page, history_name, isRecover);
144
+ return page;
171
145
  }
172
146
  var page_generators = {};
173
147
  /**
@@ -359,16 +333,26 @@ function prepare(pgpath, ok) {
359
333
  emit(pg);
360
334
  }, state, true);
361
335
  }
362
- function create(pagepath, args, from, needroles) {
336
+ function create(pagepath, args, from, needroles, zimolidata) {
337
+ if (zimolidata) {
338
+ if (!isHandled(args)) args = zimolidata.data;
339
+ if (!isHandled(needroles)) needroles = zimolidata.roles;
340
+ }
363
341
  if (typeof pagepath === 'string') {
364
- var page_object = page_generators[pagepath];
342
+ var [pgpath, args0] = getpgpath(pagepath);
343
+ var page_object = page_generators[pgpath];
344
+ if (!isEmpty(args0)) page_object.state.data = args, args = args0;
345
+ }
346
+ else pgpath = pagepath;
347
+ if (typeof pgpath === 'string') {
348
+ var page_object = page_generators[pgpath];
365
349
  if (!page_object) {
366
- throw new Error(i18n`调用create前请确保prepare执行完毕:${pagepath}`);
350
+ throw new Error(i18n`调用create前请确保prepare执行完毕:${pgpath}`);
367
351
  }
368
352
  var { pg, "with": _with_elements, state, onback: _pageback_listener, roles } = page_object;
369
353
  }
370
- else if (isFunction(pagepath)) {
371
- var pg = pagepath;
354
+ else if (isFunction(pgpath)) {
355
+ var pg = pgpath;
372
356
  var { with: _with_elements = [], state = {}, onback: _pageback_listener, roles } = pg;
373
357
  }
374
358
  var h = history[current_history];
@@ -379,7 +363,7 @@ function create(pagepath, args, from, needroles) {
379
363
  if (h) h.wardable = false;
380
364
  return pg;
381
365
  }
382
- return alert(i18n`没有权限!`, 0);
366
+ return zimoli.alert(i18n`没有权限!`, 0);
383
367
  }
384
368
  if (!pg) return;
385
369
  if (h) h.wardable = true;
@@ -419,7 +403,33 @@ function create(pagepath, args, from, needroles) {
419
403
  if (isEmpty(_page.onback)) {
420
404
  _page.onback = _pageback_listener;
421
405
  }
406
+ _page.disptch = function () {
407
+ if (!zimolidata) return;
408
+ zimoli.upwith = state.upwith;
409
+ if (fullfill_is_dispatched > 0) return;
410
+ fullfill_is_dispatched = 1;
411
+ var event = createEvent("zimoli");
412
+ event.$reload = _page.$reload.bind(_page);
413
+ zimolidata.target = _page;
414
+ zimolidata.path = pagepath;
415
+ event.zimoli = zimolidata;
416
+ dispatch(document, event);
417
+ fullfill_is_dispatched = 0;
418
+ }
419
+ _page.$reload = function () {
420
+ var _page = create(pagepath, undefined, from, undefined, zimolidata);
421
+ appendChild.replace(this, _page);
422
+ return _page;
423
+ };
422
424
  }
425
+ if (!page_object) return _page;
426
+ var _history = history[current_history];
427
+ if (_history) page_object.prepares.splice(0, page_object.prepares.length).forEach(function (url) {
428
+ if (isNumber(url)) {
429
+ url = _history[url < 2 ? _history.index + url : url];
430
+ }
431
+ if (isString(url)) prepare(url);
432
+ });
423
433
  return _page;
424
434
 
425
435
  }
@@ -677,7 +687,7 @@ function addGlobal(element, name = null, isBack) {
677
687
  if (isBack) appendChild.insert(body, element);
678
688
  else appendChild(body, element);
679
689
  }
680
- var upwith = element.$upwith || rootElements;
690
+ var upwith = $upwith.get(element) || rootElements;
681
691
  if (upwith.indexOf(element) < 0) upwith.push(element);
682
692
  }
683
693
  if (hasLock) fixurl(), fixLock = false;
@@ -731,6 +741,8 @@ rootElements.splice = function () {
731
741
  appendChild.transition = transition;
732
742
  remove.transition = transition;
733
743
  zimoli.prepare = prepare;
744
+ var upwith = [];
745
+ zimoli.upwith = popup.upwith(upwith);
734
746
  zimoli.setStorage = function (storage) {
735
747
  historyStorage = storage;
736
748
  try {
@@ -801,8 +813,7 @@ zimoli.enableTouchBack = function () {
801
813
  var path0 = historyList[historyList.index - 1];
802
814
  prepare(path0, function () {
803
815
  if (id !== touchId) return;
804
- var args = getZimoliParams(path0).data;
805
- backwardTarget = create(path0, args, path1);
816
+ backwardTarget = create(path0, null, path1, null, getZimoliParams(path0));
806
817
  setWithStyle(backwardTarget, true);
807
818
  appendChild.insert(body, backwardTarget);
808
819
  });
@@ -815,8 +826,7 @@ zimoli.enableTouchBack = function () {
815
826
  var path2 = historyList[historyList.index + 1];
816
827
  prepare(path2, function () {
817
828
  if (id !== touchId) return;
818
- var args = getZimoliParams(path2).data;
819
- forwardTarget = create(path2, args, path1);
829
+ forwardTarget = create(path2, null, path1, null, getZimoliParams(path2));
820
830
  setWithStyle(forwardTarget, false);
821
831
  appendChild.insert(body, forwardTarget);
822
832
  });
@@ -839,6 +849,7 @@ zimoli.enableTouchBack = function () {
839
849
  transition(backwardTarget, 1);
840
850
  global[history_name] = backwardTarget;
841
851
  fixurl();
852
+ backwardTarget.disptch();
842
853
  }
843
854
  else if (historyList.index < historyList.length - 1 && (deltaX < 0 && ratio < -.1 || deltaX > 0 && ratio < -.9 || deltaX === 0 && ratio < -.4)) {
844
855
  pushstate(historyList[historyList.index + 1], history_name);
@@ -848,6 +859,7 @@ zimoli.enableTouchBack = function () {
848
859
  transition(forwardTarget, 1);
849
860
  global[history_name] = forwardTarget;
850
861
  fixurl();
862
+ forwardTarget.disptch();
851
863
  }
852
864
  else {
853
865
  if (backwardTarget) setWithStyle(backwardTarget, false), remove(backwardTarget);
@@ -861,4 +873,9 @@ zimoli.enableTouchBack = function () {
861
873
  ratio = null;
862
874
  }
863
875
  }, 'x')
876
+ };
877
+ zimoli.alert = function () {
878
+ var ae = alert.apply(this, arguments);
879
+ zimoli.upwith(ae.parentNode);
880
+ return ae;
864
881
  };
@@ -286,7 +286,20 @@
286
286
  }
287
287
  }
288
288
  var argNames = Object.keys(envs);
289
- var args = await Promise.all(argNames.map(a => init(a + "*" + live, null, { ["init*" + live]: init, ["put*" + live]: put, ["zimoli*" + live]: zimoli, ["appendChild*" + live]: appendChild, ["remove*" + live]: remove, ["render*" + live]: render })));
289
+ var args = await Promise.all(argNames.map(a => init(a + "*" + live, null, {
290
+ ["init*" + live]: init,
291
+ ["put*" + live]: put,
292
+ ["zimoli*" + live]: zimoli,
293
+ ["appendChild*" + live]: appendChild,
294
+ ["remove*" + live]: remove,
295
+ ["render*" + live]: render,
296
+ ["$structed*" + live]: $structed,
297
+ ["$scoped*" + live]: $scoped,
298
+ ["$parented*" + live]: $parented,
299
+ ["$mounted*" + live]: $mounted,
300
+ ["$watches*" + live]: $watches,
301
+ ["$renders*" + live]: $renders,
302
+ })));
290
303
  var func = createFunction("", jstext, argNames, code.async, code.yield);
291
304
  var res = func.apply(window, args);
292
305
  if (isFunction(res)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.23.0",
3
+ "version": "4.23.4",
4
4
  "description": "一个开发环境,提供一种自由的前端开发模式,也可作为辅助工具使用。",
5
5
  "main": "public/efront.js",
6
6
  "directories": {