@medplum/react 0.9.25 → 0.9.28
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.js +282 -152
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.min.js +1 -1
- package/dist/cjs/index.min.js.map +1 -1
- package/dist/cjs/styles.css +83 -79
- package/dist/{types → esm}/AddressDisplay.d.ts +0 -0
- package/dist/esm/AddressDisplay.js +13 -0
- package/dist/esm/AddressDisplay.js.map +1 -0
- package/dist/{types → esm}/AddressInput.d.ts +0 -0
- package/dist/esm/AddressInput.js +69 -0
- package/dist/esm/AddressInput.js.map +1 -0
- package/dist/{types → esm}/AnnotationInput.d.ts +0 -0
- package/dist/esm/AnnotationInput.js +28 -0
- package/dist/esm/AnnotationInput.js.map +1 -0
- package/dist/{types → esm}/AttachmentArrayDisplay.d.ts +0 -0
- package/dist/esm/AttachmentArrayDisplay.js +11 -0
- package/dist/esm/AttachmentArrayDisplay.js.map +1 -0
- package/dist/{types → esm}/AttachmentArrayInput.d.ts +0 -0
- package/dist/esm/AttachmentArrayInput.js +42 -0
- package/dist/esm/AttachmentArrayInput.js.map +1 -0
- package/dist/{types → esm}/AttachmentDisplay.d.ts +0 -0
- package/dist/esm/AttachmentDisplay.js +20 -0
- package/dist/esm/AttachmentDisplay.js.map +1 -0
- package/dist/{types → esm}/AttachmentInput.d.ts +0 -0
- package/dist/esm/AttachmentInput.js +27 -0
- package/dist/esm/AttachmentInput.js.map +1 -0
- package/dist/{types → esm}/Autocomplete.d.ts +1 -0
- package/dist/esm/Autocomplete.js +280 -0
- package/dist/esm/Autocomplete.js.map +1 -0
- package/dist/{types → esm}/Avatar.d.ts +0 -0
- package/dist/esm/Avatar.js +24 -0
- package/dist/esm/Avatar.js.map +1 -0
- package/dist/{types → esm}/BackboneElementDisplay.d.ts +0 -0
- package/dist/esm/BackboneElementDisplay.js +43 -0
- package/dist/esm/BackboneElementDisplay.js.map +1 -0
- package/dist/{types → esm}/BackboneElementInput.d.ts +0 -0
- package/dist/esm/BackboneElementInput.js +51 -0
- package/dist/esm/BackboneElementInput.js.map +1 -0
- package/dist/{types → esm}/Button.d.ts +0 -0
- package/dist/esm/Button.js +13 -0
- package/dist/esm/Button.js.map +1 -0
- package/dist/{types → esm}/CalendarInput.d.ts +0 -0
- package/dist/esm/CalendarInput.js +96 -0
- package/dist/esm/CalendarInput.js.map +1 -0
- package/dist/{types → esm}/Checkbox.d.ts +0 -0
- package/dist/esm/Checkbox.js +13 -0
- package/dist/esm/Checkbox.js.map +1 -0
- package/dist/{types → esm}/CheckboxFormSection.d.ts +0 -0
- package/dist/esm/CheckboxFormSection.js +12 -0
- package/dist/esm/CheckboxFormSection.js.map +1 -0
- package/dist/{types → esm}/CodeInput.d.ts +0 -0
- package/dist/esm/CodeInput.js +28 -0
- package/dist/esm/CodeInput.js.map +1 -0
- package/dist/{types → esm}/CodeableConceptDisplay.d.ts +0 -0
- package/dist/esm/CodeableConceptDisplay.js +21 -0
- package/dist/esm/CodeableConceptDisplay.js.map +1 -0
- package/dist/{types → esm}/CodeableConceptInput.d.ts +0 -0
- package/dist/esm/CodeableConceptInput.js +52 -0
- package/dist/esm/CodeableConceptInput.js.map +1 -0
- package/dist/{types → esm}/CodingDisplay.d.ts +0 -0
- package/dist/esm/CodingDisplay.js +9 -0
- package/dist/esm/CodingDisplay.js.map +1 -0
- package/dist/{types → esm}/CodingInput.d.ts +0 -0
- package/dist/esm/CodingInput.js +30 -0
- package/dist/esm/CodingInput.js.map +1 -0
- package/dist/{types → esm}/ContactDetailDisplay.d.ts +0 -0
- package/dist/esm/ContactDetailDisplay.js +17 -0
- package/dist/esm/ContactDetailDisplay.js.map +1 -0
- package/dist/{types → esm}/ContactDetailInput.d.ts +0 -0
- package/dist/esm/ContactDetailInput.js +37 -0
- package/dist/esm/ContactDetailInput.js.map +1 -0
- package/dist/{types → esm}/ContactPointDisplay.d.ts +0 -0
- package/dist/esm/ContactPointDisplay.js +29 -0
- package/dist/esm/ContactPointDisplay.js.map +1 -0
- package/dist/{types → esm}/ContactPointInput.d.ts +0 -0
- package/dist/esm/ContactPointInput.js +60 -0
- package/dist/esm/ContactPointInput.js.map +1 -0
- package/dist/{types → esm}/DateTimeInput.d.ts +0 -0
- package/dist/esm/DateTimeInput.js +60 -0
- package/dist/esm/DateTimeInput.js.map +1 -0
- package/dist/{types → esm}/DefaultResourceTimeline.d.ts +0 -0
- package/dist/esm/DefaultResourceTimeline.js +27 -0
- package/dist/esm/DefaultResourceTimeline.js.map +1 -0
- package/dist/{types → esm}/DescriptionList.d.ts +0 -0
- package/dist/esm/DescriptionList.js +13 -0
- package/dist/esm/DescriptionList.js.map +1 -0
- package/dist/{types → esm}/DiagnosticReportDisplay.d.ts +0 -0
- package/dist/esm/DiagnosticReportDisplay.js +101 -0
- package/dist/esm/DiagnosticReportDisplay.js.map +1 -0
- package/dist/{types → esm}/Dialog.d.ts +0 -0
- package/dist/esm/Dialog.js +43 -0
- package/dist/esm/Dialog.js.map +1 -0
- package/dist/{types → esm}/Document.d.ts +0 -0
- package/dist/esm/Document.js +9 -0
- package/dist/esm/Document.js.map +1 -0
- package/dist/{types → esm}/EncounterTimeline.d.ts +0 -0
- package/dist/esm/EncounterTimeline.js +47 -0
- package/dist/esm/EncounterTimeline.js.map +1 -0
- package/dist/{types → esm}/ErrorBoundary.d.ts +0 -0
- package/dist/esm/ErrorBoundary.js +27 -0
- package/dist/esm/ErrorBoundary.js.map +1 -0
- package/dist/{types → esm}/ExtensionInput.d.ts +0 -0
- package/dist/esm/ExtensionInput.js +14 -0
- package/dist/esm/ExtensionInput.js.map +1 -0
- package/dist/{types → esm}/FhirPathDisplay.d.ts +0 -0
- package/dist/esm/FhirPathDisplay.js +23 -0
- package/dist/esm/FhirPathDisplay.js.map +1 -0
- package/dist/{types → esm}/FhirPathTable.d.ts +0 -0
- package/dist/esm/FhirPathTable.js +117 -0
- package/dist/esm/FhirPathTable.js.map +1 -0
- package/dist/{types → esm}/FooterLinks.d.ts +0 -0
- package/dist/esm/FooterLinks.js +8 -0
- package/dist/esm/FooterLinks.js.map +1 -0
- package/dist/{types → esm}/Form.d.ts +0 -0
- package/dist/esm/Form.js +15 -0
- package/dist/esm/Form.js.map +1 -0
- package/dist/{types → esm}/FormSection.d.ts +0 -0
- package/dist/esm/FormSection.js +18 -0
- package/dist/esm/FormSection.js.map +1 -0
- package/dist/{types → esm}/FormUtils.d.ts +0 -0
- package/dist/esm/FormUtils.js +49 -0
- package/dist/esm/FormUtils.js.map +1 -0
- package/dist/{types → esm}/GoogleButton.d.ts +0 -0
- package/dist/esm/GoogleButton.js +48 -0
- package/dist/esm/GoogleButton.js.map +1 -0
- package/dist/{types → esm}/Header.d.ts +0 -0
- package/dist/esm/Header.js +95 -0
- package/dist/esm/Header.js.map +1 -0
- package/dist/{types → esm}/HeaderSearchInput.d.ts +0 -0
- package/dist/esm/HeaderSearchInput.js +181 -0
- package/dist/esm/HeaderSearchInput.js.map +1 -0
- package/dist/{types → esm}/HumanNameDisplay.d.ts +0 -0
- package/dist/esm/HumanNameDisplay.js +13 -0
- package/dist/esm/HumanNameDisplay.js.map +1 -0
- package/dist/{types → esm}/HumanNameInput.d.ts +0 -0
- package/dist/esm/HumanNameInput.js +49 -0
- package/dist/esm/HumanNameInput.js.map +1 -0
- package/dist/{types → esm}/IdentifierDisplay.d.ts +0 -0
- package/dist/esm/IdentifierDisplay.js +12 -0
- package/dist/esm/IdentifierDisplay.js.map +1 -0
- package/dist/{types → esm}/IdentifierInput.d.ts +0 -0
- package/dist/esm/IdentifierInput.js +19 -0
- package/dist/esm/IdentifierInput.js.map +1 -0
- package/dist/{types → esm}/Input.d.ts +0 -0
- package/dist/esm/Input.js +26 -0
- package/dist/esm/Input.js.map +1 -0
- package/dist/{types → esm}/InputRow.d.ts +0 -0
- package/dist/esm/InputRow.js +8 -0
- package/dist/esm/InputRow.js.map +1 -0
- package/dist/{types → esm}/Loading.d.ts +0 -0
- package/dist/esm/Loading.js +11 -0
- package/dist/esm/Loading.js.map +1 -0
- package/dist/{types → esm}/Logo.d.ts +0 -0
- package/dist/esm/Logo.js +14 -0
- package/dist/esm/Logo.js.map +1 -0
- package/dist/{types → esm}/MedplumLink.d.ts +0 -0
- package/dist/esm/MedplumLink.js +34 -0
- package/dist/esm/MedplumLink.js.map +1 -0
- package/dist/{types → esm}/MedplumProvider.d.ts +0 -0
- package/dist/esm/MedplumProvider.js +50 -0
- package/dist/esm/MedplumProvider.js.map +1 -0
- package/dist/{types → esm}/MenuItem.d.ts +0 -0
- package/dist/esm/MenuItem.js +8 -0
- package/dist/esm/MenuItem.js.map +1 -0
- package/dist/{types → esm}/MenuSeparator.d.ts +0 -0
- package/dist/esm/MenuSeparator.js +8 -0
- package/dist/esm/MenuSeparator.js.map +1 -0
- package/dist/{types → esm}/PatientTimeline.d.ts +0 -0
- package/dist/esm/PatientTimeline.js +40 -0
- package/dist/esm/PatientTimeline.js.map +1 -0
- package/dist/{types → esm}/PeriodInput.d.ts +0 -0
- package/dist/esm/PeriodInput.js +19 -0
- package/dist/esm/PeriodInput.js.map +1 -0
- package/dist/{types → esm}/PlanDefinitionBuilder.d.ts +0 -0
- package/dist/esm/PlanDefinitionBuilder.js +224 -0
- package/dist/esm/PlanDefinitionBuilder.js.map +1 -0
- package/dist/{types → esm}/Popup.d.ts +0 -0
- package/dist/esm/Popup.js +64 -0
- package/dist/esm/Popup.js.map +1 -0
- package/dist/{types → esm}/QuantityDisplay.d.ts +0 -0
- package/dist/esm/QuantityDisplay.js +28 -0
- package/dist/esm/QuantityDisplay.js.map +1 -0
- package/dist/{types → esm}/QuantityInput.d.ts +0 -0
- package/dist/esm/QuantityInput.js +33 -0
- package/dist/esm/QuantityInput.js.map +1 -0
- package/dist/{types → esm}/QuestionnaireBuilder.d.ts +0 -0
- package/dist/esm/QuestionnaireBuilder.js +217 -0
- package/dist/esm/QuestionnaireBuilder.js.map +1 -0
- package/dist/{types → esm}/QuestionnaireForm.d.ts +0 -0
- package/dist/esm/QuestionnaireForm.js +218 -0
- package/dist/esm/QuestionnaireForm.js.map +1 -0
- package/dist/{types → esm}/QuestionnaireUtils.d.ts +0 -0
- package/dist/esm/QuestionnaireUtils.js +103 -0
- package/dist/esm/QuestionnaireUtils.js.map +1 -0
- package/dist/{types → esm}/RangeDisplay.d.ts +0 -0
- package/dist/esm/RangeDisplay.js +21 -0
- package/dist/esm/RangeDisplay.js.map +1 -0
- package/dist/{types → esm}/RangeInput.d.ts +0 -0
- package/dist/esm/RangeInput.js +25 -0
- package/dist/esm/RangeInput.js.map +1 -0
- package/dist/{types → esm}/RatioDisplay.d.ts +0 -0
- package/dist/esm/RatioDisplay.js +16 -0
- package/dist/esm/RatioDisplay.js.map +1 -0
- package/dist/{types → esm}/RatioInput.d.ts +0 -0
- package/dist/esm/RatioInput.js +25 -0
- package/dist/esm/RatioInput.js.map +1 -0
- package/dist/{types → esm}/ReferenceDisplay.d.ts +0 -0
- package/dist/esm/ReferenceDisplay.js +21 -0
- package/dist/esm/ReferenceDisplay.js.map +1 -0
- package/dist/{types → esm}/ReferenceInput.d.ts +0 -0
- package/dist/esm/ReferenceInput.js +42 -0
- package/dist/esm/ReferenceInput.js.map +1 -0
- package/dist/{types → esm}/RegisterForm.d.ts +0 -0
- package/dist/esm/RegisterForm.js +121 -0
- package/dist/esm/RegisterForm.js.map +1 -0
- package/dist/{types → esm}/RequestGroupDisplay.d.ts +0 -0
- package/dist/esm/RequestGroupDisplay.js +72 -0
- package/dist/esm/RequestGroupDisplay.js.map +1 -0
- package/dist/{types → esm}/ResourceArrayDisplay.d.ts +0 -0
- package/dist/esm/ResourceArrayDisplay.js +14 -0
- package/dist/esm/ResourceArrayDisplay.js.map +1 -0
- package/dist/{types → esm}/ResourceArrayInput.d.ts +0 -0
- package/dist/esm/ResourceArrayInput.js +47 -0
- package/dist/esm/ResourceArrayInput.js.map +1 -0
- package/dist/{types → esm}/ResourceBadge.d.ts +0 -0
- package/dist/esm/ResourceBadge.js +13 -0
- package/dist/esm/ResourceBadge.js.map +1 -0
- package/dist/{types → esm}/ResourceBlame.d.ts +0 -0
- package/dist/esm/ResourceBlame.js +65 -0
- package/dist/esm/ResourceBlame.js.map +1 -0
- package/dist/{types → esm}/ResourceDiff.d.ts +0 -0
- package/dist/esm/ResourceDiff.js +28 -0
- package/dist/esm/ResourceDiff.js.map +1 -0
- package/dist/{types → esm}/ResourceDiffTable.d.ts +0 -0
- package/dist/esm/ResourceDiffTable.js +58 -0
- package/dist/esm/ResourceDiffTable.js.map +1 -0
- package/dist/{types → esm}/ResourceForm.d.ts +0 -0
- package/dist/esm/ResourceForm.js +55 -0
- package/dist/esm/ResourceForm.js.map +1 -0
- package/dist/{types → esm}/ResourceHistoryTable.d.ts +0 -0
- package/dist/esm/ResourceHistoryTable.js +45 -0
- package/dist/esm/ResourceHistoryTable.js.map +1 -0
- package/dist/{types → esm}/ResourceInput.d.ts +1 -0
- package/dist/esm/ResourceInput.js +41 -0
- package/dist/esm/ResourceInput.js.map +1 -0
- package/dist/{types → esm}/ResourceName.d.ts +0 -0
- package/dist/esm/ResourceName.js +16 -0
- package/dist/esm/ResourceName.js.map +1 -0
- package/dist/{types → esm}/ResourcePropertyDisplay.d.ts +0 -0
- package/dist/esm/ResourcePropertyDisplay.js +107 -0
- package/dist/esm/ResourcePropertyDisplay.js.map +1 -0
- package/dist/{types → esm}/ResourcePropertyInput.d.ts +0 -0
- package/dist/esm/ResourcePropertyInput.js +154 -0
- package/dist/esm/ResourcePropertyInput.js.map +1 -0
- package/dist/{types → esm}/ResourceTable.d.ts +0 -0
- package/dist/esm/ResourceTable.js +22 -0
- package/dist/esm/ResourceTable.js.map +1 -0
- package/dist/{types → esm}/ResourceTimeline.d.ts +0 -0
- package/dist/esm/ResourceTimeline.js +221 -0
- package/dist/esm/ResourceTimeline.js.map +1 -0
- package/dist/{types → esm}/Scheduler.d.ts +0 -0
- package/dist/esm/Scheduler.js +82 -0
- package/dist/esm/Scheduler.js.map +1 -0
- package/dist/{types → esm}/Scrollable.d.ts +0 -0
- package/dist/esm/Scrollable.js +12 -0
- package/dist/esm/Scrollable.js.map +1 -0
- package/dist/{types → esm}/SearchControl.d.ts +0 -0
- package/dist/esm/SearchControl.js +268 -0
- package/dist/esm/SearchControl.js.map +1 -0
- package/dist/{types → esm}/SearchControlField.d.ts +0 -0
- package/dist/esm/SearchControlField.js +98 -0
- package/dist/esm/SearchControlField.js.map +1 -0
- package/dist/{types → esm}/SearchFieldEditor.d.ts +0 -0
- package/dist/esm/SearchFieldEditor.js +192 -0
- package/dist/esm/SearchFieldEditor.js.map +1 -0
- package/dist/{types → esm}/SearchFilterEditor.d.ts +0 -0
- package/dist/esm/SearchFilterEditor.js +103 -0
- package/dist/esm/SearchFilterEditor.js.map +1 -0
- package/dist/{types → esm}/SearchFilterValueDialog.d.ts +0 -0
- package/dist/esm/SearchFilterValueDialog.js +22 -0
- package/dist/esm/SearchFilterValueDialog.js.map +1 -0
- package/dist/{types → esm}/SearchFilterValueDisplay.d.ts +0 -0
- package/dist/esm/SearchFilterValueDisplay.js +22 -0
- package/dist/esm/SearchFilterValueDisplay.js.map +1 -0
- package/dist/{types → esm}/SearchFilterValueInput.d.ts +0 -0
- package/dist/esm/SearchFilterValueInput.js +59 -0
- package/dist/esm/SearchFilterValueInput.js.map +1 -0
- package/dist/{types → esm}/SearchPopupMenu.d.ts +0 -0
- package/dist/esm/SearchPopupMenu.js +135 -0
- package/dist/esm/SearchPopupMenu.js.map +1 -0
- package/dist/{types → esm}/SearchUtils.d.ts +0 -0
- package/dist/esm/SearchUtils.js +487 -0
- package/dist/esm/SearchUtils.js.map +1 -0
- package/dist/{types → esm}/Select.d.ts +0 -0
- package/dist/esm/Select.js +16 -0
- package/dist/esm/Select.js.map +1 -0
- package/dist/{types → esm}/ServiceRequestTimeline.d.ts +0 -0
- package/dist/esm/ServiceRequestTimeline.js +53 -0
- package/dist/esm/ServiceRequestTimeline.js.map +1 -0
- package/dist/{types → esm}/SignInForm.d.ts +0 -0
- package/dist/esm/SignInForm.js +130 -0
- package/dist/esm/SignInForm.js.map +1 -0
- package/dist/{types → esm}/StatusBadge.d.ts +0 -0
- package/dist/esm/StatusBadge.js +8 -0
- package/dist/esm/StatusBadge.js.map +1 -0
- package/dist/{types → esm}/SubMenu.d.ts +0 -0
- package/dist/esm/SubMenu.js +38 -0
- package/dist/esm/SubMenu.js.map +1 -0
- package/dist/{types → esm}/Tab.d.ts +0 -0
- package/dist/esm/Tab.js +19 -0
- package/dist/esm/Tab.js.map +1 -0
- package/dist/{types → esm}/TabList.d.ts +0 -0
- package/dist/esm/TabList.js +23 -0
- package/dist/esm/TabList.js.map +1 -0
- package/dist/{types → esm}/TabPanel.d.ts +0 -0
- package/dist/esm/TabPanel.js +8 -0
- package/dist/esm/TabPanel.js.map +1 -0
- package/dist/{types → esm}/TabSwitch.d.ts +0 -0
- package/dist/esm/TabSwitch.js +16 -0
- package/dist/esm/TabSwitch.js.map +1 -0
- package/dist/{types → esm}/TextArea.d.ts +0 -0
- package/dist/esm/TextArea.js +16 -0
- package/dist/esm/TextArea.js.map +1 -0
- package/dist/{types → esm}/Timeline.d.ts +0 -0
- package/dist/esm/Timeline.js +48 -0
- package/dist/esm/Timeline.js.map +1 -0
- package/dist/esm/TimingInput.d.ts +8 -0
- package/dist/esm/TimingInput.js +90 -0
- package/dist/esm/TimingInput.js.map +1 -0
- package/dist/{types → esm}/TitleBar.d.ts +0 -0
- package/dist/esm/TitleBar.js +8 -0
- package/dist/esm/TitleBar.js.map +1 -0
- package/dist/{types → esm}/UploadButton.d.ts +0 -0
- package/dist/esm/UploadButton.js +55 -0
- package/dist/esm/UploadButton.js.map +1 -0
- package/dist/{types → esm}/constants.d.ts +0 -0
- package/dist/esm/constants.js +12 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/{types → esm}/index.d.ts +0 -1
- package/dist/esm/index.js +86 -5814
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +1 -1
- package/dist/esm/index.min.js.map +1 -1
- package/dist/esm/node_modules/tslib/tslib.es6.js +27 -0
- package/dist/esm/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/{types → esm}/stories/AddressInput.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/AttachmentArrayInput.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/AttachmentInput.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/Autocomplete.stories.d.ts +1 -0
- package/dist/{types → esm}/stories/Avatar.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/Button.stories.d.ts +0 -0
- package/dist/esm/stories/CodeableConceptDisplay.stories.d.ts +8 -0
- package/dist/{types → esm}/stories/DiagnosticReportDisplay.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/Dialog.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/EncounterTimeline.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/FhirPathDisplay.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/FormSection.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/Header.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/Input.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/Loading.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/Logo.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/PatientTimeline.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/PlanDefinitionBuilder.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/QuestionnaireBuilder.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/QuestionnaireForm.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/ReferenceInput.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/RegisterForm.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/RequestGroupDisplay.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/ResourceBlame.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/ResourceForm.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/ResourceHistoryTable.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/ResourceTable.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/Scheduler.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/SearchControl.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/Select.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/SignInForm.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/StatusBadge.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/Tabs.stories.d.ts +0 -0
- package/dist/{types → esm}/stories/Timeline.stories.d.ts +0 -0
- package/dist/esm/stories/TimingInput.stories.d.ts +6 -0
- package/dist/{types → esm}/stories/UploadButton.stories.d.ts +0 -0
- package/dist/esm/styles.css +83 -79
- package/dist/{types → esm}/test.setup.d.ts +0 -0
- package/dist/{types → esm}/useResource.d.ts +0 -0
- package/dist/esm/useResource.js +65 -0
- package/dist/esm/useResource.js.map +1 -0
- package/dist/{types → esm}/utils/blame.d.ts +0 -0
- package/dist/esm/utils/blame.js +74 -0
- package/dist/esm/utils/blame.js.map +1 -0
- package/dist/{types → esm}/utils/date.d.ts +0 -0
- package/dist/esm/utils/date.js +48 -0
- package/dist/esm/utils/date.js.map +1 -0
- package/dist/{types → esm}/utils/diff.d.ts +0 -0
- package/dist/esm/utils/diff.js +118 -0
- package/dist/esm/utils/diff.js.map +1 -0
- package/dist/{types → esm}/utils/dom.d.ts +0 -0
- package/dist/esm/utils/dom.js +34 -0
- package/dist/esm/utils/dom.js.map +1 -0
- package/dist/{types → esm}/utils/outcomes.d.ts +0 -0
- package/dist/esm/utils/outcomes.js +7 -0
- package/dist/esm/utils/outcomes.js.map +1 -0
- package/dist/{types → esm}/utils/recaptcha.d.ts +0 -0
- package/dist/esm/utils/recaptcha.js +27 -0
- package/dist/esm/utils/recaptcha.js.map +1 -0
- package/dist/{types → esm}/utils.d.ts +0 -0
- package/dist/esm/utils.js +15 -0
- package/dist/esm/utils.js.map +1 -0
- package/package.json +7 -7
- package/stats.html +4034 -0
- package/dist/types/DateTimeDisplay.d.ts +0 -5
- package/dist/types/PeriodDisplay.d.ts +0 -6
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { capitalize } from '@medplum/core';
|
|
2
|
+
import React, { useState, useEffect } from 'react';
|
|
3
|
+
import { BackboneElementInput } from './BackboneElementInput.js';
|
|
4
|
+
import { Button } from './Button.js';
|
|
5
|
+
import { FormSection } from './FormSection.js';
|
|
6
|
+
import { Input } from './Input.js';
|
|
7
|
+
import { useMedplum } from './MedplumProvider.js';
|
|
8
|
+
import { useResource } from './useResource.js';
|
|
9
|
+
|
|
10
|
+
function ResourceForm(props) {
|
|
11
|
+
const medplum = useMedplum();
|
|
12
|
+
const defaultValue = useResource(props.defaultValue);
|
|
13
|
+
const [schema, setSchema] = useState();
|
|
14
|
+
const [value, setValue] = useState();
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (defaultValue) {
|
|
17
|
+
setValue(JSON.parse(JSON.stringify(defaultValue)));
|
|
18
|
+
medplum.requestSchema(defaultValue.resourceType).then(setSchema);
|
|
19
|
+
}
|
|
20
|
+
}, [medplum, defaultValue]);
|
|
21
|
+
if (!schema || !value) {
|
|
22
|
+
return React.createElement("div", null, "Loading...");
|
|
23
|
+
}
|
|
24
|
+
return (React.createElement("form", { noValidate: true, autoComplete: "off", onSubmit: (e) => {
|
|
25
|
+
e.preventDefault();
|
|
26
|
+
if (props.onSubmit) {
|
|
27
|
+
props.onSubmit(value);
|
|
28
|
+
}
|
|
29
|
+
} },
|
|
30
|
+
React.createElement(FormSection, { title: "Resource Type" },
|
|
31
|
+
React.createElement(Input, { name: "resourceType", defaultValue: value.resourceType, disabled: true })),
|
|
32
|
+
React.createElement(FormSection, { title: "ID" },
|
|
33
|
+
React.createElement(Input, { name: "id", defaultValue: value.id, disabled: true })),
|
|
34
|
+
React.createElement(BackboneElementInput, { typeName: value.resourceType, defaultValue: value, outcome: props.outcome, onChange: setValue }),
|
|
35
|
+
React.createElement(Button, { type: "submit", size: "large" }, "OK"),
|
|
36
|
+
props.onDelete && (React.createElement(Button, { type: "button", size: "large", onClick: () => {
|
|
37
|
+
props.onDelete(value);
|
|
38
|
+
} }, "Delete"))));
|
|
39
|
+
}
|
|
40
|
+
function setPropertyValue(obj, key, propName, elementDefinition, value) {
|
|
41
|
+
const types = elementDefinition.type;
|
|
42
|
+
if (types.length > 1) {
|
|
43
|
+
for (const type of types) {
|
|
44
|
+
const compoundKey = key.replace('[x]', capitalize(type.code));
|
|
45
|
+
if (compoundKey in obj) {
|
|
46
|
+
delete obj[compoundKey];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
obj[propName] = value;
|
|
51
|
+
return obj;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { ResourceForm, setPropertyValue };
|
|
55
|
+
//# sourceMappingURL=ResourceForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResourceForm.js","sources":["../../src/ResourceForm.tsx"],"sourcesContent":["import { capitalize, IndexedStructureDefinition } from '@medplum/core';\nimport { ElementDefinition, ElementDefinitionType, OperationOutcome, Reference, Resource } from '@medplum/fhirtypes';\nimport React, { useEffect, useState } from 'react';\nimport { BackboneElementInput } from './BackboneElementInput';\nimport { Button } from './Button';\nimport { FormSection } from './FormSection';\nimport { Input } from './Input';\nimport { useMedplum } from './MedplumProvider';\nimport { useResource } from './useResource';\n\nexport interface ResourceFormProps {\n defaultValue: Resource | Reference;\n outcome?: OperationOutcome;\n onSubmit: (resource: Resource) => void;\n onDelete?: (resource: Resource) => void;\n}\n\nexport function ResourceForm(props: ResourceFormProps): JSX.Element {\n const medplum = useMedplum();\n const defaultValue = useResource(props.defaultValue);\n const [schema, setSchema] = useState<IndexedStructureDefinition | undefined>();\n const [value, setValue] = useState<Resource | undefined>();\n\n useEffect(() => {\n if (defaultValue) {\n setValue(JSON.parse(JSON.stringify(defaultValue)));\n medplum.requestSchema(defaultValue.resourceType).then(setSchema);\n }\n }, [medplum, defaultValue]);\n\n if (!schema || !value) {\n return <div>Loading...</div>;\n }\n\n return (\n <form\n noValidate\n autoComplete=\"off\"\n onSubmit={(e: React.FormEvent) => {\n e.preventDefault();\n if (props.onSubmit) {\n props.onSubmit(value);\n }\n }}\n >\n <FormSection title=\"Resource Type\">\n <Input name=\"resourceType\" defaultValue={value.resourceType} disabled={true} />\n </FormSection>\n <FormSection title=\"ID\">\n <Input name=\"id\" defaultValue={value.id} disabled={true} />\n </FormSection>\n <BackboneElementInput\n typeName={value.resourceType}\n defaultValue={value}\n outcome={props.outcome}\n onChange={setValue}\n />\n <Button type=\"submit\" size=\"large\">\n OK\n </Button>\n {props.onDelete && (\n <Button\n type=\"button\"\n size=\"large\"\n onClick={() => {\n (props.onDelete as (resource: Resource) => void)(value);\n }}\n >\n Delete\n </Button>\n )}\n </form>\n );\n}\n\nexport function setPropertyValue(\n obj: any,\n key: string,\n propName: string,\n elementDefinition: ElementDefinition,\n value: any\n): any {\n const types = elementDefinition.type as ElementDefinitionType[];\n if (types.length > 1) {\n for (const type of types) {\n const compoundKey = key.replace('[x]', capitalize(type.code as string));\n if (compoundKey in obj) {\n delete obj[compoundKey];\n }\n }\n }\n obj[propName] = value;\n return obj;\n}\n"],"names":[],"mappings":";;;;;;;;;AAiBM,SAAU,YAAY,CAAC,KAAwB,EAAA;AACnD,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,YAAY,GAAG,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACrD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,EAA0C,CAAC;IAC/E,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAwB,CAAC;IAE3D,SAAS,CAAC,MAAK;AACb,QAAA,IAAI,YAAY,EAAE;AAChB,YAAA,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAA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M,IAAC,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,OAAO,EAEzB,EAAA,IAAA,CAAA;AACR,QAAA,KAAK,CAAC,QAAQ,KACb,KAAC,CAAA,aAAA,CAAA,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,MAAK;AACX,gBAAA,KAAK,CAAC,QAAyC,CAAC,KAAK,CAAC,CAAC;AAC1D,aAAC,EAGM,EAAA,QAAA,CAAA,CACV,CACI,EACP;AACJ,CAAC;AAEK,SAAU,gBAAgB,CAC9B,GAAQ,EACR,GAAW,EACX,QAAgB,EAChB,iBAAoC,EACpC,KAAU,EAAA;AAEV,IAAA,MAAM,KAAK,GAAG,iBAAiB,CAAC,IAA+B,CAAC;AAChE,IAAA,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;AACpB,QAAA,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;AACxB,YAAA,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,IAAc,CAAC,CAAC,CAAC;YACxE,IAAI,WAAW,IAAI,GAAG,EAAE;AACtB,gBAAA,OAAO,GAAG,CAAC,WAAW,CAAC,CAAC;AACzB,aAAA;AACF,SAAA;AACF,KAAA;AACD,IAAA,GAAG,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;AACtB,IAAA,OAAO,GAAG,CAAC;AACb;;;;"}
|
|
File without changes
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { formatDateTime } from '@medplum/core';
|
|
2
|
+
import React, { useState, useEffect } from 'react';
|
|
3
|
+
import { MedplumLink } from './MedplumLink.js';
|
|
4
|
+
import { useMedplum } from './MedplumProvider.js';
|
|
5
|
+
import { ResourceBadge } from './ResourceBadge.js';
|
|
6
|
+
|
|
7
|
+
function ResourceHistoryTable(props) {
|
|
8
|
+
var _a;
|
|
9
|
+
const medplum = useMedplum();
|
|
10
|
+
const [value, setValue] = useState(props.history);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (!props.history && props.resourceType && props.id) {
|
|
13
|
+
medplum.readHistory(props.resourceType, props.id).then((result) => setValue(result));
|
|
14
|
+
}
|
|
15
|
+
}, [medplum, props.history, props.resourceType, props.id]);
|
|
16
|
+
if (!value) {
|
|
17
|
+
return React.createElement("div", null, "Loading...");
|
|
18
|
+
}
|
|
19
|
+
return (React.createElement("table", { className: "medplum-table" },
|
|
20
|
+
React.createElement("thead", null,
|
|
21
|
+
React.createElement("tr", null,
|
|
22
|
+
React.createElement("th", null, "Author"),
|
|
23
|
+
React.createElement("th", null, "Date"),
|
|
24
|
+
React.createElement("th", null, "Version"))),
|
|
25
|
+
React.createElement("tbody", null, (_a = value.entry) === null || _a === void 0 ? void 0 : _a.map((entry) => {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
return (React.createElement(HistoryRow, { key: (_b = (_a = entry.resource) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.versionId, version: entry.resource }));
|
|
28
|
+
}))));
|
|
29
|
+
}
|
|
30
|
+
function HistoryRow(props) {
|
|
31
|
+
var _a, _b, _c;
|
|
32
|
+
return (React.createElement("tr", null,
|
|
33
|
+
React.createElement("td", null,
|
|
34
|
+
React.createElement(ResourceBadge, { value: (_a = props.version.meta) === null || _a === void 0 ? void 0 : _a.author, link: true })),
|
|
35
|
+
React.createElement("td", null, formatDateTime((_b = props.version.meta) === null || _b === void 0 ? void 0 : _b.lastUpdated)),
|
|
36
|
+
React.createElement("td", null,
|
|
37
|
+
React.createElement(MedplumLink, { to: getVersionUrl(props.version) }, (_c = props.version.meta) === null || _c === void 0 ? void 0 : _c.versionId))));
|
|
38
|
+
}
|
|
39
|
+
function getVersionUrl(resource) {
|
|
40
|
+
var _a;
|
|
41
|
+
return `/${resource.resourceType}/${resource.id}/_history/${(_a = resource.meta) === null || _a === void 0 ? void 0 : _a.versionId}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { ResourceHistoryTable };
|
|
45
|
+
//# sourceMappingURL=ResourceHistoryTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResourceHistoryTable.js","sources":["../../src/ResourceHistoryTable.tsx"],"sourcesContent":["import { formatDateTime } from '@medplum/core';\nimport { Bundle, Resource, ResourceType } from '@medplum/fhirtypes';\nimport React, { useEffect, useState } from 'react';\nimport { MedplumLink } from './MedplumLink';\nimport { useMedplum } from './MedplumProvider';\nimport { ResourceBadge } from './ResourceBadge';\nimport './Table.css';\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.readHistory(props.resourceType as ResourceType, props.id).then((result) => setValue(result));\n }\n }, [medplum, props.history, props.resourceType, props.id]);\n\n if (!value) {\n return <div>Loading...</div>;\n }\n\n return (\n <table className=\"medplum-table\">\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) => (\n <HistoryRow key={entry.resource?.meta?.versionId} version={entry.resource as Resource} />\n ))}\n </tbody>\n </table>\n );\n}\n\ninterface HistoryRowProps {\n version: Resource;\n}\n\nfunction HistoryRow(props: HistoryRowProps): JSX.Element {\n return (\n <tr>\n <td>\n <ResourceBadge value={props.version.meta?.author} link={true} />\n </td>\n <td>{formatDateTime(props.version.meta?.lastUpdated)}</td>\n <td>\n <MedplumLink to={getVersionUrl(props.version)}>{props.version.meta?.versionId}</MedplumLink>\n </td>\n </tr>\n );\n}\n\nfunction getVersionUrl(resource: Resource): string {\n return `/${resource.resourceType}/${resource.id}/_history/${resource.meta?.versionId}`;\n}\n"],"names":[],"mappings":";;;;;;AAcM,SAAU,oBAA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AAY,CAAA,CAAA,EAAI,QAAQ,CAAC,EAAE,CAAa,UAAA,EAAA,CAAA,EAAA,GAAA,QAAQ,CAAC,IAAI,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,SAAS,EAAE,CAAC;AACzF;;;;"}
|
|
@@ -6,6 +6,7 @@ export interface ResourceInputProps<T extends Resource = Resource> {
|
|
|
6
6
|
readonly defaultValue?: T | Reference<T>;
|
|
7
7
|
readonly className?: string;
|
|
8
8
|
readonly placeholder?: string;
|
|
9
|
+
readonly loadOnFocus?: boolean;
|
|
9
10
|
readonly onChange?: (value: T | undefined) => void;
|
|
10
11
|
}
|
|
11
12
|
export declare function ResourceInput<T extends Resource = Resource>(props: ResourceInputProps<T>): JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { __awaiter } from './node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
3
|
+
import { Autocomplete } from './Autocomplete.js';
|
|
4
|
+
import { Avatar } from './Avatar.js';
|
|
5
|
+
import { useMedplum } from './MedplumProvider.js';
|
|
6
|
+
import { ResourceName } from './ResourceName.js';
|
|
7
|
+
import { useResource } from './useResource.js';
|
|
8
|
+
|
|
9
|
+
function ResourceInput(props) {
|
|
10
|
+
const medplum = useMedplum();
|
|
11
|
+
const defaultResource = useResource(props.defaultValue);
|
|
12
|
+
const [value, setValue] = useState();
|
|
13
|
+
const resourceTypeRef = useRef(props.resourceType);
|
|
14
|
+
resourceTypeRef.current = props.resourceType;
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
setValue(defaultResource);
|
|
17
|
+
}, [defaultResource]);
|
|
18
|
+
function setValueWrapper(newValue) {
|
|
19
|
+
setValue(newValue);
|
|
20
|
+
if (props.onChange) {
|
|
21
|
+
props.onChange(newValue);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return (React.createElement(Autocomplete, { loadOptions: (input) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
return medplum
|
|
26
|
+
.search(resourceTypeRef.current, 'name=' + encodeURIComponent(input) + '&_count=10')
|
|
27
|
+
.then((bundle) => bundle.entry.map((entry) => entry.resource));
|
|
28
|
+
}), getId: (item) => {
|
|
29
|
+
return item.id;
|
|
30
|
+
}, getIcon: (item) => React.createElement(Avatar, { value: item }), getDisplay: (item) => React.createElement(ResourceName, { value: item }), getHelpText: (item) => {
|
|
31
|
+
if (item.resourceType === 'Patient' && item.birthDate) {
|
|
32
|
+
return 'DoB: ' + item.birthDate;
|
|
33
|
+
}
|
|
34
|
+
return undefined;
|
|
35
|
+
}, name: props.name, defaultValue: value ? [value] : undefined, className: props.className, placeholder: props.placeholder, loadOnFocus: props.loadOnFocus, onChange: (items) => {
|
|
36
|
+
setValueWrapper(items.length > 0 ? items[0] : undefined);
|
|
37
|
+
} }));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { ResourceInput };
|
|
41
|
+
//# sourceMappingURL=ResourceInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResourceInput.js","sources":["../../src/ResourceInput.tsx"],"sourcesContent":["import { Bundle, BundleEntry, Reference, Resource, ResourceType } from '@medplum/fhirtypes';\nimport React, { useEffect, useRef, useState } from 'react';\nimport { Autocomplete } from './Autocomplete';\nimport { Avatar } from './Avatar';\nimport { useMedplum } from './MedplumProvider';\nimport { ResourceName } from './ResourceName';\nimport { useResource } from './useResource';\n\nexport interface ResourceInputProps<T extends Resource = Resource> {\n readonly resourceType: string;\n readonly name: string;\n readonly defaultValue?: T | Reference<T>;\n readonly className?: string;\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 defaultResource = useResource(props.defaultValue);\n const [value, setValue] = useState<T>();\n\n const resourceTypeRef = useRef<string>(props.resourceType);\n resourceTypeRef.current = props.resourceType;\n\n useEffect(() => {\n setValue(defaultResource);\n }, [defaultResource]);\n\n function setValueWrapper(newValue: T | undefined): void {\n setValue(newValue);\n if (props.onChange) {\n props.onChange(newValue);\n }\n }\n\n return (\n <Autocomplete\n loadOptions={async (input: string): Promise<T[]> => {\n return medplum\n .search(resourceTypeRef.current as ResourceType, 'name=' + encodeURIComponent(input) + '&_count=10')\n .then((bundle: Bundle) => (bundle.entry as BundleEntry[]).map((entry) => entry.resource as T));\n }}\n getId={(item: T) => {\n return item.id as string;\n }}\n getIcon={(item: T) => <Avatar value={item} />}\n getDisplay={(item: T) => <ResourceName value={item} />}\n getHelpText={(item: T) => {\n if (item.resourceType === 'Patient' && item.birthDate) {\n return 'DoB: ' + item.birthDate;\n }\n return undefined;\n }}\n name={props.name}\n defaultValue={value ? [value] : undefined}\n className={props.className}\n placeholder={props.placeholder}\n loadOnFocus={props.loadOnFocus}\n onChange={(items: T[]) => {\n setValueWrapper(items.length > 0 ? items[0] : undefined);\n }}\n />\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAkBM,SAAU,aAAa,CAAgC,KAA4B,EAAA;AACvF,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,eAAe,GAAG,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACxD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAK,CAAC;IAExC,MAAM,eAAe,GAAG,MAAM,CAAS,KAAK,CAAC,YAAY,CAAC,CAAC;AAC3D,IAAA,eAAe,CAAC,OAAO,GAAG,KAAK,CAAC,YAAY,CAAC;IAE7C,SAAS,CAAC,MAAK;QACb,QAAQ,CAAC,eAAe,CAAC,CAAC;AAC5B,KAAC,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;IAEtB,SAAS,eAAe,CAAC,QAAuB,EAAA;QAC9C,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACnB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,EAAE,CAAC,KAAU,KAAI;AACvB,YAAA,eAAe,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;SAC1D,EAAA,CACD,EACF;AACJ;;;;"}
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getDisplayString } from '@medplum/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { MedplumLink } from './MedplumLink.js';
|
|
4
|
+
import { useResource } from './useResource.js';
|
|
5
|
+
|
|
6
|
+
function ResourceName(props) {
|
|
7
|
+
const resource = useResource(props.value);
|
|
8
|
+
if (!resource) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
const text = getDisplayString(resource);
|
|
12
|
+
return props.link ? React.createElement(MedplumLink, { to: resource }, text) : React.createElement("span", null, text);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { ResourceName };
|
|
16
|
+
//# sourceMappingURL=ResourceName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResourceName.js","sources":["../../src/ResourceName.tsx"],"sourcesContent":["import { getDisplayString } from '@medplum/core';\nimport { Reference, Resource } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { MedplumLink } from './MedplumLink';\nimport { useResource } from './useResource';\n\nexport interface ResourceNameProps {\n value?: Reference | Resource;\n link?: boolean;\n}\n\nexport function ResourceName(props: ResourceNameProps): JSX.Element | null {\n const resource = useResource(props.value);\n if (!resource) {\n return null;\n }\n\n const text = getDisplayString(resource);\n\n return props.link ? <MedplumLink to={resource}>{text}</MedplumLink> : <span>{text}</span>;\n}\n"],"names":[],"mappings":";;;;;AAWM,SAAU,YAAY,CAAC,KAAwB,EAAA;IACnD,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1C,IAAI,CAAC,QAAQ,EAAE;AACb,QAAA,OAAO,IAAI,CAAC;AACb,KAAA;AAED,IAAA,MAAM,IAAI,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAExC,OAAO,KAAK,CAAC,IAAI,GAAG,KAAA,CAAA,aAAA,CAAC,WAAW,EAAC,EAAA,EAAE,EAAE,QAAQ,EAAA,EAAG,IAAI,CAAe,GAAG,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,IAAA,EAAO,IAAI,CAAQ,CAAC;AAC5F;;;;"}
|
|
File without changes
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { buildTypeName, PropertyType, formatTiming, formatPeriod, formatDateTime, getTypedPropertyValue } from '@medplum/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AddressDisplay } from './AddressDisplay.js';
|
|
4
|
+
import { AttachmentArrayDisplay } from './AttachmentArrayDisplay.js';
|
|
5
|
+
import { AttachmentDisplay } from './AttachmentDisplay.js';
|
|
6
|
+
import { BackboneElementDisplay } from './BackboneElementDisplay.js';
|
|
7
|
+
import { CodeableConceptDisplay } from './CodeableConceptDisplay.js';
|
|
8
|
+
import { CodingDisplay } from './CodingDisplay.js';
|
|
9
|
+
import { ContactDetailDisplay } from './ContactDetailDisplay.js';
|
|
10
|
+
import { ContactPointDisplay } from './ContactPointDisplay.js';
|
|
11
|
+
import { HumanNameDisplay } from './HumanNameDisplay.js';
|
|
12
|
+
import { IdentifierDisplay } from './IdentifierDisplay.js';
|
|
13
|
+
import { QuantityDisplay } from './QuantityDisplay.js';
|
|
14
|
+
import { RangeDisplay } from './RangeDisplay.js';
|
|
15
|
+
import { RatioDisplay } from './RatioDisplay.js';
|
|
16
|
+
import { ReferenceDisplay } from './ReferenceDisplay.js';
|
|
17
|
+
import { ResourceArrayDisplay } from './ResourceArrayDisplay.js';
|
|
18
|
+
|
|
19
|
+
function ResourcePropertyDisplay(props) {
|
|
20
|
+
var _a;
|
|
21
|
+
const { property, propertyType, value } = props;
|
|
22
|
+
if ((property === null || property === void 0 ? void 0 : property.max) === '*' && !props.arrayElement) {
|
|
23
|
+
if (propertyType === 'Attachment') {
|
|
24
|
+
return React.createElement(AttachmentArrayDisplay, { values: value, maxWidth: props.maxWidth });
|
|
25
|
+
}
|
|
26
|
+
return (React.createElement(ResourceArrayDisplay, { property: property, values: value, ignoreMissingValues: props.ignoreMissingValues, link: props.link }));
|
|
27
|
+
}
|
|
28
|
+
switch (propertyType) {
|
|
29
|
+
case PropertyType.boolean:
|
|
30
|
+
return React.createElement("div", null, value === undefined ? '' : Boolean(value).toString());
|
|
31
|
+
case PropertyType.SystemString:
|
|
32
|
+
case PropertyType.code:
|
|
33
|
+
case PropertyType.date:
|
|
34
|
+
case PropertyType.integer:
|
|
35
|
+
case PropertyType.positiveInt:
|
|
36
|
+
case PropertyType.string:
|
|
37
|
+
case PropertyType.unsignedInt:
|
|
38
|
+
case PropertyType.uri:
|
|
39
|
+
case PropertyType.url:
|
|
40
|
+
return React.createElement("div", null, value);
|
|
41
|
+
case PropertyType.canonical:
|
|
42
|
+
return React.createElement(ReferenceDisplay, { value: { reference: value }, link: props.link });
|
|
43
|
+
case PropertyType.dateTime:
|
|
44
|
+
case PropertyType.instant:
|
|
45
|
+
return React.createElement("div", null, formatDateTime(value));
|
|
46
|
+
case PropertyType.markdown:
|
|
47
|
+
return React.createElement("pre", null, value);
|
|
48
|
+
case PropertyType.Address:
|
|
49
|
+
return React.createElement(AddressDisplay, { value: value });
|
|
50
|
+
case PropertyType.Annotation:
|
|
51
|
+
return React.createElement("div", null, value === null || value === void 0 ? void 0 : value.text);
|
|
52
|
+
case PropertyType.Attachment:
|
|
53
|
+
return React.createElement(AttachmentDisplay, { value: value, maxWidth: props.maxWidth });
|
|
54
|
+
case PropertyType.CodeableConcept:
|
|
55
|
+
return React.createElement(CodeableConceptDisplay, { value: value });
|
|
56
|
+
case PropertyType.Coding:
|
|
57
|
+
return React.createElement(CodingDisplay, { value: value });
|
|
58
|
+
case PropertyType.ContactDetail:
|
|
59
|
+
return React.createElement(ContactDetailDisplay, { value: value });
|
|
60
|
+
case PropertyType.ContactPoint:
|
|
61
|
+
return React.createElement(ContactPointDisplay, { value: value });
|
|
62
|
+
case PropertyType.HumanName:
|
|
63
|
+
return React.createElement(HumanNameDisplay, { value: value });
|
|
64
|
+
case PropertyType.Identifier:
|
|
65
|
+
return React.createElement(IdentifierDisplay, { value: value });
|
|
66
|
+
case PropertyType.Period:
|
|
67
|
+
return React.createElement("div", null, formatPeriod(value));
|
|
68
|
+
case PropertyType.Quantity:
|
|
69
|
+
return React.createElement(QuantityDisplay, { value: value });
|
|
70
|
+
case PropertyType.Range:
|
|
71
|
+
return React.createElement(RangeDisplay, { value: value });
|
|
72
|
+
case PropertyType.Ratio:
|
|
73
|
+
return React.createElement(RatioDisplay, { value: value });
|
|
74
|
+
case PropertyType.Reference:
|
|
75
|
+
return React.createElement(ReferenceDisplay, { value: value, link: props.link });
|
|
76
|
+
case PropertyType.Timing:
|
|
77
|
+
return React.createElement("div", null, formatTiming(value));
|
|
78
|
+
default:
|
|
79
|
+
if (!(property === null || property === void 0 ? void 0 : property.path)) {
|
|
80
|
+
throw Error(`Displaying property of type ${props.propertyType} requires element definition path`);
|
|
81
|
+
}
|
|
82
|
+
return (React.createElement(BackboneElementDisplay, { value: { type: buildTypeName((_a = property === null || property === void 0 ? void 0 : property.path) === null || _a === void 0 ? void 0 : _a.split('.')), value }, compact: true, ignoreMissingValues: props.ignoreMissingValues }));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Returns the value of the property and the property type.
|
|
87
|
+
* Some property definitions support multiple types.
|
|
88
|
+
* For example, "Observation.value[x]" can be "valueString", "valueInteger", "valueQuantity", etc.
|
|
89
|
+
* According to the spec, there can only be one property for a given element definition.
|
|
90
|
+
* This function returns the value and the type.
|
|
91
|
+
* @param context The base context (usually a FHIR resource).
|
|
92
|
+
* @param property The property definition.
|
|
93
|
+
* @returns The value of the property and the property type.
|
|
94
|
+
*/
|
|
95
|
+
function getValueAndType(context, path) {
|
|
96
|
+
const typedResult = getTypedPropertyValue(context, path);
|
|
97
|
+
if (!typedResult) {
|
|
98
|
+
return [undefined, 'undefined'];
|
|
99
|
+
}
|
|
100
|
+
if (Array.isArray(typedResult)) {
|
|
101
|
+
return [typedResult.map((e) => e.value), typedResult[0].type];
|
|
102
|
+
}
|
|
103
|
+
return [typedResult.value, typedResult.type];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export { ResourcePropertyDisplay, getValueAndType };
|
|
107
|
+
//# sourceMappingURL=ResourcePropertyDisplay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResourcePropertyDisplay.js","sources":["../../src/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';\nimport { AttachmentArrayDisplay } from './AttachmentArrayDisplay';\nimport { AttachmentDisplay } from './AttachmentDisplay';\nimport { BackboneElementDisplay } from './BackboneElementDisplay';\nimport { CodeableConceptDisplay } from './CodeableConceptDisplay';\nimport { CodingDisplay } from './CodingDisplay';\nimport { ContactDetailDisplay } from './ContactDetailDisplay';\nimport { ContactPointDisplay } from './ContactPointDisplay';\nimport { HumanNameDisplay } from './HumanNameDisplay';\nimport { IdentifierDisplay } from './IdentifierDisplay';\nimport { QuantityDisplay } from './QuantityDisplay';\nimport { RangeDisplay } from './RangeDisplay';\nimport { RatioDisplay } from './RatioDisplay';\nimport { ReferenceDisplay } from './ReferenceDisplay';\nimport { ResourceArrayDisplay } from './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 <div>{value === undefined ? '' : Boolean(value).toString()}</div>;\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 <div>{value}</div>;\n case PropertyType.canonical:\n return <ReferenceDisplay value={{ reference: value }} link={props.link} />;\n case PropertyType.dateTime:\n case PropertyType.instant:\n return <div>{formatDateTime(value)}</div>;\n case PropertyType.markdown:\n return <pre>{value}</pre>;\n case PropertyType.Address:\n return <AddressDisplay value={value} />;\n case PropertyType.Annotation:\n return <div>{value?.text}</div>;\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.Period:\n return <div>{formatPeriod(value)}</div>;\n case PropertyType.Quantity:\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 <div>{formatTiming(value)}</div>;\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":";;;;;;;;;;;;;;;;;;AAqCM,SAAU,uBAAuB,CAAC,KAAmC,EAAA;;IACzE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;AAEhD,IAAA,IAAI,CAAA,QAAQ,KAAR,IAAA,IAAA,QAAQ,uBAAR,QAAQ,CAAE,GAAG,MAAK,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,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AAC,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;;;;"}
|
|
File without changes
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { capitalize, buildTypeName, PropertyType } from '@medplum/core';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { AddressInput } from './AddressInput.js';
|
|
4
|
+
import { AnnotationInput } from './AnnotationInput.js';
|
|
5
|
+
import { AttachmentArrayInput } from './AttachmentArrayInput.js';
|
|
6
|
+
import { AttachmentInput } from './AttachmentInput.js';
|
|
7
|
+
import { BackboneElementInput } from './BackboneElementInput.js';
|
|
8
|
+
import { Checkbox } from './Checkbox.js';
|
|
9
|
+
import { CodeableConceptInput } from './CodeableConceptInput.js';
|
|
10
|
+
import { CodeInput } from './CodeInput.js';
|
|
11
|
+
import { CodingInput } from './CodingInput.js';
|
|
12
|
+
import { ContactDetailInput } from './ContactDetailInput.js';
|
|
13
|
+
import { ContactPointInput } from './ContactPointInput.js';
|
|
14
|
+
import { DateTimeInput } from './DateTimeInput.js';
|
|
15
|
+
import { ExtensionInput } from './ExtensionInput.js';
|
|
16
|
+
import { HumanNameInput } from './HumanNameInput.js';
|
|
17
|
+
import { IdentifierInput } from './IdentifierInput.js';
|
|
18
|
+
import { Input } from './Input.js';
|
|
19
|
+
import { InputRow } from './InputRow.js';
|
|
20
|
+
import { PeriodInput } from './PeriodInput.js';
|
|
21
|
+
import { QuantityInput } from './QuantityInput.js';
|
|
22
|
+
import { RangeInput } from './RangeInput.js';
|
|
23
|
+
import { RatioInput } from './RatioInput.js';
|
|
24
|
+
import { ReferenceInput } from './ReferenceInput.js';
|
|
25
|
+
import { ResourceArrayInput } from './ResourceArrayInput.js';
|
|
26
|
+
import { Select } from './Select.js';
|
|
27
|
+
import { TextArea } from './TextArea.js';
|
|
28
|
+
import { TimingInput } from './TimingInput.js';
|
|
29
|
+
|
|
30
|
+
function ResourcePropertyInput(props) {
|
|
31
|
+
var _a, _b, _c;
|
|
32
|
+
const property = props.property;
|
|
33
|
+
const propertyType = (_a = props.defaultPropertyType) !== null && _a !== void 0 ? _a : (_c = (_b = property.type) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.code;
|
|
34
|
+
const name = props.name;
|
|
35
|
+
const value = props.defaultValue;
|
|
36
|
+
if (property.max === '*' && !props.arrayElement) {
|
|
37
|
+
if (propertyType === 'Attachment') {
|
|
38
|
+
return React.createElement(AttachmentArrayInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
39
|
+
}
|
|
40
|
+
return React.createElement(ResourceArrayInput, { property: property, name: name, defaultValue: value, onChange: props.onChange });
|
|
41
|
+
}
|
|
42
|
+
const propertyTypes = property.type;
|
|
43
|
+
if (propertyTypes.length > 1) {
|
|
44
|
+
return React.createElement(ElementDefinitionInputSelector, Object.assign({ elementDefinitionTypes: propertyTypes }, props));
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
return React.createElement(ElementDefinitionTypeInput, Object.assign({ elementDefinitionType: propertyTypes[0] }, props));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function ElementDefinitionInputSelector(props) {
|
|
51
|
+
const propertyTypes = props.elementDefinitionTypes;
|
|
52
|
+
let initialPropertyType = undefined;
|
|
53
|
+
if (props.defaultPropertyType) {
|
|
54
|
+
initialPropertyType = propertyTypes.find((t) => t.code === props.defaultPropertyType);
|
|
55
|
+
}
|
|
56
|
+
if (!initialPropertyType) {
|
|
57
|
+
initialPropertyType = propertyTypes[0];
|
|
58
|
+
}
|
|
59
|
+
const [selectedType, setSelectedType] = useState(initialPropertyType);
|
|
60
|
+
return (React.createElement(InputRow, null,
|
|
61
|
+
React.createElement(Select, { style: { width: '200px' }, defaultValue: selectedType === null || selectedType === void 0 ? void 0 : selectedType.code, onChange: (newValue) => {
|
|
62
|
+
setSelectedType(propertyTypes.find((type) => type.code === newValue));
|
|
63
|
+
} }, propertyTypes.map((type) => (React.createElement("option", { key: type.code, value: type.code }, type.code)))),
|
|
64
|
+
React.createElement(ElementDefinitionTypeInput, Object.assign({}, 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
|
+
var _a;
|
|
72
|
+
const property = props.property;
|
|
73
|
+
const propertyType = props.elementDefinitionType.code;
|
|
74
|
+
const name = props.name;
|
|
75
|
+
const value = props.defaultValue;
|
|
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(Input, { type: "text", name: name, testid: name, defaultValue: value, onChange: props.onChange, outcome: props.outcome }));
|
|
86
|
+
case PropertyType.date:
|
|
87
|
+
return (React.createElement(Input, { type: "date", name: name, testid: name, defaultValue: value, onChange: props.onChange, outcome: props.outcome }));
|
|
88
|
+
case PropertyType.dateTime:
|
|
89
|
+
case PropertyType.instant:
|
|
90
|
+
return (React.createElement(DateTimeInput, { type: "datetime-local", name: name, testid: name, defaultValue: value, onChange: props.onChange, outcome: props.outcome }));
|
|
91
|
+
case PropertyType.decimal:
|
|
92
|
+
case PropertyType.integer:
|
|
93
|
+
case PropertyType.positiveInt:
|
|
94
|
+
case PropertyType.unsignedInt:
|
|
95
|
+
return (React.createElement(Input, { type: "number", step: propertyType === PropertyType.decimal ? 'any' : 1, name: name, testid: name, defaultValue: value, onChange: (newValue) => {
|
|
96
|
+
if (props.onChange) {
|
|
97
|
+
props.onChange(parseFloat(newValue));
|
|
98
|
+
}
|
|
99
|
+
}, outcome: props.outcome }));
|
|
100
|
+
case PropertyType.code:
|
|
101
|
+
return React.createElement(CodeInput, { property: property, name: name, defaultValue: value, onChange: props.onChange });
|
|
102
|
+
case PropertyType.boolean:
|
|
103
|
+
return (React.createElement(Checkbox, { name: name, testid: name, defaultValue: !!value, onChange: (newValue) => {
|
|
104
|
+
if (props.onChange) {
|
|
105
|
+
props.onChange(newValue);
|
|
106
|
+
}
|
|
107
|
+
} }));
|
|
108
|
+
case PropertyType.markdown:
|
|
109
|
+
return React.createElement(TextArea, { name: name, testid: name, defaultValue: value, onChange: props.onChange });
|
|
110
|
+
// 2.24.0.2 Complex Types
|
|
111
|
+
// https://www.hl7.org/fhir/datatypes.html#complex
|
|
112
|
+
case PropertyType.Address:
|
|
113
|
+
return React.createElement(AddressInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
114
|
+
case PropertyType.Annotation:
|
|
115
|
+
return React.createElement(AnnotationInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
116
|
+
case PropertyType.Attachment:
|
|
117
|
+
return React.createElement(AttachmentInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
118
|
+
case PropertyType.CodeableConcept:
|
|
119
|
+
return React.createElement(CodeableConceptInput, { property: property, name: name, defaultValue: value, onChange: props.onChange });
|
|
120
|
+
case PropertyType.Coding:
|
|
121
|
+
return React.createElement(CodingInput, { property: property, name: name, defaultValue: value, onChange: props.onChange });
|
|
122
|
+
case PropertyType.ContactDetail:
|
|
123
|
+
return React.createElement(ContactDetailInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
124
|
+
case PropertyType.ContactPoint:
|
|
125
|
+
return React.createElement(ContactPointInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
126
|
+
case PropertyType.Extension:
|
|
127
|
+
return React.createElement(ExtensionInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
128
|
+
case PropertyType.HumanName:
|
|
129
|
+
return React.createElement(HumanNameInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
130
|
+
case PropertyType.Identifier:
|
|
131
|
+
return React.createElement(IdentifierInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
132
|
+
case PropertyType.Period:
|
|
133
|
+
return React.createElement(PeriodInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
134
|
+
case PropertyType.Quantity:
|
|
135
|
+
return React.createElement(QuantityInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
136
|
+
case PropertyType.Range:
|
|
137
|
+
return React.createElement(RangeInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
138
|
+
case PropertyType.Ratio:
|
|
139
|
+
return React.createElement(RatioInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
140
|
+
case PropertyType.Reference:
|
|
141
|
+
return (React.createElement(ReferenceInput, { name: name, defaultValue: value, targetTypes: getTargetTypes(property), onChange: props.onChange }));
|
|
142
|
+
case PropertyType.Timing:
|
|
143
|
+
return React.createElement(TimingInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
144
|
+
default:
|
|
145
|
+
return (React.createElement(BackboneElementInput, { typeName: buildTypeName((_a = property.path) === null || _a === void 0 ? void 0 : _a.split('.')), defaultValue: value, onChange: props.onChange, outcome: props.outcome }));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function getTargetTypes(property) {
|
|
149
|
+
var _a, _b, _c;
|
|
150
|
+
return (_c = (_b = (_a = property === null || property === void 0 ? void 0 : property.type) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.targetProfile) === null || _c === void 0 ? void 0 : _c.map((p) => p.split('/').pop());
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export { ElementDefinitionInputSelector, ElementDefinitionTypeInput, ResourcePropertyInput };
|
|
154
|
+
//# sourceMappingURL=ResourcePropertyInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResourcePropertyInput.js","sources":["../../src/ResourcePropertyInput.tsx"],"sourcesContent":["import { buildTypeName, capitalize, PropertyType } from '@medplum/core';\nimport { ElementDefinition, ElementDefinitionType, OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { AddressInput } from './AddressInput';\nimport { AnnotationInput } from './AnnotationInput';\nimport { AttachmentArrayInput } from './AttachmentArrayInput';\nimport { AttachmentInput } from './AttachmentInput';\nimport { BackboneElementInput } from './BackboneElementInput';\nimport { Checkbox } from './Checkbox';\nimport { CodeableConceptInput } from './CodeableConceptInput';\nimport { CodeInput } from './CodeInput';\nimport { CodingInput } from './CodingInput';\nimport { ContactDetailInput } from './ContactDetailInput';\nimport { ContactPointInput } from './ContactPointInput';\nimport { DateTimeInput } from './DateTimeInput';\nimport { ExtensionInput } from './ExtensionInput';\nimport { HumanNameInput } from './HumanNameInput';\nimport { IdentifierInput } from './IdentifierInput';\nimport { Input } from './Input';\nimport { InputRow } from './InputRow';\nimport { PeriodInput } from './PeriodInput';\nimport { QuantityInput } from './QuantityInput';\nimport { RangeInput } from './RangeInput';\nimport { RatioInput } from './RatioInput';\nimport { ReferenceInput } from './ReferenceInput';\nimport { ResourceArrayInput } from './ResourceArrayInput';\nimport { Select } from './Select';\nimport { TextArea } from './TextArea';\nimport { TimingInput } from './TimingInput';\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 <InputRow>\n <Select\n style={{ width: '200px' }}\n defaultValue={selectedType?.code}\n onChange={(newValue) => {\n setSelectedType(\n propertyTypes.find((type: ElementDefinitionType) => type.code === newValue) as ElementDefinitionType\n );\n }}\n >\n {propertyTypes.map((type: ElementDefinitionType) => (\n <option key={type.code} value={type.code}>\n {type.code}\n </option>\n ))}\n </Select>\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 </InputRow>\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 <Input\n type=\"text\"\n name={name}\n testid={name}\n defaultValue={value}\n onChange={props.onChange}\n outcome={props.outcome}\n />\n );\n case PropertyType.date:\n return (\n <Input\n type=\"date\"\n name={name}\n testid={name}\n defaultValue={value}\n onChange={props.onChange}\n outcome={props.outcome}\n />\n );\n case PropertyType.dateTime:\n case PropertyType.instant:\n return (\n <DateTimeInput\n type=\"datetime-local\"\n name={name}\n testid={name}\n defaultValue={value}\n onChange={props.onChange}\n outcome={props.outcome}\n />\n );\n case PropertyType.decimal:\n case PropertyType.integer:\n case PropertyType.positiveInt:\n case PropertyType.unsignedInt:\n return (\n <Input\n type=\"number\"\n step={propertyType === PropertyType.decimal ? 'any' : 1}\n name={name}\n testid={name}\n defaultValue={value}\n onChange={(newValue) => {\n if (props.onChange) {\n props.onChange(parseFloat(newValue));\n }\n }}\n outcome={props.outcome}\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 name={name}\n testid={name}\n defaultValue={!!value}\n onChange={(newValue) => {\n if (props.onChange) {\n props.onChange(newValue);\n }\n }}\n />\n );\n case PropertyType.markdown:\n return <TextArea name={name} testid={name} defaultValue={value} onChange={props.onChange} />;\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.Period:\n return <PeriodInput name={name} defaultValue={value} onChange={props.onChange} />;\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 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCM,SAAU,qBAAqB,CAAC,KAAiC,EAAA;;AACrE,IAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;AAChC,IAAA,MAAM,YAAY,GAAG,CAAA,EAAA,GAAA,KAAK,CAAC,mBAAmB,MAAK,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,QAAQ,CAAC,IAAI,MAAA,IAAA,IAAA,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AAA,GAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,QAAQ,aAAR,QAAQ,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAR,QAAQ,CAAE,IAAI,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAG,CAAC,CAAC,0CAAE,aAAa,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAY,CAAC,CAAC;AACtF;;;;"}
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { BackboneElementDisplay } from './BackboneElementDisplay.js';
|
|
3
|
+
import { useMedplum } from './MedplumProvider.js';
|
|
4
|
+
import { useResource } from './useResource.js';
|
|
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);
|
|
13
|
+
}
|
|
14
|
+
}, [medplum, value]);
|
|
15
|
+
if (!schema || !value) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return (React.createElement(BackboneElementDisplay, { value: { type: value.resourceType, value }, ignoreMissingValues: props.ignoreMissingValues }));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { ResourceTable };
|
|
22
|
+
//# sourceMappingURL=ResourceTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResourceTable.js","sources":["../../src/ResourceTable.tsx"],"sourcesContent":["import { IndexedStructureDefinition } from '@medplum/core';\nimport { Reference, Resource } from '@medplum/fhirtypes';\nimport React, { useEffect, useState } from 'react';\nimport { BackboneElementDisplay } from './BackboneElementDisplay';\nimport { useMedplum } from './MedplumProvider';\nimport { useResource } from './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);\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;AAC3D,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,QACE,oBAAC,sBAAsB,EAAA,EACrB,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,YAAY,EAAE,KAAK,EAAE,EAC1C,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,EAC9C,CAAA,EACF;AACJ;;;;"}
|
|
File without changes
|