@bwg-ui/core 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/AuthContext-CXng9fj0.cjs +1 -0
- package/dist/chunks/AuthContext-Ei2P-z4d.js +52 -0
- package/dist/chunks/BwgLargeUploader-BOf905_l.cjs +2 -0
- package/dist/chunks/BwgLargeUploader-BeI8oV8y.js +3315 -0
- package/dist/chunks/FileUtils-BcnoJ2zn.js +140 -0
- package/dist/chunks/FileUtils-CCBueCSG.cjs +1 -0
- package/dist/chunks/PublicLayout-BiTPwkVq.cjs +35 -0
- package/dist/chunks/PublicLayout-g9WMtoZ0.js +138 -0
- package/dist/chunks/{QuickServiceToggle-y7esp1kp.js → SSOHandler-DVa4JKKb.js} +14831 -14630
- package/dist/chunks/SSOHandler-DiwKoTdN.cjs +183 -0
- package/dist/chunks/ScreenProtectContext-ofv2QgMp.cjs +1 -0
- package/dist/chunks/ScreenProtectContext-zByHldrr.js +114 -0
- package/dist/chunks/SearchBoxContext-B1nxG-Wd.cjs +1 -0
- package/dist/chunks/{ServiceCodeContext-CDZMr3Mm.js → SearchBoxContext-DhKP2pQj.js} +39 -39
- package/dist/chunks/{UtilsContext-B16Gh9LL.cjs → UtilsContext-CLJwXO1Q.cjs} +1 -1
- package/dist/chunks/{UtilsContext-BbfZYiMR.js → UtilsContext-CwVwmfrg.js} +9 -9
- package/dist/chunks/{codeStore-bxk_q1sl.js → codeStore-9alVvK1W.js} +1 -1
- package/dist/chunks/{codeStore-Dt6j826J.cjs → codeStore-B_4WPxpS.cjs} +1 -1
- package/dist/chunks/envUtils-C9Gf5aek.js +29 -0
- package/dist/chunks/envUtils-CduTHoHu.cjs +1 -0
- package/dist/chunks/menuStore-BwLORbDu.cjs +1 -0
- package/dist/chunks/{favoriteStore-CguRSEcH.js → menuStore-DXn19Xnr.js} +136 -123
- package/dist/chunks/{popupStore-CVD8SPTa.cjs → popupStore-D_-Wpcao.cjs} +1 -1
- package/dist/chunks/{popupStore-Dp_fqtim.js → popupStore-JBIRLYTL.js} +1 -1
- package/dist/chunks/{serviceConfig-BJBsdee_.js → serviceConfig-4iBLfLzF.js} +176 -205
- package/dist/chunks/serviceConfig-B5UJqk4b.cjs +2 -0
- package/dist/components/common/BwgCmptArea.d.ts +84 -6
- package/dist/components/common/BwgCol.d.ts +19 -0
- package/dist/components/common/BwgConfigProvider.d.ts +2 -1
- package/dist/components/common/BwgGrid.d.ts +9 -4
- package/dist/components/common/BwgInfoArea.d.ts +2 -1
- package/dist/components/common/BwgRow.d.ts +19 -0
- package/dist/components/common/BwgTitleBox.d.ts +5 -1
- package/dist/components/common/BwgView.d.ts +2 -13
- package/dist/components/common/SSOHandler.d.ts +2 -0
- package/dist/components/common/SearchBox.d.ts +59 -7
- package/dist/components/common/index.cjs +1 -1
- package/dist/components/common/index.d.ts +19 -16
- package/dist/components/common/index.js +20 -17
- package/dist/components/core/BwgLargeUploader.d.ts +4 -1
- package/dist/components/core/BwgSearch.d.ts +4 -0
- package/dist/components/core/BwgUploader.d.ts +30 -7
- package/dist/components/core/index.cjs +1 -1
- package/dist/components/core/index.js +1 -1
- package/dist/components/layout/ProgressOverlay.d.ts +10 -0
- package/dist/components/layout/ProtectLayout.d.ts +6 -0
- package/dist/components/layout/PublicLayout.d.ts +6 -0
- package/dist/components/layout/index.cjs +1 -0
- package/dist/components/layout/index.d.ts +3 -0
- package/dist/components/layout/index.js +6 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +304 -289
- package/dist/provider/contexts/AuthContext.d.ts +12 -0
- package/dist/provider/contexts/ScreenProtectContext.d.ts +21 -0
- package/dist/provider/contexts/index.d.ts +2 -0
- package/dist/provider/index.cjs +1 -1
- package/dist/provider/index.js +25 -19
- package/dist/stores/index.cjs +1 -1
- package/dist/stores/index.js +5 -5
- package/dist/styles/assets/images/backgrounds/krx_login_bg.png +0 -0
- package/dist/styles/assets/images/contents/icon/ico-lockscreen.svg +44 -0
- package/dist/styles/assets/images/logos/krx-logo-full.svg +35 -0
- package/dist/styles/components.css +130 -17
- package/dist/styles/global.css +19 -0
- package/dist/styles/layout.css +108 -35
- package/dist/styles/login.css +39 -33
- package/dist/styles/variables.css +221 -5
- package/dist/types/global.d.ts +2 -0
- package/dist/utils/FileUtils.d.ts +7 -0
- package/dist/utils/envUtils.d.ts +8 -0
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +105 -103
- package/package.json +32 -5
- package/dist/chunks/BwgLargeUploader-ByN1XWV4.js +0 -809
- package/dist/chunks/BwgLargeUploader-CU0-MVk4.cjs +0 -1
- package/dist/chunks/QuickServiceToggle-CiCuWfCF.cjs +0 -183
- package/dist/chunks/ServiceCodeContext--ZnMtjzD.cjs +0 -1
- package/dist/chunks/favoriteStore-TgeeY32l.cjs +0 -1
- package/dist/chunks/messageUtils-9DXOwada.js +0 -117
- package/dist/chunks/messageUtils-RjJD_ArW.cjs +0 -1
- package/dist/chunks/serviceConfig-Cr2P4yr4.cjs +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const o=require("./jsx-runtime-CeSfJrVB.cjs"),L=require("antd"),n=require("react"),k=n.createContext(null),I=()=>{const s=n.useContext(k);if(!s)throw new Error("useLock must be used within ScreenProtectProvider");return s},P=({children:s,idleMs:a=1e4,onUnlock:x,persistLocked:c=!0,storageKey:i="inactivityLocked"})=>{const m=c&&typeof window<"u"&&window.localStorage.getItem(i)==="1",[e,p]=n.useState(m),[f,j]=n.useState(a),u=n.useRef(null),E=n.useRef(null),y=()=>{try{c&&window.localStorage.setItem(i,"1")}catch{}p(!0)},v=async r=>{if(!(x&&!await x(r))){try{c&&window.localStorage.removeItem(i)}catch{}p(!1),w()}},R=()=>{try{c&&window.localStorage.setItem(i,"1")}catch{}p(!0)},w=()=>{u.current&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{R()},f)};n.useEffect(()=>{const r=()=>{e||w()},l={passive:!0},d=["pointermove","pointerdown","keydown","wheel","touchstart"];return d.forEach(t=>window.addEventListener(t,r,l)),w(),()=>{u.current&&window.clearTimeout(u.current),d.forEach(t=>window.removeEventListener(t,r))}},[f,e]),n.useEffect(()=>{if(!e)return;const r=t=>{const h=document.getElementById("lock-overlay-root");h&&h.contains(t.target)||(t.stopPropagation(),t.preventDefault())},l={capture:!0},d=["pointerdown","pointerup","pointermove","click","wheel","keydown","keyup","touchstart","touchmove"];return d.forEach(t=>window.addEventListener(t,r,l)),()=>d.forEach(t=>window.removeEventListener(t,r,l))},[e]);const g=n.useMemo(()=>({locked:e,lock:y,unlock:v,setIdleMs:j}),[e]);return o.jsxRuntimeExports.jsxs(k.Provider,{value:g,children:[o.jsxRuntimeExports.jsx("div",{ref:E,...e?{inert:""}:{},...e?{"aria-hidden":!0}:{},children:s}),e&&o.jsxRuntimeExports.jsx(S,{onUnlock:v})]})},S=({onUnlock:s})=>{const[a,x]=n.useState(4),[c,i]=n.useState("");return o.jsxRuntimeExports.jsx("div",{id:"lock-overlay-root","aria-modal":"true",role:"dialog","aria-label":"Locked screen",style:{position:"fixed",inset:0,background:"rgba(12, 14, 18, 0.85)",backdropFilter:"blur(4px)",display:"grid",placeItems:"center",zIndex:9999},children:o.jsxRuntimeExports.jsxs("div",{className:"lockscreen-form",style:{width:420,maxWidth:"92vw"},children:[o.jsxRuntimeExports.jsx("div",{className:"lock-icon-wrap",children:o.jsxRuntimeExports.jsx("span",{className:"lock-icon-box"})}),o.jsxRuntimeExports.jsx("h2",{children:" 잠금됨"}),o.jsxRuntimeExports.jsx("p",{children:"PIN 번호를 입력하세요"}),o.jsxRuntimeExports.jsx("div",{className:"lock-ipt-wrap",style:{display:"flex",justifyContent:"center"},children:o.jsxRuntimeExports.jsx(L.Input.OTP,{mask:"*",autoFocus:!0,length:a,value:c,onChange:m=>{const e=(m??"").replace(/\D/g,"").slice(0,a);i(e),e.length===a&&s(e)}})})]})})};exports.ScreenProtectProvider=P;exports.useLock=I;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { j as o } from "./jsx-runtime-Dpn_P65e.js";
|
|
2
|
+
import { Input as S } from "antd";
|
|
3
|
+
import { useContext as b, createContext as C, useState as u, useRef as k, useEffect as y, useMemo as N } from "react";
|
|
4
|
+
const j = C(null), M = () => {
|
|
5
|
+
const r = b(j);
|
|
6
|
+
if (!r) throw new Error("useLock must be used within ScreenProtectProvider");
|
|
7
|
+
return r;
|
|
8
|
+
}, O = ({ children: r, idleMs: s = 1e4, onUnlock: w, persistLocked: c = !0, storageKey: i = "inactivityLocked" }) => {
|
|
9
|
+
const m = c && typeof window < "u" && window.localStorage.getItem(i) === "1", [e, p] = u(m), [v, g] = u(s), a = k(null), E = k(null), L = () => {
|
|
10
|
+
try {
|
|
11
|
+
c && window.localStorage.setItem(i, "1");
|
|
12
|
+
} catch {
|
|
13
|
+
}
|
|
14
|
+
p(!0);
|
|
15
|
+
}, h = async (n) => {
|
|
16
|
+
if (!(w && !await w(n))) {
|
|
17
|
+
try {
|
|
18
|
+
c && window.localStorage.removeItem(i);
|
|
19
|
+
} catch {
|
|
20
|
+
}
|
|
21
|
+
p(!1), f();
|
|
22
|
+
}
|
|
23
|
+
}, I = () => {
|
|
24
|
+
try {
|
|
25
|
+
c && window.localStorage.setItem(i, "1");
|
|
26
|
+
} catch {
|
|
27
|
+
}
|
|
28
|
+
p(!0);
|
|
29
|
+
}, f = () => {
|
|
30
|
+
a.current && window.clearTimeout(a.current), a.current = window.setTimeout(() => {
|
|
31
|
+
I();
|
|
32
|
+
}, v);
|
|
33
|
+
};
|
|
34
|
+
y(() => {
|
|
35
|
+
const n = () => {
|
|
36
|
+
e || f();
|
|
37
|
+
}, l = { passive: !0 }, d = ["pointermove", "pointerdown", "keydown", "wheel", "touchstart"];
|
|
38
|
+
return d.forEach((t) => window.addEventListener(t, n, l)), f(), () => {
|
|
39
|
+
a.current && window.clearTimeout(a.current), d.forEach((t) => window.removeEventListener(t, n));
|
|
40
|
+
};
|
|
41
|
+
}, [v, e]), y(() => {
|
|
42
|
+
if (!e) return;
|
|
43
|
+
const n = (t) => {
|
|
44
|
+
const x = document.getElementById("lock-overlay-root");
|
|
45
|
+
x && x.contains(t.target) || (t.stopPropagation(), t.preventDefault());
|
|
46
|
+
}, l = { capture: !0 }, d = [
|
|
47
|
+
"pointerdown",
|
|
48
|
+
"pointerup",
|
|
49
|
+
"pointermove",
|
|
50
|
+
"click",
|
|
51
|
+
"wheel",
|
|
52
|
+
"keydown",
|
|
53
|
+
"keyup",
|
|
54
|
+
"touchstart",
|
|
55
|
+
"touchmove"
|
|
56
|
+
];
|
|
57
|
+
return d.forEach((t) => window.addEventListener(t, n, l)), () => d.forEach((t) => window.removeEventListener(t, n, l));
|
|
58
|
+
}, [e]);
|
|
59
|
+
const P = N(() => ({ locked: e, lock: L, unlock: h, setIdleMs: g }), [e]);
|
|
60
|
+
return /* @__PURE__ */ o.jsxs(j.Provider, { value: P, children: [
|
|
61
|
+
/* @__PURE__ */ o.jsx(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
ref: E,
|
|
65
|
+
...e ? { inert: "" } : {},
|
|
66
|
+
...e ? { "aria-hidden": !0 } : {},
|
|
67
|
+
children: r
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
e && /* @__PURE__ */ o.jsx(T, { onUnlock: h })
|
|
71
|
+
] });
|
|
72
|
+
}, T = ({ onUnlock: r }) => {
|
|
73
|
+
const [s, w] = u(4), [c, i] = u("");
|
|
74
|
+
return /* @__PURE__ */ o.jsx(
|
|
75
|
+
"div",
|
|
76
|
+
{
|
|
77
|
+
id: "lock-overlay-root",
|
|
78
|
+
"aria-modal": "true",
|
|
79
|
+
role: "dialog",
|
|
80
|
+
"aria-label": "Locked screen",
|
|
81
|
+
style: {
|
|
82
|
+
position: "fixed",
|
|
83
|
+
inset: 0,
|
|
84
|
+
background: "rgba(12, 14, 18, 0.85)",
|
|
85
|
+
backdropFilter: "blur(4px)",
|
|
86
|
+
display: "grid",
|
|
87
|
+
placeItems: "center",
|
|
88
|
+
zIndex: 9999
|
|
89
|
+
},
|
|
90
|
+
children: /* @__PURE__ */ o.jsxs("div", { className: "lockscreen-form", style: { width: 420, maxWidth: "92vw" }, children: [
|
|
91
|
+
/* @__PURE__ */ o.jsx("div", { className: "lock-icon-wrap", children: /* @__PURE__ */ o.jsx("span", { className: "lock-icon-box" }) }),
|
|
92
|
+
/* @__PURE__ */ o.jsx("h2", { children: " 잠금됨" }),
|
|
93
|
+
/* @__PURE__ */ o.jsx("p", { children: "PIN 번호를 입력하세요" }),
|
|
94
|
+
/* @__PURE__ */ o.jsx("div", { className: "lock-ipt-wrap", style: { display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ o.jsx(
|
|
95
|
+
S.OTP,
|
|
96
|
+
{
|
|
97
|
+
mask: "*",
|
|
98
|
+
autoFocus: !0,
|
|
99
|
+
length: s,
|
|
100
|
+
value: c,
|
|
101
|
+
onChange: (m) => {
|
|
102
|
+
const e = (m ?? "").replace(/\D/g, "").slice(0, s);
|
|
103
|
+
i(e), e.length === s && r(e);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
) })
|
|
107
|
+
] })
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
export {
|
|
112
|
+
O as S,
|
|
113
|
+
M as u
|
|
114
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const a=require("./jsx-runtime-CeSfJrVB.cjs"),c=require("react"),d=require("./serviceConfig-B5UJqk4b.cjs"),u={AUTH_BTNS:"SCMSIGN00202",AUTH_MENU:"SCMSIGN00201",SRCH_CODE:"SCMSIGN00301",SRCH_POPU:"SCMPOPU00101",AUTH_BMRK:"SCMBMRK00101"},S=c.createContext(null),x=({children:o,serviceCodes:e={}})=>{c.useEffect(()=>{d.setServiceCodeOverrides(e)},[e]);const i={serviceCodes:e,getServiceCode:r=>{if(e[r]&&e[r].trim()!=="")return console.log(`🔧 Provider 설정 사용: ${r} = ${e[r]}`),e[r];const s=u[r];return console.log(`🔧 기본값 사용: ${r} = ${s}`),s}};return a.jsxRuntimeExports.jsx(S.Provider,{value:i,children:o})},n=()=>{const o=c.useContext(S);if(!o)throw new Error("useServiceCode must be used within a ServiceCodeProvider");return o},g=o=>{const{getServiceCode:e}=n();return e(o)},m=()=>{const{getServiceCode:o}=n(),e={};for(const t of Object.keys(u))e[t]=o(t);return e},f=()=>{const{getServiceCode:o}=n();console.log("🔧 bwg-core 서비스코드 설정:"),console.log("📋 Provider 설정 > 기본값 순서로 확인");for(const e of Object.keys(u)){const t=o(e);console.log(` ${e}: ${t}`)}},l=c.createContext(null),P=({children:o})=>{const e=c.useRef(null),C={searchBoxRef:e,getFormData:()=>e.current?.getFormData()||{},setFormData:v=>{e.current?.setFormData(v)},resetForm:()=>{e.current?.resetForm()},validateForm:async()=>await e.current?.validateForm()||{success:!1,error:null}};return a.jsxRuntimeExports.jsx(l.Provider,{value:C,children:o})},F=()=>{const o=c.useContext(l);if(!o)throw new Error("useSearchBox must be used within a SearchBoxProvider");return o};exports.SearchBoxProvider=P;exports.ServiceCodeProvider=x;exports.useAllServiceCodes=m;exports.useLogServiceCodeConfig=f;exports.useSearchBox=F;exports.useServiceCode=n;exports.useServiceCodeValue=g;
|
|
@@ -1,30 +1,7 @@
|
|
|
1
1
|
import { j as u } from "./jsx-runtime-Dpn_P65e.js";
|
|
2
|
-
import {
|
|
3
|
-
import { an as f } from "./serviceConfig-
|
|
4
|
-
const
|
|
5
|
-
children: o
|
|
6
|
-
}) => {
|
|
7
|
-
const e = m(null), v = {
|
|
8
|
-
searchBoxRef: e,
|
|
9
|
-
getFormData: () => e.current?.getFormData() || {},
|
|
10
|
-
setFormData: (C) => {
|
|
11
|
-
e.current?.setFormData(C);
|
|
12
|
-
},
|
|
13
|
-
resetForm: () => {
|
|
14
|
-
e.current?.resetForm();
|
|
15
|
-
},
|
|
16
|
-
validateForm: async () => await e.current?.validateForm() || {
|
|
17
|
-
success: !1,
|
|
18
|
-
error: null
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
return /* @__PURE__ */ u.jsx(l.Provider, { value: v, children: o });
|
|
22
|
-
}, E = () => {
|
|
23
|
-
const o = S(l);
|
|
24
|
-
if (!o)
|
|
25
|
-
throw new Error("useSearchBox must be used within a SearchBoxProvider");
|
|
26
|
-
return o;
|
|
27
|
-
}, s = {
|
|
2
|
+
import { useEffect as m, createContext as i, useContext as S, useRef as x } from "react";
|
|
3
|
+
import { an as f } from "./serviceConfig-4iBLfLzF.js";
|
|
4
|
+
const s = {
|
|
28
5
|
// 권한 관련
|
|
29
6
|
AUTH_BTNS: "SCMSIGN00202",
|
|
30
7
|
// 버튼 권한 조회
|
|
@@ -38,11 +15,11 @@ const l = i(null), h = ({
|
|
|
38
15
|
// 즐겨찾기 관련
|
|
39
16
|
AUTH_BMRK: "SCMBMRK00101"
|
|
40
17
|
// 즐겨찾기 관리
|
|
41
|
-
},
|
|
18
|
+
}, l = i(null), h = ({
|
|
42
19
|
children: o,
|
|
43
20
|
serviceCodes: e = {}
|
|
44
21
|
}) => {
|
|
45
|
-
|
|
22
|
+
m(() => {
|
|
46
23
|
f(e);
|
|
47
24
|
}, [e]);
|
|
48
25
|
const a = {
|
|
@@ -54,34 +31,57 @@ const l = i(null), h = ({
|
|
|
54
31
|
return console.log(`🔧 기본값 사용: ${r} = ${n}`), n;
|
|
55
32
|
}
|
|
56
33
|
};
|
|
57
|
-
return /* @__PURE__ */ u.jsx(
|
|
34
|
+
return /* @__PURE__ */ u.jsx(l.Provider, { value: a, children: o });
|
|
58
35
|
}, c = () => {
|
|
59
|
-
const o = S(
|
|
36
|
+
const o = S(l);
|
|
60
37
|
if (!o)
|
|
61
38
|
throw new Error("useServiceCode must be used within a ServiceCodeProvider");
|
|
62
39
|
return o;
|
|
63
|
-
},
|
|
40
|
+
}, E = (o) => {
|
|
64
41
|
const { getServiceCode: e } = c();
|
|
65
42
|
return e(o);
|
|
66
|
-
},
|
|
43
|
+
}, B = () => {
|
|
67
44
|
const { getServiceCode: o } = c(), e = {};
|
|
68
45
|
for (const t of Object.keys(s))
|
|
69
46
|
e[t] = o(t);
|
|
70
47
|
return e;
|
|
71
|
-
},
|
|
48
|
+
}, D = () => {
|
|
72
49
|
const { getServiceCode: o } = c();
|
|
73
50
|
console.log("🔧 bwg-core 서비스코드 설정:"), console.log("📋 Provider 설정 > 기본값 순서로 확인");
|
|
74
51
|
for (const e of Object.keys(s)) {
|
|
75
52
|
const t = o(e);
|
|
76
53
|
console.log(` ${e}: ${t}`);
|
|
77
54
|
}
|
|
55
|
+
}, d = i(null), w = ({
|
|
56
|
+
children: o
|
|
57
|
+
}) => {
|
|
58
|
+
const e = x(null), v = {
|
|
59
|
+
searchBoxRef: e,
|
|
60
|
+
getFormData: () => e.current?.getFormData() || {},
|
|
61
|
+
setFormData: (C) => {
|
|
62
|
+
e.current?.setFormData(C);
|
|
63
|
+
},
|
|
64
|
+
resetForm: () => {
|
|
65
|
+
e.current?.resetForm();
|
|
66
|
+
},
|
|
67
|
+
validateForm: async () => await e.current?.validateForm() || {
|
|
68
|
+
success: !1,
|
|
69
|
+
error: null
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
return /* @__PURE__ */ u.jsx(d.Provider, { value: v, children: o });
|
|
73
|
+
}, M = () => {
|
|
74
|
+
const o = S(d);
|
|
75
|
+
if (!o)
|
|
76
|
+
throw new Error("useSearchBox must be used within a SearchBoxProvider");
|
|
77
|
+
return o;
|
|
78
78
|
};
|
|
79
79
|
export {
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
w as S,
|
|
81
|
+
h as a,
|
|
82
82
|
c as b,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
E as c,
|
|
84
|
+
B as d,
|
|
85
|
+
D as e,
|
|
86
|
+
M as u
|
|
87
87
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const u=require("react"),b=require("./popupStore-
|
|
1
|
+
"use strict";const u=require("react"),b=require("./popupStore-D_-Wpcao.cjs"),y=require("./jsx-runtime-CeSfJrVB.cjs"),L=require("./codeStore-B_4WPxpS.cjs"),o=require("./commonUtils-L9Jgc5y-.cjs"),i=require("./serviceConfig-B5UJqk4b.cjs"),x=()=>!1,E=()=>{const{popups:e,activePopupId:r,setActivePopup:s,closePopup:m,openPopup:c}=b.usePopupStore(),l=u.useCallback(async(d,g,C)=>{try{await c(d,g,C)}catch(p){throw console.error("팝업 열기 실패:",p),p}},[c]);return{popups:e,activePopupId:r,setActivePopup:s,closePopup:m,showPopup:l,isPopup:e.length>0}},D=u.createContext(void 0),S=({children:e})=>{const{codeData:r,isLoading:s,error:m,lastUpdated:c,getCodeList:l,getCodeListByOption:d,getCodeName:g,getCodeColor:C,getCodeByOption:p,getAvailableGroupCodes:U,getGridLookup:f,fetchCommonCodes:P}=L.useCodeStore(),v={codeData:r,isLoading:s,error:m,lastUpdated:c,getCodeList:l,getCodeListByOption:d,getCodeName:g,getCodeColor:C,getCodeByOption:p,getAvailableGroupCodes:U,getGridLookup:f,refreshCodes:P};return y.jsxRuntimeExports.jsx(D.Provider,{value:v,children:e})},a=()=>{const e=u.useContext(D);if(e===void 0)throw new Error("useCommonCode must be used within a CommonCodeProvider");return e},A=()=>{const{getCodeList:e,isLoading:r,error:s}=a();return{getCodeList:e,isLoading:r,error:s}},I=()=>{const{getCodeName:e,isLoading:r,error:s}=a();return{getCodeName:e,isLoading:r,error:s}},N=()=>{const{getCodeColor:e,isLoading:r,error:s}=a();return{getCodeColor:e,isLoading:r,error:s}},T=()=>{const{getCodeListByOption:e,isLoading:r,error:s}=a();return{getCodeListByOption:e,isLoading:r,error:s}},G=()=>{const{getGridLookup:e,isLoading:r,error:s}=a();return{getGridLookup:e,isLoading:r,error:s}},k={...o.dateUtils,...i.stringUtils,isEmptyArray:o.isEmptyArray,isNotEmptyArray:o.isNotEmptyArray,unique:o.unique,shuffle:o.shuffle,sortBy:o.sortBy,max:o.max,min:o.min,average:o.average,sum:o.sum,randomFromArray:o.randomFromArray,flattenArray:o.flattenArray,...o.objectUtils,debounce:o.debounce,throttle:o.throttle,setLocalStorage:o.setLocalStorage,getLocalStorage:o.getLocalStorage,formatNumber:o.formatNumber,formatCurrency:o.formatCurrency,copyToClipboard:o.copyToClipboard,isMobile:o.isMobile,isDesktop:o.isDesktop,callService:i.callService,apiGet:i.apiGet,apiPost:i.apiPost,apiPut:i.apiPut,apiDelete:i.apiDelete,apiPatch:i.apiPatch},h=u.createContext(void 0),q=({children:e})=>y.jsxRuntimeExports.jsx(h.Provider,{value:{utils:k},children:e}),n=()=>{const e=u.useContext(h);if(e===void 0)throw new Error("useUtils must be used within a UtilsProvider");return e.utils},t=(e,r,s)=>e&&typeof e[r]=="function"?e[r]:s||(()=>{}),w=()=>{const e=n();return{formatDate:t(e,"formatDate"),formatDateKorean:t(e,"formatDateKorean"),getCurrentDate:t(e,"getCurrentDate"),getCurrentDateString:t(e,"getCurrentDateString"),getRelativeTime:t(e,"getRelativeTime"),isToday:t(e,"isToday"),isThisWeek:t(e,"isThisWeek"),isThisMonth:t(e,"isThisMonth"),getDateDiff:t(e,"getDateDiff"),calculateAge:t(e,"calculateAge")}},B=()=>{const e=n();return{isEmpty:t(e,"isEmpty"),isNotEmpty:t(e,"isNotEmpty"),truncate:t(e,"truncate"),capitalize:t(e,"capitalize"),formatPhoneNumber:t(e,"formatPhoneNumber"),isValidEmail:t(e,"isValidEmail"),removeHtmlTags:t(e,"removeHtmlTags"),generateUID:t(e,"generateUID"),generateShortUID:t(e,"generateShortUID"),generateLongUID:t(e,"generateLongUID"),generateNumericUID:t(e,"generateNumericUID"),generateAlphanumericUID:t(e,"generateAlphanumericUID"),generateGUID:t(e,"generateGUID"),generateGUIDWithoutHyphens:t(e,"generateGUIDWithoutHyphens"),generateTimestampUID:t(e,"generateTimestampUID"),generateCustomUID:t(e,"generateCustomUID"),encryptSha256:t(e,"encryptSha256"),bxmEncrypt:t(e,"bxmEncrypt"),bxmDecrypt:t(e,"bxmDecrypt"),simpleEncrypt:t(e,"simpleEncrypt"),simpleDecrypt:t(e,"simpleDecrypt"),md5Hash:t(e,"md5Hash"),sha256Hash:t(e,"sha256Hash"),base64Encode:t(e,"base64Encode"),base64Decode:t(e,"base64Decode")}},H=()=>{const e=n();return{isEmptyArray:t(e,"isEmptyArray"),isNotEmptyArray:t(e,"isNotEmptyArray"),unique:t(e,"unique"),shuffle:t(e,"shuffle"),sortBy:t(e,"sortBy"),max:t(e,"max"),min:t(e,"min"),average:t(e,"average"),sum:t(e,"sum")}},M=()=>{const e=n();return{debounce:t(e,"debounce"),throttle:t(e,"throttle"),setLocalStorage:t(e,"setLocalStorage"),getLocalStorage:t(e,"getLocalStorage"),formatNumber:t(e,"formatNumber"),formatCurrency:t(e,"formatCurrency"),copyToClipboard:t(e,"copyToClipboard"),isMobile:t(e,"isMobile"),isDesktop:t(e,"isDesktop")}},R=()=>{const e=n();return{callService:t(e,"callService"),apiGet:t(e,"apiGet"),apiPost:t(e,"apiPost"),apiPut:t(e,"apiPut"),apiDelete:t(e,"apiDelete"),apiPatch:t(e,"apiPatch")}};exports.CommonCodeProvider=S;exports.UtilsProvider=q;exports.useApiUtils=R;exports.useArrayUtils=H;exports.useCodeColor=N;exports.useCodeList=A;exports.useCodeListByOption=T;exports.useCodeName=I;exports.useCommonCode=a;exports.useCommonUtils=M;exports.useDateUtils=w;exports.useGridLookup=G;exports.usePopup=E;exports.usePopupContext=x;exports.useStringUtils=B;exports.useUtils=n;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useCallback as P, createContext as g, useContext as d } from "react";
|
|
2
|
-
import { u as v } from "./popupStore-
|
|
2
|
+
import { u as v } from "./popupStore-JBIRLYTL.js";
|
|
3
3
|
import { j as y } from "./jsx-runtime-Dpn_P65e.js";
|
|
4
|
-
import { u as L } from "./codeStore-
|
|
5
|
-
import { am as E, ap as S, ac as x, aI as A, aJ as I, ai as N, aF as T, aH as G, ad as k, aK as w, a6 as H, T as B, Z as M, Y as
|
|
6
|
-
import { S as J, Q, U as X, T as Y, R as Z, V as _,
|
|
4
|
+
import { u as L } from "./codeStore-9alVvK1W.js";
|
|
5
|
+
import { am as E, ap as S, ac as x, aI as A, aJ as I, ai as N, aF as T, aH as G, ad as k, aK as w, a6 as H, T as B, Z as M, Y as q, X as O, W as R, P as W, O as j, R as V, aL as F, aM as K, aN as z } from "./commonUtils-BV6WFv-z.js";
|
|
6
|
+
import { S as J, Q, U as X, T as Y, R as Z, V as _, aq as $ } from "./serviceConfig-4iBLfLzF.js";
|
|
7
7
|
const ne = () => !1, ue = () => {
|
|
8
8
|
const { popups: e, activePopupId: o, setActivePopup: a, closePopup: u, openPopup: i } = v(), c = P(
|
|
9
9
|
async (m, p, l) => {
|
|
@@ -105,11 +105,11 @@ const ne = () => !1, ue = () => {
|
|
|
105
105
|
isEmptyArray: K,
|
|
106
106
|
isNotEmptyArray: F,
|
|
107
107
|
unique: V,
|
|
108
|
-
shuffle:
|
|
109
|
-
sortBy:
|
|
110
|
-
max:
|
|
111
|
-
min:
|
|
112
|
-
average:
|
|
108
|
+
shuffle: j,
|
|
109
|
+
sortBy: W,
|
|
110
|
+
max: R,
|
|
111
|
+
min: O,
|
|
112
|
+
average: q,
|
|
113
113
|
sum: M,
|
|
114
114
|
randomFromArray: B,
|
|
115
115
|
flattenArray: H,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const D=require("zustand"),S=require("./serviceConfig-
|
|
1
|
+
"use strict";const D=require("zustand"),S=require("./serviceConfig-B5UJqk4b.cjs"),O={CACHE_SIZE_LIMIT:1e3},t={codeCache:new Map,nameCache:new Map,optionCache:new Map,colorCache:new Map,loadedGroups:new Set,cacheHits:new Map,clearCache(){this.codeCache.clear(),this.nameCache.clear(),this.optionCache.clear(),this.colorCache.clear(),this.loadedGroups.clear(),this.cacheHits.clear()},cleanupCache(){const s=Array.from(this.cacheHits.entries());s.sort((e,c)=>e[1]-c[1]),s.slice(0,Math.floor(s.length*.3)).forEach(([e])=>{this.codeCache.delete(e),this.nameCache.delete(e),this.optionCache.delete(e),this.colorCache.delete(e),this.cacheHits.delete(e)})},isGroupLoaded(s){return this.loadedGroups.has(s)},markGroupLoaded(s){this.loadedGroups.add(s)}},_=s=>{console.log("대규모 데이터 변환 시작:",s);const p={};if(s&&s.code&&Array.isArray(s.code)){const e=s.code,c=s.opt||[],o=new Map;c.forEach(a=>{a.cmmnCd&&a.enblYn==="Y"&&(o.has(a.cmmnCd)||o.set(a.cmmnCd,[]),o.get(a.cmmnCd).push(a))}),e.forEach(a=>{if(a&&a.cmmnCdGrp&&a.cmmnCd&&a.enblYn==="Y"){const n=a.cmmnCdGrp;p[n]||(p[n]={});const d=(o.get(a.cmmnCd)||[]).reduce((i,l)=>(l.optnCd&&l.optnNm&&(i[l.optnCd]=l.optnNm),i),{});p[n][a.cmmnCd]={codeValue:a.cmmnCd,codeNm:a.cmmnCdNm,groupCode:a.cmmnCdGrp,commonCode:a.cmmnCd,labelColor:a.cmmnCdClr,systemCodeYn:a.syscdYn,sortOrder:parseInt(a.sortOrd)||1,enabled:a.enblYn==="Y",options:Object.keys(d).length>0?d:null,originalData:a}}})}return console.log("대규모 데이터 변환 완료:",p),p},r=D.create()(S.persist((s,p)=>({codeData:null,isLoading:!1,error:null,lastUpdated:null,loadedGroups:new Set,fetchData:async()=>{s({isLoading:!0,error:null});try{console.log("대규모 공통코드 데이터 가져오기 시작: SCMSIGN00301");const e=await S.callService(S.getServiceCode("SRCH_CODE"),{crprCd:"100"});console.log("대규모 공통코드 응답:",e),console.log("대규모 공통코드목록:",e.code),console.log("대규모 공통코드옵션션목록:",e.opt);const c=_(e);t.clearCache();const o=new Set(Object.keys(c));o.forEach(a=>{t.markGroupLoaded(a)}),s({codeData:c,isLoading:!1,error:null,lastUpdated:new Date,loadedGroups:o}),console.log("대규모 공통코드 데이터 가져오기 완료")}catch(e){console.error("대규모 공통코드 데이터 가져오기 실패:",e),s({isLoading:!1,error:e instanceof Error?e.message:"대규모 공통코드 데이터 가져오기 실패"})}},loadSpecificGroup:async e=>{const{codeData:c,loadedGroups:o}=p();if(!c||o.has(e))return;const a=new Set(o).add(e);s({loadedGroups:a}),t.markGroupLoaded(e)},setData:e=>{t.clearCache();const c=new Set(Object.keys(e));c.forEach(o=>{t.markGroupLoaded(o)}),s({codeData:e,lastUpdated:new Date,loadedGroups:c})},clearData:()=>{t.clearCache(),s({codeData:null,isLoading:!1,error:null,lastUpdated:null,loadedGroups:new Set})},getLoadedGroups:()=>Array.from(p().loadedGroups)}),{name:"large-data-storage",partialize:s=>({codeData:s.codeData,lastUpdated:s.lastUpdated,loadedGroups:Array.from(s.loadedGroups)})})),b=D.create()(S.persist((s,p)=>({get codeData(){return r.getState().codeData},get isLoading(){return r.getState().isLoading},get error(){return r.getState().error},get lastUpdated(){return r.getState().lastUpdated},fetchCommonCodes:async()=>{await r.getState().fetchData()},getCodeList:(e,c)=>{const{enabledOnly:o=!0,systemCodeOnly:a=!1,sortByOrder:n=!1,excludeParentCode:u=!1}=c||{},d=`simpleCodeList_${e}_${o}_${a}_${n}_${u}`;if(t.optionCache.has(d)){const h=t.cacheHits.get(d)||0;return t.cacheHits.set(d,h+1),t.optionCache.get(d)}const i=r.getState().codeData;if(!i)return[];if(!t.isGroupLoaded(e)&&!i[e])return console.warn(`그룹 ${e}가 아직 로드되지 않았습니다.`),[];const l=[],f=i[e];f&&Object.values(f).forEach(h=>{if(!(o&&!h.enabled)&&!(a&&h.systemCodeYn!=="Y"))if(u){const m=e.length,H=h.codeValue.substring(m);H.length>0&&l.push({...h,codeValue:H})}else l.push(h)});let g;n?g=l.sort((h,m)=>h.sortOrder!==m.sortOrder?h.sortOrder-m.sortOrder:h.codeValue.localeCompare(m.codeValue)):g=l.sort((h,m)=>h.codeValue.localeCompare(m.codeValue));const C=g.map(h=>({label:h.codeNm,value:h.codeValue,tagColor:h.labelColor}));return t.optionCache.size>=O.CACHE_SIZE_LIMIT&&t.cleanupCache(),t.optionCache.set(d,C),t.cacheHits.set(d,1),C},getCodeName:e=>{if(t.nameCache.has(e)){const o=t.cacheHits.get(`name_${e}`)||0;return t.cacheHits.set(`name_${e}`,o+1),t.nameCache.get(e)}const c=r.getState().codeData;if(!c)return null;for(const o of Object.values(c))for(const a of Object.values(o))if(a.codeValue===e)return t.nameCache.set(e,a.codeNm),t.cacheHits.set(`name_${e}`,1),a.codeNm;return null},getCodeColor:e=>{if(t.colorCache.has(e)){const o=t.cacheHits.get(`color_${e}`)||0;return t.cacheHits.set(`color_${e}`,o+1),t.colorCache.get(e)}const c=r.getState().codeData;if(!c)return null;for(const o of Object.values(c))for(const a of Object.values(o))if(a.codeValue===e)return t.colorCache.set(e,a.labelColor||""),t.cacheHits.set(`color_${e}`,1),a.labelColor;return null},getGridLookup:e=>{const c=`gridLookup_${e}`;if(t.optionCache.has(c)){const i=t.cacheHits.get(c)||0;return t.cacheHits.set(c,i+1),t.optionCache.get(c)}const o=r.getState().codeData;if(!o)return{labels:[],values:[],lookupDisplay:!0};const a=o[e];if(!a)return{labels:[],values:[],lookupDisplay:!0};const n=[],u=[];Object.values(a).filter(i=>i.enabled).sort((i,l)=>i.sortOrder-l.sortOrder).forEach(i=>{n.push(i.codeNm),u.push(i.codeValue)});const d={labels:n,values:u,lookupDisplay:!0};return t.optionCache.set(c,d),t.cacheHits.set(c,1),d},getCodeByOption:(e,c,o)=>{const a=`codeByOption_${e}_${c}_${o}`;if(t.codeCache.has(a)){const l=t.cacheHits.get(a)||0;return t.cacheHits.set(a,l+1),t.codeCache.get(a)}const n=r.getState().codeData;if(!n)return[];const u=[],d=n[e];d&&Object.values(d).forEach(l=>{l.enabled&&l.options&&l.options[c]===o&&u.push({...l,codeNm:l.options[c]||l.codeNm})});const i=u.sort((l,f)=>l.codeValue.localeCompare(f.codeValue));return t.codeCache.size>=O.CACHE_SIZE_LIMIT&&t.cleanupCache(),t.codeCache.set(a,i),t.cacheHits.set(a,1),i},getCodeListByOption:(e,c,o)=>{const{enabledOnly:a=!0,systemCodeOnly:n=!1,sortByOrder:u=!1}=o||{},d=`codeListByOption_${e}_${c}_${a}_${n}_${u}`;if(t.codeCache.has(d)){const C=t.cacheHits.get(d)||0;return t.cacheHits.set(d,C+1),t.codeCache.get(d)}const i=r.getState().codeData;if(!i)return[];if(!t.isGroupLoaded(e)&&!i[e])return console.warn(`그룹 ${e}가 아직 로드되지 않았습니다.`),[];const l=[],f=i[e];f&&Object.values(f).forEach(C=>{a&&!C.enabled||n&&C.systemCodeYn!=="Y"||C.options&&C.options[c]&&l.push({label:C.options[c],value:C.commonCode,tagColor:C.labelColor})});let g;return u?g=l.sort((C,h)=>C.value.localeCompare(h.value)):g=l.sort((C,h)=>C.value.localeCompare(h.value)),t.codeCache.size>=O.CACHE_SIZE_LIMIT&&t.cleanupCache(),t.codeCache.set(d,g),t.cacheHits.set(d,1),g},getAvailableGroupCodes:()=>{const e="available_group_codes";if(t.nameCache.has(e)){const a=t.cacheHits.get(e)||0;return t.cacheHits.set(e,a+1),JSON.parse(t.nameCache.get(e))}const c=r.getState().codeData;if(!c)return[];const o=Object.keys(c).sort();return t.nameCache.set(e,JSON.stringify(o)),t.cacheHits.set(e,1),o},clearCodes:()=>{r.getState().clearData()}}),{name:"code-storage",partialize:s=>({})})),y=D.create()(S.persist((s,p)=>({get codeData(){return r.getState().codeData},get isLoading(){return r.getState().isLoading},get error(){return r.getState().error},get lastUpdated(){return r.getState().lastUpdated},fetchCommonCodes:async()=>{await r.getState().fetchData()},getOptionValue:(e,c)=>{const o=`option_${e}_${c}`;if(t.optionCache.has(o)){const u=t.cacheHits.get(o)||0;return t.cacheHits.set(o,u+1),t.optionCache.get(o)}const a=r.getState().codeData;if(!a)return null;const n=a[e];if(n&&n[c]){const u=n[c].options;return t.optionCache.set(o,u),t.cacheHits.set(o,1),u}return null},getOptionByKey:(e,c,o)=>{const a=`option_${e}_${c}_${o}`;if(t.optionCache.has(a)){const d=t.cacheHits.get(a)||0;return t.cacheHits.set(a,d+1),t.optionCache.get(a)}const n=p().getOptionValue(e,c),u=n?n[o]:null;return t.optionCache.set(a,u),t.cacheHits.set(a,1),u},clearCodes:()=>{r.getState().clearData()}}),{name:"option-storage",partialize:s=>({})})),L=D.create()(S.persist((s,p)=>({get codeData(){return r.getState().codeData},get isLoading(){return r.getState().isLoading},get error(){return r.getState().error},get lastUpdated(){return r.getState().lastUpdated},fetchCommonCodes:async()=>{await r.getState().fetchData()},getColorCode:e=>{if(t.colorCache.has(e)){const o=t.cacheHits.get(`color_${e}`)||0;return t.cacheHits.set(`color_${e}`,o+1),t.colorCache.get(e)}const c=r.getState().codeData;if(!c)return null;for(const o of Object.values(c))for(const a of Object.values(o))if(a.codeValue===e)return t.colorCache.set(e,a.labelColor||""),t.cacheHits.set(`color_${e}`,1),a.labelColor;return null},getColorMapping:()=>{const e="color_mapping";if(t.optionCache.has(e)){const a=t.cacheHits.get(e)||0;return t.cacheHits.set(e,a+1),t.optionCache.get(e)}const c=r.getState().codeData;if(!c)return[];const o=[];return Object.values(c).forEach(a=>{Object.values(a).forEach(n=>{n.labelColor&&o.push({code:n.codeValue,color:n.labelColor})})}),t.optionCache.set(e,o),t.cacheHits.set(e,1),o},clearCodes:()=>{r.getState().clearData()}}),{name:"color-storage",partialize:s=>({})}));exports.useCodeStore=b;exports.useColorStore=L;exports.useOptionStore=y;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const e = (() => {
|
|
2
|
+
try {
|
|
3
|
+
if (import.meta.env.DEV)
|
|
4
|
+
return !0;
|
|
5
|
+
} catch {
|
|
6
|
+
}
|
|
7
|
+
return !1;
|
|
8
|
+
})();
|
|
9
|
+
let o = [], r = [];
|
|
10
|
+
function n() {
|
|
11
|
+
if (typeof window < "u" && window.location)
|
|
12
|
+
return window.location.hostname;
|
|
13
|
+
}
|
|
14
|
+
const s = (() => {
|
|
15
|
+
const t = n();
|
|
16
|
+
return !!(t && o.includes(t));
|
|
17
|
+
})(), i = (() => {
|
|
18
|
+
const t = n();
|
|
19
|
+
return !!(t && r.includes(t));
|
|
20
|
+
})();
|
|
21
|
+
function u() {
|
|
22
|
+
return e ? "X" : s ? "D" : i ? "P" : "X";
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
s as a,
|
|
26
|
+
i as b,
|
|
27
|
+
u as g,
|
|
28
|
+
e as i
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=(()=>{try{if((void 0).DEV)return!0}catch{}return!1})();let i=[],s=[];function n(){if(typeof window<"u"&&window.location)return window.location.hostname}const o=(()=>{const t=n();return!!(t&&i.includes(t))})(),r=(()=>{const t=n();return!!(t&&s.includes(t))})();function u(){return e?"X":o?"D":r?"P":"X"}exports.getEnvCode=u;exports.isDev=o;exports.isLocal=e;exports.isProd=r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const g=require("zustand"),u=require("./serviceConfig-B5UJqk4b.cjs"),P=require("./envUtils-CduTHoHu.cjs"),f=g.create((t,i)=>({favorites:[],isLoading:!1,error:null,fetchFavorites:async({crprCd:e,userId:a})=>{console.log("즐겨찾기 메뉴 요청:",{crprCd:e,userId:a}),t({isLoading:!0,error:null});try{const n=await u.callService(u.getServiceCode("AUTH_BMRK"),{crprCd:e,userId:a});let r=[];if(n?.favorites&&Array.isArray(n.favorites)?r=n.favorites:Array.isArray(n)?r=n:(console.warn("즐겨찾기 데이터가 비어있거나 예상과 다른 구조입니다."),r=[]),console.log("즐겨찾기 메뉴 로드 완료:",r),P.isLocal&&r.length===0){const o=[{crprCd:"100",menuGbCd:"CMPRGRP",menuPrntId:"FAV001",menuId:"FAV_TEST001",menuNm:"API 테스트",scrnId:"TEST001",menuNo:1,scrnPath:"/dev/ApiTest",menuLvl:3,rootMenu:"FAV001",addedAt:new Date().toISOString(),userId:a},{crprCd:"100",menuGbCd:"CMPRGRP",menuPrntId:"FAV001",menuId:"FAV_TEST002",menuNm:"프로젝트 개요",scrnId:"DOCS001",menuNo:2,scrnPath:"/docs/ProjectOverview",menuLvl:3,rootMenu:"FAV001",addedAt:new Date().toISOString(),userId:a}];t({favorites:o,isLoading:!1,error:null}),console.log("개발 모드: 테스트용 즐겨찾기 데이터 추가")}else t({favorites:r,isLoading:!1,error:null})}catch(n){console.error("즐겨찾기 메뉴 로드 실패:",n),t({error:n instanceof Error?n.message:"즐겨찾기 로드 실패",isLoading:!1})}},addFavorite:async(e,a)=>{const{favorites:n}=i();if(n.some(r=>r.menuId===e.menuId)){console.log("이미 즐겨찾기에 추가된 메뉴입니다:",e.menuNm);return}try{await u.callService(u.getServiceCode("AUTH_BMRK"),{action:"add",crprCd:e.crprCd,userId:a,menuId:e.menuId,menuNm:e.menuNm,scrnPath:e.scrnPath});const r={...e,addedAt:new Date().toISOString(),userId:a};t({favorites:[...n,r]}),console.log("즐겨찾기 추가 완료:",e.menuNm)}catch(r){throw console.error("즐겨찾기 추가 실패:",r),r}},removeFavorite:async(e,a)=>{const{favorites:n}=i();try{await u.callService(u.getServiceCode("AUTH_BMRK"),{action:"remove",crprCd:"100",userId:a,menuId:e});const r=n.filter(o=>o.menuId!==e);t({favorites:r}),console.log("즐겨찾기 제거 완료:",e)}catch(r){throw console.error("즐겨찾기 제거 실패:",r),r}},isFavorite:e=>{const{favorites:a}=i();return a.some(n=>n.menuId===e)},clearFavorites:()=>{t({favorites:[],isLoading:!1,error:null})}})),m=()=>typeof process<"u"&&process.env.NODE_ENV==="development"||typeof window<"u"&&window.location.hostname==="localhost"?[{crprCd:"100",menuGbCd:"CMPRGRM",menuPrntId:"-",menuId:"DEV001",menuNm:"개발자 도구",scrnId:"",menuNo:0,scrnPath:"",menuLvl:1,rootMenu:"DEV001"},{crprCd:"100",menuGbCd:"CMPRGRS",menuPrntId:"DEV001",menuId:"DEV00101",menuNm:"컴포넌트 가이드",scrnId:"",menuNo:1,scrnPath:"",menuLvl:2,rootMenu:"DEV001"},{crprCd:"100",menuGbCd:"CMPRGRP",menuPrntId:"DEV00101",menuId:"DEV0010101",menuNm:"기본 컴포넌트",scrnId:"BwgComponentGuideM01",menuNo:9991,scrnPath:"/cm/guide/BwgComponentGuideM01",menuLvl:3,rootMenu:"DEV00101"},{crprCd:"100",menuGbCd:"CMPRGRP",menuPrntId:"DEV00101",menuId:"DEV0010102",menuNm:"응용 컴포넌트",scrnId:"BwgComponentGuideM02",menuNo:9992,scrnPath:"/cm/guide/BwgComponentGuideM02",menuLvl:3,rootMenu:"DEV00101"},{crprCd:"100",menuGbCd:"CMPRGRS",menuPrntId:"DEV001",menuId:"DEV00102",menuNm:"개발자 가이드",scrnId:"",menuNo:2,scrnPath:"",menuLvl:2,rootMenu:"DEV001"},{crprCd:"100",menuGbCd:"CMPRGRP",menuPrntId:"DEV00102",menuId:"DEV0010201",menuNm:"개발자 가이드",scrnId:"BwgDeveloperGuideM01",menuNo:9993,scrnPath:"/cm/guide/BwgDeveloperGuideM01",menuLvl:3,rootMenu:"DEV00102"},{crprCd:"100",menuGbCd:"CMPRGRP",menuPrntId:"DEV00102",menuId:"DEV0010202",menuNm:"React 가이드",scrnId:"BwgReactGuideM01",menuNo:9994,scrnPath:"/cm/guide/BwgReactGuideM01",menuLvl:3,rootMenu:"DEV00102"},{crprCd:"100",menuGbCd:"CMPRGRP",menuPrntId:"DEV00102",menuId:"DEV0010203",menuNm:"연습공간",scrnId:"BwgPracticeM01",menuNo:9995,scrnPath:"/cm/guide/BwgPracticeM01",menuLvl:3,rootMenu:"DEV00102"}]:[],v=t=>{if(!t||!Array.isArray(t)||t.length===0)return[];const i=new Map,e=[];t.forEach(o=>{o&&o.menuId&&i.set(o.menuId,{...o,children:[]})}),t.forEach(o=>{if(!o||!o.menuId)return;const s=i.get(o.menuId);if(s)if(o.menuPrntId&&o.menuPrntId!==""&&o.menuPrntId!=="-"){const c=i.get(o.menuPrntId);c&&c.children.push(s)}else e.push(s)});const a=o=>o.sort((s,c)=>s.menuNo-c.menuNo).map(s=>({...s,children:s.children&&s.children.length>0?a(s.children):void 0})),n=a(e),r=n.filter(o=>o.menuId.startsWith("DEV"));return r.length>0&&console.log("DEV 최종 결과:",r),n},h=g.create((t,i)=>({menuList:[],isLoading:!1,error:null,activeMenu:"1",currentProgram:null,tabs:[],activeTabKey:null,sidebarCollapsed:!1,viewStates:{},_lastFetchParams:null,fetchMenu:async({crprCd:e,userId:a,prntGbcd:n})=>{const r={crprCd:e,userId:a,prntGbcd:n??1},{_lastFetchParams:o}=i();if(o&&o.crprCd===r.crprCd&&o.userId===r.userId&&o.prntGbcd===r.prntGbcd){console.log("동일한 파라미터로 중복 요청 방지:",r);return}console.log("메뉴 데이터 요청 시작:",r),t({isLoading:!0,error:null,_lastFetchParams:r});try{const s=await u.callService(u.getServiceCode("AUTH_MENU"),r);let c=[];s?.menus&&Array.isArray(s.menus)?c=s.menus:Array.isArray(s)?c=s:(console.warn("서버 응답이 비어있거나 예상과 다른 구조입니다. 개발자 메뉴만 표시합니다."),c=[]);const l=m();l.length>0&&(c=[...l,...c]);const d=v(c);console.log("메뉴 데이터 로드 완료 (계층 구조):",d),t({menuList:d,isLoading:!1,error:null})}catch(s){console.error("메뉴 데이터 로드 실패:",s);const c=m();if(c.length>0){console.log("서버 오류로 인해 개발자 메뉴만 표시합니다.");const l=v(c);t({menuList:l,isLoading:!1,error:null})}else t({error:s instanceof Error?s.message:"메뉴 로드 실패",isLoading:!1})}},setActiveMenu:e=>{t({activeMenu:e})},setCurrentProgram:e=>{console.log("setCurrentProgram 호출:",e),t({currentProgram:e})},addTab:e=>{const{tabs:a}=i();if(a.find(r=>r.key===e.menuId))t({activeTabKey:e.menuId});else{const r={key:e.menuId,label:e.menuNm,menuItem:e,closable:!0};t({tabs:[...a,r],activeTabKey:e.menuId})}},removeTab:e=>{const{tabs:a,activeTabKey:n}=i(),r=a.filter(s=>s.key!==e);let o=n;if(n===e){const s=a.findIndex(c=>c.key===e);r.length>0?o=r[Math.min(s,r.length-1)]?.key||null:o=null}t({tabs:r,activeTabKey:o,currentProgram:o&&r.find(s=>s.key===o)?.menuItem||null})},setActiveTab:e=>{const{tabs:a}=i(),n=a.find(r=>r.key===e);n&&t({activeTabKey:e,currentProgram:n.menuItem})},clearTabs:()=>{t({tabs:[],activeTabKey:null,currentProgram:null})},clearMenu:()=>{t({menuList:[],error:null,activeMenu:"1",currentProgram:null,tabs:[],activeTabKey:null,_lastFetchParams:null})},toggleSidebar:()=>{const{sidebarCollapsed:e}=i();t({sidebarCollapsed:!e})},updateViewState:(e,a,n)=>{t(r=>({viewStates:{...r.viewStates,[e]:{...r.viewStates[e],[a]:n}}})),console.log(`뷰 상태 업데이트: ${e}.${a}`,n)}}));exports.useFavoriteStore=f;exports.useMenuStore=h;
|