@hzab/form-render 1.3.3 → 1.4.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/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # @hzab/form-render@1.4.0-beta
2
+
3
+ break: location-list-picker 添加多区域规划
4
+ fix: LocationListPicker 点位信息弹窗位置问题修复
5
+
1
6
  # @hzab/form-render@1.3.3
2
7
 
3
8
  fix: 富文本异步数据问题修复
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hzab/form-render",
3
- "version": "1.3.3",
3
+ "version": "1.4.0",
4
4
  "description": "",
5
5
  "main": "src",
6
6
  "scripts": {
@@ -41,6 +41,7 @@
41
41
  "@amap/amap-jsapi-loader": "^1.0.1",
42
42
  "@formily/core": "2.3.1",
43
43
  "@formily/react": "2.3.1",
44
+ "@turf/turf": "^6.5.0",
44
45
  "@formily/reactive-react": "2.3.1",
45
46
  "@wangeditor/editor-for-react": "^1.0.6",
46
47
  "ajv": "^8.12.0",
@@ -50,4 +51,4 @@
50
51
  "directories": {
51
52
  "lib": "lib"
52
53
  }
53
- }
54
+ }
@@ -9,6 +9,7 @@
9
9
  align-items: center;
10
10
  padding: 12px 24px;
11
11
  line-height: 1;
12
+ cursor: pointer;
12
13
 
13
14
  &.active {
14
15
  background: #f2f9ff;
@@ -39,6 +40,10 @@
39
40
  &:last-child {
40
41
  margin-right: none;
41
42
  }
43
+ &.disabled {
44
+ color: #999;
45
+ cursor: not-allowed;
46
+ }
42
47
  }
