yootd 0.0.1
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/LICENSE +21 -0
- package/README.md +43 -0
- package/dist/Preview/assets/phonebg.png +0 -0
- package/dist/Preview/components/icons/AdaptIcon.d.ts +3 -0
- package/dist/Preview/components/icons/AdaptIcon.js +60 -0
- package/dist/Preview/components/icons/MagnifyIcon.d.ts +3 -0
- package/dist/Preview/components/icons/MagnifyIcon.js +40 -0
- package/dist/Preview/components/icons/ResetIcon.d.ts +3 -0
- package/dist/Preview/components/icons/ResetIcon.js +66 -0
- package/dist/Preview/components/icons/ShrinkIcon.d.ts +3 -0
- package/dist/Preview/components/icons/ShrinkIcon.js +40 -0
- package/dist/Preview/components/preview/phone.d.ts +7 -0
- package/dist/Preview/components/preview/phone.js +10 -0
- package/dist/Preview/components/preview/phone.scss +8 -0
- package/dist/Preview/components/preview/web.d.ts +6 -0
- package/dist/Preview/components/preview/web.js +10 -0
- package/dist/Preview/components/reactflow/Controls.d.ts +5 -0
- package/dist/Preview/components/reactflow/Controls.js +69 -0
- package/dist/Preview/components/reactflow/TopPreview.d.ts +5 -0
- package/dist/Preview/components/reactflow/TopPreview.js +28 -0
- package/dist/Preview/index.d.ts +5 -0
- package/dist/Preview/index.js +94 -0
- package/dist/Preview/index.scss +35 -0
- package/dist/Preview/types/type.d.ts +21 -0
- package/dist/affix/index.d.ts +3 -0
- package/dist/affix/index.js +2 -0
- package/dist/alert/index.d.ts +5 -0
- package/dist/alert/index.js +2 -0
- package/dist/anchor/index.d.ts +10 -0
- package/dist/anchor/index.js +18 -0
- package/dist/anchor/index.scss +23 -0
- package/dist/app/index.d.ts +5 -0
- package/dist/app/index.js +2 -0
- package/dist/approval-process/components/Avatar.d.ts +3 -0
- package/dist/approval-process/components/Avatar.js +100 -0
- package/dist/approval-process/components/BackOut.d.ts +3 -0
- package/dist/approval-process/components/BackOut.js +35 -0
- package/dist/approval-process/components/Failed.d.ts +3 -0
- package/dist/approval-process/components/Failed.js +37 -0
- package/dist/approval-process/components/Pending.d.ts +3 -0
- package/dist/approval-process/components/Pending.js +51 -0
- package/dist/approval-process/components/StartIcon.d.ts +3 -0
- package/dist/approval-process/components/StartIcon.js +35 -0
- package/dist/approval-process/components/Success.d.ts +3 -0
- package/dist/approval-process/components/Success.js +35 -0
- package/dist/approval-process/index.d.ts +7 -0
- package/dist/approval-process/index.js +96 -0
- package/dist/approval-process/index.scss +95 -0
- package/dist/areas/index.d.ts +4 -0
- package/dist/areas/index.js +317 -0
- package/dist/areas/index.scss +21 -0
- package/dist/areas/types/types.d.ts +39 -0
- package/dist/aside/components/AddBtnIcon.d.ts +3 -0
- package/dist/aside/components/AddBtnIcon.js +27 -0
- package/dist/aside/components/DelBtnIcon.d.ts +3 -0
- package/dist/aside/components/DelBtnIcon.js +33 -0
- package/dist/aside/components/DragBtnIcon.d.ts +3 -0
- package/dist/aside/components/DragBtnIcon.js +26 -0
- package/dist/aside/components/EditBtnIcon.d.ts +3 -0
- package/dist/aside/components/EditBtnIcon.js +33 -0
- package/dist/aside/components/SortableItem.d.ts +5 -0
- package/dist/aside/components/SortableItem.js +125 -0
- package/dist/aside/components/SortableItem.scss +93 -0
- package/dist/aside/index.d.ts +4 -0
- package/dist/aside/index.js +186 -0
- package/dist/aside/index.scss +25 -0
- package/dist/aside/types/types.d.ts +44 -0
- package/dist/auto-complete/index.d.ts +4 -0
- package/dist/auto-complete/index.js +2 -0
- package/dist/avatar/index.d.ts +3 -0
- package/dist/avatar/index.js +2 -0
- package/dist/badge/index.d.ts +11 -0
- package/dist/badge/index.js +21 -0
- package/dist/badge/index.scss +5 -0
- package/dist/breadcrumb/index.d.ts +9 -0
- package/dist/breadcrumb/index.js +10 -0
- package/dist/business-tree/components/dept.d.ts +4 -0
- package/dist/business-tree/components/dept.js +35 -0
- package/dist/business-tree/components/space.d.ts +4 -0
- package/dist/business-tree/components/space.js +48 -0
- package/dist/business-tree/index.d.ts +3 -0
- package/dist/business-tree/index.js +16 -0
- package/dist/button/index.d.ts +13 -0
- package/dist/button/index.js +54 -0
- package/dist/button/index.scss +31 -0
- package/dist/calendar/index.d.ts +3 -0
- package/dist/calendar/index.js +2 -0
- package/dist/card/index.d.ts +3 -0
- package/dist/card/index.js +2 -0
- package/dist/carousel/index.d.ts +3 -0
- package/dist/carousel/index.js +2 -0
- package/dist/cascader/index.d.ts +11 -0
- package/dist/cascader/index.js +23 -0
- package/dist/cascader/index.scss +5 -0
- package/dist/checkbox/index.d.ts +10 -0
- package/dist/checkbox/index.js +13 -0
- package/dist/collapse/index.d.ts +3 -0
- package/dist/collapse/index.js +2 -0
- package/dist/color-picker/index.d.ts +6 -0
- package/dist/color-picker/index.js +2 -0
- package/dist/config-provider/context.d.ts +8 -0
- package/dist/config-provider/context.js +2 -0
- package/dist/config-provider/index.d.ts +24 -0
- package/dist/config-provider/index.js +34 -0
- package/dist/date-interval/index.d.ts +16 -0
- package/dist/date-interval/index.js +82 -0
- package/dist/date-picker/index.d.ts +3 -0
- package/dist/date-picker/index.js +2 -0
- package/dist/date-range/index.d.ts +16 -0
- package/dist/date-range/index.js +83 -0
- package/dist/description/index.d.ts +3 -0
- package/dist/description/index.js +2 -0
- package/dist/dictionary/index.d.ts +6 -0
- package/dist/dictionary/index.js +45 -0
- package/dist/dictionary/types/types.d.ts +14 -0
- package/dist/divider/index.d.ts +4 -0
- package/dist/divider/index.js +5 -0
- package/dist/drawer/index.d.ts +3 -0
- package/dist/drawer/index.js +2 -0
- package/dist/drawer-modal/components/CloseOutlined.d.ts +7 -0
- package/dist/drawer-modal/components/CloseOutlined.js +23 -0
- package/dist/drawer-modal/index.d.ts +6 -0
- package/dist/drawer-modal/index.js +37 -0
- package/dist/drawer-modal/index.scss +39 -0
- package/dist/drawer-modal/types/types.d.ts +3 -0
- package/dist/dropdown/assets/arrow-down.svg +6 -0
- package/dist/dropdown/index.d.ts +9 -0
- package/dist/dropdown/index.js +7 -0
- package/dist/empty/assets/404.png +0 -0
- package/dist/empty/assets/empty-content.png +0 -0
- package/dist/empty/assets/empty-data.png +0 -0
- package/dist/empty/assets/image-error.png +0 -0
- package/dist/empty/assets/net-error.png +0 -0
- package/dist/empty/assets/no-collect.png +0 -0
- package/dist/empty/assets/no-news.png +0 -0
- package/dist/empty/assets/no-notice.png +0 -0
- package/dist/empty/assets/no-schedule.png +0 -0
- package/dist/empty/assets/no-search-data.png +0 -0
- package/dist/empty/assets/submit-fail.png +0 -0
- package/dist/empty/assets/submit-success.png +0 -0
- package/dist/empty/index.d.ts +12 -0
- package/dist/empty/index.js +131 -0
- package/dist/empty/index.scss +15 -0
- package/dist/flex/index.d.ts +4 -0
- package/dist/flex/index.js +5 -0
- package/dist/float-button/index.d.ts +9 -0
- package/dist/float-button/index.js +10 -0
- package/dist/form/index.d.ts +3 -0
- package/dist/form/index.js +2 -0
- package/dist/grid/index.d.ts +6 -0
- package/dist/grid/index.js +8 -0
- package/dist/group-title/index.d.ts +7 -0
- package/dist/group-title/index.js +21 -0
- package/dist/group-title/index.scss +31 -0
- package/dist/hooks/useAssets.d.ts +1 -0
- package/dist/hooks/useAssets.js +11 -0
- package/dist/hooks/useBem.d.ts +15 -0
- package/dist/hooks/useBem.js +80 -0
- package/dist/hooks/useRequest.d.ts +1 -0
- package/dist/hooks/useRequest.js +11 -0
- package/dist/image/assets/default.png +0 -0
- package/dist/image/assets/error.png +0 -0
- package/dist/image/assets/eye.png +0 -0
- package/dist/image/index.d.ts +10 -0
- package/dist/image/index.js +95 -0
- package/dist/image/index.scss +27 -0
- package/dist/index.d.ts +156 -0
- package/dist/index.js +85 -0
- package/dist/input/index.d.ts +10 -0
- package/dist/input/index.js +24 -0
- package/dist/input/index.scss +5 -0
- package/dist/input-number/index.d.ts +3 -0
- package/dist/input-number/index.js +2 -0
- package/dist/layout/index.d.ts +6 -0
- package/dist/layout/index.js +2 -0
- package/dist/list/index.d.ts +3 -0
- package/dist/list/index.js +2 -0
- package/dist/mentions/index.d.ts +3 -0
- package/dist/mentions/index.js +2 -0
- package/dist/menu/index.d.ts +9 -0
- package/dist/menu/index.js +12 -0
- package/dist/message/index.d.ts +3 -0
- package/dist/message/index.js +2 -0
- package/dist/modal/components/header-icon.d.ts +3 -0
- package/dist/modal/components/header-icon.js +46 -0
- package/dist/modal/index.d.ts +10 -0
- package/dist/modal/index.js +41 -0
- package/dist/modal/index.scss +65 -0
- package/dist/notification/index.d.ts +3 -0
- package/dist/notification/index.js +2 -0
- package/dist/pagination/index.d.ts +5 -0
- package/dist/pagination/index.js +22 -0
- package/dist/pagination/index.scss +47 -0
- package/dist/pop-confirm/index.d.ts +3 -0
- package/dist/pop-confirm/index.js +2 -0
- package/dist/popover/index.d.ts +5 -0
- package/dist/popover/index.js +2 -0
- package/dist/progress/index.d.ts +3 -0
- package/dist/progress/index.js +2 -0
- package/dist/qrcode/index.d.ts +3 -0
- package/dist/qrcode/index.js +2 -0
- package/dist/radio/index.d.ts +4 -0
- package/dist/radio/index.js +3 -0
- package/dist/rate/index.d.ts +3 -0
- package/dist/rate/index.js +2 -0
- package/dist/result/index.d.ts +2 -0
- package/dist/result/index.js +2 -0
- package/dist/school/index.d.ts +4 -0
- package/dist/school/index.js +304 -0
- package/dist/school/index.scss +21 -0
- package/dist/school/types/types.d.ts +84 -0
- package/dist/segmented/index.d.ts +3 -0
- package/dist/segmented/index.js +2 -0
- package/dist/select/index.d.ts +3 -0
- package/dist/select/index.js +2 -0
- package/dist/skeleton/index.d.ts +9 -0
- package/dist/skeleton/index.js +2 -0
- package/dist/slider/index.d.ts +3 -0
- package/dist/slider/index.js +2 -0
- package/dist/space/index.d.ts +6 -0
- package/dist/space/index.js +2 -0
- package/dist/spin/index.d.ts +2 -0
- package/dist/spin/index.js +2 -0
- package/dist/splitter/index.d.ts +6 -0
- package/dist/splitter/index.js +2 -0
- package/dist/state/index.d.ts +8 -0
- package/dist/state/index.js +28 -0
- package/dist/state/index.scss +89 -0
- package/dist/statistic/index.d.ts +2 -0
- package/dist/statistic/index.js +2 -0
- package/dist/steps/index.d.ts +10 -0
- package/dist/steps/index.js +18 -0
- package/dist/steps/index.scss +32 -0
- package/dist/switch/index.d.ts +3 -0
- package/dist/switch/index.js +2 -0
- package/dist/table/components/icons/DownOutlined.d.ts +3 -0
- package/dist/table/components/icons/DownOutlined.js +28 -0
- package/dist/table/components/icons/DragHandler.d.ts +3 -0
- package/dist/table/components/icons/DragHandler.js +24 -0
- package/dist/table/components/icons/SettingFilled.d.ts +3 -0
- package/dist/table/components/icons/SettingFilled.js +22 -0
- package/dist/table/components/icons/UpOutlined.d.ts +3 -0
- package/dist/table/components/icons/UpOutlined.js +28 -0
- package/dist/table/components/primary-header-row/index.d.ts +3 -0
- package/dist/table/components/primary-header-row/index.js +130 -0
- package/dist/table/components/primary-header-row/index.scss +58 -0
- package/dist/table/components/primary-tbody-row/index.d.ts +3 -0
- package/dist/table/components/primary-tbody-row/index.js +40 -0
- package/dist/table/components/primary-tbody-row/index.scss +5 -0
- package/dist/table/index.d.ts +41 -0
- package/dist/table/index.js +146 -0
- package/dist/table/index.module.scss +9 -0
- package/dist/table/index.scss +33 -0
- package/dist/tabs/index.d.ts +12 -0
- package/dist/tabs/index.js +108 -0
- package/dist/tabs/index.scss +50 -0
- package/dist/tag/index.d.ts +2 -0
- package/dist/tag/index.js +2 -0
- package/dist/teacher/index.d.ts +3 -0
- package/dist/teacher/index.js +59 -0
- package/dist/teacher/types/types.d.ts +31 -0
- package/dist/time-picker/index.d.ts +3 -0
- package/dist/time-picker/index.js +2 -0
- package/dist/timeline/index.d.ts +5 -0
- package/dist/timeline/index.js +2 -0
- package/dist/tooltip/index.d.ts +5 -0
- package/dist/tooltip/index.js +2 -0
- package/dist/tour/index.d.ts +5 -0
- package/dist/tour/index.js +2 -0
- package/dist/transfer/index.d.ts +3 -0
- package/dist/transfer/index.js +2 -0
- package/dist/tree/components/BedIcon.d.ts +3 -0
- package/dist/tree/components/BedIcon.js +29 -0
- package/dist/tree/components/CampusIcon.d.ts +3 -0
- package/dist/tree/components/CampusIcon.js +30 -0
- package/dist/tree/components/DeptIcon.d.ts +3 -0
- package/dist/tree/components/DeptIcon.js +32 -0
- package/dist/tree/components/FloorIcon.d.ts +3 -0
- package/dist/tree/components/FloorIcon.js +32 -0
- package/dist/tree/components/RoomIcon.d.ts +3 -0
- package/dist/tree/components/RoomIcon.js +32 -0
- package/dist/tree/components/SchoolIcon.d.ts +3 -0
- package/dist/tree/components/SchoolIcon.js +70 -0
- package/dist/tree/components/TierlIcon.d.ts +3 -0
- package/dist/tree/components/TierlIcon.js +39 -0
- package/dist/tree/index.d.ts +27 -0
- package/dist/tree/index.js +207 -0
- package/dist/tree/index.scss +25 -0
- package/dist/tree-select/index.d.ts +3 -0
- package/dist/tree-select/index.js +2 -0
- package/dist/typography/index.d.ts +3 -0
- package/dist/typography/index.js +2 -0
- package/dist/upload/assets/again.png +0 -0
- package/dist/upload/assets/delete.png +0 -0
- package/dist/upload/assets/success.png +0 -0
- package/dist/upload/components/AgainIcon.d.ts +3 -0
- package/dist/upload/components/AgainIcon.js +29 -0
- package/dist/upload/components/DeleteIcon.d.ts +3 -0
- package/dist/upload/components/DeleteIcon.js +28 -0
- package/dist/upload/components/DeleteImage.d.ts +3 -0
- package/dist/upload/components/DeleteImage.js +47 -0
- package/dist/upload/components/SuccessIcon.d.ts +3 -0
- package/dist/upload/components/SuccessIcon.js +28 -0
- package/dist/upload/components/UpLoadIconAdd.d.ts +3 -0
- package/dist/upload/components/UpLoadIconAdd.js +28 -0
- package/dist/upload/components/UploadIcon.d.ts +3 -0
- package/dist/upload/components/UploadIcon.js +36 -0
- package/dist/upload/components/fileUpload.d.ts +13 -0
- package/dist/upload/components/fileUpload.js +258 -0
- package/dist/upload/components/imageUpload.d.ts +13 -0
- package/dist/upload/components/imageUpload.js +243 -0
- package/dist/upload/index.d.ts +20 -0
- package/dist/upload/index.js +16 -0
- package/dist/upload/index.scss +115 -0
- package/dist/user-dropdown/index.d.ts +3 -0
- package/dist/user-dropdown/index.js +101 -0
- package/dist/user-dropdown/types/types.d.ts +44 -0
- package/dist/utils/types.d.ts +7 -0
- package/dist/utils/types.js +1 -0
- package/dist/utils/utils.d.ts +2 -0
- package/dist/utils/utils.js +12 -0
- package/dist/watermark/index.d.ts +3 -0
- package/dist/watermark/index.js +2 -0
- package/dist/year-options/index.d.ts +11 -0
- package/dist/year-options/index.js +32 -0
- package/dist/year-term/index.d.ts +4 -0
- package/dist/year-term/index.js +169 -0
- package/dist/year-term/index.scss +21 -0
- package/dist/year-term/types/types.d.ts +28 -0
- package/dist/zones/index.d.ts +3 -0
- package/dist/zones/index.js +186 -0
- package/dist/zones/index.module.scss +23 -0
- package/dist/zones/types/types.d.ts +26 -0
- package/package.json +97 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
var _excluded = ["style", "className"];
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
5
|
+
import React, { forwardRef } from 'react';
|
6
|
+
export var DeleteImage = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
7
|
+
var style = _ref.style,
|
8
|
+
className = _ref.className,
|
9
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
10
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
11
|
+
ref: ref,
|
12
|
+
width: "16",
|
13
|
+
height: "16",
|
14
|
+
viewBox: "0 0 16 16",
|
15
|
+
fill: "none",
|
16
|
+
xmlns: "http://www.w3.org/2000/svg"
|
17
|
+
}, rest, {
|
18
|
+
style: style,
|
19
|
+
className: className
|
20
|
+
}), /*#__PURE__*/React.createElement("g", {
|
21
|
+
id: "\xE5\x88\xA0\xE9\x99\xA4"
|
22
|
+
}, /*#__PURE__*/React.createElement("g", {
|
23
|
+
id: "Group 5151"
|
24
|
+
}, /*#__PURE__*/React.createElement("circle", {
|
25
|
+
id: "Ellipse 214",
|
26
|
+
cx: "8",
|
27
|
+
cy: "8",
|
28
|
+
r: "7",
|
29
|
+
fill: "black",
|
30
|
+
fillOpacity: "0.45"
|
31
|
+
}), /*#__PURE__*/React.createElement("g", {
|
32
|
+
id: "Frame",
|
33
|
+
clipPath: "url(#clip0_534_350)"
|
34
|
+
}, /*#__PURE__*/React.createElement("path", {
|
35
|
+
id: "Union",
|
36
|
+
d: "M7.99577 8.8001L10.6872 11.4915L11.4915 10.6872L8.8001 7.99577L11.4915 5.30436L10.6872 4.50002L7.99577 7.19144L5.30433 4.5L4.5 5.30433L7.19144 7.99577L4.5 10.6872L5.30433 11.4915L7.99577 8.8001Z",
|
37
|
+
fill: "white"
|
38
|
+
})))), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
39
|
+
id: "clip0_534_350"
|
40
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
41
|
+
width: "7",
|
42
|
+
height: "7",
|
43
|
+
fill: "white",
|
44
|
+
transform: "translate(4.5 4.5)"
|
45
|
+
}))));
|
46
|
+
});
|
47
|
+
DeleteImage.displayName = 'DeleteImage';
|
@@ -0,0 +1,28 @@
|
|
1
|
+
var _excluded = ["style", "className"];
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
5
|
+
import React, { forwardRef } from 'react';
|
6
|
+
export var SuccessIcon = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
7
|
+
var style = _ref.style,
|
8
|
+
className = _ref.className,
|
9
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
10
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
11
|
+
ref: ref,
|
12
|
+
width: "16",
|
13
|
+
height: "16",
|
14
|
+
viewBox: "0 0 16 16",
|
15
|
+
fill: "none",
|
16
|
+
xmlns: "http://www.w3.org/2000/svg"
|
17
|
+
}, rest, {
|
18
|
+
style: style,
|
19
|
+
className: className
|
20
|
+
}), /*#__PURE__*/React.createElement("g", {
|
21
|
+
id: "check-circle-filled"
|
22
|
+
}, /*#__PURE__*/React.createElement("path", {
|
23
|
+
id: "Union",
|
24
|
+
d: "M8 15C11.866 15 15 11.866 15 8C15 4.13401 11.866 1 8 1C4.13401 1 1 4.13401 1 8C1 11.866 4.13401 15 8 15ZM4.5 8.2065L5.2065 7.5L7 9.293L10.7925 5.5L11.5 6.2075L7 10.707L4.5 8.2065Z",
|
25
|
+
fill: "#00A870"
|
26
|
+
})));
|
27
|
+
});
|
28
|
+
SuccessIcon.displayName = 'SuccessIcon';
|
@@ -0,0 +1,28 @@
|
|
1
|
+
var _excluded = ["style", "className"];
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
5
|
+
import React, { forwardRef } from 'react';
|
6
|
+
export var UpLoadIconAdd = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
7
|
+
var style = _ref.style,
|
8
|
+
className = _ref.className,
|
9
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
10
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
11
|
+
ref: ref,
|
12
|
+
width: "24",
|
13
|
+
height: "24",
|
14
|
+
viewBox: "0 0 24 24",
|
15
|
+
fill: "none",
|
16
|
+
xmlns: "http://www.w3.org/2000/svg"
|
17
|
+
}, rest, {
|
18
|
+
style: style,
|
19
|
+
className: className
|
20
|
+
}), /*#__PURE__*/React.createElement("g", {
|
21
|
+
id: "add"
|
22
|
+
}, /*#__PURE__*/React.createElement("path", {
|
23
|
+
id: "Union",
|
24
|
+
d: "M11.025 12.975V18.75H12.975V12.975H18.75V11.025H12.975V5.25H11.025V11.025H5.25V12.975H11.025Z",
|
25
|
+
fill: "#333333"
|
26
|
+
})));
|
27
|
+
});
|
28
|
+
UpLoadIconAdd.displayName = 'UpLoadIconAdd';
|
@@ -0,0 +1,36 @@
|
|
1
|
+
var _excluded = ["style", "className"];
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
5
|
+
import React, { forwardRef } from 'react';
|
6
|
+
export var UploadIcon = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
7
|
+
var style = _ref.style,
|
8
|
+
className = _ref.className,
|
9
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
10
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
11
|
+
ref: ref,
|
12
|
+
width: "16",
|
13
|
+
height: "17",
|
14
|
+
viewBox: "0 0 16 17",
|
15
|
+
fill: "none",
|
16
|
+
xmlns: "http://www.w3.org/2000/svg"
|
17
|
+
}, rest, {
|
18
|
+
style: style,
|
19
|
+
className: className
|
20
|
+
}), /*#__PURE__*/React.createElement("g", {
|
21
|
+
id: "upload"
|
22
|
+
}, /*#__PURE__*/React.createElement("g", {
|
23
|
+
id: "Union"
|
24
|
+
}, /*#__PURE__*/React.createElement("path", {
|
25
|
+
className: "path-1",
|
26
|
+
d: "M3.73759 7.1778L7.50118 3.41421L7.5012 12L8.5012 12L8.50118 3.41422L12.2648 7.1778L12.9719 6.47069L8.35473 1.85355C8.15947 1.65829 7.84289 1.65829 7.64762 1.85355L3.03048 6.4707L3.73759 7.1778Z",
|
27
|
+
fill: "black",
|
28
|
+
fillOpacity: "0.85"
|
29
|
+
}), /*#__PURE__*/React.createElement("path", {
|
30
|
+
className: "path-1",
|
31
|
+
d: "M2 11.5V13.5C2 14.0523 2.44772 14.5 3 14.5H13C13.5523 14.5 14 14.0523 14 13.5V11.5H13V13.5H3V11.5H2Z",
|
32
|
+
fill: "black",
|
33
|
+
fillOpacity: "0.85"
|
34
|
+
}))));
|
35
|
+
});
|
36
|
+
UploadIcon.displayName = 'UploadIcon';
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import type { UploadFile } from 'antd';
|
2
|
+
import React from 'react';
|
3
|
+
import '../index.scss';
|
4
|
+
import { UploadRef } from 'antd/es/upload/Upload';
|
5
|
+
declare const FileUpload: React.ForwardRefExoticComponent<import("antd").UploadProps<any> & {
|
6
|
+
maxCount?: number | undefined;
|
7
|
+
accept?: string | undefined;
|
8
|
+
folder?: string | undefined;
|
9
|
+
value?: UploadFile<any>[] | undefined;
|
10
|
+
fileType?: "image" | "file" | undefined;
|
11
|
+
onChange?: ((value?: UploadFile<any>[] | undefined) => void) | undefined;
|
12
|
+
} & React.RefAttributes<UploadRef<any>>>;
|
13
|
+
export default FileUpload;
|
@@ -0,0 +1,258 @@
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
9
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
10
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
11
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
12
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
13
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
14
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
15
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
16
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
17
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
18
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
19
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
20
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
21
|
+
import { Upload as AntUpload } from 'antd';
|
22
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
23
|
+
import { Button, message } from "../..";
|
24
|
+
import { useRequest } from "../../hooks/useRequest";
|
25
|
+
import "../index.scss";
|
26
|
+
import { useAssets } from "../../hooks/useAssets";
|
27
|
+
import { useBem } from "../../hooks/useBem";
|
28
|
+
import AgainImage from "../assets/again.png";
|
29
|
+
import DeleteImage from "../assets/delete.png";
|
30
|
+
import SuccessIcon from "../assets/success.png";
|
31
|
+
import { UploadIcon } from "./UploadIcon";
|
32
|
+
var InternalUpload = function InternalUpload(props, ref) {
|
33
|
+
var _fileList$filter;
|
34
|
+
var mb = useBem('upload');
|
35
|
+
var maxCount = props.maxCount,
|
36
|
+
accept = props.accept,
|
37
|
+
folder = props.folder,
|
38
|
+
value = props.value,
|
39
|
+
onChange = props.onChange;
|
40
|
+
var _useState = useState([]),
|
41
|
+
_useState2 = _slicedToArray(_useState, 2),
|
42
|
+
fileList = _useState2[0],
|
43
|
+
setFileList = _useState2[1];
|
44
|
+
var _useState3 = useState(null),
|
45
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
46
|
+
setPreviewFile = _useState4[1];
|
47
|
+
var _useRequest = useRequest(),
|
48
|
+
request = _useRequest.request;
|
49
|
+
var assetsURL = useAssets();
|
50
|
+
var _message$useMessage = message.useMessage(),
|
51
|
+
_message$useMessage2 = _slicedToArray(_message$useMessage, 2),
|
52
|
+
messageApi = _message$useMessage2[0],
|
53
|
+
contextHolder = _message$useMessage2[1];
|
54
|
+
function getBase64(_x) {
|
55
|
+
return _getBase.apply(this, arguments);
|
56
|
+
}
|
57
|
+
function _getBase() {
|
58
|
+
_getBase = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {
|
59
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
60
|
+
while (1) switch (_context.prev = _context.next) {
|
61
|
+
case 0:
|
62
|
+
if (!(typeof file === 'string')) {
|
63
|
+
_context.next = 6;
|
64
|
+
break;
|
65
|
+
}
|
66
|
+
_context.next = 3;
|
67
|
+
return Promise.resolve(file);
|
68
|
+
case 3:
|
69
|
+
return _context.abrupt("return", _context.sent);
|
70
|
+
case 6:
|
71
|
+
_context.next = 8;
|
72
|
+
return new Promise(function (resolve, reject) {
|
73
|
+
var reader = new FileReader();
|
74
|
+
reader.readAsDataURL(file);
|
75
|
+
reader.onload = function () {
|
76
|
+
resolve(reader.result);
|
77
|
+
};
|
78
|
+
reader.onerror = function (error) {
|
79
|
+
reject(error);
|
80
|
+
};
|
81
|
+
});
|
82
|
+
case 8:
|
83
|
+
return _context.abrupt("return", _context.sent);
|
84
|
+
case 9:
|
85
|
+
case "end":
|
86
|
+
return _context.stop();
|
87
|
+
}
|
88
|
+
}, _callee);
|
89
|
+
}));
|
90
|
+
return _getBase.apply(this, arguments);
|
91
|
+
}
|
92
|
+
function beforeUpload(file) {
|
93
|
+
if (/\.(bmp|jpg|png|tif|gif|pcx|tga|exif|fpx|svg|psd|cdr|pcd|dxf|ufo|eps|ai|raw|WMF|webp|jpeg)$/i.test(file.name)) {
|
94
|
+
if ((file === null || file === void 0 ? void 0 : file.size) / 1024 / 1024 > 5) {
|
95
|
+
void messageApi.info('请上传5M以内的图片');
|
96
|
+
return false;
|
97
|
+
}
|
98
|
+
} else if (/\.(mp4)$/i.test(file.name)) {
|
99
|
+
if ((file === null || file === void 0 ? void 0 : file.size) / 1024 / 1024 > 200) {
|
100
|
+
void messageApi.info('请上传200M以内的视频');
|
101
|
+
return false;
|
102
|
+
}
|
103
|
+
}
|
104
|
+
var formData = new FormData();
|
105
|
+
if (folder != null) {
|
106
|
+
formData.append('folder', folder);
|
107
|
+
}
|
108
|
+
formData.append('files', file);
|
109
|
+
formData.append('user_origin_name', 'true');
|
110
|
+
void request({
|
111
|
+
url: "/v1/file/multi-upload1",
|
112
|
+
method: 'post',
|
113
|
+
data: formData,
|
114
|
+
headers: {
|
115
|
+
'Content-Type': 'multipart/form-data'
|
116
|
+
}
|
117
|
+
}).then(function (res) {
|
118
|
+
var _fileList = _toConsumableArray(fileList);
|
119
|
+
var filteredList = _fileList.filter(function (item) {
|
120
|
+
return !(item.uid === file.uid && item.status === 'error');
|
121
|
+
});
|
122
|
+
var filterError = _fileList.filter(function (item) {
|
123
|
+
return item.status === 'done';
|
124
|
+
});
|
125
|
+
var _list = Array.from([]);
|
126
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
127
|
+
// @ts-expect-error
|
128
|
+
res === null || res === void 0 || res.forEach(function (item) {
|
129
|
+
_list.push({
|
130
|
+
name: file.name,
|
131
|
+
url: item.filename,
|
132
|
+
uid: file.uid,
|
133
|
+
preview: item.filename,
|
134
|
+
status: 'done'
|
135
|
+
});
|
136
|
+
});
|
137
|
+
var _url = Array.from([]);
|
138
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
139
|
+
// @ts-expect-error
|
140
|
+
fileList === null || fileList === void 0 || fileList.map(function (item) {
|
141
|
+
return _url.push(item.preview);
|
142
|
+
});
|
143
|
+
onChange === null || onChange === void 0 || onChange([].concat(_toConsumableArray(filterError), _list));
|
144
|
+
setFileList([].concat(_toConsumableArray(filteredList), _list));
|
145
|
+
}).catch(function () {
|
146
|
+
// const msg = e?.response?.data?.[0]?.message;
|
147
|
+
var _fileList = Array.from([]);
|
148
|
+
_fileList.push({
|
149
|
+
name: file.name,
|
150
|
+
status: 'error',
|
151
|
+
lastModified: file.lastModified,
|
152
|
+
lastModifiedDate: file.lastModifiedDate,
|
153
|
+
uid: file.uid,
|
154
|
+
size: file.size,
|
155
|
+
type: file.type,
|
156
|
+
originFileObj: file
|
157
|
+
});
|
158
|
+
setFileList([].concat(_toConsumableArray(fileList), _fileList));
|
159
|
+
var msg = '上传失败!';
|
160
|
+
void messageApi.error(msg);
|
161
|
+
});
|
162
|
+
return false;
|
163
|
+
}
|
164
|
+
var onRemove = function onRemove(file) {
|
165
|
+
var newFileList = fileList === null || fileList === void 0 ? void 0 : fileList.filter(function (item) {
|
166
|
+
return item.uid !== file.uid;
|
167
|
+
});
|
168
|
+
onChange === null || onChange === void 0 || onChange(newFileList);
|
169
|
+
setFileList(newFileList);
|
170
|
+
};
|
171
|
+
var ReUpload = function ReUpload(file) {
|
172
|
+
if (file.originFileObj) {
|
173
|
+
beforeUpload(file.originFileObj);
|
174
|
+
} else {
|
175
|
+
console.error('无法重新上传文件:缺少原始文件对象');
|
176
|
+
}
|
177
|
+
};
|
178
|
+
function handlePreview(file) {
|
179
|
+
if (file.url != null) {
|
180
|
+
setPreviewFile(file);
|
181
|
+
} else if (file.originFileObj != null) {
|
182
|
+
void getBase64(file.originFileObj).then(function (res) {
|
183
|
+
file.url = res;
|
184
|
+
setPreviewFile(file);
|
185
|
+
});
|
186
|
+
}
|
187
|
+
}
|
188
|
+
var newFileList = useMemo(function () {
|
189
|
+
return fileList != null && fileList !== null && fileList !== void 0 && fileList.every(function (item) {
|
190
|
+
return item.url;
|
191
|
+
}) ? fileList === null || fileList === void 0 ? void 0 : fileList.map(function (item) {
|
192
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
193
|
+
url: "".concat(assetsURL, "/").concat(item.url)
|
194
|
+
});
|
195
|
+
}) : [];
|
196
|
+
}, [fileList]);
|
197
|
+
useEffect(function () {
|
198
|
+
if (value != null && fileList.length === 0 && Array.isArray(value)) {
|
199
|
+
var _value$filter;
|
200
|
+
var _fileList = Array.from([]);
|
201
|
+
value === null || value === void 0 || (_value$filter = value.filter(function (item) {
|
202
|
+
return item.url != null;
|
203
|
+
})) === null || _value$filter === void 0 || _value$filter.map(function (item) {
|
204
|
+
return _fileList.push({
|
205
|
+
uid: "".concat(Date.now(), ".fileUid"),
|
206
|
+
name: item.name,
|
207
|
+
status: 'done',
|
208
|
+
url: item.url,
|
209
|
+
preview: item.url
|
210
|
+
});
|
211
|
+
});
|
212
|
+
setFileList(_fileList);
|
213
|
+
}
|
214
|
+
}, [value]);
|
215
|
+
var uploadButton = /*#__PURE__*/React.createElement("div", {
|
216
|
+
className: "".concat(mb.b('file').b('btn'))
|
217
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
218
|
+
type: "default",
|
219
|
+
icon: /*#__PURE__*/React.createElement(UploadIcon, {
|
220
|
+
className: "".concat(mb.b('file').b('btn').e('icon'))
|
221
|
+
})
|
222
|
+
}, "\u4E0A\u4F20\u6587\u4EF6"));
|
223
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, contextHolder, /*#__PURE__*/React.createElement(AntUpload, _extends({
|
224
|
+
ref: ref,
|
225
|
+
className: "".concat(mb, " ").concat(props.className),
|
226
|
+
fileList: newFileList,
|
227
|
+
beforeUpload: beforeUpload,
|
228
|
+
onRemove: onRemove,
|
229
|
+
onPreview: handlePreview,
|
230
|
+
accept: accept,
|
231
|
+
maxCount: maxCount,
|
232
|
+
showUploadList: {
|
233
|
+
extra: function extra(file) {
|
234
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, file.status === 'done' ? /*#__PURE__*/React.createElement("img", {
|
235
|
+
src: SuccessIcon,
|
236
|
+
className: "".concat(mb.e('icon').m('success'))
|
237
|
+
}) : null, file.status === 'error' ? /*#__PURE__*/React.createElement("img", {
|
238
|
+
src: AgainImage,
|
239
|
+
className: "".concat(mb.e('icon').m('again')),
|
240
|
+
onClick: function onClick() {
|
241
|
+
return ReUpload(file);
|
242
|
+
}
|
243
|
+
}) : null, /*#__PURE__*/React.createElement("img", {
|
244
|
+
src: DeleteImage,
|
245
|
+
className: "".concat(mb.e('icon').m('delete')),
|
246
|
+
onClick: function onClick() {
|
247
|
+
return onRemove(file);
|
248
|
+
}
|
249
|
+
}));
|
250
|
+
},
|
251
|
+
showRemoveIcon: false
|
252
|
+
}
|
253
|
+
}, props), (fileList === null || fileList === void 0 || (_fileList$filter = fileList.filter(function (item) {
|
254
|
+
return item.url != null;
|
255
|
+
})) === null || _fileList$filter === void 0 ? void 0 : _fileList$filter.length) >= (maxCount != null ? maxCount : 1) ? null : uploadButton));
|
256
|
+
};
|
257
|
+
var FileUpload = /*#__PURE__*/React.forwardRef(InternalUpload);
|
258
|
+
export default FileUpload;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import type { UploadFile } from 'antd';
|
2
|
+
import React from 'react';
|
3
|
+
import '../index.scss';
|
4
|
+
import { UploadRef } from 'antd/es/upload/Upload';
|
5
|
+
declare const ImageUpload: React.ForwardRefExoticComponent<import("antd").UploadProps<any> & {
|
6
|
+
maxCount?: number | undefined;
|
7
|
+
accept?: string | undefined;
|
8
|
+
folder?: string | undefined;
|
9
|
+
value?: UploadFile<any>[] | undefined;
|
10
|
+
fileType?: "image" | "file" | undefined;
|
11
|
+
onChange?: ((value?: UploadFile<any>[] | undefined) => void) | undefined;
|
12
|
+
} & React.RefAttributes<UploadRef<any>>>;
|
13
|
+
export default ImageUpload;
|