@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,431 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import classNames from '../../../../utils/classnames';
|
|
5
|
+
import debounce from '../../../../utils/debounce';
|
|
6
|
+
import { tmapApiUrl } from '../constants';
|
|
7
|
+
import { getTMap, calculateDistance, base64LocationIcon, } from '../../../../utils/tmap';
|
|
8
|
+
import './mapChoose.css';
|
|
9
|
+
import { Icon } from 'tea-component';
|
|
10
|
+
const { useEffect, useState, useRef, useMemo } = React;
|
|
11
|
+
let relativePosition;
|
|
12
|
+
const defaultLatLng = {
|
|
13
|
+
lat: null,
|
|
14
|
+
lng: null,
|
|
15
|
+
};
|
|
16
|
+
export default function MapChoose({ changeLocation, onConfirm, onClose, currentLocations, latlng = defaultLatLng, isPC, APIKEY = '', locationRange, customRange, setConfirmStatus, }) {
|
|
17
|
+
const { lat, lng } = latlng;
|
|
18
|
+
const mapRef = useRef();
|
|
19
|
+
const markerRef = useRef();
|
|
20
|
+
const centerRef = useRef();
|
|
21
|
+
const [isSearch, setIsSearch] = useState(false);
|
|
22
|
+
const [searchValue, setSearchValue] = useState('');
|
|
23
|
+
const [chooseLoc, setChooseLoc] = useState({
|
|
24
|
+
location: {
|
|
25
|
+
lat: null,
|
|
26
|
+
lng: null,
|
|
27
|
+
},
|
|
28
|
+
title: '',
|
|
29
|
+
address: '',
|
|
30
|
+
id: '',
|
|
31
|
+
});
|
|
32
|
+
const [exploreList, setExploreList] = useState([]);
|
|
33
|
+
const [searchList, setSearchList] = useState([]);
|
|
34
|
+
const [mapDomName, setMapDomName] = useState(new Date().getTime());
|
|
35
|
+
const clientHeight = useMemo(() => document.documentElement.clientHeight, []);
|
|
36
|
+
const [mapBoxHeight, setMapBoxHeight] = useState(clientHeight - 328);
|
|
37
|
+
const [searchLoadingStatus, setSearchLoadingStatus] = useState(false);
|
|
38
|
+
const [isOutofrange, setIsOutofrange] = useState(false);
|
|
39
|
+
const [searchBoxHeight, setSearchBoxHeight] = useState(328);
|
|
40
|
+
const touchCoordinate = useRef({
|
|
41
|
+
startY: 0,
|
|
42
|
+
lastY: 0,
|
|
43
|
+
});
|
|
44
|
+
const searchListRef = useRef();
|
|
45
|
+
const searchListPageSize = useRef(1);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (!APIKEY || new RegExp('[\\u4E00-\\u9FFF]+', 'g').test(APIKEY))
|
|
48
|
+
return;
|
|
49
|
+
function loadScript() {
|
|
50
|
+
const script = document.createElement('script');
|
|
51
|
+
script.type = 'text/javascript';
|
|
52
|
+
script.src = `${tmapApiUrl}?v=2.exp&key=${APIKEY}&callback=init&libraries=service`;
|
|
53
|
+
script.onload = () => {
|
|
54
|
+
initMap();
|
|
55
|
+
};
|
|
56
|
+
script.onerror = (error) => {
|
|
57
|
+
console.log(' load mapchoose error success', APIKEY, error);
|
|
58
|
+
};
|
|
59
|
+
document.body.appendChild(script);
|
|
60
|
+
}
|
|
61
|
+
if (getTMap()) {
|
|
62
|
+
initMap();
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
loadScript();
|
|
66
|
+
}
|
|
67
|
+
exploreNear('updateCenter');
|
|
68
|
+
return () => {
|
|
69
|
+
mapRef.current && mapRef.current.destroy();
|
|
70
|
+
};
|
|
71
|
+
}, [APIKEY]);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
setConfirmStatus(getConfirm());
|
|
74
|
+
}, [isOutofrange, chooseLoc.id]);
|
|
75
|
+
const initMap = () => {
|
|
76
|
+
if (!getTMap())
|
|
77
|
+
return;
|
|
78
|
+
const TMap = getTMap();
|
|
79
|
+
//定义地图中心点坐标
|
|
80
|
+
const center = new TMap.LatLng(lat, lng);
|
|
81
|
+
//定义map变量,调用 TMap.Map() 构造函数创建地图
|
|
82
|
+
mapRef.current = new TMap.Map(document.getElementById(`form-map-choose-${mapDomName}`), {
|
|
83
|
+
center,
|
|
84
|
+
zoom: 16, //设置地图缩放级别
|
|
85
|
+
});
|
|
86
|
+
initMarker(TMap, mapRef.current);
|
|
87
|
+
getRadius() && initCircle(TMap, mapRef.current);
|
|
88
|
+
};
|
|
89
|
+
const initMarker = (TMap, map) => {
|
|
90
|
+
const canLoad = lat && lng && TMap && map;
|
|
91
|
+
if (canLoad) {
|
|
92
|
+
const position = new TMap.LatLng(lat, lng);
|
|
93
|
+
const currentLocationsLatlng = currentLocations.latlng;
|
|
94
|
+
const currentLocationsPosition = new TMap.LatLng(currentLocationsLatlng.lat, currentLocationsLatlng.lng);
|
|
95
|
+
markerRef.current = new TMap.MultiMarker({
|
|
96
|
+
map: mapRef.current,
|
|
97
|
+
styles: {
|
|
98
|
+
pointer: new TMap.MarkerStyle({
|
|
99
|
+
width: 26,
|
|
100
|
+
height: 35,
|
|
101
|
+
}),
|
|
102
|
+
originPointer: new window.TMap.MarkerStyle({
|
|
103
|
+
width: 70,
|
|
104
|
+
height: 70,
|
|
105
|
+
src: base64LocationIcon,
|
|
106
|
+
}),
|
|
107
|
+
},
|
|
108
|
+
geometries: [
|
|
109
|
+
{
|
|
110
|
+
id: `pointer-origin-${mapDomName}`,
|
|
111
|
+
styleId: 'originPointer',
|
|
112
|
+
position: currentLocationsPosition,
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
id: `pointer-${mapDomName}`,
|
|
116
|
+
styleId: 'pointer',
|
|
117
|
+
position,
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
});
|
|
121
|
+
// 监听中心点变化事件,更新marker的位置
|
|
122
|
+
map.on('center_changed', updateCenter);
|
|
123
|
+
map.on('drag', clearChooseLoc);
|
|
124
|
+
map.on('zoom', clearChooseLoc);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const initCircle = (TMap, map) => {
|
|
128
|
+
const currentLocationsLatlng = currentLocations.latlng;
|
|
129
|
+
const canLoad = lat && lng && currentLocationsLatlng && TMap && map;
|
|
130
|
+
if (canLoad) {
|
|
131
|
+
const nowPosition = new TMap.LatLng(currentLocationsLatlng.lat, currentLocationsLatlng.lng);
|
|
132
|
+
let circle = {
|
|
133
|
+
map,
|
|
134
|
+
styles: {
|
|
135
|
+
circleColor: new TMap.CircleStyle({
|
|
136
|
+
showBorder: true,
|
|
137
|
+
borderColor: '#fff',
|
|
138
|
+
borderWidth: 1,
|
|
139
|
+
}),
|
|
140
|
+
},
|
|
141
|
+
geometries: [
|
|
142
|
+
{
|
|
143
|
+
styleId: 'circleColor',
|
|
144
|
+
center: nowPosition,
|
|
145
|
+
radius: getRadius(),
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
};
|
|
149
|
+
new TMap.MultiCircle(circle);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
const clearChooseLoc = () => {
|
|
153
|
+
setChooseLoc({});
|
|
154
|
+
};
|
|
155
|
+
const updateCenter = () => {
|
|
156
|
+
const TMap = getTMap();
|
|
157
|
+
const canLoad = TMap && lat && lng && mapRef.current;
|
|
158
|
+
if (canLoad) {
|
|
159
|
+
const currentLocationsLatlng = currentLocations.latlng;
|
|
160
|
+
const nowPosition = new TMap.LatLng(currentLocationsLatlng.lat, currentLocationsLatlng.lng);
|
|
161
|
+
let centerPosition = mapRef.current.getCenter();
|
|
162
|
+
centerRef.current = centerPosition;
|
|
163
|
+
markerRef.current.updateGeometries([
|
|
164
|
+
{
|
|
165
|
+
id: `pointer-origin-${mapDomName}`,
|
|
166
|
+
styleId: 'originPointer',
|
|
167
|
+
position: nowPosition,
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
id: `pointer-${mapDomName}`,
|
|
171
|
+
styleId: 'pointer',
|
|
172
|
+
position: mapRef.current.getCenter(),
|
|
173
|
+
},
|
|
174
|
+
]);
|
|
175
|
+
exploreNear('updateCenter');
|
|
176
|
+
// 计算距离
|
|
177
|
+
if (getRadius()) {
|
|
178
|
+
let latlng1 = {
|
|
179
|
+
latitude: currentLocationsLatlng.lat,
|
|
180
|
+
longitude: currentLocationsLatlng.lng,
|
|
181
|
+
};
|
|
182
|
+
let latlng2 = {
|
|
183
|
+
latitude: centerPosition.getLat(),
|
|
184
|
+
longitude: centerPosition.getLng(),
|
|
185
|
+
};
|
|
186
|
+
const distance = calculateDistance(latlng1, latlng2);
|
|
187
|
+
let isOutof = getRadius() && getRadius() < distance;
|
|
188
|
+
setIsOutofrange(isOutof);
|
|
189
|
+
if (!isPC) {
|
|
190
|
+
changeSearchBoxHeight(false, isOutof);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
const handleFocus = (value) => {
|
|
196
|
+
changeSearchBoxHeight(true);
|
|
197
|
+
setIsSearch(value);
|
|
198
|
+
};
|
|
199
|
+
const exploreNear = debounce((type) => {
|
|
200
|
+
const { lat, lng } = centerRef.current || latlng;
|
|
201
|
+
let TMap = getTMap();
|
|
202
|
+
let search = new TMap.service.Search({ pageSize: 10 }); // 新建一个地点搜索类
|
|
203
|
+
if (type === 'updateCenter') {
|
|
204
|
+
searchListPageSize.current = 1;
|
|
205
|
+
}
|
|
206
|
+
setSearchLoadingStatus(true);
|
|
207
|
+
search
|
|
208
|
+
.explore({
|
|
209
|
+
center: new TMap.LatLng(lat, lng),
|
|
210
|
+
policy: 2,
|
|
211
|
+
radius: 1000,
|
|
212
|
+
pageIndex: searchListPageSize.current,
|
|
213
|
+
})
|
|
214
|
+
.then((res) => {
|
|
215
|
+
setSearchLoadingStatus(false);
|
|
216
|
+
if (res.status === 0) {
|
|
217
|
+
let list = [...exploreList, ...res.data];
|
|
218
|
+
if (searchListPageSize.current === 1) {
|
|
219
|
+
list = res.data;
|
|
220
|
+
}
|
|
221
|
+
setExploreList(list);
|
|
222
|
+
}
|
|
223
|
+
})
|
|
224
|
+
.catch((error) => {
|
|
225
|
+
setSearchLoadingStatus(false);
|
|
226
|
+
console.log('explore error', error);
|
|
227
|
+
});
|
|
228
|
+
}, 500);
|
|
229
|
+
const chooseLoction = (value, type) => {
|
|
230
|
+
const TMap = getTMap();
|
|
231
|
+
//定义地图中心点坐标
|
|
232
|
+
const center = new TMap.LatLng(value.location.lat, value.location.lng);
|
|
233
|
+
mapRef.current.setCenter(center);
|
|
234
|
+
setChooseLoc(value);
|
|
235
|
+
changeLocation(value);
|
|
236
|
+
type && cancleSearch();
|
|
237
|
+
};
|
|
238
|
+
const changeSearchValue = (event) => {
|
|
239
|
+
if (event.target.value) {
|
|
240
|
+
setSearchValue(event.target.value);
|
|
241
|
+
let TMap = getTMap();
|
|
242
|
+
let search = new TMap.service.Suggestion({ pageSize: 20 }); // 新建一个地点搜索类
|
|
243
|
+
search
|
|
244
|
+
.getSuggestions({
|
|
245
|
+
keyword: event.target.value,
|
|
246
|
+
location: new TMap.LatLng(lat, lng),
|
|
247
|
+
radius: 2000,
|
|
248
|
+
pageIndex: 1,
|
|
249
|
+
})
|
|
250
|
+
.then((res) => {
|
|
251
|
+
if (res.status === 0) {
|
|
252
|
+
setSearchList(res.data);
|
|
253
|
+
}
|
|
254
|
+
})
|
|
255
|
+
.catch((error) => {
|
|
256
|
+
console.log('error', error);
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
setSearchValue('');
|
|
261
|
+
setTimeout(() => {
|
|
262
|
+
setSearchList([]);
|
|
263
|
+
}, 300);
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
const cancleSearch = () => {
|
|
267
|
+
handleFocus(false);
|
|
268
|
+
setSearchValue('');
|
|
269
|
+
setSearchList([]);
|
|
270
|
+
changeSearchBoxHeight(false);
|
|
271
|
+
};
|
|
272
|
+
const renderMapView = () => {
|
|
273
|
+
return (React.createElement("div", { id: `form-map-choose-${mapDomName}`, style: { height: '100%', width: '100%', position: 'relative' } },
|
|
274
|
+
React.createElement("div", { className: "weda-ui_mapChoose_map_control", onClick: backToOrigin, onTouchEnd: backToOrigin },
|
|
275
|
+
React.createElement("img", { src: "https://qcloudimg.tencent-cloud.cn/raw/16f372916b73decb45faa912e37f6e6f.svg", className: "weda-ui_mapChoose_map_control_img", alt: "" }))));
|
|
276
|
+
};
|
|
277
|
+
const handletouchmove = (event) => {
|
|
278
|
+
document.getElementsByClassName('map-choose-header_search_input')[0].blur();
|
|
279
|
+
let currentY = event.changedTouches[0].clientY;
|
|
280
|
+
let status = currentY <= touchCoordinate.current.startY;
|
|
281
|
+
changeSearchBoxHeight(status);
|
|
282
|
+
};
|
|
283
|
+
const handletouchstart = (event) => {
|
|
284
|
+
document.getElementsByClassName('map-choose-header_search_input')[0].blur();
|
|
285
|
+
touchCoordinate.current.startY = event.changedTouches[0].clientY;
|
|
286
|
+
};
|
|
287
|
+
const changeSearchBoxHeight = (status, currentOutofrange) => {
|
|
288
|
+
// 搜索区域默认 328px ,上拉 75% ,当超出范围多一个超出提示 46px
|
|
289
|
+
let isOut = isOutofrange;
|
|
290
|
+
if (currentOutofrange) {
|
|
291
|
+
isOut = currentOutofrange;
|
|
292
|
+
}
|
|
293
|
+
const boxHeight = Math.ceil(clientHeight * 0.75);
|
|
294
|
+
let searchBoxHeights = isOut ? 328 - 46 : 328;
|
|
295
|
+
if (status) {
|
|
296
|
+
searchBoxHeights = isOut ? boxHeight - 46 : boxHeight;
|
|
297
|
+
}
|
|
298
|
+
setSearchBoxHeight(searchBoxHeights);
|
|
299
|
+
setMapBoxHeight(status ? clientHeight - boxHeight : clientHeight - 328);
|
|
300
|
+
};
|
|
301
|
+
const searchListOnScroll = () => {
|
|
302
|
+
getOnScrollDirection();
|
|
303
|
+
if (searchListPageSize.current === 5 || isSearch) {
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
let scrollTop = searchListRef.current.scrollTop;
|
|
307
|
+
let clientHeight = searchListRef.current.clientHeight;
|
|
308
|
+
let scrollHeight = searchListRef.current.scrollHeight;
|
|
309
|
+
if (scrollTop + clientHeight + 1 >= scrollHeight) {
|
|
310
|
+
searchListPageSize.current++;
|
|
311
|
+
exploreNear();
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
const getOnScrollDirection = () => {
|
|
315
|
+
if ((searchBoxHeight !== 328 && searchBoxHeight !== 282) || isPC) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
if (searchListRef.current.scrollTop > relativePosition) {
|
|
319
|
+
changeSearchBoxHeight(true);
|
|
320
|
+
}
|
|
321
|
+
relativePosition = searchListRef.current.scrollTop;
|
|
322
|
+
};
|
|
323
|
+
const renderSearchList = () => {
|
|
324
|
+
return (React.createElement("div", { className: classNames({
|
|
325
|
+
'weda-ui_mapChoose_search': true,
|
|
326
|
+
'weda-ui_mapChoose_search_pc': isPC,
|
|
327
|
+
}), style: { height: `${searchBoxHeight}px` }, onTouchStart: handletouchstart, onTouchMove: handletouchmove },
|
|
328
|
+
searchBoxHeight !== 328 && searchBoxHeight !== 282 && !isPC && (React.createElement("div", { className: "weda-ui_mapChoose_search_input_arrow", onClick: () => {
|
|
329
|
+
changeSearchBoxHeight(false);
|
|
330
|
+
} },
|
|
331
|
+
React.createElement("span", { className: "weda-ui_mapChoose_search_input_arrow-con" }))),
|
|
332
|
+
React.createElement("div", { className: classNames({
|
|
333
|
+
'map-choose-header': true,
|
|
334
|
+
'map-choose-header_focus': isSearch,
|
|
335
|
+
}) },
|
|
336
|
+
React.createElement("div", { className: "map-choose-header_search" },
|
|
337
|
+
React.createElement("input", { type: "text", onFocus: () => {
|
|
338
|
+
handleFocus(true);
|
|
339
|
+
}, onClick: (e) => {
|
|
340
|
+
e.stopPropagation();
|
|
341
|
+
}, onChange: changeSearchValue, value: searchValue, className: "map-choose-header_search_input" }),
|
|
342
|
+
React.createElement("div", { className: classNames({
|
|
343
|
+
'map-choose-header_search_place': true,
|
|
344
|
+
'map-choose-header_search_place_value': searchValue,
|
|
345
|
+
}) },
|
|
346
|
+
React.createElement("img", { src: "https://qcloudimg.tencent-cloud.cn/raw/388c48cdcbe9ca07f5682fb10d05ebdd.png", alt: "" }),
|
|
347
|
+
React.createElement("span", null, "\u641C\u7D22\u5730\u70B9")),
|
|
348
|
+
searchValue && (React.createElement("div", { className: "weda-ui_mapChoose_search_input_clear", onClick: changeSearchValue },
|
|
349
|
+
React.createElement("p", { className: "weda-ui_mapChoose_search_input_clear_close" })))),
|
|
350
|
+
React.createElement("span", { className: "map-choose-header_search_cancel", onClick: cancleSearch }, "\u53D6\u6D88")),
|
|
351
|
+
searchLoadingStatus && !isSearch && (React.createElement("div", { className: "weda-ui_mapChoose_search_list_lodading" },
|
|
352
|
+
React.createElement("span", { className: "weda-ui_mapChoose_search_list_lodading_con" }))),
|
|
353
|
+
React.createElement("div", { className: classNames({
|
|
354
|
+
'weda-ui_mapChoose_search_list': true,
|
|
355
|
+
'weda-ui_mapChoose_search_list_top': searchBoxHeight !== 328 && searchBoxHeight !== 282 && !isPC,
|
|
356
|
+
}), onTouchStart: (e) => {
|
|
357
|
+
e.stopPropagation();
|
|
358
|
+
}, onTouchMove: (e) => {
|
|
359
|
+
e.stopPropagation();
|
|
360
|
+
}, ref: searchListRef, onScroll: searchListOnScroll }, (isSearch ? searchList : exploreList).map((item, index) => (React.createElement("div", { key: index, className: "weda-ui_mapChoose_search_list_li", onClick: () => {
|
|
361
|
+
chooseLoction(item, isSearch);
|
|
362
|
+
} },
|
|
363
|
+
React.createElement("div", { className: "weda-ui_mapChoose_search_list_li_wrap" },
|
|
364
|
+
React.createElement("div", { className: "weda-ui_mapChoose_search_list_li_title" }, item.title),
|
|
365
|
+
React.createElement("div", { className: "weda-ui_mapChoose_search_list_li_con" }, item.address),
|
|
366
|
+
item.id === chooseLoc.id && (React.createElement("span", { className: "weda-ui_mapChoose_search_list_li_con_choosed" })))))))));
|
|
367
|
+
};
|
|
368
|
+
const renderOutTip = () => {
|
|
369
|
+
return (React.createElement("div", { className: classNames({
|
|
370
|
+
'weda-ui_mapChoose_outTip': true,
|
|
371
|
+
'weda-ui_mapChoose_outTip_block': isOutofrange,
|
|
372
|
+
'weda-ui_mapChoose_outTip_pc': isPC,
|
|
373
|
+
}) },
|
|
374
|
+
isOutofrange && (React.createElement(Icon, { type: "warning", size: "default", color: "#ED7B2F", style: { marginRight: '9px' } })),
|
|
375
|
+
isOutofrange && React.createElement("span", null, "\u5B9A\u4F4D\u8D85\u51FA\u5141\u8BB8\u8303\u56F4,\u8BF7\u8C03\u6574")));
|
|
376
|
+
};
|
|
377
|
+
const getRadius = () => {
|
|
378
|
+
let radius = 0;
|
|
379
|
+
if (locationRange > 0) {
|
|
380
|
+
radius = locationRange;
|
|
381
|
+
}
|
|
382
|
+
else if (locationRange < 0 && customRange > 0) {
|
|
383
|
+
radius = customRange;
|
|
384
|
+
}
|
|
385
|
+
return radius;
|
|
386
|
+
};
|
|
387
|
+
const backToOrigin = () => {
|
|
388
|
+
const TMap = getTMap();
|
|
389
|
+
const canLoad = TMap && lat && lng && mapRef.current;
|
|
390
|
+
if (canLoad) {
|
|
391
|
+
const currentLocationsLatlng = currentLocations.latlng;
|
|
392
|
+
const nowPosition = new TMap.LatLng(currentLocationsLatlng.lat, currentLocationsLatlng.lng);
|
|
393
|
+
markerRef.current.updateGeometries([
|
|
394
|
+
{
|
|
395
|
+
id: `pointer-${mapDomName}`,
|
|
396
|
+
styleId: 'pointer',
|
|
397
|
+
position: nowPosition,
|
|
398
|
+
},
|
|
399
|
+
]);
|
|
400
|
+
mapRef.current.setCenter(nowPosition);
|
|
401
|
+
searchListPageSize.current = 1;
|
|
402
|
+
setChooseLoc({});
|
|
403
|
+
}
|
|
404
|
+
};
|
|
405
|
+
const getConfirm = () => {
|
|
406
|
+
return isOutofrange || !chooseLoc.id;
|
|
407
|
+
};
|
|
408
|
+
if (isPC) {
|
|
409
|
+
return (React.createElement("div", { className: classNames('map-choose', 'map-choose-pc', 'weda-ui_map-choose') },
|
|
410
|
+
renderOutTip(),
|
|
411
|
+
React.createElement("div", { className: classNames({
|
|
412
|
+
'map-choose-pc_warp': true,
|
|
413
|
+
'map-choose-pc_warp_out': isOutofrange,
|
|
414
|
+
}) },
|
|
415
|
+
React.createElement("div", { className: "map-choose-pc-left" }, renderSearchList()),
|
|
416
|
+
React.createElement("div", { className: "map-choose-pc-right" }, renderMapView()))));
|
|
417
|
+
}
|
|
418
|
+
return (React.createElement("div", { className: "map-choose weda-ui_map-choose" },
|
|
419
|
+
renderOutTip(),
|
|
420
|
+
React.createElement("div", { className: "weda-ui_mapChoose_map", style: { height: `${mapBoxHeight}px` } },
|
|
421
|
+
React.createElement("div", { className: "weda-ui_mapChoose_msg" },
|
|
422
|
+
React.createElement("div", { className: classNames({
|
|
423
|
+
'weda-ui_mapChoose_confirm': true,
|
|
424
|
+
'weda-ui_mapChoose_confirm_disable': getConfirm(),
|
|
425
|
+
}), onClick: () => {
|
|
426
|
+
!getConfirm() && onConfirm();
|
|
427
|
+
} }, "\u786E\u5B9A"),
|
|
428
|
+
React.createElement("div", { className: "weda-ui_mapChoose_colse", onClick: onClose }, "\u53D6\u6D88")),
|
|
429
|
+
renderMapView()),
|
|
430
|
+
renderSearchList()));
|
|
431
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare function MapView({ APIKEY, drag, zoom, latlng, }: {
|
|
2
|
+
APIKEY?: string;
|
|
3
|
+
drag?: boolean;
|
|
4
|
+
zoom?: boolean;
|
|
5
|
+
latlng?: {
|
|
6
|
+
lat: any;
|
|
7
|
+
lng: any;
|
|
8
|
+
};
|
|
9
|
+
}): JSX.Element;
|
|
10
|
+
declare namespace MapView {
|
|
11
|
+
namespace propTypes {
|
|
12
|
+
const APIKEY: PropTypes.Requireable<string>;
|
|
13
|
+
const drag: PropTypes.Requireable<boolean>;
|
|
14
|
+
const zoom: PropTypes.Requireable<boolean>;
|
|
15
|
+
const latlng: PropTypes.Requireable<object>;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export default MapView;
|
|
19
|
+
import * as PropTypes from "prop-types";
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as PropTypes from 'prop-types';
|
|
5
|
+
import { tmapApiUrl } from '../constants';
|
|
6
|
+
import { getTMap } from '../../../../utils/tmap';
|
|
7
|
+
const { useEffect, useRef, useState } = React;
|
|
8
|
+
const defaultLatLng = {
|
|
9
|
+
lat: null,
|
|
10
|
+
lng: null,
|
|
11
|
+
};
|
|
12
|
+
export default function MapView({ APIKEY = '', drag = true, zoom = true, latlng = defaultLatLng, }) {
|
|
13
|
+
const mapRef = useRef();
|
|
14
|
+
const markerRef = useRef();
|
|
15
|
+
const mapDom = useRef();
|
|
16
|
+
const mapDomName = useRef(new Date().getTime());
|
|
17
|
+
const [mapStatus, setMapStatus] = useState(false);
|
|
18
|
+
const { lat, lng } = latlng;
|
|
19
|
+
const initMap = () => {
|
|
20
|
+
if (mapRef.current || !mapDom.current)
|
|
21
|
+
return;
|
|
22
|
+
try {
|
|
23
|
+
const TMap = getTMap();
|
|
24
|
+
//定义地图中心点坐标
|
|
25
|
+
const center = new TMap.LatLng(lat, lng);
|
|
26
|
+
//定义map变量,调用 TMap.Map() 构造函数创建地图
|
|
27
|
+
mapRef.current = new TMap.Map(mapDom.current, {
|
|
28
|
+
center,
|
|
29
|
+
zoom: 16,
|
|
30
|
+
minZoom: 3,
|
|
31
|
+
maxZoom: 20,
|
|
32
|
+
});
|
|
33
|
+
mapRef.current.setDraggable(drag);
|
|
34
|
+
removeOrAddZoom(mapRef.current, TMap);
|
|
35
|
+
initMarker();
|
|
36
|
+
setMapStatus(true);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
console.log('initMap error', error);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const initMarker = () => {
|
|
43
|
+
try {
|
|
44
|
+
const TMap = getTMap();
|
|
45
|
+
const canLoad = TMap && lat && lng && mapRef.current;
|
|
46
|
+
if (canLoad) {
|
|
47
|
+
const position = new TMap.LatLng(lat, lng);
|
|
48
|
+
markerRef.current = new TMap.MultiMarker({
|
|
49
|
+
map: mapRef.current,
|
|
50
|
+
styles: {
|
|
51
|
+
pointer: new TMap.MarkerStyle({
|
|
52
|
+
width: 26,
|
|
53
|
+
height: 35,
|
|
54
|
+
}),
|
|
55
|
+
},
|
|
56
|
+
geometries: [
|
|
57
|
+
{
|
|
58
|
+
id: `pointer-${mapDomName.current}`,
|
|
59
|
+
styleId: 'pointer',
|
|
60
|
+
position,
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
console.log('initMarker err', err);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (!APIKEY || new RegExp('[\\u4E00-\\u9FFF]+', 'g').test(APIKEY))
|
|
72
|
+
return;
|
|
73
|
+
function loadScript() {
|
|
74
|
+
// 移除之前的
|
|
75
|
+
if (document.getElementById('tmap-script')) {
|
|
76
|
+
document.body.removeChild(document.getElementById('tmap-script'));
|
|
77
|
+
}
|
|
78
|
+
const script = document.createElement('script');
|
|
79
|
+
script.type = 'text/javascript';
|
|
80
|
+
script.src = `${tmapApiUrl}?v=2.exp&key=${APIKEY}&callback=init&libraries=service`;
|
|
81
|
+
script.setAttribute('id', 'tmap-script');
|
|
82
|
+
script.onload = () => {
|
|
83
|
+
initMap();
|
|
84
|
+
};
|
|
85
|
+
script.onerror = (err) => {
|
|
86
|
+
console.log('loadScript err', err);
|
|
87
|
+
};
|
|
88
|
+
document.body.appendChild(script);
|
|
89
|
+
}
|
|
90
|
+
setTimeout(() => {
|
|
91
|
+
loadScript();
|
|
92
|
+
}, 1000);
|
|
93
|
+
return () => {
|
|
94
|
+
mapRef.current && mapRef.current.destroy();
|
|
95
|
+
mapRef.current = null;
|
|
96
|
+
setMapStatus(false);
|
|
97
|
+
};
|
|
98
|
+
}, [APIKEY]);
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
mapRef.current && mapRef.current.setDraggable(drag);
|
|
101
|
+
}, [drag, mapRef.current]);
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
mapRef.current && getTMap() && removeOrAddZoom(mapRef.current, getTMap());
|
|
104
|
+
}, [zoom, mapRef.current]);
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
const TMap = getTMap();
|
|
107
|
+
const canLoad = TMap && lat && lng && mapRef.current && mapStatus;
|
|
108
|
+
if (canLoad) {
|
|
109
|
+
try {
|
|
110
|
+
const newLatLng = new TMap.LatLng(lat, lng);
|
|
111
|
+
mapRef.current.setCenter(newLatLng);
|
|
112
|
+
mapRef.current.panTo(newLatLng);
|
|
113
|
+
markerRef.current.updateGeometries([
|
|
114
|
+
{
|
|
115
|
+
styleId: 'pointer',
|
|
116
|
+
id: `pointer-${mapDomName.current}`,
|
|
117
|
+
position: newLatLng,
|
|
118
|
+
},
|
|
119
|
+
]);
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
console.log('updateGeometries error view', error);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}, [lat, lng, mapStatus]);
|
|
126
|
+
// 缩放事件
|
|
127
|
+
const removeOrAddZoom = (map, TMap) => {
|
|
128
|
+
try {
|
|
129
|
+
let level = map.getZoom();
|
|
130
|
+
map.setScrollable(zoom);
|
|
131
|
+
map.setDoubleClickZoom(zoom);
|
|
132
|
+
// 缩放控件
|
|
133
|
+
if (zoom) {
|
|
134
|
+
addControl(map, TMap);
|
|
135
|
+
map.setMaxZoom(20);
|
|
136
|
+
map.setMinZoom(3);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
removeControl(map, TMap);
|
|
140
|
+
map.setMaxZoom(level);
|
|
141
|
+
map.setMinZoom(level);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
console.log('removeOrAddZoom error', error);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
// 移除缩放控件
|
|
149
|
+
const removeControl = (map, TMap) => {
|
|
150
|
+
if (!map.getControl(TMap.constants.DEFAULT_CONTROL_ID.ZOOM)) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
map.removeControl(TMap.constants.DEFAULT_CONTROL_ID.ZOOM);
|
|
154
|
+
};
|
|
155
|
+
// 缩放控件添加到地图上
|
|
156
|
+
const addControl = (map, TMap) => {
|
|
157
|
+
let control = map.getControl(TMap.constants.DEFAULT_CONTROL_ID.ZOOM);
|
|
158
|
+
if (!control) {
|
|
159
|
+
map.addControl(control);
|
|
160
|
+
control.setPosition(TMap.constants.CONTROL_POSITION.BOTTOM_RIGHT);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
return (React.createElement("div", { ref: mapDom, id: `form-location-map-${mapDomName.current}`, style: { height: '100%', width: '100%' } }));
|
|
164
|
+
}
|
|
165
|
+
MapView.propTypes = {
|
|
166
|
+
APIKEY: PropTypes.string,
|
|
167
|
+
drag: PropTypes.bool,
|
|
168
|
+
zoom: PropTypes.bool,
|
|
169
|
+
latlng: PropTypes.object,
|
|
170
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export namespace propTypes {
|
|
2
|
+
const id: PropTypes.Requireable<string>;
|
|
3
|
+
const className: PropTypes.Requireable<string>;
|
|
4
|
+
const style: PropTypes.Requireable<string>;
|
|
5
|
+
const events: PropTypes.Requireable<object>;
|
|
6
|
+
const label: PropTypes.Requireable<string>;
|
|
7
|
+
const labelVisible: PropTypes.Requireable<boolean>;
|
|
8
|
+
const APIKEY: PropTypes.Requireable<string>;
|
|
9
|
+
const showLngLat: PropTypes.Requireable<boolean>;
|
|
10
|
+
const showMap: PropTypes.Requireable<boolean>;
|
|
11
|
+
const defauleShowLocation: PropTypes.Requireable<boolean>;
|
|
12
|
+
const drag: PropTypes.Requireable<boolean>;
|
|
13
|
+
const zoom: PropTypes.Requireable<boolean>;
|
|
14
|
+
const disabled: PropTypes.Requireable<boolean>;
|
|
15
|
+
const requiredFlag: PropTypes.Requireable<boolean>;
|
|
16
|
+
const decorator: PropTypes.Requireable<any[] | PropTypes.ReactNodeLike>;
|
|
17
|
+
const value: PropTypes.Requireable<object>;
|
|
18
|
+
const locationType: PropTypes.Requireable<number>;
|
|
19
|
+
const customLocation: PropTypes.Requireable<object>;
|
|
20
|
+
const dataSource: PropTypes.Requireable<object>;
|
|
21
|
+
}
|
|
22
|
+
export namespace defaultProps {
|
|
23
|
+
const events_1: {};
|
|
24
|
+
export { events_1 as events };
|
|
25
|
+
const label_1: string;
|
|
26
|
+
export { label_1 as label };
|
|
27
|
+
const labelVisible_1: boolean;
|
|
28
|
+
export { labelVisible_1 as labelVisible };
|
|
29
|
+
const APIKEY_1: string;
|
|
30
|
+
export { APIKEY_1 as APIKEY };
|
|
31
|
+
const showLngLat_1: boolean;
|
|
32
|
+
export { showLngLat_1 as showLngLat };
|
|
33
|
+
const showMap_1: boolean;
|
|
34
|
+
export { showMap_1 as showMap };
|
|
35
|
+
const defauleShowLocation_1: boolean;
|
|
36
|
+
export { defauleShowLocation_1 as defauleShowLocation };
|
|
37
|
+
const drag_1: boolean;
|
|
38
|
+
export { drag_1 as drag };
|
|
39
|
+
const zoom_1: boolean;
|
|
40
|
+
export { zoom_1 as zoom };
|
|
41
|
+
const disabled_1: boolean;
|
|
42
|
+
export { disabled_1 as disabled };
|
|
43
|
+
const requiredFlag_1: boolean;
|
|
44
|
+
export { requiredFlag_1 as requiredFlag };
|
|
45
|
+
const locationType_1: number;
|
|
46
|
+
export { locationType_1 as locationType };
|
|
47
|
+
const customLocation_1: {};
|
|
48
|
+
export { customLocation_1 as customLocation };
|
|
49
|
+
export namespace value_1 {
|
|
50
|
+
const address: string;
|
|
51
|
+
namespace geopoint {
|
|
52
|
+
const coordinates: number[];
|
|
53
|
+
const type: string;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export { value_1 as value };
|
|
57
|
+
export const readOnly: boolean;
|
|
58
|
+
export const isModalApp: boolean;
|
|
59
|
+
const dataSource_1: {};
|
|
60
|
+
export { dataSource_1 as dataSource };
|
|
61
|
+
}
|
|
62
|
+
import * as PropTypes from "prop-types";
|