@bwg-ui/core 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BwgUploader.d.ts","sourceRoot":"","sources":["../../../src/components/core/BwgUploader.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAU,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EAEL,EAAE,EAKH,MAAM,OAAO,CAAC;AAIf,OAAoB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAsB9D,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,WAAW,EAAE;QAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,KAAK,IAAI,CAAC;IACX;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;CAC/C;AAqGD;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"BwgUploader.d.ts","sourceRoot":"","sources":["../../../src/components/core/BwgUploader.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAU,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EAEL,EAAE,EAKH,MAAM,OAAO,CAAC;AAIf,OAAoB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAsB9D,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,WAAW,EAAE;QAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,KAAK,IAAI,CAAC;IACX;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;CAC/C;AAqGD;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAibrC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),n=require("antd"),g=require("react"),T=require("dayjs"),$=require("@ant-design/icons"),q=require("lodash"),k=require("../../utils/index.cjs"),ae=require("jszip"),ne=require("imask"),ie=require("../../stores/index.cjs"),X=require("react-dnd"),le=require("react-dnd-html5-backend"),ce=t=>r.jsx(n.Button,{...t,className:"bwg-btn"}),M=g.memo(({children:t,label:e,name:l,rules:i,initialValue:s,style:o,...u})=>{const a={fontWeight:"bold"},m=Array.isArray(i)&&i.some(Y=>Y.required===!0),c=()=>typeof e=="string"?r.jsxs("span",{style:a,children:[e,m&&r.jsx("span",{style:{color:"#ff4d4f",marginLeft:"4px"},children:"*"})]}):r.jsx("span",{style:a,children:e});return r.jsx(n.Form.Item,{className:"bwg-form-item",label:e?c():void 0,labelAlign:"left",name:l,rules:i,colon:!1,initialValue:s,style:o,...u,children:t})}),de=({itemProps:t,inputProps:e={format:"YN"}})=>{const l=n.Form.useFormInstance(),i=s=>{e.format==="boolean"?l.setFieldValue(t?.name,s.target.checked):l.setFieldValue(t?.name,s.target.checked?"Y":"N"),e.onChange&&e.onChange(s)};return r.jsx(M,{...t,getValueProps:s=>({checked:e.format==="boolean"?!!s:s==="Y"}),normalize:s=>typeof s=="boolean"?e.format==="boolean"?s:s?"Y":"N":e.format==="boolean"?!!s:s?"Y":"N",children:r.jsx(n.Checkbox,{...e,onChange:i,children:e?.title})})},ue=({itemProps:t,inputProps:e})=>{const l=n.Form.useFormInstance(),[i,s]=g.useState(t?.initialValue??[]),[o,u]=g.useState([]),a=o.length>0&&o.length==i?.length,m=i?.length>0&&i.length<o.length;g.useEffect(()=>{u(c(e?.options))},[e?.options]),g.useEffect(()=>{s(i)},[i]);const c=j=>{const C=[];return(j||[]).map((N,E)=>{C.push(N.value)}),C},Y=j=>{s(j.target.checked?o:[]),l.setFieldValue(t?.name,j.target.checked?o:[])},y=j=>{s(j),l.setFieldValue(t?.name,j),e?.onChange&&typeof e?.onChange=="function"&&e?.onChange(j)};return r.jsx(M,{...t,children:r.jsxs(n.ConfigProvider,{theme:{components:{Checkbox:{colorPrimary:"var(--check-primary)",colorPrimaryBorder:"var(--check-primary)",colorPrimaryHover:"var(--check-primary-active)"}}},children:[e?.allCheck&&r.jsx(n.Checkbox,{indeterminate:m,checked:a,onChange:Y,children:"전체선택"}),r.jsx(n.Checkbox.Group,{options:e?.options,value:i,onChange:y})]})})},P={year:{displayFormat:"YYYY",outputFormat:"YYYY"},month:{displayFormat:"YYYY-MM",outputFormat:"YYYYMM"},date:{displayFormat:"YYYY-MM-DD",outputFormat:"YYYYMMDD"},time:{displayFormat:"HH:mm",outputFormat:"HHmm"},datetime:{displayFormat:"YYYY-MM-DD HH:mm",outputFormat:"YYYYMMDDHHmm"}},me=({itemProps:t,inputProps:e,type:l="date",returnType:i="string"})=>{const{displayFormat:s,outputFormat:o}=g.useMemo(()=>P[l],[l]),u=g.useMemo(()=>Object.values(P).map(a=>a.outputFormat).sort((a,m)=>{if(a.length===m.length){if(a===o)return-1;if(m===o)return 1}return m.length-a.length}),[o]);return r.jsx(M,{...t,getValueProps:a=>({value:a?T.isDayjs(a)?a:T(a,u):null}),normalize:a=>a?i==="dayjs"?a:a.format(o):null,children:r.jsx(n.DatePicker,{...e,picker:l==="datetime"?"date":l,showTime:e?.showTime??(l==="datetime"||l==="time"),format:s})})},fe=({fileGrpKey:t,onFetchFilesTrxCd:e="SCMFILE00101",readOnly:l=!1,sysCd:i=__SYS_CD__})=>{const[s,o]=g.useState([]);g.useEffect(()=>{t&&e?i!=__SYS_CD__?k.callService_SYSCD(i,e,{crprCd:k.getUserInfo()?.crprCd,sysCd:i,fileGrpKey:t}).then(a=>{if(a?.sub){const m=a.sub.map(c=>({uid:c.fileKey,name:c.lgclFileNm,filePath:c.filePath}));o(m)}}).catch(a=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",a),n.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")}):k.callService(e,{crprCd:k.getUserInfo()?.crprCd,sysCd:i,fileGrpKey:t}).then(a=>{if(a?.sub){const m=a.sub.map(c=>({uid:c.fileKey,name:c.lgclFileNm,filePath:c.filePath}));o(m)}}).catch(a=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",a),n.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")}):o([])},[t,e]);const u=async a=>{try{let m;i!=__SYS_CD__?m="/api/download/"+i:m="/api/download";const c=await fetch(m,{method:"POST",headers:{SYSCD:__SYS_CD__,"Content-Type":"application/json"},body:JSON.stringify({filePath:a.filePath,logicalName:a.name,fileKey:a.uid})});if(!c.ok){const N=(await c.json().catch(()=>null))?.message||"파일 다운로드에 실패했습니다.";throw new Error(N)}const Y=await c.blob(),y=window.URL.createObjectURL(Y),j=document.createElement("a");j.href=y,j.setAttribute("download",a.name),document.body.appendChild(j),j.click(),document.body.removeChild(j),window.URL.revokeObjectURL(y)}catch(m){console.error(m),n.message.error(m.message||"파일을 다운로드하는 중 오류가 발생했습니다.")}};return q.isEmpty(s)?null:r.jsx(n.Card,{title:"파일 목록",children:r.jsx(n.List,{dataSource:s,renderItem:a=>r.jsx(n.List.Item,{actions:l?[]:[r.jsx(n.Button,{type:"text",icon:r.jsx($.DownloadOutlined,{}),onClick:()=>u(a)},"download")],children:r.jsx(n.List.Item.Meta,{avatar:r.jsx($.PaperClipOutlined,{}),title:a.name})})})})},se=g.forwardRef(({children:t,labelCol:e,style:l,className:i,...s},o)=>r.jsx(n.ConfigProvider,{form:{validateMessages:{required:"'${label}을(를) 입력해주세요.'"}},children:r.jsx(n.Form,{ref:o,...s,requiredMark:!1,labelCol:e||{flex:"100px"},style:{padding:"10px",...l},className:`bwg-form ${i??""}`,children:t})}));se.displayName="BwgForm";const ge=({itemProps:t,inputProps:e})=>r.jsx(M,{...t,children:r.jsx(n.Input,{...e})}),{Text:J}=n.Typography,{Dragger:he}=n.Upload,pe=[".pdf",".xlsx",".xls",".docx",".doc",".pptx",".ppt",".hwp",".txt",".csv",".jpg",".jpeg",".png",".gif",".zip"],xe=(t,e=2)=>{if(t===0)return"0 Bytes";const l=1024,i=e<0?0:e,s=["Bytes","KB","MB","GB","TB"],o=Math.floor(Math.log(t)/Math.log(l));return parseFloat((t/Math.pow(l,o)).toFixed(i))+" "+s[o]},Fe=({title:t="첨부파일",fileGrpKey:e,onUploadComplete:l,onSuccessTrxCd:i="SCMFILE00102",anotherServiceTrxCd:s="SCMFILE00105",allowedExtensions:o=pe,maxFileSize:u=2048})=>{const[a,m]=g.useState([]),[c,Y]=g.useState(!1),[y,j]=g.useState(!1),[C,N]=g.useState(0),E=f=>{if(o&&o.length>0){const L=(U=>{const H=U.lastIndexOf(".");return H===-1?"":U.substring(H).toLowerCase()})(f.name);if(!o.includes(L))return n.message.error(`${f.name} 파일은 허용되지 않는 확장자입니다. (${o.join(", ")}만 가능)`),!1}return!0},D=async()=>{const f=a.filter(I=>I.status!=="done"),x=f.reduce((I,A)=>I+(A.size||0),0),L=2*1024*1024*1024;if(x>L){n.notification.error({message:"업로드 용량 초과",description:"한 번에 업로드할 수 있는 총 파일 용량은 2GB를 초과할 수 없습니다."});return}if(f.length===0){n.message.warning("업로드할 파일이 없거나 모든 파일이 이미 업로드되었습니다.");return}j(!0);let U;try{const I=new ae;f.forEach(A=>{A.originFileObj&&I.file(A.name,A.originFileObj)}),U=await I.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:9}})}catch(I){j(!1),n.message.error("파일을 압축하는 중 오류가 발생했습니다."),console.error("Zipping error:",I);return}j(!1);const H=new FormData;H.append("file",U,"upload.zip"),Y(!0),N(0);try{const I=await new Promise((F,w)=>{const v=new XMLHttpRequest;v.open("POST","/api/upload-large",!0),v.upload.onprogress=B=>{if(B.lengthComputable){const W=Math.round(B.loaded/B.total*100);N(W)}},v.onload=()=>{if(v.status>=200&&v.status<300)try{const B=JSON.parse(v.responseText);B.success?F(B):w(new Error(B.message||"파일 업로드에 실패했습니다."))}catch{w(new Error("잘못된 서버 응답입니다."))}else try{const B=JSON.parse(v.responseText);w(new Error(B.message||`서버 오류: ${v.status}`))}catch{w(new Error(`서버 오류: ${v.status}`))}},v.onerror=()=>{w(new Error("네트워크 오류가 발생했습니다."))},v.send(H)});n.message.success(I.message||"압축 파일이 성공적으로 업로드되었습니다.");const A=a.map(F=>f.find(w=>w.uid===F.uid)?{...F,status:"done"}:F);if(m(A),i&&I.uploadedFiles&&Array.isArray(I.uploadedFiles)){const F=k.getUserInfo();I.uploadedFiles.forEach(w=>{const v={crprCd:F?.crprCd,sysCd:__SYS_CD__,fileGrpKey:e,sub:[{crprCd:F?.crprCd,sysCd:__SYS_CD__,fileGrpKey:e,physFileNm:w.fileNameP,lgclFileNm:w.fileNameL,filePath:w.filePath,fileExtn:w.fileExt,fileSize:w.fileSize,mltpYn:"Y"}]};k.callService(i,v).then(B=>{const W=a.map(K=>({crprCd:F?.crprCd,sysCd:__SYS_CD__,fileGrpKey:B.sub[0].fileGrpKey,fileKey:B.sub[0].fileKey,lgclFileNm:K.name,fileSize:K.size,fileExtn:K.name.split(".").pop(),fileType:K.type}));k.callService(s,{sub:W})}).catch(B=>{console.error("후처리 서비스 호출 실패:",B),n.message.error(`${w.fileNameL} 파일의 후처리 작업에 실패했습니다.`)}),l&&l({fileNameP:w.fileNameP,fileNameL:w.fileNameL})})}}catch(I){n.message.error(I.message||"파일 업로드 중 오류가 발생했습니다.");const A=a.map(F=>f.find(w=>w.uid===F.uid)?{...F,status:"error",response:I.message||"파일 업로드 중 오류가 발생했습니다."}:F);m(A)}finally{Y(!1)}},h={multiple:!0,fileList:a,beforeUpload:f=>E(f)?u&&f.size>=u*1024*1024?(n.message.error(`대용량 첨부 파일 최대 크기는 ${(u/1024).toFixed(1)}GB입니다.`),n.Upload.LIST_IGNORE):!1:n.Upload.LIST_IGNORE,onChange:({fileList:f})=>{const x=new Map(a.map(L=>[L.uid,L]));f.forEach(L=>{x.set(L.uid,L)}),m(Array.from(x.values()))},onRemove:f=>{const x=a.filter(L=>L.uid!==f.uid);m(x)},showUploadList:!1};return r.jsx(n.Spin,{spinning:c||y,tip:y?"파일 압축 중...":`파일 업로드 중... ${C}%`,children:r.jsxs("div",{className:"bwg-large-uploader-container",children:[r.jsx(n.Card,{title:r.jsx(J,{strong:!0,children:t}),extra:r.jsx(n.Upload,{...h,children:r.jsx(n.Button,{icon:r.jsx($.UploadOutlined,{}),children:"파일 선택"})}),bodyStyle:{padding:0},children:r.jsx(he,{...h,style:{border:"none",background:"transparent",padding:0},children:r.jsx("div",{className:"upload-list-container",children:a.length>0?r.jsx(n.List,{style:{textAlign:"left"},dataSource:a,renderItem:f=>{const x=f.status==="done",L=f.status==="error";let U;return x?U=r.jsx($.CheckCircleOutlined,{style:{color:"#52c41a",fontSize:14}}):L?U=r.jsx(n.Tooltip,{title:typeof f.response=="string"?f.response:"업로드 실패",children:r.jsx($.CloseCircleOutlined,{style:{color:"#ff4d4f",fontSize:14}})}):U=r.jsx($.FileTextOutlined,{style:{fontSize:14}}),r.jsx(n.List.Item,{actions:[r.jsx(J,{type:"secondary",children:xe(f.size||0)},"size"),r.jsx(n.Button,{type:"text",icon:r.jsx($.DeleteOutlined,{}),onClick:H=>{H.stopPropagation(),h.onRemove?.(f)},disabled:c||y},"delete")],children:r.jsx(n.List.Item.Meta,{avatar:U,title:r.jsx(J,{type:L?"danger":void 0,children:f.name})})},f.uid)}}):r.jsxs(n.Flex,{gap:"middle",align:"center",justify:"center",vertical:!0,style:{padding:"20px 0",minHeight:"120px"},children:[r.jsx($.InboxOutlined,{style:{fontSize:"32px",color:"#999"}}),r.jsx(J,{type:"secondary",children:"업로드할 파일을 선택하거나 이 영역으로 드래그하세요."})]})})})}),a.length>0&&r.jsxs(n.Flex,{justify:"flex-end",align:"center",gap:"large",style:{marginTop:16},children:[c&&r.jsx("div",{style:{width:"250px"},children:r.jsx(n.Progress,{percent:C,size:"small"})}),r.jsx(n.Button,{type:"primary",onClick:D,disabled:c||y||a.filter(f=>f.status!=="done").length===0,icon:r.jsx($.CloudUploadOutlined,{}),children:"일괄 업로드"})]})]})})},ye=t=>{if(typeof t=="string")return t.replace(/0/g,"_");if(Array.isArray(t))return t[0].replace(/0/g,"_");if(typeof t=="object"&&"mask"in t&&"blocks"in t){const{mask:e,blocks:l}=t;return e.split(".").map(i=>{const o=l?.[i]?.maxLength??3;return"_".repeat(o)}).join(".")}return""},Se=({itemProps:t,inputProps:e,mask:l})=>{const i=g.useRef(null),s=n.Form.useFormInstance(),o=g.useMemo(()=>ye(l),[l]);return g.useEffect(()=>{if(!i.current?.input)return;const u=typeof l=="string"||Array.isArray(l)?{mask:l}:l,a=ne(i.current.input,u);return a.on("accept",()=>{s&&t?.name&&s.setFieldValue(t.name,a.value)}),()=>{a.destroy()}},[l,s,t?.name]),r.jsx(M,{...t,children:r.jsx(n.Input,{...e,ref:i,placeholder:o})})},je=t=>{switch(t){case"year":return{format:"YYYY",mask:"0000",outputFormat:"YYYY"};case"month":return{format:"YYYY-MM",mask:"0000-00",outputFormat:"YYYYMM"};case"date":default:return{format:"YYYY-MM-DD",mask:"0000-00-00",outputFormat:"YYYYMMDD"}}},Ye=({type:t="date",itemProps:e={name:"calendar"},inputProps:l})=>{const{format:i,mask:s,outputFormat:o}=je(t),u=g.useRef(null),a=g.useRef(null),m=n.Form.useFormInstance(),[c,Y]=g.useState(!1),[y,j]=g.useState(!1),C=e?.name,[N,E]=g.useState(null);g.useEffect(()=>{if(!u.current?.input)return;const h=ne(u.current.input,{mask:s,lazy:!1});return a.current=h,h.on("accept",()=>{console.log("input :: ",h.value);const f=h.value,x=T(f,i,!0);console.log("input :: ",x),f.length===i.length&&x.isValid()&&(console.log("parsed :: ",x.format(o)),m.setFieldValue(C,x.format(o)),a.current?.updateValue(),Y(!1))}),()=>{h.destroy()}},[i,s]),g.useEffect(()=>{E(T(m.getFieldValue(C)))},[m.getFieldValue(C)]);const D=h=>{if(!h){a.current?.updateValue();return}const f=h.format(o);console.log("formatted :: ",f),a.current&&(a.current.value=f,a.current.updateValue()),j(!1)};return r.jsx(M,{...e,name:void 0,validateStatus:y?"warning":void 0,help:y?"유효하지 않은 날짜입니다":void 0,children:r.jsxs("div",{style:{position:"relative"},children:[r.jsx(n.Form.Item,{name:C,getValueProps:h=>({value:h?T(h).format(i):void 0}),normalize:h=>h?T(h).format(o):void 0,noStyle:!0,children:r.jsx(n.Input,{...l,ref:u,onFocus:()=>{Y(!c),a.current?.updateValue()},onKeyDown:h=>{h.key==="Backspace"&&Y(!0),h.key==="Tab"&&Y(!1)},allowClear:!0,placeholder:s.replace(/0/g,"_"),autoComplete:"off"})}),r.jsx(n.DatePicker,{open:c,picker:t,format:i,value:N,onChange:D,getPopupContainer:h=>h.parentElement,style:{position:"absolute",top:0,left:0,pointerEvents:"none",opacity:0,width:"100%"}})]})})},{Option:Q}=n.Select,Ce=({itemProps:t,inputProps:e})=>{const[l,i]=g.useState([]);return g.useEffect(()=>{e?.addField==="ALL"?i([{label:"전체",value:""},...e?.list||[]]):e?.addField==="NULL"?i([{label:"",value:""},...e?.list||[]]):i(e?.list||[])},[e?.list]),r.jsx(M,{...t,getValueProps:s=>s?{value:s&&s.indexOf(",")>0?s.split(","):[s]}:{value:[]},normalize:s=>s!=null&&s!=null&&s.length>0?s.toString():"",children:r.jsx(n.Select,{...e,mode:"multiple",children:l.map(s=>{const{value:o,label:u}=s;return e?.printCode?r.jsx(Q,{value:o,label:u,children:r.jsx(n.Space,{children:`[${o}] ${u}`})},o):r.jsx(Q,{value:o,label:u,children:r.jsx(n.Space,{children:`${u}`})},o)})})})},we=({itemProps:t,inputProps:e})=>{const l=s=>{let o=s.toString().split(".");return e?.decimalPoint!=null&&o[1]!=null&&e?.decimalPoint>0?o[1].length>e?.decimalPoint?o[1]="."+o[1].substring(0,e?.decimalPoint):o[1]="."+o[1]:o[1]="",o[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")+o[1]},i=s=>{let o=s.toString().split(".");return e?.decimalPoint!=null&&o[1]!=null&&e?.decimalPoint>0?o[1].length>e?.decimalPoint?o[1]="."+o[1].substring(0,e?.decimalPoint):o[1]="."+o[1]:o[1]="",o[0].replace(/\$\s?|(,*)/g,"")+o[1]};return r.jsx(M,{...t,children:r.jsx(n.InputNumber,{...e,formatter:s=>l(s),parser:s=>i(s)})})},Le=({itemProps:t,inputProps:e})=>r.jsx(M,{...t,children:r.jsx(n.Radio.Group,{...e})}),{RangePicker:be}=n.DatePicker,ee={year:{displayFormat:"YYYY",outputFormat:"YYYY"},month:{displayFormat:"YYYY-MM",outputFormat:"YYYYMM"},date:{displayFormat:"YYYY-MM-DD",outputFormat:"YYYYMMDD"},time:{displayFormat:"HH:mm",outputFormat:"HHmm"},datetime:{displayFormat:"YYYY-MM-DD HH:mm",outputFormat:"YYYYMMDDHHmm"}},Ie=({itemProps:t,inputProps:e,type:l="date",minDate:i,maxDate:s,returnType:o="string"})=>{const{displayFormat:u,outputFormat:a}=g.useMemo(()=>ee[l],[l]),m=g.useMemo(()=>Object.values(ee).map(c=>c.outputFormat).sort((c,Y)=>{if(c.length===Y.length){if(c===a)return-1;if(Y===a)return 1}return Y.length-c.length}),[a]);return r.jsx(M,{...t,getValueProps:c=>({value:c&&c.length>0?[c[0]?T.isDayjs(c[0])?c[0]:T(c[0],m):null,c[1]?T.isDayjs(c[1])?c[1]:T(c[1],m):null]:null}),normalize:c=>c?o==="dayjs"?[c[0]??void 0,c[1]??void 0]:[c[0]?c[0].format(a):void 0,c[1]?c[1].format(a):void 0]:[void 0,void 0],children:r.jsx(be,{...e,order:!0,minDate:i?T(i,m):void 0,maxDate:s?T(s,m):void 0,picker:l==="datetime"?"date":l,showTime:e?.showTime??(l==="datetime"||l==="time"),format:u})})},te=n.Input.Search,Be=t=>{const e=n.Form.useFormInstance(),{openPopup:l}=ie.usePopupStore(),i=t.itemProps?.name||[],s=t.popupConfig||{callback(u){console.log("callback data :: ",u),i.length>1?(e.setFieldValue(i[0],u.code),e.setFieldValue(i[1],u.name)):e.setFieldValue(i,u.code)}},o={...t,placeholder:typeof t.placeholder=="string"?t.placeholder:t.placeholder?.[0]||"",onChange:u=>{i.length>1&&e.setFieldValue(i[0],""),t.onChange?.(u)},onSearch:u=>{t.popuCd?l(t.popuCd,t.popupParams,s):t.onSearch?.(u)}};return i.length>1?r.jsx(M,{...t.itemProps,name:void 0,children:r.jsxs(n.Space.Compact,{block:!0,children:[r.jsx(n.Form.Item,{name:i[0],rules:t.itemProps?.rules,style:{width:"40%",marginBottom:0,marginInlineEnd:0},validateStatus:"",help:"",children:r.jsx(n.Input,{style:{color:"#999",backgroundColor:"#f5f5f5"},placeholder:t.placeholder?.[0]||"",readOnly:!0})}),r.jsx(n.Form.Item,{name:i[1],style:{width:"60%",marginBottom:0},children:r.jsx(te,{readOnly:t.readOnly,enterButton:r.jsx(n.Button,{icon:r.jsx($.SearchOutlined,{}),disabled:t.readOnly}),...o})})]})}):r.jsx(M,{...t.itemProps,children:r.jsx(te,{...o})})},Me=({itemProps:t,selectProps:e={options:[],allowClear:!0}})=>{const l=n.Form.useFormInstance(),i=!!l,s=g.useMemo(()=>e?.addField==="ALL"?[{label:"전체",value:""},...e?.options||[]]:e?.addField==="NULL"?[{label:"",value:""},...e?.options||[]]:e?.options||[],[e.options,e.addField]),o=m=>{e.onChange?.(m)},u={...e,allowClear:e.allowClear??!0,options:s,onChange:o,variant:e.variant},a=r.jsx(n.Select,{...u,disabled:e.disabled});return e.copyable&&!i&&console.warn("BwgSelect: copyable 기능은 Form 컨텍스트 내에서만 사용 가능합니다."),e.copyable?r.jsx(M,{...t,name:void 0,children:r.jsxs(n.Space.Compact,{block:!0,children:[r.jsx(n.Form.Item,{name:t?.name,rules:t?.rules,style:{width:"100%",marginBottom:0},validateStatus:"",help:"",children:a}),r.jsx(n.Typography.Paragraph,{copyable:{text:i&&l?.getFieldValue(t?.name)?.toString()||"",tooltips:["코드복사","코드복사됨"]},style:{margin:0,backgroundColor:"#f5f5f5",borderRadius:"4px",border:"1px solid #d9d9d9",fontSize:"12px",color:"#666",display:"flex",alignItems:"center",height:"30px",padding:"0 8px"}})]})}):r.jsx(M,{...t,children:a})},_e=({itemProps:t,inputProps:e={format:"YN"}})=>{const l=n.Form.useFormInstance(),i=(s,o)=>{e.format==="boolean"?l.setFieldValue(t?.name,s):l.setFieldValue(t?.name,s?"Y":"N"),e.onChange&&e.onChange(s,o)};return r.jsx(M,{...t,getValueProps:s=>({checked:e.format==="boolean"?!!s:s==="Y"}),normalize:s=>typeof s=="boolean"?e.format==="boolean"?s:s?"Y":"N":e.format==="boolean"?!!s:s?"Y":"N",children:r.jsx(n.Switch,{...e,onChange:(s,o)=>i(s,o)})})},{TextArea:Ne}=n.Input,De=({itemProps:t,inputProps:e})=>r.jsx(M,{...t,children:r.jsx(Ne,{...e})}),ke=[".pdf",".xlsx",".xls",".docx",".doc",".pptx",".ppt",".hwp",".txt",".csv",".jpg",".jpeg",".png",".gif",".zip"],re={FILE:"file"},ve=({originNode:t,file:e,fileList:l,moveFile:i,onDrop:s})=>{const o=g.useRef(null),[{handlerId:u},a]=X.useDrop({accept:re.FILE,collect:y=>({handlerId:y.getHandlerId()}),hover(y,j){if(!o.current)return;const C=y.uid,N=e.uid;if(C===N)return;const E=q.findIndex(l,{uid:N}),D=q.findIndex(l,{uid:C});if(D===-1||E===-1)return;const h=o.current.getBoundingClientRect(),f=j.getClientOffset();if(!f)return;const x=(h.bottom-h.top)/2,L=f.y-h.top;D<E&&L<x||D>E&&L>x||i(C,N)},drop(){s()}}),[{isDragging:m},c]=X.useDrag({type:re.FILE,item:()=>({uid:e.uid,index:q.findIndex(l,{uid:e.uid})}),collect:y=>({isDragging:y.isDragging()})}),Y=m?0:1;return c(a(o)),r.jsx("div",{ref:o,style:{opacity:Y},"data-handler-id":u,children:t})},Ee=({itemProps:t,fileGrpKey:e,onUploadComplete:l,onFetchFilesTrxCd:i="SCMFILE00101",onSuccessTrxCd:s="SCMFILE00102",onDeleteFileTrxCd:o="SCMFILE00103",onReorderFilesTrxCd:u="SCMFILE00104",allowedExtensions:a=ke,maxFileSize:m=200,showButton:c=!0,multiple:Y=!1,newFileGrpKeyonModify:y=!1,buttonText:j="파일 선택",localOnly:C=!1,onFilesChange:N})=>{const[E,D]=g.useState([]),h=g.useRef(e),f=g.useRef([]),x=n.Form.useFormInstance(),L=()=>{if(C||f.current.length===0)return;const d=[...f.current];if(f.current=[],s){const b=d.map(S=>({crprCd:k.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:h.current,physFileNm:S.fileNameP,lgclFileNm:S.fileNameL,filePath:S.filePath,fileExtn:S.fileExt,fileSize:S.fileSize,mltpYn:"N"}));console.log("newFileGrpKeyonModify",y),console.log("newFileGrpKeyonModify",y?0:h.current),k.callService(s,{crprCd:k.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:y?0:h.current,oldFileGrpKey:h.current,newFileGrpKeyonModify:y,sub:b}).then(S=>{if(S?.sub&&S.sub.length>0){const p=S.sub[0].fileGrpKey;h.current||(h.current=p);const O=new Map;S.sub.forEach(_=>{const V=d.find(z=>z.fileNameL===_.lgclFileNm);V&&O.set(V.tempId,_)});const G=t?.name;(_=>{if(F){const V=x?.getFieldValue(G)||[],z=_(V);x?.setFieldValue(G,z)}else D(V=>_(V))})(_=>_.map(V=>{const z=O.get(V.uid);if(z){const Z=d.find(oe=>oe.tempId===V.uid);return l&&Z&&l({...Z,fileGrpKey:p,fileKey:z.fileKey}),{...V,name:z.lgclFileNm,fileGrpKey:p,fileKey:z.fileKey,uid:z.fileKey,status:"done",url:`/api/download?filePath=${z.filePath}&logicalName=${z.lgclFileNm}`}}return V}))}}).catch(S=>{console.error("업로드 후처리 서비스 호출 실패:",S),n.message.error("파일 후처리 중 오류가 발생했습니다.");const p=new Set(d.map(R=>R.tempId)),O=t?.name;(R=>{if(F){const _=x?.getFieldValue(O)||[],V=R(_);x?.setFieldValue(O,V)}else D(_=>R(_))})(R=>R.map(_=>p.has(_.uid)?{..._,status:"error",error:"후처리 실패"}:_))})}},U=g.useRef(q.debounce(L,500)).current;g.useEffect(()=>()=>{U.cancel()},[U]),g.useEffect(()=>{h.current=e},[e]),g.useEffect(()=>{C||e&&i&&k.callService(i,{crprCd:k.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:e}).then(d=>{if(d?.sub){const b=d.sub.map(p=>({uid:p.fileKey,name:p.lgclFileNm,status:"done",url:`/api/download?filePath=${p.filePath}&logicalName=${p.lgclFileNm}`})),S=t?.name;F?x?.setFieldValue(S,b):D(b)}else{const b=t?.name;F?x?.setFieldValue(b,[]):D([])}}).catch(d=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",d),n.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")})},[e,i]);const H=(d,b)=>{const S=t?.name,p=F?x?.getFieldValue(S)||[]:E,O=q.findIndex(p,{uid:d}),G=q.findIndex(p,{uid:b});if(O<0||G<0)return;const R=[...p],[_]=R.splice(O,1);R.splice(G,0,_),F?x?.setFieldValue(S,R):D(R)},I=()=>{if(!C&&e&&u){const d=t?.name,S=(F?x?.getFieldValue(d)||[]:E).map(p=>p.uid);k.callService(u,{crprCd:k.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:e,reorderedFileKeys:S}).then(()=>{n.message.success("파일 순서가 성공적으로 저장되었습니다.")}).catch(p=>{console.error("파일 순서 저장 서비스 호출 실패:",p),n.message.error("파일 순서 저장 중 오류가 발생했습니다.")})}},A=d=>{const b=t?.name,S=F?x?.getFieldValue(b)||[]:E;if(!Y&&S.length>0)return n.message.error("하나의 파일만 업로드할 수 있습니다."),n.Upload.LIST_IGNORE;if(a&&a.length>0){const p=`.${d.name.split(".").pop()?.toLowerCase()}`;if(!a.includes(p))return n.message.error(`${d.name} 파일은 허용되지 않는 확장자입니다. (${a.join(", ")})`),n.Upload.LIST_IGNORE}return m&&!(d.size/1024/1024<m)?(n.message.error(`일반업로드의 최대용량은 ${m}MB입니다.`),n.Upload.LIST_IGNORE):!C},F=!!t?.name,w={name:"file",multiple:Y,action:C?void 0:"/api/upload",beforeUpload:A,showUploadList:{showRemoveIcon:c},onChange(d){const{status:b,uid:S}=d.file;if(b==="removed"){if(!C&&o)k.callService(o,{crprCd:k.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:y?0:h.current,fileKey:S,oldFileGrpKey:h.current,newFileGrpKeyonModify:y}).then(p=>{if(n.message.success("파일이 성공적으로 삭제되었습니다."),F){const O=t?.name;x?.setFieldValue(O,d.fileList)}else D(d.fileList);N?.(d.fileList),l?.({fileGrpKey:p.fileGrpKey})}).catch(p=>{console.error("파일 삭제 서비스 호출에 실패했습니다.",p),n.message.error("파일 삭제 중 오류가 발생했습니다.")});else{if(F){const p=t?.name;x?.setFieldValue(p,d.fileList)}else D(d.fileList);N?.(d.fileList)}return}if(F){const p=t?.name;x?.setFieldValue(p,d.fileList)}else D(d.fileList);if(N?.(d.fileList),b==="done")if(!C&&d.file.response?.success){const{uploadedFiles:p}=d.file.response;p&&Array.isArray(p)&&p.length>0&&(p.forEach(O=>{O.tempId=d.file.uid,f.current.push(O)}),U()),n.message.success(d.file.response.message||`${d.file.name} 파일이 성공적으로 업로드되었습니다.`)}else n.message.error(d.file.response?.message||`${d.file.name} 파일 업로드에 실패했습니다.`);else b==="error"&&n.message.error(d.file.response?.message||`${d.file.name} 파일 업로드 중 오류가 발생했습니다.`)},itemRender(d,b,S){const p=g.cloneElement(d,{href:b.url||void 0,title:void 0});return r.jsx(ve,{originNode:p,file:b,fileList:S,moveFile:H,onDrop:I},b.uid)}};F||(w.fileList=E);const v=d=>Array.isArray(d)?d:d&&d.fileList,B=t?.name,W=F?n.Form.useWatch?.(B,x):void 0,K=F?W||[]:E;return r.jsx(X.DndProvider,{backend:le.HTML5Backend,children:r.jsx(M,{valuePropName:"fileList",getValueFromEvent:v,...t,children:r.jsx(n.Upload,{headers:{SYSCD:__SYS_CD__},...w,listType:"picture",children:c&&(Y||K.length===0)&&r.jsx(n.Button,{icon:r.jsx($.UploadOutlined,{}),children:j})})})})};exports.BwgButton=ce;exports.BwgCheck=de;exports.BwgCheckList=ue;exports.BwgDatePicker=me;exports.BwgDownload=fe;exports.BwgForm=se;exports.BwgFormItem=M;exports.BwgInput=ge;exports.BwgLargeUploader=Fe;exports.BwgMaskedInput=Se;exports.BwgMaskedPicker=Ye;exports.BwgMultiSelect=Ce;exports.BwgNumber=we;exports.BwgRadio=Le;exports.BwgRangePicker=Ie;exports.BwgSearch=Be;exports.BwgSelect=Me;exports.BwgSwitch=_e;exports.BwgTextArea=De;exports.BwgUploader=Ee;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),n=require("antd"),h=require("react"),T=require("dayjs"),$=require("@ant-design/icons"),q=require("lodash"),k=require("../../utils/index.cjs"),ae=require("jszip"),ne=require("imask"),ie=require("../../stores/index.cjs"),X=require("react-dnd"),le=require("react-dnd-html5-backend"),ce=t=>r.jsx(n.Button,{...t,className:"bwg-btn"}),M=h.memo(({children:t,label:e,name:l,rules:i,initialValue:s,style:o,...u})=>{const a={fontWeight:"bold"},m=Array.isArray(i)&&i.some(Y=>Y.required===!0),c=()=>typeof e=="string"?r.jsxs("span",{style:a,children:[e,m&&r.jsx("span",{style:{color:"#ff4d4f",marginLeft:"4px"},children:"*"})]}):r.jsx("span",{style:a,children:e});return r.jsx(n.Form.Item,{className:"bwg-form-item",label:e?c():void 0,labelAlign:"left",name:l,rules:i,colon:!1,initialValue:s,style:o,...u,children:t})}),de=({itemProps:t,inputProps:e={format:"YN"}})=>{const l=n.Form.useFormInstance(),i=s=>{e.format==="boolean"?l.setFieldValue(t?.name,s.target.checked):l.setFieldValue(t?.name,s.target.checked?"Y":"N"),e.onChange&&e.onChange(s)};return r.jsx(M,{...t,getValueProps:s=>({checked:e.format==="boolean"?!!s:s==="Y"}),normalize:s=>typeof s=="boolean"?e.format==="boolean"?s:s?"Y":"N":e.format==="boolean"?!!s:s?"Y":"N",children:r.jsx(n.Checkbox,{...e,onChange:i,children:e?.title})})},ue=({itemProps:t,inputProps:e})=>{const l=n.Form.useFormInstance(),[i,s]=h.useState(t?.initialValue??[]),[o,u]=h.useState([]),a=o.length>0&&o.length==i?.length,m=i?.length>0&&i.length<o.length;h.useEffect(()=>{u(c(e?.options))},[e?.options]),h.useEffect(()=>{s(i)},[i]);const c=j=>{const C=[];return(j||[]).map((N,E)=>{C.push(N.value)}),C},Y=j=>{s(j.target.checked?o:[]),l.setFieldValue(t?.name,j.target.checked?o:[])},y=j=>{s(j),l.setFieldValue(t?.name,j),e?.onChange&&typeof e?.onChange=="function"&&e?.onChange(j)};return r.jsx(M,{...t,children:r.jsxs(n.ConfigProvider,{theme:{components:{Checkbox:{colorPrimary:"var(--check-primary)",colorPrimaryBorder:"var(--check-primary)",colorPrimaryHover:"var(--check-primary-active)"}}},children:[e?.allCheck&&r.jsx(n.Checkbox,{indeterminate:m,checked:a,onChange:Y,children:"전체선택"}),r.jsx(n.Checkbox.Group,{options:e?.options,value:i,onChange:y})]})})},P={year:{displayFormat:"YYYY",outputFormat:"YYYY"},month:{displayFormat:"YYYY-MM",outputFormat:"YYYYMM"},date:{displayFormat:"YYYY-MM-DD",outputFormat:"YYYYMMDD"},time:{displayFormat:"HH:mm",outputFormat:"HHmm"},datetime:{displayFormat:"YYYY-MM-DD HH:mm",outputFormat:"YYYYMMDDHHmm"}},me=({itemProps:t,inputProps:e,type:l="date",returnType:i="string"})=>{const{displayFormat:s,outputFormat:o}=h.useMemo(()=>P[l],[l]),u=h.useMemo(()=>Object.values(P).map(a=>a.outputFormat).sort((a,m)=>{if(a.length===m.length){if(a===o)return-1;if(m===o)return 1}return m.length-a.length}),[o]);return r.jsx(M,{...t,getValueProps:a=>({value:a?T.isDayjs(a)?a:T(a,u):null}),normalize:a=>a?i==="dayjs"?a:a.format(o):null,children:r.jsx(n.DatePicker,{...e,picker:l==="datetime"?"date":l,showTime:e?.showTime??(l==="datetime"||l==="time"),format:s})})},fe=({fileGrpKey:t,onFetchFilesTrxCd:e="SCMFILE00101",readOnly:l=!1,sysCd:i=__SYS_CD__})=>{const[s,o]=h.useState([]);h.useEffect(()=>{t&&e?i!=__SYS_CD__?k.callService_SYSCD(i,e,{crprCd:k.getUserInfo()?.crprCd,sysCd:i,fileGrpKey:t}).then(a=>{if(a?.sub){const m=a.sub.map(c=>({uid:c.fileKey,name:c.lgclFileNm,filePath:c.filePath}));o(m)}}).catch(a=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",a),n.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")}):k.callService(e,{crprCd:k.getUserInfo()?.crprCd,sysCd:i,fileGrpKey:t}).then(a=>{if(a?.sub){const m=a.sub.map(c=>({uid:c.fileKey,name:c.lgclFileNm,filePath:c.filePath}));o(m)}}).catch(a=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",a),n.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")}):o([])},[t,e]);const u=async a=>{try{let m;i!=__SYS_CD__?m="/api/download/"+i:m="/api/download";const c=await fetch(m,{method:"POST",headers:{SYSCD:__SYS_CD__,"Content-Type":"application/json"},body:JSON.stringify({filePath:a.filePath,logicalName:a.name,fileKey:a.uid})});if(!c.ok){const N=(await c.json().catch(()=>null))?.message||"파일 다운로드에 실패했습니다.";throw new Error(N)}const Y=await c.blob(),y=window.URL.createObjectURL(Y),j=document.createElement("a");j.href=y,j.setAttribute("download",a.name),document.body.appendChild(j),j.click(),document.body.removeChild(j),window.URL.revokeObjectURL(y)}catch(m){console.error(m),n.message.error(m.message||"파일을 다운로드하는 중 오류가 발생했습니다.")}};return q.isEmpty(s)?null:r.jsx(n.Card,{title:"파일 목록",children:r.jsx(n.List,{dataSource:s,renderItem:a=>r.jsx(n.List.Item,{actions:l?[]:[r.jsx(n.Button,{type:"text",icon:r.jsx($.DownloadOutlined,{}),onClick:()=>u(a)},"download")],children:r.jsx(n.List.Item.Meta,{avatar:r.jsx($.PaperClipOutlined,{}),title:a.name})})})})},se=h.forwardRef(({children:t,labelCol:e,style:l,className:i,...s},o)=>r.jsx(n.ConfigProvider,{form:{validateMessages:{required:"'${label}을(를) 입력해주세요.'"}},children:r.jsx(n.Form,{ref:o,...s,requiredMark:!1,labelCol:e||{flex:"100px"},style:{padding:"10px",...l},className:`bwg-form ${i??""}`,children:t})}));se.displayName="BwgForm";const ge=({itemProps:t,inputProps:e})=>r.jsx(M,{...t,children:r.jsx(n.Input,{...e})}),{Text:J}=n.Typography,{Dragger:he}=n.Upload,pe=[".pdf",".xlsx",".xls",".docx",".doc",".pptx",".ppt",".hwp",".txt",".csv",".jpg",".jpeg",".png",".gif",".zip"],xe=(t,e=2)=>{if(t===0)return"0 Bytes";const l=1024,i=e<0?0:e,s=["Bytes","KB","MB","GB","TB"],o=Math.floor(Math.log(t)/Math.log(l));return parseFloat((t/Math.pow(l,o)).toFixed(i))+" "+s[o]},Fe=({title:t="첨부파일",fileGrpKey:e,onUploadComplete:l,onSuccessTrxCd:i="SCMFILE00102",anotherServiceTrxCd:s="SCMFILE00105",allowedExtensions:o=pe,maxFileSize:u=2048})=>{const[a,m]=h.useState([]),[c,Y]=h.useState(!1),[y,j]=h.useState(!1),[C,N]=h.useState(0),E=f=>{if(o&&o.length>0){const L=(U=>{const H=U.lastIndexOf(".");return H===-1?"":U.substring(H).toLowerCase()})(f.name);if(!o.includes(L))return n.message.error(`${f.name} 파일은 허용되지 않는 확장자입니다. (${o.join(", ")}만 가능)`),!1}return!0},D=async()=>{const f=a.filter(I=>I.status!=="done"),x=f.reduce((I,A)=>I+(A.size||0),0),L=2*1024*1024*1024;if(x>L){n.notification.error({message:"업로드 용량 초과",description:"한 번에 업로드할 수 있는 총 파일 용량은 2GB를 초과할 수 없습니다."});return}if(f.length===0){n.message.warning("업로드할 파일이 없거나 모든 파일이 이미 업로드되었습니다.");return}j(!0);let U;try{const I=new ae;f.forEach(A=>{A.originFileObj&&I.file(A.name,A.originFileObj)}),U=await I.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:9}})}catch(I){j(!1),n.message.error("파일을 압축하는 중 오류가 발생했습니다."),console.error("Zipping error:",I);return}j(!1);const H=new FormData;H.append("file",U,"upload.zip"),Y(!0),N(0);try{const I=await new Promise((F,w)=>{const v=new XMLHttpRequest;v.open("POST","/api/upload-large",!0),v.upload.onprogress=B=>{if(B.lengthComputable){const W=Math.round(B.loaded/B.total*100);N(W)}},v.onload=()=>{if(v.status>=200&&v.status<300)try{const B=JSON.parse(v.responseText);B.success?F(B):w(new Error(B.message||"파일 업로드에 실패했습니다."))}catch{w(new Error("잘못된 서버 응답입니다."))}else try{const B=JSON.parse(v.responseText);w(new Error(B.message||`서버 오류: ${v.status}`))}catch{w(new Error(`서버 오류: ${v.status}`))}},v.onerror=()=>{w(new Error("네트워크 오류가 발생했습니다."))},v.send(H)});n.message.success(I.message||"압축 파일이 성공적으로 업로드되었습니다.");const A=a.map(F=>f.find(w=>w.uid===F.uid)?{...F,status:"done"}:F);if(m(A),i&&I.uploadedFiles&&Array.isArray(I.uploadedFiles)){const F=k.getUserInfo();I.uploadedFiles.forEach(w=>{const v={crprCd:F?.crprCd,sysCd:__SYS_CD__,fileGrpKey:e,sub:[{crprCd:F?.crprCd,sysCd:__SYS_CD__,fileGrpKey:e,physFileNm:w.fileNameP,lgclFileNm:w.fileNameL,filePath:w.filePath,fileExtn:w.fileExt,fileSize:w.fileSize,mltpYn:"Y"}]};k.callService(i,v).then(B=>{const W=a.map(K=>({crprCd:F?.crprCd,sysCd:__SYS_CD__,fileGrpKey:B.sub[0].fileGrpKey,fileKey:B.sub[0].fileKey,lgclFileNm:K.name,fileSize:K.size,fileExtn:K.name.split(".").pop(),fileType:K.type}));k.callService(s,{sub:W})}).catch(B=>{console.error("후처리 서비스 호출 실패:",B),n.message.error(`${w.fileNameL} 파일의 후처리 작업에 실패했습니다.`)}),l&&l({fileNameP:w.fileNameP,fileNameL:w.fileNameL})})}}catch(I){n.message.error(I.message||"파일 업로드 중 오류가 발생했습니다.");const A=a.map(F=>f.find(w=>w.uid===F.uid)?{...F,status:"error",response:I.message||"파일 업로드 중 오류가 발생했습니다."}:F);m(A)}finally{Y(!1)}},g={multiple:!0,fileList:a,beforeUpload:f=>E(f)?u&&f.size>=u*1024*1024?(n.message.error(`대용량 첨부 파일 최대 크기는 ${(u/1024).toFixed(1)}GB입니다.`),n.Upload.LIST_IGNORE):!1:n.Upload.LIST_IGNORE,onChange:({fileList:f})=>{const x=new Map(a.map(L=>[L.uid,L]));f.forEach(L=>{x.set(L.uid,L)}),m(Array.from(x.values()))},onRemove:f=>{const x=a.filter(L=>L.uid!==f.uid);m(x)},showUploadList:!1};return r.jsx(n.Spin,{spinning:c||y,tip:y?"파일 압축 중...":`파일 업로드 중... ${C}%`,children:r.jsxs("div",{className:"bwg-large-uploader-container",children:[r.jsx(n.Card,{title:r.jsx(J,{strong:!0,children:t}),extra:r.jsx(n.Upload,{...g,children:r.jsx(n.Button,{icon:r.jsx($.UploadOutlined,{}),children:"파일 선택"})}),bodyStyle:{padding:0},children:r.jsx(he,{...g,style:{border:"none",background:"transparent",padding:0},children:r.jsx("div",{className:"upload-list-container",children:a.length>0?r.jsx(n.List,{style:{textAlign:"left"},dataSource:a,renderItem:f=>{const x=f.status==="done",L=f.status==="error";let U;return x?U=r.jsx($.CheckCircleOutlined,{style:{color:"#52c41a",fontSize:14}}):L?U=r.jsx(n.Tooltip,{title:typeof f.response=="string"?f.response:"업로드 실패",children:r.jsx($.CloseCircleOutlined,{style:{color:"#ff4d4f",fontSize:14}})}):U=r.jsx($.FileTextOutlined,{style:{fontSize:14}}),r.jsx(n.List.Item,{actions:[r.jsx(J,{type:"secondary",children:xe(f.size||0)},"size"),r.jsx(n.Button,{type:"text",icon:r.jsx($.DeleteOutlined,{}),onClick:H=>{H.stopPropagation(),g.onRemove?.(f)},disabled:c||y},"delete")],children:r.jsx(n.List.Item.Meta,{avatar:U,title:r.jsx(J,{type:L?"danger":void 0,children:f.name})})},f.uid)}}):r.jsxs(n.Flex,{gap:"middle",align:"center",justify:"center",vertical:!0,style:{padding:"20px 0",minHeight:"120px"},children:[r.jsx($.InboxOutlined,{style:{fontSize:"32px",color:"#999"}}),r.jsx(J,{type:"secondary",children:"업로드할 파일을 선택하거나 이 영역으로 드래그하세요."})]})})})}),a.length>0&&r.jsxs(n.Flex,{justify:"flex-end",align:"center",gap:"large",style:{marginTop:16},children:[c&&r.jsx("div",{style:{width:"250px"},children:r.jsx(n.Progress,{percent:C,size:"small"})}),r.jsx(n.Button,{type:"primary",onClick:D,disabled:c||y||a.filter(f=>f.status!=="done").length===0,icon:r.jsx($.CloudUploadOutlined,{}),children:"일괄 업로드"})]})]})})},ye=t=>{if(typeof t=="string")return t.replace(/0/g,"_");if(Array.isArray(t))return t[0].replace(/0/g,"_");if(typeof t=="object"&&"mask"in t&&"blocks"in t){const{mask:e,blocks:l}=t;return e.split(".").map(i=>{const o=l?.[i]?.maxLength??3;return"_".repeat(o)}).join(".")}return""},Se=({itemProps:t,inputProps:e,mask:l})=>{const i=h.useRef(null),s=n.Form.useFormInstance(),o=h.useMemo(()=>ye(l),[l]);return h.useEffect(()=>{if(!i.current?.input)return;const u=typeof l=="string"||Array.isArray(l)?{mask:l}:l,a=ne(i.current.input,u);return a.on("accept",()=>{s&&t?.name&&s.setFieldValue(t.name,a.value)}),()=>{a.destroy()}},[l,s,t?.name]),r.jsx(M,{...t,children:r.jsx(n.Input,{...e,ref:i,placeholder:o})})},je=t=>{switch(t){case"year":return{format:"YYYY",mask:"0000",outputFormat:"YYYY"};case"month":return{format:"YYYY-MM",mask:"0000-00",outputFormat:"YYYYMM"};case"date":default:return{format:"YYYY-MM-DD",mask:"0000-00-00",outputFormat:"YYYYMMDD"}}},Ye=({type:t="date",itemProps:e={name:"calendar"},inputProps:l})=>{const{format:i,mask:s,outputFormat:o}=je(t),u=h.useRef(null),a=h.useRef(null),m=n.Form.useFormInstance(),[c,Y]=h.useState(!1),[y,j]=h.useState(!1),C=e?.name,[N,E]=h.useState(null);h.useEffect(()=>{if(!u.current?.input)return;const g=ne(u.current.input,{mask:s,lazy:!1});return a.current=g,g.on("accept",()=>{console.log("input :: ",g.value);const f=g.value,x=T(f,i,!0);console.log("input :: ",x),f.length===i.length&&x.isValid()&&(console.log("parsed :: ",x.format(o)),m.setFieldValue(C,x.format(o)),a.current?.updateValue(),Y(!1))}),()=>{g.destroy()}},[i,s]),h.useEffect(()=>{E(T(m.getFieldValue(C)))},[m.getFieldValue(C)]);const D=g=>{if(!g){a.current?.updateValue();return}const f=g.format(o);console.log("formatted :: ",f),a.current&&(a.current.value=f,a.current.updateValue()),j(!1)};return r.jsx(M,{...e,name:void 0,validateStatus:y?"warning":void 0,help:y?"유효하지 않은 날짜입니다":void 0,children:r.jsxs("div",{style:{position:"relative"},children:[r.jsx(n.Form.Item,{name:C,getValueProps:g=>({value:g?T(g).format(i):void 0}),normalize:g=>g?T(g).format(o):void 0,noStyle:!0,children:r.jsx(n.Input,{...l,ref:u,onFocus:()=>{Y(!c),a.current?.updateValue()},onKeyDown:g=>{g.key==="Backspace"&&Y(!0),g.key==="Tab"&&Y(!1)},allowClear:!0,placeholder:s.replace(/0/g,"_"),autoComplete:"off"})}),r.jsx(n.DatePicker,{open:c,picker:t,format:i,value:N,onChange:D,getPopupContainer:g=>g.parentElement,style:{position:"absolute",top:0,left:0,pointerEvents:"none",opacity:0,width:"100%"}})]})})},{Option:Q}=n.Select,Ce=({itemProps:t,inputProps:e})=>{const[l,i]=h.useState([]);return h.useEffect(()=>{e?.addField==="ALL"?i([{label:"전체",value:""},...e?.list||[]]):e?.addField==="NULL"?i([{label:"",value:""},...e?.list||[]]):i(e?.list||[])},[e?.list]),r.jsx(M,{...t,getValueProps:s=>s?{value:s&&s.indexOf(",")>0?s.split(","):[s]}:{value:[]},normalize:s=>s!=null&&s!=null&&s.length>0?s.toString():"",children:r.jsx(n.Select,{...e,mode:"multiple",children:l.map(s=>{const{value:o,label:u}=s;return e?.printCode?r.jsx(Q,{value:o,label:u,children:r.jsx(n.Space,{children:`[${o}] ${u}`})},o):r.jsx(Q,{value:o,label:u,children:r.jsx(n.Space,{children:`${u}`})},o)})})})},we=({itemProps:t,inputProps:e})=>{const l=s=>{let o=s.toString().split(".");return e?.decimalPoint!=null&&o[1]!=null&&e?.decimalPoint>0?o[1].length>e?.decimalPoint?o[1]="."+o[1].substring(0,e?.decimalPoint):o[1]="."+o[1]:o[1]="",o[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")+o[1]},i=s=>{let o=s.toString().split(".");return e?.decimalPoint!=null&&o[1]!=null&&e?.decimalPoint>0?o[1].length>e?.decimalPoint?o[1]="."+o[1].substring(0,e?.decimalPoint):o[1]="."+o[1]:o[1]="",o[0].replace(/\$\s?|(,*)/g,"")+o[1]};return r.jsx(M,{...t,children:r.jsx(n.InputNumber,{...e,formatter:s=>l(s),parser:s=>i(s)})})},Le=({itemProps:t,inputProps:e})=>r.jsx(M,{...t,children:r.jsx(n.Radio.Group,{...e})}),{RangePicker:be}=n.DatePicker,ee={year:{displayFormat:"YYYY",outputFormat:"YYYY"},month:{displayFormat:"YYYY-MM",outputFormat:"YYYYMM"},date:{displayFormat:"YYYY-MM-DD",outputFormat:"YYYYMMDD"},time:{displayFormat:"HH:mm",outputFormat:"HHmm"},datetime:{displayFormat:"YYYY-MM-DD HH:mm",outputFormat:"YYYYMMDDHHmm"}},Ie=({itemProps:t,inputProps:e,type:l="date",minDate:i,maxDate:s,returnType:o="string"})=>{const{displayFormat:u,outputFormat:a}=h.useMemo(()=>ee[l],[l]),m=h.useMemo(()=>Object.values(ee).map(c=>c.outputFormat).sort((c,Y)=>{if(c.length===Y.length){if(c===a)return-1;if(Y===a)return 1}return Y.length-c.length}),[a]);return r.jsx(M,{...t,getValueProps:c=>({value:c&&c.length>0?[c[0]?T.isDayjs(c[0])?c[0]:T(c[0],m):null,c[1]?T.isDayjs(c[1])?c[1]:T(c[1],m):null]:null}),normalize:c=>c?o==="dayjs"?[c[0]??void 0,c[1]??void 0]:[c[0]?c[0].format(a):void 0,c[1]?c[1].format(a):void 0]:[void 0,void 0],children:r.jsx(be,{...e,order:!0,minDate:i?T(i,m):void 0,maxDate:s?T(s,m):void 0,picker:l==="datetime"?"date":l,showTime:e?.showTime??(l==="datetime"||l==="time"),format:u})})},te=n.Input.Search,Be=t=>{const e=n.Form.useFormInstance(),{openPopup:l}=ie.usePopupStore(),i=t.itemProps?.name||[],s=t.popupConfig||{callback(u){console.log("callback data :: ",u),i.length>1?(e.setFieldValue(i[0],u.code),e.setFieldValue(i[1],u.name)):e.setFieldValue(i,u.code)}},o={...t,placeholder:typeof t.placeholder=="string"?t.placeholder:t.placeholder?.[0]||"",onChange:u=>{i.length>1&&e.setFieldValue(i[0],""),t.onChange?.(u)},onSearch:u=>{t.popuCd?l(t.popuCd,t.popupParams,s):t.onSearch?.(u)}};return i.length>1?r.jsx(M,{...t.itemProps,name:void 0,children:r.jsxs(n.Space.Compact,{block:!0,children:[r.jsx(n.Form.Item,{name:i[0],rules:t.itemProps?.rules,style:{width:"40%",marginBottom:0,marginInlineEnd:0},validateStatus:"",help:"",children:r.jsx(n.Input,{style:{color:"#999",backgroundColor:"#f5f5f5"},placeholder:t.placeholder?.[0]||"",readOnly:!0})}),r.jsx(n.Form.Item,{name:i[1],style:{width:"60%",marginBottom:0},children:r.jsx(te,{readOnly:t.readOnly,enterButton:r.jsx(n.Button,{icon:r.jsx($.SearchOutlined,{}),disabled:t.readOnly}),...o})})]})}):r.jsx(M,{...t.itemProps,children:r.jsx(te,{...o})})},Me=({itemProps:t,selectProps:e={options:[],allowClear:!0}})=>{const l=n.Form.useFormInstance(),i=!!l,s=h.useMemo(()=>e?.addField==="ALL"?[{label:"전체",value:""},...e?.options||[]]:e?.addField==="NULL"?[{label:"",value:""},...e?.options||[]]:e?.options||[],[e.options,e.addField]),o=m=>{e.onChange?.(m)},u={...e,allowClear:e.allowClear??!0,options:s,onChange:o,variant:e.variant},a=r.jsx(n.Select,{...u,disabled:e.disabled});return e.copyable&&!i&&console.warn("BwgSelect: copyable 기능은 Form 컨텍스트 내에서만 사용 가능합니다."),e.copyable?r.jsx(M,{...t,name:void 0,children:r.jsxs(n.Space.Compact,{block:!0,children:[r.jsx(n.Form.Item,{name:t?.name,rules:t?.rules,style:{width:"100%",marginBottom:0},validateStatus:"",help:"",children:a}),r.jsx(n.Typography.Paragraph,{copyable:{text:i&&l?.getFieldValue(t?.name)?.toString()||"",tooltips:["코드복사","코드복사됨"]},style:{margin:0,backgroundColor:"#f5f5f5",borderRadius:"4px",border:"1px solid #d9d9d9",fontSize:"12px",color:"#666",display:"flex",alignItems:"center",height:"30px",padding:"0 8px"}})]})}):r.jsx(M,{...t,children:a})},_e=({itemProps:t,inputProps:e={format:"YN"}})=>{const l=n.Form.useFormInstance(),i=(s,o)=>{e.format==="boolean"?l.setFieldValue(t?.name,s):l.setFieldValue(t?.name,s?"Y":"N"),e.onChange&&e.onChange(s,o)};return r.jsx(M,{...t,getValueProps:s=>({checked:e.format==="boolean"?!!s:s==="Y"}),normalize:s=>typeof s=="boolean"?e.format==="boolean"?s:s?"Y":"N":e.format==="boolean"?!!s:s?"Y":"N",children:r.jsx(n.Switch,{...e,onChange:(s,o)=>i(s,o)})})},{TextArea:Ne}=n.Input,De=({itemProps:t,inputProps:e})=>r.jsx(M,{...t,children:r.jsx(Ne,{...e})}),ke=[".pdf",".xlsx",".xls",".docx",".doc",".pptx",".ppt",".hwp",".txt",".csv",".jpg",".jpeg",".png",".gif",".zip"],re={FILE:"file"},ve=({originNode:t,file:e,fileList:l,moveFile:i,onDrop:s})=>{const o=h.useRef(null),[{handlerId:u},a]=X.useDrop({accept:re.FILE,collect:y=>({handlerId:y.getHandlerId()}),hover(y,j){if(!o.current)return;const C=y.uid,N=e.uid;if(C===N)return;const E=q.findIndex(l,{uid:N}),D=q.findIndex(l,{uid:C});if(D===-1||E===-1)return;const g=o.current.getBoundingClientRect(),f=j.getClientOffset();if(!f)return;const x=(g.bottom-g.top)/2,L=f.y-g.top;D<E&&L<x||D>E&&L>x||i(C,N)},drop(){s()}}),[{isDragging:m},c]=X.useDrag({type:re.FILE,item:()=>({uid:e.uid,index:q.findIndex(l,{uid:e.uid})}),collect:y=>({isDragging:y.isDragging()})}),Y=m?0:1;return c(a(o)),r.jsx("div",{ref:o,style:{opacity:Y},"data-handler-id":u,children:t})},Ee=({itemProps:t,fileGrpKey:e,onUploadComplete:l,onFetchFilesTrxCd:i="SCMFILE00101",onSuccessTrxCd:s="SCMFILE00102",onDeleteFileTrxCd:o="SCMFILE00103",onReorderFilesTrxCd:u="SCMFILE00104",allowedExtensions:a=ke,maxFileSize:m=200,showButton:c=!0,multiple:Y=!1,newFileGrpKeyonModify:y=!1,buttonText:j="파일 선택",localOnly:C=!1,onFilesChange:N})=>{const[E,D]=h.useState([]),g=h.useRef(e),f=h.useRef([]),x=n.Form.useFormInstance(),L=()=>{if(C||f.current.length===0)return;const d=[...f.current];if(f.current=[],s){const b=d.map(S=>({crprCd:k.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:g.current,physFileNm:S.fileNameP,lgclFileNm:S.fileNameL,filePath:S.filePath,fileExtn:S.fileExt,fileSize:S.fileSize,mltpYn:"N"}));console.log("newFileGrpKeyonModify",y),console.log("newFileGrpKeyonModify",y?0:g.current),k.callService(s,{crprCd:k.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:y?0:g.current,oldFileGrpKey:g.current,newFileGrpKeyonModify:y,sub:b}).then(S=>{if(S?.sub&&S.sub.length>0){const p=S.sub[0].fileGrpKey;(!g.current||y)&&(g.current=p);const O=new Map;S.sub.forEach(_=>{const V=d.find(z=>z.fileNameL===_.lgclFileNm);V&&O.set(V.tempId,_)});const G=t?.name;(_=>{if(F){const V=x?.getFieldValue(G)||[],z=_(V);x?.setFieldValue(G,z)}else D(V=>_(V))})(_=>_.map(V=>{const z=O.get(V.uid);if(z){const Z=d.find(oe=>oe.tempId===V.uid);return l&&Z&&l({...Z,fileGrpKey:p,fileKey:z.fileKey}),{...V,name:z.lgclFileNm,fileGrpKey:p,fileKey:z.fileKey,uid:z.fileKey,status:"done",url:`/api/download?filePath=${z.filePath}&logicalName=${z.lgclFileNm}`}}return V}))}}).catch(S=>{console.error("업로드 후처리 서비스 호출 실패:",S),n.message.error("파일 후처리 중 오류가 발생했습니다.");const p=new Set(d.map(R=>R.tempId)),O=t?.name;(R=>{if(F){const _=x?.getFieldValue(O)||[],V=R(_);x?.setFieldValue(O,V)}else D(_=>R(_))})(R=>R.map(_=>p.has(_.uid)?{..._,status:"error",error:"후처리 실패"}:_))})}},U=h.useRef(q.debounce(L,500)).current;h.useEffect(()=>()=>{U.cancel()},[U]),h.useEffect(()=>{g.current=e},[e]),h.useEffect(()=>{C||e&&i&&k.callService(i,{crprCd:k.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:e}).then(d=>{if(d?.sub){const b=d.sub.map(p=>({uid:p.fileKey,name:p.lgclFileNm,status:"done",url:`/api/download?filePath=${p.filePath}&logicalName=${p.lgclFileNm}`})),S=t?.name;F?x?.setFieldValue(S,b):D(b)}else{const b=t?.name;F?x?.setFieldValue(b,[]):D([])}}).catch(d=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",d),n.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")})},[e,i]);const H=(d,b)=>{const S=t?.name,p=F?x?.getFieldValue(S)||[]:E,O=q.findIndex(p,{uid:d}),G=q.findIndex(p,{uid:b});if(O<0||G<0)return;const R=[...p],[_]=R.splice(O,1);R.splice(G,0,_),F?x?.setFieldValue(S,R):D(R)},I=()=>{if(!C&&e&&u){const d=t?.name,S=(F?x?.getFieldValue(d)||[]:E).map(p=>p.uid);k.callService(u,{crprCd:k.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:e,reorderedFileKeys:S}).then(()=>{n.message.success("파일 순서가 성공적으로 저장되었습니다.")}).catch(p=>{console.error("파일 순서 저장 서비스 호출 실패:",p),n.message.error("파일 순서 저장 중 오류가 발생했습니다.")})}},A=d=>{const b=t?.name,S=F?x?.getFieldValue(b)||[]:E;if(!Y&&S.length>0)return n.message.error("하나의 파일만 업로드할 수 있습니다."),n.Upload.LIST_IGNORE;if(a&&a.length>0){const p=`.${d.name.split(".").pop()?.toLowerCase()}`;if(!a.includes(p))return n.message.error(`${d.name} 파일은 허용되지 않는 확장자입니다. (${a.join(", ")})`),n.Upload.LIST_IGNORE}return m&&!(d.size/1024/1024<m)?(n.message.error(`일반업로드의 최대용량은 ${m}MB입니다.`),n.Upload.LIST_IGNORE):!C},F=!!t?.name,w={name:"file",multiple:Y,action:C?void 0:"/api/upload",beforeUpload:A,showUploadList:{showRemoveIcon:c},onChange(d){const{status:b,uid:S}=d.file;if(b==="removed"){if(!C&&o)k.callService(o,{crprCd:k.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:y?0:g.current,fileKey:S,oldFileGrpKey:g.current,newFileGrpKeyonModify:y}).then(p=>{if(n.message.success("파일이 성공적으로 삭제되었습니다."),y&&(g.current=p.fileGrpKey),F){const O=t?.name;x?.setFieldValue(O,d.fileList)}else D(d.fileList);N?.(d.fileList),l?.({fileGrpKey:p.fileGrpKey})}).catch(p=>{console.error("파일 삭제 서비스 호출에 실패했습니다.",p),n.message.error("파일 삭제 중 오류가 발생했습니다.")});else{if(F){const p=t?.name;x?.setFieldValue(p,d.fileList)}else D(d.fileList);N?.(d.fileList)}return}if(F){const p=t?.name;x?.setFieldValue(p,d.fileList)}else D(d.fileList);if(N?.(d.fileList),b==="done")if(!C&&d.file.response?.success){const{uploadedFiles:p}=d.file.response;p&&Array.isArray(p)&&p.length>0&&(p.forEach(O=>{O.tempId=d.file.uid,f.current.push(O)}),U()),n.message.success(d.file.response.message||`${d.file.name} 파일이 성공적으로 업로드되었습니다.`)}else n.message.error(d.file.response?.message||`${d.file.name} 파일 업로드에 실패했습니다.`);else b==="error"&&n.message.error(d.file.response?.message||`${d.file.name} 파일 업로드 중 오류가 발생했습니다.`)},itemRender(d,b,S){const p=h.cloneElement(d,{href:b.url||void 0,title:void 0});return r.jsx(ve,{originNode:p,file:b,fileList:S,moveFile:H,onDrop:I},b.uid)}};F||(w.fileList=E);const v=d=>Array.isArray(d)?d:d&&d.fileList,B=t?.name,W=F?n.Form.useWatch?.(B,x):void 0,K=F?W||[]:E;return r.jsx(X.DndProvider,{backend:le.HTML5Backend,children:r.jsx(M,{valuePropName:"fileList",getValueFromEvent:v,...t,children:r.jsx(n.Upload,{headers:{SYSCD:__SYS_CD__},...w,listType:"picture",children:c&&(Y||K.length===0)&&r.jsx(n.Button,{icon:r.jsx($.UploadOutlined,{}),children:j})})})})};exports.BwgButton=ce;exports.BwgCheck=de;exports.BwgCheckList=ue;exports.BwgDatePicker=me;exports.BwgDownload=fe;exports.BwgForm=se;exports.BwgFormItem=M;exports.BwgInput=ge;exports.BwgLargeUploader=Fe;exports.BwgMaskedInput=Se;exports.BwgMaskedPicker=Ye;exports.BwgMultiSelect=Ce;exports.BwgNumber=we;exports.BwgRadio=Le;exports.BwgRangePicker=Ie;exports.BwgSearch=Be;exports.BwgSelect=Me;exports.BwgSwitch=_e;exports.BwgTextArea=De;exports.BwgUploader=Ee;
|
|
@@ -1048,7 +1048,7 @@ const St = ({ itemProps: t, inputProps: e }) => /* @__PURE__ */ r(D, { ...t, chi
|
|
|
1048
1048
|
}).then((y) => {
|
|
1049
1049
|
if (y?.sub && y.sub.length > 0) {
|
|
1050
1050
|
const h = y.sub[0].fileGrpKey;
|
|
1051
|
-
f.current || (f.current = h);
|
|
1051
|
+
(!f.current || F) && (f.current = h);
|
|
1052
1052
|
const V = /* @__PURE__ */ new Map();
|
|
1053
1053
|
y.sub.forEach((M) => {
|
|
1054
1054
|
const U = c.find(
|
|
@@ -1184,7 +1184,7 @@ const St = ({ itemProps: t, inputProps: e }) => /* @__PURE__ */ r(D, { ...t, chi
|
|
|
1184
1184
|
oldFileGrpKey: f.current,
|
|
1185
1185
|
newFileGrpKeyonModify: F
|
|
1186
1186
|
}).then((h) => {
|
|
1187
|
-
if (b.success("파일이 성공적으로 삭제되었습니다."), p) {
|
|
1187
|
+
if (b.success("파일이 성공적으로 삭제되었습니다."), F && (f.current = h.fileGrpKey), p) {
|
|
1188
1188
|
const V = t?.name;
|
|
1189
1189
|
g?.setFieldValue(V, c.fileList);
|
|
1190
1190
|
} else
|