@uxland/primary-shell 5.1.2 → 5.2.0
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 +27047 -26702
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1637 -1519
- package/dist/index.umd.cjs.map +1 -1
- package/dist/primary/shell/src/UI/bootstrapper.d.ts +1 -0
- package/dist/primary/shell/src/UI/components/bootstrapper.d.ts +1 -0
- package/dist/primary/shell/src/UI/components/{shell-header → primaria-shell/shell-header}/shell-header.d.ts +3 -3
- package/dist/primary/shell/src/UI/components/primaria-shell/shell-header/template.d.ts +3 -0
- package/dist/primary/shell/src/UI/index.d.ts +0 -1
- package/dist/primary/shell/src/UI/shared-components/bootstrapper.d.ts +1 -0
- package/dist/primary/shell/src/UI/shared-components/index.d.ts +0 -1
- package/dist/primary/shell/src/api/api.d.ts +4 -4
- package/dist/primary/shell/src/api/ecap-event-manager/ecap-event-manager.test.d.ts +1 -0
- package/dist/primary/shell/src/api/notification-service/notification-service-impl.test.d.ts +1 -0
- package/dist/primary/shell/src/api/pdf-viewer-manager/constants.d.ts +1 -0
- package/dist/primary/shell/src/api/pdf-viewer-manager/handle-views.d.ts +2 -0
- package/dist/primary/shell/src/api/pdf-viewer-manager/pdf-viewer-manager.d.ts +2 -4
- package/dist/primary/shell/src/api/pdf-viewer-manager/pdf-viewer-manager.test.d.ts +1 -0
- package/dist/primary/shell/src/api/region-manager/region-manager.test.d.ts +1 -0
- package/dist/primary/shell/src/bootstrapper.d.ts +0 -1
- package/dist/primary/shell/src/constants.d.ts +0 -2
- package/dist/primary/shell/src/features/bootstrapper.d.ts +2 -2
- package/dist/primary/shell/src/features/clinical-monitoring/bootstrapper.d.ts +4 -0
- package/dist/primary/shell/src/features/clinical-monitoring/constants.d.ts +1 -0
- package/dist/primary/shell/src/features/clinical-monitoring/handle-views.d.ts +1 -0
- package/dist/primary/shell/src/features/exit/bootstrapper.d.ts +4 -2
- package/dist/primary/shell/src/features/exit/handler.test.d.ts +1 -0
- package/dist/primary/shell/src/features/get-patient-cip/action.d.ts +3 -0
- package/dist/primary/shell/src/features/get-user-info/bootstrapper.d.ts +4 -2
- package/dist/primary/shell/src/features/get-user-info/handler.d.ts +1 -1
- package/dist/primary/shell/src/features/get-user-info/handler.test.d.ts +1 -0
- package/dist/primary/shell/src/features/navigate-to-ecap/navigate-without-closing-and-with-cip.d.ts +1 -0
- package/dist/primary/shell/src/handle-views.d.ts +1 -2
- package/dist/primary/shell/src/internal-plugins/activity-history/utils/get-unique-values-by-prop-path.test.d.ts +1 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/utils/normalize-string.d.ts +1 -1
- package/dist/primary/shell/src/internal-plugins/activity-history/utils/normalize-string.test.d.ts +1 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/utils/prop-contains-string.test.d.ts +1 -0
- package/dist/primary/shell/src/locales.d.ts +1 -1
- package/package.json +2 -2
- package/src/UI/bootstrapper.ts +12 -0
- package/src/UI/components/bootstrapper.ts +17 -0
- package/src/UI/components/{primaria-error-view → error-view}/component.ts +2 -3
- package/src/UI/components/poc-events-ecap/poc-events-ecap.ts +3 -7
- package/src/UI/components/primaria-shell/primaria-shell.ts +8 -10
- package/src/UI/components/{shell-header → primaria-shell/shell-header}/shell-header.ts +8 -9
- package/src/UI/components/{shell-header → primaria-shell/shell-header}/template.ts +4 -4
- package/src/UI/components/primaria-shell/template.ts +14 -8
- package/src/UI/components/quick-actions-menu/quick-actions-menu.ts +0 -2
- package/src/UI/index.ts +0 -1
- package/src/UI/shared-components/bootstrapper.ts +12 -0
- package/src/UI/shared-components/index.ts +0 -3
- package/src/UI/shared-components/primaria-content-switcher/primaria-content-switcher.ts +1 -2
- package/src/UI/shared-components/primaria-nav-item/primaria-nav-item.ts +6 -7
- package/src/UI/shared-components/primaria-nav-tree-menu/primaria-nav-tree-menu.ts +3 -4
- package/src/UI/shared-components/primaria-text-editor/primaria-rich-text-editor.ts +1 -2
- package/src/api/api.ts +17 -14
- package/src/api/ecap-event-manager/ecap-event-manager.test.ts +48 -0
- package/src/api/notification-service/notification-service-impl.test.ts +56 -0
- package/src/api/pdf-viewer-manager/constants.ts +1 -0
- package/src/api/pdf-viewer-manager/handle-views.ts +32 -0
- package/src/api/pdf-viewer-manager/pdf-viewer-manager.test.ts +99 -0
- package/src/api/pdf-viewer-manager/pdf-viewer-manager.ts +15 -25
- package/src/{UI/components → api/pdf-viewer-manager}/pdf-visor/pdf-selector/pdf-selector.ts +3 -4
- package/src/{UI/components → api/pdf-viewer-manager}/pdf-visor/pdf-visor.ts +8 -9
- package/src/api/plugin-busy-manager/plugin-busy-list/component.ts +0 -2
- package/src/api/plugin-busy-manager/plugin-busy-manager.ts +7 -1
- package/src/api/region-manager/region-manager.test.ts +123 -0
- package/src/bootstrapper.ts +8 -9
- package/src/constants.ts +0 -2
- package/src/disposer.ts +2 -2
- package/src/features/bootstrapper.ts +14 -8
- package/src/features/clinical-monitoring/bootstrapper.ts +39 -0
- package/src/{UI/components/clinical-monitoring → features/clinical-monitoring/component}/clinical-monitoring.ts +3 -6
- package/src/features/clinical-monitoring/constants.ts +1 -0
- package/src/features/clinical-monitoring/handle-views.ts +6 -0
- package/src/features/exit/bootstrapper.ts +5 -5
- package/src/features/exit/handler.test.ts +103 -0
- package/src/features/get-patient-cip/action.ts +5 -0
- package/src/features/get-user-info/bootstrapper.ts +5 -5
- package/src/features/get-user-info/handler.test.ts +60 -0
- package/src/features/get-user-info/handler.ts +2 -4
- package/src/features/navigate-to-ecap/navigate-without-closing-and-with-cip.ts +7 -0
- package/src/handle-views.ts +91 -133
- package/src/internal-plugins/activity-history/utils/get-unique-values-by-prop-path.test.ts +61 -0
- package/src/internal-plugins/activity-history/utils/get-unique-values-by-prop-path.ts +2 -2
- package/src/internal-plugins/activity-history/utils/normalize-string.test.ts +29 -0
- package/src/internal-plugins/activity-history/utils/normalize-string.ts +5 -3
- package/src/internal-plugins/activity-history/utils/prop-contains-string.test.ts +47 -0
- package/src/locales.ts +1 -1
- package/dist/primary/shell/src/UI/components/index.d.ts +0 -1
- package/dist/primary/shell/src/UI/components/shell-header/template.d.ts +0 -3
- package/src/UI/components/index.ts +0 -7
- /package/dist/primary/shell/src/UI/components/{primaria-error-view → error-view}/component.d.ts +0 -0
- /package/dist/primary/shell/src/UI/components/{primaria-error-view → error-view}/template.d.ts +0 -0
- /package/dist/primary/shell/src/{UI/components → api/pdf-viewer-manager}/pdf-visor/pdf-selector/pdf-selector.d.ts +0 -0
- /package/dist/primary/shell/src/{UI/components → api/pdf-viewer-manager}/pdf-visor/pdf-selector/template.d.ts +0 -0
- /package/dist/primary/shell/src/{UI/components → api/pdf-viewer-manager}/pdf-visor/pdf-visor.d.ts +0 -0
- /package/dist/primary/shell/src/{UI/components → api/pdf-viewer-manager}/pdf-visor/utils.d.ts +0 -0
- /package/dist/primary/shell/src/{UI/components/clinical-monitoring → features/clinical-monitoring/component}/clinical-monitoring.d.ts +0 -0
- /package/dist/primary/shell/src/{UI/components/clinical-monitoring → features/clinical-monitoring/component}/template.d.ts +0 -0
- /package/src/UI/components/{primaria-error-view → error-view}/styles.css +0 -0
- /package/src/UI/components/{primaria-error-view → error-view}/template.ts +0 -0
- /package/src/UI/components/{shell-header → primaria-shell/shell-header}/styles.css +0 -0
- /package/src/{UI/components → api/pdf-viewer-manager}/pdf-visor/pdf-selector/styles.css +0 -0
- /package/src/{UI/components → api/pdf-viewer-manager}/pdf-visor/pdf-selector/template.ts +0 -0
- /package/src/{UI/components → api/pdf-viewer-manager}/pdf-visor/styles.css +0 -0
- /package/src/{UI/components → api/pdf-viewer-manager}/pdf-visor/utils.ts +0 -0
- /package/src/{UI/components/clinical-monitoring → features/clinical-monitoring/component}/styles.css +0 -0
- /package/src/{UI/components/clinical-monitoring → features/clinical-monitoring/component}/template.ts +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { getUniqueObjects } from "./get-unique-values-by-prop-path";
|
|
3
|
+
|
|
4
|
+
describe("getUniqueObjects", () => {
|
|
5
|
+
it("should return unique objects by id, keeping the last occurrence", () => {
|
|
6
|
+
const items = [
|
|
7
|
+
{ data: { id: "1", label: "Item 1" } },
|
|
8
|
+
{ data: { id: "2", label: "Item 2" } },
|
|
9
|
+
{ data: { id: "1", label: "Item 1 (duplicate)" } }, // <- este debe sobrescribir
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
const result = getUniqueObjects(items, ["data", "id"], ["data", "label"]);
|
|
13
|
+
|
|
14
|
+
expect(result).toEqual([
|
|
15
|
+
{ id: "1", description: "Item 1 (duplicate)" }, // 👈 el último
|
|
16
|
+
{ id: "2", description: "Item 2" },
|
|
17
|
+
]);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("should skip items with missing id or title", () => {
|
|
21
|
+
const items = [
|
|
22
|
+
{ data: { id: "1", label: "Valid" } },
|
|
23
|
+
{ data: { id: 2, label: "Invalid ID" } },
|
|
24
|
+
{ data: { id: "3", label: null } },
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
const result = getUniqueObjects(items, ["data", "id"], ["data", "label"]);
|
|
28
|
+
|
|
29
|
+
expect(result).toEqual([{ id: "1", description: "Valid" }]);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("should return an empty array if input is empty", () => {
|
|
33
|
+
const result = getUniqueObjects([], ["a"], ["b"]);
|
|
34
|
+
expect(result).toEqual([]);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("should handle deeply nested paths", () => {
|
|
38
|
+
const items = [
|
|
39
|
+
{ a: { b: { c: { id: "x1", name: "Deep 1" } } } },
|
|
40
|
+
{ a: { b: { c: { id: "x2", name: "Deep 2" } } } },
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
const result = getUniqueObjects(items, ["a", "b", "c", "id"], ["a", "b", "c", "name"]);
|
|
44
|
+
|
|
45
|
+
expect(result).toEqual([
|
|
46
|
+
{ id: "x1", description: "Deep 1" },
|
|
47
|
+
{ id: "x2", description: "Deep 2" },
|
|
48
|
+
]);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("should handle invalid path safely", () => {
|
|
52
|
+
const items = [
|
|
53
|
+
{ a: { b: { id: "1", name: "Good" } } },
|
|
54
|
+
{ x: { y: { id: "2", name: "Missing Path" } } },
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
const result = getUniqueObjects(items, ["a", "b", "id"], ["a", "b", "name"]);
|
|
58
|
+
|
|
59
|
+
expect(result).toEqual([{ id: "1", description: "Good" }]);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -7,9 +7,9 @@ export function getUniqueObjects<T>(
|
|
|
7
7
|
items
|
|
8
8
|
.map((item) => ({
|
|
9
9
|
id: propPathId.reduce((acc, key) => acc?.[key], item),
|
|
10
|
-
|
|
10
|
+
description: propPathDescription.reduce((acc, key) => acc?.[key], item),
|
|
11
11
|
}))
|
|
12
|
-
.filter((obj) => typeof obj.id === "string" && typeof obj.
|
|
12
|
+
.filter((obj) => typeof obj.id === "string" && typeof obj.description === "string")
|
|
13
13
|
.reduce(
|
|
14
14
|
(map, obj) => map.set(obj.id, obj),
|
|
15
15
|
new Map<string, { id: string; description: string }>(),
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { normalizeStringToNFD } from "./normalize-string";
|
|
3
|
+
|
|
4
|
+
describe("normalizeStringToNFD", () => {
|
|
5
|
+
it("should remove accents and convert to lowercase", () => {
|
|
6
|
+
expect(normalizeStringToNFD("Árbol")).toBe("arbol");
|
|
7
|
+
expect(normalizeStringToNFD("ÉLÉPHANT")).toBe("elephant");
|
|
8
|
+
expect(normalizeStringToNFD("Niño")).toBe("nino");
|
|
9
|
+
expect(normalizeStringToNFD("Cañón")).toBe("canon");
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("should convert only to lowercase if no accents", () => {
|
|
13
|
+
expect(normalizeStringToNFD("HELLO")).toBe("hello");
|
|
14
|
+
expect(normalizeStringToNFD("WORLD")).toBe("world");
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("should handle empty string", () => {
|
|
18
|
+
expect(normalizeStringToNFD("")).toBe("");
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("should return lowercase even if no normalization is needed", () => {
|
|
22
|
+
expect(normalizeStringToNFD("AlreadyClean")).toBe("alreadyclean");
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("should remove accents from multicharacter words", () => {
|
|
26
|
+
expect(normalizeStringToNFD("José Álvarez")).toBe("jose alvarez");
|
|
27
|
+
expect(normalizeStringToNFD("mañana será otro día")).toBe("manana sera otro dia");
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export const normalizeStringToNFD = (text: string) => {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export const normalizeStringToNFD = (text: string | number | boolean | null | undefined) => {
|
|
2
|
+
if (text == null) return "";
|
|
3
|
+
const str = String(text);
|
|
4
|
+
const normalized = str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
5
|
+
return normalized.toLocaleLowerCase();
|
|
4
6
|
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { propContainsString } from "./prop-contains-string";
|
|
3
|
+
|
|
4
|
+
describe("propContainsString", () => {
|
|
5
|
+
it("should return true if string contains search string (case-insensitive)", () => {
|
|
6
|
+
expect(propContainsString("Leo Messi", "messi")).toBe(true);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it("should return true if string contains search string with accents", () => {
|
|
10
|
+
expect(propContainsString("José Álvarez", "alvarez")).toBe(true);
|
|
11
|
+
expect(propContainsString("mañana", "manana")).toBe(true);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("should return true for numeric values", () => {
|
|
15
|
+
expect(propContainsString(12345, "234")).toBe(true);
|
|
16
|
+
expect(propContainsString(2024, "202")).toBe(true);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("should return false if no match", () => {
|
|
20
|
+
expect(propContainsString("Barcelona", "Madrid")).toBe(false);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("should return true if match is exact", () => {
|
|
24
|
+
expect(propContainsString("Hola", "Hola")).toBe(true);
|
|
25
|
+
expect(propContainsString("hola", "HOLA")).toBe(true);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("should handle boolean props", () => {
|
|
29
|
+
expect(propContainsString(true, "tru")).toBe(true);
|
|
30
|
+
expect(propContainsString(false, "false")).toBe(true);
|
|
31
|
+
expect(propContainsString(true, "nope")).toBe(false);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("should return false if prop is null or undefined", () => {
|
|
35
|
+
expect(propContainsString(null, "a")).toBe(false);
|
|
36
|
+
expect(propContainsString(undefined, "a")).toBe(false);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("should return false if search string is not in prop", () => {
|
|
40
|
+
expect(propContainsString("casa", "zzz")).toBe(false);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("should be accent-insensitive and case-insensitive", () => {
|
|
44
|
+
expect(propContainsString("Éxito", "exito")).toBe(true);
|
|
45
|
+
expect(propContainsString("árbol", "ARBOL")).toBe(true);
|
|
46
|
+
});
|
|
47
|
+
});
|
package/src/locales.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { primariaShellId } from "./constants";
|
|
|
4
4
|
|
|
5
5
|
let shellLocaleManager;
|
|
6
6
|
|
|
7
|
-
export const
|
|
7
|
+
export const useLocalization = async (api: PrimariaApi) => {
|
|
8
8
|
setLanguage("ca");
|
|
9
9
|
const localeManager = await api.createLocaleManager(locales);
|
|
10
10
|
shellLocaleManager = localeManager;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import "./primaria-shell/primaria-shell";
|
|
2
|
-
import "./clinical-monitoring/clinical-monitoring";
|
|
3
|
-
import "../shared-components";
|
|
4
|
-
import "./shell-header/shell-header";
|
|
5
|
-
import "./quick-actions-menu/quick-actions-menu";
|
|
6
|
-
import "../../api/plugin-busy-manager/plugin-busy-list/component";
|
|
7
|
-
import "./pdf-visor/pdf-selector/pdf-selector";
|
/package/dist/primary/shell/src/UI/components/{primaria-error-view → error-view}/component.d.ts
RENAMED
|
File without changes
|
/package/dist/primary/shell/src/UI/components/{primaria-error-view → error-view}/template.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/primary/shell/src/{UI/components → api/pdf-viewer-manager}/pdf-visor/pdf-visor.d.ts
RENAMED
|
File without changes
|
/package/dist/primary/shell/src/{UI/components → api/pdf-viewer-manager}/pdf-visor/utils.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{UI/components/clinical-monitoring → features/clinical-monitoring/component}/styles.css
RENAMED
|
File without changes
|
|
File without changes
|