szld-libs 0.1.3 → 0.1.5

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.
@@ -20636,11 +20636,11 @@ const iR = [Cf.jpeg, Cf.jpg, Cf.png], dN = (h) => {
20636
20636
  /* @__PURE__ */ Se(
20637
20637
  OS,
20638
20638
  {
20639
- ...h,
20640
- onPreview: Je,
20641
20639
  beforeUpload: J,
20642
20640
  onChange: Le,
20643
20641
  listType: v,
20642
+ ...h,
20643
+ onPreview: Je,
20644
20644
  children: w.length >= g ? null : ie()
20645
20645
  }
20646
20646
  ),
@@ -20915,6 +20915,7 @@ const TN = "editable-module_editableCellValueWrap_3b3d9", RN = {
20915
20915
  return /* @__PURE__ */ Se(Ip, { form: v, component: !1, children: /* @__PURE__ */ Se(MR.Provider, { value: v, children: /* @__PURE__ */ Se("tr", { ...g }) }) });
20916
20916
  };
20917
20917
  function bN(h) {
20918
+ console.log(h, "props");
20918
20919
  const {
20919
20920
  title: g,
20920
20921
  editable: v,
@@ -188,4 +188,4 @@ Check the render method of %s.`,Fe(tn)||"Unknown"));var m=lu(s,f);m.payload={ele
188
188
 
189
189
  let root = createRoot(domContainer);
190
190
  root.render(<App />);`),t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(u=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError),t.transitionCallbacks!==void 0&&t.transitionCallbacks);var f=ew(e,Yh,null,a,i,u,s);Hh(f.current,e);var p=e.nodeType===nn?e.parentNode:e;return Kd(p),new qS(f)}function Xm(e){this._internalRoot=e}function IO(e){e&&dh(e)}Xm.prototype.unstable_scheduleHydration=IO;function $O(e,t,a){if(!Km(e))throw new Error("hydrateRoot(...): Target container is not a DOM element.");Tw(e),t===void 0&&C("Must provide initial children as second argument to hydrateRoot. Example usage: hydrateRoot(domContainer, <App />)");var i=a??null,u=a!=null&&a.hydratedSources||null,s=!1,f=!1,p="",m=Ew;a!=null&&(a.unstable_strictMode===!0&&(s=!0),a.identifierPrefix!==void 0&&(p=a.identifierPrefix),a.onRecoverableError!==void 0&&(m=a.onRecoverableError));var S=tw(t,null,e,Yh,i,s,f,p,m);if(Hh(S.current,e),Kd(e),u)for(var E=0;E<u.length;E++){var D=u[E];Zk(S,D)}return new Xm(S)}function Km(e){return!!(e&&(e.nodeType===Er||e.nodeType===Ma||e.nodeType===kl||!dt))}function $p(e){return!!(e&&(e.nodeType===Er||e.nodeType===Ma||e.nodeType===kl||e.nodeType===nn&&e.nodeValue===" react-mount-point-unstable "))}function Tw(e){e.nodeType===Er&&e.tagName&&e.tagName.toUpperCase()==="BODY"&&C("createRoot(): Creating roots directly with document.body is discouraged, since its children are often manipulated by third-party scripts and browser extensions. This may lead to subtle reconciliation issues. Try using a container element created for your app."),op(e)&&(e._reactRootContainer?C("You are calling ReactDOMClient.createRoot() on a container that was previously passed to ReactDOM.render(). This is not supported."):C("You are calling ReactDOMClient.createRoot() on a container that has already been passed to createRoot() before. Instead, call root.render() on the existing root instead if you want to update it."))}var YO=v.ReactCurrentOwner,ww;ww=function(e){if(e._reactRootContainer&&e.nodeType!==nn){var t=rw(e._reactRootContainer.current);t&&t.parentNode!==e&&C("render(...): It looks like the React-rendered content of this container was removed without using React. This is not supported and will cause errors. Instead, call ReactDOM.unmountComponentAtNode to empty a container.")}var a=!!e._reactRootContainer,i=XS(e),u=!!(i&&eo(i));u&&!a&&C("render(...): Replacing React-rendered children with a new root component. If you intended to update the children of this node, you should instead have the existing children update their state and render the new components instead of calling ReactDOM.render."),e.nodeType===Er&&e.tagName&&e.tagName.toUpperCase()==="BODY"&&C("render(): Rendering components directly into document.body is discouraged, since its children are often manipulated by third-party scripts and browser extensions. This may lead to subtle reconciliation issues. Try rendering into a container element created for your app.")};function XS(e){return e?e.nodeType===Ma?e.documentElement:e.firstChild:null}function Rw(){}function QO(e,t,a,i,u){if(u){if(typeof i=="function"){var s=i;i=function(){var x=qm(f);s.call(x)}}var f=tw(t,i,e,no,null,!1,!1,"",Rw);e._reactRootContainer=f,Hh(f.current,e);var p=e.nodeType===nn?e.parentNode:e;return Kd(p),cu(),f}else{for(var m;m=e.lastChild;)e.removeChild(m);if(typeof i=="function"){var S=i;i=function(){var x=qm(E);S.call(x)}}var E=ew(e,no,null,!1,!1,"",Rw);e._reactRootContainer=E,Hh(E.current,e);var D=e.nodeType===nn?e.parentNode:e;return Kd(D),cu(function(){Ip(t,E,a,i)}),E}}function WO(e,t){e!==null&&typeof e!="function"&&C("%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.",t,e)}function Zm(e,t,a,i,u){ww(a),WO(u===void 0?null:u,"render");var s=a._reactRootContainer,f;if(!s)f=QO(a,t,e,u,i);else{if(f=s,typeof u=="function"){var p=u;u=function(){var m=qm(f);p.call(m)}}Ip(t,f,e,u)}return qm(f)}function GO(e){{var t=YO.current;if(t!==null&&t.stateNode!==null){var a=t.stateNode._warnedAboutRefsInRender;a||C("%s is accessing findDOMNode inside its render(). render() should be a pure function of props and state. It should never access something that requires stale data from the previous render, such as refs. Move this logic to componentDidMount and componentDidUpdate instead.",Rt(t.type)||"A component"),t.stateNode._warnedAboutRefsInRender=!0}}return e==null?null:e.nodeType===Er?e:MO(e,"findDOMNode")}function qO(e,t,a){if(C("ReactDOM.hydrate is no longer supported in React 18. Use hydrateRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot"),!$p(t))throw new Error("Target container is not a DOM element.");{var i=op(t)&&t._reactRootContainer===void 0;i&&C("You are calling ReactDOM.hydrate() on a container that was previously passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call hydrateRoot(container, element)?")}return Zm(null,e,t,!0,a)}function XO(e,t,a){if(C("ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot"),!$p(t))throw new Error("Target container is not a DOM element.");{var i=op(t)&&t._reactRootContainer===void 0;i&&C("You are calling ReactDOM.render() on a container that was previously passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call root.render(element)?")}return Zm(null,e,t,!1,a)}function KO(e,t,a,i){if(C("ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported in React 18. Consider using a portal instead. Until you switch to the createRoot API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot"),!$p(a))throw new Error("Target container is not a DOM element.");if(e==null||!Vo(e))throw new Error("parentComponent must be a valid React Component");return Zm(e,t,a,!1,i)}function ZO(e){if(!$p(e))throw new Error("unmountComponentAtNode(...): Target container is not a DOM element.");{var t=op(e)&&e._reactRootContainer===void 0;t&&C("You are calling ReactDOM.unmountComponentAtNode() on a container that was previously passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call root.unmount()?")}if(e._reactRootContainer){{var a=XS(e),i=a&&!eo(a);i&&C("unmountComponentAtNode(): The node you're attempting to unmount was rendered by another copy of React.")}return cu(function(){Zm(null,null,e,!1,function(){e._reactRootContainer=null,CC(e)})}),!0}else{{var u=XS(e),s=!!(u&&eo(u)),f=e.nodeType===Er&&$p(e.parentNode)&&!!e.parentNode._reactRootContainer;s&&C("unmountComponentAtNode(): The node you're attempting to unmount was rendered by React and is not a top-level container. %s",f?"You may have accidentally passed in a React root node instead of its container.":"Instead, have the parent component update its state and rerender in order to remove this component.")}return!1}}de(LO),lh(zO),ts(UO),Ld(va),oh(Zo),(typeof Map!="function"||Map.prototype==null||typeof Map.prototype.forEach!="function"||typeof Set!="function"||Set.prototype==null||typeof Set.prototype.clear!="function"||typeof Set.prototype.forEach!="function")&&C("React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),Vv(tx),Xs(kS,$_,cu);function JO(e,t){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(!Km(t))throw new Error("Target container is not a DOM element.");return NO(e,t,null,a)}function eN(e,t,a,i){return KO(e,t,a,i)}var KS={usingClientEntryPoint:!1,Events:[eo,Zc,jh,qs,Fo,kS]};function tN(e,t){return KS.usingClientEntryPoint||C('You are importing createRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client".'),PO(e,t)}function nN(e,t,a){return KS.usingClientEntryPoint||C('You are importing hydrateRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client".'),$O(e,t,a)}function rN(e){return LT()&&C("flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task."),cu(e)}var aN=BO({findFiberByHostInstance:fs,bundleType:1,version:$S,rendererPackageName:"react-dom"});if(!aN&&gn&&window.top===window.self&&(navigator.userAgent.indexOf("Chrome")>-1&&navigator.userAgent.indexOf("Edge")===-1||navigator.userAgent.indexOf("Firefox")>-1)){var bw=window.location.protocol;/^(https?|file):$/.test(bw)&&console.info("%cDownload the React DevTools for a better development experience: https://reactjs.org/link/react-devtools"+(bw==="file:"?`
191
- You might need to use a local HTTP server (instead of file://): https://reactjs.org/link/react-devtools-faq`:""),"font-weight:bold")}Jr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=KS,Jr.createPortal=JO,Jr.createRoot=tN,Jr.findDOMNode=GO,Jr.flushSync=rN,Jr.hydrate=qO,Jr.hydrateRoot=nN,Jr.render=XO,Jr.unmountComponentAtNode=ZO,Jr.unstable_batchedUpdates=kS,Jr.unstable_renderSubtreeIntoContainer=eN,Jr.version=$S,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Jr}(function(h){function g(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function")){if(process.env.NODE_ENV!=="production")throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(g)}catch(v){console.error(v)}}}process.env.NODE_ENV==="production"?(g(),h.exports=eb()):h.exports=tb()})(KR);const H1=[Ds.jpeg,Ds.jpg,Ds.png],j1=h=>{const{maxCount:g=1,listType:v="picture-card",fileList:R=[],maxSize:_=2,accept:F=H1.join(","),uploadBtnName:C="上传",uploadHint:K=null}=h,[j,H]=it.useState(!1),[ae,q]=it.useState(""),ie=()=>v!=="text"?mn("div",{style:{position:"relative"},children:[mn("div",{children:[Se(OR,{}),Se("div",{style:{marginTop:8},children:C})]}),K]}):mn(Jm,{children:[Se(Ye.Button,{icon:Se(AR,{}),children:C}),K]}),J=Be=>{const Ie=F.split(","),He=Zp(Be.name)||"";return Ie.includes(He)?Be.size/1024/1024<_?!0:(Ye.message.error(`文件必须小于${_}MB`),Ye.Upload.LIST_IGNORE):(Ye.message.error(`只允许上传 ${F} 文件`),Ye.Upload.LIST_IGNORE)},Le=Be=>{h.onChange&&h.onChange(Be)},et=Be=>{h.onPreview?h.onPreview(Be):Xe(Be)},Xe=async Be=>{let Ie=Zp(Be.name)||"";if(Ie||(Ie=Zp(Be.name||Be.url)||""),Ie===Ds.pdf)return Ye.Modal.info({title:"PDF",width:"60%",content:Se("iframe",{title:"PDF预览",src:Be.url||Be.response.url,frameBorder:"0",style:{width:"100%",height:"70vh"}}),okText:"关闭"});H1.includes(Ie)&&(!Be.url&&!Be.thumbUrl&&!Be.preview&&(Be.preview=await N1(Be.originFileObj)),q(Be.url||Be.thumbUrl||Be.preview),H(!0))};return mn(Jm,{children:[Se(Ye.Upload,{...h,onPreview:et,beforeUpload:J,onChange:Le,listType:v,children:R.length>=g?null:ie()}),Se(Ye.Image,{style:{display:"none"},preview:{visible:j,src:ae,onVisibleChange:()=>{H(!1),q("")}}})]})},Jp={fieldModal:"create-form-module_fieldModal_8bf3d",content:"create-form-module_content_61f84",suffix:"create-form-module_suffix_42205",placeholder:"create-form-module_placeholder_90d6a"},nb={labelCol:{span:4},wrapperCol:{span:20}},V1=h=>{switch(h){case"upload":return"fileList";case"switch":return"checked";default:return"value"}},B1=h=>{const{items:g,rowProps:v,formProps:R,readonly:_=!1,hiddenTitle:F=!1}=h,C=(H,ae)=>{var q,ie;if(ae.btnType==="submit"){(q=R==null?void 0:R.form)==null||q.validateFields().then(J=>{ae.onClick&&ae.onClick(J)});return}if(ae.btnType==="reset"){(ie=R==null?void 0:R.form)==null||ie.resetFields(),ae.onClick&&ae.onClick(H);return}ae.btnType==="cancel"&&ae.onClick&&ae.onClick(H)},K=H=>Array.isArray(H)?H:H&&H.fileList,j=H=>{var q;const ae=R==null?void 0:R.initialValues;return H.dataIndex?((q=H.render)==null?void 0:q.call(H,ae==null?void 0:ae[H.dataIndex],ae))||H.value||(ae==null?void 0:ae[H.dataIndex]):""};return Se(Ye.Form,{layout:"horizontal",form:R==null?void 0:R.form,...nb,...R||{},children:Se(Ye.Row,{gutter:16,...v,children:g.filter(H=>!H.hidden).map((H,ae)=>{var q;return Se(Ye.Col,{...H.colProps||{span:24},children:Se(Ye.Form.Item,{...H.valueType==="upload"?{getValueFromEvent:K}:{},label:F?"":H.title,name:H.valueType==="btns"?void 0:H.dataIndex,...H.formItemProps,children:H.readonly?Se("div",{children:j(H)}):H.readonly===void 0&&_?Se("div",{children:H.value||H.dataIndex&&((q=R==null?void 0:R.initialValues)==null?void 0:q[H.dataIndex])}):Se(P1,{onChange:ie=>{var J;return(J=H==null?void 0:H.onChange)==null?void 0:J.call(H,ie)},valueType:H.valueType,onBtnClick:C,valueProps:H.valueProps})})},H.dataIndex||ae)})})})},P1=h=>{const{valueType:g,valueProps:v,value:R,onChange:_,onBtnClick:F,inputRef:C}=h,K=it.useMemo(()=>{let j=Se(Ye.Input,{placeholder:"请输入",...v,allowClear:!0});switch(g){case"rate":j=Se(Ye.Rate,{...v});break;case"password":j=Se(Ye.Input.Password,{...v});break;case"modal":j=Se(rb,{...v});break;case"checkbox":j=Se(Ye.Checkbox.Group,{...v});break;case"select":j=Se(Ye.Select,{placeholder:"请选择",...v,allowClear:!0});break;case"inputNumber":j=Se(Ye.InputNumber,{style:{width:"100%"},placeholder:"请输入",...v});break;case"textarea":j=Se(Ye.Input.TextArea,{placeholder:"请输入",...v,allowClear:!0});break;case"radio":j=Se(Ye.Radio.Group,{...v});break;case"switch":j=Se(Ye.Switch,{...v});break;case"datePicker":j=Se(Ye.DatePicker,{style:{width:"100%"},...v,allowClear:!0});break;case"rangePicker":j=Se(Ye.DatePicker.RangePicker,{style:{width:"100%"},...v,allowClear:!0});break;case"timePicker":j=Se(Ye.TimePicker,{style:{width:"100%"},...v,allowClear:!0});break;case"cascader":j=Se(Ye.Cascader,{...v,allowClear:!0});break;case"upload":j=Se(j1,{...v});break;case"btns":j=Se(Ye.Space,{children:v==null?void 0:v.map(H=>it.createElement(Ye.Button,{type:H.btnType==="submit"?"primary":"default",...Rf.omit(H,["btnType"]),key:H.key||H.btnType,onClick:ae=>{F==null||F(ae,H)}},H.title||H.children))});break}return j},[g,v,_,R]);if(g==="custom"){const j=v;return it.cloneElement(j.children,{[V1(g||"input")]:R,onChange:_,ref:C})}return it.cloneElement(K,{[V1(g||"input")]:R,onChange:_,ref:C})},rb=h=>{const{placeholder:g,labelKey:v,onToggle:R,value:_,onClear:F,className:C,style:K}=h;return mn("div",{className:[Jp.fieldModal,C].filter(j=>j).join(" "),style:K,children:[Se("div",{className:Jp.content,onClick:()=>R(!0),children:_?Se("span",{children:_[v]}):Se("span",{className:Jp.placeholder,children:g})}),Se("span",{className:Jp.suffix,onClick:F,children:_&&Se(RR,{})})]})},ab={search:"search-table-module_search_17add"};function ib(h){const{tableProps:g={},searchProps:v}=h,{columns:R=[],..._}=g;return mn(Jm,{children:[v&&Se(B1,{hiddenTitle:!0,...v,items:v.items}),Se(Ye.Table,{columns:R.filter(F=>!F.hidden),..._,className:kf(ab.table,g==null?void 0:g.className),pagination:typeof(g==null?void 0:g.pagination)=="boolean"?g.pagination:{hideOnSinglePage:!0,showPrevNextJumpers:!0,showQuickJumper:!0,showSizeChanger:!0,showTotal:F=>`共 ${F} 条`,...g==null?void 0:g.pagination}})]})}const lb={editableCellValueWrap:"editable-module_editableCellValueWrap_3b3d9"},I1=it.createContext(null),ub=({index:h,...g})=>{const[v]=Ye.Form.useForm();return Se(Ye.Form,{form:v,component:!1,children:Se(I1.Provider,{value:v,children:Se("tr",{...g})})})};function ob(h){const{title:g,editable:v,children:R,dataIndex:_,record:F,rules:C,onChange:K,type:j="input",valueProps:H,...ae}=h,q=it.useRef(null),ie=it.useContext(I1),J=async()=>{try{const Xe=await ie.validateFields();K({...F,...Xe})}catch(Xe){console.log("Save failed:",Xe)}},Le=()=>Se(P1,{valueType:j,valueProps:{...H,onBlur:J,onPressEnter:J},inputRef:q});let et=R;return v&&(et=Se(Ye.Form.Item,{style:{margin:0},initialValue:F[_],name:_,rules:C,children:Le()})),Se("td",{children:et})}function sb(h){const{columns:g,onChange:v,...R}=h,_={body:{row:ub,cell:ob}},F=g==null?void 0:g.map(C=>C.editable?{...C,onCell:K=>({...C,record:K,onChange:v})}:C);return Se(Ye.Table,{...R,components:_,rowClassName:()=>lb.editableRow,columns:F})}const $1=h=>{const{auth:g=!0,...v}=h;return g?Se(Ye.Button,{...v}):null},cb=h=>{const{PId:g,auths:v,...R}=h,_=it.useMemo(()=>!!(v&&v.find(F=>F.PId===g)),[g,v]);return Se($1,{...R,auth:_})},_n={main:"workflownode-module_main_dce7f",item:"workflownode-module_item_73d7c",tail:"workflownode-module_tail_3cb51",node:"workflownode-module_node_005fd",content:"workflownode-module_content_8334f",collpase:"workflownode-module_collpase_f2468",btn:"workflownode-module_btn_b0c06",title:"workflownode-module_title_cb34c",dateWrapper:"workflownode-module_dateWrapper_94849",remark:"workflownode-module_remark_4f910",itemActive:"workflownode-module_itemActive_2a29d",itemDone:"workflownode-module_itemDone_489bc",itemUnDo:"workflownode-module_itemUnDo_2914c"},fb=h=>{const{data:g,current:v}=h,[R,_]=it.useState(!1),F=it.useMemo(()=>!v||g.length===0?0:g.findIndex(H=>H.PNId===v),[v,g]),C=it.useMemo(()=>F>1?R?0:F-1:0,[F,R]),K=()=>{_(!0)};return mn("ul",{className:_n.main,children:[F>1&&!R&&mn("li",{className:kf(_n.item,_n.itemDone),children:[Se("div",{className:_n.tail}),Se("div",{className:_n.node}),Se("div",{className:_n.content,children:mn("div",{className:_n.collpase,children:[mn("div",{children:["已收起",Se("span",{children:F-1}),"个节点"]}),mn("a",{className:_n.btn,onClick:K,children:["展开节点",Se(kR,{})]})]})})]}),g.slice(C).map((j,H)=>mn("li",{className:kf(_n.item,F===H+C?_n.itemActive:F>H+C?_n.itemDone:_n.itemUnDo),children:[Se("div",{className:_n.tail}),Se("div",{className:_n.node}),mn("div",{className:_n.content,children:[Se("div",{className:_n.title,children:j.PNName}),mn("div",{className:_n.dateWrapper,children:[j.PlanFinishDate&&mn("span",{children:["预计完成时间: ",j.PlanFinishDate]}),j.UpdateTime&&mn("span",{style:{color:"#333",fontWeight:"bold"},children:["实际完成时间: ",j.UpdateTime]}),R&&F-1===H&&mn("a",{className:_n.btn,onClick:()=>_(!1),children:["收起节点 ",Se(LR,{})]})]}),j.Remark&&Se("div",{className:_n.remark,children:j.Remark})]})]},j.PNId))]})},db=h=>{const{current:g,data:v,...R}=h;return(()=>{Ye.Modal.info({icon:null,title:"流程节点",width:700,content:Se(fb,{current:g,data:v}),closable:!0,footer:null,maskClosable:!0,...R})})(),null},pb=(h,g)=>{const v=new URL(h),R=new URL(g);return v.protocol===R.protocol&&v.host===R.host&&v.port===R.port},vb=h=>{const g=new URL(h).href.split("/");return g[g.length-1]},hb=h=>{var v;return(v=h.headers.get("content-disposition"))==null?void 0:v.split(";")[1].split("=")[1]},mb=(h,g)=>{const v=g||vb(h);if(pb(h,window.location.href)){Cy(h,v);return}let R=g;fetch(h,{method:"get"}).then(_=>(R||(R=hb(_)),_.blob())).then(_=>{Y1(_,R||v)}).catch(()=>{Cy(h,"")})},yb=h=>{for(var g=h.split(","),v=g[0].match(/:(.*?);/)[1],R=window.atob(g[1]),_=R.length,F=new Uint8Array(_);_--;)F[_]=R.charCodeAt(_);return new Blob([F],{type:v})},Y1=(h,g)=>{let v="";h instanceof Blob?v=window.URL.createObjectURL(h):v=window.URL.createObjectURL(yb(h));const R=window.navigator;if(R.msSaveOrOpenBlob){R.msSaveOrOpenBlob(h,g);return}Cy(v,g),window.URL.revokeObjectURL(v)},Cy=(h,g)=>{let v=document.createElement("a");v.style.display="none",v.href=h,v.target="_blank",v.download=g,document.body.appendChild(v),v.click(),document.body.removeChild(v)},gb=Object.freeze(Object.defineProperty({__proto__:null,downloadUrl:mb,downloadBlob:Y1},Symbol.toStringTag,{value:"Module"}));class Sb{constructor(g){xw(this,"options",{id:"",canvasId:"verifyCanvas",width:100,height:30,type:"blend",code:""});this.options=g}GVerify(){this.options.numArr="0,1,2,3,4,5,6,7,8,9".split(","),this.options.letterArr=this.getAllLetter(),this._init(),this.refresh()}_init(){const g=document.getElementById(this.options.id),v=document.createElement("canvas");v.id=this.options.canvasId,v.width=Number(this.options.width),v.height=Number(this.options.height),v.style.cursor="pointer",v.innerHTML="您的浏览器版本不支持canvas",g&&g.appendChild(v),v.onclick=()=>{this.refresh()}}refresh(){this.options.code="";const g=document.getElementById(this.options.canvasId);let v,R=[];if(g.getContext)v=g.getContext("2d");else return;v.textBaseline="middle",v.fillStyle=this.randomColor(180,240),v.fillRect(0,0,this.options.width,this.options.height),this.options.type=="blend"?R=this.options.numArr.concat(this.options.letterArr):this.options.type=="number"?R=this.options.numArr:R=this.options.letterArr;for(let _=1;_<=4;_++){const F=R[this.randomNum(0,R.length)];this.options.code+=F,v.font="20px SimHei",v.fillStyle=this.randomColor(50,160),v.shadowBlur=this.randomNum(-3,3),v.shadowColor="rgba(0, 0, 0, 0.3)";const C=Number(this.options.width)/5*_,K=Number(this.options.height)/2,j=this.randomNum(-30,30);v.translate(C,K),v.rotate(j*Math.PI/180),v.fillText(F,0,0),v.rotate(-j*Math.PI/180),v.translate(-C,-K)}for(let _=0;_<2;_++)v.strokeStyle=this.randomColor(40,180),v.beginPath(),v.moveTo(this.randomNum(0,Number(this.options.width)/2),this.randomNum(0,Number(this.options.height)/2)),v.lineTo(this.randomNum(0,Number(this.options.width)/2),this.randomNum(0,Number(this.options.height))),v.stroke();for(let _=0;_<Number(this.options.width)/10;_++)v.fillStyle=this.randomColor(0,255),v.beginPath(),v.arc(this.randomNum(0,this.options.width),this.randomNum(0,this.options.height),1,0,2*Math.PI),v.fill()}validate(g){const v=g.toLowerCase(),R=this.options.code.toLowerCase();return v==R}getAllLetter(){return"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z".split(",")}randomNum(g,v){return Math.floor(Math.random()*(v-g)+g)}randomColor(g,v){const R=this.randomNum(g,v),_=this.randomNum(g,v),F=this.randomNum(g,v);return"rgb("+R+","+_+","+F+")"}}const Cb=Object.freeze(Object.defineProperty({__proto__:null,getGVerify:Sb},Symbol.toStringTag,{value:"Module"}));_t.AuthButton=$1,_t.BackHeader=jR,_t.CoralButton=cb,_t.CreateForm=B1,_t.EditTable=sb,_t.SearchTable=ib,_t.UploadFile=j1,_t.download=gb,_t.fileType=VR,_t.showWorkFlow=db,_t.utils=XR,_t.verfyCode=Cb,Object.defineProperty(_t,Symbol.toStringTag,{value:"Module"})});
191
+ You might need to use a local HTTP server (instead of file://): https://reactjs.org/link/react-devtools-faq`:""),"font-weight:bold")}Jr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=KS,Jr.createPortal=JO,Jr.createRoot=tN,Jr.findDOMNode=GO,Jr.flushSync=rN,Jr.hydrate=qO,Jr.hydrateRoot=nN,Jr.render=XO,Jr.unmountComponentAtNode=ZO,Jr.unstable_batchedUpdates=kS,Jr.unstable_renderSubtreeIntoContainer=eN,Jr.version=$S,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Jr}(function(h){function g(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function")){if(process.env.NODE_ENV!=="production")throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(g)}catch(v){console.error(v)}}}process.env.NODE_ENV==="production"?(g(),h.exports=eb()):h.exports=tb()})(KR);const H1=[Ds.jpeg,Ds.jpg,Ds.png],j1=h=>{const{maxCount:g=1,listType:v="picture-card",fileList:R=[],maxSize:_=2,accept:F=H1.join(","),uploadBtnName:C="上传",uploadHint:K=null}=h,[j,H]=it.useState(!1),[ae,q]=it.useState(""),ie=()=>v!=="text"?mn("div",{style:{position:"relative"},children:[mn("div",{children:[Se(OR,{}),Se("div",{style:{marginTop:8},children:C})]}),K]}):mn(Jm,{children:[Se(Ye.Button,{icon:Se(AR,{}),children:C}),K]}),J=Be=>{const Ie=F.split(","),He=Zp(Be.name)||"";return Ie.includes(He)?Be.size/1024/1024<_?!0:(Ye.message.error(`文件必须小于${_}MB`),Ye.Upload.LIST_IGNORE):(Ye.message.error(`只允许上传 ${F} 文件`),Ye.Upload.LIST_IGNORE)},Le=Be=>{h.onChange&&h.onChange(Be)},et=Be=>{h.onPreview?h.onPreview(Be):Xe(Be)},Xe=async Be=>{let Ie=Zp(Be.name)||"";if(Ie||(Ie=Zp(Be.name||Be.url)||""),Ie===Ds.pdf)return Ye.Modal.info({title:"PDF",width:"60%",content:Se("iframe",{title:"PDF预览",src:Be.url||Be.response.url,frameBorder:"0",style:{width:"100%",height:"70vh"}}),okText:"关闭"});H1.includes(Ie)&&(!Be.url&&!Be.thumbUrl&&!Be.preview&&(Be.preview=await N1(Be.originFileObj)),q(Be.url||Be.thumbUrl||Be.preview),H(!0))};return mn(Jm,{children:[Se(Ye.Upload,{beforeUpload:J,onChange:Le,listType:v,...h,onPreview:et,children:R.length>=g?null:ie()}),Se(Ye.Image,{style:{display:"none"},preview:{visible:j,src:ae,onVisibleChange:()=>{H(!1),q("")}}})]})},Jp={fieldModal:"create-form-module_fieldModal_8bf3d",content:"create-form-module_content_61f84",suffix:"create-form-module_suffix_42205",placeholder:"create-form-module_placeholder_90d6a"},nb={labelCol:{span:4},wrapperCol:{span:20}},V1=h=>{switch(h){case"upload":return"fileList";case"switch":return"checked";default:return"value"}},B1=h=>{const{items:g,rowProps:v,formProps:R,readonly:_=!1,hiddenTitle:F=!1}=h,C=(H,ae)=>{var q,ie;if(ae.btnType==="submit"){(q=R==null?void 0:R.form)==null||q.validateFields().then(J=>{ae.onClick&&ae.onClick(J)});return}if(ae.btnType==="reset"){(ie=R==null?void 0:R.form)==null||ie.resetFields(),ae.onClick&&ae.onClick(H);return}ae.btnType==="cancel"&&ae.onClick&&ae.onClick(H)},K=H=>Array.isArray(H)?H:H&&H.fileList,j=H=>{var q;const ae=R==null?void 0:R.initialValues;return H.dataIndex?((q=H.render)==null?void 0:q.call(H,ae==null?void 0:ae[H.dataIndex],ae))||H.value||(ae==null?void 0:ae[H.dataIndex]):""};return Se(Ye.Form,{layout:"horizontal",form:R==null?void 0:R.form,...nb,...R||{},children:Se(Ye.Row,{gutter:16,...v,children:g.filter(H=>!H.hidden).map((H,ae)=>{var q;return Se(Ye.Col,{...H.colProps||{span:24},children:Se(Ye.Form.Item,{...H.valueType==="upload"?{getValueFromEvent:K}:{},label:F?"":H.title,name:H.valueType==="btns"?void 0:H.dataIndex,...H.formItemProps,children:H.readonly?Se("div",{children:j(H)}):H.readonly===void 0&&_?Se("div",{children:H.value||H.dataIndex&&((q=R==null?void 0:R.initialValues)==null?void 0:q[H.dataIndex])}):Se(P1,{onChange:ie=>{var J;return(J=H==null?void 0:H.onChange)==null?void 0:J.call(H,ie)},valueType:H.valueType,onBtnClick:C,valueProps:H.valueProps})})},H.dataIndex||ae)})})})},P1=h=>{const{valueType:g,valueProps:v,value:R,onChange:_,onBtnClick:F,inputRef:C}=h,K=it.useMemo(()=>{let j=Se(Ye.Input,{placeholder:"请输入",...v,allowClear:!0});switch(g){case"rate":j=Se(Ye.Rate,{...v});break;case"password":j=Se(Ye.Input.Password,{...v});break;case"modal":j=Se(rb,{...v});break;case"checkbox":j=Se(Ye.Checkbox.Group,{...v});break;case"select":j=Se(Ye.Select,{placeholder:"请选择",...v,allowClear:!0});break;case"inputNumber":j=Se(Ye.InputNumber,{style:{width:"100%"},placeholder:"请输入",...v});break;case"textarea":j=Se(Ye.Input.TextArea,{placeholder:"请输入",...v,allowClear:!0});break;case"radio":j=Se(Ye.Radio.Group,{...v});break;case"switch":j=Se(Ye.Switch,{...v});break;case"datePicker":j=Se(Ye.DatePicker,{style:{width:"100%"},...v,allowClear:!0});break;case"rangePicker":j=Se(Ye.DatePicker.RangePicker,{style:{width:"100%"},...v,allowClear:!0});break;case"timePicker":j=Se(Ye.TimePicker,{style:{width:"100%"},...v,allowClear:!0});break;case"cascader":j=Se(Ye.Cascader,{...v,allowClear:!0});break;case"upload":j=Se(j1,{...v});break;case"btns":j=Se(Ye.Space,{children:v==null?void 0:v.map(H=>it.createElement(Ye.Button,{type:H.btnType==="submit"?"primary":"default",...Rf.omit(H,["btnType"]),key:H.key||H.btnType,onClick:ae=>{F==null||F(ae,H)}},H.title||H.children))});break}return j},[g,v,_,R]);if(g==="custom"){const j=v;return it.cloneElement(j.children,{[V1(g||"input")]:R,onChange:_,ref:C})}return it.cloneElement(K,{[V1(g||"input")]:R,onChange:_,ref:C})},rb=h=>{const{placeholder:g,labelKey:v,onToggle:R,value:_,onClear:F,className:C,style:K}=h;return mn("div",{className:[Jp.fieldModal,C].filter(j=>j).join(" "),style:K,children:[Se("div",{className:Jp.content,onClick:()=>R(!0),children:_?Se("span",{children:_[v]}):Se("span",{className:Jp.placeholder,children:g})}),Se("span",{className:Jp.suffix,onClick:F,children:_&&Se(RR,{})})]})},ab={search:"search-table-module_search_17add"};function ib(h){const{tableProps:g={},searchProps:v}=h,{columns:R=[],..._}=g;return mn(Jm,{children:[v&&Se(B1,{hiddenTitle:!0,...v,items:v.items}),Se(Ye.Table,{columns:R.filter(F=>!F.hidden),..._,className:kf(ab.table,g==null?void 0:g.className),pagination:typeof(g==null?void 0:g.pagination)=="boolean"?g.pagination:{hideOnSinglePage:!0,showPrevNextJumpers:!0,showQuickJumper:!0,showSizeChanger:!0,showTotal:F=>`共 ${F} 条`,...g==null?void 0:g.pagination}})]})}const lb={editableCellValueWrap:"editable-module_editableCellValueWrap_3b3d9"},I1=it.createContext(null),ub=({index:h,...g})=>{const[v]=Ye.Form.useForm();return Se(Ye.Form,{form:v,component:!1,children:Se(I1.Provider,{value:v,children:Se("tr",{...g})})})};function ob(h){console.log(h,"props");const{title:g,editable:v,children:R,dataIndex:_,record:F,rules:C,onChange:K,type:j="input",valueProps:H,...ae}=h,q=it.useRef(null),ie=it.useContext(I1),J=async()=>{try{const Xe=await ie.validateFields();K({...F,...Xe})}catch(Xe){console.log("Save failed:",Xe)}},Le=()=>Se(P1,{valueType:j,valueProps:{...H,onBlur:J,onPressEnter:J},inputRef:q});let et=R;return v&&(et=Se(Ye.Form.Item,{style:{margin:0},initialValue:F[_],name:_,rules:C,children:Le()})),Se("td",{children:et})}function sb(h){const{columns:g,onChange:v,...R}=h,_={body:{row:ub,cell:ob}},F=g==null?void 0:g.map(C=>C.editable?{...C,onCell:K=>({...C,record:K,onChange:v})}:C);return Se(Ye.Table,{...R,components:_,rowClassName:()=>lb.editableRow,columns:F})}const $1=h=>{const{auth:g=!0,...v}=h;return g?Se(Ye.Button,{...v}):null},cb=h=>{const{PId:g,auths:v,...R}=h,_=it.useMemo(()=>!!(v&&v.find(F=>F.PId===g)),[g,v]);return Se($1,{...R,auth:_})},_n={main:"workflownode-module_main_dce7f",item:"workflownode-module_item_73d7c",tail:"workflownode-module_tail_3cb51",node:"workflownode-module_node_005fd",content:"workflownode-module_content_8334f",collpase:"workflownode-module_collpase_f2468",btn:"workflownode-module_btn_b0c06",title:"workflownode-module_title_cb34c",dateWrapper:"workflownode-module_dateWrapper_94849",remark:"workflownode-module_remark_4f910",itemActive:"workflownode-module_itemActive_2a29d",itemDone:"workflownode-module_itemDone_489bc",itemUnDo:"workflownode-module_itemUnDo_2914c"},fb=h=>{const{data:g,current:v}=h,[R,_]=it.useState(!1),F=it.useMemo(()=>!v||g.length===0?0:g.findIndex(H=>H.PNId===v),[v,g]),C=it.useMemo(()=>F>1?R?0:F-1:0,[F,R]),K=()=>{_(!0)};return mn("ul",{className:_n.main,children:[F>1&&!R&&mn("li",{className:kf(_n.item,_n.itemDone),children:[Se("div",{className:_n.tail}),Se("div",{className:_n.node}),Se("div",{className:_n.content,children:mn("div",{className:_n.collpase,children:[mn("div",{children:["已收起",Se("span",{children:F-1}),"个节点"]}),mn("a",{className:_n.btn,onClick:K,children:["展开节点",Se(kR,{})]})]})})]}),g.slice(C).map((j,H)=>mn("li",{className:kf(_n.item,F===H+C?_n.itemActive:F>H+C?_n.itemDone:_n.itemUnDo),children:[Se("div",{className:_n.tail}),Se("div",{className:_n.node}),mn("div",{className:_n.content,children:[Se("div",{className:_n.title,children:j.PNName}),mn("div",{className:_n.dateWrapper,children:[j.PlanFinishDate&&mn("span",{children:["预计完成时间: ",j.PlanFinishDate]}),j.UpdateTime&&mn("span",{style:{color:"#333",fontWeight:"bold"},children:["实际完成时间: ",j.UpdateTime]}),R&&F-1===H&&mn("a",{className:_n.btn,onClick:()=>_(!1),children:["收起节点 ",Se(LR,{})]})]}),j.Remark&&Se("div",{className:_n.remark,children:j.Remark})]})]},j.PNId))]})},db=h=>{const{current:g,data:v,...R}=h;return(()=>{Ye.Modal.info({icon:null,title:"流程节点",width:700,content:Se(fb,{current:g,data:v}),closable:!0,footer:null,maskClosable:!0,...R})})(),null},pb=(h,g)=>{const v=new URL(h),R=new URL(g);return v.protocol===R.protocol&&v.host===R.host&&v.port===R.port},vb=h=>{const g=new URL(h).href.split("/");return g[g.length-1]},hb=h=>{var v;return(v=h.headers.get("content-disposition"))==null?void 0:v.split(";")[1].split("=")[1]},mb=(h,g)=>{const v=g||vb(h);if(pb(h,window.location.href)){Cy(h,v);return}let R=g;fetch(h,{method:"get"}).then(_=>(R||(R=hb(_)),_.blob())).then(_=>{Y1(_,R||v)}).catch(()=>{Cy(h,"")})},yb=h=>{for(var g=h.split(","),v=g[0].match(/:(.*?);/)[1],R=window.atob(g[1]),_=R.length,F=new Uint8Array(_);_--;)F[_]=R.charCodeAt(_);return new Blob([F],{type:v})},Y1=(h,g)=>{let v="";h instanceof Blob?v=window.URL.createObjectURL(h):v=window.URL.createObjectURL(yb(h));const R=window.navigator;if(R.msSaveOrOpenBlob){R.msSaveOrOpenBlob(h,g);return}Cy(v,g),window.URL.revokeObjectURL(v)},Cy=(h,g)=>{let v=document.createElement("a");v.style.display="none",v.href=h,v.target="_blank",v.download=g,document.body.appendChild(v),v.click(),document.body.removeChild(v)},gb=Object.freeze(Object.defineProperty({__proto__:null,downloadUrl:mb,downloadBlob:Y1},Symbol.toStringTag,{value:"Module"}));class Sb{constructor(g){xw(this,"options",{id:"",canvasId:"verifyCanvas",width:100,height:30,type:"blend",code:""});this.options=g}GVerify(){this.options.numArr="0,1,2,3,4,5,6,7,8,9".split(","),this.options.letterArr=this.getAllLetter(),this._init(),this.refresh()}_init(){const g=document.getElementById(this.options.id),v=document.createElement("canvas");v.id=this.options.canvasId,v.width=Number(this.options.width),v.height=Number(this.options.height),v.style.cursor="pointer",v.innerHTML="您的浏览器版本不支持canvas",g&&g.appendChild(v),v.onclick=()=>{this.refresh()}}refresh(){this.options.code="";const g=document.getElementById(this.options.canvasId);let v,R=[];if(g.getContext)v=g.getContext("2d");else return;v.textBaseline="middle",v.fillStyle=this.randomColor(180,240),v.fillRect(0,0,this.options.width,this.options.height),this.options.type=="blend"?R=this.options.numArr.concat(this.options.letterArr):this.options.type=="number"?R=this.options.numArr:R=this.options.letterArr;for(let _=1;_<=4;_++){const F=R[this.randomNum(0,R.length)];this.options.code+=F,v.font="20px SimHei",v.fillStyle=this.randomColor(50,160),v.shadowBlur=this.randomNum(-3,3),v.shadowColor="rgba(0, 0, 0, 0.3)";const C=Number(this.options.width)/5*_,K=Number(this.options.height)/2,j=this.randomNum(-30,30);v.translate(C,K),v.rotate(j*Math.PI/180),v.fillText(F,0,0),v.rotate(-j*Math.PI/180),v.translate(-C,-K)}for(let _=0;_<2;_++)v.strokeStyle=this.randomColor(40,180),v.beginPath(),v.moveTo(this.randomNum(0,Number(this.options.width)/2),this.randomNum(0,Number(this.options.height)/2)),v.lineTo(this.randomNum(0,Number(this.options.width)/2),this.randomNum(0,Number(this.options.height))),v.stroke();for(let _=0;_<Number(this.options.width)/10;_++)v.fillStyle=this.randomColor(0,255),v.beginPath(),v.arc(this.randomNum(0,this.options.width),this.randomNum(0,this.options.height),1,0,2*Math.PI),v.fill()}validate(g){const v=g.toLowerCase(),R=this.options.code.toLowerCase();return v==R}getAllLetter(){return"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z".split(",")}randomNum(g,v){return Math.floor(Math.random()*(v-g)+g)}randomColor(g,v){const R=this.randomNum(g,v),_=this.randomNum(g,v),F=this.randomNum(g,v);return"rgb("+R+","+_+","+F+")"}}const Cb=Object.freeze(Object.defineProperty({__proto__:null,getGVerify:Sb},Symbol.toStringTag,{value:"Module"}));_t.AuthButton=$1,_t.BackHeader=jR,_t.CoralButton=cb,_t.CreateForm=B1,_t.EditTable=sb,_t.SearchTable=ib,_t.UploadFile=j1,_t.download=gb,_t.fileType=VR,_t.showWorkFlow=db,_t.utils=XR,_t.verfyCode=Cb,Object.defineProperty(_t,Symbol.toStringTag,{value:"Module"})});
@@ -12,6 +12,7 @@ const EditableRow = ({ index, ...props }) => {
12
12
  return /* @__PURE__ */ jsx(Form, { form, component: false, children: /* @__PURE__ */ jsx(EditableContext.Provider, { value: form, children: /* @__PURE__ */ jsx("tr", { ...props }) }) });
13
13
  };
14
14
  function EditableCell(props) {
15
+ console.log(props, "props");
15
16
  const {
16
17
  title,
17
18
  editable,
@@ -91,11 +91,11 @@ const UploadFile = (props) => {
91
91
  /* @__PURE__ */ jsx(
92
92
  Upload,
93
93
  {
94
- ...props,
95
- onPreview: isPropsPreview,
96
94
  beforeUpload,
97
95
  onChange,
98
96
  listType,
97
+ ...props,
98
+ onPreview: isPropsPreview,
99
99
  children: fileList.length >= maxCount ? null : uploadButton()
100
100
  }
101
101
  ),
@@ -1,5 +1,5 @@
1
- import { jsx, Fragment } from "react/jsx-runtime";
2
- import { Table, Form, Input } from "antd";
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Table } from "antd";
3
3
  import classNames from "classnames";
4
4
  import ResizeObserver from "rc-resize-observer";
5
5
  import { useState, useRef, useEffect } from "react";
@@ -54,6 +54,9 @@ function VirtualTable(props) {
54
54
  });
55
55
  };
56
56
  useEffect(() => resetVirtualGrid, [tableWidth]);
57
+ const renderCell = (data, column, columnIndex) => {
58
+ return column.render ? column.render(data[column.dataIndex], data, columnIndex) : data[column.dataIndex];
59
+ };
57
60
  const renderVirtualList = (rawData, { scrollbarSize, ref, onScroll }) => {
58
61
  ref.current = connectObject;
59
62
  const totalHeight = rawData.length * 54;
@@ -85,13 +88,10 @@ function VirtualTable(props) {
85
88
  [classes.cellLast]: columnIndex === mergedColumns.length - 1
86
89
  }),
87
90
  style,
88
- children: /* @__PURE__ */ jsx(
89
- EditableCell,
90
- {
91
- data: rawData[rowIndex],
92
- onChange,
93
- column: mergedColumns[columnIndex]
94
- }
91
+ children: renderCell(
92
+ rawData[rowIndex],
93
+ mergedColumns[columnIndex],
94
+ columnIndex
95
95
  )
96
96
  }
97
97
  )
@@ -120,53 +120,6 @@ function VirtualTable(props) {
120
120
  }
121
121
  );
122
122
  }
