zy-react-library 1.4.7 → 1.4.9

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.
@@ -23,6 +23,8 @@ export interface DescriptionsProps<DataSource = Record<string, any>> extends Omi
23
23
  emptyText?: ReactNode;
24
24
  /** 是否加载中,默认 false */
25
25
  loading?: boolean;
26
+ /** 是否展示边框,默认 true */
27
+ bordered?: boolean;
26
28
  }
27
29
 
28
30
  /**
@@ -1 +1 @@
1
- import{Spin as e,Descriptions as t}from"antd";import{get as r}from"lodash-es";import{isEmpty as n}from"../../utils/index.js";import{jsx as i}from"react/jsx-runtime";const o=o=>{const{dataSource:s={},items:a=[],emptyText:l="-",loading:m=!1,column:d=2,styles:c,...p}=o,u=a.map((e,t)=>{const{dataIndex:i,hidden:o,render:a,emptyText:m,...d}=e;if("function"==typeof o?o(s):o)return null;const c=((e,t)=>{if(void 0!==t)return r(e,t)})(s,i),p=a?a(c,s,t):c;return{...d,key:d.key??(Array.isArray(i)?i.join("."):i)??t,children:n(p)?m??l:p}}).filter(Boolean);return i(e,{spinning:m,children:i(t,{...p,column:d,items:u,styles:{...c,label:{width:200,...c?.label}}})})};o.displayName="Descriptions";export{o as default};
1
+ import{Spin as e,Descriptions as r}from"antd";import{get as t}from"lodash-es";import{isEmpty as n}from"../../utils/index.js";import{jsx as i}from"react/jsx-runtime";const o=o=>{const{dataSource:s={},items:d=[],emptyText:a="-",loading:l=!1,bordered:m=!0,column:c=2,styles:p,...u}=o,f=d.map((e,r)=>{const{dataIndex:i,hidden:o,render:d,emptyText:l,...m}=e;if("function"==typeof o?o(s):o)return null;const c=((e,r)=>{if(void 0!==r)return t(e,r)})(s,i),p=d?d(c,s,r):c;return{...m,key:m.key??(Array.isArray(i)?i.join("."):i)??r,children:n(p)?l??a:p}}).filter(Boolean);return i(e,{spinning:l,children:i(r,{...u,bordered:m,column:c,items:f,styles:{...p,label:{width:200,...p?.label}}})})};o.displayName="Descriptions";export{o as default};
@@ -1 +1 @@
1
- import{useFullscreen as e}from"ahooks";import{Modal as t,Button as r,Spin as o,message as n}from"antd";import{useState as i,useRef as l}from"react";import{pdfjs as a,Document as c,Page as s}from"react-pdf";import d 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:w,inline:y=!1,title:v="PDF预览",style:k={},extraButtons:b,usePrint:C=!1}=h,L=p(),j=g.includes(L)?g:L+g,[P,F]=i(0),[D,R]=i(600),S=l(null),[U,{enterFullscreen:E,exitFullscreen:O}]=e(S),{downloadFile:W}=d();a.GlobalWorkerOptions.workerSrc=`//unpkg.com/pdfjs-dist@${a.version}/build/pdf.worker.min.mjs`;const A=({numPages:e})=>{F(e)},B=()=>{n.error("加载 PDF 文件失败"),x&&x()},N=({width:e})=>{R(e)},T=()=>m(f,{children:m("div",{style:{height:U?"calc(100vh - 40px - 24px - 8px - 32px - 12px)":"72vh",overflowY:"auto",padding:"24px",...k},children:m(c,{file:j,onLoadSuccess:A,onLoadError:B,loading:m("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"65vh"},children:m(o,{size:"large"})}),children:Array.from({length:P}).map((e,t)=>m(s,{pageNumber:t+1,onLoadSuccess:N},`page_${t+1}`))})})});return y?T():m("div",{ref:S,children:m(t,{style:{top:U?0:100,maxWidth:U?"100vw":"calc(100vw - 32px)",paddingBottom:U?0:24},open:u,maskClosable:!1,width:U?"100vw":D+100,title:v,onCancel:()=>{U&&O(),x()},getContainer:!1,footer:[m(r,{onClick:()=>{U&&O(),x()},children:"关闭"},"cancel"),m(r,{onClick:()=>{U?O():E()},children:U?"退出全屏":"全屏"},"fullScreen"),m(r,{type:"primary",onClick:()=>{U&&O(),W({url:g,name:w})},children:"下载"},"download"),C&&m(r,{type:"primary",onClick:async()=>{const e=window.open("","_blank");if(e)try{const t=await fetch(j);if(!t.ok)return void n.error("获取 PDF 文件失败");const r=URL.createObjectURL(await t.blob()),o=e.document.createElement("iframe");o.style.cssText="position:fixed;inset:0;width:100%;height:100%;border:0",o.onload=()=>{const t=o.contentWindow;t.addEventListener("afterprint",()=>{URL.revokeObjectURL(r),e.close()},{once:!0}),t.focus(),t.print()},o.src=r,e.document.body.appendChild(o)}catch(t){e.close(),n.error(t.message||"打印失败,请稍后重试")}else n.warning("请允许弹出窗口后重试")},children:"打印"},"print"),...b||[]],children:T()})})}h.displayName="Pdf";export{h as default};
1
+ import{useFullscreen as e}from"ahooks";import{Modal as r,Button as t,Spin as o,message as n}from"antd";import{useState as i,useRef as a}from"react";import{pdfjs as l,Document as c,Page as d}from"react-pdf";import s 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:g,file:x,name:y,inline:v=!1,title:w="PDF预览",style:k={},extraButtons:b,usePrint:C=!1}=h,L=p(),j=x.includes(L)?x:L+x,[P,F]=i(0),[D,R]=i(600),S=a(null),[U,{enterFullscreen:E,exitFullscreen:O}]=e(S),{downloadFile:W}=s();l.GlobalWorkerOptions.workerSrc=`//unpkg.com/pdfjs-dist@${l.version}/build/pdf.worker.min.mjs`;const A=({numPages:e})=>{F(e)},B=()=>{n.error("加载 PDF 文件失败"),g&&g()},N=({width:e})=>{R(e)},T=()=>m(f,{children:m("div",{style:{height:U?"calc(100vh - 40px - 24px - 8px - 32px - 12px)":"72vh",overflowY:"auto",padding:"24px",...k},children:m(c,{file:j,onLoadSuccess:A,onLoadError:B,loading:m("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"65vh"},children:m(o,{size:"large"})}),children:Array.from({length:P}).map((e,r)=>m(d,{pageNumber:r+1,onLoadSuccess:N},`page_${r+1}`))})})});return v?T():m("div",{ref:S,children:m(r,{style:{top:U?0:100,maxWidth:U?"100vw":"calc(100vw - 32px)",paddingBottom:U?0:24},open:u,maskClosable:!1,width:U?"100vw":D+100,title:w,onCancel:()=>{U&&O(),g()},getContainer:!1,footer:[m(t,{onClick:()=>{U&&O(),g()},children:"关闭"},"cancel"),m(t,{onClick:()=>{U?O():E()},children:U?"退出全屏":"全屏"},"fullScreen"),m(t,{type:"primary",onClick:()=>{U&&O(),W({url:x,name:y})},children:"下载"},"download"),C&&m(t,{type:"primary",onClick:async()=>{try{const e=await fetch(j);if(!e.ok)return void n.warning("获取 PDF 文件失败");const r=URL.createObjectURL(await e.blob()),t=document.createElement("iframe");t.style.cssText="position:fixed;width:0;height:0;border:0",t.onload=()=>{const e=t.contentWindow,o=()=>{URL.revokeObjectURL(r),t.remove()};e.addEventListener("afterprint",o,{once:!0});try{e.focus(),e.print()}catch(e){o(),n.error(e.message||"打印失败,请稍后重试")}},t.src=r,document.body.appendChild(t)}catch(e){n.error(e.message||"打印失败,请稍后重试")}},children:"打印"},"print"),...b||[]],children:T()})})}h.displayName="Pdf";export{h as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zy-react-library",
3
3
  "private": false,
4
- "version": "1.4.7",
4
+ "version": "1.4.9",
5
5
  "type": "module",
6
6
  "description": "",
7
7
  "author": "LiuJiaNan",