@uxland/primary-shell 5.3.0 → 5.3.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.
@@ -0,0 +1,3 @@
1
+ import { IActivityHistoryItem } from './model';
2
+
3
+ export declare function shouldShowRole(item: IActivityHistoryItem): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxland/primary-shell",
3
- "version": "5.3.0",
3
+ "version": "5.3.2",
4
4
  "description": "Primaria Shell",
5
5
  "author": "UXLand <dev@uxland.es>",
6
6
  "homepage": "https://github.com/uxland/harmonix/tree/app#readme",
@@ -30,7 +30,7 @@ export const useClinicalMonitoring = (api: PrimariaApi) => {
30
30
  });
31
31
  return Promise.resolve(menuItem);
32
32
  },
33
- sortHint: "000200",
33
+ sortHint: "0020",
34
34
  });
35
35
  };
36
36
 
@@ -21,7 +21,7 @@ const registerUpperNavMenuViews = () => {
21
21
  });
22
22
  return Promise.resolve(menuItem);
23
23
  },
24
- sortHint: "000100",
24
+ sortHint: "0010",
25
25
  });
26
26
 
27
27
  shellApi.regionManager.registerView(shellRegions.navigationMenu, {
@@ -68,7 +68,7 @@ const registerUpperNavMenuViews = () => {
68
68
  });
69
69
  return Promise.resolve(menuItem);
70
70
  },
71
- sortHint: "000400",
71
+ sortHint: "0040",
72
72
  });
73
73
  shellApi.regionManager.registerView(shellRegions.navigationMenu, {
74
74
  id: "unique-petition",
@@ -109,7 +109,7 @@ const registerUpperNavMenuViews = () => {
109
109
  });
110
110
  return Promise.resolve(menuItem);
111
111
  },
112
- sortHint: "000500",
112
+ sortHint: "0050",
113
113
  });
114
114
  shellApi.regionManager.registerView(shellRegions.navigationMenu, {
115
115
  id: "results-reports",
@@ -136,7 +136,7 @@ const registerUpperNavMenuViews = () => {
136
136
  });
137
137
  return Promise.resolve(menuItem);
138
138
  },
139
- sortHint: "000700",
139
+ sortHint: "0070",
140
140
  });
141
141
  shellApi.regionManager.registerView(shellRegions.navigationMenu, {
142
142
  id: "communication",
@@ -182,7 +182,7 @@ const registerUpperNavMenuViews = () => {
182
182
  });
183
183
  return Promise.resolve(menuItem);
184
184
  },
185
- sortHint: "001200",
185
+ sortHint: "0120",
186
186
  });
187
187
  shellApi.regionManager.registerView(shellRegions.navigationMenu, {
188
188
  id: "visits",
@@ -196,7 +196,7 @@ const registerUpperNavMenuViews = () => {
196
196
  });
197
197
  return Promise.resolve(menuItem);
198
198
  },
199
- sortHint: "001300",
199
+ sortHint: "0130",
200
200
  });
201
201
 
