@simplysm/angular 14.0.19 → 14.0.22
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/core/provideSdAngular.js +1 -1
- package/dist/core/providers/sd-activated-modal.provider.d.ts +13 -0
- package/dist/core/providers/sd-activated-modal.provider.d.ts.map +1 -0
- package/dist/core/providers/sd-activated-modal.provider.js +15 -0
- package/dist/core/providers/sd-app-structure.provider.d.ts +3 -64
- package/dist/core/providers/sd-app-structure.provider.d.ts.map +1 -1
- package/dist/core/providers/sd-app-structure.provider.js +1 -252
- package/dist/core/providers/sd-app-structure.types.d.ts +52 -0
- package/dist/core/providers/sd-app-structure.types.d.ts.map +1 -0
- package/dist/core/providers/sd-app-structure.types.js +1 -0
- package/dist/core/providers/sd-app-structure.utils.d.ts +13 -0
- package/dist/core/providers/sd-app-structure.utils.d.ts.map +1 -0
- package/dist/core/providers/sd-app-structure.utils.js +250 -0
- package/dist/{ui/overlay/busy → core/providers}/sd-busy.provider.d.ts +1 -1
- package/dist/core/providers/sd-busy.provider.d.ts.map +1 -0
- package/dist/{ui/overlay/busy → core/providers}/sd-busy.provider.js +1 -1
- package/dist/core/providers/sd-print.provider.js +1 -1
- package/dist/core/providers/sd-service-client-factory.provider.js +1 -1
- package/dist/{ui/overlay/toast → core/providers}/sd-toast.provider.d.ts +1 -1
- package/dist/core/providers/sd-toast.provider.d.ts.map +1 -0
- package/dist/{ui/overlay/toast → core/providers}/sd-toast.provider.js +3 -3
- package/dist/core/types/select-modal-output-result.d.ts +8 -0
- package/dist/core/types/select-modal-output-result.d.ts.map +1 -0
- package/dist/core/types/select-modal-output-result.js +1 -0
- package/dist/core/utils/setups/setupCanDeactivate.js +1 -1
- package/dist/core/utils/useViewTitleSignal.js +1 -1
- package/dist/core/utils/useViewTypeSignal.js +1 -1
- package/dist/features/base/sd-base-container.control.js +1 -1
- package/dist/features/data-view/sd-data-detail.control.js +1 -1
- package/dist/features/data-view/sd-data-sheet.control.d.ts +24 -37
- package/dist/features/data-view/sd-data-sheet.control.d.ts.map +1 -1
- package/dist/features/data-view/sd-data-sheet.control.js +98 -152
- package/dist/features/data-view/sd-data-sheet.types.d.ts +17 -0
- package/dist/features/data-view/sd-data-sheet.types.d.ts.map +1 -0
- package/dist/features/data-view/sd-data-sheet.types.js +1 -0
- package/dist/{core/utils/setups → features/data-view}/setupCloserWhenSingleSelectionChange.d.ts +1 -1
- package/dist/features/data-view/setupCloserWhenSingleSelectionChange.d.ts.map +1 -0
- package/dist/features/data-view/useDataSheetExcelManager.d.ts +14 -0
- package/dist/features/data-view/useDataSheetExcelManager.d.ts.map +1 -0
- package/dist/features/data-view/useDataSheetExcelManager.js +31 -0
- package/dist/features/data-view/useDataSheetFilterManager.d.ts +13 -0
- package/dist/features/data-view/useDataSheetFilterManager.d.ts.map +1 -0
- package/dist/features/data-view/useDataSheetFilterManager.js +19 -0
- package/dist/features/data-view/useDataSheetInlineEditManager.d.ts +26 -0
- package/dist/features/data-view/useDataSheetInlineEditManager.d.ts.map +1 -0
- package/dist/features/data-view/useDataSheetInlineEditManager.js +54 -0
- package/dist/features/data-view/useDataSheetModalEditManager.d.ts +19 -0
- package/dist/features/data-view/useDataSheetModalEditManager.d.ts.map +1 -0
- package/dist/features/data-view/useDataSheetModalEditManager.js +44 -0
- package/dist/features/data-view/useDataSheetRefreshManager.d.ts +25 -0
- package/dist/features/data-view/useDataSheetRefreshManager.d.ts.map +1 -0
- package/dist/features/data-view/useDataSheetRefreshManager.js +50 -0
- package/dist/features/permission-table/sd-permission-table.control.d.ts +1 -1
- package/dist/features/permission-table/sd-permission-table.control.d.ts.map +1 -1
- package/dist/index.d.ts +12 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -5
- package/dist/ui/data/sheet/sd-sheet-config.modal.d.ts +1 -2
- package/dist/ui/data/sheet/sd-sheet-config.modal.d.ts.map +1 -1
- package/dist/ui/data/sheet/sd-sheet-config.modal.js +8 -11
- package/dist/ui/data/sheet/sd-sheet.control.d.ts +22 -30
- package/dist/ui/data/sheet/sd-sheet.control.d.ts.map +1 -1
- package/dist/ui/data/sheet/sd-sheet.control.js +52 -210
- package/dist/ui/data/sheet/useSheetCellStyling.d.ts +22 -0
- package/dist/ui/data/sheet/useSheetCellStyling.d.ts.map +1 -0
- package/dist/ui/data/sheet/useSheetCellStyling.js +95 -0
- package/dist/ui/data/sheet/useSheetColumnResizing.d.ts +17 -0
- package/dist/ui/data/sheet/useSheetColumnResizing.d.ts.map +1 -0
- package/dist/ui/data/sheet/useSheetColumnResizing.js +65 -0
- package/dist/ui/data/sheet/useSheetDisplayPipeline.d.ts +24 -0
- package/dist/ui/data/sheet/useSheetDisplayPipeline.d.ts.map +1 -0
- package/dist/ui/data/sheet/useSheetDisplayPipeline.js +52 -0
- package/dist/ui/form/button/sd-modal-select-button.control.d.ts +1 -7
- package/dist/ui/form/button/sd-modal-select-button.control.d.ts.map +1 -1
- package/dist/ui/form/button/sd-modal-select-button.control.js +1 -1
- package/dist/ui/form/choice/sd-state-preset.control.js +1 -1
- package/dist/ui/form/select/sd-select.control.d.ts +1 -1
- package/dist/ui/form/select/sd-select.control.d.ts.map +1 -1
- package/dist/ui/form/select/sd-select.control.js +23 -27
- package/dist/ui/layout/sd-gap.control.d.ts +1 -2
- package/dist/ui/layout/sd-gap.control.d.ts.map +1 -1
- package/dist/ui/layout/sd-gap.control.js +22 -24
- package/dist/ui/navigation/menu-utils.d.ts +2 -7
- package/dist/ui/navigation/menu-utils.d.ts.map +1 -1
- package/dist/ui/overlay/busy/sd-busy-container.control.d.ts +1 -1
- package/dist/ui/overlay/busy/sd-busy-container.control.d.ts.map +1 -1
- package/dist/ui/overlay/busy/sd-busy-container.control.js +1 -1
- package/dist/ui/overlay/modal/sd-confirm-modal.control.d.ts.map +1 -1
- package/dist/ui/overlay/modal/sd-confirm-modal.control.js +29 -23
- package/dist/ui/overlay/modal/sd-modal.control.js +1 -1
- package/dist/ui/overlay/modal/sd-modal.provider.d.ts +0 -10
- package/dist/ui/overlay/modal/sd-modal.provider.d.ts.map +1 -1
- package/dist/ui/overlay/modal/sd-modal.provider.js +1 -13
- package/dist/ui/overlay/modal/sd-prompt-modal.control.d.ts.map +1 -1
- package/dist/ui/overlay/modal/sd-prompt-modal.control.js +40 -33
- package/dist/ui/overlay/toast/sd-toast.control.d.ts +1 -1
- package/dist/ui/overlay/toast/sd-toast.control.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/core/provideSdAngular.ts +1 -1
- package/src/core/providers/sd-activated-modal.provider.ts +12 -0
- package/src/core/providers/sd-app-structure.provider.ts +2 -405
- package/src/core/providers/sd-app-structure.types.ts +60 -0
- package/src/core/providers/sd-app-structure.utils.ts +350 -0
- package/src/{ui/overlay/busy → core/providers}/sd-busy.provider.ts +1 -1
- package/src/core/providers/sd-print.provider.ts +1 -1
- package/src/core/providers/sd-service-client-factory.provider.ts +1 -1
- package/src/{ui/overlay/toast → core/providers}/sd-toast.provider.ts +4 -4
- package/src/core/types/select-modal-output-result.ts +7 -0
- package/src/core/utils/setups/setupCanDeactivate.ts +1 -1
- package/src/core/utils/useViewTitleSignal.ts +1 -1
- package/src/core/utils/useViewTypeSignal.ts +1 -1
- package/src/features/base/sd-base-container.control.ts +1 -1
- package/src/features/data-view/sd-data-detail.control.ts +1 -1
- package/src/features/data-view/sd-data-sheet.control.ts +117 -216
- package/src/features/data-view/sd-data-sheet.types.ts +18 -0
- package/src/{core/utils/setups → features/data-view}/setupCloserWhenSingleSelectionChange.ts +1 -1
- package/src/features/data-view/useDataSheetExcelManager.ts +57 -0
- package/src/features/data-view/useDataSheetFilterManager.ts +30 -0
- package/src/features/data-view/useDataSheetInlineEditManager.ts +89 -0
- package/src/features/data-view/useDataSheetModalEditManager.ts +76 -0
- package/src/features/data-view/useDataSheetRefreshManager.ts +90 -0
- package/src/features/permission-table/sd-permission-table.control.ts +1 -1
- package/src/index.ts +17 -11
- package/src/ui/data/sheet/sd-sheet-config.modal.ts +7 -11
- package/src/ui/data/sheet/sd-sheet.control.ts +50 -238
- package/src/ui/data/sheet/useSheetCellStyling.ts +113 -0
- package/src/ui/data/sheet/useSheetColumnResizing.ts +92 -0
- package/src/ui/data/sheet/useSheetDisplayPipeline.ts +64 -0
- package/src/ui/form/button/sd-modal-select-button.control.ts +1 -8
- package/src/ui/form/choice/sd-state-preset.control.ts +1 -1
- package/src/ui/form/select/sd-select.control.ts +21 -26
- package/src/ui/layout/sd-gap.control.ts +17 -21
- package/src/ui/navigation/menu-utils.ts +3 -7
- package/src/ui/overlay/busy/sd-busy-container.control.ts +1 -1
- package/src/ui/overlay/modal/sd-confirm-modal.control.ts +8 -26
- package/src/ui/overlay/modal/sd-modal.control.ts +1 -1
- package/src/ui/overlay/modal/sd-modal.provider.ts +1 -10
- package/src/ui/overlay/modal/sd-prompt-modal.control.ts +17 -43
- package/src/ui/overlay/toast/sd-toast.control.ts +1 -1
- package/dist/core/utils/setups/setupCloserWhenSingleSelectionChange.d.ts.map +0 -1
- package/dist/ui/overlay/busy/sd-busy.provider.d.ts.map +0 -1
- package/dist/ui/overlay/toast/sd-toast.provider.d.ts.map +0 -1
- /package/dist/{core/utils/setups → features/data-view}/setupCloserWhenSingleSelectionChange.js +0 -0
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
TSdAppStructureItem,
|
|
3
|
+
ISdMenu,
|
|
4
|
+
ISdFlatMenu,
|
|
5
|
+
ISdPermission,
|
|
6
|
+
ISdFlatPermission,
|
|
7
|
+
} from "./sd-app-structure.types";
|
|
8
|
+
|
|
9
|
+
export abstract class SdAppStructureUtils {
|
|
10
|
+
//---------- Info
|
|
11
|
+
|
|
12
|
+
static getTitleByFullCode<TModule>(items: TSdAppStructureItem<TModule>[], fullCode: string) {
|
|
13
|
+
const itemChain = this.getItemChainByFullCode(items, fullCode);
|
|
14
|
+
if (itemChain.length === 0) {
|
|
15
|
+
throw new Error(`Item not found for fullCode: ${fullCode}`);
|
|
16
|
+
}
|
|
17
|
+
const parent = itemChain
|
|
18
|
+
.slice(0, -1)
|
|
19
|
+
.map((item) => item.title)
|
|
20
|
+
.join(" > ");
|
|
21
|
+
const current = itemChain.last()!.title;
|
|
22
|
+
return (parent ? `[${parent}] ` : "") + current;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static getPermsByFullCode<TModule, K extends string>(
|
|
26
|
+
items: TSdAppStructureItem<TModule>[],
|
|
27
|
+
fullCodes: string[],
|
|
28
|
+
permKeys: K[],
|
|
29
|
+
permRecord: Record<string, boolean> | undefined,
|
|
30
|
+
): K[] {
|
|
31
|
+
if (permRecord === undefined) return [] as K[];
|
|
32
|
+
|
|
33
|
+
const result = [] as K[];
|
|
34
|
+
for (const permKey of permKeys) {
|
|
35
|
+
// 해당 권한이 설정되어있거나
|
|
36
|
+
if (fullCodes.some((fullCode) => permRecord[fullCode + "." + permKey])) {
|
|
37
|
+
result.push(permKey);
|
|
38
|
+
}
|
|
39
|
+
// 권한이라는것이 아얘 존재하지 않거나
|
|
40
|
+
else if (
|
|
41
|
+
fullCodes.every((fullCode) => {
|
|
42
|
+
const item = this.getItemChainByFullCode(items, fullCode).last();
|
|
43
|
+
return item != null && !("perms" in item);
|
|
44
|
+
})
|
|
45
|
+
) {
|
|
46
|
+
result.push(permKey);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static getItemChainByFullCode<TModule>(
|
|
54
|
+
items: TSdAppStructureItem<TModule>[],
|
|
55
|
+
fullCode: string,
|
|
56
|
+
): TSdAppStructureItem<TModule>[] {
|
|
57
|
+
const codeChain = fullCode.split(".");
|
|
58
|
+
|
|
59
|
+
const result: TSdAppStructureItem<TModule>[] = [];
|
|
60
|
+
|
|
61
|
+
let cursorChildren = items;
|
|
62
|
+
for (const currCode of codeChain) {
|
|
63
|
+
const cursor = cursorChildren.single((item) => item.code === currCode);
|
|
64
|
+
if (cursor == null) return [];
|
|
65
|
+
cursorChildren = "children" in cursor ? cursor.children : [];
|
|
66
|
+
result.push(cursor);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//---------- Menus
|
|
73
|
+
|
|
74
|
+
static getMenus<TModule>(
|
|
75
|
+
items: TSdAppStructureItem<TModule>[],
|
|
76
|
+
codeChain: string[],
|
|
77
|
+
usableModules: TModule[] | undefined,
|
|
78
|
+
permRecord: Record<string, boolean> | undefined,
|
|
79
|
+
): ISdMenu[] {
|
|
80
|
+
const resultMenus: ISdMenu[] = [];
|
|
81
|
+
|
|
82
|
+
for (const item of items) {
|
|
83
|
+
if ("isNotMenu" in item && item.isNotMenu) continue;
|
|
84
|
+
|
|
85
|
+
const currCodeChain = [...codeChain, item.code];
|
|
86
|
+
|
|
87
|
+
// 모듈 활성화 여부 확인
|
|
88
|
+
if (!this._isUsableModules(item.modules, item.requiredModules, usableModules)) continue;
|
|
89
|
+
|
|
90
|
+
// 그룹 메뉴
|
|
91
|
+
if ("children" in item) {
|
|
92
|
+
const children = this.getMenus(item.children, currCodeChain, usableModules, permRecord);
|
|
93
|
+
|
|
94
|
+
// 자식 중 표시 가능한 게 있으면 그룹 메뉴 포함
|
|
95
|
+
if (children.length > 0) {
|
|
96
|
+
resultMenus.push({
|
|
97
|
+
title: item.title,
|
|
98
|
+
icon: item.icon,
|
|
99
|
+
codeChain: currCodeChain,
|
|
100
|
+
children,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// Leaf 메뉴
|
|
105
|
+
else {
|
|
106
|
+
const code = currCodeChain.join(".");
|
|
107
|
+
|
|
108
|
+
if (item.perms != null && !permRecord?.[code + ".use"]) continue;
|
|
109
|
+
|
|
110
|
+
resultMenus.push({
|
|
111
|
+
title: item.title,
|
|
112
|
+
icon: item.icon,
|
|
113
|
+
codeChain: currCodeChain,
|
|
114
|
+
url: item.url,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return resultMenus;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
static getFlatMenus<TModule>(
|
|
123
|
+
items: TSdAppStructureItem<TModule>[],
|
|
124
|
+
usableModules: TModule[] | undefined,
|
|
125
|
+
permRecord: Record<string, boolean> | undefined,
|
|
126
|
+
): ISdFlatMenu<TModule>[] {
|
|
127
|
+
const resultFlatMenus: ISdFlatMenu<TModule>[] = [];
|
|
128
|
+
|
|
129
|
+
type QueueItem = {
|
|
130
|
+
item: TSdAppStructureItem<TModule>;
|
|
131
|
+
titleChain: string[];
|
|
132
|
+
codeChain: string[];
|
|
133
|
+
modulesChain: TModule[][];
|
|
134
|
+
requiredModulesChain: TModule[][];
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const queue: QueueItem[] = items.map((item) => ({
|
|
138
|
+
item,
|
|
139
|
+
titleChain: [],
|
|
140
|
+
codeChain: [],
|
|
141
|
+
modulesChain: [],
|
|
142
|
+
requiredModulesChain: [],
|
|
143
|
+
}));
|
|
144
|
+
|
|
145
|
+
while (queue.length > 0) {
|
|
146
|
+
const { item, titleChain, codeChain, modulesChain, requiredModulesChain } = queue.shift()!;
|
|
147
|
+
|
|
148
|
+
if ("isNotMenu" in item && item.isNotMenu) continue;
|
|
149
|
+
|
|
150
|
+
const currTitleChain = [...titleChain, item.title];
|
|
151
|
+
const currCodeChain = [...codeChain, item.code];
|
|
152
|
+
const currModulesChain = item.modules ? [...modulesChain, item.modules] : modulesChain;
|
|
153
|
+
const currRequiredModulesChain = item.requiredModules
|
|
154
|
+
? [...requiredModulesChain, item.requiredModules]
|
|
155
|
+
: requiredModulesChain;
|
|
156
|
+
|
|
157
|
+
if (!this._isUsableModulesChain(currModulesChain, currRequiredModulesChain, usableModules))
|
|
158
|
+
continue;
|
|
159
|
+
|
|
160
|
+
if ("children" in item) {
|
|
161
|
+
for (const child of item.children) {
|
|
162
|
+
queue.push({
|
|
163
|
+
item: child,
|
|
164
|
+
titleChain: currTitleChain,
|
|
165
|
+
codeChain: currCodeChain,
|
|
166
|
+
modulesChain: currModulesChain,
|
|
167
|
+
requiredModulesChain: currRequiredModulesChain,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
} else if (item.perms == null || Boolean(permRecord?.[currCodeChain.join(".") + ".use"])) {
|
|
171
|
+
resultFlatMenus.push({
|
|
172
|
+
titleChain: currTitleChain,
|
|
173
|
+
codeChain: currCodeChain,
|
|
174
|
+
modulesChain: currModulesChain,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return resultFlatMenus;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
//---------- Perms
|
|
183
|
+
|
|
184
|
+
static getPermissions<TModule>(
|
|
185
|
+
items: TSdAppStructureItem<TModule>[],
|
|
186
|
+
codeChain: string[],
|
|
187
|
+
usableModules: TModule[] | undefined,
|
|
188
|
+
): ISdPermission<TModule>[] {
|
|
189
|
+
const results: ISdPermission<TModule>[] = [];
|
|
190
|
+
for (const item of items) {
|
|
191
|
+
const currCodeChain = [...codeChain, item.code];
|
|
192
|
+
|
|
193
|
+
// 모듈 활성화 여부 확인
|
|
194
|
+
if (!this._isUsableModules(item.modules, item.requiredModules, usableModules)) continue;
|
|
195
|
+
|
|
196
|
+
// 그룹
|
|
197
|
+
if ("children" in item) {
|
|
198
|
+
const children = this.getPermissions(item.children, currCodeChain, usableModules);
|
|
199
|
+
|
|
200
|
+
results.push({
|
|
201
|
+
title: item.title,
|
|
202
|
+
codeChain: currCodeChain,
|
|
203
|
+
modules: item.modules,
|
|
204
|
+
perms: undefined,
|
|
205
|
+
children: children,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
// Leaf
|
|
209
|
+
else {
|
|
210
|
+
results.push({
|
|
211
|
+
title: item.title,
|
|
212
|
+
codeChain: currCodeChain,
|
|
213
|
+
perms: item.perms,
|
|
214
|
+
modules: item.modules,
|
|
215
|
+
children: item.subPerms?.map((subPerm) => ({
|
|
216
|
+
title: subPerm.title,
|
|
217
|
+
codeChain: [...currCodeChain, subPerm.code],
|
|
218
|
+
perms: subPerm.perms,
|
|
219
|
+
modules: subPerm.modules,
|
|
220
|
+
children: undefined,
|
|
221
|
+
})),
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return results;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
static getFlatPermissions<TModule>(
|
|
230
|
+
items: TSdAppStructureItem<TModule>[],
|
|
231
|
+
usableModules: TModule[] | undefined,
|
|
232
|
+
) {
|
|
233
|
+
const results: ISdFlatPermission<TModule>[] = [];
|
|
234
|
+
|
|
235
|
+
type QueueItem = {
|
|
236
|
+
item: TSdAppStructureItem<TModule>;
|
|
237
|
+
titleChain: string[];
|
|
238
|
+
codeChain: string[];
|
|
239
|
+
modulesChain: TModule[][];
|
|
240
|
+
requiredModulesChain: TModule[][];
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
const queue: QueueItem[] = items.map((item) => ({
|
|
244
|
+
item,
|
|
245
|
+
titleChain: [],
|
|
246
|
+
codeChain: [],
|
|
247
|
+
modulesChain: [],
|
|
248
|
+
requiredModulesChain: [],
|
|
249
|
+
}));
|
|
250
|
+
|
|
251
|
+
while (queue.length > 0) {
|
|
252
|
+
const { item, titleChain, codeChain, modulesChain, requiredModulesChain } = queue.shift()!;
|
|
253
|
+
|
|
254
|
+
const currTitleChain = [...titleChain, item.title];
|
|
255
|
+
const currCodeChain = [...codeChain, item.code];
|
|
256
|
+
const currModulesChain = item.modules ? [...modulesChain, item.modules] : modulesChain;
|
|
257
|
+
const currRequiredModulesChain = item.requiredModules
|
|
258
|
+
? [...requiredModulesChain, item.requiredModules]
|
|
259
|
+
: requiredModulesChain;
|
|
260
|
+
|
|
261
|
+
if (!this._isUsableModulesChain(currModulesChain, currRequiredModulesChain, usableModules))
|
|
262
|
+
continue;
|
|
263
|
+
|
|
264
|
+
// 1. 자식 enqueue
|
|
265
|
+
if ("children" in item) {
|
|
266
|
+
for (const child of item.children) {
|
|
267
|
+
queue.push({
|
|
268
|
+
item: child,
|
|
269
|
+
titleChain: currTitleChain,
|
|
270
|
+
codeChain: currCodeChain,
|
|
271
|
+
modulesChain: currModulesChain,
|
|
272
|
+
requiredModulesChain: currRequiredModulesChain,
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// 1. 직접 perms 처리
|
|
278
|
+
if ("perms" in item) {
|
|
279
|
+
for (const perm of item.perms ?? []) {
|
|
280
|
+
results.push({
|
|
281
|
+
titleChain: currTitleChain,
|
|
282
|
+
codeChain: [...currCodeChain, perm],
|
|
283
|
+
modulesChain: currModulesChain,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// 2. subPerms 처리
|
|
289
|
+
if ("subPerms" in item) {
|
|
290
|
+
for (const subPerm of item.subPerms ?? []) {
|
|
291
|
+
// subPerm도 모듈 체크
|
|
292
|
+
if (!this._isUsableModules(subPerm.modules, subPerm.requiredModules, usableModules))
|
|
293
|
+
continue;
|
|
294
|
+
|
|
295
|
+
for (const perm of subPerm.perms) {
|
|
296
|
+
results.push({
|
|
297
|
+
titleChain: currTitleChain,
|
|
298
|
+
codeChain: [...currCodeChain, subPerm.code, perm],
|
|
299
|
+
modulesChain: [...currModulesChain, subPerm.modules ?? []],
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return results;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
//-- Modules (private)
|
|
310
|
+
|
|
311
|
+
private static _isUsableModulesChain<TModule>(
|
|
312
|
+
modulesChain: TModule[][],
|
|
313
|
+
requiredModulesChain: TModule[][],
|
|
314
|
+
usableModules: TModule[] | undefined,
|
|
315
|
+
) {
|
|
316
|
+
// 각 레벨의 modules (OR) 체크
|
|
317
|
+
for (const modules of modulesChain) {
|
|
318
|
+
if (!this._isUsableModules(modules, undefined, usableModules)) {
|
|
319
|
+
return false;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// 각 레벨의 requiredModules (AND) 체크
|
|
324
|
+
for (const requiredModules of requiredModulesChain) {
|
|
325
|
+
if (!this._isUsableModules(undefined, requiredModules, usableModules)) {
|
|
326
|
+
return false;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
return true;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
private static _isUsableModules<TModule>(
|
|
334
|
+
modules: TModule[] | undefined,
|
|
335
|
+
requiredModules: TModule[] | undefined,
|
|
336
|
+
usableModules: TModule[] | undefined,
|
|
337
|
+
): boolean {
|
|
338
|
+
// 1. requiredModules: 모두 있어야 함 (AND)
|
|
339
|
+
if (requiredModules && requiredModules.length > 0) {
|
|
340
|
+
if (!requiredModules.every((m) => usableModules?.includes(m))) {
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// 2. modules: 하나라도 있으면 됨 (OR)
|
|
346
|
+
return (
|
|
347
|
+
modules == null || modules.length === 0 || modules.some((m) => usableModules?.includes(m))
|
|
348
|
+
);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
signal,
|
|
9
9
|
type ComponentRef,
|
|
10
10
|
} from "@angular/core";
|
|
11
|
-
import { SdBusyContainerControl } from "
|
|
11
|
+
import { SdBusyContainerControl } from "../../ui/overlay/busy/sd-busy-container.control";
|
|
12
12
|
|
|
13
13
|
export type TSdBusyType = "spinner" | "bar" | "cube";
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
type Type,
|
|
9
9
|
} from "@angular/core";
|
|
10
10
|
import type { TDirectiveInputSignals, TWithOptional } from "../utils/TDirectiveInputSignals";
|
|
11
|
-
import { SdBusyProvider } from "
|
|
11
|
+
import { SdBusyProvider } from "./sd-busy.provider";
|
|
12
12
|
import { wait } from "@simplysm/core-common";
|
|
13
13
|
import { jsPDF } from "jspdf";
|
|
14
14
|
import * as htmlToImage from "html-to-image";
|
|
@@ -2,7 +2,7 @@ import { DestroyRef, inject, Injectable, type WritableSignal } from "@angular/co
|
|
|
2
2
|
import type { ServiceConnectionOptions, ServiceProgressState } from "@simplysm/service-client";
|
|
3
3
|
import { createServiceClient, ServiceClient } from "@simplysm/service-client";
|
|
4
4
|
import { SdAngularConfigProvider } from "./sd-angular-config.provider";
|
|
5
|
-
import { SdToastProvider } from "
|
|
5
|
+
import { SdToastProvider } from "./sd-toast.provider";
|
|
6
6
|
|
|
7
7
|
@Injectable({ providedIn: "root" })
|
|
8
8
|
export class SdServiceClientFactoryProvider {
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
type WritableSignal,
|
|
14
14
|
} from "@angular/core";
|
|
15
15
|
import { outputToObservable } from "@angular/core/rxjs-interop";
|
|
16
|
-
import type { TDirectiveInputSignals } from "
|
|
17
|
-
import { SdToastControl } from "
|
|
18
|
-
import { SdToastContainerControl } from "
|
|
19
|
-
import { SdSystemLogProvider } from "
|
|
16
|
+
import type { TDirectiveInputSignals } from "../utils/TDirectiveInputSignals";
|
|
17
|
+
import { SdToastControl } from "../../ui/overlay/toast/sd-toast.control";
|
|
18
|
+
import { SdToastContainerControl } from "../../ui/overlay/toast/sd-toast-container.control";
|
|
19
|
+
import { SdSystemLogProvider } from "./sd-system-log.provider";
|
|
20
20
|
import "@simplysm/core-browser";
|
|
21
21
|
|
|
22
22
|
export type TSdToastSeverity = "info" | "success" | "warning" | "danger";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DestroyRef, ElementRef, inject, reflectComponentType } from "@angular/core";
|
|
2
2
|
import { ActivatedRoute, type CanDeactivateFn } from "@angular/router";
|
|
3
|
-
import { SdActivatedModalProvider } from "
|
|
3
|
+
import { SdActivatedModalProvider } from "../../providers/sd-activated-modal.provider";
|
|
4
4
|
|
|
5
5
|
export function setupCanDeactivate(fn: () => boolean): void {
|
|
6
6
|
const activatedModal = inject(SdActivatedModalProvider, { optional: true });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { computed, inject, type Signal } from "@angular/core";
|
|
2
|
-
import { SdActivatedModalProvider } from "
|
|
2
|
+
import { SdActivatedModalProvider } from "../providers/sd-activated-modal.provider";
|
|
3
3
|
import { SdAppStructureProvider } from "../providers/sd-app-structure.provider";
|
|
4
4
|
import { useFullPageCodeSignal } from "./useFullPageCodeSignal";
|
|
5
5
|
import { useCurrentPageCodeSignal } from "./useCurrentPageCodeSignal";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computed, inject, type Signal } from "@angular/core";
|
|
2
2
|
import { ActivatedRoute } from "@angular/router";
|
|
3
|
-
import { SdActivatedModalProvider } from "
|
|
3
|
+
import { SdActivatedModalProvider } from "../providers/sd-activated-modal.provider";
|
|
4
4
|
import { useCurrentPageCodeSignal } from "./useCurrentPageCodeSignal";
|
|
5
5
|
import { useFullPageCodeSignal } from "./useFullPageCodeSignal";
|
|
6
6
|
|
|
@@ -14,7 +14,7 @@ import { SdBusyContainerControl } from "../../ui/overlay/busy/sd-busy-container.
|
|
|
14
14
|
import { SdTopbarContainerControl } from "../../ui/navigation/topbar/sd-topbar-container.control";
|
|
15
15
|
import { SdTopbarControl } from "../../ui/navigation/topbar/sd-topbar.control";
|
|
16
16
|
import { SdAppStructureProvider } from "../../core/providers/sd-app-structure.provider";
|
|
17
|
-
import { SdActivatedModalProvider } from "../../
|
|
17
|
+
import { SdActivatedModalProvider } from "../../core/providers/sd-activated-modal.provider";
|
|
18
18
|
import { useCurrentPageCodeSignal } from "../../core/utils/useCurrentPageCodeSignal";
|
|
19
19
|
import { useFullPageCodeSignal } from "../../core/utils/useFullPageCodeSignal";
|
|
20
20
|
import {
|
|
@@ -25,7 +25,7 @@ import { SdButtonControl } from "../../ui/form/button/sd-button.control";
|
|
|
25
25
|
import { SdAnchorControl } from "../../ui/form/button/sd-anchor.control";
|
|
26
26
|
import { SdFormControl } from "../../ui/form/sd-form.control";
|
|
27
27
|
import { type ISdModal } from "../../ui/overlay/modal/sd-modal.provider";
|
|
28
|
-
import { SdToastProvider } from "../../
|
|
28
|
+
import { SdToastProvider } from "../../core/providers/sd-toast.provider";
|
|
29
29
|
import { SdBaseContainerControl } from "../base/sd-base-container.control";
|
|
30
30
|
import { NgIcon } from "@ng-icons/core";
|
|
31
31
|
import {
|