component-shipinlv 0.1.5 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ declare const fileList: (filePathList: string[], fileType?: 'folder' | 'file' | '', extTypes?: string[]) => Promise<unknown>;
2
+ export default fileList;
@@ -0,0 +1,61 @@
1
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
+ import * as LocalFileController from "../service/local/FileController";
4
+ var fileList = /*#__PURE__*/function () {
5
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(filePathList) {
6
+ var fileType,
7
+ extTypes,
8
+ _args2 = arguments;
9
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
10
+ while (1) switch (_context2.prev = _context2.next) {
11
+ case 0:
12
+ fileType = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : '';
13
+ extTypes = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : [];
14
+ return _context2.abrupt("return", new Promise( /*#__PURE__*/function () {
15
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve, reject) {
16
+ var openResult;
17
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
18
+ while (1) switch (_context.prev = _context.next) {
19
+ case 0:
20
+ _context.next = 2;
21
+ return LocalFileController.fileList({
22
+ path: filePathList,
23
+ fileType: fileType,
24
+ extTypes: extTypes
25
+ }, {
26
+ silent: true
27
+ }).catch(function (err) {
28
+ if ((err === null || err === void 0 ? void 0 : err.name) === "shipinlv-client-not-run") {
29
+ return reject(err);
30
+ }
31
+ console.log('open In Folder err:', err);
32
+ console.log('open In Folder err 2:', JSON.stringify(err));
33
+ err.message = "\u9009\u53D6\u6587\u4EF6\u5939\u5931\u8D25\uFF1A".concat(err === null || err === void 0 ? void 0 : err.message, "\uFF01 ");
34
+ reject(err);
35
+ });
36
+ case 2:
37
+ openResult = _context.sent;
38
+ if (openResult) {
39
+ resolve(openResult);
40
+ }
41
+ case 4:
42
+ case "end":
43
+ return _context.stop();
44
+ }
45
+ }, _callee);
46
+ }));
47
+ return function (_x2, _x3) {
48
+ return _ref2.apply(this, arguments);
49
+ };
50
+ }()));
51
+ case 3:
52
+ case "end":
53
+ return _context2.stop();
54
+ }
55
+ }, _callee2);
56
+ }));
57
+ return function fileList(_x) {
58
+ return _ref.apply(this, arguments);
59
+ };
60
+ }();
61
+ export default fileList;
@@ -0,0 +1,2 @@
1
+ declare const fileListContent: (fileDir: string, extName?: string[], maxCount?: number) => Promise<string[]>;
2
+ export default fileListContent;
@@ -0,0 +1,61 @@
1
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
+ import * as LocalFileController from "../service/local/FileController";
4
+ var fileListContent = /*#__PURE__*/function () {
5
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(fileDir) {
6
+ var extName,
7
+ maxCount,
8
+ _args2 = arguments;
9
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
10
+ while (1) switch (_context2.prev = _context2.next) {
11
+ case 0:
12
+ extName = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : [];
13
+ maxCount = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : 100;
14
+ return _context2.abrupt("return", new Promise( /*#__PURE__*/function () {
15
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve, reject) {
16
+ var openResult;
17
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
18
+ while (1) switch (_context.prev = _context.next) {
19
+ case 0:
20
+ _context.next = 2;
21
+ return LocalFileController.fileListContent({
22
+ fileDir: fileDir,
23
+ extName: extName,
24
+ maxCount: maxCount
25
+ }, {
26
+ silent: true
27
+ }).catch(function (err) {
28
+ if ((err === null || err === void 0 ? void 0 : err.name) === "shipinlv-client-not-run") {
29
+ return reject(err);
30
+ }
31
+ console.log('open In Folder err:', err);
32
+ console.log('open In Folder err 2:', JSON.stringify(err));
33
+ err.message = "\u9009\u53D6\u6587\u4EF6\u5185\u5BB9\u5931\u8D25\uFF1A".concat(err === null || err === void 0 ? void 0 : err.message, "\uFF01 \u6587\u4EF6\u5939\u5730\u5740\uFF1A ").concat(fileDir);
34
+ reject(err);
35
+ });
36
+ case 2:
37
+ openResult = _context.sent;
38
+ if (openResult) {
39
+ resolve(openResult || []);
40
+ }
41
+ case 4:
42
+ case "end":
43
+ return _context.stop();
44
+ }
45
+ }, _callee);
46
+ }));
47
+ return function (_x2, _x3) {
48
+ return _ref2.apply(this, arguments);
49
+ };
50
+ }()));
51
+ case 3:
52
+ case "end":
53
+ return _context2.stop();
54
+ }
55
+ }, _callee2);
56
+ }));
57
+ return function fileListContent(_x) {
58
+ return _ref.apply(this, arguments);
59
+ };
60
+ }();
61
+ export default fileListContent;
@@ -0,0 +1,2 @@
1
+ declare const soundInfo: (filePath: string, isShowCover?: boolean) => Promise<LocalFile.SoundInfo>;
2
+ export default soundInfo;
@@ -0,0 +1,55 @@
1
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
+ import * as LocalFileController from "../service/local/FileController";
4
+ var soundInfo = /*#__PURE__*/function () {
5
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(filePath, isShowCover) {
6
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
7
+ while (1) switch (_context2.prev = _context2.next) {
8
+ case 0:
9
+ return _context2.abrupt("return", new Promise( /*#__PURE__*/function () {
10
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve, reject) {
11
+ var openResult;
12
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
13
+ while (1) switch (_context.prev = _context.next) {
14
+ case 0:
15
+ _context.next = 2;
16
+ return LocalFileController.soundInfo({
17
+ filePath: filePath,
18
+ isShowCover: isShowCover
19
+ }, {
20
+ silent: true
21
+ }).catch(function (err) {
22
+ if ((err === null || err === void 0 ? void 0 : err.name) === "shipinlv-client-not-run") {
23
+ return reject(err);
24
+ }
25
+ console.log('open In Folder err:', err);
26
+ console.log('open In Folder err 2:', JSON.stringify(err));
27
+ err.message = "\u83B7\u53D6\u58F0\u97F3\u6587\u4EF6\u5931\u8D25\uFF1A".concat(err === null || err === void 0 ? void 0 : err.message, "\uFF01 \u6587\u4EF6\u5939\u5730\u5740\uFF1A ").concat(filePath);
28
+ reject(err);
29
+ });
30
+ case 2:
31
+ openResult = _context.sent;
32
+ if (openResult) {
33
+ resolve(openResult);
34
+ }
35
+ case 4:
36
+ case "end":
37
+ return _context.stop();
38
+ }
39
+ }, _callee);
40
+ }));
41
+ return function (_x3, _x4) {
42
+ return _ref2.apply(this, arguments);
43
+ };
44
+ }()));
45
+ case 1:
46
+ case "end":
47
+ return _context2.stop();
48
+ }
49
+ }, _callee2);
50
+ }));
51
+ return function soundInfo(_x, _x2) {
52
+ return _ref.apply(this, arguments);
53
+ };
54
+ }();
55
+ export default soundInfo;
package/dist/index.d.ts CHANGED
@@ -8,3 +8,6 @@ export { default as fileSelect } from './base/fileSelect';
8
8
  export { default as folderOpen } from './base/folderOpen';
