@bwg-ui/core 1.3.2 → 1.3.3

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 (60) hide show
  1. package/dist/chunks/{CMSearchIntfGwP01-Bx5cpkhH.js → CMSearchIntfGwP01-Co6lrDf9.js} +9 -9
  2. package/dist/chunks/CMSearchIntfGwP01-Do_ZDjmX.cjs +1 -0
  3. package/dist/chunks/{MenuReport-DxJIaW8D.js → MenuReport-BTtoDFz-.js} +146 -141
  4. package/dist/chunks/MenuReport-Bn5NyNel.cjs +1 -0
  5. package/dist/chunks/{common-components-dzN5Nuq0.js → common-components-0IMhPxxg.js} +11521 -10978
  6. package/dist/chunks/common-components-Csd3OioX.cjs +1109 -0
  7. package/dist/chunks/core-components-CX6NGtTh.cjs +1 -0
  8. package/dist/chunks/core-components-Ckwf4Rd7.js +1969 -0
  9. package/dist/chunks/layout-components-BMLp8YAy.cjs +38 -0
  10. package/dist/chunks/{layout-components-B25FFvXj.js → layout-components-DphZY34c.js} +942 -741
  11. package/dist/components/common/index.cjs +1 -1
  12. package/dist/components/common/index.js +1 -1
  13. package/dist/components/core/BwgEmpSearch.d.ts +28 -0
  14. package/dist/components/core/BwgEmpSearch.d.ts.map +1 -0
  15. package/dist/components/core/index.cjs +1 -1
  16. package/dist/components/core/index.js +22 -1846
  17. package/dist/components/guide/index.cjs +1 -1
  18. package/dist/components/guide/index.js +13 -13
  19. package/dist/components/layout/AppWrapper.d.ts +2 -1
  20. package/dist/components/layout/AppWrapper.d.ts.map +1 -1
  21. package/dist/components/layout/BwgCoreLogin.d.ts +1 -2
  22. package/dist/components/layout/BwgCoreLogin.d.ts.map +1 -1
  23. package/dist/components/layout/BwgSessionNotice.d.ts +15 -0
  24. package/dist/components/layout/BwgSessionNotice.d.ts.map +1 -0
  25. package/dist/components/layout/BwgSsoLogin.d.ts +19 -0
  26. package/dist/components/layout/BwgSsoLogin.d.ts.map +1 -0
  27. package/dist/components/layout/custom/ConfigurableHeader.d.ts.map +1 -1
  28. package/dist/components/layout/index.cjs +1 -1
  29. package/dist/components/layout/index.d.ts +2 -0
  30. package/dist/components/layout/index.d.ts.map +1 -1
  31. package/dist/components/layout/index.js +16 -14
  32. package/dist/components/pages/board/CMAdminBoardM01.d.ts.map +1 -1
  33. package/dist/components/pages/board/CMMyBoardM01.d.ts.map +1 -1
  34. package/dist/components/popup/MenuReport.d.ts.map +1 -1
  35. package/dist/components/popup/SearchOrganizationP01.d.ts +1 -1
  36. package/dist/components/popup/SearchOrganizationP01.d.ts.map +1 -1
  37. package/dist/components/popup/index.cjs +1 -1
  38. package/dist/components/popup/index.js +1 -1
  39. package/dist/index.cjs +1 -1
  40. package/dist/index.js +160 -157
  41. package/dist/stores/index.cjs +2 -2
  42. package/dist/stores/index.d.ts +2 -1
  43. package/dist/stores/index.d.ts.map +1 -1
  44. package/dist/stores/index.js +368 -335
  45. package/dist/stores/loginStore.d.ts +55 -10
  46. package/dist/stores/loginStore.d.ts.map +1 -1
  47. package/dist/stores/userStore.d.ts +1 -2
  48. package/dist/stores/userStore.d.ts.map +1 -1
  49. package/dist/styles/assets/images/header/icon/ico-bell.svg +3 -3
  50. package/dist/styles/assets/images/header/icon/ico-logout.svg +10 -10
  51. package/dist/styles/assets/images/header/icon/ico-setting.svg +4 -4
  52. package/dist/styles/assets/images/header/icon/ico-sidebar-arrow.svg +3 -3
  53. package/dist/utils/index.cjs +1 -1
  54. package/dist/utils/index.d.ts.map +1 -1
  55. package/dist/utils/index.js +455 -454
  56. package/package.json +1 -1
  57. package/dist/chunks/CMSearchIntfGwP01-Uhl4uqiV.cjs +0 -1
  58. package/dist/chunks/MenuReport-CPwq8w-z.cjs +0 -1
  59. package/dist/chunks/common-components-Dd_AsKs7.cjs +0 -1109
  60. package/dist/chunks/layout-components-Cz7Zets7.cjs +0 -35
