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.
- package/coms/basic/lazy.js +5 -2
- package/coms/zimoli/autofocus.js +20 -0
- package/coms/zimoli/cross.js +2 -2
- package/coms/zimoli/data.js +4 -3
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/coms/basic/lazy.js
CHANGED
|
@@ -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
|
|
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
|
+
}
|
package/coms/zimoli/cross.js
CHANGED
package/coms/zimoli/data.js
CHANGED
|
@@ -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
|
-
|
|
619
|
-
|
|
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
|
},
|