zy-react-library 1.0.179 → 1.1.1
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/components/Cascader/Area/index.d.ts +1 -1
- package/components/Cascader/Industry/index.d.ts +1 -1
- package/components/FormBuilder/FormBuilder.d.ts +2 -2
- package/components/FormBuilder/FormBuilder.js +25 -19
- package/components/FormBuilder/FormItemsRenderer.d.ts +3 -3
- package/components/HeaderBack/index.d.ts +2 -4
- package/components/HeaderBack/index.js +2 -2
- package/components/HeaderBack/index.less +1 -1
- package/components/HiddenInfo/gwj/index.d.ts +0 -2
- package/components/HiddenInfo/gwj/index.js +379 -375
- package/components/Map/MapSelector.js +2 -0
- package/components/Map/index.js +2 -0
- package/components/Page/index.d.ts +32 -0
- package/components/Page/index.js +50 -0
- package/components/Pdf/index.d.ts +1 -1
- package/components/Pdf/index.js +12 -8
- package/components/PreviewImg/index.js +3 -1
- package/components/PreviewPdf/index.js +2 -0
- package/components/Search/index.js +48 -46
- package/components/Select/Personnel/Gwj/index.js +1 -1
- package/components/SelectCreate/index.d.ts +1 -1
- package/components/SelectCreate/index.js +2 -0
- package/components/Signature/index.d.ts +2 -2
- package/components/Signature/index.js +2 -0
- package/components/Table/index.d.ts +6 -4
- package/components/Table/index.js +52 -7
- package/components/Table/index.less +2 -1
- package/components/TooltipPreviewImg/index.js +2 -0
- package/components/Upload/index.d.ts +1 -1
- package/components/Upload/index.js +2 -2
- package/css/common.less +31 -0
- package/package.json +2 -1
package/components/Map/index.js
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { FC, ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export interface PageProps {
|
|
4
|
+
/** 头部返回组件的标题 */
|
|
5
|
+
headerTitle?: ReactNode;
|
|
6
|
+
/** 历史记录对象,用于返回上一页,默认使用 window.history.back */
|
|
7
|
+
history?: {
|
|
8
|
+
goBack?: () => void;
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
};
|
|
11
|
+
/** 是否显示头部组件,默认 true */
|
|
12
|
+
isShowHeader?: boolean;
|
|
13
|
+
/** 是否显示头部组件返回按钮,默认 true */
|
|
14
|
+
headerPrevious?: boolean;
|
|
15
|
+
/** 是否显示底部组件,默认 true */
|
|
16
|
+
isShowFooter?: boolean;
|
|
17
|
+
/** 是否显示头部和底部组件,默认 true */
|
|
18
|
+
isShowAllAction?: boolean;
|
|
19
|
+
/** 取消按钮文字,默认 "关闭" */
|
|
20
|
+
backButtonText?: string;
|
|
21
|
+
/** 内容区域的padding,默认 "20px" */
|
|
22
|
+
contentPadding?: string;
|
|
23
|
+
/** 自定义底部操作按钮组 */
|
|
24
|
+
customActionButtons?: ReactNode;
|
|
25
|
+
/** 额外底部操作按钮组 */
|
|
26
|
+
extraActionButtons?: ReactNode;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** 页面布局组件 */
|
|
30
|
+
declare const Page: FC<PageProps>;
|
|
31
|
+
|
|
32
|
+
export default Page;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Button, Space } from "antd";
|
|
2
|
+
import HeaderBack from "../HeaderBack";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 页面布局组件
|
|
6
|
+
*/
|
|
7
|
+
function Page(props) {
|
|
8
|
+
const {
|
|
9
|
+
headerTitle,
|
|
10
|
+
history,
|
|
11
|
+
isShowHeader = true,
|
|
12
|
+
headerPrevious = true,
|
|
13
|
+
isShowFooter = true,
|
|
14
|
+
isShowAllAction = true,
|
|
15
|
+
backButtonText = "关闭",
|
|
16
|
+
contentPadding = "20px",
|
|
17
|
+
customActionButtons,
|
|
18
|
+
extraActionButtons,
|
|
19
|
+
} = props;
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div className="page">
|
|
23
|
+
{(isShowAllAction && isShowHeader) && <HeaderBack title={headerTitle} history={history} previous={headerPrevious} />}
|
|
24
|
+
<div style={{ padding: contentPadding }}>
|
|
25
|
+
{props.children}
|
|
26
|
+
</div>
|
|
27
|
+
{
|
|
28
|
+
(isShowAllAction && isShowFooter) && (
|
|
29
|
+
<>
|
|
30
|
+
<div style={{ height: "52px" }}></div>
|
|
31
|
+
<div style={{ textAlign: "center", backgroundColor: "rgb(241, 241, 242)", margin: "0 -20px", padding: "10px 0", position: "fixed", bottom: "0", width: "100%" }}>
|
|
32
|
+
{customActionButtons || (
|
|
33
|
+
<Space>
|
|
34
|
+
{extraActionButtons}
|
|
35
|
+
<Button onClick={() => history?.goBack?.() || window.history.back()}>
|
|
36
|
+
{backButtonText}
|
|
37
|
+
</Button>
|
|
38
|
+
</Space>
|
|
39
|
+
)}
|
|
40
|
+
</div>
|
|
41
|
+
</>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
Page.displayName = "Page";
|
|
49
|
+
|
|
50
|
+
export default Page;
|
package/components/Pdf/index.js
CHANGED
|
@@ -110,14 +110,16 @@ function Pdf(props) {
|
|
|
110
110
|
>
|
|
111
111
|
关闭
|
|
112
112
|
</Button>,
|
|
113
|
-
!loading &&
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
113
|
+
!loading && (
|
|
114
|
+
<Button
|
|
115
|
+
key="fullScreen"
|
|
116
|
+
onClick={() => {
|
|
117
|
+
isFullscreen ? exitFullscreen() : enterFullscreen();
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
{isFullscreen ? "退出全屏" : "全屏"}
|
|
121
|
+
</Button>
|
|
122
|
+
),
|
|
121
123
|
<Button key="download" type="primary" onClick={onDownloadFile}>下载</Button>,
|
|
122
124
|
]}
|
|
123
125
|
>
|
|
@@ -127,4 +129,6 @@ function Pdf(props) {
|
|
|
127
129
|
);
|
|
128
130
|
}
|
|
129
131
|
|
|
132
|
+
Pdf.displayName = "Pdf";
|
|
133
|
+
|
|
130
134
|
export default Pdf;
|
|
@@ -12,7 +12,7 @@ const PreviewImg = (props) => {
|
|
|
12
12
|
return (
|
|
13
13
|
<Image.PreviewGroup>
|
|
14
14
|
{
|
|
15
|
-
files.filter(Boolean).map(
|
|
15
|
+
files.filter(Boolean).map(item => (
|
|
16
16
|
<Image
|
|
17
17
|
key={item[fileUrlKey] || item}
|
|
18
18
|
src={item[fileUrlKey] ? fileUrl + item[fileUrlKey] : fileUrl + item}
|
|
@@ -27,4 +27,6 @@ const PreviewImg = (props) => {
|
|
|
27
27
|
);
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
PreviewImg.displayName = "PreviewImg";
|
|
31
|
+
|
|
30
32
|
export default PreviewImg;
|
|
@@ -83,54 +83,56 @@ const Search = (props) => {
|
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
return (
|
|
86
|
-
<
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
<
|
|
103
|
-
{
|
|
104
|
-
|
|
105
|
-
{
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
{
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
</Col>
|
|
125
|
-
{extraButtons && (
|
|
126
|
-
<Col span={24}>
|
|
127
|
-
<Form.Item label=" " colon={false} labelCol={{ span: 0 }}>
|
|
128
|
-
{extraButtons}
|
|
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
|
+
)}
|
|
129
124
|
</Form.Item>
|
|
130
125
|
</Col>
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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>
|
|
134
136
|
);
|
|
135
137
|
};
|
|
136
138
|
|
|
@@ -13,7 +13,7 @@ export interface SelectCreateOption {
|
|
|
13
13
|
export interface SelectCreateProps extends SelectProps {
|
|
14
14
|
/** 选项列表 */
|
|
15
15
|
items: SelectCreateOption[];
|
|
16
|
-
/**
|
|
16
|
+
/** 是否显示删除图标,默认 true */
|
|
17
17
|
showDelete?: boolean;
|
|
18
18
|
/** 标签名称,用于占位符显示 */
|
|
19
19
|
label?: string;
|
|
@@ -12,9 +12,9 @@ export interface SignatureValue {
|
|
|
12
12
|
export interface SignatureProps {
|
|
13
13
|
/** 确认签字回调 */
|
|
14
14
|
onConfirm: (value: SignatureValue) => void;
|
|
15
|
-
/**
|
|
15
|
+
/** 签字区域宽度,默认 752 */
|
|
16
16
|
width?: number;
|
|
17
|
-
/**
|
|
17
|
+
/** 签字区域高度,默认 300 */
|
|
18
18
|
height?: number;
|
|
19
19
|
/** 回显的签字图片 */
|
|
20
20
|
url?: string;
|
|
@@ -5,7 +5,7 @@ import type { FC } from "react";
|
|
|
5
5
|
/**
|
|
6
6
|
* TablePro 组件属性
|
|
7
7
|
*/
|
|
8
|
-
export type TableProps<DataSource, U, ValueType> = Omit<AntdTableProps,
|
|
8
|
+
export type TableProps<DataSource, U, ValueType> = Omit<AntdTableProps, "columns"> & ProTableProps<DataSource, U, ValueType> & {
|
|
9
9
|
/** 当一个路由下存在多个表格的情况下 需要给每一个表格设置一个唯一存储索引 若没有设置则使用默认索引,请注意缓存数据会被覆盖 */
|
|
10
10
|
storeIndex?: string;
|
|
11
11
|
/** 是否禁用内容区滚动,默认 false */
|
|
@@ -14,9 +14,11 @@ export type TableProps<DataSource, U, ValueType> = Omit<AntdTableProps, 'columns
|
|
|
14
14
|
showIndexColumn?: boolean;
|
|
15
15
|
/** 索引列是否固定,默认 left */
|
|
16
16
|
indexColumnFixed?: "left" | "right" | boolean;
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
/** 列的对齐方式,默认 center */
|
|
18
|
+
align?: "left" | "right" | "center";
|
|
19
|
+
/** 超过宽度是否自动省略,默认 true */
|
|
20
|
+
ellipsis?: boolean;
|
|
21
|
+
};
|
|
20
22
|
|
|
21
23
|
/**
|
|
22
24
|
* 表格组件
|
|
@@ -1,28 +1,73 @@
|
|
|
1
1
|
import TablePro from "@cqsjjb/jjb-react-admin-component/Table";
|
|
2
2
|
import { getIndexColumn } from "../../utils/index";
|
|
3
|
+
import dayjs from 'dayjs';
|
|
3
4
|
import "./index.less";
|
|
4
5
|
|
|
6
|
+
const CLEANUP_INTERVAL_DAYS = 10; // 清理间隔天数
|
|
7
|
+
const LAST_CLEANUP_KEY = 'tableLocalStorageLastCleanup'; // 最后清理时间存储key
|
|
8
|
+
|
|
9
|
+
// 清理本地存储中特定后缀的key
|
|
10
|
+
function cleanupTableLocalStorage() {
|
|
11
|
+
const now = dayjs();
|
|
12
|
+
const lastCleanupStr = localStorage.getItem(LAST_CLEANUP_KEY);
|
|
13
|
+
const lastCleanup = lastCleanupStr ? dayjs(lastCleanupStr) : null;
|
|
14
|
+
|
|
15
|
+
// 如果没有上次清理时间或距离上次清理已超过10天
|
|
16
|
+
if (!lastCleanup || now.diff(lastCleanup, 'day') >= CLEANUP_INTERVAL_DAYS) {
|
|
17
|
+
// 查找并清理符合条件的key
|
|
18
|
+
const keysToRemove = [];
|
|
19
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
20
|
+
const key = localStorage.key(i);
|
|
21
|
+
if (key && (key.endsWith('#columnState') ||
|
|
22
|
+
key.endsWith('#size') ||
|
|
23
|
+
key.endsWith('#resizable'))) {
|
|
24
|
+
keysToRemove.push(key);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// 删除匹配的key
|
|
29
|
+
keysToRemove.forEach(key => {
|
|
30
|
+
localStorage.removeItem(key);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// 更新最后清理时间
|
|
34
|
+
localStorage.setItem(LAST_CLEANUP_KEY, now.toISOString());
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
5
38
|
function Table(props) {
|
|
6
39
|
const {
|
|
7
40
|
columns = [],
|
|
8
41
|
showIndexColumn = true,
|
|
9
|
-
|
|
42
|
+
ellipsis = true,
|
|
43
|
+
align = "center",
|
|
10
44
|
indexColumnFixed = "left",
|
|
11
45
|
rowKey = "id",
|
|
12
46
|
...restProps
|
|
13
47
|
} = props;
|
|
14
|
-
function calcColumns() {
|
|
15
|
-
showIndexColumn && columns.unshift({...getIndexColumn(props.pagination), fixed: indexColumnFixed});
|
|
16
48
|
|
|
17
|
-
|
|
18
|
-
|
|
49
|
+
// 组件初始化时执行清理
|
|
50
|
+
cleanupTableLocalStorage();
|
|
51
|
+
|
|
52
|
+
function settingColumns() {
|
|
53
|
+
showIndexColumn && columns.unshift({ ...getIndexColumn(props.pagination), fixed: indexColumnFixed });
|
|
54
|
+
|
|
55
|
+
const setAlign = column => ({
|
|
56
|
+
align,
|
|
57
|
+
ellipsis,
|
|
19
58
|
...column,
|
|
20
|
-
...(column.children ? { children: column.children.map(setAlign) } : {})
|
|
59
|
+
...(column.children ? { children: column.children.map(setAlign) } : {}),
|
|
21
60
|
});
|
|
22
61
|
|
|
23
62
|
return columns.map(setAlign);
|
|
24
63
|
}
|
|
25
|
-
return
|
|
64
|
+
return (
|
|
65
|
+
<div className="table-layout card-layout">
|
|
66
|
+
<TablePro rowKey={rowKey} columns={settingColumns()} bordered size="small" {...restProps} />
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
26
69
|
}
|
|
27
70
|
|
|
71
|
+
Table.displayName = "Table";
|
|
72
|
+
|
|
28
73
|
export default Table;
|
|
@@ -17,7 +17,7 @@ export interface UploadProps extends Omit<AntUploadProps, "fileList"> {
|
|
|
17
17
|
tipContent?: ReactNode;
|
|
18
18
|
/** listType 为 text 时上传按钮文本 */
|
|
19
19
|
uploadButtonText?: string;
|
|
20
|
-
/**
|
|
20
|
+
/** 要上传的文件类型,默认 image */
|
|
21
21
|
fileType?: "image" | "video" | "document";
|
|
22
22
|
/** 获取上传过服务器删除的附件 */
|
|
23
23
|
onGetRemoveFile?: (file: Omit<UploadFile, "originFileObj">) => void;
|
|
@@ -132,7 +132,7 @@ const Upload = (props) => {
|
|
|
132
132
|
|
|
133
133
|
const handleBeforeUpload = (file, fileList) => {
|
|
134
134
|
if (beforeUpload)
|
|
135
|
-
return beforeUpload(file, fileList)
|
|
135
|
+
return beforeUpload(file, fileList);
|
|
136
136
|
return false;
|
|
137
137
|
};
|
|
138
138
|
|
|
@@ -196,7 +196,7 @@ const Upload = (props) => {
|
|
|
196
196
|
if (!file.originFileObj)
|
|
197
197
|
onGetRemoveFile?.(file);
|
|
198
198
|
return onRemove?.(file);
|
|
199
|
-
}
|
|
199
|
+
};
|
|
200
200
|
|
|
201
201
|
// 预览文件
|
|
202
202
|
const handlePreview = (file) => {
|
package/css/common.less
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.@{ant-prefix}-modal-header {
|
|
2
|
+
border-bottom: 1px solid #ccc !important;
|
|
3
|
+
margin: 0 -24px 15px -24px !important;
|
|
4
|
+
padding: 0 24px 15px 24px !important;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.@{ant-prefix}-modal-footer {
|
|
8
|
+
text-align: center !important;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.search-layout {
|
|
12
|
+
position: relative;
|
|
13
|
+
|
|
14
|
+
&::after {
|
|
15
|
+
content: '';
|
|
16
|
+
position: absolute;
|
|
17
|
+
bottom: -10px;
|
|
18
|
+
left: -20px;
|
|
19
|
+
right: -20px;
|
|
20
|
+
height: 10px;
|
|
21
|
+
background-color: rgb(241, 241, 242);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.table-layout {
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.card-layout {
|
|
29
|
+
background-color: #fff;
|
|
30
|
+
border-radius: 6px;
|
|
31
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zy-react-library",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.1.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "",
|
|
7
7
|
"author": "LiuJiaNan",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"files": [
|
|
10
10
|
"components",
|
|
11
|
+
"css",
|
|
11
12
|
"enum",
|
|
12
13
|
"hooks",
|
|
13
14
|
"json",
|