@hi-ui/hiui 2.15.10 → 2.15.11
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/CHANGELOG.md +3 -0
- package/es/_util/warning.js +2 -2
- package/es/alert/__test__/index.test.js +67 -0
- package/es/alert/index.js +147 -6
- package/es/alert/style/index.css +1 -1
- package/es/badge/index.js +87 -9
- package/es/badge/style/index.css +1 -1
- package/es/badge/style/index.js +0 -0
- package/es/button/Button.js +51 -59
- package/es/button/ButtonGroup.js +31 -23
- package/es/button/IconLoading.js +2 -2
- package/es/button/__test__/index.test.js +29 -0
- package/es/button/index.js +2 -3
- package/es/button/style/index.css +1 -1
- package/es/card/index.js +42 -54
- package/es/card/style/index.css +1 -1
- package/es/cascader/Cascader.js +116 -181
- package/es/cascader/__test__/index.test.js +283 -0
- package/es/cascader/index.js +2 -5
- package/es/cascader/menu.js +155 -0
- package/es/cascader/style/cascader.css +1 -1
- package/es/cascader/style/menu.css +1 -1
- package/es/checkbox/{checkbox-legacy/Base.js → Base.js} +31 -46
- package/es/checkbox/CheckBox.js +185 -0
- package/es/checkbox/index.js +4 -13
- package/es/checkbox/style/index.css +1 -1
- package/es/collapse/__test__/index.test.js +58 -0
- package/es/collapse/index.js +93 -79
- package/es/collapse/style/index.css +1 -1
- package/es/confirm/index.js +50 -37
- package/es/context/index.js +37 -39
- package/es/counter/__test__/index.test.js +52 -0
- package/es/counter/index.js +270 -6
- package/es/counter/style/index.css +1 -1
- package/es/date-picker/BasePicker.js +288 -374
- package/es/date-picker/Calender.js +90 -326
- package/es/date-picker/DatePanel.js +186 -175
- package/es/date-picker/DatePicker.js +51 -151
- package/es/date-picker/DateRangePanel.js +181 -253
- package/es/date-picker/Modal.js +25 -15
- package/es/date-picker/Time.js +336 -230
- package/es/date-picker/TimePanel.js +32 -27
- package/es/date-picker/TimePeriodPanel.js +32 -21
- package/es/date-picker/TimePicker.js +40 -42
- package/es/date-picker/TimeRangePanel.js +42 -32
- package/es/date-picker/Type.js +1 -5
- package/es/date-picker/WeekRangePanel.js +150 -237
- package/es/date-picker/constants.js +28 -14
- package/es/date-picker/dateUtil.js +52 -221
- package/es/date-picker/index.js +2 -5
- package/es/date-picker/style/index.css +1 -1
- package/es/date-picker/util.js +8 -101
- package/es/dropdown/Dropdown.js +199 -193
- package/es/dropdown/{tests → __test__}/index.test.js +2 -2
- package/es/dropdown/index.js +4 -73
- package/es/dropdown/style/index.css +1 -1
- package/es/dropdown/style/index.js +2 -0
- package/es/ficon/index.js +23 -13
- package/es/form/index.js +171 -6
- package/es/form/{Item.js → item.js} +53 -53
- package/es/form/style/index.css +1 -1
- package/es/grid/index.js +37 -25
- package/es/icon/index.js +32 -21
- package/es/index.js +9 -61
- package/es/input/index.js +345 -28
- package/es/input/style/index.css +1 -1
- package/es/input/util.js +18 -26
- package/es/lib/withDragDropContext.js +2 -2
- package/es/loading/index.js +129 -5
- package/es/loading/style/index.css +0 -0
- package/es/loading/style/index.js +0 -0
- package/es/locales/en-US.js +11 -45
- package/es/locales/index.js +2 -16
- package/es/locales/zh-CN.js +12 -46
- package/es/menu/Item.js +41 -32
- package/es/menu/ItemGroup.js +81 -0
- package/es/menu/SubMenu.js +74 -55
- package/es/menu/Title.js +42 -36
- package/es/menu/index.js +419 -12
- package/es/menu/style/index.css +1 -1
- package/es/modal/__test__/index.test.js +123 -0
- package/es/modal/index.js +61 -77
- package/es/modal/style/index.css +1 -1
- package/es/nav-menu/NavMenu.js +45 -31
- package/es/nav-menu/__test__/index.test.js +2 -2
- package/es/nav-menu/index.js +2 -2
- package/es/notification/__test__/index.test.js +56 -0
- package/es/notification/index.js +231 -68
- package/es/notification/style/index.css +1 -1
- package/es/notification/style/index.js +0 -0
- package/es/pagination/Pager.js +8 -6
- package/es/pagination/Pagination.js +115 -124
- package/es/pagination/__test__/index.test.js +140 -0
- package/es/pagination/index.js +8 -9
- package/es/pagination/style/index.css +1 -1
- package/es/panel/index.js +33 -23
- package/es/popover/__test__/index.test.js +2 -2
- package/es/popover/index.js +69 -71
- package/es/popper/index.js +54 -64
- package/es/popper/style/index.css +1 -1
- package/es/progress/BarProgress.js +43 -109
- package/es/progress/CircleProgress.js +10 -9
- package/es/progress/DashboardProgress.js +9 -7
- package/es/progress/index.js +100 -8
- package/es/progress/style/index.css +1 -1
- package/es/radio/{radio-legacy/__test__ → __test__}/index.test.js +10 -10
- package/es/radio/index.js +216 -10
- package/es/radio/style/index.css +1 -1
- package/es/rate/Icons.js +2 -2
- package/es/rate/Rate.js +90 -65
- package/es/rate/__test__/index.test.js +54 -0
- package/es/rate/index.js +2 -5
- package/es/rate/style/index.css +1 -1
- package/es/select/Option.js +93 -0
- package/es/select/Select.js +253 -325
- package/es/select/SelectDropdown.js +63 -215
- package/es/select/SelectInput.js +54 -88
- package/es/select/__test__/index.test.js +429 -0
- package/es/select/index.js +4 -6
- package/es/select/style/select-dropdown.css +1 -1
- package/es/select/style/select-input.css +1 -1
- package/es/stepper/index.js +127 -21
- package/es/stepper/style/index.css +1 -1
- package/es/style/color/colors.css +0 -0
- package/es/style/icon/diyIcon.css +1 -1
- package/es/style/icon/index.css +1 -1
- package/es/style/index.css +0 -0
- package/es/style/mixins/colors.css +0 -0
- package/es/style/mixins/index.css +0 -0
- package/es/style/theme/dark.css +0 -0
- package/es/style/theme/default.css +0 -0
- package/es/switch/{__tests__ → __test__}/index.test.js +2 -31
- package/es/switch/index.js +36 -24
- package/es/switch/style/index.css +1 -1
- package/es/table/__test__/index.test.js +73 -0
- package/es/table/{Body.js → body.js} +52 -36
- package/es/table/checkbox/index.js +36 -33
- package/es/table/clickOuterside.js +115 -0
- package/es/table/{Footer.js → footer.js} +41 -24
- package/es/table/{Header.js → header.js} +54 -41
- package/es/table/index.js +300 -262
- package/es/table/menu/index.js +34 -32
- package/es/table/pover.js +154 -0
- package/es/table/prefix.js +2 -2
- package/es/table/style/Table.css +1 -1
- package/es/table/style/index.css +1 -1
- package/es/table/tableContent.js +120 -0
- package/es/tabs/ItemDropdown.js +51 -39
- package/es/tabs/TabPane.js +35 -25
- package/es/tabs/Tabs.js +91 -98
- package/es/tabs/index.js +3 -9
- package/es/tabs/style/index.css +1 -1
- package/es/timeline/__test__/index.test.js +49 -0
- package/es/timeline/foldingItem.js +82 -0
- package/es/timeline/index.js +127 -203
- package/es/timeline/style/index.css +1 -1
- package/es/tooltip/__test__/index.test.js +67 -0
- package/es/tooltip/index.js +39 -86
- package/es/tooltip/style/index.css +1 -1
- package/es/transfer/Item.js +44 -53
- package/es/transfer/__test__/index.test.js +11 -0
- package/es/transfer/index.js +443 -4
- package/es/transfer/style/index.css +1 -1
- package/es/tree/Tree.js +86 -76
- package/es/tree/TreeDivider.js +3 -3
- package/es/tree/TreeItem.js +108 -204
- package/es/tree/TreeNode.js +318 -457
- package/es/tree/index.js +2 -9
- package/es/tree/style/index.css +1 -1
- package/es/tree/util.js +257 -9
- package/es/upload/{upload-legacy/Preview.js → Preview.js} +39 -33
- package/es/upload/Upload.js +193 -289
- package/es/upload/UploadAvatar.js +58 -44
- package/es/upload/UploadClick.js +45 -49
- package/es/upload/UploadDrag.js +43 -44
- package/es/upload/UploadPhoto.js +55 -70
- package/es/upload/UploadPictureCard.js +44 -39
- package/es/upload/index.js +71 -8
- package/es/upload/style/index.css +1 -1
- package/es/upload/tool.js +1 -0
- package/package.json +4 -1
- package/es/_util/SwitchVersion.js +0 -44
- package/es/_util/depreactedPropsCompat.js +0 -58
- package/es/_util/index.js +0 -32
- package/es/alert/Alert.js +0 -134
- package/es/alert/__tests__/index.test.js +0 -88
- package/es/badge/Badge.js +0 -90
- package/es/badge/__tests__/index.test.js +0 -82
- package/es/breadcrumb/__tests__/index.test.js +0 -61
- package/es/breadcrumb/index.js +0 -93
- package/es/breadcrumb/style/index.css +0 -1
- package/es/button/__tests__/index.test.js +0 -219
- package/es/card/__tests__/index.test.js +0 -169
- package/es/carousel/__tests__/index.test.js +0 -104
- package/es/carousel/index.js +0 -227
- package/es/carousel/style/index.css +0 -1
- package/es/carousel/style/index.js +0 -3
- package/es/cascader/Menu.js +0 -174
- package/es/cascader/__tests__/index.test.js +0 -389
- package/es/checkbox/Checkbox.js +0 -144
- package/es/checkbox/Group.js +0 -202
- package/es/checkbox/__tests__/index.test.js +0 -226
- package/es/checkbox/checkbox-legacy/CheckBox.js +0 -165
- package/es/checkbox/checkbox-legacy/index.js +0 -15
- package/es/checkbox/checkbox-legacy/style/index.css +0 -1
- package/es/checkbox/checkbox-legacy/style/index.js +0 -3
- package/es/collapse/__tests__/index.test.js +0 -111
- package/es/counter/Counter.js +0 -343
- package/es/counter/__tests__/index.test.js +0 -134
- package/es/counter/counter-legacy/index.js +0 -271
- package/es/date-picker/TimeList.js +0 -254
- package/es/date-picker/YMRangePanel.js +0 -372
- package/es/date-picker/__tests__/index.test.js +0 -961
- package/es/date-picker/datepicker-legacy/BasePicker.js +0 -519
- package/es/date-picker/datepicker-legacy/Calender.js +0 -430
- package/es/date-picker/datepicker-legacy/DatePanel.js +0 -463
- package/es/date-picker/datepicker-legacy/DatePicker.js +0 -107
- package/es/date-picker/datepicker-legacy/DateRangePanel.js +0 -496
- package/es/date-picker/datepicker-legacy/Modal.js +0 -71
- package/es/date-picker/datepicker-legacy/Time.js +0 -413
- package/es/date-picker/datepicker-legacy/TimePanel.js +0 -93
- package/es/date-picker/datepicker-legacy/TimePeriodPanel.js +0 -126
- package/es/date-picker/datepicker-legacy/TimePicker.js +0 -82
- package/es/date-picker/datepicker-legacy/TimeRangePanel.js +0 -98
- package/es/date-picker/datepicker-legacy/Type.js +0 -31
- package/es/date-picker/datepicker-legacy/WeekRangePanel.js +0 -345
- package/es/date-picker/datepicker-legacy/constants.js +0 -79
- package/es/date-picker/datepicker-legacy/dateUtil.js +0 -258
- package/es/date-picker/datepicker-legacy/index.js +0 -15
- package/es/date-picker/datepicker-legacy/local.js +0 -11
- package/es/date-picker/datepicker-legacy/style/index.css +0 -1
- package/es/date-picker/datepicker-legacy/style/index.js +0 -3
- package/es/date-picker/datepicker-legacy/style/timepicker.css +0 -1
- package/es/date-picker/datepicker-legacy/util.js +0 -60
- package/es/date-picker/toLunar.js +0 -172
- package/es/dropdown/DropdownButton.js +0 -106
- package/es/dropdown/DropdownMenu.js +0 -111
- package/es/dropdown/DropdownMenuItem.js +0 -178
- package/es/dropdown/__tests__/index.test.js +0 -317
- package/es/dropdown/utils.js +0 -35
- package/es/form/Form.js +0 -184
- package/es/form/__tests__/index.test.js +0 -575
- package/es/grid/__tests__/index.test.js +0 -104
- package/es/input/Input.js +0 -412
- package/es/input/__tests__/index.test.js +0 -381
- package/es/input/input-legacy/index.js +0 -353
- package/es/input/input-legacy/util.js +0 -176
- package/es/loading/Loading.js +0 -181
- package/es/loading/__tests__/index.test.js +0 -110
- package/es/locales/zh-Hant-HK.js +0 -121
- package/es/locales/zh-Hant-TW.js +0 -123
- package/es/menu/Menu.js +0 -422
- package/es/menu/__tests__/index.test.js +0 -279
- package/es/message/__tests__/index.test.js +0 -75
- package/es/message/index.js +0 -58
- package/es/message/style/index.css +0 -1
- package/es/message/style/index.js +0 -5
- package/es/modal/__tests__/index.test.js +0 -178
- package/es/nav-menu/__tests__/index.test.js +0 -27
- package/es/notice/Notice.js +0 -142
- package/es/notice/NoticeContainer.js +0 -113
- package/es/notice/__tests__/index.test.js +0 -174
- package/es/notice/index.js +0 -66
- package/es/notice/style/index.css +0 -1
- package/es/notice/style/index.js +0 -5
- package/es/notification/HandleNotification/index.js +0 -224
- package/es/notification/HandleNotification/style/index.css +0 -1
- package/es/notification/HandleNotification/style/index.js +0 -5
- package/es/notification/__tests__/index.test.js +0 -118
- package/es/pagination/__tests__/index.test.js +0 -248
- package/es/popover/__tests__/index.test.js +0 -152
- package/es/preview/index.js +0 -527
- package/es/preview/style/index.css +0 -1
- package/es/preview/style/index.js +0 -3
- package/es/progress/Progress.js +0 -110
- package/es/progress/__tests__/index.test.js +0 -131
- package/es/radio/Group.js +0 -203
- package/es/radio/Radio.js +0 -151
- package/es/radio/__tests__/index.test.js +0 -128
- package/es/radio/radio-legacy/index.js +0 -222
- package/es/radio/radio-legacy/style/index.css +0 -1
- package/es/radio/radio-legacy/style/index.js +0 -3
- package/es/rate/__tests__/index.test.js +0 -124
- package/es/select/__tests__/index.test.js +0 -505
- package/es/select/select-legacy/Option.js +0 -81
- package/es/select/select-legacy/Select.js +0 -710
- package/es/select/select-legacy/SelectDropdown.js +0 -164
- package/es/select/select-legacy/SelectInput.js +0 -312
- package/es/select/select-legacy/common.js +0 -19
- package/es/select/select-legacy/index.js +0 -16
- package/es/stepper/Stepper.js +0 -151
- package/es/stepper/__tests__/index.test.js +0 -161
- package/es/table/ClickOuterside.js +0 -103
- package/es/table/TableContent.js +0 -109
- package/es/table/__tests__/index.test.js +0 -133
- package/es/table/checkbox/style/index.css +0 -1
- package/es/table/checkbox/style/index.js +0 -3
- package/es/tabs/__tests__/index.test.js +0 -333
- package/es/tabs/tabs-legacy/ItemDropdown.js +0 -170
- package/es/tabs/tabs-legacy/TabPane.js +0 -78
- package/es/tabs/tabs-legacy/Tabs.js +0 -299
- package/es/tabs/tabs-legacy/index.js +0 -18
- package/es/tabs/tabs-legacy/style/index.css +0 -1
- package/es/tabs/tabs-legacy/style/index.js +0 -3
- package/es/tag/__tests__/index.test.js +0 -46
- package/es/tag/index.js +0 -94
- package/es/tag/style/index.css +0 -1
- package/es/tag/style/index.js +0 -3
- package/es/timeline/__tests__/index.test.js +0 -198
- package/es/tooltip/__tests__/index.test.js +0 -170
- package/es/transfer/Transfer.js +0 -566
- package/es/transfer/__tests__/index.test.js +0 -210
- package/es/tree/IconLoading.js +0 -38
- package/es/tree/__tests__/index.test.js +0 -603
- package/es/tree/tree-legacy/Tree.js +0 -337
- package/es/tree/tree-legacy/TreeDivider.js +0 -25
- package/es/tree/tree-legacy/TreeItem.js +0 -333
- package/es/tree/tree-legacy/TreeNode.js +0 -719
- package/es/tree/tree-legacy/index.js +0 -13
- package/es/tree/tree-legacy/style/index.css +0 -1
- package/es/tree/tree-legacy/style/index.js +0 -3
- package/es/tree/tree-legacy/util.js +0 -434
- package/es/upload/__tests__/index.test.js +0 -760
- package/es/upload/main.js +0 -91
- package/es/upload/upload-legacy/Upload.js +0 -435
- package/es/upload/upload-legacy/UploadAvatar.js +0 -322
- package/es/upload/upload-legacy/UploadClick.js +0 -125
- package/es/upload/upload-legacy/UploadDrag.js +0 -180
- package/es/upload/upload-legacy/UploadPhoto.js +0 -183
- package/es/upload/upload-legacy/UploadPictureCard.js +0 -126
- package/es/upload/upload-legacy/index.js +0 -75
- package/es/upload/upload-legacy/style/index.css +0 -1
- package/es/upload/upload-legacy/style/index.js +0 -5
- package/es/upload/upload-legacy/tool.js +0 -84
- package/es/watermark/index.js +0 -101
- package/es/watermark/watermark.js +0 -252
- /package/es/checkbox/{checkbox-legacy/common.js → common.js} +0 -0
- /package/es/{breadcrumb/style → style}/index.js +0 -0
- /package/es/upload/{upload-legacy/style → style}/preview.css +0 -0
- /package/es/upload/{upload-legacy/style → style}/preview.js +0 -0
package/es/upload/Upload.js
CHANGED
|
@@ -1,34 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
3
|
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
6
|
exports["default"] = void 0;
|
|
11
7
|
|
|
12
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
|
-
|
|
14
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
15
|
-
|
|
16
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
17
|
-
|
|
18
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
19
|
-
|
|
20
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
21
|
-
|
|
22
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
23
|
-
|
|
24
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
25
|
-
|
|
26
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
27
|
-
|
|
28
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
29
|
-
|
|
30
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
31
|
-
|
|
32
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
33
9
|
|
|
34
10
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
@@ -45,244 +21,72 @@ var _button = _interopRequireDefault(require("../button"));
|
|
|
45
21
|
|
|
46
22
|
var _icon = _interopRequireDefault(require("../icon"));
|
|
47
23
|
|
|
48
|
-
function
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
49
25
|
|
|
50
|
-
function
|
|
26
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
51
27
|
|
|
52
|
-
function
|
|
28
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
53
29
|
|
|
54
|
-
function
|
|
30
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
55
31
|
|
|
56
|
-
|
|
32
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
57
33
|
|
|
58
|
-
var
|
|
59
|
-
(0, _inherits2["default"])(Upload, _Component);
|
|
34
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
60
35
|
|
|
61
|
-
|
|
36
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
62
37
|
|
|
63
|
-
|
|
64
|
-
var _this;
|
|
65
|
-
|
|
66
|
-
(0, _classCallCheck2["default"])(this, Upload);
|
|
67
|
-
_this = _super.call(this, props);
|
|
68
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "cancelEvent", function () {
|
|
69
|
-
_this.setState({
|
|
70
|
-
visibleModal: false
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "uploadFile", /*#__PURE__*/function () {
|
|
74
|
-
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(file) {
|
|
75
|
-
var dataUrl,
|
|
76
|
-
FileReader,
|
|
77
|
-
XMLHttpRequest,
|
|
78
|
-
FormData,
|
|
79
|
-
fileList,
|
|
80
|
-
_this$props,
|
|
81
|
-
name,
|
|
82
|
-
params,
|
|
83
|
-
headers,
|
|
84
|
-
uploadAction,
|
|
85
|
-
withCredentials,
|
|
86
|
-
maxCount,
|
|
87
|
-
_uploadAction,
|
|
88
|
-
onerror,
|
|
89
|
-
fr,
|
|
90
|
-
xhr,
|
|
91
|
-
formFile,
|
|
92
|
-
i,
|
|
93
|
-
j,
|
|
94
|
-
_args = arguments;
|
|
95
|
-
|
|
96
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
97
|
-
while (1) {
|
|
98
|
-
switch (_context.prev = _context.next) {
|
|
99
|
-
case 0:
|
|
100
|
-
dataUrl = _args.length > 1 && _args[1] !== undefined ? _args[1] : '';
|
|
101
|
-
FileReader = window.FileReader;
|
|
102
|
-
XMLHttpRequest = window.XMLHttpRequest;
|
|
103
|
-
FormData = window.FormData;
|
|
104
|
-
fileList = _this.state.fileList;
|
|
105
|
-
_this$props = _this.props, name = _this$props.name, params = _this$props.params, headers = _this$props.headers, uploadAction = _this$props.uploadAction, withCredentials = _this$props.withCredentials, maxCount = _this$props.maxCount;
|
|
106
|
-
_uploadAction = typeof uploadAction === 'string' ? uploadAction : uploadAction(file);
|
|
107
|
-
|
|
108
|
-
if (!(_uploadAction.toString() === '[object Promise]')) {
|
|
109
|
-
_context.next = 10;
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
_context.next = 10;
|
|
114
|
-
return _uploadAction.then(function (res) {
|
|
115
|
-
_uploadAction = res;
|
|
116
|
-
})["catch"](function (error) {
|
|
117
|
-
throw new Error(error);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
case 10:
|
|
121
|
-
_this.setState({
|
|
122
|
-
fileCountLimted: fileList.length >= maxCount
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
onerror = function onerror(err) {
|
|
126
|
-
var fileList = _this.state.fileList;
|
|
127
|
-
var errRes = err !== undefined ? err : {
|
|
128
|
-
status: xhr.status,
|
|
129
|
-
statusText: xhr.statusText
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
var _fileList = (0, _toConsumableArray2["default"])(fileList);
|
|
133
|
-
|
|
134
|
-
file.uploadState = 'error';
|
|
135
|
-
|
|
136
|
-
var idx = _fileList.findIndex(function (item) {
|
|
137
|
-
return item.fileId === file.fileId;
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
_fileList.splice(idx, 1, file);
|
|
141
|
-
|
|
142
|
-
_this.setState({
|
|
143
|
-
fileList: _fileList
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
_this.onUpload(file, _fileList, errRes);
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
if (file.fileType === 'img') {
|
|
150
|
-
// 用来图片预览
|
|
151
|
-
if (dataUrl) {
|
|
152
|
-
file.url = dataUrl;
|
|
153
|
-
} else if (dataUrl !== false) {
|
|
154
|
-
fr = new FileReader();
|
|
155
|
-
|
|
156
|
-
fr.onload = function (e) {
|
|
157
|
-
var url = e.target.result;
|
|
158
|
-
|
|
159
|
-
var _fileList = (0, _toConsumableArray2["default"])(fileList);
|
|
160
|
-
|
|
161
|
-
file.url = url;
|
|
162
|
-
|
|
163
|
-
var idx = _fileList.findIndex(function (item) {
|
|
164
|
-
return item.fileId === file.fileId;
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
_fileList.splice(idx, 1, file);
|
|
168
|
-
|
|
169
|
-
_this.setState({
|
|
170
|
-
fileList: _fileList
|
|
171
|
-
});
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
fr.readAsDataURL(file);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
xhr = new XMLHttpRequest();
|
|
179
|
-
formFile = new FormData();
|
|
180
|
-
file.xhr = xhr;
|
|
181
|
-
xhr.withCredentials = withCredentials;
|
|
182
|
-
|
|
183
|
-
if (dataUrl) {
|
|
184
|
-
formFile.append(name, dataUrl);
|
|
185
|
-
} else {
|
|
186
|
-
formFile.append(name, file);
|
|
187
|
-
} // 设置除file外需要带入的参数
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
if (params) {
|
|
191
|
-
for (i in params) {
|
|
192
|
-
formFile.append(i, params[i]);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
xhr.onreadystatechange = function () {
|
|
197
|
-
if (xhr.readyState === 4) {
|
|
198
|
-
if (xhr.status === 200) {
|
|
199
|
-
var _fileList3 = _this.state.fileList;
|
|
200
|
-
|
|
201
|
-
var _fileList = (0, _toConsumableArray2["default"])(_fileList3);
|
|
202
|
-
|
|
203
|
-
file.uploadState = 'success';
|
|
204
|
-
|
|
205
|
-
var idx = _fileList.findIndex(function (item) {
|
|
206
|
-
return item.fileId === file.fileId;
|
|
207
|
-
});
|
|
38
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
208
39
|
|
|
209
|
-
|
|
40
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
210
41
|
|
|
211
|
-
|
|
212
|
-
fileList: _fileList
|
|
213
|
-
}, function () {
|
|
214
|
-
return _this.onUpload(file, _fileList, JSON.parse(xhr.response));
|
|
215
|
-
});
|
|
216
|
-
} else {
|
|
217
|
-
onerror();
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
};
|
|
42
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
221
43
|
|
|
222
|
-
|
|
223
|
-
onerror();
|
|
224
|
-
};
|
|
44
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
225
45
|
|
|
226
|
-
|
|
227
|
-
var fileList = _this.state.fileList;
|
|
228
|
-
var e = event || window.event;
|
|
229
|
-
var percentComplete = Math.ceil(e.loaded / e.total * 100);
|
|
46
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
230
47
|
|
|
231
|
-
|
|
48
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
232
49
|
|
|
233
|
-
|
|
234
|
-
return item.fileId === file.fileId;
|
|
235
|
-
});
|
|
50
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
236
51
|
|
|
237
|
-
|
|
52
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
238
53
|
|
|
239
|
-
|
|
54
|
+
var fileId = 0;
|
|
240
55
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
});
|
|
244
|
-
};
|
|
56
|
+
var Upload = /*#__PURE__*/function (_Component) {
|
|
57
|
+
_inherits(Upload, _Component);
|
|
245
58
|
|
|
246
|
-
|
|
59
|
+
var _super = _createSuper(Upload);
|
|
247
60
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
xhr.setRequestHeader(j, headers[j]);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
61
|
+
function Upload(props) {
|
|
62
|
+
var _this;
|
|
253
63
|
|
|
254
|
-
|
|
64
|
+
_classCallCheck(this, Upload);
|
|
255
65
|
|
|
256
|
-
|
|
257
|
-
case "end":
|
|
258
|
-
return _context.stop();
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}, _callee);
|
|
262
|
-
}));
|
|
66
|
+
_this = _super.call(this, props);
|
|
263
67
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
68
|
+
_defineProperty(_assertThisInitialized(_this), "cancelEvent", function () {
|
|
69
|
+
_this.setState({
|
|
70
|
+
visibleModal: false
|
|
71
|
+
});
|
|
72
|
+
});
|
|
268
73
|
|
|
269
|
-
var
|
|
74
|
+
var fileList = _this.prepareDefaultFileList(props.defaultFileList);
|
|
270
75
|
|
|
271
76
|
_this.state = {
|
|
272
77
|
visibleModal: false,
|
|
273
|
-
fileList:
|
|
274
|
-
fileCountLimted:
|
|
78
|
+
fileList: fileList,
|
|
79
|
+
fileCountLimted: props.defaultFileList.length >= props.maxCount
|
|
275
80
|
};
|
|
276
81
|
return _this;
|
|
277
82
|
}
|
|
278
83
|
|
|
279
|
-
(
|
|
84
|
+
_createClass(Upload, [{
|
|
280
85
|
key: "componentWillReceiveProps",
|
|
281
86
|
value: function componentWillReceiveProps(nextProps) {
|
|
282
|
-
if (!(0, _shallowequal["default"])(nextProps.
|
|
87
|
+
if (!(0, _shallowequal["default"])(nextProps.defaultFileList, this.props.defaultFileList)) {
|
|
283
88
|
this.setState({
|
|
284
|
-
fileList: this.prepareDefaultFileList(nextProps.
|
|
285
|
-
fileCountLimted: nextProps.fileList.length >= nextProps.maxCount
|
|
89
|
+
fileList: this.prepareDefaultFileList(nextProps.defaultFileList)
|
|
286
90
|
});
|
|
287
91
|
}
|
|
288
92
|
}
|
|
@@ -320,7 +124,7 @@ var Upload = /*#__PURE__*/function (_Component) {
|
|
|
320
124
|
break;
|
|
321
125
|
|
|
322
126
|
case 'doc':
|
|
323
|
-
case '
|
|
127
|
+
case 'dcox':
|
|
324
128
|
fileType = 'word';
|
|
325
129
|
break;
|
|
326
130
|
|
|
@@ -379,8 +183,8 @@ var Upload = /*#__PURE__*/function (_Component) {
|
|
|
379
183
|
width: '480px'
|
|
380
184
|
},
|
|
381
185
|
onCancel: this.cancelEvent,
|
|
382
|
-
|
|
383
|
-
|
|
186
|
+
show: this.state.visibleModal,
|
|
187
|
+
footers: [/*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
384
188
|
type: "primary",
|
|
385
189
|
key: 0,
|
|
386
190
|
onClick: this.cancelEvent
|
|
@@ -407,12 +211,11 @@ var Upload = /*#__PURE__*/function (_Component) {
|
|
|
407
211
|
}, {
|
|
408
212
|
key: "uploadFiles",
|
|
409
213
|
value: function uploadFiles(files) {
|
|
410
|
-
var
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
maxSize = _this$props2.maxSize;
|
|
214
|
+
var _this$props = this.props,
|
|
215
|
+
beforeUpload = _this$props.beforeUpload,
|
|
216
|
+
customUpload = _this$props.customUpload,
|
|
217
|
+
maxSize = _this$props.maxSize,
|
|
218
|
+
maxCount = _this$props.maxCount;
|
|
416
219
|
var _this$state = this.state,
|
|
417
220
|
fileList = _this$state.fileList,
|
|
418
221
|
fileCountLimted = _this$state.fileCountLimted;
|
|
@@ -427,43 +230,43 @@ var Upload = /*#__PURE__*/function (_Component) {
|
|
|
427
230
|
|
|
428
231
|
if (customUpload) {
|
|
429
232
|
customUpload(files);
|
|
430
|
-
_reactDom["default"].findDOMNode(this.uploadRef).value = '';
|
|
431
233
|
return;
|
|
432
234
|
}
|
|
433
235
|
|
|
434
236
|
if (files.length === 0) return;
|
|
435
237
|
|
|
436
|
-
|
|
238
|
+
if (files[0].size > maxSize * 1024) {
|
|
239
|
+
this.setState({
|
|
240
|
+
visibleModal: true
|
|
241
|
+
});
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
437
244
|
|
|
438
|
-
|
|
245
|
+
for (var key in files) {
|
|
246
|
+
if (!files.hasOwnProperty(key)) continue;
|
|
439
247
|
var file = files[key];
|
|
440
|
-
|
|
441
|
-
if (file.size > maxSize * 1024) {
|
|
442
|
-
_this3.setState({
|
|
443
|
-
visibleModal: true
|
|
444
|
-
});
|
|
445
|
-
|
|
446
|
-
return;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
file.fileId = _this3.getFileId();
|
|
248
|
+
file.fileId = this.getFileId();
|
|
450
249
|
file.uploadState = 'loading';
|
|
451
|
-
file.fileType =
|
|
452
|
-
|
|
453
|
-
|
|
250
|
+
file.fileType = this.getFileType(file);
|
|
251
|
+
fileList.unshift(file);
|
|
252
|
+
this.setState({
|
|
253
|
+
fileList: fileList
|
|
254
|
+
});
|
|
255
|
+
this.uploadFile(file);
|
|
256
|
+
}
|
|
454
257
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
_this3.uploadFile(file);
|
|
258
|
+
if (fileList.length >= maxCount) {
|
|
259
|
+
this.setState({
|
|
260
|
+
fileCountLimted: true
|
|
459
261
|
});
|
|
460
|
-
}
|
|
262
|
+
}
|
|
263
|
+
|
|
461
264
|
_reactDom["default"].findDOMNode(this.uploadRef).value = '';
|
|
462
265
|
}
|
|
463
266
|
}, {
|
|
464
267
|
key: "deleteFile",
|
|
465
268
|
value: function deleteFile(file, index) {
|
|
466
|
-
var
|
|
269
|
+
var _this3 = this;
|
|
467
270
|
|
|
468
271
|
var fileList = this.state.fileList;
|
|
469
272
|
var onRemove = this.props.onRemove;
|
|
@@ -471,14 +274,13 @@ var Upload = /*#__PURE__*/function (_Component) {
|
|
|
471
274
|
var doRemove = function doRemove() {
|
|
472
275
|
fileList.splice(index, 1);
|
|
473
276
|
|
|
474
|
-
|
|
277
|
+
_this3.setState({
|
|
475
278
|
fileList: fileList,
|
|
476
279
|
fileCountLimted: false
|
|
477
280
|
});
|
|
478
281
|
};
|
|
479
282
|
|
|
480
283
|
var ret = onRemove(file, fileList, index);
|
|
481
|
-
file.uploadState === 'loading' && file.xhr.abort();
|
|
482
284
|
|
|
483
285
|
if (ret === true) {
|
|
484
286
|
doRemove();
|
|
@@ -493,22 +295,17 @@ var Upload = /*#__PURE__*/function (_Component) {
|
|
|
493
295
|
}, {
|
|
494
296
|
key: "onUpload",
|
|
495
297
|
value: function onUpload(file, fileList, response) {
|
|
496
|
-
var
|
|
298
|
+
var _this4 = this;
|
|
497
299
|
|
|
498
|
-
var
|
|
499
|
-
onChange = _this$props3.onChange,
|
|
500
|
-
maxCount = _this$props3.maxCount;
|
|
300
|
+
var onChange = this.props.onChange;
|
|
501
301
|
|
|
502
302
|
var onUploadError = function onUploadError() {
|
|
503
303
|
for (var index in fileList) {
|
|
504
304
|
if (fileList[index].fileId === file.fileId) {
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
_fileList.splice(index, 1);
|
|
305
|
+
fileList.splice(index, 1);
|
|
508
306
|
|
|
509
|
-
|
|
510
|
-
fileList:
|
|
511
|
-
fileCountLimted: _fileList.length >= _this5.props.maxCount
|
|
307
|
+
_this4.setState({
|
|
308
|
+
fileList: fileList
|
|
512
309
|
});
|
|
513
310
|
|
|
514
311
|
break;
|
|
@@ -516,23 +313,127 @@ var Upload = /*#__PURE__*/function (_Component) {
|
|
|
516
313
|
}
|
|
517
314
|
};
|
|
518
315
|
|
|
519
|
-
var
|
|
316
|
+
var callback = function callback(ret) {
|
|
317
|
+
if (ret === false) {
|
|
318
|
+
onUploadError();
|
|
319
|
+
} else if (ret && typeof ret.then === 'function') {
|
|
320
|
+
ret.then(function (res) {
|
|
321
|
+
if (res === false) {
|
|
322
|
+
onUploadError();
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
};
|
|
520
327
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
328
|
+
onChange(file, fileList, response, callback);
|
|
329
|
+
}
|
|
330
|
+
}, {
|
|
331
|
+
key: "uploadFile",
|
|
332
|
+
value: function uploadFile(file) {
|
|
333
|
+
var _this5 = this;
|
|
334
|
+
|
|
335
|
+
var dataUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
336
|
+
var FileReader = window.FileReader;
|
|
337
|
+
var XMLHttpRequest = window.XMLHttpRequest;
|
|
338
|
+
var FormData = window.FormData;
|
|
339
|
+
var fileList = this.state.fileList;
|
|
340
|
+
var _this$props2 = this.props,
|
|
341
|
+
name = _this$props2.name,
|
|
342
|
+
param = _this$props2.param,
|
|
343
|
+
headers = _this$props2.headers,
|
|
344
|
+
uploadAction = _this$props2.uploadAction;
|
|
345
|
+
|
|
346
|
+
var onerror = function onerror(err) {
|
|
347
|
+
var errRes = err !== undefined ? err : {
|
|
348
|
+
status: xhr.status,
|
|
349
|
+
statusText: xhr.statusText
|
|
350
|
+
};
|
|
351
|
+
file.uploadState = 'error';
|
|
352
|
+
|
|
353
|
+
_this5.setState({
|
|
354
|
+
fileList: fileList
|
|
528
355
|
});
|
|
356
|
+
|
|
357
|
+
_this5.onUpload(file, fileList, errRes);
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
if (file.fileType === 'img') {
|
|
361
|
+
// 用来图片预览
|
|
362
|
+
if (dataUrl) {
|
|
363
|
+
file.url = dataUrl;
|
|
364
|
+
} else if (dataUrl !== false) {
|
|
365
|
+
var fr = new FileReader();
|
|
366
|
+
|
|
367
|
+
fr.onload = function (e) {
|
|
368
|
+
var url = e.target.result;
|
|
369
|
+
file.url = url;
|
|
370
|
+
|
|
371
|
+
_this5.setState({
|
|
372
|
+
fileList: fileList
|
|
373
|
+
});
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
fr.readAsDataURL(file);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
var xhr = new XMLHttpRequest();
|
|
381
|
+
var formFile = new FormData();
|
|
382
|
+
|
|
383
|
+
if (dataUrl) {
|
|
384
|
+
formFile.append(name, dataUrl);
|
|
529
385
|
} else {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
386
|
+
formFile.append(name, file);
|
|
387
|
+
} // 设置除file外需要带入的参数
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
if (param) {
|
|
391
|
+
for (var i in param) {
|
|
392
|
+
formFile.append(i, param[i]);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
xhr.upload.onload = function () {
|
|
397
|
+
file.uploadState = 'success';
|
|
398
|
+
|
|
399
|
+
_this5.setState({
|
|
400
|
+
fileList: fileList
|
|
401
|
+
});
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
xhr.onreadystatechange = function () {
|
|
405
|
+
if (xhr.readyState === 4) {
|
|
406
|
+
if (xhr.status === 200) {
|
|
407
|
+
_this5.onUpload(file, fileList, JSON.parse(xhr.response));
|
|
408
|
+
} else {
|
|
409
|
+
onerror();
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
xhr.upload.onerror = function () {
|
|
415
|
+
onerror();
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
xhr.upload.onprogress = function (event) {
|
|
419
|
+
var e = event || window.event;
|
|
420
|
+
var percentComplete = Math.ceil(e.loaded / e.total * 100);
|
|
421
|
+
file.progressNumber = percentComplete;
|
|
422
|
+
|
|
423
|
+
_this5.setState({
|
|
424
|
+
fileList: fileList
|
|
425
|
+
});
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
xhr.open('post', uploadAction, true); // 设置用户传入的请求头
|
|
429
|
+
|
|
430
|
+
if (headers) {
|
|
431
|
+
for (var j in headers) {
|
|
432
|
+
xhr.setRequestHeader(j, headers[j]);
|
|
534
433
|
}
|
|
535
434
|
}
|
|
435
|
+
|
|
436
|
+
xhr.send(formFile);
|
|
536
437
|
}
|
|
537
438
|
}, {
|
|
538
439
|
key: "uploadStatusIcon",
|
|
@@ -549,6 +450,7 @@ var Upload = /*#__PURE__*/function (_Component) {
|
|
|
549
450
|
}
|
|
550
451
|
}
|
|
551
452
|
}]);
|
|
453
|
+
|
|
552
454
|
return Upload;
|
|
553
455
|
}(_react.Component);
|
|
554
456
|
|
|
@@ -558,6 +460,7 @@ Upload.propTypes = {
|
|
|
558
460
|
limit: _propTypes["default"].number,
|
|
559
461
|
buttonText: _propTypes["default"].string,
|
|
560
462
|
buttonIcon: _propTypes["default"].string,
|
|
463
|
+
uploadAction: _propTypes["default"].string,
|
|
561
464
|
param: _propTypes["default"].object,
|
|
562
465
|
name: _propTypes["default"].string,
|
|
563
466
|
disabled: _propTypes["default"].bool,
|
|
@@ -570,21 +473,21 @@ Upload.propTypes = {
|
|
|
570
473
|
defaultFileList: _propTypes["default"].array,
|
|
571
474
|
fileList: _propTypes["default"].array,
|
|
572
475
|
onRemove: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].bool]),
|
|
573
|
-
maxSize: _propTypes["default"].number
|
|
574
|
-
withCredentials: _propTypes["default"].bool
|
|
476
|
+
maxSize: _propTypes["default"].number
|
|
575
477
|
};
|
|
576
478
|
Upload.defaultProps = {
|
|
577
479
|
defaultFileList: [],
|
|
480
|
+
// headers: {'Content-type': 'multipart/form-data'}, // headers 不可以设置Content-type https://stackoverflow.com/questions/17415084/multipart-data-post-using-python-requests-no-multipart-boundary-was-found/17438575
|
|
578
481
|
headers: {},
|
|
579
482
|
accept: '',
|
|
580
483
|
limit: null,
|
|
581
484
|
buttonIcon: 'upload',
|
|
485
|
+
uploadAction: '',
|
|
582
486
|
param: null,
|
|
583
487
|
name: 'file',
|
|
584
488
|
disabled: false,
|
|
585
489
|
showUploadList: true,
|
|
586
490
|
multiple: false,
|
|
587
|
-
withCredentials: false,
|
|
588
491
|
beforeUpload: function beforeUpload() {
|
|
589
492
|
return true;
|
|
590
493
|
},
|
|
@@ -593,7 +496,8 @@ Upload.defaultProps = {
|
|
|
593
496
|
},
|
|
594
497
|
onChange: function onChange() {
|
|
595
498
|
return true;
|
|
596
|
-
}
|
|
499
|
+
} // overEvent: false
|
|
500
|
+
|
|
597
501
|
};
|
|
598
502
|
var _default = Upload;
|
|
599
503
|
exports["default"] = _default;
|