@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,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { CommonPropsType, ICompRef } from '../../types';
|
|
3
|
-
import './index.css';
|
|
4
|
-
export interface PropsType extends CommonPropsType {
|
|
5
|
-
name?: string;
|
|
6
|
-
value?: any;
|
|
7
|
-
isPureArray?: boolean;
|
|
8
|
-
parent: any;
|
|
9
|
-
}
|
|
10
|
-
declare type TCompRef = ICompRef<{
|
|
11
|
-
addition: () => void;
|
|
12
|
-
remove: (key: string) => void;
|
|
13
|
-
}>;
|
|
14
|
-
export declare const reorderContext: (data: any, name: any, isPureArray: any) => any;
|
|
15
|
-
export declare const newContextItem: (childFormItem: any, name: any, isPureArray: any) => {
|
|
16
|
-
index: number;
|
|
17
|
-
_id: string;
|
|
18
|
-
};
|
|
19
|
-
export declare const changeHandle: ({ type, name, data, childFormItem, isPureArray, params, }: {
|
|
20
|
-
type: any;
|
|
21
|
-
name: any;
|
|
22
|
-
data: any;
|
|
23
|
-
childFormItem: any;
|
|
24
|
-
isPureArray: any;
|
|
25
|
-
params: any;
|
|
26
|
-
}) => any;
|
|
27
|
-
declare const _default: React.ForwardRefExoticComponent<PropsType & React.RefAttributes<TCompRef>>;
|
|
28
|
-
export default _default;
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef, forwardRef, useImperativeHandle, useState, } from 'react';
|
|
2
|
-
import destr from 'destr';
|
|
3
|
-
import classNames from '../../utils/classnames';
|
|
4
|
-
import { usePlatform, randomStr } from '../../utils/platform';
|
|
5
|
-
import isObjectEqual from '../../utils/isObjectEqual';
|
|
6
|
-
import './index.css';
|
|
7
|
-
export const reorderContext = (data, name, isPureArray) => data.map((i, index) => {
|
|
8
|
-
const item = { ...i };
|
|
9
|
-
Object.keys(i).forEach((j) => {
|
|
10
|
-
var _a;
|
|
11
|
-
if ((_a = item[j]) === null || _a === void 0 ? void 0 : _a.name) {
|
|
12
|
-
item[j].name = isPureArray
|
|
13
|
-
? `${name}[${index}]`
|
|
14
|
-
: `${name}[${index}].${j}`;
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
item.index = index;
|
|
18
|
-
return item;
|
|
19
|
-
});
|
|
20
|
-
export const newContextItem = (childFormItem, name, isPureArray) => {
|
|
21
|
-
const mock = { index: 0, _id: randomStr() };
|
|
22
|
-
childFormItem === null || childFormItem === void 0 ? void 0 : childFormItem.forEach((i) => {
|
|
23
|
-
mock[i] = {
|
|
24
|
-
name: isPureArray ? `${name}[0]` : `${name}[0].${i}`,
|
|
25
|
-
value: null,
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
|
-
return mock;
|
|
29
|
-
};
|
|
30
|
-
export const changeHandle = ({ type, name, data, childFormItem, isPureArray, params, }) => {
|
|
31
|
-
switch (type) {
|
|
32
|
-
case 'add': {
|
|
33
|
-
const mock = newContextItem(childFormItem, name, isPureArray);
|
|
34
|
-
data.push({ ...mock, _id: randomStr() });
|
|
35
|
-
data = reorderContext(data, name, isPureArray);
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
case 'remove': {
|
|
39
|
-
data.splice(params.index, 1);
|
|
40
|
-
data = reorderContext(data, name, isPureArray);
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
case 'change': {
|
|
44
|
-
data = data.map((i) => {
|
|
45
|
-
const item = { ...i };
|
|
46
|
-
for (const [key, subItem] of Object.entries(item)) {
|
|
47
|
-
if (params.name === (subItem === null || subItem === void 0 ? void 0 : subItem.name)) {
|
|
48
|
-
item[key].value = params === null || params === void 0 ? void 0 : params.value;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return item;
|
|
52
|
-
});
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
default: {
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return data;
|
|
60
|
-
};
|
|
61
|
-
export default forwardRef(function FormDetail(props, ref) {
|
|
62
|
-
const { className, id, style, children, events, name, value: initDetailValue, isPureArray, parent, } = props;
|
|
63
|
-
const observeRef = useRef(null); // 当前监听对象
|
|
64
|
-
const [defaultValue, setDetailValue] = useState([]);
|
|
65
|
-
const [contextData, setContextData] = useState([]);
|
|
66
|
-
const [childFormItem, setCildFormItem] = useState([]);
|
|
67
|
-
const platform = usePlatform();
|
|
68
|
-
const init = (defaultValue) => {
|
|
69
|
-
var _a;
|
|
70
|
-
const formDetailItemValue = {};
|
|
71
|
-
let childFormItem = defaultValue[0] ? Object.keys(defaultValue[0]) : [];
|
|
72
|
-
// 纯数组,默认key值为'arrayItem'
|
|
73
|
-
if (isPureArray) {
|
|
74
|
-
childFormItem = ['arrayItem'];
|
|
75
|
-
}
|
|
76
|
-
setCildFormItem(childFormItem);
|
|
77
|
-
let initialValues = [];
|
|
78
|
-
try {
|
|
79
|
-
initialValues = defaultValue.map((i, index) => {
|
|
80
|
-
let item = {};
|
|
81
|
-
if (isPureArray) {
|
|
82
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
83
|
-
const val = (i === null || i === void 0 ? void 0 : i.hasOwnProperty('arrayItem')) ? null : i;
|
|
84
|
-
item['arrayItem'] = { name: `${name}[${index}]`, value: val };
|
|
85
|
-
formDetailItemValue[`${name}[${index}]`] = val;
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
item = { ...i };
|
|
89
|
-
Object.keys(i).forEach((j) => {
|
|
90
|
-
const key = `${name}[${index}].${j}`;
|
|
91
|
-
const val = i[j];
|
|
92
|
-
item[j] = { name: key, value: val };
|
|
93
|
-
formDetailItemValue[key] = val;
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
item.index = index;
|
|
97
|
-
item._id = randomStr();
|
|
98
|
-
return item;
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
console.log(error);
|
|
103
|
-
}
|
|
104
|
-
const mock = newContextItem(childFormItem, name, isPureArray);
|
|
105
|
-
const data = (initialValues === null || initialValues === void 0 ? void 0 : initialValues.length) ? initialValues : [mock];
|
|
106
|
-
setContextData(data);
|
|
107
|
-
(_a = events === null || events === void 0 ? void 0 : events.onDataChange) === null || _a === void 0 ? void 0 : _a.call(events, {
|
|
108
|
-
data,
|
|
109
|
-
});
|
|
110
|
-
// 解决web端,编辑场景不回显初始值的问题
|
|
111
|
-
// eslint-disable-next-line rulesdir/no-timer
|
|
112
|
-
setTimeout(() => {
|
|
113
|
-
if (!isObjectEqual(formDetailItemValue, {})) {
|
|
114
|
-
parent.setValue(formDetailItemValue);
|
|
115
|
-
}
|
|
116
|
-
}, 0);
|
|
117
|
-
};
|
|
118
|
-
// 初始化context的值
|
|
119
|
-
useEffect(() => {
|
|
120
|
-
if (!isObjectEqual(initDetailValue, defaultValue)) {
|
|
121
|
-
setDetailValue(initDetailValue);
|
|
122
|
-
init(initDetailValue);
|
|
123
|
-
}
|
|
124
|
-
}, [initDetailValue]);
|
|
125
|
-
useEffect(() => {
|
|
126
|
-
init(initDetailValue);
|
|
127
|
-
setDetailValue(initDetailValue);
|
|
128
|
-
// 组件卸载时触发
|
|
129
|
-
return () => {
|
|
130
|
-
var _a, _b;
|
|
131
|
-
(_a = observeRef.current) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
132
|
-
(_b = events === null || events === void 0 ? void 0 : events.onDataChange) === null || _b === void 0 ? void 0 : _b.call(events, { data: [] });
|
|
133
|
-
};
|
|
134
|
-
}, []);
|
|
135
|
-
const onChange = (type, params) => {
|
|
136
|
-
var _a;
|
|
137
|
-
let data = destr(contextData);
|
|
138
|
-
data = changeHandle({
|
|
139
|
-
type,
|
|
140
|
-
name,
|
|
141
|
-
data,
|
|
142
|
-
childFormItem,
|
|
143
|
-
isPureArray,
|
|
144
|
-
params,
|
|
145
|
-
});
|
|
146
|
-
setContextData(data);
|
|
147
|
-
(_a = events === null || events === void 0 ? void 0 : events.onDataChange) === null || _a === void 0 ? void 0 : _a.call(events, { data });
|
|
148
|
-
};
|
|
149
|
-
useImperativeHandle(ref, () => {
|
|
150
|
-
return {
|
|
151
|
-
methods: {
|
|
152
|
-
addition: () => {
|
|
153
|
-
onChange('add', null);
|
|
154
|
-
},
|
|
155
|
-
remove: (params) => {
|
|
156
|
-
onChange('remove', params);
|
|
157
|
-
},
|
|
158
|
-
change: (params) => {
|
|
159
|
-
onChange('change', params);
|
|
160
|
-
},
|
|
161
|
-
},
|
|
162
|
-
};
|
|
163
|
-
}, [onChange]);
|
|
164
|
-
return (React.createElement("div", { className: classNames({
|
|
165
|
-
'weda-ui': true,
|
|
166
|
-
'form-detail-wrap': true,
|
|
167
|
-
'h5-form-detail-wrap': platform === 'h5',
|
|
168
|
-
[className]: className,
|
|
169
|
-
}), id: id, style: style, role: "container", "data-testid": "formDetail" }, children));
|
|
170
|
-
});
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import './index.css';
|
|
3
|
-
import type { CommonPropsType } from '../../types';
|
|
4
|
-
export interface IGraphicCardPropsType extends CommonPropsType {
|
|
5
|
-
/**
|
|
6
|
-
* 导航配置
|
|
7
|
-
*/
|
|
8
|
-
navOption?: Array<any>;
|
|
9
|
-
titleVisible: boolean;
|
|
10
|
-
titleColor: string;
|
|
11
|
-
titleFontWeight: string;
|
|
12
|
-
titleFontSize: number;
|
|
13
|
-
titleLineHeight: string;
|
|
14
|
-
titleMaxLines: number;
|
|
15
|
-
desColor: string;
|
|
16
|
-
desFontWeight: string;
|
|
17
|
-
desVisible: boolean;
|
|
18
|
-
desFontSize: number;
|
|
19
|
-
desLineHeight: string;
|
|
20
|
-
desMaxLines: number;
|
|
21
|
-
buttonVisible: boolean;
|
|
22
|
-
buttonText: string;
|
|
23
|
-
ColMobile: number;
|
|
24
|
-
ColPC: number;
|
|
25
|
-
percentageVisible: boolean;
|
|
26
|
-
iconWidthSize: string;
|
|
27
|
-
iconHeightSize: string;
|
|
28
|
-
textAlign?: 'start' | 'end' | 'left' | 'right' | 'center' | 'justify';
|
|
29
|
-
imageStyle: any;
|
|
30
|
-
}
|
|
31
|
-
export default function GraphicCard({ navOption, ColMobile, ColPC, iconWidthSize, iconHeightSize, titleVisible, desVisible, buttonVisible, textAlign, className, titleColor, titleFontWeight, titleFontSize, titleLineHeight, titleMaxLines, desColor, desFontWeight, desFontSize, desLineHeight, desMaxLines, buttonText, style, }: IGraphicCardPropsType): JSX.Element;
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import './index.css';
|
|
3
|
-
import classNames from '../../utils/classnames';
|
|
4
|
-
import { Row, Col, ConfigProvider, Button, Text } from 'tea-component';
|
|
5
|
-
import { usePlatform } from '../../utils/platform';
|
|
6
|
-
import { IconFont } from 'tdesign-icons-react';
|
|
7
|
-
import Image from '../image';
|
|
8
|
-
const CLASS_PREFIX = 'weda-graphic-card';
|
|
9
|
-
export default function GraphicCard({ navOption, ColMobile, ColPC, iconWidthSize, iconHeightSize, titleVisible, desVisible, buttonVisible, textAlign, className, titleColor, titleFontWeight, titleFontSize, titleLineHeight, titleMaxLines, desColor, desFontWeight, desFontSize, desLineHeight, desMaxLines, buttonText, style, }) {
|
|
10
|
-
const platform = usePlatform();
|
|
11
|
-
const isH5 = platform === 'h5';
|
|
12
|
-
// 一个栅格的宽度
|
|
13
|
-
const [SingleGrid, setSingleGrid] = useState({ width: 10 });
|
|
14
|
-
const [colCount, setColCount] = React.useState(2);
|
|
15
|
-
const cls = classNames({
|
|
16
|
-
[CLASS_PREFIX]: true,
|
|
17
|
-
[className]: className,
|
|
18
|
-
[`${CLASS_PREFIX}-mobile`]: isH5,
|
|
19
|
-
});
|
|
20
|
-
const cardList = React.useMemo(() => {
|
|
21
|
-
const list = [];
|
|
22
|
-
const col = isH5 ? ColMobile : ColPC;
|
|
23
|
-
setColCount(col);
|
|
24
|
-
list.length = Math.floor(navOption.length / colCount);
|
|
25
|
-
list.forEach((item, index) => {
|
|
26
|
-
list[index] = [];
|
|
27
|
-
});
|
|
28
|
-
//debugger;
|
|
29
|
-
navOption.forEach((item, index) => {
|
|
30
|
-
const _index = Math.floor(index / colCount);
|
|
31
|
-
if (!list[_index] || list[_index].length <= 0) {
|
|
32
|
-
// 保证每个col 的数据都是有的,列入总共7个数据,那么第二行的3, 4,5数据是undefined, 占位
|
|
33
|
-
list[_index] = Array(colCount).fill(null);
|
|
34
|
-
}
|
|
35
|
-
const paramObj = {};
|
|
36
|
-
if (item === null || item === void 0 ? void 0 : item.params) {
|
|
37
|
-
for (const info of item.params) {
|
|
38
|
-
paramObj[info.key] = info.value;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
item.paramObj = paramObj;
|
|
42
|
-
list[_index][index - _index * colCount] = item;
|
|
43
|
-
list[_index][index - _index * colCount] = item;
|
|
44
|
-
});
|
|
45
|
-
return list;
|
|
46
|
-
}, [colCount, navOption, isH5]);
|
|
47
|
-
const elementStyle = document.createElement('body').style;
|
|
48
|
-
const vendor = (() => {
|
|
49
|
-
const transformNames = {
|
|
50
|
-
webkit: 'webkitTransform',
|
|
51
|
-
Moz: 'MozTransform',
|
|
52
|
-
O: 'OTransform',
|
|
53
|
-
ms: 'msTransform',
|
|
54
|
-
standard: 'transform',
|
|
55
|
-
};
|
|
56
|
-
for (const key in transformNames) {
|
|
57
|
-
if (elementStyle[transformNames[key]] !== undefined) {
|
|
58
|
-
return key;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return false;
|
|
62
|
-
})();
|
|
63
|
-
function prefixStyle(style) {
|
|
64
|
-
if (vendor === false) {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
if (vendor === 'standard') {
|
|
68
|
-
return style;
|
|
69
|
-
}
|
|
70
|
-
return '-' + vendor + style.charAt(0).toUpperCase() + style.substr(1);
|
|
71
|
-
}
|
|
72
|
-
const boxStyle = prefixStyle('-box');
|
|
73
|
-
//标题样式
|
|
74
|
-
const titleStyle = {
|
|
75
|
-
display: `${boxStyle}`,
|
|
76
|
-
WebkitLineClamp: `${titleMaxLines ? titleMaxLines : 'inherit'}`,
|
|
77
|
-
overflow: 'hidden',
|
|
78
|
-
color: `${titleColor}`,
|
|
79
|
-
fontWeight: `${titleFontWeight}`,
|
|
80
|
-
fontSize: `${titleFontSize}` + 'px',
|
|
81
|
-
textAlign: `${textAlign}`,
|
|
82
|
-
lineHeight: `${titleLineHeight == 'auto' ? 'normal' : titleLineHeight}`,
|
|
83
|
-
};
|
|
84
|
-
const desStyle = {
|
|
85
|
-
display: `${boxStyle}`,
|
|
86
|
-
WebkitLineClamp: `${desMaxLines ? desMaxLines : 'inherit'}`,
|
|
87
|
-
overflow: 'hidden',
|
|
88
|
-
color: `${desColor}`,
|
|
89
|
-
fontWeight: `${desFontWeight}`,
|
|
90
|
-
fontSize: `${desFontSize}` + 'px',
|
|
91
|
-
textAlign: `${textAlign}`,
|
|
92
|
-
lineHeight: `${desLineHeight == 'auto' ? 'normal' : desLineHeight}`,
|
|
93
|
-
};
|
|
94
|
-
// 图片高度: 100% 基础下 H5: 1列 200px;2列 98px PC: 3列 220px 4列 162px
|
|
95
|
-
const imageStyle = React.useMemo(() => {
|
|
96
|
-
let width = '100%';
|
|
97
|
-
let height = platform === 'h5' ? '200' : '220';
|
|
98
|
-
if (platform === 'h5' && ColMobile === 2) {
|
|
99
|
-
height = '98';
|
|
100
|
-
}
|
|
101
|
-
if (platform !== 'h5' && ColPC === 4) {
|
|
102
|
-
height = '162';
|
|
103
|
-
}
|
|
104
|
-
const numReg = /^\d+$/;
|
|
105
|
-
width = numReg.test(iconWidthSize) ? iconWidthSize + 'px' : iconWidthSize;
|
|
106
|
-
height = numReg.test(iconHeightSize)
|
|
107
|
-
? iconHeightSize + 'px' //纯数字
|
|
108
|
-
: iconHeightSize.indexOf('%') == -1
|
|
109
|
-
? iconHeightSize
|
|
110
|
-
: (Number(height) * parseInt(iconHeightSize)) / 100 + 'px';
|
|
111
|
-
return { width, height };
|
|
112
|
-
}, [iconWidthSize, iconHeightSize, ColMobile, ColPC, isH5]);
|
|
113
|
-
const tapTo = (colInfo = navOption[0]) => {
|
|
114
|
-
switch (colInfo === null || colInfo === void 0 ? void 0 : colInfo.tapStatus) {
|
|
115
|
-
case 'tap':
|
|
116
|
-
return null;
|
|
117
|
-
case 'inside':
|
|
118
|
-
if (colInfo.insideUrl) {
|
|
119
|
-
app.navigateTo({
|
|
120
|
-
mode: 'weDa',
|
|
121
|
-
pageId: colInfo.insideUrl,
|
|
122
|
-
params: (colInfo === null || colInfo === void 0 ? void 0 : colInfo.withParams) && (colInfo === null || colInfo === void 0 ? void 0 : colInfo.params.length) > 0
|
|
123
|
-
? colInfo.paramObj
|
|
124
|
-
: null,
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
break;
|
|
128
|
-
//return renderCancel();
|
|
129
|
-
case 'outer':
|
|
130
|
-
if (colInfo.newPage) {
|
|
131
|
-
colInfo.outerUrl ? window.open(colInfo.outerUrl) : false;
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
colInfo.outerUrl ? (window.location.href = colInfo.outerUrl) : false;
|
|
135
|
-
}
|
|
136
|
-
break;
|
|
137
|
-
default:
|
|
138
|
-
return null;
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
|
|
142
|
-
React.createElement("div", { className: cls, "data-testid": "graphicCard", style: style },
|
|
143
|
-
React.createElement("div", { className: `${CLASS_PREFIX}__wrapper` }, cardList.map((row, rowIndex) => {
|
|
144
|
-
return (React.createElement(Row, { className: `${CLASS_PREFIX}__row`, key: rowIndex },
|
|
145
|
-
React.createElement(React.Fragment, null, row &&
|
|
146
|
-
row.map((col, colIndex) => {
|
|
147
|
-
return (
|
|
148
|
-
// 每列内容左右间距为0.1栅格列宽
|
|
149
|
-
React.createElement(Col, { style: {
|
|
150
|
-
width: `${(1 / colCount) * 100}%`,
|
|
151
|
-
padding: `0 ${SingleGrid.width * 0.1}px`,
|
|
152
|
-
cursor: (col === null || col === void 0 ? void 0 : col.tapStatus) != 'tap' ? 'pointer' : 'auto',
|
|
153
|
-
}, className: `${CLASS_PREFIX}__col ${CLASS_PREFIX}__col--${textAlign}`, key: colIndex },
|
|
154
|
-
React.createElement("div", { className: "wedatea2td-grid__box", "data-testid": `${colIndex}_click`, onClick: () => tapTo(col) },
|
|
155
|
-
React.createElement("div", { className: `${CLASS_PREFIX}__col-body` },
|
|
156
|
-
col && (React.createElement("div", { className: `${CLASS_PREFIX}__icon`, style: imageStyle },
|
|
157
|
-
React.createElement(Image, { mode: 'scaleToFill', lazyLoad: false, maskClosable: false, imgPreview: false, fit: 'cover', alt: '', src: col === null || col === void 0 ? void 0 : col.icon, className: `${CLASS_PREFIX}__img` }))),
|
|
158
|
-
React.createElement("div", { className: `${CLASS_PREFIX}__detail` },
|
|
159
|
-
titleVisible && (col === null || col === void 0 ? void 0 : col.title) && (React.createElement("div", { className: `${CLASS_PREFIX}__title`, style: titleStyle }, col === null || col === void 0 ? void 0 : col.title)),
|
|
160
|
-
desVisible && (col === null || col === void 0 ? void 0 : col.des) && (React.createElement("div", { className: `${CLASS_PREFIX}__desc`, style: desStyle }, col === null || col === void 0 ? void 0 : col.des)))),
|
|
161
|
-
buttonVisible && col && (React.createElement(Button, { type: "link", className: `${CLASS_PREFIX}__btn` },
|
|
162
|
-
React.createElement(Text, { className: `${CLASS_PREFIX}__btn--text` }, buttonText),
|
|
163
|
-
React.createElement(IconFont, { name: "arrow-right", className: `${CLASS_PREFIX}__btn-icon` }))))));
|
|
164
|
-
}))));
|
|
165
|
-
})))));
|
|
166
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { PropsType } from './index';
|
|
3
|
-
interface ImageInnerPropsType extends Omit<PropsType, 'fit' | 'mode'> {
|
|
4
|
-
objectFit: React.CSSProperties['objectFit'];
|
|
5
|
-
isError: boolean;
|
|
6
|
-
setIsError: React.Dispatch<React.SetStateAction<boolean>>;
|
|
7
|
-
}
|
|
8
|
-
export declare function ImageInner({ objectFit, style, className, alt, src, isError, setIsError, events, lazyLoad, maskClosable, imgPreview, }: ImageInnerPropsType): JSX.Element;
|
|
9
|
-
export {};
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ConfigProvider, ImagePreview } from 'tea-component';
|
|
3
|
-
import { usePlatform } from '../../utils/platform';
|
|
4
|
-
import { useGesture } from '@use-gesture/react';
|
|
5
|
-
export function ImageInner({ objectFit, style, className, alt, src, isError, setIsError, events, lazyLoad, maskClosable, imgPreview, }) {
|
|
6
|
-
const platform = usePlatform();
|
|
7
|
-
const [imgShow, setImgShow] = React.useState(false);
|
|
8
|
-
const onMaskClick = () => {
|
|
9
|
-
if (maskClosable) {
|
|
10
|
-
setImgShow(false);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
const [showHeight, setShowHeight] = React.useState(0);
|
|
14
|
-
const realWidth = React.useRef(0);
|
|
15
|
-
const realHeight = React.useRef(0);
|
|
16
|
-
const [offsetHeight, setOffsetHeight] = React.useState(0);
|
|
17
|
-
const [translateX, setTranslateX] = React.useState(0);
|
|
18
|
-
const [translateY, setTranslateY] = React.useState(0);
|
|
19
|
-
const [previewScale, setPreviewScale] = React.useState(1);
|
|
20
|
-
React.useEffect(() => {
|
|
21
|
-
// 防止触发浏览器的放大缩小
|
|
22
|
-
const handler = (e) => e.preventDefault();
|
|
23
|
-
document.addEventListener('gesturestart', handler);
|
|
24
|
-
document.addEventListener('gesturechange', handler);
|
|
25
|
-
return () => {
|
|
26
|
-
document.removeEventListener('gesturestart', handler);
|
|
27
|
-
document.removeEventListener('gesturechange', handler);
|
|
28
|
-
};
|
|
29
|
-
}, []);
|
|
30
|
-
const bind = useGesture({
|
|
31
|
-
onClick: ({ event }) => {
|
|
32
|
-
// 防止冒泡出发关闭预览
|
|
33
|
-
event.stopPropagation();
|
|
34
|
-
},
|
|
35
|
-
onPinch: ({ offset }) => {
|
|
36
|
-
const [s] = offset;
|
|
37
|
-
setPreviewScale(s);
|
|
38
|
-
},
|
|
39
|
-
onDrag: ({ offset, event }) => {
|
|
40
|
-
event.stopPropagation();
|
|
41
|
-
const [x, y] = offset;
|
|
42
|
-
setTranslateX(x);
|
|
43
|
-
setTranslateY(y);
|
|
44
|
-
},
|
|
45
|
-
}, {
|
|
46
|
-
drag: {
|
|
47
|
-
delay: true,
|
|
48
|
-
preventDefault: true,
|
|
49
|
-
},
|
|
50
|
-
pinch: {
|
|
51
|
-
scaleBounds: { min: 0.6, max: 5 },
|
|
52
|
-
pointer: {
|
|
53
|
-
touch: true,
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
if (platform === 'h5' || !imgPreview || isError) {
|
|
58
|
-
return (React.createElement(React.Fragment, null,
|
|
59
|
-
React.createElement("img", { style: {
|
|
60
|
-
objectFit,
|
|
61
|
-
...style,
|
|
62
|
-
}, className: className, alt: alt, src: src, onLoad: (e) => {
|
|
63
|
-
const img = e.target;
|
|
64
|
-
const { naturalHeight, naturalWidth } = img;
|
|
65
|
-
realHeight.current = naturalHeight;
|
|
66
|
-
realWidth.current = naturalWidth;
|
|
67
|
-
setIsError(false);
|
|
68
|
-
events.load && events.load({}, { originEvent: e });
|
|
69
|
-
}, onError: (e) => {
|
|
70
|
-
setIsError(true);
|
|
71
|
-
events.error && events.error({}, { originEvent: e });
|
|
72
|
-
}, onClick: (e) => {
|
|
73
|
-
if (imgPreview && !isError) {
|
|
74
|
-
setTranslateX(0);
|
|
75
|
-
setTranslateY(0);
|
|
76
|
-
setPreviewScale(1);
|
|
77
|
-
const windowHeight = window.innerHeight;
|
|
78
|
-
const windowWidth = window.innerWidth;
|
|
79
|
-
let ratio = realWidth.current / realHeight.current;
|
|
80
|
-
if (Number.isNaN(ratio)) {
|
|
81
|
-
ratio = 1;
|
|
82
|
-
}
|
|
83
|
-
const height = windowWidth / ratio;
|
|
84
|
-
setOffsetHeight(windowHeight / 2 - height / 2);
|
|
85
|
-
setShowHeight(height);
|
|
86
|
-
setImgShow(true);
|
|
87
|
-
}
|
|
88
|
-
events.tap && events.tap({}, { originEvent: e });
|
|
89
|
-
}, loading: lazyLoad ? 'lazy' : undefined }),
|
|
90
|
-
imgShow && (React.createElement("div", { className: "weda-img-mask", onClick: onMaskClick },
|
|
91
|
-
React.createElement("div", { onClick: () => setImgShow(false), className: "weda-img-modal-close-btn" },
|
|
92
|
-
React.createElement("i", { className: "weui-icon-clear", style: { color: 'white' } })),
|
|
93
|
-
React.createElement("div", { ...bind(), className: "weda-img-preview", style: {
|
|
94
|
-
touchAction: 'none',
|
|
95
|
-
backgroundImage: `url(${src})`,
|
|
96
|
-
width: '100%',
|
|
97
|
-
height: showHeight,
|
|
98
|
-
marginTop: offsetHeight,
|
|
99
|
-
transform: `translate(${translateX}px, ${translateY}px) scale(${previewScale})`,
|
|
100
|
-
} })))));
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
|
|
104
|
-
React.createElement(ImagePreview, { previewSrc: src, maskClosable: maskClosable, className: className, style: { ...style, objectFit } }, (open) => (React.createElement("img", { style: {
|
|
105
|
-
objectFit,
|
|
106
|
-
cursor: 'zoom-in',
|
|
107
|
-
...style,
|
|
108
|
-
}, className: className, alt: alt, src: src, onLoad: (e) => {
|
|
109
|
-
setIsError(false);
|
|
110
|
-
events.load && events.load({}, { originEvent: e });
|
|
111
|
-
}, onError: (e) => {
|
|
112
|
-
setIsError(true);
|
|
113
|
-
events.error && events.error({}, { originEvent: e });
|
|
114
|
-
}, loading: lazyLoad ? 'lazy' : undefined, onClick: (e) => {
|
|
115
|
-
open();
|
|
116
|
-
events.tap && events.tap({}, { originEvent: e });
|
|
117
|
-
} })))));
|
|
118
|
-
}
|
|
119
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import './index.css';
|
|
3
|
-
import type { CommonPropsType } from '../../types';
|
|
4
|
-
declare type TMode = 'scaleToFill' | 'aspectFit' | 'aspectFill' | 'widthFix' | 'heightFix' | 'top' | 'bottom' | 'center' | 'left' | 'right' | 'top left' | 'top right' | 'bottom left' | 'bottom right';
|
|
5
|
-
export interface PropsType extends CommonPropsType, Pick<HTMLImageElement, 'src' | 'alt'> {
|
|
6
|
-
mode: TMode;
|
|
7
|
-
lazyLoad: boolean;
|
|
8
|
-
maskClosable: boolean;
|
|
9
|
-
imgPreview: boolean;
|
|
10
|
-
fit: React.CSSProperties['objectFit'] | ('widthFix' | 'heightFix');
|
|
11
|
-
}
|
|
12
|
-
export default function Image({ className, events, style, src, alt, mode, lazyLoad, imgPreview, maskClosable, fit, }: PropsType): JSX.Element;
|
|
13
|
-
export {};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useState, useEffect, useMemo } from 'react';
|
|
3
|
-
import classNames from '../../utils/classnames';
|
|
4
|
-
import './index.css';
|
|
5
|
-
import { ImageInner } from './image';
|
|
6
|
-
import { emptyObject } from '../../utils/constant';
|
|
7
|
-
export default function Image({
|
|
8
|
-
// 系统属性
|
|
9
|
-
className, events = emptyObject, style,
|
|
10
|
-
// 组件属性
|
|
11
|
-
src, alt, mode, lazyLoad, imgPreview, maskClosable, fit, }) {
|
|
12
|
-
const [isError, setIsError] = useState(false);
|
|
13
|
-
const cls = classNames({
|
|
14
|
-
'weda-ui': true,
|
|
15
|
-
'weda-image': true,
|
|
16
|
-
'weda-image-error': isError,
|
|
17
|
-
[className]: className,
|
|
18
|
-
});
|
|
19
|
-
const objectFit = fit || getObjectFitByWxImageMode(mode);
|
|
20
|
-
const [realSrc, setRealSrc] = useState(/^cloud:\/\//.test(src) ? undefined : src);
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
if (/^cloud:\/\//.test(src)) {
|
|
23
|
-
window.app.cloud
|
|
24
|
-
.getTempFileURL(src)
|
|
25
|
-
.then((res) => {
|
|
26
|
-
setRealSrc(res || '');
|
|
27
|
-
})
|
|
28
|
-
.catch(() => {
|
|
29
|
-
setRealSrc('');
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
setRealSrc(src);
|
|
34
|
-
}
|
|
35
|
-
}, [src]);
|
|
36
|
-
/**
|
|
37
|
-
* 模拟小程序的widthFix、heightFix模式
|
|
38
|
-
*/
|
|
39
|
-
const realFit = useMemo(() => {
|
|
40
|
-
if (objectFit === 'widthFix' || objectFit === 'heightFix') {
|
|
41
|
-
return 'scale-down';
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
return objectFit;
|
|
45
|
-
}
|
|
46
|
-
}, [objectFit]);
|
|
47
|
-
const realStyle = useMemo(() => {
|
|
48
|
-
if (objectFit === 'widthFix') {
|
|
49
|
-
return {
|
|
50
|
-
...style,
|
|
51
|
-
height: 'auto',
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
else if (objectFit === 'heightFix') {
|
|
55
|
-
return {
|
|
56
|
-
...style,
|
|
57
|
-
width: 'auto',
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
return style;
|
|
62
|
-
}
|
|
63
|
-
}, [style, fit]);
|
|
64
|
-
return src === realSrc || (realSrc !== undefined && src !== realSrc) ? (React.createElement(ImageInner, { objectFit: realFit, style: realStyle, className: cls, alt: alt, src: realSrc, isError: isError, setIsError: setIsError, events: events, lazyLoad: lazyLoad, imgPreview: imgPreview, maskClosable: maskClosable })) : null;
|
|
65
|
-
}
|
|
66
|
-
function getObjectFitByWxImageMode(mode) {
|
|
67
|
-
const array = [
|
|
68
|
-
{
|
|
69
|
-
mode: 'scaleToFill',
|
|
70
|
-
h5: 'fill',
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
mode: 'aspectFit',
|
|
74
|
-
h5: 'contain',
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
mode: 'aspectFill',
|
|
78
|
-
h5: 'cover',
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
mode: 'widthFix',
|
|
82
|
-
h5: 'cover',
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
mode: 'heightFix',
|
|
86
|
-
h5: 'contain',
|
|
87
|
-
},
|
|
88
|
-
];
|
|
89
|
-
const item = array.find((item) => item.mode === mode);
|
|
90
|
-
return item === null || item === void 0 ? void 0 : item.h5;
|
|
91
|
-
}
|