efront 3.35.5 → 3.35.6

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.
@@ -309,6 +309,7 @@ function cross_(jsonp, digest = noop, method, url, headers) {
309
309
  };
310
310
  var fire = async function (code) {
311
311
  if (!~requests.indexOf(xhr)) return;
312
+ prepareHeaders();
312
313
  xhr.method = method;
313
314
  xhr.url = url;
314
315
  xhr.encrypt = code;
@@ -365,25 +366,28 @@ function cross_(jsonp, digest = noop, method, url, headers) {
365
366
  }
366
367
  var setRequestHeader = xhr.setRequestHeader;
367
368
  var realHeaders = Object.create(null);
368
- var cookie_ = this.hostCookie(xhr);
369
- var _cookies = cookie_.getCookies(originDomain);
370
- var _headers = {};
371
- if (_cookies) {
372
- _headers.Cookie = _cookies;
373
- }
374
- var cookobj = null;
375
- for (var k in headers) {
376
- if (/^\$/.test(headers[k])) {
377
- var k2 = headers[k].slice(1);
378
- if (!cookobj) cookobj = _cookies ? parseKV(_cookies, ';') : {};
379
- if (k2 in cookobj) {
380
- _headers[k] = cookobj[k2];
381
- }
369
+ var cookie_;
370
+ var prepareHeaders = () => {
371
+ cookie_ = this.hostCookie(xhr);
372
+ var _cookies = cookie_.getCookies(originDomain);
373
+ if (_cookies) {
374
+ _headers.Cookie = _cookies;
382
375
  }
383
- else {
384
- _headers[k] = headers[k];
376
+ var cookobj = null;
377
+ for (var k in headers) {
378
+ if (/^\$/.test(headers[k])) {
379
+ var k2 = headers[k].slice(1);
380
+ if (!cookobj) cookobj = _cookies ? parseKV(_cookies, ';') : {};
381
+ if (k2 in cookobj) {
382
+ _headers[k] = cookobj[k2];
383
+ }
384
+ }
385
+ else {
386
+ _headers[k] = headers[k];
387
+ }
385
388
  }
386
- }
389
+ };
390
+ var _headers = {};
387
391
  if (/^[mc]/i.test(method)) {
388
392
  _headers["User-Agent"] = /^m/i.test(method)
389
393
  ? "efront/3.25 (iPhone) Safari/602.1"
@@ -59,7 +59,8 @@ cross.setHost = function (host) {
59
59
  host = (/^https/.test(location_href) ? "https://" : "http://") + host;
60
60
  cross_.setHost(host);
61
61
  };
62
- cross.hostCookie = function () {
62
+ cross.hostCookie = function (xhr) {
63
+ if (xhr.cookie) return xhr.cookie;
63
64
  return cookie;
64
65
  };
65
66
  cross.getCookies = function (dp) {
@@ -33,9 +33,10 @@ function prompt() {
33
33
  };
34
34
  var buttons = [button("确认"), button("取消", 'white')];
35
35
  if (isFunction(check)) {
36
- var setDisable = function () {
36
+ var setDisable = function (event) {
37
+ if (oked || ohed) return;
37
38
  var valid = validate(ipt.value, check, tip);
38
- attr(body, "error", !valid);
39
+ if (event) attr(body, "error", !valid);
39
40
  attr(buttons[0], 'disabled', !valid);
40
41
  };
41
42
  on('keyup')(ipt, setDisable);
@@ -49,7 +50,7 @@ function prompt() {
49
50
  var c = confirm(msg, body, buttons, function (_) {
50
51
  if (oked || ohed) return;
51
52
  if (_ === buttons[0]) {
52
- if (check && validate(ipt.value, check, tip)) return false;
53
+ if (check && !validate(ipt.value, check, tip)) return false;
53
54
  oked = true;
54
55
  } else {
55
56
  ohed = true;
@@ -65,11 +66,8 @@ function prompt() {
65
66
  on("mousedown")(c, e => e.target !== ipt && e.preventDefault() | ipt.focus());
66
67
  on("keydown.enter")(c, function (event) {
67
68
  if (event.defaultPrevented) return;
68
- if (check && check(ipt.value) === false) return;
69
69
  event.preventDefault();
70
- oked = true;
71
- remove(c);
72
- fire();
70
+ buttons[0].click();
73
71
  });
74
72
  c.then = function (ok, oh) {
75
73
  oks.push(ok);
@@ -170,9 +170,10 @@ function main() {
170
170
  switch (target) {
171
171
  case this.children[0]:
172
172
  var a = prompt("请输入", a => {
173
+ if (!a) return false;
174
+ console.log(itemMap, a);
173
175
  if (a in itemMap) {
174
- alert(`选项 ${a} 已存在!`);
175
- return false;
176
+ return `选项 ${a} 已存在!`;
176
177
  }
177
178
  });
178
179
  page.with = a;
@@ -192,6 +193,7 @@ function main() {
192
193
  var edit = selectListEdit(options.slice(0));
193
194
  page.with = edit;
194
195
  on("remove")(edit, function () {
196
+ itemMap = Object.create(null);
195
197
  page.with = null;
196
198
  children.splice(0, children.length);
197
199
  children.push.apply(children, edit.$scope.options.map(o => ({ key: o.key || o.value, name: o.name || o.innerHTML })))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.35.5",
3
+ "version": "3.35.6",
4
4
  "description": "简化前端开发,优化web性能",
5
5
  "main": "public/efront.js",
6
6
  "directories": {