@cloudbase/weda-ui 3.1.1 → 3.1.4

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.
Files changed (49) hide show
  1. package/dist/asset-manifest.json +17 -0
  2. package/dist/configs/components/carousel.json +2 -2
  3. package/dist/configs/components/form/checkbox.json +1 -0
  4. package/dist/configs/components/form/form.json +39 -15
  5. package/dist/configs/components/form/location.json +0 -32
  6. package/dist/configs/components/form/select.json +1 -0
  7. package/dist/index.html +88 -0
  8. package/dist/static/js/bundle.js +963 -0
  9. package/dist/static/js/bundle.js.map +1 -0
  10. package/dist/static/js/main.chunk.js +8841 -0
  11. package/dist/static/js/main.chunk.js.map +1 -0
  12. package/dist/static/js/vendors~main.chunk.js +247885 -0
  13. package/dist/static/js/vendors~main.chunk.js.map +1 -0
  14. package/dist/static/media/ef6fa527e24e354765d806b826b41391.fa67580a.svg +627 -0
  15. package/dist/web/components/chart/common/core/eChartBar.d.ts +36 -0
  16. package/dist/web/components/chart/common/core/eChartBar.js +3 -1
  17. package/dist/web/components/chart/common/core/eChartLine.d.ts +34 -0
  18. package/dist/web/components/chart/common/core/eChartLine.js +3 -1
  19. package/dist/web/components/chart/common/core/eChartPie.d.ts +22 -0
  20. package/dist/web/components/form/checkbox/index.js +1 -1
  21. package/dist/web/components/form/form/index.css +4 -0
  22. package/dist/web/components/form/form/index.d.ts +21 -2
  23. package/dist/web/components/form/form/index.js +90 -16
  24. package/dist/web/components/form/location/common/mapChoose.js +97 -35
  25. package/dist/web/components/form/location/common/propsConfig.d.ts +1 -4
  26. package/dist/web/components/form/location/common/propsConfig.js +0 -2
  27. package/dist/web/components/form/location/common/useLocationInfo.d.ts +2 -0
  28. package/dist/web/components/form/location/common/useLocationInfo.js +19 -3
  29. package/dist/web/components/form/location/components/LocationH5/index.css +1 -1
  30. package/dist/web/components/form/location/components/LocationH5/location.h5.js +30 -54
  31. package/dist/web/components/form/location/components/LocationPC/location.PC.js +16 -51
  32. package/dist/web/components/form/select/dropdown-select/ui.d.ts +15 -0
  33. package/dist/web/components/form/select/dropdown-select/ui.js +55 -0
  34. package/dist/web/components/form/select/h5.d.ts +1 -1
  35. package/dist/web/components/form/select/h5.js +54 -150
  36. package/dist/web/components/form/select/index.d.ts +1 -1
  37. package/dist/web/components/form/select/index.js +33 -94
  38. package/dist/web/components/form/select/use-options.d.ts +26 -0
  39. package/dist/web/components/form/select/use-options.js +103 -0
  40. package/dist/web/components/form/uploader/index.css +10 -3
  41. package/dist/web/components/form/uploader/uploader.h5.d.ts +1 -1
  42. package/dist/web/components/form/uploader/uploader.h5.js +18 -19
  43. package/dist/web/components/form/uploader/uploader.pc.js +6 -3
  44. package/dist/web/components/richText/index.js +20 -17
  45. package/dist/web/utils/isObjectEqual.d.ts +1 -1
  46. package/dist/web/utils/tcb.d.ts +5 -1
  47. package/dist/web/utils/tcb.js +26 -3
  48. package/package.json +41 -39
  49. package/CHANGELOG.md +0 -7
