efront 3.21.6 → 3.22.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 (39) hide show
  1. package/apps/pay/alipay-callback.jsp +8 -5
  2. package/apps/pay/alipay-query.jsp +15 -0
  3. package/apps/pay/alipay.jsp +10 -13
  4. package/apps/pay/alipay_test.js +2 -1
  5. package/apps/pivot/auth/login.html +3 -0
  6. package/apps/pivot/auth/login.js +1 -1
  7. package/apps/pivot/auth/login.less +16 -3
  8. package/apps/pivot/log/boot.js +3 -2
  9. package/coms/basic/BigNumber.js +2 -2
  10. package/coms/basic/BigNumber_test.js +5 -0
  11. package/coms/basic/[]map.js +1 -1
  12. package/coms/compile/scanner2.js +12 -1
  13. package/coms/frame/list.less +6 -4
  14. package/coms/frame/payment.js +17 -2
  15. package/coms/layer/glance.js +4 -2
  16. package/coms/reptile/cross.js +5 -3
  17. package/coms/zimoli/autodragchildren.js +46 -35
  18. package/coms/zimoli/drag.js +1 -1
  19. package/coms/zimoli/gallery.js +1 -1
  20. package/coms/zimoli/getGenerator.js +4 -2
  21. package/coms/zimoli/list.js +31 -22
  22. package/coms/zimoli/menu.js +1 -3
  23. package/coms/zimoli/menuList.js +12 -16
  24. package/coms/zimoli/on.js +12 -0
  25. package/coms/zimoli/once.js +9 -7
  26. package/coms/zimoli/pagination.html +1 -1
  27. package/coms/zimoli/pagination.js +9 -24
  28. package/coms/zimoli/pagination.less +34 -19
  29. package/coms/zimoli/render.js +11 -1
  30. package/coms/zimoli/scrollbar.js +5 -5
  31. package/coms/zimoli/table.html +24 -10
  32. package/coms/zimoli/table.js +270 -61
  33. package/coms/zimoli/table.less +76 -34
  34. package/coms/zimoli/table_test.html +32 -0
  35. package/coms/zimoli/table_test.js +1 -8
  36. package/coms/zimoli/vbox.js +25 -17
  37. package/coms/zimoli/vscroll.js +4 -4
  38. package/package.json +1 -1
  39. package/public/efront.js +1 -1
@@ -14,14 +14,18 @@ function ylist(container, generator, $Y) {
14
14
  saved_itemIndex = void 0;
15
15
  if (a !== void 0) scrollTo(a);
16
16
  });
17
+ var getNodeTarget = function (node) {
18
+ if (node.nodeType === 8 && node.template) return node.template;
19
+ return node;
20
+ };
17
21
  //取底部元素
18
22
  var getLastElement = function (nodeType) {
19
- var children = nodeType === 1 ? list.children : list.childNodes;
23
+ var children = list.childNodes;
20
24
  for (var cx = children.length - 1; cx >= 0; cx--) {
21
25
  var child = children[cx];
22
- if (isFinite(child.index) || nodeType === 2 && child.offsetHeight) {
23
- return child;
24
- }
26
+ if (!(isFinite(child.index) || nodeType === 2 && child.offsetHeight)) continue;
27
+ child = getNodeTarget(child);
28
+ return child;
25
29
  }
26
30
  return null;
27
31
  };
@@ -30,33 +34,33 @@ function ylist(container, generator, $Y) {
30
34
  var children = list.childNodes;
31
35
  for (var cx = children.length - 1; cx >= 0; cx--) {
32
36
  var child = children[cx];
33
- if (isFinite(child.index) && child.index === index) {
34
- return child;
35
- }
37
+ if (child.index !== index) continue;
38
+ child = getNodeTarget(child);
39
+ return child;
36
40
  }
37
41
  return null;
38
42
  };
39
43
 
40
44
  //取顶部元素
