@bwg-ui/core 1.3.8 → 1.3.10

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/{UploadMultiFileP01-Bf1qonGN.cjs → UploadMultiFileP01-CffgcIXm.cjs} +1 -1
  2. package/dist/chunks/{UploadMultiFileP01-BgyIhfac.js → UploadMultiFileP01-Cy2LeYfy.js} +1 -1
  3. package/dist/chunks/{layout-components-Lyp9SZ7V.js → layout-components-Cpzy8mH1.js} +1 -1
  4. package/dist/chunks/{layout-components-NtKR0O6Y.cjs → layout-components-y9YpQQbx.cjs} +2 -2
  5. package/dist/components/common/index.cjs +1 -1
  6. package/dist/components/common/index.d.ts +1 -1
  7. package/dist/components/common/index.d.ts.map +1 -1
  8. package/dist/components/common/index.js +1 -1
  9. package/dist/components/core/{BwgXlsxUploader.d.ts → BwgExcelUploaderBatch.d.ts} +4 -4
  10. package/dist/components/core/BwgExcelUploaderBatch.d.ts.map +1 -0
  11. package/dist/components/core/BwgExcelUploaderService.d.ts +31 -0
  12. package/dist/components/core/BwgExcelUploaderService.d.ts.map +1 -0
  13. package/dist/components/core/index.cjs +1 -1
  14. package/dist/components/core/index.d.ts +4 -2
  15. package/dist/components/core/index.d.ts.map +1 -1
  16. package/dist/components/core/index.js +1362 -1190
  17. package/dist/components/layout/index.cjs +1 -1
  18. package/dist/components/layout/index.js +1 -1
  19. package/dist/components/pages/auth/AuthManagement.d.ts +2 -2
  20. package/dist/components/pages/auth/AuthManagement.d.ts.map +1 -1
  21. package/dist/components/pages/auth/RoleAuthMapper.d.ts +8 -0
  22. package/dist/components/pages/auth/RoleAuthMapper.d.ts.map +1 -0
  23. package/dist/components/pages/index.d.ts +1 -0
  24. package/dist/components/pages/index.d.ts.map +1 -1
  25. package/dist/components/popup/index.cjs +1 -1
  26. package/dist/components/popup/index.js +1 -1
  27. package/dist/index.cjs +98 -49
  28. package/dist/index.js +13004 -12301
  29. package/dist/provider/hooks/useSizeConfig.d.ts +2 -2
  30. package/dist/stores/codeStore.d.ts +1 -1
  31. package/dist/stores/codeStore.d.ts.map +1 -1
  32. package/dist/stores/index.cjs +1 -1
  33. package/dist/stores/index.js +23 -23
  34. package/dist/utils/colorFormat.d.ts.map +1 -1
  35. package/dist/utils/index.js +173 -0
  36. package/package.json +2 -2
  37. package/dist/components/core/BwgXlsxUploader.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
