zy-react-library 1.1.0 → 1.1.2

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 (76) hide show
  1. package/README.md +5 -1
  2. package/components/Cascader/Area/index.js +11 -11
  3. package/components/Cascader/Basic/index.js +23 -30
  4. package/components/Cascader/Dictionary/index.js +42 -42
  5. package/components/Cascader/Industry/index.js +12 -11
  6. package/components/Editor/index.js +43 -63
  7. package/components/FormBuilder/FormBuilder.js +97 -87
  8. package/components/FormBuilder/FormItemsRenderer.js +579 -581
  9. package/components/FormBuilder/index.js +5 -3
  10. package/components/HeaderBack/index.js +39 -32
  11. package/components/HiddenInfo/gwj/index.js +507 -439
  12. package/components/Icon/AddIcon/index.js +6 -6
  13. package/components/Icon/BackIcon/index.js +6 -6
  14. package/components/Icon/DeleteIcon/index.js +6 -6
  15. package/components/Icon/DownloadIcon/index.js +6 -6
  16. package/components/Icon/EditIcon/index.js +6 -6
  17. package/components/Icon/ExportIcon/index.js +6 -6
  18. package/components/Icon/ImportIcon/index.js +6 -6
  19. package/components/Icon/LocationIcon/index.js +6 -6
  20. package/components/Icon/PrintIcon/index.js +6 -6
  21. package/components/Icon/ResetIcon/index.js +6 -6
  22. package/components/Icon/SearchIcon/index.js +6 -6
  23. package/components/Icon/VideoIcon/index.js +6 -6
  24. package/components/Icon/ViewIcon/index.js +6 -6
  25. package/components/ImportFile/index.js +94 -91
  26. package/components/LeftTree/Area/index.js +15 -15
  27. package/components/LeftTree/Basic/index.js +54 -65
  28. package/components/LeftTree/Department/Gwj/index.js +29 -32
  29. package/components/LeftTree/Dictionary/index.js +42 -42
  30. package/components/Map/MapSelector.js +280 -254
  31. package/components/Map/index.js +90 -77
  32. package/components/Page/index.d.ts +2 -0
  33. package/components/Page/index.js +44 -34
  34. package/components/Pdf/index.js +92 -90
  35. package/components/PreviewImg/index.js +26 -32
  36. package/components/PreviewPdf/index.js +78 -86
  37. package/components/Search/index.js +147 -141
  38. package/components/Select/Basic/index.js +70 -76
  39. package/components/Select/Dictionary/index.js +42 -42
  40. package/components/Select/Personnel/Gwj/index.js +45 -49
  41. package/components/SelectCreate/index.js +33 -40
  42. package/components/SelectTree/Area/index.js +11 -17
  43. package/components/SelectTree/Basic/index.js +105 -102
  44. package/components/SelectTree/Department/Gwj/index.js +40 -46
  45. package/components/SelectTree/Dictionary/index.js +42 -42
  46. package/components/SelectTree/HiddenLevel/Gwj/index.js +33 -35
  47. package/components/SelectTree/HiddenPart/Gwj/index.js +16 -19
  48. package/components/SelectTree/Industry/index.js +12 -18
  49. package/components/Signature/index.js +68 -62
  50. package/components/Table/index.js +77 -73
  51. package/components/Table/index.less +7 -1
  52. package/components/TooltipPreviewImg/index.js +28 -27
  53. package/components/Upload/index.js +229 -275
  54. package/components/Video/AliPlayer.js +182 -160
  55. package/components/Video/index.js +71 -90
  56. package/css/common.less +4 -0
  57. package/enum/dictionary/index.js +5 -3
  58. package/enum/formItemRender/index.js +37 -35
  59. package/enum/hidden/gwj/index.js +65 -26
  60. package/enum/uploadFile/gwj/index.js +166 -84
  61. package/hooks/useDeleteFile/index.js +24 -30
  62. package/hooks/useDictionary/index.js +28 -30
  63. package/hooks/useDownloadBlob/index.js +78 -77
  64. package/hooks/useDownloadFile/index.js +76 -79
  65. package/hooks/useGetFile/index.js +32 -32
  66. package/hooks/useGetUrlQuery/index.js +1 -2
  67. package/hooks/useGetUserInfo/index.js +19 -26
  68. package/hooks/useIdle/index.js +9 -11
  69. package/hooks/useImportFile/index.js +30 -28
  70. package/hooks/useIsExistenceDuplicateSelection/index.js +25 -18
  71. package/hooks/useTable/index.js +49 -38
  72. package/hooks/useUploadFile/index.js +142 -147
  73. package/hooks/useUrlQueryCriteria/index.js +20 -13
  74. package/package.json +14 -1
  75. package/regular/index.js +34 -39
  76. package/utils/index.js +515 -511
