@minvws/mgo-hcim-ui 0.1.2 → 0.1.3

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/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 0.1.3 (2026-11-03)
2
+
3
+ ### 🧱 Updated Dependencies
4
+
5
+ - Updated @minvws/mgo-utils to 0.1.4
6
+ - Updated @minvws/mgo-fhir to 0.1.3
7
+ - Updated @minvws/mgo-hcim-parse to 0.1.3
8
+ - Updated @minvws/mgo-intl to 0.1.3
9
+ - Updated @minvws/mgo-logging to 0.1.2
10
+
1
11
  ## 0.1.2 (2026-10-22)
2
12
 
3
13
  ### 🚀 Features
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@minvws/mgo-hcim-ui",
3
3
  "license": "EUPL-1.2",
4
4
  "type": "module",
5
- "version": "0.1.2",
5
+ "version": "0.1.3",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
@@ -36,11 +36,11 @@
36
36
  "dependencies": {
37
37
  "lodash-es": "^4.18.1",
38
38
  "type-fest": "^5.10.0",
39
- "@minvws/mgo-hcim-parse": "^0.1.2",
40
- "@minvws/mgo-fhir": "^0.1.2",
41
- "@minvws/mgo-utils": "^0.1.3",
42
- "@minvws/mgo-logging": "^0.1.1",
43
- "@minvws/mgo-intl": "^0.1.2"
39
+ "@minvws/mgo-fhir": "^0.1.3",
40
+ "@minvws/mgo-hcim-parse": "^0.1.3",
41
+ "@minvws/mgo-intl": "^0.1.3",
42
+ "@minvws/mgo-logging": "^0.1.2",
43
+ "@minvws/mgo-utils": "^0.1.4"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@faker-js/faker": "^10.6.0",
@@ -1,12 +0,0 @@
1
- import { type DraftSchema, type HealthUiSchema } from '../../types/index.js';
2
- /**
3
- * Hoists root-level nodes (e.g. a DICOM_VIEWER) out of groups up to the schema
4
- * root, turning a loosely drafted `DraftSchema` into a strict `HealthUiSchema`.
5
- *
6
- * A group's root elements are emitted directly after that group, preserving the
7
- * drafted order. Empty groups (including groups that only contained root
8
- * elements) are dropped. Nested draft groups become `HealthUiSubGroup` (one
9
- * level); deeper nesting is flattened into that subgroup's children.
10
- */
11
- export declare function normalizeSchema(schema: DraftSchema): HealthUiSchema;
12
- //# sourceMappingURL=normalizeSchema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalizeSchema.d.ts","sourceRoot":"","sources":["../../../src/finalize/normalizeSchema/normalizeSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,KAAK,WAAW,EAEhB,KAAK,cAAc,EAGtB,MAAM,sBAAsB,CAAC;AAG9B;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,cAAc,CAmBnE"}
@@ -1,81 +0,0 @@
1
- import { isGroupNode } from '../../helpers/isGroupNode/isGroupNode.js';
2
- /**
3
- * Hoists root-level nodes (e.g. a DICOM_VIEWER) out of groups up to the schema
4
- * root, turning a loosely drafted `DraftSchema` into a strict `HealthUiSchema`.
5
- *
6
- * A group's root elements are emitted directly after that group, preserving the
7
- * drafted order. Empty groups (including groups that only contained root
8
- * elements) are dropped. Nested draft groups become `HealthUiSubGroup` (one
9
- * level); deeper nesting is flattened into that subgroup's children.
10
- */
11
- export function normalizeSchema(schema) {
12
- const children = [];
13
- for (const child of schema.children) {
14
- if (!isGroupNode(child)) {
15
- children.push(child);
16
- continue;
17
- }
18
- const { group, rootElements } = normalizeTopLevelGroup(child);
19
- if (group) {
20
- children.push(group);
21
- }
22
- children.push(...rootElements);
23
- }
24
- return { ...schema, children };
25
- }
26
- function normalizeTopLevelGroup(group) {
27
- const elements = [];
28
- const rootElements = [];
29
- for (const node of group.children) {
30
- if (node.type === 'DICOM_VIEWER') {
31
- rootElements.push(node);
32
- continue;
33
- }
34
- if (isGroupNode(node)) {
35
- const nested = normalizeNestedGroup(node);
36
- if (nested.subGroup) {
37
- elements.push(nested.subGroup);
38
- }
39
- rootElements.push(...nested.rootElements);
40
- continue;
41
- }
42
- elements.push(node);
43
- }
44
- if (elements.length === 0) {
45
- return { group: undefined, rootElements };
46
- }
47
- return {
48
- group: { ...group, children: elements },
49
- rootElements,
50
- };
51
- }
52
- function normalizeNestedGroup(group) {
53
- const elements = [];
54
- const rootElements = [];
55
- for (const node of group.children) {
56
- if (node.type === 'DICOM_VIEWER') {
57
- rootElements.push(node);
58
- continue;
59
- }
60
- if (isGroupNode(node)) {
61
- // Deeper than one nested level: flatten into this subgroup.
62
- const nested = normalizeNestedGroup(node);
63
- elements.push(...(nested.subGroup?.children ?? []));
64
- rootElements.push(...nested.rootElements);
65
- continue;
66
- }
67
- elements.push(node);
68
- }
69
- if (elements.length === 0) {
70
- return { subGroup: undefined, rootElements };
71
- }
72
- return {
73
- subGroup: {
74
- type: 'HEALTH_UI_SUB_GROUP',
75
- id: group.id,
76
- label: group.label,
77
- children: elements,
78
- },
79
- rootElements,
80
- };
81
- }
@@ -1,3 +0,0 @@
1
- import { DraftGroup, DraftNode } from '../../types/index.js';
2
- export declare function getUiElements(elements: DraftNode[]): DraftGroup['children'];
3
- //# sourceMappingURL=getUiElements.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getUiElements.d.ts","sourceRoot":"","sources":["../../../src/generator/getUiElements/getUiElements.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAE7D,wBAAgB,aAAa,CAAC,QAAQ,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,CAE3E"}
@@ -1,4 +0,0 @@
1
- import { isGroupNode } from '../../helpers/isGroupNode/isGroupNode.js';
2
- export function getUiElements(elements) {
3
- return elements.map((x) => (isGroupNode(x) ? x.children : x)).flat();
4
- }
@@ -1,5 +0,0 @@
1
- import { type DicomViewer, type DraftGroup, type HealthUiGroup, type HealthUiSubGroup, type UiElement } from '../../types/index.js';
2
- type UiEntry = UiElement | DicomViewer | DraftGroup | HealthUiGroup | HealthUiSubGroup;
3
- export declare function isEmptyUiEntry(uiField: UiEntry): boolean;
4
- export {};
5
- //# sourceMappingURL=isEmptyUiEntry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isEmptyUiEntry.d.ts","sourceRoot":"","sources":["../../../src/helpers/isEmptyUiEntry/isEmptyUiEntry.ts"],"names":[],"mappings":"AACA,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACjB,MAAM,sBAAsB,CAAC;AAG9B,KAAK,OAAO,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,aAAa,GAAG,gBAAgB,CAAC;AAEvF,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAqBxD"}
@@ -1,23 +0,0 @@
1
- import { isNullish } from '@minvws/mgo-utils';
2
- import { isGroupNode } from '../isGroupNode/isGroupNode.js';
3
- export function isEmptyUiEntry(uiField) {
4
- if (isGroupNode(uiField)) {
5
- return uiField.children.every(isEmptyUiEntry);
6
- }
7
- switch (uiField.type) {
8
- case 'REFERENCE_VALUE':
9
- return isNullish(uiField.reference) && isNullish(uiField.display);
10
- case 'REFERENCE_LINK':
11
- case 'DOWNLOAD_BINARY':
12
- return isNullish(uiField.reference);
13
- case 'SINGLE_VALUE':
14
- return isNullish(uiField.value?.display);
15
- case 'MULTIPLE_VALUES':
16
- return isNullish(uiField.value) || !uiField.value.flat().length;
17
- case 'DOWNLOAD_LINK':
18
- case 'DICOM_VIEWER':
19
- return isNullish(uiField.url);
20
- default:
21
- throw new Error(`Unknown UI entry type: ${JSON.stringify(uiField)}`);
22
- }
23
- }
@@ -1,6 +0,0 @@
1
- type UiGroupType = 'HEALTH_UI_GROUP' | 'HEALTH_UI_SUB_GROUP';
2
- export declare function isUiGroupNode<T extends object>(node: T): node is Extract<T, {
3
- type: UiGroupType;
4
- }>;
5
- export {};
6
- //# sourceMappingURL=isUiGroupNode.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isUiGroupNode.d.ts","sourceRoot":"","sources":["../../../src/helpers/isUiGroupNode/isUiGroupNode.ts"],"names":[],"mappings":"AAAA,KAAK,WAAW,GAAG,iBAAiB,GAAG,qBAAqB,CAAC;AAE7D,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAC1C,IAAI,EAAE,CAAC,GACR,IAAI,IAAI,OAAO,CAAC,CAAC,EAAE;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC,CAI3C"}
@@ -1,3 +0,0 @@
1
- export function isUiGroupNode(node) {
2
- return ('type' in node && (node.type === 'HEALTH_UI_GROUP' || node.type === 'HEALTH_UI_SUB_GROUP'));
3
- }
@@ -1,3 +0,0 @@
1
- import { DraftGroup, DraftSchema, type DicomViewer, type HealthUiGroup, type HealthUiSchema, type UiElement } from '../../types/index.js';
2
- export declare function isUiSchemaGroup(schema: UiElement | DicomViewer | HealthUiSchema | HealthUiGroup | DraftSchema | DraftGroup): schema is HealthUiGroup | DraftGroup;
3
- //# sourceMappingURL=isUiSchemaGroup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isUiSchemaGroup.d.ts","sourceRoot":"","sources":["../../../src/helpers/isUiSchemaGroup/isUiSchemaGroup.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,UAAU,EACV,WAAW,EACX,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,SAAS,EACjB,MAAM,sBAAsB,CAAC;AAE9B,wBAAgB,eAAe,CAC3B,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,cAAc,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,GAC5F,MAAM,IAAI,aAAa,GAAG,UAAU,CAEtC"}
@@ -1,3 +0,0 @@
1
- export function isUiSchemaGroup(schema) {
2
- return schema.type === 'HEALTH_UI_GROUP';
3
- }
@@ -1,4 +0,0 @@
1
- import { type MgoAttachment } from '@minvws/mgo-hcim-parse';
2
- import { type DicomViewer, type DownloadBinary, type DownloadLink, type UiFunctionWithoutLabel, type WithUiContext } from '../../types/index.js';
3
- export declare const attachment: WithUiContext<UiFunctionWithoutLabel<MgoAttachment, (DownloadLink | DownloadBinary | DicomViewer)[]>>;
4
- //# sourceMappingURL=attachment.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../../../src/special/attachment/attachment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EACrB,MAAM,sBAAsB,CAAC;AAU9B,eAAO,MAAM,UAAU,EAAE,aAAa,CAClC,sBAAsB,CAAC,aAAa,EAAE,CAAC,YAAY,GAAG,cAAc,GAAG,WAAW,CAAC,EAAE,CAAC,CA8BrF,CAAC"}
@@ -1,31 +0,0 @@
1
- function isDicomAttachment(value) {
2
- return value?.contentType === 'application/dicom+json';
3
- }
4
- function isBinaryReference(value) {
5
- return value?.url?.startsWith('Binary/');
6
- }
7
- export const attachment = ({ formatMessage, isSummary }) => (value) => {
8
- const label = value?.title ?? formatMessage('fhir.unknown');
9
- if (isDicomAttachment(value)) {
10
- // Currently, dicom attachments are only supported on summary pages.
11
- return isSummary ? [{ id: label, type: 'DICOM_VIEWER', label, url: value?.url }] : [];
12
- }
13
- if (isBinaryReference(value)) {
14
- return [
15
- {
16
- id: label,
17
- type: 'DOWNLOAD_BINARY',
18
- label,
19
- reference: value?.url,
20
- },
21
- ];
22
- }
23
- return [
24
- {
25
- id: label,
26
- type: 'DOWNLOAD_LINK',
27
- label,
28
- url: value?.url,
29
- },
30
- ];
31
- };