@medplum/react 2.0.24 → 2.0.26
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/index.cjs +11 -7714
- package/dist/cjs/index.cjs.map +7 -1
- package/dist/esm/index.mjs +67 -92
- package/dist/esm/index.mjs.map +7 -1
- package/dist/types/auth/NewUserForm.d.ts +1 -0
- package/dist/types/auth/RegisterForm.d.ts +1 -0
- package/package.json +20 -20
- package/dist/cjs/index.min.cjs +0 -1
- package/dist/esm/AddressDisplay/AddressDisplay.mjs +0 -13
- package/dist/esm/AddressDisplay/AddressDisplay.mjs.map +0 -1
- package/dist/esm/AddressInput/AddressInput.mjs +0 -57
- package/dist/esm/AddressInput/AddressInput.mjs.map +0 -1
- package/dist/esm/AnnotationInput/AnnotationInput.mjs +0 -28
- package/dist/esm/AnnotationInput/AnnotationInput.mjs.map +0 -1
- package/dist/esm/AppShell/AppShell.mjs +0 -37
- package/dist/esm/AppShell/AppShell.mjs.map +0 -1
- package/dist/esm/AppShell/Header.mjs +0 -88
- package/dist/esm/AppShell/Header.mjs.map +0 -1
- package/dist/esm/AppShell/HeaderSearchInput.mjs +0 -230
- package/dist/esm/AppShell/HeaderSearchInput.mjs.map +0 -1
- package/dist/esm/AppShell/Navbar.mjs +0 -169
- package/dist/esm/AppShell/Navbar.mjs.map +0 -1
- package/dist/esm/AsyncAutocomplete/AsyncAutocomplete.mjs +0 -121
- package/dist/esm/AsyncAutocomplete/AsyncAutocomplete.mjs.map +0 -1
- package/dist/esm/AttachmentArrayDisplay/AttachmentArrayDisplay.mjs +0 -10
- package/dist/esm/AttachmentArrayDisplay/AttachmentArrayDisplay.mjs.map +0 -1
- package/dist/esm/AttachmentArrayInput/AttachmentArrayInput.mjs +0 -45
- package/dist/esm/AttachmentArrayInput/AttachmentArrayInput.mjs.map +0 -1
- package/dist/esm/AttachmentButton/AttachmentButton.mjs +0 -55
- package/dist/esm/AttachmentButton/AttachmentButton.mjs.map +0 -1
- package/dist/esm/AttachmentDisplay/AttachmentDisplay.mjs +0 -21
- package/dist/esm/AttachmentDisplay/AttachmentDisplay.mjs.map +0 -1
- package/dist/esm/AttachmentInput/AttachmentInput.mjs +0 -27
- package/dist/esm/AttachmentInput/AttachmentInput.mjs.map +0 -1
- package/dist/esm/BackboneElementDisplay/BackboneElementDisplay.mjs +0 -49
- package/dist/esm/BackboneElementDisplay/BackboneElementDisplay.mjs.map +0 -1
- package/dist/esm/BackboneElementInput/BackboneElementInput.mjs +0 -52
- package/dist/esm/BackboneElementInput/BackboneElementInput.mjs.map +0 -1
- package/dist/esm/BookmarkDialog/BookmarkDialog.mjs +0 -47
- package/dist/esm/BookmarkDialog/BookmarkDialog.mjs.map +0 -1
- package/dist/esm/CalendarInput/CalendarInput.mjs +0 -133
- package/dist/esm/CalendarInput/CalendarInput.mjs.map +0 -1
- package/dist/esm/CheckboxFormSection/CheckboxFormSection.mjs +0 -12
- package/dist/esm/CheckboxFormSection/CheckboxFormSection.mjs.map +0 -1
- package/dist/esm/CodeInput/CodeInput.mjs +0 -24
- package/dist/esm/CodeInput/CodeInput.mjs.map +0 -1
- package/dist/esm/CodeableConceptDisplay/CodeableConceptDisplay.mjs +0 -9
- package/dist/esm/CodeableConceptDisplay/CodeableConceptDisplay.mjs.map +0 -1
- package/dist/esm/CodeableConceptInput/CodeableConceptInput.mjs +0 -36
- package/dist/esm/CodeableConceptInput/CodeableConceptInput.mjs.map +0 -1
- package/dist/esm/CodingDisplay/CodingDisplay.mjs +0 -9
- package/dist/esm/CodingDisplay/CodingDisplay.mjs.map +0 -1
- package/dist/esm/CodingInput/CodingInput.mjs +0 -32
- package/dist/esm/CodingInput/CodingInput.mjs.map +0 -1
- package/dist/esm/ContactDetailDisplay/ContactDetailDisplay.mjs +0 -16
- package/dist/esm/ContactDetailDisplay/ContactDetailDisplay.mjs.map +0 -1
- package/dist/esm/ContactDetailInput/ContactDetailInput.mjs +0 -35
- package/dist/esm/ContactDetailInput/ContactDetailInput.mjs.map +0 -1
- package/dist/esm/ContactPointDisplay/ContactPointDisplay.mjs +0 -29
- package/dist/esm/ContactPointDisplay/ContactPointDisplay.mjs.map +0 -1
- package/dist/esm/ContactPointInput/ContactPointInput.mjs +0 -45
- package/dist/esm/ContactPointInput/ContactPointInput.mjs.map +0 -1
- package/dist/esm/Container/Container.mjs +0 -19
- package/dist/esm/Container/Container.mjs.map +0 -1
- package/dist/esm/DateTimeInput/DateTimeInput.mjs +0 -71
- package/dist/esm/DateTimeInput/DateTimeInput.mjs.map +0 -1
- package/dist/esm/DefaultResourceTimeline/DefaultResourceTimeline.mjs +0 -16
- package/dist/esm/DefaultResourceTimeline/DefaultResourceTimeline.mjs.map +0 -1
- package/dist/esm/DescriptionList/DescriptionList.mjs +0 -35
- package/dist/esm/DescriptionList/DescriptionList.mjs.map +0 -1
- package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.mjs +0 -172
- package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.mjs.map +0 -1
- package/dist/esm/Document/Document.mjs +0 -12
- package/dist/esm/Document/Document.mjs.map +0 -1
- package/dist/esm/EncounterTimeline/EncounterTimeline.mjs +0 -32
- package/dist/esm/EncounterTimeline/EncounterTimeline.mjs.map +0 -1
- package/dist/esm/ErrorBoundary/ErrorBoundary.mjs +0 -30
- package/dist/esm/ErrorBoundary/ErrorBoundary.mjs.map +0 -1
- package/dist/esm/ExtensionInput/ExtensionInput.mjs +0 -14
- package/dist/esm/ExtensionInput/ExtensionInput.mjs.map +0 -1
- package/dist/esm/FhirPathDisplay/FhirPathDisplay.mjs +0 -23
- package/dist/esm/FhirPathDisplay/FhirPathDisplay.mjs.map +0 -1
- package/dist/esm/FhirPathTable/FhirPathTable.mjs +0 -122
- package/dist/esm/FhirPathTable/FhirPathTable.mjs.map +0 -1
- package/dist/esm/Form/Form.mjs +0 -15
- package/dist/esm/Form/Form.mjs.map +0 -1
- package/dist/esm/Form/FormUtils.mjs +0 -50
- package/dist/esm/Form/FormUtils.mjs.map +0 -1
- package/dist/esm/FormSection/FormSection.mjs +0 -10
- package/dist/esm/FormSection/FormSection.mjs.map +0 -1
- package/dist/esm/GoogleButton/GoogleButton.mjs +0 -49
- package/dist/esm/GoogleButton/GoogleButton.mjs.map +0 -1
- package/dist/esm/HumanNameDisplay/HumanNameDisplay.mjs +0 -13
- package/dist/esm/HumanNameDisplay/HumanNameDisplay.mjs.map +0 -1
- package/dist/esm/HumanNameInput/HumanNameInput.mjs +0 -50
- package/dist/esm/HumanNameInput/HumanNameInput.mjs.map +0 -1
- package/dist/esm/IdentifierDisplay/IdentifierDisplay.mjs +0 -11
- package/dist/esm/IdentifierDisplay/IdentifierDisplay.mjs.map +0 -1
- package/dist/esm/IdentifierInput/IdentifierInput.mjs +0 -18
- package/dist/esm/IdentifierInput/IdentifierInput.mjs.map +0 -1
- package/dist/esm/Loading/Loading.mjs +0 -10
- package/dist/esm/Loading/Loading.mjs.map +0 -1
- package/dist/esm/Logo/Logo.mjs +0 -14
- package/dist/esm/Logo/Logo.mjs.map +0 -1
- package/dist/esm/MedplumLink/MedplumLink.mjs +0 -52
- package/dist/esm/MedplumLink/MedplumLink.mjs.map +0 -1
- package/dist/esm/MedplumProvider/MedplumProvider.mjs +0 -84
- package/dist/esm/MedplumProvider/MedplumProvider.mjs.map +0 -1
- package/dist/esm/MoneyDisplay/MoneyDisplay.mjs +0 -9
- package/dist/esm/MoneyDisplay/MoneyDisplay.mjs.map +0 -1
- package/dist/esm/MoneyInput/MoneyInput.mjs +0 -53
- package/dist/esm/MoneyInput/MoneyInput.mjs.map +0 -1
- package/dist/esm/NoteDisplay/NoteDisplay.mjs +0 -18
- package/dist/esm/NoteDisplay/NoteDisplay.mjs.map +0 -1
- package/dist/esm/OperationOutcomeAlert/OperationOutcomeAlert.mjs +0 -14
- package/dist/esm/OperationOutcomeAlert/OperationOutcomeAlert.mjs.map +0 -1
- package/dist/esm/Panel/Panel.mjs +0 -34
- package/dist/esm/Panel/Panel.mjs.map +0 -1
- package/dist/esm/PatientTimeline/PatientTimeline.mjs +0 -38
- package/dist/esm/PatientTimeline/PatientTimeline.mjs.map +0 -1
- package/dist/esm/PeriodInput/PeriodInput.mjs +0 -19
- package/dist/esm/PeriodInput/PeriodInput.mjs.map +0 -1
- package/dist/esm/PlanDefinitionBuilder/PlanDefinitionBuilder.mjs +0 -258
- package/dist/esm/PlanDefinitionBuilder/PlanDefinitionBuilder.mjs.map +0 -1
- package/dist/esm/QuantityDisplay/QuantityDisplay.mjs +0 -9
- package/dist/esm/QuantityDisplay/QuantityDisplay.mjs.map +0 -1
- package/dist/esm/QuantityInput/QuantityInput.mjs +0 -40
- package/dist/esm/QuantityInput/QuantityInput.mjs.map +0 -1
- package/dist/esm/QuestionnaireBuilder/QuestionnaireBuilder.mjs +0 -288
- package/dist/esm/QuestionnaireBuilder/QuestionnaireBuilder.mjs.map +0 -1
- package/dist/esm/QuestionnaireForm/QuestionnaireForm.mjs +0 -276
- package/dist/esm/QuestionnaireForm/QuestionnaireForm.mjs.map +0 -1
- package/dist/esm/RangeDisplay/RangeDisplay.mjs +0 -9
- package/dist/esm/RangeDisplay/RangeDisplay.mjs.map +0 -1
- package/dist/esm/RangeInput/RangeInput.mjs +0 -31
- package/dist/esm/RangeInput/RangeInput.mjs.map +0 -1
- package/dist/esm/RatioDisplay/RatioDisplay.mjs +0 -16
- package/dist/esm/RatioDisplay/RatioDisplay.mjs.map +0 -1
- package/dist/esm/RatioInput/RatioInput.mjs +0 -31
- package/dist/esm/RatioInput/RatioInput.mjs.map +0 -1
- package/dist/esm/ReferenceDisplay/ReferenceDisplay.mjs +0 -21
- package/dist/esm/ReferenceDisplay/ReferenceDisplay.mjs.map +0 -1
- package/dist/esm/ReferenceInput/ReferenceInput.mjs +0 -45
- package/dist/esm/ReferenceInput/ReferenceInput.mjs.map +0 -1
- package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.mjs +0 -286
- package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.mjs.map +0 -1
- package/dist/esm/RequestGroupDisplay/RequestGroupDisplay.mjs +0 -72
- package/dist/esm/RequestGroupDisplay/RequestGroupDisplay.mjs.map +0 -1
- package/dist/esm/ResourceArrayDisplay/ResourceArrayDisplay.mjs +0 -13
- package/dist/esm/ResourceArrayDisplay/ResourceArrayDisplay.mjs.map +0 -1
- package/dist/esm/ResourceArrayInput/ResourceArrayInput.mjs +0 -51
- package/dist/esm/ResourceArrayInput/ResourceArrayInput.mjs.map +0 -1
- package/dist/esm/ResourceAvatar/ResourceAvatar.mjs +0 -23
- package/dist/esm/ResourceAvatar/ResourceAvatar.mjs.map +0 -1
- package/dist/esm/ResourceBadge/ResourceBadge.mjs +0 -13
- package/dist/esm/ResourceBadge/ResourceBadge.mjs.map +0 -1
- package/dist/esm/ResourceBlame/ResourceBlame.mjs +0 -113
- package/dist/esm/ResourceBlame/ResourceBlame.mjs.map +0 -1
- package/dist/esm/ResourceDiff/ResourceDiff.mjs +0 -39
- package/dist/esm/ResourceDiff/ResourceDiff.mjs.map +0 -1
- package/dist/esm/ResourceDiffTable/ResourceDiffTable.mjs +0 -80
- package/dist/esm/ResourceDiffTable/ResourceDiffTable.mjs.map +0 -1
- package/dist/esm/ResourceForm/ResourceForm.mjs +0 -56
- package/dist/esm/ResourceForm/ResourceForm.mjs.map +0 -1
- package/dist/esm/ResourceHistoryTable/ResourceHistoryTable.mjs +0 -50
- package/dist/esm/ResourceHistoryTable/ResourceHistoryTable.mjs.map +0 -1
- package/dist/esm/ResourceInput/ResourceInput.mjs +0 -70
- package/dist/esm/ResourceInput/ResourceInput.mjs.map +0 -1
- package/dist/esm/ResourceName/ResourceName.mjs +0 -25
- package/dist/esm/ResourceName/ResourceName.mjs.map +0 -1
- package/dist/esm/ResourcePropertyDisplay/ResourcePropertyDisplay.mjs +0 -119
- package/dist/esm/ResourcePropertyDisplay/ResourcePropertyDisplay.mjs.map +0 -1
- package/dist/esm/ResourcePropertyInput/ResourcePropertyInput.mjs +0 -171
- package/dist/esm/ResourcePropertyInput/ResourcePropertyInput.mjs.map +0 -1
- package/dist/esm/ResourceTable/ResourceTable.mjs +0 -25
- package/dist/esm/ResourceTable/ResourceTable.mjs.map +0 -1
- package/dist/esm/ResourceTimeline/ResourceTimeline.mjs +0 -309
- package/dist/esm/ResourceTimeline/ResourceTimeline.mjs.map +0 -1
- package/dist/esm/Scheduler/Scheduler.mjs +0 -98
- package/dist/esm/Scheduler/Scheduler.mjs.map +0 -1
- package/dist/esm/SearchControl/SearchControl.mjs +0 -337
- package/dist/esm/SearchControl/SearchControl.mjs.map +0 -1
- package/dist/esm/SearchControl/SearchControlField.mjs +0 -95
- package/dist/esm/SearchControl/SearchControlField.mjs.map +0 -1
- package/dist/esm/SearchControl/SearchUtils.mjs +0 -497
- package/dist/esm/SearchControl/SearchUtils.mjs.map +0 -1
- package/dist/esm/SearchExportDialog/SearchExportDialog.mjs +0 -19
- package/dist/esm/SearchExportDialog/SearchExportDialog.mjs.map +0 -1
- package/dist/esm/SearchFieldEditor/SearchFieldEditor.mjs +0 -196
- package/dist/esm/SearchFieldEditor/SearchFieldEditor.mjs.map +0 -1
- package/dist/esm/SearchFilterEditor/SearchFilterEditor.mjs +0 -97
- package/dist/esm/SearchFilterEditor/SearchFilterEditor.mjs.map +0 -1
- package/dist/esm/SearchFilterValueDialog/SearchFilterValueDialog.mjs +0 -22
- package/dist/esm/SearchFilterValueDialog/SearchFilterValueDialog.mjs.map +0 -1
- package/dist/esm/SearchFilterValueDisplay/SearchFilterValueDisplay.mjs +0 -22
- package/dist/esm/SearchFilterValueDisplay/SearchFilterValueDisplay.mjs.map +0 -1
- package/dist/esm/SearchFilterValueInput/SearchFilterValueInput.mjs +0 -57
- package/dist/esm/SearchFilterValueInput/SearchFilterValueInput.mjs.map +0 -1
- package/dist/esm/SearchPopupMenu/SearchPopupMenu.mjs +0 -134
- package/dist/esm/SearchPopupMenu/SearchPopupMenu.mjs.map +0 -1
- package/dist/esm/ServiceRequestTimeline/ServiceRequestTimeline.mjs +0 -36
- package/dist/esm/ServiceRequestTimeline/ServiceRequestTimeline.mjs.map +0 -1
- package/dist/esm/StatusBadge/StatusBadge.mjs +0 -63
- package/dist/esm/StatusBadge/StatusBadge.mjs.map +0 -1
- package/dist/esm/Timeline/Timeline.mjs +0 -40
- package/dist/esm/Timeline/Timeline.mjs.map +0 -1
- package/dist/esm/TimingInput/TimingInput.mjs +0 -76
- package/dist/esm/TimingInput/TimingInput.mjs.map +0 -1
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.mjs +0 -58
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.mjs.map +0 -1
- package/dist/esm/auth/AuthenticationForm.mjs +0 -89
- package/dist/esm/auth/AuthenticationForm.mjs.map +0 -1
- package/dist/esm/auth/ChooseProfileForm.mjs +0 -33
- package/dist/esm/auth/ChooseProfileForm.mjs.map +0 -1
- package/dist/esm/auth/ChooseScopeForm.mjs +0 -28
- package/dist/esm/auth/ChooseScopeForm.mjs.map +0 -1
- package/dist/esm/auth/MfaForm.mjs +0 -34
- package/dist/esm/auth/MfaForm.mjs.map +0 -1
- package/dist/esm/auth/NewProjectForm.mjs +0 -39
- package/dist/esm/auth/NewProjectForm.mjs.map +0 -1
- package/dist/esm/auth/NewUserForm.mjs +0 -84
- package/dist/esm/auth/NewUserForm.mjs.map +0 -1
- package/dist/esm/auth/RegisterForm.mjs +0 -39
- package/dist/esm/auth/RegisterForm.mjs.map +0 -1
- package/dist/esm/auth/SignInForm.mjs +0 -100
- package/dist/esm/auth/SignInForm.mjs.map +0 -1
- package/dist/esm/constants.mjs +0 -12
- package/dist/esm/constants.mjs.map +0 -1
- package/dist/esm/index.min.mjs +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/createReactComponent.mjs +0 -70
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/createReactComponent.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.mjs +0 -18
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconAdjustmentsHorizontal.mjs +0 -25
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconAdjustmentsHorizontal.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertCircle.mjs +0 -15
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertCircle.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBleach.mjs +0 -19
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBleach.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBleachOff.mjs +0 -20
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBleachOff.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBoxMultiple.mjs +0 -26
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBoxMultiple.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBracketsContain.mjs +0 -17
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBracketsContain.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBucket.mjs +0 -20
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBucket.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBucketOff.mjs +0 -27
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBucketOff.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCalendar.mjs +0 -24
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCalendar.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.mjs +0 -13
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCheckbox.mjs +0 -20
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCheckbox.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.mjs +0 -13
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleMinus.mjs +0 -14
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleMinus.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCirclePlus.mjs +0 -15
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCirclePlus.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCloudUpload.mjs +0 -21
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCloudUpload.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconColumns.mjs +0 -20
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconColumns.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCurrencyDollar.mjs +0 -20
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCurrencyDollar.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconDots.mjs +0 -15
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconDots.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEdit.mjs +0 -27
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEdit.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEqual.mjs +0 -14
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEqual.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEqualNot.mjs +0 -15
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEqualNot.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFileAlert.mjs +0 -22
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFileAlert.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFilePlus.mjs +0 -22
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFilePlus.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFilter.mjs +0 -19
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFilter.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconListDetails.mjs +0 -30
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconListDetails.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconLogout.mjs +0 -21
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconLogout.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMathGreater.mjs +0 -13
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMathGreater.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMathLower.mjs +0 -13
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMathLower.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMessage.mjs +0 -21
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMessage.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconPin.mjs +0 -21
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconPin.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconPinnedOff.mjs +0 -22
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconPinnedOff.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconPlus.mjs +0 -14
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconPlus.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.mjs +0 -14
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSettings.mjs +0 -20
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSettings.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSortAscending.mjs +0 -17
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSortAscending.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSortDescending.mjs +0 -17
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSortDescending.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSquare.mjs +0 -19
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSquare.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSwitchHorizontal.mjs +0 -20
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSwitchHorizontal.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconTableExport.mjs +0 -23
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconTableExport.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.mjs +0 -20
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.mjs.map +0 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconX.mjs +0 -14
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconX.mjs.map +0 -1
- package/dist/esm/useResource/useResource.mjs +0 -68
- package/dist/esm/useResource/useResource.mjs.map +0 -1
- package/dist/esm/utils/blame.mjs +0 -72
- package/dist/esm/utils/blame.mjs.map +0 -1
- package/dist/esm/utils/date.mjs +0 -56
- package/dist/esm/utils/date.mjs.map +0 -1
- package/dist/esm/utils/diff.mjs +0 -118
- package/dist/esm/utils/diff.mjs.map +0 -1
- package/dist/esm/utils/dom.mjs +0 -34
- package/dist/esm/utils/dom.mjs.map +0 -1
- package/dist/esm/utils/outcomes.mjs +0 -30
- package/dist/esm/utils/outcomes.mjs.map +0 -1
- package/dist/esm/utils/questionnaire.mjs +0 -26
- package/dist/esm/utils/questionnaire.mjs.map +0 -1
- package/dist/esm/utils/recaptcha.mjs +0 -32
- package/dist/esm/utils/recaptcha.mjs.map +0 -1
- package/dist/esm/utils/script.mjs +0 -16
- package/dist/esm/utils/script.mjs.map +0 -1
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { Table } from '@mantine/core';
|
|
2
|
-
import { formatDateTime, normalizeErrorString } from '@medplum/core';
|
|
3
|
-
import React, { useState, useEffect } from 'react';
|
|
4
|
-
import { MedplumLink } from '../MedplumLink/MedplumLink.mjs';
|
|
5
|
-
import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
|
|
6
|
-
import { ResourceBadge } from '../ResourceBadge/ResourceBadge.mjs';
|
|
7
|
-
|
|
8
|
-
function ResourceHistoryTable(props) {
|
|
9
|
-
const medplum = useMedplum();
|
|
10
|
-
const [value, setValue] = useState(props.history);
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
if (!props.history && props.resourceType && props.id) {
|
|
13
|
-
medplum
|
|
14
|
-
.readHistory(props.resourceType, props.id)
|
|
15
|
-
.then(setValue)
|
|
16
|
-
.catch(console.log);
|
|
17
|
-
}
|
|
18
|
-
}, [medplum, props.history, props.resourceType, props.id]);
|
|
19
|
-
if (!value) {
|
|
20
|
-
return React.createElement("div", null, "Loading...");
|
|
21
|
-
}
|
|
22
|
-
return (React.createElement(Table, { withBorder: true, withColumnBorders: true },
|
|
23
|
-
React.createElement("thead", null,
|
|
24
|
-
React.createElement("tr", null,
|
|
25
|
-
React.createElement("th", null, "Author"),
|
|
26
|
-
React.createElement("th", null, "Date"),
|
|
27
|
-
React.createElement("th", null, "Version"))),
|
|
28
|
-
React.createElement("tbody", null, value.entry?.map((entry, index) => (React.createElement(HistoryRow, { key: 'entry-' + index, entry: entry }))))));
|
|
29
|
-
}
|
|
30
|
-
function HistoryRow(props) {
|
|
31
|
-
const { response, resource } = props.entry;
|
|
32
|
-
if (resource) {
|
|
33
|
-
return (React.createElement("tr", null,
|
|
34
|
-
React.createElement("td", null,
|
|
35
|
-
React.createElement(ResourceBadge, { value: resource.meta?.author, link: true })),
|
|
36
|
-
React.createElement("td", null, formatDateTime(resource.meta?.lastUpdated)),
|
|
37
|
-
React.createElement("td", null,
|
|
38
|
-
React.createElement(MedplumLink, { to: getVersionUrl(resource) }, resource.meta?.versionId))));
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
return (React.createElement("tr", null,
|
|
42
|
-
React.createElement("td", { colSpan: 3 }, normalizeErrorString(response?.outcome))));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function getVersionUrl(resource) {
|
|
46
|
-
return `/${resource.resourceType}/${resource.id}/_history/${resource.meta?.versionId}`;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export { ResourceHistoryTable };
|
|
50
|
-
//# sourceMappingURL=ResourceHistoryTable.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceHistoryTable.mjs","sources":["../../../src/ResourceHistoryTable/ResourceHistoryTable.tsx"],"sourcesContent":["import { Table } from '@mantine/core';\nimport { formatDateTime, normalizeErrorString } from '@medplum/core';\nimport { Bundle, BundleEntry, Resource, ResourceType } from '@medplum/fhirtypes';\nimport React, { useEffect, useState } from 'react';\nimport { MedplumLink } from '../MedplumLink/MedplumLink';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { ResourceBadge } from '../ResourceBadge/ResourceBadge';\n\nexport interface ResourceHistoryTableProps {\n history?: Bundle;\n resourceType?: string;\n id?: string;\n}\n\nexport function ResourceHistoryTable(props: ResourceHistoryTableProps): JSX.Element {\n const medplum = useMedplum();\n const [value, setValue] = useState<Bundle | undefined>(props.history);\n\n useEffect(() => {\n if (!props.history && props.resourceType && props.id) {\n medplum\n .readHistory(props.resourceType as ResourceType, props.id)\n .then(setValue)\n .catch(console.log);\n }\n }, [medplum, props.history, props.resourceType, props.id]);\n\n if (!value) {\n return <div>Loading...</div>;\n }\n\n return (\n <Table withBorder withColumnBorders>\n <thead>\n <tr>\n <th>Author</th>\n <th>Date</th>\n <th>Version</th>\n </tr>\n </thead>\n <tbody>\n {value.entry?.map((entry, index) => (\n <HistoryRow key={'entry-' + index} entry={entry} />\n ))}\n </tbody>\n </Table>\n );\n}\n\ninterface HistoryRowProps {\n entry: BundleEntry;\n}\n\nfunction HistoryRow(props: HistoryRowProps): JSX.Element {\n const { response, resource } = props.entry;\n if (resource) {\n return (\n <tr>\n <td>\n <ResourceBadge value={resource.meta?.author} link={true} />\n </td>\n <td>{formatDateTime(resource.meta?.lastUpdated)}</td>\n <td>\n <MedplumLink to={getVersionUrl(resource)}>{resource.meta?.versionId}</MedplumLink>\n </td>\n </tr>\n );\n } else {\n return (\n <tr>\n <td colSpan={3}>{normalizeErrorString(response?.outcome)}</td>\n </tr>\n );\n }\n}\n\nfunction getVersionUrl(resource: Resource): string {\n return `/${resource.resourceType}/${resource.id}/_history/${resource.meta?.versionId}`;\n}\n"],"names":[],"mappings":";;;;;;;AAcM,SAAU,oBAAoB,CAAC,KAAgC,EAAA;AACnE,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,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|
|
1
|
-
import { Group, Text, Autocomplete, Loader } from '@mantine/core';
|
|
2
|
-
import { getDisplayString } from '@medplum/core';
|
|
3
|
-
import React, { forwardRef, useState, useEffect } from 'react';
|
|
4
|
-
import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
|
|
5
|
-
import { ResourceAvatar } from '../ResourceAvatar/ResourceAvatar.mjs';
|
|
6
|
-
import { useResource } from '../useResource/useResource.mjs';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Defines which search parameters will be used by the type ahead to search for each resourceType
|
|
10
|
-
*/
|
|
11
|
-
const SEARCH_CODES = {
|
|
12
|
-
Schedule: '_id',
|
|
13
|
-
Task: '_id',
|
|
14
|
-
Patient: 'name',
|
|
15
|
-
Practitioner: 'name',
|
|
16
|
-
Questionnaire: 'name',
|
|
17
|
-
ServiceRequest: '_id',
|
|
18
|
-
DiagnosticReport: '_id',
|
|
19
|
-
Specimen: '_id',
|
|
20
|
-
Observation: 'code',
|
|
21
|
-
RequestGroup: '_id',
|
|
22
|
-
ActivityDefinition: 'name',
|
|
23
|
-
User: 'email:contains',
|
|
24
|
-
};
|
|
25
|
-
function ResourceInput(props) {
|
|
26
|
-
const medplum = useMedplum();
|
|
27
|
-
const defaultValue = useResource(props.defaultValue);
|
|
28
|
-
const [value, setValue] = useState(defaultValue ? getDisplayString(defaultValue) : '');
|
|
29
|
-
const [loading, setLoading] = useState(false);
|
|
30
|
-
const [data, setData] = useState([]);
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
if (defaultValue) {
|
|
33
|
-
setValue(getDisplayString(defaultValue));
|
|
34
|
-
}
|
|
35
|
-
}, [defaultValue, setValue]);
|
|
36
|
-
async function loadValues(input) {
|
|
37
|
-
setLoading(true);
|
|
38
|
-
const searchCode = SEARCH_CODES[props.resourceType] || 'name';
|
|
39
|
-
const searchParams = new URLSearchParams({
|
|
40
|
-
[searchCode]: input,
|
|
41
|
-
_count: '10',
|
|
42
|
-
});
|
|
43
|
-
const resources = await medplum.searchResources(props.resourceType, searchParams);
|
|
44
|
-
setData(resources.map((resource) => ({ value: getDisplayString(resource), resource })));
|
|
45
|
-
setLoading(false);
|
|
46
|
-
}
|
|
47
|
-
async function handleChange(val) {
|
|
48
|
-
setValue(val);
|
|
49
|
-
return loadValues(val);
|
|
50
|
-
}
|
|
51
|
-
function handleSelect(item) {
|
|
52
|
-
setValue(item.value);
|
|
53
|
-
setData([]);
|
|
54
|
-
if (props.onChange) {
|
|
55
|
-
props.onChange(item.resource);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return (React.createElement(Autocomplete, { name: props.name, itemComponent: ItemComponent, value: value, data: data, placeholder: props.placeholder, onFocus: () => loadValues(value), onChange: handleChange, onItemSubmit: handleSelect, rightSection: loading ? React.createElement(Loader, { size: 16 }) : null }));
|
|
59
|
-
}
|
|
60
|
-
const ItemComponent = forwardRef(({ value, resource, ...others }, ref) => {
|
|
61
|
-
return (React.createElement("div", { ref: ref, ...others },
|
|
62
|
-
React.createElement(Group, { noWrap: true },
|
|
63
|
-
React.createElement(ResourceAvatar, { value: resource }),
|
|
64
|
-
React.createElement("div", null,
|
|
65
|
-
React.createElement(Text, null, value),
|
|
66
|
-
React.createElement(Text, { size: "xs", color: "dimmed" }, resource.birthDate)))));
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
export { ResourceInput };
|
|
70
|
-
//# sourceMappingURL=ResourceInput.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceInput.mjs","sources":["../../../src/ResourceInput/ResourceInput.tsx"],"sourcesContent":["import { Autocomplete, AutocompleteItem, Group, Loader, Text } from '@mantine/core';\nimport { getDisplayString } from '@medplum/core';\nimport { Patient, Reference, Resource, ResourceType } from '@medplum/fhirtypes';\nimport React, { forwardRef, useEffect, useState } from 'react';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { ResourceAvatar } from '../ResourceAvatar/ResourceAvatar';\nimport { useResource } from '../useResource/useResource';\n\n/**\n * Defines which search parameters will be used by the type ahead to search for each resourceType\n */\nconst SEARCH_CODES: Record<string, string> = {\n Schedule: '_id',\n Task: '_id',\n Patient: 'name',\n Practitioner: 'name',\n Questionnaire: 'name',\n ServiceRequest: '_id',\n DiagnosticReport: '_id',\n Specimen: '_id',\n Observation: 'code',\n RequestGroup: '_id',\n ActivityDefinition: 'name',\n User: 'email:contains',\n};\n\nexport interface ResourceInputProps<T extends Resource = Resource> {\n readonly resourceType: ResourceType;\n readonly name: string;\n readonly defaultValue?: T | Reference<T>;\n readonly placeholder?: string;\n readonly loadOnFocus?: boolean;\n readonly onChange?: (value: T | undefined) => void;\n}\n\nexport function ResourceInput<T extends Resource = Resource>(props: ResourceInputProps<T>): JSX.Element {\n const medplum = useMedplum();\n const defaultValue = useResource(props.defaultValue);\n const [value, setValue] = useState<string>(defaultValue ? getDisplayString(defaultValue) : '');\n const [loading, setLoading] = useState(false);\n const [data, setData] = useState<AutocompleteItem[]>([]);\n\n useEffect(() => {\n if (defaultValue) {\n setValue(getDisplayString(defaultValue));\n }\n }, [defaultValue, setValue]);\n\n async function loadValues(input: string): Promise<void> {\n setLoading(true);\n const searchCode = SEARCH_CODES[props.resourceType] || 'name';\n const searchParams = new URLSearchParams({\n [searchCode]: input,\n _count: '10',\n });\n\n const resources = await medplum.searchResources(props.resourceType, searchParams);\n setData(resources.map((resource) => ({ value: getDisplayString(resource), resource })));\n setLoading(false);\n }\n\n async function handleChange(val: string): Promise<void> {\n setValue(val);\n return loadValues(val);\n }\n\n function handleSelect(item: AutocompleteItem): void {\n setValue(item.value);\n setData([]);\n if (props.onChange) {\n props.onChange(item.resource);\n }\n }\n\n return (\n <Autocomplete\n name={props.name}\n itemComponent={ItemComponent}\n value={value}\n data={data}\n placeholder={props.placeholder}\n onFocus={() => loadValues(value)}\n onChange={handleChange}\n onItemSubmit={handleSelect}\n rightSection={loading ? <Loader size={16} /> : null}\n />\n );\n}\n\nconst ItemComponent = forwardRef<HTMLDivElement, any>(({ value, resource, ...others }: any, ref) => {\n return (\n <div ref={ref} {...others}>\n <Group noWrap>\n <ResourceAvatar value={resource} />\n <div>\n <Text>{value}</Text>\n <Text size=\"xs\" color=\"dimmed\">\n {(resource as Patient).birthDate}\n </Text>\n </div>\n </Group>\n </div>\n );\n});\n"],"names":[],"mappings":";;;;;;;AAQA;;AAEG;AACH,MAAM,YAAY,GAA2B;AAC3C,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,IAAI,EAAE,KAAK;AACX,IAAA,OAAO,EAAE,MAAM;AACf,IAAA,YAAY,EAAE,MAAM;AACpB,IAAA,aAAa,EAAE,MAAM;AACrB,IAAA,cAAc,EAAE,KAAK;AACrB,IAAA,gBAAgB,EAAE,KAAK;AACvB,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,WAAW,EAAE,MAAM;AACnB,IAAA,YAAY,EAAE,KAAK;AACnB,IAAA,kBAAkB,EAAE,MAAM;AAC1B,IAAA,IAAI,EAAE,gBAAgB;CACvB,CAAC;AAWI,SAAU,aAAa,CAAgC,KAA4B,EAAA;AACvF,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,YAAY,GAAG,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACrD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAS,YAAY,GAAG,gBAAgB,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/F,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAqB,EAAE,CAAC,CAAC;IAEzD,SAAS,CAAC,MAAK;AACb,QAAA,IAAI,YAAY,EAAE;AAChB,YAAA,QAAQ,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAAC;AAC1C,SAAA;AACH,KAAC,EAAE,CAAC,YAA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C,EAChC,QAAQ,EAAE,YAAY,EACtB,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,OAAO,GAAG,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,IAAI,EAAE,EAAE,EAAI,CAAA,GAAG,IAAI,EAAA,CACnD,EACF;AACJ,CAAC;AAED,MAAM,aAAa,GAAG,UAAU,CAAsB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAO,EAAE,GAAG,KAAI;AACjG,IAAA,QACE,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,GAAG,EAAE,GAAG,KAAM,MAAM,EAAA;QACvB,KAAC,CAAA,aAAA,CAAA,KAAK,IAAC,MAAM,EAAA,IAAA,EAAA;AACX,YAAA,KAAA,CAAA,aAAA,CAAC,cAAc,EAAA,EAAC,KAAK,EAAE,QAAQ,EAAI,CAAA;AACnC,YAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA;gBACE,KAAC,CAAA,aAAA,CAAA,IAAI,EAAE,IAAA,EAAA,KAAK,CAAQ;AACpB,gBAAA,KAAA,CAAA,aAAA,CAAC,IAAI,EAAC,EAAA,IAAI,EAAC,IAAI,EAAC,KAAK,EAAC,QAAQ,EAC1B,EAAA,QAAoB,CAAC,SAAS,CAC3B,CACH,CACA,CACJ,EACN;AACJ,CAAC,CAAC;;;;"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Text } from '@mantine/core';
|
|
2
|
-
import { isOk, normalizeErrorString, getDisplayString } from '@medplum/core';
|
|
3
|
-
import React, { useState } from 'react';
|
|
4
|
-
import { MedplumLink } from '../MedplumLink/MedplumLink.mjs';
|
|
5
|
-
import { useResource } from '../useResource/useResource.mjs';
|
|
6
|
-
|
|
7
|
-
function ResourceName(props) {
|
|
8
|
-
const { value, link, ...rest } = props;
|
|
9
|
-
const [outcome, setOutcome] = useState();
|
|
10
|
-
const resource = useResource(value, setOutcome);
|
|
11
|
-
let text;
|
|
12
|
-
if (outcome && !isOk(outcome)) {
|
|
13
|
-
text = `[${normalizeErrorString(outcome)}]`;
|
|
14
|
-
}
|
|
15
|
-
else if (resource) {
|
|
16
|
-
text = getDisplayString(resource);
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
return link ? (React.createElement(MedplumLink, { to: value, ...rest }, text)) : (React.createElement(Text, { component: "span", ...rest }, text));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { ResourceName };
|
|
25
|
-
//# sourceMappingURL=ResourceName.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceName.mjs","sources":["../../../src/ResourceName/ResourceName.tsx"],"sourcesContent":["import { Text, TextProps } from '@mantine/core';\nimport { getDisplayString, isOk, normalizeErrorString } from '@medplum/core';\nimport { OperationOutcome, Reference, Resource } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { MedplumLink } from '../MedplumLink/MedplumLink';\nimport { useResource } from '../useResource/useResource';\n\nexport interface ResourceNameProps extends TextProps {\n value?: Reference | Resource;\n link?: boolean;\n}\n\nexport function ResourceName(props: ResourceNameProps): JSX.Element | null {\n const { value, link, ...rest } = props;\n const [outcome, setOutcome] = useState<OperationOutcome | undefined>();\n const resource = useResource(value, setOutcome);\n let text: string;\n\n if (outcome && !isOk(outcome)) {\n text = `[${normalizeErrorString(outcome)}]`;\n } else if (resource) {\n text = getDisplayString(resource);\n } else {\n return null;\n }\n\n return link ? (\n <MedplumLink to={value} {...rest}>\n {text}\n </MedplumLink>\n ) : (\n <Text component=\"span\" {...rest}>\n {text}\n </Text>\n );\n}\n"],"names":[],"mappings":";;;;;;AAYM,SAAU,YAAY,CAAC,KAAwB,EAAA;IACnD,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACvC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAgC,CAAC;IACvE,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AAChD,IAAA,IAAI,IAAY,CAAC;AAEjB,IAAA,IAAI,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;AAC7B,QAAA,IAAI,GAAG,CAAI,CAAA,EAAA,oBAAoB,CAAC,OAAO,CAAC,GAAG,CAAC;AAC7C,KAAA;AAAM,SAAA,IAAI,QAAQ,EAAE;AACnB,QAAA,IAAI,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;AACnC,KAAA;AAAM,SAAA;AACL,QAAA,OAAO,IAAI,CAAC;AACb,KAAA;AAED,IAAA,OAAO,IAAI,IACT,KAAC,CAAA,aAAA,CAAA,WAAW,EAAC,EAAA,EAAE,EAAE,KAAK,EAAM,GAAA,IAAI,IAC7B,IAAI,CACO,KAEd,KAAA,CAAA,aAAA,CAAC,IAAI,EAAC,EAAA,SAAS,EAAC,MAAM,KAAK,IAAI,EAAA,EAC5B,IAAI,CACA,CACR,CAAC;AACJ;;;;"}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { PropertyType, getElementDefinitionTypeName, formatTiming, formatPeriod, formatDateTime, getTypedPropertyValue } from '@medplum/core';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { AddressDisplay } from '../AddressDisplay/AddressDisplay.mjs';
|
|
4
|
-
import { AttachmentArrayDisplay } from '../AttachmentArrayDisplay/AttachmentArrayDisplay.mjs';
|
|
5
|
-
import { AttachmentDisplay } from '../AttachmentDisplay/AttachmentDisplay.mjs';
|
|
6
|
-
import { BackboneElementDisplay } from '../BackboneElementDisplay/BackboneElementDisplay.mjs';
|
|
7
|
-
import { CodeableConceptDisplay } from '../CodeableConceptDisplay/CodeableConceptDisplay.mjs';
|
|
8
|
-
import { CodingDisplay } from '../CodingDisplay/CodingDisplay.mjs';
|
|
9
|
-
import { ContactDetailDisplay } from '../ContactDetailDisplay/ContactDetailDisplay.mjs';
|
|
10
|
-
import { ContactPointDisplay } from '../ContactPointDisplay/ContactPointDisplay.mjs';
|
|
11
|
-
import { HumanNameDisplay } from '../HumanNameDisplay/HumanNameDisplay.mjs';
|
|
12
|
-
import { IdentifierDisplay } from '../IdentifierDisplay/IdentifierDisplay.mjs';
|
|
13
|
-
import { MoneyDisplay } from '../MoneyDisplay/MoneyDisplay.mjs';
|
|
14
|
-
import { QuantityDisplay } from '../QuantityDisplay/QuantityDisplay.mjs';
|
|
15
|
-
import { RangeDisplay } from '../RangeDisplay/RangeDisplay.mjs';
|
|
16
|
-
import { RatioDisplay } from '../RatioDisplay/RatioDisplay.mjs';
|
|
17
|
-
import { ReferenceDisplay } from '../ReferenceDisplay/ReferenceDisplay.mjs';
|
|
18
|
-
import { ResourceArrayDisplay } from '../ResourceArrayDisplay/ResourceArrayDisplay.mjs';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Low-level component that renders a property from a given resource, given type information.
|
|
22
|
-
* @param props The ResourcePropertyDisplay React props.
|
|
23
|
-
* @returns The ResourcePropertyDisplay React node.
|
|
24
|
-
*/
|
|
25
|
-
function ResourcePropertyDisplay(props) {
|
|
26
|
-
const { property, propertyType, value } = props;
|
|
27
|
-
if (property?.max === '*' && !props.arrayElement) {
|
|
28
|
-
if (propertyType === PropertyType.Attachment) {
|
|
29
|
-
return React.createElement(AttachmentArrayDisplay, { values: value, maxWidth: props.maxWidth });
|
|
30
|
-
}
|
|
31
|
-
return (React.createElement(ResourceArrayDisplay, { property: property, values: value, ignoreMissingValues: props.ignoreMissingValues, link: props.link }));
|
|
32
|
-
}
|
|
33
|
-
switch (propertyType) {
|
|
34
|
-
case PropertyType.boolean:
|
|
35
|
-
return React.createElement(React.Fragment, null, value === undefined ? '' : Boolean(value).toString());
|
|
36
|
-
case PropertyType.SystemString:
|
|
37
|
-
case PropertyType.string:
|
|
38
|
-
return React.createElement("div", { style: { whiteSpace: 'pre-wrap' } }, value);
|
|
39
|
-
case PropertyType.code:
|
|
40
|
-
case PropertyType.date:
|
|
41
|
-
case PropertyType.integer:
|
|
42
|
-
case PropertyType.positiveInt:
|
|
43
|
-
case PropertyType.unsignedInt:
|
|
44
|
-
case PropertyType.uri:
|
|
45
|
-
case PropertyType.url:
|
|
46
|
-
return React.createElement(React.Fragment, null, value);
|
|
47
|
-
case PropertyType.canonical:
|
|
48
|
-
return React.createElement(ReferenceDisplay, { value: { reference: value }, link: props.link });
|
|
49
|
-
case PropertyType.dateTime:
|
|
50
|
-
case PropertyType.instant:
|
|
51
|
-
return React.createElement(React.Fragment, null, formatDateTime(value));
|
|
52
|
-
case PropertyType.markdown:
|
|
53
|
-
return React.createElement("pre", null, value);
|
|
54
|
-
case PropertyType.Address:
|
|
55
|
-
return React.createElement(AddressDisplay, { value: value });
|
|
56
|
-
case PropertyType.Annotation:
|
|
57
|
-
return React.createElement(React.Fragment, null, value?.text);
|
|
58
|
-
case PropertyType.Attachment:
|
|
59
|
-
return React.createElement(AttachmentDisplay, { value: value, maxWidth: props.maxWidth });
|
|
60
|
-
case PropertyType.CodeableConcept:
|
|
61
|
-
return React.createElement(CodeableConceptDisplay, { value: value });
|
|
62
|
-
case PropertyType.Coding:
|
|
63
|
-
return React.createElement(CodingDisplay, { value: value });
|
|
64
|
-
case PropertyType.ContactDetail:
|
|
65
|
-
return React.createElement(ContactDetailDisplay, { value: value });
|
|
66
|
-
case PropertyType.ContactPoint:
|
|
67
|
-
return React.createElement(ContactPointDisplay, { value: value });
|
|
68
|
-
case PropertyType.HumanName:
|
|
69
|
-
return React.createElement(HumanNameDisplay, { value: value });
|
|
70
|
-
case PropertyType.Identifier:
|
|
71
|
-
return React.createElement(IdentifierDisplay, { value: value });
|
|
72
|
-
case PropertyType.Money:
|
|
73
|
-
return React.createElement(MoneyDisplay, { value: value });
|
|
74
|
-
case PropertyType.Period:
|
|
75
|
-
return React.createElement(React.Fragment, null, formatPeriod(value));
|
|
76
|
-
case PropertyType.Quantity:
|
|
77
|
-
case PropertyType.Duration:
|
|
78
|
-
return React.createElement(QuantityDisplay, { value: value });
|
|
79
|
-
case PropertyType.Range:
|
|
80
|
-
return React.createElement(RangeDisplay, { value: value });
|
|
81
|
-
case PropertyType.Ratio:
|
|
82
|
-
return React.createElement(RatioDisplay, { value: value });
|
|
83
|
-
case PropertyType.Reference:
|
|
84
|
-
return React.createElement(ReferenceDisplay, { value: value, link: props.link });
|
|
85
|
-
case PropertyType.Timing:
|
|
86
|
-
return React.createElement(React.Fragment, null, formatTiming(value));
|
|
87
|
-
case PropertyType.Dosage:
|
|
88
|
-
case PropertyType.UsageContext:
|
|
89
|
-
return (React.createElement(BackboneElementDisplay, { value: { type: propertyType, value }, compact: true, ignoreMissingValues: props.ignoreMissingValues }));
|
|
90
|
-
default:
|
|
91
|
-
if (!property?.path) {
|
|
92
|
-
throw Error(`Displaying property of type ${props.propertyType} requires element definition path`);
|
|
93
|
-
}
|
|
94
|
-
return (React.createElement(BackboneElementDisplay, { value: { type: getElementDefinitionTypeName(property), value }, compact: true, ignoreMissingValues: props.ignoreMissingValues }));
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Returns the value of the property and the property type.
|
|
99
|
-
* Some property definitions support multiple types.
|
|
100
|
-
* For example, "Observation.value[x]" can be "valueString", "valueInteger", "valueQuantity", etc.
|
|
101
|
-
* According to the spec, there can only be one property for a given element definition.
|
|
102
|
-
* This function returns the value and the type.
|
|
103
|
-
* @param context The base context (usually a FHIR resource).
|
|
104
|
-
* @param path The property path.
|
|
105
|
-
* @returns The value of the property and the property type.
|
|
106
|
-
*/
|
|
107
|
-
function getValueAndType(context, path) {
|
|
108
|
-
const typedResult = getTypedPropertyValue(context, path);
|
|
109
|
-
if (!typedResult) {
|
|
110
|
-
return [undefined, 'undefined'];
|
|
111
|
-
}
|
|
112
|
-
if (Array.isArray(typedResult)) {
|
|
113
|
-
return [typedResult.map((e) => e.value), typedResult[0].type];
|
|
114
|
-
}
|
|
115
|
-
return [typedResult.value, typedResult.type];
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export { ResourcePropertyDisplay, getValueAndType };
|
|
119
|
-
//# sourceMappingURL=ResourcePropertyDisplay.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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\n/**\n * Low-level component that renders a property from a given resource, given type information.\n * @param props The ResourcePropertyDisplay React props.\n * @returns The ResourcePropertyDisplay React node.\n */\nexport function ResourcePropertyDisplay(props: ResourcePropertyDisplayProps): JSX.Element {\n const { property, propertyType, value } = props;\n\n if (property?.max === '*' && !props.arrayElement) {\n if (propertyType === 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.string:\n return <div style={{ whiteSpace: 'pre-wrap' }}>{value}</div>;\n case PropertyType.code:\n case PropertyType.date:\n case PropertyType.integer:\n case PropertyType.positiveInt:\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 path The property path.\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":";;;;;;;;;;;;;;;;;;;AAsCA;;;;AAIG;AACG,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;AAChD,QAAA,IAAI,YAAY,KAAK,YAAY,CAAC,UAAU,EAAE;AAC5C,YAAA,OAAO,KAA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CAAC;AACnG,aAAA;AACD,YAAA,QACE,KAAA,CAAA,aAAA,CAAC,sBAAsB,EAAA,EACrB,KAAK,EAAE,EAAE,IAAI,EAAE,4BAA4B,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,EAC9D,OAAO,EAAE,IAAI,EACb,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,EAC9C,CAAA,EACF;AACL,KAAA;AACH,CAAC;AAED;;;;;;;;;AASG;AACa,SAAA,eAAe,CAAC,OAAmB,EAAE,IAAY,EAAA;IAC/D,MAAM,WAAW,GAAG,qBAAqB,CAAC,OAAO,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,171 +0,0 @@
|
|
|
1
|
-
import { Group, NativeSelect, Textarea, Checkbox, TextInput } from '@mantine/core';
|
|
2
|
-
import { PropertyType, capitalize, getElementDefinitionTypeName } from '@medplum/core';
|
|
3
|
-
import React, { useState } from 'react';
|
|
4
|
-
import { AddressInput } from '../AddressInput/AddressInput.mjs';
|
|
5
|
-
import { AnnotationInput } from '../AnnotationInput/AnnotationInput.mjs';
|
|
6
|
-
import { AttachmentArrayInput } from '../AttachmentArrayInput/AttachmentArrayInput.mjs';
|
|
7
|
-
import { AttachmentInput } from '../AttachmentInput/AttachmentInput.mjs';
|
|
8
|
-
import { BackboneElementInput } from '../BackboneElementInput/BackboneElementInput.mjs';
|
|
9
|
-
import { CodeableConceptInput } from '../CodeableConceptInput/CodeableConceptInput.mjs';
|
|
10
|
-
import { CodeInput } from '../CodeInput/CodeInput.mjs';
|
|
11
|
-
import { CodingInput } from '../CodingInput/CodingInput.mjs';
|
|
12
|
-
import { ContactDetailInput } from '../ContactDetailInput/ContactDetailInput.mjs';
|
|
13
|
-
import { ContactPointInput } from '../ContactPointInput/ContactPointInput.mjs';
|
|
14
|
-
import { DateTimeInput } from '../DateTimeInput/DateTimeInput.mjs';
|
|
15
|
-
import { ExtensionInput } from '../ExtensionInput/ExtensionInput.mjs';
|
|
16
|
-
import { HumanNameInput } from '../HumanNameInput/HumanNameInput.mjs';
|
|
17
|
-
import { IdentifierInput } from '../IdentifierInput/IdentifierInput.mjs';
|
|
18
|
-
import { MoneyInput } from '../MoneyInput/MoneyInput.mjs';
|
|
19
|
-
import { PeriodInput } from '../PeriodInput/PeriodInput.mjs';
|
|
20
|
-
import { QuantityInput } from '../QuantityInput/QuantityInput.mjs';
|
|
21
|
-
import { RangeInput } from '../RangeInput/RangeInput.mjs';
|
|
22
|
-
import { RatioInput } from '../RatioInput/RatioInput.mjs';
|
|
23
|
-
import { ReferenceInput } from '../ReferenceInput/ReferenceInput.mjs';
|
|
24
|
-
import { ResourceArrayInput } from '../ResourceArrayInput/ResourceArrayInput.mjs';
|
|
25
|
-
import { TimingInput } from '../TimingInput/TimingInput.mjs';
|
|
26
|
-
import { getErrorsForInput } from '../utils/outcomes.mjs';
|
|
27
|
-
|
|
28
|
-
function ResourcePropertyInput(props) {
|
|
29
|
-
const property = props.property;
|
|
30
|
-
const propertyType = props.defaultPropertyType ?? property.type?.[0]?.code;
|
|
31
|
-
const name = props.name;
|
|
32
|
-
const value = props.defaultValue;
|
|
33
|
-
if (property.max === '*' && !props.arrayElement) {
|
|
34
|
-
if (propertyType === PropertyType.Attachment) {
|
|
35
|
-
return React.createElement(AttachmentArrayInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
36
|
-
}
|
|
37
|
-
return React.createElement(ResourceArrayInput, { property: property, name: name, defaultValue: value, onChange: props.onChange });
|
|
38
|
-
}
|
|
39
|
-
const propertyTypes = property.type;
|
|
40
|
-
if (propertyTypes.length > 1) {
|
|
41
|
-
return React.createElement(ElementDefinitionInputSelector, { elementDefinitionTypes: propertyTypes, ...props });
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
return React.createElement(ElementDefinitionTypeInput, { elementDefinitionType: propertyTypes[0], ...props });
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function ElementDefinitionInputSelector(props) {
|
|
48
|
-
const propertyTypes = props.elementDefinitionTypes;
|
|
49
|
-
let initialPropertyType = undefined;
|
|
50
|
-
if (props.defaultPropertyType) {
|
|
51
|
-
initialPropertyType = propertyTypes.find((t) => t.code === props.defaultPropertyType);
|
|
52
|
-
}
|
|
53
|
-
if (!initialPropertyType) {
|
|
54
|
-
initialPropertyType = propertyTypes[0];
|
|
55
|
-
}
|
|
56
|
-
const [selectedType, setSelectedType] = useState(initialPropertyType);
|
|
57
|
-
return (React.createElement(Group, { spacing: "xs", grow: true, noWrap: true },
|
|
58
|
-
React.createElement(NativeSelect, { style: { width: '200px' }, defaultValue: selectedType.code, onChange: (e) => {
|
|
59
|
-
setSelectedType(propertyTypes.find((type) => type.code === e.currentTarget.value));
|
|
60
|
-
}, data: propertyTypes.map((type) => ({
|
|
61
|
-
value: type.code,
|
|
62
|
-
label: type.code,
|
|
63
|
-
})) }),
|
|
64
|
-
React.createElement(ElementDefinitionTypeInput, { ...props, elementDefinitionType: selectedType, onChange: (newValue) => {
|
|
65
|
-
if (props.onChange) {
|
|
66
|
-
props.onChange(newValue, props.name.replace('[x]', capitalize(selectedType.code)));
|
|
67
|
-
}
|
|
68
|
-
} })));
|
|
69
|
-
}
|
|
70
|
-
function ElementDefinitionTypeInput(props) {
|
|
71
|
-
const property = props.property;
|
|
72
|
-
const propertyType = props.elementDefinitionType.code;
|
|
73
|
-
const name = props.name;
|
|
74
|
-
const value = props.defaultValue;
|
|
75
|
-
const required = property.min !== undefined && property.min > 0;
|
|
76
|
-
switch (propertyType) {
|
|
77
|
-
// 2.24.0.1 Primitive Types
|
|
78
|
-
// https://www.hl7.org/fhir/datatypes.html#primitive
|
|
79
|
-
case PropertyType.SystemString:
|
|
80
|
-
case PropertyType.canonical:
|
|
81
|
-
case PropertyType.string:
|
|
82
|
-
case PropertyType.time:
|
|
83
|
-
case PropertyType.uri:
|
|
84
|
-
case PropertyType.url:
|
|
85
|
-
return (React.createElement(TextInput, { id: name, name: name, "data-testid": name, defaultValue: value, required: required, onChange: (e) => {
|
|
86
|
-
if (props.onChange) {
|
|
87
|
-
props.onChange(e.currentTarget.value);
|
|
88
|
-
}
|
|
89
|
-
}, error: getErrorsForInput(props.outcome, name) }));
|
|
90
|
-
case PropertyType.date:
|
|
91
|
-
return (React.createElement(TextInput, { type: "date", id: name, name: name, "data-testid": name, defaultValue: value, required: required, onChange: (e) => {
|
|
92
|
-
if (props.onChange) {
|
|
93
|
-
props.onChange(e.currentTarget.value);
|
|
94
|
-
}
|
|
95
|
-
}, error: getErrorsForInput(props.outcome, name) }));
|
|
96
|
-
case PropertyType.dateTime:
|
|
97
|
-
case PropertyType.instant:
|
|
98
|
-
return React.createElement(DateTimeInput, { name: name, defaultValue: value, onChange: props.onChange, outcome: props.outcome });
|
|
99
|
-
case PropertyType.decimal:
|
|
100
|
-
case PropertyType.integer:
|
|
101
|
-
case PropertyType.positiveInt:
|
|
102
|
-
case PropertyType.unsignedInt:
|
|
103
|
-
return (React.createElement(TextInput, { type: "number", step: propertyType === PropertyType.decimal ? 'any' : '1', id: name, name: name, "data-testid": name, defaultValue: value, required: required, onChange: (e) => {
|
|
104
|
-
if (props.onChange) {
|
|
105
|
-
props.onChange(e.currentTarget.valueAsNumber);
|
|
106
|
-
}
|
|
107
|
-
} }));
|
|
108
|
-
case PropertyType.code:
|
|
109
|
-
return React.createElement(CodeInput, { property: property, name: name, defaultValue: value, onChange: props.onChange });
|
|
110
|
-
case PropertyType.boolean:
|
|
111
|
-
return (React.createElement(Checkbox, { id: name, name: name, "data-testid": name, defaultChecked: !!value, onChange: (e) => {
|
|
112
|
-
if (props.onChange) {
|
|
113
|
-
props.onChange(e.currentTarget.checked);
|
|
114
|
-
}
|
|
115
|
-
} }));
|
|
116
|
-
case PropertyType.markdown:
|
|
117
|
-
return (React.createElement(Textarea, { id: name, name: name, "data-testid": name, defaultValue: value, required: required, onChange: (e) => {
|
|
118
|
-
if (props.onChange) {
|
|
119
|
-
props.onChange(e.currentTarget.value);
|
|
120
|
-
}
|
|
121
|
-
} }));
|
|
122
|
-
// 2.24.0.2 Complex Types
|
|
123
|
-
// https://www.hl7.org/fhir/datatypes.html#complex
|
|
124
|
-
case PropertyType.Address:
|
|
125
|
-
return React.createElement(AddressInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
126
|
-
case PropertyType.Annotation:
|
|
127
|
-
return React.createElement(AnnotationInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
128
|
-
case PropertyType.Attachment:
|
|
129
|
-
return React.createElement(AttachmentInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
130
|
-
case PropertyType.CodeableConcept:
|
|
131
|
-
return React.createElement(CodeableConceptInput, { property: property, name: name, defaultValue: value, onChange: props.onChange });
|
|
132
|
-
case PropertyType.Coding:
|
|
133
|
-
return React.createElement(CodingInput, { property: property, name: name, defaultValue: value, onChange: props.onChange });
|
|
134
|
-
case PropertyType.ContactDetail:
|
|
135
|
-
return React.createElement(ContactDetailInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
136
|
-
case PropertyType.ContactPoint:
|
|
137
|
-
return React.createElement(ContactPointInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
138
|
-
case PropertyType.Extension:
|
|
139
|
-
return React.createElement(ExtensionInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
140
|
-
case PropertyType.HumanName:
|
|
141
|
-
return React.createElement(HumanNameInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
142
|
-
case PropertyType.Identifier:
|
|
143
|
-
return React.createElement(IdentifierInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
144
|
-
case PropertyType.Money:
|
|
145
|
-
return React.createElement(MoneyInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
146
|
-
case PropertyType.Period:
|
|
147
|
-
return React.createElement(PeriodInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
148
|
-
case PropertyType.Duration:
|
|
149
|
-
case PropertyType.Quantity:
|
|
150
|
-
return React.createElement(QuantityInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
151
|
-
case PropertyType.Range:
|
|
152
|
-
return React.createElement(RangeInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
153
|
-
case PropertyType.Ratio:
|
|
154
|
-
return React.createElement(RatioInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
155
|
-
case PropertyType.Reference:
|
|
156
|
-
return (React.createElement(ReferenceInput, { name: name, defaultValue: value, targetTypes: getTargetTypes(property), onChange: props.onChange }));
|
|
157
|
-
case PropertyType.Timing:
|
|
158
|
-
return React.createElement(TimingInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
159
|
-
case PropertyType.Dosage:
|
|
160
|
-
case PropertyType.UsageContext:
|
|
161
|
-
return (React.createElement(BackboneElementInput, { typeName: propertyType, defaultValue: value, onChange: props.onChange, outcome: props.outcome }));
|
|
162
|
-
default:
|
|
163
|
-
return (React.createElement(BackboneElementInput, { typeName: getElementDefinitionTypeName(property), defaultValue: value, onChange: props.onChange, outcome: props.outcome }));
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
function getTargetTypes(property) {
|
|
167
|
-
return property?.type?.[0]?.targetProfile?.map((p) => p.split('/').pop());
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export { ElementDefinitionInputSelector, ElementDefinitionTypeInput, ResourcePropertyInput };
|
|
171
|
-
//# sourceMappingURL=ResourcePropertyInput.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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 === 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 const required = property.min !== undefined && property.min > 0;\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 required={required}\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 required={required}\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 required={required}\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 required={required}\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":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCM,SAAU,qBAAqB,CAAC,KAAiC,EAAA;AACrE,IAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;AAChC,IAAA,MAAM,YAAY,GAAG,KAAK,CAAC,mBAAmB,IAAK,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC,EAAE,IAAqB,CAAC;AAC7F,IAAA,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;AACxB,IAAA,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC;IAEjC,IAAI,QAAQ,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE;AAC/C,QAAA,IAAI,YAAY,KAAK,YAAY,CAAC,UAAU,EAAE;AAC5C,YAAA,OAAO,oBAAC,oBAAoB,EAAA,EAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAAI,CAAC;AAC5F,SAAA;QACD,OAAO,KAAA,CAAA,aAAA,CAAC,kBAAkB,EAAC,EAAA,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAA,CAAI,CAAC;AAC9G,KAAA;AAED,IAAA,MAAM,aAAa,GAAG,QAAQ,CAAC,IAA+B,C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AAE,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,25 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { BackboneElementDisplay } from '../BackboneElementDisplay/BackboneElementDisplay.mjs';
|
|
3
|
-
import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
|
|
4
|
-
import { useResource } from '../useResource/useResource.mjs';
|
|
5
|
-
|
|
6
|
-
function ResourceTable(props) {
|
|
7
|
-
const medplum = useMedplum();
|
|
8
|
-
const value = useResource(props.value);
|
|
9
|
-
const [schema, setSchema] = useState();
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
if (value) {
|
|
12
|
-
medplum.requestSchema(value.resourceType).then(setSchema).catch(console.log);
|
|
13
|
-
}
|
|
14
|
-
}, [medplum, value]);
|
|
15
|
-
if (!schema || !value) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
return (React.createElement(BackboneElementDisplay, { value: {
|
|
19
|
-
type: value.resourceType,
|
|
20
|
-
value: props.forceUseInput ? props.value : value,
|
|
21
|
-
}, ignoreMissingValues: props.ignoreMissingValues }));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { ResourceTable };
|
|
25
|
-
//# sourceMappingURL=ResourceTable.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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 /**\n * The input value either as a resource or a reference.\n */\n value: Resource | Reference;\n\n /**\n * Optional flag to ignore missing values.\n * By default, missing values are displayed as empty strings.\n */\n ignoreMissingValues?: boolean;\n\n /**\n * Optional flag to force use the input value.\n * This is useful when you want to display a specific version of the resource,\n * and not use the latest version.\n */\n forceUseInput?: 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={{\n type: value.resourceType,\n value: props.forceUseInput ? props.value : value,\n }}\n ignoreMissingValues={props.ignoreMissingValues}\n />\n );\n}\n"],"names":[],"mappings":";;;;;AA2BM,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;AAED,IAAA,QACE,KAAA,CAAA,aAAA,CAAC,sBAAsB,EAAA,EACrB,KAAK,EAAE;YACL,IAAI,EAAE,KAAK,CAAC,YAAY;AACxB,YAAA,KAAK,EAAE,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK;AACjD,SAAA,EACD,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,EAAA,CAC9C,EACF;AACJ;;;;"}
|