@hzab/form-render 1.6.4 → 1.6.6

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,6 +1,15 @@
1
+ # @hzab/form-render@1.6.6
2
+
3
+ fix: 修复 LocationListPicker 组件在编辑时第一次无法正确渲染的 bug。
4
+
5
+ # @hzab/form-render@1.6.5
6
+
7
+ fix: 修复 LocationListPicker 组件在编辑时第一次无法正确渲染的 bug。
8
+ feat: LocationPicker 渲染时增加范围
9
+
1
10
  # @hzab/form-render@1.6.3
2
11
 
3
- fix: 修复LocationListPicker组件的Pupup弹窗在某些时候漂移的bug。
12
+ fix: 修复 LocationListPicker 组件的 Pupup 弹窗在某些时候漂移的 bug。
4
13
 
5
14
  # @hzab/form-render@1.6.2
6
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hzab/form-render",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
4
4
  "description": "",
5
5
  "main": "src",
6
6
  "scripts": {
@@ -48,7 +48,7 @@ export const LocationListPicker = observer((props) => {
48
48
  const currentItemRef = useRef();
49
49
  const popupRef = useRef();
50
50
  const isEditingRef = useRef();
51
- const mapBoxRef = useRef(null)
51
+ const mapBoxRef = useRef(null);
52
52
 
53
53
  useEffect(() => {
54
54
  return () => {
@@ -60,6 +60,7 @@ export const LocationListPicker = observer((props) => {
60
60
  }, []);
61
61
 
62
62
  useEffect(() => {
63
+ listRef.current = value || [];
63
64
  if (!Array.isArray(value) || value?.length == 0 || !mapUtilsRef.current) {
64
65
  return;
65
66
  }
@@ -69,7 +70,6 @@ export const LocationListPicker = observer((props) => {
69
70
  it.id = nanoid();
70
71
  }
71
72
  });
72
- listRef.current = value || [];
73
73
  renderMarker();
74
74
  }, [value]);
75
75
 
@@ -11,18 +11,20 @@
11
11
  }
12
12
  */
13
13
  export function getPropsValue(value = {}, opt) {
14
- const { lonKey = "longitude", latKey = "latitude", addrKey = "address", pointsKey = "points" } = opt || {};
14
+ const { lonKey = "longitude", latKey = "latitude", addrKey = "address", pointsKey = "points", rangeKey = "range" } = opt || {};
15
15
 
16
16
  let lon = value[lonKey];
17
17
  let lat = value[latKey];
18
18
  let addr = value[addrKey];
19
19
  let points = value[pointsKey];
20
+ let range = value[rangeKey];
20
21
 
21
22
  const res = {
22
23
  lon,
23
24
  lat,
24
25
  addr,
25
- points
26
+ points,
27
+ range
26
28
  };
27
29
  return res;
28
30
  }
@@ -38,6 +38,7 @@ export const ModalContent = observer((props: any) => {
38
38
  latKey = "latitude",
39
39
  addrKey = "address",
40
40
  pointsKey = "points",
41
+ rangeKey = "range",
41
42
  value,
42
43
  // 搜索框是否自动搜索
43
44
  isAutoSearch = true,
@@ -63,8 +64,9 @@ export const ModalContent = observer((props: any) => {
63
64
  latKey,
64
65
  addrKey,
65
66
  pointsKey,
67
+ rangeKey
66
68
  }),
67
- [lonKey, latKey, addrKey, pointsKey, value, value?.[pointsKey], value?.[lonKey], value?.[latKey], value?.[addrKey]],
69
+ [lonKey, latKey, addrKey, pointsKey,rangeKey, value, value?.[rangeKey], value?.[pointsKey], value?.[lonKey], value?.[latKey], value?.[addrKey]],
68
70
  );
69
71
 
70
72
  const [loading, setLoading] = useState(props.loading || false);
@@ -167,6 +169,7 @@ export const ModalContent = observer((props: any) => {
167
169
  addr,
168
170
  lon: center[0],
169
171
  lat: center[1],
172
+ range: 0
170
173
  });
171
174
  }
172
175
  }
@@ -178,14 +181,17 @@ export const ModalContent = observer((props: any) => {
178
181
  let _lon = defaultLocation.lon;
179
182
  let _lat = defaultLocation.lat;
180
183
  let _points = defaultLocation.points;
184
+ let _range = defaultLocation.range
181
185
  if (pickInfo.lon && pickInfo.lat) {
182
186
  _lon = pickInfo.lon;
183
187
  _lat = pickInfo.lat;
184
188
  _points = pickInfo.points;
189
+ _range = pickInfo.range
185
190
  } else if (formatValRef.current?.lon && formatValRef.current?.lat) {
186
191
  _lon = formatValRef.current?.lon;
187
192
  _lat = formatValRef.current?.lat;
188
193
  _points = formatValRef.current?.points;
194
+ _range = formatValRef.current?.range;
189
195
  }
190
196
 
191
197
  setMapCenter(_lon, _lat);
@@ -211,6 +217,7 @@ export const ModalContent = observer((props: any) => {
211
217
  // 禁用、只读情况使用 marker 展示点位
212
218
  if (element === "Polypoint") {
213
219
  mapUtilsRef.current?.setPickerMarker(_lon, _lat);
220
+ mapUtilsRef.current.setCircle(_lon, _lat, _range);
214
221
  } else {
215
222
  setDrawEditor(_points, true);
216
223
  }