linkmore-design 1.0.68 → 1.0.69
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 +11 -7
- package/dist/Approval/demos/basic.d.ts +1 -0
- package/dist/LmFilter/components/InputFilter.d.ts +2 -2
- package/dist/LmFilter/filterFns/index.d.ts +1 -1
- package/dist/LmFilter/localization.d.ts +1 -0
- package/dist/LmFilter/utils.d.ts +1 -1
- package/dist/LmSelect/useCheckboxOptions.d.ts +1 -0
- package/dist/LmUpload/UploadList/ItemPicture.d.ts +2 -1
- package/dist/LmUpload/UploadList/ItemText.d.ts +2 -1
- package/dist/LmUpload/UploadList/RenderItem.d.ts +1 -5
- package/dist/LmUpload/demos/card.d.ts +2 -0
- package/dist/LmUpload/demos/picture.d.ts +2 -0
- package/dist/LmUpload/fns/index.d.ts +2 -0
- package/dist/LmUpload/utils.d.ts +1 -0
- package/dist/LmUpload/wrapper/UploadContainer.d.ts +4 -3
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.min.js +1 -1
- package/es/Affix/style/index.css +6 -0
- package/es/Alert/style/index.css +6 -0
- package/es/Approval/index.js +4 -4
- package/es/Approval/style/index.css +18 -4
- package/es/AutoComplete/style/index.css +6 -0
- package/es/Avatar/style/index.css +6 -0
- package/es/Breadcrumb/style/index.css +6 -0
- package/es/ButtonTags/style/index.css +6 -0
- package/es/Calendar/style/index.css +6 -0
- package/es/Card/style/index.css +6 -0
- package/es/CardTable/fns/index.js +5 -8
- package/es/CardTable/table/TableRoot.js +2 -1
- package/es/Carousel/style/index.css +6 -0
- package/es/Cascader/style/index.css +6 -0
- package/es/CkFilter/complexFilter/drawer.js +1 -4
- package/es/CkFilter/complexFilter/saveModal.js +5 -7
- package/es/CkFilter/components/CustomModal.js +2 -3
- package/es/CkFilter/components/filterTypes.js +1 -3
- package/es/CkFilter/components/modal.js +2 -5
- package/es/CkFilter/components/modalBack.js +2 -3
- package/es/CkFilter/customFilter/drawer.js +6 -11
- package/es/CkFilter/style/index.css +6 -0
- package/es/Col/style/index.css +6 -0
- package/es/Collapse/style/index.css +6 -0
- package/es/Comment/style/index.css +6 -0
- package/es/CustomTableOption/style/index.css +6 -0
- package/es/CustomerService/style/index.css +6 -0
- package/es/DatePicker/style/index.css +6 -0
- package/es/Descriptions/style/index.css +6 -0
- package/es/Drawer/style/index.css +6 -0
- package/es/Dropdown/style/index.css +6 -0
- package/es/EditTable/style/index.css +6 -0
- package/es/Empty/style/index.css +6 -0
- package/es/Filter/baseFilter/Popover.js +0 -1
- package/es/Filter/baseFilter/ToggleFilter.js +0 -1
- package/es/Filter/edit/editFilter.js +2 -6
- package/es/Filter/remember.js +0 -1
- package/es/Filter/style/index.css +6 -0
- package/es/Form/style/index.css +6 -0
- package/es/Grid/style/index.css +6 -0
- package/es/Icon/style/index.css +6 -0
- package/es/IconFont/font/iconfont.js +1 -1
- package/es/Image/style/index.css +6 -0
- package/es/Input/style/index.css +6 -0
- package/es/InputNumber/style/index.css +6 -0
- package/es/Layout/style/index.css +6 -0
- package/es/LeftTable/style/index.css +6 -0
- package/es/List/style/index.css +6 -0
- package/es/LmEditTable/style/index.css +6 -0
- package/es/LmFilter/complexFilter/drawer.js +2 -7
- package/es/LmFilter/complexFilter/valueDrawer.js +2 -5
- package/es/LmFilter/components/CascaderFilter.js +0 -1
- package/es/LmFilter/components/DropdownFIlter.js +17 -19
- package/es/LmFilter/components/InputFilter.js +1 -2
- package/es/LmFilter/components/SelectFilter.js +2 -2
- package/es/LmFilter/components/index.js +1 -1
- package/es/LmFilter/customFilter/drawer.js +7 -25
- package/es/LmFilter/customFilter/saveModal.js +2 -3
- package/es/LmFilter/customFilter/valueDrawer.js +2 -5
- package/es/LmFilter/filterFns/index.js +3 -5
- package/es/LmFilter/localization.d.ts +1 -0
- package/es/LmFilter/localization.js +2 -1
- package/es/LmFilter/utils.js +39 -22
- package/es/LmFilter/wrapper/FilterRoot.js +0 -2
- package/es/LmSelect/style/index.css +6 -0
- package/es/LmSelect/useCheckboxOptions.d.ts +1 -0
- package/es/LmSelect/useCheckboxOptions.js +4 -3
- package/es/LmTable/Table.js +0 -1
- package/es/LmTable/autosize.js +0 -3
- package/es/LmTable/style/index.css +6 -0
- package/es/LmUpload/LmUpload.js +44 -21
- package/es/LmUpload/UploadList/ItemPicture.d.ts +2 -1
- package/es/LmUpload/UploadList/ItemPicture.js +14 -8
- package/es/LmUpload/UploadList/ItemPictureCard.js +18 -9
- package/es/LmUpload/UploadList/ItemText.d.ts +2 -1
- package/es/LmUpload/UploadList/ItemText.js +12 -7
- package/es/LmUpload/UploadList/RenderItem.d.ts +1 -5
- package/es/LmUpload/UploadList/RenderItem.js +3 -3
- package/es/LmUpload/UploadList/index.js +9 -4
- package/es/LmUpload/body/Progress.js +2 -2
- package/es/LmUpload/body/UploadCore.js +10 -5
- package/es/LmUpload/body/UploadPicture.js +4 -4
- package/es/LmUpload/fns/index.d.ts +2 -0
- package/es/LmUpload/fns/index.js +61 -16
- package/es/LmUpload/utils.d.ts +1 -0
- package/es/LmUpload/utils.js +14 -1
- package/es/LmUpload/wrapper/UploadContainer.d.ts +4 -3
- package/es/LmUpload/wrapper/UploadContainer.js +19 -3
- package/es/LmUpload/wrapper/UploadRoot.js +30 -3
- package/es/LmUpload/wrapper/UploadWrapper.js +4 -8
- package/es/LmUpload/wrapper/reducer.js +2 -1
- package/es/Mentions/style/index.css +6 -0
- package/es/Menu/style/index.css +6 -0
- package/es/Modal/style/index.css +6 -0
- package/es/PageHeader/style/index.css +6 -0
- package/es/Pagination/style/index.css +6 -0
- package/es/PopTable/style/index.css +6 -0
- package/es/Popconfirm/style/index.css +6 -0
- package/es/Popover/style/index.css +6 -0
- package/es/ProTable/Table.js +0 -1
- package/es/ProTable/autosize.js +0 -3
- package/es/ProTable/style/index.css +6 -0
- package/es/Progress/style/index.css +6 -0
- package/es/QuickMenu/style/index.css +6 -0
- package/es/Rate/style/index.css +6 -0
- package/es/Row/style/index.css +6 -0
- package/es/Segmented/style/index.css +6 -0
- package/es/Select/style/index.css +6 -0
- package/es/Slider/style/index.css +6 -0
- package/es/Space/style/index.css +6 -0
- package/es/Spin/style/index.css +6 -0
- package/es/Statistic/style/index.css +6 -0
- package/es/Steps/style/index.css +6 -0
- package/es/Switch/style/index.css +6 -0
- package/es/Table/style/index.css +6 -0
- package/es/Tabs/style/index.css +6 -0
- package/es/Tag/style/index.css +6 -0
- package/es/TimePicker/style/index.css +6 -0
- package/es/Timeline/style/index.css +6 -0
- package/es/Tooltip/style/index.css +6 -0
- package/es/Transfer/style/index.css +6 -0
- package/es/Tree/style/index.css +6 -0
- package/es/TreeSelect/style/index.css +6 -0
- package/es/Typography/style/index.css +6 -0
- package/es/Upload/style/index.css +6 -0
- package/es/message/style/index.css +6 -0
- package/es/notification/style/index.css +6 -0
- package/es/styles/main.css +6 -0
- package/es/styles/resetAntd.css +3 -0
- package/lib/Affix/style/index.css +6 -0
- package/lib/Alert/style/index.css +6 -0
- package/lib/Approval/index.js +4 -4
- package/lib/Approval/style/index.css +18 -4
- package/lib/AutoComplete/style/index.css +6 -0
- package/lib/Avatar/style/index.css +6 -0
- package/lib/Breadcrumb/style/index.css +6 -0
- package/lib/ButtonTags/style/index.css +6 -0
- package/lib/Calendar/style/index.css +6 -0
- package/lib/Card/style/index.css +6 -0
- package/lib/CardTable/fns/index.js +5 -8
- package/lib/CardTable/table/TableRoot.js +2 -1
- package/lib/Carousel/style/index.css +6 -0
- package/lib/Cascader/style/index.css +6 -0
- package/lib/CkFilter/complexFilter/drawer.js +1 -4
- package/lib/CkFilter/complexFilter/saveModal.js +5 -7
- package/lib/CkFilter/components/CustomModal.js +2 -3
- package/lib/CkFilter/components/filterTypes.js +1 -3
- package/lib/CkFilter/components/modal.js +2 -5
- package/lib/CkFilter/components/modalBack.js +2 -3
- package/lib/CkFilter/customFilter/drawer.js +6 -11
- package/lib/CkFilter/style/index.css +6 -0
- package/lib/Col/style/index.css +6 -0
- package/lib/Collapse/style/index.css +6 -0
- package/lib/Comment/style/index.css +6 -0
- package/lib/CustomTableOption/style/index.css +6 -0
- package/lib/CustomerService/style/index.css +6 -0
- package/lib/DatePicker/style/index.css +6 -0
- package/lib/Descriptions/style/index.css +6 -0
- package/lib/Drawer/style/index.css +6 -0
- package/lib/Dropdown/style/index.css +6 -0
- package/lib/EditTable/style/index.css +6 -0
- package/lib/Empty/style/index.css +6 -0
- package/lib/Filter/baseFilter/Popover.js +0 -1
- package/lib/Filter/baseFilter/ToggleFilter.js +0 -1
- package/lib/Filter/edit/editFilter.js +2 -6
- package/lib/Filter/remember.js +0 -1
- package/lib/Filter/style/index.css +6 -0
- package/lib/Form/style/index.css +6 -0
- package/lib/Grid/style/index.css +6 -0
- package/lib/Icon/style/index.css +6 -0
- package/lib/IconFont/font/iconfont.js +1 -1
- package/lib/Image/style/index.css +6 -0
- package/lib/Input/style/index.css +6 -0
- package/lib/InputNumber/style/index.css +6 -0
- package/lib/Layout/style/index.css +6 -0
- package/lib/LeftTable/style/index.css +6 -0
- package/lib/List/style/index.css +6 -0
- package/lib/LmEditTable/style/index.css +6 -0
- package/lib/LmFilter/complexFilter/drawer.js +2 -7
- package/lib/LmFilter/complexFilter/valueDrawer.js +2 -5
- package/lib/LmFilter/components/CascaderFilter.js +0 -1
- package/lib/LmFilter/components/DropdownFIlter.js +17 -19
- package/lib/LmFilter/components/InputFilter.js +1 -2
- package/lib/LmFilter/components/SelectFilter.js +2 -2
- package/lib/LmFilter/components/index.js +1 -1
- package/lib/LmFilter/customFilter/drawer.js +7 -25
- package/lib/LmFilter/customFilter/saveModal.js +2 -3
- package/lib/LmFilter/customFilter/valueDrawer.js +2 -5
- package/lib/LmFilter/filterFns/index.js +3 -5
- package/lib/LmFilter/localization.d.ts +1 -0
- package/lib/LmFilter/localization.js +4 -2
- package/lib/LmFilter/utils.js +39 -22
- package/lib/LmFilter/wrapper/FilterRoot.js +0 -2
- package/lib/LmSelect/style/index.css +6 -0
- package/lib/LmSelect/useCheckboxOptions.d.ts +1 -0
- package/lib/LmSelect/useCheckboxOptions.js +7 -5
- package/lib/LmTable/Table.js +0 -1
- package/lib/LmTable/autosize.js +0 -3
- package/lib/LmTable/style/index.css +6 -0
- package/lib/LmUpload/LmUpload.js +43 -21
- package/lib/LmUpload/UploadList/ItemPicture.d.ts +2 -1
- package/lib/LmUpload/UploadList/ItemPicture.js +14 -8
- package/lib/LmUpload/UploadList/ItemPictureCard.js +18 -9
- package/lib/LmUpload/UploadList/ItemText.d.ts +2 -1
- package/lib/LmUpload/UploadList/ItemText.js +12 -7
- package/lib/LmUpload/UploadList/RenderItem.d.ts +1 -5
- package/lib/LmUpload/UploadList/RenderItem.js +3 -3
- package/lib/LmUpload/UploadList/index.js +9 -4
- package/lib/LmUpload/body/Progress.js +2 -2
- package/lib/LmUpload/body/UploadCore.js +15 -8
- package/lib/LmUpload/body/UploadPicture.js +4 -4
- package/lib/LmUpload/fns/index.d.ts +2 -0
- package/lib/LmUpload/fns/index.js +61 -16
- package/lib/LmUpload/utils.d.ts +1 -0
- package/lib/LmUpload/utils.js +16 -1
- package/lib/LmUpload/wrapper/UploadContainer.d.ts +4 -3
- package/lib/LmUpload/wrapper/UploadContainer.js +21 -3
- package/lib/LmUpload/wrapper/UploadRoot.js +30 -3
- package/lib/LmUpload/wrapper/UploadWrapper.js +5 -12
- package/lib/LmUpload/wrapper/reducer.js +2 -1
- package/lib/Mentions/style/index.css +6 -0
- package/lib/Menu/style/index.css +6 -0
- package/lib/Modal/style/index.css +6 -0
- package/lib/PageHeader/style/index.css +6 -0
- package/lib/Pagination/style/index.css +6 -0
- package/lib/PopTable/style/index.css +6 -0
- package/lib/Popconfirm/style/index.css +6 -0
- package/lib/Popover/style/index.css +6 -0
- package/lib/ProTable/Table.js +0 -1
- package/lib/ProTable/autosize.js +0 -3
- package/lib/ProTable/style/index.css +6 -0
- package/lib/Progress/style/index.css +6 -0
- package/lib/QuickMenu/style/index.css +6 -0
- package/lib/Rate/style/index.css +6 -0
- package/lib/Row/style/index.css +6 -0
- package/lib/Segmented/style/index.css +6 -0
- package/lib/Select/style/index.css +6 -0
- package/lib/Slider/style/index.css +6 -0
- package/lib/Space/style/index.css +6 -0
- package/lib/Spin/style/index.css +6 -0
- package/lib/Statistic/style/index.css +6 -0
- package/lib/Steps/style/index.css +6 -0
- package/lib/Switch/style/index.css +6 -0
- package/lib/Table/style/index.css +6 -0
- package/lib/Tabs/style/index.css +6 -0
- package/lib/Tag/style/index.css +6 -0
- package/lib/TimePicker/style/index.css +6 -0
- package/lib/Timeline/style/index.css +6 -0
- package/lib/Tooltip/style/index.css +6 -0
- package/lib/Transfer/style/index.css +6 -0
- package/lib/Tree/style/index.css +6 -0
- package/lib/TreeSelect/style/index.css +6 -0
- package/lib/Typography/style/index.css +6 -0
- package/lib/Upload/style/index.css +6 -0
- package/lib/message/style/index.css +6 -0
- package/lib/notification/style/index.css +6 -0
- package/lib/styles/main.css +6 -0
- package/lib/styles/resetAntd.css +3 -0
- package/package.json +2 -1
|
@@ -7,14 +7,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.useCheckboxOptions = void 0;
|
|
10
|
+
exports.useCheckboxOptions = exports.default = void 0;
|
|
11
11
|
|
|
12
12
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
13
|
|
|
14
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
15
|
|
|
16
|
-
var _hooks = require("../hooks");
|
|
17
|
-
|
|
18
16
|
var _ahooks = require("ahooks");
|
|
19
17
|
|
|
20
18
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
@@ -23,6 +21,8 @@ var _linkmoreDesign = require("linkmore-design");
|
|
|
23
21
|
|
|
24
22
|
var _react = _interopRequireWildcard(require("react"));
|
|
25
23
|
|
|
24
|
+
var _hooks = require("../hooks");
|
|
25
|
+
|
|
26
26
|
var _utils = require("./utils");
|
|
27
27
|
|
|
28
28
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
@@ -70,7 +70,7 @@ var useCheckboxOptions = function useCheckboxOptions(options, _ref) {
|
|
|
70
70
|
|
|
71
71
|
var renderOptions = (0, _react.useMemo)(function () {
|
|
72
72
|
return options.filter(function (v) {
|
|
73
|
-
return (0, _utils.onStringSearch)(filter, v.label);
|
|
73
|
+
return !v.disabled && (0, _utils.onStringSearch)(filter, v.label);
|
|
74
74
|
});
|
|
75
75
|
}, [options, filter]); // 是否全选: 选中的数据大于等于筛选后的数据 && 筛选后的数据全部存在于选中的数据中
|
|
76
76
|
|
|
@@ -143,4 +143,6 @@ var useCheckboxOptions = function useCheckboxOptions(options, _ref) {
|
|
|
143
143
|
}), !renderOptions.length && /*#__PURE__*/_react.default.createElement(FilterEmpty, null)));
|
|
144
144
|
};
|
|
145
145
|
|
|
146
|
-
exports.useCheckboxOptions = useCheckboxOptions;
|
|
146
|
+
exports.useCheckboxOptions = useCheckboxOptions;
|
|
147
|
+
var _default = useCheckboxOptions;
|
|
148
|
+
exports.default = _default;
|
package/lib/LmTable/Table.js
CHANGED
|
@@ -158,7 +158,6 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
158
158
|
var newIndex = columns.findIndex(function (item) {
|
|
159
159
|
return item.dataIndex === over;
|
|
160
160
|
});
|
|
161
|
-
console.log((0, _sortable.arrayMove)(columns, oldIndex, newIndex), 222);
|
|
162
161
|
filterChange === null || filterChange === void 0 ? void 0 : filterChange((0, _sortable.arrayMove)(columns, oldIndex, newIndex).map(function (item, index) {
|
|
163
162
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
|
164
163
|
order: index
|
package/lib/LmTable/autosize.js
CHANGED
|
@@ -48,7 +48,6 @@ var AutoSizer = /*#__PURE__*/function (_React$Component) {
|
|
|
48
48
|
_this._detectElementResize = void 0;
|
|
49
49
|
|
|
50
50
|
_this._onResize = function () {
|
|
51
|
-
console.log(11);
|
|
52
51
|
var _this$props = _this.props,
|
|
53
52
|
disableHeight = _this$props.disableHeight,
|
|
54
53
|
disableWidth = _this$props.disableWidth,
|
|
@@ -109,8 +108,6 @@ var AutoSizer = /*#__PURE__*/function (_React$Component) {
|
|
|
109
108
|
|
|
110
109
|
this._detectElementResize.addResizeListener(this._parentNode, this.handleResize);
|
|
111
110
|
|
|
112
|
-
console.log(3);
|
|
113
|
-
|
|
114
111
|
this._onResize();
|
|
115
112
|
}
|
|
116
113
|
}
|
|
@@ -81,6 +81,9 @@
|
|
|
81
81
|
.ant-notification-notice .ant-notification-notice-description {
|
|
82
82
|
font-size: 12px;
|
|
83
83
|
}
|
|
84
|
+
.ant-collapse {
|
|
85
|
+
font-size: 12px;
|
|
86
|
+
}
|
|
84
87
|
@font-face {
|
|
85
88
|
font-family: 'iconfont';
|
|
86
89
|
/* Project id 2966019 */
|
|
@@ -503,6 +506,9 @@ html {
|
|
|
503
506
|
.card_cell_content:hover .card_cell_body .card_cell_checkbox {
|
|
504
507
|
opacity: 1;
|
|
505
508
|
}
|
|
509
|
+
p {
|
|
510
|
+
margin-bottom: 0;
|
|
511
|
+
}
|
|
506
512
|
.z_container {
|
|
507
513
|
position: relative;
|
|
508
514
|
display: flex;
|
package/lib/LmUpload/LmUpload.js
CHANGED
|
@@ -26,15 +26,38 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
26
26
|
return t;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
var stsToken = 'CAISjgJ1q6Ft5B2yfSjIr5eDGdHdi5RigKuYR2fGhUcBaOEfmKHYijz2IH5IenZuA+gYtf8ymm1Q5v8ZloAvFs4YbR3KPJco48QJtA/9aoGE5cW7tfkIhJasXDPCBRPyjJ+OaLn0RYseuA94rQiW+BVoyJ7WKB+APTX8Q7Dr5LdjatMIJHraCRNNGNZRICZ7tcYeLgG/HP2xMxns8AGyZQgSzWgas25k7rmlycCx8wfXiEaAqtUYvIPsOJOpHaIOVdVdK47tgr0pLfeRinQNukYSpPhM4fYaqWudjLa0GEJM5hiKCe3Q/+B0IRVxDqpAQPAY8qeiz6Um4beOydmvm08WJ49SSD/FTYWwXwx6zT9crb8agAE/AmQIq01ud7Oe11GaycEGpfRMjSM7w3GYv7WZPtY7dlVJemeghJDOuoOjPuu+WigsrFqJr4LCXB44EvoV4tTBz9NrFdJ8T1JPD5nCQ15TSifXJMjym4tWeOTVRiZk04N27cXgD3YYj7s9wOFMsUsenZR6WulrHhyUEwyjb9fGcQ==';
|
|
30
|
-
|
|
31
29
|
var LmUpload = function LmUpload(_a, ref) {
|
|
32
|
-
var
|
|
30
|
+
var _ossConfig = _a.ossConfig,
|
|
33
31
|
resetProps = __rest(_a, ["ossConfig"]);
|
|
34
32
|
|
|
35
|
-
var defaultRef = (0, _react.useRef)(null);
|
|
33
|
+
var defaultRef = (0, _react.useRef)(null); // 仅在初始化触发一次
|
|
34
|
+
|
|
35
|
+
var initConfig = (0, _react.useMemo)(function () {
|
|
36
|
+
return {
|
|
37
|
+
// 文件配置单独存储
|
|
38
|
+
fileConfig: {
|
|
39
|
+
size: 10,
|
|
40
|
+
type: ['jpg', 'jpeg', 'png'],
|
|
41
|
+
maxCount: 99
|
|
42
|
+
},
|
|
43
|
+
// 初始化
|
|
44
|
+
components: {
|
|
45
|
+
itemRender: null,
|
|
46
|
+
wrapper: null // 结构定义
|
|
47
|
+
// 包装结构体: 上传, 列表
|
|
48
|
+
// wrapper: (upload, fileList) => (
|
|
49
|
+
// <>
|
|
50
|
+
// {upload}
|
|
51
|
+
// {fileList}
|
|
52
|
+
// </>
|
|
53
|
+
// ),
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}, []);
|
|
36
58
|
var defaultProps = {
|
|
37
|
-
|
|
59
|
+
uid: 'uid',
|
|
60
|
+
fileList: [],
|
|
38
61
|
type: ['jpg', 'jpeg', 'png'],
|
|
39
62
|
accept: '',
|
|
40
63
|
fileSize: 10,
|
|
@@ -45,27 +68,26 @@ var LmUpload = function LmUpload(_a, ref) {
|
|
|
45
68
|
children: null,
|
|
46
69
|
defaultFileList: [],
|
|
47
70
|
itemRender: null,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
wrapper: function wrapper(upload, fileList) {
|
|
51
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, upload, fileList);
|
|
52
|
-
}
|
|
71
|
+
onRemove: function onRemove() {
|
|
72
|
+
return true;
|
|
53
73
|
},
|
|
74
|
+
enabledOss: false,
|
|
54
75
|
// oss配置
|
|
55
|
-
ossConfig:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
76
|
+
ossConfig: function ossConfig() {
|
|
77
|
+
return Object.assign({
|
|
78
|
+
dir: '/BizFile/4595/Supplier/',
|
|
79
|
+
region: 'oss-cn-hangzhou',
|
|
80
|
+
accessKeyId: '',
|
|
81
|
+
accessKeySecret: '',
|
|
82
|
+
stsToken: '',
|
|
83
|
+
bucket: 'linkmore-scm-test',
|
|
84
|
+
shortlink: 'https://linkmore-scm-test.oss-cn-hangzhou.aliyuncs.com'
|
|
85
|
+
}, typeof _ossConfig === 'function' ? _ossConfig() : _ossConfig);
|
|
86
|
+
}
|
|
65
87
|
};
|
|
66
88
|
return /*#__PURE__*/_react.default.createElement(_UploadRoot.default, Object.assign({
|
|
67
89
|
ref: ref || defaultRef
|
|
68
|
-
}, defaultProps, resetProps));
|
|
90
|
+
}, initConfig, defaultProps, resetProps));
|
|
69
91
|
};
|
|
70
92
|
|
|
71
93
|
var _default = /*#__PURE__*/(0, _react.forwardRef)(LmUpload);
|
|
@@ -13,21 +13,27 @@ var _linkmoreDesign = require("linkmore-design");
|
|
|
13
13
|
|
|
14
14
|
// 图片列表项
|
|
15
15
|
var PictureItem = function PictureItem(_ref) {
|
|
16
|
-
var file = _ref.file
|
|
16
|
+
var file = _ref.file,
|
|
17
|
+
instance = _ref.instance;
|
|
18
|
+
var remove = instance.remove;
|
|
17
19
|
return /*#__PURE__*/React.createElement("div", {
|
|
18
|
-
className:
|
|
20
|
+
className: "lm_upload_item lm_upload_item_picture"
|
|
19
21
|
}, /*#__PURE__*/React.createElement("div", {
|
|
20
|
-
className:
|
|
22
|
+
className: "picture_left"
|
|
21
23
|
}, /*#__PURE__*/React.createElement("div", {
|
|
22
|
-
className:
|
|
24
|
+
className: "lm_upload_item_thumb"
|
|
23
25
|
}, /*#__PURE__*/React.createElement("img", {
|
|
24
|
-
src: file.url
|
|
26
|
+
src: file.url,
|
|
27
|
+
alt: ""
|
|
25
28
|
})), /*#__PURE__*/React.createElement("div", {
|
|
26
|
-
className:
|
|
29
|
+
className: "lm_upload_item_name"
|
|
27
30
|
}, file.fileName)), /*#__PURE__*/React.createElement("div", {
|
|
28
|
-
className:
|
|
31
|
+
className: "picture_right lm_upload_item_action"
|
|
29
32
|
}, /*#__PURE__*/React.createElement("div", {
|
|
30
|
-
className:
|
|
33
|
+
className: "action_delete",
|
|
34
|
+
onClick: function onClick() {
|
|
35
|
+
return remove(file);
|
|
36
|
+
}
|
|
31
37
|
}, /*#__PURE__*/React.createElement(_linkmoreDesign.IconFont, {
|
|
32
38
|
type: "lmweb-delete"
|
|
33
39
|
}))));
|
|
@@ -28,11 +28,11 @@ var renderThumb = function renderThumb(file) {
|
|
|
28
28
|
case 'png':
|
|
29
29
|
case 'jpg':
|
|
30
30
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
31
|
-
className:
|
|
31
|
+
className: "lm_upload_item_error"
|
|
32
32
|
}, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.IconFont, {
|
|
33
33
|
type: "lmweb-image"
|
|
34
34
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
35
|
-
className:
|
|
35
|
+
className: "lm_upload_item_name"
|
|
36
36
|
}, file.realFileName));
|
|
37
37
|
|
|
38
38
|
case 'doc':
|
|
@@ -69,7 +69,9 @@ var renderThumb = function renderThumb(file) {
|
|
|
69
69
|
var PictureItem = function PictureItem(_ref) {
|
|
70
70
|
var file = _ref.file,
|
|
71
71
|
instance = _ref.instance;
|
|
72
|
-
var size = instance.size
|
|
72
|
+
var size = instance.size,
|
|
73
|
+
remove = instance.remove,
|
|
74
|
+
preview = instance.preview;
|
|
73
75
|
|
|
74
76
|
var _useState = (0, _react.useState)(false),
|
|
75
77
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -86,7 +88,8 @@ var PictureItem = function PictureItem(_ref) {
|
|
|
86
88
|
|
|
87
89
|
var thumbUrl = (0, _react.useMemo)(function () {
|
|
88
90
|
return "".concat(file.url, "?x-oss-process=image/resize,w_").concat(size);
|
|
89
|
-
}, [file.url, size]);
|
|
91
|
+
}, [file.url, size]); // 根据文件名后缀判断
|
|
92
|
+
|
|
90
93
|
var isImg = (0, _react.useMemo)(function () {
|
|
91
94
|
return ['jpg', 'jpeg', 'png', 'gif', 'bmp'].includes(resetFile.fileExtension);
|
|
92
95
|
}, [resetFile]); // 重置尺寸大小
|
|
@@ -108,7 +111,7 @@ var PictureItem = function PictureItem(_ref) {
|
|
|
108
111
|
width: size
|
|
109
112
|
}
|
|
110
113
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
111
|
-
className:
|
|
114
|
+
className: "lm_upload_item_thumb"
|
|
112
115
|
}, isError || !isImg ? renderThumb(resetFile) : /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Image, {
|
|
113
116
|
width: resetSize.width,
|
|
114
117
|
height: resetSize.width,
|
|
@@ -117,18 +120,24 @@ var PictureItem = function PictureItem(_ref) {
|
|
|
117
120
|
return setIsError(true);
|
|
118
121
|
}
|
|
119
122
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
120
|
-
className:
|
|
123
|
+
className: "lm_upload_item_mask"
|
|
121
124
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
122
|
-
className:
|
|
125
|
+
className: "lm_upload_item_action"
|
|
123
126
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
124
|
-
className:
|
|
127
|
+
className: "action_preview",
|
|
128
|
+
onClick: function onClick() {
|
|
129
|
+
return preview(file);
|
|
130
|
+
}
|
|
125
131
|
}, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.IconFont, {
|
|
126
132
|
type: "lmweb-eye",
|
|
127
133
|
style: {
|
|
128
134
|
fontSize: size > 48 ? 16 : 12
|
|
129
135
|
}
|
|
130
136
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
131
|
-
className:
|
|
137
|
+
className: "action_delete",
|
|
138
|
+
onClick: function onClick() {
|
|
139
|
+
return remove(file);
|
|
140
|
+
}
|
|
132
141
|
}, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.IconFont, {
|
|
133
142
|
type: "lmweb-delete",
|
|
134
143
|
style: {
|
|
@@ -12,21 +12,26 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var _linkmoreDesign = require("linkmore-design");
|
|
13
13
|
|
|
14
14
|
var TextItem = function TextItem(_ref) {
|
|
15
|
-
var file = _ref.file
|
|
15
|
+
var file = _ref.file,
|
|
16
|
+
instance = _ref.instance;
|
|
17
|
+
var remove = instance.remove;
|
|
16
18
|
return /*#__PURE__*/React.createElement("div", {
|
|
17
|
-
className:
|
|
19
|
+
className: "lm_upload_item lm_upload_item_text"
|
|
18
20
|
}, /*#__PURE__*/React.createElement("div", {
|
|
19
|
-
className:
|
|
21
|
+
className: "text_left"
|
|
20
22
|
}, /*#__PURE__*/React.createElement("div", {
|
|
21
|
-
className:
|
|
23
|
+
className: "prefix"
|
|
22
24
|
}, /*#__PURE__*/React.createElement(_linkmoreDesign.IconFont, {
|
|
23
25
|
type: "lmweb-attachment"
|
|
24
26
|
})), /*#__PURE__*/React.createElement("div", {
|
|
25
|
-
className:
|
|
27
|
+
className: "lm_upload_item_name"
|
|
26
28
|
}, file.fileName)), /*#__PURE__*/React.createElement("div", {
|
|
27
|
-
className:
|
|
29
|
+
className: "text_right lm_upload_item_text_action"
|
|
28
30
|
}, /*#__PURE__*/React.createElement("div", {
|
|
29
|
-
className:
|
|
31
|
+
className: "action_delete",
|
|
32
|
+
onClick: function onClick() {
|
|
33
|
+
return remove(file);
|
|
34
|
+
}
|
|
30
35
|
}, /*#__PURE__*/React.createElement(_linkmoreDesign.IconFont, {
|
|
31
36
|
type: "lmweb-delete"
|
|
32
37
|
}))));
|
|
@@ -33,9 +33,9 @@ var RenderCell = function RenderCell(props) {
|
|
|
33
33
|
resetProsp = __rest(props, ["type"]);
|
|
34
34
|
|
|
35
35
|
var types = {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
text: _ItemText.default,
|
|
37
|
+
picture: _ItemPicture.default,
|
|
38
|
+
card: _ItemPictureCard.default
|
|
39
39
|
};
|
|
40
40
|
return (0, _utils.render)(types[type] || _ItemPicture.default, resetProsp);
|
|
41
41
|
};
|
|
@@ -17,14 +17,19 @@ var _RenderItem = _interopRequireDefault(require("./RenderItem"));
|
|
|
17
17
|
|
|
18
18
|
var LmUploadList = function LmUploadList(_ref) {
|
|
19
19
|
var instance = _ref.instance;
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
var _a;
|
|
22
|
+
|
|
23
|
+
var uid = instance.uid,
|
|
24
|
+
fileList = instance.fileList,
|
|
21
25
|
itemRender = instance.itemRender,
|
|
22
26
|
listType = instance.listType;
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, (_a = fileList === null || fileList === void 0 ? void 0 : fileList.sort(function (a, b) {
|
|
28
|
+
return a.seq - b.seq;
|
|
29
|
+
})) === null || _a === void 0 ? void 0 : _a.map(function (file, idx) {
|
|
25
30
|
return (0, _utils.render)(itemRender || _RenderItem.default, {
|
|
26
31
|
type: listType,
|
|
27
|
-
key: idx,
|
|
32
|
+
key: file[uid] || idx,
|
|
28
33
|
file: file,
|
|
29
34
|
fileList: fileList,
|
|
30
35
|
instance: instance
|
|
@@ -13,9 +13,9 @@ var Progress = function Progress(_ref) {
|
|
|
13
13
|
var instance = _ref.instance;
|
|
14
14
|
var state = instance.state;
|
|
15
15
|
return /*#__PURE__*/React.createElement("div", {
|
|
16
|
-
className:
|
|
16
|
+
className: "lm_upload_progress"
|
|
17
17
|
}, /*#__PURE__*/React.createElement("div", {
|
|
18
|
-
className:
|
|
18
|
+
className: "line",
|
|
19
19
|
style: {
|
|
20
20
|
width: "".concat(state.percent || 0, "%")
|
|
21
21
|
}
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.default = void 0;
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
|
|
14
14
|
var _UploadPicture = _interopRequireDefault(require("./UploadPicture"));
|
|
15
15
|
|
|
@@ -18,11 +18,18 @@ var _UploadPicture = _interopRequireDefault(require("./UploadPicture"));
|
|
|
18
18
|
// type: 'card' 图片 | 'drag' 拖拽
|
|
19
19
|
var UploadCore = function UploadCore(_ref) {
|
|
20
20
|
var instance = _ref.instance;
|
|
21
|
-
|
|
22
|
-
var
|
|
21
|
+
|
|
22
|
+
var inputRef = _react.default.useRef(null);
|
|
23
|
+
|
|
24
|
+
var fileList = instance.fileList,
|
|
25
|
+
accept = instance.accept,
|
|
26
|
+
maxCount = instance.maxCount,
|
|
23
27
|
children = instance.children,
|
|
24
28
|
beforeUpload = instance.beforeUpload,
|
|
25
|
-
getUploadStatus = instance.getUploadStatus;
|
|
29
|
+
getUploadStatus = instance.getUploadStatus;
|
|
30
|
+
var isMaxCount = (0, _react.useMemo)(function () {
|
|
31
|
+
return !(fileList.length < maxCount);
|
|
32
|
+
}, []); // 点击事件触发文件上传
|
|
26
33
|
|
|
27
34
|
var handleClick = function handleClick() {
|
|
28
35
|
var _a;
|
|
@@ -44,7 +51,7 @@ var UploadCore = function UploadCore(_ref) {
|
|
|
44
51
|
};
|
|
45
52
|
|
|
46
53
|
var inputConfig = {
|
|
47
|
-
type:
|
|
54
|
+
type: 'file',
|
|
48
55
|
accept: accept,
|
|
49
56
|
title: '',
|
|
50
57
|
onChange: uploadChange,
|
|
@@ -52,12 +59,12 @@ var UploadCore = function UploadCore(_ref) {
|
|
|
52
59
|
display: 'none'
|
|
53
60
|
}
|
|
54
61
|
};
|
|
55
|
-
return /*#__PURE__*/
|
|
62
|
+
return isMaxCount && /*#__PURE__*/_react.default.createElement("div", {
|
|
56
63
|
onClick: handleClick,
|
|
57
64
|
className: "lm_upload_core"
|
|
58
|
-
}, children || /*#__PURE__*/
|
|
65
|
+
}, children || /*#__PURE__*/_react.default.createElement(_UploadPicture.default, {
|
|
59
66
|
instance: instance
|
|
60
|
-
}), /*#__PURE__*/
|
|
67
|
+
}), /*#__PURE__*/_react.default.createElement("input", Object.assign({
|
|
61
68
|
ref: inputRef
|
|
62
69
|
}, inputConfig)));
|
|
63
70
|
};
|
|
@@ -25,22 +25,22 @@ var uploadPicture = function uploadPicture(_ref) {
|
|
|
25
25
|
return getUploadStatus().uploading;
|
|
26
26
|
}, [getUploadStatus]);
|
|
27
27
|
return /*#__PURE__*/React.createElement("div", {
|
|
28
|
-
className:
|
|
28
|
+
className: "lm_upload_core_picture",
|
|
29
29
|
style: {
|
|
30
30
|
height: size,
|
|
31
31
|
width: size
|
|
32
32
|
}
|
|
33
33
|
}, /*#__PURE__*/React.createElement("div", {
|
|
34
|
-
className:
|
|
34
|
+
className: "lm_upload_core_picture_action"
|
|
35
35
|
}, !isUploading && /*#__PURE__*/React.createElement("div", {
|
|
36
|
-
className:
|
|
36
|
+
className: "action_plus"
|
|
37
37
|
}, /*#__PURE__*/React.createElement(_linkmoreDesign.IconFont, {
|
|
38
38
|
type: "lmweb-plus",
|
|
39
39
|
style: {
|
|
40
40
|
fontSize: size > 48 ? 16 : 12
|
|
41
41
|
}
|
|
42
42
|
})), /*#__PURE__*/React.createElement("div", {
|
|
43
|
-
className:
|
|
43
|
+
className: "tip"
|
|
44
44
|
}, "\u4E0A\u4F20"), isUploading && /*#__PURE__*/React.createElement(_Progress.default, {
|
|
45
45
|
instance: instance
|
|
46
46
|
})));
|
|
@@ -53,13 +53,16 @@ var useCoreOptions = function useCoreOptions(_ref) {
|
|
|
53
53
|
var state = _ref.state,
|
|
54
54
|
dispatch = _ref.dispatch,
|
|
55
55
|
props = _ref.props;
|
|
56
|
-
var
|
|
56
|
+
var uid = props.uid,
|
|
57
|
+
value = props.fileList,
|
|
58
|
+
onChange = props.onChange,
|
|
57
59
|
type = props.type,
|
|
58
60
|
fileSize = props.fileSize,
|
|
61
|
+
enabledOss = props.enabledOss,
|
|
59
62
|
ossConfig = props.ossConfig; // 上传完成
|
|
60
63
|
|
|
61
64
|
var uploadOnChange = (0, _react.useCallback)(function (file) {
|
|
62
|
-
var fileList = [file].concat((0, _toConsumableArray2.default)(
|
|
65
|
+
var fileList = [file].concat((0, _toConsumableArray2.default)(value));
|
|
63
66
|
dispatch({
|
|
64
67
|
type: 'changeFileList',
|
|
65
68
|
fileList: fileList
|
|
@@ -73,17 +76,17 @@ var useCoreOptions = function useCoreOptions(_ref) {
|
|
|
73
76
|
file: file,
|
|
74
77
|
fileList: fileList
|
|
75
78
|
});
|
|
76
|
-
}, [
|
|
79
|
+
}, [value]); // 上传至ali-oss
|
|
77
80
|
|
|
78
81
|
var uploadOss = (0, _react.useCallback)(function (file) {
|
|
79
82
|
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
80
|
-
var _a, dir, shortlink, region, accessKeyId, accessKeySecret, stsToken, bucket, client, fileName, pathName, url,
|
|
83
|
+
var _a, _ossConfig, _ossConfig$dir, dir, shortlink, _ossConfig$region, region, accessKeyId, accessKeySecret, stsToken, _ossConfig$bucket, bucket, client, fileName, pathName, url, seq, params;
|
|
81
84
|
|
|
82
85
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
83
86
|
while (1) {
|
|
84
87
|
switch (_context.prev = _context.next) {
|
|
85
88
|
case 0:
|
|
86
|
-
dir =
|
|
89
|
+
_ossConfig = ossConfig(), _ossConfig$dir = _ossConfig.dir, dir = _ossConfig$dir === void 0 ? '/BizFile/4595/Supplier/' : _ossConfig$dir, shortlink = _ossConfig.shortlink, _ossConfig$region = _ossConfig.region, region = _ossConfig$region === void 0 ? 'oss-cn-hangzhou' : _ossConfig$region, accessKeyId = _ossConfig.accessKeyId, accessKeySecret = _ossConfig.accessKeySecret, stsToken = _ossConfig.stsToken, _ossConfig$bucket = _ossConfig.bucket, bucket = _ossConfig$bucket === void 0 ? 'linkmore-scm-test' : _ossConfig$bucket;
|
|
87
90
|
client = new _aliOss.default({
|
|
88
91
|
region: region,
|
|
89
92
|
accessKeyId: accessKeyId,
|
|
@@ -100,6 +103,8 @@ var useCoreOptions = function useCoreOptions(_ref) {
|
|
|
100
103
|
// 获取分片上传进度、断点和返回值。
|
|
101
104
|
progress: function progress(p, cpt, res) {
|
|
102
105
|
onChange({
|
|
106
|
+
file: file,
|
|
107
|
+
fileList: value,
|
|
103
108
|
event: {
|
|
104
109
|
progress: p,
|
|
105
110
|
checkPoint: cpt,
|
|
@@ -117,9 +122,9 @@ var useCoreOptions = function useCoreOptions(_ref) {
|
|
|
117
122
|
});
|
|
118
123
|
|
|
119
124
|
case 8:
|
|
120
|
-
result = _context.sent;
|
|
121
125
|
seq = (((_a = state.fileList) === null || _a === void 0 ? void 0 : _a.length) || 0) + 1;
|
|
122
126
|
params = {
|
|
127
|
+
uid: seq,
|
|
123
128
|
fileTypeCode: file.type,
|
|
124
129
|
fileTypeName: file.type,
|
|
125
130
|
fileName: fileName,
|
|
@@ -132,23 +137,22 @@ var useCoreOptions = function useCoreOptions(_ref) {
|
|
|
132
137
|
url: url
|
|
133
138
|
};
|
|
134
139
|
uploadOnChange(params);
|
|
135
|
-
|
|
136
|
-
_context.next = 18;
|
|
140
|
+
_context.next = 16;
|
|
137
141
|
break;
|
|
138
142
|
|
|
139
|
-
case
|
|
140
|
-
_context.prev =
|
|
143
|
+
case 13:
|
|
144
|
+
_context.prev = 13;
|
|
141
145
|
_context.t0 = _context["catch"](2);
|
|
142
146
|
console.log('error:', _context.t0);
|
|
143
147
|
|
|
144
|
-
case
|
|
148
|
+
case 16:
|
|
145
149
|
case "end":
|
|
146
150
|
return _context.stop();
|
|
147
151
|
}
|
|
148
152
|
}
|
|
149
|
-
}, _callee, null, [[2,
|
|
153
|
+
}, _callee, null, [[2, 13]]);
|
|
150
154
|
}));
|
|
151
|
-
}, [ossConfig, uploadOnChange]); // 上传前的检测
|
|
155
|
+
}, [ossConfig, uploadOnChange, value]); // 上传前的检测
|
|
152
156
|
|
|
153
157
|
var beforeUpload = (0, _react.useCallback)(function (e) {
|
|
154
158
|
var files = e.target.files; // 循环文件检查是否存在不符合要求的文件
|
|
@@ -165,12 +169,51 @@ var useCoreOptions = function useCoreOptions(_ref) {
|
|
|
165
169
|
return _linkmoreDesign.message.warning("\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25\uFF01\u9644\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7".concat(fileSize, "M\uFF01"), 1.5);
|
|
166
170
|
}
|
|
167
171
|
|
|
168
|
-
uploadOss(item); // 单个文件上传
|
|
172
|
+
enabledOss && uploadOss(item); // 单个文件上传
|
|
169
173
|
// fileUpload?.({ file: item, size, value, onChange: uploadOnChange, isImg: true });
|
|
170
174
|
}
|
|
171
175
|
|
|
172
176
|
return false;
|
|
173
|
-
}, [type, fileSize, uploadOss]); //
|
|
177
|
+
}, [type, fileSize, uploadOss]); // 删除事件
|
|
178
|
+
|
|
179
|
+
var remove = (0, _react.useCallback)(function (file) {
|
|
180
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
181
|
+
var _b, res, fileList;
|
|
182
|
+
|
|
183
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
184
|
+
while (1) {
|
|
185
|
+
switch (_context2.prev = _context2.next) {
|
|
186
|
+
case 0:
|
|
187
|
+
_context2.next = 2;
|
|
188
|
+
return (_b = props.onRemove) === null || _b === void 0 ? void 0 : _b.call(props, file);
|
|
189
|
+
|
|
190
|
+
case 2:
|
|
191
|
+
res = _context2.sent;
|
|
192
|
+
|
|
193
|
+
if (res) {
|
|
194
|
+
fileList = value.filter(function (v) {
|
|
195
|
+
return v[uid] !== file[uid];
|
|
196
|
+
});
|
|
197
|
+
dispatch({
|
|
198
|
+
type: 'changeFileList',
|
|
199
|
+
fileList: fileList
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
case 4:
|
|
204
|
+
case "end":
|
|
205
|
+
return _context2.stop();
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}, _callee2);
|
|
209
|
+
}));
|
|
210
|
+
}, [props.onRemove, state.fileList, uid]); // 点击文件链接或预览图标时的回调
|
|
211
|
+
|
|
212
|
+
var preview = (0, _react.useCallback)(function (file) {
|
|
213
|
+
var _a;
|
|
214
|
+
|
|
215
|
+
(_a = props.onPreview) === null || _a === void 0 ? void 0 : _a.call(props, file);
|
|
216
|
+
}, []); // 获取上传状态
|
|
174
217
|
|
|
175
218
|
var getUploadStatus = (0, _react.useCallback)(function () {
|
|
176
219
|
var uploading = typeof state.percent === 'number';
|
|
@@ -180,7 +223,9 @@ var useCoreOptions = function useCoreOptions(_ref) {
|
|
|
180
223
|
}, [state.percent]);
|
|
181
224
|
var CoreMethods = {
|
|
182
225
|
beforeUpload: beforeUpload,
|
|
183
|
-
getUploadStatus: getUploadStatus
|
|
226
|
+
getUploadStatus: getUploadStatus,
|
|
227
|
+
remove: remove,
|
|
228
|
+
preview: preview
|
|
184
229
|
};
|
|
185
230
|
var RefMethods = {
|
|
186
231
|
getState: function getState() {
|
package/lib/LmUpload/utils.d.ts
CHANGED