zy-react-library 1.1.4 → 1.1.6

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.
@@ -1 +1 @@
1
- import{Spin as e,Form as t,Row as n,Col as i,Space as r,Button as o,message as s}from"antd";import{useState as l,useEffect as a}from"react";import d from"./FormItemsRenderer.js";import{jsx as u,jsxs as c,Fragment as p}from"react/jsx-runtime";const m=m=>{const{values:h,options:g,gutter:w=24,span:x=12,labelCol:b={span:4},useAutoGenerateRequired:y=!0,showActionButtons:f=!0,submitButtonText:B="提交",cancelButtonText:A="取消",showSubmitButton:C=!0,showCancelButton:T=!0,customActionButtons:v,extraActionButtons:F,loading:k=!1,...q}=m,[E,R]=l(window.innerWidth),j=()=>{const e=document.querySelector("#page");e&&R(e.offsetWidth)};return a(()=>{const e=setTimeout(()=>{j()},0);return f&&window.addEventListener("resize",j),()=>{f&&window.removeEventListener("resize",j),clearTimeout(e)}},[f]),u(e,{spinning:k,children:c(t,{labelCol:b,scrollToFirstError:!0,wrapperCol:{span:24-b.span},initialValues:h,onFinishFailed:()=>{s.error("请补全必填项")},style:{width:`calc(100% - ${2*w}px)`,margin:"0 auto"},...q,children:[u(n,{gutter:w,children:u(d,{options:g,labelCol:b,span:x,gutter:w,useAutoGenerateRequired:y,initialValues:h})}),f&&c(p,{children:[u("div",{style:{height:"32px"}}),u(n,{style:{textAlign:"center",backgroundColor:"rgb(241, 241, 242)",padding:"10px 0",position:"fixed",bottom:"0",width:E,margin:"0 -44px"},children:u(i,{span:24,style:{textAlign:"center"},children:v||c(r,{children:[C&&u(o,{type:"primary",htmlType:"submit",children:B}),F,T&&u(o,{onClick:()=>{window.history.back()},children:A})]})})})]})]})})};m.displayName="FormBuilder";export{m as default};
1
+ import{Spin as t,Form as e,Row as i,Col as n,Space as o,Button as r,message as l}from"antd";import{useState as s,useEffect as a}from"react";import{throttle as d}from"throttle-debounce";import u from"./FormItemsRenderer.js";import{jsx as c,jsxs as p}from"react/jsx-runtime";const m=m=>{const{values:h,options:g,gutter:w=24,span:x=12,labelCol:y={span:4},useAutoGenerateRequired:b=!0,showActionButtons:f=!0,submitButtonText:B="提交",cancelButtonText:v="取消",showSubmitButton:A=!0,showCancelButton:C=!0,customActionButtons:T,extraActionButtons:F,loading:k=!1,...q}=m,[z,E]=s(window.innerWidth),R=d(50,()=>{const t=document.querySelector("#page-layout");t&&E(t.offsetWidth)});return a(()=>{const t=setTimeout(()=>{R()},0);return f&&window.addEventListener("resize",R),()=>{f&&window.removeEventListener("resize",R),clearTimeout(t)}},[f]),c(t,{spinning:k,children:p(e,{labelCol:y,scrollToFirstError:!0,wrapperCol:{span:24-y.span},initialValues:h,onFinishFailed:()=>{l.error("请补全必填项")},style:{width:`calc(100% - ${2*w}px)`,margin:"0 auto"},...q,children:[c(i,{gutter:w,children:c(u,{options:g,labelCol:y,span:x,gutter:w,useAutoGenerateRequired:b,initialValues:h})}),f&&p("div",{style:{position:"relative",zIndex:"9"},children:[c("div",{style:{height:"32px"}}),c(i,{style:{textAlign:"center",backgroundColor:"rgb(241, 241, 242)",padding:"10px 0",position:"fixed",bottom:"0",width:z,margin:"0 -44px"},children:c(n,{span:24,style:{textAlign:"center"},children:T||p(o,{children:[A&&c(r,{type:"primary",htmlType:"submit",children:B}),F,C&&c(r,{onClick:()=>{window.history.back()},children:v})]})})})]})]})})};m.displayName="FormBuilder";export{m as default};
@@ -5,7 +5,7 @@
5
5
  position: sticky;
6
6
  top: 0;
7
7
  background-color: #fff;
8
- z-index: 1;
8
+ z-index: 9;
9
9
 
