efront 3.12.2 → 3.12.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.
@@ -1,11 +1,11 @@
1
1
  // 激活 自定义的 active 事件
2
- function active(target, value, item, targetElement) {
2
+ function active(target, value, item = value, srcElem) {
3
3
  var activeEvent = createEvent("active");
4
4
  activeEvent.item = item;
5
5
  activeEvent.value = value;
6
- if (targetElement) {
7
- if (Object.defineProperty) Object.defineProperty(activeEvent, 'currentTarget', { value: targetElement });
8
- else activeEvent.currentTarget = targetElement;
6
+ if (srcElem) {
7
+ if (Object.defineProperty) Object.defineProperty(activeEvent, 'currentTarget', { value: srcElem });
8
+ else activeEvent.currentTarget = srcElem;
9
9
  }
10
10
  activeEvent = dispatch(target, activeEvent);
11
11
  return activeEvent && !activeEvent.defaultPrevented;
@@ -16,7 +16,25 @@ var active = function () {
16
16
  __addClass(this, "hover active");
17
17
  };
18
18
  var checkclick = function () {
19
- if (this.hasAttribute("disabled") || this.disabled || this.hasAttribute("loading") || this.loading || this.hasAttribute("pending") || this.pending) onclick.preventClick = true;
19
+ if (this.hasAttribute("disabled") || this.disabled || this.hasAttribute("loading") || this.loading || this.hasAttribute("pending") || this.pending) {
20
+ onclick.preventClick = true;
21
+ return;
22
+ }
23
+ if (this.hasAttribute("confirm") || this.confirm) {
24
+ if (!this.confirm_sign) {
25
+ addClass(this, 'confirm');
26
+ var that = this;
27
+ that.confirm_sign = true;
28
+ setTimeout(function () {
29
+ removeClass(that, "confirm");
30
+ delete that.confirm_sign;
31
+ }, 2000);
32
+ onclick.preventClick = true;
33
+ return;
34
+ }
35
+ delete this.confirm_sign;
36
+ removeClass(this, "confirm");
37
+ }
20
38
  };
21
39
  var resetactive = function () {
22
40
  removeClass(this, "active");
@@ -259,4 +259,11 @@ a&,
259
259
  }
260
260
 
261
261
  text-shadow: none;
262
+ }
263
+
264
+ &.confirm {
265
+ &:before {
266
+ content: "确认";
267
+ }
268
+ background: #333;
262
269
  }
@@ -27,6 +27,8 @@ function chooseFile(accept, multiple, extra) {
27
27
  }
28
28
  });
29
29
  });
30
- input.click();
30
+ setTimeout(function(){
31
+ input.click();
32
+ });
31
33
  return result;
32
34
  }
