@uxland/primary-shell 8.3.4 → 8.3.5

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 (146) hide show
  1. package/README.md +18 -1
  2. package/package.json +6 -14
  3. package/src/UI/bootstrapper.ts +0 -14
  4. package/src/UI/components/bootstrapper.ts +0 -25
  5. package/src/UI/components/clinical-pathways-action-menu/clinical-pathways-action-menu.ts +0 -13
  6. package/src/UI/components/communication-action-menu/communication-action-menu.ts +0 -13
  7. package/src/UI/components/error-view/component.ts +0 -17
  8. package/src/UI/components/error-view/styles.css +0 -27
  9. package/src/UI/components/error-view/template.ts +0 -12
  10. package/src/UI/components/nav-divider/nav-divider.ts +0 -41
  11. package/src/UI/components/nav-divider/styles.css +0 -21
  12. package/src/UI/components/nav-divider/template.ts +0 -8
  13. package/src/UI/components/petitioner-action-menu/petitioner-action-menu.ts +0 -13
  14. package/src/UI/components/primaria-accordion/primaria-accordion.ts +0 -45
  15. package/src/UI/components/primaria-shell/constants.ts +0 -4
  16. package/src/UI/components/primaria-shell/primaria-shell.ts +0 -105
  17. package/src/UI/components/primaria-shell/shell-header/header-divider/header-divider.ts +0 -13
  18. package/src/UI/components/primaria-shell/shell-header/header-divider/styles.css +0 -5
  19. package/src/UI/components/primaria-shell/shell-header/header-divider/template.ts +0 -8
  20. package/src/UI/components/primaria-shell/shell-header/shell-header.ts +0 -71
  21. package/src/UI/components/primaria-shell/shell-header/styles.css +0 -45
  22. package/src/UI/components/primaria-shell/shell-header/template.ts +0 -37
  23. package/src/UI/components/primaria-shell/styles.css +0 -185
  24. package/src/UI/components/primaria-shell/template.ts +0 -72
  25. package/src/UI/components/sidenav-action-menu/sidenav-action-menu.ts +0 -62
  26. package/src/UI/components/sidenav-action-menu/styles.css +0 -25
  27. package/src/UI/components/sidenav-action-menu/template.ts +0 -24
  28. package/src/UI/fonts/fonts.css +0 -48
  29. package/src/UI/fonts/open-sans-v40-latin-300.woff2 +0 -0
  30. package/src/UI/fonts/open-sans-v40-latin-500.woff2 +0 -0
  31. package/src/UI/fonts/open-sans-v40-latin-600.woff2 +0 -0
  32. package/src/UI/fonts/open-sans-v40-latin-700.woff2 +0 -0
  33. package/src/UI/fonts/open-sans-v40-latin-800.woff2 +0 -0
  34. package/src/UI/fonts/open-sans-v40-latin-regular.woff2 +0 -0
  35. package/src/UI/images/Gencat_Logotip.svg +0 -70
  36. package/src/UI/images/Salut_Logotip.svg +0 -8
  37. package/src/UI/index.ts +0 -1
  38. package/src/UI/internal-views/administrative-nav-menu.ts +0 -302
  39. package/src/UI/internal-views/common-nav-menu.ts +0 -94
  40. package/src/UI/internal-views/doctor-nav-menu.ts +0 -297
  41. package/src/UI/internal-views/doctor-quick-action-menu.ts +0 -16
  42. package/src/UI/internal-views/handle-views.ts +0 -24
  43. package/src/UI/shared-components/bootstrapper.ts +0 -18
  44. package/src/UI/shared-components/index.ts +0 -1
  45. package/src/UI/shared-components/primaria-character-limit-badge/primaria-character-limit-badge.ts +0 -27
  46. package/src/UI/shared-components/primaria-character-limit-badge/styles.css +0 -8
  47. package/src/UI/shared-components/primaria-content-switcher/primaria-content-switcher.ts +0 -78
  48. package/src/UI/shared-components/primaria-nav-item/primaria-nav-item.ts +0 -71
  49. package/src/UI/shared-components/primaria-nav-item/styles.css +0 -25
  50. package/src/UI/shared-components/primaria-nav-item/template.ts +0 -27
  51. package/src/UI/shared-components/primaria-nav-tree-menu/primaria-nav-tree-menu.ts +0 -41
  52. package/src/UI/shared-components/primaria-nav-tree-menu/styles.css +0 -11
  53. package/src/UI/shared-components/primaria-nav-tree-menu/template.ts +0 -46
  54. package/src/UI/shared-components/primaria-region/index.ts +0 -1
  55. package/src/UI/shared-components/primaria-region/primaria-region.ts +0 -199
  56. package/src/UI/shared-components/primaria-text-editor/primaria-rich-text-editor.ts +0 -261
  57. package/src/UI/shared-components/primaria-text-editor/styles.css +0 -966
  58. package/src/UI/shared-components/primaria-text-editor/template.ts +0 -8
  59. package/src/UI/shared-components/primaria-text-editor/utils.ts +0 -39
  60. package/src/UI/shared-components/quick-action-item/quick-action-item.ts +0 -21
  61. package/src/UI/shared-components/quick-action-item/template.ts +0 -8
  62. package/src/UI/shared-components/typings.ts +0 -19
  63. package/src/api/activity-monitor/activity-monitor.test.ts +0 -67
  64. package/src/api/activity-monitor/activity-monitor.ts +0 -26
  65. package/src/api/api.test.ts +0 -37
  66. package/src/api/api.ts +0 -119
  67. package/src/api/broker/broker-events.ts +0 -39
  68. package/src/api/broker/broker-requests.ts +0 -20
  69. package/src/api/broker/factory.test.ts +0 -378
  70. package/src/api/broker/factory.ts +0 -151
  71. package/src/api/broker/primaria-broker.ts +0 -20
  72. package/src/api/context-manager/context-manager.test.ts +0 -86
  73. package/src/api/context-manager/context-manager.ts +0 -42
  74. package/src/api/ecap-event-manager/ecap-event-manager.test.ts +0 -100
  75. package/src/api/ecap-event-manager/ecap-event-manager.ts +0 -58
  76. package/src/api/ecap-event-manager/typings.ts +0 -6
  77. package/src/api/exit-guard-manager/exit-guard-manager.test.ts +0 -75
  78. package/src/api/exit-guard-manager/exit-guard-manager.ts +0 -31
  79. package/src/api/global-state/global-state.test.ts +0 -45
  80. package/src/api/global-state/global-state.ts +0 -38
  81. package/src/api/http-client/http-client.test.ts +0 -196
  82. package/src/api/http-client/http-client.ts +0 -97
  83. package/src/api/import-data-manager/component/component.ts +0 -29
  84. package/src/api/import-data-manager/component/styles.css +0 -79
  85. package/src/api/import-data-manager/component/template.ts +0 -49
  86. package/src/api/import-data-manager/import-data-manager-impl.test.ts +0 -364
  87. package/src/api/import-data-manager/import-data-manager-impl.ts +0 -121
  88. package/src/api/import-data-manager/import-data-manager.ts +0 -42
  89. package/src/api/import-data-manager/index.ts +0 -2
  90. package/src/api/interaction-service/confirmation-message.tsx +0 -5
  91. package/src/api/interaction-service/index.ts +0 -1
  92. package/src/api/interaction-service/interaction-service-impl.tsx +0 -260
  93. package/src/api/interaction-service/interaction-service.ts +0 -52
  94. package/src/api/interaction-service/modal-styles.css +0 -97
  95. package/src/api/localization/localization.test.ts +0 -61
  96. package/src/api/localization/localization.ts +0 -58
  97. package/src/api/notification-service/notification-service-impl.test.ts +0 -84
  98. package/src/api/notification-service/notification-service.ts +0 -6
  99. package/src/api/notification-service/notification.service-impl.ts +0 -67
  100. package/src/api/pdf-viewer-manager/constants.ts +0 -1
  101. package/src/api/pdf-viewer-manager/events.ts +0 -5
  102. package/src/api/pdf-viewer-manager/handle-views.ts +0 -32
  103. package/src/api/pdf-viewer-manager/pdf-viewer-manager.test.ts +0 -126
  104. package/src/api/pdf-viewer-manager/pdf-viewer-manager.ts +0 -96
  105. package/src/api/pdf-viewer-manager/pdf-visor/pdf-selector/pdf-selector.ts +0 -39
  106. package/src/api/pdf-viewer-manager/pdf-visor/pdf-selector/styles.css +0 -45
  107. package/src/api/pdf-viewer-manager/pdf-visor/pdf-selector/template.ts +0 -32
  108. package/src/api/pdf-viewer-manager/pdf-visor/pdf-visor.ts +0 -122
  109. package/src/api/pdf-viewer-manager/pdf-visor/styles.css +0 -29
  110. package/src/api/pdf-viewer-manager/pdf-visor/utils.ts +0 -16
  111. package/src/api/quick-action-busy-manager/quick-action-busy-manager.test.ts +0 -61
  112. package/src/api/quick-action-busy-manager/quick-action-busy-manager.ts +0 -45
  113. package/src/api/region-manager/region-manager.test.ts +0 -239
  114. package/src/api/region-manager/region-manager.ts +0 -263
  115. package/src/api/region-manager/regions.ts +0 -30
  116. package/src/api/region-manager/remove-view-idempotency.test.ts +0 -98
  117. package/src/api/session-refresh-timer/session-refresh-timer.test.ts +0 -102
  118. package/src/api/session-refresh-timer/session-refresh-timer.ts +0 -75
  119. package/src/api/token-manager/token-manager.test.ts +0 -146
  120. package/src/api/token-manager/token-manager.ts +0 -70
  121. package/src/api/user-manager/user-manager.ts +0 -79
  122. package/src/bootstrapper.ts +0 -41
  123. package/src/constants.ts +0 -1
  124. package/src/disposer.ts +0 -19
  125. package/src/features/bootstrapper.ts +0 -21
  126. package/src/features/exit/bootstrapper.ts +0 -17
  127. package/src/features/exit/handler.test.ts +0 -187
  128. package/src/features/exit/handler.ts +0 -58
  129. package/src/features/exit/request.ts +0 -10
  130. package/src/features/get-patient-cip/action.ts +0 -5
  131. package/src/features/get-user-info/backend-adapter.ts +0 -48
  132. package/src/features/get-user-info/bootstrapper.ts +0 -20
  133. package/src/features/get-user-info/handler.test.ts +0 -66
  134. package/src/features/get-user-info/handler.ts +0 -23
  135. package/src/features/get-user-info/model.ts +0 -10
  136. package/src/features/get-user-info/pds-token.ts +0 -28
  137. package/src/features/get-user-info/request.ts +0 -4
  138. package/src/features/get-visi-id/action.ts +0 -11
  139. package/src/features/navigate-to-ecap/navigate-to-ecap.ts +0 -21
  140. package/src/features/utils.ts +0 -27
  141. package/src/handle-plugins.ts +0 -82
  142. package/src/index.ts +0 -101
  143. package/src/infrastructure/ioc/container.ts +0 -14
  144. package/src/infrastructure/ioc/types.ts +0 -5
  145. package/src/locales.ts +0 -70
  146. package/src/types/custom.d.ts +0 -30
