@cloudbase/weda-ui 3.1.0 → 3.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/asset-manifest.json +17 -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 +216 -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.html +88 -0
- package/dist/index.js +3 -0
- package/dist/setupTests.d.ts +1 -0
- package/dist/setupTests.js +14 -0
- package/dist/static/js/bundle.js +963 -0
- package/dist/static/js/bundle.js.map +1 -0
- package/dist/static/js/main.chunk.js +8841 -0
- package/dist/static/js/main.chunk.js.map +1 -0
- package/dist/static/js/vendors~main.chunk.js +247885 -0
- package/dist/static/js/vendors~main.chunk.js.map +1 -0
- package/dist/static/media/ef6fa527e24e354765d806b826b41391.fa67580a.svg +627 -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 +68 -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 +62 -0
- package/dist/web/components/chart/common/core/eChartLine.js +168 -0
- package/dist/web/components/chart/common/core/eChartPie.d.ts +50 -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 +435 -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 +59 -0
- package/dist/web/components/form/location/common/propsConfig.js +50 -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 +36 -0
- package/dist/web/components/form/location/common/useLocationInfo.js +104 -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 +323 -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 +224 -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 +504 -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 +301 -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 +298 -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 -12
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/* pc style */
|
|
2
|
+
.weda-graphic-card {
|
|
3
|
+
width: 100%;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.weda-graphic-card .weda-graphic-card__wrapper {
|
|
7
|
+
width: 100%;
|
|
8
|
+
padding: 0 1.71429rem;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.weda-graphic-card .weda-graphic-card__row {
|
|
12
|
+
margin: 0;
|
|
13
|
+
padding: 1.42857rem 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.weda-graphic-card .weda-graphic-card__col {
|
|
17
|
+
padding: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__col-body {
|
|
21
|
+
width: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.weda-graphic-card .weda-graphic-card__col .wedatea2td-grid__box,
|
|
25
|
+
.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__col-body {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
justify-content: space-between;
|
|
29
|
+
align-items: center;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.weda-graphic-card
|
|
33
|
+
.weda-graphic-card__col.weda-graphic-card__col--left
|
|
34
|
+
.wedatea2td-grid__box,
|
|
35
|
+
.weda-graphic-card
|
|
36
|
+
.weda-graphic-card__col.weda-graphic-card__col--left
|
|
37
|
+
.weda-graphic-card__col-body {
|
|
38
|
+
align-items: flex-start;
|
|
39
|
+
width: 100%;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.weda-graphic-card
|
|
43
|
+
.weda-graphic-card__col.weda-graphic-card__col--right
|
|
44
|
+
.wedatea2td-grid__box,
|
|
45
|
+
.weda-graphic-card
|
|
46
|
+
.weda-graphic-card__col.weda-graphic-card__col--right
|
|
47
|
+
.weda-graphic-card__col-body {
|
|
48
|
+
align-items: flex-end;
|
|
49
|
+
width: 100%;
|
|
50
|
+
}
|
|
51
|
+
.weda-graphic-card
|
|
52
|
+
.weda-graphic-card__col.weda-graphic-card__col--center
|
|
53
|
+
.wedatea2td-grid__box,
|
|
54
|
+
.weda-graphic-card
|
|
55
|
+
.weda-graphic-card__col.weda-graphic-card__col--center
|
|
56
|
+
.weda-graphic-card__col-body {
|
|
57
|
+
align-items: center;
|
|
58
|
+
width: 100%;
|
|
59
|
+
}
|
|
60
|
+
.weda-graphic-card
|
|
61
|
+
.weda-graphic-card__col.weda-graphic-card__col--justify
|
|
62
|
+
.wedatea2td-grid__box,
|
|
63
|
+
.weda-graphic-card
|
|
64
|
+
.weda-graphic-card__col.weda-graphic-card__col--justify
|
|
65
|
+
.weda-graphic-card__col-body {
|
|
66
|
+
width: 100%;
|
|
67
|
+
}
|
|
68
|
+
.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__icon {
|
|
69
|
+
width: 100%;
|
|
70
|
+
height: 14.28571rem;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.weda-graphic-card .weda-graphic-card__icon .weda-graphic-card__img {
|
|
74
|
+
width: 100%;
|
|
75
|
+
height: 100%;
|
|
76
|
+
object-fit: cover;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__detail {
|
|
80
|
+
width: 100%;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__title {
|
|
84
|
+
font-size: 1.1428em;
|
|
85
|
+
line-height: 1.71428em;
|
|
86
|
+
text-align: center;
|
|
87
|
+
color: rgba(0, 0, 0, 0.9);
|
|
88
|
+
display: -webkit-box;
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
text-overflow: ellipsis;
|
|
91
|
+
-webkit-box-orient: vertical;
|
|
92
|
+
-webkit-line-clamp: 2;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__desc {
|
|
96
|
+
font-size: 1em;
|
|
97
|
+
line-height: 1.5714em;
|
|
98
|
+
color: rgba(0, 0, 0, 0.4);
|
|
99
|
+
text-align: center;
|
|
100
|
+
display: -webkit-box;
|
|
101
|
+
overflow: hidden;
|
|
102
|
+
text-overflow: ellipsis;
|
|
103
|
+
-webkit-box-orient: vertical;
|
|
104
|
+
-webkit-line-clamp: 2;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__btn--text {
|
|
108
|
+
font-size: 1em;
|
|
109
|
+
line-height: 1.5714em;
|
|
110
|
+
color: #0052d9;
|
|
111
|
+
margin-right: 0.57143rem;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.weda-graphic-card .weda-graphic-card__btn-icon {
|
|
115
|
+
margin-bottom: 0.14286rem;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__title {
|
|
119
|
+
margin-top: 1.42857rem;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__desc {
|
|
123
|
+
margin-top: 0.57143rem;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__btn {
|
|
127
|
+
margin-top: 1.42857rem;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* h5 style */
|
|
131
|
+
.weda-graphic-card-mobile .weda-graphic-card__wrapper {
|
|
132
|
+
width: 100%;
|
|
133
|
+
padding: 0 1.14286rem;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.weda-graphic-card-mobile .weda-graphic-card__row {
|
|
137
|
+
padding: 1.28571rem 0;
|
|
138
|
+
margin: 0 -0.39286rem;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.weda-graphic-card-mobile .weda-graphic-card__col {
|
|
142
|
+
padding: 0 0.39286rem !important;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.weda-graphic-card-mobile .weda-graphic-card__col .weda-graphic-card__detail {
|
|
146
|
+
padding: 0 !important;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.weda-graphic-card-mobile .weda-graphic-card__col .weda-graphic-card__title {
|
|
150
|
+
margin-top: 1.14286rem;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.weda-graphic-card-mobile .weda-graphic-card__col .weda-graphic-card__desc {
|
|
154
|
+
margin-top: 0.42857rem;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.weda-graphic-card-mobile .weda-graphic-card__col .weda-graphic-card__btn {
|
|
158
|
+
margin-top: 1.14286rem;
|
|
159
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import './index.css';
|
|
3
|
+
import type { CommonPropsType } from '../../types';
|
|
4
|
+
export interface IGraphicCardPropsType extends CommonPropsType {
|
|
5
|
+
/**
|
|
6
|
+
* 导航配置
|
|
7
|
+
*/
|
|
8
|
+
navOption?: Array<any>;
|
|
9
|
+
titleVisible: boolean;
|
|
10
|
+
titleColor: string;
|
|
11
|
+
titleFontWeight: string;
|
|
12
|
+
titleFontSize: number;
|
|
13
|
+
titleLineHeight: string;
|
|
14
|
+
titleMaxLines: number;
|
|
15
|
+
desColor: string;
|
|
16
|
+
desFontWeight: string;
|
|
17
|
+
desVisible: boolean;
|
|
18
|
+
desFontSize: number;
|
|
19
|
+
desLineHeight: string;
|
|
20
|
+
desMaxLines: number;
|
|
21
|
+
buttonVisible: boolean;
|
|
22
|
+
buttonText: string;
|
|
23
|
+
ColMobile: number;
|
|
24
|
+
ColPC: number;
|
|
25
|
+
percentageVisible: boolean;
|
|
26
|
+
iconWidthSize: string;
|
|
27
|
+
iconHeightSize: string;
|
|
28
|
+
textAlign?: 'start' | 'end' | 'left' | 'right' | 'center' | 'justify';
|
|
29
|
+
imageStyle: any;
|
|
30
|
+
}
|
|
31
|
+
export default function GraphicCard({ navOption, ColMobile, ColPC, iconWidthSize, iconHeightSize, titleVisible, desVisible, buttonVisible, textAlign, className, titleColor, titleFontWeight, titleFontSize, titleLineHeight, titleMaxLines, desColor, desFontWeight, desFontSize, desLineHeight, desMaxLines, buttonText, style, }: IGraphicCardPropsType): JSX.Element;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import './index.css';
|
|
3
|
+
import classNames from '../../utils/classnames';
|
|
4
|
+
import { Row, Col, ConfigProvider, Button, Text } from 'tea-component';
|
|
5
|
+
import { usePlatform } from '../../utils/platform';
|
|
6
|
+
import { IconFont } from 'tdesign-icons-react';
|
|
7
|
+
import Image from '../image';
|
|
8
|
+
const CLASS_PREFIX = 'weda-graphic-card';
|
|
9
|
+
export default function GraphicCard({ navOption, ColMobile, ColPC, iconWidthSize, iconHeightSize, titleVisible, desVisible, buttonVisible, textAlign, className, titleColor, titleFontWeight, titleFontSize, titleLineHeight, titleMaxLines, desColor, desFontWeight, desFontSize, desLineHeight, desMaxLines, buttonText, style, }) {
|
|
10
|
+
const platform = usePlatform();
|
|
11
|
+
const isH5 = platform === 'h5';
|
|
12
|
+
// 一个栅格的宽度
|
|
13
|
+
const [SingleGrid, setSingleGrid] = useState({ width: 10 });
|
|
14
|
+
const [colCount, setColCount] = React.useState(2);
|
|
15
|
+
const cls = classNames({
|
|
16
|
+
[CLASS_PREFIX]: true,
|
|
17
|
+
[className]: className,
|
|
18
|
+
[`${CLASS_PREFIX}-mobile`]: isH5,
|
|
19
|
+
});
|
|
20
|
+
const cardList = React.useMemo(() => {
|
|
21
|
+
const list = [];
|
|
22
|
+
const col = isH5 ? ColMobile : ColPC;
|
|
23
|
+
setColCount(col);
|
|
24
|
+
list.length = Math.floor(navOption.length / colCount);
|
|
25
|
+
list.forEach((item, index) => {
|
|
26
|
+
list[index] = [];
|
|
27
|
+
});
|
|
28
|
+
//debugger;
|
|
29
|
+
navOption.forEach((item, index) => {
|
|
30
|
+
const _index = Math.floor(index / colCount);
|
|
31
|
+
if (!list[_index] || list[_index].length <= 0) {
|
|
32
|
+
// 保证每个col 的数据都是有的,列入总共7个数据,那么第二行的3, 4,5数据是undefined, 占位
|
|
33
|
+
list[_index] = Array(colCount).fill(null);
|
|
34
|
+
}
|
|
35
|
+
const paramObj = {};
|
|
36
|
+
if (item === null || item === void 0 ? void 0 : item.params) {
|
|
37
|
+
for (const info of item.params) {
|
|
38
|
+
paramObj[info.key] = info.value;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
item.paramObj = paramObj;
|
|
42
|
+
list[_index][index - _index * colCount] = item;
|
|
43
|
+
list[_index][index - _index * colCount] = item;
|
|
44
|
+
});
|
|
45
|
+
return list;
|
|
46
|
+
}, [colCount, navOption, isH5]);
|
|
47
|
+
const elementStyle = document.createElement('body').style;
|
|
48
|
+
const vendor = (() => {
|
|
49
|
+
const transformNames = {
|
|
50
|
+
webkit: 'webkitTransform',
|
|
51
|
+
Moz: 'MozTransform',
|
|
52
|
+
O: 'OTransform',
|
|
53
|
+
ms: 'msTransform',
|
|
54
|
+
standard: 'transform',
|
|
55
|
+
};
|
|
56
|
+
for (const key in transformNames) {
|
|
57
|
+
if (elementStyle[transformNames[key]] !== undefined) {
|
|
58
|
+
return key;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
})();
|
|
63
|
+
function prefixStyle(style) {
|
|
64
|
+
if (vendor === false) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
if (vendor === 'standard') {
|
|
68
|
+
return style;
|
|
69
|
+
}
|
|
70
|
+
return '-' + vendor + style.charAt(0).toUpperCase() + style.substr(1);
|
|
71
|
+
}
|
|
72
|
+
const boxStyle = prefixStyle('-box');
|
|
73
|
+
//标题样式
|
|
74
|
+
const titleStyle = {
|
|
75
|
+
display: `${boxStyle}`,
|
|
76
|
+
WebkitLineClamp: `${titleMaxLines ? titleMaxLines : 'inherit'}`,
|
|
77
|
+
overflow: 'hidden',
|
|
78
|
+
color: `${titleColor}`,
|
|
79
|
+
fontWeight: `${titleFontWeight}`,
|
|
80
|
+
fontSize: `${titleFontSize}` + 'px',
|
|
81
|
+
textAlign: `${textAlign}`,
|
|
82
|
+
lineHeight: `${titleLineHeight == 'auto' ? 'normal' : titleLineHeight}`,
|
|
83
|
+
};
|
|
84
|
+
const desStyle = {
|
|
85
|
+
display: `${boxStyle}`,
|
|
86
|
+
WebkitLineClamp: `${desMaxLines ? desMaxLines : 'inherit'}`,
|
|
87
|
+
overflow: 'hidden',
|
|
88
|
+
color: `${desColor}`,
|
|
89
|
+
fontWeight: `${desFontWeight}`,
|
|
90
|
+
fontSize: `${desFontSize}` + 'px',
|
|
91
|
+
textAlign: `${textAlign}`,
|
|
92
|
+
lineHeight: `${desLineHeight == 'auto' ? 'normal' : desLineHeight}`,
|
|
93
|
+
};
|
|
94
|
+
// 图片高度: 100% 基础下 H5: 1列 200px;2列 98px PC: 3列 220px 4列 162px
|
|
95
|
+
const imageStyle = React.useMemo(() => {
|
|
96
|
+
let width = '100%';
|
|
97
|
+
let height = platform === 'h5' ? '200' : '220';
|
|
98
|
+
if (platform === 'h5' && ColMobile === 2) {
|
|
99
|
+
height = '98';
|
|
100
|
+
}
|
|
101
|
+
if (platform !== 'h5' && ColPC === 4) {
|
|
102
|
+
height = '162';
|
|
103
|
+
}
|
|
104
|
+
const numReg = /^\d+$/;
|
|
105
|
+
width = numReg.test(iconWidthSize) ? iconWidthSize + 'px' : iconWidthSize;
|
|
106
|
+
height = numReg.test(iconHeightSize)
|
|
107
|
+
? iconHeightSize + 'px' //纯数字
|
|
108
|
+
: iconHeightSize.indexOf('%') == -1
|
|
109
|
+
? iconHeightSize
|
|
110
|
+
: (Number(height) * parseInt(iconHeightSize)) / 100 + 'px';
|
|
111
|
+
return { width, height };
|
|
112
|
+
}, [iconWidthSize, iconHeightSize, ColMobile, ColPC, isH5]);
|
|
113
|
+
const tapTo = (colInfo = navOption[0]) => {
|
|
114
|
+
switch (colInfo === null || colInfo === void 0 ? void 0 : colInfo.tapStatus) {
|
|
115
|
+
case 'tap':
|
|
116
|
+
return null;
|
|
117
|
+
case 'inside':
|
|
118
|
+
if (colInfo.insideUrl) {
|
|
119
|
+
app.navigateTo({
|
|
120
|
+
mode: 'weDa',
|
|
121
|
+
pageId: colInfo.insideUrl,
|
|
122
|
+
params: (colInfo === null || colInfo === void 0 ? void 0 : colInfo.withParams) && (colInfo === null || colInfo === void 0 ? void 0 : colInfo.params.length) > 0
|
|
123
|
+
? colInfo.paramObj
|
|
124
|
+
: null,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
break;
|
|
128
|
+
//return renderCancel();
|
|
129
|
+
case 'outer':
|
|
130
|
+
if (colInfo.newPage) {
|
|
131
|
+
colInfo.outerUrl ? window.open(colInfo.outerUrl) : false;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
colInfo.outerUrl ? (window.location.href = colInfo.outerUrl) : false;
|
|
135
|
+
}
|
|
136
|
+
break;
|
|
137
|
+
default:
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
|
|
142
|
+
React.createElement("div", { className: cls, "data-testid": "graphicCard", style: style },
|
|
143
|
+
React.createElement("div", { className: `${CLASS_PREFIX}__wrapper` }, cardList.map((row, rowIndex) => {
|
|
144
|
+
return (React.createElement(Row, { className: `${CLASS_PREFIX}__row`, key: rowIndex },
|
|
145
|
+
React.createElement(React.Fragment, null, row &&
|
|
146
|
+
row.map((col, colIndex) => {
|
|
147
|
+
return (
|
|
148
|
+
// 每列内容左右间距为0.1栅格列宽
|
|
149
|
+
React.createElement(Col, { style: {
|
|
150
|
+
width: `${(1 / colCount) * 100}%`,
|
|
151
|
+
padding: `0 ${SingleGrid.width * 0.1}px`,
|
|
152
|
+
cursor: (col === null || col === void 0 ? void 0 : col.tapStatus) != 'tap' ? 'pointer' : 'auto',
|
|
153
|
+
}, className: `${CLASS_PREFIX}__col ${CLASS_PREFIX}__col--${textAlign}`, key: colIndex },
|
|
154
|
+
React.createElement("div", { className: "wedatea2td-grid__box", "data-testid": `${colIndex}_click`, onClick: () => tapTo(col) },
|
|
155
|
+
React.createElement("div", { className: `${CLASS_PREFIX}__col-body` },
|
|
156
|
+
col && (React.createElement("div", { className: `${CLASS_PREFIX}__icon`, style: imageStyle },
|
|
157
|
+
React.createElement(Image, { mode: 'scaleToFill', lazyLoad: false, maskClosable: false, imgPreview: false, fit: 'cover', alt: '', src: col === null || col === void 0 ? void 0 : col.icon, className: `${CLASS_PREFIX}__img` }))),
|
|
158
|
+
React.createElement("div", { className: `${CLASS_PREFIX}__detail` },
|
|
159
|
+
titleVisible && (col === null || col === void 0 ? void 0 : col.title) && (React.createElement("div", { className: `${CLASS_PREFIX}__title`, style: titleStyle }, col === null || col === void 0 ? void 0 : col.title)),
|
|
160
|
+
desVisible && (col === null || col === void 0 ? void 0 : col.des) && (React.createElement("div", { className: `${CLASS_PREFIX}__desc`, style: desStyle }, col === null || col === void 0 ? void 0 : col.des)))),
|
|
161
|
+
buttonVisible && col && (React.createElement(Button, { type: "link", className: `${CLASS_PREFIX}__btn` },
|
|
162
|
+
React.createElement(Text, { className: `${CLASS_PREFIX}__btn--text` }, buttonText),
|
|
163
|
+
React.createElement(IconFont, { name: "arrow-right", className: `${CLASS_PREFIX}__btn-icon` }))))));
|
|
164
|
+
}))));
|
|
165
|
+
})))));
|
|
166
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PropsType } from './index';
|
|
3
|
+
interface ImageInnerPropsType extends Omit<PropsType, 'fit' | 'mode'> {
|
|
4
|
+
objectFit: React.CSSProperties['objectFit'];
|
|
5
|
+
isError: boolean;
|
|
6
|
+
setIsError: React.Dispatch<React.SetStateAction<boolean>>;
|
|
7
|
+
}
|
|
8
|
+
export declare function ImageInner({ objectFit, style, className, alt, src, isError, setIsError, events, lazyLoad, maskClosable, imgPreview, }: ImageInnerPropsType): JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ConfigProvider, ImagePreview } from 'tea-component';
|
|
3
|
+
import { usePlatform } from '../../utils/platform';
|
|
4
|
+
import { useGesture } from '@use-gesture/react';
|
|
5
|
+
export function ImageInner({ objectFit, style, className, alt, src, isError, setIsError, events, lazyLoad, maskClosable, imgPreview, }) {
|
|
6
|
+
const platform = usePlatform();
|
|
7
|
+
const [imgShow, setImgShow] = React.useState(false);
|
|
8
|
+
const onMaskClick = () => {
|
|
9
|
+
if (maskClosable) {
|
|
10
|
+
setImgShow(false);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const [showHeight, setShowHeight] = React.useState(0);
|
|
14
|
+
const realWidth = React.useRef(0);
|
|
15
|
+
const realHeight = React.useRef(0);
|
|
16
|
+
const [offsetHeight, setOffsetHeight] = React.useState(0);
|
|
17
|
+
const [translateX, setTranslateX] = React.useState(0);
|
|
18
|
+
const [translateY, setTranslateY] = React.useState(0);
|
|
19
|
+
const [previewScale, setPreviewScale] = React.useState(1);
|
|
20
|
+
React.useEffect(() => {
|
|
21
|
+
// 防止触发浏览器的放大缩小
|
|
22
|
+
const handler = (e) => e.preventDefault();
|
|
23
|
+
document.addEventListener('gesturestart', handler);
|
|
24
|
+
document.addEventListener('gesturechange', handler);
|
|
25
|
+
return () => {
|
|
26
|
+
document.removeEventListener('gesturestart', handler);
|
|
27
|
+
document.removeEventListener('gesturechange', handler);
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
const bind = useGesture({
|
|
31
|
+
onClick: ({ event }) => {
|
|
32
|
+
// 防止冒泡出发关闭预览
|
|
33
|
+
event.stopPropagation();
|
|
34
|
+
},
|
|
35
|
+
onPinch: ({ offset }) => {
|
|
36
|
+
const [s] = offset;
|
|
37
|
+
setPreviewScale(s);
|
|
38
|
+
},
|
|
39
|
+
onDrag: ({ offset, event }) => {
|
|
40
|
+
event.stopPropagation();
|
|
41
|
+
const [x, y] = offset;
|
|
42
|
+
setTranslateX(x);
|
|
43
|
+
setTranslateY(y);
|
|
44
|
+
},
|
|
45
|
+
}, {
|
|
46
|
+
drag: {
|
|
47
|
+
delay: true,
|
|
48
|
+
preventDefault: true,
|
|
49
|
+
},
|
|
50
|
+
pinch: {
|
|
51
|
+
scaleBounds: { min: 0.6, max: 5 },
|
|
52
|
+
pointer: {
|
|
53
|
+
touch: true,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
if (platform === 'h5' || !imgPreview || isError) {
|
|
58
|
+
return (React.createElement(React.Fragment, null,
|
|
59
|
+
React.createElement("img", { style: {
|
|
60
|
+
objectFit,
|
|
61
|
+
...style,
|
|
62
|
+
}, className: className, alt: alt, src: src, onLoad: (e) => {
|
|
63
|
+
const img = e.target;
|
|
64
|
+
const { naturalHeight, naturalWidth } = img;
|
|
65
|
+
realHeight.current = naturalHeight;
|
|
66
|
+
realWidth.current = naturalWidth;
|
|
67
|
+
setIsError(false);
|
|
68
|
+
events.load && events.load({}, { originEvent: e });
|
|
69
|
+
}, onError: (e) => {
|
|
70
|
+
setIsError(true);
|
|
71
|
+
events.error && events.error({}, { originEvent: e });
|
|
72
|
+
}, onClick: (e) => {
|
|
73
|
+
if (imgPreview && !isError) {
|
|
74
|
+
setTranslateX(0);
|
|
75
|
+
setTranslateY(0);
|
|
76
|
+
setPreviewScale(1);
|
|
77
|
+
const windowHeight = window.innerHeight;
|
|
78
|
+
const windowWidth = window.innerWidth;
|
|
79
|
+
let ratio = realWidth.current / realHeight.current;
|
|
80
|
+
if (Number.isNaN(ratio)) {
|
|
81
|
+
ratio = 1;
|
|
82
|
+
}
|
|
83
|
+
const height = windowWidth / ratio;
|
|
84
|
+
setOffsetHeight(windowHeight / 2 - height / 2);
|
|
85
|
+
setShowHeight(height);
|
|
86
|
+
setImgShow(true);
|
|
87
|
+
}
|
|
88
|
+
events.tap && events.tap({}, { originEvent: e });
|
|
89
|
+
}, loading: lazyLoad ? 'lazy' : undefined }),
|
|
90
|
+
imgShow && (React.createElement("div", { className: "weda-img-mask", onClick: onMaskClick },
|
|
91
|
+
React.createElement("div", { onClick: () => setImgShow(false), className: "weda-img-modal-close-btn" },
|
|
92
|
+
React.createElement("i", { className: "weui-icon-clear", style: { color: 'white' } })),
|
|
93
|
+
React.createElement("div", { ...bind(), className: "weda-img-preview", style: {
|
|
94
|
+
touchAction: 'none',
|
|
95
|
+
backgroundImage: `url(${src})`,
|
|
96
|
+
width: '100%',
|
|
97
|
+
height: showHeight,
|
|
98
|
+
marginTop: offsetHeight,
|
|
99
|
+
transform: `translate(${translateX}px, ${translateY}px) scale(${previewScale})`,
|
|
100
|
+
} })))));
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
|
|
104
|
+
React.createElement(ImagePreview, { previewSrc: src, maskClosable: maskClosable, className: className, style: { ...style, objectFit } }, (open) => (React.createElement("img", { style: {
|
|
105
|
+
objectFit,
|
|
106
|
+
cursor: 'zoom-in',
|
|
107
|
+
...style,
|
|
108
|
+
}, className: className, alt: alt, src: src, onLoad: (e) => {
|
|
109
|
+
setIsError(false);
|
|
110
|
+
events.load && events.load({}, { originEvent: e });
|
|
111
|
+
}, onError: (e) => {
|
|
112
|
+
setIsError(true);
|
|
113
|
+
events.error && events.error({}, { originEvent: e });
|
|
114
|
+
}, loading: lazyLoad ? 'lazy' : undefined, onClick: (e) => {
|
|
115
|
+
open();
|
|
116
|
+
events.tap && events.tap({}, { originEvent: e });
|
|
117
|
+
} })))));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
@media screen and (max-width: 576px) {
|
|
2
|
+
.weda-image {
|
|
3
|
+
width: 8.5714rem;
|
|
4
|
+
height: 8.5714rem;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
.weda-img-mask {
|
|
8
|
+
position: fixed;
|
|
9
|
+
top: 0;
|
|
10
|
+
bottom: 0;
|
|
11
|
+
left: 0;
|
|
12
|
+
right: 0;
|
|
13
|
+
background-color: black;
|
|
14
|
+
z-index: 99;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.weda-img-preview {
|
|
18
|
+
background: center center no-repeat;
|
|
19
|
+
background-size: contain;
|
|
20
|
+
width: 100%;
|
|
21
|
+
position: absolute;
|
|
22
|
+
left: 0;
|
|
23
|
+
right: 0;
|
|
24
|
+
top: 0;
|
|
25
|
+
bottom: 0;
|
|
26
|
+
z-index: 150;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.weda-img-modal-close-btn {
|
|
30
|
+
position: fixed;
|
|
31
|
+
top: 1.14286rem;
|
|
32
|
+
right: 1.14286rem;
|
|
33
|
+
display: inline-block;
|
|
34
|
+
z-index: 99;
|
|
35
|
+
color: white;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.weda-image.weda-image-error,
|
|
39
|
+
.weda-image:not([src]) {
|
|
40
|
+
position: relative !important;
|
|
41
|
+
display: inline-block !important;
|
|
42
|
+
}
|
|
43
|
+
.weda-image:not([src]):before,
|
|
44
|
+
.weda-image-error::before {
|
|
45
|
+
content: '';
|
|
46
|
+
background: #f5f5f5
|
|
47
|
+
url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIiBmaWxsPSJub25lIj4KICA8cGF0aCBkPSJNMjUuMzIgMTYuMzU5N0MyNi4wNzY0IDE2LjM1OTcgMjYuODI1NCAxNi41MDg3IDI3LjUyNDMgMTYuNzk4MUMyOC4yMjMxIDE3LjA4NzYgMjguODU4MSAxNy41MTE5IDI5LjM5MjkgMTguMDQ2OEMyOS45Mjc4IDE4LjU4MTYgMzAuMzUyMSAxOS4yMTY2IDMwLjY0MTYgMTkuOTE1NEMzMC45MzEgMjAuNjE0MyAzMS4wOCAyMS4zNjMzIDMxLjA4IDIyLjExOTdDMzEuMDggMjIuODc2MSAzMC45MzEgMjMuNjI1MSAzMC42NDE2IDI0LjMyMzlDMzAuMzUyMSAyNS4wMjI4IDI5LjkyNzggMjUuNjU3OCAyOS4zOTI5IDI2LjE5MjZDMjguODU4MSAyNi43Mjc1IDI4LjIyMzEgMjcuMTUxOCAyNy41MjQzIDI3LjQ0MTJDMjYuODI1NCAyNy43MzA3IDI2LjA3NjQgMjcuODc5NyAyNS4zMiAyNy44Nzk3QzIzLjc5MjQgMjcuODc5NyAyMi4zMjczIDI3LjI3MjggMjEuMjQ3MSAyNi4xOTI2QzIwLjE2NjkgMjUuMTEyNCAxOS41NiAyMy42NDczIDE5LjU2IDIyLjExOTdDMTkuNTYgMjAuNTkyIDIwLjE2NjkgMTkuMTI3IDIxLjI0NzEgMTguMDQ2OEMyMi4zMjczIDE2Ljk2NjUgMjMuNzkyNCAxNi4zNTk3IDI1LjMyIDE2LjM1OTdaTTI4IDMuNTU5NjlWMTQuODc2OEMyNy4xNzc3IDE0LjU4NjYgMjYuMTkyIDE0LjQzODggMjUuMzIgMTQuNDM5N0MyNC4wMzEgMTQuNDM5NyAyMi44MTU3IDE0Ljc1NzEgMjEuNzQ4OCAxNS4zMTg0TDIwLjc5NTIgMTMuMTU5N0wxNi4wMjU5IDIwLjAyNzVMOC40NDU3NiAxNi40NDFMMy41NiAyMy4zOTk3SDE3Ljc0NjJDMTcuOTg2NyAyNC44MjkgMTguNjI4MiAyNi4xNjA2IDE5LjU5NTggMjcuMjM5N0gxVjMuNTU5NjlIMjhaTTI1Ljk2IDI0LjAzOTdIMjQuNjhWMjUuMzE5N0gyNS45NlYyNC4wMzk3Wk0yNS45NiAxOC45MTk3SDI0LjY4VjIzLjM5OTdIMjUuOTZWMTguOTE5N1pNNi4xMiAxMC41OTk3QzYuMTIgMTEuOTk4MSA3LjE5OTA0IDEzLjEwODUgOC42MDc2OCAxMy4xNTg0QzEwLjAyMDggMTMuMjA3NyAxMS4yNCAxMi4wNDggMTEuMjQgMTAuNTk5N0MxMS4yNCA5LjI0NjA5IDEwLjA2NDMgOC4wODU3NyA4Ljc1MjMyIDguMDQwOTdDNy4yOTU2OCA3Ljk5MTY5IDYuMTIgOS4xNTEzNyA2LjEyIDEwLjU5OTdaIiBmaWxsPSIjQkNDNEQwIj48L3BhdGg+Cjwvc3ZnPgo=')
|
|
48
|
+
no-repeat center / 50% 50%;
|
|
49
|
+
position: absolute;
|
|
50
|
+
left: 0;
|
|
51
|
+
top: 0;
|
|
52
|
+
width: 100%;
|
|
53
|
+
height: 100%;
|
|
54
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import './index.css';
|
|
3
|
+
import type { CommonPropsType } from '../../types';
|
|
4
|
+
declare type TMode = 'scaleToFill' | 'aspectFit' | 'aspectFill' | 'widthFix' | 'heightFix' | 'top' | 'bottom' | 'center' | 'left' | 'right' | 'top left' | 'top right' | 'bottom left' | 'bottom right';
|
|
5
|
+
export interface PropsType extends CommonPropsType, Pick<HTMLImageElement, 'src' | 'alt'> {
|
|
6
|
+
mode: TMode;
|
|
7
|
+
lazyLoad: boolean;
|
|
8
|
+
maskClosable: boolean;
|
|
9
|
+
imgPreview: boolean;
|
|
10
|
+
fit: React.CSSProperties['objectFit'] | ('widthFix' | 'heightFix');
|
|
11
|
+
}
|
|
12
|
+
export default function Image({ className, events, style, src, alt, mode, lazyLoad, imgPreview, maskClosable, fit, }: PropsType): JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useState, useEffect, useMemo } from 'react';
|
|
3
|
+
import classNames from '../../utils/classnames';
|
|
4
|
+
import './index.css';
|
|
5
|
+
import { ImageInner } from './image';
|
|
6
|
+
import { emptyObject } from '../../utils/constant';
|
|
7
|
+
export default function Image({
|
|
8
|
+
// 系统属性
|
|
9
|
+
className, events = emptyObject, style,
|
|
10
|
+
// 组件属性
|
|
11
|
+
src, alt, mode, lazyLoad, imgPreview, maskClosable, fit, }) {
|
|
12
|
+
const [isError, setIsError] = useState(false);
|
|
13
|
+
const cls = classNames({
|
|
14
|
+
'weda-ui': true,
|
|
15
|
+
'weda-image': true,
|
|
16
|
+
'weda-image-error': isError,
|
|
17
|
+
[className]: className,
|
|
18
|
+
});
|
|
19
|
+
const objectFit = fit || getObjectFitByWxImageMode(mode);
|
|
20
|
+
const [realSrc, setRealSrc] = useState(/^cloud:\/\//.test(src) ? undefined : src);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (/^cloud:\/\//.test(src)) {
|
|
23
|
+
window.app.cloud
|
|
24
|
+
.getTempFileURL(src)
|
|
25
|
+
.then((res) => {
|
|
26
|
+
setRealSrc(res || '');
|
|
27
|
+
})
|
|
28
|
+
.catch(() => {
|
|
29
|
+
setRealSrc('');
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
setRealSrc(src);
|
|
34
|
+
}
|
|
35
|
+
}, [src]);
|
|
36
|
+
/**
|
|
37
|
+
* 模拟小程序的widthFix、heightFix模式
|
|
38
|
+
*/
|
|
39
|
+
const realFit = useMemo(() => {
|
|
40
|
+
if (objectFit === 'widthFix' || objectFit === 'heightFix') {
|
|
41
|
+
return 'scale-down';
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return objectFit;
|
|
45
|
+
}
|
|
46
|
+
}, [objectFit]);
|
|
47
|
+
const realStyle = useMemo(() => {
|
|
48
|
+
if (objectFit === 'widthFix') {
|
|
49
|
+
return {
|
|
50
|
+
...style,
|
|
51
|
+
height: 'auto',
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
else if (objectFit === 'heightFix') {
|
|
55
|
+
return {
|
|
56
|
+
...style,
|
|
57
|
+
width: 'auto',
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
return style;
|
|
62
|
+
}
|
|
63
|
+
}, [style, fit]);
|
|
64
|
+
return src === realSrc || (realSrc !== undefined && src !== realSrc) ? (React.createElement(ImageInner, { objectFit: realFit, style: realStyle, className: cls, alt: alt, src: realSrc, isError: isError, setIsError: setIsError, events: events, lazyLoad: lazyLoad, imgPreview: imgPreview, maskClosable: maskClosable })) : null;
|
|
65
|
+
}
|
|
66
|
+
function getObjectFitByWxImageMode(mode) {
|
|
67
|
+
const array = [
|
|
68
|
+
{
|
|
69
|
+
mode: 'scaleToFill',
|
|
70
|
+
h5: 'fill',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
mode: 'aspectFit',
|
|
74
|
+
h5: 'contain',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
mode: 'aspectFill',
|
|
78
|
+
h5: 'cover',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
mode: 'widthFix',
|
|
82
|
+
h5: 'cover',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
mode: 'heightFix',
|
|
86
|
+
h5: 'contain',
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
const item = array.find((item) => item.mode === mode);
|
|
90
|
+
return item === null || item === void 0 ? void 0 : item.h5;
|
|
91
|
+
}
|