linkmore-design 1.0.67 → 1.0.68
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/dist/Approval/handle.d.ts +11 -0
- package/dist/Approval/type.d.ts +39 -8
- package/dist/Approval/util.d.ts +26 -0
- package/dist/AutoComplete/index.d.ts +2 -1
- package/dist/Calendar/demos/basic.d.ts +2 -0
- package/dist/Calendar/index.d.ts +4 -0
- package/dist/Calendar/style/index.d.ts +1 -0
- package/dist/CardTable/hooks/usePagination.d.ts +1 -1
- package/dist/CardTable/utils.d.ts +2 -2
- package/dist/Carousel/demos/basic.d.ts +2 -0
- package/dist/Carousel/index.d.ts +3 -0
- package/dist/Carousel/style/index.d.ts +1 -0
- package/dist/CkFilter/components/CascaderFilter.d.ts +1 -1
- package/dist/Collapse/demos/basic.d.ts +2 -0
- package/dist/Collapse/index.d.ts +3 -0
- package/dist/Collapse/style/index.d.ts +1 -0
- package/dist/Comment/demos/basic.d.ts +2 -0
- package/dist/Comment/index.d.ts +3 -0
- package/dist/Comment/style/index.d.ts +1 -0
- package/dist/LmFilter/components/CascaderFilter.d.ts +1 -1
- package/dist/LmFilter/components/CheckboxFilter.d.ts +1 -1
- package/dist/LmFilter/components/DateFilter.d.ts +1 -1
- package/dist/LmFilter/components/SelectFilter.d.ts +1 -1
- package/dist/LmSelect/useCheckboxOptions.d.ts +1 -1
- package/dist/LmTable/components/DndContainer.d.ts +5 -0
- package/dist/LmTable/components/sortableBoxCol.d.ts +5 -0
- package/dist/LmTable/components/sortableItemCol.d.ts +1 -0
- package/dist/LmTable/demos/tableColSort.d.ts +2 -0
- package/dist/LmUpload/LmUpload.d.ts +4 -1
- package/dist/LmUpload/UploadList/index.d.ts +1 -1
- package/dist/LmUpload/body/Progress.d.ts +4 -0
- package/dist/LmUpload/fns/index.d.ts +4 -1
- package/dist/Modal/index.d.ts +1 -1
- package/dist/Popconfirm/demos/basic.d.ts +2 -0
- package/dist/Popconfirm/index.d.ts +3 -0
- package/dist/Popconfirm/style/index.d.ts +1 -0
- package/dist/Progress/demos/basic.d.ts +2 -0
- package/dist/Progress/demos/circle.d.ts +2 -0
- package/dist/Progress/demos/dynamic.d.ts +2 -0
- package/dist/Progress/demos/small.d.ts +2 -0
- package/dist/Progress/index.d.ts +3 -0
- package/dist/Progress/style/index.d.ts +1 -0
- package/dist/Segmented/demos/basic.d.ts +2 -0
- package/dist/Segmented/index.d.ts +3 -0
- package/dist/Segmented/style/index.d.ts +1 -0
- package/dist/Slider/demos/basic.d.ts +2 -0
- package/dist/Slider/index.d.ts +2 -0
- package/dist/Slider/style/index.d.ts +1 -0
- package/dist/Statistic/demos/basic.d.ts +2 -0
- package/dist/Statistic/index.d.ts +3 -0
- package/dist/Statistic/style/index.d.ts +1 -0
- package/dist/TimePicker/demos/basic.d.ts +3 -0
- package/dist/TimePicker/index.d.ts +3 -0
- package/dist/TimePicker/style/index.d.ts +1 -0
- package/dist/Timeline/demos/basic.d.ts +2 -0
- package/dist/Timeline/index.d.ts +3 -0
- package/dist/Timeline/style/index.d.ts +1 -0
- package/dist/Transfer/demos/basic.d.ts +2 -0
- package/dist/Transfer/index.d.ts +3 -0
- package/dist/Transfer/style/index.d.ts +1 -0
- package/dist/TreeSelect/demos/basic.d.ts +2 -0
- package/dist/TreeSelect/index.d.ts +3 -0
- package/dist/TreeSelect/style/index.d.ts +1 -0
- package/dist/hooks/useFullscreen/demos/useInModal.d.ts +2 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.umd.js +3780 -1343
- package/dist/index.umd.min.js +6 -6
- package/es/Alert/index.js +27 -5
- package/es/Alert/style/index.css +1 -1
- package/es/Approval/handle.d.ts +11 -0
- package/es/Approval/handle.js +138 -0
- package/es/Approval/index.js +279 -121
- package/es/Approval/style/index.css +42 -4
- package/es/Approval/type.d.ts +39 -8
- package/es/Approval/type.js +97 -1
- package/es/Approval/util.d.ts +26 -0
- package/es/Approval/util.js +132 -0
- package/es/AutoComplete/index.d.ts +2 -1
- package/es/Calendar/index.d.ts +4 -0
- package/es/Calendar/index.js +3 -0
- package/es/Calendar/style/index.css +505 -0
- package/es/Calendar/style/index.d.ts +1 -0
- package/es/Calendar/style/index.js +1 -0
- package/es/Carousel/index.d.ts +3 -0
- package/es/Carousel/index.js +3 -0
- package/es/Carousel/style/index.css +505 -0
- package/es/Carousel/style/index.d.ts +1 -0
- package/es/Carousel/style/index.js +1 -0
- package/es/Collapse/index.d.ts +3 -0
- package/es/Collapse/index.js +3 -0
- package/es/Collapse/style/index.css +505 -0
- package/es/Collapse/style/index.d.ts +1 -0
- package/es/Collapse/style/index.js +1 -0
- package/es/Comment/index.d.ts +3 -0
- package/es/Comment/index.js +3 -0
- package/es/Comment/style/index.css +505 -0
- package/es/Comment/style/index.d.ts +1 -0
- package/es/Comment/style/index.js +1 -0
- package/es/LmEditTable/EditTable.js +5 -3
- package/es/LmEditTable/style/index.css +6 -0
- package/es/LmFilter/customFilter/index.js +2 -1
- package/es/LmFilter/customFilter/saveModal.js +5 -6
- package/es/LmFilter/filterFns/index.js +0 -1
- package/es/LmSelect/useCheckboxOptions.d.ts +1 -1
- package/es/LmTable/Table.js +79 -45
- package/es/LmTable/components/DndContainer.d.ts +5 -0
- package/es/LmTable/components/DndContainer.js +35 -0
- package/es/LmTable/components/sortableBoxCol.js +24 -0
- package/es/LmTable/components/sortableItemCol.js +54 -0
- package/es/LmUpload/LmUpload.d.ts +4 -1
- package/es/LmUpload/LmUpload.js +30 -6
- package/es/LmUpload/UploadList/ItemPictureCard.js +67 -10
- package/es/LmUpload/UploadList/index.d.ts +1 -1
- package/es/LmUpload/UploadList/index.js +3 -2
- package/es/LmUpload/body/Progress.d.ts +4 -0
- package/es/LmUpload/body/Progress.js +16 -0
- package/es/LmUpload/body/UploadCore.js +16 -10
- package/es/LmUpload/body/UploadPicture.js +12 -4
- package/es/LmUpload/fns/index.d.ts +3 -0
- package/es/LmUpload/fns/index.js +135 -25
- package/es/LmUpload/style/index.css +20 -3
- package/es/LmUpload/wrapper/reducer.js +7 -1
- package/es/Modal/index.d.ts +1 -1
- package/es/Popconfirm/index.d.ts +3 -0
- package/es/Popconfirm/index.js +3 -0
- package/es/Popconfirm/style/index.css +505 -0
- package/es/Popconfirm/style/index.d.ts +1 -0
- package/es/Popconfirm/style/index.js +1 -0
- package/es/Progress/index.d.ts +3 -0
- package/es/Progress/index.js +3 -0
- package/es/Progress/style/index.css +505 -0
- package/es/Progress/style/index.d.ts +1 -0
- package/es/Progress/style/index.js +1 -0
- package/es/Segmented/index.d.ts +3 -0
- package/es/Segmented/index.js +3 -0
- package/es/Segmented/style/index.css +505 -0
- package/es/Segmented/style/index.d.ts +1 -0
- package/es/Segmented/style/index.js +1 -0
- package/es/Slider/index.d.ts +2 -0
- package/es/Slider/index.js +3 -0
- package/es/Slider/style/index.css +505 -0
- package/es/Slider/style/index.d.ts +1 -0
- package/es/Slider/style/index.js +1 -0
- package/es/Statistic/index.d.ts +3 -0
- package/es/Statistic/index.js +3 -0
- package/es/Statistic/style/index.css +505 -0
- package/es/Statistic/style/index.d.ts +1 -0
- package/es/Statistic/style/index.js +1 -0
- package/es/TimePicker/index.d.ts +3 -0
- package/es/TimePicker/index.js +3 -0
- package/es/TimePicker/style/index.css +505 -0
- package/es/TimePicker/style/index.d.ts +1 -0
- package/es/TimePicker/style/index.js +1 -0
- package/es/Timeline/index.d.ts +3 -0
- package/es/Timeline/index.js +3 -0
- package/es/Timeline/style/index.css +505 -0
- package/es/Timeline/style/index.d.ts +1 -0
- package/es/Timeline/style/index.js +1 -0
- package/es/Transfer/index.d.ts +3 -0
- package/es/Transfer/index.js +3 -0
- package/es/Transfer/style/index.css +505 -0
- package/es/Transfer/style/index.d.ts +1 -0
- package/es/Transfer/style/index.js +1 -0
- package/es/TreeSelect/index.d.ts +3 -0
- package/es/TreeSelect/index.js +3 -0
- package/es/TreeSelect/style/index.css +505 -0
- package/es/TreeSelect/style/index.d.ts +1 -0
- package/es/TreeSelect/style/index.js +1 -0
- package/es/hooks/useFullscreen/index.js +6 -8
- package/es/index.d.ts +18 -0
- package/es/index.js +10 -1
- package/lib/Alert/index.js +27 -5
- package/lib/Alert/style/index.css +1 -1
- package/lib/Approval/handle.d.ts +11 -0
- package/lib/Approval/handle.js +160 -0
- package/lib/Approval/index.js +286 -121
- package/lib/Approval/style/index.css +42 -4
- package/lib/Approval/type.d.ts +39 -8
- package/lib/Approval/type.js +101 -1
- package/lib/Approval/util.d.ts +26 -0
- package/lib/Approval/util.js +148 -0
- package/lib/AutoComplete/index.d.ts +2 -1
- package/lib/Calendar/index.d.ts +4 -0
- package/lib/Calendar/index.js +15 -0
- package/lib/Calendar/style/index.css +505 -0
- package/lib/Calendar/style/index.d.ts +1 -0
- package/lib/Calendar/style/index.js +3 -0
- package/lib/Carousel/index.d.ts +3 -0
- package/lib/Carousel/index.js +15 -0
- package/lib/Carousel/style/index.css +505 -0
- package/lib/Carousel/style/index.d.ts +1 -0
- package/lib/Carousel/style/index.js +3 -0
- package/lib/Collapse/index.d.ts +3 -0
- package/lib/Collapse/index.js +15 -0
- package/lib/Collapse/style/index.css +505 -0
- package/lib/Collapse/style/index.d.ts +1 -0
- package/lib/Collapse/style/index.js +3 -0
- package/lib/Comment/index.d.ts +3 -0
- package/lib/Comment/index.js +15 -0
- package/lib/Comment/style/index.css +505 -0
- package/lib/Comment/style/index.d.ts +1 -0
- package/lib/Comment/style/index.js +3 -0
- package/lib/LmEditTable/EditTable.js +5 -3
- package/lib/LmEditTable/style/index.css +6 -0
- package/lib/LmFilter/customFilter/index.js +2 -1
- package/lib/LmFilter/customFilter/saveModal.js +5 -6
- package/lib/LmFilter/filterFns/index.js +0 -1
- package/lib/LmSelect/useCheckboxOptions.d.ts +1 -1
- package/lib/LmTable/Table.js +79 -45
- package/lib/LmTable/components/DndContainer.d.ts +5 -0
- package/lib/LmTable/components/DndContainer.js +49 -0
- package/lib/LmTable/components/sortableBoxCol.js +24 -0
- package/lib/LmTable/components/sortableItemCol.js +54 -0
- package/lib/LmUpload/LmUpload.d.ts +4 -1
- package/lib/LmUpload/LmUpload.js +31 -6
- package/lib/LmUpload/UploadList/ItemPictureCard.js +66 -10
- package/lib/LmUpload/UploadList/index.d.ts +1 -1
- package/lib/LmUpload/UploadList/index.js +6 -2
- package/lib/LmUpload/body/Progress.d.ts +4 -0
- package/lib/LmUpload/body/{UploadDrag.js → Progress.js} +10 -5
- package/lib/LmUpload/body/UploadCore.js +16 -10
- package/lib/LmUpload/body/UploadPicture.js +14 -3
- package/lib/LmUpload/fns/index.d.ts +3 -0
- package/lib/LmUpload/fns/index.js +141 -29
- package/lib/LmUpload/style/index.css +20 -3
- package/lib/LmUpload/wrapper/reducer.js +7 -1
- package/lib/Modal/index.d.ts +1 -1
- package/lib/Popconfirm/index.d.ts +3 -0
- package/lib/Popconfirm/index.js +15 -0
- package/lib/Popconfirm/style/index.css +505 -0
- package/lib/Popconfirm/style/index.d.ts +1 -0
- package/lib/Popconfirm/style/index.js +3 -0
- package/lib/Progress/index.d.ts +3 -0
- package/lib/Progress/index.js +15 -0
- package/lib/Progress/style/index.css +505 -0
- package/lib/Progress/style/index.d.ts +1 -0
- package/lib/Progress/style/index.js +3 -0
- package/lib/Segmented/index.d.ts +3 -0
- package/lib/Segmented/index.js +15 -0
- package/lib/Segmented/style/index.css +505 -0
- package/lib/Segmented/style/index.d.ts +1 -0
- package/lib/Segmented/style/index.js +3 -0
- package/lib/Slider/index.d.ts +2 -0
- package/lib/Slider/index.js +15 -0
- package/lib/Slider/style/index.css +505 -0
- package/lib/Slider/style/index.d.ts +1 -0
- package/lib/Slider/style/index.js +3 -0
- package/lib/Statistic/index.d.ts +3 -0
- package/lib/Statistic/index.js +15 -0
- package/lib/Statistic/style/index.css +505 -0
- package/lib/Statistic/style/index.d.ts +1 -0
- package/lib/Statistic/style/index.js +3 -0
- package/lib/TimePicker/index.d.ts +3 -0
- package/lib/TimePicker/index.js +15 -0
- package/lib/TimePicker/style/index.css +505 -0
- package/lib/TimePicker/style/index.d.ts +1 -0
- package/lib/TimePicker/style/index.js +3 -0
- package/lib/Timeline/index.d.ts +3 -0
- package/lib/Timeline/index.js +15 -0
- package/lib/Timeline/style/index.css +505 -0
- package/lib/Timeline/style/index.d.ts +1 -0
- package/lib/Timeline/style/index.js +3 -0
- package/lib/Transfer/index.d.ts +3 -0
- package/lib/Transfer/index.js +15 -0
- package/lib/Transfer/style/index.css +505 -0
- package/lib/Transfer/style/index.d.ts +1 -0
- package/lib/Transfer/style/index.js +3 -0
- package/lib/TreeSelect/index.d.ts +3 -0
- package/lib/TreeSelect/index.js +15 -0
- package/lib/TreeSelect/style/index.css +505 -0
- package/lib/TreeSelect/style/index.d.ts +1 -0
- package/lib/TreeSelect/style/index.js +3 -0
- package/lib/hooks/useFullscreen/index.js +6 -10
- package/lib/index.d.ts +18 -0
- package/lib/index.js +73 -1
- package/package.json +2 -1
- package/typings/index.d.ts +1 -1
- package/dist/LmUpload/body/UploadDrag.d.ts +0 -4
- package/es/LmUpload/body/UploadDrag.d.ts +0 -4
- package/es/LmUpload/body/UploadDrag.js +0 -10
- package/lib/LmUpload/body/UploadDrag.d.ts +0 -4
package/es/LmUpload/fns/index.js
CHANGED
|
@@ -1,38 +1,148 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
|
|
4
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
5
|
+
function adopt(value) {
|
|
6
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
7
|
+
resolve(value);
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
12
|
+
function fulfilled(value) {
|
|
13
|
+
try {
|
|
14
|
+
step(generator.next(value));
|
|
15
|
+
} catch (e) {
|
|
16
|
+
reject(e);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function rejected(value) {
|
|
21
|
+
try {
|
|
22
|
+
step(generator["throw"](value));
|
|
23
|
+
} catch (e) {
|
|
24
|
+
reject(e);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function step(result) {
|
|
29
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
import { useCallback } from 'react';
|
|
2
37
|
import { message } from 'linkmore-design';
|
|
38
|
+
import OSS from 'ali-oss';
|
|
3
39
|
|
|
4
40
|
var useCoreOptions = function useCoreOptions(_ref) {
|
|
5
41
|
var state = _ref.state,
|
|
6
42
|
dispatch = _ref.dispatch,
|
|
7
43
|
props = _ref.props;
|
|
8
|
-
var
|
|
9
|
-
onChange = props.onChange,
|
|
10
|
-
size = props.size,
|
|
44
|
+
var onChange = props.onChange,
|
|
11
45
|
type = props.type,
|
|
12
46
|
fileSize = props.fileSize,
|
|
13
|
-
|
|
47
|
+
ossConfig = props.ossConfig; // 上传完成
|
|
14
48
|
|
|
15
|
-
var uploadOnChange = function
|
|
49
|
+
var uploadOnChange = useCallback(function (file) {
|
|
16
50
|
var fileList = [file].concat(_toConsumableArray(state.fileList));
|
|
17
|
-
console.log('fileList', fileList);
|
|
18
51
|
dispatch({
|
|
19
52
|
type: 'changeFileList',
|
|
20
53
|
fileList: fileList
|
|
54
|
+
});
|
|
55
|
+
dispatch({
|
|
56
|
+
type: 'changePercent',
|
|
57
|
+
percent: null
|
|
21
58
|
}); // 上传事件:抛出 file: 文件 filelist: 文件列表 event: 上传进度信息
|
|
22
59
|
|
|
23
60
|
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
24
61
|
file: file,
|
|
25
|
-
fileList: fileList
|
|
26
|
-
event: event
|
|
62
|
+
fileList: fileList
|
|
27
63
|
});
|
|
28
|
-
}; //
|
|
64
|
+
}, [state.fileList]); // 上传至ali-oss
|
|
65
|
+
|
|
66
|
+
var uploadOss = useCallback(function (file) {
|
|
67
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
68
|
+
var _a, dir, shortlink, region, accessKeyId, accessKeySecret, stsToken, bucket, client, fileName, pathName, url, result, seq, params;
|
|
69
|
+
|
|
70
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
71
|
+
while (1) {
|
|
72
|
+
switch (_context.prev = _context.next) {
|
|
73
|
+
case 0:
|
|
74
|
+
dir = ossConfig.dir, shortlink = ossConfig.shortlink, region = ossConfig.region, accessKeyId = ossConfig.accessKeyId, accessKeySecret = ossConfig.accessKeySecret, stsToken = ossConfig.stsToken, bucket = ossConfig.bucket;
|
|
75
|
+
client = new OSS({
|
|
76
|
+
region: region,
|
|
77
|
+
accessKeyId: accessKeyId,
|
|
78
|
+
accessKeySecret: accessKeySecret,
|
|
79
|
+
stsToken: stsToken,
|
|
80
|
+
bucket: bucket
|
|
81
|
+
});
|
|
82
|
+
_context.prev = 2;
|
|
83
|
+
fileName = "".concat(Date.now(), "-").concat(file.name);
|
|
84
|
+
pathName = dir.slice(-1) === '/' ? "".concat(dir).concat(fileName) : "".concat(dir, "/").concat(fileName);
|
|
85
|
+
url = "".concat(shortlink).concat(pathName) || '';
|
|
86
|
+
_context.next = 8;
|
|
87
|
+
return client.multipartUpload(pathName, file, {
|
|
88
|
+
// 获取分片上传进度、断点和返回值。
|
|
89
|
+
progress: function progress(p, cpt, res) {
|
|
90
|
+
onChange({
|
|
91
|
+
event: {
|
|
92
|
+
progress: p,
|
|
93
|
+
checkPoint: cpt,
|
|
94
|
+
result: res
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
dispatch({
|
|
98
|
+
type: 'changePercent',
|
|
99
|
+
percent: Number((p * 100).toFixed(2))
|
|
100
|
+
});
|
|
101
|
+
},
|
|
102
|
+
parallel: 4,
|
|
103
|
+
partSize: 1024 * 1024 // 分片大小
|
|
29
104
|
|
|
105
|
+
});
|
|
30
106
|
|
|
31
|
-
|
|
32
|
-
|
|
107
|
+
case 8:
|
|
108
|
+
result = _context.sent;
|
|
109
|
+
seq = (((_a = state.fileList) === null || _a === void 0 ? void 0 : _a.length) || 0) + 1;
|
|
110
|
+
params = {
|
|
111
|
+
fileTypeCode: file.type,
|
|
112
|
+
fileTypeName: file.type,
|
|
113
|
+
fileName: fileName,
|
|
114
|
+
realFileName: file.name,
|
|
115
|
+
fileSize: file.size,
|
|
116
|
+
internalUrl: '',
|
|
117
|
+
externalUrl: 'externalUrl',
|
|
118
|
+
filePath: dir,
|
|
119
|
+
seq: seq,
|
|
120
|
+
url: url
|
|
121
|
+
};
|
|
122
|
+
uploadOnChange(params);
|
|
123
|
+
console.log('result', result);
|
|
124
|
+
_context.next = 18;
|
|
125
|
+
break;
|
|
33
126
|
|
|
34
|
-
|
|
35
|
-
|
|
127
|
+
case 15:
|
|
128
|
+
_context.prev = 15;
|
|
129
|
+
_context.t0 = _context["catch"](2);
|
|
130
|
+
console.log('error:', _context.t0);
|
|
131
|
+
|
|
132
|
+
case 18:
|
|
133
|
+
case "end":
|
|
134
|
+
return _context.stop();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}, _callee, null, [[2, 15]]);
|
|
138
|
+
}));
|
|
139
|
+
}, [ossConfig, uploadOnChange]); // 上传前的检测
|
|
140
|
+
|
|
141
|
+
var beforeUpload = useCallback(function (e) {
|
|
142
|
+
var files = e.target.files; // 循环文件检查是否存在不符合要求的文件
|
|
143
|
+
|
|
144
|
+
for (var i = 0, len = files.length; i < len; i += 1) {
|
|
145
|
+
var item = files[i];
|
|
36
146
|
|
|
37
147
|
if (!type.includes(item.name.replace(/.*\./, '').toLowerCase())) {
|
|
38
148
|
var content = type.join('、');
|
|
@@ -41,24 +151,24 @@ var useCoreOptions = function useCoreOptions(_ref) {
|
|
|
41
151
|
|
|
42
152
|
if (item.size / 1024 / 1024 > fileSize) {
|
|
43
153
|
return message.warning("\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25\uFF01\u9644\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7".concat(fileSize, "M\uFF01"), 1.5);
|
|
44
|
-
}
|
|
45
|
-
|
|
154
|
+
}
|
|
46
155
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
size: size,
|
|
50
|
-
value: value,
|
|
51
|
-
onChange: uploadOnChange,
|
|
52
|
-
isImg: true
|
|
53
|
-
});
|
|
156
|
+
uploadOss(item); // 单个文件上传
|
|
157
|
+
// fileUpload?.({ file: item, size, value, onChange: uploadOnChange, isImg: true });
|
|
54
158
|
}
|
|
55
159
|
|
|
56
|
-
;
|
|
57
160
|
return false;
|
|
58
|
-
};
|
|
161
|
+
}, [type, fileSize, uploadOss]); // 获取上传状态
|
|
59
162
|
|
|
163
|
+
var getUploadStatus = useCallback(function () {
|
|
164
|
+
var uploading = typeof state.percent === 'number';
|
|
165
|
+
return {
|
|
166
|
+
uploading: uploading
|
|
167
|
+
};
|
|
168
|
+
}, [state.percent]);
|
|
60
169
|
var CoreMethods = {
|
|
61
|
-
beforeUpload: beforeUpload
|
|
170
|
+
beforeUpload: beforeUpload,
|
|
171
|
+
getUploadStatus: getUploadStatus
|
|
62
172
|
};
|
|
63
173
|
var RefMethods = {
|
|
64
174
|
getState: function getState() {
|
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
border-color: var(--primary-color);
|
|
23
23
|
}
|
|
24
24
|
.lm_upload_wrapper .lm_upload_core .lm_upload_core_picture .lm_upload_core_picture_action {
|
|
25
|
+
width: 100%;
|
|
25
26
|
text-align: center;
|
|
27
|
+
padding: var(--gap);
|
|
26
28
|
}
|
|
27
29
|
.lm_upload_wrapper .lm_upload_core .lm_upload_core_picture .lm_upload_core_picture_action .action_plus {
|
|
28
30
|
color: var(--color-85);
|
|
@@ -31,6 +33,20 @@
|
|
|
31
33
|
color: var(--color-45);
|
|
32
34
|
margin-top: var(--gap);
|
|
33
35
|
}
|
|
36
|
+
.lm_upload_wrapper .lm_upload_progress {
|
|
37
|
+
width: 100%;
|
|
38
|
+
height: 2px;
|
|
39
|
+
background-color: var(--color-4);
|
|
40
|
+
border-radius: 20px;
|
|
41
|
+
margin: 10px 0;
|
|
42
|
+
}
|
|
43
|
+
.lm_upload_wrapper .lm_upload_progress .line {
|
|
44
|
+
width: 0%;
|
|
45
|
+
height: 2px;
|
|
46
|
+
transition: 0.3;
|
|
47
|
+
background-color: var(--primary-color);
|
|
48
|
+
border-radius: 20px;
|
|
49
|
+
}
|
|
34
50
|
.lm_upload_wrapper .lm_upload_item {
|
|
35
51
|
vertical-align: middle;
|
|
36
52
|
}
|
|
@@ -95,12 +111,13 @@
|
|
|
95
111
|
.lm_upload_wrapper .lm_upload_item.lm_upload_item_card .lm_upload_item_thumb {
|
|
96
112
|
width: 100%;
|
|
97
113
|
}
|
|
114
|
+
.lm_upload_wrapper .lm_upload_item.lm_upload_item_card .lm_upload_item_thumb .anticon {
|
|
115
|
+
font-size: 34px;
|
|
116
|
+
color: var(--color-45);
|
|
117
|
+
}
|
|
98
118
|
.lm_upload_wrapper .lm_upload_item.lm_upload_item_card .lm_upload_item_thumb img {
|
|
99
119
|
object-fit: contain;
|
|
100
120
|
}
|
|
101
|
-
.lm_upload_wrapper .lm_upload_item.lm_upload_item_card .lm_upload_item_error .anticon {
|
|
102
|
-
font-size: 34px;
|
|
103
|
-
}
|
|
104
121
|
.lm_upload_wrapper .lm_upload_item.lm_upload_item_card .lm_upload_item_error .lm_upload_item_name {
|
|
105
122
|
font-size: 12px;
|
|
106
123
|
text-overflow: ellipsis;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// 状态管理操作
|
|
2
2
|
export var reducer = function reducer(state, action) {
|
|
3
|
-
var fileList = action.fileList
|
|
3
|
+
var fileList = action.fileList,
|
|
4
|
+
percent = action.percent;
|
|
4
5
|
|
|
5
6
|
switch (action.type) {
|
|
6
7
|
case 'changeFileList':
|
|
@@ -8,6 +9,11 @@ export var reducer = function reducer(state, action) {
|
|
|
8
9
|
fileList: fileList
|
|
9
10
|
});
|
|
10
11
|
|
|
12
|
+
case 'changePercent':
|
|
13
|
+
return Object.assign(Object.assign({}, state), {
|
|
14
|
+
percent: percent
|
|
15
|
+
});
|
|
16
|
+
|
|
11
17
|
default:
|
|
12
18
|
throw new Error();
|
|
13
19
|
}
|
package/es/Modal/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export interface ILMModalProps extends ModalProps {
|
|
|
4
4
|
wrapClassName?: string;
|
|
5
5
|
size?: 'default' | 'small';
|
|
6
6
|
}
|
|
7
|
-
declare const LMModal: React.FC<ModalProps> & import("antd/lib/modal/confirm").ModalStaticFunctions & {
|
|
7
|
+
declare const LMModal: React.FC<ILMModalProps> & React.FC<ModalProps> & import("antd/lib/modal/confirm").ModalStaticFunctions & {
|
|
8
8
|
useModal: typeof import("antd/lib/modal/useModal").default;
|
|
9
9
|
destroyAll: () => void;
|
|
10
10
|
config: typeof import("antd/lib/modal/confirm").modalGlobalConfig;
|