@@ -28,5 +28,41 @@ declare class EchartBar extends EchartBase {
28
28
  setDirectionType({ directionType }: {
29
29
  directionType: any;
30
30
  }): void;
31
+ setOptions({ directionType, isPile, setColor, isTitle, title, titleLocation, dataSource, filterData, xField, xStatistics, groupKey, groupKeyTimeSpan, xIsCountEmpty, yField, isLegend, legend, legend2, isXaxisName, xAxisName, isXaxisAxisLabelShow, isXaxisAxisTickShow, isXaxisAxisLabelRotate, isYAxisSplitlineLinestyleWidth, yAxisSplitlineLinestyleType, yAxisMax, yAxisMin, isYAxisName, yAxisName, isSeriesShowSymbol, isYAxisShow, isUnit, unit, decimalDigits, suffix, }: {
32
+ directionType: any;
33
+ isPile: any;
34
+ setColor: any;
35
+ isTitle: any;
36
+ title: any;
37
+ titleLocation: any;
38
+ dataSource: any;
39
+ filterData: any;
40
+ xField: any;
41
+ xStatistics: any;
42
+ groupKey: any;
43
+ groupKeyTimeSpan: any;
44
+ xIsCountEmpty: any;
45
+ yField: any;
46
+ isLegend: any;
47
+ legend: any;
48
+ legend2: any;
49
+ isXaxisName: any;
50
+ xAxisName: any;
51
+ isXaxisAxisLabelShow: any;
52
+ isXaxisAxisTickShow: any;
53
+ isXaxisAxisLabelRotate: any;
54
+ isYAxisSplitlineLinestyleWidth: any;
55
+ yAxisSplitlineLinestyleType: any;
56
+ yAxisMax: any;
57
+ yAxisMin: any;
58
+ isYAxisName: any;
59
+ yAxisName: any;
60
+ isSeriesShowSymbol: any;
61
+ isYAxisShow: any;
62
+ isUnit: any;
63
+ unit: any;
64
+ decimalDigits: any;
65
+ suffix: any;
66
+ }): Promise<any>;
31
67
  }
32
68
  import EchartBase from "./eChartBase";
@@ -43,7 +43,9 @@ class EchartBar extends EchartBase {
43
43
  data: [],
44
44
  };