123
- function EditableCell(props) {
124
- const { column, data, onChange } = props;
125
- const [editing, setEditing] = useState(false);
126
- const inputRef = useRef(null);
127
- const [form] = Form.useForm();
128
- useEffect(() => {
129
- if (editing) {
130
- inputRef.current.focus();
131
- }
132
- }, [editing]);
133
- const save = async () => {
134
- try {
135
- const values = await form.validateFields();
136
- toggleEdit();
137
- onChange && onChange({ ...data, ...values });
138
- } catch (errInfo) {
139
- console.log("Save failed:", errInfo);
140
- }
141
- };
142
- const toggleEdit = () => {
143
- setEditing(!editing);
144
- if (column.dataIndex) {
145
- form.setFieldsValue({ [column.dataIndex]: data[column.dataIndex] });
146
- }
147
- };
148
- let childNode = data[column.dataIndex];
149
- if (column.editable) {
150
- childNode = editing ? /* @__PURE__ */ jsx(Form, { form, className: classes.editForm, children: /* @__PURE__ */ jsx(
151
- Form.Item,
152
- {
153
- style: { margin: 0 },
154
- name: column.dataIndex,
155
- rules: column.rules,
156
- children: /* @__PURE__ */ jsx(
157
- Input,
158
- {
159
- ref: inputRef,
160
- onPressEnter: save,
161
- onBlur: save,
162
- ...column.inputProps
163
- }
164
- )
165
- }
166
- ) }) : /* @__PURE__ */ jsx("div", { className: classes.editBox, onClick: toggleEdit, children: data[column.dataIndex] });
167
- }
168
- return /* @__PURE__ */ jsx(Fragment, { children: childNode });
169
- }
170
123
  export {
171
124
  VirtualTable as default
172
125
  };
