@medplum/react 0.10.2 → 1.0.1
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/{AddressDisplay.d.ts → AddressDisplay/AddressDisplay.d.ts} +0 -0
- package/dist/cjs/{AddressInput.d.ts → AddressInput/AddressInput.d.ts} +0 -0
- package/dist/cjs/{stories → AddressInput}/AddressInput.stories.d.ts +0 -0
- package/dist/cjs/{AnnotationInput.d.ts → AnnotationInput/AnnotationInput.d.ts} +0 -0
- package/dist/cjs/{AttachmentArrayDisplay.d.ts → AttachmentArrayDisplay/AttachmentArrayDisplay.d.ts} +0 -0
- package/dist/cjs/{AttachmentArrayInput.d.ts → AttachmentArrayInput/AttachmentArrayInput.d.ts} +0 -0
- package/dist/cjs/{stories → AttachmentArrayInput}/AttachmentArrayInput.stories.d.ts +0 -0
- package/dist/{esm → cjs/AttachmentButton}/AttachmentButton.d.ts +2 -0
- package/dist/cjs/{stories → AttachmentButton}/AttachmentButton.stories.d.ts +0 -0
- package/dist/cjs/{AttachmentDisplay.d.ts → AttachmentDisplay/AttachmentDisplay.d.ts} +0 -0
- package/dist/cjs/{AttachmentInput.d.ts → AttachmentInput/AttachmentInput.d.ts} +0 -0
- package/dist/cjs/{stories → AttachmentInput}/AttachmentInput.stories.d.ts +0 -0
- package/dist/cjs/{BackboneElementDisplay.d.ts → BackboneElementDisplay/BackboneElementDisplay.d.ts} +0 -0
- package/dist/cjs/{BackboneElementInput.d.ts → BackboneElementInput/BackboneElementInput.d.ts} +0 -0
- package/dist/cjs/{CalendarInput.d.ts → CalendarInput/CalendarInput.d.ts} +0 -1
- package/dist/{esm → cjs/CheckboxFormSection}/CheckboxFormSection.d.ts +0 -1
- package/dist/cjs/{CodeInput.d.ts → CodeInput/CodeInput.d.ts} +0 -0
- package/dist/cjs/{stories → CodeInput}/CodeInput.stories.d.ts +0 -0
- package/dist/cjs/{CodeableConceptDisplay.d.ts → CodeableConceptDisplay/CodeableConceptDisplay.d.ts} +0 -0
- package/dist/cjs/{stories → CodeableConceptDisplay}/CodeableConceptDisplay.stories.d.ts +0 -0
- package/dist/cjs/{CodeableConceptInput.d.ts → CodeableConceptInput/CodeableConceptInput.d.ts} +0 -0
- package/dist/cjs/{stories → CodeableConceptInput}/CodeableConceptInput.stories.d.ts +0 -0
- package/dist/cjs/{CodingDisplay.d.ts → CodingDisplay/CodingDisplay.d.ts} +0 -0
- package/dist/cjs/{CodingInput.d.ts → CodingInput/CodingInput.d.ts} +0 -0
- package/dist/cjs/{ContactDetailDisplay.d.ts → ContactDetailDisplay/ContactDetailDisplay.d.ts} +0 -0
- package/dist/cjs/{ContactDetailInput.d.ts → ContactDetailInput/ContactDetailInput.d.ts} +0 -0
- package/dist/cjs/{ContactPointDisplay.d.ts → ContactPointDisplay/ContactPointDisplay.d.ts} +0 -0
- package/dist/cjs/{ContactPointInput.d.ts → ContactPointInput/ContactPointInput.d.ts} +0 -0
- package/dist/cjs/{DateTimeInput.d.ts → DateTimeInput/DateTimeInput.d.ts} +0 -0
- package/dist/cjs/{DefaultResourceTimeline.d.ts → DefaultResourceTimeline/DefaultResourceTimeline.d.ts} +0 -0
- package/dist/{esm → cjs/DescriptionList}/DescriptionList.d.ts +0 -1
- package/dist/cjs/{stories/Logo.stories.d.ts → DescriptionList/DescriptionList.stories.d.ts} +0 -0
- package/dist/cjs/{DiagnosticReportDisplay.d.ts → DiagnosticReportDisplay/DiagnosticReportDisplay.d.ts} +0 -1
- package/dist/cjs/{stories → DiagnosticReportDisplay}/DiagnosticReportDisplay.stories.d.ts +0 -0
- package/dist/cjs/{Document.d.ts → Document/Document.d.ts} +0 -1
- package/dist/cjs/{EncounterTimeline.d.ts → EncounterTimeline/EncounterTimeline.d.ts} +0 -0
- package/dist/cjs/{stories → EncounterTimeline}/EncounterTimeline.stories.d.ts +0 -0
- package/dist/cjs/{ErrorBoundary.d.ts → ErrorBoundary/ErrorBoundary.d.ts} +0 -0
- package/dist/cjs/{ExtensionInput.d.ts → ExtensionInput/ExtensionInput.d.ts} +0 -0
- package/dist/cjs/{FhirPathDisplay.d.ts → FhirPathDisplay/FhirPathDisplay.d.ts} +0 -0
- package/dist/cjs/{stories → FhirPathDisplay}/FhirPathDisplay.stories.d.ts +1 -1
- package/dist/cjs/{FhirPathTable.d.ts → FhirPathTable/FhirPathTable.d.ts} +1 -2
- package/dist/cjs/{Form.d.ts → Form/Form.d.ts} +0 -0
- package/dist/cjs/{FormUtils.d.ts → Form/FormUtils.d.ts} +0 -0
- package/dist/cjs/{FormSection.d.ts → FormSection/FormSection.d.ts} +0 -1
- package/dist/cjs/{GoogleButton.d.ts → GoogleButton/GoogleButton.d.ts} +0 -0
- package/dist/cjs/{HumanNameDisplay.d.ts → HumanNameDisplay/HumanNameDisplay.d.ts} +0 -0
- package/dist/cjs/{HumanNameInput.d.ts → HumanNameInput/HumanNameInput.d.ts} +0 -0
- package/dist/cjs/{IdentifierDisplay.d.ts → IdentifierDisplay/IdentifierDisplay.d.ts} +0 -0
- package/dist/cjs/{IdentifierInput.d.ts → IdentifierInput/IdentifierInput.d.ts} +0 -0
- package/dist/cjs/{Logo.d.ts → Logo/Logo.d.ts} +0 -0
- package/dist/{esm/stories → cjs/Logo}/Logo.stories.d.ts +0 -0
- package/dist/cjs/{MedplumLink.d.ts → MedplumLink/MedplumLink.d.ts} +2 -4
- package/dist/cjs/{MedplumProvider.d.ts → MedplumProvider/MedplumProvider.d.ts} +0 -0
- package/dist/cjs/{PatientTimeline.d.ts → PatientTimeline/PatientTimeline.d.ts} +0 -0
- package/dist/cjs/{stories → PatientTimeline}/PatientTimeline.stories.d.ts +0 -0
- package/dist/cjs/{PeriodInput.d.ts → PeriodInput/PeriodInput.d.ts} +0 -0
- package/dist/cjs/{stories → PeriodInput}/PeriodInput.stories.d.ts +0 -0
- package/dist/cjs/{PlanDefinitionBuilder.d.ts → PlanDefinitionBuilder/PlanDefinitionBuilder.d.ts} +0 -0
- package/dist/cjs/{stories → PlanDefinitionBuilder}/PlanDefinitionBuilder.stories.d.ts +0 -0
- package/dist/cjs/{QuantityDisplay.d.ts → QuantityDisplay/QuantityDisplay.d.ts} +0 -1
- package/dist/cjs/{QuantityInput.d.ts → QuantityInput/QuantityInput.d.ts} +0 -0
- package/dist/cjs/{QuestionnaireBuilder.d.ts → QuestionnaireBuilder/QuestionnaireBuilder.d.ts} +0 -1
- package/dist/cjs/{stories → QuestionnaireBuilder}/QuestionnaireBuilder.stories.d.ts +0 -0
- package/dist/{esm → cjs/QuestionnaireForm}/QuestionnaireForm.d.ts +0 -1
- package/dist/cjs/{stories → QuestionnaireForm}/QuestionnaireForm.stories.d.ts +0 -0
- package/dist/{esm → cjs/RangeDisplay}/RangeDisplay.d.ts +0 -1
- package/dist/cjs/{RangeInput.d.ts → RangeInput/RangeInput.d.ts} +0 -0
- package/dist/cjs/{RatioDisplay.d.ts → RatioDisplay/RatioDisplay.d.ts} +0 -0
- package/dist/cjs/{RatioInput.d.ts → RatioInput/RatioInput.d.ts} +0 -0
- package/dist/cjs/{ReferenceDisplay.d.ts → ReferenceDisplay/ReferenceDisplay.d.ts} +0 -0
- package/dist/cjs/{ReferenceInput.d.ts → ReferenceInput/ReferenceInput.d.ts} +0 -0
- package/dist/cjs/{stories → ReferenceInput}/ReferenceInput.stories.d.ts +0 -0
- package/dist/cjs/ReferenceRangeEditor/ReferenceRangeEditor.d.ts +27 -0
- package/dist/cjs/ReferenceRangeEditor/ReferenceRangeEditor.stories.d.ts +7 -0
- package/dist/cjs/{RequestGroupDisplay.d.ts → RequestGroupDisplay/RequestGroupDisplay.d.ts} +0 -1
- package/dist/cjs/{stories → RequestGroupDisplay}/RequestGroupDisplay.stories.d.ts +0 -0
- package/dist/cjs/{ResourceArrayDisplay.d.ts → ResourceArrayDisplay/ResourceArrayDisplay.d.ts} +0 -0
- package/dist/cjs/{ResourceArrayInput.d.ts → ResourceArrayInput/ResourceArrayInput.d.ts} +0 -0
- package/dist/cjs/{ResourceAvatar.d.ts → ResourceAvatar/ResourceAvatar.d.ts} +0 -0
- package/dist/cjs/{stories → ResourceAvatar}/ResourceAvatar.stories.d.ts +0 -0
- package/dist/{esm → cjs/ResourceBadge}/ResourceBadge.d.ts +0 -1
- package/dist/{esm → cjs/ResourceBlame}/ResourceBlame.d.ts +0 -1
- package/dist/cjs/{stories → ResourceBlame}/ResourceBlame.stories.d.ts +0 -0
- package/dist/{esm → cjs/ResourceDiff}/ResourceDiff.d.ts +0 -1
- package/dist/cjs/{ResourceDiffTable.d.ts → ResourceDiffTable/ResourceDiffTable.d.ts} +0 -2
- package/dist/cjs/ResourceDiffTable/ResourceDiffTable.stories.d.ts +5 -0
- package/dist/cjs/{ResourceForm.d.ts → ResourceForm/ResourceForm.d.ts} +0 -0
- package/dist/cjs/{stories → ResourceForm}/ResourceForm.stories.d.ts +0 -0
- package/dist/cjs/{ResourceHistoryTable.d.ts → ResourceHistoryTable/ResourceHistoryTable.d.ts} +0 -0
- package/dist/cjs/{stories → ResourceHistoryTable}/ResourceHistoryTable.stories.d.ts +0 -0
- package/dist/cjs/{ResourceInput.d.ts → ResourceInput/ResourceInput.d.ts} +0 -0
- package/dist/cjs/{stories → ResourceInput}/ResourceInput.stories.d.ts +0 -0
- package/dist/{esm → cjs/ResourceName}/ResourceName.d.ts +2 -1
- package/dist/cjs/{ResourcePropertyDisplay.d.ts → ResourcePropertyDisplay/ResourcePropertyDisplay.d.ts} +0 -0
- package/dist/cjs/{ResourcePropertyInput.d.ts → ResourcePropertyInput/ResourcePropertyInput.d.ts} +0 -0
- package/dist/cjs/{ResourceTable.d.ts → ResourceTable/ResourceTable.d.ts} +0 -0
- package/dist/cjs/{stories → ResourceTable}/ResourceTable.stories.d.ts +0 -0
- package/dist/cjs/{ResourceTimeline.d.ts → ResourceTimeline/ResourceTimeline.d.ts} +0 -1
- package/dist/cjs/{Scheduler.d.ts → Scheduler/Scheduler.d.ts} +0 -1
- package/dist/cjs/{stories → Scheduler}/Scheduler.stories.d.ts +0 -0
- package/dist/{esm → cjs/SearchControl}/SearchControl.d.ts +0 -1
- package/dist/cjs/{stories → SearchControl}/SearchControl.stories.d.ts +0 -0
- package/dist/cjs/{SearchControlField.d.ts → SearchControl/SearchControlField.d.ts} +0 -0
- package/dist/cjs/{SearchUtils.d.ts → SearchControl/SearchUtils.d.ts} +0 -21
- package/dist/cjs/{SearchFieldEditor.d.ts → SearchFieldEditor/SearchFieldEditor.d.ts} +0 -0
- package/dist/cjs/{SearchFilterEditor.d.ts → SearchFilterEditor/SearchFilterEditor.d.ts} +0 -1
- package/dist/cjs/{SearchFilterValueDialog.d.ts → SearchFilterValueDialog/SearchFilterValueDialog.d.ts} +0 -0
- package/dist/cjs/{SearchFilterValueDisplay.d.ts → SearchFilterValueDisplay/SearchFilterValueDisplay.d.ts} +0 -0
- package/dist/cjs/{SearchFilterValueInput.d.ts → SearchFilterValueInput/SearchFilterValueInput.d.ts} +0 -0
- package/dist/cjs/{SearchPopupMenu.d.ts → SearchPopupMenu/SearchPopupMenu.d.ts} +0 -0
- package/dist/cjs/{ServiceRequestTimeline.d.ts → ServiceRequestTimeline/ServiceRequestTimeline.d.ts} +0 -0
- package/dist/cjs/{StatusBadge.d.ts → StatusBadge/StatusBadge.d.ts} +0 -0
- package/dist/cjs/{stories → StatusBadge}/StatusBadge.stories.d.ts +0 -0
- package/dist/{esm → cjs/Timeline}/Timeline.d.ts +0 -1
- package/dist/cjs/{stories → Timeline}/Timeline.stories.d.ts +0 -0
- package/dist/cjs/{TimingInput.d.ts → TimingInput/TimingInput.d.ts} +0 -0
- package/dist/cjs/{stories → TimingInput}/TimingInput.stories.d.ts +0 -0
- package/dist/cjs/{ValueSetAutocomplete.d.ts → ValueSetAutocomplete/ValueSetAutocomplete.d.ts} +0 -0
- package/dist/cjs/auth/AuthenticationForm.d.ts +2 -9
- package/dist/cjs/auth/ChooseScopeForm.d.ts +7 -0
- package/dist/cjs/auth/RegisterForm.d.ts +0 -1
- package/dist/cjs/{stories → auth}/RegisterForm.stories.d.ts +0 -0
- package/dist/cjs/auth/SignInForm.d.ts +3 -10
- package/dist/cjs/{stories → auth}/SignInForm.stories.d.ts +0 -0
- package/dist/cjs/index.d.ts +66 -65
- package/dist/cjs/index.js +1659 -1105
- 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/stories/referenceLab.d.ts +3 -0
- package/dist/cjs/{useResource.d.ts → useResource/useResource.d.ts} +0 -0
- package/dist/cjs/{QuestionnaireUtils.d.ts → utils/questionnaire.d.ts} +0 -0
- package/dist/cjs/{utils.d.ts → utils/script.d.ts} +0 -0
- package/dist/esm/{AddressDisplay.d.ts → AddressDisplay/AddressDisplay.d.ts} +0 -0
- package/dist/esm/{AddressDisplay.js → AddressDisplay/AddressDisplay.js} +0 -0
- package/dist/esm/AddressDisplay/AddressDisplay.js.map +1 -0
- package/dist/esm/{AddressInput.d.ts → AddressInput/AddressInput.d.ts} +0 -0
- package/dist/esm/{AddressInput.js → AddressInput/AddressInput.js} +0 -0
- package/dist/esm/AddressInput/AddressInput.js.map +1 -0
- package/dist/esm/{stories → AddressInput}/AddressInput.stories.d.ts +0 -0
- package/dist/esm/{AnnotationInput.d.ts → AnnotationInput/AnnotationInput.d.ts} +0 -0
- package/dist/esm/{AnnotationInput.js → AnnotationInput/AnnotationInput.js} +1 -1
- package/dist/esm/AnnotationInput/AnnotationInput.js.map +1 -0
- package/dist/esm/{AttachmentArrayDisplay.d.ts → AttachmentArrayDisplay/AttachmentArrayDisplay.d.ts} +0 -0
- package/dist/esm/{AttachmentArrayDisplay.js → AttachmentArrayDisplay/AttachmentArrayDisplay.js} +1 -1
- package/dist/esm/AttachmentArrayDisplay/AttachmentArrayDisplay.js.map +1 -0
- package/dist/esm/{AttachmentArrayInput.d.ts → AttachmentArrayInput/AttachmentArrayInput.d.ts} +0 -0
- package/dist/esm/{AttachmentArrayInput.js → AttachmentArrayInput/AttachmentArrayInput.js} +5 -5
- package/dist/esm/AttachmentArrayInput/AttachmentArrayInput.js.map +1 -0
- package/dist/esm/{stories → AttachmentArrayInput}/AttachmentArrayInput.stories.d.ts +0 -0
- package/dist/{cjs → esm/AttachmentButton}/AttachmentButton.d.ts +2 -0
- package/dist/esm/{AttachmentButton.js → AttachmentButton/AttachmentButton.js} +6 -3
- package/dist/esm/AttachmentButton/AttachmentButton.js.map +1 -0
- package/dist/esm/{stories → AttachmentButton}/AttachmentButton.stories.d.ts +0 -0
- package/dist/esm/{AttachmentDisplay.d.ts → AttachmentDisplay/AttachmentDisplay.d.ts} +0 -0
- package/dist/esm/{AttachmentDisplay.js → AttachmentDisplay/AttachmentDisplay.js} +0 -0
- package/dist/esm/AttachmentDisplay/AttachmentDisplay.js.map +1 -0
- package/dist/esm/{AttachmentInput.d.ts → AttachmentInput/AttachmentInput.d.ts} +0 -0
- package/dist/esm/{AttachmentInput.js → AttachmentInput/AttachmentInput.js} +3 -3
- package/dist/esm/AttachmentInput/AttachmentInput.js.map +1 -0
- package/dist/esm/{stories → AttachmentInput}/AttachmentInput.stories.d.ts +0 -0
- package/dist/esm/{BackboneElementDisplay.d.ts → BackboneElementDisplay/BackboneElementDisplay.d.ts} +0 -0
- package/dist/esm/{BackboneElementDisplay.js → BackboneElementDisplay/BackboneElementDisplay.js} +7 -4
- package/dist/esm/BackboneElementDisplay/BackboneElementDisplay.js.map +1 -0
- package/dist/esm/{BackboneElementInput.d.ts → BackboneElementInput/BackboneElementInput.d.ts} +0 -0
- package/dist/esm/{BackboneElementInput.js → BackboneElementInput/BackboneElementInput.js} +8 -7
- package/dist/esm/BackboneElementInput/BackboneElementInput.js.map +1 -0
- package/dist/esm/{CalendarInput.d.ts → CalendarInput/CalendarInput.d.ts} +0 -1
- package/dist/esm/{CalendarInput.js → CalendarInput/CalendarInput.js} +39 -2
- package/dist/esm/CalendarInput/CalendarInput.js.map +1 -0
- package/dist/{cjs → esm/CheckboxFormSection}/CheckboxFormSection.d.ts +0 -1
- package/dist/esm/CheckboxFormSection/CheckboxFormSection.js +12 -0
- package/dist/esm/CheckboxFormSection/CheckboxFormSection.js.map +1 -0
- package/dist/esm/{CodeInput.d.ts → CodeInput/CodeInput.d.ts} +0 -0
- package/dist/esm/{CodeInput.js → CodeInput/CodeInput.js} +1 -1
- package/dist/esm/CodeInput/CodeInput.js.map +1 -0
- package/dist/esm/{stories → CodeInput}/CodeInput.stories.d.ts +0 -0
- package/dist/esm/{CodeableConceptDisplay.d.ts → CodeableConceptDisplay/CodeableConceptDisplay.d.ts} +0 -0
- package/dist/esm/{CodeableConceptDisplay.js → CodeableConceptDisplay/CodeableConceptDisplay.js} +1 -1
- package/dist/esm/CodeableConceptDisplay/CodeableConceptDisplay.js.map +1 -0
- package/dist/esm/{stories → CodeableConceptDisplay}/CodeableConceptDisplay.stories.d.ts +0 -0
- package/dist/esm/{CodeableConceptInput.d.ts → CodeableConceptInput/CodeableConceptInput.d.ts} +0 -0
- package/dist/esm/{CodeableConceptInput.js → CodeableConceptInput/CodeableConceptInput.js} +1 -1
- package/dist/esm/CodeableConceptInput/CodeableConceptInput.js.map +1 -0
- package/dist/esm/{stories → CodeableConceptInput}/CodeableConceptInput.stories.d.ts +0 -0
- package/dist/esm/{CodingDisplay.d.ts → CodingDisplay/CodingDisplay.d.ts} +0 -0
- package/dist/esm/{CodingDisplay.js → CodingDisplay/CodingDisplay.js} +0 -0
- package/dist/esm/CodingDisplay/CodingDisplay.js.map +1 -0
- package/dist/esm/{CodingInput.d.ts → CodingInput/CodingInput.d.ts} +0 -0
- package/dist/esm/{CodingInput.js → CodingInput/CodingInput.js} +1 -1
- package/dist/esm/CodingInput/CodingInput.js.map +1 -0
- package/dist/esm/{ContactDetailDisplay.d.ts → ContactDetailDisplay/ContactDetailDisplay.d.ts} +0 -0
- package/dist/esm/{ContactDetailDisplay.js → ContactDetailDisplay/ContactDetailDisplay.js} +1 -1
- package/dist/esm/ContactDetailDisplay/ContactDetailDisplay.js.map +1 -0
- package/dist/esm/{ContactDetailInput.d.ts → ContactDetailInput/ContactDetailInput.d.ts} +0 -0
- package/dist/esm/{ContactDetailInput.js → ContactDetailInput/ContactDetailInput.js} +1 -1
- package/dist/esm/ContactDetailInput/ContactDetailInput.js.map +1 -0
- package/dist/esm/{ContactPointDisplay.d.ts → ContactPointDisplay/ContactPointDisplay.d.ts} +0 -0
- package/dist/esm/{ContactPointDisplay.js → ContactPointDisplay/ContactPointDisplay.js} +0 -0
- package/dist/esm/ContactPointDisplay/ContactPointDisplay.js.map +1 -0
- package/dist/esm/{ContactPointInput.d.ts → ContactPointInput/ContactPointInput.d.ts} +0 -0
- package/dist/esm/{ContactPointInput.js → ContactPointInput/ContactPointInput.js} +0 -0
- package/dist/esm/ContactPointInput/ContactPointInput.js.map +1 -0
- package/dist/esm/{DateTimeInput.d.ts → DateTimeInput/DateTimeInput.d.ts} +0 -0
- package/dist/esm/{DateTimeInput.js → DateTimeInput/DateTimeInput.js} +1 -1
- package/dist/esm/DateTimeInput/DateTimeInput.js.map +1 -0
- package/dist/esm/{DefaultResourceTimeline.d.ts → DefaultResourceTimeline/DefaultResourceTimeline.d.ts} +0 -0
- package/dist/esm/{DefaultResourceTimeline.js → DefaultResourceTimeline/DefaultResourceTimeline.js} +1 -1
- package/dist/esm/DefaultResourceTimeline/DefaultResourceTimeline.js.map +1 -0
- package/dist/{cjs → esm/DescriptionList}/DescriptionList.d.ts +0 -1
- package/dist/esm/DescriptionList/DescriptionList.js +35 -0
- package/dist/esm/DescriptionList/DescriptionList.js.map +1 -0
- package/dist/esm/{stories/ResourceBlame.stories.d.ts → DescriptionList/DescriptionList.stories.d.ts} +0 -0
- package/dist/esm/{DiagnosticReportDisplay.d.ts → DiagnosticReportDisplay/DiagnosticReportDisplay.d.ts} +0 -1
- package/dist/esm/{DiagnosticReportDisplay.js → DiagnosticReportDisplay/DiagnosticReportDisplay.js} +47 -29
- package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.js.map +1 -0
- package/dist/esm/{stories → DiagnosticReportDisplay}/DiagnosticReportDisplay.stories.d.ts +0 -0
- package/dist/esm/{Document.d.ts → Document/Document.d.ts} +0 -1
- package/dist/esm/Document/Document.js +14 -0
- package/dist/esm/Document/Document.js.map +1 -0
- package/dist/esm/{EncounterTimeline.d.ts → EncounterTimeline/EncounterTimeline.d.ts} +0 -0
- package/dist/esm/{EncounterTimeline.js → EncounterTimeline/EncounterTimeline.js} +1 -1
- package/dist/esm/EncounterTimeline/EncounterTimeline.js.map +1 -0
- package/dist/esm/{stories → EncounterTimeline}/EncounterTimeline.stories.d.ts +0 -0
- package/dist/esm/{ErrorBoundary.d.ts → ErrorBoundary/ErrorBoundary.d.ts} +0 -0
- package/dist/esm/{ErrorBoundary.js → ErrorBoundary/ErrorBoundary.js} +4 -1
- package/dist/esm/ErrorBoundary/ErrorBoundary.js.map +1 -0
- package/dist/esm/{ExtensionInput.d.ts → ExtensionInput/ExtensionInput.d.ts} +0 -0
- package/dist/esm/{ExtensionInput.js → ExtensionInput/ExtensionInput.js} +0 -0
- package/dist/esm/ExtensionInput/ExtensionInput.js.map +1 -0
- package/dist/esm/{FhirPathDisplay.d.ts → FhirPathDisplay/FhirPathDisplay.d.ts} +0 -0
- package/dist/esm/{FhirPathDisplay.js → FhirPathDisplay/FhirPathDisplay.js} +1 -1
- package/dist/esm/FhirPathDisplay/FhirPathDisplay.js.map +1 -0
- package/dist/esm/{stories → FhirPathDisplay}/FhirPathDisplay.stories.d.ts +1 -1
- package/dist/esm/{FhirPathTable.d.ts → FhirPathTable/FhirPathTable.d.ts} +1 -2
- package/dist/esm/{FhirPathTable.js → FhirPathTable/FhirPathTable.js} +9 -9
- package/dist/esm/FhirPathTable/FhirPathTable.js.map +1 -0
- package/dist/esm/{Form.d.ts → Form/Form.d.ts} +0 -0
- package/dist/esm/{Form.js → Form/Form.js} +0 -0
- package/dist/esm/Form/Form.js.map +1 -0
- package/dist/esm/{FormUtils.d.ts → Form/FormUtils.d.ts} +0 -0
- package/dist/esm/{FormUtils.js → Form/FormUtils.js} +0 -0
- package/dist/esm/Form/FormUtils.js.map +1 -0
- package/dist/esm/{FormSection.d.ts → FormSection/FormSection.d.ts} +0 -1
- package/dist/esm/FormSection/FormSection.js +10 -0
- package/dist/esm/FormSection/FormSection.js.map +1 -0
- package/dist/esm/{GoogleButton.d.ts → GoogleButton/GoogleButton.d.ts} +0 -0
- package/dist/esm/{GoogleButton.js → GoogleButton/GoogleButton.js} +2 -2
- package/dist/esm/GoogleButton/GoogleButton.js.map +1 -0
- package/dist/esm/{HumanNameDisplay.d.ts → HumanNameDisplay/HumanNameDisplay.d.ts} +0 -0
- package/dist/esm/{HumanNameDisplay.js → HumanNameDisplay/HumanNameDisplay.js} +0 -0
- package/dist/esm/HumanNameDisplay/HumanNameDisplay.js.map +1 -0
- package/dist/esm/{HumanNameInput.d.ts → HumanNameInput/HumanNameInput.d.ts} +0 -0
- package/dist/esm/{HumanNameInput.js → HumanNameInput/HumanNameInput.js} +0 -0
- package/dist/esm/HumanNameInput/HumanNameInput.js.map +1 -0
- package/dist/esm/{IdentifierDisplay.d.ts → IdentifierDisplay/IdentifierDisplay.d.ts} +0 -0
- package/dist/esm/{IdentifierDisplay.js → IdentifierDisplay/IdentifierDisplay.js} +0 -0
- package/dist/esm/IdentifierDisplay/IdentifierDisplay.js.map +1 -0
- package/dist/esm/{IdentifierInput.d.ts → IdentifierInput/IdentifierInput.d.ts} +0 -0
- package/dist/esm/{IdentifierInput.js → IdentifierInput/IdentifierInput.js} +0 -0
- package/dist/esm/IdentifierInput/IdentifierInput.js.map +1 -0
- package/dist/esm/{Logo.d.ts → Logo/Logo.d.ts} +0 -0
- package/dist/esm/{Logo.js → Logo/Logo.js} +0 -0
- package/dist/esm/Logo/Logo.js.map +1 -0
- package/dist/esm/{stories/ResourceHistoryTable.stories.d.ts → Logo/Logo.stories.d.ts} +0 -0
- package/dist/esm/{MedplumLink.d.ts → MedplumLink/MedplumLink.d.ts} +2 -4
- package/dist/esm/{MedplumLink.js → MedplumLink/MedplumLink.js} +12 -9
- package/dist/esm/MedplumLink/MedplumLink.js.map +1 -0
- package/dist/esm/{MedplumProvider.d.ts → MedplumProvider/MedplumProvider.d.ts} +0 -0
- package/dist/esm/{MedplumProvider.js → MedplumProvider/MedplumProvider.js} +0 -0
- package/dist/esm/MedplumProvider/MedplumProvider.js.map +1 -0
- package/dist/esm/{PatientTimeline.d.ts → PatientTimeline/PatientTimeline.d.ts} +0 -0
- package/dist/esm/{PatientTimeline.js → PatientTimeline/PatientTimeline.js} +1 -1
- package/dist/esm/PatientTimeline/PatientTimeline.js.map +1 -0
- package/dist/esm/{stories → PatientTimeline}/PatientTimeline.stories.d.ts +0 -0
- package/dist/esm/{PeriodInput.d.ts → PeriodInput/PeriodInput.d.ts} +0 -0
- package/dist/esm/{PeriodInput.js → PeriodInput/PeriodInput.js} +1 -1
- package/dist/esm/PeriodInput/PeriodInput.js.map +1 -0
- package/dist/esm/{stories → PeriodInput}/PeriodInput.stories.d.ts +0 -0
- package/dist/esm/{PlanDefinitionBuilder.d.ts → PlanDefinitionBuilder/PlanDefinitionBuilder.d.ts} +0 -0
- package/dist/esm/{PlanDefinitionBuilder.js → PlanDefinitionBuilder/PlanDefinitionBuilder.js} +50 -19
- package/dist/esm/PlanDefinitionBuilder/PlanDefinitionBuilder.js.map +1 -0
- package/dist/esm/{stories → PlanDefinitionBuilder}/PlanDefinitionBuilder.stories.d.ts +0 -0
- package/dist/esm/{QuantityDisplay.d.ts → QuantityDisplay/QuantityDisplay.d.ts} +0 -1
- package/dist/esm/QuantityDisplay/QuantityDisplay.js +9 -0
- package/dist/esm/QuantityDisplay/QuantityDisplay.js.map +1 -0
- package/dist/esm/{QuantityInput.d.ts → QuantityInput/QuantityInput.d.ts} +0 -0
- package/dist/esm/{QuantityInput.js → QuantityInput/QuantityInput.js} +2 -2
- package/dist/esm/QuantityInput/QuantityInput.js.map +1 -0
- package/dist/esm/{QuestionnaireBuilder.d.ts → QuestionnaireBuilder/QuestionnaireBuilder.d.ts} +0 -1
- package/dist/esm/{QuestionnaireBuilder.js → QuestionnaireBuilder/QuestionnaireBuilder.js} +86 -39
- package/dist/esm/QuestionnaireBuilder/QuestionnaireBuilder.js.map +1 -0
- package/dist/esm/{stories → QuestionnaireBuilder}/QuestionnaireBuilder.stories.d.ts +0 -0
- package/dist/{cjs → esm/QuestionnaireForm}/QuestionnaireForm.d.ts +0 -1
- package/dist/esm/{QuestionnaireForm.js → QuestionnaireForm/QuestionnaireForm.js} +37 -27
- package/dist/esm/QuestionnaireForm/QuestionnaireForm.js.map +1 -0
- package/dist/esm/{stories → QuestionnaireForm}/QuestionnaireForm.stories.d.ts +0 -0
- package/dist/{cjs → esm/RangeDisplay}/RangeDisplay.d.ts +0 -1
- package/dist/esm/RangeDisplay/RangeDisplay.js +9 -0
- package/dist/esm/RangeDisplay/RangeDisplay.js.map +1 -0
- package/dist/esm/{RangeInput.d.ts → RangeInput/RangeInput.d.ts} +0 -0
- package/dist/esm/{RangeInput.js → RangeInput/RangeInput.js} +1 -1
- package/dist/esm/RangeInput/RangeInput.js.map +1 -0
- package/dist/esm/{RatioDisplay.d.ts → RatioDisplay/RatioDisplay.d.ts} +0 -0
- package/dist/esm/{RatioDisplay.js → RatioDisplay/RatioDisplay.js} +1 -1
- package/dist/esm/RatioDisplay/RatioDisplay.js.map +1 -0
- package/dist/esm/{RatioInput.d.ts → RatioInput/RatioInput.d.ts} +0 -0
- package/dist/esm/{RatioInput.js → RatioInput/RatioInput.js} +1 -1
- package/dist/esm/RatioInput/RatioInput.js.map +1 -0
- package/dist/esm/{ReferenceDisplay.d.ts → ReferenceDisplay/ReferenceDisplay.d.ts} +0 -0
- package/dist/esm/{ReferenceDisplay.js → ReferenceDisplay/ReferenceDisplay.js} +1 -1
- package/dist/esm/ReferenceDisplay/ReferenceDisplay.js.map +1 -0
- package/dist/esm/{ReferenceInput.d.ts → ReferenceInput/ReferenceInput.d.ts} +0 -0
- package/dist/esm/{ReferenceInput.js → ReferenceInput/ReferenceInput.js} +1 -1
- package/dist/esm/ReferenceInput/ReferenceInput.js.map +1 -0
- package/dist/esm/{stories → ReferenceInput}/ReferenceInput.stories.d.ts +0 -0
- package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.d.ts +27 -0
- package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.js +269 -0
- package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.js.map +1 -0
- package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.stories.d.ts +7 -0
- package/dist/esm/{RequestGroupDisplay.d.ts → RequestGroupDisplay/RequestGroupDisplay.d.ts} +0 -1
- package/dist/esm/{RequestGroupDisplay.js → RequestGroupDisplay/RequestGroupDisplay.js} +12 -11
- package/dist/esm/RequestGroupDisplay/RequestGroupDisplay.js.map +1 -0
- package/dist/esm/{stories → RequestGroupDisplay}/RequestGroupDisplay.stories.d.ts +0 -0
- package/dist/esm/{ResourceArrayDisplay.d.ts → ResourceArrayDisplay/ResourceArrayDisplay.d.ts} +0 -0
- package/dist/esm/{ResourceArrayDisplay.js → ResourceArrayDisplay/ResourceArrayDisplay.js} +1 -1
- package/dist/esm/ResourceArrayDisplay/ResourceArrayDisplay.js.map +1 -0
- package/dist/esm/{ResourceArrayInput.d.ts → ResourceArrayInput/ResourceArrayInput.d.ts} +0 -0
- package/dist/esm/{ResourceArrayInput.js → ResourceArrayInput/ResourceArrayInput.js} +2 -2
- package/dist/esm/ResourceArrayInput/ResourceArrayInput.js.map +1 -0
- package/dist/esm/{ResourceAvatar.d.ts → ResourceAvatar/ResourceAvatar.d.ts} +0 -0
- package/dist/esm/{ResourceAvatar.js → ResourceAvatar/ResourceAvatar.js} +2 -2
- package/dist/esm/ResourceAvatar/ResourceAvatar.js.map +1 -0
- package/dist/esm/{stories → ResourceAvatar}/ResourceAvatar.stories.d.ts +0 -0
- package/dist/{cjs → esm/ResourceBadge}/ResourceBadge.d.ts +0 -1
- package/dist/esm/{ResourceBadge.js → ResourceBadge/ResourceBadge.js} +4 -3
- package/dist/esm/ResourceBadge/ResourceBadge.js.map +1 -0
- package/dist/{cjs → esm/ResourceBlame}/ResourceBlame.d.ts +0 -1
- package/dist/esm/ResourceBlame/ResourceBlame.js +114 -0
- package/dist/esm/ResourceBlame/ResourceBlame.js.map +1 -0
- package/dist/esm/{stories/Scheduler.stories.d.ts → ResourceBlame/ResourceBlame.stories.d.ts} +0 -0
- package/dist/{cjs → esm/ResourceDiff}/ResourceDiff.d.ts +0 -1
- package/dist/esm/{ResourceDiff.js → ResourceDiff/ResourceDiff.js} +14 -3
- package/dist/esm/ResourceDiff/ResourceDiff.js.map +1 -0
- package/dist/esm/{ResourceDiffTable.d.ts → ResourceDiffTable/ResourceDiffTable.d.ts} +0 -2
- package/dist/esm/{ResourceDiffTable.js → ResourceDiffTable/ResourceDiffTable.js} +27 -5
- package/dist/esm/ResourceDiffTable/ResourceDiffTable.js.map +1 -0
- package/dist/esm/ResourceDiffTable/ResourceDiffTable.stories.d.ts +5 -0
- package/dist/esm/{ResourceForm.d.ts → ResourceForm/ResourceForm.d.ts} +0 -0
- package/dist/esm/{ResourceForm.js → ResourceForm/ResourceForm.js} +11 -10
- package/dist/esm/ResourceForm/ResourceForm.js.map +1 -0
- package/dist/esm/{stories → ResourceForm}/ResourceForm.stories.d.ts +0 -0
- package/dist/esm/{ResourceHistoryTable.d.ts → ResourceHistoryTable/ResourceHistoryTable.d.ts} +0 -0
- package/dist/esm/{ResourceHistoryTable.js → ResourceHistoryTable/ResourceHistoryTable.js} +3 -3
- package/dist/esm/ResourceHistoryTable/ResourceHistoryTable.js.map +1 -0
- package/dist/esm/{stories/Timeline.stories.d.ts → ResourceHistoryTable/ResourceHistoryTable.stories.d.ts} +0 -0
- package/dist/esm/{ResourceInput.d.ts → ResourceInput/ResourceInput.d.ts} +0 -0
- package/dist/esm/{ResourceInput.js → ResourceInput/ResourceInput.js} +26 -5
- package/dist/esm/ResourceInput/ResourceInput.js.map +1 -0
- package/dist/esm/{stories → ResourceInput}/ResourceInput.stories.d.ts +0 -0
- package/dist/{cjs → esm/ResourceName}/ResourceName.d.ts +2 -1
- package/dist/esm/ResourceName/ResourceName.js +19 -0
- package/dist/esm/ResourceName/ResourceName.js.map +1 -0
- package/dist/esm/{ResourcePropertyDisplay.d.ts → ResourcePropertyDisplay/ResourcePropertyDisplay.d.ts} +0 -0
- package/dist/esm/{ResourcePropertyDisplay.js → ResourcePropertyDisplay/ResourcePropertyDisplay.js} +21 -21
- package/dist/esm/ResourcePropertyDisplay/ResourcePropertyDisplay.js.map +1 -0
- package/dist/esm/{ResourcePropertyInput.d.ts → ResourcePropertyInput/ResourcePropertyInput.d.ts} +0 -0
- package/dist/esm/{ResourcePropertyInput.js → ResourcePropertyInput/ResourcePropertyInput.js} +22 -22
- package/dist/esm/ResourcePropertyInput/ResourcePropertyInput.js.map +1 -0
- package/dist/esm/{ResourceTable.d.ts → ResourceTable/ResourceTable.d.ts} +0 -0
- package/dist/esm/{ResourceTable.js → ResourceTable/ResourceTable.js} +3 -3
- package/dist/esm/ResourceTable/ResourceTable.js.map +1 -0
- package/dist/esm/{stories → ResourceTable}/ResourceTable.stories.d.ts +0 -0
- package/dist/esm/{ResourceTimeline.d.ts → ResourceTimeline/ResourceTimeline.d.ts} +0 -1
- package/dist/esm/{ResourceTimeline.js → ResourceTimeline/ResourceTimeline.js} +91 -37
- package/dist/esm/ResourceTimeline/ResourceTimeline.js.map +1 -0
- package/dist/esm/{Scheduler.d.ts → Scheduler/Scheduler.d.ts} +0 -1
- package/dist/esm/{Scheduler.js → Scheduler/Scheduler.js} +26 -10
- package/dist/esm/Scheduler/Scheduler.js.map +1 -0
- package/dist/esm/Scheduler/Scheduler.stories.d.ts +5 -0
- package/dist/{cjs → esm/SearchControl}/SearchControl.d.ts +0 -1
- package/dist/esm/{SearchControl.js → SearchControl/SearchControl.js} +44 -28
- package/dist/esm/SearchControl/SearchControl.js.map +1 -0
- package/dist/esm/{stories → SearchControl}/SearchControl.stories.d.ts +0 -0
- package/dist/esm/{SearchControlField.d.ts → SearchControl/SearchControlField.d.ts} +0 -0
- package/dist/esm/{SearchControlField.js → SearchControl/SearchControlField.js} +0 -0
- package/dist/esm/SearchControl/SearchControlField.js.map +1 -0
- package/dist/esm/{SearchUtils.d.ts → SearchControl/SearchUtils.d.ts} +0 -21
- package/dist/esm/{SearchUtils.js → SearchControl/SearchUtils.js} +2 -33
- package/dist/esm/SearchControl/SearchUtils.js.map +1 -0
- package/dist/esm/{SearchFieldEditor.d.ts → SearchFieldEditor/SearchFieldEditor.d.ts} +0 -0
- package/dist/esm/{SearchFieldEditor.js → SearchFieldEditor/SearchFieldEditor.js} +1 -1
- package/dist/esm/SearchFieldEditor/SearchFieldEditor.js.map +1 -0
- package/dist/esm/{SearchFilterEditor.d.ts → SearchFilterEditor/SearchFilterEditor.d.ts} +0 -1
- package/dist/esm/{SearchFilterEditor.js → SearchFilterEditor/SearchFilterEditor.js} +5 -5
- package/dist/esm/SearchFilterEditor/SearchFilterEditor.js.map +1 -0
- package/dist/esm/{SearchFilterValueDialog.d.ts → SearchFilterValueDialog/SearchFilterValueDialog.d.ts} +0 -0
- package/dist/esm/{SearchFilterValueDialog.js → SearchFilterValueDialog/SearchFilterValueDialog.js} +2 -2
- package/dist/esm/SearchFilterValueDialog/SearchFilterValueDialog.js.map +1 -0
- package/dist/esm/{SearchFilterValueDisplay.d.ts → SearchFilterValueDisplay/SearchFilterValueDisplay.d.ts} +0 -0
- package/dist/esm/{SearchFilterValueDisplay.js → SearchFilterValueDisplay/SearchFilterValueDisplay.js} +1 -1
- package/dist/esm/SearchFilterValueDisplay/SearchFilterValueDisplay.js.map +1 -0
- package/dist/esm/{SearchFilterValueInput.d.ts → SearchFilterValueInput/SearchFilterValueInput.d.ts} +0 -0
- package/dist/esm/{SearchFilterValueInput.js → SearchFilterValueInput/SearchFilterValueInput.js} +3 -3
- package/dist/esm/SearchFilterValueInput/SearchFilterValueInput.js.map +1 -0
- package/dist/esm/{SearchPopupMenu.d.ts → SearchPopupMenu/SearchPopupMenu.d.ts} +0 -0
- package/dist/esm/{SearchPopupMenu.js → SearchPopupMenu/SearchPopupMenu.js} +1 -1
- package/dist/esm/SearchPopupMenu/SearchPopupMenu.js.map +1 -0
- package/dist/esm/{ServiceRequestTimeline.d.ts → ServiceRequestTimeline/ServiceRequestTimeline.d.ts} +0 -0
- package/dist/esm/{ServiceRequestTimeline.js → ServiceRequestTimeline/ServiceRequestTimeline.js} +1 -1
- package/dist/esm/ServiceRequestTimeline/ServiceRequestTimeline.js.map +1 -0
- package/dist/esm/{StatusBadge.d.ts → StatusBadge/StatusBadge.d.ts} +0 -0
- package/dist/esm/{StatusBadge.js → StatusBadge/StatusBadge.js} +0 -0
- package/dist/esm/StatusBadge/StatusBadge.js.map +1 -0
- package/dist/esm/{stories → StatusBadge}/StatusBadge.stories.d.ts +0 -0
- package/dist/{cjs → esm/Timeline}/Timeline.d.ts +0 -1
- package/dist/esm/Timeline/Timeline.js +37 -0
- package/dist/esm/Timeline/Timeline.js.map +1 -0
- package/dist/esm/Timeline/Timeline.stories.d.ts +5 -0
- package/dist/esm/{TimingInput.d.ts → TimingInput/TimingInput.d.ts} +0 -0
- package/dist/esm/{TimingInput.js → TimingInput/TimingInput.js} +2 -2
- package/dist/esm/TimingInput/TimingInput.js.map +1 -0
- package/dist/esm/{stories → TimingInput}/TimingInput.stories.d.ts +0 -0
- package/dist/esm/{ValueSetAutocomplete.d.ts → ValueSetAutocomplete/ValueSetAutocomplete.d.ts} +0 -0
- package/dist/esm/{ValueSetAutocomplete.js → ValueSetAutocomplete/ValueSetAutocomplete.js} +5 -5
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.js.map +1 -0
- package/dist/esm/auth/AuthenticationForm.d.ts +2 -9
- package/dist/esm/auth/AuthenticationForm.js +16 -33
- package/dist/esm/auth/AuthenticationForm.js.map +1 -1
- package/dist/esm/auth/ChooseProfileForm.js +5 -5
- package/dist/esm/auth/ChooseProfileForm.js.map +1 -1
- package/dist/esm/auth/ChooseScopeForm.d.ts +7 -0
- package/dist/esm/auth/ChooseScopeForm.js +28 -0
- package/dist/esm/auth/ChooseScopeForm.js.map +1 -0
- package/dist/esm/auth/NewProjectForm.js +6 -6
- package/dist/esm/auth/NewProjectForm.js.map +1 -1
- package/dist/esm/auth/NewUserForm.js +7 -6
- package/dist/esm/auth/NewUserForm.js.map +1 -1
- package/dist/esm/auth/RegisterForm.d.ts +0 -1
- package/dist/esm/auth/RegisterForm.js +2 -2
- package/dist/esm/auth/RegisterForm.js.map +1 -1
- package/dist/esm/{stories → auth}/RegisterForm.stories.d.ts +0 -0
- package/dist/esm/auth/SignInForm.d.ts +3 -10
- package/dist/esm/auth/SignInForm.js +30 -13
- package/dist/esm/auth/SignInForm.js.map +1 -1
- package/dist/esm/{stories → auth}/SignInForm.stories.d.ts +0 -0
- package/dist/esm/index.d.ts +66 -65
- package/dist/esm/index.js +66 -65
- 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/stories/referenceLab.d.ts +3 -0
- package/dist/esm/{useResource.d.ts → useResource/useResource.d.ts} +0 -0
- package/dist/esm/{useResource.js → useResource/useResource.js} +1 -1
- package/dist/esm/useResource/useResource.js.map +1 -0
- package/dist/esm/{QuestionnaireUtils.d.ts → utils/questionnaire.d.ts} +0 -0
- package/dist/esm/{QuestionnaireUtils.js → utils/questionnaire.js} +1 -1
- package/dist/esm/utils/questionnaire.js.map +1 -0
- package/dist/esm/utils/recaptcha.js +1 -1
- package/dist/esm/utils/recaptcha.js.map +1 -1
- package/dist/esm/{utils.d.ts → utils/script.d.ts} +0 -0
- package/dist/esm/{utils.js → utils/script.js} +1 -1
- package/dist/esm/utils/script.js.map +1 -0
- package/package.json +44 -33
- package/rollup.config.mjs +111 -0
- package/dist/cjs/defaulttheme.css +0 -192
- package/dist/cjs/styles.css +0 -528
- package/dist/esm/AddressDisplay.js.map +0 -1
- package/dist/esm/AddressInput.js.map +0 -1
- package/dist/esm/AnnotationInput.js.map +0 -1
- package/dist/esm/AttachmentArrayDisplay.js.map +0 -1
- package/dist/esm/AttachmentArrayInput.js.map +0 -1
- package/dist/esm/AttachmentButton.js.map +0 -1
- package/dist/esm/AttachmentDisplay.js.map +0 -1
- package/dist/esm/AttachmentInput.js.map +0 -1
- package/dist/esm/BackboneElementDisplay.js.map +0 -1
- package/dist/esm/BackboneElementInput.js.map +0 -1
- package/dist/esm/CalendarInput.js.map +0 -1
- package/dist/esm/CheckboxFormSection.js +0 -12
- package/dist/esm/CheckboxFormSection.js.map +0 -1
- package/dist/esm/CodeInput.js.map +0 -1
- package/dist/esm/CodeableConceptDisplay.js.map +0 -1
- package/dist/esm/CodeableConceptInput.js.map +0 -1
- package/dist/esm/CodingDisplay.js.map +0 -1
- package/dist/esm/CodingInput.js.map +0 -1
- package/dist/esm/ContactDetailDisplay.js.map +0 -1
- package/dist/esm/ContactDetailInput.js.map +0 -1
- package/dist/esm/ContactPointDisplay.js.map +0 -1
- package/dist/esm/ContactPointInput.js.map +0 -1
- package/dist/esm/DateTimeInput.js.map +0 -1
- package/dist/esm/DefaultResourceTimeline.js.map +0 -1
- package/dist/esm/DescriptionList.js +0 -13
- package/dist/esm/DescriptionList.js.map +0 -1
- package/dist/esm/DiagnosticReportDisplay.js.map +0 -1
- package/dist/esm/Document.js +0 -9
- package/dist/esm/Document.js.map +0 -1
- package/dist/esm/EncounterTimeline.js.map +0 -1
- package/dist/esm/ErrorBoundary.js.map +0 -1
- package/dist/esm/ExtensionInput.js.map +0 -1
- package/dist/esm/FhirPathDisplay.js.map +0 -1
- package/dist/esm/FhirPathTable.js.map +0 -1
- package/dist/esm/Form.js.map +0 -1
- package/dist/esm/FormSection.js +0 -18
- package/dist/esm/FormSection.js.map +0 -1
- package/dist/esm/FormUtils.js.map +0 -1
- package/dist/esm/GoogleButton.js.map +0 -1
- package/dist/esm/HumanNameDisplay.js.map +0 -1
- package/dist/esm/HumanNameInput.js.map +0 -1
- package/dist/esm/IdentifierDisplay.js.map +0 -1
- package/dist/esm/IdentifierInput.js.map +0 -1
- package/dist/esm/Logo.js.map +0 -1
- package/dist/esm/MedplumLink.js.map +0 -1
- package/dist/esm/MedplumProvider.js.map +0 -1
- package/dist/esm/PatientTimeline.js.map +0 -1
- package/dist/esm/PeriodInput.js.map +0 -1
- package/dist/esm/PlanDefinitionBuilder.js.map +0 -1
- package/dist/esm/QuantityDisplay.js +0 -28
- package/dist/esm/QuantityDisplay.js.map +0 -1
- package/dist/esm/QuantityInput.js.map +0 -1
- package/dist/esm/QuestionnaireBuilder.js.map +0 -1
- package/dist/esm/QuestionnaireForm.js.map +0 -1
- package/dist/esm/QuestionnaireUtils.js.map +0 -1
- package/dist/esm/RangeDisplay.js +0 -21
- package/dist/esm/RangeDisplay.js.map +0 -1
- package/dist/esm/RangeInput.js.map +0 -1
- package/dist/esm/RatioDisplay.js.map +0 -1
- package/dist/esm/RatioInput.js.map +0 -1
- package/dist/esm/ReferenceDisplay.js.map +0 -1
- package/dist/esm/ReferenceInput.js.map +0 -1
- package/dist/esm/RequestGroupDisplay.js.map +0 -1
- package/dist/esm/ResourceArrayDisplay.js.map +0 -1
- package/dist/esm/ResourceArrayInput.js.map +0 -1
- package/dist/esm/ResourceAvatar.js.map +0 -1
- package/dist/esm/ResourceBadge.js.map +0 -1
- package/dist/esm/ResourceBlame.js +0 -65
- package/dist/esm/ResourceBlame.js.map +0 -1
- package/dist/esm/ResourceDiff.js.map +0 -1
- package/dist/esm/ResourceDiffTable.js.map +0 -1
- package/dist/esm/ResourceForm.js.map +0 -1
- package/dist/esm/ResourceHistoryTable.js.map +0 -1
- package/dist/esm/ResourceInput.js.map +0 -1
- package/dist/esm/ResourceName.js +0 -16
- package/dist/esm/ResourceName.js.map +0 -1
- package/dist/esm/ResourcePropertyDisplay.js.map +0 -1
- package/dist/esm/ResourcePropertyInput.js.map +0 -1
- package/dist/esm/ResourceTable.js.map +0 -1
- package/dist/esm/ResourceTimeline.js.map +0 -1
- package/dist/esm/Scheduler.js.map +0 -1
- package/dist/esm/SearchControl.js.map +0 -1
- package/dist/esm/SearchControlField.js.map +0 -1
- package/dist/esm/SearchFieldEditor.js.map +0 -1
- package/dist/esm/SearchFilterEditor.js.map +0 -1
- package/dist/esm/SearchFilterValueDialog.js.map +0 -1
- package/dist/esm/SearchFilterValueDisplay.js.map +0 -1
- package/dist/esm/SearchFilterValueInput.js.map +0 -1
- package/dist/esm/SearchPopupMenu.js.map +0 -1
- package/dist/esm/SearchUtils.js.map +0 -1
- package/dist/esm/ServiceRequestTimeline.js.map +0 -1
- package/dist/esm/StatusBadge.js.map +0 -1
- package/dist/esm/Timeline.js +0 -40
- package/dist/esm/Timeline.js.map +0 -1
- package/dist/esm/TimingInput.js.map +0 -1
- package/dist/esm/ValueSetAutocomplete.js.map +0 -1
- package/dist/esm/defaulttheme.css +0 -192
- package/dist/esm/styles.css +0 -528
- package/dist/esm/useResource.js.map +0 -1
- package/dist/esm/utils.js.map +0 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@medplum/core'), require('react'), require('@mantine/core'), require('@tabler/icons'), require('react-router-dom')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@medplum/core', 'react', '@mantine/core', '@tabler/icons', 'react-router-dom'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.medplum = global.medplum || {}, global.medplum.
|
|
5
|
-
})(this, (function (exports, core, React, core$1, icons, reactRouterDom) { 'use strict';
|
|
6
|
-
|
|
7
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
-
|
|
9
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@medplum/core'), require('react'), require('@mantine/core'), require('@tabler/icons'), require('react-router-dom'), require('@mantine/notifications')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@medplum/core', 'react', '@mantine/core', '@tabler/icons', 'react-router-dom', '@mantine/notifications'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.medplum = global.medplum || {}, global.medplum.react = {}), global.medplum.core, global.React, global.mantine.core, global.tabler.icons, global.ReactRouterDOM, global.mantine.notifications));
|
|
5
|
+
})(this, (function (exports, core, React, core$1, icons, reactRouterDom, notifications) { 'use strict';
|
|
10
6
|
|
|
11
7
|
function AddressDisplay(props) {
|
|
12
8
|
const address = props.value;
|
|
13
9
|
if (!address) {
|
|
14
10
|
return null;
|
|
15
11
|
}
|
|
16
|
-
return
|
|
12
|
+
return React.createElement(React.Fragment, null, core.formatAddress(address));
|
|
17
13
|
}
|
|
18
14
|
|
|
19
15
|
function getLine(address, index) {
|
|
@@ -58,14 +54,14 @@
|
|
|
58
54
|
function setPostalCode(postalCode) {
|
|
59
55
|
setValueWrapper(Object.assign(Object.assign({}, valueRef.current), { postalCode }));
|
|
60
56
|
}
|
|
61
|
-
return (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
57
|
+
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
58
|
+
React.createElement(core$1.NativeSelect, { "data-testid": "address-use", defaultValue: value === null || value === void 0 ? void 0 : value.use, onChange: (e) => setUse(e.currentTarget.value), data: ['', 'home', 'work', 'temp', 'old', 'billing'] }),
|
|
59
|
+
React.createElement(core$1.NativeSelect, { "data-testid": "address-type", defaultValue: value === null || value === void 0 ? void 0 : value.type, onChange: (e) => setType(e.currentTarget.value), data: ['', 'postal', 'physical', 'both'] }),
|
|
60
|
+
React.createElement(core$1.TextInput, { placeholder: "Line 1", defaultValue: getLine(value, 0), onChange: (e) => setLine1(e.currentTarget.value) }),
|
|
61
|
+
React.createElement(core$1.TextInput, { placeholder: "Line 2", defaultValue: getLine(value, 1), onChange: (e) => setLine2(e.currentTarget.value) }),
|
|
62
|
+
React.createElement(core$1.TextInput, { placeholder: "City", defaultValue: value.city, onChange: (e) => setCity(e.currentTarget.value) }),
|
|
63
|
+
React.createElement(core$1.TextInput, { placeholder: "State", defaultValue: value.state, onChange: (e) => setState(e.currentTarget.value) }),
|
|
64
|
+
React.createElement(core$1.TextInput, { placeholder: "Postal Code", defaultValue: value.postalCode, onChange: (e) => setPostalCode(e.currentTarget.value) })));
|
|
69
65
|
}
|
|
70
66
|
|
|
71
67
|
function AttachmentDisplay(props) {
|
|
@@ -74,20 +70,20 @@
|
|
|
74
70
|
if (!url) {
|
|
75
71
|
return null;
|
|
76
72
|
}
|
|
77
|
-
return (
|
|
78
|
-
(contentType === null || contentType === void 0 ? void 0 : contentType.startsWith('image/')) && (
|
|
79
|
-
(contentType === null || contentType === void 0 ? void 0 : contentType.startsWith('video/')) && (
|
|
80
|
-
|
|
81
|
-
contentType === 'application/pdf' && !(title === null || title === void 0 ? void 0 : title.endsWith('.pdf')) && (
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
73
|
+
return (React.createElement("div", { "data-testid": "attachment-display" },
|
|
74
|
+
(contentType === null || contentType === void 0 ? void 0 : contentType.startsWith('image/')) && (React.createElement("img", { "data-testid": "attachment-image", style: { maxWidth: props.maxWidth }, src: url, alt: value === null || value === void 0 ? void 0 : value.title })),
|
|
75
|
+
(contentType === null || contentType === void 0 ? void 0 : contentType.startsWith('video/')) && (React.createElement("video", { "data-testid": "attachment-video", style: { maxWidth: props.maxWidth }, controls: true },
|
|
76
|
+
React.createElement("source", { type: contentType, src: url }))),
|
|
77
|
+
contentType === 'application/pdf' && !(title === null || title === void 0 ? void 0 : title.endsWith('.pdf')) && (React.createElement("div", { "data-testid": "attachment-pdf", style: { maxWidth: props.maxWidth, minHeight: 400 } },
|
|
78
|
+
React.createElement("iframe", { width: "100%", height: "400", src: url + '#navpanes=0', allowFullScreen: true, frameBorder: 0, seamless: true }))),
|
|
79
|
+
React.createElement("div", { "data-testid": "download-link", style: { padding: '2px 16px 16px 16px' } },
|
|
80
|
+
React.createElement("a", { href: value === null || value === void 0 ? void 0 : value.url, "data-testid": "attachment-details", target: "_blank", rel: "noopener noreferrer" }, (value === null || value === void 0 ? void 0 : value.title) || 'Download'))));
|
|
85
81
|
}
|
|
86
82
|
|
|
87
83
|
function AttachmentArrayDisplay(props) {
|
|
88
|
-
return (
|
|
89
|
-
props.values.map((v, index) => (
|
|
90
|
-
|
|
84
|
+
return (React.createElement("div", null, props.values &&
|
|
85
|
+
props.values.map((v, index) => (React.createElement("div", { key: 'attatchment-' + index },
|
|
86
|
+
React.createElement(AttachmentDisplay, { value: v, maxWidth: props.maxWidth }))))));
|
|
91
87
|
}
|
|
92
88
|
|
|
93
89
|
const reactContext = React.createContext(undefined);
|
|
@@ -112,7 +108,7 @@
|
|
|
112
108
|
return () => medplum.removeEventListeneer('change', eventListener);
|
|
113
109
|
}, [medplum, state]);
|
|
114
110
|
const medplumContext = Object.assign(Object.assign({}, state), { medplum });
|
|
115
|
-
return
|
|
111
|
+
return React.createElement(reactContext.Provider, { value: medplumContext }, props.children);
|
|
116
112
|
}
|
|
117
113
|
/**
|
|
118
114
|
* Returns the MedplumContext instance.
|
|
@@ -196,10 +192,13 @@
|
|
|
196
192
|
if (!fileName) {
|
|
197
193
|
return;
|
|
198
194
|
}
|
|
195
|
+
if (props.onUploadStart) {
|
|
196
|
+
props.onUploadStart();
|
|
197
|
+
}
|
|
199
198
|
const filename = file.name;
|
|
200
199
|
const contentType = file.type || 'application/octet-stream';
|
|
201
200
|
medplum
|
|
202
|
-
.createBinary(file, filename, contentType)
|
|
201
|
+
.createBinary(file, filename, contentType, props.onUploadProgress)
|
|
203
202
|
.then((binary) => {
|
|
204
203
|
props.onUpload({
|
|
205
204
|
contentType: binary.contentType,
|
|
@@ -212,8 +211,8 @@
|
|
|
212
211
|
alert((_c = (_b = (_a = outcome === null || outcome === void 0 ? void 0 : outcome.issue) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.details) === null || _c === void 0 ? void 0 : _c.text);
|
|
213
212
|
});
|
|
214
213
|
}
|
|
215
|
-
return (
|
|
216
|
-
|
|
214
|
+
return (React.createElement(React.Fragment, null,
|
|
215
|
+
React.createElement("input", { type: "file", "data-testid": "upload-file-input", style: { display: 'none' }, ref: fileInputRef, onChange: (e) => onFileChange(e) }),
|
|
217
216
|
props.children({ onClick })));
|
|
218
217
|
}
|
|
219
218
|
|
|
@@ -228,29 +227,29 @@
|
|
|
228
227
|
props.onChange(newValues);
|
|
229
228
|
}
|
|
230
229
|
}
|
|
231
|
-
return (
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
values.map((v, index) => (
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
230
|
+
return (React.createElement("table", { style: { width: '100%' } },
|
|
231
|
+
React.createElement("colgroup", null,
|
|
232
|
+
React.createElement("col", { width: "97%" }),
|
|
233
|
+
React.createElement("col", { width: "3%" })),
|
|
234
|
+
React.createElement("tbody", null,
|
|
235
|
+
values.map((v, index) => (React.createElement("tr", { key: `${index}-${values.length}` },
|
|
236
|
+
React.createElement("td", null,
|
|
237
|
+
React.createElement(AttachmentDisplay, { value: v, maxWidth: 200 })),
|
|
238
|
+
React.createElement("td", null,
|
|
239
|
+
React.createElement(core$1.ActionIcon, { title: "Remove", size: "sm", onClick: (e) => {
|
|
241
240
|
killEvent(e);
|
|
242
241
|
const copy = values.slice();
|
|
243
242
|
copy.splice(index, 1);
|
|
244
243
|
setValuesWrapper(copy);
|
|
245
244
|
} },
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
245
|
+
React.createElement(icons.IconCircleMinus, null)))))),
|
|
246
|
+
React.createElement("tr", null,
|
|
247
|
+
React.createElement("td", null),
|
|
248
|
+
React.createElement("td", null,
|
|
249
|
+
React.createElement(AttachmentButton, { onUpload: (attachment) => {
|
|
251
250
|
setValuesWrapper([...valuesRef.current, attachment]);
|
|
252
|
-
} }, (props) => (
|
|
253
|
-
|
|
251
|
+
} }, (props) => (React.createElement(core$1.ActionIcon, Object.assign({}, props, { title: "Add", size: "sm", color: "green" }),
|
|
252
|
+
React.createElement(icons.IconCloudUpload, { size: 16 })))))))));
|
|
254
253
|
}
|
|
255
254
|
|
|
256
255
|
function AttachmentInput(props) {
|
|
@@ -262,19 +261,23 @@
|
|
|
262
261
|
}
|
|
263
262
|
}
|
|
264
263
|
if (value) {
|
|
265
|
-
return (
|
|
266
|
-
|
|
267
|
-
|
|
264
|
+
return (React.createElement(React.Fragment, null,
|
|
265
|
+
React.createElement(AttachmentDisplay, { value: value, maxWidth: 200 }),
|
|
266
|
+
React.createElement(core$1.Button, { onClick: (e) => {
|
|
268
267
|
killEvent(e);
|
|
269
268
|
setValueWrapper(undefined);
|
|
270
269
|
} }, "Remove")));
|
|
271
270
|
}
|
|
272
|
-
return (
|
|
271
|
+
return (React.createElement(AttachmentButton, { onUpload: setValueWrapper }, (props) => React.createElement(core$1.Button, Object.assign({}, props), "Upload...")));
|
|
273
272
|
}
|
|
274
273
|
|
|
275
274
|
function Document(props) {
|
|
276
|
-
|
|
277
|
-
|
|
275
|
+
let style = undefined;
|
|
276
|
+
if (props.width) {
|
|
277
|
+
style = { maxWidth: props.width };
|
|
278
|
+
}
|
|
279
|
+
return (React.createElement(core$1.Container, null,
|
|
280
|
+
React.createElement(core$1.Paper, { style: style, mx: "auto", my: "lg", p: "lg", shadow: "xs", radius: "sm", withBorder: true }, props.children)));
|
|
278
281
|
}
|
|
279
282
|
|
|
280
283
|
/******************************************************************************
|
|
@@ -362,7 +365,7 @@
|
|
|
362
365
|
}
|
|
363
366
|
|
|
364
367
|
function Form(props) {
|
|
365
|
-
return (
|
|
368
|
+
return (React.createElement("form", { style: props.style, "data-testid": props.testid, onSubmit: (e) => {
|
|
366
369
|
e.preventDefault();
|
|
367
370
|
const formData = parseForm(e.target);
|
|
368
371
|
if (props.onSubmit) {
|
|
@@ -372,13 +375,13 @@
|
|
|
372
375
|
}
|
|
373
376
|
|
|
374
377
|
function Logo(props) {
|
|
375
|
-
return (
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
378
|
+
return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 491 491", style: { width: props.size, height: props.size } },
|
|
379
|
+
React.createElement("title", null, "Medplum Logo"),
|
|
380
|
+
React.createElement("path", { fill: props.fill || '#ad7136', d: "M282 67c6-16 16-29 29-40L289 0c-22 17-37 41-43 68l17 23 19-24z" }),
|
|
381
|
+
React.createElement("path", { fill: props.fill || '#946af9', d: "M311 63c-17 0-33 4-48 11-16-7-32-11-49-11-87 0-158 96-158 214s71 214 158 214c17 0 33-4 49-11 15 7 31 11 48 11 87 0 158-96 158-214S398 63 311 63z" }),
|
|
382
|
+
React.createElement("path", { fill: props.fill || '#7857c5', d: "M231 489l-17 2c-87 0-158-96-158-214S127 63 214 63l17 1c-39 12-70 102-70 213s31 201 70 212z" }),
|
|
383
|
+
React.createElement("path", { fill: props.fill || '#40bc26', d: "M207 220a176 176 0 01-177 43A176 176 0 01251 43l1 5c17 59 2 125-45 172z" }),
|
|
384
|
+
React.createElement("path", { fill: props.fill || '#33961e', d: "M252 48A421 421 0 0057 270l-27-7A176 176 0 01251 43l1 5z" })));
|
|
382
385
|
}
|
|
383
386
|
|
|
384
387
|
function getErrorsForInput(outcome, expression) {
|
|
@@ -411,7 +414,7 @@
|
|
|
411
414
|
function NewProjectForm(props) {
|
|
412
415
|
const medplum = useMedplum();
|
|
413
416
|
const [outcome, setOutcome] = React.useState();
|
|
414
|
-
return (
|
|
417
|
+
return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: (formData) => __awaiter(this, void 0, void 0, function* () {
|
|
415
418
|
try {
|
|
416
419
|
props.handleAuthResponse(yield medplum.startNewProject({
|
|
417
420
|
login: props.login,
|
|
@@ -422,19 +425,19 @@
|
|
|
422
425
|
setOutcome(err);
|
|
423
426
|
}
|
|
424
427
|
}) },
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
428
|
+
React.createElement(core$1.Center, { sx: { flexDirection: 'column' } },
|
|
429
|
+
React.createElement(Logo, { size: 32 }),
|
|
430
|
+
React.createElement(core$1.Title, null, "Create project")),
|
|
431
|
+
React.createElement(core$1.Stack, { spacing: "xl" },
|
|
432
|
+
React.createElement(core$1.TextInput, { name: "projectName", label: "Project Name", placeholder: "My Project", required: true, autoFocus: true, error: getErrorsForInput(outcome, 'firstName') }),
|
|
433
|
+
React.createElement(core$1.Text, { color: "dimmed", size: "xs" },
|
|
431
434
|
"By clicking submit you agree to the Medplum ",
|
|
432
|
-
|
|
435
|
+
React.createElement("a", { href: "https://www.medplum.com/privacy" }, "Privacy\u00A0Policy"),
|
|
433
436
|
' and ',
|
|
434
|
-
|
|
437
|
+
React.createElement("a", { href: "https://www.medplum.com/terms" }, "Terms\u00A0of\u00A0Service"),
|
|
435
438
|
".")),
|
|
436
|
-
|
|
437
|
-
|
|
439
|
+
React.createElement(core$1.Group, { position: "right", mt: "xl", noWrap: true },
|
|
440
|
+
React.createElement(core$1.Button, { type: "submit" }, "Create project"))));
|
|
438
441
|
}
|
|
439
442
|
|
|
440
443
|
/**
|
|
@@ -477,7 +480,7 @@
|
|
|
477
480
|
if (!googleClientId) {
|
|
478
481
|
return null;
|
|
479
482
|
}
|
|
480
|
-
return
|
|
483
|
+
return React.createElement("div", { ref: parentRef });
|
|
481
484
|
}
|
|
482
485
|
function getGoogleClientId(clientId) {
|
|
483
486
|
var _a, _b;
|
|
@@ -527,7 +530,7 @@
|
|
|
527
530
|
const [outcome, setOutcome] = React.useState();
|
|
528
531
|
const issues = getIssuesForExpression(outcome, undefined);
|
|
529
532
|
React.useEffect(() => initRecaptcha(recaptchaSiteKey), [recaptchaSiteKey]);
|
|
530
|
-
return (
|
|
533
|
+
return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: (formData) => __awaiter(this, void 0, void 0, function* () {
|
|
531
534
|
try {
|
|
532
535
|
const recaptchaToken = yield getRecaptcha(recaptchaSiteKey);
|
|
533
536
|
props.handleAuthResponse(yield medplum.startNewUser({
|
|
@@ -545,14 +548,14 @@
|
|
|
545
548
|
setOutcome(err);
|
|
546
549
|
}
|
|
547
550
|
}) },
|
|
548
|
-
|
|
549
|
-
issues && (
|
|
551
|
+
React.createElement(core$1.Center, { sx: { flexDirection: 'column' } }, props.children),
|
|
552
|
+
issues && (React.createElement(core$1.Alert, { icon: React.createElement(icons.IconAlertCircle, { size: 16 }), color: "red" }, issues.map((issue) => {
|
|
550
553
|
var _a, _b;
|
|
551
|
-
return (
|
|
554
|
+
return (React.createElement("div", { "data-testid": "text-field-error", key: (_a = issue.details) === null || _a === void 0 ? void 0 : _a.text }, (_b = issue.details) === null || _b === void 0 ? void 0 : _b.text));
|
|
552
555
|
}))),
|
|
553
|
-
googleClientId && (
|
|
554
|
-
|
|
555
|
-
|
|
556
|
+
googleClientId && (React.createElement(React.Fragment, null,
|
|
557
|
+
React.createElement(core$1.Group, { position: "center", p: "xl", style: { height: 70 } },
|
|
558
|
+
React.createElement(GoogleButton, { googleClientId: googleClientId, handleGoogleCredential: (response) => __awaiter(this, void 0, void 0, function* () {
|
|
556
559
|
try {
|
|
557
560
|
props.handleAuthResponse(yield medplum.startGoogleLogin({
|
|
558
561
|
googleClientId: response.clientId,
|
|
@@ -564,28 +567,28 @@
|
|
|
564
567
|
setOutcome(err);
|
|
565
568
|
}
|
|
566
569
|
}) })),
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
570
|
+
React.createElement(core$1.Divider, { label: "or", labelPosition: "center", my: "lg" }))),
|
|
571
|
+
React.createElement(core$1.Stack, { spacing: "xl" },
|
|
572
|
+
React.createElement(core$1.TextInput, { name: "firstName", type: "text", label: "First name", placeholder: "First name", required: true, autoFocus: true, error: getErrorsForInput(outcome, 'firstName') }),
|
|
573
|
+
React.createElement(core$1.TextInput, { name: "lastName", type: "text", label: "Last name", placeholder: "Last name", required: true, error: getErrorsForInput(outcome, 'lastName') }),
|
|
574
|
+
React.createElement(core$1.TextInput, { name: "email", type: "email", label: "Email", placeholder: "name@domain.com", required: true, error: getErrorsForInput(outcome, 'email') }),
|
|
575
|
+
React.createElement(core$1.PasswordInput, { name: "password", label: "Password", autoComplete: "off", required: true, error: getErrorsForInput(outcome, 'password') }),
|
|
576
|
+
React.createElement(core$1.Text, { color: "dimmed", size: "xs" },
|
|
574
577
|
"By clicking submit you agree to the Medplum ",
|
|
575
|
-
|
|
578
|
+
React.createElement("a", { href: "https://www.medplum.com/privacy" }, "Privacy\u00A0Policy"),
|
|
576
579
|
' and ',
|
|
577
|
-
|
|
580
|
+
React.createElement("a", { href: "https://www.medplum.com/terms" }, "Terms\u00A0of\u00A0Service"),
|
|
578
581
|
"."),
|
|
579
|
-
|
|
582
|
+
React.createElement(core$1.Text, { color: "dimmed", size: "xs" },
|
|
580
583
|
"This site is protected by reCAPTCHA and the Google",
|
|
581
584
|
' ',
|
|
582
|
-
|
|
585
|
+
React.createElement("a", { href: "https://policies.google.com/privacy" }, "Privacy\u00A0Policy"),
|
|
583
586
|
' and ',
|
|
584
|
-
|
|
587
|
+
React.createElement("a", { href: "https://policies.google.com/terms" }, "Terms\u00A0of\u00A0Service"),
|
|
585
588
|
" apply.")),
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
+
React.createElement(core$1.Group, { position: "apart", mt: "xl", noWrap: true },
|
|
590
|
+
React.createElement(core$1.Checkbox, { name: "remember", label: "Remember me", size: "xs" }),
|
|
591
|
+
React.createElement(core$1.Button, { type: "submit" }, "Create account"))));
|
|
589
592
|
}
|
|
590
593
|
|
|
591
594
|
function RegisterForm(props) {
|
|
@@ -613,82 +616,64 @@
|
|
|
613
616
|
setLogin(response.login);
|
|
614
617
|
}
|
|
615
618
|
}
|
|
616
|
-
return (
|
|
617
|
-
outcome &&
|
|
618
|
-
!login && (
|
|
619
|
-
login && type === 'project' &&
|
|
619
|
+
return (React.createElement(Document, { width: 450 },
|
|
620
|
+
outcome && React.createElement("pre", null, JSON.stringify(outcome, null, 2)),
|
|
621
|
+
!login && (React.createElement(NewUserForm, { projectId: projectId, googleClientId: googleClientId, recaptchaSiteKey: recaptchaSiteKey, handleAuthResponse: handleAuthResponse }, props.children)),
|
|
622
|
+
login && type === 'project' && React.createElement(NewProjectForm, { login: login, handleAuthResponse: handleAuthResponse })));
|
|
620
623
|
}
|
|
621
624
|
|
|
622
625
|
function AuthenticationForm(props) {
|
|
626
|
+
const { generatePkce, onForgotPassword, onRegister, handleAuthResponse, children } = props, baseLoginRequest = __rest(props, ["generatePkce", "onForgotPassword", "onRegister", "handleAuthResponse", "children"]);
|
|
623
627
|
const medplum = useMedplum();
|
|
624
628
|
const googleClientId = getGoogleClientId(props.googleClientId);
|
|
625
629
|
const [outcome, setOutcome] = React.useState();
|
|
626
630
|
const issues = getIssuesForExpression(outcome, undefined);
|
|
627
631
|
function startPkce() {
|
|
628
632
|
return __awaiter(this, void 0, void 0, function* () {
|
|
629
|
-
if (
|
|
633
|
+
if (generatePkce) {
|
|
630
634
|
yield medplum.startPkce();
|
|
631
635
|
}
|
|
632
636
|
});
|
|
633
637
|
}
|
|
634
|
-
return (
|
|
638
|
+
return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: (formData) => {
|
|
635
639
|
startPkce()
|
|
636
|
-
.then(() => medplum.startLogin({
|
|
637
|
-
|
|
638
|
-
clientId: props.clientId,
|
|
639
|
-
scope: props.scope,
|
|
640
|
-
nonce: props.nonce,
|
|
641
|
-
codeChallenge: props.codeChallenge,
|
|
642
|
-
codeChallengeMethod: props.codeChallengeMethod,
|
|
643
|
-
email: formData.email,
|
|
644
|
-
password: formData.password,
|
|
645
|
-
remember: formData.remember === 'true',
|
|
646
|
-
}))
|
|
647
|
-
.then(props.handleAuthResponse)
|
|
640
|
+
.then(() => medplum.startLogin(Object.assign(Object.assign({}, baseLoginRequest), { email: formData.email, password: formData.password, remember: formData.remember === 'on' })))
|
|
641
|
+
.then(handleAuthResponse)
|
|
648
642
|
.catch(setOutcome);
|
|
649
643
|
} },
|
|
650
|
-
|
|
651
|
-
issues && (
|
|
644
|
+
React.createElement(core$1.Center, { sx: { flexDirection: 'column' } }, children),
|
|
645
|
+
issues && (React.createElement(core$1.Alert, { icon: React.createElement(icons.IconAlertCircle, { size: 16 }), color: "red" }, issues.map((issue) => {
|
|
652
646
|
var _a, _b;
|
|
653
|
-
return (
|
|
647
|
+
return (React.createElement("div", { "data-testid": "text-field-error", key: (_a = issue.details) === null || _a === void 0 ? void 0 : _a.text }, (_b = issue.details) === null || _b === void 0 ? void 0 : _b.text));
|
|
654
648
|
}))),
|
|
655
|
-
googleClientId && (
|
|
656
|
-
|
|
657
|
-
|
|
649
|
+
googleClientId && (React.createElement(React.Fragment, null,
|
|
650
|
+
React.createElement(core$1.Group, { position: "center", p: "xl", style: { height: 70 } },
|
|
651
|
+
React.createElement(GoogleButton, { googleClientId: googleClientId, handleGoogleCredential: (response) => {
|
|
658
652
|
startPkce()
|
|
659
|
-
.then(() => medplum.startGoogleLogin({
|
|
660
|
-
projectId: props.projectId,
|
|
661
|
-
clientId: props.clientId,
|
|
662
|
-
scope: props.scope,
|
|
663
|
-
nonce: props.nonce,
|
|
664
|
-
codeChallenge: props.codeChallenge,
|
|
665
|
-
codeChallengeMethod: props.codeChallengeMethod,
|
|
666
|
-
googleClientId: response.clientId,
|
|
667
|
-
googleCredential: response.credential,
|
|
668
|
-
}))
|
|
653
|
+
.then(() => medplum.startGoogleLogin(Object.assign(Object.assign({}, baseLoginRequest), { googleCredential: response.credential })))
|
|
669
654
|
.then(props.handleAuthResponse)
|
|
670
655
|
.catch(setOutcome);
|
|
671
656
|
} })),
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
657
|
+
React.createElement(core$1.Divider, { label: "or", labelPosition: "center", my: "lg" }))),
|
|
658
|
+
React.createElement(core$1.Stack, { spacing: "xl" },
|
|
659
|
+
React.createElement(core$1.TextInput, { name: "email", type: "email", label: "Email", placeholder: "name@domain.com", required: true, autoFocus: true, error: getErrorsForInput(outcome, 'email') }),
|
|
660
|
+
React.createElement(core$1.PasswordInput, { name: "password", type: "password", label: "Password", autoComplete: "off", required: true, error: getErrorsForInput(outcome, 'password') })),
|
|
661
|
+
React.createElement(core$1.Group, { position: "apart", mt: "xl", noWrap: true },
|
|
662
|
+
onForgotPassword && (React.createElement(core$1.Anchor, { component: "button", type: "button", color: "dimmed", onClick: onForgotPassword, size: "xs" }, "Forgot password")),
|
|
663
|
+
onRegister && (React.createElement(core$1.Anchor, { component: "button", type: "button", color: "dimmed", onClick: onRegister, size: "xs" }, "Register")),
|
|
664
|
+
React.createElement(core$1.Checkbox, { id: "remember", name: "remember", label: "Remember me", size: "xs" }),
|
|
665
|
+
React.createElement(core$1.Button, { type: "submit" }, "Sign in"))));
|
|
681
666
|
}
|
|
682
667
|
|
|
683
668
|
function ChooseProfileForm(props) {
|
|
684
669
|
const medplum = useMedplum();
|
|
685
|
-
return (
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
670
|
+
return (React.createElement(core$1.Stack, null,
|
|
671
|
+
React.createElement(core$1.Center, { sx: { flexDirection: 'column' } },
|
|
672
|
+
React.createElement(Logo, { size: 32 }),
|
|
673
|
+
React.createElement(core$1.Title, null, "Choose profile")),
|
|
689
674
|
props.memberships.map((membership) => {
|
|
690
675
|
var _a, _b;
|
|
691
|
-
return (
|
|
676
|
+
return (React.createElement(core$1.UnstyledButton, { key: membership.id, onClick: () => {
|
|
692
677
|
medplum
|
|
693
678
|
.post('auth/profile', {
|
|
694
679
|
login: props.login,
|
|
@@ -697,15 +682,36 @@
|
|
|
697
682
|
.then(props.handleAuthResponse)
|
|
698
683
|
.catch(console.log);
|
|
699
684
|
} },
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
685
|
+
React.createElement(core$1.Group, null,
|
|
686
|
+
React.createElement(core$1.Avatar, { radius: "xl" }),
|
|
687
|
+
React.createElement("div", { style: { flex: 1 } },
|
|
688
|
+
React.createElement(core$1.Text, { size: "sm", weight: 500 }, (_a = membership.profile) === null || _a === void 0 ? void 0 : _a.display),
|
|
689
|
+
React.createElement(core$1.Text, { color: "dimmed", size: "xs" }, (_b = membership.project) === null || _b === void 0 ? void 0 : _b.display)))));
|
|
705
690
|
})));
|
|
706
691
|
}
|
|
707
692
|
|
|
693
|
+
function ChooseScopeForm(props) {
|
|
694
|
+
const medplum = useMedplum();
|
|
695
|
+
return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: (formData) => {
|
|
696
|
+
medplum
|
|
697
|
+
.post('auth/scope', {
|
|
698
|
+
login: props.login,
|
|
699
|
+
scope: Object.keys(formData).join(' '),
|
|
700
|
+
})
|
|
701
|
+
.then(props.handleAuthResponse)
|
|
702
|
+
.catch(console.log);
|
|
703
|
+
} },
|
|
704
|
+
React.createElement(core$1.Stack, null,
|
|
705
|
+
React.createElement(core$1.Center, { sx: { flexDirection: 'column' } },
|
|
706
|
+
React.createElement(Logo, { size: 32 }),
|
|
707
|
+
React.createElement(core$1.Title, null, "Choose scope")),
|
|
708
|
+
React.createElement(core$1.Stack, null, (props.scope || 'openid').split(' ').map((scopeName) => (React.createElement(core$1.Checkbox, { key: scopeName, id: scopeName, name: scopeName, label: scopeName, defaultChecked: true })))),
|
|
709
|
+
React.createElement(core$1.Group, { position: "right", mt: "xl" },
|
|
710
|
+
React.createElement(core$1.Button, { type: "submit" }, "Set scope")))));
|
|
711
|
+
}
|
|
712
|
+
|
|
708
713
|
function SignInForm(props) {
|
|
714
|
+
const { chooseScopes, onSuccess, onForgotPassword, onRegister, onCode } = props, baseLoginRequest = __rest(props, ["chooseScopes", "onSuccess", "onForgotPassword", "onRegister", "onCode"]);
|
|
709
715
|
const medplum = useMedplum();
|
|
710
716
|
const [login, setLogin] = React.useState(undefined);
|
|
711
717
|
const [memberships, setMemberships] = React.useState(undefined);
|
|
@@ -717,43 +723,56 @@
|
|
|
717
723
|
setMemberships(response.memberships);
|
|
718
724
|
}
|
|
719
725
|
if (response.code) {
|
|
720
|
-
if (
|
|
721
|
-
|
|
726
|
+
if (chooseScopes) {
|
|
727
|
+
setMemberships(undefined);
|
|
722
728
|
}
|
|
723
729
|
else {
|
|
724
|
-
|
|
725
|
-
.processCode(response.code)
|
|
726
|
-
.then(() => {
|
|
727
|
-
if (props.onSuccess) {
|
|
728
|
-
props.onSuccess();
|
|
729
|
-
}
|
|
730
|
-
})
|
|
731
|
-
.catch(console.log);
|
|
730
|
+
handleCode(response.code);
|
|
732
731
|
}
|
|
733
732
|
}
|
|
734
733
|
}
|
|
735
|
-
|
|
734
|
+
function handleScopeResponse(response) {
|
|
735
|
+
handleCode(response.code);
|
|
736
|
+
}
|
|
737
|
+
function handleCode(code) {
|
|
738
|
+
if (onCode) {
|
|
739
|
+
onCode(code);
|
|
740
|
+
}
|
|
741
|
+
else {
|
|
742
|
+
medplum
|
|
743
|
+
.processCode(code)
|
|
744
|
+
.then(() => {
|
|
745
|
+
if (onSuccess) {
|
|
746
|
+
onSuccess();
|
|
747
|
+
}
|
|
748
|
+
})
|
|
749
|
+
.catch(console.log);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
return (React.createElement(Document, { width: 450 }, (() => {
|
|
736
753
|
if (!login) {
|
|
737
|
-
return (
|
|
754
|
+
return (React.createElement(AuthenticationForm, Object.assign({ generatePkce: !onCode, onForgotPassword: onForgotPassword, onRegister: onRegister, handleAuthResponse: handleAuthResponse }, baseLoginRequest), props.children));
|
|
738
755
|
}
|
|
739
756
|
else if (memberships) {
|
|
740
|
-
return
|
|
757
|
+
return React.createElement(ChooseProfileForm, { login: login, memberships: memberships, handleAuthResponse: handleAuthResponse });
|
|
741
758
|
}
|
|
742
759
|
else if (props.projectId === 'new') {
|
|
743
|
-
return
|
|
760
|
+
return React.createElement(NewProjectForm, { login: login, handleAuthResponse: handleAuthResponse });
|
|
761
|
+
}
|
|
762
|
+
else if (props.chooseScopes) {
|
|
763
|
+
return React.createElement(ChooseScopeForm, { login: login, scope: props.scope, handleAuthResponse: handleScopeResponse });
|
|
744
764
|
}
|
|
745
765
|
else {
|
|
746
|
-
return
|
|
766
|
+
return React.createElement("div", null, "Success");
|
|
747
767
|
}
|
|
748
768
|
})()));
|
|
749
769
|
}
|
|
750
770
|
|
|
751
771
|
function CheckboxFormSection(props) {
|
|
752
|
-
return (
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
React__default["default"].createElement("p", null, props.description))));
|
|
772
|
+
return (React.createElement(core$1.Group, { noWrap: true },
|
|
773
|
+
React.createElement("div", null, props.children),
|
|
774
|
+
React.createElement("div", null,
|
|
775
|
+
React.createElement(core$1.Input.Wrapper, { id: props.htmlFor, label: props.title, description: props.description }, (() => null)()))));
|
|
757
776
|
}
|
|
758
777
|
|
|
759
778
|
const DEFAULT_IGNORED_PROPERTIES = [
|
|
@@ -767,16 +786,7 @@
|
|
|
767
786
|
];
|
|
768
787
|
|
|
769
788
|
function FormSection(props) {
|
|
770
|
-
|
|
771
|
-
const invalid = issues && issues.length > 0;
|
|
772
|
-
return (React__default["default"].createElement("fieldset", { className: "medplum-form-section" },
|
|
773
|
-
props.title && React__default["default"].createElement("label", { htmlFor: props.htmlFor }, props.title),
|
|
774
|
-
props.description && React__default["default"].createElement("p", null, props.description),
|
|
775
|
-
props.children,
|
|
776
|
-
invalid && (React__default["default"].createElement("div", { id: props.htmlFor + '-errors', className: "medplum-input-error" }, issues === null || issues === void 0 ? void 0 : issues.map((issue) => {
|
|
777
|
-
var _a, _b;
|
|
778
|
-
return (React__default["default"].createElement("div", { "data-testid": "text-field-error", key: (_a = issue.details) === null || _a === void 0 ? void 0 : _a.text }, (_b = issue.details) === null || _b === void 0 ? void 0 : _b.text));
|
|
779
|
-
})))));
|
|
789
|
+
return (React.createElement(core$1.Input.Wrapper, { id: props.htmlFor, label: props.title, description: props.description, error: getErrorsForInput(props.outcome, props.htmlFor) }, props.children));
|
|
780
790
|
}
|
|
781
791
|
|
|
782
792
|
const system = {
|
|
@@ -851,22 +861,23 @@
|
|
|
851
861
|
}
|
|
852
862
|
}, [medplum, defaultValue]);
|
|
853
863
|
if (!schema || !value) {
|
|
854
|
-
return
|
|
864
|
+
return React.createElement("div", null, "Loading...");
|
|
855
865
|
}
|
|
856
|
-
return (
|
|
866
|
+
return (React.createElement("form", { noValidate: true, autoComplete: "off", onSubmit: (e) => {
|
|
857
867
|
e.preventDefault();
|
|
858
868
|
if (props.onSubmit) {
|
|
859
869
|
props.onSubmit(value);
|
|
860
870
|
}
|
|
861
871
|
} },
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
872
|
+
React.createElement(core$1.Stack, { mb: "xl" },
|
|
873
|
+
React.createElement(FormSection, { title: "Resource Type", htmlFor: "resourceType", outcome: props.outcome },
|
|
874
|
+
React.createElement(core$1.TextInput, { name: "resourceType", defaultValue: value.resourceType, disabled: true })),
|
|
875
|
+
React.createElement(FormSection, { title: "ID", htmlFor: "id", outcome: props.outcome },
|
|
876
|
+
React.createElement(core$1.TextInput, { name: "id", defaultValue: value.id, disabled: true }))),
|
|
877
|
+
React.createElement(BackboneElementInput, { typeName: value.resourceType, defaultValue: value, outcome: props.outcome, onChange: setValue }),
|
|
878
|
+
React.createElement(core$1.Group, { position: "right", mt: "xl" },
|
|
879
|
+
React.createElement(core$1.Button, { type: "submit" }, "OK"),
|
|
880
|
+
props.onDelete && (React.createElement(core$1.Button, { variant: "outline", color: "red", type: "button", onClick: () => {
|
|
870
881
|
props.onDelete(value);
|
|
871
882
|
} }, "Delete")))));
|
|
872
883
|
}
|
|
@@ -884,13 +895,34 @@
|
|
|
884
895
|
return obj;
|
|
885
896
|
}
|
|
886
897
|
|
|
898
|
+
const useStyles$b = core$1.createStyles((theme) => ({
|
|
899
|
+
root: {
|
|
900
|
+
display: 'grid',
|
|
901
|
+
gridTemplateColumns: '30% 70%',
|
|
902
|
+
margin: 0,
|
|
903
|
+
'& > dt, & > dd': {
|
|
904
|
+
padding: `${theme.spacing.sm}px ${theme.spacing.sm}px`,
|
|
905
|
+
borderTop: `0.1px solid ${theme.colors.gray[3]}`,
|
|
906
|
+
margin: 0,
|
|
907
|
+
},
|
|
908
|
+
},
|
|
909
|
+
compact: {
|
|
910
|
+
gridTemplateColumns: '20% 80%',
|
|
911
|
+
'& > dt, & > dd': {
|
|
912
|
+
padding: `0 ${theme.spacing.xs}px ${theme.spacing.xs}px 0`,
|
|
913
|
+
border: 0,
|
|
914
|
+
},
|
|
915
|
+
},
|
|
916
|
+
}));
|
|
887
917
|
function DescriptionList(props) {
|
|
888
|
-
|
|
918
|
+
const { children, compact } = props;
|
|
919
|
+
const { classes, cx } = useStyles$b();
|
|
920
|
+
return React.createElement("dl", { className: cx(classes.root, { [classes.compact]: compact }) }, children);
|
|
889
921
|
}
|
|
890
922
|
function DescriptionListEntry(props) {
|
|
891
|
-
return (
|
|
892
|
-
|
|
893
|
-
|
|
923
|
+
return (React.createElement(React.Fragment, null,
|
|
924
|
+
React.createElement("dt", null, props.term),
|
|
925
|
+
React.createElement("dd", null, props.children)));
|
|
894
926
|
}
|
|
895
927
|
|
|
896
928
|
function BackboneElementDisplay(props) {
|
|
@@ -902,17 +934,20 @@
|
|
|
902
934
|
const typeName = typedValue.type;
|
|
903
935
|
const typeSchema = core.globalSchema.types[typeName];
|
|
904
936
|
if (!typeSchema) {
|
|
905
|
-
return
|
|
937
|
+
return React.createElement("div", null,
|
|
906
938
|
typeName,
|
|
907
939
|
"\u00A0not implemented");
|
|
908
940
|
}
|
|
909
|
-
if (typeof value === 'object' &&
|
|
941
|
+
if (typeof value === 'object' &&
|
|
942
|
+
'name' in value &&
|
|
943
|
+
Object.keys(value).length === 1 &&
|
|
944
|
+
typeof value.name === 'string') {
|
|
910
945
|
// Special case for common BackboneElement pattern
|
|
911
946
|
// Where there is an object with a single property 'name'
|
|
912
947
|
// Just display the name value.
|
|
913
|
-
return
|
|
948
|
+
return React.createElement("div", null, value.name);
|
|
914
949
|
}
|
|
915
|
-
return (
|
|
950
|
+
return (React.createElement(DescriptionList, { compact: props.compact }, Object.entries(typeSchema.properties).map((entry) => {
|
|
916
951
|
const key = entry[0];
|
|
917
952
|
if (DEFAULT_IGNORED_PROPERTIES.indexOf(key) >= 0) {
|
|
918
953
|
return null;
|
|
@@ -923,14 +958,14 @@
|
|
|
923
958
|
(!propertyValue || (Array.isArray(propertyValue) && propertyValue.length === 0))) {
|
|
924
959
|
return null;
|
|
925
960
|
}
|
|
926
|
-
return (
|
|
927
|
-
|
|
961
|
+
return (React.createElement(DescriptionListEntry, { key: key, term: core.getPropertyDisplayName(key) },
|
|
962
|
+
React.createElement(ResourcePropertyDisplay, { property: property, propertyType: propertyType, value: propertyValue, ignoreMissingValues: props.ignoreMissingValues, link: props.link })));
|
|
928
963
|
})));
|
|
929
964
|
}
|
|
930
965
|
|
|
931
966
|
function CodingDisplay(props) {
|
|
932
967
|
var _a, _b;
|
|
933
|
-
return
|
|
968
|
+
return React.createElement(React.Fragment, null, ((_a = props.value) === null || _a === void 0 ? void 0 : _a.display) || ((_b = props.value) === null || _b === void 0 ? void 0 : _b.code));
|
|
934
969
|
}
|
|
935
970
|
|
|
936
971
|
function CodeableConceptDisplay(props) {
|
|
@@ -939,12 +974,12 @@
|
|
|
939
974
|
return null;
|
|
940
975
|
}
|
|
941
976
|
if (value.text) {
|
|
942
|
-
return
|
|
977
|
+
return React.createElement(React.Fragment, null, value.text);
|
|
943
978
|
}
|
|
944
979
|
if (value.coding) {
|
|
945
|
-
return (
|
|
946
|
-
index > 0 &&
|
|
947
|
-
|
|
980
|
+
return (React.createElement(React.Fragment, null, value.coding.map((coding, index) => (React.createElement(React.Fragment, { key: 'coding-' + index },
|
|
981
|
+
index > 0 && React.createElement(React.Fragment, null, ', '),
|
|
982
|
+
React.createElement(CodingDisplay, { value: coding }))))));
|
|
948
983
|
}
|
|
949
984
|
return null;
|
|
950
985
|
}
|
|
@@ -971,7 +1006,7 @@
|
|
|
971
1006
|
}
|
|
972
1007
|
builder.push(']');
|
|
973
1008
|
}
|
|
974
|
-
return
|
|
1009
|
+
return React.createElement(React.Fragment, null, builder.join('').trim());
|
|
975
1010
|
}
|
|
976
1011
|
|
|
977
1012
|
function ContactDetailDisplay(props) {
|
|
@@ -980,10 +1015,10 @@
|
|
|
980
1015
|
if (!contactDetail) {
|
|
981
1016
|
return null;
|
|
982
1017
|
}
|
|
983
|
-
return (
|
|
1018
|
+
return (React.createElement(React.Fragment, null,
|
|
984
1019
|
contactDetail.name,
|
|
985
1020
|
contactDetail.name && ': ', (_a = contactDetail.telecom) === null || _a === void 0 ? void 0 :
|
|
986
|
-
_a.map((telecom, index) => (
|
|
1021
|
+
_a.map((telecom, index) => (React.createElement(ContactPointDisplay, { key: 'telecom-' + index, value: telecom })))));
|
|
987
1022
|
}
|
|
988
1023
|
|
|
989
1024
|
function HumanNameDisplay(props) {
|
|
@@ -991,55 +1026,23 @@
|
|
|
991
1026
|
if (!name) {
|
|
992
1027
|
return null;
|
|
993
1028
|
}
|
|
994
|
-
return
|
|
1029
|
+
return React.createElement(React.Fragment, null, core.formatHumanName(name, props.options));
|
|
995
1030
|
}
|
|
996
1031
|
|
|
997
1032
|
function IdentifierDisplay(props) {
|
|
998
1033
|
var _a, _b;
|
|
999
|
-
return (
|
|
1034
|
+
return (React.createElement("div", null, (_a = props.value) === null || _a === void 0 ? void 0 :
|
|
1000
1035
|
_a.system,
|
|
1001
1036
|
": ", (_b = props.value) === null || _b === void 0 ? void 0 :
|
|
1002
1037
|
_b.value));
|
|
1003
1038
|
}
|
|
1004
1039
|
|
|
1005
1040
|
function QuantityDisplay(props) {
|
|
1006
|
-
return
|
|
1007
|
-
}
|
|
1008
|
-
function formatQuantityString(quantity) {
|
|
1009
|
-
if (!quantity) {
|
|
1010
|
-
return '';
|
|
1011
|
-
}
|
|
1012
|
-
const result = [];
|
|
1013
|
-
if (quantity.comparator) {
|
|
1014
|
-
result.push(quantity.comparator);
|
|
1015
|
-
result.push(' ');
|
|
1016
|
-
}
|
|
1017
|
-
if (quantity.value !== undefined) {
|
|
1018
|
-
result.push(quantity.value);
|
|
1019
|
-
}
|
|
1020
|
-
if (quantity.unit) {
|
|
1021
|
-
if (quantity.unit !== '%') {
|
|
1022
|
-
result.push(' ');
|
|
1023
|
-
}
|
|
1024
|
-
result.push(quantity.unit);
|
|
1025
|
-
}
|
|
1026
|
-
return result.join('');
|
|
1041
|
+
return React.createElement(React.Fragment, null, core.formatQuantity(props.value));
|
|
1027
1042
|
}
|
|
1028
1043
|
|
|
1029
1044
|
function RangeDisplay(props) {
|
|
1030
|
-
return
|
|
1031
|
-
}
|
|
1032
|
-
function formatRangeString(range) {
|
|
1033
|
-
if (!range || (!range.low && !range.high)) {
|
|
1034
|
-
return '';
|
|
1035
|
-
}
|
|
1036
|
-
if (range.low && !range.high) {
|
|
1037
|
-
return `>= ${formatQuantityString(range.low)}`;
|
|
1038
|
-
}
|
|
1039
|
-
if (!range.low && range.high) {
|
|
1040
|
-
return `<= ${formatQuantityString(range.high)}`;
|
|
1041
|
-
}
|
|
1042
|
-
return `${formatQuantityString(range.low)} - ${formatQuantityString(range.high)}`;
|
|
1045
|
+
return React.createElement(React.Fragment, null, core.formatRange(props.value));
|
|
1043
1046
|
}
|
|
1044
1047
|
|
|
1045
1048
|
function RatioDisplay(props) {
|
|
@@ -1047,27 +1050,28 @@
|
|
|
1047
1050
|
if (!value) {
|
|
1048
1051
|
return null;
|
|
1049
1052
|
}
|
|
1050
|
-
return (
|
|
1051
|
-
|
|
1053
|
+
return (React.createElement(React.Fragment, null,
|
|
1054
|
+
React.createElement(QuantityDisplay, { value: value.numerator }),
|
|
1052
1055
|
"\u00A0/\u00A0",
|
|
1053
|
-
|
|
1056
|
+
React.createElement(QuantityDisplay, { value: value.denominator })));
|
|
1054
1057
|
}
|
|
1055
1058
|
|
|
1056
1059
|
function MedplumLink(props) {
|
|
1057
1060
|
const navigate = reactRouterDom.useNavigate();
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
+
const { to, suffix, label, onClick, children } = props, rest = __rest(props, ["to", "suffix", "label", "onClick", "children"]);
|
|
1062
|
+
let href = getHref(to);
|
|
1063
|
+
if (suffix) {
|
|
1064
|
+
href += '/' + suffix;
|
|
1061
1065
|
}
|
|
1062
|
-
return (
|
|
1066
|
+
return (React.createElement(core$1.Anchor, Object.assign({ href: href, "aria-label": label, onClick: (e) => {
|
|
1063
1067
|
killEvent(e);
|
|
1064
|
-
if (
|
|
1065
|
-
|
|
1068
|
+
if (onClick) {
|
|
1069
|
+
onClick();
|
|
1066
1070
|
}
|
|
1067
|
-
else if (
|
|
1071
|
+
else if (to) {
|
|
1068
1072
|
navigate(href);
|
|
1069
1073
|
}
|
|
1070
|
-
} },
|
|
1074
|
+
} }, rest), children));
|
|
1071
1075
|
}
|
|
1072
1076
|
function getHref(to) {
|
|
1073
1077
|
if (to) {
|
|
@@ -1104,10 +1108,10 @@
|
|
|
1104
1108
|
// The "link" prop defaults to "true"; undefined is treated as "true"
|
|
1105
1109
|
// To disable the link, it must be explicitly "false"
|
|
1106
1110
|
if (props.link !== false && props.value.reference) {
|
|
1107
|
-
return
|
|
1111
|
+
return React.createElement(MedplumLink, { to: props.value }, displayString);
|
|
1108
1112
|
}
|
|
1109
1113
|
else {
|
|
1110
|
-
return
|
|
1114
|
+
return React.createElement(React.Fragment, null, displayString);
|
|
1111
1115
|
}
|
|
1112
1116
|
}
|
|
1113
1117
|
|
|
@@ -1116,8 +1120,8 @@
|
|
|
1116
1120
|
const property = props.property;
|
|
1117
1121
|
const values = (_a = props.values) !== null && _a !== void 0 ? _a : [];
|
|
1118
1122
|
const propertyType = (_c = (_b = property.type) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.code;
|
|
1119
|
-
return (
|
|
1120
|
-
|
|
1123
|
+
return (React.createElement(React.Fragment, null, values.map((v, index) => (React.createElement("div", { key: `${index}-${values.length}` },
|
|
1124
|
+
React.createElement(ResourcePropertyDisplay, { arrayElement: true, property: property, propertyType: propertyType, value: v, ignoreMissingValues: props.ignoreMissingValues, link: props.link }))))));
|
|
1121
1125
|
}
|
|
1122
1126
|
|
|
1123
1127
|
function ResourcePropertyDisplay(props) {
|
|
@@ -1125,13 +1129,13 @@
|
|
|
1125
1129
|
const { property, propertyType, value } = props;
|
|
1126
1130
|
if ((property === null || property === void 0 ? void 0 : property.max) === '*' && !props.arrayElement) {
|
|
1127
1131
|
if (propertyType === 'Attachment') {
|
|
1128
|
-
return
|
|
1132
|
+
return React.createElement(AttachmentArrayDisplay, { values: value, maxWidth: props.maxWidth });
|
|
1129
1133
|
}
|
|
1130
|
-
return (
|
|
1134
|
+
return (React.createElement(ResourceArrayDisplay, { property: property, values: value, ignoreMissingValues: props.ignoreMissingValues, link: props.link }));
|
|
1131
1135
|
}
|
|
1132
1136
|
switch (propertyType) {
|
|
1133
1137
|
case core.PropertyType.boolean:
|
|
1134
|
-
return
|
|
1138
|
+
return React.createElement(React.Fragment, null, value === undefined ? '' : Boolean(value).toString());
|
|
1135
1139
|
case core.PropertyType.SystemString:
|
|
1136
1140
|
case core.PropertyType.code:
|
|
1137
1141
|
case core.PropertyType.date:
|
|
@@ -1141,49 +1145,49 @@
|
|
|
1141
1145
|
case core.PropertyType.unsignedInt:
|
|
1142
1146
|
case core.PropertyType.uri:
|
|
1143
1147
|
case core.PropertyType.url:
|
|
1144
|
-
return
|
|
1148
|
+
return React.createElement(React.Fragment, null, value);
|
|
1145
1149
|
case core.PropertyType.canonical:
|
|
1146
|
-
return
|
|
1150
|
+
return React.createElement(ReferenceDisplay, { value: { reference: value }, link: props.link });
|
|
1147
1151
|
case core.PropertyType.dateTime:
|
|
1148
1152
|
case core.PropertyType.instant:
|
|
1149
|
-
return
|
|
1153
|
+
return React.createElement(React.Fragment, null, core.formatDateTime(value));
|
|
1150
1154
|
case core.PropertyType.markdown:
|
|
1151
|
-
return
|
|
1155
|
+
return React.createElement("pre", null, value);
|
|
1152
1156
|
case core.PropertyType.Address:
|
|
1153
|
-
return
|
|
1157
|
+
return React.createElement(AddressDisplay, { value: value });
|
|
1154
1158
|
case core.PropertyType.Annotation:
|
|
1155
|
-
return
|
|
1159
|
+
return React.createElement(React.Fragment, null, value === null || value === void 0 ? void 0 : value.text);
|
|
1156
1160
|
case core.PropertyType.Attachment:
|
|
1157
|
-
return
|
|
1161
|
+
return React.createElement(AttachmentDisplay, { value: value, maxWidth: props.maxWidth });
|
|
1158
1162
|
case core.PropertyType.CodeableConcept:
|
|
1159
|
-
return
|
|
1163
|
+
return React.createElement(CodeableConceptDisplay, { value: value });
|
|
1160
1164
|
case core.PropertyType.Coding:
|
|
1161
|
-
return
|
|
1165
|
+
return React.createElement(CodingDisplay, { value: value });
|
|
1162
1166
|
case core.PropertyType.ContactDetail:
|
|
1163
|
-
return
|
|
1167
|
+
return React.createElement(ContactDetailDisplay, { value: value });
|
|
1164
1168
|
case core.PropertyType.ContactPoint:
|
|
1165
|
-
return
|
|
1169
|
+
return React.createElement(ContactPointDisplay, { value: value });
|
|
1166
1170
|
case core.PropertyType.HumanName:
|
|
1167
|
-
return
|
|
1171
|
+
return React.createElement(HumanNameDisplay, { value: value });
|
|
1168
1172
|
case core.PropertyType.Identifier:
|
|
1169
|
-
return
|
|
1173
|
+
return React.createElement(IdentifierDisplay, { value: value });
|
|
1170
1174
|
case core.PropertyType.Period:
|
|
1171
|
-
return
|
|
1175
|
+
return React.createElement(React.Fragment, null, core.formatPeriod(value));
|
|
1172
1176
|
case core.PropertyType.Quantity:
|
|
1173
|
-
return
|
|
1177
|
+
return React.createElement(QuantityDisplay, { value: value });
|
|
1174
1178
|
case core.PropertyType.Range:
|
|
1175
|
-
return
|
|
1179
|
+
return React.createElement(RangeDisplay, { value: value });
|
|
1176
1180
|
case core.PropertyType.Ratio:
|
|
1177
|
-
return
|
|
1181
|
+
return React.createElement(RatioDisplay, { value: value });
|
|
1178
1182
|
case core.PropertyType.Reference:
|
|
1179
|
-
return
|
|
1183
|
+
return React.createElement(ReferenceDisplay, { value: value, link: props.link });
|
|
1180
1184
|
case core.PropertyType.Timing:
|
|
1181
|
-
return
|
|
1185
|
+
return React.createElement(React.Fragment, null, core.formatTiming(value));
|
|
1182
1186
|
default:
|
|
1183
1187
|
if (!(property === null || property === void 0 ? void 0 : property.path)) {
|
|
1184
1188
|
throw Error(`Displaying property of type ${props.propertyType} requires element definition path`);
|
|
1185
1189
|
}
|
|
1186
|
-
return (
|
|
1190
|
+
return (React.createElement(BackboneElementDisplay, { value: { type: core.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 }));
|
|
1187
1191
|
}
|
|
1188
1192
|
}
|
|
1189
1193
|
/**
|
|
@@ -1225,7 +1229,7 @@
|
|
|
1225
1229
|
props.onChange(newValue);
|
|
1226
1230
|
}
|
|
1227
1231
|
}
|
|
1228
|
-
return (
|
|
1232
|
+
return (React.createElement(core$1.TextInput, { name: props.name, placeholder: "Annotation text", defaultValue: value.text, onChange: (e) => setText(e.currentTarget.value) }));
|
|
1229
1233
|
}
|
|
1230
1234
|
|
|
1231
1235
|
function valueSetElementToAutocompleteItem(element) {
|
|
@@ -1238,8 +1242,8 @@
|
|
|
1238
1242
|
function ValueSetAutocomplete(props) {
|
|
1239
1243
|
const medplum = useMedplum();
|
|
1240
1244
|
const { property, defaultValue } = props;
|
|
1241
|
-
const [textValues, setTextValues] = React.useState(defaultValue ? [defaultValue.code] : []);
|
|
1242
|
-
const [data, setData] = React.useState(defaultValue ? [valueSetElementToAutocompleteItem(defaultValue)] : []);
|
|
1245
|
+
const [textValues, setTextValues] = React.useState((defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.code) ? [defaultValue.code] : []);
|
|
1246
|
+
const [data, setData] = React.useState((defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.code) ? [valueSetElementToAutocompleteItem(defaultValue)] : []);
|
|
1243
1247
|
const dataRef = React.useRef();
|
|
1244
1248
|
dataRef.current = data;
|
|
1245
1249
|
const loadValues = React.useCallback((input) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1249,7 +1253,7 @@
|
|
|
1249
1253
|
const valueSetElements = (_b = valueSet.expansion) === null || _b === void 0 ? void 0 : _b.contains;
|
|
1250
1254
|
const newData = [...dataRef.current];
|
|
1251
1255
|
for (const valueSetElement of valueSetElements) {
|
|
1252
|
-
if (!newData.some((item) => item.value === valueSetElement.code)) {
|
|
1256
|
+
if (valueSetElement.code && !newData.some((item) => item.value === valueSetElement.code)) {
|
|
1253
1257
|
newData.push(valueSetElementToAutocompleteItem(valueSetElement));
|
|
1254
1258
|
}
|
|
1255
1259
|
}
|
|
@@ -1274,7 +1278,7 @@
|
|
|
1274
1278
|
React.useEffect(() => {
|
|
1275
1279
|
loadValues('').catch(console.log);
|
|
1276
1280
|
}, [loadValues]);
|
|
1277
|
-
return (
|
|
1281
|
+
return (React.createElement(core$1.MultiSelect, { data: data, placeholder: props.placeholder, searchable: true, creatable: true, clearable: true, value: textValues, filter: (value, selected, item) => {
|
|
1278
1282
|
var _a, _b;
|
|
1279
1283
|
return !!(textValues.length === 0 &&
|
|
1280
1284
|
!selected &&
|
|
@@ -1295,7 +1299,7 @@
|
|
|
1295
1299
|
props.onChange(newConcept);
|
|
1296
1300
|
}
|
|
1297
1301
|
}
|
|
1298
|
-
return (
|
|
1302
|
+
return (React.createElement(ValueSetAutocomplete, { property: props.property, name: props.name, placeholder: props.placeholder, defaultValue: value && codeableConceptToValueSetElement(value), onChange: handleChange }));
|
|
1299
1303
|
}
|
|
1300
1304
|
function codeableConceptToValueSetElement(concept) {
|
|
1301
1305
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -1327,7 +1331,7 @@
|
|
|
1327
1331
|
props.onChange(newCode);
|
|
1328
1332
|
}
|
|
1329
1333
|
}
|
|
1330
|
-
return (
|
|
1334
|
+
return (React.createElement(ValueSetAutocomplete, { property: props.property, name: props.name, placeholder: props.placeholder, defaultValue: codeToValueSetElement(value), onChange: handleChange }));
|
|
1331
1335
|
}
|
|
1332
1336
|
function codeToValueSetElement(code) {
|
|
1333
1337
|
return code ? { code } : undefined;
|
|
@@ -1345,7 +1349,7 @@
|
|
|
1345
1349
|
props.onChange(newConcept);
|
|
1346
1350
|
}
|
|
1347
1351
|
}
|
|
1348
|
-
return (
|
|
1352
|
+
return (React.createElement(ValueSetAutocomplete, { property: props.property, name: props.name, placeholder: props.placeholder, defaultValue: value && codingToValueSetElement(value), onChange: handleChange }));
|
|
1349
1353
|
}
|
|
1350
1354
|
function codingToValueSetElement(coding) {
|
|
1351
1355
|
return {
|
|
@@ -1396,10 +1400,10 @@
|
|
|
1396
1400
|
}
|
|
1397
1401
|
setContactPointWrapper(newValue);
|
|
1398
1402
|
}
|
|
1399
|
-
return (
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
+
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
1404
|
+
React.createElement(core$1.NativeSelect, { "data-testid": "system", defaultValue: contactPoint === null || contactPoint === void 0 ? void 0 : contactPoint.system, onChange: (e) => setSystem(e.currentTarget.value), data: ['', 'email', 'phone', 'fax', 'pager', 'sms', 'other'] }),
|
|
1405
|
+
React.createElement(core$1.NativeSelect, { "data-testid": "use", defaultValue: contactPoint === null || contactPoint === void 0 ? void 0 : contactPoint.use, onChange: (e) => setUse(e.currentTarget.value), data: ['', 'home', 'work', 'temp', 'old', 'mobile'] }),
|
|
1406
|
+
React.createElement(core$1.TextInput, { placeholder: "Value", defaultValue: contactPoint === null || contactPoint === void 0 ? void 0 : contactPoint.value, onChange: (e) => setValue(e.currentTarget.value) })));
|
|
1403
1407
|
}
|
|
1404
1408
|
|
|
1405
1409
|
function ContactDetailInput(props) {
|
|
@@ -1427,9 +1431,9 @@
|
|
|
1427
1431
|
}
|
|
1428
1432
|
setContactDetailWrapper(newValue);
|
|
1429
1433
|
}
|
|
1430
|
-
return (
|
|
1431
|
-
|
|
1432
|
-
|
|
1434
|
+
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
1435
|
+
React.createElement(core$1.TextInput, { "data-testid": props.name + '-name', name: props.name + '-name', placeholder: "Name", style: { width: 180 }, defaultValue: contactPoint === null || contactPoint === void 0 ? void 0 : contactPoint.name, onChange: (e) => setName(e.currentTarget.value) }),
|
|
1436
|
+
React.createElement(ContactPointInput, { name: props.name + '-telecom', defaultValue: (_a = contactPoint === null || contactPoint === void 0 ? void 0 : contactPoint.telecom) === null || _a === void 0 ? void 0 : _a[0], onChange: setTelecom })));
|
|
1433
1437
|
}
|
|
1434
1438
|
|
|
1435
1439
|
/**
|
|
@@ -1441,7 +1445,7 @@
|
|
|
1441
1445
|
* @returns The JSX element to render.
|
|
1442
1446
|
*/
|
|
1443
1447
|
function DateTimeInput(props) {
|
|
1444
|
-
return (
|
|
1448
|
+
return (React.createElement(core$1.TextInput, { id: props.name, name: props.name, "data-testid": props.name, placeholder: props.placeholder, type: getInputType(), defaultValue: convertIsoToLocal(props.defaultValue), error: getErrorsForInput(props.outcome, props.name), onChange: (e) => {
|
|
1445
1449
|
if (props.onChange) {
|
|
1446
1450
|
const newValue = e.currentTarget.value;
|
|
1447
1451
|
props.onChange(convertLocalToIso(newValue));
|
|
@@ -1496,7 +1500,7 @@
|
|
|
1496
1500
|
}
|
|
1497
1501
|
|
|
1498
1502
|
function ExtensionInput(props) {
|
|
1499
|
-
return (
|
|
1503
|
+
return (React.createElement(core$1.JsonInput, { id: props.name, name: props.name, "data-testid": "extension-input", defaultValue: core.stringify(props.defaultValue), onChange: (newValue) => {
|
|
1500
1504
|
if (props.onChange) {
|
|
1501
1505
|
props.onChange(JSON.parse(newValue));
|
|
1502
1506
|
}
|
|
@@ -1529,12 +1533,12 @@
|
|
|
1529
1533
|
function setSuffix(suffix) {
|
|
1530
1534
|
setValueWrapper(Object.assign(Object.assign({}, valueRef.current), { suffix: suffix ? suffix.split(' ') : undefined }));
|
|
1531
1535
|
}
|
|
1532
|
-
return (
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1536
|
+
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
1537
|
+
React.createElement(core$1.NativeSelect, { defaultValue: value === null || value === void 0 ? void 0 : value.use, "data-testid": "use", onChange: (e) => setUse(e.currentTarget.value), data: ['', 'temp', 'old', 'usual', 'official', 'nickname', 'anonymous', 'maiden'] }),
|
|
1538
|
+
React.createElement(core$1.TextInput, { placeholder: "Prefix", defaultValue: (_a = value === null || value === void 0 ? void 0 : value.prefix) === null || _a === void 0 ? void 0 : _a.join(' '), onChange: (e) => setPrefix(e.currentTarget.value) }),
|
|
1539
|
+
React.createElement(core$1.TextInput, { placeholder: "Given", defaultValue: (_b = value === null || value === void 0 ? void 0 : value.given) === null || _b === void 0 ? void 0 : _b.join(' '), onChange: (e) => setGiven(e.currentTarget.value) }),
|
|
1540
|
+
React.createElement(core$1.TextInput, { placeholder: "Family", defaultValue: value === null || value === void 0 ? void 0 : value.family, onChange: (e) => setFamily(e.currentTarget.value) }),
|
|
1541
|
+
React.createElement(core$1.TextInput, { placeholder: "Suffix", defaultValue: (_c = value === null || value === void 0 ? void 0 : value.suffix) === null || _c === void 0 ? void 0 : _c.join(' '), onChange: (e) => setSuffix(e.currentTarget.value) })));
|
|
1538
1542
|
}
|
|
1539
1543
|
|
|
1540
1544
|
function IdentifierInput(props) {
|
|
@@ -1545,9 +1549,9 @@
|
|
|
1545
1549
|
props.onChange(newValue);
|
|
1546
1550
|
}
|
|
1547
1551
|
}
|
|
1548
|
-
return (
|
|
1549
|
-
|
|
1550
|
-
|
|
1552
|
+
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
1553
|
+
React.createElement(core$1.TextInput, { placeholder: "System", defaultValue: value === null || value === void 0 ? void 0 : value.system, onChange: (e) => setValueWrapper(Object.assign(Object.assign({}, value), { system: e.currentTarget.value })) }),
|
|
1554
|
+
React.createElement(core$1.TextInput, { placeholder: "Value", defaultValue: value === null || value === void 0 ? void 0 : value.value, onChange: (e) => setValueWrapper(Object.assign(Object.assign({}, value), { value: e.currentTarget.value })) })));
|
|
1551
1555
|
}
|
|
1552
1556
|
|
|
1553
1557
|
function PeriodInput(props) {
|
|
@@ -1558,9 +1562,9 @@
|
|
|
1558
1562
|
props.onChange(newValue);
|
|
1559
1563
|
}
|
|
1560
1564
|
}
|
|
1561
|
-
return (
|
|
1562
|
-
|
|
1563
|
-
|
|
1565
|
+
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
1566
|
+
React.createElement(DateTimeInput, { name: props.name + '.start', placeholder: "Start", defaultValue: value === null || value === void 0 ? void 0 : value.start, onChange: (newValue) => setValueWrapper(Object.assign(Object.assign({}, value), { start: newValue })) }),
|
|
1567
|
+
React.createElement(DateTimeInput, { name: props.name + '.end', placeholder: "End", defaultValue: value === null || value === void 0 ? void 0 : value.end, onChange: (newValue) => setValueWrapper(Object.assign(Object.assign({}, value), { end: newValue })) })));
|
|
1564
1568
|
}
|
|
1565
1569
|
|
|
1566
1570
|
function QuantityInput(props) {
|
|
@@ -1572,10 +1576,10 @@
|
|
|
1572
1576
|
props.onChange(newValue);
|
|
1573
1577
|
}
|
|
1574
1578
|
}
|
|
1575
|
-
return (
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
+
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
1580
|
+
React.createElement(core$1.NativeSelect, { style: { width: 80 }, "data-testid": props.name + '-comparator', defaultValue: value === null || value === void 0 ? void 0 : value.comparator, data: ['', '<', '<=', '>=', '>'], onChange: (e) => setValueWrapper(Object.assign(Object.assign({}, value), { comparator: e.currentTarget.value })) }),
|
|
1581
|
+
React.createElement(core$1.TextInput, { id: props.name, name: props.name, "data-testid": props.name + '-value', type: "number", step: "any", placeholder: "Value", defaultValue: (_a = value === null || value === void 0 ? void 0 : value.value) === null || _a === void 0 ? void 0 : _a.toString(), onChange: (e) => setValueWrapper(Object.assign(Object.assign({}, value), { value: tryParseNumber(e.currentTarget.value) })) }),
|
|
1582
|
+
React.createElement(core$1.TextInput, { placeholder: "Unit", "data-testid": props.name + '-unit', defaultValue: value === null || value === void 0 ? void 0 : value.unit, onChange: (e) => setValueWrapper(Object.assign(Object.assign({}, value), { unit: e.currentTarget.value })) })));
|
|
1579
1583
|
}
|
|
1580
1584
|
function tryParseNumber(str) {
|
|
1581
1585
|
if (!str) {
|
|
@@ -1598,9 +1602,9 @@
|
|
|
1598
1602
|
props.onChange(newValue);
|
|
1599
1603
|
}
|
|
1600
1604
|
}
|
|
1601
|
-
return (
|
|
1602
|
-
|
|
1603
|
-
|
|
1605
|
+
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
1606
|
+
React.createElement(QuantityInput, { name: props.name + '-low', defaultValue: value === null || value === void 0 ? void 0 : value.low, onChange: (v) => setValueWrapper(Object.assign(Object.assign({}, value), { low: v })) }),
|
|
1607
|
+
React.createElement(QuantityInput, { name: props.name + '-high', defaultValue: value === null || value === void 0 ? void 0 : value.high, onChange: (v) => setValueWrapper(Object.assign(Object.assign({}, value), { high: v })) })));
|
|
1604
1608
|
}
|
|
1605
1609
|
|
|
1606
1610
|
/**
|
|
@@ -1617,9 +1621,9 @@
|
|
|
1617
1621
|
props.onChange(newValue);
|
|
1618
1622
|
}
|
|
1619
1623
|
}
|
|
1620
|
-
return (
|
|
1621
|
-
|
|
1622
|
-
|
|
1624
|
+
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
1625
|
+
React.createElement(QuantityInput, { name: props.name + '-numerator', defaultValue: value === null || value === void 0 ? void 0 : value.numerator, onChange: (v) => setValueWrapper(Object.assign(Object.assign({}, value), { numerator: v })) }),
|
|
1626
|
+
React.createElement(QuantityInput, { name: props.name + '-denominator', defaultValue: value === null || value === void 0 ? void 0 : value.denominator, onChange: (v) => setValueWrapper(Object.assign(Object.assign({}, value), { denominator: v })) })));
|
|
1623
1627
|
}
|
|
1624
1628
|
|
|
1625
1629
|
function ResourceAvatar(props) {
|
|
@@ -1632,12 +1636,28 @@
|
|
|
1632
1636
|
delete avatarProps.value;
|
|
1633
1637
|
delete avatarProps.link;
|
|
1634
1638
|
if (props.link) {
|
|
1635
|
-
return (
|
|
1636
|
-
|
|
1639
|
+
return (React.createElement(MedplumLink, { to: resource },
|
|
1640
|
+
React.createElement(core$1.Avatar, Object.assign({ src: imageUrl, alt: text, radius: radius }, avatarProps))));
|
|
1637
1641
|
}
|
|
1638
|
-
return
|
|
1642
|
+
return React.createElement(core$1.Avatar, Object.assign({ src: imageUrl, alt: text, radius: radius }, avatarProps));
|
|
1639
1643
|
}
|
|
1640
1644
|
|
|
1645
|
+
/**
|
|
1646
|
+
* Defines which search parameters will be used by the type ahead to search for each resourceType
|
|
1647
|
+
*/
|
|
1648
|
+
const SEARCH_CODES = {
|
|
1649
|
+
Schedule: '_id',
|
|
1650
|
+
Task: '_id',
|
|
1651
|
+
Patient: 'name',
|
|
1652
|
+
Practitioner: 'name',
|
|
1653
|
+
Questionnaire: 'name',
|
|
1654
|
+
ServiceRequest: '_id',
|
|
1655
|
+
DiagnosticReport: '_id',
|
|
1656
|
+
Specimen: '_id',
|
|
1657
|
+
Observation: 'code',
|
|
1658
|
+
RequestGroup: '_id',
|
|
1659
|
+
ActivityDefinition: 'name',
|
|
1660
|
+
};
|
|
1641
1661
|
function ResourceInput(props) {
|
|
1642
1662
|
const medplum = useMedplum();
|
|
1643
1663
|
const defaultValue = useResource(props.defaultValue);
|
|
@@ -1652,7 +1672,12 @@
|
|
|
1652
1672
|
function loadValues(input) {
|
|
1653
1673
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1654
1674
|
setLoading(true);
|
|
1655
|
-
const
|
|
1675
|
+
const searchCode = SEARCH_CODES[props.resourceType] || 'name';
|
|
1676
|
+
const searchParams = new URLSearchParams({
|
|
1677
|
+
[searchCode]: encodeURIComponent(input),
|
|
1678
|
+
_count: '10',
|
|
1679
|
+
});
|
|
1680
|
+
const resources = yield medplum.searchResources(props.resourceType, searchParams);
|
|
1656
1681
|
setData(resources.map((resource) => ({ value: core.getDisplayString(resource), resource })));
|
|
1657
1682
|
setLoading(false);
|
|
1658
1683
|
});
|
|
@@ -1670,16 +1695,16 @@
|
|
|
1670
1695
|
props.onChange(item.resource);
|
|
1671
1696
|
}
|
|
1672
1697
|
}
|
|
1673
|
-
return (
|
|
1698
|
+
return (React.createElement(core$1.Autocomplete, { itemComponent: ItemComponent, value: value, data: data, placeholder: props.placeholder, onFocus: () => loadValues(value), onChange: handleChange, onItemSubmit: handleSelect, rightSection: loading ? React.createElement(core$1.Loader, { size: 16 }) : null }));
|
|
1674
1699
|
}
|
|
1675
1700
|
const ItemComponent = React.forwardRef((_a, ref) => {
|
|
1676
1701
|
var { value, resource } = _a, others = __rest(_a, ["value", "resource"]);
|
|
1677
|
-
return (
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1702
|
+
return (React.createElement("div", Object.assign({ ref: ref }, others),
|
|
1703
|
+
React.createElement(core$1.Group, { noWrap: true },
|
|
1704
|
+
React.createElement(ResourceAvatar, { value: resource }),
|
|
1705
|
+
React.createElement("div", null,
|
|
1706
|
+
React.createElement(core$1.Text, null, value),
|
|
1707
|
+
React.createElement(core$1.Text, { size: "xs", color: "dimmed" }, resource.birthDate)))));
|
|
1683
1708
|
});
|
|
1684
1709
|
|
|
1685
1710
|
function ReferenceInput(props) {
|
|
@@ -1697,9 +1722,9 @@
|
|
|
1697
1722
|
props.onChange(newValue);
|
|
1698
1723
|
}
|
|
1699
1724
|
}
|
|
1700
|
-
return (
|
|
1701
|
-
targetTypes ? (
|
|
1702
|
-
|
|
1725
|
+
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
1726
|
+
targetTypes ? (React.createElement(core$1.NativeSelect, { "data-testid": "reference-input-resource-type-select", defaultValue: resourceType, onChange: (e) => setResourceType(e.currentTarget.value), data: targetTypes })) : (React.createElement(core$1.TextInput, { "data-testid": "reference-input-resource-type-input", defaultValue: resourceType, onChange: (e) => setResourceType(e.currentTarget.value) })),
|
|
1727
|
+
React.createElement(ResourceInput, { resourceType: resourceType, name: props.name + '-id', placeholder: props.placeholder, defaultValue: value, onChange: (item) => {
|
|
1703
1728
|
setValueHelper(item ? core.createReference(item) : undefined);
|
|
1704
1729
|
} })));
|
|
1705
1730
|
}
|
|
@@ -1725,36 +1750,36 @@
|
|
|
1725
1750
|
props.onChange(newValues);
|
|
1726
1751
|
}
|
|
1727
1752
|
}
|
|
1728
|
-
return (
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
values.map((v, index) => (
|
|
1734
|
-
|
|
1735
|
-
|
|
1753
|
+
return (React.createElement("table", { style: { width: '100%', borderCollapse: 'collapse' } },
|
|
1754
|
+
React.createElement("colgroup", null,
|
|
1755
|
+
React.createElement("col", { width: "97%" }),
|
|
1756
|
+
React.createElement("col", { width: "3%" })),
|
|
1757
|
+
React.createElement("tbody", null,
|
|
1758
|
+
values.map((v, index) => (React.createElement("tr", { key: `${index}-${values.length}` },
|
|
1759
|
+
React.createElement("td", null,
|
|
1760
|
+
React.createElement(ResourcePropertyInput, { arrayElement: true, property: props.property, name: props.name + '.' + index, defaultValue: v, onChange: (newValue) => {
|
|
1736
1761
|
const copy = [...valuesRef.current];
|
|
1737
1762
|
copy[index] = newValue;
|
|
1738
1763
|
setValuesWrapper(copy);
|
|
1739
1764
|
} })),
|
|
1740
|
-
|
|
1741
|
-
|
|
1765
|
+
React.createElement("td", { style: { textAlign: 'right' } },
|
|
1766
|
+
React.createElement(core$1.ActionIcon, { title: "Remove", size: "sm", onClick: (e) => {
|
|
1742
1767
|
killEvent(e);
|
|
1743
1768
|
const copy = [...valuesRef.current];
|
|
1744
1769
|
copy.splice(index, 1);
|
|
1745
1770
|
setValuesWrapper(copy);
|
|
1746
1771
|
} },
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1772
|
+
React.createElement(icons.IconCircleMinus, null)))))),
|
|
1773
|
+
React.createElement("tr", null,
|
|
1774
|
+
React.createElement("td", null),
|
|
1775
|
+
React.createElement("td", { style: { textAlign: 'right' } },
|
|
1776
|
+
React.createElement(core$1.ActionIcon, { title: "Add", size: "sm", color: "green", onClick: (e) => {
|
|
1752
1777
|
killEvent(e);
|
|
1753
1778
|
const copy = [...valuesRef.current];
|
|
1754
1779
|
copy.push(undefined);
|
|
1755
1780
|
setValuesWrapper(copy);
|
|
1756
1781
|
} },
|
|
1757
|
-
|
|
1782
|
+
React.createElement(icons.IconCirclePlus, null)))))));
|
|
1758
1783
|
}
|
|
1759
1784
|
|
|
1760
1785
|
const daysOfWeek = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
|
|
@@ -1763,11 +1788,11 @@
|
|
|
1763
1788
|
const [open, setOpen] = React.useState(false);
|
|
1764
1789
|
const valueRef = React.useRef();
|
|
1765
1790
|
valueRef.current = value;
|
|
1766
|
-
return (
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1791
|
+
return (React.createElement(React.Fragment, null,
|
|
1792
|
+
React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
1793
|
+
React.createElement("span", null, core.formatTiming(valueRef.current) || 'No repeat'),
|
|
1794
|
+
React.createElement(core$1.Button, { onClick: () => setOpen(true) }, "Edit")),
|
|
1795
|
+
React.createElement(TimingEditorDialog, { visible: open, defaultValue: valueRef.current, onOk: (newValue) => {
|
|
1771
1796
|
if (props.onChange) {
|
|
1772
1797
|
props.onChange(newValue);
|
|
1773
1798
|
}
|
|
@@ -1816,24 +1841,24 @@
|
|
|
1816
1841
|
setRepeat(Object.assign(Object.assign({}, (_c = valueRef.current) === null || _c === void 0 ? void 0 : _c.repeat), { dayOfWeek: existing.filter((d) => d !== day) }));
|
|
1817
1842
|
}
|
|
1818
1843
|
}
|
|
1819
|
-
return (
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1844
|
+
return (React.createElement(core$1.Modal, { title: "Timing", closeButtonLabel: "Close", opened: props.visible, onClose: () => props.onCancel() },
|
|
1845
|
+
React.createElement("div", { style: { padding: '5px 20px', textAlign: 'left' } },
|
|
1846
|
+
React.createElement(FormSection, { title: "Starts on", htmlFor: 'timing-dialog-start' },
|
|
1847
|
+
React.createElement(DateTimeInput, { name: 'timing-dialog-start', onChange: (newValue) => setStart(newValue) })),
|
|
1848
|
+
React.createElement(FormSection, { title: "Repeat every", htmlFor: 'timing-dialog-period' },
|
|
1849
|
+
React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
1850
|
+
React.createElement(core$1.TextInput, { type: "number", step: 1, id: "timing-dialog-period", name: "timing-dialog-period", defaultValue: (_a = value === null || value === void 0 ? void 0 : value.repeat) === null || _a === void 0 ? void 0 : _a.period, onChange: (e) => setPeriod(parseInt(e.currentTarget.value)) }),
|
|
1851
|
+
React.createElement(core$1.NativeSelect, { id: "timing-dialog-periodUnit", name: "timing-dialog-periodUnit", defaultValue: (_b = value === null || value === void 0 ? void 0 : value.repeat) === null || _b === void 0 ? void 0 : _b.periodUnit, onChange: (e) => setPeriodUnit(e.currentTarget.value), data: [
|
|
1827
1852
|
{ label: 'day', value: 'd' },
|
|
1828
1853
|
{ label: 'week', value: 'wk' },
|
|
1829
1854
|
{ label: 'month', value: 'mo' },
|
|
1830
1855
|
{ label: 'year', value: 'a' },
|
|
1831
1856
|
] }))),
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1857
|
+
React.createElement(FormSection, { title: "Repeat on" },
|
|
1858
|
+
React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true }, daysOfWeek.map((day) => (React.createElement(React.Fragment, { key: day },
|
|
1859
|
+
React.createElement("label", { htmlFor: 'timing-dialog-repeat-' + day }, day.charAt(0).toUpperCase()),
|
|
1860
|
+
React.createElement(core$1.Checkbox, { id: 'timing-dialog-repeat-' + day, name: 'timing-dialog-repeat-' + day, onChange: (e) => setDayOfWeek(day, e.currentTarget.checked) }))))))),
|
|
1861
|
+
React.createElement(core$1.Button, { onClick: () => props.onOk(value) }, "OK")));
|
|
1837
1862
|
}
|
|
1838
1863
|
|
|
1839
1864
|
function ResourcePropertyInput(props) {
|
|
@@ -1844,16 +1869,16 @@
|
|
|
1844
1869
|
const value = props.defaultValue;
|
|
1845
1870
|
if (property.max === '*' && !props.arrayElement) {
|
|
1846
1871
|
if (propertyType === 'Attachment') {
|
|
1847
|
-
return
|
|
1872
|
+
return React.createElement(AttachmentArrayInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
1848
1873
|
}
|
|
1849
|
-
return
|
|
1874
|
+
return React.createElement(ResourceArrayInput, { property: property, name: name, defaultValue: value, onChange: props.onChange });
|
|
1850
1875
|
}
|
|
1851
1876
|
const propertyTypes = property.type;
|
|
1852
1877
|
if (propertyTypes.length > 1) {
|
|
1853
|
-
return
|
|
1878
|
+
return React.createElement(ElementDefinitionInputSelector, Object.assign({ elementDefinitionTypes: propertyTypes }, props));
|
|
1854
1879
|
}
|
|
1855
1880
|
else {
|
|
1856
|
-
return
|
|
1881
|
+
return React.createElement(ElementDefinitionTypeInput, Object.assign({ elementDefinitionType: propertyTypes[0] }, props));
|
|
1857
1882
|
}
|
|
1858
1883
|
}
|
|
1859
1884
|
function ElementDefinitionInputSelector(props) {
|
|
@@ -1866,14 +1891,14 @@
|
|
|
1866
1891
|
initialPropertyType = propertyTypes[0];
|
|
1867
1892
|
}
|
|
1868
1893
|
const [selectedType, setSelectedType] = React.useState(initialPropertyType);
|
|
1869
|
-
return (
|
|
1870
|
-
|
|
1894
|
+
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
1895
|
+
React.createElement(core$1.NativeSelect, { style: { width: '200px' }, defaultValue: selectedType === null || selectedType === void 0 ? void 0 : selectedType.code, onChange: (e) => {
|
|
1871
1896
|
setSelectedType(propertyTypes.find((type) => type.code === e.currentTarget.value));
|
|
1872
1897
|
}, data: propertyTypes.map((type) => ({
|
|
1873
1898
|
value: type.code,
|
|
1874
1899
|
label: type.code,
|
|
1875
1900
|
})) }),
|
|
1876
|
-
|
|
1901
|
+
React.createElement(ElementDefinitionTypeInput, Object.assign({}, props, { elementDefinitionType: selectedType, onChange: (newValue) => {
|
|
1877
1902
|
if (props.onChange) {
|
|
1878
1903
|
props.onChange(newValue, props.name.replace('[x]', core.capitalize(selectedType.code)));
|
|
1879
1904
|
}
|
|
@@ -1894,39 +1919,39 @@
|
|
|
1894
1919
|
case core.PropertyType.time:
|
|
1895
1920
|
case core.PropertyType.uri:
|
|
1896
1921
|
case core.PropertyType.url:
|
|
1897
|
-
return (
|
|
1922
|
+
return (React.createElement(core$1.TextInput, { id: name, name: name, "data-testid": name, defaultValue: value, onChange: (e) => {
|
|
1898
1923
|
if (props.onChange) {
|
|
1899
1924
|
props.onChange(e.currentTarget.value);
|
|
1900
1925
|
}
|
|
1901
1926
|
}, error: getErrorsForInput(props.outcome, name) }));
|
|
1902
1927
|
case core.PropertyType.date:
|
|
1903
|
-
return (
|
|
1928
|
+
return (React.createElement(core$1.TextInput, { type: "date", id: name, name: name, "data-testid": name, defaultValue: value, onChange: (e) => {
|
|
1904
1929
|
if (props.onChange) {
|
|
1905
1930
|
props.onChange(e.currentTarget.value);
|
|
1906
1931
|
}
|
|
1907
1932
|
}, error: getErrorsForInput(props.outcome, name) }));
|
|
1908
1933
|
case core.PropertyType.dateTime:
|
|
1909
1934
|
case core.PropertyType.instant:
|
|
1910
|
-
return
|
|
1935
|
+
return React.createElement(DateTimeInput, { name: name, defaultValue: value, onChange: props.onChange, outcome: props.outcome });
|
|
1911
1936
|
case core.PropertyType.decimal:
|
|
1912
1937
|
case core.PropertyType.integer:
|
|
1913
1938
|
case core.PropertyType.positiveInt:
|
|
1914
1939
|
case core.PropertyType.unsignedInt:
|
|
1915
|
-
return (
|
|
1940
|
+
return (React.createElement(core$1.TextInput, { type: "number", step: propertyType === core.PropertyType.decimal ? 'any' : '1', id: name, name: name, "data-testid": name, defaultValue: value, onChange: (e) => {
|
|
1916
1941
|
if (props.onChange) {
|
|
1917
1942
|
props.onChange(e.currentTarget.valueAsNumber);
|
|
1918
1943
|
}
|
|
1919
1944
|
} }));
|
|
1920
1945
|
case core.PropertyType.code:
|
|
1921
|
-
return
|
|
1946
|
+
return React.createElement(CodeInput, { property: property, name: name, defaultValue: value, onChange: props.onChange });
|
|
1922
1947
|
case core.PropertyType.boolean:
|
|
1923
|
-
return (
|
|
1948
|
+
return (React.createElement(core$1.Checkbox, { id: name, name: name, "data-testid": name, defaultChecked: !!value, onChange: (e) => {
|
|
1924
1949
|
if (props.onChange) {
|
|
1925
1950
|
props.onChange(e.currentTarget.checked);
|
|
1926
1951
|
}
|
|
1927
1952
|
} }));
|
|
1928
1953
|
case core.PropertyType.markdown:
|
|
1929
|
-
return (
|
|
1954
|
+
return (React.createElement(core$1.Textarea, { id: name, name: name, "data-testid": name, defaultValue: value, onChange: (e) => {
|
|
1930
1955
|
if (props.onChange) {
|
|
1931
1956
|
props.onChange(e.currentTarget.value);
|
|
1932
1957
|
}
|
|
@@ -1934,39 +1959,39 @@
|
|
|
1934
1959
|
// 2.24.0.2 Complex Types
|
|
1935
1960
|
// https://www.hl7.org/fhir/datatypes.html#complex
|
|
1936
1961
|
case core.PropertyType.Address:
|
|
1937
|
-
return
|
|
1962
|
+
return React.createElement(AddressInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
1938
1963
|
case core.PropertyType.Annotation:
|
|
1939
|
-
return
|
|
1964
|
+
return React.createElement(AnnotationInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
1940
1965
|
case core.PropertyType.Attachment:
|
|
1941
|
-
return
|
|
1966
|
+
return React.createElement(AttachmentInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
1942
1967
|
case core.PropertyType.CodeableConcept:
|
|
1943
|
-
return
|
|
1968
|
+
return React.createElement(CodeableConceptInput, { property: property, name: name, defaultValue: value, onChange: props.onChange });
|
|
1944
1969
|
case core.PropertyType.Coding:
|
|
1945
|
-
return
|
|
1970
|
+
return React.createElement(CodingInput, { property: property, name: name, defaultValue: value, onChange: props.onChange });
|
|
1946
1971
|
case core.PropertyType.ContactDetail:
|
|
1947
|
-
return
|
|
1972
|
+
return React.createElement(ContactDetailInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
1948
1973
|
case core.PropertyType.ContactPoint:
|
|
1949
|
-
return
|
|
1974
|
+
return React.createElement(ContactPointInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
1950
1975
|
case core.PropertyType.Extension:
|
|
1951
|
-
return
|
|
1976
|
+
return React.createElement(ExtensionInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
1952
1977
|
case core.PropertyType.HumanName:
|
|
1953
|
-
return
|
|
1978
|
+
return React.createElement(HumanNameInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
1954
1979
|
case core.PropertyType.Identifier:
|
|
1955
|
-
return
|
|
1980
|
+
return React.createElement(IdentifierInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
1956
1981
|
case core.PropertyType.Period:
|
|
1957
|
-
return
|
|
1982
|
+
return React.createElement(PeriodInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
1958
1983
|
case core.PropertyType.Quantity:
|
|
1959
|
-
return
|
|
1984
|
+
return React.createElement(QuantityInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
1960
1985
|
case core.PropertyType.Range:
|
|
1961
|
-
return
|
|
1986
|
+
return React.createElement(RangeInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
1962
1987
|
case core.PropertyType.Ratio:
|
|
1963
|
-
return
|
|
1988
|
+
return React.createElement(RatioInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
1964
1989
|
case core.PropertyType.Reference:
|
|
1965
|
-
return (
|
|
1990
|
+
return (React.createElement(ReferenceInput, { name: name, defaultValue: value, targetTypes: getTargetTypes(property), onChange: props.onChange }));
|
|
1966
1991
|
case core.PropertyType.Timing:
|
|
1967
|
-
return
|
|
1992
|
+
return React.createElement(TimingInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
1968
1993
|
default:
|
|
1969
|
-
return (
|
|
1994
|
+
return (React.createElement(BackboneElementInput, { typeName: core.buildTypeName((_a = property.path) === null || _a === void 0 ? void 0 : _a.split('.')), defaultValue: value, onChange: props.onChange, outcome: props.outcome }));
|
|
1970
1995
|
}
|
|
1971
1996
|
}
|
|
1972
1997
|
function getTargetTypes(property) {
|
|
@@ -1986,12 +2011,12 @@
|
|
|
1986
2011
|
const typeName = props.typeName;
|
|
1987
2012
|
const typeSchema = core.globalSchema.types[typeName];
|
|
1988
2013
|
if (!typeSchema) {
|
|
1989
|
-
return
|
|
2014
|
+
return React.createElement("div", null,
|
|
1990
2015
|
typeName,
|
|
1991
2016
|
"\u00A0not implemented");
|
|
1992
2017
|
}
|
|
1993
2018
|
const typedValue = { type: typeName, value };
|
|
1994
|
-
return (
|
|
2019
|
+
return (React.createElement(core$1.Stack, null, Object.entries(typeSchema.properties).map((entry) => {
|
|
1995
2020
|
const key = entry[0];
|
|
1996
2021
|
if (key === 'id' || DEFAULT_IGNORED_PROPERTIES.indexOf(key) >= 0) {
|
|
1997
2022
|
return null;
|
|
@@ -2002,33 +2027,53 @@
|
|
|
2002
2027
|
}
|
|
2003
2028
|
const [propertyValue, propertyType] = getValueAndType(typedValue, key);
|
|
2004
2029
|
if (property.type.length === 1 && property.type[0].code === 'boolean') {
|
|
2005
|
-
return (
|
|
2006
|
-
|
|
2030
|
+
return (React.createElement(CheckboxFormSection, { key: key, title: core.getPropertyDisplayName(key), description: property.definition, htmlFor: key },
|
|
2031
|
+
React.createElement(ResourcePropertyInput, { property: property, name: key, defaultValue: propertyValue, defaultPropertyType: propertyType, outcome: props.outcome, onChange: (newValue, propName) => {
|
|
2007
2032
|
setValueWrapper(setPropertyValue(value, key, propName !== null && propName !== void 0 ? propName : key, entry[1], newValue));
|
|
2008
2033
|
} })));
|
|
2009
2034
|
}
|
|
2010
|
-
return (
|
|
2011
|
-
|
|
2035
|
+
return (React.createElement(FormSection, { key: key, title: core.getPropertyDisplayName(key), description: property.definition, htmlFor: key, outcome: props.outcome },
|
|
2036
|
+
React.createElement(ResourcePropertyInput, { property: property, name: key, defaultValue: propertyValue, defaultPropertyType: propertyType, outcome: props.outcome, onChange: (newValue, propName) => {
|
|
2012
2037
|
setValueWrapper(setPropertyValue(value, key, propName !== null && propName !== void 0 ? propName : key, entry[1], newValue));
|
|
2013
2038
|
} })));
|
|
2014
2039
|
})));
|
|
2015
2040
|
}
|
|
2016
2041
|
|
|
2017
2042
|
function ResourceName(props) {
|
|
2018
|
-
const
|
|
2043
|
+
const { value, link } = props, rest = __rest(props, ["value", "link"]);
|
|
2044
|
+
const resource = useResource(value);
|
|
2019
2045
|
if (!resource) {
|
|
2020
2046
|
return null;
|
|
2021
2047
|
}
|
|
2022
2048
|
const text = core.getDisplayString(resource);
|
|
2023
|
-
return
|
|
2049
|
+
return link ? (React.createElement(MedplumLink, Object.assign({ to: resource }, rest), text)) : (React.createElement(core$1.Text, Object.assign({ component: "span" }, rest), text));
|
|
2024
2050
|
}
|
|
2025
2051
|
|
|
2026
2052
|
function ResourceBadge(props) {
|
|
2027
|
-
return (
|
|
2028
|
-
|
|
2029
|
-
|
|
2053
|
+
return (React.createElement(core$1.Group, { spacing: "xs" },
|
|
2054
|
+
React.createElement(ResourceAvatar, { size: 24, radius: 12, value: props.value, link: props.link }),
|
|
2055
|
+
React.createElement(ResourceName, { value: props.value, link: props.link })));
|
|
2030
2056
|
}
|
|
2031
2057
|
|
|
2058
|
+
const useStyles$a = core$1.createStyles((theme) => ({
|
|
2059
|
+
table: {
|
|
2060
|
+
border: `0.1px solid ${theme.colors.gray[5]}`,
|
|
2061
|
+
borderCollapse: 'collapse',
|
|
2062
|
+
'& td, & th': {
|
|
2063
|
+
border: `0.1px solid ${theme.colors.gray[5]}`,
|
|
2064
|
+
padding: 4,
|
|
2065
|
+
},
|
|
2066
|
+
},
|
|
2067
|
+
criticalRow: {
|
|
2068
|
+
background: theme.colorScheme === 'dark' ? theme.colors.red[7] : theme.colors.red[1],
|
|
2069
|
+
border: `0.1px solid ${theme.colors.red[5]}`,
|
|
2070
|
+
color: theme.colors.red[5],
|
|
2071
|
+
fontWeight: 500,
|
|
2072
|
+
'& td': {
|
|
2073
|
+
border: `0.1px solid ${theme.colors.red[5]}`,
|
|
2074
|
+
},
|
|
2075
|
+
},
|
|
2076
|
+
}));
|
|
2032
2077
|
function DiagnosticReportDisplay(props) {
|
|
2033
2078
|
var _a, _b;
|
|
2034
2079
|
const diagnosticReport = useResource(props.value);
|
|
@@ -2048,69 +2093,68 @@
|
|
|
2048
2093
|
textContent += note.text + '\n\n';
|
|
2049
2094
|
}
|
|
2050
2095
|
}
|
|
2051
|
-
return (
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
diagnosticReport.subject && (
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2096
|
+
return (React.createElement(core$1.Stack, null,
|
|
2097
|
+
React.createElement(core$1.Title, null, "Diagnostic Report"),
|
|
2098
|
+
React.createElement(core$1.Group, { mt: "md", spacing: 30 },
|
|
2099
|
+
diagnosticReport.subject && (React.createElement("div", null,
|
|
2100
|
+
React.createElement(core$1.Text, { size: "xs", transform: "uppercase", color: "dimmed" }, "Subject"),
|
|
2101
|
+
React.createElement(core$1.Text, null,
|
|
2102
|
+
React.createElement(ResourceBadge, { value: diagnosticReport.subject, link: true })))),
|
|
2058
2103
|
diagnosticReport.resultsInterpreter &&
|
|
2059
|
-
diagnosticReport.resultsInterpreter.map((interpreter) => (
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
diagnosticReport.issued && (
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
diagnosticReport.status && (
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
diagnosticReport.result &&
|
|
2070
|
-
textContent &&
|
|
2104
|
+
diagnosticReport.resultsInterpreter.map((interpreter) => (React.createElement("div", { key: interpreter.reference },
|
|
2105
|
+
React.createElement(core$1.Text, { size: "xs", transform: "uppercase", color: "dimmed" }, "Interpreter"),
|
|
2106
|
+
React.createElement(core$1.Text, null,
|
|
2107
|
+
React.createElement(ResourceBadge, { value: interpreter, link: true }))))),
|
|
2108
|
+
diagnosticReport.issued && (React.createElement("div", null,
|
|
2109
|
+
React.createElement(core$1.Text, { size: "xs", transform: "uppercase", color: "dimmed" }, "Issued"),
|
|
2110
|
+
React.createElement(core$1.Text, null, core.formatDateTime(diagnosticReport.issued)))),
|
|
2111
|
+
diagnosticReport.status && (React.createElement("div", null,
|
|
2112
|
+
React.createElement(core$1.Text, { size: "xs", transform: "uppercase", color: "dimmed" }, "Status"),
|
|
2113
|
+
React.createElement(core$1.Text, null, core.capitalize(diagnosticReport.status))))),
|
|
2114
|
+
diagnosticReport.result && React.createElement(ObservationTable, { value: diagnosticReport.result }),
|
|
2115
|
+
textContent && React.createElement("pre", null, textContent.trim())));
|
|
2071
2116
|
}
|
|
2072
2117
|
function ObservationTable(props) {
|
|
2073
2118
|
var _a;
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2119
|
+
const { classes } = useStyles$a();
|
|
2120
|
+
return (React.createElement("table", { className: classes.table },
|
|
2121
|
+
React.createElement("thead", null,
|
|
2122
|
+
React.createElement("tr", null,
|
|
2123
|
+
React.createElement("th", null, "Test"),
|
|
2124
|
+
React.createElement("th", null, "Value"),
|
|
2125
|
+
React.createElement("th", null, "Reference Range"),
|
|
2126
|
+
React.createElement("th", null, "Interpretation"))),
|
|
2127
|
+
React.createElement("tbody", null, (_a = props.value) === null || _a === void 0 ? void 0 : _a.map((observation, index) => (React.createElement(ObservationRow, { key: 'obs-' + index, value: observation }))))));
|
|
2082
2128
|
}
|
|
2083
2129
|
function ObservationRow(props) {
|
|
2130
|
+
const { classes, cx } = useStyles$a();
|
|
2084
2131
|
const observation = useResource(props.value);
|
|
2085
2132
|
if (!observation) {
|
|
2086
2133
|
return null;
|
|
2087
2134
|
}
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
React__default["default"].createElement("td", null,
|
|
2099
|
-
React__default["default"].createElement(ReferenceRangeDisplay, { value: observation.referenceRange })),
|
|
2100
|
-
React__default["default"].createElement("td", null, observation.interpretation && observation.interpretation.length > 0 && (React__default["default"].createElement(CodeableConceptDisplay, { value: observation.interpretation[0] })))));
|
|
2135
|
+
const critical = isCritical(observation);
|
|
2136
|
+
return (React.createElement("tr", { className: cx({ [classes.criticalRow]: critical }) },
|
|
2137
|
+
React.createElement("td", null,
|
|
2138
|
+
React.createElement(MedplumLink, { to: observation },
|
|
2139
|
+
React.createElement(CodeableConceptDisplay, { value: observation.code }))),
|
|
2140
|
+
React.createElement("td", null,
|
|
2141
|
+
React.createElement(ObservationValueDisplay, { value: observation })),
|
|
2142
|
+
React.createElement("td", null,
|
|
2143
|
+
React.createElement(ReferenceRangeDisplay, { value: observation.referenceRange })),
|
|
2144
|
+
React.createElement("td", null, observation.interpretation && observation.interpretation.length > 0 && (React.createElement(CodeableConceptDisplay, { value: observation.interpretation[0] })))));
|
|
2101
2145
|
}
|
|
2102
2146
|
function ObservationValueDisplay(props) {
|
|
2103
2147
|
var _a;
|
|
2104
2148
|
const obs = props.value;
|
|
2105
2149
|
if (obs === null || obs === void 0 ? void 0 : obs.valueQuantity) {
|
|
2106
|
-
return
|
|
2150
|
+
return React.createElement(QuantityDisplay, { value: (_a = props.value) === null || _a === void 0 ? void 0 : _a.valueQuantity });
|
|
2107
2151
|
}
|
|
2108
2152
|
if (obs === null || obs === void 0 ? void 0 : obs.valueString) {
|
|
2109
|
-
return
|
|
2153
|
+
return React.createElement(React.Fragment, null, obs.valueString);
|
|
2110
2154
|
}
|
|
2111
2155
|
if (obs && 'component' in obs && (obs === null || obs === void 0 ? void 0 : obs.component)) {
|
|
2112
|
-
return (
|
|
2113
|
-
.map((component, index) => (
|
|
2156
|
+
return (React.createElement(React.Fragment, null, obs.component
|
|
2157
|
+
.map((component, index) => (React.createElement(ObservationValueDisplay, { key: `obs-${index}`, value: component })))
|
|
2114
2158
|
.reduce((prev, curr) => [prev, ' / ', curr])));
|
|
2115
2159
|
}
|
|
2116
2160
|
return null;
|
|
@@ -2121,9 +2165,9 @@
|
|
|
2121
2165
|
return null;
|
|
2122
2166
|
}
|
|
2123
2167
|
if (range.text) {
|
|
2124
|
-
return
|
|
2168
|
+
return React.createElement(React.Fragment, null, range.text);
|
|
2125
2169
|
}
|
|
2126
|
-
return
|
|
2170
|
+
return React.createElement(RangeDisplay, { value: range });
|
|
2127
2171
|
}
|
|
2128
2172
|
/**
|
|
2129
2173
|
* Returns true if the observation is critical.
|
|
@@ -2134,10 +2178,31 @@
|
|
|
2134
2178
|
function isCritical(observation) {
|
|
2135
2179
|
var _a, _b, _c, _d;
|
|
2136
2180
|
const code = (_d = (_c = (_b = (_a = observation.interpretation) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.coding) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.code;
|
|
2137
|
-
return code === 'AA' || code === 'LL' || code === 'HH' || code === '
|
|
2181
|
+
return code === 'AA' || code === 'LL' || code === 'HH' || code === 'A';
|
|
2138
2182
|
}
|
|
2139
2183
|
|
|
2184
|
+
const useStyles$9 = core$1.createStyles((theme) => ({
|
|
2185
|
+
root: {
|
|
2186
|
+
borderCollapse: 'collapse',
|
|
2187
|
+
width: '100%',
|
|
2188
|
+
'& tr': {
|
|
2189
|
+
borderTop: `0.1px solid ${theme.colors.gray[3]}`,
|
|
2190
|
+
},
|
|
2191
|
+
'& th, & td': {
|
|
2192
|
+
padding: `${theme.spacing.sm}px ${theme.spacing.sm}px`,
|
|
2193
|
+
verticalAlign: 'top',
|
|
2194
|
+
},
|
|
2195
|
+
},
|
|
2196
|
+
removed: {
|
|
2197
|
+
color: theme.colors.red[7],
|
|
2198
|
+
textDecoration: 'line-through',
|
|
2199
|
+
},
|
|
2200
|
+
added: {
|
|
2201
|
+
color: theme.colors.green[7],
|
|
2202
|
+
},
|
|
2203
|
+
}));
|
|
2140
2204
|
function ResourceDiffTable(props) {
|
|
2205
|
+
const { classes } = useStyles$9();
|
|
2141
2206
|
const medplum = useMedplum();
|
|
2142
2207
|
const [schema, setSchema] = React.useState();
|
|
2143
2208
|
React.useEffect(() => {
|
|
@@ -2150,17 +2215,17 @@
|
|
|
2150
2215
|
if (!typeSchema) {
|
|
2151
2216
|
return null;
|
|
2152
2217
|
}
|
|
2153
|
-
return (
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2218
|
+
return (React.createElement("table", { className: classes.root },
|
|
2219
|
+
React.createElement("colgroup", null,
|
|
2220
|
+
React.createElement("col", { style: { width: '30%' } }),
|
|
2221
|
+
React.createElement("col", { style: { width: '35%' } }),
|
|
2222
|
+
React.createElement("col", { style: { width: '35%' } })),
|
|
2223
|
+
React.createElement("thead", null,
|
|
2224
|
+
React.createElement("tr", null,
|
|
2225
|
+
React.createElement("th", null, "Property"),
|
|
2226
|
+
React.createElement("th", null, "Before"),
|
|
2227
|
+
React.createElement("th", null, "After"))),
|
|
2228
|
+
React.createElement("tbody", null, Object.entries(typeSchema.properties).map((entry) => {
|
|
2164
2229
|
const key = entry[0];
|
|
2165
2230
|
if (key === 'id' || key === 'meta') {
|
|
2166
2231
|
return null;
|
|
@@ -2174,12 +2239,12 @@
|
|
|
2174
2239
|
if (core.stringify(originalPropertyValue) === core.stringify(revisedPropertyValue)) {
|
|
2175
2240
|
return null;
|
|
2176
2241
|
}
|
|
2177
|
-
return (
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2242
|
+
return (React.createElement("tr", { key: key },
|
|
2243
|
+
React.createElement("td", null, core.getPropertyDisplayName(key)),
|
|
2244
|
+
React.createElement("td", { className: classes.removed },
|
|
2245
|
+
React.createElement(ResourcePropertyDisplay, { property: property, propertyType: originalPropertyType, value: originalPropertyValue, ignoreMissingValues: true })),
|
|
2246
|
+
React.createElement("td", { className: classes.added },
|
|
2247
|
+
React.createElement(ResourcePropertyDisplay, { property: property, propertyType: revisedPropertyType, value: revisedPropertyValue, ignoreMissingValues: true }))));
|
|
2183
2248
|
}))));
|
|
2184
2249
|
}
|
|
2185
2250
|
function isEmpty(value) {
|
|
@@ -2200,14 +2265,14 @@
|
|
|
2200
2265
|
if (!schema || !value) {
|
|
2201
2266
|
return null;
|
|
2202
2267
|
}
|
|
2203
|
-
return (
|
|
2268
|
+
return (React.createElement(BackboneElementDisplay, { value: { type: value.resourceType, value }, ignoreMissingValues: props.ignoreMissingValues }));
|
|
2204
2269
|
}
|
|
2205
2270
|
|
|
2206
2271
|
/**
|
|
2207
2272
|
* ErrorBoundary is a React component that handles errors in its child components.
|
|
2208
2273
|
* See: https://reactjs.org/docs/error-boundaries.html
|
|
2209
2274
|
*/
|
|
2210
|
-
class ErrorBoundary extends
|
|
2275
|
+
class ErrorBoundary extends React.Component {
|
|
2211
2276
|
constructor(props) {
|
|
2212
2277
|
super(props);
|
|
2213
2278
|
this.state = {};
|
|
@@ -2220,39 +2285,36 @@
|
|
|
2220
2285
|
}
|
|
2221
2286
|
render() {
|
|
2222
2287
|
if (this.state.error) {
|
|
2223
|
-
return
|
|
2288
|
+
return (React.createElement(core$1.Alert, { icon: React.createElement(icons.IconAlertCircle, { size: 16 }), title: "Something went wrong", color: "red" }, core.normalizeErrorString(this.state.error)));
|
|
2224
2289
|
}
|
|
2225
2290
|
return this.props.children;
|
|
2226
2291
|
}
|
|
2227
2292
|
}
|
|
2228
2293
|
|
|
2229
2294
|
function Timeline(props) {
|
|
2230
|
-
return
|
|
2295
|
+
return React.createElement(core$1.Container, null, props.children);
|
|
2231
2296
|
}
|
|
2232
2297
|
function TimelineItem(props) {
|
|
2233
2298
|
var _a, _b, _c;
|
|
2234
2299
|
const author = (_a = props.profile) !== null && _a !== void 0 ? _a : (_b = props.resource.meta) === null || _b === void 0 ? void 0 : _b.author;
|
|
2235
|
-
return (
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
props.popupMenuItems && (
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2300
|
+
return (React.createElement(core$1.Paper, { "data-testid": "timeline-item", m: "lg", p: "sm", shadow: "xs", radius: "sm", withBorder: true, className: props.className },
|
|
2301
|
+
React.createElement(core$1.Group, { position: "apart", spacing: 8 },
|
|
2302
|
+
React.createElement(ResourceAvatar, { value: author, link: true, size: "md" }),
|
|
2303
|
+
React.createElement("div", { style: { flex: 1 } },
|
|
2304
|
+
React.createElement(core$1.Text, { size: "sm" },
|
|
2305
|
+
React.createElement(ResourceName, { color: "dark", weight: 500, value: author, link: true })),
|
|
2306
|
+
React.createElement(core$1.Text, { size: "xs" },
|
|
2307
|
+
React.createElement(MedplumLink, { color: "dimmed", to: props.resource }, core.formatDateTime((_c = props.resource.meta) === null || _c === void 0 ? void 0 : _c.lastUpdated)),
|
|
2308
|
+
React.createElement(core$1.Text, { component: "span", color: "dimmed", mx: 8 }, "\u00B7"),
|
|
2309
|
+
React.createElement(MedplumLink, { color: "dimmed", to: props.resource }, props.resource.resourceType))),
|
|
2310
|
+
props.popupMenuItems && (React.createElement(core$1.Menu, { position: "bottom-end", shadow: "md", width: 200 },
|
|
2311
|
+
React.createElement(core$1.Menu.Target, null,
|
|
2312
|
+
React.createElement(core$1.ActionIcon, { radius: "xl", "aria-label": `Actions for ${core.getReferenceString(props.resource)}` },
|
|
2313
|
+
React.createElement(icons.IconDots, null))),
|
|
2249
2314
|
props.popupMenuItems))),
|
|
2250
|
-
|
|
2251
|
-
props.padding &&
|
|
2252
|
-
!props.padding &&
|
|
2253
|
-
props.socialEnabled && (React__default["default"].createElement("div", { className: "medplum-timeline-item-footer" },
|
|
2254
|
-
React__default["default"].createElement(core$1.Button, { variant: "subtle" }, "Like"),
|
|
2255
|
-
React__default["default"].createElement(core$1.Button, { variant: "subtle" }, "Comment")))));
|
|
2315
|
+
React.createElement(ErrorBoundary, null,
|
|
2316
|
+
props.padding && React.createElement("div", { style: { padding: '2px 16px 16px 16px' } }, props.children),
|
|
2317
|
+
!props.padding && React.createElement(React.Fragment, null, props.children))));
|
|
2256
2318
|
}
|
|
2257
2319
|
|
|
2258
2320
|
/**
|
|
@@ -2301,6 +2363,11 @@
|
|
|
2301
2363
|
return new Date(dateTime).getTime();
|
|
2302
2364
|
}
|
|
2303
2365
|
|
|
2366
|
+
const useStyles$8 = core$1.createStyles((theme) => ({
|
|
2367
|
+
pinnedComment: {
|
|
2368
|
+
backgroundColor: theme.colors.blue[0],
|
|
2369
|
+
},
|
|
2370
|
+
}));
|
|
2304
2371
|
function ResourceTimeline(props) {
|
|
2305
2372
|
const navigate = reactRouterDom.useNavigate();
|
|
2306
2373
|
const medplum = useMedplum();
|
|
@@ -2389,10 +2456,23 @@
|
|
|
2389
2456
|
}
|
|
2390
2457
|
medplum
|
|
2391
2458
|
.createResource(props.createMedia(resource, sender, attachment))
|
|
2392
|
-
.then((result) =>
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2459
|
+
.then((result) => addResources([result]))
|
|
2460
|
+
.then(() => notifications.updateNotification({
|
|
2461
|
+
id: 'upload-notification',
|
|
2462
|
+
color: 'teal',
|
|
2463
|
+
title: 'Upload complete',
|
|
2464
|
+
message: '',
|
|
2465
|
+
icon: React.createElement(icons.IconCheck, { size: 16 }),
|
|
2466
|
+
autoClose: 2000,
|
|
2467
|
+
}))
|
|
2468
|
+
.catch((reason) => notifications.updateNotification({
|
|
2469
|
+
id: 'upload-notification',
|
|
2470
|
+
color: 'red',
|
|
2471
|
+
title: 'Upload error',
|
|
2472
|
+
message: core.normalizeErrorString(reason),
|
|
2473
|
+
icon: React.createElement(icons.IconFileAlert, { size: 16 }),
|
|
2474
|
+
autoClose: 2000,
|
|
2475
|
+
}));
|
|
2396
2476
|
}
|
|
2397
2477
|
function setPriority(communication, priority) {
|
|
2398
2478
|
return medplum.updateResource(Object.assign(Object.assign({}, communication), { priority }));
|
|
@@ -2416,70 +2496,90 @@
|
|
|
2416
2496
|
var _a;
|
|
2417
2497
|
navigate(`/${version.resourceType}/${version.id}/_history/${(_a = version.meta) === null || _a === void 0 ? void 0 : _a.versionId}`);
|
|
2418
2498
|
}
|
|
2499
|
+
function onUploadStart() {
|
|
2500
|
+
notifications.showNotification({
|
|
2501
|
+
id: 'upload-notification',
|
|
2502
|
+
loading: true,
|
|
2503
|
+
title: 'Initializing upload...',
|
|
2504
|
+
message: 'Please wait...',
|
|
2505
|
+
autoClose: false,
|
|
2506
|
+
disallowClose: true,
|
|
2507
|
+
});
|
|
2508
|
+
}
|
|
2509
|
+
function onUploadProgress(e) {
|
|
2510
|
+
notifications.updateNotification({
|
|
2511
|
+
id: 'upload-notification',
|
|
2512
|
+
loading: true,
|
|
2513
|
+
title: 'Uploading...',
|
|
2514
|
+
message: getProgressMessage(e),
|
|
2515
|
+
autoClose: false,
|
|
2516
|
+
disallowClose: true,
|
|
2517
|
+
});
|
|
2518
|
+
}
|
|
2419
2519
|
if (!resource || !history) {
|
|
2420
|
-
return
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2520
|
+
return (React.createElement(core$1.Center, { style: { width: '100%', height: '100%' } },
|
|
2521
|
+
React.createElement(core$1.Loader, null)));
|
|
2522
|
+
}
|
|
2523
|
+
return (React.createElement(Timeline, null,
|
|
2524
|
+
props.createCommunication && (React.createElement(core$1.Paper, { m: "lg", p: "sm", shadow: "xs", radius: "sm", withBorder: true },
|
|
2525
|
+
React.createElement(Form, { testid: "timeline-form", onSubmit: (formData) => {
|
|
2526
|
+
createComment(formData.text);
|
|
2527
|
+
const input = inputRef.current;
|
|
2528
|
+
if (input) {
|
|
2529
|
+
input.value = '';
|
|
2530
|
+
input.focus();
|
|
2531
|
+
}
|
|
2532
|
+
} },
|
|
2533
|
+
React.createElement(core$1.Group, { spacing: "xs", noWrap: true, style: { width: '100%' } },
|
|
2534
|
+
React.createElement(ResourceAvatar, { value: sender }),
|
|
2535
|
+
React.createElement(core$1.TextInput, { name: "text", ref: inputRef, placeholder: "Add comment", style: { width: '100%', maxWidth: 300 } }),
|
|
2536
|
+
React.createElement(core$1.ActionIcon, { type: "submit", radius: "xl", color: "blue", variant: "filled" },
|
|
2537
|
+
React.createElement(icons.IconMessage, { size: 16 })),
|
|
2538
|
+
React.createElement(AttachmentButton, { onUpload: createMedia, onUploadStart: onUploadStart, onUploadProgress: onUploadProgress }, (props) => (React.createElement(core$1.ActionIcon, Object.assign({}, props, { radius: "xl", color: "blue", variant: "filled" }),
|
|
2539
|
+
React.createElement(icons.IconCloudUpload, { size: 16 })))))))),
|
|
2440
2540
|
items.map((item) => {
|
|
2441
2541
|
var _a;
|
|
2442
2542
|
if (item.resourceType === resource.resourceType && item.id === resource.id) {
|
|
2443
|
-
return (
|
|
2543
|
+
return (React.createElement(HistoryTimelineItem, { key: (_a = item.meta) === null || _a === void 0 ? void 0 : _a.versionId, history: history, resource: item, onDetails: onVersionDetails }));
|
|
2444
2544
|
}
|
|
2445
2545
|
const key = `${item.resourceType}/${item.id}`;
|
|
2446
2546
|
switch (item.resourceType) {
|
|
2447
2547
|
case 'AuditEvent':
|
|
2448
|
-
return
|
|
2548
|
+
return React.createElement(AuditEventTimelineItem, { key: key, resource: item, onDetails: onDetails });
|
|
2449
2549
|
case 'Communication':
|
|
2450
|
-
return (
|
|
2550
|
+
return (React.createElement(CommunicationTimelineItem, { key: key, resource: item, onPin: item.priority !== 'stat' ? onPin : undefined, onUnpin: item.priority === 'stat' ? onUnpin : undefined, onDetails: onDetails, onEdit: onEdit, onDelete: onDelete }));
|
|
2451
2551
|
case 'DiagnosticReport':
|
|
2452
|
-
return (
|
|
2552
|
+
return (React.createElement(DiagnosticReportTimelineItem, { key: key, resource: item, onDetails: onDetails, onEdit: onEdit, onDelete: onDelete }));
|
|
2453
2553
|
case 'Media':
|
|
2454
|
-
return (
|
|
2554
|
+
return (React.createElement(MediaTimelineItem, { key: key, resource: item, onDetails: onDetails, onEdit: onEdit, onDelete: onDelete }));
|
|
2455
2555
|
default:
|
|
2456
|
-
return (
|
|
2457
|
-
|
|
2556
|
+
return (React.createElement(TimelineItem, { key: key, resource: item, padding: true },
|
|
2557
|
+
React.createElement(ResourceTable, { value: item, ignoreMissingValues: true })));
|
|
2458
2558
|
}
|
|
2459
2559
|
})));
|
|
2460
2560
|
}
|
|
2461
2561
|
function TimelineItemPopupMenu(props) {
|
|
2462
|
-
return (
|
|
2463
|
-
|
|
2464
|
-
props.onPin && (
|
|
2465
|
-
props.onUnpin && (
|
|
2466
|
-
props.onDetails && (
|
|
2467
|
-
props.onEdit && (
|
|
2468
|
-
props.onDelete && (
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2562
|
+
return (React.createElement(core$1.Menu.Dropdown, null,
|
|
2563
|
+
React.createElement(core$1.Menu.Label, null, "Resource"),
|
|
2564
|
+
props.onPin && (React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconPin, { size: 14 }), onClick: () => props.onPin(props.resource), "aria-label": `Pin ${core.getReferenceString(props.resource)}` }, "Pin")),
|
|
2565
|
+
props.onUnpin && (React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconPinnedOff, { size: 14 }), onClick: () => props.onUnpin(props.resource), "aria-label": `Unpin ${core.getReferenceString(props.resource)}` }, "Unpin")),
|
|
2566
|
+
props.onDetails && (React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconListDetails, { size: 14 }), onClick: () => props.onDetails(props.resource), "aria-label": `Details ${core.getReferenceString(props.resource)}` }, "Details")),
|
|
2567
|
+
props.onEdit && (React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconEdit, { size: 14 }), onClick: () => props.onEdit(props.resource), "aria-label": `Edit ${core.getReferenceString(props.resource)}` }, "Edit")),
|
|
2568
|
+
props.onDelete && (React.createElement(React.Fragment, null,
|
|
2569
|
+
React.createElement(core$1.Menu.Divider, null),
|
|
2570
|
+
React.createElement(core$1.Menu.Label, null, "Danger zone"),
|
|
2571
|
+
React.createElement(core$1.Menu.Item, { color: "red", icon: React.createElement(icons.IconTrash, { size: 14 }), onClick: () => props.onDelete(props.resource), "aria-label": `Delete ${core.getReferenceString(props.resource)}` }, "Delete")))));
|
|
2472
2572
|
}
|
|
2473
2573
|
function HistoryTimelineItem(props) {
|
|
2474
2574
|
const previous = getPrevious(props.history, props.resource);
|
|
2475
2575
|
if (previous) {
|
|
2476
|
-
return (
|
|
2477
|
-
|
|
2576
|
+
return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu, Object.assign({}, props)) },
|
|
2577
|
+
React.createElement(ResourceDiffTable, { original: previous, revised: props.resource })));
|
|
2478
2578
|
}
|
|
2479
2579
|
else {
|
|
2480
|
-
return (
|
|
2481
|
-
|
|
2482
|
-
|
|
2580
|
+
return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu, Object.assign({}, props)) },
|
|
2581
|
+
React.createElement("h3", null, "Created"),
|
|
2582
|
+
React.createElement(ResourceTable, { value: props.resource, ignoreMissingValues: true })));
|
|
2483
2583
|
}
|
|
2484
2584
|
}
|
|
2485
2585
|
function getPrevious(history, version) {
|
|
@@ -2492,10 +2592,11 @@
|
|
|
2492
2592
|
}
|
|
2493
2593
|
function CommunicationTimelineItem(props) {
|
|
2494
2594
|
var _a, _b;
|
|
2595
|
+
const { classes } = useStyles$8();
|
|
2495
2596
|
const routine = !props.resource.priority || props.resource.priority === 'routine';
|
|
2496
|
-
const className = routine ?
|
|
2497
|
-
return (
|
|
2498
|
-
|
|
2597
|
+
const className = routine ? undefined : classes.pinnedComment;
|
|
2598
|
+
return (React.createElement(TimelineItem, { resource: props.resource, profile: props.resource.sender, padding: true, className: className, popupMenuItems: React.createElement(TimelineItemPopupMenu, Object.assign({}, props)) },
|
|
2599
|
+
React.createElement("p", null, (_b = (_a = props.resource.payload) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.contentString)));
|
|
2499
2600
|
}
|
|
2500
2601
|
function MediaTimelineItem(props) {
|
|
2501
2602
|
var _a;
|
|
@@ -2504,21 +2605,35 @@
|
|
|
2504
2605
|
!contentType.startsWith('image/') &&
|
|
2505
2606
|
!contentType.startsWith('video/') &&
|
|
2506
2607
|
contentType !== 'application/pdf';
|
|
2507
|
-
return (
|
|
2508
|
-
|
|
2608
|
+
return (React.createElement(TimelineItem, { resource: props.resource, padding: !!padding, popupMenuItems: React.createElement(TimelineItemPopupMenu, Object.assign({}, props)) },
|
|
2609
|
+
React.createElement(AttachmentDisplay, { value: props.resource.content })));
|
|
2509
2610
|
}
|
|
2510
2611
|
function AuditEventTimelineItem(props) {
|
|
2511
|
-
return (
|
|
2512
|
-
|
|
2513
|
-
|
|
2612
|
+
return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu, Object.assign({}, props)) },
|
|
2613
|
+
React.createElement(core$1.ScrollArea, null,
|
|
2614
|
+
React.createElement("pre", null, props.resource.outcomeDesc))));
|
|
2514
2615
|
}
|
|
2515
2616
|
function DiagnosticReportTimelineItem(props) {
|
|
2516
|
-
return (
|
|
2517
|
-
|
|
2617
|
+
return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu, Object.assign({}, props)) },
|
|
2618
|
+
React.createElement(DiagnosticReportDisplay, { value: props.resource })));
|
|
2619
|
+
}
|
|
2620
|
+
function getProgressMessage(e) {
|
|
2621
|
+
if (e.lengthComputable) {
|
|
2622
|
+
const percent = (100 * e.loaded) / e.total;
|
|
2623
|
+
return `Uploaded: ${formatFileSize(e.loaded)} / ${formatFileSize(e.total)} ${percent.toFixed(2)}%`;
|
|
2624
|
+
}
|
|
2625
|
+
return `Uploaded: ${formatFileSize(e.loaded)}`;
|
|
2626
|
+
}
|
|
2627
|
+
function formatFileSize(bytes) {
|
|
2628
|
+
if (bytes == 0) {
|
|
2629
|
+
return '0.00 B';
|
|
2630
|
+
}
|
|
2631
|
+
const e = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
2632
|
+
return (bytes / Math.pow(1024, e)).toFixed(2) + ' ' + ' KMGTP'.charAt(e) + 'B';
|
|
2518
2633
|
}
|
|
2519
2634
|
|
|
2520
2635
|
function DefaultResourceTimeline(props) {
|
|
2521
|
-
return (
|
|
2636
|
+
return (React.createElement(ResourceTimeline, { value: props.resource, buildSearchRequests: (resource) => ({
|
|
2522
2637
|
resourceType: 'Bundle',
|
|
2523
2638
|
type: 'batch',
|
|
2524
2639
|
entry: [
|
|
@@ -2539,7 +2654,7 @@
|
|
|
2539
2654
|
}
|
|
2540
2655
|
|
|
2541
2656
|
function EncounterTimeline(props) {
|
|
2542
|
-
return (
|
|
2657
|
+
return (React.createElement(ResourceTimeline, { value: props.encounter, buildSearchRequests: (resource) => ({
|
|
2543
2658
|
resourceType: 'Bundle',
|
|
2544
2659
|
type: 'batch',
|
|
2545
2660
|
entry: [
|
|
@@ -2595,99 +2710,7 @@
|
|
|
2595
2710
|
Received ${value.length} elements \
|
|
2596
2711
|
[${JSON.stringify(value, null, 2)}]`);
|
|
2597
2712
|
}
|
|
2598
|
-
return
|
|
2599
|
-
}
|
|
2600
|
-
|
|
2601
|
-
/**
|
|
2602
|
-
* Returns the collection of field definitions for the search request.
|
|
2603
|
-
* @param search The search request definition.
|
|
2604
|
-
* @returns An array of field definitions.
|
|
2605
|
-
*/
|
|
2606
|
-
function getFieldDefinitions(search) {
|
|
2607
|
-
const resourceType = search.resourceType;
|
|
2608
|
-
const fields = [];
|
|
2609
|
-
for (const name of search.fields || ['id', '_lastUpdated']) {
|
|
2610
|
-
fields.push(getFieldDefinition(resourceType, name));
|
|
2611
|
-
}
|
|
2612
|
-
return fields;
|
|
2613
|
-
}
|
|
2614
|
-
/**
|
|
2615
|
-
* Return the field definition for a given field name.
|
|
2616
|
-
* Field names can be either property names or search parameter codes.
|
|
2617
|
-
* @param resourceType The resource type.
|
|
2618
|
-
* @param name The search field name (either property name or search parameter code).
|
|
2619
|
-
* @returns The field definition.
|
|
2620
|
-
*/
|
|
2621
|
-
function getFieldDefinition(resourceType, name) {
|
|
2622
|
-
var _a;
|
|
2623
|
-
if (name === '_lastUpdated') {
|
|
2624
|
-
return {
|
|
2625
|
-
name: '_lastUpdated',
|
|
2626
|
-
searchParams: [
|
|
2627
|
-
{
|
|
2628
|
-
resourceType: 'SearchParameter',
|
|
2629
|
-
base: ['Resource'],
|
|
2630
|
-
code: '_lastUpdated',
|
|
2631
|
-
name: '_lastUpdated',
|
|
2632
|
-
type: 'date',
|
|
2633
|
-
expression: 'Resource.meta.lastUpdated',
|
|
2634
|
-
},
|
|
2635
|
-
],
|
|
2636
|
-
};
|
|
2637
|
-
}
|
|
2638
|
-
if (name === 'meta.versionId') {
|
|
2639
|
-
return {
|
|
2640
|
-
name: 'meta.versionId',
|
|
2641
|
-
searchParams: [
|
|
2642
|
-
{
|
|
2643
|
-
resourceType: 'SearchParameter',
|
|
2644
|
-
base: ['Resource'],
|
|
2645
|
-
code: '_versionId',
|
|
2646
|
-
name: '_versionId',
|
|
2647
|
-
type: 'token',
|
|
2648
|
-
expression: 'Resource.meta.versionId',
|
|
2649
|
-
},
|
|
2650
|
-
],
|
|
2651
|
-
};
|
|
2652
|
-
}
|
|
2653
|
-
const typeSchema = core.globalSchema.types[resourceType];
|
|
2654
|
-
const exactElementDefinition = typeSchema.properties[name];
|
|
2655
|
-
const exactSearchParam = (_a = typeSchema.searchParams) === null || _a === void 0 ? void 0 : _a[name.toLowerCase()];
|
|
2656
|
-
// Best case: Exact match of element definition or search parameter.
|
|
2657
|
-
// Examples: ServiceRequest.subject, Patient.name, Patient.birthDate
|
|
2658
|
-
// In this case, we only show the one search parameter.
|
|
2659
|
-
if (exactElementDefinition && exactSearchParam) {
|
|
2660
|
-
return { name, elementDefinition: exactElementDefinition, searchParams: [exactSearchParam] };
|
|
2661
|
-
}
|
|
2662
|
-
// Next best case: Exact match of element definition
|
|
2663
|
-
// Examples: Observation.value
|
|
2664
|
-
// In this case, there could be zero or more search parameters that are a function of the element definition.
|
|
2665
|
-
// So search for those search parameters.
|
|
2666
|
-
if (exactElementDefinition) {
|
|
2667
|
-
let searchParams = undefined;
|
|
2668
|
-
if (typeSchema.searchParams) {
|
|
2669
|
-
const path = `${resourceType}.${name.replaceAll('[x]', '')}`;
|
|
2670
|
-
searchParams = Object.values(typeSchema.searchParams).filter((p) => { var _a; return (_a = p.expression) === null || _a === void 0 ? void 0 : _a.includes(path); });
|
|
2671
|
-
if (searchParams.length === 0) {
|
|
2672
|
-
searchParams = undefined;
|
|
2673
|
-
}
|
|
2674
|
-
}
|
|
2675
|
-
return { name, elementDefinition: exactElementDefinition, searchParams };
|
|
2676
|
-
}
|
|
2677
|
-
// Search parameter case: Exact match of search parameter
|
|
2678
|
-
// Examples: Observation.value-quantity, Patient.email
|
|
2679
|
-
// Here we have a search parameter, but no element definition.
|
|
2680
|
-
// Observation.value-quantity is a search parameter for the Observation.value element.
|
|
2681
|
-
// Patient.email is a search parameter for the Patient.telecom element.
|
|
2682
|
-
// So we need to walk backwards to find the element definition.
|
|
2683
|
-
if (exactSearchParam) {
|
|
2684
|
-
const details = core.getSearchParameterDetails(resourceType, exactSearchParam);
|
|
2685
|
-
return { name, elementDefinition: details.elementDefinition, searchParams: [exactSearchParam] };
|
|
2686
|
-
}
|
|
2687
|
-
// Worst case: no element definition and no search parameter.
|
|
2688
|
-
// This is probably a malformed URL that includes an unknown field.
|
|
2689
|
-
// We will render the column header, but all cells will be empty.
|
|
2690
|
-
return { name };
|
|
2713
|
+
return React.createElement(ResourcePropertyDisplay, { value: value[0] || '', propertyType: props.propertyType });
|
|
2691
2714
|
}
|
|
2692
2715
|
|
|
2693
2716
|
const searchParamToOperators = {
|
|
@@ -2927,26 +2950,6 @@
|
|
|
2927
2950
|
const endTime = new Date();
|
|
2928
2951
|
return addDateFilterBetween(definition, field, startTime, endTime);
|
|
2929
2952
|
}
|
|
2930
|
-
/**
|
|
2931
|
-
* Adds a filter for a field equaling a specified date.
|
|
2932
|
-
*
|
|
2933
|
-
* @param {string} field The field key name.
|
|
2934
|
-
* @param {Date} value The date.
|
|
2935
|
-
*/
|
|
2936
|
-
function addDateEqualsFilter(definition, field, value) {
|
|
2937
|
-
return addDateFilterBetween(definition, field, value, value);
|
|
2938
|
-
}
|
|
2939
|
-
/**
|
|
2940
|
-
* Adds a filter for a date before a certain date/time.
|
|
2941
|
-
*
|
|
2942
|
-
* @param {string} field The field key name.
|
|
2943
|
-
* @param {Operator} op The date/time operation.
|
|
2944
|
-
* @param {Date} value The date.
|
|
2945
|
-
*/
|
|
2946
|
-
function addDateFilter(definition, field, op, value) {
|
|
2947
|
-
definition = clearFiltersOnField(definition, field);
|
|
2948
|
-
return addDateFilterImpl(definition, field, op, value);
|
|
2949
|
-
}
|
|
2950
2953
|
/**
|
|
2951
2954
|
* Adds a filter for a date between two dates (inclusive of both dates).
|
|
2952
2955
|
*
|
|
@@ -2978,17 +2981,6 @@
|
|
|
2978
2981
|
function addMissingFilter(definition, field, value = true) {
|
|
2979
2982
|
return addFilter(definition, field, core.Operator.MISSING, value.toString());
|
|
2980
2983
|
}
|
|
2981
|
-
/**
|
|
2982
|
-
* Returns true if the search has any filters on the specified field.
|
|
2983
|
-
*
|
|
2984
|
-
* @param {string} code The field key name.
|
|
2985
|
-
*/
|
|
2986
|
-
function hasFilterOnField(definition, code) {
|
|
2987
|
-
if (!definition.filters) {
|
|
2988
|
-
return false;
|
|
2989
|
-
}
|
|
2990
|
-
return definition.filters.find((f) => f.code === code) !== undefined;
|
|
2991
|
-
}
|
|
2992
2984
|
/**
|
|
2993
2985
|
* Sets the offset (starting at zero).
|
|
2994
2986
|
*
|
|
@@ -3150,7 +3142,7 @@
|
|
|
3150
3142
|
if (!value) {
|
|
3151
3143
|
return null;
|
|
3152
3144
|
}
|
|
3153
|
-
return (
|
|
3145
|
+
return (React.createElement(ResourcePropertyDisplay, { property: elementDefinition, propertyType: propertyType, value: value, maxWidth: 200, ignoreMissingValues: true, link: false }));
|
|
3154
3146
|
}
|
|
3155
3147
|
/**
|
|
3156
3148
|
* Returns a fragment to be displayed in the search table for a search parameter.
|
|
@@ -3165,9 +3157,9 @@
|
|
|
3165
3157
|
return null;
|
|
3166
3158
|
}
|
|
3167
3159
|
if (elementDefinition) {
|
|
3168
|
-
return (
|
|
3160
|
+
return (React.createElement(ResourcePropertyDisplay, { propertyType: value[0].type, value: value[0].value, maxWidth: 200, ignoreMissingValues: true, link: false }));
|
|
3169
3161
|
}
|
|
3170
|
-
return (
|
|
3162
|
+
return (React.createElement(React.Fragment, null, value.map((v, index) => (React.createElement("span", { key: `${index}-${value.length}` }, typeof v === 'object' ? JSON.stringify(v) : v)))));
|
|
3171
3163
|
}
|
|
3172
3164
|
|
|
3173
3165
|
function SearchFieldEditor(props) {
|
|
@@ -3301,30 +3293,30 @@
|
|
|
3301
3293
|
const available = getFieldsList(typeDef)
|
|
3302
3294
|
.filter((field) => !(selected === null || selected === void 0 ? void 0 : selected.includes(field)))
|
|
3303
3295
|
.sort();
|
|
3304
|
-
return (
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3296
|
+
return (React.createElement(core$1.Modal, { title: "Fields", closeButtonLabel: "Close", opened: props.visible, onClose: props.onCancel },
|
|
3297
|
+
React.createElement("div", null,
|
|
3298
|
+
React.createElement("table", { style: { margin: 'auto' } },
|
|
3299
|
+
React.createElement("thead", null,
|
|
3300
|
+
React.createElement("tr", null,
|
|
3301
|
+
React.createElement("th", { colSpan: 2, align: "center" }, "Available"),
|
|
3302
|
+
React.createElement("th", { colSpan: 2, align: "center" }, "Selected"))),
|
|
3303
|
+
React.createElement("tbody", null,
|
|
3304
|
+
React.createElement("tr", null,
|
|
3305
|
+
React.createElement("td", { colSpan: 2, align: "center" },
|
|
3306
|
+
React.createElement("select", { ref: availableRef, size: 15, tabIndex: 1, style: { width: '200px' }, onKeyDown: (e) => handleAvailableKeyDown(e), onDoubleClick: () => handleAvailableDoubleClick(), "data-testid": "available" }, available.map((key) => (React.createElement("option", { key: key, value: key }, buildFieldNameString(key)))))),
|
|
3307
|
+
React.createElement("td", { colSpan: 2, align: "center" },
|
|
3308
|
+
React.createElement("select", { ref: selectedRef, size: 15, tabIndex: 4, style: { width: '200px' }, onKeyDown: (e) => handleSelectedKeyDown(e), onDoubleClick: () => handleSelectedDoubleClick(), "data-testid": "selected" }, selected.map((key) => (React.createElement("option", { key: key, value: key }, buildFieldNameString(key)))))))),
|
|
3309
|
+
React.createElement("tfoot", null,
|
|
3310
|
+
React.createElement("tr", null,
|
|
3311
|
+
React.createElement("td", { align: "center" },
|
|
3312
|
+
React.createElement(core$1.Button, { compact: true, variant: "outline", onClick: onAddField }, "Add")),
|
|
3313
|
+
React.createElement("td", { align: "center" },
|
|
3314
|
+
React.createElement(core$1.Button, { compact: true, variant: "outline", onClick: onRemoveField }, "Remove")),
|
|
3315
|
+
React.createElement("td", { align: "center" },
|
|
3316
|
+
React.createElement(core$1.Button, { compact: true, variant: "outline", onClick: onMoveUp }, "Up")),
|
|
3317
|
+
React.createElement("td", { align: "center" },
|
|
3318
|
+
React.createElement(core$1.Button, { compact: true, variant: "outline", onClick: onMoveDown }, "Down")))))),
|
|
3319
|
+
React.createElement(core$1.Button, { onClick: () => props.onOk(state.search) }, "OK")));
|
|
3328
3320
|
}
|
|
3329
3321
|
/**
|
|
3330
3322
|
* Returns a list of fields/columns available for a type.
|
|
@@ -3361,14 +3353,14 @@
|
|
|
3361
3353
|
const searchParam = (_b = (_a = core.globalSchema.types[resourceType]) === null || _a === void 0 ? void 0 : _a.searchParams) === null || _b === void 0 ? void 0 : _b[filter.code];
|
|
3362
3354
|
if (searchParam) {
|
|
3363
3355
|
if (searchParam.type === 'reference') {
|
|
3364
|
-
return
|
|
3356
|
+
return React.createElement(ResourceName, { value: { reference: filter.value } });
|
|
3365
3357
|
}
|
|
3366
3358
|
const searchParamDetails = core.getSearchParameterDetails(resourceType, searchParam);
|
|
3367
3359
|
if (filter.code === '_lastUpdated' || searchParamDetails.type === core.SearchParameterType.DATETIME) {
|
|
3368
|
-
return
|
|
3360
|
+
return React.createElement(React.Fragment, null, core.formatDateTime(filter.value));
|
|
3369
3361
|
}
|
|
3370
3362
|
}
|
|
3371
|
-
return
|
|
3363
|
+
return React.createElement(React.Fragment, null, filter.value);
|
|
3372
3364
|
}
|
|
3373
3365
|
|
|
3374
3366
|
function SearchFilterValueInput(props) {
|
|
@@ -3377,7 +3369,7 @@
|
|
|
3377
3369
|
const name = 'filter-value';
|
|
3378
3370
|
switch (details.type) {
|
|
3379
3371
|
case core.SearchParameterType.REFERENCE:
|
|
3380
|
-
return (
|
|
3372
|
+
return (React.createElement(ReferenceInput, { name: name, defaultValue: { reference: props.defaultValue }, targetTypes: (_a = props.searchParam) === null || _a === void 0 ? void 0 : _a.target, onChange: (newReference) => {
|
|
3381
3373
|
if (newReference) {
|
|
3382
3374
|
props.onChange(newReference.reference);
|
|
3383
3375
|
}
|
|
@@ -3386,15 +3378,15 @@
|
|
|
3386
3378
|
}
|
|
3387
3379
|
} }));
|
|
3388
3380
|
case core.SearchParameterType.BOOLEAN:
|
|
3389
|
-
return (
|
|
3381
|
+
return (React.createElement(core$1.Checkbox, { name: name, "data-testid": name, defaultChecked: props.defaultValue === 'true', onChange: (e) => props.onChange(e.currentTarget.checked.toString()) }));
|
|
3390
3382
|
case core.SearchParameterType.DATE:
|
|
3391
|
-
return (
|
|
3383
|
+
return (React.createElement(core$1.TextInput, { type: "date", name: name, "data-testid": name, defaultValue: props.defaultValue, onChange: (e) => props.onChange(e.currentTarget.value) }));
|
|
3392
3384
|
case core.SearchParameterType.DATETIME:
|
|
3393
|
-
return
|
|
3385
|
+
return React.createElement(DateTimeInput, { name: name, defaultValue: props.defaultValue, onChange: props.onChange });
|
|
3394
3386
|
case core.SearchParameterType.NUMBER:
|
|
3395
|
-
return (
|
|
3387
|
+
return (React.createElement(core$1.TextInput, { type: "number", name: name, "data-testid": name, defaultValue: props.defaultValue, onChange: (e) => props.onChange(e.currentTarget.value) }));
|
|
3396
3388
|
case core.SearchParameterType.QUANTITY:
|
|
3397
|
-
return (
|
|
3389
|
+
return (React.createElement(QuantityInput, { name: name, defaultValue: tryParseQuantity(props.defaultValue), onChange: (newQuantity) => {
|
|
3398
3390
|
if (newQuantity) {
|
|
3399
3391
|
props.onChange(`${newQuantity.value}`);
|
|
3400
3392
|
}
|
|
@@ -3403,7 +3395,7 @@
|
|
|
3403
3395
|
}
|
|
3404
3396
|
} }));
|
|
3405
3397
|
default:
|
|
3406
|
-
return (
|
|
3398
|
+
return (React.createElement(core$1.TextInput, { name: name, "data-testid": name, defaultValue: props.defaultValue, autoFocus: props.autoFocus, onChange: (e) => props.onChange(e.currentTarget.value), placeholder: "Search value" }));
|
|
3407
3399
|
}
|
|
3408
3400
|
}
|
|
3409
3401
|
function tryParseQuantity(value) {
|
|
@@ -3437,24 +3429,24 @@
|
|
|
3437
3429
|
const resourceType = props.search.resourceType;
|
|
3438
3430
|
const searchParams = core.globalSchema.types[resourceType].searchParams;
|
|
3439
3431
|
const filters = search.filters || [];
|
|
3440
|
-
return (
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3432
|
+
return (React.createElement(core$1.Modal, { title: "Filters", closeButtonLabel: "Close", size: 900, opened: props.visible, onClose: props.onCancel },
|
|
3433
|
+
React.createElement("div", null,
|
|
3434
|
+
React.createElement("table", null,
|
|
3435
|
+
React.createElement("colgroup", null,
|
|
3436
|
+
React.createElement("col", { style: { width: 200 } }),
|
|
3437
|
+
React.createElement("col", { style: { width: 200 } }),
|
|
3438
|
+
React.createElement("col", { style: { width: 380 } }),
|
|
3439
|
+
React.createElement("col", { style: { width: 120 } })),
|
|
3440
|
+
React.createElement("thead", null,
|
|
3441
|
+
React.createElement("tr", null,
|
|
3442
|
+
React.createElement("th", null, "Field"),
|
|
3443
|
+
React.createElement("th", null, "Operation"),
|
|
3444
|
+
React.createElement("th", null, "Value"),
|
|
3445
|
+
React.createElement("th", null, "Actions"))),
|
|
3446
|
+
React.createElement("tbody", null,
|
|
3455
3447
|
filters.map((filter, index) => {
|
|
3456
3448
|
if (index === editingIndex) {
|
|
3457
|
-
return (
|
|
3449
|
+
return (React.createElement(FilterRowInput, { key: `filter-${index}-${filters.length}-input`, resourceType: resourceType, searchParams: searchParams, defaultValue: filter, okText: "Save", onOk: (newFilter) => {
|
|
3458
3450
|
const newFilters = [...filters];
|
|
3459
3451
|
newFilters[index] = newFilter;
|
|
3460
3452
|
setSearch(setFilters(searchRef.current, newFilters));
|
|
@@ -3462,23 +3454,23 @@
|
|
|
3462
3454
|
}, onCancel: () => setEditingIndex(-1) }));
|
|
3463
3455
|
}
|
|
3464
3456
|
else {
|
|
3465
|
-
return (
|
|
3457
|
+
return (React.createElement(FilterRowDisplay, { key: `filter-${index}-${filters.length}-display`, resourceType: resourceType, searchParams: searchParams, filter: filter, onEdit: () => setEditingIndex(index), onDelete: () => setSearch(deleteFilter(searchRef.current, index)) }));
|
|
3466
3458
|
}
|
|
3467
3459
|
}),
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3460
|
+
React.createElement(FilterRowInput, { resourceType: resourceType, searchParams: searchParams, okText: "Add", onOk: onAddFilter })))),
|
|
3461
|
+
React.createElement(core$1.Group, { position: "right", mt: "xl" },
|
|
3462
|
+
React.createElement(core$1.Button, { onClick: () => props.onOk(searchRef.current) }, "OK"))));
|
|
3471
3463
|
}
|
|
3472
3464
|
function FilterRowDisplay(props) {
|
|
3473
3465
|
const { filter } = props;
|
|
3474
|
-
return (
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3466
|
+
return (React.createElement("tr", null,
|
|
3467
|
+
React.createElement("td", null, buildFieldNameString(filter.code)),
|
|
3468
|
+
React.createElement("td", null, getOpString(filter.operator)),
|
|
3469
|
+
React.createElement("td", null,
|
|
3470
|
+
React.createElement(SearchFilterValueDisplay, { resourceType: props.resourceType, filter: filter })),
|
|
3471
|
+
React.createElement("td", null,
|
|
3472
|
+
React.createElement(core$1.Button, { compact: true, variant: "outline", onClick: props.onEdit }, "Edit"),
|
|
3473
|
+
React.createElement(core$1.Button, { compact: true, variant: "outline", onClick: props.onDelete }, "Delete"))));
|
|
3482
3474
|
}
|
|
3483
3475
|
function FilterRowInput(props) {
|
|
3484
3476
|
var _a;
|
|
@@ -3496,17 +3488,17 @@
|
|
|
3496
3488
|
}
|
|
3497
3489
|
const searchParam = props.searchParams[value.code];
|
|
3498
3490
|
const operators = searchParam && getSearchOperators(searchParam);
|
|
3499
|
-
return (
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
value.code && value.operator && value.value && (
|
|
3491
|
+
return (React.createElement("tr", null,
|
|
3492
|
+
React.createElement("td", null,
|
|
3493
|
+
React.createElement(core$1.NativeSelect, { "data-testid": "filter-field", defaultValue: valueRef.current.code, onChange: (e) => setFilterCode(e.currentTarget.value), data: Object.keys(props.searchParams).map((param) => ({ value: param, label: buildFieldNameString(param) })) })),
|
|
3494
|
+
React.createElement("td", null, operators && (React.createElement(core$1.NativeSelect, { "data-testid": "filter-operation", defaultValue: value.operator, onChange: (e) => setFilterOperator(e.currentTarget.value), data: ['', ...operators.map((op) => ({ value: op, label: getOpString(op) }))] }))),
|
|
3495
|
+
React.createElement("td", null, searchParam && value.operator && (React.createElement(SearchFilterValueInput, { resourceType: props.resourceType, searchParam: searchParam, defaultValue: value.value, onChange: setFilterValue }))),
|
|
3496
|
+
React.createElement("td", null,
|
|
3497
|
+
value.code && value.operator && value.value && (React.createElement(core$1.Button, { compact: true, variant: "outline", onClick: () => {
|
|
3506
3498
|
props.onOk(valueRef.current);
|
|
3507
3499
|
setValue({});
|
|
3508
3500
|
} }, props.okText)),
|
|
3509
|
-
props.onCancel && (
|
|
3501
|
+
props.onCancel && (React.createElement(core$1.Button, { compact: true, variant: "outline", onClick: props.onCancel }, "Cancel")))));
|
|
3510
3502
|
}
|
|
3511
3503
|
|
|
3512
3504
|
function SearchFilterValueDialog(props) {
|
|
@@ -3518,11 +3510,11 @@
|
|
|
3518
3510
|
function onOk() {
|
|
3519
3511
|
props.onOk(Object.assign(Object.assign({}, props.filter), { value }));
|
|
3520
3512
|
}
|
|
3521
|
-
return (
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3513
|
+
return (React.createElement(core$1.Modal, { title: props.title, size: "xl", opened: props.visible, onClose: props.onCancel },
|
|
3514
|
+
React.createElement("div", { style: { width: 500 } },
|
|
3515
|
+
React.createElement(Form, { onSubmit: onOk },
|
|
3516
|
+
React.createElement(SearchFilterValueInput, { resourceType: props.resourceType, searchParam: props.searchParam, defaultValue: value, autoFocus: true, onChange: setValue }))),
|
|
3517
|
+
React.createElement(core$1.Button, { onClick: onOk }, "OK")));
|
|
3526
3518
|
}
|
|
3527
3519
|
|
|
3528
3520
|
function SearchPopupMenu(props) {
|
|
@@ -3543,26 +3535,26 @@
|
|
|
3543
3535
|
}
|
|
3544
3536
|
// If there is only one search parameter, then show it directly
|
|
3545
3537
|
if (props.searchParams.length === 1) {
|
|
3546
|
-
return (
|
|
3538
|
+
return (React.createElement(SearchParameterSubMenu, { search: props.search, searchParam: props.searchParams[0], onSort: onSort, onPrompt: onPrompt, onChange: onChange, onClear: onClear }));
|
|
3547
3539
|
}
|
|
3548
3540
|
// Otherwise, show a menu, with each search parameter as a sub menu
|
|
3549
|
-
return (
|
|
3541
|
+
return (React.createElement(core$1.Menu.Dropdown, null, props.searchParams.map((searchParam) => (React.createElement(core$1.Menu.Item, { key: searchParam.code }, buildFieldNameString(searchParam.code))))));
|
|
3550
3542
|
}
|
|
3551
3543
|
function SearchParameterSubMenu(props) {
|
|
3552
3544
|
switch (props.searchParam.type) {
|
|
3553
3545
|
case 'date':
|
|
3554
|
-
return
|
|
3546
|
+
return React.createElement(DateFilterSubMenu, Object.assign({}, props));
|
|
3555
3547
|
case 'number':
|
|
3556
3548
|
case 'quantity':
|
|
3557
|
-
return
|
|
3549
|
+
return React.createElement(NumericFilterSubMenu, Object.assign({}, props));
|
|
3558
3550
|
case 'reference':
|
|
3559
|
-
return
|
|
3551
|
+
return React.createElement(ReferenceFilterSubMenu, Object.assign({}, props));
|
|
3560
3552
|
case 'string':
|
|
3561
3553
|
case 'token':
|
|
3562
3554
|
case 'uri':
|
|
3563
|
-
return
|
|
3555
|
+
return React.createElement(TextFilterSubMenu, Object.assign({}, props));
|
|
3564
3556
|
default:
|
|
3565
|
-
return
|
|
3557
|
+
return React.createElement(React.Fragment, null,
|
|
3566
3558
|
"Unknown search param type: ",
|
|
3567
3559
|
props.searchParam.type);
|
|
3568
3560
|
}
|
|
@@ -3570,72 +3562,164 @@
|
|
|
3570
3562
|
function DateFilterSubMenu(props) {
|
|
3571
3563
|
const { searchParam } = props;
|
|
3572
3564
|
const code = searchParam.code;
|
|
3573
|
-
return (
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3565
|
+
return (React.createElement(core$1.Menu.Dropdown, null,
|
|
3566
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconSortAscending, { size: 14 }), onClick: () => props.onSort(searchParam, false) }, "Sort Oldest to Newest"),
|
|
3567
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconSortDescending, { size: 14 }), onClick: () => props.onSort(searchParam, true) }, "Sort Newest to Oldest"),
|
|
3568
|
+
React.createElement(core$1.Menu.Divider, null),
|
|
3569
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconEqual, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.EQUALS) }, "Equals..."),
|
|
3570
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconEqualNot, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.NOT_EQUALS) }, "Does not equal..."),
|
|
3571
|
+
React.createElement(core$1.Menu.Divider, null),
|
|
3572
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconMathLower, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.ENDS_BEFORE) }, "Before..."),
|
|
3573
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconMathGreater, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.STARTS_AFTER) }, "After..."),
|
|
3574
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconBracketsContain, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.EQUALS) }, "Between..."),
|
|
3575
|
+
React.createElement(core$1.Menu.Divider, null),
|
|
3576
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconCalendar, { size: 14 }), onClick: () => props.onChange(addTomorrowFilter(props.search, code)) }, "Tomorrow"),
|
|
3577
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconCalendar, { size: 14 }), onClick: () => props.onChange(addTodayFilter(props.search, code)) }, "Today"),
|
|
3578
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconCalendar, { size: 14 }), onClick: () => props.onChange(addYesterdayFilter(props.search, code)) }, "Yesterday"),
|
|
3579
|
+
React.createElement(core$1.Menu.Divider, null),
|
|
3580
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconCalendar, { size: 14 }), onClick: () => props.onChange(addNextMonthFilter(props.search, code)) }, "Next Month"),
|
|
3581
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconCalendar, { size: 14 }), onClick: () => props.onChange(addThisMonthFilter(props.search, code)) }, "This Month"),
|
|
3582
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconCalendar, { size: 14 }), onClick: () => props.onChange(addLastMonthFilter(props.search, code)) }, "Last Month"),
|
|
3583
|
+
React.createElement(core$1.Menu.Divider, null),
|
|
3584
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconCalendar, { size: 14 }), onClick: () => props.onChange(addYearToDateFilter(props.search, code)) }, "Year to date"),
|
|
3585
|
+
React.createElement(CommonMenuItems, Object.assign({}, props))));
|
|
3594
3586
|
}
|
|
3595
3587
|
function NumericFilterSubMenu(props) {
|
|
3596
3588
|
const { searchParam } = props;
|
|
3597
|
-
return (
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3589
|
+
return (React.createElement(core$1.Menu.Dropdown, null,
|
|
3590
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconSortAscending, { size: 14 }), onClick: () => props.onSort(searchParam, false) }, "Sort Smallest to Largest"),
|
|
3591
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconSortDescending, { size: 14 }), onClick: () => props.onSort(searchParam, true) }, "Sort Largest to Smallest"),
|
|
3592
|
+
React.createElement(core$1.Menu.Divider, null),
|
|
3593
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconEqual, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.EQUALS) }, "Equals..."),
|
|
3594
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconEqualNot, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.NOT_EQUALS) }, "Does not equal..."),
|
|
3595
|
+
React.createElement(core$1.Menu.Divider, null),
|
|
3596
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconMathGreater, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.GREATER_THAN) }, "Greater than..."),
|
|
3597
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconSettings, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.GREATER_THAN_OR_EQUALS) }, "Greater than or equal to..."),
|
|
3598
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconMathLower, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.LESS_THAN) }, "Less than..."),
|
|
3599
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconSettings, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.LESS_THAN_OR_EQUALS) }, "Less than or equal to..."),
|
|
3600
|
+
React.createElement(CommonMenuItems, Object.assign({}, props))));
|
|
3609
3601
|
}
|
|
3610
3602
|
function ReferenceFilterSubMenu(props) {
|
|
3611
3603
|
const { searchParam } = props;
|
|
3612
|
-
return (
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3604
|
+
return (React.createElement(core$1.Menu.Dropdown, null,
|
|
3605
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconEqual, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.EQUALS) }, "Equals..."),
|
|
3606
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconEqualNot, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.NOT) }, "Does not equal..."),
|
|
3607
|
+
React.createElement(CommonMenuItems, Object.assign({}, props))));
|
|
3616
3608
|
}
|
|
3617
3609
|
function TextFilterSubMenu(props) {
|
|
3618
3610
|
const { searchParam } = props;
|
|
3619
|
-
return (
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3611
|
+
return (React.createElement(core$1.Menu.Dropdown, null,
|
|
3612
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconSortAscending, { size: 14 }), onClick: () => props.onSort(searchParam, false) }, "Sort A to Z"),
|
|
3613
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconSortDescending, { size: 14 }), onClick: () => props.onSort(searchParam, true) }, "Sort Z to A"),
|
|
3614
|
+
React.createElement(core$1.Menu.Divider, null),
|
|
3615
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconEqual, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.EQUALS) }, "Equals..."),
|
|
3616
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconEqualNot, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.NOT) }, "Does not equal..."),
|
|
3617
|
+
React.createElement(core$1.Menu.Divider, null),
|
|
3618
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconBucket, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.CONTAINS) }, "Contains..."),
|
|
3619
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconBucketOff, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.EQUALS) }, "Does not contain..."),
|
|
3620
|
+
React.createElement(CommonMenuItems, Object.assign({}, props))));
|
|
3629
3621
|
}
|
|
3630
3622
|
function CommonMenuItems(props) {
|
|
3631
3623
|
const { searchParam } = props;
|
|
3632
3624
|
const code = searchParam.code;
|
|
3633
|
-
return (
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3625
|
+
return (React.createElement(React.Fragment, null,
|
|
3626
|
+
React.createElement(core$1.Menu.Divider, null),
|
|
3627
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconBleach, { size: 14 }), onClick: () => props.onChange(addMissingFilter(props.search, code)) }, "Missing"),
|
|
3628
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconBleachOff, { size: 14 }), onClick: () => props.onChange(addMissingFilter(props.search, code, false)) }, "Not missing"),
|
|
3629
|
+
React.createElement(core$1.Menu.Divider, null),
|
|
3630
|
+
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconX, { size: 14 }), onClick: () => props.onClear(searchParam) }, "Clear filters")));
|
|
3631
|
+
}
|
|
3632
|
+
|
|
3633
|
+
/**
|
|
3634
|
+
* Returns the collection of field definitions for the search request.
|
|
3635
|
+
* @param search The search request definition.
|
|
3636
|
+
* @returns An array of field definitions.
|
|
3637
|
+
*/
|
|
3638
|
+
function getFieldDefinitions(search) {
|
|
3639
|
+
const resourceType = search.resourceType;
|
|
3640
|
+
const fields = [];
|
|
3641
|
+
for (const name of search.fields || ['id', '_lastUpdated']) {
|
|
3642
|
+
fields.push(getFieldDefinition(resourceType, name));
|
|
3643
|
+
}
|
|
3644
|
+
return fields;
|
|
3645
|
+
}
|
|
3646
|
+
/**
|
|
3647
|
+
* Return the field definition for a given field name.
|
|
3648
|
+
* Field names can be either property names or search parameter codes.
|
|
3649
|
+
* @param resourceType The resource type.
|
|
3650
|
+
* @param name The search field name (either property name or search parameter code).
|
|
3651
|
+
* @returns The field definition.
|
|
3652
|
+
*/
|
|
3653
|
+
function getFieldDefinition(resourceType, name) {
|
|
3654
|
+
var _a;
|
|
3655
|
+
if (name === '_lastUpdated') {
|
|
3656
|
+
return {
|
|
3657
|
+
name: '_lastUpdated',
|
|
3658
|
+
searchParams: [
|
|
3659
|
+
{
|
|
3660
|
+
resourceType: 'SearchParameter',
|
|
3661
|
+
base: ['Resource'],
|
|
3662
|
+
code: '_lastUpdated',
|
|
3663
|
+
name: '_lastUpdated',
|
|
3664
|
+
type: 'date',
|
|
3665
|
+
expression: 'Resource.meta.lastUpdated',
|
|
3666
|
+
},
|
|
3667
|
+
],
|
|
3668
|
+
};
|
|
3669
|
+
}
|
|
3670
|
+
if (name === 'meta.versionId') {
|
|
3671
|
+
return {
|
|
3672
|
+
name: 'meta.versionId',
|
|
3673
|
+
searchParams: [
|
|
3674
|
+
{
|
|
3675
|
+
resourceType: 'SearchParameter',
|
|
3676
|
+
base: ['Resource'],
|
|
3677
|
+
code: '_versionId',
|
|
3678
|
+
name: '_versionId',
|
|
3679
|
+
type: 'token',
|
|
3680
|
+
expression: 'Resource.meta.versionId',
|
|
3681
|
+
},
|
|
3682
|
+
],
|
|
3683
|
+
};
|
|
3684
|
+
}
|
|
3685
|
+
const typeSchema = core.globalSchema.types[resourceType];
|
|
3686
|
+
const exactElementDefinition = typeSchema.properties[name];
|
|
3687
|
+
const exactSearchParam = (_a = typeSchema.searchParams) === null || _a === void 0 ? void 0 : _a[name.toLowerCase()];
|
|
3688
|
+
// Best case: Exact match of element definition or search parameter.
|
|
3689
|
+
// Examples: ServiceRequest.subject, Patient.name, Patient.birthDate
|
|
3690
|
+
// In this case, we only show the one search parameter.
|
|
3691
|
+
if (exactElementDefinition && exactSearchParam) {
|
|
3692
|
+
return { name, elementDefinition: exactElementDefinition, searchParams: [exactSearchParam] };
|
|
3693
|
+
}
|
|
3694
|
+
// Next best case: Exact match of element definition
|
|
3695
|
+
// Examples: Observation.value
|
|
3696
|
+
// In this case, there could be zero or more search parameters that are a function of the element definition.
|
|
3697
|
+
// So search for those search parameters.
|
|
3698
|
+
if (exactElementDefinition) {
|
|
3699
|
+
let searchParams = undefined;
|
|
3700
|
+
if (typeSchema.searchParams) {
|
|
3701
|
+
const path = `${resourceType}.${name.replaceAll('[x]', '')}`;
|
|
3702
|
+
searchParams = Object.values(typeSchema.searchParams).filter((p) => { var _a; return (_a = p.expression) === null || _a === void 0 ? void 0 : _a.includes(path); });
|
|
3703
|
+
if (searchParams.length === 0) {
|
|
3704
|
+
searchParams = undefined;
|
|
3705
|
+
}
|
|
3706
|
+
}
|
|
3707
|
+
return { name, elementDefinition: exactElementDefinition, searchParams };
|
|
3708
|
+
}
|
|
3709
|
+
// Search parameter case: Exact match of search parameter
|
|
3710
|
+
// Examples: Observation.value-quantity, Patient.email
|
|
3711
|
+
// Here we have a search parameter, but no element definition.
|
|
3712
|
+
// Observation.value-quantity is a search parameter for the Observation.value element.
|
|
3713
|
+
// Patient.email is a search parameter for the Patient.telecom element.
|
|
3714
|
+
// So we need to walk backwards to find the element definition.
|
|
3715
|
+
if (exactSearchParam) {
|
|
3716
|
+
const details = core.getSearchParameterDetails(resourceType, exactSearchParam);
|
|
3717
|
+
return { name, elementDefinition: details.elementDefinition, searchParams: [exactSearchParam] };
|
|
3718
|
+
}
|
|
3719
|
+
// Worst case: no element definition and no search parameter.
|
|
3720
|
+
// This is probably a malformed URL that includes an unknown field.
|
|
3721
|
+
// We will render the column header, but all cells will be empty.
|
|
3722
|
+
return { name };
|
|
3639
3723
|
}
|
|
3640
3724
|
|
|
3641
3725
|
class SearchChangeEvent extends Event {
|
|
@@ -3657,7 +3741,21 @@
|
|
|
3657
3741
|
this.browserEvent = browserEvent;
|
|
3658
3742
|
}
|
|
3659
3743
|
}
|
|
3660
|
-
const useStyles = core$1.createStyles((theme) => ({
|
|
3744
|
+
const useStyles$7 = core$1.createStyles((theme) => ({
|
|
3745
|
+
root: {
|
|
3746
|
+
maxWidth: '100%',
|
|
3747
|
+
overflow: 'auto',
|
|
3748
|
+
textAlign: 'left',
|
|
3749
|
+
marginBottom: '20px',
|
|
3750
|
+
},
|
|
3751
|
+
table: {
|
|
3752
|
+
cursor: 'pointer',
|
|
3753
|
+
},
|
|
3754
|
+
tr: {
|
|
3755
|
+
'&:hover': {
|
|
3756
|
+
backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[7] : theme.colors.gray[0],
|
|
3757
|
+
},
|
|
3758
|
+
},
|
|
3661
3759
|
th: {
|
|
3662
3760
|
padding: '0 !important',
|
|
3663
3761
|
},
|
|
@@ -3680,8 +3778,8 @@
|
|
|
3680
3778
|
* It does not include the field editor, filter editor, pagination buttons.
|
|
3681
3779
|
*/
|
|
3682
3780
|
function SearchControl(props) {
|
|
3683
|
-
var _a, _b;
|
|
3684
|
-
const { classes } = useStyles();
|
|
3781
|
+
var _a, _b, _c;
|
|
3782
|
+
const { classes } = useStyles$7();
|
|
3685
3783
|
const medplum = useMedplum();
|
|
3686
3784
|
const [schemaLoaded, setSchemaLoaded] = React.useState(false);
|
|
3687
3785
|
const [outcome, setOutcome] = React.useState();
|
|
@@ -3793,7 +3891,8 @@
|
|
|
3793
3891
|
}, [medplum, props.search.resourceType]);
|
|
3794
3892
|
const typeSchema = schemaLoaded && ((_a = core.globalSchema === null || core.globalSchema === void 0 ? void 0 : core.globalSchema.types) === null || _a === void 0 ? void 0 : _a[props.search.resourceType]);
|
|
3795
3893
|
if (!typeSchema) {
|
|
3796
|
-
return
|
|
3894
|
+
return (React.createElement(core$1.Center, { style: { width: '100%', height: '100%' } },
|
|
3895
|
+
React.createElement(core$1.Loader, null)));
|
|
3797
3896
|
}
|
|
3798
3897
|
const checkboxColumn = props.checkboxesEnabled;
|
|
3799
3898
|
const fields = getFieldDefinitions(search);
|
|
@@ -3805,51 +3904,52 @@
|
|
|
3805
3904
|
const buttonColor = 'gray';
|
|
3806
3905
|
const iconSize = 16;
|
|
3807
3906
|
const isMobile = window.innerWidth < 768;
|
|
3808
|
-
return (
|
|
3809
|
-
!props.hideToolbar && (
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
props.onNew && (
|
|
3814
|
-
!isMobile && props.onExport && (
|
|
3815
|
-
!isMobile && props.onDelete && (
|
|
3816
|
-
!isMobile && props.onBulk && (
|
|
3817
|
-
lastResult && (
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
React__default["default"].createElement(SearchPopupMenu, { search: props.search, searchParams: field.searchParams, onPrompt: (searchParam, filter) => {
|
|
3907
|
+
return (React.createElement("div", { className: classes.root, "data-testid": "search-control" },
|
|
3908
|
+
!props.hideToolbar && (React.createElement(core$1.Group, { position: "apart", mb: "xl" },
|
|
3909
|
+
React.createElement(core$1.Group, { spacing: 2 },
|
|
3910
|
+
React.createElement(core$1.Button, { compact: true, variant: buttonVariant, color: buttonColor, leftIcon: React.createElement(icons.IconFilter, { size: iconSize }), onClick: () => setState(Object.assign(Object.assign({}, stateRef.current), { fieldEditorVisible: true })) }, "Fields"),
|
|
3911
|
+
React.createElement(core$1.Button, { compact: true, variant: buttonVariant, color: buttonColor, leftIcon: React.createElement(icons.IconColumns, { size: iconSize }), onClick: () => setState(Object.assign(Object.assign({}, stateRef.current), { filterEditorVisible: true })) }, "Filters"),
|
|
3912
|
+
props.onNew && (React.createElement(core$1.Button, { compact: true, variant: buttonVariant, color: buttonColor, leftIcon: React.createElement(icons.IconFilePlus, { size: iconSize }), onClick: props.onNew }, "New...")),
|
|
3913
|
+
!isMobile && props.onExport && (React.createElement(core$1.Button, { compact: true, variant: buttonVariant, color: buttonColor, leftIcon: React.createElement(icons.IconTableExport, { size: iconSize }), onClick: props.onExport }, "Export...")),
|
|
3914
|
+
!isMobile && props.onDelete && (React.createElement(core$1.Button, { compact: true, variant: buttonVariant, color: buttonColor, leftIcon: React.createElement(icons.IconTrash, { size: iconSize }), onClick: () => props.onDelete(Object.keys(state.selected)) }, "Delete...")),
|
|
3915
|
+
!isMobile && props.onBulk && (React.createElement(core$1.Button, { compact: true, variant: buttonVariant, color: buttonColor, leftIcon: React.createElement(icons.IconBoxMultiple, { size: iconSize }), onClick: () => props.onBulk(Object.keys(state.selected)) }, "Bulk..."))),
|
|
3916
|
+
lastResult && (React.createElement(core$1.Text, { size: "xs", color: "dimmed" },
|
|
3917
|
+
getStart$1(search, lastResult.total),
|
|
3918
|
+
"-",
|
|
3919
|
+
getEnd$1(search, lastResult.total),
|
|
3920
|
+
" of",
|
|
3921
|
+
' ', (_b = lastResult.total) === null || _b === void 0 ? void 0 :
|
|
3922
|
+
_b.toLocaleString())))),
|
|
3923
|
+
React.createElement(core$1.Table, { className: classes.table },
|
|
3924
|
+
React.createElement("thead", null,
|
|
3925
|
+
React.createElement("tr", null,
|
|
3926
|
+
checkboxColumn && (React.createElement("th", null,
|
|
3927
|
+
React.createElement("input", { type: "checkbox", value: "checked", "aria-label": "all-checkbox", "data-testid": "all-checkbox", checked: isAllSelected(), onChange: (e) => handleAllCheckboxClick(e) }))),
|
|
3928
|
+
fields.map((field) => (React.createElement("th", { key: field.name },
|
|
3929
|
+
React.createElement(core$1.Menu, { shadow: "md", width: 240, position: "bottom-end" },
|
|
3930
|
+
React.createElement(core$1.Menu.Target, null,
|
|
3931
|
+
React.createElement(core$1.UnstyledButton, { className: classes.control },
|
|
3932
|
+
React.createElement(core$1.Group, { position: "apart", noWrap: true },
|
|
3933
|
+
React.createElement(core$1.Text, { weight: 500, size: "sm" }, buildFieldNameString(field.name)),
|
|
3934
|
+
React.createElement(core$1.Center, { className: classes.icon },
|
|
3935
|
+
React.createElement(icons.IconAdjustmentsHorizontal, { size: 14, stroke: 1.5 }))))),
|
|
3936
|
+
React.createElement(SearchPopupMenu, { search: props.search, searchParams: field.searchParams, onPrompt: (searchParam, filter) => {
|
|
3839
3937
|
setState(Object.assign(Object.assign({}, stateRef.current), { filterDialogVisible: true, filterDialogSearchParam: searchParam, filterDialogFilter: filter }));
|
|
3840
3938
|
}, onChange: (result) => {
|
|
3841
3939
|
emitSearchChange(result);
|
|
3842
3940
|
} })))))),
|
|
3843
|
-
!props.hideFilters && (
|
|
3844
|
-
checkboxColumn &&
|
|
3845
|
-
fields.map((field) => (
|
|
3846
|
-
|
|
3847
|
-
checkboxColumn && (
|
|
3848
|
-
|
|
3849
|
-
fields.map((field) => (
|
|
3850
|
-
(resources === null || resources === void 0 ? void 0 : resources.length) === 0 && (
|
|
3851
|
-
|
|
3852
|
-
|
|
3941
|
+
!props.hideFilters && (React.createElement("tr", null,
|
|
3942
|
+
checkboxColumn && React.createElement("th", null),
|
|
3943
|
+
fields.map((field) => (React.createElement("th", { key: field.name }, field.searchParams && (React.createElement(FilterDescription, { resourceType: resourceType, searchParams: field.searchParams, filters: props.search.filters })))))))),
|
|
3944
|
+
React.createElement("tbody", null, resources === null || resources === void 0 ? void 0 : resources.map((resource) => resource && (React.createElement("tr", { key: resource.id, className: classes.tr, "data-testid": "search-control-row", onClick: (e) => handleRowClick(e, resource), onAuxClick: (e) => handleRowClick(e, resource) },
|
|
3945
|
+
checkboxColumn && (React.createElement("td", null,
|
|
3946
|
+
React.createElement("input", { type: "checkbox", value: "checked", "data-testid": "row-checkbox", "aria-label": `Checkbox for ${resource.id}`, checked: !!state.selected[resource.id], onChange: (e) => handleSingleCheckboxClick(e, resource.id) }))),
|
|
3947
|
+
fields.map((field) => (React.createElement("td", { key: field.name }, renderValue(resource, field))))))))),
|
|
3948
|
+
(resources === null || resources === void 0 ? void 0 : resources.length) === 0 && (React.createElement(core$1.Container, null,
|
|
3949
|
+
React.createElement(core$1.Center, null,
|
|
3950
|
+
React.createElement(core$1.Text, { size: "xl", color: "dimmed" }, "No results")))),
|
|
3951
|
+
(lastResult === null || lastResult === void 0 ? void 0 : lastResult.total) !== undefined && lastResult.total > 0 && (React.createElement(core$1.Center, { m: "md", p: "md" },
|
|
3952
|
+
React.createElement(core$1.Pagination, { page: getPage(search), total: getTotalPages(search, lastResult.total), onChange: (newPage) => emitSearchChange(setPage(search, newPage)), getItemAriaLabel: (page) => {
|
|
3853
3953
|
switch (page) {
|
|
3854
3954
|
case 'prev':
|
|
3855
3955
|
return 'Previous page';
|
|
@@ -3859,38 +3959,38 @@
|
|
|
3859
3959
|
return undefined;
|
|
3860
3960
|
}
|
|
3861
3961
|
} }))),
|
|
3862
|
-
outcome && (
|
|
3863
|
-
|
|
3864
|
-
|
|
3962
|
+
outcome && (React.createElement("div", { "data-testid": "search-error" },
|
|
3963
|
+
React.createElement("pre", { style: { textAlign: 'left' } }, JSON.stringify(outcome, undefined, 2)))),
|
|
3964
|
+
React.createElement(SearchFieldEditor, { search: props.search, visible: stateRef.current.fieldEditorVisible, onOk: (result) => {
|
|
3865
3965
|
emitSearchChange(result);
|
|
3866
3966
|
setState(Object.assign(Object.assign({}, stateRef.current), { fieldEditorVisible: false }));
|
|
3867
3967
|
}, onCancel: () => {
|
|
3868
3968
|
setState(Object.assign(Object.assign({}, stateRef.current), { fieldEditorVisible: false }));
|
|
3869
3969
|
} }),
|
|
3870
|
-
|
|
3970
|
+
React.createElement(SearchFilterEditor, { search: props.search, visible: stateRef.current.filterEditorVisible, onOk: (result) => {
|
|
3871
3971
|
emitSearchChange(result);
|
|
3872
3972
|
setState(Object.assign(Object.assign({}, stateRef.current), { filterEditorVisible: false }));
|
|
3873
3973
|
}, onCancel: () => {
|
|
3874
3974
|
setState(Object.assign(Object.assign({}, stateRef.current), { filterEditorVisible: false }));
|
|
3875
3975
|
} }),
|
|
3876
|
-
|
|
3976
|
+
React.createElement(SearchFilterValueDialog, { key: (_c = state.filterDialogSearchParam) === null || _c === void 0 ? void 0 : _c.code, visible: stateRef.current.filterDialogVisible, title: 'Input', resourceType: resourceType, searchParam: state.filterDialogSearchParam, filter: state.filterDialogFilter, defaultValue: '', onOk: (filter) => {
|
|
3877
3977
|
emitSearchChange(addFilter(props.search, filter.code, filter.operator, filter.value));
|
|
3878
3978
|
setState(Object.assign(Object.assign({}, stateRef.current), { filterDialogVisible: false }));
|
|
3879
3979
|
}, onCancel: () => {
|
|
3880
3980
|
setState(Object.assign(Object.assign({}, stateRef.current), { filterDialogVisible: false }));
|
|
3881
3981
|
} })));
|
|
3882
3982
|
}
|
|
3883
|
-
const MemoizedSearchControl =
|
|
3983
|
+
const MemoizedSearchControl = React.memo(SearchControl);
|
|
3884
3984
|
function FilterDescription(props) {
|
|
3885
3985
|
var _a;
|
|
3886
3986
|
const filters = ((_a = props.filters) !== null && _a !== void 0 ? _a : []).filter((f) => props.searchParams.find((p) => p.code === f.code));
|
|
3887
3987
|
if (filters.length === 0) {
|
|
3888
|
-
return
|
|
3988
|
+
return React.createElement("span", null, "no filters");
|
|
3889
3989
|
}
|
|
3890
|
-
return (
|
|
3990
|
+
return (React.createElement(React.Fragment, null, filters.map((filter, index) => (React.createElement("div", { key: `filter-${index}-${filters.length}` },
|
|
3891
3991
|
getOpString(filter.operator),
|
|
3892
3992
|
"\u00A0",
|
|
3893
|
-
|
|
3993
|
+
React.createElement(SearchFilterValueDisplay, { resourceType: props.resourceType, filter: filter }))))));
|
|
3894
3994
|
}
|
|
3895
3995
|
function getPage(search) {
|
|
3896
3996
|
return Math.floor((search.offset || 0) / (search.count || core.DEFAULT_SEARCH_COUNT)) + 1;
|
|
@@ -3994,29 +4094,29 @@
|
|
|
3994
4094
|
}, [medplum, props.resourceType]);
|
|
3995
4095
|
const typeSchema = (_a = schema === null || schema === void 0 ? void 0 : schema.types) === null || _a === void 0 ? void 0 : _a[props.resourceType];
|
|
3996
4096
|
if (!typeSchema) {
|
|
3997
|
-
return
|
|
4097
|
+
return React.createElement(core$1.Loader, null);
|
|
3998
4098
|
}
|
|
3999
4099
|
const checkboxColumn = props.checkboxesEnabled;
|
|
4000
|
-
return (
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
checkboxColumn && (
|
|
4005
|
-
|
|
4006
|
-
fields.map((field) => (
|
|
4007
|
-
|
|
4008
|
-
checkboxColumn && (
|
|
4009
|
-
|
|
4100
|
+
return (React.createElement("div", { onContextMenu: (e) => killEvent(e), "data-testid": "search-control" },
|
|
4101
|
+
React.createElement(core$1.Table, null,
|
|
4102
|
+
React.createElement("thead", null,
|
|
4103
|
+
React.createElement("tr", null,
|
|
4104
|
+
checkboxColumn && (React.createElement("th", null,
|
|
4105
|
+
React.createElement("input", { type: "checkbox", value: "checked", "aria-label": "all-checkbox", "data-testid": "all-checkbox", checked: isAllSelected(), onChange: (e) => handleAllCheckboxClick(e) }))),
|
|
4106
|
+
fields.map((field) => (React.createElement("th", { key: field.name }, field.name))))),
|
|
4107
|
+
React.createElement("tbody", null, (_c = (_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.ResourceList) === null || _c === void 0 ? void 0 : _c.map((resource) => resource && (React.createElement("tr", { key: resource.id, "data-testid": "search-control-row", onClick: (e) => handleRowClick(e, resource), onAuxClick: (e) => handleRowClick(e, resource) },
|
|
4108
|
+
checkboxColumn && (React.createElement("td", null,
|
|
4109
|
+
React.createElement("input", { type: "checkbox", value: "checked", "data-testid": "row-checkbox", "aria-label": `Checkbox for ${resource.id}`, checked: !!selected[resource.id], onChange: (e) => handleSingleCheckboxClick(e, resource.id) }))),
|
|
4010
4110
|
fields.map((field) => {
|
|
4011
|
-
return (
|
|
4012
|
-
|
|
4111
|
+
return (React.createElement("td", { key: field.name },
|
|
4112
|
+
React.createElement(FhirPathDisplay, { propertyType: field.propertyType, path: field.fhirPath, resource: resource })));
|
|
4013
4113
|
})))))),
|
|
4014
|
-
((_e = (_d = response === null || response === void 0 ? void 0 : response.data) === null || _d === void 0 ? void 0 : _d.ResourceList) === null || _e === void 0 ? void 0 : _e.length) === 0 &&
|
|
4015
|
-
outcome && (
|
|
4016
|
-
|
|
4017
|
-
props.onBulk && (
|
|
4114
|
+
((_e = (_d = response === null || response === void 0 ? void 0 : response.data) === null || _d === void 0 ? void 0 : _d.ResourceList) === null || _e === void 0 ? void 0 : _e.length) === 0 && React.createElement("div", { "data-testid": "empty-search" }, "No results"),
|
|
4115
|
+
outcome && (React.createElement("div", { "data-testid": "search-error" },
|
|
4116
|
+
React.createElement("pre", { style: { textAlign: 'left' } }, JSON.stringify(outcome, undefined, 2)))),
|
|
4117
|
+
props.onBulk && (React.createElement(core$1.Button, { onClick: () => props.onBulk(Object.keys(selectedRef.current)) }, "Bulk..."))));
|
|
4018
4118
|
}
|
|
4019
|
-
const MemoizedFhirPathTable =
|
|
4119
|
+
const MemoizedFhirPathTable = React.memo(FhirPathTable);
|
|
4020
4120
|
|
|
4021
4121
|
const searches = [
|
|
4022
4122
|
'$/_history',
|
|
@@ -4028,7 +4128,7 @@
|
|
|
4028
4128
|
'ServiceRequest?subject=$',
|
|
4029
4129
|
];
|
|
4030
4130
|
function PatientTimeline(props) {
|
|
4031
|
-
return (
|
|
4131
|
+
return (React.createElement(ResourceTimeline, { value: props.patient, buildSearchRequests: (resource) => ({
|
|
4032
4132
|
resourceType: 'Bundle',
|
|
4033
4133
|
type: 'batch',
|
|
4034
4134
|
entry: searches.map((search) => ({
|
|
@@ -4054,6 +4154,32 @@
|
|
|
4054
4154
|
}) }));
|
|
4055
4155
|
}
|
|
4056
4156
|
|
|
4157
|
+
const useStyles$6 = core$1.createStyles((theme) => ({
|
|
4158
|
+
section: {
|
|
4159
|
+
position: 'relative',
|
|
4160
|
+
margin: '4px 4px 8px 0',
|
|
4161
|
+
padding: '6px 12px 16px 6px',
|
|
4162
|
+
border: `1.5px solid ${theme.colors.gray[1]}`,
|
|
4163
|
+
borderRadius: theme.radius.sm,
|
|
4164
|
+
transition: 'all 0.1s',
|
|
4165
|
+
},
|
|
4166
|
+
hovering: {
|
|
4167
|
+
border: `1.5px solid ${theme.colors.blue[5]}`,
|
|
4168
|
+
},
|
|
4169
|
+
editing: {
|
|
4170
|
+
border: `1.5px solid ${theme.colors.gray[1]}`,
|
|
4171
|
+
borderLeft: `4px solid ${theme.colors.blue[5]}`,
|
|
4172
|
+
},
|
|
4173
|
+
bottomActions: {
|
|
4174
|
+
position: 'absolute',
|
|
4175
|
+
right: 4,
|
|
4176
|
+
bottom: 0,
|
|
4177
|
+
fontSize: theme.fontSizes.xs,
|
|
4178
|
+
'& a': {
|
|
4179
|
+
marginLeft: 8,
|
|
4180
|
+
},
|
|
4181
|
+
},
|
|
4182
|
+
}));
|
|
4057
4183
|
function PlanDefinitionBuilder(props) {
|
|
4058
4184
|
const medplum = useMedplum();
|
|
4059
4185
|
const defaultValue = useResource(props.value);
|
|
@@ -4087,13 +4213,14 @@
|
|
|
4087
4213
|
function changeProperty(property, newValue) {
|
|
4088
4214
|
setValue(Object.assign(Object.assign({}, valueRef.current), { [property]: newValue }));
|
|
4089
4215
|
}
|
|
4090
|
-
return (
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4216
|
+
return (React.createElement("div", null,
|
|
4217
|
+
React.createElement(Form, { testid: "questionnaire-form", onSubmit: () => props.onSubmit(value) },
|
|
4218
|
+
React.createElement(core$1.TextInput, { label: "Plan Title", defaultValue: value.title, onChange: (e) => changeProperty('title', e.currentTarget.value) }),
|
|
4219
|
+
React.createElement(ActionArrayBuilder, { actions: value.action || [], selectedKey: selectedKey, setSelectedKey: setSelectedKey, hoverKey: hoverKey, setHoverKey: setHoverKey, onChange: (x) => changeProperty('action', x) }),
|
|
4220
|
+
React.createElement(core$1.Button, { type: "submit" }, "Save"))));
|
|
4095
4221
|
}
|
|
4096
4222
|
function ActionArrayBuilder(props) {
|
|
4223
|
+
const { classes } = useStyles$6();
|
|
4097
4224
|
const actionsRef = React.useRef();
|
|
4098
4225
|
actionsRef.current = props.actions;
|
|
4099
4226
|
function changeAction(changedAction) {
|
|
@@ -4106,16 +4233,17 @@
|
|
|
4106
4233
|
function removeAction(removedAction) {
|
|
4107
4234
|
props.onChange(actionsRef.current.filter((i) => i !== removedAction));
|
|
4108
4235
|
}
|
|
4109
|
-
return (
|
|
4110
|
-
props.actions.map((action) => (
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4236
|
+
return (React.createElement("div", { className: classes.section },
|
|
4237
|
+
props.actions.map((action) => (React.createElement("div", { key: action.id },
|
|
4238
|
+
React.createElement(ActionBuilder, { action: action, selectedKey: props.selectedKey, setSelectedKey: props.setSelectedKey, hoverKey: props.hoverKey, setHoverKey: props.setHoverKey, onChange: changeAction, onRemove: () => removeAction(action) })))),
|
|
4239
|
+
React.createElement("div", { className: classes.bottomActions },
|
|
4240
|
+
React.createElement("a", { href: "#", onClick: (e) => {
|
|
4114
4241
|
killEvent(e);
|
|
4115
4242
|
addAction({ id: generateId$1() });
|
|
4116
4243
|
} }, "Add action"))));
|
|
4117
4244
|
}
|
|
4118
4245
|
function ActionBuilder(props) {
|
|
4246
|
+
const { classes, cx } = useStyles$6();
|
|
4119
4247
|
const { action } = props;
|
|
4120
4248
|
const actionType = getInitialActionType(action);
|
|
4121
4249
|
const editing = props.selectedKey === props.action.id;
|
|
@@ -4128,11 +4256,14 @@
|
|
|
4128
4256
|
killEvent(e);
|
|
4129
4257
|
props.setHoverKey(props.action.id);
|
|
4130
4258
|
}
|
|
4131
|
-
const className =
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4259
|
+
const className = cx(classes.section, {
|
|
4260
|
+
[classes.editing]: editing,
|
|
4261
|
+
[classes.hovering]: hovering && !editing,
|
|
4262
|
+
});
|
|
4263
|
+
return (React.createElement("div", { "data-testid": action.id, className: className, onClick: onClick, onMouseOver: onHover },
|
|
4264
|
+
editing ? (React.createElement(ActionEditor, { action: action, actionType: actionType, onChange: props.onChange, selectedKey: props.selectedKey, setSelectedKey: props.setSelectedKey, hoverKey: props.hoverKey, setHoverKey: props.setHoverKey, onRemove: props.onRemove })) : (React.createElement(ActionDisplay, { action: action, actionType: actionType })),
|
|
4265
|
+
React.createElement("div", { className: classes.bottomActions },
|
|
4266
|
+
React.createElement("a", { href: "#", onClick: (e) => {
|
|
4136
4267
|
e.preventDefault();
|
|
4137
4268
|
props.onRemove();
|
|
4138
4269
|
} }, "Remove"))));
|
|
@@ -4146,15 +4277,15 @@
|
|
|
4146
4277
|
function ActionDisplay(props) {
|
|
4147
4278
|
const { action, actionType } = props;
|
|
4148
4279
|
const [propertyValue, propertyType] = getActionTiming(action);
|
|
4149
|
-
return (
|
|
4150
|
-
|
|
4280
|
+
return (React.createElement("div", null,
|
|
4281
|
+
React.createElement("div", null,
|
|
4151
4282
|
action.title || 'Untitled',
|
|
4152
4283
|
" ",
|
|
4153
4284
|
actionType && `(${actionType})`),
|
|
4154
|
-
action.definitionCanonical && (
|
|
4155
|
-
|
|
4156
|
-
propertyValue && (
|
|
4157
|
-
|
|
4285
|
+
action.definitionCanonical && (React.createElement("div", null,
|
|
4286
|
+
React.createElement(ReferenceDisplay, { value: { reference: action.definitionCanonical } }))),
|
|
4287
|
+
propertyValue && (React.createElement("div", null,
|
|
4288
|
+
React.createElement(ResourcePropertyDisplay, { property: timingProperty, propertyType: propertyType, value: propertyValue })))));
|
|
4158
4289
|
}
|
|
4159
4290
|
function ActionEditor(props) {
|
|
4160
4291
|
const { action } = props;
|
|
@@ -4162,35 +4293,34 @@
|
|
|
4162
4293
|
function changeProperty(property, value) {
|
|
4163
4294
|
props.onChange(Object.assign(Object.assign({}, action), { [property]: value }));
|
|
4164
4295
|
}
|
|
4165
|
-
return (
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
action.action && action.action.length > 0 && (
|
|
4296
|
+
return (React.createElement(core$1.Stack, { spacing: "xl" },
|
|
4297
|
+
React.createElement(core$1.TextInput, { name: `actionTitle-${action.id}`, label: "Title", defaultValue: action.title, onChange: (e) => changeProperty('title', e.currentTarget.value) }),
|
|
4298
|
+
React.createElement(core$1.TextInput, { name: `actionDescription-${action.id}`, label: "Description", defaultValue: action.description, onChange: (e) => changeProperty('description', e.currentTarget.value) }),
|
|
4299
|
+
React.createElement(core$1.NativeSelect, { label: "Type of Action", description: "The type of the action to be performed.", name: `actionType-${action.id}`, defaultValue: actionType, onChange: (e) => setActionType(e.currentTarget.value), data: ['', 'appointment', 'lab', 'questionnaire', 'task'] }),
|
|
4300
|
+
action.action && action.action.length > 0 && (React.createElement(ActionArrayBuilder, { actions: action.action, selectedKey: props.selectedKey, setSelectedKey: props.setSelectedKey, hoverKey: props.hoverKey, setHoverKey: props.setHoverKey, onChange: (x) => changeProperty('action', x) })),
|
|
4170
4301
|
(() => {
|
|
4171
4302
|
switch (actionType) {
|
|
4172
4303
|
case 'appointment':
|
|
4173
|
-
return (
|
|
4304
|
+
return (React.createElement(ActionResourceTypeBuilder, { title: "Appointment", description: "The subject must schedule an appointment from the schedule.", resourceType: "Schedule", action: action, onChange: props.onChange }));
|
|
4174
4305
|
case 'lab':
|
|
4175
|
-
return (
|
|
4306
|
+
return (React.createElement(ActionResourceTypeBuilder, { title: "Lab", description: "The subject must complete the following lab panel.", resourceType: "ActivityDefinition", action: action, onChange: props.onChange }));
|
|
4176
4307
|
case 'questionnaire':
|
|
4177
|
-
return (
|
|
4308
|
+
return (React.createElement(ActionResourceTypeBuilder, { title: "Questionnaire", description: "The subject must complete the selected questionnaire.", resourceType: "Questionnaire", action: action, onChange: props.onChange }));
|
|
4178
4309
|
case 'task':
|
|
4179
|
-
return (
|
|
4310
|
+
return (React.createElement(ActionResourceTypeBuilder, { title: "Task", description: "The subject must complete the following task.", resourceType: "ActivityDefinition", action: action, onChange: props.onChange }));
|
|
4180
4311
|
default:
|
|
4181
4312
|
return null;
|
|
4182
4313
|
}
|
|
4183
4314
|
})(),
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
React__default["default"].createElement(ActionTimingInput, { name: 'timing-' + action.id, action: action, onChange: props.onChange })));
|
|
4315
|
+
React.createElement(FormSection, { title: "Timing", description: "When the action should take place." },
|
|
4316
|
+
React.createElement(ActionTimingInput, { name: 'timing-' + action.id, action: action, onChange: props.onChange }))));
|
|
4187
4317
|
}
|
|
4188
4318
|
function ActionResourceTypeBuilder(props) {
|
|
4189
4319
|
const { id, definitionCanonical } = props.action;
|
|
4190
4320
|
const reference = (definitionCanonical === null || definitionCanonical === void 0 ? void 0 : definitionCanonical.startsWith(props.resourceType + '/'))
|
|
4191
4321
|
? { reference: definitionCanonical }
|
|
4192
4322
|
: undefined;
|
|
4193
|
-
return (
|
|
4323
|
+
return (React.createElement(ResourceInput, { name: id, resourceType: props.resourceType, defaultValue: reference, loadOnFocus: true, onChange: (newValue) => {
|
|
4194
4324
|
if (newValue) {
|
|
4195
4325
|
props.onChange(Object.assign(Object.assign({}, props.action), { definitionCanonical: core.getReferenceString(newValue) }));
|
|
4196
4326
|
}
|
|
@@ -4203,7 +4333,7 @@
|
|
|
4203
4333
|
const value = props.action;
|
|
4204
4334
|
const key = 'timing';
|
|
4205
4335
|
const [propertyValue, propertyType] = getActionTiming(value);
|
|
4206
|
-
return (
|
|
4336
|
+
return (React.createElement(ResourcePropertyInput, { property: timingProperty, name: "timing[x]", defaultValue: propertyValue, defaultPropertyType: propertyType, onChange: (newValue, propName) => {
|
|
4207
4337
|
props.onChange(setPropertyValue(value, key, propName !== null && propName !== void 0 ? propName : key, timingProperty, newValue));
|
|
4208
4338
|
} }));
|
|
4209
4339
|
}
|
|
@@ -4305,14 +4435,15 @@
|
|
|
4305
4435
|
if (!schema || !questionnaire) {
|
|
4306
4436
|
return null;
|
|
4307
4437
|
}
|
|
4308
|
-
return (
|
|
4438
|
+
return (React.createElement(Form, { testid: "questionnaire-form", onSubmit: () => {
|
|
4309
4439
|
if (props.onSubmit && response) {
|
|
4310
4440
|
props.onSubmit(Object.assign(Object.assign({}, response), { questionnaire: core.getReferenceString(questionnaire), subject: props.subject, source: core.createReference(source), authored: new Date().toISOString() }));
|
|
4311
4441
|
}
|
|
4312
4442
|
} },
|
|
4313
|
-
questionnaire.title &&
|
|
4314
|
-
questionnaire.item && (
|
|
4315
|
-
|
|
4443
|
+
questionnaire.title && React.createElement(core$1.Title, null, questionnaire.title),
|
|
4444
|
+
questionnaire.item && (React.createElement(QuestionnaireFormItemArray, { items: questionnaire.item, answers: answers, onChange: setItems })),
|
|
4445
|
+
React.createElement(core$1.Group, { position: "right", mt: "xl" },
|
|
4446
|
+
React.createElement(core$1.Button, { type: "submit" }, props.submitButtonText || 'OK'))));
|
|
4316
4447
|
}
|
|
4317
4448
|
function QuestionnaireFormItemArray(props) {
|
|
4318
4449
|
const [responseItems, setResponseItems] = React.useState(buildInitialResponseItems(props.items));
|
|
@@ -4322,27 +4453,27 @@
|
|
|
4322
4453
|
setResponseItems(newResponseItems);
|
|
4323
4454
|
props.onChange(newResponseItems);
|
|
4324
4455
|
}
|
|
4325
|
-
return (
|
|
4456
|
+
return (React.createElement(core$1.Stack, null, props.items.map((item, index) => {
|
|
4326
4457
|
if (!isQuestionEnabled(item, props.answers)) {
|
|
4327
4458
|
return null;
|
|
4328
4459
|
}
|
|
4329
4460
|
if (item.type === exports.QuestionnaireItemType.display) {
|
|
4330
|
-
return
|
|
4461
|
+
return React.createElement("p", { key: item.linkId }, item.text);
|
|
4331
4462
|
}
|
|
4332
4463
|
if (item.type === exports.QuestionnaireItemType.group) {
|
|
4333
|
-
return (
|
|
4464
|
+
return (React.createElement(QuestionnaireFormItem, { key: item.linkId, item: item, answers: props.answers, onChange: (newResponseItem) => setResponseItem(index, newResponseItem) }));
|
|
4334
4465
|
}
|
|
4335
4466
|
if (item.type === exports.QuestionnaireItemType.boolean) {
|
|
4336
4467
|
const initial = item.initial && item.initial.length > 0 ? item.initial[0] : undefined;
|
|
4337
|
-
return (
|
|
4338
|
-
|
|
4468
|
+
return (React.createElement(CheckboxFormSection, { key: item.linkId, title: item.text, htmlFor: item.linkId },
|
|
4469
|
+
React.createElement(core$1.Checkbox, { id: item.linkId, name: item.linkId, defaultChecked: initial === null || initial === void 0 ? void 0 : initial.valueBoolean, onChange: (e) => setResponseItem(index, {
|
|
4339
4470
|
linkId: item.linkId,
|
|
4340
4471
|
text: item.text,
|
|
4341
4472
|
answer: [{ valueBoolean: e.currentTarget.checked }],
|
|
4342
4473
|
}) })));
|
|
4343
4474
|
}
|
|
4344
|
-
return (
|
|
4345
|
-
|
|
4475
|
+
return (React.createElement(FormSection, { key: item.linkId, htmlFor: item.linkId, title: item.text || '' },
|
|
4476
|
+
React.createElement(QuestionnaireFormItem, { item: item, answers: props.answers, onChange: (newResponseItem) => setResponseItem(index, newResponseItem) })));
|
|
4346
4477
|
})));
|
|
4347
4478
|
}
|
|
4348
4479
|
function QuestionnaireFormItem(props) {
|
|
@@ -4372,39 +4503,39 @@
|
|
|
4372
4503
|
}
|
|
4373
4504
|
switch (type) {
|
|
4374
4505
|
case exports.QuestionnaireItemType.group:
|
|
4375
|
-
return (
|
|
4376
|
-
|
|
4377
|
-
item.item && (
|
|
4506
|
+
return (React.createElement("div", null,
|
|
4507
|
+
React.createElement("h3", null, item.text),
|
|
4508
|
+
item.item && (React.createElement(QuestionnaireFormItemArray, { items: item.item, answers: props.answers, onChange: onChangeItem }))));
|
|
4378
4509
|
case exports.QuestionnaireItemType.boolean:
|
|
4379
|
-
return (
|
|
4510
|
+
return (React.createElement(core$1.Checkbox, { id: name, name: name, defaultChecked: initial === null || initial === void 0 ? void 0 : initial.valueBoolean, onChange: (e) => onChangeAnswer({ valueBoolean: e.currentTarget.checked }) }));
|
|
4380
4511
|
case exports.QuestionnaireItemType.decimal:
|
|
4381
|
-
return (
|
|
4512
|
+
return (React.createElement(core$1.TextInput, { type: "number", step: "any", id: name, name: name, defaultValue: initial === null || initial === void 0 ? void 0 : initial.valueDecimal, onChange: (e) => onChangeAnswer({ valueDecimal: e.currentTarget.valueAsNumber }) }));
|
|
4382
4513
|
case exports.QuestionnaireItemType.integer:
|
|
4383
|
-
return (
|
|
4514
|
+
return (React.createElement(core$1.TextInput, { type: "number", step: 1, id: name, name: name, defaultValue: initial === null || initial === void 0 ? void 0 : initial.valueInteger, onChange: (e) => onChangeAnswer({ valueInteger: e.currentTarget.valueAsNumber }) }));
|
|
4384
4515
|
case exports.QuestionnaireItemType.date:
|
|
4385
|
-
return (
|
|
4516
|
+
return (React.createElement(core$1.TextInput, { type: "date", id: name, name: name, defaultValue: initial === null || initial === void 0 ? void 0 : initial.valueDate, onChange: (e) => onChangeAnswer({ valueDate: e.currentTarget.value }) }));
|
|
4386
4517
|
case exports.QuestionnaireItemType.dateTime:
|
|
4387
|
-
return (
|
|
4518
|
+
return (React.createElement(DateTimeInput, { name: name, defaultValue: initial === null || initial === void 0 ? void 0 : initial.valueDateTime, onChange: (newValue) => onChangeAnswer({ valueDateTime: newValue }) }));
|
|
4388
4519
|
case exports.QuestionnaireItemType.time:
|
|
4389
|
-
return (
|
|
4520
|
+
return (React.createElement(core$1.TextInput, { type: "time", id: name, name: name, defaultValue: initial === null || initial === void 0 ? void 0 : initial.valueTime, onChange: (e) => onChangeAnswer({ valueTime: e.currentTarget.value }) }));
|
|
4390
4521
|
case exports.QuestionnaireItemType.string:
|
|
4391
4522
|
case exports.QuestionnaireItemType.url:
|
|
4392
|
-
return (
|
|
4523
|
+
return (React.createElement(core$1.TextInput, { id: name, name: name, defaultValue: initial === null || initial === void 0 ? void 0 : initial.valueString, onChange: (e) => onChangeAnswer({ valueString: e.currentTarget.value }) }));
|
|
4393
4524
|
case exports.QuestionnaireItemType.text:
|
|
4394
|
-
return (
|
|
4525
|
+
return (React.createElement(core$1.Textarea, { id: name, name: name, defaultValue: initial === null || initial === void 0 ? void 0 : initial.valueString, onChange: (e) => onChangeAnswer({ valueString: e.currentTarget.value }) }));
|
|
4395
4526
|
case exports.QuestionnaireItemType.attachment:
|
|
4396
|
-
return (
|
|
4527
|
+
return (React.createElement(AttachmentInput, { name: name, defaultValue: initial === null || initial === void 0 ? void 0 : initial.valueAttachment, onChange: (newValue) => onChangeAnswer({ valueAttachment: newValue }) }));
|
|
4397
4528
|
case exports.QuestionnaireItemType.reference:
|
|
4398
|
-
return (
|
|
4529
|
+
return (React.createElement(ReferenceInput, { name: name, defaultValue: initial === null || initial === void 0 ? void 0 : initial.valueReference, onChange: (newValue) => onChangeAnswer({ valueReference: newValue }) }));
|
|
4399
4530
|
case exports.QuestionnaireItemType.quantity:
|
|
4400
|
-
return (
|
|
4531
|
+
return (React.createElement(QuantityInput, { name: name, defaultValue: initial === null || initial === void 0 ? void 0 : initial.valueQuantity, onChange: (newValue) => onChangeAnswer({ valueQuantity: newValue }) }));
|
|
4401
4532
|
case exports.QuestionnaireItemType.choice:
|
|
4402
4533
|
case exports.QuestionnaireItemType.openChoice:
|
|
4403
4534
|
if (isDropDownChoice(item)) {
|
|
4404
|
-
return (
|
|
4535
|
+
return (React.createElement(QuestionnaireChoiceDropDownInput, { name: name, item: item, initial: initial, onChangeAnswer: onChangeAnswer }));
|
|
4405
4536
|
}
|
|
4406
4537
|
else {
|
|
4407
|
-
return (
|
|
4538
|
+
return (React.createElement(QuestionnaireChoiceRadioInput, { name: name, item: item, initial: initial, onChangeAnswer: onChangeAnswer }));
|
|
4408
4539
|
}
|
|
4409
4540
|
}
|
|
4410
4541
|
return null;
|
|
@@ -4419,7 +4550,7 @@
|
|
|
4419
4550
|
data.push(typedValueToString(optionValue));
|
|
4420
4551
|
}
|
|
4421
4552
|
}
|
|
4422
|
-
return (
|
|
4553
|
+
return (React.createElement(core$1.NativeSelect, { id: name, name: name, onChange: (e) => {
|
|
4423
4554
|
const index = e.currentTarget.selectedIndex;
|
|
4424
4555
|
if (index === 0) {
|
|
4425
4556
|
props.onChangeAnswer({});
|
|
@@ -4447,18 +4578,27 @@
|
|
|
4447
4578
|
const { name, item, initial, onChangeAnswer } = props;
|
|
4448
4579
|
const valueElementDefinition = core.globalSchema.types['QuestionnaireItemAnswerOption'].properties['value[x]'];
|
|
4449
4580
|
const initialValue = core.getTypedPropertyValue({ type: 'QuestionnaireItemInitial', value: initial }, 'value');
|
|
4450
|
-
|
|
4451
|
-
|
|
4581
|
+
const options = [];
|
|
4582
|
+
let defaultValue = undefined;
|
|
4583
|
+
if (item.answerOption) {
|
|
4584
|
+
for (let i = 0; i < item.answerOption.length; i++) {
|
|
4585
|
+
const option = item.answerOption[i];
|
|
4586
|
+
const optionName = `${name}-option-${i}`;
|
|
4452
4587
|
const optionValue = core.getTypedPropertyValue({ type: 'QuestionnaireItemAnswerOption', value: option }, 'value');
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4588
|
+
if (initialValue && core.stringify(optionValue) === core.stringify(initialValue)) {
|
|
4589
|
+
defaultValue = optionName;
|
|
4590
|
+
}
|
|
4591
|
+
options.push([optionName, optionValue]);
|
|
4592
|
+
}
|
|
4593
|
+
}
|
|
4594
|
+
return (React.createElement(core$1.Radio.Group, { name: name, orientation: "vertical", defaultValue: defaultValue, onChange: (newValue) => {
|
|
4595
|
+
const option = options.find((option) => option[0] === newValue);
|
|
4596
|
+
if (option) {
|
|
4597
|
+
const optionValue = option[1];
|
|
4598
|
+
const propertyName = 'value' + core.capitalize(optionValue.type);
|
|
4599
|
+
onChangeAnswer({ [propertyName]: optionValue.value });
|
|
4600
|
+
}
|
|
4601
|
+
} }, options.map(([optionName, optionValue]) => (React.createElement(core$1.Radio, { key: optionName, id: optionName, value: optionName, label: React.createElement(ResourcePropertyDisplay, { property: valueElementDefinition, propertyType: optionValue.type, value: optionValue.value }) })))));
|
|
4462
4602
|
}
|
|
4463
4603
|
function buildInitialResponse(questionnaire) {
|
|
4464
4604
|
const response = {
|
|
@@ -4524,6 +4664,50 @@
|
|
|
4524
4664
|
}
|
|
4525
4665
|
}
|
|
4526
4666
|
|
|
4667
|
+
const useStyles$5 = core$1.createStyles((theme) => ({
|
|
4668
|
+
section: {
|
|
4669
|
+
position: 'relative',
|
|
4670
|
+
margin: '4px 4px 8px 0',
|
|
4671
|
+
padding: '6px 12px 16px 6px',
|
|
4672
|
+
border: `1.5px solid ${theme.colors.gray[1]}`,
|
|
4673
|
+
borderRadius: theme.radius.sm,
|
|
4674
|
+
transition: 'all 0.1s',
|
|
4675
|
+
},
|
|
4676
|
+
hovering: {
|
|
4677
|
+
border: `1.5px solid ${theme.colors.blue[5]}`,
|
|
4678
|
+
},
|
|
4679
|
+
editing: {
|
|
4680
|
+
border: `1.5px solid ${theme.colors.gray[1]}`,
|
|
4681
|
+
borderLeft: `4px solid ${theme.colors.blue[5]}`,
|
|
4682
|
+
},
|
|
4683
|
+
questionBody: {
|
|
4684
|
+
maxWidth: 600,
|
|
4685
|
+
},
|
|
4686
|
+
topActions: {
|
|
4687
|
+
position: 'absolute',
|
|
4688
|
+
right: 4,
|
|
4689
|
+
top: 1,
|
|
4690
|
+
padding: 4,
|
|
4691
|
+
color: theme.colors.gray[5],
|
|
4692
|
+
fontSize: theme.fontSizes.xs,
|
|
4693
|
+
},
|
|
4694
|
+
bottomActions: {
|
|
4695
|
+
position: 'absolute',
|
|
4696
|
+
right: 4,
|
|
4697
|
+
bottom: 0,
|
|
4698
|
+
fontSize: theme.fontSizes.xs,
|
|
4699
|
+
'& a': {
|
|
4700
|
+
marginLeft: 8,
|
|
4701
|
+
},
|
|
4702
|
+
},
|
|
4703
|
+
linkIdInput: {
|
|
4704
|
+
width: 100,
|
|
4705
|
+
marginBottom: 4,
|
|
4706
|
+
},
|
|
4707
|
+
typeSelect: {
|
|
4708
|
+
width: 100,
|
|
4709
|
+
},
|
|
4710
|
+
}));
|
|
4527
4711
|
function QuestionnaireBuilder(props) {
|
|
4528
4712
|
const medplum = useMedplum();
|
|
4529
4713
|
const defaultValue = useResource(props.questionnaire);
|
|
@@ -4552,13 +4736,14 @@
|
|
|
4552
4736
|
if (!schema || !value) {
|
|
4553
4737
|
return null;
|
|
4554
4738
|
}
|
|
4555
|
-
return (
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4739
|
+
return (React.createElement("div", null,
|
|
4740
|
+
React.createElement(Form, { testid: "questionnaire-form", onSubmit: () => props.onSubmit(value) },
|
|
4741
|
+
React.createElement(ItemBuilder, { item: value, selectedKey: selectedKey, setSelectedKey: setSelectedKey, hoverKey: hoverKey, setHoverKey: setHoverKey, onChange: setValue }),
|
|
4742
|
+
React.createElement(core$1.Button, { type: "submit" }, "Save"))));
|
|
4559
4743
|
}
|
|
4560
4744
|
function ItemBuilder(props) {
|
|
4561
4745
|
var _a;
|
|
4746
|
+
const { classes, cx } = useStyles$5();
|
|
4562
4747
|
const resource = props.item;
|
|
4563
4748
|
const item = props.item;
|
|
4564
4749
|
const isResource = 'resourceType' in props.item;
|
|
@@ -4592,41 +4777,43 @@
|
|
|
4592
4777
|
function changeProperty(property, value) {
|
|
4593
4778
|
props.onChange(Object.assign(Object.assign({}, itemRef.current), { [property]: value }));
|
|
4594
4779
|
}
|
|
4595
|
-
const className =
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
{ value: 'dateTime', label: 'Date/Time' },
|
|
4608
|
-
{ value: 'time', label: 'Time' },
|
|
4609
|
-
{ value: 'string', label: 'String' },
|
|
4610
|
-
{ value: 'text', label: 'Text' },
|
|
4611
|
-
{ value: 'url', label: 'URL' },
|
|
4612
|
-
{ value: 'choice', label: 'Choice' },
|
|
4613
|
-
{ value: 'open-choice', label: 'Open Choice' },
|
|
4614
|
-
{ value: 'attachment', label: 'Attachment' },
|
|
4615
|
-
{ value: 'reference', label: 'Reference' },
|
|
4616
|
-
{ value: 'quantity', label: 'Quantity' },
|
|
4617
|
-
] }))),
|
|
4618
|
-
!isResource && (React__default["default"].createElement(core$1.Textarea, { style: { width: '95%', height: '100px', minHeight: '100px', margin: '8px 4px 4px 4px' }, defaultValue: item.text, onChange: (e) => changeProperty('text', e.currentTarget.value) })),
|
|
4619
|
-
isChoiceQuestion(item) && (React__default["default"].createElement(AnswerBuilder, { options: item.answerOption, onChange: (newOptions) => changeProperty('answerOption', newOptions) })))) : (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
4620
|
-
resource.title && React__default["default"].createElement("h1", null, resource.title),
|
|
4621
|
-
item.text && React__default["default"].createElement("p", null, item.text),
|
|
4622
|
-
!isContainer && React__default["default"].createElement(QuestionnaireFormItem, { item: item, answers: {}, onChange: () => undefined }))),
|
|
4780
|
+
const className = cx(classes.section, {
|
|
4781
|
+
[classes.editing]: editing,
|
|
4782
|
+
[classes.hovering]: hovering && !editing,
|
|
4783
|
+
});
|
|
4784
|
+
return (React.createElement("div", { "data-testid": item.linkId, className: className, onClick: onClick, onMouseOver: onHover },
|
|
4785
|
+
React.createElement("div", { className: classes.questionBody }, editing ? (React.createElement(React.Fragment, null,
|
|
4786
|
+
isResource && (React.createElement(core$1.TextInput, { size: "xl", defaultValue: resource.title, onChange: (e) => changeProperty('title', e.currentTarget.value) })),
|
|
4787
|
+
!isResource && (React.createElement(core$1.Textarea, { autosize: true, minRows: 2, defaultValue: item.text, onChange: (e) => changeProperty('text', e.currentTarget.value) })),
|
|
4788
|
+
isChoiceQuestion(item) && (React.createElement(AnswerBuilder, { options: item.answerOption, onChange: (newOptions) => changeProperty('answerOption', newOptions) })))) : (React.createElement(React.Fragment, null,
|
|
4789
|
+
resource.title && React.createElement(core$1.Title, null, resource.title),
|
|
4790
|
+
item.text && React.createElement("div", null, item.text),
|
|
4791
|
+
!isContainer && React.createElement(QuestionnaireFormItem, { item: item, answers: {}, onChange: () => undefined })))),
|
|
4623
4792
|
item.item &&
|
|
4624
|
-
item.item.map((i) => (
|
|
4625
|
-
|
|
4626
|
-
!isContainer && (
|
|
4627
|
-
|
|
4628
|
-
isContainer && (
|
|
4629
|
-
|
|
4793
|
+
item.item.map((i) => (React.createElement("div", { key: i.id },
|
|
4794
|
+
React.createElement(ItemBuilder, { item: i, selectedKey: props.selectedKey, setSelectedKey: props.setSelectedKey, hoverKey: props.hoverKey, setHoverKey: props.setHoverKey, onChange: changeItem, onRemove: () => removeItem(i) })))),
|
|
4795
|
+
!isContainer && (React.createElement("div", { className: classes.topActions }, editing ? (React.createElement(React.Fragment, null,
|
|
4796
|
+
React.createElement(core$1.TextInput, { size: "xs", className: classes.linkIdInput, defaultValue: item.linkId, onChange: (e) => changeProperty('linkId', e.currentTarget.value) }),
|
|
4797
|
+
!isContainer && (React.createElement(core$1.NativeSelect, { size: "xs", className: classes.typeSelect, defaultValue: item.type, onChange: (e) => changeProperty('type', e.currentTarget.value), data: [
|
|
4798
|
+
{ value: 'display', label: 'Display' },
|
|
4799
|
+
{ value: 'boolean', label: 'Boolean' },
|
|
4800
|
+
{ value: 'decimal', label: 'Decimal' },
|
|
4801
|
+
{ value: 'integer', label: 'Integer' },
|
|
4802
|
+
{ value: 'date', label: 'Date' },
|
|
4803
|
+
{ value: 'dateTime', label: 'Date/Time' },
|
|
4804
|
+
{ value: 'time', label: 'Time' },
|
|
4805
|
+
{ value: 'string', label: 'String' },
|
|
4806
|
+
{ value: 'text', label: 'Text' },
|
|
4807
|
+
{ value: 'url', label: 'URL' },
|
|
4808
|
+
{ value: 'choice', label: 'Choice' },
|
|
4809
|
+
{ value: 'open-choice', label: 'Open Choice' },
|
|
4810
|
+
{ value: 'attachment', label: 'Attachment' },
|
|
4811
|
+
{ value: 'reference', label: 'Reference' },
|
|
4812
|
+
{ value: 'quantity', label: 'Quantity' },
|
|
4813
|
+
] })))) : (React.createElement("div", null, linkId)))),
|
|
4814
|
+
React.createElement("div", { className: classes.bottomActions },
|
|
4815
|
+
isContainer && (React.createElement(React.Fragment, null,
|
|
4816
|
+
React.createElement("a", { href: "#", onClick: (e) => {
|
|
4630
4817
|
e.preventDefault();
|
|
4631
4818
|
addItem({
|
|
4632
4819
|
id: generateId(),
|
|
@@ -4635,7 +4822,7 @@
|
|
|
4635
4822
|
text: 'Question',
|
|
4636
4823
|
});
|
|
4637
4824
|
} }, "Add item"),
|
|
4638
|
-
|
|
4825
|
+
React.createElement("a", { href: "#", onClick: (e) => {
|
|
4639
4826
|
e.preventDefault();
|
|
4640
4827
|
addItem({
|
|
4641
4828
|
id: generateId(),
|
|
@@ -4644,7 +4831,7 @@
|
|
|
4644
4831
|
text: 'Group',
|
|
4645
4832
|
});
|
|
4646
4833
|
} }, "Add group"))),
|
|
4647
|
-
!isResource && (
|
|
4834
|
+
editing && !isResource && (React.createElement("a", { href: "#", onClick: (e) => {
|
|
4648
4835
|
e.preventDefault();
|
|
4649
4836
|
if (props.onRemove) {
|
|
4650
4837
|
props.onRemove();
|
|
@@ -4655,30 +4842,30 @@
|
|
|
4655
4842
|
var _a;
|
|
4656
4843
|
const property = core.globalSchema.types['QuestionnaireItemAnswerOption'].properties['value[x]'];
|
|
4657
4844
|
const options = (_a = props.options) !== null && _a !== void 0 ? _a : [];
|
|
4658
|
-
return (
|
|
4845
|
+
return (React.createElement("div", null,
|
|
4659
4846
|
options.map((option) => {
|
|
4660
4847
|
const [propertyValue, propertyType] = getValueAndType({ type: 'QuestionnaireItemAnswerOption', value: option }, 'value');
|
|
4661
|
-
return (
|
|
4848
|
+
return (React.createElement("div", { key: option.id, style: {
|
|
4662
4849
|
display: 'flex',
|
|
4663
4850
|
flexDirection: 'row',
|
|
4664
4851
|
justifyContent: 'space-between',
|
|
4665
4852
|
alignItems: 'center',
|
|
4666
4853
|
width: '80%',
|
|
4667
4854
|
} },
|
|
4668
|
-
|
|
4669
|
-
|
|
4855
|
+
React.createElement("div", null,
|
|
4856
|
+
React.createElement(ResourcePropertyInput, { key: option.id, name: "value[x]", property: property, defaultPropertyType: propertyType, defaultValue: propertyValue, onChange: (newValue, propName) => {
|
|
4670
4857
|
const newOptions = [...options];
|
|
4671
4858
|
const index = newOptions.findIndex((o) => o.id === option.id);
|
|
4672
4859
|
newOptions[index] = { id: option.id, [propName]: newValue };
|
|
4673
4860
|
props.onChange(newOptions);
|
|
4674
4861
|
} })),
|
|
4675
|
-
|
|
4676
|
-
|
|
4862
|
+
React.createElement("div", null,
|
|
4863
|
+
React.createElement("a", { href: "#", onClick: (e) => {
|
|
4677
4864
|
killEvent(e);
|
|
4678
4865
|
props.onChange(options.filter((o) => o.id !== option.id));
|
|
4679
4866
|
} }, "Remove"))));
|
|
4680
4867
|
}),
|
|
4681
|
-
|
|
4868
|
+
React.createElement("a", { href: "#", onClick: (e) => {
|
|
4682
4869
|
killEvent(e);
|
|
4683
4870
|
props.onChange([
|
|
4684
4871
|
...options,
|
|
@@ -4733,6 +4920,265 @@
|
|
|
4733
4920
|
return options.map((option) => (Object.assign(Object.assign({}, option), { id: option.id || generateId() })));
|
|
4734
4921
|
}
|
|
4735
4922
|
|
|
4923
|
+
const useStyles$4 = core$1.createStyles((theme) => ({
|
|
4924
|
+
section: {
|
|
4925
|
+
position: 'relative',
|
|
4926
|
+
margin: '4px 4px 8px 0',
|
|
4927
|
+
padding: '6px 12px 16px 6px',
|
|
4928
|
+
border: `1.5px solid ${theme.colors.gray[3]}`,
|
|
4929
|
+
borderRadius: theme.radius.sm,
|
|
4930
|
+
transition: 'all 0.1s',
|
|
4931
|
+
},
|
|
4932
|
+
}));
|
|
4933
|
+
// Properties of qualified intervals used for grouping
|
|
4934
|
+
const intervalFilters = ['gender', 'age', 'gestationalAge', 'context', 'appliesTo'];
|
|
4935
|
+
const defaultProps = {
|
|
4936
|
+
definition: { resourceType: 'ObservationDefinition' },
|
|
4937
|
+
onSubmit: () => {
|
|
4938
|
+
return;
|
|
4939
|
+
},
|
|
4940
|
+
};
|
|
4941
|
+
function ReferenceRangeEditor(props) {
|
|
4942
|
+
props = Object.assign(defaultProps, props);
|
|
4943
|
+
const defaultDefinition = props.definition;
|
|
4944
|
+
const [intervalGroups, setIntervalGroups] = React.useState([]);
|
|
4945
|
+
const [groupId, setGroupId] = React.useState(1);
|
|
4946
|
+
const [intervalId, setIntervalId] = React.useState(1);
|
|
4947
|
+
React.useEffect(() => {
|
|
4948
|
+
const definition = ensureQualifiedIntervalKeys(defaultDefinition, setIntervalId);
|
|
4949
|
+
setIntervalGroups(groupQualifiedIntervals(definition.qualifiedInterval || [], setGroupId));
|
|
4950
|
+
}, [defaultDefinition]);
|
|
4951
|
+
return (React.createElement(Form, { testid: "reference-range-editor", onSubmit: submitDefinition },
|
|
4952
|
+
React.createElement(core$1.Stack, null, intervalGroups.map((intervalGroup) => {
|
|
4953
|
+
var _a;
|
|
4954
|
+
return (React.createElement(ReferenceRangeGroupEditor, { unit: getUnitString((_a = defaultDefinition.quantitativeDetails) === null || _a === void 0 ? void 0 : _a.unit), onChange: changeInterval, onAdd: addInterval, onRemove: removeInterval, onRemoveGroup: removeGroup, key: `group-${intervalGroup.id}`, intervalGroup: intervalGroup }));
|
|
4955
|
+
})),
|
|
4956
|
+
React.createElement(core$1.ActionIcon, { title: "Add Group", size: "sm", onClick: (e) => {
|
|
4957
|
+
killEvent(e);
|
|
4958
|
+
addGroup({ id: `group-id-${groupId}`, filters: {}, intervals: [] });
|
|
4959
|
+
setGroupId((id) => id + 1);
|
|
4960
|
+
} },
|
|
4961
|
+
React.createElement(icons.IconCirclePlus, null)),
|
|
4962
|
+
React.createElement(core$1.Group, { position: "right" },
|
|
4963
|
+
React.createElement(core$1.Button, { type: "submit" }, "Save"))));
|
|
4964
|
+
/**
|
|
4965
|
+
* Submit qualified intervals
|
|
4966
|
+
*/
|
|
4967
|
+
function submitDefinition() {
|
|
4968
|
+
const qualifiedInterval = intervalGroups
|
|
4969
|
+
.flatMap((group) => group.intervals)
|
|
4970
|
+
.filter((interval) => !isEmptyInterval(interval));
|
|
4971
|
+
props.onSubmit(Object.assign(Object.assign({}, defaultDefinition), { qualifiedInterval }));
|
|
4972
|
+
}
|
|
4973
|
+
/**
|
|
4974
|
+
* Add Remove Interval Groups
|
|
4975
|
+
*/
|
|
4976
|
+
function addGroup(addedGroup) {
|
|
4977
|
+
setIntervalGroups((currentGroups) => [...currentGroups, addedGroup]);
|
|
4978
|
+
}
|
|
4979
|
+
function removeGroup(removedGroup) {
|
|
4980
|
+
setIntervalGroups((currentGroups) => currentGroups.filter((group) => group.id !== removedGroup.id));
|
|
4981
|
+
}
|
|
4982
|
+
/**
|
|
4983
|
+
* Add/Remove/Update specific Qualified Intervals
|
|
4984
|
+
*/
|
|
4985
|
+
function changeInterval(groupId, changedInterval) {
|
|
4986
|
+
setIntervalGroups((groups) => {
|
|
4987
|
+
var _a, _b;
|
|
4988
|
+
groups = [...groups];
|
|
4989
|
+
const currentGroup = groups.find((g) => g.id === groupId);
|
|
4990
|
+
const index = (_a = currentGroup === null || currentGroup === void 0 ? void 0 : currentGroup.intervals) === null || _a === void 0 ? void 0 : _a.findIndex((interval) => interval.id === changedInterval.id);
|
|
4991
|
+
if (index !== undefined && ((_b = currentGroup === null || currentGroup === void 0 ? void 0 : currentGroup.intervals) === null || _b === void 0 ? void 0 : _b[index])) {
|
|
4992
|
+
currentGroup.intervals[index] = changedInterval;
|
|
4993
|
+
}
|
|
4994
|
+
return groups;
|
|
4995
|
+
});
|
|
4996
|
+
}
|
|
4997
|
+
function addInterval(groupId, addedInterval) {
|
|
4998
|
+
if (addedInterval.id === undefined) {
|
|
4999
|
+
addedInterval.id = `id-${intervalId}`;
|
|
5000
|
+
setIntervalId((id) => id + 1);
|
|
5001
|
+
}
|
|
5002
|
+
setIntervalGroups((groups) => {
|
|
5003
|
+
groups = [...groups];
|
|
5004
|
+
const currentGroupIndex = groups.findIndex((g) => g.id === groupId);
|
|
5005
|
+
if (currentGroupIndex != -1) {
|
|
5006
|
+
const currentGroup = Object.assign({}, groups[currentGroupIndex]);
|
|
5007
|
+
currentGroup.intervals = [...currentGroup.intervals, addedInterval];
|
|
5008
|
+
groups[currentGroupIndex] = currentGroup;
|
|
5009
|
+
}
|
|
5010
|
+
return groups;
|
|
5011
|
+
});
|
|
5012
|
+
}
|
|
5013
|
+
function removeInterval(groupId, removedInterval) {
|
|
5014
|
+
setIntervalGroups((groups) => {
|
|
5015
|
+
groups = [...groups];
|
|
5016
|
+
const currentGroup = groups.find((g) => g.id === groupId);
|
|
5017
|
+
if (currentGroup) {
|
|
5018
|
+
currentGroup.intervals = currentGroup.intervals.filter((interval) => interval.id !== removedInterval.id);
|
|
5019
|
+
}
|
|
5020
|
+
return groups;
|
|
5021
|
+
});
|
|
5022
|
+
}
|
|
5023
|
+
}
|
|
5024
|
+
function ReferenceRangeGroupEditor(props) {
|
|
5025
|
+
const { intervalGroup, unit } = props;
|
|
5026
|
+
const { classes } = useStyles$4();
|
|
5027
|
+
return (React.createElement(core$1.Container, { "data-testid": intervalGroup.id, className: classes.section },
|
|
5028
|
+
React.createElement(core$1.Stack, { spacing: 'lg' },
|
|
5029
|
+
React.createElement(core$1.Group, { position: "right" },
|
|
5030
|
+
React.createElement(core$1.ActionIcon, { title: "Remove Group", "data-testid": `remove-group-button-${intervalGroup.id}`, key: `remove-group-button-${intervalGroup.id}`, size: "sm", onClick: (e) => {
|
|
5031
|
+
killEvent(e);
|
|
5032
|
+
props.onRemoveGroup(intervalGroup);
|
|
5033
|
+
} },
|
|
5034
|
+
React.createElement(icons.IconCircleMinus, null))),
|
|
5035
|
+
React.createElement(ReferenceRangeGroupFilters, { intervalGroup: intervalGroup, onChange: props.onChange }),
|
|
5036
|
+
React.createElement(core$1.Divider, null),
|
|
5037
|
+
intervalGroup.intervals.map((interval) => (React.createElement(core$1.Stack, { key: `interval-${interval.id}`, spacing: 'xs' },
|
|
5038
|
+
React.createElement(core$1.Group, null,
|
|
5039
|
+
React.createElement(core$1.TextInput, { key: `condition-${interval.id}`, "data-testid": `condition-${interval.id}`, defaultValue: interval.condition, label: 'Condition: ', size: 'sm', onChange: (e) => {
|
|
5040
|
+
killEvent(e);
|
|
5041
|
+
props.onChange(intervalGroup.id, Object.assign(Object.assign({}, interval), { condition: e.currentTarget.value.trim() }));
|
|
5042
|
+
} }),
|
|
5043
|
+
React.createElement(core$1.ActionIcon, { title: "Remove Interval", size: "sm", key: `remove-interval-${interval.id}`, "data-testid": `remove-interval-${interval.id}`, onClick: (e) => {
|
|
5044
|
+
killEvent(e);
|
|
5045
|
+
props.onRemove(intervalGroup.id, interval);
|
|
5046
|
+
} },
|
|
5047
|
+
React.createElement(icons.IconCircleMinus, null))),
|
|
5048
|
+
React.createElement(RangeInput, { onChange: (range) => {
|
|
5049
|
+
props.onChange(intervalGroup.id, Object.assign(Object.assign({}, interval), { range }));
|
|
5050
|
+
}, key: `range-${interval.id}`, name: `range-${interval.id}`, defaultValue: interval.range })))),
|
|
5051
|
+
React.createElement(core$1.ActionIcon, { title: "Add Interval", size: "sm", onClick: (e) => {
|
|
5052
|
+
killEvent(e);
|
|
5053
|
+
props.onAdd(intervalGroup.id, {
|
|
5054
|
+
range: {
|
|
5055
|
+
low: { unit },
|
|
5056
|
+
high: { unit },
|
|
5057
|
+
},
|
|
5058
|
+
});
|
|
5059
|
+
} },
|
|
5060
|
+
React.createElement(icons.IconCirclePlus, null)))));
|
|
5061
|
+
}
|
|
5062
|
+
/**
|
|
5063
|
+
* Render the "filters" section of the IntervalGroup. Also populates some initial
|
|
5064
|
+
*/
|
|
5065
|
+
function ReferenceRangeGroupFilters(props) {
|
|
5066
|
+
var _a, _b;
|
|
5067
|
+
const { intervalGroup, onChange } = props;
|
|
5068
|
+
// Pre-populate the units of the age filter
|
|
5069
|
+
if (!intervalGroup.filters.age) {
|
|
5070
|
+
intervalGroup.filters.age = {};
|
|
5071
|
+
}
|
|
5072
|
+
for (const key of ['low', 'high']) {
|
|
5073
|
+
if (!((_a = intervalGroup.filters.age[key]) === null || _a === void 0 ? void 0 : _a.unit)) {
|
|
5074
|
+
intervalGroup.filters.age[key] = Object.assign(Object.assign({}, intervalGroup.filters.age[key]), { unit: 'years', system: 'http://unitsofmeasure.org' });
|
|
5075
|
+
}
|
|
5076
|
+
}
|
|
5077
|
+
return (React.createElement(core$1.Stack, { style: { maxWidth: '50%' } },
|
|
5078
|
+
React.createElement(core$1.Group, null,
|
|
5079
|
+
React.createElement(core$1.NativeSelect, { data: ['', 'male', 'female'], label: "Gender:", defaultValue: intervalGroup.filters.gender || '', onChange: (e) => {
|
|
5080
|
+
var _a;
|
|
5081
|
+
for (const interval of intervalGroup.intervals) {
|
|
5082
|
+
let newGender = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value;
|
|
5083
|
+
if (newGender === '') {
|
|
5084
|
+
newGender = undefined;
|
|
5085
|
+
}
|
|
5086
|
+
onChange(intervalGroup.id, Object.assign(Object.assign({}, interval), { gender: newGender }));
|
|
5087
|
+
}
|
|
5088
|
+
} })),
|
|
5089
|
+
React.createElement(core$1.Group, { spacing: 'xs' },
|
|
5090
|
+
React.createElement(core$1.Text, { component: "label", htmlFor: `div-age-${intervalGroup.id}` }, "Age:"),
|
|
5091
|
+
React.createElement("div", { id: `div-age-${intervalGroup.id}` },
|
|
5092
|
+
React.createElement(RangeInput, { key: `age-${intervalGroup.id}`, name: `age-${intervalGroup.id}`, defaultValue: intervalGroup.filters['age'], onChange: (ageRange) => {
|
|
5093
|
+
for (const interval of intervalGroup.intervals) {
|
|
5094
|
+
onChange(intervalGroup.id, Object.assign(Object.assign({}, interval), { age: ageRange }));
|
|
5095
|
+
}
|
|
5096
|
+
} }))),
|
|
5097
|
+
React.createElement(core$1.NativeSelect, { data: ['', 'pre-puberty', 'follicular', 'midcycle', 'luteal', 'postmenopausal'], label: "Endocrine:", defaultValue: ((_b = intervalGroup.filters.context) === null || _b === void 0 ? void 0 : _b.text) || '', onChange: (e) => {
|
|
5098
|
+
var _a;
|
|
5099
|
+
for (const interval of intervalGroup.intervals) {
|
|
5100
|
+
let newEndocrine = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value;
|
|
5101
|
+
if (newEndocrine === '') {
|
|
5102
|
+
newEndocrine = undefined;
|
|
5103
|
+
onChange(intervalGroup.id, Object.assign(Object.assign({}, interval), { context: undefined }));
|
|
5104
|
+
}
|
|
5105
|
+
else {
|
|
5106
|
+
onChange(intervalGroup.id, Object.assign(Object.assign({}, interval), { context: {
|
|
5107
|
+
text: newEndocrine,
|
|
5108
|
+
coding: [
|
|
5109
|
+
{ code: newEndocrine, system: 'http://terminology.hl7.org/CodeSystem/referencerange-meaning' },
|
|
5110
|
+
],
|
|
5111
|
+
} }));
|
|
5112
|
+
}
|
|
5113
|
+
}
|
|
5114
|
+
} })));
|
|
5115
|
+
}
|
|
5116
|
+
/**
|
|
5117
|
+
* Helper function that assigns ids to each qualifiedInterval of an ObservationDefinition
|
|
5118
|
+
* @param definition An ObservationDefinition
|
|
5119
|
+
* @param setIntervalId React setState function for the intervalId
|
|
5120
|
+
* @returns
|
|
5121
|
+
*/
|
|
5122
|
+
function ensureQualifiedIntervalKeys(definition, setIntervalId) {
|
|
5123
|
+
const intervals = definition.qualifiedInterval || [];
|
|
5124
|
+
// Set the nextId to the max of any existing numeric id
|
|
5125
|
+
let nextId = Math.max(...intervals.map((interval) => {
|
|
5126
|
+
var _a;
|
|
5127
|
+
const existingNum = parseInt(((_a = interval.id) === null || _a === void 0 ? void 0 : _a.substring(3)) || '');
|
|
5128
|
+
return !isNaN(existingNum) ? existingNum : Number.NEGATIVE_INFINITY;
|
|
5129
|
+
})) + 1;
|
|
5130
|
+
if (!Number.isFinite(nextId)) {
|
|
5131
|
+
nextId = 1;
|
|
5132
|
+
}
|
|
5133
|
+
// If an interval doesn't have an id, set it to the nextId
|
|
5134
|
+
definition = Object.assign(Object.assign({}, definition), { qualifiedInterval: intervals.map((interval) => (Object.assign(Object.assign({}, interval), { id: interval.id || `id-${nextId++}` }))) });
|
|
5135
|
+
setIntervalId(nextId);
|
|
5136
|
+
return definition;
|
|
5137
|
+
}
|
|
5138
|
+
/**
|
|
5139
|
+
* Group all ObservationDefinitionQualifiedIntervals based on the values of their "filter" properties,
|
|
5140
|
+
* so that similar ranges can be grouped together
|
|
5141
|
+
*/
|
|
5142
|
+
function groupQualifiedIntervals(intervals, setGroupId) {
|
|
5143
|
+
let groupId = 1;
|
|
5144
|
+
const groups = {};
|
|
5145
|
+
for (const interval of intervals) {
|
|
5146
|
+
const groupKey = generateGroupKey(interval);
|
|
5147
|
+
if (!(groupKey in groups)) {
|
|
5148
|
+
groups[groupKey] = {
|
|
5149
|
+
id: `group-id-${groupId++}`,
|
|
5150
|
+
filters: Object.fromEntries(intervalFilters.map((f) => [f, interval[f]])),
|
|
5151
|
+
intervals: [],
|
|
5152
|
+
};
|
|
5153
|
+
}
|
|
5154
|
+
groups[groupKey].intervals.push(interval);
|
|
5155
|
+
}
|
|
5156
|
+
setGroupId(groupId);
|
|
5157
|
+
return Object.values(groups);
|
|
5158
|
+
}
|
|
5159
|
+
/**
|
|
5160
|
+
* Generates a unique string for each set of filter values, so that similarly filtered intervals can be grouped together
|
|
5161
|
+
* @return A "group key" that corresponds to the value of the interval filter properties.
|
|
5162
|
+
*/
|
|
5163
|
+
function generateGroupKey(interval) {
|
|
5164
|
+
var _a, _b;
|
|
5165
|
+
const results = [
|
|
5166
|
+
`gender=${interval.gender}`,
|
|
5167
|
+
`age=${core.formatRange(interval.age)}`,
|
|
5168
|
+
`gestationalAge=${core.formatRange(interval.gestationalAge)}`,
|
|
5169
|
+
`context=${(_a = interval.context) === null || _a === void 0 ? void 0 : _a.text}`,
|
|
5170
|
+
`appliesTo=${(_b = interval.appliesTo) === null || _b === void 0 ? void 0 : _b.map((c) => c.text).join('+')}`,
|
|
5171
|
+
];
|
|
5172
|
+
return results.join(':');
|
|
5173
|
+
}
|
|
5174
|
+
function getUnitString(unit) {
|
|
5175
|
+
return unit && (core.getCodeBySystem(unit, 'http://unitsofmeasure.org') || unit.text);
|
|
5176
|
+
}
|
|
5177
|
+
function isEmptyInterval(interval) {
|
|
5178
|
+
var _a, _b, _c, _d;
|
|
5179
|
+
return ((_b = (_a = interval.range) === null || _a === void 0 ? void 0 : _a.low) === null || _b === void 0 ? void 0 : _b.value) === undefined && ((_d = (_c = interval.range) === null || _c === void 0 ? void 0 : _c.high) === null || _d === void 0 ? void 0 : _d.value) === undefined;
|
|
5180
|
+
}
|
|
5181
|
+
|
|
4736
5182
|
/*
|
|
4737
5183
|
* Request status: https://hl7.org/fhir/valueset-request-status.html
|
|
4738
5184
|
* draft, active, on-hold, revoked, completed, entered-in-error, unknown
|
|
@@ -4787,7 +5233,7 @@
|
|
|
4787
5233
|
stat: 'red',
|
|
4788
5234
|
};
|
|
4789
5235
|
function StatusBadge(props) {
|
|
4790
|
-
return
|
|
5236
|
+
return React.createElement(core$1.Badge, { color: statusToColor[props.status] }, props.status);
|
|
4791
5237
|
}
|
|
4792
5238
|
|
|
4793
5239
|
function RequestGroupDisplay(props) {
|
|
@@ -4805,27 +5251,27 @@
|
|
|
4805
5251
|
if (!requestGroup || !responseBundle) {
|
|
4806
5252
|
return null;
|
|
4807
5253
|
}
|
|
4808
|
-
return (
|
|
5254
|
+
return (React.createElement(core$1.Grid, null, (_a = requestGroup.action) === null || _a === void 0 ? void 0 : _a.map((action, index) => {
|
|
4809
5255
|
var _a, _b, _c, _d, _e, _f;
|
|
4810
5256
|
const task = action.resource && findBundleEntry(action.resource);
|
|
4811
5257
|
const taskInput = (_b = (_a = task === null || task === void 0 ? void 0 : task.input) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.valueReference;
|
|
4812
5258
|
const taskOutput = (_d = (_c = task === null || task === void 0 ? void 0 : task.output) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.valueReference;
|
|
4813
|
-
return (
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
action.description &&
|
|
4818
|
-
|
|
5259
|
+
return (React.createElement(React.Fragment, { key: `action-${index}` },
|
|
5260
|
+
React.createElement(core$1.Grid.Col, { span: 1, p: "md" }, (task === null || task === void 0 ? void 0 : task.status) === 'completed' ? React.createElement(icons.IconCheckbox, null) : React.createElement(icons.IconSquare, { color: "gray" })),
|
|
5261
|
+
React.createElement(core$1.Grid.Col, { span: 9, p: "xs" },
|
|
5262
|
+
React.createElement(core$1.Text, { weight: 500 }, action.title),
|
|
5263
|
+
action.description && React.createElement("div", null, action.description),
|
|
5264
|
+
React.createElement("div", null,
|
|
4819
5265
|
"Last edited by\u00A0",
|
|
4820
|
-
|
|
5266
|
+
React.createElement(ResourceName, { value: (_e = task === null || task === void 0 ? void 0 : task.meta) === null || _e === void 0 ? void 0 : _e.author }),
|
|
4821
5267
|
"\u00A0on\u00A0",
|
|
4822
5268
|
core.formatDateTime((_f = task === null || task === void 0 ? void 0 : task.meta) === null || _f === void 0 ? void 0 : _f.lastUpdated)),
|
|
4823
|
-
|
|
5269
|
+
React.createElement("div", null,
|
|
4824
5270
|
"Status: ",
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
taskInput && !taskOutput &&
|
|
4828
|
-
taskInput && taskOutput && (
|
|
5271
|
+
React.createElement(StatusBadge, { status: (task === null || task === void 0 ? void 0 : task.status) || 'unknown' }))),
|
|
5272
|
+
React.createElement(core$1.Grid.Col, { span: 2, p: "md" },
|
|
5273
|
+
taskInput && !taskOutput && React.createElement(core$1.Button, { onClick: () => props.onStart(task, taskInput) }, "Start"),
|
|
5274
|
+
taskInput && taskOutput && (React.createElement(core$1.Button, { onClick: () => props.onEdit(task, taskInput, taskOutput) }, "Edit")))));
|
|
4829
5275
|
})));
|
|
4830
5276
|
function buildBatchRequest(request) {
|
|
4831
5277
|
var _a;
|
|
@@ -5039,8 +5485,56 @@
|
|
|
5039
5485
|
}
|
|
5040
5486
|
}
|
|
5041
5487
|
|
|
5488
|
+
const useStyles$3 = core$1.createStyles((theme) => ({
|
|
5489
|
+
container: {
|
|
5490
|
+
overflowX: 'auto',
|
|
5491
|
+
},
|
|
5492
|
+
root: {
|
|
5493
|
+
border: `0.1px solid ${theme.colors.gray[3]}`,
|
|
5494
|
+
borderCollapse: 'collapse',
|
|
5495
|
+
borderRadius: theme.radius.sm,
|
|
5496
|
+
borderSpacing: 0,
|
|
5497
|
+
fontSize: theme.fontSizes.xs,
|
|
5498
|
+
width: '100%',
|
|
5499
|
+
'& td': {
|
|
5500
|
+
padding: '2px 4px 0 4px',
|
|
5501
|
+
verticalAlign: 'top',
|
|
5502
|
+
whiteSpace: 'nowrap',
|
|
5503
|
+
},
|
|
5504
|
+
},
|
|
5505
|
+
startRow: {
|
|
5506
|
+
borderTop: `0.1px solid ${theme.colors.gray[3]}`,
|
|
5507
|
+
},
|
|
5508
|
+
normalRow: {
|
|
5509
|
+
borderTop: 0,
|
|
5510
|
+
},
|
|
5511
|
+
author: {
|
|
5512
|
+
lineHeight: '10px',
|
|
5513
|
+
},
|
|
5514
|
+
dateTime: {
|
|
5515
|
+
borderRight: `0.1px solid ${theme.colors.gray[3]}`,
|
|
5516
|
+
lineHeight: '20px',
|
|
5517
|
+
},
|
|
5518
|
+
lineNumber: {
|
|
5519
|
+
backgroundColor: theme.colors.gray[1],
|
|
5520
|
+
border: 0,
|
|
5521
|
+
color: theme.colors.gray[5],
|
|
5522
|
+
fontFamily: theme.fontFamilyMonospace,
|
|
5523
|
+
padding: `${theme.spacing.xs}px ${theme.spacing.sm}px`,
|
|
5524
|
+
textAlign: 'right',
|
|
5525
|
+
},
|
|
5526
|
+
line: {
|
|
5527
|
+
fontFamily: theme.fontFamilyMonospace,
|
|
5528
|
+
fontSize: theme.fontSizes.sm,
|
|
5529
|
+
padding: `${theme.spacing.xs}px ${theme.spacing.sm}px`,
|
|
5530
|
+
},
|
|
5531
|
+
pre: {
|
|
5532
|
+
margin: 0,
|
|
5533
|
+
},
|
|
5534
|
+
}));
|
|
5042
5535
|
function ResourceBlame(props) {
|
|
5043
5536
|
var _a, _b;
|
|
5537
|
+
const { classes } = useStyles$3();
|
|
5044
5538
|
const medplum = useMedplum();
|
|
5045
5539
|
const [value, setValue] = React.useState(props.history);
|
|
5046
5540
|
React.useEffect(() => {
|
|
@@ -5049,20 +5543,21 @@
|
|
|
5049
5543
|
}
|
|
5050
5544
|
}, [medplum, props.history, props.resourceType, props.id]);
|
|
5051
5545
|
if (!value) {
|
|
5052
|
-
return
|
|
5546
|
+
return React.createElement("div", null, "Loading...");
|
|
5053
5547
|
}
|
|
5054
5548
|
const resource = (_b = (_a = value.entry) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.resource;
|
|
5055
5549
|
const table = blame(value);
|
|
5056
|
-
return (
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
row.span > 0 && (
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5550
|
+
return (React.createElement("div", { className: classes.container },
|
|
5551
|
+
React.createElement("table", { className: classes.root },
|
|
5552
|
+
React.createElement("tbody", null, table.map((row, index) => (React.createElement("tr", { key: 'row-' + index, className: row.span > 0 ? classes.startRow : classes.normalRow },
|
|
5553
|
+
row.span > 0 && (React.createElement(React.Fragment, null,
|
|
5554
|
+
React.createElement("td", { className: classes.author, rowSpan: row.span },
|
|
5555
|
+
React.createElement(ResourceBadge, { value: row.meta.author, link: true })),
|
|
5556
|
+
React.createElement("td", { className: classes.dateTime, rowSpan: row.span },
|
|
5557
|
+
React.createElement(MedplumLink, { to: getVersionUrl$1(resource, row.meta.versionId) }, getTimeString(row.meta.lastUpdated))))),
|
|
5558
|
+
React.createElement("td", { className: classes.lineNumber }, index + 1),
|
|
5559
|
+
React.createElement("td", { className: classes.line },
|
|
5560
|
+
React.createElement("pre", { className: classes.pre }, row.value)))))))));
|
|
5066
5561
|
}
|
|
5067
5562
|
function getVersionUrl$1(resource, versionId) {
|
|
5068
5563
|
return `/${resource.resourceType}/${resource.id}/_history/${versionId}`;
|
|
@@ -5095,6 +5590,15 @@
|
|
|
5095
5590
|
return `${count} ${count === 1 ? noun : noun + 's'} ago`;
|
|
5096
5591
|
}
|
|
5097
5592
|
|
|
5593
|
+
const useStyles$2 = core$1.createStyles((theme) => ({
|
|
5594
|
+
removed: {
|
|
5595
|
+
color: theme.colors.red[7],
|
|
5596
|
+
textDecoration: 'line-through',
|
|
5597
|
+
},
|
|
5598
|
+
added: {
|
|
5599
|
+
color: theme.colors.green[7],
|
|
5600
|
+
},
|
|
5601
|
+
}));
|
|
5098
5602
|
function ResourceDiff(props) {
|
|
5099
5603
|
let originalResource = props.original;
|
|
5100
5604
|
let revisedResource = props.revised;
|
|
@@ -5105,16 +5609,17 @@
|
|
|
5105
5609
|
const original = core.stringify(originalResource, true).match(/[^\r\n]+/g);
|
|
5106
5610
|
const revised = core.stringify(revisedResource, true).match(/[^\r\n]+/g);
|
|
5107
5611
|
const deltas = diff(original, revised);
|
|
5108
|
-
return (
|
|
5612
|
+
return (React.createElement("pre", { style: { color: 'gray' } }, deltas.map((delta, index) => (React.createElement(ChangeDiff, { key: 'delta' + index, delta: delta })))));
|
|
5109
5613
|
}
|
|
5110
5614
|
function ChangeDiff(props) {
|
|
5111
|
-
|
|
5615
|
+
const { classes } = useStyles$2();
|
|
5616
|
+
return (React.createElement(React.Fragment, null,
|
|
5112
5617
|
"...",
|
|
5113
|
-
|
|
5114
|
-
props.delta.original.lines.length > 0 && (
|
|
5115
|
-
props.delta.revised.lines.length > 0 && (
|
|
5618
|
+
React.createElement("br", null),
|
|
5619
|
+
props.delta.original.lines.length > 0 && (React.createElement("div", { className: classes.removed }, props.delta.original.lines.join('\n'))),
|
|
5620
|
+
props.delta.revised.lines.length > 0 && (React.createElement("div", { className: classes.added }, props.delta.revised.lines.join('\n'))),
|
|
5116
5621
|
"...",
|
|
5117
|
-
|
|
5622
|
+
React.createElement("br", null)));
|
|
5118
5623
|
}
|
|
5119
5624
|
|
|
5120
5625
|
function ResourceHistoryTable(props) {
|
|
@@ -5130,30 +5635,30 @@
|
|
|
5130
5635
|
}
|
|
5131
5636
|
}, [medplum, props.history, props.resourceType, props.id]);
|
|
5132
5637
|
if (!value) {
|
|
5133
|
-
return
|
|
5638
|
+
return React.createElement("div", null, "Loading...");
|
|
5134
5639
|
}
|
|
5135
|
-
return (
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5640
|
+
return (React.createElement(core$1.Table, { withBorder: true, withColumnBorders: true },
|
|
5641
|
+
React.createElement("thead", null,
|
|
5642
|
+
React.createElement("tr", null,
|
|
5643
|
+
React.createElement("th", null, "Author"),
|
|
5644
|
+
React.createElement("th", null, "Date"),
|
|
5645
|
+
React.createElement("th", null, "Version"))),
|
|
5646
|
+
React.createElement("tbody", null, (_a = value.entry) === null || _a === void 0 ? void 0 : _a.map((entry, index) => (React.createElement(HistoryRow, { key: 'entry-' + index, entry: entry }))))));
|
|
5142
5647
|
}
|
|
5143
5648
|
function HistoryRow(props) {
|
|
5144
5649
|
var _a, _b, _c;
|
|
5145
5650
|
const { response, resource } = props.entry;
|
|
5146
5651
|
if (resource) {
|
|
5147
|
-
return (
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5652
|
+
return (React.createElement("tr", null,
|
|
5653
|
+
React.createElement("td", null,
|
|
5654
|
+
React.createElement(ResourceBadge, { value: (_a = resource.meta) === null || _a === void 0 ? void 0 : _a.author, link: true })),
|
|
5655
|
+
React.createElement("td", null, core.formatDateTime((_b = resource.meta) === null || _b === void 0 ? void 0 : _b.lastUpdated)),
|
|
5656
|
+
React.createElement("td", null,
|
|
5657
|
+
React.createElement(MedplumLink, { to: getVersionUrl(resource) }, (_c = resource.meta) === null || _c === void 0 ? void 0 : _c.versionId))));
|
|
5153
5658
|
}
|
|
5154
5659
|
else {
|
|
5155
|
-
return (
|
|
5156
|
-
|
|
5660
|
+
return (React.createElement("tr", null,
|
|
5661
|
+
React.createElement("td", { colSpan: 3 }, core.normalizeErrorString(response === null || response === void 0 ? void 0 : response.outcome))));
|
|
5157
5662
|
}
|
|
5158
5663
|
}
|
|
5159
5664
|
function getVersionUrl(resource) {
|
|
@@ -5161,6 +5666,42 @@
|
|
|
5161
5666
|
return `/${resource.resourceType}/${resource.id}/_history/${(_a = resource.meta) === null || _a === void 0 ? void 0 : _a.versionId}`;
|
|
5162
5667
|
}
|
|
5163
5668
|
|
|
5669
|
+
const useStyles$1 = core$1.createStyles((theme) => ({
|
|
5670
|
+
table: {
|
|
5671
|
+
width: 350,
|
|
5672
|
+
'& th': {
|
|
5673
|
+
fontWeight: 'normal',
|
|
5674
|
+
fontSize: 11,
|
|
5675
|
+
padding: 8,
|
|
5676
|
+
textAlign: 'center',
|
|
5677
|
+
},
|
|
5678
|
+
'& td': {
|
|
5679
|
+
padding: '2px 4px',
|
|
5680
|
+
},
|
|
5681
|
+
'& td button': {
|
|
5682
|
+
width: 44,
|
|
5683
|
+
height: 44,
|
|
5684
|
+
color: theme.colors[theme.primaryColor][5],
|
|
5685
|
+
fontSize: 16,
|
|
5686
|
+
fontWeight: 500,
|
|
5687
|
+
textAlign: 'center',
|
|
5688
|
+
padding: 0,
|
|
5689
|
+
backgroundColor: theme.colors[theme.primaryColor][0],
|
|
5690
|
+
border: 0,
|
|
5691
|
+
borderRadius: '50%',
|
|
5692
|
+
cursor: 'pointer',
|
|
5693
|
+
},
|
|
5694
|
+
'& td button:hover': {
|
|
5695
|
+
backgroundColor: theme.colors[theme.primaryColor][1],
|
|
5696
|
+
},
|
|
5697
|
+
'& td button:disabled': {
|
|
5698
|
+
backgroundColor: 'transparent',
|
|
5699
|
+
cursor: 'default',
|
|
5700
|
+
color: theme.colors.gray[4],
|
|
5701
|
+
fontWeight: 'normal',
|
|
5702
|
+
},
|
|
5703
|
+
},
|
|
5704
|
+
}));
|
|
5164
5705
|
/**
|
|
5165
5706
|
* Returns a month display string (e.g. "January 2020").
|
|
5166
5707
|
* @param date Any date within the month.
|
|
@@ -5170,6 +5711,7 @@
|
|
|
5170
5711
|
return date.toLocaleString('default', { month: 'long' }) + ' ' + date.getFullYear();
|
|
5171
5712
|
}
|
|
5172
5713
|
function CalendarInput(props) {
|
|
5714
|
+
const { classes } = useStyles$1();
|
|
5173
5715
|
const { onChangeMonth, onClick } = props;
|
|
5174
5716
|
const [month, setMonth] = React.useState(getStartMonth);
|
|
5175
5717
|
function moveMonth(delta) {
|
|
@@ -5181,23 +5723,23 @@
|
|
|
5181
5723
|
});
|
|
5182
5724
|
}
|
|
5183
5725
|
const grid = React.useMemo(() => buildGrid(month, props.slots), [month, props.slots]);
|
|
5184
|
-
return (
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5726
|
+
return (React.createElement("div", null,
|
|
5727
|
+
React.createElement(core$1.Group, { position: "apart", spacing: "xs", grow: true, noWrap: true },
|
|
5728
|
+
React.createElement("p", { style: { flex: 1 } }, getMonthString(month)),
|
|
5729
|
+
React.createElement(core$1.Group, { position: "right", spacing: "xs" },
|
|
5730
|
+
React.createElement(core$1.Button, { variant: "outline", "aria-label": "Previous month", onClick: () => moveMonth(-1) }, "<"),
|
|
5731
|
+
React.createElement(core$1.Button, { variant: "outline", "aria-label": "Next month", onClick: () => moveMonth(1) }, ">"))),
|
|
5732
|
+
React.createElement("table", { className: classes.table },
|
|
5733
|
+
React.createElement("thead", null,
|
|
5734
|
+
React.createElement("tr", null,
|
|
5735
|
+
React.createElement("th", null, "SUN"),
|
|
5736
|
+
React.createElement("th", null, "MON"),
|
|
5737
|
+
React.createElement("th", null, "TUE"),
|
|
5738
|
+
React.createElement("th", null, "WED"),
|
|
5739
|
+
React.createElement("th", null, "THU"),
|
|
5740
|
+
React.createElement("th", null, "FRI"),
|
|
5741
|
+
React.createElement("th", null, "SAT"))),
|
|
5742
|
+
React.createElement("tbody", null, grid.map((week, weekIndex) => (React.createElement("tr", { key: 'week-' + weekIndex }, week.map((day, dayIndex) => (React.createElement("td", { key: 'day-' + dayIndex }, day && (React.createElement(core$1.Button, { disabled: !day.available, onClick: () => onClick(day.date) }, day.date.getDate()))))))))))));
|
|
5201
5743
|
}
|
|
5202
5744
|
function getStartMonth() {
|
|
5203
5745
|
const result = new Date();
|
|
@@ -5252,8 +5794,24 @@
|
|
|
5252
5794
|
return false;
|
|
5253
5795
|
}
|
|
5254
5796
|
|
|
5797
|
+
const useStyles = core$1.createStyles((theme) => ({
|
|
5798
|
+
container: {
|
|
5799
|
+
display: 'flex',
|
|
5800
|
+
minHeight: 400,
|
|
5801
|
+
},
|
|
5802
|
+
info: {
|
|
5803
|
+
minWidth: 300,
|
|
5804
|
+
padding: 20,
|
|
5805
|
+
borderRight: `1px solid ${theme.colors.gray[3]}`,
|
|
5806
|
+
},
|
|
5807
|
+
selection: {
|
|
5808
|
+
minWidth: 300,
|
|
5809
|
+
padding: 20,
|
|
5810
|
+
},
|
|
5811
|
+
}));
|
|
5255
5812
|
function Scheduler(props) {
|
|
5256
5813
|
var _a;
|
|
5814
|
+
const { classes } = useStyles();
|
|
5257
5815
|
const medplum = useMedplum();
|
|
5258
5816
|
const schedule = useResource(props.schedule);
|
|
5259
5817
|
const questionnaire = useResource(props.questionnaire);
|
|
@@ -5285,30 +5843,30 @@
|
|
|
5285
5843
|
return null;
|
|
5286
5844
|
}
|
|
5287
5845
|
const actor = (_a = schedule.actor) === null || _a === void 0 ? void 0 : _a[0];
|
|
5288
|
-
return (
|
|
5289
|
-
|
|
5290
|
-
actor &&
|
|
5291
|
-
actor && (
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
date &&
|
|
5295
|
-
slot &&
|
|
5296
|
-
|
|
5297
|
-
!date && (
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
date && !slot && (
|
|
5301
|
-
|
|
5302
|
-
|
|
5846
|
+
return (React.createElement("div", { className: classes.container, "data-testid": "scheduler" },
|
|
5847
|
+
React.createElement("div", { className: classes.info },
|
|
5848
|
+
actor && React.createElement(ResourceAvatar, { value: actor, size: "xl" }),
|
|
5849
|
+
actor && (React.createElement(core$1.Text, { size: "xl", weight: 500 },
|
|
5850
|
+
React.createElement(ResourceName, { value: actor }))),
|
|
5851
|
+
React.createElement("p", null, "1 hour"),
|
|
5852
|
+
date && React.createElement("p", null, date.toLocaleDateString()),
|
|
5853
|
+
slot && React.createElement("p", null, formatTime(new Date(slot.start)))),
|
|
5854
|
+
React.createElement("div", { className: classes.selection },
|
|
5855
|
+
!date && (React.createElement("div", null,
|
|
5856
|
+
React.createElement("h3", null, "Select date"),
|
|
5857
|
+
React.createElement(CalendarInput, { slots: slots, onChangeMonth: setMonth, onClick: setDate }))),
|
|
5858
|
+
date && !slot && (React.createElement("div", null,
|
|
5859
|
+
React.createElement("h3", null, "Select time"),
|
|
5860
|
+
React.createElement(core$1.Stack, null, slots.map((s) => {
|
|
5303
5861
|
const slotStart = new Date(s.start);
|
|
5304
5862
|
return (slotStart.getTime() > date.getTime() &&
|
|
5305
|
-
slotStart.getTime() < date.getTime() + 24 * 3600 * 1000 && (
|
|
5306
|
-
|
|
5863
|
+
slotStart.getTime() < date.getTime() + 24 * 3600 * 1000 && (React.createElement("div", { key: s.id },
|
|
5864
|
+
React.createElement(core$1.Button, { variant: "outline", style: { width: 150 }, onClick: () => setSlot(s) }, formatTime(slotStart)))));
|
|
5307
5865
|
})))),
|
|
5308
|
-
date && slot && !response && (
|
|
5309
|
-
date && slot && response && (
|
|
5310
|
-
|
|
5311
|
-
|
|
5866
|
+
date && slot && !response && (React.createElement(QuestionnaireForm, { questionnaire: questionnaire, submitButtonText: 'Next', onSubmit: setResponse })),
|
|
5867
|
+
date && slot && response && (React.createElement("div", null,
|
|
5868
|
+
React.createElement("h3", null, "You're all set!"),
|
|
5869
|
+
React.createElement("p", null, "Check your email for a calendar invite."))))));
|
|
5312
5870
|
}
|
|
5313
5871
|
function getStart(month) {
|
|
5314
5872
|
return formatSlotInstant(month.getTime());
|
|
@@ -5324,7 +5882,7 @@
|
|
|
5324
5882
|
}
|
|
5325
5883
|
|
|
5326
5884
|
function ServiceRequestTimeline(props) {
|
|
5327
|
-
return (
|
|
5885
|
+
return (React.createElement(ResourceTimeline, { value: props.serviceRequest, buildSearchRequests: (resource) => ({
|
|
5328
5886
|
resourceType: 'Bundle',
|
|
5329
5887
|
type: 'batch',
|
|
5330
5888
|
entry: [
|
|
@@ -5417,6 +5975,8 @@
|
|
|
5417
5975
|
exports.RangeDisplay = RangeDisplay;
|
|
5418
5976
|
exports.RangeInput = RangeInput;
|
|
5419
5977
|
exports.ReferenceInput = ReferenceInput;
|
|
5978
|
+
exports.ReferenceRangeEditor = ReferenceRangeEditor;
|
|
5979
|
+
exports.ReferenceRangeGroupEditor = ReferenceRangeGroupEditor;
|
|
5420
5980
|
exports.RegisterForm = RegisterForm;
|
|
5421
5981
|
exports.RequestGroupDisplay = RequestGroupDisplay;
|
|
5422
5982
|
exports.ResourceArrayDisplay = ResourceArrayDisplay;
|
|
@@ -5445,8 +6005,6 @@
|
|
|
5445
6005
|
exports.StatusBadge = StatusBadge;
|
|
5446
6006
|
exports.Timeline = Timeline;
|
|
5447
6007
|
exports.TimelineItem = TimelineItem;
|
|
5448
|
-
exports.addDateEqualsFilter = addDateEqualsFilter;
|
|
5449
|
-
exports.addDateFilter = addDateFilter;
|
|
5450
6008
|
exports.addDateFilterBetween = addDateFilterBetween;
|
|
5451
6009
|
exports.addField = addField;
|
|
5452
6010
|
exports.addFilter = addFilter;
|
|
@@ -5465,7 +6023,6 @@
|
|
|
5465
6023
|
exports.convertLocalToIso = convertLocalToIso;
|
|
5466
6024
|
exports.createScriptTag = createScriptTag;
|
|
5467
6025
|
exports.deleteFilter = deleteFilter;
|
|
5468
|
-
exports.formatRangeString = formatRangeString;
|
|
5469
6026
|
exports.getErrorsForInput = getErrorsForInput;
|
|
5470
6027
|
exports.getIssuesForExpression = getIssuesForExpression;
|
|
5471
6028
|
exports.getOpString = getOpString;
|
|
@@ -5474,7 +6031,6 @@
|
|
|
5474
6031
|
exports.getSortField = getSortField;
|
|
5475
6032
|
exports.getTimeString = getTimeString;
|
|
5476
6033
|
exports.getValueAndType = getValueAndType;
|
|
5477
|
-
exports.hasFilterOnField = hasFilterOnField;
|
|
5478
6034
|
exports.initRecaptcha = initRecaptcha;
|
|
5479
6035
|
exports.isChoiceQuestion = isChoiceQuestion;
|
|
5480
6036
|
exports.isQuestionEnabled = isQuestionEnabled;
|
|
@@ -5493,7 +6049,5 @@
|
|
|
5493
6049
|
exports.useMedplumProfile = useMedplumProfile;
|
|
5494
6050
|
exports.useResource = useResource;
|
|
5495
6051
|
|
|
5496
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5497
|
-
|
|
5498
6052
|
}));
|
|
5499
6053
|
//# sourceMappingURL=index.js.map
|