45
45
  sortedXAxisData.forEach((itemSource, index) => {
46
- this.config.series[j].name = itemSource.YLabels[j].Cn_Name;
46
+ var _a, _b;
47
+ this.config.series[j].name =
48
+ (_b = (_a = itemSource.YLabels[j]) === null || _a === void 0 ? void 0 : _a.Cn_Name) !== null && _b !== void 0 ? _b : itemSource.YLabels[j].Name;
47
49
  if ((itemSource.YLabels[j].Value === undefined ||
48
50
  itemSource.YLabels[j].Value === null) &&
49
51
  !xIsCountEmpty) {
@@ -24,5 +24,39 @@ declare class EchartLine extends EchartBase {
24
24
  decimalDigits: any;
25
25
  suffix: any;
26
26
  }): void;
27
+ setOptions({ chartType, isTitle, title, titleLocation, dataSource, filterData, xField, xStatistics, groupKey, groupKeyTimeSpan, xIsCountEmpty, yField, isLegend, legend, legend2, isXaxisName, xAxisName, isXaxisAxisLabelShow, isXaxisAxisTickShow, isXaxisAxisLabelRotate, isYAxisSplitlineLinestyleWidth, yAxisSplitlineLinestyleType, yAxisMax, yAxisMin, isYAxisName, yAxisName, isSeriesShowSymbol, isYAxisShow, isUnit, unit, decimalDigits, suffix, }: {
28
+ chartType: any;
29
+ isTitle: any;
30
+ title: any;
31
+ titleLocation: any;
32
+ dataSource: any;
33
+ filterData: any;
34
+ xField: any;
35
+ xStatistics: any;
36
+ groupKey: any;
37
+ groupKeyTimeSpan: any;
38
+ xIsCountEmpty: any;
39
+ yField: any;
40
+ isLegend: any;
41
+ legend: any;
42
+ legend2: any;
43
+ isXaxisName: any;
44
+ xAxisName: any;
45
+ isXaxisAxisLabelShow: any;
46
+ isXaxisAxisTickShow: any;
47
+ isXaxisAxisLabelRotate: any;
48
+ isYAxisSplitlineLinestyleWidth: any;
49
+ yAxisSplitlineLinestyleType: any;
50
+ yAxisMax: any;
51
+ yAxisMin: any;
52
+ isYAxisName: any;
53
+ yAxisName: any;
54
+ isSeriesShowSymbol: any;
55
+ isYAxisShow: any;
56
+ isUnit: any;
57
+ unit: any;
58
+ decimalDigits: any;
59
+ suffix: any;
60
+ }): Promise<void>;
27
61
  }
28
62
  import EchartBase from "./eChartBase";
@@ -43,7 +43,9 @@ class EchartLine extends EchartBase {
43
43
  data: [],
44
44
  };
45
45
  sortedXAxisData.forEach((itemSource, index) => {
46
- this.config.series[j].name = itemSource.YLabels[j].Cn_Name;
46
+ var _a, _b;
47
+ this.config.series[j].name =
48
+ (_b = (_a = itemSource.YLabels[j]) === null || _a === void 0 ? void 0 : _a.Cn_Name) !== null && _b !== void 0 ? _b : itemSource.YLabels[j].Name;
47
49
  if ((itemSource.YLabels[j].Value === undefined ||
48
50
  itemSource.YLabels[j].Value === null) &&
49
51
  !xIsCountEmpty) {
@@ -24,5 +24,27 @@ declare class EchartPie extends EchartBase {
24
24
  decimalDigits: any;
25
25
  suffix: any;
26
26
  }): void;
27
+ setOptions({ chartType, isTitle, title, titleLocation, dataSource, filterData, setColor, xField, xStatistics, xIsCountEmpty, yField, isLegend, legend, legend2, isSeriesShowSymbol, isPercent, isUnit, unit, decimalDigits, suffix, }: {
28
+ chartType: any;
29
+ isTitle: any;
30
+ title: any;
31
+ titleLocation: any;
32
+ dataSource: any;
33
+ filterData: any;
34
+ setColor: any;
35
+ xField: any;
36
+ xStatistics: any;
37
+ xIsCountEmpty: any;
38
+ yField: any;
39
+ isLegend: any;
40
+ legend: any;
41
+ legend2: any;
42
+ isSeriesShowSymbol: any;
43
+ isPercent: any;
44
+ isUnit: any;
45
+ unit: any;
46
+ decimalDigits: any;
47
+ suffix: any;
48
+ }): Promise<void>;
27
49
  }
28
50
  import EchartBase from "./eChartBase";
@@ -35,7 +35,7 @@ name = 'formCheckbox', label = '标题', labelVisible = true, format = '', enumN
35
35
  // 两次range不同时, 需要刷新checkedItems
36
36
  const prevRangeRef = React.useRef();
37
37
  React.useEffect(() => {
38
- if (!isObjectEqual(prevRangeRef.current, option)) {
38
+ if (!isObjectEqual(prevRangeRef.current, option, true)) {
39
39
  prevRangeRef.current = JSON.parse(JSON.stringify(option));
40
40
  setCheckedItems(fromEntries(option.map(({ value, checked }) => [value, !!checked])));
41
41
  }
@@ -7,3 +7,7 @@
7
7
  padding-left: 1.71429rem;
8
8
  padding-right: 1.71429rem;
9
9
  }
10
+
11
+ .weda-form-toast .weui-icon_toast {
12
+ display: none !important;
13
+ }
@@ -1,13 +1,32 @@
1
1
  /// <reference types="react" />
2
- import './index.css';
3
2
  import type { CommonFormPropsType } from '../types';
4
- export default function Form({ className, contentSlot, style, id, layout, }: {
3
+ import './index.css';
4
+ /**
5
+ * 表单容器组件
6
+ */
7
+ export default function Form({ className, contentSlot, style, id, layout, formType, datasourceType, dataSourceName, _id, methodGetItem, paramGetItem, events, appCloud, }: {
5
8
  className: any;
6
9
  contentSlot: any;
7
10
  style: any;
8
11
  id: any;
9
12
  layout: any;
13
+ formType: any;
14
+ datasourceType: any;
15
+ dataSourceName: any;
16
+ _id: any;
17
+ methodGetItem: any;
18
+ paramGetItem: any;
19
+ events: any;
20
+ appCloud?: any;
10
21
  }): JSX.Element;
11
22
  export interface PropsType extends CommonFormPropsType {
12
23
  contentSlot?: any;
24
+ formType?: string;
25
+ datasourceType?: string;
26
+ dataSourceName?: string;
27
+ _id?: string;
28
+ methodCreate?: string;
29
+ methodGetItem?: string;
30
+ paramGetItem?: any;
31
+ methodUpdate?: string;
13
32
  }
@@ -1,19 +1,16 @@
1
1
  import * as React from 'react';
2
2
  import classNames from '../../../utils/classnames';
3
+ import { ConfigProvider, Form as TeaForm, message as TeaMessage, } from 'tea-component';
4
+ import { usePlatform, isInIde } from '../../../utils/platform';
5
+ import { callDataSource, callConnector } from '../../../utils/tcb';
6
+ import weui from '../../../utils/weui';
3
7
  import './index.css';
4
- import { ConfigProvider, Form as TeaForm } from 'tea-component';
5
- import { usePlatform } from '../../../utils/platform';
6
- export default function Form({
7
- // 系统属性
8
- className,
9
- // 组件属性
10
- // title,
11
- // description,
12
- // tips,
13
- contentSlot,
14
- // buttonSlot,
15
- style, id, layout, }) {
16
- const platform = usePlatform();
8
+ /**
9
+ * 表单容器组件
10
+ */
11
+ export default function Form({ className, contentSlot, style, id, layout, formType, datasourceType, dataSourceName, _id, methodGetItem, paramGetItem, events, appCloud = { callDataSource, callConnector }, }) {
12
+ const platform = usePlatform(); // h5 | web
13
+ const isDataModel = !['connector', 'custom-connector'].includes(datasourceType); // 是否为数据模型,兼容历史 undefined
17
14
  const cls = classNames({
18
15
  'weda-ui': true,
19
16
  'weda-form': true,
@@ -22,10 +19,87 @@ style, id, layout, }) {
22
19
  'gsd-h5-react-form-pc': platform === 'pc',
23
20
  [className]: className,
24
21
  });
25
- if (platform === 'pc') {
22
+ const timeRef = React.useRef(null);
23
+ React.useEffect(() => {
24
+ const getData = async () => {
25
+ var _a, _b;
26
+ try {
27
+ let initValue = {};
28
+ if (isDataModel) {
29
+ // 数据模型查询条件
30
+ if (formType === 'edit' && dataSourceName) {
31
+ initValue = await appCloud.callDataSource({
32
+ dataSourceName,
33
+ methodName: 'wedaGetItem',
34
+ params: { _id },
35
+ }, true);
36
+ if (Object.keys(initValue).length !== 0) {
37
+ (_a = events === null || events === void 0 ? void 0 : events.onInitValue) === null || _a === void 0 ? void 0 : _a.call(events, initValue);
38
+ }
39
+ else {
40
+ alertError(platform);
41
+ }
42
+ }
43
+ }
44
+ else {
45
+ // 连接器查询条件
46
+ if (formType === 'edit' &&
47
+ dataSourceName &&
48
+ methodGetItem &&
49
+ paramGetItem) {
50
+ initValue = await appCloud.callConnector({
51
+ dataSourceName,
52
+ methodName: methodGetItem,
53
+ params: paramGetItem,
54
+ }, true);
55
+ if (Object.keys(initValue).length !== 0) {
56
+ (_b = events === null || events === void 0 ? void 0 : events.onInitValue) === null || _b === void 0 ? void 0 : _b.call(events, initValue);
57
+ }
58
+ }
59
+ }
60
+ }
61
+ catch (e) {
62
+ alertError(platform);
63
+ }
64
+ };
65
+ if (dataSourceName && formType === 'edit') {
66
+ if ((isDataModel && _id) ||
67
+ (!isDataModel && paramGetItem && methodGetItem)) {
68
+ clearTimeout(timeRef.current);
69
+ timeRef.current = setTimeout(() => getData(), 100);
70
+ }
71
+ }
72
+ }, [
73
+ formType,
74
+ isDataModel,
75
+ dataSourceName,
76
+ _id,
77
+ platform,
78
+ methodGetItem,
79
+ paramGetItem,
80
+ ]);
81
+ // pc 渲染
82
+ const renderPc = () => {
26
83
  return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
27
84
  React.createElement(TeaForm, { layout: layout, className: cls, style: style, id: id }, contentSlot)));
85
+ };
86
+ // h5 渲染
87
+ const renderH5 = () => {
88
+ return (React.createElement("div", { className: cls, style: style, id: id },
89
+ React.createElement("div", { className: "weui-cells__group weui-cells__group_form" }, contentSlot)));
90
+ };
91
+ return platform === 'pc' ? renderPc() : renderH5();
92
+ }
93
+ /**
94
+ * 根据平台不同,展示不同的错误提示消息
95
+ */
96
+ function alertError(platform = 'h5', message = '更新场景下未查询到数据') {
97
+ if (isInIde())
98
+ return;
99
+ if (platform === 'h5') {
100
+ weui.toast(message, { className: 'weda-form-toast' });
101
+ }
102
+ else {
103
+ TeaMessage.error({ content: message });
28
104
  }
29
- return (React.createElement("div", { className: cls, style: style, id: id },
30
- React.createElement("div", { className: "weui-cells__group weui-cells__group_form" }, contentSlot)));
31
105
  }
@@ -103,6 +103,10 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
103
103
  width: 70,
104
104
  height: 70,
105
105
  src: base64LocationIcon,
106
+ anchor: {
107
+ x: 35,
108
+ y: 30,
109
+ },
106
110
  }),
107
111
  },
108
112
  geometries: [
@@ -119,9 +123,7 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
119
123
  ],
120
124
  });
