zy-react-library 1.0.11 → 1.0.13

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,18 @@
1
+ import type { FC, ReactNode } from "react";
2
+
3
+ export interface HeaderBackProps {
4
+ /** 标题 */
5
+ title: ReactNode;
6
+ /** 历史记录对象,用于返回上一页,默认使用 window.history.back */
7
+ history?: {
8
+ goBack?: () => void;
9
+ [key: string]: any;
10
+ };
11
+ /** 是否显示返回按钮,默认为 true */
12
+ previous?: boolean;
13
+ }
14
+
15
+ /** 头部返回组件 */
16
+ declare const HeaderBack: FC<HeaderBackProps>;
17
+
18
+ export default HeaderBack;
@@ -0,0 +1,35 @@
1
+ import { ArrowLeftOutlined } from "@ant-design/icons";
2
+ import { Divider } from "antd";
3
+ import "./index.less";
4
+
5
+ /**
6
+ * 头部返回组件
7
+ */
8
+ function HeaderBack(props) {
9
+ const { title, history, previous = true } = props;
10
+
11
+ return (
12
+ <div className="header-back">
13
+ <div className="action">
14
+ {
15
+ previous
16
+ && (
17
+ <>
18
+ <div
19
+ className="back"
20
+ onClick={() => history?.goBack?.() || window.history.back()}
21
+ >
22
+ <ArrowLeftOutlined style={{ fontSize: 14 }} />
23
+ <span>返回</span>
24
+ </div>
25
+ <Divider type="vertical" style={{ backgroundColor: "#dcdfe6", marginLeft: 15, marginRight: 15 }} />
26
+ </>
27
+ )
28
+ }
29
+ <div className="title">{title}</div>
30
+ </div>
31
+ </div>
32
+ );
33
+ }
34
+
35
+ export default HeaderBack;
@@ -0,0 +1,21 @@
1
+ .header-back {
2
+ padding: 10px 20px;
3
+ border-bottom: 1px solid #dcdfe6;
4
+
5
+ .action {
6
+ display: flex;
7
+ align-items: center;
8
+
9
+ .back {
10
+ display: flex;
11
+ align-items: center;
12
+ gap: 10px;
13
+ cursor: pointer;
14
+ font-size: 14px;
15
+ }
16
+
17
+ .title {
18
+ font-size: 17px;
19
+ }
20
+ }
21
+ }
@@ -1,13 +1,18 @@
1
1
  import { Button, Col, Form, Input, Modal, Row, Spin } from "antd";
2
2
  import { useEffect, useRef, useState } from "react";
3
3
 
4
- const MapSelector = ({
5
- visible,
6
- onClose,
7
- longitude,
8
- latitude,
9
- onConfirm, // 新增确认回调
10
- }) => {
4
+ /**
5
+ * 定位组件弹窗
6
+ */
7
+ const MapSelector = (props) => {
8
+ const {
9
+ visible,
10
+ onClose,
11
+ longitude,
12
+ latitude,
13
+ onConfirm,
14
+ } = props;
15
+
11
16
  const mapContainerRef = useRef(null);
12
17
  const mapInstanceRef = useRef(null);
13
18
  const [loading, setLoading] = useState(false);
@@ -2,6 +2,9 @@ import { Button, Col, Form, Input, Row } from "antd";
2
2
  import { useState } from "react";
3
3
  import MapSelector from "./MapSelector";
4
4
 
5
+ /**
6
+ * 定位组件
7
+ */
5
8
  const Map = (props) => {
6
9
  const {
7
10
  longitudeProps = "longitude",
@@ -3,6 +3,9 @@ import { useState } from "react";
3
3
  import { Document, Page, pdfjs } from "react-pdf";
4
4
  import { getFileUrl } from "../../utils/index";
5
5
 
6
+ /**
7
+ * PDF查看组件
8
+ */
6
9
  function Pdf(props) {
7
10
  const {
8
11
  visible = false,
@@ -1,8 +1,12 @@
1
1
  import { Image } from "antd";
2
2
  import { getFileUrl } from "../../utils/index";
3
3
 
4
+ /**
5
+ * 在查看页面中图片预览组件
6
+ */
4
7
  const PreviewImg = (props) => {
5
8
  const { files = [], fileUrlKey = "filePath" } = props;
9
+
6
10
  const fileUrl = getFileUrl();
7
11
 
8
12
  return (
@@ -2,6 +2,9 @@ import { Button, Space } from "antd";
2
2
  import { useState } from "react";
3
3
  import Pdf from "../Pdf";
4
4
 
5
+ /**
6
+ * 在查看页面中PDF查看组件
7
+ */
5
8
  const PreviewPdf = (props) => {
6
9
  const {
7
10
  files = [],
@@ -8,7 +8,7 @@ import FormItemsRenderer from "../FormBuilder/FormItemsRenderer";
8
8
  */
9
9
  const Search = (props) => {
10
10
  const {
11
- labelCol = { span: 4 },
11
+ labelCol = { span: 6 },
12
12
  options = [],
13
13
  values,
14
14
  onFinish,
@@ -9,6 +9,7 @@ function TablePro(props) {
9
9
  rowKey = 'id',
10
10
  ...restProps
11
11
  } = props;
12
+
12
13
  const storeIndex = props.storeIndex || `${window.process.env.app.antd["ant-prefix"]}_${Math.random().toString(36).substring(2)}`;
13
14
  function calcColumns() {
14
15
  showIndex && columns.unshift(getIndexColumn(props.pagination));
@@ -1,6 +1,9 @@
1
1
  import { Tag, Tooltip } from "antd";
2
- import PreviewImg from "~/components/PreviewImg";
2
+ import PreviewImg from "../PreviewImg";
3
3
 
4
+ /**
5
+ * 在表格组件中图片查看组件
6
+ */
4
7
  const TooltipPreviewImg = (props) => {
5
8
  const { files = [], fileUrlKey = "filePath" } = props;
6
9
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zy-react-library",
3
3
  "private": false,
4
- "version": "1.0.11",
4
+ "version": "1.0.13",
5
5
  "type": "module",
6
6
  "description": "",
7
7
  "author": "LiuJiaNan",