- export interface BwgXlsxUploaderProps {
1
+ export interface BwgExcelUploaderBatchProps {
2
2
  /**
3
3
  * 버튼 라벨
4
4
  */
@@ -20,6 +20,6 @@ export interface BwgXlsxUploaderProps {
20
20
  */
21
21
  disabled?: boolean;
22
22
  }
23
- declare const BwgXlsxUploader: ({ label, jobId, extraParams, onFinish, disabled, }: BwgXlsxUploaderProps) => import("react/jsx-runtime").JSX.Element;
24
- export default BwgXlsxUploader;
25
- //# sourceMappingURL=BwgXlsxUploader.d.ts.map
23
+ declare const BwgExcelUploaderBatch: ({ label, jobId, extraParams, onFinish, disabled, }: BwgExcelUploaderBatchProps) => import("react/jsx-runtime").JSX.Element;
24
+ export default BwgExcelUploaderBatch;
25
+ //# sourceMappingURL=BwgExcelUploaderBatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BwgExcelUploaderBatch.d.ts","sourceRoot":"","sources":["../../../src/components/core/BwgExcelUploaderBatch.tsx"],"names":[],"mappings":"AA4CA,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAClC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,qBAAqB,GAAI,oDAM5B,0BAA0B,4CAgS5B,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,31 @@
1
+ export interface BwgExcelUploaderServiceProps {
2
+ /**
3
+ * 버튼 라벨
4
+ * @default '엑셀 업로드'
5
+ */
6
+ label?: string;
7
+ /**
8
+ * 실행할 서비스 이름
9
+ * !! 반드시 서비스 요청 dto에 filePath 필드를 포함해야 합니다.
10
+ * !! 서비스 응답의 success 필드의 결과에 따라 상태를 처리합니다.
11
+ * - true: 서비스 실행 완료
12
+ * - false: 서비스 실행 실패
13
+ * - 없을 경우 항상 서비스 실행 완료로 간주합니다.
14
+ */
15
+ serviceName: string;
16
+ /**
17
+ * 서비스 추가 파라미터
18
+ */
19
+ extraParams?: any;
20
+ /**
21
+ * 실행 완료 시 호출되는 함수
22
+ */
23
+ onFinish?: () => void;
24
+ /**
25
+ * 버튼 비활성화 여부
26
+ */
27
+ disabled?: boolean;
28
+ }
29
+ declare const BwgExcelUploaderService: ({ label, serviceName, extraParams, onFinish, disabled, }: BwgExcelUploaderServiceProps) => import("react/jsx-runtime").JSX.Element;
30
+ export default BwgExcelUploaderService;
31
+ //# sourceMappingURL=BwgExcelUploaderService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BwgExcelUploaderService.d.ts","sourceRoot":"","sources":["../../../src/components/core/BwgExcelUploaderService.tsx"],"names":[],"mappings":"AA4CA,MAAM,WAAW,4BAA4B;IAC3C;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;OAOG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,uBAAuB,GAAI,0DAM9B,4BAA4B,4CAsP9B,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("antd"),h=require("react"),ie=require("../../stores/index.cjs"),v=require("dayjs"),Y=require("@ant-design/icons"),$=require("../../utils/index.cjs"),me=require("jszip"),J=require("imask"),G=require("../../chunks/provider-DrmM0H4o.cjs"),Q=require("lodash"),Z=require("react-dnd"),ce=require("react-dnd-html5-backend"),fe=require("antd/es/upload/Dragger"),W=t=>{const{componentSize:r}=ie.useUserStore(),m=h.useMemo(()=>t.size?t.size:{0:"small",1:"middle",2:"large"}[r],[r,t.size]),l=h.useMemo(()=>({0:12,1:14,2:16})[r],[r]);return e.jsx(s.Button,{...t,size:m,className:"bwg-btn",style:{fontSize:`${l}px`,...t.style},children:t.children})},T=h.memo(({children:t,label:r,name:m,rules:l,initialValue:n,style:a,required:d,...c})=>{const g={fontWeight:"bold"};(l==null||l==null)&&d&&(l=[{required:!0,message:`${r}을(를) 입력해주세요.`}]);const i=Array.isArray(l)&&l.some(F=>F.required===!0),u=()=>typeof r=="string"?e.jsxs("span",{style:g,children:[r,i&&e.jsx("span",{style:{color:"#ff4d4f",marginLeft:"4px"},children:"*"})]}):e.jsx("span",{style:g,children:r});return e.jsx(s.Form.Item,{className:"bwg-form-item",label:r?u():void 0,labelAlign:c.labelAlign||"left",name:m,rules:l,colon:!1,initialValue:n,style:a,...c,children:t})}),ge=({itemProps:t,inputProps:r={format:"YN"}})=>{const m=s.Form.useFormInstance(),l=n=>{r.format==="boolean"?m.setFieldValue(t?.name,n.target.checked):m.setFieldValue(t?.name,n.target.checked?"Y":"N"),r.onChange&&r.onChange(n)};return e.jsx(T,{...t,getValueProps:n=>({checked:r.format==="boolean"?!!n:n==="Y"}),normalize:n=>typeof n=="boolean"?r.format==="boolean"?n:n?"Y":"N":r.format==="boolean"?!!n:n?"Y":"N",children:e.jsx(s.Checkbox,{...r,onChange:l,children:r?.title})})},he=({itemProps:t,inputProps:r})=>{const m=s.Form.useFormInstance(),[l,n]=h.useState(t?.initialValue??[]),[a,d]=h.useState([]),c=a.length>0&&a.length==l?.length,g=l?.length>0&&l.length<a.length;h.useEffect(()=>{d(i(r?.options))},[r?.options]),h.useEffect(()=>{n(l)},[l]);const i=x=>{const w=[];return(x||[]).map((C,A)=>{w.push(C.value)}),w},u=x=>{n(x.target.checked?a:[]),m.setFieldValue(t?.name,x.target.checked?a:[])},F=x=>{n(x),m.setFieldValue(t?.name,x),r?.onChange&&typeof r?.onChange=="function"&&r?.onChange(x)};return e.jsx(T,{...t,children:e.jsxs(s.ConfigProvider,{theme:{components:{Checkbox:{colorPrimary:"var(--check-primary)",colorPrimaryBorder:"var(--check-primary)",colorPrimaryHover:"var(--check-primary-active)"}}},children:[r?.allCheck&&e.jsx(s.Checkbox,{indeterminate:g,checked:c,onChange:u,children:"전체선택"}),e.jsx(s.Checkbox.Group,{options:r?.options,value:l,onChange:F})]})})},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"}},pe=({itemProps:t,inputProps:r,type:m="date",returnType:l="string"})=>{const{displayFormat:n,outputFormat:a}=h.useMemo(()=>re[m],[m]),d=h.useMemo(()=>Object.values(re).map(c=>c.outputFormat).sort((c,g)=>{if(c.length===g.length){if(c===a)return-1;if(g===a)return 1}return g.length-c.length}),[a]);return e.jsx(T,{...t,getValueProps:c=>({value:c?v.isDayjs(c)?c:v(c,d):null}),normalize:c=>c?l==="dayjs"?c:c.format(a):null,children:e.jsx(s.DatePicker,{...r,picker:m==="datetime"?"date":m,showTime:r?.showTime??(m==="datetime"||m==="time"),format:r?.format??n})})},xe=({fileGrpKey:t,onFetchFilesTrxCd:r="SCMFILE00101",readOnly:m=!1,appCd:l=__APP_CD__})=>{const[n,a]=h.useState([]);h.useEffect(()=>{if(r)if(l!=__APP_CD__){const g=$.getApiDeps().findSystemByAppCd?.(l??__APP_CD__);if(!g||!g.sysCd){console.error("해당 앱코드는 존재하지 않습니다.",l);return}$.callServiceByAppCd({trxCd:r,appCd:l},{crprCd:$.getCrprCd(),sysCd:g.sysCd,fileGrpKey:t}).then(i=>{if(i?.sub){const u=i.sub.map(F=>({uid:F.fileKey,name:F.lgclFileNm,filePath:F.filePath}));a(u)}}).catch(i=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",i),s.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")})}else $.callService(r,{crprCd:$.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:t}).then(c=>{if(c?.sub){const g=c.sub.map(i=>({uid:i.fileKey,name:i.lgclFileNm,filePath:i.filePath}));a(g)}}).catch(c=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",c),s.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")});else a([])},[t,r,l]);const d=async c=>{try{const i=$.getApiDeps().findSystemByAppCd?.(l??__APP_CD__);if(!i||!i.sysCd){console.error("해당 앱코드는 존재하지 않습니다.",l);return}const F=await fetch("/api/download",{method:"POST",headers:{SYSCD:i.sysCd,"Content-Type":"application/json"},body:JSON.stringify({filePath:c.filePath,logicalName:c.name,fileKey:c.uid})});if(!F.ok){const y=(await F.json().catch(()=>null))?.message||"파일 다운로드에 실패했습니다.";throw new Error(y)}const x=await F.blob(),w=window.URL.createObjectURL(x),C=document.createElement("a");C.href=w,C.setAttribute("download",c.name),document.body.appendChild(C),C.click(),document.body.removeChild(C),window.URL.revokeObjectURL(w)}catch(g){console.error(g),s.message.error(g.message||"파일을 다운로드하는 중 오류가 발생했습니다.")}};return e.jsx(s.Card,{title:"파일 목록",children:e.jsx(s.List,{dataSource:n,renderItem:c=>e.jsx(s.List.Item,{actions:m?[]:[e.jsx(s.Button,{type:"text",icon:e.jsx(Y.DownloadOutlined,{}),onClick:()=>d(c)},"download")],children:e.jsx(s.List.Item.Meta,{avatar:e.jsx(Y.PaperClipOutlined,{}),title:c.name})})})})},ue=h.forwardRef(({children:t,labelCol:r,style:m,className:l,...n},a)=>e.jsx(s.ConfigProvider,{form:{},children:e.jsx(s.Form,{ref:a,...n,requiredMark:!1,labelCol:r||{flex:"100px"},style:{padding:"10px",...m},className:`bwg-form ${l??""}`,children:t})}));ue.displayName="BwgForm";const ye=({itemProps:t,inputProps:r})=>e.jsx(T,{...t,children:e.jsx(s.Input,{...r})}),{Text:K}=s.Typography,{Dragger:Fe}=s.Upload,je=[".pdf",".xlsx",".xls",".docx",".doc",".pptx",".ppt",".hwp",".txt",".csv",".jpg",".jpeg",".png",".gif",".zip"],Ce=(t,r=2)=>{if(t===0)return"0 Bytes";const m=1024,l=r<0?0:r,n=["Bytes","KB","MB","GB","TB"],a=Math.floor(Math.log(t)/Math.log(m));return parseFloat((t/Math.pow(m,a)).toFixed(l))+" "+n[a]},Se=({title:t="첨부파일",fileGrpKey:r,onUploadComplete:m,onSuccessTrxCd:l="SCMFILE00102",anotherServiceTrxCd:n="SCMFILE00105",allowedExtensions:a=je,maxFileSize:d=2048})=>{const[c,g]=h.useState([]),[i,u]=h.useState(!1),[F,x]=h.useState(!1),[w,C]=h.useState(0),A=p=>{if(a&&a.length>0){const L=(R=>{const o=R.lastIndexOf(".");return o===-1?"":R.substring(o).toLowerCase()})(p.name);if(!a.includes(L))return s.message.error(`${p.name} 파일은 허용되지 않는 확장자입니다. (${a.join(", ")}만 가능)`),!1}return!0},y=async()=>{const p=c.filter(S=>S.status!=="done"),P=p.reduce((S,b)=>S+(b.size||0),0),L=2*1024*1024*1024;if(P>L){s.notification.error({message:"업로드 용량 초과",description:"한 번에 업로드할 수 있는 총 파일 용량은 2GB를 초과할 수 없습니다."});return}if(p.length===0){s.message.warning("업로드할 파일이 없거나 모든 파일이 이미 업로드되었습니다.");return}x(!0);let R;try{const S=new me;p.forEach(b=>{b.originFileObj&&S.file(b.name,b.originFileObj)}),R=await S.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:9}})}catch(S){x(!1),s.message.error("파일을 압축하는 중 오류가 발생했습니다."),console.error("Zipping error:",S);return}x(!1);const o=new FormData;o.append("file",R,"upload.zip"),u(!0),C(0);try{const S=await new Promise((O,B)=>{const M=new XMLHttpRequest;M.open("POST","/api/upload-large",!0),M.upload.onprogress=_=>{if(_.lengthComputable){const X=Math.round(_.loaded/_.total*100);C(X)}},M.onload=()=>{if(M.status>=200&&M.status<300)try{const _=JSON.parse(M.responseText);_.success?O(_):B(new Error(_.message||"파일 업로드에 실패했습니다."))}catch{B(new Error("잘못된 서버 응답입니다."))}else try{const _=JSON.parse(M.responseText);B(new Error(_.message||`서버 오류: ${M.status}`))}catch{B(new Error(`서버 오류: ${M.status}`))}},M.onerror=()=>{B(new Error("네트워크 오류가 발생했습니다."))},M.send(o)});s.message.success(S.message||"압축 파일이 성공적으로 업로드되었습니다.");const b=c.map(O=>p.find(B=>B.uid===O.uid)?{...O,status:"done"}:O);if(g(b),l&&S.uploadedFiles&&Array.isArray(S.uploadedFiles)){const O=$.getUserInfo();S.uploadedFiles.forEach(B=>{const M={crprCd:O?.crprCd,sysCd:__SYS_CD__,fileGrpKey:r,sub:[{crprCd:O?.crprCd,sysCd:__SYS_CD__,fileGrpKey:r,physFileNm:B.fileNameP,lgclFileNm:B.fileNameL,filePath:B.filePath,fileExtn:B.fileExt,fileSize:B.fileSize,mltpYn:"Y"}]};$.callService(l,M).then(_=>{const X=c.map(q=>({crprCd:O?.crprCd,sysCd:__SYS_CD__,fileGrpKey:_.sub[0].fileGrpKey,fileKey:_.sub[0].fileKey,lgclFileNm:q.name,fileSize:q.size,fileExtn:q.name.split(".").pop(),fileType:q.type}));$.callService(n,{sub:X})}).catch(_=>{console.error("후처리 서비스 호출 실패:",_),s.message.error(`${B.fileNameL} 파일의 후처리 작업에 실패했습니다.`)}),m&&m({fileNameP:B.fileNameP,fileNameL:B.fileNameL})})}}catch(S){s.message.error(S.message||"파일 업로드 중 오류가 발생했습니다.");const b=c.map(O=>p.find(B=>B.uid===O.uid)?{...O,status:"error",response:S.message||"파일 업로드 중 오류가 발생했습니다."}:O);g(b)}finally{u(!1)}},E={multiple:!0,fileList:c,beforeUpload:p=>A(p)?d&&p.size>=d*1024*1024?(s.message.error(`대용량 첨부 파일 최대 크기는 ${(d/1024).toFixed(1)}GB입니다.`),s.Upload.LIST_IGNORE):!1:s.Upload.LIST_IGNORE,onChange:({fileList:p})=>{const P=new Map(c.map(L=>[L.uid,L]));p.forEach(L=>{P.set(L.uid,L)}),g(Array.from(P.values()))},onRemove:p=>{const P=c.filter(L=>L.uid!==p.uid);g(P)},showUploadList:!1};return e.jsx(s.Spin,{spinning:i||F,tip:F?"파일 압축 중...":`파일 업로드 중... ${w}%`,children:e.jsxs("div",{className:"bwg-large-uploader-container",children:[e.jsx(s.Card,{title:e.jsx(K,{strong:!0,children:t}),extra:e.jsx(s.Upload,{...E,children:e.jsx(s.Button,{icon:e.jsx(Y.UploadOutlined,{}),children:"파일 선택"})}),style:{padding:0},children:e.jsx(Fe,{...E,style:{border:"none",background:"transparent",padding:0},children:e.jsx("div",{className:"upload-list-container",children:c.length>0?e.jsx(s.List,{style:{textAlign:"left"},dataSource:c,renderItem:p=>{const P=p.status==="done",L=p.status==="error";let R;return P?R=e.jsx(Y.CheckCircleOutlined,{style:{color:"#52c41a",fontSize:14}}):L?R=e.jsx(s.Tooltip,{title:typeof p.response=="string"?p.response:"업로드 실패",children:e.jsx(Y.CloseCircleOutlined,{style:{color:"#ff4d4f",fontSize:14}})}):R=e.jsx(Y.FileTextOutlined,{style:{fontSize:14}}),e.jsx(s.List.Item,{actions:[e.jsx(K,{type:"secondary",children:Ce(p.size||0)},"size"),e.jsx(s.Button,{type:"text",icon:e.jsx(Y.DeleteOutlined,{}),onClick:o=>{o.stopPropagation(),E.onRemove?.(p)},disabled:i||F},"delete")],children:e.jsx(s.List.Item.Meta,{avatar:R,title:e.jsx(K,{type:L?"danger":void 0,children:p.name})})},p.uid)}}):e.jsxs(s.Flex,{gap:"middle",align:"center",justify:"center",vertical:!0,style:{padding:"20px 0",minHeight:"120px"},children:[e.jsx(Y.InboxOutlined,{style:{fontSize:"32px",color:"#999"}}),e.jsx(K,{type:"secondary",children:"업로드할 파일을 선택하거나 이 영역으로 드래그하세요."})]})})})}),c.length>0&&e.jsxs(s.Flex,{justify:"flex-end",align:"center",gap:"large",style:{marginTop:16},children:[i&&e.jsx("div",{style:{width:"250px"},children:e.jsx(s.Progress,{percent:w,size:"small"})}),e.jsx(s.Button,{type:"primary",onClick:y,disabled:i||F||c.filter(p=>p.status!=="done").length===0,icon:e.jsx(Y.CloudUploadOutlined,{}),children:"일괄 업로드"})]})]})})},ke=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:r,blocks:m}=t;return r.split(".").map(l=>{const a=m?.[l]?.maxLength??3;return"_".repeat(a)}).join(".")}return""},we=({itemProps:t,inputProps:r,mask:m})=>{const l=h.useRef(null),n=s.Form.useFormInstance(),a=h.useMemo(()=>ke(m),[m]);return h.useEffect(()=>{if(!l.current?.input)return;const d=typeof m=="string"||Array.isArray(m)?{mask:m}:m,c=J(l.current.input,d);return c.on("accept",()=>{n&&t?.name&&n.setFieldValue(t.name,c.value)}),()=>{c.destroy()}},[m,n,t?.name]),e.jsx(T,{...t,children:e.jsx(s.Input,{...r,ref:l,placeholder:a})})},be=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"}}},Ie=({type:t="date",itemProps:r={name:"calendar"},inputProps:m,pickerProps:l})=>{const{format:n,mask:a,outputFormat:d}=be(t),c=h.useRef(null),g=h.useRef(null),i=h.useRef(null),u=s.Form.useFormInstance(),[F,x]=h.useState(!1),[w,C]=h.useState(!1),A=r?.name,[y,E]=h.useState(null),p=s.Form.useWatch(A,u),P=G.useSizeConfig();h.useEffect(()=>{if(!c.current?.input)return;const o=J(c.current.input,{mask:a,lazy:!1});return g.current=o,o.on("accept",()=>{const S=o.value;S.length>0&&x(!0);const b=v(S,n,!0);S.length===n.length&&b.isValid()&&(u.setFieldValue(A,b.format(d)),E(b),g.current?.updateValue())}),()=>{o.destroy()}},[n,a]),h.useEffect(()=>{if(!p){E(null);return}let o=null;if(typeof p=="string"&&p.length===d.length&&/^\d+$/.test(p))if(t==="date"){const S=p.substring(0,4),b=p.substring(4,6),O=p.substring(6,8);o=v(`${S}-${b}-${O}`,n,!0)}else if(t==="month"){const S=p.substring(0,4),b=p.substring(4,6);o=v(`${S}-${b}`,n,!0)}else t==="year"&&(o=v(p,n,!0));else o=v(p,n,!0);o&&o.isValid()?E(o):E(null),C(!1)},[p,n,d,t]);const L=o=>{if(!o){u.setFieldValue(A,void 0),E(null),g.current?.updateValue();return}E(o);const S=o.format(d);u.setFieldValue(A,S),g.current&&(g.current.value=o.format(n),g.current.updateValue()),C(!1)},R=o=>{setTimeout(()=>{const S=document.activeElement,b=i.current,O=b?.querySelector(".ant-picker-dropdown");!(b&&(b.contains(S)||b===S||O?.contains(S)))&&!(o!==void 0?o:F)&&console.log("✅ Input과 DatePicker 모두 포커스가 없습니다")},0)};return e.jsx(T,{...r,name:void 0,validateStatus:w?"warning":void 0,children:e.jsxs(s.ConfigProvider,{componentSize:P.componentSize,theme:{components:{Input:{addonBg:"#fff"}}},children:[e.jsx(s.Form.Item,{name:A,getValueProps:o=>({value:o?v(o).format(n):void 0}),normalize:o=>o?v(o).format(d):void 0,noStyle:!0,rules:r?.rules??[],children:e.jsx(s.Input,{...m,ref:c,onFocus:()=>{x(!F),g.current?.updateValue()},onBlur:()=>{R()},onKeyDown:o=>{if(o.key==="Backspace"&&x(!0),o.key==="Tab"&&x(!1),o.key==="Enter")if(F){const S=g.current?.value||"",b=v(S,n,!0);S.length===n.length&&b.isValid()?(x(!1),C(!1)):C(!0)}else x(!0)},style:{width:"65%"},allowClear:!0,placeholder:a.replace(/0/g,"_"),suffix:e.jsx(Y.CalendarOutlined,{style:{color:"#d9d9d9"}}),autoComplete:"off"})}),e.jsx(s.DatePicker,{...l,open:F,picker:t,format:{format:n,type:"mask"},showNow:!0,value:y,onChange:L,onOpenChange:o=>{x(o),o||R(!1)},renderExtraFooter:()=>w?e.jsxs("div",{style:{color:"#faad14",paddingLeft:"8px",fontSize:"12px",display:"flex",alignItems:"center",gap:"6px",borderTop:"1px solid #f0f0f0",backgroundColor:"#fffbe6"},children:[e.jsx(Y.ExclamationCircleOutlined,{}),e.jsx("span",{children:"유효하지 않은 날짜입니다"})]}):null,getPopupContainer:o=>o.parentElement,style:{position:"absolute",top:0,left:0,pointerEvents:"none",opacity:0,width:"100%"}})]})})},{RangePicker:Ee}=s.DatePicker,De=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:r={name:"dateRange"},inputProps:m,pickerProps:l})=>{const{format:n,mask:a,outputFormat:d}=De(t),c=h.useRef(null),g=h.useRef(null),i=h.useRef(null),u=h.useRef(null),F=h.useRef(null),x=s.Form.useFormInstance(),[w,C]=h.useState(!1),[A,y]=h.useState(!1),[E,p]=h.useState(null),[P,L]=h.useState(!1),R=h.useRef(!1),o=r?.name,[S,b]=h.useState([null,null]),O=s.Form.useWatch(o?Array.isArray(o)?[...o,0]:[o,0]:void 0,x),B=s.Form.useWatch(o?Array.isArray(o)?[...o,1]:[o,1]:void 0,x),M=s.Form.useWatch(o,x),_=G.useSizeConfig();h.useEffect(()=>{if(!c.current?.input)return;const f=J(c.current.input,{mask:a,lazy:!1});return i.current=f,f.on("accept",()=>{const j=f.value,D=f.unmaskedValue||"";if(console.log("🔵 [시작일] accept 이벤트:",{maskValue:j,unmaskedValue:D,length:j.length,formatLength:n.length}),j.length>0&&(p("start"),C(!0),L(!1)),D.length===d.length){const k=v(j,n,!0);if(k.isValid()){console.log("🔵 [시작일] 입력 완료 및 검증 통과:",{parsed:k.format(n)});const z=k.format(d);R.current=!0;const I=Array.isArray(o)?[...o,0]:[o,0];x.setFieldValue(I,z),b([k,S[1]]),i.current&&i.current.updateValue(),y(!1),setTimeout(()=>{u.current&&(u.current.value="",u.current.unmaskedValue="",u.current.updateValue());const V=Array.isArray(o)?[...o,1]:[o,1];x.getFieldValue(V)||x.setFieldValue(V,void 0),g.current?.focus(),setTimeout(()=>{if(u.current){const H=u.current.value||"";!(u.current.unmaskedValue||"")&&!H.replace(/[^0-9]/g,"")&&(u.current.value="",u.current.updateValue())}},10),p("end"),C(!0),R.current=!1},0)}else l?.allowEmpty?y(!1):(console.log("🔵 [시작일] 검증 실패:",{val:j,parsed:k}),y(!0))}}),()=>{f.destroy()}},[n,a,o]),h.useEffect(()=>{if(!g.current?.input)return;const f=J(g.current.input,{mask:a,lazy:!1});return u.current=f,f.on("accept",()=>{const j=f.value,D=f.unmaskedValue||"";if(console.log("🟢 [종료일] accept 이벤트:",{maskValue:j,unmaskedValue:D,length:j.length,formatLength:n.length}),D===""||D.length===0){const k=Array.isArray(o)?[...o,1]:[o,1];x.setFieldValue(k,void 0),b([S[0],null]),u.current&&(u.current.value="",u.current.updateValue()),setTimeout(()=>{c.current?.focus(),p("start"),C(!0)},0);return}if(j.length>0&&(p("end"),C(!0)),j.length<n.length){y(!1);return}if(D.length===d.length){const k=v(j,n,!0);if(k.isValid()){const z=k.format(d);console.log("🟢 [종료일] 입력 완료:",{parsed:k.format(n),formatted:z}),R.current=!0;const I=Array.isArray(o)?[...o,1]:[o,1];x.setFieldValue(I,z),b([S[0],k]),u.current?.updateValue(),setTimeout(()=>{R.current=!1},0)}else l?.allowEmpty?y(!1):(console.log("🟢 [종료일] 검증 실패:",{val:j,parsed:k}),y(!0))}}),()=>{f.destroy()}},[n,a,o]),h.useEffect(()=>{console.log("🟡 [useEffect] form 값 변경 감지:",{startFormValue:O,endFormValue:B,formValue:M});const f=O??(Array.isArray(M)?M[0]:null),j=B??(Array.isArray(M)?M[1]:null);if(f===void 0&&j===void 0&&(!M||!Array.isArray(M))){b([null,null]);return}const D=I=>{if(!I)return null;let V=null;if(typeof I=="string"&&I.length===d.length&&/^\d+$/.test(I))if(t==="date"){const U=I.substring(0,4),H=I.substring(4,6),ne=I.substring(6,8);V=v(`${U}-${H}-${ne}`,n,!0)}else if(t==="month"){const U=I.substring(0,4),H=I.substring(4,6);V=v(`${U}-${H}`,n,!0)}else t==="year"&&(V=v(I,n,!0));else V=v(I,n,!0);return V&&V.isValid()?V:null},k=D(f),z=D(j);if(console.log("🟡 [useEffect] 파싱 결과:",{startParsed:k?k.format(n):null,endParsed:z?z.format(n):null,isStartDateFromPicker:P}),b([k,z]),R.current){console.log("🟡 [useEffect] 사용자 입력 중 - 마스크 값 업데이트 스킵"),y(!1);return}if(!P&&i.current){const I=i.current.value||"",V=k?k.format(n):"",U=i.current.unmaskedValue||"",H=k?k.format(d):"";console.log("🟡 [useEffect] 시작일 마스크 값 체크:",{currentMaskValue:I,expectedMaskValue:V,unmaskedValue:U,expectedUnmasked:H,shouldUpdate:I===""||I!==V,canUpdate:U===""||U===H}),(I===""||I!==V)&&(U===""||U===H?(console.log("🟡 [useEffect] 시작일 마스크 값 업데이트:",{before:I,after:k?k.format(n):""}),k?(i.current.value=k.format(n),i.current.updateValue()):(i.current.value="",i.current.updateValue())):console.log("🟡 [useEffect] 시작일 마스크 값 업데이트 스킵 (사용자 입력 중)"))}if(u.current){const I=u.current.value||"",V=z?z.format(n):"",U=u.current.unmaskedValue||"",H=z?z.format(d):"";console.log("🟡 [useEffect] 종료일 마스크 값 체크:",{currentMaskValue:I,expectedMaskValue:V,unmaskedValue:U,expectedUnmasked:H,shouldUpdate:I===""||I!==V,canUpdate:U===""||U===H}),(I===""||I!==V)&&(U===""||U===H?(console.log("🟡 [useEffect] 종료일 마스크 값 업데이트:",{before:I,after:V}),z?(u.current.value=z.format(n),u.current.updateValue()):(u.current.value="",u.current.updateValue())):console.log("🟡 [useEffect] 종료일 마스크 값 업데이트 스킵 (사용자 입력 중)"))}y(!1)},[O,B,M,n,d,t]);const X=f=>{if(console.log("🔴 [RangePicker] 날짜 변경:",{dates:f?[f[0]?f[0].format(n):null,f[1]?f[1].format(n):null]:null,prevRange:[S[0]?S[0].format(n):null,S[1]?S[1].format(n):null]}),!f){b([null,null]);const V=Array.isArray(o)?[...o,0]:[o,0],U=Array.isArray(o)?[...o,1]:[o,1];x.setFieldValue(V,void 0),x.setFieldValue(U,void 0),i.current?.updateValue(),u.current?.updateValue();return}const[j,D]=f,k=S[0],z=j&&(!k||!j.isSame(k,t==="year"?"year":t==="month"?"month":"day"));if(console.log("🔴 [RangePicker] 시작일 변경 여부:",{isStartDateChanged:z,startDate:j?j.format(n):null,prevStartDate:k?k.format(n):null}),b([j,D]),z){console.log("🔴 [RangePicker] 시작일 선택됨 - input 비우기"),L(!0),i.current&&(i.current.value="",i.current.updateValue());const V=j.format(d);console.log("🔴 [RangePicker] form 값 업데이트:",{formatted:V});const U=Array.isArray(o)?[...o,0]:[o,0];x.setFieldValue(U,V)}else if(!j&&i.current){L(!1),i.current.value="",i.current.updateValue();const V=Array.isArray(o)?[...o,0]:[o,0];x.setFieldValue(V,void 0)}else L(!1);const I=Array.isArray(o)?[...o,1]:[o,1];if(D){const V=D.format(d);x.setFieldValue(I,V),u.current&&(u.current.value=D.format(n),u.current.updateValue())}else x.setFieldValue(I,void 0),u.current&&(u.current.value="",u.current.updateValue());y(!1)},q=f=>{setTimeout(()=>{const j=document.activeElement,D=F.current,k=D?.querySelector(".ant-picker-dropdown");!(D&&(D.contains(j)||D===j||k?.contains(j)))&&!(f!==void 0?f:w)&&(console.log("✅ Input과 RangePicker 모두 포커스가 없습니다"),C(!1))},0)};return e.jsx(T,{...r,name:void 0,validateStatus:A?"warning":void 0,children:e.jsxs(s.ConfigProvider,{componentSize:_.componentSize,theme:{components:{Input:{addonBg:"#fff"}}},children:[e.jsxs("div",{ref:F,style:{display:"flex",alignItems:"center",gap:"8px",width:"100%"},children:[e.jsx(s.Form.Item,{name:o?Array.isArray(o)?[...o,0]:[o,0]:void 0,getValueProps:f=>{if(!f)return{value:void 0};if(typeof f=="string"&&f.length===d.length&&/^\d+$/.test(f)){if(t==="date"){const j=f.substring(0,4),D=f.substring(4,6),k=f.substring(6,8);return{value:`${j}-${D}-${k}`}}else if(t==="month"){const j=f.substring(0,4),D=f.substring(4,6);return{value:`${j}-${D}`}}else if(t==="year")return{value:f}}return{value:v(f).format(n)}},normalize:f=>f?v(f).format(d):(l?.allowEmpty,void 0),noStyle:!0,rules:r?.rules??[],children:e.jsx(s.Input,{...m,value:void 0,ref:c,onFocus:()=>{if(p("start"),C(!w),L(!1),i.current){const f=Array.isArray(o)?[...o,0]:[o,0];x.getFieldValue(f)||(i.current.value="",i.current.unmaskedValue=""),i.current.updateValue()}},onBlur:()=>{q()},onKeyDown:f=>{if(f.key==="Backspace"&&(p("start"),C(!0)),f.key==="Enter")if(w&&E==="start"){const j=i.current?.value||"";j.length===n.length?v(j,n,!0).isValid()?(C(!1),y(!1)):l?.allowEmpty?y(!1):y(!0):y(!1)}else p("start"),C(!0)},style:{flex:1},allowClear:!0,placeholder:a.replace(/0/g,"_"),suffix:e.jsx(Y.CalendarOutlined,{style:{color:"#d9d9d9"}}),autoComplete:"off"})}),e.jsx("span",{style:{color:"#d9d9d9",userSelect:"none"},children:"~"}),e.jsx(s.Form.Item,{name:o?Array.isArray(o)?[...o,1]:[o,1]:void 0,getValueProps:f=>{if(!f)return{value:void 0};if(typeof f=="string"&&f.length===d.length&&/^\d+$/.test(f)){if(t==="date"){const j=f.substring(0,4),D=f.substring(4,6),k=f.substring(6,8);return{value:`${j}-${D}-${k}`}}else if(t==="month"){const j=f.substring(0,4),D=f.substring(4,6);return{value:`${j}-${D}`}}else if(t==="year")return{value:f}}return{value:v(f).format(n)}},normalize:f=>f?v(f).format(d):(l?.allowEmpty,void 0),noStyle:!0,rules:r?.rules??[],children:e.jsx(s.Input,{...m,ref:g,onFocus:()=>{if(p("end"),C(!w),u.current){u.current.updateValue();const f=u.current.value||"";!(u.current.unmaskedValue||"")&&!f.replace(/[^0-9]/g,"")&&(u.current.value="",u.current.updateValue())}},onBlur:()=>{q()},onKeyDown:f=>{if(f.key==="Backspace"){const j=u.current?.value||"",D=u.current?.unmaskedValue||"";if(j===""||D===""||j.replace(/[^0-9]/g,"").length<=1){f.preventDefault();const k=Array.isArray(o)?[...o,1]:[o,1];x.setFieldValue(k,void 0),b([S[0],null]),u.current&&(u.current.value="",u.current.updateValue()),setTimeout(()=>{c.current?.focus(),p("start"),C(!0)},0);return}p("end"),C(!0)}if(f.key==="Tab"&&C(!1),f.key==="Enter")if(w&&E==="end"){const j=u.current?.value||"";j.length===n.length?v(j,n,!0).isValid()?(C(!1),y(!1)):l?.allowEmpty?y(!1):y(!0):y(!1)}else p("end"),C(!0)},style:{flex:1},allowClear:!0,onClear:()=>{const f=Array.isArray(o)?[...o,1]:[o,1];x.setFieldValue(f,void 0),b([S[0],null]),u.current&&(u.current.value="",u.current.updateValue()),setTimeout(()=>{c.current?.focus(),p("start"),C(!0)},0)},placeholder:a.replace(/0/g,"_"),suffix:e.jsx(Y.CalendarOutlined,{style:{color:"#d9d9d9"}}),autoComplete:"off"})})]}),e.jsx(Ee,{...l,open:w,picker:t,format:{format:n,type:"mask"},showNow:!0,value:S,onChange:X,onOpenChange:f=>{C(f),f||q(!1)},renderExtraFooter:()=>A?e.jsxs("div",{style:{color:"#faad14",paddingLeft:"8px",fontSize:"12px",display:"flex",alignItems:"center",gap:"6px",borderTop:"1px solid #f0f0f0",backgroundColor:"#fffbe6"},children:[e.jsx(Y.ExclamationCircleOutlined,{}),e.jsx("span",{children:"유효하지 않은 날짜입니다"})]}):null,getPopupContainer:f=>f.parentElement,style:{position:"absolute",top:0,left:0,pointerEvents:"none",opacity:0,width:"100%"}})]})})},{Option:se}=s.Select,Ve=({itemProps:t,inputProps:r})=>{const[m,l]=h.useState([]);return h.useEffect(()=>{r?.addField==="ALL"?l([{label:"전체",value:""},...r?.list||[]]):r?.addField==="NULL"?l([{label:"",value:""},...r?.list||[]]):l(r?.list||[])},[r?.list]),e.jsx(T,{...t,getValueProps:n=>n?{value:n&&n.indexOf(",")>0?n.split(","):[n]}:{value:[]},normalize:n=>n!=null&&n!=null&&n.length>0?n.toString():"",children:e.jsx(s.Select,{...r,mode:"multiple",children:m.map(n=>{const{value:a,label:d}=n;return r?.printCode?e.jsx(se,{value:a,label:d,children:e.jsx(s.Space,{children:`[${a}] ${d}`})},a):e.jsx(se,{value:a,label:d,children:e.jsx(s.Space,{children:`${d}`})},a)})})})},ve=({itemProps:t,inputProps:r})=>{const m=n=>{let a=n.toString().split(".");return r?.decimalPoint!=null&&a[1]!=null&&r?.decimalPoint>0?a[1].length>r?.decimalPoint?a[1]="."+a[1].substring(0,r?.decimalPoint):a[1]="."+a[1]:a[1]="",a[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")+a[1]},l=n=>{let a=n.toString().split(".");return r?.decimalPoint!=null&&a[1]!=null&&r?.decimalPoint>0?a[1].length>r?.decimalPoint?a[1]="."+a[1].substring(0,r?.decimalPoint):a[1]="."+a[1]:a[1]="",a[0].replace(/\$\s?|(,*)/g,"")+a[1]};return e.jsx(T,{...t,children:e.jsx(s.InputNumber,{...r,formatter:n=>m(n),parser:n=>l(n)})})},Ne=({itemProps:t,inputProps:r})=>e.jsx(T,{...t,children:e.jsx(s.Radio.Group,{...r})}),{RangePicker:Le}=s.DatePicker,ae={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"}},Be=({itemProps:t,inputProps:r,type:m="date",minDate:l,maxDate:n,returnType:a="string"})=>{const{displayFormat:d,outputFormat:c}=h.useMemo(()=>ae[m],[m]),g=h.useMemo(()=>Object.values(ae).map(i=>i.outputFormat).sort((i,u)=>{if(i.length===u.length){if(i===c)return-1;if(u===c)return 1}return u.length-i.length}),[c]);return e.jsx(T,{...t,getValueProps:i=>({value:i&&i.length>0?[i[0]?v.isDayjs(i[0])?i[0]:v(i[0],g):null,i[1]?v.isDayjs(i[1])?i[1]:v(i[1],g):null]:null}),normalize:i=>i?a==="dayjs"?[i[0]??void 0,i[1]??void 0]:[i[0]?i[0].format(c):void 0,i[1]?i[1].format(c):void 0]:[void 0,void 0],children:e.jsx(Le,{...r,order:!0,minDate:l?v(l,g):void 0,maxDate:n?v(n,g):void 0,picker:m==="datetime"?"date":m,showTime:r?.showTime??(m==="datetime"||m==="time"),format:d})})},oe=s.Input.Search,Me=t=>{const r=s.Form.useFormInstance(),{openPopup:m}=ie.usePopupStore(),l=t.itemProps?.name||[],n=t.popupConfig||{callback(d){Array.isArray(l)&&l.length>1?(r.setFieldValue(l[0],d.code),r.setFieldValue(l[1],d.name)):r.setFieldValue(l,d.code)}},a={...t,placeholder:typeof t.placeholder=="string"?t.placeholder:t.placeholder?.[0]||"",onChange:d=>{Array.isArray(l)&&l.length>1&&r.setFieldValue(l[0],""),t.onChange?.(d)},onSearch:d=>{t.popuCd?m(t.popuCd,t.popupParams,n):t.onSearch?.(d)}};return Array.isArray(l)&&l.length>1?e.jsx(T,{...t.itemProps,name:void 0,children:e.jsxs(s.Space.Compact,{block:!0,children:[e.jsx(s.Form.Item,{name:l[0],rules:t.itemProps?.rules,style:{width:"40%",marginBottom:0,marginInlineEnd:0},validateStatus:"",help:"",children:e.jsx(s.Input,{style:{color:"#999",backgroundColor:"#f5f5f5"},placeholder:t.placeholder?.[0]||"",readOnly:!0})}),e.jsx(s.Form.Item,{name:l[1],style:{width:"60%",marginBottom:0},children:e.jsx(oe,{readOnly:t.readOnly,enterButton:e.jsx(s.Button,{icon:e.jsx(Y.SearchOutlined,{}),disabled:t.readOnly}),...a})})]})}):e.jsx(T,{...t.itemProps,children:e.jsx(oe,{...a})})},Ae=({itemProps:t,selectProps:r={options:[],allowClear:!0}})=>{const m=s.Form.useFormInstance(),l=!!m,n=h.useMemo(()=>r?.addField==="ALL"?[{label:"전체",value:""},...r?.options||[]]:r?.addField==="NULL"?[{label:"",value:""},...r?.options||[]]:r?.options||[],[r.options,r.addField]),a=g=>{r.onChange?.(g)},d={...r,allowClear:r.allowClear??!0,options:n,onChange:a,variant:r.variant},c=e.jsx(s.Select,{...d,disabled:r.disabled});return r.copyable&&!l&&console.warn("BwgSelect: copyable 기능은 Form 컨텍스트 내에서만 사용 가능합니다."),r.copyable?e.jsx(T,{...t,name:void 0,children:e.jsxs(s.Space.Compact,{block:!0,children:[e.jsx(s.Form.Item,{name:t?.name,rules:t?.rules,style:{width:"100%",marginBottom:0},validateStatus:"",help:"",children:c}),e.jsx(s.Typography.Paragraph,{copyable:{text:l&&m?.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"}})]})}):e.jsx(T,{...t,children:c})},Oe=({itemProps:t,inputProps:r={format:"YN"}})=>{const m=s.Form.useFormInstance(),l=(n,a)=>{r.format==="boolean"?m.setFieldValue(t?.name,n):m.setFieldValue(t?.name,n?"Y":"N"),r.onChange&&r.onChange(n,a)};return e.jsx(T,{...t,getValueProps:n=>({checked:r.format==="boolean"?!!n:n==="Y"}),normalize:n=>typeof n=="boolean"?r.format==="boolean"?n:n?"Y":"N":r.format==="boolean"?!!n:n?"Y":"N",children:e.jsx(s.Switch,{...r,onChange:(n,a)=>l(n,a)})})},{TextArea:Ue}=s.Input,Te=({itemProps:t,inputProps:r})=>e.jsx(T,{...t,children:e.jsx(Ue,{...r})}),Re=s.Input.Search,Pe=t=>{const r=s.Form.useFormInstance(),{openCorePopup:m}=G.usePopup(),l={value:"deptNm",fieldName:"deptNm",placeholder:"부서명"},n={value:"empNm",fieldName:"empNm",placeholder:"사원명 입력"},a=t.field1||l,d=t.field2||n,c=h.useCallback(u=>{r.setFieldValue(t.employeeFieldName||"employee",u),r.setFieldValue(t.empNoFieldName||"empNo",u.empNo??""),r.setFieldValue(a.fieldName,u[a.value||"deptNm"]??""),r.setFieldValue(d.fieldName,u[d.value||"empNm"]??""),t.onFinish?.()},[r,a,d,t.employeeFieldName]),g=h.useCallback(u=>{m("CORE_ORGANIZATION_01",{onSelect:F=>{c(F)},defaultParams:{keyword:u}})},[c,m]),i=h.useCallback(async u=>{const F=u?.trim();if(F)try{const x=await $.callService("SCMUTIL00101",{keyword:F},{showLoading:!1}),w=x?.empList||[];if(x?.empCnt===0){s.message.warning("일치하는 사원을 찾을 수 없어 팝업을 열립니다. 사원을 선택해주세요."),g();return}if(x?.empCnt>1){s.message.info("여러 건이 검색되어 팝업이 열립니다. 사원을 선택해주세요."),g(F);return}const C=w[0];c(C)}catch(x){console.error("사원 검색 서비스 실패:",x),s.message.error("사원 검색 중 오류가 발생했습니다.")}},[c,g]);return e.jsx(T,{label:t.label||"사원",name:void 0,children:e.jsxs(s.Space.Compact,{block:!0,children:[e.jsx(s.Form.Item,{name:a.fieldName,style:{width:"40%",marginBottom:0,marginInlineEnd:0},validateStatus:"",help:"",children:e.jsx(s.Input,{style:{color:"#999",backgroundColor:"#f5f5f5"},placeholder:a.placeholder,readOnly:!0})}),e.jsx(s.Form.Item,{name:t.employeeFieldName||"employee",hidden:!0}),e.jsx(s.Form.Item,{name:t.empNoFieldName||"empNo",hidden:!0}),e.jsx(s.Form.Item,{name:d.fieldName,style:{width:"60%",marginBottom:0},children:e.jsx(Re,{allowClear:!0,readOnly:t.readOnly,placeholder:d.placeholder,enterButton:e.jsx(s.Button,{icon:e.jsx(Y.SearchOutlined,{}),disabled:t.readOnly,onClick:()=>{g()}}),onSearch:i,onChange:u=>{r.setFieldValue(a.fieldName,""),r.setFieldValue(t.employeeFieldName||"employee",null),r.setFieldValue(t.empNoFieldName||"empNo","")}})})]})})},{Text:le}=s.Typography,N={IDLE:"idle",UPLOADING:"uploading",UPLOADED:"uploaded",EXECUTING:"executing",COMPLETED:"completed",FAILED:"failed"},_e={[N.IDLE]:"엑셀 파일을 선택해 업로드 해 주세요. (xlsx, xls, csv만 가능)",[N.UPLOADING]:"엑셀 업로드 중입니다. 잠시만 기다려 주세요.",[N.UPLOADED]:"엑셀 업로드가 완료되었습니다.",[N.EXECUTING]:"배치 작업 실행 중입니다. 잠시만 기다려 주세요.",[N.COMPLETED]:"배치 작업이 완료되었습니다.",[N.FAILED]:"배치 작업이 실패했습니다."},ze=({label:t="엑셀 업로드",jobId:r,extraParams:m,onFinish:l,disabled:n=!1})=>{const[a,d]=h.useState(N.IDLE),[c,g]=h.useState(null),[i,u]=h.useState(null),F=h.useCallback(async()=>{if(!(!c||!i)){if(!r){s.message.warning("실행 job id(jobId)가 설정되어 있지 않습니다.");return}try{if(!i.filePath){s.message.error("파일 URL 정보가 없습니다.");return}d(N.EXECUTING);const y={crprCd:$.getCrprCd(),sysCd:window.__SYS_CD__||"",fileKey:i.fileKey,filePath:i.filePath,jobId:r},E=await $.callService("SCMUTIL00301",{...y,...m});E?.success?(x(),s.message.success(E?.message||"배치 실행 요청이 성공적으로 완료되었습니다.")):(d(N.FAILED),s.message.error(E?.message||"배치 실행 요청에 실패했습니다."))}catch(y){console.error("배치 실행 요청에 실패했습니다.",y),s.message.error("배치 실행 요청에 실패했습니다."),d(N.FAILED)}}},[c,i,r,m]),x=h.useCallback(async()=>{setTimeout(async()=>{try{const y=await $.callService("SCMUTIL00302",{jobId:r});if(y?.status==="COMPLETED"){d(N.COMPLETED),s.message.success("배치 작업이 완료되었습니다."),l?.();return}else if(y?.status==="FAILED"){d(N.FAILED),s.message.error("배치 작업이 실패했습니다.");return}else{setTimeout(x,1e3);return}}catch(y){console.error("배치 작업 상태 확인 오류:",y),d(N.FAILED),s.message.error("배치 작업 상태 확인 중 오류가 발생했습니다.")}},3e3)},[r,l]),w=h.useMemo(()=>({name:"file",accept:".xlsx, .xls, .csv",listType:"picture",multiple:!1,action:"/api/upload",showUploadList:{showRemoveIcon:!0},beforeUpload:y=>{const E=`.${y.name.split(".").pop()?.toLowerCase()}`;if(![".xlsx",".xls",".csv"].includes(E))return s.message.error(`${y.name} 파일은 허용되지 않는 확장자입니다. (xlsx, xls, csv만 가능)`),s.Upload.LIST_IGNORE},onChange:y=>{const{status:E}=y.file;if(E==="removed"){g(null),d(N.IDLE),u(null);return}if(g(y.file),E==="uploading"){d(N.UPLOADING);return}if(E==="done"){if(y.file.response?.success){d(N.UPLOADED);const p=y.file.response.uploadedFiles[0]||{};u({fileKey:p.fileKey,filePath:p.filePath,fileNameL:p.fileNameL,fileNameP:p.fileNameP,fileSize:p.fileSize,fileExt:p.fileExt})}else d(N.IDLE),s.message.error(y.file.response?.message||`${y.file.name} 파일 업로드에 실패했습니다.`);return}E==="error"&&(d(N.IDLE),s.message.error(y.file.response?.message||`${y.file.name} 파일 업로드 중 오류가 발생했습니다.`))}}),[]),C=h.useMemo(()=>e.jsxs(s.Space,{direction:"vertical",style:{width:400},children:[e.jsxs(s.Space,{children:[a===N.EXECUTING&&e.jsx(s.Spin,{size:"small"}),e.jsx(le,{type:a===N.FAILED?"danger":"secondary",children:_e[a]})]}),a!==N.EXECUTING&&a!==N.COMPLETED&&a!==N.FAILED&&e.jsx(s.Upload,{...w,children:!c&&e.jsx(W,{icon:e.jsx(Y.UploadOutlined,{}),children:"파일 선택"})}),a===N.UPLOADED&&e.jsx(s.Space,{direction:"vertical",children:e.jsx(s.Space,{children:e.jsx(W,{type:"primary",icon:e.jsx(Y.PlayCircleOutlined,{}),onClick:F,disabled:!c,children:"실행하기"})})}),(a===N.COMPLETED||a===N.FAILED)&&e.jsx(s.Space,{direction:"vertical",children:e.jsxs(s.Space,{children:[e.jsx(W,{icon:e.jsx(Y.RedoOutlined,{}),onClick:F,children:"다시 실행하기"}),e.jsx(W,{icon:e.jsx(Y.UploadOutlined,{}),onClick:()=>{d(N.IDLE),g(null),u(null)},children:"다른 파일 업로드"})]})})]}),[a,c,F,w]),A=e.jsx(W,{icon:e.jsx(Y.UploadOutlined,{}),disabled:n,children:t});if(n){const y=e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(Y.ExclamationCircleFilled,{style:{color:"#faad14",fontSize:16}}),e.jsx("span",{style:{fontWeight:600},children:"'엑셀 업로드' 버튼에 대한 사용 권한이 없습니다."})]}),E=e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4,paddingLeft:24},children:e.jsx("span",{style:{fontSize:12},children:"관리자에게 문의하세요."})});return e.jsx(s.Popover,{title:y,content:E,placement:"bottom",styles:{body:{backgroundColor:"#fffbe6"}},children:e.jsx("span",{children:A})})}return e.jsx(s.Popover,{content:C,title:e.jsx("div",{style:{display:"flex",alignItems:"center",marginBottom:0},children:e.jsx(le,{strong:!0,children:"엑셀 업로드"})}),trigger:"click",placement:"bottom",children:A})},$e=s.Input.Search,He=t=>{const r=s.Form.useFormInstance(),{openCorePopup:m}=G.usePopup(),l={value:"deptNm",fieldName:"deptNm",placeholder:"부서명"},n=t.field||l,a=h.useCallback(g=>{r.setFieldValue(t.departmentFieldName||"department",g),r.setFieldValue(n.fieldName,g[n.value||"deptNm"]??""),r.setFieldValue(t.deptCdFieldName||"deptCd",g.deptCd??""),t.onFinish?.()},[r,n,t.departmentFieldName,t.deptCdFieldName]),d=h.useCallback(g=>{m("CORE_DEPARTMENT_01",{onSelect:i=>{a(i)},defaultParams:{keyword:g}})},[a,m]),c=h.useCallback(async g=>{const i=g?.trim();if(i)try{const u=await $.callService("SCMUTIL00103",{keyword:i},{showLoading:!1}),F=u?.deptCnt??0,x=u?.deptList||[];if(F===0||x.length===0){s.message.warning("일치하는 부서를 찾을 수 없어 팝업을 열립니다. 부서를 선택해주세요."),d(i);return}if(F>1||x.length>1){s.message.info("여러 건이 검색되어 팝업이 열립니다. 부서를 선택해주세요."),d(i);return}const w=x[0];a(w)}catch(u){console.error("부서 검색 서비스 실패:",u),s.message.error("부서 검색 중 오류가 발생했습니다.")}},[a,d]);return e.jsx(T,{label:t.label||"부서",name:void 0,children:e.jsxs(s.Space.Compact,{block:!0,children:[e.jsx(s.Form.Item,{name:t.deptCdFieldName||"deptCd",style:{width:"40%",marginBottom:0,marginInlineEnd:0},validateStatus:"",help:"",children:e.jsx(s.Input,{style:{color:"#999",backgroundColor:"#f5f5f5"},placeholder:"부서코드",readOnly:!0})}),e.jsx(s.Form.Item,{name:t.departmentFieldName||"department",hidden:!0}),e.jsx(s.Form.Item,{name:n.fieldName,style:{width:"60%",marginBottom:0},children:e.jsx($e,{allowClear:!0,readOnly:t.readOnly,placeholder:n.placeholder,enterButton:e.jsx(s.Button,{icon:e.jsx(Y.SearchOutlined,{}),disabled:t.readOnly,onClick:()=>{d()}}),onSearch:c,onChange:g=>{r.setFieldValue(t.deptCdFieldName||"deptCd",""),r.setFieldValue(t.departmentFieldName||"department",null)}})})]})})},de=({originNode:t,file:r,fileList:m,moveFile:l,onDrop:n})=>{const a=h.useRef(null),[{handlerId:d},c]=Z.useDrop({accept:"file",collect:F=>({handlerId:F.getHandlerId()}),hover(F,x){if(!a.current)return;const w=F.uid,C=r.uid;if(w===C)return;const A=Q.findIndex(m,{uid:C}),y=Q.findIndex(m,{uid:w});if(y===-1||A===-1)return;const E=a.current.getBoundingClientRect(),p=x.getClientOffset();if(!p)return;const P=(E.bottom-E.top)/2,L=p.y-E.top;y<A&&L<P||y>A&&L>P||l(w,C)},drop(){n()}}),[{isDragging:g},i]=Z.useDrag({type:"file",item:()=>({uid:r.uid,index:Q.findIndex(m,{uid:r.uid})}),collect:F=>({isDragging:F.isDragging()})}),u=g?0:1;return i(c(a)),e.jsx("div",{ref:a,style:{opacity:u},"data-handler-id":d,children:t})},ee=(t,r,m,l,n)=>{const a=m[0]?.uid===r.uid,d=h.cloneElement(t,{href:r.url||void 0,title:void 0});return e.jsxs(e.Fragment,{children:[a&&e.jsxs("div",{style:{fontSize:12,color:"var(--text-secondary, #666)",marginBottom:4},children:["총 ",m.length,"건"]}),e.jsx(de,{originNode:d,file:r,fileList:m,moveFile:l,onDrop:n})]})},te=(t,r)=>{const m=String(r||"");return m.startsWith("picture")?t.name.endsWith(".pdf")?e.jsx(Y.FilePdfTwoTone,{}):t.name.endsWith(".docx")||t.name.endsWith(".doc")?e.jsx(Y.FileWordTwoTone,{}):t.name.endsWith(".xlsx")||t.name.endsWith(".xls")?e.jsx(Y.FileExcelTwoTone,{}):t.name.endsWith(".pptx")||t.name.endsWith(".ppt")?e.jsx(Y.FilePptTwoTone,{}):e.jsx(Y.FileTwoTone,{}):m.startsWith("text")?e.jsx(Y.LinkOutlined,{}):e.jsx(Y.FileOutlined,{})},qe=({listType:t="picture",buttonText:r="파일 선택",permissions:m,multiple:l=!1,fileGrpKey:n,uploadProps:a,heights:d,...c})=>{const{defaultUploadProps:g,fileList:i,fetchFileList:u,reorderFiles:F,saveFileOrder:x}=G.useFileUploader({multiple:l,fileGrpKey:n,...c});h.useEffect(()=>{n&&u()},[n]);const w=!!m?.fileAdd,C={...g,listType:t,styles:{root:{height:d?.root},list:{height:d?.list}},iconRender:te,itemRender(A,y,E){return ee(A,y,E,F,x)},...a};return e.jsx(Z.DndProvider,{backend:ce.HTML5Backend,children:e.jsx(s.Upload,{headers:{SYSCD:__SYS_CD__},style:{height:d?.root},...C,children:w&&l||(w&&!l||i.length===0)&&e.jsx(s.Button,{icon:e.jsx(Y.UploadOutlined,{}),children:r})})})},We=({listType:t="picture",permissions:r,multiple:m=!1,fileGrpKey:l,uploadProps:n,heights:a,...d})=>{const{defaultUploadProps:c,fetchFileList:g,reorderFiles:i,saveFileOrder:u}=G.useFileUploader({multiple:m,fileGrpKey:l,...d}),F={...c,listType:t,iconRender:te,itemRender(x,w,C){return ee(x,w,C,i,u)},...n};return h.useEffect(()=>{l&&g()},[l]),e.jsx(Z.DndProvider,{backend:ce.HTML5Backend,children:e.jsxs(fe,{style:{marginBottom:10},height:a?.dragger||100,...F,children:[e.jsx("p",{className:"ant-upload-drag-icon",style:{marginBottom:10},children:e.jsx(Y.InboxOutlined,{style:{fontSize:25}})}),e.jsx("p",{className:"ant-upload-hint",children:"첨부할 파일을 여기에 끌어다 놓거나, 영역을 클릭하여 파일을 직접 선택해주세요."})]})})};exports.BwgButton=W;exports.BwgCheck=ge;exports.BwgCheckList=he;exports.BwgDatePicker=pe;exports.BwgDeptSearch=He;exports.BwgDownload=xe;exports.BwgDraggerUploader=We;exports.BwgEmpSearch=Pe;exports.BwgForm=ue;exports.BwgFormItem=T;exports.BwgInput=ye;exports.BwgLargeUploader=Se;exports.BwgMaskedDate=Ie;exports.BwgMaskedInput=we;exports.BwgMaskedRange=Ye;exports.BwgMultiSelect=Ve;exports.BwgNumber=ve;exports.BwgRadio=Ne;exports.BwgRangePicker=Be;exports.BwgSearch=Me;exports.BwgSelect=Ae;exports.BwgSwitch=Oe;exports.BwgTextArea=Te;exports.BwgUploader=qe;exports.BwgXlsxUploader=ze;exports.DraggableUploadListItem=de;exports.defaultIconRender=te;exports.defaultItemRender=ee;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("antd"),h=require("react"),de=require("../../stores/index.cjs"),v=require("dayjs"),I=require("@ant-design/icons"),G=require("../../utils/index.cjs"),ge=require("jszip"),Z=require("imask"),X=require("../../chunks/provider-DrmM0H4o.cjs"),ee=require("lodash"),Q=require("react-dnd"),ue=require("react-dnd-html5-backend"),pe=require("antd/es/upload/Dragger"),W=t=>{const{componentSize:r}=de.useUserStore(),m=h.useMemo(()=>t.size?t.size:{0:"small",1:"middle",2:"large"}[r],[r,t.size]),o=h.useMemo(()=>({0:12,1:14,2:16})[r],[r]);return e.jsx(n.Button,{...t,size:m,className:"bwg-btn",style:{fontSize:`${o}px`,...t.style},children:t.children})},_=h.memo(({children:t,label:r,name:m,rules:o,initialValue:s,style:a,required:c,...d})=>{const p={fontWeight:"bold"};(o==null||o==null)&&c&&(o=[{required:!0,message:`${r}을(를) 입력해주세요.`}]);const i=Array.isArray(o)&&o.some(j=>j.required===!0),u=()=>typeof r=="string"?e.jsxs("span",{style:p,children:[r,i&&e.jsx("span",{style:{color:"#ff4d4f",marginLeft:"4px"},children:"*"})]}):e.jsx("span",{style:p,children:r});return e.jsx(n.Form.Item,{className:"bwg-form-item",label:r?u():void 0,labelAlign:d.labelAlign||"left",name:m,rules:o,colon:!1,initialValue:s,style:a,...d,children:t})}),he=({itemProps:t,inputProps:r={format:"YN"}})=>{const m=n.Form.useFormInstance(),o=s=>{r.format==="boolean"?m.setFieldValue(t?.name,s.target.checked):m.setFieldValue(t?.name,s.target.checked?"Y":"N"),r.onChange&&r.onChange(s)};return e.jsx(_,{...t,getValueProps:s=>({checked:r.format==="boolean"?!!s:s==="Y"}),normalize:s=>typeof s=="boolean"?r.format==="boolean"?s:s?"Y":"N":r.format==="boolean"?!!s:s?"Y":"N",children:e.jsx(n.Checkbox,{...r,onChange:o,children:r?.title})})},xe=({itemProps:t,inputProps:r})=>{const m=n.Form.useFormInstance(),[o,s]=h.useState(t?.initialValue??[]),[a,c]=h.useState([]),d=a.length>0&&a.length==o?.length,p=o?.length>0&&o.length<a.length;h.useEffect(()=>{c(i(r?.options))},[r?.options]),h.useEffect(()=>{s(o)},[o]);const i=x=>{const w=[];return(x||[]).map((F,M)=>{w.push(F.value)}),w},u=x=>{s(x.target.checked?a:[]),m.setFieldValue(t?.name,x.target.checked?a:[])},j=x=>{s(x),m.setFieldValue(t?.name,x),r?.onChange&&typeof r?.onChange=="function"&&r?.onChange(x)};return e.jsx(_,{...t,children:e.jsxs(n.ConfigProvider,{theme:{components:{Checkbox:{colorPrimary:"var(--check-primary)",colorPrimaryBorder:"var(--check-primary)",colorPrimaryHover:"var(--check-primary-active)"}}},children:[r?.allCheck&&e.jsx(n.Checkbox,{indeterminate:p,checked:d,onChange:u,children:"전체선택"}),e.jsx(n.Checkbox.Group,{options:r?.options,value:o,onChange:j})]})})},se={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"}},ye=({itemProps:t,inputProps:r,type:m="date",returnType:o="string"})=>{const{displayFormat:s,outputFormat:a}=h.useMemo(()=>se[m],[m]),c=h.useMemo(()=>Object.values(se).map(d=>d.outputFormat).sort((d,p)=>{if(d.length===p.length){if(d===a)return-1;if(p===a)return 1}return p.length-d.length}),[a]);return e.jsx(_,{...t,getValueProps:d=>({value:d?v.isDayjs(d)?d:v(d,c):null}),normalize:d=>d?o==="dayjs"?d:d.format(a):null,children:e.jsx(n.DatePicker,{...r,picker:m==="datetime"?"date":m,showTime:r?.showTime??(m==="datetime"||m==="time"),format:r?.format??s})})},je=({fileGrpKey:t,onFetchFilesTrxCd:r="SCMFILE00101",readOnly:m=!1,appCd:o=__APP_CD__})=>{const[s,a]=h.useState([]);h.useEffect(()=>{if(r)if(o!=__APP_CD__){const p=G.getApiDeps().findSystemByAppCd?.(o??__APP_CD__);if(!p||!p.sysCd){console.error("해당 앱코드는 존재하지 않습니다.",o);return}G.callServiceByAppCd({trxCd:r,appCd:o},{crprCd:G.getCrprCd(),sysCd:p.sysCd,fileGrpKey:t}).then(i=>{if(i?.sub){const u=i.sub.map(j=>({uid:j.fileKey,name:j.lgclFileNm,filePath:j.filePath}));a(u)}}).catch(i=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",i),n.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")})}else G.callService(r,{crprCd:G.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:t}).then(d=>{if(d?.sub){const p=d.sub.map(i=>({uid:i.fileKey,name:i.lgclFileNm,filePath:i.filePath}));a(p)}}).catch(d=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",d),n.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")});else a([])},[t,r,o]);const c=async d=>{try{const i=G.getApiDeps().findSystemByAppCd?.(o??__APP_CD__);if(!i||!i.sysCd){console.error("해당 앱코드는 존재하지 않습니다.",o);return}const j=await fetch("/api/download",{method:"POST",headers:{SYSCD:i.sysCd,"Content-Type":"application/json"},body:JSON.stringify({filePath:d.filePath,logicalName:d.name,fileKey:d.uid})});if(!j.ok){const y=(await j.json().catch(()=>null))?.message||"파일 다운로드에 실패했습니다.";throw new Error(y)}const x=await j.blob(),w=window.URL.createObjectURL(x),F=document.createElement("a");F.href=w,F.setAttribute("download",d.name),document.body.appendChild(F),F.click(),document.body.removeChild(F),window.URL.revokeObjectURL(w)}catch(p){console.error(p),n.message.error(p.message||"파일을 다운로드하는 중 오류가 발생했습니다.")}};return e.jsx(n.Card,{title:"파일 목록",children:e.jsx(n.List,{dataSource:s,renderItem:d=>e.jsx(n.List.Item,{actions:m?[]:[e.jsx(n.Button,{type:"text",icon:e.jsx(I.DownloadOutlined,{}),onClick:()=>c(d)},"download")],children:e.jsx(n.List.Item.Meta,{avatar:e.jsx(I.PaperClipOutlined,{}),title:d.name})})})})},me=h.forwardRef(({children:t,labelCol:r,style:m,className:o,...s},a)=>e.jsx(n.ConfigProvider,{form:{},children:e.jsx(n.Form,{ref:a,...s,requiredMark:!1,labelCol:r||{flex:"100px"},style:{padding:"10px",...m},className:`bwg-form ${o??""}`,children:t})}));me.displayName="BwgForm";const Fe=({itemProps:t,inputProps:r})=>e.jsx(_,{...t,children:e.jsx(n.Input,{...r})}),{Text:J}=n.Typography,{Dragger:Ce}=n.Upload,Se=[".pdf",".xlsx",".xls",".docx",".doc",".pptx",".ppt",".hwp",".txt",".csv",".jpg",".jpeg",".png",".gif",".zip"],Ee=(t,r=2)=>{if(t===0)return"0 Bytes";const m=1024,o=r<0?0:r,s=["Bytes","KB","MB","GB","TB"],a=Math.floor(Math.log(t)/Math.log(m));return parseFloat((t/Math.pow(m,a)).toFixed(o))+" "+s[a]},Ie=({title:t="첨부파일",fileGrpKey:r,onUploadComplete:m,onSuccessTrxCd:o="SCMFILE00102",anotherServiceTrxCd:s="SCMFILE00105",allowedExtensions:a=Se,maxFileSize:c=2048})=>{const[d,p]=h.useState([]),[i,u]=h.useState(!1),[j,x]=h.useState(!1),[w,F]=h.useState(0),M=f=>{if(a&&a.length>0){const Y=(T=>{const l=T.lastIndexOf(".");return l===-1?"":T.substring(l).toLowerCase()})(f.name);if(!a.includes(Y))return n.message.error(`${f.name} 파일은 허용되지 않는 확장자입니다. (${a.join(", ")}만 가능)`),!1}return!0},y=async()=>{const f=d.filter(E=>E.status!=="done"),O=f.reduce((E,D)=>E+(D.size||0),0),Y=2*1024*1024*1024;if(O>Y){n.notification.error({message:"업로드 용량 초과",description:"한 번에 업로드할 수 있는 총 파일 용량은 2GB를 초과할 수 없습니다."});return}if(f.length===0){n.message.warning("업로드할 파일이 없거나 모든 파일이 이미 업로드되었습니다.");return}x(!0);let T;try{const E=new ge;f.forEach(D=>{D.originFileObj&&E.file(D.name,D.originFileObj)}),T=await E.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:9}})}catch(E){x(!1),n.message.error("파일을 압축하는 중 오류가 발생했습니다."),console.error("Zipping error:",E);return}x(!1);const l=new FormData;l.append("file",T,"upload.zip"),u(!0),F(0);try{const E=await new Promise((P,B)=>{const U=new XMLHttpRequest;U.open("POST","/api/upload-large",!0),U.upload.onprogress=z=>{if(z.lengthComputable){const K=Math.round(z.loaded/z.total*100);F(K)}},U.onload=()=>{if(U.status>=200&&U.status<300)try{const z=JSON.parse(U.responseText);z.success?P(z):B(new Error(z.message||"파일 업로드에 실패했습니다."))}catch{B(new Error("잘못된 서버 응답입니다."))}else try{const z=JSON.parse(U.responseText);B(new Error(z.message||`서버 오류: ${U.status}`))}catch{B(new Error(`서버 오류: ${U.status}`))}},U.onerror=()=>{B(new Error("네트워크 오류가 발생했습니다."))},U.send(l)});n.message.success(E.message||"압축 파일이 성공적으로 업로드되었습니다.");const D=d.map(P=>f.find(B=>B.uid===P.uid)?{...P,status:"done"}:P);if(p(D),o&&E.uploadedFiles&&Array.isArray(E.uploadedFiles)){const P=G.getUserInfo();E.uploadedFiles.forEach(B=>{const U={crprCd:P?.crprCd,sysCd:__SYS_CD__,fileGrpKey:r,sub:[{crprCd:P?.crprCd,sysCd:__SYS_CD__,fileGrpKey:r,physFileNm:B.fileNameP,lgclFileNm:B.fileNameL,filePath:B.filePath,fileExtn:B.fileExt,fileSize:B.fileSize,mltpYn:"Y"}]};G.callService(o,U).then(z=>{const K=d.map(q=>({crprCd:P?.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}));G.callService(s,{sub:K})}).catch(z=>{console.error("후처리 서비스 호출 실패:",z),n.message.error(`${B.fileNameL} 파일의 후처리 작업에 실패했습니다.`)}),m&&m({fileNameP:B.fileNameP,fileNameL:B.fileNameL})})}}catch(E){n.message.error(E.message||"파일 업로드 중 오류가 발생했습니다.");const D=d.map(P=>f.find(B=>B.uid===P.uid)?{...P,status:"error",response:E.message||"파일 업로드 중 오류가 발생했습니다."}:P);p(D)}finally{u(!1)}},C={multiple:!0,fileList:d,beforeUpload:f=>M(f)?c&&f.size>=c*1024*1024?(n.message.error(`대용량 첨부 파일 최대 크기는 ${(c/1024).toFixed(1)}GB입니다.`),n.Upload.LIST_IGNORE):!1:n.Upload.LIST_IGNORE,onChange:({fileList:f})=>{const O=new Map(d.map(Y=>[Y.uid,Y]));f.forEach(Y=>{O.set(Y.uid,Y)}),p(Array.from(O.values()))},onRemove:f=>{const O=d.filter(Y=>Y.uid!==f.uid);p(O)},showUploadList:!1};return e.jsx(n.Spin,{spinning:i||j,tip:j?"파일 압축 중...":`파일 업로드 중... ${w}%`,children:e.jsxs("div",{className:"bwg-large-uploader-container",children:[e.jsx(n.Card,{title:e.jsx(J,{strong:!0,children:t}),extra:e.jsx(n.Upload,{...C,children:e.jsx(n.Button,{icon:e.jsx(I.UploadOutlined,{}),children:"파일 선택"})}),style:{padding:0},children:e.jsx(Ce,{...C,style:{border:"none",background:"transparent",padding:0},children:e.jsx("div",{className:"upload-list-container",children:d.length>0?e.jsx(n.List,{style:{textAlign:"left"},dataSource:d,renderItem:f=>{const O=f.status==="done",Y=f.status==="error";let T;return O?T=e.jsx(I.CheckCircleOutlined,{style:{color:"#52c41a",fontSize:14}}):Y?T=e.jsx(n.Tooltip,{title:typeof f.response=="string"?f.response:"업로드 실패",children:e.jsx(I.CloseCircleOutlined,{style:{color:"#ff4d4f",fontSize:14}})}):T=e.jsx(I.FileTextOutlined,{style:{fontSize:14}}),e.jsx(n.List.Item,{actions:[e.jsx(J,{type:"secondary",children:Ee(f.size||0)},"size"),e.jsx(n.Button,{type:"text",icon:e.jsx(I.DeleteOutlined,{}),onClick:l=>{l.stopPropagation(),C.onRemove?.(f)},disabled:i||j},"delete")],children:e.jsx(n.List.Item.Meta,{avatar:T,title:e.jsx(J,{type:Y?"danger":void 0,children:f.name})})},f.uid)}}):e.jsxs(n.Flex,{gap:"middle",align:"center",justify:"center",vertical:!0,style:{padding:"20px 0",minHeight:"120px"},children:[e.jsx(I.InboxOutlined,{style:{fontSize:"32px",color:"#999"}}),e.jsx(J,{type:"secondary",children:"업로드할 파일을 선택하거나 이 영역으로 드래그하세요."})]})})})}),d.length>0&&e.jsxs(n.Flex,{justify:"flex-end",align:"center",gap:"large",style:{marginTop:16},children:[i&&e.jsx("div",{style:{width:"250px"},children:e.jsx(n.Progress,{percent:w,size:"small"})}),e.jsx(n.Button,{type:"primary",onClick:y,disabled:i||j||d.filter(f=>f.status!=="done").length===0,icon:e.jsx(I.CloudUploadOutlined,{}),children:"일괄 업로드"})]})]})})},we=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:r,blocks:m}=t;return r.split(".").map(o=>{const a=m?.[o]?.maxLength??3;return"_".repeat(a)}).join(".")}return""},ke=({itemProps:t,inputProps:r,mask:m})=>{const o=h.useRef(null),s=n.Form.useFormInstance(),a=h.useMemo(()=>we(m),[m]);return h.useEffect(()=>{if(!o.current?.input)return;const c=typeof m=="string"||Array.isArray(m)?{mask:m}:m,d=Z(o.current.input,c);return d.on("accept",()=>{s&&t?.name&&s.setFieldValue(t.name,d.value)}),()=>{d.destroy()}},[m,s,t?.name]),e.jsx(_,{...t,children:e.jsx(n.Input,{...r,ref:o,placeholder:a})})},De=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"}}},be=({type:t="date",itemProps:r={name:"calendar"},inputProps:m,pickerProps:o})=>{const{format:s,mask:a,outputFormat:c}=De(t),d=h.useRef(null),p=h.useRef(null),i=h.useRef(null),u=n.Form.useFormInstance(),[j,x]=h.useState(!1),[w,F]=h.useState(!1),M=r?.name,[y,C]=h.useState(null),f=n.Form.useWatch(M,u),O=X.useSizeConfig();h.useEffect(()=>{if(!d.current?.input)return;const l=Z(d.current.input,{mask:a,lazy:!1});return p.current=l,l.on("accept",()=>{const E=l.value;E.length>0&&x(!0);const D=v(E,s,!0);E.length===s.length&&D.isValid()&&(u.setFieldValue(M,D.format(c)),C(D),p.current?.updateValue())}),()=>{l.destroy()}},[s,a]),h.useEffect(()=>{if(!f){C(null);return}let l=null;if(typeof f=="string"&&f.length===c.length&&/^\d+$/.test(f))if(t==="date"){const E=f.substring(0,4),D=f.substring(4,6),P=f.substring(6,8);l=v(`${E}-${D}-${P}`,s,!0)}else if(t==="month"){const E=f.substring(0,4),D=f.substring(4,6);l=v(`${E}-${D}`,s,!0)}else t==="year"&&(l=v(f,s,!0));else l=v(f,s,!0);l&&l.isValid()?C(l):C(null),F(!1)},[f,s,c,t]);const Y=l=>{if(!l){u.setFieldValue(M,void 0),C(null),p.current?.updateValue();return}C(l);const E=l.format(c);u.setFieldValue(M,E),p.current&&(p.current.value=l.format(s),p.current.updateValue()),F(!1)},T=l=>{setTimeout(()=>{const E=document.activeElement,D=i.current,P=D?.querySelector(".ant-picker-dropdown");!(D&&(D.contains(E)||D===E||P?.contains(E)))&&!(l!==void 0?l:j)&&console.log("✅ Input과 DatePicker 모두 포커스가 없습니다")},0)};return e.jsx(_,{...r,name:void 0,validateStatus:w?"warning":void 0,children:e.jsxs(n.ConfigProvider,{componentSize:O.componentSize,theme:{components:{Input:{addonBg:"#fff"}}},children:[e.jsx(n.Form.Item,{name:M,getValueProps:l=>({value:l?v(l).format(s):void 0}),normalize:l=>l?v(l).format(c):void 0,noStyle:!0,rules:r?.rules??[],children:e.jsx(n.Input,{...m,ref:d,onFocus:()=>{x(!j),p.current?.updateValue()},onBlur:()=>{T()},onKeyDown:l=>{if(l.key==="Backspace"&&x(!0),l.key==="Tab"&&x(!1),l.key==="Enter")if(j){const E=p.current?.value||"",D=v(E,s,!0);E.length===s.length&&D.isValid()?(x(!1),F(!1)):F(!0)}else x(!0)},style:{width:"65%"},allowClear:!0,placeholder:a.replace(/0/g,"_"),suffix:e.jsx(I.CalendarOutlined,{style:{color:"#d9d9d9"}}),autoComplete:"off"})}),e.jsx(n.DatePicker,{...o,open:j,picker:t,format:{format:s,type:"mask"},showNow:!0,value:y,onChange:Y,onOpenChange:l=>{x(l),l||T(!1)},renderExtraFooter:()=>w?e.jsxs("div",{style:{color:"#faad14",paddingLeft:"8px",fontSize:"12px",display:"flex",alignItems:"center",gap:"6px",borderTop:"1px solid #f0f0f0",backgroundColor:"#fffbe6"},children:[e.jsx(I.ExclamationCircleOutlined,{}),e.jsx("span",{children:"유효하지 않은 날짜입니다"})]}):null,getPopupContainer:l=>l.parentElement,style:{position:"absolute",top:0,left:0,pointerEvents:"none",opacity:0,width:"100%"}})]})})},{RangePicker:Le}=n.DatePicker,Ye=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"}}},ve=({type:t="date",itemProps:r={name:"dateRange"},inputProps:m,pickerProps:o})=>{const{format:s,mask:a,outputFormat:c}=Ye(t),d=h.useRef(null),p=h.useRef(null),i=h.useRef(null),u=h.useRef(null),j=h.useRef(null),x=n.Form.useFormInstance(),[w,F]=h.useState(!1),[M,y]=h.useState(!1),[C,f]=h.useState(null),[O,Y]=h.useState(!1),T=h.useRef(!1),l=r?.name,[E,D]=h.useState([null,null]),P=n.Form.useWatch(l?Array.isArray(l)?[...l,0]:[l,0]:void 0,x),B=n.Form.useWatch(l?Array.isArray(l)?[...l,1]:[l,1]:void 0,x),U=n.Form.useWatch(l,x),z=X.useSizeConfig();h.useEffect(()=>{if(!d.current?.input)return;const g=Z(d.current.input,{mask:a,lazy:!1});return i.current=g,g.on("accept",()=>{const S=g.value,L=g.unmaskedValue||"";if(console.log("🔵 [시작일] accept 이벤트:",{maskValue:S,unmaskedValue:L,length:S.length,formatLength:s.length}),S.length>0&&(f("start"),F(!0),Y(!1)),L.length===c.length){const k=v(S,s,!0);if(k.isValid()){console.log("🔵 [시작일] 입력 완료 및 검증 통과:",{parsed:k.format(s)});const $=k.format(c);T.current=!0;const b=Array.isArray(l)?[...l,0]:[l,0];x.setFieldValue(b,$),D([k,E[1]]),i.current&&i.current.updateValue(),y(!1),setTimeout(()=>{u.current&&(u.current.value="",u.current.unmaskedValue="",u.current.updateValue());const N=Array.isArray(l)?[...l,1]:[l,1];x.getFieldValue(N)||x.setFieldValue(N,void 0),p.current?.focus(),setTimeout(()=>{if(u.current){const H=u.current.value||"";!(u.current.unmaskedValue||"")&&!H.replace(/[^0-9]/g,"")&&(u.current.value="",u.current.updateValue())}},10),f("end"),F(!0),T.current=!1},0)}else o?.allowEmpty?y(!1):(console.log("🔵 [시작일] 검증 실패:",{val:S,parsed:k}),y(!0))}}),()=>{g.destroy()}},[s,a,l]),h.useEffect(()=>{if(!p.current?.input)return;const g=Z(p.current.input,{mask:a,lazy:!1});return u.current=g,g.on("accept",()=>{const S=g.value,L=g.unmaskedValue||"";if(console.log("🟢 [종료일] accept 이벤트:",{maskValue:S,unmaskedValue:L,length:S.length,formatLength:s.length}),L===""||L.length===0){const k=Array.isArray(l)?[...l,1]:[l,1];x.setFieldValue(k,void 0),D([E[0],null]),u.current&&(u.current.value="",u.current.updateValue()),setTimeout(()=>{d.current?.focus(),f("start"),F(!0)},0);return}if(S.length>0&&(f("end"),F(!0)),S.length<s.length){y(!1);return}if(L.length===c.length){const k=v(S,s,!0);if(k.isValid()){const $=k.format(c);console.log("🟢 [종료일] 입력 완료:",{parsed:k.format(s),formatted:$}),T.current=!0;const b=Array.isArray(l)?[...l,1]:[l,1];x.setFieldValue(b,$),D([E[0],k]),u.current?.updateValue(),setTimeout(()=>{T.current=!1},0)}else o?.allowEmpty?y(!1):(console.log("🟢 [종료일] 검증 실패:",{val:S,parsed:k}),y(!0))}}),()=>{g.destroy()}},[s,a,l]),h.useEffect(()=>{console.log("🟡 [useEffect] form 값 변경 감지:",{startFormValue:P,endFormValue:B,formValue:U});const g=P??(Array.isArray(U)?U[0]:null),S=B??(Array.isArray(U)?U[1]:null);if(g===void 0&&S===void 0&&(!U||!Array.isArray(U))){D([null,null]);return}const L=b=>{if(!b)return null;let N=null;if(typeof b=="string"&&b.length===c.length&&/^\d+$/.test(b))if(t==="date"){const R=b.substring(0,4),H=b.substring(4,6),re=b.substring(6,8);N=v(`${R}-${H}-${re}`,s,!0)}else if(t==="month"){const R=b.substring(0,4),H=b.substring(4,6);N=v(`${R}-${H}`,s,!0)}else t==="year"&&(N=v(b,s,!0));else N=v(b,s,!0);return N&&N.isValid()?N:null},k=L(g),$=L(S);if(console.log("🟡 [useEffect] 파싱 결과:",{startParsed:k?k.format(s):null,endParsed:$?$.format(s):null,isStartDateFromPicker:O}),D([k,$]),T.current){console.log("🟡 [useEffect] 사용자 입력 중 - 마스크 값 업데이트 스킵"),y(!1);return}if(!O&&i.current){const b=i.current.value||"",N=k?k.format(s):"",R=i.current.unmaskedValue||"",H=k?k.format(c):"";console.log("🟡 [useEffect] 시작일 마스크 값 체크:",{currentMaskValue:b,expectedMaskValue:N,unmaskedValue:R,expectedUnmasked:H,shouldUpdate:b===""||b!==N,canUpdate:R===""||R===H}),(b===""||b!==N)&&(R===""||R===H?(console.log("🟡 [useEffect] 시작일 마스크 값 업데이트:",{before:b,after:k?k.format(s):""}),k?(i.current.value=k.format(s),i.current.updateValue()):(i.current.value="",i.current.updateValue())):console.log("🟡 [useEffect] 시작일 마스크 값 업데이트 스킵 (사용자 입력 중)"))}if(u.current){const b=u.current.value||"",N=$?$.format(s):"",R=u.current.unmaskedValue||"",H=$?$.format(c):"";console.log("🟡 [useEffect] 종료일 마스크 값 체크:",{currentMaskValue:b,expectedMaskValue:N,unmaskedValue:R,expectedUnmasked:H,shouldUpdate:b===""||b!==N,canUpdate:R===""||R===H}),(b===""||b!==N)&&(R===""||R===H?(console.log("🟡 [useEffect] 종료일 마스크 값 업데이트:",{before:b,after:N}),$?(u.current.value=$.format(s),u.current.updateValue()):(u.current.value="",u.current.updateValue())):console.log("🟡 [useEffect] 종료일 마스크 값 업데이트 스킵 (사용자 입력 중)"))}y(!1)},[P,B,U,s,c,t]);const K=g=>{if(console.log("🔴 [RangePicker] 날짜 변경:",{dates:g?[g[0]?g[0].format(s):null,g[1]?g[1].format(s):null]:null,prevRange:[E[0]?E[0].format(s):null,E[1]?E[1].format(s):null]}),!g){D([null,null]);const N=Array.isArray(l)?[...l,0]:[l,0],R=Array.isArray(l)?[...l,1]:[l,1];x.setFieldValue(N,void 0),x.setFieldValue(R,void 0),i.current?.updateValue(),u.current?.updateValue();return}const[S,L]=g,k=E[0],$=S&&(!k||!S.isSame(k,t==="year"?"year":t==="month"?"month":"day"));if(console.log("🔴 [RangePicker] 시작일 변경 여부:",{isStartDateChanged:$,startDate:S?S.format(s):null,prevStartDate:k?k.format(s):null}),D([S,L]),$){console.log("🔴 [RangePicker] 시작일 선택됨 - input 비우기"),Y(!0),i.current&&(i.current.value="",i.current.updateValue());const N=S.format(c);console.log("🔴 [RangePicker] form 값 업데이트:",{formatted:N});const R=Array.isArray(l)?[...l,0]:[l,0];x.setFieldValue(R,N)}else if(!S&&i.current){Y(!1),i.current.value="",i.current.updateValue();const N=Array.isArray(l)?[...l,0]:[l,0];x.setFieldValue(N,void 0)}else Y(!1);const b=Array.isArray(l)?[...l,1]:[l,1];if(L){const N=L.format(c);x.setFieldValue(b,N),u.current&&(u.current.value=L.format(s),u.current.updateValue())}else x.setFieldValue(b,void 0),u.current&&(u.current.value="",u.current.updateValue());y(!1)},q=g=>{setTimeout(()=>{const S=document.activeElement,L=j.current,k=L?.querySelector(".ant-picker-dropdown");!(L&&(L.contains(S)||L===S||k?.contains(S)))&&!(g!==void 0?g:w)&&(console.log("✅ Input과 RangePicker 모두 포커스가 없습니다"),F(!1))},0)};return e.jsx(_,{...r,name:void 0,validateStatus:M?"warning":void 0,children:e.jsxs(n.ConfigProvider,{componentSize:z.componentSize,theme:{components:{Input:{addonBg:"#fff"}}},children:[e.jsxs("div",{ref:j,style:{display:"flex",alignItems:"center",gap:"8px",width:"100%"},children:[e.jsx(n.Form.Item,{name:l?Array.isArray(l)?[...l,0]:[l,0]:void 0,getValueProps:g=>{if(!g)return{value:void 0};if(typeof g=="string"&&g.length===c.length&&/^\d+$/.test(g)){if(t==="date"){const S=g.substring(0,4),L=g.substring(4,6),k=g.substring(6,8);return{value:`${S}-${L}-${k}`}}else if(t==="month"){const S=g.substring(0,4),L=g.substring(4,6);return{value:`${S}-${L}`}}else if(t==="year")return{value:g}}return{value:v(g).format(s)}},normalize:g=>g?v(g).format(c):(o?.allowEmpty,void 0),noStyle:!0,rules:r?.rules??[],children:e.jsx(n.Input,{...m,value:void 0,ref:d,onFocus:()=>{if(f("start"),F(!w),Y(!1),i.current){const g=Array.isArray(l)?[...l,0]:[l,0];x.getFieldValue(g)||(i.current.value="",i.current.unmaskedValue=""),i.current.updateValue()}},onBlur:()=>{q()},onKeyDown:g=>{if(g.key==="Backspace"&&(f("start"),F(!0)),g.key==="Enter")if(w&&C==="start"){const S=i.current?.value||"";S.length===s.length?v(S,s,!0).isValid()?(F(!1),y(!1)):o?.allowEmpty?y(!1):y(!0):y(!1)}else f("start"),F(!0)},style:{flex:1},allowClear:!0,placeholder:a.replace(/0/g,"_"),suffix:e.jsx(I.CalendarOutlined,{style:{color:"#d9d9d9"}}),autoComplete:"off"})}),e.jsx("span",{style:{color:"#d9d9d9",userSelect:"none"},children:"~"}),e.jsx(n.Form.Item,{name:l?Array.isArray(l)?[...l,1]:[l,1]:void 0,getValueProps:g=>{if(!g)return{value:void 0};if(typeof g=="string"&&g.length===c.length&&/^\d+$/.test(g)){if(t==="date"){const S=g.substring(0,4),L=g.substring(4,6),k=g.substring(6,8);return{value:`${S}-${L}-${k}`}}else if(t==="month"){const S=g.substring(0,4),L=g.substring(4,6);return{value:`${S}-${L}`}}else if(t==="year")return{value:g}}return{value:v(g).format(s)}},normalize:g=>g?v(g).format(c):(o?.allowEmpty,void 0),noStyle:!0,rules:r?.rules??[],children:e.jsx(n.Input,{...m,ref:p,onFocus:()=>{if(f("end"),F(!w),u.current){u.current.updateValue();const g=u.current.value||"";!(u.current.unmaskedValue||"")&&!g.replace(/[^0-9]/g,"")&&(u.current.value="",u.current.updateValue())}},onBlur:()=>{q()},onKeyDown:g=>{if(g.key==="Backspace"){const S=u.current?.value||"",L=u.current?.unmaskedValue||"";if(S===""||L===""||S.replace(/[^0-9]/g,"").length<=1){g.preventDefault();const k=Array.isArray(l)?[...l,1]:[l,1];x.setFieldValue(k,void 0),D([E[0],null]),u.current&&(u.current.value="",u.current.updateValue()),setTimeout(()=>{d.current?.focus(),f("start"),F(!0)},0);return}f("end"),F(!0)}if(g.key==="Tab"&&F(!1),g.key==="Enter")if(w&&C==="end"){const S=u.current?.value||"";S.length===s.length?v(S,s,!0).isValid()?(F(!1),y(!1)):o?.allowEmpty?y(!1):y(!0):y(!1)}else f("end"),F(!0)},style:{flex:1},allowClear:!0,onClear:()=>{const g=Array.isArray(l)?[...l,1]:[l,1];x.setFieldValue(g,void 0),D([E[0],null]),u.current&&(u.current.value="",u.current.updateValue()),setTimeout(()=>{d.current?.focus(),f("start"),F(!0)},0)},placeholder:a.replace(/0/g,"_"),suffix:e.jsx(I.CalendarOutlined,{style:{color:"#d9d9d9"}}),autoComplete:"off"})})]}),e.jsx(Le,{...o,open:w,picker:t,format:{format:s,type:"mask"},showNow:!0,value:E,onChange:K,onOpenChange:g=>{F(g),g||q(!1)},renderExtraFooter:()=>M?e.jsxs("div",{style:{color:"#faad14",paddingLeft:"8px",fontSize:"12px",display:"flex",alignItems:"center",gap:"6px",borderTop:"1px solid #f0f0f0",backgroundColor:"#fffbe6"},children:[e.jsx(I.ExclamationCircleOutlined,{}),e.jsx("span",{children:"유효하지 않은 날짜입니다"})]}):null,getPopupContainer:g=>g.parentElement,style:{position:"absolute",top:0,left:0,pointerEvents:"none",opacity:0,width:"100%"}})]})})},{Option:ae}=n.Select,Ne=({itemProps:t,inputProps:r})=>{const[m,o]=h.useState([]);return h.useEffect(()=>{r?.addField==="ALL"?o([{label:"전체",value:""},...r?.list||[]]):r?.addField==="NULL"?o([{label:"",value:""},...r?.list||[]]):o(r?.list||[])},[r?.list]),e.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:e.jsx(n.Select,{...r,mode:"multiple",children:m.map(s=>{const{value:a,label:c}=s;return r?.printCode?e.jsx(ae,{value:a,label:c,children:e.jsx(n.Space,{children:`[${a}] ${c}`})},a):e.jsx(ae,{value:a,label:c,children:e.jsx(n.Space,{children:`${c}`})},a)})})})},Ve=({itemProps:t,inputProps:r})=>{const m=s=>{let a=s.toString().split(".");return r?.decimalPoint!=null&&a[1]!=null&&r?.decimalPoint>0?a[1].length>r?.decimalPoint?a[1]="."+a[1].substring(0,r?.decimalPoint):a[1]="."+a[1]:a[1]="",a[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")+a[1]},o=s=>{let a=s.toString().split(".");return r?.decimalPoint!=null&&a[1]!=null&&r?.decimalPoint>0?a[1].length>r?.decimalPoint?a[1]="."+a[1].substring(0,r?.decimalPoint):a[1]="."+a[1]:a[1]="",a[0].replace(/\$\s?|(,*)/g,"")+a[1]};return e.jsx(_,{...t,children:e.jsx(n.InputNumber,{...r,formatter:s=>m(s),parser:s=>o(s)})})},Oe=({itemProps:t,inputProps:r})=>e.jsx(_,{...t,children:e.jsx(n.Radio.Group,{...r})}),{RangePicker:Ae}=n.DatePicker,oe={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:r,type:m="date",minDate:o,maxDate:s,returnType:a="string"})=>{const{displayFormat:c,outputFormat:d}=h.useMemo(()=>oe[m],[m]),p=h.useMemo(()=>Object.values(oe).map(i=>i.outputFormat).sort((i,u)=>{if(i.length===u.length){if(i===d)return-1;if(u===d)return 1}return u.length-i.length}),[d]);return e.jsx(_,{...t,getValueProps:i=>({value:i&&i.length>0?[i[0]?v.isDayjs(i[0])?i[0]:v(i[0],p):null,i[1]?v.isDayjs(i[1])?i[1]:v(i[1],p):null]:null}),normalize:i=>i?a==="dayjs"?[i[0]??void 0,i[1]??void 0]:[i[0]?i[0].format(d):void 0,i[1]?i[1].format(d):void 0]:[void 0,void 0],children:e.jsx(Ae,{...r,order:!0,minDate:o?v(o,p):void 0,maxDate:s?v(s,p):void 0,picker:m==="datetime"?"date":m,showTime:r?.showTime??(m==="datetime"||m==="time"),format:c})})},le=n.Input.Search,Be=t=>{const r=n.Form.useFormInstance(),{openPopup:m}=de.usePopupStore(),o=t.itemProps?.name||[],s=t.popupConfig||{callback(c){Array.isArray(o)&&o.length>1?(r.setFieldValue(o[0],c.code),r.setFieldValue(o[1],c.name)):r.setFieldValue(o,c.code)}},a={...t,placeholder:typeof t.placeholder=="string"?t.placeholder:t.placeholder?.[0]||"",onChange:c=>{Array.isArray(o)&&o.length>1&&r.setFieldValue(o[0],""),t.onChange?.(c)},onSearch:c=>{t.popuCd?m(t.popuCd,t.popupParams,s):t.onSearch?.(c)}};return Array.isArray(o)&&o.length>1?e.jsx(_,{...t.itemProps,name:void 0,children:e.jsxs(n.Space.Compact,{block:!0,children:[e.jsx(n.Form.Item,{name:o[0],rules:t.itemProps?.rules,style:{width:"40%",marginBottom:0,marginInlineEnd:0},validateStatus:"",help:"",children:e.jsx(n.Input,{style:{color:"#999",backgroundColor:"#f5f5f5"},placeholder:t.placeholder?.[0]||"",readOnly:!0})}),e.jsx(n.Form.Item,{name:o[1],style:{width:"60%",marginBottom:0},children:e.jsx(le,{readOnly:t.readOnly,enterButton:e.jsx(n.Button,{icon:e.jsx(I.SearchOutlined,{}),disabled:t.readOnly}),...a})})]})}):e.jsx(_,{...t.itemProps,children:e.jsx(le,{...a})})},Ue=({itemProps:t,selectProps:r={options:[],allowClear:!0}})=>{const m=n.Form.useFormInstance(),o=!!m,s=h.useMemo(()=>r?.addField==="ALL"?[{label:"전체",value:""},...r?.options||[]]:r?.addField==="NULL"?[{label:"",value:""},...r?.options||[]]:r?.options||[],[r.options,r.addField]),a=p=>{r.onChange?.(p)},c={...r,allowClear:r.allowClear??!0,options:s,onChange:a,variant:r.variant},d=e.jsx(n.Select,{...c,disabled:r.disabled});return r.copyable&&!o&&console.warn("BwgSelect: copyable 기능은 Form 컨텍스트 내에서만 사용 가능합니다."),r.copyable?e.jsx(_,{...t,name:void 0,children:e.jsxs(n.Space.Compact,{block:!0,children:[e.jsx(n.Form.Item,{name:t?.name,rules:t?.rules,style:{width:"100%",marginBottom:0},validateStatus:"",help:"",children:d}),e.jsx(n.Typography.Paragraph,{copyable:{text:o&&m?.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"}})]})}):e.jsx(_,{...t,children:d})},Te=({itemProps:t,inputProps:r={format:"YN"}})=>{const m=n.Form.useFormInstance(),o=(s,a)=>{r.format==="boolean"?m.setFieldValue(t?.name,s):m.setFieldValue(t?.name,s?"Y":"N"),r.onChange&&r.onChange(s,a)};return e.jsx(_,{...t,getValueProps:s=>({checked:r.format==="boolean"?!!s:s==="Y"}),normalize:s=>typeof s=="boolean"?r.format==="boolean"?s:s?"Y":"N":r.format==="boolean"?!!s:s?"Y":"N",children:e.jsx(n.Switch,{...r,onChange:(s,a)=>o(s,a)})})},{TextArea:Pe}=n.Input,Re=({itemProps:t,inputProps:r})=>e.jsx(_,{...t,children:e.jsx(Pe,{...r})}),_e=n.Input.Search,ze=t=>{const r=n.Form.useFormInstance(),{openCorePopup:m}=X.usePopup(),o={value:"deptNm",fieldName:"deptNm",placeholder:"부서명"},s={value:"empNm",fieldName:"empNm",placeholder:"사원명 입력"},a=t.field1||o,c=t.field2||s,d=h.useCallback(u=>{r.setFieldValue(t.employeeFieldName||"employee",u),r.setFieldValue(t.empNoFieldName||"empNo",u.empNo??""),r.setFieldValue(a.fieldName,u[a.value||"deptNm"]??""),r.setFieldValue(c.fieldName,u[c.value||"empNm"]??""),t.onFinish?.()},[r,a,c,t.employeeFieldName]),p=h.useCallback(u=>{m("CORE_ORGANIZATION_01",{onSelect:j=>{d(j)},defaultParams:{keyword:u}})},[d,m]),i=h.useCallback(async u=>{const j=u?.trim();if(j)try{const x=await G.callService("SCMUTIL00101",{keyword:j},{showLoading:!1}),w=x?.empList||[];if(x?.empCnt===0){n.message.warning("일치하는 사원을 찾을 수 없어 팝업을 열립니다. 사원을 선택해주세요."),p();return}if(x?.empCnt>1){n.message.info("여러 건이 검색되어 팝업이 열립니다. 사원을 선택해주세요."),p(j);return}const F=w[0];d(F)}catch(x){console.error("사원 검색 서비스 실패:",x),n.message.error("사원 검색 중 오류가 발생했습니다.")}},[d,p]);return e.jsx(_,{label:t.label||"사원",name:void 0,children:e.jsxs(n.Space.Compact,{block:!0,children:[e.jsx(n.Form.Item,{name:a.fieldName,style:{width:"40%",marginBottom:0,marginInlineEnd:0},validateStatus:"",help:"",children:e.jsx(n.Input,{style:{color:"#999",backgroundColor:"#f5f5f5"},placeholder:a.placeholder,readOnly:!0})}),e.jsx(n.Form.Item,{name:t.employeeFieldName||"employee",hidden:!0}),e.jsx(n.Form.Item,{name:t.empNoFieldName||"empNo",hidden:!0}),e.jsx(n.Form.Item,{name:c.fieldName,style:{width:"60%",marginBottom:0},children:e.jsx(_e,{allowClear:!0,readOnly:t.readOnly,placeholder:c.placeholder,enterButton:e.jsx(n.Button,{icon:e.jsx(I.SearchOutlined,{}),disabled:t.readOnly,onClick:()=>{p()}}),onSearch:i,onChange:u=>{r.setFieldValue(a.fieldName,""),r.setFieldValue(t.employeeFieldName||"employee",null),r.setFieldValue(t.empNoFieldName||"empNo","")}})})]})})},$e=n.Input.Search,Ge=t=>{const r=n.Form.useFormInstance(),{openCorePopup:m}=X.usePopup(),o={value:"deptNm",fieldName:"deptNm",placeholder:"부서명"},s=t.field||o,a=h.useCallback(p=>{r.setFieldValue(t.departmentFieldName||"department",p),r.setFieldValue(s.fieldName,p[s.value||"deptNm"]??""),r.setFieldValue(t.deptCdFieldName||"deptCd",p.deptCd??""),t.onFinish?.()},[r,s,t.departmentFieldName,t.deptCdFieldName]),c=h.useCallback(p=>{m("CORE_DEPARTMENT_01",{onSelect:i=>{a(i)},defaultParams:{keyword:p}})},[a,m]),d=h.useCallback(async p=>{const i=p?.trim();if(i)try{const u=await G.callService("SCMUTIL00103",{keyword:i},{showLoading:!1}),j=u?.deptCnt??0,x=u?.deptList||[];if(j===0||x.length===0){n.message.warning("일치하는 부서를 찾을 수 없어 팝업을 열립니다. 부서를 선택해주세요."),c(i);return}if(j>1||x.length>1){n.message.info("여러 건이 검색되어 팝업이 열립니다. 부서를 선택해주세요."),c(i);return}const w=x[0];a(w)}catch(u){console.error("부서 검색 서비스 실패:",u),n.message.error("부서 검색 중 오류가 발생했습니다.")}},[a,c]);return e.jsx(_,{label:t.label||"부서",name:void 0,children:e.jsxs(n.Space.Compact,{block:!0,children:[e.jsx(n.Form.Item,{name:t.deptCdFieldName||"deptCd",style:{width:"40%",marginBottom:0,marginInlineEnd:0},validateStatus:"",help:"",children:e.jsx(n.Input,{style:{color:"#999",backgroundColor:"#f5f5f5"},placeholder:"부서코드",readOnly:!0})}),e.jsx(n.Form.Item,{name:t.departmentFieldName||"department",hidden:!0}),e.jsx(n.Form.Item,{name:s.fieldName,style:{width:"60%",marginBottom:0},children:e.jsx($e,{allowClear:!0,readOnly:t.readOnly,placeholder:s.placeholder,enterButton:e.jsx(n.Button,{icon:e.jsx(I.SearchOutlined,{}),disabled:t.readOnly,onClick:()=>{c()}}),onSearch:d,onChange:p=>{r.setFieldValue(t.deptCdFieldName||"deptCd",""),r.setFieldValue(t.departmentFieldName||"department",null)}})})]})})},fe=({originNode:t,file:r,fileList:m,moveFile:o,onDrop:s})=>{const a=h.useRef(null),[{handlerId:c},d]=Q.useDrop({accept:"file",collect:j=>({handlerId:j.getHandlerId()}),hover(j,x){if(!a.current)return;const w=j.uid,F=r.uid;if(w===F)return;const M=ee.findIndex(m,{uid:F}),y=ee.findIndex(m,{uid:w});if(y===-1||M===-1)return;const C=a.current.getBoundingClientRect(),f=x.getClientOffset();if(!f)return;const O=(C.bottom-C.top)/2,Y=f.y-C.top;y<M&&Y<O||y>M&&Y>O||o(w,F)},drop(){s()}}),[{isDragging:p},i]=Q.useDrag({type:"file",item:()=>({uid:r.uid,index:ee.findIndex(m,{uid:r.uid})}),collect:j=>({isDragging:j.isDragging()})}),u=p?0:1;return i(d(a)),e.jsx("div",{ref:a,style:{opacity:u},"data-handler-id":c,children:t})},te=(t,r,m,o,s)=>{const a=m[0]?.uid===r.uid,c=h.cloneElement(t,{href:r.url||void 0,title:void 0});return e.jsxs(e.Fragment,{children:[a&&e.jsxs("div",{style:{fontSize:12,color:"var(--text-secondary, #666)",marginBottom:4},children:["총 ",m.length,"건"]}),e.jsx(fe,{originNode:c,file:r,fileList:m,moveFile:o,onDrop:s})]})},ne=(t,r)=>{const m=String(r||"");return m.startsWith("picture")?t.name.endsWith(".pdf")?e.jsx(I.FilePdfTwoTone,{}):t.name.endsWith(".docx")||t.name.endsWith(".doc")?e.jsx(I.FileWordTwoTone,{}):t.name.endsWith(".xlsx")||t.name.endsWith(".xls")?e.jsx(I.FileExcelTwoTone,{}):t.name.endsWith(".pptx")||t.name.endsWith(".ppt")?e.jsx(I.FilePptTwoTone,{}):e.jsx(I.FileTwoTone,{}):m.startsWith("text")?e.jsx(I.LinkOutlined,{}):e.jsx(I.FileOutlined,{})},He=({listType:t="picture",buttonText:r="파일 선택",permissions:m,multiple:o=!1,fileGrpKey:s,uploadProps:a,heights:c,...d})=>{const{defaultUploadProps:p,fileList:i,fetchFileList:u,reorderFiles:j,saveFileOrder:x}=X.useFileUploader({multiple:o,fileGrpKey:s,...d});h.useEffect(()=>{s&&u()},[s]);const w=!!m?.fileAdd,F={...p,listType:t,styles:{root:{height:c?.root},list:{height:c?.list}},iconRender:ne,itemRender(M,y,C){return te(M,y,C,j,x)},...a};return e.jsx(Q.DndProvider,{backend:ue.HTML5Backend,children:e.jsx(n.Upload,{headers:{SYSCD:__SYS_CD__},style:{height:c?.root},...F,children:w&&o||(w&&!o||i.length===0)&&e.jsx(n.Button,{icon:e.jsx(I.UploadOutlined,{}),children:r})})})},We=({listType:t="picture",permissions:r,multiple:m=!1,fileGrpKey:o,uploadProps:s,heights:a,...c})=>{const{defaultUploadProps:d,fetchFileList:p,reorderFiles:i,saveFileOrder:u}=X.useFileUploader({multiple:m,fileGrpKey:o,...c}),j={...d,listType:t,iconRender:ne,itemRender(x,w,F){return te(x,w,F,i,u)},...s};return h.useEffect(()=>{o&&p()},[o]),e.jsx(Q.DndProvider,{backend:ue.HTML5Backend,children:e.jsxs(pe,{style:{marginBottom:10},height:a?.dragger||100,...j,children:[e.jsx("p",{className:"ant-upload-drag-icon",style:{marginBottom:10},children:e.jsx(I.InboxOutlined,{style:{fontSize:25}})}),e.jsx("p",{className:"ant-upload-hint",children:"첨부할 파일을 여기에 끌어다 놓거나, 영역을 클릭하여 파일을 직접 선택해주세요."})]})})},{Text:ie}=n.Typography,V={IDLE:"idle",UPLOADING:"uploading",UPLOADED:"uploaded",EXECUTING:"executing",COMPLETED:"completed",FAILED:"failed"},qe={[V.IDLE]:"엑셀 파일을 선택해 업로드 해 주세요. (xlsx, xls, csv만 가능)",[V.UPLOADING]:"엑셀 업로드 중입니다. 잠시만 기다려 주세요.",[V.UPLOADED]:"엑셀 업로드가 완료되었습니다.",[V.EXECUTING]:"배치 작업 실행 중입니다. 잠시만 기다려 주세요.",[V.COMPLETED]:"배치 작업이 완료되었습니다.",[V.FAILED]:"배치 작업이 실패했습니다."},Xe=({label:t="엑셀 업로드",jobId:r,extraParams:m,onFinish:o,disabled:s=!1})=>{const[a,c]=h.useState(V.IDLE),[d,p]=h.useState(null),[i,u]=h.useState(null),j=h.useCallback(async()=>{if(!(!d||!i)){if(!r){n.message.warning("실행 job id(jobId)가 설정되어 있지 않습니다.");return}try{if(!i.filePath){n.message.error("파일 URL 정보가 없습니다.");return}c(V.EXECUTING);const y={crprCd:G.getCrprCd(),sysCd:window.__SYS_CD__||"",fileKey:i.fileKey,filePath:i.filePath,jobId:r},C=await G.callService("SCMUTIL00301",{...y,...m});C?.success?n.message.success(C?.message||"배치 실행 요청이 접수되었습니다. 상태 확인을 눌러주세요."):(c(V.FAILED),n.message.error(C?.message||"배치 실행 요청에 실패했습니다."))}catch(y){console.error("배치 실행 요청에 실패했습니다.",y),n.message.error("배치 실행 요청에 실패했습니다."),c(V.FAILED)}}},[d,i,r,m]),x=h.useCallback(async()=>{if(!r){n.message.warning("실행 job id(jobId)가 설정되어 있지 않습니다.");return}try{const y=await G.callService("SCMUTIL00302",{jobId:r});if(y?.status==="COMPLETED"){c(V.COMPLETED),n.message.success("배치 작업이 완료되었습니다."),o?.();return}if(y?.status==="FAILED"){c(V.FAILED),n.message.error("배치 작업이 실패했습니다.");return}n.message.info("배치가 아직 진행 중입니다.")}catch(y){console.error("배치 작업 상태 확인 오류:",y),n.message.error("배치 작업 상태 확인 중 오류가 발생했습니다.")}},[r,o]),w=h.useMemo(()=>({name:"file",accept:".xlsx, .xls, .csv",listType:"picture",multiple:!1,action:"/api/upload",showUploadList:{showRemoveIcon:!0},beforeUpload:y=>{const C=`.${y.name.split(".").pop()?.toLowerCase()}`;if(![".xlsx",".xls",".csv"].includes(C))return n.message.error(`${y.name} 파일은 허용되지 않는 확장자입니다. (xlsx, xls, csv만 가능)`),n.Upload.LIST_IGNORE},onChange:y=>{const{status:C}=y.file;if(C==="removed"){p(null),c(V.IDLE),u(null);return}if(p(y.file),C==="uploading"){c(V.UPLOADING);return}if(C==="done"){if(y.file.response?.success){c(V.UPLOADED);const f=y.file.response.uploadedFiles[0]||{};u({fileKey:f.fileKey,filePath:f.filePath,fileNameL:f.fileNameL,fileNameP:f.fileNameP,fileSize:f.fileSize,fileExt:f.fileExt})}else c(V.IDLE),n.message.error(y.file.response?.message||`${y.file.name} 파일 업로드에 실패했습니다.`);return}C==="error"&&(c(V.IDLE),n.message.error(y.file.response?.message||`${y.file.name} 파일 업로드 중 오류가 발생했습니다.`))}}),[]),F=h.useMemo(()=>e.jsxs(n.Space,{direction:"vertical",style:{width:400},children:[e.jsxs(n.Space,{children:[a===V.EXECUTING&&e.jsx(n.Spin,{size:"small"}),e.jsx(ie,{type:a===V.FAILED?"danger":"secondary",children:qe[a]})]}),a!==V.EXECUTING&&a!==V.COMPLETED&&a!==V.FAILED&&e.jsx(n.Upload,{...w,children:!d&&e.jsx(W,{icon:e.jsx(I.UploadOutlined,{}),children:"파일 선택"})}),a===V.UPLOADED&&e.jsx(n.Space,{direction:"vertical",children:e.jsx(n.Space,{children:e.jsx(W,{type:"primary",icon:e.jsx(I.PlayCircleOutlined,{}),onClick:j,disabled:!d,children:"실행하기"})})}),a===V.EXECUTING&&e.jsx(n.Space,{direction:"vertical",children:e.jsx(n.Space,{children:e.jsx(W,{icon:e.jsx(I.RedoOutlined,{}),onClick:x,type:"primary",children:"상태 새로고침"})})}),(a===V.COMPLETED||a===V.FAILED)&&e.jsx(n.Space,{direction:"vertical",children:e.jsxs(n.Space,{children:[e.jsx(W,{icon:e.jsx(I.RedoOutlined,{}),onClick:j,children:"다시 실행하기"}),e.jsx(W,{icon:e.jsx(I.UploadOutlined,{}),onClick:()=>{c(V.IDLE),p(null),u(null)},children:"다른 파일 업로드"})]})})]}),[a,d,j,w]),M=e.jsx(W,{icon:e.jsx(I.UploadOutlined,{}),disabled:s,children:t});if(s){const y=e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(I.ExclamationCircleFilled,{style:{color:"#faad14",fontSize:16}}),e.jsx("span",{style:{fontWeight:600},children:"'엑셀 업로드' 버튼에 대한 사용 권한이 없습니다."})]}),C=e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4,paddingLeft:24},children:e.jsx("span",{style:{fontSize:12},children:"관리자에게 문의하세요."})});return e.jsx(n.Popover,{title:y,content:C,placement:"bottom",styles:{body:{backgroundColor:"#fffbe6"}},children:e.jsx("span",{children:M})})}return e.jsx(n.Popover,{content:F,title:e.jsx("div",{style:{display:"flex",alignItems:"center",marginBottom:0},children:e.jsx(ie,{strong:!0,children:"엑셀 업로드"})}),trigger:"click",placement:"bottom",children:M})},{Text:ce}=n.Typography,A={IDLE:"idle",UPLOADING:"uploading",UPLOADED:"uploaded",EXECUTING:"executing",COMPLETED:"completed",FAILED:"failed"},Ke={[A.IDLE]:"엑셀 파일을 선택해 업로드 해 주세요. (xlsx만 가능)",[A.UPLOADING]:"엑셀 업로드 중입니다. 잠시만 기다려 주세요.",[A.UPLOADED]:"엑셀 업로드가 완료되었습니다.",[A.EXECUTING]:"서비스 작업 실행 중입니다. 잠시만 기다려 주세요.",[A.COMPLETED]:"서비스 작업이 완료되었습니다.",[A.FAILED]:"서비스 작업이 실패했습니다."},Je=({label:t="엑셀 업로드",serviceName:r,extraParams:m,onFinish:o,disabled:s=!1})=>{const[a,c]=h.useState(A.IDLE),[d,p]=h.useState(null),[i,u]=h.useState(null),j=h.useCallback(async()=>{if(!(!d||!i)){if(!r){n.message.warning("실행 서비스 이름(serviceName)이 설정되어 있지 않습니다.");return}try{if(!i.filePath){n.message.error("파일 URL 정보가 없습니다.");return}c(A.EXECUTING);const C={crprCd:G.getCrprCd(),filePath:i.filePath},f=await G.callService(r,{...C,...m});f?.success||(c(A.FAILED),n.message.error(f?.message||"서비스 실행에 실패했습니다.")),c(A.COMPLETED),n.message.success(f?.message||"서비스 실행이 완료되었습니다."),o?.()}catch(C){console.error("서비스 실행 요청에 실패했습니다.",C),n.message.error("서비스 실행 요청에 실패했습니다."),c(A.FAILED)}}},[d,i,r,m,o]),w=`/excel/test/${v().format("YYYY/MM/DD")}`,F=h.useMemo(()=>({name:"file",accept:".xlsx",listType:"picture",multiple:!1,action:`/api/upload${w}`,showUploadList:{showRemoveIcon:!0},beforeUpload:C=>{const f=`.${C.name.split(".").pop()?.toLowerCase()}`;if(![".xlsx"].includes(f))return n.message.error(`${C.name} 파일은 허용되지 않는 확장자입니다. (xlsx만 가능)`),n.Upload.LIST_IGNORE;const O=10*1024*1024;if(C.size>O)return n.message.error("첨부 파일은 최대 10MB까지 업로드 가능합니다."),n.Upload.LIST_IGNORE},onChange:C=>{const{status:f}=C.file;if(f==="removed"){p(null),c(A.IDLE),u(null);return}if(p(C.file),f==="uploading"){c(A.UPLOADING);return}if(f==="done"){c(A.UPLOADED);const O=C.file,Y=O.name||O.response.file_1?.filename,T=O.response.file_1?.encrypted;u({fileKey:T,filePath:`${w}/${Y}`,fileNameL:Y,fileNameP:O.response.file_1?.encrypted,fileSize:O.response.file_1?.fileSize,fileExt:Y.includes(".")?Y.split(".").pop():""})}f==="error"&&(c(A.IDLE),n.message.error(C.file.response?.message||`${C.file.name} 파일 업로드 중 오류가 발생했습니다.`))}}),[w]),M=h.useMemo(()=>e.jsxs(n.Space,{direction:"vertical",style:{width:400},children:[e.jsxs(n.Space,{children:[a===A.EXECUTING&&e.jsx(n.Spin,{size:"small"}),e.jsx(ce,{type:a===A.FAILED?"danger":"secondary",children:Ke[a]})]}),a!==A.EXECUTING&&a!==A.COMPLETED&&a!==A.FAILED&&e.jsx(n.Upload,{...F,children:!d&&e.jsx(W,{icon:e.jsx(I.UploadOutlined,{}),children:"파일 선택"})}),a===A.UPLOADED&&e.jsx(n.Space,{direction:"vertical",children:e.jsx(n.Space,{children:e.jsx(W,{type:"primary",icon:e.jsx(I.PlayCircleOutlined,{}),onClick:j,disabled:!d,children:"실행하기"})})}),(a===A.COMPLETED||a===A.FAILED)&&e.jsx(n.Space,{direction:"vertical",children:e.jsxs(n.Space,{children:[e.jsx(W,{icon:e.jsx(I.RedoOutlined,{}),onClick:j,children:"다시 실행하기"}),e.jsx(W,{icon:e.jsx(I.UploadOutlined,{}),onClick:()=>{c(A.IDLE),p(null),u(null)},children:"다른 파일 업로드"})]})})]}),[a,d,j,F]),y=e.jsx(W,{icon:e.jsx(I.UploadOutlined,{}),disabled:s,children:t});if(s){const C=e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(I.ExclamationCircleFilled,{style:{color:"#faad14",fontSize:16}}),e.jsx("span",{style:{fontWeight:600},children:"'엑셀 업로드' 버튼에 대한 사용 권한이 없습니다."})]}),f=e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4,paddingLeft:24},children:e.jsx("span",{style:{fontSize:12},children:"관리자에게 문의하세요."})});return e.jsx(n.Popover,{title:C,content:f,placement:"bottom",style:{backgroundColor:"#fffbe6"},children:e.jsx("span",{children:y})})}return e.jsx(n.Popover,{content:M,title:e.jsx("div",{style:{display:"flex",alignItems:"center",marginBottom:0},children:e.jsx(ce,{strong:!0,children:"엑셀 업로드"})}),trigger:"click",placement:"bottom",children:y})};exports.BwgButton=W;exports.BwgCheck=he;exports.BwgCheckList=xe;exports.BwgDatePicker=ye;exports.BwgDeptSearch=Ge;exports.BwgDownload=je;exports.BwgDraggerUploader=We;exports.BwgEmpSearch=ze;exports.BwgExcelUploaderBatch=Xe;exports.BwgExcelUploaderService=Je;exports.BwgForm=me;exports.BwgFormItem=_;exports.BwgInput=Fe;exports.BwgLargeUploader=Ie;exports.BwgMaskedDate=be;exports.BwgMaskedInput=ke;exports.BwgMaskedRange=ve;exports.BwgMultiSelect=Ne;exports.BwgNumber=Ve;exports.BwgRadio=Oe;exports.BwgRangePicker=Me;exports.BwgSearch=Be;exports.BwgSelect=Ue;exports.BwgSwitch=Te;exports.BwgTextArea=Re;exports.BwgUploader=He;exports.DraggableUploadListItem=fe;exports.defaultIconRender=ne;exports.defaultItemRender=te;
@@ -19,11 +19,12 @@ export { default as BwgSelect } from './BwgSelect';
19
19
  export { default as BwgSwitch } from './BwgSwitch';
20
20
  export { default as BwgTextArea } from './BwgTextArea';
21
21
  export { default as BwgEmpSearch } from './BwgEmpSearch';
22
- export { default as BwgXlsxUploader } from './BwgXlsxUploader';
23
22
  export { default as BwgDeptSearch } from './BwgDeptSearch';
24
23
  export { DraggableUploadListItem, defaultItemRender, defaultIconRender, } from './BwgCmnFileItems';
25
24
  export { default as BwgUploader } from './BwgUploader';
26
25
  export { default as BwgDraggerUploader } from './BwgDraggerUploader';
26
+ export { default as BwgExcelUploaderBatch } from './BwgExcelUploaderBatch';
27
+ export { default as BwgExcelUploaderService } from './BwgExcelUploaderService';
27
28
  export type { BwgButtonProps } from './BwgButton';
28
29
  export type { BwgCheckBoxProps, BwgCheckProps } from './BwgCheck';
29
30
  export type { BwgCheckboxGroupProps, BwgCheckListProps } from './BwgCheckList';
@@ -44,10 +45,11 @@ export type { BwgSearchProps } from './BwgSearch';
44
45
  export type { BwgSelectProps, SelectBoxProps } from './BwgSelect';
45
46
  export type { BwgTextAreaProps } from './BwgTextArea';
46
47
  export type { BwgEmpSearchProps } from './BwgEmpSearch';
47
- export type { BwgXlsxUploaderProps } from './BwgXlsxUploader';
48
48
  export type { BwgDeptSearchProps } from './BwgDeptSearch';
49
49
  export type { BwgCommonUploaderProps } from './BwgCmnFileItems';
50
50
  export type { DraggableUploadListItemProps } from './BwgCmnFileItems';
51
51
  export type { BwgUploaderProps } from './BwgUploader';
52
52
  export type { BwgDraggerUploaderProps } from './BwgDraggerUploader';
53
+ export type { BwgExcelUploaderBatchProps } from './BwgExcelUploaderBatch';
54
+ export type { BwgExcelUploaderServiceProps } from './BwgExcelUploaderService';
53
55
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/core/index.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/core/index.ts"],"names":[],"mappings":"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"}