@bwg-ui/core 1.3.0 → 1.3.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/{CMSearchIntfGwP01-_h2B12Ig.js → CMSearchIntfGwP01-BWm9OqAH.js} +1 -1
- package/dist/chunks/{CMSearchIntfGwP01-D7XtXMLy.cjs → CMSearchIntfGwP01-CihGc5Q1.cjs} +1 -1
- package/dist/chunks/{MenuReport-DuWbbKBC.cjs → MenuReport-khjaUz1Q.cjs} +1 -1
- package/dist/chunks/{MenuReport-Bw3AvR6b.js → MenuReport-yYhMOHyq.js} +1 -1
- package/dist/chunks/{common-components-BOJo6FH_.cjs → common-components-DletnDTf.cjs} +72 -72
- package/dist/chunks/{common-components-BjfrRYiU.js → common-components-coAoWxE9.js} +6913 -6823
- package/dist/chunks/{layout-components-DNhUIx4u.js → layout-components-C1DG2B74.js} +899 -666
- package/dist/chunks/layout-components-C6KeWPIu.cjs +35 -0
- package/dist/components/common/BwgDetail.d.ts.map +1 -1
- package/dist/components/common/BwgGrid.d.ts.map +1 -1
- package/dist/components/common/BwgPagination.d.ts.map +1 -1
- package/dist/components/common/index.cjs +1 -1
- package/dist/components/common/index.js +1 -1
- package/dist/components/guide/index.cjs +1 -1
- package/dist/components/guide/index.js +1 -1
- package/dist/components/layout/BwgPortal01.d.ts.map +1 -1
- package/dist/components/layout/custom/ConfigurableHeader.d.ts.map +1 -1
- package/dist/components/layout/custom/ConfigurableMenuTab.d.ts.map +1 -1
- package/dist/components/layout/index.cjs +1 -1
- package/dist/components/layout/index.js +1 -1
- package/dist/components/popup/index.cjs +1 -1
- package/dist/components/popup/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/stores/index.cjs +2 -2
- package/dist/stores/index.d.ts +6 -0
- package/dist/stores/index.d.ts.map +1 -1
- package/dist/stores/index.js +265 -185
- package/dist/stores/menuViewStore.d.ts +6 -0
- package/dist/stores/menuViewStore.d.ts.map +1 -1
- package/dist/stores/userStore.d.ts +19 -0
- package/dist/stores/userStore.d.ts.map +1 -1
- package/dist/styles/assets/images/contents/icon/ico-tab-hashtag-grey.svg +11 -0
- package/dist/styles/assets/images/contents/icon/ico-tab-hashtag.svg +11 -0
- package/dist/styles/components.css +71 -0
- package/dist/styles/layout.css +1289 -1234
- package/dist/utils/gridUtils.d.ts +6 -6
- package/dist/utils/gridUtils.d.ts.map +1 -1
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +936 -971
- package/package.json +1 -1
- package/dist/chunks/layout-components-Ddn-4n36.cjs +0 -35
package/dist/stores/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { create as
|
|
2
|
-
import { callService as
|
|
3
|
-
import { message as
|
|
4
|
-
import { l as se } from "../chunks/layout-components-
|
|
1
|
+
import { create as N } from "zustand";
|
|
2
|
+
import { callService as b, getServiceCode as F, getUserId as v, getUserInfo as ee, getCookie as te, encryptSha256 as oe, setCookie as $ } from "../utils/index.js";
|
|
3
|
+
import { message as w } from "antd";
|
|
4
|
+
import { l as se } from "../chunks/layout-components-C1DG2B74.js";
|
|
5
5
|
import { useState as X, useCallback as W } from "react";
|
|
6
6
|
import { useNavigate as ne } from "react-router-dom";
|
|
7
7
|
function re(n, r) {
|
|
@@ -21,12 +21,12 @@ function re(n, r) {
|
|
|
21
21
|
removeItem: (o) => e.removeItem(o)
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const K = (n) => (r) => {
|
|
25
25
|
try {
|
|
26
26
|
const e = n(r);
|
|
27
27
|
return e instanceof Promise ? e : {
|
|
28
28
|
then(s) {
|
|
29
|
-
return
|
|
29
|
+
return K(s)(e);
|
|
30
30
|
},
|
|
31
31
|
catch(s) {
|
|
32
32
|
return this;
|
|
@@ -38,7 +38,7 @@ const E = (n) => (r) => {
|
|
|
38
38
|
return this;
|
|
39
39
|
},
|
|
40
40
|
catch(s) {
|
|
41
|
-
return
|
|
41
|
+
return K(s)(e);
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
}
|
|
@@ -71,8 +71,8 @@ const E = (n) => (r) => {
|
|
|
71
71
|
state: C,
|
|
72
72
|
version: t.version
|
|
73
73
|
});
|
|
74
|
-
},
|
|
75
|
-
o.setState = (C, g) => (
|
|
74
|
+
}, h = o.setState;
|
|
75
|
+
o.setState = (C, g) => (h(C, g), l());
|
|
76
76
|
const m = n(
|
|
77
77
|
(...C) => (e(...C), l()),
|
|
78
78
|
s,
|
|
@@ -80,21 +80,21 @@ const E = (n) => (r) => {
|
|
|
80
80
|
);
|
|
81
81
|
o.getInitialState = () => m;
|
|
82
82
|
let u;
|
|
83
|
-
const
|
|
83
|
+
const f = () => {
|
|
84
84
|
var C, g;
|
|
85
85
|
if (!i) return;
|
|
86
|
-
a = !1, d.forEach((
|
|
86
|
+
a = !1, d.forEach((I) => {
|
|
87
87
|
var S;
|
|
88
|
-
return
|
|
88
|
+
return I((S = s()) != null ? S : m);
|
|
89
89
|
});
|
|
90
90
|
const k = ((g = t.onRehydrateStorage) == null ? void 0 : g.call(t, (C = s()) != null ? C : m)) || void 0;
|
|
91
|
-
return
|
|
92
|
-
if (
|
|
93
|
-
if (typeof
|
|
91
|
+
return K(i.getItem.bind(i))(t.name).then((I) => {
|
|
92
|
+
if (I)
|
|
93
|
+
if (typeof I.version == "number" && I.version !== t.version) {
|
|
94
94
|
if (t.migrate) {
|
|
95
95
|
const S = t.migrate(
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
I.state,
|
|
97
|
+
I.version
|
|
98
98
|
);
|
|
99
99
|
return S instanceof Promise ? S.then((_) => [!0, _]) : [!0, S];
|
|
100
100
|
}
|
|
@@ -102,20 +102,20 @@ const E = (n) => (r) => {
|
|
|
102
102
|
"State loaded from storage couldn't be migrated since no migrate function was provided"
|
|
103
103
|
);
|
|
104
104
|
} else
|
|
105
|
-
return [!1,
|
|
105
|
+
return [!1, I.state];
|
|
106
106
|
return [!1, void 0];
|
|
107
|
-
}).then((
|
|
107
|
+
}).then((I) => {
|
|
108
108
|
var S;
|
|
109
|
-
const [_, Q] =
|
|
109
|
+
const [_, Q] = I;
|
|
110
110
|
if (u = t.merge(
|
|
111
111
|
Q,
|
|
112
112
|
(S = s()) != null ? S : m
|
|
113
113
|
), e(u, !0), _)
|
|
114
114
|
return l();
|
|
115
115
|
}).then(() => {
|
|
116
|
-
k?.(u, void 0), u = s(), a = !0, c.forEach((
|
|
117
|
-
}).catch((
|
|
118
|
-
k?.(void 0,
|
|
116
|
+
k?.(u, void 0), u = s(), a = !0, c.forEach((I) => I(u));
|
|
117
|
+
}).catch((I) => {
|
|
118
|
+
k?.(void 0, I);
|
|
119
119
|
});
|
|
120
120
|
};
|
|
121
121
|
return o.persist = {
|
|
@@ -129,7 +129,7 @@ const E = (n) => (r) => {
|
|
|
129
129
|
i?.removeItem(t.name);
|
|
130
130
|
},
|
|
131
131
|
getOptions: () => t,
|
|
132
|
-
rehydrate: () =>
|
|
132
|
+
rehydrate: () => f(),
|
|
133
133
|
hasHydrated: () => a,
|
|
134
134
|
onHydrate: (C) => (d.add(C), () => {
|
|
135
135
|
d.delete(C);
|
|
@@ -137,8 +137,8 @@ const E = (n) => (r) => {
|
|
|
137
137
|
onFinishHydration: (C) => (c.add(C), () => {
|
|
138
138
|
c.delete(C);
|
|
139
139
|
})
|
|
140
|
-
}, t.skipHydration ||
|
|
141
|
-
}, M = ae, H =
|
|
140
|
+
}, t.skipHydration || f(), u || m;
|
|
141
|
+
}, M = ae, H = N()(
|
|
142
142
|
M(
|
|
143
143
|
(n, r) => ({
|
|
144
144
|
user: null,
|
|
@@ -152,6 +152,10 @@ const E = (n) => (r) => {
|
|
|
152
152
|
// 기본값: 크게
|
|
153
153
|
enableProtectWrapper: !0,
|
|
154
154
|
// 기본값: 활성화
|
|
155
|
+
gridLayouts: {},
|
|
156
|
+
// 그리드 레이아웃 정보 (sysCd별로 관리)
|
|
157
|
+
theme: "modern",
|
|
158
|
+
// 기본값: modern
|
|
155
159
|
isLoggedIn: () => !!r().user,
|
|
156
160
|
// 로그인
|
|
157
161
|
setLoginUser: (e, s) => {
|
|
@@ -186,6 +190,10 @@ const E = (n) => (r) => {
|
|
|
186
190
|
setEnableProtectWrapper: (e) => {
|
|
187
191
|
n({ enableProtectWrapper: e });
|
|
188
192
|
},
|
|
193
|
+
// 테마 설정
|
|
194
|
+
setTheme: (e) => {
|
|
195
|
+
n({ theme: e }), console.log("테마 변경:", e);
|
|
196
|
+
},
|
|
189
197
|
// 권한 확인 결과 가져오기
|
|
190
198
|
getButtonAuth: (e, s) => {
|
|
191
199
|
const o = `${e}_${s}`;
|
|
@@ -204,6 +212,40 @@ const E = (n) => (r) => {
|
|
|
204
212
|
// 권한 확인 결과 초기화
|
|
205
213
|
clearButtonAuths: () => {
|
|
206
214
|
n({ buttonAuths: {} });
|
|
215
|
+
},
|
|
216
|
+
// 그리드 레이아웃 관련 메서드
|
|
217
|
+
getGridLayouts: (e) => r().gridLayouts[e] || [],
|
|
218
|
+
getGridLayout: (e, s, o) => r().getGridLayouts(e).find(
|
|
219
|
+
(d) => d.menuId === s && d.gridId === o
|
|
220
|
+
) || null,
|
|
221
|
+
saveGridLayout: (e, s, o, t) => {
|
|
222
|
+
const a = { ...r().gridLayouts };
|
|
223
|
+
a[e] || (a[e] = []);
|
|
224
|
+
const d = a[e].findIndex(
|
|
225
|
+
(i) => i.menuId === s && i.gridId === o
|
|
226
|
+
), c = {
|
|
227
|
+
menuId: s,
|
|
228
|
+
gridId: o,
|
|
229
|
+
layout: t
|
|
230
|
+
};
|
|
231
|
+
d >= 0 ? a[e][d] = c : a[e].push(c), n({ gridLayouts: a }), console.log(
|
|
232
|
+
`[UserStore] 그리드 레이아웃 저장 완료: ${e}/${s}/${o}`
|
|
233
|
+
);
|
|
234
|
+
},
|
|
235
|
+
removeGridLayout: (e, s, o) => {
|
|
236
|
+
const t = { ...r().gridLayouts };
|
|
237
|
+
t[e] && (t[e] = t[e].filter(
|
|
238
|
+
(a) => !(a.menuId === s && a.gridId === o)
|
|
239
|
+
), n({ gridLayouts: t }), console.log(
|
|
240
|
+
`[UserStore] 그리드 레이아웃 삭제 완료: ${e}/${s}/${o}`
|
|
241
|
+
));
|
|
242
|
+
},
|
|
243
|
+
clearGridLayouts: (e) => {
|
|
244
|
+
const s = { ...r().gridLayouts };
|
|
245
|
+
delete s[e], n({ gridLayouts: s }), console.log(`[UserStore] ${e}의 모든 그리드 레이아웃 삭제 완료`);
|
|
246
|
+
},
|
|
247
|
+
clearAllGridLayouts: () => {
|
|
248
|
+
n({ gridLayouts: {} }), console.log("[UserStore] 전체 그리드 레이아웃 삭제 완료");
|
|
207
249
|
}
|
|
208
250
|
}),
|
|
209
251
|
{
|
|
@@ -216,13 +258,17 @@ const E = (n) => (r) => {
|
|
|
216
258
|
gridSize: n.gridSize,
|
|
217
259
|
spacingSize: n.spacingSize,
|
|
218
260
|
enableProtectWrapper: n.enableProtectWrapper,
|
|
261
|
+
gridLayouts: n.gridLayouts,
|
|
262
|
+
// 그리드 레이아웃 정보 저장
|
|
263
|
+
theme: n.theme,
|
|
264
|
+
// 테마 정보 저장
|
|
219
265
|
isLoggedIn: n.isLoggedIn
|
|
220
266
|
// buttonAuthCache는 세션 동안만 유지 (localStorage에 저장 안 함)
|
|
221
267
|
})
|
|
222
268
|
// 저장할 상태만 선택
|
|
223
269
|
}
|
|
224
270
|
)
|
|
225
|
-
),
|
|
271
|
+
), T = {
|
|
226
272
|
CACHE_SIZE_LIMIT: 1e3
|
|
227
273
|
}, p = {
|
|
228
274
|
codeCache: /* @__PURE__ */ new Map(),
|
|
@@ -246,7 +292,7 @@ const E = (n) => (r) => {
|
|
|
246
292
|
markGroupLoaded(n) {
|
|
247
293
|
this.loadedGroups.add(n);
|
|
248
294
|
}
|
|
249
|
-
},
|
|
295
|
+
}, L = (n) => {
|
|
250
296
|
console.log("대규모 데이터 변환 시작:", n);
|
|
251
297
|
const r = {};
|
|
252
298
|
if (n && n.code && Array.isArray(n.code)) {
|
|
@@ -274,7 +320,7 @@ const E = (n) => (r) => {
|
|
|
274
320
|
});
|
|
275
321
|
}
|
|
276
322
|
return console.log("대규모 데이터 변환 완료:", r), r;
|
|
277
|
-
},
|
|
323
|
+
}, y = N()(
|
|
278
324
|
M(
|
|
279
325
|
(n, r) => ({
|
|
280
326
|
codeData: null,
|
|
@@ -287,11 +333,11 @@ const E = (n) => (r) => {
|
|
|
287
333
|
n({ isLoading: !0, error: null });
|
|
288
334
|
try {
|
|
289
335
|
console.log("시스템 공통코드 데이터 가져오기 시작: SCMSIGN00301");
|
|
290
|
-
const e = await
|
|
336
|
+
const e = await b(F("SRCH_CODE"), {
|
|
291
337
|
crprCd: "100"
|
|
292
338
|
});
|
|
293
339
|
console.log("시스템 공통코드 응답:", e), console.log("시스템 공통코드목록:", e.code), console.log("시스템 공통코드옵션목록:", e.opt);
|
|
294
|
-
const s =
|
|
340
|
+
const s = L(e), t = {
|
|
295
341
|
...r().codeData || {},
|
|
296
342
|
...s
|
|
297
343
|
// 시스템 공통코드가 우선 (같은 그룹코드가 있으면 덮어씀)
|
|
@@ -319,11 +365,11 @@ const E = (n) => (r) => {
|
|
|
319
365
|
n({ isLoading: !0, error: null });
|
|
320
366
|
try {
|
|
321
367
|
console.log("업무 공통코드 데이터 가져오기 시작: SCMSIGN00302");
|
|
322
|
-
const e = await
|
|
368
|
+
const e = await b("SCMSIGN00302", {
|
|
323
369
|
sysCd: __SYS_CD__
|
|
324
370
|
});
|
|
325
371
|
console.log("업무 공통코드 응답:", e), console.log("업무 공통코드목록:", e.code), console.log("업무 공통코드옵션목록:", e.opt);
|
|
326
|
-
const s =
|
|
372
|
+
const s = L(e), t = {
|
|
327
373
|
...r().codeData || {},
|
|
328
374
|
...s
|
|
329
375
|
// 업무 공통코드 추가 (같은 그룹코드가 있으면 덮어씀)
|
|
@@ -352,15 +398,15 @@ const E = (n) => (r) => {
|
|
|
352
398
|
try {
|
|
353
399
|
console.log("전체 공통코드 데이터 가져오기 시작 (시스템 + 업무)");
|
|
354
400
|
const [e, s] = await Promise.all([
|
|
355
|
-
|
|
401
|
+
b(F("SRCH_CODE"), {
|
|
356
402
|
crprCd: "100"
|
|
357
403
|
}),
|
|
358
|
-
|
|
404
|
+
b("SCMSIGN00302", {
|
|
359
405
|
sysCd: __SYS_CD__
|
|
360
406
|
})
|
|
361
407
|
]);
|
|
362
408
|
console.log("시스템 공통코드 응답:", e), console.log("업무 공통코드 응답:", s);
|
|
363
|
-
const o =
|
|
409
|
+
const o = L(e), t = L(s), a = {
|
|
364
410
|
...o,
|
|
365
411
|
...t
|
|
366
412
|
// 업무 공통코드가 같은 그룹코드를 덮어쓸 수 있음
|
|
@@ -420,25 +466,25 @@ const E = (n) => (r) => {
|
|
|
420
466
|
})
|
|
421
467
|
}
|
|
422
468
|
)
|
|
423
|
-
), G =
|
|
469
|
+
), G = N()(
|
|
424
470
|
M(
|
|
425
471
|
(n, r) => ({
|
|
426
472
|
// 공통 데이터 스토어에서 상태 가져오기
|
|
427
473
|
get codeData() {
|
|
428
|
-
return
|
|
474
|
+
return y.getState().codeData;
|
|
429
475
|
},
|
|
430
476
|
get isLoading() {
|
|
431
|
-
return
|
|
477
|
+
return y.getState().isLoading;
|
|
432
478
|
},
|
|
433
479
|
get error() {
|
|
434
|
-
return
|
|
480
|
+
return y.getState().error;
|
|
435
481
|
},
|
|
436
482
|
get lastUpdated() {
|
|
437
|
-
return
|
|
483
|
+
return y.getState().lastUpdated;
|
|
438
484
|
},
|
|
439
485
|
// 공통코드 가져오기 (중앙 스토어 사용)
|
|
440
486
|
fetchCommonCodes: async () => {
|
|
441
|
-
await
|
|
487
|
+
await y.getState().fetchData();
|
|
442
488
|
},
|
|
443
489
|
// 1. 통합된 코드 목록 조회 (그룹코드 필수, 옵션으로 필터링)
|
|
444
490
|
getCodeList: (e, s) => {
|
|
@@ -449,36 +495,36 @@ const E = (n) => (r) => {
|
|
|
449
495
|
excludeParentCode: d = !1
|
|
450
496
|
} = s || {}, c = `simpleCodeList_${e}_${o}_${t}_${a}_${d}`;
|
|
451
497
|
if (p.optionCache.has(c)) {
|
|
452
|
-
const
|
|
453
|
-
return p.cacheHits.set(c,
|
|
498
|
+
const f = p.cacheHits.get(c) || 0;
|
|
499
|
+
return p.cacheHits.set(c, f + 1), p.optionCache.get(c);
|
|
454
500
|
}
|
|
455
|
-
const i =
|
|
501
|
+
const i = y.getState().codeData;
|
|
456
502
|
if (!i) return [];
|
|
457
503
|
if (!p.isGroupLoaded(e) && !i[e])
|
|
458
504
|
return console.warn(`그룹 ${e}가 아직 로드되지 않았습니다.`), [];
|
|
459
|
-
const l = [],
|
|
460
|
-
|
|
461
|
-
if (!(o && !
|
|
505
|
+
const l = [], h = i[e];
|
|
506
|
+
h && Object.values(h).forEach((f) => {
|
|
507
|
+
if (!(o && !f.enabled) && !(t && f.systemCodeYn !== "Y"))
|
|
462
508
|
if (d) {
|
|
463
|
-
const C = e.length, g =
|
|
509
|
+
const C = e.length, g = f.codeValue.substring(C);
|
|
464
510
|
g.length > 0 && l.push({
|
|
465
|
-
...
|
|
511
|
+
...f,
|
|
466
512
|
codeValue: g
|
|
467
513
|
// 자식코드만 사용
|
|
468
514
|
});
|
|
469
515
|
} else
|
|
470
|
-
l.push(
|
|
516
|
+
l.push(f);
|
|
471
517
|
});
|
|
472
518
|
let m;
|
|
473
|
-
a ? m = l.sort((
|
|
474
|
-
(
|
|
519
|
+
a ? m = l.sort((f, C) => f.sortOrder !== C.sortOrder ? f.sortOrder - C.sortOrder : f.codeValue.localeCompare(C.codeValue)) : m = l.sort(
|
|
520
|
+
(f, C) => f.codeValue.localeCompare(C.codeValue)
|
|
475
521
|
);
|
|
476
|
-
const u = m.map((
|
|
477
|
-
label:
|
|
478
|
-
value:
|
|
479
|
-
tagColor:
|
|
522
|
+
const u = m.map((f) => ({
|
|
523
|
+
label: f.codeNm,
|
|
524
|
+
value: f.codeValue,
|
|
525
|
+
tagColor: f.labelColor
|
|
480
526
|
}));
|
|
481
|
-
return p.optionCache.size >=
|
|
527
|
+
return p.optionCache.size >= T.CACHE_SIZE_LIMIT && p.cleanupCache(), p.optionCache.set(c, u), p.cacheHits.set(c, 1), u;
|
|
482
528
|
},
|
|
483
529
|
// 2. 코드를 던졌을 때 코드명을 리턴 (대규모 최적화)
|
|
484
530
|
getCodeName: (e) => {
|
|
@@ -486,7 +532,7 @@ const E = (n) => (r) => {
|
|
|
486
532
|
const o = p.cacheHits.get(`name_${e}`) || 0;
|
|
487
533
|
return p.cacheHits.set(`name_${e}`, o + 1), p.nameCache.get(e);
|
|
488
534
|
}
|
|
489
|
-
const s =
|
|
535
|
+
const s = y.getState().codeData;
|
|
490
536
|
if (!s) return null;
|
|
491
537
|
for (const o of Object.values(s))
|
|
492
538
|
for (const t of Object.values(o))
|
|
@@ -500,7 +546,7 @@ const E = (n) => (r) => {
|
|
|
500
546
|
const o = p.cacheHits.get(`color_${e}`) || 0;
|
|
501
547
|
return p.cacheHits.set(`color_${e}`, o + 1), p.colorCache.get(e);
|
|
502
548
|
}
|
|
503
|
-
const s =
|
|
549
|
+
const s = y.getState().codeData;
|
|
504
550
|
if (!s) return null;
|
|
505
551
|
for (const o of Object.values(s))
|
|
506
552
|
for (const t of Object.values(o))
|
|
@@ -518,7 +564,7 @@ const E = (n) => (r) => {
|
|
|
518
564
|
const i = p.cacheHits.get(s) || 0;
|
|
519
565
|
return p.cacheHits.set(s, i + 1), p.optionCache.get(s);
|
|
520
566
|
}
|
|
521
|
-
const o =
|
|
567
|
+
const o = y.getState().codeData;
|
|
522
568
|
if (!o) return { labels: [], values: [], lookupDisplay: !0 };
|
|
523
569
|
const t = o[e];
|
|
524
570
|
if (!t) return { labels: [], values: [], lookupDisplay: !0 };
|
|
@@ -536,7 +582,7 @@ const E = (n) => (r) => {
|
|
|
536
582
|
const l = p.cacheHits.get(t) || 0;
|
|
537
583
|
return p.cacheHits.set(t, l + 1), p.codeCache.get(t);
|
|
538
584
|
}
|
|
539
|
-
const a =
|
|
585
|
+
const a = y.getState().codeData;
|
|
540
586
|
if (!a) return [];
|
|
541
587
|
const d = [], c = a[e];
|
|
542
588
|
c && Object.values(c).forEach((l) => {
|
|
@@ -547,9 +593,9 @@ const E = (n) => (r) => {
|
|
|
547
593
|
});
|
|
548
594
|
});
|
|
549
595
|
const i = d.sort(
|
|
550
|
-
(l,
|
|
596
|
+
(l, h) => l.codeValue.localeCompare(h.codeValue)
|
|
551
597
|
);
|
|
552
|
-
return p.codeCache.size >=
|
|
598
|
+
return p.codeCache.size >= T.CACHE_SIZE_LIMIT && p.cleanupCache(), p.codeCache.set(t, i), p.cacheHits.set(t, 1), i;
|
|
553
599
|
},
|
|
554
600
|
// 6. 옵션코드별로 코드 목록 조회 (SimpleCodeItem 형태로 반환)
|
|
555
601
|
getCodeListByOption: (e, s, o) => {
|
|
@@ -564,12 +610,12 @@ const E = (n) => (r) => {
|
|
|
564
610
|
c
|
|
565
611
|
);
|
|
566
612
|
}
|
|
567
|
-
const i =
|
|
613
|
+
const i = y.getState().codeData;
|
|
568
614
|
if (!i) return [];
|
|
569
615
|
if (!p.isGroupLoaded(e) && !i[e])
|
|
570
616
|
return console.warn(`그룹 ${e}가 아직 로드되지 않았습니다.`), [];
|
|
571
|
-
const l = [],
|
|
572
|
-
|
|
617
|
+
const l = [], h = i[e];
|
|
618
|
+
h && Object.values(h).forEach((u) => {
|
|
573
619
|
t && !u.enabled || a && u.systemCodeYn !== "Y" || u.options && u.options[s] && l.push({
|
|
574
620
|
label: u.options[s],
|
|
575
621
|
// optnNm 값
|
|
@@ -580,9 +626,9 @@ const E = (n) => (r) => {
|
|
|
580
626
|
});
|
|
581
627
|
});
|
|
582
628
|
let m;
|
|
583
|
-
return d ? m = l.sort((u,
|
|
584
|
-
(u,
|
|
585
|
-
), p.codeCache.size >=
|
|
629
|
+
return d ? m = l.sort((u, f) => u.value.localeCompare(f.value)) : m = l.sort(
|
|
630
|
+
(u, f) => u.value.localeCompare(f.value)
|
|
631
|
+
), p.codeCache.size >= T.CACHE_SIZE_LIMIT && p.cleanupCache(), p.codeCache.set(c, m), p.cacheHits.set(c, 1), m;
|
|
586
632
|
},
|
|
587
633
|
// 7. 그룹코드 목록 조회
|
|
588
634
|
getAvailableGroupCodes: () => {
|
|
@@ -591,7 +637,7 @@ const E = (n) => (r) => {
|
|
|
591
637
|
const t = p.cacheHits.get(e) || 0;
|
|
592
638
|
return p.cacheHits.set(e, t + 1), JSON.parse(p.nameCache.get(e));
|
|
593
639
|
}
|
|
594
|
-
const s =
|
|
640
|
+
const s = y.getState().codeData;
|
|
595
641
|
if (!s) return [];
|
|
596
642
|
const o = Object.keys(s).sort();
|
|
597
643
|
return p.nameCache.set(
|
|
@@ -601,7 +647,7 @@ const E = (n) => (r) => {
|
|
|
601
647
|
},
|
|
602
648
|
// 공통코드 초기화
|
|
603
649
|
clearCodes: () => {
|
|
604
|
-
|
|
650
|
+
y.getState().clearData();
|
|
605
651
|
}
|
|
606
652
|
}),
|
|
607
653
|
{
|
|
@@ -611,25 +657,25 @@ const E = (n) => (r) => {
|
|
|
611
657
|
})
|
|
612
658
|
}
|
|
613
659
|
)
|
|
614
|
-
), ve =
|
|
660
|
+
), ve = N()(
|
|
615
661
|
M(
|
|
616
662
|
(n, r) => ({
|
|
617
663
|
// 공통 데이터 스토어에서 상태 가져오기
|
|
618
664
|
get codeData() {
|
|
619
|
-
return
|
|
665
|
+
return y.getState().codeData;
|
|
620
666
|
},
|
|
621
667
|
get isLoading() {
|
|
622
|
-
return
|
|
668
|
+
return y.getState().isLoading;
|
|
623
669
|
},
|
|
624
670
|
get error() {
|
|
625
|
-
return
|
|
671
|
+
return y.getState().error;
|
|
626
672
|
},
|
|
627
673
|
get lastUpdated() {
|
|
628
|
-
return
|
|
674
|
+
return y.getState().lastUpdated;
|
|
629
675
|
},
|
|
630
676
|
// 공통코드 가져오기 (중앙 스토어 사용)
|
|
631
677
|
fetchCommonCodes: async () => {
|
|
632
|
-
await
|
|
678
|
+
await y.getState().fetchData();
|
|
633
679
|
},
|
|
634
680
|
// 그룹코드와 옵션코드를 던졌을 때 상세코드의 옵션값을 리턴 (대규모 최적화)
|
|
635
681
|
getOptionValue: (e, s) => {
|
|
@@ -638,7 +684,7 @@ const E = (n) => (r) => {
|
|
|
638
684
|
const d = p.cacheHits.get(o) || 0;
|
|
639
685
|
return p.cacheHits.set(o, d + 1), p.optionCache.get(o);
|
|
640
686
|
}
|
|
641
|
-
const t =
|
|
687
|
+
const t = y.getState().codeData;
|
|
642
688
|
if (!t) return null;
|
|
643
689
|
const a = t[e];
|
|
644
690
|
if (a && a[s]) {
|
|
@@ -659,7 +705,7 @@ const E = (n) => (r) => {
|
|
|
659
705
|
},
|
|
660
706
|
// 공통코드 초기화
|
|
661
707
|
clearCodes: () => {
|
|
662
|
-
|
|
708
|
+
y.getState().clearData();
|
|
663
709
|
}
|
|
664
710
|
}),
|
|
665
711
|
{
|
|
@@ -669,25 +715,25 @@ const E = (n) => (r) => {
|
|
|
669
715
|
})
|
|
670
716
|
}
|
|
671
717
|
)
|
|
672
|
-
),
|
|
718
|
+
), Le = N()(
|
|
673
719
|
M(
|
|
674
720
|
(n, r) => ({
|
|
675
721
|
// 공통 데이터 스토어에서 상태 가져오기
|
|
676
722
|
get codeData() {
|
|
677
|
-
return
|
|
723
|
+
return y.getState().codeData;
|
|
678
724
|
},
|
|
679
725
|
get isLoading() {
|
|
680
|
-
return
|
|
726
|
+
return y.getState().isLoading;
|
|
681
727
|
},
|
|
682
728
|
get error() {
|
|
683
|
-
return
|
|
729
|
+
return y.getState().error;
|
|
684
730
|
},
|
|
685
731
|
get lastUpdated() {
|
|
686
|
-
return
|
|
732
|
+
return y.getState().lastUpdated;
|
|
687
733
|
},
|
|
688
734
|
// 공통코드 가져오기 (중앙 스토어 사용)
|
|
689
735
|
fetchCommonCodes: async () => {
|
|
690
|
-
await
|
|
736
|
+
await y.getState().fetchData();
|
|
691
737
|
},
|
|
692
738
|
// 코드를 던졌을 때 컬러코드를 리턴 (대규모 최적화)
|
|
693
739
|
getColorCode: (e) => {
|
|
@@ -695,7 +741,7 @@ const E = (n) => (r) => {
|
|
|
695
741
|
const o = p.cacheHits.get(`color_${e}`) || 0;
|
|
696
742
|
return p.cacheHits.set(`color_${e}`, o + 1), p.colorCache.get(e);
|
|
697
743
|
}
|
|
698
|
-
const s =
|
|
744
|
+
const s = y.getState().codeData;
|
|
699
745
|
if (!s) return null;
|
|
700
746
|
for (const o of Object.values(s))
|
|
701
747
|
for (const t of Object.values(o))
|
|
@@ -713,7 +759,7 @@ const E = (n) => (r) => {
|
|
|
713
759
|
const t = p.cacheHits.get(e) || 0;
|
|
714
760
|
return p.cacheHits.set(e, t + 1), p.optionCache.get(e);
|
|
715
761
|
}
|
|
716
|
-
const s =
|
|
762
|
+
const s = y.getState().codeData;
|
|
717
763
|
if (!s) return [];
|
|
718
764
|
const o = [];
|
|
719
765
|
return Object.values(s).forEach((t) => {
|
|
@@ -727,7 +773,7 @@ const E = (n) => (r) => {
|
|
|
727
773
|
},
|
|
728
774
|
// 공통코드 초기화
|
|
729
775
|
clearCodes: () => {
|
|
730
|
-
|
|
776
|
+
y.getState().clearData();
|
|
731
777
|
}
|
|
732
778
|
}),
|
|
733
779
|
{
|
|
@@ -749,11 +795,11 @@ const E = (n) => (r) => {
|
|
|
749
795
|
(s) => s.type === "M" && s.menuId === e
|
|
750
796
|
),
|
|
751
797
|
getPrntBkmkIdByMenuId: (e) => {
|
|
752
|
-
const s =
|
|
798
|
+
const s = D(r().nodes, e);
|
|
753
799
|
return s ? r().nodes[s]?.prntBkmkId ?? "-" : "-";
|
|
754
800
|
},
|
|
755
801
|
getNodeByMenuId: (e) => {
|
|
756
|
-
const s =
|
|
802
|
+
const s = D(r().nodes, e);
|
|
757
803
|
if (!s) return null;
|
|
758
804
|
const o = r().nodes[s];
|
|
759
805
|
return o?.type === "M" ? o : null;
|
|
@@ -778,7 +824,7 @@ const E = (n) => (r) => {
|
|
|
778
824
|
if (!(!s && o.loadedFor === e && Object.keys(o.nodes).length)) {
|
|
779
825
|
n({ loading: !0, error: void 0 });
|
|
780
826
|
try {
|
|
781
|
-
const t = await
|
|
827
|
+
const t = await b("SCMBKMK00101", { userId: e }), a = Array.isArray(t?.sub) ? t.sub : [], d = ce(a), c = P(
|
|
782
828
|
d.nodes,
|
|
783
829
|
d.rootIds
|
|
784
830
|
);
|
|
@@ -809,7 +855,7 @@ const E = (n) => (r) => {
|
|
|
809
855
|
},
|
|
810
856
|
// ====== 공통: 생성 ======
|
|
811
857
|
addNode: async (e) => {
|
|
812
|
-
const s =
|
|
858
|
+
const s = A(r()), o = pe();
|
|
813
859
|
n((t) => {
|
|
814
860
|
const a = e.sortOrdr ?? U(t, e.prntBkmkId), d = {
|
|
815
861
|
...t,
|
|
@@ -838,11 +884,11 @@ const E = (n) => (r) => {
|
|
|
838
884
|
rootIds: t.rootIds.slice(),
|
|
839
885
|
treeNodes: t.treeNodes
|
|
840
886
|
};
|
|
841
|
-
return le(d, o, e.prntBkmkId), d.treeNodes =
|
|
887
|
+
return le(d, o, e.prntBkmkId), d.treeNodes = P(d.nodes, d.rootIds), d;
|
|
842
888
|
});
|
|
843
889
|
try {
|
|
844
890
|
let t = o;
|
|
845
|
-
const a = U(r(), e.prntBkmkId), d = await
|
|
891
|
+
const a = U(r(), e.prntBkmkId), d = await b("SCMBKMK00102", {
|
|
846
892
|
iudFlag: "I",
|
|
847
893
|
type: e.type,
|
|
848
894
|
sysCd: e.sysCd,
|
|
@@ -859,7 +905,7 @@ const E = (n) => (r) => {
|
|
|
859
905
|
const i = ue(c, o, t);
|
|
860
906
|
return {
|
|
861
907
|
...i,
|
|
862
|
-
treeNodes:
|
|
908
|
+
treeNodes: P(i.nodes, i.rootIds)
|
|
863
909
|
};
|
|
864
910
|
}), t;
|
|
865
911
|
} catch (t) {
|
|
@@ -875,10 +921,10 @@ const E = (n) => (r) => {
|
|
|
875
921
|
if (!u || u.type !== "F")
|
|
876
922
|
throw new Error("부모는 폴더만 가능합니다.");
|
|
877
923
|
}
|
|
878
|
-
const l = i.prntBkmkId ?? "-",
|
|
924
|
+
const l = i.prntBkmkId ?? "-", h = l === "-" ? c : d[l].children ||= [];
|
|
879
925
|
{
|
|
880
|
-
const u =
|
|
881
|
-
u >= 0 &&
|
|
926
|
+
const u = h.indexOf(e);
|
|
927
|
+
u >= 0 && h.splice(u, 1);
|
|
882
928
|
}
|
|
883
929
|
const m = s === "-" ? c : d[s].children ||= [];
|
|
884
930
|
m.splice(
|
|
@@ -887,7 +933,7 @@ const E = (n) => (r) => {
|
|
|
887
933
|
e
|
|
888
934
|
), i.prntBkmkId = s, n({ nodes: d, rootIds: c }), z(d, c, s), z(d, c, l);
|
|
889
935
|
try {
|
|
890
|
-
await
|
|
936
|
+
await b("SCMBKMK00104", {
|
|
891
937
|
// 백엔드 명칭 호환
|
|
892
938
|
bkmkId: e,
|
|
893
939
|
prntBkmkId: s,
|
|
@@ -900,7 +946,7 @@ const E = (n) => (r) => {
|
|
|
900
946
|
},
|
|
901
947
|
// ====== 공통: 삭제 ======
|
|
902
948
|
removeNode: async (e) => {
|
|
903
|
-
const s =
|
|
949
|
+
const s = A(r());
|
|
904
950
|
n((o) => {
|
|
905
951
|
if (!o.nodes[e]) return o;
|
|
906
952
|
const t = {
|
|
@@ -909,17 +955,17 @@ const E = (n) => (r) => {
|
|
|
909
955
|
rootIds: o.rootIds.slice(),
|
|
910
956
|
treeNodes: o.treeNodes
|
|
911
957
|
};
|
|
912
|
-
return J(t, e), t.treeNodes =
|
|
958
|
+
return J(t, e), t.treeNodes = P(t.nodes, t.rootIds), t;
|
|
913
959
|
});
|
|
914
960
|
try {
|
|
915
|
-
await
|
|
961
|
+
await b("SCMBKMK00103", { bkmkId: e });
|
|
916
962
|
} catch (o) {
|
|
917
963
|
throw n(s), o;
|
|
918
964
|
}
|
|
919
965
|
},
|
|
920
966
|
// ====== 공통: 수정 ======
|
|
921
967
|
editNode: async ({ bkmkId: e, userId: s, bkmkNm: o, prntBkmkId: t, sortOrdr: a }) => {
|
|
922
|
-
const d =
|
|
968
|
+
const d = A(r());
|
|
923
969
|
n((c) => {
|
|
924
970
|
const i = { ...c, nodes: { ...c.nodes } }, l = i.nodes[e];
|
|
925
971
|
return l?.type === "F" && typeof o == "string" && (i.nodes[e] = {
|
|
@@ -928,7 +974,7 @@ const E = (n) => (r) => {
|
|
|
928
974
|
}), i;
|
|
929
975
|
});
|
|
930
976
|
try {
|
|
931
|
-
await
|
|
977
|
+
await b("SCMBKMK00102", {
|
|
932
978
|
iudFlag: "U",
|
|
933
979
|
userId: s,
|
|
934
980
|
bkmkId: e,
|
|
@@ -949,7 +995,7 @@ const E = (n) => (r) => {
|
|
|
949
995
|
sysCd: o,
|
|
950
996
|
userId: t
|
|
951
997
|
}),
|
|
952
|
-
addMenuToFolder: async (e, s) =>
|
|
998
|
+
addMenuToFolder: async (e, s) => D(r().nodes, s.menuId) ? "이미 북마크에 저장된 메뉴입니다." : await r().addNode({
|
|
953
999
|
type: "M",
|
|
954
1000
|
prntBkmkId: e,
|
|
955
1001
|
sysCd: "KH",
|
|
@@ -977,7 +1023,7 @@ const E = (n) => (r) => {
|
|
|
977
1023
|
});
|
|
978
1024
|
},
|
|
979
1025
|
removeMenuByMenuId: async (e) => {
|
|
980
|
-
const s = r(), o =
|
|
1026
|
+
const s = r(), o = D(s.nodes, e);
|
|
981
1027
|
o && await r().removeNode(o);
|
|
982
1028
|
},
|
|
983
1029
|
removeMenu: async (e) => {
|
|
@@ -1001,8 +1047,8 @@ const E = (n) => (r) => {
|
|
|
1001
1047
|
const i = e[c];
|
|
1002
1048
|
if (!i || t && i.type !== "F") return null;
|
|
1003
1049
|
if (i.type === "F") {
|
|
1004
|
-
const l = i,
|
|
1005
|
-
return a(l.bkmkNm) ||
|
|
1050
|
+
const l = i, h = (l.children || []).map((u) => d(u)).filter(Boolean);
|
|
1051
|
+
return a(l.bkmkNm) || h.length > 0 ? {
|
|
1006
1052
|
key: l.bkmkId,
|
|
1007
1053
|
type: "F",
|
|
1008
1054
|
title: `📁 ${l.bkmkNm}`,
|
|
@@ -1010,14 +1056,14 @@ const E = (n) => (r) => {
|
|
|
1010
1056
|
prntBkmkId: l.prntBkmkId,
|
|
1011
1057
|
sortOrdr: l.sortOrdr,
|
|
1012
1058
|
fullPath: l.fullPath,
|
|
1013
|
-
children:
|
|
1059
|
+
children: h.length ? h : void 0
|
|
1014
1060
|
} : null;
|
|
1015
1061
|
} else {
|
|
1016
|
-
const l = i,
|
|
1017
|
-
return a(
|
|
1062
|
+
const l = i, h = l.menuNm ? `${l.menuNm} (${l.menuId})` : l.menuId;
|
|
1063
|
+
return a(h) ? {
|
|
1018
1064
|
key: l.bkmkId,
|
|
1019
1065
|
type: "M",
|
|
1020
|
-
title: `📄 ${
|
|
1066
|
+
title: `📄 ${h}`,
|
|
1021
1067
|
prntBkmkId: l.prntBkmkId,
|
|
1022
1068
|
sortOrdr: l.sortOrdr,
|
|
1023
1069
|
fullPath: l.fullPath,
|
|
@@ -1027,7 +1073,7 @@ const E = (n) => (r) => {
|
|
|
1027
1073
|
};
|
|
1028
1074
|
return s.map(d).filter(Boolean);
|
|
1029
1075
|
}
|
|
1030
|
-
}), q =
|
|
1076
|
+
}), q = N(de);
|
|
1031
1077
|
function ce(n) {
|
|
1032
1078
|
const r = {}, e = [], s = (o) => {
|
|
1033
1079
|
o.forEach((t) => {
|
|
@@ -1067,7 +1113,7 @@ function ce(n) {
|
|
|
1067
1113
|
);
|
|
1068
1114
|
}), { nodes: r, rootIds: e };
|
|
1069
1115
|
}
|
|
1070
|
-
function
|
|
1116
|
+
function A(n) {
|
|
1071
1117
|
return {
|
|
1072
1118
|
...n,
|
|
1073
1119
|
nodes: JSON.parse(JSON.stringify(n.nodes)),
|
|
@@ -1131,7 +1177,7 @@ function ue(n, r, e) {
|
|
|
1131
1177
|
function x(n) {
|
|
1132
1178
|
return n.rootIds.find((r) => n.nodes[r]?.type === "F") ?? null;
|
|
1133
1179
|
}
|
|
1134
|
-
function
|
|
1180
|
+
function P(n, r) {
|
|
1135
1181
|
const e = {};
|
|
1136
1182
|
Object.values(n).forEach((c) => {
|
|
1137
1183
|
const i = c.bkmkId, l = c.prntBkmkId;
|
|
@@ -1144,12 +1190,12 @@ function D(n, r) {
|
|
|
1144
1190
|
s.add(c);
|
|
1145
1191
|
try {
|
|
1146
1192
|
if (i.type === "F") {
|
|
1147
|
-
const
|
|
1193
|
+
const h = i, m = e[c] ?? [];
|
|
1148
1194
|
return {
|
|
1149
1195
|
type: "F",
|
|
1150
1196
|
bkmkId: c,
|
|
1151
|
-
bkmkNm:
|
|
1152
|
-
prntBkmkId:
|
|
1197
|
+
bkmkNm: h.bkmkNm,
|
|
1198
|
+
prntBkmkId: h.prntBkmkId,
|
|
1153
1199
|
children: m.map(o).filter(Boolean)
|
|
1154
1200
|
};
|
|
1155
1201
|
}
|
|
@@ -1170,7 +1216,7 @@ function D(n, r) {
|
|
|
1170
1216
|
/* @__PURE__ */ new Set([...r, ...t, ...a])
|
|
1171
1217
|
).map(o).filter(Boolean);
|
|
1172
1218
|
}
|
|
1173
|
-
function
|
|
1219
|
+
function D(n, r) {
|
|
1174
1220
|
for (const e of Object.values(n))
|
|
1175
1221
|
if (e.type === "M" && e.menuId === r) return e.bkmkId;
|
|
1176
1222
|
return null;
|
|
@@ -1181,7 +1227,7 @@ function z(n, r, e) {
|
|
|
1181
1227
|
a && (a.sortOrdr = t);
|
|
1182
1228
|
});
|
|
1183
1229
|
}
|
|
1184
|
-
const
|
|
1230
|
+
const E = {
|
|
1185
1231
|
DEFAULT_PRNT_GBCD: 1
|
|
1186
1232
|
}, me = (n) => n && typeof n == "object" && typeof n.menuId == "string" && typeof n.menuNm == "string", j = (n) => Array.isArray(n) && n.every(me);
|
|
1187
1233
|
let B = [], Y = [];
|
|
@@ -1192,7 +1238,7 @@ const Ce = (n) => {
|
|
|
1192
1238
|
if (j(n)) return n;
|
|
1193
1239
|
}
|
|
1194
1240
|
return console.warn("⚠️ 메뉴 응답이 비어있거나 예상과 다릅니다."), [];
|
|
1195
|
-
},
|
|
1241
|
+
}, fe = (n, r) => !!r && n.crprCd === r.crprCd && n.userId === r.userId && (n.prntGbcd ?? E.DEFAULT_PRNT_GBCD) === (r.prntGbcd ?? E.DEFAULT_PRNT_GBCD), he = (n) => {
|
|
1196
1242
|
if (B.length === n.length && B.every(
|
|
1197
1243
|
(t, a) => t.menuId === n[a]?.menuId && t.menuPrntId === n[a]?.menuPrntId
|
|
1198
1244
|
))
|
|
@@ -1208,7 +1254,7 @@ const Ce = (n) => {
|
|
|
1208
1254
|
children: a.children && a.children.length ? s(a.children) : void 0
|
|
1209
1255
|
})), o = s(e);
|
|
1210
1256
|
return B = [...n], Y = o, o;
|
|
1211
|
-
}, R =
|
|
1257
|
+
}, R = N((n, r) => ({
|
|
1212
1258
|
// 📊 초기 상태값
|
|
1213
1259
|
menuList: [],
|
|
1214
1260
|
flatMenuList: [],
|
|
@@ -1221,15 +1267,15 @@ const Ce = (n) => {
|
|
|
1221
1267
|
const t = {
|
|
1222
1268
|
crprCd: e,
|
|
1223
1269
|
userId: s,
|
|
1224
|
-
prntGbcd: o ??
|
|
1270
|
+
prntGbcd: o ?? E.DEFAULT_PRNT_GBCD
|
|
1225
1271
|
};
|
|
1226
|
-
if (
|
|
1272
|
+
if (fe(t, r()._lastFetchParams)) {
|
|
1227
1273
|
console.log("✅ 중복 fetch 차단", t);
|
|
1228
1274
|
return;
|
|
1229
1275
|
}
|
|
1230
1276
|
n({ isLoading: !0, error: null, _lastFetchParams: t });
|
|
1231
1277
|
try {
|
|
1232
|
-
const a = await
|
|
1278
|
+
const a = await b(F("AUTH_MENU"), t), d = Ce(a), c = he(d);
|
|
1233
1279
|
n({
|
|
1234
1280
|
flatMenuList: d,
|
|
1235
1281
|
// 평면 리스트 저장
|
|
@@ -1258,19 +1304,21 @@ const Ce = (n) => {
|
|
|
1258
1304
|
const { flatMenuList: s } = r();
|
|
1259
1305
|
return s.find((o) => o.menuId === e) ?? null;
|
|
1260
1306
|
}
|
|
1261
|
-
})),
|
|
1307
|
+
})), O = {
|
|
1262
1308
|
MAX_TABS: 15
|
|
1263
|
-
}, Z =
|
|
1309
|
+
}, Z = N((n, r) => ({
|
|
1264
1310
|
// 📊 초기 상태값
|
|
1265
1311
|
activeMenuId: null,
|
|
1266
1312
|
activeMenuItem: null,
|
|
1267
1313
|
activeDetailItem: null,
|
|
1268
1314
|
tabs: [],
|
|
1269
1315
|
sidebarCollapsed: !1,
|
|
1270
|
-
maxTabs:
|
|
1316
|
+
maxTabs: O.MAX_TABS,
|
|
1271
1317
|
tabProtectFlag: {},
|
|
1272
1318
|
tabParams: {},
|
|
1273
1319
|
componentLabelMap: {},
|
|
1320
|
+
pinnedTabs: /* @__PURE__ */ new Set(),
|
|
1321
|
+
refreshTabKey: {},
|
|
1274
1322
|
clearMenuViewStore: () => {
|
|
1275
1323
|
n({
|
|
1276
1324
|
activeMenuId: null,
|
|
@@ -1278,10 +1326,12 @@ const Ce = (n) => {
|
|
|
1278
1326
|
activeDetailItem: null,
|
|
1279
1327
|
tabs: [],
|
|
1280
1328
|
sidebarCollapsed: !1,
|
|
1281
|
-
maxTabs:
|
|
1329
|
+
maxTabs: O.MAX_TABS,
|
|
1282
1330
|
tabProtectFlag: {},
|
|
1283
1331
|
tabParams: {},
|
|
1284
|
-
componentLabelMap: {}
|
|
1332
|
+
componentLabelMap: {},
|
|
1333
|
+
pinnedTabs: /* @__PURE__ */ new Set(),
|
|
1334
|
+
refreshTabKey: {}
|
|
1285
1335
|
});
|
|
1286
1336
|
},
|
|
1287
1337
|
// 🔧 탭 추가 (메뉴 아이템 객체로)
|
|
@@ -1289,11 +1339,11 @@ const Ce = (n) => {
|
|
|
1289
1339
|
openTabFromMenu: (e, s) => {
|
|
1290
1340
|
const { tabs: o } = r(), t = o.find((d) => d.key === e.menuId), a = o.find((d) => d.key === e.menuId);
|
|
1291
1341
|
if (t)
|
|
1292
|
-
a != null ? (n({ activeMenuId: e.menuId, activeMenuItem: e }), r().setTabParams(e.menuId, s || {}), e?.prsnInfoYn === "Y" && r().setProtectFlagForKey(e.menuId)) :
|
|
1342
|
+
a != null ? (n({ activeMenuId: e.menuId, activeMenuItem: e }), r().setTabParams(e.menuId, s || {}), e?.prsnInfoYn === "Y" && r().setProtectFlagForKey(e.menuId)) : w.warning("유효하지 않은 메뉴정보입니다.");
|
|
1293
1343
|
else {
|
|
1294
|
-
if (o.length >
|
|
1295
|
-
console.warn("❌ 최대 탭 개수를 초과했습니다."),
|
|
1296
|
-
`최대 ${
|
|
1344
|
+
if (o.length > O.MAX_TABS) {
|
|
1345
|
+
console.warn("❌ 최대 탭 개수를 초과했습니다."), w.warning(
|
|
1346
|
+
`최대 ${O.MAX_TABS}개의 탭만 열 수 있습니다.
|
|
1297
1347
|
기존 탭을 닫고 다시 시도해주세요.`
|
|
1298
1348
|
);
|
|
1299
1349
|
return;
|
|
@@ -1319,7 +1369,7 @@ const Ce = (n) => {
|
|
|
1319
1369
|
// URL 파라미터로 메뉴 열기 시 사용 (예: ?menuId=CM000301)
|
|
1320
1370
|
openTabByMenuId: (e, s) => {
|
|
1321
1371
|
const o = R.getState().findMenuById(e);
|
|
1322
|
-
o ? r().openTabFromMenu(o, s) :
|
|
1372
|
+
o ? r().openTabFromMenu(o, s) : w.warning("메뉴 ID를 찾을 수 없습니다.");
|
|
1323
1373
|
},
|
|
1324
1374
|
openDetailView: (e, s, o) => {
|
|
1325
1375
|
const { tabs: t } = r();
|
|
@@ -1349,17 +1399,19 @@ const Ce = (n) => {
|
|
|
1349
1399
|
// 🔧 탭 제거
|
|
1350
1400
|
// X 버튼 클릭 시 탭을 닫고 관련 상태도 정리
|
|
1351
1401
|
closeTab: (e) => {
|
|
1352
|
-
const { tabs: s, activeMenuId: o } = r();
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1402
|
+
const { tabs: s, activeMenuId: o, pinnedTabs: t } = r();
|
|
1403
|
+
if (t.has(e))
|
|
1404
|
+
return;
|
|
1405
|
+
s.find((c) => c.key === e);
|
|
1406
|
+
const a = s.filter((c) => c.key !== e);
|
|
1407
|
+
let d = o;
|
|
1356
1408
|
if (o === e) {
|
|
1357
|
-
const
|
|
1358
|
-
|
|
1409
|
+
const c = s.findIndex((i) => i.key === e);
|
|
1410
|
+
d = a.length ? a[Math.min(c, a.length - 1)]?.key ?? null : null;
|
|
1359
1411
|
}
|
|
1360
1412
|
n({
|
|
1361
|
-
tabs:
|
|
1362
|
-
}),
|
|
1413
|
+
tabs: a
|
|
1414
|
+
}), d && r().focusTab(d);
|
|
1363
1415
|
},
|
|
1364
1416
|
// 🔧 활성 탭 변경
|
|
1365
1417
|
// 탭 헤더 클릭 시 해당 탭으로 전환
|
|
@@ -1423,8 +1475,36 @@ const Ce = (n) => {
|
|
|
1423
1475
|
};
|
|
1424
1476
|
}),
|
|
1425
1477
|
// 컴포넌트 라벨 맵 설정
|
|
1426
|
-
setComponentLabelMap: (e, s) => n({ componentLabelMap: e })
|
|
1427
|
-
|
|
1478
|
+
setComponentLabelMap: (e, s) => n({ componentLabelMap: e }),
|
|
1479
|
+
// 탭 고정 토글
|
|
1480
|
+
togglePinTab: (e) => n((s) => {
|
|
1481
|
+
const o = new Set(s.pinnedTabs);
|
|
1482
|
+
return o.has(e) ? o.delete(e) : o.add(e), { pinnedTabs: o };
|
|
1483
|
+
}),
|
|
1484
|
+
// 탭 새로고침 (ContentContainer 재적재를 위한 키 변경)
|
|
1485
|
+
refreshTab: (e) => n((s) => ({
|
|
1486
|
+
refreshTabKey: {
|
|
1487
|
+
...s.refreshTabKey,
|
|
1488
|
+
[e]: Date.now()
|
|
1489
|
+
}
|
|
1490
|
+
})),
|
|
1491
|
+
// 다른 탭 닫기
|
|
1492
|
+
closeOtherTabs: (e) => {
|
|
1493
|
+
const { tabs: s, activeMenuId: o } = r();
|
|
1494
|
+
if (!s.find((c) => c.key === e)) return;
|
|
1495
|
+
const a = r().pinnedTabs;
|
|
1496
|
+
s.filter(
|
|
1497
|
+
(c) => c.key !== e && !a.has(c.key)
|
|
1498
|
+
).forEach((c) => r().closeTab(c.key)), o !== e && r().focusTab(e);
|
|
1499
|
+
},
|
|
1500
|
+
// 우측 탭 닫기
|
|
1501
|
+
closeRightTabs: (e) => {
|
|
1502
|
+
const { tabs: s } = r(), o = s.findIndex((d) => d.key === e);
|
|
1503
|
+
if (o < 0) return;
|
|
1504
|
+
const t = r().pinnedTabs;
|
|
1505
|
+
s.slice(o + 1).filter((d) => !t.has(d.key)).forEach((d) => r().closeTab(d.key));
|
|
1506
|
+
}
|
|
1507
|
+
})), ye = N((n, r) => ({
|
|
1428
1508
|
popups: [],
|
|
1429
1509
|
activePopupId: null,
|
|
1430
1510
|
isLoading: !1,
|
|
@@ -1435,7 +1515,7 @@ const Ce = (n) => {
|
|
|
1435
1515
|
n({ isLoading: !0, error: null });
|
|
1436
1516
|
try {
|
|
1437
1517
|
let t = null;
|
|
1438
|
-
const a = await
|
|
1518
|
+
const a = await b(F("SRCH_POPU"), {
|
|
1439
1519
|
crprCd: ee()?.crprCd,
|
|
1440
1520
|
popuCd: e
|
|
1441
1521
|
});
|
|
@@ -1445,7 +1525,7 @@ const Ce = (n) => {
|
|
|
1445
1525
|
const u = `팝업 정보를 찾을 수 없습니다: ${e}`;
|
|
1446
1526
|
throw console.error(u), new Error(u);
|
|
1447
1527
|
}
|
|
1448
|
-
const i = ((u) => `/src/pages/views/popup/${u}`)(t.popuUrl), l = r().zIndexSeed + 1,
|
|
1528
|
+
const i = ((u) => `/src/pages/views/popup/${u}`)(t.popuUrl), l = r().zIndexSeed + 1, h = {
|
|
1449
1529
|
popupId: `popup_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
|
|
1450
1530
|
popupCode: e,
|
|
1451
1531
|
//config.title을 통해 팝업 제목 변경 가능
|
|
@@ -1472,8 +1552,8 @@ const Ce = (n) => {
|
|
|
1472
1552
|
return;
|
|
1473
1553
|
}
|
|
1474
1554
|
n((u) => ({
|
|
1475
|
-
popups: [...u.popups,
|
|
1476
|
-
activePopupId:
|
|
1555
|
+
popups: [...u.popups, h],
|
|
1556
|
+
activePopupId: h.popupId,
|
|
1477
1557
|
isLoading: !1,
|
|
1478
1558
|
zIndexSeed: l
|
|
1479
1559
|
}));
|
|
@@ -1499,19 +1579,19 @@ const Ce = (n) => {
|
|
|
1499
1579
|
const m = r().zIndexSeed + 1;
|
|
1500
1580
|
n({ activePopupId: l.popupId, zIndexSeed: m }), n((u) => ({
|
|
1501
1581
|
popups: u.popups.map(
|
|
1502
|
-
(
|
|
1503
|
-
...
|
|
1582
|
+
(f) => f.popupId === l.popupId ? {
|
|
1583
|
+
...f,
|
|
1504
1584
|
config: c,
|
|
1505
1585
|
zIndex: m,
|
|
1506
1586
|
close: () => {
|
|
1507
1587
|
r().closePopup(l.popupId);
|
|
1508
1588
|
}
|
|
1509
|
-
} :
|
|
1589
|
+
} : f
|
|
1510
1590
|
)
|
|
1511
1591
|
}));
|
|
1512
1592
|
return;
|
|
1513
1593
|
}
|
|
1514
|
-
const
|
|
1594
|
+
const h = {
|
|
1515
1595
|
popupId: o,
|
|
1516
1596
|
popupCode: e,
|
|
1517
1597
|
popupTitle: c.title || e,
|
|
@@ -1531,7 +1611,7 @@ const Ce = (n) => {
|
|
|
1531
1611
|
}
|
|
1532
1612
|
};
|
|
1533
1613
|
n((m) => ({
|
|
1534
|
-
popups: [...m.popups,
|
|
1614
|
+
popups: [...m.popups, h],
|
|
1535
1615
|
activePopupId: o,
|
|
1536
1616
|
zIndexSeed: t
|
|
1537
1617
|
}));
|
|
@@ -1571,7 +1651,7 @@ const Ce = (n) => {
|
|
|
1571
1651
|
)
|
|
1572
1652
|
}));
|
|
1573
1653
|
}
|
|
1574
|
-
})), V =
|
|
1654
|
+
})), V = N()(
|
|
1575
1655
|
M(
|
|
1576
1656
|
(n, r) => ({
|
|
1577
1657
|
systemMap: [],
|
|
@@ -1980,7 +2060,7 @@ const Ce = (n) => {
|
|
|
1980
2060
|
// localStorage key
|
|
1981
2061
|
}
|
|
1982
2062
|
)
|
|
1983
|
-
),
|
|
2063
|
+
), Pe = N((n) => ({
|
|
1984
2064
|
requestCount: 0,
|
|
1985
2065
|
loading: !1,
|
|
1986
2066
|
showLoading: () => n((r) => {
|
|
@@ -1991,7 +2071,7 @@ const Ce = (n) => {
|
|
|
1991
2071
|
const e = Math.max(0, r.requestCount - 1);
|
|
1992
2072
|
return { requestCount: e, loading: e > 0 };
|
|
1993
2073
|
})
|
|
1994
|
-
})),
|
|
2074
|
+
})), De = N((n) => ({
|
|
1995
2075
|
requestCount: 0,
|
|
1996
2076
|
loading: !1,
|
|
1997
2077
|
showLoading: () => n((r) => {
|
|
@@ -2003,40 +2083,40 @@ const Ce = (n) => {
|
|
|
2003
2083
|
return { requestCount: e, loading: e > 0 };
|
|
2004
2084
|
})
|
|
2005
2085
|
}));
|
|
2006
|
-
function
|
|
2086
|
+
function Ie() {
|
|
2007
2087
|
const [n, r] = X(!1), e = W((s) => {
|
|
2008
2088
|
const o = s?.getModifierState?.("CapsLock");
|
|
2009
2089
|
typeof o == "boolean" && r(o);
|
|
2010
2090
|
}, []);
|
|
2011
2091
|
return { capsOn: n, onKeyDown: e };
|
|
2012
2092
|
}
|
|
2013
|
-
function
|
|
2093
|
+
function Oe(n) {
|
|
2014
2094
|
const {
|
|
2015
2095
|
loginApi: r,
|
|
2016
2096
|
fetchCommonCodes: e,
|
|
2017
2097
|
onAfterLogin: s,
|
|
2018
2098
|
onError: o,
|
|
2019
2099
|
rememberCookie: t = { enabled: !0, days: 30 }
|
|
2020
|
-
} = n, [a, d] = X(!1), { capsOn: c, onKeyDown: i } =
|
|
2021
|
-
id: t?.enabled ? te(
|
|
2100
|
+
} = n, [a, d] = X(!1), { capsOn: c, onKeyDown: i } = Ie(), l = "SCMSIGN00101", h = `${__SYS_CD__}_login_id`, m = {
|
|
2101
|
+
id: t?.enabled ? te(h) : void 0,
|
|
2022
2102
|
pswr: void 0
|
|
2023
2103
|
}, u = W(
|
|
2024
|
-
async (
|
|
2104
|
+
async (f, C) => {
|
|
2025
2105
|
d(!0);
|
|
2026
2106
|
try {
|
|
2027
2107
|
const g = {
|
|
2028
2108
|
crprCd: "100",
|
|
2029
|
-
id:
|
|
2030
|
-
pswr: await oe(
|
|
2031
|
-
},
|
|
2032
|
-
if (
|
|
2033
|
-
if (H.getState().setLoginUser(
|
|
2109
|
+
id: f.id,
|
|
2110
|
+
pswr: await oe(f.pswr)
|
|
2111
|
+
}, I = await (r ?? ((S) => b(l, S)))(g);
|
|
2112
|
+
if (I?.userInfo?.userId) {
|
|
2113
|
+
if (H.getState().setLoginUser(I.userInfo, I?.hrInfo), t?.enabled) {
|
|
2034
2114
|
const S = t.days ?? 30;
|
|
2035
|
-
|
|
2115
|
+
f.remember ? $(h, f.id ?? "", S) : $(h, "", 0);
|
|
2036
2116
|
}
|
|
2037
|
-
return e ? await e() : await G.getState().fetchCommonCodes(), s ? s(
|
|
2117
|
+
return e ? await e() : await G.getState().fetchCommonCodes(), s ? s(I, C) : (w.success(`${I.userInfo.userNm}님 환영합니다.`), C("/main")), { user: I.userInfo, response: I };
|
|
2038
2118
|
} else
|
|
2039
|
-
throw o?.({ user:
|
|
2119
|
+
throw o?.({ user: I.userInfo, response: I, navigate: C }), new Error("사용자 정보가 유효하지 않습니다.");
|
|
2040
2120
|
} catch (g) {
|
|
2041
2121
|
throw o?.(g), g;
|
|
2042
2122
|
} finally {
|
|
@@ -2061,33 +2141,33 @@ function Fe(n) {
|
|
|
2061
2141
|
doLogin: u
|
|
2062
2142
|
};
|
|
2063
2143
|
}
|
|
2064
|
-
function
|
|
2144
|
+
function we() {
|
|
2065
2145
|
const n = ne();
|
|
2066
2146
|
return () => {
|
|
2067
2147
|
H.getState().clearLoginUser(), V.getState().clearSystemMap(), G.getState().clearCodes(), R.getState().clearMenu(), Z.getState().clearMenuViewStore(), q.getState().clearFavorites(), n("/login");
|
|
2068
2148
|
};
|
|
2069
2149
|
}
|
|
2070
|
-
const
|
|
2150
|
+
const Fe = () => G.getState(), _e = () => ye.getState(), Te = () => H.getState(), Ae = () => q.getState(), Be = () => R.getState(), Ke = () => Z.getState(), Ee = () => V.getState();
|
|
2071
2151
|
export {
|
|
2072
|
-
|
|
2073
|
-
|
|
2152
|
+
Ie as useCapsLock,
|
|
2153
|
+
Fe as useCode,
|
|
2074
2154
|
G as useCodeStore,
|
|
2075
|
-
|
|
2076
|
-
|
|
2155
|
+
Le as useColorStore,
|
|
2156
|
+
Ae as useFavorite,
|
|
2077
2157
|
q as useFavoriteStore,
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2158
|
+
Pe as useLoadingStore,
|
|
2159
|
+
Oe as useLogin,
|
|
2160
|
+
we as useLogout,
|
|
2081
2161
|
Be as useMenuModel,
|
|
2082
2162
|
R as useMenuModelStore,
|
|
2083
|
-
|
|
2163
|
+
Ke as useMenuView,
|
|
2084
2164
|
Z as useMenuViewStore,
|
|
2085
2165
|
ve as useOptionStore,
|
|
2086
|
-
|
|
2166
|
+
De as usePopupLoadingStore,
|
|
2087
2167
|
_e as usePopupState,
|
|
2088
|
-
|
|
2089
|
-
|
|
2168
|
+
ye as usePopupStore,
|
|
2169
|
+
Ee as useSystemCode,
|
|
2090
2170
|
V as useSystemStore,
|
|
2091
|
-
|
|
2171
|
+
Te as useUser,
|
|
2092
2172
|
H as useUserStore
|
|
2093
2173
|
};
|