@cloudbase/weda-ui 2.0.27 → 3.1.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/CHANGELOG.md +7 -0
- package/dist/configs/actions/showModal.json +48 -0
- package/dist/configs/actions/showToast.json +41 -0
- package/dist/configs/components/auth.json +16 -0
- package/dist/configs/components/button.json +239 -0
- package/dist/configs/components/calendar.json +81 -0
- package/dist/configs/components/carousel.json +292 -0
- package/dist/configs/components/chart/bar.json +721 -0
- package/dist/configs/components/chart/line.json +674 -0
- package/dist/configs/components/chart/pie.json +494 -0
- package/dist/configs/components/chart/statisticsCard.json +376 -0
- package/dist/configs/components/container.json +50 -0
- package/dist/configs/components/dataView.json +239 -0
- package/dist/configs/components/drawer.json +115 -0
- package/dist/configs/components/form/checkbox.json +178 -0
- package/dist/configs/components/form/form.json +45 -0
- package/dist/configs/components/form/input.json +154 -0
- package/dist/configs/components/form/location.json +248 -0
- package/dist/configs/components/form/radio.json +203 -0
- package/dist/configs/components/form/richText.json +125 -0
- package/dist/configs/components/form/select.json +430 -0
- package/dist/configs/components/form/switch.json +58 -0
- package/dist/configs/components/form/textarea.json +116 -0
- package/dist/configs/components/form/tips.json +34 -0
- package/dist/configs/components/form/uploader.json +171 -0
- package/dist/configs/components/form/uploaderFile.json +158 -0
- package/dist/configs/components/graphicCard.json +413 -0
- package/dist/configs/components/image.json +187 -0
- package/dist/configs/components/link.json +79 -0
- package/dist/configs/components/listView.json +370 -0
- package/dist/configs/components/lottery.json +163 -0
- package/dist/configs/components/modal.json +72 -0
- package/dist/configs/components/navLayout.json +368 -0
- package/dist/configs/components/navigationBar.json +62 -0
- package/dist/configs/components/richtextview.json +26 -0
- package/dist/configs/components/scrollVeiw.json +253 -0
- package/dist/configs/components/slot.json +17 -0
- package/dist/configs/components/swiper.json +90 -0
- package/dist/configs/components/tabs.json +121 -0
- package/dist/configs/components/text.json +95 -0
- package/dist/configs/components/wedaVideo.json +89 -0
- package/dist/configs/components/wxOpenApi/phone.json +127 -0
- package/dist/configs/components/wxOpenApi/phoneCode.json +109 -0
- package/dist/configs/components/wxOpenApi/share.json +157 -0
- package/dist/configs/components/wxOpenApi/userInfo.json +156 -0
- package/dist/configs/index.d.ts +97 -0
- package/{src → dist}/configs/index.js +51 -57
- package/dist/docs/common/format.d.ts +13 -0
- package/dist/docs/common/format.js +103 -0
- package/dist/docs/common/tableView.d.ts +30 -0
- package/dist/docs/common/tableView.js +159 -0
- package/dist/index.d.ts +2 -0
- package/{src → dist}/index.js +0 -1
- package/dist/setupTests.d.ts +1 -0
- package/dist/setupTests.js +14 -0
- package/dist/web/actions/index.d.ts +2 -0
- package/{src → dist}/web/actions/index.js +0 -0
- package/dist/web/actions/showModal/index.d.ts +3 -0
- package/dist/web/actions/showModal/index.js +66 -0
- package/dist/web/actions/showToast/index.d.ts +1 -0
- package/dist/web/actions/showToast/index.js +3 -0
- package/dist/web/components/auth/index.d.ts +10 -0
- package/dist/web/components/auth/index.js +37 -0
- package/{src → dist}/web/components/button/index.css +2 -2
- package/dist/web/components/button/index.d.ts +32 -0
- package/dist/web/components/button/index.js +48 -0
- package/{src → dist}/web/components/calendar/index.css +29 -29
- package/dist/web/components/calendar/index.d.ts +19 -0
- package/dist/web/components/calendar/index.js +181 -0
- package/dist/web/components/calendar/util.d.ts +13 -0
- package/dist/web/components/calendar/util.js +74 -0
- package/{src → dist}/web/components/carousel/index.css +11 -11
- package/dist/web/components/carousel/index.d.ts +41 -0
- package/dist/web/components/carousel/index.js +240 -0
- package/dist/web/components/chart/bar/index.d.ts +41 -0
- package/dist/web/components/chart/bar/index.js +56 -0
- package/dist/web/components/chart/common/config/bar.d.ts +48 -0
- package/dist/web/components/chart/common/config/bar.js +49 -0
- package/dist/web/components/chart/common/config/global.d.ts +13 -0
- package/dist/web/components/chart/common/config/global.js +16 -0
- package/dist/web/components/chart/common/config/line.d.ts +46 -0
- package/dist/web/components/chart/common/config/line.js +49 -0
- package/dist/web/components/chart/common/config/pie.d.ts +29 -0
- package/dist/web/components/chart/common/config/pie.js +36 -0
- package/dist/web/components/chart/common/core/eChartBar.d.ts +32 -0
- package/dist/web/components/chart/common/core/eChartBar.js +196 -0
- package/dist/web/components/chart/common/core/eChartBase.d.ts +128 -0
- package/dist/web/components/chart/common/core/eChartBase.js +346 -0
- package/dist/web/components/chart/common/core/eChartLine.d.ts +28 -0
- package/dist/web/components/chart/common/core/eChartLine.js +168 -0
- package/dist/web/components/chart/common/core/eChartPie.d.ts +28 -0
- package/dist/web/components/chart/common/core/eChartPie.js +132 -0
- package/dist/web/components/chart/common/core/type.d.ts +35 -0
- package/dist/web/components/chart/common/core/type.js +9 -0
- package/dist/web/components/chart/common/echarts.d.ts +2 -0
- package/{src/web/components/chart/common/echarts.ts → dist/web/components/chart/common/echarts.js} +12 -19
- package/dist/web/components/chart/common/useChart.d.ts +8 -0
- package/dist/web/components/chart/common/useChart.js +60 -0
- package/dist/web/components/chart/line/index.d.ts +39 -0
- package/dist/web/components/chart/line/index.js +53 -0
- package/dist/web/components/chart/pie/index.d.ts +27 -0
- package/dist/web/components/chart/pie/index.js +40 -0
- package/{src → dist}/web/components/chart/statisticsCard/index.css +12 -12
- package/dist/web/components/chart/statisticsCard/index.d.ts +85 -0
- package/dist/web/components/chart/statisticsCard/index.js +203 -0
- package/dist/web/components/chart/statisticsCard/interface.d.ts +13 -0
- package/dist/web/components/chart/statisticsCard/interface.js +1 -0
- package/dist/web/components/container/index.d.ts +6 -0
- package/dist/web/components/container/index.js +6 -0
- package/dist/web/components/dataView/index.d.ts +6 -0
- package/dist/web/components/dataView/index.js +8 -0
- package/{src/web/components/dataView/interface.ts → dist/web/components/dataView/interface.d.ts} +1 -2
- package/dist/web/components/dataView/interface.js +1 -0
- package/dist/web/components/drawer/index.d.ts +13 -0
- package/dist/web/components/drawer/index.js +12 -0
- package/dist/web/components/form/checkbox/index.d.ts +13 -0
- package/dist/web/components/form/checkbox/index.js +167 -0
- package/dist/web/components/form/enumSelect/MultipleSelect.d.ts +78 -0
- package/dist/web/components/form/enumSelect/MultipleSelect.js +52 -0
- package/dist/web/components/form/enumSelect/NormalSelect.d.ts +83 -0
- package/dist/web/components/form/enumSelect/NormalSelect.js +52 -0
- package/dist/web/components/form/enumSelect/SelectContainer.d.ts +16 -0
- package/dist/web/components/form/enumSelect/SelectContainer.js +30 -0
- package/dist/web/components/form/enumSelect/index.d.ts +82 -0
- package/{src/web/components/form/enumSelect/index.jsx → dist/web/components/form/enumSelect/index.js} +1 -4
- package/dist/web/components/form/enumSelect/props/defaultProps.d.ts +34 -0
- package/dist/web/components/form/enumSelect/props/defaultProps.js +40 -0
- package/dist/web/components/form/enumSelect/props/propsTypes.d.ts +39 -0
- package/dist/web/components/form/enumSelect/props/propsTypes.js +47 -0
- package/{src → dist}/web/components/form/form/index.css +2 -2
- package/dist/web/components/form/form/index.d.ts +13 -0
- package/dist/web/components/form/form/index.js +31 -0
- package/{src → dist}/web/components/form/formcell/index.css +14 -14
- package/dist/web/components/form/formcell/index.d.ts +8 -0
- package/dist/web/components/form/formcell/index.js +40 -0
- package/{src → dist}/web/components/form/input/index.css +3 -3
- package/dist/web/components/form/input/index.d.ts +14 -0
- package/dist/web/components/form/input/index.js +86 -0
- package/dist/web/components/form/location/common/mapChoose.css +477 -0
- package/dist/web/components/form/location/common/mapChoose.d.ts +15 -0
- package/dist/web/components/form/location/common/mapChoose.js +431 -0
- package/dist/web/components/form/location/common/mapView.d.ts +19 -0
- package/dist/web/components/form/location/common/mapView.js +170 -0
- package/dist/web/components/form/location/common/propsConfig.d.ts +62 -0
- package/dist/web/components/form/location/common/propsConfig.js +52 -0
- package/{src → dist}/web/components/form/location/common/selectModal.css +11 -10
- package/dist/web/components/form/location/common/selectModal.d.ts +21 -0
- package/dist/web/components/form/location/common/selectModal.js +44 -0
- package/dist/web/components/form/location/common/useLocationInfo.d.ts +34 -0
- package/dist/web/components/form/location/common/useLocationInfo.js +88 -0
- package/dist/web/components/form/location/components/LocationH5/index.css +100 -0
- package/dist/web/components/form/location/components/LocationH5/location.h5.d.ts +8 -0
- package/dist/web/components/form/location/components/LocationH5/location.h5.js +347 -0
- package/dist/web/components/form/location/components/LocationPC/Header.d.ts +12 -0
- package/dist/web/components/form/location/components/LocationPC/Header.js +43 -0
- package/{src → dist}/web/components/form/location/components/LocationPC/index.css +10 -14
- package/dist/web/components/form/location/components/LocationPC/location.PC.d.ts +8 -0
- package/dist/web/components/form/location/components/LocationPC/location.PC.js +259 -0
- package/dist/web/components/form/location/constants.d.ts +2 -0
- package/{src → dist}/web/components/form/location/constants.js +0 -1
- package/dist/web/components/form/location/index.css +13 -0
- package/dist/web/components/form/location/index.d.ts +1 -0
- package/dist/web/components/form/location/index.js +17 -0
- package/{src → dist}/web/components/form/radio/index.css +0 -0
- package/dist/web/components/form/radio/index.d.ts +11 -0
- package/dist/web/components/form/radio/index.js +115 -0
- package/dist/web/components/form/renderDecorator.d.ts +6 -0
- package/dist/web/components/form/renderDecorator.js +20 -0
- package/dist/web/components/form/select/h5.d.ts +16 -0
- package/dist/web/components/form/select/h5.js +502 -0
- package/{src → dist}/web/components/form/select/index.css +4 -4
- package/dist/web/components/form/select/index.d.ts +65 -0
- package/dist/web/components/form/select/index.js +299 -0
- package/dist/web/components/form/select/region/index.d.ts +6 -0
- package/dist/web/components/form/select/region/index.js +147 -0
- package/dist/web/components/form/select/time.d.ts +9 -0
- package/dist/web/components/form/select/time.js +146 -0
- package/dist/web/components/form/select/year.d.ts +7 -0
- package/dist/web/components/form/select/year.js +72 -0
- package/dist/web/components/form/switch/index.d.ts +6 -0
- package/dist/web/components/form/switch/index.js +57 -0
- package/{src → dist}/web/components/form/textarea/index.css +1 -1
- package/dist/web/components/form/textarea/index.d.ts +12 -0
- package/dist/web/components/form/textarea/index.js +66 -0
- package/{src → dist}/web/components/form/tips/index.css +0 -0
- package/dist/web/components/form/tips/index.d.ts +8 -0
- package/dist/web/components/form/tips/index.js +17 -0
- package/{src → dist}/web/components/form/uploader/index.css +14 -14
- package/dist/web/components/form/uploader/index.d.ts +3 -0
- package/dist/web/components/form/uploader/index.js +42 -0
- package/dist/web/components/form/uploader/uploader.h5.d.ts +19 -0
- package/dist/web/components/form/uploader/uploader.h5.js +201 -0
- package/dist/web/components/form/uploader/uploader.pc.d.ts +29 -0
- package/dist/web/components/form/uploader/uploader.pc.js +182 -0
- package/{src → dist}/web/components/form/uploaderFile/index.css +62 -62
- package/dist/web/components/form/uploaderFile/index.d.ts +4 -0
- package/dist/web/components/form/uploaderFile/index.js +19 -0
- package/dist/web/components/form/uploaderFile/uploadFile.h5.d.ts +23 -0
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +315 -0
- package/dist/web/components/form/uploaderFile/uploadFile.pc.d.ts +24 -0
- package/dist/web/components/form/uploaderFile/uploadFile.pc.js +290 -0
- package/{src → dist}/web/components/graphicCard/index.css +15 -15
- package/dist/web/components/graphicCard/index.d.ts +31 -0
- package/dist/web/components/graphicCard/index.js +166 -0
- package/dist/web/components/image/image.d.ts +9 -0
- package/dist/web/components/image/image.js +119 -0
- package/{src → dist}/web/components/image/index.css +2 -2
- package/dist/web/components/image/index.d.ts +13 -0
- package/dist/web/components/image/index.js +91 -0
- package/dist/web/components/index.d.ts +47 -0
- package/{src → dist}/web/components/index.js +25 -26
- package/{src → dist}/web/components/link/index.css +0 -0
- package/dist/web/components/link/index.d.ts +24 -0
- package/dist/web/components/link/index.js +71 -0
- package/{src → dist}/web/components/listView/index.css +17 -17
- package/dist/web/components/listView/index.d.ts +7 -0
- package/dist/web/components/listView/index.js +262 -0
- package/dist/web/components/listView/interface.d.ts +122 -0
- package/dist/web/components/listView/interface.js +1 -0
- package/{src → dist}/web/components/lottery/index.css +98 -72
- package/dist/web/components/lottery/index.d.ts +22 -0
- package/dist/web/components/lottery/index.js +390 -0
- package/dist/web/components/lottery/lotteryUtil.d.ts +23 -0
- package/dist/web/components/lottery/lotteryUtil.js +180 -0
- package/dist/web/components/modal/h5.css +53 -0
- package/dist/web/components/modal/index.d.ts +17 -0
- package/dist/web/components/modal/index.js +11 -0
- package/dist/web/components/modal/modal.h5.d.ts +4 -0
- package/dist/web/components/modal/modal.h5.js +46 -0
- package/dist/web/components/modal/modal.pc.d.ts +3 -0
- package/dist/web/components/modal/modal.pc.js +31 -0
- package/{src → dist}/web/components/navLayout/index.css +15 -15
- package/dist/web/components/navLayout/index.d.ts +46 -0
- package/dist/web/components/navLayout/index.js +116 -0
- package/dist/web/components/navigationBar/common.d.ts +15 -0
- package/dist/web/components/navigationBar/common.js +127 -0
- package/dist/web/components/navigationBar/h5Menu.d.ts +14 -0
- package/dist/web/components/navigationBar/h5Menu.js +72 -0
- package/dist/web/components/navigationBar/horizontalMenu.d.ts +12 -0
- package/dist/web/components/navigationBar/horizontalMenu.js +99 -0
- package/{src → dist}/web/components/navigationBar/index.css +66 -66
- package/dist/web/components/navigationBar/index.d.ts +13 -0
- package/dist/web/components/navigationBar/index.js +157 -0
- package/dist/web/components/navigationBar/verticalMenu.d.ts +13 -0
- package/dist/web/components/navigationBar/verticalMenu.js +38 -0
- package/dist/web/components/phone/index.d.ts +18 -0
- package/dist/web/components/phone/index.js +4 -0
- package/dist/web/components/phoneCode/index.d.ts +18 -0
- package/dist/web/components/phoneCode/index.js +4 -0
- package/dist/web/components/picker/datePicker.d.ts +10 -0
- package/dist/web/components/picker/datePicker.js +31 -0
- package/dist/web/components/picker/picker.d.ts +6 -0
- package/dist/web/components/picker/picker.js +45 -0
- package/dist/web/components/picker/timePicker.d.ts +7 -0
- package/dist/web/components/picker/timePicker.js +42 -0
- package/dist/web/components/richText/const.d.ts +1 -0
- package/dist/web/components/richText/const.js +2 -0
- package/{src → dist}/web/components/richText/index.css +3 -3
- package/dist/web/components/richText/index.d.ts +51 -0
- package/dist/web/components/richText/index.js +295 -0
- package/{src → dist}/web/components/richTextView/index.css +8 -8
- package/dist/web/components/richTextView/index.d.ts +7 -0
- package/dist/web/components/richTextView/index.js +44 -0
- package/dist/web/components/scrollView/index.d.ts +27 -0
- package/dist/web/components/scrollView/index.js +95 -0
- package/dist/web/components/share/index.d.ts +34 -0
- package/dist/web/components/share/index.js +4 -0
- package/dist/web/components/slot/index.d.ts +6 -0
- package/dist/web/components/slot/index.js +9 -0
- package/{src → dist}/web/components/swiper/index.css +10 -10
- package/dist/web/components/swiper/index.d.ts +24 -0
- package/dist/web/components/swiper/index.js +149 -0
- package/{src → dist}/web/components/tabs/index.css +6 -6
- package/dist/web/components/tabs/index.d.ts +13 -0
- package/dist/web/components/tabs/index.js +15 -0
- package/dist/web/components/tabs/tabs.h5.d.ts +4 -0
- package/dist/web/components/tabs/tabs.h5.js +42 -0
- package/dist/web/components/tabs/tabs.pc.d.ts +3 -0
- package/dist/web/components/tabs/tabs.pc.js +40 -0
- package/{src → dist}/web/components/text/index.css +6 -6
- package/dist/web/components/text/index.d.ts +14 -0
- package/dist/web/components/text/index.js +17 -0
- package/{src → dist}/web/components/uploaderFileView/index.css +0 -0
- package/dist/web/components/uploaderFileView/index.d.ts +10 -0
- package/dist/web/components/uploaderFileView/index.js +61 -0
- package/{src → dist}/web/components/uploaderView/index.css +5 -5
- package/dist/web/components/uploaderView/index.d.ts +17 -0
- package/dist/web/components/uploaderView/index.js +48 -0
- package/dist/web/components/userInfo/index.d.ts +26 -0
- package/dist/web/components/userInfo/index.js +4 -0
- package/{src → dist}/web/components/wedaVideo/index.css +2 -2
- package/dist/web/components/wedaVideo/index.d.ts +17 -0
- package/dist/web/components/wedaVideo/index.js +159 -0
- package/dist/web/index.d.ts +8 -0
- package/{src → dist}/web/index.js +1 -1
- package/dist/web/utils/classnames.d.ts +2 -0
- package/dist/web/utils/classnames.js +37 -0
- package/dist/web/utils/constant.d.ts +23 -0
- package/dist/web/utils/constant.js +24 -0
- package/dist/web/utils/debounce.d.ts +2 -0
- package/dist/web/utils/debounce.js +92 -0
- package/dist/web/utils/events.d.ts +1 -0
- package/{src → dist}/web/utils/events.js +1 -1
- package/dist/web/utils/getLocalCounter.d.ts +1 -0
- package/{src → dist}/web/utils/getLocalCounter.js +1 -2
- package/dist/web/utils/isObjectEqual.d.ts +2 -0
- package/dist/web/utils/isObjectEqual.js +12 -0
- package/dist/web/utils/loading-fallback.d.ts +2 -0
- package/dist/web/utils/loading-fallback.js +2 -0
- package/dist/web/utils/lodash.d.ts +1 -0
- package/{src/mp → dist/web}/utils/lodash.js +0 -0
- package/dist/web/utils/platform.d.ts +18 -0
- package/dist/web/utils/platform.js +191 -0
- package/dist/web/utils/tcb.d.ts +23 -0
- package/dist/web/utils/tcb.js +82 -0
- package/dist/web/utils/tmap.d.ts +3 -0
- package/dist/web/utils/tmap.js +21 -0
- package/dist/web/utils/useSetState.d.ts +1 -0
- package/dist/web/utils/useSetState.js +8 -0
- package/dist/web/utils/useSyncValue.d.ts +4 -0
- package/dist/web/utils/useSyncValue.js +15 -0
- package/dist/web/utils/weui.d.ts +1 -0
- package/{src → dist}/web/utils/weui.js +0 -1
- package/{src → dist}/web/weda-ui.css +2 -2
- package/package.json +22 -22
- package/src/configs/actions/showModal.json +0 -48
- package/src/configs/actions/showToast.json +0 -41
- package/src/configs/components/auth.json +0 -16
- package/src/configs/components/button.json +0 -239
- package/src/configs/components/calendar.json +0 -81
- package/src/configs/components/carousel.json +0 -292
- package/src/configs/components/chart/bar.json +0 -721
- package/src/configs/components/chart/line.json +0 -674
- package/src/configs/components/chart/pie.json +0 -494
- package/src/configs/components/chart/statisticsCard.json +0 -376
- package/src/configs/components/container.json +0 -50
- package/src/configs/components/dataView.json +0 -151
- package/src/configs/components/drawer.json +0 -115
- package/src/configs/components/form/checkbox.json +0 -173
- package/src/configs/components/form/form.json +0 -45
- package/src/configs/components/form/input.json +0 -154
- package/src/configs/components/form/label.json +0 -22
- package/src/configs/components/form/location.json +0 -155
- package/src/configs/components/form/radio.json +0 -203
- package/src/configs/components/form/richText.json +0 -125
- package/src/configs/components/form/select.json +0 -411
- package/src/configs/components/form/switch.json +0 -58
- package/src/configs/components/form/textarea.json +0 -116
- package/src/configs/components/form/tips.json +0 -34
- package/src/configs/components/form/uploader.json +0 -169
- package/src/configs/components/form/uploaderFile.json +0 -158
- package/src/configs/components/graphicCard.json +0 -413
- package/src/configs/components/image.json +0 -179
- package/src/configs/components/link.json +0 -79
- package/src/configs/components/listView.json +0 -281
- package/src/configs/components/lottery.json +0 -157
- package/src/configs/components/modal.json +0 -83
- package/src/configs/components/navLayout.json +0 -368
- package/src/configs/components/navigationBar.json +0 -62
- package/src/configs/components/picker/datePicker.json +0 -33
- package/src/configs/components/picker/picker.json +0 -18
- package/src/configs/components/picker/timePicker.json +0 -23
- package/src/configs/components/richtextview.json +0 -26
- package/src/configs/components/scrollVeiw.json +0 -253
- package/src/configs/components/slot.json +0 -17
- package/src/configs/components/swiper.json +0 -90
- package/src/configs/components/tabs.json +0 -121
- package/src/configs/components/text.json +0 -95
- package/src/configs/components/wedaVideo.json +0 -89
- package/src/configs/components/wxOpenApi/phone.json +0 -127
- package/src/configs/components/wxOpenApi/phoneCode.json +0 -109
- package/src/configs/components/wxOpenApi/share.json +0 -157
- package/src/configs/components/wxOpenApi/userInfo.json +0 -156
- package/src/mp/README.md +0 -1
- package/src/mp/actions/showModal/index.js +0 -3
- package/src/mp/actions/showToast/index.js +0 -3
- package/src/mp/components/button/index.js +0 -91
- package/src/mp/components/button/index.json +0 -4
- package/src/mp/components/button/index.wxml +0 -22
- package/src/mp/components/button/index.wxss +0 -13
- package/src/mp/components/calendar/arrowright--line.svg +0 -11
- package/src/mp/components/calendar/index.js +0 -268
- package/src/mp/components/calendar/index.json +0 -5
- package/src/mp/components/calendar/index.wxml +0 -35
- package/src/mp/components/calendar/index.wxss +0 -179
- package/src/mp/components/carousel/index.js +0 -88
- package/src/mp/components/carousel/index.json +0 -7
- package/src/mp/components/carousel/index.wxml +0 -6
- package/src/mp/components/chart/bar/index.js +0 -257
- package/src/mp/components/chart/bar/index.json +0 -6
- package/src/mp/components/chart/bar/index.wxml +0 -3
- package/src/mp/components/chart/bar/index.wxss +0 -9
- package/src/mp/components/chart/common/config/bar.js +0 -50
- package/src/mp/components/chart/common/config/global.js +0 -16
- package/src/mp/components/chart/common/config/line.js +0 -48
- package/src/mp/components/chart/common/config/pie.js +0 -36
- package/src/mp/components/chart/common/core/eChartBar.js +0 -258
- package/src/mp/components/chart/common/core/eChartBase.js +0 -389
- package/src/mp/components/chart/common/core/eChartLine.js +0 -223
- package/src/mp/components/chart/common/core/eChartPie.js +0 -169
- package/src/mp/components/chart/common/lib/echarts.min.js +0 -18
- package/src/mp/components/chart/ec-canvas/ec-canvas.js +0 -277
- package/src/mp/components/chart/ec-canvas/ec-canvas.json +0 -4
- package/src/mp/components/chart/ec-canvas/ec-canvas.wxml +0 -4
- package/src/mp/components/chart/ec-canvas/ec-canvas.wxss +0 -4
- package/src/mp/components/chart/ec-canvas/wx-canvas.js +0 -109
- package/src/mp/components/chart/line/index.js +0 -247
- package/src/mp/components/chart/line/index.json +0 -6
- package/src/mp/components/chart/line/index.wxml +0 -3
- package/src/mp/components/chart/line/index.wxss +0 -9
- package/src/mp/components/chart/pie/index.js +0 -182
- package/src/mp/components/chart/pie/index.json +0 -6
- package/src/mp/components/chart/pie/index.wxml +0 -3
- package/src/mp/components/chart/pie/index.wxss +0 -9
- package/src/mp/components/chart/statisticsCard/index.js +0 -253
- package/src/mp/components/chart/statisticsCard/index.json +0 -4
- package/src/mp/components/chart/statisticsCard/index.wxml +0 -9
- package/src/mp/components/chart/statisticsCard/index.wxss +0 -42
- package/src/mp/components/container/index.js +0 -20
- package/src/mp/components/container/index.json +0 -4
- package/src/mp/components/container/index.wxml +0 -3
- package/src/mp/components/dataView/index.js +0 -34
- package/src/mp/components/dataView/index.json +0 -7
- package/src/mp/components/dataView/index.wxml +0 -3
- package/src/mp/components/dataView/index.wxss +0 -0
- package/src/mp/components/form/checkbox/index.js +0 -124
- package/src/mp/components/form/checkbox/index.json +0 -7
- package/src/mp/components/form/checkbox/index.wxml +0 -13
- package/src/mp/components/form/checkbox/index.wxss +0 -1
- package/src/mp/components/form/form/index.js +0 -18
- package/src/mp/components/form/form/index.json +0 -4
- package/src/mp/components/form/form/index.wxml +0 -5
- package/src/mp/components/form/form/index.wxss +0 -1
- package/src/mp/components/form/formcell/index.js +0 -54
- package/src/mp/components/form/formcell/index.json +0 -4
- package/src/mp/components/form/formcell/index.wxml +0 -11
- package/src/mp/components/form/formcell/index.wxss +0 -31
- package/src/mp/components/form/input/index.js +0 -110
- package/src/mp/components/form/input/index.json +0 -7
- package/src/mp/components/form/input/index.wxml +0 -24
- package/src/mp/components/form/input/index.wxss +0 -22
- package/src/mp/components/form/location/components/mapChoose/index.js +0 -201
- package/src/mp/components/form/location/components/mapChoose/index.json +0 -4
- package/src/mp/components/form/location/components/mapChoose/index.wxml +0 -42
- package/src/mp/components/form/location/components/mapChoose/index.wxss +0 -188
- package/src/mp/components/form/location/index.js +0 -388
- package/src/mp/components/form/location/index.json +0 -6
- package/src/mp/components/form/location/index.wxml +0 -21
- package/src/mp/components/form/location/index.wxss +0 -89
- package/src/mp/components/form/radio/index.js +0 -124
- package/src/mp/components/form/radio/index.json +0 -7
- package/src/mp/components/form/radio/index.wxml +0 -13
- package/src/mp/components/form/radio/index.wxss +0 -1
- package/src/mp/components/form/select/index.js +0 -677
- package/src/mp/components/form/select/index.json +0 -7
- package/src/mp/components/form/select/index.wxml +0 -12
- package/src/mp/components/form/select/index.wxss +0 -16
- package/src/mp/components/form/select/region/index.js +0 -107
- package/src/mp/components/form/switch/index.js +0 -75
- package/src/mp/components/form/switch/index.json +0 -7
- package/src/mp/components/form/switch/index.wxml +0 -11
- package/src/mp/components/form/switch/index.wxss +0 -1
- package/src/mp/components/form/textarea/index.js +0 -90
- package/src/mp/components/form/textarea/index.json +0 -7
- package/src/mp/components/form/textarea/index.wxml +0 -8
- package/src/mp/components/form/textarea/index.wxss +0 -10
- package/src/mp/components/form/tips/index.js +0 -41
- package/src/mp/components/form/tips/index.json +0 -4
- package/src/mp/components/form/tips/index.wxml +0 -1
- package/src/mp/components/form/tips/index.wxss +0 -1
- package/src/mp/components/form/uploader/index.js +0 -158
- package/src/mp/components/form/uploader/index.json +0 -10
- package/src/mp/components/form/uploader/index.wxml +0 -14
- package/src/mp/components/form/uploader/index.wxss +0 -36
- package/src/mp/components/form/uploader/weui-uploader.js +0 -219
- package/src/mp/components/form/uploader/weui-uploader.json +0 -7
- package/src/mp/components/form/uploader/weui-uploader.wxml +0 -45
- package/src/mp/components/form/uploader/weui-uploader.wxss +0 -1
- package/src/mp/components/form/uploaderFile/index.js +0 -313
- package/src/mp/components/form/uploaderFile/index.json +0 -9
- package/src/mp/components/form/uploaderFile/index.wxml +0 -45
- package/src/mp/components/form/uploaderFile/index.wxss +0 -105
- package/src/mp/components/graphicCard/chevron-right.svg +0 -3
- package/src/mp/components/graphicCard/index.js +0 -203
- package/src/mp/components/graphicCard/index.json +0 -4
- package/src/mp/components/graphicCard/index.wxml +0 -25
- package/src/mp/components/graphicCard/index.wxss +0 -157
- package/src/mp/components/image/index.js +0 -182
- package/src/mp/components/image/index.json +0 -7
- package/src/mp/components/image/index.wxml +0 -9
- package/src/mp/components/image/index.wxss +0 -49
- package/src/mp/components/listView/arrow-right-line.svg +0 -3
- package/src/mp/components/listView/index.js +0 -274
- package/src/mp/components/listView/index.json +0 -4
- package/src/mp/components/listView/index.wxml +0 -38
- package/src/mp/components/listView/index.wxss +0 -155
- package/src/mp/components/listView/more-line.svg +0 -3
- package/src/mp/components/lottery/index.js +0 -270
- package/src/mp/components/lottery/index.json +0 -4
- package/src/mp/components/lottery/index.wxml +0 -41
- package/src/mp/components/lottery/index.wxss +0 -323
- package/src/mp/components/modal/index.js +0 -39
- package/src/mp/components/modal/index.json +0 -4
- package/src/mp/components/modal/index.wxml +0 -1
- package/src/mp/components/navLayout/index.js +0 -120
- package/src/mp/components/navLayout/index.json +0 -7
- package/src/mp/components/navLayout/index.wxml +0 -23
- package/src/mp/components/navLayout/index.wxss +0 -1193
- package/src/mp/components/navigationBar/index.js +0 -193
- package/src/mp/components/navigationBar/index.json +0 -5
- package/src/mp/components/navigationBar/index.wxml +0 -80
- package/src/mp/components/navigationBar/index.wxss +0 -1257
- package/src/mp/components/richText/index.js +0 -67
- package/src/mp/components/richText/index.json +0 -4
- package/src/mp/components/richText/index.wxml +0 -3
- package/src/mp/components/richText/index.wxss +0 -27
- package/src/mp/components/scrollView/index.js +0 -119
- package/src/mp/components/scrollView/index.json +0 -4
- package/src/mp/components/scrollView/index.wxml +0 -38
- package/src/mp/components/slot/index.js +0 -20
- package/src/mp/components/slot/index.json +0 -4
- package/src/mp/components/slot/index.wxml +0 -3
- package/src/mp/components/swiper/index.js +0 -65
- package/src/mp/components/swiper/index.json +0 -4
- package/src/mp/components/swiper/index.wxml +0 -3
- package/src/mp/components/tabs/index.js +0 -59
- package/src/mp/components/tabs/index.json +0 -4
- package/src/mp/components/tabs/index.wxml +0 -12
- package/src/mp/components/tabs/index.wxss +0 -57
- package/src/mp/components/text/index.js +0 -40
- package/src/mp/components/text/index.json +0 -4
- package/src/mp/components/text/index.wxml +0 -1
- package/src/mp/components/text/index.wxss +0 -26
- package/src/mp/components/wedaVideo/index.js +0 -86
- package/src/mp/components/wedaVideo/index.json +0 -4
- package/src/mp/components/wedaVideo/index.wxml +0 -4
- package/src/mp/components/wedaVideo/index.wxss +0 -20
- package/src/mp/components/wxOpenApi/phone/index.js +0 -109
- package/src/mp/components/wxOpenApi/phone/index.json +0 -4
- package/src/mp/components/wxOpenApi/phone/index.wxml +0 -4
- package/src/mp/components/wxOpenApi/phone/index.wxss +0 -22
- package/src/mp/components/wxOpenApi/phoneCode/index.js +0 -89
- package/src/mp/components/wxOpenApi/phoneCode/index.json +0 -4
- package/src/mp/components/wxOpenApi/phoneCode/index.wxml +0 -4
- package/src/mp/components/wxOpenApi/phoneCode/index.wxss +0 -22
- package/src/mp/components/wxOpenApi/share/index.js +0 -117
- package/src/mp/components/wxOpenApi/share/index.json +0 -4
- package/src/mp/components/wxOpenApi/share/index.wxml +0 -4
- package/src/mp/components/wxOpenApi/share/index.wxss +0 -22
- package/src/mp/components/wxOpenApi/userInfo/index.js +0 -88
- package/src/mp/components/wxOpenApi/userInfo/index.json +0 -4
- package/src/mp/components/wxOpenApi/userInfo/index.wxml +0 -4
- package/src/mp/components/wxOpenApi/userInfo/index.wxss +0 -22
- package/src/mp/index.json +0 -52
- package/src/mp/package.json +0 -6
- package/src/mp/style/weda-ui.wxss +0 -71
- package/src/mp/utils/classnames.js +0 -39
- package/src/mp/utils/constant.js +0 -20
- package/src/mp/utils/dayjs.min.js +0 -1
- package/src/mp/utils/debounce.js +0 -133
- package/src/mp/utils/deepEqual.js +0 -42
- package/src/mp/utils/destr.js +0 -49
- package/src/mp/utils/dr_square_point.js +0 -29
- package/src/mp/utils/handleEvents.js +0 -32
- package/src/mp/utils/platform.js +0 -45
- package/src/mp/utils/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.js +0 -1336
- package/src/mp/utils/spark-md5.js +0 -776
- package/src/mp/utils/tcb.js +0 -76
- package/src/setupTests.js +0 -14
- package/src/web/actions/showModal/index.tsx +0 -118
- package/src/web/actions/showToast/index.js +0 -3
- package/src/web/components/auth/index.css +0 -0
- package/src/web/components/auth/index.js +0 -66
- package/src/web/components/button/index.tsx +0 -119
- package/src/web/components/calendar/index.jsx +0 -312
- package/src/web/components/calendar/util.js +0 -90
- package/src/web/components/carousel/index.tsx +0 -417
- package/src/web/components/chart/bar/index.tsx +0 -140
- package/src/web/components/chart/common/config/bar.js +0 -49
- package/src/web/components/chart/common/config/global.js +0 -16
- package/src/web/components/chart/common/config/line.js +0 -50
- package/src/web/components/chart/common/config/pie.js +0 -37
- package/src/web/components/chart/common/core/eChartBar.js +0 -259
- package/src/web/components/chart/common/core/eChartBase.ts +0 -396
- package/src/web/components/chart/common/core/eChartLine.js +0 -225
- package/src/web/components/chart/common/core/eChartPie.js +0 -173
- package/src/web/components/chart/common/core/type.ts +0 -34
- package/src/web/components/chart/common/echart.css +0 -106
- package/src/web/components/chart/common/useChart.tsx +0 -87
- package/src/web/components/chart/line/index.tsx +0 -136
- package/src/web/components/chart/pie/index.tsx +0 -99
- package/src/web/components/chart/statisticsCard/index.tsx +0 -307
- package/src/web/components/chart/statisticsCard/interface.ts +0 -14
- package/src/web/components/container/index.tsx +0 -34
- package/src/web/components/dataView/index.tsx +0 -20
- package/src/web/components/drawer/index.tsx +0 -68
- package/src/web/components/form/checkbox/index.tsx +0 -210
- package/src/web/components/form/enumSelect/MultipleSelect.jsx +0 -89
- package/src/web/components/form/enumSelect/NormalSelect.tsx +0 -92
- package/src/web/components/form/enumSelect/SelectContainer.jsx +0 -43
- package/src/web/components/form/enumSelect/props/defaultProps.js +0 -39
- package/src/web/components/form/enumSelect/props/propsTypes.js +0 -50
- package/src/web/components/form/form/index.tsx +0 -51
- package/src/web/components/form/formcell/index.tsx +0 -85
- package/src/web/components/form/input/index.tsx +0 -166
- package/src/web/components/form/location/common/mapChoose.css +0 -180
- package/src/web/components/form/location/common/mapChoose.jsx +0 -343
- package/src/web/components/form/location/common/mapView.jsx +0 -190
- package/src/web/components/form/location/common/propsConfig.js +0 -54
- package/src/web/components/form/location/common/selectModal.jsx +0 -73
- package/src/web/components/form/location/common/useLocationInfo.js +0 -104
- package/src/web/components/form/location/components/LocationH5/index.css +0 -239
- package/src/web/components/form/location/components/LocationH5/location.h5.jsx +0 -413
- package/src/web/components/form/location/components/LocationPC/Header.jsx +0 -96
- package/src/web/components/form/location/components/LocationPC/location.PC.jsx +0 -332
- package/src/web/components/form/location/index.css +0 -0
- package/src/web/components/form/location/index.jsx +0 -25
- package/src/web/components/form/radio/index.tsx +0 -179
- package/src/web/components/form/renderDecorator.tsx +0 -28
- package/src/web/components/form/select/h5.tsx +0 -602
- package/src/web/components/form/select/index.tsx +0 -510
- package/src/web/components/form/select/region/index.ts +0 -152
- package/src/web/components/form/select/time.jsx +0 -145
- package/src/web/components/form/select/year.tsx +0 -172
- package/src/web/components/form/switch/index.tsx +0 -100
- package/src/web/components/form/textarea/index.tsx +0 -127
- package/src/web/components/form/tips/index.tsx +0 -34
- package/src/web/components/form/types.d.ts +0 -12
- package/src/web/components/form/uploader/index.tsx +0 -65
- package/src/web/components/form/uploader/uploader.h5.tsx +0 -290
- package/src/web/components/form/uploader/uploader.pc.tsx +0 -287
- package/src/web/components/form/uploaderFile/fail.svg +0 -12
- package/src/web/components/form/uploaderFile/index.jsx +0 -25
- package/src/web/components/form/uploaderFile/pending.svg +0 -18
- package/src/web/components/form/uploaderFile/success.svg +0 -12
- package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +0 -606
- package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +0 -520
- package/src/web/components/graphicCard/index.tsx +0 -310
- package/src/web/components/image/image.tsx +0 -187
- package/src/web/components/image/index.tsx +0 -121
- package/src/web/components/link/index.tsx +0 -119
- package/src/web/components/listView/arrow-right-line.svg +0 -3
- package/src/web/components/listView/index.tsx +0 -346
- package/src/web/components/listView/interface.ts +0 -98
- package/src/web/components/lottery/index.tsx +0 -567
- package/src/web/components/lottery/lotteryUtil.ts +0 -130
- package/src/web/components/modal/index.tsx +0 -60
- package/src/web/components/navLayout/index.tsx +0 -247
- package/src/web/components/navigationBar/chevron-right--double.svg +0 -3
- package/src/web/components/navigationBar/common.tsx +0 -198
- package/src/web/components/navigationBar/h5Menu.tsx +0 -179
- package/src/web/components/navigationBar/horizontalMenu.tsx +0 -200
- package/src/web/components/navigationBar/index.tsx +0 -230
- package/src/web/components/navigationBar/type.d.ts +0 -111
- package/src/web/components/navigationBar/verticalMenu.tsx +0 -81
- package/src/web/components/phone/index.css +0 -0
- package/src/web/components/phone/index.tsx +0 -22
- package/src/web/components/phoneCode/index.css +0 -0
- package/src/web/components/phoneCode/index.tsx +0 -22
- package/src/web/components/picker/datePicker.tsx +0 -48
- package/src/web/components/picker/picker.tsx +0 -59
- package/src/web/components/picker/timePicker.tsx +0 -56
- package/src/web/components/richText/const.ts +0 -3
- package/src/web/components/richText/index.jsx +0 -473
- package/src/web/components/richTextView/index.tsx +0 -63
- package/src/web/components/scrollView/index.tsx +0 -148
- package/src/web/components/share/index.css +0 -0
- package/src/web/components/share/index.tsx +0 -38
- package/src/web/components/slot/index.tsx +0 -19
- package/src/web/components/swiper/index.tsx +0 -291
- package/src/web/components/tabs/index.tsx +0 -35
- package/src/web/components/tabs/tabs.h5.tsx +0 -84
- package/src/web/components/tabs/tabs.pc.tsx +0 -74
- package/src/web/components/text/index.tsx +0 -60
- package/src/web/components/uploaderFileView/index.jsx +0 -84
- package/src/web/components/uploaderView/index.tsx +0 -92
- package/src/web/components/userInfo/index.css +0 -0
- package/src/web/components/userInfo/index.tsx +0 -30
- package/src/web/components/wedaVideo/index.tsx +0 -208
- package/src/web/types.d.ts +0 -21
- package/src/web/utils/classnames.js +0 -39
- package/src/web/utils/constant.ts +0 -23
- package/src/web/utils/debounce.js +0 -98
- package/src/web/utils/isObjectEqual.js +0 -15
- package/src/web/utils/loading-fallback.tsx +0 -2
- package/src/web/utils/lodash.ts +0 -2
- package/src/web/utils/platform.js +0 -156
- package/src/web/utils/tcb.js +0 -86
- package/src/web/utils/tmap.js +0 -4
- package/src/web/utils/useSetState.ts +0 -18
- package/src/web/utils/useSyncValue.ts +0 -17
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Container, Text, Button } from '../index';
|
|
3
|
+
import './h5.css';
|
|
4
|
+
import { useSyncValue } from '../../utils/useSyncValue';
|
|
5
|
+
export function ModalH5(props) {
|
|
6
|
+
const { events, visible, content, isDefaultButton, customButton, customContent, outerRef, } = props;
|
|
7
|
+
const [isVisible, setIsVisible] = useSyncValue(visible);
|
|
8
|
+
React.useImperativeHandle(outerRef, () => {
|
|
9
|
+
return {
|
|
10
|
+
methods: {
|
|
11
|
+
close: () => {
|
|
12
|
+
setIsVisible(false);
|
|
13
|
+
},
|
|
14
|
+
open: () => {
|
|
15
|
+
setIsVisible(true);
|
|
16
|
+
},
|
|
17
|
+
toggle: () => {
|
|
18
|
+
setIsVisible((prev) => !prev);
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}, [setIsVisible]);
|
|
23
|
+
const buttonEvents = React.useMemo(() => {
|
|
24
|
+
return {
|
|
25
|
+
tap: events.confirm,
|
|
26
|
+
};
|
|
27
|
+
}, [events]);
|
|
28
|
+
const closeEvents = React.useMemo(() => {
|
|
29
|
+
return {
|
|
30
|
+
tap: events.close,
|
|
31
|
+
};
|
|
32
|
+
}, [events]);
|
|
33
|
+
if (!isVisible) {
|
|
34
|
+
return React.createElement(Container, { className: "lcap-modal" });
|
|
35
|
+
}
|
|
36
|
+
return (React.createElement(Container, { className: "lcap-modal" },
|
|
37
|
+
React.createElement(Container, { className: "container" },
|
|
38
|
+
React.createElement(Container, { className: "lcap-modal__mask" }),
|
|
39
|
+
React.createElement(Container, { className: `lcap-modal__dialog ${isVisible ? 'enter' : ''}` },
|
|
40
|
+
React.createElement(Container, { className: "lcap-modal__close_btn", events: closeEvents },
|
|
41
|
+
React.createElement(Container, { className: "lcap-icon-close lcap-icon", style: {
|
|
42
|
+
fontSize: 24,
|
|
43
|
+
} })),
|
|
44
|
+
React.createElement(Container, { title: "modal-header" }, content ? (React.createElement(Text, { level: "0", text: content, maxLines: 2, userSelect: true, space: false, contenteditable: 'false' })) : (customContent)),
|
|
45
|
+
React.createElement(Container, { className: "lcap-modal__confirm_btn" }, isDefaultButton ? (React.createElement(Button, { className: "lcap-modal__default_btn", text: "\u786E\u5B9A", events: buttonEvents })) : (customButton))))));
|
|
46
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Modal, Button, ConfigProvider } from 'tea-component';
|
|
3
|
+
import classNames from '../../utils/classnames';
|
|
4
|
+
import { useSyncValue } from '../../utils/useSyncValue';
|
|
5
|
+
export function ModalPc(props) {
|
|
6
|
+
const { className, content, visible, customButton, customContent, isDefaultButton, size, events, outerRef, ...restProps } = props;
|
|
7
|
+
const [isVisible, setIsVisible] = useSyncValue(visible);
|
|
8
|
+
React.useImperativeHandle(outerRef, () => {
|
|
9
|
+
return {
|
|
10
|
+
methods: {
|
|
11
|
+
close: () => {
|
|
12
|
+
setIsVisible(false);
|
|
13
|
+
},
|
|
14
|
+
open: () => {
|
|
15
|
+
setIsVisible(true);
|
|
16
|
+
},
|
|
17
|
+
toggle: () => {
|
|
18
|
+
setIsVisible((prev) => !prev);
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}, [setIsVisible]);
|
|
23
|
+
return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
|
|
24
|
+
React.createElement(Modal, { size: size, className: classNames('weda-ui', 'lcap-modal', 'container', className), visible: isVisible, onClose: () => {
|
|
25
|
+
events.close();
|
|
26
|
+
}, ...restProps },
|
|
27
|
+
React.createElement(Modal.Body, null, content ? content : customContent),
|
|
28
|
+
React.createElement(Modal.Footer, null, isDefaultButton ? (React.createElement(Button, { type: "primary", onClick: () => {
|
|
29
|
+
events.confirm();
|
|
30
|
+
} }, "\u786E\u5B9A")) : (customButton)))));
|
|
31
|
+
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
.lcap-icon {
|
|
10
|
-
font-size:
|
|
10
|
+
font-size: 2.42857rem;
|
|
11
11
|
/* display: inline-block; */
|
|
12
12
|
font-family: 'lcap-icon' !important;
|
|
13
13
|
speak: none;
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
|
|
130
130
|
.weda-grid-navigation .weda-grid-navigation__wrapper {
|
|
131
131
|
width: 100%;
|
|
132
|
-
padding: 0
|
|
132
|
+
padding: 0 1.71429rem;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
.weda-grid-navigation .weda-grid-navigation__row {
|
|
@@ -145,14 +145,14 @@
|
|
|
145
145
|
flex-direction: column;
|
|
146
146
|
justify-content: flex-start;
|
|
147
147
|
/* align-items: center; */
|
|
148
|
-
padding:
|
|
148
|
+
padding: 1.14286rem 0;
|
|
149
149
|
text-align: center;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
.weda-grid-navigation
|
|
153
153
|
.weda-grid-navigation__col.weda-grid-navigation__col--big
|
|
154
154
|
.wedatea2td-grid__box {
|
|
155
|
-
padding:
|
|
155
|
+
padding: 1.42857rem 0;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
.weda-grid-navigation .weda-grid-navigation__col .weda-grid-navigation__icon {
|
|
@@ -203,13 +203,13 @@
|
|
|
203
203
|
text-overflow: ellipsis;
|
|
204
204
|
-webkit-box-orient: vertical;
|
|
205
205
|
-webkit-line-clamp: 1;
|
|
206
|
-
margin-top:
|
|
206
|
+
margin-top: 0.85714rem;
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
.weda-grid-navigation
|
|
210
210
|
.weda-grid-navigation__col--big
|
|
211
211
|
.weda-grid-navigation__text {
|
|
212
|
-
margin-top:
|
|
212
|
+
margin-top: 1.14286rem;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
.weda-grid-navigation
|
|
@@ -233,11 +233,11 @@
|
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
.weda-grid-navigation-mobile .weda-grid-navigation__wrapper {
|
|
236
|
-
padding: 0
|
|
236
|
+
padding: 0 1.14286rem;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
.weda-grid-navigation-mobile .weda-grid-navigation__col .wedatea2td-grid__box {
|
|
240
|
-
padding:
|
|
240
|
+
padding: 0.57143rem 0;
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
.weda-grid-navigation-mobile
|
|
@@ -245,7 +245,7 @@
|
|
|
245
245
|
.weda-grid-navigation__col
|
|
246
246
|
.wedatea2td-grid__box {
|
|
247
247
|
text-align: center;
|
|
248
|
-
padding-top:
|
|
248
|
+
padding-top: 1.14286rem;
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
.weda-grid-navigation-mobile
|
|
@@ -253,13 +253,13 @@
|
|
|
253
253
|
.weda-grid-navigation__col
|
|
254
254
|
.wedatea2td-grid__box {
|
|
255
255
|
text-align: center;
|
|
256
|
-
padding-bottom:
|
|
256
|
+
padding-bottom: 1.14286rem;
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
.weda-grid-navigation-mobile
|
|
260
260
|
.weda-grid-navigation__col.weda-grid-navigation__col--big
|
|
261
261
|
.wedatea2td-grid__box {
|
|
262
|
-
padding:
|
|
262
|
+
padding: 0.71429rem 0;
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
.weda-grid-navigation-mobile
|
|
@@ -267,14 +267,14 @@
|
|
|
267
267
|
.weda-grid-navigation__col.weda-grid-navigation__col--big
|
|
268
268
|
.wedatea2td-grid__box {
|
|
269
269
|
text-align: center;
|
|
270
|
-
padding-top:
|
|
270
|
+
padding-top: 1.42857rem;
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
.weda-grid-navigation-mobile
|
|
274
274
|
.weda-grid-navigation__row:last-child
|
|
275
275
|
.weda-grid-navigation__col.weda-grid-navigation__col--big
|
|
276
276
|
.wedatea2td-grid__box {
|
|
277
|
-
padding-bottom:
|
|
277
|
+
padding-bottom: 1.42857rem;
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
.weda-grid-navigation-mobile
|
|
@@ -322,11 +322,11 @@
|
|
|
322
322
|
.weda-grid-navigation__text {
|
|
323
323
|
font-size: 0.85714em;
|
|
324
324
|
line-height: 1.42857em;
|
|
325
|
-
margin-top:
|
|
325
|
+
margin-top: 0.28571rem;
|
|
326
326
|
}
|
|
327
327
|
|
|
328
328
|
.weda-grid-navigation-mobile
|
|
329
329
|
.weda-grid-navigation__col--big
|
|
330
330
|
.weda-grid-navigation__text {
|
|
331
|
-
margin-top:
|
|
331
|
+
margin-top: 0.57143rem;
|
|
332
332
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CommonPropsType } from '../../types';
|
|
3
|
+
import './index.css';
|
|
4
|
+
export default function NavLayout({ navOption, mobileCol, pcCol, iconSize, textColor, fontSize, lineHeight, fontWeight, maxLines, className, style, }: H5NavLayoutProps): JSX.Element;
|
|
5
|
+
export interface H5NavLayoutProps extends CommonPropsType {
|
|
6
|
+
/**
|
|
7
|
+
* 导航配置
|
|
8
|
+
*/
|
|
9
|
+
navOption?: Array<any>;
|
|
10
|
+
/**
|
|
11
|
+
* 移动端每行列数
|
|
12
|
+
*/
|
|
13
|
+
mobileCol?: number;
|
|
14
|
+
/**
|
|
15
|
+
* PC端每行列数
|
|
16
|
+
*/
|
|
17
|
+
pcCol?: number;
|
|
18
|
+
/**
|
|
19
|
+
* icon尺寸
|
|
20
|
+
*/
|
|
21
|
+
iconSize?: 'medium' | 'samll' | 'big';
|
|
22
|
+
/**
|
|
23
|
+
* 标题颜色
|
|
24
|
+
*/
|
|
25
|
+
textColor?: string;
|
|
26
|
+
/**
|
|
27
|
+
* 标题字重
|
|
28
|
+
*/
|
|
29
|
+
fontWeight?: 'lighter' | 'normal' | 'bolder';
|
|
30
|
+
/**
|
|
31
|
+
* 最大行数
|
|
32
|
+
*/
|
|
33
|
+
maxLines?: number;
|
|
34
|
+
/**
|
|
35
|
+
* 字号
|
|
36
|
+
*/
|
|
37
|
+
fontSize?: number;
|
|
38
|
+
/**
|
|
39
|
+
* 行高
|
|
40
|
+
*/
|
|
41
|
+
lineHeight: string;
|
|
42
|
+
/**
|
|
43
|
+
* 点击事件
|
|
44
|
+
*/
|
|
45
|
+
navTap?: (colInfo: any) => void;
|
|
46
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classNames from '../../utils/classnames';
|
|
3
|
+
import { Row, Col, ConfigProvider } from 'tea-component';
|
|
4
|
+
import { usePlatform } from '../../utils/platform';
|
|
5
|
+
import './index.css';
|
|
6
|
+
import { IconFont } from 'tdesign-icons-react';
|
|
7
|
+
import Image from '../image';
|
|
8
|
+
/**
|
|
9
|
+
* Web端
|
|
10
|
+
*/
|
|
11
|
+
const CLASS_PREFIX = 'weda-grid-navigation';
|
|
12
|
+
export default function NavLayout({ navOption, mobileCol, pcCol, iconSize, textColor, fontSize, lineHeight, fontWeight, maxLines, className, style, }) {
|
|
13
|
+
const platform = usePlatform();
|
|
14
|
+
// 等分列占比
|
|
15
|
+
const [colCount, setColCount] = React.useState(4);
|
|
16
|
+
const cls = classNames({
|
|
17
|
+
[CLASS_PREFIX]: true,
|
|
18
|
+
[className]: className,
|
|
19
|
+
[`${CLASS_PREFIX}-mobile`]: platform === 'h5',
|
|
20
|
+
});
|
|
21
|
+
const navList = React.useMemo(() => {
|
|
22
|
+
const list = [];
|
|
23
|
+
list.length = Math.floor(navOption.length / colCount);
|
|
24
|
+
list.forEach((item, index) => {
|
|
25
|
+
list[index] = [];
|
|
26
|
+
});
|
|
27
|
+
navOption.forEach((item, index) => {
|
|
28
|
+
const _index = Math.floor(index / colCount);
|
|
29
|
+
if (!list[_index] || list[_index].length <= 0) {
|
|
30
|
+
// 保证每个col 的数据都是有的,列入总共7个数据,那么第二行的3, 4,5数据是undefined, 占位
|
|
31
|
+
list[_index] = Array(colCount).fill(null);
|
|
32
|
+
}
|
|
33
|
+
const paramObj = {};
|
|
34
|
+
if (item === null || item === void 0 ? void 0 : item.params) {
|
|
35
|
+
for (const info of item.params) {
|
|
36
|
+
paramObj[info.key] = info.value;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
item.paramObj = paramObj;
|
|
40
|
+
list[_index][index - _index * colCount] = item;
|
|
41
|
+
});
|
|
42
|
+
return list;
|
|
43
|
+
}, [colCount, navOption]);
|
|
44
|
+
React.useEffect(() => {
|
|
45
|
+
setColCount(platform === 'h5' ? mobileCol : pcCol);
|
|
46
|
+
}, [mobileCol, pcCol]);
|
|
47
|
+
// 每个col的宽度百分比
|
|
48
|
+
const colStyle = {
|
|
49
|
+
width: `${(1 / colCount) * 100}%`,
|
|
50
|
+
};
|
|
51
|
+
const mutiLabelStyle = {
|
|
52
|
+
width: '100%',
|
|
53
|
+
display: '-webkit-box',
|
|
54
|
+
WebkitLineClamp: `${maxLines ? maxLines : 'inherit'}`,
|
|
55
|
+
overflow: 'hidden',
|
|
56
|
+
color: `${textColor}`,
|
|
57
|
+
fontWeight: `${fontWeight}`,
|
|
58
|
+
fontSize: `${fontSize}` + 'px',
|
|
59
|
+
lineHeight: `${lineHeight == 'auto' ? 'normal' : lineHeight}`,
|
|
60
|
+
};
|
|
61
|
+
const navTap = (colInfo = navOption[0]) => {
|
|
62
|
+
switch (colInfo === null || colInfo === void 0 ? void 0 : colInfo.tapStatus) {
|
|
63
|
+
case 'tap':
|
|
64
|
+
return null;
|
|
65
|
+
case 'inside':
|
|
66
|
+
if (colInfo.insideUrl) {
|
|
67
|
+
app.navigateTo({
|
|
68
|
+
mode: 'weDa',
|
|
69
|
+
pageId: colInfo.insideUrl,
|
|
70
|
+
params: (colInfo === null || colInfo === void 0 ? void 0 : colInfo.withParams) && (colInfo === null || colInfo === void 0 ? void 0 : colInfo.params.length) > 0
|
|
71
|
+
? colInfo.paramObj
|
|
72
|
+
: null,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
break;
|
|
79
|
+
case 'outer':
|
|
80
|
+
if (colInfo.newPage) {
|
|
81
|
+
colInfo.outerUrl ? window.open(colInfo.outerUrl) : false;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
colInfo.outerUrl ? (window.location.href = colInfo.outerUrl) : false;
|
|
85
|
+
}
|
|
86
|
+
break;
|
|
87
|
+
default:
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
|
|
92
|
+
React.createElement("div", { className: cls, "data-testid": "navLayout", style: style },
|
|
93
|
+
React.createElement("div", { className: `${CLASS_PREFIX}__wrapper` }, navList.map((row, rowIndex) => {
|
|
94
|
+
return (React.createElement(Row, { className: `${CLASS_PREFIX}__row`, key: rowIndex },
|
|
95
|
+
React.createElement(React.Fragment, null, row &&
|
|
96
|
+
row.map((colInfo, colIndex) => {
|
|
97
|
+
return (React.createElement(Col, { style: {
|
|
98
|
+
...colStyle,
|
|
99
|
+
cursor: (colInfo === null || colInfo === void 0 ? void 0 : colInfo.tapStatus) != 'tap'
|
|
100
|
+
? 'pointer'
|
|
101
|
+
: 'auto',
|
|
102
|
+
}, className: `${CLASS_PREFIX}__col ${CLASS_PREFIX}__col--${iconSize}`, key: colIndex },
|
|
103
|
+
React.createElement("div", { "data-testid": `${colIndex}_click`, onClick: () => navTap(colInfo) },
|
|
104
|
+
!(colInfo === null || colInfo === void 0 ? void 0 : colInfo.iconSrc) ? (React.createElement(IconShow, { onIcon: colInfo === null || colInfo === void 0 ? void 0 : colInfo.icon })) : (React.createElement("div", { className: `${CLASS_PREFIX}__img` },
|
|
105
|
+
React.createElement(Image, { mode: 'scaleToFill', lazyLoad: false, maskClosable: false, imgPreview: false, fit: 'cover', alt: '', src: colInfo === null || colInfo === void 0 ? void 0 : colInfo.iconSrc, className: `${CLASS_PREFIX}__icon` }))),
|
|
106
|
+
(colInfo === null || colInfo === void 0 ? void 0 : colInfo.title) && (React.createElement("div", { className: `${CLASS_PREFIX}__text`, style: mutiLabelStyle }, colInfo === null || colInfo === void 0 ? void 0 : colInfo.title)))));
|
|
107
|
+
}))));
|
|
108
|
+
})))));
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* icon回显组件
|
|
112
|
+
*/
|
|
113
|
+
const IconShow = ({ onIcon }) => {
|
|
114
|
+
return (React.createElement(React.Fragment, null, (onIcon === null || onIcon === void 0 ? void 0 : onIcon.includes('td:')) ? (React.createElement("div", null,
|
|
115
|
+
React.createElement(IconFont, { name: onIcon === null || onIcon === void 0 ? void 0 : onIcon.split(':')[1], className: `${CLASS_PREFIX}__fonticon` }))) : (React.createElement("div", { className: `${CLASS_PREFIX}__fonticon lcap-icon lcap-icon-${onIcon}` }))));
|
|
116
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { IMenuItem, INavigationStyle } from './type';
|
|
3
|
+
export declare const renderTitle: (navigationStyle: INavigationStyle) => JSX.Element;
|
|
4
|
+
export declare const renderMenuTitle: (navigationStyle: INavigationStyle, item: Partial<IMenuItem>, hasIcon: boolean) => JSX.Element;
|
|
5
|
+
export declare const renderLogo: (navigationStyle: INavigationStyle, className: string) => JSX.Element;
|
|
6
|
+
export declare const IconShow: ({ onIcon, menuColor, menuFontSize }: {
|
|
7
|
+
onIcon: any;
|
|
8
|
+
menuColor: any;
|
|
9
|
+
menuFontSize: any;
|
|
10
|
+
}) => JSX.Element;
|
|
11
|
+
export declare const renderMenuIcon: (iconUrl: string, iconPath: string, navigationStyle: INavigationStyle) => JSX.Element;
|
|
12
|
+
export declare const navigateTo: (menu: IMenuItem) => void;
|
|
13
|
+
export declare const hasSelectedMenu: (menu: IMenuItem, selectedkey: string) => boolean;
|
|
14
|
+
export declare const expandMenu: (menuData: IMenuItem[], menuItem: Partial<IMenuItem>, init?: boolean) => any;
|
|
15
|
+
export declare const findMenuItemByPath: (menus: IMenuItem[], targetPath: string) => IMenuItem | null;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { isUrl, resolveStaticResourceUrl } from '../../utils/platform';
|
|
3
|
+
import { IconFont } from 'tdesign-icons-react';
|
|
4
|
+
const CLASS_PREFIX = 'weda-menu';
|
|
5
|
+
// 标题
|
|
6
|
+
export const renderTitle = (navigationStyle) => {
|
|
7
|
+
const { title, titleColor, showTitle, titleFontSize } = navigationStyle;
|
|
8
|
+
return (showTitle && (React.createElement("span", { "data-testid": "navigationBar-title", style: {
|
|
9
|
+
display: 'inline-block',
|
|
10
|
+
color: titleColor,
|
|
11
|
+
fontSize: titleFontSize,
|
|
12
|
+
} }, title)));
|
|
13
|
+
};
|
|
14
|
+
// 菜单
|
|
15
|
+
export const renderMenuTitle = (navigationStyle, item, hasIcon) => {
|
|
16
|
+
const { menuColor, menuFontSize, showMenuIcon } = navigationStyle;
|
|
17
|
+
const { title, level, iconUrl, iconPath } = item;
|
|
18
|
+
return (React.createElement("span", { className: "menu-text", style: {
|
|
19
|
+
color: menuColor,
|
|
20
|
+
fontSize: menuFontSize,
|
|
21
|
+
}, "data-testid": "navigationBar-menu" },
|
|
22
|
+
showMenuIcon &&
|
|
23
|
+
level === 0 &&
|
|
24
|
+
hasIcon &&
|
|
25
|
+
renderMenuIcon(iconUrl, iconPath, navigationStyle),
|
|
26
|
+
title));
|
|
27
|
+
};
|
|
28
|
+
// 默认logo
|
|
29
|
+
const defaultLogoUrl = 'https://imgcache.qq.com/qcloud/tcloud_dtc/static/static_source_business/43d3b2b7-445c-4858-8eb0-50ac5d5cc08e.svg';
|
|
30
|
+
// logo
|
|
31
|
+
export const renderLogo = (navigationStyle, className) => {
|
|
32
|
+
const { showLogo, logoHeight, logoWidth, logoUrl, logoPath } = navigationStyle;
|
|
33
|
+
const src = resolveStaticResourceUrl(logoPath) || logoUrl;
|
|
34
|
+
return (showLogo && (React.createElement("img", { "data-testid": "navigationBar-logo", className: className, style: { width: `${logoWidth}px`, height: `${logoHeight}px` }, src: src || defaultLogoUrl, alt: "logo" })));
|
|
35
|
+
};
|
|
36
|
+
// icon回显
|
|
37
|
+
export const IconShow = ({ onIcon, menuColor, menuFontSize }) => {
|
|
38
|
+
return (React.createElement(React.Fragment, null, (onIcon === null || onIcon === void 0 ? void 0 : onIcon.includes('td:')) ? (React.createElement(IconFont, { name: onIcon === null || onIcon === void 0 ? void 0 : onIcon.split(':')[1], className: `${CLASS_PREFIX}__fonticon`, style: { color: menuColor, fontSize: menuFontSize } })) : (React.createElement("div", { className: `${CLASS_PREFIX}__fonticon lcap-icon lcap-icon-${onIcon}`, style: { color: menuColor, fontSize: menuFontSize } }))));
|
|
39
|
+
};
|
|
40
|
+
// 菜单图标
|
|
41
|
+
export const renderMenuIcon = (iconUrl, iconPath, navigationStyle) => {
|
|
42
|
+
const { menuColor, menuFontSize } = navigationStyle;
|
|
43
|
+
let icon = iconUrl || 'td:view-module';
|
|
44
|
+
if (iconUrl && isUrl(iconUrl)) {
|
|
45
|
+
icon = resolveStaticResourceUrl(iconPath) || iconUrl;
|
|
46
|
+
return (React.createElement("img", { className: `${CLASS_PREFIX}__item-icon`, style: { width: 16, height: 16, marginRight: 4 }, src: icon, alt: "logo" }));
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return (React.createElement(IconShow, { onIcon: icon, menuColor: menuColor, menuFontSize: menuFontSize }));
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
// 页面跳转
|
|
53
|
+
export const navigateTo = (menu) => {
|
|
54
|
+
const { path, linkTargetBlank, linkUrl, type, key } = menu;
|
|
55
|
+
localStorage.setItem('selectedKey', key);
|
|
56
|
+
// 存储跳转页面的id
|
|
57
|
+
if (linkUrl && type === 'link') {
|
|
58
|
+
if (linkTargetBlank) {
|
|
59
|
+
window.open(linkUrl);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
window.location.href = linkUrl;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
app.navigateTo({
|
|
67
|
+
pageId: path === null || path === void 0 ? void 0 : path.replace('/', ''),
|
|
68
|
+
packageName: '',
|
|
69
|
+
mode: 'weDa',
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
// 菜单是否展开
|
|
74
|
+
export const hasSelectedMenu = (menu, selectedkey) => {
|
|
75
|
+
var _a;
|
|
76
|
+
let opened = false;
|
|
77
|
+
if (menu.key === selectedkey) {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
(_a = menu === null || menu === void 0 ? void 0 : menu.children) === null || _a === void 0 ? void 0 : _a.forEach((i) => {
|
|
81
|
+
var _a;
|
|
82
|
+
if (i.key === selectedkey) {
|
|
83
|
+
opened = true;
|
|
84
|
+
}
|
|
85
|
+
if ((_a = i === null || i === void 0 ? void 0 : i.children) === null || _a === void 0 ? void 0 : _a.length) {
|
|
86
|
+
opened = hasSelectedMenu(i, selectedkey);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
return opened;
|
|
90
|
+
};
|
|
91
|
+
// 点击展开/收起菜单
|
|
92
|
+
export const expandMenu = (menuData, menuItem, init = false) => {
|
|
93
|
+
const menus = JSON.parse(JSON.stringify(menuData));
|
|
94
|
+
return menus.map((i) => {
|
|
95
|
+
if (init) {
|
|
96
|
+
i.opened = hasSelectedMenu(i, menuItem.key);
|
|
97
|
+
}
|
|
98
|
+
else if (i.key === menuItem.key) {
|
|
99
|
+
i.opened = menuItem.opened;
|
|
100
|
+
}
|
|
101
|
+
if (i.children) {
|
|
102
|
+
return { ...i, children: expandMenu(i === null || i === void 0 ? void 0 : i.children, menuItem, init) };
|
|
103
|
+
}
|
|
104
|
+
return i;
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
// 根据path查找菜单
|
|
108
|
+
export const findMenuItemByPath = (menus, targetPath) => {
|
|
109
|
+
var _a;
|
|
110
|
+
const queue = [];
|
|
111
|
+
let targetNode = null;
|
|
112
|
+
menus.forEach((node) => queue.push(node));
|
|
113
|
+
while (queue.length) {
|
|
114
|
+
const node = queue.shift();
|
|
115
|
+
if (!node)
|
|
116
|
+
return null;
|
|
117
|
+
if (node.path === targetPath) {
|
|
118
|
+
// 添加节点
|
|
119
|
+
targetNode = node;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
(_a = node.children) === null || _a === void 0 ? void 0 : _a.forEach((node) => queue.push(node));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return targetNode;
|
|
127
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IMenuItem, INavigationStyle } from './type';
|
|
3
|
+
/**
|
|
4
|
+
* 移动端导航
|
|
5
|
+
*/
|
|
6
|
+
declare const H5Menu: React.FC<{
|
|
7
|
+
menuData: IMenuItem[];
|
|
8
|
+
navigationStyle: INavigationStyle;
|
|
9
|
+
setMenuData: (menus: IMenuItem[]) => void;
|
|
10
|
+
className: string;
|
|
11
|
+
selected: string;
|
|
12
|
+
setSelected: (selectedKey: string) => void;
|
|
13
|
+
}>;
|
|
14
|
+
export default H5Menu;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-key */
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { Menu, Drawer } from 'tea-component';
|
|
4
|
+
import classNames from '../../utils/classnames';
|
|
5
|
+
import { renderMenuTitle, renderLogo, renderTitle, navigateTo, expandMenu, } from './common';
|
|
6
|
+
const CLASS_PREFIX = 'weda-menu';
|
|
7
|
+
/**
|
|
8
|
+
* 移动端导航
|
|
9
|
+
*/
|
|
10
|
+
const H5Menu = ({ menuData, navigationStyle, setMenuData, className, selected, setSelected, }) => {
|
|
11
|
+
// 平台
|
|
12
|
+
const cls = classNames({
|
|
13
|
+
[CLASS_PREFIX]: true,
|
|
14
|
+
[className]: className,
|
|
15
|
+
[`${CLASS_PREFIX}-mobile`]: true,
|
|
16
|
+
});
|
|
17
|
+
// h5 弹框
|
|
18
|
+
const [visible, setVisible] = useState(false);
|
|
19
|
+
// 菜单背景色
|
|
20
|
+
const menuStyle = {
|
|
21
|
+
background: navigationStyle.menuBackgroundColor || '#fff',
|
|
22
|
+
};
|
|
23
|
+
// 渲染subMenu
|
|
24
|
+
const renderSubMenu = (item, hasThereNode = false) => {
|
|
25
|
+
const { key, children, opened } = item;
|
|
26
|
+
return children.length > 0 ? (React.createElement(Menu.SubMenu, { className: hasThereNode ? `${CLASS_PREFIX}__submenu` : '', key: key, title: renderMenuTitle(navigationStyle, item, true), opened: opened, onOpenedChange: (opened) => {
|
|
27
|
+
const menus = expandMenu(menuData, { ...item, opened });
|
|
28
|
+
setMenuData(menus);
|
|
29
|
+
} }, children === null || children === void 0 ? void 0 : children.map((el) => renderSubMenu(el, true)))) : (renderMenuItem(item));
|
|
30
|
+
};
|
|
31
|
+
// 渲染MenuItem
|
|
32
|
+
const renderMenuItem = (item) => {
|
|
33
|
+
const { key } = item;
|
|
34
|
+
return (React.createElement(Menu.Item, { key: key, title: renderMenuTitle(navigationStyle, item, true), selected: item.key === selected, onClick: () => {
|
|
35
|
+
if (item.key !== selected) {
|
|
36
|
+
setSelected(item.key);
|
|
37
|
+
navigateTo(item);
|
|
38
|
+
}
|
|
39
|
+
setVisible(false);
|
|
40
|
+
} }));
|
|
41
|
+
};
|
|
42
|
+
const renderH5Title = (navigationStyle) => (React.createElement(React.Fragment, null,
|
|
43
|
+
React.createElement("div", { className: `${CLASS_PREFIX}__bar-main` },
|
|
44
|
+
React.createElement("span", { className: `${CLASS_PREFIX}__main-logo` },
|
|
45
|
+
renderLogo(navigationStyle, `${CLASS_PREFIX}__main-icon`),
|
|
46
|
+
renderTitle(navigationStyle))),
|
|
47
|
+
React.createElement("div", { className: `${CLASS_PREFIX}__bar-extra` },
|
|
48
|
+
!visible && (React.createElement("i", { className: `${CLASS_PREFIX}__bar-btn`, onClick: () => setVisible(true) },
|
|
49
|
+
React.createElement("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
50
|
+
React.createElement("path", { d: "M3 4H21V6H3V4ZM3 11H21V13H3V11ZM3 18H21V20H3V18Z", fill: navigationStyle.titleColor, fillOpacity: "0.9" })))),
|
|
51
|
+
visible && (React.createElement("i", { className: `${CLASS_PREFIX}__bar-btn--close`, onClick: () => setVisible(false) },
|
|
52
|
+
React.createElement("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
53
|
+
React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M10.6219 11.9998L3.88672 5.2646L5.26558 3.88574L12.0008 10.6209L18.736 3.88574L20.1148 5.2646L13.3796 11.9998L20.1148 18.735L18.736 20.1138L12.0008 13.3786L5.26558 20.1138L3.88672 18.735L10.6219 11.9998Z", fill: navigationStyle.titleColor, fillOpacity: "0.9" })))))));
|
|
54
|
+
return (React.createElement(React.Fragment, null,
|
|
55
|
+
renderH5Title(navigationStyle),
|
|
56
|
+
React.createElement(Drawer, { size: 'm', placement: 'left', disableAnimation: true, outerClickClosable: false, visible: visible, onClose: () => setVisible(false), className: `${CLASS_PREFIX}__drawer` },
|
|
57
|
+
React.createElement("div", { className: cls, style: {
|
|
58
|
+
display: 'flex',
|
|
59
|
+
flexDirection: 'column',
|
|
60
|
+
position: 'relative',
|
|
61
|
+
} },
|
|
62
|
+
React.createElement("div", { className: `${CLASS_PREFIX}__wrapper`, style: {
|
|
63
|
+
background: (navigationStyle === null || navigationStyle === void 0 ? void 0 : navigationStyle.menuBackgroundColor) || '#fff',
|
|
64
|
+
} }, renderH5Title(navigationStyle))),
|
|
65
|
+
React.createElement(Menu, { className: `${CLASS_PREFIX}__drawer-menu`, style: menuStyle }, menuData === null || menuData === void 0 ? void 0 : menuData.map((item) => {
|
|
66
|
+
var _a;
|
|
67
|
+
return ((_a = item === null || item === void 0 ? void 0 : item.children) === null || _a === void 0 ? void 0 : _a.length) > 0
|
|
68
|
+
? renderSubMenu(item)
|
|
69
|
+
: renderMenuItem(item);
|
|
70
|
+
})))));
|
|
71
|
+
};
|
|
72
|
+
export default H5Menu;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IMenuItem, INavigationStyle } from './type';
|
|
3
|
+
/**
|
|
4
|
+
* pc端横向导航
|
|
5
|
+
*/
|
|
6
|
+
declare const HorizontalMenu: React.FC<{
|
|
7
|
+
menuData: IMenuItem[];
|
|
8
|
+
navigationStyle: INavigationStyle;
|
|
9
|
+
selected: string;
|
|
10
|
+
setSelected: (selectedKey: string) => void;
|
|
11
|
+
}>;
|
|
12
|
+
export default HorizontalMenu;
|