efront 3.21.5 → 3.22.3

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.
@@ -5,12 +5,15 @@
5
5
  var id = params.out_trade_no;
6
6
 
7
7
  var data = await _runtask("couchdb", "get", `alipay-log/${id}`);
8
- await _runtask("couchdb", "put", `alipay-log/${id}?_rev=${data._rev}`, extend(data, {
8
+ extend(data, {
9
9
  alipay_trade_no: params.trade_no,
10
10
  seller_id: params.seller_id,
11
11
  return_amount: params.total_amount,
12
- return_time: new Date().toISOString(),
13
- }));
12
+ trade_status: params.trade_status
13
+ });
14
+ if (req.headers["user-agent"]) data.return_time = new Date().toISOString();
15
+ else data.notify_time = new Date().toISOString();
16
+ await _runtask("couchdb", "put", `alipay-log/${id}?_rev=${data._rev}`, data);
14
17
  context.id = params.out_trade_no;
15
18
  </script>
16
19
  <script>
@@ -18,6 +21,6 @@
18
21
  if (id) parent.postMessage(id);
19
22
  </script>
20
23
  <script serverside>
21
- if(context.id)return `<body style="color:green">支付完成</body>`;
24
+ if (context.id) return `<body style="color:green">支付完成</body>`;
22
25
  else return `<body style="color:red">支付失败</body>`
23
- </script>
26
+ </script>
@@ -0,0 +1,15 @@
1
+ <script serverside>
2
+ var time = Date.now();
3
+ var out_trade_no = encode62.timedecode(request.id);
4
+ var payed = /^(TRADE_FINISHED|TRADE_SUCCESS)$/i;
5
+ for (var cx = 0, dx = 10; cx < dx; cx++) {
6
+ if (Date.now() - time > 30000) return;
7
+ var data = await _runtask("couchdb", 'get', `alipay-log/${out_trade_no}`);
8
+ if (data.return_time || data.notify_time || payed.test(data.trade_status)) return JSON.stringify(data);
9
+ var data1 = await _runtask("alipay-query", out_trade_no);
10
+ if (payed.test(data1.trade_status)) {
11
+ return JSON.stringify(Object.assign(data, { trade_status: data1.trade_status }));
12
+ }
13
+ await new Promise(ok => setTimeout(ok, 300));
14
+ }
15
+ </script>
@@ -50,18 +50,13 @@ ACQ.MERCHANT_PERM_RECEIPT_DAY_LIMIT 超过单日累计收款额度 联系支付
50
50
  if (a < 10) return "0" + a;
51
51
  return a;
52
52
  }
53
- var now = new Date();
54
- function createStamp(now) {
55
- var d = now;
56
- return [d.getFullYear(), d.getMonth() + 1, d.getDate()].map(pad).join("-") +
57
- " " + [d.getHours(), d.getMinutes(), d.getSeconds()].map(pad).join(":");
58
- }
59
53
  var amount = request.id;
60
54
  if (!/^(\d+)(\.\d+)?$/.test(amount)) amount = encode62.timedecode(request.id);
61
55
  var [amount, subject = '网页扫码支付'] = amount.split(',');
56
+ var trade_no = createId();
62
57
  if (!+amount) return forbidden("参数异常");
63
58
  var biz_content = {
64
- out_trade_no: "alipay-" + createId(),
59
+ out_trade_no: "alipay-" + trade_no,
65
60
  product_code: 'FAST_INSTANT_TRADE_PAY',
66
61
  total_amount: amount,
67
62
  qr_pay_mode: 4,
@@ -70,15 +65,15 @@ ACQ.MERCHANT_PERM_RECEIPT_DAY_LIMIT 超过单日累计收款额度 联系支付
70
65
  body: subject,
71
66
  };
72
67
  var params = {
73
- timestamp: createStamp(now),
74
68
  method: "alipay.trade.page.pay",
75
69
  app_id: "2021002143612677",
76
70
  sign_type: "RSA2",
77
71
  version: "1.0",
78
72
  charset: "utf-8",
79
- return_url: `${req.protocol}//${req.headers.host}${req.url.replace(/[\.\:][\s\S]*$/, '')}-callback`,
73
+ return_url: `${req.protocol}//${req.headers[":authority"] || req.headers.host}${req.url.replace(/[\.\:][\s\S]*$/, '')}-callback`,
80
74
  biz_content: JSON.stringify(biz_content)
81
75
  };