121
125
  // 监听中心点变化事件,更新marker的位置
122
- map.on('center_changed', updateCenter);
123
- map.on('drag', clearChooseLoc);
124
- map.on('zoom', clearChooseLoc);
126
+ map.on('drag', mapDrag);
125
127
  }
126
128
  };
127
129
  const initCircle = (TMap, map) => {
@@ -149,23 +151,14 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
149
151
  new TMap.MultiCircle(circle);
150
152
  }
151
153
  };
152
- const clearChooseLoc = () => {
153
- setChooseLoc({});
154
- };
155
- const updateCenter = () => {
154
+ const mapDrag = () => {
156
155
  const TMap = getTMap();
157
156
  const canLoad = TMap && lat && lng && mapRef.current;
158
157
  if (canLoad) {
159
158
  const currentLocationsLatlng = currentLocations.latlng;
160
- const nowPosition = new TMap.LatLng(currentLocationsLatlng.lat, currentLocationsLatlng.lng);
161
159
  let centerPosition = mapRef.current.getCenter();
162
160
  centerRef.current = centerPosition;
163
161
  markerRef.current.updateGeometries([
164
- {
165
- id: `pointer-origin-${mapDomName}`,
166
- styleId: 'originPointer',
167
- position: nowPosition,
168
- },
169
162
  {
170
163
  id: `pointer-${mapDomName}`,
171
164
  styleId: 'pointer',
@@ -174,21 +167,27 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
174
167
  ]);
175
168
  exploreNear('updateCenter');
176
169
  // 计算距离
177
- if (getRadius()) {
178
- let latlng1 = {
179
- latitude: currentLocationsLatlng.lat,
180
- longitude: currentLocationsLatlng.lng,
181
- };
182
- let latlng2 = {
183
- latitude: centerPosition.getLat(),
184
- longitude: centerPosition.getLng(),
185
- };
186
- const distance = calculateDistance(latlng1, latlng2);
187
- let isOutof = getRadius() && getRadius() < distance;
188
- setIsOutofrange(isOutof);
189
- if (!isPC) {
190
- changeSearchBoxHeight(false, isOutof);
191
- }
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);
192
191
  }
193
192
  }
194
193
  };
@@ -217,23 +216,88 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
217
216
  let list = [...exploreList, ...res.data];
218
217
  if (searchListPageSize.current === 1) {
219
218
  list = res.data;
219
+ setRealLocation({ lat, lng }, list);
220
+ }
221
+ else {
222
+ setExploreList(list);
220
223
  }
221
- setExploreList(list);
224
+ }
225
+ else {
226
+ setRealLocation({ lat, lng }, []);
222
227
  }
