@bwg-ui/core 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{common-components-CI7wc_j0.js → common-components-CKPZB7JH.js} +1360 -1355
- package/dist/chunks/{common-components-cQcq2ylW.cjs → common-components-Cw7pbhrp.cjs} +14 -14
- package/dist/chunks/{core-xi9w8O3O.js → core-C2wEZy2f.js} +1 -1
- package/dist/chunks/{core-Cg6a-3GL.cjs → core-DfOWJ6JQ.cjs} +1 -1
- package/dist/chunks/{enc-base64-CyKdjNg8.js → enc-base64-BNbm__mu.js} +2 -2
- package/dist/chunks/{enc-base64-BR77UbCA.cjs → enc-base64-DPfS87kE.cjs} +1 -1
- package/dist/chunks/{sha256-DA5XnjXl.cjs → sha256-BXXaP9RF.cjs} +1 -1
- package/dist/chunks/{sha256-DmQY-nMP.js → sha256-ZWZAX8tH.js} +2 -2
- package/dist/components/common/index.cjs +1 -1
- package/dist/components/common/index.js +1 -1
- package/dist/components/core/BwgUploader.d.ts +31 -6
- package/dist/components/core/BwgUploader.d.ts.map +1 -1
- package/dist/components/core/index.cjs +1 -1
- package/dist/components/core/index.js +520 -453
- package/dist/components/guide/index.cjs +1 -1
- package/dist/components/guide/index.js +1 -1
- package/dist/components/layout/index.cjs +1 -1
- package/dist/components/layout/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/styles/assets/images/header/icon/ico-bell.svg +3 -3
- package/dist/styles/assets/images/header/icon/ico-logout.svg +10 -10
- package/dist/styles/assets/images/header/icon/ico-setting.svg +4 -4
- package/dist/styles/assets/images/header/icon/ico-sidebar-arrow.svg +3 -3
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.js +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as I, c as B } from "./common-components-
|
|
1
|
+
import { b as I, c as B } from "./common-components-CKPZB7JH.js";
|
|
2
2
|
function W(y) {
|
|
3
3
|
throw new Error('Could not dynamically require "' + y + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
4
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const p=require("./common-components-
|
|
1
|
+
"use strict";const p=require("./common-components-Cw7pbhrp.cjs");function H(v){throw new Error('Could not dynamically require "'+v+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var y={exports:{}};const I={},W=Object.freeze(Object.defineProperty({__proto__:null,default:I},Symbol.toStringTag,{value:"Module"})),E=p.getAugmentedNamespace(W);var O=y.exports,C;function P(){return C||(C=1,(function(v,T){(function(g,c){v.exports=c()})(O,function(){var g=g||(function(c,S){var s;if(typeof window<"u"&&window.crypto&&(s=window.crypto),typeof self<"u"&&self.crypto&&(s=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(s=globalThis.crypto),!s&&typeof window<"u"&&window.msCrypto&&(s=window.msCrypto),!s&&typeof p.commonjsGlobal<"u"&&p.commonjsGlobal.crypto&&(s=p.commonjsGlobal.crypto),!s&&typeof H=="function")try{s=E}catch{}var R=function(){if(s){if(typeof s.getRandomValues=="function")try{return s.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof s.randomBytes=="function")try{return s.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},z=Object.create||(function(){function t(){}return function(r){var e;return t.prototype=r,e=new t,t.prototype=null,e}})(),l={},d=l.lib={},f=d.Base=(function(){return{extend:function(t){var r=z(this);return t&&r.mixIn(t),(!r.hasOwnProperty("init")||this.init===r.init)&&(r.init=function(){r.$super.init.apply(this,arguments)}),r.init.prototype=r,r.$super=this,r},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var r in t)t.hasOwnProperty(r)&&(this[r]=t[r]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),u=d.WordArray=f.extend({init:function(t,r){t=this.words=t||[],r!=S?this.sigBytes=r:this.sigBytes=t.length*4},toString:function(t){return(t||q).stringify(this)},concat:function(t){var r=this.words,e=t.words,n=this.sigBytes,i=t.sigBytes;if(this.clamp(),n%4)for(var o=0;o<i;o++){var w=e[o>>>2]>>>24-o%4*8&255;r[n+o>>>2]|=w<<24-(n+o)%4*8}else for(var a=0;a<i;a+=4)r[n+a>>>2]=e[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=c.ceil(r/4)},clone:function(){var t=f.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var r=[],e=0;e<t;e+=4)r.push(R());return new u.init(r,t)}}),m=l.enc={},q=m.Hex={stringify:function(t){for(var r=t.words,e=t.sigBytes,n=[],i=0;i<e;i++){var o=r[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((o&15).toString(16))}return n.join("")},parse:function(t){for(var r=t.length,e=[],n=0;n<r;n+=2)e[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new u.init(e,r/2)}},_=m.Latin1={stringify:function(t){for(var r=t.words,e=t.sigBytes,n=[],i=0;i<e;i++){var o=r[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(t){for(var r=t.length,e=[],n=0;n<r;n++)e[n>>>2]|=(t.charCodeAt(n)&255)<<24-n%4*8;return new u.init(e,r)}},k=m.Utf8={stringify:function(t){try{return decodeURIComponent(escape(_.stringify(t)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(t){return _.parse(unescape(encodeURIComponent(t)))}},x=d.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(t){typeof t=="string"&&(t=k.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(t){var r,e=this._data,n=e.words,i=e.sigBytes,o=this.blockSize,w=o*4,a=i/w;t?a=c.ceil(a):a=c.max((a|0)-this._minBufferSize,0);var h=a*o,b=c.min(h*4,i);if(h){for(var B=0;B<h;B+=o)this._doProcessBlock(n,B);r=n.splice(0,h),e.sigBytes-=b}return new u.init(r,b)},clone:function(){var t=f.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});d.Hasher=x.extend({cfg:f.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){x.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var r=this._doFinalize();return r},blockSize:16,_createHelper:function(t){return function(r,e){return new t.init(e).finalize(r)}},_createHmacHelper:function(t){return function(r,e){return new j.HMAC.init(t,e).finalize(r)}}});var j=l.algo={};return l})(Math);return g})})(y)),y.exports}exports.requireCore=P;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as A } from "./common-components-
|
|
2
|
-
import { r as b } from "./core-
|
|
1
|
+
import { g as A } from "./common-components-CKPZB7JH.js";
|
|
2
|
+
import { r as b } from "./core-C2wEZy2f.js";
|
|
3
3
|
function O(p, g) {
|
|
4
4
|
for (var f = 0; f < g.length; f++) {
|
|
5
5
|
const a = g[f];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const A=require("./common-components-
|
|
1
|
+
"use strict";const A=require("./common-components-Cw7pbhrp.cjs"),b=require("./core-DfOWJ6JQ.cjs");function O(u,g){for(var c=0;c<g.length;c++){const a=g[c];if(typeof a!="string"&&!Array.isArray(a)){for(const f in a)if(f!=="default"&&!(f in u)){const i=Object.getOwnPropertyDescriptor(a,f);i&&Object.defineProperty(u,f,i.get?i:{enumerable:!0,get:()=>a[f]})}}}return Object.freeze(Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}))}var h={exports:{}},q=h.exports,B;function E(){return B||(B=1,(function(u,g){(function(c,a){u.exports=a(b.requireCore())})(q,function(c){return(function(){var a=c,f=a.lib,i=f.WordArray,C=a.enc;C.Base64={stringify:function(t){var s=t.words,o=t.sigBytes,n=this._map;t.clamp();for(var e=[],r=0;r<o;r+=3)for(var v=s[r>>>2]>>>24-r%4*8&255,l=s[r+1>>>2]>>>24-(r+1)%4*8&255,d=s[r+2>>>2]>>>24-(r+2)%4*8&255,y=v<<16|l<<8|d,p=0;p<4&&r+p*.75<o;p++)e.push(n.charAt(y>>>6*(3-p)&63));var m=n.charAt(64);if(m)for(;e.length%4;)e.push(m);return e.join("")},parse:function(t){var s=t.length,o=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var e=0;e<o.length;e++)n[o.charCodeAt(e)]=e}var r=o.charAt(64);if(r){var v=t.indexOf(r);v!==-1&&(s=v)}return _(t,s,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function _(t,s,o){for(var n=[],e=0,r=0;r<s;r++)if(r%4){var v=o[t.charCodeAt(r-1)]<<r%4*2,l=o[t.charCodeAt(r)]>>>6-r%4*2,d=v|l;n[e>>>2]|=d<<24-e%4*8,e++}return i.create(n,e)}})(),c.enc.Base64})})(h)),h.exports}var x=E();const w=A.getDefaultExportFromCjs(x),M=O({__proto__:null,default:w},[x]);exports.encBase64=M;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const N=require("./common-components-
|
|
1
|
+
"use strict";const N=require("./common-components-Cw7pbhrp.cjs"),R=require("./core-DfOWJ6JQ.cjs");function T(d,g){for(var c=0;c<g.length;c++){const t=g[c];if(typeof t!="string"&&!Array.isArray(t)){for(const n in t)if(n!=="default"&&!(n in d)){const h=Object.getOwnPropertyDescriptor(t,n);h&&Object.defineProperty(d,n,h.get?h:{enumerable:!0,get:()=>t[n]})}}}return Object.freeze(Object.defineProperty(d,Symbol.toStringTag,{value:"Module"}))}var A={exports:{}},K=A.exports,j;function L(){return j||(j=1,(function(d,g){(function(c,t){d.exports=t(R.requireCore())})(K,function(c){return(function(t){var n=c,h=n.lib,O=h.WordArray,H=h.Hasher,x=n.algo,q=[],w=[];(function(){function i(o){for(var f=t.sqrt(o),l=2;l<=f;l++)if(!(o%l))return!1;return!0}function v(o){return(o-(o|0))*4294967296|0}for(var r=2,e=0;e<64;)i(r)&&(e<8&&(q[e]=v(t.pow(r,1/2))),w[e]=v(t.pow(r,1/3)),e++),r++})();var u=[],B=x.SHA256=H.extend({_doReset:function(){this._hash=new O.init(q.slice(0))},_doProcessBlock:function(i,v){for(var r=this._hash.words,e=r[0],o=r[1],f=r[2],l=r[3],s=r[4],y=r[5],b=r[6],S=r[7],a=0;a<64;a++){if(a<16)u[a]=i[v+a]|0;else{var p=u[a-15],W=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,_=u[a-2],D=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;u[a]=W+u[a-7]+D+u[a-16]}var F=s&y^~s&b,$=e&o^e&f^o&f,k=(e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22),z=(s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25),P=S+z+F+w[a]+u[a],E=k+$;S=b,b=y,y=s,s=l+P|0,l=f,f=o,o=e,e=P+E|0}r[0]=r[0]+e|0,r[1]=r[1]+o|0,r[2]=r[2]+f|0,r[3]=r[3]+l|0,r[4]=r[4]+s|0,r[5]=r[5]+y|0,r[6]=r[6]+b|0,r[7]=r[7]+S|0},_doFinalize:function(){var i=this._data,v=i.words,r=this._nDataBytes*8,e=i.sigBytes*8;return v[e>>>5]|=128<<24-e%32,v[(e+64>>>9<<4)+14]=t.floor(r/4294967296),v[(e+64>>>9<<4)+15]=r,i.sigBytes=v.length*4,this._process(),this._hash},clone:function(){var i=H.clone.call(this);return i._hash=this._hash.clone(),i}});n.SHA256=H._createHelper(B),n.HmacSHA256=H._createHmacHelper(B)})(Math),c.SHA256})})(A)),A.exports}var C=L();const G=N.getDefaultExportFromCjs(C),I=T({__proto__:null,default:G},[C]);exports.sha256=I;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as N } from "./common-components-
|
|
2
|
-
import { r as R } from "./core-
|
|
1
|
+
import { g as N } from "./common-components-CKPZB7JH.js";
|
|
2
|
+
import { r as R } from "./core-C2wEZy2f.js";
|
|
3
3
|
function T(p, A) {
|
|
4
4
|
for (var c = 0; c < A.length; c++) {
|
|
5
5
|
const t = A[c];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/common-components-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/common-components-Cw7pbhrp.cjs"),o=require("../../utils/index.cjs");exports.BwgButtonGroup=e.BwgButtonGroup;exports.BwgCmptArea=e.BwgCmptArea;exports.BwgCol=e.BwgCol;exports.BwgConfigProvider=e.BwgConfigProvider;exports.BwgDetail=e.BwgDetail;exports.BwgDrawer=e.BwgDrawer;exports.BwgEditor=e.BwgEditor;exports.BwgGrid=e.BwgGrid;exports.BwgInfoArea=e.BwgInfoArea;exports.BwgPagination=e.BwgPagination;exports.BwgPopup=e.BwgPopup;exports.BwgRow=e.BwgRow;exports.BwgSpace=e.BwgSpace;exports.BwgTable=e.BwgTable;exports.BwgTabs=e.BwgTabs;exports.BwgTitleBox=e.BwgTitleBox;exports.BwgView=e.BwgView;exports.ContentBox=e.ContentBox;exports.ContentLayOut=e.ContentLayOut;exports.GlobalConfigProvider=e.GlobalConfigProvider;exports.QuickServiceToggle=e.QuickServiceToggle;exports.SSOHandler=e.SSOHandler;exports.SearchBox=e.SearchBox;exports.createBwgGridRenderer=e.createBwgGridRenderer;exports.realFormat=o.realFormat;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as s, e as o, f as r, B as g, h as B, i as w, j as t, k as i, l as n, m as l, n as d, o as p, a as C, p as f, q as u, r as S, s as c, C as m, t as x, G, Q as v, u as P, S as T, v as b } from "../../chunks/common-components-
|
|
1
|
+
import { d as s, e as o, f as r, B as g, h as B, i as w, j as t, k as i, l as n, m as l, n as d, o as p, a as C, p as f, q as u, r as S, s as c, C as m, t as x, G, Q as v, u as P, S as T, v as b } from "../../chunks/common-components-CKPZB7JH.js";
|
|
2
2
|
import { realFormat as k } from "../../utils/index.js";
|
|
3
3
|
export {
|
|
4
4
|
s as BwgButtonGroup,
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import { UploadFile } from 'antd/es/upload';
|
|
1
2
|
import { FC } from 'react';
|
|
3
|
+
import { BwgFormItemProps } from './BwgFormItem';
|
|
2
4
|
export interface BwgUploaderProps {
|
|
5
|
+
/**
|
|
6
|
+
* Form.Item 속성
|
|
7
|
+
*/
|
|
8
|
+
itemProps?: BwgFormItemProps;
|
|
3
9
|
/**
|
|
4
10
|
* 선/후처리 서비스에 전달할 파일 그룹 키입니다.
|
|
5
11
|
* 선처리 : 파일 목록조회
|
|
@@ -10,13 +16,13 @@ export interface BwgUploaderProps {
|
|
|
10
16
|
* 파일 업로드 완료 시 호출되는 콜백 함수입니다.
|
|
11
17
|
*/
|
|
12
18
|
onUploadComplete?: (fileDetails: {
|
|
13
|
-
fileNameP
|
|
14
|
-
fileNameL
|
|
15
|
-
filePath
|
|
16
|
-
fileSize
|
|
17
|
-
fileExt
|
|
19
|
+
fileNameP?: string;
|
|
20
|
+
fileNameL?: string;
|
|
21
|
+
filePath?: string;
|
|
22
|
+
fileSize?: number;
|
|
23
|
+
fileExt?: string;
|
|
18
24
|
fileGrpKey: string;
|
|
19
|
-
fileKey
|
|
25
|
+
fileKey?: string;
|
|
20
26
|
}) => void;
|
|
21
27
|
/**
|
|
22
28
|
* 파일 목록을 조회하는 거래코드.
|
|
@@ -54,6 +60,24 @@ export interface BwgUploaderProps {
|
|
|
54
60
|
* @default false
|
|
55
61
|
*/
|
|
56
62
|
multiple?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* 파일목록 수정시 새로운 fileGrpKey 채번 여부
|
|
65
|
+
*/
|
|
66
|
+
newFileGrpKeyonModify?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* 파일 선택 버튼 텍스트
|
|
69
|
+
* @default "파일 선택"
|
|
70
|
+
*/
|
|
71
|
+
buttonText?: string;
|
|
72
|
+
/**
|
|
73
|
+
* 서버 업로드를 수행하지 않고 로컬에서만 파일을 보관합니다.
|
|
74
|
+
* 이 모드에서는 API 호출을 하지 않으며 선택/제거/정렬 결과의 파일 목록을 그대로 반환합니다.
|
|
75
|
+
*/
|
|
76
|
+
localOnly?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* localOnly 모드에서 파일 목록이 변경될 때 호출됩니다.
|
|
79
|
+
*/
|
|
80
|
+
onFilesChange?: (files: UploadFile[]) => void;
|
|
57
81
|
}
|
|
58
82
|
/**
|
|
59
83
|
* BwgUploader 컴포넌트
|
|
@@ -67,6 +91,7 @@ export interface BwgUploaderProps {
|
|
|
67
91
|
* @param allowedExtensions - 허용 파일 확장자
|
|
68
92
|
* @param maxFileSize - 최대 파일 크기
|
|
69
93
|
* @param showButton - 파일 선택 버튼 표시 여부
|
|
94
|
+
* @param buttonText - 파일 선택 버튼 텍스트
|
|
70
95
|
*/
|
|
71
96
|
declare const BwgUploader: FC<BwgUploaderProps>;
|
|
72
97
|
export default BwgUploader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BwgUploader.d.ts","sourceRoot":"","sources":["../../../src/components/core/BwgUploader.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BwgUploader.d.ts","sourceRoot":"","sources":["../../../src/components/core/BwgUploader.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAU,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EAEL,EAAE,EAKH,MAAM,OAAO,CAAC;AAIf,OAAoB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAsB9D,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,WAAW,EAAE;QAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,KAAK,IAAI,CAAC;IACX;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;CAC/C;AAqGD;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CA8arC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),n=require("antd"),g=require("react"),N=require("dayjs"),E=require("@ant-design/icons"),O=require("lodash"),_=require("../../utils/index.cjs"),G=require("jszip"),K=require("imask"),J=require("../../stores/index.cjs"),z=require("react-dnd"),W=require("react-dnd-html5-backend"),X=t=>r.jsx(n.Button,{...t,className:"bwg-btn"}),B=g.memo(({children:t,label:e,name:l,rules:i,initialValue:o,style:s,...u})=>{const a={fontWeight:"bold"},m=Array.isArray(i)&&i.some(S=>S.required===!0),c=()=>typeof e=="string"?r.jsxs("span",{style:a,children:[e,m&&r.jsx("span",{style:{color:"#ff4d4f",marginLeft:"4px"},children:"*"})]}):r.jsx("span",{style:a,children:e});return r.jsx(n.Form.Item,{className:"bwg-form-item",label:e?c():void 0,labelAlign:"left",name:l,rules:i,colon:!1,initialValue:o,style:s,...u,children:t})}),Z=({itemProps:t,inputProps:e={format:"YN"}})=>{const l=n.Form.useFormInstance(),i=o=>{e.format==="boolean"?l.setFieldValue(t?.name,o.target.checked):l.setFieldValue(t?.name,o.target.checked?"Y":"N"),e.onChange&&e.onChange(o)};return r.jsx(B,{...t,getValueProps:o=>({checked:e.format==="boolean"?!!o:o==="Y"}),normalize:o=>typeof o=="boolean"?e.format==="boolean"?o:o?"Y":"N":e.format==="boolean"?!!o:o?"Y":"N",children:r.jsx(n.Checkbox,{...e,onChange:i,children:e?.title})})},Q=({itemProps:t,inputProps:e})=>{const l=n.Form.useFormInstance(),[i,o]=g.useState(t?.initialValue??[]),[s,u]=g.useState([]),a=s.length>0&&s.length==i?.length,m=i?.length>0&&i.length<s.length;g.useEffect(()=>{u(c(e?.options))},[e?.options]),g.useEffect(()=>{o(i)},[i]);const c=y=>{const I=[];return(y||[]).map((D,k)=>{I.push(D.value)}),I},S=y=>{o(y.target.checked?s:[]),l.setFieldValue(t?.name,y.target.checked?s:[])},j=y=>{o(y),l.setFieldValue(t?.name,y),e?.onChange&&typeof e?.onChange=="function"&&e?.onChange(y)};return r.jsx(B,{...t,children:r.jsxs(n.ConfigProvider,{theme:{components:{Checkbox:{colorPrimary:"var(--check-primary)",colorPrimaryBorder:"var(--check-primary)",colorPrimaryHover:"var(--check-primary-active)"}}},children:[e?.allCheck&&r.jsx(n.Checkbox,{indeterminate:m,checked:a,onChange:S,children:"전체선택"}),r.jsx(n.Checkbox.Group,{options:e?.options,value:i,onChange:j})]})})},A={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"}},ee=({itemProps:t,inputProps:e,type:l="date",returnType:i="string"})=>{const{displayFormat:o,outputFormat:s}=g.useMemo(()=>A[l],[l]),u=g.useMemo(()=>Object.values(A).map(a=>a.outputFormat).sort((a,m)=>{if(a.length===m.length){if(a===s)return-1;if(m===s)return 1}return m.length-a.length}),[s]);return r.jsx(B,{...t,getValueProps:a=>({value:a?N.isDayjs(a)?a:N(a,u):null}),normalize:a=>a?i==="dayjs"?a:a.format(s):null,children:r.jsx(n.DatePicker,{...e,picker:l==="datetime"?"date":l,showTime:e?.showTime??(l==="datetime"||l==="time"),format:o})})},te=({fileGrpKey:t,onFetchFilesTrxCd:e="SCMFILE00101",readOnly:l=!1,sysCd:i=__SYS_CD__})=>{const[o,s]=g.useState([]);g.useEffect(()=>{t&&e?i!=__SYS_CD__?_.callService_SYSCD(i,e,{crprCd:_.getUserInfo()?.crprCd,sysCd:i,fileGrpKey:t}).then(a=>{if(a?.sub){const m=a.sub.map(c=>({uid:c.fileKey,name:c.lgclFileNm,filePath:c.filePath}));s(m)}}).catch(a=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",a),n.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")}):_.callService(e,{crprCd:_.getUserInfo()?.crprCd,sysCd:i,fileGrpKey:t}).then(a=>{if(a?.sub){const m=a.sub.map(c=>({uid:c.fileKey,name:c.lgclFileNm,filePath:c.filePath}));s(m)}}).catch(a=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",a),n.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")}):s([])},[t,e]);const u=async a=>{try{let m;i!=__SYS_CD__?m="/api/download/"+i:m="/api/download";const c=await fetch(m,{method:"POST",headers:{SYSCD:__SYS_CD__,"Content-Type":"application/json"},body:JSON.stringify({filePath:a.filePath,logicalName:a.name,fileKey:a.uid})});if(!c.ok){const D=(await c.json().catch(()=>null))?.message||"파일 다운로드에 실패했습니다.";throw new Error(D)}const S=await c.blob(),j=window.URL.createObjectURL(S),y=document.createElement("a");y.href=j,y.setAttribute("download",a.name),document.body.appendChild(y),y.click(),document.body.removeChild(y),window.URL.revokeObjectURL(j)}catch(m){console.error(m),n.message.error(m.message||"파일을 다운로드하는 중 오류가 발생했습니다.")}};return O.isEmpty(o)?null:r.jsx(n.Card,{title:"파일 목록",children:r.jsx(n.List,{dataSource:o,renderItem:a=>r.jsx(n.List.Item,{actions:l?[]:[r.jsx(n.Button,{type:"text",icon:r.jsx(E.DownloadOutlined,{}),onClick:()=>u(a)},"download")],children:r.jsx(n.List.Item.Meta,{avatar:r.jsx(E.PaperClipOutlined,{}),title:a.name})})})})},P=g.forwardRef(({children:t,labelCol:e,style:l,className:i,...o},s)=>r.jsx(n.ConfigProvider,{form:{validateMessages:{required:"'${label}을(를) 입력해주세요.'"}},children:r.jsx(n.Form,{ref:s,...o,requiredMark:!1,labelCol:e||{flex:"100px"},style:{padding:"10px",...l},className:`bwg-form ${i??""}`,children:t})}));P.displayName="BwgForm";const re=({itemProps:t,inputProps:e})=>r.jsx(B,{...t,children:r.jsx(n.Input,{...e})}),{Text:T}=n.Typography,{Dragger:ne}=n.Upload,oe=[".pdf",".xlsx",".xls",".docx",".doc",".pptx",".ppt",".hwp",".txt",".csv",".jpg",".jpeg",".png",".gif",".zip"],se=(t,e=2)=>{if(t===0)return"0 Bytes";const l=1024,i=e<0?0:e,o=["Bytes","KB","MB","GB","TB"],s=Math.floor(Math.log(t)/Math.log(l));return parseFloat((t/Math.pow(l,s)).toFixed(i))+" "+o[s]},ae=({title:t="첨부파일",fileGrpKey:e,onUploadComplete:l,onSuccessTrxCd:i="SCMFILE00102",anotherServiceTrxCd:o="SCMFILE00105",allowedExtensions:s=oe,maxFileSize:u=2048})=>{const[a,m]=g.useState([]),[c,S]=g.useState(!1),[j,y]=g.useState(!1),[I,D]=g.useState(0),k=f=>{if(s&&s.length>0){const d=(x=>{const p=x.lastIndexOf(".");return p===-1?"":x.substring(p).toLowerCase()})(f.name);if(!s.includes(d))return n.message.error(`${f.name} 파일은 허용되지 않는 확장자입니다. (${s.join(", ")}만 가능)`),!1}return!0},v=async()=>{const f=a.filter(h=>h.status!=="done"),L=f.reduce((h,w)=>h+(w.size||0),0),d=2*1024*1024*1024;if(L>d){n.notification.error({message:"업로드 용량 초과",description:"한 번에 업로드할 수 있는 총 파일 용량은 2GB를 초과할 수 없습니다."});return}if(f.length===0){n.message.warning("업로드할 파일이 없거나 모든 파일이 이미 업로드되었습니다.");return}y(!0);let x;try{const h=new G;f.forEach(w=>{w.originFileObj&&h.file(w.name,w.originFileObj)}),x=await h.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:9}})}catch(h){y(!1),n.message.error("파일을 압축하는 중 오류가 발생했습니다."),console.error("Zipping error:",h);return}y(!1);const p=new FormData;p.append("file",x,"upload.zip"),S(!0),D(0);try{const h=await new Promise((Y,b)=>{const M=new XMLHttpRequest;M.open("POST","/api/upload-large",!0),M.upload.onprogress=C=>{if(C.lengthComputable){const U=Math.round(C.loaded/C.total*100);D(U)}},M.onload=()=>{if(M.status>=200&&M.status<300)try{const C=JSON.parse(M.responseText);C.success?Y(C):b(new Error(C.message||"파일 업로드에 실패했습니다."))}catch{b(new Error("잘못된 서버 응답입니다."))}else try{const C=JSON.parse(M.responseText);b(new Error(C.message||`서버 오류: ${M.status}`))}catch{b(new Error(`서버 오류: ${M.status}`))}},M.onerror=()=>{b(new Error("네트워크 오류가 발생했습니다."))},M.send(p)});n.message.success(h.message||"압축 파일이 성공적으로 업로드되었습니다.");const w=a.map(Y=>f.find(b=>b.uid===Y.uid)?{...Y,status:"done"}:Y);if(m(w),i&&h.uploadedFiles&&Array.isArray(h.uploadedFiles)){const Y=_.getUserInfo();h.uploadedFiles.forEach(b=>{const M={crprCd:Y?.crprCd,sysCd:__SYS_CD__,fileGrpKey:e,sub:[{crprCd:Y?.crprCd,sysCd:__SYS_CD__,fileGrpKey:e,physFileNm:b.fileNameP,lgclFileNm:b.fileNameL,filePath:b.filePath,fileExtn:b.fileExt,fileSize:b.fileSize,mltpYn:"Y"}]};_.callService(i,M).then(C=>{const U=a.map(R=>({crprCd:Y?.crprCd,sysCd:__SYS_CD__,fileGrpKey:C.sub[0].fileGrpKey,fileKey:C.sub[0].fileKey,lgclFileNm:R.name,fileSize:R.size,fileExtn:R.name.split(".").pop(),fileType:R.type}));_.callService(o,{sub:U})}).catch(C=>{console.error("후처리 서비스 호출 실패:",C),n.message.error(`${b.fileNameL} 파일의 후처리 작업에 실패했습니다.`)}),l&&l({fileNameP:b.fileNameP,fileNameL:b.fileNameL})})}}catch(h){n.message.error(h.message||"파일 업로드 중 오류가 발생했습니다.");const w=a.map(Y=>f.find(b=>b.uid===Y.uid)?{...Y,status:"error",response:h.message||"파일 업로드 중 오류가 발생했습니다."}:Y);m(w)}finally{S(!1)}},F={multiple:!0,fileList:a,beforeUpload:f=>k(f)?u&&f.size>=u*1024*1024?(n.message.error(`대용량 첨부 파일 최대 크기는 ${(u/1024).toFixed(1)}GB입니다.`),n.Upload.LIST_IGNORE):!1:n.Upload.LIST_IGNORE,onChange:({fileList:f})=>{const L=new Map(a.map(d=>[d.uid,d]));f.forEach(d=>{L.set(d.uid,d)}),m(Array.from(L.values()))},onRemove:f=>{const L=a.filter(d=>d.uid!==f.uid);m(L)},showUploadList:!1};return r.jsx(n.Spin,{spinning:c||j,tip:j?"파일 압축 중...":`파일 업로드 중... ${I}%`,children:r.jsxs("div",{className:"bwg-large-uploader-container",children:[r.jsx(n.Card,{title:r.jsx(T,{strong:!0,children:t}),extra:r.jsx(n.Upload,{...F,children:r.jsx(n.Button,{icon:r.jsx(E.UploadOutlined,{}),children:"파일 선택"})}),bodyStyle:{padding:0},children:r.jsx(ne,{...F,style:{border:"none",background:"transparent",padding:0},children:r.jsx("div",{className:"upload-list-container",children:a.length>0?r.jsx(n.List,{style:{textAlign:"left"},dataSource:a,renderItem:f=>{const L=f.status==="done",d=f.status==="error";let x;return L?x=r.jsx(E.CheckCircleOutlined,{style:{color:"#52c41a",fontSize:14}}):d?x=r.jsx(n.Tooltip,{title:typeof f.response=="string"?f.response:"업로드 실패",children:r.jsx(E.CloseCircleOutlined,{style:{color:"#ff4d4f",fontSize:14}})}):x=r.jsx(E.FileTextOutlined,{style:{fontSize:14}}),r.jsx(n.List.Item,{actions:[r.jsx(T,{type:"secondary",children:se(f.size||0)},"size"),r.jsx(n.Button,{type:"text",icon:r.jsx(E.DeleteOutlined,{}),onClick:p=>{p.stopPropagation(),F.onRemove?.(f)},disabled:c||j},"delete")],children:r.jsx(n.List.Item.Meta,{avatar:x,title:r.jsx(T,{type:d?"danger":void 0,children:f.name})})},f.uid)}}):r.jsxs(n.Flex,{gap:"middle",align:"center",justify:"center",vertical:!0,style:{padding:"20px 0",minHeight:"120px"},children:[r.jsx(E.InboxOutlined,{style:{fontSize:"32px",color:"#999"}}),r.jsx(T,{type:"secondary",children:"업로드할 파일을 선택하거나 이 영역으로 드래그하세요."})]})})})}),a.length>0&&r.jsxs(n.Flex,{justify:"flex-end",align:"center",gap:"large",style:{marginTop:16},children:[c&&r.jsx("div",{style:{width:"250px"},children:r.jsx(n.Progress,{percent:I,size:"small"})}),r.jsx(n.Button,{type:"primary",onClick:v,disabled:c||j||a.filter(f=>f.status!=="done").length===0,icon:r.jsx(E.CloudUploadOutlined,{}),children:"일괄 업로드"})]})]})})},ie=t=>{if(typeof t=="string")return t.replace(/0/g,"_");if(Array.isArray(t))return t[0].replace(/0/g,"_");if(typeof t=="object"&&"mask"in t&&"blocks"in t){const{mask:e,blocks:l}=t;return e.split(".").map(i=>{const s=l?.[i]?.maxLength??3;return"_".repeat(s)}).join(".")}return""},le=({itemProps:t,inputProps:e,mask:l})=>{const i=g.useRef(null),o=n.Form.useFormInstance(),s=g.useMemo(()=>ie(l),[l]);return g.useEffect(()=>{if(!i.current?.input)return;const u=typeof l=="string"||Array.isArray(l)?{mask:l}:l,a=K(i.current.input,u);return a.on("accept",()=>{o&&t?.name&&o.setFieldValue(t.name,a.value)}),()=>{a.destroy()}},[l,o,t?.name]),r.jsx(B,{...t,children:r.jsx(n.Input,{...e,ref:i,placeholder:s})})},ce=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"}}},de=({type:t="date",itemProps:e={name:"calendar"},inputProps:l})=>{const{format:i,mask:o,outputFormat:s}=ce(t),u=g.useRef(null),a=g.useRef(null),m=n.Form.useFormInstance(),[c,S]=g.useState(!1),[j,y]=g.useState(!1),I=e?.name,[D,k]=g.useState(null);g.useEffect(()=>{if(!u.current?.input)return;const F=K(u.current.input,{mask:o,lazy:!1});return a.current=F,F.on("accept",()=>{console.log("input :: ",F.value);const f=F.value,L=N(f,i,!0);console.log("input :: ",L),f.length===i.length&&L.isValid()&&(console.log("parsed :: ",L.format(s)),m.setFieldValue(I,L.format(s)),a.current?.updateValue(),S(!1))}),()=>{F.destroy()}},[i,o]),g.useEffect(()=>{k(N(m.getFieldValue(I)))},[m.getFieldValue(I)]);const v=F=>{if(!F){a.current?.updateValue();return}const f=F.format(s);console.log("formatted :: ",f),a.current&&(a.current.value=f,a.current.updateValue()),y(!1)};return r.jsx(B,{...e,name:void 0,validateStatus:j?"warning":void 0,help:j?"유효하지 않은 날짜입니다":void 0,children:r.jsxs("div",{style:{position:"relative"},children:[r.jsx(n.Form.Item,{name:I,getValueProps:F=>({value:F?N(F).format(i):void 0}),normalize:F=>F?N(F).format(s):void 0,noStyle:!0,children:r.jsx(n.Input,{...l,ref:u,onFocus:()=>{S(!c),a.current?.updateValue()},onKeyDown:F=>{F.key==="Backspace"&&S(!0),F.key==="Tab"&&S(!1)},allowClear:!0,placeholder:o.replace(/0/g,"_"),autoComplete:"off"})}),r.jsx(n.DatePicker,{open:c,picker:t,format:i,value:D,onChange:v,getPopupContainer:F=>F.parentElement,style:{position:"absolute",top:0,left:0,pointerEvents:"none",opacity:0,width:"100%"}})]})})},{Option:V}=n.Select,ue=({itemProps:t,inputProps:e})=>{const[l,i]=g.useState([]);return g.useEffect(()=>{e?.addField==="ALL"?i([{label:"전체",value:""},...e?.list||[]]):e?.addField==="NULL"?i([{label:"",value:""},...e?.list||[]]):i(e?.list||[])},[e?.list]),r.jsx(B,{...t,getValueProps:o=>o?{value:o&&o.indexOf(",")>0?o.split(","):[o]}:{value:[]},normalize:o=>o!=null&&o!=null&&o.length>0?o.toString():"",children:r.jsx(n.Select,{...e,mode:"multiple",children:l.map(o=>{const{value:s,label:u}=o;return e?.printCode?r.jsx(V,{value:s,label:u,children:r.jsx(n.Space,{children:`[${s}] ${u}`})},s):r.jsx(V,{value:s,label:u,children:r.jsx(n.Space,{children:`${u}`})},s)})})})},me=({itemProps:t,inputProps:e})=>{const l=o=>{let s=o.toString().split(".");return e?.decimalPoint!=null&&s[1]!=null&&e?.decimalPoint>0?s[1].length>e?.decimalPoint?s[1]="."+s[1].substring(0,e?.decimalPoint):s[1]="."+s[1]:s[1]="",s[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")+s[1]},i=o=>{let s=o.toString().split(".");return e?.decimalPoint!=null&&s[1]!=null&&e?.decimalPoint>0?s[1].length>e?.decimalPoint?s[1]="."+s[1].substring(0,e?.decimalPoint):s[1]="."+s[1]:s[1]="",s[0].replace(/\$\s?|(,*)/g,"")+s[1]};return r.jsx(B,{...t,children:r.jsx(n.InputNumber,{...e,formatter:o=>l(o),parser:o=>i(o)})})},ge=({itemProps:t,inputProps:e})=>r.jsx(B,{...t,children:r.jsx(n.Radio.Group,{...e})}),{RangePicker:fe}=n.DatePicker,$={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"}},he=({itemProps:t,inputProps:e,type:l="date",minDate:i,maxDate:o,returnType:s="string"})=>{const{displayFormat:u,outputFormat:a}=g.useMemo(()=>$[l],[l]),m=g.useMemo(()=>Object.values($).map(c=>c.outputFormat).sort((c,S)=>{if(c.length===S.length){if(c===a)return-1;if(S===a)return 1}return S.length-c.length}),[a]);return r.jsx(B,{...t,getValueProps:c=>({value:c&&c.length>0?[c[0]?N.isDayjs(c[0])?c[0]:N(c[0],m):null,c[1]?N.isDayjs(c[1])?c[1]:N(c[1],m):null]:null}),normalize:c=>c?s==="dayjs"?[c[0]??void 0,c[1]??void 0]:[c[0]?c[0].format(a):void 0,c[1]?c[1].format(a):void 0]:[void 0,void 0],children:r.jsx(fe,{...e,order:!0,minDate:i?N(i,m):void 0,maxDate:o?N(o,m):void 0,picker:l==="datetime"?"date":l,showTime:e?.showTime??(l==="datetime"||l==="time"),format:u})})},H=n.Input.Search,pe=t=>{const e=n.Form.useFormInstance(),{openPopup:l}=J.usePopupStore(),i=t.itemProps?.name||[],o=t.popupConfig||{callback(u){console.log("callback data :: ",u),i.length>1?(e.setFieldValue(i[0],u.code),e.setFieldValue(i[1],u.name)):e.setFieldValue(i,u.code)}},s={...t,placeholder:typeof t.placeholder=="string"?t.placeholder:t.placeholder?.[0]||"",onChange:u=>{i.length>1&&e.setFieldValue(i[0],""),t.onChange?.(u)},onSearch:u=>{t.popuCd?l(t.popuCd,t.popupParams,o):t.onSearch?.(u)}};return i.length>1?r.jsx(B,{...t.itemProps,name:void 0,children:r.jsxs(n.Space.Compact,{block:!0,children:[r.jsx(n.Form.Item,{name:i[0],rules:t.itemProps?.rules,style:{width:"40%",marginBottom:0,marginInlineEnd:0},validateStatus:"",help:"",children:r.jsx(n.Input,{style:{color:"#999",backgroundColor:"#f5f5f5"},placeholder:t.placeholder?.[0]||"",readOnly:!0})}),r.jsx(n.Form.Item,{name:i[1],style:{width:"60%",marginBottom:0},children:r.jsx(H,{readOnly:t.readOnly,enterButton:r.jsx(n.Button,{icon:r.jsx(E.SearchOutlined,{}),disabled:t.readOnly}),...s})})]})}):r.jsx(B,{...t.itemProps,children:r.jsx(H,{...s})})},xe=({itemProps:t,selectProps:e={options:[],allowClear:!0}})=>{const l=n.Form.useFormInstance(),i=!!l,o=g.useMemo(()=>e?.addField==="ALL"?[{label:"전체",value:""},...e?.options||[]]:e?.addField==="NULL"?[{label:"",value:""},...e?.options||[]]:e?.options||[],[e.options,e.addField]),s=m=>{e.onChange?.(m)},u={...e,allowClear:e.allowClear??!0,options:o,onChange:s,variant:e.variant},a=r.jsx(n.Select,{...u,disabled:e.disabled});return e.copyable&&!i&&console.warn("BwgSelect: copyable 기능은 Form 컨텍스트 내에서만 사용 가능합니다."),e.copyable?r.jsx(B,{...t,name:void 0,children:r.jsxs(n.Space.Compact,{block:!0,children:[r.jsx(n.Form.Item,{name:t?.name,rules:t?.rules,style:{width:"100%",marginBottom:0},validateStatus:"",help:"",children:a}),r.jsx(n.Typography.Paragraph,{copyable:{text:i&&l?.getFieldValue(t?.name)?.toString()||"",tooltips:["코드복사","코드복사됨"]},style:{margin:0,backgroundColor:"#f5f5f5",borderRadius:"4px",border:"1px solid #d9d9d9",fontSize:"12px",color:"#666",display:"flex",alignItems:"center",height:"30px",padding:"0 8px"}})]})}):r.jsx(B,{...t,children:a})},ye=({itemProps:t,inputProps:e={format:"YN"}})=>{const l=n.Form.useFormInstance(),i=(o,s)=>{e.format==="boolean"?l.setFieldValue(t?.name,o):l.setFieldValue(t?.name,o?"Y":"N"),e.onChange&&e.onChange(o,s)};return r.jsx(B,{...t,getValueProps:o=>({checked:e.format==="boolean"?!!o:o==="Y"}),normalize:o=>typeof o=="boolean"?e.format==="boolean"?o:o?"Y":"N":e.format==="boolean"?!!o:o?"Y":"N",children:r.jsx(n.Switch,{...e,onChange:(o,s)=>i(o,s)})})},{TextArea:Fe}=n.Input,Se=({itemProps:t,inputProps:e})=>r.jsx(B,{...t,children:r.jsx(Fe,{...e})}),je=[".pdf",".xlsx",".xls",".docx",".doc",".pptx",".ppt",".hwp",".txt",".csv",".jpg",".jpeg",".png",".gif",".zip"],q={FILE:"file"},Ye=({originNode:t,file:e,fileList:l,moveFile:i,onDrop:o})=>{const s=g.useRef(null),[{handlerId:u},a]=z.useDrop({accept:q.FILE,collect:j=>({handlerId:j.getHandlerId()}),hover(j,y){if(!s.current)return;const I=j.uid,D=e.uid;if(I===D)return;const k=O.findIndex(l,{uid:D}),v=O.findIndex(l,{uid:I});if(v===-1||k===-1)return;const F=s.current.getBoundingClientRect(),f=y.getClientOffset();if(!f)return;const L=(F.bottom-F.top)/2,d=f.y-F.top;v<k&&d<L||v>k&&d>L||i(I,D)},drop(){o()}}),[{isDragging:m},c]=z.useDrag({type:q.FILE,item:()=>({uid:e.uid,index:O.findIndex(l,{uid:e.uid})}),collect:j=>({isDragging:j.isDragging()})}),S=m?0:1;return c(a(s)),r.jsx("div",{ref:s,style:{opacity:S},"data-handler-id":u,children:t})},Ce=({fileGrpKey:t,onUploadComplete:e,onFetchFilesTrxCd:l="SCMFILE00101",onSuccessTrxCd:i="SCMFILE00102",onDeleteFileTrxCd:o="SCMFILE00103",onReorderFilesTrxCd:s="SCMFILE00104",allowedExtensions:u=je,maxFileSize:a=200,showButton:m=!0,multiple:c=!1})=>{const[S,j]=g.useState([]),y=g.useRef(t),I=g.useRef([]),D=()=>{if(I.current.length===0)return;const d=[...I.current];if(I.current=[],i){const x=d.map(p=>({crprCd:_.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:y.current,physFileNm:p.fileNameP,lgclFileNm:p.fileNameL,filePath:p.filePath,fileExtn:p.fileExt,fileSize:p.fileSize,mltpYn:"N"}));_.callService(i,{crprCd:_.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:y.current,sub:x}).then(p=>{if(p?.sub&&p.sub.length>0){const h=p.sub[0].fileGrpKey;y.current||(y.current=h);const w=new Map;p.sub.forEach(Y=>{const b=d.find(M=>M.fileNameL===Y.lgclFileNm);b&&w.set(b.tempId,Y)}),j(Y=>Y.map(M=>{const C=w.get(M.uid);if(C){const U=d.find(R=>R.tempId===M.uid);return e&&U&&e({...U,fileGrpKey:h,fileKey:C.fileKey}),{...M,name:C.lgclFileNm,fileGrpKey:h,fileKey:C.fileKey,uid:C.fileKey,status:"done",url:`/api/download?filePath=${C.filePath}&logicalName=${C.lgclFileNm}`}}return M}))}}).catch(p=>{console.error("업로드 후처리 서비스 호출 실패:",p),n.message.error("파일 후처리 중 오류가 발생했습니다.");const h=new Set(d.map(w=>w.tempId));j(w=>w.map(Y=>h.has(Y.uid)?{...Y,status:"error",error:"후처리 실패"}:Y))})}},k=g.useRef(O.debounce(D,500)).current;g.useEffect(()=>()=>{k.cancel()},[k]),g.useEffect(()=>{y.current=t},[t]),g.useEffect(()=>{t&&l&&_.callService(l,{crprCd:_.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:t}).then(d=>{if(d?.sub){const x=d.sub.map(p=>({uid:p.fileKey,name:p.lgclFileNm,status:"done",url:`/api/download?filePath=${p.filePath}&logicalName=${p.lgclFileNm}`}));j(x)}else j([])}).catch(d=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",d),n.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")})},[t,l]);const v=(d,x)=>{const p=O.findIndex(S,{uid:d}),h=O.findIndex(S,{uid:x});if(p<0||h<0)return;const w=[...S],[Y]=w.splice(p,1);w.splice(h,0,Y),j(w)},F=()=>{if(t&&s){const d=S.map(x=>x.uid);_.callService(s,{crprCd:_.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:t,reorderedFileKeys:d}).then(()=>{n.message.success("파일 순서가 성공적으로 저장되었습니다.")}).catch(x=>{console.error("파일 순서 저장 서비스 호출 실패:",x),n.message.error("파일 순서 저장 중 오류가 발생했습니다.")})}},L={name:"file",multiple:c,action:"/api/upload",fileList:S,beforeUpload:d=>{if(!c&&S.length>0)return n.message.error("하나의 파일만 업로드할 수 있습니다."),n.Upload.LIST_IGNORE;if(u&&u.length>0){const x=`.${d.name.split(".").pop()?.toLowerCase()}`;if(!u.includes(x))return n.message.error(`${d.name} 파일은 허용되지 않는 확장자입니다. (${u.join(", ")})`),n.Upload.LIST_IGNORE}return a&&!(d.size/1024/1024<a)?(n.message.error(`일반업로드의 최대용량은 ${a}MB입니다.`),n.Upload.LIST_IGNORE):!0},showUploadList:{showRemoveIcon:m},onChange(d){const{status:x,uid:p}=d.file;if(x==="removed"){o?_.callService(o,{crprCd:_.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:y.current,fileKey:p}).then(()=>{n.message.success("파일이 성공적으로 삭제되었습니다."),j(d.fileList)}).catch(h=>{console.error("파일 삭제 서비스 호출에 실패했습니다.",h),n.message.error("파일 삭제 중 오류가 발생했습니다.")}):j(d.fileList);return}if(j(d.fileList),x==="done")if(d.file.response?.success){const{uploadedFiles:h}=d.file.response;h&&Array.isArray(h)&&h.length>0&&(h.forEach(w=>{w.tempId=d.file.uid,I.current.push(w)}),k()),n.message.success(d.file.response.message||`${d.file.name} 파일이 성공적으로 업로드되었습니다.`)}else n.message.error(d.file.response?.message||`${d.file.name} 파일 업로드에 실패했습니다.`);else x==="error"&&n.message.error(d.file.response?.message||`${d.file.name} 파일 업로드 중 오류가 발생했습니다.`)},itemRender(d,x,p){const h=g.cloneElement(d,{href:x.url||void 0,title:void 0});return r.jsx(Ye,{originNode:h,file:x,fileList:p,moveFile:v,onDrop:F},x.uid)}};return r.jsx(z.DndProvider,{backend:W.HTML5Backend,children:r.jsx(n.Upload,{headers:{SYSCD:__SYS_CD__},...L,listType:"picture",children:m&&(c||S.length===0)&&r.jsx(n.Button,{icon:r.jsx(E.UploadOutlined,{}),children:"파일 선택"})})})};exports.BwgButton=X;exports.BwgCheck=Z;exports.BwgCheckList=Q;exports.BwgDatePicker=ee;exports.BwgDownload=te;exports.BwgForm=P;exports.BwgFormItem=B;exports.BwgInput=re;exports.BwgLargeUploader=ae;exports.BwgMaskedInput=le;exports.BwgMaskedPicker=de;exports.BwgMultiSelect=ue;exports.BwgNumber=me;exports.BwgRadio=ge;exports.BwgRangePicker=he;exports.BwgSearch=pe;exports.BwgSelect=xe;exports.BwgSwitch=ye;exports.BwgTextArea=Se;exports.BwgUploader=Ce;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),n=require("antd"),g=require("react"),T=require("dayjs"),$=require("@ant-design/icons"),q=require("lodash"),k=require("../../utils/index.cjs"),ae=require("jszip"),ne=require("imask"),ie=require("../../stores/index.cjs"),X=require("react-dnd"),le=require("react-dnd-html5-backend"),ce=t=>r.jsx(n.Button,{...t,className:"bwg-btn"}),M=g.memo(({children:t,label:e,name:l,rules:i,initialValue:s,style:o,...u})=>{const a={fontWeight:"bold"},m=Array.isArray(i)&&i.some(Y=>Y.required===!0),c=()=>typeof e=="string"?r.jsxs("span",{style:a,children:[e,m&&r.jsx("span",{style:{color:"#ff4d4f",marginLeft:"4px"},children:"*"})]}):r.jsx("span",{style:a,children:e});return r.jsx(n.Form.Item,{className:"bwg-form-item",label:e?c():void 0,labelAlign:"left",name:l,rules:i,colon:!1,initialValue:s,style:o,...u,children:t})}),de=({itemProps:t,inputProps:e={format:"YN"}})=>{const l=n.Form.useFormInstance(),i=s=>{e.format==="boolean"?l.setFieldValue(t?.name,s.target.checked):l.setFieldValue(t?.name,s.target.checked?"Y":"N"),e.onChange&&e.onChange(s)};return r.jsx(M,{...t,getValueProps:s=>({checked:e.format==="boolean"?!!s:s==="Y"}),normalize:s=>typeof s=="boolean"?e.format==="boolean"?s:s?"Y":"N":e.format==="boolean"?!!s:s?"Y":"N",children:r.jsx(n.Checkbox,{...e,onChange:i,children:e?.title})})},ue=({itemProps:t,inputProps:e})=>{const l=n.Form.useFormInstance(),[i,s]=g.useState(t?.initialValue??[]),[o,u]=g.useState([]),a=o.length>0&&o.length==i?.length,m=i?.length>0&&i.length<o.length;g.useEffect(()=>{u(c(e?.options))},[e?.options]),g.useEffect(()=>{s(i)},[i]);const c=j=>{const C=[];return(j||[]).map((N,E)=>{C.push(N.value)}),C},Y=j=>{s(j.target.checked?o:[]),l.setFieldValue(t?.name,j.target.checked?o:[])},y=j=>{s(j),l.setFieldValue(t?.name,j),e?.onChange&&typeof e?.onChange=="function"&&e?.onChange(j)};return r.jsx(M,{...t,children:r.jsxs(n.ConfigProvider,{theme:{components:{Checkbox:{colorPrimary:"var(--check-primary)",colorPrimaryBorder:"var(--check-primary)",colorPrimaryHover:"var(--check-primary-active)"}}},children:[e?.allCheck&&r.jsx(n.Checkbox,{indeterminate:m,checked:a,onChange:Y,children:"전체선택"}),r.jsx(n.Checkbox.Group,{options:e?.options,value:i,onChange:y})]})})},P={year:{displayFormat:"YYYY",outputFormat:"YYYY"},month:{displayFormat:"YYYY-MM",outputFormat:"YYYYMM"},date:{displayFormat:"YYYY-MM-DD",outputFormat:"YYYYMMDD"},time:{displayFormat:"HH:mm",outputFormat:"HHmm"},datetime:{displayFormat:"YYYY-MM-DD HH:mm",outputFormat:"YYYYMMDDHHmm"}},me=({itemProps:t,inputProps:e,type:l="date",returnType:i="string"})=>{const{displayFormat:s,outputFormat:o}=g.useMemo(()=>P[l],[l]),u=g.useMemo(()=>Object.values(P).map(a=>a.outputFormat).sort((a,m)=>{if(a.length===m.length){if(a===o)return-1;if(m===o)return 1}return m.length-a.length}),[o]);return r.jsx(M,{...t,getValueProps:a=>({value:a?T.isDayjs(a)?a:T(a,u):null}),normalize:a=>a?i==="dayjs"?a:a.format(o):null,children:r.jsx(n.DatePicker,{...e,picker:l==="datetime"?"date":l,showTime:e?.showTime??(l==="datetime"||l==="time"),format:s})})},fe=({fileGrpKey:t,onFetchFilesTrxCd:e="SCMFILE00101",readOnly:l=!1,sysCd:i=__SYS_CD__})=>{const[s,o]=g.useState([]);g.useEffect(()=>{t&&e?i!=__SYS_CD__?k.callService_SYSCD(i,e,{crprCd:k.getUserInfo()?.crprCd,sysCd:i,fileGrpKey:t}).then(a=>{if(a?.sub){const m=a.sub.map(c=>({uid:c.fileKey,name:c.lgclFileNm,filePath:c.filePath}));o(m)}}).catch(a=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",a),n.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")}):k.callService(e,{crprCd:k.getUserInfo()?.crprCd,sysCd:i,fileGrpKey:t}).then(a=>{if(a?.sub){const m=a.sub.map(c=>({uid:c.fileKey,name:c.lgclFileNm,filePath:c.filePath}));o(m)}}).catch(a=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",a),n.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")}):o([])},[t,e]);const u=async a=>{try{let m;i!=__SYS_CD__?m="/api/download/"+i:m="/api/download";const c=await fetch(m,{method:"POST",headers:{SYSCD:__SYS_CD__,"Content-Type":"application/json"},body:JSON.stringify({filePath:a.filePath,logicalName:a.name,fileKey:a.uid})});if(!c.ok){const N=(await c.json().catch(()=>null))?.message||"파일 다운로드에 실패했습니다.";throw new Error(N)}const Y=await c.blob(),y=window.URL.createObjectURL(Y),j=document.createElement("a");j.href=y,j.setAttribute("download",a.name),document.body.appendChild(j),j.click(),document.body.removeChild(j),window.URL.revokeObjectURL(y)}catch(m){console.error(m),n.message.error(m.message||"파일을 다운로드하는 중 오류가 발생했습니다.")}};return q.isEmpty(s)?null:r.jsx(n.Card,{title:"파일 목록",children:r.jsx(n.List,{dataSource:s,renderItem:a=>r.jsx(n.List.Item,{actions:l?[]:[r.jsx(n.Button,{type:"text",icon:r.jsx($.DownloadOutlined,{}),onClick:()=>u(a)},"download")],children:r.jsx(n.List.Item.Meta,{avatar:r.jsx($.PaperClipOutlined,{}),title:a.name})})})})},se=g.forwardRef(({children:t,labelCol:e,style:l,className:i,...s},o)=>r.jsx(n.ConfigProvider,{form:{validateMessages:{required:"'${label}을(를) 입력해주세요.'"}},children:r.jsx(n.Form,{ref:o,...s,requiredMark:!1,labelCol:e||{flex:"100px"},style:{padding:"10px",...l},className:`bwg-form ${i??""}`,children:t})}));se.displayName="BwgForm";const ge=({itemProps:t,inputProps:e})=>r.jsx(M,{...t,children:r.jsx(n.Input,{...e})}),{Text:J}=n.Typography,{Dragger:he}=n.Upload,pe=[".pdf",".xlsx",".xls",".docx",".doc",".pptx",".ppt",".hwp",".txt",".csv",".jpg",".jpeg",".png",".gif",".zip"],xe=(t,e=2)=>{if(t===0)return"0 Bytes";const l=1024,i=e<0?0:e,s=["Bytes","KB","MB","GB","TB"],o=Math.floor(Math.log(t)/Math.log(l));return parseFloat((t/Math.pow(l,o)).toFixed(i))+" "+s[o]},Fe=({title:t="첨부파일",fileGrpKey:e,onUploadComplete:l,onSuccessTrxCd:i="SCMFILE00102",anotherServiceTrxCd:s="SCMFILE00105",allowedExtensions:o=pe,maxFileSize:u=2048})=>{const[a,m]=g.useState([]),[c,Y]=g.useState(!1),[y,j]=g.useState(!1),[C,N]=g.useState(0),E=f=>{if(o&&o.length>0){const L=(U=>{const H=U.lastIndexOf(".");return H===-1?"":U.substring(H).toLowerCase()})(f.name);if(!o.includes(L))return n.message.error(`${f.name} 파일은 허용되지 않는 확장자입니다. (${o.join(", ")}만 가능)`),!1}return!0},D=async()=>{const f=a.filter(I=>I.status!=="done"),x=f.reduce((I,A)=>I+(A.size||0),0),L=2*1024*1024*1024;if(x>L){n.notification.error({message:"업로드 용량 초과",description:"한 번에 업로드할 수 있는 총 파일 용량은 2GB를 초과할 수 없습니다."});return}if(f.length===0){n.message.warning("업로드할 파일이 없거나 모든 파일이 이미 업로드되었습니다.");return}j(!0);let U;try{const I=new ae;f.forEach(A=>{A.originFileObj&&I.file(A.name,A.originFileObj)}),U=await I.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:9}})}catch(I){j(!1),n.message.error("파일을 압축하는 중 오류가 발생했습니다."),console.error("Zipping error:",I);return}j(!1);const H=new FormData;H.append("file",U,"upload.zip"),Y(!0),N(0);try{const I=await new Promise((F,w)=>{const v=new XMLHttpRequest;v.open("POST","/api/upload-large",!0),v.upload.onprogress=B=>{if(B.lengthComputable){const W=Math.round(B.loaded/B.total*100);N(W)}},v.onload=()=>{if(v.status>=200&&v.status<300)try{const B=JSON.parse(v.responseText);B.success?F(B):w(new Error(B.message||"파일 업로드에 실패했습니다."))}catch{w(new Error("잘못된 서버 응답입니다."))}else try{const B=JSON.parse(v.responseText);w(new Error(B.message||`서버 오류: ${v.status}`))}catch{w(new Error(`서버 오류: ${v.status}`))}},v.onerror=()=>{w(new Error("네트워크 오류가 발생했습니다."))},v.send(H)});n.message.success(I.message||"압축 파일이 성공적으로 업로드되었습니다.");const A=a.map(F=>f.find(w=>w.uid===F.uid)?{...F,status:"done"}:F);if(m(A),i&&I.uploadedFiles&&Array.isArray(I.uploadedFiles)){const F=k.getUserInfo();I.uploadedFiles.forEach(w=>{const v={crprCd:F?.crprCd,sysCd:__SYS_CD__,fileGrpKey:e,sub:[{crprCd:F?.crprCd,sysCd:__SYS_CD__,fileGrpKey:e,physFileNm:w.fileNameP,lgclFileNm:w.fileNameL,filePath:w.filePath,fileExtn:w.fileExt,fileSize:w.fileSize,mltpYn:"Y"}]};k.callService(i,v).then(B=>{const W=a.map(K=>({crprCd:F?.crprCd,sysCd:__SYS_CD__,fileGrpKey:B.sub[0].fileGrpKey,fileKey:B.sub[0].fileKey,lgclFileNm:K.name,fileSize:K.size,fileExtn:K.name.split(".").pop(),fileType:K.type}));k.callService(s,{sub:W})}).catch(B=>{console.error("후처리 서비스 호출 실패:",B),n.message.error(`${w.fileNameL} 파일의 후처리 작업에 실패했습니다.`)}),l&&l({fileNameP:w.fileNameP,fileNameL:w.fileNameL})})}}catch(I){n.message.error(I.message||"파일 업로드 중 오류가 발생했습니다.");const A=a.map(F=>f.find(w=>w.uid===F.uid)?{...F,status:"error",response:I.message||"파일 업로드 중 오류가 발생했습니다."}:F);m(A)}finally{Y(!1)}},h={multiple:!0,fileList:a,beforeUpload:f=>E(f)?u&&f.size>=u*1024*1024?(n.message.error(`대용량 첨부 파일 최대 크기는 ${(u/1024).toFixed(1)}GB입니다.`),n.Upload.LIST_IGNORE):!1:n.Upload.LIST_IGNORE,onChange:({fileList:f})=>{const x=new Map(a.map(L=>[L.uid,L]));f.forEach(L=>{x.set(L.uid,L)}),m(Array.from(x.values()))},onRemove:f=>{const x=a.filter(L=>L.uid!==f.uid);m(x)},showUploadList:!1};return r.jsx(n.Spin,{spinning:c||y,tip:y?"파일 압축 중...":`파일 업로드 중... ${C}%`,children:r.jsxs("div",{className:"bwg-large-uploader-container",children:[r.jsx(n.Card,{title:r.jsx(J,{strong:!0,children:t}),extra:r.jsx(n.Upload,{...h,children:r.jsx(n.Button,{icon:r.jsx($.UploadOutlined,{}),children:"파일 선택"})}),bodyStyle:{padding:0},children:r.jsx(he,{...h,style:{border:"none",background:"transparent",padding:0},children:r.jsx("div",{className:"upload-list-container",children:a.length>0?r.jsx(n.List,{style:{textAlign:"left"},dataSource:a,renderItem:f=>{const x=f.status==="done",L=f.status==="error";let U;return x?U=r.jsx($.CheckCircleOutlined,{style:{color:"#52c41a",fontSize:14}}):L?U=r.jsx(n.Tooltip,{title:typeof f.response=="string"?f.response:"업로드 실패",children:r.jsx($.CloseCircleOutlined,{style:{color:"#ff4d4f",fontSize:14}})}):U=r.jsx($.FileTextOutlined,{style:{fontSize:14}}),r.jsx(n.List.Item,{actions:[r.jsx(J,{type:"secondary",children:xe(f.size||0)},"size"),r.jsx(n.Button,{type:"text",icon:r.jsx($.DeleteOutlined,{}),onClick:H=>{H.stopPropagation(),h.onRemove?.(f)},disabled:c||y},"delete")],children:r.jsx(n.List.Item.Meta,{avatar:U,title:r.jsx(J,{type:L?"danger":void 0,children:f.name})})},f.uid)}}):r.jsxs(n.Flex,{gap:"middle",align:"center",justify:"center",vertical:!0,style:{padding:"20px 0",minHeight:"120px"},children:[r.jsx($.InboxOutlined,{style:{fontSize:"32px",color:"#999"}}),r.jsx(J,{type:"secondary",children:"업로드할 파일을 선택하거나 이 영역으로 드래그하세요."})]})})})}),a.length>0&&r.jsxs(n.Flex,{justify:"flex-end",align:"center",gap:"large",style:{marginTop:16},children:[c&&r.jsx("div",{style:{width:"250px"},children:r.jsx(n.Progress,{percent:C,size:"small"})}),r.jsx(n.Button,{type:"primary",onClick:D,disabled:c||y||a.filter(f=>f.status!=="done").length===0,icon:r.jsx($.CloudUploadOutlined,{}),children:"일괄 업로드"})]})]})})},ye=t=>{if(typeof t=="string")return t.replace(/0/g,"_");if(Array.isArray(t))return t[0].replace(/0/g,"_");if(typeof t=="object"&&"mask"in t&&"blocks"in t){const{mask:e,blocks:l}=t;return e.split(".").map(i=>{const o=l?.[i]?.maxLength??3;return"_".repeat(o)}).join(".")}return""},Se=({itemProps:t,inputProps:e,mask:l})=>{const i=g.useRef(null),s=n.Form.useFormInstance(),o=g.useMemo(()=>ye(l),[l]);return g.useEffect(()=>{if(!i.current?.input)return;const u=typeof l=="string"||Array.isArray(l)?{mask:l}:l,a=ne(i.current.input,u);return a.on("accept",()=>{s&&t?.name&&s.setFieldValue(t.name,a.value)}),()=>{a.destroy()}},[l,s,t?.name]),r.jsx(M,{...t,children:r.jsx(n.Input,{...e,ref:i,placeholder:o})})},je=t=>{switch(t){case"year":return{format:"YYYY",mask:"0000",outputFormat:"YYYY"};case"month":return{format:"YYYY-MM",mask:"0000-00",outputFormat:"YYYYMM"};case"date":default:return{format:"YYYY-MM-DD",mask:"0000-00-00",outputFormat:"YYYYMMDD"}}},Ye=({type:t="date",itemProps:e={name:"calendar"},inputProps:l})=>{const{format:i,mask:s,outputFormat:o}=je(t),u=g.useRef(null),a=g.useRef(null),m=n.Form.useFormInstance(),[c,Y]=g.useState(!1),[y,j]=g.useState(!1),C=e?.name,[N,E]=g.useState(null);g.useEffect(()=>{if(!u.current?.input)return;const h=ne(u.current.input,{mask:s,lazy:!1});return a.current=h,h.on("accept",()=>{console.log("input :: ",h.value);const f=h.value,x=T(f,i,!0);console.log("input :: ",x),f.length===i.length&&x.isValid()&&(console.log("parsed :: ",x.format(o)),m.setFieldValue(C,x.format(o)),a.current?.updateValue(),Y(!1))}),()=>{h.destroy()}},[i,s]),g.useEffect(()=>{E(T(m.getFieldValue(C)))},[m.getFieldValue(C)]);const D=h=>{if(!h){a.current?.updateValue();return}const f=h.format(o);console.log("formatted :: ",f),a.current&&(a.current.value=f,a.current.updateValue()),j(!1)};return r.jsx(M,{...e,name:void 0,validateStatus:y?"warning":void 0,help:y?"유효하지 않은 날짜입니다":void 0,children:r.jsxs("div",{style:{position:"relative"},children:[r.jsx(n.Form.Item,{name:C,getValueProps:h=>({value:h?T(h).format(i):void 0}),normalize:h=>h?T(h).format(o):void 0,noStyle:!0,children:r.jsx(n.Input,{...l,ref:u,onFocus:()=>{Y(!c),a.current?.updateValue()},onKeyDown:h=>{h.key==="Backspace"&&Y(!0),h.key==="Tab"&&Y(!1)},allowClear:!0,placeholder:s.replace(/0/g,"_"),autoComplete:"off"})}),r.jsx(n.DatePicker,{open:c,picker:t,format:i,value:N,onChange:D,getPopupContainer:h=>h.parentElement,style:{position:"absolute",top:0,left:0,pointerEvents:"none",opacity:0,width:"100%"}})]})})},{Option:Q}=n.Select,Ce=({itemProps:t,inputProps:e})=>{const[l,i]=g.useState([]);return g.useEffect(()=>{e?.addField==="ALL"?i([{label:"전체",value:""},...e?.list||[]]):e?.addField==="NULL"?i([{label:"",value:""},...e?.list||[]]):i(e?.list||[])},[e?.list]),r.jsx(M,{...t,getValueProps:s=>s?{value:s&&s.indexOf(",")>0?s.split(","):[s]}:{value:[]},normalize:s=>s!=null&&s!=null&&s.length>0?s.toString():"",children:r.jsx(n.Select,{...e,mode:"multiple",children:l.map(s=>{const{value:o,label:u}=s;return e?.printCode?r.jsx(Q,{value:o,label:u,children:r.jsx(n.Space,{children:`[${o}] ${u}`})},o):r.jsx(Q,{value:o,label:u,children:r.jsx(n.Space,{children:`${u}`})},o)})})})},we=({itemProps:t,inputProps:e})=>{const l=s=>{let o=s.toString().split(".");return e?.decimalPoint!=null&&o[1]!=null&&e?.decimalPoint>0?o[1].length>e?.decimalPoint?o[1]="."+o[1].substring(0,e?.decimalPoint):o[1]="."+o[1]:o[1]="",o[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")+o[1]},i=s=>{let o=s.toString().split(".");return e?.decimalPoint!=null&&o[1]!=null&&e?.decimalPoint>0?o[1].length>e?.decimalPoint?o[1]="."+o[1].substring(0,e?.decimalPoint):o[1]="."+o[1]:o[1]="",o[0].replace(/\$\s?|(,*)/g,"")+o[1]};return r.jsx(M,{...t,children:r.jsx(n.InputNumber,{...e,formatter:s=>l(s),parser:s=>i(s)})})},Le=({itemProps:t,inputProps:e})=>r.jsx(M,{...t,children:r.jsx(n.Radio.Group,{...e})}),{RangePicker:be}=n.DatePicker,ee={year:{displayFormat:"YYYY",outputFormat:"YYYY"},month:{displayFormat:"YYYY-MM",outputFormat:"YYYYMM"},date:{displayFormat:"YYYY-MM-DD",outputFormat:"YYYYMMDD"},time:{displayFormat:"HH:mm",outputFormat:"HHmm"},datetime:{displayFormat:"YYYY-MM-DD HH:mm",outputFormat:"YYYYMMDDHHmm"}},Ie=({itemProps:t,inputProps:e,type:l="date",minDate:i,maxDate:s,returnType:o="string"})=>{const{displayFormat:u,outputFormat:a}=g.useMemo(()=>ee[l],[l]),m=g.useMemo(()=>Object.values(ee).map(c=>c.outputFormat).sort((c,Y)=>{if(c.length===Y.length){if(c===a)return-1;if(Y===a)return 1}return Y.length-c.length}),[a]);return r.jsx(M,{...t,getValueProps:c=>({value:c&&c.length>0?[c[0]?T.isDayjs(c[0])?c[0]:T(c[0],m):null,c[1]?T.isDayjs(c[1])?c[1]:T(c[1],m):null]:null}),normalize:c=>c?o==="dayjs"?[c[0]??void 0,c[1]??void 0]:[c[0]?c[0].format(a):void 0,c[1]?c[1].format(a):void 0]:[void 0,void 0],children:r.jsx(be,{...e,order:!0,minDate:i?T(i,m):void 0,maxDate:s?T(s,m):void 0,picker:l==="datetime"?"date":l,showTime:e?.showTime??(l==="datetime"||l==="time"),format:u})})},te=n.Input.Search,Be=t=>{const e=n.Form.useFormInstance(),{openPopup:l}=ie.usePopupStore(),i=t.itemProps?.name||[],s=t.popupConfig||{callback(u){console.log("callback data :: ",u),i.length>1?(e.setFieldValue(i[0],u.code),e.setFieldValue(i[1],u.name)):e.setFieldValue(i,u.code)}},o={...t,placeholder:typeof t.placeholder=="string"?t.placeholder:t.placeholder?.[0]||"",onChange:u=>{i.length>1&&e.setFieldValue(i[0],""),t.onChange?.(u)},onSearch:u=>{t.popuCd?l(t.popuCd,t.popupParams,s):t.onSearch?.(u)}};return i.length>1?r.jsx(M,{...t.itemProps,name:void 0,children:r.jsxs(n.Space.Compact,{block:!0,children:[r.jsx(n.Form.Item,{name:i[0],rules:t.itemProps?.rules,style:{width:"40%",marginBottom:0,marginInlineEnd:0},validateStatus:"",help:"",children:r.jsx(n.Input,{style:{color:"#999",backgroundColor:"#f5f5f5"},placeholder:t.placeholder?.[0]||"",readOnly:!0})}),r.jsx(n.Form.Item,{name:i[1],style:{width:"60%",marginBottom:0},children:r.jsx(te,{readOnly:t.readOnly,enterButton:r.jsx(n.Button,{icon:r.jsx($.SearchOutlined,{}),disabled:t.readOnly}),...o})})]})}):r.jsx(M,{...t.itemProps,children:r.jsx(te,{...o})})},Me=({itemProps:t,selectProps:e={options:[],allowClear:!0}})=>{const l=n.Form.useFormInstance(),i=!!l,s=g.useMemo(()=>e?.addField==="ALL"?[{label:"전체",value:""},...e?.options||[]]:e?.addField==="NULL"?[{label:"",value:""},...e?.options||[]]:e?.options||[],[e.options,e.addField]),o=m=>{e.onChange?.(m)},u={...e,allowClear:e.allowClear??!0,options:s,onChange:o,variant:e.variant},a=r.jsx(n.Select,{...u,disabled:e.disabled});return e.copyable&&!i&&console.warn("BwgSelect: copyable 기능은 Form 컨텍스트 내에서만 사용 가능합니다."),e.copyable?r.jsx(M,{...t,name:void 0,children:r.jsxs(n.Space.Compact,{block:!0,children:[r.jsx(n.Form.Item,{name:t?.name,rules:t?.rules,style:{width:"100%",marginBottom:0},validateStatus:"",help:"",children:a}),r.jsx(n.Typography.Paragraph,{copyable:{text:i&&l?.getFieldValue(t?.name)?.toString()||"",tooltips:["코드복사","코드복사됨"]},style:{margin:0,backgroundColor:"#f5f5f5",borderRadius:"4px",border:"1px solid #d9d9d9",fontSize:"12px",color:"#666",display:"flex",alignItems:"center",height:"30px",padding:"0 8px"}})]})}):r.jsx(M,{...t,children:a})},_e=({itemProps:t,inputProps:e={format:"YN"}})=>{const l=n.Form.useFormInstance(),i=(s,o)=>{e.format==="boolean"?l.setFieldValue(t?.name,s):l.setFieldValue(t?.name,s?"Y":"N"),e.onChange&&e.onChange(s,o)};return r.jsx(M,{...t,getValueProps:s=>({checked:e.format==="boolean"?!!s:s==="Y"}),normalize:s=>typeof s=="boolean"?e.format==="boolean"?s:s?"Y":"N":e.format==="boolean"?!!s:s?"Y":"N",children:r.jsx(n.Switch,{...e,onChange:(s,o)=>i(s,o)})})},{TextArea:Ne}=n.Input,De=({itemProps:t,inputProps:e})=>r.jsx(M,{...t,children:r.jsx(Ne,{...e})}),ke=[".pdf",".xlsx",".xls",".docx",".doc",".pptx",".ppt",".hwp",".txt",".csv",".jpg",".jpeg",".png",".gif",".zip"],re={FILE:"file"},ve=({originNode:t,file:e,fileList:l,moveFile:i,onDrop:s})=>{const o=g.useRef(null),[{handlerId:u},a]=X.useDrop({accept:re.FILE,collect:y=>({handlerId:y.getHandlerId()}),hover(y,j){if(!o.current)return;const C=y.uid,N=e.uid;if(C===N)return;const E=q.findIndex(l,{uid:N}),D=q.findIndex(l,{uid:C});if(D===-1||E===-1)return;const h=o.current.getBoundingClientRect(),f=j.getClientOffset();if(!f)return;const x=(h.bottom-h.top)/2,L=f.y-h.top;D<E&&L<x||D>E&&L>x||i(C,N)},drop(){s()}}),[{isDragging:m},c]=X.useDrag({type:re.FILE,item:()=>({uid:e.uid,index:q.findIndex(l,{uid:e.uid})}),collect:y=>({isDragging:y.isDragging()})}),Y=m?0:1;return c(a(o)),r.jsx("div",{ref:o,style:{opacity:Y},"data-handler-id":u,children:t})},Ee=({itemProps:t,fileGrpKey:e,onUploadComplete:l,onFetchFilesTrxCd:i="SCMFILE00101",onSuccessTrxCd:s="SCMFILE00102",onDeleteFileTrxCd:o="SCMFILE00103",onReorderFilesTrxCd:u="SCMFILE00104",allowedExtensions:a=ke,maxFileSize:m=200,showButton:c=!0,multiple:Y=!1,newFileGrpKeyonModify:y=!1,buttonText:j="파일 선택",localOnly:C=!1,onFilesChange:N})=>{const[E,D]=g.useState([]),h=g.useRef(e),f=g.useRef([]),x=n.Form.useFormInstance(),L=()=>{if(C||f.current.length===0)return;const d=[...f.current];if(f.current=[],s){const b=d.map(S=>({crprCd:k.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:h.current,physFileNm:S.fileNameP,lgclFileNm:S.fileNameL,filePath:S.filePath,fileExtn:S.fileExt,fileSize:S.fileSize,mltpYn:"N"}));console.log("newFileGrpKeyonModify",y),console.log("newFileGrpKeyonModify",y?0:h.current),k.callService(s,{crprCd:k.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:y?0:h.current,oldFileGrpKey:h.current,newFileGrpKeyonModify:y,sub:b}).then(S=>{if(S?.sub&&S.sub.length>0){const p=S.sub[0].fileGrpKey;h.current||(h.current=p);const O=new Map;S.sub.forEach(_=>{const V=d.find(z=>z.fileNameL===_.lgclFileNm);V&&O.set(V.tempId,_)});const G=t?.name;(_=>{if(F){const V=x?.getFieldValue(G)||[],z=_(V);x?.setFieldValue(G,z)}else D(V=>_(V))})(_=>_.map(V=>{const z=O.get(V.uid);if(z){const Z=d.find(oe=>oe.tempId===V.uid);return l&&Z&&l({...Z,fileGrpKey:p,fileKey:z.fileKey}),{...V,name:z.lgclFileNm,fileGrpKey:p,fileKey:z.fileKey,uid:z.fileKey,status:"done",url:`/api/download?filePath=${z.filePath}&logicalName=${z.lgclFileNm}`}}return V}))}}).catch(S=>{console.error("업로드 후처리 서비스 호출 실패:",S),n.message.error("파일 후처리 중 오류가 발생했습니다.");const p=new Set(d.map(R=>R.tempId)),O=t?.name;(R=>{if(F){const _=x?.getFieldValue(O)||[],V=R(_);x?.setFieldValue(O,V)}else D(_=>R(_))})(R=>R.map(_=>p.has(_.uid)?{..._,status:"error",error:"후처리 실패"}:_))})}},U=g.useRef(q.debounce(L,500)).current;g.useEffect(()=>()=>{U.cancel()},[U]),g.useEffect(()=>{h.current=e},[e]),g.useEffect(()=>{C||e&&i&&k.callService(i,{crprCd:k.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:e}).then(d=>{if(d?.sub){const b=d.sub.map(p=>({uid:p.fileKey,name:p.lgclFileNm,status:"done",url:`/api/download?filePath=${p.filePath}&logicalName=${p.lgclFileNm}`})),S=t?.name;F?x?.setFieldValue(S,b):D(b)}else{const b=t?.name;F?x?.setFieldValue(b,[]):D([])}}).catch(d=>{console.error("파일 목록 조회 서비스 호출에 실패했습니다.",d),n.message.error("파일 목록을 불러오는 중 오류가 발생했습니다.")})},[e,i]);const H=(d,b)=>{const S=t?.name,p=F?x?.getFieldValue(S)||[]:E,O=q.findIndex(p,{uid:d}),G=q.findIndex(p,{uid:b});if(O<0||G<0)return;const R=[...p],[_]=R.splice(O,1);R.splice(G,0,_),F?x?.setFieldValue(S,R):D(R)},I=()=>{if(!C&&e&&u){const d=t?.name,S=(F?x?.getFieldValue(d)||[]:E).map(p=>p.uid);k.callService(u,{crprCd:k.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:e,reorderedFileKeys:S}).then(()=>{n.message.success("파일 순서가 성공적으로 저장되었습니다.")}).catch(p=>{console.error("파일 순서 저장 서비스 호출 실패:",p),n.message.error("파일 순서 저장 중 오류가 발생했습니다.")})}},A=d=>{const b=t?.name,S=F?x?.getFieldValue(b)||[]:E;if(!Y&&S.length>0)return n.message.error("하나의 파일만 업로드할 수 있습니다."),n.Upload.LIST_IGNORE;if(a&&a.length>0){const p=`.${d.name.split(".").pop()?.toLowerCase()}`;if(!a.includes(p))return n.message.error(`${d.name} 파일은 허용되지 않는 확장자입니다. (${a.join(", ")})`),n.Upload.LIST_IGNORE}return m&&!(d.size/1024/1024<m)?(n.message.error(`일반업로드의 최대용량은 ${m}MB입니다.`),n.Upload.LIST_IGNORE):!C},F=!!t?.name,w={name:"file",multiple:Y,action:C?void 0:"/api/upload",beforeUpload:A,showUploadList:{showRemoveIcon:c},onChange(d){const{status:b,uid:S}=d.file;if(b==="removed"){if(!C&&o)k.callService(o,{crprCd:k.getUserInfo()?.crprCd,sysCd:__SYS_CD__,fileGrpKey:y?0:h.current,fileKey:S,oldFileGrpKey:h.current,newFileGrpKeyonModify:y}).then(p=>{if(n.message.success("파일이 성공적으로 삭제되었습니다."),F){const O=t?.name;x?.setFieldValue(O,d.fileList)}else D(d.fileList);N?.(d.fileList),l?.({fileGrpKey:p.fileGrpKey})}).catch(p=>{console.error("파일 삭제 서비스 호출에 실패했습니다.",p),n.message.error("파일 삭제 중 오류가 발생했습니다.")});else{if(F){const p=t?.name;x?.setFieldValue(p,d.fileList)}else D(d.fileList);N?.(d.fileList)}return}if(F){const p=t?.name;x?.setFieldValue(p,d.fileList)}else D(d.fileList);if(N?.(d.fileList),b==="done")if(!C&&d.file.response?.success){const{uploadedFiles:p}=d.file.response;p&&Array.isArray(p)&&p.length>0&&(p.forEach(O=>{O.tempId=d.file.uid,f.current.push(O)}),U()),n.message.success(d.file.response.message||`${d.file.name} 파일이 성공적으로 업로드되었습니다.`)}else n.message.error(d.file.response?.message||`${d.file.name} 파일 업로드에 실패했습니다.`);else b==="error"&&n.message.error(d.file.response?.message||`${d.file.name} 파일 업로드 중 오류가 발생했습니다.`)},itemRender(d,b,S){const p=g.cloneElement(d,{href:b.url||void 0,title:void 0});return r.jsx(ve,{originNode:p,file:b,fileList:S,moveFile:H,onDrop:I},b.uid)}};F||(w.fileList=E);const v=d=>Array.isArray(d)?d:d&&d.fileList,B=t?.name,W=F?n.Form.useWatch?.(B,x):void 0,K=F?W||[]:E;return r.jsx(X.DndProvider,{backend:le.HTML5Backend,children:r.jsx(M,{valuePropName:"fileList",getValueFromEvent:v,...t,children:r.jsx(n.Upload,{headers:{SYSCD:__SYS_CD__},...w,listType:"picture",children:c&&(Y||K.length===0)&&r.jsx(n.Button,{icon:r.jsx($.UploadOutlined,{}),children:j})})})})};exports.BwgButton=ce;exports.BwgCheck=de;exports.BwgCheckList=ue;exports.BwgDatePicker=me;exports.BwgDownload=fe;exports.BwgForm=se;exports.BwgFormItem=M;exports.BwgInput=ge;exports.BwgLargeUploader=Fe;exports.BwgMaskedInput=Se;exports.BwgMaskedPicker=Ye;exports.BwgMultiSelect=Ce;exports.BwgNumber=we;exports.BwgRadio=Le;exports.BwgRangePicker=Ie;exports.BwgSearch=Be;exports.BwgSelect=Me;exports.BwgSwitch=_e;exports.BwgTextArea=De;exports.BwgUploader=Ee;
|