component-shipinlv 1.0.50 → 1.1.0

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.
Files changed (39) hide show
  1. package/dist/VideoPublish/account-manage/home.d.ts +1 -0
  2. package/dist/VideoPublish/account-manage/home.js +2 -0
  3. package/dist/VideoPublish/account-manage/list.d.ts +1 -0
  4. package/dist/VideoPublish/account-manage/list.js +25 -19
  5. package/dist/VideoPublish/account-manage/setting/index.js +59 -12
  6. package/dist/VideoPublish/create-task/index.js +8 -4
  7. package/dist/VideoPublish/index.d.ts +1 -0
  8. package/dist/VideoPublish/index.js +22 -10
  9. package/dist/VideoPublish/log/index.d.ts +7 -1
  10. package/dist/VideoPublish/log/index.js +27 -10
  11. package/dist/VideoPublish/log/index.less +44 -46
  12. package/dist/VideoPublish/publish-task-plan/index.d.ts +8 -0
  13. package/dist/VideoPublish/publish-task-plan/index.js +16 -0
  14. package/dist/VideoPublish/publish-task-plan/index.less +4 -0
  15. package/dist/VideoPublish/publish-task-plan/tool.d.ts +16 -0
  16. package/dist/VideoPublish/publish-task-plan/tool.js +349 -0
  17. package/dist/base/fileSelect.d.ts +1 -1
  18. package/dist/base/folderSelect.d.ts +1 -1
  19. package/dist/component/file-select.d.ts +18 -0
  20. package/dist/component/file-select.js +163 -0
  21. package/dist/component/file-select.less +24 -0
  22. package/dist/component/folder-select.d.ts +18 -0
  23. package/dist/component/folder-select.js +190 -0
  24. package/dist/component/folder-select.less +22 -0
  25. package/dist/component/is-installed-chrome.d.ts +2 -0
  26. package/dist/component/is-installed-chrome.js +5 -0
  27. package/dist/index.js +2 -0
  28. package/dist/lib/accountManageSettingConfig.js +8 -1
  29. package/dist/lib/request.js +6 -2
  30. package/dist/service/api/VideoPublishCrawlerTaskController.d.ts +2 -0
  31. package/dist/service/api/VideoPublishCrawlerTaskController.js +51 -0
  32. package/dist/service/api/VideoPublishVideoAccountController.d.ts +1 -1
  33. package/dist/service/api/VideoPublishVideoAccountController.js +6 -6
  34. package/dist/service/local/FileController.d.ts +1 -1
  35. package/dist/types/PublishTaskPlan.d.ts +1 -0
  36. package/dist/typings/VideoPublishAccountManageSetting.d.ts +2 -0
  37. package/dist/typings/VideoPublishVideoAccount.d.ts +1 -1
  38. package/dist/window.d.ts +5 -1
  39. package/package.json +1 -1