package/README.md CHANGED
@@ -1 +1,18 @@
1
- Full Harmonix and Primaria Shell Documentation here: https://doc.clickup.com/9012015559/d/h/8cjgwe7-2192/bc9e680ac3c7b52
1
+ # @uxland/primary-shell
2
+
3
+ The shell of the ETC HES Primària application, built on [Harmonix](https://harmonixframework.dev). It hosts the plugins of the application and gives each one its API: the regions where it registers its views, the broker to talk to other plugins, the context and the user, an HTTP client, notifications and dialogs.
4
+
5
+ Plugins depend on it to compile, but do not bundle it: the application provides it at runtime.
6
+
7
+ ## Developing a plugin for Primària
8
+
9
+ Create the project with the plugin creator. It comes with the Primària sandbox, which runs your plugin inside this shell, next to the plugins published in the pre-production Plugin Store:
10
+
11
+ ```bash
12
+ npm create @uxland/etc-hes-plugin@latest my-plugin -- --template react # or lit, angular
13
+ ```
14
+
15
+ ## Documentation
16
+
17
+ - [Integration guide for the initiatives](https://doc.clickup.com/9012015559/d/h/8cjgwe7-11732/68226d17c70b7a1) (in Catalan): how to integrate a plugin into Primària, the development environment and what each shell version brings.
18
+ - [harmonixframework.dev](https://harmonixframework.dev): the Harmonix framework.
package/package.json CHANGED
@@ -1,29 +1,21 @@
1
1
  {
2
2
  "name": "@uxland/primary-shell",
3
- "version": "8.3.4",
4
- "description": "Primaria Shell",
3
+ "version": "8.3.5",
4
+ "description": "The shell of the ETC HES Primària application, built on Harmonix.",
5
5
  "author": "UXLand <dev@uxland.es>",
6
- "homepage": "https://github.com/uxland/harmonix/tree/app#readme",
6
+ "homepage": "https://doc.clickup.com/9012015559/d/h/8cjgwe7-11732/68226d17c70b7a1",
7
7
  "license": "UNLICENSED",
8
8
  "type": "module",
9
- "main": "src/index.ts",
9
+ "main": "dist/index.js",
10
10
  "types": "dist/index.d.ts",
11
11
  "module": "dist/index.js",
12
12
  "files": [
13
- "dist",
14
- "src"
13
+ "dist"
15
14
  ],
16
15
  "publishConfig": {
17
16
  "access": "public",
18
17
  "registry": "https://registry.npmjs.org/"
19
18
  },
20
- "repository": {
21
- "type": "git",
22
- "url": "git+https://github.com/uxland/harmonix.git"
23
- },
24
- "bugs": {
25
- "url": "https://github.com/uxland/harmonix/issues"
26
- },
27
19
  "dependencies": {
28
20
  "@uxland/harmonix": "^1.1.6",
29
21
  "@uxland/harmonix-adapters": "^1.2.2"
@@ -54,7 +46,7 @@
54
46
  "start": "ng serve --host 0.0.0.0",
55
47
  "build": "vite build",
56
48
  "preview": "vite preview",
57
- "publish-rc": "npm publish --tag rc",
49
+ "publish-rc": "pnpm publish --tag rc",
58
50
  "test": "vitest"
59
51
  }
60
52
  }
@@ -1,14 +0,0 @@
1
- import { regionAdapterRegistry, selectableAdapterFactory } from "@uxland/regions";
2
- import { useComponents } from "./components/bootstrapper";
3
- import { useSharedUI } from "./shared-components/bootstrapper";
4
- import { useInternalViews } from "./internal-views/handle-views";
5
-
6
- export const useUI = () => {
7
- regionAdapterRegistry.registerAdapterFactory(
8
- "primaria-content-switcher",
9
- selectableAdapterFactory,
10
- );
11
- useSharedUI();
12
- useComponents();
13
- useInternalViews();
14
- };
@@ -1,25 +0,0 @@
1
- import { customElement } from "lit/decorators.js";
2
- import { PrimariaShell } from "./primaria-shell/primaria-shell";
3
- import { PrimariaErrorView } from "./error-view/component";
4
- import { PrimariaShellHeader } from "./primaria-shell/shell-header/shell-header";
5
- import { PrimariaAccordion } from "./primaria-accordion/primaria-accordion";
6
- import { CommunicationActionMenu } from "./communication-action-menu/communication-action-menu";
7
- import { ClinicalPathwaysActionMenu } from "./clinical-pathways-action-menu/clinical-pathways-action-menu";
8
- import { PetitionerActionMenu } from "./petitioner-action-menu/petitioner-action-menu";
9
- import { HeaderDivider } from "./primaria-shell/shell-header/header-divider/header-divider";
10
-
11
- export const useComponents = () => {
12
- //@ts-ignore
13
- customElement("primaria-shell")(PrimariaShell);
14
- //@ts-ignore
15
- customElement("primaria-shell-header")(PrimariaShellHeader);
16
- customElement("primaria-error-view")(PrimariaErrorView);
17
- customElement("header-divider")(HeaderDivider);
18
- //@ts-ignore
19
- customElement("communication-action-menu")(CommunicationActionMenu);
20
- //@ts-ignore
21
- customElement("clinical-pathways-action-menu")(ClinicalPathwaysActionMenu);
22
- //@ts-ignore
23
- customElement("petitioner-action-menu")(PetitionerActionMenu);
24
- customElement("primaria-accordion")(PrimariaAccordion);
25
- };
@@ -1,13 +0,0 @@
1
- import { IRegion, region } from "@uxland/regions";
2
- import { shellRegions } from "../../../api/region-manager/regions";
3
- import { SidenavActionMenu, regionContainerId } from "../sidenav-action-menu/sidenav-action-menu";
4
-
5
- /** Menú "Vies clíniques" del menú de navegació: aporta la regió `clinicalPathwaysSidenav`. */
6
- export class ClinicalPathwaysActionMenu extends SidenavActionMenu {
7
- constructor(icon: string, label: string) {
8
- super(icon, label, shellRegions.clinicalPathwaysSidenav);
9
- }
10
-
11
- @region({ targetId: regionContainerId(shellRegions.clinicalPathwaysSidenav), name: shellRegions.clinicalPathwaysSidenav })
12
- sidenavRegion: IRegion | undefined;
13
- }
@@ -1,13 +0,0 @@
1
- import { IRegion, region } from "@uxland/regions";
2
- import { shellRegions } from "../../../api/region-manager/regions";
3
- import { SidenavActionMenu, regionContainerId } from "../sidenav-action-menu/sidenav-action-menu";
4
-
5
- /** Menú "Comunicació" del menú de navegació: aporta la regió `communicationSidenav`. */
6
- export class CommunicationActionMenu extends SidenavActionMenu {
7
- constructor(icon: string, label: string) {
8
- super(icon, label, shellRegions.communicationSidenav);
9
- }
10
-
11
- @region({ targetId: regionContainerId(shellRegions.communicationSidenav), name: shellRegions.communicationSidenav })
12
- sidenavRegion: IRegion | undefined;
13
- }
@@ -1,17 +0,0 @@
1
- import { LitElement, css, html, unsafeCSS } from "lit";
2
- import { property } from "lit/decorators.js";
3
- import styles from "./styles.css?inline";
4
- import { template } from "./template";
5
-
6
- export class PrimariaErrorView extends LitElement {
7
- render() {
8
- return html`${template(this)}`;
9
- }
10
-
11
- static styles = css`
12
- ${unsafeCSS(styles)}
13
- `;
14
-
15
- @property()
16
- error: { message: string };
17
- }
@@ -1,27 +0,0 @@
1
- :host{
2
- width: 100%;
3
- height: 100%;
4
- min-height: 1px;
5
- display: flex;
6
- }
7
-
8
- .container{
9
- width: 100%;
10
- min-height: 1px;
11
- height: 100%;
12
- display: flex;
13
- flex-direction: column;
14
- align-items: center;
15
- justify-content: center;
16
- background: #60A8F0;
17
- }
18
-
19
- svg{
20
- width: 45px;
21
- height: 45px;
22
- fill: #D36262;
23
- }
24
-
25
- h1{
26
- color: white;
27
- }
@@ -1,12 +0,0 @@
1
- import { html } from "lit";
2
- import { PrimariaErrorView } from "./component";
3
-
4
- export const template = (props: PrimariaErrorView) => {
5
-
6
- return html`
7
- <div class="container">
8
- <svg height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed"><path d="M480-280q17 0 28.5-11.5T520-320q0-17-11.5-28.5T480-360q-17 0-28.5 11.5T440-320q0 17 11.5 28.5T480-280Zm-40-160h80v-240h-80v240Zm40 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>
9
- <h1>${props.error?.message}</h1>
10
- </div>
11
- `;
12
- };
@@ -1,41 +0,0 @@
1
- import { regionView } from "@uxland/regions";
2
- import { LitElement, PropertyValues, css, html, unsafeCSS } from "lit";
3
- import { state } from "lit/decorators.js";
4
- import styles from "./styles.css?inline";
5
- import { template } from "./template";
6
-
7
- export class NavDivider extends regionView(LitElement) {
8
- static styles = css`
9
- ${unsafeCSS(styles)}
10
- `;
11
-
12
- render() {
13
- return html`${template(this)}`;
14
- }
15
-
16
- @state()
17
- expanded = false;
18
-
19
- connectedCallback(): void {
20
- super.connectedCallback();
21
- }
22
-
23
- firstUpdated(_changedProps: PropertyValues<NavDivider>) {
24
- super.firstUpdated(_changedProps);
25
- this.observeHostResize();
26
- }
27
-
28
- observeHostResize() {
29
- const parentElement = this.parentElement;
30
- const observer = new ResizeObserver((entries) => {
31
- for (const entry of entries) {
32
- const width = entry.target.clientWidth;
33
- this.expanded = width > 100;
34
- }
35
- });
36
-
37
- observer.observe(parentElement as HTMLElement);
38
- }
39
- }
40
-
41
- customElements.define("primaria-nav-divider", NavDivider);
@@ -1,21 +0,0 @@
1
- :host {
2
- display: block;
3
- width: 100%;
4
- }
5
-
6
- .divider-container {
7
- display: flex;
8
- justify-content: center;
9
- }
10
-
11
- .divider-container hr {
12
- margin: 0;
13
- }
14
-
15
- .divider-opened {
16
- width: 220px;
17
- }
18
-
19
- .divider-closed {
20
- width: 40px;
21
- }
@@ -1,8 +0,0 @@
1
- import { html } from "lit";
2
- import { NavDivider } from "./nav-divider";
3
-
4
- export const template = (props: NavDivider) => html`
5
- <div class="divider-container">
6
- <hr class="${props.expanded ? "divider-opened" : "divider-closed"}" />
7
- </div>
8
- `;
@@ -1,13 +0,0 @@
1
- import { IRegion, region } from "@uxland/regions";
2
- import { shellRegions } from "../../../api/region-manager/regions";
3
- import { SidenavActionMenu, regionContainerId } from "../sidenav-action-menu/sidenav-action-menu";
4
-
5
- /** Menú "Peticionari" del menú de navegació: aporta la regió `petitionerSidenav`. */
6
- export class PetitionerActionMenu extends SidenavActionMenu {
7
- constructor(icon: string, label: string) {
8
- super(icon, label, shellRegions.petitionerSidenav);
9
- }
10
-
11
- @region({ targetId: regionContainerId(shellRegions.petitionerSidenav), name: shellRegions.petitionerSidenav })
12
- sidenavRegion: IRegion | undefined;
13
- }
@@ -1,45 +0,0 @@
1
- import { LitElement, html, css } from "lit";
2
- import { property } from "lit/decorators.js";
3
- export class PrimariaAccordion extends LitElement {
4
- @property({ type: Boolean })
5
- isOpen;
6
-
7
- static styles = css`
8
- :host {
9
- display: block;
10
- }
11
-
12
- .content {
13
- overflow: hidden;
14
- max-height: 0;
15
- }
16
-
17
- .content.open {
18
- margin-top: 8px;
19
- max-height: unset;
20
- }
21
-
22
- .title {
23
- cursor: pointer;
24
- display: flex;
25
- justify-content: space-between;
26
- align-items: center;
27
- }
28
- `;
29
-
30
- toggle() {
31
- this.isOpen = !this.isOpen;
32
- }
33
-
34
- render() {
35
- return html`
36
- <div class="title" @click=${this.toggle}>
37
- <slot name="title"></slot>
38
- <dss-icon-button size="md" variant="primary" icon=${this.isOpen ? "keyboard_arrow_up" : "keyboard_arrow_down"}></dss-icon-button>
39
- </div>
40
- <div class="content ${this.isOpen ? "open" : ""}">
41
- <slot name="content"></slot>
42
- </div>
43
- `;
44
- }
45
- }
@@ -1,4 +0,0 @@
1
- export enum shellViews {
2
- shell = "primaria-shell",
3
- error = "primaria-error-view",
4
- }
@@ -1,105 +0,0 @@
1
- import { BrokerDisposableHandler } from "@uxland/harmonix";
2
- import { IRegion, region } from "@uxland/regions";
3
- import { LitElement, css, html, unsafeCSS } from "lit";
4
- import { state } from "lit/decorators.js";
5
- import { PrimariaRegionHost, shellApi } from "../../../api/api";
6
- import { BROKER_EVENTS } from "../../../api/broker/broker-events";
7
- import { disposeShell } from "../../../disposer";
8
- import { translate } from "../../../locales";
9
- import { shellViews } from "./constants";
10
- import styles from "./styles.css?inline";
11
- import { template } from "./template";
12
-
13
- export class PrimariaShell extends PrimariaRegionHost(LitElement) {
14
- render() {
15
- return html`${template(this)}`;
16
- }
17
-
18
- static styles = css`
19
- ${unsafeCSS(styles)}
20
- `;
21
-
22
- connectedCallback() {
23
- super.connectedCallback();
24
- this._subscribeEvents();
25
- }
26
-
27
- disconnectedCallback() {
28
- super.disconnectedCallback();
29
- this._unsubscribeEvents();
30
- }
31
-
32
- @region({ targetId: "menu-region-container", name: shellApi.regionManager.regions.shell.navigationMenu })
33
- navigationMenuRegion: IRegion | undefined;
34
-
35
- @region({ targetId: "main-region-container", name: shellApi.regionManager.regions.shell.main })
36
- mainRegion: IRegion | undefined;
37
-
38
- @region({ targetId: "quick-actions-region-container", name: shellApi.regionManager.regions.shell.quickActions })
39
- quickActionsRegion: IRegion | undefined;
40
-
41
- @region({ targetId: "floating-region-container", name: shellApi.regionManager.regions.shell.floating })
42
- floatingRegion: IRegion | undefined;
43
-
44
- @region({
45
- targetId: "navigation-menu-lower-region-container",
46
- name: shellApi.regionManager.regions.shell.navigationLowerLeftMenu,
47
- })
48
- navLowerLeftMenu: IRegion | undefined;
49
-
50
- @state()
51
- sidebarExpanded = false;
52
-
53
- @state()
54
- viewSelected = shellViews.shell;
55
-
56
- @state()
57
- error: { message: string };
58
-
59
- @state()
60
- quickActionBusy = false;
61
-
62
- _toggleSidebar() {
63
- this.sidebarExpanded = !this.sidebarExpanded;
64
- }
65
-
66
- private subscriptions: BrokerDisposableHandler[] = [];
67
-
68
- _subscribeEvents() {
69
- this.subscriptions.push(
70
- shellApi.broker.subscribe(BROKER_EVENTS.shell.appCrashed, (error: { message: string }) => {
71
- this._handleError(error);
72
- }),
73
- );
74
-
75
- this.subscriptions.push(
76
- shellApi.broker.subscribe(BROKER_EVENTS.shell.refreshTokenFailed, (detail: any) => {
77
- this._handleError({ message: translate("errors.session") });
78
- }),
79
- );
80
-
81
- this.subscriptions.push(
82
- shellApi.broker.subscribe(BROKER_EVENTS.shell.mpidHeaderInvalid, (detail: any) => {
83
- this._handleError({ message: translate("errors.invalidPatient") });
84
- }),
85
- );
86
-
87
- this.subscriptions.push(
88
- shellApi.broker.subscribe(BROKER_EVENTS.shell.quickActionBusyChanged, (detail: { busy: boolean }) => {
89
- this.quickActionBusy = detail.busy;
90
- }),
91
- );
92
- }
93
-
94
- _handleError(error: { message: string }) {
95
- this.viewSelected = shellViews.error;
96
- this.error = error;
97
- // Sense esperar a proposit: aixo es un callback sincron de Lit i aqui ja pintem la vista
98
- // d'error, que no depen que el teardown hagi acabat. El `void` ho marca com a deliberat.
99
- void disposeShell();
100
- }
101
-
102
- _unsubscribeEvents() {
103
- this.subscriptions.forEach((s) => s.dispose());
104
- }
105
- }
@@ -1,13 +0,0 @@
1
- import { html, LitElement, css, unsafeCSS } from "lit";
2
- import styles from "./styles.css?inline";
3
- import { template } from "./template";
4
-
5
- export class HeaderDivider extends LitElement {
6
- render() {
7
- return html`${template(this)}`;
8
- }
9
-
10
- static styles = css`
11
- ${unsafeCSS(styles)}
12
- `;
13
- }
@@ -1,5 +0,0 @@
1
- .header-container {
2
- width: 1px;
3
- height: 40px;
4
- background-color: var(--color-neutral-100);
5
- }
@@ -1,8 +0,0 @@
1
- import { html } from "lit";
2
- import { HeaderDivider } from "./header-divider";
3
-
4
- export const template = (props: HeaderDivider) => {
5
- return html`
6
- <div class="header-container"></div>
7
- `;
8
- };
@@ -1,71 +0,0 @@
1
- import { IRegion, region } from "@uxland/regions";
2
- import { LitElement, css, html, unsafeCSS } from "lit";
3
- import { property, state } from "lit/decorators.js";
4
- import { PrimariaRegionHost, shellApi } from "../../../../api/api";
5
- import { ExitShell } from "../../../../features/exit/request";
6
- import { GetUserInfo } from "../../../../features/get-user-info/request";
7
- import styles from "./styles.css?inline";
8
- import { template } from "./template";
9
- import { IUserInfo } from "../../../../features/get-user-info/model";
10
-
11
- export class PrimariaShellHeader extends PrimariaRegionHost(LitElement) {
12
- render() {
13
- return html`${template(this)}`;
14
- }
15
-
16
- static styles = css`
17
- ${unsafeCSS(styles)}
18
- `;
19
-
20
- @region({ targetId: "header-region-container", name: shellApi.regionManager.regions.shell.header })
21
- headerRegion: IRegion | undefined;
22
-
23
- @region({ targetId: "header-actions-region-container", name: shellApi.regionManager.regions.shell.headerRightActions })
24
- headerRightActionsRegion: IRegion | undefined;
25
-
26
- @property({ type: Object })
27
- professional: IUserInfo;
28
-
29
- @state()
30
- menuOpened = false;
31
-
32
- toggleMenu() {
33
- this.menuOpened = !this.menuOpened;
34
- }
35
-
36
- logout() {
37
- shellApi.broker.send(new ExitShell());
38
- }
39
-
40
- connectedCallback() {
41
- super.connectedCallback();
42
- shellApi.broker.send(new GetUserInfo()).then((response: IUserInfo) => {
43
- this.professional = response;
44
- });
45
- }
46
-
47
- firstUpdated() {
48
- const container = this.renderRoot?.querySelector("#header-region-container");
49
- if (!container) return;
50
-
51
- let observer: MutationObserver;
52
-
53
- const updateDividers = () => {
54
- observer.disconnect();
55
-
56
- Array.from(container.querySelectorAll("header-divider")).forEach((div) => (div as HTMLElement).remove());
57
-
58
- const children = Array.from(container.children).filter((el) => (el as HTMLElement).tagName !== "HEADER-DIVIDER");
59
-
60
- for (let i = 1; i < children.length; i++) {
61
- const divider = document.createElement("header-divider");
62
- container.insertBefore(divider, children[i]);
63
- }
64
-
65
- observer.observe(container, { childList: true });
66
- };
67
-
68
- observer = new MutationObserver(updateDividers);
69
- observer.observe(container, { childList: true });
70
- }
71
- }
@@ -1,45 +0,0 @@
1
- .header {
2
- display: flex;
3
- flex-direction: row;
4
- align-items: center;
5
- justify-content: space-between;
6
- padding: 0 16px;
7
- height: 60px;
8
- background-color: white;
9
- color: black;
10
- z-index: 1;
11
- box-shadow:
12
- rgba(0, 0, 0, 0.12) 4px -1px 3px,
13
- rgba(0, 0, 0, 0.24) 0px 1px 2px;
14
- position: relative;
15
- z-index: 998;
16
- .header__left {
17
- display: flex;
18
- flex-direction: row;
19
- align-items: center;
20
- gap: 16px;
21
-
22
- .header-logo {
23
- align-self: center;
24
- }
25
- #header-region-container {
26
- display: flex;
27
- flex-direction: row;
28
- align-items: center;
29
- gap: 16px;
30
- }
31
- }
32
-
33
- .header__right {
34
- display: flex;
35
- flex-direction: row;
36
- align-items: center;
37
- gap: 16px;
38
-
39
- #header-actions-region-container {
40
- display: flex;
41
- flex-direction: row;
42
- align-items: center;
43
- }
44
- }
45
- }
@@ -1,37 +0,0 @@
1
- import { html } from "lit";
2
- import salutLogo from "../../../../UI/images/Salut_Logotip.svg";
3
- import { PrimariaShellHeader } from "./shell-header";
4
- import { when } from "lit/directives/when.js";
5
- import { translate } from "../../../../locales";
6
-
7
- export const template = (props: PrimariaShellHeader) => {
8
- const workCenterElements = [{ label: props.professional?.workCenter, value: "1" }];
9
- const roleElements = [{ label: props.professional?.role, value: "1" }];
10
- const specialityElements = [{ label: props.professional?.speciality, value: "1" }];
11
- const selectedValue = ["1"];
12
-
13
- return html`
14
- <div class="header">
15
- <div class="header__left">
16
- <div class="header-logo">
17
- <img src=${salutLogo} alt="logo" />
18
- </div>
19
- <header-divider></header-divider>
20
- <div id="header-region-container"></div>
21
- </div>
22
- <div class="header__right">
23
- <div id="header-actions-region-container"></div>
24
- <header-divider></header-divider>
25
- ${when(
26
- props.professional,
27
- () => html`<dss-header-menu-professional hideViewDetails @primary-action=${props.logout} name="${props.professional.firstName} ${props.professional?.familyName} ${props.professional?.lastName}" center="${props.professional.workCenter}" collegiate="${props.professional.registrationNumber}">
28
- <dss-avatar size="xl" name="${props.professional.firstName}" surname="${props.professional?.familyName}" slot="avatar"></dss-avatar>
29
- <dss-select icon="maps_home_work" label=${translate("header.workCenter")} .elements=${workCenterElements} .selectedValue=${selectedValue} readonly></dss-select>
30
- <dss-select icon="business_center" label=${translate("header.role")} .elements=${roleElements} .selectedValue=${selectedValue} readonly></dss-select>
31
- <dss-select icon="people_alt" label=${translate("header.speciality")} .elements=${specialityElements} .selectedValue=${selectedValue} readonly></dss-select>
32
- </dss-header-menu-professional>`,
33
- )}
34
- </div>
35
- </div>
36
- `;
37
- };