@hzab/form-render 1.6.5 → 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,11 +1,15 @@
1
- # @hzab/form-render@1.6.4
1
+ # @hzab/form-render@1.6.6
2
2
 
3
- fix: 修复LocationListPicker组件在编辑时第一次无法正确渲染的bug。
4
- feat: LocationPicker渲染时增加范围
3
+ fix: 修复 LocationListPicker 组件在编辑时第一次无法正确渲染的 bug。
4
+
5
+ # @hzab/form-render@1.6.5
6
+
7
+ fix: 修复 LocationListPicker 组件在编辑时第一次无法正确渲染的 bug。
8
+ feat: LocationPicker 渲染时增加范围
5
9
 
6
10
  # @hzab/form-render@1.6.3
7
11
 
8
- fix: 修复LocationListPicker组件的Pupup弹窗在某些时候漂移的bug。
12
+ fix: 修复 LocationListPicker 组件的 Pupup 弹窗在某些时候漂移的 bug。
9
13
 
10
14
  # @hzab/form-render@1.6.2
11
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hzab/form-render",
3
- "version": "1.6.5",
3
+ "version": "1.6.6",
4
4
  "description": "",
5
5
  "main": "src",
6
6
  "scripts": {
@@ -48,8 +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)
52
- const [mapInitCompleted, setMapInitCompleted] = useState(false);
51
+ const mapBoxRef = useRef(null);
53
52
 
54
53
  useEffect(() => {
55
54
  return () => {
@@ -61,8 +60,8 @@ export const LocationListPicker = observer((props) => {
61
60
  }, []);
62
61
 
63
62
  useEffect(() => {
64
-
65
- if (!Array.isArray(value) || value?.length == 0 || !mapInitCompleted) {
63
+ listRef.current = value || [];
64
+ if (!Array.isArray(value) || value?.length == 0 || !mapUtilsRef.current) {
66
65
  return;
67
66
  }
68
67
  // 处理 id
@@ -71,12 +70,11 @@ export const LocationListPicker = observer((props) => {
71
70
  it.id = nanoid();
72
71
  }
73
72
  });
74
- listRef.current = value || [];
75
- renderMarker(value);
76
- }, [value, mapInitCompleted]);
73
+ renderMarker();
74
+ }, [value]);
77
75
 
78
- function renderMarker(value = []) {
79
- (listRef.current || value)?.forEach((item) => {
76
+ function renderMarker() {
77
+ listRef.current?.forEach((item) => {
80
78
  if (item.type === "polygon") {
81
79
  mapUtilsRef.current.setPolygon({
82
80
  ...item,
@@ -107,7 +105,6 @@ export const LocationListPicker = observer((props) => {
107
105
  onClick: onPolygonClick,
108
106
  });
109
107
 
110
- mapUtils && setMapInitCompleted(true);
111
108
  renderMarker();
112
109
  mapUtilsRef.current.setFitView();
113
110
  }