@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,90 +0,0 @@
|
|
|
1
|
-
import dayjs from 'dayjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 获取一个日期是周几(1~7)
|
|
5
|
-
*/
|
|
6
|
-
export const getDay = (dt) => {
|
|
7
|
-
let day = dayjs(dt).day();
|
|
8
|
-
if (day === 0) {
|
|
9
|
-
day = 7;
|
|
10
|
-
}
|
|
11
|
-
return day;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 创建日历单元格数据
|
|
16
|
-
* @param year 日历年份
|
|
17
|
-
* @param month 日历月份
|
|
18
|
-
* @param firstDayOfWeek 周起始日(1~7)
|
|
19
|
-
* @param currentValue 当前日期
|
|
20
|
-
* @param format 日期格式
|
|
21
|
-
*/
|
|
22
|
-
export const createDateList = (
|
|
23
|
-
year,
|
|
24
|
-
month,
|
|
25
|
-
firstDayOfWeek,
|
|
26
|
-
currentValue,
|
|
27
|
-
format
|
|
28
|
-
) => {
|
|
29
|
-
const createCellData = (belongTo, isCurrent, date, weekOrder) => {
|
|
30
|
-
const day = getDay(date);
|
|
31
|
-
return {
|
|
32
|
-
mode: 'month',
|
|
33
|
-
belongTo,
|
|
34
|
-
isCurrent,
|
|
35
|
-
day,
|
|
36
|
-
weekOrder,
|
|
37
|
-
date,
|
|
38
|
-
formattedDate: dayjs(date).format(format),
|
|
39
|
-
filterDate: null,
|
|
40
|
-
formattedFilterDate: null,
|
|
41
|
-
isShowWeekend: true,
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const monthFirstDay = dayjs(`${year}-${month}`);
|
|
46
|
-
const rowList = [];
|
|
47
|
-
let list = [];
|
|
48
|
-
let weekCount = 1;
|
|
49
|
-
|
|
50
|
-
// 添加上个月中会在本月显示的最后几天日期
|
|
51
|
-
// getDay(monthFirstDay.toDate()) 获取每月第一天是周几
|
|
52
|
-
const lastMonthDaysCount =
|
|
53
|
-
(getDay(monthFirstDay.toDate()) - firstDayOfWeek + 7) % 7;
|
|
54
|
-
for (let i = 0; i < lastMonthDaysCount; i++) {
|
|
55
|
-
// 获取显示在当前月的日历中,上月日期数据
|
|
56
|
-
// monthFirstDay.subtract(num, 'day' | 'month' | 'year') 表示以当月第一天日期为基准,在 日|月|年 数字上减去num
|
|
57
|
-
const dayObj = monthFirstDay.subtract(i + 1, 'day');
|
|
58
|
-
list.unshift(createCellData(-1, false, dayObj.toDate(), weekCount));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// 添加本月日期
|
|
62
|
-
// 获取本月最后一天是几号
|
|
63
|
-
const monthDaysCount = monthFirstDay.endOf('month').daysInMonth();
|
|
64
|
-
for (let i = 0; i < monthDaysCount; i++) {
|
|
65
|
-
const dayObj = monthFirstDay.add(i, 'day');
|
|
66
|
-
list.push(
|
|
67
|
-
createCellData(0, currentValue.isSame(dayObj), dayObj.toDate(), weekCount)
|
|
68
|
-
);
|
|
69
|
-
if (list.length === 7) {
|
|
70
|
-
rowList.push(list);
|
|
71
|
-
list = [];
|
|
72
|
-
weekCount += 1;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// 添加下月日期
|
|
77
|
-
if (list.length) {
|
|
78
|
-
// 获取当月最后一天
|
|
79
|
-
const monthLastDay = dayjs(`${year}-${month}`).endOf('month');
|
|
80
|
-
// 获取下月在当月日历中的天数
|
|
81
|
-
const nextMonthDaysCount = 7 - list.length;
|
|
82
|
-
for (let i = 0; i < nextMonthDaysCount; i++) {
|
|
83
|
-
const dayObj = monthLastDay.add(i + 1, 'day');
|
|
84
|
-
list.push(createCellData(1, false, dayObj.toDate(), weekCount));
|
|
85
|
-
}
|
|
86
|
-
rowList.push(list);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return rowList;
|
|
90
|
-
};
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
.g-swiper {
|
|
2
|
-
overflow: hidden;
|
|
3
|
-
margin: auto;
|
|
4
|
-
width: 100%;
|
|
5
|
-
transition: height 0.15s ease-in;
|
|
6
|
-
position: relative;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.g-carousel {
|
|
10
|
-
height: 320px;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.g-swiper-list {
|
|
14
|
-
margin: 0;
|
|
15
|
-
padding: 0;
|
|
16
|
-
width: 100%;
|
|
17
|
-
height: 100%;
|
|
18
|
-
display: flex;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.g-swiper-item {
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
flex-flow: column;
|
|
24
|
-
min-width: 100%;
|
|
25
|
-
max-height: 100%;
|
|
26
|
-
margin: 0;
|
|
27
|
-
text-align: center;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.g-swiper.vertical {
|
|
31
|
-
display: flex;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.g-swiper.vertical .g-swiper-list {
|
|
35
|
-
display: block;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.g-swiper.vertical .g-swiper-item {
|
|
39
|
-
height: 100%;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.g-swiper-item > div > * {
|
|
43
|
-
width: 100%;
|
|
44
|
-
height: auto;
|
|
45
|
-
max-width: 100%;
|
|
46
|
-
max-height: 100%;
|
|
47
|
-
object-fit: cover;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/* .g-swiper-item > div,
|
|
51
|
-
.g-swiper-item > div > .weda-image {
|
|
52
|
-
width: 100%;
|
|
53
|
-
height: 100%;
|
|
54
|
-
max-width: 100%;
|
|
55
|
-
max-height: 100%;
|
|
56
|
-
} */
|
|
57
|
-
|
|
58
|
-
.g-swiper__pagination {
|
|
59
|
-
position: absolute;
|
|
60
|
-
bottom: 0;
|
|
61
|
-
margin: 10px 0;
|
|
62
|
-
padding: 0;
|
|
63
|
-
text-align: center;
|
|
64
|
-
width: 100%;
|
|
65
|
-
z-index: 1;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.g-swiper__pagination-bulletm {
|
|
69
|
-
background: #fff;
|
|
70
|
-
border-radius: 50%;
|
|
71
|
-
box-shadow: 1px 1px 2px rgb(0 0 0 / 70%);
|
|
72
|
-
width: 8px;
|
|
73
|
-
height: 8px;
|
|
74
|
-
display: inline-block;
|
|
75
|
-
margin: 0 8px;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
@media (max-width: 1024px) {
|
|
79
|
-
.g-swiper .g-swiper__turn-pre,
|
|
80
|
-
.g-swiper .g-swiper__turn-next {
|
|
81
|
-
display: none;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.g-swiper__turn-pre,
|
|
86
|
-
.g-swiper__turn-next {
|
|
87
|
-
position: absolute;
|
|
88
|
-
box-sizing: content-box;
|
|
89
|
-
display: block;
|
|
90
|
-
top: 50%;
|
|
91
|
-
transform: translate3d(0, -50%, 0);
|
|
92
|
-
font-size: 0;
|
|
93
|
-
background-color: rgba(0, 0, 0, 0.2);
|
|
94
|
-
padding: 20px 10px;
|
|
95
|
-
width: 23px;
|
|
96
|
-
height: 41px;
|
|
97
|
-
background-position: center;
|
|
98
|
-
background-repeat: no-repeat;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.g-swiper__turn-pre {
|
|
102
|
-
left: 20px;
|
|
103
|
-
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAApCAYAAADeWrJ9AAAABGdBTUEAALGPC/xhBQAAAbpJREFUSA2t178rxHEcx/E7p/MrP9KRRbFcMZHBIBkMSjYyKEpXJIMkww3KcIOkxKAsBmWQDEQSgyRJUkKZFANJRBLy4+v51udT/oDXp569660e32933X1PKCQ8QRCEaZa6hWwo5OAZpp05GQ5mdzxtKmeBIkp88o8NgkU1POHgJTU85uBlZlT5UqQcvKKGRx28roZHHLzBzFC+FEkHbzKzlPCwg7eZ2Up40ME7angA8Id2KUd5x/0O3mPmKuFeB+8z85VwwsGHargb8JuOqEB5x12AX3RMhUq4w8EnzJgSbnfwKbNICbcBftI5FctgoDRqpXSyR5PuiwjMHqxRWiU7l1Rme9kBtAv00AddUVyGewi0md7ohir8XjZBG+mV7qhKBnsItJ6e6YFq/F42QWvpkZ6oTgZ7CLSa7umFGvxeNkEr6ZbsfWiSwR4CjdM1vVOL38smaDnZh8w+C20y2EOgpXRB9rXc4feyCVpCZ+4CCRnsIeAY2QPFfhX0+b1sghbQgbvAkAz2EHAe2e8ZO0m/l03QbNoynZOSwR4CzaQ10znjFPZ/k0xAeybYfxh2piTofwQ0QvPUaftfzME87zp8MlQAAAAASUVORK5CYII=);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.g-swiper__turn-next {
|
|
107
|
-
right: 20px;
|
|
108
|
-
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAApCAYAAADeWrJ9AAAABGdBTUEAALGPC/xhBQAAAZpJREFUSA21l7ErhHEYgO9cznUR6ZTBcAvFRMpCGQxKxstwJV1XlJQkyw0y3CJJLDJYZJEMSCKDJEmSQpkUA0lEEko+z3u9/oP3fevp1y3P87uv7/t+d6EQEwRBBhYgLJ9NB+kiyMyDbQBhBJZBZg5cAisFfRDMmF4akSGWb7CqgWmPQDHyNQ1MegSiyNc1kPcKbGlgwiuwrYFxj0AM+Y4Gch6BOPI9DYx5BfY1MOIVONDAsEegFPkh/MKQR6Ac8ZEGBrwCJxrIegVONZDxCFQiP4Mf6PMIJBCfayDtEahCfqGBHq/AlQZSRcaFEnwRJWXmZrdJuAGZDYiayBHVwi18Qz+YieuR3cMndJnsViTIGuERPqDDUtyM8BneoM1S3IrwFV6gxVLcjvAdnqDJUtyJUK7vAzRYirsRfsEd1FmKUwjlHpaHJGkpTiOU1+k11FiKsyq+ZK22FA8ilENYDoKEpXhUxcesFZbiHEIZ+X1SZinOF7RBsMsaNxEjCsOUijdZYyZikSCbVbH8o7B5F//vDmEvLIEcUWbzB99VPOowvSXGAAAAAElFTkSuQmCC);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.g-swiper__turn-pre:hover,
|
|
112
|
-
.g-swiper__turn-next:hover {
|
|
113
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
._editor-iframe
|
|
117
|
-
._wa-comp-container-empty-children:not(._wa-comp-slot-wrapper):after {
|
|
118
|
-
display: none;
|
|
119
|
-
}
|
|
@@ -1,417 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useState, useEffect, useRef } from 'react';
|
|
3
|
-
import classNames from '../../utils/classnames';
|
|
4
|
-
import Swipe from 'react-easy-swipe';
|
|
5
|
-
import {
|
|
6
|
-
useDebouncedCallback,
|
|
7
|
-
useEventListener,
|
|
8
|
-
useResizeObserver,
|
|
9
|
-
} from '@react-hookz/web';
|
|
10
|
-
|
|
11
|
-
import './index.css';
|
|
12
|
-
import type { CommonPropsType } from '../../types';
|
|
13
|
-
|
|
14
|
-
import Image from '../image';
|
|
15
|
-
interface imagesItem {
|
|
16
|
-
image: string;
|
|
17
|
-
title: string;
|
|
18
|
-
tapMode: 'tap' | 'inside' | 'outer';
|
|
19
|
-
fit: React.CSSProperties['objectFit'];
|
|
20
|
-
height: string;
|
|
21
|
-
width: string;
|
|
22
|
-
insideUrl?: string;
|
|
23
|
-
outerUrl?: string;
|
|
24
|
-
newPage?: boolean;
|
|
25
|
-
params?: { key: string; value: string }[];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface PropsType extends CommonPropsType {
|
|
29
|
-
/**
|
|
30
|
-
* 是否启用指示点
|
|
31
|
-
*/
|
|
32
|
-
indicatorDots: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* 是否自动切换
|
|
35
|
-
*/
|
|
36
|
-
autoplay: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* 当前索引值
|
|
39
|
-
*/
|
|
40
|
-
current: number;
|
|
41
|
-
interval: number;
|
|
42
|
-
duration: number;
|
|
43
|
-
circular: boolean;
|
|
44
|
-
vertical: boolean;
|
|
45
|
-
indicatorColor: string;
|
|
46
|
-
indicatorActiveColor: string;
|
|
47
|
-
images: Array<imagesItem>;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export default function Carousel({
|
|
51
|
-
className,
|
|
52
|
-
style = {},
|
|
53
|
-
autoplay,
|
|
54
|
-
circular,
|
|
55
|
-
vertical,
|
|
56
|
-
indicatorDots,
|
|
57
|
-
indicatorColor,
|
|
58
|
-
indicatorActiveColor,
|
|
59
|
-
duration,
|
|
60
|
-
interval,
|
|
61
|
-
current,
|
|
62
|
-
events = {},
|
|
63
|
-
id,
|
|
64
|
-
images,
|
|
65
|
-
}: PropsType) {
|
|
66
|
-
const itemCount = images.length;
|
|
67
|
-
current = Math.max(0, Math.min(itemCount - 1, current));
|
|
68
|
-
|
|
69
|
-
const [currentIndex, setCurrentIndex] = useState(current);
|
|
70
|
-
const [swipeStyle, setSwipeStyle] = useState(null);
|
|
71
|
-
const [height, setHeight] = useState(0);
|
|
72
|
-
|
|
73
|
-
const { change = () => {} } = events;
|
|
74
|
-
|
|
75
|
-
// 自动切换
|
|
76
|
-
useEffect(() => {
|
|
77
|
-
if (autoplay) {
|
|
78
|
-
const timer = setInterval(() => {
|
|
79
|
-
setIndex(currentIndex + 1);
|
|
80
|
-
}, interval);
|
|
81
|
-
|
|
82
|
-
return () => clearInterval(timer);
|
|
83
|
-
}
|
|
84
|
-
}, [currentIndex, autoplay]);
|
|
85
|
-
|
|
86
|
-
// 触发切换
|
|
87
|
-
const pre = useRef({ index: currentIndex }).current;
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
updateSwipeStyle(currentIndex, pre.index, itemCount);
|
|
90
|
-
change({
|
|
91
|
-
current: currentIndex,
|
|
92
|
-
});
|
|
93
|
-
return () => {
|
|
94
|
-
pre.index = currentIndex;
|
|
95
|
-
};
|
|
96
|
-
}, [currentIndex, vertical]);
|
|
97
|
-
|
|
98
|
-
const outerWrapRef = useRef<HTMLDivElement>();
|
|
99
|
-
useEventListener(outerWrapRef, 'load', (e) => {
|
|
100
|
-
setHeight(e.target.clientHeight);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
const itemsClone = images.map((x, i) => {
|
|
104
|
-
return (
|
|
105
|
-
<div className="g-swiper-item" data-index={i} key={i}>
|
|
106
|
-
<Image
|
|
107
|
-
mode={'scaleToFill'}
|
|
108
|
-
lazyLoad={false}
|
|
109
|
-
maskClosable={false}
|
|
110
|
-
imgPreview={false}
|
|
111
|
-
src={x.image}
|
|
112
|
-
alt={'图片'}
|
|
113
|
-
fit={x.fit}
|
|
114
|
-
style={{
|
|
115
|
-
height: x.height ? x.height : 'auto',
|
|
116
|
-
width: x.width ? x.width : '100%',
|
|
117
|
-
}}
|
|
118
|
-
/>
|
|
119
|
-
</div>
|
|
120
|
-
);
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
const setIndex = (index) => {
|
|
124
|
-
if (index >= itemCount) {
|
|
125
|
-
index = 0;
|
|
126
|
-
}
|
|
127
|
-
if (index < 0) {
|
|
128
|
-
index = itemCount - 1;
|
|
129
|
-
}
|
|
130
|
-
setCurrentIndex(index);
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
// 设置容器样式、动画
|
|
134
|
-
// TODO fix settimeout mess
|
|
135
|
-
const updateSwipeStyle = (to, cur, length) => {
|
|
136
|
-
let style;
|
|
137
|
-
// 最后向前到最开始
|
|
138
|
-
if (to === 0 && cur === length - 1) {
|
|
139
|
-
circular &&
|
|
140
|
-
setSwipeStyle({
|
|
141
|
-
transform: `translate3d(0, 0, 0)`,
|
|
142
|
-
});
|
|
143
|
-
setTimeout(() => {
|
|
144
|
-
setSwipeStyle({
|
|
145
|
-
transform: vertical
|
|
146
|
-
? `translate3d(0, -100%, 0)`
|
|
147
|
-
: `translate3d(-100%, 0, 0)`,
|
|
148
|
-
transitionDuration: `${duration}ms`,
|
|
149
|
-
});
|
|
150
|
-
}, 50);
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// 第一个后退到最后
|
|
155
|
-
if (to === length - 1 && cur === 0) {
|
|
156
|
-
circular &&
|
|
157
|
-
setSwipeStyle({
|
|
158
|
-
transform: vertical
|
|
159
|
-
? `translate3d(0, -${(to + 2) * 100}%, 0)`
|
|
160
|
-
: `translate3d(-${(to + 2) * 100}%, 0, 0)`,
|
|
161
|
-
});
|
|
162
|
-
setTimeout(() => {
|
|
163
|
-
setSwipeStyle({
|
|
164
|
-
transform: vertical
|
|
165
|
-
? `translate3d(0, -${(to + 1) * 100}%, 0)`
|
|
166
|
-
: `translate3d(-${(to + 1) * 100}%, 0, 0)`,
|
|
167
|
-
transitionDuration: `${duration}ms`,
|
|
168
|
-
});
|
|
169
|
-
}, 50);
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
style = {
|
|
174
|
-
transform: vertical
|
|
175
|
-
? `translate3d(0, -${(to + 1) * 100}%, 0)`
|
|
176
|
-
: `translate3d(-${(to + 1) * 100}%, 0, 0)`,
|
|
177
|
-
};
|
|
178
|
-
if (to !== cur) {
|
|
179
|
-
style.transitionDuration = `${duration}ms`;
|
|
180
|
-
}
|
|
181
|
-
setSwipeStyle(style);
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
return (
|
|
185
|
-
<div
|
|
186
|
-
className={classNames('g-swiper weda-ui g-carousel', className, {
|
|
187
|
-
vertical: vertical,
|
|
188
|
-
})}
|
|
189
|
-
style={{ height: height ? height : 'auto', ...style }}
|
|
190
|
-
ref={outerWrapRef}
|
|
191
|
-
id={id}
|
|
192
|
-
data-testid="carousel"
|
|
193
|
-
>
|
|
194
|
-
{itemCount > 0 ? (
|
|
195
|
-
<Swipe
|
|
196
|
-
className="g-swiper-list"
|
|
197
|
-
style={swipeStyle}
|
|
198
|
-
tolerance={20}
|
|
199
|
-
onSwipeLeft={() => {
|
|
200
|
-
vertical || setIndex(currentIndex + 1);
|
|
201
|
-
}}
|
|
202
|
-
onSwipeRight={() => {
|
|
203
|
-
vertical || setIndex(currentIndex - 1);
|
|
204
|
-
}}
|
|
205
|
-
onSwipeDown={() => {
|
|
206
|
-
vertical && setIndex(currentIndex - 1);
|
|
207
|
-
}}
|
|
208
|
-
onSwipeUp={() => {
|
|
209
|
-
vertical && setIndex(currentIndex + 1);
|
|
210
|
-
}}
|
|
211
|
-
>
|
|
212
|
-
{itemsClone[itemCount - 1]}
|
|
213
|
-
{images.map((x, i) => {
|
|
214
|
-
return (
|
|
215
|
-
<SwiperItem
|
|
216
|
-
setHeight={setHeight}
|
|
217
|
-
currentIndex={currentIndex}
|
|
218
|
-
index={i}
|
|
219
|
-
key={i}
|
|
220
|
-
imagesValue={x}
|
|
221
|
-
>
|
|
222
|
-
<Image
|
|
223
|
-
mode={'scaleToFill'}
|
|
224
|
-
lazyLoad={false}
|
|
225
|
-
maskClosable={false}
|
|
226
|
-
imgPreview={false}
|
|
227
|
-
fit={x.fit}
|
|
228
|
-
src={x.image}
|
|
229
|
-
alt={'图片'}
|
|
230
|
-
style={{
|
|
231
|
-
height: x.height ? x.height : 'auto',
|
|
232
|
-
width: x.width ? x.width : '100%',
|
|
233
|
-
}}
|
|
234
|
-
/>
|
|
235
|
-
</SwiperItem>
|
|
236
|
-
);
|
|
237
|
-
})}
|
|
238
|
-
{itemsClone[0]}
|
|
239
|
-
</Swipe>
|
|
240
|
-
) : null}
|
|
241
|
-
|
|
242
|
-
{indicatorDots ? (
|
|
243
|
-
<div className="g-swiper__pagination">
|
|
244
|
-
{images.map((x, i) => {
|
|
245
|
-
return (
|
|
246
|
-
<a
|
|
247
|
-
key={i}
|
|
248
|
-
href="#"
|
|
249
|
-
className="g-swiper__pagination-bulletm"
|
|
250
|
-
data-testid="g-swiper__pagination-bulletm"
|
|
251
|
-
style={{
|
|
252
|
-
backgroundColor:
|
|
253
|
-
currentIndex === i ? indicatorActiveColor : indicatorColor,
|
|
254
|
-
}}
|
|
255
|
-
onClick={(e) => {
|
|
256
|
-
setIndex(i);
|
|
257
|
-
e.preventDefault();
|
|
258
|
-
}}
|
|
259
|
-
data-index={i}
|
|
260
|
-
></a>
|
|
261
|
-
);
|
|
262
|
-
})}
|
|
263
|
-
</div>
|
|
264
|
-
) : (
|
|
265
|
-
false
|
|
266
|
-
)}
|
|
267
|
-
<a
|
|
268
|
-
href="#"
|
|
269
|
-
className="g-swiper__turn-pre"
|
|
270
|
-
onClick={(ev) => {
|
|
271
|
-
ev.preventDefault();
|
|
272
|
-
setIndex(currentIndex - 1);
|
|
273
|
-
}}
|
|
274
|
-
>
|
|
275
|
-
上一页
|
|
276
|
-
</a>
|
|
277
|
-
<a
|
|
278
|
-
href="#"
|
|
279
|
-
className="g-swiper__turn-next"
|
|
280
|
-
onClick={(ev) => {
|
|
281
|
-
ev.preventDefault();
|
|
282
|
-
setIndex(currentIndex + 1);
|
|
283
|
-
}}
|
|
284
|
-
>
|
|
285
|
-
下一页
|
|
286
|
-
</a>
|
|
287
|
-
</div>
|
|
288
|
-
);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
const SwiperItem: React.FC<{
|
|
292
|
-
setHeight: React.Dispatch<React.SetStateAction<number>>;
|
|
293
|
-
currentIndex: number;
|
|
294
|
-
index: number;
|
|
295
|
-
children?: React.ReactNode;
|
|
296
|
-
imagesValue: imagesItem;
|
|
297
|
-
}> = ({ setHeight, children, currentIndex, index, imagesValue }) => {
|
|
298
|
-
const firstChildRef = useRef<HTMLDivElement>(null);
|
|
299
|
-
const syncHeight = useDebouncedCallback(
|
|
300
|
-
(e) => {
|
|
301
|
-
// console.log('e.contentRect.height', e.contentRect.height);
|
|
302
|
-
setHeight(e.contentRect.height);
|
|
303
|
-
},
|
|
304
|
-
[setHeight],
|
|
305
|
-
500,
|
|
306
|
-
2000
|
|
307
|
-
); // 必须debounce延迟,让resize完成后再设置高度
|
|
308
|
-
|
|
309
|
-
// 因为有loading 所以得用resizeobserver
|
|
310
|
-
// @ts-ignore
|
|
311
|
-
useResizeObserver(firstChildRef, (e) => {
|
|
312
|
-
if (currentIndex === index) {
|
|
313
|
-
syncHeight(e);
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
const getLinkUrl = (url, params) => {
|
|
318
|
-
// URL 构造函数不支持 '//xxx.com' 的格式
|
|
319
|
-
if (url && url.indexOf('//') === 0) {
|
|
320
|
-
url = location.protocol + url;
|
|
321
|
-
}
|
|
322
|
-
// "proto:" 或 "//" 起头的是绝对路径
|
|
323
|
-
let isAbosolutePath = /^(?:[a-z]+:)/i.test(url);
|
|
324
|
-
let base,
|
|
325
|
-
path,
|
|
326
|
-
href,
|
|
327
|
-
paramObj = {},
|
|
328
|
-
urlObj;
|
|
329
|
-
if (!isAbosolutePath) {
|
|
330
|
-
// 相对地址使用站位域名,不实际使用
|
|
331
|
-
base =
|
|
332
|
-
location.origin && location.origin !== 'null'
|
|
333
|
-
? location.origin
|
|
334
|
-
: 'https://we.da';
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
try {
|
|
338
|
-
urlObj = new URL(url, base);
|
|
339
|
-
params.forEach((x) => {
|
|
340
|
-
urlObj.searchParams.append(x.key, x.value);
|
|
341
|
-
});
|
|
342
|
-
|
|
343
|
-
href = urlObj.href;
|
|
344
|
-
path = urlObj.pathname;
|
|
345
|
-
|
|
346
|
-
for (const [key, value] of urlObj.searchParams) {
|
|
347
|
-
paramObj[key] = value;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
// 相对地址去掉站位域名
|
|
351
|
-
if (!isAbosolutePath) {
|
|
352
|
-
href = urlObj.pathname + urlObj.search + urlObj.hash;
|
|
353
|
-
href = href.replace(/^\//, '');
|
|
354
|
-
}
|
|
355
|
-
} catch (e) {
|
|
356
|
-
// 非法 url
|
|
357
|
-
isAbosolutePath = true;
|
|
358
|
-
href = url;
|
|
359
|
-
path = '';
|
|
360
|
-
paramObj = params.reduce((p, x) => {
|
|
361
|
-
p[x.key] = x.value;
|
|
362
|
-
return p;
|
|
363
|
-
}, {});
|
|
364
|
-
}
|
|
365
|
-
let res = {
|
|
366
|
-
path,
|
|
367
|
-
isAbosolutePath,
|
|
368
|
-
href,
|
|
369
|
-
};
|
|
370
|
-
return res;
|
|
371
|
-
};
|
|
372
|
-
|
|
373
|
-
const handleImage = (e) => {
|
|
374
|
-
const { insideUrl, outerUrl, tapMode, params, newPage } = imagesValue;
|
|
375
|
-
if (tapMode === 'tap') {
|
|
376
|
-
return;
|
|
377
|
-
} else if (tapMode === 'inside' && !insideUrl) {
|
|
378
|
-
return;
|
|
379
|
-
} else if (tapMode === 'outer' && !outerUrl) {
|
|
380
|
-
return;
|
|
381
|
-
}
|
|
382
|
-
let selectedUrl = tapMode === 'inside' ? insideUrl : outerUrl;
|
|
383
|
-
let { path, isAbosolutePath, href } = getLinkUrl(selectedUrl, []);
|
|
384
|
-
let paramObj =
|
|
385
|
-
params &&
|
|
386
|
-
params.length > 0 &&
|
|
387
|
-
params.reduce((p, x) => {
|
|
388
|
-
p[x.key] = x.value;
|
|
389
|
-
return p;
|
|
390
|
-
}, {});
|
|
391
|
-
if (tapMode === 'inside') {
|
|
392
|
-
if (!isAbosolutePath) {
|
|
393
|
-
e.preventDefault();
|
|
394
|
-
app.navigateTo({
|
|
395
|
-
pageId: path,
|
|
396
|
-
packageName: '',
|
|
397
|
-
mode: 'weDa',
|
|
398
|
-
params: paramObj,
|
|
399
|
-
});
|
|
400
|
-
}
|
|
401
|
-
} else if (tapMode === 'outer') {
|
|
402
|
-
newPage ? window.open(href) : (location.href = href);
|
|
403
|
-
}
|
|
404
|
-
};
|
|
405
|
-
return (
|
|
406
|
-
<div
|
|
407
|
-
className={classNames('g-swiper-item', {
|
|
408
|
-
current: index === currentIndex,
|
|
409
|
-
})}
|
|
410
|
-
data-index={index}
|
|
411
|
-
onClick={handleImage}
|
|
412
|
-
data-testid="swiper-item"
|
|
413
|
-
>
|
|
414
|
-
<div ref={firstChildRef}>{children}</div>
|
|
415
|
-
</div>
|
|
416
|
-
);
|
|
417
|
-
};
|