@bwg-ui/core 1.2.7 → 1.2.9
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/README.md +28 -0
- package/dist/chunks/MenuReport-CuAfCZbc.cjs +1 -0
- package/dist/chunks/MenuReport-iuRC_snf.js +1244 -0
- package/dist/chunks/{common-components-BiUtYMIt.js → common-components-CFIJNFN0.js} +6704 -7999
- package/dist/chunks/common-components-CioS_8Bi.cjs +183 -0
- package/dist/chunks/{core-CF_HWm44.cjs → core-CA7iRgyb.cjs} +1 -1
- package/dist/chunks/{core-Cb5dF0QU.js → core-D18HD1It.js} +1 -1
- package/dist/chunks/{enc-base64-Dy-3zKzn.js → enc-base64-CdWu8KMI.js} +2 -2
- package/dist/chunks/{enc-base64-CAxIzedh.cjs → enc-base64-DSIiAsI5.cjs} +1 -1
- package/dist/chunks/layout-components-C-9ATcL9.js +1616 -0
- package/dist/chunks/layout-components-DMR4tl9_.cjs +35 -0
- package/dist/chunks/{sha256-DbQnwvPn.cjs → sha256-D5iKSlK6.cjs} +1 -1
- package/dist/chunks/{sha256-DKma8qua.js → sha256-DQcqzuys.js} +2 -2
- package/dist/components/common/ButtonAccessController.d.ts +5 -0
- package/dist/components/common/ButtonAccessController.d.ts.map +1 -0
- package/dist/components/common/BwgEditor.d.ts +3 -3
- package/dist/components/common/BwgEditor.d.ts.map +1 -1
- package/dist/components/common/BwgPopup.d.ts +15 -0
- package/dist/components/common/BwgPopup.d.ts.map +1 -1
- package/dist/components/common/BwgView.d.ts +2 -23
- package/dist/components/common/BwgView.d.ts.map +1 -1
- package/dist/components/common/SearchBox.d.ts +1 -57
- package/dist/components/common/SearchBox.d.ts.map +1 -1
- package/dist/components/common/index.cjs +1 -1
- package/dist/components/common/index.d.ts +5 -3
- package/dist/components/common/index.d.ts.map +1 -1
- package/dist/components/common/index.js +24 -23
- package/dist/components/common/type.d.ts +132 -0
- package/dist/components/common/type.d.ts.map +1 -0
- 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/default/LocalPopupContainer.d.ts +3 -0
- package/dist/components/layout/default/LocalPopupContainer.d.ts.map +1 -0
- package/dist/components/layout/default/PopupContainer.d.ts.map +1 -1
- package/dist/components/layout/index.cjs +1 -35
- package/dist/components/layout/index.js +13 -1558
- package/dist/components/popup/MenuReport.d.ts +2 -5
- package/dist/components/popup/MenuReport.d.ts.map +1 -1
- package/dist/components/popup/SearchDepartmentP01.d.ts +4 -5
- package/dist/components/popup/SearchDepartmentP01.d.ts.map +1 -1
- package/dist/components/popup/SearchDepartmentP02.d.ts +3 -5
- package/dist/components/popup/SearchDepartmentP02.d.ts.map +1 -1
- package/dist/components/popup/SearchEmployeeP01.d.ts +3 -1
- package/dist/components/popup/SearchEmployeeP01.d.ts.map +1 -1
- package/dist/components/popup/SearchEmployeeP02.d.ts +3 -1
- package/dist/components/popup/SearchEmployeeP02.d.ts.map +1 -1
- package/dist/components/popup/SearchOrganizationP01.d.ts +2 -4
- package/dist/components/popup/SearchOrganizationP01.d.ts.map +1 -1
- package/dist/components/popup/SearchOrganizationP02.d.ts +3 -4
- package/dist/components/popup/SearchOrganizationP02.d.ts.map +1 -1
- package/dist/components/popup/config/localPopupRegistry.d.ts +8 -0
- package/dist/components/popup/config/localPopupRegistry.d.ts.map +1 -0
- package/dist/components/popup/index.cjs +1 -1
- package/dist/components/popup/index.d.ts +2 -4
- package/dist/components/popup/index.d.ts.map +1 -1
- package/dist/components/popup/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +238 -217
- package/dist/provider/hooks/usePopup.d.ts +2 -1
- package/dist/provider/hooks/usePopup.d.ts.map +1 -1
- package/dist/provider/index.cjs +1 -1
- package/dist/provider/index.js +205 -188
- package/dist/stores/index.cjs +2 -2
- package/dist/stores/index.js +265 -196
- package/dist/stores/popupStore.d.ts +17 -1
- package/dist/stores/popupStore.d.ts.map +1 -1
- package/dist/stores/userStore.d.ts +16 -2
- package/dist/stores/userStore.d.ts.map +1 -1
- package/dist/utils/commonUtils.d.ts +77 -6
- package/dist/utils/commonUtils.d.ts.map +1 -1
- package/dist/utils/gwUtils.d.ts +23 -0
- package/dist/utils/gwUtils.d.ts.map +1 -0
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.ts +27 -8
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +770 -619
- package/dist/utils/userUtils.d.ts +6 -0
- package/dist/utils/userUtils.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/chunks/common-components-DyOLtUJx.cjs +0 -183
package/dist/stores/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { create as
|
|
2
|
-
import { callService as v, getServiceCode as E, getUserId as N, getUserInfo as
|
|
3
|
-
import { message as
|
|
1
|
+
import { create as b } from "zustand";
|
|
2
|
+
import { callService as v, getServiceCode as E, getUserId as N, getUserInfo as K } from "../utils/index.js";
|
|
3
|
+
import { message as O } from "antd";
|
|
4
|
+
import { l as Y } from "../chunks/layout-components-C-9ATcL9.js";
|
|
4
5
|
function q(r, s) {
|
|
5
6
|
let e;
|
|
6
7
|
try {
|
|
@@ -39,14 +40,14 @@ const H = (r) => (s) => {
|
|
|
39
40
|
}
|
|
40
41
|
};
|
|
41
42
|
}
|
|
42
|
-
},
|
|
43
|
+
}, J = (r, s) => (e, n, o) => {
|
|
43
44
|
let t = {
|
|
44
45
|
storage: q(() => localStorage),
|
|
45
|
-
partialize: (
|
|
46
|
+
partialize: (h) => h,
|
|
46
47
|
version: 0,
|
|
47
|
-
merge: (
|
|
48
|
-
...
|
|
49
|
-
...
|
|
48
|
+
merge: (h, y) => ({
|
|
49
|
+
...y,
|
|
50
|
+
...h
|
|
50
51
|
}),
|
|
51
52
|
...s
|
|
52
53
|
}, a = !1;
|
|
@@ -54,37 +55,37 @@ const H = (r) => (s) => {
|
|
|
54
55
|
let u = t.storage;
|
|
55
56
|
if (!u)
|
|
56
57
|
return r(
|
|
57
|
-
(...
|
|
58
|
+
(...h) => {
|
|
58
59
|
console.warn(
|
|
59
60
|
`[zustand persist middleware] Unable to update item '${t.name}', the given storage is currently unavailable.`
|
|
60
|
-
), e(...
|
|
61
|
+
), e(...h);
|
|
61
62
|
},
|
|
62
63
|
n,
|
|
63
64
|
o
|
|
64
65
|
);
|
|
65
66
|
const i = () => {
|
|
66
|
-
const
|
|
67
|
+
const h = t.partialize({ ...n() });
|
|
67
68
|
return u.setItem(t.name, {
|
|
68
|
-
state:
|
|
69
|
+
state: h,
|
|
69
70
|
version: t.version
|
|
70
71
|
});
|
|
71
|
-
},
|
|
72
|
-
o.setState = (
|
|
73
|
-
const
|
|
74
|
-
(...
|
|
72
|
+
}, f = o.setState;
|
|
73
|
+
o.setState = (h, y) => (f(h, y), i());
|
|
74
|
+
const m = r(
|
|
75
|
+
(...h) => (e(...h), i()),
|
|
75
76
|
n,
|
|
76
77
|
o
|
|
77
78
|
);
|
|
78
|
-
o.getInitialState = () =>
|
|
79
|
-
let
|
|
79
|
+
o.getInitialState = () => m;
|
|
80
|
+
let p;
|
|
80
81
|
const I = () => {
|
|
81
|
-
var
|
|
82
|
+
var h, y;
|
|
82
83
|
if (!u) return;
|
|
83
84
|
a = !1, c.forEach((C) => {
|
|
84
85
|
var k;
|
|
85
|
-
return C((k = n()) != null ? k :
|
|
86
|
+
return C((k = n()) != null ? k : m);
|
|
86
87
|
});
|
|
87
|
-
const M = ((
|
|
88
|
+
const M = ((y = t.onRehydrateStorage) == null ? void 0 : y.call(t, (h = n()) != null ? h : m)) || void 0;
|
|
88
89
|
return H(u.getItem.bind(u))(t.name).then((C) => {
|
|
89
90
|
if (C)
|
|
90
91
|
if (typeof C.version == "number" && C.version !== t.version) {
|
|
@@ -93,7 +94,7 @@ const H = (r) => (s) => {
|
|
|
93
94
|
C.state,
|
|
94
95
|
C.version
|
|
95
96
|
);
|
|
96
|
-
return k instanceof Promise ? k.then((
|
|
97
|
+
return k instanceof Promise ? k.then((L) => [!0, L]) : [!0, k];
|
|
97
98
|
}
|
|
98
99
|
console.error(
|
|
99
100
|
"State loaded from storage couldn't be migrated since no migrate function was provided"
|
|
@@ -103,24 +104,24 @@ const H = (r) => (s) => {
|
|
|
103
104
|
return [!1, void 0];
|
|
104
105
|
}).then((C) => {
|
|
105
106
|
var k;
|
|
106
|
-
const [
|
|
107
|
-
if (
|
|
108
|
-
|
|
109
|
-
(k = n()) != null ? k :
|
|
110
|
-
), e(
|
|
107
|
+
const [L, R] = C;
|
|
108
|
+
if (p = t.merge(
|
|
109
|
+
R,
|
|
110
|
+
(k = n()) != null ? k : m
|
|
111
|
+
), e(p, !0), L)
|
|
111
112
|
return i();
|
|
112
113
|
}).then(() => {
|
|
113
|
-
M?.(
|
|
114
|
+
M?.(p, void 0), p = n(), a = !0, d.forEach((C) => C(p));
|
|
114
115
|
}).catch((C) => {
|
|
115
116
|
M?.(void 0, C);
|
|
116
117
|
});
|
|
117
118
|
};
|
|
118
119
|
return o.persist = {
|
|
119
|
-
setOptions: (
|
|
120
|
+
setOptions: (h) => {
|
|
120
121
|
t = {
|
|
121
122
|
...t,
|
|
122
|
-
...
|
|
123
|
-
},
|
|
123
|
+
...h
|
|
124
|
+
}, h.storage && (u = h.storage);
|
|
124
125
|
},
|
|
125
126
|
clearStorage: () => {
|
|
126
127
|
u?.removeItem(t.name);
|
|
@@ -128,30 +129,35 @@ const H = (r) => (s) => {
|
|
|
128
129
|
getOptions: () => t,
|
|
129
130
|
rehydrate: () => I(),
|
|
130
131
|
hasHydrated: () => a,
|
|
131
|
-
onHydrate: (
|
|
132
|
-
c.delete(
|
|
132
|
+
onHydrate: (h) => (c.add(h), () => {
|
|
133
|
+
c.delete(h);
|
|
133
134
|
}),
|
|
134
|
-
onFinishHydration: (
|
|
135
|
-
d.delete(
|
|
135
|
+
onFinishHydration: (h) => (d.add(h), () => {
|
|
136
|
+
d.delete(h);
|
|
136
137
|
})
|
|
137
|
-
}, t.skipHydration || I(),
|
|
138
|
-
}, S =
|
|
138
|
+
}, t.skipHydration || I(), p || m;
|
|
139
|
+
}, S = J, Z = b()(
|
|
139
140
|
S(
|
|
140
141
|
(r, s) => ({
|
|
141
142
|
user: null,
|
|
142
143
|
isLoggedIn: !1,
|
|
144
|
+
hrInfo: null,
|
|
143
145
|
// 로그인
|
|
144
|
-
login: (e) => {
|
|
145
|
-
r({ user: e, isLoggedIn: !0 }), console.log("사용자 로그인:", e);
|
|
146
|
+
login: (e, n) => {
|
|
147
|
+
r({ user: e, isLoggedIn: !0, hrInfo: n }), console.log("사용자 로그인:", e), console.log("HR 정보 저장:", n);
|
|
146
148
|
},
|
|
147
149
|
// 로그아웃
|
|
148
150
|
logout: () => {
|
|
149
|
-
r({ user: null, isLoggedIn: !1 }), console.log("사용자 로그아웃");
|
|
151
|
+
r({ user: null, isLoggedIn: !1, hrInfo: null }), console.log("사용자 로그아웃");
|
|
150
152
|
},
|
|
151
153
|
// 사용자 정보 업데이트
|
|
152
|
-
updateUser: (e) => {
|
|
153
|
-
const
|
|
154
|
-
|
|
154
|
+
updateUser: (e, n) => {
|
|
155
|
+
const o = s().user, t = s().hrInfo;
|
|
156
|
+
o && r({
|
|
157
|
+
user: { ...o, ...e }
|
|
158
|
+
}), t && r({
|
|
159
|
+
hrInfo: { ...t, ...n }
|
|
160
|
+
});
|
|
155
161
|
}
|
|
156
162
|
}),
|
|
157
163
|
{
|
|
@@ -159,6 +165,7 @@ const H = (r) => (s) => {
|
|
|
159
165
|
// 로컬 스토리지 키
|
|
160
166
|
partialize: (r) => ({
|
|
161
167
|
user: r.user,
|
|
168
|
+
hrInfo: r.hrInfo,
|
|
162
169
|
isLoggedIn: r.isLoggedIn
|
|
163
170
|
})
|
|
164
171
|
// 저장할 상태만 선택
|
|
@@ -216,7 +223,7 @@ const H = (r) => (s) => {
|
|
|
216
223
|
});
|
|
217
224
|
}
|
|
218
225
|
return console.log("대규모 데이터 변환 완료:", s), s;
|
|
219
|
-
},
|
|
226
|
+
}, g = b()(
|
|
220
227
|
S(
|
|
221
228
|
(r, s) => ({
|
|
222
229
|
codeData: null,
|
|
@@ -288,25 +295,25 @@ const H = (r) => (s) => {
|
|
|
288
295
|
})
|
|
289
296
|
}
|
|
290
297
|
)
|
|
291
|
-
),
|
|
298
|
+
), W = b()(
|
|
292
299
|
S(
|
|
293
300
|
(r, s) => ({
|
|
294
301
|
// 공통 데이터 스토어에서 상태 가져오기
|
|
295
302
|
get codeData() {
|
|
296
|
-
return
|
|
303
|
+
return g.getState().codeData;
|
|
297
304
|
},
|
|
298
305
|
get isLoading() {
|
|
299
|
-
return
|
|
306
|
+
return g.getState().isLoading;
|
|
300
307
|
},
|
|
301
308
|
get error() {
|
|
302
|
-
return
|
|
309
|
+
return g.getState().error;
|
|
303
310
|
},
|
|
304
311
|
get lastUpdated() {
|
|
305
|
-
return
|
|
312
|
+
return g.getState().lastUpdated;
|
|
306
313
|
},
|
|
307
314
|
// 공통코드 가져오기 (중앙 스토어 사용)
|
|
308
315
|
fetchCommonCodes: async () => {
|
|
309
|
-
await
|
|
316
|
+
await g.getState().fetchData();
|
|
310
317
|
},
|
|
311
318
|
// 1. 통합된 코드 목록 조회 (그룹코드 필수, 옵션으로 필터링)
|
|
312
319
|
getCodeList: (e, n) => {
|
|
@@ -320,33 +327,33 @@ const H = (r) => (s) => {
|
|
|
320
327
|
const I = l.cacheHits.get(d) || 0;
|
|
321
328
|
return l.cacheHits.set(d, I + 1), l.optionCache.get(d);
|
|
322
329
|
}
|
|
323
|
-
const u =
|
|
330
|
+
const u = g.getState().codeData;
|
|
324
331
|
if (!u) return [];
|
|
325
332
|
if (!l.isGroupLoaded(e) && !u[e])
|
|
326
333
|
return console.warn(`그룹 ${e}가 아직 로드되지 않았습니다.`), [];
|
|
327
|
-
const i = [],
|
|
328
|
-
|
|
334
|
+
const i = [], f = u[e];
|
|
335
|
+
f && Object.values(f).forEach((I) => {
|
|
329
336
|
if (!(o && !I.enabled) && !(t && I.systemCodeYn !== "Y"))
|
|
330
337
|
if (c) {
|
|
331
|
-
const
|
|
332
|
-
|
|
338
|
+
const h = e.length, y = I.codeValue.substring(h);
|
|
339
|
+
y.length > 0 && i.push({
|
|
333
340
|
...I,
|
|
334
|
-
codeValue:
|
|
341
|
+
codeValue: y
|
|
335
342
|
// 자식코드만 사용
|
|
336
343
|
});
|
|
337
344
|
} else
|
|
338
345
|
i.push(I);
|
|
339
346
|
});
|
|
340
|
-
let
|
|
341
|
-
a ?
|
|
342
|
-
(I,
|
|
347
|
+
let m;
|
|
348
|
+
a ? m = i.sort((I, h) => I.sortOrder !== h.sortOrder ? I.sortOrder - h.sortOrder : I.codeValue.localeCompare(h.codeValue)) : m = i.sort(
|
|
349
|
+
(I, h) => I.codeValue.localeCompare(h.codeValue)
|
|
343
350
|
);
|
|
344
|
-
const
|
|
351
|
+
const p = m.map((I) => ({
|
|
345
352
|
label: I.codeNm,
|
|
346
353
|
value: I.codeValue,
|
|
347
354
|
tagColor: I.labelColor
|
|
348
355
|
}));
|
|
349
|
-
return l.optionCache.size >= F.CACHE_SIZE_LIMIT && l.cleanupCache(), l.optionCache.set(d,
|
|
356
|
+
return l.optionCache.size >= F.CACHE_SIZE_LIMIT && l.cleanupCache(), l.optionCache.set(d, p), l.cacheHits.set(d, 1), p;
|
|
350
357
|
},
|
|
351
358
|
// 2. 코드를 던졌을 때 코드명을 리턴 (대규모 최적화)
|
|
352
359
|
getCodeName: (e) => {
|
|
@@ -354,7 +361,7 @@ const H = (r) => (s) => {
|
|
|
354
361
|
const o = l.cacheHits.get(`name_${e}`) || 0;
|
|
355
362
|
return l.cacheHits.set(`name_${e}`, o + 1), l.nameCache.get(e);
|
|
356
363
|
}
|
|
357
|
-
const n =
|
|
364
|
+
const n = g.getState().codeData;
|
|
358
365
|
if (!n) return null;
|
|
359
366
|
for (const o of Object.values(n))
|
|
360
367
|
for (const t of Object.values(o))
|
|
@@ -368,7 +375,7 @@ const H = (r) => (s) => {
|
|
|
368
375
|
const o = l.cacheHits.get(`color_${e}`) || 0;
|
|
369
376
|
return l.cacheHits.set(`color_${e}`, o + 1), l.colorCache.get(e);
|
|
370
377
|
}
|
|
371
|
-
const n =
|
|
378
|
+
const n = g.getState().codeData;
|
|
372
379
|
if (!n) return null;
|
|
373
380
|
for (const o of Object.values(n))
|
|
374
381
|
for (const t of Object.values(o))
|
|
@@ -386,7 +393,7 @@ const H = (r) => (s) => {
|
|
|
386
393
|
const u = l.cacheHits.get(n) || 0;
|
|
387
394
|
return l.cacheHits.set(n, u + 1), l.optionCache.get(n);
|
|
388
395
|
}
|
|
389
|
-
const o =
|
|
396
|
+
const o = g.getState().codeData;
|
|
390
397
|
if (!o) return { labels: [], values: [], lookupDisplay: !0 };
|
|
391
398
|
const t = o[e];
|
|
392
399
|
if (!t) return { labels: [], values: [], lookupDisplay: !0 };
|
|
@@ -404,7 +411,7 @@ const H = (r) => (s) => {
|
|
|
404
411
|
const i = l.cacheHits.get(t) || 0;
|
|
405
412
|
return l.cacheHits.set(t, i + 1), l.codeCache.get(t);
|
|
406
413
|
}
|
|
407
|
-
const a =
|
|
414
|
+
const a = g.getState().codeData;
|
|
408
415
|
if (!a) return [];
|
|
409
416
|
const c = [], d = a[e];
|
|
410
417
|
d && Object.values(d).forEach((i) => {
|
|
@@ -415,7 +422,7 @@ const H = (r) => (s) => {
|
|
|
415
422
|
});
|
|
416
423
|
});
|
|
417
424
|
const u = c.sort(
|
|
418
|
-
(i,
|
|
425
|
+
(i, f) => i.codeValue.localeCompare(f.codeValue)
|
|
419
426
|
);
|
|
420
427
|
return l.codeCache.size >= F.CACHE_SIZE_LIMIT && l.cleanupCache(), l.codeCache.set(t, u), l.cacheHits.set(t, 1), u;
|
|
421
428
|
},
|
|
@@ -427,30 +434,30 @@ const H = (r) => (s) => {
|
|
|
427
434
|
sortByOrder: c = !1
|
|
428
435
|
} = o || {}, d = `codeListByOption_${e}_${n}_${t}_${a}_${c}`;
|
|
429
436
|
if (l.codeCache.has(d)) {
|
|
430
|
-
const
|
|
431
|
-
return l.cacheHits.set(d,
|
|
437
|
+
const p = l.cacheHits.get(d) || 0;
|
|
438
|
+
return l.cacheHits.set(d, p + 1), l.codeCache.get(
|
|
432
439
|
d
|
|
433
440
|
);
|
|
434
441
|
}
|
|
435
|
-
const u =
|
|
442
|
+
const u = g.getState().codeData;
|
|
436
443
|
if (!u) return [];
|
|
437
444
|
if (!l.isGroupLoaded(e) && !u[e])
|
|
438
445
|
return console.warn(`그룹 ${e}가 아직 로드되지 않았습니다.`), [];
|
|
439
|
-
const i = [],
|
|
440
|
-
|
|
441
|
-
t && !
|
|
442
|
-
label:
|
|
446
|
+
const i = [], f = u[e];
|
|
447
|
+
f && Object.values(f).forEach((p) => {
|
|
448
|
+
t && !p.enabled || a && p.systemCodeYn !== "Y" || p.options && p.options[n] && i.push({
|
|
449
|
+
label: p.options[n],
|
|
443
450
|
// optnNm 값
|
|
444
|
-
value:
|
|
451
|
+
value: p.commonCode,
|
|
445
452
|
// 공통코드값
|
|
446
|
-
tagColor:
|
|
453
|
+
tagColor: p.labelColor
|
|
447
454
|
// 라벨 컬러
|
|
448
455
|
});
|
|
449
456
|
});
|
|
450
|
-
let
|
|
451
|
-
return c ?
|
|
452
|
-
(
|
|
453
|
-
), l.codeCache.size >= F.CACHE_SIZE_LIMIT && l.cleanupCache(), l.codeCache.set(d,
|
|
457
|
+
let m;
|
|
458
|
+
return c ? m = i.sort((p, I) => p.value.localeCompare(I.value)) : m = i.sort(
|
|
459
|
+
(p, I) => p.value.localeCompare(I.value)
|
|
460
|
+
), l.codeCache.size >= F.CACHE_SIZE_LIMIT && l.cleanupCache(), l.codeCache.set(d, m), l.cacheHits.set(d, 1), m;
|
|
454
461
|
},
|
|
455
462
|
// 7. 그룹코드 목록 조회
|
|
456
463
|
getAvailableGroupCodes: () => {
|
|
@@ -459,7 +466,7 @@ const H = (r) => (s) => {
|
|
|
459
466
|
const t = l.cacheHits.get(e) || 0;
|
|
460
467
|
return l.cacheHits.set(e, t + 1), JSON.parse(l.nameCache.get(e));
|
|
461
468
|
}
|
|
462
|
-
const n =
|
|
469
|
+
const n = g.getState().codeData;
|
|
463
470
|
if (!n) return [];
|
|
464
471
|
const o = Object.keys(n).sort();
|
|
465
472
|
return l.nameCache.set(
|
|
@@ -469,7 +476,7 @@ const H = (r) => (s) => {
|
|
|
469
476
|
},
|
|
470
477
|
// 공통코드 초기화
|
|
471
478
|
clearCodes: () => {
|
|
472
|
-
|
|
479
|
+
g.getState().clearData();
|
|
473
480
|
}
|
|
474
481
|
}),
|
|
475
482
|
{
|
|
@@ -479,25 +486,25 @@ const H = (r) => (s) => {
|
|
|
479
486
|
})
|
|
480
487
|
}
|
|
481
488
|
)
|
|
482
|
-
),
|
|
489
|
+
), fe = b()(
|
|
483
490
|
S(
|
|
484
491
|
(r, s) => ({
|
|
485
492
|
// 공통 데이터 스토어에서 상태 가져오기
|
|
486
493
|
get codeData() {
|
|
487
|
-
return
|
|
494
|
+
return g.getState().codeData;
|
|
488
495
|
},
|
|
489
496
|
get isLoading() {
|
|
490
|
-
return
|
|
497
|
+
return g.getState().isLoading;
|
|
491
498
|
},
|
|
492
499
|
get error() {
|
|
493
|
-
return
|
|
500
|
+
return g.getState().error;
|
|
494
501
|
},
|
|
495
502
|
get lastUpdated() {
|
|
496
|
-
return
|
|
503
|
+
return g.getState().lastUpdated;
|
|
497
504
|
},
|
|
498
505
|
// 공통코드 가져오기 (중앙 스토어 사용)
|
|
499
506
|
fetchCommonCodes: async () => {
|
|
500
|
-
await
|
|
507
|
+
await g.getState().fetchData();
|
|
501
508
|
},
|
|
502
509
|
// 그룹코드와 옵션코드를 던졌을 때 상세코드의 옵션값을 리턴 (대규모 최적화)
|
|
503
510
|
getOptionValue: (e, n) => {
|
|
@@ -506,7 +513,7 @@ const H = (r) => (s) => {
|
|
|
506
513
|
const c = l.cacheHits.get(o) || 0;
|
|
507
514
|
return l.cacheHits.set(o, c + 1), l.optionCache.get(o);
|
|
508
515
|
}
|
|
509
|
-
const t =
|
|
516
|
+
const t = g.getState().codeData;
|
|
510
517
|
if (!t) return null;
|
|
511
518
|
const a = t[e];
|
|
512
519
|
if (a && a[n]) {
|
|
@@ -527,7 +534,7 @@ const H = (r) => (s) => {
|
|
|
527
534
|
},
|
|
528
535
|
// 공통코드 초기화
|
|
529
536
|
clearCodes: () => {
|
|
530
|
-
|
|
537
|
+
g.getState().clearData();
|
|
531
538
|
}
|
|
532
539
|
}),
|
|
533
540
|
{
|
|
@@ -537,25 +544,25 @@ const H = (r) => (s) => {
|
|
|
537
544
|
})
|
|
538
545
|
}
|
|
539
546
|
)
|
|
540
|
-
),
|
|
547
|
+
), Ie = b()(
|
|
541
548
|
S(
|
|
542
549
|
(r, s) => ({
|
|
543
550
|
// 공통 데이터 스토어에서 상태 가져오기
|
|
544
551
|
get codeData() {
|
|
545
|
-
return
|
|
552
|
+
return g.getState().codeData;
|
|
546
553
|
},
|
|
547
554
|
get isLoading() {
|
|
548
|
-
return
|
|
555
|
+
return g.getState().isLoading;
|
|
549
556
|
},
|
|
550
557
|
get error() {
|
|
551
|
-
return
|
|
558
|
+
return g.getState().error;
|
|
552
559
|
},
|
|
553
560
|
get lastUpdated() {
|
|
554
|
-
return
|
|
561
|
+
return g.getState().lastUpdated;
|
|
555
562
|
},
|
|
556
563
|
// 공통코드 가져오기 (중앙 스토어 사용)
|
|
557
564
|
fetchCommonCodes: async () => {
|
|
558
|
-
await
|
|
565
|
+
await g.getState().fetchData();
|
|
559
566
|
},
|
|
560
567
|
// 코드를 던졌을 때 컬러코드를 리턴 (대규모 최적화)
|
|
561
568
|
getColorCode: (e) => {
|
|
@@ -563,7 +570,7 @@ const H = (r) => (s) => {
|
|
|
563
570
|
const o = l.cacheHits.get(`color_${e}`) || 0;
|
|
564
571
|
return l.cacheHits.set(`color_${e}`, o + 1), l.colorCache.get(e);
|
|
565
572
|
}
|
|
566
|
-
const n =
|
|
573
|
+
const n = g.getState().codeData;
|
|
567
574
|
if (!n) return null;
|
|
568
575
|
for (const o of Object.values(n))
|
|
569
576
|
for (const t of Object.values(o))
|
|
@@ -581,7 +588,7 @@ const H = (r) => (s) => {
|
|
|
581
588
|
const t = l.cacheHits.get(e) || 0;
|
|
582
589
|
return l.cacheHits.set(e, t + 1), l.optionCache.get(e);
|
|
583
590
|
}
|
|
584
|
-
const n =
|
|
591
|
+
const n = g.getState().codeData;
|
|
585
592
|
if (!n) return [];
|
|
586
593
|
const o = [];
|
|
587
594
|
return Object.values(n).forEach((t) => {
|
|
@@ -595,7 +602,7 @@ const H = (r) => (s) => {
|
|
|
595
602
|
},
|
|
596
603
|
// 공통코드 초기화
|
|
597
604
|
clearCodes: () => {
|
|
598
|
-
|
|
605
|
+
g.getState().clearData();
|
|
599
606
|
}
|
|
600
607
|
}),
|
|
601
608
|
{
|
|
@@ -605,7 +612,7 @@ const H = (r) => (s) => {
|
|
|
605
612
|
})
|
|
606
613
|
}
|
|
607
614
|
)
|
|
608
|
-
),
|
|
615
|
+
), Q = (r, s) => ({
|
|
609
616
|
nodes: {},
|
|
610
617
|
rootIds: [],
|
|
611
618
|
loadedFor: void 0,
|
|
@@ -617,11 +624,11 @@ const H = (r) => (s) => {
|
|
|
617
624
|
(n) => n.type === "M" && n.menuId === e
|
|
618
625
|
),
|
|
619
626
|
getPrntBkmkIdByMenuId: (e) => {
|
|
620
|
-
const n =
|
|
627
|
+
const n = _(s().nodes, e);
|
|
621
628
|
return n ? s().nodes[n]?.prntBkmkId ?? "-" : "-";
|
|
622
629
|
},
|
|
623
630
|
getNodeByMenuId: (e) => {
|
|
624
|
-
const n =
|
|
631
|
+
const n = _(s().nodes, e);
|
|
625
632
|
if (!n) return null;
|
|
626
633
|
const o = s().nodes[n];
|
|
627
634
|
return o?.type === "M" ? o : null;
|
|
@@ -630,7 +637,7 @@ const H = (r) => (s) => {
|
|
|
630
637
|
const { nodes: n, rootIds: o } = s(), t = (c) => e ? c.toLowerCase().includes(e.toLowerCase()) : !0, a = (c) => {
|
|
631
638
|
const d = n[c];
|
|
632
639
|
if (!d || d.type !== "F") return null;
|
|
633
|
-
const u = d, i = (u.children || []).map((
|
|
640
|
+
const u = d, i = (u.children || []).map((m) => n[m]).filter((m) => !!m && m.type === "F").map((m) => a(m.bkmkId)).filter(Boolean);
|
|
634
641
|
return t(u.bkmkNm) || i.length > 0 ? {
|
|
635
642
|
key: u.bkmkId,
|
|
636
643
|
title: `📁 ${u.bkmkNm}`,
|
|
@@ -646,7 +653,7 @@ const H = (r) => (s) => {
|
|
|
646
653
|
if (!(!n && o.loadedFor === e && Object.keys(o.nodes).length)) {
|
|
647
654
|
r({ loading: !0, error: void 0 });
|
|
648
655
|
try {
|
|
649
|
-
const t = await v("SCMBKMK00101", { userId: e }), a = Array.isArray(t?.sub) ? t.sub : [], c =
|
|
656
|
+
const t = await v("SCMBKMK00101", { userId: e }), a = Array.isArray(t?.sub) ? t.sub : [], c = ee(a), d = w(
|
|
650
657
|
c.nodes,
|
|
651
658
|
c.rootIds
|
|
652
659
|
);
|
|
@@ -667,9 +674,9 @@ const H = (r) => (s) => {
|
|
|
667
674
|
},
|
|
668
675
|
// ====== 공통: 생성 ======
|
|
669
676
|
addNode: async (e) => {
|
|
670
|
-
const n = D(s()), o =
|
|
677
|
+
const n = D(s()), o = te();
|
|
671
678
|
r((t) => {
|
|
672
|
-
const a = e.sortOrdr ??
|
|
679
|
+
const a = e.sortOrdr ?? $(t, e.prntBkmkId), c = {
|
|
673
680
|
...t,
|
|
674
681
|
nodes: {
|
|
675
682
|
...t.nodes,
|
|
@@ -696,11 +703,11 @@ const H = (r) => (s) => {
|
|
|
696
703
|
rootIds: t.rootIds.slice(),
|
|
697
704
|
treeNodes: t.treeNodes
|
|
698
705
|
};
|
|
699
|
-
return
|
|
706
|
+
return oe(c, o, e.prntBkmkId), c.treeNodes = w(c.nodes, c.rootIds), c;
|
|
700
707
|
});
|
|
701
708
|
try {
|
|
702
709
|
let t = o;
|
|
703
|
-
const a =
|
|
710
|
+
const a = $(s(), e.prntBkmkId), c = await v("SCMBKMK00102", {
|
|
704
711
|
iudFlag: "I",
|
|
705
712
|
type: e.type,
|
|
706
713
|
sysCd: e.sysCd,
|
|
@@ -714,10 +721,10 @@ const H = (r) => (s) => {
|
|
|
714
721
|
chngId: N()
|
|
715
722
|
});
|
|
716
723
|
return t = String(c?.bkmkId ?? c?.itemId ?? o), r((d) => {
|
|
717
|
-
const u =
|
|
724
|
+
const u = re(d, o, t);
|
|
718
725
|
return {
|
|
719
726
|
...u,
|
|
720
|
-
treeNodes:
|
|
727
|
+
treeNodes: w(u.nodes, u.rootIds)
|
|
721
728
|
};
|
|
722
729
|
}), t;
|
|
723
730
|
} catch (t) {
|
|
@@ -729,18 +736,18 @@ const H = (r) => (s) => {
|
|
|
729
736
|
const a = s(), c = structuredClone(a.nodes), d = [...a.rootIds], u = c[e];
|
|
730
737
|
if (!u) return;
|
|
731
738
|
if (n !== "-") {
|
|
732
|
-
const
|
|
733
|
-
if (!
|
|
739
|
+
const p = c[n];
|
|
740
|
+
if (!p || p.type !== "F")
|
|
734
741
|
throw new Error("부모는 폴더만 가능합니다.");
|
|
735
742
|
}
|
|
736
|
-
const i = u.prntBkmkId ?? "-",
|
|
743
|
+
const i = u.prntBkmkId ?? "-", f = i === "-" ? d : c[i].children ||= [];
|
|
737
744
|
{
|
|
738
|
-
const
|
|
739
|
-
|
|
745
|
+
const p = f.indexOf(e);
|
|
746
|
+
p >= 0 && f.splice(p, 1);
|
|
740
747
|
}
|
|
741
|
-
const
|
|
742
|
-
|
|
743
|
-
Math.max(0, Math.min(o,
|
|
748
|
+
const m = n === "-" ? d : c[n].children ||= [];
|
|
749
|
+
m.splice(
|
|
750
|
+
Math.max(0, Math.min(o, m.length)),
|
|
744
751
|
0,
|
|
745
752
|
e
|
|
746
753
|
), u.prntBkmkId = n, r({ nodes: c, rootIds: d }), U(c, d, n), U(c, d, i);
|
|
@@ -752,8 +759,8 @@ const H = (r) => (s) => {
|
|
|
752
759
|
sortOrdr: o,
|
|
753
760
|
chngId: t
|
|
754
761
|
});
|
|
755
|
-
} catch (
|
|
756
|
-
throw r(a),
|
|
762
|
+
} catch (p) {
|
|
763
|
+
throw r(a), p;
|
|
757
764
|
}
|
|
758
765
|
},
|
|
759
766
|
// ====== 공통: 삭제 ======
|
|
@@ -767,7 +774,7 @@ const H = (r) => (s) => {
|
|
|
767
774
|
rootIds: o.rootIds.slice(),
|
|
768
775
|
treeNodes: o.treeNodes
|
|
769
776
|
};
|
|
770
|
-
return
|
|
777
|
+
return j(t, e), t.treeNodes = w(t.nodes, t.rootIds), t;
|
|
771
778
|
});
|
|
772
779
|
try {
|
|
773
780
|
await v("SCMBKMK00103", { bkmkId: e });
|
|
@@ -807,7 +814,7 @@ const H = (r) => (s) => {
|
|
|
807
814
|
sysCd: o,
|
|
808
815
|
userId: t
|
|
809
816
|
}),
|
|
810
|
-
addMenuToFolder: async (e, n) =>
|
|
817
|
+
addMenuToFolder: async (e, n) => _(s().nodes, n.menuId) ? "이미 북마크에 저장된 메뉴입니다." : await s().addNode({
|
|
811
818
|
type: "M",
|
|
812
819
|
prntBkmkId: e,
|
|
813
820
|
sysCd: "KH",
|
|
@@ -823,8 +830,8 @@ const H = (r) => (s) => {
|
|
|
823
830
|
await s().removeNode(t.bkmkId);
|
|
824
831
|
return;
|
|
825
832
|
}
|
|
826
|
-
let a =
|
|
827
|
-
a || (await s().loadFavorites(e, !0), a =
|
|
833
|
+
let a = A(o);
|
|
834
|
+
a || (await s().loadFavorites(e, !0), a = A(s())), a && await s().addNode({
|
|
828
835
|
type: "M",
|
|
829
836
|
prntBkmkId: a,
|
|
830
837
|
sysCd: "KH",
|
|
@@ -834,7 +841,7 @@ const H = (r) => (s) => {
|
|
|
834
841
|
});
|
|
835
842
|
},
|
|
836
843
|
removeMenuByMenuId: async (e) => {
|
|
837
|
-
const n = s(), o =
|
|
844
|
+
const n = s(), o = _(n.nodes, e);
|
|
838
845
|
o && await s().removeNode(o);
|
|
839
846
|
},
|
|
840
847
|
removeMenu: async (e) => {
|
|
@@ -858,8 +865,8 @@ const H = (r) => (s) => {
|
|
|
858
865
|
const u = e[d];
|
|
859
866
|
if (!u || t && u.type !== "F") return null;
|
|
860
867
|
if (u.type === "F") {
|
|
861
|
-
const i = u,
|
|
862
|
-
return a(i.bkmkNm) ||
|
|
868
|
+
const i = u, f = (i.children || []).map((p) => c(p)).filter(Boolean);
|
|
869
|
+
return a(i.bkmkNm) || f.length > 0 ? {
|
|
863
870
|
key: i.bkmkId,
|
|
864
871
|
type: "F",
|
|
865
872
|
title: `📁 ${i.bkmkNm}`,
|
|
@@ -867,14 +874,14 @@ const H = (r) => (s) => {
|
|
|
867
874
|
prntBkmkId: i.prntBkmkId,
|
|
868
875
|
sortOrdr: i.sortOrdr,
|
|
869
876
|
fullPath: i.fullPath,
|
|
870
|
-
children:
|
|
877
|
+
children: f.length ? f : void 0
|
|
871
878
|
} : null;
|
|
872
879
|
} else {
|
|
873
|
-
const i = u,
|
|
874
|
-
return a(
|
|
880
|
+
const i = u, f = i.menuNm ? `${i.menuNm} (${i.menuId})` : i.menuId;
|
|
881
|
+
return a(f) ? {
|
|
875
882
|
key: i.bkmkId,
|
|
876
883
|
type: "M",
|
|
877
|
-
title: `📄 ${
|
|
884
|
+
title: `📄 ${f}`,
|
|
878
885
|
prntBkmkId: i.prntBkmkId,
|
|
879
886
|
sortOrdr: i.sortOrdr,
|
|
880
887
|
fullPath: i.fullPath,
|
|
@@ -884,8 +891,8 @@ const H = (r) => (s) => {
|
|
|
884
891
|
};
|
|
885
892
|
return n.map(c).filter(Boolean);
|
|
886
893
|
}
|
|
887
|
-
}),
|
|
888
|
-
function
|
|
894
|
+
}), V = b(Q);
|
|
895
|
+
function ee(r) {
|
|
889
896
|
const s = {}, e = [], n = (o) => {
|
|
890
897
|
o.forEach((t) => {
|
|
891
898
|
const a = {
|
|
@@ -931,15 +938,15 @@ function D(r) {
|
|
|
931
938
|
rootIds: r.rootIds.slice()
|
|
932
939
|
};
|
|
933
940
|
}
|
|
934
|
-
function
|
|
941
|
+
function te() {
|
|
935
942
|
return `tmp_${Math.random().toString(36).slice(2, 10)}`;
|
|
936
943
|
}
|
|
937
|
-
function
|
|
944
|
+
function $(r, s) {
|
|
938
945
|
if (!s || s === "-") return r.rootIds.length;
|
|
939
946
|
const e = r.nodes[s];
|
|
940
947
|
return e ? e.children.length : 0;
|
|
941
948
|
}
|
|
942
|
-
function
|
|
949
|
+
function oe(r, s, e) {
|
|
943
950
|
const n = r.nodes[s];
|
|
944
951
|
if (n)
|
|
945
952
|
if (e && e !== "-") {
|
|
@@ -949,7 +956,7 @@ function te(r, s, e) {
|
|
|
949
956
|
} else
|
|
950
957
|
n.prntBkmkId = "-", r.rootIds = [...r.rootIds, s];
|
|
951
958
|
}
|
|
952
|
-
function
|
|
959
|
+
function ne(r, s) {
|
|
953
960
|
const e = r.nodes[s];
|
|
954
961
|
if (!e) return;
|
|
955
962
|
const n = e.prntBkmkId;
|
|
@@ -959,14 +966,14 @@ function oe(r, s) {
|
|
|
959
966
|
} else
|
|
960
967
|
r.rootIds = r.rootIds.filter((o) => o !== s);
|
|
961
968
|
}
|
|
962
|
-
function
|
|
969
|
+
function j(r, s) {
|
|
963
970
|
const e = r.nodes[s];
|
|
964
971
|
if (!e) return;
|
|
965
|
-
e.type === "F" && e.children.slice().forEach((a) =>
|
|
972
|
+
e.type === "F" && e.children.slice().forEach((a) => j(r, a)), ne(r, s);
|
|
966
973
|
const { [s]: n, ...o } = r.nodes;
|
|
967
974
|
r.nodes = o;
|
|
968
975
|
}
|
|
969
|
-
function
|
|
976
|
+
function re(r, s, e) {
|
|
970
977
|
if (s === e) return r;
|
|
971
978
|
const n = r.nodes[s];
|
|
972
979
|
if (!n) return r;
|
|
@@ -985,10 +992,10 @@ function ne(r, s, e) {
|
|
|
985
992
|
a = r.rootIds.map((c) => c === s ? e : c);
|
|
986
993
|
return { ...r, nodes: t, rootIds: a };
|
|
987
994
|
}
|
|
988
|
-
function
|
|
995
|
+
function A(r) {
|
|
989
996
|
return r.rootIds.find((s) => r.nodes[s]?.type === "F") ?? null;
|
|
990
997
|
}
|
|
991
|
-
function
|
|
998
|
+
function w(r, s) {
|
|
992
999
|
const e = {};
|
|
993
1000
|
Object.values(r).forEach((d) => {
|
|
994
1001
|
const u = d.bkmkId, i = d.prntBkmkId;
|
|
@@ -1001,13 +1008,13 @@ function _(r, s) {
|
|
|
1001
1008
|
n.add(d);
|
|
1002
1009
|
try {
|
|
1003
1010
|
if (u.type === "F") {
|
|
1004
|
-
const
|
|
1011
|
+
const f = u, m = e[d] ?? [];
|
|
1005
1012
|
return {
|
|
1006
1013
|
type: "F",
|
|
1007
1014
|
bkmkId: d,
|
|
1008
|
-
bkmkNm:
|
|
1009
|
-
prntBkmkId:
|
|
1010
|
-
children:
|
|
1015
|
+
bkmkNm: f.bkmkNm,
|
|
1016
|
+
prntBkmkId: f.prntBkmkId,
|
|
1017
|
+
children: m.map(o).filter(Boolean)
|
|
1011
1018
|
};
|
|
1012
1019
|
}
|
|
1013
1020
|
const i = u;
|
|
@@ -1027,7 +1034,7 @@ function _(r, s) {
|
|
|
1027
1034
|
/* @__PURE__ */ new Set([...s, ...t, ...a])
|
|
1028
1035
|
).map(o).filter(Boolean);
|
|
1029
1036
|
}
|
|
1030
|
-
function
|
|
1037
|
+
function _(r, s) {
|
|
1031
1038
|
for (const e of Object.values(r))
|
|
1032
1039
|
if (e.type === "M" && e.menuId === s) return e.bkmkId;
|
|
1033
1040
|
return null;
|
|
@@ -1040,20 +1047,20 @@ function U(r, s, e) {
|
|
|
1040
1047
|
}
|
|
1041
1048
|
const T = {
|
|
1042
1049
|
DEFAULT_PRNT_GBCD: 1
|
|
1043
|
-
},
|
|
1044
|
-
let
|
|
1045
|
-
const
|
|
1050
|
+
}, se = (r) => r && typeof r == "object" && typeof r.menuId == "string" && typeof r.menuNm == "string", G = (r) => Array.isArray(r) && r.every(se);
|
|
1051
|
+
let P = [], x = [];
|
|
1052
|
+
const ae = (r) => {
|
|
1046
1053
|
if (r && typeof r == "object") {
|
|
1047
1054
|
const s = r;
|
|
1048
1055
|
if (s.menus && G(s.menus)) return s.menus;
|
|
1049
1056
|
if (G(r)) return r;
|
|
1050
1057
|
}
|
|
1051
1058
|
return console.warn("⚠️ 메뉴 응답이 비어있거나 예상과 다릅니다."), [];
|
|
1052
|
-
},
|
|
1053
|
-
if (
|
|
1059
|
+
}, ce = (r, s) => !!s && r.crprCd === s.crprCd && r.userId === s.userId && (r.prntGbcd ?? T.DEFAULT_PRNT_GBCD) === (s.prntGbcd ?? T.DEFAULT_PRNT_GBCD), de = (r) => {
|
|
1060
|
+
if (P.length === r.length && P.every(
|
|
1054
1061
|
(t, a) => t.menuId === r[a]?.menuId && t.menuPrntId === r[a]?.menuPrntId
|
|
1055
1062
|
))
|
|
1056
|
-
return
|
|
1063
|
+
return x;
|
|
1057
1064
|
if (!r.length) return [];
|
|
1058
1065
|
const s = /* @__PURE__ */ new Map(), e = [];
|
|
1059
1066
|
r.forEach((t) => t?.menuId && s.set(t.menuId, { ...t, children: [] })), r.forEach((t) => {
|
|
@@ -1064,8 +1071,8 @@ const se = (r) => {
|
|
|
1064
1071
|
...a,
|
|
1065
1072
|
children: a.children && a.children.length ? n(a.children) : void 0
|
|
1066
1073
|
})), o = n(e);
|
|
1067
|
-
return
|
|
1068
|
-
},
|
|
1074
|
+
return P = [...r], x = o, o;
|
|
1075
|
+
}, z = b((r, s) => ({
|
|
1069
1076
|
// 📊 초기 상태값
|
|
1070
1077
|
menuList: [],
|
|
1071
1078
|
flatMenuList: [],
|
|
@@ -1080,13 +1087,13 @@ const se = (r) => {
|
|
|
1080
1087
|
userId: n,
|
|
1081
1088
|
prntGbcd: o ?? T.DEFAULT_PRNT_GBCD
|
|
1082
1089
|
};
|
|
1083
|
-
if (
|
|
1090
|
+
if (ce(t, s()._lastFetchParams)) {
|
|
1084
1091
|
console.log("✅ 중복 fetch 차단", t);
|
|
1085
1092
|
return;
|
|
1086
1093
|
}
|
|
1087
1094
|
r({ isLoading: !0, error: null, _lastFetchParams: t });
|
|
1088
1095
|
try {
|
|
1089
|
-
const a = await v(E("AUTH_MENU"), t), c =
|
|
1096
|
+
const a = await v(E("AUTH_MENU"), t), c = ae(a), d = de(c);
|
|
1090
1097
|
r({
|
|
1091
1098
|
flatMenuList: c,
|
|
1092
1099
|
// 평면 리스트 저장
|
|
@@ -1115,16 +1122,16 @@ const se = (r) => {
|
|
|
1115
1122
|
const { flatMenuList: n } = s();
|
|
1116
1123
|
return n.find((o) => o.menuId === e) ?? null;
|
|
1117
1124
|
}
|
|
1118
|
-
})),
|
|
1125
|
+
})), B = {
|
|
1119
1126
|
MAX_TABS: 15
|
|
1120
|
-
},
|
|
1127
|
+
}, le = b((r, s) => ({
|
|
1121
1128
|
// 📊 초기 상태값
|
|
1122
1129
|
activeMenuId: null,
|
|
1123
1130
|
activeMenuItem: null,
|
|
1124
1131
|
activeDetailItem: null,
|
|
1125
1132
|
tabs: [],
|
|
1126
1133
|
sidebarCollapsed: !1,
|
|
1127
|
-
maxTabs:
|
|
1134
|
+
maxTabs: B.MAX_TABS,
|
|
1128
1135
|
tabProtectFlag: {},
|
|
1129
1136
|
tabParams: {},
|
|
1130
1137
|
componentLabelMap: {},
|
|
@@ -1133,11 +1140,11 @@ const se = (r) => {
|
|
|
1133
1140
|
openTabFromMenu: (e, n) => {
|
|
1134
1141
|
const { tabs: o } = s(), t = o.find((c) => c.key === e.menuId), a = o.find((c) => c.key === e.menuId);
|
|
1135
1142
|
if (t)
|
|
1136
|
-
a != null ? (r({ activeMenuId: e.menuId, activeMenuItem: e }), s().setTabParams(e.menuId, n || {}), e?.prsnInfoYn === "Y" && s().setProtectFlagForKey(e.menuId)) :
|
|
1143
|
+
a != null ? (r({ activeMenuId: e.menuId, activeMenuItem: e }), s().setTabParams(e.menuId, n || {}), e?.prsnInfoYn === "Y" && s().setProtectFlagForKey(e.menuId)) : O.warning("유효하지 않은 메뉴정보입니다.");
|
|
1137
1144
|
else {
|
|
1138
|
-
if (o.length >
|
|
1139
|
-
console.warn("❌ 최대 탭 개수를 초과했습니다."),
|
|
1140
|
-
`최대 ${
|
|
1145
|
+
if (o.length > B.MAX_TABS) {
|
|
1146
|
+
console.warn("❌ 최대 탭 개수를 초과했습니다."), O.warning(
|
|
1147
|
+
`최대 ${B.MAX_TABS}개의 탭만 열 수 있습니다.
|
|
1141
1148
|
기존 탭을 닫고 다시 시도해주세요.`
|
|
1142
1149
|
);
|
|
1143
1150
|
return;
|
|
@@ -1162,8 +1169,8 @@ const se = (r) => {
|
|
|
1162
1169
|
// 🔧 탭 추가 (메뉴 ID로)
|
|
1163
1170
|
// URL 파라미터로 메뉴 열기 시 사용 (예: ?menuId=CM000301)
|
|
1164
1171
|
openTabByMenuId: (e, n) => {
|
|
1165
|
-
const o =
|
|
1166
|
-
o ? s().openTabFromMenu(o, n) :
|
|
1172
|
+
const o = z.getState().findMenuById(e);
|
|
1173
|
+
o ? s().openTabFromMenu(o, n) : O.warning("메뉴 ID를 찾을 수 없습니다.");
|
|
1167
1174
|
},
|
|
1168
1175
|
openDetailView: (e, n, o) => {
|
|
1169
1176
|
const { tabs: t } = s();
|
|
@@ -1268,18 +1275,19 @@ const se = (r) => {
|
|
|
1268
1275
|
}),
|
|
1269
1276
|
// 컴포넌트 라벨 맵 설정
|
|
1270
1277
|
setComponentLabelMap: (e, n) => r({ componentLabelMap: e })
|
|
1271
|
-
})),
|
|
1278
|
+
})), ie = b((r, s) => ({
|
|
1272
1279
|
popups: [],
|
|
1273
1280
|
activePopupId: null,
|
|
1274
1281
|
isLoading: !1,
|
|
1275
1282
|
error: null,
|
|
1283
|
+
zIndexSeed: 1e3,
|
|
1276
1284
|
// 팝업 열기
|
|
1277
1285
|
openPopup: async (e, n, o) => {
|
|
1278
1286
|
r({ isLoading: !0, error: null });
|
|
1279
1287
|
try {
|
|
1280
1288
|
let t = null;
|
|
1281
1289
|
const a = await v(E("SRCH_POPU"), {
|
|
1282
|
-
crprCd:
|
|
1290
|
+
crprCd: K()?.crprCd,
|
|
1283
1291
|
popuCd: e
|
|
1284
1292
|
});
|
|
1285
1293
|
t = a?.mstr;
|
|
@@ -1288,7 +1296,7 @@ const se = (r) => {
|
|
|
1288
1296
|
const p = `팝업 정보를 찾을 수 없습니다: ${e}`;
|
|
1289
1297
|
throw console.error(p), new Error(p);
|
|
1290
1298
|
}
|
|
1291
|
-
const u = ((p) => `/src/pages/views/popup/${p}`)(t.popuUrl), i = {
|
|
1299
|
+
const u = ((p) => `/src/pages/views/popup/${p}`)(t.popuUrl), i = s().zIndexSeed + 1, f = {
|
|
1292
1300
|
popupId: `popup_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
|
|
1293
1301
|
popupCode: e,
|
|
1294
1302
|
//config.title을 통해 팝업 제목 변경 가능
|
|
@@ -1301,22 +1309,24 @@ const se = (r) => {
|
|
|
1301
1309
|
draggable: !0,
|
|
1302
1310
|
buttonList: c,
|
|
1303
1311
|
// 버튼 목록 추가
|
|
1304
|
-
config: o
|
|
1305
|
-
|
|
1306
|
-
|
|
1312
|
+
config: o,
|
|
1313
|
+
zIndex: i
|
|
1314
|
+
}, m = s().popups.find((p) => p.popupCode === e);
|
|
1315
|
+
if (m) {
|
|
1307
1316
|
r({
|
|
1308
|
-
activePopupId:
|
|
1317
|
+
activePopupId: m.popupId,
|
|
1309
1318
|
popups: s().popups.map(
|
|
1310
|
-
(p) => p.popupId ===
|
|
1319
|
+
(p) => p.popupId === m.popupId ? { ...p, config: o } : p
|
|
1311
1320
|
),
|
|
1312
1321
|
isLoading: !1
|
|
1313
1322
|
});
|
|
1314
1323
|
return;
|
|
1315
1324
|
}
|
|
1316
1325
|
r((p) => ({
|
|
1317
|
-
popups: [...p.popups,
|
|
1318
|
-
activePopupId:
|
|
1319
|
-
isLoading: !1
|
|
1326
|
+
popups: [...p.popups, f],
|
|
1327
|
+
activePopupId: f.popupId,
|
|
1328
|
+
isLoading: !1,
|
|
1329
|
+
zIndexSeed: i
|
|
1320
1330
|
}));
|
|
1321
1331
|
} catch (t) {
|
|
1322
1332
|
r({
|
|
@@ -1325,6 +1335,58 @@ const se = (r) => {
|
|
|
1325
1335
|
});
|
|
1326
1336
|
}
|
|
1327
1337
|
},
|
|
1338
|
+
// 로컬 팝업 열기 (DB 조회 없이 레지스트리 매핑으로 렌더)
|
|
1339
|
+
openCorePopup: (e, n) => {
|
|
1340
|
+
const o = `popup_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, t = s().zIndexSeed + 1, c = Y[e]?.defaultConfig || {}, d = {
|
|
1341
|
+
...c,
|
|
1342
|
+
...n,
|
|
1343
|
+
// buttons와 callback은 완전히 덮어쓰기 (병합하지 않음)
|
|
1344
|
+
buttons: n?.buttons !== void 0 ? n.buttons : c.buttons,
|
|
1345
|
+
callback: n?.callback !== void 0 ? n.callback : c.callback
|
|
1346
|
+
}, u = n?.defaultParams || {}, i = s().popups.find(
|
|
1347
|
+
(m) => m.popupCode === e && m.isLocal
|
|
1348
|
+
);
|
|
1349
|
+
if (i) {
|
|
1350
|
+
const m = s().zIndexSeed + 1;
|
|
1351
|
+
r({ activePopupId: i.popupId, zIndexSeed: m }), r((p) => ({
|
|
1352
|
+
popups: p.popups.map(
|
|
1353
|
+
(I) => I.popupId === i.popupId ? {
|
|
1354
|
+
...I,
|
|
1355
|
+
config: d,
|
|
1356
|
+
zIndex: m,
|
|
1357
|
+
close: () => {
|
|
1358
|
+
s().closePopup(i.popupId);
|
|
1359
|
+
}
|
|
1360
|
+
} : I
|
|
1361
|
+
)
|
|
1362
|
+
}));
|
|
1363
|
+
return;
|
|
1364
|
+
}
|
|
1365
|
+
const f = {
|
|
1366
|
+
popupId: o,
|
|
1367
|
+
popupCode: e,
|
|
1368
|
+
popupTitle: d.title || e,
|
|
1369
|
+
popupUrl: "",
|
|
1370
|
+
// 로컬 팝업은 URL 사용 안 함
|
|
1371
|
+
popupParams: u,
|
|
1372
|
+
width: d.width || 1e3,
|
|
1373
|
+
height: d.height || 700,
|
|
1374
|
+
resizable: d.resizable !== void 0 ? d.resizable : !0,
|
|
1375
|
+
draggable: d.draggable !== void 0 ? d.draggable : !0,
|
|
1376
|
+
buttonList: [],
|
|
1377
|
+
config: d,
|
|
1378
|
+
isLocal: !0,
|
|
1379
|
+
zIndex: t,
|
|
1380
|
+
close: () => {
|
|
1381
|
+
s().closePopup(o);
|
|
1382
|
+
}
|
|
1383
|
+
};
|
|
1384
|
+
r((m) => ({
|
|
1385
|
+
popups: [...m.popups, f],
|
|
1386
|
+
activePopupId: o,
|
|
1387
|
+
zIndexSeed: t
|
|
1388
|
+
}));
|
|
1389
|
+
},
|
|
1328
1390
|
// 팝업 닫기
|
|
1329
1391
|
closePopup: (e) => {
|
|
1330
1392
|
const { popups: n, activePopupId: o } = s(), t = n.filter((c) => c.popupId !== e);
|
|
@@ -1343,7 +1405,14 @@ const se = (r) => {
|
|
|
1343
1405
|
},
|
|
1344
1406
|
// 활성 팝업 설정
|
|
1345
1407
|
setActivePopup: (e) => {
|
|
1346
|
-
|
|
1408
|
+
const n = s().zIndexSeed + 1;
|
|
1409
|
+
r((o) => ({
|
|
1410
|
+
activePopupId: e,
|
|
1411
|
+
zIndexSeed: n,
|
|
1412
|
+
popups: o.popups.map(
|
|
1413
|
+
(t) => t.popupId === e ? { ...t, zIndex: n } : t
|
|
1414
|
+
)
|
|
1415
|
+
}));
|
|
1347
1416
|
},
|
|
1348
1417
|
// 팝업 설정 업데이트
|
|
1349
1418
|
updatePopupConfig: (e, n) => {
|
|
@@ -1353,7 +1422,7 @@ const se = (r) => {
|
|
|
1353
1422
|
)
|
|
1354
1423
|
}));
|
|
1355
1424
|
}
|
|
1356
|
-
})),
|
|
1425
|
+
})), ge = b((r) => ({
|
|
1357
1426
|
requestCount: 0,
|
|
1358
1427
|
loading: !1,
|
|
1359
1428
|
showLoading: () => r((s) => {
|
|
@@ -1364,7 +1433,7 @@ const se = (r) => {
|
|
|
1364
1433
|
const e = Math.max(0, s.requestCount - 1);
|
|
1365
1434
|
return { requestCount: e, loading: e > 0 };
|
|
1366
1435
|
})
|
|
1367
|
-
})),
|
|
1436
|
+
})), Ce = b((r) => ({
|
|
1368
1437
|
requestCount: 0,
|
|
1369
1438
|
loading: !1,
|
|
1370
1439
|
showLoading: () => r((s) => {
|
|
@@ -1375,22 +1444,22 @@ const se = (r) => {
|
|
|
1375
1444
|
const e = Math.max(0, s.requestCount - 1);
|
|
1376
1445
|
return { requestCount: e, loading: e > 0 };
|
|
1377
1446
|
})
|
|
1378
|
-
})),
|
|
1447
|
+
})), be = () => W.getState(), ye = () => ie.getState(), ke = () => Z.getState(), ve = () => V.getState(), Se = () => z.getState(), Me = () => le.getState();
|
|
1379
1448
|
export {
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1449
|
+
be as useCode,
|
|
1450
|
+
W as useCodeStore,
|
|
1451
|
+
Ie as useColorStore,
|
|
1452
|
+
ve as useFavorite,
|
|
1453
|
+
V as useFavoriteStore,
|
|
1454
|
+
ge as useLoadingStore,
|
|
1455
|
+
Se as useMenuModel,
|
|
1456
|
+
z as useMenuModelStore,
|
|
1457
|
+
Me as useMenuView,
|
|
1458
|
+
le as useMenuViewStore,
|
|
1459
|
+
fe as useOptionStore,
|
|
1460
|
+
Ce as usePopupLoadingStore,
|
|
1461
|
+
ye as usePopupState,
|
|
1462
|
+
ie as usePopupStore,
|
|
1463
|
+
ke as useUser,
|
|
1464
|
+
Z as useUserStore
|
|
1396
1465
|
};
|