@bwg-ui/core 1.2.30 → 1.2.32

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.
Files changed (37) hide show
  1. package/dist/chunks/{CMSearchIntfGwP01-CIf-fHXy.js → CMSearchIntfGwP01-C_y_G3xh.js} +108 -94
  2. package/dist/chunks/CMSearchIntfGwP01-uJxdFXUb.cjs +1 -0
  3. package/dist/chunks/{MenuReport-DQS5SAmi.cjs → MenuReport-DkWB3Yyc.cjs} +1 -1
  4. package/dist/chunks/{MenuReport-GeXRkcDD.js → MenuReport-XwdiwiFn.js} +1 -1
  5. package/dist/chunks/{common-components-DNos8aEG.js → common-components-Cxh8PLBH.js} +5 -5
  6. package/dist/chunks/{common-components-CyqUT5Vj.cjs → common-components-DcTm1Tn1.cjs} +1 -1
  7. package/dist/chunks/layout-components-B4ptqDmC.cjs +35 -0
  8. package/dist/chunks/{layout-components-C4ehuALr.js → layout-components-Bp6b-T1V.js} +495 -474
  9. package/dist/components/common/BwgPopup.d.ts.map +1 -1
  10. package/dist/components/common/index.cjs +1 -1
  11. package/dist/components/common/index.js +1 -1
  12. package/dist/components/core/BwgMaskedPicker.d.ts.map +1 -1
  13. package/dist/components/core/index.cjs +1 -1
  14. package/dist/components/core/index.js +683 -615
  15. package/dist/components/guide/index.cjs +1 -1
  16. package/dist/components/guide/index.js +1 -1
  17. package/dist/components/layout/custom/ConfigurableSidebar.d.ts.map +1 -1
  18. package/dist/components/layout/index.cjs +1 -1
  19. package/dist/components/layout/index.js +1 -1
  20. package/dist/components/popup/CMSearchIntfGwP01.d.ts.map +1 -1
  21. package/dist/components/popup/index.cjs +1 -1
  22. package/dist/components/popup/index.js +1 -1
  23. package/dist/index.cjs +1 -1
  24. package/dist/index.js +2 -2
  25. package/dist/provider/contexts/ServiceCodeContext.d.ts.map +1 -1
  26. package/dist/provider/index.cjs +1 -1
  27. package/dist/provider/index.js +90 -90
  28. package/dist/stores/index.cjs +1 -1
  29. package/dist/stores/index.js +1 -1
  30. package/dist/styles/layout.css +1234 -1176
  31. package/dist/utils/index.cjs +1 -1
  32. package/dist/utils/index.js +1 -1
  33. package/package.json +1 -1
  34. package/dist/chunks/CMSearchIntfGwP01-C4Kg1iWo.cjs +0 -1
  35. package/dist/chunks/layout-components-USIA9TVn.cjs +0 -35
  36. package/dist/components/common/BwgDraggable.d.ts +0 -25
  37. package/dist/components/common/BwgDraggable.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"BwgPopup.d.ts","sourceRoot":"","sources":["../../../src/components/common/BwgPopup.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,SAAS,EAA6B,MAAM,OAAO,CAAC;AAIjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAa1C;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,YAAY;IACZ,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,YAAY;IACZ,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC7B,kCAAkC;IAClC,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,aAAa;IACb,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,YAAY;IACZ,QAAQ,EAAE,SAAS,CAAC;CACrB;AAmDD,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAuK/B,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"BwgPopup.d.ts","sourceRoot":"","sources":["../../../src/components/common/BwgPopup.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,SAAS,EAA6B,MAAM,OAAO,CAAC;AAIjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAc1C;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,YAAY;IACZ,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,YAAY;IACZ,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC7B,kCAAkC;IAClC,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,aAAa;IACb,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,YAAY;IACZ,QAAQ,EAAE,SAAS,CAAC;CACrB;AAmDD,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAwK/B,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/common-components-CyqUT5Vj.cjs"),o=require("../../utils/index.cjs");exports.ButtonAccessController=e.ButtonAccessController;exports.BwgButtonGroup=e.BwgButtonGroup;exports.BwgCmptArea=e.BwgCmptArea;exports.BwgCol=e.BwgCol;exports.BwgConfigProvider=e.BwgConfigProvider;exports.BwgDetail=e.BwgDetail;exports.BwgDrawer=e.BwgDrawer;exports.BwgEditor=e.BwgEditor;exports.BwgGrid=e.BwgGrid;exports.BwgInfoArea=e.BwgInfoArea;exports.BwgPagination=e.BwgPagination;exports.BwgPopup=e.BwgPopup;exports.BwgRow=e.BwgRow;exports.BwgSpace=e.BwgSpace;exports.BwgTable=e.BwgTable;exports.BwgTabs=e.BwgTabs;exports.BwgTitleBox=e.BwgTitleBox;exports.BwgView=e.BwgView;exports.ContentBox=e.ContentBox;exports.ContentLayOut=e.ContentLayOut;exports.GlobalConfigProvider=e.GlobalConfigProvider;exports.QuickServiceToggle=e.QuickServiceToggle;exports.SSOHandler=e.SSOHandler;exports.SearchBox=e.SearchBox;exports.createBwgGridRenderer=e.createBwgGridRenderer;exports.realFormat=o.realFormat;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/common-components-DcTm1Tn1.cjs"),o=require("../../utils/index.cjs");exports.ButtonAccessController=e.ButtonAccessController;exports.BwgButtonGroup=e.BwgButtonGroup;exports.BwgCmptArea=e.BwgCmptArea;exports.BwgCol=e.BwgCol;exports.BwgConfigProvider=e.BwgConfigProvider;exports.BwgDetail=e.BwgDetail;exports.BwgDrawer=e.BwgDrawer;exports.BwgEditor=e.BwgEditor;exports.BwgGrid=e.BwgGrid;exports.BwgInfoArea=e.BwgInfoArea;exports.BwgPagination=e.BwgPagination;exports.BwgPopup=e.BwgPopup;exports.BwgRow=e.BwgRow;exports.BwgSpace=e.BwgSpace;exports.BwgTable=e.BwgTable;exports.BwgTabs=e.BwgTabs;exports.BwgTitleBox=e.BwgTitleBox;exports.BwgView=e.BwgView;exports.ContentBox=e.ContentBox;exports.ContentLayOut=e.ContentLayOut;exports.GlobalConfigProvider=e.GlobalConfigProvider;exports.QuickServiceToggle=e.QuickServiceToggle;exports.SSOHandler=e.SSOHandler;exports.SearchBox=e.SearchBox;exports.createBwgGridRenderer=e.createBwgGridRenderer;exports.realFormat=o.realFormat;