@@ -0,0 +1,349 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
5
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
6
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
7
+ import * as VideoPublishCrawlerTaskController from "../../service/api/VideoPublishCrawlerTaskController";
8
+ import sleep from "../../lib/sleep";
9
+ import event from "../../lib/event";
10
+ import AccountManageSettingConfig from "../../lib/accountManageSettingConfig";
11
+ var PublishTaskPlanClass = /*#__PURE__*/function () {
12
+ function PublishTaskPlanClass(env) {
13
+ var clientUniqueKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
14
+ _classCallCheck(this, PublishTaskPlanClass);
15
+ _defineProperty(this, "timeLoopMillisecond", 15 * 1e3);
16
+ _defineProperty(this, "isPublishing", false);
17
+ _defineProperty(this, "env", '');
18
+ _defineProperty(this, "clientUniqueKey", '');
19
+ this.env = env;
20
+ this.clientUniqueKey = clientUniqueKey;
21
+ }
22
+ _createClass(PublishTaskPlanClass, [{
23
+ key: "onInit",
24
+ value: function onInit() {
25
+ var _this = this,
26
+ _window$bridge,
27
+ _window;
28
+ setInterval(function () {
29
+ if (_this.isPublishing) {
30
+ return;
31
+ }
32
+ _this.getWork();
33
+ }, 2e3);
34
+
35
+ // 桥
36
+ (_window$bridge = (_window = window).bridge) === null || _window$bridge === void 0 || (_window$bridge = _window$bridge.call(_window)) === null || _window$bridge === void 0 || _window$bridge.onLog(function (query) {
37
+ event.run('shipinlv-video-publish-log', query);
38
+ });
39
+ }
40
+ }, {
41
+ key: "getWork",
42
+ value: function () {
43
+ var _getWork = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
44
+ var settingConfig, taskDetail;
45
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
46
+ while (1) switch (_context.prev = _context.next) {
47
+ case 0:
48
+ settingConfig = AccountManageSettingConfig();
49
+ if (!settingConfig.disabledApplyTask) {
50
+ _context.next = 3;
51
+ break;
52
+ }
53
+ return _context.abrupt("return");
54
+ case 3:
55
+ this.isPublishing = true;
56
+ _context.next = 6;
57
+ return this.onTaskGet().catch(function (err) {});
58
+ case 6:
59
+ taskDetail = _context.sent;
60
+ if (taskDetail) {
61
+ _context.next = 12;
62
+ break;
63
+ }
64
+ _context.next = 10;
65
+ return sleep(this.timeLoopMillisecond);
66
+ case 10:
67
+ this.isPublishing = false;
68
+ return _context.abrupt("return");
69
+ case 12:
70
+ this.doWork(taskDetail);
71
+ case 13:
72
+ case "end":
73
+ return _context.stop();
74
+ }
75
+ }, _callee, this);
76
+ }));
77
+ function getWork() {
78
+ return _getWork.apply(this, arguments);
79
+ }
80
+ return getWork;
81
+ }()
82
+ }, {
83
+ key: "doWork",
84
+ value: function () {
85
+ var _doWork = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(taskDetail) {
86
+ var _this2 = this;
87
+ var item, saveBaseData, result, errMessage, errLog;
88
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
89
+ while (1) switch (_context2.prev = _context2.next) {
90
+ case 0:
91
+ if (taskDetail.emptyLoopTimeSecond > 10) {
92
+ this.timeLoopMillisecond = taskDetail.emptyLoopTimeSecond * 1e3;
93
+ }
94
+ console.log("taskDetail;", taskDetail);
95
+ item = taskDetail.taskInfo;
96
+ if (!(item.taskType === '')) {
97
+ _context2.next = 8;
98
+ break;
99
+ }
100
+ console.log('无任务');
101
+ _context2.next = 7;
102
+ return this.doWorkWait();
103
+ case 7:
104
+ return _context2.abrupt("return");
105
+ case 8:
106
+ saveBaseData = {
107
+ taskType: item.taskType,
108
+ taskId: item.taskId,
109
+ platform: taskDetail.platform,
110
+ platformAccountId: taskDetail.platformVideoAccountId
111
+ };
112
+ _context2.t0 = item.taskType;
113
+ _context2.next = _context2.t0 === "publish-video" ? 12 : 21;
114
+ break;
115
+ case 12:
116
+ if (item.publishVideo) {
117
+ _context2.next = 16;
118
+ break;
119
+ }
120
+ console.warn("item.publishVideo is empty!");
121
+ this.onReport(false, "publishVideo 不存在", saveBaseData);
122
+ return _context2.abrupt("break", 26);
123
+ case 16:
124
+ _context2.next = 18;
125
+ return this.onPublishVideo(taskDetail.platform, taskDetail.platformVideoAccountId, taskDetail.taskInfo).catch(function (err) {
126
+ console.warn("onPublishVideo err:", err);
127
+ _this2.onReport(false, err === null || err === void 0 ? void 0 : err.message, saveBaseData);
128
+ });
129
+ case 18:
130
+ result = _context2.sent;
131
+ if (result) {
132
+ this.onReport(result.success, result.message, saveBaseData);
133
+ }
134
+ return _context2.abrupt("break", 26);
135
+ case 21:
136
+ errMessage = '暂不支持 类型:' + item.taskType;
137
+ console.log(errMessage);
138
+ errLog = {
139
+ platform: taskDetail.platform,
140
+ platformAccountId: taskDetail.platformVideoAccountId,
141
+ code: 'not-support-task-type',
142
+ message: errMessage,
143
+ status: 'fail',
144
+ taskId: item.taskId,
145
+ eventType: 'task-kind'
146
+ };
147
+ this.onLog(errLog);
148
+ this.onReport(false, errMessage, saveBaseData);
149
+ case 26:
150
+ _context2.next = 28;
151
+ return this.doWorkWait();
152
+ case 28:
153
+ case "end":
154
+ return _context2.stop();
155
+ }
156
+ }, _callee2, this);
157
+ }));
158
+ function doWork(_x) {
159
+ return _doWork.apply(this, arguments);
160
+ }
161
+ return doWork;
162
+ }()
163
+ }, {
164
+ key: "onLog",
165
+ value: function () {
166
+ var _onLog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(query) {
167
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
168
+ while (1) switch (_context3.prev = _context3.next) {
169
+ case 0:
170
+ event.run('shipinlv-video-publish-log', query);
171
+ case 1:
172
+ case "end":
173
+ return _context3.stop();
174
+ }
175
+ }, _callee3);
176
+ }));
177
+ function onLog(_x2) {
178
+ return _onLog.apply(this, arguments);
179
+ }
180
+ return onLog;
181
+ }()
182
+ }, {
183
+ key: "doWorkWait",
184
+ value: function () {
185
+ var _doWorkWait = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
186
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
187
+ while (1) switch (_context4.prev = _context4.next) {
188
+ case 0:
189
+ _context4.next = 2;
190
+ return sleep(this.timeLoopMillisecond);
191
+ case 2:
192
+ this.isPublishing = false;
193
+ case 3:
194
+ case "end":
195
+ return _context4.stop();
196
+ }
197
+ }, _callee4, this);
198
+ }));
199
+ function doWorkWait() {
200
+ return _doWorkWait.apply(this, arguments);
201
+ }
202
+ return doWorkWait;
203
+ }()
204
+ }, {
205
+ key: "onReport",
206
+ value: function onReport(success, message, saveBaseData) {
207
+ VideoPublishCrawlerTaskController.report(_objectSpread({
208
+ success: success,
209
+ message: message
210
+ }, saveBaseData), {
211
+ env: this.env
212
+ });
213
+ }
214
+ }, {
215
+ key: "onTaskGet",
216
+ value: function () {
217
+ var _onTaskGet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
218
+ var env;
219
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
220
+ while (1) switch (_context5.prev = _context5.next) {
221
+ case 0:
222
+ event.run('task-apply');
223
+ env = this.env;
224
+ _context5.next = 4;
225
+ return VideoPublishCrawlerTaskController.apply({}, {
226
+ env: env
227
+ });
228
+ case 4:
229
+ return _context5.abrupt("return", _context5.sent);
230
+ case 5:
231
+ case "end":
232
+ return _context5.stop();
233
+ }
234
+ }, _callee5, this);
235
+ }));
236
+ function onTaskGet() {
237
+ return _onTaskGet.apply(this, arguments);
238
+ }
239
+ return onTaskGet;
240
+ }()
241
+ }, {
242
+ key: "onPublishVideo",
243
+ value: function () {
244
+ var _onPublishVideo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(platform, platformVideoAccountId, taskInfo) {
245
+ var _this3 = this;
246
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
247
+ while (1) switch (_context7.prev = _context7.next) {
248
+ case 0:
249
+ _context7.next = 2;
250
+ return sleep(1);
251
+ case 2:
252
+ return _context7.abrupt("return", new Promise( /*#__PURE__*/function () {
253
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(resolve, reject) {
254
+ var _window$bridge2, _window2;
255
+ var settingConfig, publishResult, errLog, err;
256
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
257
+ while (1) switch (_context6.prev = _context6.next) {
258
+ case 0:
259
+ settingConfig = AccountManageSettingConfig();
260
+ console.log('settingConfig 1:', settingConfig);
261
+ _context6.next = 4;
262
+ return (_window$bridge2 = (_window2 = window).bridge) === null || _window$bridge2 === void 0 ? void 0 : _window$bridge2.call(_window2).videoPublish({
263
+ platformVideoAccountId: platformVideoAccountId,
264
+ platform: platform,
265
+ open: settingConfig.isChromeOpen,
266
+ // 发布视频的时候是否打开图形界面
267
+ taskInfo: taskInfo
268
+ // taskInfo: {
269
+ // taskId: detail.taskId,
270
+ // taskType:
271
+ // publishVideo: {
272
+ // taskId: detail.taskId,
273
+ // title: detail.title, // "视频标题",
274
+ // introduction: detail.introduction, //"视频简介",
275
+ // videoKindTag: detail.videoKindTag, //"", // shopping | ""
276
+ // videoUrl: detail.videoUrl, //"视频地址",
277
+ // publishTime: detail.publishTime, //"2024-08-14 10:00", // 可以是int也可以是string
278
+ // kindTagValue: detail.kindTagValue, // "" // 抖音是商品链接 快手是商品relItemId
279
+ // }
280
+ // },
281
+ }).catch(function (err) {
282
+ // 基本不会到这里
283
+ console.warn('bridge. video Publish err:', err.code, err);
284
+ resolve(err);
285
+ });
286
+ case 4:
287
+ publishResult = _context6.sent;
288
+ if (publishResult) {
289
+ _context6.next = 7;
290
+ break;
291
+ }
292
+ return _context6.abrupt("return", publishResult);
293
+ case 7:
294
+ console.log("publishResult:", publishResult);
295
+ if (publishResult.success) {
296
+ _context6.next = 14;
297
+ break;
298
+ }
299
+ errLog = {
300
+ platform: publishResult.data.platform,
301
+ platformAccountId: publishResult.data.platformVideoAccountId,
302
+ code: publishResult.code,
303
+ message: publishResult.message,
304
+ status: 'fail',
305
+ taskId: taskInfo.taskId,
306
+ eventType: 'publish-video'
307
+ }; // event.run('lo g', errLog);
308
+ _this3.onLog(errLog);
309
+ err = new Error(publishResult.message);
310
+ err.name = publishResult.code;
311
+ return _context6.abrupt("return", reject(err));
312
+ case 14:
313
+ resolve(publishResult);
314
+
315
+ // const logReceive: Log.Receive = {
316
+ // platform: publishResult.data.platform,
317
+ // platformAccountId: publishResult.data.platformVideoAccountId,
318
+ // code: 'publish-video-finish',
319
+ // message: '',
320
+ // status: 'success',
321
+ // taskId: 0,
322
+ // eventType: 'task-kind'
323
+ // }
324
+ // event.run('lo g', logReceive);
325
+ case 15:
326
+ case "end":
327
+ return _context6.stop();
328
+ }
329
+ }, _callee6);
330
+ }));
331
+ return function (_x6, _x7) {
332
+ return _ref.apply(this, arguments);
333
+ };
334
+ }()));
335
+ case 3:
336
+ case "end":
337
+ return _context7.stop();
338
+ }
339
+ }, _callee7);
340
+ }));
341
+ function onPublishVideo(_x3, _x4, _x5) {
342
+ return _onPublishVideo.apply(this, arguments);
343
+ }
344
+ return onPublishVideo;
345
+ }()
346
+ }]);
347
+ return PublishTaskPlanClass;
348
+ }();
349
+ export default PublishTaskPlanClass;
@@ -1,2 +1,2 @@
1
- declare const fileSelect: (fileType: 'video' | 'video+image' | 'image' | 'sound' | '') => Promise<LocalFile.FileSelect>;
1
+ declare const fileSelect: (fileType: 'video' | 'video+image' | 'image' | 'sound' | string) => Promise<LocalFile.FileSelect>;
2
2
  export default fileSelect;
