@uxland/primary-shell 7.2.1 → 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.
@@ -1 +1 @@
1
- export declare const useUI: () => void;
1
+ export declare const useUI: (userRole?: string) => void;
@@ -2,7 +2,7 @@ import { LitElement } from 'lit';
2
2
  export declare class PocEventsEcap extends LitElement {
3
3
  render(): import('lit').TemplateResult<1>;
4
4
  sendPdfToViewer(): void;
5
- getPDFS(): void;
5
+ getPDFS(): import('../../../api/pdf-viewer-manager/pdf-viewer-manager').IPdfDocument[];
6
6
  goToLinkOnEcap(): void;
7
7
  static styles: import('lit').CSSResult;
8
8
  }
@@ -1 +1 @@
1
- export declare const useInternalViews: () => void;
1
+ export declare const useInternalViews: (userRole?: string) => void;
@@ -1,3 +1,4 @@
1
- export declare const registerUpperNavMenuViews: () => void;
2
- export declare const registerCommunicationNavMenuItem: () => void;
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;
@@ -1,2 +1 @@
1
1
  export declare const primariaShellId = "primaria-shell";
2
- export declare const pocTestEventsId = "poc-events-ecap";
@@ -0,0 +1 @@
1
+ export declare const isUserRoleAdministrative: (userRole?: string) => userRole is "ADM";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxland/primary-shell",
3
- "version": "7.2.1",
3
+ "version": "7.3.0",
4
4
  "description": "Primaria Shell",
5
5
  "author": "UXLand <dev@uxland.es>",
6
6
  "homepage": "https://github.com/uxland/harmonix/tree/app#readme",
@@ -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
  };
@@ -42,14 +42,13 @@ export class PocEventsEcap extends LitElement {
42
42
 
43
43
  const data = { url: fileName };
44
44
 
45
- console.log("Añadiendo PDF:", pdfName);
46
-
47
45
  shellApi.pdfViewerManager.add(pdfName, data);
48
46
  }
49
47
 
50
48
  getPDFS() {
51
49
  const pdfs = shellApi.pdfViewerManager.getPdfs();
52
50
  console.log(pdfs);
51
+ return pdfs;
53
52
  }
54
53
 
55
54
  goToLinkOnEcap() {
@@ -1,16 +1,15 @@
1
1
  import { registerPDFVisorMainView } from "../../api/pdf-viewer-manager/handle-views";
2
- import { registerLowerNavMenuViews } from "./lower-nav-menu-views";
3
- import { registerCommunicationMenuActions, registerCommunicationNavMenuItem, registerUpperNavMenuViews } from "./upper-nav-views";
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
- registerCommunicationNavMenuItem();
12
- registerUpperNavMenuViews();
13
- // registerLowerNavMenuViews();
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 upperNavMenuItems: MenuItemConfig[] = [
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
- export const registerUpperNavMenuViews = () => {
217
- for (const item of upperNavMenuItems) {
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 registerCommunicationNavMenuItem = () => {
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 = () => {
@@ -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);
package/src/constants.ts CHANGED
@@ -1,2 +1 @@
1
1
  export const primariaShellId = "primaria-shell";
2
- export const pocTestEventsId = "poc-events-ecap";
@@ -0,0 +1 @@
1
+ export const isUserRoleAdministrative = (userRole?: string) => userRole === "ADM";
@@ -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 === "ADM") {
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;
@@ -1,2 +0,0 @@
1
- export const registerLowerNavMenuViews = () => {
2
- };