efront 4.22.18 → 4.23.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 (74) hide show
  1. package/#/345/233/275/351/231/205/345/214/226.yml +6 -0
  2. package/apps/kugou/search/search.js +4 -3
  3. package/apps/noice/main.js +1 -1
  4. package/apps/pivot/auth/login.js +4 -4
  5. package/apps/pivot/dht/list.js +5 -5
  6. package/apps/pivot/link/chat.js +1 -1
  7. package/apps/pivot/link/index.js +1 -1
  8. package/apps/pivot/link/list.js +5 -4
  9. package/apps/pivot/share/list.js +6 -5
  10. package/apps/pivot/wow/root.js +3 -2
  11. package/coms/basic/LoadingArray.js +1 -0
  12. package/coms/basic/cross_.js +4 -1
  13. package/coms/basic/data.js +16 -13
  14. package/coms/basic_/WeakMap.js +23 -0
  15. package/coms/compile/Javascript.js +2 -1
  16. package/coms/explorer/context.js +10 -7
  17. package/coms/explorer/edit.js +1 -1
  18. package/coms/explorer/fileitem.js +9 -7
  19. package/coms/explorer/main.js +20 -17
  20. package/coms/frame/chat.js +17 -16
  21. package/coms/frame/list.js +6 -5
  22. package/coms/kugou/bindScroll.js +0 -1
  23. package/coms/kugou/buildScroll.js +5 -4
  24. package/coms/kugou/krc.js +2 -2
  25. package/coms/kugou/player.js +2 -2
  26. package/coms/kugou/song.js +1 -1
  27. package/coms/layer/leftCenter.js +5 -5
  28. package/coms/pivot/checkGeo.js +0 -1
  29. package/coms/zimoli/$eval.js +1 -0
  30. package/coms/zimoli/$mounted.js +1 -0
  31. package/coms/zimoli/$parented.js +1 -0
  32. package/coms/zimoli/$renders.js +1 -0
  33. package/coms/zimoli/$scoped.js +1 -0
  34. package/coms/zimoli/$structed.js +1 -0
  35. package/coms/zimoli/HexEditor.js +1 -1
  36. package/coms/zimoli/appendChild.js +12 -20
  37. package/coms/zimoli/autodragchildren_test.js +1 -1
  38. package/coms/zimoli/checkbox.js +1 -1
  39. package/coms/zimoli/container.js +4 -3
  40. package/coms/zimoli/createItemTarget.js +10 -6
  41. package/coms/zimoli/cross.js +1 -1
  42. package/coms/zimoli/field.js +3 -3
  43. package/coms/zimoli/gallery_test.js +4 -3
  44. package/coms/zimoli/getArgsChildren.js +22 -0
  45. package/coms/zimoli/getGenerator.js +36 -28
  46. package/coms/zimoli/grid.js +2 -2
  47. package/coms/zimoli/isMounted.js +6 -3
  48. package/coms/zimoli/lattice.js +2 -4
  49. package/coms/zimoli/maps.js +1 -2
  50. package/coms/zimoli/menu.js +1 -0
  51. package/coms/zimoli/menuItem.js +4 -3
  52. package/coms/zimoli/menuList.js +8 -8
  53. package/coms/zimoli/menu_test.js +4 -3
  54. package/coms/zimoli/model.js +11 -6
  55. package/coms/zimoli/on.js +28 -20
  56. package/coms/zimoli/picture.js +0 -7
  57. package/coms/zimoli/popup.js +33 -2
  58. package/coms/zimoli/radio.js +1 -1
  59. package/coms/zimoli/remove.js +5 -14
  60. package/coms/zimoli/render.js +193 -99
  61. package/coms/zimoli/scrollbar.js +90 -42
  62. package/coms/zimoli/scrollbar.less +5 -3
  63. package/coms/zimoli/select.js +3 -3
  64. package/coms/zimoli/selectList.js +1 -1
  65. package/coms/zimoli/selectListEdit.js +5 -4
  66. package/coms/zimoli/table.html +6 -4
  67. package/coms/zimoli/table.js +82 -41
  68. package/coms/zimoli/table.less +22 -0
  69. package/coms/zimoli/vbox.less +2 -2
  70. package/coms/zimoli/zimoli.js +15 -8
  71. package/docs/version-desc.md +3 -1
  72. package/docs//347/211/210/346/234/254/350/257/264/346/230/216.md +3 -1
  73. package/package.json +1 -1
  74. package/public/efront.js +1 -1