@@ -29,7 +29,9 @@ var encode62 = {
29
29
  timeencode(string) {
30
30
  var { time_delta } = this;
31
31
  var time_free = time_delta / 6 | 0;
32
- var time_stamp = +new Date() - time_free;
32
+ var time = +new Date;
33
+ time = time - time % (time_delta >> 2);
34
+ var time_stamp = time - time_free;
33
35
  var time_rest = time_stamp % time_delta;
34
36
  var time_rest_str = time_rest.toString(36);
35
37
  var time_delta_str = time_delta.toString(36);
@@ -39,9 +41,10 @@ var encode62 = {
39
41
  timeupdate(string) {
40
42
  var { time_delta } = this;
41
43
  var time_rest = string.slice(string.length - time_delta.toString(36).length, string.length);
42
- var time_start = parseInt((new Date() - parseInt(time_rest, 36)) / time_delta) * time_delta;
44
+ var time = +new Date;
45
+ var time_start = parseInt((time - parseInt(time_rest, 36)) / time_delta) * time_delta;
43
46
  var time_stamp = time_start + parseInt(time_rest, 36);
44
- if (time_stamp + (time_delta >> 1) > +new Date()) {
47
+ if (time_stamp + (time_delta >> 1) > time) {
45
48
  return string;
46
49
  } else {
47
50
  return this.timeencode(this.timedecode(string));
@@ -2,7 +2,7 @@
2
2
  var _slider = createElement(div);
3
3
  var getGenerator = function (container, tagName = 'item') {
4
4
  if (!container) return;
5
- if (!container.childNodes.length && container.$generator) return container.$generator;
5
+ if (container.$generator) return container.$generator;
6
6
  var template = document.createElement(tagName);
7
7
  var templates = [].concat.apply([], container.childNodes).filter(a => {
8
8
  if (a.hasAttribute('insert')) {
@@ -154,14 +154,24 @@ function main(elem, mode) {
154
154
  case "y":
155
155
  case "vertical":
156
156
  var emit = function (item, target) {
157
- active(elem, item, item.value, target);
157
+ active(elem, item.value, item, target);
158
158
  };
159
159
  if ("$src" in elem) {
160
160
  getGenerator(elem, 'menu-item');
161
- care(elem, function (src) {
162
- menuList(elem, getTreeFromData(src), emit, direction);
161
+ on("append")(elem, function () {
163
162
  elem.registerAsRoot();
164
163
  });
164
+ var src0 = [];
165
+ menuList(elem, src0, emit, direction);
166
+ care(elem, function (src) {
167
+ src0.splice(0, src0.length);
168
+ var s = getTreeFromData(src);
169
+ var i = 0;
170
+ while (i < s.length) {
171
+ src0.push.apply(src0, s.slice(i, i += 1000));
172
+ }
173
+ elem.go(0);
174
+ });
165
175
  }
166
176
  else {
167
177
  var nodes = getArrayNodes(elem);
@@ -275,7 +275,6 @@ function main(page, items, active, direction = 'y') {
275
275
  var className = `{'has-children':${itemName}.children&&${itemName}.children.length,'warn':${itemName}.type==='danger'||${itemName}.type==='warn'||${itemName}.type==='red'}`;
276
276
  var notHidden = `!${itemName}.hidden`;
277
277
  var generator = getGenerator(page, 'menu-item');
278
-
279
278
  list(page, function (index) {
280
279
  var item = items[index];
281
280
  if (!item) return;
@@ -17,8 +17,15 @@ var getstation = function (n, s) {
17
17
  return n;
18
18
  };
19
19
  var _createImage = function (url, callback) {
20
- var imgpic = document.createElement('img');
21
- imgpic.src = url;
20
+ var imgpic;
21
+ if (url instanceof Image) {
22
+ imgpic = new Image;
23
+ imgpic.src = url.src;
24
+ }
25
+ else {
26
+ imgpic = document.createElement('img');
27
+ imgpic.src = url;
28
+ }
22
29
  var onload = function () {
23
30
  imgpic.onload = null;
24
31
  callback(imgpic);
@@ -393,7 +400,6 @@ function picture(url, to = 0, key) {
393
400
  var gen = function (index, ratio) {
394
401
  if (index >= urls.length || index < 0) return null;
395
402
  if (images[index] && images[index].url !== urls[index]) {
396
- console.log(images[index].url, urls[index]);
397
403
  delete images[index];
398
404
  }
399
405
  if (!images[index]) {
@@ -152,10 +152,6 @@ var createMask = function (element) {
152
152
  return mask;
153
153
  };
154
154
  var popup_with_mask = function (element, mask = createMask(element)) {
155
- if (!mask.clean) {
156
- mask.clean = new Cleanup(element.with);
157
- }
158
- onremove(element, mask.clean);
159
155
  css(element, `z-index:${zIndex()};`);
160
156
  if (mask.parentNode) {
161
157
  global(element, false);
@@ -167,6 +163,10 @@ var popup_with_mask = function (element, mask = createMask(element)) {
167
163
  } else {
168
164
  if (element.with !== element) element.with = [element.with, mask];
169
165
  }
166
+ if (!mask.clean) {
167
+ mask.clean = new Cleanup(element.with);
168
+ }
169
+ onremove(element, mask.clean);
170
170
  if (!element.parentNode) global(element, false);
171
171
  return element;
172
172
  };
@@ -381,7 +381,7 @@ var src2 = function (search) {
381
381
  temp = "";
382
382
  }
383
383
  var changes = getChanges(temp, savedValue);
384
- if (!changes || isEmpty(origin) && isEmpty(this.src)) return;
384
+ if (!changes || isEmpty(origin) && isEmpty(this.src) && isEmpty(savedValue)) return;
385
385
  savedValue = temp;
386
386
  this.src = origin;
387
387
  cast(this, origin);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.12.2",
3
+ "version": "3.12.3",
4
4
  "description": "一个开发工具,开放源代码,自带组件库和编译环境,可以用来开发web组件,web应用或nodejs模块,或做为已有代码的加密工具,也可以做为静态页面服务器或跨域中转服务器使用",
5
5
  "main": "public/efront.js",
6
6
  "directories": {