@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.
Files changed (205) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +9 -7
  3. package/dist/common/organization/organization.d.ts.map +1 -1
  4. package/dist/common/organization/organization.js +2 -1
  5. package/dist/common/summaryOptions/summaryOptions.d.ts +2 -6
  6. package/dist/common/summaryOptions/summaryOptions.d.ts.map +1 -1
  7. package/dist/common/summaryOptions/summaryOptions.js +7 -4
  8. package/dist/context/baseProps/baseProps.d.ts +7 -0
  9. package/dist/context/baseProps/baseProps.d.ts.map +1 -0
  10. package/dist/context/baseProps/baseProps.js +10 -0
  11. package/dist/context/formatLabel/formatLabel.d.ts +20 -0
  12. package/dist/context/formatLabel/formatLabel.d.ts.map +1 -0
  13. package/dist/context/formatLabel/formatLabel.js +69 -0
  14. package/dist/context/index.d.ts +5 -3
  15. package/dist/context/index.d.ts.map +1 -1
  16. package/dist/context/index.js +3 -1
  17. package/dist/finalize/finalizeSchema/finalizeSchema.d.ts +7 -0
  18. package/dist/finalize/finalizeSchema/finalizeSchema.d.ts.map +1 -0
  19. package/dist/finalize/finalizeSchema/finalizeSchema.js +17 -0
  20. package/dist/finalize/flattenDeepGroups/flattenDeepGroups.d.ts +7 -0
  21. package/dist/finalize/flattenDeepGroups/flattenDeepGroups.d.ts.map +1 -0
  22. package/dist/finalize/flattenDeepGroups/flattenDeepGroups.js +69 -0
  23. package/dist/finalize/flattenSingleSubGroups/flattenSingleSubGroups.d.ts +7 -0
  24. package/dist/finalize/flattenSingleSubGroups/flattenSingleSubGroups.d.ts.map +1 -0
  25. package/dist/finalize/flattenSingleSubGroups/flattenSingleSubGroups.js +29 -0
  26. package/dist/finalize/hoistRootElements/hoistRootElements.d.ts +8 -0
  27. package/dist/finalize/hoistRootElements/hoistRootElements.d.ts.map +1 -0
  28. package/dist/finalize/hoistRootElements/hoistRootElements.js +47 -0
  29. package/dist/finalize/index.d.ts +7 -0
  30. package/dist/finalize/index.d.ts.map +1 -0
  31. package/dist/finalize/index.js +6 -0
  32. package/dist/finalize/normalizeSchema/normalizeSchema.d.ts +12 -0
  33. package/dist/finalize/normalizeSchema/normalizeSchema.d.ts.map +1 -0
  34. package/dist/finalize/normalizeSchema/normalizeSchema.js +81 -0
  35. package/dist/finalize/setEmptyEntries/setEmptyEntries.d.ts +4 -0
  36. package/dist/finalize/setEmptyEntries/setEmptyEntries.d.ts.map +1 -0
  37. package/dist/finalize/setEmptyEntries/setEmptyEntries.js +27 -0
  38. package/dist/finalize/translateGroupLabels/translateGroupLabels.d.ts +8 -0
  39. package/dist/finalize/translateGroupLabels/translateGroupLabels.d.ts.map +1 -0
  40. package/dist/finalize/translateGroupLabels/translateGroupLabels.js +29 -0
  41. package/dist/format/cardTitle/cardTitle.d.ts +6 -0
  42. package/dist/format/cardTitle/cardTitle.d.ts.map +1 -0
  43. package/dist/format/cardTitle/cardTitle.js +21 -0
  44. package/dist/format/cardTitle/extractDisplayFromUiElement/extractDisplayFromUiElement.d.ts +3 -0
  45. package/dist/format/cardTitle/extractDisplayFromUiElement/extractDisplayFromUiElement.d.ts.map +1 -0
  46. package/dist/format/cardTitle/extractDisplayFromUiElement/extractDisplayFromUiElement.js +17 -0
  47. package/dist/format/index.d.ts +10 -1
  48. package/dist/format/index.d.ts.map +1 -1
  49. package/dist/format/index.js +9 -0
  50. package/dist/generator/createGeneratorContext/createGeneratorContext.d.ts +5 -2
  51. package/dist/generator/createGeneratorContext/createGeneratorContext.d.ts.map +1 -1
  52. package/dist/generator/createGeneratorContext/createGeneratorContext.js +5 -2
  53. package/dist/generator/createUiElementHelper/createUiElementHelper.d.ts +2 -2
  54. package/dist/generator/createUiElementHelper/createUiElementHelper.d.ts.map +1 -1
  55. package/dist/generator/createUiElementHelper/createUiElementHelper.js +11 -43
  56. package/dist/generator/generateUiSchema/generateUiSchema.d.ts.map +1 -1
  57. package/dist/generator/generateUiSchema/generateUiSchema.js +5 -14
  58. package/dist/generator/getProfileKey/getProfileKey.d.ts +1 -1
  59. package/dist/generator/getProfileKey/getProfileKey.d.ts.map +1 -1
  60. package/dist/generator/getUiElements/getUiElements.d.ts +2 -2
  61. package/dist/generator/getUiElements/getUiElements.d.ts.map +1 -1
  62. package/dist/generator/getUiElements/getUiElements.js +2 -2
  63. package/dist/generator/processArray/processArray.d.ts +2 -2
  64. package/dist/generator/processArray/processArray.d.ts.map +1 -1
  65. package/dist/generator/processArray/processArray.js +2 -2
  66. package/dist/generator/processMgoType/processMgoType.d.ts +2 -2
  67. package/dist/generator/processMgoType/processMgoType.d.ts.map +1 -1
  68. package/dist/generator/processMgoType/processMgoType.js +3 -2
  69. package/dist/generator/processObject/processObject.d.ts +2 -2
  70. package/dist/generator/processObject/processObject.d.ts.map +1 -1
  71. package/dist/generator/processObject/processObject.js +5 -4
  72. package/dist/generator/processValue/processValue.d.ts +2 -2
  73. package/dist/generator/processValue/processValue.d.ts.map +1 -1
  74. package/dist/generator/processValue/processValue.js +4 -3
  75. package/dist/helpers/index.d.ts +3 -3
  76. package/dist/helpers/index.d.ts.map +1 -1
  77. package/dist/helpers/index.js +3 -3
  78. package/dist/helpers/isEmptyNode/isEmptyNode.d.ts +5 -0
  79. package/dist/helpers/isEmptyNode/isEmptyNode.d.ts.map +1 -0
  80. package/dist/helpers/isEmptyNode/isEmptyNode.js +24 -0
  81. package/dist/helpers/isEmptyUiEntry/isEmptyUiEntry.d.ts +4 -2
  82. package/dist/helpers/isEmptyUiEntry/isEmptyUiEntry.d.ts.map +1 -1
  83. package/dist/helpers/isEmptyUiEntry/isEmptyUiEntry.js +8 -3
  84. package/dist/helpers/isGroupNode/isGroupNode.d.ts +6 -0
  85. package/dist/helpers/isGroupNode/isGroupNode.d.ts.map +1 -0
  86. package/dist/helpers/isGroupNode/isGroupNode.js +3 -0
  87. package/dist/helpers/isUiGroupNode/isUiGroupNode.d.ts +6 -0
  88. package/dist/helpers/isUiGroupNode/isUiGroupNode.d.ts.map +1 -0
  89. package/dist/helpers/isUiGroupNode/isUiGroupNode.js +3 -0
  90. package/dist/helpers/isUiSchemaGroup/isUiSchemaGroup.d.ts +2 -2
  91. package/dist/helpers/isUiSchemaGroup/isUiSchemaGroup.d.ts.map +1 -1
  92. package/dist/helpers/isUiSchemaGroup/isUiSchemaGroup.js +1 -1
  93. package/dist/helpers/optional/optional.d.ts +17 -0
  94. package/dist/helpers/optional/optional.d.ts.map +1 -0
  95. package/dist/helpers/optional/optional.js +21 -0
  96. package/dist/index.d.ts +5 -3
  97. package/dist/index.d.ts.map +1 -1
  98. package/dist/index.js +2 -3
  99. package/dist/schema.d.ts +2 -0
  100. package/dist/schema.d.ts.map +1 -0
  101. package/dist/schema.js +2 -0
  102. package/dist/special/attachment/attachment.d.ts +2 -2
  103. package/dist/special/attachment/attachment.d.ts.map +1 -1
  104. package/dist/special/attachment/attachment.js +28 -15
  105. package/dist/special/index.d.ts +3 -4
  106. package/dist/special/index.d.ts.map +1 -1
  107. package/dist/special/index.js +0 -2
  108. package/dist/special/oneOfValueX/oneOfValueX.d.ts +2 -2
  109. package/dist/special/oneOfValueX/oneOfValueX.d.ts.map +1 -1
  110. package/dist/special/oneOfValueX/oneOfValueX.js +7 -7
  111. package/dist/special/valueWithMax/valueWithMax.js +3 -3
  112. package/dist/special/valueWithUnit/valueWithUnit.js +3 -3
  113. package/dist/type/annotation/annotation.d.ts +3 -1
  114. package/dist/type/annotation/annotation.d.ts.map +1 -1
  115. package/dist/type/annotation/annotation.js +8 -6
  116. package/dist/type/attachment/attachment.d.ts +4 -0
  117. package/dist/type/attachment/attachment.d.ts.map +1 -0
  118. package/dist/type/attachment/attachment.js +31 -0
  119. package/dist/type/boolean/boolean.js +3 -3
  120. package/dist/type/code/code.js +8 -8
  121. package/dist/type/codeableConcept/codeableConcept.d.ts +2 -2
  122. package/dist/type/codeableConcept/codeableConcept.d.ts.map +1 -1
  123. package/dist/type/codeableConcept/codeableConcept.js +28 -15
  124. package/dist/type/coding/coding.d.ts +5 -2
  125. package/dist/type/coding/coding.d.ts.map +1 -1
  126. package/dist/type/coding/coding.js +14 -6
  127. package/dist/type/date/date.d.ts.map +1 -1
  128. package/dist/type/date/date.js +2 -1
  129. package/dist/type/dateTime/dateTime.d.ts.map +1 -1
  130. package/dist/type/dateTime/dateTime.js +5 -6
  131. package/dist/type/decimal/decimal.js +3 -3
  132. package/dist/type/duration/duration.d.ts +2 -2
  133. package/dist/type/duration/duration.d.ts.map +1 -1
  134. package/dist/type/identifier/identifier.d.ts.map +1 -1
  135. package/dist/type/identifier/identifier.js +5 -6
  136. package/dist/type/index.d.ts +12 -11
  137. package/dist/type/index.d.ts.map +1 -1
  138. package/dist/type/index.js +4 -1
  139. package/dist/type/instant/instant.d.ts.map +1 -1
  140. package/dist/type/instant/instant.js +5 -6
  141. package/dist/type/integer/integer.js +3 -3
  142. package/dist/type/integer64/integer64.js +3 -3
  143. package/dist/type/period/period.d.ts.map +1 -1
  144. package/dist/type/period/period.js +4 -2
  145. package/dist/type/positiveInt/positiveInt.js +3 -3
  146. package/dist/type/quantity/quantity.d.ts +2 -2
  147. package/dist/type/quantity/quantity.d.ts.map +1 -1
  148. package/dist/type/quantity/quantity.js +15 -3
  149. package/dist/type/range/range.d.ts.map +1 -1
  150. package/dist/type/range/range.js +5 -7
  151. package/dist/type/ratio/ratio.d.ts.map +1 -1
  152. package/dist/type/ratio/ratio.js +5 -7
  153. package/dist/type/reference/reference.d.ts.map +1 -1
  154. package/dist/type/reference/reference.js +6 -7
  155. package/dist/type/sampledData/sampledData.d.ts +2 -2
  156. package/dist/type/sampledData/sampledData.d.ts.map +1 -1
  157. package/dist/type/sampledData/sampledData.js +2 -0
  158. package/dist/type/simpleQuantity/simpleQuantity.js +3 -3
  159. package/dist/type/string/string.d.ts.map +1 -1
  160. package/dist/type/string/string.js +5 -6
  161. package/dist/type/time/time.d.ts.map +1 -1
  162. package/dist/type/time/time.js +5 -6
  163. package/dist/type/timing/timing.d.ts +2 -2
  164. package/dist/type/timing/timing.d.ts.map +1 -1
  165. package/dist/type/timing/timing.js +2 -0
  166. package/dist/type/unsignedInt/unsignedInt.js +3 -3
  167. package/dist/typeMaps/complexUiTypeMap.d.ts +8 -0
  168. package/dist/typeMaps/complexUiTypeMap.d.ts.map +1 -0
  169. package/dist/typeMaps/complexUiTypeMap.js +6 -0
  170. package/dist/typeMaps/index.d.ts +4 -0
  171. package/dist/typeMaps/index.d.ts.map +1 -0
  172. package/dist/typeMaps/index.js +3 -0
  173. package/dist/typeMaps/multipleUiTypeMap.d.ts +19 -0
  174. package/dist/typeMaps/multipleUiTypeMap.d.ts.map +1 -0
  175. package/dist/typeMaps/multipleUiTypeMap.js +15 -0
  176. package/dist/typeMaps/singleUiTypeMap.d.ts +32 -0
  177. package/dist/typeMaps/singleUiTypeMap.d.ts.map +1 -0
  178. package/dist/typeMaps/singleUiTypeMap.js +28 -0
  179. package/dist/typeMaps/typeMapTypes.d.ts +12 -0
  180. package/dist/typeMaps/typeMapTypes.d.ts.map +1 -0
  181. package/dist/typeMaps/typeMapTypes.js +2 -0
  182. package/dist/types/context.d.ts +5 -11
  183. package/dist/types/context.d.ts.map +1 -1
  184. package/dist/types/draft.d.ts +10 -0
  185. package/dist/types/draft.d.ts.map +1 -0
  186. package/dist/types/draft.js +1 -0
  187. package/dist/types/index.d.ts +2 -0
  188. package/dist/types/index.d.ts.map +1 -1
  189. package/dist/types/index.js +3 -1
  190. package/dist/types/schema.d.ts +39 -18
  191. package/dist/types/schema.d.ts.map +1 -1
  192. package/dist/types/schemaFunction.d.ts +5 -0
  193. package/dist/types/schemaFunction.d.ts.map +1 -0
  194. package/dist/types/schemaFunction.js +1 -0
  195. package/dist/ui.d.ts +30 -30
  196. package/package.json +26 -11
  197. package/dist/context/formatLabel.d.ts +0 -14
  198. package/dist/context/formatLabel.d.ts.map +0 -1
  199. package/dist/context/formatLabel.js +0 -61
  200. package/dist/helpers/dropEmptyEntries/dropEmptyEntries.d.ts +0 -5
  201. package/dist/helpers/dropEmptyEntries/dropEmptyEntries.d.ts.map +0 -1
  202. package/dist/helpers/dropEmptyEntries/dropEmptyEntries.js +0 -28
  203. package/dist/helpers/setEmptyEntries/setEmptyEntries.d.ts +0 -4
  204. package/dist/helpers/setEmptyEntries/setEmptyEntries.d.ts.map +0 -1
  205. package/dist/helpers/setEmptyEntries/setEmptyEntries.js +0 -31
