@uxland/primary-shell 7.35.0 → 7.35.2

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.
Files changed (26) hide show
  1. package/dist/{component-iaGoBwQJ.js → component-C0H3AM4N.js} +2 -2
  2. package/dist/{component-iaGoBwQJ.js.map → component-C0H3AM4N.js.map} +1 -1
  3. package/dist/{index-FlVi1nb2.js → index-CI2A4nGX.js} +466 -380
  4. package/dist/index-CI2A4nGX.js.map +1 -0
  5. package/dist/index.js +14 -13
  6. package/dist/index.umd.cjs +113 -97
  7. package/dist/index.umd.cjs.map +1 -1
  8. package/dist/primary/shell/src/UI/components/petitioner-action-menu/petitioner-action-menu.d.ts +15 -0
  9. package/dist/primary/shell/src/UI/components/petitioner-action-menu/template.d.ts +2 -0
  10. package/dist/primary/shell/src/UI/internal-views/common-nav-menu.d.ts +1 -1
  11. package/dist/primary/shell/src/UI/internal-views/doctor-nav-menu.d.ts +2 -0
  12. package/dist/primary/shell/src/api/notification-service/notification.service-impl.d.ts +2 -0
  13. package/dist/primary/shell/src/api/region-manager/regions.d.ts +1 -0
  14. package/dist/primary/shell/src/handle-plugins.d.ts +1 -1
  15. package/dist/primary/shell/src/index.d.ts +1 -0
  16. package/package.json +1 -1
  17. package/src/UI/components/bootstrapper.ts +3 -0
  18. package/src/UI/components/petitioner-action-menu/petitioner-action-menu.ts +47 -0
  19. package/src/UI/components/petitioner-action-menu/styles.css +29 -0
  20. package/src/UI/components/petitioner-action-menu/template.ts +24 -0
  21. package/src/UI/internal-views/doctor-nav-menu.ts +57 -29
  22. package/src/api/notification-service/notification-service-impl.test.ts +27 -0
  23. package/src/api/notification-service/notification.service-impl.ts +29 -5
  24. package/src/api/region-manager/regions.ts +1 -0
  25. package/src/index.ts +1 -0
  26. package/dist/index-FlVi1nb2.js.map +0 -1
@@ -0,0 +1,15 @@
1
+ import { PropertyValues } from 'lit';
2
+ import { IRegion } from '@uxland/regions';
3
+ declare const PetitionerActionMenu_base: any;
4
+ export declare class PetitionerActionMenu extends PetitionerActionMenu_base {
5
+ constructor(icon: string, label: string);
6
+ showText: boolean;
7
+ petitionerSidenavRegion: IRegion | undefined;
8
+ static styles: import('lit').CSSResult;
9
+ firstUpdated(_changedProps: PropertyValues<PetitionerActionMenu>): void;
10
+ observeHostResize(): void;
11
+ render(): import('lit').TemplateResult<1>;
12
+ icon: string;
13
+ label: string;
14
+ }
15
+ export {};
@@ -0,0 +1,2 @@
1
+ import { PetitionerActionMenu } from './petitioner-action-menu';
2
+ export declare const template: (props: PetitionerActionMenu) => import('lit').TemplateResult<1>;
@@ -29,7 +29,7 @@ export declare const commonNavMenuItems: {
29
29
  label: string;
30
30
  type: string;
31
31
  sortHint: string;
32
- callbackFn: () => Promise<unknown>;
32
+ callbackFn: () => any;
33
33
  }[];
34
34
  export declare const registerNavMenuViews: (views: MenuItemConfig[]) => void;
35
35
  export declare const registerCommunicationNavMenu: () => void;
@@ -1,4 +1,6 @@
1
1
  export declare const registerClinicalPathwaysNavMenu: () => void;
2
2
  export declare const registerDoctorCommunicationMenuActions: () => void;
3
3
  export declare const registerDoctorClinicalPathwaysMenuActions: () => void;
4
+ export declare const registerPetitionerNavMenu: () => void;
5
+ export declare const registerDoctorPetitionerMenuActions: () => void;
4
6
  export declare const registerDoctorNavMenuViews: () => void;
@@ -1,5 +1,7 @@
1
1
  import { PrimariaNotificationService } from './notification-service';
