@bwg-ui/core 1.3.3 → 1.3.5

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 (72) hide show
  1. package/dist/chunks/CMSearchIntfGwP01-CuGDAfFM.cjs +1 -0
  2. package/dist/chunks/{CMSearchIntfGwP01-Co6lrDf9.js → CMSearchIntfGwP01-DBpDpgQr.js} +21 -21
  3. package/dist/chunks/{MenuReport-BTtoDFz-.js → MenuReport-CCbCy7yt.js} +250 -228
  4. package/dist/chunks/MenuReport-yw8tZDUk.cjs +1 -0
  5. package/dist/chunks/common-components-CbkWoYfX.cjs +1111 -0
  6. package/dist/chunks/{common-components-0IMhPxxg.js → common-components-DtzVj5lz.js} +10904 -10757
  7. package/dist/chunks/layout-components-BzLAGXiu.cjs +38 -0
  8. package/dist/chunks/{layout-components-DphZY34c.js → layout-components-ljht1sHh.js} +954 -856
  9. package/dist/chunks/{provider-VCa8UGvF.js → provider-Kxea5IoZ.js} +57 -54
  10. package/dist/chunks/provider-r4mkv5Zs.cjs +1 -0
  11. package/dist/components/common/BwgGrid.d.ts.map +1 -1
  12. package/dist/components/common/BwgView.d.ts.map +1 -1
  13. package/dist/components/common/SearchBox.d.ts +2 -0
  14. package/dist/components/common/SearchBox.d.ts.map +1 -1
  15. package/dist/components/common/index.cjs +1 -1
  16. package/dist/components/common/index.js +1 -1
  17. package/dist/components/core/BwgDatePicker.d.ts.map +1 -1
  18. package/dist/components/core/BwgEmpSearch.d.ts +1 -1
  19. package/dist/components/core/BwgEmpSearch.d.ts.map +1 -1
  20. package/dist/components/core/BwgMaskedDate.d.ts.map +1 -1
  21. package/dist/components/core/BwgMaskedRange.d.ts.map +1 -1
  22. package/dist/components/core/index.cjs +1 -1
  23. package/dist/components/core/index.d.ts +2 -0
  24. package/dist/components/core/index.d.ts.map +1 -1
  25. package/dist/components/core/index.js +1973 -22
  26. package/dist/components/guide/index.cjs +1 -1
  27. package/dist/components/guide/index.js +14 -14
  28. package/dist/components/layout/BwgPortal01.d.ts.map +1 -1
  29. package/dist/components/layout/custom/ConfigurableHeader.d.ts.map +1 -1
  30. package/dist/components/layout/custom/ConfigurableMenuTab.d.ts.map +1 -1
  31. package/dist/components/layout/custom/ConfigurableSidebar.d.ts.map +1 -1
  32. package/dist/components/layout/index.cjs +1 -1
  33. package/dist/components/layout/index.js +1 -1
  34. package/dist/components/pages/board/CMAdminBoardM01.d.ts.map +1 -1
  35. package/dist/components/pages/board/CMMyBoardM01.d.ts.map +1 -1
  36. package/dist/components/pages/rsrc/CMPopuMstrM01.d.ts.map +1 -1
  37. package/dist/components/pages/syst/SystemCodeManage.d.ts.map +1 -1
  38. package/dist/components/popup/MenuReport.d.ts.map +1 -1
  39. package/dist/components/popup/index.cjs +1 -1
  40. package/dist/components/popup/index.d.ts.map +1 -1
  41. package/dist/components/popup/index.js +1 -1
  42. package/dist/index.cjs +1 -1
  43. package/dist/index.js +242 -240
  44. package/dist/provider/contexts/SearchBoxContext.d.ts +20 -0
  45. package/dist/provider/contexts/SearchBoxContext.d.ts.map +1 -1
  46. package/dist/provider/index.cjs +1 -1
  47. package/dist/provider/index.js +5 -5
  48. package/dist/stores/favoriteStore.d.ts.map +1 -1
  49. package/dist/stores/index.cjs +2 -2
  50. package/dist/stores/index.js +208 -207
  51. package/dist/stores/loginStore.d.ts +4 -8
  52. package/dist/stores/loginStore.d.ts.map +1 -1
  53. package/dist/stores/popupStore.d.ts.map +1 -1
  54. package/dist/styles/components.css +107 -37
  55. package/dist/styles/layout.css +59 -5
  56. package/dist/styles/variables.css +6 -0
  57. package/dist/utils/commonUtils.d.ts +5 -1
  58. package/dist/utils/commonUtils.d.ts.map +1 -1
  59. package/dist/utils/index.cjs +1 -1
  60. package/dist/utils/index.d.ts +1 -0
  61. package/dist/utils/index.d.ts.map +1 -1
  62. package/dist/utils/index.js +986 -954
  63. package/package.json +1 -1
  64. package/dist/chunks/CMSearchIntfGwP01-Do_ZDjmX.cjs +0 -1
  65. package/dist/chunks/MenuReport-Bn5NyNel.cjs +0 -1
  66. package/dist/chunks/common-components-Csd3OioX.cjs +0 -1109
  67. package/dist/chunks/core-components-CX6NGtTh.cjs +0 -1
  68. package/dist/chunks/core-components-Ckwf4Rd7.js +0 -1969
  69. package/dist/chunks/layout-components-BMLp8YAy.cjs +0 -38
  70. package/dist/chunks/provider-DrboIg2C.cjs +0 -1
  71. package/dist/components/popup/SearchAddress.d.ts +0 -3
  72. package/dist/components/popup/SearchAddress.d.ts.map +0 -1
