amos-tool 1.6.0 → 1.6.2
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/README.md +3 -0
- package/docs/Logger.html +1 -1
- package/docs/global.html +14 -2
- package/docs/index.html +5 -1
- package/index.d.ts +10 -0
- package/lib/dom/fileSaveAs.js +79 -57
- package/lib/locationParams.js +6 -1
- package/lib/utils.js +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
package/docs/Logger.html
CHANGED
|
@@ -336,7 +336,7 @@ isDebug: true
|
|
|
336
336
|
<br class="clear">
|
|
337
337
|
|
|
338
338
|
<footer>
|
|
339
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on
|
|
339
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Thu Aug 31 2023 11:02:25 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
340
340
|
</footer>
|
|
341
341
|
|
|
342
342
|
<script>prettyPrint();</script>
|
package/docs/global.html
CHANGED
|
@@ -14217,7 +14217,7 @@ clear 是否清理前一次的事件,如果清理,则重新设置定时器</
|
|
|
14217
14217
|
|
|
14218
14218
|
|
|
14219
14219
|
|
|
14220
|
-
<h4 class="name" id="slpitArray"><span class="type-signature"></span>slpitArray<span class="signature">(arr, num)</span><span class="type-signature"
|
|
14220
|
+
<h4 class="name" id="slpitArray"><span class="type-signature"></span>slpitArray<span class="signature">(arr, num)</span><span class="type-signature"> → {Array}</span></h4>
|
|
14221
14221
|
|
|
14222
14222
|
|
|
14223
14223
|
|
|
@@ -14374,6 +14374,18 @@ clear 是否清理前一次的事件,如果清理,则重新设置定时器</
|
|
|
14374
14374
|
|
|
14375
14375
|
|
|
14376
14376
|
|
|
14377
|
+
<dl class="param-type">
|
|
14378
|
+
<dt>
|
|
14379
|
+
Type
|
|
14380
|
+
</dt>
|
|
14381
|
+
<dd>
|
|
14382
|
+
|
|
14383
|
+
<span class="param-type">Array</span>
|
|
14384
|
+
|
|
14385
|
+
|
|
14386
|
+
</dd>
|
|
14387
|
+
</dl>
|
|
14388
|
+
|
|
14377
14389
|
|
|
14378
14390
|
|
|
14379
14391
|
|
|
@@ -16595,7 +16607,7 @@ schedule <code>callback</code> to execute after <code>delay</code> ms.</p></td>
|
|
|
16595
16607
|
<br class="clear">
|
|
16596
16608
|
|
|
16597
16609
|
<footer>
|
|
16598
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on
|
|
16610
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Thu Aug 31 2023 11:02:25 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
16599
16611
|
</footer>
|
|
16600
16612
|
|
|
16601
16613
|
<script>prettyPrint();</script>
|
package/docs/index.html
CHANGED
|
@@ -743,6 +743,10 @@ convert2BMP(canvas, width, height)</p>
|
|
|
743
743
|
<h2>changelog</h2>
|
|
744
744
|
<ul>
|
|
745
745
|
<li>
|
|
746
|
+
<p>v1.6.1
|
|
747
|
+
<code>*</code> fix saver</p>
|
|
748
|
+
</li>
|
|
749
|
+
<li>
|
|
746
750
|
<p>v1.4.1
|
|
747
751
|
<code>*</code> add <code>pathToRoutes</code></p>
|
|
748
752
|
</li>
|
|
@@ -785,7 +789,7 @@ convert2BMP(canvas, width, height)</p>
|
|
|
785
789
|
<br class="clear">
|
|
786
790
|
|
|
787
791
|
<footer>
|
|
788
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on
|
|
792
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Thu Aug 31 2023 11:02:25 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
789
793
|
</footer>
|
|
790
794
|
|
|
791
795
|
<script>prettyPrint();</script>
|
package/index.d.ts
CHANGED
|
@@ -203,7 +203,13 @@ declare namespace LocationParam {
|
|
|
203
203
|
* - 获取 location 中的参数。
|
|
204
204
|
* - 采用 location.search 进行查找,因此,如果采用 react-router hash 方式,将无法获取到参数
|
|
205
205
|
* - why not support hash router? because in hash router location.search=''
|
|
206
|
+
* - since v1.6.2 add hash supported
|
|
206
207
|
* @param name
|
|
208
|
+
* @example
|
|
209
|
+
* // href='http://113.142.68.105:8090/#/?_k=jxwq5h&token=3355&id=666'
|
|
210
|
+
* getLocationParamByName('token'); // 3355
|
|
211
|
+
* // href='http://113.142.68.105:8090?mmm=jxwq5h&token=3355&id=666'
|
|
212
|
+
* getLocationParamByName('token'); // 3355
|
|
207
213
|
*/
|
|
208
214
|
export function getLocationParamByName(name: string): string | null;
|
|
209
215
|
/**
|
|
@@ -685,6 +691,7 @@ export function omit(obj: object, keys: string | Array<String>): any;
|
|
|
685
691
|
* @example
|
|
686
692
|
* pick({ name: 'ilex', age: 16 }, ['age']); // { age: 16 }
|
|
687
693
|
* pick({ name: 'ilex', age: 16 }, ['']); // {}
|
|
694
|
+
* pick({ name: 'ilex', age: 16 }, ['you']); // {},如果指定对象中无指定的 key,则不拾取
|
|
688
695
|
*/
|
|
689
696
|
export function pick(obj: Object | Function, keys: string | Array<String>): Object;
|
|
690
697
|
/**
|
|
@@ -1032,6 +1039,9 @@ declare namespace utils {
|
|
|
1032
1039
|
* isUrl('www.baidu.com') // false
|
|
1033
1040
|
* isUrl('http://172.16.1.2') // true
|
|
1034
1041
|
* isUrl('172.16.1.2') // false
|
|
1042
|
+
* isUrl('/a/b/c') // false
|
|
1043
|
+
* isUrl('main/dd/d') // false
|
|
1044
|
+
* isUrl('http://localhost:8080/aaa') // true
|
|
1035
1045
|
*/
|
|
1036
1046
|
export function isUrl(value: string): boolean;
|
|
1037
1047
|
export function isBuiltInObject(value: any): boolean;
|
package/lib/dom/fileSaveAs.js
CHANGED
|
@@ -1,61 +1,83 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"), _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")), _global = "object" === ("undefined" == typeof window ? "undefined" : (0,
|
|
4
|
+
_typeof2.default)(window)) && window.window === window ? window : "object" === ("undefined" == typeof self ? "undefined" : (0,
|
|
5
|
+
_typeof2.default)(self)) && self.self === self ? self : "object" === ("undefined" == typeof global ? "undefined" : (0,
|
|
6
|
+
_typeof2.default)(global)) && global.global === global ? global : void 0;
|
|
7
|
+
|
|
8
|
+
function bom(e, t) {
|
|
9
|
+
return void 0 === t ? t = {
|
|
10
|
+
autoBom: !1
|
|
11
|
+
} : "object" !== (0, _typeof2.default)(t) && (console.warn("Deprecated: Expected third argument to be a object"),
|
|
12
|
+
t = {
|
|
13
|
+
autoBom: !t
|
|
14
|
+
}), t.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type) ? new Blob([ String.fromCharCode(65279), e ], {
|
|
15
|
+
type: e.type
|
|
16
|
+
}) : e;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function download(e, t, o) {
|
|
20
|
+
var n = new XMLHttpRequest;
|
|
21
|
+
n.open("GET", e), n.responseType = "blob", n.onload = function() {
|
|
22
|
+
saveAs(n.response, t, o);
|
|
23
|
+
}, n.onerror = function() {
|
|
24
|
+
console.error("could not download file");
|
|
25
|
+
}, n.send();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function corsEnabled(e) {
|
|
29
|
+
var t = new XMLHttpRequest;
|
|
30
|
+
t.open("HEAD", e, !1);
|
|
31
|
+
try {
|
|
32
|
+
t.send();
|
|
33
|
+
} catch (e) {}
|
|
34
|
+
return t.status >= 200 && t.status <= 299;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function click(e) {
|
|
38
|
+
try {
|
|
39
|
+
e.dispatchEvent(new MouseEvent("click"));
|
|
40
|
+
} catch (o) {
|
|
41
|
+
var t = document.createEvent("MouseEvents");
|
|
42
|
+
t.initMouseEvent("click", !0, !0, window, 0, 0, 0, 80, 20, !1, !1, !1, !1, 0, null),
|
|
43
|
+
e.dispatchEvent(t);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
var isMacOSWebView = _global.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent), saveAs = "object" !== ("undefined" == typeof window ? "undefined" : (0,
|
|
48
|
+
_typeof2.default)(window)) || window !== _global ? function() {} : "download" in HTMLAnchorElement.prototype && !isMacOSWebView ? function(e, t, o) {
|
|
49
|
+
var n = _global.URL || _global.webkitURL, a = document.createElement("a");
|
|
50
|
+
t = t || e.name || "download", a.download = t, a.rel = "noopener", "string" == typeof e ? (a.href = e,
|
|
51
|
+
a.origin !== location.origin ? corsEnabled(a.href) ? download(e, t, o) : click(a, a.target = "_blank") : click(a)) : (a.href = n.createObjectURL(e),
|
|
52
|
+
setTimeout((function() {
|
|
53
|
+
n.revokeObjectURL(a.href);
|
|
54
|
+
}), 4e4), setTimeout((function() {
|
|
55
|
+
click(a);
|
|
56
|
+
}), 0));
|
|
57
|
+
} : "msSaveOrOpenBlob" in navigator ? function(e, t, o) {
|
|
58
|
+
if (t = t || e.name || "download", "string" == typeof e) if (corsEnabled(e)) download(e, t, o); else {
|
|
59
|
+
var n = document.createElement("a");
|
|
60
|
+
n.href = e, n.target = "_blank", setTimeout((function() {
|
|
61
|
+
click(n);
|
|
62
|
+
}));
|
|
63
|
+
} else navigator.msSaveOrOpenBlob(bom(e, o), t);
|
|
64
|
+
} : function(e, t, o, n) {
|
|
65
|
+
if ((n = n || open("", "_blank")) && (n.document.title = n.document.body.innerText = "downloading..."),
|
|
66
|
+
"string" == typeof e) return download(e, t, o);
|
|
67
|
+
var a = "application/octet-stream" === e.type, i = /constructor/i.test(_global.HTMLElement) || _global.safari, l = /CriOS\/[\d]+/.test(navigator.userAgent);
|
|
68
|
+
if ((l || a && i || isMacOSWebView) && "undefined" != typeof FileReader) {
|
|
69
|
+
var r = new FileReader;
|
|
70
|
+
r.onloadend = function() {
|
|
71
|
+
var e = r.result;
|
|
72
|
+
e = l ? e : e.replace(/^data:[^;]*;/, "data:attachment/file;"), n ? n.location.href = e : location = e,
|
|
73
|
+
n = null;
|
|
74
|
+
}, r.readAsDataURL(e);
|
|
75
|
+
} else {
|
|
76
|
+
var d = _global.URL || _global.webkitURL, c = d.createObjectURL(e);
|
|
77
|
+
n ? n.location = c : location.href = c, n = null, setTimeout((function() {
|
|
78
|
+
d.revokeObjectURL(c);
|
|
79
|
+
}), 4e4);
|
|
58
80
|
}
|
|
59
|
-
}
|
|
81
|
+
};
|
|
60
82
|
|
|
61
|
-
module.exports =
|
|
83
|
+
module.exports = saveAs;
|
package/lib/locationParams.js
CHANGED
|
@@ -79,7 +79,12 @@ var utils = require("./utils"), _LSFN = function() {
|
|
|
79
79
|
},
|
|
80
80
|
getLocationParamByName: function(t) {
|
|
81
81
|
var n = new RegExp("(^|&?)".concat(t, "=([^&]*)(&|$)")), i = window.location.search.substr(1).match(n);
|
|
82
|
-
|
|
82
|
+
if (null != i) return decodeURIComponent(i[2]);
|
|
83
|
+
if (!utils.isEmpty(window.location.hash)) {
|
|
84
|
+
var e = window.location.hash.substr(1).match(n);
|
|
85
|
+
if (null != e) return decodeURIComponent(e[2]);
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
83
88
|
},
|
|
84
89
|
getParameter: function(t, n) {
|
|
85
90
|
var i = new RegExp("(\\?|#|&)" + n + "=([^&#]*)(&|#|$)"), e = t.match(i);
|
package/lib/utils.js
CHANGED
|
@@ -80,7 +80,7 @@ function isDom(e) {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
function isUrl(e) {
|
|
83
|
-
return isString(e) && (/^https?:\/\/(?!\-)(?:(([0-9]{1,3}\.){3}[0-9]{1,3}))(:[0-9]{1,4}\/)?/.test(e) || /^https?:\/\/(?!\-)(?:[a-zA-Z\d\-]{0,62}[a-zA-Z\d]\.){1,126}(?!\d+)[a-zA-Z\d]{1,63}/.test(e));
|
|
83
|
+
return isString(e) && (/^https?:\/\/(?!\-)(?:(([0-9]{1,3}\.){3}[0-9]{1,3}))(:[0-9]{1,4}\/)?/.test(e) || /^https?:\/\/(?!\-)(?:[a-zA-Z\d\-]{0,62}[a-zA-Z\d]\.){1,126}(?!\d+)[a-zA-Z\d]{1,63}/.test(e) || /^https?:\/\/localhost.*/.test(e));
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
function isBuiltInObject(e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "amos-tool",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.2",
|
|
4
4
|
"description": "amos ui tool",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"directories": {
|
|
@@ -11,10 +11,11 @@
|
|
|
11
11
|
"testUUID": "mocha tests/uuid.test",
|
|
12
12
|
"testFilter": "mocha tests/tablefilter.test",
|
|
13
13
|
"docs": "node_modules/.bin/jsdoc -c jsdoc-ori.json --readme README.md",
|
|
14
|
-
"build": "ac-build babel-es5
|
|
14
|
+
"build": "ac-build babel-es5",
|
|
15
15
|
"build2": "rollup -c",
|
|
16
16
|
"doc": "ac-doc docall",
|
|
17
|
-
"pub": "npm run doc && npm run build && npm publish"
|
|
17
|
+
"pub": "npm run doc && npm run build && npm publish",
|
|
18
|
+
"pub2": "npm run doc && npm run build && gulp move && npm publish"
|
|
18
19
|
},
|
|
19
20
|
"repository": {
|
|
20
21
|
"type": "git",
|