beer-network 1.1.1-alpha.3 → 1.1.1-alpha.5

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/api.js CHANGED
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const session_1 = require("./session");
4
- class Fetch {
1
+ import { Session } from './session';
2
+ export default class Fetch {
5
3
  constructor(pathPrefix) {
6
4
  this.pathPrefix = pathPrefix;
7
5
  }
@@ -76,7 +74,7 @@ class Fetch {
76
74
  * 默认授权方式.
77
75
  */
78
76
  authorization() {
79
- const bearer = session_1.Session.getBearer();
77
+ const bearer = Session.getBearer();
80
78
  if (bearer === undefined || bearer === '') {
81
79
  return {};
82
80
  }
@@ -117,4 +115,3 @@ class Fetch {
117
115
  });
118
116
  }
119
117
  }
120
- exports.default = Fetch;
package/elementUtils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare class ElementUtils {
1
+ export default class ElementUtils {
2
2
  /**
3
3
  * 选择文件本地文件.
4
4
  */
package/elementUtils.js CHANGED
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ElementUtils = void 0;
4
- class ElementUtils {
1
+ export default class ElementUtils {
5
2
  /**
6
3
  * 选择文件本地文件.
7
4
  */
@@ -32,4 +29,3 @@ class ElementUtils {
32
29
  document.body.removeChild(link);
33
30
  }
34
31
  }
35
- exports.ElementUtils = ElementUtils;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "beer-network",
3
3
  "private": false,
4
- "version": "1.1.1-alpha.3",
4
+ "version": "1.1.1-alpha.5",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "pub-w": "copy package.json .\\dist\\package.json && npm publish ./dist"
package/session.js CHANGED
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Session = void 0;
4
- class Session {
1
+ export class Session {
5
2
  /**
6
3
  * 获取令牌.
7
4
  * <li>window.sessionKey 设置读取缓存用户信息的Key, 默认 login_user.</li>
@@ -37,4 +34,3 @@ class Session {
37
34
  }
38
35
  }
39
36
  }
40
- exports.Session = Session;
package/utils.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ export default class Utils {
2
+ /**
3
+ * 获取URI 地址参数.
4
+ * @param key 参数名称.
5
+ */
6
+ static getParam(key: string): string | undefined;
7
+ /**
8
+ * 复制到剪切板.
9
+ * @param value 内容.
10
+ */
11
+ static copy(value: string): Promise<void>;
12
+ }
package/utils.js ADDED
@@ -0,0 +1,36 @@
1
+ export default class Utils {
2
+ /**
3
+ * 获取URI 地址参数.
4
+ * @param key 参数名称.
5
+ */
6
+ static getParam(key) {
7
+ const values = window.location.search.split('?');
8
+ if (values.length <= 1) {
9
+ return undefined;
10
+ }
11
+ const value = values[1];
12
+ if (value === undefined) {
13
+ return undefined;
14
+ }
15
+ for (const it of decodeURIComponent(value)
16
+ .split('&')) {
17
+ const args = it.trim()
18
+ .split('=');
19
+ if (args.length !== 2) {
20
+ continue;
21
+ }
22
+ if (args[0].toString()
23
+ .toLocaleLowerCase() === key.toLocaleLowerCase()) {
24
+ return args[1];
25
+ }
26
+ }
27
+ return undefined;
28
+ }
29
+ /**
30
+ * 复制到剪切板.
31
+ * @param value 内容.
32
+ */
33
+ static async copy(value) {
34
+ return navigator.clipboard.writeText(value);
35
+ }
36
+ }