zy-react-library 1.0.178 → 1.1.0

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 (33) hide show
  1. package/components/Cascader/Area/index.d.ts +1 -1
  2. package/components/Cascader/Industry/index.d.ts +1 -1
  3. package/components/FormBuilder/FormBuilder.d.ts +2 -2
  4. package/components/FormBuilder/FormBuilder.js +25 -19
  5. package/components/FormBuilder/FormItemsRenderer.d.ts +5 -5
  6. package/components/FormBuilder/FormItemsRenderer.js +1 -1
  7. package/components/HeaderBack/index.d.ts +2 -4
  8. package/components/HeaderBack/index.js +2 -2
  9. package/components/HeaderBack/index.less +1 -1
  10. package/components/HiddenInfo/gwj/index.d.ts +0 -2
  11. package/components/HiddenInfo/gwj/index.js +379 -375
  12. package/components/Map/MapSelector.js +2 -0
  13. package/components/Map/index.js +2 -0
  14. package/components/Page/index.d.ts +30 -0
  15. package/components/Page/index.js +49 -0
  16. package/components/Pdf/index.d.ts +1 -1
  17. package/components/Pdf/index.js +12 -8
  18. package/components/PreviewImg/index.js +3 -1
  19. package/components/PreviewPdf/index.js +2 -0
  20. package/components/Search/index.js +48 -46
  21. package/components/Select/Personnel/Gwj/index.js +1 -1
  22. package/components/SelectCreate/index.d.ts +1 -1
  23. package/components/SelectCreate/index.js +2 -0
  24. package/components/Signature/index.d.ts +2 -2
  25. package/components/Signature/index.js +2 -0
  26. package/components/Table/index.d.ts +6 -4
  27. package/components/Table/index.js +52 -7
  28. package/components/Table/index.less +2 -1
  29. package/components/TooltipPreviewImg/index.js +2 -0
  30. package/components/Upload/index.d.ts +1 -1
  31. package/components/Upload/index.js +2 -2
  32. package/css/common.less +31 -0
  33. package/package.json +2 -1
@@ -249,4 +249,6 @@ const MapSelector = (props) => {
249
249
  );
250
250
  };
251
251
 
252
+ MapSelector.displayName = "MapSelector";
253
+
252
254
  export default MapSelector;
@@ -72,4 +72,6 @@ const Map = (props) => {
72
72
  );
73
73
  };
74
74
 
75
+ Map.displayName = "Map";
76
+
75
77
  export default Map;
