@bwg-ui/core 1.1.26 → 1.1.27

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 (115) hide show
  1. package/dist/chunks/common-components-CniOkOzu.js +15776 -0
  2. package/dist/chunks/common-components-DrcQahsO.cjs +183 -0
  3. package/dist/chunks/{core-BBMCFpHx.js → core-CEDyqniq.js} +1 -2
  4. package/dist/chunks/core-lmAmbqvY.cjs +1 -0
  5. package/dist/chunks/{enc-base64-DAsYWbA2.js → enc-base64-CF2tIkYl.js} +4 -5
  6. package/dist/chunks/enc-base64-Dxq399hI.cjs +1 -0
  7. package/dist/chunks/{sha256-D80RpYO2.js → sha256-DYurgXCU.js} +12 -13
  8. package/dist/chunks/sha256-H5WWQnKT.cjs +1 -0
  9. package/dist/components/common/BwgPagination.d.ts +1 -1
  10. package/dist/components/common/BwgPagination.d.ts.map +1 -1
  11. package/dist/components/common/index.cjs +1 -2
  12. package/dist/components/common/index.d.ts +3 -1
  13. package/dist/components/common/index.d.ts.map +1 -1
  14. package/dist/components/common/index.js +16 -17
  15. package/dist/components/core/index.cjs +1 -2
  16. package/dist/components/core/index.js +1218 -23
  17. package/dist/components/guide/index.cjs +1 -2
  18. package/dist/components/guide/index.js +1 -2
  19. package/dist/components/layout/index.cjs +35 -2
  20. package/dist/components/layout/index.js +350 -10
  21. package/dist/components/popup/MenuReport.d.ts.map +1 -1
  22. package/dist/index.cjs +1 -2
  23. package/dist/index.js +211 -222
  24. package/dist/provider/index.cjs +1 -2
  25. package/dist/provider/index.js +384 -25
  26. package/dist/stores/index.cjs +2 -2
  27. package/dist/stores/index.js +1394 -24
  28. package/dist/utils/index.cjs +1 -2
  29. package/dist/utils/index.js +1369 -200
  30. package/package.json +1 -1
  31. package/dist/chunks/AuthContext-BQ3gHLbr.cjs +0 -2
  32. package/dist/chunks/AuthContext-BQ3gHLbr.cjs.map +0 -1
  33. package/dist/chunks/AuthContext-CVizgYxY.js +0 -57
  34. package/dist/chunks/AuthContext-CVizgYxY.js.map +0 -1
  35. package/dist/chunks/BwgSpace-BPJARdOc.js +0 -27
  36. package/dist/chunks/BwgSpace-BPJARdOc.js.map +0 -1
  37. package/dist/chunks/BwgSpace-Cw27d-XU.cjs +0 -2
  38. package/dist/chunks/BwgSpace-Cw27d-XU.cjs.map +0 -1
  39. package/dist/chunks/BwgSwitch-BLtVdW44.cjs +0 -2
  40. package/dist/chunks/BwgSwitch-BLtVdW44.cjs.map +0 -1
  41. package/dist/chunks/BwgSwitch-DdHo4gYR.js +0 -269
  42. package/dist/chunks/BwgSwitch-DdHo4gYR.js.map +0 -1
  43. package/dist/chunks/BwgUploader-BUmFmeuS.js +0 -3250
  44. package/dist/chunks/BwgUploader-BUmFmeuS.js.map +0 -1
  45. package/dist/chunks/BwgUploader-Djhl4lIt.cjs +0 -3
  46. package/dist/chunks/BwgUploader-Djhl4lIt.cjs.map +0 -1
  47. package/dist/chunks/LoadingOverlay-Uf6xy04v.js +0 -19
  48. package/dist/chunks/LoadingOverlay-Uf6xy04v.js.map +0 -1
  49. package/dist/chunks/LoadingOverlay-jdMzdB-z.cjs +0 -2
  50. package/dist/chunks/LoadingOverlay-jdMzdB-z.cjs.map +0 -1
  51. package/dist/chunks/SSOHandler-CR0nR3rJ.js +0 -28654
  52. package/dist/chunks/SSOHandler-CR0nR3rJ.js.map +0 -1
  53. package/dist/chunks/SSOHandler-DQG0Jp4V.cjs +0 -237
  54. package/dist/chunks/SSOHandler-DQG0Jp4V.cjs.map +0 -1
  55. package/dist/chunks/ScreenProtectContext-BMsPPcTX.js +0 -154
  56. package/dist/chunks/ScreenProtectContext-BMsPPcTX.js.map +0 -1
  57. package/dist/chunks/ScreenProtectContext-DrCGlcTs.cjs +0 -2
  58. package/dist/chunks/ScreenProtectContext-DrCGlcTs.cjs.map +0 -1
  59. package/dist/chunks/SearchBoxContext-DY6lES-W.cjs +0 -2
  60. package/dist/chunks/SearchBoxContext-DY6lES-W.cjs.map +0 -1
  61. package/dist/chunks/SearchBoxContext-Dtzo_rJd.js +0 -86
  62. package/dist/chunks/SearchBoxContext-Dtzo_rJd.js.map +0 -1
  63. package/dist/chunks/ViewContainer-BfiTFvLP.cjs +0 -36
  64. package/dist/chunks/ViewContainer-BfiTFvLP.cjs.map +0 -1
  65. package/dist/chunks/ViewContainer-CTl3_56W.js +0 -338
  66. package/dist/chunks/ViewContainer-CTl3_56W.js.map +0 -1
  67. package/dist/chunks/apiUtils-D9Vn1gwZ.cjs +0 -3
  68. package/dist/chunks/apiUtils-D9Vn1gwZ.cjs.map +0 -1
  69. package/dist/chunks/apiUtils-DPUgfmKk.js +0 -1450
  70. package/dist/chunks/apiUtils-DPUgfmKk.js.map +0 -1
  71. package/dist/chunks/codeStore-BrCfe9K3.js +0 -450
  72. package/dist/chunks/codeStore-BrCfe9K3.js.map +0 -1
  73. package/dist/chunks/codeStore-_b2fDZtD.cjs +0 -2
  74. package/dist/chunks/codeStore-_b2fDZtD.cjs.map +0 -1
  75. package/dist/chunks/core-BBMCFpHx.js.map +0 -1
  76. package/dist/chunks/core-CM9MsJRf.cjs +0 -2
  77. package/dist/chunks/core-CM9MsJRf.cjs.map +0 -1
  78. package/dist/chunks/enc-base64-DAsYWbA2.js.map +0 -1
  79. package/dist/chunks/enc-base64-DbK5VBfD.cjs +0 -2
  80. package/dist/chunks/enc-base64-DbK5VBfD.cjs.map +0 -1
  81. package/dist/chunks/favoriteStore-BnQ2u-sa.cjs +0 -2
  82. package/dist/chunks/favoriteStore-BnQ2u-sa.cjs.map +0 -1
  83. package/dist/chunks/favoriteStore-SyAjqLG8.js +0 -439
  84. package/dist/chunks/favoriteStore-SyAjqLG8.js.map +0 -1
  85. package/dist/chunks/popupStore-BrKcPw7K.js +0 -92
  86. package/dist/chunks/popupStore-BrKcPw7K.js.map +0 -1
  87. package/dist/chunks/popupStore-ChbYTqy1.cjs +0 -2
  88. package/dist/chunks/popupStore-ChbYTqy1.cjs.map +0 -1
  89. package/dist/chunks/realFormat-Cha7OTd9.cjs +0 -2
  90. package/dist/chunks/realFormat-Cha7OTd9.cjs.map +0 -1
  91. package/dist/chunks/realFormat-DRGLFabQ.js +0 -305
  92. package/dist/chunks/realFormat-DRGLFabQ.js.map +0 -1
  93. package/dist/chunks/sha256-BnWVPP1K.cjs +0 -2
  94. package/dist/chunks/sha256-BnWVPP1K.cjs.map +0 -1
  95. package/dist/chunks/sha256-D80RpYO2.js.map +0 -1
  96. package/dist/chunks/usePopup-DnfKRiYs.js +0 -109
  97. package/dist/chunks/usePopup-DnfKRiYs.js.map +0 -1
  98. package/dist/chunks/usePopup-Domnpg55.cjs +0 -2
  99. package/dist/chunks/usePopup-Domnpg55.cjs.map +0 -1
  100. package/dist/components/common/index.cjs.map +0 -1
  101. package/dist/components/common/index.js.map +0 -1
  102. package/dist/components/core/index.cjs.map +0 -1
  103. package/dist/components/core/index.js.map +0 -1
  104. package/dist/components/guide/index.cjs.map +0 -1
  105. package/dist/components/guide/index.js.map +0 -1
  106. package/dist/components/layout/index.cjs.map +0 -1
  107. package/dist/components/layout/index.js.map +0 -1
  108. package/dist/index.cjs.map +0 -1
  109. package/dist/index.js.map +0 -1
  110. package/dist/provider/index.cjs.map +0 -1
  111. package/dist/provider/index.js.map +0 -1
  112. package/dist/stores/index.cjs.map +0 -1
  113. package/dist/stores/index.js.map +0 -1
  114. package/dist/utils/index.cjs.map +0 -1
  115. package/dist/utils/index.js.map +0 -1