@@ -0,0 +1,81 @@
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
+ }
@@ -0,0 +1,4 @@
1
+ import { type UiContext } from '../../context/index.js';
2
+ import { type HealthUiSchema } from '../../types/index.js';
3
+ export declare function setEmptyEntries(context: UiContext): (schema: HealthUiSchema) => HealthUiSchema;
4
+ //# sourceMappingURL=setEmptyEntries.d.ts.map
@@ -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"}
@@ -0,0 +1,29 @@
1
+ import { isNullish } from '@minvws/mgo-utils';
2
+ import { isGroupNode } from '../../helpers/isGroupNode/isGroupNode.js';
3
+ const untranslatedLabelRegexp = /^(r3|r4|fhir)\./;
4
+ /**
5
+ * Translates group and subgroup labels after the schema structure is finalized.
6
+ * Only labels that look like message keys (`r3.*`, `r4.*`, `fhir.*`) are translated.
7
+ */
8
+ export function translateGroupLabels(context) {
9
+ return (schema) => ({
10
+ ...schema,
11
+ children: schema.children.map((child) => isGroupNode(child) ? translateGroup(context, child) : child),
12
+ });
13
+ }
14
+ function translateLabel(context, label) {
15
+ if (label && untranslatedLabelRegexp.test(label)) {
16
+ return context.formatLabel(label, null);
17
+ }
18
+ return label;
19
+ }
20
+ function translateGroup(context, group) {
21
+ const { type, id, label, children, ...rest } = group;
22
+ return {
23
+ type,
24
+ ...(!isNullish(id) ? { id } : {}),
25
+ ...(!isNullish(label) ? { label: translateLabel(context, label) } : {}),
26
+ ...rest,
27
+ children: children.map((child) => isGroupNode(child) ? translateGroup(context, child) : child),
28
+ };
29
+ }
@@ -0,0 +1,6 @@
1
+ import { ValueType } from '@minvws/mgo-hcim-parse';
2
+ import { FhirMessagesIds } from '@minvws/mgo-intl';
3
+ import { type UiContext } from '../../context/index.js';
4
+ import { type SingleTypeUiFunctionMapKeys } from '../../typeMaps/index.js';
5
+ export declare function createCardTitleFormatter(uiContext: UiContext): (value: ValueType<SingleTypeUiFunctionMapKeys> | ValueType<SingleTypeUiFunctionMapKeys>[] | undefined, fallback: FhirMessagesIds) => string;
6
+ //# sourceMappingURL=cardTitle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cardTitle.d.ts","sourceRoot":"","sources":["../../../src/format/cardTitle/cardTitle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAyB,KAAK,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAIlG,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,SAAS,IASrD,OACM,SAAS,CAAC,2BAA2B,CAAC,GACtC,SAAS,CAAC,2BAA2B,CAAC,EAAE,GACxC,SAAS,EACf,UAAU,eAAe,KAC1B,MAAM,CAUZ"}
@@ -0,0 +1,21 @@
1
+ import { createSingleUiTypeMap } from '../../typeMaps/index.js';
2
+ import { createUiHelpers } from '../../ui.js';
3
+ import { extractDisplayFromUiElement } from './extractDisplayFromUiElement/extractDisplayFromUiElement.js';
4
+ export function createCardTitleFormatter(uiContext) {
5
+ const { formatMessage } = uiContext;
6
+ const ui = createUiHelpers(uiContext);
7
+ const singleUiTypeMap = createSingleUiTypeMap(ui);
8
+ /**
9
+ * Attempts to generate the title for a card solely based on the value
10
+ */
11
+ return function cardTitle(value, fallback) {
12
+ const usedValue = Array.isArray(value) ? value[0] : value;
13
+ if (!usedValue) {
14
+ return formatMessage(fallback);
15
+ }
16
+ const helper = singleUiTypeMap[usedValue._type];
17
+ const result = helper(fallback, value); // eslint-disable-line @typescript-eslint/no-explicit-any -- indexed map loses type correlation
18
+ const element = Array.isArray(result) ? result[0] : result;
19
+ return extractDisplayFromUiElement(element) ?? formatMessage(fallback);
20
+ };
21
+ }
@@ -0,0 +1,3 @@
1
+ import { type DicomViewer, type UiElement } from '../../../types/schema.js';
2
+ export declare function extractDisplayFromUiElement(element: UiElement | DicomViewer): string | undefined;
3
+ //# sourceMappingURL=extractDisplayFromUiElement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractDisplayFromUiElement.d.ts","sourceRoot":"","sources":["../../../../src/format/cardTitle/extractDisplayFromUiElement/extractDisplayFromUiElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE5E,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS,CAgBhG"}
@@ -0,0 +1,17 @@
1
+ export function extractDisplayFromUiElement(element) {
2
+ switch (element.type) {
3
+ case 'SINGLE_VALUE':
4
+ return element.value?.display;
5
+ case 'MULTIPLE_VALUES':
6
+ return element?.value?.[0]?.display;
7
+ case 'REFERENCE_VALUE':
8
+ case 'EMPTY_VALUE':
9
+ return element.display;
10
+ case 'DOWNLOAD_LINK':
11
+ case 'DOWNLOAD_BINARY':
12
+ case 'DICOM_VIEWER':
13
+ return element.label;
14
+ default:
15
+ return;
16
+ }
17
+ }
@@ -1,6 +1,15 @@
1
+ import { type UiContext } from '../context/index.js';
1
2
  export declare const format: {
2
- date: import("../index.js").WithUiContext<import("../index.js").FormatFunction<import("@minvws/mgo-fhir").DateString | import("@minvws/mgo-fhir").DateTimeString | import("@minvws/mgo-fhir").InstantDateTimeString>>;
3
+ date: import("../types/context.js").WithUiContext<import("../types/context.js").FormatFunction<import("@minvws/mgo-fhir").DateString | import("@minvws/mgo-fhir").DateTimeString | import("@minvws/mgo-fhir").InstantDateTimeString>>;
3
4
  valueWithUnit(value: import("@minvws/mgo-utils").Nullable<import("lossless-json").LosslessNumber | number>, unit: import("@minvws/mgo-utils").Nullable<string>): string | undefined;
4
5
  valueWithMaxValue(value: import("@minvws/mgo-utils").Nullable<import("lossless-json").LosslessNumber | number>, maxValue: import("@minvws/mgo-utils").Nullable<import("lossless-json").LosslessNumber | number>): string | undefined;
5
6
  };
