efront 4.36.2 → 4.36.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.
@@ -0,0 +1,69 @@
1
+ <todo>
2
+ <div .id>
3
+ <span -bind="m.id"></span>
4
+ </div>
5
+ <div .detail>
6
+ <span -bind="m.name"></span>
7
+ <span -bind="states[m.state]"></span>
8
+ </div>
9
+ <div .circle -bind="index"></div>
10
+ </todo>
11
+ <style>
12
+ .circle {
13
+ border-radius: 50%;
14
+ width: 32px;
15
+ height: 32px;
16
+ font-size: 16px;
17
+ line-height: 24px;
18
+ text-align: center;
19
+ position: absolute;
20
+ display: block;
21
+ left: -6px;
22
+ top: 6px;
23
+ border: 4px double;
24
+ }
25
+
26
+ .id {
27
+ size: 0;
28
+ font-size: 12px;
29
+ color: #666;
30
+ padding-left: 32px;
31
+ }
32
+
33
+ & {
34
+ padding: 4px 12px 4px 0px;
35
+ display: block;
36
+ color: #ccc;
37
+ border: 1px solid;
38
+ border-left: 6px solid;
39
+ position: relative;
40
+ background: #fff;
41
+ margin: 0 0 10px 0;
42
+ }
43
+
44
+ .detail {
45
+ color: #000;
46
+ text-indent: 32px;
47
+ }
48
+
49
+ &.new {
50
+ color: #629;
51
+ }
52
+
53
+ &.ing {
54
+ color: #263;
55
+ }
56
+
57
+ &.done {
58
+ color: #26c;
59
+ }
60
+ </style>
61
+ <script>
62
+ var m = {};
63
+ var index;
64
+ var states = [];
65
+ care(this, function ([a, i]) {
66
+ m = a;
67
+ index = +i + 1;
68
+ });
69
+ </script>
@@ -1,12 +1,12 @@
1
1
  var cross = cross_.bind(function (callback, onerror) {
2
2
  var response, responseObject, responseType = "", decoder, error;
3
+ var headers = {};
4
+ var http = null;
3
5
  var xhr = {
4
6
  status: 0,
5
7
  readyState: 0,
6
8
  method: null,
7
9
  url: null,
8
- http: null,
9
- headers: {},
10
10
  responseHeaders: {},
11
11
  get response() {
12
12
  if (responseType === "" || responseType === "text") {
@@ -42,7 +42,7 @@ var cross = cross_.bind(function (callback, onerror) {
42
42
  if (data instanceof FormData) data = String(data);
43
43
  if (data) {
44
44
  data = Buffer.from(data);
45
- this.headers["Content-Length"] = data.length;
45
+ headers["Content-Length"] = data.length;
46
46
  }
47
47
  if (/^\[/.test(hostname)) hostname = hostname.replace(/^\[(.*?)\]$/, "$1");
48
48
  var options = {
@@ -51,14 +51,14 @@ var cross = cross_.bind(function (callback, onerror) {
51
51
  port,
52
52
  path,
53
53
  auth,
54
- headers: this.headers,
54
+ headers: headers,
55
55
  };
56
56
  var onerror1 = function (e) {
57
57
  xhr.readyState = 4;
58
58
  error = e;
59
59
  onerror(e);
60
60
  };
61
- var req = this.http.request(options, function (res) {
61
+ var req = http.request(options, (res) => {
62
62
  var data = [];
63
63
  xhr.status = res.statusCode;
64
64
  xhr.responseHeaders = res.headers;
@@ -76,11 +76,12 @@ var cross = cross_.bind(function (callback, onerror) {
76
76
  this.readyState = 1;
77
77
  req.on("error", onerror1);
78
78
  req.on("timeout", onerror1);
79
- req.setTimeout(3000);
79
+ req.setTimeout(120000);
80
80
  if (data) req.end(data);
81
81
  else req.end();
82
82
  },
83
83
  open(method, url) {
84
+ if (http) throw new Error('请不要重新打开!');
84
85
  this.method = method;
85
86
  this.url = url;
86
87
  this.status = 0;
@@ -88,14 +89,12 @@ var cross = cross_.bind(function (callback, onerror) {
88
89
  response = null;
89
90
  responseObject = null;
90
91
  error = null;
91
- var http;
92
92
  if (/^http\:/i.test(url)) {
93
93
  http = require("http");
94
94
  }
95
95
  else {
96
96
  http = require("https");
97
97
  }
98
- this.http = http;
99
98
  },
100
99
  get responseType() {
101
100
  return responseType;
@@ -106,7 +105,7 @@ var cross = cross_.bind(function (callback, onerror) {
106
105
  responseType = v;
107
106
  },
108
107
  setRequestHeader(key, value) {
109
- this.headers[key] = value;
108
+ headers[key] = value;
110
109
  },
111
110
  overrideMimeType(type) {
112
111
  responseType = type;
@@ -1,5 +1,4 @@
1
1
  var global1 = typeof globalThis !== 'undefined' ? globalThis : typeof global !== "undefined" ? global : {};
2
- var extendIfNeeded = require("../basic/extendIfNeeded");
3
2
  if (global1.window) {
4
3
  module.exports = global1.window;
5
4
  }
@@ -93,13 +93,12 @@ var bindTarget = function (index, element) {
93
93
  return value;
94
94
  };
95
95
 
96
- var hooka = function (matcher, move, event, targetChild, isMovingSource) {
96
+ var hooka = function (matcher, move, event, targetChild, isMovingSource, hideSource = isMovingSource !== false) {
97
97
  var boxfinder;
98
98
  var isMovingSource = isMovingSource !== false;
99
99
  if (isMovingSource === false) boxfinder = matcher, matcher = null;
100
100
  var that = this;
101
-
102
- var draggingSourceOpacity = isMovingSource !== false ? 0 : 1;
101
+ var draggingSourceOpacity = hideSource ? 0 : 1;
103
102
 
104
103
  var recover = function (element) {
105
104
  moveMargin(element, 0);
@@ -151,7 +150,7 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
151
150
  if (event.target === this) return;
152
151
  // var targetChild = getTargetIn(matcher, event.target);
153
152
  if (!targetChild) return;
154
- drag(targetChild, event, false, isMovingSource);
153
+ drag(targetChild, event, false, hideSource);
155
154
  if (isArray(targetChild)) {
156
155
  targetChild = targetChild[0];
157
156
  }
@@ -169,7 +168,8 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
169
168
  rebuildTargets = function () { };
170
169
  [moveMargin, moveChildren, scroll] = getMoveFuncs(targetChild);
171
170
  moveChildren = moveChildren.bind(null, that, previousElements, followedElements, moveMargin, recover);
172
- } else {
171
+ }
172
+ else {
173
173
  previousElements = [];
174
174
  followedElements = [];
175
175
  moveChildren = () => { };
@@ -354,10 +354,10 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
354
354
  e.style.zIndex = zIndex;
355
355
  var z = zIndex - 1;
356
356
  var ws = e.with;
357
- if (ws){
357
+ if (ws) {
358
358
  if (isNode(ws)) ws = [ws];
359
359
  for (var w of ws) w.style.zIndex = z;
360
- }
360
+ }
361
361
  };
362
362
  if (zIndex > 2) {
363
363
  previousElements.forEach(copyZIndex);
@@ -412,7 +412,7 @@ var hookEvent = function (matcher, move, event) {
412
412
  if (event.target === this) return;
413
413
  var targetChild = getTargetIn(matcher, event.target, false);
414
414
  if (!targetChild) return;
415
- hooka.call(this, matcher, move, event, targetChild);
415
+ hooka.call(this, matcher, move, event, targetChild, true, true);
416
416
  };
417
417
  function addhook() {
418
418
  var mousedownEvent, targetElement, callback, boxfinder, dropid, allowdrops;
@@ -440,6 +440,9 @@ function addhook() {
440
440
  }
441
441
  if (arg !== null) mousedownEvent = arg;
442
442
  break;
443
+ case "boolean":
444
+ dropSource = arg;
445
+ break;
443
446
  }
444
447
  });
445
448
  if (!targetElement && isElement(this)) {
@@ -447,22 +450,27 @@ function addhook() {
447
450
  }
448
451
  if (!mousedownEvent) return;
449
452
  var target = targetElement || mousedownEvent.currentTarget;
453
+ var dropSource = target && target.parentNode?.hasAttribute('allowdrop');
450
454
  hooka.call(targetElement, function () {
451
455
  var target = drag.shadow;
452
- var res = Array.prototype.filter.call(allowdrops || (boxfinder ? boxfinder(target) : document.querySelectorAll("[allowdrop]")), function (child) {
453
- return target && overlap(child, target);
456
+ if (!allowdrops) allowdrops = [...boxfinder ? boxfinder(target) : document.querySelectorAll("[allowdrop]")];
457
+ var ols = new WeakMap;
458
+ var res = allowdrops.filter(function (child, i) {
459
+ var o = target && overlap(child, target);
460
+ ols.set(child, o);
461
+ return o > 0;
454
462
  }).filter(e => {
455
463
  var a = e.getAttribute("allowdrop");
456
464
  if (!a || !dropid) return true;
457
465
  return a === dropid;
458
- });
466
+ }).sort((a, b) => ols.get(a) - ols.get(b));
459
467
  if (res instanceof Array) {
460
468
  return res[res.length - 1];
461
469
  }
462
470
  return res;
463
471
  }, function (_, dst, _a, _b, parentNode) {
464
472
  if (isFunction(callback) && parentNode) callback(dst, parentNode);
465
- }, mousedownEvent, target, false);
473
+ }, mousedownEvent, target, false, dropSource);
466
474
  }
467
475
  function autodragchildren(target, matcher, move) {
468
476
  onmousedown(target, hookEvent.bind(target, matcher, move));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.36.2",
3
+ "version": "4.36.3",
4
4
  "description": "一个开发环境,提供一种自由的前端开发模式,也可作为辅助工具使用。",
5
5
  "main": "public/efront.js",
6
6
  "directories": {