76
+ params.notify_url = params.return_url;
82
77
  await _runtask("alipay-sign", params);
83
78
 
84
79
  var log = await _runtask("couchdb", "put", "alipay-log/" + biz_content.out_trade_no, {
@@ -89,11 +84,13 @@ ACQ.MERCHANT_PERM_RECEIPT_DAY_LIMIT 超过单日累计收款额度 联系支付
89
84
  subject: biz_content.subject,
90
85
  body: biz_content.body,
91
86
  timestamp: params.timestamp,
92
- create_time: now.toISOString(),
87
+ create_time: new Date().toISOString(),
93
88
  return_url: biz_content.return_url
94
89
  });
95
- res.writeHead(302, {
96
- Location: "https://openapi.alipay.com/gateway.do?" + serialize(params)
97
- });
98
- res.end();
90
+ context.id = biz_content.out_trade_no;
91
+ context.location = "https://openapi.alipay.com/gateway.do?" + serialize(params);
92
+ </script>
93
+ <script>
94
+ parent.postMessage(<%JSON.stringify(context.id)%>);
95
+ location.href = <%JSON.stringify(context.location)%>;
99
96
  </script>
@@ -1,13 +1,14 @@
1
1
  var pay = frame$payment([
2
2
  {
3
3
  url: './alipay:',
4
+ query: './alipay-query:',
4
5
  name: '支付宝',
5
6
  icon: 'alipay.ico',
6
7
  cost(price) {
7
8
  return BigNumber.prd((0.6036218 + 0.204081632) / 100, price);
8
9
  },
9
10
  }
10
- ], 1.00, '支付宝支付测试');
11
+ ], 0.01, '支付宝支付测试');
11
12
  popup(pay, true);
12
13
  console.log(pay)