@@ -1,4 +1,4 @@
1
- import { f as e, q as o, r, j as B, B as g, s as w, t, p as i, h as n, u as l, o as d, n as p, i as C, b as c, v as u, l as f, e as S, k as m, d as x, C as G, G as b, Q as v, w as P, S as T, m as A } from "../../chunks/common-components-DNos8aEG.js";
1
+ import { f as e, q as o, r, j as B, B as g, s as w, t, p as i, h as n, u as l, o as d, n as p, i as C, b as c, v as u, l as f, e as S, k as m, d as x, C as G, G as b, Q as v, w as P, S as T, m as A } from "../../chunks/common-components-Cxh8PLBH.js";
2
2
  import { realFormat as k } from "../../utils/index.js";
3
3
  export {
4
4
  e as ButtonAccessController,
@@ -1 +1 @@
1
- {"version":3,"file":"BwgMaskedPicker.d.ts","sourceRoot":"","sources":["../../../src/components/core/BwgMaskedPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAIvC,OAAO,EAAE,EAAE,EAA+B,MAAM,OAAO,CAAC;AACxD,OAAoB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE9D,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAkBjD,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,GAAG,IAAI,CAAC,UAAU,EAAE,OAAO,GAAG,UAAU,CAAC,CAAC;AAE3C,QAAA,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CA2H7C,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"BwgMaskedPicker.d.ts","sourceRoot":"","sources":["../../../src/components/core/BwgMaskedPicker.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAIvC,OAAO,EAAE,EAAE,EAA+B,MAAM,OAAO,CAAC;AACxD,OAAoB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE9D,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAkBjD,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,GAAG,IAAI,CAAC,UAAU,EAAE,OAAO,GAAG,UAAU,CAAC,CAAC;AAE3C,QAAA,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAoR7C,CAAC;AAEF,eAAe,eAAe,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"),ne=require("../../stores/index.cjs"),R=require("dayjs"),$=require("@ant-design/icons"),q=require("lodash"),k=require("../../utils/index.cjs"),ie=require("jszip"),se=require("imask"),J=require("react-dnd"),le=require("react-dnd-html5-backend"),ce=t=>{const{componentSize:e}=ne.useUserStore(),l=g.useMemo(()=>t.size?t.size:{0:"small",1:"middle",2:"large"}[e],[e,t.size]),i=g.useMemo(()=>({0:12,1:14,2:16})[e],[e]);return r.jsx(n.Button,{...t,size:l,className:"bwg-btn",style:{fontSize:`${i}px`,...t.style},children:t.children})},_=g.memo(({children:t,label:e,name:l,rules:i,initialValue:s,style:o,required:m,...a})=>{const u={fontWeight:"bold"};(i==null||i==null)&&m&&(i=[{required:!0,message:`${e}을(를) 입력해주세요.`}]);const c=Array.isArray(i)&&i.some(F=>F.required===!0),Y=()=>typeof e=="string"?r.jsxs("span",{style:u,children:[e,c&&r.jsx("span",{style:{color:"#ff4d4f",marginLeft:"4px"},children:"*"})]}):r.jsx("span",{style:u,children:e});return r.jsx(n.Form.Item,{className:"bwg-form-item",label:e?Y():void 0,labelAlign:a.labelAlign||"left",name:l,rules:i,colon:!1,initialValue:s,style:o,...a,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(_,{...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,m]=g.useState([]),a=o.length>0&&o.length==i?.length,u=i?.length>0&&i.length<o.length;g.useEffect(()=>{m(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:[])},F=j=>{s(j),l.setFieldValue(t?.name,j),e?.onChange&&typeof e?.onChange=="function"&&e?.onChange(j)};return r.jsx(_,{...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:u,checked:a,onChange:Y,children:"전체선택"}),r.jsx(n.Checkbox.Group,{options:e?.options,value:i,onChange:F})]})})},Z={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(()=>Z[l],[l]),m=g.useMemo(()=>Object.values(Z).map(a=>a.outputFormat).sort((a,u)=>{if(a.length===u.length){if(a===o)return-1;if(u===o)return 1}return u.length-a.length}),[o]);return r.jsx(_,{...t,getValueProps:a=>({value:a?R.isDayjs(a)?a:R(a,m):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.callServiceBySysCd(__APP_CD__,e,{crprCd:k.getUserInfo()?.crprCd,sysCd:i,fileGrpKey:t}).then(a=>{if(a?.sub){const u=a.sub.map(c=>({uid:c.fileKey,name:c.lgclFileNm,filePath:c.filePath}));o(u)}}).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 u=a.sub.map(c=>({uid:c.fileKey,name:c.lgclFileNm,filePath:c.filePath}));o(u)}}).catch(a=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",a),n.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")}):o([])},[t,e]);const m=async a=>{try{let u;i!=__SYS_CD__?u="/api/download/"+i:u="/api/download";const c=await fetch(u,{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(),F=window.URL.createObjectURL(Y),j=document.createElement("a");j.href=F,j.setAttribute("download",a.name),document.body.appendChild(j),j.click(),document.body.removeChild(j),window.URL.revokeObjectURL(F)}catch(u){console.error(u),n.message.error(u.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:()=>m(a)},"download")],children:r.jsx(n.List.Item.Meta,{avatar:r.jsx($.PaperClipOutlined,{}),title:a.name})})})})},oe=g.forwardRef(({children:t,labelCol:e,style:l,className:i,...s},o)=>r.jsx(n.ConfigProvider,{form:{},children:r.jsx(n.Form,{ref:o,...s,requiredMark:!1,labelCol:e||{flex:"100px"},style:{padding:"10px",...l},className:`bwg-form ${i??""}`,children:t})}));oe.displayName="BwgForm";const ge=({itemProps:t,inputProps:e})=>r.jsx(_,{...t,children:r.jsx(n.Input,{...e})}),{Text:W}=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:m=2048})=>{const[a,u]=g.useState([]),[c,Y]=g.useState(!1),[F,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 ie;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((y,w)=>{const v=new XMLHttpRequest;v.open("POST","/api/upload-large",!0),v.upload.onprogress=M=>{if(M.lengthComputable){const P=Math.round(M.loaded/M.total*100);N(P)}},v.onload=()=>{if(v.status>=200&&v.status<300)try{const M=JSON.parse(v.responseText);M.success?y(M):w(new Error(M.message||"파일 업로드에 실패했습니다."))}catch{w(new Error("잘못된 서버 응답입니다."))}else try{const M=JSON.parse(v.responseText);w(new Error(M.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(y=>f.find(w=>w.uid===y.uid)?{...y,status:"done"}:y);if(u(A),i&&I.uploadedFiles&&Array.isArray(I.uploadedFiles)){const y=k.getUserInfo();I.uploadedFiles.forEach(w=>{const v={crprCd:y?.crprCd,sysCd:__SYS_CD__,fileGrpKey:e,sub:[{crprCd:y?.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(M=>{const P=a.map(K=>({crprCd:y?.crprCd,sysCd:__SYS_CD__,fileGrpKey:M.sub[0].fileGrpKey,fileKey:M.sub[0].fileKey,lgclFileNm:K.name,fileSize:K.size,fileExtn:K.name.split(".").pop(),fileType:K.type}));k.callService(s,{sub:P})}).catch(M=>{console.error("후처리 서비스 호출 실패:",M),n.message.error(`${w.fileNameL} 파일의 후처리 작업에 실패했습니다.`)}),l&&l({fileNameP:w.fileNameP,fileNameL:w.fileNameL})})}}catch(I){n.message.error(I.message||"파일 업로드 중 오류가 발생했습니다.");const A=a.map(y=>f.find(w=>w.uid===y.uid)?{...y,status:"error",response:I.message||"파일 업로드 중 오류가 발생했습니다."}:y);u(A)}finally{Y(!1)}},h={multiple:!0,fileList:a,beforeUpload:f=>E(f)?m&&f.size>=m*1024*1024?(n.message.error(`대용량 첨부 파일 최대 크기는 ${(m/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)}),u(Array.from(x.values()))},onRemove:f=>{const x=a.filter(L=>L.uid!==f.uid);u(x)},showUploadList:!1};return r.jsx(n.Spin,{spinning:c||F,tip:F?"파일 압축 중...":`파일 업로드 중... ${C}%`,children:r.jsxs("div",{className:"bwg-large-uploader-container",children:[r.jsx(n.Card,{title:r.jsx(W,{strong:!0,children:t}),extra:r.jsx(n.Upload,{...h,children:r.jsx(n.Button,{icon:r.jsx($.UploadOutlined,{}),children:"파일 선택"})}),style:{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(W,{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||F},"delete")],children:r.jsx(n.List.Item.Meta,{avatar:U,title:r.jsx(W,{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(W,{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||F||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 m=typeof l=="string"||Array.isArray(l)?{mask:l}:l,a=se(i.current.input,m);return a.on("accept",()=>{s&&t?.name&&s.setFieldValue(t.name,a.value)}),()=>{a.destroy()}},[l,s,t?.name]),r.jsx(_,{...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),m=g.useRef(null),a=g.useRef(null),u=n.Form.useFormInstance(),[c,Y]=g.useState(!1),[F,j]=g.useState(!1),C=e?.name,[N,E]=g.useState(null);g.useEffect(()=>{if(!m.current?.input)return;const h=se(m.current.input,{mask:s,lazy:!1});return a.current=h,h.on("accept",()=>{console.log("input :: ",h.value);const f=h.value,x=R(f,i,!0);console.log("input :: ",x),f.length===i.length&&x.isValid()&&(console.log("parsed :: ",x.format(o)),u.setFieldValue(C,x.format(o)),a.current?.updateValue(),Y(!1))}),()=>{h.destroy()}},[i,s]),g.useEffect(()=>{E(R(u.getFieldValue(C)))},[u.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(_,{...e,name:void 0,validateStatus:F?"warning":void 0,help:F?"유효하지 않은 날짜입니다":void 0,children:r.jsxs("div",{style:{position:"relative"},children:[r.jsx(n.Form.Item,{name:C,getValueProps:h=>({value:h?R(h).format(i):void 0}),normalize:h=>h?R(h).format(o):void 0,noStyle:!0,children:r.jsx(n.Input,{...l,ref:m,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(_,{...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:m}=s;return e?.printCode?r.jsx(Q,{value:o,label:m,children:r.jsx(n.Space,{children:`[${o}] ${m}`})},o):r.jsx(Q,{value:o,label:m,children:r.jsx(n.Space,{children:`${m}`})},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(_,{...t,children:r.jsx(n.InputNumber,{...e,formatter:s=>l(s),parser:s=>i(s)})})},Le=({itemProps:t,inputProps:e})=>r.jsx(_,{...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:m,outputFormat:a}=g.useMemo(()=>ee[l],[l]),u=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(_,{...t,getValueProps:c=>({value:c&&c.length>0?[c[0]?R.isDayjs(c[0])?c[0]:R(c[0],u):null,c[1]?R.isDayjs(c[1])?c[1]:R(c[1],u):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?R(i,u):void 0,maxDate:s?R(s,u):void 0,picker:l==="datetime"?"date":l,showTime:e?.showTime??(l==="datetime"||l==="time"),format:m})})},te=n.Input.Search,Me=t=>{const e=n.Form.useFormInstance(),{openPopup:l}=ne.usePopupStore(),i=t.itemProps?.name||[],s=t.popupConfig||{callback(m){console.log("callback data :: ",m),i.length>1?(e.setFieldValue(i[0],m.code),e.setFieldValue(i[1],m.name)):e.setFieldValue(i,m.code)}},o={...t,placeholder:typeof t.placeholder=="string"?t.placeholder:t.placeholder?.[0]||"",onChange:m=>{i.length>1&&e.setFieldValue(i[0],""),t.onChange?.(m)},onSearch:m=>{t.popuCd?l(t.popuCd,t.popupParams,s):t.onSearch?.(m)}};return i.length>1?r.jsx(_,{...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(_,{...t.itemProps,children:r.jsx(te,{...o})})},_e=({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=u=>{e.onChange?.(u)},m={...e,allowClear:e.allowClear??!0,options:s,onChange:o,variant:e.variant},a=r.jsx(n.Select,{...m,disabled:e.disabled});return e.copyable&&!i&&console.warn("BwgSelect: copyable 기능은 Form 컨텍스트 내에서만 사용 가능합니다."),e.copyable?r.jsx(_,{...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(_,{...t,children:a})},Be=({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(_,{...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(_,{...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:m},a]=J.useDrop({accept:re.FILE,collect:F=>({handlerId:F.getHandlerId()}),hover(F,j){if(!o.current)return;const C=F.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:u},c]=J.useDrag({type:re.FILE,item:()=>({uid:e.uid,index:q.findIndex(l,{uid:e.uid})}),collect:F=>({isDragging:F.isDragging()})}),Y=u?0:1;return c(a(o)),r.jsx("div",{ref:o,style:{opacity:Y},"data-handler-id":m,children:t})},Ee=({itemProps:t,fileGrpKey:e,onUploadComplete:l,onFetchFilesTrxCd:i="SCMFILE00101",onSuccessTrxCd:s="SCMFILE00102",onDeleteFileTrxCd:o="SCMFILE00103",onReorderFilesTrxCd:m="SCMFILE00104",allowedExtensions:a=ke,maxFileSize:u=200,showButton:c=!0,multiple:Y=!1,newFileGrpKeyonModify:F=!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",F),console.log("newFileGrpKeyonModify",F?0:h.current),k.callService(s,{crprCd:k.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:F?0:h.current,oldFileGrpKey:h.current,newFileGrpKeyonModify:F,sub:b}).then(S=>{if(S?.sub&&S.sub.length>0){const p=S.sub[0].fileGrpKey;(!h.current||F)&&(h.current=p);const O=new Map;S.sub.forEach(B=>{const z=d.find(T=>T.fileNameL===B.lgclFileNm);z&&O.set(z.tempId,B)});const G=t?.name;(B=>{if(y){const z=x?.getFieldValue(G)||[],T=B(z);x?.setFieldValue(G,T)}else D(z=>B(z))})(B=>B.map(z=>{const T=O.get(z.uid);if(T){const X=d.find(ae=>ae.tempId===z.uid);return l&&X&&l({...X,fileGrpKey:p,fileKey:T.fileKey}),{...z,name:T.lgclFileNm,fileGrpKey:p,fileKey:T.fileKey,uid:T.fileKey,status:"done",url:`/api/download?filePath=${T.filePath}&logicalName=${T.lgclFileNm}`}}return z}))}}).catch(S=>{console.error("업로드 후처리 서비스 호출 실패:",S),n.message.error("파일 후처리 중 오류가 발생했습니다.");const p=new Set(d.map(V=>V.tempId)),O=t?.name;(V=>{if(y){const B=x?.getFieldValue(O)||[],z=V(B);x?.setFieldValue(O,z)}else D(B=>V(B))})(V=>V.map(B=>p.has(B.uid)?{...B,status:"error",error:"후처리 실패"}:B))})}},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;y?x?.setFieldValue(S,b):D(b)}else{const b=t?.name;y?x?.setFieldValue(b,[]):D([])}}).catch(d=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",d),n.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")})},[e,i]);const H=(d,b)=>{const S=t?.name,p=y?x?.getFieldValue(S)||[]:E,O=q.findIndex(p,{uid:d}),G=q.findIndex(p,{uid:b});if(O<0||G<0)return;const V=[...p],[B]=V.splice(O,1);V.splice(G,0,B),y?x?.setFieldValue(S,V):D(V)},I=()=>{if(!C&&e&&m){const d=t?.name,S=(y?x?.getFieldValue(d)||[]:E).map(p=>p.uid);k.callService(m,{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=y?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 u&&!(d.size/1024/1024<u)?(n.message.error(`일반업로드의 최대용량은 ${u}MB입니다.`),n.Upload.LIST_IGNORE):!C},y=!!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:F?0:h.current,fileKey:S,oldFileGrpKey:h.current,newFileGrpKeyonModify:F}).then(p=>{if(n.message.success("파일이 성공적으로 삭제되었습니다."),F&&(h.current=p.fileGrpKey),y){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(y){const p=t?.name;x?.setFieldValue(p,d.fileList)}else D(d.fileList);N?.(d.fileList)}return}if(y){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)}};y||(w.fileList=E);const v=d=>Array.isArray(d)?d:d&&d.fileList,M=t?.name,P=y?n.Form.useWatch?.(M,x):void 0,K=y?P||[]:E;return r.jsx(J.DndProvider,{backend:le.HTML5Backend,children:r.jsx(_,{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=oe;exports.BwgFormItem=_;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=Me;exports.BwgSelect=_e;exports.BwgSwitch=Be;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"),m=require("react"),ne=require("../../stores/index.cjs"),U=require("dayjs"),T=require("@ant-design/icons"),q=require("lodash"),E=require("../../utils/index.cjs"),ie=require("jszip"),se=require("imask"),J=require("react-dnd"),le=require("react-dnd-html5-backend"),ce=t=>{const{componentSize:e}=ne.useUserStore(),l=m.useMemo(()=>t.size?t.size:{0:"small",1:"middle",2:"large"}[e],[e,t.size]),a=m.useMemo(()=>({0:12,1:14,2:16})[e],[e]);return r.jsx(n.Button,{...t,size:l,className:"bwg-btn",style:{fontSize:`${a}px`,...t.style},children:t.children})},D=m.memo(({children:t,label:e,name:l,rules:a,initialValue:s,style:o,required:f,...i})=>{const g={fontWeight:"bold"};(a==null||a==null)&&f&&(a=[{required:!0,message:`${e}을(를) 입력해주세요.`}]);const d=Array.isArray(a)&&a.some(x=>x.required===!0),w=()=>typeof e=="string"?r.jsxs("span",{style:g,children:[e,d&&r.jsx("span",{style:{color:"#ff4d4f",marginLeft:"4px"},children:"*"})]}):r.jsx("span",{style:g,children:e});return r.jsx(n.Form.Item,{className:"bwg-form-item",label:e?w():void 0,labelAlign:i.labelAlign||"left",name:l,rules:a,colon:!1,initialValue:s,style:o,...i,children:t})}),de=({itemProps:t,inputProps:e={format:"YN"}})=>{const l=n.Form.useFormInstance(),a=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(D,{...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:a,children:e?.title})})},ue=({itemProps:t,inputProps:e})=>{const l=n.Form.useFormInstance(),[a,s]=m.useState(t?.initialValue??[]),[o,f]=m.useState([]),i=o.length>0&&o.length==a?.length,g=a?.length>0&&a.length<o.length;m.useEffect(()=>{f(d(e?.options))},[e?.options]),m.useEffect(()=>{s(a)},[a]);const d=C=>{const b=[];return(C||[]).map((k,z)=>{b.push(k.value)}),b},w=C=>{s(C.target.checked?o:[]),l.setFieldValue(t?.name,C.target.checked?o:[])},x=C=>{s(C),l.setFieldValue(t?.name,C),e?.onChange&&typeof e?.onChange=="function"&&e?.onChange(C)};return r.jsx(D,{...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:g,checked:i,onChange:w,children:"전체선택"}),r.jsx(n.Checkbox.Group,{options:e?.options,value:a,onChange:x})]})})},Z={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:a="string"})=>{const{displayFormat:s,outputFormat:o}=m.useMemo(()=>Z[l],[l]),f=m.useMemo(()=>Object.values(Z).map(i=>i.outputFormat).sort((i,g)=>{if(i.length===g.length){if(i===o)return-1;if(g===o)return 1}return g.length-i.length}),[o]);return r.jsx(D,{...t,getValueProps:i=>({value:i?U.isDayjs(i)?i:U(i,f):null}),normalize:i=>i?a==="dayjs"?i:i.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:a=__SYS_CD__})=>{const[s,o]=m.useState([]);m.useEffect(()=>{t&&e?a!=__SYS_CD__?E.callServiceBySysCd(__APP_CD__,e,{crprCd:E.getUserInfo()?.crprCd,sysCd:a,fileGrpKey:t}).then(i=>{if(i?.sub){const g=i.sub.map(d=>({uid:d.fileKey,name:d.lgclFileNm,filePath:d.filePath}));o(g)}}).catch(i=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",i),n.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")}):E.callService(e,{crprCd:E.getUserInfo()?.crprCd,sysCd:a,fileGrpKey:t}).then(i=>{if(i?.sub){const g=i.sub.map(d=>({uid:d.fileKey,name:d.lgclFileNm,filePath:d.filePath}));o(g)}}).catch(i=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",i),n.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")}):o([])},[t,e]);const f=async i=>{try{let g;a!=__SYS_CD__?g="/api/download/"+a:g="/api/download";const d=await fetch(g,{method:"POST",headers:{SYSCD:__SYS_CD__,"Content-Type":"application/json"},body:JSON.stringify({filePath:i.filePath,logicalName:i.name,fileKey:i.uid})});if(!d.ok){const k=(await d.json().catch(()=>null))?.message||"파일 다운로드에 실패했습니다.";throw new Error(k)}const w=await d.blob(),x=window.URL.createObjectURL(w),C=document.createElement("a");C.href=x,C.setAttribute("download",i.name),document.body.appendChild(C),C.click(),document.body.removeChild(C),window.URL.revokeObjectURL(x)}catch(g){console.error(g),n.message.error(g.message||"파일을 다운로드하는 중 오류가 발생했습니다.")}};return q.isEmpty(s)?null:r.jsx(n.Card,{title:"파일 목록",children:r.jsx(n.List,{dataSource:s,renderItem:i=>r.jsx(n.List.Item,{actions:l?[]:[r.jsx(n.Button,{type:"text",icon:r.jsx(T.DownloadOutlined,{}),onClick:()=>f(i)},"download")],children:r.jsx(n.List.Item.Meta,{avatar:r.jsx(T.PaperClipOutlined,{}),title:i.name})})})})},oe=m.forwardRef(({children:t,labelCol:e,style:l,className:a,...s},o)=>r.jsx(n.ConfigProvider,{form:{},children:r.jsx(n.Form,{ref:o,...s,requiredMark:!1,labelCol:e||{flex:"100px"},style:{padding:"10px",...l},className:`bwg-form ${a??""}`,children:t})}));oe.displayName="BwgForm";const ge=({itemProps:t,inputProps:e})=>r.jsx(D,{...t,children:r.jsx(n.Input,{...e})}),{Text:W}=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,a=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(a))+" "+s[o]},Fe=({title:t="첨부파일",fileGrpKey:e,onUploadComplete:l,onSuccessTrxCd:a="SCMFILE00102",anotherServiceTrxCd:s="SCMFILE00105",allowedExtensions:o=pe,maxFileSize:f=2048})=>{const[i,g]=m.useState([]),[d,w]=m.useState(!1),[x,C]=m.useState(!1),[b,k]=m.useState(0),z=p=>{if(o&&o.length>0){const c=(S=>{const L=S.lastIndexOf(".");return L===-1?"":S.substring(L).toLowerCase()})(p.name);if(!o.includes(c))return n.message.error(`${p.name} 파일은 허용되지 않는 확장자입니다. (${o.join(", ")}만 가능)`),!1}return!0},B=async()=>{const p=i.filter(I=>I.status!=="done"),y=p.reduce((I,A)=>I+(A.size||0),0),c=2*1024*1024*1024;if(y>c){n.notification.error({message:"업로드 용량 초과",description:"한 번에 업로드할 수 있는 총 파일 용량은 2GB를 초과할 수 없습니다."});return}if(p.length===0){n.message.warning("업로드할 파일이 없거나 모든 파일이 이미 업로드되었습니다.");return}C(!0);let S;try{const I=new ie;p.forEach(A=>{A.originFileObj&&I.file(A.name,A.originFileObj)}),S=await I.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:9}})}catch(I){C(!1),n.message.error("파일을 압축하는 중 오류가 발생했습니다."),console.error("Zipping error:",I);return}C(!1);const L=new FormData;L.append("file",S,"upload.zip"),w(!0),k(0);try{const I=await new Promise((j,M)=>{const O=new XMLHttpRequest;O.open("POST","/api/upload-large",!0),O.upload.onprogress=N=>{if(N.lengthComputable){const P=Math.round(N.loaded/N.total*100);k(P)}},O.onload=()=>{if(O.status>=200&&O.status<300)try{const N=JSON.parse(O.responseText);N.success?j(N):M(new Error(N.message||"파일 업로드에 실패했습니다."))}catch{M(new Error("잘못된 서버 응답입니다."))}else try{const N=JSON.parse(O.responseText);M(new Error(N.message||`서버 오류: ${O.status}`))}catch{M(new Error(`서버 오류: ${O.status}`))}},O.onerror=()=>{M(new Error("네트워크 오류가 발생했습니다."))},O.send(L)});n.message.success(I.message||"압축 파일이 성공적으로 업로드되었습니다.");const A=i.map(j=>p.find(M=>M.uid===j.uid)?{...j,status:"done"}:j);if(g(A),a&&I.uploadedFiles&&Array.isArray(I.uploadedFiles)){const j=E.getUserInfo();I.uploadedFiles.forEach(M=>{const O={crprCd:j?.crprCd,sysCd:__SYS_CD__,fileGrpKey:e,sub:[{crprCd:j?.crprCd,sysCd:__SYS_CD__,fileGrpKey:e,physFileNm:M.fileNameP,lgclFileNm:M.fileNameL,filePath:M.filePath,fileExtn:M.fileExt,fileSize:M.fileSize,mltpYn:"Y"}]};E.callService(a,O).then(N=>{const P=i.map(K=>({crprCd:j?.crprCd,sysCd:__SYS_CD__,fileGrpKey:N.sub[0].fileGrpKey,fileKey:N.sub[0].fileKey,lgclFileNm:K.name,fileSize:K.size,fileExtn:K.name.split(".").pop(),fileType:K.type}));E.callService(s,{sub:P})}).catch(N=>{console.error("후처리 서비스 호출 실패:",N),n.message.error(`${M.fileNameL} 파일의 후처리 작업에 실패했습니다.`)}),l&&l({fileNameP:M.fileNameP,fileNameL:M.fileNameL})})}}catch(I){n.message.error(I.message||"파일 업로드 중 오류가 발생했습니다.");const A=i.map(j=>p.find(M=>M.uid===j.uid)?{...j,status:"error",response:I.message||"파일 업로드 중 오류가 발생했습니다."}:j);g(A)}finally{w(!1)}},F={multiple:!0,fileList:i,beforeUpload:p=>z(p)?f&&p.size>=f*1024*1024?(n.message.error(`대용량 첨부 파일 최대 크기는 ${(f/1024).toFixed(1)}GB입니다.`),n.Upload.LIST_IGNORE):!1:n.Upload.LIST_IGNORE,onChange:({fileList:p})=>{const y=new Map(i.map(c=>[c.uid,c]));p.forEach(c=>{y.set(c.uid,c)}),g(Array.from(y.values()))},onRemove:p=>{const y=i.filter(c=>c.uid!==p.uid);g(y)},showUploadList:!1};return r.jsx(n.Spin,{spinning:d||x,tip:x?"파일 압축 중...":`파일 업로드 중... ${b}%`,children:r.jsxs("div",{className:"bwg-large-uploader-container",children:[r.jsx(n.Card,{title:r.jsx(W,{strong:!0,children:t}),extra:r.jsx(n.Upload,{...F,children:r.jsx(n.Button,{icon:r.jsx(T.UploadOutlined,{}),children:"파일 선택"})}),style:{padding:0},children:r.jsx(he,{...F,style:{border:"none",background:"transparent",padding:0},children:r.jsx("div",{className:"upload-list-container",children:i.length>0?r.jsx(n.List,{style:{textAlign:"left"},dataSource:i,renderItem:p=>{const y=p.status==="done",c=p.status==="error";let S;return y?S=r.jsx(T.CheckCircleOutlined,{style:{color:"#52c41a",fontSize:14}}):c?S=r.jsx(n.Tooltip,{title:typeof p.response=="string"?p.response:"업로드 실패",children:r.jsx(T.CloseCircleOutlined,{style:{color:"#ff4d4f",fontSize:14}})}):S=r.jsx(T.FileTextOutlined,{style:{fontSize:14}}),r.jsx(n.List.Item,{actions:[r.jsx(W,{type:"secondary",children:xe(p.size||0)},"size"),r.jsx(n.Button,{type:"text",icon:r.jsx(T.DeleteOutlined,{}),onClick:L=>{L.stopPropagation(),F.onRemove?.(p)},disabled:d||x},"delete")],children:r.jsx(n.List.Item.Meta,{avatar:S,title:r.jsx(W,{type:c?"danger":void 0,children:p.name})})},p.uid)}}):r.jsxs(n.Flex,{gap:"middle",align:"center",justify:"center",vertical:!0,style:{padding:"20px 0",minHeight:"120px"},children:[r.jsx(T.InboxOutlined,{style:{fontSize:"32px",color:"#999"}}),r.jsx(W,{type:"secondary",children:"업로드할 파일을 선택하거나 이 영역으로 드래그하세요."})]})})})}),i.length>0&&r.jsxs(n.Flex,{justify:"flex-end",align:"center",gap:"large",style:{marginTop:16},children:[d&&r.jsx("div",{style:{width:"250px"},children:r.jsx(n.Progress,{percent:b,size:"small"})}),r.jsx(n.Button,{type:"primary",onClick:B,disabled:d||x||i.filter(p=>p.status!=="done").length===0,icon:r.jsx(T.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(a=>{const o=l?.[a]?.maxLength??3;return"_".repeat(o)}).join(".")}return""},Se=({itemProps:t,inputProps:e,mask:l})=>{const a=m.useRef(null),s=n.Form.useFormInstance(),o=m.useMemo(()=>ye(l),[l]);return m.useEffect(()=>{if(!a.current?.input)return;const f=typeof l=="string"||Array.isArray(l)?{mask:l}:l,i=se(a.current.input,f);return i.on("accept",()=>{s&&t?.name&&s.setFieldValue(t.name,i.value)}),()=>{i.destroy()}},[l,s,t?.name]),r.jsx(D,{...t,children:r.jsx(n.Input,{...e,ref:a,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"}}},Ce=({type:t="date",itemProps:e={name:"calendar"},inputProps:l})=>{const{format:a,mask:s,outputFormat:o}=je(t),f=m.useRef(null),i=m.useRef(null),g=m.useRef(null),d=n.Form.useFormInstance(),[w,x]=m.useState(!1),[C,b]=m.useState(!1),k=e?.name,[z,B]=m.useState(null),F=n.Form.useWatch(k,d);m.useEffect(()=>{if(!f.current?.input)return;const c=se(f.current.input,{mask:s,lazy:!1});return i.current=c,c.on("accept",()=>{const S=c.value;S.length>0&&x(!0);const L=U(S,a,!0);S.length===a.length&&L.isValid()&&(d.setFieldValue(k,c.value),B(L),i.current?.updateValue())}),()=>{c.destroy()}},[a,s]),m.useEffect(()=>{if(!F){B(null);return}let c=null;if(typeof F=="string"&&F.length===o.length&&/^\d+$/.test(F))if(t==="date"){const S=F.substring(0,4),L=F.substring(4,6),I=F.substring(6,8);c=U(`${S}-${L}-${I}`,a,!0)}else if(t==="month"){const S=F.substring(0,4),L=F.substring(4,6);c=U(`${S}-${L}`,a,!0)}else t==="year"&&(c=U(F,a,!0));else c=U(F,a,!0);c&&c.isValid()?B(c):B(null),b(!1)},[F,a,o,t]);const p=c=>{if(!c){B(null),i.current?.updateValue();return}B(c);const S=c.format(o);i.current&&(i.current.value=S,i.current.updateValue()),b(!1)},y=c=>{setTimeout(()=>{const S=document.activeElement,L=g.current,I=L?.querySelector(".ant-picker-dropdown");!(L&&(L.contains(S)||L===S||I?.contains(S)))&&!(c!==void 0?c:w)&&console.log("✅ Input과 DatePicker 모두 포커스가 없습니다")},0)};return r.jsx(D,{...e,name:void 0,validateStatus:C?"warning":void 0,children:r.jsx(n.ConfigProvider,{theme:{components:{Input:{addonBg:"#fff"}}},children:r.jsxs("div",{ref:g,style:{position:"relative"},children:[r.jsx(n.Form.Item,{name:k,getValueProps:c=>({value:c?U(c).format(a):void 0}),normalize:c=>c?U(c).format(o):void 0,noStyle:!0,children:r.jsx(n.Input,{...l,ref:f,onFocus:()=>{x(!w),i.current?.updateValue()},onBlur:()=>{y()},onKeyDown:c=>{if(c.key==="Backspace"&&x(!0),c.key==="Tab"&&x(!1),c.key==="Enter")if(w){const S=i.current?.value||"",L=U(S,a,!0);S.length===a.length&&L.isValid()?(x(!1),b(!1)):b(!0)}else x(!0)},allowClear:!0,placeholder:s.replace(/0/g,"_"),suffix:r.jsx(T.CalendarOutlined,{style:{color:"#d9d9d9"}}),autoComplete:"off"})}),r.jsx(n.DatePicker,{open:w,picker:t,format:{format:a,type:"mask"},showNow:!0,value:z,onChange:p,onOpenChange:c=>{x(c),c||y(!1)},renderExtraFooter:()=>C?r.jsxs("div",{style:{color:"#faad14",paddingLeft:"8px",fontSize:"12px",display:"flex",alignItems:"center",gap:"6px",borderTop:"1px solid #f0f0f0",backgroundColor:"#fffbe6"},children:[r.jsx(T.ExclamationCircleOutlined,{}),r.jsx("span",{children:"유효하지 않은 날짜입니다"})]}):null,getPopupContainer:c=>c.parentElement,style:{position:"absolute",top:0,left:0,pointerEvents:"none",opacity:0,width:"100%"}})]})})})},{Option:Q}=n.Select,Ye=({itemProps:t,inputProps:e})=>{const[l,a]=m.useState([]);return m.useEffect(()=>{e?.addField==="ALL"?a([{label:"전체",value:""},...e?.list||[]]):e?.addField==="NULL"?a([{label:"",value:""},...e?.list||[]]):a(e?.list||[])},[e?.list]),r.jsx(D,{...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:f}=s;return e?.printCode?r.jsx(Q,{value:o,label:f,children:r.jsx(n.Space,{children:`[${o}] ${f}`})},o):r.jsx(Q,{value:o,label:f,children:r.jsx(n.Space,{children:`${f}`})},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]},a=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(D,{...t,children:r.jsx(n.InputNumber,{...e,formatter:s=>l(s),parser:s=>a(s)})})},be=({itemProps:t,inputProps:e})=>r.jsx(D,{...t,children:r.jsx(n.Radio.Group,{...e})}),{RangePicker:Le}=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:a,maxDate:s,returnType:o="string"})=>{const{displayFormat:f,outputFormat:i}=m.useMemo(()=>ee[l],[l]),g=m.useMemo(()=>Object.values(ee).map(d=>d.outputFormat).sort((d,w)=>{if(d.length===w.length){if(d===i)return-1;if(w===i)return 1}return w.length-d.length}),[i]);return r.jsx(D,{...t,getValueProps:d=>({value:d&&d.length>0?[d[0]?U.isDayjs(d[0])?d[0]:U(d[0],g):null,d[1]?U.isDayjs(d[1])?d[1]:U(d[1],g):null]:null}),normalize:d=>d?o==="dayjs"?[d[0]??void 0,d[1]??void 0]:[d[0]?d[0].format(i):void 0,d[1]?d[1].format(i):void 0]:[void 0,void 0],children:r.jsx(Le,{...e,order:!0,minDate:a?U(a,g):void 0,maxDate:s?U(s,g):void 0,picker:l==="datetime"?"date":l,showTime:e?.showTime??(l==="datetime"||l==="time"),format:f})})},te=n.Input.Search,Be=t=>{const e=n.Form.useFormInstance(),{openPopup:l}=ne.usePopupStore(),a=t.itemProps?.name||[],s=t.popupConfig||{callback(f){console.log("callback data :: ",f),a.length>1?(e.setFieldValue(a[0],f.code),e.setFieldValue(a[1],f.name)):e.setFieldValue(a,f.code)}},o={...t,placeholder:typeof t.placeholder=="string"?t.placeholder:t.placeholder?.[0]||"",onChange:f=>{a.length>1&&e.setFieldValue(a[0],""),t.onChange?.(f)},onSearch:f=>{t.popuCd?l(t.popuCd,t.popupParams,s):t.onSearch?.(f)}};return a.length>1?r.jsx(D,{...t.itemProps,name:void 0,children:r.jsxs(n.Space.Compact,{block:!0,children:[r.jsx(n.Form.Item,{name:a[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:a[1],style:{width:"60%",marginBottom:0},children:r.jsx(te,{readOnly:t.readOnly,enterButton:r.jsx(n.Button,{icon:r.jsx(T.SearchOutlined,{}),disabled:t.readOnly}),...o})})]})}):r.jsx(D,{...t.itemProps,children:r.jsx(te,{...o})})},Me=({itemProps:t,selectProps:e={options:[],allowClear:!0}})=>{const l=n.Form.useFormInstance(),a=!!l,s=m.useMemo(()=>e?.addField==="ALL"?[{label:"전체",value:""},...e?.options||[]]:e?.addField==="NULL"?[{label:"",value:""},...e?.options||[]]:e?.options||[],[e.options,e.addField]),o=g=>{e.onChange?.(g)},f={...e,allowClear:e.allowClear??!0,options:s,onChange:o,variant:e.variant},i=r.jsx(n.Select,{...f,disabled:e.disabled});return e.copyable&&!a&&console.warn("BwgSelect: copyable 기능은 Form 컨텍스트 내에서만 사용 가능합니다."),e.copyable?r.jsx(D,{...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:i}),r.jsx(n.Typography.Paragraph,{copyable:{text:a&&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(D,{...t,children:i})},_e=({itemProps:t,inputProps:e={format:"YN"}})=>{const l=n.Form.useFormInstance(),a=(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(D,{...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)=>a(s,o)})})},{TextArea:ke}=n.Input,Ne=({itemProps:t,inputProps:e})=>r.jsx(D,{...t,children:r.jsx(ke,{...e})}),De=[".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:a,onDrop:s})=>{const o=m.useRef(null),[{handlerId:f},i]=J.useDrop({accept:re.FILE,collect:x=>({handlerId:x.getHandlerId()}),hover(x,C){if(!o.current)return;const b=x.uid,k=e.uid;if(b===k)return;const z=q.findIndex(l,{uid:k}),B=q.findIndex(l,{uid:b});if(B===-1||z===-1)return;const F=o.current.getBoundingClientRect(),p=C.getClientOffset();if(!p)return;const y=(F.bottom-F.top)/2,c=p.y-F.top;B<z&&c<y||B>z&&c>y||a(b,k)},drop(){s()}}),[{isDragging:g},d]=J.useDrag({type:re.FILE,item:()=>({uid:e.uid,index:q.findIndex(l,{uid:e.uid})}),collect:x=>({isDragging:x.isDragging()})}),w=g?0:1;return d(i(o)),r.jsx("div",{ref:o,style:{opacity:w},"data-handler-id":f,children:t})},Ee=({itemProps:t,fileGrpKey:e,onUploadComplete:l,onFetchFilesTrxCd:a="SCMFILE00101",onSuccessTrxCd:s="SCMFILE00102",onDeleteFileTrxCd:o="SCMFILE00103",onReorderFilesTrxCd:f="SCMFILE00104",allowedExtensions:i=De,maxFileSize:g=200,showButton:d=!0,multiple:w=!1,newFileGrpKeyonModify:x=!1,buttonText:C="파일 선택",localOnly:b=!1,onFilesChange:k})=>{const[z,B]=m.useState([]),F=m.useRef(e),p=m.useRef([]),y=n.Form.useFormInstance(),c=()=>{if(b||p.current.length===0)return;const u=[...p.current];if(p.current=[],s){const _=u.map(Y=>({crprCd:E.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:F.current,physFileNm:Y.fileNameP,lgclFileNm:Y.fileNameL,filePath:Y.filePath,fileExtn:Y.fileExt,fileSize:Y.fileSize,mltpYn:"N"}));console.log("newFileGrpKeyonModify",x),console.log("newFileGrpKeyonModify",x?0:F.current),E.callService(s,{crprCd:E.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:x?0:F.current,oldFileGrpKey:F.current,newFileGrpKeyonModify:x,sub:_}).then(Y=>{if(Y?.sub&&Y.sub.length>0){const h=Y.sub[0].fileGrpKey;(!F.current||x)&&(F.current=h);const V=new Map;Y.sub.forEach(v=>{const R=u.find(H=>H.fileNameL===v.lgclFileNm);R&&V.set(R.tempId,v)});const G=t?.name;(v=>{if(j){const R=y?.getFieldValue(G)||[],H=v(R);y?.setFieldValue(G,H)}else B(R=>v(R))})(v=>v.map(R=>{const H=V.get(R.uid);if(H){const X=u.find(ae=>ae.tempId===R.uid);return l&&X&&l({...X,fileGrpKey:h,fileKey:H.fileKey}),{...R,name:H.lgclFileNm,fileGrpKey:h,fileKey:H.fileKey,uid:H.fileKey,status:"done",url:`/api/download?filePath=${H.filePath}&logicalName=${H.lgclFileNm}`}}return R}))}}).catch(Y=>{console.error("업로드 후처리 서비스 호출 실패:",Y),n.message.error("파일 후처리 중 오류가 발생했습니다.");const h=new Set(u.map($=>$.tempId)),V=t?.name;($=>{if(j){const v=y?.getFieldValue(V)||[],R=$(v);y?.setFieldValue(V,R)}else B(v=>$(v))})($=>$.map(v=>h.has(v.uid)?{...v,status:"error",error:"후처리 실패"}:v))})}},S=m.useRef(q.debounce(c,500)).current;m.useEffect(()=>()=>{S.cancel()},[S]),m.useEffect(()=>{F.current=e},[e]),m.useEffect(()=>{b||e&&a&&E.callService(a,{crprCd:E.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:e}).then(u=>{if(u?.sub){const _=u.sub.map(h=>({uid:h.fileKey,name:h.lgclFileNm,status:"done",url:`/api/download?filePath=${h.filePath}&logicalName=${h.lgclFileNm}`})),Y=t?.name;j?y?.setFieldValue(Y,_):B(_)}else{const _=t?.name;j?y?.setFieldValue(_,[]):B([])}}).catch(u=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",u),n.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")})},[e,a]);const L=(u,_)=>{const Y=t?.name,h=j?y?.getFieldValue(Y)||[]:z,V=q.findIndex(h,{uid:u}),G=q.findIndex(h,{uid:_});if(V<0||G<0)return;const $=[...h],[v]=$.splice(V,1);$.splice(G,0,v),j?y?.setFieldValue(Y,$):B($)},I=()=>{if(!b&&e&&f){const u=t?.name,Y=(j?y?.getFieldValue(u)||[]:z).map(h=>h.uid);E.callService(f,{crprCd:E.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:e,reorderedFileKeys:Y}).then(()=>{n.message.success("파일 순서가 성공적으로 저장되었습니다.")}).catch(h=>{console.error("파일 순서 저장 서비스 호출 실패:",h),n.message.error("파일 순서 저장 중 오류가 발생했습니다.")})}},A=u=>{const _=t?.name,Y=j?y?.getFieldValue(_)||[]:z;if(!w&&Y.length>0)return n.message.error("하나의 파일만 업로드할 수 있습니다."),n.Upload.LIST_IGNORE;if(i&&i.length>0){const h=`.${u.name.split(".").pop()?.toLowerCase()}`;if(!i.includes(h))return n.message.error(`${u.name} 파일은 허용되지 않는 확장자입니다. (${i.join(", ")})`),n.Upload.LIST_IGNORE}return g&&!(u.size/1024/1024<g)?(n.message.error(`일반업로드의 최대용량은 ${g}MB입니다.`),n.Upload.LIST_IGNORE):!b},j=!!t?.name,M={name:"file",multiple:w,action:b?void 0:"/api/upload",beforeUpload:A,showUploadList:{showRemoveIcon:d},onChange(u){const{status:_,uid:Y}=u.file;if(_==="removed"){if(!b&&o)E.callService(o,{crprCd:E.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:x?0:F.current,fileKey:Y,oldFileGrpKey:F.current,newFileGrpKeyonModify:x}).then(h=>{if(n.message.success("파일이 성공적으로 삭제되었습니다."),x&&(F.current=h.fileGrpKey),j){const V=t?.name;y?.setFieldValue(V,u.fileList)}else B(u.fileList);k?.(u.fileList),l?.({fileGrpKey:h.fileGrpKey})}).catch(h=>{console.error("파일 삭제 서비스 호출에 실패했습니다.",h),n.message.error("파일 삭제 중 오류가 발생했습니다.")});else{if(j){const h=t?.name;y?.setFieldValue(h,u.fileList)}else B(u.fileList);k?.(u.fileList)}return}if(j){const h=t?.name;y?.setFieldValue(h,u.fileList)}else B(u.fileList);if(k?.(u.fileList),_==="done")if(!b&&u.file.response?.success){const{uploadedFiles:h}=u.file.response;h&&Array.isArray(h)&&h.length>0&&(h.forEach(V=>{V.tempId=u.file.uid,p.current.push(V)}),S()),n.message.success(u.file.response.message||`${u.file.name} 파일이 성공적으로 업로드되었습니다.`)}else n.message.error(u.file.response?.message||`${u.file.name} 파일 업로드에 실패했습니다.`);else _==="error"&&n.message.error(u.file.response?.message||`${u.file.name} 파일 업로드 중 오류가 발생했습니다.`)},itemRender(u,_,Y){const h=m.cloneElement(u,{href:_.url||void 0,title:void 0});return r.jsx(ve,{originNode:h,file:_,fileList:Y,moveFile:L,onDrop:I},_.uid)}};j||(M.fileList=z);const O=u=>Array.isArray(u)?u:u&&u.fileList,N=t?.name,P=j?n.Form.useWatch?.(N,y):void 0,K=j?P||[]:z;return r.jsx(J.DndProvider,{backend:le.HTML5Backend,children:r.jsx(D,{valuePropName:"fileList",getValueFromEvent:O,...t,children:r.jsx(n.Upload,{headers:{SYSCD:__SYS_CD__},...M,listType:"picture",children:d&&(w||K.length===0)&&r.jsx(n.Button,{icon:r.jsx(T.UploadOutlined,{}),children:C})})})})};exports.BwgButton=ce;exports.BwgCheck=de;exports.BwgCheckList=ue;exports.BwgDatePicker=me;exports.BwgDownload=fe;exports.BwgForm=oe;exports.BwgFormItem=D;exports.BwgInput=ge;exports.BwgLargeUploader=Fe;exports.BwgMaskedInput=Se;exports.BwgMaskedPicker=Ce;exports.BwgMultiSelect=Ye;exports.BwgNumber=we;exports.BwgRadio=be;exports.BwgRangePicker=Ie;exports.BwgSearch=Be;exports.BwgSelect=Me;exports.BwgSwitch=_e;exports.BwgTextArea=Ne;exports.BwgUploader=Ee;