@@ -1,2 +1,2 @@
1
- declare const folderSelect: (defaultPath: string) => Promise<unknown>;
1
+ declare const folderSelect: (defaultPath: string) => Promise<LocalFile.FileSelect>;
2
2
  export default folderSelect;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import "./file-select.less";
3
+ import { SizeType } from "antd/es/config-provider/SizeContext";
4
+ interface Props {
5
+ defaultPath?: string;
6
+ path?: string;
7
+ allowClear?: boolean;
8
+ size?: SizeType;
9
+ extName: string;
10
+ label?: React.ReactNode;
11
+ placeholder?: string;
12
+ disabled?: boolean;
13
+ onBeforeSelect?: () => Promise<boolean>;
14
+ disabledChangeFile?: boolean;
15
+ onFinish: (dir: string) => void;
16
+ }
17
+ declare const FileSelect: React.FC<Props>;
18
+ export default FileSelect;
@@ -0,0 +1,163 @@
1
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
+ import React, { useEffect, useState } from 'react';
5
+ import Tool from "../lib/Tool";
6
+ import "./file-select.less";
7
+ import { Button, Input, Space } from "antd";
8
+ import { FolderOutlined } from "@ant-design/icons";
9
+ import { fileSelect } from "./..";
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { jsxs as _jsxs } from "react/jsx-runtime";
12
+ var FileSelect = function FileSelect(_ref) {
13
+ var _ref$defaultPath = _ref.defaultPath,
14
+ defaultPath = _ref$defaultPath === void 0 ? '' : _ref$defaultPath,
15
+ _ref$path = _ref.path,
16
+ path = _ref$path === void 0 ? '' : _ref$path,
17
+ size = _ref.size,
18
+ extName = _ref.extName,
19
+ allowClear = _ref.allowClear,
20
+ _ref$label = _ref.label,
21
+ label = _ref$label === void 0 ? '' : _ref$label,
22
+ disabled = _ref.disabled,
23
+ _ref$placeholder = _ref.placeholder,
24
+ placeholder = _ref$placeholder === void 0 ? '请选择文件' : _ref$placeholder,
25
+ _ref$disabledChangeFi = _ref.disabledChangeFile,
26
+ disabledChangeFile = _ref$disabledChangeFi === void 0 ? false : _ref$disabledChangeFi,
27
+ onBeforeSelect = _ref.onBeforeSelect,
28
+ _ref$onFinish = _ref.onFinish,
29
+ onFinish = _ref$onFinish === void 0 ? function () {} : _ref$onFinish;
30
+ var _useState = useState(defaultPath),
31
+ _useState2 = _slicedToArray(_useState, 2),
32
+ filePath = _useState2[0],
33
+ setFilePath = _useState2[1];
34
+ var _useState3 = useState(false),
35
+ _useState4 = _slicedToArray(_useState3, 2),
36
+ loadingSelectDir = _useState4[0],
37
+ setLoadingSelectDir = _useState4[1];
38
+ var _useState5 = useState(false),
39
+ _useState6 = _slicedToArray(_useState5, 2),
40
+ loadingOpenDir = _useState6[0],
41
+ setLoadingOpenDir = _useState6[1];
42
+ var onSelectDir = /*#__PURE__*/function () {
43
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
44
+ var _fileResul$filePaths;
45
+ var beforeSelectResult, fileResul, filePaths, selectFolderPath;
46
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
47
+ while (1) switch (_context.prev = _context.next) {
48
+ case 0:
49
+ setLoadingSelectDir(true);
50
+ if (!(typeof onBeforeSelect === 'function')) {
51
+ _context.next = 8;
52
+ break;
53
+ }
54
+ _context.next = 4;
55
+ return onBeforeSelect().catch(function (err) {});
56
+ case 4:
57
+ beforeSelectResult = _context.sent;
58
+ if (!(beforeSelectResult === false)) {
59
+ _context.next = 8;
60
+ break;
61
+ }
62
+ setLoadingSelectDir(false);
63
+ return _context.abrupt("return");
64
+ case 8:
65
+ _context.next = 10;
66
+ return fileSelect(extName).catch(function (err) {
67
+ Tool.toastError('选取文件失败:' + (err === null || err === void 0 ? void 0 : err.message));
68
+ });
69
+ case 10:
70
+ fileResul = _context.sent;
71
+ setTimeout(function () {
72
+ setLoadingSelectDir(false);
73
+ }, 1e3);
74
+ if (fileResul) {
75
+ _context.next = 14;
76
+ break;
77
+ }
78
+ return _context.abrupt("return");
79
+ case 14:
80
+ filePaths = (fileResul === null || fileResul === void 0 ? void 0 : fileResul.filePaths) || [];
81
+ if (!(filePaths.length <= 0)) {
82
+ _context.next = 17;
83
+ break;
84
+ }
85
+ return _context.abrupt("return");
86
+ case 17:
87
+ selectFolderPath = (fileResul === null || fileResul === void 0 || (_fileResul$filePaths = fileResul.filePaths) === null || _fileResul$filePaths === void 0 ? void 0 : _fileResul$filePaths[0]) || '';
88
+ console.log("selectFolderPath 2:", selectFolderPath);
89
+ if (selectFolderPath) {
90
+ Tool.toast('已选择文件');
91
+ onFinish(selectFolderPath);
92
+ onDir(selectFolderPath);
93
+ }
94
+ case 20:
95
+ case "end":
96
+ return _context.stop();
97
+ }
98
+ }, _callee);
99
+ }));
100
+ return function onSelectDir() {
101
+ return _ref2.apply(this, arguments);
102
+ };
103
+ }();
104
+ var onDir = function onDir(filePath) {
105
+ setFilePath(filePath);
106
+ onFinish(filePath);
107
+ };
108
+
109
+ // const onOpenDir = async () => {
110
+ // setLoadingOpenDir( true );
111
+ //
112
+ // const fileResul = await folderOpen( filePath )
113
+ // .catch( err => {
114
+ // Tool.toastError('选取文件失败:'+ err?.message )
115
+ // });
116
+ //
117
+ // setTimeout(() => {
118
+ // setLoadingOpenDir( false );
119
+ // }, 1e3 );
120
+ // }
121
+
122
+ useEffect(function () {
123
+ setFilePath(path);
124
+ }, [path]);
125
+ return /*#__PURE__*/_jsx("div", {
126
+ className: "fileSelect",
127
+ children: /*#__PURE__*/_jsx("div", {
128
+ className: "savePathContent",
129
+ children: /*#__PURE__*/_jsxs("div", {
130
+ className: "savePathWarp",
131
+ children: [/*#__PURE__*/_jsx(Input, {
132
+ value: /^\d+$/g.test(filePath) ? '[已选择 - 文件空间文件]' : filePath,
133
+ allowClear: allowClear,
134
+ disabled: disabled,
135
+ addonBefore: label,
136
+ placeholder: placeholder,
137
+ size: size,
138
+ onChange: function onChange(e) {
139
+ var inputPath = e.target.value;
140
+ // 只允许 清空
141
+ if (!inputPath) {
142
+ onDir(inputPath);
143
+ }
144
+ },
145
+ className: "input"
146
+ }), /*#__PURE__*/_jsx("div", {
147
+ className: "option",
148
+ children: /*#__PURE__*/_jsx(Space, {
149
+ children: /*#__PURE__*/_jsx(Button, {
150
+ onClick: onSelectDir,
151
+ loading: loadingSelectDir,
152
+ icon: /*#__PURE__*/_jsx(FolderOutlined, {}),
153
+ disabled: disabled || disabledChangeFile,
154
+ size: size,
155
+ children: filePath ? '更改' : '选择'
156
+ })
157
+ })
158
+ })]
159
+ })
160
+ })
161
+ });
162
+ };
163
+ export default FileSelect;
@@ -0,0 +1,24 @@
1
+ .fileSelect{
2
+ .savePathContent{
3
+ z-index: 30;
4
+ .savePathWarp{
5
+ display: flex;
6
+ flex-direction: row;
7
+ .option{
8
+ padding: 0 0 0 8px;
9
+ }
10
+ }
11
+ :global{
12
+ .ant-input{
13
+ font-size: 12px;
14
+ color: #555;
15
+
16
+
17
+ }
18
+ }
19
+ }
20
+ .input{
21
+
22
+ }
23
+ }
24
+
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import "./folder-select.less";
3
+ import { SizeType } from "antd/es/config-provider/SizeContext";
4
+ interface Props {
5
+ defaultPath?: string;
6
+ path?: string;
7
+ allowClear?: boolean;
8
+ size?: SizeType;
9
+ label?: React.ReactNode;
10
+ placeholder?: string;
11
+ disabled?: boolean;
12
+ onBeforeSelect?: () => Promise<boolean>;
13
+ hiddenOpenDir?: boolean;
14
+ disabledChangeDir?: boolean;
15
+ onFinish: (dir: string) => void;
16
+ }
17
+ declare const FolderSelect: React.FC<Props>;
18
+ export default FolderSelect;