@@ -1,24 +1,1975 @@
1
- import { B as g, k as s, l as w, i as B, r as t, a as r, d as o, b as c, o as d, p as k, q as i, t as l, h as n, g as m, m as p, j as u, e as h, c as M, u as S, f as D, n as I } from "../../chunks/core-components-Ckwf4Rd7.js";
1
+ import { jsx as a, jsxs as K } from "react/jsx-runtime";
2
+ import { Button as X, Form as E, Checkbox as ue, ConfigProvider as se, DatePicker as ie, message as z, Card as Ve, List as re, Input as q, Spin as Le, Upload as Z, Typography as be, Flex as ge, Progress as ve, notification as Ae, Tooltip as Me, Select as fe, Space as ae, InputNumber as _e, Radio as De, Switch as Ee } from "antd";
3
+ import { useMemo as Q, memo as xe, useState as j, useEffect as G, forwardRef as Be, useRef as P, cloneElement as Oe, useCallback as ce } from "react";
4
+ import { useUserStore as ze, usePopupStore as $e } from "../../stores/index.js";
5
+ import _ from "dayjs";
6
+ import { PaperClipOutlined as Re, DownloadOutlined as Ue, DeleteOutlined as Te, InboxOutlined as je, UploadOutlined as ke, CloudUploadOutlined as He, CheckCircleOutlined as Pe, CloseCircleOutlined as Ke, FileTextOutlined as Ge, CalendarOutlined as de, ExclamationCircleOutlined as Se, SearchOutlined as Ne } from "@ant-design/icons";
7
+ import { getApiDeps as he, callServiceByAppCd as We, getCrprCd as qe, callService as J, getUserInfo as te } from "../../utils/index.js";
8
+ import Ze from "jszip";
9
+ import le from "imask";
10
+ import { d as we, e as Je } from "../../chunks/provider-Kxea5IoZ.js";
11
+ import { debounce as Xe, findIndex as ne } from "lodash";
12
+ import { DndProvider as Qe, useDrop as et, useDrag as tt } from "react-dnd";
13
+ import { HTML5Backend as rt } from "react-dnd-html5-backend";
14
+ const vt = (e) => {
15
+ const { componentSize: r } = ze(), f = Q(() => e.size ? e.size : {
16
+ 0: "small",
17
+ 1: "middle",
18
+ 2: "large"
19
+ }[r], [r, e.size]), s = Q(() => ({
20
+ 0: 12,
21
+ // 작게
22
+ 1: 14,
23
+ // 보통
24
+ 2: 16
25
+ // 크게
26
+ })[r], [r]);
27
+ return /* @__PURE__ */ a(
28
+ X,
29
+ {
30
+ ...e,
31
+ size: f,
32
+ className: "bwg-btn",
33
+ style: { fontSize: `${s}px`, ...e.style },
34
+ children: e.children
35
+ }
36
+ );
37
+ }, T = xe(
38
+ ({
39
+ children: e,
40
+ label: r,
41
+ name: f,
42
+ rules: s,
43
+ initialValue: t,
44
+ style: l,
45
+ required: g,
46
+ ...i
47
+ }) => {
48
+ const y = {
49
+ fontWeight: "bold"
50
+ };
51
+ (s == null || s == null) && g && (s = [
52
+ {
53
+ required: !0,
54
+ message: `${r}을(를) 입력해주세요.`
55
+ }
56
+ ]);
57
+ const c = Array.isArray(s) && s.some((Y) => Y.required === !0), u = () => typeof r == "string" ? /* @__PURE__ */ K("span", { style: y, children: [
58
+ r,
59
+ c && /* @__PURE__ */ a("span", { style: { color: "#ff4d4f", marginLeft: "4px" }, children: "*" })
60
+ ] }) : /* @__PURE__ */ a("span", { style: y, children: r });
61
+ return /* @__PURE__ */ a(
62
+ E.Item,
63
+ {
64
+ className: "bwg-form-item",
65
+ label: r ? u() : void 0,
66
+ labelAlign: i.labelAlign || "left",
67
+ name: f,
68
+ rules: s,
69
+ colon: !1,
70
+ initialValue: t,
71
+ style: l,
72
+ ...i,
73
+ children: e
74
+ }
75
+ );
76
+ }
77
+ ), At = ({
78
+ itemProps: e,
79
+ inputProps: r = {
80
+ format: "YN"
81
+ }
82
+ }) => {
83
+ const f = E.useFormInstance();
84
+ return /* @__PURE__ */ a(
85
+ T,
86
+ {
87
+ ...e,
88
+ getValueProps: (t) => ({ checked: r.format === "boolean" ? !!t : t === "Y" }),
89
+ normalize: (t) => typeof t == "boolean" ? r.format === "boolean" ? t : t ? "Y" : "N" : r.format === "boolean" ? !!t : t ? "Y" : "N",
90
+ children: /* @__PURE__ */ a(ue, { ...r, onChange: (t) => {
91
+ r.format === "boolean" ? f.setFieldValue(e?.name, t.target.checked) : f.setFieldValue(e?.name, t.target.checked ? "Y" : "N"), r.onChange && r.onChange(t);
92
+ }, children: r?.title })
93
+ }
94
+ );
95
+ }, Mt = ({ itemProps: e, inputProps: r }) => {
96
+ const f = E.useFormInstance(), [s, t] = j(
97
+ e?.initialValue ?? []
98
+ ), [l, g] = j([]), i = l.length > 0 && l.length == s?.length, y = s?.length > 0 && s.length < l.length;
99
+ G(() => {
100
+ g(c(r?.options));
101
+ }, [r?.options]), G(() => {
102
+ t(s);
103
+ }, [s]);
104
+ const c = (F) => {
105
+ const v = [];
106
+ return (F || []).map((V, R) => {
107
+ v.push(V.value);
108
+ }), v;
109
+ }, u = (F) => {
110
+ t(F.target.checked ? l : []), f.setFieldValue(e?.name, F.target.checked ? l : []);
111
+ }, Y = (F) => {
112
+ t(F), f.setFieldValue(e?.name, F), r?.onChange && typeof r?.onChange == "function" && r?.onChange(F);
113
+ };
114
+ return /* @__PURE__ */ a(T, { ...e, children: /* @__PURE__ */ K(se, { theme: {
115
+ components: {
116
+ Checkbox: {
117
+ colorPrimary: "var(--check-primary)",
118
+ colorPrimaryBorder: "var(--check-primary)",
119
+ colorPrimaryHover: "var(--check-primary-active)"
120
+ }
121
+ }
122
+ }, children: [
123
+ r?.allCheck && /* @__PURE__ */ a(
124
+ ue,
125
+ {
126
+ indeterminate: y,
127
+ checked: i,
128
+ onChange: u,
129
+ children: "전체선택"
130
+ }
131
+ ),
132
+ /* @__PURE__ */ a(
133
+ ue.Group,
134
+ {
135
+ options: r?.options,
136
+ value: s,
137
+ onChange: Y
138
+ }
139
+ )
140
+ ] }) });
141
+ }, pe = {
142
+ year: { displayFormat: "YYYY", outputFormat: "YYYY" },
143
+ month: { displayFormat: "YYYY-MM", outputFormat: "YYYYMM" },
144
+ date: { displayFormat: "YYYY-MM-DD", outputFormat: "YYYYMMDD" },
145
+ time: { displayFormat: "HH:mm", outputFormat: "HHmm" },
146
+ datetime: {
147
+ displayFormat: "YYYY-MM-DD HH:mm",
148
+ outputFormat: "YYYYMMDDHHmm"
149
+ }
150
+ }, _t = ({
151
+ itemProps: e,
152
+ inputProps: r,
153
+ type: f = "date",
154
+ returnType: s = "string"
155
+ }) => {
156
+ const { displayFormat: t, outputFormat: l } = Q(
157
+ () => pe[f],
158
+ [f]
159
+ ), g = Q(
160
+ () => Object.values(pe).map((i) => i.outputFormat).sort((i, y) => {
161
+ if (i.length === y.length) {
162
+ if (i === l) return -1;
163
+ if (y === l) return 1;
164
+ }
165
+ return y.length - i.length;
166
+ }),
167
+ [l]
168
+ // type(outputFormat)이 바뀔 때마다 재정렬
169
+ );
170
+ return /* @__PURE__ */ a(
171
+ T,
172
+ {
173
+ ...e,
174
+ getValueProps: (i) => ({
175
+ // 폼에 저장된 값(문자열 또는 Dayjs)을 DatePicker가 요구하는 Dayjs로 변환
176
+ value: i ? _.isDayjs(i) ? i : _(i, g) : null
177
+ }),
178
+ normalize: (i) => i ? s === "dayjs" ? i : i.format(l) : null,
179
+ children: /* @__PURE__ */ a(
180
+ ie,
181
+ {
182
+ ...r,
183
+ picker: f === "datetime" ? "date" : f,
184
+ showTime: r?.showTime ?? (f === "datetime" || f === "time"),
185
+ format: r?.format ?? t
186
+ }
187
+ )
188
+ }
189
+ );
190
+ }, Dt = ({
191
+ fileGrpKey: e,
192
+ onFetchFilesTrxCd: r = "SCMFILE00101",
193
+ readOnly: f = !1,
194
+ appCd: s = __APP_CD__
195
+ }) => {
196
+ const [t, l] = j([]);
197
+ G(() => {
198
+ if (r)
199
+ if (s != __APP_CD__) {
200
+ const y = he().findSystemByAppCd?.(s ?? __APP_CD__);
201
+ if (!y || !y.sysCd) {
202
+ console.error("해당 앱코드는 존재하지 않습니다.", s);
203
+ return;
204
+ }
205
+ We(
206
+ { trxCd: r, appCd: s },
207
+ {
208
+ crprCd: qe(),
209
+ sysCd: y.sysCd,
210
+ fileGrpKey: e
211
+ }
212
+ ).then((c) => {
213
+ if (c?.sub) {
214
+ const u = c.sub.map((Y) => ({
215
+ uid: Y.fileKey,
216
+ name: Y.lgclFileNm,
217
+ filePath: Y.filePath
218
+ }));
219
+ l(u);
220
+ }
221
+ }).catch((c) => {
222
+ console.error("파일 목록 조회 서비스 호출에 실패했습니다.", c), z.error("파일 목록을 불러오는 중 오류가 발생했습니다.");
223
+ });
224
+ } else
225
+ J(r, {
226
+ crprCd: te()?.crprCd,
227
+ sysCd: __SYS_CD__,
228
+ fileGrpKey: e
229
+ }).then((i) => {
230
+ if (i?.sub) {
231
+ const y = i.sub.map((c) => ({
232
+ uid: c.fileKey,
233
+ name: c.lgclFileNm,
234
+ filePath: c.filePath
235
+ }));
236
+ l(y);
237
+ }
238
+ }).catch((i) => {
239
+ console.error("파일 목록 조회 서비스 호출에 실패했습니다.", i), z.error("파일 목록을 불러오는 중 오류가 발생했습니다.");
240
+ });
241
+ else
242
+ l([]);
243
+ }, [e, r, s]);
244
+ const g = async (i) => {
245
+ try {
246
+ const c = he().findSystemByAppCd?.(s ?? __APP_CD__);
247
+ if (!c || !c.sysCd) {
248
+ console.error("해당 앱코드는 존재하지 않습니다.", s);
249
+ return;
250
+ }
251
+ const Y = await fetch("/api/download", {
252
+ method: "POST",
253
+ headers: {
254
+ SYSCD: c.sysCd,
255
+ "Content-Type": "application/json"
256
+ // 여기에 필요한 다른 헤더(예: 인증 토큰)를 추가할 수 있습니다.
257
+ },
258
+ body: JSON.stringify({
259
+ filePath: i.filePath,
260
+ logicalName: i.name,
261
+ fileKey: i.uid
262
+ })
263
+ });
264
+ if (!Y.ok) {
265
+ const N = (await Y.json().catch(() => null))?.message || "파일 다운로드에 실패했습니다.";
266
+ throw new Error(N);
267
+ }
268
+ const F = await Y.blob(), v = window.URL.createObjectURL(F), V = document.createElement("a");
269
+ V.href = v, V.setAttribute("download", i.name), document.body.appendChild(V), V.click(), document.body.removeChild(V), window.URL.revokeObjectURL(v);
270
+ } catch (y) {
271
+ console.error(y), z.error(
272
+ y.message || "파일을 다운로드하는 중 오류가 발생했습니다."
273
+ );
274
+ }
275
+ };
276
+ return /* @__PURE__ */ a(Ve, { title: "파일 목록", children: /* @__PURE__ */ a(
277
+ re,
278
+ {
279
+ dataSource: t,
280
+ renderItem: (i) => /* @__PURE__ */ a(
281
+ re.Item,
282
+ {
283
+ actions: f ? [] : [
284
+ /* @__PURE__ */ a(
285
+ X,
286
+ {
287
+ type: "text",
288
+ icon: /* @__PURE__ */ a(Ue, {}),
289
+ onClick: () => g(i)
290
+ },
291
+ "download"
292
+ )
293
+ ],
294
+ children: /* @__PURE__ */ a(re.Item.Meta, { avatar: /* @__PURE__ */ a(Re, {}), title: i.name })
295
+ }
296
+ )
297
+ }
298
+ ) });
299
+ }, nt = Be(
300
+ ({ children: e, labelCol: r, style: f, className: s, ...t }, l) => /* @__PURE__ */ a(
301
+ se,
302
+ {
303
+ form: {
304
+ /**
305
+ * 기존 rule.message의 default message인 $name을를 입력해주세요를 변경
306
+ * label이 단순 string이 아닌 <><>형식으로 변경되서 주석처리.
307
+ */
308
+ // validateMessages: { required: "'${label}을(를) 입력해주세요.'" },
309
+ },
310
+ children: /* @__PURE__ */ a(
311
+ E,
312
+ {
313
+ ref: l,
314
+ ...t,
315
+ requiredMark: !1,
316
+ labelCol: r || { flex: "100px" },
317
+ style: { padding: "10px", ...f },
318
+ className: `bwg-form ${s ?? ""}`,
319
+ children: e
320
+ }
321
+ )
322
+ }
323
+ )
324
+ );
325
+ nt.displayName = "BwgForm";
326
+ const Et = ({ itemProps: e, inputProps: r }) => /* @__PURE__ */ a(T, { ...e, children: /* @__PURE__ */ a(q, { ...r }) }), { Text: oe } = be, { Dragger: at } = Z, ot = [
327
+ ".pdf",
328
+ ".xlsx",
329
+ ".xls",
330
+ ".docx",
331
+ ".doc",
332
+ ".pptx",
333
+ ".ppt",
334
+ ".hwp",
335
+ ".txt",
336
+ ".csv",
337
+ // 이미지
338
+ ".jpg",
339
+ ".jpeg",
340
+ ".png",
341
+ ".gif",
342
+ // 압축
343
+ ".zip"
344
+ ], lt = (e, r = 2) => {
345
+ if (e === 0) return "0 Bytes";
346
+ const f = 1024, s = r < 0 ? 0 : r, t = ["Bytes", "KB", "MB", "GB", "TB"], l = Math.floor(Math.log(e) / Math.log(f));
347
+ return parseFloat((e / Math.pow(f, l)).toFixed(s)) + " " + t[l];
348
+ }, xt = ({
349
+ title: e = "첨부파일",
350
+ fileGrpKey: r,
351
+ onUploadComplete: f,
352
+ onSuccessTrxCd: s = "SCMFILE00102",
353
+ // BwgUploader와 동일한 기본 trxCd 설정
354
+ anotherServiceTrxCd: t = "SCMFILE00105",
355
+ allowedExtensions: l = ot,
356
+ maxFileSize: g = 2048
357
+ // 기본값 2GB
358
+ }) => {
359
+ const [i, y] = j([]), [c, u] = j(!1), [Y, F] = j(!1), [v, V] = j(0), R = (h) => {
360
+ if (l && l.length > 0) {
361
+ const x = (($) => {
362
+ const o = $.lastIndexOf(".");
363
+ return o === -1 ? "" : $.substring(o).toLowerCase();
364
+ })(h.name);
365
+ if (!l.includes(x))
366
+ return z.error(
367
+ `${h.name} 파일은 허용되지 않는 확장자입니다. (${l.join(
368
+ ", "
369
+ )}만 가능)`
370
+ ), !1;
371
+ }
372
+ return !0;
373
+ }, N = async () => {
374
+ const h = i.filter((C) => C.status !== "done"), L = h.reduce(
375
+ (C, w) => C + (w.size || 0),
376
+ 0
377
+ ), x = 2 * 1024 * 1024 * 1024;
378
+ if (L > x) {
379
+ Ae.error({
380
+ message: "업로드 용량 초과",
381
+ description: "한 번에 업로드할 수 있는 총 파일 용량은 2GB를 초과할 수 없습니다."
382
+ });
383
+ return;
384
+ }
385
+ if (h.length === 0) {
386
+ z.warning(
387
+ "업로드할 파일이 없거나 모든 파일이 이미 업로드되었습니다."
388
+ );
389
+ return;
390
+ }
391
+ F(!0);
392
+ let $;
393
+ try {
394
+ const C = new Ze();
395
+ h.forEach((w) => {
396
+ w.originFileObj && C.file(w.name, w.originFileObj);
397
+ }), $ = await C.generateAsync({
398
+ type: "blob",
399
+ compression: "DEFLATE",
400
+ compressionOptions: {
401
+ level: 9
402
+ // 높은 압축률 설정
403
+ }
404
+ });
405
+ } catch (C) {
406
+ F(!1), z.error("파일을 압축하는 중 오류가 발생했습니다."), console.error("Zipping error:", C);
407
+ return;
408
+ }
409
+ F(!1);
410
+ const o = new FormData();
411
+ o.append("file", $, "upload.zip"), u(!0), V(0);
412
+ try {
413
+ const C = await new Promise((I, B) => {
414
+ const O = new XMLHttpRequest();
415
+ O.open("POST", "/api/upload-large", !0), O.upload.onprogress = (U) => {
416
+ if (U.lengthComputable) {
417
+ const ee = Math.round(
418
+ U.loaded / U.total * 100
419
+ );
420
+ V(ee);
421
+ }
422
+ }, O.onload = () => {
423
+ if (O.status >= 200 && O.status < 300)
424
+ try {
425
+ const U = JSON.parse(O.responseText);
426
+ U.success ? I(U) : B(
427
+ new Error(U.message || "파일 업로드에 실패했습니다.")
428
+ );
429
+ } catch {
430
+ B(new Error("잘못된 서버 응답입니다."));
431
+ }
432
+ else
433
+ try {
434
+ const U = JSON.parse(O.responseText);
435
+ B(new Error(U.message || `서버 오류: ${O.status}`));
436
+ } catch {
437
+ B(new Error(`서버 오류: ${O.status}`));
438
+ }
439
+ }, O.onerror = () => {
440
+ B(new Error("네트워크 오류가 발생했습니다."));
441
+ }, O.send(o);
442
+ });
443
+ z.success(
444
+ C.message || "압축 파일이 성공적으로 업로드되었습니다."
445
+ );
446
+ const w = i.map(
447
+ (I) => h.find((B) => B.uid === I.uid) ? { ...I, status: "done" } : I
448
+ );
449
+ if (y(w), s && C.uploadedFiles && Array.isArray(C.uploadedFiles)) {
450
+ const I = te();
451
+ C.uploadedFiles.forEach((B) => {
452
+ const O = {
453
+ crprCd: I?.crprCd,
454
+ sysCd: __SYS_CD__,
455
+ fileGrpKey: r,
456
+ sub: [
457
+ {
458
+ crprCd: I?.crprCd,
459
+ sysCd: __SYS_CD__,
460
+ fileGrpKey: r,
461
+ physFileNm: B.fileNameP,
462
+ lgclFileNm: B.fileNameL,
463
+ filePath: B.filePath,
464
+ fileExtn: B.fileExt,
465
+ fileSize: B.fileSize,
466
+ mltpYn: "Y"
467
+ }
468
+ ]
469
+ };
470
+ J(s, O).then((U) => {
471
+ const ee = i.map((W) => ({
472
+ crprCd: I?.crprCd,
473
+ sysCd: __SYS_CD__,
474
+ fileGrpKey: U.sub[0].fileGrpKey,
475
+ fileKey: U.sub[0].fileKey,
476
+ lgclFileNm: W.name,
477
+ fileSize: W.size,
478
+ fileExtn: W.name.split(".").pop(),
479
+ fileType: W.type
480
+ }));
481
+ J(t, {
482
+ // 파일 목록에 fileKey를 추가합니다.
483
+ sub: ee
484
+ });
485
+ }).catch((U) => {
486
+ console.error("후처리 서비스 호출 실패:", U), z.error(
487
+ `${B.fileNameL} 파일의 후처리 작업에 실패했습니다.`
488
+ );
489
+ }), f && f({
490
+ fileNameP: B.fileNameP,
491
+ fileNameL: B.fileNameL
492
+ });
493
+ });
494
+ }
495
+ } catch (C) {
496
+ z.error(C.message || "파일 업로드 중 오류가 발생했습니다.");
497
+ const w = i.map(
498
+ (I) => h.find((B) => B.uid === I.uid) ? {
499
+ ...I,
500
+ status: "error",
501
+ response: C.message || "파일 업로드 중 오류가 발생했습니다."
502
+ } : I
503
+ );
504
+ y(w);
505
+ } finally {
506
+ u(!1);
507
+ }
508
+ }, M = {
509
+ multiple: !0,
510
+ fileList: i,
511
+ beforeUpload: (h) => R(h) ? g && h.size >= g * 1024 * 1024 ? (z.error(
512
+ `대용량 첨부 파일 최대 크기는 ${(g / 1024).toFixed(
513
+ 1
514
+ )}GB입니다.`
515
+ ), Z.LIST_IGNORE) : !1 : Z.LIST_IGNORE,
516
+ onChange: ({ fileList: h }) => {
517
+ const L = new Map(i.map((x) => [x.uid, x]));
518
+ h.forEach((x) => {
519
+ L.set(x.uid, x);
520
+ }), y(Array.from(L.values()));
521
+ },
522
+ onRemove: (h) => {
523
+ const L = i.filter((x) => x.uid !== h.uid);
524
+ y(L);
525
+ },
526
+ showUploadList: !1
527
+ // 수동으로 목록을 렌더링하므로 antd의 기본 목록은 숨깁니다.
528
+ };
529
+ return /* @__PURE__ */ a(
530
+ Le,
531
+ {
532
+ spinning: c || Y,
533
+ tip: Y ? "파일 압축 중..." : `파일 업로드 중... ${v}%`,
534
+ children: /* @__PURE__ */ K("div", { className: "bwg-large-uploader-container", children: [
535
+ /* @__PURE__ */ a(
536
+ Ve,
537
+ {
538
+ title: /* @__PURE__ */ a(oe, { strong: !0, children: e }),
539
+ extra: /* @__PURE__ */ a(Z, { ...M, children: /* @__PURE__ */ a(X, { icon: /* @__PURE__ */ a(ke, {}), children: "파일 선택" }) }),
540
+ style: { padding: 0 },
541
+ children: /* @__PURE__ */ a(
542
+ at,
543
+ {
544
+ ...M,
545
+ style: {
546
+ border: "none",
547
+ background: "transparent",
548
+ padding: 0
549
+ },
550
+ children: /* @__PURE__ */ a("div", { className: "upload-list-container", children: i.length > 0 ? /* @__PURE__ */ a(
551
+ re,
552
+ {
553
+ style: { textAlign: "left" },
554
+ dataSource: i,
555
+ renderItem: (h) => {
556
+ const L = h.status === "done", x = h.status === "error";
557
+ let $;
558
+ return L ? $ = /* @__PURE__ */ a(
559
+ Pe,
560
+ {
561
+ style: { color: "#52c41a", fontSize: 14 }
562
+ }
563
+ ) : x ? $ = /* @__PURE__ */ a(
564
+ Me,
565
+ {
566
+ title: typeof h.response == "string" ? h.response : "업로드 실패",
567
+ children: /* @__PURE__ */ a(
568
+ Ke,
569
+ {
570
+ style: { color: "#ff4d4f", fontSize: 14 }
571
+ }
572
+ )
573
+ }
574
+ ) : $ = /* @__PURE__ */ a(Ge, { style: { fontSize: 14 } }), /* @__PURE__ */ a(
575
+ re.Item,
576
+ {
577
+ actions: [
578
+ /* @__PURE__ */ a(oe, { type: "secondary", children: lt(h.size || 0) }, "size"),
579
+ /* @__PURE__ */ a(
580
+ X,
581
+ {
582
+ type: "text",
583
+ icon: /* @__PURE__ */ a(Te, {}),
584
+ onClick: (o) => {
585
+ o.stopPropagation(), M.onRemove?.(h);
586
+ },
587
+ disabled: c || Y
588
+ },
589
+ "delete"
590
+ )
591
+ ],
592
+ children: /* @__PURE__ */ a(
593
+ re.Item.Meta,
594
+ {
595
+ avatar: $,
596
+ title: /* @__PURE__ */ a(oe, { type: x ? "danger" : void 0, children: h.name })
597
+ }
598
+ )
599
+ },
600
+ h.uid
601
+ );
602
+ }
603
+ }
604
+ ) : /* @__PURE__ */ K(
605
+ ge,
606
+ {
607
+ gap: "middle",
608
+ align: "center",
609
+ justify: "center",
610
+ vertical: !0,
611
+ style: { padding: "20px 0", minHeight: "120px" },
612
+ children: [
613
+ /* @__PURE__ */ a(je, { style: { fontSize: "32px", color: "#999" } }),
614
+ /* @__PURE__ */ a(oe, { type: "secondary", children: "업로드할 파일을 선택하거나 이 영역으로 드래그하세요." })
615
+ ]
616
+ }
617
+ ) })
618
+ }
619
+ )
620
+ }
621
+ ),
622
+ i.length > 0 && /* @__PURE__ */ K(
623
+ ge,
624
+ {
625
+ justify: "flex-end",
626
+ align: "center",
627
+ gap: "large",
628
+ style: { marginTop: 16 },
629
+ children: [
630
+ c && /* @__PURE__ */ a("div", { style: { width: "250px" }, children: /* @__PURE__ */ a(ve, { percent: v, size: "small" }) }),
631
+ /* @__PURE__ */ a(
632
+ X,
633
+ {
634
+ type: "primary",
635
+ onClick: N,
636
+ disabled: c || Y || i.filter((h) => h.status !== "done").length === 0,
637
+ icon: /* @__PURE__ */ a(He, {}),
638
+ children: "일괄 업로드"
639
+ }
640
+ )
641
+ ]
642
+ }
643
+ )
644
+ ] })
645
+ }
646
+ );
647
+ }, st = (e) => {
648
+ if (typeof e == "string")
649
+ return e.replace(/0/g, "_");
650
+ if (Array.isArray(e))
651
+ return e[0].replace(/0/g, "_");
652
+ if (typeof e == "object" && "mask" in e && "blocks" in e) {
653
+ const { mask: r, blocks: f } = e;
654
+ return r.split(".").map((s) => {
655
+ const l = f?.[s]?.maxLength ?? 3;
656
+ return "_".repeat(l);
657
+ }).join(".");
658
+ }
659
+ return "";
660
+ }, Bt = ({
661
+ itemProps: e,
662
+ inputProps: r,
663
+ mask: f
664
+ }) => {
665
+ const s = P(null), t = E.useFormInstance(), l = Q(() => st(f), [f]);
666
+ return G(() => {
667
+ if (!s.current?.input) return;
668
+ const g = typeof f == "string" || Array.isArray(f) ? { mask: f } : f, i = le(s.current.input, g);
669
+ return i.on("accept", () => {
670
+ t && e?.name && t.setFieldValue(e.name, i.value);
671
+ }), () => {
672
+ i.destroy();
673
+ };
674
+ }, [f, t, e?.name]), /* @__PURE__ */ a(T, { ...e, children: /* @__PURE__ */ a(q, { ...r, ref: s, placeholder: l }) });
675
+ }, it = (e) => {
676
+ switch (e) {
677
+ case "year":
678
+ return { format: "YYYY", mask: "0000", outputFormat: "YYYY" };
679
+ case "month":
680
+ return { format: "YYYY-MM", mask: "0000-00", outputFormat: "YYYYMM" };
681
+ case "date":
682
+ default:
683
+ return {
684
+ format: "YYYY-MM-DD",
685
+ mask: "0000-00-00",
686
+ outputFormat: "YYYYMMDD"
687
+ };
688
+ }
689
+ }, Ot = ({
690
+ type: e = "date",
691
+ itemProps: r = { name: "calendar" },
692
+ inputProps: f,
693
+ pickerProps: s
694
+ }) => {
695
+ const { format: t, mask: l, outputFormat: g } = it(e), i = P(null), y = P(null), c = P(null), u = E.useFormInstance(), [Y, F] = j(!1), [v, V] = j(!1), R = r?.name, [N, M] = j(null), h = E.useWatch(R, u), L = we();
696
+ G(() => {
697
+ if (!i.current?.input) return;
698
+ const o = le(i.current.input, {
699
+ mask: l,
700
+ lazy: !1
701
+ });
702
+ return y.current = o, o.on("accept", () => {
703
+ const C = o.value;
704
+ C.length > 0 && F(!0);
705
+ const w = _(C, t, !0);
706
+ C.length === t.length && w.isValid() && (u.setFieldValue(R, w.format(g)), M(w), y.current?.updateValue());
707
+ }), () => {
708
+ o.destroy();
709
+ };
710
+ }, [t, l]), G(() => {
711
+ if (!h) {
712
+ M(null);
713
+ return;
714
+ }
715
+ let o = null;
716
+ if (typeof h == "string" && h.length === g.length && /^\d+$/.test(h))
717
+ if (e === "date") {
718
+ const C = h.substring(0, 4), w = h.substring(4, 6), I = h.substring(6, 8);
719
+ o = _(`${C}-${w}-${I}`, t, !0);
720
+ } else if (e === "month") {
721
+ const C = h.substring(0, 4), w = h.substring(4, 6);
722
+ o = _(`${C}-${w}`, t, !0);
723
+ } else e === "year" && (o = _(h, t, !0));
724
+ else
725
+ o = _(h, t, !0);
726
+ o && o.isValid() ? M(o) : M(null), V(!1);
727
+ }, [h, t, g, e]);
728
+ const x = (o) => {
729
+ if (!o) {
730
+ u.setFieldValue(R, void 0), M(null), y.current?.updateValue();
731
+ return;
732
+ }
733
+ M(o);
734
+ const C = o.format(g);
735
+ u.setFieldValue(R, C), y.current && (y.current.value = o.format(t), y.current.updateValue()), V(!1);
736
+ }, $ = (o) => {
737
+ setTimeout(() => {
738
+ const C = document.activeElement, w = c.current, I = w?.querySelector(".ant-picker-dropdown");
739
+ !(w && (w.contains(C) || w === C || I?.contains(C))) && !(o !== void 0 ? o : Y) && console.log("✅ Input과 DatePicker 모두 포커스가 없습니다");
740
+ }, 0);
741
+ };
742
+ return /* @__PURE__ */ a(
743
+ T,
744
+ {
745
+ ...r,
746
+ name: void 0,
747
+ validateStatus: v ? "warning" : void 0,
748
+ children: /* @__PURE__ */ K(
749
+ se,
750
+ {
751
+ componentSize: L.componentSize,
752
+ theme: {
753
+ components: {
754
+ Input: {
755
+ addonBg: "#fff"
756
+ }
757
+ }
758
+ },
759
+ children: [
760
+ /* @__PURE__ */ a(
761
+ E.Item,
762
+ {
763
+ name: R,
764
+ getValueProps: (o) => ({
765
+ value: o ? _(o).format(t) : void 0
766
+ }),
767
+ normalize: (o) => o ? _(o).format(g) : void 0,
768
+ noStyle: !0,
769
+ children: /* @__PURE__ */ a(
770
+ q,
771
+ {
772
+ ...f,
773
+ ref: i,
774
+ onFocus: () => {
775
+ F(!Y), y.current?.updateValue();
776
+ },
777
+ onBlur: () => {
778
+ $();
779
+ },
780
+ onKeyDown: (o) => {
781
+ if (o.key === "Backspace" && F(!0), o.key === "Tab" && F(!1), o.key === "Enter")
782
+ if (Y) {
783
+ const C = y.current?.value || "", w = _(C, t, !0);
784
+ C.length === t.length && w.isValid() ? (F(!1), V(!1)) : V(!0);
785
+ } else
786
+ F(!0);
787
+ },
788
+ style: {
789
+ width: "65%"
790
+ },
791
+ allowClear: !0,
792
+ placeholder: l.replace(/0/g, "_"),
793
+ suffix: /* @__PURE__ */ a(de, { style: { color: "#d9d9d9" } }),
794
+ autoComplete: "off"
795
+ }
796
+ )
797
+ }
798
+ ),
799
+ /* @__PURE__ */ a(
800
+ ie,
801
+ {
802
+ ...s,
803
+ open: Y,
804
+ picker: e,
805
+ format: {
806
+ format: t,
807
+ type: "mask"
808
+ },
809
+ showNow: !0,
810
+ value: N,
811
+ onChange: x,
812
+ onOpenChange: (o) => {
813
+ F(o), o || $(!1);
814
+ },
815
+ renderExtraFooter: () => v ? /* @__PURE__ */ K(
816
+ "div",
817
+ {
818
+ style: {
819
+ color: "#faad14",
820
+ paddingLeft: "8px",
821
+ fontSize: "12px",
822
+ display: "flex",
823
+ alignItems: "center",
824
+ gap: "6px",
825
+ borderTop: "1px solid #f0f0f0",
826
+ backgroundColor: "#fffbe6"
827
+ },
828
+ children: [
829
+ /* @__PURE__ */ a(Se, {}),
830
+ /* @__PURE__ */ a("span", { children: "유효하지 않은 날짜입니다" })
831
+ ]
832
+ }
833
+ ) : null,
834
+ getPopupContainer: (o) => o.parentElement,
835
+ style: {
836
+ position: "absolute",
837
+ top: 0,
838
+ left: 0,
839
+ pointerEvents: "none",
840
+ opacity: 0,
841
+ width: "100%"
842
+ }
843
+ }
844
+ )
845
+ ]
846
+ }
847
+ )
848
+ }
849
+ );
850
+ }, { RangePicker: ct } = ie, ut = (e) => {
851
+ switch (e) {
852
+ case "year":
853
+ return { format: "YYYY", mask: "0000", outputFormat: "YYYY" };
854
+ case "month":
855
+ return { format: "YYYY-MM", mask: "0000-00", outputFormat: "YYYYMM" };
856
+ case "date":
857
+ default:
858
+ return {
859
+ format: "YYYY-MM-DD",
860
+ mask: "0000-00-00",
861
+ outputFormat: "YYYYMMDD"
862
+ };
863
+ }
864
+ }, zt = ({
865
+ type: e = "date",
866
+ itemProps: r = { name: "dateRange" },
867
+ inputProps: f,
868
+ pickerProps: s
869
+ }) => {
870
+ const { format: t, mask: l, outputFormat: g } = ut(e), i = P(null), y = P(null), c = P(null), u = P(null), Y = P(null), F = E.useFormInstance(), [v, V] = j(!1), [R, N] = j(!1), [M, h] = j(null), [L, x] = j(!1), $ = P(!1), o = r?.name, [C, w] = j([
871
+ null,
872
+ null
873
+ ]), I = E.useWatch(
874
+ o ? Array.isArray(o) ? [...o, 0] : [o, 0] : void 0,
875
+ F
876
+ ), B = E.useWatch(
877
+ o ? Array.isArray(o) ? [...o, 1] : [o, 1] : void 0,
878
+ F
879
+ ), O = E.useWatch(o, F), U = we();
880
+ G(() => {
881
+ if (!i.current?.input) return;
882
+ const n = le(i.current.input, {
883
+ mask: l,
884
+ lazy: !1
885
+ });
886
+ return c.current = n, n.on("accept", () => {
887
+ const m = n.value, p = n.unmaskedValue || "";
888
+ if (console.log("🔵 [시작일] accept 이벤트:", {
889
+ maskValue: m,
890
+ unmaskedValue: p,
891
+ length: m.length,
892
+ formatLength: t.length
893
+ }), m.length > 0 && (h("start"), V(!0), x(!1)), p.length === g.length) {
894
+ const d = _(m, t, !0);
895
+ if (d.isValid()) {
896
+ console.log("🔵 [시작일] 입력 완료 및 검증 통과:", {
897
+ parsed: d.format(t)
898
+ });
899
+ const A = d.format(g);
900
+ $.current = !0;
901
+ const k = Array.isArray(o) ? [...o, 0] : [o, 0];
902
+ F.setFieldValue(k, A), w([d, C[1]]), c.current && c.current.updateValue(), N(!1), setTimeout(() => {
903
+ u.current && (u.current.value = "", u.current.unmaskedValue = "", u.current.updateValue());
904
+ const b = Array.isArray(o) ? [...o, 1] : [o, 1];
905
+ F.getFieldValue(b) || F.setFieldValue(b, void 0), y.current?.focus(), setTimeout(() => {
906
+ if (u.current) {
907
+ const D = u.current.value || "";
908
+ !(u.current.unmaskedValue || "") && !D.replace(/[^0-9]/g, "") && (u.current.value = "", u.current.updateValue());
909
+ }
910
+ }, 10), h("end"), V(!0), $.current = !1;
911
+ }, 0);
912
+ } else
913
+ s?.allowEmpty ? N(!1) : (console.log("🔵 [시작일] 검증 실패:", { val: m, parsed: d }), N(!0));
914
+ }
915
+ }), () => {
916
+ n.destroy();
917
+ };
918
+ }, [t, l, o]), G(() => {
919
+ if (!y.current?.input) return;
920
+ const n = le(y.current.input, {
921
+ mask: l,
922
+ lazy: !1
923
+ });
924
+ return u.current = n, n.on("accept", () => {
925
+ const m = n.value, p = n.unmaskedValue || "";
926
+ if (console.log("🟢 [종료일] accept 이벤트:", {
927
+ maskValue: m,
928
+ unmaskedValue: p,
929
+ length: m.length,
930
+ formatLength: t.length
931
+ }), p === "" || p.length === 0) {
932
+ const d = Array.isArray(o) ? [...o, 1] : [o, 1];
933
+ F.setFieldValue(d, void 0), w([C[0], null]), u.current && (u.current.value = "", u.current.updateValue()), setTimeout(() => {
934
+ i.current?.focus(), h("start"), V(!0);
935
+ }, 0);
936
+ return;
937
+ }
938
+ if (m.length > 0 && (h("end"), V(!0)), m.length < t.length) {
939
+ N(!1);
940
+ return;
941
+ }
942
+ if (p.length === g.length) {
943
+ const d = _(m, t, !0);
944
+ if (d.isValid()) {
945
+ const A = d.format(g);
946
+ console.log("🟢 [종료일] 입력 완료:", {
947
+ parsed: d.format(t),
948
+ formatted: A
949
+ }), $.current = !0;
950
+ const k = Array.isArray(o) ? [...o, 1] : [o, 1];
951
+ F.setFieldValue(k, A), w([C[0], d]), u.current?.updateValue(), setTimeout(() => {
952
+ $.current = !1;
953
+ }, 0);
954
+ } else
955
+ s?.allowEmpty ? N(!1) : (console.log("🟢 [종료일] 검증 실패:", { val: m, parsed: d }), N(!0));
956
+ }
957
+ }), () => {
958
+ n.destroy();
959
+ };
960
+ }, [t, l, o]), G(() => {
961
+ console.log("🟡 [useEffect] form 값 변경 감지:", {
962
+ startFormValue: I,
963
+ endFormValue: B,
964
+ formValue: O
965
+ });
966
+ const n = I ?? (Array.isArray(O) ? O[0] : null), m = B ?? (Array.isArray(O) ? O[1] : null);
967
+ if (n === void 0 && m === void 0 && (!O || !Array.isArray(O))) {
968
+ w([null, null]);
969
+ return;
970
+ }
971
+ const p = (k) => {
972
+ if (!k) return null;
973
+ let b = null;
974
+ if (typeof k == "string" && k.length === g.length && /^\d+$/.test(k))
975
+ if (e === "date") {
976
+ const S = k.substring(0, 4), D = k.substring(4, 6), H = k.substring(6, 8);
977
+ b = _(`${S}-${D}-${H}`, t, !0);
978
+ } else if (e === "month") {
979
+ const S = k.substring(0, 4), D = k.substring(4, 6);
980
+ b = _(`${S}-${D}`, t, !0);
981
+ } else e === "year" && (b = _(k, t, !0));
982
+ else
983
+ b = _(k, t, !0);
984
+ return b && b.isValid() ? b : null;
985
+ }, d = p(n), A = p(m);
986
+ if (console.log("🟡 [useEffect] 파싱 결과:", {
987
+ startParsed: d ? d.format(t) : null,
988
+ endParsed: A ? A.format(t) : null,
989
+ isStartDateFromPicker: L
990
+ }), w([d, A]), $.current) {
991
+ console.log("🟡 [useEffect] 사용자 입력 중 - 마스크 값 업데이트 스킵"), N(!1);
992
+ return;
993
+ }
994
+ if (!L && c.current) {
995
+ const k = c.current.value || "", b = d ? d.format(t) : "", S = c.current.unmaskedValue || "", D = d ? d.format(g) : "";
996
+ console.log("🟡 [useEffect] 시작일 마스크 값 체크:", {
997
+ currentMaskValue: k,
998
+ expectedMaskValue: b,
999
+ unmaskedValue: S,
1000
+ expectedUnmasked: D,
1001
+ shouldUpdate: k === "" || k !== b,
1002
+ canUpdate: S === "" || S === D
1003
+ }), (k === "" || k !== b) && (S === "" || S === D ? (console.log("🟡 [useEffect] 시작일 마스크 값 업데이트:", {
1004
+ before: k,
1005
+ after: d ? d.format(t) : ""
1006
+ }), d ? (c.current.value = d.format(t), c.current.updateValue()) : (c.current.value = "", c.current.updateValue())) : console.log(
1007
+ "🟡 [useEffect] 시작일 마스크 값 업데이트 스킵 (사용자 입력 중)"
1008
+ ));
1009
+ }
1010
+ if (u.current) {
1011
+ const k = u.current.value || "", b = A ? A.format(t) : "", S = u.current.unmaskedValue || "", D = A ? A.format(g) : "";
1012
+ console.log("🟡 [useEffect] 종료일 마스크 값 체크:", {
1013
+ currentMaskValue: k,
1014
+ expectedMaskValue: b,
1015
+ unmaskedValue: S,
1016
+ expectedUnmasked: D,
1017
+ shouldUpdate: k === "" || k !== b,
1018
+ canUpdate: S === "" || S === D
1019
+ }), (k === "" || k !== b) && (S === "" || S === D ? (console.log("🟡 [useEffect] 종료일 마스크 값 업데이트:", {
1020
+ before: k,
1021
+ after: b
1022
+ }), A ? (u.current.value = A.format(t), u.current.updateValue()) : (u.current.value = "", u.current.updateValue())) : console.log(
1023
+ "🟡 [useEffect] 종료일 마스크 값 업데이트 스킵 (사용자 입력 중)"
1024
+ ));
1025
+ }
1026
+ N(!1);
1027
+ }, [I, B, O, t, g, e]);
1028
+ const ee = (n) => {
1029
+ if (console.log("🔴 [RangePicker] 날짜 변경:", {
1030
+ dates: n ? [
1031
+ n[0] ? n[0].format(t) : null,
1032
+ n[1] ? n[1].format(t) : null
1033
+ ] : null,
1034
+ prevRange: [
1035
+ C[0] ? C[0].format(t) : null,
1036
+ C[1] ? C[1].format(t) : null
1037
+ ]
1038
+ }), !n) {
1039
+ w([null, null]);
1040
+ const b = Array.isArray(o) ? [...o, 0] : [o, 0], S = Array.isArray(o) ? [...o, 1] : [o, 1];
1041
+ F.setFieldValue(b, void 0), F.setFieldValue(S, void 0), c.current?.updateValue(), u.current?.updateValue();
1042
+ return;
1043
+ }
1044
+ const [m, p] = n, d = C[0], A = m && (!d || !m.isSame(
1045
+ d,
1046
+ e === "year" ? "year" : e === "month" ? "month" : "day"
1047
+ ));
1048
+ if (console.log("🔴 [RangePicker] 시작일 변경 여부:", {
1049
+ isStartDateChanged: A,
1050
+ startDate: m ? m.format(t) : null,
1051
+ prevStartDate: d ? d.format(t) : null
1052
+ }), w([m, p]), A) {
1053
+ console.log("🔴 [RangePicker] 시작일 선택됨 - input 비우기"), x(!0), c.current && (c.current.value = "", c.current.updateValue());
1054
+ const b = m.format(g);
1055
+ console.log("🔴 [RangePicker] form 값 업데이트:", {
1056
+ formatted: b
1057
+ });
1058
+ const S = Array.isArray(o) ? [...o, 0] : [o, 0];
1059
+ F.setFieldValue(S, b);
1060
+ } else if (!m && c.current) {
1061
+ x(!1), c.current.value = "", c.current.updateValue();
1062
+ const b = Array.isArray(o) ? [...o, 0] : [o, 0];
1063
+ F.setFieldValue(b, void 0);
1064
+ } else
1065
+ x(!1);
1066
+ const k = Array.isArray(o) ? [...o, 1] : [o, 1];
1067
+ if (p) {
1068
+ const b = p.format(g);
1069
+ F.setFieldValue(k, b), u.current && (u.current.value = p.format(t), u.current.updateValue());
1070
+ } else
1071
+ F.setFieldValue(k, void 0), u.current && (u.current.value = "", u.current.updateValue());
1072
+ N(!1);
1073
+ }, W = (n) => {
1074
+ setTimeout(() => {
1075
+ const m = document.activeElement, p = Y.current, d = p?.querySelector(".ant-picker-dropdown");
1076
+ !(p && (p.contains(m) || p === m || d?.contains(m))) && !(n !== void 0 ? n : v) && (console.log("✅ Input과 RangePicker 모두 포커스가 없습니다"), V(!1));
1077
+ }, 0);
1078
+ };
1079
+ return /* @__PURE__ */ a(
1080
+ T,
1081
+ {
1082
+ ...r,
1083
+ name: void 0,
1084
+ validateStatus: R ? "warning" : void 0,
1085
+ children: /* @__PURE__ */ K(
1086
+ se,
1087
+ {
1088
+ componentSize: U.componentSize,
1089
+ theme: {
1090
+ components: {
1091
+ Input: {
1092
+ addonBg: "#fff"
1093
+ }
1094
+ }
1095
+ },
1096
+ children: [
1097
+ /* @__PURE__ */ K(
1098
+ "div",
1099
+ {
1100
+ ref: Y,
1101
+ style: {
1102
+ display: "flex",
1103
+ alignItems: "center",
1104
+ gap: "8px",
1105
+ width: "100%"
1106
+ },
1107
+ children: [
1108
+ /* @__PURE__ */ a(
1109
+ E.Item,
1110
+ {
1111
+ name: o ? Array.isArray(o) ? [...o, 0] : [o, 0] : void 0,
1112
+ getValueProps: (n) => {
1113
+ if (!n) return { value: void 0 };
1114
+ if (typeof n == "string" && n.length === g.length && /^\d+$/.test(n)) {
1115
+ if (e === "date") {
1116
+ const m = n.substring(0, 4), p = n.substring(4, 6), d = n.substring(6, 8);
1117
+ return { value: `${m}-${p}-${d}` };
1118
+ } else if (e === "month") {
1119
+ const m = n.substring(0, 4), p = n.substring(4, 6);
1120
+ return { value: `${m}-${p}` };
1121
+ } else if (e === "year")
1122
+ return { value: n };
1123
+ }
1124
+ return { value: _(n).format(t) };
1125
+ },
1126
+ normalize: (n) => n ? _(n).format(g) : (s?.allowEmpty, void 0),
1127
+ noStyle: !0,
1128
+ children: /* @__PURE__ */ a(
1129
+ q,
1130
+ {
1131
+ ...f,
1132
+ value: void 0,
1133
+ ref: i,
1134
+ onFocus: () => {
1135
+ if (h("start"), V(!v), x(!1), c.current) {
1136
+ const n = Array.isArray(o) ? [...o, 0] : [o, 0];
1137
+ F.getFieldValue(n) || (c.current.value = "", c.current.unmaskedValue = ""), c.current.updateValue();
1138
+ }
1139
+ },
1140
+ onBlur: () => {
1141
+ W();
1142
+ },
1143
+ onKeyDown: (n) => {
1144
+ if (n.key === "Backspace" && (h("start"), V(!0)), n.key === "Enter")
1145
+ if (v && M === "start") {
1146
+ const m = c.current?.value || "";
1147
+ m.length === t.length ? _(m, t, !0).isValid() ? (V(!1), N(!1)) : s?.allowEmpty ? N(!1) : N(!0) : N(!1);
1148
+ } else
1149
+ h("start"), V(!0);
1150
+ },
1151
+ style: {
1152
+ flex: 1
1153
+ },
1154
+ allowClear: !0,
1155
+ placeholder: l.replace(/0/g, "_"),
1156
+ suffix: /* @__PURE__ */ a(de, { style: { color: "#d9d9d9" } }),
1157
+ autoComplete: "off"
1158
+ }
1159
+ )
1160
+ }
1161
+ ),
1162
+ /* @__PURE__ */ a("span", { style: { color: "#d9d9d9", userSelect: "none" }, children: "~" }),
1163
+ /* @__PURE__ */ a(
1164
+ E.Item,
1165
+ {
1166
+ name: o ? Array.isArray(o) ? [...o, 1] : [o, 1] : void 0,
1167
+ getValueProps: (n) => {
1168
+ if (!n) return { value: void 0 };
1169
+ if (typeof n == "string" && n.length === g.length && /^\d+$/.test(n)) {
1170
+ if (e === "date") {
1171
+ const m = n.substring(0, 4), p = n.substring(4, 6), d = n.substring(6, 8);
1172
+ return { value: `${m}-${p}-${d}` };
1173
+ } else if (e === "month") {
1174
+ const m = n.substring(0, 4), p = n.substring(4, 6);
1175
+ return { value: `${m}-${p}` };
1176
+ } else if (e === "year")
1177
+ return { value: n };
1178
+ }
1179
+ return { value: _(n).format(t) };
1180
+ },
1181
+ normalize: (n) => n ? _(n).format(g) : (s?.allowEmpty, void 0),
1182
+ noStyle: !0,
1183
+ children: /* @__PURE__ */ a(
1184
+ q,
1185
+ {
1186
+ ...f,
1187
+ ref: y,
1188
+ onFocus: () => {
1189
+ if (h("end"), V(!v), u.current) {
1190
+ u.current.updateValue();
1191
+ const n = u.current.value || "";
1192
+ !(u.current.unmaskedValue || "") && !n.replace(/[^0-9]/g, "") && (u.current.value = "", u.current.updateValue());
1193
+ }
1194
+ },
1195
+ onBlur: () => {
1196
+ W();
1197
+ },
1198
+ onKeyDown: (n) => {
1199
+ if (n.key === "Backspace") {
1200
+ const m = u.current?.value || "", p = u.current?.unmaskedValue || "";
1201
+ if (m === "" || p === "" || m.replace(/[^0-9]/g, "").length <= 1) {
1202
+ n.preventDefault();
1203
+ const d = Array.isArray(o) ? [...o, 1] : [o, 1];
1204
+ F.setFieldValue(d, void 0), w([C[0], null]), u.current && (u.current.value = "", u.current.updateValue()), setTimeout(() => {
1205
+ i.current?.focus(), h("start"), V(!0);
1206
+ }, 0);
1207
+ return;
1208
+ }
1209
+ h("end"), V(!0);
1210
+ }
1211
+ if (n.key === "Tab" && V(!1), n.key === "Enter")
1212
+ if (v && M === "end") {
1213
+ const m = u.current?.value || "";
1214
+ m.length === t.length ? _(m, t, !0).isValid() ? (V(!1), N(!1)) : s?.allowEmpty ? N(!1) : N(!0) : N(!1);
1215
+ } else
1216
+ h("end"), V(!0);
1217
+ },
1218
+ style: {
1219
+ flex: 1
1220
+ },
1221
+ allowClear: !0,
1222
+ onClear: () => {
1223
+ const n = Array.isArray(o) ? [...o, 1] : [o, 1];
1224
+ F.setFieldValue(n, void 0), w([C[0], null]), u.current && (u.current.value = "", u.current.updateValue()), setTimeout(() => {
1225
+ i.current?.focus(), h("start"), V(!0);
1226
+ }, 0);
1227
+ },
1228
+ placeholder: l.replace(/0/g, "_"),
1229
+ suffix: /* @__PURE__ */ a(de, { style: { color: "#d9d9d9" } }),
1230
+ autoComplete: "off"
1231
+ }
1232
+ )
1233
+ }
1234
+ )
1235
+ ]
1236
+ }
1237
+ ),
1238
+ /* @__PURE__ */ a(
1239
+ ct,
1240
+ {
1241
+ ...s,
1242
+ open: v,
1243
+ picker: e,
1244
+ format: {
1245
+ format: t,
1246
+ type: "mask"
1247
+ },
1248
+ showNow: !0,
1249
+ value: C,
1250
+ onChange: ee,
1251
+ onOpenChange: (n) => {
1252
+ V(n), n || W(!1);
1253
+ },
1254
+ renderExtraFooter: () => R ? /* @__PURE__ */ K(
1255
+ "div",
1256
+ {
1257
+ style: {
1258
+ color: "#faad14",
1259
+ paddingLeft: "8px",
1260
+ fontSize: "12px",
1261
+ display: "flex",
1262
+ alignItems: "center",
1263
+ gap: "6px",
1264
+ borderTop: "1px solid #f0f0f0",
1265
+ backgroundColor: "#fffbe6"
1266
+ },
1267
+ children: [
1268
+ /* @__PURE__ */ a(Se, {}),
1269
+ /* @__PURE__ */ a("span", { children: "유효하지 않은 날짜입니다" })
1270
+ ]
1271
+ }
1272
+ ) : null,
1273
+ getPopupContainer: (n) => n.parentElement,
1274
+ style: {
1275
+ position: "absolute",
1276
+ top: 0,
1277
+ left: 0,
1278
+ pointerEvents: "none",
1279
+ opacity: 0,
1280
+ width: "100%"
1281
+ }
1282
+ }
1283
+ )
1284
+ ]
1285
+ }
1286
+ )
1287
+ }
1288
+ );
1289
+ }, { Option: ye } = fe, $t = ({ itemProps: e, inputProps: r }) => {
1290
+ const [f, s] = j([]);
1291
+ return G(() => {
1292
+ r?.addField === "ALL" ? s([
1293
+ { label: "전체", value: "" },
1294
+ ...r?.list || []
1295
+ ]) : r?.addField === "NULL" ? s([{ label: "", value: "" }, ...r?.list || []]) : s(r?.list || []);
1296
+ }, [r?.list]), /* @__PURE__ */ a(
1297
+ T,
1298
+ {
1299
+ ...e,
1300
+ getValueProps: (t) => t ? {
1301
+ value: t && t.indexOf(",") > 0 ? t.split(",") : [t]
1302
+ } : {
1303
+ value: []
1304
+ },
1305
+ normalize: (t) => t != null && t != null && t.length > 0 ? t.toString() : "",
1306
+ children: /* @__PURE__ */ a(fe, { ...r, mode: "multiple", children: f.map((t) => {
1307
+ const { value: l, label: g } = t;
1308
+ return r?.printCode ? /* @__PURE__ */ a(ye, { value: l, label: g, children: /* @__PURE__ */ a(ae, { children: `[${l}] ${g}` }) }, l) : /* @__PURE__ */ a(ye, { value: l, label: g, children: /* @__PURE__ */ a(ae, { children: `${g}` }) }, l);
1309
+ }) })
1310
+ }
1311
+ );
1312
+ }, Rt = ({ itemProps: e, inputProps: r }) => {
1313
+ const f = (t) => {
1314
+ let l = t.toString().split(".");
1315
+ return r?.decimalPoint != null && l[1] != null && r?.decimalPoint > 0 ? l[1].length > r?.decimalPoint ? l[1] = "." + l[1].substring(0, r?.decimalPoint) : l[1] = "." + l[1] : l[1] = "", l[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",") + l[1];
1316
+ }, s = (t) => {
1317
+ let l = t.toString().split(".");
1318
+ return r?.decimalPoint != null && l[1] != null && r?.decimalPoint > 0 ? l[1].length > r?.decimalPoint ? l[1] = "." + l[1].substring(0, r?.decimalPoint) : l[1] = "." + l[1] : l[1] = "", l[0].replace(/\$\s?|(,*)/g, "") + l[1];
1319
+ };
1320
+ return /* @__PURE__ */ a(T, { ...e, children: /* @__PURE__ */ a(
1321
+ _e,
1322
+ {
1323
+ ...r,
1324
+ formatter: (t) => f(t),
1325
+ parser: (t) => s(t)
1326
+ }
1327
+ ) });
1328
+ }, Ut = ({ itemProps: e, inputProps: r }) => /* @__PURE__ */ a(T, { ...e, children: /* @__PURE__ */ a(De.Group, { ...r }) }), { RangePicker: dt } = ie, Fe = {
1329
+ year: { displayFormat: "YYYY", outputFormat: "YYYY" },
1330
+ month: { displayFormat: "YYYY-MM", outputFormat: "YYYYMM" },
1331
+ date: { displayFormat: "YYYY-MM-DD", outputFormat: "YYYYMMDD" },
1332
+ time: { displayFormat: "HH:mm", outputFormat: "HHmm" },
1333
+ datetime: {
1334
+ displayFormat: "YYYY-MM-DD HH:mm",
1335
+ outputFormat: "YYYYMMDDHHmm"
1336
+ }
1337
+ }, Tt = ({
1338
+ itemProps: e,
1339
+ inputProps: r,
1340
+ type: f = "date",
1341
+ minDate: s,
1342
+ maxDate: t,
1343
+ returnType: l = "string"
1344
+ }) => {
1345
+ const { displayFormat: g, outputFormat: i } = Q(
1346
+ () => Fe[f],
1347
+ [f]
1348
+ ), y = Q(
1349
+ () => Object.values(Fe).map((c) => c.outputFormat).sort((c, u) => {
1350
+ if (c.length === u.length) {
1351
+ if (c === i) return -1;
1352
+ if (u === i) return 1;
1353
+ }
1354
+ return u.length - c.length;
1355
+ }),
1356
+ [i]
1357
+ // type(outputFormat)이 바뀔 때마다 재정렬
1358
+ );
1359
+ return /* @__PURE__ */ a(
1360
+ T,
1361
+ {
1362
+ ...e,
1363
+ getValueProps: (c) => ({
1364
+ // 폼에 저장된 값(문자열 또는 Dayjs)을 RangePicker가 요구하는 Dayjs 배열로 변환
1365
+ value: c && c.length > 0 ? [
1366
+ c[0] ? _.isDayjs(c[0]) ? c[0] : _(c[0], y) : null,
1367
+ c[1] ? _.isDayjs(c[1]) ? c[1] : _(c[1], y) : null
1368
+ ] : null
1369
+ }),
1370
+ normalize: (c) => c ? l === "dayjs" ? [c[0] ?? void 0, c[1] ?? void 0] : [
1371
+ c[0] ? c[0].format(i) : void 0,
1372
+ c[1] ? c[1].format(i) : void 0
1373
+ ] : [void 0, void 0],
1374
+ children: /* @__PURE__ */ a(
1375
+ dt,
1376
+ {
1377
+ ...r,
1378
+ order: !0,
1379
+ minDate: s ? _(s, y) : void 0,
1380
+ maxDate: t ? _(t, y) : void 0,
1381
+ picker: f === "datetime" ? "date" : f,
1382
+ showTime: r?.showTime ?? (f === "datetime" || f === "time"),
1383
+ format: g
1384
+ }
1385
+ )
1386
+ }
1387
+ );
1388
+ }, Ce = q.Search, jt = (e) => {
1389
+ const r = E.useFormInstance(), { openPopup: f } = $e(), s = e.itemProps?.name || [], t = e.popupConfig || {
1390
+ callback(g) {
1391
+ Array.isArray(s) && s.length > 1 ? (r.setFieldValue(s[0], g.code), r.setFieldValue(s[1], g.name)) : r.setFieldValue(s, g.code);
1392
+ }
1393
+ }, l = {
1394
+ ...e,
1395
+ placeholder: typeof e.placeholder == "string" ? e.placeholder : e.placeholder?.[0] || "",
1396
+ onChange: (g) => {
1397
+ Array.isArray(s) && s.length > 1 && r.setFieldValue(s[0], ""), e.onChange?.(g);
1398
+ },
1399
+ onSearch: (g) => {
1400
+ e.popuCd ? f(e.popuCd, e.popupParams, t) : e.onSearch?.(g);
1401
+ }
1402
+ };
1403
+ return Array.isArray(s) && s.length > 1 ? /* @__PURE__ */ a(T, { ...e.itemProps, name: void 0, children: /* @__PURE__ */ K(ae.Compact, { block: !0, children: [
1404
+ /* @__PURE__ */ a(
1405
+ E.Item,
1406
+ {
1407
+ name: s[0],
1408
+ rules: e.itemProps?.rules,
1409
+ style: { width: "40%", marginBottom: 0, marginInlineEnd: 0 },
1410
+ validateStatus: "",
1411
+ help: "",
1412
+ children: /* @__PURE__ */ a(
1413
+ q,
1414
+ {
1415
+ style: { color: "#999", backgroundColor: "#f5f5f5" },
1416
+ placeholder: e.placeholder?.[0] || "",
1417
+ readOnly: !0
1418
+ }
1419
+ )
1420
+ }
1421
+ ),
1422
+ /* @__PURE__ */ a(E.Item, { name: s[1], style: { width: "60%", marginBottom: 0 }, children: /* @__PURE__ */ a(
1423
+ Ce,
1424
+ {
1425
+ readOnly: e.readOnly,
1426
+ enterButton: /* @__PURE__ */ a(
1427
+ X,
1428
+ {
1429
+ icon: /* @__PURE__ */ a(Ne, {}),
1430
+ disabled: e.readOnly
1431
+ }
1432
+ ),
1433
+ ...l
1434
+ }
1435
+ ) })
1436
+ ] }) }) : /* @__PURE__ */ a(T, { ...e.itemProps, children: /* @__PURE__ */ a(Ce, { ...l }) });
1437
+ }, Ht = ({
1438
+ itemProps: e,
1439
+ selectProps: r = {
1440
+ options: [],
1441
+ allowClear: !0
1442
+ }
1443
+ }) => {
1444
+ const f = E.useFormInstance(), s = !!f, t = Q(() => r?.addField === "ALL" ? [{ label: "전체", value: "" }, ...r?.options || []] : r?.addField === "NULL" ? [{ label: "", value: "" }, ...r?.options || []] : r?.options || [], [r.options, r.addField]), l = (y) => {
1445
+ r.onChange?.(y);
1446
+ }, g = {
1447
+ ...r,
1448
+ allowClear: r.allowClear ?? !0,
1449
+ options: t,
1450
+ onChange: l,
1451
+ variant: r.variant
1452
+ }, i = /* @__PURE__ */ a(fe, { ...g, disabled: r.disabled });
1453
+ return r.copyable && !s && console.warn(
1454
+ "BwgSelect: copyable 기능은 Form 컨텍스트 내에서만 사용 가능합니다."
1455
+ ), r.copyable ? /* @__PURE__ */ a(T, { ...e, name: void 0, children: /* @__PURE__ */ K(ae.Compact, { block: !0, children: [
1456
+ /* @__PURE__ */ a(
1457
+ E.Item,
1458
+ {
1459
+ name: e?.name,
1460
+ rules: e?.rules,
1461
+ style: { width: "100%", marginBottom: 0 },
1462
+ validateStatus: "",
1463
+ help: "",
1464
+ children: i
1465
+ }
1466
+ ),
1467
+ /* @__PURE__ */ a(
1468
+ be.Paragraph,
1469
+ {
1470
+ copyable: {
1471
+ text: s && f?.getFieldValue(e?.name)?.toString() || "",
1472
+ tooltips: ["코드복사", "코드복사됨"]
1473
+ },
1474
+ style: {
1475
+ margin: 0,
1476
+ backgroundColor: "#f5f5f5",
1477
+ borderRadius: "4px",
1478
+ border: "1px solid #d9d9d9",
1479
+ fontSize: "12px",
1480
+ color: "#666",
1481
+ display: "flex",
1482
+ alignItems: "center",
1483
+ height: "30px",
1484
+ padding: "0 8px"
1485
+ }
1486
+ }
1487
+ )
1488
+ ] }) }) : /* @__PURE__ */ a(T, { ...e, children: i });
1489
+ }, Pt = ({
1490
+ itemProps: e,
1491
+ inputProps: r = {
1492
+ format: "YN"
1493
+ }
1494
+ }) => {
1495
+ const f = E.useFormInstance(), s = (t, l) => {
1496
+ r.format === "boolean" ? f.setFieldValue(e?.name, t) : f.setFieldValue(e?.name, t ? "Y" : "N"), r.onChange && r.onChange(t, l);
1497
+ };
1498
+ return /* @__PURE__ */ a(
1499
+ T,
1500
+ {
1501
+ ...e,
1502
+ getValueProps: (t) => ({ checked: r.format === "boolean" ? !!t : t === "Y" }),
1503
+ normalize: (t) => typeof t == "boolean" ? r.format === "boolean" ? t : t ? "Y" : "N" : r.format === "boolean" ? !!t : t ? "Y" : "N",
1504
+ children: /* @__PURE__ */ a(Ee, { ...r, onChange: (t, l) => s(t, l) })
1505
+ }
1506
+ );
1507
+ }, { TextArea: ft } = q, Kt = ({ itemProps: e, inputProps: r }) => /* @__PURE__ */ a(T, { ...e, children: /* @__PURE__ */ a(ft, { ...r }) }), mt = [
1508
+ ".pdf",
1509
+ ".xlsx",
1510
+ ".xls",
1511
+ ".docx",
1512
+ ".doc",
1513
+ ".pptx",
1514
+ ".ppt",
1515
+ ".hwp",
1516
+ ".txt",
1517
+ ".csv",
1518
+ // 이미지
1519
+ ".jpg",
1520
+ ".jpeg",
1521
+ ".png",
1522
+ ".gif",
1523
+ // 압축
1524
+ ".zip"
1525
+ ], Ye = {
1526
+ FILE: "file"
1527
+ }, gt = ({
1528
+ originNode: e,
1529
+ file: r,
1530
+ fileList: f,
1531
+ moveFile: s,
1532
+ onDrop: t
1533
+ }) => {
1534
+ const l = P(null), [{ handlerId: g }, i] = et({
1535
+ accept: Ye.FILE,
1536
+ collect: (Y) => ({
1537
+ handlerId: Y.getHandlerId()
1538
+ }),
1539
+ hover(Y, F) {
1540
+ if (!l.current)
1541
+ return;
1542
+ const v = Y.uid, V = r.uid;
1543
+ if (v === V)
1544
+ return;
1545
+ const R = ne(f, { uid: V }), N = ne(f, { uid: v });
1546
+ if (N === -1 || R === -1)
1547
+ return;
1548
+ const M = l.current.getBoundingClientRect(), h = F.getClientOffset();
1549
+ if (!h)
1550
+ return;
1551
+ const L = (M.bottom - M.top) / 2, x = h.y - M.top;
1552
+ N < R && x < L || N > R && x > L || s(v, V);
1553
+ },
1554
+ drop() {
1555
+ t();
1556
+ }
1557
+ }), [{ isDragging: y }, c] = tt({
1558
+ type: Ye.FILE,
1559
+ item: () => ({
1560
+ uid: r.uid,
1561
+ index: ne(f, { uid: r.uid })
1562
+ }),
1563
+ collect: (Y) => ({
1564
+ isDragging: Y.isDragging()
1565
+ })
1566
+ }), u = y ? 0 : 1;
1567
+ return c(i(l)), /* @__PURE__ */ a("div", { ref: l, style: { opacity: u }, "data-handler-id": g, children: e });
1568
+ }, Gt = ({
1569
+ itemProps: e,
1570
+ fileGrpKey: r,
1571
+ onUploadComplete: f,
1572
+ onFetchFilesTrxCd: s = "SCMFILE00101",
1573
+ onSuccessTrxCd: t = "SCMFILE00102",
1574
+ onDeleteFileTrxCd: l = "SCMFILE00103",
1575
+ onReorderFilesTrxCd: g = "SCMFILE00104",
1576
+ allowedExtensions: i = mt,
1577
+ maxFileSize: y = 200,
1578
+ showButton: c = !0,
1579
+ // 기본값으로 true 설정
1580
+ multiple: u = !1,
1581
+ newFileGrpKeyonModify: Y = !1,
1582
+ buttonText: F = "파일 선택",
1583
+ localOnly: v = !1,
1584
+ onFilesChange: V
1585
+ }) => {
1586
+ const [R, N] = j([]), M = P(r), h = P([]), L = E.useFormInstance(), $ = P(
1587
+ Xe(() => {
1588
+ if (v || h.current.length === 0)
1589
+ return;
1590
+ const n = [...h.current];
1591
+ if (h.current = [], t) {
1592
+ const m = n.map((p) => ({
1593
+ crprCd: te()?.crprCd,
1594
+ sysCd: __SYS_CD__,
1595
+ fileGrpKey: M.current,
1596
+ physFileNm: p.fileNameP,
1597
+ lgclFileNm: p.fileNameL,
1598
+ filePath: p.filePath,
1599
+ fileExtn: p.fileExt,
1600
+ fileSize: p.fileSize,
1601
+ mltpYn: "N"
1602
+ }));
1603
+ console.log("newFileGrpKeyonModify", Y), console.log(
1604
+ "newFileGrpKeyonModify",
1605
+ Y ? 0 : M.current
1606
+ ), J(t, {
1607
+ crprCd: te()?.crprCd,
1608
+ sysCd: __SYS_CD__,
1609
+ fileGrpKey: Y ? 0 : M.current,
1610
+ oldFileGrpKey: M.current,
1611
+ newFileGrpKeyonModify: Y,
1612
+ sub: m
1613
+ }).then((p) => {
1614
+ if (p?.sub && p.sub.length > 0) {
1615
+ const d = p.sub[0].fileGrpKey;
1616
+ (!M.current || Y) && (M.current = d);
1617
+ const A = /* @__PURE__ */ new Map();
1618
+ p.sub.forEach((S) => {
1619
+ const D = n.find(
1620
+ (H) => H.fileNameL === S.lgclFileNm
1621
+ );
1622
+ D && A.set(D.tempId, S);
1623
+ });
1624
+ const k = e?.name;
1625
+ ((S) => {
1626
+ if (I) {
1627
+ const D = L?.getFieldValue(k) || [], H = S(D);
1628
+ L?.setFieldValue(k, H);
1629
+ } else
1630
+ N((D) => S(D));
1631
+ })((S) => S.map((D) => {
1632
+ const H = A.get(D.uid);
1633
+ if (H) {
1634
+ const me = n.find(
1635
+ (Ie) => Ie.tempId === D.uid
1636
+ );
1637
+ return f && me && f({
1638
+ ...me,
1639
+ fileGrpKey: d,
1640
+ fileKey: H.fileKey
1641
+ }), {
1642
+ ...D,
1643
+ name: H.lgclFileNm,
1644
+ fileGrpKey: d,
1645
+ fileKey: H.fileKey,
1646
+ uid: H.fileKey,
1647
+ status: "done",
1648
+ url: `/api/download?filePath=${H.filePath}&logicalName=${H.lgclFileNm}`
1649
+ };
1650
+ }
1651
+ return D;
1652
+ }));
1653
+ }
1654
+ }).catch((p) => {
1655
+ console.error("업로드 후처리 서비스 호출 실패:", p), z.error("파일 후처리 중 오류가 발생했습니다.");
1656
+ const d = new Set(n.map((b) => b.tempId)), A = e?.name;
1657
+ ((b) => {
1658
+ if (I) {
1659
+ const S = L?.getFieldValue(A) || [], D = b(S);
1660
+ L?.setFieldValue(A, D);
1661
+ } else
1662
+ N((S) => b(S));
1663
+ })(
1664
+ (b) => b.map(
1665
+ (S) => d.has(S.uid) ? { ...S, status: "error", error: "후처리 실패" } : S
1666
+ )
1667
+ );
1668
+ });
1669
+ }
1670
+ }, 500)
1671
+ ).current;
1672
+ G(() => () => {
1673
+ $.cancel();
1674
+ }, [$]), G(() => {
1675
+ M.current = r;
1676
+ }, [r]), G(() => {
1677
+ v || r && s && J(s, {
1678
+ crprCd: te()?.crprCd,
1679
+ sysCd: __SYS_CD__,
1680
+ fileGrpKey: r
1681
+ }).then((n) => {
1682
+ if (n?.sub) {
1683
+ const m = n.sub.map((d) => ({
1684
+ uid: d.fileKey,
1685
+ name: d.lgclFileNm,
1686
+ status: "done",
1687
+ url: `/api/download?filePath=${d.filePath}&logicalName=${d.lgclFileNm}`
1688
+ })), p = e?.name;
1689
+ I ? L?.setFieldValue(p, m) : N(m);
1690
+ } else {
1691
+ const m = e?.name;
1692
+ I ? L?.setFieldValue(m, []) : N([]);
1693
+ }
1694
+ }).catch((n) => {
1695
+ console.error("파일 목록 조회 서비스 호출에 실패했습니다.", n), z.error("파일 목록을 불러오는 중 오류가 발생했습니다.");
1696
+ });
1697
+ }, [r, s]);
1698
+ const o = (n, m) => {
1699
+ const p = e?.name, d = I ? L?.getFieldValue(p) || [] : R, A = ne(d, { uid: n }), k = ne(d, { uid: m });
1700
+ if (A < 0 || k < 0) return;
1701
+ const b = [...d], [S] = b.splice(A, 1);
1702
+ b.splice(k, 0, S), I ? L?.setFieldValue(p, b) : N(b);
1703
+ }, C = () => {
1704
+ if (!v && r && g) {
1705
+ const n = e?.name, p = (I ? L?.getFieldValue(n) || [] : R).map((d) => d.uid);
1706
+ J(g, {
1707
+ crprCd: te()?.crprCd,
1708
+ sysCd: __SYS_CD__,
1709
+ fileGrpKey: r,
1710
+ reorderedFileKeys: p
1711
+ }).then(() => {
1712
+ z.success("파일 순서가 성공적으로 저장되었습니다.");
1713
+ }).catch((d) => {
1714
+ console.error("파일 순서 저장 서비스 호출 실패:", d), z.error("파일 순서 저장 중 오류가 발생했습니다.");
1715
+ });
1716
+ }
1717
+ }, w = (n) => {
1718
+ const m = e?.name, p = I ? L?.getFieldValue(m) || [] : R;
1719
+ if (!u && p.length > 0)
1720
+ return z.error("하나의 파일만 업로드할 수 있습니다."), Z.LIST_IGNORE;
1721
+ if (i && i.length > 0) {
1722
+ const d = `.${n.name.split(".").pop()?.toLowerCase()}`;
1723
+ if (!i.includes(d))
1724
+ return z.error(
1725
+ `${n.name} 파일은 허용되지 않는 확장자입니다. (${i.join(
1726
+ ", "
1727
+ )})`
1728
+ ), Z.LIST_IGNORE;
1729
+ }
1730
+ return y && !(n.size / 1024 / 1024 < y) ? (z.error(`일반업로드의 최대용량은 ${y}MB입니다.`), Z.LIST_IGNORE) : !v;
1731
+ }, I = !!e?.name, B = {
1732
+ name: "file",
1733
+ multiple: u,
1734
+ action: v ? void 0 : "/api/upload",
1735
+ beforeUpload: w,
1736
+ showUploadList: {
1737
+ showRemoveIcon: c
1738
+ // showButton 값에 따라 삭제 버튼 표시/숨김
1739
+ },
1740
+ onChange(n) {
1741
+ const { status: m, uid: p } = n.file;
1742
+ if (m === "removed") {
1743
+ if (!v && l)
1744
+ J(l, {
1745
+ crprCd: te()?.crprCd,
1746
+ sysCd: __SYS_CD__,
1747
+ fileGrpKey: Y ? 0 : M.current,
1748
+ fileKey: p,
1749
+ oldFileGrpKey: M.current,
1750
+ newFileGrpKeyonModify: Y
1751
+ }).then((d) => {
1752
+ if (z.success("파일이 성공적으로 삭제되었습니다."), Y && (M.current = d.fileGrpKey), I) {
1753
+ const A = e?.name;
1754
+ L?.setFieldValue(A, n.fileList);
1755
+ } else
1756
+ N(n.fileList);
1757
+ V?.(n.fileList), f?.({
1758
+ fileGrpKey: d.fileGrpKey
1759
+ });
1760
+ }).catch((d) => {
1761
+ console.error("파일 삭제 서비스 호출에 실패했습니다.", d), z.error("파일 삭제 중 오류가 발생했습니다.");
1762
+ });
1763
+ else {
1764
+ if (I) {
1765
+ const d = e?.name;
1766
+ L?.setFieldValue(d, n.fileList);
1767
+ } else
1768
+ N(n.fileList);
1769
+ V?.(n.fileList);
1770
+ }
1771
+ return;
1772
+ }
1773
+ if (I) {
1774
+ const d = e?.name;
1775
+ L?.setFieldValue(d, n.fileList);
1776
+ } else
1777
+ N(n.fileList);
1778
+ if (V?.(n.fileList), m === "done")
1779
+ if (!v && n.file.response?.success) {
1780
+ const { uploadedFiles: d } = n.file.response;
1781
+ d && Array.isArray(d) && d.length > 0 && (d.forEach((A) => {
1782
+ A.tempId = n.file.uid, h.current.push(A);
1783
+ }), $()), z.success(
1784
+ n.file.response.message || `${n.file.name} 파일이 성공적으로 업로드되었습니다.`
1785
+ );
1786
+ } else
1787
+ z.error(
1788
+ n.file.response?.message || `${n.file.name} 파일 업로드에 실패했습니다.`
1789
+ );
1790
+ else m === "error" && z.error(
1791
+ n.file.response?.message || `${n.file.name} 파일 업로드 중 오류가 발생했습니다.`
1792
+ );
1793
+ },
1794
+ itemRender(n, m, p) {
1795
+ const d = Oe(n, {
1796
+ href: m.url || void 0,
1797
+ title: void 0
1798
+ });
1799
+ return /* @__PURE__ */ a(
1800
+ gt,
1801
+ {
1802
+ originNode: d,
1803
+ file: m,
1804
+ fileList: p,
1805
+ moveFile: o,
1806
+ onDrop: C
1807
+ },
1808
+ m.uid
1809
+ );
1810
+ }
1811
+ };
1812
+ I || (B.fileList = R);
1813
+ const O = (n) => Array.isArray(n) ? n : n && n.fileList, U = e?.name, ee = I ? E.useWatch?.(U, L) : void 0, W = I ? ee || [] : R;
1814
+ return /* @__PURE__ */ a(Qe, { backend: rt, children: /* @__PURE__ */ a(
1815
+ T,
1816
+ {
1817
+ valuePropName: "fileList",
1818
+ getValueFromEvent: O,
1819
+ ...e,
1820
+ children: /* @__PURE__ */ a(
1821
+ Z,
1822
+ {
1823
+ headers: { SYSCD: __SYS_CD__ },
1824
+ ...B,
1825
+ listType: "picture",
1826
+ children: c && (u || W.length === 0) && /* @__PURE__ */ a(X, { icon: /* @__PURE__ */ a(ke, {}), children: F })
1827
+ }
1828
+ )
1829
+ }
1830
+ ) });
1831
+ }, ht = q.Search, Wt = (e) => {
1832
+ const r = E.useFormInstance(), { openCorePopup: f } = Je(), s = {
1833
+ value: "empNm",
1834
+ fieldName: "empNm",
1835
+ placeholder: "사원명"
1836
+ }, t = {
1837
+ value: "deptNm",
1838
+ fieldName: "deptNm",
1839
+ placeholder: "부서"
1840
+ }, l = e.field1 || s, g = e.field2 || t, i = ce(
1841
+ (u) => {
1842
+ r.setFieldValue(e.employeeFieldName || "employee", u), r.setFieldValue(e.empNoFieldName || "empNo", u.empNo ?? ""), r.setFieldValue(
1843
+ l.fieldName,
1844
+ u[l.value || "empNm"] ?? ""
1845
+ ), r.setFieldValue(
1846
+ g.fieldName,
1847
+ u[g.value || "deptNm"] ?? ""
1848
+ ), e.onFinish?.();
1849
+ },
1850
+ [r, l, g, e.employeeFieldName]
1851
+ ), y = ce(
1852
+ (u) => {
1853
+ f("CORE_ORGANIZATION_01", {
1854
+ onSelect: (Y) => {
1855
+ i(Y);
1856
+ },
1857
+ defaultParams: {
1858
+ keyword: u
1859
+ }
1860
+ });
1861
+ },
1862
+ [i, f]
1863
+ ), c = ce(
1864
+ async (u) => {
1865
+ const Y = u?.trim();
1866
+ if (Y)
1867
+ try {
1868
+ const F = await J(
1869
+ "SCMUTIL00101",
1870
+ {
1871
+ keyword: Y
1872
+ },
1873
+ { showLoading: !1 }
1874
+ ), v = F?.empList || [];
1875
+ if (F?.empCnt === 0) {
1876
+ z.warning(
1877
+ "일치하는 사원을 찾을 수 없어 팝업을 열립니다. 사원을 선택해주세요."
1878
+ ), y();
1879
+ return;
1880
+ }
1881
+ if (F?.empCnt > 1) {
1882
+ z.info(
1883
+ "여러 건이 검색되어 팝업이 열립니다. 사원을 선택해주세요."
1884
+ ), y(Y);
1885
+ return;
1886
+ }
1887
+ const V = v[0];
1888
+ i(V);
1889
+ } catch (F) {
1890
+ console.error("사원 검색 서비스 실패:", F), z.error("사원 검색 중 오류가 발생했습니다.");
1891
+ }
1892
+ },
1893
+ [i, y]
1894
+ );
1895
+ return /* @__PURE__ */ a(T, { label: e.label || "사원", name: void 0, children: /* @__PURE__ */ K(ae.Compact, { block: !0, children: [
1896
+ /* @__PURE__ */ a(
1897
+ E.Item,
1898
+ {
1899
+ name: l.fieldName,
1900
+ style: { width: "40%", marginBottom: 0, marginInlineEnd: 0 },
1901
+ validateStatus: "",
1902
+ help: "",
1903
+ children: /* @__PURE__ */ a(
1904
+ q,
1905
+ {
1906
+ style: { color: "#999", backgroundColor: "#f5f5f5" },
1907
+ placeholder: l.placeholder,
1908
+ readOnly: !0
1909
+ }
1910
+ )
1911
+ }
1912
+ ),
1913
+ /* @__PURE__ */ a(
1914
+ E.Item,
1915
+ {
1916
+ name: e.employeeFieldName || "employee",
1917
+ hidden: !0
1918
+ }
1919
+ ),
1920
+ /* @__PURE__ */ a(E.Item, { name: e.empNoFieldName || "empNo", hidden: !0 }),
1921
+ /* @__PURE__ */ a(
1922
+ E.Item,
1923
+ {
1924
+ name: g.fieldName,
1925
+ style: { width: "60%", marginBottom: 0 },
1926
+ children: /* @__PURE__ */ a(
1927
+ ht,
1928
+ {
1929
+ allowClear: !0,
1930
+ readOnly: e.readOnly,
1931
+ placeholder: g.placeholder,
1932
+ enterButton: /* @__PURE__ */ a(
1933
+ X,
1934
+ {
1935
+ icon: /* @__PURE__ */ a(Ne, {}),
1936
+ disabled: e.readOnly,
1937
+ onClick: () => {
1938
+ y();
1939
+ }
1940
+ }
1941
+ ),
1942
+ onSearch: c,
1943
+ onChange: (u) => {
1944
+ r.setFieldValue(e.empNoFieldName || "empNo", ""), r.setFieldValue(l.fieldName, ""), r.setFieldValue(g.fieldName, u.target.value), r.setFieldValue(e.employeeFieldName || "employee", null);
1945
+ }
1946
+ }
1947
+ )
1948
+ }
1949
+ )
1950
+ ] }) });
1951
+ };
2
1952
  export {
3
- g as BwgButton,
4
- s as BwgCheck,
5
- w as BwgCheckList,
6
- B as BwgDatePicker,
7
- t as BwgDownload,
8
- r as BwgForm,
9
- o as BwgFormItem,
10
- c as BwgInput,
11
- d as BwgLargeUploader,
12
- k as BwgMaskedDate,
13
- i as BwgMaskedInput,
14
- l as BwgMaskedRange,
15
- n as BwgMultiSelect,
16
- m as BwgNumber,
17
- p as BwgRadio,
18
- u as BwgRangePicker,
19
- h as BwgSearch,
20
- M as BwgSelect,
21
- S as BwgSwitch,
22
- D as BwgTextArea,
23
- I as BwgUploader
1953
+ vt as BwgButton,
1954
+ At as BwgCheck,
1955
+ Mt as BwgCheckList,
1956
+ _t as BwgDatePicker,
1957
+ Dt as BwgDownload,
1958
+ Wt as BwgEmpSearch,
1959
+ nt as BwgForm,
1960
+ T as BwgFormItem,
1961
+ Et as BwgInput,
1962
+ xt as BwgLargeUploader,
1963
+ Ot as BwgMaskedDate,
1964
+ Bt as BwgMaskedInput,
1965
+ zt as BwgMaskedRange,
1966
+ $t as BwgMultiSelect,
1967
+ Rt as BwgNumber,
1968
+ Ut as BwgRadio,
1969
+ Tt as BwgRangePicker,
1970
+ jt as BwgSearch,
1971
+ Ht as BwgSelect,
1972
+ Pt as BwgSwitch,
1973
+ Kt as BwgTextArea,
1974
+ Gt as BwgUploader
24
1975
  };