@minvws/mgo-hcim-ui 0.1.1-1 → 0.1.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.
- package/CHANGELOG.md +46 -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/normalizeSchema/normalizeSchema.d.ts +12 -0
- package/dist/finalize/normalizeSchema/normalizeSchema.d.ts.map +1 -0
- package/dist/finalize/normalizeSchema/normalizeSchema.js +81 -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/getUiElements/getUiElements.d.ts +2 -2
- package/dist/generator/getUiElements/getUiElements.d.ts.map +1 -1
- package/dist/generator/getUiElements/getUiElements.js +2 -2
- 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/isEmptyUiEntry/isEmptyUiEntry.d.ts +4 -2
- package/dist/helpers/isEmptyUiEntry/isEmptyUiEntry.d.ts.map +1 -1
- package/dist/helpers/isEmptyUiEntry/isEmptyUiEntry.js +8 -3
- 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/isUiGroupNode/isUiGroupNode.d.ts +6 -0
- package/dist/helpers/isUiGroupNode/isUiGroupNode.d.ts.map +1 -0
- package/dist/helpers/isUiGroupNode/isUiGroupNode.js +3 -0
- package/dist/helpers/isUiSchemaGroup/isUiSchemaGroup.d.ts +2 -2
- package/dist/helpers/isUiSchemaGroup/isUiSchemaGroup.d.ts.map +1 -1
- package/dist/helpers/isUiSchemaGroup/isUiSchemaGroup.js +1 -1
- 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/attachment/attachment.d.ts +2 -2
- package/dist/special/attachment/attachment.d.ts.map +1 -1
- package/dist/special/attachment/attachment.js +28 -15
- 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/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/setEmptyEntries/setEmptyEntries.d.ts +0 -4
- package/dist/helpers/setEmptyEntries/setEmptyEntries.d.ts.map +0 -1
- package/dist/helpers/setEmptyEntries/setEmptyEntries.js +0 -31
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { isMgoElement, isValueType } from '@minvws/mgo-hcim-parse';
|
|
2
2
|
import { isNullish } from '@minvws/mgo-utils';
|
|
3
3
|
import { getProfileKey } from '../getProfileKey/getProfileKey.js';
|
|
4
|
-
import { getUiElements } from '../getUiElements/getUiElements.js';
|
|
5
4
|
import { processArray } from '../processArray/processArray.js';
|
|
6
5
|
import { processMgoType } from '../processMgoType/processMgoType.js';
|
|
7
6
|
import { processObject } from '../processObject/processObject.js';
|
|
@@ -11,6 +10,8 @@ export function processValue(context, path, value) {
|
|
|
11
10
|
if (isMgoElement(value)) {
|
|
12
11
|
path = getProfileKey(context.fhirVersion, value._profile);
|
|
13
12
|
group = {
|
|
13
|
+
type: 'HEALTH_UI_GROUP',
|
|
14
|
+
id: path,
|
|
14
15
|
label: getProfileKey(context.fhirVersion, value._profile),
|
|
15
16
|
children: [],
|
|
16
17
|
};
|
|
@@ -28,10 +29,10 @@ export function processValue(context, path, value) {
|
|
|
28
29
|
elements = processObject(context, path, value);
|
|
29
30
|
}
|
|
30
31
|
else {
|
|
31
|
-
|
|
32
|
+
context.log.error(`Failed to process path: ${path} with value:`, value);
|
|
32
33
|
}
|
|
33
34
|
if (group) {
|
|
34
|
-
group.children =
|
|
35
|
+
group.children = elements;
|
|
35
36
|
return [group];
|
|
36
37
|
}
|
|
37
38
|
return elements;
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from './dropEmptyEntries/dropEmptyEntries.js';
|
|
2
1
|
export * from './getChildren/getChildren.js';
|
|
3
|
-
export * from './
|
|
2
|
+
export * from './isEmptyNode/isEmptyNode.js';
|
|
4
3
|
export * from './isUiEntry/isUiEntry.js';
|
|
4
|
+
export * from './isGroupNode/isGroupNode.js';
|
|
5
5
|
export * from './numberToString/numberToString.js';
|
|
6
|
-
export * from './
|
|
6
|
+
export * from './optional/optional.js';
|
|
7
7
|
export * from './toString/toString.js';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC"}
|
package/dist/helpers/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './dropEmptyEntries/dropEmptyEntries.js';
|
|
2
1
|
export * from './getChildren/getChildren.js';
|
|
3
|
-
export * from './
|
|
2
|
+
export * from './isEmptyNode/isEmptyNode.js';
|
|
4
3
|
export * from './isUiEntry/isUiEntry.js';
|
|
4
|
+
export * from './isGroupNode/isGroupNode.js';
|
|
5
5
|
export * from './numberToString/numberToString.js';
|
|
6
|
-
export * from './
|
|
6
|
+
export * from './optional/optional.js';
|
|
7
7
|
export * from './toString/toString.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type DicomViewer, type DraftGroup, type HealthUiGroup, type HealthUiSubGroup, type UiElement } from '../../types/index.js';
|
|
2
|
+
type SchemaNode = UiElement | DicomViewer | DraftGroup | HealthUiGroup | HealthUiSubGroup;
|
|
3
|
+
export declare function isEmptyNode(node: SchemaNode): boolean;
|
|
4
|
+
export {};
|
|
5
|
+
//# sourceMappingURL=isEmptyNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isEmptyNode.d.ts","sourceRoot":"","sources":["../../../src/helpers/isEmptyNode/isEmptyNode.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,UAAU,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,aAAa,GAAG,gBAAgB,CAAC;AAE1F,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAsBrD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { isNullish } from '@minvws/mgo-utils';
|
|
2
|
+
import { isGroupNode } from '../isGroupNode/isGroupNode.js';
|
|
3
|
+
export function isEmptyNode(node) {
|
|
4
|
+
if (isGroupNode(node)) {
|
|
5
|
+
return node.children.every(isEmptyNode);
|
|
6
|
+
}
|
|
7
|
+
switch (node.type) {
|
|
8
|
+
case 'REFERENCE_VALUE':
|
|
9
|
+
return isNullish(node.reference) && isNullish(node.display);
|
|
10
|
+
case 'DETAILS_LINK':
|
|
11
|
+
return false;
|
|
12
|
+
case 'DOWNLOAD_BINARY':
|
|
13
|
+
return isNullish(node.reference);
|
|
14
|
+
case 'SINGLE_VALUE':
|
|
15
|
+
return isNullish(node.value?.display);
|
|
16
|
+
case 'MULTIPLE_VALUES':
|
|
17
|
+
return isNullish(node.value) || !node.value.flat().length;
|
|
18
|
+
case 'DOWNLOAD_LINK':
|
|
19
|
+
case 'DICOM_VIEWER':
|
|
20
|
+
return isNullish(node.url);
|
|
21
|
+
default:
|
|
22
|
+
throw new Error(`Unknown UI entry type: ${JSON.stringify(node)}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import { type UiElement } from '../../types/index.js';
|
|
2
|
-
|
|
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 {};
|
|
3
5
|
//# sourceMappingURL=isEmptyUiEntry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isEmptyUiEntry.d.ts","sourceRoot":"","sources":["../../../src/helpers/isEmptyUiEntry/isEmptyUiEntry.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
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,16 +1,21 @@
|
|
|
1
1
|
import { isNullish } from '@minvws/mgo-utils';
|
|
2
|
+
import { isGroupNode } from '../isGroupNode/isGroupNode.js';
|
|
2
3
|
export function isEmptyUiEntry(uiField) {
|
|
4
|
+
if (isGroupNode(uiField)) {
|
|
5
|
+
return uiField.children.every(isEmptyUiEntry);
|
|
6
|
+
}
|
|
3
7
|
switch (uiField.type) {
|
|
4
8
|
case 'REFERENCE_VALUE':
|
|
9
|
+
return isNullish(uiField.reference) && isNullish(uiField.display);
|
|
5
10
|
case 'REFERENCE_LINK':
|
|
6
11
|
case 'DOWNLOAD_BINARY':
|
|
7
12
|
return isNullish(uiField.reference);
|
|
8
13
|
case 'SINGLE_VALUE':
|
|
9
|
-
return isNullish(uiField.display);
|
|
14
|
+
return isNullish(uiField.value?.display);
|
|
10
15
|
case 'MULTIPLE_VALUES':
|
|
11
|
-
|
|
12
|
-
return isNullish(uiField.display) || !uiField.display.flat().length;
|
|
16
|
+
return isNullish(uiField.value) || !uiField.value.flat().length;
|
|
13
17
|
case 'DOWNLOAD_LINK':
|
|
18
|
+
case 'DICOM_VIEWER':
|
|
14
19
|
return isNullish(uiField.url);
|
|
15
20
|
default:
|
|
16
21
|
throw new Error(`Unknown UI entry type: ${JSON.stringify(uiField)}`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isGroupNode.d.ts","sourceRoot":"","sources":["../../../src/helpers/isGroupNode/isGroupNode.ts"],"names":[],"mappings":"AAAA,KAAK,aAAa,GAAG,iBAAiB,GAAG,qBAAqB,CAAC;AAE/D,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EACxC,IAAI,EAAE,CAAC,GACR,IAAI,IAAI,OAAO,CAAC,CAAC,EAAE;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC,CAI7C"}
|
|
@@ -0,0 +1 @@
|
|
|
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 +1,3 @@
|
|
|
1
|
-
import { type HealthUiGroup, type HealthUiSchema, type UiElement } from '../../types/index.js';
|
|
2
|
-
export declare function isUiSchemaGroup(schema: UiElement | HealthUiSchema | HealthUiGroup): schema is HealthUiGroup;
|
|
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
3
|
//# sourceMappingURL=isUiSchemaGroup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isUiSchemaGroup.d.ts","sourceRoot":"","sources":["../../../src/helpers/isUiSchemaGroup/isUiSchemaGroup.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type DicomViewer, type DraftGroup, type HealthUiGroup, type HealthUiSubGroup, type UiElement } from '../../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* A helper function to filter out empty elements in a health ui schema.
|
|
4
|
+
* It works for single elements, groups, and arrays of either.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // example usage in a ui schema group
|
|
9
|
+
* children: [
|
|
10
|
+
* ...optional(ui.codeableConcept('r3.foo.code', resource.code)),
|
|
11
|
+
* ...optional(ui.period('r3.foo.period', resource.period)),
|
|
12
|
+
* ...optional(ui.timing('r3.foo.timing', resource.timing)),
|
|
13
|
+
* ]
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function optional<T extends UiElement | DicomViewer | DraftGroup | HealthUiGroup | HealthUiSubGroup>(elements: T | T[]): T[];
|
|
17
|
+
//# sourceMappingURL=optional.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optional.d.ts","sourceRoot":"","sources":["../../../src/helpers/optional/optional.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACjB,MAAM,sBAAsB,CAAC;AAG9B;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CACpB,CAAC,SAAS,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,aAAa,GAAG,gBAAgB,EACnF,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,CAMxB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isEmptyNode } from '../isEmptyNode/isEmptyNode.js';
|
|
2
|
+
/**
|
|
3
|
+
* A helper function to filter out empty elements in a health ui schema.
|
|
4
|
+
* It works for single elements, groups, and arrays of either.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // example usage in a ui schema group
|
|
9
|
+
* children: [
|
|
10
|
+
* ...optional(ui.codeableConcept('r3.foo.code', resource.code)),
|
|
11
|
+
* ...optional(ui.period('r3.foo.period', resource.period)),
|
|
12
|
+
* ...optional(ui.timing('r3.foo.timing', resource.timing)),
|
|
13
|
+
* ]
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export function optional(elements) {
|
|
17
|
+
if (Array.isArray(elements)) {
|
|
18
|
+
return elements.filter((x) => !isEmptyNode(x));
|
|
19
|
+
}
|
|
20
|
+
return isEmptyNode(elements) ? [] : [elements];
|
|
21
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
export { dropEmptyEntries } from './helpers/index.js';
|
|
2
|
-
export * from './types/index.js';
|
|
3
1
|
export { common } from './common/index.js';
|
|
4
2
|
export { createUiContext, type UiContext, type UiContextOptions } from './context/index.js';
|
|
3
|
+
export { finalizeSchema, setEmptyEntries } from './finalize/index.js';
|
|
4
|
+
export { createCardTitleFormatter, createFormatHelpers, type FormatHelpers, } from './format/index.js';
|
|
5
5
|
export { generateUiSchema } from './generator/index.js';
|
|
6
6
|
export * from './helpers/index.js';
|
|
7
7
|
export { createUiHelpers, type UiHelpers } from './ui.js';
|
|
8
|
-
export
|
|
8
|
+
export type * from './types/draft.js';
|
|
9
|
+
export type * from './types/schema.js';
|
|
10
|
+
export type * from './types/schemaFunction.js';
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,KAAK,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EACH,wBAAwB,EACxB,mBAAmB,EACnB,KAAK,aAAa,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAE1D,mBAAmB,kBAAkB,CAAC;AACtC,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,2BAA2B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export { dropEmptyEntries } from './helpers/index.js';
|
|
2
|
-
export * from './types/index.js';
|
|
3
1
|
export { common } from './common/index.js';
|
|
4
2
|
export { createUiContext } from './context/index.js';
|
|
3
|
+
export { finalizeSchema, setEmptyEntries } from './finalize/index.js';
|
|
4
|
+
export { createCardTitleFormatter, createFormatHelpers, } from './format/index.js';
|
|
5
5
|
export { generateUiSchema } from './generator/index.js';
|
|
6
6
|
export * from './helpers/index.js';
|
|
7
7
|
export { createUiHelpers } from './ui.js';
|
|
8
|
-
export { systemCode } from './format/systemCode/systemCode.js';
|
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAEA,mBAAmB,mBAAmB,CAAC"}
|
package/dist/schema.js
ADDED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type MgoAttachment } from '@minvws/mgo-hcim-parse';
|
|
2
|
-
import { type DownloadBinary, type DownloadLink, type UiFunctionWithoutLabel, type WithUiContext } from '../../types/index.js';
|
|
3
|
-
export declare const attachment: WithUiContext<UiFunctionWithoutLabel<MgoAttachment, DownloadLink | DownloadBinary>>;
|
|
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
4
|
//# sourceMappingURL=attachment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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,18 +1,31 @@
|
|
|
1
|
-
|
|
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) => {
|
|
2
8
|
const label = value?.title ?? formatMessage('fhir.unknown');
|
|
3
|
-
if (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
label,
|
|
7
|
-
reference: value?.url,
|
|
8
|
-
};
|
|
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 }] : [];
|
|
9
12
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
+
];
|
|
15
31
|
};
|
|
16
|
-
function isBinaryReference(value) {
|
|
17
|
-
return value?.startsWith('Binary/');
|
|
18
|
-
}
|
package/dist/special/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { type UiContext } from '../context/index.js';
|
|
2
2
|
export declare function getSpecial(context: UiContext): {
|
|
3
|
-
valueWithMax: import("../
|
|
4
|
-
valueWithUnit: import("../
|
|
5
|
-
oneOfValueX: <T extends object>(label: import("@minvws/mgo-intl").FhirMessagesIds, value: import("@minvws/mgo-utils").Nullable<T>, prefix?: string) => import("../index.js").UiElement[];
|
|
6
|
-
attachment: import("../index.js").UiFunctionWithoutLabel<import("@minvws/mgo-hcim-parse").MgoAttachment, import("../index.js").DownloadLink | import("../index.js").DownloadBinary>;
|
|
3
|
+
valueWithMax: import("../types/context.js").CombinedUiFunction<number, number, import("../index.js").SingleValue>;
|
|
4
|
+
valueWithUnit: import("../types/context.js").CombinedUiFunction<number | import("@minvws/mgo-hcim-parse").PrimitiveValueType<string, number>, string | import("@minvws/mgo-hcim-parse").PrimitiveValueType<string, string>, import("../index.js").SingleValue>;
|
|
5
|
+
oneOfValueX: <T extends object>(label: import("@minvws/mgo-intl").FhirMessagesIds, value: import("@minvws/mgo-utils").Nullable<T>, prefix?: string) => (import("../index.js").UiElement | import("../index.js").DicomViewer | import("../index.js").DraftGroup)[];
|
|
7
6
|
};
|
|
8
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/special/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/special/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKrD,wBAAgB,UAAU,CAAC,OAAO,EAAE,SAAS;;;;EAM5C"}
|
package/dist/special/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { attachment } from './attachment/attachment.js';
|
|
2
1
|
import { oneOfValueX } from './oneOfValueX/oneOfValueX.js';
|
|
3
2
|
import { valueWithMax } from './valueWithMax/valueWithMax.js';
|
|
4
3
|
import { valueWithUnit } from './valueWithUnit/valueWithUnit.js';
|
|
@@ -7,6 +6,5 @@ export function getSpecial(context) {
|
|
|
7
6
|
valueWithMax: valueWithMax(context),
|
|
8
7
|
valueWithUnit: valueWithUnit(context),
|
|
9
8
|
oneOfValueX: oneOfValueX(context),
|
|
10
|
-
attachment: attachment(context),
|
|
11
9
|
};
|
|
12
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type FhirMessagesIds } from '@minvws/mgo-intl';
|
|
2
2
|
import { type Nullable } from '@minvws/mgo-utils';
|
|
3
3
|
import { type UiContext } from '../../context/index.js';
|
|
4
|
-
import { type UiElement } from '../../types/index.js';
|
|
5
|
-
export declare const oneOfValueX: (context: UiContext) => <T extends object>(label: FhirMessagesIds, value: Nullable<T>, prefix?: string) => UiElement[];
|
|
4
|
+
import { type DicomViewer, type UiElement } from '../../types/index.js';
|
|
5
|
+
export declare const oneOfValueX: (context: UiContext) => <T extends object>(label: FhirMessagesIds, value: Nullable<T>, prefix?: string) => (UiElement | DicomViewer | import("../../types/draft.js").DraftGroup)[];
|
|
6
6
|
//# sourceMappingURL=oneOfValueX.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oneOfValueX.d.ts","sourceRoot":"","sources":["../../../src/special/oneOfValueX/oneOfValueX.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAA2B,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE3E,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,
|
|
1
|
+
{"version":3,"file":"oneOfValueX.d.ts","sourceRoot":"","sources":["../../../src/special/oneOfValueX/oneOfValueX.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAA2B,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE3E,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAExE,eAAO,MAAM,WAAW,GACnB,SAAS,SAAS,MAClB,CAAC,SAAS,MAAM,EAAE,OAAO,eAAe,EAAE,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE,eAAgB,4EAsB9E,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isNonNullish, isNullish } from '@minvws/mgo-utils';
|
|
2
|
-
import { upperFirst } from 'lodash-es';
|
|
3
|
-
import {
|
|
2
|
+
import { snakeCase, upperFirst } from 'lodash-es';
|
|
3
|
+
import { isGroupNode } from '../../helpers/isGroupNode/isGroupNode.js';
|
|
4
4
|
import { getTypes } from '../../type/index.js';
|
|
5
5
|
export const oneOfValueX = (context) => (label, value, prefix = 'value') => {
|
|
6
6
|
if (isNullish(value)) {
|
|
@@ -11,11 +11,11 @@ export const oneOfValueX = (context) => (label, value, prefix = 'value') => {
|
|
|
11
11
|
for (type in typeUiFunctions) {
|
|
12
12
|
const key = `${prefix}${upperFirst(type)}`;
|
|
13
13
|
if (key in value && isNonNullish(value[key])) {
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return elements.map((x) => (
|
|
14
|
+
const typeExtension = `${snakeCase(type)}`;
|
|
15
|
+
const uiValue = typeUiFunctions[type](`${label}_${typeExtension}`, value[key] // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
16
|
+
);
|
|
17
|
+
const elements = Array.isArray(uiValue) ? uiValue : [uiValue];
|
|
18
|
+
return elements.map((x) => (isGroupNode(x) ? x.children : x)).flat();
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
return [];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { format } from '../../format/index.js';
|
|
2
|
-
export const valueWithMax = ({
|
|
2
|
+
export const valueWithMax = ({ baseProps }) => (label, value, max) => {
|
|
3
3
|
return {
|
|
4
|
-
|
|
5
|
-
display: format.valueWithMaxValue(value, max),
|
|
4
|
+
...baseProps(label, value),
|
|
5
|
+
value: { display: format.valueWithMaxValue(value, max) },
|
|
6
6
|
type: 'SINGLE_VALUE',
|
|
7
7
|
};
|
|
8
8
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { format } from '../../format/index.js';
|
|
2
2
|
import { valueOf } from '../../helpers/valueOf/valueOf.js';
|
|
3
|
-
export const valueWithUnit = ({
|
|
3
|
+
export const valueWithUnit = ({ baseProps }) => (label, value, unit) => {
|
|
4
4
|
return {
|
|
5
|
-
|
|
6
|
-
display: format.valueWithUnit(valueOf(value), valueOf(unit)),
|
|
5
|
+
...baseProps(label, value),
|
|
6
|
+
value: { display: format.valueWithUnit(valueOf(value), valueOf(unit)) },
|
|
7
7
|
type: 'SINGLE_VALUE',
|
|
8
8
|
};
|
|
9
9
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type MgoAnnotation } from '@minvws/mgo-hcim-parse';
|
|
2
2
|
import { type Nullable } from '@minvws/mgo-utils';
|
|
3
3
|
import { type MultipleValues, type SingleValue, type UiFunction, type WithUiContext } from '../../types/index.js';
|
|
4
|
-
export declare const annotationDisplay: (value: Nullable<MgoAnnotation>) =>
|
|
4
|
+
export declare const annotationDisplay: (value: Nullable<MgoAnnotation>) => {
|
|
5
|
+
display: string | undefined;
|
|
6
|
+
};
|
|
5
7
|
export declare const annotation: WithUiContext<UiFunction<MgoAnnotation | MgoAnnotation[], SingleValue | MultipleValues>>;
|
|
6
8
|
//# sourceMappingURL=annotation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotation.d.ts","sourceRoot":"","sources":["../../../src/type/annotation/annotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EACH,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,EACrB,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,iBAAiB,GAAI,OAAO,QAAQ,CAAC,aAAa,CAAC
|
|
1
|
+
{"version":3,"file":"annotation.d.ts","sourceRoot":"","sources":["../../../src/type/annotation/annotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EACH,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,EACrB,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,iBAAiB,GAAI,OAAO,QAAQ,CAAC,aAAa,CAAC;;CAI/D,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,aAAa,CAClC,UAAU,CAAC,aAAa,GAAG,aAAa,EAAE,EAAE,WAAW,GAAG,cAAc,CAAC,CAiBxE,CAAC"}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { isNonNullish } from '@minvws/mgo-utils';
|
|
2
2
|
export const annotationDisplay = (value) => {
|
|
3
|
-
return
|
|
3
|
+
return {
|
|
4
|
+
display: value?.text,
|
|
5
|
+
};
|
|
4
6
|
};
|
|
5
|
-
export const annotation = ({
|
|
7
|
+
export const annotation = ({ baseProps }) => (label, value, options = {}) => {
|
|
6
8
|
if (Array.isArray(value)) {
|
|
7
9
|
return {
|
|
8
|
-
|
|
10
|
+
...baseProps(label, value, options),
|
|
9
11
|
type: 'MULTIPLE_VALUES',
|
|
10
|
-
|
|
12
|
+
value: value.map(annotationDisplay).filter(isNonNullish),
|
|
11
13
|
};
|
|
12
14
|
}
|
|
13
15
|
return {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
...baseProps(label, value, options),
|
|
17
|
+
value: annotationDisplay(value),
|
|
16
18
|
type: 'SINGLE_VALUE',
|
|
17
19
|
};
|
|
18
20
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type MgoAttachment } from '@minvws/mgo-hcim-parse';
|
|
2
|
+
import { type DicomViewer, type DownloadBinary, type DownloadLink, type UiFunction, type WithUiContext } from '../../types/index.js';
|
|
3
|
+
export declare const attachment: WithUiContext<UiFunction<MgoAttachment, (DownloadLink | DownloadBinary | DicomViewer)[]>>;
|
|
4
|
+
//# sourceMappingURL=attachment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../../../src/type/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,UAAU,EACf,KAAK,aAAa,EACrB,MAAM,sBAAsB,CAAC;AAU9B,eAAO,MAAM,UAAU,EAAE,aAAa,CAClC,UAAU,CAAC,aAAa,EAAE,CAAC,YAAY,GAAG,cAAc,GAAG,WAAW,CAAC,EAAE,CAAC,CA8BzE,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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 }) => (_label, 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
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { isNonNullish } from '@minvws/mgo-utils';
|
|
2
|
-
export const boolean = ({
|
|
2
|
+
export const boolean = ({ baseProps, formatMessage }) => (label, value, options = {}) => {
|
|
3
3
|
const truthyString = value?.value
|
|
4
4
|
? formatMessage('fhir.boolean.true')
|
|
5
5
|
: formatMessage('fhir.boolean.false');
|
|
6
6
|
return {
|
|
7
|
-
|
|
7
|
+
...baseProps(label, value, options),
|
|
8
8
|
type: 'SINGLE_VALUE',
|
|
9
|
-
|
|
9
|
+
value: isNonNullish(value?.value) ? { display: truthyString } : undefined,
|
|
10
10
|
};
|
|
11
11
|
};
|
package/dist/type/code/code.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { isNonNullish, isNullish } from '@minvws/mgo-utils';
|
|
2
2
|
import { valueOf } from '../../helpers/valueOf/valueOf.js';
|
|
3
3
|
export function code(context) {
|
|
4
|
-
const { hasMessage, formatMessage,
|
|
4
|
+
const { hasMessage, formatMessage, baseProps } = context;
|
|
5
5
|
return function (label, value, options) {
|
|
6
|
-
const { i18nCode
|
|
6
|
+
const { i18nCode } = options ?? {};
|
|
7
7
|
function translateCode(code) {
|
|
8
8
|
const codeValue = valueOf(code);
|
|
9
9
|
const i18nKey = `codes.${i18nCode}.${codeValue}`;
|
|
@@ -11,21 +11,21 @@ export function code(context) {
|
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
if (i18nCode && hasMessage(i18nKey)) {
|
|
14
|
-
return formatMessage(i18nKey);
|
|
14
|
+
return { display: formatMessage(i18nKey) };
|
|
15
15
|
}
|
|
16
|
-
return codeValue;
|
|
16
|
+
return { display: codeValue };
|
|
17
17
|
}
|
|
18
18
|
if (Array.isArray(value)) {
|
|
19
19
|
return {
|
|
20
|
-
|
|
20
|
+
...baseProps(label, value, options),
|
|
21
21
|
type: 'MULTIPLE_VALUES',
|
|
22
|
-
|
|
22
|
+
value: value.map(translateCode).filter(isNonNullish),
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
return {
|
|
26
|
-
|
|
26
|
+
...baseProps(label, value, options),
|
|
27
27
|
type: 'SINGLE_VALUE',
|
|
28
|
-
|
|
28
|
+
value: translateCode(value),
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
31
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type MgoCodeableConcept } from '@minvws/mgo-hcim-parse';
|
|
2
|
-
import {
|
|
3
|
-
export declare const codeableConcept: WithUiContext<UiFunction<MgoCodeableConcept | MgoCodeableConcept[],
|
|
2
|
+
import { SingleValue, type MultipleValues, type UiFunction, type WithUiContext } from '../../types/index.js';
|
|
3
|
+
export declare const codeableConcept: WithUiContext<UiFunction<MgoCodeableConcept | MgoCodeableConcept[], SingleValue | MultipleValues>>;
|
|
4
4
|
//# sourceMappingURL=codeableConcept.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codeableConcept.d.ts","sourceRoot":"","sources":["../../../src/type/codeableConcept/codeableConcept.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"codeableConcept.d.ts","sourceRoot":"","sources":["../../../src/type/codeableConcept/codeableConcept.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjF,OAAO,EACH,WAAW,EACX,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,aAAa,EACrB,MAAM,sBAAsB,CAAC;AAe9B,eAAO,MAAM,eAAe,EAAE,aAAa,CACvC,UAAU,CAAC,kBAAkB,GAAG,kBAAkB,EAAE,EAAE,WAAW,GAAG,cAAc,CAAC,CAgClF,CAAC"}
|