41
45
  var getFirstElement = function (nodeType) {
42
- var children = nodeType === 1 ? list.children : list.childNodes;
46
+ var children = list.childNodes;
43
47
  for (var cx = 0, dx = children.length; cx < dx; cx++) {
44
48
  var child = children[cx];
45
- if (isFinite(child.index) || nodeType === 2 && child.offsetHeight) {
46
- return child;
47
- }
49
+ if (!(isFinite(child.index) || nodeType === 2 && child.offsetHeight)) continue;
50
+ child = getNodeTarget(child);
51
+ return child;
48
52
  }
49
53
  return null;
50
54
  };
51
55
  var getFirstVisibleElement = function (deltaY = 0) {
52
- var children = list.children;
56
+ var children = list.childNodes;
53
57
  var { scrollTop } = list;
54
58
  scrollTop += deltaY;
55
59
  for (var cx = 0, dx = children.length; cx < dx; cx++) {
56
60
  var child = children[cx];
57
- if (isFinite(child.index) && child.offsetTop + child.offsetHeight > scrollTop) {
58
- return child;
59
- }
61
+ if (!isFinite(child.index)) continue;
62
+ child = getNodeTarget(child);
63
+ if (child.offsetTop + child.offsetHeight > scrollTop) return child;
60
64
  }
61
65
  return null;
62
66
  };
