efront 3.20.6 → 3.20.10

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.
@@ -2,7 +2,7 @@
2
2
  // 2.如果time小于0,传入的函数会立即执行,并忽略-time内的连续调用,time时间后触发最后一次调用
3
3
  // 如果time传false或0 使用requestAnimationFrame代替setTimeout按第1步执行
4
4
  // 如果time传null或undefined或NaN使用requestAnimationFrame代替setTimeout按第2步执行
5
- function lazy(run, time = false) {
5
+ function lazy(run, time) {
6
6
  var wait = +time ? setTimeout : requestAnimationFrame;
7
7
  var ing, args, that;
8
8
  var hire = function () {
@@ -49,11 +49,14 @@ function lazy(run, time = false) {
49
49
  if (time >= 0) {
50
50
  ing = wait(fire, +time);
51
51
  }
52
- else {
52
+ else if (time < 0) {
53
53
  ing = run.apply(that, args);
54
54
  if (ing instanceof Promise) ing.then(hire, hire);
55
55
  else ing = wait(fire, -time);
56
56
  }
57
+ else {
58
+ ing = true; wait(fire);
59
+ }
57
60
  };
58
61
  }
59
62
  module.exports = lazy;
@@ -0,0 +1,20 @@
1
+ function autofocus(e) {
2
+ if (!e.renders) e.renders = [];
3
+ var savedElement;
4
+ e.renders.push(function () {
5
+ var parent = rootElements[rootElements.length - 1] || document.body;
6
+ if (savedElement === parent) {
7
+ if (this !== parent || getTargetIn(parent, document.activeElement)) return;
8
+ }
9
+ savedElement = parent;
10
+ if (/^(input|textarea)$/i.test(this.tagName) || /^true$/.test(this.contentEditable)) {
11
+ if (getTargetIn(parent, this)) {
12
+ this.focus();
13
+ }
14
+ }
15
+ else if (parent === this) {
16
+ var e = this.querySelector("input,textarea,[contenteditable]");
17
+ if (e) e.focus();
18
+ }
19
+ });
20
+ }
@@ -17,9 +17,9 @@ if (cookiesData) {
17
17
  }
18
18
  }
19
19
 
20
- var digest = lazy(function () {
20
+ var digest = function () {
21
21
  dispatch('render', window);
22
- }, 0);
22
+ };
23
23
 
24
24
  var cross = cross_.bind(function (callback, onerror) {
25
25
  var xhr = new XMLHttpRequest;
@@ -353,7 +353,7 @@ function fixApi(api, href) {
353
353
  href = protocol + "//" + host + href;
354
354
  }
355
355
  else if (/^\.\//.test(href)) {
356
- var { protocol, host, pathname } = parseURL(location.href);
356
+ var { protocol, host, pathname } = parseURL(document.baseURI || location.href);
357
357
  href = href.slice(1);
358
358
  if (pathname) href = pathname.replace(/\/[^\/\\]*$/, '') + href;
359
359
  href = protocol + "//" + host + href;
@@ -615,8 +615,9 @@ var privates = {
615
615
  if (!_configfileurl) {
616
616
  throw new Error("没有指定配置文件的路径,请使用data.loadConfig加载配置");
617
617
  }
618
- configPormise = this.loadIgnoreConfig('get', _configfileurl)
619
- .then(createApiMap);
618
+ var p = this.loadIgnoreConfig('get', _configfileurl);
619
+ p.loading.abort = function () { };
620
+ configPormise = p.then(createApiMap);
620
621
  }
621
622
  return configPormise;
622
623
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.20.6",
3
+ "version": "3.20.10",
4
4
  "description": "一个开发工具,开放源代码,自带组件库和编译环境,可以用来开发web组件,web应用或nodejs模块,或做为已有代码的加密工具,也可以做为静态页面服务器或跨域中转服务器使用",
5
5
  "main": "public/efront.js",
6
6
  "directories": {