@@ -133,9 +133,7 @@ function main() {
133
133
  if (!item.length) return;
134
134
  var menu = item.menu;
135
135
  if (!menu) {
136
- var clone = template.cloneNode();
137
- clone.$parentScopes = page.$parentScopes;
138
- clone.$scope = page.$scope;
136
+ var clone =render.clone(template);
139
137
  clone.$src = src;
140
138
  clone.innerHTML = template.innerHTML;
141
139
  menu = item.menu = main(clone, item.children, active);
@@ -165,6 +163,7 @@ function main() {
165
163
  template.innerHTML = page.innerHTML;
166
164
  page.$template = template;
167
165
  }
166
+ var cloner = render.createCloner(template);
168
167
  var enterMenuEnabled = 0;
169
168
  onmousemove(page, function () {
170
169
  enterMenuEnabled = +new Date;
@@ -258,7 +257,7 @@ function main() {
258
257
  };
259
258
  var $scope = {
260
259
  "menu-item"(e, s) {
261
- if (e && s === e.$scope) s = itemName ? s[itemName] : s.$item.value;
260
+ if (e && s === $scoped.get(e)) s = itemName ? s[itemName] : s.$item.value;
262
261
  var a = button(
263
262
  menuItem(e, s, this.hasIcon)
264
263
  );
@@ -284,6 +283,7 @@ function main() {
284
283
  ItemTemplate.setAttribute("e-class", className);
285
284
  if (src.itemName) ItemTemplate.setAttribute("e-if", notHidden);
286
285
  ItemTemplate.innerHTML = menuItem.template;
286
+ page.src = items;
287
287
  var generator = getGenerator(page, ItemTemplate, (item) => {
288
288
  if (item.constructor !== Item) item = new Item(item);
289
289
  if (istoolbar) {
@@ -294,15 +294,15 @@ function main() {
294
294
  }
295
295
  return item;
296
296
  });
297
- page.$generatorScopes.push($scope);
298
- page.src = items;
297
+ var generatorScopes = generator.scopes;
298
+ generatorScopes.push($scope);
299
299
  list(page, generator, direction);
300
300
  if (!page.$renders) page.$renders = [];
301
301
  page.$renders.unshift(function () {
302
- this.$scope.hasIcon = hasIcon();
302
+ $scope.hasIcon = hasIcon();
303
303
  });
304
304
  var getMenu = function (a) {
305
- return a.$scope.$item;
305
+ return $scoped.get(a).$item;
306
306
  }
307
307
  page.open = function (a) {
308
308
  var amenu = getMenu(a);
@@ -22,12 +22,13 @@ function main() {
22
22
  ]
23
23
  }]
24
24
  }], 20);
25
- render(page, {
25
+ var scope = {
26
26
  ylist: menu,
27
27
  menus: []
28
- });
28
+ };
29
+ render(page, scope);
29
30
  on("append")(page, function () {
30
- page.$scope.menus = data;
31
+ scope.menus = data;
31
32
  page.querySelector("ylist").go(0)
32
33
  });
33
34
  return page;
@@ -56,9 +56,10 @@ var constructors = {
56
56
  return e;
57
57
  },
58
58
  success(e) {
59
+ var { field } = e;
59
60
  success(e);
60
61
  e.innerHTML = `<span ng-html="field.comment"></span>`;
61
- render(e.children, e.$scope, e.$parentScopes);
62
+ render(e.children, { field });
62
63
  return e;
63
64
  },
64
65
  switch: swap,
@@ -147,8 +148,8 @@ var constructors = {
147
148
  },
148
149
  "repeat"(_) {
149
150
  var elem = input();
151
+ var { field, data } = _;
150
152
  elem.$renders = [function () {
151
- var { field, data } = this.$scope;
152
153
  var { status } = this;
153
154
  var field_type = field.ref;
154
155
  var valid = this.value === data[field_type];
@@ -247,6 +248,9 @@ var setContent = function (value) {
247
248
  if (this.field.type === 'html') this.innerHTML = value;
248
249
  else this.innerText = value;
249
250
  }
251
+ else {
252
+ remove(this.childNodes);
253
+ }
250
254
  };
251
255
  var Binder = render.Binder, Model = render.Model;
252
256
  Object.keys(readonly_types).forEach(k => {
@@ -316,11 +320,12 @@ function setModel(ipt) {
316
320
  }
317
321
  function setBinder(elem, binder) {
318
322
  if (binder === elem.$binder) return;
319
- removeFromList(elem.$renders, elem.$binder);
323
+ var renders = $renders.get(elem);
324
+ removeFromList(renders, elem.$binder);
320
325
  remove(elem.childNodes);
321
326
  if (binder instanceof Binder) {
322
327
  binder.call(elem);
323
- elem.$renders.push(binder);
328
+ renders.push(binder);
324
329
  }
325
330
  else {
326
331
  var ipt = binder(elem);
@@ -347,11 +352,11 @@ var createOptionsMap = function (options) {
347
352
  }
348
353
  readonly_types.radio = readonly_types.select = readonly_types.swap;
349
354
  var findReaderForElement = function (type, e) {
350
- var editor = render.getFromScopes(type, e.$scope, e.$parentScopes);
355
+ var editor = render.findKey(type, e);
351
356
  if (isFunction(editor) && (editor.isreader || !editor.isediter) && editor.isreader !== false) return editor;
352
357
  };
353
358
  var findEditerForElement = function (type, e) {
354
- var editor = render.getFromScopes(type, e.$scope, e.$parentScopes);
359
+ var editor = render.findKey(type, e);
355
360
  if (isFunction(editor) && (editor.isediter || !editor.isreader) && editor.isediter !== false) return editor;
356
361
  };
357
362
  var markReader = function (readers) {
package/coms/zimoli/on.js CHANGED
@@ -272,7 +272,7 @@ function pending(h, event) {
272
272
  }
273
273
  var remove = function (k, hk, [eventtypes, handler, context]) {
274
274
  var element = this;
275
- var hs = element[hk];
275
+ var hs = hk.get(element);
276
276
  if (hs) {
277
277
  for (var cx = hs.length - 1; cx >= 0; cx--) {
278
278
  var [e, h, c] = hs[cx];
@@ -282,7 +282,7 @@ var remove = function (k, hk, [eventtypes, handler, context]) {
282
282
  }
283
283
  }
284
284
  if (!hs.length && hs.h) {
285
- element[hk] = null;
285
+ hk.delete(element);
286
286
  if (element.removeEventListener) {
287
287
  element.removeEventListener(k, hs.h, getListenerOption(eventtypes, k));
288
288
  }
@@ -292,7 +292,7 @@ var remove = function (k, hk, [eventtypes, handler, context]) {
292
292
  };
293
293
  var broadcast = function (k, hk, event) {
294
294
  var element = this;
295
- var handlers = element[hk];
295
+ var handlers = hk.get(element);
296
296
  if (handlers.length > 1) handlers = handlers.slice();
297
297
  if (event.which === 1 && event.buttons === 0) {
298
298
  // firefox 无按键
@@ -341,7 +341,7 @@ var checkroot = function (element, k) {
341
341
  var append = function (k, hk, listener2, firstmost) {
342
342
  var [eventtypes, handler, context] = listener2;
343
343
  var element = this;
344
- var handlers = element[hk];
344
+ var handlers = hk.get(element);
345
345
  for (var [e, h, c, d] of handlers) {
346
346
  if (h === handler && c === context && shallowEqual(eventtypes, e, 2)) return d.dulp = true, d;
347
347
  }
@@ -353,23 +353,29 @@ var append = function (k, hk, listener2, firstmost) {
353
353
  else handlers.push(listener2);
354
354
  return listener2[3] = remove.bind(element, k, hk, listener2);
355
355
  };
356
-
356
+ var emitersMap = Object.create(null);
357
+ var getEmiters = function (k, eventtypes) {
358
+ k = k + +!!eventtypes.capture;
359
+ k = k + +!!eventtypes.passive;
360
+ var m = emitersMap[k];
361
+ if (!m) m = emitersMap[k] = new WeakMap;
362
+ return m;
363
+ }
357
364
  var on = document.efronton = function (k) {
358
365
  var on_event_path = "on" + k;
359
366
  if (handlersMap[on_event_path]) return handlersMap[on_event_path];
360
367
  var eventtypes = parseEventTypes(k);
361
368
  k = k.replace(eventtypereg, '');
362
- var handler_path = "$h_" + k;
363
- var hk = handler_path + +!!eventtypes.capture;
364
- if (supportPassive) hk += +!!eventtypes.passive;
369
+ var hk = getEmiters(k, is_addEventListener_enabled && eventtypes);
365
370
  if (is_addEventListener_enabled) var addhandler = function (context, handler, firstmost = false) {
366
371
  var target = this || context;
367
372
  target = checkroot(target, k);
368
- if (target[hk] instanceof Array) {
369
- } else {
373
+ var emiters = hk.get(target);
374
+ if (!emiters) {
370
375
  var h = broadcast.bind(target, k, hk);
371
- target[hk] = [];
372
- target[hk].h = h;
376
+ emiters = [];
377
+ emiters.h = h;
378
+ hk.set(target, emiters);
373
379
  if (target.addEventListener)
374
380
  target.addEventListener(k, h, getListenerOption(eventtypes, k));
375
381
  else target[on_event_path] = h;
@@ -385,8 +391,8 @@ var on = document.efronton = function (k) {
385
391
  firstmost = true;
386
392
  }
387
393
  target = checkroot(target, k);
388
- if (target[handler_path] instanceof Array) {
389
- } else {
394
+ var emiters = hk.get(target);
395
+ if (!emiters) {
390
396
  var h = function (e) {
391
397
  if (!e) e = window.event || {};
392
398
  if (!e.target && e.srcElement) {
@@ -411,16 +417,18 @@ var on = document.efronton = function (k) {
411
417
  if (e.keyCode) {
412
418
  if (e.which === undefined) e.which = e.keyCode;
413
419
  }
414
- broadcast.call(target, k, handler_path, e);
420
+ broadcast.call(target, k, emiters, e);
415
421
  return e.returnValue;
416
422
  };
417
- target[handler_path] = target["on" + k] && target["on" + k] !== handler ? [[{}, target["on" + k]]] : [];
418
- target[handler_path].h = h;
419
- target["on" + k] = h;
420
-
423
+ var emiters = [];
424
+ emiters.h = h;
425
+ var h0 = target[on_event_path];
426
+ if (h0 && h0 !== h) emiters.push([{}, h0, target]);
427
+ hk.set(target, emiters);
428
+ target[on_event_path] = h;
421
429
  }
422
430
  var listener = [eventtypes, handler, context];
423
- return append.call(target, k, handler_path, listener, firstmost);
431
+ return append.call(target, k, hk, listener, firstmost);
424
432
  }, addhandler = function (context, handler, firstmost) {
425
433
  return _addhandler(context, context, handler, firstmost);
426
434
  };
@@ -47,13 +47,6 @@ var create = function (url, key, report_error) {
47
47
  remove(p);
48
48
  };
49
49
  image.park = function (x, y, scaled, rotate) {
50
- var style = get_style(x, y, scaled, rotate);
51
- var a = transition(imgpic, style, true);
52
- setTimeout(function () {
53
- // set_unlock();
54
- // image.locked = false;
55
- }, a || 0);
56
-
57
50
  };
58
51
  var init = function () {
59
52
  if (!imgpic) return;
@@ -26,7 +26,26 @@ var popup = function (path) {
26
26
  }
27
27
  throw new Error(i18n`参数异常:${path}`);
28
28
  };
29
+ var onAppendUp = function () {
30
+ var upwith = this.$upwith;
31
+ if (isArray(upwith) && upwith.indexOf(this) < 0) {
32
+ upwith.push(this);
33
+ }
34
+ };
35
+ var onRemoveUp = function () {
36
+ var upwith = this.$upwith;
37
+ if (isArray(upwith)) {
38
+ removeFromList(upwith, this);
39
+ }
40
+ };
41
+ var setUpwith = function (page, upwith) {
42
+ if (!isArray(upwith)) return;
43
+ page.$upwith = upwith;
44
+ on('append')(page, onAppendUp);
45
+ on('remove')(page, onRemoveUp);
46
+ };
29
47
  var popup_path = function (path = "", parameters, target) {
48
+ var upwith_ = upwith;
30
49
  if (!popup.go || !popup.prepare) throw new Error(i18n`当前环境无法使用`);
31
50
  // 3 has mask has view control
32
51
  var element;
@@ -86,6 +105,7 @@ var popup_path = function (path = "", parameters, target) {
86
105
  remove(element && element.$mask);
87
106
  element = popup.create(path, parameters);
88
107
  if (!element) return;
108
+ setUpwith(element, upwith_);
89
109
  load();
90
110
  element.$reload = fullfill;
91
111
  if (target == null && parameters !== false) {
@@ -106,8 +126,9 @@ var popup_path = function (path = "", parameters, target) {
106
126
  }, fullfill
107
127
  };
108
128
  };
109
-
129
+ var upwith = null;
110
130
  var popup_view = function (element, target, style) {
131
+ setUpwith(element, upwith);
111
132
  if (isNode(target)) {
112
133
  if (target.$mask) {
113
134
  popup_with_mask(element, target);
@@ -395,9 +416,19 @@ var popup_fixup = function (element, x, y) {
395
416
  var popup_to_event = function (element, { clientX, clientY }) {
396
417
  popup_fixup(element, clientX, clientY);
397
418
  };
419
+
420
+ popup.upwith = function (collects) {
421
+ return function () {
422
+ upwith = collects;
423
+ var res = popup.apply(this, arguments);
424
+ upwith = null;
425
+ return res;
426
+ }
427
+ };
398
428
  var global = function (element, issingle) {
399
429
  once("remove")(element, cleanup);
400
- rootElements.push(element);
430
+ var upwith = element.$upwith || rootElements;
431
+ if (upwith.indexOf(element) < 0) upwith.push(element);
401
432
  if (isMounted(element)) return;
402
433
  popup.global &&
403
434
  issingle !== false ? popup.global(element, true) : appendChild(document.body, element);
@@ -27,7 +27,7 @@ function main(elem = document.createElement("radio-group")) {
27
27
  }
28
28
  });
29
29
  elem.setValue = function (key) {
30
- var { options } = this.$scope;
30
+ var { options } = $scoped.get(this);
31
31
  if (!(options instanceof Array)) return;
32
32
  var index = options.map(a => getValue(a)).indexOf(key);
33
33
  options.active = options[index];
@@ -1,15 +1,6 @@
1
- function remove() {
2
- var [node, transition] = arguments;
1
+ function remove(node, transition) {
3
2
  if (!node) return;
4
- if (isNode(node)) {
5
- if (transition !== false) {
6
- var args = arguments;
7
- } else {
8
- var args = [node];
9
- }
10
- } else {
11
- var args = node;
12
- }
3
+ var args = getArgsChildren(arguments, 0);
13
4
  for (var cx = args.length - 1; cx >= 0; cx--) {
14
5
  node = args[cx];
15
6
  if (!node) continue;
@@ -42,14 +33,14 @@ function hasLeaveStyle(o) {
42
33
  }
43
34
 
44
35
  function _onremove(node, event) {
45
- if (!node || node.$mounted === false) return;
36
+ if (!node || $mounted.get(node) === false) return;
46
37
  var children = node.childNodes;
47
- if (node.$mounted) {
38
+ if ($mounted.get(node)) {
48
39
  if (!event) {
49
40
  event = createEvent("remove");
50
41
  }
51
42
  dispatch(node, event);
52
- node.$mounted = false;
43
+ $mounted.set(node, false);
53
44
  }
54
45
  if (children) for (var cx = 0, dx = children.length; cx < dx; cx++) {
55
46
  _onremove(children[cx], event);