202
202
  shellApi.regionManager.registerView(shellRegions.navigationMenu, {
@@ -0,0 +1,5 @@
1
+ import { IActivityHistoryItem } from "./model";
2
+
3
+ export function shouldShowRole(item: IActivityHistoryItem): boolean {
4
+ return !item.professional.speciality.description;
5
+ }
@@ -10,6 +10,7 @@ import {
10
10
  import { activityHistoryGroupedItems } from "../../../selectors";
11
11
  import styles from "./styles.css?inline";
12
12
  import { template } from "./template";
13
+ import { unsafeHTML } from "lit/directives/unsafe-html.js";
13
14
 
14
15
  //@ts-ignore
15
16
  @customElement("activity-history-timeline")
@@ -76,6 +77,10 @@ export class ActivityHistoryTimeline extends LitElement {
76
77
  return text.replace(regex, `<span class="highlight">$1</span>`);
77
78
  }
78
79
 
80
+ highlighted(text?: string) {
81
+ return text ? unsafeHTML(this.highlightMatch(text, this.searchString)) : null;
82
+ }
83
+
79
84
  _scrollIntoDate(selectedDate: number) {
80
85
  let closestElement = null;
81
86
  let closestDifference = Number.POSITIVE_INFINITY;
@@ -3,7 +3,6 @@ import { ActivityHistoryTimeline } from "./activity-history-timeline";
3
3
  import { repeat } from "lit/directives/repeat.js";
4
4
  import { IEntityDescription } from "@primaria/plugins-core";
5
5
  import { format } from "date-fns";
6
- import { unsafeHTML } from "lit/directives/unsafe-html.js";
7
6
  import notFound from "../../../../../../UI/images/not-found.svg";
8
7
  import { ifDefined } from "lit/directives/if-defined.js";
9
8
  import {
@@ -14,6 +13,7 @@ import {
14
13
  } from "../../../domain/model";
15
14
  import { translate } from "../../../../localization";
16
15
  import { virtualize } from "@lit-labs/virtualizer/virtualize.js";
16
+ import { shouldShowRole } from "../../../domain/business-rules";
17
17
 
18
18
  export const template = (props: ActivityHistoryTimeline) => {
19
19
  if (!props._hasUpdatedOnce) {
@@ -72,25 +72,40 @@ export const template = (props: ActivityHistoryTimeline) => {
72
72
  const visitHeaderTemplate = (
73
73
  props: ActivityHistoryTimeline,
74
74
  item: IActivityHistoryItem | undefined,
75
- ) =>
76
- item &&
77
- html`
78
- <div class="visit__header">
79
- <div class="title">
80
- <div class="title-date">
81
- <div>${format(new Date(item.date), "dd/MM/yyyy")}</div>
82
- </div>
83
- <div class="title-description">
84
- <div>
85
- ${unsafeHTML(props.highlightMatch(item.professional.name, props.searchString))} |
86
- ${unsafeHTML(props.highlightMatch(item.professional.role.description, props.searchString))} |
87
- ${unsafeHTML(props.highlightMatch(item.center.description, props.searchString))} |
88
- ${unsafeHTML(props.highlightMatch(item.professional.speciality.description, props.searchString))}
75
+ ) => {
76
+ if (!item) return nothing;
77
+
78
+ return html`
79
+ <div class="visit__header">
80
+ <div class="title">
81
+ <div class="title-date">
82
+ <div>${format(new Date(item.date), "dd/MM/yyyy")}</div>
83
+ </div>
84
+ <div class="title-description">
85
+ <div>
86
+ ${renderProfessionalValues(props, item)}
87
+ </div>
89
88
  </div>
90
89
  </div>
91
90
  </div>
92
- </div>
93
- `;
91
+ `;
92
+ };
93
+
94
+ const renderProfessionalValues = (props: ActivityHistoryTimeline, item: IActivityHistoryItem) => {
95
+ const showRole = shouldShowRole(item);
96
+ const professionalItems = [
97
+ props.highlighted(item.professional.name),
98
+ showRole ? props.highlighted(item.professional.role.description) : null,
99
+ props.highlighted(item.center.description),
100
+ props.highlighted(item.professional.speciality.description),
101
+ ].filter(Boolean);
102
+
103
+ const professionalValues = professionalItems.map(
104
+ (item, i) => html`${item}${i < professionalItems.length - 1 ? " | " : ""}`,
105
+ );
106
+
107
+ return professionalValues;
108
+ };
94
109
 
95
110
  const diagnosticHeaderTemplate = (item: IActivityHistoryItem | undefined) =>
96
111
  item &&
@@ -1,17 +0,0 @@
1
- import { LitElement } from 'lit';
2
- import { IActivityHistoryGroup } from '../../../domain/model';
3
-
4
- export declare class ActivityHistoryTimeline extends LitElement {
5
- render(): import('lit').TemplateResult<1>;
6
- static styles: import('lit').CSSResult;
7
- historyGroups: IActivityHistoryGroup[];
8
- isAnyCollectionLoadingWithoutAnyLoaded: boolean;
9
- isSomeCollectionLoadedAndOtherLoading: boolean;
10
- searchString: string;
11
- _hasUpdatedOnce: boolean;
12
- firstUpdated(): void;
13
- updated(changedProperties: any): Promise<void>;
14
- prepareComponents(historyGroups: any): Promise<void>;
15
- highlightMatch(text: string, searchString: string): string;
16
- _scrollIntoDate(selectedDate: number): void;
17
- }