@@ -88,7 +92,9 @@ function ylist(container, generator, $Y) {
88
92
  var children = list.children;
89
93
  for (var cx = children.length - 1; cx >= 0; cx--) {
90
94
  var child = children[cx];
91
- if (isFinite(child.index) && child.offsetTop < scrollTop + list.clientHeight) {
95
+ if (!isFinite(child.index)) continue;
96
+ child = getNodeTarget(child);
97
+ if (child.offsetTop < scrollTop + list.clientHeight) {
92
98
  return child;
93
99
  }
94
100
  }
@@ -96,7 +102,7 @@ function ylist(container, generator, $Y) {
96
102
  };
97
103
  //元素表
98
104
  var getChildrenMap = function () {
99
- var children = list.children;
105
+ var children = list.childNodes;
100
106
  var map = {};
101
107
  for (var cx = 0, dx = children.length; cx < dx; cx++) {
102
108
  var child = children[cx];
@@ -152,6 +158,7 @@ function ylist(container, generator, $Y) {
152
158
  if (item.previousElementSibling !== item) list.insertBefore(item, getNextSibling(last_item));
153
159
  }
154
160
  last_index = offset;
161
+ item = getNodeTarget(item);
155
162
  last_item = item;
156
163
  if (offset === index || !indexed_item) indexed_item = item;
157
164
  if (delta > 0) {
@@ -249,6 +256,7 @@ function ylist(container, generator, $Y) {
249
256
  }
250
257
  list.insertBefore(item, getNextSibling(last_element));
251
258
  }
259
+ item = getNodeTarget(item);
252
260
  if (!item.offsetHeight) {
253
261
  console.warn(item, '!item.offsetHeight');
254
262
  break;
@@ -312,6 +320,7 @@ function ylist(container, generator, $Y) {
312
320
  item = createItem(offset);
313
321
  if (!item) break;
314
322
  list.insertBefore(item, first_element);
323
+ item = getNodeTarget(item);
315
324
  scrollTop += flag_element.offsetTop - offsetTop;
316
325
  offsetTop = flag_element.offsetTop;
317
326
  first_element = item;
@@ -352,7 +361,7 @@ function ylist(container, generator, $Y) {
352
361
  }
353
362
  };
354
363
  list.getLastVisibleElement = getLastVisibleElement;
355
- list.stopY = function (count, spd) {
364
+ list.$stopY = function (count, spd) {
356
365
  var firstElement = getFirstVisibleElement();
357
366
  var lastElement = getLastVisibleElement();
358
367
  if (!firstElement || !lastElement || !list.clientHeight) return false;
@@ -386,7 +395,7 @@ function ylist(container, generator, $Y) {
386
395
  if (deltay < 3) speed = .5;
387
396
  y = last_y + (target_y > last_y ? speed : -speed);
388
397
  }
389
- list.Top(y);
398
+ list.$Top(y);
390
399
  if (target_y === y) {
391
400
  return false;
392
401
  }
@@ -394,12 +403,12 @@ function ylist(container, generator, $Y) {
394
403
  };
395
404
  //导出方法
396
405
  list.go = scrollTo;
397
- list.Height = function () {
406
+ list.$Height = function () {
398
407
  var elem = getLastElement(2);
399
408
  var listRestHeight = elem ? elem.offsetHeight + elem.offsetTop - list.scrollTop : list.clientHeight;
400
409
  return currentY() + listRestHeight + restHeight;
401
410
  };
402
- list.Top = function (y) {
411
+ list.$Top = function (y) {
403
412
  if (isFinite(y)) {
404
413
  var last_y = currentY();
405
414
  if (y !== last_y) {
@@ -431,7 +440,7 @@ function ylist(container, generator, $Y) {
431
440
  on("remove")(list, function () {
432
441
  saved_itemIndex = list.index();
433
442
  });
434
- on("append")(list, function () {
443
+ onmounted(list, function () {
435
444
  if (isFinite(saved_itemIndex)) list.go(saved_itemIndex);
436
445
  })
437
446
  return list;
@@ -25,9 +25,7 @@ function menu(buttons, map = buttons.map((a, cx) => cx)) {
25
25
  });
26
26
  css(extra_list, "min-width:180px;width:auto;height:auto;border:1px solid #000;background:#fff;padding:4px 0;");
27
27
  select(menu_extra, extra_list);
28
- onappend(extra_list, function () {
29
- extra_list.go(0);
30
- });
28
+ extra_list.go(0);
31
29
  appendChild(menu_box, menu_items, menu_extra);
32
30
  return menu_box;
33
31
  }
@@ -14,6 +14,7 @@ var unfocus = function () {
14
14
  this.setFocus(null);
15
15
  };
16
16
  var setFocus = function (focused) {
17
+ console.log(focused)
17
18
  if (focused && focused.hasAttribute("disabled")) return;
18
19
  var page = this;
19
20
  if (focused) {
@@ -178,6 +179,7 @@ function main(page, items, active, direction = 'y') {
178
179
  }
179
180
  if (emptyFocus !== false) page.setFocus(target);
180
181
  if (!item.length) return;
182
+ console.log('popupmenu')
181
183
  page.setFocus(target);
182
184
  var clone = template.cloneNode();
183
185
  clone.$parentScopes = page.$parentScopes;
@@ -199,6 +201,7 @@ function main(page, items, active, direction = 'y') {
199
201
  once("remove")(menu, function () {
200
202
  removeFromList(mounted_menus, this);
201
203
  });
204
+ menu.go(0);
202
205
  }
203
206
  on("blur")(page, unfocus);
204
207
  var template = page.tempalte || document.createElement("ylist");
@@ -215,7 +218,7 @@ function main(page, items, active, direction = 'y') {
215
218
  time = +time;
216
219
  if (byMousedown && !time) return;
217
220
  if (time) byMousedown = false;
218
-
221
+
219
222
  if (page.ispop || time) popTimer = setTimeout(function () {
220
223
  if (time) byMousedown = elem;
221
224
  page.setFocus(elem);
@@ -312,10 +315,7 @@ function main(page, items, active, direction = 'y') {
312
315
  }`;
313
316
  var notHidden = `!${itemName}.hidden`;
314
317
  var generator = getGenerator(page, 'menu-item');
315
- var fire0 = function () {
316
- fire.apply(this, arguments);
317
- dispatch(window, 'render');
318
- };
318
+ page.$generatorScopes.push($scope);
319
319
  list(page, function (index) {
320
320
  var item = items[index];
321
321
  if (!item) return;
@@ -323,18 +323,15 @@ function main(page, items, active, direction = 'y') {
323
323
  var a = $scope["menu-item"](null, item);
324
324
  if (src.itemName) a.setAttribute("e-if", notHidden);
325
325
  a.setAttribute("e-class", className);
326
+ a.setAttribute("on-mouseleave", "cancel.call(this)");
327
+ a.setAttribute("on-mouseenter", "popMenu.call(this)");
328
+ a.setAttribute("on-pointermove", "popMenu.call(this)");
329
+ a.setAttribute("on-click", "open.call(this)");
330
+ a.setAttribute("_menu", src.itemName);
331
+ if (istoolbar) a.setAttribute("on-pointerdown", "popMenu1");
326
332
  a = generator(index, item, a);
327
- a.menu = item;
328
- on("mouseleave")(a, cancel);
329
- on("mouseenter")(a, open);
330
- on("pointermove")(a, open);
331
- if (istoolbar) on("pointerdown")(a, open1);
332
- on("click")(a, fire0);
333
333
  return a;
334
334
  });
335
- on("append")(page, function () {
336
- this.go(0);
337
- })
338
335
  }
339
336
  else {
340
337
  page.innerHTML = menuList;
@@ -349,7 +346,6 @@ function main(page, items, active, direction = 'y') {
349
346
  }
350
347
  else {
351
348
  var generator = getGenerator(page, 'menu-item');
352
-
353
349
  list(page, function (index) {
354
350
  var elem = generator(index);
355
351
  if (!elem) return;
@@ -362,7 +358,7 @@ function main(page, items, active, direction = 'y') {
362
358
  on("mouseenter")(elem, open);
363
359
  on("pointermove")(elem, cancel);
364
360
  if (istoolbar) on("pointerdown")(elem, open1);
365
- on("click")(elem, fire0);
361
+ on("click")(elem, fire);
366
362
  return elem;
367
363
  }, direction);
368
364
  }
package/coms/zimoli/on.js CHANGED
@@ -231,6 +231,18 @@ var broadcast = function (k, hk, event) {
231
231
  var element = this;
232
232
  var handlers = element[hk];
233
233
  if (handlers.length > 1) handlers = handlers.slice();
234
+ if (event.which === 1 && event.buttons === 0) {
235
+ // firefox 无按键
236
+ Object.defineProperty(event, 'which', { value: 0 });
237
+ }
238
+ if (event.which === 1 && event.buttons === 2) {
239
+ // firefox 右键
240
+ Object.defineProperty(event, 'which', { value: 3 });
241
+ }
242
+ if (event.which === 1 && event.buttons === 4) {
243
+ // firefox 中键
244
+ Object.defineProperty(event, 'which', { value: 2 });
245
+ }
234
246
  for (var [eventtypes, handler, context] of handlers) {
235
247
  if (eventtypes.self && event.target !== element) continue;
236
248
  if (!checkKeyNeed(eventtypes, event)) continue;
@@ -1,15 +1,17 @@
1
1
  "use strict";
2
2
  var oncetree = {};
3
+ function emit(ontype, target, handler, firstmost) {
4
+ var off = ontype.call(this, target, function (event) {
5
+ off();
6
+ return handler.call(this, event);
7
+ }, firstmost);
8
+ return off;
9
+ }
3
10
  function _once(key) {
4
11
  if (oncetree[key]) return oncetree[key];
5
- return oncetree[key] = function (target, handler, firstmost) {
6
- var off = on(key).call(this, target, function (event) {
7
- off();
8
- return handler.call(this, event);
9
- }, firstmost);
10
- return off;
11
- };
12
+ return oncetree[key] = emit.bind(null, on(key));
12
13
  }
14
+ once.emit = emit;
13
15
  function once(key, target, handler, firstmost) {
14
16
  if (isFunction(handler) && isNode(target)) return _once(key).call(this, target, handler, firstmost);
15
17
  return _once(key);
@@ -4,7 +4,7 @@
4
4
  <btn class="prev" ng-click="prev()">
5
5
 
6
6
  </btn>
7
- <xlist elementid='pglist' ng-src="page in pages" ng-style="{width:fromPixel(40*pages.length)}">
7
+ <xlist #pglist ng-src="page in pages">
8
8
  <btn class="item">
9
9
  <span ng-bind=page></span>
10
10
  </btn>
@@ -1,5 +1,5 @@
1
1
  function main(element) {
2
- var page = element || div();
2
+ var page = element || document.createElement('pagination');
3
3
  page.innerHTML = pagination;
4
4
  render(page, {
5
5
  xlist: list,
@@ -7,26 +7,10 @@ function main(element) {
7
7
  fromPixel,
8
8
  pages: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
9
9
  next() {
10
- var index = this.pglist.index();
11
- index += 10;
12
- if (this.pages.length < index + 10) {
13
- index = this.pages.length - 10;
14
- }
15
- if (index < 0) {
16
- index = 0;
17
- }
18
- this.pglist.go(index);
10
+ this.pglist.scrollBy(this.pglist.clientWidth);
19
11
  },
20
12
  prev() {
21
- var index = this.pglist.index();
22
- index -= 10;
23
- if (this.pages.length < index + 10) {
24
- index = this.pages.length - 10;
25
- }
26
- if (index < 0) {
27
- index = 0;
28
- }
29
- this.pglist.go(index);
13
+ this.pglist.scrollBy(-this.pglist.clientWidth);
30
14
  },
31
15
  start() {
32
16
  this.pglist.go(0);
@@ -39,10 +23,11 @@ function main(element) {
39
23
  this.pglist.go(index);
40
24
  }
41
25
  });
42
-
43
- page.querySelector("xlist").go(0);
44
- once("append")(page, function () {
45
- console.log(page);
46
- })
26
+ var pglist = page.querySelector('xlist');
27
+ onmounted(page, function () {
28
+ console.log(pglist)
29
+ pglist.XScrollBoxId = 1;
30
+ pglist.go(0);
31
+ });
47
32
  return page;
48
33
  }
@@ -1,26 +1,41 @@
1
+ *{
2
+ box-sizing: border-box;
3
+ }
1
4
  & {
2
5
  white-space: nowrap;
6
+ display: block;
7
+ min-width: 240px;
8
+ width: 100%;
9
+ position: relative;
10
+ }
11
+
12
+ >xlist {
3
13
  display: inline-block;
14
+ text-overflow: clip;
15
+ text-align: center;
16
+ position: relative;
17
+ overflow: hidden;
18
+ vertical-align: top;
19
+ border-left: 72px solid transparent;
20
+ border-right: 72px solid transparent;
21
+ margin: 0 -72px 0 -72px;
4
22
 
5
- >xlist {
6
- width: auto;
7
- display: inline-block;
8
- text-overflow: clip;
9
- min-width: 40px;
10
- text-align: center;
11
- max-width: 400px;
12
- position: relative;
13
- overflow: hidden;
14
- vertical-align: top;
23
+ .button {
24
+ border-radius: 0;
15
25
  }
26
+ }
16
27
 
17
- btn {
18
- width: 40px;
19
- height: 40px;
20
- line-height: 40px;
21
- vertical-align: top;
22
- display: inline-block;
23
- background-color: inherit;
24
- color: inherit;
25
- }
28
+ btn.button {
29
+ box-shadow: none;
30
+ padding: 0 10px;
31
+ min-width: 36px;
32
+ height: 28px;
33
+ line-height: 28px;
34
+ color: #999;
35
+ margin: 0;
36
+ vertical-align: top;
37
+ display: inline-block;
38
+ background-color: inherit;
39
+ color: inherit;
40
+ z-index: 1;
26
41
  }
@@ -564,7 +564,17 @@ var createEmiter = function (on) {
564
564
  search[0] += `with(this.$parentScopes[${scopes.length}])`;
565
565
  getter1 = createGetter(search, false);
566
566
  }
567
- on(key)(this, function (e) {
567
+ var onkey;
568
+ if (key === 'mounted' || key === 'mount') {
569
+ onkey = on === once ? oncemount : onmounted;
570
+ }
571
+ else if (key === 'wheel' || key === 'mousewheel') {
572
+ onkey = on === once ? once.emit.bind(null, onmousewheel) : onmousewheel;
573
+ }
574
+ else {
575
+ onkey = on(key);
576
+ }
577
+ onkey(this, function (e) {
568
578
  digest();
569
579
  if (parsedSrc) {
570
580
  var target = e.currentTarget || e.target;
@@ -86,7 +86,7 @@ var scrollbary = function () {
86
86
  var run = function () {
87
87
  var thumbPosition = getScreenPosition(scroller.thumb);
88
88
  if (delta > 0 && thumbPosition.bottom - delta / 6 < scrollTimerTarget || delta < 0 && thumbPosition.top - delta / 6 > scrollTimerTarget) {
89
- var targetTop = scroller.Top() + delta;
89
+ var targetTop = scroller.$Top() + delta;
90
90
  var target = scroller.target;
91
91
  scroller.scrollTo(targetTop);
92
92
  if (target) setTargetTop(target, targetTop);
@@ -126,11 +126,11 @@ var scrollbary = function () {
126
126
 
127
127
 
128
128
  var setTargetTop = function (target, top) {
129
- if (target.Top instanceof Function) target.Top(top);
129
+ if (target.$Top instanceof Function) target.$Top(top);
130
130
  else target.scrollTop = top;
131
131
  };
132
132
  var getTargetTop = function (target) {
133
- if (target.Top instanceof Function) return target.Top();
133
+ if (target.$Top instanceof Function) return target.$Top();
134
134
  return target.scrollTop;
135
135
  };
136
136
 
@@ -152,7 +152,7 @@ var scrollbary = function () {
152
152
  _scrollbar.autoshow();
153
153
  });
154
154
  on("change")(_scrollbar, function () {
155
- var top = _scrollbar.Top();
155
+ var top = _scrollbar.$Top();
156
156
  setTargetTop(_container, top);
157
157
  });
158
158
  if (followResize) on("resize")(followResize, _scrollbar.reshape);
@@ -167,7 +167,7 @@ var scrollbary = function () {
167
167
  _scrollbar.scrollTo = scrollTo;
168
168
  var _handler = document.createElement("scrollbar-thumb");
169
169
  _handler.className = "thumb";
170
- _scrollbar.Top = getTop;
170
+ _scrollbar.$Top = getTop;
171
171
  _scrollbar.autohide = lazy(function () {
172
172
  this.thumb.style.opacity = 0;
173
173
  }, 600);
@@ -1,18 +1,32 @@
1
- <tbody -src="(d,i) in data" :style="tbodyHeight()">
2
- <tr thead #adapter insert>
3
- <td row-index>序号</td>
4
- <td -repeat="f in fields track by f.id" :style="{width:f.width}" @dblclick="sort(f)"><i -if="f.icon"
5
- -class="f.icon"></i></span><span -if="f.name" -html="f.name"></span>
1
+ <thead @mounted="setFixedColumn.call(this.parentNode)">
2
+ <tr inline-block #adapter thead @mounted="resizeT(this)">
3
+ <td fixed row-index>序号</td>
4
+ <td fixed:="f.fixed" -repeat="f in fields track by f.id" :style="{width:f.width}" @dblclick="sort(f)"><i
5
+ -if="f.icon" -class="f.icon"></i><span -if="f.name" -html="f.name"></span><template
6
+ -else>&nbsp;</template>
6
7
  </td>
7
8
  </tr>
8
- <tr>
9
- <td row-index -bind="i+1"></td>
10
- <td -repeat="f in fields">
11
- <model -if="f.key" :field=f :data=d readonly></model>
9
+ </thead>
10
+ <tbody -src="(d,i) in data" :style="tbodyHeight(this)">
11
+ <tr inline-block @mounted="this.style.width=adapter.style.width">
12
+ <td fixed row-index -bind="i+1" @mounted="this.style=adapter.firstChild.getAttribute('style')">
13
+ </td>
14
+ <td fixed:="f.fixed" -repeat="(f,i) in fields"
15
+ @mounted="this.style=adapter.children[i+1].getAttribute('style')">
16
+ <model -if="f.key&&!isEmpty(d[f.key])" :field=f :data=d readonly></model>
17
+ <template -else>&nbsp;</template>
12
18
  <a on-click="o.do(d)" -if="!f.key&&f.options&&(!o.when||o.when(d))"
13
19
  _type="o.type instanceof Function?o.type(d):o.type" -repeat="o in f.options">
14
20
  <span -text="o.name instanceof Function?o.name(d):o.name"></span>
15
21
  </a>
16
22
  </td>
17
23
  </tr>
18
- </tbody>
24
+ </tbody>
25
+ <tfoot>
26
+ <tr -if="!data||!data.length" style="padding-bottom: 20px;">
27
+ <td style="text-align: center;">
28
+ <template -if="data.is_loading">加载中</template>
29
+ <template -else>无数据</template>
30
+ </td>
31
+ </tr>
32
+ </tfoot>