zy-react-library 1.4.0 → 1.4.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.
|
@@ -3,7 +3,7 @@ import type { FormItemProps, Rule } from "antd/es/form";
|
|
|
3
3
|
import type { FormListFieldData } from "antd/es/form/FormList";
|
|
4
4
|
import type { Gutter } from "antd/es/grid/row";
|
|
5
5
|
import type { NamePath } from "rc-field-form/lib/interface";
|
|
6
|
-
import type { CSSProperties, ReactElement, ReactNode } from "react";
|
|
6
|
+
import type { CSSProperties, Key, ReactElement, ReactNode } from "react";
|
|
7
7
|
import type { FORM_ITEM_RENDER_TYPE_MAP } from "../../enum/formItemRender";
|
|
8
8
|
import type { DeepPartial } from "./FormBuilder";
|
|
9
9
|
|
|
@@ -98,7 +98,7 @@ export interface FormOptionBase<
|
|
|
98
98
|
Dependencies = NamePath<Values>,
|
|
99
99
|
> {
|
|
100
100
|
/** React 需要的 key,如果传递了唯一的 name,则不需要 */
|
|
101
|
-
key?:
|
|
101
|
+
key?: Key;
|
|
102
102
|
/** 表单项字段名 */
|
|
103
103
|
name?: Name;
|
|
104
104
|
/** 表单项标签 */
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import type { CSSProperties, FC } from "react";
|
|
2
|
-
|
|
3
|
-
export interface PdfProps {
|
|
4
|
-
/** pdf 文件地址 */
|
|
5
|
-
file: string;
|
|
6
|
-
/** pdf 文件名 */
|
|
7
|
-
name?: string;
|
|
8
|
-
/** 是否显示弹窗 */
|
|
9
|
-
visible?: boolean;
|
|
10
|
-
/** 弹窗的标题,默认 ”PDF预览“ */
|
|
11
|
-
title?: string;
|
|
12
|
-
/** 关闭弹窗的方法 */
|
|
13
|
-
onCancel?: () => void;
|
|
14
|
-
/** 是否使用内联模式,true为不使用弹窗,默认 false */
|
|
15
|
-
inline?: boolean;
|
|
16
|
-
/** 内联模式下的样式 */
|
|
17
|
-
style?: CSSProperties;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import type { CSSProperties, FC, ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export interface PdfProps {
|
|
4
|
+
/** pdf 文件地址 */
|
|
5
|
+
file: string;
|
|
6
|
+
/** pdf 文件名 */
|
|
7
|
+
name?: string;
|
|
8
|
+
/** 是否显示弹窗 */
|
|
9
|
+
visible?: boolean;
|
|
10
|
+
/** 弹窗的标题,默认 ”PDF预览“ */
|
|
11
|
+
title?: string;
|
|
12
|
+
/** 关闭弹窗的方法 */
|
|
13
|
+
onCancel?: () => void;
|
|
14
|
+
/** 是否使用内联模式,true为不使用弹窗,默认 false */
|
|
15
|
+
inline?: boolean;
|
|
16
|
+
/** 内联模式下的样式 */
|
|
17
|
+
style?: CSSProperties;
|
|
18
|
+
/** 弹窗底部额外的按钮 */
|
|
19
|
+
extraButtons?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
declare const Pdf: FC<PdfProps>;
|
|
23
|
+
|
|
24
|
+
export default Pdf;
|
package/components/Pdf/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useFullscreen as e}from"ahooks";import{Modal as r,Button as o,Spin as i,message as n}from"antd";import{useState as t,useRef as l}from"react";import{pdfjs as a,Document as d,Page as s}from"react-pdf";import c from"../../hooks/useDownloadFile/index.js";import{getFileUrl as p}from"../../utils/index.js";import"react-pdf/dist/Page/AnnotationLayer.css";import"react-pdf/dist/Page/TextLayer.css";import"./index.less";import{jsx as m,Fragment as f}from"react/jsx-runtime";function h(h){const{visible:u=!1,onCancel:x,file:g,name:v,inline:y=!1,title:w="PDF预览",style:k={}}=h,
|
|
1
|
+
import{useFullscreen as e}from"ahooks";import{Modal as r,Button as o,Spin as i,message as n}from"antd";import{useState as t,useRef as l}from"react";import{pdfjs as a,Document as d,Page as s}from"react-pdf";import c from"../../hooks/useDownloadFile/index.js";import{getFileUrl as p}from"../../utils/index.js";import"react-pdf/dist/Page/AnnotationLayer.css";import"react-pdf/dist/Page/TextLayer.css";import"./index.less";import{jsx as m,Fragment as f}from"react/jsx-runtime";function h(h){const{visible:u=!1,onCancel:x,file:g,name:v,inline:y=!1,title:w="PDF预览",style:k={},extraButtons:C}=h,j=p(),[F,P]=t(0),[b,L]=t(600),S=l(null),[D,{enterFullscreen:A,exitFullscreen:B}]=e(S),{downloadFile:N}=c();a.GlobalWorkerOptions.workerSrc=`//unpkg.com/pdfjs-dist@${a.version}/build/pdf.worker.min.mjs`;const W=({numPages:e})=>{P(e)},$=()=>{n.error("加载 PDF 文件失败"),x&&x()},z=({width:e})=>{L(e)},E=()=>m(f,{children:m("div",{style:{height:D?"calc(100vh - 40px - 24px - 8px - 32px - 12px)":"72vh",overflowY:"auto",padding:"24px",...k},children:m(d,{file:g.includes(j)?g:j+g,onLoadSuccess:W,onLoadError:$,loading:m("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"65vh"},children:m(i,{size:"large"})}),children:Array.from({length:F}).map((e,r)=>m(s,{pageNumber:r+1,onLoadSuccess:z},`page_${r+1}`))})})});return y?E():m("div",{ref:S,children:m(r,{style:{top:D?0:100,maxWidth:D?"100vw":"calc(100vw - 32px)",paddingBottom:D?0:24},open:u,maskClosable:!1,width:D?"100vw":b+100,title:w,onCancel:()=>{D&&B(),x()},getContainer:!1,footer:[m(o,{onClick:()=>{D&&B(),x()},children:"关闭"},"cancel"),m(o,{onClick:()=>{D?B():A()},children:D?"退出全屏":"全屏"},"fullScreen"),m(o,{type:"primary",onClick:()=>{D&&B(),N({url:g,name:v})},children:"下载"},"download"),...C||[]],children:E()})})}h.displayName="Pdf";export{h as default};
|
|
@@ -1,11 +1,33 @@
|
|
|
1
|
-
import type { ProTableProps } from "@ant-design/pro-
|
|
2
|
-
import type { TableProps as AntdTableProps } from "antd";
|
|
1
|
+
import type { ProColumns, ProTableProps } from "@ant-design/pro-components";
|
|
2
|
+
import type { TableProps as AntdTableProps, TableColumnType } from "antd";
|
|
3
3
|
import type { FC } from "react";
|
|
4
4
|
|
|
5
|
+
/** 保留 Ant Design 推导的嵌套元组路径,移除宽泛字符串和普通数组 */
|
|
6
|
+
type StrictTableDataIndex<DataIndex> = DataIndex extends string
|
|
7
|
+
? never
|
|
8
|
+
: DataIndex extends readonly unknown[]
|
|
9
|
+
? number extends DataIndex["length"] ? never : DataIndex
|
|
10
|
+
: DataIndex extends number ? DataIndex : never;
|
|
11
|
+
|
|
12
|
+
/** 表格字段索引,支持一级字段和嵌套字段路径提示 */
|
|
13
|
+
export type TableDataIndex<DataSource>
|
|
14
|
+
= | Extract<keyof DataSource, string | number>
|
|
15
|
+
| StrictTableDataIndex<NonNullable<TableColumnType<DataSource>["dataIndex"]>>;
|
|
16
|
+
|
|
17
|
+
/** 表格列配置 */
|
|
18
|
+
export type TableColumn<DataSource, ValueType = "text"> = Omit<ProColumns<DataSource, ValueType>, "children" | "dataIndex"> & {
|
|
19
|
+
/** 当前列对应的数据字段 */
|
|
20
|
+
dataIndex?: TableDataIndex<DataSource>;
|
|
21
|
+
/** 多级表头子列 */
|
|
22
|
+
children?: TableColumn<DataSource, ValueType>[];
|
|
23
|
+
};
|
|
24
|
+
|
|
5
25
|
/**
|
|
6
|
-
*
|
|
26
|
+
* Table 组件属性
|
|
7
27
|
*/
|
|
8
|
-
export type TableProps<DataSource, U, ValueType> = Omit<AntdTableProps
|
|
28
|
+
export type TableProps<DataSource, U = Record<string, unknown>, ValueType = "text"> = Omit<AntdTableProps<DataSource>, "columns"> & Omit<ProTableProps<DataSource, U, ValueType>, "columns"> & {
|
|
29
|
+
/** 表格列配置 */
|
|
30
|
+
columns: TableColumn<DataSource, ValueType>[];
|
|
9
31
|
/** 当一个路由下存在多个表格的情况下 需要给每一个表格设置一个唯一存储索引 若没有设置则使用默认索引,请注意缓存数据会被覆盖 */
|
|
10
32
|
storeIndex?: string;
|
|
11
33
|
/** 是否禁用内容区滚动,默认 false */
|
|
@@ -25,5 +47,5 @@ export type TableProps<DataSource, U, ValueType> = Omit<AntdTableProps, "columns
|
|
|
25
47
|
/**
|
|
26
48
|
* 表格组件
|
|
27
49
|
*/
|
|
28
|
-
declare const Table: <DataSource, U, ValueType = "text">(props: TableProps<DataSource, U, ValueType>) => ReturnType<FC>;
|
|
50
|
+
declare const Table: <DataSource, U = Record<string, unknown>, ValueType = "text">(props: TableProps<DataSource, U, ValueType>) => ReturnType<FC>;
|
|
29
51
|
export default Table;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zy-react-library",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "",
|
|
7
7
|
"author": "LiuJiaNan",
|
|
@@ -72,5 +72,9 @@
|
|
|
72
72
|
"antd": ">=5.27.6 <6",
|
|
73
73
|
"react": ">=18.3.1 <19",
|
|
74
74
|
"zy-react-data": ">=1.0.0"
|
|
75
|
+
},
|
|
76
|
+
"publishConfig": {
|
|
77
|
+
"access": "public",
|
|
78
|
+
"registry": "https://registry.npmjs.org/"
|
|
75
79
|
}
|
|
76
80
|
}
|