@@ -1,25 +1,1220 @@
1
- import { B as g, a as s, b as B, c as w, d as r, e as t, f as o, g as c, h as d, i, j as k, k as l } from "../../chunks/BwgUploader-BUmFmeuS.js";
2
- import { B as p, a as h, b as n, c as u, d as f, e as S, f as b, g as x } from "../../chunks/BwgSwitch-DdHo4gYR.js";
1
+ import { jsx as r, jsxs as A } from "react/jsx-runtime";
2
+ import { Button as U, Form as k, Checkbox as W, ConfigProvider as ae, DatePicker as X, message as L, Card as ie, List as H, Input as G, Spin as de, Upload as T, Typography as le, Flex as Q, Progress as ue, notification as me, Tooltip as fe, Select as Z, Space as J, InputNumber as he, Radio as pe, Switch as ge } from "antd";
3
+ import { memo as ye, useState as E, useEffect as v, useMemo as K, forwardRef as Ye, useRef as V, cloneElement as Fe } from "react";
4
+ import O from "dayjs";
5
+ import { PaperClipOutlined as Ce, DownloadOutlined as be, DeleteOutlined as Se, InboxOutlined as we, UploadOutlined as se, CloudUploadOutlined as Le, CheckCircleOutlined as _e, CloseCircleOutlined as Ie, FileTextOutlined as Me, SearchOutlined as De } from "@ant-design/icons";
6
+ import { isEmpty as Ne, debounce as ke, findIndex as P } from "lodash";
7
+ import { callService_SYSCD as xe, getUserInfo as z, callService as R } from "../../utils/index.js";
8
+ import Oe from "jszip";
9
+ import ce from "imask";
10
+ import { usePopupStore as Ee } from "../../stores/index.js";
11
+ import { DndProvider as ve, useDrop as Be, useDrag as ze } from "react-dnd";
12
+ import { HTML5Backend as Te } from "react-dnd-html5-backend";
13
+ const it = (t) => /* @__PURE__ */ r(U, { ...t, className: "bwg-btn" }), D = ye(
14
+ ({
15
+ children: t,
16
+ label: e,
17
+ name: l,
18
+ rules: i,
19
+ initialValue: n,
20
+ style: o,
21
+ ...d
22
+ }) => {
23
+ const a = {
24
+ fontWeight: "bold"
25
+ }, u = Array.isArray(i) && i.some((Y) => Y.required === !0), s = () => typeof e == "string" ? /* @__PURE__ */ A("span", { style: a, children: [
26
+ e,
27
+ u && /* @__PURE__ */ r("span", { style: { color: "#ff4d4f", marginLeft: "4px" }, children: "*" })
28
+ ] }) : /* @__PURE__ */ r("span", { style: a, children: e });
29
+ return /* @__PURE__ */ r(
30
+ k.Item,
31
+ {
32
+ className: "bwg-form-item",
33
+ label: e ? s() : void 0,
34
+ labelAlign: "left",
35
+ name: l,
36
+ rules: i,
37
+ colon: !1,
38
+ initialValue: n,
39
+ style: o,
40
+ ...d,
41
+ children: t
42
+ }
43
+ );
44
+ }
45
+ ), lt = ({
46
+ itemProps: t,
47
+ inputProps: e = {
48
+ format: "YN"
49
+ }
50
+ }) => {
51
+ const l = k.useFormInstance();
52
+ return /* @__PURE__ */ r(
53
+ D,
54
+ {
55
+ ...t,
56
+ getValueProps: (n) => ({ checked: e.format === "boolean" ? !!n : n === "Y" }),
57
+ normalize: (n) => typeof n == "boolean" ? e.format === "boolean" ? n : n ? "Y" : "N" : e.format === "boolean" ? !!n : n ? "Y" : "N",
58
+ children: /* @__PURE__ */ r(W, { ...e, onChange: (n) => {
59
+ e.format === "boolean" ? l.setFieldValue(t?.name, n.target.checked) : l.setFieldValue(t?.name, n.target.checked ? "Y" : "N"), e.onChange && e.onChange(n);
60
+ }, children: e?.title })
61
+ }
62
+ );
63
+ }, st = ({ itemProps: t, inputProps: e }) => {
64
+ const l = k.useFormInstance(), [i, n] = E(
65
+ t?.initialValue ?? []
66
+ ), [o, d] = E([]), a = o.length > 0 && o.length == i?.length, u = i?.length > 0 && i.length < o.length;
67
+ v(() => {
68
+ d(s(e?.options));
69
+ }, [e?.options]), v(() => {
70
+ n(i);
71
+ }, [i]);
72
+ const s = (g) => {
73
+ const _ = [];
74
+ return (g || []).map((N, x) => {
75
+ _.push(N.value);
76
+ }), _;
77
+ }, Y = (g) => {
78
+ n(g.target.checked ? o : []), l.setFieldValue(t?.name, g.target.checked ? o : []);
79
+ }, F = (g) => {
80
+ n(g), l.setFieldValue(t?.name, g), e?.onChange && typeof e?.onChange == "function" && e?.onChange(g);
81
+ };
82
+ return /* @__PURE__ */ r(D, { ...t, children: /* @__PURE__ */ A(ae, { theme: {
83
+ components: {
84
+ Checkbox: {
85
+ colorPrimary: "var(--check-primary)",
86
+ colorPrimaryBorder: "var(--check-primary)",
87
+ colorPrimaryHover: "var(--check-primary-active)"
88
+ }
89
+ }
90
+ }, children: [
91
+ e?.allCheck && /* @__PURE__ */ r(
92
+ W,
93
+ {
94
+ indeterminate: u,
95
+ checked: a,
96
+ onChange: Y,
97
+ children: "전체선택"
98
+ }
99
+ ),
100
+ /* @__PURE__ */ r(
101
+ W.Group,
102
+ {
103
+ options: e?.options,
104
+ value: i,
105
+ onChange: F
106
+ }
107
+ )
108
+ ] }) });
109
+ }, ee = {
110
+ year: { displayFormat: "YYYY", outputFormat: "YYYY" },
111
+ month: { displayFormat: "YYYY-MM", outputFormat: "YYYYMM" },
112
+ date: { displayFormat: "YYYY-MM-DD", outputFormat: "YYYYMMDD" },
113
+ time: { displayFormat: "HH:mm", outputFormat: "HHmm" },
114
+ datetime: {
115
+ displayFormat: "YYYY-MM-DD HH:mm",
116
+ outputFormat: "YYYYMMDDHHmm"
117
+ }
118
+ }, ct = ({
119
+ itemProps: t,
120
+ inputProps: e,
121
+ type: l = "date",
122
+ returnType: i = "string"
123
+ }) => {
124
+ const { displayFormat: n, outputFormat: o } = K(
125
+ () => ee[l],
126
+ [l]
127
+ ), d = K(
128
+ () => Object.values(ee).map((a) => a.outputFormat).sort((a, u) => {
129
+ if (a.length === u.length) {
130
+ if (a === o) return -1;
131
+ if (u === o) return 1;
132
+ }
133
+ return u.length - a.length;
134
+ }),
135
+ [o]
136
+ // type(outputFormat)이 바뀔 때마다 재정렬
137
+ );
138
+ return /* @__PURE__ */ r(
139
+ D,
140
+ {
141
+ ...t,
142
+ getValueProps: (a) => ({
143
+ // 폼에 저장된 값(문자열 또는 Dayjs)을 DatePicker가 요구하는 Dayjs로 변환
144
+ value: a ? O.isDayjs(a) ? a : O(a, d) : null
145
+ }),
146
+ normalize: (a) => a ? i === "dayjs" ? a : a.format(o) : null,
147
+ children: /* @__PURE__ */ r(
148
+ X,
149
+ {
150
+ ...e,
151
+ picker: l === "datetime" ? "date" : l,
152
+ showTime: e?.showTime ?? (l === "datetime" || l === "time"),
153
+ format: n
154
+ }
155
+ )
156
+ }
157
+ );
158
+ }, dt = ({
159
+ fileGrpKey: t,
160
+ onFetchFilesTrxCd: e = "SCMFILE00101",
161
+ readOnly: l = !1,
162
+ sysCd: i = __SYS_CD__
163
+ }) => {
164
+ const [n, o] = E([]);
165
+ v(() => {
166
+ t && e ? i != __SYS_CD__ ? xe(i, e, {
167
+ crprCd: z()?.crprCd,
168
+ sysCd: i,
169
+ fileGrpKey: t
170
+ }).then((a) => {
171
+ if (a?.sub) {
172
+ const u = a.sub.map((s) => ({
173
+ uid: s.fileKey,
174
+ name: s.lgclFileNm,
175
+ filePath: s.filePath
176
+ }));
177
+ o(u);
178
+ }
179
+ }).catch((a) => {
180
+ console.error("파일 목록 조회 서비스 호출에 실패했습니다.", a), L.error("파일 목록을 불러오는 중 오류가 발생했습니다.");
181
+ }) : R(e, {
182
+ crprCd: z()?.crprCd,
183
+ sysCd: i,
184
+ fileGrpKey: t
185
+ }).then((a) => {
186
+ if (a?.sub) {
187
+ const u = a.sub.map((s) => ({
188
+ uid: s.fileKey,
189
+ name: s.lgclFileNm,
190
+ filePath: s.filePath
191
+ }));
192
+ o(u);
193
+ }
194
+ }).catch((a) => {
195
+ console.error("파일 목록 조회 서비스 호출에 실패했습니다.", a), L.error("파일 목록을 불러오는 중 오류가 발생했습니다.");
196
+ }) : o([]);
197
+ }, [t, e]);
198
+ const d = async (a) => {
199
+ try {
200
+ let u;
201
+ i != __SYS_CD__ ? u = "/api/download/" + i : u = "/api/download";
202
+ const s = await fetch(u, {
203
+ method: "POST",
204
+ headers: {
205
+ SYSCD: __SYS_CD__,
206
+ "Content-Type": "application/json"
207
+ // 여기에 필요한 다른 헤더(예: 인증 토큰)를 추가할 수 있습니다.
208
+ },
209
+ body: JSON.stringify({
210
+ filePath: a.filePath,
211
+ logicalName: a.name,
212
+ fileKey: a.uid
213
+ })
214
+ });
215
+ if (!s.ok) {
216
+ const N = (await s.json().catch(() => null))?.message || "파일 다운로드에 실패했습니다.";
217
+ throw new Error(N);
218
+ }
219
+ const Y = await s.blob(), F = window.URL.createObjectURL(Y), g = document.createElement("a");
220
+ g.href = F, g.setAttribute("download", a.name), document.body.appendChild(g), g.click(), document.body.removeChild(g), window.URL.revokeObjectURL(F);
221
+ } catch (u) {
222
+ console.error(u), L.error(
223
+ u.message || "파일을 다운로드하는 중 오류가 발생했습니다."
224
+ );
225
+ }
226
+ };
227
+ return Ne(n) ? null : /* @__PURE__ */ r(ie, { title: "파일 목록", children: /* @__PURE__ */ r(
228
+ H,
229
+ {
230
+ dataSource: n,
231
+ renderItem: (a) => /* @__PURE__ */ r(
232
+ H.Item,
233
+ {
234
+ actions: l ? [] : [
235
+ /* @__PURE__ */ r(
236
+ U,
237
+ {
238
+ type: "text",
239
+ icon: /* @__PURE__ */ r(be, {}),
240
+ onClick: () => d(a)
241
+ },
242
+ "download"
243
+ )
244
+ ],
245
+ children: /* @__PURE__ */ r(H.Item.Meta, { avatar: /* @__PURE__ */ r(Ce, {}), title: a.name })
246
+ }
247
+ )
248
+ }
249
+ ) });
250
+ }, Ae = Ye(
251
+ ({ children: t, labelCol: e, style: l, className: i, ...n }, o) => /* @__PURE__ */ r(
252
+ ae,
253
+ {
254
+ form: {
255
+ //기존 rule.message의 default message인 $name을를 입력해주세요를 변경
256
+ validateMessages: { required: "'${label}을(를) 입력해주세요.'" }
257
+ },
258
+ children: /* @__PURE__ */ r(
259
+ k,
260
+ {
261
+ ref: o,
262
+ ...n,
263
+ requiredMark: !1,
264
+ labelCol: e || { flex: "100px" },
265
+ style: { padding: "10px", ...l },
266
+ className: `bwg-form ${i ?? ""}`,
267
+ children: t
268
+ }
269
+ )
270
+ }
271
+ )
272
+ );
273
+ Ae.displayName = "BwgForm";
274
+ const ut = ({ itemProps: t, inputProps: e }) => /* @__PURE__ */ r(D, { ...t, children: /* @__PURE__ */ r(G, { ...e }) }), { Text: q } = le, { Dragger: Re } = T, Ue = [
275
+ ".pdf",
276
+ ".xlsx",
277
+ ".xls",
278
+ ".docx",
279
+ ".doc",
280
+ ".pptx",
281
+ ".ppt",
282
+ ".hwp",
283
+ ".txt",
284
+ ".csv",
285
+ // 이미지
286
+ ".jpg",
287
+ ".jpeg",
288
+ ".png",
289
+ ".gif",
290
+ // 압축
291
+ ".zip"
292
+ ], Ve = (t, e = 2) => {
293
+ if (t === 0) return "0 Bytes";
294
+ const l = 1024, i = e < 0 ? 0 : e, n = ["Bytes", "KB", "MB", "GB", "TB"], o = Math.floor(Math.log(t) / Math.log(l));
295
+ return parseFloat((t / Math.pow(l, o)).toFixed(i)) + " " + n[o];
296
+ }, mt = ({
297
+ title: t = "첨부파일",
298
+ fileGrpKey: e,
299
+ onUploadComplete: l,
300
+ onSuccessTrxCd: i = "SCMFILE00102",
301
+ // BwgUploader와 동일한 기본 trxCd 설정
302
+ anotherServiceTrxCd: n = "SCMFILE00105",
303
+ allowedExtensions: o = Ue,
304
+ maxFileSize: d = 2048
305
+ // 기본값 2GB
306
+ }) => {
307
+ const [a, u] = E([]), [s, Y] = E(!1), [F, g] = E(!1), [_, N] = E(0), x = (m) => {
308
+ if (o && o.length > 0) {
309
+ const c = ((p) => {
310
+ const h = p.lastIndexOf(".");
311
+ return h === -1 ? "" : p.substring(h).toLowerCase();
312
+ })(m.name);
313
+ if (!o.includes(c))
314
+ return L.error(
315
+ `${m.name} 파일은 허용되지 않는 확장자입니다. (${o.join(
316
+ ", "
317
+ )}만 가능)`
318
+ ), !1;
319
+ }
320
+ return !0;
321
+ }, B = async () => {
322
+ const m = a.filter((f) => f.status !== "done"), I = m.reduce(
323
+ (f, S) => f + (S.size || 0),
324
+ 0
325
+ ), c = 2 * 1024 * 1024 * 1024;
326
+ if (I > c) {
327
+ me.error({
328
+ message: "업로드 용량 초과",
329
+ description: "한 번에 업로드할 수 있는 총 파일 용량은 2GB를 초과할 수 없습니다."
330
+ });
331
+ return;
332
+ }
333
+ if (m.length === 0) {
334
+ L.warning(
335
+ "업로드할 파일이 없거나 모든 파일이 이미 업로드되었습니다."
336
+ );
337
+ return;
338
+ }
339
+ g(!0);
340
+ let p;
341
+ try {
342
+ const f = new Oe();
343
+ m.forEach((S) => {
344
+ S.originFileObj && f.file(S.name, S.originFileObj);
345
+ }), p = await f.generateAsync({
346
+ type: "blob",
347
+ compression: "DEFLATE",
348
+ compressionOptions: {
349
+ level: 9
350
+ // 높은 압축률 설정
351
+ }
352
+ });
353
+ } catch (f) {
354
+ g(!1), L.error("파일을 압축하는 중 오류가 발생했습니다."), console.error("Zipping error:", f);
355
+ return;
356
+ }
357
+ g(!1);
358
+ const h = new FormData();
359
+ h.append("file", p, "upload.zip"), Y(!0), N(0);
360
+ try {
361
+ const f = await new Promise((C, w) => {
362
+ const M = new XMLHttpRequest();
363
+ M.open("POST", "/api/upload-large", !0), M.upload.onprogress = (b) => {
364
+ if (b.lengthComputable) {
365
+ const $ = Math.round(
366
+ b.loaded / b.total * 100
367
+ );
368
+ N($);
369
+ }
370
+ }, M.onload = () => {
371
+ if (M.status >= 200 && M.status < 300)
372
+ try {
373
+ const b = JSON.parse(M.responseText);
374
+ b.success ? C(b) : w(
375
+ new Error(b.message || "파일 업로드에 실패했습니다.")
376
+ );
377
+ } catch {
378
+ w(new Error("잘못된 서버 응답입니다."));
379
+ }
380
+ else
381
+ try {
382
+ const b = JSON.parse(M.responseText);
383
+ w(new Error(b.message || `서버 오류: ${M.status}`));
384
+ } catch {
385
+ w(new Error(`서버 오류: ${M.status}`));
386
+ }
387
+ }, M.onerror = () => {
388
+ w(new Error("네트워크 오류가 발생했습니다."));
389
+ }, M.send(h);
390
+ });
391
+ L.success(
392
+ f.message || "압축 파일이 성공적으로 업로드되었습니다."
393
+ );
394
+ const S = a.map(
395
+ (C) => m.find((w) => w.uid === C.uid) ? { ...C, status: "done" } : C
396
+ );
397
+ if (u(S), i && f.uploadedFiles && Array.isArray(f.uploadedFiles)) {
398
+ const C = z();
399
+ f.uploadedFiles.forEach((w) => {
400
+ const M = {
401
+ crprCd: C?.crprCd,
402
+ sysCd: __SYS_CD__,
403
+ fileGrpKey: e,
404
+ sub: [
405
+ {
406
+ crprCd: C?.crprCd,
407
+ sysCd: __SYS_CD__,
408
+ fileGrpKey: e,
409
+ physFileNm: w.fileNameP,
410
+ lgclFileNm: w.fileNameL,
411
+ filePath: w.filePath,
412
+ fileExtn: w.fileExt,
413
+ fileSize: w.fileSize,
414
+ mltpYn: "Y"
415
+ }
416
+ ]
417
+ };
418
+ R(i, M).then((b) => {
419
+ const $ = a.map((j) => ({
420
+ crprCd: C?.crprCd,
421
+ sysCd: __SYS_CD__,
422
+ fileGrpKey: b.sub[0].fileGrpKey,
423
+ fileKey: b.sub[0].fileKey,
424
+ lgclFileNm: j.name,
425
+ fileSize: j.size,
426
+ fileExtn: j.name.split(".").pop(),
427
+ fileType: j.type
428
+ }));
429
+ R(n, {
430
+ // 파일 목록에 fileKey를 추가합니다.
431
+ sub: $
432
+ });
433
+ }).catch((b) => {
434
+ console.error("후처리 서비스 호출 실패:", b), L.error(
435
+ `${w.fileNameL} 파일의 후처리 작업에 실패했습니다.`
436
+ );
437
+ }), l && l({
438
+ fileNameP: w.fileNameP,
439
+ fileNameL: w.fileNameL
440
+ });
441
+ });
442
+ }
443
+ } catch (f) {
444
+ L.error(f.message || "파일 업로드 중 오류가 발생했습니다.");
445
+ const S = a.map(
446
+ (C) => m.find((w) => w.uid === C.uid) ? {
447
+ ...C,
448
+ status: "error",
449
+ response: f.message || "파일 업로드 중 오류가 발생했습니다."
450
+ } : C
451
+ );
452
+ u(S);
453
+ } finally {
454
+ Y(!1);
455
+ }
456
+ }, y = {
457
+ multiple: !0,
458
+ fileList: a,
459
+ beforeUpload: (m) => x(m) ? d && m.size >= d * 1024 * 1024 ? (L.error(
460
+ `대용량 첨부 파일 최대 크기는 ${(d / 1024).toFixed(
461
+ 1
462
+ )}GB입니다.`
463
+ ), T.LIST_IGNORE) : !1 : T.LIST_IGNORE,
464
+ onChange: ({ fileList: m }) => {
465
+ const I = new Map(a.map((c) => [c.uid, c]));
466
+ m.forEach((c) => {
467
+ I.set(c.uid, c);
468
+ }), u(Array.from(I.values()));
469
+ },
470
+ onRemove: (m) => {
471
+ const I = a.filter((c) => c.uid !== m.uid);
472
+ u(I);
473
+ },
474
+ showUploadList: !1
475
+ // 수동으로 목록을 렌더링하므로 antd의 기본 목록은 숨깁니다.
476
+ };
477
+ return /* @__PURE__ */ r(
478
+ de,
479
+ {
480
+ spinning: s || F,
481
+ tip: F ? "파일 압축 중..." : `파일 업로드 중... ${_}%`,
482
+ children: /* @__PURE__ */ A("div", { className: "bwg-large-uploader-container", children: [
483
+ /* @__PURE__ */ r(
484
+ ie,
485
+ {
486
+ title: /* @__PURE__ */ r(q, { strong: !0, children: t }),
487
+ extra: /* @__PURE__ */ r(T, { ...y, children: /* @__PURE__ */ r(U, { icon: /* @__PURE__ */ r(se, {}), children: "파일 선택" }) }),
488
+ bodyStyle: { padding: 0 },
489
+ children: /* @__PURE__ */ r(
490
+ Re,
491
+ {
492
+ ...y,
493
+ style: {
494
+ border: "none",
495
+ background: "transparent",
496
+ padding: 0
497
+ },
498
+ children: /* @__PURE__ */ r("div", { className: "upload-list-container", children: a.length > 0 ? /* @__PURE__ */ r(
499
+ H,
500
+ {
501
+ style: { textAlign: "left" },
502
+ dataSource: a,
503
+ renderItem: (m) => {
504
+ const I = m.status === "done", c = m.status === "error";
505
+ let p;
506
+ return I ? p = /* @__PURE__ */ r(
507
+ _e,
508
+ {
509
+ style: { color: "#52c41a", fontSize: 14 }
510
+ }
511
+ ) : c ? p = /* @__PURE__ */ r(
512
+ fe,
513
+ {
514
+ title: typeof m.response == "string" ? m.response : "업로드 실패",
515
+ children: /* @__PURE__ */ r(
516
+ Ie,
517
+ {
518
+ style: { color: "#ff4d4f", fontSize: 14 }
519
+ }
520
+ )
521
+ }
522
+ ) : p = /* @__PURE__ */ r(Me, { style: { fontSize: 14 } }), /* @__PURE__ */ r(
523
+ H.Item,
524
+ {
525
+ actions: [
526
+ /* @__PURE__ */ r(q, { type: "secondary", children: Ve(m.size || 0) }, "size"),
527
+ /* @__PURE__ */ r(
528
+ U,
529
+ {
530
+ type: "text",
531
+ icon: /* @__PURE__ */ r(Se, {}),
532
+ onClick: (h) => {
533
+ h.stopPropagation(), y.onRemove?.(m);
534
+ },
535
+ disabled: s || F
536
+ },
537
+ "delete"
538
+ )
539
+ ],
540
+ children: /* @__PURE__ */ r(
541
+ H.Item.Meta,
542
+ {
543
+ avatar: p,
544
+ title: /* @__PURE__ */ r(q, { type: c ? "danger" : void 0, children: m.name })
545
+ }
546
+ )
547
+ },
548
+ m.uid
549
+ );
550
+ }
551
+ }
552
+ ) : /* @__PURE__ */ A(
553
+ Q,
554
+ {
555
+ gap: "middle",
556
+ align: "center",
557
+ justify: "center",
558
+ vertical: !0,
559
+ style: { padding: "20px 0", minHeight: "120px" },
560
+ children: [
561
+ /* @__PURE__ */ r(we, { style: { fontSize: "32px", color: "#999" } }),
562
+ /* @__PURE__ */ r(q, { type: "secondary", children: "업로드할 파일을 선택하거나 이 영역으로 드래그하세요." })
563
+ ]
564
+ }
565
+ ) })
566
+ }
567
+ )
568
+ }
569
+ ),
570
+ a.length > 0 && /* @__PURE__ */ A(
571
+ Q,
572
+ {
573
+ justify: "flex-end",
574
+ align: "center",
575
+ gap: "large",
576
+ style: { marginTop: 16 },
577
+ children: [
578
+ s && /* @__PURE__ */ r("div", { style: { width: "250px" }, children: /* @__PURE__ */ r(ue, { percent: _, size: "small" }) }),
579
+ /* @__PURE__ */ r(
580
+ U,
581
+ {
582
+ type: "primary",
583
+ onClick: B,
584
+ disabled: s || F || a.filter((m) => m.status !== "done").length === 0,
585
+ icon: /* @__PURE__ */ r(Le, {}),
586
+ children: "일괄 업로드"
587
+ }
588
+ )
589
+ ]
590
+ }
591
+ )
592
+ ] })
593
+ }
594
+ );
595
+ }, $e = (t) => {
596
+ if (typeof t == "string")
597
+ return t.replace(/0/g, "_");
598
+ if (Array.isArray(t))
599
+ return t[0].replace(/0/g, "_");
600
+ if (typeof t == "object" && "mask" in t && "blocks" in t) {
601
+ const { mask: e, blocks: l } = t;
602
+ return e.split(".").map((i) => {
603
+ const o = l?.[i]?.maxLength ?? 3;
604
+ return "_".repeat(o);
605
+ }).join(".");
606
+ }
607
+ return "";
608
+ }, ft = ({
609
+ itemProps: t,
610
+ inputProps: e,
611
+ mask: l
612
+ }) => {
613
+ const i = V(null), n = k.useFormInstance(), o = K(() => $e(l), [l]);
614
+ return v(() => {
615
+ if (!i.current?.input) return;
616
+ const d = typeof l == "string" || Array.isArray(l) ? { mask: l } : l, a = ce(i.current.input, d);
617
+ return a.on("accept", () => {
618
+ n && t?.name && n.setFieldValue(t.name, a.value);
619
+ }), () => {
620
+ a.destroy();
621
+ };
622
+ }, [l, n, t?.name]), /* @__PURE__ */ r(D, { ...t, children: /* @__PURE__ */ r(G, { ...e, ref: i, placeholder: o }) });
623
+ }, je = (t) => {
624
+ switch (t) {
625
+ case "year":
626
+ return { format: "YYYY", mask: "0000", outputFormat: "YYYY" };
627
+ case "month":
628
+ return { format: "YYYY-MM", mask: "0000-00", outputFormat: "YYYYMM" };
629
+ case "date":
630
+ default:
631
+ return {
632
+ format: "YYYY-MM-DD",
633
+ mask: "0000-00-00",
634
+ outputFormat: "YYYYMMDD"
635
+ };
636
+ }
637
+ }, ht = ({
638
+ type: t = "date",
639
+ itemProps: e = { name: "calendar" },
640
+ inputProps: l
641
+ }) => {
642
+ const { format: i, mask: n, outputFormat: o } = je(t), d = V(null), a = V(null), u = k.useFormInstance(), [s, Y] = E(!1), [F, g] = E(!1), _ = e?.name, [N, x] = E(null);
643
+ v(() => {
644
+ if (!d.current?.input) return;
645
+ const y = ce(d.current.input, {
646
+ mask: n,
647
+ lazy: !1
648
+ });
649
+ return a.current = y, y.on("accept", () => {
650
+ console.log("input :: ", y.value);
651
+ const m = y.value, I = O(m, i, !0);
652
+ console.log("input :: ", I), m.length === i.length && I.isValid() && (console.log("parsed :: ", I.format(o)), u.setFieldValue(_, I.format(o)), a.current?.updateValue(), Y(!1));
653
+ }), () => {
654
+ y.destroy();
655
+ };
656
+ }, [i, n]), v(() => {
657
+ x(O(u.getFieldValue(_)));
658
+ }, [u.getFieldValue(_)]);
659
+ const B = (y) => {
660
+ if (!y) {
661
+ a.current?.updateValue();
662
+ return;
663
+ }
664
+ const m = y.format(o);
665
+ console.log("formatted :: ", m), a.current && (a.current.value = m, a.current.updateValue()), g(!1);
666
+ };
667
+ return /* @__PURE__ */ r(
668
+ D,
669
+ {
670
+ ...e,
671
+ name: void 0,
672
+ validateStatus: F ? "warning" : void 0,
673
+ help: F ? "유효하지 않은 날짜입니다" : void 0,
674
+ children: /* @__PURE__ */ A("div", { style: { position: "relative" }, children: [
675
+ /* @__PURE__ */ r(
676
+ k.Item,
677
+ {
678
+ name: _,
679
+ getValueProps: (y) => ({
680
+ value: y ? O(y).format(i) : void 0
681
+ }),
682
+ normalize: (y) => y ? O(y).format(o) : void 0,
683
+ noStyle: !0,
684
+ children: /* @__PURE__ */ r(
685
+ G,
686
+ {
687
+ ...l,
688
+ ref: d,
689
+ onFocus: () => {
690
+ Y(!s), a.current?.updateValue();
691
+ },
692
+ onKeyDown: (y) => {
693
+ y.key === "Backspace" && Y(!0), y.key === "Tab" && Y(!1);
694
+ },
695
+ allowClear: !0,
696
+ placeholder: n.replace(/0/g, "_"),
697
+ autoComplete: "off"
698
+ }
699
+ )
700
+ }
701
+ ),
702
+ /* @__PURE__ */ r(
703
+ X,
704
+ {
705
+ open: s,
706
+ picker: t,
707
+ format: i,
708
+ value: N,
709
+ onChange: B,
710
+ getPopupContainer: (y) => y.parentElement,
711
+ style: {
712
+ position: "absolute",
713
+ top: 0,
714
+ left: 0,
715
+ pointerEvents: "none",
716
+ opacity: 0,
717
+ width: "100%"
718
+ }
719
+ }
720
+ )
721
+ ] })
722
+ }
723
+ );
724
+ }, { Option: te } = Z, pt = ({ itemProps: t, inputProps: e }) => {
725
+ const [l, i] = E([]);
726
+ return v(() => {
727
+ e?.addField === "ALL" ? i([
728
+ { label: "전체", value: "" },
729
+ ...e?.list || []
730
+ ]) : e?.addField === "NULL" ? i([{ label: "", value: "" }, ...e?.list || []]) : i(e?.list || []);
731
+ }, [e?.list]), /* @__PURE__ */ r(
732
+ D,
733
+ {
734
+ ...t,
735
+ getValueProps: (n) => n ? {
736
+ value: n && n.indexOf(",") > 0 ? n.split(",") : [n]
737
+ } : {
738
+ value: []
739
+ },
740
+ normalize: (n) => n != null && n != null && n.length > 0 ? n.toString() : "",
741
+ children: /* @__PURE__ */ r(Z, { ...e, mode: "multiple", children: l.map((n) => {
742
+ const { value: o, label: d } = n;
743
+ return e?.printCode ? /* @__PURE__ */ r(te, { value: o, label: d, children: /* @__PURE__ */ r(J, { children: `[${o}] ${d}` }) }, o) : /* @__PURE__ */ r(te, { value: o, label: d, children: /* @__PURE__ */ r(J, { children: `${d}` }) }, o);
744
+ }) })
745
+ }
746
+ );
747
+ }, gt = ({ itemProps: t, inputProps: e }) => {
748
+ const l = (n) => {
749
+ let o = n.toString().split(".");
750
+ 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];
751
+ }, i = (n) => {
752
+ let o = n.toString().split(".");
753
+ 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];
754
+ };
755
+ return /* @__PURE__ */ r(D, { ...t, children: /* @__PURE__ */ r(
756
+ he,
757
+ {
758
+ ...e,
759
+ formatter: (n) => l(n),
760
+ parser: (n) => i(n)
761
+ }
762
+ ) });
763
+ }, yt = ({ itemProps: t, inputProps: e }) => /* @__PURE__ */ r(D, { ...t, children: /* @__PURE__ */ r(pe.Group, { ...e }) }), { RangePicker: He } = X, re = {
764
+ year: { displayFormat: "YYYY", outputFormat: "YYYY" },
765
+ month: { displayFormat: "YYYY-MM", outputFormat: "YYYYMM" },
766
+ date: { displayFormat: "YYYY-MM-DD", outputFormat: "YYYYMMDD" },
767
+ time: { displayFormat: "HH:mm", outputFormat: "HHmm" },
768
+ datetime: {
769
+ displayFormat: "YYYY-MM-DD HH:mm",
770
+ outputFormat: "YYYYMMDDHHmm"
771
+ }
772
+ }, Yt = ({
773
+ itemProps: t,
774
+ inputProps: e,
775
+ type: l = "date",
776
+ minDate: i,
777
+ maxDate: n,
778
+ returnType: o = "string"
779
+ }) => {
780
+ const { displayFormat: d, outputFormat: a } = K(
781
+ () => re[l],
782
+ [l]
783
+ ), u = K(
784
+ () => Object.values(re).map((s) => s.outputFormat).sort((s, Y) => {
785
+ if (s.length === Y.length) {
786
+ if (s === a) return -1;
787
+ if (Y === a) return 1;
788
+ }
789
+ return Y.length - s.length;
790
+ }),
791
+ [a]
792
+ // type(outputFormat)이 바뀔 때마다 재정렬
793
+ );
794
+ return /* @__PURE__ */ r(
795
+ D,
796
+ {
797
+ ...t,
798
+ getValueProps: (s) => ({
799
+ // 폼에 저장된 값(문자열 또는 Dayjs)을 RangePicker가 요구하는 Dayjs 배열로 변환
800
+ value: s && s.length > 0 ? [
801
+ s[0] ? O.isDayjs(s[0]) ? s[0] : O(s[0], u) : null,
802
+ s[1] ? O.isDayjs(s[1]) ? s[1] : O(s[1], u) : null
803
+ ] : null
804
+ }),
805
+ normalize: (s) => s ? o === "dayjs" ? [s[0] ?? void 0, s[1] ?? void 0] : [
806
+ s[0] ? s[0].format(a) : void 0,
807
+ s[1] ? s[1].format(a) : void 0
808
+ ] : [void 0, void 0],
809
+ children: /* @__PURE__ */ r(
810
+ He,
811
+ {
812
+ ...e,
813
+ order: !0,
814
+ minDate: i ? O(i, u) : void 0,
815
+ maxDate: n ? O(n, u) : void 0,
816
+ picker: l === "datetime" ? "date" : l,
817
+ showTime: e?.showTime ?? (l === "datetime" || l === "time"),
818
+ format: d
819
+ }
820
+ )
821
+ }
822
+ );
823
+ }, ne = G.Search, Ft = (t) => {
824
+ const e = k.useFormInstance(), { openPopup: l } = Ee(), i = t.itemProps?.name || [], n = t.popupConfig || {
825
+ callback(d) {
826
+ console.log("callback data :: ", d), i.length > 1 ? (e.setFieldValue(i[0], d.code), e.setFieldValue(i[1], d.name)) : e.setFieldValue(i, d.code);
827
+ }
828
+ }, o = {
829
+ ...t,
830
+ placeholder: typeof t.placeholder == "string" ? t.placeholder : t.placeholder?.[0] || "",
831
+ onChange: (d) => {
832
+ i.length > 1 && e.setFieldValue(i[0], ""), t.onChange?.(d);
833
+ },
834
+ onSearch: (d) => {
835
+ t.popuCd ? l(t.popuCd, t.popupParams, n) : t.onSearch?.(d);
836
+ }
837
+ };
838
+ return i.length > 1 ? /* @__PURE__ */ r(D, { ...t.itemProps, name: void 0, children: /* @__PURE__ */ A(J.Compact, { block: !0, children: [
839
+ /* @__PURE__ */ r(
840
+ k.Item,
841
+ {
842
+ name: i[0],
843
+ rules: t.itemProps?.rules,
844
+ style: { width: "40%", marginBottom: 0, marginInlineEnd: 0 },
845
+ validateStatus: "",
846
+ help: "",
847
+ children: /* @__PURE__ */ r(
848
+ G,
849
+ {
850
+ style: { color: "#999", backgroundColor: "#f5f5f5" },
851
+ placeholder: t.placeholder?.[0] || "",
852
+ readOnly: !0
853
+ }
854
+ )
855
+ }
856
+ ),
857
+ /* @__PURE__ */ r(k.Item, { name: i[1], style: { width: "60%", marginBottom: 0 }, children: /* @__PURE__ */ r(
858
+ ne,
859
+ {
860
+ readOnly: t.readOnly,
861
+ enterButton: /* @__PURE__ */ r(
862
+ U,
863
+ {
864
+ icon: /* @__PURE__ */ r(De, {}),
865
+ disabled: t.readOnly
866
+ }
867
+ ),
868
+ ...o
869
+ }
870
+ ) })
871
+ ] }) }) : /* @__PURE__ */ r(D, { ...t.itemProps, children: /* @__PURE__ */ r(ne, { ...o }) });
872
+ }, Ct = ({
873
+ itemProps: t,
874
+ selectProps: e = {
875
+ options: [],
876
+ allowClear: !0
877
+ }
878
+ }) => {
879
+ const l = k.useFormInstance(), i = !!l, n = K(() => e?.addField === "ALL" ? [{ label: "전체", value: "" }, ...e?.options || []] : e?.addField === "NULL" ? [{ label: "", value: "" }, ...e?.options || []] : e?.options || [], [e.options, e.addField]), o = (u) => {
880
+ e.onChange?.(u);
881
+ }, d = {
882
+ ...e,
883
+ allowClear: e.allowClear ?? !0,
884
+ options: n,
885
+ onChange: o,
886
+ variant: e.variant
887
+ }, a = /* @__PURE__ */ r(Z, { ...d, disabled: e.disabled });
888
+ return e.copyable && !i && console.warn(
889
+ "BwgSelect: copyable 기능은 Form 컨텍스트 내에서만 사용 가능합니다."
890
+ ), e.copyable ? /* @__PURE__ */ r(D, { ...t, name: void 0, children: /* @__PURE__ */ A(J.Compact, { block: !0, children: [
891
+ /* @__PURE__ */ r(
892
+ k.Item,
893
+ {
894
+ name: t?.name,
895
+ rules: t?.rules,
896
+ style: { width: "100%", marginBottom: 0 },
897
+ validateStatus: "",
898
+ help: "",
899
+ children: a
900
+ }
901
+ ),
902
+ /* @__PURE__ */ r(
903
+ le.Paragraph,
904
+ {
905
+ copyable: {
906
+ text: i && l?.getFieldValue(t?.name)?.toString() || "",
907
+ tooltips: ["코드복사", "코드복사됨"]
908
+ },
909
+ style: {
910
+ margin: 0,
911
+ backgroundColor: "#f5f5f5",
912
+ borderRadius: "4px",
913
+ border: "1px solid #d9d9d9",
914
+ fontSize: "12px",
915
+ color: "#666",
916
+ display: "flex",
917
+ alignItems: "center",
918
+ height: "30px",
919
+ padding: "0 8px"
920
+ }
921
+ }
922
+ )
923
+ ] }) }) : /* @__PURE__ */ r(D, { ...t, children: a });
924
+ }, bt = ({
925
+ itemProps: t,
926
+ inputProps: e = {
927
+ format: "YN"
928
+ }
929
+ }) => {
930
+ const l = k.useFormInstance(), i = (n, o) => {
931
+ e.format === "boolean" ? l.setFieldValue(t?.name, n) : l.setFieldValue(t?.name, n ? "Y" : "N"), e.onChange && e.onChange(n, o);
932
+ };
933
+ return /* @__PURE__ */ r(
934
+ D,
935
+ {
936
+ ...t,
937
+ getValueProps: (n) => ({ checked: e.format === "boolean" ? !!n : n === "Y" }),
938
+ normalize: (n) => typeof n == "boolean" ? e.format === "boolean" ? n : n ? "Y" : "N" : e.format === "boolean" ? !!n : n ? "Y" : "N",
939
+ children: /* @__PURE__ */ r(ge, { ...e, onChange: (n, o) => i(n, o) })
940
+ }
941
+ );
942
+ }, { TextArea: Ke } = G, St = ({ itemProps: t, inputProps: e }) => /* @__PURE__ */ r(D, { ...t, children: /* @__PURE__ */ r(Ke, { ...e }) }), Ge = [
943
+ ".pdf",
944
+ ".xlsx",
945
+ ".xls",
946
+ ".docx",
947
+ ".doc",
948
+ ".pptx",
949
+ ".ppt",
950
+ ".hwp",
951
+ ".txt",
952
+ ".csv",
953
+ // 이미지
954
+ ".jpg",
955
+ ".jpeg",
956
+ ".png",
957
+ ".gif",
958
+ // 압축
959
+ ".zip"
960
+ ], oe = {
961
+ FILE: "file"
962
+ }, Pe = ({
963
+ originNode: t,
964
+ file: e,
965
+ fileList: l,
966
+ moveFile: i,
967
+ onDrop: n
968
+ }) => {
969
+ const o = V(null), [{ handlerId: d }, a] = Be({
970
+ accept: oe.FILE,
971
+ collect: (F) => ({
972
+ handlerId: F.getHandlerId()
973
+ }),
974
+ hover(F, g) {
975
+ if (!o.current)
976
+ return;
977
+ const _ = F.uid, N = e.uid;
978
+ if (_ === N)
979
+ return;
980
+ const x = P(l, { uid: N }), B = P(l, { uid: _ });
981
+ if (B === -1 || x === -1)
982
+ return;
983
+ const y = o.current.getBoundingClientRect(), m = g.getClientOffset();
984
+ if (!m)
985
+ return;
986
+ const I = (y.bottom - y.top) / 2, c = m.y - y.top;
987
+ B < x && c < I || B > x && c > I || i(_, N);
988
+ },
989
+ drop() {
990
+ n();
991
+ }
992
+ }), [{ isDragging: u }, s] = ze({
993
+ type: oe.FILE,
994
+ item: () => ({
995
+ uid: e.uid,
996
+ index: P(l, { uid: e.uid })
997
+ }),
998
+ collect: (F) => ({
999
+ isDragging: F.isDragging()
1000
+ })
1001
+ }), Y = u ? 0 : 1;
1002
+ return s(a(o)), /* @__PURE__ */ r("div", { ref: o, style: { opacity: Y }, "data-handler-id": d, children: t });
1003
+ }, wt = ({
1004
+ fileGrpKey: t,
1005
+ onUploadComplete: e,
1006
+ onFetchFilesTrxCd: l = "SCMFILE00101",
1007
+ onSuccessTrxCd: i = "SCMFILE00102",
1008
+ onDeleteFileTrxCd: n = "SCMFILE00103",
1009
+ onReorderFilesTrxCd: o = "SCMFILE00104",
1010
+ allowedExtensions: d = Ge,
1011
+ maxFileSize: a = 200,
1012
+ showButton: u = !0,
1013
+ // 기본값으로 true 설정
1014
+ multiple: s = !1
1015
+ }) => {
1016
+ const [Y, F] = E([]), g = V(t), _ = V([]), x = V(
1017
+ ke(() => {
1018
+ if (_.current.length === 0)
1019
+ return;
1020
+ const c = [..._.current];
1021
+ if (_.current = [], i) {
1022
+ const p = c.map((h) => ({
1023
+ crprCd: z()?.crprCd,
1024
+ sysCd: __SYS_CD__,
1025
+ fileGrpKey: g.current,
1026
+ physFileNm: h.fileNameP,
1027
+ lgclFileNm: h.fileNameL,
1028
+ filePath: h.filePath,
1029
+ fileExtn: h.fileExt,
1030
+ fileSize: h.fileSize,
1031
+ mltpYn: "N"
1032
+ }));
1033
+ R(i, {
1034
+ crprCd: z()?.crprCd,
1035
+ sysCd: __SYS_CD__,
1036
+ fileGrpKey: g.current,
1037
+ sub: p
1038
+ }).then((h) => {
1039
+ if (h?.sub && h.sub.length > 0) {
1040
+ const f = h.sub[0].fileGrpKey;
1041
+ g.current || (g.current = f);
1042
+ const S = /* @__PURE__ */ new Map();
1043
+ h.sub.forEach((C) => {
1044
+ const w = c.find(
1045
+ (M) => M.fileNameL === C.lgclFileNm
1046
+ );
1047
+ w && S.set(w.tempId, C);
1048
+ }), F((C) => C.map((M) => {
1049
+ const b = S.get(M.uid);
1050
+ if (b) {
1051
+ const $ = c.find(
1052
+ (j) => j.tempId === M.uid
1053
+ );
1054
+ return e && $ && e({
1055
+ ...$,
1056
+ fileGrpKey: f,
1057
+ fileKey: b.fileKey
1058
+ }), {
1059
+ ...M,
1060
+ name: b.lgclFileNm,
1061
+ fileGrpKey: f,
1062
+ fileKey: b.fileKey,
1063
+ uid: b.fileKey,
1064
+ status: "done",
1065
+ url: `/api/download?filePath=${b.filePath}&logicalName=${b.lgclFileNm}`
1066
+ };
1067
+ }
1068
+ return M;
1069
+ }));
1070
+ }
1071
+ }).catch((h) => {
1072
+ console.error("업로드 후처리 서비스 호출 실패:", h), L.error("파일 후처리 중 오류가 발생했습니다.");
1073
+ const f = new Set(c.map((S) => S.tempId));
1074
+ F(
1075
+ (S) => S.map(
1076
+ (C) => f.has(C.uid) ? { ...C, status: "error", error: "후처리 실패" } : C
1077
+ )
1078
+ );
1079
+ });
1080
+ }
1081
+ }, 500)
1082
+ ).current;
1083
+ v(() => () => {
1084
+ x.cancel();
1085
+ }, [x]), v(() => {
1086
+ g.current = t;
1087
+ }, [t]), v(() => {
1088
+ t && l && R(l, {
1089
+ crprCd: z()?.crprCd,
1090
+ sysCd: __SYS_CD__,
1091
+ fileGrpKey: t
1092
+ }).then((c) => {
1093
+ if (c?.sub) {
1094
+ const p = c.sub.map((h) => ({
1095
+ uid: h.fileKey,
1096
+ name: h.lgclFileNm,
1097
+ status: "done",
1098
+ url: `/api/download?filePath=${h.filePath}&logicalName=${h.lgclFileNm}`
1099
+ }));
1100
+ F(p);
1101
+ }
1102
+ }).catch((c) => {
1103
+ console.error("파일 목록 조회 서비스 호출에 실패했습니다.", c), L.error("파일 목록을 불러오는 중 오류가 발생했습니다.");
1104
+ });
1105
+ }, [t, l]);
1106
+ const B = (c, p) => {
1107
+ const h = P(Y, { uid: c }), f = P(Y, { uid: p });
1108
+ if (h < 0 || f < 0) return;
1109
+ const S = [...Y], [C] = S.splice(h, 1);
1110
+ S.splice(f, 0, C), F(S);
1111
+ }, y = () => {
1112
+ if (t && o) {
1113
+ const c = Y.map((p) => p.uid);
1114
+ R(o, {
1115
+ crprCd: z()?.crprCd,
1116
+ sysCd: __SYS_CD__,
1117
+ fileGrpKey: t,
1118
+ reorderedFileKeys: c
1119
+ }).then(() => {
1120
+ L.success("파일 순서가 성공적으로 저장되었습니다.");
1121
+ }).catch((p) => {
1122
+ console.error("파일 순서 저장 서비스 호출 실패:", p), L.error("파일 순서 저장 중 오류가 발생했습니다.");
1123
+ });
1124
+ }
1125
+ }, I = {
1126
+ name: "file",
1127
+ multiple: s,
1128
+ action: "/api/upload",
1129
+ fileList: Y,
1130
+ beforeUpload: (c) => {
1131
+ if (!s && Y.length > 0)
1132
+ return L.error("하나의 파일만 업로드할 수 있습니다."), T.LIST_IGNORE;
1133
+ if (d && d.length > 0) {
1134
+ const p = `.${c.name.split(".").pop()?.toLowerCase()}`;
1135
+ if (!d.includes(p))
1136
+ return L.error(
1137
+ `${c.name} 파일은 허용되지 않는 확장자입니다. (${d.join(
1138
+ ", "
1139
+ )})`
1140
+ ), T.LIST_IGNORE;
1141
+ }
1142
+ return a && !(c.size / 1024 / 1024 < a) ? (L.error(`일반업로드의 최대용량은 ${a}MB입니다.`), T.LIST_IGNORE) : !0;
1143
+ },
1144
+ showUploadList: {
1145
+ showRemoveIcon: u
1146
+ // showButton 값에 따라 삭제 버튼 표시/숨김
1147
+ },
1148
+ onChange(c) {
1149
+ const { status: p, uid: h } = c.file;
1150
+ if (p === "removed") {
1151
+ n ? R(n, {
1152
+ crprCd: z()?.crprCd,
1153
+ sysCd: __SYS_CD__,
1154
+ fileGrpKey: g.current,
1155
+ fileKey: h
1156
+ }).then(() => {
1157
+ L.success("파일이 성공적으로 삭제되었습니다."), F(c.fileList);
1158
+ }).catch((f) => {
1159
+ console.error("파일 삭제 서비스 호출에 실패했습니다.", f), L.error("파일 삭제 중 오류가 발생했습니다.");
1160
+ }) : F(c.fileList);
1161
+ return;
1162
+ }
1163
+ if (F(c.fileList), p === "done")
1164
+ if (c.file.response?.success) {
1165
+ const { uploadedFiles: f } = c.file.response;
1166
+ f && Array.isArray(f) && f.length > 0 && (f.forEach((S) => {
1167
+ S.tempId = c.file.uid, _.current.push(S);
1168
+ }), x()), L.success(
1169
+ c.file.response.message || `${c.file.name} 파일이 성공적으로 업로드되었습니다.`
1170
+ );
1171
+ } else
1172
+ L.error(
1173
+ c.file.response?.message || `${c.file.name} 파일 업로드에 실패했습니다.`
1174
+ );
1175
+ else p === "error" && L.error(
1176
+ c.file.response?.message || `${c.file.name} 파일 업로드 중 오류가 발생했습니다.`
1177
+ );
1178
+ },
1179
+ itemRender(c, p, h) {
1180
+ const f = Fe(c, {
1181
+ href: p.url || void 0,
1182
+ title: void 0
1183
+ });
1184
+ return /* @__PURE__ */ r(
1185
+ Pe,
1186
+ {
1187
+ originNode: f,
1188
+ file: p,
1189
+ fileList: h,
1190
+ moveFile: B,
1191
+ onDrop: y
1192
+ },
1193
+ p.uid
1194
+ );
1195
+ }
1196
+ };
1197
+ return /* @__PURE__ */ r(ve, { backend: Te, children: /* @__PURE__ */ r(T, { headers: { SYSCD: __SYS_CD__ }, ...I, listType: "picture", children: u && (s || Y.length === 0) && /* @__PURE__ */ r(U, { icon: /* @__PURE__ */ r(se, {}), children: "파일 선택" }) }) });
1198
+ };
3
1199
  export {
4
- g as BwgButton,
5
- p as BwgCheck,
6
- s as BwgCheckList,
7
- h as BwgDatePicker,
8
- B as BwgDownload,
9
- n as BwgForm,
10
- u as BwgFormItem,
11
- f as BwgInput,
12
- w as BwgLargeUploader,
13
- r as BwgMaskedInput,
14
- t as BwgMaskedPicker,
15
- o as BwgMultiSelect,
16
- c as BwgNumber,
17
- d as BwgRadio,
18
- S as BwgRangePicker,
19
- i as BwgSearch,
20
- b as BwgSelect,
21
- x as BwgSwitch,
22
- k as BwgTextArea,
23
- l as BwgUploader
1200
+ it as BwgButton,
1201
+ lt as BwgCheck,
1202
+ st as BwgCheckList,
1203
+ ct as BwgDatePicker,
1204
+ dt as BwgDownload,
1205
+ Ae as BwgForm,
1206
+ D as BwgFormItem,
1207
+ ut as BwgInput,
1208
+ mt as BwgLargeUploader,
1209
+ ft as BwgMaskedInput,
1210
+ ht as BwgMaskedPicker,
1211
+ pt as BwgMultiSelect,
1212
+ gt as BwgNumber,
1213
+ yt as BwgRadio,
1214
+ Yt as BwgRangePicker,
1215
+ Ft as BwgSearch,
1216
+ Ct as BwgSelect,
1217
+ bt as BwgSwitch,
1218
+ St as BwgTextArea,
1219
+ wt as BwgUploader
24
1220
  };
25
- //# sourceMappingURL=index.js.map