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,86 +1,78 @@
1
- import { Button, Space } from "antd";
2
- import { useState } from "react";
3
- import Pdf from "../Pdf";
4
-
5
- /**
6
- * 在查看页面中PDF查看组件
7
- */
8
- const PreviewPdf = (props) => {
9
- const {
10
- files = [],
11
- nameKey = "",
12
- urlKey = "",
13
- name = "",
14
- url = "",
15
- } = props;
16
-
17
- const [visible, setVisible] = useState(false);
18
- const [currentSrc, setCurrentSrc] = useState("");
19
- const [currentName, setCurrentName] = useState("");
20
-
21
- const previewPdf = (src, name) => {
22
- setVisible(true);
23
- setCurrentSrc(src);
24
- setCurrentName(name);
25
- };
26
-
27
- const onCancel = () => {
28
- setVisible(false);
29
- setCurrentSrc("");
30
- setCurrentName("");
31
- };
32
-
33
- // 单个文件预览模式
34
- if (files.length === 0 && name && url) {
35
- return (
36
- <>
37
- <Space>
38
- <span>{name}</span>
39
- <Button type="primary" size="small" onClick={() => previewPdf(url, name)}>
40
- 预览
41
- </Button>
42
- </Space>
43
- <Pdf
44
- visible={visible}
45
- file={currentSrc}
46
- name={currentName}
47
- onCancel={onCancel}
48
- />
49
- </>
50
- );
51
- }
52
-
53
- // 多文件预览模式
54
- if (files.length > 0 && !name && !url) {
55
- return (
56
- <>
57
- {files.map(item => (
58
- <div key={item.filePath || item[urlKey]} style={{ marginTop: 5 }}>
59
- <Space>
60
- <span>{item.name || item.fileName || item[nameKey]}</span>
61
- <Button
62
- type="primary"
63
- size="small"
64
- onClick={() => previewPdf(item.filePath || item[urlKey], item.name || item.fileName || item[nameKey])}
65
- >
66
- 预览
67
- </Button>
68
- </Space>
69
- </div>
70
- ))}
71
- <Pdf
72
- visible={visible}
73
- file={currentSrc}
74
- name={currentName}
75
- onCancel={onCancel}
76
- />
77
- </>
78
- );
79
- }
80
-
81
- return null;
82
- };
83
-
84
- PreviewPdf.displayName = "PreviewPdf";
85
-
86
- export default PreviewPdf;
1
+ import { Space, Button } from 'antd';
2
+ import { useState } from 'react';
3
+ import Pdf from '../Pdf/index.js';
4
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
5
+
6
+ const PreviewPdf = props => {
7
+ const {
8
+ files = [],
9
+ nameKey = "",
10
+ urlKey = "",
11
+ name = "",
12
+ url = ""
13
+ } = props;
14
+ const [visible, setVisible] = useState(false);
15
+ const [currentSrc, setCurrentSrc] = useState("");
16
+ const [currentName, setCurrentName] = useState("");
17
+ const previewPdf = (src, name) => {
18
+ setVisible(true);
19
+ setCurrentSrc(src);
20
+ setCurrentName(name);
21
+ };
22
+ const onCancel = () => {
23
+ setVisible(false);
24
+ setCurrentSrc("");
25
+ setCurrentName("");
26
+ };
27
+
28
+ // 单个文件预览模式
29
+ if (files.length === 0 && name && url) {
30
+ return /*#__PURE__*/jsxs(Fragment, {
31
+ children: [/*#__PURE__*/jsxs(Space, {
32
+ children: [/*#__PURE__*/jsx("span", {
33
+ children: name
34
+ }), /*#__PURE__*/jsx(Button, {
35
+ type: "primary",
36
+ size: "small",
37
+ onClick: () => previewPdf(url, name),
38
+ children: "\u9884\u89C8"
39
+ })]
40
+ }), /*#__PURE__*/jsx(Pdf, {
41
+ visible: visible,
42
+ file: currentSrc,
43
+ name: currentName,
44
+ onCancel: onCancel
45
+ })]
46
+ });
47
+ }
48
+
49
+ // 多文件预览模式
50
+ if (files.length > 0 && !name && !url) {
51
+ return /*#__PURE__*/jsxs(Fragment, {
52
+ children: [files.map(item => /*#__PURE__*/jsx("div", {
53
+ style: {
54
+ marginTop: 5
55
+ },
56
+ children: /*#__PURE__*/jsxs(Space, {
57
+ children: [/*#__PURE__*/jsx("span", {
58
+ children: item.name || item.fileName || item[nameKey]
59
+ }), /*#__PURE__*/jsx(Button, {
60
+ type: "primary",
61
+ size: "small",
62
+ onClick: () => previewPdf(item.filePath || item[urlKey], item.name || item.fileName || item[nameKey]),
63
+ children: "\u9884\u89C8"
64
+ })]
65
+ })
66
+ }, item.filePath || item[urlKey])), /*#__PURE__*/jsx(Pdf, {
67
+ visible: visible,
68
+ file: currentSrc,
69
+ name: currentName,
70
+ onCancel: onCancel
71
+ })]
72
+ });
73
+ }
74
+ return null;
75
+ };
76
+ PreviewPdf.displayName = "PreviewPdf";
77
+
78
+ export { PreviewPdf as default };
@@ -1,141 +1,147 @@
1
- import { DownOutlined, UpOutlined } from "@ant-design/icons";
2
- import { Button, Col, Form, Row } from "antd";
3
- import { useEffect, useRef, useState } from "react";
4
- import FormItemsRenderer from "../FormBuilder/FormItemsRenderer";
5
- import ResetIcon from "../Icon/ResetIcon";
6
- import SearchIcon from "../Icon/SearchIcon";
7
-
8
- /**
9
- * 搜索表单组件
10
- */
11
- const Search = (props) => {
12
- const {
13
- labelCol = { span: 6 },
14
- options = [],
15
- values = {},
16
- onFinish,
17
- onSubmit,
18
- onReset,
19
- searchText = "搜索",
20
- resetText = "重置",
21
- showSearchButton = true,
22
- showResetButton = true,
23
- extraButtons,
24
- form,
25
- ...restProps
26
- } = props;
27
-
28
- const [collapse, setCollapse] = useState(true);
29
- const [span, setSpan] = useState(6);
30
- const [showCollapseButton, setShowCollapseButton] = useState(false);
31
- const classNameRef = useRef(`search-${Date.now()}`);
32
-
33
- // 计算是否需要显示展开/收起按钮
34
- useEffect(() => {
35
- if (!options || options.length === 0)
36
- return;
37
-
38
- const calculateLayout = () => {
39
- const colEl = document.querySelectorAll(
40
- `.${classNameRef.current}>.${window.process.env.app.antd["ant-prefix"]}-col`,
41
- );
42
- const colElLength = colEl.length;
43
- const excludeLast = colElLength - (extraButtons ? 2 : 1);
44
-
45
- const spanMap = { 0: 24, 1: 18, 2: 12, 3: 6 };
46
- setSpan(spanMap[excludeLast % 4] || 6);
47
-
48
- setShowCollapseButton(excludeLast > 3);
49
- };
50
-
51
- // 延迟执行以确保 DOM 已渲染
52
- setTimeout(calculateLayout, 0);
53
- }, [options, extraButtons]);
54
-
55
- // 处理表单提交
56
- const handleSubmit = () => {
57
- const values = form.getFieldsValue();
58
- onFinish?.(values, "submit");
59
- onSubmit?.(values);
60
- };
61
-
62
- // 处理重置
63
- const handleReset = () => {
64
- // form.resetFields();
65
- // const values = form.getFieldsValue();
66
- // onFinish?.(values, "reset");
67
- // onReset?.(values);
68
-
69
- const currentValues = form.getFieldsValue();
70
- const resetValues = {};
71
- Object.keys(currentValues).forEach((key) => {
72
- resetValues[key] = values.hasOwnProperty(key) ? values[key] : undefined;
73
- });
74
-
75
- form.setFieldsValue(resetValues);
76
- onFinish?.(values, "reset");
77
- onReset?.(values);
78
- };
79
-
80
- // 切换展开/收起
81
- const toggleCollapse = () => {
82
- setCollapse(!collapse);
83
- };
84
-
85
- return (
86
- <div className="search-layout card-layout">
87
- <Form
88
- form={form}
89
- labelCol={labelCol}
90
- initialValues={values}
91
- {...restProps}
92
- >
93
- <Row className={classNameRef.current}>
94
- <FormItemsRenderer
95
- options={options}
96
- labelCol={labelCol}
97
- span={6}
98
- collapse={collapse}
99
- useAutoGenerateRequired={false}
100
- initialValues={values}
101
- />
102
- <Col span={showCollapseButton ? (collapse ? 6 : span) : span}>
103
- <Form.Item label=" " labelCol={{ span: 2 }} colon={false} style={{ textAlign: "right" }}>
104
- {showSearchButton && (
105
- <Button type="primary" icon={<SearchIcon />} onClick={handleSubmit}>
106
- {searchText}
107
- </Button>
108
- )}
109
- {showResetButton && (
110
- <Button style={{ marginLeft: 8 }} icon={<ResetIcon />} onClick={handleReset}>
111
- {resetText}
112
- </Button>
113
- )}
114
- {showCollapseButton && (
115
- <Button
116
- type="link"
117
- icon={collapse ? <DownOutlined /> : <UpOutlined />}
118
- onClick={toggleCollapse}
119
- style={{ marginLeft: 8 }}
120
- >
121
- {collapse ? "展开" : "收起"}
122
- </Button>
123
- )}
124
- </Form.Item>
125
- </Col>
126
- {extraButtons && (
127
- <Col span={24}>
128
- <Form.Item label=" " colon={false} labelCol={{ span: 0 }}>
129
- {extraButtons}
130
- </Form.Item>
131
- </Col>
132
- )}
133
- </Row>
134
- </Form>
135
- </div>
136
- );
137
- };
138
-
139
- Search.displayName = "Search";
140
-
141
- export default Search;
1
+ import { DownOutlined, UpOutlined } from '@ant-design/icons';
2
+ import { Form, Row, Col, Button } from 'antd';
3
+ import { useState, useRef, useEffect } from 'react';
4
+ import FormItemsRenderer from '../FormBuilder/FormItemsRenderer.js';
5
+ import ResetIcon from '../Icon/ResetIcon/index.js';
6
+ import SearchIcon from '../Icon/SearchIcon/index.js';
7
+ import { jsx, jsxs } from 'react/jsx-runtime';
8
+
9
+ const Search = props => {
10
+ const {
11
+ labelCol = {
12
+ span: 6
13
+ },
14
+ options = [],
15
+ values = {},
16
+ onFinish,
17
+ onSubmit,
18
+ onReset,
19
+ searchText = "搜索",
20
+ resetText = "重置",
21
+ showSearchButton = true,
22
+ showResetButton = true,
23
+ extraButtons,
24
+ form,
25
+ ...restProps
26
+ } = props;
27
+ const [collapse, setCollapse] = useState(true);
28
+ const [span, setSpan] = useState(6);
29
+ const [showCollapseButton, setShowCollapseButton] = useState(false);
30
+ const classNameRef = useRef(`search-${Date.now()}`);
31
+
32
+ // 计算是否需要显示展开/收起按钮
33
+ useEffect(() => {
34
+ if (!options || options.length === 0) return;
35
+ const calculateLayout = () => {
36
+ const colEl = document.querySelectorAll(`.${classNameRef.current}>.${window.process.env.app.antd["ant-prefix"]}-col`);
37
+ const colElLength = colEl.length;
38
+ const excludeLast = colElLength - (extraButtons ? 2 : 1);
39
+ const spanMap = {
40
+ 0: 24,
41
+ 1: 18,
42
+ 2: 12,
43
+ 3: 6
44
+ };
45
+ setSpan(spanMap[excludeLast % 4] || 6);
46
+ setShowCollapseButton(excludeLast > 3);
47
+ };
48
+
49
+ // 延迟执行以确保 DOM 已渲染
50
+ setTimeout(calculateLayout, 0);
51
+ }, [options, extraButtons]);
52
+
53
+ // 处理表单提交
54
+ const handleSubmit = () => {
55
+ const values = form.getFieldsValue();
56
+ onFinish?.(values, "submit");
57
+ onSubmit?.(values);
58
+ };
59
+
60
+ // 处理重置
61
+ const handleReset = () => {
62
+ // form.resetFields();
63
+ // const values = form.getFieldsValue();
64
+ // onFinish?.(values, "reset");
65
+ // onReset?.(values);
66
+
67
+ const currentValues = form.getFieldsValue();
68
+ const resetValues = {};
69
+ Object.keys(currentValues).forEach(key => {
70
+ resetValues[key] = values.hasOwnProperty(key) ? values[key] : undefined;
71
+ });
72
+ form.setFieldsValue(resetValues);
73
+ onFinish?.(values, "reset");
74
+ onReset?.(values);
75
+ };
76
+
77
+ // 切换展开/收起
78
+ const toggleCollapse = () => {
79
+ setCollapse(!collapse);
80
+ };
81
+ return /*#__PURE__*/jsx("div", {
82
+ className: "search-layout card-layout",
83
+ children: /*#__PURE__*/jsx(Form, {
84
+ form: form,
85
+ labelCol: labelCol,
86
+ initialValues: values,
87
+ ...restProps,
88
+ children: /*#__PURE__*/jsxs(Row, {
89
+ className: classNameRef.current,
90
+ children: [/*#__PURE__*/jsx(FormItemsRenderer, {
91
+ options: options,
92
+ labelCol: labelCol,
93
+ span: 6,
94
+ collapse: collapse,
95
+ useAutoGenerateRequired: false,
96
+ initialValues: values
97
+ }), /*#__PURE__*/jsx(Col, {
98
+ span: showCollapseButton ? collapse ? 6 : span : span,
99
+ children: /*#__PURE__*/jsxs(Form.Item, {
100
+ label: " ",
101
+ labelCol: {
102
+ span: 2
103
+ },
104
+ colon: false,
105
+ style: {
106
+ textAlign: "right"
107
+ },
108
+ children: [showSearchButton && /*#__PURE__*/jsx(Button, {
109
+ type: "primary",
110
+ icon: /*#__PURE__*/jsx(SearchIcon, {}),
111
+ onClick: handleSubmit,
112
+ children: searchText
113
+ }), showResetButton && /*#__PURE__*/jsx(Button, {
114
+ style: {
115
+ marginLeft: 8
116
+ },
117
+ icon: /*#__PURE__*/jsx(ResetIcon, {}),
118
+ onClick: handleReset,
119
+ children: resetText
120
+ }), showCollapseButton && /*#__PURE__*/jsx(Button, {
121
+ type: "link",
122
+ icon: collapse ? /*#__PURE__*/jsx(DownOutlined, {}) : /*#__PURE__*/jsx(UpOutlined, {}),
123
+ onClick: toggleCollapse,
124
+ style: {
125
+ marginLeft: 8
126
+ },
127
+ children: collapse ? "展开" : "收起"
128
+ })]
129
+ })
130
+ }), extraButtons && /*#__PURE__*/jsx(Col, {
131
+ span: 24,
132
+ children: /*#__PURE__*/jsx(Form.Item, {
133
+ label: " ",
134
+ colon: false,
135
+ labelCol: {
136
+ span: 0
137
+ },
138
+ children: extraButtons
139
+ })
140
+ })]
141
+ })
142
+ })
143
+ });
144
+ };
145
+ Search.displayName = "Search";
146
+
147
+ export { Search as default };
@@ -1,76 +1,70 @@
1
- import { Select } from "antd";
2
- import { useEffect } from "react";
3
-
4
- /**
5
- * 基础下拉组件(不建议直接使用此组件,二次继承使用)
6
- */
7
- function BasicSelect(props) {
8
- const {
9
- onGetData,
10
- onChange,
11
- onGetLabel,
12
- onGetOption,
13
- placeholder = "",
14
- data = [],
15
- nameKey = "name",
16
- idKey = "id",
17
- labelRender,
18
- ...restProps
19
- } = props;
20
-
21
- const handleChange = (event, option) => {
22
- if (Array.isArray(event)) {
23
- if (event.length > 0) {
24
- const findItems = [];
25
- const names = [];
26
- event.forEach((item) => {
27
- const findItem = data.find(dataItem => dataItem[idKey] === item);
28
- if (findItem) {
29
- findItems.push(findItem);
30
- names.push(findItem[nameKey]);
31
- }
32
- });
33
- onGetLabel?.(names);
34
- onGetOption?.(findItems);
35
- }
36
- else {
37
- onGetLabel?.([]);
38
- onGetOption?.([]);
39
- }
40
- }
41
- else {
42
- if (event) {
43
- const findItem = data.find(item => item[idKey] === event);
44
- onGetLabel?.(findItem[nameKey]);
45
- onGetOption?.(findItem);
46
- }
47
- else {
48
- onGetLabel?.("");
49
- onGetOption?.({});
50
- }
51
- }
52
- onChange?.(event, option);
53
- };
54
-
55
- useEffect(() => {
56
- onGetData?.(data);
57
- }, [data]);
58
-
59
- return (
60
- <Select placeholder={`请选择${placeholder}`} showSearch allowClear optionFilterProp="children" onChange={handleChange} {...restProps}>
61
- {data.map((item) => {
62
- const value = item[idKey];
63
- const label = labelRender ? labelRender(item) : item[nameKey];
64
- return (
65
- <Select.Option key={value} value={value}>
66
- {label}
67
- </Select.Option>
68
- );
69
- })}
70
- </Select>
71
- );
72
- }
73
-
74
- BasicSelect.displayName = "BasicSelect";
75
-
76
- export default BasicSelect;
1
+ import { Select } from 'antd';
2
+ import { useEffect } from 'react';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ function BasicSelect(props) {
6
+ const {
7
+ onGetData,
8
+ onChange,
9
+ onGetLabel,
10
+ onGetOption,
11
+ placeholder = "",
12
+ data = [],
13
+ nameKey = "name",
14
+ idKey = "id",
15
+ labelRender,
16
+ ...restProps
17
+ } = props;
18
+ const handleChange = (event, option) => {
19
+ if (Array.isArray(event)) {
20
+ if (event.length > 0) {
21
+ const findItems = [];
22
+ const names = [];
23
+ event.forEach(item => {
24
+ const findItem = data.find(dataItem => dataItem[idKey] === item);
25
+ if (findItem) {
26
+ findItems.push(findItem);
27
+ names.push(findItem[nameKey]);
28
+ }
29
+ });
30
+ onGetLabel?.(names);
31
+ onGetOption?.(findItems);
32
+ } else {
33
+ onGetLabel?.([]);
34
+ onGetOption?.([]);
35
+ }
36
+ } else {
37
+ if (event) {
38
+ const findItem = data.find(item => item[idKey] === event);
39
+ onGetLabel?.(findItem[nameKey]);
40
+ onGetOption?.(findItem);
41
+ } else {
42
+ onGetLabel?.("");
43
+ onGetOption?.({});
44
+ }
45
+ }
46
+ onChange?.(event, option);
47
+ };
48
+ useEffect(() => {
49
+ onGetData?.(data);
50
+ }, [data]);
51
+ return /*#__PURE__*/jsx(Select, {
52
+ placeholder: `请选择${placeholder}`,
53
+ showSearch: true,
54
+ allowClear: true,
55
+ optionFilterProp: "children",
56
+ onChange: handleChange,
57
+ ...restProps,
58
+ children: data.map(item => {
59
+ const value = item[idKey];
60
+ const label = labelRender ? labelRender(item) : item[nameKey];
61
+ return /*#__PURE__*/jsx(Select.Option, {
62
+ value: value,
63
+ children: label
64
+ }, value);
65
+ })
66
+ });
67
+ }
68
+ BasicSelect.displayName = "BasicSelect";
69
+
70
+ export { BasicSelect as default };