43
48
  .edit-btn {
44
49
  color: #0080ff;
@@ -5,28 +5,53 @@ import "./index.less";
5
5
  import { useState } from "react";
6
6
 
7
7
  export const AddrList = (props) => {
8
- const { list, ItemRender, onItemClick, onEdit, onDel, hasAction = true, activeId, onDelClick, onDelCancel } = props;
8
+ const {
9
+ readOnly,
10
+ disabled,
11
+ list,
12
+ ItemRender,
13
+ onItemClick,
14
+ onEdit,
15
+ onDel,
16
+ hasAction = true,
17
+ activeId,
18
+ onDelClick,
19
+ onDelCancel,
20
+ } = props;
9
21
 
10
22
  const CItemRender = ItemRender ?? LItemRender;
11
23
 
12
24
  return (
13
25
  <div className="addr-list">
14
26
  {list?.map((it, i) => {
27
+ const delCom = (
28
+ <DeleteOutlined
29
+ className={`action-btn del-btn ${disabled ? "disabled" : ""}`}
30
+ onClick={(e) => !disabled && onDelClick && onDelClick(it, i, e)}
31
+ />
32
+ );
15
33
  return (
16
34
  <div className={`addr-item ${activeId === it.id ? "active" : ""}`} key={it.id ?? i}>
17
35
  <div className="addr-item-content" onClick={(e) => onItemClick(it, i, e)}>
18
36
  <CItemRender item={it} index={i} />
19
37
  </div>
20
- {hasAction && (
38
+ {!readOnly && hasAction && (
21
39
  <div className="action-box">
22
- <EditOutlined className="action-btn edit-btn" onClick={(e) => onEdit && onEdit(it, i, e)} />
23
- <Popconfirm
24
- title={"确认删除当前项?"}
25
- onConfirm={(e) => onDel && onDel(it, i, e)}
26
- onOpenChange={(open) => open === false && onDelCancel && onDelCancel(it, i)}
27
- >
28
- <DeleteOutlined className="action-btn del-btn" onClick={(e) => onDelClick && onDelClick(it, i, e)} />
29
- </Popconfirm>
40
+ <EditOutlined
41
+ className={`action-btn edit-btn ${disabled ? "disabled" : ""}`}
42
+ onClick={(e) => !disabled && onEdit && onEdit(it, i, e)}
43
+ />
44
+ {disabled ? (
45
+ delCom
46
+ ) : (
47
+ <Popconfirm
48
+ title={"确认删除当前项?"}
49
+ onConfirm={(e) => onDel && onDel(it, i, e)}
50
+ onOpenChange={(open) => open === false && onDelCancel && onDelCancel(it, i)}
51
+ >
52
+ {delCom}
53
+ </Popconfirm>
54
+ )}
30
55
  </div>
31
56
  )}
32
57
  </div>
@@ -1,5 +1,5 @@
1
1
  .popup-box {
2
- position: absolute;
2
+ position: fixed;
3
3
  z-index: 9;
4
4
  min-width: 200px;
5
5
  padding: 20px;
@@ -1,4 +1,5 @@
1
1
  import { useRef, forwardRef, useImperativeHandle, useState } from "react";
2
+ import { createPortal } from "react-dom";
2
3
  import { Button } from "antd";
3
4
 
4
5
  import FormRender from "@hzab/form-render";
@@ -61,26 +62,29 @@ export const Popup = forwardRef((props: IPopupProps, parentRef) => {
61
62
 
62
63
  const schema = mergeSchema(AddressSchema, formProps?.schema ?? RangeSchema);
63
64
 
64
- return data ? (
65
- <div className="popup-box" style={{ top: data?.top, left: data?.left }}>
66
- <div className="popup-body">
67
- {/* TODO: schema 中插入地址字段 text 格式 */}
68
- <div>地址:{data?.address}</div>
69
- <FormRender
70
- ref={formRef}
71
- {...formProps}
72
- schema={schema}
73
- initialValues={{ ...formProps?.initialValues, ...data }}
74
- />
75
- </div>
76
- <div className="popup-footer">
77
- <Button type="primary" onClick={onConfirm}>
78
- 确定
79
- </Button>
80
- <Button onClick={onCancel}>取消</Button>
81
- </div>
82
- </div>
83
- ) : null;
65
+ return data
66
+ ? createPortal(
67
+ <div className="popup-box" style={{ top: data?.top, left: data?.left }}>
68
+ <div className="popup-body">
69
+ {/* TODO: schema 中插入地址字段 text 格式 */}
70
+ <div>地址:{data?.address}</div>
71
+ <FormRender
72
+ ref={formRef}
73
+ {...formProps}
74
+ schema={schema}
75
+ initialValues={{ ...formProps?.initialValues, ...data }}
76
+ />
77
+ </div>
78
+ <div className="popup-footer">
79
+ <Button type="primary" onClick={onConfirm}>
80
+ 确定
81
+ </Button>
82
+ <Button onClick={onCancel}>取消</Button>
83
+ </div>
84
+ </div>,
85
+ document.body,
86
+ )
87
+ : null;
84
88
  });
85
89
 
86
90
  export default Popup;
@@ -2,24 +2,34 @@
2
2
  width: 100%;
3
3
  height: 722px;
4
4
  display: flex;
5
+
5
6
  .location-map-search {
6
7
  top: 12px;
7
8
  left: 12px;
8
9
  }
10
+
9
11
  .map-box {
10
12
  position: relative;
11
13
  width: 50%;
12
14
  min-height: 600px;
13
15
  margin-right: 12px;
16
+
14
17
  .location-list-picker-notice-bar {
15
18
  width: 120px;
16
19
  position: absolute;
17
20
  z-index: 9;
18
21
  }
22
+
23
+ .add-polygon-btn {
24
+ position: absolute;
25
+ top: 12px;
26
+ right: 112px;
27
+ }
28
+
19
29
  .add-btn {
20
30
  position: absolute;
21
31
  top: 12px;
22
32
  right: 12px;
23
33
  }
24
34
  }
25
- }
35
+ }
@@ -2,7 +2,7 @@
2
2
  import { useEffect, useRef, useState } from "react";
3
3
  import { Button, message, Alert } from "antd";
4
4
  import { observer } from "@formily/react";
5
-
5
+ import * as turf from "@turf/turf";
6
6
  import { nanoid } from "nanoid";
7
7
 
8
8
  import AddrList from "./components/AddrList";
@@ -19,17 +19,32 @@ import { iconCircle0080ff } from "./assets/icon";
19
19
  import "./index.less";
20
20
 
21
21
  export const LocationListPicker = observer((props) => {
22
- const { value, listProps, popupProps, ItemRender, markerIconConf, isAutoSearch, onChange } = props;
22
+ const {
23
+ value,
24
+ readOnly,
25
+ disabled,
26
+ listProps,
27
+ popupProps,
28
+ ItemRender,
29
+ markerIconConf,
30
+ isAutoSearch,
31
+ /** 是否支持新增多边形 */
32
+ hasPolygon,
33
+ /** 是否支持新增点位 */
34
+ hasPoint = true,
35
+ onChange,
36
+ } = props;
23
37
 
24
38
  const [loading, setLoading] = useState(props.loading || false);
25
39
  const [showTip, setShowTip] = useState(false);
40
+ const [tipText, setTipText] = useState("点击选择地址");
26
41
  const [tipPosition, setTipPosition] = useState({});
27
42
  const [activeId, setActiveId] = useState();
28
-
29
43
  const mapDomRef = useRef();
30
44
  const mapUtilsRef = useRef<MapUtils>();
31
45
  const listRef = useRef(value);
32
46
  const statusRef = useRef();
47
+ const drawType = useRef("marker");
33
48
  const currentItemRef = useRef();
34
49
  const popupRef = useRef();
35
50
  const isEditingRef = useRef();
@@ -38,6 +53,7 @@ export const LocationListPicker = observer((props) => {
38
53
  return () => {
39
54
  // 取消监听
40
55
  mapUtilsRef.current?.off("click", onMapClick);
56
+ mapUtilsRef.current?.off("dblclick", onMapDbClick);
41
57
  mapDomRef.current.current.removeEventListener("mousemove", onMouseMove);
42
58
  };
43
59
  }, []);
@@ -52,28 +68,42 @@ export const LocationListPicker = observer((props) => {
52
68
  it.id = nanoid();
53
69
  }
54
70
  });
55
- listRef.current = value;
71
+ listRef.current = value || [];
56
72
  renderMarker();
57
73
  }, [value]);
58
74
 
59
75
  function renderMarker() {
60
76
  listRef.current?.forEach((item) => {
61
- mapUtilsRef.current.setMarker(item.longitude, item.latitude, {
62
- ...item,
63
- data: item,
64
- onClick: onMarkerClick,
65
- });
66
- mapUtilsRef.current.setCircle(item.longitude, item.latitude, item.range, { ...item });
67
- setInactiveMarkerIcon(item.id);
77
+ if (item.type === "polygon") {
78
+ mapUtilsRef.current.setPolygon({
79
+ ...item,
80
+ onClick: onPolygonClick,
81
+ });
82
+ } else {
83
+ mapUtilsRef.current.setMarker(item.longitude, item.latitude, {
84
+ ...item,
85
+ data: item,
86
+ onClick: onMarkerClick,
87
+ });
88
+ mapUtilsRef.current.setCircle(item.longitude, item.latitude, item.range, { ...item });
89
+ }
68
90
  });
91
+ clearActive();
69
92
  }
70
93
 
71
94
  function mapInit({ map, mapUtils, mapDomRef: _mapDomRef }) {
72
95
  mapDomRef.current = _mapDomRef;
73
96
  _mapDomRef.current.addEventListener("mousemove", onMouseMove);
74
97
  mapUtilsRef.current = mapUtils;
98
+ mapUtilsRef.current?.createPoly("Polygon");
75
99
  // 启动监听事件
76
100
  mapUtilsRef.current.on("click", onMapClick);
101
+ mapUtilsRef.current.on("dblclick", onMapDbClick);
102
+
103
+ mapUtilsRef.current.startPolygon({
104
+ onClick: onPolygonClick,
105
+ });
106
+
77
107
  renderMarker();
78
108
  mapUtilsRef.current.setFitView();
79
109
  }
@@ -83,18 +113,98 @@ export const LocationListPicker = observer((props) => {
83
113
  message.warn("请先完成上次操作");
84
114
  return;
85
115
  }
86
- setInactiveMarkerIcon(activeId);
116
+ clearActive();
117
+ setTipText("点击选择地址");
118
+ setShowTip(true);
119
+ drawType.current = "marker";
120
+ statusRef.current = "add";
121
+ }
122
+
123
+ function onDrawClick() {
124
+ if (isEditingRef.current) {
125
+ message.warn("请先完成上次操作");
126
+ return;
127
+ }
128
+ isEditingRef.current = true;
129
+ setTipText("点击绘制区域 双击完成绘制");
130
+ setDrawPolygon();
87
131
  setShowTip(true);
132
+ drawType.current = "polygon";
88
133
  statusRef.current = "add";
89
134
  }
90
135
 
136
+ function setDrawPolygon() {
137
+ mapUtilsRef.current.setDrawPolygon({});
138
+ }
139
+
140
+ function setInactivePolygon(item) {
141
+ mapUtilsRef.current.setEditPolygon(item);
142
+ }
143
+
144
+ function onMapDbClick(e) {
145
+ if (drawType.current !== "polygon") {
146
+ return;
147
+ }
148
+ const graphical = mapUtilsRef.current.polyEditor?.PolygonEditor?.getTarget();
149
+ if (graphical) {
150
+ let points = [];
151
+ let center = [];
152
+ if (graphical.getPath().length > 0) {
153
+ const coordinate = graphical.getPath().map((item) => [item.lng, item.lat]);
154
+ points = coordinate;
155
+ center = getPolygonCenter(coordinate);
156
+ }
157
+ mapUtilsRef.current.polyEditor?.PolygonEditor?.close();
158
+ mapUtilsRef.current.polyEditor?.PolygonEditor?.setTarget();
159
+ handlePolygon({
160
+ type: "polygon",
161
+ id: graphical.id,
162
+ points,
163
+ longitude: center[0],
164
+ latitude: center[1],
165
+ });
166
+ }
167
+ }
168
+
169
+ function getPolygonCenter(coordinate) {
170
+ if (coordinate.length > 0) {
171
+ let features = turf.featureCollection(coordinate.map((item) => turf.point(item)));
172
+ let center = turf.center(features).geometry.coordinates;
173
+ return center;
174
+ }
175
+ return [];
176
+ }
177
+
178
+ async function handlePolygon(item) {
179
+ const status = statusRef.current;
180
+ const isAdd = status === "add";
181
+ const isEdit = status === "edit";
182
+ if (isAdd) {
183
+ currentItemRef.current = item;
184
+ }
185
+ // 接口获取地址
186
+ item.address = await getAddress(item.longitude, item.latitude);
187
+ const list = [...(listRef.current || [])];
188
+ if (isAdd) {
189
+ list.push(item);
190
+ } else if (isEdit) {
191
+ const idx = list.findIndex((it) => it.id === item.id);
192
+ list.splice(idx, 1, item);
193
+ }
194
+ onChange && onChange(list);
195
+ clearStatus();
196
+ }
197
+
91
198
  // 处理 marker、范围 绘制填写逻辑
92
199
  async function onMapClick(e) {
200
+ if (drawType.current !== "marker") {
201
+ return;
202
+ }
203
+
93
204
  const status = statusRef.current;
94
205
  const isAdd = status === "add";
95
206
  const isEdit = status === "edit";
96
207
  setShowTip(false);
97
-
98
208
  if (!isAdd && !isEdit) {
99
209
  return;
100
210
  }
@@ -110,7 +220,7 @@ export const LocationListPicker = observer((props) => {
110
220
  longitude: lng,
111
221
  latitude: lat,
112
222
  address: "",
113
- range: null,
223
+ range: "",
114
224
  ...preItem,
115
225
  };
116
226
 
@@ -135,11 +245,16 @@ export const LocationListPicker = observer((props) => {
135
245
 
136
246
  // 根据经纬度获取弹窗位置
137
247
  const { x, y } = mapUtilsRef.current.map.lngLatToContainer([lng, lat]);
248
+ const mapDomRect = mapDomRef.current?.current?.getBoundingClientRect();
249
+ // 获取屏幕 x y
250
+ const screenX = mapDomRect?.left + x;
251
+ const screenY = mapDomRect?.top + y;
138
252
  let res = {};
139
253
  try {
140
254
  res = await popupRef.current?.onShow({
141
- top: y,
142
- left: x,
255
+ type: "marker",
256
+ top: screenY,
257
+ left: screenX,
143
258
  address: item.address,
144
259
  range: item.range,
145
260
  item,
@@ -164,7 +279,7 @@ export const LocationListPicker = observer((props) => {
164
279
 
165
280
  item = Object.assign(item, res);
166
281
 
167
- const list = [...listRef.current];
282
+ const list = [...(listRef.current || [])];
168
283
 
169
284
  if (isAdd) {
170
285
  list.push(item);
@@ -177,35 +292,92 @@ export const LocationListPicker = observer((props) => {
177
292
  clearStatus();
178
293
  }
179
294
 
295
+ function onPolygonClick(e) {
296
+ if (!isEditingRef.current) {
297
+ drawType.current = "polygon";
298
+ const id = e.target.id;
299
+ clearEdit(id);
300
+ setActiveId(id);
301
+ setActivePolygon(e.target);
302
+ }
303
+ }
304
+
180
305
  function onMarkerClick(e, ...args) {
181
- const { id } = e.target.getExtData() || {};
182
- setActiveId((_id) => {
183
- setInactiveMarkerIcon(_id);
184
- return id;
306
+ clearActive();
307
+ if (!isEditingRef.current) {
308
+ setShowTip(false);
309
+ isEditingRef.current = false;
310
+ const { id } = e.target.getExtData() || {};
311
+ setActiveId(id);
312
+ setActiveMarkerIcon(id);
313
+ }
314
+ }
315
+
316
+ /**
317
+ * 选中态
318
+ * @param item
319
+ */
320
+ function setActivePolygon(item) {
321
+ clearActive();
322
+ const target = mapUtilsRef.current.polygonEnum[item.id];
323
+ const center = mapUtilsRef.current.getPolygonCenter(target.getPath()?.map((it) => [it.lng, it.lat]));
324
+ mapUtilsRef.current.setCenter(center?.[0], center?.[1]);
325
+ target?.setOptions({
326
+ strokeColor: "#403ef5",
327
+ strokeWeight: 4,
185
328
  });
186
- setActiveMarkerIcon(id);
329
+ }
330
+
331
+ function clearActive() {
332
+ // 多边形清除选中态
333
+ Object.keys(mapUtilsRef.current.polygonEnum).forEach((key) => {
334
+ const item = mapUtilsRef.current.polygonEnum[key];
335
+ item?.setOptions({
336
+ strokeColor: "#1791fc",
337
+ strokeWeight: 2,
338
+ });
339
+ });
340
+ // Marker 清除选中态
341
+ Object.keys(mapUtilsRef.current.markers).forEach((key) => {
342
+ mapUtilsRef.current.setMarkerIcon(key, {
343
+ image: iconCircle0080ff,
344
+ size: [12, 12],
345
+ offset: [-6, -6],
346
+ });
347
+ });
348
+ }
349
+
350
+ function clearEdit(id) {
351
+ mapUtilsRef.current.polyEditor?.PolygonEditor?.close();
352
+ mapUtilsRef.current.polyEditor?.PolygonEditor?.setTarget();
187
353
  }
188
354
 
189
355
  function clearStatus(id) {
356
+ clearActive();
190
357
  isEditingRef.current = false;
191
358
  // 清除状态,解决重复创建的问题
192
359
  statusRef.current = null;
193
360
  // 编辑状态清除数据
194
361
  currentItemRef.current = null;
195
362
  setShowTip(false);
196
- id && setInactiveMarkerIcon(id);
197
363
  popupRef.current.onCancel();
198
364
  }
199
365
 
200
366
  function onItemClick(item, i) {
367
+ drawType.current = item.type || "marker";
368
+ clearActive();
201
369
  clearStatus(item.id);
202
- setInactiveMarkerIcon(activeId);
203
370
  setActiveId(item.id);
204
371
  const mapUtils = mapUtilsRef.current;
205
- const marker = mapUtils.markers[item.id];
206
- const position = marker?.getPosition();
207
- position && mapUtils.setCenter(position.lng, position.lat);
208
- setActiveMarkerIcon(item.id);
372
+ if (item.type == "polygon") {
373
+ // 选中态
374
+ setActivePolygon(item);
375
+ } else {
376
+ const marker = mapUtils.markers[item.id];
377
+ const position = marker?.getPosition();
378
+ position && mapUtils.setCenter(position.lng, position.lat);
379
+ setActiveMarkerIcon(item.id);
380
+ }
209
381
  }
210
382
 
211
383
  function setActiveMarkerIcon(id) {
@@ -216,55 +388,67 @@ export const LocationListPicker = observer((props) => {
216
388
  });
217
389
  }
218
390
 
219
- function setInactiveMarkerIcon(id) {
220
- mapUtilsRef.current.setMarkerIcon(id, {
221
- image: iconCircle0080ff,
222
- size: [12, 12],
223
- offset: [-6, -6],
224
- });
225
- }
226
-
227
391
  function onEdit(item, i) {
228
392
  if (isEditingRef.current) {
229
393
  message.warn("请先完成上次操作");
230
394
  return;
231
395
  }
232
- setInactiveMarkerIcon(activeId);
233
- setActiveId(item.id);
396
+ clearActive();
397
+ drawType.current = item.type || "marker";
234
398
  setShowTip(true);
399
+ mapUtilsRef.current.setCenter(item.longitude, item.latitude, { immediately: true });
400
+ clearEdit(item.id);
401
+ // 多边形清除选中态
235
402
  statusRef.current = "edit";
236
403
  currentItemRef.current = item;
237
- mapUtilsRef.current.setCenter(item.longitude, item.latitude, { immediately: true });
238
- setActiveMarkerIcon(item.id);
239
- onMapClick({
240
- lnglat: {
241
- lng: item.longitude,
242
- lat: item.latitude,
243
- },
244
- });
404
+ if (item.type == "polygon") {
405
+ setTipText("点击绘制区域 双击完成绘制");
406
+ setInactivePolygon(item);
407
+ isEditingRef.current = true;
408
+ } else {
409
+ setTipText("点击选择地址");
410
+ setActiveMarkerIcon(item.id);
411
+ onMapClick({
412
+ lnglat: {
413
+ lng: item.longitude,
414
+ lat: item.latitude,
415
+ },
416
+ });
417
+ }
245
418
  }
246
419
 
247
420
  function onDelClick(item, i) {
248
- setInactiveMarkerIcon(activeId);
249
- setActiveId(item.id);
421
+ clearActive();
422
+ drawType.current = item.type || "marker";
250
423
  mapUtilsRef.current.setCenter(item.longitude, item.latitude, { immediately: true });
251
- setActiveMarkerIcon(item.id);
424
+ if (item.type !== "polygon") {
425
+ setActiveId(item.id);
426
+ setActiveMarkerIcon(item.id);
427
+ }
252
428
  }
253
429
 
254
430
  function onDel(item, i) {
255
- const list = [...listRef.current];
256
- listRef.current?.splice(i, 1)
431
+ drawType.current = item.type || "marker";
432
+ const list = [...(listRef.current || [])];
433
+ listRef.current?.splice(i, 1);
257
434
  list?.splice(i, 1);
258
435
  onChange && onChange(list);
259
- // 清除对应的 marker
260
- mapUtilsRef.current.rmMarker(item.id);
261
- // 清除对应的 circle
262
- mapUtilsRef.current.rmCircle(item.id);
436
+ if (item.type === "polygon") {
437
+ mapUtilsRef.current.rmPolygon(item.id);
438
+ } else {
439
+ // 清除对应的 marker
440
+ mapUtilsRef.current.rmMarker(item.id);
441
+ // 清除对应的 circle
442
+ mapUtilsRef.current.rmCircle(item.id);
443
+ }
263
444
  }
264
445
 
265
446
  function onDelCancel(item, i) {
266
- setInactiveMarkerIcon(item.id);
267
- setActiveId(null);
447
+ drawType.current = item.type || "marker";
448
+ if (item.type !== "polygon") {
449
+ clearActive();
450
+ setActiveId(null);
451
+ }
268
452
  }
269
453
 
270
454
  function setPoint(lng, lat) {
@@ -287,17 +471,26 @@ export const LocationListPicker = observer((props) => {
287
471
  <div className="location-list-picker">
288
472
  <div className="map-box">
289
473
  <AMapCom init={mapInit} loading={loading} markerIconConf={markerIconConf} />
290
- <MapSearch setPoint={setPoint} isAutoSearch={isAutoSearch} />
474
+ {!readOnly && !disabled && <MapSearch setPoint={setPoint} isAutoSearch={isAutoSearch} />}
291
475
  {showTip && (
292
- <Alert className="location-list-picker-notice-bar" message={"点击选择地址"} type="info" style={tipPosition} />
476
+ <Alert className="location-list-picker-notice-bar" message={tipText} type="info" style={tipPosition} />
477
+ )}
478
+ {hasPolygon && !readOnly && (
479
+ <Button className="add-polygon-btn" onClick={onDrawClick} disabled={disabled}>
480
+ 新增区域
481
+ </Button>
482
+ )}
483
+ {hasPoint !== false && !readOnly && (
484
+ <Button className="add-btn" onClick={onAddClick} disabled={disabled}>
485
+ 新增地址
486
+ </Button>
293
487
  )}
294
- <Button className="add-btn" onClick={onAddClick}>
295
- 新增地址
296
- </Button>
297
488
  <Popup ref={popupRef} {...popupProps} />
298
489
  </div>
299
490
  <AddrList
300
491
  {...listProps}
492
+ readOnly={readOnly}
493
+ disabled={disabled}
301
494
  mapUtilsRef={mapUtilsRef}
302
495
  activeId={activeId}
303
496
  list={value}