@uxland/primary-shell 5.4.3 → 5.4.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.
- package/dist/index.js +7 -18
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +4 -4
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +2 -2
- package/src/UI/components/primaria-shell/styles.css +11 -0
- package/src/UI/internal-views/upper-nav-views.ts +1 -1
- package/src/UI/shared-components/primaria-nav-item/styles.css +1 -0
- package/src/internal-plugins/activity-history/activity-history-item/list/UI/timeline/styles.css +1 -0
- package/src/internal-plugins/activity-history/activity-history-item/list/group-history-items/group-history-items.test.ts +61 -96
- package/src/internal-plugins/activity-history/activity-history-item/list/group-history-items/group-history-items.ts +2 -30
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxland/primary-shell",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.5",
|
|
4
4
|
"description": "Primaria Shell",
|
|
5
5
|
"author": "UXLand <dev@uxland.es>",
|
|
6
6
|
"homepage": "https://github.com/uxland/harmonix/tree/app#readme",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@uxland/harmonix": "^1.1.1",
|
|
29
|
-
"@uxland/harmonix-adapters": "^1.2.
|
|
29
|
+
"@uxland/harmonix-adapters": "^1.2.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@primaria/plugins-core": "^1.0.14",
|
|
@@ -58,6 +58,17 @@
|
|
|
58
58
|
flex-direction: column;
|
|
59
59
|
gap: 4px;
|
|
60
60
|
}
|
|
61
|
+
|
|
62
|
+
/*Temporary scrollbar*/
|
|
63
|
+
#menu-region-container {
|
|
64
|
+
overflow-y: auto;
|
|
65
|
+
margin-right: -10px;
|
|
66
|
+
padding-right: 10px;
|
|
67
|
+
scrollbar-color: var(--color-primary-900) var(--color-primary-700);
|
|
68
|
+
scrollbar-width: thin;
|
|
69
|
+
}
|
|
70
|
+
/**/
|
|
71
|
+
|
|
61
72
|
.bottom-content {
|
|
62
73
|
display: flex;
|
|
63
74
|
flex-direction: column;
|
|
@@ -154,7 +154,7 @@ const upperNavMenuItems: MenuItemConfig[] = [
|
|
|
154
154
|
label: "Gabinets de proves",
|
|
155
155
|
type: "item",
|
|
156
156
|
sortHint: "0080",
|
|
157
|
-
callbackFn: () =>
|
|
157
|
+
callbackFn: () => navigateToEcapWithoutClosingWithCip("GABINETS_PROVES"),
|
|
158
158
|
},
|
|
159
159
|
{
|
|
160
160
|
id: "prescriptions",
|
|
@@ -1,135 +1,100 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
2
|
import { IActivityHistoryItem } from "../../domain/model";
|
|
3
|
+
import * as diagnosticsUtils from "../../domain/validation/diagnostics/has-valid-diagnostics";
|
|
4
|
+
import * as sameDiagnosticsUtils from "../../domain/validation/diagnostics/are-same-diagnostics";
|
|
3
5
|
import { groupActivityHistoryItems } from "./group-history-items";
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
vi.mock("../../domain/validation/diagnostics/has-valid-diagnostics", () => ({
|
|
8
|
+
hasValidDiagnostics: vi.fn(),
|
|
9
|
+
}));
|
|
10
|
+
vi.mock("../../domain/validation/diagnostics/are-same-diagnostics", () => ({
|
|
11
|
+
areSameDiagnostics: vi.fn(),
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
const mockItem = (overrides: Partial<IActivityHistoryItem>): IActivityHistoryItem => ({
|
|
7
15
|
date: new Date().toISOString(),
|
|
8
|
-
|
|
16
|
+
diagnostics: [],
|
|
17
|
+
professional: {
|
|
18
|
+
id: "1",
|
|
19
|
+
role: { id: "r1" },
|
|
20
|
+
speciality: { id: "s1" },
|
|
21
|
+
},
|
|
9
22
|
ep: { id: "ep1" },
|
|
10
23
|
up: { id: "up1" },
|
|
11
24
|
center: { id: "c1" },
|
|
12
|
-
service: { id: "
|
|
13
|
-
diagnostics: [],
|
|
25
|
+
service: { id: "svc1" },
|
|
14
26
|
...overrides,
|
|
15
27
|
});
|
|
16
28
|
|
|
17
29
|
describe("groupActivityHistoryItems", () => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
baseItem({ id: "1", date: now.toISOString() }),
|
|
22
|
-
baseItem({ id: "2", date: new Date(now.getTime() + 2 * 3600 * 1000).toISOString() }),
|
|
23
|
-
];
|
|
30
|
+
beforeEach(() => {
|
|
31
|
+
vi.clearAllMocks();
|
|
32
|
+
});
|
|
24
33
|
|
|
25
|
-
|
|
34
|
+
it("agrupa ítems que son de la misma visita y dentro de 8h", () => {
|
|
35
|
+
const date1 = new Date();
|
|
36
|
+
const date2 = new Date(date1.getTime() + 2 * 60 * 60 * 1000); // +2h
|
|
26
37
|
|
|
27
|
-
|
|
28
|
-
expect(result[0].sameVisit).toBe(true);
|
|
29
|
-
expect(result[0].items).toHaveLength(2);
|
|
30
|
-
});
|
|
38
|
+
const items = [mockItem({ date: date1.toISOString() }), mockItem({ date: date2.toISOString() })];
|
|
31
39
|
|
|
32
|
-
|
|
33
|
-
const now = new Date();
|
|
34
|
-
const items = [
|
|
35
|
-
baseItem({
|
|
36
|
-
id: "1",
|
|
37
|
-
date: now.toISOString(),
|
|
38
|
-
professional: { id: "p1", role: { id: "r1" }, speciality: { id: "s1" } },
|
|
39
|
-
}),
|
|
40
|
-
baseItem({
|
|
41
|
-
id: "2",
|
|
42
|
-
date: new Date(now.getTime() + 2 * 3600 * 1000).toISOString(),
|
|
43
|
-
professional: { id: "p2", role: { id: "r2" }, speciality: { id: "s2" } },
|
|
44
|
-
}),
|
|
45
|
-
];
|
|
40
|
+
(diagnosticsUtils.hasValidDiagnostics as any).mockReturnValue(false);
|
|
46
41
|
|
|
47
42
|
const result = groupActivityHistoryItems(items);
|
|
48
43
|
|
|
49
44
|
expect(result).toHaveLength(1);
|
|
50
|
-
expect(result[0].sameVisit).toBe(false);
|
|
51
45
|
expect(result[0].items).toHaveLength(2);
|
|
52
46
|
});
|
|
53
47
|
|
|
54
|
-
it("no agrupa
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
baseItem({ id: "1", date: now.toISOString() }),
|
|
58
|
-
baseItem({ id: "2", date: new Date(now.getTime() + 9 * 3600 * 1000).toISOString() }),
|
|
59
|
-
];
|
|
48
|
+
it("no agrupa ítems de diferente visita", () => {
|
|
49
|
+
const item1 = mockItem({ professional: { id: "1", role: { id: "r1" }, speciality: { id: "s1" } } });
|
|
50
|
+
const item2 = mockItem({ professional: { id: "2", role: { id: "r2" }, speciality: { id: "s2" } } });
|
|
60
51
|
|
|
61
|
-
|
|
52
|
+
(diagnosticsUtils.hasValidDiagnostics as any).mockReturnValue(false);
|
|
53
|
+
|
|
54
|
+
const result = groupActivityHistoryItems([item1, item2]);
|
|
62
55
|
|
|
63
56
|
expect(result).toHaveLength(2);
|
|
64
57
|
});
|
|
65
58
|
|
|
66
|
-
it("crea subgrupos
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
codi: "A123",
|
|
71
|
-
cataleg: "ICD-10",
|
|
72
|
-
descripcio: "Dolor lumbar",
|
|
73
|
-
},
|
|
74
|
-
];
|
|
75
|
-
const items = [
|
|
76
|
-
baseItem({ id: "1", date: now.toISOString(), diagnostics }),
|
|
77
|
-
baseItem({ id: "2", date: new Date(now.getTime() + 1000).toISOString(), diagnostics }),
|
|
78
|
-
];
|
|
59
|
+
it("crea subgrupos por diagnósticos válidos e iguales", () => {
|
|
60
|
+
const diagnostics = [{ code: "A" }];
|
|
61
|
+
const item1 = mockItem({ diagnostics });
|
|
62
|
+
const item2 = mockItem({ diagnostics });
|
|
79
63
|
|
|
80
|
-
|
|
64
|
+
(diagnosticsUtils.hasValidDiagnostics as any).mockReturnValue(true);
|
|
65
|
+
(sameDiagnosticsUtils.areSameDiagnostics as any).mockReturnValue(true);
|
|
66
|
+
|
|
67
|
+
const result = groupActivityHistoryItems([item1, item2]);
|
|
81
68
|
|
|
69
|
+
expect(result).toHaveLength(1);
|
|
82
70
|
expect(result[0].subGroups).toHaveLength(1);
|
|
83
|
-
expect(result[0].subGroups
|
|
84
|
-
expect(result[0].items).toHaveLength(0);
|
|
71
|
+
expect(result[0].subGroups[0].items).toHaveLength(2);
|
|
72
|
+
expect(result[0].items).toHaveLength(0); // todos se agruparon
|
|
85
73
|
});
|
|
86
74
|
|
|
87
|
-
it("
|
|
88
|
-
const
|
|
89
|
-
const
|
|
90
|
-
{
|
|
91
|
-
codi: "A123",
|
|
92
|
-
cataleg: "ICD-10",
|
|
93
|
-
descripcio: "Dolor lumbar",
|
|
94
|
-
},
|
|
95
|
-
];
|
|
96
|
-
const diagnostics2 = [
|
|
97
|
-
{
|
|
98
|
-
codi: "A123",
|
|
99
|
-
},
|
|
100
|
-
];
|
|
101
|
-
const items = [
|
|
102
|
-
baseItem({ id: "1", date: now.toISOString(), diagnostics1 }),
|
|
103
|
-
baseItem({ id: "2", date: new Date(now.getTime() + 1000).toISOString(), diagnostics2 }),
|
|
104
|
-
];
|
|
75
|
+
it("deja fuera del subgrupo los ítems con diagnósticos no válidos", () => {
|
|
76
|
+
const item1 = mockItem({ diagnostics: [{ code: "A" }] });
|
|
77
|
+
const item2 = mockItem({ diagnostics: [] });
|
|
105
78
|
|
|
106
|
-
|
|
79
|
+
(diagnosticsUtils.hasValidDiagnostics as any).mockImplementation((d: any[]) => d.length > 0);
|
|
80
|
+
(sameDiagnosticsUtils.areSameDiagnostics as any).mockReturnValue(true);
|
|
107
81
|
|
|
108
|
-
|
|
109
|
-
|
|
82
|
+
const result = groupActivityHistoryItems([item1, item2]);
|
|
83
|
+
|
|
84
|
+
expect(result[0].subGroups).toHaveLength(1);
|
|
85
|
+
expect(result[0].subGroups[0].items).toHaveLength(1);
|
|
86
|
+
expect(result[0].items).toHaveLength(1); // el que no tiene diagnóstico válido
|
|
110
87
|
});
|
|
111
88
|
|
|
112
|
-
it("
|
|
113
|
-
const
|
|
114
|
-
const
|
|
115
|
-
baseItem({
|
|
116
|
-
id: "1",
|
|
117
|
-
date: now.toISOString(),
|
|
118
|
-
diagnostics: [
|
|
119
|
-
{
|
|
120
|
-
codi: "A123",
|
|
121
|
-
cataleg: "ICD-10",
|
|
122
|
-
descripcio: "Dolor lumbar",
|
|
123
|
-
},
|
|
124
|
-
],
|
|
125
|
-
}),
|
|
126
|
-
baseItem({ id: "2", date: new Date(now.getTime() + 1000).toISOString() }),
|
|
127
|
-
];
|
|
89
|
+
it("crea subgrupos distintos para diagnósticos distintos", () => {
|
|
90
|
+
const item1 = mockItem({ diagnostics: [{ code: "A" }] });
|
|
91
|
+
const item2 = mockItem({ diagnostics: [{ code: "B" }] });
|
|
128
92
|
|
|
129
|
-
|
|
93
|
+
(diagnosticsUtils.hasValidDiagnostics as any).mockReturnValue(true);
|
|
94
|
+
(sameDiagnosticsUtils.areSameDiagnostics as any).mockReturnValue(false);
|
|
130
95
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
expect(result[0].
|
|
96
|
+
const result = groupActivityHistoryItems([item1, item2]);
|
|
97
|
+
|
|
98
|
+
expect(result[0].subGroups).toHaveLength(2);
|
|
134
99
|
});
|
|
135
100
|
});
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IActivityHistoryItem,
|
|
3
|
-
IActivityHistoryGroup,
|
|
4
|
-
IActivityHistorySubGroup,
|
|
5
|
-
} from "../../domain/model";
|
|
1
|
+
import { IActivityHistoryItem, IActivityHistoryGroup, IActivityHistorySubGroup } from "../../domain/model";
|
|
6
2
|
import { areSameDiagnostics } from "../../domain/validation/diagnostics/are-same-diagnostics";
|
|
7
3
|
import { hasValidDiagnostics } from "../../domain/validation/diagnostics/has-valid-diagnostics";
|
|
8
4
|
|
|
@@ -72,7 +68,6 @@ const groupActivityHistoryItems = (items: IActivityHistoryItem[]): IActivityHist
|
|
|
72
68
|
items?.forEach((item) => {
|
|
73
69
|
let added = false;
|
|
74
70
|
|
|
75
|
-
// Primer intento: agrupar por misma visita y dentro de 8 horas
|
|
76
71
|
for (const group of groups) {
|
|
77
72
|
const firstItem = group.items[0];
|
|
78
73
|
const lastItem = group.items[group.items.length - 1];
|
|
@@ -83,43 +78,20 @@ const groupActivityHistoryItems = (items: IActivityHistoryItem[]): IActivityHist
|
|
|
83
78
|
withinEightHours(lastItem.date, item.date)
|
|
84
79
|
) {
|
|
85
80
|
group.items.push(item);
|
|
86
|
-
group.sameVisit = true; // marcamos el grupo como de "misma visita"
|
|
87
81
|
added = true;
|
|
88
82
|
break;
|
|
89
83
|
}
|
|
90
84
|
}
|
|
91
85
|
|
|
92
|
-
// Segundo intento: agrupar solo por 8h, pero solo en grupos que NO son "misma visita"
|
|
93
|
-
if (!added) {
|
|
94
|
-
for (const group of groups) {
|
|
95
|
-
if (group.sameVisit) continue; // evitamos mezclar visitas
|
|
96
|
-
|
|
97
|
-
const firstItem = group.items[0];
|
|
98
|
-
const lastItem = group.items[group.items.length - 1];
|
|
99
|
-
|
|
100
|
-
if (
|
|
101
|
-
withinEightHours(firstItem.date, item.date) &&
|
|
102
|
-
withinEightHours(lastItem.date, item.date)
|
|
103
|
-
) {
|
|
104
|
-
group.items.push(item);
|
|
105
|
-
added = true;
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Si no se pudo agrupar, crear un nuevo grupo
|
|
112
86
|
if (!added) {
|
|
113
87
|
groups.push({
|
|
114
|
-
idGroup:
|
|
88
|
+
idGroup: Math.random().toString(36).substr(2, 9),
|
|
115
89
|
items: [item],
|
|
116
|
-
sameVisit: false,
|
|
117
90
|
});
|
|
118
91
|
}
|
|
119
92
|
});
|
|
120
93
|
|
|
121
94
|
// Crear subgrupos por diagnósticos iguales. Los items que no tienen diagnostico, se quedan fuera de subgrupos (remaining items)
|
|
122
|
-
|
|
123
95
|
groupByValidDiagnostics(groups);
|
|
124
96
|
|
|
125
97
|
return groups;
|