@cloudbase/weda-ui 3.2.0 → 3.3.0
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 +962 -0
- package/dist/src/configs/components/chart/line.json +878 -0
- package/dist/src/configs/components/chart/pie.json +685 -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 +66 -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 +191 -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 +45 -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 +10 -0
- package/dist/src/web/components/chart/common/Chart.js +31 -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 +248 -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 +72 -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/error-boundary.d.ts +5 -0
- package/dist/src/web/components/common/error-boundary.js +33 -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/common/use-loop-render-detect.d.ts +11 -0
- package/dist/src/web/components/common/use-loop-render-detect.js +124 -0
- package/dist/src/web/components/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 +150 -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 +94 -0
- package/dist/src/web/components/form/location/common/mapChoose.d.ts +15 -0
- package/dist/src/web/components/form/location/common/mapChoose.js +496 -0
- package/dist/src/web/components/form/location/common/mapView.d.ts +19 -0
- package/dist/src/web/components/form/location/common/mapView.js +175 -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/tmap.d.ts +3 -0
- package/dist/src/web/components/form/location/common/tmap.js +21 -0
- package/dist/src/web/components/form/location/common/useLocationInfo.d.ts +36 -0
- package/dist/src/web/components/form/location/common/useLocationInfo.js +105 -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 +328 -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 +228 -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 +24 -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 +944 -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 +466 -0
- package/dist/src/web/components/form/select/index.d.ts +66 -0
- package/dist/src/web/components/form/select/index.js +255 -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 +330 -0
- package/dist/src/web/components/form/uploaderFile/uploadFile.pc.d.ts +24 -0
- package/dist/src/web/components/form/uploaderFile/uploadFile.pc.js +302 -0
- package/dist/src/web/components/form/userOrgSelect/comTool.d.ts +8 -0
- package/dist/src/web/components/form/userOrgSelect/comTool.js +101 -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 +252 -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 +157 -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/getUserService.d.ts +11 -0
- package/dist/src/web/components/form/userOrgSelect/getUserService.js +159 -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 +27 -0
- package/dist/src/web/components/form/userOrgSelect/userTreeSelect.h5.js +276 -0
- package/dist/src/web/components/form/userOrgSelect/userTreeSelect.pc.d.ts +9 -0
- package/dist/src/web/components/form/userOrgSelect/userTreeSelect.pc.js +253 -0
- package/dist/src/web/components/form/userOrgSelect/utils.d.ts +36 -0
- package/dist/src/web/components/form/userOrgSelect/utils.js +80 -0
- package/dist/src/web/components/formdetail/index.d.ts +28 -0
- package/dist/src/web/components/formdetail/index.js +173 -0
- package/dist/src/web/components/graphicCard/index.d.ts +46 -0
- package/dist/src/web/components/graphicCard/index.js +178 -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 +297 -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 +385 -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 +351 -0
- package/dist/src/web/components/richTextView/index.d.ts +7 -0
- package/dist/src/web/components/richTextView/index.js +46 -0
- package/dist/src/web/components/scrollView/index.d.ts +26 -0
- package/dist/src/web/components/scrollView/index.js +97 -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 +20 -0
- package/dist/src/web/components/tabs/tabs.h5.d.ts +4 -0
- package/dist/src/web/components/tabs/tabs.h5.js +44 -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 +19 -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 +156 -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/console.d.ts +3 -0
- package/dist/src/web/utils/console.js +26 -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 +16 -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/input/index.css +16 -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 +809 -0
- package/package.json +34 -21
|
@@ -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,3 @@
|
|
|
1
|
+
export function getTMap(): any;
|
|
2
|
+
export function calculateDistance(latlng1: any, latlng2: any): number;
|
|
3
|
+
export const base64LocationIcon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODQiIGhlaWdodD0iODgiIHZpZXdCb3g9IjAgMCA4NCA4OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgb3BhY2l0eT0iMC45OCIgZmlsdGVyPSJ1cmwoI2ZpbHRlcjBfZGRkXzI0NDdfNTc0OSkiPgo8Y2lyY2xlIGN4PSI0MiIgY3k9IjM2IiByPSIxMiIgZmlsbD0id2hpdGUiLz4KPC9nPgo8Y2lyY2xlIGN4PSI0MiIgY3k9IjM2IiByPSI3IiBmaWxsPSIjMDA1MkQ5Ii8+CjxkZWZzPgo8ZmlsdGVyIGlkPSJmaWx0ZXIwX2RkZF8yNDQ3XzU3NDkiIHg9IjAiIHk9IjAiIHdpZHRoPSI4NCIgaGVpZ2h0PSI4OCIgZmlsdGVyVW5pdHM9InVzZXJTcGFjZU9uVXNlIiBjb2xvci1pbnRlcnBvbGF0aW9uLWZpbHRlcnM9InNSR0IiPgo8ZmVGbG9vZCBmbG9vZC1vcGFjaXR5PSIwIiByZXN1bHQ9IkJhY2tncm91bmRJbWFnZUZpeCIvPgo8ZmVDb2xvck1hdHJpeCBpbj0iU291cmNlQWxwaGEiIHR5cGU9Im1hdHJpeCIgdmFsdWVzPSIwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAxMjcgMCIgcmVzdWx0PSJoYXJkQWxwaGEiLz4KPGZlT2Zmc2V0IGR5PSI4Ii8+CjxmZUdhdXNzaWFuQmx1ciBzdGREZXZpYXRpb249IjUiLz4KPGZlQ29sb3JNYXRyaXggdHlwZT0ibWF0cml4IiB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAuMDggMCIvPgo8ZmVCbGVuZCBtb2RlPSJub3JtYWwiIGluMj0iQmFja2dyb3VuZEltYWdlRml4IiByZXN1bHQ9ImVmZmVjdDFfZHJvcFNoYWRvd18yNDQ3XzU3NDkiLz4KPGZlQ29sb3JNYXRyaXggaW49IlNvdXJjZUFscGhhIiB0eXBlPSJtYXRyaXgiIHZhbHVlcz0iMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMTI3IDAiIHJlc3VsdD0iaGFyZEFscGhhIi8+CjxmZU9mZnNldCBkeT0iMTYiLz4KPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMTIiLz4KPGZlQ29sb3JNYXRyaXggdHlwZT0ibWF0cml4IiB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAuMDQgMCIvPgo8ZmVCbGVuZCBtb2RlPSJub3JtYWwiIGluMj0iZWZmZWN0MV9kcm9wU2hhZG93XzI0NDdfNTc0OSIgcmVzdWx0PSJlZmZlY3QyX2Ryb3BTaGFkb3dfMjQ0N181NzQ5Ii8+CjxmZUNvbG9yTWF0cml4IGluPSJTb3VyY2VBbHBoYSIgdHlwZT0ibWF0cml4IiB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDEyNyAwIiByZXN1bHQ9ImhhcmRBbHBoYSIvPgo8ZmVPZmZzZXQgZHk9IjYiLz4KPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMTUiLz4KPGZlQ29sb3JNYXRyaXggdHlwZT0ibWF0cml4IiB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAuMDUgMCIvPgo8ZmVCbGVuZCBtb2RlPSJub3JtYWwiIGluMj0iZWZmZWN0Ml9kcm9wU2hhZG93XzI0NDdfNTc0OSIgcmVzdWx0PSJlZmZlY3QzX2Ryb3BTaGFkb3dfMjQ0N181NzQ5Ii8+CjxmZUJsZW5kIG1vZGU9Im5vcm1hbCIgaW49IlNvdXJjZUdyYXBoaWMiIGluMj0iZWZmZWN0M19kcm9wU2hhZG93XzI0NDdfNTc0OSIgcmVzdWx0PSJzaGFwZSIvPgo8L2ZpbHRlcj4KPC9kZWZzPgo8L3N2Zz4K";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function getTMap() {
|
|
2
|
+
const TMap = window === null || window === void 0 ? void 0 : window.TMap;
|
|
3
|
+
return TMap;
|
|
4
|
+
}
|
|
5
|
+
export function calculateDistance(latlng1, latlng2) {
|
|
6
|
+
let lat1 = latlng1.latitude;
|
|
7
|
+
let lng1 = latlng1.longitude;
|
|
8
|
+
let lat2 = latlng2.latitude;
|
|
9
|
+
let lng2 = latlng2.longitude;
|
|
10
|
+
var radLat1 = (lat1 * Math.PI) / 180.0;
|
|
11
|
+
var radLat2 = (lat2 * Math.PI) / 180.0;
|
|
12
|
+
var a = radLat1 - radLat2;
|
|
13
|
+
var b = (lng1 * Math.PI) / 180.0 - (lng2 * Math.PI) / 180.0;
|
|
14
|
+
var s = 2 *
|
|
15
|
+
Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +
|
|
16
|
+
Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
|
|
17
|
+
s = s * 6378.137; // EARTH_RADIUS;
|
|
18
|
+
s = Math.round(s * 10000) / 10000;
|
|
19
|
+
return s * 1000;
|
|
20
|
+
}
|
|
21
|
+
export const base64LocationIcon = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODQiIGhlaWdodD0iODgiIHZpZXdCb3g9IjAgMCA4NCA4OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgb3BhY2l0eT0iMC45OCIgZmlsdGVyPSJ1cmwoI2ZpbHRlcjBfZGRkXzI0NDdfNTc0OSkiPgo8Y2lyY2xlIGN4PSI0MiIgY3k9IjM2IiByPSIxMiIgZmlsbD0id2hpdGUiLz4KPC9nPgo8Y2lyY2xlIGN4PSI0MiIgY3k9IjM2IiByPSI3IiBmaWxsPSIjMDA1MkQ5Ii8+CjxkZWZzPgo8ZmlsdGVyIGlkPSJmaWx0ZXIwX2RkZF8yNDQ3XzU3NDkiIHg9IjAiIHk9IjAiIHdpZHRoPSI4NCIgaGVpZ2h0PSI4OCIgZmlsdGVyVW5pdHM9InVzZXJTcGFjZU9uVXNlIiBjb2xvci1pbnRlcnBvbGF0aW9uLWZpbHRlcnM9InNSR0IiPgo8ZmVGbG9vZCBmbG9vZC1vcGFjaXR5PSIwIiByZXN1bHQ9IkJhY2tncm91bmRJbWFnZUZpeCIvPgo8ZmVDb2xvck1hdHJpeCBpbj0iU291cmNlQWxwaGEiIHR5cGU9Im1hdHJpeCIgdmFsdWVzPSIwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAxMjcgMCIgcmVzdWx0PSJoYXJkQWxwaGEiLz4KPGZlT2Zmc2V0IGR5PSI4Ii8+CjxmZUdhdXNzaWFuQmx1ciBzdGREZXZpYXRpb249IjUiLz4KPGZlQ29sb3JNYXRyaXggdHlwZT0ibWF0cml4IiB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAuMDggMCIvPgo8ZmVCbGVuZCBtb2RlPSJub3JtYWwiIGluMj0iQmFja2dyb3VuZEltYWdlRml4IiByZXN1bHQ9ImVmZmVjdDFfZHJvcFNoYWRvd18yNDQ3XzU3NDkiLz4KPGZlQ29sb3JNYXRyaXggaW49IlNvdXJjZUFscGhhIiB0eXBlPSJtYXRyaXgiIHZhbHVlcz0iMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMTI3IDAiIHJlc3VsdD0iaGFyZEFscGhhIi8+CjxmZU9mZnNldCBkeT0iMTYiLz4KPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMTIiLz4KPGZlQ29sb3JNYXRyaXggdHlwZT0ibWF0cml4IiB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAuMDQgMCIvPgo8ZmVCbGVuZCBtb2RlPSJub3JtYWwiIGluMj0iZWZmZWN0MV9kcm9wU2hhZG93XzI0NDdfNTc0OSIgcmVzdWx0PSJlZmZlY3QyX2Ryb3BTaGFkb3dfMjQ0N181NzQ5Ii8+CjxmZUNvbG9yTWF0cml4IGluPSJTb3VyY2VBbHBoYSIgdHlwZT0ibWF0cml4IiB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDEyNyAwIiByZXN1bHQ9ImhhcmRBbHBoYSIvPgo8ZmVPZmZzZXQgZHk9IjYiLz4KPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMTUiLz4KPGZlQ29sb3JNYXRyaXggdHlwZT0ibWF0cml4IiB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAuMDUgMCIvPgo8ZmVCbGVuZCBtb2RlPSJub3JtYWwiIGluMj0iZWZmZWN0Ml9kcm9wU2hhZG93XzI0NDdfNTc0OSIgcmVzdWx0PSJlZmZlY3QzX2Ryb3BTaGFkb3dfMjQ0N181NzQ5Ii8+CjxmZUJsZW5kIG1vZGU9Im5vcm1hbCIgaW49IlNvdXJjZUdyYXBoaWMiIGluMj0iZWZmZWN0M19kcm9wU2hhZG93XzI0NDdfNTc0OSIgcmVzdWx0PSJzaGFwZSIvPgo8L2ZpbHRlcj4KPC9kZWZzPgo8L3N2Zz4K';
|
|
@@ -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,105 @@
|
|
|
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.error('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.error('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
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
94
|
+
}, [APIKEY, locationType]);
|
|
95
|
+
return {
|
|
96
|
+
location,
|
|
97
|
+
setLocation,
|
|
98
|
+
apiKeyStatus,
|
|
99
|
+
setApiKeyStatus,
|
|
100
|
+
currentLocStatus,
|
|
101
|
+
currentLocations,
|
|
102
|
+
customLocation,
|
|
103
|
+
checkCustomLocation,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
@@ -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";
|