@cloudbase/weda-ui 3.2.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cypress/support/commands.d.ts +1 -0
- package/dist/cypress/support/commands.js +40 -0
- package/dist/cypress/support/e2e.d.ts +24 -0
- package/dist/cypress/support/e2e.js +22 -0
- package/dist/src/configs/actions/showModal.json +48 -0
- package/dist/src/configs/actions/showToast.json +41 -0
- package/dist/src/configs/components/auth.json +16 -0
- package/dist/src/configs/components/button.json +239 -0
- package/dist/src/configs/components/calendar.json +81 -0
- package/dist/src/configs/components/carousel.json +292 -0
- package/dist/src/configs/components/chart/bar.json +954 -0
- package/dist/src/configs/components/chart/line.json +870 -0
- package/dist/src/configs/components/chart/pie.json +677 -0
- package/dist/src/configs/components/chart/statisticsCard.json +376 -0
- package/dist/src/configs/components/container.json +50 -0
- package/dist/src/configs/components/dataView.json +247 -0
- package/dist/src/configs/components/drawer.json +115 -0
- package/dist/src/configs/components/form/checkbox.json +179 -0
- package/dist/src/configs/components/form/departTreeSelect.json +124 -0
- package/dist/src/configs/components/form/form.json +73 -0
- package/dist/src/configs/components/form/input.json +154 -0
- package/dist/src/configs/components/form/location.json +216 -0
- package/dist/src/configs/components/form/radio.json +203 -0
- package/dist/src/configs/components/form/richText.json +133 -0
- package/dist/src/configs/components/form/select.json +449 -0
- package/dist/src/configs/components/form/switch.json +58 -0
- package/dist/src/configs/components/form/textarea.json +116 -0
- package/dist/src/configs/components/form/tips.json +34 -0
- package/dist/src/configs/components/form/uploader.json +171 -0
- package/dist/src/configs/components/form/uploaderFile.json +158 -0
- package/dist/src/configs/components/form/userTreeSelect.json +128 -0
- package/dist/src/configs/components/formdetail.json +105 -0
- package/dist/src/configs/components/graphicCard.json +413 -0
- package/dist/src/configs/components/image.json +187 -0
- package/dist/src/configs/components/link.json +79 -0
- package/dist/src/configs/components/listView.json +378 -0
- package/dist/src/configs/components/lottery.json +163 -0
- package/dist/src/configs/components/modal.json +72 -0
- package/dist/src/configs/components/navLayout.json +368 -0
- package/dist/src/configs/components/navigationBar.json +62 -0
- package/dist/src/configs/components/richtextview.json +26 -0
- package/dist/src/configs/components/scrollVeiw.json +253 -0
- package/dist/src/configs/components/slot.json +17 -0
- package/dist/src/configs/components/swiper.json +90 -0
- package/dist/src/configs/components/tabs.json +122 -0
- package/dist/src/configs/components/text.json +95 -0
- package/dist/src/configs/components/wedaVideo.json +89 -0
- package/dist/src/configs/components/wxOpenApi/phone.json +127 -0
- package/dist/src/configs/components/wxOpenApi/phoneCode.json +109 -0
- package/dist/src/configs/components/wxOpenApi/share.json +160 -0
- package/dist/src/configs/components/wxOpenApi/userInfo.json +156 -0
- package/dist/src/configs/index.d.ts +103 -0
- package/dist/src/configs/index.js +111 -0
- package/dist/src/docs/common/format.d.ts +13 -0
- package/dist/src/docs/common/format.js +122 -0
- package/dist/src/docs/common/tableView.d.ts +30 -0
- package/dist/src/docs/common/tableView.js +156 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +3 -0
- package/dist/src/setupTests.d.ts +2 -0
- package/dist/src/setupTests.js +19 -0
- package/dist/src/web/actions/index.d.ts +2 -0
- package/dist/src/web/actions/index.js +2 -0
- package/dist/src/web/actions/showModal/index.d.ts +4 -0
- package/dist/src/web/actions/showModal/index.js +67 -0
- package/dist/src/web/actions/showToast/index.d.ts +1 -0
- package/dist/src/web/actions/showToast/index.js +3 -0
- package/dist/src/web/components/button/index.d.ts +32 -0
- package/dist/src/web/components/button/index.js +48 -0
- package/dist/src/web/components/calendar/index.d.ts +19 -0
- package/dist/src/web/components/calendar/index.js +189 -0
- package/dist/src/web/components/calendar/util.d.ts +13 -0
- package/dist/src/web/components/calendar/util.js +74 -0
- package/dist/src/web/components/carousel/index.d.ts +41 -0
- package/dist/src/web/components/carousel/index.js +244 -0
- package/dist/src/web/components/chart/bar/index.d.ts +3 -0
- package/dist/src/web/components/chart/bar/index.js +41 -0
- package/dist/src/web/components/chart/bar/index.old.d.ts +40 -0
- package/dist/src/web/components/chart/bar/index.old.js +56 -0
- package/dist/src/web/components/chart/common/Chart.d.ts +9 -0
- package/dist/src/web/components/chart/common/Chart.js +23 -0
- package/dist/src/web/components/chart/common/chart-custom-connector.d.ts +6 -0
- package/dist/src/web/components/chart/common/chart-custom-connector.js +35 -0
- package/dist/src/web/components/chart/common/chart-error.d.ts +2 -0
- package/dist/src/web/components/chart/common/chart-error.js +2 -0
- package/dist/src/web/components/chart/common/config/bar.d.ts +48 -0
- package/dist/src/web/components/chart/common/config/bar.js +49 -0
- package/dist/src/web/components/chart/common/config/global.d.ts +13 -0
- package/dist/src/web/components/chart/common/config/global.js +16 -0
- package/dist/src/web/components/chart/common/config/line.d.ts +46 -0
- package/dist/src/web/components/chart/common/config/line.js +49 -0
- package/dist/src/web/components/chart/common/config/pie.d.ts +29 -0
- package/dist/src/web/components/chart/common/config/pie.js +36 -0
- package/dist/src/web/components/chart/common/core/eChartBar.d.ts +66 -0
- package/dist/src/web/components/chart/common/core/eChartBar.js +201 -0
- package/dist/src/web/components/chart/common/core/eChartBase.d.ts +127 -0
- package/dist/src/web/components/chart/common/core/eChartBase.js +394 -0
- package/dist/src/web/components/chart/common/core/eChartLine.d.ts +60 -0
- package/dist/src/web/components/chart/common/core/eChartLine.js +173 -0
- package/dist/src/web/components/chart/common/core/eChartPie.d.ts +48 -0
- package/dist/src/web/components/chart/common/core/eChartPie.js +135 -0
- package/dist/src/web/components/chart/common/core/type.d.ts +35 -0
- package/dist/src/web/components/chart/common/core/type.js +9 -0
- package/dist/src/web/components/chart/common/data-transform.d.ts +6 -0
- package/dist/src/web/components/chart/common/data-transform.js +246 -0
- package/dist/src/web/components/chart/common/echarts.d.ts +5 -0
- package/dist/src/web/components/chart/common/echarts.js +24 -0
- package/dist/src/web/components/chart/common/error-boundary.d.ts +5 -0
- package/dist/src/web/components/chart/common/error-boundary.js +26 -0
- package/dist/src/web/components/chart/common/useChart.d.ts +8 -0
- package/dist/src/web/components/chart/common/useChart.js +61 -0
- package/dist/src/web/components/chart/line/index.d.ts +3 -0
- package/dist/src/web/components/chart/line/index.js +42 -0
- package/dist/src/web/components/chart/line/index.old.d.ts +38 -0
- package/dist/src/web/components/chart/line/index.old.js +53 -0
- package/dist/src/web/components/chart/pie/index.d.ts +3 -0
- package/dist/src/web/components/chart/pie/index.js +42 -0
- package/dist/src/web/components/chart/pie/index.old.d.ts +27 -0
- package/dist/src/web/components/chart/pie/index.old.js +40 -0
- package/dist/src/web/components/chart/statisticsCard/index.d.ts +85 -0
- package/dist/src/web/components/chart/statisticsCard/index.js +203 -0
- package/dist/src/web/components/chart/statisticsCard/interface.d.ts +13 -0
- package/dist/src/web/components/chart/statisticsCard/interface.js +1 -0
- package/dist/src/web/components/common/portal.d.ts +7 -0
- package/dist/src/web/components/common/portal.js +14 -0
- package/dist/src/web/components/container/index.d.ts +6 -0
- package/dist/src/web/components/container/index.js +6 -0
- package/dist/src/web/components/dataView/index.d.ts +6 -0
- package/dist/src/web/components/dataView/index.js +8 -0
- package/dist/src/web/components/dataView/interface.d.ts +5 -0
- package/dist/src/web/components/dataView/interface.js +1 -0
- package/dist/src/web/components/drawer/index.d.ts +13 -0
- package/dist/src/web/components/drawer/index.js +12 -0
- package/dist/src/web/components/form/checkbox/index.d.ts +13 -0
- package/dist/src/web/components/form/checkbox/index.js +167 -0
- package/dist/src/web/components/form/enumSelect/MultipleSelect.d.ts +78 -0
- package/dist/src/web/components/form/enumSelect/MultipleSelect.js +52 -0
- package/dist/src/web/components/form/enumSelect/NormalSelect.d.ts +83 -0
- package/dist/src/web/components/form/enumSelect/NormalSelect.js +52 -0
- package/dist/src/web/components/form/enumSelect/SelectContainer.d.ts +16 -0
- package/dist/src/web/components/form/enumSelect/SelectContainer.js +30 -0
- package/dist/src/web/components/form/enumSelect/index.d.ts +82 -0
- package/dist/src/web/components/form/enumSelect/index.js +6 -0
- package/dist/src/web/components/form/enumSelect/props/defaultProps.d.ts +34 -0
- package/dist/src/web/components/form/enumSelect/props/defaultProps.js +40 -0
- package/dist/src/web/components/form/enumSelect/props/propsTypes.d.ts +39 -0
- package/dist/src/web/components/form/enumSelect/props/propsTypes.js +47 -0
- package/dist/src/web/components/form/form/index.d.ts +32 -0
- package/dist/src/web/components/form/form/index.js +141 -0
- package/dist/src/web/components/form/formcell/index.d.ts +8 -0
- package/dist/src/web/components/form/formcell/index.js +40 -0
- package/dist/src/web/components/form/input/index.d.ts +14 -0
- package/dist/src/web/components/form/input/index.js +86 -0
- package/dist/src/web/components/form/location/common/mapChoose.d.ts +15 -0
- package/dist/src/web/components/form/location/common/mapChoose.js +495 -0
- package/dist/src/web/components/form/location/common/mapView.d.ts +19 -0
- package/dist/src/web/components/form/location/common/mapView.js +172 -0
- package/dist/src/web/components/form/location/common/propsConfig.d.ts +59 -0
- package/dist/src/web/components/form/location/common/propsConfig.js +50 -0
- package/dist/src/web/components/form/location/common/selectModal.d.ts +21 -0
- package/dist/src/web/components/form/location/common/selectModal.js +44 -0
- package/dist/src/web/components/form/location/common/useLocationInfo.d.ts +36 -0
- package/dist/src/web/components/form/location/common/useLocationInfo.js +104 -0
- package/dist/src/web/components/form/location/components/LocationH5/location.h5.d.ts +8 -0
- package/dist/src/web/components/form/location/components/LocationH5/location.h5.js +325 -0
- package/dist/src/web/components/form/location/components/LocationPC/Header.d.ts +12 -0
- package/dist/src/web/components/form/location/components/LocationPC/Header.js +43 -0
- package/dist/src/web/components/form/location/components/LocationPC/location.PC.d.ts +8 -0
- package/dist/src/web/components/form/location/components/LocationPC/location.PC.js +224 -0
- package/dist/src/web/components/form/location/constants.d.ts +2 -0
- package/dist/src/web/components/form/location/constants.js +3 -0
- package/dist/src/web/components/form/location/index.d.ts +1 -0
- package/dist/src/web/components/form/location/index.js +17 -0
- package/dist/src/web/components/form/radio/index.d.ts +11 -0
- package/dist/src/web/components/form/radio/index.js +115 -0
- package/dist/src/web/components/form/renderDecorator.d.ts +6 -0
- package/dist/src/web/components/form/renderDecorator.js +20 -0
- package/dist/src/web/components/form/select/allTimePicker/calendar.d.ts +13 -0
- package/dist/src/web/components/form/select/allTimePicker/calendar.js +104 -0
- package/dist/src/web/components/form/select/allTimePicker/dataUtils.d.ts +24 -0
- package/dist/src/web/components/form/select/allTimePicker/dataUtils.js +265 -0
- package/dist/src/web/components/form/select/allTimePicker/index.d.ts +14 -0
- package/dist/src/web/components/form/select/allTimePicker/index.js +943 -0
- package/dist/src/web/components/form/select/dropdown-select/ui.d.ts +15 -0
- package/dist/src/web/components/form/select/dropdown-select/ui.js +55 -0
- package/dist/src/web/components/form/select/h5.d.ts +16 -0
- package/dist/src/web/components/form/select/h5.js +452 -0
- package/dist/src/web/components/form/select/index.d.ts +66 -0
- package/dist/src/web/components/form/select/index.js +241 -0
- package/dist/src/web/components/form/select/region/index.d.ts +6 -0
- package/dist/src/web/components/form/select/region/index.js +147 -0
- package/dist/src/web/components/form/select/time.d.ts +9 -0
- package/dist/src/web/components/form/select/time.js +146 -0
- package/dist/src/web/components/form/select/use-options.d.ts +26 -0
- package/dist/src/web/components/form/select/use-options.js +103 -0
- package/dist/src/web/components/form/select/year.d.ts +7 -0
- package/dist/src/web/components/form/select/year.js +72 -0
- package/dist/src/web/components/form/switch/index.d.ts +6 -0
- package/dist/src/web/components/form/switch/index.js +58 -0
- package/dist/src/web/components/form/textarea/index.d.ts +12 -0
- package/dist/src/web/components/form/textarea/index.js +66 -0
- package/dist/src/web/components/form/tips/index.d.ts +8 -0
- package/dist/src/web/components/form/tips/index.js +17 -0
- package/dist/src/web/components/form/uploader/index.d.ts +3 -0
- package/dist/src/web/components/form/uploader/index.js +42 -0
- package/dist/src/web/components/form/uploader/uploader.h5.d.ts +20 -0
- package/dist/src/web/components/form/uploader/uploader.h5.js +199 -0
- package/dist/src/web/components/form/uploader/uploader.pc.d.ts +29 -0
- package/dist/src/web/components/form/uploader/uploader.pc.js +208 -0
- package/dist/src/web/components/form/uploaderFile/index.d.ts +4 -0
- package/dist/src/web/components/form/uploaderFile/index.js +19 -0
- package/dist/src/web/components/form/uploaderFile/uploadFile.h5.d.ts +23 -0
- package/dist/src/web/components/form/uploaderFile/uploadFile.h5.js +328 -0
- package/dist/src/web/components/form/uploaderFile/uploadFile.pc.d.ts +24 -0
- package/dist/src/web/components/form/uploaderFile/uploadFile.pc.js +299 -0
- package/dist/src/web/components/form/userOrgSelect/comTool.d.ts +8 -0
- package/dist/src/web/components/form/userOrgSelect/comTool.js +107 -0
- package/dist/src/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.d.ts +19 -0
- package/dist/src/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.js +247 -0
- package/dist/src/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.pc.d.ts +4 -0
- package/dist/src/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.pc.js +158 -0
- package/dist/src/web/components/form/userOrgSelect/departTreeSelect/index.d.ts +2 -0
- package/dist/src/web/components/form/userOrgSelect/departTreeSelect/index.js +17 -0
- package/dist/src/web/components/form/userOrgSelect/index.d.ts +2 -0
- package/dist/src/web/components/form/userOrgSelect/index.js +17 -0
- package/dist/src/web/components/form/userOrgSelect/userTreeSelect.h5.d.ts +26 -0
- package/dist/src/web/components/form/userOrgSelect/userTreeSelect.h5.js +258 -0
- package/dist/src/web/components/form/userOrgSelect/userTreeSelect.pc.d.ts +9 -0
- package/dist/src/web/components/form/userOrgSelect/userTreeSelect.pc.js +271 -0
- package/dist/src/web/components/form/userOrgSelect/utils.d.ts +35 -0
- package/dist/src/web/components/form/userOrgSelect/utils.js +72 -0
- package/dist/src/web/components/formdetail/index.d.ts +28 -0
- package/dist/src/web/components/formdetail/index.js +170 -0
- package/dist/src/web/components/graphicCard/index.d.ts +46 -0
- package/dist/src/web/components/graphicCard/index.js +179 -0
- package/dist/src/web/components/image/image.d.ts +9 -0
- package/dist/src/web/components/image/image.js +119 -0
- package/dist/src/web/components/image/index.d.ts +13 -0
- package/dist/src/web/components/image/index.js +77 -0
- package/dist/src/web/components/index.d.ts +50 -0
- package/dist/src/web/components/index.js +99 -0
- package/dist/src/web/components/link/index.d.ts +24 -0
- package/dist/src/web/components/link/index.js +71 -0
- package/dist/src/web/components/listView/index.d.ts +7 -0
- package/dist/src/web/components/listView/index.js +296 -0
- package/dist/src/web/components/listView/interface.d.ts +127 -0
- package/dist/src/web/components/listView/interface.js +1 -0
- package/dist/src/web/components/lottery/index.d.ts +22 -0
- package/dist/src/web/components/lottery/index.js +391 -0
- package/dist/src/web/components/lottery/lotteryUtil.d.ts +23 -0
- package/dist/src/web/components/lottery/lotteryUtil.js +181 -0
- package/dist/src/web/components/modal/index.d.ts +17 -0
- package/dist/src/web/components/modal/index.js +11 -0
- package/dist/src/web/components/modal/modal.h5.d.ts +4 -0
- package/dist/src/web/components/modal/modal.h5.js +46 -0
- package/dist/src/web/components/modal/modal.pc.d.ts +3 -0
- package/dist/src/web/components/modal/modal.pc.js +31 -0
- package/dist/src/web/components/navLayout/index.d.ts +61 -0
- package/dist/src/web/components/navLayout/index.js +127 -0
- package/dist/src/web/components/navigationBar/common.d.ts +15 -0
- package/dist/src/web/components/navigationBar/common.js +127 -0
- package/dist/src/web/components/navigationBar/h5Menu.d.ts +14 -0
- package/dist/src/web/components/navigationBar/h5Menu.js +72 -0
- package/dist/src/web/components/navigationBar/horizontalMenu.d.ts +12 -0
- package/dist/src/web/components/navigationBar/horizontalMenu.js +99 -0
- package/dist/src/web/components/navigationBar/index.d.ts +13 -0
- package/dist/src/web/components/navigationBar/index.js +157 -0
- package/dist/src/web/components/navigationBar/verticalMenu.d.ts +13 -0
- package/dist/src/web/components/navigationBar/verticalMenu.js +38 -0
- package/dist/src/web/components/phone/index.d.ts +18 -0
- package/dist/src/web/components/phone/index.js +4 -0
- package/dist/src/web/components/phoneCode/index.d.ts +18 -0
- package/dist/src/web/components/phoneCode/index.js +4 -0
- package/dist/src/web/components/picker/datePicker.d.ts +10 -0
- package/dist/src/web/components/picker/datePicker.js +31 -0
- package/dist/src/web/components/picker/picker.d.ts +6 -0
- package/dist/src/web/components/picker/picker.js +45 -0
- package/dist/src/web/components/picker/timePicker.d.ts +7 -0
- package/dist/src/web/components/picker/timePicker.js +42 -0
- package/dist/src/web/components/richText/const.d.ts +1 -0
- package/dist/src/web/components/richText/const.js +2 -0
- package/dist/src/web/components/richText/index.d.ts +50 -0
- package/dist/src/web/components/richText/index.js +352 -0
- package/dist/src/web/components/richTextView/index.d.ts +7 -0
- package/dist/src/web/components/richTextView/index.js +44 -0
- package/dist/src/web/components/scrollView/index.d.ts +27 -0
- package/dist/src/web/components/scrollView/index.js +95 -0
- package/dist/src/web/components/share/index.d.ts +34 -0
- package/dist/src/web/components/share/index.js +4 -0
- package/dist/src/web/components/slot/index.d.ts +6 -0
- package/dist/src/web/components/slot/index.js +9 -0
- package/dist/src/web/components/swiper/index.d.ts +24 -0
- package/dist/src/web/components/swiper/index.js +153 -0
- package/dist/src/web/components/tabs/index.d.ts +13 -0
- package/dist/src/web/components/tabs/index.js +15 -0
- package/dist/src/web/components/tabs/tabs.h5.d.ts +4 -0
- package/dist/src/web/components/tabs/tabs.h5.js +42 -0
- package/dist/src/web/components/tabs/tabs.pc.d.ts +3 -0
- package/dist/src/web/components/tabs/tabs.pc.js +40 -0
- package/dist/src/web/components/text/index.d.ts +14 -0
- package/dist/src/web/components/text/index.js +17 -0
- package/dist/src/web/components/uploaderFileView/index.d.ts +10 -0
- package/dist/src/web/components/uploaderFileView/index.js +46 -0
- package/dist/src/web/components/uploaderView/index.d.ts +17 -0
- package/dist/src/web/components/uploaderView/index.js +48 -0
- package/dist/src/web/components/userInfo/index.d.ts +26 -0
- package/dist/src/web/components/userInfo/index.js +4 -0
- package/dist/src/web/components/wedaVideo/index.d.ts +17 -0
- package/dist/src/web/components/wedaVideo/index.js +144 -0
- package/dist/src/web/index.d.ts +8 -0
- package/dist/src/web/index.js +4 -0
- package/dist/src/web/utils/classnames.d.ts +2 -0
- package/dist/src/web/utils/classnames.js +37 -0
- package/dist/src/web/utils/constant.d.ts +23 -0
- package/dist/src/web/utils/constant.js +24 -0
- package/dist/src/web/utils/debounce.d.ts +2 -0
- package/dist/src/web/utils/debounce.js +92 -0
- package/dist/src/web/utils/getLocalCounter.d.ts +1 -0
- package/dist/src/web/utils/getLocalCounter.js +4 -0
- package/dist/src/web/utils/getUserService.d.ts +11 -0
- package/dist/src/web/utils/getUserService.js +156 -0
- package/dist/src/web/utils/isObjectEqual.d.ts +2 -0
- package/dist/src/web/utils/isObjectEqual.js +12 -0
- package/dist/src/web/utils/loading-fallback.d.ts +2 -0
- package/dist/src/web/utils/loading-fallback.js +2 -0
- package/dist/src/web/utils/lodash.d.ts +1 -0
- package/dist/src/web/utils/lodash.js +2 -0
- package/dist/src/web/utils/platform.d.ts +18 -0
- package/dist/src/web/utils/platform.js +193 -0
- package/dist/src/web/utils/tcb.d.ts +33 -0
- package/dist/src/web/utils/tcb.js +118 -0
- package/dist/src/web/utils/tmap.d.ts +3 -0
- package/dist/src/web/utils/tmap.js +21 -0
- package/dist/src/web/utils/use-cloud-id-temp-url.d.ts +1 -0
- package/dist/src/web/utils/use-cloud-id-temp-url.js +15 -0
- package/dist/src/web/utils/useSetState.d.ts +1 -0
- package/dist/src/web/utils/useSetState.js +8 -0
- package/dist/src/web/utils/useSyncValue.d.ts +4 -0
- package/dist/src/web/utils/useSyncValue.js +15 -0
- package/dist/src/web/utils/weui.d.ts +1 -0
- package/dist/src/web/utils/weui.js +2 -0
- package/dist/web/components/form/select/allTimePicker/calendar.css +114 -0
- package/dist/web/components/form/select/allTimePicker/index.css +136 -0
- package/dist/web/components/form/userOrgSelect/userOrgSelect.css +805 -0
- package/package.json +15 -2
|
@@ -0,0 +1,59 @@
|
|
|
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<NonNullable<PropTypes.ReactNodeLike>>;
|
|
17
|
+
const value: PropTypes.Requireable<object>;
|
|
18
|
+
const locationType: PropTypes.Requireable<number>;
|
|
19
|
+
const dataSource: PropTypes.Requireable<object>;
|
|
20
|
+
}
|
|
21
|
+
export namespace defaultProps {
|
|
22
|
+
const events_1: {};
|
|
23
|
+
export { events_1 as events };
|
|
24
|
+
const label_1: string;
|
|
25
|
+
export { label_1 as label };
|
|
26
|
+
const labelVisible_1: boolean;
|
|
27
|
+
export { labelVisible_1 as labelVisible };
|
|
28
|
+
const APIKEY_1: string;
|
|
29
|
+
export { APIKEY_1 as APIKEY };
|
|
30
|
+
const showLngLat_1: boolean;
|
|
31
|
+
export { showLngLat_1 as showLngLat };
|
|
32
|
+
const showMap_1: boolean;
|
|
33
|
+
export { showMap_1 as showMap };
|
|
34
|
+
const defauleShowLocation_1: boolean;
|
|
35
|
+
export { defauleShowLocation_1 as defauleShowLocation };
|
|
36
|
+
const drag_1: boolean;
|
|
37
|
+
export { drag_1 as drag };
|
|
38
|
+
const zoom_1: boolean;
|
|
39
|
+
export { zoom_1 as zoom };
|
|
40
|
+
const disabled_1: boolean;
|
|
41
|
+
export { disabled_1 as disabled };
|
|
42
|
+
const requiredFlag_1: boolean;
|
|
43
|
+
export { requiredFlag_1 as requiredFlag };
|
|
44
|
+
const locationType_1: number;
|
|
45
|
+
export { locationType_1 as locationType };
|
|
46
|
+
export namespace value_1 {
|
|
47
|
+
const address: string;
|
|
48
|
+
namespace geopoint {
|
|
49
|
+
const coordinates: number[];
|
|
50
|
+
const type: string;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export { value_1 as value };
|
|
54
|
+
export const readOnly: boolean;
|
|
55
|
+
export const isModalApp: boolean;
|
|
56
|
+
const dataSource_1: {};
|
|
57
|
+
export { dataSource_1 as dataSource };
|
|
58
|
+
}
|
|
59
|
+
import * as PropTypes from "prop-types";
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as PropTypes from 'prop-types';
|
|
2
|
+
export const propTypes = {
|
|
3
|
+
// 系统属性
|
|
4
|
+
id: PropTypes.string,
|
|
5
|
+
className: PropTypes.string,
|
|
6
|
+
style: PropTypes.string,
|
|
7
|
+
events: PropTypes.object,
|
|
8
|
+
// 组件属性
|
|
9
|
+
label: PropTypes.string,
|
|
10
|
+
labelVisible: PropTypes.bool,
|
|
11
|
+
APIKEY: PropTypes.string,
|
|
12
|
+
showLngLat: PropTypes.bool,
|
|
13
|
+
showMap: PropTypes.bool,
|
|
14
|
+
defauleShowLocation: PropTypes.bool,
|
|
15
|
+
drag: PropTypes.bool,
|
|
16
|
+
zoom: PropTypes.bool,
|
|
17
|
+
disabled: PropTypes.bool,
|
|
18
|
+
requiredFlag: PropTypes.bool,
|
|
19
|
+
decorator: PropTypes.oneOfType([PropTypes.array, PropTypes.node]),
|
|
20
|
+
value: PropTypes.object,
|
|
21
|
+
locationType: PropTypes.number,
|
|
22
|
+
dataSource: PropTypes.object,
|
|
23
|
+
};
|
|
24
|
+
export const defaultProps = {
|
|
25
|
+
// 系统属性
|
|
26
|
+
events: {},
|
|
27
|
+
// 组件属性
|
|
28
|
+
label: '地图定位',
|
|
29
|
+
labelVisible: true,
|
|
30
|
+
APIKEY: '',
|
|
31
|
+
showLngLat: false,
|
|
32
|
+
showMap: false,
|
|
33
|
+
defauleShowLocation: false,
|
|
34
|
+
drag: true,
|
|
35
|
+
zoom: true,
|
|
36
|
+
disabled: false,
|
|
37
|
+
requiredFlag: false,
|
|
38
|
+
locationType: 1,
|
|
39
|
+
// 模型应用属性
|
|
40
|
+
value: {
|
|
41
|
+
address: '',
|
|
42
|
+
geopoint: {
|
|
43
|
+
coordinates: [39.984104, 116.307503],
|
|
44
|
+
type: 'Point',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
readOnly: false,
|
|
48
|
+
isModalApp: false,
|
|
49
|
+
dataSource: {},
|
|
50
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default function SelectModal({ currentLocations, location, setLocation, isSelectMapVisible, setIsSelectMapVisible, chooseLocation, APIKEY, locationRange, customRange, }: {
|
|
2
|
+
currentLocations?: {
|
|
3
|
+
latlng: {
|
|
4
|
+
lat: any;
|
|
5
|
+
lng: any;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
location?: {
|
|
9
|
+
latlng: {
|
|
10
|
+
lat: any;
|
|
11
|
+
lng: any;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
setLocation: any;
|
|
15
|
+
isSelectMapVisible?: boolean;
|
|
16
|
+
setIsSelectMapVisible: any;
|
|
17
|
+
chooseLocation: any;
|
|
18
|
+
APIKEY?: string;
|
|
19
|
+
locationRange: any;
|
|
20
|
+
customRange: any;
|
|
21
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Modal, Button } from 'tea-component';
|
|
5
|
+
import { usePlatform } from '../../../../utils/platform';
|
|
6
|
+
import classNames from '../../../../utils/classnames';
|
|
7
|
+
import MapChoose from './mapChoose';
|
|
8
|
+
import './selectModal.css';
|
|
9
|
+
const { useRef, useState } = React;
|
|
10
|
+
const defaultLatLng = { latlng: { lat: null, lng: null } };
|
|
11
|
+
export default function SelectModal({ currentLocations = defaultLatLng, location = defaultLatLng, setLocation, isSelectMapVisible = false, setIsSelectMapVisible, chooseLocation, APIKEY = '', locationRange, customRange, }) {
|
|
12
|
+
const latlng = location.latlng || { lat: null, lng: null };
|
|
13
|
+
const positionRef = useRef({});
|
|
14
|
+
const platform = usePlatform();
|
|
15
|
+
const isPC = platform === 'pc';
|
|
16
|
+
const [confirmStatus, setConfirmStatus] = useState(true);
|
|
17
|
+
const close = () => setIsSelectMapVisible(false);
|
|
18
|
+
const confirm = () => {
|
|
19
|
+
if (positionRef.current.latlng) {
|
|
20
|
+
setLocation(positionRef.current);
|
|
21
|
+
chooseLocation(positionRef.current);
|
|
22
|
+
}
|
|
23
|
+
close();
|
|
24
|
+
};
|
|
25
|
+
const getPosition = (value) => {
|
|
26
|
+
const { title, location, address } = value;
|
|
27
|
+
let loc = {
|
|
28
|
+
poiname: title,
|
|
29
|
+
detailedAddress: address,
|
|
30
|
+
latlng: { lat: location.lat, lng: location.lng },
|
|
31
|
+
};
|
|
32
|
+
positionRef.current = loc;
|
|
33
|
+
};
|
|
34
|
+
return (React.createElement(Modal, { visible: isSelectMapVisible, caption: "\u9009\u62E9\u5730\u7406\u4F4D\u7F6E", onClose: close, className: classNames({
|
|
35
|
+
'weda-ui_form-select': true,
|
|
36
|
+
'form-select-map': !isPC,
|
|
37
|
+
'form-select-map-pc': isPC,
|
|
38
|
+
}), ...(isPC ? { size: 1200 } : {}) },
|
|
39
|
+
React.createElement(Modal.Body, null,
|
|
40
|
+
React.createElement(MapChoose, { latlng: latlng, currentLocations: currentLocations, changeLocation: getPosition, isPC: isPC, APIKEY: APIKEY, onClose: close, onConfirm: confirm, locationRange: locationRange, customRange: customRange, setConfirmStatus: setConfirmStatus })),
|
|
41
|
+
React.createElement(Modal.Footer, null,
|
|
42
|
+
React.createElement(Button, { type: "primary", onClick: confirm, disabled: confirmStatus }, "\u786E\u5B9A"),
|
|
43
|
+
React.createElement(Button, { type: "weak", onClick: close }, "\u53D6\u6D88"))));
|
|
44
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export default function useLocationInfo({ apiKey, locationType, eventsChange, dataSourceStatus, }: {
|
|
2
|
+
apiKey: any;
|
|
3
|
+
locationType: any;
|
|
4
|
+
eventsChange: any;
|
|
5
|
+
dataSourceStatus: any;
|
|
6
|
+
}): {
|
|
7
|
+
location: {
|
|
8
|
+
poiname: string;
|
|
9
|
+
detailedAddress: string;
|
|
10
|
+
latlng: {
|
|
11
|
+
lat: number;
|
|
12
|
+
lng: number;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
setLocation: React.Dispatch<React.SetStateAction<{
|
|
16
|
+
poiname: string;
|
|
17
|
+
detailedAddress: string;
|
|
18
|
+
latlng: {
|
|
19
|
+
lat: number;
|
|
20
|
+
lng: number;
|
|
21
|
+
};
|
|
22
|
+
}>>;
|
|
23
|
+
apiKeyStatus: {
|
|
24
|
+
status: boolean;
|
|
25
|
+
message: string;
|
|
26
|
+
};
|
|
27
|
+
setApiKeyStatus: React.Dispatch<React.SetStateAction<{
|
|
28
|
+
status: boolean;
|
|
29
|
+
message: string;
|
|
30
|
+
}>>;
|
|
31
|
+
currentLocStatus: boolean;
|
|
32
|
+
currentLocations: React.MutableRefObject<undefined>;
|
|
33
|
+
customLocation: React.MutableRefObject<undefined>;
|
|
34
|
+
checkCustomLocation: (params: any) => boolean;
|
|
35
|
+
};
|
|
36
|
+
import * as React from "react";
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
const { useEffect, useState, useRef } = React;
|
|
5
|
+
export default function useLocationInfo({ apiKey: APIKEY, locationType, eventsChange, dataSourceStatus, }) {
|
|
6
|
+
const [location, setLocation] = useState({
|
|
7
|
+
poiname: '',
|
|
8
|
+
detailedAddress: '',
|
|
9
|
+
latlng: { lat: 39.98410411, lng: 116.307503 },
|
|
10
|
+
});
|
|
11
|
+
const [apiKeyStatus, setApiKeyStatus] = useState({
|
|
12
|
+
status: false,
|
|
13
|
+
message: '定位功能初始化中,请稍后重试',
|
|
14
|
+
});
|
|
15
|
+
const [currentLocStatus, setCurrentLocStatus] = useState(false);
|
|
16
|
+
const currentLocations = useRef();
|
|
17
|
+
const customLocation = useRef();
|
|
18
|
+
const checkCustomLocation = (params) => {
|
|
19
|
+
var _a;
|
|
20
|
+
let status = true;
|
|
21
|
+
if (!(params === null || params === void 0 ? void 0 : params.address) || !(params === null || params === void 0 ? void 0 : params.detailedAddress)) {
|
|
22
|
+
status = false;
|
|
23
|
+
}
|
|
24
|
+
else if (((_a = params === null || params === void 0 ? void 0 : params.geopoint) === null || _a === void 0 ? void 0 : _a.type) != 'Point') {
|
|
25
|
+
status = false;
|
|
26
|
+
}
|
|
27
|
+
return status;
|
|
28
|
+
};
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (!dataSourceStatus ||
|
|
31
|
+
!APIKEY ||
|
|
32
|
+
new RegExp('[\\u4E00-\\u9FFF]+', 'g').test(APIKEY))
|
|
33
|
+
return;
|
|
34
|
+
function loadScript() {
|
|
35
|
+
// 移除之前的
|
|
36
|
+
if (document.getElementById('form-location-plug')) {
|
|
37
|
+
document.body.removeChild(document.getElementById('form-location-plug'));
|
|
38
|
+
}
|
|
39
|
+
const script = document.createElement('script');
|
|
40
|
+
script.type = 'text/javascript';
|
|
41
|
+
script.src = `https://apis.map.qq.com/tools/geolocation/min?key=${APIKEY}&referer=myapp`;
|
|
42
|
+
script.setAttribute('id', 'form-location-plug');
|
|
43
|
+
script.onload = () => {
|
|
44
|
+
let geolocation = new window.qq.maps.Geolocation();
|
|
45
|
+
geolocation.getIpLocation(({ city, lat, lng, addr }) => {
|
|
46
|
+
setApiKeyStatus({ status: true, message: '' });
|
|
47
|
+
setCurrentLocStatus(true);
|
|
48
|
+
let locations = {
|
|
49
|
+
poiname: city + addr,
|
|
50
|
+
detailedAddress: city + addr,
|
|
51
|
+
latlng: { lat, lng },
|
|
52
|
+
locationType,
|
|
53
|
+
};
|
|
54
|
+
currentLocations.current = locations;
|
|
55
|
+
if (checkCustomLocation(customLocation.current))
|
|
56
|
+
return;
|
|
57
|
+
setLocation(locations);
|
|
58
|
+
eventsChange &&
|
|
59
|
+
eventsChange({
|
|
60
|
+
poiname: city + addr,
|
|
61
|
+
detailedAddress: city + addr,
|
|
62
|
+
latitude: lat,
|
|
63
|
+
longitude: lng,
|
|
64
|
+
}, locationType === 1);
|
|
65
|
+
}, (error) => {
|
|
66
|
+
console.log('error loc', error);
|
|
67
|
+
currentLocations.current = null;
|
|
68
|
+
setApiKeyStatus({
|
|
69
|
+
status: false,
|
|
70
|
+
message: error.code === 1
|
|
71
|
+
? '请打开定位权限'
|
|
72
|
+
: error.message || '定位失败',
|
|
73
|
+
});
|
|
74
|
+
setCurrentLocStatus(false);
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
script.onerror = (error) => {
|
|
78
|
+
console.log('Geolocation script onerror', error);
|
|
79
|
+
setApiKeyStatus({
|
|
80
|
+
status: false,
|
|
81
|
+
message: '定位失败',
|
|
82
|
+
});
|
|
83
|
+
setLocation({
|
|
84
|
+
poiname: '',
|
|
85
|
+
detailedAddress: '',
|
|
86
|
+
latlng: { lat: 39.98410411, lng: 116.307503 },
|
|
87
|
+
locationType,
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
document.body.appendChild(script);
|
|
91
|
+
}
|
|
92
|
+
loadScript();
|
|
93
|
+
}, [APIKEY, locationType]);
|
|
94
|
+
return {
|
|
95
|
+
location,
|
|
96
|
+
setLocation,
|
|
97
|
+
apiKeyStatus,
|
|
98
|
+
setApiKeyStatus,
|
|
99
|
+
currentLocStatus,
|
|
100
|
+
currentLocations,
|
|
101
|
+
customLocation,
|
|
102
|
+
checkCustomLocation,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare function LocationH5(props: any): JSX.Element;
|
|
2
|
+
declare namespace LocationH5 {
|
|
3
|
+
export { propTypes };
|
|
4
|
+
export { defaultProps };
|
|
5
|
+
}
|
|
6
|
+
export default LocationH5;
|
|
7
|
+
import { propTypes } from "../../common/propsConfig";
|
|
8
|
+
import { defaultProps } from "../../common/propsConfig";
|
|
@@ -0,0 +1,325 @@
|
|
|
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 weui from '../../../../../utils/weui';
|
|
6
|
+
import './index.css';
|
|
7
|
+
import { renderDecorator } from '../../../renderDecorator';
|
|
8
|
+
import MapView from '../../common/mapView';
|
|
9
|
+
import SelectModal from '../../common/selectModal';
|
|
10
|
+
import { propTypes, defaultProps } from '../../common/propsConfig';
|
|
11
|
+
import { callDataSource } from '../../../../../utils/tcb';
|
|
12
|
+
import { inH5IsMobile } from '../../../../../utils/platform';
|
|
13
|
+
import styles from './location.module.css';
|
|
14
|
+
const { useEffect, useState, useRef } = React;
|
|
15
|
+
export default function LocationH5(props) {
|
|
16
|
+
const {
|
|
17
|
+
// 系统属性
|
|
18
|
+
id, className, style, events,
|
|
19
|
+
// 组件属性
|
|
20
|
+
value, label, labelVisible, showLngLat, showMap, drag, zoom, disabled, requiredFlag, decorator, locationType, dataSource, layout, locationRange, customRange, } = props;
|
|
21
|
+
const cls = classNames({
|
|
22
|
+
'weda-ui': true,
|
|
23
|
+
cloudbase_standard: true,
|
|
24
|
+
[className]: className,
|
|
25
|
+
});
|
|
26
|
+
const [isSelectMapVisible, setIsSelectMapVisible] = useState(false);
|
|
27
|
+
const [currentLocStatus, setCurrentLocStatus] = useState(false);
|
|
28
|
+
const [dataSourceStatus, setDataSourceStatus] = useState({
|
|
29
|
+
status: false,
|
|
30
|
+
message: '定位功能初始化中,请稍后重试',
|
|
31
|
+
});
|
|
32
|
+
const [APIKEY, setAPIKEY] = useState('');
|
|
33
|
+
const [apiKeyStatus, setApiKeyStatus] = useState({
|
|
34
|
+
status: false,
|
|
35
|
+
message: '定位功能初始化中,请稍后重试',
|
|
36
|
+
});
|
|
37
|
+
const [location, setLocation] = useState({
|
|
38
|
+
detailedAddress: '',
|
|
39
|
+
poiname: '',
|
|
40
|
+
latlng: { lat: 39.98410411, lng: 116.307503 },
|
|
41
|
+
});
|
|
42
|
+
const currentLocations = useRef();
|
|
43
|
+
const customLocation = useRef();
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (value || !currentLocations.current)
|
|
46
|
+
return;
|
|
47
|
+
// 重置表单时
|
|
48
|
+
const { poiname, detailedAddress, latlng: { lat, lng }, } = currentLocations.current;
|
|
49
|
+
let location = {
|
|
50
|
+
poiname,
|
|
51
|
+
detailedAddress,
|
|
52
|
+
latlng: { lat, lng },
|
|
53
|
+
};
|
|
54
|
+
if (locationType === 1) {
|
|
55
|
+
location.locationType = 1;
|
|
56
|
+
events.change({ value: {} });
|
|
57
|
+
}
|
|
58
|
+
else if (locationType === 2) {
|
|
59
|
+
let res = {
|
|
60
|
+
value: {
|
|
61
|
+
address: poiname,
|
|
62
|
+
detailedAddress,
|
|
63
|
+
geopoint: {
|
|
64
|
+
coordinates: [lng, lat],
|
|
65
|
+
type: 'Point',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
events.change && events.change(res);
|
|
70
|
+
}
|
|
71
|
+
setLocation(location);
|
|
72
|
+
}, [value, locationType]);
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
let loc = {
|
|
75
|
+
latlng: {
|
|
76
|
+
lat: 39.98410411,
|
|
77
|
+
lng: 116.307503,
|
|
78
|
+
},
|
|
79
|
+
poiname: '',
|
|
80
|
+
detailedAddress: '',
|
|
81
|
+
locationType,
|
|
82
|
+
};
|
|
83
|
+
setLocation(loc);
|
|
84
|
+
// 暂不支持自定位置,初始化表单值都是{}
|
|
85
|
+
events.change({ value: {} });
|
|
86
|
+
}, [locationType]);
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
if (checkCustomLocation(value)) {
|
|
89
|
+
// 表单为新增时回传点位信息
|
|
90
|
+
const { address, detailedAddress, geopoint } = value;
|
|
91
|
+
const coordinates = (geopoint === null || geopoint === void 0 ? void 0 : geopoint.coordinates) || [];
|
|
92
|
+
let loc = {
|
|
93
|
+
poiname: address,
|
|
94
|
+
detailedAddress: detailedAddress,
|
|
95
|
+
latlng: { lng: coordinates[0], lat: coordinates[1] },
|
|
96
|
+
};
|
|
97
|
+
customLocation.current = value;
|
|
98
|
+
setLocation(loc);
|
|
99
|
+
}
|
|
100
|
+
}, [value]);
|
|
101
|
+
// 获取定位信息
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
if (!dataSourceStatus.status ||
|
|
104
|
+
!APIKEY ||
|
|
105
|
+
new RegExp('[\\u4E00-\\u9FFF]+', 'g').test(APIKEY))
|
|
106
|
+
return;
|
|
107
|
+
function loadScript() {
|
|
108
|
+
// 移除之前的
|
|
109
|
+
if (document.getElementById('form-location-plug')) {
|
|
110
|
+
document.body.removeChild(document.getElementById('form-location-plug'));
|
|
111
|
+
}
|
|
112
|
+
const script = document.createElement('script');
|
|
113
|
+
script.type = 'text/javascript';
|
|
114
|
+
script.src = `https://apis.map.qq.com/tools/geolocation/min?key=${APIKEY}&referer=myapp`;
|
|
115
|
+
script.setAttribute('id', 'form-location-plug');
|
|
116
|
+
script.onload = () => {
|
|
117
|
+
let geolocation = new window.qq.maps.Geolocation();
|
|
118
|
+
let getLocationType = inH5IsMobile() ? 'getLocation' : 'getIpLocation';
|
|
119
|
+
geolocation[getLocationType]((ipLocation) => {
|
|
120
|
+
const { city, lat, lng, addr } = ipLocation;
|
|
121
|
+
setApiKeyStatus({
|
|
122
|
+
status: true,
|
|
123
|
+
message: '',
|
|
124
|
+
});
|
|
125
|
+
setCurrentLocStatus(true);
|
|
126
|
+
let loc = {
|
|
127
|
+
poiname: city + addr,
|
|
128
|
+
detailedAddress: city + addr,
|
|
129
|
+
latlng: { lat, lng },
|
|
130
|
+
};
|
|
131
|
+
if (locationType === 1) {
|
|
132
|
+
loc.locationType = 1;
|
|
133
|
+
}
|
|
134
|
+
currentLocations.current = loc;
|
|
135
|
+
// 表单为新增时检查是否为回传点位信息
|
|
136
|
+
if (checkCustomLocation(customLocation.current))
|
|
137
|
+
return;
|
|
138
|
+
setLocation(loc);
|
|
139
|
+
if (locationType === 2) {
|
|
140
|
+
events.change &&
|
|
141
|
+
events.change({
|
|
142
|
+
value: {
|
|
143
|
+
address: city + addr,
|
|
144
|
+
detailedAddress: city + addr,
|
|
145
|
+
geopoint: {
|
|
146
|
+
coordinates: [lng, lat],
|
|
147
|
+
type: 'Point',
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}, (error) => {
|
|
153
|
+
console.log('error loc', error);
|
|
154
|
+
currentLocations.current = null;
|
|
155
|
+
setApiKeyStatus({
|
|
156
|
+
status: false,
|
|
157
|
+
message: error.code === 1
|
|
158
|
+
? '请打开定位权限'
|
|
159
|
+
: error.message || '定位失败',
|
|
160
|
+
});
|
|
161
|
+
setCurrentLocStatus(false);
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
script.onerror = (error) => {
|
|
165
|
+
console.log('Geolocation script onerror', error);
|
|
166
|
+
setApiKeyStatus({
|
|
167
|
+
status: false,
|
|
168
|
+
message: '定位失败',
|
|
169
|
+
});
|
|
170
|
+
setLocation({
|
|
171
|
+
poiname: '',
|
|
172
|
+
detailedAddress: '',
|
|
173
|
+
latlng: { lat: 39.98410411, lng: 116.307503 },
|
|
174
|
+
});
|
|
175
|
+
showToast('定位失败');
|
|
176
|
+
};
|
|
177
|
+
document.body.appendChild(script);
|
|
178
|
+
}
|
|
179
|
+
loadScript();
|
|
180
|
+
}, [APIKEY, locationType, dataSourceStatus]);
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
// 调用连接器数据源方法
|
|
183
|
+
if (dataSource.name) {
|
|
184
|
+
callDataSource({
|
|
185
|
+
dataSourceName: dataSource.name,
|
|
186
|
+
methodName: 'getApiKey',
|
|
187
|
+
})
|
|
188
|
+
.then((res) => {
|
|
189
|
+
if (res.apiKey) {
|
|
190
|
+
setAPIKEY(res.apiKey);
|
|
191
|
+
setDataSourceStatus({
|
|
192
|
+
status: true,
|
|
193
|
+
message: '',
|
|
194
|
+
});
|
|
195
|
+
setApiKeyStatus({
|
|
196
|
+
status: true,
|
|
197
|
+
message: '',
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
})
|
|
201
|
+
.catch((error) => {
|
|
202
|
+
console.log('datasources error', error);
|
|
203
|
+
setDataSourceStatus({
|
|
204
|
+
status: false,
|
|
205
|
+
message: error,
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
setDataSourceStatus({
|
|
211
|
+
status: false,
|
|
212
|
+
message: '请配置地图连接器',
|
|
213
|
+
});
|
|
214
|
+
showToast('请配置地图连接器');
|
|
215
|
+
}
|
|
216
|
+
}, [dataSource]);
|
|
217
|
+
const checkCustomLocation = (params) => {
|
|
218
|
+
var _a;
|
|
219
|
+
let status = true;
|
|
220
|
+
if (!(params === null || params === void 0 ? void 0 : params.address) || !(params === null || params === void 0 ? void 0 : params.detailedAddress)) {
|
|
221
|
+
status = false;
|
|
222
|
+
}
|
|
223
|
+
else if (((_a = params === null || params === void 0 ? void 0 : params.geopoint) === null || _a === void 0 ? void 0 : _a.type) != 'Point') {
|
|
224
|
+
status = false;
|
|
225
|
+
}
|
|
226
|
+
return status;
|
|
227
|
+
};
|
|
228
|
+
const showToast = (message) => {
|
|
229
|
+
weui.toast(message, {
|
|
230
|
+
duration: 2000,
|
|
231
|
+
className: 'weui-form-location_toast',
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
const handleChooseLocation = () => {
|
|
235
|
+
if (disabled)
|
|
236
|
+
return;
|
|
237
|
+
if (!dataSourceStatus.status)
|
|
238
|
+
return showToast(dataSourceStatus.message);
|
|
239
|
+
if (!apiKeyStatus.status)
|
|
240
|
+
return showToast(apiKeyStatus.message);
|
|
241
|
+
if (!currentLocStatus)
|
|
242
|
+
return showToast('获取位置信息中,请稍后重试');
|
|
243
|
+
setIsSelectMapVisible(true);
|
|
244
|
+
};
|
|
245
|
+
const onChangeLocation = (value) => {
|
|
246
|
+
const { poiname, latlng, detailedAddress } = value;
|
|
247
|
+
let res = {
|
|
248
|
+
value: {
|
|
249
|
+
address: poiname,
|
|
250
|
+
detailedAddress,
|
|
251
|
+
geopoint: {
|
|
252
|
+
coordinates: [latlng.lng, latlng.lat],
|
|
253
|
+
type: 'Point',
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
};
|
|
257
|
+
events.change && events.change(res);
|
|
258
|
+
};
|
|
259
|
+
const getIsShowMap = () => {
|
|
260
|
+
let status = showMap;
|
|
261
|
+
if (locationType === 1 && location.locationType === 1) {
|
|
262
|
+
status = false;
|
|
263
|
+
}
|
|
264
|
+
else if (locationType === 2 && !dataSourceStatus.status) {
|
|
265
|
+
status = false;
|
|
266
|
+
}
|
|
267
|
+
else if (locationType === 2 && !apiKeyStatus.status) {
|
|
268
|
+
status = false;
|
|
269
|
+
}
|
|
270
|
+
else if (!currentLocStatus) {
|
|
271
|
+
status = false;
|
|
272
|
+
}
|
|
273
|
+
return status;
|
|
274
|
+
};
|
|
275
|
+
const getIsShowAddr = () => {
|
|
276
|
+
let status = true;
|
|
277
|
+
if (locationType === 1 && location.locationType === 1) {
|
|
278
|
+
status = false;
|
|
279
|
+
}
|
|
280
|
+
else if (locationType === 2 && !dataSourceStatus.status) {
|
|
281
|
+
status = false;
|
|
282
|
+
}
|
|
283
|
+
else if (locationType === 2 && !apiKeyStatus.status) {
|
|
284
|
+
status = false;
|
|
285
|
+
}
|
|
286
|
+
else if (!currentLocStatus) {
|
|
287
|
+
status = false;
|
|
288
|
+
}
|
|
289
|
+
return status;
|
|
290
|
+
};
|
|
291
|
+
const LocationEl = (React.createElement("div", { className: "form-location weda-ui_form-location", "data-testid": "form-location" },
|
|
292
|
+
React.createElement("div", { className: `form-location-warp ${styles.locationDisabled}`, style: { display: layout === 'vertical' ? 'block' : 'flex' } },
|
|
293
|
+
labelVisible && (React.createElement("div", { className: "form-location-label" },
|
|
294
|
+
React.createElement("label", null, label),
|
|
295
|
+
requiredFlag && React.createElement("span", null, "*"))),
|
|
296
|
+
React.createElement("div", { className: classNames({
|
|
297
|
+
'form-location-con': true,
|
|
298
|
+
[styles.locationContent]: true,
|
|
299
|
+
'form-location-con_vertical': layout === 'vertical',
|
|
300
|
+
}) },
|
|
301
|
+
React.createElement("img", { src: "https://qcloudimg.tencent-cloud.cn/raw/6542e1ce1dd36a90085b2eb979801df9.png", alt: "" }),
|
|
302
|
+
React.createElement("span", { className: classNames({ 'form-location-con_disabled': disabled }), onClick: handleChooseLocation }, "\u9009\u62E9\u5730\u7406\u4F4D\u7F6E"))),
|
|
303
|
+
getIsShowAddr() && (React.createElement("div", { className: classNames({
|
|
304
|
+
'form-location-addr': true,
|
|
305
|
+
'form-location-addr-vertical': layout === 'vertical',
|
|
306
|
+
}) },
|
|
307
|
+
React.createElement("img", { src: "https://qcloudimg.tencent-cloud.cn/raw/f9729e0b091f394110a6e12d3f4e7290.png", alt: "" }),
|
|
308
|
+
React.createElement("div", null,
|
|
309
|
+
location.poiname && (React.createElement("div", { className: "form-location-addr-title" }, location.poiname)),
|
|
310
|
+
showLngLat && (React.createElement("div", { className: "form-location-addr-lat" }, location.latlng
|
|
311
|
+
? `${location.latlng.lat}N,${location.latlng.lng}E`
|
|
312
|
+
: ''))))),
|
|
313
|
+
getIsShowMap() && (React.createElement("div", { className: "form-map-container", style: { height: '200px' } },
|
|
314
|
+
React.createElement(MapView, { APIKEY: APIKEY, drag: drag, zoom: zoom, latlng: location.latlng }))),
|
|
315
|
+
React.createElement(SelectModal, { isSelectMapVisible: isSelectMapVisible, setIsSelectMapVisible: setIsSelectMapVisible, location: location, currentLocations: currentLocations.current, setLocation: setLocation, chooseLocation: onChangeLocation, APIKEY: APIKEY, locationRange: locationRange, customRange: customRange })));
|
|
316
|
+
return renderDecorator(LocationEl, decorator)({
|
|
317
|
+
id,
|
|
318
|
+
className: cls,
|
|
319
|
+
style,
|
|
320
|
+
multiCell: false,
|
|
321
|
+
requiredFlag,
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
LocationH5.propTypes = propTypes;
|
|
325
|
+
LocationH5.defaultProps = defaultProps;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default Header;
|
|
2
|
+
declare function Header({ onClick, isEdit, info, disabled, showLngLat, locationType, dataSourceStatus, apiKeyStatus, currentLocStatus, }: {
|
|
3
|
+
onClick: any;
|
|
4
|
+
isEdit: any;
|
|
5
|
+
info: any;
|
|
6
|
+
disabled: any;
|
|
7
|
+
showLngLat: any;
|
|
8
|
+
locationType: any;
|
|
9
|
+
dataSourceStatus: any;
|
|
10
|
+
apiKeyStatus: any;
|
|
11
|
+
currentLocStatus: any;
|
|
12
|
+
}): JSX.Element;
|