zy-react-library 1.0.95 → 1.0.97

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.
@@ -0,0 +1,6 @@
1
+ import type { AntdIconProps } from "@ant-design/icons/lib/components/AntdIcon";
2
+ import type { FC } from "react";
3
+
4
+ declare const LocationIcon: FC<AntdIconProps>;
5
+
6
+ export default LocationIcon;
@@ -0,0 +1,9 @@
1
+ import { EnvironmentOutlined } from "@ant-design/icons";
2
+
3
+ const LocationIcon = props => (
4
+ <EnvironmentOutlined {...props} />
5
+ );
6
+
7
+ LocationIcon.displayName = "LocationIcon";
8
+
9
+ export default LocationIcon;
@@ -22,6 +22,8 @@ export interface MapSelectorProps {
22
22
  area?: string;
23
23
  /** 是否显示所属区域 */
24
24
  showArea?: boolean;
25
+ /** 是否只查看 */
26
+ disable?: boolean;
25
27
  /** 确认选择回调 */
26
28
  onConfirm?: (longitude: number | string, latitude: number | string, extra: { area: string }) => void;
27
29
  }
@@ -13,6 +13,7 @@ const MapSelector = (props) => {
13
13
  onConfirm,
14
14
  area = "",
15
15
  showArea = false,
16
+ disable = false,
16
17
  } = props;
17
18
 
18
19
  const mapContainerRef = useRef(null);
@@ -66,14 +67,16 @@ const MapSelector = (props) => {
66
67
  }
67
68
 
68
69
  // 添加点击事件
69
- map.addEventListener("click", (event) => {
70
- map.clearOverlays();
71
- const point = new window.BMapGL.Point(event.latlng.lng, event.latlng.lat);
72
- const marker = new window.BMapGL.Marker(point);
73
- map.addOverlay(marker);
74
- setCurrentLatitude(event.latlng.lat);
75
- setCurrentLongitude(event.latlng.lng);
76
- });
70
+ if (!disable) {
71
+ map.addEventListener("click", (event) => {
72
+ map.clearOverlays();
73
+ const point = new window.BMapGL.Point(event.latlng.lng, event.latlng.lat);
74
+ const marker = new window.BMapGL.Marker(point);
75
+ map.addOverlay(marker);
76
+ setCurrentLatitude(event.latlng.lat);
77
+ setCurrentLongitude(event.latlng.lng);
78
+ });
79
+ }
77
80
  }
78
81
 
79
82
  setLoading(false);
@@ -149,10 +152,19 @@ const MapSelector = (props) => {
149
152
  open={visible}
150
153
  title="坐标"
151
154
  onCancel={handleClose}
152
- onOk={handleConfirm}
153
155
  width={1000}
154
156
  destroyOnHidden={false}
155
157
  afterClose={handleAfterClose}
158
+ footer={[
159
+ <Button key="back" onClick={handleClose}>
160
+ 取消
161
+ </Button>,
162
+ !disable && (
163
+ <Button key="submit" type="primary" onClick={handleConfirm}>
164
+ 确定
165
+ </Button>
166
+ ),
167
+ ]}
156
168
  >
157
169
  <Form labelAlign="right" labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
158
170
  {
@@ -169,20 +181,24 @@ const MapSelector = (props) => {
169
181
  </Row>
170
182
  )
171
183
  }
172
- <Row gutter={24}>
173
- <Col span={12}>
174
- <Form.Item label="关键字搜索">
175
- <Input value={localSearch} onChange={e => setLocalSearch(e.target.value)} allowClear />
176
- </Form.Item>
177
- </Col>
178
- <Col span={12}>
179
- <Form.Item label=" " colon={false}>
180
- <Button type="primary" onClick={handleLocalSearch}>
181
- 搜索
182
- </Button>
183
- </Form.Item>
184
- </Col>
185
- </Row>
184
+ {
185
+ !disable && (
186
+ <Row gutter={24}>
187
+ <Col span={12}>
188
+ <Form.Item label="关键字搜索">
189
+ <Input value={localSearch} onChange={e => setLocalSearch(e.target.value)} allowClear />
190
+ </Form.Item>
191
+ </Col>
192
+ <Col span={12}>
193
+ <Form.Item label=" " colon={false}>
194
+ <Button type="primary" onClick={handleLocalSearch}>
195
+ 搜索
196
+ </Button>
197
+ </Form.Item>
198
+ </Col>
199
+ </Row>
200
+ )
201
+ }
186
202
  <Row gutter={24}>
187
203
  <Col span={12}>
188
204
  <Form.Item label="经度">
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zy-react-library",
3
3
  "private": false,
4
- "version": "1.0.95",
4
+ "version": "1.0.97",
5
5
  "type": "module",
6
6
  "description": "",
7
7
  "author": "LiuJiaNan",