lu-lowcode-package-form 0.11.36 → 0.11.37
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.
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +2735 -2735
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/App.jsx +3 -3
- package/src/components/field/base.jsx +49 -34
package/dist/index.cjs.js
CHANGED
@@ -339,7 +339,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
339
339
|
${n}-eye,
|
340
340
|
${n}-download,
|
341
341
|
${n}-delete
|
342
|
-
`]:{zIndex:10,width:r,margin:`0 ${Be(e.marginXXS)}`,fontSize:r,cursor:"pointer",transition:`all ${e.motionDurationSlow}`,color:o,"&:hover":{color:o},svg:{verticalAlign:"baseline"}}},[`${s}-thumbnail, ${s}-thumbnail img`]:{position:"static",display:"block",width:"100%",height:"100%",objectFit:"contain"},[`${s}-name`]:{display:"none",textAlign:"center"},[`${s}-file + ${s}-name`]:{position:"absolute",bottom:e.margin,display:"block",width:`calc(100% - ${Be(i(e.paddingXS).mul(2).equal())})`},[`${s}-uploading`]:{[`&${s}`]:{backgroundColor:e.colorFillAlter},[`&::before, ${n}-eye, ${n}-download, ${n}-delete`]:{display:"none"}},[`${s}-progress`]:{bottom:e.marginXL,width:`calc(100% - ${Be(i(e.paddingXS).mul(2).equal())})`,paddingInlineStart:0}}}),[`${t}-wrapper${t}-picture-circle-wrapper`]:{[`${t}${t}-select`]:{borderRadius:"50%"}}}},olt=e=>{const{componentCls:t}=e;return{[`${t}-rtl`]:{direction:"rtl"}}},ilt=e=>{const{componentCls:t,colorTextDisabled:n}=e;return{[`${t}-wrapper`]:Object.assign(Object.assign({},Kr(e)),{[t]:{outline:0,"input[type='file']":{cursor:"pointer"}},[`${t}-select`]:{display:"inline-block"},[`${t}-hidden`]:{display:"none"},[`${t}-disabled`]:{color:n,cursor:"not-allowed"}})}},alt=e=>({actionsColor:e.colorTextDescription}),slt=to("Upload",e=>{const{fontSizeHeading3:t,fontHeight:n,lineWidth:r,controlHeightLG:o,calc:i}=e,a=rr(e,{uploadThumbnailSize:i(t).mul(2).equal(),uploadProgressOffset:i(i(n).div(2)).add(r).equal(),uploadPicCardSize:i(o).mul(2.55).equal()});return[ilt(a),Jst(a),nlt(a),rlt(a),elt(a),tlt(a),olt(a),ZH(a)]},alt);function mx(e){return Object.assign(Object.assign({},e),{lastModified:e.lastModified,lastModifiedDate:e.lastModifiedDate,name:e.name,size:e.size,type:e.type,uid:e.uid,percent:0,originFileObj:e})}function yx(e,t){const n=vt(t),r=n.findIndex(o=>{let{uid:i}=o;return i===e.uid});return r===-1?n.push(e):n[r]=e,n}function X5(e,t){const n=e.uid!==void 0?"uid":"name";return t.filter(r=>r[n]===e[n])[0]}function llt(e,t){const n=e.uid!==void 0?"uid":"name",r=t.filter(o=>o[n]!==e[n]);return r.length===t.length?null:r}const ult=function(){const t=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:"").split("/"),r=t[t.length-1].split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(r)||[""])[0]},hTe=e=>e.indexOf("image/")===0,clt=e=>{if(e.type&&!e.thumbUrl)return hTe(e.type);const t=e.thumbUrl||e.url||"",n=ult(t);return/^data:image\//.test(t)||/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico|heic|heif)$/i.test(n)?!0:!(/^data:/.test(t)||n)},Ff=200;function flt(e){return new Promise(t=>{if(!e.type||!hTe(e.type)){t("");return}const n=document.createElement("canvas");n.width=Ff,n.height=Ff,n.style.cssText=`position: fixed; left: 0; top: 0; width: ${Ff}px; height: ${Ff}px; z-index: 9999; display: none;`,document.body.appendChild(n);const r=n.getContext("2d"),o=new Image;if(o.onload=()=>{const{width:i,height:a}=o;let s=Ff,l=Ff,u=0,c=0;i>a?(l=a*(Ff/i),c=-(l-s)/2):(s=i*(Ff/a),u=-(s-l)/2),r.drawImage(o,u,c,s,l);const f=n.toDataURL();document.body.removeChild(n),window.URL.revokeObjectURL(o.src),t(f)},o.crossOrigin="anonymous",e.type.startsWith("image/svg+xml")){const i=new FileReader;i.onload=()=>{i.result&&typeof i.result=="string"&&(o.src=i.result)},i.readAsDataURL(e)}else if(e.type.startsWith("image/gif")){const i=new FileReader;i.onload=()=>{i.result&&t(i.result)},i.readAsDataURL(e)}else o.src=window.URL.createObjectURL(e)})}const dlt=$.forwardRef((e,t)=>{let{prefixCls:n,className:r,style:o,locale:i,listType:a,file:s,items:l,progress:u,iconRender:c,actionIconRender:f,itemRender:d,isImgUrl:p,showPreviewIcon:g,showRemoveIcon:m,showDownloadIcon:h,previewIcon:y,removeIcon:v,downloadIcon:b,extra:C,onPreview:E,onDownload:S,onClose:w}=e;var x,O;const{status:T}=s,[A,N]=$.useState(T);$.useEffect(()=>{T!=="removed"&&N(T)},[T]);const[I,R]=$.useState(!1);$.useEffect(()=>{const re=setTimeout(()=>{R(!0)},300);return()=>{clearTimeout(re)}},[]);const F=c(s);let B=$.createElement("div",{className:`${n}-icon`},F);if(a==="picture"||a==="picture-card"||a==="picture-circle")if(A==="uploading"||!s.thumbUrl&&!s.url){const re=Pe(`${n}-list-item-thumbnail`,{[`${n}-list-item-file`]:A!=="uploading"});B=$.createElement("div",{className:re},F)}else{const re=p!=null&&p(s)?$.createElement("img",{src:s.thumbUrl||s.url,alt:s.name,className:`${n}-list-item-image`,crossOrigin:s.crossOrigin}):F,G=Pe(`${n}-list-item-thumbnail`,{[`${n}-list-item-file`]:p&&!p(s)});B=$.createElement("a",{className:G,onClick:Q=>E(s,Q),href:s.url||s.thumbUrl,target:"_blank",rel:"noopener noreferrer"},re)}const L=Pe(`${n}-list-item`,`${n}-list-item-${A}`),z=typeof s.linkProps=="string"?JSON.parse(s.linkProps):s.linkProps,H=(typeof m=="function"?m(s):m)?f((typeof v=="function"?v(s):v)||$.createElement(H3e,null),()=>w(s),n,i.removeFile,!0):null,k=(typeof h=="function"?h(s):h)&&A==="done"?f((typeof b=="function"?b(s):b)||$.createElement(z3e,null),()=>S(s),n,i.downloadFile):null,M=a!=="picture-card"&&a!=="picture-circle"&&$.createElement("span",{key:"download-delete",className:Pe(`${n}-list-item-actions`,{picture:a==="picture"})},k,H),j=typeof C=="function"?C(s):C,_=j&&$.createElement("span",{className:`${n}-list-item-extra`},j),V=Pe(`${n}-list-item-name`),K=s.url?$.createElement("a",Object.assign({key:"view",target:"_blank",rel:"noopener noreferrer",className:V,title:s.name},z,{href:s.url,onClick:re=>E(s,re)}),s.name,_):$.createElement("span",{key:"view",className:V,onClick:re=>E(s,re),title:s.name},s.name,_),W=(typeof g=="function"?g(s):g)&&(s.url||s.thumbUrl)?$.createElement("a",{href:s.url||s.thumbUrl,target:"_blank",rel:"noopener noreferrer",onClick:re=>E(s,re),title:i.previewFile},typeof y=="function"?y(s):y||$.createElement(KT,null)):null,Y=(a==="picture-card"||a==="picture-circle")&&A!=="uploading"&&$.createElement("span",{className:`${n}-list-item-actions`},W,A==="done"&&k,H),{getPrefixCls:X}=$.useContext(Nn),Z=X(),ee=$.createElement("div",{className:L},B,K,M,Y,I&&$.createElement(ns,{motionName:`${Z}-fade`,visible:A==="uploading",motionDeadline:2e3},re=>{let{className:G}=re;const Q="percent"in s?$.createElement(L3e,Object.assign({},u,{type:"line",percent:s.percent,"aria-label":s["aria-label"],"aria-labelledby":s["aria-labelledby"]})):null;return $.createElement("div",{className:Pe(`${n}-list-item-progress`,G)},Q)})),ne=s.response&&typeof s.response=="string"?s.response:((x=s.error)===null||x===void 0?void 0:x.statusText)||((O=s.error)===null||O===void 0?void 0:O.message)||i.uploadError,te=A==="error"?$.createElement(ay,{title:ne,getPopupContainer:re=>re.parentNode},ee):ee;return $.createElement("div",{className:Pe(`${n}-list-item-container`,r),style:o,ref:t},d?d(te,s,l,{download:S.bind(null,s),preview:E.bind(null,s),remove:w.bind(null,s)}):te)}),plt=(e,t)=>{const{listType:n="text",previewFile:r=flt,onPreview:o,onDownload:i,onRemove:a,locale:s,iconRender:l,isImageUrl:u=clt,prefixCls:c,items:f=[],showPreviewIcon:d=!0,showRemoveIcon:p=!0,showDownloadIcon:g=!1,removeIcon:m,previewIcon:h,downloadIcon:y,extra:v,progress:b={size:[-1,2],showInfo:!1},appendAction:C,appendActionVisible:E=!0,itemRender:S,disabled:w}=e,x=rDe(),[O,T]=$.useState(!1),A=["picture-card","picture-circle"].includes(n);$.useEffect(()=>{n.startsWith("picture")&&(f||[]).forEach(_=>{!(_.originFileObj instanceof File||_.originFileObj instanceof Blob)||_.thumbUrl!==void 0||(_.thumbUrl="",r==null||r(_.originFileObj).then(V=>{_.thumbUrl=V||"",x()}))})},[n,f,r]),$.useEffect(()=>{T(!0)},[]);const N=(_,V)=>{if(o)return V==null||V.preventDefault(),o(_)},I=_=>{typeof i=="function"?i(_):_.url&&window.open(_.url)},R=_=>{a==null||a(_)},F=_=>{if(l)return l(_,n);const V=_.status==="uploading";if(n.startsWith("picture")){const K=n==="picture"?$.createElement(_d,null):s.uploading,W=u!=null&&u(_)?$.createElement(X3e,null):$.createElement(V3e,null);return V?K:W}return V?$.createElement(_d,null):$.createElement(Y3e,null)},B=(_,V,K,W,Y)=>{const X={type:"text",size:"small",title:W,onClick:Z=>{var ee,ne;V(),$.isValidElement(_)&&((ne=(ee=_.props).onClick)===null||ne===void 0||ne.call(ee,Z))},className:`${K}-list-item-action`};return Y&&(X.disabled=w),$.isValidElement(_)?$.createElement(qa,Object.assign({},X,{icon:bl(_,Object.assign(Object.assign({},_.props),{onClick:()=>{}}))})):$.createElement(qa,Object.assign({},X),$.createElement("span",null,_))};$.useImperativeHandle(t,()=>({handlePreview:N,handleDownload:I}));const{getPrefixCls:L}=$.useContext(Nn),z=L("upload",c),H=L(),k=Pe(`${z}-list`,`${z}-list-${n}`),M=$.useMemo(()=>Ho(iD(H),["onAppearEnd","onEnterEnd","onLeaveEnd"]),[H]),j=Object.assign(Object.assign({},A?{}:M),{motionDeadline:2e3,motionName:`${z}-${A?"animate-inline":"animate"}`,keys:vt(f.map(_=>({key:_.uid,file:_}))),motionAppear:O});return $.createElement("div",{className:k},$.createElement(bAe,Object.assign({},j,{component:!1}),_=>{let{key:V,file:K,className:W,style:Y}=_;return $.createElement(dlt,{key:V,locale:s,prefixCls:z,className:W,style:Y,file:K,items:f,progress:b,listType:n,isImgUrl:u,showPreviewIcon:d,showRemoveIcon:p,showDownloadIcon:g,removeIcon:m,previewIcon:h,downloadIcon:y,extra:v,iconRender:F,actionIconRender:B,itemRender:S,onPreview:N,onDownload:I,onClose:R})}),C&&$.createElement(ns,Object.assign({},j,{visible:E,forceRender:!0}),_=>{let{className:V,style:K}=_;return bl(C,W=>({className:Pe(W.className,V),style:Object.assign(Object.assign(Object.assign({},K),{pointerEvents:V?"none":void 0}),W.style)}))}))},vTe=$.forwardRef(plt);process.env.NODE_ENV!=="production"&&(vTe.displayName="UploadList");var hlt=function(e,t,n,r){function o(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function s(c){try{u(r.next(c))}catch(f){a(f)}}function l(c){try{u(r.throw(c))}catch(f){a(f)}}function u(c){c.done?i(c.value):o(c.value).then(s,l)}u((r=r.apply(e,t||[])).next())})};const uC=`__LIST_IGNORE_${Date.now()}__`,vlt=(e,t)=>{const{fileList:n,defaultFileList:r,onRemove:o,showUploadList:i=!0,listType:a="text",onPreview:s,onDownload:l,onChange:u,onDrop:c,previewFile:f,disabled:d,locale:p,iconRender:g,isImageUrl:m,progress:h,prefixCls:y,className:v,type:b="select",children:C,style:E,itemRender:S,maxCount:w,data:x={},multiple:O=!1,hasControlInside:T=!0,action:A="",accept:N="",supportServerRender:I=!0,rootClassName:R}=e,F=$.useContext(Qi),B=d??F,[L,z]=Ar(r||[],{value:n,postState:we=>we??[]}),[H,k]=$.useState("drop"),M=$.useRef(null),j=$.useRef(null);if(process.env.NODE_ENV!=="production"){const we=Or("Upload");process.env.NODE_ENV!=="production"&&we("fileList"in e||!("value"in e),"usage","`value` is not a valid prop, do you mean `fileList`?"),we.deprecated(!("transformFile"in e),"transformFile","beforeUpload")}$.useMemo(()=>{const we=Date.now();(n||[]).forEach((Re,He)=>{!Re.uid&&!Object.isFrozen(Re)&&(Re.uid=`__AUTO__${we}_${He}__`)})},[n]);const _=(we,Re,He)=>{let ge=vt(Re),Ne=!1;w===1?ge=ge.slice(-1):w&&(Ne=ge.length>w,ge=ge.slice(0,w)),Os.flushSync(()=>{z(ge)});const Ve={file:we,fileList:ge};He&&(Ve.event=He),(!Ne||we.status==="removed"||ge.some(tt=>tt.uid===we.uid))&&Os.flushSync(()=>{u==null||u(Ve)})},V=(we,Re)=>hlt(void 0,void 0,void 0,function*(){const{beforeUpload:He,transformFile:ge}=e;let Ne=we;if(He){const Ve=yield He(we,Re);if(Ve===!1)return!1;if(delete we[uC],Ve===uC)return Object.defineProperty(we,uC,{value:!0,configurable:!0}),!1;typeof Ve=="object"&&Ve&&(Ne=Ve)}return ge&&(Ne=yield ge(Ne)),Ne}),K=we=>{const Re=we.filter(Ne=>!Ne.file[uC]);if(!Re.length)return;const He=Re.map(Ne=>mx(Ne.file));let ge=vt(L);He.forEach(Ne=>{ge=yx(Ne,ge)}),He.forEach((Ne,Ve)=>{let tt=Ne;if(Re[Ve].parsedFile)Ne.status="uploading";else{const{originFileObj:gt}=Ne;let lt;try{lt=new File([gt],gt.name,{type:gt.type})}catch{lt=new Blob([gt],{type:gt.type}),lt.name=gt.name,lt.lastModifiedDate=new Date,lt.lastModified=new Date().getTime()}lt.uid=Ne.uid,tt=lt}_(tt,ge)})},W=(we,Re,He)=>{try{typeof we=="string"&&(we=JSON.parse(we))}catch{}if(!X5(Re,L))return;const ge=mx(Re);ge.status="done",ge.percent=100,ge.response=we,ge.xhr=He;const Ne=yx(ge,L);_(ge,Ne)},Y=(we,Re)=>{if(!X5(Re,L))return;const He=mx(Re);He.status="uploading",He.percent=we.percent;const ge=yx(He,L);_(He,ge,we)},X=(we,Re,He)=>{if(!X5(He,L))return;const ge=mx(He);ge.error=we,ge.response=Re,ge.status="error";const Ne=yx(ge,L);_(ge,Ne)},Z=we=>{let Re;Promise.resolve(typeof o=="function"?o(we):o).then(He=>{var ge;if(He===!1)return;const Ne=llt(we,L);Ne&&(Re=Object.assign(Object.assign({},we),{status:"removed"}),L==null||L.forEach(Ve=>{const tt=Re.uid!==void 0?"uid":"name";Ve[tt]===Re[tt]&&!Object.isFrozen(Ve)&&(Ve.status="removed")}),(ge=M.current)===null||ge===void 0||ge.abort(Re),_(Re,Ne))})},ee=we=>{k(we.type),we.type==="drop"&&(c==null||c(we))};$.useImperativeHandle(t,()=>({onBatchStart:K,onSuccess:W,onProgress:Y,onError:X,fileList:L,upload:M.current,nativeElement:j.current}));const{getPrefixCls:ne,direction:te,upload:re}=$.useContext(Nn),G=ne("upload",y),Q=Object.assign(Object.assign({onBatchStart:K,onError:X,onProgress:Y,onSuccess:W},e),{data:x,multiple:O,action:A,accept:N,supportServerRender:I,prefixCls:G,disabled:B,beforeUpload:V,onChange:void 0,hasControlInside:T});delete Q.className,delete Q.style,(!C||B)&&delete Q.id;const oe=`${G}-wrapper`,[le,se,de]=slt(G,oe),[be]=Il("Upload",Gu.Upload),{showRemoveIcon:pe,showPreviewIcon:me,showDownloadIcon:Ee,removeIcon:Oe,previewIcon:_e,downloadIcon:Ge,extra:Ze}=typeof i=="boolean"?{}:i,qe=typeof pe>"u"?!B:pe,ot=(we,Re)=>i?$.createElement(vTe,{prefixCls:G,listType:a,items:L,previewFile:f,onPreview:s,onDownload:l,onRemove:Z,showRemoveIcon:qe,showPreviewIcon:me,showDownloadIcon:Ee,removeIcon:Oe,previewIcon:_e,downloadIcon:Ge,iconRender:g,extra:Ze,locale:Object.assign(Object.assign({},be),p),isImageUrl:m,progress:h,appendAction:we,appendActionVisible:Re,itemRender:S,disabled:B}):we,je=Pe(oe,v,R,se,de,re==null?void 0:re.className,{[`${G}-rtl`]:te==="rtl",[`${G}-picture-card-wrapper`]:a==="picture-card",[`${G}-picture-circle-wrapper`]:a==="picture-circle"}),ze=Object.assign(Object.assign({},re==null?void 0:re.style),E);if(b==="drag"){const we=Pe(se,G,`${G}-drag`,{[`${G}-drag-uploading`]:L.some(Re=>Re.status==="uploading"),[`${G}-drag-hover`]:H==="dragover",[`${G}-disabled`]:B,[`${G}-rtl`]:te==="rtl"});return le($.createElement("span",{className:je,ref:j},$.createElement("div",{className:we,style:ze,onDrop:ee,onDragOver:ee,onDragLeave:ee},$.createElement(lk,Object.assign({},Q,{ref:M,className:`${G}-btn`}),$.createElement("div",{className:`${G}-drag-container`},C))),ot()))}const xe=Pe(G,`${G}-select`,{[`${G}-disabled`]:B,[`${G}-hidden`]:!C}),Ie=$.createElement("div",{className:xe},$.createElement(lk,Object.assign({},Q,{ref:M})));return le(a==="picture-card"||a==="picture-circle"?$.createElement("span",{className:je,ref:j},ot(Ie,!!C)):$.createElement("span",{className:je,ref:j},Ie,ot()))},bV=$.forwardRef(vlt);process.env.NODE_ENV!=="production"&&(bV.displayName="Upload");var glt=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};const gTe=$.forwardRef((e,t)=>{var{style:n,height:r,hasControlInside:o=!1}=e,i=glt(e,["style","height","hasControlInside"]);return $.createElement(bV,Object.assign({ref:t,hasControlInside:o},i,{type:"drag",style:Object.assign(Object.assign({},n),{height:r})}))});process.env.NODE_ENV!=="production"&&(gTe.displayName="Dragger");const QT=bV;QT.Dragger=gTe;QT.LIST_IGNORE=uC;const Ro=e=>{var t;let{label:n,higLabel:r=!1,children:o,prompt:i,subTable:a,subTableHead:s=!1,subTableContent:l=!0,hidePrompt:u=!1,subTableIndex:c,addWrapper:f=!0,calcHidden:d=!1,defaultValue:p,value:g,onChange:m,readonly:h,isRequired:y,initializeFormRender:v,...b}=e;const C=q.useRef(!1);if(q.useEffect(()=>{C.current!=d&&(console.log(n+" calcHiddenRef.current",C.current),console.log(n+" calcHiddenRef.current",d),C.current=d)},[d]),q.useEffect(()=>{p&&typeof m=="function"&&!g&&m(p)},[]),!f)return o;["UploadImage","UploadFile","Table","WithMultipleSelect","WithSingleSelect"].includes(o==null||(t=o.type)===null||t===void 0?void 0:t.displayName)&&h&&(h=!1);const S=Ye.jsxs("div",{className:"frelative fw-full",children:[n&&Ye.jsxs(Ye.Fragment,{children:[!r&&Ye.jsxs("div",{className:`fh-8 ftext-gray-500 ftext-sm fflex fitems-center ${r?" ftext-xl fmy-2 ftext-black":""}`,children:[n,y&&Ye.jsx("span",{className:"ftext-red-500 ffont-bold",children:"*"})]}),r&&Ye.jsxs("div",{className:"fh-11 fflex fitems-center ftext-lg ffont-medium ",children:[Ye.jsx("span",{className:"fborder-l-4 fborder-slate-300 fpl-2 ",children:n}),y&&Ye.jsx("span",{className:"ftext-red-500 ffont-bold",children:"*"})]})]}),Ye.jsxs("div",{className:"fw-full fflex fitems-stretch ftext-gray-900 frelative",children:[h&&Ye.jsx("div",{className:"fw-full fh-full fbg-gray-100 fopacity-5 fcursor-not-allowed fabsolute fleft-0 ftop-0 fz-10"}),o]}),!u&&i&&Ye.jsx("div",{className:"ftext-xs ftext-gray-500 fmin-h-5 fflex fitems-center",children:i})]});return a?Ye.jsxs("div",{className:"frelative fw-full",children:[s&&n&&Ye.jsx("div",{className:"fh-12 ffont-semibold fbg-[#fafafa] ftext-sm fflex fitems-center fborder-b fpl-2 f-mx-1",children:Ye.jsxs("div",{className:"fw-full fborder-r fborder-r-[#e9e9e9]",children:[n,y&&Ye.jsx("span",{className:"ftext-red-500",children:"*"})]})}),l&&Ye.jsxs("div",{className:"fw-full fflex fitems-stretch frelative fpy-2",children:[h&&Ye.jsx("div",{className:"fw-full fh-full fbg-gray-50 fopacity-5 fcursor-not-allowed fabsolute fleft-0 ftop-0 fz-10"}),o]})]}):S};var bD={exports:{}};/**
|
342
|
+
`]:{zIndex:10,width:r,margin:`0 ${Be(e.marginXXS)}`,fontSize:r,cursor:"pointer",transition:`all ${e.motionDurationSlow}`,color:o,"&:hover":{color:o},svg:{verticalAlign:"baseline"}}},[`${s}-thumbnail, ${s}-thumbnail img`]:{position:"static",display:"block",width:"100%",height:"100%",objectFit:"contain"},[`${s}-name`]:{display:"none",textAlign:"center"},[`${s}-file + ${s}-name`]:{position:"absolute",bottom:e.margin,display:"block",width:`calc(100% - ${Be(i(e.paddingXS).mul(2).equal())})`},[`${s}-uploading`]:{[`&${s}`]:{backgroundColor:e.colorFillAlter},[`&::before, ${n}-eye, ${n}-download, ${n}-delete`]:{display:"none"}},[`${s}-progress`]:{bottom:e.marginXL,width:`calc(100% - ${Be(i(e.paddingXS).mul(2).equal())})`,paddingInlineStart:0}}}),[`${t}-wrapper${t}-picture-circle-wrapper`]:{[`${t}${t}-select`]:{borderRadius:"50%"}}}},olt=e=>{const{componentCls:t}=e;return{[`${t}-rtl`]:{direction:"rtl"}}},ilt=e=>{const{componentCls:t,colorTextDisabled:n}=e;return{[`${t}-wrapper`]:Object.assign(Object.assign({},Kr(e)),{[t]:{outline:0,"input[type='file']":{cursor:"pointer"}},[`${t}-select`]:{display:"inline-block"},[`${t}-hidden`]:{display:"none"},[`${t}-disabled`]:{color:n,cursor:"not-allowed"}})}},alt=e=>({actionsColor:e.colorTextDescription}),slt=to("Upload",e=>{const{fontSizeHeading3:t,fontHeight:n,lineWidth:r,controlHeightLG:o,calc:i}=e,a=rr(e,{uploadThumbnailSize:i(t).mul(2).equal(),uploadProgressOffset:i(i(n).div(2)).add(r).equal(),uploadPicCardSize:i(o).mul(2.55).equal()});return[ilt(a),Jst(a),nlt(a),rlt(a),elt(a),tlt(a),olt(a),ZH(a)]},alt);function mx(e){return Object.assign(Object.assign({},e),{lastModified:e.lastModified,lastModifiedDate:e.lastModifiedDate,name:e.name,size:e.size,type:e.type,uid:e.uid,percent:0,originFileObj:e})}function yx(e,t){const n=vt(t),r=n.findIndex(o=>{let{uid:i}=o;return i===e.uid});return r===-1?n.push(e):n[r]=e,n}function X5(e,t){const n=e.uid!==void 0?"uid":"name";return t.filter(r=>r[n]===e[n])[0]}function llt(e,t){const n=e.uid!==void 0?"uid":"name",r=t.filter(o=>o[n]!==e[n]);return r.length===t.length?null:r}const ult=function(){const t=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:"").split("/"),r=t[t.length-1].split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(r)||[""])[0]},hTe=e=>e.indexOf("image/")===0,clt=e=>{if(e.type&&!e.thumbUrl)return hTe(e.type);const t=e.thumbUrl||e.url||"",n=ult(t);return/^data:image\//.test(t)||/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico|heic|heif)$/i.test(n)?!0:!(/^data:/.test(t)||n)},Ff=200;function flt(e){return new Promise(t=>{if(!e.type||!hTe(e.type)){t("");return}const n=document.createElement("canvas");n.width=Ff,n.height=Ff,n.style.cssText=`position: fixed; left: 0; top: 0; width: ${Ff}px; height: ${Ff}px; z-index: 9999; display: none;`,document.body.appendChild(n);const r=n.getContext("2d"),o=new Image;if(o.onload=()=>{const{width:i,height:a}=o;let s=Ff,l=Ff,u=0,c=0;i>a?(l=a*(Ff/i),c=-(l-s)/2):(s=i*(Ff/a),u=-(s-l)/2),r.drawImage(o,u,c,s,l);const f=n.toDataURL();document.body.removeChild(n),window.URL.revokeObjectURL(o.src),t(f)},o.crossOrigin="anonymous",e.type.startsWith("image/svg+xml")){const i=new FileReader;i.onload=()=>{i.result&&typeof i.result=="string"&&(o.src=i.result)},i.readAsDataURL(e)}else if(e.type.startsWith("image/gif")){const i=new FileReader;i.onload=()=>{i.result&&t(i.result)},i.readAsDataURL(e)}else o.src=window.URL.createObjectURL(e)})}const dlt=$.forwardRef((e,t)=>{let{prefixCls:n,className:r,style:o,locale:i,listType:a,file:s,items:l,progress:u,iconRender:c,actionIconRender:f,itemRender:d,isImgUrl:p,showPreviewIcon:g,showRemoveIcon:m,showDownloadIcon:h,previewIcon:y,removeIcon:v,downloadIcon:b,extra:C,onPreview:E,onDownload:S,onClose:w}=e;var x,O;const{status:T}=s,[A,N]=$.useState(T);$.useEffect(()=>{T!=="removed"&&N(T)},[T]);const[I,R]=$.useState(!1);$.useEffect(()=>{const re=setTimeout(()=>{R(!0)},300);return()=>{clearTimeout(re)}},[]);const F=c(s);let B=$.createElement("div",{className:`${n}-icon`},F);if(a==="picture"||a==="picture-card"||a==="picture-circle")if(A==="uploading"||!s.thumbUrl&&!s.url){const re=Pe(`${n}-list-item-thumbnail`,{[`${n}-list-item-file`]:A!=="uploading"});B=$.createElement("div",{className:re},F)}else{const re=p!=null&&p(s)?$.createElement("img",{src:s.thumbUrl||s.url,alt:s.name,className:`${n}-list-item-image`,crossOrigin:s.crossOrigin}):F,G=Pe(`${n}-list-item-thumbnail`,{[`${n}-list-item-file`]:p&&!p(s)});B=$.createElement("a",{className:G,onClick:Q=>E(s,Q),href:s.url||s.thumbUrl,target:"_blank",rel:"noopener noreferrer"},re)}const L=Pe(`${n}-list-item`,`${n}-list-item-${A}`),z=typeof s.linkProps=="string"?JSON.parse(s.linkProps):s.linkProps,H=(typeof m=="function"?m(s):m)?f((typeof v=="function"?v(s):v)||$.createElement(H3e,null),()=>w(s),n,i.removeFile,!0):null,k=(typeof h=="function"?h(s):h)&&A==="done"?f((typeof b=="function"?b(s):b)||$.createElement(z3e,null),()=>S(s),n,i.downloadFile):null,M=a!=="picture-card"&&a!=="picture-circle"&&$.createElement("span",{key:"download-delete",className:Pe(`${n}-list-item-actions`,{picture:a==="picture"})},k,H),j=typeof C=="function"?C(s):C,_=j&&$.createElement("span",{className:`${n}-list-item-extra`},j),V=Pe(`${n}-list-item-name`),K=s.url?$.createElement("a",Object.assign({key:"view",target:"_blank",rel:"noopener noreferrer",className:V,title:s.name},z,{href:s.url,onClick:re=>E(s,re)}),s.name,_):$.createElement("span",{key:"view",className:V,onClick:re=>E(s,re),title:s.name},s.name,_),W=(typeof g=="function"?g(s):g)&&(s.url||s.thumbUrl)?$.createElement("a",{href:s.url||s.thumbUrl,target:"_blank",rel:"noopener noreferrer",onClick:re=>E(s,re),title:i.previewFile},typeof y=="function"?y(s):y||$.createElement(KT,null)):null,Y=(a==="picture-card"||a==="picture-circle")&&A!=="uploading"&&$.createElement("span",{className:`${n}-list-item-actions`},W,A==="done"&&k,H),{getPrefixCls:X}=$.useContext(Nn),Z=X(),ee=$.createElement("div",{className:L},B,K,M,Y,I&&$.createElement(ns,{motionName:`${Z}-fade`,visible:A==="uploading",motionDeadline:2e3},re=>{let{className:G}=re;const Q="percent"in s?$.createElement(L3e,Object.assign({},u,{type:"line",percent:s.percent,"aria-label":s["aria-label"],"aria-labelledby":s["aria-labelledby"]})):null;return $.createElement("div",{className:Pe(`${n}-list-item-progress`,G)},Q)})),ne=s.response&&typeof s.response=="string"?s.response:((x=s.error)===null||x===void 0?void 0:x.statusText)||((O=s.error)===null||O===void 0?void 0:O.message)||i.uploadError,te=A==="error"?$.createElement(ay,{title:ne,getPopupContainer:re=>re.parentNode},ee):ee;return $.createElement("div",{className:Pe(`${n}-list-item-container`,r),style:o,ref:t},d?d(te,s,l,{download:S.bind(null,s),preview:E.bind(null,s),remove:w.bind(null,s)}):te)}),plt=(e,t)=>{const{listType:n="text",previewFile:r=flt,onPreview:o,onDownload:i,onRemove:a,locale:s,iconRender:l,isImageUrl:u=clt,prefixCls:c,items:f=[],showPreviewIcon:d=!0,showRemoveIcon:p=!0,showDownloadIcon:g=!1,removeIcon:m,previewIcon:h,downloadIcon:y,extra:v,progress:b={size:[-1,2],showInfo:!1},appendAction:C,appendActionVisible:E=!0,itemRender:S,disabled:w}=e,x=rDe(),[O,T]=$.useState(!1),A=["picture-card","picture-circle"].includes(n);$.useEffect(()=>{n.startsWith("picture")&&(f||[]).forEach(_=>{!(_.originFileObj instanceof File||_.originFileObj instanceof Blob)||_.thumbUrl!==void 0||(_.thumbUrl="",r==null||r(_.originFileObj).then(V=>{_.thumbUrl=V||"",x()}))})},[n,f,r]),$.useEffect(()=>{T(!0)},[]);const N=(_,V)=>{if(o)return V==null||V.preventDefault(),o(_)},I=_=>{typeof i=="function"?i(_):_.url&&window.open(_.url)},R=_=>{a==null||a(_)},F=_=>{if(l)return l(_,n);const V=_.status==="uploading";if(n.startsWith("picture")){const K=n==="picture"?$.createElement(_d,null):s.uploading,W=u!=null&&u(_)?$.createElement(X3e,null):$.createElement(V3e,null);return V?K:W}return V?$.createElement(_d,null):$.createElement(Y3e,null)},B=(_,V,K,W,Y)=>{const X={type:"text",size:"small",title:W,onClick:Z=>{var ee,ne;V(),$.isValidElement(_)&&((ne=(ee=_.props).onClick)===null||ne===void 0||ne.call(ee,Z))},className:`${K}-list-item-action`};return Y&&(X.disabled=w),$.isValidElement(_)?$.createElement(qa,Object.assign({},X,{icon:bl(_,Object.assign(Object.assign({},_.props),{onClick:()=>{}}))})):$.createElement(qa,Object.assign({},X),$.createElement("span",null,_))};$.useImperativeHandle(t,()=>({handlePreview:N,handleDownload:I}));const{getPrefixCls:L}=$.useContext(Nn),z=L("upload",c),H=L(),k=Pe(`${z}-list`,`${z}-list-${n}`),M=$.useMemo(()=>Ho(iD(H),["onAppearEnd","onEnterEnd","onLeaveEnd"]),[H]),j=Object.assign(Object.assign({},A?{}:M),{motionDeadline:2e3,motionName:`${z}-${A?"animate-inline":"animate"}`,keys:vt(f.map(_=>({key:_.uid,file:_}))),motionAppear:O});return $.createElement("div",{className:k},$.createElement(bAe,Object.assign({},j,{component:!1}),_=>{let{key:V,file:K,className:W,style:Y}=_;return $.createElement(dlt,{key:V,locale:s,prefixCls:z,className:W,style:Y,file:K,items:f,progress:b,listType:n,isImgUrl:u,showPreviewIcon:d,showRemoveIcon:p,showDownloadIcon:g,removeIcon:m,previewIcon:h,downloadIcon:y,extra:v,iconRender:F,actionIconRender:B,itemRender:S,onPreview:N,onDownload:I,onClose:R})}),C&&$.createElement(ns,Object.assign({},j,{visible:E,forceRender:!0}),_=>{let{className:V,style:K}=_;return bl(C,W=>({className:Pe(W.className,V),style:Object.assign(Object.assign(Object.assign({},K),{pointerEvents:V?"none":void 0}),W.style)}))}))},vTe=$.forwardRef(plt);process.env.NODE_ENV!=="production"&&(vTe.displayName="UploadList");var hlt=function(e,t,n,r){function o(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function s(c){try{u(r.next(c))}catch(f){a(f)}}function l(c){try{u(r.throw(c))}catch(f){a(f)}}function u(c){c.done?i(c.value):o(c.value).then(s,l)}u((r=r.apply(e,t||[])).next())})};const uC=`__LIST_IGNORE_${Date.now()}__`,vlt=(e,t)=>{const{fileList:n,defaultFileList:r,onRemove:o,showUploadList:i=!0,listType:a="text",onPreview:s,onDownload:l,onChange:u,onDrop:c,previewFile:f,disabled:d,locale:p,iconRender:g,isImageUrl:m,progress:h,prefixCls:y,className:v,type:b="select",children:C,style:E,itemRender:S,maxCount:w,data:x={},multiple:O=!1,hasControlInside:T=!0,action:A="",accept:N="",supportServerRender:I=!0,rootClassName:R}=e,F=$.useContext(Qi),B=d??F,[L,z]=Ar(r||[],{value:n,postState:we=>we??[]}),[H,k]=$.useState("drop"),M=$.useRef(null),j=$.useRef(null);if(process.env.NODE_ENV!=="production"){const we=Or("Upload");process.env.NODE_ENV!=="production"&&we("fileList"in e||!("value"in e),"usage","`value` is not a valid prop, do you mean `fileList`?"),we.deprecated(!("transformFile"in e),"transformFile","beforeUpload")}$.useMemo(()=>{const we=Date.now();(n||[]).forEach((Re,He)=>{!Re.uid&&!Object.isFrozen(Re)&&(Re.uid=`__AUTO__${we}_${He}__`)})},[n]);const _=(we,Re,He)=>{let ge=vt(Re),Ne=!1;w===1?ge=ge.slice(-1):w&&(Ne=ge.length>w,ge=ge.slice(0,w)),Os.flushSync(()=>{z(ge)});const Ve={file:we,fileList:ge};He&&(Ve.event=He),(!Ne||we.status==="removed"||ge.some(tt=>tt.uid===we.uid))&&Os.flushSync(()=>{u==null||u(Ve)})},V=(we,Re)=>hlt(void 0,void 0,void 0,function*(){const{beforeUpload:He,transformFile:ge}=e;let Ne=we;if(He){const Ve=yield He(we,Re);if(Ve===!1)return!1;if(delete we[uC],Ve===uC)return Object.defineProperty(we,uC,{value:!0,configurable:!0}),!1;typeof Ve=="object"&&Ve&&(Ne=Ve)}return ge&&(Ne=yield ge(Ne)),Ne}),K=we=>{const Re=we.filter(Ne=>!Ne.file[uC]);if(!Re.length)return;const He=Re.map(Ne=>mx(Ne.file));let ge=vt(L);He.forEach(Ne=>{ge=yx(Ne,ge)}),He.forEach((Ne,Ve)=>{let tt=Ne;if(Re[Ve].parsedFile)Ne.status="uploading";else{const{originFileObj:gt}=Ne;let lt;try{lt=new File([gt],gt.name,{type:gt.type})}catch{lt=new Blob([gt],{type:gt.type}),lt.name=gt.name,lt.lastModifiedDate=new Date,lt.lastModified=new Date().getTime()}lt.uid=Ne.uid,tt=lt}_(tt,ge)})},W=(we,Re,He)=>{try{typeof we=="string"&&(we=JSON.parse(we))}catch{}if(!X5(Re,L))return;const ge=mx(Re);ge.status="done",ge.percent=100,ge.response=we,ge.xhr=He;const Ne=yx(ge,L);_(ge,Ne)},Y=(we,Re)=>{if(!X5(Re,L))return;const He=mx(Re);He.status="uploading",He.percent=we.percent;const ge=yx(He,L);_(He,ge,we)},X=(we,Re,He)=>{if(!X5(He,L))return;const ge=mx(He);ge.error=we,ge.response=Re,ge.status="error";const Ne=yx(ge,L);_(ge,Ne)},Z=we=>{let Re;Promise.resolve(typeof o=="function"?o(we):o).then(He=>{var ge;if(He===!1)return;const Ne=llt(we,L);Ne&&(Re=Object.assign(Object.assign({},we),{status:"removed"}),L==null||L.forEach(Ve=>{const tt=Re.uid!==void 0?"uid":"name";Ve[tt]===Re[tt]&&!Object.isFrozen(Ve)&&(Ve.status="removed")}),(ge=M.current)===null||ge===void 0||ge.abort(Re),_(Re,Ne))})},ee=we=>{k(we.type),we.type==="drop"&&(c==null||c(we))};$.useImperativeHandle(t,()=>({onBatchStart:K,onSuccess:W,onProgress:Y,onError:X,fileList:L,upload:M.current,nativeElement:j.current}));const{getPrefixCls:ne,direction:te,upload:re}=$.useContext(Nn),G=ne("upload",y),Q=Object.assign(Object.assign({onBatchStart:K,onError:X,onProgress:Y,onSuccess:W},e),{data:x,multiple:O,action:A,accept:N,supportServerRender:I,prefixCls:G,disabled:B,beforeUpload:V,onChange:void 0,hasControlInside:T});delete Q.className,delete Q.style,(!C||B)&&delete Q.id;const oe=`${G}-wrapper`,[le,se,de]=slt(G,oe),[be]=Il("Upload",Gu.Upload),{showRemoveIcon:pe,showPreviewIcon:me,showDownloadIcon:Ee,removeIcon:Oe,previewIcon:_e,downloadIcon:Ge,extra:Ze}=typeof i=="boolean"?{}:i,qe=typeof pe>"u"?!B:pe,ot=(we,Re)=>i?$.createElement(vTe,{prefixCls:G,listType:a,items:L,previewFile:f,onPreview:s,onDownload:l,onRemove:Z,showRemoveIcon:qe,showPreviewIcon:me,showDownloadIcon:Ee,removeIcon:Oe,previewIcon:_e,downloadIcon:Ge,iconRender:g,extra:Ze,locale:Object.assign(Object.assign({},be),p),isImageUrl:m,progress:h,appendAction:we,appendActionVisible:Re,itemRender:S,disabled:B}):we,je=Pe(oe,v,R,se,de,re==null?void 0:re.className,{[`${G}-rtl`]:te==="rtl",[`${G}-picture-card-wrapper`]:a==="picture-card",[`${G}-picture-circle-wrapper`]:a==="picture-circle"}),ze=Object.assign(Object.assign({},re==null?void 0:re.style),E);if(b==="drag"){const we=Pe(se,G,`${G}-drag`,{[`${G}-drag-uploading`]:L.some(Re=>Re.status==="uploading"),[`${G}-drag-hover`]:H==="dragover",[`${G}-disabled`]:B,[`${G}-rtl`]:te==="rtl"});return le($.createElement("span",{className:je,ref:j},$.createElement("div",{className:we,style:ze,onDrop:ee,onDragOver:ee,onDragLeave:ee},$.createElement(lk,Object.assign({},Q,{ref:M,className:`${G}-btn`}),$.createElement("div",{className:`${G}-drag-container`},C))),ot()))}const xe=Pe(G,`${G}-select`,{[`${G}-disabled`]:B,[`${G}-hidden`]:!C}),Ie=$.createElement("div",{className:xe},$.createElement(lk,Object.assign({},Q,{ref:M})));return le(a==="picture-card"||a==="picture-circle"?$.createElement("span",{className:je,ref:j},ot(Ie,!!C)):$.createElement("span",{className:je,ref:j},Ie,ot()))},bV=$.forwardRef(vlt);process.env.NODE_ENV!=="production"&&(bV.displayName="Upload");var glt=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};const gTe=$.forwardRef((e,t)=>{var{style:n,height:r,hasControlInside:o=!1}=e,i=glt(e,["style","height","hasControlInside"]);return $.createElement(bV,Object.assign({ref:t,hasControlInside:o},i,{type:"drag",style:Object.assign(Object.assign({},n),{height:r})}))});process.env.NODE_ENV!=="production"&&(gTe.displayName="Dragger");const QT=bV;QT.Dragger=gTe;QT.LIST_IGNORE=uC;const Ro=e=>{var t;let{label:n,higLabel:r=!1,children:o,prompt:i,subTable:a,subTableHead:s=!1,subTableContent:l=!0,hidePrompt:u=!1,subTableIndex:c,addWrapper:f=!0,calcHidden:d=!1,defaultValue:p,value:g,onChange:m,readonly:h,isRequired:y,initializeFormRender:v,...b}=e;const C=q.useRef(!1);if(q.useEffect(()=>{C.current!==d&&(console.log(n+" calcHiddenRef.current",C.current),console.log(n+" calcHidden",d),C.current=d)},[d]),q.useEffect(()=>{p&&typeof m=="function"&&!g&&m(p)},[]),!f)return o;["UploadImage","UploadFile","Table","WithMultipleSelect","WithSingleSelect"].includes(o==null||(t=o.type)===null||t===void 0?void 0:t.displayName)&&h&&(h=!1);let S=o;h&&q.isValidElement(o)&&(S=q.cloneElement(o,{disabled:!0}));const w=Ye.jsxs("div",{className:"frelative fw-full",children:[n&&Ye.jsxs(Ye.Fragment,{children:[!r&&Ye.jsxs("div",{className:`fh-8 ftext-gray-500 ftext-sm fflex fitems-center ${r?" ftext-xl fmy-2 ftext-black":""}`,children:[n,y&&Ye.jsx("span",{className:"ftext-red-500 ffont-bold",children:"*"})]}),r&&Ye.jsxs("div",{className:"fh-11 fflex fitems-center ftext-lg ffont-medium ",children:[Ye.jsx("span",{className:"fborder-l-4 fborder-slate-300 fpl-2 ",children:n}),y&&Ye.jsx("span",{className:"ftext-red-500 ffont-bold",children:"*"})]})]}),Ye.jsx("div",{className:"fw-full fflex fitems-stretch ftext-gray-900 frelative",children:S}),!u&&i&&Ye.jsx("div",{className:"ftext-xs ftext-gray-500 fmin-h-5 fflex fitems-center",children:i})]});return a?Ye.jsxs("div",{className:"frelative fw-full",children:[s&&n&&Ye.jsx("div",{className:"fh-12 ffont-semibold fbg-[#fafafa] ftext-sm fflex fitems-center fborder-b fpl-2 f-mx-1",children:Ye.jsxs("div",{className:"fw-full fborder-r fborder-r-[#e9e9e9]",children:[n,y&&Ye.jsx("span",{className:"ftext-red-500",children:"*"})]})}),l&&Ye.jsx("div",{className:"fw-full fflex fitems-stretch frelative fpy-2",children:S})]}):w};var bD={exports:{}};/**
|
343
343
|
* @license
|
344
344
|
* Lodash <https://lodash.com/>
|
345
345
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|