package/es/index.js CHANGED
@@ -1,13 +1,12 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
3
  import ReactDOM from "react-dom/client";
4
4
  import { BrowserRouter } from "react-router-dom";
5
- import { BackHeader, AuthButton, SearchTable, UploadFile } from "./main";
6
- import CoralButton from "./components/CoralButton";
7
- import { Form, Space, Input, Button } from "antd";
5
+ import { EditTable } from "./main";
6
+ import { Form } from "antd";
8
7
  const Demo = () => {
9
- const [form] = Form.useForm();
10
- useState([
8
+ Form.useForm();
9
+ const [list, setList] = useState([
11
10
  {
12
11
  PNOrderNo: 1,
13
12
  PNName: "未分配",
@@ -27,6 +26,40 @@ const Demo = () => {
27
26
  Remark: ""
28
27
  }
29
28
  ]);
29
+ const columns = [
30
+ {
31
+ dataIndex: "PNOrderNo",
32
+ title: "序号",
33
+ width: 80
34
+ },
35
+ {
36
+ dataIndex: "PNName",
37
+ title: "节点名称"
38
+ },
39
+ {
40
+ dataIndex: "PlanFinishDate",
41
+ title: "预计完成时间",
42
+ editable: true,
43
+ width: 400,
44
+ type: "datePicker",
45
+ valueProps: {
46
+ placeholder: "请输入内容"
47
+ }
48
+ },
49
+ {
50
+ dataIndex: "Remark",
51
+ title: "备注",
52
+ editable: true,
53
+ type: "textarea",
54
+ width: 400,
55
+ valueProps: {
56
+ placeholder: "请输入内容",
57
+ autoSize: {
58
+ minRows: 3
59
+ }
60
+ }
61
+ }
62
+ ];
30
63
  useState(
31
64
  Array.from({ length: 1e5 }, (_, key) => ({
32
65
  key,
@@ -55,103 +88,18 @@ const Demo = () => {
55
88
  url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
56
89
  }
57
90
  ]);
58
- return /* @__PURE__ */ jsxs("div", { style: { height: "100vh" }, children: [
59
- /* @__PURE__ */ jsx(BackHeader, { title: "标题111", subTitle: /* @__PURE__ */ jsx("span", { children: "副标题" }) }),
60
- /* @__PURE__ */ jsx(AuthButton, { type: "primary", children: "按钮1" }),
61
- /* @__PURE__ */ jsx(CoralButton, { PId: 100, auths: [{ PId: 100 }], children: "123" }),
62
- /* @__PURE__ */ jsx(
63
- SearchTable,
64
- {
65
- searchProps: {
66
- items: [
67
- {
68
- dataIndex: "name",
69
- valueProps: {
70
- placeholder: "名称"
71
- },
72
- colProps: {
73
- span: 6
74
- }
75
- },
76
- {
77
- valueType: "custom",
78
- valueProps: {
79
- children: /* @__PURE__ */ jsxs(Space, { children: [
80
- /* @__PURE__ */ jsx(Form.Item, { name: "yzm", noStyle: true, children: /* @__PURE__ */ jsx(Input, { placeholder: "请输入验证码" }) }),
81
- /* @__PURE__ */ jsx(Button, { children: "发送验证码" })
82
- ] })
83
- },
84
- colProps: {
85
- span: 6
86
- }
87
- },
88
- {
89
- dataIndex: "mm",
90
- valueType: "password",
91
- colProps: {
92
- span: 6
93
- }
94
- },
95
- {
96
- dataIndex: "pic",
97
- valueType: "upload",
98
- valueProps: {
99
- maxCount: 1
100
- },
101
- colProps: {
102
- span: 12
103
- }
104
- },
105
- {
106
- dataIndex: "pic2",
107
- colProps: {
108
- span: 12
109
- }
110
- },
111
- {
112
- dataIndex: "qwe",
113
- valueProps: {
114
- placeholder: "name"
115
- },
116
- colProps: {
117
- span: 12
118
- }
119
- },
120
- {
121
- dataIndex: "btns",
122
- valueType: "btns",
123
- valueProps: [
124
- {
125
- btnType: "submit",
126
- title: "确定",
127
- type: "primary",
128
- onClick: (v) => console.log(v)
129
- }
130
- ]
131
- }
132
- ],
133
- formProps: { wrapperCol: { span: 24 }, form }
134
- },
135
- tableProps: {
136
- columns: [
137
- { dataIndex: "A", title: "A" },
138
- { dataIndex: "B", title: "B", hidden: true }
139
- ],
140
- pagination: false,
141
- rowKey: "A",
142
- dataSource: Array(3).fill(0).map((v, i) => ({ A: i + 1 }))
143
- }
144
- }
145
- ),
146
- /* @__PURE__ */ jsx(
147
- UploadFile,
148
- {
149
- uploadBtnName: "上传图片",
150
- accept: ".zip,.jpg,.png",
151
- uploadHint: /* @__PURE__ */ jsx("span", { style: { position: "absolute", left: "100px", top: "20px" }, children: "11111111111111111111111111111" })
152
- }
153
- )
154
- ] });
91
+ return /* @__PURE__ */ jsx("div", { style: { height: "100vh" }, children: /* @__PURE__ */ jsx(
92
+ EditTable,
93
+ {
94
+ columns,
95
+ rowKey: "PNOrderNo",
96
+ onChange: (row) => {
97
+ console.log(row);
98
+ },
99
+ dataSource: list,
100
+ pagination: false
101
+ }
102
+ ) });
155
103
  };
156
104
  ReactDOM.createRoot(document.getElementById("root")).render(
157
105
  /* @__PURE__ */ jsx(BrowserRouter, { children: /* @__PURE__ */ jsx(Demo, {}) })
@@ -13,6 +13,7 @@ const EditableRow = ({ index, ...props }) => {
13
13
  return /* @__PURE__ */ jsxRuntime.jsx(antd.Form, { form, component: false, children: /* @__PURE__ */ jsxRuntime.jsx(EditableContext.Provider, { value: form, children: /* @__PURE__ */ jsxRuntime.jsx("tr", { ...props }) }) });
14
14
  };
15
15
  function EditableCell(props) {
16
+ console.log(props, "props");
16
17
  const {
17
18
  title,
18
19
  editable,
@@ -92,11 +92,11 @@ const UploadFile = (props) => {
92
92
  /* @__PURE__ */ jsxRuntime.jsx(
93
93
  antd.Upload,
94
94
  {
95
- ...props,
96
- onPreview: isPropsPreview,
97
95
  beforeUpload,
98
96
  onChange,
99
97
  listType,
98
+ ...props,
99
+ onPreview: isPropsPreview,
100
100
  children: fileList.length >= maxCount ? null : uploadButton()
101
101
  }
102
102
  ),
@@ -55,6 +55,9 @@ function VirtualTable(props) {
55
55
  });
56
56
  };
57
57
  react.useEffect(() => resetVirtualGrid, [tableWidth]);
58
+ const renderCell = (data, column, columnIndex) => {
59
+ return column.render ? column.render(data[column.dataIndex], data, columnIndex) : data[column.dataIndex];
60
+ };
58
61
  const renderVirtualList = (rawData, { scrollbarSize, ref, onScroll }) => {
59
62
  ref.current = connectObject;
60
63
  const totalHeight = rawData.length * 54;
@@ -86,13 +89,10 @@ function VirtualTable(props) {
86
89
  [classes.cellLast]: columnIndex === mergedColumns.length - 1
87
90
  }),
88
91
  style,
89
- children: /* @__PURE__ */ jsxRuntime.jsx(
90
- EditableCell,
91
- {
92
- data: rawData[rowIndex],
93
- onChange,
94
- column: mergedColumns[columnIndex]
95
- }
92
+ children: renderCell(
93
+ rawData[rowIndex],
94
+ mergedColumns[columnIndex],
95
+ columnIndex
96
96
  )
97
97
  }
98
98
  )
@@ -121,51 +121,4 @@ function VirtualTable(props) {
121
121
  }
122
122
  );
123
123
  }
124
- function EditableCell(props) {
125
- const { column, data, onChange } = props;
126
- const [editing, setEditing] = react.useState(false);
127
- const inputRef = react.useRef(null);
128
- const [form] = antd.Form.useForm();
129
- react.useEffect(() => {
130
- if (editing) {
131
- inputRef.current.focus();
132
- }
133
- }, [editing]);
134
- const save = async () => {
135
- try {
136
- const values = await form.validateFields();
137
- toggleEdit();
138
- onChange && onChange({ ...data, ...values });
139
- } catch (errInfo) {
140
- console.log("Save failed:", errInfo);
141
- }
142
- };
143
- const toggleEdit = () => {
144
- setEditing(!editing);
145
- if (column.dataIndex) {
146
- form.setFieldsValue({ [column.dataIndex]: data[column.dataIndex] });
147
- }
148
- };
149
- let childNode = data[column.dataIndex];
150
- if (column.editable) {
151
- childNode = editing ? /* @__PURE__ */ jsxRuntime.jsx(antd.Form, { form, className: classes.editForm, children: /* @__PURE__ */ jsxRuntime.jsx(
152
- antd.Form.Item,
153
- {
154
- style: { margin: 0 },
155
- name: column.dataIndex,
156
- rules: column.rules,
157
- children: /* @__PURE__ */ jsxRuntime.jsx(
158
- antd.Input,
159
- {
160
- ref: inputRef,
161
- onPressEnter: save,
162
- onBlur: save,
163
- ...column.inputProps
164
- }
165
- )
166
- }
167
- ) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes.editBox, onClick: toggleEdit, children: data[column.dataIndex] });
168
- }
169
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: childNode });
170
- }
171
124
  module.exports = VirtualTable;
package/lib/index.js CHANGED
@@ -4,11 +4,10 @@ const react = require("react");
4
4
  const ReactDOM = require("react-dom/client");
5
5
  const reactRouterDom = require("react-router-dom");
6
6
  const main = require("./main");
7
- const CoralButton = require("./components/CoralButton");
8
7
  const antd = require("antd");
9
8
  const Demo = () => {
10
- const [form] = antd.Form.useForm();
11
- react.useState([
9
+ antd.Form.useForm();
10
+ const [list, setList] = react.useState([
12
11
  {
13
12
  PNOrderNo: 1,
14
13
  PNName: "未分配",
@@ -28,6 +27,40 @@ const Demo = () => {
28
27
  Remark: ""
29
28
  }
30
29
  ]);
30
+ const columns = [
31
+ {
32
+ dataIndex: "PNOrderNo",
33
+ title: "序号",
34
+ width: 80
35
+ },
36
+ {
37
+ dataIndex: "PNName",
38
+ title: "节点名称"
39
+ },
40
+ {
41
+ dataIndex: "PlanFinishDate",
42
+ title: "预计完成时间",
43
+ editable: true,
44
+ width: 400,
45
+ type: "datePicker",
46
+ valueProps: {
47
+ placeholder: "请输入内容"
48
+ }
49
+ },
50
+ {
51
+ dataIndex: "Remark",
52
+ title: "备注",
53
+ editable: true,
54
+ type: "textarea",
55
+ width: 400,
56
+ valueProps: {
57
+ placeholder: "请输入内容",
58
+ autoSize: {
59
+ minRows: 3
60
+ }
61
+ }
62
+ }
63
+ ];
31
64
  react.useState(
32
65
  Array.from({ length: 1e5 }, (_, key) => ({
33
66
  key,
@@ -56,103 +89,18 @@ const Demo = () => {
56
89
  url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
57
90
  }
58
91
  ]);
59
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { height: "100vh" }, children: [
60
- /* @__PURE__ */ jsxRuntime.jsx(main.BackHeader, { title: "标题111", subTitle: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "副标题" }) }),
61
- /* @__PURE__ */ jsxRuntime.jsx(main.AuthButton, { type: "primary", children: "按钮1" }),
62
- /* @__PURE__ */ jsxRuntime.jsx(CoralButton, { PId: 100, auths: [{ PId: 100 }], children: "123" }),
63
- /* @__PURE__ */ jsxRuntime.jsx(
64
- main.SearchTable,
65
- {
66
- searchProps: {
67
- items: [
68
- {
69
- dataIndex: "name",
70
- valueProps: {
71
- placeholder: "名称"
72
- },
73
- colProps: {
74
- span: 6
75
- }
76
- },
77
- {
78
- valueType: "custom",
79
- valueProps: {
80
- children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { children: [
81
- /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { name: "yzm", noStyle: true, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Input, { placeholder: "请输入验证码" }) }),
82
- /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { children: "发送验证码" })
83
- ] })
84
- },
85
- colProps: {
86
- span: 6
87
- }
88
- },
89
- {
90
- dataIndex: "mm",
91
- valueType: "password",
92
- colProps: {
93
- span: 6
94
- }
95
- },
96
- {
97
- dataIndex: "pic",
98
- valueType: "upload",
99
- valueProps: {
100
- maxCount: 1
101
- },
102
- colProps: {
103
- span: 12
104
- }
105
- },
106
- {
107
- dataIndex: "pic2",
108
- colProps: {
109
- span: 12
110
- }
111
- },
112
- {
113
- dataIndex: "qwe",
114
- valueProps: {
115
- placeholder: "name"
116
- },
117
- colProps: {
118
- span: 12
119
- }
120
- },
121
- {
122
- dataIndex: "btns",
123
- valueType: "btns",
124
- valueProps: [
125
- {
126
- btnType: "submit",
127
- title: "确定",
128
- type: "primary",
129
- onClick: (v) => console.log(v)
130
- }
131
- ]
132
- }
133
- ],
134
- formProps: { wrapperCol: { span: 24 }, form }
135
- },
136
- tableProps: {
137
- columns: [
138
- { dataIndex: "A", title: "A" },
139
- { dataIndex: "B", title: "B", hidden: true }
140
- ],
141
- pagination: false,
142
- rowKey: "A",
143
- dataSource: Array(3).fill(0).map((v, i) => ({ A: i + 1 }))
144
- }
145
- }
146
- ),
147
- /* @__PURE__ */ jsxRuntime.jsx(
148
- main.UploadFile,
149
- {
150
- uploadBtnName: "上传图片",
151
- accept: ".zip,.jpg,.png",
152
- uploadHint: /* @__PURE__ */ jsxRuntime.jsx("span", { style: { position: "absolute", left: "100px", top: "20px" }, children: "11111111111111111111111111111" })
153
- }
154
- )
155
- ] });
92
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: "100vh" }, children: /* @__PURE__ */ jsxRuntime.jsx(
93
+ main.EditTable,
94
+ {
95
+ columns,
96
+ rowKey: "PNOrderNo",
97
+ onChange: (row) => {
98
+ console.log(row);
99
+ },
100
+ dataSource: list,
101
+ pagination: false
102
+ }
103
+ ) });
156
104
  };
157
105
  ReactDOM.createRoot(document.getElementById("root")).render(
158
106
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.BrowserRouter, { children: /* @__PURE__ */ jsxRuntime.jsx(Demo, {}) })
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "szld-libs",
3
3
  "private": false,
4
- "version": "0.1.3",
4
+ "version": "0.1.5",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -15,7 +15,8 @@
15
15
  "lodash": "^4.17.21",
16
16
  "react": "^18.2.0",
17
17
  "react-dom": "^18.2.0",
18
- "react-router-dom": "^6.6.1"
18
+ "react-router-dom": "^6.6.1",
19
+ "react-window": "^1.8.9"
19
20
  },
20
21
  "devDependencies": {
21
22
  "@types/lodash": "^4.14.191",