@uxland/primary-shell 7.2.2 → 7.3.0
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/index.js +124 -78
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +7 -7
- package/dist/index.umd.cjs.map +1 -1
- package/dist/primary/shell/src/UI/bootstrapper.d.ts +1 -1
- package/dist/primary/shell/src/UI/internal-views/handle-views.d.ts +1 -1
- package/dist/primary/shell/src/UI/internal-views/upper-nav-views.d.ts +3 -2
- package/dist/primary/shell/src/bootstrapper.d.ts +1 -1
- package/dist/primary/shell/src/domain/is-user-role-administrative.d.ts +1 -0
- package/package.json +1 -1
- package/src/UI/bootstrapper.ts +2 -2
- package/src/UI/internal-views/handle-views.ts +7 -8
- package/src/UI/internal-views/upper-nav-views.ts +28 -5
- package/src/bootstrapper.ts +2 -2
- package/src/domain/is-user-role-administrative.ts +1 -0
- package/src/handle-plugins.ts +2 -1
- package/dist/primary/shell/src/UI/internal-views/lower-nav-menu-views.d.ts +0 -1
- package/src/UI/internal-views/lower-nav-menu-views.ts +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useUI: () => void;
|
|
1
|
+
export declare const useUI: (userRole?: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useInternalViews: () => void;
|
|
1
|
+
export declare const useInternalViews: (userRole?: string) => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const
|
|
1
|
+
export declare const registerDoctorNavMenuViews: () => void;
|
|
2
|
+
export declare const registerAdministrativeNavMenuViews: () => void;
|
|
3
|
+
export declare const registerCommunicationNavMenu: () => void;
|
|
3
4
|
export declare const registerCommunicationMenuActions: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const initializeShell: (hostAppElement: HTMLElement) => void;
|
|
1
|
+
export declare const initializeShell: (hostAppElement: HTMLElement, userRole?: string) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isUserRoleAdministrative: (userRole?: string) => userRole is "ADM";
|
package/package.json
CHANGED
package/src/UI/bootstrapper.ts
CHANGED
|
@@ -3,12 +3,12 @@ import { useComponents } from "./components/bootstrapper";
|
|
|
3
3
|
import { useSharedUI } from "./shared-components/bootstrapper";
|
|
4
4
|
import { useInternalViews } from "./internal-views/handle-views";
|
|
5
5
|
|
|
6
|
-
export const useUI = () => {
|
|
6
|
+
export const useUI = (userRole?: string) => {
|
|
7
7
|
regionAdapterRegistry.registerAdapterFactory(
|
|
8
8
|
"primaria-content-switcher",
|
|
9
9
|
selectableAdapterFactory,
|
|
10
10
|
);
|
|
11
11
|
useSharedUI();
|
|
12
12
|
useComponents();
|
|
13
|
-
useInternalViews();
|
|
13
|
+
useInternalViews(userRole);
|
|
14
14
|
};
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { registerPDFVisorMainView } from "../../api/pdf-viewer-manager/handle-views";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { isUserRoleAdministrative } from "../../domain/is-user-role-administrative";
|
|
3
|
+
import { registerAdministrativeNavMenuViews, registerDoctorNavMenuViews } from "./upper-nav-views";
|
|
4
4
|
|
|
5
5
|
const registerMainViews = () => {
|
|
6
6
|
registerPDFVisorMainView();
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
export const useInternalViews = () => {
|
|
9
|
+
export const useInternalViews = (userRole?: string) => {
|
|
10
10
|
registerMainViews();
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
registerCommunicationMenuActions();
|
|
11
|
+
if(isUserRoleAdministrative(userRole))
|
|
12
|
+
registerAdministrativeNavMenuViews();
|
|
13
|
+
else
|
|
14
|
+
registerDoctorNavMenuViews();
|
|
16
15
|
};
|
|
@@ -30,7 +30,16 @@ type MenuItemConfig =
|
|
|
30
30
|
}[];
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
const
|
|
33
|
+
const commonNavMenuItems = [{
|
|
34
|
+
id: "landing",
|
|
35
|
+
icon: "home",
|
|
36
|
+
label: "Pàgina inici",
|
|
37
|
+
type: "item",
|
|
38
|
+
sortHint: "0010",
|
|
39
|
+
callbackFn: () => shellApi.broker.send(new ExitShell("OBRIR_PI")),
|
|
40
|
+
}];
|
|
41
|
+
|
|
42
|
+
const doctorNavMenuItems: MenuItemConfig[] = [
|
|
34
43
|
{
|
|
35
44
|
id: "landing",
|
|
36
45
|
icon: "home",
|
|
@@ -213,8 +222,20 @@ const upperNavMenuItems: MenuItemConfig[] = [
|
|
|
213
222
|
},
|
|
214
223
|
];
|
|
215
224
|
|
|
216
|
-
|
|
217
|
-
|
|
225
|
+
const administrativeNavMenuItems = [] as any;
|
|
226
|
+
|
|
227
|
+
export const registerDoctorNavMenuViews = () => {
|
|
228
|
+
registerCommunicationNavMenu();
|
|
229
|
+
registerNavMenuViews(doctorNavMenuItems);
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
export const registerAdministrativeNavMenuViews = () => {
|
|
233
|
+
registerNavMenuViews(administrativeNavMenuItems);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const registerNavMenuViews = (views: MenuItemConfig[]) => {
|
|
237
|
+
const finalViews = [...commonNavMenuItems, ...views];
|
|
238
|
+
for (const item of finalViews) {
|
|
218
239
|
shellApi.regionManager.registerView(shellApi.regionManager.regions.shell.navigationMenu, {
|
|
219
240
|
id: item.id,
|
|
220
241
|
sortHint: item.sortHint,
|
|
@@ -236,9 +257,9 @@ export const registerUpperNavMenuViews = () => {
|
|
|
236
257
|
},
|
|
237
258
|
});
|
|
238
259
|
}
|
|
239
|
-
}
|
|
260
|
+
}
|
|
240
261
|
|
|
241
|
-
export const
|
|
262
|
+
export const registerCommunicationNavMenu = () => {
|
|
242
263
|
shellApi.regionManager.registerView(shellApi.regionManager.regions.shell.navigationMenu, {
|
|
243
264
|
id: "communication",
|
|
244
265
|
sortHint: "0120",
|
|
@@ -248,6 +269,8 @@ export const registerCommunicationNavMenuItem = () => {
|
|
|
248
269
|
return Promise.resolve(menuItem);
|
|
249
270
|
},
|
|
250
271
|
});
|
|
272
|
+
|
|
273
|
+
registerCommunicationMenuActions();
|
|
251
274
|
};
|
|
252
275
|
|
|
253
276
|
export const registerCommunicationMenuActions = () => {
|
package/src/bootstrapper.ts
CHANGED
|
@@ -4,9 +4,9 @@ import { useFeatures } from "./features/bootstrapper";
|
|
|
4
4
|
import { useLocalization } from "./locales";
|
|
5
5
|
import { useUI } from "./UI/bootstrapper";
|
|
6
6
|
|
|
7
|
-
export const initializeShell = (hostAppElement: HTMLElement) => {
|
|
7
|
+
export const initializeShell = (hostAppElement: HTMLElement, userRole?: string) => {
|
|
8
8
|
useLocalization(shellApi);
|
|
9
|
-
useUI();
|
|
9
|
+
useUI(userRole);
|
|
10
10
|
useFeatures(shellApi);
|
|
11
11
|
const shell = new PrimariaShell();
|
|
12
12
|
hostAppElement.appendChild(shell as any);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const isUserRoleAdministrative = (userRole?: string) => userRole === "ADM";
|
package/src/handle-plugins.ts
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
dispose as adminClinicalMonitoringDispose,
|
|
15
15
|
} from "../../../plugins/admin-clinical-monitoring/src/plugin";
|
|
16
16
|
import { PrimariaApi, primariaApiFactory } from "./api/api";
|
|
17
|
+
import { isUserRoleAdministrative } from "./domain/is-user-role-administrative";
|
|
17
18
|
|
|
18
19
|
let bootstrappedPlugins = [] as BootstrappedPlugin[];
|
|
19
20
|
|
|
@@ -51,7 +52,7 @@ const administrativeInternalPlugins: PluginDefinition[] = [
|
|
|
51
52
|
];
|
|
52
53
|
|
|
53
54
|
const getPluginsByUserRole = (userRole?: string) => {
|
|
54
|
-
if (userRole
|
|
55
|
+
if (isUserRoleAdministrative(userRole)) {
|
|
55
56
|
return commonPlugins.concat(administrativeInternalPlugins);
|
|
56
57
|
}
|
|
57
58
|
return commonPlugins.concat(doctorInternalPlugins);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const registerLowerNavMenuViews: () => void;
|