@cloudbase/weda-ui 3.3.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/web/components/form/form/index.js +42 -38
- package/dist/src/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.js +12 -4
- package/dist/src/web/components/form/userOrgSelect/userTreeSelect.h5.js +6 -2
- package/dist/src/web/components/navigationBar/index.js +9 -4
- package/package.json +3 -3
- package/dist/configs/actions/showModal.json +0 -48
- package/dist/configs/actions/showToast.json +0 -41
- package/dist/configs/components/auth.json +0 -16
- package/dist/configs/components/button.json +0 -239
- package/dist/configs/components/calendar.json +0 -81
- package/dist/configs/components/carousel.json +0 -292
- package/dist/configs/components/chart/bar.json +0 -728
- package/dist/configs/components/chart/line.json +0 -681
- package/dist/configs/components/chart/pie.json +0 -500
- package/dist/configs/components/chart/statisticsCard.json +0 -376
- package/dist/configs/components/container.json +0 -50
- package/dist/configs/components/dataView.json +0 -239
- package/dist/configs/components/drawer.json +0 -115
- package/dist/configs/components/form/checkbox.json +0 -179
- package/dist/configs/components/form/departTreeSelect.json +0 -124
- package/dist/configs/components/form/form.json +0 -69
- package/dist/configs/components/form/input.json +0 -154
- package/dist/configs/components/form/location.json +0 -216
- package/dist/configs/components/form/radio.json +0 -203
- package/dist/configs/components/form/richText.json +0 -133
- package/dist/configs/components/form/select.json +0 -431
- package/dist/configs/components/form/switch.json +0 -58
- package/dist/configs/components/form/textarea.json +0 -116
- package/dist/configs/components/form/tips.json +0 -34
- package/dist/configs/components/form/uploader.json +0 -171
- package/dist/configs/components/form/uploaderFile.json +0 -158
- package/dist/configs/components/form/userTreeSelect.json +0 -128
- package/dist/configs/components/formdetail.json +0 -105
- package/dist/configs/components/graphicCard.json +0 -413
- package/dist/configs/components/image.json +0 -187
- package/dist/configs/components/link.json +0 -79
- package/dist/configs/components/listView.json +0 -378
- package/dist/configs/components/lottery.json +0 -163
- package/dist/configs/components/modal.json +0 -72
- package/dist/configs/components/navLayout.json +0 -368
- package/dist/configs/components/navigationBar.json +0 -62
- package/dist/configs/components/richtextview.json +0 -26
- package/dist/configs/components/scrollVeiw.json +0 -253
- package/dist/configs/components/slot.json +0 -17
- package/dist/configs/components/swiper.json +0 -90
- package/dist/configs/components/tabs.json +0 -122
- package/dist/configs/components/text.json +0 -95
- package/dist/configs/components/wedaVideo.json +0 -89
- package/dist/configs/components/wxOpenApi/phone.json +0 -127
- package/dist/configs/components/wxOpenApi/phoneCode.json +0 -109
- package/dist/configs/components/wxOpenApi/share.json +0 -160
- package/dist/configs/components/wxOpenApi/userInfo.json +0 -156
- package/dist/configs/index.d.ts +0 -103
- package/dist/configs/index.js +0 -111
- package/dist/docs/common/format.d.ts +0 -13
- package/dist/docs/common/format.js +0 -122
- package/dist/docs/common/tableView.d.ts +0 -30
- package/dist/docs/common/tableView.js +0 -159
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -3
- package/dist/setupTests.d.ts +0 -1
- package/dist/setupTests.js +0 -14
- package/dist/src/web/components/chart/common/error-boundary.d.ts +0 -5
- package/dist/src/web/components/chart/common/error-boundary.js +0 -26
- package/dist/src/web/utils/getUserService.d.ts +0 -11
- package/dist/src/web/utils/getUserService.js +0 -156
- package/dist/src/web/utils/tmap.d.ts +0 -3
- package/dist/src/web/utils/tmap.js +0 -21
- package/dist/web/actions/index.d.ts +0 -2
- package/dist/web/actions/index.js +0 -2
- package/dist/web/actions/showModal/index.d.ts +0 -4
- package/dist/web/actions/showModal/index.js +0 -67
- package/dist/web/actions/showToast/index.d.ts +0 -1
- package/dist/web/actions/showToast/index.js +0 -3
- package/dist/web/components/button/index.d.ts +0 -32
- package/dist/web/components/button/index.js +0 -48
- package/dist/web/components/calendar/index.d.ts +0 -19
- package/dist/web/components/calendar/index.js +0 -189
- package/dist/web/components/calendar/util.d.ts +0 -13
- package/dist/web/components/calendar/util.js +0 -74
- package/dist/web/components/carousel/index.d.ts +0 -41
- package/dist/web/components/carousel/index.js +0 -244
- package/dist/web/components/chart/bar/index.d.ts +0 -41
- package/dist/web/components/chart/bar/index.js +0 -56
- package/dist/web/components/chart/common/config/bar.d.ts +0 -48
- package/dist/web/components/chart/common/config/bar.js +0 -49
- package/dist/web/components/chart/common/config/global.d.ts +0 -13
- package/dist/web/components/chart/common/config/global.js +0 -16
- package/dist/web/components/chart/common/config/line.d.ts +0 -46
- package/dist/web/components/chart/common/config/line.js +0 -49
- package/dist/web/components/chart/common/config/pie.d.ts +0 -29
- package/dist/web/components/chart/common/config/pie.js +0 -36
- package/dist/web/components/chart/common/core/eChartBar.d.ts +0 -68
- package/dist/web/components/chart/common/core/eChartBar.js +0 -198
- package/dist/web/components/chart/common/core/eChartBase.d.ts +0 -128
- package/dist/web/components/chart/common/core/eChartBase.js +0 -352
- package/dist/web/components/chart/common/core/eChartLine.d.ts +0 -62
- package/dist/web/components/chart/common/core/eChartLine.js +0 -170
- package/dist/web/components/chart/common/core/eChartPie.d.ts +0 -50
- package/dist/web/components/chart/common/core/eChartPie.js +0 -132
- package/dist/web/components/chart/common/core/type.d.ts +0 -35
- package/dist/web/components/chart/common/core/type.js +0 -9
- package/dist/web/components/chart/common/echarts.d.ts +0 -2
- package/dist/web/components/chart/common/echarts.js +0 -24
- package/dist/web/components/chart/common/useChart.d.ts +0 -8
- package/dist/web/components/chart/common/useChart.js +0 -60
- package/dist/web/components/chart/line/index.d.ts +0 -39
- package/dist/web/components/chart/line/index.js +0 -53
- package/dist/web/components/chart/pie/index.d.ts +0 -27
- package/dist/web/components/chart/pie/index.js +0 -40
- package/dist/web/components/chart/statisticsCard/index.d.ts +0 -85
- package/dist/web/components/chart/statisticsCard/index.js +0 -203
- package/dist/web/components/chart/statisticsCard/interface.d.ts +0 -13
- package/dist/web/components/chart/statisticsCard/interface.js +0 -1
- package/dist/web/components/container/index.d.ts +0 -6
- package/dist/web/components/container/index.js +0 -6
- package/dist/web/components/dataView/index.d.ts +0 -6
- package/dist/web/components/dataView/index.js +0 -8
- package/dist/web/components/dataView/interface.d.ts +0 -5
- package/dist/web/components/dataView/interface.js +0 -1
- package/dist/web/components/drawer/index.d.ts +0 -13
- package/dist/web/components/drawer/index.js +0 -12
- package/dist/web/components/form/checkbox/index.d.ts +0 -13
- package/dist/web/components/form/checkbox/index.js +0 -167
- package/dist/web/components/form/enumSelect/MultipleSelect.d.ts +0 -78
- package/dist/web/components/form/enumSelect/MultipleSelect.js +0 -52
- package/dist/web/components/form/enumSelect/NormalSelect.d.ts +0 -83
- package/dist/web/components/form/enumSelect/NormalSelect.js +0 -52
- package/dist/web/components/form/enumSelect/SelectContainer.d.ts +0 -16
- package/dist/web/components/form/enumSelect/SelectContainer.js +0 -30
- package/dist/web/components/form/enumSelect/index.d.ts +0 -82
- package/dist/web/components/form/enumSelect/index.js +0 -6
- package/dist/web/components/form/enumSelect/props/defaultProps.d.ts +0 -34
- package/dist/web/components/form/enumSelect/props/defaultProps.js +0 -40
- package/dist/web/components/form/enumSelect/props/propsTypes.d.ts +0 -39
- package/dist/web/components/form/enumSelect/props/propsTypes.js +0 -47
- package/dist/web/components/form/form/index.d.ts +0 -32
- package/dist/web/components/form/form/index.js +0 -108
- package/dist/web/components/form/formcell/index.d.ts +0 -8
- package/dist/web/components/form/formcell/index.js +0 -40
- package/dist/web/components/form/input/index.d.ts +0 -14
- package/dist/web/components/form/input/index.js +0 -86
- package/dist/web/components/form/location/common/mapChoose.d.ts +0 -15
- package/dist/web/components/form/location/common/mapChoose.js +0 -495
- package/dist/web/components/form/location/common/mapView.d.ts +0 -19
- package/dist/web/components/form/location/common/mapView.js +0 -172
- package/dist/web/components/form/location/common/propsConfig.d.ts +0 -59
- package/dist/web/components/form/location/common/propsConfig.js +0 -50
- package/dist/web/components/form/location/common/selectModal.d.ts +0 -21
- package/dist/web/components/form/location/common/selectModal.js +0 -44
- package/dist/web/components/form/location/common/useLocationInfo.d.ts +0 -36
- package/dist/web/components/form/location/common/useLocationInfo.js +0 -104
- package/dist/web/components/form/location/components/LocationH5/location.h5.d.ts +0 -8
- package/dist/web/components/form/location/components/LocationH5/location.h5.js +0 -325
- package/dist/web/components/form/location/components/LocationPC/Header.d.ts +0 -12
- package/dist/web/components/form/location/components/LocationPC/Header.js +0 -43
- package/dist/web/components/form/location/components/LocationPC/location.PC.d.ts +0 -8
- package/dist/web/components/form/location/components/LocationPC/location.PC.js +0 -224
- package/dist/web/components/form/location/constants.d.ts +0 -2
- package/dist/web/components/form/location/constants.js +0 -3
- package/dist/web/components/form/location/index.d.ts +0 -1
- package/dist/web/components/form/location/index.js +0 -17
- package/dist/web/components/form/radio/index.d.ts +0 -11
- package/dist/web/components/form/radio/index.js +0 -115
- package/dist/web/components/form/renderDecorator.d.ts +0 -6
- package/dist/web/components/form/renderDecorator.js +0 -20
- package/dist/web/components/form/select/dropdown-select/ui.d.ts +0 -15
- package/dist/web/components/form/select/dropdown-select/ui.js +0 -55
- package/dist/web/components/form/select/h5.d.ts +0 -16
- package/dist/web/components/form/select/h5.js +0 -410
- package/dist/web/components/form/select/index.d.ts +0 -65
- package/dist/web/components/form/select/index.js +0 -232
- package/dist/web/components/form/select/region/index.d.ts +0 -6
- package/dist/web/components/form/select/region/index.js +0 -147
- package/dist/web/components/form/select/time.d.ts +0 -9
- package/dist/web/components/form/select/time.js +0 -146
- package/dist/web/components/form/select/use-options.d.ts +0 -26
- package/dist/web/components/form/select/use-options.js +0 -103
- package/dist/web/components/form/select/year.d.ts +0 -7
- package/dist/web/components/form/select/year.js +0 -72
- package/dist/web/components/form/switch/index.d.ts +0 -6
- package/dist/web/components/form/switch/index.js +0 -58
- package/dist/web/components/form/textarea/index.d.ts +0 -12
- package/dist/web/components/form/textarea/index.js +0 -66
- package/dist/web/components/form/tips/index.d.ts +0 -8
- package/dist/web/components/form/tips/index.js +0 -17
- package/dist/web/components/form/uploader/index.d.ts +0 -3
- package/dist/web/components/form/uploader/index.js +0 -42
- package/dist/web/components/form/uploader/uploader.h5.d.ts +0 -20
- package/dist/web/components/form/uploader/uploader.h5.js +0 -224
- package/dist/web/components/form/uploader/uploader.pc.d.ts +0 -29
- package/dist/web/components/form/uploader/uploader.pc.js +0 -214
- package/dist/web/components/form/uploaderFile/index.d.ts +0 -4
- package/dist/web/components/form/uploaderFile/index.js +0 -19
- package/dist/web/components/form/uploaderFile/uploadFile.h5.d.ts +0 -23
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +0 -337
- package/dist/web/components/form/uploaderFile/uploadFile.pc.d.ts +0 -24
- package/dist/web/components/form/uploaderFile/uploadFile.pc.js +0 -313
- package/dist/web/components/form/userOrgSelect/comTool.d.ts +0 -7
- package/dist/web/components/form/userOrgSelect/comTool.js +0 -89
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.d.ts +0 -20
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.js +0 -259
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.pc.d.ts +0 -4
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.pc.js +0 -153
- package/dist/web/components/form/userOrgSelect/departTreeSelect/index.d.ts +0 -2
- package/dist/web/components/form/userOrgSelect/departTreeSelect/index.js +0 -17
- package/dist/web/components/form/userOrgSelect/index.d.ts +0 -2
- package/dist/web/components/form/userOrgSelect/index.js +0 -17
- package/dist/web/components/form/userOrgSelect/userOrgSelect.less +0 -643
- package/dist/web/components/form/userOrgSelect/userTreeSelect.h5.d.ts +0 -24
- package/dist/web/components/form/userOrgSelect/userTreeSelect.h5.js +0 -276
- package/dist/web/components/form/userOrgSelect/userTreeSelect.pc.d.ts +0 -9
- package/dist/web/components/form/userOrgSelect/userTreeSelect.pc.js +0 -229
- package/dist/web/components/form/userOrgSelect/utils.d.ts +0 -35
- package/dist/web/components/form/userOrgSelect/utils.js +0 -72
- package/dist/web/components/formdetail/index.d.ts +0 -28
- package/dist/web/components/formdetail/index.js +0 -170
- package/dist/web/components/graphicCard/index.d.ts +0 -31
- package/dist/web/components/graphicCard/index.js +0 -166
- package/dist/web/components/image/image.d.ts +0 -9
- package/dist/web/components/image/image.js +0 -119
- package/dist/web/components/image/index.d.ts +0 -13
- package/dist/web/components/image/index.js +0 -91
- package/dist/web/components/index.d.ts +0 -50
- package/dist/web/components/index.js +0 -97
- package/dist/web/components/link/index.d.ts +0 -24
- package/dist/web/components/link/index.js +0 -71
- package/dist/web/components/listView/index.d.ts +0 -7
- package/dist/web/components/listView/index.js +0 -286
- package/dist/web/components/listView/interface.d.ts +0 -127
- package/dist/web/components/listView/interface.js +0 -1
- package/dist/web/components/lottery/index.d.ts +0 -22
- package/dist/web/components/lottery/index.js +0 -391
- package/dist/web/components/lottery/lotteryUtil.d.ts +0 -23
- package/dist/web/components/lottery/lotteryUtil.js +0 -181
- package/dist/web/components/modal/index.d.ts +0 -17
- package/dist/web/components/modal/index.js +0 -11
- package/dist/web/components/modal/modal.h5.d.ts +0 -4
- package/dist/web/components/modal/modal.h5.js +0 -46
- package/dist/web/components/modal/modal.pc.d.ts +0 -3
- package/dist/web/components/modal/modal.pc.js +0 -31
- package/dist/web/components/navLayout/index.d.ts +0 -46
- package/dist/web/components/navLayout/index.js +0 -116
- package/dist/web/components/navigationBar/common.d.ts +0 -15
- package/dist/web/components/navigationBar/common.js +0 -127
- package/dist/web/components/navigationBar/h5Menu.d.ts +0 -14
- package/dist/web/components/navigationBar/h5Menu.js +0 -72
- package/dist/web/components/navigationBar/horizontalMenu.d.ts +0 -12
- package/dist/web/components/navigationBar/horizontalMenu.js +0 -99
- package/dist/web/components/navigationBar/index.d.ts +0 -13
- package/dist/web/components/navigationBar/index.js +0 -157
- package/dist/web/components/navigationBar/verticalMenu.d.ts +0 -13
- package/dist/web/components/navigationBar/verticalMenu.js +0 -38
- package/dist/web/components/phone/index.d.ts +0 -18
- package/dist/web/components/phone/index.js +0 -4
- package/dist/web/components/phoneCode/index.d.ts +0 -18
- package/dist/web/components/phoneCode/index.js +0 -4
- package/dist/web/components/picker/datePicker.d.ts +0 -10
- package/dist/web/components/picker/datePicker.js +0 -31
- package/dist/web/components/picker/picker.d.ts +0 -6
- package/dist/web/components/picker/picker.js +0 -45
- package/dist/web/components/picker/timePicker.d.ts +0 -7
- package/dist/web/components/picker/timePicker.js +0 -42
- package/dist/web/components/richText/const.d.ts +0 -1
- package/dist/web/components/richText/const.js +0 -2
- package/dist/web/components/richText/index.d.ts +0 -50
- package/dist/web/components/richText/index.js +0 -352
- package/dist/web/components/richTextView/index.d.ts +0 -7
- package/dist/web/components/richTextView/index.js +0 -44
- package/dist/web/components/scrollView/index.d.ts +0 -27
- package/dist/web/components/scrollView/index.js +0 -95
- package/dist/web/components/share/index.d.ts +0 -34
- package/dist/web/components/share/index.js +0 -4
- package/dist/web/components/slot/index.d.ts +0 -6
- package/dist/web/components/slot/index.js +0 -9
- package/dist/web/components/swiper/index.d.ts +0 -24
- package/dist/web/components/swiper/index.js +0 -153
- package/dist/web/components/tabs/index.d.ts +0 -13
- package/dist/web/components/tabs/index.js +0 -15
- package/dist/web/components/tabs/tabs.h5.d.ts +0 -4
- package/dist/web/components/tabs/tabs.h5.js +0 -42
- package/dist/web/components/tabs/tabs.pc.d.ts +0 -3
- package/dist/web/components/tabs/tabs.pc.js +0 -40
- package/dist/web/components/text/index.d.ts +0 -14
- package/dist/web/components/text/index.js +0 -17
- package/dist/web/components/uploaderFileView/index.d.ts +0 -10
- package/dist/web/components/uploaderFileView/index.js +0 -61
- package/dist/web/components/uploaderView/index.d.ts +0 -17
- package/dist/web/components/uploaderView/index.js +0 -48
- package/dist/web/components/userInfo/index.d.ts +0 -26
- package/dist/web/components/userInfo/index.js +0 -4
- package/dist/web/components/wedaVideo/index.d.ts +0 -17
- package/dist/web/components/wedaVideo/index.js +0 -160
- package/dist/web/index.d.ts +0 -8
- package/dist/web/index.js +0 -4
- package/dist/web/utils/classnames.d.ts +0 -2
- package/dist/web/utils/classnames.js +0 -37
- package/dist/web/utils/constant.d.ts +0 -23
- package/dist/web/utils/constant.js +0 -24
- package/dist/web/utils/debounce.d.ts +0 -2
- package/dist/web/utils/debounce.js +0 -92
- package/dist/web/utils/getLocalCounter.d.ts +0 -1
- package/dist/web/utils/getLocalCounter.js +0 -4
- package/dist/web/utils/getUserService.d.ts +0 -17
- package/dist/web/utils/getUserService.js +0 -148
- package/dist/web/utils/isObjectEqual.d.ts +0 -2
- package/dist/web/utils/isObjectEqual.js +0 -12
- package/dist/web/utils/loading-fallback.d.ts +0 -2
- package/dist/web/utils/loading-fallback.js +0 -2
- package/dist/web/utils/lodash.d.ts +0 -1
- package/dist/web/utils/lodash.js +0 -2
- package/dist/web/utils/platform.d.ts +0 -18
- package/dist/web/utils/platform.js +0 -193
- package/dist/web/utils/tcb.d.ts +0 -27
- package/dist/web/utils/tcb.js +0 -105
- package/dist/web/utils/tmap.d.ts +0 -3
- package/dist/web/utils/tmap.js +0 -21
- package/dist/web/utils/use-cloud-id-temp-url.d.ts +0 -1
- package/dist/web/utils/use-cloud-id-temp-url.js +0 -13
- package/dist/web/utils/useSetState.d.ts +0 -1
- package/dist/web/utils/useSetState.js +0 -8
- package/dist/web/utils/useSyncValue.d.ts +0 -4
- package/dist/web/utils/useSyncValue.js +0 -15
- package/dist/web/utils/weui.d.ts +0 -1
- package/dist/web/utils/weui.js +0 -2
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import classNames from '../../../utils/classnames';
|
|
3
|
-
import { usePlatform } from '../../../utils/platform';
|
|
4
|
-
import { Input as TeaInput, ConfigProvider } from 'tea-component';
|
|
5
|
-
import { renderDecorator } from '../renderDecorator';
|
|
6
|
-
import { useSyncValue } from '../../../utils/useSyncValue';
|
|
7
|
-
import './index.css';
|
|
8
|
-
import { emptyObject } from '../../../utils/constant';
|
|
9
|
-
export default function Input({ id, className, style, events = emptyObject,
|
|
10
|
-
// 组件属性
|
|
11
|
-
label = '标题', labelVisible = true, name = 'formInput', defaultValue = '', password = false, placeholder = '请输入', type = 'text', maxLength = 140, disabled = false, focus: autoFocus = false, layout = 'horizontal', requiredFlag = false, size = 'l', clearable = true, decorator, }) {
|
|
12
|
-
const platform = usePlatform();
|
|
13
|
-
const cls = classNames({
|
|
14
|
-
'weda-ui': true,
|
|
15
|
-
'weda-input': true,
|
|
16
|
-
[className]: className,
|
|
17
|
-
});
|
|
18
|
-
const subCls = classNames({
|
|
19
|
-
'weui-cell': true,
|
|
20
|
-
'weui-cell_active': true,
|
|
21
|
-
'weui-cell_form': true,
|
|
22
|
-
'weui-cell_disabled': disabled,
|
|
23
|
-
});
|
|
24
|
-
const inputType = getInputType(type, password);
|
|
25
|
-
// 两次默认值不同时, 需要刷新value
|
|
26
|
-
const [value, setValue] = useSyncValue(defaultValue);
|
|
27
|
-
const onChange = function (e) {
|
|
28
|
-
const text = typeof e === 'string' ? e : e.target.value;
|
|
29
|
-
if (maxLength > 0 && text.length > maxLength) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const newValue = text;
|
|
33
|
-
setValue(newValue);
|
|
34
|
-
events.change({ value: newValue }, { originEvent: e });
|
|
35
|
-
};
|
|
36
|
-
const onClear = function (e) {
|
|
37
|
-
events.clear({ originValue: value }, { originEvent: e });
|
|
38
|
-
setValue('');
|
|
39
|
-
e.preventDefault();
|
|
40
|
-
};
|
|
41
|
-
const onKeyDown = function (e) {
|
|
42
|
-
// 确认逻辑
|
|
43
|
-
if (e.key === 'enter' || e.keyCode === 13) {
|
|
44
|
-
events.confirm({ value: e.target.value }, { originEvent: e });
|
|
45
|
-
}
|
|
46
|
-
// 数字类型的键盘, 不能输入e
|
|
47
|
-
if (inputType === 'number' && e.key === 'e') {
|
|
48
|
-
e.preventDefault();
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
const onFocus = function (e) {
|
|
52
|
-
events.focus({ value: e.target.value }, { originEvent: e });
|
|
53
|
-
};
|
|
54
|
-
const onBlur = function (e) {
|
|
55
|
-
events.blur({ value: e.target.value }, { originEvent: e });
|
|
56
|
-
};
|
|
57
|
-
const fieldEl = platform === 'h5' ? (React.createElement("div", { className: subCls },
|
|
58
|
-
React.createElement("div", { className: "weui-cell__bd weui-flex" },
|
|
59
|
-
React.createElement("input", { className: "weui-input", type: inputType, placeholder: placeholder, value: value, disabled: disabled, name: name, autoFocus: autoFocus, onChange: onChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, role: "input" }),
|
|
60
|
-
clearable && (React.createElement("button", { className: "weui-btn_reset weui-btn_icon weui-btn_input-clear", onMouseDown: onClear },
|
|
61
|
-
React.createElement("i", { className: "weui-icon-clear" })))))) : (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
|
|
62
|
-
React.createElement(TeaInput, { size: size, type: inputType, placeholder: placeholder, value: value, disabled: disabled, name: name, autoFocus: autoFocus, onChange: onChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown })));
|
|
63
|
-
return renderDecorator(fieldEl, decorator)({
|
|
64
|
-
id,
|
|
65
|
-
className: cls,
|
|
66
|
-
style,
|
|
67
|
-
label: labelVisible ? label : null,
|
|
68
|
-
layout,
|
|
69
|
-
multiCell: false,
|
|
70
|
-
requiredFlag,
|
|
71
|
-
size,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
function getInputType(type, password) {
|
|
75
|
-
if (password) {
|
|
76
|
-
return 'password';
|
|
77
|
-
}
|
|
78
|
-
switch (type) {
|
|
79
|
-
case 'idcard':
|
|
80
|
-
return 'text';
|
|
81
|
-
case 'digit':
|
|
82
|
-
return 'number';
|
|
83
|
-
default:
|
|
84
|
-
return type;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export default function MapChoose({ changeLocation, onConfirm, onClose, currentLocations, latlng, isPC, APIKEY, locationRange, customRange, setConfirmStatus, }: {
|
|
2
|
-
changeLocation: any;
|
|
3
|
-
onConfirm: any;
|
|
4
|
-
onClose: any;
|
|
5
|
-
currentLocations: any;
|
|
6
|
-
latlng?: {
|
|
7
|
-
lat: any;
|
|
8
|
-
lng: any;
|
|
9
|
-
};
|
|
10
|
-
isPC: any;
|
|
11
|
-
APIKEY?: string;
|
|
12
|
-
locationRange: any;
|
|
13
|
-
customRange: any;
|
|
14
|
-
setConfirmStatus: any;
|
|
15
|
-
}): JSX.Element;
|
|
@@ -1,495 +0,0 @@
|
|
|
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
|
-
anchor: {
|
|
107
|
-
x: 35,
|
|
108
|
-
y: 30,
|
|
109
|
-
},
|
|
110
|
-
}),
|
|
111
|
-
},
|
|
112
|
-
geometries: [
|
|
113
|
-
{
|
|
114
|
-
id: `pointer-origin-${mapDomName}`,
|
|
115
|
-
styleId: 'originPointer',
|
|
116
|
-
position: currentLocationsPosition,
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
id: `pointer-${mapDomName}`,
|
|
120
|
-
styleId: 'pointer',
|
|
121
|
-
position,
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
});
|
|
125
|
-
// 监听中心点变化事件,更新marker的位置
|
|
126
|
-
map.on('drag', mapDrag);
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
const initCircle = (TMap, map) => {
|
|
130
|
-
const currentLocationsLatlng = currentLocations.latlng;
|
|
131
|
-
const canLoad = lat && lng && currentLocationsLatlng && TMap && map;
|
|
132
|
-
if (canLoad) {
|
|
133
|
-
const nowPosition = new TMap.LatLng(currentLocationsLatlng.lat, currentLocationsLatlng.lng);
|
|
134
|
-
let circle = {
|
|
135
|
-
map,
|
|
136
|
-
styles: {
|
|
137
|
-
circleColor: new TMap.CircleStyle({
|
|
138
|
-
showBorder: true,
|
|
139
|
-
borderColor: '#fff',
|
|
140
|
-
borderWidth: 1,
|
|
141
|
-
}),
|
|
142
|
-
},
|
|
143
|
-
geometries: [
|
|
144
|
-
{
|
|
145
|
-
styleId: 'circleColor',
|
|
146
|
-
center: nowPosition,
|
|
147
|
-
radius: getRadius(),
|
|
148
|
-
},
|
|
149
|
-
],
|
|
150
|
-
};
|
|
151
|
-
new TMap.MultiCircle(circle);
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
const mapDrag = () => {
|
|
155
|
-
const TMap = getTMap();
|
|
156
|
-
const canLoad = TMap && lat && lng && mapRef.current;
|
|
157
|
-
if (canLoad) {
|
|
158
|
-
const currentLocationsLatlng = currentLocations.latlng;
|
|
159
|
-
let centerPosition = mapRef.current.getCenter();
|
|
160
|
-
centerRef.current = centerPosition;
|
|
161
|
-
markerRef.current.updateGeometries([
|
|
162
|
-
{
|
|
163
|
-
id: `pointer-${mapDomName}`,
|
|
164
|
-
styleId: 'pointer',
|
|
165
|
-
position: mapRef.current.getCenter(),
|
|
166
|
-
},
|
|
167
|
-
]);
|
|
168
|
-
exploreNear('updateCenter');
|
|
169
|
-
// 计算距离
|
|
170
|
-
compareDistance(currentLocationsLatlng, {
|
|
171
|
-
lat: centerPosition.getLat(),
|
|
172
|
-
lng: centerPosition.getLng(),
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
const compareDistance = (currentLocation, centerPosition) => {
|
|
177
|
-
if (getRadius()) {
|
|
178
|
-
let latlng1 = {
|
|
179
|
-
latitude: currentLocation.lat,
|
|
180
|
-
longitude: currentLocation.lng,
|
|
181
|
-
};
|
|
182
|
-
let latlng2 = {
|
|
183
|
-
latitude: centerPosition.lat,
|
|
184
|
-
longitude: centerPosition.lng,
|
|
185
|
-
};
|
|
186
|
-
const distance = calculateDistance(latlng1, latlng2);
|
|
187
|
-
let isOutof = getRadius() && getRadius() < distance;
|
|
188
|
-
setIsOutofrange(isOutof);
|
|
189
|
-
if (!isPC) {
|
|
190
|
-
changeSearchBoxHeight(false, isOutof, true);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
const handleFocus = (value) => {
|
|
195
|
-
changeSearchBoxHeight(true);
|
|
196
|
-
setIsSearch(value);
|
|
197
|
-
};
|
|
198
|
-
const exploreNear = debounce((type) => {
|
|
199
|
-
const { lat, lng } = centerRef.current || latlng;
|
|
200
|
-
let TMap = getTMap();
|
|
201
|
-
let search = new TMap.service.Search({ pageSize: 10 }); // 新建一个地点搜索类
|
|
202
|
-
if (type === 'updateCenter') {
|
|
203
|
-
searchListPageSize.current = 1;
|
|
204
|
-
}
|
|
205
|
-
setSearchLoadingStatus(true);
|
|
206
|
-
search
|
|
207
|
-
.explore({
|
|
208
|
-
center: new TMap.LatLng(lat, lng),
|
|
209
|
-
policy: 2,
|
|
210
|
-
radius: 1000,
|
|
211
|
-
pageIndex: searchListPageSize.current,
|
|
212
|
-
})
|
|
213
|
-
.then((res) => {
|
|
214
|
-
setSearchLoadingStatus(false);
|
|
215
|
-
if (res.status === 0) {
|
|
216
|
-
let list = [...exploreList, ...res.data];
|
|
217
|
-
if (searchListPageSize.current === 1) {
|
|
218
|
-
list = res.data;
|
|
219
|
-
setRealLocation({ lat, lng }, list);
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
setExploreList(list);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
else {
|
|
226
|
-
setRealLocation({ lat, lng }, []);
|
|
227
|
-
}
|
|
228
|
-
})
|
|
229
|
-
.catch((error) => {
|
|
230
|
-
setSearchLoadingStatus(false);
|
|
231
|
-
setRealLocation({ lat, lng }, []);
|
|
232
|
-
console.log('explore error', error);
|
|
233
|
-
});
|
|
234
|
-
}, 500);
|
|
235
|
-
// 逆解析查询当前经纬度地址
|
|
236
|
-
const setRealLocation = (location, list) => {
|
|
237
|
-
const { lat, lng } = location;
|
|
238
|
-
let TMap = getTMap();
|
|
239
|
-
const Geocoder = new TMap.service.Geocoder();
|
|
240
|
-
Geocoder.getAddress({
|
|
241
|
-
location: new TMap.LatLng(lat, lng),
|
|
242
|
-
})
|
|
243
|
-
.then(({ status, result }) => {
|
|
244
|
-
var _a;
|
|
245
|
-
if (status == 0) {
|
|
246
|
-
let address = result.address;
|
|
247
|
-
let title = (_a = result === null || result === void 0 ? void 0 : result.formatted_addresses) === null || _a === void 0 ? void 0 : _a.recommend;
|
|
248
|
-
let item = {
|
|
249
|
-
id: 'current-location',
|
|
250
|
-
location: {
|
|
251
|
-
lat,
|
|
252
|
-
lng,
|
|
253
|
-
},
|
|
254
|
-
title: title ? title : address,
|
|
255
|
-
address,
|
|
256
|
-
};
|
|
257
|
-
setChooseLoc(item);
|
|
258
|
-
changeLocation(item);
|
|
259
|
-
setExploreList([item, ...list]);
|
|
260
|
-
}
|
|
261
|
-
})
|
|
262
|
-
.catch((error) => {
|
|
263
|
-
console.log('getAddress error', error);
|
|
264
|
-
let item = {
|
|
265
|
-
id: 'current-location',
|
|
266
|
-
location: {
|
|
267
|
-
lat,
|
|
268
|
-
lng,
|
|
269
|
-
},
|
|
270
|
-
title: '[位置]',
|
|
271
|
-
address: '暂无地址信息',
|
|
272
|
-
};
|
|
273
|
-
setChooseLoc(item);
|
|
274
|
-
changeLocation(item);
|
|
275
|
-
setExploreList([item]);
|
|
276
|
-
});
|
|
277
|
-
};
|
|
278
|
-
const chooseLoction = (value, type) => {
|
|
279
|
-
const TMap = getTMap();
|
|
280
|
-
//定义地图中心点坐标
|
|
281
|
-
const center = new TMap.LatLng(value.location.lat, value.location.lng);
|
|
282
|
-
mapRef.current.setCenter(center);
|
|
283
|
-
markerRef.current.updateGeometries([
|
|
284
|
-
{
|
|
285
|
-
id: `pointer-${mapDomName}`,
|
|
286
|
-
styleId: 'pointer',
|
|
287
|
-
position: center,
|
|
288
|
-
},
|
|
289
|
-
]);
|
|
290
|
-
setChooseLoc(value);
|
|
291
|
-
changeLocation(value);
|
|
292
|
-
if (type) {
|
|
293
|
-
setExploreList([]);
|
|
294
|
-
cancleSearch();
|
|
295
|
-
mapDrag();
|
|
296
|
-
}
|
|
297
|
-
else {
|
|
298
|
-
const currentLocationsLatlng = currentLocations.latlng;
|
|
299
|
-
compareDistance(currentLocationsLatlng, value.location);
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
const changeSearchValue = (event) => {
|
|
303
|
-
if (event.target.value) {
|
|
304
|
-
setSearchValue(event.target.value);
|
|
305
|
-
let TMap = getTMap();
|
|
306
|
-
let search = new TMap.service.Suggestion({ pageSize: 20 }); // 新建一个地点搜索类
|
|
307
|
-
search
|
|
308
|
-
.getSuggestions({
|
|
309
|
-
keyword: event.target.value,
|
|
310
|
-
location: new TMap.LatLng(lat, lng),
|
|
311
|
-
radius: 2000,
|
|
312
|
-
pageIndex: 1,
|
|
313
|
-
})
|
|
314
|
-
.then((res) => {
|
|
315
|
-
if (res.status === 0) {
|
|
316
|
-
setSearchList(res.data);
|
|
317
|
-
}
|
|
318
|
-
})
|
|
319
|
-
.catch((error) => {
|
|
320
|
-
console.log('error', error);
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
else {
|
|
324
|
-
setSearchValue('');
|
|
325
|
-
// 不知道
|
|
326
|
-
// eslint-disable-next-line rulesdir/no-timer
|
|
327
|
-
setTimeout(() => {
|
|
328
|
-
setSearchList([]);
|
|
329
|
-
}, 300);
|
|
330
|
-
}
|
|
331
|
-
};
|
|
332
|
-
const cancleSearch = () => {
|
|
333
|
-
handleFocus(false);
|
|
334
|
-
setSearchValue('');
|
|
335
|
-
setSearchList([]);
|
|
336
|
-
changeSearchBoxHeight(false);
|
|
337
|
-
};
|
|
338
|
-
const renderMapView = () => {
|
|
339
|
-
return (React.createElement("div", { id: `form-map-choose-${mapDomName}`, style: { height: '100%', width: '100%', position: 'relative' } },
|
|
340
|
-
React.createElement("div", { className: "weda-ui_mapChoose_map_control", onClick: backToOrigin, onTouchEnd: backToOrigin },
|
|
341
|
-
React.createElement("img", { src: "https://qcloudimg.tencent-cloud.cn/raw/16f372916b73decb45faa912e37f6e6f.svg", className: "weda-ui_mapChoose_map_control_img", alt: "" }))));
|
|
342
|
-
};
|
|
343
|
-
const handletouchmove = (event) => {
|
|
344
|
-
document.getElementsByClassName('map-choose-header_search_input')[0].blur();
|
|
345
|
-
let currentY = event.changedTouches[0].clientY;
|
|
346
|
-
let status = currentY <= touchCoordinate.current.startY;
|
|
347
|
-
changeSearchBoxHeight(status);
|
|
348
|
-
};
|
|
349
|
-
const handletouchstart = (event) => {
|
|
350
|
-
document.getElementsByClassName('map-choose-header_search_input')[0].blur();
|
|
351
|
-
touchCoordinate.current.startY = event.changedTouches[0].clientY;
|
|
352
|
-
};
|
|
353
|
-
const changeSearchBoxHeight = (status, currentOutofrange, isInDrag) => {
|
|
354
|
-
// 搜索区域默认 328px ,上拉 75% ,当超出范围多一个超出提示 46px
|
|
355
|
-
let isOut = isInDrag ? currentOutofrange : isOutofrange;
|
|
356
|
-
const boxHeight = Math.ceil(clientHeight * 0.75);
|
|
357
|
-
let searchBoxHeights = isOut ? 328 - 46 : 328;
|
|
358
|
-
if (status) {
|
|
359
|
-
searchBoxHeights = isOut ? boxHeight - 46 : boxHeight;
|
|
360
|
-
}
|
|
361
|
-
setSearchBoxHeight(searchBoxHeights);
|
|
362
|
-
setMapBoxHeight(status ? clientHeight - boxHeight : clientHeight - 328);
|
|
363
|
-
};
|
|
364
|
-
const searchListOnScroll = () => {
|
|
365
|
-
getOnScrollDirection();
|
|
366
|
-
if (searchListPageSize.current === 5 || isSearch) {
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
let scrollTop = searchListRef.current.scrollTop;
|
|
370
|
-
let clientHeight = searchListRef.current.clientHeight;
|
|
371
|
-
let scrollHeight = searchListRef.current.scrollHeight;
|
|
372
|
-
if (scrollTop + clientHeight + 1 >= scrollHeight) {
|
|
373
|
-
searchListPageSize.current++;
|
|
374
|
-
exploreNear();
|
|
375
|
-
}
|
|
376
|
-
};
|
|
377
|
-
const getOnScrollDirection = () => {
|
|
378
|
-
if ((searchBoxHeight !== 328 && searchBoxHeight !== 282) || isPC) {
|
|
379
|
-
return;
|
|
380
|
-
}
|
|
381
|
-
if (searchListRef.current.scrollTop > relativePosition) {
|
|
382
|
-
changeSearchBoxHeight(true);
|
|
383
|
-
}
|
|
384
|
-
relativePosition = searchListRef.current.scrollTop;
|
|
385
|
-
};
|
|
386
|
-
const renderSearchList = () => {
|
|
387
|
-
return (React.createElement("div", { className: classNames({
|
|
388
|
-
'weda-ui_mapChoose_search': true,
|
|
389
|
-
'weda-ui_mapChoose_search_pc': isPC,
|
|
390
|
-
}), style: { height: `${searchBoxHeight}px` }, onTouchStart: handletouchstart, onTouchMove: handletouchmove },
|
|
391
|
-
searchBoxHeight !== 328 && searchBoxHeight !== 282 && !isPC && (React.createElement("div", { className: "weda-ui_mapChoose_search_input_arrow", onClick: () => {
|
|
392
|
-
changeSearchBoxHeight(false);
|
|
393
|
-
} },
|
|
394
|
-
React.createElement("span", { className: "weda-ui_mapChoose_search_input_arrow-con" }))),
|
|
395
|
-
React.createElement("div", { className: classNames({
|
|
396
|
-
'map-choose-header': true,
|
|
397
|
-
'map-choose-header_focus': isSearch,
|
|
398
|
-
}) },
|
|
399
|
-
React.createElement("div", { className: "map-choose-header_search" },
|
|
400
|
-
React.createElement("input", { type: "text", onFocus: () => {
|
|
401
|
-
handleFocus(true);
|
|
402
|
-
}, onClick: (e) => {
|
|
403
|
-
e.stopPropagation();
|
|
404
|
-
}, onChange: changeSearchValue, value: searchValue, className: "map-choose-header_search_input" }),
|
|
405
|
-
React.createElement("div", { className: classNames({
|
|
406
|
-
'map-choose-header_search_place': true,
|
|
407
|
-
'map-choose-header_search_place_value': searchValue,
|
|
408
|
-
}) },
|
|
409
|
-
React.createElement("img", { src: "https://qcloudimg.tencent-cloud.cn/raw/388c48cdcbe9ca07f5682fb10d05ebdd.png", alt: "" }),
|
|
410
|
-
React.createElement("span", null, "\u641C\u7D22\u5730\u70B9")),
|
|
411
|
-
searchValue && (React.createElement("div", { className: "weda-ui_mapChoose_search_input_clear", onClick: changeSearchValue },
|
|
412
|
-
React.createElement("p", { className: "weda-ui_mapChoose_search_input_clear_close" })))),
|
|
413
|
-
React.createElement("span", { className: "map-choose-header_search_cancel", onClick: cancleSearch }, "\u53D6\u6D88")),
|
|
414
|
-
searchLoadingStatus && !isSearch && (React.createElement("div", { className: "weda-ui_mapChoose_search_list_lodading" },
|
|
415
|
-
React.createElement("span", { className: "weda-ui_mapChoose_search_list_lodading_con" }))),
|
|
416
|
-
React.createElement("div", { className: classNames({
|
|
417
|
-
'weda-ui_mapChoose_search_list': true,
|
|
418
|
-
'weda-ui_mapChoose_search_list_top': searchBoxHeight !== 328 && searchBoxHeight !== 282 && !isPC,
|
|
419
|
-
}), onTouchStart: (e) => {
|
|
420
|
-
e.stopPropagation();
|
|
421
|
-
}, onTouchMove: (e) => {
|
|
422
|
-
e.stopPropagation();
|
|
423
|
-
}, ref: searchListRef, onScroll: searchListOnScroll }, (isSearch ? searchList : exploreList).map((item, index) => (React.createElement("div", { key: index, className: "weda-ui_mapChoose_search_list_li", onClick: () => {
|
|
424
|
-
chooseLoction(item, isSearch);
|
|
425
|
-
} },
|
|
426
|
-
React.createElement("div", { className: "weda-ui_mapChoose_search_list_li_wrap" },
|
|
427
|
-
React.createElement("div", { className: "weda-ui_mapChoose_search_list_li_title" }, item.title),
|
|
428
|
-
React.createElement("div", { className: "weda-ui_mapChoose_search_list_li_con" }, item.address),
|
|
429
|
-
item.id === chooseLoc.id && (React.createElement("span", { className: "weda-ui_mapChoose_search_list_li_con_choosed" })))))))));
|
|
430
|
-
};
|
|
431
|
-
const renderOutTip = () => {
|
|
432
|
-
return (React.createElement("div", { className: classNames({
|
|
433
|
-
'weda-ui_mapChoose_outTip': true,
|
|
434
|
-
'weda-ui_mapChoose_outTip_block': isOutofrange,
|
|
435
|
-
'weda-ui_mapChoose_outTip_pc': isPC,
|
|
436
|
-
}) },
|
|
437
|
-
isOutofrange && (React.createElement(Icon, { type: "warning", size: "default", color: "#ED7B2F", style: { marginRight: '9px' } })),
|
|
438
|
-
isOutofrange && React.createElement("span", null, "\u5B9A\u4F4D\u8D85\u51FA\u5141\u8BB8\u8303\u56F4,\u8BF7\u8C03\u6574")));
|
|
439
|
-
};
|
|
440
|
-
const getRadius = () => {
|
|
441
|
-
let radius = 0;
|
|
442
|
-
if (locationRange > 0) {
|
|
443
|
-
radius = locationRange;
|
|
444
|
-
}
|
|
445
|
-
else if (locationRange < 0 && customRange > 0) {
|
|
446
|
-
radius = customRange;
|
|
447
|
-
}
|
|
448
|
-
return radius;
|
|
449
|
-
};
|
|
450
|
-
const backToOrigin = () => {
|
|
451
|
-
const TMap = getTMap();
|
|
452
|
-
const canLoad = TMap && lat && lng && mapRef.current;
|
|
453
|
-
if (canLoad) {
|
|
454
|
-
const currentLocationsLatlng = currentLocations.latlng;
|
|
455
|
-
const nowPosition = new TMap.LatLng(currentLocationsLatlng.lat, currentLocationsLatlng.lng);
|
|
456
|
-
markerRef.current.updateGeometries([
|
|
457
|
-
{
|
|
458
|
-
id: `pointer-${mapDomName}`,
|
|
459
|
-
styleId: 'pointer',
|
|
460
|
-
position: nowPosition,
|
|
461
|
-
},
|
|
462
|
-
]);
|
|
463
|
-
mapRef.current.setCenter(nowPosition);
|
|
464
|
-
searchListPageSize.current = 1;
|
|
465
|
-
setChooseLoc({});
|
|
466
|
-
mapDrag();
|
|
467
|
-
}
|
|
468
|
-
};
|
|
469
|
-
const getConfirm = () => {
|
|
470
|
-
return isOutofrange || !chooseLoc.id;
|
|
471
|
-
};
|
|
472
|
-
if (isPC) {
|
|
473
|
-
return (React.createElement("div", { className: classNames('map-choose', 'map-choose-pc', 'weda-ui_map-choose') },
|
|
474
|
-
renderOutTip(),
|
|
475
|
-
React.createElement("div", { className: classNames({
|
|
476
|
-
'map-choose-pc_warp': true,
|
|
477
|
-
'map-choose-pc_warp_out': isOutofrange,
|
|
478
|
-
}) },
|
|
479
|
-
React.createElement("div", { className: "map-choose-pc-left" }, renderSearchList()),
|
|
480
|
-
React.createElement("div", { className: "map-choose-pc-right" }, renderMapView()))));
|
|
481
|
-
}
|
|
482
|
-
return (React.createElement("div", { className: "map-choose weda-ui_map-choose" },
|
|
483
|
-
renderOutTip(),
|
|
484
|
-
React.createElement("div", { className: "weda-ui_mapChoose_map", style: { height: `${mapBoxHeight}px` } },
|
|
485
|
-
React.createElement("div", { className: "weda-ui_mapChoose_msg" },
|
|
486
|
-
React.createElement("div", { className: classNames({
|
|
487
|
-
'weda-ui_mapChoose_confirm': true,
|
|
488
|
-
'weda-ui_mapChoose_confirm_disable': getConfirm(),
|
|
489
|
-
}), onClick: () => {
|
|
490
|
-
!getConfirm() && onConfirm();
|
|
491
|
-
} }, "\u786E\u5B9A"),
|
|
492
|
-
React.createElement("div", { className: "weda-ui_mapChoose_colse", onClick: onClose }, "\u53D6\u6D88")),
|
|
493
|
-
renderMapView()),
|
|
494
|
-
renderSearchList()));
|
|
495
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
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";
|