10
10
  .action {
11
11
  display: flex;
@@ -1 +1 @@
1
- import{Space as e,Button as t}from"antd";import{useState as i,useEffect as o}from"react";import r from"../HeaderBack/index.js";import{jsxs as n,jsx as d,Fragment as s}from"react/jsx-runtime";function a(a){const{headerTitle:c,history:l,isShowHeader:h=!0,headerPrevious:m=!0,isShowFooter:p=!0,isShowAllAction:u=!0,backButtonText:g="关闭",contentPadding:w="20px",customActionButtons:x,extraActionButtons:f}=a,[v,y]=i(window.innerWidth),k=()=>{const e=document.querySelector("#page");e&&y(e.offsetWidth)};return o(()=>{const e=setTimeout(()=>{k()},0);return u&&p&&window.addEventListener("resize",k),()=>{u&&p&&window.removeEventListener("resize",k),clearTimeout(e)}},[u,p]),n("div",{className:"page",id:"page",children:[u&&h&&d(r,{title:c,history:l,previous:m}),n("div",{style:{padding:w},children:[a.children,u&&p&&n(s,{children:[d("div",{style:{height:"52px"}}),d("div",{style:{textAlign:"center",backgroundColor:"rgb(241, 241, 242)",padding:"10px 0",position:"fixed",bottom:"0",width:v,margin:"0px -20px"},children:x||n(e,{children:[f,d(t,{onClick:()=>l?.goBack?.()||window.history.back(),children:g})]})})]})]})]})}a.displayName="Page";export{a as default};
1
+ import{Space as e,Button as t}from"antd";import{useState as i,useEffect as o}from"react";import{throttle as r}from"throttle-debounce";import n from"../HeaderBack/index.js";import{jsxs as d,jsx as a}from"react/jsx-runtime";function s(s){const{headerTitle:c,history:l,isShowHeader:h=!0,headerPrevious:m=!0,isShowFooter:p=!0,isShowAllAction:u=!0,backButtonText:g="关闭",contentPadding:x="20px",customActionButtons:y,extraActionButtons:w}=s,[f,v]=i(window.innerWidth),b=r(50,()=>{const e=document.querySelector("#page-layout");e&&v(e.offsetWidth)});return o(()=>{const e=setTimeout(()=>{b()},0);return u&&p&&window.addEventListener("resize",b),()=>{u&&p&&window.removeEventListener("resize",b),clearTimeout(e)}},[u,p]),d("div",{className:"page-layout",id:"page-layout",children:[u&&h&&a(n,{title:c,history:l,previous:m}),d("div",{style:{padding:x},children:[s.children,u&&p&&d("div",{className:"page-layout-footer",style:{position:"relative",zIndex:"9"},children:[a("div",{style:{height:"52px"}}),a("div",{style:{textAlign:"center",backgroundColor:"rgb(241, 241, 242)",padding:"10px 0",position:"fixed",bottom:"0",width:f,margin:"0px -20px"},children:y||d(e,{children:[w,a(t,{onClick:()=>l?.goBack?.()||window.history.back(),children:g})]})})]})]})]})}s.displayName="Page";export{s as default};
@@ -7,6 +7,8 @@ export interface PdfProps {
7
7
  name?: string;
8
8
  /** 是否显示弹窗 */
9
9
  visible?: boolean;
10
+ /** 弹窗的标题,默认 ”PDF预览“ */
11
+ title?: string;
10
12
  /** 关闭弹窗的方法 */
11
13
  onCancel?: () => void;
12
14
  /** 是否使用内联模式,true为不使用弹窗,默认 false */
@@ -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{jsxs as m,jsx as f,Fragment as h}from"react/jsx-runtime";function u(u){const{visible:x=!1,onCancel:g,file:v,name:y,inline:w=!1,style:k={}}=u,C=p(),[j,F]=t(0),[P,b]=t(600),[L,S]=t(!0),D=l(null),[A,{enterFullscreen:N,exitFullscreen:W}]=e(D),{downloadFile:$}=c();a.GlobalWorkerOptions.workerSrc=`//unpkg.com/pdfjs-dist@${a.version}/build/pdf.worker.min.mjs`;const z=({numPages:e})=>{F(e),S(!1)},B=()=>{S(!1),n.error("加载 PDF 文件失败"),g&&g()},E=({width:e})=>{b(e)},G=()=>m(h,{children:[L&&f("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"72vh"},children:f(i,{size:"large"})}),f("div",{style:{height:A?"calc(100vh - 40px - 24px - 8px - 32px - 12px)":"72vh",overflowY:"auto",padding:"24px",...k},children:f(d,{file:v.includes(C)?v:C+v,onLoadSuccess:z,onLoadError:B,children:Array.from({length:j}).map((e,r)=>f(s,{pageNumber:r+1,onLoadSuccess:E},`page_${r+1}`))})})]});return w?G():f("div",{ref:D,children:f(r,{style:{top:A?0:100,maxWidth:A?"100vw":"calc(100vw - 32px)",paddingBottom:A?0:24},open:x,maskClosable:!1,width:A?"100vw":P+100,title:"PDF预览",onCancel:()=>{A&&W(),g()},getContainer:!1,footer:[f(o,{onClick:()=>{A&&W(),g()},children:"关闭"},"cancel"),!L&&f(o,{onClick:()=>{A?W():N()},children:A?"退出全屏":"全屏"},"fullScreen"),f(o,{type:"primary",onClick:()=>{A&&W(),$({url:v,name:y})},children:"下载"},"download")],children:G()})})}u.displayName="Pdf";export{u as default};
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{jsxs as m,jsx as f,Fragment as h}from"react/jsx-runtime";function u(u){const{visible:x=!1,onCancel:g,file:v,name:y,inline:w=!1,title:k="PDF预览",style:C={}}=u,j=p(),[F,P]=t(0),[b,L]=t(600),[S,D]=t(!0),A=l(null),[N,{enterFullscreen:W,exitFullscreen:$}]=e(A),{downloadFile:z}=c();a.GlobalWorkerOptions.workerSrc=`//unpkg.com/pdfjs-dist@${a.version}/build/pdf.worker.min.mjs`;const B=({numPages:e})=>{P(e),D(!1)},E=()=>{D(!1),n.error("加载 PDF 文件失败"),g&&g()},G=({width:e})=>{L(e)},I=()=>m(h,{children:[S&&f("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"72vh"},children:f(i,{size:"large"})}),f("div",{style:{height:N?"calc(100vh - 40px - 24px - 8px - 32px - 12px)":"72vh",overflowY:"auto",padding:"24px",...C},children:f(d,{file:v.includes(j)?v:j+v,onLoadSuccess:B,onLoadError:E,children:Array.from({length:F}).map((e,r)=>f(s,{pageNumber:r+1,onLoadSuccess:G},`page_${r+1}`))})})]});return w?I():f("div",{ref:A,children:f(r,{style:{top:N?0:100,maxWidth:N?"100vw":"calc(100vw - 32px)",paddingBottom:N?0:24},open:x,maskClosable:!1,width:N?"100vw":b+100,title:k,onCancel:()=>{N&&$(),g()},getContainer:!1,footer:[f(o,{onClick:()=>{N&&$(),g()},children:"关闭"},"cancel"),!S&&f(o,{onClick:()=>{N?$():W()},children:N?"退出全屏":"全屏"},"fullScreen"),f(o,{type:"primary",onClick:()=>{N&&$(),z({url:v,name:y})},children:"下载"},"download")],children:I()})})}u.displayName="Pdf";export{u as default};
@@ -1 +1 @@
1
- import{Button as r,Image as e,Modal as i,message as t}from"antd";import n from"dayjs";import{useState as o,useRef as c,useEffect as a}from"react";import d from"react-signature-canvas";import{base642File as l}from"../../utils/index.js";import{jsxs as h,Fragment as m,jsx as s}from"react/jsx-runtime";function p(p){const{onConfirm:u,width:f=752,height:y=300,url:g="",...C}=p,[k,b]=o(!1),v=c(null),[w,x]=o("");return a(()=>{x(g)},[g]),h(m,{children:[s("div",{children:s(r,{type:"primary",onClick:()=>{b(!0)},children:w?"重新签字":"手写签字"})}),w&&s("div",{style:{border:"1px dashed #d9d9d9",width:f,height:y,marginTop:16},children:s(e,{src:w,style:{width:f,height:y,objectFit:"contain"}})}),s(i,{title:"签字",width:800,open:k,maskClosable:!1,onCancel:()=>b(!1),footer:[s(r,{onClick:()=>v.current.clear(),children:"重签"},"clear"),s(r,{onClick:()=>{b(!1),v.current.clear()},children:"取消"},"cancel"),s(r,{type:"primary",onClick:()=>{if(v.current.isEmpty())return void t.warning("请签名");const r=v.current.toDataURL();x(r),u({time:n().format("YYYY-MM-DD HH:mm:ss"),base64:r,file:l(r)}),v.current.clear(),b(!1)},children:"确定"},"ok")],children:s("div",{style:{border:"1px dashed #d9d9d9"},children:s(d,{ref:v,penColor:"black",canvasProps:{width:f,height:y},...C})})})]})}p.displayName="Signature";export{p as default};
1
+ import{Button as r,Image as e,Modal as i,message as t}from"antd";import n from"dayjs";import{useState as o,useRef as c,useEffect as a}from"react";import d from"react-signature-canvas";import{base642File as l}from"../../utils/index.js";import{jsxs as h,Fragment as m,jsx as s}from"react/jsx-runtime";function p(p){const{onConfirm:u,width:f=752,height:y=300,url:g="",...C}=p,[k,b]=o(!1),v=c(null),[w,x]=o("");return a(()=>{x(g)},[g]),h(m,{children:[s("div",{children:s(r,{type:"primary",onClick:()=>{b(!0)},children:w?"重新签字":"手写签字"})}),w&&s("div",{style:{border:"1px dashed #d9d9d9",width:"100%",height:y,marginTop:16},children:s(e,{src:w,style:{width:"100%",height:y,objectFit:"contain"}})}),s(i,{title:"签字",width:800,open:k,maskClosable:!1,onCancel:()=>b(!1),footer:[s(r,{onClick:()=>v.current.clear(),children:"重签"},"clear"),s(r,{onClick:()=>{b(!1),v.current.clear()},children:"取消"},"cancel"),s(r,{type:"primary",onClick:()=>{if(v.current.isEmpty())return void t.warning("请签名");const r=v.current.toDataURL();x(r),u({time:n().format("YYYY-MM-DD HH:mm:ss"),base64:r,file:l(r)}),v.current.clear(),b(!1)},children:"确定"},"ok")],children:s("div",{style:{border:"1px dashed #d9d9d9"},children:s(d,{ref:v,penColor:"black",canvasProps:{width:f,height:y},...C})})})]})}p.displayName="Signature";export{p as default};
@@ -1 +1 @@
1
- import e from"@cqsjjb/jjb-react-admin-component/Table";import{getIndexColumn as t}from"../../utils/index.js";import o from"dayjs";import"./index.less";import{jsx as l}from"react/jsx-runtime";const n="tableLocalStorageLastCleanup";function a(a){const{columns:i=[],showIndexColumn:r=!0,ellipsis:s=!0,align:c="center",indexColumnFixed:m="left",rowKey:d="id",...u}=a;return function(){const e=o(),t=localStorage.getItem(n),l=t?o(t):null;if(!l||e.diff(l,"day")>=10){const t=[];for(let e=0;e<localStorage.length;e++){const o=localStorage.key(e);o&&(o.endsWith("#columnState")||o.endsWith("#size")||o.endsWith("#resizable"))&&t.push(o)}t.forEach(e=>{localStorage.removeItem(e)}),localStorage.setItem(n,e.toISOString())}}(),l("div",{className:"table-layout card-layout",children:l(e,{rowKey:d,columns:function(){r&&i.unshift({...t(a.pagination),fixed:m});const e=t=>({align:c,ellipsis:s,...t,...t.children?{children:t.children.map(e)}:{}});return i.map(e)}(),bordered:!0,size:"small",...u})})}a.displayName="Table";export{a as default};
1
+ import{ProTable as e}from"@ant-design/pro-components";import t from"dayjs";import{useState as o,useEffect as n,useMemo as r}from"react";import{throttle as s}from"throttle-debounce";import{useAntdResizableHeader as a}from"use-antd-resizable-header";import{getDataType as i,getIndexColumn as l}from"../../utils/index.js";import"use-antd-resizable-header/dist/style.css";import"./index.less";import{jsx as c}from"react/jsx-runtime";const d="tableLocalStorageLastCleanup";function m(e){const t=process.env?.app?.basename,o=decodeURIComponent(window.location.pathname),n="Undefined"===i(e)?"":`#{${e}}`;return{size:`${t}#${o}${n}#size`,resizable:`${t}#${o}${n}#resizable`,columnState:`${t}#${o}${n}#columnState`}}function u(i){const{columns:u=[],showIndexColumn:p=!0,ellipsis:b=!0,align:f="center",indexColumnFixed:g="left",rowKey:h="id",storeIndex:y,disabledResizer:S=!1,...w}=i,z=process.env.app.antd["ant-prefix"],$=`.${z||"ant"}-table`,x=`${$}-wrapper`,v=`${$}-body`,[C,I]=o((R=y,window.localStorage.getItem(m(R).size)||"default"));var R;const[_,E]=o(0),K=m(y),N=!S,{components:T,resizableColumns:W,tableWidth:j,resetColumns:k}=a({columns:u,columnsState:{persistenceKey:K.resizable,persistenceType:"localStorage"}}),q=s(50,()=>{try{const e=document.querySelector(x),t=document.querySelector(v),o=document.querySelector(".page-layout-footer"),n=o?o.offsetHeight:0;if(t&&e){const o=e.getBoundingClientRect(),r=t.getBoundingClientRect(),s=o.bottom-r.bottom;E(innerHeight-r.top-s-(window.__IN_BASE__?38:22)-n)}}catch(e){window.console.error(e)}});n(()=>{let e,o;return N&&(e=new MutationObserver(e=>e.forEach(()=>q())),o=new ResizeObserver(e=>e.forEach(()=>q())),setTimeout(()=>q(),500),o.observe(document.body),e.observe(document.body,{subtree:!0,childList:!0})),function(){const e=t(),o=localStorage.getItem(d),n=o?t(o):null;if(!n||e.diff(n,"day")>=10){const t=[];for(let e=0;e<localStorage.length;e++){const o=localStorage.key(e);o&&(o.endsWith("#columnState")||o.endsWith("#size")||o.endsWith("#resizable"))&&t.push(o)}t.forEach(e=>{localStorage.removeItem(e)}),localStorage.setItem(d,e.toISOString())}}(),()=>{e&&o&&N&&(o.unobserve(document.body),e.disconnect(document.body))}},[]),n(()=>{!function(e,t){window.localStorage.setItem(m(t).size,e)}(C,y)},[C]);const B=r(()=>(()=>{const e=[...W];p&&e.unshift({...l(i.pagination),fixed:g});const t=e=>({align:f,ellipsis:b,...e,...e.children?{children:e.children.map(t)}:{}});return e.map(t)})(),[W,p,f,b,g,i.pagination]);return c("div",{className:"table-layout card-layout",children:c(e,{ghost:!0,search:!1,scroll:{x:j,y:N?_:void 0},options:{reload:!1,fullScreen:!0,setting:{checkedReset:!0,extra:c("a",{className:`${z}-pro-table-column-setting-action-rest-button`,onClick:k,children:"重置列宽"})}},components:T,columnsState:{persistenceKey:K.columnState,persistenceType:"localStorage"},onSizeChange:I,columns:B,bordered:!0,size:"small",rowKey:h,...w})})}u.displayName="Table";export{u as default};
@@ -12,9 +12,3 @@
12
12
  padding-top: 0 !important;
13
13
  padding-bottom: 16px;
14
14
  }
15
-
16
- .search-layout {
17
- + .table-layout .@{ant-prefix}-pro-table-list-toolbar-container {
18
- padding-top: 26px !important;
19
- }
20
- }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zy-react-library",
3
3
  "private": false,
4
- "version": "1.1.4",
4
+ "version": "1.1.6",
5
5
  "type": "module",
6
6
  "description": "",
7
7
  "author": "LiuJiaNan",
@@ -33,7 +33,6 @@
33
33
  "@ant-design/icons": "^6.1.0",
34
34
  "@ant-design/pro-components": "^2.8.10",
35
35
  "@cqsjjb/jjb-common-lib": "latest",
36
- "@cqsjjb/jjb-react-admin-component": "latest",
37
36
  "@wangeditor/editor": "^5.1.23",
38
37
  "@wangeditor/editor-for-react": "^1.0.6",
39
38
  "ahooks": "^3.9.5",
@@ -42,7 +41,9 @@
42
41
  "lodash-es": "^4.17.21",
43
42
  "react": "^18.3.1",
44
43
  "react-pdf": "^10.2.0",
45
- "react-signature-canvas": "^1.1.0-alpha.2"
44
+ "react-signature-canvas": "^1.1.0-alpha.2",
45
+ "throttle-debounce": "^5.0.2",
46
+ "use-antd-resizable-header": "^3.2.2"
46
47
  },
47
48
  "devDependencies": {
48
49
  "@babel/core": "^7.28.5",