@cloudbase/weda-ui 3.2.1 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/configs/components/chart/bar.json +9 -1
- package/dist/src/configs/components/chart/line.json +8 -0
- package/dist/src/configs/components/chart/pie.json +8 -0
- package/dist/src/web/actions/showModal/index.js +0 -1
- package/dist/src/web/components/calendar/index.js +39 -37
- package/dist/src/web/components/carousel/index.js +62 -62
- package/dist/src/web/components/chart/bar/index.js +6 -2
- package/dist/src/web/components/chart/common/Chart.d.ts +1 -0
- package/dist/src/web/components/chart/common/Chart.js +9 -1
- package/dist/src/web/components/chart/common/chart-custom-connector.js +1 -1
- package/dist/src/web/components/chart/common/core/eChartBase.js +1 -1
- package/dist/src/web/components/chart/common/data-transform.js +3 -1
- package/dist/src/web/components/chart/common/useChart.js +13 -2
- package/dist/src/web/components/chart/line/index.js +2 -2
- package/dist/src/web/components/chart/pie/index.js +2 -2
- package/dist/src/web/components/common/error-boundary.d.ts +5 -0
- package/dist/src/web/components/common/error-boundary.js +33 -0
- package/dist/src/web/components/common/use-loop-render-detect.d.ts +11 -0
- package/dist/src/web/components/common/use-loop-render-detect.js +124 -0
- package/dist/src/web/components/form/checkbox/index.js +29 -29
- package/dist/src/web/components/form/form/index.js +39 -26
- package/dist/src/web/components/form/input/index.js +11 -3
- package/dist/src/web/components/form/location/common/mapChoose.js +6 -5
- package/dist/src/web/components/form/location/common/mapView.js +9 -6
- package/dist/src/web/{utils → components/form/location/common}/tmap.d.ts +0 -0
- package/dist/src/web/{utils → components/form/location/common}/tmap.js +0 -0
- package/dist/src/web/components/form/location/common/useLocationInfo.js +3 -2
- package/dist/src/web/components/form/location/components/LocationH5/location.h5.js +6 -3
- package/dist/src/web/components/form/location/components/LocationPC/location.PC.js +5 -1
- package/dist/src/web/components/form/location/index.js +7 -0
- package/dist/src/web/components/form/radio/index.js +3 -3
- package/dist/src/web/components/form/select/allTimePicker/index.js +1 -0
- package/dist/src/web/components/form/select/h5.js +18 -4
- package/dist/src/web/components/form/select/index.js +15 -1
- package/dist/src/web/components/form/select/use-options.js +1 -1
- package/dist/src/web/components/form/uploader/uploader.h5.js +2 -2
- package/dist/src/web/components/form/uploader/uploader.pc.js +1 -1
- package/dist/src/web/components/form/uploaderFile/uploadFile.h5.js +9 -7
- package/dist/src/web/components/form/uploaderFile/uploadFile.pc.js +9 -6
- package/dist/src/web/components/form/userOrgSelect/comTool.js +3 -9
- package/dist/src/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.js +47 -34
- package/dist/src/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.pc.d.ts +1 -1
- package/dist/src/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.pc.js +35 -36
- package/dist/src/web/{utils → components/form/userOrgSelect}/getUserService.d.ts +0 -0
- package/dist/src/web/{utils → components/form/userOrgSelect}/getUserService.js +8 -5
- package/dist/src/web/components/form/userOrgSelect/userTreeSelect.h5.d.ts +3 -2
- package/dist/src/web/components/form/userOrgSelect/userTreeSelect.h5.js +42 -20
- package/dist/src/web/components/form/userOrgSelect/userTreeSelect.pc.d.ts +1 -1
- package/dist/src/web/components/form/userOrgSelect/userTreeSelect.pc.js +111 -129
- package/dist/src/web/components/form/userOrgSelect/utils.d.ts +3 -2
- package/dist/src/web/components/form/userOrgSelect/utils.js +24 -16
- package/dist/src/web/components/formdetail/index.js +14 -11
- package/dist/src/web/components/graphicCard/index.js +5 -6
- package/dist/src/web/components/image/index.js +1 -1
- package/dist/src/web/components/listView/index.js +1 -0
- package/dist/src/web/components/lottery/index.js +10 -16
- package/dist/src/web/components/navLayout/index.js +1 -1
- package/dist/src/web/components/navigationBar/horizontalMenu.js +1 -1
- package/dist/src/web/components/navigationBar/index.js +13 -8
- package/dist/src/web/components/richText/index.js +1 -2
- package/dist/src/web/components/richTextView/index.js +20 -18
- package/dist/src/web/components/scrollView/index.d.ts +1 -2
- package/dist/src/web/components/scrollView/index.js +7 -5
- package/dist/src/web/components/swiper/index.js +62 -62
- package/dist/src/web/components/tabs/index.js +6 -1
- package/dist/src/web/components/tabs/tabs.h5.js +2 -0
- package/dist/src/web/components/text/index.js +10 -8
- package/dist/src/web/components/uploaderFileView/index.js +1 -1
- package/dist/src/web/components/uploaderView/index.js +1 -1
- package/dist/src/web/components/wedaVideo/index.js +15 -3
- package/dist/src/web/utils/console.d.ts +3 -0
- package/dist/src/web/utils/console.js +26 -0
- package/dist/src/web/utils/platform.js +1 -1
- package/dist/src/web/utils/tcb.js +1 -1
- package/dist/src/web/utils/useSyncValue.js +1 -0
- package/dist/web/components/form/input/index.css +16 -0
- package/dist/web/components/form/userOrgSelect/userOrgSelect.css +4 -0
- package/package.json +22 -22
- package/dist/configs/actions/showModal.json +0 -48
- package/dist/configs/actions/showToast.json +0 -41
- package/dist/configs/components/auth.json +0 -16
- package/dist/configs/components/button.json +0 -239
- package/dist/configs/components/calendar.json +0 -81
- package/dist/configs/components/carousel.json +0 -292
- package/dist/configs/components/chart/bar.json +0 -728
- package/dist/configs/components/chart/line.json +0 -681
- package/dist/configs/components/chart/pie.json +0 -500
- package/dist/configs/components/chart/statisticsCard.json +0 -376
- package/dist/configs/components/container.json +0 -50
- package/dist/configs/components/dataView.json +0 -239
- package/dist/configs/components/drawer.json +0 -115
- package/dist/configs/components/form/checkbox.json +0 -179
- package/dist/configs/components/form/departTreeSelect.json +0 -124
- package/dist/configs/components/form/form.json +0 -69
- package/dist/configs/components/form/input.json +0 -154
- package/dist/configs/components/form/location.json +0 -216
- package/dist/configs/components/form/radio.json +0 -203
- package/dist/configs/components/form/richText.json +0 -133
- package/dist/configs/components/form/select.json +0 -431
- package/dist/configs/components/form/switch.json +0 -58
- package/dist/configs/components/form/textarea.json +0 -116
- package/dist/configs/components/form/tips.json +0 -34
- package/dist/configs/components/form/uploader.json +0 -171
- package/dist/configs/components/form/uploaderFile.json +0 -158
- package/dist/configs/components/form/userTreeSelect.json +0 -128
- package/dist/configs/components/formdetail.json +0 -105
- package/dist/configs/components/graphicCard.json +0 -413
- package/dist/configs/components/image.json +0 -187
- package/dist/configs/components/link.json +0 -79
- package/dist/configs/components/listView.json +0 -378
- package/dist/configs/components/lottery.json +0 -163
- package/dist/configs/components/modal.json +0 -72
- package/dist/configs/components/navLayout.json +0 -368
- package/dist/configs/components/navigationBar.json +0 -62
- package/dist/configs/components/richtextview.json +0 -26
- package/dist/configs/components/scrollVeiw.json +0 -253
- package/dist/configs/components/slot.json +0 -17
- package/dist/configs/components/swiper.json +0 -90
- package/dist/configs/components/tabs.json +0 -122
- package/dist/configs/components/text.json +0 -95
- package/dist/configs/components/wedaVideo.json +0 -89
- package/dist/configs/components/wxOpenApi/phone.json +0 -127
- package/dist/configs/components/wxOpenApi/phoneCode.json +0 -109
- package/dist/configs/components/wxOpenApi/share.json +0 -160
- package/dist/configs/components/wxOpenApi/userInfo.json +0 -156
- package/dist/configs/index.d.ts +0 -103
- package/dist/configs/index.js +0 -111
- package/dist/docs/common/format.d.ts +0 -13
- package/dist/docs/common/format.js +0 -122
- package/dist/docs/common/tableView.d.ts +0 -30
- package/dist/docs/common/tableView.js +0 -159
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -3
- package/dist/setupTests.d.ts +0 -1
- package/dist/setupTests.js +0 -14
- package/dist/src/web/components/chart/common/error-boundary.d.ts +0 -5
- package/dist/src/web/components/chart/common/error-boundary.js +0 -26
- package/dist/web/actions/index.d.ts +0 -2
- package/dist/web/actions/index.js +0 -2
- package/dist/web/actions/showModal/index.d.ts +0 -4
- package/dist/web/actions/showModal/index.js +0 -67
- package/dist/web/actions/showToast/index.d.ts +0 -1
- package/dist/web/actions/showToast/index.js +0 -3
- package/dist/web/components/button/index.d.ts +0 -32
- package/dist/web/components/button/index.js +0 -48
- package/dist/web/components/calendar/index.d.ts +0 -19
- package/dist/web/components/calendar/index.js +0 -189
- package/dist/web/components/calendar/util.d.ts +0 -13
- package/dist/web/components/calendar/util.js +0 -74
- package/dist/web/components/carousel/index.d.ts +0 -41
- package/dist/web/components/carousel/index.js +0 -244
- package/dist/web/components/chart/bar/index.d.ts +0 -41
- package/dist/web/components/chart/bar/index.js +0 -56
- package/dist/web/components/chart/common/config/bar.d.ts +0 -48
- package/dist/web/components/chart/common/config/bar.js +0 -49
- package/dist/web/components/chart/common/config/global.d.ts +0 -13
- package/dist/web/components/chart/common/config/global.js +0 -16
- package/dist/web/components/chart/common/config/line.d.ts +0 -46
- package/dist/web/components/chart/common/config/line.js +0 -49
- package/dist/web/components/chart/common/config/pie.d.ts +0 -29
- package/dist/web/components/chart/common/config/pie.js +0 -36
- package/dist/web/components/chart/common/core/eChartBar.d.ts +0 -68
- package/dist/web/components/chart/common/core/eChartBar.js +0 -198
- package/dist/web/components/chart/common/core/eChartBase.d.ts +0 -128
- package/dist/web/components/chart/common/core/eChartBase.js +0 -352
- package/dist/web/components/chart/common/core/eChartLine.d.ts +0 -62
- package/dist/web/components/chart/common/core/eChartLine.js +0 -170
- package/dist/web/components/chart/common/core/eChartPie.d.ts +0 -50
- package/dist/web/components/chart/common/core/eChartPie.js +0 -132
- package/dist/web/components/chart/common/core/type.d.ts +0 -35
- package/dist/web/components/chart/common/core/type.js +0 -9
- package/dist/web/components/chart/common/echarts.d.ts +0 -2
- package/dist/web/components/chart/common/echarts.js +0 -24
- package/dist/web/components/chart/common/useChart.d.ts +0 -8
- package/dist/web/components/chart/common/useChart.js +0 -60
- package/dist/web/components/chart/line/index.d.ts +0 -39
- package/dist/web/components/chart/line/index.js +0 -53
- package/dist/web/components/chart/pie/index.d.ts +0 -27
- package/dist/web/components/chart/pie/index.js +0 -40
- package/dist/web/components/chart/statisticsCard/index.d.ts +0 -85
- package/dist/web/components/chart/statisticsCard/index.js +0 -203
- package/dist/web/components/chart/statisticsCard/interface.d.ts +0 -13
- package/dist/web/components/chart/statisticsCard/interface.js +0 -1
- package/dist/web/components/container/index.d.ts +0 -6
- package/dist/web/components/container/index.js +0 -6
- package/dist/web/components/dataView/index.d.ts +0 -6
- package/dist/web/components/dataView/index.js +0 -8
- package/dist/web/components/dataView/interface.d.ts +0 -5
- package/dist/web/components/dataView/interface.js +0 -1
- package/dist/web/components/drawer/index.d.ts +0 -13
- package/dist/web/components/drawer/index.js +0 -12
- package/dist/web/components/form/checkbox/index.d.ts +0 -13
- package/dist/web/components/form/checkbox/index.js +0 -167
- package/dist/web/components/form/enumSelect/MultipleSelect.d.ts +0 -78
- package/dist/web/components/form/enumSelect/MultipleSelect.js +0 -52
- package/dist/web/components/form/enumSelect/NormalSelect.d.ts +0 -83
- package/dist/web/components/form/enumSelect/NormalSelect.js +0 -52
- package/dist/web/components/form/enumSelect/SelectContainer.d.ts +0 -16
- package/dist/web/components/form/enumSelect/SelectContainer.js +0 -30
- package/dist/web/components/form/enumSelect/index.d.ts +0 -82
- package/dist/web/components/form/enumSelect/index.js +0 -6
- package/dist/web/components/form/enumSelect/props/defaultProps.d.ts +0 -34
- package/dist/web/components/form/enumSelect/props/defaultProps.js +0 -40
- package/dist/web/components/form/enumSelect/props/propsTypes.d.ts +0 -39
- package/dist/web/components/form/enumSelect/props/propsTypes.js +0 -47
- package/dist/web/components/form/form/index.d.ts +0 -32
- package/dist/web/components/form/form/index.js +0 -108
- package/dist/web/components/form/formcell/index.d.ts +0 -8
- package/dist/web/components/form/formcell/index.js +0 -40
- package/dist/web/components/form/input/index.d.ts +0 -14
- package/dist/web/components/form/input/index.js +0 -86
- package/dist/web/components/form/location/common/mapChoose.d.ts +0 -15
- package/dist/web/components/form/location/common/mapChoose.js +0 -495
- package/dist/web/components/form/location/common/mapView.d.ts +0 -19
- package/dist/web/components/form/location/common/mapView.js +0 -172
- package/dist/web/components/form/location/common/propsConfig.d.ts +0 -59
- package/dist/web/components/form/location/common/propsConfig.js +0 -50
- package/dist/web/components/form/location/common/selectModal.d.ts +0 -21
- package/dist/web/components/form/location/common/selectModal.js +0 -44
- package/dist/web/components/form/location/common/useLocationInfo.d.ts +0 -36
- package/dist/web/components/form/location/common/useLocationInfo.js +0 -104
- package/dist/web/components/form/location/components/LocationH5/location.h5.d.ts +0 -8
- package/dist/web/components/form/location/components/LocationH5/location.h5.js +0 -325
- package/dist/web/components/form/location/components/LocationPC/Header.d.ts +0 -12
- package/dist/web/components/form/location/components/LocationPC/Header.js +0 -43
- package/dist/web/components/form/location/components/LocationPC/location.PC.d.ts +0 -8
- package/dist/web/components/form/location/components/LocationPC/location.PC.js +0 -224
- package/dist/web/components/form/location/constants.d.ts +0 -2
- package/dist/web/components/form/location/constants.js +0 -3
- package/dist/web/components/form/location/index.d.ts +0 -1
- package/dist/web/components/form/location/index.js +0 -17
- package/dist/web/components/form/radio/index.d.ts +0 -11
- package/dist/web/components/form/radio/index.js +0 -115
- package/dist/web/components/form/renderDecorator.d.ts +0 -6
- package/dist/web/components/form/renderDecorator.js +0 -20
- package/dist/web/components/form/select/dropdown-select/ui.d.ts +0 -15
- package/dist/web/components/form/select/dropdown-select/ui.js +0 -55
- package/dist/web/components/form/select/h5.d.ts +0 -16
- package/dist/web/components/form/select/h5.js +0 -410
- package/dist/web/components/form/select/index.d.ts +0 -65
- package/dist/web/components/form/select/index.js +0 -232
- package/dist/web/components/form/select/region/index.d.ts +0 -6
- package/dist/web/components/form/select/region/index.js +0 -147
- package/dist/web/components/form/select/time.d.ts +0 -9
- package/dist/web/components/form/select/time.js +0 -146
- package/dist/web/components/form/select/use-options.d.ts +0 -26
- package/dist/web/components/form/select/use-options.js +0 -103
- package/dist/web/components/form/select/year.d.ts +0 -7
- package/dist/web/components/form/select/year.js +0 -72
- package/dist/web/components/form/switch/index.d.ts +0 -6
- package/dist/web/components/form/switch/index.js +0 -58
- package/dist/web/components/form/textarea/index.d.ts +0 -12
- package/dist/web/components/form/textarea/index.js +0 -66
- package/dist/web/components/form/tips/index.d.ts +0 -8
- package/dist/web/components/form/tips/index.js +0 -17
- package/dist/web/components/form/uploader/index.d.ts +0 -3
- package/dist/web/components/form/uploader/index.js +0 -42
- package/dist/web/components/form/uploader/uploader.h5.d.ts +0 -20
- package/dist/web/components/form/uploader/uploader.h5.js +0 -224
- package/dist/web/components/form/uploader/uploader.pc.d.ts +0 -29
- package/dist/web/components/form/uploader/uploader.pc.js +0 -214
- package/dist/web/components/form/uploaderFile/index.d.ts +0 -4
- package/dist/web/components/form/uploaderFile/index.js +0 -19
- package/dist/web/components/form/uploaderFile/uploadFile.h5.d.ts +0 -23
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +0 -337
- package/dist/web/components/form/uploaderFile/uploadFile.pc.d.ts +0 -24
- package/dist/web/components/form/uploaderFile/uploadFile.pc.js +0 -313
- package/dist/web/components/form/userOrgSelect/comTool.d.ts +0 -7
- package/dist/web/components/form/userOrgSelect/comTool.js +0 -89
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.d.ts +0 -20
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.js +0 -259
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.pc.d.ts +0 -4
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.pc.js +0 -153
- package/dist/web/components/form/userOrgSelect/departTreeSelect/index.d.ts +0 -2
- package/dist/web/components/form/userOrgSelect/departTreeSelect/index.js +0 -17
- package/dist/web/components/form/userOrgSelect/index.d.ts +0 -2
- package/dist/web/components/form/userOrgSelect/index.js +0 -17
- package/dist/web/components/form/userOrgSelect/userOrgSelect.less +0 -643
- package/dist/web/components/form/userOrgSelect/userTreeSelect.h5.d.ts +0 -24
- package/dist/web/components/form/userOrgSelect/userTreeSelect.h5.js +0 -276
- package/dist/web/components/form/userOrgSelect/userTreeSelect.pc.d.ts +0 -9
- package/dist/web/components/form/userOrgSelect/userTreeSelect.pc.js +0 -229
- package/dist/web/components/form/userOrgSelect/utils.d.ts +0 -35
- package/dist/web/components/form/userOrgSelect/utils.js +0 -72
- package/dist/web/components/formdetail/index.d.ts +0 -28
- package/dist/web/components/formdetail/index.js +0 -170
- package/dist/web/components/graphicCard/index.d.ts +0 -31
- package/dist/web/components/graphicCard/index.js +0 -166
- package/dist/web/components/image/image.d.ts +0 -9
- package/dist/web/components/image/image.js +0 -119
- package/dist/web/components/image/index.d.ts +0 -13
- package/dist/web/components/image/index.js +0 -91
- package/dist/web/components/index.d.ts +0 -50
- package/dist/web/components/index.js +0 -97
- package/dist/web/components/link/index.d.ts +0 -24
- package/dist/web/components/link/index.js +0 -71
- package/dist/web/components/listView/index.d.ts +0 -7
- package/dist/web/components/listView/index.js +0 -286
- package/dist/web/components/listView/interface.d.ts +0 -127
- package/dist/web/components/listView/interface.js +0 -1
- package/dist/web/components/lottery/index.d.ts +0 -22
- package/dist/web/components/lottery/index.js +0 -391
- package/dist/web/components/lottery/lotteryUtil.d.ts +0 -23
- package/dist/web/components/lottery/lotteryUtil.js +0 -181
- package/dist/web/components/modal/index.d.ts +0 -17
- package/dist/web/components/modal/index.js +0 -11
- package/dist/web/components/modal/modal.h5.d.ts +0 -4
- package/dist/web/components/modal/modal.h5.js +0 -46
- package/dist/web/components/modal/modal.pc.d.ts +0 -3
- package/dist/web/components/modal/modal.pc.js +0 -31
- package/dist/web/components/navLayout/index.d.ts +0 -46
- package/dist/web/components/navLayout/index.js +0 -116
- package/dist/web/components/navigationBar/common.d.ts +0 -15
- package/dist/web/components/navigationBar/common.js +0 -127
- package/dist/web/components/navigationBar/h5Menu.d.ts +0 -14
- package/dist/web/components/navigationBar/h5Menu.js +0 -72
- package/dist/web/components/navigationBar/horizontalMenu.d.ts +0 -12
- package/dist/web/components/navigationBar/horizontalMenu.js +0 -99
- package/dist/web/components/navigationBar/index.d.ts +0 -13
- package/dist/web/components/navigationBar/index.js +0 -157
- package/dist/web/components/navigationBar/verticalMenu.d.ts +0 -13
- package/dist/web/components/navigationBar/verticalMenu.js +0 -38
- package/dist/web/components/phone/index.d.ts +0 -18
- package/dist/web/components/phone/index.js +0 -4
- package/dist/web/components/phoneCode/index.d.ts +0 -18
- package/dist/web/components/phoneCode/index.js +0 -4
- package/dist/web/components/picker/datePicker.d.ts +0 -10
- package/dist/web/components/picker/datePicker.js +0 -31
- package/dist/web/components/picker/picker.d.ts +0 -6
- package/dist/web/components/picker/picker.js +0 -45
- package/dist/web/components/picker/timePicker.d.ts +0 -7
- package/dist/web/components/picker/timePicker.js +0 -42
- package/dist/web/components/richText/const.d.ts +0 -1
- package/dist/web/components/richText/const.js +0 -2
- package/dist/web/components/richText/index.d.ts +0 -50
- package/dist/web/components/richText/index.js +0 -352
- package/dist/web/components/richTextView/index.d.ts +0 -7
- package/dist/web/components/richTextView/index.js +0 -44
- package/dist/web/components/scrollView/index.d.ts +0 -27
- package/dist/web/components/scrollView/index.js +0 -95
- package/dist/web/components/share/index.d.ts +0 -34
- package/dist/web/components/share/index.js +0 -4
- package/dist/web/components/slot/index.d.ts +0 -6
- package/dist/web/components/slot/index.js +0 -9
- package/dist/web/components/swiper/index.d.ts +0 -24
- package/dist/web/components/swiper/index.js +0 -153
- package/dist/web/components/tabs/index.d.ts +0 -13
- package/dist/web/components/tabs/index.js +0 -15
- package/dist/web/components/tabs/tabs.h5.d.ts +0 -4
- package/dist/web/components/tabs/tabs.h5.js +0 -42
- package/dist/web/components/tabs/tabs.pc.d.ts +0 -3
- package/dist/web/components/tabs/tabs.pc.js +0 -40
- package/dist/web/components/text/index.d.ts +0 -14
- package/dist/web/components/text/index.js +0 -17
- package/dist/web/components/uploaderFileView/index.d.ts +0 -10
- package/dist/web/components/uploaderFileView/index.js +0 -61
- package/dist/web/components/uploaderView/index.d.ts +0 -17
- package/dist/web/components/uploaderView/index.js +0 -48
- package/dist/web/components/userInfo/index.d.ts +0 -26
- package/dist/web/components/userInfo/index.js +0 -4
- package/dist/web/components/wedaVideo/index.d.ts +0 -17
- package/dist/web/components/wedaVideo/index.js +0 -160
- package/dist/web/index.d.ts +0 -8
- package/dist/web/index.js +0 -4
- package/dist/web/utils/classnames.d.ts +0 -2
- package/dist/web/utils/classnames.js +0 -37
- package/dist/web/utils/constant.d.ts +0 -23
- package/dist/web/utils/constant.js +0 -24
- package/dist/web/utils/debounce.d.ts +0 -2
- package/dist/web/utils/debounce.js +0 -92
- package/dist/web/utils/getLocalCounter.d.ts +0 -1
- package/dist/web/utils/getLocalCounter.js +0 -4
- package/dist/web/utils/getUserService.d.ts +0 -17
- package/dist/web/utils/getUserService.js +0 -148
- package/dist/web/utils/isObjectEqual.d.ts +0 -2
- package/dist/web/utils/isObjectEqual.js +0 -12
- package/dist/web/utils/loading-fallback.d.ts +0 -2
- package/dist/web/utils/loading-fallback.js +0 -2
- package/dist/web/utils/lodash.d.ts +0 -1
- package/dist/web/utils/lodash.js +0 -2
- package/dist/web/utils/platform.d.ts +0 -18
- package/dist/web/utils/platform.js +0 -193
- package/dist/web/utils/tcb.d.ts +0 -27
- package/dist/web/utils/tcb.js +0 -105
- package/dist/web/utils/tmap.d.ts +0 -3
- package/dist/web/utils/tmap.js +0 -21
- package/dist/web/utils/use-cloud-id-temp-url.d.ts +0 -1
- package/dist/web/utils/use-cloud-id-temp-url.js +0 -13
- package/dist/web/utils/useSetState.d.ts +0 -1
- package/dist/web/utils/useSetState.js +0 -8
- package/dist/web/utils/useSyncValue.d.ts +0 -4
- package/dist/web/utils/useSyncValue.js +0 -15
- package/dist/web/utils/weui.d.ts +0 -1
- package/dist/web/utils/weui.js +0 -2
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './index.css';
|
|
3
|
-
import type { CommonPropsType, ICompRef } from '../../types';
|
|
4
|
-
declare type TCompRef = ICompRef<{
|
|
5
|
-
start: () => void;
|
|
6
|
-
}>;
|
|
7
|
-
declare const _default: React.ForwardRefExoticComponent<PropsType & React.RefAttributes<TCompRef>>;
|
|
8
|
-
export default _default;
|
|
9
|
-
export interface PropsType extends CommonPropsType {
|
|
10
|
-
/**
|
|
11
|
-
* 奖品列表
|
|
12
|
-
*/
|
|
13
|
-
prizeList: any;
|
|
14
|
-
/**
|
|
15
|
-
* 启动抽奖
|
|
16
|
-
*/
|
|
17
|
-
enablePrize: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* 抽奖结果
|
|
20
|
-
*/
|
|
21
|
-
prizeResult: string;
|
|
22
|
-
}
|
|
@@ -1,391 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react/jsx-key */
|
|
2
|
-
import React, { useState, useEffect, useCallback, useImperativeHandle, } from 'react';
|
|
3
|
-
import { usePlatform } from '../../utils/platform';
|
|
4
|
-
import classNames from '../../utils/classnames';
|
|
5
|
-
import './index.css';
|
|
6
|
-
import { ConfigProvider } from 'tea-component';
|
|
7
|
-
import LotteryAction from './lotteryUtil';
|
|
8
|
-
const CLASS_PREFIX = 'weda-lottery';
|
|
9
|
-
const lotteryAction = new LotteryAction();
|
|
10
|
-
export default React.forwardRef(function Lottery({ className, id, style, prizeList, enablePrize, prizeResult, events }, ref) {
|
|
11
|
-
const platform = usePlatform();
|
|
12
|
-
const [activedId, setActivedId] = useState(-1);
|
|
13
|
-
const [isStartLottery, setIsStartLottery] = useState(false);
|
|
14
|
-
const [lotteryList, setLotteryList] = useState([]);
|
|
15
|
-
const [btnActived, setBtnActived] = useState(false);
|
|
16
|
-
//获取初始化默认数据,数据不足8条设置默认,超过8条获取前8条
|
|
17
|
-
const lotteryListDefault = () => {
|
|
18
|
-
const list = [];
|
|
19
|
-
if (prizeList == null) {
|
|
20
|
-
return list;
|
|
21
|
-
}
|
|
22
|
-
for (let i = 0; i < 8; i++) {
|
|
23
|
-
if (i < prizeList.length) {
|
|
24
|
-
const prize = prizeList[i];
|
|
25
|
-
list.push({
|
|
26
|
-
idx: i + 1,
|
|
27
|
-
selected: false,
|
|
28
|
-
desc: prize.title,
|
|
29
|
-
src: prize.image,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
list.push({
|
|
34
|
-
idx: i + 1,
|
|
35
|
-
selected: false,
|
|
36
|
-
desc: '',
|
|
37
|
-
src: '',
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return list;
|
|
42
|
-
};
|
|
43
|
-
const startLottery = useCallback(() => {
|
|
44
|
-
setLotteryList(lotteryListDefault());
|
|
45
|
-
setBtnActived(true);
|
|
46
|
-
if (lotteryAction.isStart)
|
|
47
|
-
return;
|
|
48
|
-
events === null || events === void 0 ? void 0 : events.clickLotteryButton();
|
|
49
|
-
setIsStartLottery(true);
|
|
50
|
-
}, [
|
|
51
|
-
lotteryAction.isStart,
|
|
52
|
-
setIsStartLottery,
|
|
53
|
-
setBtnActived,
|
|
54
|
-
lotteryListDefault,
|
|
55
|
-
setLotteryList,
|
|
56
|
-
]);
|
|
57
|
-
useImperativeHandle(ref, () => {
|
|
58
|
-
return {
|
|
59
|
-
methods: {
|
|
60
|
-
start: startLottery,
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
}, [startLottery]);
|
|
64
|
-
useEffect(() => {
|
|
65
|
-
setLotteryList(lotteryListDefault());
|
|
66
|
-
}, [prizeList]);
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
lotteryAction.animationCallback = ({ idx, isEnd }) => {
|
|
69
|
-
setActivedId(idx == -1 ? 0 : idx);
|
|
70
|
-
if (isEnd) {
|
|
71
|
-
setBtnActived(false);
|
|
72
|
-
const list = lotteryList.map((item, index) => {
|
|
73
|
-
if (index === idx - 1) {
|
|
74
|
-
item.selected = true;
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
item.selected = false;
|
|
78
|
-
}
|
|
79
|
-
return item;
|
|
80
|
-
});
|
|
81
|
-
setLotteryList(list);
|
|
82
|
-
setActivedId(-1);
|
|
83
|
-
// eslint-disable-next-line rulesdir/no-timer
|
|
84
|
-
setTimeout(() => {
|
|
85
|
-
events.finishLottery({
|
|
86
|
-
prize: idx,
|
|
87
|
-
result: list[idx - 1],
|
|
88
|
-
});
|
|
89
|
-
// 延迟700毫秒显示的视觉效果更好,否则看不清结果就弹出dialog盖住了
|
|
90
|
-
}, 700);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
}, [lotteryList]);
|
|
94
|
-
useEffect(() => {
|
|
95
|
-
// 当满足开启抽奖条件并且点击了开奖开关时,启用抽奖
|
|
96
|
-
if (enablePrize && isStartLottery) {
|
|
97
|
-
lotteryAction.start(prizeResult, () => {
|
|
98
|
-
window.app.showToast({
|
|
99
|
-
title: '网络异常',
|
|
100
|
-
icon: 'none',
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
// 当不选取变量作为结果的时候,按照设置给定结果
|
|
104
|
-
lotteryAction.end(prizeResult);
|
|
105
|
-
setIsStartLottery(false);
|
|
106
|
-
}
|
|
107
|
-
else if (!enablePrize) {
|
|
108
|
-
//立马停止抽奖
|
|
109
|
-
lotteryAction.stop();
|
|
110
|
-
}
|
|
111
|
-
}, [isStartLottery, enablePrize]);
|
|
112
|
-
useEffect(() => {
|
|
113
|
-
// 设置抽奖结果
|
|
114
|
-
lotteryAction.end(prizeResult);
|
|
115
|
-
}, [prizeResult]);
|
|
116
|
-
const [widthRatio, setWidthRatio] = useState(1);
|
|
117
|
-
const [heightRatio, setHeightRatio] = useState(1);
|
|
118
|
-
// 上下5个球的宽度
|
|
119
|
-
const [dotWidth, setDotWidth] = useState(217 / 14);
|
|
120
|
-
// 左右5个球的高度
|
|
121
|
-
const [dotHeight, setDotHeight] = useState(217 / 14);
|
|
122
|
-
const standardWidth = 326;
|
|
123
|
-
const standardHeight = 326;
|
|
124
|
-
const cls = classNames({
|
|
125
|
-
[CLASS_PREFIX]: true,
|
|
126
|
-
[className]: className,
|
|
127
|
-
[`${CLASS_PREFIX}-mobile`]: platform === 'h5',
|
|
128
|
-
});
|
|
129
|
-
// 将获取的style 转化为 px, 用户输入的单位可能有(纯数字,px, rem, %, rpx)
|
|
130
|
-
// 注: 前端输入宽高,不带单位和带rem单位,code 中获取的都是rem 单位,也就是输入1304,输出‘46.5714rem’; 输入‘1304rem’, 输出‘1304rem’, 所以rem目前不支持正常的比列
|
|
131
|
-
// 带上px单位和不带单位,输出的都是rem,且转化的值一样的,所以不需要特殊处理,也就是 输入 1304 和 1304px ,前端拿到的都是‘46.5714rem’
|
|
132
|
-
// rpx 是小程序的单位,并且在pc 上加病没作用,所以rpx 不处理
|
|
133
|
-
// % 暂时也不处理,因为不确定用户的百分比是以什么为标准的
|
|
134
|
-
const getStyleUnit = (targetValue) => {
|
|
135
|
-
if (!targetValue)
|
|
136
|
-
return -1;
|
|
137
|
-
const value = targetValue.toString();
|
|
138
|
-
// 获取单位
|
|
139
|
-
const fotData = value.match(/^\d+(?:\.\d+)?([a-zA-Z%]+)?$/);
|
|
140
|
-
let unit = 'rem';
|
|
141
|
-
if (fotData && fotData[1]) {
|
|
142
|
-
unit = fotData[1];
|
|
143
|
-
}
|
|
144
|
-
return unit;
|
|
145
|
-
};
|
|
146
|
-
const getRatio = (value, unit) => {
|
|
147
|
-
let actualValue;
|
|
148
|
-
if (unit.toString() === 'rem') {
|
|
149
|
-
actualValue = value * 14 * 2;
|
|
150
|
-
}
|
|
151
|
-
return actualValue;
|
|
152
|
-
};
|
|
153
|
-
// 通过页面配置拿到用户设置的宽,高,直接获取的宽和高,会被转化为rem, 需要将rem 转为 px. 规则: e/2/14
|
|
154
|
-
// css 输出的px到页面rem, 转化规则为: e/14
|
|
155
|
-
useEffect(() => {
|
|
156
|
-
if (!style || style == undefined || platform === 'h5') {
|
|
157
|
-
setWidthRatio(1);
|
|
158
|
-
setDotWidth(217 / 14);
|
|
159
|
-
setHeightRatio(1);
|
|
160
|
-
setDotHeight(217 / 14);
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
if (style && style !== undefined) {
|
|
164
|
-
// 如果宽和高不存在,则还远吗比例为默认值-1,也就是保持视觉稿默认的宽和高
|
|
165
|
-
if (!style.width) {
|
|
166
|
-
setWidthRatio(1);
|
|
167
|
-
setDotWidth(217 / 14);
|
|
168
|
-
}
|
|
169
|
-
if (!style.height) {
|
|
170
|
-
setHeightRatio(1);
|
|
171
|
-
setDotHeight(217 / 14);
|
|
172
|
-
}
|
|
173
|
-
if (style.width) {
|
|
174
|
-
// 现将获取的rem 转化为px
|
|
175
|
-
const actualValue = getRatio(parseFloat(style.width.toString()), getStyleUnit(style.width));
|
|
176
|
-
// setWidthRatio();
|
|
177
|
-
const setValue = Math.floor((actualValue / (standardWidth * 2)) * 1000) / 1000;
|
|
178
|
-
setWidthRatio(setValue);
|
|
179
|
-
const dotWidth = (setValue * 43 * 4 + setValue * 9 * 5) / 14;
|
|
180
|
-
setDotWidth(dotWidth);
|
|
181
|
-
}
|
|
182
|
-
if (style.height) {
|
|
183
|
-
// 现将获取的rem 转化为px
|
|
184
|
-
const actualValue = getRatio(parseFloat(style.height.toString()), getStyleUnit(style.height));
|
|
185
|
-
const setValue = Math.floor((actualValue / (standardHeight * 2)) * 1000) / 1000;
|
|
186
|
-
setHeightRatio(setValue);
|
|
187
|
-
const dotHeight = (setValue * 43 * 4 + setValue * 9 * 5) / 14;
|
|
188
|
-
setDotHeight(dotHeight);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}, [style]);
|
|
192
|
-
const renderDot = (direction, list) => {
|
|
193
|
-
return (React.createElement(React.Fragment, null,
|
|
194
|
-
React.createElement("div", { className: classNames(`${CLASS_PREFIX}__dot`, `${CLASS_PREFIX}__dot-${direction}`) }, list.map((item, index) => {
|
|
195
|
-
return (React.createElement("div", { key: index, className: `${CLASS_PREFIX}__dot-item`, style: {
|
|
196
|
-
width: `${(9 * widthRatio) / 14}rem`,
|
|
197
|
-
height: `${(9 * heightRatio) / 14}rem`,
|
|
198
|
-
marginBottom: `${direction}` === 'vertical'
|
|
199
|
-
? `${(43 * heightRatio) / 14}rem`
|
|
200
|
-
: '0',
|
|
201
|
-
marginRight: `${direction}` === 'horizontal'
|
|
202
|
-
? `${(43 * widthRatio) / 14}rem`
|
|
203
|
-
: '0',
|
|
204
|
-
} }));
|
|
205
|
-
}))));
|
|
206
|
-
};
|
|
207
|
-
const dotList = [
|
|
208
|
-
{
|
|
209
|
-
single: true,
|
|
210
|
-
position: 'left-top',
|
|
211
|
-
direction: '',
|
|
212
|
-
list: [],
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
single: true,
|
|
216
|
-
position: 'left-bottom',
|
|
217
|
-
direction: '',
|
|
218
|
-
list: [],
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
single: true,
|
|
222
|
-
position: 'right-top',
|
|
223
|
-
direction: '',
|
|
224
|
-
list: [],
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
single: true,
|
|
228
|
-
position: 'right-bottom',
|
|
229
|
-
direction: '',
|
|
230
|
-
list: [],
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
single: false,
|
|
234
|
-
position: 'top',
|
|
235
|
-
direction: 'horizontal',
|
|
236
|
-
list: ['1', '2', '3', '4', '5'],
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
single: false,
|
|
240
|
-
position: 'bottom',
|
|
241
|
-
direction: 'horizontal',
|
|
242
|
-
list: ['1', '2', '3', '4', '5'],
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
single: false,
|
|
246
|
-
position: 'left',
|
|
247
|
-
direction: 'vertical',
|
|
248
|
-
list: ['1', '2', '3', '4', '5'],
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
single: false,
|
|
252
|
-
position: 'right',
|
|
253
|
-
direction: 'vertical',
|
|
254
|
-
list: ['1', '2', '3', '4', '5'],
|
|
255
|
-
},
|
|
256
|
-
];
|
|
257
|
-
return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
|
|
258
|
-
React.createElement("div", { className: "body", key: "lottery", "data-testid": "lottery" },
|
|
259
|
-
React.createElement("div", { className: cls, id: id, style: style },
|
|
260
|
-
React.createElement("div", { className: `${CLASS_PREFIX}__wrap` },
|
|
261
|
-
dotList.map((dot, index) => {
|
|
262
|
-
return (React.createElement("div", { key: index },
|
|
263
|
-
dot.single && (React.createElement("div", { key: `${dot.direction}-${index}`, className: classNames(`${CLASS_PREFIX}__dot-single`, `${CLASS_PREFIX}__dot-${dot.position}`), style: {
|
|
264
|
-
width: `${(9 * widthRatio) / 14}rem`,
|
|
265
|
-
height: `${(9 * heightRatio) / 14}rem`,
|
|
266
|
-
top: `${dot.position}` === 'left-top' ||
|
|
267
|
-
`${dot.position}` === 'right-top'
|
|
268
|
-
? `${(9 * heightRatio) / 14}rem`
|
|
269
|
-
: '',
|
|
270
|
-
bottom: `${dot.position}` === 'left-bottom' ||
|
|
271
|
-
`${dot.position}` === 'right-bottom'
|
|
272
|
-
? `${(9 * heightRatio) / 14}rem`
|
|
273
|
-
: '',
|
|
274
|
-
left: `${dot.position}` === 'left-top' ||
|
|
275
|
-
`${dot.position}` === 'left-bottom'
|
|
276
|
-
? `${(6 * widthRatio) / 14}rem`
|
|
277
|
-
: '',
|
|
278
|
-
right: `${dot.position}` === 'right-top' ||
|
|
279
|
-
`${dot.position}` === 'right-bottom'
|
|
280
|
-
? `${(6 * widthRatio) / 14}rem`
|
|
281
|
-
: '',
|
|
282
|
-
} })),
|
|
283
|
-
!dot.single && (React.createElement("div", { key: `${dot.direction}-${index}`, className: `${CLASS_PREFIX}__dot-${dot.position}`, style: {
|
|
284
|
-
left: `${dot.position}` === 'top' ||
|
|
285
|
-
`${dot.position}` === 'bottom'
|
|
286
|
-
? `calc((${'100%'} - ${dotWidth}rem) / 2)`
|
|
287
|
-
: `${dot.position}` === 'left'
|
|
288
|
-
? `${(widthRatio * 18 - widthRatio * 9) / 2 / 14}rem`
|
|
289
|
-
: '',
|
|
290
|
-
top: `${dot.position}` === 'left' ||
|
|
291
|
-
`${dot.position}` === 'right'
|
|
292
|
-
? `calc((100% - ${dotHeight}rem) / 2)`
|
|
293
|
-
: `${dot.position}` === 'top'
|
|
294
|
-
? `${(heightRatio * 18 - heightRatio * 9) / 2 / 14}rem`
|
|
295
|
-
: '',
|
|
296
|
-
bottom: `${dot.position}` === 'bottom'
|
|
297
|
-
? `${(heightRatio * 18 - heightRatio * 9) / 2 / 14}rem`
|
|
298
|
-
: '',
|
|
299
|
-
right: `${dot.position}` === 'right'
|
|
300
|
-
? `${(widthRatio * 18 - widthRatio * 9) / 2 / 14}rem`
|
|
301
|
-
: '',
|
|
302
|
-
} }, true && renderDot(dot.direction, dot.list)))));
|
|
303
|
-
}),
|
|
304
|
-
React.createElement("div", { className: `${CLASS_PREFIX}__inner`, style: {
|
|
305
|
-
paddingTop: `${(18 * heightRatio) / 14}rem`,
|
|
306
|
-
paddingBottom: `${(18 * heightRatio) / 14}rem`,
|
|
307
|
-
paddingLeft: `${(18 * widthRatio) / 14}rem`,
|
|
308
|
-
paddingRight: `${(18 * widthRatio) / 14}rem`,
|
|
309
|
-
} },
|
|
310
|
-
React.createElement("div", { className: `${CLASS_PREFIX}__inner-wrap` },
|
|
311
|
-
React.createElement("ul", { className: `${CLASS_PREFIX}__list` }, lotteryList.map((item, index) => {
|
|
312
|
-
return (React.createElement("li", { "data-testid": "lottery-item", key: index, className: classNames(`${CLASS_PREFIX}__turntable-item`, item.idx === activedId ? 'is-actived' : '', item.selected ? 'is-selected' : ''), style: {
|
|
313
|
-
width: `calc((${'100%'} - ${(widthRatio * 8 * 4) / 14}rem) / 3)`,
|
|
314
|
-
height: `calc((${'100%'} - ${(heightRatio * 8 * 4) / 14}rem) / 3)`,
|
|
315
|
-
top: `${index}` == '0' ||
|
|
316
|
-
`${index}` == '1' ||
|
|
317
|
-
`${index}` == '2'
|
|
318
|
-
? `${(heightRatio * 8) / 14}rem`
|
|
319
|
-
: `${index}` == '3'
|
|
320
|
-
? `calc((${'100%'} - ${(heightRatio * 8 * 4) / 14}rem) / 3 + ${(heightRatio * 8 * 2) / 14}rem)`
|
|
321
|
-
: '',
|
|
322
|
-
bottom: `${index}` == '4' ||
|
|
323
|
-
`${index}` == '5' ||
|
|
324
|
-
`${index}` == '6'
|
|
325
|
-
? `${(heightRatio * 8) / 14}rem`
|
|
326
|
-
: `${index}` == '7'
|
|
327
|
-
? `calc((${'100%'} - ${(heightRatio * 8 * 4) / 14}rem) / 3 + ${(heightRatio * 8 * 2) / 14}rem)`
|
|
328
|
-
: '',
|
|
329
|
-
right: `${index}` == '2' ||
|
|
330
|
-
`${index}` == '3' ||
|
|
331
|
-
`${index}` == '4'
|
|
332
|
-
? `${(widthRatio * 8) / 14}rem`
|
|
333
|
-
: '',
|
|
334
|
-
left: `${index}` == '0' ||
|
|
335
|
-
`${index}` == '6' ||
|
|
336
|
-
`${index}` == '7'
|
|
337
|
-
? `${(widthRatio * 8) / 14}rem`
|
|
338
|
-
: `${index}` == '1' || `${index}` == '5'
|
|
339
|
-
? `calc((${'100%'} - ${(widthRatio * 8 * 4) / 14}rem) / 3 + ${(widthRatio * 8 * 2) / 14}rem)`
|
|
340
|
-
: '',
|
|
341
|
-
} },
|
|
342
|
-
React.createElement("div", { className: `${CLASS_PREFIX}__turntable-cell`, style: {
|
|
343
|
-
borderLeftWidth: `${(4 * widthRatio) / 14}rem`,
|
|
344
|
-
borderRightWidth: `${(4 * widthRatio) / 14}rem`,
|
|
345
|
-
borderTopWidth: `${(4 * heightRatio) / 14}rem`,
|
|
346
|
-
borderBottomWidth: `${(4 * heightRatio) / 14}rem`,
|
|
347
|
-
paddingTop: `${(8 * heightRatio) / 14}rem`,
|
|
348
|
-
paddingBottom: `${(8 * heightRatio) / 14}rem`,
|
|
349
|
-
paddingLeft: `${(2 * widthRatio) / 14}rem`,
|
|
350
|
-
paddingRight: `${(2 * widthRatio) / 14}rem`,
|
|
351
|
-
} },
|
|
352
|
-
item.src && (React.createElement("div", { className: `${CLASS_PREFIX}__turntable-cell-image`, style: {
|
|
353
|
-
height: `${(heightRatio * 40) / 14}rem`,
|
|
354
|
-
} },
|
|
355
|
-
React.createElement("img", { src: item.src, alt: item.desc, className: `${CLASS_PREFIX}__turntable-cell-icon`, style: {
|
|
356
|
-
width: `${(widthRatio * 40) / 14}rem`,
|
|
357
|
-
height: `${(heightRatio * 40) / 14}rem`,
|
|
358
|
-
} }))),
|
|
359
|
-
item.desc && (React.createElement("div", { className: `${CLASS_PREFIX}__turntable-cell-desc`, style: {
|
|
360
|
-
marginTop: `${(heightRatio * 6) / 14}rem`,
|
|
361
|
-
fontSize: `${(widthRatio * 12) / 14}rem`,
|
|
362
|
-
lineHeight: `${(heightRatio * 17) / 14}rem`,
|
|
363
|
-
} }, item.desc)))));
|
|
364
|
-
})),
|
|
365
|
-
React.createElement("div", { className: classNames(`${CLASS_PREFIX}__turntable-btn`, btnActived ? 'is-actived' : ''), style: {
|
|
366
|
-
width: `calc((${'100%'} - ${(widthRatio * 8 * 4) / 14}rem) / 3)`,
|
|
367
|
-
height: `calc((${'100%'} - ${(heightRatio * 8 * 4) / 14}rem) / 3)`,
|
|
368
|
-
top: `calc((${'100%'} - ${(heightRatio * 8 * 4) / 14}rem) / 3 + ${(heightRatio * 8 * 2) / 14}rem)`,
|
|
369
|
-
left: `calc((${'100%'} - ${(heightRatio * 8 * 4) / 14}rem) / 3 + ${(heightRatio * 8 * 2) / 14}rem)`,
|
|
370
|
-
} },
|
|
371
|
-
React.createElement("div", { className: `${CLASS_PREFIX}__btn-inner`, style: {
|
|
372
|
-
paddingTop: `${(9 * heightRatio) / 14}rem`,
|
|
373
|
-
paddingBottom: `${(9 * heightRatio) / 14}rem`,
|
|
374
|
-
paddingLeft: `${(9 * widthRatio) / 14}rem`,
|
|
375
|
-
paddingRight: `${(9 * widthRatio) / 14}rem`,
|
|
376
|
-
} },
|
|
377
|
-
React.createElement("div", { className: `${CLASS_PREFIX}__btn` },
|
|
378
|
-
React.createElement("a", { "data-testid": "start-lottery", className: `${CLASS_PREFIX}__btn-image`, style: {
|
|
379
|
-
paddingTop: `${(11 * heightRatio) / 14}rem`,
|
|
380
|
-
paddingBottom: `${(11 * heightRatio) / 14}rem`,
|
|
381
|
-
paddingLeft: `${(15 * widthRatio) / 14}rem`,
|
|
382
|
-
paddingRight: `${(15 * widthRatio) / 14}rem`,
|
|
383
|
-
}, onClick: startLottery },
|
|
384
|
-
React.createElement("p", { className: `${CLASS_PREFIX}__btn-text`, style: {
|
|
385
|
-
fontSize: `${(widthRatio * 18) / 14}rem`,
|
|
386
|
-
lineHeight: `${(widthRatio * 22) / 14}rem`,
|
|
387
|
-
} },
|
|
388
|
-
"\u5F00\u59CB",
|
|
389
|
-
React.createElement("br", null),
|
|
390
|
-
"\u62BD\u5956"))))))))))));
|
|
391
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export default class LotteryAction {
|
|
2
|
-
idx: number;
|
|
3
|
-
isStart: boolean;
|
|
4
|
-
endId: any;
|
|
5
|
-
speed: number;
|
|
6
|
-
duration: number;
|
|
7
|
-
maxIdx: number;
|
|
8
|
-
animationCallback: ({ idx, isEnd }: {
|
|
9
|
-
idx: any;
|
|
10
|
-
isEnd: any;
|
|
11
|
-
}) => void;
|
|
12
|
-
isError: boolean;
|
|
13
|
-
isSpeedUp: boolean;
|
|
14
|
-
timeout: number;
|
|
15
|
-
timer: any;
|
|
16
|
-
constructor();
|
|
17
|
-
start(prizeResult: any, errorCallback: any): void;
|
|
18
|
-
end(prizeResult: any): void;
|
|
19
|
-
error(): void;
|
|
20
|
-
stop(): void;
|
|
21
|
-
pointOnCubicBezier(cp: any, t: any): number;
|
|
22
|
-
loop(): void;
|
|
23
|
-
}
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
/* eslint-disable rulesdir/no-timer */
|
|
2
|
-
export default class LotteryAction {
|
|
3
|
-
constructor() {
|
|
4
|
-
Object.defineProperty(this, "idx", {
|
|
5
|
-
enumerable: true,
|
|
6
|
-
configurable: true,
|
|
7
|
-
writable: true,
|
|
8
|
-
value: void 0
|
|
9
|
-
});
|
|
10
|
-
// 开始抽奖
|
|
11
|
-
Object.defineProperty(this, "isStart", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
configurable: true,
|
|
14
|
-
writable: true,
|
|
15
|
-
value: void 0
|
|
16
|
-
});
|
|
17
|
-
// 结束位置
|
|
18
|
-
Object.defineProperty(this, "endId", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
configurable: true,
|
|
21
|
-
writable: true,
|
|
22
|
-
value: void 0
|
|
23
|
-
});
|
|
24
|
-
// 抽奖速度
|
|
25
|
-
Object.defineProperty(this, "speed", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
configurable: true,
|
|
28
|
-
writable: true,
|
|
29
|
-
value: void 0
|
|
30
|
-
});
|
|
31
|
-
// 持续时长
|
|
32
|
-
Object.defineProperty(this, "duration", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
writable: true,
|
|
36
|
-
value: void 0
|
|
37
|
-
});
|
|
38
|
-
Object.defineProperty(this, "maxIdx", {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
configurable: true,
|
|
41
|
-
writable: true,
|
|
42
|
-
value: void 0
|
|
43
|
-
});
|
|
44
|
-
// 回调动作
|
|
45
|
-
Object.defineProperty(this, "animationCallback", {
|
|
46
|
-
enumerable: true,
|
|
47
|
-
configurable: true,
|
|
48
|
-
writable: true,
|
|
49
|
-
value: void 0
|
|
50
|
-
});
|
|
51
|
-
// 是否异常
|
|
52
|
-
Object.defineProperty(this, "isError", {
|
|
53
|
-
enumerable: true,
|
|
54
|
-
configurable: true,
|
|
55
|
-
writable: true,
|
|
56
|
-
value: void 0
|
|
57
|
-
});
|
|
58
|
-
// 是否加速
|
|
59
|
-
Object.defineProperty(this, "isSpeedUp", {
|
|
60
|
-
enumerable: true,
|
|
61
|
-
configurable: true,
|
|
62
|
-
writable: true,
|
|
63
|
-
value: void 0
|
|
64
|
-
});
|
|
65
|
-
// 超时时间
|
|
66
|
-
Object.defineProperty(this, "timeout", {
|
|
67
|
-
enumerable: true,
|
|
68
|
-
configurable: true,
|
|
69
|
-
writable: true,
|
|
70
|
-
value: void 0
|
|
71
|
-
});
|
|
72
|
-
Object.defineProperty(this, "timer", {
|
|
73
|
-
enumerable: true,
|
|
74
|
-
configurable: true,
|
|
75
|
-
writable: true,
|
|
76
|
-
value: void 0
|
|
77
|
-
});
|
|
78
|
-
// 当前位置
|
|
79
|
-
this.idx = -1;
|
|
80
|
-
// 开始抽奖
|
|
81
|
-
this.isStart = false;
|
|
82
|
-
// 结束位置
|
|
83
|
-
this.endId = undefined;
|
|
84
|
-
// 抽奖速度
|
|
85
|
-
this.speed = 0;
|
|
86
|
-
// 持续时长
|
|
87
|
-
this.duration = 2000;
|
|
88
|
-
// 长度
|
|
89
|
-
this.maxIdx = 8;
|
|
90
|
-
// 回调动作
|
|
91
|
-
this.animationCallback = ({ idx, isEnd }) => { };
|
|
92
|
-
// 是否异常
|
|
93
|
-
this.isError = false;
|
|
94
|
-
// 是否加速
|
|
95
|
-
this.isSpeedUp = false;
|
|
96
|
-
//超时时间
|
|
97
|
-
this.timeout = 6000;
|
|
98
|
-
}
|
|
99
|
-
start(prizeResult, errorCallback) {
|
|
100
|
-
setTimeout(() => {
|
|
101
|
-
this.isStart = false;
|
|
102
|
-
const reg = /^\+?[1-9]\d*$/;
|
|
103
|
-
if (!reg.test(prizeResult)) {
|
|
104
|
-
this.isError = true;
|
|
105
|
-
if (errorCallback) {
|
|
106
|
-
errorCallback();
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}, this.duration);
|
|
110
|
-
// 在转动时长的一半,开始减速转动
|
|
111
|
-
setTimeout(() => {
|
|
112
|
-
this.isSpeedUp = false;
|
|
113
|
-
}, this.duration / 2);
|
|
114
|
-
// 超时,当出现一些意外的情况终止动画
|
|
115
|
-
setTimeout(() => {
|
|
116
|
-
if (this.endId === undefined) {
|
|
117
|
-
this.end(prizeResult);
|
|
118
|
-
}
|
|
119
|
-
}, this.timeout);
|
|
120
|
-
this.isStart = true;
|
|
121
|
-
this.isError = false;
|
|
122
|
-
this.isSpeedUp = true;
|
|
123
|
-
this.loop();
|
|
124
|
-
}
|
|
125
|
-
end(prizeResult) {
|
|
126
|
-
this.endId = prizeResult;
|
|
127
|
-
}
|
|
128
|
-
error() {
|
|
129
|
-
this.isError = true;
|
|
130
|
-
}
|
|
131
|
-
stop() {
|
|
132
|
-
this.isStart = false;
|
|
133
|
-
this.end(-1);
|
|
134
|
-
clearTimeout(this.timer);
|
|
135
|
-
}
|
|
136
|
-
pointOnCubicBezier(cp, t) {
|
|
137
|
-
const x = Math.pow(1 - t, 2) * cp[0] +
|
|
138
|
-
2 * t * (1 - t) * cp[1] +
|
|
139
|
-
Math.pow(t, 2) * cp[2];
|
|
140
|
-
return x;
|
|
141
|
-
}
|
|
142
|
-
loop() {
|
|
143
|
-
const { animationCallback } = this;
|
|
144
|
-
this.timer = setTimeout(() => {
|
|
145
|
-
const over = !this.isStart && this.endId !== undefined;
|
|
146
|
-
// emit
|
|
147
|
-
animationCallback({ idx: this.idx, isEnd: false });
|
|
148
|
-
// compare
|
|
149
|
-
if (this.idx < this.maxIdx) {
|
|
150
|
-
this.idx++;
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
this.idx = 1;
|
|
154
|
-
}
|
|
155
|
-
// continue
|
|
156
|
-
if (!(over && String(this.idx) === String(this.endId)) && !this.isError) {
|
|
157
|
-
if (this.isSpeedUp) {
|
|
158
|
-
const point = this.pointOnCubicBezier([500, 50, 100], 1 / 10);
|
|
159
|
-
this.speed = point;
|
|
160
|
-
if (this.speed < 100) {
|
|
161
|
-
this.speed = 100;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
const point = this.pointOnCubicBezier([100, 50, 500], 1 / 10);
|
|
166
|
-
this.speed = point;
|
|
167
|
-
if (this.speed > 1000) {
|
|
168
|
-
this.speed = 1000;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
this.loop();
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
if (this.isError)
|
|
175
|
-
return;
|
|
176
|
-
animationCallback({ idx: this.idx, isEnd: true });
|
|
177
|
-
this.idx = -1;
|
|
178
|
-
}
|
|
179
|
-
}, this.speed);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ModalProps } from 'tea-component';
|
|
3
|
-
import type { CommonPropsType, ICompRef } from '../../types';
|
|
4
|
-
export interface PropTypes extends ModalProps, CommonPropsType {
|
|
5
|
-
content: string;
|
|
6
|
-
customButton: React.ReactNode;
|
|
7
|
-
customContent: React.ReactNode;
|
|
8
|
-
isDefaultButton: boolean;
|
|
9
|
-
outerRef: React.Ref<TCompRef>;
|
|
10
|
-
}
|
|
11
|
-
declare type TCompRef = ICompRef<{
|
|
12
|
-
close: () => void;
|
|
13
|
-
open: () => void;
|
|
14
|
-
toggle: () => void;
|
|
15
|
-
}>;
|
|
16
|
-
declare const _default: React.ForwardRefExoticComponent<PropTypes & React.RefAttributes<TCompRef>>;
|
|
17
|
-
export default _default;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { usePlatform } from '../../utils/platform';
|
|
3
|
-
import { ModalPc } from './modal.pc';
|
|
4
|
-
import { ModalH5 } from './modal.h5';
|
|
5
|
-
export default React.forwardRef(function WeDaModal(props, ref) {
|
|
6
|
-
const platform = usePlatform();
|
|
7
|
-
if (platform === 'h5') {
|
|
8
|
-
return React.createElement(ModalH5, { ...props, outerRef: ref });
|
|
9
|
-
}
|
|
10
|
-
return React.createElement(ModalPc, { ...props, outerRef: ref });
|
|
11
|
-
});
|