@bwg-ui/core 1.1.3 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{SSOHandler-BFys-2Zz.js → SSOHandler-Bu3v95k0.js} +6 -3
- package/dist/chunks/SSOHandler-Bu3v95k0.js.map +1 -0
- package/dist/chunks/{SSOHandler-De8MPtGZ.cjs → SSOHandler-kghWABfM.cjs} +2 -2
- package/dist/chunks/SSOHandler-kghWABfM.cjs.map +1 -0
- package/dist/chunks/menuStore-2zsN-PRt.js +266 -0
- package/dist/chunks/{menuStore-CvQrMo35.js.map → menuStore-2zsN-PRt.js.map} +1 -1
- package/dist/chunks/menuStore-D7zl2c89.cjs +2 -0
- package/dist/chunks/{menuStore-CBvENehP.cjs.map → menuStore-D7zl2c89.cjs.map} +1 -1
- package/dist/components/common/BwgGrid.d.ts +1 -1
- package/dist/components/common/BwgGrid.d.ts.map +1 -1
- package/dist/components/common/index.cjs +1 -1
- package/dist/components/common/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/stores/index.cjs +1 -1
- package/dist/stores/index.js +1 -1
- package/dist/stores/menuStore.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/SSOHandler-BFys-2Zz.js.map +0 -1
- package/dist/chunks/SSOHandler-De8MPtGZ.cjs.map +0 -1
- package/dist/chunks/menuStore-CBvENehP.cjs +0 -2
- package/dist/chunks/menuStore-CvQrMo35.js +0 -381
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const g=require("zustand"),u=require("./serviceConfig-Cc8jfw_Y.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;
|
|
2
|
-
//# sourceMappingURL=menuStore-CBvENehP.cjs.map
|
|
@@ -1,381 +0,0 @@
|
|
|
1
|
-
import { create as f } from "zustand";
|
|
2
|
-
import { V as l, am as d } from "./serviceConfig-lAlRNVIw.js";
|
|
3
|
-
import { i as P } from "./envUtils-C9Gf5aek.js";
|
|
4
|
-
const C = f((t, i) => ({
|
|
5
|
-
favorites: [],
|
|
6
|
-
isLoading: !1,
|
|
7
|
-
error: null,
|
|
8
|
-
// 즐겨찾기 메뉴 가져오기
|
|
9
|
-
fetchFavorites: async ({ crprCd: e, userId: a }) => {
|
|
10
|
-
console.log("즐겨찾기 메뉴 요청:", { crprCd: e, userId: a }), t({ isLoading: !0, error: null });
|
|
11
|
-
try {
|
|
12
|
-
const n = await l(d("AUTH_BMRK"), {
|
|
13
|
-
crprCd: e,
|
|
14
|
-
userId: a
|
|
15
|
-
});
|
|
16
|
-
let r = [];
|
|
17
|
-
if (n?.favorites && Array.isArray(n.favorites) ? r = n.favorites : Array.isArray(n) ? r = n : (console.warn("즐겨찾기 데이터가 비어있거나 예상과 다른 구조입니다."), r = []), console.log("즐겨찾기 메뉴 로드 완료:", r), P && r.length === 0) {
|
|
18
|
-
const o = [
|
|
19
|
-
{
|
|
20
|
-
crprCd: "100",
|
|
21
|
-
menuGbCd: "CMPRGRP",
|
|
22
|
-
menuPrntId: "FAV001",
|
|
23
|
-
menuId: "FAV_TEST001",
|
|
24
|
-
menuNm: "API 테스트",
|
|
25
|
-
scrnId: "TEST001",
|
|
26
|
-
menuNo: 1,
|
|
27
|
-
scrnPath: "/dev/ApiTest",
|
|
28
|
-
menuLvl: 3,
|
|
29
|
-
rootMenu: "FAV001",
|
|
30
|
-
addedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
31
|
-
userId: a
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
crprCd: "100",
|
|
35
|
-
menuGbCd: "CMPRGRP",
|
|
36
|
-
menuPrntId: "FAV001",
|
|
37
|
-
menuId: "FAV_TEST002",
|
|
38
|
-
menuNm: "프로젝트 개요",
|
|
39
|
-
scrnId: "DOCS001",
|
|
40
|
-
menuNo: 2,
|
|
41
|
-
scrnPath: "/docs/ProjectOverview",
|
|
42
|
-
menuLvl: 3,
|
|
43
|
-
rootMenu: "FAV001",
|
|
44
|
-
addedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
45
|
-
userId: a
|
|
46
|
-
}
|
|
47
|
-
];
|
|
48
|
-
t({ favorites: o, isLoading: !1, error: null }), console.log("개발 모드: 테스트용 즐겨찾기 데이터 추가");
|
|
49
|
-
} else
|
|
50
|
-
t({ favorites: r, isLoading: !1, error: null });
|
|
51
|
-
} catch (n) {
|
|
52
|
-
console.error("즐겨찾기 메뉴 로드 실패:", n), t({
|
|
53
|
-
error: n instanceof Error ? n.message : "즐겨찾기 로드 실패",
|
|
54
|
-
isLoading: !1
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
// 즐겨찾기 추가
|
|
59
|
-
addFavorite: async (e, a) => {
|
|
60
|
-
const { favorites: n } = i();
|
|
61
|
-
if (n.some((r) => r.menuId === e.menuId)) {
|
|
62
|
-
console.log("이미 즐겨찾기에 추가된 메뉴입니다:", e.menuNm);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
try {
|
|
66
|
-
await l(d("AUTH_BMRK"), {
|
|
67
|
-
action: "add",
|
|
68
|
-
crprCd: e.crprCd,
|
|
69
|
-
userId: a,
|
|
70
|
-
menuId: e.menuId,
|
|
71
|
-
menuNm: e.menuNm,
|
|
72
|
-
scrnPath: e.scrnPath
|
|
73
|
-
});
|
|
74
|
-
const r = {
|
|
75
|
-
...e,
|
|
76
|
-
addedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
77
|
-
userId: a
|
|
78
|
-
};
|
|
79
|
-
t({ favorites: [...n, r] }), console.log("즐겨찾기 추가 완료:", e.menuNm);
|
|
80
|
-
} catch (r) {
|
|
81
|
-
throw console.error("즐겨찾기 추가 실패:", r), r;
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
// 즐겨찾기 제거
|
|
85
|
-
removeFavorite: async (e, a) => {
|
|
86
|
-
const { favorites: n } = i();
|
|
87
|
-
try {
|
|
88
|
-
await l(d("AUTH_BMRK"), {
|
|
89
|
-
action: "remove",
|
|
90
|
-
crprCd: "100",
|
|
91
|
-
// 기본값
|
|
92
|
-
userId: a,
|
|
93
|
-
menuId: e
|
|
94
|
-
});
|
|
95
|
-
const r = n.filter((o) => o.menuId !== e);
|
|
96
|
-
t({ favorites: r }), console.log("즐겨찾기 제거 완료:", e);
|
|
97
|
-
} catch (r) {
|
|
98
|
-
throw console.error("즐겨찾기 제거 실패:", r), r;
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
// 즐겨찾기 여부 확인
|
|
102
|
-
isFavorite: (e) => {
|
|
103
|
-
const { favorites: a } = i();
|
|
104
|
-
return a.some((n) => n.menuId === e);
|
|
105
|
-
},
|
|
106
|
-
// 즐겨찾기 초기화
|
|
107
|
-
clearFavorites: () => {
|
|
108
|
-
t({ favorites: [], isLoading: !1, error: null });
|
|
109
|
-
}
|
|
110
|
-
})), v = () => typeof process < "u" && process.env.NODE_ENV === "development" || typeof window < "u" && window.location.hostname === "localhost" ? [
|
|
111
|
-
// 1뎁스: 개발자 도구
|
|
112
|
-
{
|
|
113
|
-
crprCd: "100",
|
|
114
|
-
menuGbCd: "CMPRGRM",
|
|
115
|
-
menuPrntId: "-",
|
|
116
|
-
menuId: "DEV001",
|
|
117
|
-
menuNm: "개발자 도구",
|
|
118
|
-
scrnId: "",
|
|
119
|
-
menuNo: 0,
|
|
120
|
-
scrnPath: "",
|
|
121
|
-
menuLvl: 1,
|
|
122
|
-
rootMenu: "DEV001"
|
|
123
|
-
},
|
|
124
|
-
// 2뎁스: 컴포넌트 가이드
|
|
125
|
-
{
|
|
126
|
-
crprCd: "100",
|
|
127
|
-
menuGbCd: "CMPRGRS",
|
|
128
|
-
menuPrntId: "DEV001",
|
|
129
|
-
menuId: "DEV00101",
|
|
130
|
-
menuNm: "컴포넌트 가이드",
|
|
131
|
-
scrnId: "",
|
|
132
|
-
menuNo: 1,
|
|
133
|
-
scrnPath: "",
|
|
134
|
-
menuLvl: 2,
|
|
135
|
-
rootMenu: "DEV001"
|
|
136
|
-
},
|
|
137
|
-
// 3뎁스: BwgComponentGuideM01 컴포넌트
|
|
138
|
-
{
|
|
139
|
-
crprCd: "100",
|
|
140
|
-
menuGbCd: "CMPRGRP",
|
|
141
|
-
menuPrntId: "DEV00101",
|
|
142
|
-
menuId: "DEV0010101",
|
|
143
|
-
menuNm: "기본 컴포넌트",
|
|
144
|
-
scrnId: "BwgComponentGuideM01",
|
|
145
|
-
menuNo: 9991,
|
|
146
|
-
scrnPath: "/cm/guide/BwgComponentGuideM01",
|
|
147
|
-
menuLvl: 3,
|
|
148
|
-
rootMenu: "DEV00101"
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
crprCd: "100",
|
|
152
|
-
menuGbCd: "CMPRGRP",
|
|
153
|
-
menuPrntId: "DEV00101",
|
|
154
|
-
menuId: "DEV0010102",
|
|
155
|
-
menuNm: "응용 컴포넌트",
|
|
156
|
-
scrnId: "BwgComponentGuideM02",
|
|
157
|
-
menuNo: 9992,
|
|
158
|
-
scrnPath: "/cm/guide/BwgComponentGuideM02",
|
|
159
|
-
menuLvl: 3,
|
|
160
|
-
rootMenu: "DEV00101"
|
|
161
|
-
},
|
|
162
|
-
// 2뎁스: 개발자 가이드
|
|
163
|
-
{
|
|
164
|
-
crprCd: "100",
|
|
165
|
-
menuGbCd: "CMPRGRS",
|
|
166
|
-
menuPrntId: "DEV001",
|
|
167
|
-
menuId: "DEV00102",
|
|
168
|
-
menuNm: "개발자 가이드",
|
|
169
|
-
scrnId: "",
|
|
170
|
-
menuNo: 2,
|
|
171
|
-
scrnPath: "",
|
|
172
|
-
menuLvl: 2,
|
|
173
|
-
rootMenu: "DEV001"
|
|
174
|
-
},
|
|
175
|
-
// 3뎁스: BwgDeveloperGuideM01 컴포넌트
|
|
176
|
-
{
|
|
177
|
-
crprCd: "100",
|
|
178
|
-
menuGbCd: "CMPRGRP",
|
|
179
|
-
menuPrntId: "DEV00102",
|
|
180
|
-
menuId: "DEV0010201",
|
|
181
|
-
menuNm: "개발자 가이드",
|
|
182
|
-
scrnId: "BwgDeveloperGuideM01",
|
|
183
|
-
menuNo: 9993,
|
|
184
|
-
scrnPath: "/cm/guide/BwgDeveloperGuideM01",
|
|
185
|
-
menuLvl: 3,
|
|
186
|
-
rootMenu: "DEV00102"
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
crprCd: "100",
|
|
190
|
-
menuGbCd: "CMPRGRP",
|
|
191
|
-
menuPrntId: "DEV00102",
|
|
192
|
-
menuId: "DEV0010202",
|
|
193
|
-
menuNm: "React 가이드",
|
|
194
|
-
scrnId: "BwgReactGuideM01",
|
|
195
|
-
menuNo: 9994,
|
|
196
|
-
scrnPath: "/cm/guide/BwgReactGuideM01",
|
|
197
|
-
menuLvl: 3,
|
|
198
|
-
rootMenu: "DEV00102"
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
crprCd: "100",
|
|
202
|
-
menuGbCd: "CMPRGRP",
|
|
203
|
-
menuPrntId: "DEV00102",
|
|
204
|
-
menuId: "DEV0010203",
|
|
205
|
-
menuNm: "연습공간",
|
|
206
|
-
scrnId: "BwgPracticeM01",
|
|
207
|
-
menuNo: 9995,
|
|
208
|
-
scrnPath: "/cm/guide/BwgPracticeM01",
|
|
209
|
-
menuLvl: 3,
|
|
210
|
-
rootMenu: "DEV00102"
|
|
211
|
-
}
|
|
212
|
-
] : [], g = (t) => {
|
|
213
|
-
if (!t || !Array.isArray(t) || t.length === 0)
|
|
214
|
-
return [];
|
|
215
|
-
const i = /* @__PURE__ */ new Map(), e = [];
|
|
216
|
-
t.forEach((o) => {
|
|
217
|
-
o && o.menuId && i.set(o.menuId, { ...o, children: [] });
|
|
218
|
-
}), t.forEach((o) => {
|
|
219
|
-
if (!o || !o.menuId) return;
|
|
220
|
-
const s = i.get(o.menuId);
|
|
221
|
-
if (s)
|
|
222
|
-
if (o.menuPrntId && o.menuPrntId !== "" && o.menuPrntId !== "-") {
|
|
223
|
-
const c = i.get(o.menuPrntId);
|
|
224
|
-
c && c.children.push(s);
|
|
225
|
-
} else
|
|
226
|
-
e.push(s);
|
|
227
|
-
});
|
|
228
|
-
const a = (o) => o.sort((s, c) => s.menuNo - c.menuNo).map((s) => ({
|
|
229
|
-
...s,
|
|
230
|
-
children: s.children && s.children.length > 0 ? a(s.children) : void 0
|
|
231
|
-
})), n = a(e), r = n.filter((o) => o.menuId.startsWith("DEV"));
|
|
232
|
-
return r.length > 0 && console.log("DEV 최종 결과:", r), n;
|
|
233
|
-
}, b = f((t, i) => ({
|
|
234
|
-
menuList: [],
|
|
235
|
-
isLoading: !1,
|
|
236
|
-
error: null,
|
|
237
|
-
activeMenu: "1",
|
|
238
|
-
currentProgram: null,
|
|
239
|
-
tabs: [],
|
|
240
|
-
activeTabKey: null,
|
|
241
|
-
sidebarCollapsed: !1,
|
|
242
|
-
// 사이드바 접기/펼치기 상태
|
|
243
|
-
viewStates: {},
|
|
244
|
-
// 뷰별 상태 저장
|
|
245
|
-
_lastFetchParams: null,
|
|
246
|
-
// 마지막 fetch 파라미터 저장
|
|
247
|
-
// 메뉴 데이터 가져오기
|
|
248
|
-
fetchMenu: async ({ crprCd: e, userId: a, prntGbcd: n }) => {
|
|
249
|
-
const r = { crprCd: e, userId: a, prntGbcd: n ?? 1 }, { _lastFetchParams: o } = i();
|
|
250
|
-
if (o && o.crprCd === r.crprCd && o.userId === r.userId && o.prntGbcd === r.prntGbcd) {
|
|
251
|
-
console.log("동일한 파라미터로 중복 요청 방지:", r);
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
console.log("메뉴 데이터 요청 시작:", r), t({ isLoading: !0, error: null, _lastFetchParams: r });
|
|
255
|
-
try {
|
|
256
|
-
const s = await l(
|
|
257
|
-
d("AUTH_MENU"),
|
|
258
|
-
r
|
|
259
|
-
);
|
|
260
|
-
let c = [];
|
|
261
|
-
s?.menus && Array.isArray(s.menus) ? c = s.menus : Array.isArray(s) ? c = s : (console.warn(
|
|
262
|
-
"서버 응답이 비어있거나 예상과 다른 구조입니다. 개발자 메뉴만 표시합니다."
|
|
263
|
-
), c = []);
|
|
264
|
-
const u = v();
|
|
265
|
-
u.length > 0 && (c = [...u, ...c]);
|
|
266
|
-
const m = g(c);
|
|
267
|
-
console.log("메뉴 데이터 로드 완료 (계층 구조):", m), t({
|
|
268
|
-
menuList: m,
|
|
269
|
-
isLoading: !1,
|
|
270
|
-
error: null
|
|
271
|
-
});
|
|
272
|
-
} catch (s) {
|
|
273
|
-
console.error("메뉴 데이터 로드 실패:", s);
|
|
274
|
-
const c = v();
|
|
275
|
-
if (c.length > 0) {
|
|
276
|
-
console.log("서버 오류로 인해 개발자 메뉴만 표시합니다.");
|
|
277
|
-
const u = g(c);
|
|
278
|
-
t({
|
|
279
|
-
menuList: u,
|
|
280
|
-
isLoading: !1,
|
|
281
|
-
error: null
|
|
282
|
-
});
|
|
283
|
-
} else
|
|
284
|
-
t({
|
|
285
|
-
error: s instanceof Error ? s.message : "메뉴 로드 실패",
|
|
286
|
-
isLoading: !1
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
},
|
|
290
|
-
// 활성 메뉴 설정
|
|
291
|
-
setActiveMenu: (e) => {
|
|
292
|
-
t({ activeMenu: e });
|
|
293
|
-
},
|
|
294
|
-
// 현재 프로그램 설정
|
|
295
|
-
setCurrentProgram: (e) => {
|
|
296
|
-
console.log("setCurrentProgram 호출:", e), t({ currentProgram: e });
|
|
297
|
-
},
|
|
298
|
-
// 탭 추가
|
|
299
|
-
addTab: (e) => {
|
|
300
|
-
const { tabs: a } = i();
|
|
301
|
-
if (a.find((r) => r.key === e.menuId))
|
|
302
|
-
t({ activeTabKey: e.menuId });
|
|
303
|
-
else {
|
|
304
|
-
const r = {
|
|
305
|
-
key: e.menuId,
|
|
306
|
-
label: e.menuNm,
|
|
307
|
-
menuItem: e,
|
|
308
|
-
closable: !0
|
|
309
|
-
};
|
|
310
|
-
t({
|
|
311
|
-
tabs: [...a, r],
|
|
312
|
-
activeTabKey: e.menuId
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
},
|
|
316
|
-
// 탭 제거
|
|
317
|
-
removeTab: (e) => {
|
|
318
|
-
const { tabs: a, activeTabKey: n } = i(), r = a.filter((s) => s.key !== e);
|
|
319
|
-
let o = n;
|
|
320
|
-
if (n === e) {
|
|
321
|
-
const s = a.findIndex((c) => c.key === e);
|
|
322
|
-
r.length > 0 ? o = r[Math.min(s, r.length - 1)]?.key || null : o = null;
|
|
323
|
-
}
|
|
324
|
-
t({
|
|
325
|
-
tabs: r,
|
|
326
|
-
activeTabKey: o,
|
|
327
|
-
currentProgram: o && r.find((s) => s.key === o)?.menuItem || null
|
|
328
|
-
});
|
|
329
|
-
},
|
|
330
|
-
// 활성 탭 설정
|
|
331
|
-
setActiveTab: (e) => {
|
|
332
|
-
const { tabs: a } = i(), n = a.find((r) => r.key === e);
|
|
333
|
-
n && t({
|
|
334
|
-
activeTabKey: e,
|
|
335
|
-
currentProgram: n.menuItem
|
|
336
|
-
});
|
|
337
|
-
},
|
|
338
|
-
// 탭 초기화
|
|
339
|
-
clearTabs: () => {
|
|
340
|
-
t({
|
|
341
|
-
tabs: [],
|
|
342
|
-
activeTabKey: null,
|
|
343
|
-
currentProgram: null
|
|
344
|
-
});
|
|
345
|
-
},
|
|
346
|
-
// 메뉴 데이터 초기화
|
|
347
|
-
clearMenu: () => {
|
|
348
|
-
t({
|
|
349
|
-
menuList: [],
|
|
350
|
-
error: null,
|
|
351
|
-
activeMenu: "1",
|
|
352
|
-
currentProgram: null,
|
|
353
|
-
tabs: [],
|
|
354
|
-
activeTabKey: null,
|
|
355
|
-
_lastFetchParams: null
|
|
356
|
-
// 마지막 fetch 파라미터도 초기화
|
|
357
|
-
});
|
|
358
|
-
},
|
|
359
|
-
// 사이드바 접기/펼치기 토글
|
|
360
|
-
toggleSidebar: () => {
|
|
361
|
-
const { sidebarCollapsed: e } = i();
|
|
362
|
-
t({ sidebarCollapsed: !e });
|
|
363
|
-
},
|
|
364
|
-
// 뷰 상태 업데이트
|
|
365
|
-
updateViewState: (e, a, n) => {
|
|
366
|
-
t((r) => ({
|
|
367
|
-
viewStates: {
|
|
368
|
-
...r.viewStates,
|
|
369
|
-
[e]: {
|
|
370
|
-
...r.viewStates[e],
|
|
371
|
-
[a]: n
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
})), console.log(`뷰 상태 업데이트: ${e}.${a}`, n);
|
|
375
|
-
}
|
|
376
|
-
}));
|
|
377
|
-
export {
|
|
378
|
-
C as a,
|
|
379
|
-
b as u
|
|
380
|
-
};
|
|
381
|
-
//# sourceMappingURL=menuStore-CvQrMo35.js.map
|