@bwg-ui/core 1.3.1 → 1.3.3

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