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 CHANGED
@@ -650,6 +650,9 @@ convert2Blob(canvas, fn, options)
650
650
 
651
651
  ## changelog
652
652
 
653
+ * v1.6.1
654
+ `*` fix saver
655
+
653
656
  * v1.4.1
654
657
  `*` add `pathToRoutes`
655
658
 
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 Wed Apr 26 2023 17:47:26 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
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"></span></h4>
14220
+ <h4 class="name" id="slpitArray"><span class="type-signature"></span>slpitArray<span class="signature">(arr, num)</span><span class="type-signature"> &rarr; {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 Wed Apr 26 2023 17:47:26 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
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 Wed Apr 26 2023 17:47:26 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
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;
@@ -1,61 +1,83 @@
1
1
  "use strict";
2
2
 
3
- var _saveAs = function(e) {
4
- if (!(void 0 === e || "undefined" != typeof navigator && /MSIE [1-9]\./.test(navigator.userAgent))) {
5
- var t = e.document, n = function() {
6
- return e.URL || e.webkitURL || e;
7
- }, o = t.createElementNS("http://www.w3.org/1999/xhtml", "a"), r = "download" in o, a = /constructor/i.test(e.HTMLElement) || e.safari, i = /CriOS\/[\d]+/.test(navigator.userAgent), c = function(t) {
8
- (e.setImmediate || e.setTimeout)((function() {
9
- throw t;
10
- }), 0);
11
- }, d = function(e) {
12
- setTimeout((function() {
13
- "string" == typeof e ? n().revokeObjectURL(e) : e.remove();
14
- }), 4e4);
15
- }, s = function(e) {
16
- return /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type) ? new Blob([ String.fromCharCode(65279), e ], {
17
- type: e.type
18
- }) : e;
19
- }, f = function(t, f, u) {
20
- u || (t = s(t));
21
- var l, v = this, p = "application/octet-stream" === t.type, w = function() {
22
- !function(e, t, n) {
23
- for (var o = (t = [].concat(t)).length; o--; ) {
24
- var r = e["on" + t[o]];
25
- if ("function" == typeof r) try {
26
- r.call(e, n || e);
27
- } catch (e) {
28
- c(e);
29
- }
30
- }
31
- }(v, "writestart progress write writeend".split(" "));
32
- };
33
- if (v.readyState = v.INIT, r) return l = n().createObjectURL(t), void setTimeout((function() {
34
- var e, t;
35
- o.href = l, o.download = f, e = o, t = new MouseEvent("click"), e.dispatchEvent(t),
36
- w(), d(l), v.readyState = v.DONE;
37
- }));
38
- !function() {
39
- if ((i || p && a) && e.FileReader) {
40
- var o = new FileReader;
41
- return o.onloadend = function() {
42
- var t = i ? o.result : o.result.replace(/^data:[^;]*;/, "data:attachment/file;");
43
- e.open(t, "_blank") || (e.location.href = t), t = void 0, v.readyState = v.DONE,
44
- w();
45
- }, o.readAsDataURL(t), void (v.readyState = v.INIT);
46
- }
47
- (l || (l = n().createObjectURL(t)), p) ? e.location.href = l : e.open(l, "_blank") || (e.location.href = l);
48
- v.readyState = v.DONE, w(), d(l);
49
- }();
50
- }, u = f.prototype;
51
- return "undefined" != typeof navigator && navigator.msSaveOrOpenBlob ? function(e, t, n) {
52
- return t = t || e.name || "download", n || (e = s(e)), navigator.msSaveOrOpenBlob(e, t);
53
- } : (u.abort = function() {}, u.readyState = u.INIT = 0, u.WRITING = 1, u.DONE = 2,
54
- u.error = u.onwritestart = u.onprogress = u.onwrite = u.onabort = u.onerror = u.onwriteend = null,
55
- function(e, t, n) {
56
- return new f(e, t || e.name || "download", n);
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
- }, view = "undefined" != typeof self && self || "undefined" != typeof window && window || this.content;
81
+ };
60
82
 
61
- module.exports = _saveAs(view);
83
+ module.exports = saveAs;
@@ -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
- return null != i ? decodeURIComponent(i[2]) : null;
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.0",
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 && gulp move",
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",