13
14
  care(pay, 'payment', function (a) {
@@ -46,7 +46,9 @@ var fixde = function (numstr, fractionDigits, compare) {
46
46
  }
47
47
  var res = s1 + s2;
48
48
  if (frag) {
49
+ var res_length = res.length;
49
50
  res = BigNumber.add(res, 1);
51
+ if (res.length < res_length) res = repeat0(res_length - res.length) + res;
50
52
  }
51
53
  if (fractionDigits > 0) res = res.slice(0, res.length - fractionDigits) + '.' + res.slice(res.length - fractionDigits);
52
54
  if (/^\./.test(res)) res = "0" + res;
@@ -70,10 +72,10 @@ class BigNumber {
70
72
  return fixde(numstr, 0, 4);
71
73
  }
72
74
  static ceil(numstr) {
73
- return fixde(numstr, 0, 0);
75
+ return fixde(numstr, 0, /^\-/.test(numstr) ? 9 : 0);
74
76
  }
75
77
  static floor(numstr) {
76
- return fixde(numstr, 0, 9);
78
+ return fixde(numstr, 0, /^\-/.test(numstr) ? 0 : 9);
77
79
  }
78
80
  static fix(numstr, fractionDigits) {
79
81
  fractionDigits = +fractionDigits || 0;
@@ -181,4 +183,24 @@ class BigNumber {
181
183
  res = res.reverse().join('');
182
184
  return fixme(neg1 ^ neg2, res, d);
183
185
  }
186
+ static sub(numstr1, numstr2) {
187
+ numstr2 = trim(numstr2);
188
+ if (/^\-/.test(numstr2)) numstr2 = numstr2.slice(1);
189
+ else numstr2 = '-' + numstr2;
190
+ return BigNumber.add(numstr1, numstr2);
191
+ }
192
+ // 按整数除法,超出输入的数字的位数之和
193
+ static div(numstr1, numstr2, decimal) {
194
+ if (isEmpty(decimal)) throw new Error("请输入保留小数的位数!");
195
+ var [neg1, s11, s12] = prepare(numstr1);
196
+ var [neg2, s21, s22] = prepare(numstr2);
197
+ var d = s12.length - s22.length;
198
+ numstr1 = s11 + s12;
199
+ numstr2 = s21 + s22;
200
+
201
+ if (d < 0) {
202
+ numstr2 += repeat0(0, -d);
203
+ }
204
+ numstr1 += repeat0(0);
205
+ }
184
206
  }
@@ -38,14 +38,20 @@ assert(BigNumber.fix(2.235, 2), '2.24');
38
38
  assert(BigNumber.fix(2.234, 2), '2.23');
39
39
  assert(BigNumber.fix(2.2351, 2), '2.24');
40
40
  assert(BigNumber.fix(2.2349, 2), '2.23');
41
+ assert(BigNumber.fix(0.00807703432, 2), '0.01');
41
42
  assert(BigNumber.round(2.2349), '2');
42
43
  assert(BigNumber.round(2.4999), '2');
43
44
  assert(BigNumber.round(2.5000), '3');
45
+ assert(BigNumber.round(-2.5000), '-3');
44
46
  assert(BigNumber.round(2.5100), '3');
45
47
  assert(BigNumber.ceil(2.5100), '3');
48
+ assert(BigNumber.ceil(-2.5100), '-2');
46
49
  assert(BigNumber.ceil(2.000), '2');
50
+ assert(BigNumber.ceil(-2.000), '-2');
47
51
  assert(BigNumber.floor(2.000), '2');
52
+ assert(BigNumber.floor(-2.000), '-2');
48
53
  assert(BigNumber.floor(2.999), '2');
54
+ assert(BigNumber.floor(-2.999), '-3');
49
55
  assert(BigNumber.ceil(2.001), '3');
50
56
  assert(BigNumber.ceil(2.999), '3');
51
57
  assert(BigNumber.fix("9007199254740992.234", 6), '9007199254740992.234000');
@@ -78,6 +78,6 @@ if (!function () { }.bind) Function.prototype.bind = function (context) {
78
78
  return function () {
79
79
  var _args = args.slice.call(arguments, 0, arguments.length);
80
80
  args.unshift.apply(_args, args);
81
- return this.apply(context, _args);
81
+ return this.apply(context === void 0 || context === null ? this : context, _args);
82
82
  };
83
83
  };
@@ -287,6 +287,17 @@ class Program extends Array {
287
287
  }
288
288
  }
289
289
 
290
+ var isShortMethodEnd = function (o) {
291
+ if (!o) return false;
292
+ if (o.type !== SCOPED || o.entry !== "{") return false;
293
+ o = o.prev;
294
+ if (!o) return false;
295
+ if (o.type !== SCOPED || o.entry !== "(") return false;
296
+ o = o.prev;
297
+ if (!o) return false;
298
+ return o.type === PROPERTY;
299
+ };
300
+
290
301
  class Javascript {
291
302
  quotes = [
292
303
  [/'/, /'/, /\\[\s\S]/],
@@ -354,7 +365,7 @@ class Javascript {
354
365
  if (queue.isClass) scope.isprop = !last || last.isprop || last.type === STAMP && last.text === ';';
355
366
  }
356
367
  else if (scope.type === STAMP) {
357
- scope.isprop = scope.text === "*" && isProperty();
368
+ scope.isprop = scope.text === "*" && (!queue.lastUncomment || /^[,;]$/.test(queue.lastUncomment.text) || queue.isClass && isShortMethodEnd(queue.lastUncomment));
358
369
  }
359
370
  else if (scope.type === PROPERTY) {
360
371
  scope.isprop = true;
@@ -4,22 +4,24 @@ btn {
4
4
 
5
5
  & {
6
6
  height: 100%;
7
- overflow: auto;
8
7
  }
9
8
 
10
9
  table {
11
10
 
12
11
  td {
13
12
 
14
- >span,
15
- >model {
16
- white-space: normal;
13
+ >[type=text] {
14
+ white-space: pre-wrap;
17
15
  word-break: break-all;
18
16
  overflow: hidden;
19
17
  display: -webkit-box;
20
18
  -webkit-line-clamp: 2;
21
19
  -webkit-box-orient: vertical;
20
+ line-height: 16px;
21
+ font-size: 10px;
22
22
  text-overflow: ellipsis;
23
+ color: #666;
24
+ height: 32px;
23
25
  }
24
26
  }
25
27
  }
@@ -36,13 +36,25 @@ function main(paytypes, price, subject = '网站扫码支付') {
36
36
  });
37
37
  drag.on(page.firstChild, page);
38
38
  resize.on(page);
39
- data.bindInstance("paytype", function (type) {
40
- console.log(type)
41
- });
42
39
  var frame = page.querySelector("iframe");
40
+ var tradeid;
43
41
  bind("message")(frame, function (e) {
44
- var id = e.data;
45
- cast(page, 'payment', id);
42
+ if (tradeid === e.data && !queryres) cast(page, 'payment', tradeid), queryres = tradeid;
43
+ else tradeid = e.data, queryres = null;
44
+ });
45
+ var queryurl, queryres;
46
+ data.bindInstance("paytype", function ({ value }) {
47
+ var type = paytypes[value - 1];
48
+ queryurl = type && type.query;
46
49
  });
50
+ var query = lazy(async function () {
51
+ if (!tradeid || queryres) return;
52
+ if (isFunction(queryurl)) var res = await queryurl(tradeid);
53
+ else if (isString(queryurl)) var res = await cross('get', queryurl + encode62.timeencode(tradeid)), res = JSAM.parse(res.response || res.responseText);
54
+ if (queryres) return;
55
+ if (res) queryres = res, cast(page, 'payment', res._id);
56
+ }, -200);
57
+ on('load')(frame, query);
58
+ on('remove')(frame, query);
47
59
  return page;
48
60
  }
@@ -44,14 +44,15 @@ return cross_.bind(function (callback, onerror) {
44
44
  data = Buffer.from(data);
45
45
  this.headers["Content-Length"] = data.length;
46
46
  }
47
- var req = http.request({
47
+ var options = {
48
48
  method: this.method,
49
49
  hostname,
50
50
  port,
51
51
  path,
52
52
  auth,
53
53
  headers: this.headers,
54
- }, function (res) {
54
+ };
55
+ var req = this.http.request(options, function (res) {
55
56
  var data = [];
56
57
  xhr.status = res.statusCode;
57
58
  xhr.responseHeaders = res.headers;
@@ -72,6 +73,7 @@ return cross_.bind(function (callback, onerror) {
72
73
  this.readyState = 2;
73
74
  });
74
75
  this.readyState = 1;
76
+ req.setTimeout(3000);
75
77
  if (data) req.end(data);
76
78
  else req.end();
77
79
  },
@@ -84,7 +86,7 @@ return cross_.bind(function (callback, onerror) {
84
86
  responseObject = null;
85
87
  error = null;
86
88
  var http;
87
- if (/^https?\:/i.test(url)) {
89
+ if (/^http\:/i.test(url)) {
88
90
  http = require("http");
89
91
  }
90
92
  else {
@@ -1,7 +1,6 @@
1
1
  var moveMarginX = function moveMarginX(element, movePixels) {
2
2
  if (element.moved === movePixels) return;
3
3
  element.moved = movePixels;
4
- element.moving = new Date;
5
4
  css(element, {
6
5
  transition: movePixels !== false ? "margin .1s" : '',
7
6
  userSelect: "none",
@@ -21,25 +20,24 @@ var moveChildrenX = function (targetBox, previousElements, followedElements, mov
21
20
  if (area > 0) {
22
21
  var dragPosition = getScreenPosition(dragTarget);
23
22
  var dragPositionLeft = dragPosition.left;
24
- var currentTime = new Date;
23
+ var dragPositionRight = dragPosition.left + dragPosition.width;
25
24
  previousElements.map(function (element) {
26
- if (currentTime - element.moving < 100) return;
27
25
  var elementPosition = getScreenPosition(element);
28
26
  var elementCenter = elementPosition.left + elementPosition.width / 2;
29
- if (elementCenter - (element.moved || 0) <= dragPositionLeft) {
27
+ var delta = elementCenter - (element.moved || 0);
28
+ if (delta + 7 <= dragPositionLeft) {
30
29
  recover(element);
31
- } else {
30
+ } else if (delta - 7 >= dragPositionLeft) {
32
31
  moveMargin(element, dragPosition.width);
33
32
  }
34
33
  });
35
- var dragPositionRight = dragPosition.left + dragPosition.width;
36
34
  followedElements.map(function (element) {
37
- if (currentTime - element.moving < 100) return;
38
35
  var elementPosition = getScreenPosition(element);
39
36
  var elementCenter = elementPosition.left + elementPosition.width / 2;
40
- if (elementCenter - (element.moved || 0) <= dragPositionRight) {
37
+ var delta = elementCenter - (element.moved || 0);
38
+ if (delta + 6 <= dragPositionRight) {
41
39
  moveMargin(element, -dragPosition.width);
42
- } else {
40
+ } else if (delta - 6 >= dragPositionRight) {
43
41
  recover(element);
44
42
  }
45
43
  });
@@ -131,6 +129,18 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
131
129
  }
132
130
  return targets;
133
131
  };
132
+ var getBoundingClientRect = function () { return getScreenPosition(this.target) }
133
+ var bindExtra = function (element) {
134
+ var targets = getTargetIn(matcher, element, false);
135
+ if (isArray(targets)) {
136
+ var [target] = targets;
137
+ return {
138
+ style: target.style, target, getBoundingClientRect,
139
+ with: targets
140
+ };
141
+ }
142
+ return targets;
143
+ };
134
144
  if (event.target === this) return;
135
145
  // var targetChild = getTargetIn(matcher, event.target);
136
146
  if (!targetChild) return;
@@ -241,10 +251,10 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
241
251
  clearInterval(autoScroll.ing);
242
252
  autoScroll.ing = 0;
243
253
  };
244
- var dragmove = function (event) {
254
+ var dragmove = lazy(function (event) {
245
255
  rebuildTargets();
246
256
  moveChildren.call(this, event);
247
- };
257
+ }, -100);
248
258
 
249
259
  // 修改margin无效的情况
250
260
  function dragclone() {
@@ -278,6 +288,12 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
278
288
  function draglist() {
279
289
  draginit();
280
290
  rebuildTargets();
291
+ var _previousElements = previousElements.map(bindExtra);
292
+ var _followedElements = followedElements.map(bindExtra);
293
+ previousElements.splice(0, previousElements.length);
294
+ followedElements.splice(0, followedElements.length);
295
+ previousElements.push.apply(previousElements, _previousElements);
296
+ followedElements.push.apply(followedElements, _followedElements);
281
297
  autoScroll();
282
298
  var offall = function () {
283
299
  cancelScroll();
@@ -287,8 +303,8 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
287
303
  var offdragend = on("dragend")(targetChild, function () {
288
304
  offall();
289
305
  dragfire();
290
- previousElements.map(e => moveMargin(e, false));
291
- followedElements.map(e => moveMargin(e, false));
306
+ previousElements.forEach(e => moveMargin(e, false));
307
+ followedElements.forEach(e => moveMargin(e, false));
292
308
  });
293
309
  var offdragmove = on("dragmove")(targetChild, dragmove);
294
310
  }
@@ -55,7 +55,7 @@ function gallery(element, minWidth, generator) {
55
55
  var e = generator(realindex);
56
56
  return e;
57
57
  });
58
- _box.stopY = noop;
58
+ _box.$stopY = noop;
59
59
  _box.delta = id;
60
60
  setWidth(_box);
61
61
  return _box;
@@ -2,6 +2,9 @@
2
2
  var _slider = createElement(div);
3
3
  var getGenerator = function (container, tagName = 'item') {
4
4
  if (!container) return;
5
+ var scopes = container.$parentScopes || [];
6
+ if (container.$scope) scopes = scopes.concat(container.$scope);
7
+ container.$generatorScopes = scopes;
5
8
  if (container.$generator) return container.$generator;
6
9
  var template = document.createElement(tagName);
7
10
  var templates = [].concat.apply([], container.childNodes).filter(a => {
@@ -21,8 +24,6 @@ var getGenerator = function (container, tagName = 'item') {
21
24
  appendChild(template, templates);
22
25
  container.insertBefore = _slider.insertBefore;
23
26
  container.appendChild = _slider.appendChild;
24
- var scopes = container.$parentScopes || [];
25
- if (container.$scope) scopes = scopes.concat(container.$scope);
26
27
  return container.$generator = function (index, com, element) {
27
28
  if (com === undefined) {
28
29
  if (!container.src || index >= container.src.length) return;
@@ -39,6 +40,7 @@ var getGenerator = function (container, tagName = 'item') {
39
40
  if (template1.childNodes.length > 1) element.with = [].concat.apply([], template1.childNodes).slice(1);
40
41
  }
41
42
  }
43
+ var scopes = container.$generatorScopes;
42
44
  var parsedSrc = container.$src;
43
45
  if (parsedSrc) {
44
46
  var { keyName, itemName, indexName } = parsedSrc;
@@ -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
  }