@uxland/primary-shell 5.4.6 → 5.4.7

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.
@@ -0,0 +1,16 @@
1
+ import { PropertyValues } from 'lit';
2
+ import { IRegion } from '@uxland/regions';
3
+
4
+ declare const CommunicationActionMenu_base: any;
5
+ export declare class CommunicationActionMenu extends CommunicationActionMenu_base {
6
+ constructor(icon: string, label: string);
7
+ showText: boolean;
8
+ comminucationSidenavRegion: IRegion | undefined;
9
+ static styles: import('lit').CSSResult;
10
+ firstUpdated(_changedProps: PropertyValues<CommunicationActionMenu>): void;
11
+ observeHostResize(): void;
12
+ render(): import('lit').TemplateResult<1>;
13
+ icon: string;
14
+ label: string;
15
+ }
16
+ export {};
@@ -0,0 +1,3 @@
1
+ import { CommunicationActionMenu } from './communication-action-menu';
2
+
3
+ export declare const template: (props: CommunicationActionMenu) => import('lit').TemplateResult<1>;
@@ -1 +1,3 @@
1
1
  export declare const registerUpperNavMenuViews: () => void;
2
+ export declare const registerCommunicationNavMenuItem: () => void;
3
+ export declare const registerCommunicationMenuActions: () => void;
@@ -0,0 +1,9 @@
1
+ import { LitElement } from 'lit';
2
+
3
+ export declare class QuickActionItem extends LitElement {
4
+ constructor(icon: string, label: string, callbackFn: () => void);
5
+ render(): import('lit').TemplateResult<1>;
6
+ icon: string;
7
+ label: string;
8
+ callbackFn: () => void;
9
+ }
@@ -0,0 +1,3 @@
1
+ import { QuickActionItem } from './quick-action-item';
2
+
3
+ export declare const template: (props: QuickActionItem) => import('lit').TemplateResult<1>;
@@ -6,6 +6,7 @@ export declare const shellRegions: {
6
6
  navigationLowerLeftMenu: string;
7
7
  quickActions: string;
8
8
  floating: string;
9
+ communicationSidenav: string;
9
10
  };
