@cloudbase/weda-ui 2.0.28 → 3.1.0
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/package.json +12 -13
- package/src/configs/actions/showModal.json +0 -48
- package/src/configs/actions/showToast.json +0 -41
- package/src/configs/components/auth.json +0 -16
- package/src/configs/components/button.json +0 -239
- package/src/configs/components/calendar.json +0 -81
- package/src/configs/components/carousel.json +0 -292
- package/src/configs/components/chart/bar.json +0 -721
- package/src/configs/components/chart/line.json +0 -674
- package/src/configs/components/chart/pie.json +0 -494
- package/src/configs/components/chart/statisticsCard.json +0 -376
- package/src/configs/components/container.json +0 -50
- package/src/configs/components/dataView.json +0 -151
- package/src/configs/components/drawer.json +0 -115
- package/src/configs/components/form/checkbox.json +0 -173
- package/src/configs/components/form/form.json +0 -45
- package/src/configs/components/form/input.json +0 -154
- package/src/configs/components/form/label.json +0 -22
- package/src/configs/components/form/location.json +0 -155
- package/src/configs/components/form/radio.json +0 -203
- package/src/configs/components/form/richText.json +0 -125
- package/src/configs/components/form/select.json +0 -411
- package/src/configs/components/form/switch.json +0 -58
- package/src/configs/components/form/textarea.json +0 -116
- package/src/configs/components/form/tips.json +0 -34
- package/src/configs/components/form/uploader.json +0 -169
- package/src/configs/components/form/uploaderFile.json +0 -158
- package/src/configs/components/graphicCard.json +0 -413
- package/src/configs/components/image.json +0 -179
- package/src/configs/components/link.json +0 -79
- package/src/configs/components/listView.json +0 -281
- package/src/configs/components/lottery.json +0 -157
- package/src/configs/components/modal.json +0 -83
- package/src/configs/components/navLayout.json +0 -368
- package/src/configs/components/navigationBar.json +0 -62
- package/src/configs/components/picker/datePicker.json +0 -33
- package/src/configs/components/picker/picker.json +0 -18
- package/src/configs/components/picker/timePicker.json +0 -23
- package/src/configs/components/richtextview.json +0 -26
- package/src/configs/components/scrollVeiw.json +0 -253
- package/src/configs/components/slot.json +0 -17
- package/src/configs/components/swiper.json +0 -90
- package/src/configs/components/tabs.json +0 -121
- package/src/configs/components/text.json +0 -95
- package/src/configs/components/wedaVideo.json +0 -89
- package/src/configs/components/wxOpenApi/phone.json +0 -127
- package/src/configs/components/wxOpenApi/phoneCode.json +0 -109
- package/src/configs/components/wxOpenApi/share.json +0 -157
- package/src/configs/components/wxOpenApi/userInfo.json +0 -156
- package/src/configs/index.js +0 -111
- package/src/index.js +0 -4
- package/src/mp/README.md +0 -1
- package/src/mp/actions/showModal/index.js +0 -3
- package/src/mp/actions/showToast/index.js +0 -3
- package/src/mp/components/button/index.js +0 -91
- package/src/mp/components/button/index.json +0 -4
- package/src/mp/components/button/index.wxml +0 -22
- package/src/mp/components/button/index.wxss +0 -13
- package/src/mp/components/calendar/arrowright--line.svg +0 -11
- package/src/mp/components/calendar/index.js +0 -268
- package/src/mp/components/calendar/index.json +0 -5
- package/src/mp/components/calendar/index.wxml +0 -35
- package/src/mp/components/calendar/index.wxss +0 -179
- package/src/mp/components/carousel/index.js +0 -88
- package/src/mp/components/carousel/index.json +0 -7
- package/src/mp/components/carousel/index.wxml +0 -6
- package/src/mp/components/chart/bar/index.js +0 -257
- package/src/mp/components/chart/bar/index.json +0 -6
- package/src/mp/components/chart/bar/index.wxml +0 -3
- package/src/mp/components/chart/bar/index.wxss +0 -9
- package/src/mp/components/chart/common/config/bar.js +0 -50
- package/src/mp/components/chart/common/config/global.js +0 -16
- package/src/mp/components/chart/common/config/line.js +0 -48
- package/src/mp/components/chart/common/config/pie.js +0 -36
- package/src/mp/components/chart/common/core/eChartBar.js +0 -258
- package/src/mp/components/chart/common/core/eChartBase.js +0 -389
- package/src/mp/components/chart/common/core/eChartLine.js +0 -223
- package/src/mp/components/chart/common/core/eChartPie.js +0 -169
- package/src/mp/components/chart/common/lib/echarts.min.js +0 -18
- package/src/mp/components/chart/ec-canvas/ec-canvas.js +0 -277
- package/src/mp/components/chart/ec-canvas/ec-canvas.json +0 -4
- package/src/mp/components/chart/ec-canvas/ec-canvas.wxml +0 -4
- package/src/mp/components/chart/ec-canvas/ec-canvas.wxss +0 -4
- package/src/mp/components/chart/ec-canvas/wx-canvas.js +0 -109
- package/src/mp/components/chart/line/index.js +0 -247
- package/src/mp/components/chart/line/index.json +0 -6
- package/src/mp/components/chart/line/index.wxml +0 -3
- package/src/mp/components/chart/line/index.wxss +0 -9
- package/src/mp/components/chart/pie/index.js +0 -182
- package/src/mp/components/chart/pie/index.json +0 -6
- package/src/mp/components/chart/pie/index.wxml +0 -3
- package/src/mp/components/chart/pie/index.wxss +0 -9
- package/src/mp/components/chart/statisticsCard/index.js +0 -253
- package/src/mp/components/chart/statisticsCard/index.json +0 -4
- package/src/mp/components/chart/statisticsCard/index.wxml +0 -9
- package/src/mp/components/chart/statisticsCard/index.wxss +0 -42
- package/src/mp/components/container/index.js +0 -20
- package/src/mp/components/container/index.json +0 -4
- package/src/mp/components/container/index.wxml +0 -3
- package/src/mp/components/dataView/index.js +0 -34
- package/src/mp/components/dataView/index.json +0 -7
- package/src/mp/components/dataView/index.wxml +0 -3
- package/src/mp/components/dataView/index.wxss +0 -0
- package/src/mp/components/form/checkbox/index.js +0 -124
- package/src/mp/components/form/checkbox/index.json +0 -7
- package/src/mp/components/form/checkbox/index.wxml +0 -13
- package/src/mp/components/form/checkbox/index.wxss +0 -1
- package/src/mp/components/form/form/index.js +0 -18
- package/src/mp/components/form/form/index.json +0 -4
- package/src/mp/components/form/form/index.wxml +0 -5
- package/src/mp/components/form/form/index.wxss +0 -1
- package/src/mp/components/form/formcell/index.js +0 -54
- package/src/mp/components/form/formcell/index.json +0 -4
- package/src/mp/components/form/formcell/index.wxml +0 -11
- package/src/mp/components/form/formcell/index.wxss +0 -31
- package/src/mp/components/form/input/index.js +0 -110
- package/src/mp/components/form/input/index.json +0 -7
- package/src/mp/components/form/input/index.wxml +0 -24
- package/src/mp/components/form/input/index.wxss +0 -22
- package/src/mp/components/form/location/components/mapChoose/index.js +0 -201
- package/src/mp/components/form/location/components/mapChoose/index.json +0 -4
- package/src/mp/components/form/location/components/mapChoose/index.wxml +0 -42
- package/src/mp/components/form/location/components/mapChoose/index.wxss +0 -188
- package/src/mp/components/form/location/index.js +0 -388
- package/src/mp/components/form/location/index.json +0 -6
- package/src/mp/components/form/location/index.wxml +0 -21
- package/src/mp/components/form/location/index.wxss +0 -89
- package/src/mp/components/form/radio/index.js +0 -124
- package/src/mp/components/form/radio/index.json +0 -7
- package/src/mp/components/form/radio/index.wxml +0 -13
- package/src/mp/components/form/radio/index.wxss +0 -1
- package/src/mp/components/form/select/index.js +0 -677
- package/src/mp/components/form/select/index.json +0 -7
- package/src/mp/components/form/select/index.wxml +0 -12
- package/src/mp/components/form/select/index.wxss +0 -16
- package/src/mp/components/form/select/region/index.js +0 -107
- package/src/mp/components/form/switch/index.js +0 -75
- package/src/mp/components/form/switch/index.json +0 -7
- package/src/mp/components/form/switch/index.wxml +0 -11
- package/src/mp/components/form/switch/index.wxss +0 -1
- package/src/mp/components/form/textarea/index.js +0 -90
- package/src/mp/components/form/textarea/index.json +0 -7
- package/src/mp/components/form/textarea/index.wxml +0 -8
- package/src/mp/components/form/textarea/index.wxss +0 -10
- package/src/mp/components/form/tips/index.js +0 -41
- package/src/mp/components/form/tips/index.json +0 -4
- package/src/mp/components/form/tips/index.wxml +0 -1
- package/src/mp/components/form/tips/index.wxss +0 -1
- package/src/mp/components/form/uploader/index.js +0 -158
- package/src/mp/components/form/uploader/index.json +0 -10
- package/src/mp/components/form/uploader/index.wxml +0 -14
- package/src/mp/components/form/uploader/index.wxss +0 -36
- package/src/mp/components/form/uploader/weui-uploader.js +0 -219
- package/src/mp/components/form/uploader/weui-uploader.json +0 -7
- package/src/mp/components/form/uploader/weui-uploader.wxml +0 -45
- package/src/mp/components/form/uploader/weui-uploader.wxss +0 -1
- package/src/mp/components/form/uploaderFile/index.js +0 -313
- package/src/mp/components/form/uploaderFile/index.json +0 -9
- package/src/mp/components/form/uploaderFile/index.wxml +0 -45
- package/src/mp/components/form/uploaderFile/index.wxss +0 -105
- package/src/mp/components/graphicCard/chevron-right.svg +0 -3
- package/src/mp/components/graphicCard/index.js +0 -203
- package/src/mp/components/graphicCard/index.json +0 -4
- package/src/mp/components/graphicCard/index.wxml +0 -25
- package/src/mp/components/graphicCard/index.wxss +0 -157
- package/src/mp/components/image/index.js +0 -182
- package/src/mp/components/image/index.json +0 -7
- package/src/mp/components/image/index.wxml +0 -9
- package/src/mp/components/image/index.wxss +0 -49
- package/src/mp/components/listView/arrow-right-line.svg +0 -3
- package/src/mp/components/listView/index.js +0 -274
- package/src/mp/components/listView/index.json +0 -4
- package/src/mp/components/listView/index.wxml +0 -38
- package/src/mp/components/listView/index.wxss +0 -155
- package/src/mp/components/listView/more-line.svg +0 -3
- package/src/mp/components/lottery/index.js +0 -270
- package/src/mp/components/lottery/index.json +0 -4
- package/src/mp/components/lottery/index.wxml +0 -41
- package/src/mp/components/lottery/index.wxss +0 -323
- package/src/mp/components/modal/index.js +0 -39
- package/src/mp/components/modal/index.json +0 -4
- package/src/mp/components/modal/index.wxml +0 -1
- package/src/mp/components/navLayout/index.js +0 -120
- package/src/mp/components/navLayout/index.json +0 -7
- package/src/mp/components/navLayout/index.wxml +0 -23
- package/src/mp/components/navLayout/index.wxss +0 -1193
- package/src/mp/components/navigationBar/index.js +0 -204
- package/src/mp/components/navigationBar/index.json +0 -5
- package/src/mp/components/navigationBar/index.wxml +0 -80
- package/src/mp/components/navigationBar/index.wxss +0 -1257
- package/src/mp/components/richText/index.js +0 -67
- package/src/mp/components/richText/index.json +0 -4
- package/src/mp/components/richText/index.wxml +0 -3
- package/src/mp/components/richText/index.wxss +0 -27
- package/src/mp/components/scrollView/index.js +0 -119
- package/src/mp/components/scrollView/index.json +0 -4
- package/src/mp/components/scrollView/index.wxml +0 -38
- package/src/mp/components/slot/index.js +0 -20
- package/src/mp/components/slot/index.json +0 -4
- package/src/mp/components/slot/index.wxml +0 -3
- package/src/mp/components/swiper/index.js +0 -65
- package/src/mp/components/swiper/index.json +0 -4
- package/src/mp/components/swiper/index.wxml +0 -3
- package/src/mp/components/tabs/index.js +0 -59
- package/src/mp/components/tabs/index.json +0 -4
- package/src/mp/components/tabs/index.wxml +0 -12
- package/src/mp/components/tabs/index.wxss +0 -57
- package/src/mp/components/text/index.js +0 -40
- package/src/mp/components/text/index.json +0 -4
- package/src/mp/components/text/index.wxml +0 -1
- package/src/mp/components/text/index.wxss +0 -26
- package/src/mp/components/wedaVideo/index.js +0 -86
- package/src/mp/components/wedaVideo/index.json +0 -4
- package/src/mp/components/wedaVideo/index.wxml +0 -4
- package/src/mp/components/wedaVideo/index.wxss +0 -20
- package/src/mp/components/wxOpenApi/phone/index.js +0 -109
- package/src/mp/components/wxOpenApi/phone/index.json +0 -4
- package/src/mp/components/wxOpenApi/phone/index.wxml +0 -4
- package/src/mp/components/wxOpenApi/phone/index.wxss +0 -22
- package/src/mp/components/wxOpenApi/phoneCode/index.js +0 -89
- package/src/mp/components/wxOpenApi/phoneCode/index.json +0 -4
- package/src/mp/components/wxOpenApi/phoneCode/index.wxml +0 -4
- package/src/mp/components/wxOpenApi/phoneCode/index.wxss +0 -22
- package/src/mp/components/wxOpenApi/share/index.js +0 -117
- package/src/mp/components/wxOpenApi/share/index.json +0 -4
- package/src/mp/components/wxOpenApi/share/index.wxml +0 -4
- package/src/mp/components/wxOpenApi/share/index.wxss +0 -22
- package/src/mp/components/wxOpenApi/userInfo/index.js +0 -88
- package/src/mp/components/wxOpenApi/userInfo/index.json +0 -4
- package/src/mp/components/wxOpenApi/userInfo/index.wxml +0 -4
- package/src/mp/components/wxOpenApi/userInfo/index.wxss +0 -22
- package/src/mp/index.json +0 -52
- package/src/mp/package.json +0 -6
- package/src/mp/style/weda-ui.wxss +0 -71
- package/src/mp/utils/classnames.js +0 -39
- package/src/mp/utils/constant.js +0 -20
- package/src/mp/utils/dayjs.min.js +0 -1
- package/src/mp/utils/debounce.js +0 -133
- package/src/mp/utils/deepEqual.js +0 -42
- package/src/mp/utils/destr.js +0 -49
- package/src/mp/utils/dr_square_point.js +0 -29
- package/src/mp/utils/handleEvents.js +0 -32
- package/src/mp/utils/lodash.js +0 -2
- package/src/mp/utils/platform.js +0 -45
- package/src/mp/utils/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.js +0 -1336
- package/src/mp/utils/spark-md5.js +0 -776
- package/src/mp/utils/tcb.js +0 -90
- package/src/setupTests.js +0 -14
- package/src/web/actions/index.js +0 -2
- package/src/web/actions/showModal/index.tsx +0 -118
- package/src/web/actions/showToast/index.js +0 -3
- package/src/web/components/auth/index.css +0 -0
- package/src/web/components/auth/index.js +0 -66
- package/src/web/components/button/index.css +0 -27
- package/src/web/components/button/index.tsx +0 -119
- package/src/web/components/calendar/index.css +0 -416
- package/src/web/components/calendar/index.jsx +0 -312
- package/src/web/components/calendar/util.js +0 -90
- package/src/web/components/carousel/index.css +0 -119
- package/src/web/components/carousel/index.tsx +0 -417
- package/src/web/components/chart/bar/index.tsx +0 -140
- package/src/web/components/chart/common/config/bar.js +0 -49
- package/src/web/components/chart/common/config/global.js +0 -16
- package/src/web/components/chart/common/config/line.js +0 -50
- package/src/web/components/chart/common/config/pie.js +0 -37
- package/src/web/components/chart/common/core/eChartBar.js +0 -259
- package/src/web/components/chart/common/core/eChartBase.ts +0 -396
- package/src/web/components/chart/common/core/eChartLine.js +0 -225
- package/src/web/components/chart/common/core/eChartPie.js +0 -173
- package/src/web/components/chart/common/core/type.ts +0 -34
- package/src/web/components/chart/common/echart.css +0 -106
- package/src/web/components/chart/common/echarts.ts +0 -31
- package/src/web/components/chart/common/useChart.tsx +0 -87
- package/src/web/components/chart/line/index.tsx +0 -136
- package/src/web/components/chart/pie/index.tsx +0 -99
- package/src/web/components/chart/statisticsCard/index.css +0 -63
- package/src/web/components/chart/statisticsCard/index.tsx +0 -307
- package/src/web/components/chart/statisticsCard/interface.ts +0 -14
- package/src/web/components/container/index.tsx +0 -34
- package/src/web/components/dataView/index.tsx +0 -20
- package/src/web/components/dataView/interface.ts +0 -6
- package/src/web/components/drawer/index.tsx +0 -68
- package/src/web/components/form/checkbox/index.tsx +0 -210
- package/src/web/components/form/enumSelect/MultipleSelect.jsx +0 -89
- package/src/web/components/form/enumSelect/NormalSelect.tsx +0 -92
- package/src/web/components/form/enumSelect/SelectContainer.jsx +0 -43
- package/src/web/components/form/enumSelect/index.jsx +0 -9
- package/src/web/components/form/enumSelect/props/defaultProps.js +0 -39
- package/src/web/components/form/enumSelect/props/propsTypes.js +0 -50
- package/src/web/components/form/form/index.css +0 -9
- package/src/web/components/form/form/index.tsx +0 -51
- package/src/web/components/form/formcell/index.css +0 -85
- package/src/web/components/form/formcell/index.tsx +0 -85
- package/src/web/components/form/input/index.css +0 -40
- package/src/web/components/form/input/index.tsx +0 -166
- package/src/web/components/form/location/common/mapChoose.css +0 -180
- package/src/web/components/form/location/common/mapChoose.jsx +0 -343
- package/src/web/components/form/location/common/mapView.jsx +0 -190
- package/src/web/components/form/location/common/propsConfig.js +0 -54
- package/src/web/components/form/location/common/selectModal.css +0 -44
- package/src/web/components/form/location/common/selectModal.jsx +0 -73
- package/src/web/components/form/location/common/useLocationInfo.js +0 -104
- package/src/web/components/form/location/components/LocationH5/index.css +0 -239
- package/src/web/components/form/location/components/LocationH5/location.h5.jsx +0 -413
- package/src/web/components/form/location/components/LocationPC/Header.jsx +0 -96
- package/src/web/components/form/location/components/LocationPC/index.css +0 -44
- package/src/web/components/form/location/components/LocationPC/location.PC.jsx +0 -332
- package/src/web/components/form/location/constants.js +0 -4
- package/src/web/components/form/location/index.css +0 -0
- package/src/web/components/form/location/index.jsx +0 -25
- package/src/web/components/form/radio/index.css +0 -12
- package/src/web/components/form/radio/index.tsx +0 -179
- package/src/web/components/form/renderDecorator.tsx +0 -28
- package/src/web/components/form/select/h5.tsx +0 -602
- package/src/web/components/form/select/index.css +0 -27
- package/src/web/components/form/select/index.tsx +0 -510
- package/src/web/components/form/select/region/index.ts +0 -152
- package/src/web/components/form/select/time.jsx +0 -145
- package/src/web/components/form/select/year.tsx +0 -172
- package/src/web/components/form/switch/index.tsx +0 -100
- package/src/web/components/form/textarea/index.css +0 -11
- package/src/web/components/form/textarea/index.tsx +0 -127
- package/src/web/components/form/tips/index.css +0 -4
- package/src/web/components/form/tips/index.tsx +0 -34
- package/src/web/components/form/types.d.ts +0 -12
- package/src/web/components/form/uploader/index.css +0 -118
- package/src/web/components/form/uploader/index.tsx +0 -65
- package/src/web/components/form/uploader/uploader.h5.tsx +0 -290
- package/src/web/components/form/uploader/uploader.pc.tsx +0 -287
- package/src/web/components/form/uploaderFile/fail.svg +0 -12
- package/src/web/components/form/uploaderFile/index.css +0 -422
- package/src/web/components/form/uploaderFile/index.jsx +0 -25
- package/src/web/components/form/uploaderFile/pending.svg +0 -18
- package/src/web/components/form/uploaderFile/success.svg +0 -12
- package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +0 -606
- package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +0 -520
- package/src/web/components/graphicCard/index.css +0 -159
- package/src/web/components/graphicCard/index.tsx +0 -310
- package/src/web/components/image/image.tsx +0 -187
- package/src/web/components/image/index.css +0 -54
- package/src/web/components/image/index.tsx +0 -121
- package/src/web/components/index.js +0 -95
- package/src/web/components/link/index.css +0 -8
- package/src/web/components/link/index.tsx +0 -119
- package/src/web/components/listView/arrow-right-line.svg +0 -3
- package/src/web/components/listView/index.css +0 -143
- package/src/web/components/listView/index.tsx +0 -346
- package/src/web/components/listView/interface.ts +0 -98
- package/src/web/components/lottery/index.css +0 -333
- package/src/web/components/lottery/index.tsx +0 -567
- package/src/web/components/lottery/lotteryUtil.ts +0 -130
- package/src/web/components/modal/index.tsx +0 -60
- package/src/web/components/navLayout/index.css +0 -332
- package/src/web/components/navLayout/index.tsx +0 -247
- package/src/web/components/navigationBar/chevron-right--double.svg +0 -3
- package/src/web/components/navigationBar/common.tsx +0 -203
- package/src/web/components/navigationBar/h5Menu.tsx +0 -179
- package/src/web/components/navigationBar/horizontalMenu.tsx +0 -201
- package/src/web/components/navigationBar/index.css +0 -762
- package/src/web/components/navigationBar/index.tsx +0 -231
- package/src/web/components/navigationBar/type.d.ts +0 -118
- package/src/web/components/navigationBar/verticalMenu.tsx +0 -81
- package/src/web/components/phone/index.css +0 -0
- package/src/web/components/phone/index.tsx +0 -22
- package/src/web/components/phoneCode/index.css +0 -0
- package/src/web/components/phoneCode/index.tsx +0 -22
- package/src/web/components/picker/datePicker.tsx +0 -48
- package/src/web/components/picker/picker.tsx +0 -59
- package/src/web/components/picker/timePicker.tsx +0 -56
- package/src/web/components/richText/const.ts +0 -3
- package/src/web/components/richText/index.css +0 -93
- package/src/web/components/richText/index.jsx +0 -473
- package/src/web/components/richTextView/index.css +0 -63
- package/src/web/components/richTextView/index.tsx +0 -63
- package/src/web/components/scrollView/index.tsx +0 -148
- package/src/web/components/share/index.css +0 -0
- package/src/web/components/share/index.tsx +0 -38
- package/src/web/components/slot/index.tsx +0 -19
- package/src/web/components/swiper/index.css +0 -106
- package/src/web/components/swiper/index.tsx +0 -291
- package/src/web/components/tabs/index.css +0 -64
- package/src/web/components/tabs/index.tsx +0 -35
- package/src/web/components/tabs/tabs.h5.tsx +0 -84
- package/src/web/components/tabs/tabs.pc.tsx +0 -74
- package/src/web/components/text/index.css +0 -26
- package/src/web/components/text/index.tsx +0 -60
- package/src/web/components/uploaderFileView/index.css +0 -11
- package/src/web/components/uploaderFileView/index.jsx +0 -84
- package/src/web/components/uploaderView/index.css +0 -31
- package/src/web/components/uploaderView/index.tsx +0 -92
- package/src/web/components/userInfo/index.css +0 -0
- package/src/web/components/userInfo/index.tsx +0 -30
- package/src/web/components/wedaVideo/index.css +0 -42
- package/src/web/components/wedaVideo/index.tsx +0 -208
- package/src/web/index.js +0 -4
- package/src/web/types.d.ts +0 -21
- package/src/web/utils/classnames.js +0 -39
- package/src/web/utils/constant.ts +0 -23
- package/src/web/utils/debounce.js +0 -98
- package/src/web/utils/events.js +0 -2
- package/src/web/utils/getLocalCounter.js +0 -5
- package/src/web/utils/isObjectEqual.js +0 -15
- package/src/web/utils/loading-fallback.tsx +0 -2
- package/src/web/utils/lodash.ts +0 -2
- package/src/web/utils/platform.js +0 -170
- package/src/web/utils/tcb.js +0 -86
- package/src/web/utils/tmap.js +0 -4
- package/src/web/utils/useSetState.ts +0 -18
- package/src/web/utils/useSyncValue.ts +0 -17
- package/src/web/utils/weui.js +0 -3
- package/src/web/weda-ui.css +0 -90
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState, useCallback } from 'react';
|
|
2
|
-
import './index.css';
|
|
3
|
-
import { CommonPropsType } from '../../types';
|
|
4
|
-
import classNames from '../../utils/classnames';
|
|
5
|
-
import { Row, Col, ConfigProvider, Button, Icon, Text } from 'tea-component';
|
|
6
|
-
import { usePlatform } from '../../utils/platform';
|
|
7
|
-
import { IconFont } from 'tdesign-icons-react';
|
|
8
|
-
|
|
9
|
-
const CLASS_PREFIX = 'weda-graphic-card';
|
|
10
|
-
|
|
11
|
-
export interface IGraphicCardPropsType extends CommonPropsType {
|
|
12
|
-
/**
|
|
13
|
-
* 导航配置
|
|
14
|
-
*/
|
|
15
|
-
navOption?: Array<any>;
|
|
16
|
-
titleVisible: boolean;
|
|
17
|
-
titleColor: string;
|
|
18
|
-
titleFontWeight: string;
|
|
19
|
-
titleFontSize: number;
|
|
20
|
-
titleLineHeight: string;
|
|
21
|
-
titleMaxLines: number;
|
|
22
|
-
desColor: string;
|
|
23
|
-
desFontWeight: string;
|
|
24
|
-
desVisible: boolean;
|
|
25
|
-
desFontSize: number;
|
|
26
|
-
desLineHeight: string;
|
|
27
|
-
desMaxLines: number;
|
|
28
|
-
buttonVisible: boolean;
|
|
29
|
-
buttonText: string;
|
|
30
|
-
ColMobile: number;
|
|
31
|
-
ColPC: number;
|
|
32
|
-
percentageVisible: boolean;
|
|
33
|
-
iconWidthSize: string;
|
|
34
|
-
iconHeightSize: string;
|
|
35
|
-
textAlign?: 'start' | 'end' | 'left' | 'right' | 'center' | 'justify';
|
|
36
|
-
imageStyle: any;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export default function GraphicCard({
|
|
40
|
-
navOption,
|
|
41
|
-
ColMobile,
|
|
42
|
-
ColPC,
|
|
43
|
-
percentageVisible,
|
|
44
|
-
iconWidthSize,
|
|
45
|
-
iconHeightSize,
|
|
46
|
-
titleVisible,
|
|
47
|
-
desVisible,
|
|
48
|
-
buttonVisible,
|
|
49
|
-
textAlign,
|
|
50
|
-
className,
|
|
51
|
-
titleColor,
|
|
52
|
-
titleFontWeight,
|
|
53
|
-
titleFontSize,
|
|
54
|
-
titleLineHeight,
|
|
55
|
-
titleMaxLines,
|
|
56
|
-
desColor,
|
|
57
|
-
desFontWeight,
|
|
58
|
-
desFontSize,
|
|
59
|
-
desLineHeight,
|
|
60
|
-
desMaxLines,
|
|
61
|
-
buttonText,
|
|
62
|
-
style,
|
|
63
|
-
}: IGraphicCardPropsType) {
|
|
64
|
-
const platform = usePlatform();
|
|
65
|
-
const isH5: boolean = platform === 'h5';
|
|
66
|
-
// 一个栅格的宽度
|
|
67
|
-
const [SingleGrid, setSingleGrid] = useState({ width: 10 });
|
|
68
|
-
const [colCount, setColCount] = React.useState(2);
|
|
69
|
-
const cls = classNames({
|
|
70
|
-
[CLASS_PREFIX]: true,
|
|
71
|
-
[className]: className,
|
|
72
|
-
[`${CLASS_PREFIX}-mobile`]: isH5,
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
const cardList = React.useMemo(() => {
|
|
76
|
-
let list = [];
|
|
77
|
-
const col = isH5 ? ColMobile : ColPC;
|
|
78
|
-
setColCount(col);
|
|
79
|
-
list.length = Math.floor(navOption.length / colCount);
|
|
80
|
-
list.forEach((item, index) => {
|
|
81
|
-
list[index] = [];
|
|
82
|
-
});
|
|
83
|
-
//debugger;
|
|
84
|
-
navOption.forEach((item, index) => {
|
|
85
|
-
const _index = Math.floor(index / colCount);
|
|
86
|
-
if (!list[_index] || list[_index].length <= 0) {
|
|
87
|
-
// 保证每个col 的数据都是有的,列入总共7个数据,那么第二行的3, 4,5数据是undefined, 占位
|
|
88
|
-
list[_index] = Array.apply(null, Array(colCount));
|
|
89
|
-
}
|
|
90
|
-
const paramObj = {};
|
|
91
|
-
if (item?.params) {
|
|
92
|
-
for (let info of item.params) {
|
|
93
|
-
paramObj[info.key] = info.value;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
item.paramObj = paramObj;
|
|
97
|
-
list[_index][index - _index * colCount] = item;
|
|
98
|
-
list[_index][index - _index * colCount] = item;
|
|
99
|
-
});
|
|
100
|
-
return list;
|
|
101
|
-
}, [colCount, navOption, isH5]);
|
|
102
|
-
const elementStyle = document.createElement('body').style;
|
|
103
|
-
let vendor = (() => {
|
|
104
|
-
let transformNames = {
|
|
105
|
-
webkit: 'webkitTransform',
|
|
106
|
-
Moz: 'MozTransform',
|
|
107
|
-
O: 'OTransform',
|
|
108
|
-
ms: 'msTransform',
|
|
109
|
-
standard: 'transform',
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
for (let key in transformNames) {
|
|
113
|
-
if (elementStyle[transformNames[key]] !== undefined) {
|
|
114
|
-
return key;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return false;
|
|
119
|
-
})();
|
|
120
|
-
function prefixStyle(style) {
|
|
121
|
-
if (vendor === false) {
|
|
122
|
-
return false;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (vendor === 'standard') {
|
|
126
|
-
return style;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return '-' + vendor + style.charAt(0).toUpperCase() + style.substr(1);
|
|
130
|
-
}
|
|
131
|
-
const boxStyle = prefixStyle('-box');
|
|
132
|
-
//标题样式
|
|
133
|
-
const titleStyle = {
|
|
134
|
-
display: `${boxStyle}`,
|
|
135
|
-
WebkitLineClamp: `${titleMaxLines ? titleMaxLines : 'inherit'}`,
|
|
136
|
-
overflow: 'hidden',
|
|
137
|
-
color: `${titleColor}`,
|
|
138
|
-
fontWeight: `${titleFontWeight}`,
|
|
139
|
-
fontSize: `${titleFontSize}` + 'px',
|
|
140
|
-
textAlign: `${textAlign}`,
|
|
141
|
-
lineHeight: `${titleLineHeight == 'auto' ? 'normal' : titleLineHeight}`,
|
|
142
|
-
} as React.CSSProperties;
|
|
143
|
-
const desStyle = {
|
|
144
|
-
display: `${boxStyle}`,
|
|
145
|
-
WebkitLineClamp: `${desMaxLines ? desMaxLines : 'inherit'}`,
|
|
146
|
-
overflow: 'hidden',
|
|
147
|
-
color: `${desColor}`,
|
|
148
|
-
fontWeight: `${desFontWeight}`,
|
|
149
|
-
fontSize: `${desFontSize}` + 'px',
|
|
150
|
-
textAlign: `${textAlign}`,
|
|
151
|
-
lineHeight: `${desLineHeight == 'auto' ? 'normal' : desLineHeight}`,
|
|
152
|
-
} as React.CSSProperties;
|
|
153
|
-
|
|
154
|
-
// 图片高度: 100% 基础下 H5: 1列 200px;2列 98px PC: 3列 220px 4列 162px
|
|
155
|
-
const imageStyle = React.useMemo(() => {
|
|
156
|
-
let width = '100%';
|
|
157
|
-
let height = platform === 'h5' ? '200' : '220';
|
|
158
|
-
if (platform === 'h5' && ColMobile === 2) {
|
|
159
|
-
height = '98';
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (platform !== 'h5' && ColPC === 4) {
|
|
163
|
-
height = '162';
|
|
164
|
-
}
|
|
165
|
-
const numReg = /^\d+$/;
|
|
166
|
-
width = numReg.test(iconWidthSize) ? iconWidthSize + 'px' : iconWidthSize;
|
|
167
|
-
height = numReg.test(iconHeightSize)
|
|
168
|
-
? iconHeightSize + 'px' //纯数字
|
|
169
|
-
: iconHeightSize.indexOf('%') == -1
|
|
170
|
-
? iconHeightSize
|
|
171
|
-
: (Number(height) * parseInt(iconHeightSize)) / 100 + 'px';
|
|
172
|
-
return { width, height };
|
|
173
|
-
}, [iconWidthSize, iconHeightSize, ColMobile, ColPC, isH5]);
|
|
174
|
-
|
|
175
|
-
const detailStyle = React.useMemo(() => {
|
|
176
|
-
let docWidth = (document.documentElement.clientWidth - 24 * 2) / 12;
|
|
177
|
-
setSingleGrid({ width: docWidth });
|
|
178
|
-
if (textAlign == 'left') {
|
|
179
|
-
return {
|
|
180
|
-
paddingRight: `${docWidth * 0.5 - docWidth * 0.1}px`,
|
|
181
|
-
paddingLeft: 0,
|
|
182
|
-
};
|
|
183
|
-
} else if (textAlign == 'right') {
|
|
184
|
-
return {
|
|
185
|
-
paddingLeft: `${docWidth * 0.5 - docWidth * 0.1}px`,
|
|
186
|
-
paddingRight: 0,
|
|
187
|
-
};
|
|
188
|
-
} else {
|
|
189
|
-
return {
|
|
190
|
-
paddingLeft: `${(docWidth * 0.5 - docWidth * 0.1) / 2}px`,
|
|
191
|
-
paddingRight: `${(docWidth * 0.5 - docWidth * 0.1) / 2}px`,
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
}, [textAlign, isH5]);
|
|
195
|
-
|
|
196
|
-
const tapTo = (colInfo = navOption[0]) => {
|
|
197
|
-
switch (colInfo?.tapStatus) {
|
|
198
|
-
case 'tap':
|
|
199
|
-
return null;
|
|
200
|
-
case 'inside':
|
|
201
|
-
if (colInfo.insideUrl) {
|
|
202
|
-
app.navigateTo({
|
|
203
|
-
mode: 'weDa',
|
|
204
|
-
pageId: colInfo.insideUrl,
|
|
205
|
-
params:
|
|
206
|
-
colInfo?.withParams && colInfo?.params.length > 0
|
|
207
|
-
? colInfo.paramObj
|
|
208
|
-
: null,
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
break;
|
|
212
|
-
//return renderCancel();
|
|
213
|
-
case 'outer':
|
|
214
|
-
if (colInfo.newPage) {
|
|
215
|
-
colInfo.outerUrl ? window.open(colInfo.outerUrl) : false;
|
|
216
|
-
} else {
|
|
217
|
-
colInfo.outerUrl ? (window.location.href = colInfo.outerUrl) : false;
|
|
218
|
-
}
|
|
219
|
-
break;
|
|
220
|
-
default:
|
|
221
|
-
return null;
|
|
222
|
-
}
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
return (
|
|
226
|
-
<ConfigProvider classPrefix="wedatea2td">
|
|
227
|
-
<div className={cls} data-testid="graphicCard" style={style}>
|
|
228
|
-
<div className={`${CLASS_PREFIX}__wrapper`}>
|
|
229
|
-
{cardList.map((row, rowIndex) => {
|
|
230
|
-
return (
|
|
231
|
-
<Row className={`${CLASS_PREFIX}__row`} key={rowIndex}>
|
|
232
|
-
<>
|
|
233
|
-
{row &&
|
|
234
|
-
row.map((col, colIndex) => {
|
|
235
|
-
return (
|
|
236
|
-
// 每列内容左右间距为0.1栅格列宽
|
|
237
|
-
<Col
|
|
238
|
-
style={{
|
|
239
|
-
width: `${(1 / colCount) * 100}%`,
|
|
240
|
-
padding: `0 ${SingleGrid.width * 0.1}px`,
|
|
241
|
-
cursor:
|
|
242
|
-
col?.tapStatus != 'tap' ? 'pointer' : 'auto',
|
|
243
|
-
}}
|
|
244
|
-
className={`${CLASS_PREFIX}__col ${CLASS_PREFIX}__col--${textAlign}`}
|
|
245
|
-
key={colIndex}
|
|
246
|
-
>
|
|
247
|
-
<div
|
|
248
|
-
className="wedatea2td-grid__box"
|
|
249
|
-
data-testid={`${colIndex}_click`}
|
|
250
|
-
onClick={() => tapTo(col)}
|
|
251
|
-
>
|
|
252
|
-
<div className={`${CLASS_PREFIX}__col-body`}>
|
|
253
|
-
{col && (
|
|
254
|
-
<div
|
|
255
|
-
className={`${CLASS_PREFIX}__icon`}
|
|
256
|
-
style={imageStyle}
|
|
257
|
-
>
|
|
258
|
-
<img
|
|
259
|
-
src={col?.icon}
|
|
260
|
-
className={`${CLASS_PREFIX}__img`}
|
|
261
|
-
/>
|
|
262
|
-
</div>
|
|
263
|
-
)}
|
|
264
|
-
{/* 详情右侧间距为0.5栅格列宽 */}
|
|
265
|
-
<div className={`${CLASS_PREFIX}__detail`}>
|
|
266
|
-
{titleVisible && col?.title && (
|
|
267
|
-
<div
|
|
268
|
-
className={`${CLASS_PREFIX}__title`}
|
|
269
|
-
style={titleStyle}
|
|
270
|
-
>
|
|
271
|
-
{col?.title}
|
|
272
|
-
</div>
|
|
273
|
-
)}
|
|
274
|
-
{desVisible && col?.des && (
|
|
275
|
-
<div
|
|
276
|
-
className={`${CLASS_PREFIX}__desc`}
|
|
277
|
-
style={desStyle}
|
|
278
|
-
>
|
|
279
|
-
{col?.des}
|
|
280
|
-
</div>
|
|
281
|
-
)}
|
|
282
|
-
</div>
|
|
283
|
-
</div>
|
|
284
|
-
{buttonVisible && col && (
|
|
285
|
-
<Button
|
|
286
|
-
type="link"
|
|
287
|
-
className={`${CLASS_PREFIX}__btn`}
|
|
288
|
-
>
|
|
289
|
-
<Text className={`${CLASS_PREFIX}__btn--text`}>
|
|
290
|
-
{buttonText}
|
|
291
|
-
</Text>
|
|
292
|
-
<IconFont
|
|
293
|
-
name="arrow-right"
|
|
294
|
-
className={`${CLASS_PREFIX}__btn-icon`}
|
|
295
|
-
/>
|
|
296
|
-
</Button>
|
|
297
|
-
)}
|
|
298
|
-
</div>
|
|
299
|
-
</Col>
|
|
300
|
-
);
|
|
301
|
-
})}
|
|
302
|
-
</>
|
|
303
|
-
</Row>
|
|
304
|
-
);
|
|
305
|
-
})}
|
|
306
|
-
</div>
|
|
307
|
-
</div>
|
|
308
|
-
</ConfigProvider>
|
|
309
|
-
);
|
|
310
|
-
}
|
|
@@ -1,187 +0,0 @@
|
|
|
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
|
-
import { PropsType } from './index';
|
|
6
|
-
interface ImageInnerPropsType extends Omit<PropsType, 'fit' | 'mode'> {
|
|
7
|
-
objectFit: React.CSSProperties['objectFit'];
|
|
8
|
-
isError: boolean;
|
|
9
|
-
setIsError: React.Dispatch<React.SetStateAction<boolean>>;
|
|
10
|
-
}
|
|
11
|
-
export function ImageInner({
|
|
12
|
-
objectFit,
|
|
13
|
-
style,
|
|
14
|
-
className,
|
|
15
|
-
alt,
|
|
16
|
-
src,
|
|
17
|
-
isError,
|
|
18
|
-
setIsError,
|
|
19
|
-
events,
|
|
20
|
-
lazyLoad,
|
|
21
|
-
maskClosable,
|
|
22
|
-
imgPreview,
|
|
23
|
-
}: ImageInnerPropsType) {
|
|
24
|
-
const platform = usePlatform();
|
|
25
|
-
const [imgShow, setImgShow] = React.useState(false);
|
|
26
|
-
const onMaskClick = () => {
|
|
27
|
-
if (maskClosable) {
|
|
28
|
-
setImgShow(false);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const [showHeight, setShowHeight] = React.useState(0);
|
|
33
|
-
const realWidth = React.useRef(0);
|
|
34
|
-
const realHeight = React.useRef(0);
|
|
35
|
-
const [offsetHeight, setOffsetHeight] = React.useState(0);
|
|
36
|
-
const [translateX, setTranslateX] = React.useState(0);
|
|
37
|
-
const [translateY, setTranslateY] = React.useState(0);
|
|
38
|
-
const [previewScale, setPreviewScale] = React.useState(1);
|
|
39
|
-
React.useEffect(() => {
|
|
40
|
-
// 防止触发浏览器的放大缩小
|
|
41
|
-
const handler = (e) => e.preventDefault();
|
|
42
|
-
document.addEventListener('gesturestart', handler);
|
|
43
|
-
document.addEventListener('gesturechange', handler);
|
|
44
|
-
return () => {
|
|
45
|
-
document.removeEventListener('gesturestart', handler);
|
|
46
|
-
document.removeEventListener('gesturechange', handler);
|
|
47
|
-
};
|
|
48
|
-
}, []);
|
|
49
|
-
|
|
50
|
-
const bind = useGesture(
|
|
51
|
-
{
|
|
52
|
-
onClick: ({ event }) => {
|
|
53
|
-
// 防止冒泡出发关闭预览
|
|
54
|
-
event.stopPropagation();
|
|
55
|
-
},
|
|
56
|
-
onPinch: ({ offset }) => {
|
|
57
|
-
const [s] = offset;
|
|
58
|
-
setPreviewScale(s);
|
|
59
|
-
},
|
|
60
|
-
onDrag: ({ offset, event }) => {
|
|
61
|
-
event.stopPropagation();
|
|
62
|
-
const [x, y] = offset;
|
|
63
|
-
setTranslateX(x);
|
|
64
|
-
setTranslateY(y);
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
drag: {
|
|
69
|
-
delay: true,
|
|
70
|
-
preventDefault: true,
|
|
71
|
-
},
|
|
72
|
-
pinch: {
|
|
73
|
-
scaleBounds: { min: 0.6, max: 5 },
|
|
74
|
-
pointer: {
|
|
75
|
-
touch: true,
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
}
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
if (platform === 'h5' || !imgPreview || isError) {
|
|
82
|
-
return (
|
|
83
|
-
<>
|
|
84
|
-
<img
|
|
85
|
-
style={{
|
|
86
|
-
objectFit,
|
|
87
|
-
...style,
|
|
88
|
-
}}
|
|
89
|
-
className={className}
|
|
90
|
-
alt={alt}
|
|
91
|
-
src={src}
|
|
92
|
-
onLoad={(e) => {
|
|
93
|
-
const img = e.target as HTMLImageElement;
|
|
94
|
-
const { naturalHeight, naturalWidth } = img;
|
|
95
|
-
realHeight.current = naturalHeight;
|
|
96
|
-
realWidth.current = naturalWidth;
|
|
97
|
-
setIsError(false);
|
|
98
|
-
events.load && events.load({}, { originEvent: e });
|
|
99
|
-
}}
|
|
100
|
-
onError={(e) => {
|
|
101
|
-
setIsError(true);
|
|
102
|
-
events.error && events.error({}, { originEvent: e });
|
|
103
|
-
}}
|
|
104
|
-
onClick={(e) => {
|
|
105
|
-
if (imgPreview && !isError) {
|
|
106
|
-
setTranslateX(0);
|
|
107
|
-
setTranslateY(0);
|
|
108
|
-
setPreviewScale(1);
|
|
109
|
-
const windowHeight = window.innerHeight;
|
|
110
|
-
const windowWidth = window.innerWidth;
|
|
111
|
-
let ratio = realWidth.current / realHeight.current;
|
|
112
|
-
if (Number.isNaN(ratio)) {
|
|
113
|
-
ratio = 1;
|
|
114
|
-
}
|
|
115
|
-
const height = windowWidth / ratio;
|
|
116
|
-
setOffsetHeight(windowHeight / 2 - height / 2);
|
|
117
|
-
setShowHeight(height);
|
|
118
|
-
setImgShow(true);
|
|
119
|
-
}
|
|
120
|
-
events.tap && events.tap({}, { originEvent: e });
|
|
121
|
-
}}
|
|
122
|
-
loading={lazyLoad ? 'lazy' : undefined}
|
|
123
|
-
/>
|
|
124
|
-
{imgShow && (
|
|
125
|
-
<div className="weda-img-mask" onClick={onMaskClick}>
|
|
126
|
-
<div
|
|
127
|
-
onClick={() => setImgShow(false)}
|
|
128
|
-
className="weda-img-modal-close-btn"
|
|
129
|
-
>
|
|
130
|
-
<i className="weui-icon-clear" style={{ color: 'white' }}></i>
|
|
131
|
-
</div>
|
|
132
|
-
<div
|
|
133
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
134
|
-
{...bind()}
|
|
135
|
-
className="weda-img-preview"
|
|
136
|
-
style={{
|
|
137
|
-
touchAction: 'none',
|
|
138
|
-
backgroundImage: `url(${src})`,
|
|
139
|
-
width: '100%',
|
|
140
|
-
height: showHeight,
|
|
141
|
-
marginTop: offsetHeight,
|
|
142
|
-
transform: `translate(${translateX}px, ${translateY}px) scale(${previewScale})`,
|
|
143
|
-
}}
|
|
144
|
-
></div>
|
|
145
|
-
</div>
|
|
146
|
-
)}
|
|
147
|
-
</>
|
|
148
|
-
);
|
|
149
|
-
} else {
|
|
150
|
-
return (
|
|
151
|
-
<ConfigProvider classPrefix="wedatea2td">
|
|
152
|
-
<ImagePreview
|
|
153
|
-
previewSrc={src}
|
|
154
|
-
maskClosable={maskClosable}
|
|
155
|
-
className={className}
|
|
156
|
-
style={{ ...style, objectFit }}
|
|
157
|
-
>
|
|
158
|
-
{(open) => (
|
|
159
|
-
<img
|
|
160
|
-
style={{
|
|
161
|
-
objectFit,
|
|
162
|
-
cursor: 'zoom-in',
|
|
163
|
-
...style,
|
|
164
|
-
}}
|
|
165
|
-
className={className}
|
|
166
|
-
alt={alt}
|
|
167
|
-
src={src}
|
|
168
|
-
onLoad={(e) => {
|
|
169
|
-
setIsError(false);
|
|
170
|
-
events.load && events.load({}, { originEvent: e });
|
|
171
|
-
}}
|
|
172
|
-
onError={(e) => {
|
|
173
|
-
setIsError(true);
|
|
174
|
-
events.error && events.error({}, { originEvent: e });
|
|
175
|
-
}}
|
|
176
|
-
loading={lazyLoad ? 'lazy' : undefined}
|
|
177
|
-
onClick={(e) => {
|
|
178
|
-
open();
|
|
179
|
-
events.tap && events.tap({}, { originEvent: e });
|
|
180
|
-
}}
|
|
181
|
-
/>
|
|
182
|
-
)}
|
|
183
|
-
</ImagePreview>
|
|
184
|
-
</ConfigProvider>
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
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: 16px;
|
|
32
|
-
right: 16px;
|
|
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
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useState, useEffect } from 'react';
|
|
3
|
-
|
|
4
|
-
import classNames from '../../utils/classnames';
|
|
5
|
-
import './index.css';
|
|
6
|
-
import { ImageInner } from './image';
|
|
7
|
-
import type { CommonPropsType } from '../../types';
|
|
8
|
-
|
|
9
|
-
const defaultSrc =
|
|
10
|
-
'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48Y2lyY2xlIGN4PSI0MCIgY3k9IjQwIiByPSI0MCIgZmlsbD0iI0VCRUZGNSIvPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0yMCA1NlYyNGg0MHYzMnoiLz48cGF0aCBmaWxsPSIjQzFDQ0REIiBkPSJNMjYgMzdoMjh2MkgyNnptMCA3aDIwdjJIMjZ6bS02LTIwaDQwdjdIMjB6Ii8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNDggNDQpIj48Y2lyY2xlIGZpbGw9IiNGRkYiIGN4PSIxMCIgY3k9IjEwIiByPSI3Ii8+PHBhdGggZD0iTTEwIDJhOCA4IDAgMSAxIDAgMTYgOCA4IDAgMCAxIDAtMTZ6bTEgMTBIOXYyaDJ2LTJ6bTAtNkg5djVoMlY2eiIgZmlsbD0iIzAwNkVGRiIvPjwvZz48L2c+PC9zdmc+';
|
|
11
|
-
type TMode =
|
|
12
|
-
| 'scaleToFill'
|
|
13
|
-
| 'aspectFit'
|
|
14
|
-
| 'aspectFill'
|
|
15
|
-
| 'widthFix'
|
|
16
|
-
| 'heightFix'
|
|
17
|
-
| 'top'
|
|
18
|
-
| 'bottom'
|
|
19
|
-
| 'center'
|
|
20
|
-
| 'left'
|
|
21
|
-
| 'right'
|
|
22
|
-
| 'top left'
|
|
23
|
-
| 'top right'
|
|
24
|
-
| 'bottom left'
|
|
25
|
-
| 'bottom right';
|
|
26
|
-
export interface PropsType
|
|
27
|
-
extends CommonPropsType,
|
|
28
|
-
Pick<HTMLImageElement, 'src' | 'alt'> {
|
|
29
|
-
mode: TMode;
|
|
30
|
-
lazyLoad: boolean;
|
|
31
|
-
maskClosable: boolean;
|
|
32
|
-
imgPreview: boolean;
|
|
33
|
-
fit: React.CSSProperties['objectFit'];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export default function Image({
|
|
37
|
-
// 系统属性
|
|
38
|
-
className,
|
|
39
|
-
events = {},
|
|
40
|
-
style = {},
|
|
41
|
-
// 组件属性
|
|
42
|
-
src,
|
|
43
|
-
alt,
|
|
44
|
-
mode,
|
|
45
|
-
lazyLoad,
|
|
46
|
-
imgPreview,
|
|
47
|
-
maskClosable,
|
|
48
|
-
fit,
|
|
49
|
-
}: PropsType) {
|
|
50
|
-
const [isError, setIsError] = useState(false);
|
|
51
|
-
const cls = classNames({
|
|
52
|
-
'weda-ui': true,
|
|
53
|
-
'weda-image': true,
|
|
54
|
-
'weda-image-error': isError,
|
|
55
|
-
[className]: className,
|
|
56
|
-
});
|
|
57
|
-
const objectFit = fit || getObjectFitByWxImageMode(mode);
|
|
58
|
-
const [realSrc, setRealSrc] = useState(
|
|
59
|
-
/^cloud:\/\//.test(src) ? undefined : src
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
useEffect(() => {
|
|
63
|
-
if (/^cloud:\/\//.test(src)) {
|
|
64
|
-
window.app.cloud
|
|
65
|
-
.getTempFileURL(src)
|
|
66
|
-
.then((res) => {
|
|
67
|
-
setRealSrc(res || '');
|
|
68
|
-
})
|
|
69
|
-
.catch(() => {
|
|
70
|
-
setRealSrc('');
|
|
71
|
-
});
|
|
72
|
-
} else {
|
|
73
|
-
setRealSrc(src);
|
|
74
|
-
}
|
|
75
|
-
}, [src]);
|
|
76
|
-
|
|
77
|
-
return src === realSrc || (realSrc !== undefined && src !== realSrc) ? (
|
|
78
|
-
<ImageInner
|
|
79
|
-
objectFit={objectFit}
|
|
80
|
-
style={style}
|
|
81
|
-
className={cls}
|
|
82
|
-
alt={alt}
|
|
83
|
-
src={realSrc}
|
|
84
|
-
isError={isError}
|
|
85
|
-
setIsError={setIsError}
|
|
86
|
-
events={events}
|
|
87
|
-
lazyLoad={lazyLoad}
|
|
88
|
-
imgPreview={imgPreview}
|
|
89
|
-
maskClosable={maskClosable}
|
|
90
|
-
/>
|
|
91
|
-
) : null;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function getObjectFitByWxImageMode(
|
|
95
|
-
mode: TMode
|
|
96
|
-
): React.CSSProperties['objectFit'] {
|
|
97
|
-
const array = [
|
|
98
|
-
{
|
|
99
|
-
mode: 'scaleToFill',
|
|
100
|
-
h5: 'fill',
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
mode: 'aspectFit',
|
|
104
|
-
h5: 'contain',
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
mode: 'aspectFill',
|
|
108
|
-
h5: 'cover',
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
mode: 'widthFix',
|
|
112
|
-
h5: 'cover',
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
mode: 'heightFix',
|
|
116
|
-
h5: 'contain',
|
|
117
|
-
},
|
|
118
|
-
] as const;
|
|
119
|
-
const item = array.find((item) => item.mode === mode);
|
|
120
|
-
return item?.h5;
|
|
121
|
-
}
|