223
228
  })
224
229
  .catch((error) => {
225
230
  setSearchLoadingStatus(false);
231
+ setRealLocation({ lat, lng }, []);
226
232
  console.log('explore error', error);
227
233
  });
228
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
+ };
229
278
  const chooseLoction = (value, type) => {
230
279
  const TMap = getTMap();
231
280
  //定义地图中心点坐标
232
281
  const center = new TMap.LatLng(value.location.lat, value.location.lng);
233
282
  mapRef.current.setCenter(center);
283
+ markerRef.current.updateGeometries([
284
+ {
285
+ id: `pointer-${mapDomName}`,
286
+ styleId: 'pointer',
287
+ position: center,
288
+ },
289
+ ]);
234
290
  setChooseLoc(value);
235
291
  changeLocation(value);
236
- type && cancleSearch();
292
+ if (type) {
293
+ setExploreList([]);
294
+ cancleSearch();
295
+ mapDrag();
296
+ }
297
+ else {
298
+ const currentLocationsLatlng = currentLocations.latlng;
299
+ compareDistance(currentLocationsLatlng, value.location);
300
+ }
237
301
  };
238
302
  const changeSearchValue = (event) => {
239
303
  if (event.target.value) {
@@ -284,12 +348,9 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
284
348
  document.getElementsByClassName('map-choose-header_search_input')[0].blur();
285
349
  touchCoordinate.current.startY = event.changedTouches[0].clientY;
286
350
  };
287
- const changeSearchBoxHeight = (status, currentOutofrange) => {
351
+ const changeSearchBoxHeight = (status, currentOutofrange, isInDrag) => {
288
352
  // 搜索区域默认 328px ,上拉 75% ,当超出范围多一个超出提示 46px
289
- let isOut = isOutofrange;
290
- if (currentOutofrange) {
291
- isOut = currentOutofrange;
292
- }
353
+ let isOut = isInDrag ? currentOutofrange : isOutofrange;
293
354
  const boxHeight = Math.ceil(clientHeight * 0.75);
294
355
  let searchBoxHeights = isOut ? 328 - 46 : 328;
295
356
  if (status) {
@@ -400,6 +461,7 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
400
461
  mapRef.current.setCenter(nowPosition);
401
462
  searchListPageSize.current = 1;
402
463
  setChooseLoc({});
464
+ mapDrag();
403
465
  }
404
466
  };
405
467
  const getConfirm = () => {
@@ -13,10 +13,9 @@ export namespace propTypes {
13
13
  const zoom: PropTypes.Requireable<boolean>;
14
14
  const disabled: PropTypes.Requireable<boolean>;
15
15
  const requiredFlag: PropTypes.Requireable<boolean>;
16
- const decorator: PropTypes.Requireable<any[] | PropTypes.ReactNodeLike>;
16
+ const decorator: PropTypes.Requireable<PropTypes.ReactNodeLike>;
17
17
  const value: PropTypes.Requireable<object>;
18
18
  const locationType: PropTypes.Requireable<number>;
19
- const customLocation: PropTypes.Requireable<object>;
20
19
  const dataSource: PropTypes.Requireable<object>;
21
20
  }
22
21
  export namespace defaultProps {
@@ -44,8 +43,6 @@ export namespace defaultProps {
44
43
  export { requiredFlag_1 as requiredFlag };
45
44
  const locationType_1: number;
46
45
  export { locationType_1 as locationType };
47
- const customLocation_1: {};
48
- export { customLocation_1 as customLocation };
49
46
  export namespace value_1 {
50
47
  const address: string;
51
48
  namespace geopoint {
@@ -19,7 +19,6 @@ export const propTypes = {
19
19
  decorator: PropTypes.oneOfType([PropTypes.array, PropTypes.node]),
20
20
  value: PropTypes.object,
21
21
  locationType: PropTypes.number,
22
- customLocation: PropTypes.object,
23
22
  dataSource: PropTypes.object,
24
23
  };
25
24
  export const defaultProps = {
@@ -37,7 +36,6 @@ export const defaultProps = {
37
36
  disabled: false,
38
37
  requiredFlag: false,
39
38
  locationType: 1,
40
- customLocation: {},
41
39
  // 模型应用属性
42
40
  value: {
43
41
  address: '',
@@ -30,5 +30,7 @@ export default function useLocationInfo({ apiKey: APIKEY, locationType, eventsCh
30
30
  }>>;
31
31
  currentLocStatus: boolean;
32
32
  currentLocations: React.MutableRefObject<undefined>;
33
+ customLocation: React.MutableRefObject<undefined>;
34
+ checkCustomLocation: (params: any) => boolean;
33
35
  };
34
36
  import * as React from "react";
@@ -14,6 +14,18 @@ export default function useLocationInfo({ apiKey: APIKEY, locationType, eventsCh
14
14
  });
15
15
  const [currentLocStatus, setCurrentLocStatus] = useState(false);
16
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
+ };
17
29
  useEffect(() => {
18
30
  if (!dataSourceStatus ||
19
31
  !APIKEY ||
@@ -31,12 +43,17 @@ export default function useLocationInfo({ apiKey: APIKEY, locationType, eventsCh
31
43
  script.onload = () => {
32
44
  let geolocation = new window.qq.maps.Geolocation();
33
45
  geolocation.getIpLocation(({ city, lat, lng, addr }) => {
46
+ setApiKeyStatus({ status: true, message: '' });
47
+ setCurrentLocStatus(true);
34
48
  let locations = {
35
49
  poiname: city + addr,
36
50
  detailedAddress: city + addr,
37
51
  latlng: { lat, lng },
38
52
  locationType,
39
53
  };
54
+ currentLocations.current = locations;
55
+ if (checkCustomLocation(customLocation.current))
56
+ return;
40
57
  setLocation(locations);
41
58
  eventsChange &&
42
59
  eventsChange({
@@ -45,9 +62,6 @@ export default function useLocationInfo({ apiKey: APIKEY, locationType, eventsCh
45
62
  latitude: lat,
46
63
  longitude: lng,
47
64
  }, locationType === 1);
48
- currentLocations.current = locations;
49
- setApiKeyStatus({ status: true, message: '' });
50
- setCurrentLocStatus(true);
51
65
  }, (error) => {
52
66
  console.log('error loc', error);
53
67
  currentLocations.current = null;
@@ -84,5 +98,7 @@ export default function useLocationInfo({ apiKey: APIKEY, locationType, eventsCh
84
98
  setApiKeyStatus,
85
99
  currentLocStatus,
86
100
  currentLocations,
101
+ customLocation,
102
+ checkCustomLocation,
87
103
  };
88
104
  }
@@ -69,7 +69,7 @@
69
69
  height: 1.25em;
70
70
  }
71
71
  .form-location-addr > div {
72
- margin-left: 0.85714rem;
72
+ margin-left: 0.57143rem;
73
73
  }
74
74
  .form-map-container {
75
75
  padding: 0 1.14286rem 1.14286rem 1.14286rem;