9
9
  export { default as folderSelect } from './base/folderSelect';
10
10
  export { default as openInFolder } from './base/openInFolder';
11
+ export { default as soundInfo } from './base/soundInfo';
12
+ export { default as fileListContent } from './base/fileListContent';
13
+ export { default as fileList } from './base/fileList';
package/dist/index.js CHANGED
@@ -7,4 +7,7 @@ export { default as JoinClient } from "./join-client";
7
7
  export { default as fileSelect } from "./base/fileSelect";
8
8
  export { default as folderOpen } from "./base/folderOpen";
9
9
  export { default as folderSelect } from "./base/folderSelect";
10
- export { default as openInFolder } from "./base/openInFolder";
10
+ export { default as openInFolder } from "./base/openInFolder";
11
+ export { default as soundInfo } from "./base/soundInfo";
12
+ export { default as fileListContent } from "./base/fileListContent";
13
+ export { default as fileList } from "./base/fileList";
@@ -163,7 +163,7 @@ declare const Tool: {
163
163
  setTimeOffset(serverTime: number): void;
164
164
  getTime(): number;
165
165
  h5Pay(query: Pay.H5PayQuery): void;
166
- notification(type: "success" | "info" | "warning" | "error", message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
166
+ notification(type: "info" | "error" | "success" | "warning", message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
167
167
  notificationSuccess(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
168
168
  notificationError(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
169
169
  notificationWarning(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
@@ -5,16 +5,25 @@ export declare function fileList(body: {
5
5
  }, options?: ServicesApi.RequestOptions): Promise<string[][]>;
6
6
  export declare function fileSelect(body: {
7
7
  fileType: 'video' | 'video+image' | 'image' | 'sound' | '';
8
- }, options?: ServicesApi.RequestOptions): Promise<LocalFile.FileSelect>;
8
+ }, optionsQuery?: ServicesApi.RequestOptions): Promise<LocalFile.FileSelect>;
9
9
  export declare function folderSelect(body: {
10
10
  defaultPath: string;
11
- }, options?: ServicesApi.RequestOptions): Promise<LocalFile.FileSelect>;
11
+ }, optionsQuery?: ServicesApi.RequestOptions): Promise<LocalFile.FileSelect>;
12
12
  export declare function openInFolder(body: {
13
13
  filePath: string;
14
- }, options?: ServicesApi.RequestOptions): Promise<LocalFile.FileSelect>;
14
+ }, optionsQuery?: ServicesApi.RequestOptions): Promise<LocalFile.FileSelect>;
15
15
  export declare function folderOpen(body: {
16
16
  folderPath: string;
17
- }, options?: ServicesApi.RequestOptions): Promise<LocalFile.FileSelect>;
17
+ }, optionsQuery?: ServicesApi.RequestOptions): Promise<LocalFile.FileSelect>;
18
+ export declare function fileListContent(body: {
19
+ fileDir: string;
20
+ extName: string[];
21
+ maxCount: number;
22
+ }, optionsQuery?: ServicesApi.RequestOptions): Promise<string[]>;
23
+ export declare function soundInfo(body: {
24
+ filePath: string;
25
+ isShowCover?: boolean;
26
+ }, optionsQuery?: ServicesApi.RequestOptions): Promise<LocalFile.SoundInfo>;
18
27
  export declare function downUrl(body: {
19
28
  url: string;
20
29
  savePath?: string;
@@ -29,18 +29,22 @@ export function fileSelect(_x3, _x4) {
29
29
  return _fileSelect.apply(this, arguments);
30
30
  }
31
31
  function _fileSelect() {
32
- _fileSelect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(body, options) {
32
+ _fileSelect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(body, optionsQuery) {
33
+ var options;
33
34
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
34
35
  while (1) switch (_context2.prev = _context2.next) {
35
36
  case 0:
37
+ options = _objectSpread(_objectSpread({}, optionsQuery), {}, {
38
+ timeout: 120e3
39
+ });
36
40
  return _context2.abrupt("return", request("_main/file/select", _objectSpread({
37
41
  method: 'POST',
38
42
  headers: {
39
43
  'Content-Type': 'application/json'
40
44
  },
41
45
  data: body
42
- }, options || {})));
43
- case 1:
46
+ }, options)));
47
+ case 2:
44
48
  case "end":
45
49
  return _context2.stop();
46
50
  }
@@ -52,10 +56,14 @@ export function folderSelect(_x5, _x6) {
52
56
  return _folderSelect.apply(this, arguments);
53
57
  }
54
58
  function _folderSelect() {
55
- _folderSelect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(body, options) {
59
+ _folderSelect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(body, optionsQuery) {
60
+ var options;
56
61
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
57
62
  while (1) switch (_context3.prev = _context3.next) {
58
63
  case 0:
64
+ options = _objectSpread(_objectSpread({}, optionsQuery), {}, {
65
+ timeout: 120e3
66
+ });
59
67
  return _context3.abrupt("return", request("_main/file/folderSelect", _objectSpread({
60
68
  method: 'POST',
61
69
  headers: {
@@ -63,7 +71,7 @@ function _folderSelect() {
63
71
  },
64
72
  data: body
65
73
  }, options || {})));
66
- case 1:
74
+ case 2:
67
75
  case "end":
68
76
  return _context3.stop();
69
77
  }
@@ -75,10 +83,14 @@ export function openInFolder(_x7, _x8) {
75
83
  return _openInFolder.apply(this, arguments);
76
84
  }
77
85
  function _openInFolder() {
78
- _openInFolder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(body, options) {
86
+ _openInFolder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(body, optionsQuery) {
87
+ var options;
79
88
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
80
89
  while (1) switch (_context4.prev = _context4.next) {
81
90
  case 0:
91
+ options = _objectSpread(_objectSpread({}, optionsQuery), {}, {
92
+ timeout: 120e3
93
+ });
82
94
  return _context4.abrupt("return", request("_main/file/openInFolder", _objectSpread({
83
95
  method: 'POST',
84
96
  headers: {
@@ -86,7 +98,7 @@ function _openInFolder() {
86
98
  },
87
99
  data: body
88
100
  }, options || {})));
89
- case 1:
101
+ case 2:
90
102
  case "end":
91
103
  return _context4.stop();
92
104
  }
@@ -97,13 +109,15 @@ function _openInFolder() {
97
109
  export function folderOpen(_x9, _x10) {
98
110
  return _folderOpen.apply(this, arguments);
99
111
  }
100
-
101
- // 相对粗糙,假设文件都不大;
102
112
  function _folderOpen() {
103
- _folderOpen = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(body, options) {
113
+ _folderOpen = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(body, optionsQuery) {
114
+ var options;
104
115
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
105
116
  while (1) switch (_context5.prev = _context5.next) {
106
117
  case 0:
118
+ options = _objectSpread(_objectSpread({}, optionsQuery), {}, {
119
+ timeout: 120e3
120
+ });
107
121
  return _context5.abrupt("return", request("_main/file/folderOpen", _objectSpread({
108
122
  method: 'POST',
109
123
  headers: {
@@ -111,7 +125,7 @@ function _folderOpen() {
111
125
  },
112
126
  data: body
113
127
  }, options || {})));
114
- case 1:
128
+ case 2:
115
129
  case "end":
116
130
  return _context5.stop();
117
131
  }
@@ -119,20 +133,76 @@ function _folderOpen() {
119
133
  }));
120
134
  return _folderOpen.apply(this, arguments);
121
135
  }
122
- export function downUrl(_x11, _x12) {
123
- return _downUrl.apply(this, arguments);
136
+ export function fileListContent(_x11, _x12) {
137
+ return _fileListContent.apply(this, arguments);
124
138
  }
125
- function _downUrl() {
126
- _downUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(body, options) {
139
+ function _fileListContent() {
140
+ _fileListContent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(body, optionsQuery) {
141
+ var options;
127
142
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
128
143
  while (1) switch (_context6.prev = _context6.next) {
144
+ case 0:
145
+ options = _objectSpread(_objectSpread({}, optionsQuery), {}, {
146
+ timeout: 120e3
147
+ });
148
+ return _context6.abrupt("return", request("_main/file/fileListContent", _objectSpread({
149
+ method: 'POST',
150
+ headers: {
151
+ 'Content-Type': 'application/json'
152
+ },
153
+ data: body
154
+ }, options || {})));
155
+ case 2:
156
+ case "end":
157
+ return _context6.stop();
158
+ }
159
+ }, _callee6);
160
+ }));
161
+ return _fileListContent.apply(this, arguments);
162
+ }
163
+ export function soundInfo(_x13, _x14) {
164
+ return _soundInfo.apply(this, arguments);
165
+ }
166
+
167
+ // 相对粗糙,假设文件都不大;
168
+ function _soundInfo() {
169
+ _soundInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(body, optionsQuery) {
170
+ var options;
171
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
172
+ while (1) switch (_context7.prev = _context7.next) {
173
+ case 0:
174
+ options = _objectSpread(_objectSpread({}, optionsQuery), {}, {
175
+ timeout: 120e3
176
+ });
177
+ return _context7.abrupt("return", request("_main/sound/info", _objectSpread({
178
+ method: 'POST',
179
+ headers: {
180
+ 'Content-Type': 'application/json'
181
+ },
182
+ data: body
183
+ }, options || {})));
184
+ case 2:
185
+ case "end":
186
+ return _context7.stop();
187
+ }
188
+ }, _callee7);
189
+ }));
190
+ return _soundInfo.apply(this, arguments);
191
+ }
192
+ export function downUrl(_x15, _x16) {
193
+ return _downUrl.apply(this, arguments);
194
+ }
195
+ function _downUrl() {
196
+ _downUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(body, options) {
197
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
198
+ while (1) switch (_context8.prev = _context8.next) {
129
199
  case 0:
130
200
  if (body.savePath) {
131
201
  if (!/\/$/.test(body.savePath)) {
132
202
  body.savePath += '/';
133
203
  }
134
204
  }
135
- return _context6.abrupt("return", request("_local/file/downUrl", _objectSpread({
205
+ return _context8.abrupt("return", request("_local/file/downUrl", _objectSpread({
136
206
  method: 'POST',
137
207
  headers: {
138
208
  'Content-Type': 'application/json'
@@ -144,9 +214,9 @@ function _downUrl() {
144
214
  }))));
145
215
  case 2:
146
216
  case "end":
147
- return _context6.stop();
217
+ return _context8.stop();
148
218
  }
149
- }, _callee6);
219
+ }, _callee8);
150
220
  }));
151
221
  return _downUrl.apply(this, arguments);
152
222
  }
@@ -6,7 +6,8 @@ declare namespace ServicesApi {
6
6
  }
7
7
 
8
8
  interface RequestOptions {
9
- silent: boolean;
9
+ silent?: boolean;
10
+ timeout?: number;
10
11
  [key: string]: any;
11
12
  }
12
13
  }
@@ -11,4 +11,10 @@ declare namespace LocalFile {
11
11
  canceled: boolean;
12
12
  filePaths: string[];
13
13
  }
14
+ interface SoundInfo {
15
+ title: string;
16
+ album: string;
17
+ artist: string;
18
+ coverUrl: string;
19
+ }
14
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "component-shipinlv",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",