@cloudbase/weda-ui 3.1.0 → 3.1.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/CHANGELOG.md +7 -0
- package/dist/configs/actions/showModal.json +48 -0
- package/dist/configs/actions/showToast.json +41 -0
- package/dist/configs/components/auth.json +16 -0
- package/dist/configs/components/button.json +239 -0
- package/dist/configs/components/calendar.json +81 -0
- package/dist/configs/components/carousel.json +292 -0
- package/dist/configs/components/chart/bar.json +721 -0
- package/dist/configs/components/chart/line.json +674 -0
- package/dist/configs/components/chart/pie.json +494 -0
- package/dist/configs/components/chart/statisticsCard.json +376 -0
- package/dist/configs/components/container.json +50 -0
- package/dist/configs/components/dataView.json +239 -0
- package/dist/configs/components/drawer.json +115 -0
- package/dist/configs/components/form/checkbox.json +178 -0
- package/dist/configs/components/form/form.json +45 -0
- package/dist/configs/components/form/input.json +154 -0
- package/dist/configs/components/form/location.json +248 -0
- package/dist/configs/components/form/radio.json +203 -0
- package/dist/configs/components/form/richText.json +125 -0
- package/dist/configs/components/form/select.json +430 -0
- package/dist/configs/components/form/switch.json +58 -0
- package/dist/configs/components/form/textarea.json +116 -0
- package/dist/configs/components/form/tips.json +34 -0
- package/dist/configs/components/form/uploader.json +171 -0
- package/dist/configs/components/form/uploaderFile.json +158 -0
- package/dist/configs/components/graphicCard.json +413 -0
- package/dist/configs/components/image.json +187 -0
- package/dist/configs/components/link.json +79 -0
- package/dist/configs/components/listView.json +370 -0
- package/dist/configs/components/lottery.json +163 -0
- package/dist/configs/components/modal.json +72 -0
- package/dist/configs/components/navLayout.json +368 -0
- package/dist/configs/components/navigationBar.json +62 -0
- package/dist/configs/components/richtextview.json +26 -0
- package/dist/configs/components/scrollVeiw.json +253 -0
- package/dist/configs/components/slot.json +17 -0
- package/dist/configs/components/swiper.json +90 -0
- package/dist/configs/components/tabs.json +121 -0
- package/dist/configs/components/text.json +95 -0
- package/dist/configs/components/wedaVideo.json +89 -0
- package/dist/configs/components/wxOpenApi/phone.json +127 -0
- package/dist/configs/components/wxOpenApi/phoneCode.json +109 -0
- package/dist/configs/components/wxOpenApi/share.json +157 -0
- package/dist/configs/components/wxOpenApi/userInfo.json +156 -0
- package/dist/configs/index.d.ts +97 -0
- package/dist/configs/index.js +105 -0
- package/dist/docs/common/format.d.ts +13 -0
- package/dist/docs/common/format.js +103 -0
- package/dist/docs/common/tableView.d.ts +30 -0
- package/dist/docs/common/tableView.js +159 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/setupTests.d.ts +1 -0
- package/dist/setupTests.js +14 -0
- package/dist/web/actions/index.d.ts +2 -0
- package/dist/web/actions/index.js +2 -0
- package/dist/web/actions/showModal/index.d.ts +3 -0
- package/dist/web/actions/showModal/index.js +66 -0
- package/dist/web/actions/showToast/index.d.ts +1 -0
- package/dist/web/actions/showToast/index.js +3 -0
- package/dist/web/components/auth/index.d.ts +10 -0
- package/dist/web/components/auth/index.js +37 -0
- package/dist/web/components/button/index.css +27 -0
- package/dist/web/components/button/index.d.ts +32 -0
- package/dist/web/components/button/index.js +48 -0
- package/dist/web/components/calendar/index.css +416 -0
- package/dist/web/components/calendar/index.d.ts +19 -0
- package/dist/web/components/calendar/index.js +181 -0
- package/dist/web/components/calendar/util.d.ts +13 -0
- package/dist/web/components/calendar/util.js +74 -0
- package/dist/web/components/carousel/index.css +119 -0
- package/dist/web/components/carousel/index.d.ts +41 -0
- package/dist/web/components/carousel/index.js +240 -0
- package/dist/web/components/chart/bar/index.d.ts +41 -0
- package/dist/web/components/chart/bar/index.js +56 -0
- package/dist/web/components/chart/common/config/bar.d.ts +48 -0
- package/dist/web/components/chart/common/config/bar.js +49 -0
- package/dist/web/components/chart/common/config/global.d.ts +13 -0
- package/dist/web/components/chart/common/config/global.js +16 -0
- package/dist/web/components/chart/common/config/line.d.ts +46 -0
- package/dist/web/components/chart/common/config/line.js +49 -0
- package/dist/web/components/chart/common/config/pie.d.ts +29 -0
- package/dist/web/components/chart/common/config/pie.js +36 -0
- package/dist/web/components/chart/common/core/eChartBar.d.ts +32 -0
- package/dist/web/components/chart/common/core/eChartBar.js +196 -0
- package/dist/web/components/chart/common/core/eChartBase.d.ts +128 -0
- package/dist/web/components/chart/common/core/eChartBase.js +346 -0
- package/dist/web/components/chart/common/core/eChartLine.d.ts +28 -0
- package/dist/web/components/chart/common/core/eChartLine.js +168 -0
- package/dist/web/components/chart/common/core/eChartPie.d.ts +28 -0
- package/dist/web/components/chart/common/core/eChartPie.js +132 -0
- package/dist/web/components/chart/common/core/type.d.ts +35 -0
- package/dist/web/components/chart/common/core/type.js +9 -0
- package/dist/web/components/chart/common/echarts.d.ts +2 -0
- package/dist/web/components/chart/common/echarts.js +24 -0
- package/dist/web/components/chart/common/useChart.d.ts +8 -0
- package/dist/web/components/chart/common/useChart.js +60 -0
- package/dist/web/components/chart/line/index.d.ts +39 -0
- package/dist/web/components/chart/line/index.js +53 -0
- package/dist/web/components/chart/pie/index.d.ts +27 -0
- package/dist/web/components/chart/pie/index.js +40 -0
- package/dist/web/components/chart/statisticsCard/index.css +63 -0
- package/dist/web/components/chart/statisticsCard/index.d.ts +85 -0
- package/dist/web/components/chart/statisticsCard/index.js +203 -0
- package/dist/web/components/chart/statisticsCard/interface.d.ts +13 -0
- package/dist/web/components/chart/statisticsCard/interface.js +1 -0
- package/dist/web/components/container/index.d.ts +6 -0
- package/dist/web/components/container/index.js +6 -0
- package/dist/web/components/dataView/index.d.ts +6 -0
- package/dist/web/components/dataView/index.js +8 -0
- package/dist/web/components/dataView/interface.d.ts +5 -0
- package/dist/web/components/dataView/interface.js +1 -0
- package/dist/web/components/drawer/index.d.ts +13 -0
- package/dist/web/components/drawer/index.js +12 -0
- package/dist/web/components/form/checkbox/index.d.ts +13 -0
- package/dist/web/components/form/checkbox/index.js +167 -0
- package/dist/web/components/form/enumSelect/MultipleSelect.d.ts +78 -0
- package/dist/web/components/form/enumSelect/MultipleSelect.js +52 -0
- package/dist/web/components/form/enumSelect/NormalSelect.d.ts +83 -0
- package/dist/web/components/form/enumSelect/NormalSelect.js +52 -0
- package/dist/web/components/form/enumSelect/SelectContainer.d.ts +16 -0
- package/dist/web/components/form/enumSelect/SelectContainer.js +30 -0
- package/dist/web/components/form/enumSelect/index.d.ts +82 -0
- package/dist/web/components/form/enumSelect/index.js +6 -0
- package/dist/web/components/form/enumSelect/props/defaultProps.d.ts +34 -0
- package/dist/web/components/form/enumSelect/props/defaultProps.js +40 -0
- package/dist/web/components/form/enumSelect/props/propsTypes.d.ts +39 -0
- package/dist/web/components/form/enumSelect/props/propsTypes.js +47 -0
- package/dist/web/components/form/form/index.css +9 -0
- package/dist/web/components/form/form/index.d.ts +13 -0
- package/dist/web/components/form/form/index.js +31 -0
- package/dist/web/components/form/formcell/index.css +85 -0
- package/dist/web/components/form/formcell/index.d.ts +8 -0
- package/dist/web/components/form/formcell/index.js +40 -0
- package/dist/web/components/form/input/index.css +40 -0
- package/dist/web/components/form/input/index.d.ts +14 -0
- package/dist/web/components/form/input/index.js +86 -0
- package/dist/web/components/form/location/common/mapChoose.css +477 -0
- package/dist/web/components/form/location/common/mapChoose.d.ts +15 -0
- package/dist/web/components/form/location/common/mapChoose.js +431 -0
- package/dist/web/components/form/location/common/mapView.d.ts +19 -0
- package/dist/web/components/form/location/common/mapView.js +170 -0
- package/dist/web/components/form/location/common/propsConfig.d.ts +62 -0
- package/dist/web/components/form/location/common/propsConfig.js +52 -0
- package/dist/web/components/form/location/common/selectModal.css +45 -0
- package/dist/web/components/form/location/common/selectModal.d.ts +21 -0
- package/dist/web/components/form/location/common/selectModal.js +44 -0
- package/dist/web/components/form/location/common/useLocationInfo.d.ts +34 -0
- package/dist/web/components/form/location/common/useLocationInfo.js +88 -0
- package/dist/web/components/form/location/components/LocationH5/index.css +100 -0
- package/dist/web/components/form/location/components/LocationH5/location.h5.d.ts +8 -0
- package/dist/web/components/form/location/components/LocationH5/location.h5.js +347 -0
- package/dist/web/components/form/location/components/LocationPC/Header.d.ts +12 -0
- package/dist/web/components/form/location/components/LocationPC/Header.js +43 -0
- package/dist/web/components/form/location/components/LocationPC/index.css +40 -0
- package/dist/web/components/form/location/components/LocationPC/location.PC.d.ts +8 -0
- package/dist/web/components/form/location/components/LocationPC/location.PC.js +259 -0
- package/dist/web/components/form/location/constants.d.ts +2 -0
- package/dist/web/components/form/location/constants.js +3 -0
- package/dist/web/components/form/location/index.css +13 -0
- package/dist/web/components/form/location/index.d.ts +1 -0
- package/dist/web/components/form/location/index.js +17 -0
- package/dist/web/components/form/radio/index.css +12 -0
- package/dist/web/components/form/radio/index.d.ts +11 -0
- package/dist/web/components/form/radio/index.js +115 -0
- package/dist/web/components/form/renderDecorator.d.ts +6 -0
- package/dist/web/components/form/renderDecorator.js +20 -0
- package/dist/web/components/form/select/h5.d.ts +16 -0
- package/dist/web/components/form/select/h5.js +502 -0
- package/dist/web/components/form/select/index.css +27 -0
- package/dist/web/components/form/select/index.d.ts +65 -0
- package/dist/web/components/form/select/index.js +299 -0
- package/dist/web/components/form/select/region/index.d.ts +6 -0
- package/dist/web/components/form/select/region/index.js +147 -0
- package/dist/web/components/form/select/time.d.ts +9 -0
- package/dist/web/components/form/select/time.js +146 -0
- package/dist/web/components/form/select/year.d.ts +7 -0
- package/dist/web/components/form/select/year.js +72 -0
- package/dist/web/components/form/switch/index.d.ts +6 -0
- package/dist/web/components/form/switch/index.js +57 -0
- package/dist/web/components/form/textarea/index.css +11 -0
- package/dist/web/components/form/textarea/index.d.ts +12 -0
- package/dist/web/components/form/textarea/index.js +66 -0
- package/dist/web/components/form/tips/index.css +4 -0
- package/dist/web/components/form/tips/index.d.ts +8 -0
- package/dist/web/components/form/tips/index.js +17 -0
- package/dist/web/components/form/uploader/index.css +118 -0
- package/dist/web/components/form/uploader/index.d.ts +3 -0
- package/dist/web/components/form/uploader/index.js +42 -0
- package/dist/web/components/form/uploader/uploader.h5.d.ts +19 -0
- package/dist/web/components/form/uploader/uploader.h5.js +201 -0
- package/dist/web/components/form/uploader/uploader.pc.d.ts +29 -0
- package/dist/web/components/form/uploader/uploader.pc.js +182 -0
- package/dist/web/components/form/uploaderFile/index.css +422 -0
- package/dist/web/components/form/uploaderFile/index.d.ts +4 -0
- package/dist/web/components/form/uploaderFile/index.js +19 -0
- package/dist/web/components/form/uploaderFile/uploadFile.h5.d.ts +23 -0
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +315 -0
- package/dist/web/components/form/uploaderFile/uploadFile.pc.d.ts +24 -0
- package/dist/web/components/form/uploaderFile/uploadFile.pc.js +290 -0
- package/dist/web/components/graphicCard/index.css +159 -0
- package/dist/web/components/graphicCard/index.d.ts +31 -0
- package/dist/web/components/graphicCard/index.js +166 -0
- package/dist/web/components/image/image.d.ts +9 -0
- package/dist/web/components/image/image.js +119 -0
- package/dist/web/components/image/index.css +54 -0
- package/dist/web/components/image/index.d.ts +13 -0
- package/dist/web/components/image/index.js +91 -0
- package/dist/web/components/index.d.ts +47 -0
- package/dist/web/components/index.js +94 -0
- package/dist/web/components/link/index.css +8 -0
- package/dist/web/components/link/index.d.ts +24 -0
- package/dist/web/components/link/index.js +71 -0
- package/dist/web/components/listView/index.css +143 -0
- package/dist/web/components/listView/index.d.ts +7 -0
- package/dist/web/components/listView/index.js +262 -0
- package/dist/web/components/listView/interface.d.ts +122 -0
- package/dist/web/components/listView/interface.js +1 -0
- package/dist/web/components/lottery/index.css +359 -0
- package/dist/web/components/lottery/index.d.ts +22 -0
- package/dist/web/components/lottery/index.js +390 -0
- package/dist/web/components/lottery/lotteryUtil.d.ts +23 -0
- package/dist/web/components/lottery/lotteryUtil.js +180 -0
- package/dist/web/components/modal/h5.css +53 -0
- package/dist/web/components/modal/index.d.ts +17 -0
- package/dist/web/components/modal/index.js +11 -0
- package/dist/web/components/modal/modal.h5.d.ts +4 -0
- package/dist/web/components/modal/modal.h5.js +46 -0
- package/dist/web/components/modal/modal.pc.d.ts +3 -0
- package/dist/web/components/modal/modal.pc.js +31 -0
- package/dist/web/components/navLayout/index.css +332 -0
- package/dist/web/components/navLayout/index.d.ts +46 -0
- package/dist/web/components/navLayout/index.js +116 -0
- package/dist/web/components/navigationBar/common.d.ts +15 -0
- package/dist/web/components/navigationBar/common.js +127 -0
- package/dist/web/components/navigationBar/h5Menu.d.ts +14 -0
- package/dist/web/components/navigationBar/h5Menu.js +72 -0
- package/dist/web/components/navigationBar/horizontalMenu.d.ts +12 -0
- package/dist/web/components/navigationBar/horizontalMenu.js +99 -0
- package/dist/web/components/navigationBar/index.css +762 -0
- package/dist/web/components/navigationBar/index.d.ts +13 -0
- package/dist/web/components/navigationBar/index.js +157 -0
- package/dist/web/components/navigationBar/verticalMenu.d.ts +13 -0
- package/dist/web/components/navigationBar/verticalMenu.js +38 -0
- package/dist/web/components/phone/index.d.ts +18 -0
- package/dist/web/components/phone/index.js +4 -0
- package/dist/web/components/phoneCode/index.d.ts +18 -0
- package/dist/web/components/phoneCode/index.js +4 -0
- package/dist/web/components/picker/datePicker.d.ts +10 -0
- package/dist/web/components/picker/datePicker.js +31 -0
- package/dist/web/components/picker/picker.d.ts +6 -0
- package/dist/web/components/picker/picker.js +45 -0
- package/dist/web/components/picker/timePicker.d.ts +7 -0
- package/dist/web/components/picker/timePicker.js +42 -0
- package/dist/web/components/richText/const.d.ts +1 -0
- package/dist/web/components/richText/const.js +2 -0
- package/dist/web/components/richText/index.css +93 -0
- package/dist/web/components/richText/index.d.ts +51 -0
- package/dist/web/components/richText/index.js +295 -0
- package/dist/web/components/richTextView/index.css +63 -0
- package/dist/web/components/richTextView/index.d.ts +7 -0
- package/dist/web/components/richTextView/index.js +44 -0
- package/dist/web/components/scrollView/index.d.ts +27 -0
- package/dist/web/components/scrollView/index.js +95 -0
- package/dist/web/components/share/index.d.ts +34 -0
- package/dist/web/components/share/index.js +4 -0
- package/dist/web/components/slot/index.d.ts +6 -0
- package/dist/web/components/slot/index.js +9 -0
- package/dist/web/components/swiper/index.css +106 -0
- package/dist/web/components/swiper/index.d.ts +24 -0
- package/dist/web/components/swiper/index.js +149 -0
- package/dist/web/components/tabs/index.css +64 -0
- package/dist/web/components/tabs/index.d.ts +13 -0
- package/dist/web/components/tabs/index.js +15 -0
- package/dist/web/components/tabs/tabs.h5.d.ts +4 -0
- package/dist/web/components/tabs/tabs.h5.js +42 -0
- package/dist/web/components/tabs/tabs.pc.d.ts +3 -0
- package/dist/web/components/tabs/tabs.pc.js +40 -0
- package/dist/web/components/text/index.css +26 -0
- package/dist/web/components/text/index.d.ts +14 -0
- package/dist/web/components/text/index.js +17 -0
- package/dist/web/components/uploaderFileView/index.css +11 -0
- package/dist/web/components/uploaderFileView/index.d.ts +10 -0
- package/dist/web/components/uploaderFileView/index.js +61 -0
- package/dist/web/components/uploaderView/index.css +31 -0
- package/dist/web/components/uploaderView/index.d.ts +17 -0
- package/dist/web/components/uploaderView/index.js +48 -0
- package/dist/web/components/userInfo/index.d.ts +26 -0
- package/dist/web/components/userInfo/index.js +4 -0
- package/dist/web/components/wedaVideo/index.css +42 -0
- package/dist/web/components/wedaVideo/index.d.ts +17 -0
- package/dist/web/components/wedaVideo/index.js +159 -0
- package/dist/web/index.d.ts +8 -0
- package/dist/web/index.js +4 -0
- package/dist/web/utils/classnames.d.ts +2 -0
- package/dist/web/utils/classnames.js +37 -0
- package/dist/web/utils/constant.d.ts +23 -0
- package/dist/web/utils/constant.js +24 -0
- package/dist/web/utils/debounce.d.ts +2 -0
- package/dist/web/utils/debounce.js +92 -0
- package/dist/web/utils/events.d.ts +1 -0
- package/dist/web/utils/events.js +2 -0
- package/dist/web/utils/getLocalCounter.d.ts +1 -0
- package/dist/web/utils/getLocalCounter.js +4 -0
- package/dist/web/utils/isObjectEqual.d.ts +2 -0
- package/dist/web/utils/isObjectEqual.js +12 -0
- package/dist/web/utils/loading-fallback.d.ts +2 -0
- package/dist/web/utils/loading-fallback.js +2 -0
- package/dist/web/utils/lodash.d.ts +1 -0
- package/dist/web/utils/lodash.js +2 -0
- package/dist/web/utils/platform.d.ts +18 -0
- package/dist/web/utils/platform.js +191 -0
- package/dist/web/utils/tcb.d.ts +23 -0
- package/dist/web/utils/tcb.js +82 -0
- package/dist/web/utils/tmap.d.ts +3 -0
- package/dist/web/utils/tmap.js +21 -0
- package/dist/web/utils/useSetState.d.ts +1 -0
- package/dist/web/utils/useSetState.js +8 -0
- package/dist/web/utils/useSyncValue.d.ts +4 -0
- package/dist/web/utils/useSyncValue.js +15 -0
- package/dist/web/utils/weui.d.ts +1 -0
- package/dist/web/utils/weui.js +2 -0
- package/dist/web/weda-ui.css +90 -0
- package/package.json +12 -11
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { H5UploaderProps } from './uploader.h5';
|
|
3
|
+
export declare const CLASS_PREFIX = "weda-uploader-pc";
|
|
4
|
+
export declare const IMAGE_TYPES: string[];
|
|
5
|
+
/**
|
|
6
|
+
* 上传图片-官方组件
|
|
7
|
+
*/
|
|
8
|
+
export declare function UploaderPC({ layout, className, id, style, title, tips, ...props }: {
|
|
9
|
+
[x: string]: any;
|
|
10
|
+
layout: any;
|
|
11
|
+
className: any;
|
|
12
|
+
id: any;
|
|
13
|
+
style: any;
|
|
14
|
+
title: any;
|
|
15
|
+
tips: any;
|
|
16
|
+
}): JSX.Element;
|
|
17
|
+
export declare function UploaderPCInner(props: any): JSX.Element;
|
|
18
|
+
export interface TcbImageProps {
|
|
19
|
+
fileID?: string;
|
|
20
|
+
isZoom?: boolean;
|
|
21
|
+
onError?: (e: unknown) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare const TcbImage: (props: TcbImageProps) => JSX.Element;
|
|
24
|
+
export interface PropsType extends H5UploaderProps {
|
|
25
|
+
tips?: string;
|
|
26
|
+
value: string | string[];
|
|
27
|
+
btnTitle?: string;
|
|
28
|
+
uploadPath?: string;
|
|
29
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Upload, Button, Icon, message, ErrorTip, ImagePreview, ConfigProvider, } from 'tea-component';
|
|
3
|
+
import classNames from '../../../utils/classnames';
|
|
4
|
+
import { getCloudInstance, getTempFileURL } from '../../../utils/tcb';
|
|
5
|
+
import { isCloudFileID, randomStr } from '../../../utils/platform';
|
|
6
|
+
import isObjectEqual from '../../../utils/isObjectEqual';
|
|
7
|
+
import { emptyObject } from '../../../utils/constant';
|
|
8
|
+
// 默认组件类前缀
|
|
9
|
+
export const CLASS_PREFIX = 'weda-uploader-pc';
|
|
10
|
+
// 默认图片类型
|
|
11
|
+
export const IMAGE_TYPES = [
|
|
12
|
+
'image/jpg',
|
|
13
|
+
'image/png',
|
|
14
|
+
'image/tif',
|
|
15
|
+
'image/bmp',
|
|
16
|
+
'image/jpeg',
|
|
17
|
+
'image/tiff',
|
|
18
|
+
'image/gif',
|
|
19
|
+
];
|
|
20
|
+
/**
|
|
21
|
+
* 上传图片-官方组件
|
|
22
|
+
*/
|
|
23
|
+
// eslint-disable-next-line react/prop-types
|
|
24
|
+
export function UploaderPC({ layout, className, id, style, title, tips, ...props }) {
|
|
25
|
+
const cls = classNames({
|
|
26
|
+
'weda-ui': true,
|
|
27
|
+
[CLASS_PREFIX]: true,
|
|
28
|
+
[layout]: layout,
|
|
29
|
+
[className]: className,
|
|
30
|
+
});
|
|
31
|
+
return (React.createElement("div", { className: cls, id: id, style: style },
|
|
32
|
+
React.createElement("div", { className: `${CLASS_PREFIX}__header` },
|
|
33
|
+
title && React.createElement("div", { className: `${CLASS_PREFIX}__title` }, title),
|
|
34
|
+
tips && (React.createElement("div", { className: `${CLASS_PREFIX}__description` }, tips || ''))),
|
|
35
|
+
React.createElement(UploaderPCInner, { ...props })));
|
|
36
|
+
}
|
|
37
|
+
export function UploaderPCInner(props) {
|
|
38
|
+
const { tips = '', btnTitle = '上传图片', maxUploadCount = 9, maxSize = 10, value: defaultValue, // 需要兼容 cloud:和https: 协议,需要兼容 字符串和字符串数组
|
|
39
|
+
acceptTypes = IMAGE_TYPES, uploadPath = 'weda-uploader', events = emptyObject, single = false, onChange, } = props;
|
|
40
|
+
// 上传中
|
|
41
|
+
const [uploading, setUploading] = React.useState(false);
|
|
42
|
+
//上传进度
|
|
43
|
+
const [progress, setProgress] = React.useState(0);
|
|
44
|
+
// 文件列表
|
|
45
|
+
const [fileIDList, setfileIDList] = React.useState([]);
|
|
46
|
+
const fileRef = React.useRef([]);
|
|
47
|
+
React.useEffect(() => {
|
|
48
|
+
let initialValue = []
|
|
49
|
+
.concat(defaultValue)
|
|
50
|
+
.filter((d) => typeof d === 'string' && d !== '');
|
|
51
|
+
if (single) {
|
|
52
|
+
initialValue = initialValue[0] ? [initialValue[0]] : [];
|
|
53
|
+
}
|
|
54
|
+
setfileIDList(initialValue);
|
|
55
|
+
}, [defaultValue]);
|
|
56
|
+
// 值变化事件
|
|
57
|
+
React.useEffect(() => {
|
|
58
|
+
if (!isObjectEqual(fileRef.current, fileIDList)) {
|
|
59
|
+
if (single) {
|
|
60
|
+
const file = fileIDList[0] || '';
|
|
61
|
+
onChange && onChange(file);
|
|
62
|
+
events.change && events.change({ value: file });
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
onChange && onChange(fileIDList);
|
|
66
|
+
events.change && events.change({ value: fileIDList });
|
|
67
|
+
}
|
|
68
|
+
fileRef.current = fileIDList;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
// 方法:上传前,判断图片大小、数量是否满足,取消默认组件的上传事件,用自定义的 tcb 上传方法
|
|
72
|
+
const beforeHandle = (file, fileList, isAccepted, error) => {
|
|
73
|
+
if (!isAccepted) {
|
|
74
|
+
try {
|
|
75
|
+
const errorList = [];
|
|
76
|
+
if (error.find((item) => (item === null || item === void 0 ? void 0 : item.code) === 'file-invalid-type')) {
|
|
77
|
+
errorList.push('上传图片类型错误');
|
|
78
|
+
}
|
|
79
|
+
if (error.find((item) => (item === null || item === void 0 ? void 0 : item.code) === 'file-too-large')) {
|
|
80
|
+
errorList.push(`上传图片大小不能超过${maxSize}M`);
|
|
81
|
+
}
|
|
82
|
+
message.error({ content: errorList.join(', ') });
|
|
83
|
+
}
|
|
84
|
+
catch (e) { }
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
uploadTcb(file);
|
|
88
|
+
return false;
|
|
89
|
+
};
|
|
90
|
+
// 自定义上传到 Tcb 的 COS
|
|
91
|
+
const uploadTcb = (file) => {
|
|
92
|
+
setUploading(true);
|
|
93
|
+
getCloudInstance().then(async (tcb) => {
|
|
94
|
+
try {
|
|
95
|
+
const cloudPath = `${uploadPath}/${randomStr()}-${file === null || file === void 0 ? void 0 : file.name}`;
|
|
96
|
+
const { fileID } = await tcb.uploadFile({
|
|
97
|
+
cloudPath,
|
|
98
|
+
filePath: file,
|
|
99
|
+
onUploadProgress: onProgress,
|
|
100
|
+
});
|
|
101
|
+
fileID && setfileIDList((list) => [...list, fileID]);
|
|
102
|
+
fileID && events.success && events.success({ value: fileID, file });
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
message.error({ content: `${err}` || '上传失败' });
|
|
106
|
+
events.error && events.error(err);
|
|
107
|
+
}
|
|
108
|
+
finally {
|
|
109
|
+
setUploading(false);
|
|
110
|
+
setProgress(0);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
// 计算上传进度
|
|
115
|
+
const onProgress = (progressEvent) => {
|
|
116
|
+
let percentCompleted = 0;
|
|
117
|
+
try {
|
|
118
|
+
percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total);
|
|
119
|
+
percentCompleted < 100 ? percentCompleted : 100;
|
|
120
|
+
}
|
|
121
|
+
catch (e) { }
|
|
122
|
+
setProgress(percentCompleted);
|
|
123
|
+
};
|
|
124
|
+
// 删除图片
|
|
125
|
+
const deleteHandle = (fileID) => {
|
|
126
|
+
setfileIDList((list) => list.filter((d) => d !== fileID));
|
|
127
|
+
};
|
|
128
|
+
// 转换后的属性
|
|
129
|
+
const extraProps = {};
|
|
130
|
+
extraProps['accept'] =
|
|
131
|
+
acceptTypes.includes('image/*') || acceptTypes.length === 0
|
|
132
|
+
? IMAGE_TYPES
|
|
133
|
+
: Array.from(new Set(acceptTypes));
|
|
134
|
+
tips && (extraProps['title'] = tips);
|
|
135
|
+
maxSize && (extraProps['maxSize'] = maxSize * 1024 * 1024);
|
|
136
|
+
return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
|
|
137
|
+
React.createElement("div", { className: "_weda-fn-upload-result" },
|
|
138
|
+
fileIDList.map((d) => (React.createElement("div", { className: "_weda-fn-upload-result__item", key: d },
|
|
139
|
+
React.createElement(TcbImage, { fileID: d }),
|
|
140
|
+
React.createElement("div", { className: "_weda-fn-upload-result__op" },
|
|
141
|
+
React.createElement(Button, { onClick: () => deleteHandle(d), className: `${CLASS_PREFIX}__btn` }, "\u5220\u9664"))))),
|
|
142
|
+
uploading && (React.createElement("div", { className: "_weda-fn-upload-result__item" },
|
|
143
|
+
React.createElement("div", { className: "_weda-fn-upload-result__status", key: "_place_image" },
|
|
144
|
+
React.createElement(Icon, { type: "loading" }),
|
|
145
|
+
!!progress && (React.createElement("span", { className: "wedatea2td-mt-1n wedatea2td-text-label wedatea2td-fz-reset" },
|
|
146
|
+
"\u4E0A\u4F20",
|
|
147
|
+
progress,
|
|
148
|
+
"%..."))))),
|
|
149
|
+
React.createElement("div", { className: `${CLASS_PREFIX}__input-box` }, ((!single && fileIDList.length < maxUploadCount) ||
|
|
150
|
+
(single && fileIDList.length < 1)) && ( // single 模式时,仅当数组为空时显示
|
|
151
|
+
React.createElement(Upload, { ...extraProps, beforeUpload: beforeHandle },
|
|
152
|
+
React.createElement("li", { className: "_weda-fn-upload-result__item _weda-fn-upload-result__item--upload" },
|
|
153
|
+
React.createElement("div", { className: "_weda-fn-upload-result__status" },
|
|
154
|
+
React.createElement("i", { className: "wedatea2td-icon wedatea2td-icon-plus", role: "img", "aria-label": "plus" }),
|
|
155
|
+
React.createElement("span", { className: "wedatea2td-mt-1n wedatea2td-text-label wedatea2td-fz-reset" }, btnTitle)))))))));
|
|
156
|
+
}
|
|
157
|
+
export const TcbImage = (props) => {
|
|
158
|
+
const { fileID, isZoom, ...rest } = props;
|
|
159
|
+
const [src, setSrc] = React.useState('');
|
|
160
|
+
const [isError, setIsError] = React.useState(false);
|
|
161
|
+
React.useEffect(() => {
|
|
162
|
+
const getSrc = async () => {
|
|
163
|
+
try {
|
|
164
|
+
const _src = await getTempFileURL(fileID);
|
|
165
|
+
_src ? setSrc(_src) : setIsError(true);
|
|
166
|
+
}
|
|
167
|
+
catch (e) {
|
|
168
|
+
message.error({ content: '图片加载失败' });
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
isCloudFileID(fileID) ? getSrc() : setSrc(fileID);
|
|
172
|
+
}, [fileID]);
|
|
173
|
+
return isError ? (React.createElement(ErrorTip, null)) : src ? (isZoom ? (React.createElement(ImagePreview, { key: fileID, className: `${CLASS_PREFIX}__image`, ...rest, src: src, previewSrc: src,
|
|
174
|
+
/** @ts-expect-error tea imagepreview onError */
|
|
175
|
+
onError: (e) => {
|
|
176
|
+
setIsError(true);
|
|
177
|
+
(props === null || props === void 0 ? void 0 : props.onError) && props.onError(e);
|
|
178
|
+
} })) : (React.createElement("img", { key: fileID, className: `${CLASS_PREFIX}__image`, ...rest, src: src, onError: (e) => {
|
|
179
|
+
setIsError(true);
|
|
180
|
+
(props === null || props === void 0 ? void 0 : props.onError) && props.onError(e);
|
|
181
|
+
} }))) : null;
|
|
182
|
+
};
|
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
.weda-uploader-pc {
|
|
2
|
+
margin: 0;
|
|
3
|
+
padding: 0;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.weda-uploader-pc .weda-uploader-pc__title {
|
|
7
|
+
color: #000000;
|
|
8
|
+
line-height: 1.42857rem;
|
|
9
|
+
font-weight: 400;
|
|
10
|
+
margin-bottom: 0.28571rem;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* 单张图片回显 */
|
|
14
|
+
.weda-uploader-pc .weda-uploader-pc__image-box {
|
|
15
|
+
height: 7.14286rem;
|
|
16
|
+
width: 7.14286rem;
|
|
17
|
+
margin-right: 0.57143rem;
|
|
18
|
+
margin-bottom: 0.57143rem;
|
|
19
|
+
background: #f2f2f2;
|
|
20
|
+
position: relative;
|
|
21
|
+
display: flex;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
align-items: center;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.weda-uploader-pc .weda-uploader-pc__body {
|
|
28
|
+
margin-bottom: 0.57143rem;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.weda-uploader-pc .weda-uploader-pc__input-box {
|
|
32
|
+
margin-bottom: 0.57143rem;
|
|
33
|
+
}
|
|
34
|
+
.weda-uploader-pc.cloudbase_standard .weda-uploader-pc__body {
|
|
35
|
+
margin-bottom: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.weda-uploader-pc.cloudbase_standard .weda-uploader-pc__input-box {
|
|
39
|
+
margin-bottom: 0;
|
|
40
|
+
}
|
|
41
|
+
.weda-uploader-pc.cloudbase_standard .weda-uploader-pc__image-list {
|
|
42
|
+
margin-left: 0.57143rem;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.weda-uploader-pc .weda-uploader-pc__image-box:hover .weda-uploader-pc__action {
|
|
46
|
+
display: flex;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.weda-uploader-pc .weda-uploader-pc__image {
|
|
50
|
+
max-height: 100%;
|
|
51
|
+
height: auto;
|
|
52
|
+
width: 100%;
|
|
53
|
+
cursor: zoom-in;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.weda-uploader-pc .weda-uploader-pc__action {
|
|
57
|
+
display: none;
|
|
58
|
+
position: absolute;
|
|
59
|
+
top: 0;
|
|
60
|
+
left: 0;
|
|
61
|
+
right: 0;
|
|
62
|
+
bottom: 0;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
align-items: center;
|
|
65
|
+
background-color: rgba(0, 0, 0, 0.6);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.weui-uploader.horizontal {
|
|
69
|
+
display: flex;
|
|
70
|
+
}
|
|
71
|
+
.weui-uploader.horizontal .weui-uploader__hd {
|
|
72
|
+
display: inline-block;
|
|
73
|
+
align-self: center;
|
|
74
|
+
}
|
|
75
|
+
.weda-uploader-pc.horizontal {
|
|
76
|
+
display: flex;
|
|
77
|
+
justify-content: space-between;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* ----上传文件---- pc */
|
|
81
|
+
.weda-upload-file-pc .weda-upload-file-pc__file-item {
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-wrap: nowrap;
|
|
84
|
+
justify-content: space-between;
|
|
85
|
+
align-items: center;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.weda-upload-file-pc .weda-upload-file-pc__btn-descripe {
|
|
89
|
+
margin-left: 1.14286rem;
|
|
90
|
+
font-size: 0.75em;
|
|
91
|
+
line-height: 1.42857rem;
|
|
92
|
+
color: rgba(0, 0, 0, 0.4);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.weda-upload-file-pc .wedatea2td-list--divider > li {
|
|
96
|
+
padding: 0 !important;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.weda-upload-file-pc .wedatea2td-list--divider > li:nth-child(n + 2) {
|
|
100
|
+
border-top: 0;
|
|
101
|
+
border-bottom: 0.07143rem solid #e7e7e7;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.weda-upload-file-pc .weda-upload-file-pc--item {
|
|
105
|
+
display: flex;
|
|
106
|
+
font-size: 0.875em;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.weda-upload-file-pc .weda-upload-file-pc--item-header {
|
|
110
|
+
border: 0.07143rem solid #e7e7e7;
|
|
111
|
+
font-size: 0.875em;
|
|
112
|
+
line-height: 1.375em;
|
|
113
|
+
color: rgba(0, 0, 0, 0.4);
|
|
114
|
+
margin-top: 1.14286rem;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.weda-upload-file-pc .weda-upload-file-pc--item-body {
|
|
118
|
+
border-left: 0.07143rem dashed #e7e7e7;
|
|
119
|
+
border-right: 0.07143rem dashed #e7e7e7;
|
|
120
|
+
font-size: 0.875em;
|
|
121
|
+
line-height: 1.375em;
|
|
122
|
+
color: rgba(0, 0, 0, 0.9);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.weda-upload-file-pc
|
|
126
|
+
.weda-upload-file-pc--item-header
|
|
127
|
+
.weda-upload-file-pc--item-label {
|
|
128
|
+
border-right: 0.07143rem solid #e7e7e7;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.weda-upload-file-pc
|
|
132
|
+
.weda-upload-file-pc--item
|
|
133
|
+
.weda-upload-file-pc--item-title {
|
|
134
|
+
width: 15.71429rem;
|
|
135
|
+
padding: 0.71429rem 0.85714rem;
|
|
136
|
+
overflow: hidden;
|
|
137
|
+
text-overflow: ellipsis;
|
|
138
|
+
white-space: nowrap;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.weda-upload-file-pc
|
|
142
|
+
.weda-upload-file-pc--item
|
|
143
|
+
.weda-upload-file-pc--item-size {
|
|
144
|
+
width: 7.14286rem;
|
|
145
|
+
padding: 0.71429rem 0.85714rem;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.weda-upload-file-pc
|
|
149
|
+
.weda-upload-file-pc--item
|
|
150
|
+
.weda-upload-file-pc--item-status {
|
|
151
|
+
width: 10.71429rem;
|
|
152
|
+
padding: 0.71429rem 0.85714rem;
|
|
153
|
+
overflow: hidden;
|
|
154
|
+
text-overflow: ellipsis;
|
|
155
|
+
white-space: nowrap;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.weda-upload-file-pc
|
|
159
|
+
.weda-upload-file-pc--item
|
|
160
|
+
.weda-upload-file-pc--item-action {
|
|
161
|
+
width: 11.42857rem;
|
|
162
|
+
padding: 0.71429rem 0.85714rem;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.weda-upload-file-pc .weda-upload-file-pc__btn--weak {
|
|
166
|
+
border-color: #dcdcdc;
|
|
167
|
+
color: rgba(0, 0, 0, 0.9);
|
|
168
|
+
width: 6.28571rem;
|
|
169
|
+
font-size: 0.875em;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.weda-upload-file-pc
|
|
173
|
+
.weda-upload-file-pc--item
|
|
174
|
+
.weda-upload-file-pc--item-status
|
|
175
|
+
.wedatea2td-icon {
|
|
176
|
+
margin-right: 0.57143rem;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.weda-upload-file-pc
|
|
180
|
+
.weda-upload-file-pc--item
|
|
181
|
+
.weda-upload-file-pc--item-status
|
|
182
|
+
.wedatea2td-icon.wedatea2td-icon-pending-gray {
|
|
183
|
+
background-image: url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMTRweCIgaGVpZ2h0PSIxNHB4IiB2aWV3Qm94PSIwIDAgMTQgMTQiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8dGl0bGU+SWNvbjwvdGl0bGU+CiAgICA8ZyBpZD0i6aG16Z2iLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJwYyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTY1MS4wMDAwMDAsIC0zOTQuMDAwMDAwKSI+CiAgICAgICAgICAgIDxnIGlkPSLkuIrkvKAv5om56YeP5LiK5Lyg5Lit5aSH5Lu9IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgzNzIuMDAwMDAwLCAxNDcuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICA8ZyBpZD0i5YaF5a655YiXIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwLjAwMDAwMCwgMTA3LjAwMDAwMCkiPgogICAgICAgICAgICAgICAgICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDI1NC4wMDAwMDAsIDEyNi4wMDAwMDApIiBpZD0i57yW57uEIj4KICAgICAgICAgICAgICAgICAgICAgICAgPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjQuMDAwMDAwLCAxMy4wMDAwMDApIiBpZD0iMS5CYWNl5Z+656GALzMuSWNvbuWbvuaghy/mk43kvZwvbW92ZSI+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMCwwIEwxNiwwIEwxNiwxNiBMMCwxNiBMMCwwIFoiIGlkPSJ0aW1lLWZpbGxlZC0oQmFja2dyb3VuZCkiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xNSw4IEMxNSw0LjEzNDAwNjc0IDExLjg2NTk5MzUsMSA4LDEgQzQuMTM0MDA2NzQsMSAxLDQuMTM0MDA2NzQgMSw4IEMxLDExLjg2NTk5MzUgNC4xMzQwMDY3NCwxNSA4LDE1IEMxMS44NjU5OTM1LDE1IDE1LDExLjg2NTk5MzUgMTUsOCBaIE03LjUsOC4zODg5MjQ2IEwxMC42NDY2OTA0LDExLjUzNTYxNTkgTDExLjM1Mzc5NzksMTAuODI4NTA4NCBMOC41LDcuOTc0NzExNDIgTDguNSw1IEw3LjUsNSBMNy41LDguMzg4OTI0NiBaIiBpZD0idGltZS1maWxsZWQiIGZpbGwtb3BhY2l0eT0iMC40IiBmaWxsPSIjMDAwMDAwIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgICAgICAgICA8L2c+CiAgICAgICAgICAgICAgICA8L2c+CiAgICAgICAgICAgIDwvZz4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg==);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.weda-upload-file-pc
|
|
187
|
+
.weda-upload-file-pc--item
|
|
188
|
+
.weda-upload-file-pc--item-action
|
|
189
|
+
.wedatea2td-btn {
|
|
190
|
+
font-size: 0.875em;
|
|
191
|
+
line-height: 1.375em;
|
|
192
|
+
color: #0052d9;
|
|
193
|
+
margin-right: 0.85714rem;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.weda-upload-file-pc
|
|
197
|
+
.weda-upload-file-pc--item
|
|
198
|
+
.weda-upload-file-pc--item-action
|
|
199
|
+
.wedatea2td-btn:last-child {
|
|
200
|
+
margin-right: 0;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.weda-upload-file-pc .weda-upload-file-pc--item-empty {
|
|
204
|
+
display: flex;
|
|
205
|
+
justify-content: center;
|
|
206
|
+
align-items: center;
|
|
207
|
+
height: 12.07143rem;
|
|
208
|
+
background: #ffffff;
|
|
209
|
+
border: 0.07143rem dashed #dcdcdc !important;
|
|
210
|
+
border-top: none !important;
|
|
211
|
+
border-radius: 0 0 0.14286rem 0.14286rem;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.weda-upload-file-pc
|
|
215
|
+
.weda-upload-file-pc--item-empty
|
|
216
|
+
.weda-upload-file-pc--item {
|
|
217
|
+
font-size: 0.875em;
|
|
218
|
+
color: rgba(0, 0, 0, 0.4);
|
|
219
|
+
line-height: 1.375em;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/* ----上传文件---- h5 */
|
|
223
|
+
.weda-upload-file-mobile {
|
|
224
|
+
width: 90%;
|
|
225
|
+
background-color: #f6f6f6;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.weda-upload-file-mobile .weda-upload-file-mobile__hd {
|
|
229
|
+
width: 100%;
|
|
230
|
+
padding: 1.14286rem;
|
|
231
|
+
padding-left: 0;
|
|
232
|
+
display: flex;
|
|
233
|
+
background-color: #fff;
|
|
234
|
+
}
|
|
235
|
+
.weda-upload-file-mobile .vertical {
|
|
236
|
+
padding: 0 1.42857rem 0.57143rem 1.42857rem;
|
|
237
|
+
}
|
|
238
|
+
.weda-upload-file-mobile .weda-upload-file-mobile__title {
|
|
239
|
+
font-size: 0.875em;
|
|
240
|
+
line-height: 1.25em;
|
|
241
|
+
color: #000;
|
|
242
|
+
margin-right: 1.42857rem;
|
|
243
|
+
padding-top: 0.42857rem;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.weda-upload-file-mobile .weda-upload-file-mobile__btn--weak {
|
|
247
|
+
width: 6.28571rem;
|
|
248
|
+
padding: 0 1.14286rem;
|
|
249
|
+
font-size: 0.875em;
|
|
250
|
+
color: rgba(0, 0, 0, 0.9);
|
|
251
|
+
border: 0.07143rem solid #dcdcdc;
|
|
252
|
+
border-radius: 0.21429rem;
|
|
253
|
+
line-height: 1.375em;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.weda-upload-file-mobile .weda-upload-file-mobile__tips {
|
|
257
|
+
display: block;
|
|
258
|
+
margin-top: 0.57143rem;
|
|
259
|
+
font-size: 0.75em;
|
|
260
|
+
line-height: 1.25em;
|
|
261
|
+
color: rgba(0, 0, 0, 0.4);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.weda-upload-file-mobile .weda-upload-file-mobile__bd {
|
|
265
|
+
margin-top: 0.57143rem;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.weda-upload-file-mobile .weda-upload-file-mobile__bd .wedatea2td-list > li {
|
|
269
|
+
margin-bottom: 0.57143rem;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.weda-upload-file-mobile .weda-upload-file-mobile__item {
|
|
273
|
+
width: 100%;
|
|
274
|
+
padding: 1.14286rem;
|
|
275
|
+
background-color: #fff;
|
|
276
|
+
display: flex;
|
|
277
|
+
justify-content: space-between;
|
|
278
|
+
align-items: center;
|
|
279
|
+
box-sizing: border-box;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.weda-upload-file-mobile .weda-upload-file-mobile__btn-group {
|
|
283
|
+
display: flex;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.weda-upload-file-mobile .weda-upload-file-mobile__item .wedatea2td-icon {
|
|
287
|
+
width: 1.71429rem;
|
|
288
|
+
height: 1.71429rem;
|
|
289
|
+
margin-right: 1.14286rem;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.weda-upload-file-mobile
|
|
293
|
+
.weda-upload-file-mobile__btn-group
|
|
294
|
+
.wedatea2td-icon:last-child {
|
|
295
|
+
margin-right: 0;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.weda-upload-file-mobile
|
|
299
|
+
.weda-upload-file-mobile__item
|
|
300
|
+
.wedatea2td-icon.wedatea2td-icon-delete {
|
|
301
|
+
background-image: url('https://imgcache.qq.com/qcloud/tcloud_dtc/static/static_source_business/2372f6a8-2f6a-4f30-92bf-73c62a5c0ae7.svg');
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.weda-upload-file-mobile
|
|
305
|
+
.weda-upload-file-mobile__item
|
|
306
|
+
.wedatea2td-icon.wedatea2td-icon-download {
|
|
307
|
+
background-image: url('https://imgcache.qq.com/qcloud/tcloud_dtc/static/static_source_business/4cba5da1-cde4-40c6-a075-86eff22858a4.svg');
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.weda-upload-file-mobile
|
|
311
|
+
.weda-upload-file-mobile__item
|
|
312
|
+
.wedatea2td-icon.wedatea2td-icon-refresh {
|
|
313
|
+
background-image: url('https://imgcache.qq.com/qcloud/tcloud_dtc/static/static_source_business/af5486eb-65e0-4536-8e51-6c68a17b71ac.svg');
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.weda-upload-file-mobile
|
|
317
|
+
.weda-upload-file-mobile__item
|
|
318
|
+
.weda-upload-file-mobile__item-left {
|
|
319
|
+
flex: 1;
|
|
320
|
+
margin-right: 1.14286rem;
|
|
321
|
+
width: 70%;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.weda-upload-file-mobile
|
|
325
|
+
.weda-upload-file-mobile__item
|
|
326
|
+
.weda-upload-file-mobile__file-detail {
|
|
327
|
+
display: flex;
|
|
328
|
+
align-items: center;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.weda-upload-file-mobile
|
|
332
|
+
.weda-upload-file-mobile__item
|
|
333
|
+
.weda-upload-file-mobile__file-name {
|
|
334
|
+
font-size: 0.875em;
|
|
335
|
+
line-height: 1.375em;
|
|
336
|
+
color: rgba(0, 0, 0, 0.9);
|
|
337
|
+
max-width: 6.5rem;
|
|
338
|
+
overflow: hidden;
|
|
339
|
+
text-overflow: ellipsis;
|
|
340
|
+
white-space: nowrap;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.weda-upload-file-mobile
|
|
344
|
+
.weda-upload-file-mobile__item
|
|
345
|
+
.weda-upload-file-mobile__file-status {
|
|
346
|
+
margin-left: 1.71429rem;
|
|
347
|
+
display: flex;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.weda-upload-file-mobile
|
|
351
|
+
.weda-upload-file-mobile__item
|
|
352
|
+
.weda-upload-file-mobile__file-status
|
|
353
|
+
.wedatea2td-icon {
|
|
354
|
+
width: 1.14286rem;
|
|
355
|
+
height: 1.14286rem;
|
|
356
|
+
background-size: 100% 100%;
|
|
357
|
+
margin-right: 0;
|
|
358
|
+
}
|
|
359
|
+
.weda-upload-file-mobile
|
|
360
|
+
.weda-upload-file-mobile__item
|
|
361
|
+
.weda-upload-file-mobile__file-status
|
|
362
|
+
.wedatea2td-icon.wedatea2td-icon-fail {
|
|
363
|
+
background-image: url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMTZweCIgaGVpZ2h0PSIxNnB4IiB2aWV3Qm94PSIwIDAgMTQgMTQiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8dGl0bGU+MS5CYWNl5Z+656GALzMuSWNvbuWbvuaghy/mk43kvZwvbW92ZTwvdGl0bGU+CiAgICA8ZyBpZD0i6aG16Z2iLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSLnlLvmnb8iIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xMDQuMDAwMDAwLCAtMjEwLjAwMDAwMCkiPgogICAgICAgICAgICA8ZyBpZD0iMS5CYWNl5Z+656GALzMuSWNvbuWbvuaghy/mk43kvZwvbW92ZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAzLjAwMDAwMCwgMjA5LjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPHBhdGggZD0iTTAsMCBMMTYsMCBMMTYsMTYgTDAsMTYgTDAsMCBaIiBpZD0iY2xvc2UtY2lyY2xlLWZpbGxlZC0oQmFja2dyb3VuZCkiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik04LDEgQzQuMTM0MDA5MTIsMSAxLDQuMTM0MDA0ODMgMSw4IEMxLDExLjg2NTk5MTYgNC4xMzQwMDQ4MywxNSA4LDE1IEMxMS44NjU5OTE2LDE1IDE1LDExLjg2NTk5NTQgMTUsOCBDMTUsNC4xMzQwMDkxMiAxMS44NjU5OTU0LDEgOCwxIFogTTguMDAwMDExOTIsNy4yOTA3NTE0NiBMMTAuMzI5MTE3OCw0Ljk0NzUzODE0IEwxMS4wMzgzNTU4LDUuNjUyNTA3MzEgTDguNzA0OTkzMjUsOCBMMTEuMDM4MzQ3MiwxMC4zNDc0ODk0IEwxMC4zMjkxMDgyLDExLjA1MjQ1NzggTDguMDAwMDExNDQsOC43MDkyNTQyNiBMNS42NzA5MTU2LDExLjA1MjQ1NzggTDQuOTYxNjc2NiwxMC4zNDc0ODg0IEw3LjI5NTAzMDU5LDggTDQuOTYxNjY3NzgsNS42NTI1MDY4MyBMNS42NzA5MDY1NCw0Ljk0NzUzODE0IEw4LjAwMDAxMTkyLDcuMjkwNzUxNDYgWiIgaWQ9ImNsb3NlLWNpcmNsZS1maWxsZWQiIGZpbGw9IiNFMzRENTkiPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+);
|
|
364
|
+
}
|
|
365
|
+
.weda-upload-file-mobile
|
|
366
|
+
.weda-upload-file-mobile__item
|
|
367
|
+
.weda-upload-file-mobile__file-status
|
|
368
|
+
.wedatea2td-icon.wedatea2td-icon-success {
|
|
369
|
+
background-image: url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMTZweCIgaGVpZ2h0PSIxNnB4IiB2aWV3Qm94PSIwIDAgMTQgMTQiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8dGl0bGU+MS5CYWNl5Z+656GALzMuSWNvbuWbvuaghy/mk43kvZwvbW92ZTwvdGl0bGU+CiAgICA8ZyBpZD0i6aG16Z2iLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSLnlLvmnb8iIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xMDQuMDAwMDAwLCAtMTIwLjAwMDAwMCkiPgogICAgICAgICAgICA8ZyBpZD0iMS5CYWNl5Z+656GALzMuSWNvbuWbvuaghy/mk43kvZwvbW92ZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAzLjAwMDAwMCwgMTE5LjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPHBhdGggZD0iTTAsMCBMMTYsMCBMMTYsMTYgTDAsMTYgTDAsMCBaIiBpZD0iY2hlY2stY2lyY2xlLWZpbGxlZC0oQmFja2dyb3VuZCkiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xNSw4IEMxNSw0LjEzNDAwNjc0IDExLjg2NTk5MzUsMSA4LDEgQzQuMTM0MDA2NzQsMSAxLDQuMTM0MDA2NzQgMSw4IEMxLDExLjg2NTk5MzUgNC4xMzQwMDY3NCwxNSA4LDE1IEMxMS44NjU5OTM1LDE1IDE1LDExLjg2NTk5MzUgMTUsOCBaIE03LDEwLjcwNjk5OTggTDExLjUsNi4yMDc0OTk5OCBMMTAuNzkyNDk5NSw1LjUgTDcsOS4yOTMwMDAyMiBMNS4yMDY1MDAwNSw3LjUgTDQuNSw4LjIwNjUwMDA1IEw3LDEwLjcwNjk5OTggWiIgaWQ9ImNoZWNrLWNpcmNsZS1maWxsZWQiIGZpbGw9IiMwMEE4NzAiPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+);
|
|
370
|
+
}
|
|
371
|
+
.weda-upload-file-mobile
|
|
372
|
+
.weda-upload-file-mobile__item
|
|
373
|
+
.weda-upload-file-mobile__file-status--msg {
|
|
374
|
+
width: 4.2rem;
|
|
375
|
+
margin-left: 0.28571rem;
|
|
376
|
+
font-size: 0.75em;
|
|
377
|
+
line-height: 1.25em;
|
|
378
|
+
color: rgba(0, 0, 0, 0.9);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
.weda-upload-file-mobile
|
|
382
|
+
.weda-upload-file-mobile__item
|
|
383
|
+
.weda-upload-file-mobile__file-foot {
|
|
384
|
+
font-size: 0.75em;
|
|
385
|
+
line-height: 1.25em;
|
|
386
|
+
color: rgba(0, 0, 0, 0.4);
|
|
387
|
+
margin-top: 0.57143rem;
|
|
388
|
+
display: flex;
|
|
389
|
+
justify-content: space-between;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.weda-upload-file-mobile
|
|
393
|
+
.weda-upload-file-mobile__item
|
|
394
|
+
.weda-upload-file-mobile__file-progress {
|
|
395
|
+
margin-top: 0.28571rem;
|
|
396
|
+
border-radius: 0;
|
|
397
|
+
background-color: #e7e7e7;
|
|
398
|
+
height: 0.21429rem !important;
|
|
399
|
+
margin-bottom: 0;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.weda-upload-file-mobile
|
|
403
|
+
.weda-upload-file-mobile__item
|
|
404
|
+
.weda-upload-file-mobile__file-progress
|
|
405
|
+
.wedatea2td-progress__value {
|
|
406
|
+
border-radius: 0;
|
|
407
|
+
height: 0.21429rem !important;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.weda-upload-file-mobile
|
|
411
|
+
.weda-upload-file-mobile__item
|
|
412
|
+
.weda-upload-file-mobile__file-progress
|
|
413
|
+
.wedatea2td-progress__text {
|
|
414
|
+
display: none;
|
|
415
|
+
}
|
|
416
|
+
.weda-upload-file-mobile .weui-uploader-mobile__input {
|
|
417
|
+
position: absolute;
|
|
418
|
+
font-size: 1em;
|
|
419
|
+
opacity: 0;
|
|
420
|
+
width: 6.57143rem;
|
|
421
|
+
height: 2.28571rem;
|
|
422
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { usePlatform } from '../../../utils/platform';
|
|
4
|
+
import { UploadFileH5 as UploaderH5 } from './uploadFile.h5';
|
|
5
|
+
import { UploadFilePc } from './uploadFile.pc';
|
|
6
|
+
import './index.css';
|
|
7
|
+
/**
|
|
8
|
+
* 文件组件上传,区分 h5端/pc端
|
|
9
|
+
*/
|
|
10
|
+
export default function UploaderFile(props) {
|
|
11
|
+
const platform = usePlatform();
|
|
12
|
+
if ((props === null || props === void 0 ? void 0 : props.showType) === 'pc') {
|
|
13
|
+
return React.createElement(UploadFilePc, { ...props });
|
|
14
|
+
}
|
|
15
|
+
if ((props === null || props === void 0 ? void 0 : props.showType) === 'h5') {
|
|
16
|
+
return React.createElement(UploaderH5, { ...props });
|
|
17
|
+
}
|
|
18
|
+
return platform === 'h5' ? (React.createElement(UploaderH5, { ...props })) : (React.createElement(UploadFilePc, { ...props }));
|
|
19
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CommonFormPropsType } from '../types';
|
|
3
|
+
export declare const FILES_TYPES: string[];
|
|
4
|
+
export declare function UploadFileH5({ layout, id, style, labelVisible, label, requiredFlag, disabled, className, acceptTypes, tips, btnTitle, maxUploadCount, maxSize, deleteVisible, downloadVisible, value, // 需要兼容 cloud:和https: 协议,需要兼容字符串和字符串数组
|
|
5
|
+
events, defaultValue, uploadPath, single, onChange, isEdit, }: IUploadFileH5): JSX.Element;
|
|
6
|
+
export interface IUploadFileH5 extends CommonFormPropsType {
|
|
7
|
+
className?: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
tips?: string;
|
|
10
|
+
btnTitle?: string;
|
|
11
|
+
maxUploadCount?: number;
|
|
12
|
+
deleteVisible?: boolean;
|
|
13
|
+
downloadVisible?: boolean;
|
|
14
|
+
acceptTypes?: Readonly<string[] | string>;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
defaultValue?: string | string[];
|
|
17
|
+
maxSize?: number;
|
|
18
|
+
value?: Readonly<string | string[]>;
|
|
19
|
+
uploadPath?: string;
|
|
20
|
+
single?: boolean;
|
|
21
|
+
onChange?: (v: any) => void;
|
|
22
|
+
isEdit: boolean;
|
|
23
|
+
}
|