2
2
  export declare class PrimariaNotificationServiceImpl extends PrimariaNotificationService {
3
+ private getOrCreateContainer;
4
+ private removeContainerIfEmpty;
3
5
  private notify;
4
6
  info(message: string, duration?: number): void;
5
7
  warning(message: string, duration?: number): void;
@@ -8,6 +8,7 @@ export declare const shellRegions: {
8
8
  floating: string;
9
9
  communicationSidenav: string;
10
10
  clinicalPathwaysSidenav: string;
11
+ petitionerSidenav: string;
11
12
  importData: string;
12
13
  };
13
14
  export declare const clinicalMonitoringRegions: {
@@ -13,5 +13,5 @@ interface PrimariaBootstrappedPlugin extends BootstrappedPlugin<PrimariaApi> {
13
13
  }
14
14
  export declare const bootstrapPlugins: (plugins: PluginDefinition[], startup?: PrimariaStartupPlugin) => Promise<void>;
15
15
  export declare const handleStartupPlugin: (plugins: PrimariaBootstrappedPlugin[], startupPlugin?: PrimariaStartupPlugin) => void;
16
- export declare const disposePlugins: () => Promise<void[]>;
16
+ export declare const disposePlugins: () => Promise<any>;
17
17
  export type Plugin = PluginType<PrimariaApi>;
@@ -7,6 +7,7 @@ export * from './api/broker/primaria-broker';
7
7
  export type { PrimariaContextManager, EcapContext } from './api/context-manager/context-manager';
8
8
  export * from './UI/index';
9
9
  export { PrimariaNavItem } from './UI/shared-components/primaria-nav-item/primaria-nav-item';
10
+ export { QuickActionItem } from './UI/shared-components/quick-action-item/quick-action-item';
10
11
  export { PrimariaRegion } from './UI/shared-components/primaria-region';
11
12
  export { EcapEventManager, createEcapEventManager, } from './api/ecap-event-manager/ecap-event-manager';
12
13
  export type { IEcapEvent } from './api/ecap-event-manager/typings';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxland/primary-shell",
3
- "version": "7.35.0",
3
+ "version": "7.35.2",
4
4
  "description": "Primaria Shell",
5
5
  "author": "UXLand <dev@uxland.es>",
6
6
  "homepage": "https://github.com/uxland/harmonix/tree/app#readme",
@@ -8,6 +8,7 @@ import { FinalizeVisitButton } from "../../features/visit/finalize-visit/compone
8
8
  import { PrimariaAccordion } from "./primaria-accordion/primaria-accordion";
9
9
  import { CommunicationActionMenu } from "./communication-action-menu/communication-action-menu";
10
10
  import { ClinicalPathwaysActionMenu } from "./clinical-pathways-action-menu/clinical-pathways-action-menu";
11
+ import { PetitionerActionMenu } from "./petitioner-action-menu/petitioner-action-menu";
11
12
  import { HeaderDivider } from "./primaria-shell/shell-header/header-divider/header-divider";
12
13
 
13
14
  export const useComponents = () => {
@@ -24,6 +25,8 @@ export const useComponents = () => {
24
25
  //@ts-ignore
25
26
  customElement("clinical-pathways-action-menu")(ClinicalPathwaysActionMenu);
26
27
  //@ts-ignore
28
+ customElement("petitioner-action-menu")(PetitionerActionMenu);
29
+ //@ts-ignore
27
30
  customElement("poc-events-ecap")(PocEventsEcap);
28
31
  customElement("primaria-accordion")(PrimariaAccordion);
29
32
  };
@@ -0,0 +1,47 @@
1
+ import { LitElement, html, css, unsafeCSS, PropertyValues } from "lit";
2
+ import { template } from "./template";
3
+ import { property, state } from "lit/decorators.js";
4
+ import { IRegion, region } from "@uxland/regions";
5
+ import { PrimariaRegionHost, shellApi } from "../../../api/api";
6
+ import styles from "./styles.css?inline";
7
+
8
+ export class PetitionerActionMenu extends PrimariaRegionHost(LitElement) {
9
+ constructor(icon: string, label: string) {
10
+ super();
11
+ this.icon = icon;
12
+ this.label = label;
13
+ }
14
+
15
+ @state() showText = false;
16
+
17
+ @region({ targetId: "petitioner-sidenav-region-container", name: shellApi.regionManager.regions.shell.petitionerSidenav })
18
+ petitionerSidenavRegion: IRegion | undefined;
19
+
20
+ static styles = css`
21
+ ${unsafeCSS(styles)}
22
+ `;
23
+
24
+ firstUpdated(_changedProps: PropertyValues<PetitionerActionMenu>) {
25
+ super.firstUpdated(_changedProps);
26
+ this.observeHostResize();
27
+ }
28
+
29
+ observeHostResize() {
30
+ const parentElement = this.parentElement;
31
+ const observer = new ResizeObserver((entries) => {
32
+ for (const entry of entries) {
33
+ const width = entry.target.clientWidth;
34
+ this.showText = width > 100;
35
+ }
36
+ });
37
+
38
+ observer.observe(parentElement as HTMLElement);
39
+ }
40
+
41
+ render() {
42
+ return html`${template(this)}`;
43
+ }
44
+
45
+ @property({ type: String }) icon = "";
46
+ @property({ type: String }) label = "";
47
+ }
@@ -0,0 +1,29 @@
1
+ .item {
2
+ display: flex;
3
+ cursor: pointer;
4
+ border-radius: 8px;
5
+ padding: 8px;
6
+ justify-content: center;
7
+ transition: background-color 0.3s ease;
8
+ &[expanded] {
9
+ justify-content: space-between;
10
+ }
11
+ &:hover {
12
+ background-color: var(--color-primary-900);
13
+ color: white;
14
+ }
15
+ .icon-label {
16
+ display: flex;
17
+ gap: 8px;
18
+ transition: background-color 0.3s;
19
+ }
20
+ }
21
+
22
+ .item.active{
23
+ outline: 2px solid white;
24
+ outline-offset: -2px;
25
+ }
26
+
27
+ dss-tooltip {
28
+ pointer-events: none;
29
+ }
@@ -0,0 +1,24 @@
1
+ import { html, nothing } from "lit";
2
+ import { PetitionerActionMenu } from "./petitioner-action-menu";
3
+
4
+ export const template = (props: PetitionerActionMenu) => {
5
+ return html`
6
+ <div class="item" ?expanded=${props.showText}>
7
+ <div class="icon-label">
8
+ <dss-icon icon=${props.icon} size="md"></dss-icon>
9
+ ${props.showText ? html`<span>${props.label}</span>` : ""}
10
+ ${
11
+ !props.showText
12
+ ? html`
13
+ <dss-tooltip position="right">
14
+ ${props.label}
15
+ </dss-tooltip>`
16
+ : nothing
17
+ }
18
+ </div>
19
+ <dss-action-menu id="petitioner-sidenav-region-container" slot="content" >
20
+ </dss-action-menu>
21
+ ${props.showText ? html`<dss-icon icon="chevron_right" size="md"></dss-icon>` : nothing}
22
+ </div>
23
+ `;
24
+ };
@@ -4,6 +4,7 @@ import { GetVisitId } from "../../features/visit/get-visit-id/request";
4
4
  import { shellApi } from "../../api/api";
5
5
  import { QuickActionItem } from "../shared-components/quick-action-item/quick-action-item";
6
6
  import { ClinicalPathwaysActionMenu } from "../components/clinical-pathways-action-menu/clinical-pathways-action-menu";
7
+ import { PetitionerActionMenu } from "../components/petitioner-action-menu/petitioner-action-menu";
7
8
  import { MenuItemConfig, registerNavMenuViews, registerCommunicationNavMenu, registerNavMenuDivider } from "./common-nav-menu";
8
9
 
9
10
  const doctorNavMenuItems: MenuItemConfig[] = [
@@ -15,35 +16,6 @@ const doctorNavMenuItems: MenuItemConfig[] = [
15
16
  sortHint: "0030",
16
17
  callbackFn: () => navigateToEcap("IA_DEV"),
17
18
  },
18
- {
19
- id: "unique-petition",
20
- icon: "playlist_add",
21
- label: "Peticionari",
22
- type: "tree",
23
- sortHint: "0050",
24
- actionMenuItems: [
25
- {
26
- icon: "open_in_new",
27
- label: "Analítiques",
28
- callbackFn: () => navigateToEcap("LABORATORI"),
29
- },
30
- {
31
- icon: "open_in_new",
32
- label: "Ordres Clíniques",
33
- callbackFn: () => navigateToEcap("RESULT_OC"),
34
- },
35
- {
36
- icon: "open_in_new",
37
- label: "OC Exprés",
38
- callbackFn: () => navigateToEcap("OC_EXPRES"),
39
- },
40
- {
41
- icon: "open_in_new",
42
- label: "Sol·licitud de trasllat",
43
- callbackFn: () => navigateToEcap("TRANSPORT"),
44
- },
45
- ],
46
- },
47
19
  {
48
20
  id: "analytics-monitoring", // id correcta?
49
21
  icon: "science",
@@ -260,11 +232,67 @@ export const registerDoctorClinicalPathwaysMenuActions = () => {
260
232
  }
261
233
  };
262
234
 
235
+ export const registerPetitionerNavMenu = () => {
236
+ shellApi.regionManager.registerView(shellApi.regionManager.regions.shell.navigationMenu, {
237
+ id: "petitioner",
238
+ sortHint: "0050",
239
+ factory: () => {
240
+ const menuItem = new PetitionerActionMenu("playlist_add", "Peticionari");
241
+ return Promise.resolve(menuItem as any);
242
+ },
243
+ });
244
+ };
245
+
246
+ export const registerDoctorPetitionerMenuActions = () => {
247
+ const petitionerItems = [
248
+ {
249
+ id: "1",
250
+ sortHint: "0010",
251
+ icon: "open_in_new",
252
+ label: "Analítiques",
253
+ callbackFn: () => navigateToEcap("LABORATORI"),
254
+ },
255
+ {
256
+ id: "2",
257
+ sortHint: "0020",
258
+ icon: "open_in_new",
259
+ label: "Ordres Clíniques",
260
+ callbackFn: () => navigateToEcap("RESULT_OC"),
261
+ },
262
+ {
263
+ id: "3",
264
+ sortHint: "0030",
265
+ icon: "open_in_new",
266
+ label: "OC Exprés",
267
+ callbackFn: () => navigateToEcap("OC_EXPRES"),
268
+ },
269
+ {
270
+ id: "4",
271
+ sortHint: "0040",
272
+ icon: "open_in_new",
273
+ label: "Sol·licitud de trasllat",
274
+ callbackFn: () => navigateToEcap("TRANSPORT"),
275
+ },
276
+ ];
277
+ for (const item of petitionerItems) {
278
+ shellApi.regionManager.registerView(shellApi.regionManager.regions.shell.petitionerSidenav, {
279
+ id: item.id,
280
+ sortHint: item.sortHint,
281
+ factory: () => {
282
+ const menuItem = new QuickActionItem(item.icon, item.label, item.callbackFn);
283
+ return Promise.resolve(menuItem as any);
284
+ },
285
+ });
286
+ }
287
+ };
288
+
263
289
  export const registerDoctorNavMenuViews = () => {
264
290
  registerCommunicationNavMenu();
265
291
  registerDoctorCommunicationMenuActions();
266
292
  registerClinicalPathwaysNavMenu();
267
293
  registerDoctorClinicalPathwaysMenuActions();
294
+ registerPetitionerNavMenu();
295
+ registerDoctorPetitionerMenuActions();
268
296
  registerNavMenuViews(doctorNavMenuItems);
269
297
  registerNavMenuDivider();
270
298
  };
@@ -37,6 +37,13 @@ describe("PrimariaNotificationServiceImpl", () => {
37
37
  assertToast(state, message);
38
38
  });
39
39
 
40
+ it("should create a container for toasts", () => {
41
+ service.info("Test");
42
+ const container = document.getElementById("primaria-toast-container");
43
+ expect(container).not.toBeNull();
44
+ expect(container?.style.position).toBe("fixed");
45
+ });
46
+
40
47
  it("should remove the toast after the duration", () => {
41
48
  service.info("Temporary toast", 2000);
42
49
 
@@ -53,4 +60,24 @@ describe("PrimariaNotificationServiceImpl", () => {
53
60
  toast = document.querySelector("dss-toast") as HTMLElement;
54
61
  expect(toast).toBeNull();
55
62
  });
63
+
64
+ it("should remove the container when all toasts are dismissed", () => {
65
+ service.info("Toast 1", 1000);
66
+
67
+ vi.advanceTimersByTime(1000);
68
+ vi.advanceTimersByTime(300);
69
+
70
+ const container = document.getElementById("primaria-toast-container");
71
+ expect(container).toBeNull();
72
+ });
73
+
74
+ it("should stack multiple toasts in the same container", () => {
75
+ service.info("Toast 1");
76
+ service.warning("Toast 2");
77
+ service.error("Toast 3");
78
+
79
+ const container = document.getElementById("primaria-toast-container");
80
+ const toasts = container?.querySelectorAll("dss-toast");
81
+ expect(toasts?.length).toBe(3);
82
+ });
56
83
  });
@@ -1,12 +1,33 @@
1
1
  import { PrimariaNotificationService } from "./notification-service";
2
2
 
3
+ const CONTAINER_ID = "primaria-toast-container";
4
+
3
5
  export class PrimariaNotificationServiceImpl extends PrimariaNotificationService {
6
+ private getOrCreateContainer(): HTMLElement {
7
+ let container = document.getElementById(CONTAINER_ID);
8
+ if (!container) {
9
+ container = document.createElement("div");
10
+ container.id = CONTAINER_ID;
11
+ container.style.cssText =
12
+ "position:fixed;bottom:var(--dss-spacing-xxs,8px);left:var(--dss-spacing-xxs,8px);display:flex;flex-direction:column-reverse;gap:var(--dss-spacing-xs,4px);z-index:999;pointer-events:none;";
13
+ document.body.appendChild(container);
14
+ }
15
+ return container;
16
+ }
17
+
18
+ private removeContainerIfEmpty(container: HTMLElement): void {
19
+ if (container.childElementCount === 0) {
20
+ container.remove();
21
+ }
22
+ }
23
+
4
24
  private notify(
5
25
  message: string,
6
26
  state: "info" | "warning" | "error" | "success",
7
27
  duration = 3000,
8
28
  ): void {
9
- // Crear el Web Component
29
+ const container = this.getOrCreateContainer();
30
+
10
31
  const toast = document.createElement("dss-toast");
11
32
  toast.setAttribute("isshow", "true");
12
33
  toast.setAttribute("state", state);
@@ -14,16 +35,19 @@ export class PrimariaNotificationServiceImpl extends PrimariaNotificationService
14
35
  toast.setAttribute("text", message);
15
36
  toast.setAttribute("hasicon", "true");
16
37
  toast.setAttribute("duration", duration.toString());
38
+ toast.style.position = "relative";
39
+ toast.style.bottom = "auto";
40
+ toast.style.left = "auto";
41
+ toast.style.pointerEvents = "auto";
17
42
 
18
- // Agregar al body
19
- document.body.appendChild(toast);
43
+ container.appendChild(toast);
20
44
 
21
- // Remover después del tiempo de duración
22
45
  setTimeout(() => {
23
46
  toast.setAttribute("isshow", "false");
24
47
  setTimeout(() => {
25
48
  toast.remove();
26
- }, 300); // Espera un poco para animación de salida (ajustable)
49
+ this.removeContainerIfEmpty(container);
50
+ }, 300);
27
51
  }, duration);
28
52
  }
29
53
 
@@ -8,6 +8,7 @@ export const shellRegions = {
8
8
  floating: "floating-region",
9
9
  communicationSidenav: "communication-sidenav-region",
10
10
  clinicalPathwaysSidenav: "clinical-pathways-sidenav-region",
11
+ petitionerSidenav: "petitioner-sidenav-region",
11
12
  importData: "import-data-region",
12
13
  };
13
14
 
package/src/index.ts CHANGED
@@ -17,6 +17,7 @@ export * from "./api/broker/primaria-broker";
17
17
  export type { PrimariaContextManager, EcapContext } from "./api/context-manager/context-manager";
18
18
  export * from "./UI/index";
19
19
  export { PrimariaNavItem } from "./UI/shared-components/primaria-nav-item/primaria-nav-item";
20
+ export { QuickActionItem } from "./UI/shared-components/quick-action-item/quick-action-item";
20
21
  export { PrimariaRegion } from "./UI/shared-components/primaria-region";
21
22
  export {
22
23
  EcapEventManager,