7
+ export declare function createFormatHelpers(context: UiContext): {
8
+ valueWithUnit(value: import("@minvws/mgo-utils").Nullable<import("lossless-json").LosslessNumber | number>, unit: import("@minvws/mgo-utils").Nullable<string>): string | undefined;
9
+ valueWithMaxValue(value: import("@minvws/mgo-utils").Nullable<import("lossless-json").LosslessNumber | number>, maxValue: import("@minvws/mgo-utils").Nullable<import("lossless-json").LosslessNumber | number>): string | undefined;
10
+ date: import("../types/context.js").FormatFunction<`${number}` | `${number}-${number}` | `${number}-${number}-${number}` | `${number}-${number}-${number}T${number}:${number}:${number}${string}`>;
11
+ systemValue: import("../types/context.js").FormatFunction<import("@minvws/mgo-hcim-parse").MgoSimpleQuantityProps>;
12
+ };
13
+ export type FormatHelpers = ReturnType<typeof createFormatHelpers>;
14
+ export { createCardTitleFormatter } from './cardTitle/cardTitle.js';
6
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/format/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM;;;;CAGlB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/format/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKrD,eAAO,MAAM,MAAM;;;;CAGlB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,SAAS;;;;;EAMrD;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -1,6 +1,15 @@
1
1
  import * as date from './date/date.js';
