@minvws/mgo-hcim-ui 0.1.1-1 → 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 +56 -0
- package/README.md +9 -7
- package/dist/common/organization/organization.d.ts.map +1 -1
- package/dist/common/organization/organization.js +2 -1
- package/dist/common/summaryOptions/summaryOptions.d.ts +2 -6
- package/dist/common/summaryOptions/summaryOptions.d.ts.map +1 -1
- package/dist/common/summaryOptions/summaryOptions.js +7 -4
- package/dist/context/baseProps/baseProps.d.ts +7 -0
- package/dist/context/baseProps/baseProps.d.ts.map +1 -0
- package/dist/context/baseProps/baseProps.js +10 -0
- package/dist/context/formatLabel/formatLabel.d.ts +20 -0
- package/dist/context/formatLabel/formatLabel.d.ts.map +1 -0
- package/dist/context/formatLabel/formatLabel.js +69 -0
- package/dist/context/index.d.ts +5 -3
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +3 -1
- package/dist/finalize/finalizeSchema/finalizeSchema.d.ts +7 -0
- package/dist/finalize/finalizeSchema/finalizeSchema.d.ts.map +1 -0
- package/dist/finalize/finalizeSchema/finalizeSchema.js +17 -0
- package/dist/finalize/flattenDeepGroups/flattenDeepGroups.d.ts +7 -0
- package/dist/finalize/flattenDeepGroups/flattenDeepGroups.d.ts.map +1 -0
- package/dist/finalize/flattenDeepGroups/flattenDeepGroups.js +69 -0
- package/dist/finalize/flattenSingleSubGroups/flattenSingleSubGroups.d.ts +7 -0
- package/dist/finalize/flattenSingleSubGroups/flattenSingleSubGroups.d.ts.map +1 -0
- package/dist/finalize/flattenSingleSubGroups/flattenSingleSubGroups.js +29 -0
- package/dist/finalize/hoistRootElements/hoistRootElements.d.ts +8 -0
- package/dist/finalize/hoistRootElements/hoistRootElements.d.ts.map +1 -0
- package/dist/finalize/hoistRootElements/hoistRootElements.js +47 -0
- package/dist/finalize/index.d.ts +7 -0
- package/dist/finalize/index.d.ts.map +1 -0
- package/dist/finalize/index.js +6 -0
- package/dist/finalize/setEmptyEntries/setEmptyEntries.d.ts +4 -0
- package/dist/finalize/setEmptyEntries/setEmptyEntries.d.ts.map +1 -0
- package/dist/finalize/setEmptyEntries/setEmptyEntries.js +27 -0
- package/dist/finalize/translateGroupLabels/translateGroupLabels.d.ts +8 -0
- package/dist/finalize/translateGroupLabels/translateGroupLabels.d.ts.map +1 -0
- package/dist/finalize/translateGroupLabels/translateGroupLabels.js +29 -0
- package/dist/format/cardTitle/cardTitle.d.ts +6 -0
- package/dist/format/cardTitle/cardTitle.d.ts.map +1 -0
- package/dist/format/cardTitle/cardTitle.js +21 -0
- package/dist/format/cardTitle/extractDisplayFromUiElement/extractDisplayFromUiElement.d.ts +3 -0
- package/dist/format/cardTitle/extractDisplayFromUiElement/extractDisplayFromUiElement.d.ts.map +1 -0
- package/dist/format/cardTitle/extractDisplayFromUiElement/extractDisplayFromUiElement.js +17 -0
- package/dist/format/index.d.ts +10 -1
- package/dist/format/index.d.ts.map +1 -1
- package/dist/format/index.js +9 -0
- package/dist/generator/createGeneratorContext/createGeneratorContext.d.ts +5 -2
- package/dist/generator/createGeneratorContext/createGeneratorContext.d.ts.map +1 -1
- package/dist/generator/createGeneratorContext/createGeneratorContext.js +5 -2
- package/dist/generator/createUiElementHelper/createUiElementHelper.d.ts +2 -2
- package/dist/generator/createUiElementHelper/createUiElementHelper.d.ts.map +1 -1
- package/dist/generator/createUiElementHelper/createUiElementHelper.js +11 -43
- package/dist/generator/generateUiSchema/generateUiSchema.d.ts.map +1 -1
- package/dist/generator/generateUiSchema/generateUiSchema.js +5 -14
- package/dist/generator/getProfileKey/getProfileKey.d.ts +1 -1
- package/dist/generator/getProfileKey/getProfileKey.d.ts.map +1 -1
- package/dist/generator/processArray/processArray.d.ts +2 -2
- package/dist/generator/processArray/processArray.d.ts.map +1 -1
- package/dist/generator/processArray/processArray.js +2 -2
- package/dist/generator/processMgoType/processMgoType.d.ts +2 -2
- package/dist/generator/processMgoType/processMgoType.d.ts.map +1 -1
- package/dist/generator/processMgoType/processMgoType.js +3 -2
- package/dist/generator/processObject/processObject.d.ts +2 -2
- package/dist/generator/processObject/processObject.d.ts.map +1 -1
- package/dist/generator/processObject/processObject.js +5 -4
- package/dist/generator/processValue/processValue.d.ts +2 -2
- package/dist/generator/processValue/processValue.d.ts.map +1 -1
- package/dist/generator/processValue/processValue.js +4 -3
- package/dist/helpers/index.d.ts +3 -3
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +3 -3
- package/dist/helpers/isEmptyNode/isEmptyNode.d.ts +5 -0
- package/dist/helpers/isEmptyNode/isEmptyNode.d.ts.map +1 -0
- package/dist/helpers/isEmptyNode/isEmptyNode.js +24 -0
- package/dist/helpers/isGroupNode/isGroupNode.d.ts +6 -0
- package/dist/helpers/isGroupNode/isGroupNode.d.ts.map +1 -0
- package/dist/helpers/isGroupNode/isGroupNode.js +3 -0
- package/dist/helpers/optional/optional.d.ts +17 -0
- package/dist/helpers/optional/optional.d.ts.map +1 -0
- package/dist/helpers/optional/optional.js +21 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/schema.d.ts +2 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +2 -0
- package/dist/special/index.d.ts +3 -4
- package/dist/special/index.d.ts.map +1 -1
- package/dist/special/index.js +0 -2
- package/dist/special/oneOfValueX/oneOfValueX.d.ts +2 -2
- package/dist/special/oneOfValueX/oneOfValueX.d.ts.map +1 -1
- package/dist/special/oneOfValueX/oneOfValueX.js +7 -7
- package/dist/special/valueWithMax/valueWithMax.js +3 -3
- package/dist/special/valueWithUnit/valueWithUnit.js +3 -3
- package/dist/type/annotation/annotation.d.ts +3 -1
- package/dist/type/annotation/annotation.d.ts.map +1 -1
- package/dist/type/annotation/annotation.js +8 -6
- package/dist/type/attachment/attachment.d.ts +4 -0
- package/dist/type/attachment/attachment.d.ts.map +1 -0
- package/dist/type/attachment/attachment.js +31 -0
- package/dist/type/boolean/boolean.js +3 -3
- package/dist/type/code/code.js +8 -8
- package/dist/type/codeableConcept/codeableConcept.d.ts +2 -2
- package/dist/type/codeableConcept/codeableConcept.d.ts.map +1 -1
- package/dist/type/codeableConcept/codeableConcept.js +28 -15
- package/dist/type/coding/coding.d.ts +5 -2
- package/dist/type/coding/coding.d.ts.map +1 -1
- package/dist/type/coding/coding.js +14 -6
- package/dist/type/date/date.d.ts.map +1 -1
- package/dist/type/date/date.js +2 -1
- package/dist/type/dateTime/dateTime.d.ts.map +1 -1
- package/dist/type/dateTime/dateTime.js +5 -6
- package/dist/type/decimal/decimal.js +3 -3
- package/dist/type/duration/duration.d.ts +2 -2
- package/dist/type/duration/duration.d.ts.map +1 -1
- package/dist/type/identifier/identifier.d.ts.map +1 -1
- package/dist/type/identifier/identifier.js +5 -6
- package/dist/type/index.d.ts +12 -11
- package/dist/type/index.d.ts.map +1 -1
- package/dist/type/index.js +4 -1
- package/dist/type/instant/instant.d.ts.map +1 -1
- package/dist/type/instant/instant.js +5 -6
- package/dist/type/integer/integer.js +3 -3
- package/dist/type/integer64/integer64.js +3 -3
- package/dist/type/period/period.d.ts.map +1 -1
- package/dist/type/period/period.js +4 -2
- package/dist/type/positiveInt/positiveInt.js +3 -3
- package/dist/type/quantity/quantity.d.ts +2 -2
- package/dist/type/quantity/quantity.d.ts.map +1 -1
- package/dist/type/quantity/quantity.js +15 -3
- package/dist/type/range/range.d.ts.map +1 -1
- package/dist/type/range/range.js +5 -7
- package/dist/type/ratio/ratio.d.ts.map +1 -1
- package/dist/type/ratio/ratio.js +5 -7
- package/dist/type/reference/reference.d.ts.map +1 -1
- package/dist/type/reference/reference.js +6 -7
- package/dist/type/sampledData/sampledData.d.ts +2 -2
- package/dist/type/sampledData/sampledData.d.ts.map +1 -1
- package/dist/type/sampledData/sampledData.js +2 -0
- package/dist/type/simpleQuantity/simpleQuantity.js +3 -3
- package/dist/type/string/string.d.ts.map +1 -1
- package/dist/type/string/string.js +5 -6
- package/dist/type/time/time.d.ts.map +1 -1
- package/dist/type/time/time.js +5 -6
- package/dist/type/timing/timing.d.ts +2 -2
- package/dist/type/timing/timing.d.ts.map +1 -1
- package/dist/type/timing/timing.js +2 -0
- package/dist/type/unsignedInt/unsignedInt.js +3 -3
- package/dist/typeMaps/complexUiTypeMap.d.ts +8 -0
- package/dist/typeMaps/complexUiTypeMap.d.ts.map +1 -0
- package/dist/typeMaps/complexUiTypeMap.js +6 -0
- package/dist/typeMaps/index.d.ts +4 -0
- package/dist/typeMaps/index.d.ts.map +1 -0
- package/dist/typeMaps/index.js +3 -0
- package/dist/typeMaps/multipleUiTypeMap.d.ts +19 -0
- package/dist/typeMaps/multipleUiTypeMap.d.ts.map +1 -0
- package/dist/typeMaps/multipleUiTypeMap.js +15 -0
- package/dist/typeMaps/singleUiTypeMap.d.ts +32 -0
- package/dist/typeMaps/singleUiTypeMap.d.ts.map +1 -0
- package/dist/typeMaps/singleUiTypeMap.js +28 -0
- package/dist/typeMaps/typeMapTypes.d.ts +12 -0
- package/dist/typeMaps/typeMapTypes.d.ts.map +1 -0
- package/dist/typeMaps/typeMapTypes.js +2 -0
- package/dist/types/context.d.ts +5 -11
- package/dist/types/context.d.ts.map +1 -1
- package/dist/types/draft.d.ts +10 -0
- package/dist/types/draft.d.ts.map +1 -0
- package/dist/types/draft.js +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +3 -1
- package/dist/types/schema.d.ts +39 -18
- package/dist/types/schema.d.ts.map +1 -1
- package/dist/types/schemaFunction.d.ts +5 -0
- package/dist/types/schemaFunction.d.ts.map +1 -0
- package/dist/types/schemaFunction.js +1 -0
- package/dist/ui.d.ts +30 -30
- package/package.json +26 -11
- package/dist/context/formatLabel.d.ts +0 -14
- package/dist/context/formatLabel.d.ts.map +0 -1
- package/dist/context/formatLabel.js +0 -61
- package/dist/generator/getUiElements/getUiElements.d.ts +0 -3
- package/dist/generator/getUiElements/getUiElements.d.ts.map +0 -1
- package/dist/generator/getUiElements/getUiElements.js +0 -4
- package/dist/helpers/dropEmptyEntries/dropEmptyEntries.d.ts +0 -5
- package/dist/helpers/dropEmptyEntries/dropEmptyEntries.d.ts.map +0 -1
- package/dist/helpers/dropEmptyEntries/dropEmptyEntries.js +0 -28
- package/dist/helpers/isEmptyUiEntry/isEmptyUiEntry.d.ts +0 -3
- package/dist/helpers/isEmptyUiEntry/isEmptyUiEntry.d.ts.map +0 -1
- package/dist/helpers/isEmptyUiEntry/isEmptyUiEntry.js +0 -18
- package/dist/helpers/isUiSchemaGroup/isUiSchemaGroup.d.ts +0 -3
- package/dist/helpers/isUiSchemaGroup/isUiSchemaGroup.d.ts.map +0 -1
- package/dist/helpers/isUiSchemaGroup/isUiSchemaGroup.js +0 -3
- package/dist/helpers/setEmptyEntries/setEmptyEntries.d.ts +0 -4
- package/dist/helpers/setEmptyEntries/setEmptyEntries.d.ts.map +0 -1
- package/dist/helpers/setEmptyEntries/setEmptyEntries.js +0 -31
- package/dist/special/attachment/attachment.d.ts +0 -4
- package/dist/special/attachment/attachment.d.ts.map +0 -1
- package/dist/special/attachment/attachment.js +0 -18
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
|
|
11
|
+
## 0.1.2 (2026-10-22)
|
|
12
|
+
|
|
13
|
+
### 🚀 Features
|
|
14
|
+
|
|
15
|
+
- **hcim-ui:** expose public schema types in separate path ([c8cce769](https://github.com/minvws/nl-mgo-app-web-private/commit/c8cce769))
|
|
16
|
+
- **hcim-ui:** remove attachment from special type ([27ad6737](https://github.com/minvws/nl-mgo-app-web-private/commit/27ad6737))
|
|
17
|
+
- **hcim-ui:** remove attachment from special type ([59492b02](https://github.com/minvws/nl-mgo-app-web-private/commit/59492b02))
|
|
18
|
+
- type discriminators update ([d6628926](https://github.com/minvws/nl-mgo-app-web-private/commit/d6628926))
|
|
19
|
+
- oneOfValueX uses type extension for labels ([9bfb288e](https://github.com/minvws/nl-mgo-app-web-private/commit/9bfb288e))
|
|
20
|
+
- **hcim-ui:** update format label order ([17329960](https://github.com/minvws/nl-mgo-app-web-private/commit/17329960))
|
|
21
|
+
- **hcim-ui:** introduce draft schema concept and move dicom_viewer to root ([4652682a](https://github.com/minvws/nl-mgo-app-web-private/commit/4652682a))
|
|
22
|
+
- add card title helper ([d2d10317](https://github.com/minvws/nl-mgo-app-web-private/commit/d2d10317))
|
|
23
|
+
- remove MultipleGroupedValues type from HealthUiSchema ([55ffa396](https://github.com/minvws/nl-mgo-app-web-private/commit/55ffa396))
|
|
24
|
+
- update the display of codeableConcept values ([0cde14d4](https://github.com/minvws/nl-mgo-app-web-private/commit/0cde14d4))
|
|
25
|
+
- add DICOM_VIEWER type ([6cdacdea](https://github.com/minvws/nl-mgo-app-web-private/commit/6cdacdea))
|
|
26
|
+
- add empty_value type ([ea7a60e3](https://github.com/minvws/nl-mgo-app-web-private/commit/ea7a60e3))
|
|
27
|
+
- restore mgo code string enum for typescript ([14c78bcf](https://github.com/minvws/nl-mgo-app-web-private/commit/14c78bcf))
|
|
28
|
+
- removed ${i18n} from summary options ([04e68ba1](https://github.com/minvws/nl-mgo-app-web-private/commit/04e68ba1))
|
|
29
|
+
- widen string enum in code to plain string ([2569b794](https://github.com/minvws/nl-mgo-app-web-private/commit/2569b794))
|
|
30
|
+
- **hcim-ui:** add seeded mock factories ([93ab5d8d](https://github.com/minvws/nl-mgo-app-web-private/commit/93ab5d8d))
|
|
31
|
+
- **hcim-ui:** add excludefrompdf to schema #1193 ([#1193](https://github.com/minvws/nl-mgo-app-web-private/issues/1193))
|
|
32
|
+
- **hcim-ui:** formatdate for card details #1131 ([#1131](https://github.com/minvws/nl-mgo-app-web-private/issues/1131))
|
|
33
|
+
- **hcim-ui:** add intl key to ui schemas #550 ([#550](https://github.com/minvws/nl-mgo-app-web-private/issues/550))
|
|
34
|
+
- **hcim-ui:** add optional helper ([f0675872](https://github.com/minvws/nl-mgo-app-web-private/commit/f0675872))
|
|
35
|
+
- **hcim-ui:** replace display property for SingleValue, MultipleValues, MultipleGroupedValues ([7bce8818](https://github.com/minvws/nl-mgo-app-web-private/commit/7bce8818))
|
|
36
|
+
- add MgoCoding details to ui schema value #841 ([#841](https://github.com/minvws/nl-mgo-app-web-private/issues/841))
|
|
37
|
+
- **mgo-fhir:** migrate to lib base tsconfig and update exported types ([44737842](https://github.com/minvws/nl-mgo-app-web-private/commit/44737842))
|
|
38
|
+
|
|
39
|
+
### 🩹 Fixes
|
|
40
|
+
|
|
41
|
+
- npm audit patches ([0386911d](https://github.com/minvws/nl-mgo-app-web-private/commit/0386911d))
|
|
42
|
+
- remove DOM dependencies ([19cc83ba](https://github.com/minvws/nl-mgo-app-web-private/commit/19cc83ba))
|
|
43
|
+
|
|
44
|
+
### 🧱 Updated Dependencies
|
|
45
|
+
|
|
46
|
+
- Updated @minvws/mgo-utils to 0.1.3
|
|
47
|
+
- Updated @minvws/mgo-fhir to 0.1.2
|
|
48
|
+
- Updated @minvws/mgo-hcim-parse to 0.1.2
|
|
49
|
+
- Updated @minvws/mgo-intl to 0.1.2
|
|
50
|
+
- Updated @minvws/mgo-logging to 0.1.1
|
|
51
|
+
|
|
52
|
+
### ❤️ Thank You
|
|
53
|
+
|
|
54
|
+
- Geert Fokke
|
|
55
|
+
- Otto Boekesteijn
|
|
56
|
+
- Rool Paap @Rool
|
package/README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# @minvws/mgo-hcim-ui
|
|
2
2
|
|
|
3
|
-
This package contains functionality for transforming Mgo resources into Health Ui Schemas. It is
|
|
3
|
+
This package contains functionality for transforming Mgo resources into Health Ui Schemas. It is used by the [HCIM package][packages-hcim] to provide Health UI Schemas for HCIM FHIR data.
|
|
4
4
|
|
|
5
5
|
For more context on why / how this is used please [visit the about documentation][about-hcim-ui].
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
9
|
```shell
|
|
10
|
-
npm i --save @minvws/mgo-ui
|
|
10
|
+
npm i --save @minvws/mgo-hcim-ui
|
|
11
11
|
|
|
12
12
|
# or
|
|
13
13
|
|
|
14
|
-
pnpm add @minvws/mgo-ui
|
|
14
|
+
pnpm add @minvws/mgo-hcim-ui
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Use
|
|
@@ -19,12 +19,11 @@ pnpm add @minvws/mgo-ui
|
|
|
19
19
|
```typescript
|
|
20
20
|
import { type MgoCode } from '@minvws/mgo-hcim-parse';
|
|
21
21
|
import { createUiContext, createUiHelpers } from '@minvws/mgo-hcim-ui';
|
|
22
|
-
import { Locale } from '@minvws/mgo-intl';
|
|
23
22
|
|
|
24
|
-
const context = createUiContext({ locale:
|
|
25
|
-
const ui = createUiHelpers(
|
|
23
|
+
const context = createUiContext({ locale: 'nl-NL' });
|
|
24
|
+
const ui = createUiHelpers(context);
|
|
26
25
|
|
|
27
|
-
const healthUiSchemaElement =
|
|
26
|
+
const healthUiSchemaElement = ui.code('fhir.x.status', {...} /* MgoCode */ );
|
|
28
27
|
```
|
|
29
28
|
|
|
30
29
|
## Health UI Schema
|
|
@@ -38,6 +37,7 @@ Here is an example of a Health UI Schema:
|
|
|
38
37
|
"label": "Quibusdam tempora nobis",
|
|
39
38
|
"children": [
|
|
40
39
|
{
|
|
40
|
+
"id": "maiores",
|
|
41
41
|
"label": "Maiores",
|
|
42
42
|
"children": [
|
|
43
43
|
{ "type": "SINGLE_VALUE", "label": "Magni quasi", "display": "Natus nobis" },
|
|
@@ -50,10 +50,12 @@ Here is an example of a Health UI Schema:
|
|
|
50
50
|
]
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
|
+
"id": "Accusantium",
|
|
53
54
|
"label": "Accusantium",
|
|
54
55
|
"children": [
|
|
55
56
|
{
|
|
56
57
|
"type": "SINGLE_VALUE",
|
|
58
|
+
"id": "consectetur",
|
|
57
59
|
"label": "Consectetur aliquid voluptatibus",
|
|
58
60
|
"display": "Blanditiis"
|
|
59
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organization.d.ts","sourceRoot":"","sources":["../../../src/common/organization/organization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,wBAAgB,YAAY,CACxB,EAAE,aAAa,EAAE,EAAE,SAAS,EAC5B,YAAY,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GAC5C,SAAS,
|
|
1
|
+
{"version":3,"file":"organization.d.ts","sourceRoot":"","sources":["../../../src/common/organization/organization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,wBAAgB,YAAY,CACxB,EAAE,aAAa,EAAE,EAAE,SAAS,EAC5B,YAAY,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GAC5C,SAAS,CAOX"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import { MgoResourceMeta } from '@minvws/mgo-hcim-parse';
|
|
2
|
-
import { type FhirMessagesIds } from '@minvws/mgo-intl';
|
|
3
1
|
import { type UiContext } from '../../context/index.js';
|
|
4
|
-
import { type
|
|
5
|
-
|
|
6
|
-
export declare function summaryOptions({ formatMessage }: UiContext, i18n: ShowDetailsLabel, resource: MgoResourceMeta): HealthUiGroup;
|
|
7
|
-
export {};
|
|
2
|
+
import { type DraftGroup } from '../../types/index.js';
|
|
3
|
+
export declare function summaryOptions({ formatMessage }: UiContext): DraftGroup;
|
|
8
4
|
//# sourceMappingURL=summaryOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summaryOptions.d.ts","sourceRoot":"","sources":["../../../src/common/summaryOptions/summaryOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"summaryOptions.d.ts","sourceRoot":"","sources":["../../../src/common/summaryOptions/summaryOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,wBAAgB,cAAc,CAAC,EAAE,aAAa,EAAE,EAAE,SAAS,GAAG,UAAU,CAcvE"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
export function summaryOptions({ formatMessage }
|
|
1
|
+
export function summaryOptions({ formatMessage }) {
|
|
2
2
|
return {
|
|
3
|
+
type: 'HEALTH_UI_GROUP',
|
|
4
|
+
id: formatMessage(`summary.options`),
|
|
3
5
|
label: formatMessage(`summary.options`),
|
|
6
|
+
excludeFromPrint: true,
|
|
4
7
|
children: [
|
|
5
8
|
{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
id: `summary.show_details`,
|
|
10
|
+
type: 'DETAILS_LINK',
|
|
11
|
+
label: formatMessage(`summary.show_details`),
|
|
9
12
|
},
|
|
10
13
|
],
|
|
11
14
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FhirIntlShape, FhirMessagesIds } from '@minvws/mgo-intl';
|
|
2
|
+
import { UiFunctionOptions } from '../../types/context.js';
|
|
3
|
+
export declare function createBaseProps(intl: FhirIntlShape): (label: FhirMessagesIds | string, value: unknown, options?: UiFunctionOptions) => {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=baseProps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseProps.d.ts","sourceRoot":"","sources":["../../../src/context/baseProps/baseProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,IAI3C,OAAO,eAAe,GAAG,MAAM,EAC/B,OAAO,OAAO,EACd,UAAS,iBAAsB;;;EAOtC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createLabelFormatter } from '../formatLabel/formatLabel.js';
|
|
2
|
+
export function createBaseProps(intl) {
|
|
3
|
+
const formatLabel = createLabelFormatter(intl);
|
|
4
|
+
return function baseProps(label, value, options = {}) {
|
|
5
|
+
return {
|
|
6
|
+
id: label,
|
|
7
|
+
label: formatLabel(label, value, options.defaultLabel),
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type FhirIntlShape, type FhirMessagesIds } from '@minvws/mgo-intl';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves a translation for `label` by trying candidates until one exists in the message catalog.
|
|
4
|
+
*
|
|
5
|
+
* Candidates are tried in this order. The type extension is derived from `value._type`
|
|
6
|
+
* (snake_cased), e.g. `_reference` or `_date_time`. Whether `label` already includes that
|
|
7
|
+
* extension or not, both forms are tried — typed variants are preferred:
|
|
8
|
+
*
|
|
9
|
+
* 1. Resource label + type extension — e.g. `r3.resource.foo.bar_reference`
|
|
10
|
+
* 2. Resource label without type — e.g. `r3.resource.foo.bar`
|
|
11
|
+
* 3. Optional `fallbackLabel` argument
|
|
12
|
+
* 4. Generic `fhir.x` label + type — e.g. `fhir.x.bar_reference`
|
|
13
|
+
* 5. Generic `fhir.x` label without — e.g. `fhir.x.bar`
|
|
14
|
+
*
|
|
15
|
+
* Examples:
|
|
16
|
+
* - `r3.resource.foo.bar_reference` + Reference → bar_reference, bar, fallback, fhir.x…
|
|
17
|
+
* - `r3.resource.foo` + DateTime → foo_date_time, foo, fallback, fhir.x…
|
|
18
|
+
*/
|
|
19
|
+
export declare function createLabelFormatter(intl: FhirIntlShape): (label: FhirMessagesIds | string, value: unknown, fallbackLabel?: FhirMessagesIds) => string;
|
|
20
|
+
//# sourceMappingURL=formatLabel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatLabel.d.ts","sourceRoot":"","sources":["../../../src/context/formatLabel/formatLabel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AA8C5E;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,aAAa,IAIhD,OAAO,eAAe,GAAG,MAAM,EAC/B,OAAO,OAAO,EACd,gBAAgB,eAAe,YAwBtC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { isValueType } from '@minvws/mgo-hcim-parse';
|
|
2
|
+
import { snakeCase } from 'lodash-es';
|
|
3
|
+
const fhirXLabelRegexp = /^r[34]\.[\w.]+\./;
|
|
4
|
+
function getFallbackLabels(label, value) {
|
|
5
|
+
let typeExtension = null;
|
|
6
|
+
if (isValueType(value)) {
|
|
7
|
+
typeExtension = `_${snakeCase(value._type)}`;
|
|
8
|
+
}
|
|
9
|
+
else if (Array.isArray(value) && isValueType(value[0])) {
|
|
10
|
+
typeExtension = `_${snakeCase(value[0]._type)}`;
|
|
11
|
+
}
|
|
12
|
+
const labels = {
|
|
13
|
+
label: null,
|
|
14
|
+
labelWithType: null,
|
|
15
|
+
fhirXLabel: null,
|
|
16
|
+
fhirXLabelWithType: null,
|
|
17
|
+
};
|
|
18
|
+
if (typeExtension) {
|
|
19
|
+
labels.label = label.endsWith(typeExtension)
|
|
20
|
+
? label.substring(0, label.lastIndexOf(typeExtension))
|
|
21
|
+
: label;
|
|
22
|
+
labels.labelWithType = `${labels.label}${typeExtension}`;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
labels.label = label;
|
|
26
|
+
}
|
|
27
|
+
if (fhirXLabelRegexp.test(labels.label)) {
|
|
28
|
+
labels.fhirXLabel = labels.label.replace(fhirXLabelRegexp, 'fhir.x.');
|
|
29
|
+
if (typeExtension) {
|
|
30
|
+
labels.fhirXLabelWithType = `${labels.fhirXLabel}${typeExtension}`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return labels;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Resolves a translation for `label` by trying candidates until one exists in the message catalog.
|
|
37
|
+
*
|
|
38
|
+
* Candidates are tried in this order. The type extension is derived from `value._type`
|
|
39
|
+
* (snake_cased), e.g. `_reference` or `_date_time`. Whether `label` already includes that
|
|
40
|
+
* extension or not, both forms are tried — typed variants are preferred:
|
|
41
|
+
*
|
|
42
|
+
* 1. Resource label + type extension — e.g. `r3.resource.foo.bar_reference`
|
|
43
|
+
* 2. Resource label without type — e.g. `r3.resource.foo.bar`
|
|
44
|
+
* 3. Optional `fallbackLabel` argument
|
|
45
|
+
* 4. Generic `fhir.x` label + type — e.g. `fhir.x.bar_reference`
|
|
46
|
+
* 5. Generic `fhir.x` label without — e.g. `fhir.x.bar`
|
|
47
|
+
*
|
|
48
|
+
* Examples:
|
|
49
|
+
* - `r3.resource.foo.bar_reference` + Reference → bar_reference, bar, fallback, fhir.x…
|
|
50
|
+
* - `r3.resource.foo` + DateTime → foo_date_time, foo, fallback, fhir.x…
|
|
51
|
+
*/
|
|
52
|
+
export function createLabelFormatter(intl) {
|
|
53
|
+
const hasMessage = (id) => Object.hasOwn(intl.messages, id);
|
|
54
|
+
return function formatLabel(label, value, fallbackLabel) {
|
|
55
|
+
const { label: labelWithoutType, labelWithType, fhirXLabel, fhirXLabelWithType, } = getFallbackLabels(label, value);
|
|
56
|
+
const foundLabel = [
|
|
57
|
+
labelWithType,
|
|
58
|
+
labelWithoutType,
|
|
59
|
+
fallbackLabel,
|
|
60
|
+
fhirXLabelWithType,
|
|
61
|
+
fhirXLabel,
|
|
62
|
+
].find((candidate) => candidate && hasMessage(candidate));
|
|
63
|
+
if (foundLabel) {
|
|
64
|
+
return intl.formatMessage({ id: foundLabel });
|
|
65
|
+
}
|
|
66
|
+
// Let intl handle the missing translation error
|
|
67
|
+
return intl.formatMessage({ id: label });
|
|
68
|
+
};
|
|
69
|
+
}
|
package/dist/context/index.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { type FhirIntlOptions, type FhirIntlShape, type FhirMessagesIds, type IntlHelpers } from '@minvws/mgo-intl';
|
|
2
|
+
import { createBaseProps } from './baseProps/baseProps.js';
|
|
3
|
+
import { createLabelFormatter } from './formatLabel/formatLabel.js';
|
|
3
4
|
export type UiContextOptions = {
|
|
4
5
|
isSummary?: boolean;
|
|
5
6
|
ignoreMissingTranslations?: boolean;
|
|
6
|
-
locale:
|
|
7
|
+
locale: FhirIntlOptions['locale'];
|
|
7
8
|
};
|
|
8
9
|
export type UiContext = {
|
|
9
10
|
isSummary: boolean | undefined;
|
|
10
11
|
intl: FhirIntlShape;
|
|
11
12
|
formatLabel: ReturnType<typeof createLabelFormatter>;
|
|
13
|
+
baseProps: ReturnType<typeof createBaseProps>;
|
|
12
14
|
} & IntlHelpers<string, FhirMessagesIds>;
|
|
13
15
|
export declare function createUiContext(options: UiContextOptions): UiContext;
|
|
14
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,WAAW,EACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,MAAM,MAAM,gBAAgB,GAAG;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;CACrC,CAAC;AAIF,MAAM,MAAM,SAAS,GAAG;IACpB,SAAS,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,IAAI,EAAE,aAAa,CAAC;IACpB,WAAW,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;IACrD,SAAS,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;CACjD,GAAG,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAEzC,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAkBpE"}
|
package/dist/context/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createHelpers, createIntl, createIntlCache, getFhirIntlConfig, } from '@minvws/mgo-intl';
|
|
2
|
-
import {
|
|
2
|
+
import { createBaseProps } from './baseProps/baseProps.js';
|
|
3
|
+
import { createLabelFormatter } from './formatLabel/formatLabel.js';
|
|
3
4
|
const intlCache = createIntlCache();
|
|
4
5
|
export function createUiContext(options) {
|
|
5
6
|
const { locale, ignoreMissingTranslations, isSummary } = options;
|
|
@@ -12,5 +13,6 @@ export function createUiContext(options) {
|
|
|
12
13
|
intl,
|
|
13
14
|
...createHelpers(intl),
|
|
14
15
|
formatLabel: createLabelFormatter(intl),
|
|
16
|
+
baseProps: createBaseProps(intl),
|
|
15
17
|
};
|
|
16
18
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type UiContext } from '../../context/index.js';
|
|
2
|
+
import { type DraftSchema, type HealthUiSchema } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Finalizes authored schemas by applying all required post-processing in one place.
|
|
5
|
+
*/
|
|
6
|
+
export declare function finalizeSchema(context: UiContext): (schema: DraftSchema) => HealthUiSchema;
|
|
7
|
+
//# sourceMappingURL=finalizeSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finalizeSchema.d.ts","sourceRoot":"","sources":["../../../src/finalize/finalizeSchema/finalizeSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAO7E;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,SAAS,IACrC,QAAQ,WAAW,KAAG,cAAc,CAO/C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { flattenDeepGroups } from '../flattenDeepGroups/flattenDeepGroups.js';
|
|
2
|
+
import { flattenSingleSubGroups } from '../flattenSingleSubGroups/flattenSingleSubGroups.js';
|
|
3
|
+
import { hoistRootElements } from '../hoistRootElements/hoistRootElements.js';
|
|
4
|
+
import { setEmptyEntries } from '../setEmptyEntries/setEmptyEntries.js';
|
|
5
|
+
import { translateGroupLabels } from '../translateGroupLabels/translateGroupLabels.js';
|
|
6
|
+
/**
|
|
7
|
+
* Finalizes authored schemas by applying all required post-processing in one place.
|
|
8
|
+
*/
|
|
9
|
+
export function finalizeSchema(context) {
|
|
10
|
+
return (schema) => {
|
|
11
|
+
const withRootElements = hoistRootElements(schema);
|
|
12
|
+
const withBoundedGroups = flattenDeepGroups(withRootElements);
|
|
13
|
+
const withoutWrappers = flattenSingleSubGroups(withBoundedGroups);
|
|
14
|
+
const withLabels = translateGroupLabels(context)(withoutWrappers);
|
|
15
|
+
return setEmptyEntries(context)(withLabels);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type DraftSchema, type HealthUiSchema } from '../../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Caps group nesting at two levels: `HEALTH_UI_GROUP` → `HEALTH_UI_SUB_GROUP`.
|
|
4
|
+
* Children nested deeper than the second level are hoisted into that subgroup.
|
|
5
|
+
*/
|
|
6
|
+
export declare function flattenDeepGroups(schema: DraftSchema): HealthUiSchema;
|
|
7
|
+
//# sourceMappingURL=flattenDeepGroups.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flattenDeepGroups.d.ts","sourceRoot":"","sources":["../../../src/finalize/flattenDeepGroups/flattenDeepGroups.ts"],"names":[],"mappings":"AAEA,OAAO,EAGH,KAAK,WAAW,EAEhB,KAAK,cAAc,EAGtB,MAAM,sBAAsB,CAAC;AAE9B;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,cAAc,CAgBrE"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { isNullish } from '@minvws/mgo-utils';
|
|
2
|
+
import { isGroupNode } from '../../helpers/isGroupNode/isGroupNode.js';
|
|
3
|
+
/**
|
|
4
|
+
* Caps group nesting at two levels: `HEALTH_UI_GROUP` → `HEALTH_UI_SUB_GROUP`.
|
|
5
|
+
* Children nested deeper than the second level are hoisted into that subgroup.
|
|
6
|
+
*/
|
|
7
|
+
export function flattenDeepGroups(schema) {
|
|
8
|
+
const children = [];
|
|
9
|
+
for (const child of schema.children) {
|
|
10
|
+
if (!isGroupNode(child)) {
|
|
11
|
+
children.push(child);
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
const group = flattenTopLevelGroup(child);
|
|
15
|
+
if (group) {
|
|
16
|
+
children.push(group);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return { ...schema, children };
|
|
20
|
+
}
|
|
21
|
+
function flattenTopLevelGroup(group) {
|
|
22
|
+
const elements = [];
|
|
23
|
+
for (const node of group.children) {
|
|
24
|
+
if (isGroupNode(node)) {
|
|
25
|
+
const subGroup = flattenToSubGroup(node);
|
|
26
|
+
if (subGroup) {
|
|
27
|
+
elements.push(subGroup);
|
|
28
|
+
}
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
elements.push(asUiElement(node));
|
|
32
|
+
}
|
|
33
|
+
if (elements.length === 0) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
return { ...group, children: elements };
|
|
37
|
+
}
|
|
38
|
+
function flattenToSubGroup(group) {
|
|
39
|
+
const elements = [];
|
|
40
|
+
for (const node of group.children) {
|
|
41
|
+
if (isGroupNode(node)) {
|
|
42
|
+
// Deeper than one nested level: hoist children into this subgroup.
|
|
43
|
+
const nested = flattenToSubGroup(node);
|
|
44
|
+
if (nested) {
|
|
45
|
+
elements.push(...nested.children);
|
|
46
|
+
}
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
elements.push(asUiElement(node));
|
|
50
|
+
}
|
|
51
|
+
if (elements.length === 0) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
if (isNullish(group.id) || isNullish(group.label)) {
|
|
55
|
+
throw new Error(`Nested draft group requires id and label to become a HEALTH_UI_SUB_GROUP. Received id: ${JSON.stringify(group.id)}, label: ${JSON.stringify(group.label)}`);
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
type: 'HEALTH_UI_SUB_GROUP',
|
|
59
|
+
id: group.id,
|
|
60
|
+
label: group.label,
|
|
61
|
+
children: elements,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function asUiElement(node) {
|
|
65
|
+
if (node.type === 'DICOM_VIEWER') {
|
|
66
|
+
throw new Error('Unexpected DICOM_VIEWER in group; run hoistRootElements first');
|
|
67
|
+
}
|
|
68
|
+
return node;
|
|
69
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type HealthUiSchema } from '../../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Promotes lone subgroups: a top-level group that only contains a single
|
|
4
|
+
* `HEALTH_UI_SUB_GROUP` is replaced by that subgroup as a `HEALTH_UI_GROUP`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function flattenSingleSubGroups(schema: HealthUiSchema): HealthUiSchema;
|
|
7
|
+
//# sourceMappingURL=flattenSingleSubGroups.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flattenSingleSubGroups.d.ts","sourceRoot":"","sources":["../../../src/finalize/flattenSingleSubGroups/flattenSingleSubGroups.ts"],"names":[],"mappings":"AACA,OAAO,EAEH,KAAK,cAAc,EAEtB,MAAM,sBAAsB,CAAC;AAE9B;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAO7E"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { isGroupNode } from '../../helpers/isGroupNode/isGroupNode.js';
|
|
2
|
+
/**
|
|
3
|
+
* Promotes lone subgroups: a top-level group that only contains a single
|
|
4
|
+
* `HEALTH_UI_SUB_GROUP` is replaced by that subgroup as a `HEALTH_UI_GROUP`.
|
|
5
|
+
*/
|
|
6
|
+
export function flattenSingleSubGroups(schema) {
|
|
7
|
+
return {
|
|
8
|
+
...schema,
|
|
9
|
+
children: schema.children.map((child) => isGroupNode(child) ? promoteLoneSubGroup(child) : child),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function promoteLoneSubGroup(group) {
|
|
13
|
+
const [onlyChild] = group.children;
|
|
14
|
+
if (group.children.length === 1 &&
|
|
15
|
+
onlyChild &&
|
|
16
|
+
isGroupNode(onlyChild) &&
|
|
17
|
+
onlyChild.type === 'HEALTH_UI_SUB_GROUP') {
|
|
18
|
+
return subGroupToGroup(onlyChild);
|
|
19
|
+
}
|
|
20
|
+
return group;
|
|
21
|
+
}
|
|
22
|
+
function subGroupToGroup(subGroup) {
|
|
23
|
+
return {
|
|
24
|
+
type: 'HEALTH_UI_GROUP',
|
|
25
|
+
id: subGroup.id,
|
|
26
|
+
label: subGroup.label,
|
|
27
|
+
children: subGroup.children,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type DraftSchema } from '../../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Hoists `DICOM_VIEWER` nodes out of groups up to the schema root.
|
|
4
|
+
* A group's viewers are emitted directly after that group. Empty groups
|
|
5
|
+
* (including groups that only contained viewers) are dropped.
|
|
6
|
+
*/
|
|
7
|
+
export declare function hoistRootElements(schema: DraftSchema): DraftSchema;
|
|
8
|
+
//# sourceMappingURL=hoistRootElements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hoistRootElements.d.ts","sourceRoot":"","sources":["../../../src/finalize/hoistRootElements/hoistRootElements.ts"],"names":[],"mappings":"AACA,OAAO,EAGH,KAAK,WAAW,EAEnB,MAAM,sBAAsB,CAAC;AAE9B;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAmBlE"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { isGroupNode } from '../../helpers/isGroupNode/isGroupNode.js';
|
|
2
|
+
/**
|
|
3
|
+
* Hoists `DICOM_VIEWER` nodes out of groups up to the schema root.
|
|
4
|
+
* A group's viewers are emitted directly after that group. Empty groups
|
|
5
|
+
* (including groups that only contained viewers) are dropped.
|
|
6
|
+
*/
|
|
7
|
+
export function hoistRootElements(schema) {
|
|
8
|
+
const children = [];
|
|
9
|
+
for (const child of schema.children) {
|
|
10
|
+
if (!isGroupNode(child)) {
|
|
11
|
+
children.push(child);
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
const { group, rootElements } = hoistFromGroup(child);
|
|
15
|
+
if (group) {
|
|
16
|
+
children.push(group);
|
|
17
|
+
}
|
|
18
|
+
children.push(...rootElements);
|
|
19
|
+
}
|
|
20
|
+
return { ...schema, children };
|
|
21
|
+
}
|
|
22
|
+
function hoistFromGroup(group) {
|
|
23
|
+
const elements = [];
|
|
24
|
+
const rootElements = [];
|
|
25
|
+
for (const node of group.children) {
|
|
26
|
+
if (node.type === 'DICOM_VIEWER') {
|
|
27
|
+
rootElements.push(node);
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if (isGroupNode(node)) {
|
|
31
|
+
const nested = hoistFromGroup(node);
|
|
32
|
+
if (nested.group) {
|
|
33
|
+
elements.push(nested.group);
|
|
34
|
+
}
|
|
35
|
+
rootElements.push(...nested.rootElements);
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
elements.push(node);
|
|
39
|
+
}
|
|
40
|
+
if (elements.length === 0) {
|
|
41
|
+
return { group: undefined, rootElements };
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
group: { ...group, children: elements },
|
|
45
|
+
rootElements,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './finalizeSchema/finalizeSchema.js';
|
|
2
|
+
export * from './flattenDeepGroups/flattenDeepGroups.js';
|
|
3
|
+
export * from './flattenSingleSubGroups/flattenSingleSubGroups.js';
|
|
4
|
+
export * from './hoistRootElements/hoistRootElements.js';
|
|
5
|
+
export * from './setEmptyEntries/setEmptyEntries.js';
|
|
6
|
+
export * from './translateGroupLabels/translateGroupLabels.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/finalize/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,oDAAoD,CAAC;AACnE,cAAc,0CAA0C,CAAC;AACzD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gDAAgD,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './finalizeSchema/finalizeSchema.js';
|
|
2
|
+
export * from './flattenDeepGroups/flattenDeepGroups.js';
|
|
3
|
+
export * from './flattenSingleSubGroups/flattenSingleSubGroups.js';
|
|
4
|
+
export * from './hoistRootElements/hoistRootElements.js';
|
|
5
|
+
export * from './setEmptyEntries/setEmptyEntries.js';
|
|
6
|
+
export * from './translateGroupLabels/translateGroupLabels.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setEmptyEntries.d.ts","sourceRoot":"","sources":["../../../src/finalize/setEmptyEntries/setEmptyEntries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,EAEH,KAAK,cAAc,EAEtB,MAAM,sBAAsB,CAAC;AAyB9B,wBAAgB,eAAe,CAAC,OAAO,EAAE,SAAS,IACtC,QAAQ,cAAc,KAAG,cAAc,CAMlD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { isEmptyNode } from '../../helpers/isEmptyNode/isEmptyNode.js';
|
|
2
|
+
import { isGroupNode } from '../../helpers/isGroupNode/isGroupNode.js';
|
|
3
|
+
function processGroup(group, context) {
|
|
4
|
+
return {
|
|
5
|
+
...group,
|
|
6
|
+
children: group.children.map((entry) => {
|
|
7
|
+
if (isGroupNode(entry)) {
|
|
8
|
+
return processGroup(entry, context);
|
|
9
|
+
}
|
|
10
|
+
return isEmptyNode(entry) &&
|
|
11
|
+
!['DOWNLOAD_LINK', 'DOWNLOAD_BINARY', 'DICOM_VIEWER'].includes(entry.type)
|
|
12
|
+
? {
|
|
13
|
+
id: entry.id,
|
|
14
|
+
label: entry.label,
|
|
15
|
+
type: 'EMPTY_VALUE',
|
|
16
|
+
display: context.formatMessage('fhir.empty_value'),
|
|
17
|
+
}
|
|
18
|
+
: entry;
|
|
19
|
+
}),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export function setEmptyEntries(context) {
|
|
23
|
+
return (schema) => ({
|
|
24
|
+
...schema,
|
|
25
|
+
children: schema.children.map((child) => isGroupNode(child) ? processGroup(child, context) : child),
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type UiContext } from '../../context/index.js';
|
|
2
|
+
import { type HealthUiSchema } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Translates group and subgroup labels after the schema structure is finalized.
|
|
5
|
+
* Only labels that look like message keys (`r3.*`, `r4.*`, `fhir.*`) are translated.
|
|
6
|
+
*/
|
|
7
|
+
export declare function translateGroupLabels(context: UiContext): (schema: HealthUiSchema) => HealthUiSchema;
|
|
8
|
+
//# sourceMappingURL=translateGroupLabels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translateGroupLabels.d.ts","sourceRoot":"","sources":["../../../src/finalize/translateGroupLabels/translateGroupLabels.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAEH,KAAK,cAAc,EAEtB,MAAM,sBAAsB,CAAC;AAI9B;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,SAAS,IAC3C,QAAQ,cAAc,KAAG,cAAc,CAMlD"}
|