@@ -1,254 +1,280 @@
1
- import { Button, Col, Form, Input, Modal, Row, Select, Spin } from "antd";
2
- import { useEffect, useRef, useState } from "react";
3
- import { dynamicLoadJs } from "../../utils";
4
-
5
- /**
6
- * 定位组件弹窗
7
- */
8
- const MapSelector = (props) => {
9
- const {
10
- visible,
11
- onClose,
12
- longitude,
13
- latitude,
14
- onConfirm,
15
- area = "",
16
- showArea = false,
17
- disable = false,
18
- } = props;
19
-
20
- const mapContainerRef = useRef(null);
21
- const mapInstanceRef = useRef(null);
22
- const local = useRef(null);
23
- const [loading, setLoading] = useState(false);
24
- const [currentLongitude, setCurrentLongitude] = useState(longitude || "");
25
- const [currentLatitude, setCurrentLatitude] = useState(latitude || "");
26
- const [localSearch, setLocalSearch] = useState("");
27
- const [currentArea, setCurrentArea] = useState("");
28
-
29
- // 当外部经纬度变化时,更新内部状态
30
- useEffect(() => {
31
- setCurrentLongitude(longitude || "");
32
- setCurrentLatitude(latitude || "");
33
- setCurrentArea(area || "");
34
- }, [longitude, latitude, area]);
35
-
36
- // 初始化地图
37
- const initMap = async () => {
38
- if (!window.BMapGL) {
39
- await dynamicLoadJs("https://api.map.baidu.com/api?v=1.0&type=webgl&ak=OElqFYoKiAH8KFtph8ftLKF5NlNrbCUr&callback=initialize");
40
- }
41
-
42
- setLoading(true);
43
-
44
- // 确保DOM已经渲染
45
- await new Promise(resolve => setTimeout(resolve, 100));
46
-
47
- if (mapContainerRef.current) {
48
- // 只有在没有地图实例时才创建新地图
49
- if (!mapInstanceRef.current) {
50
- const map = new window.BMapGL.Map(mapContainerRef.current);
51
- mapInstanceRef.current = map;
52
-
53
- map.centerAndZoom(
54
- new window.BMapGL.Point(
55
- longitude || "119.69457721306945",
56
- latitude || "39.940504336846665",
57
- ),
58
- 16,
59
- );
60
-
61
- map.enableScrollWheelZoom(true);
62
-
63
- // 如果有初始坐标,添加标记
64
- if (longitude && latitude) {
65
- const point = new window.BMapGL.Point(longitude, latitude);
66
- const marker = new window.BMapGL.Marker(point);
67
- map.addOverlay(marker);
68
- }
69
-
70
- // 添加点击事件
71
- if (!disable) {
72
- map.addEventListener("click", (event) => {
73
- map.clearOverlays();
74
- const point = new window.BMapGL.Point(event.latlng.lng, event.latlng.lat);
75
- const marker = new window.BMapGL.Marker(point);
76
- map.addOverlay(marker);
77
- setCurrentLatitude(event.latlng.lat);
78
- setCurrentLongitude(event.latlng.lng);
79
- });
80
- }
81
- }
82
-
83
- setLoading(false);
84
- }
85
- };
86
-
87
- // 搜索功能
88
- const handleLocalSearch = () => {
89
- if (localSearch && mapInstanceRef.current) {
90
- local.current = new window.BMapGL.LocalSearch(mapInstanceRef.current, {
91
- renderOptions: { map: mapInstanceRef.current },
92
- });
93
- local.current.search(localSearch);
94
- }
95
- };
96
-
97
- // 清空
98
- const handleLocalClear = () => {
99
- setLocalSearch("");
100
- if (mapInstanceRef.current) {
101
- local.current.search("");
102
- }
103
- };
104
-
105
- // 关闭弹窗
106
- const handleClose = () => {
107
- setLocalSearch("");
108
- if (onClose)
109
- onClose();
110
- };
111
-
112
- // 确认选择
113
- const handleConfirm = () => {
114
- if (onConfirm) {
115
- onConfirm(currentLongitude, currentLatitude, { area: currentArea });
116
- }
117
- handleClose();
118
- };
119
-
120
- // 监听visible变化
121
- useEffect(() => {
122
- let initTimer;
123
-
124
- if (visible) {
125
- // 延迟初始化地图,确保DOM完全渲染
126
- initTimer = setTimeout(() => {
127
- initMap();
128
- }, 100);
129
- }
130
-
131
- return () => {
132
- if (initTimer) {
133
- clearTimeout(initTimer);
134
- }
135
- };
136
- }, [visible]);
137
-
138
- const handleAfterClose = () => {
139
- if (mapInstanceRef.current) {
140
- try {
141
- mapInstanceRef.current.clearOverlays();
142
- mapInstanceRef.current.destroy();
143
- mapInstanceRef.current = null;
144
- }
145
- catch (e) {
146
- console.warn("Error destroying map on unmount:", e);
147
- }
148
- mapInstanceRef.current = null;
149
- }
150
- };
151
-
152
- // 组件卸载时清理地图
153
- useEffect(() => {
154
- return () => {
155
- handleAfterClose();
156
- };
157
- }, []);
158
-
159
- return (
160
- <Modal
161
- open={visible}
162
- title="坐标"
163
- onCancel={handleClose}
164
- width={1000}
165
- destroyOnHidden={false}
166
- maskClosable={false}
167
- afterClose={handleAfterClose}
168
- footer={[
169
- <Button key="back" onClick={handleClose}>
170
- 取消
171
- </Button>,
172
- !disable && (
173
- <Button key="submit" type="primary" onClick={handleConfirm}>
174
- 确定
175
- </Button>
176
- ),
177
- ]}
178
- >
179
- <Form labelAlign="right" labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
180
- {
181
- showArea && (
182
- <Row gutter={24}>
183
- <Col span={12}>
184
- <Form.Item label="所属区域">
185
- <Select value={currentArea} onChange={e => setCurrentArea(e)} allowClear>
186
- <Select.Option value="1">东港区</Select.Option>
187
- <Select.Option value="2">西港区</Select.Option>
188
- </Select>
189
- </Form.Item>
190
- </Col>
191
- </Row>
192
- )
193
- }
194
- {
195
- !disable && (
196
- <Row gutter={24}>
197
- <Col span={12}>
198
- <Form.Item label="关键字搜索">
199
- <Input value={localSearch} onChange={e => setLocalSearch(e.target.value)} allowClear />
200
- </Form.Item>
201
- </Col>
202
- <Col span={12}>
203
- <Form.Item label=" " colon={false} style={{ textAlign: "right" }}>
204
- <Button type="primary" onClick={handleLocalSearch}>
205
- 搜索
206
- </Button>
207
- <Button onClick={handleLocalClear} style={{ marginLeft: 8 }}>
208
- 重置
209
- </Button>
210
- </Form.Item>
211
- </Col>
212
- </Row>
213
- )
214
- }
215
- <Row gutter={24}>
216
- <Col span={12}>
217
- <Form.Item label="经度">
218
- <Input disabled value={currentLongitude} />
219
- </Form.Item>
220
- </Col>
221
- <Col span={12}>
222
- <Form.Item label="纬度">
223
- <Input disabled value={currentLatitude} />
224
- </Form.Item>
225
- </Col>
226
- </Row>
227
- </Form>
228
- <div
229
- ref={mapContainerRef}
230
- style={{ width: "100%", height: "500px", position: "relative" }}
231
- >
232
- <Spin size="large" tip="地图正在加载中..." spinning={loading}>
233
- <div style={{
234
- position: "absolute",
235
- top: 0,
236
- left: 0,
237
- right: 0,
238
- bottom: 0,
239
- display: "flex",
240
- justifyContent: "center",
241
- alignItems: "center",
242
- backgroundColor: "rgba(0, 0, 0, 0.5)",
243
- zIndex: 1000,
244
- }}
245
- />
246
- </Spin>
247
- </div>
248
- </Modal>
249
- );
250
- };
251
-
252
- MapSelector.displayName = "MapSelector";
253
-
254
- export default MapSelector;
1
+ import { Modal, Form, Row, Col, Select, Input, Button, Spin } from 'antd';
2
+ import { useRef, useState, useEffect } from 'react';
3
+ import { dynamicLoadJs } from '../../utils/index.js';
4
+ import { jsxs, jsx } from 'react/jsx-runtime';
5
+
6
+ const MapSelector = props => {
7
+ const {
8
+ visible,
9
+ onClose,
10
+ longitude,
11
+ latitude,
12
+ onConfirm,
13
+ area = "",
14
+ showArea = false,
15
+ disable = false
16
+ } = props;
17
+ const mapContainerRef = useRef(null);
18
+ const mapInstanceRef = useRef(null);
19
+ const local = useRef(null);
20
+ const [loading, setLoading] = useState(false);
21
+ const [currentLongitude, setCurrentLongitude] = useState(longitude || "");
22
+ const [currentLatitude, setCurrentLatitude] = useState(latitude || "");
23
+ const [localSearch, setLocalSearch] = useState("");
24
+ const [currentArea, setCurrentArea] = useState("");
25
+
26
+ // 当外部经纬度变化时,更新内部状态
27
+ useEffect(() => {
28
+ setCurrentLongitude(longitude || "");
29
+ setCurrentLatitude(latitude || "");
30
+ setCurrentArea(area || "");
31
+ }, [longitude, latitude, area]);
32
+
33
+ // 初始化地图
34
+ const initMap = async () => {
35
+ if (!window.BMapGL) {
36
+ if (window?.base?.loadDynamicResource) {
37
+ await window.base.loadDynamicResource({
38
+ url: "https://api.map.baidu.com/api?v=1.0&type=webgl&ak=OElqFYoKiAH8KFtph8ftLKF5NlNrbCUr&callback=initialize",
39
+ type: "script"
40
+ });
41
+ } else {
42
+ await dynamicLoadJs("https://api.map.baidu.com/api?v=1.0&type=webgl&ak=OElqFYoKiAH8KFtph8ftLKF5NlNrbCUr&callback=initialize");
43
+ }
44
+ }
45
+ setLoading(true);
46
+
47
+ // 确保DOM已经渲染
48
+ await new Promise(resolve => setTimeout(resolve, 100));
49
+ if (mapContainerRef.current) {
50
+ // 只有在没有地图实例时才创建新地图
51
+ if (!mapInstanceRef.current) {
52
+ const map = new window.BMapGL.Map(mapContainerRef.current);
53
+ mapInstanceRef.current = map;
54
+ map.centerAndZoom(new window.BMapGL.Point(longitude || "119.69457721306945", latitude || "39.940504336846665"), 16);
55
+ map.enableScrollWheelZoom(true);
56
+
57
+ // 如果有初始坐标,添加标记
58
+ if (longitude && latitude) {
59
+ const point = new window.BMapGL.Point(longitude, latitude);
60
+ const marker = new window.BMapGL.Marker(point);
61
+ map.addOverlay(marker);
62
+ }
63
+
64
+ // 添加点击事件
65
+ if (!disable) {
66
+ map.addEventListener("click", event => {
67
+ map.clearOverlays();
68
+ const point = new window.BMapGL.Point(event.latlng.lng, event.latlng.lat);
69
+ const marker = new window.BMapGL.Marker(point);
70
+ map.addOverlay(marker);
71
+ setCurrentLatitude(event.latlng.lat);
72
+ setCurrentLongitude(event.latlng.lng);
73
+ });
74
+ }
75
+ }
76
+ setLoading(false);
77
+ }
78
+ };
79
+
80
+ // 搜索功能
81
+ const handleLocalSearch = () => {
82
+ if (localSearch && mapInstanceRef.current) {
83
+ local.current = new window.BMapGL.LocalSearch(mapInstanceRef.current, {
84
+ renderOptions: {
85
+ map: mapInstanceRef.current
86
+ }
87
+ });
88
+ local.current.search(localSearch);
89
+ }
90
+ };
91
+
92
+ // 清空
93
+ const handleLocalClear = () => {
94
+ setLocalSearch("");
95
+ if (mapInstanceRef.current) {
96
+ local.current.search("");
97
+ }
98
+ };
99
+
100
+ // 关闭弹窗
101
+ const handleClose = () => {
102
+ setLocalSearch("");
103
+ if (onClose) onClose();
104
+ };
105
+
106
+ // 确认选择
107
+ const handleConfirm = () => {
108
+ if (onConfirm) {
109
+ onConfirm(currentLongitude, currentLatitude, {
110
+ area: currentArea
111
+ });
112
+ }
113
+ handleClose();
114
+ };
115
+
116
+ // 监听visible变化
117
+ useEffect(() => {
118
+ let initTimer;
119
+ if (visible) {
120
+ // 延迟初始化地图,确保DOM完全渲染
121
+ initTimer = setTimeout(() => {
122
+ initMap();
123
+ }, 100);
124
+ }
125
+ return () => {
126
+ if (initTimer) {
127
+ clearTimeout(initTimer);
128
+ }
129
+ };
130
+ }, [visible]);
131
+ const handleAfterClose = () => {
132
+ if (mapInstanceRef.current) {
133
+ try {
134
+ mapInstanceRef.current.clearOverlays();
135
+ mapInstanceRef.current.destroy();
136
+ mapInstanceRef.current = null;
137
+ } catch (e) {
138
+ console.warn("Error destroying map on unmount:", e);
139
+ }
140
+ mapInstanceRef.current = null;
141
+ }
142
+ };
143
+
144
+ // 组件卸载时清理地图
145
+ useEffect(() => {
146
+ return () => {
147
+ handleAfterClose();
148
+ };
149
+ }, []);
150
+ return /*#__PURE__*/jsxs(Modal, {
151
+ open: visible,
152
+ title: "\u5750\u6807",
153
+ onCancel: handleClose,
154
+ width: 1000,
155
+ destroyOnHidden: false,
156
+ maskClosable: false,
157
+ afterClose: handleAfterClose,
158
+ footer: [/*#__PURE__*/jsx(Button, {
159
+ onClick: handleClose,
160
+ children: "\u53D6\u6D88"
161
+ }, "back"), !disable && /*#__PURE__*/jsx(Button, {
162
+ type: "primary",
163
+ onClick: handleConfirm,
164
+ children: "\u786E\u5B9A"
165
+ }, "submit")],
166
+ children: [/*#__PURE__*/jsxs(Form, {
167
+ labelAlign: "right",
168
+ labelCol: {
169
+ span: 6
170
+ },
171
+ wrapperCol: {
172
+ span: 18
173
+ },
174
+ children: [showArea && /*#__PURE__*/jsx(Row, {
175
+ gutter: 24,
176
+ children: /*#__PURE__*/jsx(Col, {
177
+ span: 12,
178
+ children: /*#__PURE__*/jsx(Form.Item, {
179
+ label: "\u6240\u5C5E\u533A\u57DF",
180
+ children: /*#__PURE__*/jsxs(Select, {
181
+ value: currentArea,
182
+ onChange: e => setCurrentArea(e),
183
+ allowClear: true,
184
+ children: [/*#__PURE__*/jsx(Select.Option, {
185
+ value: "1",
186
+ children: "\u4E1C\u6E2F\u533A"
187
+ }), /*#__PURE__*/jsx(Select.Option, {
188
+ value: "2",
189
+ children: "\u897F\u6E2F\u533A"
190
+ })]
191
+ })
192
+ })
193
+ })
194
+ }), !disable && /*#__PURE__*/jsxs(Row, {
195
+ gutter: 24,
196
+ children: [/*#__PURE__*/jsx(Col, {
197
+ span: 12,
198
+ children: /*#__PURE__*/jsx(Form.Item, {
199
+ label: "\u5173\u952E\u5B57\u641C\u7D22",
200
+ children: /*#__PURE__*/jsx(Input, {
201
+ value: localSearch,
202
+ onChange: e => setLocalSearch(e.target.value),
203
+ allowClear: true
204
+ })
205
+ })
206
+ }), /*#__PURE__*/jsx(Col, {
207
+ span: 12,
208
+ children: /*#__PURE__*/jsxs(Form.Item, {
209
+ label: " ",
210
+ colon: false,
211
+ style: {
212
+ textAlign: "right"
213
+ },
214
+ children: [/*#__PURE__*/jsx(Button, {
215
+ type: "primary",
216
+ onClick: handleLocalSearch,
217
+ children: "\u641C\u7D22"
218
+ }), /*#__PURE__*/jsx(Button, {
219
+ onClick: handleLocalClear,
220
+ style: {
221
+ marginLeft: 8
222
+ },
223
+ children: "\u91CD\u7F6E"
224
+ })]
225
+ })
226
+ })]
227
+ }), /*#__PURE__*/jsxs(Row, {
228
+ gutter: 24,
229
+ children: [/*#__PURE__*/jsx(Col, {
230
+ span: 12,
231
+ children: /*#__PURE__*/jsx(Form.Item, {
232
+ label: "\u7ECF\u5EA6",
233
+ children: /*#__PURE__*/jsx(Input, {
234
+ disabled: true,
235
+ value: currentLongitude
236
+ })
237
+ })
238
+ }), /*#__PURE__*/jsx(Col, {
239
+ span: 12,
240
+ children: /*#__PURE__*/jsx(Form.Item, {
241
+ label: "\u7EAC\u5EA6",
242
+ children: /*#__PURE__*/jsx(Input, {
243
+ disabled: true,
244
+ value: currentLatitude
245
+ })
246
+ })
247
+ })]
248
+ })]
249
+ }), /*#__PURE__*/jsx("div", {
250
+ ref: mapContainerRef,
251
+ style: {
252
+ width: "100%",
253
+ height: "500px",
254
+ position: "relative"
255
+ },
256
+ children: /*#__PURE__*/jsx(Spin, {
257
+ size: "large",
258
+ tip: "\u5730\u56FE\u6B63\u5728\u52A0\u8F7D\u4E2D...",
259
+ spinning: loading,
260
+ children: /*#__PURE__*/jsx("div", {
261
+ style: {
262
+ position: "absolute",
263
+ top: 0,
264
+ left: 0,
265
+ right: 0,
266
+ bottom: 0,
267
+ display: "flex",
268
+ justifyContent: "center",
269
+ alignItems: "center",
270
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
271
+ zIndex: 1000
272
+ }
273
+ })
274
+ })
275
+ })]
276
+ });
277
+ };
278
+ MapSelector.displayName = "MapSelector";
279
+
280
+ export { MapSelector as default };