2
+ import { systemValue } from './systemValue/systemValue.js';
2
3
  import * as value from './value/value.js';
3
4
  export const format = {
4
5
  ...value,
5
6
  ...date,
6
7
  };
8
+ export function createFormatHelpers(context) {
9
+ return {
10
+ date: date.date(context),
11
+ systemValue: systemValue(context),
12
+ ...value,
13
+ };
14
+ }
15
+ export { createCardTitleFormatter } from './cardTitle/cardTitle.js';
@@ -1,12 +1,15 @@
1
1
  import { type FhirVersion } from '@minvws/mgo-fhir';
2
+ import { type Logger } from '@minvws/mgo-logging';
2
3
  import { UiContext } from '../../context/index.js';
3
4
  import { createUiElementHelper } from '../createUiElementHelper/createUiElementHelper.js';
4
5
  export type GeneratorContext = {
5
6
  formatMessage: UiContext['formatMessage'];
6
7
  formatLabel: UiContext['formatLabel'];
7
8
  createUiElement: ReturnType<typeof createUiElementHelper>;
8
- fhirVersion: `${FhirVersion}`;
9
+ fhirVersion: FhirVersion;
9
10
  rootPath: string;
11
+ baseProps: UiContext['baseProps'];
12
+ log: Logger;
10
13
  };