@@ -0,0 +1 @@
1
+ "use strict";const n=require("react/jsx-runtime"),a=require("antd"),x=require("react"),ae=require("../stores/index.cjs"),E=require("dayjs"),P=require("@ant-design/icons"),T=require("../utils/index.cjs"),ie=require("jszip"),Z=require("imask"),X=require("./provider-DrboIg2C.cjs"),G=require("lodash"),J=require("react-dnd"),ce=require("react-dnd-html5-backend"),ue=e=>{const{componentSize:t}=ae.useUserStore(),m=x.useMemo(()=>e.size?e.size:{0:"small",1:"middle",2:"large"}[t],[t,e.size]),i=x.useMemo(()=>({0:12,1:14,2:16})[t],[t]);return n.jsx(a.Button,{...e,size:m,className:"bwg-btn",style:{fontSize:`${i}px`,...e.style},children:e.children})},$=x.memo(({children:e,label:t,name:m,rules:i,initialValue:r,style:o,required:h,...c})=>{const F={fontWeight:"bold"};(i==null||i==null)&&h&&(i=[{required:!0,message:`${t}을(를) 입력해주세요.`}]);const u=Array.isArray(i)&&i.some(S=>S.required===!0),d=()=>typeof t=="string"?n.jsxs("span",{style:F,children:[t,u&&n.jsx("span",{style:{color:"#ff4d4f",marginLeft:"4px"},children:"*"})]}):n.jsx("span",{style:F,children:t});return n.jsx(a.Form.Item,{className:"bwg-form-item",label:t?d():void 0,labelAlign:c.labelAlign||"left",name:m,rules:i,colon:!1,initialValue:r,style:o,...c,children:e})}),de=({itemProps:e,inputProps:t={format:"YN"}})=>{const m=a.Form.useFormInstance(),i=r=>{t.format==="boolean"?m.setFieldValue(e?.name,r.target.checked):m.setFieldValue(e?.name,r.target.checked?"Y":"N"),t.onChange&&t.onChange(r)};return n.jsx($,{...e,getValueProps:r=>({checked:t.format==="boolean"?!!r:r==="Y"}),normalize:r=>typeof r=="boolean"?t.format==="boolean"?r:r?"Y":"N":t.format==="boolean"?!!r:r?"Y":"N",children:n.jsx(a.Checkbox,{...t,onChange:i,children:t?.title})})},fe=({itemProps:e,inputProps:t})=>{const m=a.Form.useFormInstance(),[i,r]=x.useState(e?.initialValue??[]),[o,h]=x.useState([]),c=o.length>0&&o.length==i?.length,F=i?.length>0&&i.length<o.length;x.useEffect(()=>{h(u(t?.options))},[t?.options]),x.useEffect(()=>{r(i)},[i]);const u=j=>{const v=[];return(j||[]).map((k,U)=>{v.push(k.value)}),v},d=j=>{r(j.target.checked?o:[]),m.setFieldValue(e?.name,j.target.checked?o:[])},S=j=>{r(j),m.setFieldValue(e?.name,j),t?.onChange&&typeof t?.onChange=="function"&&t?.onChange(j)};return n.jsx($,{...e,children:n.jsxs(a.ConfigProvider,{theme:{components:{Checkbox:{colorPrimary:"var(--check-primary)",colorPrimaryBorder:"var(--check-primary)",colorPrimaryHover:"var(--check-primary-active)"}}},children:[t?.allCheck&&n.jsx(a.Checkbox,{indeterminate:F,checked:c,onChange:d,children:"전체선택"}),n.jsx(a.Checkbox.Group,{options:t?.options,value:i,onChange:S})]})})},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"}},me=({itemProps:e,inputProps:t,type:m="date",returnType:i="string"})=>{const{displayFormat:r,outputFormat:o}=x.useMemo(()=>ee[m],[m]),h=x.useMemo(()=>Object.values(ee).map(c=>c.outputFormat).sort((c,F)=>{if(c.length===F.length){if(c===o)return-1;if(F===o)return 1}return F.length-c.length}),[o]);return n.jsx($,{...e,getValueProps:c=>({value:c?E.isDayjs(c)?c:E(c,h):null}),normalize:c=>c?i==="dayjs"?c:c.format(o):null,children:n.jsx(a.DatePicker,{...t,picker:m==="datetime"?"date":m,showTime:t?.showTime??(m==="datetime"||m==="time"),format:t?.format?{format:t?.format?.format,type:"mask"}:r})})},ge=({fileGrpKey:e,onFetchFilesTrxCd:t="SCMFILE00101",readOnly:m=!1,appCd:i=__APP_CD__})=>{const[r,o]=x.useState([]);x.useEffect(()=>{if(t)if(i!=__APP_CD__){const F=T.getApiDeps().findSystemByAppCd?.(i??__APP_CD__);if(!F||!F.sysCd){console.error("해당 앱코드는 존재하지 않습니다.",i);return}T.callServiceByAppCd({trxCd:t,appCd:i},{crprCd:T.getCrprCd(),sysCd:F.sysCd,fileGrpKey:e}).then(u=>{if(u?.sub){const d=u.sub.map(S=>({uid:S.fileKey,name:S.lgclFileNm,filePath:S.filePath}));o(d)}}).catch(u=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",u),a.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")})}else T.callService(t,{crprCd:T.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:e}).then(c=>{if(c?.sub){const F=c.sub.map(u=>({uid:u.fileKey,name:u.lgclFileNm,filePath:u.filePath}));o(F)}}).catch(c=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",c),a.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")});else o([])},[e,t,i]);const h=async c=>{try{const u=T.getApiDeps().findSystemByAppCd?.(i??__APP_CD__);if(!u||!u.sysCd){console.error("해당 앱코드는 존재하지 않습니다.",i);return}const S=await fetch("/api/download",{method:"POST",headers:{SYSCD:u.sysCd,"Content-Type":"application/json"},body:JSON.stringify({filePath:c.filePath,logicalName:c.name,fileKey:c.uid})});if(!S.ok){const w=(await S.json().catch(()=>null))?.message||"파일 다운로드에 실패했습니다.";throw new Error(w)}const j=await S.blob(),v=window.URL.createObjectURL(j),k=document.createElement("a");k.href=v,k.setAttribute("download",c.name),document.body.appendChild(k),k.click(),document.body.removeChild(k),window.URL.revokeObjectURL(v)}catch(F){console.error(F),a.message.error(F.message||"파일을 다운로드하는 중 오류가 발생했습니다.")}};return n.jsx(a.Card,{title:"파일 목록",children:n.jsx(a.List,{dataSource:r,renderItem:c=>n.jsx(a.List.Item,{actions:m?[]:[n.jsx(a.Button,{type:"text",icon:n.jsx(P.DownloadOutlined,{}),onClick:()=>h(c)},"download")],children:n.jsx(a.List.Item.Meta,{avatar:n.jsx(P.PaperClipOutlined,{}),title:c.name})})})})},oe=x.forwardRef(({children:e,labelCol:t,style:m,className:i,...r},o)=>n.jsx(a.ConfigProvider,{form:{},children:n.jsx(a.Form,{ref:o,...r,requiredMark:!1,labelCol:t||{flex:"100px"},style:{padding:"10px",...m},className:`bwg-form ${i??""}`,children:e})}));oe.displayName="BwgForm";const he=({itemProps:e,inputProps:t})=>n.jsx($,{...e,children:n.jsx(a.Input,{...t})}),{Text:W}=a.Typography,{Dragger:pe}=a.Upload,ye=[".pdf",".xlsx",".xls",".docx",".doc",".pptx",".ppt",".hwp",".txt",".csv",".jpg",".jpeg",".png",".gif",".zip"],xe=(e,t=2)=>{if(e===0)return"0 Bytes";const m=1024,i=t<0?0:t,r=["Bytes","KB","MB","GB","TB"],o=Math.floor(Math.log(e)/Math.log(m));return parseFloat((e/Math.pow(m,o)).toFixed(i))+" "+r[o]},Fe=({title:e="첨부파일",fileGrpKey:t,onUploadComplete:m,onSuccessTrxCd:i="SCMFILE00102",anotherServiceTrxCd:r="SCMFILE00105",allowedExtensions:o=ye,maxFileSize:h=2048})=>{const[c,F]=x.useState([]),[u,d]=x.useState(!1),[S,j]=x.useState(!1),[v,k]=x.useState(0),U=p=>{if(o&&o.length>0){const D=(O=>{const l=O.lastIndexOf(".");return l===-1?"":O.substring(l).toLowerCase()})(p.name);if(!o.includes(D))return a.message.error(`${p.name} 파일은 허용되지 않는 확장자입니다. (${o.join(", ")}만 가능)`),!1}return!0},w=async()=>{const p=c.filter(C=>C.status!=="done"),L=p.reduce((C,I)=>C+(I.size||0),0),D=2*1024*1024*1024;if(L>D){a.notification.error({message:"업로드 용량 초과",description:"한 번에 업로드할 수 있는 총 파일 용량은 2GB를 초과할 수 없습니다."});return}if(p.length===0){a.message.warning("업로드할 파일이 없거나 모든 파일이 이미 업로드되었습니다.");return}j(!0);let O;try{const C=new ie;p.forEach(I=>{I.originFileObj&&C.file(I.name,I.originFileObj)}),O=await C.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:9}})}catch(C){j(!1),a.message.error("파일을 압축하는 중 오류가 발생했습니다."),console.error("Zipping error:",C);return}j(!1);const l=new FormData;l.append("file",O,"upload.zip"),d(!0),k(0);try{const C=await new Promise((b,A)=>{const R=new XMLHttpRequest;R.open("POST","/api/upload-large",!0),R.upload.onprogress=z=>{if(z.lengthComputable){const K=Math.round(z.loaded/z.total*100);k(K)}},R.onload=()=>{if(R.status>=200&&R.status<300)try{const z=JSON.parse(R.responseText);z.success?b(z):A(new Error(z.message||"파일 업로드에 실패했습니다."))}catch{A(new Error("잘못된 서버 응답입니다."))}else try{const z=JSON.parse(R.responseText);A(new Error(z.message||`서버 오류: ${R.status}`))}catch{A(new Error(`서버 오류: ${R.status}`))}},R.onerror=()=>{A(new Error("네트워크 오류가 발생했습니다."))},R.send(l)});a.message.success(C.message||"압축 파일이 성공적으로 업로드되었습니다.");const I=c.map(b=>p.find(A=>A.uid===b.uid)?{...b,status:"done"}:b);if(F(I),i&&C.uploadedFiles&&Array.isArray(C.uploadedFiles)){const b=T.getUserInfo();C.uploadedFiles.forEach(A=>{const R={crprCd:b?.crprCd,sysCd:__SYS_CD__,fileGrpKey:t,sub:[{crprCd:b?.crprCd,sysCd:__SYS_CD__,fileGrpKey:t,physFileNm:A.fileNameP,lgclFileNm:A.fileNameL,filePath:A.filePath,fileExtn:A.fileExt,fileSize:A.fileSize,mltpYn:"Y"}]};T.callService(i,R).then(z=>{const K=c.map(q=>({crprCd:b?.crprCd,sysCd:__SYS_CD__,fileGrpKey:z.sub[0].fileGrpKey,fileKey:z.sub[0].fileKey,lgclFileNm:q.name,fileSize:q.size,fileExtn:q.name.split(".").pop(),fileType:q.type}));T.callService(r,{sub:K})}).catch(z=>{console.error("후처리 서비스 호출 실패:",z),a.message.error(`${A.fileNameL} 파일의 후처리 작업에 실패했습니다.`)}),m&&m({fileNameP:A.fileNameP,fileNameL:A.fileNameL})})}}catch(C){a.message.error(C.message||"파일 업로드 중 오류가 발생했습니다.");const I=c.map(b=>p.find(A=>A.uid===b.uid)?{...b,status:"error",response:C.message||"파일 업로드 중 오류가 발생했습니다."}:b);F(I)}finally{d(!1)}},M={multiple:!0,fileList:c,beforeUpload:p=>U(p)?h&&p.size>=h*1024*1024?(a.message.error(`대용량 첨부 파일 최대 크기는 ${(h/1024).toFixed(1)}GB입니다.`),a.Upload.LIST_IGNORE):!1:a.Upload.LIST_IGNORE,onChange:({fileList:p})=>{const L=new Map(c.map(D=>[D.uid,D]));p.forEach(D=>{L.set(D.uid,D)}),F(Array.from(L.values()))},onRemove:p=>{const L=c.filter(D=>D.uid!==p.uid);F(L)},showUploadList:!1};return n.jsx(a.Spin,{spinning:u||S,tip:S?"파일 압축 중...":`파일 업로드 중... ${v}%`,children:n.jsxs("div",{className:"bwg-large-uploader-container",children:[n.jsx(a.Card,{title:n.jsx(W,{strong:!0,children:e}),extra:n.jsx(a.Upload,{...M,children:n.jsx(a.Button,{icon:n.jsx(P.UploadOutlined,{}),children:"파일 선택"})}),style:{padding:0},children:n.jsx(pe,{...M,style:{border:"none",background:"transparent",padding:0},children:n.jsx("div",{className:"upload-list-container",children:c.length>0?n.jsx(a.List,{style:{textAlign:"left"},dataSource:c,renderItem:p=>{const L=p.status==="done",D=p.status==="error";let O;return L?O=n.jsx(P.CheckCircleOutlined,{style:{color:"#52c41a",fontSize:14}}):D?O=n.jsx(a.Tooltip,{title:typeof p.response=="string"?p.response:"업로드 실패",children:n.jsx(P.CloseCircleOutlined,{style:{color:"#ff4d4f",fontSize:14}})}):O=n.jsx(P.FileTextOutlined,{style:{fontSize:14}}),n.jsx(a.List.Item,{actions:[n.jsx(W,{type:"secondary",children:xe(p.size||0)},"size"),n.jsx(a.Button,{type:"text",icon:n.jsx(P.DeleteOutlined,{}),onClick:l=>{l.stopPropagation(),M.onRemove?.(p)},disabled:u||S},"delete")],children:n.jsx(a.List.Item.Meta,{avatar:O,title:n.jsx(W,{type:D?"danger":void 0,children:p.name})})},p.uid)}}):n.jsxs(a.Flex,{gap:"middle",align:"center",justify:"center",vertical:!0,style:{padding:"20px 0",minHeight:"120px"},children:[n.jsx(P.InboxOutlined,{style:{fontSize:"32px",color:"#999"}}),n.jsx(W,{type:"secondary",children:"업로드할 파일을 선택하거나 이 영역으로 드래그하세요."})]})})})}),c.length>0&&n.jsxs(a.Flex,{justify:"flex-end",align:"center",gap:"large",style:{marginTop:16},children:[u&&n.jsx("div",{style:{width:"250px"},children:n.jsx(a.Progress,{percent:v,size:"small"})}),n.jsx(a.Button,{type:"primary",onClick:w,disabled:u||S||c.filter(p=>p.status!=="done").length===0,icon:n.jsx(P.CloudUploadOutlined,{}),children:"일괄 업로드"})]})]})})},Ce=e=>{if(typeof e=="string")return e.replace(/0/g,"_");if(Array.isArray(e))return e[0].replace(/0/g,"_");if(typeof e=="object"&&"mask"in e&&"blocks"in e){const{mask:t,blocks:m}=e;return t.split(".").map(i=>{const o=m?.[i]?.maxLength??3;return"_".repeat(o)}).join(".")}return""},Se=({itemProps:e,inputProps:t,mask:m})=>{const i=x.useRef(null),r=a.Form.useFormInstance(),o=x.useMemo(()=>Ce(m),[m]);return x.useEffect(()=>{if(!i.current?.input)return;const h=typeof m=="string"||Array.isArray(m)?{mask:m}:m,c=Z(i.current.input,h);return c.on("accept",()=>{r&&e?.name&&r.setFieldValue(e.name,c.value)}),()=>{c.destroy()}},[m,r,e?.name]),n.jsx($,{...e,children:n.jsx(a.Input,{...t,ref:i,placeholder:o})})},je=e=>{switch(e){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"}}},ke=({type:e="date",itemProps:t={name:"calendar"},inputProps:m,pickerProps:i})=>{const{format:r,mask:o,outputFormat:h}=je(e),c=x.useRef(null),F=x.useRef(null),u=x.useRef(null),d=a.Form.useFormInstance(),[S,j]=x.useState(!1),[v,k]=x.useState(!1),U=t?.name,[w,M]=x.useState(null),p=a.Form.useWatch(U,d),L=X.useSizeConfig();x.useEffect(()=>{if(!c.current?.input)return;const l=Z(c.current.input,{mask:o,lazy:!1});return F.current=l,l.on("accept",()=>{const C=l.value;C.length>0&&j(!0);const I=E(C,r,!0);C.length===r.length&&I.isValid()&&(d.setFieldValue(U,l.value),M(I),F.current?.updateValue())}),()=>{l.destroy()}},[r,o]),x.useEffect(()=>{if(!p){M(null);return}let l=null;if(typeof p=="string"&&p.length===h.length&&/^\d+$/.test(p))if(e==="date"){const C=p.substring(0,4),I=p.substring(4,6),b=p.substring(6,8);l=E(`${C}-${I}-${b}`,r,!0)}else if(e==="month"){const C=p.substring(0,4),I=p.substring(4,6);l=E(`${C}-${I}`,r,!0)}else e==="year"&&(l=E(p,r,!0));else l=E(p,r,!0);l&&l.isValid()?M(l):M(null),k(!1)},[p,r,h,e]);const D=l=>{if(!l){M(null),F.current?.updateValue();return}M(l);const C=l.format(h);F.current&&(F.current.value=C,F.current.updateValue()),k(!1)},O=l=>{setTimeout(()=>{const C=document.activeElement,I=u.current,b=I?.querySelector(".ant-picker-dropdown");!(I&&(I.contains(C)||I===C||b?.contains(C)))&&!(l!==void 0?l:S)&&console.log("✅ Input과 DatePicker 모두 포커스가 없습니다")},0)};return n.jsx($,{...t,name:void 0,validateStatus:v?"warning":void 0,children:n.jsxs(a.ConfigProvider,{componentSize:L.componentSize,theme:{components:{Input:{addonBg:"#fff"}}},children:[n.jsx(a.Form.Item,{name:U,getValueProps:l=>({value:l?E(l).format(r):void 0}),normalize:l=>l?E(l).format(h):void 0,noStyle:!0,children:n.jsx(a.Input,{...m,ref:c,onFocus:()=>{j(!S),F.current?.updateValue()},onBlur:()=>{O()},onKeyDown:l=>{if(l.key==="Backspace"&&j(!0),l.key==="Tab"&&j(!1),l.key==="Enter")if(S){const C=F.current?.value||"",I=E(C,r,!0);C.length===r.length&&I.isValid()?(j(!1),k(!1)):k(!0)}else j(!0)},style:{width:"65%"},allowClear:!0,placeholder:o.replace(/0/g,"_"),suffix:n.jsx(P.CalendarOutlined,{style:{color:"#d9d9d9"}}),autoComplete:"off"})}),n.jsx(a.DatePicker,{...i,open:S,picker:e,format:{format:r,type:"mask"},showNow:!0,value:w,onChange:D,onOpenChange:l=>{j(l),l||O(!1)},renderExtraFooter:()=>v?n.jsxs("div",{style:{color:"#faad14",paddingLeft:"8px",fontSize:"12px",display:"flex",alignItems:"center",gap:"6px",borderTop:"1px solid #f0f0f0",backgroundColor:"#fffbe6"},children:[n.jsx(P.ExclamationCircleOutlined,{}),n.jsx("span",{children:"유효하지 않은 날짜입니다"})]}):null,getPopupContainer:l=>l.parentElement,style:{position:"absolute",top:0,left:0,pointerEvents:"none",opacity:0,width:"100%"}})]})})},{RangePicker:Ye}=a.DatePicker,we=e=>{switch(e){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"}}},be=({type:e="date",itemProps:t={name:"dateRange"},inputProps:m,pickerProps:i})=>{const{format:r,mask:o,outputFormat:h}=we(e),c=x.useRef(null),F=x.useRef(null),u=x.useRef(null),d=x.useRef(null),S=x.useRef(null),j=a.Form.useFormInstance(),[v,k]=x.useState(!1),[U,w]=x.useState(!1),[M,p]=x.useState(null),[L,D]=x.useState(!1),O=x.useRef(!1),l=t?.name,[C,I]=x.useState([null,null]),b=a.Form.useWatch(l?Array.isArray(l)?[...l,0]:[l,0]:void 0,j),A=a.Form.useWatch(l?Array.isArray(l)?[...l,1]:[l,1]:void 0,j),R=a.Form.useWatch(l,j),z=X.useSizeConfig();x.useEffect(()=>{if(!c.current?.input)return;const s=Z(c.current.input,{mask:o,lazy:!1});return u.current=s,s.on("accept",()=>{const g=s.value,y=s.unmaskedValue||"";if(console.log("🔵 [시작일] accept 이벤트:",{maskValue:g,unmaskedValue:y,length:g.length,formatLength:r.length}),g.length>0&&(p("start"),k(!0),D(!1)),y.length===h.length){const f=E(g,r,!0);if(f.isValid()){console.log("🔵 [시작일] 입력 완료 및 검증 통과:",{parsed:f.format(r)});const B=f.format(h);O.current=!0;const Y=Array.isArray(l)?[...l,0]:[l,0];j.setFieldValue(Y,B),I([f,C[1]]),u.current&&u.current.updateValue(),w(!1),setTimeout(()=>{d.current&&(d.current.value="",d.current.unmaskedValue="",d.current.updateValue());const V=Array.isArray(l)?[...l,1]:[l,1];j.getFieldValue(V)||j.setFieldValue(V,void 0),F.current?.focus(),setTimeout(()=>{if(d.current){const _=d.current.value||"";!(d.current.unmaskedValue||"")&&!_.replace(/[^0-9]/g,"")&&(d.current.value="",d.current.updateValue())}},10),p("end"),k(!0),O.current=!1},0)}else i?.allowEmpty?w(!1):(console.log("🔵 [시작일] 검증 실패:",{val:g,parsed:f}),w(!0))}}),()=>{s.destroy()}},[r,o,l]),x.useEffect(()=>{if(!F.current?.input)return;const s=Z(F.current.input,{mask:o,lazy:!1});return d.current=s,s.on("accept",()=>{const g=s.value,y=s.unmaskedValue||"";if(console.log("🟢 [종료일] accept 이벤트:",{maskValue:g,unmaskedValue:y,length:g.length,formatLength:r.length}),y===""||y.length===0){const f=Array.isArray(l)?[...l,1]:[l,1];j.setFieldValue(f,void 0),I([C[0],null]),d.current&&(d.current.value="",d.current.updateValue()),setTimeout(()=>{c.current?.focus(),p("start"),k(!0)},0);return}if(g.length>0&&(p("end"),k(!0)),g.length<r.length){w(!1);return}if(y.length===h.length){const f=E(g,r,!0);if(f.isValid()){const B=f.format(h);console.log("🟢 [종료일] 입력 완료:",{parsed:f.format(r),formatted:B}),O.current=!0;const Y=Array.isArray(l)?[...l,1]:[l,1];j.setFieldValue(Y,B),I([C[0],f]),d.current?.updateValue(),setTimeout(()=>{O.current=!1},0)}else i?.allowEmpty?w(!1):(console.log("🟢 [종료일] 검증 실패:",{val:g,parsed:f}),w(!0))}}),()=>{s.destroy()}},[r,o,l]),x.useEffect(()=>{console.log("🟡 [useEffect] form 값 변경 감지:",{startFormValue:b,endFormValue:A,formValue:R});const s=b??(Array.isArray(R)?R[0]:null),g=A??(Array.isArray(R)?R[1]:null);if(s===void 0&&g===void 0&&(!R||!Array.isArray(R))){I([null,null]);return}const y=Y=>{if(!Y)return null;let V=null;if(typeof Y=="string"&&Y.length===h.length&&/^\d+$/.test(Y))if(e==="date"){const N=Y.substring(0,4),_=Y.substring(4,6),H=Y.substring(6,8);V=E(`${N}-${_}-${H}`,r,!0)}else if(e==="month"){const N=Y.substring(0,4),_=Y.substring(4,6);V=E(`${N}-${_}`,r,!0)}else e==="year"&&(V=E(Y,r,!0));else V=E(Y,r,!0);return V&&V.isValid()?V:null},f=y(s),B=y(g);if(console.log("🟡 [useEffect] 파싱 결과:",{startParsed:f?f.format(r):null,endParsed:B?B.format(r):null,isStartDateFromPicker:L}),I([f,B]),O.current){console.log("🟡 [useEffect] 사용자 입력 중 - 마스크 값 업데이트 스킵"),w(!1);return}if(!L&&u.current){const Y=u.current.value||"",V=f?f.format(r):"",N=u.current.unmaskedValue||"",_=f?f.format(h):"";console.log("🟡 [useEffect] 시작일 마스크 값 체크:",{currentMaskValue:Y,expectedMaskValue:V,unmaskedValue:N,expectedUnmasked:_,shouldUpdate:Y===""||Y!==V,canUpdate:N===""||N===_}),(Y===""||Y!==V)&&(N===""||N===_?(console.log("🟡 [useEffect] 시작일 마스크 값 업데이트:",{before:Y,after:f?f.format(r):""}),f?(u.current.value=f.format(r),u.current.updateValue()):(u.current.value="",u.current.updateValue())):console.log("🟡 [useEffect] 시작일 마스크 값 업데이트 스킵 (사용자 입력 중)"))}if(d.current){const Y=d.current.value||"",V=B?B.format(r):"",N=d.current.unmaskedValue||"",_=B?B.format(h):"";console.log("🟡 [useEffect] 종료일 마스크 값 체크:",{currentMaskValue:Y,expectedMaskValue:V,unmaskedValue:N,expectedUnmasked:_,shouldUpdate:Y===""||Y!==V,canUpdate:N===""||N===_}),(Y===""||Y!==V)&&(N===""||N===_?(console.log("🟡 [useEffect] 종료일 마스크 값 업데이트:",{before:Y,after:V}),B?(d.current.value=B.format(r),d.current.updateValue()):(d.current.value="",d.current.updateValue())):console.log("🟡 [useEffect] 종료일 마스크 값 업데이트 스킵 (사용자 입력 중)"))}w(!1)},[b,A,R,r,h,e]);const K=s=>{if(console.log("🔴 [RangePicker] 날짜 변경:",{dates:s?[s[0]?s[0].format(r):null,s[1]?s[1].format(r):null]:null,prevRange:[C[0]?C[0].format(r):null,C[1]?C[1].format(r):null]}),!s){I([null,null]),u.current?.updateValue(),d.current?.updateValue();return}const[g,y]=s,f=C[0],B=g&&(!f||!g.isSame(f,e==="year"?"year":e==="month"?"month":"day"));if(console.log("🔴 [RangePicker] 시작일 변경 여부:",{isStartDateChanged:B,startDate:g?g.format(r):null,prevStartDate:f?f.format(r):null}),I([g,y]),B){console.log("🔴 [RangePicker] 시작일 선택됨 - input 비우기"),D(!0),u.current&&(u.current.value="",u.current.updateValue());const Y=g.format(h);console.log("🔴 [RangePicker] form 값 업데이트:",{formatted:Y});const V=Array.isArray(l)?[...l,0]:[l,0];j.setFieldValue(V,Y)}else!g&&u.current?(D(!1),u.current.value="",u.current.updateValue()):D(!1);if(y&&d.current){const Y=y.format(h);d.current.value=Y,d.current.updateValue()}else!y&&d.current&&(d.current.value="",d.current.updateValue());w(!1)},q=s=>{setTimeout(()=>{const g=document.activeElement,y=S.current,f=y?.querySelector(".ant-picker-dropdown");!(y&&(y.contains(g)||y===g||f?.contains(g)))&&!(s!==void 0?s:v)&&(console.log("✅ Input과 RangePicker 모두 포커스가 없습니다"),k(!1))},0)};return n.jsx($,{...t,name:void 0,validateStatus:U?"warning":void 0,children:n.jsxs(a.ConfigProvider,{componentSize:z.componentSize,theme:{components:{Input:{addonBg:"#fff"}}},children:[n.jsxs("div",{ref:S,style:{display:"flex",alignItems:"center",gap:"8px",width:"100%"},children:[n.jsx(a.Form.Item,{name:l?Array.isArray(l)?[...l,0]:[l,0]:void 0,getValueProps:s=>{if(!s)return{value:void 0};if(typeof s=="string"&&s.length===h.length&&/^\d+$/.test(s)){if(e==="date"){const g=s.substring(0,4),y=s.substring(4,6),f=s.substring(6,8);return{value:`${g}-${y}-${f}`}}else if(e==="month"){const g=s.substring(0,4),y=s.substring(4,6);return{value:`${g}-${y}`}}else if(e==="year")return{value:s}}return{value:E(s).format(r)}},normalize:s=>s?E(s).format(h):(i?.allowEmpty,void 0),noStyle:!0,children:n.jsx(a.Input,{...m,value:void 0,ref:c,onFocus:()=>{if(p("start"),k(!v),D(!1),u.current){const s=Array.isArray(l)?[...l,0]:[l,0];j.getFieldValue(s)||(u.current.value="",u.current.unmaskedValue=""),u.current.updateValue()}},onBlur:()=>{q()},onKeyDown:s=>{if(s.key==="Backspace"&&(p("start"),k(!0)),s.key==="Enter")if(v&&M==="start"){const g=u.current?.value||"";g.length===r.length?E(g,r,!0).isValid()?(k(!1),w(!1)):i?.allowEmpty?w(!1):w(!0):w(!1)}else p("start"),k(!0)},style:{flex:1},allowClear:!0,placeholder:o.replace(/0/g,"_"),suffix:n.jsx(P.CalendarOutlined,{style:{color:"#d9d9d9"}}),autoComplete:"off"})}),n.jsx("span",{style:{color:"#d9d9d9",userSelect:"none"},children:"~"}),n.jsx(a.Form.Item,{name:l?Array.isArray(l)?[...l,1]:[l,1]:void 0,getValueProps:s=>{if(!s)return{value:void 0};if(typeof s=="string"&&s.length===h.length&&/^\d+$/.test(s)){if(e==="date"){const g=s.substring(0,4),y=s.substring(4,6),f=s.substring(6,8);return{value:`${g}-${y}-${f}`}}else if(e==="month"){const g=s.substring(0,4),y=s.substring(4,6);return{value:`${g}-${y}`}}else if(e==="year")return{value:s}}return{value:E(s).format(r)}},normalize:s=>s?E(s).format(h):(i?.allowEmpty,void 0),noStyle:!0,children:n.jsx(a.Input,{...m,ref:F,onFocus:()=>{if(p("end"),k(!v),d.current){d.current.updateValue();const s=d.current.value||"";!(d.current.unmaskedValue||"")&&!s.replace(/[^0-9]/g,"")&&(d.current.value="",d.current.updateValue())}},onBlur:()=>{q()},onKeyDown:s=>{if(s.key==="Backspace"){const g=d.current?.value||"",y=d.current?.unmaskedValue||"";if(g===""||y===""||g.replace(/[^0-9]/g,"").length<=1){s.preventDefault();const f=Array.isArray(l)?[...l,1]:[l,1];j.setFieldValue(f,void 0),I([C[0],null]),d.current&&(d.current.value="",d.current.updateValue()),setTimeout(()=>{c.current?.focus(),p("start"),k(!0)},0);return}p("end"),k(!0)}if(s.key==="Tab"&&k(!1),s.key==="Enter")if(v&&M==="end"){const g=d.current?.value||"";g.length===r.length?E(g,r,!0).isValid()?(k(!1),w(!1)):i?.allowEmpty?w(!1):w(!0):w(!1)}else p("end"),k(!0)},style:{flex:1},allowClear:!0,onClear:()=>{const s=Array.isArray(l)?[...l,1]:[l,1];j.setFieldValue(s,void 0),I([C[0],null]),d.current&&(d.current.value="",d.current.updateValue()),setTimeout(()=>{c.current?.focus(),p("start"),k(!0)},0)},placeholder:o.replace(/0/g,"_"),suffix:n.jsx(P.CalendarOutlined,{style:{color:"#d9d9d9"}}),autoComplete:"off"})})]}),n.jsx(Ye,{...i,open:v,picker:e,format:{format:r,type:"mask"},showNow:!0,value:C,onChange:K,onOpenChange:s=>{k(s),s||q(!1)},renderExtraFooter:()=>U?n.jsxs("div",{style:{color:"#faad14",paddingLeft:"8px",fontSize:"12px",display:"flex",alignItems:"center",gap:"6px",borderTop:"1px solid #f0f0f0",backgroundColor:"#fffbe6"},children:[n.jsx(P.ExclamationCircleOutlined,{}),n.jsx("span",{children:"유효하지 않은 날짜입니다"})]}):null,getPopupContainer:s=>s.parentElement,style:{position:"absolute",top:0,left:0,pointerEvents:"none",opacity:0,width:"100%"}})]})})},{Option:te}=a.Select,Ie=({itemProps:e,inputProps:t})=>{const[m,i]=x.useState([]);return x.useEffect(()=>{t?.addField==="ALL"?i([{label:"전체",value:""},...t?.list||[]]):t?.addField==="NULL"?i([{label:"",value:""},...t?.list||[]]):i(t?.list||[])},[t?.list]),n.jsx($,{...e,getValueProps:r=>r?{value:r&&r.indexOf(",")>0?r.split(","):[r]}:{value:[]},normalize:r=>r!=null&&r!=null&&r.length>0?r.toString():"",children:n.jsx(a.Select,{...t,mode:"multiple",children:m.map(r=>{const{value:o,label:h}=r;return t?.printCode?n.jsx(te,{value:o,label:h,children:n.jsx(a.Space,{children:`[${o}] ${h}`})},o):n.jsx(te,{value:o,label:h,children:n.jsx(a.Space,{children:`${h}`})},o)})})})},Ve=({itemProps:e,inputProps:t})=>{const m=r=>{let o=r.toString().split(".");return t?.decimalPoint!=null&&o[1]!=null&&t?.decimalPoint>0?o[1].length>t?.decimalPoint?o[1]="."+o[1].substring(0,t?.decimalPoint):o[1]="."+o[1]:o[1]="",o[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")+o[1]},i=r=>{let o=r.toString().split(".");return t?.decimalPoint!=null&&o[1]!=null&&t?.decimalPoint>0?o[1].length>t?.decimalPoint?o[1]="."+o[1].substring(0,t?.decimalPoint):o[1]="."+o[1]:o[1]="",o[0].replace(/\$\s?|(,*)/g,"")+o[1]};return n.jsx($,{...e,children:n.jsx(a.InputNumber,{...t,formatter:r=>m(r),parser:r=>i(r)})})},Ne=({itemProps:e,inputProps:t})=>n.jsx($,{...e,children:n.jsx(a.Radio.Group,{...t})}),{RangePicker:Le}=a.DatePicker,re={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"}},ve=({itemProps:e,inputProps:t,type:m="date",minDate:i,maxDate:r,returnType:o="string"})=>{const{displayFormat:h,outputFormat:c}=x.useMemo(()=>re[m],[m]),F=x.useMemo(()=>Object.values(re).map(u=>u.outputFormat).sort((u,d)=>{if(u.length===d.length){if(u===c)return-1;if(d===c)return 1}return d.length-u.length}),[c]);return n.jsx($,{...e,getValueProps:u=>({value:u&&u.length>0?[u[0]?E.isDayjs(u[0])?u[0]:E(u[0],F):null,u[1]?E.isDayjs(u[1])?u[1]:E(u[1],F):null]:null}),normalize:u=>u?o==="dayjs"?[u[0]??void 0,u[1]??void 0]:[u[0]?u[0].format(c):void 0,u[1]?u[1].format(c):void 0]:[void 0,void 0],children:n.jsx(Le,{...t,order:!0,minDate:i?E(i,F):void 0,maxDate:r?E(r,F):void 0,picker:m==="datetime"?"date":m,showTime:t?.showTime??(m==="datetime"||m==="time"),format:h})})},ne=a.Input.Search,Be=e=>{const t=a.Form.useFormInstance(),{openPopup:m}=ae.usePopupStore(),i=e.itemProps?.name||[],r=e.popupConfig||{callback(h){Array.isArray(i)&&i.length>1?(t.setFieldValue(i[0],h.code),t.setFieldValue(i[1],h.name)):t.setFieldValue(i,h.code)}},o={...e,placeholder:typeof e.placeholder=="string"?e.placeholder:e.placeholder?.[0]||"",onChange:h=>{Array.isArray(i)&&i.length>1&&t.setFieldValue(i[0],""),e.onChange?.(h)},onSearch:h=>{e.popuCd?m(e.popuCd,e.popupParams,r):e.onSearch?.(h)}};return Array.isArray(i)&&i.length>1?n.jsx($,{...e.itemProps,name:void 0,children:n.jsxs(a.Space.Compact,{block:!0,children:[n.jsx(a.Form.Item,{name:i[0],rules:e.itemProps?.rules,style:{width:"40%",marginBottom:0,marginInlineEnd:0},validateStatus:"",help:"",children:n.jsx(a.Input,{style:{color:"#999",backgroundColor:"#f5f5f5"},placeholder:e.placeholder?.[0]||"",readOnly:!0})}),n.jsx(a.Form.Item,{name:i[1],style:{width:"60%",marginBottom:0},children:n.jsx(ne,{readOnly:e.readOnly,enterButton:n.jsx(a.Button,{icon:n.jsx(P.SearchOutlined,{}),disabled:e.readOnly}),...o})})]})}):n.jsx($,{...e.itemProps,children:n.jsx(ne,{...o})})},Me=({itemProps:e,selectProps:t={options:[],allowClear:!0}})=>{const m=a.Form.useFormInstance(),i=!!m,r=x.useMemo(()=>t?.addField==="ALL"?[{label:"전체",value:""},...t?.options||[]]:t?.addField==="NULL"?[{label:"",value:""},...t?.options||[]]:t?.options||[],[t.options,t.addField]),o=F=>{t.onChange?.(F)},h={...t,allowClear:t.allowClear??!0,options:r,onChange:o,variant:t.variant},c=n.jsx(a.Select,{...h,disabled:t.disabled});return t.copyable&&!i&&console.warn("BwgSelect: copyable 기능은 Form 컨텍스트 내에서만 사용 가능합니다."),t.copyable?n.jsx($,{...e,name:void 0,children:n.jsxs(a.Space.Compact,{block:!0,children:[n.jsx(a.Form.Item,{name:e?.name,rules:e?.rules,style:{width:"100%",marginBottom:0},validateStatus:"",help:"",children:c}),n.jsx(a.Typography.Paragraph,{copyable:{text:i&&m?.getFieldValue(e?.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"}})]})}):n.jsx($,{...e,children:c})},Ee=({itemProps:e,inputProps:t={format:"YN"}})=>{const m=a.Form.useFormInstance(),i=(r,o)=>{t.format==="boolean"?m.setFieldValue(e?.name,r):m.setFieldValue(e?.name,r?"Y":"N"),t.onChange&&t.onChange(r,o)};return n.jsx($,{...e,getValueProps:r=>({checked:t.format==="boolean"?!!r:r==="Y"}),normalize:r=>typeof r=="boolean"?t.format==="boolean"?r:r?"Y":"N":t.format==="boolean"?!!r:r?"Y":"N",children:n.jsx(a.Switch,{...t,onChange:(r,o)=>i(r,o)})})},{TextArea:De}=a.Input,_e=({itemProps:e,inputProps:t})=>n.jsx($,{...e,children:n.jsx(De,{...t})}),Ae=[".pdf",".xlsx",".xls",".docx",".doc",".pptx",".ppt",".hwp",".txt",".csv",".jpg",".jpeg",".png",".gif",".zip"],se={FILE:"file"},Re=({originNode:e,file:t,fileList:m,moveFile:i,onDrop:r})=>{const o=x.useRef(null),[{handlerId:h},c]=J.useDrop({accept:se.FILE,collect:S=>({handlerId:S.getHandlerId()}),hover(S,j){if(!o.current)return;const v=S.uid,k=t.uid;if(v===k)return;const U=G.findIndex(m,{uid:k}),w=G.findIndex(m,{uid:v});if(w===-1||U===-1)return;const M=o.current.getBoundingClientRect(),p=j.getClientOffset();if(!p)return;const L=(M.bottom-M.top)/2,D=p.y-M.top;w<U&&D<L||w>U&&D>L||i(v,k)},drop(){r()}}),[{isDragging:F},u]=J.useDrag({type:se.FILE,item:()=>({uid:t.uid,index:G.findIndex(m,{uid:t.uid})}),collect:S=>({isDragging:S.isDragging()})}),d=F?0:1;return u(c(o)),n.jsx("div",{ref:o,style:{opacity:d},"data-handler-id":h,children:e})},Oe=({itemProps:e,fileGrpKey:t,onUploadComplete:m,onFetchFilesTrxCd:i="SCMFILE00101",onSuccessTrxCd:r="SCMFILE00102",onDeleteFileTrxCd:o="SCMFILE00103",onReorderFilesTrxCd:h="SCMFILE00104",allowedExtensions:c=Ae,maxFileSize:F=200,showButton:u=!0,multiple:d=!1,newFileGrpKeyonModify:S=!1,buttonText:j="파일 선택",localOnly:v=!1,onFilesChange:k})=>{const[U,w]=x.useState([]),M=x.useRef(t),p=x.useRef([]),L=a.Form.useFormInstance(),D=()=>{if(v||p.current.length===0)return;const s=[...p.current];if(p.current=[],r){const g=s.map(y=>({crprCd:T.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:M.current,physFileNm:y.fileNameP,lgclFileNm:y.fileNameL,filePath:y.filePath,fileExtn:y.fileExt,fileSize:y.fileSize,mltpYn:"N"}));console.log("newFileGrpKeyonModify",S),console.log("newFileGrpKeyonModify",S?0:M.current),T.callService(r,{crprCd:T.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:S?0:M.current,oldFileGrpKey:M.current,newFileGrpKeyonModify:S,sub:g}).then(y=>{if(y?.sub&&y.sub.length>0){const f=y.sub[0].fileGrpKey;(!M.current||S)&&(M.current=f);const B=new Map;y.sub.forEach(N=>{const _=s.find(H=>H.fileNameL===N.lgclFileNm);_&&B.set(_.tempId,N)});const Y=e?.name;(N=>{if(b){const _=L?.getFieldValue(Y)||[],H=N(_);L?.setFieldValue(Y,H)}else w(_=>N(_))})(N=>N.map(_=>{const H=B.get(_.uid);if(H){const Q=s.find(le=>le.tempId===_.uid);return m&&Q&&m({...Q,fileGrpKey:f,fileKey:H.fileKey}),{..._,name:H.lgclFileNm,fileGrpKey:f,fileKey:H.fileKey,uid:H.fileKey,status:"done",url:`/api/download?filePath=${H.filePath}&logicalName=${H.lgclFileNm}`}}return _}))}}).catch(y=>{console.error("업로드 후처리 서비스 호출 실패:",y),a.message.error("파일 후처리 중 오류가 발생했습니다.");const f=new Set(s.map(V=>V.tempId)),B=e?.name;(V=>{if(b){const N=L?.getFieldValue(B)||[],_=V(N);L?.setFieldValue(B,_)}else w(N=>V(N))})(V=>V.map(N=>f.has(N.uid)?{...N,status:"error",error:"후처리 실패"}:N))})}},O=x.useRef(G.debounce(D,500)).current;x.useEffect(()=>()=>{O.cancel()},[O]),x.useEffect(()=>{M.current=t},[t]),x.useEffect(()=>{v||t&&i&&T.callService(i,{crprCd:T.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:t}).then(s=>{if(s?.sub){const g=s.sub.map(f=>({uid:f.fileKey,name:f.lgclFileNm,status:"done",url:`/api/download?filePath=${f.filePath}&logicalName=${f.lgclFileNm}`})),y=e?.name;b?L?.setFieldValue(y,g):w(g)}else{const g=e?.name;b?L?.setFieldValue(g,[]):w([])}}).catch(s=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",s),a.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")})},[t,i]);const l=(s,g)=>{const y=e?.name,f=b?L?.getFieldValue(y)||[]:U,B=G.findIndex(f,{uid:s}),Y=G.findIndex(f,{uid:g});if(B<0||Y<0)return;const V=[...f],[N]=V.splice(B,1);V.splice(Y,0,N),b?L?.setFieldValue(y,V):w(V)},C=()=>{if(!v&&t&&h){const s=e?.name,y=(b?L?.getFieldValue(s)||[]:U).map(f=>f.uid);T.callService(h,{crprCd:T.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:t,reorderedFileKeys:y}).then(()=>{a.message.success("파일 순서가 성공적으로 저장되었습니다.")}).catch(f=>{console.error("파일 순서 저장 서비스 호출 실패:",f),a.message.error("파일 순서 저장 중 오류가 발생했습니다.")})}},I=s=>{const g=e?.name,y=b?L?.getFieldValue(g)||[]:U;if(!d&&y.length>0)return a.message.error("하나의 파일만 업로드할 수 있습니다."),a.Upload.LIST_IGNORE;if(c&&c.length>0){const f=`.${s.name.split(".").pop()?.toLowerCase()}`;if(!c.includes(f))return a.message.error(`${s.name} 파일은 허용되지 않는 확장자입니다. (${c.join(", ")})`),a.Upload.LIST_IGNORE}return F&&!(s.size/1024/1024<F)?(a.message.error(`일반업로드의 최대용량은 ${F}MB입니다.`),a.Upload.LIST_IGNORE):!v},b=!!e?.name,A={name:"file",multiple:d,action:v?void 0:"/api/upload",beforeUpload:I,showUploadList:{showRemoveIcon:u},onChange(s){const{status:g,uid:y}=s.file;if(g==="removed"){if(!v&&o)T.callService(o,{crprCd:T.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:S?0:M.current,fileKey:y,oldFileGrpKey:M.current,newFileGrpKeyonModify:S}).then(f=>{if(a.message.success("파일이 성공적으로 삭제되었습니다."),S&&(M.current=f.fileGrpKey),b){const B=e?.name;L?.setFieldValue(B,s.fileList)}else w(s.fileList);k?.(s.fileList),m?.({fileGrpKey:f.fileGrpKey})}).catch(f=>{console.error("파일 삭제 서비스 호출에 실패했습니다.",f),a.message.error("파일 삭제 중 오류가 발생했습니다.")});else{if(b){const f=e?.name;L?.setFieldValue(f,s.fileList)}else w(s.fileList);k?.(s.fileList)}return}if(b){const f=e?.name;L?.setFieldValue(f,s.fileList)}else w(s.fileList);if(k?.(s.fileList),g==="done")if(!v&&s.file.response?.success){const{uploadedFiles:f}=s.file.response;f&&Array.isArray(f)&&f.length>0&&(f.forEach(B=>{B.tempId=s.file.uid,p.current.push(B)}),O()),a.message.success(s.file.response.message||`${s.file.name} 파일이 성공적으로 업로드되었습니다.`)}else a.message.error(s.file.response?.message||`${s.file.name} 파일 업로드에 실패했습니다.`);else g==="error"&&a.message.error(s.file.response?.message||`${s.file.name} 파일 업로드 중 오류가 발생했습니다.`)},itemRender(s,g,y){const f=x.cloneElement(s,{href:g.url||void 0,title:void 0});return n.jsx(Re,{originNode:f,file:g,fileList:y,moveFile:l,onDrop:C},g.uid)}};b||(A.fileList=U);const R=s=>Array.isArray(s)?s:s&&s.fileList,z=e?.name,K=b?a.Form.useWatch?.(z,L):void 0,q=b?K||[]:U;return n.jsx(J.DndProvider,{backend:ce.HTML5Backend,children:n.jsx($,{valuePropName:"fileList",getValueFromEvent:R,...e,children:n.jsx(a.Upload,{headers:{SYSCD:__SYS_CD__},...A,listType:"picture",children:u&&(d||q.length===0)&&n.jsx(a.Button,{icon:n.jsx(P.UploadOutlined,{}),children:j})})})})},Ue=a.Input.Search,ze=e=>{const t=a.Form.useFormInstance(),{openCorePopup:m}=X.usePopup(),i={value:"empNm",fieldName:"empNm",placeholder:"사원명"},r={value:"deptNm",fieldName:"deptNm",placeholder:"부서"},o=e.field1||i,h=e.field2||r,c=x.useCallback(d=>{t.setFieldValue(e.employeeFieldName||"employee",d),t.setFieldValue(e.empNoFieldName||"empNo",d.empNo??""),t.setFieldValue(o.fieldName,d[o.value||"empNm"]??""),t.setFieldValue(h.fieldName,d[h.value||"deptNm"]??""),e.onFinish?.()},[t,o,h,e.employeeFieldName]),F=x.useCallback(d=>{m("CORE_ORGANIZATION_01",{onSelect:S=>{c(S)},defaultParams:{keyword:d}})},[c,m]),u=x.useCallback(async d=>{const S=d?.trim();if(S)try{const j=await T.callService("SCMUTIL00101",{keyword:S},{showLoading:!1}),v=j?.empList||[];if(j?.empCnt===0){a.message.warning("일치하는 사원을 찾을 수 없어 팝업을 열립니다. 사원을 선택해주세요."),F();return}if(j?.empCnt>1){a.message.info("여러 건이 검색되어 팝업이 열립니다. 사원을 선택해주세요."),F(S);return}const k=v[0];c(k)}catch(j){console.error("사원 검색 서비스 실패:",j),a.message.error("사원 검색 중 오류가 발생했습니다.")}},[c,F]);return n.jsx($,{label:e.label||"사원",name:void 0,children:n.jsxs(a.Space.Compact,{block:!0,children:[n.jsx(a.Form.Item,{name:o.fieldName,style:{width:"40%",marginBottom:0,marginInlineEnd:0},validateStatus:"",help:"",children:n.jsx(a.Input,{style:{color:"#999",backgroundColor:"#f5f5f5"},placeholder:o.placeholder,readOnly:!0})}),n.jsx(a.Form.Item,{name:e.employeeFieldName||"employee",hidden:!0}),n.jsx(a.Form.Item,{name:e.empNoFieldName||"empNo",hidden:!0}),n.jsx(a.Form.Item,{name:h.fieldName,style:{width:"60%",marginBottom:0},children:n.jsx(Ue,{allowClear:!0,readOnly:e.readOnly,placeholder:h.placeholder,enterButton:n.jsx(a.Button,{icon:n.jsx(P.SearchOutlined,{}),disabled:e.readOnly,onClick:()=>{F()}}),onSearch:u,onChange:d=>{t.setFieldValue(e.empNoFieldName||"empNo",""),t.setFieldValue(o.fieldName,""),t.setFieldValue(h.fieldName,d.target.value),t.setFieldValue(e.employeeFieldName||"employee",null)}})})]})})};exports.BwgButton=ue;exports.BwgCheck=de;exports.BwgCheckList=fe;exports.BwgDatePicker=me;exports.BwgDownload=ge;exports.BwgEmpSearch=ze;exports.BwgForm=oe;exports.BwgFormItem=$;exports.BwgInput=he;exports.BwgLargeUploader=Fe;exports.BwgMaskedDate=ke;exports.BwgMaskedInput=Se;exports.BwgMaskedRange=be;exports.BwgMultiSelect=Ie;exports.BwgNumber=Ve;exports.BwgRadio=Ne;exports.BwgRangePicker=ve;exports.BwgSearch=Be;exports.BwgSelect=Me;exports.BwgSwitch=Ee;exports.BwgTextArea=_e;exports.BwgUploader=Oe;