10
11
  export declare const clinicalMonitoringRegions: {
11
12
  sidebar: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxland/primary-shell",
3
- "version": "5.4.6",
3
+ "version": "5.4.7",
4
4
  "description": "Primaria Shell",
5
5
  "author": "UXLand <dev@uxland.es>",
6
6
  "homepage": "https://github.com/uxland/harmonix/tree/app#readme",
@@ -6,6 +6,7 @@ import { PrimariaShellHeader } from "./primaria-shell/shell-header/shell-header"
6
6
  import { PocEventsEcap } from "./poc-events-ecap/poc-events-ecap";
7
7
  import { FinalizeVisitButton } from "../../features/visit/finalize-visit/component/finalize-visit-button";
8
8
  import { PrimariaAccordion } from "./primaria-accordion/primaria-accordion";
9
+ import { CommunicationActionMenu } from "./communication-action-menu/communication-action-menu";
9
10
 
10
11
  export const useComponents = () => {
11
12
  //@ts-ignore
@@ -15,6 +16,7 @@ export const useComponents = () => {
15
16
  customElement("primaria-error-view")(PrimariaErrorView);
16
17
  customElement("quick-actions-menu")(QuickActionsMenu);
17
18
  customElement("finalize-visit-button")(FinalizeVisitButton);
19
+ customElement("communication-action-menu")(CommunicationActionMenu);
18
20
  //@ts-ignore
19
21
  customElement("poc-events-ecap")(PocEventsEcap);
20
22
  customElement("primaria-accordion")(PrimariaAccordion);
@@ -0,0 +1,48 @@
1
+ import { LitElement, html, css, unsafeCSS, PropertyValues } from "lit";
2
+ import { template } from "./template";
3
+ import { property, state } from "lit/decorators.js";
4
+ import { shellRegions } from "../../../api/region-manager/regions";
5
+ import { IRegion, region } from "@uxland/regions";
6
+ import { PrimariaRegionHost } from "../../../api/api";
7
+ import styles from "./styles.css?inline";
8
+
9
+ export class CommunicationActionMenu extends PrimariaRegionHost(LitElement) {
10
+ constructor(icon: string, label: string) {
11
+ super();
12
+ this.icon = icon;
13
+ this.label = label;
14
+ }
15
+
16
+ @state() showText = false;
17
+
18
+ @region({ targetId: "communication-sidenav-region-container", name: shellRegions.communicationSidenav })
19
+ comminucationSidenavRegion: IRegion | undefined;
20
+
21
+ static styles = css`
22
+ ${unsafeCSS(styles)}
23
+ `;
24
+
25
+ firstUpdated(_changedProps: PropertyValues<CommunicationActionMenu>) {
26
+ super.firstUpdated(_changedProps);
27
+ this.observeHostResize();
28
+ }
29
+
30
+ observeHostResize() {
31
+ const parentElement = this.parentElement;
32
+ const observer = new ResizeObserver((entries) => {
33
+ for (const entry of entries) {
34
+ const width = entry.target.clientWidth;
35
+ this.showText = width > 100;
36
+ }
37
+ });
38
+
39
+ observer.observe(parentElement as HTMLElement);
40
+ }
41
+
42
+ render() {
43
+ return html`${template(this)}`;
44
+ }
45
+
46
+ @property({ type: String }) icon = "";
47
+ @property({ type: String }) label = "";
48
+ }
@@ -0,0 +1,25 @@
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
+ }
@@ -0,0 +1,23 @@
1
+ import { html, nothing } from "lit";
2
+ import { CommunicationActionMenu } from "./communication-action-menu";
3
+
4
+ export const template = (props: CommunicationActionMenu) => {
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
+ <dss-action-menu id="communication-sidenav-region-container" slot="content" >
19
+ </dss-action-menu>
20
+ </div>
21
+ </div>
22
+ `;
23
+ };
@@ -90,9 +90,6 @@
90
90
  gap: 4px;
91
91
  }
92
92
  }
93
- #quick-actions-region-container {
94
- width: 100%;
95
- }
96
93
  &[expanded] {
97
94
  width: 252px;
98
95
  align-items: flex-start;
@@ -1,6 +1,6 @@
1
1
  import { registerPDFVisorMainView } from "../../api/pdf-viewer-manager/handle-views";
2
2
  import { registerLowerNavMenuViews } from "./lower-nav-menu-views";
3
- import { registerUpperNavMenuViews } from "./upper-nav-views";
3
+ import { registerCommunicationMenuActions, registerCommunicationNavMenuItem, registerUpperNavMenuViews } from "./upper-nav-views";
4
4
 
5
5
  const registerMainViews = () => {
6
6
  registerPDFVisorMainView();
@@ -8,6 +8,9 @@ const registerMainViews = () => {
8
8
 
9
9
  export const useInternalViews = () => {
10
10
  registerMainViews();
11
+ registerCommunicationNavMenuItem();
11
12
  registerUpperNavMenuViews();
12
13
  registerLowerNavMenuViews();
14
+
15
+ registerCommunicationMenuActions();
13
16
  };
@@ -3,6 +3,8 @@ import { shellRegions } from "../../api/region-manager/regions";
3
3
  import { ExitShell } from "../../features/exit/request";
4
4
  import { getPatientCip } from "../../features/get-patient-cip/action";
5
5
  import { navigateToEcapWithoutClosingWithCip } from "../../features/navigate-to-ecap/navigate-without-closing-and-with-cip";
6
+ import { CommunicationActionMenu } from "../components/communication-action-menu/communication-action-menu";
7
+ import { QuickActionItem } from "../shared-components/quick-action-item/quick-action-item";
6
8
  import { PrimariaNavItem } from "../shared-components/primaria-nav-item/primaria-nav-item";
7
9
  import { PrimariaNavTreeMenu } from "../shared-components/primaria-nav-tree-menu/primaria-nav-tree-menu";
8
10
 
@@ -201,34 +203,6 @@ const upperNavMenuItems: MenuItemConfig[] = [
201
203
  sortHint: "0100",
202
204
  callbackFn: () => navigateToEcapWithoutClosingWithCip("REV_IT"),
203
205
  },
204
- {
205
- id: "communication",
206
- icon: "3p",
207
- label: "Comunicació",
208
- type: "tree",
209
- sortHint: "0120",
210
- actionMenuItems: [
211
- {
212
- icon: "open_in_new",
213
- label: "SMS",
214
- callbackFn: async () => {
215
- const CIP = await getPatientCip(shellApi);
216
- shellApi.ecapEventManager.publish("MISSATGES_DEV", "NO_TANCAR", {
217
- CIP: CIP || "",
218
- TipusMissatge: "SMS",
219
- });
220
- },
221
- },
222
- { icon: "open_in_new", label: "eConsulta", callbackFn: () => {} },
223
- { icon: "open_in_new", label: "Mail", callbackFn: () => {} },
224
- {
225
- icon: "open_in_new",
226
- label: "Veu IP",
227
- callbackFn: () => navigateToEcapWithoutClosingWithCip("VOIP"),
228
- },
229
- { icon: "open_in_new", label: "Videoconsulta", callbackFn: () => {} },
230
- ],
231
- },
232
206
  {
233
207
  id: "visits",
234
208
  icon: "event",
@@ -271,3 +245,59 @@ export const registerUpperNavMenuViews = () => {
271
245
  });
272
246
  }
273
247
  };
248
+
249
+ export const registerCommunicationNavMenuItem = () => {
250
+ shellApi.regionManager.registerView(shellRegions.navigationMenu, {
251
+ id: "communication",
252
+ sortHint: "0120",
253
+ factory: () => {
254
+ const menuItem = new CommunicationActionMenu("3p", "Comunicació");
255
+
256
+ return Promise.resolve(menuItem);
257
+ },
258
+ });
259
+ };
260
+
261
+ export const registerCommunicationMenuActions = () => {
262
+ const communicationItems = [
263
+ {
264
+ id: "1",
265
+ sortHint: "0010",
266
+ icon: "open_in_new",
267
+ label: "SMS",
268
+ callbackFn: async () => {
269
+ const CIP = await getPatientCip(shellApi);
270
+ shellApi.ecapEventManager.publish("MISSATGES_DEV", "NO_TANCAR", {
271
+ CIP: CIP || "",
272
+ TipusMissatge: "SMS",
273
+ });
274
+ },
275
+ },
276
+ { id: "2", sortHint: "0020", icon: "open_in_new", label: "eConsulta", callbackFn: () => {} },
277
+ { id: "3", icon: "open_in_new", label: "Mail", callbackFn: () => {} },
278
+ {
279
+ id: "4",
280
+ sortHint: "0030",
281
+ icon: "open_in_new",
282
+ label: "Veu IP",
283
+ callbackFn: () => navigateToEcapWithoutClosingWithCip("VOIP"),
284
+ },
285
+ { id: "5", sortHint: "0040", icon: "open_in_new", label: "Videoconsulta", callbackFn: () => {} },
286
+ ];
287
+ for (const item of communicationItems) {
288
+ shellApi.regionManager.registerView(shellRegions.communicationSidenav, {
289
+ id: item.id,
290
+ sortHint: item.sortHint,
291
+ factory: () => {
292
+ const menuItem = new PrimariaNavItem({
293
+ icon: item.icon,
294
+ label: item.label,
295
+ callbackFn: item.callbackFn,
296
+ });
297
+
298
+ const menuTest = new QuickActionItem(item.icon, item.label, item.callbackFn);
299
+ return Promise.resolve(menuTest);
300
+ },
301
+ });
302
+ }
303
+ };
@@ -0,0 +1,21 @@
1
+ import { LitElement, html } from "lit";
2
+ import { template } from "./template";
3
+ import { customElement, property } from "lit/decorators.js";
4
+
5
+ @customElement("quick-action-item")
6
+ export class QuickActionItem extends LitElement {
7
+ constructor(icon: string, label: string, callbackFn: () => void) {
8
+ super();
9
+ this.icon = icon;
10
+ this.label = label;
11
+ this.callbackFn = callbackFn;
12
+ }
13
+
14
+ render() {
15
+ return html`${template(this)}`;
16
+ }
17
+
18
+ @property({ type: String }) icon = "";
19
+ @property({ type: String }) label = "";
20
+ @property({ attribute: false }) callbackFn = () => {};
21
+ }
@@ -0,0 +1,8 @@
1
+ import { html } from "lit";
2
+ import { QuickActionItem } from "./quick-action-item";
3
+
4
+ export const template = (props: QuickActionItem) => {
5
+ return html`
6
+ <dss-action-menu-item @click=${props.callbackFn} notificationsstate="error" rightIcon=${props.icon} label=${props.label}></dss-action-menu-item>
7
+ `;
8
+ };
@@ -6,6 +6,7 @@ export const shellRegions = {
6
6
  navigationLowerLeftMenu: "navigation-lower-left-menu",
7
7
  quickActions: "quick-actions-region",
8
8
  floating: "floating-region",
9
+ communicationSidenav: "communication-sidenav-region",
9
10
  };
10
11
 
11
12
  export const clinicalMonitoringRegions = {