11
- export declare function createGeneratorContext(uiContext: UiContext, rootPath: string, fhirVersion: `${FhirVersion}`): GeneratorContext;
14
+ export declare function createGeneratorContext(uiContext: UiContext, rootPath: string, fhirVersion: FhirVersion, log?: Logger): GeneratorContext;
12
15
  //# sourceMappingURL=createGeneratorContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createGeneratorContext.d.ts","sourceRoot":"","sources":["../../../src/generator/createGeneratorContext/createGeneratorContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAE1F,MAAM,MAAM,gBAAgB,GAAG;IAC3B,aAAa,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC;IAC1C,WAAW,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;IACtC,eAAe,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;IAC1D,WAAW,EAAE,GAAG,WAAW,EAAE,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,sBAAsB,CAClC,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,GAAG,WAAW,EAAE,GAC9B,gBAAgB,CAWlB"}
1
+ {"version":3,"file":"createGeneratorContext.d.ts","sourceRoot":"","sources":["../../../src/generator/createGeneratorContext/createGeneratorContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAE1F,MAAM,MAAM,gBAAgB,GAAG;IAC3B,aAAa,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC;IAC1C,WAAW,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;IACtC,eAAe,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;IAC1D,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAClC,GAAG,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,wBAAgB,sBAAsB,CAClC,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,WAAW,EACxB,GAAG,GAAE,MAAsB,GAC5B,gBAAgB,CAalB"}
@@ -1,6 +1,7 @@
1
+ import { consoleLogger } from '@minvws/mgo-logging';
1
2
  import { createUiElementHelper } from '../createUiElementHelper/createUiElementHelper.js';
2
- export function createGeneratorContext(uiContext, rootPath, fhirVersion) {
3
- const { formatMessage, formatLabel } = uiContext;
3
+ export function createGeneratorContext(uiContext, rootPath, fhirVersion, log = consoleLogger) {
4
+ const { formatMessage, formatLabel, baseProps } = uiContext;
4
5
  const createUiElement = createUiElementHelper(uiContext);
5
6
  return {
6
7
  formatMessage,
@@ -8,5 +9,7 @@ export function createGeneratorContext(uiContext, rootPath, fhirVersion) {
8
9
  createUiElement,
9
10
  fhirVersion,
10
11
  rootPath,
12
+ baseProps,
13
+ log,
11
14
  };
12
15
  }
@@ -1,6 +1,6 @@
1
1
  import { type MgoType, type MgoTypeId } from '@minvws/mgo-hcim-parse';
2
2
  import { type FhirMessagesIds } from '@minvws/mgo-intl';
3
3
  import { UiContext } from '../../context/index.js';
4
- import { type HealthUiGroup, type UiElement } from '../../types/index.js';
5
- export declare function createUiElementHelper(uiContext: UiContext): <T extends MgoTypeId>(label: FhirMessagesIds, value: MgoType<T> | MgoType<T>[]) => UiElement | UiElement[] | HealthUiGroup;
4
+ import { DicomViewer, DraftGroup, type UiElement } from '../../types/index.js';
5
+ export declare function createUiElementHelper(uiContext: UiContext): <T extends MgoTypeId>(label: FhirMessagesIds, value: MgoType<T> | MgoType<T>[]) => (UiElement | DicomViewer) | (UiElement | DicomViewer)[] | DraftGroup;
6
6
  //# sourceMappingURL=createUiElementHelper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createUiElementHelper.d.ts","sourceRoot":"","sources":["../../../src/generator/createUiElementHelper/createUiElementHelper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAmB,MAAM,sBAAsB,CAAC;AAU3F,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,SAAS,IA6CtB,CAAC,SAAS,SAAS,EAC/C,OAAO,eAAe,EACtB,OAAO,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,KACjC,SAAS,GAAG,SAAS,EAAE,GAAG,aAAa,CAe7C"}
1
+ {"version":3,"file":"createUiElementHelper.d.ts","sourceRoot":"","sources":["../../../src/generator/createUiElementHelper/createUiElementHelper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AASnD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAG/E,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,SAAS,IAMtB,CAAC,SAAS,SAAS,EAC/C,OAAO,eAAe,EACtB,OAAO,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,KACjC,CAAC,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,SAAS,GAAG,WAAW,CAAC,EAAE,GAAG,UAAU,CAqB1E"}
@@ -1,48 +1,12 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  import { map } from '@minvws/mgo-utils';
3
+ import { createComplexUiTypeMap, createMultipleUiTypeMap, createSingleUiTypeMap, } from '../../typeMaps/index.js';
3
4
  import { createUiHelpers } from '../../ui.js';
4
5
  export function createUiElementHelper(uiContext) {
5
6
  const ui = createUiHelpers(uiContext);
6
- const singleUiTypeMap = {
7
- annotation: ui.annotation,
8
- attachment: (_label, value) => ui.attachment(value),
9
- boolean: ui.boolean,
10
- code: ui.code,
11
- codeableConcept: ui.codeableConcept,
12
- coding: ui.coding,
13
- date: ui.date,
14
- dateTime: ui.dateTime,
15
- decimal: ui.decimal,
16
- duration: ui.duration,
17
- identifier: ui.identifier,
18
- instant: ui.instant,
19
- integer: ui.integer,
20
- integer64: ui.integer64,
21
- period: ui.period,
22
- positiveInt: ui.positiveInt,
23
- quantity: ui.quantity,
24
- range: ui.range,
25
- ratio: ui.ratio,
26
- reference: ui.reference,
27
- simpleQuantity: ui.simpleQuantity,
28
- string: ui.string,
29
- time: ui.time,
30
- unsignedInt: ui.unsignedInt,
31
- // complex types
32
- timing: ui.timing,
33
- sampledData: ui.sampledData,
34
- };
35
- const multipleUiTypeMap = {
36
- annotation: ui.annotation,
37
- code: ui.code,
38
- codeableConcept: ui.codeableConcept,
39
- coding: ui.coding,
40
- dateTime: ui.dateTime,
41
- identifier: ui.identifier,
42
- instant: ui.instant,
43
- reference: ui.reference,
44
- string: ui.string,
45
- };
7
+ const singleUiTypeMap = createSingleUiTypeMap(ui);
8
+ const complexUiTypeMap = createComplexUiTypeMap(ui);
9
+ const multipleUiTypeMap = createMultipleUiTypeMap(ui);
46
10
  return function createUiElement(label, value) {
47
11
  if (Array.isArray(value)) {
48
12
  const uiHelper = multipleUiTypeMap[value[0]._type];
@@ -51,10 +15,14 @@ export function createUiElementHelper(uiContext) {
51
15
  }
52
16
  return map(value, (x) => createUiElement(label, x), true);
53
17
  }
18
+ const complexHelper = complexUiTypeMap[value._type];
19
+ if (complexHelper) {
20
+ return complexHelper(label, value);
21
+ }
54
22
  const uiHelper = singleUiTypeMap[value._type];
55
- if (!uiHelper) {
56
- throw new Error(`No ui helper found for type "${value._type}"`);
23
+ if (uiHelper) {
24
+ return uiHelper(label, value);
57
25
  }
58
- return uiHelper(label, value);
26
+ throw new Error(`No ui helper found for type "${value._type}"`);
59
27
  };
60
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generateUiSchema.d.ts","sourceRoot":"","sources":["../../../src/generator/generateUiSchema/generateUiSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,sBAAsB,EAAsB,MAAM,sBAAsB,CAAC;AAOlF,eAAO,MAAM,gBAAgB,EAAE,sBAAsB,CAAC,eAAe,EAAE,SAAS,CAgD/E,CAAC"}
1
+ {"version":3,"file":"generateUiSchema.d.ts","sourceRoot":"","sources":["../../../src/generator/generateUiSchema/generateUiSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAc,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAK1E,eAAO,MAAM,gBAAgB,EAAE,sBAAsB,CAAC,eAAe,EAAE,SAAS,CAwC/E,CAAC"}
@@ -1,37 +1,28 @@
1
- import { isUiSchemaGroup } from '../../helpers/isUiSchemaGroup/isUiSchemaGroup.js';
1
+ import { isGroupNode } from '../../helpers/isGroupNode/isGroupNode.js';
2
2
  import { createGeneratorContext } from '../createGeneratorContext/createGeneratorContext.js';
3
3
  import { getProfileKey } from '../getProfileKey/getProfileKey.js';
4
4
  import { processValue } from '../processValue/processValue.js';
5
- const untranslatedLabelRegexp = /^(r3|r4|fhir)\./;
6
5
  export const generateUiSchema = (resource, context) => {
7
6
  const { formatMessage } = context;
8
7
  const { id: _id, referenceId: _referenceId, resourceType: _resourceType, profile, fhirVersion, ...rest } = resource;
9
8
  const rootPath = getProfileKey(fhirVersion, profile);
10
9
  const generatorContext = createGeneratorContext(context, rootPath, fhirVersion);
11
10
  const defaultGroup = {
11
+ type: 'HEALTH_UI_GROUP',
12
12
  children: [],
13
13
  };
14
14
  const groups = [defaultGroup];
15
15
  const elements = processValue(generatorContext, rootPath, rest);
16
16
  for (const element of elements) {
17
- if (isUiSchemaGroup(element)) {
18
- groups.push({
19
- ...element,
20
- // We only translate the group labels at the last moment.
21
- // Otherwise groups within other groups might be missing translations for their label
22
- // even though that label is never actually used as their contents will be merged
23
- // into their parent group.
24
- label: untranslatedLabelRegexp.test(element.label)
25
- ? context.formatLabel(element.label, null)
26
- : element.label,
27
- });
17
+ if (isGroupNode(element)) {
18
+ groups.push(element);
28
19
  }
29
20
  else {
30
21
  defaultGroup.children.push(element);
31
22
  }
32
23
  }
33
24
  for (const group of groups) {
34
- group.children.sort((a, b) => a.label.localeCompare(b.label));
25
+ group.children.sort((a, b) => (a.label ?? '').localeCompare(b.label ?? ''));
35
26
  }
36
27
  return {
37
28
  label: formatMessage(rootPath),
@@ -1,3 +1,3 @@
1
1
  import { type FhirVersion, type NictizNlProfile } from '@minvws/mgo-fhir';
2
- export declare function getProfileKey(fhirVersion: `${FhirVersion}`, profile: NictizNlProfile): string;
2
+ export declare function getProfileKey(fhirVersion: FhirVersion, profile: NictizNlProfile): string;
3
3
  //# sourceMappingURL=getProfileKey.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getProfileKey.d.ts","sourceRoot":"","sources":["../../../src/generator/getProfileKey/getProfileKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAG1E,wBAAgB,aAAa,CAAC,WAAW,EAAE,GAAG,WAAW,EAAE,EAAE,OAAO,EAAE,eAAe,GAAG,MAAM,CAG7F"}
1
+ {"version":3,"file":"getProfileKey.d.ts","sourceRoot":"","sources":["../../../src/generator/getProfileKey/getProfileKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAG1E,wBAAgB,aAAa,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,GAAG,MAAM,CAGxF"}
@@ -1,3 +1,3 @@
1
- import { type HealthUiGroup, type UiElement } from '../../types/index.js';
2
- export declare function getUiElements(elements: (UiElement | HealthUiGroup)[]): UiElement[];
1
+ import { DraftGroup, DraftNode } from '../../types/index.js';
2
+ export declare function getUiElements(elements: DraftNode[]): DraftGroup['children'];
3
3
  //# sourceMappingURL=getUiElements.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getUiElements.d.ts","sourceRoot":"","sources":["../../../src/generator/getUiElements/getUiElements.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAE1E,wBAAgB,aAAa,CAAC,QAAQ,EAAE,CAAC,SAAS,GAAG,aAAa,CAAC,EAAE,GAAG,SAAS,EAAE,CAElF"}
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 +1,4 @@
1
- import { isUiSchemaGroup } from '../../helpers/isUiSchemaGroup/isUiSchemaGroup.js';
1
+ import { isGroupNode } from '../../helpers/isGroupNode/isGroupNode.js';
2
2
  export function getUiElements(elements) {
3
- return elements.map((x) => (isUiSchemaGroup(x) ? x.children : x)).flat();
3
+ return elements.map((x) => (isGroupNode(x) ? x.children : x)).flat();
4
4
  }
@@ -1,4 +1,4 @@
1
- import { type HealthUiGroup, type UiElement } from '../../types/index.js';
1
+ import { DraftNode } from '../../types/index.js';
2
2
  import { type GeneratorContext } from '../createGeneratorContext/createGeneratorContext.js';
3
- export declare function processArray(context: GeneratorContext, path: string, value: unknown[]): (UiElement | HealthUiGroup)[];
3
+ export declare function processArray(context: GeneratorContext, path: string, value: unknown[]): DraftNode[];
4
4
  //# sourceMappingURL=processArray.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"processArray.d.ts","sourceRoot":"","sources":["../../../src/generator/processArray/processArray.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAsB5F,wBAAgB,YAAY,CACxB,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EAAE,GACjB,CAAC,SAAS,GAAG,aAAa,CAAC,EAAE,CAoB/B"}
1
+ {"version":3,"file":"processArray.d.ts","sourceRoot":"","sources":["../../../src/generator/processArray/processArray.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAsB5F,wBAAgB,YAAY,CACxB,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EAAE,GACjB,SAAS,EAAE,CAoBb"}
@@ -31,9 +31,9 @@ export function processArray(context, path, value) {
31
31
  }
32
32
  return [
33
33
  {
34
- label: context.formatLabel(path, null),
34
+ ...context.baseProps(path, null),
35
35
  type: 'SINGLE_VALUE',
36
- display: undefined,
36
+ value: undefined,
37
37
  },
38
38
  ];
39
39
  }
@@ -1,5 +1,5 @@
1
1
  import { type PrimitiveValueType, type ValueType } from '@minvws/mgo-hcim-parse';
2
- import { type HealthUiGroup, type UiElement } from '../../types/index.js';
2
+ import { DraftNode } from '../../types/index.js';
3
3
  import { type GeneratorContext } from '../createGeneratorContext/createGeneratorContext.js';
4
- export declare function processMgoType(context: GeneratorContext, path: string, value: ValueType | PrimitiveValueType): (UiElement | HealthUiGroup)[];
4
+ export declare function processMgoType(context: GeneratorContext, path: string, value: ValueType | PrimitiveValueType): DraftNode[];
5
5
  //# sourceMappingURL=processMgoType.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"processMgoType.d.ts","sourceRoot":"","sources":["../../../src/generator/processMgoType/processMgoType.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACjB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAyC5F,wBAAgB,cAAc,CAC1B,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,SAAS,GAAG,kBAAkB,iCA0BxC"}
1
+ {"version":3,"file":"processMgoType.d.ts","sourceRoot":"","sources":["../../../src/generator/processMgoType/processMgoType.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACjB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EAAc,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAgC5F,wBAAgB,cAAc,CAC1B,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,SAAS,GAAG,kBAAkB,eA4BxC"}
@@ -1,7 +1,6 @@
1
1
  import { isExtensionValue, isValueType, } from '@minvws/mgo-hcim-parse';
2
2
  import { isNullish } from '@minvws/mgo-utils';
3
3
  import { snakeCase } from 'lodash-es';
4
- import { getUiElements } from '../getUiElements/getUiElements.js';
5
4
  function processNestedArray(context, path, value) {
6
5
  return value.map((item) => processNestedValue(context, path, item).flat()).flat();
7
6
  }
@@ -43,8 +42,10 @@ export function processMgoType(context, path, value) {
43
42
  if (extraUiElements.length) {
44
43
  return [
45
44
  {
45
+ type: 'HEALTH_UI_GROUP',
46
+ id: path,
46
47
  label: path,
47
- children: getUiElements(elements),
48
+ children: elements,
48
49
  },
49
50
  ];
50
51
  }
@@ -1,4 +1,4 @@
1
- import { type HealthUiGroup, type UiElement } from '../../types/index.js';
1
+ import { DraftNode } from '../../types/index.js';
2
2
  import { type GeneratorContext } from '../createGeneratorContext/createGeneratorContext.js';
3
- export declare function processObject(context: GeneratorContext, path: string, value: object): (UiElement | HealthUiGroup)[];
3
+ export declare function processObject(context: GeneratorContext, path: string, value: object): DraftNode[];
4
4
  //# sourceMappingURL=processObject.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"processObject.d.ts","sourceRoot":"","sources":["../../../src/generator/processObject/processObject.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAI5F,wBAAgB,aAAa,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,iCAgCnF"}
1
+ {"version":3,"file":"processObject.d.ts","sourceRoot":"","sources":["../../../src/generator/processObject/processObject.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAG5F,wBAAgB,aAAa,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAkCnF"}
@@ -1,6 +1,5 @@
1
1
  import { isNullish } from '@minvws/mgo-utils';
2
2
  import { snakeCase } from 'lodash-es';
3
- import { getUiElements } from '../getUiElements/getUiElements.js';
4
3
  import { processValue } from '../processValue/processValue.js';
5
4
  export function processObject(context, path, value) {
6
5
  const elements = [];
@@ -13,9 +12,9 @@ export function processObject(context, path, value) {
13
12
  const valuePath = `${path}.${snakeCase(key)}`;
14
13
  if (isNullish(value)) {
15
14
  elements.push({
16
- label: context.formatLabel(valuePath, null),
15
+ ...context.baseProps(valuePath, null),
17
16
  type: 'SINGLE_VALUE',
18
- display: undefined,
17
+ value: undefined,
19
18
  });
20
19
  }
21
20
  else {
@@ -25,8 +24,10 @@ export function processObject(context, path, value) {
25
24
  if (path !== context.rootPath && elements.length > 1) {
26
25
  return [
27
26
  {
27
+ type: 'HEALTH_UI_GROUP',
28
+ id: path,
28
29
  label: path,
29
- children: getUiElements(elements),
30
+ children: elements,
30
31
  },
31
32
  ];
32
33
  }
@@ -1,5 +1,5 @@
1
1
  import { type Nullable } from '@minvws/mgo-utils';
2
- import { type HealthUiGroup, type UiElement } from '../../types/index.js';
2
+ import { DraftNode } from '../../types/index.js';
3
3
  import { type GeneratorContext } from '../createGeneratorContext/createGeneratorContext.js';
4
- export declare function processValue(context: GeneratorContext, path: string, value: Nullable<unknown[] | object>): (UiElement | HealthUiGroup)[];
4
+ export declare function processValue(context: GeneratorContext, path: string, value: Nullable<unknown[] | object>): DraftNode[];
5
5
  //# sourceMappingURL=processValue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"processValue.d.ts","sourceRoot":"","sources":["../../../src/generator/processValue/processValue.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAO5F,wBAAgB,YAAY,CACxB,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,QAAQ,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,GACpC,CAAC,SAAS,GAAG,aAAa,CAAC,EAAE,CA8B/B"}
1
+ {"version":3,"file":"processValue.d.ts","sourceRoot":"","sources":["../../../src/generator/processValue/processValue.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAc,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAM5F,wBAAgB,YAAY,CACxB,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,QAAQ,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,GACpC,SAAS,EAAE,CAgCb"}