@@ -0,0 +1,30 @@
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
+ /** 自定义底部操作按钮组 */
22
+ customActionButtons?: ReactNode;
23
+ /** 额外底部操作按钮组 */
24
+ extraActionButtons?: ReactNode;
25
+ }
26
+
27
+ /** 页面布局组件 */
28
+ declare const Page: FC<PageProps>;
29
+
30
+ export default Page;
@@ -0,0 +1,49 @@
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
+ customActionButtons,
17
+ extraActionButtons,
18
+ } = props;
19
+
20
+ return (
21
+ <div className="page">
22
+ {(isShowAllAction && isShowHeader) && <HeaderBack title={headerTitle} history={history} previous={headerPrevious} />}
23
+ <div style={{ padding: 20 }}>
24
+ {props.children}
25
+ </div>
26
+ {
27
+ (isShowAllAction && isShowFooter) && (
28
+ <>
29
+ <div style={{ height: "52px" }}></div>
30
+ <div style={{ textAlign: "center", backgroundColor: "rgb(241, 241, 242)", margin: "0 -20px", padding: "10px 0", position: "fixed", bottom: "0", width: "100%" }}>
31
+ {customActionButtons || (
32
+ <Space>
33
+ {extraActionButtons}
34
+ <Button onClick={() => history?.goBack?.() || window.history.back()}>
35
+ {backButtonText}
36
+ </Button>
37
+ </Space>
38
+ )}
39
+ </div>
40
+ </>
41
+ )
42
+ }
43
+ </div>
44
+ );
45
+ }
46
+
47
+ Page.displayName = "Page";
48
+
49
+ export default Page;
@@ -9,7 +9,7 @@ export interface PdfProps {
9
9
  visible?: boolean;
10
10
  /** 关闭弹窗的方法 */
11
11
  onCancel?: () => void;
12
- /** 是否使用内联模式,true为不使用弹窗,默认为false */
12
+ /** 是否使用内联模式,true为不使用弹窗,默认 false */
13
13
  inline?: boolean;
14
14
  /** 内联模式下的样式 */
15
15
  style?: CSSProperties;
@@ -110,14 +110,16 @@ function Pdf(props) {
110
110
  >
111
111
  关闭
112
112
  </Button>,
113
- !loading && <Button
114
- key="fullScreen"
115
- onClick={() => {
116
- isFullscreen ? exitFullscreen() : enterFullscreen();
117
- }}
118
- >
119
- {isFullscreen ? "退出全屏" : "全屏"}
120
- </Button>,
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((item) => (
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;
@@ -81,4 +81,6 @@ const PreviewPdf = (props) => {
81
81
  return null;
82
82
  };
83
83
 
84
+ PreviewPdf.displayName = "PreviewPdf";
85
+
84
86
  export default PreviewPdf;
@@ -83,54 +83,56 @@ const Search = (props) => {
83
83
  };
84
84
 
85
85
  return (
86
- <Form
87
- form={form}
88
- labelCol={labelCol}
89
- initialValues={values}
90
- {...restProps}
91
- >
92
- <Row className={classNameRef.current}>
93
- <FormItemsRenderer
94
- options={options}
95
- labelCol={labelCol}
96
- span={6}
97
- collapse={collapse}
98
- useAutoGenerateRequired={false}
99
- initialValues={values}
100
- />
101
- <Col span={showCollapseButton ? (collapse ? 6 : span) : span}>
102
- <Form.Item label=" " labelCol={{ span: 2 }} colon={false} style={{ textAlign: "right" }}>
103
- {showSearchButton && (
104
- <Button type="primary" icon={<SearchIcon />} onClick={handleSubmit}>
105
- {searchText}
106
- </Button>
107
- )}
108
- {showResetButton && (
109
- <Button style={{ marginLeft: 8 }} icon={<ResetIcon />} onClick={handleReset}>
110
- {resetText}
111
- </Button>
112
- )}
113
- {showCollapseButton && (
114
- <Button
115
- type="link"
116
- icon={collapse ? <DownOutlined /> : <UpOutlined />}
117
- onClick={toggleCollapse}
118
- style={{ marginLeft: 8 }}
119
- >
120
- {collapse ? "展开" : "收起"}
121
- </Button>
122
- )}
123
- </Form.Item>
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
- </Row>
133
- </Form>
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
 
@@ -12,7 +12,7 @@ function PersonnelSelect(props) {
12
12
  isNeedCorpInfoId = false,
13
13
  isNeedDepartmentId = true,
14
14
  isNeedPostId = false,
15
- extraParams= {
15
+ extraParams = {
16
16
  noMain: "",
17
17
  eqEmploymentFlag: 1,
18
18
  },
@@ -13,7 +13,7 @@ export interface SelectCreateOption {
13
13
  export interface SelectCreateProps extends SelectProps {
14
14
  /** 选项列表 */
15
15
  items: SelectCreateOption[];
16
- /** 是否显示删除图标,默认为 true */
16
+ /** 是否显示删除图标,默认 true */
17
17
  showDelete?: boolean;
18
18
  /** 标签名称,用于占位符显示 */
19
19
  label?: string;
@@ -50,4 +50,6 @@ function SelectCreate(props) {
50
50
  );
51
51
  }
52
52
 
53
+ SelectCreate.displayName = "SelectCreate";
54
+
53
55
  export default SelectCreate;
@@ -12,9 +12,9 @@ export interface SignatureValue {
12
12
  export interface SignatureProps {
13
13
  /** 确认签字回调 */
14
14
  onConfirm: (value: SignatureValue) => void;
15
- /** 签字区域宽度,默认为 752 */
15
+ /** 签字区域宽度,默认 752 */
16
16
  width?: number;
17
- /** 签字区域高度,默认为 300 */
17
+ /** 签字区域高度,默认 300 */
18
18
  height?: number;
19
19
  /** 回显的签字图片 */
20
20
  url?: string;
@@ -89,4 +89,6 @@ function Signature(props) {
89
89
  );
90
90
  }
91
91
 
92
+ Signature.displayName = "Signature";
93
+
92
94
  export default Signature;
@@ -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, 'columns'> & ProTableProps<DataSource, U, ValueType> & {
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
- /** 是否使用居中布局,默认 true */
18
- useAlignCenter?: boolean;
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
- useAlignCenter = true,
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
- const setAlign = (column) => ({
18
- align: useAlignCenter ? "center" : "left",
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 <TablePro rowKey={rowKey} columns={calcColumns()} bordered {...restProps} />;
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;
@@ -9,5 +9,6 @@
9
9
  }
10
10
 
11
11
  .@{ant-prefix}-pro-table-list-toolbar-container {
12
- padding-block: 16px !important;
12
+ padding-top: 26px !important;
13
+ padding-bottom: 16px;
13
14
  }
@@ -22,4 +22,6 @@ const TooltipPreviewImg = (props) => {
22
22
  );
23
23
  };
24
24
 
25
+ TooltipPreviewImg.displayName = "TooltipPreviewImg";
26
+
25
27
  export default TooltipPreviewImg;
@@ -17,7 +17,7 @@ export interface UploadProps extends Omit<AntUploadProps, "fileList"> {
17
17
  tipContent?: ReactNode;
18
18
  /** listType 为 text 时上传按钮文本 */
19
19
  uploadButtonText?: string;
20
- /** 要上传的文件类型,默认为 image */
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) => {
@@ -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.0.178",
4
+ "version": "1.1.0",
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",