@medplum/react 2.0.0 → 2.0.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/dist/cjs/DiagnosticReportDisplay/DiagnosticReportDisplay.d.ts +2 -0
- package/dist/cjs/DiagnosticReportDisplay/DiagnosticReportDisplay.stories.d.ts +1 -0
- package/dist/cjs/MedplumProvider/MedplumProvider.d.ts +8 -0
- package/dist/cjs/NoteDisplay/NoteDisplay.d.ts +6 -0
- package/dist/cjs/{ResourceDiffTable/ResourceDiffTable.stories.d.ts → NoteDisplay/NoteDisplay.stories.d.ts} +3 -1
- package/dist/cjs/QuantityInput/QuantityInput.d.ts +1 -0
- package/dist/cjs/QuantityInput/QuantityInput.stories.d.ts +7 -0
- package/dist/cjs/ReferenceRangeEditor/ReferenceRangeEditor.d.ts +1 -2
- package/dist/cjs/ResourceTimeline/ResourceTimeline.d.ts +2 -2
- package/dist/cjs/index.cjs +1206 -1204
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.min.cjs +1 -1
- package/dist/esm/AddressDisplay/AddressDisplay.mjs +2 -2
- package/dist/esm/AddressDisplay/AddressDisplay.mjs.map +1 -1
- package/dist/esm/AddressInput/AddressInput.mjs +9 -9
- package/dist/esm/AddressInput/AddressInput.mjs.map +1 -1
- package/dist/esm/AnnotationInput/AnnotationInput.mjs +2 -2
- package/dist/esm/AnnotationInput/AnnotationInput.mjs.map +1 -1
- package/dist/esm/AsyncAutocomplete/AsyncAutocomplete.mjs +2 -2
- package/dist/esm/AsyncAutocomplete/AsyncAutocomplete.mjs.map +1 -1
- package/dist/esm/AttachmentArrayDisplay/AttachmentArrayDisplay.mjs +4 -4
- package/dist/esm/AttachmentArrayDisplay/AttachmentArrayDisplay.mjs.map +1 -1
- package/dist/esm/AttachmentArrayInput/AttachmentArrayInput.mjs +19 -19
- package/dist/esm/AttachmentArrayInput/AttachmentArrayInput.mjs.map +1 -1
- package/dist/esm/AttachmentButton/AttachmentButton.mjs +3 -3
- package/dist/esm/AttachmentButton/AttachmentButton.mjs.map +1 -1
- package/dist/esm/AttachmentDisplay/AttachmentDisplay.mjs +9 -9
- package/dist/esm/AttachmentDisplay/AttachmentDisplay.mjs.map +1 -1
- package/dist/esm/AttachmentInput/AttachmentInput.mjs +5 -5
- package/dist/esm/AttachmentInput/AttachmentInput.mjs.map +1 -1
- package/dist/esm/BackboneElementDisplay/BackboneElementDisplay.mjs +6 -6
- package/dist/esm/BackboneElementDisplay/BackboneElementDisplay.mjs.map +1 -1
- package/dist/esm/BackboneElementInput/BackboneElementInput.mjs +7 -7
- package/dist/esm/BackboneElementInput/BackboneElementInput.mjs.map +1 -1
- package/dist/esm/CalendarInput/CalendarInput.mjs +18 -18
- package/dist/esm/CalendarInput/CalendarInput.mjs.map +1 -1
- package/dist/esm/CheckboxFormSection/CheckboxFormSection.mjs +5 -5
- package/dist/esm/CheckboxFormSection/CheckboxFormSection.mjs.map +1 -1
- package/dist/esm/CodeInput/CodeInput.mjs +2 -2
- package/dist/esm/CodeInput/CodeInput.mjs.map +1 -1
- package/dist/esm/CodeableConceptDisplay/CodeableConceptDisplay.mjs +2 -2
- package/dist/esm/CodeableConceptDisplay/CodeableConceptDisplay.mjs.map +1 -1
- package/dist/esm/CodeableConceptInput/CodeableConceptInput.mjs +2 -2
- package/dist/esm/CodeableConceptInput/CodeableConceptInput.mjs.map +1 -1
- package/dist/esm/CodingDisplay/CodingDisplay.mjs +2 -2
- package/dist/esm/CodingDisplay/CodingDisplay.mjs.map +1 -1
- package/dist/esm/CodingInput/CodingInput.mjs +2 -2
- package/dist/esm/CodingInput/CodingInput.mjs.map +1 -1
- package/dist/esm/ContactDetailDisplay/ContactDetailDisplay.mjs +3 -3
- package/dist/esm/ContactDetailDisplay/ContactDetailDisplay.mjs.map +1 -1
- package/dist/esm/ContactDetailInput/ContactDetailInput.mjs +4 -4
- package/dist/esm/ContactDetailInput/ContactDetailInput.mjs.map +1 -1
- package/dist/esm/ContactPointDisplay/ContactPointDisplay.mjs +2 -2
- package/dist/esm/ContactPointDisplay/ContactPointDisplay.mjs.map +1 -1
- package/dist/esm/ContactPointInput/ContactPointInput.mjs +5 -5
- package/dist/esm/ContactPointInput/ContactPointInput.mjs.map +1 -1
- package/dist/esm/Container/Container.mjs +2 -2
- package/dist/esm/Container/Container.mjs.map +1 -1
- package/dist/esm/DateTimeInput/DateTimeInput.mjs +2 -2
- package/dist/esm/DateTimeInput/DateTimeInput.mjs.map +1 -1
- package/dist/esm/DefaultResourceTimeline/DefaultResourceTimeline.mjs +7 -19
- package/dist/esm/DefaultResourceTimeline/DefaultResourceTimeline.mjs.map +1 -1
- package/dist/esm/DescriptionList/DescriptionList.mjs +5 -5
- package/dist/esm/DescriptionList/DescriptionList.mjs.map +1 -1
- package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.d.ts +2 -0
- package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.mjs +56 -52
- package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.mjs.map +1 -1
- package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.stories.d.ts +1 -0
- package/dist/esm/Document/Document.mjs +3 -3
- package/dist/esm/Document/Document.mjs.map +1 -1
- package/dist/esm/EncounterTimeline/EncounterTimeline.mjs +8 -25
- package/dist/esm/EncounterTimeline/EncounterTimeline.mjs.map +1 -1
- package/dist/esm/ErrorBoundary/ErrorBoundary.mjs +4 -4
- package/dist/esm/ErrorBoundary/ErrorBoundary.mjs.map +1 -1
- package/dist/esm/ExtensionInput/ExtensionInput.mjs +2 -2
- package/dist/esm/ExtensionInput/ExtensionInput.mjs.map +1 -1
- package/dist/esm/FhirPathDisplay/FhirPathDisplay.mjs +2 -2
- package/dist/esm/FhirPathDisplay/FhirPathDisplay.mjs.map +1 -1
- package/dist/esm/FhirPathTable/FhirPathTable.mjs +19 -19
- package/dist/esm/FhirPathTable/FhirPathTable.mjs.map +1 -1
- package/dist/esm/Form/Form.mjs +2 -2
- package/dist/esm/Form/Form.mjs.map +1 -1
- package/dist/esm/FormSection/FormSection.mjs +2 -2
- package/dist/esm/FormSection/FormSection.mjs.map +1 -1
- package/dist/esm/GoogleButton/GoogleButton.mjs +8 -6
- package/dist/esm/GoogleButton/GoogleButton.mjs.map +1 -1
- package/dist/esm/HumanNameDisplay/HumanNameDisplay.mjs +2 -2
- package/dist/esm/HumanNameDisplay/HumanNameDisplay.mjs.map +1 -1
- package/dist/esm/HumanNameInput/HumanNameInput.mjs +7 -7
- package/dist/esm/HumanNameInput/HumanNameInput.mjs.map +1 -1
- package/dist/esm/IdentifierDisplay/IdentifierDisplay.mjs +2 -2
- package/dist/esm/IdentifierDisplay/IdentifierDisplay.mjs.map +1 -1
- package/dist/esm/IdentifierInput/IdentifierInput.mjs +4 -4
- package/dist/esm/IdentifierInput/IdentifierInput.mjs.map +1 -1
- package/dist/esm/Logo/Logo.mjs +8 -8
- package/dist/esm/Logo/Logo.mjs.map +1 -1
- package/dist/esm/MedplumLink/MedplumLink.mjs +4 -4
- package/dist/esm/MedplumLink/MedplumLink.mjs.map +1 -1
- package/dist/esm/MedplumProvider/MedplumProvider.d.ts +8 -0
- package/dist/esm/MedplumProvider/MedplumProvider.mjs +19 -3
- package/dist/esm/MedplumProvider/MedplumProvider.mjs.map +1 -1
- package/dist/esm/MoneyDisplay/MoneyDisplay.mjs +2 -2
- package/dist/esm/MoneyDisplay/MoneyDisplay.mjs.map +1 -1
- package/dist/esm/MoneyInput/MoneyInput.mjs +4 -4
- package/dist/esm/MoneyInput/MoneyInput.mjs.map +1 -1
- package/dist/esm/NoteDisplay/NoteDisplay.d.ts +6 -0
- package/dist/esm/NoteDisplay/NoteDisplay.mjs +18 -0
- package/dist/esm/NoteDisplay/NoteDisplay.mjs.map +1 -0
- package/dist/esm/{ResourceDiffTable/ResourceDiffTable.stories.d.ts → NoteDisplay/NoteDisplay.stories.d.ts} +3 -1
- package/dist/esm/OperationOutcomeAlert/OperationOutcomeAlert.mjs +3 -3
- package/dist/esm/OperationOutcomeAlert/OperationOutcomeAlert.mjs.map +1 -1
- package/dist/esm/Panel/Panel.mjs +2 -2
- package/dist/esm/Panel/Panel.mjs.map +1 -1
- package/dist/esm/PatientTimeline/PatientTimeline.mjs +13 -20
- package/dist/esm/PatientTimeline/PatientTimeline.mjs.map +1 -1
- package/dist/esm/PeriodInput/PeriodInput.mjs +4 -4
- package/dist/esm/PeriodInput/PeriodInput.mjs.map +1 -1
- package/dist/esm/PlanDefinitionBuilder/PlanDefinitionBuilder.mjs +34 -34
- package/dist/esm/PlanDefinitionBuilder/PlanDefinitionBuilder.mjs.map +1 -1
- package/dist/esm/QuantityDisplay/QuantityDisplay.mjs +2 -2
- package/dist/esm/QuantityDisplay/QuantityDisplay.mjs.map +1 -1
- package/dist/esm/QuantityInput/QuantityInput.d.ts +1 -0
- package/dist/esm/QuantityInput/QuantityInput.mjs +14 -8
- package/dist/esm/QuantityInput/QuantityInput.mjs.map +1 -1
- package/dist/esm/QuantityInput/QuantityInput.stories.d.ts +7 -0
- package/dist/esm/QuestionnaireBuilder/QuestionnaireBuilder.mjs +31 -31
- package/dist/esm/QuestionnaireBuilder/QuestionnaireBuilder.mjs.map +1 -1
- package/dist/esm/QuestionnaireForm/QuestionnaireForm.mjs +33 -33
- package/dist/esm/QuestionnaireForm/QuestionnaireForm.mjs.map +1 -1
- package/dist/esm/RangeDisplay/RangeDisplay.mjs +2 -2
- package/dist/esm/RangeDisplay/RangeDisplay.mjs.map +1 -1
- package/dist/esm/RangeInput/RangeInput.mjs +4 -4
- package/dist/esm/RangeInput/RangeInput.mjs.map +1 -1
- package/dist/esm/RatioDisplay/RatioDisplay.mjs +4 -4
- package/dist/esm/RatioDisplay/RatioDisplay.mjs.map +1 -1
- package/dist/esm/RatioInput/RatioInput.mjs +4 -4
- package/dist/esm/RatioInput/RatioInput.mjs.map +1 -1
- package/dist/esm/ReferenceDisplay/ReferenceDisplay.mjs +3 -3
- package/dist/esm/ReferenceDisplay/ReferenceDisplay.mjs.map +1 -1
- package/dist/esm/ReferenceInput/ReferenceInput.mjs +4 -4
- package/dist/esm/ReferenceInput/ReferenceInput.mjs.map +1 -1
- package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.d.ts +1 -2
- package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.mjs +31 -31
- package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.mjs.map +1 -1
- package/dist/esm/RequestGroupDisplay/RequestGroupDisplay.mjs +15 -15
- package/dist/esm/RequestGroupDisplay/RequestGroupDisplay.mjs.map +1 -1
- package/dist/esm/ResourceArrayDisplay/ResourceArrayDisplay.mjs +3 -3
- package/dist/esm/ResourceArrayDisplay/ResourceArrayDisplay.mjs.map +1 -1
- package/dist/esm/ResourceArrayInput/ResourceArrayInput.mjs +18 -18
- package/dist/esm/ResourceArrayInput/ResourceArrayInput.mjs.map +1 -1
- package/dist/esm/ResourceAvatar/ResourceAvatar.mjs +4 -4
- package/dist/esm/ResourceAvatar/ResourceAvatar.mjs.map +1 -1
- package/dist/esm/ResourceBadge/ResourceBadge.mjs +4 -4
- package/dist/esm/ResourceBadge/ResourceBadge.mjs.map +1 -1
- package/dist/esm/ResourceBlame/ResourceBlame.mjs +13 -13
- package/dist/esm/ResourceBlame/ResourceBlame.mjs.map +1 -1
- package/dist/esm/ResourceDiff/ResourceDiff.mjs +7 -7
- package/dist/esm/ResourceDiff/ResourceDiff.mjs.map +1 -1
- package/dist/esm/ResourceDiffTable/ResourceDiffTable.mjs +18 -18
- package/dist/esm/ResourceDiffTable/ResourceDiffTable.mjs.map +1 -1
- package/dist/esm/ResourceForm/ResourceForm.mjs +12 -12
- package/dist/esm/ResourceForm/ResourceForm.mjs.map +1 -1
- package/dist/esm/ResourceHistoryTable/ResourceHistoryTable.mjs +17 -17
- package/dist/esm/ResourceHistoryTable/ResourceHistoryTable.mjs.map +1 -1
- package/dist/esm/ResourceInput/ResourceInput.mjs +8 -8
- package/dist/esm/ResourceInput/ResourceInput.mjs.map +1 -1
- package/dist/esm/ResourceName/ResourceName.mjs +2 -2
- package/dist/esm/ResourceName/ResourceName.mjs.map +1 -1
- package/dist/esm/ResourcePropertyDisplay/ResourcePropertyDisplay.mjs +27 -27
- package/dist/esm/ResourcePropertyDisplay/ResourcePropertyDisplay.mjs.map +1 -1
- package/dist/esm/ResourcePropertyInput/ResourcePropertyInput.mjs +35 -35
- package/dist/esm/ResourcePropertyInput/ResourcePropertyInput.mjs.map +1 -1
- package/dist/esm/ResourceTable/ResourceTable.mjs +2 -2
- package/dist/esm/ResourceTable/ResourceTable.mjs.map +1 -1
- package/dist/esm/ResourceTimeline/ResourceTimeline.d.ts +2 -2
- package/dist/esm/ResourceTimeline/ResourceTimeline.mjs +67 -73
- package/dist/esm/ResourceTimeline/ResourceTimeline.mjs.map +1 -1
- package/dist/esm/Scheduler/Scheduler.mjs +22 -22
- package/dist/esm/Scheduler/Scheduler.mjs.map +1 -1
- package/dist/esm/SearchControl/SearchControl.mjs +49 -49
- package/dist/esm/SearchControl/SearchControl.mjs.map +1 -1
- package/dist/esm/SearchControl/SearchUtils.mjs +4 -4
- package/dist/esm/SearchControl/SearchUtils.mjs.map +1 -1
- package/dist/esm/SearchFieldEditor/SearchFieldEditor.mjs +25 -25
- package/dist/esm/SearchFieldEditor/SearchFieldEditor.mjs.map +1 -1
- package/dist/esm/SearchFilterEditor/SearchFilterEditor.mjs +37 -37
- package/dist/esm/SearchFilterEditor/SearchFilterEditor.mjs.map +1 -1
- package/dist/esm/SearchFilterValueDialog/SearchFilterValueDialog.mjs +6 -6
- package/dist/esm/SearchFilterValueDialog/SearchFilterValueDialog.mjs.map +1 -1
- package/dist/esm/SearchFilterValueDisplay/SearchFilterValueDisplay.mjs +4 -4
- package/dist/esm/SearchFilterValueDisplay/SearchFilterValueDisplay.mjs.map +1 -1
- package/dist/esm/SearchFilterValueInput/SearchFilterValueInput.mjs +8 -8
- package/dist/esm/SearchFilterValueInput/SearchFilterValueInput.mjs.map +1 -1
- package/dist/esm/SearchPopupMenu/SearchPopupMenu.mjs +62 -62
- package/dist/esm/SearchPopupMenu/SearchPopupMenu.mjs.map +1 -1
- package/dist/esm/ServiceRequestTimeline/ServiceRequestTimeline.mjs +9 -31
- package/dist/esm/ServiceRequestTimeline/ServiceRequestTimeline.mjs.map +1 -1
- package/dist/esm/StatusBadge/StatusBadge.mjs +2 -2
- package/dist/esm/StatusBadge/StatusBadge.mjs.map +1 -1
- package/dist/esm/Timeline/Timeline.mjs +20 -20
- package/dist/esm/Timeline/Timeline.mjs.map +1 -1
- package/dist/esm/TimingInput/TimingInput.mjs +19 -19
- package/dist/esm/TimingInput/TimingInput.mjs.map +1 -1
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.mjs +2 -2
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.mjs.map +1 -1
- package/dist/esm/auth/AuthenticationForm.mjs +22 -22
- package/dist/esm/auth/AuthenticationForm.mjs.map +1 -1
- package/dist/esm/auth/ChooseProfileForm.mjs +11 -11
- package/dist/esm/auth/ChooseProfileForm.mjs.map +1 -1
- package/dist/esm/auth/ChooseScopeForm.mjs +9 -9
- package/dist/esm/auth/ChooseScopeForm.mjs.map +1 -1
- package/dist/esm/auth/MfaForm.mjs +12 -12
- package/dist/esm/auth/MfaForm.mjs.map +1 -1
- package/dist/esm/auth/NewProjectForm.mjs +12 -12
- package/dist/esm/auth/NewProjectForm.mjs.map +1 -1
- package/dist/esm/auth/NewUserForm.mjs +22 -22
- package/dist/esm/auth/NewUserForm.mjs.map +1 -1
- package/dist/esm/auth/RegisterForm.mjs +5 -5
- package/dist/esm/auth/RegisterForm.mjs.map +1 -1
- package/dist/esm/auth/SignInForm.mjs +8 -8
- package/dist/esm/auth/SignInForm.mjs.map +1 -1
- package/dist/esm/index.min.mjs +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons/icons-react/dist/index.esm.mjs +6 -0
- package/dist/esm/node_modules/@tabler/icons/icons-react/dist/index.esm.mjs.map +1 -0
- package/dist/esm/useResource/useResource.mjs +3 -0
- package/dist/esm/useResource/useResource.mjs.map +1 -1
- package/package.json +20 -25
- package/rollup.config.mjs +0 -110
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { getElementDefinitionTypeName, PropertyType, formatTiming, formatPeriod, formatDateTime, getTypedPropertyValue } from '@medplum/core';
|
|
2
|
+
import e__default from 'react';
|
|
3
3
|
import { AddressDisplay } from '../AddressDisplay/AddressDisplay.mjs';
|
|
4
4
|
import { AttachmentArrayDisplay } from '../AttachmentArrayDisplay/AttachmentArrayDisplay.mjs';
|
|
5
5
|
import { AttachmentDisplay } from '../AttachmentDisplay/AttachmentDisplay.mjs';
|
|
@@ -21,13 +21,13 @@ function ResourcePropertyDisplay(props) {
|
|
|
21
21
|
const { property, propertyType, value } = props;
|
|
22
22
|
if (property?.max === '*' && !props.arrayElement) {
|
|
23
23
|
if (propertyType === 'Attachment') {
|
|
24
|
-
return
|
|
24
|
+
return e__default.createElement(AttachmentArrayDisplay, { values: value, maxWidth: props.maxWidth });
|
|
25
25
|
}
|
|
26
|
-
return (
|
|
26
|
+
return (e__default.createElement(ResourceArrayDisplay, { property: property, values: value, ignoreMissingValues: props.ignoreMissingValues, link: props.link }));
|
|
27
27
|
}
|
|
28
28
|
switch (propertyType) {
|
|
29
29
|
case PropertyType.boolean:
|
|
30
|
-
return
|
|
30
|
+
return e__default.createElement(e__default.Fragment, null, value === undefined ? '' : Boolean(value).toString());
|
|
31
31
|
case PropertyType.SystemString:
|
|
32
32
|
case PropertyType.code:
|
|
33
33
|
case PropertyType.date:
|
|
@@ -37,55 +37,55 @@ function ResourcePropertyDisplay(props) {
|
|
|
37
37
|
case PropertyType.unsignedInt:
|
|
38
38
|
case PropertyType.uri:
|
|
39
39
|
case PropertyType.url:
|
|
40
|
-
return
|
|
40
|
+
return e__default.createElement(e__default.Fragment, null, value);
|
|
41
41
|
case PropertyType.canonical:
|
|
42
|
-
return
|
|
42
|
+
return e__default.createElement(ReferenceDisplay, { value: { reference: value }, link: props.link });
|
|
43
43
|
case PropertyType.dateTime:
|
|
44
44
|
case PropertyType.instant:
|
|
45
|
-
return
|
|
45
|
+
return e__default.createElement(e__default.Fragment, null, formatDateTime(value));
|
|
46
46
|
case PropertyType.markdown:
|
|
47
|
-
return
|
|
47
|
+
return e__default.createElement("pre", null, value);
|
|
48
48
|
case PropertyType.Address:
|
|
49
|
-
return
|
|
49
|
+
return e__default.createElement(AddressDisplay, { value: value });
|
|
50
50
|
case PropertyType.Annotation:
|
|
51
|
-
return
|
|
51
|
+
return e__default.createElement(e__default.Fragment, null, value?.text);
|
|
52
52
|
case PropertyType.Attachment:
|
|
53
|
-
return
|
|
53
|
+
return e__default.createElement(AttachmentDisplay, { value: value, maxWidth: props.maxWidth });
|
|
54
54
|
case PropertyType.CodeableConcept:
|
|
55
|
-
return
|
|
55
|
+
return e__default.createElement(CodeableConceptDisplay, { value: value });
|
|
56
56
|
case PropertyType.Coding:
|
|
57
|
-
return
|
|
57
|
+
return e__default.createElement(CodingDisplay, { value: value });
|
|
58
58
|
case PropertyType.ContactDetail:
|
|
59
|
-
return
|
|
59
|
+
return e__default.createElement(ContactDetailDisplay, { value: value });
|
|
60
60
|
case PropertyType.ContactPoint:
|
|
61
|
-
return
|
|
61
|
+
return e__default.createElement(ContactPointDisplay, { value: value });
|
|
62
62
|
case PropertyType.HumanName:
|
|
63
|
-
return
|
|
63
|
+
return e__default.createElement(HumanNameDisplay, { value: value });
|
|
64
64
|
case PropertyType.Identifier:
|
|
65
|
-
return
|
|
65
|
+
return e__default.createElement(IdentifierDisplay, { value: value });
|
|
66
66
|
case PropertyType.Money:
|
|
67
|
-
return
|
|
67
|
+
return e__default.createElement(MoneyDisplay, { value: value });
|
|
68
68
|
case PropertyType.Period:
|
|
69
|
-
return
|
|
69
|
+
return e__default.createElement(e__default.Fragment, null, formatPeriod(value));
|
|
70
70
|
case PropertyType.Quantity:
|
|
71
71
|
case PropertyType.Duration:
|
|
72
|
-
return
|
|
72
|
+
return e__default.createElement(QuantityDisplay, { value: value });
|
|
73
73
|
case PropertyType.Range:
|
|
74
|
-
return
|
|
74
|
+
return e__default.createElement(RangeDisplay, { value: value });
|
|
75
75
|
case PropertyType.Ratio:
|
|
76
|
-
return
|
|
76
|
+
return e__default.createElement(RatioDisplay, { value: value });
|
|
77
77
|
case PropertyType.Reference:
|
|
78
|
-
return
|
|
78
|
+
return e__default.createElement(ReferenceDisplay, { value: value, link: props.link });
|
|
79
79
|
case PropertyType.Timing:
|
|
80
|
-
return
|
|
80
|
+
return e__default.createElement(e__default.Fragment, null, formatTiming(value));
|
|
81
81
|
case PropertyType.Dosage:
|
|
82
82
|
case PropertyType.UsageContext:
|
|
83
|
-
return (
|
|
83
|
+
return (e__default.createElement(BackboneElementDisplay, { value: { type: propertyType, value }, compact: true, ignoreMissingValues: props.ignoreMissingValues }));
|
|
84
84
|
default:
|
|
85
85
|
if (!property?.path) {
|
|
86
86
|
throw Error(`Displaying property of type ${props.propertyType} requires element definition path`);
|
|
87
87
|
}
|
|
88
|
-
return (
|
|
88
|
+
return (e__default.createElement(BackboneElementDisplay, { value: { type: getElementDefinitionTypeName(property), value }, compact: true, ignoreMissingValues: props.ignoreMissingValues }));
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourcePropertyDisplay.mjs","sources":["../../../src/ResourcePropertyDisplay/ResourcePropertyDisplay.tsx"],"sourcesContent":["import {\n buildTypeName,\n formatDateTime,\n formatPeriod,\n formatTiming,\n getTypedPropertyValue,\n PropertyType,\n TypedValue,\n} from '@medplum/core';\nimport { ElementDefinition } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { AddressDisplay } from '../AddressDisplay/AddressDisplay';\nimport { AttachmentArrayDisplay } from '../AttachmentArrayDisplay/AttachmentArrayDisplay';\nimport { AttachmentDisplay } from '../AttachmentDisplay/AttachmentDisplay';\nimport { BackboneElementDisplay } from '../BackboneElementDisplay/BackboneElementDisplay';\nimport { CodeableConceptDisplay } from '../CodeableConceptDisplay/CodeableConceptDisplay';\nimport { CodingDisplay } from '../CodingDisplay/CodingDisplay';\nimport { ContactDetailDisplay } from '../ContactDetailDisplay/ContactDetailDisplay';\nimport { ContactPointDisplay } from '../ContactPointDisplay/ContactPointDisplay';\nimport { HumanNameDisplay } from '../HumanNameDisplay/HumanNameDisplay';\nimport { IdentifierDisplay } from '../IdentifierDisplay/IdentifierDisplay';\nimport { MoneyDisplay } from '../MoneyDisplay/MoneyDisplay';\nimport { QuantityDisplay } from '../QuantityDisplay/QuantityDisplay';\nimport { RangeDisplay } from '../RangeDisplay/RangeDisplay';\nimport { RatioDisplay } from '../RatioDisplay/RatioDisplay';\nimport { ReferenceDisplay } from '../ReferenceDisplay/ReferenceDisplay';\nimport { ResourceArrayDisplay } from '../ResourceArrayDisplay/ResourceArrayDisplay';\n\nexport interface ResourcePropertyDisplayProps {\n property?: ElementDefinition;\n propertyType: PropertyType;\n value: any;\n arrayElement?: boolean;\n maxWidth?: number;\n ignoreMissingValues?: boolean;\n link?: boolean;\n}\n\nexport function ResourcePropertyDisplay(props: ResourcePropertyDisplayProps): JSX.Element {\n const { property, propertyType, value } = props;\n\n if (property?.max === '*' && !props.arrayElement) {\n if (propertyType === 'Attachment') {\n return <AttachmentArrayDisplay values={value} maxWidth={props.maxWidth} />;\n }\n return (\n <ResourceArrayDisplay\n property={property}\n values={value}\n ignoreMissingValues={props.ignoreMissingValues}\n link={props.link}\n />\n );\n }\n\n switch (propertyType) {\n case PropertyType.boolean:\n return <>{value === undefined ? '' : Boolean(value).toString()}</>;\n case PropertyType.SystemString:\n case PropertyType.code:\n case PropertyType.date:\n case PropertyType.integer:\n case PropertyType.positiveInt:\n case PropertyType.string:\n case PropertyType.unsignedInt:\n case PropertyType.uri:\n case PropertyType.url:\n return <>{value}</>;\n case PropertyType.canonical:\n return <ReferenceDisplay value={{ reference: value }} link={props.link} />;\n case PropertyType.dateTime:\n case PropertyType.instant:\n return <>{formatDateTime(value)}</>;\n case PropertyType.markdown:\n return <pre>{value}</pre>;\n case PropertyType.Address:\n return <AddressDisplay value={value} />;\n case PropertyType.Annotation:\n return <>{value?.text}</>;\n case PropertyType.Attachment:\n return <AttachmentDisplay value={value} maxWidth={props.maxWidth} />;\n case PropertyType.CodeableConcept:\n return <CodeableConceptDisplay value={value} />;\n case PropertyType.Coding:\n return <CodingDisplay value={value} />;\n case PropertyType.ContactDetail:\n return <ContactDetailDisplay value={value} />;\n case PropertyType.ContactPoint:\n return <ContactPointDisplay value={value} />;\n case PropertyType.HumanName:\n return <HumanNameDisplay value={value} />;\n case PropertyType.Identifier:\n return <IdentifierDisplay value={value} />;\n case PropertyType.Money:\n return <MoneyDisplay value={value} />;\n case PropertyType.Period:\n return <>{formatPeriod(value)}</>;\n case PropertyType.Quantity:\n case PropertyType.Duration:\n return <QuantityDisplay value={value} />;\n case PropertyType.Range:\n return <RangeDisplay value={value} />;\n case PropertyType.Ratio:\n return <RatioDisplay value={value} />;\n case PropertyType.Reference:\n return <ReferenceDisplay value={value} link={props.link} />;\n case PropertyType.Timing:\n return <>{formatTiming(value)}</>;\n case PropertyType.Dosage:\n case PropertyType.UsageContext:\n return (\n <BackboneElementDisplay\n value={{ type: propertyType, value }}\n compact={true}\n ignoreMissingValues={props.ignoreMissingValues}\n />\n );\n default:\n if (!property?.path) {\n throw Error(`Displaying property of type ${props.propertyType} requires element definition path`);\n }\n return (\n <BackboneElementDisplay\n value={{ type: buildTypeName(property?.path?.split('.') as string[]), value }}\n compact={true}\n ignoreMissingValues={props.ignoreMissingValues}\n />\n );\n }\n}\n\n/**\n * Returns the value of the property and the property type.\n * Some property definitions support multiple types.\n * For example, \"Observation.value[x]\" can be \"valueString\", \"valueInteger\", \"valueQuantity\", etc.\n * According to the spec, there can only be one property for a given element definition.\n * This function returns the value and the type.\n * @param context The base context (usually a FHIR resource).\n * @param property The property definition.\n * @returns The value of the property and the property type.\n */\nexport function getValueAndType(context: TypedValue, path: string): [any, PropertyType] {\n const typedResult = getTypedPropertyValue(context, path);\n if (!typedResult) {\n return [undefined, 'undefined' as PropertyType];\n }\n\n if (Array.isArray(typedResult)) {\n return [typedResult.map((e) => e.value), typedResult[0].type as PropertyType];\n }\n\n return [typedResult.value, typedResult.type as PropertyType];\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAsCM,SAAU,uBAAuB,CAAC,KAAmC,EAAA;IACzE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAEhD,IAAI,QAAQ,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE;QAChD,IAAI,YAAY,KAAK,YAAY,EAAE;AACjC,YAAA,OAAO,KAAC,CAAA,aAAA,CAAA,sBAAsB,EAAC,EAAA,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAAI,CAAC;AAC5E,SAAA;QACD,QACE,KAAC,CAAA,aAAA,CAAA,oBAAoB,EACnB,EAAA,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,KAAK,EACb,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,EAC9C,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,CAAA,EACF;AACH,KAAA;AAED,IAAA,QAAQ,YAAY;QAClB,KAAK,YAAY,CAAC,OAAO;AACvB,YAAA,OAAO,0CAAG,KAAK,KAAK,SAAS,GAAG,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAI,CAAC;QACrE,KAAK,YAAY,CAAC,YAAY,CAAC;QAC/B,KAAK,YAAY,CAAC,IAAI,CAAC;QACvB,KAAK,YAAY,CAAC,IAAI,CAAC;QACvB,KAAK,YAAY,CAAC,OAAO,CAAC;QAC1B,KAAK,YAAY,CAAC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AAW,CAAC,IAAoB,CAAC,CAAC;AAC/D;;;;"}
|
|
1
|
+
{"version":3,"file":"ResourcePropertyDisplay.mjs","sources":["../../../src/ResourcePropertyDisplay/ResourcePropertyDisplay.tsx"],"sourcesContent":["import {\n formatDateTime,\n formatPeriod,\n formatTiming,\n getElementDefinitionTypeName,\n getTypedPropertyValue,\n PropertyType,\n TypedValue,\n} from '@medplum/core';\nimport { ElementDefinition } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { AddressDisplay } from '../AddressDisplay/AddressDisplay';\nimport { AttachmentArrayDisplay } from '../AttachmentArrayDisplay/AttachmentArrayDisplay';\nimport { AttachmentDisplay } from '../AttachmentDisplay/AttachmentDisplay';\nimport { BackboneElementDisplay } from '../BackboneElementDisplay/BackboneElementDisplay';\nimport { CodeableConceptDisplay } from '../CodeableConceptDisplay/CodeableConceptDisplay';\nimport { CodingDisplay } from '../CodingDisplay/CodingDisplay';\nimport { ContactDetailDisplay } from '../ContactDetailDisplay/ContactDetailDisplay';\nimport { ContactPointDisplay } from '../ContactPointDisplay/ContactPointDisplay';\nimport { HumanNameDisplay } from '../HumanNameDisplay/HumanNameDisplay';\nimport { IdentifierDisplay } from '../IdentifierDisplay/IdentifierDisplay';\nimport { MoneyDisplay } from '../MoneyDisplay/MoneyDisplay';\nimport { QuantityDisplay } from '../QuantityDisplay/QuantityDisplay';\nimport { RangeDisplay } from '../RangeDisplay/RangeDisplay';\nimport { RatioDisplay } from '../RatioDisplay/RatioDisplay';\nimport { ReferenceDisplay } from '../ReferenceDisplay/ReferenceDisplay';\nimport { ResourceArrayDisplay } from '../ResourceArrayDisplay/ResourceArrayDisplay';\n\nexport interface ResourcePropertyDisplayProps {\n property?: ElementDefinition;\n propertyType: PropertyType;\n value: any;\n arrayElement?: boolean;\n maxWidth?: number;\n ignoreMissingValues?: boolean;\n link?: boolean;\n}\n\nexport function ResourcePropertyDisplay(props: ResourcePropertyDisplayProps): JSX.Element {\n const { property, propertyType, value } = props;\n\n if (property?.max === '*' && !props.arrayElement) {\n if (propertyType === 'Attachment') {\n return <AttachmentArrayDisplay values={value} maxWidth={props.maxWidth} />;\n }\n return (\n <ResourceArrayDisplay\n property={property}\n values={value}\n ignoreMissingValues={props.ignoreMissingValues}\n link={props.link}\n />\n );\n }\n\n switch (propertyType) {\n case PropertyType.boolean:\n return <>{value === undefined ? '' : Boolean(value).toString()}</>;\n case PropertyType.SystemString:\n case PropertyType.code:\n case PropertyType.date:\n case PropertyType.integer:\n case PropertyType.positiveInt:\n case PropertyType.string:\n case PropertyType.unsignedInt:\n case PropertyType.uri:\n case PropertyType.url:\n return <>{value}</>;\n case PropertyType.canonical:\n return <ReferenceDisplay value={{ reference: value }} link={props.link} />;\n case PropertyType.dateTime:\n case PropertyType.instant:\n return <>{formatDateTime(value)}</>;\n case PropertyType.markdown:\n return <pre>{value}</pre>;\n case PropertyType.Address:\n return <AddressDisplay value={value} />;\n case PropertyType.Annotation:\n return <>{value?.text}</>;\n case PropertyType.Attachment:\n return <AttachmentDisplay value={value} maxWidth={props.maxWidth} />;\n case PropertyType.CodeableConcept:\n return <CodeableConceptDisplay value={value} />;\n case PropertyType.Coding:\n return <CodingDisplay value={value} />;\n case PropertyType.ContactDetail:\n return <ContactDetailDisplay value={value} />;\n case PropertyType.ContactPoint:\n return <ContactPointDisplay value={value} />;\n case PropertyType.HumanName:\n return <HumanNameDisplay value={value} />;\n case PropertyType.Identifier:\n return <IdentifierDisplay value={value} />;\n case PropertyType.Money:\n return <MoneyDisplay value={value} />;\n case PropertyType.Period:\n return <>{formatPeriod(value)}</>;\n case PropertyType.Quantity:\n case PropertyType.Duration:\n return <QuantityDisplay value={value} />;\n case PropertyType.Range:\n return <RangeDisplay value={value} />;\n case PropertyType.Ratio:\n return <RatioDisplay value={value} />;\n case PropertyType.Reference:\n return <ReferenceDisplay value={value} link={props.link} />;\n case PropertyType.Timing:\n return <>{formatTiming(value)}</>;\n case PropertyType.Dosage:\n case PropertyType.UsageContext:\n return (\n <BackboneElementDisplay\n value={{ type: propertyType, value }}\n compact={true}\n ignoreMissingValues={props.ignoreMissingValues}\n />\n );\n default:\n if (!property?.path) {\n throw Error(`Displaying property of type ${props.propertyType} requires element definition path`);\n }\n return (\n <BackboneElementDisplay\n value={{ type: getElementDefinitionTypeName(property), value }}\n compact={true}\n ignoreMissingValues={props.ignoreMissingValues}\n />\n );\n }\n}\n\n/**\n * Returns the value of the property and the property type.\n * Some property definitions support multiple types.\n * For example, \"Observation.value[x]\" can be \"valueString\", \"valueInteger\", \"valueQuantity\", etc.\n * According to the spec, there can only be one property for a given element definition.\n * This function returns the value and the type.\n * @param context The base context (usually a FHIR resource).\n * @param property The property definition.\n * @returns The value of the property and the property type.\n */\nexport function getValueAndType(context: TypedValue, path: string): [any, PropertyType] {\n const typedResult = getTypedPropertyValue(context, path);\n if (!typedResult) {\n return [undefined, 'undefined' as PropertyType];\n }\n\n if (Array.isArray(typedResult)) {\n return [typedResult.map((e) => e.value), typedResult[0].type as PropertyType];\n }\n\n return [typedResult.value, typedResult.type as PropertyType];\n}\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;AAsCM,SAAU,uBAAuB,CAAC,KAAmC,EAAA;IACzE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAEhD,IAAI,QAAQ,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE;QAChD,IAAI,YAAY,KAAK,YAAY,EAAE;AACjC,YAAA,OAAOA,UAAC,CAAA,aAAA,CAAA,sBAAsB,EAAC,EAAA,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAAI,CAAC;AAC5E,SAAA;QACD,QACEA,UAAC,CAAA,aAAA,CAAA,oBAAoB,EACnB,EAAA,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,KAAK,EACb,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,EAC9C,IAAI,EAAE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,EAAE,IAAI,CAAC,CAAC;IACzD,IAAI,CAAC,WAAW,EAAE;AAChB,QAAA,OAAO,CAAC,SAAS,EAAE,WAA2B,CAAC,CAAC;AACjD,KAAA;AAED,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;QAC9B,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,IAAoB,CAAC,CAAC;AAC/E,KAAA;IAED,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,IAAoB,CAAC,CAAC;AAC/D;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Group, NativeSelect, Textarea, Checkbox, TextInput } from '@mantine/core';
|
|
2
|
-
import { capitalize,
|
|
3
|
-
import
|
|
2
|
+
import { capitalize, getElementDefinitionTypeName, PropertyType } from '@medplum/core';
|
|
3
|
+
import e__default, { useState } from 'react';
|
|
4
4
|
import { AddressInput } from '../AddressInput/AddressInput.mjs';
|
|
5
5
|
import { AnnotationInput } from '../AnnotationInput/AnnotationInput.mjs';
|
|
6
6
|
import { AttachmentArrayInput } from '../AttachmentArrayInput/AttachmentArrayInput.mjs';
|
|
@@ -32,16 +32,16 @@ function ResourcePropertyInput(props) {
|
|
|
32
32
|
const value = props.defaultValue;
|
|
33
33
|
if (property.max === '*' && !props.arrayElement) {
|
|
34
34
|
if (propertyType === 'Attachment') {
|
|
35
|
-
return
|
|
35
|
+
return e__default.createElement(AttachmentArrayInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
36
36
|
}
|
|
37
|
-
return
|
|
37
|
+
return e__default.createElement(ResourceArrayInput, { property: property, name: name, defaultValue: value, onChange: props.onChange });
|
|
38
38
|
}
|
|
39
39
|
const propertyTypes = property.type;
|
|
40
40
|
if (propertyTypes.length > 1) {
|
|
41
|
-
return
|
|
41
|
+
return e__default.createElement(ElementDefinitionInputSelector, { elementDefinitionTypes: propertyTypes, ...props });
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
|
-
return
|
|
44
|
+
return e__default.createElement(ElementDefinitionTypeInput, { elementDefinitionType: propertyTypes[0], ...props });
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
function ElementDefinitionInputSelector(props) {
|
|
@@ -54,14 +54,14 @@ function ElementDefinitionInputSelector(props) {
|
|
|
54
54
|
initialPropertyType = propertyTypes[0];
|
|
55
55
|
}
|
|
56
56
|
const [selectedType, setSelectedType] = useState(initialPropertyType);
|
|
57
|
-
return (
|
|
58
|
-
|
|
57
|
+
return (e__default.createElement(Group, { spacing: "xs", grow: true, noWrap: true },
|
|
58
|
+
e__default.createElement(NativeSelect, { style: { width: '200px' }, defaultValue: selectedType?.code, onChange: (e) => {
|
|
59
59
|
setSelectedType(propertyTypes.find((type) => type.code === e.currentTarget.value));
|
|
60
60
|
}, data: propertyTypes.map((type) => ({
|
|
61
61
|
value: type.code,
|
|
62
62
|
label: type.code,
|
|
63
63
|
})) }),
|
|
64
|
-
|
|
64
|
+
e__default.createElement(ElementDefinitionTypeInput, { ...props, elementDefinitionType: selectedType, onChange: (newValue) => {
|
|
65
65
|
if (props.onChange) {
|
|
66
66
|
props.onChange(newValue, props.name.replace('[x]', capitalize(selectedType.code)));
|
|
67
67
|
}
|
|
@@ -81,39 +81,39 @@ function ElementDefinitionTypeInput(props) {
|
|
|
81
81
|
case PropertyType.time:
|
|
82
82
|
case PropertyType.uri:
|
|
83
83
|
case PropertyType.url:
|
|
84
|
-
return (
|
|
84
|
+
return (e__default.createElement(TextInput, { id: name, name: name, "data-testid": name, defaultValue: value, onChange: (e) => {
|
|
85
85
|
if (props.onChange) {
|
|
86
86
|
props.onChange(e.currentTarget.value);
|
|
87
87
|
}
|
|
88
88
|
}, error: getErrorsForInput(props.outcome, name) }));
|
|
89
89
|
case PropertyType.date:
|
|
90
|
-
return (
|
|
90
|
+
return (e__default.createElement(TextInput, { type: "date", id: name, name: name, "data-testid": name, defaultValue: value, onChange: (e) => {
|
|
91
91
|
if (props.onChange) {
|
|
92
92
|
props.onChange(e.currentTarget.value);
|
|
93
93
|
}
|
|
94
94
|
}, error: getErrorsForInput(props.outcome, name) }));
|
|
95
95
|
case PropertyType.dateTime:
|
|
96
96
|
case PropertyType.instant:
|
|
97
|
-
return
|
|
97
|
+
return e__default.createElement(DateTimeInput, { name: name, defaultValue: value, onChange: props.onChange, outcome: props.outcome });
|
|
98
98
|
case PropertyType.decimal:
|
|
99
99
|
case PropertyType.integer:
|
|
100
100
|
case PropertyType.positiveInt:
|
|
101
101
|
case PropertyType.unsignedInt:
|
|
102
|
-
return (
|
|
102
|
+
return (e__default.createElement(TextInput, { type: "number", step: propertyType === PropertyType.decimal ? 'any' : '1', id: name, name: name, "data-testid": name, defaultValue: value, onChange: (e) => {
|
|
103
103
|
if (props.onChange) {
|
|
104
104
|
props.onChange(e.currentTarget.valueAsNumber);
|
|
105
105
|
}
|
|
106
106
|
} }));
|
|
107
107
|
case PropertyType.code:
|
|
108
|
-
return
|
|
108
|
+
return e__default.createElement(CodeInput, { property: property, name: name, defaultValue: value, onChange: props.onChange });
|
|
109
109
|
case PropertyType.boolean:
|
|
110
|
-
return (
|
|
110
|
+
return (e__default.createElement(Checkbox, { id: name, name: name, "data-testid": name, defaultChecked: !!value, onChange: (e) => {
|
|
111
111
|
if (props.onChange) {
|
|
112
112
|
props.onChange(e.currentTarget.checked);
|
|
113
113
|
}
|
|
114
114
|
} }));
|
|
115
115
|
case PropertyType.markdown:
|
|
116
|
-
return (
|
|
116
|
+
return (e__default.createElement(Textarea, { id: name, name: name, "data-testid": name, defaultValue: value, onChange: (e) => {
|
|
117
117
|
if (props.onChange) {
|
|
118
118
|
props.onChange(e.currentTarget.value);
|
|
119
119
|
}
|
|
@@ -121,45 +121,45 @@ function ElementDefinitionTypeInput(props) {
|
|
|
121
121
|
// 2.24.0.2 Complex Types
|
|
122
122
|
// https://www.hl7.org/fhir/datatypes.html#complex
|
|
123
123
|
case PropertyType.Address:
|
|
124
|
-
return
|
|
124
|
+
return e__default.createElement(AddressInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
125
125
|
case PropertyType.Annotation:
|
|
126
|
-
return
|
|
126
|
+
return e__default.createElement(AnnotationInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
127
127
|
case PropertyType.Attachment:
|
|
128
|
-
return
|
|
128
|
+
return e__default.createElement(AttachmentInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
129
129
|
case PropertyType.CodeableConcept:
|
|
130
|
-
return
|
|
130
|
+
return e__default.createElement(CodeableConceptInput, { property: property, name: name, defaultValue: value, onChange: props.onChange });
|
|
131
131
|
case PropertyType.Coding:
|
|
132
|
-
return
|
|
132
|
+
return e__default.createElement(CodingInput, { property: property, name: name, defaultValue: value, onChange: props.onChange });
|
|
133
133
|
case PropertyType.ContactDetail:
|
|
134
|
-
return
|
|
134
|
+
return e__default.createElement(ContactDetailInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
135
135
|
case PropertyType.ContactPoint:
|
|
136
|
-
return
|
|
136
|
+
return e__default.createElement(ContactPointInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
137
137
|
case PropertyType.Extension:
|
|
138
|
-
return
|
|
138
|
+
return e__default.createElement(ExtensionInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
139
139
|
case PropertyType.HumanName:
|
|
140
|
-
return
|
|
140
|
+
return e__default.createElement(HumanNameInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
141
141
|
case PropertyType.Identifier:
|
|
142
|
-
return
|
|
142
|
+
return e__default.createElement(IdentifierInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
143
143
|
case PropertyType.Money:
|
|
144
|
-
return
|
|
144
|
+
return e__default.createElement(MoneyInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
145
145
|
case PropertyType.Period:
|
|
146
|
-
return
|
|
146
|
+
return e__default.createElement(PeriodInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
147
147
|
case PropertyType.Duration:
|
|
148
148
|
case PropertyType.Quantity:
|
|
149
|
-
return
|
|
149
|
+
return e__default.createElement(QuantityInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
150
150
|
case PropertyType.Range:
|
|
151
|
-
return
|
|
151
|
+
return e__default.createElement(RangeInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
152
152
|
case PropertyType.Ratio:
|
|
153
|
-
return
|
|
153
|
+
return e__default.createElement(RatioInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
154
154
|
case PropertyType.Reference:
|
|
155
|
-
return (
|
|
155
|
+
return (e__default.createElement(ReferenceInput, { name: name, defaultValue: value, targetTypes: getTargetTypes(property), onChange: props.onChange }));
|
|
156
156
|
case PropertyType.Timing:
|
|
157
|
-
return
|
|
157
|
+
return e__default.createElement(TimingInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
158
158
|
case PropertyType.Dosage:
|
|
159
159
|
case PropertyType.UsageContext:
|
|
160
|
-
return (
|
|
160
|
+
return (e__default.createElement(BackboneElementInput, { typeName: propertyType, defaultValue: value, onChange: props.onChange, outcome: props.outcome }));
|
|
161
161
|
default:
|
|
162
|
-
return (
|
|
162
|
+
return (e__default.createElement(BackboneElementInput, { typeName: getElementDefinitionTypeName(property), defaultValue: value, onChange: props.onChange, outcome: props.outcome }));
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
function getTargetTypes(property) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourcePropertyInput.mjs","sources":["../../../src/ResourcePropertyInput/ResourcePropertyInput.tsx"],"sourcesContent":["import { Checkbox, Group, NativeSelect, Textarea, TextInput } from '@mantine/core';\nimport { buildTypeName, capitalize, PropertyType } from '@medplum/core';\nimport { ElementDefinition, ElementDefinitionType, OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { AddressInput } from '../AddressInput/AddressInput';\nimport { AnnotationInput } from '../AnnotationInput/AnnotationInput';\nimport { AttachmentArrayInput } from '../AttachmentArrayInput/AttachmentArrayInput';\nimport { AttachmentInput } from '../AttachmentInput/AttachmentInput';\nimport { BackboneElementInput } from '../BackboneElementInput/BackboneElementInput';\nimport { CodeableConceptInput } from '../CodeableConceptInput/CodeableConceptInput';\nimport { CodeInput } from '../CodeInput/CodeInput';\nimport { CodingInput } from '../CodingInput/CodingInput';\nimport { ContactDetailInput } from '../ContactDetailInput/ContactDetailInput';\nimport { ContactPointInput } from '../ContactPointInput/ContactPointInput';\nimport { DateTimeInput } from '../DateTimeInput/DateTimeInput';\nimport { ExtensionInput } from '../ExtensionInput/ExtensionInput';\nimport { HumanNameInput } from '../HumanNameInput/HumanNameInput';\nimport { IdentifierInput } from '../IdentifierInput/IdentifierInput';\nimport { MoneyInput } from '../MoneyInput/MoneyInput';\nimport { PeriodInput } from '../PeriodInput/PeriodInput';\nimport { QuantityInput } from '../QuantityInput/QuantityInput';\nimport { RangeInput } from '../RangeInput/RangeInput';\nimport { RatioInput } from '../RatioInput/RatioInput';\nimport { ReferenceInput } from '../ReferenceInput/ReferenceInput';\nimport { ResourceArrayInput } from '../ResourceArrayInput/ResourceArrayInput';\nimport { TimingInput } from '../TimingInput/TimingInput';\nimport { getErrorsForInput } from '../utils/outcomes';\n\nexport interface ResourcePropertyInputProps {\n property: ElementDefinition;\n name: string;\n defaultPropertyType?: PropertyType;\n defaultValue?: any;\n arrayElement?: boolean;\n onChange?: (value: any, propName?: string) => void;\n outcome?: OperationOutcome;\n}\n\nexport function ResourcePropertyInput(props: ResourcePropertyInputProps): JSX.Element {\n const property = props.property;\n const propertyType = props.defaultPropertyType ?? (property.type?.[0]?.code as PropertyType);\n const name = props.name;\n const value = props.defaultValue;\n\n if (property.max === '*' && !props.arrayElement) {\n if (propertyType === 'Attachment') {\n return <AttachmentArrayInput name={name} defaultValue={value} onChange={props.onChange} />;\n }\n return <ResourceArrayInput property={property} name={name} defaultValue={value} onChange={props.onChange} />;\n }\n\n const propertyTypes = property.type as ElementDefinitionType[];\n if (propertyTypes.length > 1) {\n return <ElementDefinitionInputSelector elementDefinitionTypes={propertyTypes} {...props} />;\n } else {\n return <ElementDefinitionTypeInput elementDefinitionType={propertyTypes[0]} {...props} />;\n }\n}\n\nexport interface ElementDefinitionSelectorProps extends ResourcePropertyInputProps {\n elementDefinitionTypes: ElementDefinitionType[];\n}\n\nexport function ElementDefinitionInputSelector(props: ElementDefinitionSelectorProps): JSX.Element {\n const propertyTypes = props.elementDefinitionTypes;\n let initialPropertyType: ElementDefinitionType | undefined = undefined;\n if (props.defaultPropertyType) {\n initialPropertyType = propertyTypes.find((t) => t.code === props.defaultPropertyType) as ElementDefinitionType;\n }\n if (!initialPropertyType) {\n initialPropertyType = propertyTypes[0];\n }\n const [selectedType, setSelectedType] = useState(initialPropertyType);\n return (\n <Group spacing=\"xs\" grow noWrap>\n <NativeSelect\n style={{ width: '200px' }}\n defaultValue={selectedType?.code}\n onChange={(e) => {\n setSelectedType(\n propertyTypes.find(\n (type: ElementDefinitionType) => type.code === e.currentTarget.value\n ) as ElementDefinitionType\n );\n }}\n data={propertyTypes.map((type: ElementDefinitionType) => ({\n value: type.code as string,\n label: type.code as string,\n }))}\n />\n <ElementDefinitionTypeInput\n {...props}\n elementDefinitionType={selectedType}\n onChange={(newValue: any) => {\n if (props.onChange) {\n props.onChange(newValue, props.name.replace('[x]', capitalize(selectedType.code as string)));\n }\n }}\n />\n </Group>\n );\n}\n\nexport interface ElementDefinitionTypeInputProps extends ResourcePropertyInputProps {\n elementDefinitionType: ElementDefinitionType;\n}\n\nexport function ElementDefinitionTypeInput(props: ElementDefinitionTypeInputProps): JSX.Element {\n const property = props.property;\n const propertyType = props.elementDefinitionType.code as PropertyType;\n const name = props.name;\n const value = props.defaultValue;\n\n switch (propertyType) {\n // 2.24.0.1 Primitive Types\n // https://www.hl7.org/fhir/datatypes.html#primitive\n\n case PropertyType.SystemString:\n case PropertyType.canonical:\n case PropertyType.string:\n case PropertyType.time:\n case PropertyType.uri:\n case PropertyType.url:\n return (\n <TextInput\n id={name}\n name={name}\n data-testid={name}\n defaultValue={value}\n onChange={(e) => {\n if (props.onChange) {\n props.onChange(e.currentTarget.value);\n }\n }}\n error={getErrorsForInput(props.outcome, name)}\n />\n );\n case PropertyType.date:\n return (\n <TextInput\n type=\"date\"\n id={name}\n name={name}\n data-testid={name}\n defaultValue={value}\n onChange={(e) => {\n if (props.onChange) {\n props.onChange(e.currentTarget.value);\n }\n }}\n error={getErrorsForInput(props.outcome, name)}\n />\n );\n case PropertyType.dateTime:\n case PropertyType.instant:\n return <DateTimeInput name={name} defaultValue={value} onChange={props.onChange} outcome={props.outcome} />;\n case PropertyType.decimal:\n case PropertyType.integer:\n case PropertyType.positiveInt:\n case PropertyType.unsignedInt:\n return (\n <TextInput\n type=\"number\"\n step={propertyType === PropertyType.decimal ? 'any' : '1'}\n id={name}\n name={name}\n data-testid={name}\n defaultValue={value}\n onChange={(e) => {\n if (props.onChange) {\n props.onChange(e.currentTarget.valueAsNumber);\n }\n }}\n />\n );\n case PropertyType.code:\n return <CodeInput property={property} name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.boolean:\n return (\n <Checkbox\n id={name}\n name={name}\n data-testid={name}\n defaultChecked={!!value}\n onChange={(e) => {\n if (props.onChange) {\n props.onChange(e.currentTarget.checked);\n }\n }}\n />\n );\n case PropertyType.markdown:\n return (\n <Textarea\n id={name}\n name={name}\n data-testid={name}\n defaultValue={value}\n onChange={(e) => {\n if (props.onChange) {\n props.onChange(e.currentTarget.value);\n }\n }}\n />\n );\n\n // 2.24.0.2 Complex Types\n // https://www.hl7.org/fhir/datatypes.html#complex\n\n case PropertyType.Address:\n return <AddressInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Annotation:\n return <AnnotationInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Attachment:\n return <AttachmentInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.CodeableConcept:\n return <CodeableConceptInput property={property} name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Coding:\n return <CodingInput property={property} name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.ContactDetail:\n return <ContactDetailInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.ContactPoint:\n return <ContactPointInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Extension:\n return <ExtensionInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.HumanName:\n return <HumanNameInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Identifier:\n return <IdentifierInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Money:\n return <MoneyInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Period:\n return <PeriodInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Duration:\n case PropertyType.Quantity:\n return <QuantityInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Range:\n return <RangeInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Ratio:\n return <RatioInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Reference:\n return (\n <ReferenceInput\n name={name}\n defaultValue={value}\n targetTypes={getTargetTypes(property)}\n onChange={props.onChange}\n />\n );\n case PropertyType.Timing:\n return <TimingInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Dosage:\n case PropertyType.UsageContext:\n return (\n <BackboneElementInput\n typeName={propertyType}\n defaultValue={value}\n onChange={props.onChange}\n outcome={props.outcome}\n />\n );\n default:\n return (\n <BackboneElementInput\n typeName={buildTypeName(property.path?.split('.') as string[])}\n defaultValue={value}\n onChange={props.onChange}\n outcome={props.outcome}\n />\n );\n }\n}\n\nfunction getTargetTypes(property?: ElementDefinition): string[] | undefined {\n return property?.type?.[0]?.targetProfile?.map((p) => p.split('/').pop() as string);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;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B,YAAA,OAAO,oBAAC,WAAW,EAAA,EAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAAI,CAAC;QACpF,KAAK,YAAY,CAAC,MAAM,CAAC;QACzB,KAAK,YAAY,CAAC,YAAY;YAC5B,QACE,KAAC,CAAA,aAAA,CAAA,oBAAoB,EACnB,EAAA,QAAQ,EAAE,YAAY,EACtB,YAAY,EAAE,KAAK,EACnB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,CAAA,EACF;AACJ,QAAA;AACE,YAAA,QACE,KAAA,CAAA,aAAA,CAAC,oBAAoB,EAAA,EACnB,QAAQ,EAAE,aAAa,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAa,CAAC,EAC9D,YAAY,EAAE,KAAK,EACnB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,OAAO,EAAE,KAAK,CAAC,OAAO,EAAA,CACtB,EACF;AACL,KAAA;AACH,CAAC;AAED,SAAS,cAAc,CAAC,QAA4B,EAAA;IAClD,OAAO,QAAQ,EAAE,IAAI,GAAG,CAAC,CAAC,EAAE,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAY,CAAC,CAAC;AACtF;;;;"}
|
|
1
|
+
{"version":3,"file":"ResourcePropertyInput.mjs","sources":["../../../src/ResourcePropertyInput/ResourcePropertyInput.tsx"],"sourcesContent":["import { Checkbox, Group, NativeSelect, Textarea, TextInput } from '@mantine/core';\nimport { capitalize, getElementDefinitionTypeName, PropertyType } from '@medplum/core';\nimport { ElementDefinition, ElementDefinitionType, OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { AddressInput } from '../AddressInput/AddressInput';\nimport { AnnotationInput } from '../AnnotationInput/AnnotationInput';\nimport { AttachmentArrayInput } from '../AttachmentArrayInput/AttachmentArrayInput';\nimport { AttachmentInput } from '../AttachmentInput/AttachmentInput';\nimport { BackboneElementInput } from '../BackboneElementInput/BackboneElementInput';\nimport { CodeableConceptInput } from '../CodeableConceptInput/CodeableConceptInput';\nimport { CodeInput } from '../CodeInput/CodeInput';\nimport { CodingInput } from '../CodingInput/CodingInput';\nimport { ContactDetailInput } from '../ContactDetailInput/ContactDetailInput';\nimport { ContactPointInput } from '../ContactPointInput/ContactPointInput';\nimport { DateTimeInput } from '../DateTimeInput/DateTimeInput';\nimport { ExtensionInput } from '../ExtensionInput/ExtensionInput';\nimport { HumanNameInput } from '../HumanNameInput/HumanNameInput';\nimport { IdentifierInput } from '../IdentifierInput/IdentifierInput';\nimport { MoneyInput } from '../MoneyInput/MoneyInput';\nimport { PeriodInput } from '../PeriodInput/PeriodInput';\nimport { QuantityInput } from '../QuantityInput/QuantityInput';\nimport { RangeInput } from '../RangeInput/RangeInput';\nimport { RatioInput } from '../RatioInput/RatioInput';\nimport { ReferenceInput } from '../ReferenceInput/ReferenceInput';\nimport { ResourceArrayInput } from '../ResourceArrayInput/ResourceArrayInput';\nimport { TimingInput } from '../TimingInput/TimingInput';\nimport { getErrorsForInput } from '../utils/outcomes';\n\nexport interface ResourcePropertyInputProps {\n property: ElementDefinition;\n name: string;\n defaultPropertyType?: PropertyType;\n defaultValue?: any;\n arrayElement?: boolean;\n onChange?: (value: any, propName?: string) => void;\n outcome?: OperationOutcome;\n}\n\nexport function ResourcePropertyInput(props: ResourcePropertyInputProps): JSX.Element {\n const property = props.property;\n const propertyType = props.defaultPropertyType ?? (property.type?.[0]?.code as PropertyType);\n const name = props.name;\n const value = props.defaultValue;\n\n if (property.max === '*' && !props.arrayElement) {\n if (propertyType === 'Attachment') {\n return <AttachmentArrayInput name={name} defaultValue={value} onChange={props.onChange} />;\n }\n return <ResourceArrayInput property={property} name={name} defaultValue={value} onChange={props.onChange} />;\n }\n\n const propertyTypes = property.type as ElementDefinitionType[];\n if (propertyTypes.length > 1) {\n return <ElementDefinitionInputSelector elementDefinitionTypes={propertyTypes} {...props} />;\n } else {\n return <ElementDefinitionTypeInput elementDefinitionType={propertyTypes[0]} {...props} />;\n }\n}\n\nexport interface ElementDefinitionSelectorProps extends ResourcePropertyInputProps {\n elementDefinitionTypes: ElementDefinitionType[];\n}\n\nexport function ElementDefinitionInputSelector(props: ElementDefinitionSelectorProps): JSX.Element {\n const propertyTypes = props.elementDefinitionTypes;\n let initialPropertyType: ElementDefinitionType | undefined = undefined;\n if (props.defaultPropertyType) {\n initialPropertyType = propertyTypes.find((t) => t.code === props.defaultPropertyType) as ElementDefinitionType;\n }\n if (!initialPropertyType) {\n initialPropertyType = propertyTypes[0];\n }\n const [selectedType, setSelectedType] = useState(initialPropertyType);\n return (\n <Group spacing=\"xs\" grow noWrap>\n <NativeSelect\n style={{ width: '200px' }}\n defaultValue={selectedType?.code}\n onChange={(e) => {\n setSelectedType(\n propertyTypes.find(\n (type: ElementDefinitionType) => type.code === e.currentTarget.value\n ) as ElementDefinitionType\n );\n }}\n data={propertyTypes.map((type: ElementDefinitionType) => ({\n value: type.code as string,\n label: type.code as string,\n }))}\n />\n <ElementDefinitionTypeInput\n {...props}\n elementDefinitionType={selectedType}\n onChange={(newValue: any) => {\n if (props.onChange) {\n props.onChange(newValue, props.name.replace('[x]', capitalize(selectedType.code as string)));\n }\n }}\n />\n </Group>\n );\n}\n\nexport interface ElementDefinitionTypeInputProps extends ResourcePropertyInputProps {\n elementDefinitionType: ElementDefinitionType;\n}\n\nexport function ElementDefinitionTypeInput(props: ElementDefinitionTypeInputProps): JSX.Element {\n const property = props.property;\n const propertyType = props.elementDefinitionType.code as PropertyType;\n const name = props.name;\n const value = props.defaultValue;\n\n switch (propertyType) {\n // 2.24.0.1 Primitive Types\n // https://www.hl7.org/fhir/datatypes.html#primitive\n\n case PropertyType.SystemString:\n case PropertyType.canonical:\n case PropertyType.string:\n case PropertyType.time:\n case PropertyType.uri:\n case PropertyType.url:\n return (\n <TextInput\n id={name}\n name={name}\n data-testid={name}\n defaultValue={value}\n onChange={(e) => {\n if (props.onChange) {\n props.onChange(e.currentTarget.value);\n }\n }}\n error={getErrorsForInput(props.outcome, name)}\n />\n );\n case PropertyType.date:\n return (\n <TextInput\n type=\"date\"\n id={name}\n name={name}\n data-testid={name}\n defaultValue={value}\n onChange={(e) => {\n if (props.onChange) {\n props.onChange(e.currentTarget.value);\n }\n }}\n error={getErrorsForInput(props.outcome, name)}\n />\n );\n case PropertyType.dateTime:\n case PropertyType.instant:\n return <DateTimeInput name={name} defaultValue={value} onChange={props.onChange} outcome={props.outcome} />;\n case PropertyType.decimal:\n case PropertyType.integer:\n case PropertyType.positiveInt:\n case PropertyType.unsignedInt:\n return (\n <TextInput\n type=\"number\"\n step={propertyType === PropertyType.decimal ? 'any' : '1'}\n id={name}\n name={name}\n data-testid={name}\n defaultValue={value}\n onChange={(e) => {\n if (props.onChange) {\n props.onChange(e.currentTarget.valueAsNumber);\n }\n }}\n />\n );\n case PropertyType.code:\n return <CodeInput property={property} name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.boolean:\n return (\n <Checkbox\n id={name}\n name={name}\n data-testid={name}\n defaultChecked={!!value}\n onChange={(e) => {\n if (props.onChange) {\n props.onChange(e.currentTarget.checked);\n }\n }}\n />\n );\n case PropertyType.markdown:\n return (\n <Textarea\n id={name}\n name={name}\n data-testid={name}\n defaultValue={value}\n onChange={(e) => {\n if (props.onChange) {\n props.onChange(e.currentTarget.value);\n }\n }}\n />\n );\n\n // 2.24.0.2 Complex Types\n // https://www.hl7.org/fhir/datatypes.html#complex\n\n case PropertyType.Address:\n return <AddressInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Annotation:\n return <AnnotationInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Attachment:\n return <AttachmentInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.CodeableConcept:\n return <CodeableConceptInput property={property} name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Coding:\n return <CodingInput property={property} name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.ContactDetail:\n return <ContactDetailInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.ContactPoint:\n return <ContactPointInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Extension:\n return <ExtensionInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.HumanName:\n return <HumanNameInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Identifier:\n return <IdentifierInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Money:\n return <MoneyInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Period:\n return <PeriodInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Duration:\n case PropertyType.Quantity:\n return <QuantityInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Range:\n return <RangeInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Ratio:\n return <RatioInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Reference:\n return (\n <ReferenceInput\n name={name}\n defaultValue={value}\n targetTypes={getTargetTypes(property)}\n onChange={props.onChange}\n />\n );\n case PropertyType.Timing:\n return <TimingInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Dosage:\n case PropertyType.UsageContext:\n return (\n <BackboneElementInput\n typeName={propertyType}\n defaultValue={value}\n onChange={props.onChange}\n outcome={props.outcome}\n />\n );\n default:\n return (\n <BackboneElementInput\n typeName={getElementDefinitionTypeName(property)}\n defaultValue={value}\n onChange={props.onChange}\n outcome={props.outcome}\n />\n );\n }\n}\n\nfunction getTargetTypes(property?: ElementDefinition): string[] | undefined {\n return property?.type?.[0]?.targetProfile?.map((p) => p.split('/').pop() as string);\n}\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCM,SAAU,qBAAqB,CAAC,KAAiC,EAAA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A,OAAOA,yBAAC,WAAW,EAAA,EAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAAI,CAAC;QACpF,KAAK,YAAY,CAAC,MAAM,CAAC;QACzB,KAAK,YAAY,CAAC,YAAY;YAC5B,QACEA,UAAC,CAAA,aAAA,CAAA,oBAAoB,EACnB,EAAA,QAAQ,EAAE,YAAY,EACtB,YAAY,EAAE,KAAK,EACnB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,CAAA,EACF;AACJ,QAAA;AACE,YAAA,QACEA,UAAA,CAAA,aAAA,CAAC,oBAAoB,EAAA,EACnB,QAAQ,EAAE,4BAA4B,CAAC,QAAQ,CAAC,EAChD,YAAY,EAAE,KAAK,EACnB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,CAAA,EACF;AACL,KAAA;AACH,CAAC;AAED,SAAS,cAAc,CAAC,QAA4B,EAAA;IAClD,OAAO,QAAQ,EAAE,IAAI,GAAG,CAAC,CAAC,EAAE,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAY,CAAC,CAAC;AACtF;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e__default, { useState, useEffect } from 'react';
|
|
2
2
|
import { BackboneElementDisplay } from '../BackboneElementDisplay/BackboneElementDisplay.mjs';
|
|
3
3
|
import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
|
|
4
4
|
import { useResource } from '../useResource/useResource.mjs';
|
|
@@ -15,7 +15,7 @@ function ResourceTable(props) {
|
|
|
15
15
|
if (!schema || !value) {
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
18
|
-
return (
|
|
18
|
+
return (e__default.createElement(BackboneElementDisplay, { value: { type: value.resourceType, value }, ignoreMissingValues: props.ignoreMissingValues }));
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export { ResourceTable };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceTable.mjs","sources":["../../../src/ResourceTable/ResourceTable.tsx"],"sourcesContent":["import { IndexedStructureDefinition } from '@medplum/core';\nimport { Reference, Resource } from '@medplum/fhirtypes';\nimport React, { useEffect, useState } from 'react';\nimport { BackboneElementDisplay } from '../BackboneElementDisplay/BackboneElementDisplay';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { useResource } from '../useResource/useResource';\n\nexport interface ResourceTableProps {\n value: Resource | Reference;\n ignoreMissingValues?: boolean;\n}\n\nexport function ResourceTable(props: ResourceTableProps): JSX.Element | null {\n const medplum = useMedplum();\n const value = useResource(props.value);\n const [schema, setSchema] = useState<IndexedStructureDefinition | undefined>();\n\n useEffect(() => {\n if (value) {\n medplum.requestSchema(value.resourceType).then(setSchema).catch(console.log);\n }\n }, [medplum, value]);\n\n if (!schema || !value) {\n return null;\n }\n\n return (\n <BackboneElementDisplay\n value={{ type: value.resourceType, value }}\n ignoreMissingValues={props.ignoreMissingValues}\n />\n );\n}\n"],"names":[],"mappings":";;;;;AAYM,SAAU,aAAa,CAAC,KAAyB,EAAA;AACrD,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,EAA0C,CAAC;IAE/E,SAAS,CAAC,MAAK;AACb,QAAA,IAAI,KAAK,EAAE;AACT,YAAA,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAC9E,SAAA;AACH,KAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAErB,IAAA,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE;AACrB,QAAA,OAAO,IAAI,CAAC;AACb,KAAA;IAED,
|
|
1
|
+
{"version":3,"file":"ResourceTable.mjs","sources":["../../../src/ResourceTable/ResourceTable.tsx"],"sourcesContent":["import { IndexedStructureDefinition } from '@medplum/core';\nimport { Reference, Resource } from '@medplum/fhirtypes';\nimport React, { useEffect, useState } from 'react';\nimport { BackboneElementDisplay } from '../BackboneElementDisplay/BackboneElementDisplay';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { useResource } from '../useResource/useResource';\n\nexport interface ResourceTableProps {\n value: Resource | Reference;\n ignoreMissingValues?: boolean;\n}\n\nexport function ResourceTable(props: ResourceTableProps): JSX.Element | null {\n const medplum = useMedplum();\n const value = useResource(props.value);\n const [schema, setSchema] = useState<IndexedStructureDefinition | undefined>();\n\n useEffect(() => {\n if (value) {\n medplum.requestSchema(value.resourceType).then(setSchema).catch(console.log);\n }\n }, [medplum, value]);\n\n if (!schema || !value) {\n return null;\n }\n\n return (\n <BackboneElementDisplay\n value={{ type: value.resourceType, value }}\n ignoreMissingValues={props.ignoreMissingValues}\n />\n );\n}\n"],"names":["React"],"mappings":";;;;;AAYM,SAAU,aAAa,CAAC,KAAyB,EAAA;AACrD,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,EAA0C,CAAC;IAE/E,SAAS,CAAC,MAAK;AACb,QAAA,IAAI,KAAK,EAAE;AACT,YAAA,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAC9E,SAAA;AACH,KAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAErB,IAAA,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE;AACrB,QAAA,OAAO,IAAI,CAAC;AACb,KAAA;IAED,QACEA,yBAAC,sBAAsB,EAAA,EACrB,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,YAAY,EAAE,KAAK,EAAE,EAC1C,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,EAC9C,CAAA,EACF;AACJ;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ProfileResource } from '@medplum/core';
|
|
2
|
+
import { MedplumClient, ProfileResource } from '@medplum/core';
|
|
3
3
|
import { Attachment, Bundle, Communication, Media, Reference, Resource } from '@medplum/fhirtypes';
|
|
4
4
|
export interface ResourceTimelineProps<T extends Resource> {
|
|
5
5
|
value: T | Reference<T>;
|
|
6
|
-
|
|
6
|
+
loadTimelineResources: (medplum: MedplumClient, resource: T) => Promise<Bundle[]>;
|
|
7
7
|
createCommunication?: (resource: T, sender: ProfileResource, text: string) => Communication;
|
|
8
8
|
createMedia?: (resource: T, operator: ProfileResource, attachment: Attachment) => Media;
|
|
9
9
|
}
|