@medplum/react 1.0.5 → 2.0.0
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/README.md +2 -1
- package/dist/cjs/MoneyDisplay/MoneyDisplay.d.ts +6 -0
- package/dist/cjs/MoneyInput/MoneyInput.d.ts +10 -0
- package/dist/cjs/MoneyInput/MoneyInput.stories.d.ts +6 -0
- package/dist/cjs/OperationOutcomeAlert/OperationOutcomeAlert.d.ts +6 -0
- package/dist/cjs/auth/AuthenticationForm.d.ts +15 -1
- package/dist/cjs/auth/SignInForm.d.ts +1 -0
- package/dist/cjs/{index.js → index.cjs} +675 -549
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.min.cjs +1 -0
- package/dist/esm/AddressDisplay/{AddressDisplay.js → AddressDisplay.mjs} +1 -1
- package/dist/esm/AddressDisplay/AddressDisplay.mjs.map +1 -0
- package/dist/esm/AddressInput/{AddressInput.js → AddressInput.mjs} +9 -9
- package/dist/esm/AddressInput/AddressInput.mjs.map +1 -0
- package/dist/esm/AnnotationInput/{AnnotationInput.js → AnnotationInput.mjs} +2 -2
- package/dist/esm/AnnotationInput/AnnotationInput.mjs.map +1 -0
- package/dist/esm/AsyncAutocomplete/{AsyncAutocomplete.js → AsyncAutocomplete.mjs} +7 -10
- package/dist/esm/AsyncAutocomplete/AsyncAutocomplete.mjs.map +1 -0
- package/dist/esm/AttachmentArrayDisplay/{AttachmentArrayDisplay.js → AttachmentArrayDisplay.mjs} +2 -2
- package/dist/esm/AttachmentArrayDisplay/AttachmentArrayDisplay.mjs.map +1 -0
- package/dist/esm/AttachmentArrayInput/{AttachmentArrayInput.js → AttachmentArrayInput.mjs} +6 -7
- package/dist/esm/AttachmentArrayInput/AttachmentArrayInput.mjs.map +1 -0
- package/dist/esm/AttachmentButton/{AttachmentButton.js → AttachmentButton.mjs} +5 -7
- package/dist/esm/AttachmentButton/AttachmentButton.mjs.map +1 -0
- package/dist/esm/AttachmentDisplay/AttachmentDisplay.mjs +21 -0
- package/dist/esm/AttachmentDisplay/AttachmentDisplay.mjs.map +1 -0
- package/dist/esm/AttachmentInput/{AttachmentInput.js → AttachmentInput.mjs} +5 -5
- package/dist/esm/AttachmentInput/AttachmentInput.mjs.map +1 -0
- package/dist/esm/BackboneElementDisplay/{BackboneElementDisplay.js → BackboneElementDisplay.mjs} +4 -4
- package/dist/esm/BackboneElementDisplay/BackboneElementDisplay.mjs.map +1 -0
- package/dist/esm/BackboneElementInput/{BackboneElementInput.js → BackboneElementInput.mjs} +10 -11
- package/dist/esm/BackboneElementInput/BackboneElementInput.mjs.map +1 -0
- package/dist/esm/CalendarInput/{CalendarInput.js → CalendarInput.mjs} +1 -1
- package/dist/esm/CalendarInput/CalendarInput.mjs.map +1 -0
- package/dist/esm/CheckboxFormSection/{CheckboxFormSection.js → CheckboxFormSection.mjs} +1 -1
- package/dist/esm/CheckboxFormSection/CheckboxFormSection.mjs.map +1 -0
- package/dist/esm/CodeInput/{CodeInput.js → CodeInput.mjs} +3 -3
- package/dist/esm/CodeInput/CodeInput.mjs.map +1 -0
- package/dist/esm/CodeableConceptDisplay/{CodeableConceptDisplay.js → CodeableConceptDisplay.mjs} +1 -1
- package/dist/esm/CodeableConceptDisplay/CodeableConceptDisplay.mjs.map +1 -0
- package/dist/esm/CodeableConceptInput/{CodeableConceptInput.js → CodeableConceptInput.mjs} +3 -4
- package/dist/esm/CodeableConceptInput/CodeableConceptInput.mjs.map +1 -0
- package/dist/esm/CodingDisplay/{CodingDisplay.js → CodingDisplay.mjs} +1 -1
- package/dist/esm/CodingDisplay/CodingDisplay.mjs.map +1 -0
- package/dist/esm/CodingInput/{CodingInput.js → CodingInput.mjs} +2 -2
- package/dist/esm/CodingInput/CodingInput.mjs.map +1 -0
- package/dist/esm/ContactDetailDisplay/{ContactDetailDisplay.js → ContactDetailDisplay.mjs} +4 -5
- package/dist/esm/ContactDetailDisplay/ContactDetailDisplay.mjs.map +1 -0
- package/dist/esm/ContactDetailInput/{ContactDetailInput.js → ContactDetailInput.mjs} +6 -7
- package/dist/esm/ContactDetailInput/ContactDetailInput.mjs.map +1 -0
- package/dist/esm/ContactPointDisplay/{ContactPointDisplay.js → ContactPointDisplay.mjs} +1 -1
- package/dist/esm/ContactPointDisplay/ContactPointDisplay.mjs.map +1 -0
- package/dist/esm/ContactPointInput/{ContactPointInput.js → ContactPointInput.mjs} +7 -7
- package/dist/esm/ContactPointInput/ContactPointInput.mjs.map +1 -0
- package/dist/esm/Container/{Container.js → Container.mjs} +3 -4
- package/dist/esm/Container/Container.mjs.map +1 -0
- package/dist/esm/DateTimeInput/{DateTimeInput.js → DateTimeInput.mjs} +2 -2
- package/dist/esm/DateTimeInput/DateTimeInput.mjs.map +1 -0
- package/dist/esm/DefaultResourceTimeline/{DefaultResourceTimeline.js → DefaultResourceTimeline.mjs} +2 -2
- package/dist/esm/DefaultResourceTimeline/DefaultResourceTimeline.mjs.map +1 -0
- package/dist/esm/DescriptionList/{DescriptionList.js → DescriptionList.mjs} +1 -1
- package/dist/esm/DescriptionList/DescriptionList.mjs.map +1 -0
- package/dist/esm/DiagnosticReportDisplay/{DiagnosticReportDisplay.js → DiagnosticReportDisplay.mjs} +13 -16
- package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.mjs.map +1 -0
- package/dist/esm/Document/Document.mjs +12 -0
- package/dist/esm/Document/Document.mjs.map +1 -0
- package/dist/esm/EncounterTimeline/{EncounterTimeline.js → EncounterTimeline.mjs} +2 -2
- package/dist/esm/EncounterTimeline/EncounterTimeline.mjs.map +1 -0
- package/dist/esm/ErrorBoundary/{ErrorBoundary.js → ErrorBoundary.mjs} +1 -1
- package/dist/esm/ErrorBoundary/ErrorBoundary.mjs.map +1 -0
- package/dist/esm/ExtensionInput/{ExtensionInput.js → ExtensionInput.mjs} +1 -1
- package/dist/esm/ExtensionInput/ExtensionInput.mjs.map +1 -0
- package/dist/esm/FhirPathDisplay/{FhirPathDisplay.js → FhirPathDisplay.mjs} +2 -2
- package/dist/esm/FhirPathDisplay/FhirPathDisplay.mjs.map +1 -0
- package/dist/esm/FhirPathTable/{FhirPathTable.js → FhirPathTable.mjs} +14 -17
- package/dist/esm/FhirPathTable/FhirPathTable.mjs.map +1 -0
- package/dist/esm/Form/{Form.js → Form.mjs} +2 -2
- package/dist/esm/Form/Form.mjs.map +1 -0
- package/dist/esm/Form/{FormUtils.js → FormUtils.mjs} +1 -1
- package/dist/esm/Form/FormUtils.mjs.map +1 -0
- package/dist/esm/FormSection/{FormSection.js → FormSection.mjs} +2 -2
- package/dist/esm/FormSection/FormSection.mjs.map +1 -0
- package/dist/esm/GoogleButton/{GoogleButton.js → GoogleButton.mjs} +4 -5
- package/dist/esm/GoogleButton/GoogleButton.mjs.map +1 -0
- package/dist/esm/HumanNameDisplay/{HumanNameDisplay.js → HumanNameDisplay.mjs} +1 -1
- package/dist/esm/HumanNameDisplay/HumanNameDisplay.mjs.map +1 -0
- package/dist/esm/HumanNameInput/HumanNameInput.mjs +50 -0
- package/dist/esm/HumanNameInput/HumanNameInput.mjs.map +1 -0
- package/dist/esm/IdentifierDisplay/IdentifierDisplay.mjs +11 -0
- package/dist/esm/IdentifierDisplay/IdentifierDisplay.mjs.map +1 -0
- package/dist/esm/IdentifierInput/{IdentifierInput.js → IdentifierInput.mjs} +3 -3
- package/dist/esm/IdentifierInput/IdentifierInput.mjs.map +1 -0
- package/dist/esm/Logo/{Logo.js → Logo.mjs} +1 -1
- package/dist/esm/Logo/Logo.mjs.map +1 -0
- package/dist/esm/MedplumLink/{MedplumLink.js → MedplumLink.mjs} +5 -6
- package/dist/esm/MedplumLink/MedplumLink.mjs.map +1 -0
- package/dist/esm/MedplumProvider/{MedplumProvider.js → MedplumProvider.mjs} +9 -3
- package/dist/esm/MedplumProvider/MedplumProvider.mjs.map +1 -0
- package/dist/esm/MoneyDisplay/MoneyDisplay.d.ts +6 -0
- package/dist/esm/MoneyDisplay/MoneyDisplay.mjs +9 -0
- package/dist/esm/MoneyDisplay/MoneyDisplay.mjs.map +1 -0
- package/dist/esm/MoneyInput/MoneyInput.d.ts +10 -0
- package/dist/esm/MoneyInput/MoneyInput.mjs +53 -0
- package/dist/esm/MoneyInput/MoneyInput.mjs.map +1 -0
- package/dist/esm/MoneyInput/MoneyInput.stories.d.ts +6 -0
- package/dist/esm/OperationOutcomeAlert/OperationOutcomeAlert.d.ts +6 -0
- package/dist/esm/OperationOutcomeAlert/OperationOutcomeAlert.mjs +13 -0
- package/dist/esm/OperationOutcomeAlert/OperationOutcomeAlert.mjs.map +1 -0
- package/dist/esm/Panel/{Panel.js → Panel.mjs} +3 -4
- package/dist/esm/Panel/Panel.mjs.map +1 -0
- package/dist/esm/PatientTimeline/{PatientTimeline.js → PatientTimeline.mjs} +2 -2
- package/dist/esm/PatientTimeline/PatientTimeline.mjs.map +1 -0
- package/dist/esm/PeriodInput/{PeriodInput.js → PeriodInput.mjs} +4 -4
- package/dist/esm/PeriodInput/PeriodInput.mjs.map +1 -0
- package/dist/esm/PlanDefinitionBuilder/{PlanDefinitionBuilder.js → PlanDefinitionBuilder.mjs} +36 -24
- package/dist/esm/PlanDefinitionBuilder/PlanDefinitionBuilder.mjs.map +1 -0
- package/dist/esm/QuantityDisplay/{QuantityDisplay.js → QuantityDisplay.mjs} +1 -1
- package/dist/esm/QuantityDisplay/QuantityDisplay.mjs.map +1 -0
- package/dist/esm/QuantityInput/{QuantityInput.js → QuantityInput.mjs} +13 -5
- package/dist/esm/QuantityInput/QuantityInput.mjs.map +1 -0
- package/dist/esm/QuestionnaireBuilder/{QuestionnaireBuilder.js → QuestionnaireBuilder.mjs} +45 -27
- package/dist/esm/QuestionnaireBuilder/QuestionnaireBuilder.mjs.map +1 -0
- package/dist/esm/QuestionnaireForm/{QuestionnaireForm.js → QuestionnaireForm.mjs} +36 -36
- package/dist/esm/QuestionnaireForm/QuestionnaireForm.mjs.map +1 -0
- package/dist/esm/RangeDisplay/{RangeDisplay.js → RangeDisplay.mjs} +1 -1
- package/dist/esm/RangeDisplay/RangeDisplay.mjs.map +1 -0
- package/dist/esm/RangeInput/{RangeInput.js → RangeInput.mjs} +10 -4
- package/dist/esm/RangeInput/RangeInput.mjs.map +1 -0
- package/dist/esm/RatioDisplay/{RatioDisplay.js → RatioDisplay.mjs} +2 -2
- package/dist/esm/RatioDisplay/RatioDisplay.mjs.map +1 -0
- package/dist/esm/RatioInput/{RatioInput.js → RatioInput.mjs} +10 -4
- package/dist/esm/RatioInput/RatioInput.mjs.map +1 -0
- package/dist/esm/ReferenceDisplay/{ReferenceDisplay.js → ReferenceDisplay.mjs} +2 -2
- package/dist/esm/ReferenceDisplay/ReferenceDisplay.mjs.map +1 -0
- package/dist/esm/ReferenceInput/{ReferenceInput.js → ReferenceInput.mjs} +10 -5
- package/dist/esm/ReferenceInput/ReferenceInput.mjs.map +1 -0
- package/dist/esm/ReferenceRangeEditor/{ReferenceRangeEditor.js → ReferenceRangeEditor.mjs} +44 -38
- package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.mjs.map +1 -0
- package/dist/esm/RequestGroupDisplay/{RequestGroupDisplay.js → RequestGroupDisplay.mjs} +14 -17
- package/dist/esm/RequestGroupDisplay/RequestGroupDisplay.mjs.map +1 -0
- package/dist/esm/ResourceArrayDisplay/{ResourceArrayDisplay.js → ResourceArrayDisplay.mjs} +4 -5
- package/dist/esm/ResourceArrayDisplay/ResourceArrayDisplay.mjs.map +1 -0
- package/dist/esm/ResourceArrayInput/{ResourceArrayInput.js → ResourceArrayInput.mjs} +3 -3
- package/dist/esm/ResourceArrayInput/ResourceArrayInput.mjs.map +1 -0
- package/dist/esm/ResourceAvatar/ResourceAvatar.mjs +23 -0
- package/dist/esm/ResourceAvatar/ResourceAvatar.mjs.map +1 -0
- package/dist/esm/ResourceBadge/{ResourceBadge.js → ResourceBadge.mjs} +3 -3
- package/dist/esm/ResourceBadge/ResourceBadge.mjs.map +1 -0
- package/dist/esm/ResourceBlame/{ResourceBlame.js → ResourceBlame.mjs} +6 -7
- package/dist/esm/ResourceBlame/ResourceBlame.mjs.map +1 -0
- package/dist/esm/ResourceDiff/{ResourceDiff.js → ResourceDiff.mjs} +4 -4
- package/dist/esm/ResourceDiff/ResourceDiff.mjs.map +1 -0
- package/dist/esm/ResourceDiffTable/{ResourceDiffTable.js → ResourceDiffTable.mjs} +3 -3
- package/dist/esm/ResourceDiffTable/ResourceDiffTable.mjs.map +1 -0
- package/dist/esm/ResourceForm/{ResourceForm.js → ResourceForm.mjs} +5 -5
- package/dist/esm/ResourceForm/ResourceForm.mjs.map +1 -0
- package/dist/esm/ResourceHistoryTable/{ResourceHistoryTable.js → ResourceHistoryTable.mjs} +10 -13
- package/dist/esm/ResourceHistoryTable/ResourceHistoryTable.mjs.map +1 -0
- package/dist/esm/ResourceInput/{ResourceInput.js → ResourceInput.mjs} +18 -24
- package/dist/esm/ResourceInput/ResourceInput.mjs.map +1 -0
- package/dist/esm/ResourceName/ResourceName.mjs +18 -0
- package/dist/esm/ResourceName/ResourceName.mjs.map +1 -0
- package/dist/esm/ResourcePropertyDisplay/{ResourcePropertyDisplay.js → ResourcePropertyDisplay.mjs} +23 -21
- package/dist/esm/ResourcePropertyDisplay/ResourcePropertyDisplay.mjs.map +1 -0
- package/dist/esm/ResourcePropertyInput/{ResourcePropertyInput.js → ResourcePropertyInput.mjs} +34 -34
- package/dist/esm/ResourcePropertyInput/ResourcePropertyInput.mjs.map +1 -0
- package/dist/esm/ResourceTable/{ResourceTable.js → ResourceTable.mjs} +4 -4
- package/dist/esm/ResourceTable/ResourceTable.mjs.map +1 -0
- package/dist/esm/ResourceTimeline/{ResourceTimeline.js → ResourceTimeline.mjs} +26 -30
- package/dist/esm/ResourceTimeline/ResourceTimeline.mjs.map +1 -0
- package/dist/esm/Scheduler/{Scheduler.js → Scheduler.mjs} +8 -9
- package/dist/esm/Scheduler/Scheduler.mjs.map +1 -0
- package/dist/esm/SearchControl/{SearchControl.js → SearchControl.mjs} +66 -50
- package/dist/esm/SearchControl/SearchControl.mjs.map +1 -0
- package/dist/esm/SearchControl/{SearchControlField.js → SearchControlField.mjs} +3 -4
- package/dist/esm/SearchControl/SearchControlField.mjs.map +1 -0
- package/dist/esm/SearchControl/{SearchUtils.js → SearchUtils.mjs} +34 -17
- package/dist/esm/SearchControl/SearchUtils.mjs.map +1 -0
- package/dist/esm/SearchFieldEditor/{SearchFieldEditor.js → SearchFieldEditor.mjs} +28 -21
- package/dist/esm/SearchFieldEditor/SearchFieldEditor.mjs.map +1 -0
- package/dist/esm/SearchFilterEditor/{SearchFilterEditor.js → SearchFilterEditor.mjs} +8 -9
- package/dist/esm/SearchFilterEditor/SearchFilterEditor.mjs.map +1 -0
- package/dist/esm/SearchFilterValueDialog/{SearchFilterValueDialog.js → SearchFilterValueDialog.mjs} +5 -6
- package/dist/esm/SearchFilterValueDialog/SearchFilterValueDialog.mjs.map +1 -0
- package/dist/esm/SearchFilterValueDisplay/{SearchFilterValueDisplay.js → SearchFilterValueDisplay.mjs} +3 -4
- package/dist/esm/SearchFilterValueDisplay/SearchFilterValueDisplay.mjs.map +1 -0
- package/dist/esm/SearchFilterValueInput/{SearchFilterValueInput.js → SearchFilterValueInput.mjs} +5 -6
- package/dist/esm/SearchFilterValueInput/SearchFilterValueInput.mjs.map +1 -0
- package/dist/esm/SearchPopupMenu/{SearchPopupMenu.js → SearchPopupMenu.mjs} +10 -10
- package/dist/esm/SearchPopupMenu/SearchPopupMenu.mjs.map +1 -0
- package/dist/esm/ServiceRequestTimeline/{ServiceRequestTimeline.js → ServiceRequestTimeline.mjs} +2 -2
- package/dist/esm/ServiceRequestTimeline/ServiceRequestTimeline.mjs.map +1 -0
- package/dist/esm/StatusBadge/{StatusBadge.js → StatusBadge.mjs} +1 -1
- package/dist/esm/StatusBadge/StatusBadge.mjs.map +1 -0
- package/dist/esm/Timeline/{Timeline.js → Timeline.mjs} +11 -13
- package/dist/esm/Timeline/Timeline.mjs.map +1 -0
- package/dist/esm/TimingInput/{TimingInput.js → TimingInput.mjs} +13 -18
- package/dist/esm/TimingInput/TimingInput.mjs.map +1 -0
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.mjs +43 -0
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.mjs.map +1 -0
- package/dist/esm/auth/AuthenticationForm.d.ts +15 -1
- package/dist/esm/auth/AuthenticationForm.mjs +88 -0
- package/dist/esm/auth/AuthenticationForm.mjs.map +1 -0
- package/dist/esm/auth/ChooseProfileForm.mjs +29 -0
- package/dist/esm/auth/ChooseProfileForm.mjs.map +1 -0
- package/dist/esm/auth/{ChooseScopeForm.js → ChooseScopeForm.mjs} +4 -4
- package/dist/esm/auth/ChooseScopeForm.mjs.map +1 -0
- package/dist/esm/auth/{MfaForm.js → MfaForm.mjs} +4 -4
- package/dist/esm/auth/MfaForm.mjs.map +1 -0
- package/dist/esm/auth/{NewProjectForm.js → NewProjectForm.mjs} +8 -9
- package/dist/esm/auth/NewProjectForm.mjs.map +1 -0
- package/dist/esm/auth/{NewUserForm.js → NewUserForm.mjs} +16 -21
- package/dist/esm/auth/NewUserForm.mjs.map +1 -0
- package/dist/esm/auth/{RegisterForm.js → RegisterForm.mjs} +5 -5
- package/dist/esm/auth/RegisterForm.mjs.map +1 -0
- package/dist/esm/auth/SignInForm.d.ts +1 -0
- package/dist/esm/auth/{SignInForm.js → SignInForm.mjs} +36 -29
- package/dist/esm/auth/SignInForm.mjs.map +1 -0
- package/dist/esm/{constants.js → constants.mjs} +1 -1
- package/dist/esm/constants.mjs.map +1 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.min.mjs +1 -0
- package/dist/esm/{index.js → index.mjs} +88 -86
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/useResource/{useResource.js → useResource.mjs} +2 -2
- package/dist/esm/useResource/useResource.mjs.map +1 -0
- package/dist/esm/utils/{blame.js → blame.mjs} +6 -9
- package/dist/esm/utils/blame.mjs.map +1 -0
- package/dist/esm/utils/{date.js → date.mjs} +2 -3
- package/dist/esm/utils/date.mjs.map +1 -0
- package/dist/esm/utils/{diff.js → diff.mjs} +1 -1
- package/dist/esm/utils/diff.mjs.map +1 -0
- package/dist/esm/utils/{dom.js → dom.mjs} +1 -1
- package/dist/esm/utils/dom.mjs.map +1 -0
- package/dist/esm/utils/outcomes.mjs +30 -0
- package/dist/esm/utils/outcomes.mjs.map +1 -0
- package/dist/esm/utils/{questionnaire.js → questionnaire.mjs} +1 -1
- package/dist/esm/utils/questionnaire.mjs.map +1 -0
- package/dist/esm/utils/{recaptcha.js → recaptcha.mjs} +5 -6
- package/dist/esm/utils/recaptcha.mjs.map +1 -0
- package/dist/esm/utils/{script.js → script.mjs} +1 -1
- package/dist/esm/utils/script.mjs.map +1 -0
- package/package.json +22 -22
- package/rollup.config.mjs +6 -7
- package/dist/cjs/auth/OktaButton.d.ts +0 -5
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/index.min.js +0 -2
- package/dist/cjs/index.min.js.map +0 -1
- package/dist/esm/AddressDisplay/AddressDisplay.js.map +0 -1
- package/dist/esm/AddressInput/AddressInput.js.map +0 -1
- package/dist/esm/AnnotationInput/AnnotationInput.js.map +0 -1
- package/dist/esm/AsyncAutocomplete/AsyncAutocomplete.js.map +0 -1
- package/dist/esm/AttachmentArrayDisplay/AttachmentArrayDisplay.js.map +0 -1
- package/dist/esm/AttachmentArrayInput/AttachmentArrayInput.js.map +0 -1
- package/dist/esm/AttachmentButton/AttachmentButton.js.map +0 -1
- package/dist/esm/AttachmentDisplay/AttachmentDisplay.js +0 -21
- package/dist/esm/AttachmentDisplay/AttachmentDisplay.js.map +0 -1
- package/dist/esm/AttachmentInput/AttachmentInput.js.map +0 -1
- package/dist/esm/BackboneElementDisplay/BackboneElementDisplay.js.map +0 -1
- package/dist/esm/BackboneElementInput/BackboneElementInput.js.map +0 -1
- package/dist/esm/CalendarInput/CalendarInput.js.map +0 -1
- package/dist/esm/CheckboxFormSection/CheckboxFormSection.js.map +0 -1
- package/dist/esm/CodeInput/CodeInput.js.map +0 -1
- package/dist/esm/CodeableConceptDisplay/CodeableConceptDisplay.js.map +0 -1
- package/dist/esm/CodeableConceptInput/CodeableConceptInput.js.map +0 -1
- package/dist/esm/CodingDisplay/CodingDisplay.js.map +0 -1
- package/dist/esm/CodingInput/CodingInput.js.map +0 -1
- package/dist/esm/ContactDetailDisplay/ContactDetailDisplay.js.map +0 -1
- package/dist/esm/ContactDetailInput/ContactDetailInput.js.map +0 -1
- package/dist/esm/ContactPointDisplay/ContactPointDisplay.js.map +0 -1
- package/dist/esm/ContactPointInput/ContactPointInput.js.map +0 -1
- package/dist/esm/Container/Container.js.map +0 -1
- package/dist/esm/DateTimeInput/DateTimeInput.js.map +0 -1
- package/dist/esm/DefaultResourceTimeline/DefaultResourceTimeline.js.map +0 -1
- package/dist/esm/DescriptionList/DescriptionList.js.map +0 -1
- package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.js.map +0 -1
- package/dist/esm/Document/Document.js +0 -13
- package/dist/esm/Document/Document.js.map +0 -1
- package/dist/esm/EncounterTimeline/EncounterTimeline.js.map +0 -1
- package/dist/esm/ErrorBoundary/ErrorBoundary.js.map +0 -1
- package/dist/esm/ExtensionInput/ExtensionInput.js.map +0 -1
- package/dist/esm/FhirPathDisplay/FhirPathDisplay.js.map +0 -1
- package/dist/esm/FhirPathTable/FhirPathTable.js.map +0 -1
- package/dist/esm/Form/Form.js.map +0 -1
- package/dist/esm/Form/FormUtils.js.map +0 -1
- package/dist/esm/FormSection/FormSection.js.map +0 -1
- package/dist/esm/GoogleButton/GoogleButton.js.map +0 -1
- package/dist/esm/HumanNameDisplay/HumanNameDisplay.js.map +0 -1
- package/dist/esm/HumanNameInput/HumanNameInput.js +0 -39
- package/dist/esm/HumanNameInput/HumanNameInput.js.map +0 -1
- package/dist/esm/IdentifierDisplay/IdentifierDisplay.js +0 -12
- package/dist/esm/IdentifierDisplay/IdentifierDisplay.js.map +0 -1
- package/dist/esm/IdentifierInput/IdentifierInput.js.map +0 -1
- package/dist/esm/Logo/Logo.js.map +0 -1
- package/dist/esm/MedplumLink/MedplumLink.js.map +0 -1
- package/dist/esm/MedplumProvider/MedplumProvider.js.map +0 -1
- package/dist/esm/Panel/Panel.js.map +0 -1
- package/dist/esm/PatientTimeline/PatientTimeline.js.map +0 -1
- package/dist/esm/PeriodInput/PeriodInput.js.map +0 -1
- package/dist/esm/PlanDefinitionBuilder/PlanDefinitionBuilder.js.map +0 -1
- package/dist/esm/QuantityDisplay/QuantityDisplay.js.map +0 -1
- package/dist/esm/QuantityInput/QuantityInput.js.map +0 -1
- package/dist/esm/QuestionnaireBuilder/QuestionnaireBuilder.js.map +0 -1
- package/dist/esm/QuestionnaireForm/QuestionnaireForm.js.map +0 -1
- package/dist/esm/RangeDisplay/RangeDisplay.js.map +0 -1
- package/dist/esm/RangeInput/RangeInput.js.map +0 -1
- package/dist/esm/RatioDisplay/RatioDisplay.js.map +0 -1
- package/dist/esm/RatioInput/RatioInput.js.map +0 -1
- package/dist/esm/ReferenceDisplay/ReferenceDisplay.js.map +0 -1
- package/dist/esm/ReferenceInput/ReferenceInput.js.map +0 -1
- package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.js.map +0 -1
- package/dist/esm/RequestGroupDisplay/RequestGroupDisplay.js.map +0 -1
- package/dist/esm/ResourceArrayDisplay/ResourceArrayDisplay.js.map +0 -1
- package/dist/esm/ResourceArrayInput/ResourceArrayInput.js.map +0 -1
- package/dist/esm/ResourceAvatar/ResourceAvatar.js +0 -24
- package/dist/esm/ResourceAvatar/ResourceAvatar.js.map +0 -1
- package/dist/esm/ResourceBadge/ResourceBadge.js.map +0 -1
- package/dist/esm/ResourceBlame/ResourceBlame.js.map +0 -1
- package/dist/esm/ResourceDiff/ResourceDiff.js.map +0 -1
- package/dist/esm/ResourceDiffTable/ResourceDiffTable.js.map +0 -1
- package/dist/esm/ResourceForm/ResourceForm.js.map +0 -1
- package/dist/esm/ResourceHistoryTable/ResourceHistoryTable.js.map +0 -1
- package/dist/esm/ResourceInput/ResourceInput.js.map +0 -1
- package/dist/esm/ResourceName/ResourceName.js +0 -19
- package/dist/esm/ResourceName/ResourceName.js.map +0 -1
- package/dist/esm/ResourcePropertyDisplay/ResourcePropertyDisplay.js.map +0 -1
- package/dist/esm/ResourcePropertyInput/ResourcePropertyInput.js.map +0 -1
- package/dist/esm/ResourceTable/ResourceTable.js.map +0 -1
- package/dist/esm/ResourceTimeline/ResourceTimeline.js.map +0 -1
- package/dist/esm/Scheduler/Scheduler.js.map +0 -1
- package/dist/esm/SearchControl/SearchControl.js.map +0 -1
- package/dist/esm/SearchControl/SearchControlField.js.map +0 -1
- package/dist/esm/SearchControl/SearchUtils.js.map +0 -1
- package/dist/esm/SearchFieldEditor/SearchFieldEditor.js.map +0 -1
- package/dist/esm/SearchFilterEditor/SearchFilterEditor.js.map +0 -1
- package/dist/esm/SearchFilterValueDialog/SearchFilterValueDialog.js.map +0 -1
- package/dist/esm/SearchFilterValueDisplay/SearchFilterValueDisplay.js.map +0 -1
- package/dist/esm/SearchFilterValueInput/SearchFilterValueInput.js.map +0 -1
- package/dist/esm/SearchPopupMenu/SearchPopupMenu.js.map +0 -1
- package/dist/esm/ServiceRequestTimeline/ServiceRequestTimeline.js.map +0 -1
- package/dist/esm/StatusBadge/StatusBadge.js.map +0 -1
- package/dist/esm/Timeline/Timeline.js.map +0 -1
- package/dist/esm/TimingInput/TimingInput.js.map +0 -1
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.js +0 -45
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.js.map +0 -1
- package/dist/esm/auth/AuthenticationForm.js +0 -54
- package/dist/esm/auth/AuthenticationForm.js.map +0 -1
- package/dist/esm/auth/ChooseProfileForm.js +0 -32
- package/dist/esm/auth/ChooseProfileForm.js.map +0 -1
- package/dist/esm/auth/ChooseScopeForm.js.map +0 -1
- package/dist/esm/auth/MfaForm.js.map +0 -1
- package/dist/esm/auth/NewProjectForm.js.map +0 -1
- package/dist/esm/auth/NewUserForm.js.map +0 -1
- package/dist/esm/auth/OktaButton.d.ts +0 -5
- package/dist/esm/auth/RegisterForm.js.map +0 -1
- package/dist/esm/auth/SignInForm.js.map +0 -1
- package/dist/esm/constants.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.min.js +0 -2
- package/dist/esm/index.min.js.map +0 -1
- package/dist/esm/node_modules/tslib/tslib.es6.js +0 -39
- package/dist/esm/node_modules/tslib/tslib.es6.js.map +0 -1
- package/dist/esm/useResource/useResource.js.map +0 -1
- package/dist/esm/utils/blame.js.map +0 -1
- package/dist/esm/utils/date.js.map +0 -1
- package/dist/esm/utils/diff.js.map +0 -1
- package/dist/esm/utils/dom.js.map +0 -1
- package/dist/esm/utils/outcomes.js +0 -29
- package/dist/esm/utils/outcomes.js.map +0 -1
- package/dist/esm/utils/questionnaire.js.map +0 -1
- package/dist/esm/utils/recaptcha.js.map +0 -1
- package/dist/esm/utils/script.js.map +0 -1
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
line.push('');
|
|
22
22
|
}
|
|
23
23
|
line[index] = str;
|
|
24
|
-
return
|
|
24
|
+
return { ...address, line };
|
|
25
25
|
}
|
|
26
26
|
function AddressInput(props) {
|
|
27
27
|
const [value, setValue] = React.useState(props.defaultValue || {});
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
function setUse(use) {
|
|
37
|
-
setValueWrapper(
|
|
37
|
+
setValueWrapper({ ...valueRef.current, use });
|
|
38
38
|
}
|
|
39
39
|
function setType(type) {
|
|
40
|
-
setValueWrapper(
|
|
40
|
+
setValueWrapper({ ...valueRef.current, type });
|
|
41
41
|
}
|
|
42
42
|
function setLine1(line1) {
|
|
43
43
|
setValueWrapper(setLine(valueRef.current || {}, 0, line1));
|
|
@@ -46,17 +46,17 @@
|
|
|
46
46
|
setValueWrapper(setLine(valueRef.current || {}, 1, line2));
|
|
47
47
|
}
|
|
48
48
|
function setCity(city) {
|
|
49
|
-
setValueWrapper(
|
|
49
|
+
setValueWrapper({ ...valueRef.current, city });
|
|
50
50
|
}
|
|
51
51
|
function setState(state) {
|
|
52
|
-
setValueWrapper(
|
|
52
|
+
setValueWrapper({ ...valueRef.current, state });
|
|
53
53
|
}
|
|
54
54
|
function setPostalCode(postalCode) {
|
|
55
|
-
setValueWrapper(
|
|
55
|
+
setValueWrapper({ ...valueRef.current, postalCode });
|
|
56
56
|
}
|
|
57
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
|
|
59
|
-
React.createElement(core$1.NativeSelect, { "data-testid": "address-type", defaultValue: value
|
|
58
|
+
React.createElement(core$1.NativeSelect, { "data-testid": "address-use", defaultValue: 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?.type, onChange: (e) => setType(e.currentTarget.value), data: ['', 'postal', 'physical', 'both'] }),
|
|
60
60
|
React.createElement(core$1.TextInput, { placeholder: "Line 1", defaultValue: getLine(value, 0), onChange: (e) => setLine1(e.currentTarget.value) }),
|
|
61
61
|
React.createElement(core$1.TextInput, { placeholder: "Line 2", defaultValue: getLine(value, 1), onChange: (e) => setLine2(e.currentTarget.value) }),
|
|
62
62
|
React.createElement(core$1.TextInput, { placeholder: "City", defaultValue: value.city, onChange: (e) => setCity(e.currentTarget.value) }),
|
|
@@ -80,12 +80,18 @@
|
|
|
80
80
|
});
|
|
81
81
|
React.useEffect(() => {
|
|
82
82
|
function eventListener() {
|
|
83
|
-
setState(
|
|
83
|
+
setState({
|
|
84
|
+
...state,
|
|
85
|
+
profile: medplum.getProfile(),
|
|
86
|
+
});
|
|
84
87
|
}
|
|
85
88
|
medplum.addEventListener('change', eventListener);
|
|
86
89
|
return () => medplum.removeEventListeneer('change', eventListener);
|
|
87
90
|
}, [medplum, state]);
|
|
88
|
-
const medplumContext =
|
|
91
|
+
const medplumContext = {
|
|
92
|
+
...state,
|
|
93
|
+
medplum,
|
|
94
|
+
};
|
|
89
95
|
return React.createElement(reactContext.Provider, { value: medplumContext }, props.children);
|
|
90
96
|
}
|
|
91
97
|
/**
|
|
@@ -131,43 +137,6 @@
|
|
|
131
137
|
return (React.createElement(core$1.TextInput, { name: props.name, placeholder: "Annotation text", defaultValue: value.text, onChange: (e) => setText(e.currentTarget.value) }));
|
|
132
138
|
}
|
|
133
139
|
|
|
134
|
-
/******************************************************************************
|
|
135
|
-
Copyright (c) Microsoft Corporation.
|
|
136
|
-
|
|
137
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
138
|
-
purpose with or without fee is hereby granted.
|
|
139
|
-
|
|
140
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
141
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
142
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
143
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
144
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
145
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
146
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
147
|
-
***************************************************************************** */
|
|
148
|
-
|
|
149
|
-
function __rest(s, e) {
|
|
150
|
-
var t = {};
|
|
151
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
152
|
-
t[p] = s[p];
|
|
153
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
154
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
155
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
156
|
-
t[p[i]] = s[p[i]];
|
|
157
|
-
}
|
|
158
|
-
return t;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
162
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
163
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
164
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
165
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
166
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
167
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
|
|
171
140
|
/**
|
|
172
141
|
* Kills a browser event.
|
|
173
142
|
* Prevents default behavior.
|
|
@@ -201,14 +170,14 @@
|
|
|
201
170
|
}
|
|
202
171
|
|
|
203
172
|
function AsyncAutocomplete(props) {
|
|
204
|
-
const { defaultValue, toKey, toOption, loadOptions, onChange, onCreate
|
|
173
|
+
const { defaultValue, toKey, toOption, loadOptions, onChange, onCreate, ...rest } = props;
|
|
205
174
|
const defaultItems = toDefaultItems(defaultValue);
|
|
206
175
|
const inputRef = React.useRef(null);
|
|
207
176
|
const [lastValue, setLastValue] = React.useState(undefined);
|
|
208
177
|
const [timer, setTimer] = React.useState();
|
|
209
178
|
const [abortController, setAbortController] = React.useState();
|
|
210
179
|
const [autoSubmit, setAutoSubmit] = React.useState();
|
|
211
|
-
const [options, setOptions] = React.useState(defaultItems
|
|
180
|
+
const [options, setOptions] = React.useState(defaultItems?.map(toOption));
|
|
212
181
|
const lastValueRef = React.useRef();
|
|
213
182
|
lastValueRef.current = lastValue;
|
|
214
183
|
const timerRef = React.useRef();
|
|
@@ -220,9 +189,8 @@
|
|
|
220
189
|
const optionsRef = React.useRef();
|
|
221
190
|
optionsRef.current = options;
|
|
222
191
|
const handleTimer = React.useCallback(() => {
|
|
223
|
-
var _a, _b;
|
|
224
192
|
setTimer(undefined);
|
|
225
|
-
const value =
|
|
193
|
+
const value = inputRef.current?.value?.trim() || '';
|
|
226
194
|
if (value === lastValueRef.current) {
|
|
227
195
|
// Nothing has changed, move on
|
|
228
196
|
return;
|
|
@@ -257,10 +225,9 @@
|
|
|
257
225
|
setTimer(newTimer);
|
|
258
226
|
}, [handleTimer]);
|
|
259
227
|
const handleChange = React.useCallback((values) => {
|
|
260
|
-
var _a, _b;
|
|
261
228
|
const result = [];
|
|
262
229
|
for (const value of values) {
|
|
263
|
-
let item =
|
|
230
|
+
let item = optionsRef.current?.find((option) => option.value === value)?.resource;
|
|
264
231
|
if (!item) {
|
|
265
232
|
item = onCreate(value);
|
|
266
233
|
}
|
|
@@ -297,7 +264,7 @@
|
|
|
297
264
|
}
|
|
298
265
|
};
|
|
299
266
|
}, []);
|
|
300
|
-
return (React.createElement(core$1.MultiSelect,
|
|
267
|
+
return (React.createElement(core$1.MultiSelect, { ...rest, ref: inputRef, defaultValue: defaultItems.map(toKey), searchable: true, onKeyDown: handleKeyDown, onSearchChange: handleSearchChange, data: options, onFocus: handleTimer, onChange: handleChange, onCreate: handleCreate, rightSectionWidth: 40, rightSection: abortController ? React.createElement(core$1.Loader, { size: 16 }) : null, filter: handleFilter }));
|
|
301
268
|
}
|
|
302
269
|
function toDefaultItems(defaultValue) {
|
|
303
270
|
if (!defaultValue) {
|
|
@@ -311,18 +278,18 @@
|
|
|
311
278
|
|
|
312
279
|
function AttachmentDisplay(props) {
|
|
313
280
|
const value = props.value;
|
|
314
|
-
const { contentType, url, title } = value
|
|
281
|
+
const { contentType, url, title } = value ?? {};
|
|
315
282
|
if (!url) {
|
|
316
283
|
return null;
|
|
317
284
|
}
|
|
318
285
|
return (React.createElement("div", { "data-testid": "attachment-display" },
|
|
319
|
-
|
|
320
|
-
|
|
286
|
+
contentType?.startsWith('image/') && (React.createElement("img", { "data-testid": "attachment-image", style: { maxWidth: props.maxWidth }, src: url, alt: value?.title })),
|
|
287
|
+
contentType?.startsWith('video/') && (React.createElement("video", { "data-testid": "attachment-video", style: { maxWidth: props.maxWidth }, controls: true },
|
|
321
288
|
React.createElement("source", { type: contentType, src: url }))),
|
|
322
|
-
contentType === 'application/pdf' && !
|
|
289
|
+
contentType === 'application/pdf' && !title?.endsWith('.pdf') && (React.createElement("div", { "data-testid": "attachment-pdf", style: { maxWidth: props.maxWidth, minHeight: 400 } },
|
|
323
290
|
React.createElement("iframe", { width: "100%", height: "400", src: url + '#navpanes=0', allowFullScreen: true, frameBorder: 0, seamless: true }))),
|
|
324
291
|
React.createElement("div", { "data-testid": "download-link", style: { padding: '2px 16px 16px 16px' } },
|
|
325
|
-
React.createElement(core$1.Anchor, { href: value
|
|
292
|
+
React.createElement(core$1.Anchor, { href: value?.url, "data-testid": "attachment-details", target: "_blank", rel: "noopener noreferrer" }, value?.title || 'Download'))));
|
|
326
293
|
}
|
|
327
294
|
|
|
328
295
|
function AttachmentArrayDisplay(props) {
|
|
@@ -335,9 +302,8 @@
|
|
|
335
302
|
const medplum = useMedplum();
|
|
336
303
|
const fileInputRef = React.useRef(null);
|
|
337
304
|
function onClick(e) {
|
|
338
|
-
var _a;
|
|
339
305
|
killEvent(e);
|
|
340
|
-
|
|
306
|
+
fileInputRef.current?.click();
|
|
341
307
|
}
|
|
342
308
|
function onFileChange(e) {
|
|
343
309
|
killEvent(e);
|
|
@@ -374,8 +340,7 @@
|
|
|
374
340
|
});
|
|
375
341
|
})
|
|
376
342
|
.catch((outcome) => {
|
|
377
|
-
|
|
378
|
-
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);
|
|
343
|
+
alert(outcome?.issue?.[0]?.details?.text);
|
|
379
344
|
});
|
|
380
345
|
}
|
|
381
346
|
return (React.createElement(React.Fragment, null,
|
|
@@ -384,8 +349,7 @@
|
|
|
384
349
|
}
|
|
385
350
|
|
|
386
351
|
function AttachmentArrayInput(props) {
|
|
387
|
-
|
|
388
|
-
const [values, setValues] = React.useState((_a = props.defaultValue) !== null && _a !== void 0 ? _a : []);
|
|
352
|
+
const [values, setValues] = React.useState(props.defaultValue ?? []);
|
|
389
353
|
const valuesRef = React.useRef();
|
|
390
354
|
valuesRef.current = values;
|
|
391
355
|
function setValuesWrapper(newValues) {
|
|
@@ -415,7 +379,7 @@
|
|
|
415
379
|
React.createElement("td", null,
|
|
416
380
|
React.createElement(AttachmentButton, { onUpload: (attachment) => {
|
|
417
381
|
setValuesWrapper([...valuesRef.current, attachment]);
|
|
418
|
-
} }, (props) => (React.createElement(core$1.ActionIcon,
|
|
382
|
+
} }, (props) => (React.createElement(core$1.ActionIcon, { ...props, title: "Add", size: "sm", color: "green" },
|
|
419
383
|
React.createElement(icons.IconCloudUpload, { size: 16 })))))))));
|
|
420
384
|
}
|
|
421
385
|
|
|
@@ -435,7 +399,7 @@
|
|
|
435
399
|
setValueWrapper(undefined);
|
|
436
400
|
} }, "Remove")));
|
|
437
401
|
}
|
|
438
|
-
return (React.createElement(AttachmentButton, { onUpload: setValueWrapper }, (props) => React.createElement(core$1.Button,
|
|
402
|
+
return (React.createElement(AttachmentButton, { onUpload: setValueWrapper }, (props) => React.createElement(core$1.Button, { ...props }, "Upload...")));
|
|
439
403
|
}
|
|
440
404
|
|
|
441
405
|
const useStyles$d = core$1.createStyles(() => ({
|
|
@@ -447,9 +411,9 @@
|
|
|
447
411
|
},
|
|
448
412
|
}));
|
|
449
413
|
function Container(props) {
|
|
450
|
-
const { children
|
|
414
|
+
const { children, ...others } = props;
|
|
451
415
|
const { classes } = useStyles$d();
|
|
452
|
-
return (React.createElement(core$1.Container,
|
|
416
|
+
return (React.createElement(core$1.Container, { className: classes.root, ...others }, children));
|
|
453
417
|
}
|
|
454
418
|
|
|
455
419
|
const useStyles$c = core$1.createStyles((theme, { width, fill }) => ({
|
|
@@ -476,15 +440,15 @@
|
|
|
476
440
|
withBorder: true,
|
|
477
441
|
};
|
|
478
442
|
function Panel(props) {
|
|
479
|
-
const
|
|
443
|
+
const { className, children, width, fill, unstyled, ...others } = core$1.useComponentDefaultProps('Panel', defaultProps$1, props);
|
|
480
444
|
const { classes, cx } = useStyles$c({ width, fill }, { name: 'Panel', unstyled });
|
|
481
|
-
return (React.createElement(core$1.Paper,
|
|
445
|
+
return (React.createElement(core$1.Paper, { className: cx(classes.paper, className), ...others }, children));
|
|
482
446
|
}
|
|
483
447
|
|
|
484
448
|
function Document(props) {
|
|
485
|
-
const { children
|
|
449
|
+
const { children, ...others } = props;
|
|
486
450
|
return (React.createElement(Container, null,
|
|
487
|
-
React.createElement(Panel,
|
|
451
|
+
React.createElement(Panel, { ...others }, children)));
|
|
488
452
|
}
|
|
489
453
|
|
|
490
454
|
/**
|
|
@@ -555,12 +519,13 @@
|
|
|
555
519
|
}
|
|
556
520
|
|
|
557
521
|
function getErrorsForInput(outcome, expression) {
|
|
558
|
-
|
|
559
|
-
|
|
522
|
+
return outcome?.issue
|
|
523
|
+
?.filter((issue) => isExpressionMatch(issue.expression?.[0], expression))
|
|
524
|
+
?.map((issue) => issue.details?.text)
|
|
525
|
+
?.join('\n');
|
|
560
526
|
}
|
|
561
527
|
function getIssuesForExpression(outcome, expression) {
|
|
562
|
-
|
|
563
|
-
return (_a = outcome === null || outcome === void 0 ? void 0 : outcome.issue) === null || _a === void 0 ? void 0 : _a.filter((issue) => { var _a; return isExpressionMatch((_a = issue.expression) === null || _a === void 0 ? void 0 : _a[0], expression); });
|
|
528
|
+
return outcome?.issue?.filter((issue) => isExpressionMatch(issue.expression?.[0], expression));
|
|
564
529
|
}
|
|
565
530
|
function isExpressionMatch(expr1, expr2) {
|
|
566
531
|
// Expression can be either "fieldName" or "resourceType.fieldName"
|
|
@@ -584,9 +549,9 @@
|
|
|
584
549
|
function NewProjectForm(props) {
|
|
585
550
|
const medplum = useMedplum();
|
|
586
551
|
const [outcome, setOutcome] = React.useState();
|
|
587
|
-
return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: (formData) =>
|
|
552
|
+
return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: async (formData) => {
|
|
588
553
|
try {
|
|
589
|
-
props.handleAuthResponse(
|
|
554
|
+
props.handleAuthResponse(await medplum.startNewProject({
|
|
590
555
|
login: props.login,
|
|
591
556
|
projectName: formData.projectName,
|
|
592
557
|
}));
|
|
@@ -594,7 +559,7 @@
|
|
|
594
559
|
catch (err) {
|
|
595
560
|
setOutcome(err);
|
|
596
561
|
}
|
|
597
|
-
}
|
|
562
|
+
} },
|
|
598
563
|
React.createElement(core$1.Center, { sx: { flexDirection: 'column' } },
|
|
599
564
|
React.createElement(Logo, { size: 32 }),
|
|
600
565
|
React.createElement(core$1.Title, null, "Create project")),
|
|
@@ -654,18 +619,24 @@
|
|
|
654
619
|
return React.createElement("div", { ref: parentRef });
|
|
655
620
|
}
|
|
656
621
|
function getGoogleClientId(clientId) {
|
|
657
|
-
var _a, _b;
|
|
658
622
|
if (clientId) {
|
|
659
623
|
return clientId;
|
|
660
624
|
}
|
|
661
625
|
const origin = window.location.protocol + '//' + window.location.host;
|
|
662
|
-
const authorizedOrigins =
|
|
626
|
+
const authorizedOrigins = "http://localhost:3000,http://127.0.0.1:3000,http://localhost:6006,http://127.0.0.1:6006,https://app.medplum.com,https://docs.medplum.com,https://storybook.medplum.com,https://graphiql.medplum.com,https://www.medplum.com"?.split(',') ?? [];
|
|
663
627
|
if (authorizedOrigins.includes(origin)) {
|
|
664
628
|
return "921088377005-3j1sa10vr6hj86jgmdfh2l53v3mp7lfi.apps.googleusercontent.com";
|
|
665
629
|
}
|
|
666
630
|
return undefined;
|
|
667
631
|
}
|
|
668
632
|
|
|
633
|
+
function OperationOutcomeAlert(props) {
|
|
634
|
+
if (!props.issues) {
|
|
635
|
+
return null;
|
|
636
|
+
}
|
|
637
|
+
return (React.createElement(core$1.Alert, { icon: React.createElement(icons.IconAlertCircle, { size: 16 }), color: "red" }, props.issues.map((issue) => (React.createElement("div", { "data-testid": "text-field-error", key: issue.details?.text }, issue.details?.text)))));
|
|
638
|
+
}
|
|
639
|
+
|
|
669
640
|
/**
|
|
670
641
|
* Dynamically loads the recaptcha script.
|
|
671
642
|
* We do not want to load the script on page load unless the user needs it.
|
|
@@ -683,14 +654,14 @@
|
|
|
683
654
|
*/
|
|
684
655
|
function getRecaptcha(siteKey) {
|
|
685
656
|
return new Promise((resolve, reject) => {
|
|
686
|
-
grecaptcha.ready(() =>
|
|
657
|
+
grecaptcha.ready(async () => {
|
|
687
658
|
try {
|
|
688
|
-
resolve(
|
|
659
|
+
resolve(await grecaptcha.execute(siteKey, { action: 'submit' }));
|
|
689
660
|
}
|
|
690
661
|
catch (err) {
|
|
691
662
|
reject(err);
|
|
692
663
|
}
|
|
693
|
-
})
|
|
664
|
+
});
|
|
694
665
|
});
|
|
695
666
|
}
|
|
696
667
|
|
|
@@ -701,10 +672,10 @@
|
|
|
701
672
|
const [outcome, setOutcome] = React.useState();
|
|
702
673
|
const issues = getIssuesForExpression(outcome, undefined);
|
|
703
674
|
React.useEffect(() => initRecaptcha(recaptchaSiteKey), [recaptchaSiteKey]);
|
|
704
|
-
return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: (formData) =>
|
|
675
|
+
return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: async (formData) => {
|
|
705
676
|
try {
|
|
706
|
-
const recaptchaToken =
|
|
707
|
-
props.handleAuthResponse(
|
|
677
|
+
const recaptchaToken = await getRecaptcha(recaptchaSiteKey);
|
|
678
|
+
props.handleAuthResponse(await medplum.startNewUser({
|
|
708
679
|
projectId: props.projectId,
|
|
709
680
|
firstName: formData.firstName,
|
|
710
681
|
lastName: formData.lastName,
|
|
@@ -718,18 +689,14 @@
|
|
|
718
689
|
catch (err) {
|
|
719
690
|
setOutcome(err);
|
|
720
691
|
}
|
|
721
|
-
}
|
|
692
|
+
} },
|
|
722
693
|
React.createElement(core$1.Center, { sx: { flexDirection: 'column' } }, props.children),
|
|
723
|
-
|
|
724
|
-
var _a, _b;
|
|
725
|
-
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));
|
|
726
|
-
}))),
|
|
694
|
+
React.createElement(OperationOutcomeAlert, { issues: issues }),
|
|
727
695
|
googleClientId && (React.createElement(React.Fragment, null,
|
|
728
696
|
React.createElement(core$1.Group, { position: "center", p: "xl", style: { height: 70 } },
|
|
729
|
-
React.createElement(GoogleButton, { googleClientId: googleClientId, handleGoogleCredential: (response) =>
|
|
697
|
+
React.createElement(GoogleButton, { googleClientId: googleClientId, handleGoogleCredential: async (response) => {
|
|
730
698
|
try {
|
|
731
|
-
|
|
732
|
-
props.handleAuthResponse(yield medplum.startGoogleLogin({
|
|
699
|
+
props.handleAuthResponse(await medplum.startGoogleLogin({
|
|
733
700
|
googleClientId: response.clientId,
|
|
734
701
|
googleCredential: response.credential,
|
|
735
702
|
createUser: true,
|
|
@@ -738,7 +705,7 @@
|
|
|
738
705
|
catch (err) {
|
|
739
706
|
setOutcome(err);
|
|
740
707
|
}
|
|
741
|
-
}
|
|
708
|
+
} })),
|
|
742
709
|
React.createElement(core$1.Divider, { label: "or", labelPosition: "center", my: "lg" }))),
|
|
743
710
|
React.createElement(core$1.Stack, { spacing: "xl" },
|
|
744
711
|
React.createElement(core$1.TextInput, { name: "firstName", type: "text", label: "First name", placeholder: "First name", required: true, autoFocus: true, error: getErrorsForInput(outcome, 'firstName') }),
|
|
@@ -796,44 +763,79 @@
|
|
|
796
763
|
}
|
|
797
764
|
|
|
798
765
|
function AuthenticationForm(props) {
|
|
799
|
-
const
|
|
766
|
+
const [email, setEmail] = React.useState();
|
|
767
|
+
if (!email) {
|
|
768
|
+
return React.createElement(EmailForm, { setEmail: setEmail, ...props });
|
|
769
|
+
}
|
|
770
|
+
else {
|
|
771
|
+
return React.createElement(PasswordForm, { email: email, ...props });
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
function EmailForm(props) {
|
|
775
|
+
const { setEmail, onRegister, handleAuthResponse, children, ...baseLoginRequest } = props;
|
|
800
776
|
const medplum = useMedplum();
|
|
801
777
|
const googleClientId = getGoogleClientId(props.googleClientId);
|
|
802
|
-
const
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
778
|
+
const isExternalAuth = React.useCallback(async (authMethod) => {
|
|
779
|
+
if (!authMethod.authorizeUrl) {
|
|
780
|
+
return false;
|
|
781
|
+
}
|
|
782
|
+
const state = JSON.stringify({
|
|
783
|
+
...(await medplum.ensureCodeChallenge(baseLoginRequest)),
|
|
784
|
+
domain: authMethod.domain,
|
|
809
785
|
});
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
786
|
+
const url = new URL(authMethod.authorizeUrl);
|
|
787
|
+
url.searchParams.set('state', state);
|
|
788
|
+
window.location.assign(url.toString());
|
|
789
|
+
return true;
|
|
790
|
+
}, [medplum, baseLoginRequest]);
|
|
791
|
+
const handleSubmit = React.useCallback(async (formData) => {
|
|
792
|
+
const authMethod = await medplum.post('auth/method', { email: formData.email });
|
|
793
|
+
if (!(await isExternalAuth(authMethod))) {
|
|
794
|
+
setEmail(formData.email);
|
|
795
|
+
}
|
|
796
|
+
}, [medplum, isExternalAuth, setEmail]);
|
|
797
|
+
const handleGoogleCredential = React.useCallback(async (response) => {
|
|
798
|
+
const authResponse = await medplum.startGoogleLogin({
|
|
799
|
+
...baseLoginRequest,
|
|
800
|
+
googleCredential: response.credential,
|
|
801
|
+
});
|
|
802
|
+
if (!(await isExternalAuth(authResponse))) {
|
|
803
|
+
handleAuthResponse(authResponse);
|
|
804
|
+
}
|
|
805
|
+
}, [medplum, baseLoginRequest, isExternalAuth, handleAuthResponse]);
|
|
806
|
+
return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: handleSubmit },
|
|
817
807
|
React.createElement(core$1.Center, { sx: { flexDirection: 'column' } }, children),
|
|
818
|
-
issues && (React.createElement(core$1.Alert, { icon: React.createElement(icons.IconAlertCircle, { size: 16 }), color: "red" }, issues.map((issue) => {
|
|
819
|
-
var _a, _b;
|
|
820
|
-
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));
|
|
821
|
-
}))),
|
|
822
808
|
googleClientId && (React.createElement(React.Fragment, null,
|
|
823
809
|
React.createElement(core$1.Group, { position: "center", p: "xl", style: { height: 70 } },
|
|
824
|
-
React.createElement(GoogleButton, { googleClientId: googleClientId, handleGoogleCredential:
|
|
825
|
-
startPkce()
|
|
826
|
-
.then(() => medplum.startGoogleLogin(Object.assign(Object.assign({}, baseLoginRequest), { googleCredential: response.credential })))
|
|
827
|
-
.then(props.handleAuthResponse)
|
|
828
|
-
.catch(setOutcome);
|
|
829
|
-
} })),
|
|
810
|
+
React.createElement(GoogleButton, { googleClientId: googleClientId, handleGoogleCredential: handleGoogleCredential })),
|
|
830
811
|
React.createElement(core$1.Divider, { label: "or", labelPosition: "center", my: "lg" }))),
|
|
812
|
+
React.createElement(core$1.TextInput, { name: "email", type: "email", label: "Email", placeholder: "name@domain.com", required: true, autoFocus: true }),
|
|
813
|
+
React.createElement(core$1.Group, { position: "apart", mt: "xl", spacing: 0, noWrap: true },
|
|
814
|
+
onRegister && (React.createElement(core$1.Anchor, { component: "button", type: "button", color: "dimmed", onClick: onRegister, size: "xs" }, "Register")),
|
|
815
|
+
React.createElement(core$1.Button, { type: "submit" }, "Next"))));
|
|
816
|
+
}
|
|
817
|
+
function PasswordForm(props) {
|
|
818
|
+
const { onForgotPassword, handleAuthResponse, children, ...baseLoginRequest } = props;
|
|
819
|
+
const medplum = useMedplum();
|
|
820
|
+
const [outcome, setOutcome] = React.useState();
|
|
821
|
+
const issues = getIssuesForExpression(outcome, undefined);
|
|
822
|
+
const handleSubmit = React.useCallback((formData) => {
|
|
823
|
+
medplum
|
|
824
|
+
.startLogin({
|
|
825
|
+
...baseLoginRequest,
|
|
826
|
+
password: formData.password,
|
|
827
|
+
remember: formData.remember === 'on',
|
|
828
|
+
})
|
|
829
|
+
.then(handleAuthResponse)
|
|
830
|
+
.catch(setOutcome);
|
|
831
|
+
}, [medplum, baseLoginRequest, handleAuthResponse]);
|
|
832
|
+
return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: handleSubmit },
|
|
833
|
+
React.createElement(core$1.Center, { sx: { flexDirection: 'column' } }, children),
|
|
834
|
+
React.createElement(OperationOutcomeAlert, { issues: issues }),
|
|
831
835
|
React.createElement(core$1.Stack, { spacing: "xl" },
|
|
832
|
-
React.createElement(core$1.TextInput, { name: "email", type: "email", label: "Email", placeholder: "name@domain.com", required: true, autoFocus: true, error: getErrorsForInput(outcome, 'email') }),
|
|
833
836
|
React.createElement(core$1.PasswordInput, { name: "password", type: "password", label: "Password", autoComplete: "off", required: true, error: getErrorsForInput(outcome, 'password') })),
|
|
834
837
|
React.createElement(core$1.Group, { position: "apart", mt: "xl", spacing: 0, noWrap: true },
|
|
835
838
|
onForgotPassword && (React.createElement(core$1.Anchor, { component: "button", type: "button", color: "dimmed", onClick: onForgotPassword, size: "xs" }, "Forgot password")),
|
|
836
|
-
onRegister && (React.createElement(core$1.Anchor, { component: "button", type: "button", color: "dimmed", onClick: onRegister, size: "xs" }, "Register")),
|
|
837
839
|
React.createElement(core$1.Checkbox, { id: "remember", name: "remember", label: "Remember me", size: "xs", sx: { lineHeight: 1 } }),
|
|
838
840
|
React.createElement(core$1.Button, { type: "submit" }, "Sign in"))));
|
|
839
841
|
}
|
|
@@ -844,23 +846,20 @@
|
|
|
844
846
|
React.createElement(core$1.Center, { sx: { flexDirection: 'column' } },
|
|
845
847
|
React.createElement(Logo, { size: 32 }),
|
|
846
848
|
React.createElement(core$1.Title, null, "Choose profile")),
|
|
847
|
-
props.memberships.map((membership) => {
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
React.createElement(
|
|
859
|
-
React.createElement(core$1.
|
|
860
|
-
React.createElement(
|
|
861
|
-
React.createElement(core$1.Text, { size: "sm", weight: 500 }, (_a = membership.profile) === null || _a === void 0 ? void 0 : _a.display),
|
|
862
|
-
React.createElement(core$1.Text, { color: "dimmed", size: "xs" }, (_b = membership.project) === null || _b === void 0 ? void 0 : _b.display)))));
|
|
863
|
-
})));
|
|
849
|
+
props.memberships.map((membership) => (React.createElement(core$1.UnstyledButton, { key: membership.id, onClick: () => {
|
|
850
|
+
medplum
|
|
851
|
+
.post('auth/profile', {
|
|
852
|
+
login: props.login,
|
|
853
|
+
profile: membership.id,
|
|
854
|
+
})
|
|
855
|
+
.then(props.handleAuthResponse)
|
|
856
|
+
.catch(console.log);
|
|
857
|
+
} },
|
|
858
|
+
React.createElement(core$1.Group, null,
|
|
859
|
+
React.createElement(core$1.Avatar, { radius: "xl" }),
|
|
860
|
+
React.createElement("div", { style: { flex: 1 } },
|
|
861
|
+
React.createElement(core$1.Text, { size: "sm", weight: 500 }, membership.profile?.display),
|
|
862
|
+
React.createElement(core$1.Text, { color: "dimmed", size: "xs" }, membership.project?.display))))))));
|
|
864
863
|
}
|
|
865
864
|
|
|
866
865
|
function ChooseScopeForm(props) {
|
|
@@ -918,12 +917,27 @@
|
|
|
918
917
|
* 5) Success - Return to the caller with either a code or a redirect
|
|
919
918
|
*/
|
|
920
919
|
function SignInForm(props) {
|
|
921
|
-
const { chooseScopes, onSuccess, onForgotPassword, onRegister, onCode
|
|
920
|
+
const { chooseScopes, onSuccess, onForgotPassword, onRegister, onCode, ...baseLoginRequest } = props;
|
|
922
921
|
const medplum = useMedplum();
|
|
923
922
|
const [login, setLogin] = React.useState(undefined);
|
|
924
923
|
const [mfaRequired, setAuthenticatorRequired] = React.useState(false);
|
|
925
924
|
const [memberships, setMemberships] = React.useState(undefined);
|
|
926
|
-
|
|
925
|
+
const handleCode = React.useCallback((code) => {
|
|
926
|
+
if (onCode) {
|
|
927
|
+
onCode(code);
|
|
928
|
+
}
|
|
929
|
+
else {
|
|
930
|
+
medplum
|
|
931
|
+
.processCode(code)
|
|
932
|
+
.then(() => {
|
|
933
|
+
if (onSuccess) {
|
|
934
|
+
onSuccess();
|
|
935
|
+
}
|
|
936
|
+
})
|
|
937
|
+
.catch(console.log);
|
|
938
|
+
}
|
|
939
|
+
}, [medplum, onCode, onSuccess]);
|
|
940
|
+
const handleAuthResponse = React.useCallback((response) => {
|
|
927
941
|
setAuthenticatorRequired(!!response.mfaRequired);
|
|
928
942
|
if (response.login) {
|
|
929
943
|
setLogin(response.login);
|
|
@@ -939,28 +953,21 @@
|
|
|
939
953
|
handleCode(response.code);
|
|
940
954
|
}
|
|
941
955
|
}
|
|
942
|
-
}
|
|
943
|
-
|
|
956
|
+
}, [chooseScopes, handleCode]);
|
|
957
|
+
const handleScopeResponse = React.useCallback((response) => {
|
|
944
958
|
handleCode(response.code);
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
if (
|
|
948
|
-
onCode(code);
|
|
949
|
-
}
|
|
950
|
-
else {
|
|
959
|
+
}, [handleCode]);
|
|
960
|
+
React.useEffect(() => {
|
|
961
|
+
if (props.login) {
|
|
951
962
|
medplum
|
|
952
|
-
.
|
|
953
|
-
.then(
|
|
954
|
-
|
|
955
|
-
onSuccess();
|
|
956
|
-
}
|
|
957
|
-
})
|
|
958
|
-
.catch(console.log);
|
|
963
|
+
.get('auth/login/' + props.login)
|
|
964
|
+
.then(handleAuthResponse)
|
|
965
|
+
.catch(console.error);
|
|
959
966
|
}
|
|
960
|
-
}
|
|
967
|
+
}, [medplum, props, handleAuthResponse]);
|
|
961
968
|
return (React.createElement(Document, { width: 450 }, (() => {
|
|
962
969
|
if (!login) {
|
|
963
|
-
return (React.createElement(AuthenticationForm,
|
|
970
|
+
return (React.createElement(AuthenticationForm, { onForgotPassword: onForgotPassword, onRegister: onRegister, handleAuthResponse: handleAuthResponse, ...baseLoginRequest }, props.children));
|
|
964
971
|
}
|
|
965
972
|
else if (mfaRequired) {
|
|
966
973
|
return React.createElement(MfaForm, { login: login, handleAuthResponse: handleAuthResponse });
|
|
@@ -1054,15 +1061,14 @@
|
|
|
1054
1061
|
}
|
|
1055
1062
|
|
|
1056
1063
|
function ContactDetailDisplay(props) {
|
|
1057
|
-
var _a;
|
|
1058
1064
|
const contactDetail = props.value;
|
|
1059
1065
|
if (!contactDetail) {
|
|
1060
1066
|
return null;
|
|
1061
1067
|
}
|
|
1062
1068
|
return (React.createElement(React.Fragment, null,
|
|
1063
1069
|
contactDetail.name,
|
|
1064
|
-
contactDetail.name && ': ',
|
|
1065
|
-
|
|
1070
|
+
contactDetail.name && ': ',
|
|
1071
|
+
contactDetail.telecom?.map((telecom, index) => (React.createElement(ContactPointDisplay, { key: 'telecom-' + index, value: telecom })))));
|
|
1066
1072
|
}
|
|
1067
1073
|
|
|
1068
1074
|
function HumanNameDisplay(props) {
|
|
@@ -1074,11 +1080,14 @@
|
|
|
1074
1080
|
}
|
|
1075
1081
|
|
|
1076
1082
|
function IdentifierDisplay(props) {
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1083
|
+
return (React.createElement("div", null,
|
|
1084
|
+
props.value?.system,
|
|
1085
|
+
": ",
|
|
1086
|
+
props.value?.value));
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
function MoneyDisplay(props) {
|
|
1090
|
+
return React.createElement(React.Fragment, null, core.formatMoney(props.value));
|
|
1082
1091
|
}
|
|
1083
1092
|
|
|
1084
1093
|
function QuantityDisplay(props) {
|
|
@@ -1102,12 +1111,12 @@
|
|
|
1102
1111
|
|
|
1103
1112
|
function MedplumLink(props) {
|
|
1104
1113
|
const navigate = reactRouterDom.useNavigate();
|
|
1105
|
-
const { to, suffix, label, onClick, children
|
|
1114
|
+
const { to, suffix, label, onClick, children, ...rest } = props;
|
|
1106
1115
|
let href = getHref(to);
|
|
1107
1116
|
if (suffix) {
|
|
1108
1117
|
href += '/' + suffix;
|
|
1109
1118
|
}
|
|
1110
|
-
return (React.createElement(core$1.Anchor,
|
|
1119
|
+
return (React.createElement(core$1.Anchor, { href: href, "aria-label": label, onClick: (e) => {
|
|
1111
1120
|
killEvent(e);
|
|
1112
1121
|
if (onClick) {
|
|
1113
1122
|
onClick();
|
|
@@ -1115,7 +1124,7 @@
|
|
|
1115
1124
|
else if (to) {
|
|
1116
1125
|
navigate(href);
|
|
1117
1126
|
}
|
|
1118
|
-
}
|
|
1127
|
+
}, ...rest }, children));
|
|
1119
1128
|
}
|
|
1120
1129
|
function getHref(to) {
|
|
1121
1130
|
if (to) {
|
|
@@ -1160,18 +1169,16 @@
|
|
|
1160
1169
|
}
|
|
1161
1170
|
|
|
1162
1171
|
function ResourceArrayDisplay(props) {
|
|
1163
|
-
var _a, _b, _c;
|
|
1164
1172
|
const property = props.property;
|
|
1165
|
-
const values =
|
|
1166
|
-
const propertyType =
|
|
1173
|
+
const values = props.values ?? [];
|
|
1174
|
+
const propertyType = property.type?.[0]?.code;
|
|
1167
1175
|
return (React.createElement(React.Fragment, null, values.map((v, index) => (React.createElement("div", { key: `${index}-${values.length}` },
|
|
1168
1176
|
React.createElement(ResourcePropertyDisplay, { arrayElement: true, property: property, propertyType: propertyType, value: v, ignoreMissingValues: props.ignoreMissingValues, link: props.link }))))));
|
|
1169
1177
|
}
|
|
1170
1178
|
|
|
1171
1179
|
function ResourcePropertyDisplay(props) {
|
|
1172
|
-
var _a;
|
|
1173
1180
|
const { property, propertyType, value } = props;
|
|
1174
|
-
if (
|
|
1181
|
+
if (property?.max === '*' && !props.arrayElement) {
|
|
1175
1182
|
if (propertyType === 'Attachment') {
|
|
1176
1183
|
return React.createElement(AttachmentArrayDisplay, { values: value, maxWidth: props.maxWidth });
|
|
1177
1184
|
}
|
|
@@ -1200,7 +1207,7 @@
|
|
|
1200
1207
|
case core.PropertyType.Address:
|
|
1201
1208
|
return React.createElement(AddressDisplay, { value: value });
|
|
1202
1209
|
case core.PropertyType.Annotation:
|
|
1203
|
-
return React.createElement(React.Fragment, null, value
|
|
1210
|
+
return React.createElement(React.Fragment, null, value?.text);
|
|
1204
1211
|
case core.PropertyType.Attachment:
|
|
1205
1212
|
return React.createElement(AttachmentDisplay, { value: value, maxWidth: props.maxWidth });
|
|
1206
1213
|
case core.PropertyType.CodeableConcept:
|
|
@@ -1215,6 +1222,8 @@
|
|
|
1215
1222
|
return React.createElement(HumanNameDisplay, { value: value });
|
|
1216
1223
|
case core.PropertyType.Identifier:
|
|
1217
1224
|
return React.createElement(IdentifierDisplay, { value: value });
|
|
1225
|
+
case core.PropertyType.Money:
|
|
1226
|
+
return React.createElement(MoneyDisplay, { value: value });
|
|
1218
1227
|
case core.PropertyType.Period:
|
|
1219
1228
|
return React.createElement(React.Fragment, null, core.formatPeriod(value));
|
|
1220
1229
|
case core.PropertyType.Quantity:
|
|
@@ -1232,10 +1241,10 @@
|
|
|
1232
1241
|
case core.PropertyType.UsageContext:
|
|
1233
1242
|
return (React.createElement(BackboneElementDisplay, { value: { type: propertyType, value }, compact: true, ignoreMissingValues: props.ignoreMissingValues }));
|
|
1234
1243
|
default:
|
|
1235
|
-
if (!
|
|
1244
|
+
if (!property?.path) {
|
|
1236
1245
|
throw Error(`Displaying property of type ${props.propertyType} requires element definition path`);
|
|
1237
1246
|
}
|
|
1238
|
-
return (React.createElement(BackboneElementDisplay, { value: { type: core.buildTypeName(
|
|
1247
|
+
return (React.createElement(BackboneElementDisplay, { value: { type: core.buildTypeName(property?.path?.split('.')), value }, compact: true, ignoreMissingValues: props.ignoreMissingValues }));
|
|
1239
1248
|
}
|
|
1240
1249
|
}
|
|
1241
1250
|
/**
|
|
@@ -1435,12 +1444,11 @@
|
|
|
1435
1444
|
}
|
|
1436
1445
|
function ValueSetAutocomplete(props) {
|
|
1437
1446
|
const medplum = useMedplum();
|
|
1438
|
-
const { elementDefinition
|
|
1439
|
-
const loadValues = React.useCallback((input, signal) =>
|
|
1440
|
-
|
|
1441
|
-
const
|
|
1442
|
-
const
|
|
1443
|
-
const valueSetElements = (_b = valueSet.expansion) === null || _b === void 0 ? void 0 : _b.contains;
|
|
1447
|
+
const { elementDefinition, ...rest } = props;
|
|
1448
|
+
const loadValues = React.useCallback(async (input, signal) => {
|
|
1449
|
+
const system = elementDefinition.binding?.valueSet;
|
|
1450
|
+
const valueSet = await medplum.searchValueSet(system, input, { signal });
|
|
1451
|
+
const valueSetElements = valueSet.expansion?.contains;
|
|
1444
1452
|
const newData = [];
|
|
1445
1453
|
for (const valueSetElement of valueSetElements) {
|
|
1446
1454
|
if (valueSetElement.code && !newData.some((item) => item.code === valueSetElement.code)) {
|
|
@@ -1448,8 +1456,8 @@
|
|
|
1448
1456
|
}
|
|
1449
1457
|
}
|
|
1450
1458
|
return newData;
|
|
1451
|
-
}
|
|
1452
|
-
return (React.createElement(AsyncAutocomplete,
|
|
1459
|
+
}, [medplum, elementDefinition]);
|
|
1460
|
+
return (React.createElement(AsyncAutocomplete, { ...rest, creatable: true, clearable: true, toKey: toKey, toOption: toOption, loadOptions: loadValues, getCreateLabel: (query) => `+ Create ${query}`, onCreate: createValue }));
|
|
1453
1461
|
}
|
|
1454
1462
|
function getDisplay(item) {
|
|
1455
1463
|
return item.display || item.code || '';
|
|
@@ -1467,8 +1475,7 @@
|
|
|
1467
1475
|
return (React.createElement(ValueSetAutocomplete, { elementDefinition: props.property, name: props.name, placeholder: props.placeholder, defaultValue: value && codeableConceptToValueSetElement(value), onChange: handleChange }));
|
|
1468
1476
|
}
|
|
1469
1477
|
function codeableConceptToValueSetElement(concept) {
|
|
1470
|
-
|
|
1471
|
-
return (_a = concept.coding) === null || _a === void 0 ? void 0 : _a.map((c) => ({
|
|
1478
|
+
return concept.coding?.map((c) => ({
|
|
1472
1479
|
system: c.system,
|
|
1473
1480
|
code: c.code,
|
|
1474
1481
|
display: c.display,
|
|
@@ -1503,7 +1510,7 @@
|
|
|
1503
1510
|
return code ? { code } : undefined;
|
|
1504
1511
|
}
|
|
1505
1512
|
function valueSetElementToCode(element) {
|
|
1506
|
-
return element
|
|
1513
|
+
return element?.code;
|
|
1507
1514
|
}
|
|
1508
1515
|
|
|
1509
1516
|
function CodingInput(props) {
|
|
@@ -1547,34 +1554,33 @@
|
|
|
1547
1554
|
}
|
|
1548
1555
|
}
|
|
1549
1556
|
function setSystem(system) {
|
|
1550
|
-
const newValue =
|
|
1557
|
+
const newValue = { ...ref.current, system };
|
|
1551
1558
|
if (!system) {
|
|
1552
1559
|
delete newValue.system;
|
|
1553
1560
|
}
|
|
1554
1561
|
setContactPointWrapper(newValue);
|
|
1555
1562
|
}
|
|
1556
1563
|
function setUse(use) {
|
|
1557
|
-
const newValue =
|
|
1564
|
+
const newValue = { ...ref.current, use };
|
|
1558
1565
|
if (!use) {
|
|
1559
1566
|
delete newValue.use;
|
|
1560
1567
|
}
|
|
1561
1568
|
setContactPointWrapper(newValue);
|
|
1562
1569
|
}
|
|
1563
1570
|
function setValue(value) {
|
|
1564
|
-
const newValue =
|
|
1571
|
+
const newValue = { ...ref.current, value };
|
|
1565
1572
|
if (!value) {
|
|
1566
1573
|
delete newValue.value;
|
|
1567
1574
|
}
|
|
1568
1575
|
setContactPointWrapper(newValue);
|
|
1569
1576
|
}
|
|
1570
1577
|
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
1571
|
-
React.createElement(core$1.NativeSelect, { "data-testid": "system", defaultValue: contactPoint
|
|
1572
|
-
React.createElement(core$1.NativeSelect, { "data-testid": "use", defaultValue: contactPoint
|
|
1573
|
-
React.createElement(core$1.TextInput, { placeholder: "Value", defaultValue: contactPoint
|
|
1578
|
+
React.createElement(core$1.NativeSelect, { "data-testid": "system", defaultValue: contactPoint?.system, onChange: (e) => setSystem(e.currentTarget.value), data: ['', 'email', 'phone', 'fax', 'pager', 'sms', 'other'] }),
|
|
1579
|
+
React.createElement(core$1.NativeSelect, { "data-testid": "use", defaultValue: contactPoint?.use, onChange: (e) => setUse(e.currentTarget.value), data: ['', 'home', 'work', 'temp', 'old', 'mobile'] }),
|
|
1580
|
+
React.createElement(core$1.TextInput, { placeholder: "Value", defaultValue: contactPoint?.value, onChange: (e) => setValue(e.currentTarget.value) })));
|
|
1574
1581
|
}
|
|
1575
1582
|
|
|
1576
1583
|
function ContactDetailInput(props) {
|
|
1577
|
-
var _a;
|
|
1578
1584
|
const [contactPoint, setContactDetail] = React.useState(props.defaultValue);
|
|
1579
1585
|
const ref = React.useRef();
|
|
1580
1586
|
ref.current = contactPoint;
|
|
@@ -1585,22 +1591,22 @@
|
|
|
1585
1591
|
}
|
|
1586
1592
|
}
|
|
1587
1593
|
function setName(name) {
|
|
1588
|
-
const newValue =
|
|
1594
|
+
const newValue = { ...ref.current, name };
|
|
1589
1595
|
if (!name) {
|
|
1590
1596
|
delete newValue.name;
|
|
1591
1597
|
}
|
|
1592
1598
|
setContactDetailWrapper(newValue);
|
|
1593
1599
|
}
|
|
1594
1600
|
function setTelecom(telecom) {
|
|
1595
|
-
const newValue =
|
|
1601
|
+
const newValue = { ...ref.current, telecom: telecom && [telecom] };
|
|
1596
1602
|
if (!telecom) {
|
|
1597
1603
|
delete newValue.telecom;
|
|
1598
1604
|
}
|
|
1599
1605
|
setContactDetailWrapper(newValue);
|
|
1600
1606
|
}
|
|
1601
1607
|
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
1602
|
-
React.createElement(core$1.TextInput, { "data-testid": props.name + '-name', name: props.name + '-name', placeholder: "Name", style: { width: 180 }, defaultValue: contactPoint
|
|
1603
|
-
React.createElement(ContactPointInput, { name: props.name + '-telecom', defaultValue:
|
|
1608
|
+
React.createElement(core$1.TextInput, { "data-testid": props.name + '-name', name: props.name + '-name', placeholder: "Name", style: { width: 180 }, defaultValue: contactPoint?.name, onChange: (e) => setName(e.currentTarget.value) }),
|
|
1609
|
+
React.createElement(ContactPointInput, { name: props.name + '-telecom', defaultValue: contactPoint?.telecom?.[0], onChange: setTelecom })));
|
|
1604
1610
|
}
|
|
1605
1611
|
|
|
1606
1612
|
/**
|
|
@@ -1675,7 +1681,6 @@
|
|
|
1675
1681
|
}
|
|
1676
1682
|
|
|
1677
1683
|
function HumanNameInput(props) {
|
|
1678
|
-
var _a, _b, _c;
|
|
1679
1684
|
const [value, setValue] = React.useState(props.defaultValue);
|
|
1680
1685
|
const valueRef = React.useRef();
|
|
1681
1686
|
valueRef.current = value;
|
|
@@ -1686,26 +1691,38 @@
|
|
|
1686
1691
|
}
|
|
1687
1692
|
}
|
|
1688
1693
|
function setUse(use) {
|
|
1689
|
-
setValueWrapper(
|
|
1694
|
+
setValueWrapper({ ...valueRef.current, use: use ? use : undefined });
|
|
1690
1695
|
}
|
|
1691
1696
|
function setPrefix(prefix) {
|
|
1692
|
-
setValueWrapper(
|
|
1697
|
+
setValueWrapper({
|
|
1698
|
+
...valueRef.current,
|
|
1699
|
+
prefix: prefix ? prefix.split(' ') : undefined,
|
|
1700
|
+
});
|
|
1693
1701
|
}
|
|
1694
1702
|
function setGiven(given) {
|
|
1695
|
-
setValueWrapper(
|
|
1703
|
+
setValueWrapper({
|
|
1704
|
+
...valueRef.current,
|
|
1705
|
+
given: given ? given.split(' ') : undefined,
|
|
1706
|
+
});
|
|
1696
1707
|
}
|
|
1697
1708
|
function setFamily(family) {
|
|
1698
|
-
setValueWrapper(
|
|
1709
|
+
setValueWrapper({
|
|
1710
|
+
...valueRef.current,
|
|
1711
|
+
family: family ? family : undefined,
|
|
1712
|
+
});
|
|
1699
1713
|
}
|
|
1700
1714
|
function setSuffix(suffix) {
|
|
1701
|
-
setValueWrapper(
|
|
1715
|
+
setValueWrapper({
|
|
1716
|
+
...valueRef.current,
|
|
1717
|
+
suffix: suffix ? suffix.split(' ') : undefined,
|
|
1718
|
+
});
|
|
1702
1719
|
}
|
|
1703
1720
|
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
1704
|
-
React.createElement(core$1.NativeSelect, { defaultValue: value
|
|
1705
|
-
React.createElement(core$1.TextInput, { placeholder: "Prefix", defaultValue:
|
|
1706
|
-
React.createElement(core$1.TextInput, { placeholder: "Given", defaultValue:
|
|
1707
|
-
React.createElement(core$1.TextInput, { placeholder: "Family", defaultValue: value
|
|
1708
|
-
React.createElement(core$1.TextInput, { placeholder: "Suffix", defaultValue:
|
|
1721
|
+
React.createElement(core$1.NativeSelect, { defaultValue: value?.use, "data-testid": "use", onChange: (e) => setUse(e.currentTarget.value), data: ['', 'temp', 'old', 'usual', 'official', 'nickname', 'anonymous', 'maiden'] }),
|
|
1722
|
+
React.createElement(core$1.TextInput, { placeholder: "Prefix", defaultValue: value?.prefix?.join(' '), onChange: (e) => setPrefix(e.currentTarget.value) }),
|
|
1723
|
+
React.createElement(core$1.TextInput, { placeholder: "Given", defaultValue: value?.given?.join(' '), onChange: (e) => setGiven(e.currentTarget.value) }),
|
|
1724
|
+
React.createElement(core$1.TextInput, { placeholder: "Family", defaultValue: value?.family, onChange: (e) => setFamily(e.currentTarget.value) }),
|
|
1725
|
+
React.createElement(core$1.TextInput, { placeholder: "Suffix", defaultValue: value?.suffix?.join(' '), onChange: (e) => setSuffix(e.currentTarget.value) })));
|
|
1709
1726
|
}
|
|
1710
1727
|
|
|
1711
1728
|
function IdentifierInput(props) {
|
|
@@ -1717,8 +1734,55 @@
|
|
|
1717
1734
|
}
|
|
1718
1735
|
}
|
|
1719
1736
|
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
1720
|
-
React.createElement(core$1.TextInput, { placeholder: "System", defaultValue: value
|
|
1721
|
-
React.createElement(core$1.TextInput, { placeholder: "Value", defaultValue: value
|
|
1737
|
+
React.createElement(core$1.TextInput, { placeholder: "System", defaultValue: value?.system, onChange: (e) => setValueWrapper({ ...value, system: e.currentTarget.value }) }),
|
|
1738
|
+
React.createElement(core$1.TextInput, { placeholder: "Value", defaultValue: value?.value, onChange: (e) => setValueWrapper({ ...value, value: e.currentTarget.value }) })));
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
/*
|
|
1742
|
+
* Based on: https://github.com/mantinedev/ui.mantine.dev/blob/master/components/CurrencyInput/CurrencyInput.tsx
|
|
1743
|
+
*/
|
|
1744
|
+
/**
|
|
1745
|
+
* List of currencies.
|
|
1746
|
+
*
|
|
1747
|
+
* Full list of currencies:
|
|
1748
|
+
* https://www.hl7.org/fhir/valueset-currencies.html
|
|
1749
|
+
*
|
|
1750
|
+
* Latest browsers can report list of supported currencies, but it's not widely supported:
|
|
1751
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf
|
|
1752
|
+
*
|
|
1753
|
+
* Using a short list for simplicity for now.
|
|
1754
|
+
*/
|
|
1755
|
+
const data = ['USD', 'EUR', 'CAD', 'GBP', 'AUD'];
|
|
1756
|
+
function MoneyInput(props) {
|
|
1757
|
+
const { onChange } = props;
|
|
1758
|
+
const [value, setValue] = React.useState(props.defaultValue);
|
|
1759
|
+
const setValueWrapper = React.useCallback((newValue) => {
|
|
1760
|
+
setValue(newValue);
|
|
1761
|
+
if (onChange) {
|
|
1762
|
+
onChange(newValue);
|
|
1763
|
+
}
|
|
1764
|
+
}, [onChange]);
|
|
1765
|
+
const handleCurrencyChange = React.useCallback((e) => {
|
|
1766
|
+
setValueWrapper({
|
|
1767
|
+
...value,
|
|
1768
|
+
currency: e.currentTarget.value,
|
|
1769
|
+
});
|
|
1770
|
+
}, [value, setValueWrapper]);
|
|
1771
|
+
const handleValueChange = React.useCallback((e) => {
|
|
1772
|
+
setValueWrapper({
|
|
1773
|
+
...value,
|
|
1774
|
+
value: e.currentTarget.valueAsNumber,
|
|
1775
|
+
});
|
|
1776
|
+
}, [value, setValueWrapper]);
|
|
1777
|
+
const select = (React.createElement(core$1.NativeSelect, { defaultValue: value?.currency, data: data, styles: {
|
|
1778
|
+
input: {
|
|
1779
|
+
fontWeight: 500,
|
|
1780
|
+
borderTopLeftRadius: 0,
|
|
1781
|
+
borderBottomLeftRadius: 0,
|
|
1782
|
+
width: 92,
|
|
1783
|
+
},
|
|
1784
|
+
}, onChange: handleCurrencyChange }));
|
|
1785
|
+
return (React.createElement(core$1.TextInput, { type: "number", label: props.label, placeholder: props.placeholder || 'Value', defaultValue: value?.value?.toString() || 'USD', icon: React.createElement(icons.IconCurrencyDollar, { size: 14 }), rightSection: select, rightSectionWidth: 92, onChange: handleValueChange }));
|
|
1722
1786
|
}
|
|
1723
1787
|
|
|
1724
1788
|
function PeriodInput(props) {
|
|
@@ -1730,12 +1794,11 @@
|
|
|
1730
1794
|
}
|
|
1731
1795
|
}
|
|
1732
1796
|
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
1733
|
-
React.createElement(DateTimeInput, { name: props.name + '.start', placeholder: "Start", defaultValue: value
|
|
1734
|
-
React.createElement(DateTimeInput, { name: props.name + '.end', placeholder: "End", defaultValue: value
|
|
1797
|
+
React.createElement(DateTimeInput, { name: props.name + '.start', placeholder: "Start", defaultValue: value?.start, onChange: (newValue) => setValueWrapper({ ...value, start: newValue }) }),
|
|
1798
|
+
React.createElement(DateTimeInput, { name: props.name + '.end', placeholder: "End", defaultValue: value?.end, onChange: (newValue) => setValueWrapper({ ...value, end: newValue }) })));
|
|
1735
1799
|
}
|
|
1736
1800
|
|
|
1737
1801
|
function QuantityInput(props) {
|
|
1738
|
-
var _a;
|
|
1739
1802
|
const [value, setValue] = React.useState(props.defaultValue);
|
|
1740
1803
|
function setValueWrapper(newValue) {
|
|
1741
1804
|
setValue(newValue);
|
|
@@ -1744,9 +1807,18 @@
|
|
|
1744
1807
|
}
|
|
1745
1808
|
}
|
|
1746
1809
|
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
1747
|
-
React.createElement(core$1.NativeSelect, { style: { width: 80 }, "data-testid": props.name + '-comparator', defaultValue: value
|
|
1748
|
-
|
|
1749
|
-
|
|
1810
|
+
React.createElement(core$1.NativeSelect, { style: { width: 80 }, "data-testid": props.name + '-comparator', defaultValue: value?.comparator, data: ['', '<', '<=', '>=', '>'], onChange: (e) => setValueWrapper({
|
|
1811
|
+
...value,
|
|
1812
|
+
comparator: e.currentTarget.value,
|
|
1813
|
+
}) }),
|
|
1814
|
+
React.createElement(core$1.TextInput, { id: props.name, name: props.name, "data-testid": props.name + '-value', type: "number", step: "any", placeholder: "Value", defaultValue: value?.value?.toString(), onChange: (e) => setValueWrapper({
|
|
1815
|
+
...value,
|
|
1816
|
+
value: tryParseNumber(e.currentTarget.value),
|
|
1817
|
+
}) }),
|
|
1818
|
+
React.createElement(core$1.TextInput, { placeholder: "Unit", "data-testid": props.name + '-unit', defaultValue: value?.unit, onChange: (e) => setValueWrapper({
|
|
1819
|
+
...value,
|
|
1820
|
+
unit: e.currentTarget.value,
|
|
1821
|
+
}) })));
|
|
1750
1822
|
}
|
|
1751
1823
|
function tryParseNumber(str) {
|
|
1752
1824
|
if (!str) {
|
|
@@ -1770,8 +1842,14 @@
|
|
|
1770
1842
|
}
|
|
1771
1843
|
}
|
|
1772
1844
|
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
1773
|
-
React.createElement(QuantityInput, { name: props.name + '-low', defaultValue: value
|
|
1774
|
-
|
|
1845
|
+
React.createElement(QuantityInput, { name: props.name + '-low', defaultValue: value?.low, onChange: (v) => setValueWrapper({
|
|
1846
|
+
...value,
|
|
1847
|
+
low: v,
|
|
1848
|
+
}) }),
|
|
1849
|
+
React.createElement(QuantityInput, { name: props.name + '-high', defaultValue: value?.high, onChange: (v) => setValueWrapper({
|
|
1850
|
+
...value,
|
|
1851
|
+
high: v,
|
|
1852
|
+
}) })));
|
|
1775
1853
|
}
|
|
1776
1854
|
|
|
1777
1855
|
/**
|
|
@@ -1789,24 +1867,29 @@
|
|
|
1789
1867
|
}
|
|
1790
1868
|
}
|
|
1791
1869
|
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
1792
|
-
React.createElement(QuantityInput, { name: props.name + '-numerator', defaultValue: value
|
|
1793
|
-
|
|
1870
|
+
React.createElement(QuantityInput, { name: props.name + '-numerator', defaultValue: value?.numerator, onChange: (v) => setValueWrapper({
|
|
1871
|
+
...value,
|
|
1872
|
+
numerator: v,
|
|
1873
|
+
}) }),
|
|
1874
|
+
React.createElement(QuantityInput, { name: props.name + '-denominator', defaultValue: value?.denominator, onChange: (v) => setValueWrapper({
|
|
1875
|
+
...value,
|
|
1876
|
+
denominator: v,
|
|
1877
|
+
}) })));
|
|
1794
1878
|
}
|
|
1795
1879
|
|
|
1796
1880
|
function ResourceAvatar(props) {
|
|
1797
|
-
var _a, _b, _c;
|
|
1798
1881
|
const resource = useResource(props.value);
|
|
1799
|
-
const text = resource ? core.getDisplayString(resource) :
|
|
1800
|
-
const imageUrl = (
|
|
1801
|
-
const radius =
|
|
1802
|
-
const avatarProps =
|
|
1882
|
+
const text = resource ? core.getDisplayString(resource) : props.alt ?? '';
|
|
1883
|
+
const imageUrl = (resource && core.getImageSrc(resource)) ?? props.src;
|
|
1884
|
+
const radius = props.radius ?? 'xl';
|
|
1885
|
+
const avatarProps = { ...props };
|
|
1803
1886
|
delete avatarProps.value;
|
|
1804
1887
|
delete avatarProps.link;
|
|
1805
1888
|
if (props.link) {
|
|
1806
1889
|
return (React.createElement(MedplumLink, { to: resource },
|
|
1807
|
-
React.createElement(core$1.Avatar,
|
|
1890
|
+
React.createElement(core$1.Avatar, { src: imageUrl, alt: text, radius: radius, ...avatarProps })));
|
|
1808
1891
|
}
|
|
1809
|
-
return React.createElement(core$1.Avatar,
|
|
1892
|
+
return React.createElement(core$1.Avatar, { src: imageUrl, alt: text, radius: radius, ...avatarProps });
|
|
1810
1893
|
}
|
|
1811
1894
|
|
|
1812
1895
|
/**
|
|
@@ -1837,24 +1920,20 @@
|
|
|
1837
1920
|
setValue(core.getDisplayString(defaultValue));
|
|
1838
1921
|
}
|
|
1839
1922
|
}, [defaultValue, setValue]);
|
|
1840
|
-
function loadValues(input) {
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
_count: '10',
|
|
1847
|
-
});
|
|
1848
|
-
const resources = yield medplum.searchResources(props.resourceType, searchParams);
|
|
1849
|
-
setData(resources.map((resource) => ({ value: core.getDisplayString(resource), resource })));
|
|
1850
|
-
setLoading(false);
|
|
1923
|
+
async function loadValues(input) {
|
|
1924
|
+
setLoading(true);
|
|
1925
|
+
const searchCode = SEARCH_CODES[props.resourceType] || 'name';
|
|
1926
|
+
const searchParams = new URLSearchParams({
|
|
1927
|
+
[searchCode]: input,
|
|
1928
|
+
_count: '10',
|
|
1851
1929
|
});
|
|
1930
|
+
const resources = await medplum.searchResources(props.resourceType, searchParams);
|
|
1931
|
+
setData(resources.map((resource) => ({ value: core.getDisplayString(resource), resource })));
|
|
1932
|
+
setLoading(false);
|
|
1852
1933
|
}
|
|
1853
|
-
function handleChange(val) {
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
return loadValues(val);
|
|
1857
|
-
});
|
|
1934
|
+
async function handleChange(val) {
|
|
1935
|
+
setValue(val);
|
|
1936
|
+
return loadValues(val);
|
|
1858
1937
|
}
|
|
1859
1938
|
function handleSelect(item) {
|
|
1860
1939
|
setValue(item.value);
|
|
@@ -1865,9 +1944,8 @@
|
|
|
1865
1944
|
}
|
|
1866
1945
|
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 }));
|
|
1867
1946
|
}
|
|
1868
|
-
const ItemComponent = React.forwardRef((
|
|
1869
|
-
|
|
1870
|
-
return (React.createElement("div", Object.assign({ ref: ref }, others),
|
|
1947
|
+
const ItemComponent = React.forwardRef(({ value, resource, ...others }, ref) => {
|
|
1948
|
+
return (React.createElement("div", { ref: ref, ...others },
|
|
1871
1949
|
React.createElement(core$1.Group, { noWrap: true },
|
|
1872
1950
|
React.createElement(ResourceAvatar, { value: resource }),
|
|
1873
1951
|
React.createElement("div", null,
|
|
@@ -1876,7 +1954,7 @@
|
|
|
1876
1954
|
});
|
|
1877
1955
|
|
|
1878
1956
|
function ReferenceInput(props) {
|
|
1879
|
-
const targetTypes = props.targetTypes;
|
|
1957
|
+
const targetTypes = getTargetTypes$1(props.targetTypes);
|
|
1880
1958
|
const initialResourceType = getInitialResourceType(props.defaultValue, targetTypes);
|
|
1881
1959
|
const [value, setValue] = React.useState(props.defaultValue);
|
|
1882
1960
|
const [resourceType, setResourceType] = React.useState(initialResourceType);
|
|
@@ -1896,9 +1974,14 @@
|
|
|
1896
1974
|
setValueHelper(item ? core.createReference(item) : undefined);
|
|
1897
1975
|
} })));
|
|
1898
1976
|
}
|
|
1977
|
+
function getTargetTypes$1(targetTypes) {
|
|
1978
|
+
if (!targetTypes || targetTypes.length === 0 || (targetTypes.length === 1 && targetTypes[0] === 'Resource')) {
|
|
1979
|
+
return undefined;
|
|
1980
|
+
}
|
|
1981
|
+
return targetTypes;
|
|
1982
|
+
}
|
|
1899
1983
|
function getInitialResourceType(defaultValue, targetTypes) {
|
|
1900
|
-
|
|
1901
|
-
const defaultValueResourceType = (_a = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.reference) === null || _a === void 0 ? void 0 : _a.split('/')[0];
|
|
1984
|
+
const defaultValueResourceType = defaultValue?.reference?.split('/')[0];
|
|
1902
1985
|
if (defaultValueResourceType) {
|
|
1903
1986
|
return defaultValueResourceType;
|
|
1904
1987
|
}
|
|
@@ -1969,23 +2052,20 @@
|
|
|
1969
2052
|
}, onCancel: () => setOpen(false) })));
|
|
1970
2053
|
}
|
|
1971
2054
|
function TimingEditorDialog(props) {
|
|
1972
|
-
var _a, _b;
|
|
1973
2055
|
const [value, setValue] = React.useState(props.defaultValue || {});
|
|
1974
2056
|
const valueRef = React.useRef();
|
|
1975
2057
|
valueRef.current = value;
|
|
1976
2058
|
function setStart(newStart) {
|
|
1977
|
-
setValue(
|
|
2059
|
+
setValue({ ...valueRef.current, event: [newStart] });
|
|
1978
2060
|
}
|
|
1979
2061
|
function setRepeat(repeat) {
|
|
1980
|
-
setValue(
|
|
2062
|
+
setValue({ ...valueRef.current, repeat });
|
|
1981
2063
|
}
|
|
1982
2064
|
function setPeriod(newPeriod) {
|
|
1983
|
-
|
|
1984
|
-
setRepeat(Object.assign(Object.assign({}, (_a = valueRef.current) === null || _a === void 0 ? void 0 : _a.repeat), { period: newPeriod }));
|
|
2065
|
+
setRepeat({ ...valueRef.current?.repeat, period: newPeriod });
|
|
1985
2066
|
}
|
|
1986
2067
|
function setPeriodUnit(newPeriodUnit) {
|
|
1987
|
-
|
|
1988
|
-
setRepeat(Object.assign(Object.assign({}, (_a = valueRef.current) === null || _a === void 0 ? void 0 : _a.repeat), { periodUnit: newPeriodUnit }));
|
|
2068
|
+
setRepeat({ ...valueRef.current?.repeat, periodUnit: newPeriodUnit });
|
|
1989
2069
|
}
|
|
1990
2070
|
function setDayOfWeek(day, enabled) {
|
|
1991
2071
|
if (enabled) {
|
|
@@ -1996,17 +2076,15 @@
|
|
|
1996
2076
|
}
|
|
1997
2077
|
}
|
|
1998
2078
|
function addDayOfWeek(day) {
|
|
1999
|
-
|
|
2000
|
-
const existing = ((_b = (_a = valueRef.current) === null || _a === void 0 ? void 0 : _a.repeat) === null || _b === void 0 ? void 0 : _b.dayOfWeek) || [];
|
|
2079
|
+
const existing = valueRef.current?.repeat?.dayOfWeek || [];
|
|
2001
2080
|
if (!existing.includes(day)) {
|
|
2002
|
-
setRepeat(
|
|
2081
|
+
setRepeat({ ...valueRef.current?.repeat, dayOfWeek: [...existing, day] });
|
|
2003
2082
|
}
|
|
2004
2083
|
}
|
|
2005
2084
|
function removeDayOfWeek(day) {
|
|
2006
|
-
|
|
2007
|
-
const existing = ((_b = (_a = valueRef.current) === null || _a === void 0 ? void 0 : _a.repeat) === null || _b === void 0 ? void 0 : _b.dayOfWeek) || [];
|
|
2085
|
+
const existing = valueRef.current?.repeat?.dayOfWeek || [];
|
|
2008
2086
|
if (existing.includes(day)) {
|
|
2009
|
-
setRepeat(
|
|
2087
|
+
setRepeat({ ...valueRef.current?.repeat, dayOfWeek: existing.filter((d) => d !== day) });
|
|
2010
2088
|
}
|
|
2011
2089
|
}
|
|
2012
2090
|
return (React.createElement(core$1.Modal, { title: "Timing", closeButtonLabel: "Close", opened: props.visible, onClose: () => props.onCancel() },
|
|
@@ -2015,8 +2093,8 @@
|
|
|
2015
2093
|
React.createElement(DateTimeInput, { name: 'timing-dialog-start', onChange: (newValue) => setStart(newValue) })),
|
|
2016
2094
|
React.createElement(FormSection, { title: "Repeat every", htmlFor: 'timing-dialog-period' },
|
|
2017
2095
|
React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
2018
|
-
React.createElement(core$1.TextInput, { type: "number", step: 1, id: "timing-dialog-period", name: "timing-dialog-period", defaultValue:
|
|
2019
|
-
React.createElement(core$1.NativeSelect, { id: "timing-dialog-periodUnit", name: "timing-dialog-periodUnit", defaultValue:
|
|
2096
|
+
React.createElement(core$1.TextInput, { type: "number", step: 1, id: "timing-dialog-period", name: "timing-dialog-period", defaultValue: value?.repeat?.period, onChange: (e) => setPeriod(parseInt(e.currentTarget.value)) }),
|
|
2097
|
+
React.createElement(core$1.NativeSelect, { id: "timing-dialog-periodUnit", name: "timing-dialog-periodUnit", defaultValue: value?.repeat?.periodUnit, onChange: (e) => setPeriodUnit(e.currentTarget.value), data: [
|
|
2020
2098
|
{ label: 'day', value: 'd' },
|
|
2021
2099
|
{ label: 'week', value: 'wk' },
|
|
2022
2100
|
{ label: 'month', value: 'mo' },
|
|
@@ -2030,9 +2108,8 @@
|
|
|
2030
2108
|
}
|
|
2031
2109
|
|
|
2032
2110
|
function ResourcePropertyInput(props) {
|
|
2033
|
-
var _a, _b, _c;
|
|
2034
2111
|
const property = props.property;
|
|
2035
|
-
const propertyType =
|
|
2112
|
+
const propertyType = props.defaultPropertyType ?? property.type?.[0]?.code;
|
|
2036
2113
|
const name = props.name;
|
|
2037
2114
|
const value = props.defaultValue;
|
|
2038
2115
|
if (property.max === '*' && !props.arrayElement) {
|
|
@@ -2043,10 +2120,10 @@
|
|
|
2043
2120
|
}
|
|
2044
2121
|
const propertyTypes = property.type;
|
|
2045
2122
|
if (propertyTypes.length > 1) {
|
|
2046
|
-
return React.createElement(ElementDefinitionInputSelector,
|
|
2123
|
+
return React.createElement(ElementDefinitionInputSelector, { elementDefinitionTypes: propertyTypes, ...props });
|
|
2047
2124
|
}
|
|
2048
2125
|
else {
|
|
2049
|
-
return React.createElement(ElementDefinitionTypeInput,
|
|
2126
|
+
return React.createElement(ElementDefinitionTypeInput, { elementDefinitionType: propertyTypes[0], ...props });
|
|
2050
2127
|
}
|
|
2051
2128
|
}
|
|
2052
2129
|
function ElementDefinitionInputSelector(props) {
|
|
@@ -2060,20 +2137,19 @@
|
|
|
2060
2137
|
}
|
|
2061
2138
|
const [selectedType, setSelectedType] = React.useState(initialPropertyType);
|
|
2062
2139
|
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
2063
|
-
React.createElement(core$1.NativeSelect, { style: { width: '200px' }, defaultValue: selectedType
|
|
2140
|
+
React.createElement(core$1.NativeSelect, { style: { width: '200px' }, defaultValue: selectedType?.code, onChange: (e) => {
|
|
2064
2141
|
setSelectedType(propertyTypes.find((type) => type.code === e.currentTarget.value));
|
|
2065
2142
|
}, data: propertyTypes.map((type) => ({
|
|
2066
2143
|
value: type.code,
|
|
2067
2144
|
label: type.code,
|
|
2068
2145
|
})) }),
|
|
2069
|
-
React.createElement(ElementDefinitionTypeInput,
|
|
2146
|
+
React.createElement(ElementDefinitionTypeInput, { ...props, elementDefinitionType: selectedType, onChange: (newValue) => {
|
|
2070
2147
|
if (props.onChange) {
|
|
2071
2148
|
props.onChange(newValue, props.name.replace('[x]', core.capitalize(selectedType.code)));
|
|
2072
2149
|
}
|
|
2073
|
-
} })))
|
|
2150
|
+
} })));
|
|
2074
2151
|
}
|
|
2075
2152
|
function ElementDefinitionTypeInput(props) {
|
|
2076
|
-
var _a;
|
|
2077
2153
|
const property = props.property;
|
|
2078
2154
|
const propertyType = props.elementDefinitionType.code;
|
|
2079
2155
|
const name = props.name;
|
|
@@ -2146,6 +2222,8 @@
|
|
|
2146
2222
|
return React.createElement(HumanNameInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
2147
2223
|
case core.PropertyType.Identifier:
|
|
2148
2224
|
return React.createElement(IdentifierInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
2225
|
+
case core.PropertyType.Money:
|
|
2226
|
+
return React.createElement(MoneyInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
2149
2227
|
case core.PropertyType.Period:
|
|
2150
2228
|
return React.createElement(PeriodInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
2151
2229
|
case core.PropertyType.Duration:
|
|
@@ -2163,17 +2241,15 @@
|
|
|
2163
2241
|
case core.PropertyType.UsageContext:
|
|
2164
2242
|
return (React.createElement(BackboneElementInput, { typeName: propertyType, defaultValue: value, onChange: props.onChange, outcome: props.outcome }));
|
|
2165
2243
|
default:
|
|
2166
|
-
return (React.createElement(BackboneElementInput, { typeName: core.buildTypeName(
|
|
2244
|
+
return (React.createElement(BackboneElementInput, { typeName: core.buildTypeName(property.path?.split('.')), defaultValue: value, onChange: props.onChange, outcome: props.outcome }));
|
|
2167
2245
|
}
|
|
2168
2246
|
}
|
|
2169
2247
|
function getTargetTypes(property) {
|
|
2170
|
-
|
|
2171
|
-
return (_c = (_b = (_a = property === null || property === void 0 ? void 0 : property.type) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.targetProfile) === null || _c === void 0 ? void 0 : _c.map((p) => p.split('/').pop());
|
|
2248
|
+
return property?.type?.[0]?.targetProfile?.map((p) => p.split('/').pop());
|
|
2172
2249
|
}
|
|
2173
2250
|
|
|
2174
2251
|
function BackboneElementInput(props) {
|
|
2175
|
-
|
|
2176
|
-
const [value, setValue] = React.useState((_a = props.defaultValue) !== null && _a !== void 0 ? _a : {});
|
|
2252
|
+
const [value, setValue] = React.useState(props.defaultValue ?? {});
|
|
2177
2253
|
function setValueWrapper(newValue) {
|
|
2178
2254
|
setValue(newValue);
|
|
2179
2255
|
if (props.onChange) {
|
|
@@ -2201,12 +2277,12 @@
|
|
|
2201
2277
|
if (property.type.length === 1 && property.type[0].code === 'boolean') {
|
|
2202
2278
|
return (React.createElement(CheckboxFormSection, { key: key, title: core.getPropertyDisplayName(key), description: property.definition, htmlFor: key },
|
|
2203
2279
|
React.createElement(ResourcePropertyInput, { property: property, name: key, defaultValue: propertyValue, defaultPropertyType: propertyType, outcome: props.outcome, onChange: (newValue, propName) => {
|
|
2204
|
-
setValueWrapper(setPropertyValue(value, key, propName
|
|
2280
|
+
setValueWrapper(setPropertyValue(value, key, propName ?? key, entry[1], newValue));
|
|
2205
2281
|
} })));
|
|
2206
2282
|
}
|
|
2207
2283
|
return (React.createElement(FormSection, { key: key, title: core.getPropertyDisplayName(key), description: property.definition, htmlFor: key, outcome: props.outcome },
|
|
2208
2284
|
React.createElement(ResourcePropertyInput, { property: property, name: key, defaultValue: propertyValue, defaultPropertyType: propertyType, outcome: props.outcome, onChange: (newValue, propName) => {
|
|
2209
|
-
setValueWrapper(setPropertyValue(value, key, propName
|
|
2285
|
+
setValueWrapper(setPropertyValue(value, key, propName ?? key, entry[1], newValue));
|
|
2210
2286
|
} })));
|
|
2211
2287
|
})));
|
|
2212
2288
|
}
|
|
@@ -2340,13 +2416,13 @@
|
|
|
2340
2416
|
}
|
|
2341
2417
|
|
|
2342
2418
|
function ResourceName(props) {
|
|
2343
|
-
const { value, link
|
|
2419
|
+
const { value, link, ...rest } = props;
|
|
2344
2420
|
const resource = useResource(value);
|
|
2345
2421
|
if (!resource) {
|
|
2346
2422
|
return null;
|
|
2347
2423
|
}
|
|
2348
2424
|
const text = core.getDisplayString(resource);
|
|
2349
|
-
return link ? (React.createElement(MedplumLink,
|
|
2425
|
+
return link ? (React.createElement(MedplumLink, { to: resource, ...rest }, text)) : (React.createElement(core$1.Text, { component: "span", ...rest }, text));
|
|
2350
2426
|
}
|
|
2351
2427
|
|
|
2352
2428
|
function ResourceBadge(props) {
|
|
@@ -2433,20 +2509,19 @@
|
|
|
2433
2509
|
},
|
|
2434
2510
|
}));
|
|
2435
2511
|
function DiagnosticReportDisplay(props) {
|
|
2436
|
-
var _a, _b;
|
|
2437
2512
|
const diagnosticReport = useResource(props.value);
|
|
2438
|
-
const specimen = useResource(
|
|
2513
|
+
const specimen = useResource(diagnosticReport?.specimen?.[0]);
|
|
2439
2514
|
if (!diagnosticReport) {
|
|
2440
2515
|
return null;
|
|
2441
2516
|
}
|
|
2442
2517
|
let textContent = '';
|
|
2443
2518
|
if (diagnosticReport.presentedForm && diagnosticReport.presentedForm.length > 0) {
|
|
2444
2519
|
const pf = diagnosticReport.presentedForm[0];
|
|
2445
|
-
if (
|
|
2520
|
+
if (pf.contentType?.startsWith('text/plain') && pf.data) {
|
|
2446
2521
|
textContent = window.atob(pf.data);
|
|
2447
2522
|
}
|
|
2448
2523
|
}
|
|
2449
|
-
if (specimen
|
|
2524
|
+
if (specimen?.note) {
|
|
2450
2525
|
for (const note of specimen.note) {
|
|
2451
2526
|
textContent += note.text + '\n\n';
|
|
2452
2527
|
}
|
|
@@ -2473,7 +2548,6 @@
|
|
|
2473
2548
|
textContent && React.createElement("pre", null, textContent.trim())));
|
|
2474
2549
|
}
|
|
2475
2550
|
function ObservationTable(props) {
|
|
2476
|
-
var _a;
|
|
2477
2551
|
const { classes } = useStyles$9();
|
|
2478
2552
|
return (React.createElement("table", { className: classes.table },
|
|
2479
2553
|
React.createElement("thead", null,
|
|
@@ -2484,7 +2558,7 @@
|
|
|
2484
2558
|
React.createElement("th", null, "Interpretation"),
|
|
2485
2559
|
React.createElement("th", null, "Category"),
|
|
2486
2560
|
React.createElement("th", null, "Status"))),
|
|
2487
|
-
React.createElement("tbody", null,
|
|
2561
|
+
React.createElement("tbody", null, props.value?.map((observation, index) => (React.createElement(ObservationRow, { key: 'obs-' + index, value: observation }))))));
|
|
2488
2562
|
}
|
|
2489
2563
|
function ObservationRow(props) {
|
|
2490
2564
|
const { classes, cx } = useStyles$9();
|
|
@@ -2502,7 +2576,7 @@
|
|
|
2502
2576
|
React.createElement("td", null,
|
|
2503
2577
|
React.createElement(ReferenceRangeDisplay, { value: observation.referenceRange })),
|
|
2504
2578
|
React.createElement("td", null, observation.interpretation && observation.interpretation.length > 0 && (React.createElement(CodeableConceptDisplay, { value: observation.interpretation[0] }))),
|
|
2505
|
-
React.createElement("td", null, observation.category && observation.category.length > 0 && (React.createElement("ul", null, observation.category.map((concept) => (React.createElement("li",
|
|
2579
|
+
React.createElement("td", null, observation.category && observation.category.length > 0 && (React.createElement("ul", null, observation.category.map((concept, index) => (React.createElement("li", { key: `category-${index}` },
|
|
2506
2580
|
React.createElement(CodeableConceptDisplay, { value: concept }))))))),
|
|
2507
2581
|
React.createElement("td", null, observation.status && React.createElement(StatusBadge, { status: observation.status }))));
|
|
2508
2582
|
}
|
|
@@ -2527,8 +2601,7 @@
|
|
|
2527
2601
|
* @returns True if the FHIR observation is a critical value.
|
|
2528
2602
|
*/
|
|
2529
2603
|
function isCritical(observation) {
|
|
2530
|
-
|
|
2531
|
-
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;
|
|
2604
|
+
const code = observation.interpretation?.[0]?.coding?.[0]?.code;
|
|
2532
2605
|
return code === 'AA' || code === 'LL' || code === 'HH' || code === 'A';
|
|
2533
2606
|
}
|
|
2534
2607
|
|
|
@@ -2646,17 +2719,16 @@
|
|
|
2646
2719
|
return React.createElement(Container, null, props.children);
|
|
2647
2720
|
}
|
|
2648
2721
|
function TimelineItem(props) {
|
|
2649
|
-
|
|
2650
|
-
const
|
|
2651
|
-
|
|
2652
|
-
return (React.createElement(Panel, Object.assign({ "data-testid": "timeline-item", fill: true }, others),
|
|
2722
|
+
const { resource, profile, padding, popupMenuItems, ...others } = props;
|
|
2723
|
+
const author = profile ?? resource.meta?.author;
|
|
2724
|
+
return (React.createElement(Panel, { "data-testid": "timeline-item", fill: true, ...others },
|
|
2653
2725
|
React.createElement(core$1.Group, { position: "apart", spacing: 8, mx: "xs", my: "sm" },
|
|
2654
2726
|
React.createElement(ResourceAvatar, { value: author, link: true, size: "md" }),
|
|
2655
2727
|
React.createElement("div", { style: { flex: 1 } },
|
|
2656
2728
|
React.createElement(core$1.Text, { size: "sm" },
|
|
2657
2729
|
React.createElement(ResourceName, { color: "dark", weight: 500, value: author, link: true })),
|
|
2658
2730
|
React.createElement(core$1.Text, { size: "xs" },
|
|
2659
|
-
React.createElement(MedplumLink, { color: "dimmed", to: props.resource }, core.formatDateTime(
|
|
2731
|
+
React.createElement(MedplumLink, { color: "dimmed", to: props.resource }, core.formatDateTime(props.resource.meta?.lastUpdated)),
|
|
2660
2732
|
React.createElement(core$1.Text, { component: "span", color: "dimmed", mx: 8 }, "\u00B7"),
|
|
2661
2733
|
React.createElement(MedplumLink, { color: "dimmed", to: props.resource }, props.resource.resourceType))),
|
|
2662
2734
|
popupMenuItems && (React.createElement(core$1.Menu, { position: "bottom-end", shadow: "md", width: 200 },
|
|
@@ -2695,7 +2767,6 @@
|
|
|
2695
2767
|
return 0;
|
|
2696
2768
|
}
|
|
2697
2769
|
function getTime(resource) {
|
|
2698
|
-
var _a;
|
|
2699
2770
|
if (resource.resourceType === 'Communication' && resource.sent) {
|
|
2700
2771
|
return new Date(resource.sent).getTime();
|
|
2701
2772
|
}
|
|
@@ -2708,7 +2779,7 @@
|
|
|
2708
2779
|
if (resource.resourceType === 'DocumentReference' && resource.date) {
|
|
2709
2780
|
return new Date(resource.date).getTime();
|
|
2710
2781
|
}
|
|
2711
|
-
const dateTime =
|
|
2782
|
+
const dateTime = resource.meta?.lastUpdated;
|
|
2712
2783
|
if (!dateTime) {
|
|
2713
2784
|
return 0;
|
|
2714
2785
|
}
|
|
@@ -2827,7 +2898,7 @@
|
|
|
2827
2898
|
}));
|
|
2828
2899
|
}
|
|
2829
2900
|
function setPriority(communication, priority) {
|
|
2830
|
-
return medplum.updateResource(
|
|
2901
|
+
return medplum.updateResource({ ...communication, priority });
|
|
2831
2902
|
}
|
|
2832
2903
|
function onPin(communication) {
|
|
2833
2904
|
setPriority(communication, 'stat').then(loadTimeline).catch(console.log);
|
|
@@ -2845,8 +2916,7 @@
|
|
|
2845
2916
|
navigate(`/${timelineItem.resourceType}/${timelineItem.id}/delete`);
|
|
2846
2917
|
}
|
|
2847
2918
|
function onVersionDetails(version) {
|
|
2848
|
-
|
|
2849
|
-
navigate(`/${version.resourceType}/${version.id}/_history/${(_a = version.meta) === null || _a === void 0 ? void 0 : _a.versionId}`);
|
|
2919
|
+
navigate(`/${version.resourceType}/${version.id}/_history/${version.meta?.versionId}`);
|
|
2850
2920
|
}
|
|
2851
2921
|
function onUploadStart() {
|
|
2852
2922
|
notifications.showNotification({
|
|
@@ -2887,12 +2957,11 @@
|
|
|
2887
2957
|
React.createElement(core$1.TextInput, { name: "text", ref: inputRef, placeholder: "Add comment", style: { width: '100%', maxWidth: 300 } }),
|
|
2888
2958
|
React.createElement(core$1.ActionIcon, { type: "submit", radius: "xl", color: "blue", variant: "filled" },
|
|
2889
2959
|
React.createElement(icons.IconMessage, { size: 16 })),
|
|
2890
|
-
React.createElement(AttachmentButton, { onUpload: createMedia, onUploadStart: onUploadStart, onUploadProgress: onUploadProgress }, (props) => (React.createElement(core$1.ActionIcon,
|
|
2960
|
+
React.createElement(AttachmentButton, { onUpload: createMedia, onUploadStart: onUploadStart, onUploadProgress: onUploadProgress }, (props) => (React.createElement(core$1.ActionIcon, { ...props, radius: "xl", color: "blue", variant: "filled" },
|
|
2891
2961
|
React.createElement(icons.IconCloudUpload, { size: 16 })))))))),
|
|
2892
2962
|
items.map((item) => {
|
|
2893
|
-
var _a;
|
|
2894
2963
|
if (item.resourceType === resource.resourceType && item.id === resource.id) {
|
|
2895
|
-
return (React.createElement(HistoryTimelineItem, { key:
|
|
2964
|
+
return (React.createElement(HistoryTimelineItem, { key: item.meta?.versionId, history: history, resource: item, onDetails: onVersionDetails }));
|
|
2896
2965
|
}
|
|
2897
2966
|
const key = `${item.resourceType}/${item.id}`;
|
|
2898
2967
|
switch (item.resourceType) {
|
|
@@ -2925,48 +2994,46 @@
|
|
|
2925
2994
|
function HistoryTimelineItem(props) {
|
|
2926
2995
|
const previous = getPrevious(props.history, props.resource);
|
|
2927
2996
|
if (previous) {
|
|
2928
|
-
return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu,
|
|
2997
|
+
return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu, { ...props }) },
|
|
2929
2998
|
React.createElement(ResourceDiffTable, { original: previous, revised: props.resource })));
|
|
2930
2999
|
}
|
|
2931
3000
|
else {
|
|
2932
|
-
return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu,
|
|
3001
|
+
return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu, { ...props }) },
|
|
2933
3002
|
React.createElement("h3", null, "Created"),
|
|
2934
3003
|
React.createElement(ResourceTable, { value: props.resource, ignoreMissingValues: true })));
|
|
2935
3004
|
}
|
|
2936
3005
|
}
|
|
2937
3006
|
function getPrevious(history, version) {
|
|
2938
3007
|
const entries = history.entry;
|
|
2939
|
-
const index = entries.findIndex((entry) =>
|
|
3008
|
+
const index = entries.findIndex((entry) => entry.resource?.meta?.versionId === version.meta?.versionId);
|
|
2940
3009
|
if (index >= entries.length - 1) {
|
|
2941
3010
|
return undefined;
|
|
2942
3011
|
}
|
|
2943
3012
|
return entries[index + 1].resource;
|
|
2944
3013
|
}
|
|
2945
3014
|
function CommunicationTimelineItem(props) {
|
|
2946
|
-
var _a, _b;
|
|
2947
3015
|
const { classes } = useStyles$7();
|
|
2948
3016
|
const routine = !props.resource.priority || props.resource.priority === 'routine';
|
|
2949
3017
|
const className = routine ? undefined : classes.pinnedComment;
|
|
2950
|
-
return (React.createElement(TimelineItem, { resource: props.resource, profile: props.resource.sender, padding: true, className: className, popupMenuItems: React.createElement(TimelineItemPopupMenu,
|
|
2951
|
-
React.createElement("p", null,
|
|
3018
|
+
return (React.createElement(TimelineItem, { resource: props.resource, profile: props.resource.sender, padding: true, className: className, popupMenuItems: React.createElement(TimelineItemPopupMenu, { ...props }) },
|
|
3019
|
+
React.createElement("p", null, props.resource.payload?.[0]?.contentString)));
|
|
2952
3020
|
}
|
|
2953
3021
|
function MediaTimelineItem(props) {
|
|
2954
|
-
|
|
2955
|
-
const contentType = (_a = props.resource.content) === null || _a === void 0 ? void 0 : _a.contentType;
|
|
3022
|
+
const contentType = props.resource.content?.contentType;
|
|
2956
3023
|
const padding = contentType &&
|
|
2957
3024
|
!contentType.startsWith('image/') &&
|
|
2958
3025
|
!contentType.startsWith('video/') &&
|
|
2959
3026
|
contentType !== 'application/pdf';
|
|
2960
|
-
return (React.createElement(TimelineItem, { resource: props.resource, padding: !!padding, popupMenuItems: React.createElement(TimelineItemPopupMenu,
|
|
3027
|
+
return (React.createElement(TimelineItem, { resource: props.resource, padding: !!padding, popupMenuItems: React.createElement(TimelineItemPopupMenu, { ...props }) },
|
|
2961
3028
|
React.createElement(AttachmentDisplay, { value: props.resource.content })));
|
|
2962
3029
|
}
|
|
2963
3030
|
function AuditEventTimelineItem(props) {
|
|
2964
|
-
return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu,
|
|
3031
|
+
return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu, { ...props }) },
|
|
2965
3032
|
React.createElement(core$1.ScrollArea, null,
|
|
2966
3033
|
React.createElement("pre", null, props.resource.outcomeDesc))));
|
|
2967
3034
|
}
|
|
2968
3035
|
function DiagnosticReportTimelineItem(props) {
|
|
2969
|
-
return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu,
|
|
3036
|
+
return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu, { ...props }) },
|
|
2970
3037
|
React.createElement(DiagnosticReportDisplay, { value: props.resource })));
|
|
2971
3038
|
}
|
|
2972
3039
|
function getProgressMessage(e) {
|
|
@@ -3136,7 +3203,12 @@
|
|
|
3136
3203
|
* @param {Array} filters The new filters.
|
|
3137
3204
|
*/
|
|
3138
3205
|
function setFilters(definition, filters) {
|
|
3139
|
-
return
|
|
3206
|
+
return {
|
|
3207
|
+
...definition,
|
|
3208
|
+
filters: filters,
|
|
3209
|
+
offset: 0,
|
|
3210
|
+
name: undefined,
|
|
3211
|
+
};
|
|
3140
3212
|
}
|
|
3141
3213
|
/**
|
|
3142
3214
|
* Clears all of the filters.
|
|
@@ -3185,7 +3257,11 @@
|
|
|
3185
3257
|
newFields.push(...definition.fields);
|
|
3186
3258
|
}
|
|
3187
3259
|
newFields.push(field);
|
|
3188
|
-
return
|
|
3260
|
+
return {
|
|
3261
|
+
...definition,
|
|
3262
|
+
fields: newFields,
|
|
3263
|
+
name: undefined,
|
|
3264
|
+
};
|
|
3189
3265
|
}
|
|
3190
3266
|
/**
|
|
3191
3267
|
* Deletes a filter at the specified index.
|
|
@@ -3198,7 +3274,11 @@
|
|
|
3198
3274
|
}
|
|
3199
3275
|
const newFilters = [...definition.filters];
|
|
3200
3276
|
newFilters.splice(index, 1);
|
|
3201
|
-
return
|
|
3277
|
+
return {
|
|
3278
|
+
...definition,
|
|
3279
|
+
filters: newFilters,
|
|
3280
|
+
name: undefined,
|
|
3281
|
+
};
|
|
3202
3282
|
}
|
|
3203
3283
|
/**
|
|
3204
3284
|
* Adds a filter that constrains the specified field to "yesterday".
|
|
@@ -3342,7 +3422,11 @@
|
|
|
3342
3422
|
if (definition.offset === offset) {
|
|
3343
3423
|
return definition;
|
|
3344
3424
|
}
|
|
3345
|
-
return
|
|
3425
|
+
return {
|
|
3426
|
+
...definition,
|
|
3427
|
+
offset,
|
|
3428
|
+
name: undefined,
|
|
3429
|
+
};
|
|
3346
3430
|
}
|
|
3347
3431
|
/**
|
|
3348
3432
|
* Creates a new search request with the search offset at the specified page.
|
|
@@ -3351,8 +3435,7 @@
|
|
|
3351
3435
|
* @return The new search definition.
|
|
3352
3436
|
*/
|
|
3353
3437
|
function setPage(definition, page) {
|
|
3354
|
-
|
|
3355
|
-
const count = (_a = definition.count) !== null && _a !== void 0 ? _a : core.DEFAULT_SEARCH_COUNT;
|
|
3438
|
+
const count = definition.count ?? core.DEFAULT_SEARCH_COUNT;
|
|
3356
3439
|
const newOffset = (page - 1) * count;
|
|
3357
3440
|
return setOffset(definition, newOffset);
|
|
3358
3441
|
}
|
|
@@ -3366,12 +3449,16 @@
|
|
|
3366
3449
|
if (sort === getSortField(definition) && desc !== undefined && desc === isSortDescending(definition)) {
|
|
3367
3450
|
return definition;
|
|
3368
3451
|
}
|
|
3369
|
-
return
|
|
3452
|
+
return {
|
|
3453
|
+
...definition,
|
|
3454
|
+
sortRules: [
|
|
3370
3455
|
{
|
|
3371
3456
|
code: sort,
|
|
3372
3457
|
descending: !!desc,
|
|
3373
3458
|
},
|
|
3374
|
-
],
|
|
3459
|
+
],
|
|
3460
|
+
name: undefined,
|
|
3461
|
+
};
|
|
3375
3462
|
}
|
|
3376
3463
|
/**
|
|
3377
3464
|
* Toggles the sort of the search by key.
|
|
@@ -3417,8 +3504,7 @@
|
|
|
3417
3504
|
* @return {string} A display string for the operation.
|
|
3418
3505
|
*/
|
|
3419
3506
|
function getOpString(op) {
|
|
3420
|
-
|
|
3421
|
-
return (_a = operatorNames[op]) !== null && _a !== void 0 ? _a : '';
|
|
3507
|
+
return operatorNames[op] ?? '';
|
|
3422
3508
|
}
|
|
3423
3509
|
/**
|
|
3424
3510
|
* Returns a field display name.
|
|
@@ -3459,16 +3545,15 @@
|
|
|
3459
3545
|
* @returns The fragment to display.
|
|
3460
3546
|
*/
|
|
3461
3547
|
function renderValue(resource, field) {
|
|
3462
|
-
var _a, _b;
|
|
3463
3548
|
const key = field.name;
|
|
3464
3549
|
if (key === 'id') {
|
|
3465
3550
|
return resource.id;
|
|
3466
3551
|
}
|
|
3467
3552
|
if (key === 'meta.versionId') {
|
|
3468
|
-
return
|
|
3553
|
+
return resource.meta?.versionId;
|
|
3469
3554
|
}
|
|
3470
3555
|
if (key === '_lastUpdated') {
|
|
3471
|
-
return core.formatDateTime(
|
|
3556
|
+
return core.formatDateTime(resource.meta?.lastUpdated);
|
|
3472
3557
|
}
|
|
3473
3558
|
// Priority 1: ElementDefinition by exact match
|
|
3474
3559
|
if (field.elementDefinition && `${resource.resourceType}.${field.name}` === field.elementDefinition.path) {
|
|
@@ -3488,8 +3573,7 @@
|
|
|
3488
3573
|
* @returns A React element or null.
|
|
3489
3574
|
*/
|
|
3490
3575
|
function renderPropertyValue(resource, elementDefinition) {
|
|
3491
|
-
|
|
3492
|
-
const path = ((_c = (_b = (_a = elementDefinition.path) === null || _a === void 0 ? void 0 : _a.split('.')) === null || _b === void 0 ? void 0 : _b.pop()) === null || _c === void 0 ? void 0 : _c.replaceAll('[x]', '')) || '';
|
|
3576
|
+
const path = elementDefinition.path?.split('.')?.pop()?.replaceAll('[x]', '') || '';
|
|
3493
3577
|
const [value, propertyType] = getValueAndType({ type: resource.resourceType, value: resource }, path);
|
|
3494
3578
|
if (!value) {
|
|
3495
3579
|
return null;
|
|
@@ -3515,7 +3599,6 @@
|
|
|
3515
3599
|
}
|
|
3516
3600
|
|
|
3517
3601
|
function SearchFieldEditor(props) {
|
|
3518
|
-
var _a;
|
|
3519
3602
|
const [state, setState] = React.useState({
|
|
3520
3603
|
search: JSON.parse(core.stringify(props.search)),
|
|
3521
3604
|
});
|
|
@@ -3565,13 +3648,15 @@
|
|
|
3565
3648
|
* Moves the "available" selection into the "selected" list.
|
|
3566
3649
|
*/
|
|
3567
3650
|
function onAddField() {
|
|
3568
|
-
|
|
3569
|
-
const
|
|
3570
|
-
const key = (_b = availableRef.current) === null || _b === void 0 ? void 0 : _b.value;
|
|
3651
|
+
const currentField = state.search.fields ?? [];
|
|
3652
|
+
const key = availableRef.current?.value;
|
|
3571
3653
|
if (key) {
|
|
3572
3654
|
const newFields = [...currentField, key];
|
|
3573
3655
|
setState({
|
|
3574
|
-
search:
|
|
3656
|
+
search: {
|
|
3657
|
+
...state.search,
|
|
3658
|
+
fields: newFields,
|
|
3659
|
+
},
|
|
3575
3660
|
});
|
|
3576
3661
|
}
|
|
3577
3662
|
}
|
|
@@ -3580,14 +3665,16 @@
|
|
|
3580
3665
|
* Moves the "selected" selection into the "available" list.
|
|
3581
3666
|
*/
|
|
3582
3667
|
function onRemoveField() {
|
|
3583
|
-
|
|
3584
|
-
const
|
|
3585
|
-
const key = (_b = selectedRef.current) === null || _b === void 0 ? void 0 : _b.value;
|
|
3668
|
+
const currentField = state.search.fields ?? [];
|
|
3669
|
+
const key = selectedRef.current?.value;
|
|
3586
3670
|
if (key) {
|
|
3587
3671
|
const newFields = [...currentField];
|
|
3588
3672
|
newFields.splice(newFields.indexOf(key), 1);
|
|
3589
3673
|
setState({
|
|
3590
|
-
search:
|
|
3674
|
+
search: {
|
|
3675
|
+
...state.search,
|
|
3676
|
+
fields: newFields,
|
|
3677
|
+
},
|
|
3591
3678
|
});
|
|
3592
3679
|
}
|
|
3593
3680
|
}
|
|
@@ -3596,15 +3683,17 @@
|
|
|
3596
3683
|
* Moves the selection up one position in the list.
|
|
3597
3684
|
*/
|
|
3598
3685
|
function onMoveUp() {
|
|
3599
|
-
|
|
3600
|
-
const
|
|
3601
|
-
const field = (_b = selectedRef.current) === null || _b === void 0 ? void 0 : _b.value;
|
|
3686
|
+
const currentField = state.search.fields ?? [];
|
|
3687
|
+
const field = selectedRef.current?.value;
|
|
3602
3688
|
if (field) {
|
|
3603
3689
|
const newFields = [...currentField];
|
|
3604
3690
|
const index = newFields.indexOf(field);
|
|
3605
3691
|
swapFields(newFields, index, index - 1);
|
|
3606
3692
|
setState({
|
|
3607
|
-
search:
|
|
3693
|
+
search: {
|
|
3694
|
+
...state.search,
|
|
3695
|
+
fields: newFields,
|
|
3696
|
+
},
|
|
3608
3697
|
});
|
|
3609
3698
|
}
|
|
3610
3699
|
}
|
|
@@ -3613,15 +3702,17 @@
|
|
|
3613
3702
|
* Moves the selection down one position in the list.
|
|
3614
3703
|
*/
|
|
3615
3704
|
function onMoveDown() {
|
|
3616
|
-
|
|
3617
|
-
const
|
|
3618
|
-
const field = (_b = selectedRef.current) === null || _b === void 0 ? void 0 : _b.value;
|
|
3705
|
+
const currentField = state.search.fields ?? [];
|
|
3706
|
+
const field = selectedRef.current?.value;
|
|
3619
3707
|
if (field) {
|
|
3620
3708
|
const newFields = [...currentField];
|
|
3621
3709
|
const index = newFields.indexOf(field);
|
|
3622
3710
|
swapFields(newFields, index, index + 1);
|
|
3623
3711
|
setState({
|
|
3624
|
-
search:
|
|
3712
|
+
search: {
|
|
3713
|
+
...state.search,
|
|
3714
|
+
fields: newFields,
|
|
3715
|
+
},
|
|
3625
3716
|
});
|
|
3626
3717
|
}
|
|
3627
3718
|
}
|
|
@@ -3641,9 +3732,9 @@
|
|
|
3641
3732
|
}
|
|
3642
3733
|
const resourceType = props.search.resourceType;
|
|
3643
3734
|
const typeDef = core.globalSchema.types[resourceType];
|
|
3644
|
-
const selected =
|
|
3735
|
+
const selected = state.search.fields ?? [];
|
|
3645
3736
|
const available = getFieldsList(typeDef)
|
|
3646
|
-
.filter((field) => !
|
|
3737
|
+
.filter((field) => !selected?.includes(field))
|
|
3647
3738
|
.sort();
|
|
3648
3739
|
return (React.createElement(core$1.Modal, { title: "Fields", closeButtonLabel: "Close", opened: props.visible, onClose: props.onCancel },
|
|
3649
3740
|
React.createElement("div", null,
|
|
@@ -3700,9 +3791,8 @@
|
|
|
3700
3791
|
}
|
|
3701
3792
|
|
|
3702
3793
|
function SearchFilterValueDisplay(props) {
|
|
3703
|
-
var _a, _b;
|
|
3704
3794
|
const { resourceType, filter } = props;
|
|
3705
|
-
const searchParam =
|
|
3795
|
+
const searchParam = core.globalSchema.types[resourceType]?.searchParams?.[filter.code];
|
|
3706
3796
|
if (searchParam) {
|
|
3707
3797
|
if (searchParam.type === 'reference') {
|
|
3708
3798
|
return React.createElement(ResourceName, { value: { reference: filter.value } });
|
|
@@ -3716,12 +3806,11 @@
|
|
|
3716
3806
|
}
|
|
3717
3807
|
|
|
3718
3808
|
function SearchFilterValueInput(props) {
|
|
3719
|
-
var _a;
|
|
3720
3809
|
const details = core.getSearchParameterDetails(props.resourceType, props.searchParam);
|
|
3721
3810
|
const name = 'filter-value';
|
|
3722
3811
|
switch (details.type) {
|
|
3723
3812
|
case core.SearchParameterType.REFERENCE:
|
|
3724
|
-
return (React.createElement(ReferenceInput, { name: name, defaultValue: { reference: props.defaultValue }, targetTypes:
|
|
3813
|
+
return (React.createElement(ReferenceInput, { name: name, defaultValue: { reference: props.defaultValue }, targetTypes: props.searchParam?.target, onChange: (newReference) => {
|
|
3725
3814
|
if (newReference) {
|
|
3726
3815
|
props.onChange(newReference.reference);
|
|
3727
3816
|
}
|
|
@@ -3825,18 +3914,17 @@
|
|
|
3825
3914
|
React.createElement(core$1.Button, { compact: true, variant: "outline", onClick: props.onDelete }, "Delete"))));
|
|
3826
3915
|
}
|
|
3827
3916
|
function FilterRowInput(props) {
|
|
3828
|
-
|
|
3829
|
-
const [value, setValue] = React.useState((_a = props.defaultValue) !== null && _a !== void 0 ? _a : {});
|
|
3917
|
+
const [value, setValue] = React.useState(props.defaultValue ?? {});
|
|
3830
3918
|
const valueRef = React.useRef(value);
|
|
3831
3919
|
valueRef.current = value;
|
|
3832
3920
|
function setFilterCode(newCode) {
|
|
3833
|
-
setValue(
|
|
3921
|
+
setValue({ ...valueRef.current, code: newCode });
|
|
3834
3922
|
}
|
|
3835
3923
|
function setFilterOperator(newOperator) {
|
|
3836
|
-
setValue(
|
|
3924
|
+
setValue({ ...valueRef.current, operator: newOperator });
|
|
3837
3925
|
}
|
|
3838
3926
|
function setFilterValue(newFilterValue) {
|
|
3839
|
-
setValue(
|
|
3927
|
+
setValue({ ...valueRef.current, value: newFilterValue });
|
|
3840
3928
|
}
|
|
3841
3929
|
const searchParam = props.searchParams[value.code];
|
|
3842
3930
|
const operators = searchParam && getSearchOperators(searchParam);
|
|
@@ -3854,13 +3942,12 @@
|
|
|
3854
3942
|
}
|
|
3855
3943
|
|
|
3856
3944
|
function SearchFilterValueDialog(props) {
|
|
3857
|
-
|
|
3858
|
-
const [value, setValue] = React.useState((_a = props.defaultValue) !== null && _a !== void 0 ? _a : '');
|
|
3945
|
+
const [value, setValue] = React.useState(props.defaultValue ?? '');
|
|
3859
3946
|
if (!props.visible || !props.searchParam || !props.filter) {
|
|
3860
3947
|
return null;
|
|
3861
3948
|
}
|
|
3862
3949
|
function onOk() {
|
|
3863
|
-
props.onOk(
|
|
3950
|
+
props.onOk({ ...props.filter, value });
|
|
3864
3951
|
}
|
|
3865
3952
|
return (React.createElement(core$1.Modal, { title: props.title, size: "xl", opened: props.visible, onClose: props.onCancel },
|
|
3866
3953
|
React.createElement("div", { style: { width: 500 } },
|
|
@@ -3895,16 +3982,16 @@
|
|
|
3895
3982
|
function SearchParameterSubMenu(props) {
|
|
3896
3983
|
switch (props.searchParam.type) {
|
|
3897
3984
|
case 'date':
|
|
3898
|
-
return React.createElement(DateFilterSubMenu,
|
|
3985
|
+
return React.createElement(DateFilterSubMenu, { ...props });
|
|
3899
3986
|
case 'number':
|
|
3900
3987
|
case 'quantity':
|
|
3901
|
-
return React.createElement(NumericFilterSubMenu,
|
|
3988
|
+
return React.createElement(NumericFilterSubMenu, { ...props });
|
|
3902
3989
|
case 'reference':
|
|
3903
|
-
return React.createElement(ReferenceFilterSubMenu,
|
|
3990
|
+
return React.createElement(ReferenceFilterSubMenu, { ...props });
|
|
3904
3991
|
case 'string':
|
|
3905
3992
|
case 'token':
|
|
3906
3993
|
case 'uri':
|
|
3907
|
-
return React.createElement(TextFilterSubMenu,
|
|
3994
|
+
return React.createElement(TextFilterSubMenu, { ...props });
|
|
3908
3995
|
default:
|
|
3909
3996
|
return React.createElement(React.Fragment, null,
|
|
3910
3997
|
"Unknown search param type: ",
|
|
@@ -3934,7 +4021,7 @@
|
|
|
3934
4021
|
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconCalendar, { size: 14 }), onClick: () => props.onChange(addLastMonthFilter(props.search, code)) }, "Last Month"),
|
|
3935
4022
|
React.createElement(core$1.Menu.Divider, null),
|
|
3936
4023
|
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconCalendar, { size: 14 }), onClick: () => props.onChange(addYearToDateFilter(props.search, code)) }, "Year to date"),
|
|
3937
|
-
React.createElement(CommonMenuItems,
|
|
4024
|
+
React.createElement(CommonMenuItems, { ...props })));
|
|
3938
4025
|
}
|
|
3939
4026
|
function NumericFilterSubMenu(props) {
|
|
3940
4027
|
const { searchParam } = props;
|
|
@@ -3949,14 +4036,14 @@
|
|
|
3949
4036
|
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..."),
|
|
3950
4037
|
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconMathLower, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.LESS_THAN) }, "Less than..."),
|
|
3951
4038
|
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..."),
|
|
3952
|
-
React.createElement(CommonMenuItems,
|
|
4039
|
+
React.createElement(CommonMenuItems, { ...props })));
|
|
3953
4040
|
}
|
|
3954
4041
|
function ReferenceFilterSubMenu(props) {
|
|
3955
4042
|
const { searchParam } = props;
|
|
3956
4043
|
return (React.createElement(core$1.Menu.Dropdown, null,
|
|
3957
4044
|
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconEqual, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.EQUALS) }, "Equals..."),
|
|
3958
4045
|
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconEqualNot, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.NOT) }, "Does not equal..."),
|
|
3959
|
-
React.createElement(CommonMenuItems,
|
|
4046
|
+
React.createElement(CommonMenuItems, { ...props })));
|
|
3960
4047
|
}
|
|
3961
4048
|
function TextFilterSubMenu(props) {
|
|
3962
4049
|
const { searchParam } = props;
|
|
@@ -3969,7 +4056,7 @@
|
|
|
3969
4056
|
React.createElement(core$1.Menu.Divider, null),
|
|
3970
4057
|
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconBucket, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.CONTAINS) }, "Contains..."),
|
|
3971
4058
|
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconBucketOff, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.EQUALS) }, "Does not contain..."),
|
|
3972
|
-
React.createElement(CommonMenuItems,
|
|
4059
|
+
React.createElement(CommonMenuItems, { ...props })));
|
|
3973
4060
|
}
|
|
3974
4061
|
function CommonMenuItems(props) {
|
|
3975
4062
|
const { searchParam } = props;
|
|
@@ -4003,7 +4090,6 @@
|
|
|
4003
4090
|
* @returns The field definition.
|
|
4004
4091
|
*/
|
|
4005
4092
|
function getFieldDefinition(resourceType, name) {
|
|
4006
|
-
var _a;
|
|
4007
4093
|
if (name === '_lastUpdated') {
|
|
4008
4094
|
return {
|
|
4009
4095
|
name: '_lastUpdated',
|
|
@@ -4036,7 +4122,7 @@
|
|
|
4036
4122
|
}
|
|
4037
4123
|
const typeSchema = core.globalSchema.types[resourceType];
|
|
4038
4124
|
const exactElementDefinition = typeSchema.properties[name];
|
|
4039
|
-
const exactSearchParam =
|
|
4125
|
+
const exactSearchParam = typeSchema.searchParams?.[name.toLowerCase()];
|
|
4040
4126
|
// Best case: Exact match of element definition or search parameter.
|
|
4041
4127
|
// Examples: ServiceRequest.subject, Patient.name, Patient.birthDate
|
|
4042
4128
|
// In this case, we only show the one search parameter.
|
|
@@ -4051,7 +4137,7 @@
|
|
|
4051
4137
|
let searchParams = undefined;
|
|
4052
4138
|
if (typeSchema.searchParams) {
|
|
4053
4139
|
const path = `${resourceType}.${name.replaceAll('[x]', '')}`;
|
|
4054
|
-
searchParams = Object.values(typeSchema.searchParams).filter((p) =>
|
|
4140
|
+
searchParams = Object.values(typeSchema.searchParams).filter((p) => p.expression?.includes(path));
|
|
4055
4141
|
if (searchParams.length === 0) {
|
|
4056
4142
|
searchParams = undefined;
|
|
4057
4143
|
}
|
|
@@ -4130,7 +4216,6 @@
|
|
|
4130
4216
|
* It does not include the field editor, filter editor, pagination buttons.
|
|
4131
4217
|
*/
|
|
4132
4218
|
function SearchControl(props) {
|
|
4133
|
-
var _a, _b, _c;
|
|
4134
4219
|
const { classes } = useStyles$6();
|
|
4135
4220
|
const medplum = useMedplum();
|
|
4136
4221
|
const [schemaLoaded, setSchemaLoaded] = React.useState(false);
|
|
@@ -4147,15 +4232,15 @@
|
|
|
4147
4232
|
React.useEffect(() => {
|
|
4148
4233
|
setOutcome(undefined);
|
|
4149
4234
|
medplum
|
|
4150
|
-
.search(search.resourceType, core.formatSearchQuery(
|
|
4235
|
+
.search(search.resourceType, core.formatSearchQuery({ ...search, total: 'accurate', fields: undefined }))
|
|
4151
4236
|
.then((response) => {
|
|
4152
|
-
setState(
|
|
4237
|
+
setState({ ...stateRef.current, searchResponse: response });
|
|
4153
4238
|
if (onLoad) {
|
|
4154
4239
|
onLoad(new SearchLoadEvent(response));
|
|
4155
4240
|
}
|
|
4156
4241
|
})
|
|
4157
4242
|
.catch((reason) => {
|
|
4158
|
-
setState(
|
|
4243
|
+
setState({ ...stateRef.current, searchResponse: undefined });
|
|
4159
4244
|
setOutcome(reason);
|
|
4160
4245
|
});
|
|
4161
4246
|
}, [medplum, search, onLoad]);
|
|
@@ -4163,40 +4248,37 @@
|
|
|
4163
4248
|
e.stopPropagation();
|
|
4164
4249
|
const el = e.target;
|
|
4165
4250
|
const checked = el.checked;
|
|
4166
|
-
const newSelected =
|
|
4251
|
+
const newSelected = { ...stateRef.current.selected };
|
|
4167
4252
|
if (checked) {
|
|
4168
4253
|
newSelected[id] = true;
|
|
4169
4254
|
}
|
|
4170
4255
|
else {
|
|
4171
4256
|
delete newSelected[id];
|
|
4172
4257
|
}
|
|
4173
|
-
setState(
|
|
4258
|
+
setState({ ...stateRef.current, selected: newSelected });
|
|
4174
4259
|
}
|
|
4175
4260
|
function handleAllCheckboxClick(e) {
|
|
4176
|
-
var _a;
|
|
4177
4261
|
e.stopPropagation();
|
|
4178
4262
|
const el = e.target;
|
|
4179
4263
|
const checked = el.checked;
|
|
4180
4264
|
const newSelected = {};
|
|
4181
|
-
const searchResponse =
|
|
4182
|
-
if (checked &&
|
|
4265
|
+
const searchResponse = stateRef.current?.searchResponse;
|
|
4266
|
+
if (checked && searchResponse?.entry) {
|
|
4183
4267
|
searchResponse.entry.forEach((entry) => {
|
|
4184
|
-
|
|
4185
|
-
if ((_a = entry.resource) === null || _a === void 0 ? void 0 : _a.id) {
|
|
4268
|
+
if (entry.resource?.id) {
|
|
4186
4269
|
newSelected[entry.resource.id] = true;
|
|
4187
4270
|
}
|
|
4188
4271
|
});
|
|
4189
4272
|
}
|
|
4190
|
-
setState(
|
|
4273
|
+
setState({ ...stateRef.current, selected: newSelected });
|
|
4191
4274
|
}
|
|
4192
4275
|
function isAllSelected() {
|
|
4193
|
-
var _a, _b;
|
|
4194
4276
|
const state = stateRef.current;
|
|
4195
|
-
if (!
|
|
4277
|
+
if (!state.searchResponse?.entry || state.searchResponse.entry.length === 0) {
|
|
4196
4278
|
return false;
|
|
4197
4279
|
}
|
|
4198
4280
|
for (const e of state.searchResponse.entry) {
|
|
4199
|
-
if (
|
|
4281
|
+
if (e.resource?.id && !state.selected[e.resource.id]) {
|
|
4200
4282
|
return false;
|
|
4201
4283
|
}
|
|
4202
4284
|
}
|
|
@@ -4241,7 +4323,7 @@
|
|
|
4241
4323
|
.then(() => setSchemaLoaded(true))
|
|
4242
4324
|
.catch(console.log);
|
|
4243
4325
|
}, [medplum, props.search.resourceType]);
|
|
4244
|
-
const typeSchema = schemaLoaded &&
|
|
4326
|
+
const typeSchema = schemaLoaded && core.globalSchema?.types?.[props.search.resourceType];
|
|
4245
4327
|
if (!typeSchema) {
|
|
4246
4328
|
return (React.createElement(core$1.Center, { style: { width: '100%', height: '100%' } },
|
|
4247
4329
|
React.createElement(core$1.Loader, null)));
|
|
@@ -4250,8 +4332,8 @@
|
|
|
4250
4332
|
const fields = getFieldDefinitions(search);
|
|
4251
4333
|
const resourceType = search.resourceType;
|
|
4252
4334
|
const lastResult = state.searchResponse;
|
|
4253
|
-
const entries = lastResult
|
|
4254
|
-
const resources = entries
|
|
4335
|
+
const entries = lastResult?.entry;
|
|
4336
|
+
const resources = entries?.map((e) => e.resource);
|
|
4255
4337
|
const buttonVariant = 'subtle';
|
|
4256
4338
|
const buttonColor = 'gray';
|
|
4257
4339
|
const iconSize = 16;
|
|
@@ -4259,8 +4341,8 @@
|
|
|
4259
4341
|
return (React.createElement("div", { className: classes.root, "data-testid": "search-control" },
|
|
4260
4342
|
!props.hideToolbar && (React.createElement(core$1.Group, { position: "apart", mb: "xl" },
|
|
4261
4343
|
React.createElement(core$1.Group, { spacing: 2 },
|
|
4262
|
-
React.createElement(core$1.Button, { compact: true, variant: buttonVariant, color: buttonColor, leftIcon: React.createElement(icons.IconFilter, { size: iconSize }), onClick: () => setState(
|
|
4263
|
-
React.createElement(core$1.Button, { compact: true, variant: buttonVariant, color: buttonColor, leftIcon: React.createElement(icons.IconColumns, { size: iconSize }), onClick: () => setState(
|
|
4344
|
+
React.createElement(core$1.Button, { compact: true, variant: buttonVariant, color: buttonColor, leftIcon: React.createElement(icons.IconFilter, { size: iconSize }), onClick: () => setState({ ...stateRef.current, fieldEditorVisible: true }) }, "Fields"),
|
|
4345
|
+
React.createElement(core$1.Button, { compact: true, variant: buttonVariant, color: buttonColor, leftIcon: React.createElement(icons.IconColumns, { size: iconSize }), onClick: () => setState({ ...stateRef.current, filterEditorVisible: true }) }, "Filters"),
|
|
4264
4346
|
props.onNew && (React.createElement(core$1.Button, { compact: true, variant: buttonVariant, color: buttonColor, leftIcon: React.createElement(icons.IconFilePlus, { size: iconSize }), onClick: props.onNew }, "New...")),
|
|
4265
4347
|
!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...")),
|
|
4266
4348
|
!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...")),
|
|
@@ -4270,8 +4352,8 @@
|
|
|
4270
4352
|
"-",
|
|
4271
4353
|
getEnd$1(search, lastResult.total),
|
|
4272
4354
|
" of",
|
|
4273
|
-
' ',
|
|
4274
|
-
|
|
4355
|
+
' ',
|
|
4356
|
+
lastResult.total?.toLocaleString())))),
|
|
4275
4357
|
React.createElement(core$1.Table, { className: classes.table },
|
|
4276
4358
|
React.createElement("thead", null,
|
|
4277
4359
|
React.createElement("tr", null,
|
|
@@ -4286,21 +4368,26 @@
|
|
|
4286
4368
|
React.createElement(core$1.Center, { className: classes.icon },
|
|
4287
4369
|
React.createElement(icons.IconAdjustmentsHorizontal, { size: 14, stroke: 1.5 }))))),
|
|
4288
4370
|
React.createElement(SearchPopupMenu, { search: props.search, searchParams: field.searchParams, onPrompt: (searchParam, filter) => {
|
|
4289
|
-
setState(
|
|
4371
|
+
setState({
|
|
4372
|
+
...stateRef.current,
|
|
4373
|
+
filterDialogVisible: true,
|
|
4374
|
+
filterDialogSearchParam: searchParam,
|
|
4375
|
+
filterDialogFilter: filter,
|
|
4376
|
+
});
|
|
4290
4377
|
}, onChange: (result) => {
|
|
4291
4378
|
emitSearchChange(result);
|
|
4292
4379
|
} })))))),
|
|
4293
4380
|
!props.hideFilters && (React.createElement("tr", null,
|
|
4294
4381
|
checkboxColumn && React.createElement("th", null),
|
|
4295
4382
|
fields.map((field) => (React.createElement("th", { key: field.name }, field.searchParams && (React.createElement(FilterDescription, { resourceType: resourceType, searchParams: field.searchParams, filters: props.search.filters })))))))),
|
|
4296
|
-
React.createElement("tbody", null, resources
|
|
4383
|
+
React.createElement("tbody", null, 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) },
|
|
4297
4384
|
checkboxColumn && (React.createElement("td", null,
|
|
4298
4385
|
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) }))),
|
|
4299
4386
|
fields.map((field) => (React.createElement("td", { key: field.name }, renderValue(resource, field))))))))),
|
|
4300
|
-
|
|
4387
|
+
resources?.length === 0 && (React.createElement(Container, null,
|
|
4301
4388
|
React.createElement(core$1.Center, null,
|
|
4302
4389
|
React.createElement(core$1.Text, { size: "xl", color: "dimmed" }, "No results")))),
|
|
4303
|
-
|
|
4390
|
+
lastResult?.total !== undefined && lastResult.total > 0 && (React.createElement(core$1.Center, { m: "md", p: "md" },
|
|
4304
4391
|
React.createElement(core$1.Pagination, { page: getPage(search), total: getTotalPages(search, lastResult.total), onChange: (newPage) => emitSearchChange(setPage(search, newPage)), getItemAriaLabel: (page) => {
|
|
4305
4392
|
switch (page) {
|
|
4306
4393
|
case 'prev':
|
|
@@ -4315,27 +4402,44 @@
|
|
|
4315
4402
|
React.createElement("pre", { style: { textAlign: 'left' } }, JSON.stringify(outcome, undefined, 2)))),
|
|
4316
4403
|
React.createElement(SearchFieldEditor, { search: props.search, visible: stateRef.current.fieldEditorVisible, onOk: (result) => {
|
|
4317
4404
|
emitSearchChange(result);
|
|
4318
|
-
setState(
|
|
4405
|
+
setState({
|
|
4406
|
+
...stateRef.current,
|
|
4407
|
+
fieldEditorVisible: false,
|
|
4408
|
+
});
|
|
4319
4409
|
}, onCancel: () => {
|
|
4320
|
-
setState(
|
|
4410
|
+
setState({
|
|
4411
|
+
...stateRef.current,
|
|
4412
|
+
fieldEditorVisible: false,
|
|
4413
|
+
});
|
|
4321
4414
|
} }),
|
|
4322
4415
|
React.createElement(SearchFilterEditor, { search: props.search, visible: stateRef.current.filterEditorVisible, onOk: (result) => {
|
|
4323
4416
|
emitSearchChange(result);
|
|
4324
|
-
setState(
|
|
4417
|
+
setState({
|
|
4418
|
+
...stateRef.current,
|
|
4419
|
+
filterEditorVisible: false,
|
|
4420
|
+
});
|
|
4325
4421
|
}, onCancel: () => {
|
|
4326
|
-
setState(
|
|
4422
|
+
setState({
|
|
4423
|
+
...stateRef.current,
|
|
4424
|
+
filterEditorVisible: false,
|
|
4425
|
+
});
|
|
4327
4426
|
} }),
|
|
4328
|
-
React.createElement(SearchFilterValueDialog, { key:
|
|
4427
|
+
React.createElement(SearchFilterValueDialog, { key: state.filterDialogSearchParam?.code, visible: stateRef.current.filterDialogVisible, title: 'Input', resourceType: resourceType, searchParam: state.filterDialogSearchParam, filter: state.filterDialogFilter, defaultValue: '', onOk: (filter) => {
|
|
4329
4428
|
emitSearchChange(addFilter(props.search, filter.code, filter.operator, filter.value));
|
|
4330
|
-
setState(
|
|
4429
|
+
setState({
|
|
4430
|
+
...stateRef.current,
|
|
4431
|
+
filterDialogVisible: false,
|
|
4432
|
+
});
|
|
4331
4433
|
}, onCancel: () => {
|
|
4332
|
-
setState(
|
|
4434
|
+
setState({
|
|
4435
|
+
...stateRef.current,
|
|
4436
|
+
filterDialogVisible: false,
|
|
4437
|
+
});
|
|
4333
4438
|
} })));
|
|
4334
4439
|
}
|
|
4335
4440
|
const MemoizedSearchControl = React.memo(SearchControl);
|
|
4336
4441
|
function FilterDescription(props) {
|
|
4337
|
-
|
|
4338
|
-
const filters = ((_a = props.filters) !== null && _a !== void 0 ? _a : []).filter((f) => props.searchParams.find((p) => p.code === f.code));
|
|
4442
|
+
const filters = (props.filters ?? []).filter((f) => props.searchParams.find((p) => p.code === f.code));
|
|
4339
4443
|
if (filters.length === 0) {
|
|
4340
4444
|
return React.createElement("span", null, "no filters");
|
|
4341
4445
|
}
|
|
@@ -4352,19 +4456,16 @@
|
|
|
4352
4456
|
return Math.ceil(total / pageSize);
|
|
4353
4457
|
}
|
|
4354
4458
|
function getStart$1(search, total) {
|
|
4355
|
-
|
|
4356
|
-
return Math.min(total, ((_a = search.offset) !== null && _a !== void 0 ? _a : 0) + 1);
|
|
4459
|
+
return Math.min(total, (search.offset ?? 0) + 1);
|
|
4357
4460
|
}
|
|
4358
4461
|
function getEnd$1(search, total) {
|
|
4359
|
-
|
|
4360
|
-
return Math.min(total, (((_a = search.offset) !== null && _a !== void 0 ? _a : 0) + 1) * ((_b = search.count) !== null && _b !== void 0 ? _b : core.DEFAULT_SEARCH_COUNT));
|
|
4462
|
+
return Math.min(total, ((search.offset ?? 0) + 1) * (search.count ?? core.DEFAULT_SEARCH_COUNT));
|
|
4361
4463
|
}
|
|
4362
4464
|
|
|
4363
4465
|
/**
|
|
4364
4466
|
* The FhirPathTable component represents the embeddable search table control.
|
|
4365
4467
|
*/
|
|
4366
4468
|
function FhirPathTable(props) {
|
|
4367
|
-
var _a, _b, _c, _d, _e;
|
|
4368
4469
|
const medplum = useMedplum();
|
|
4369
4470
|
const [schema, setSchema] = React.useState();
|
|
4370
4471
|
const [outcome, setOutcome] = React.useState();
|
|
@@ -4383,7 +4484,7 @@
|
|
|
4383
4484
|
e.stopPropagation();
|
|
4384
4485
|
const el = e.target;
|
|
4385
4486
|
const checked = el.checked;
|
|
4386
|
-
const newSelected =
|
|
4487
|
+
const newSelected = { ...selectedRef.current };
|
|
4387
4488
|
if (checked) {
|
|
4388
4489
|
newSelected[id] = true;
|
|
4389
4490
|
}
|
|
@@ -4393,15 +4494,14 @@
|
|
|
4393
4494
|
setSelected(newSelected);
|
|
4394
4495
|
}
|
|
4395
4496
|
function handleAllCheckboxClick(e) {
|
|
4396
|
-
var _a, _b;
|
|
4397
4497
|
e.stopPropagation();
|
|
4398
4498
|
const el = e.target;
|
|
4399
4499
|
const checked = el.checked;
|
|
4400
4500
|
const newSelected = {};
|
|
4401
|
-
const resources =
|
|
4501
|
+
const resources = responseRef.current?.data?.ResourceList;
|
|
4402
4502
|
if (checked && resources) {
|
|
4403
4503
|
resources.forEach((resource) => {
|
|
4404
|
-
if (resource
|
|
4504
|
+
if (resource?.id) {
|
|
4405
4505
|
newSelected[resource.id] = true;
|
|
4406
4506
|
}
|
|
4407
4507
|
});
|
|
@@ -4409,13 +4509,12 @@
|
|
|
4409
4509
|
setSelected(newSelected);
|
|
4410
4510
|
}
|
|
4411
4511
|
function isAllSelected() {
|
|
4412
|
-
|
|
4413
|
-
const resources = (_b = (_a = responseRef.current) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.ResourceList;
|
|
4512
|
+
const resources = responseRef.current?.data?.ResourceList;
|
|
4414
4513
|
if (!resources || resources.length === 0) {
|
|
4415
4514
|
return false;
|
|
4416
4515
|
}
|
|
4417
4516
|
for (const resource of resources) {
|
|
4418
|
-
if (
|
|
4517
|
+
if (resource?.id && !selectedRef.current[resource.id]) {
|
|
4419
4518
|
return false;
|
|
4420
4519
|
}
|
|
4421
4520
|
}
|
|
@@ -4440,11 +4539,11 @@
|
|
|
4440
4539
|
.then((newSchema) => {
|
|
4441
4540
|
// The schema could have the same object identity,
|
|
4442
4541
|
// so need to use the spread operator to kick React re-render.
|
|
4443
|
-
setSchema(
|
|
4542
|
+
setSchema({ ...newSchema });
|
|
4444
4543
|
})
|
|
4445
4544
|
.catch(console.log);
|
|
4446
4545
|
}, [medplum, props.resourceType]);
|
|
4447
|
-
const typeSchema =
|
|
4546
|
+
const typeSchema = schema?.types?.[props.resourceType];
|
|
4448
4547
|
if (!typeSchema) {
|
|
4449
4548
|
return React.createElement(core$1.Loader, null);
|
|
4450
4549
|
}
|
|
@@ -4456,14 +4555,14 @@
|
|
|
4456
4555
|
checkboxColumn && (React.createElement("th", null,
|
|
4457
4556
|
React.createElement("input", { type: "checkbox", value: "checked", "aria-label": "all-checkbox", "data-testid": "all-checkbox", checked: isAllSelected(), onChange: (e) => handleAllCheckboxClick(e) }))),
|
|
4458
4557
|
fields.map((field) => (React.createElement("th", { key: field.name }, field.name))))),
|
|
4459
|
-
React.createElement("tbody", null,
|
|
4558
|
+
React.createElement("tbody", null, response?.data?.ResourceList?.map((resource) => resource && (React.createElement("tr", { key: resource.id, "data-testid": "search-control-row", onClick: (e) => handleRowClick(e, resource), onAuxClick: (e) => handleRowClick(e, resource) },
|
|
4460
4559
|
checkboxColumn && (React.createElement("td", null,
|
|
4461
4560
|
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) }))),
|
|
4462
4561
|
fields.map((field) => {
|
|
4463
4562
|
return (React.createElement("td", { key: field.name },
|
|
4464
4563
|
React.createElement(FhirPathDisplay, { propertyType: field.propertyType, path: field.fhirPath, resource: resource })));
|
|
4465
4564
|
})))))),
|
|
4466
|
-
|
|
4565
|
+
response?.data?.ResourceList?.length === 0 && React.createElement("div", { "data-testid": "empty-search" }, "No results"),
|
|
4467
4566
|
outcome && (React.createElement("div", { "data-testid": "search-error" },
|
|
4468
4567
|
React.createElement("pre", { style: { textAlign: 'left' } }, JSON.stringify(outcome, undefined, 2)))),
|
|
4469
4568
|
props.onBulk && (React.createElement(core$1.Button, { onClick: () => props.onBulk(Object.keys(selectedRef.current)) }, "Bulk..."))));
|
|
@@ -4551,7 +4650,7 @@
|
|
|
4551
4650
|
medplum.requestSchema('PlanDefinition').then(setSchema).catch(console.log);
|
|
4552
4651
|
}, [medplum]);
|
|
4553
4652
|
React.useEffect(() => {
|
|
4554
|
-
setValue(ensurePlanDefinitionKeys(defaultValue
|
|
4653
|
+
setValue(ensurePlanDefinitionKeys(defaultValue ?? { resourceType: 'PlanDefinition' }));
|
|
4555
4654
|
document.addEventListener('mouseover', handleDocumentMouseOver);
|
|
4556
4655
|
document.addEventListener('click', handleDocumentClick);
|
|
4557
4656
|
return () => {
|
|
@@ -4563,7 +4662,10 @@
|
|
|
4563
4662
|
return null;
|
|
4564
4663
|
}
|
|
4565
4664
|
function changeProperty(property, newValue) {
|
|
4566
|
-
setValue(
|
|
4665
|
+
setValue({
|
|
4666
|
+
...valueRef.current,
|
|
4667
|
+
[property]: newValue,
|
|
4668
|
+
});
|
|
4567
4669
|
}
|
|
4568
4670
|
return (React.createElement("div", null,
|
|
4569
4671
|
React.createElement(Form, { testid: "questionnaire-form", onSubmit: () => props.onSubmit(value) },
|
|
@@ -4643,7 +4745,10 @@
|
|
|
4643
4745
|
const { action } = props;
|
|
4644
4746
|
const [actionType, setActionType] = React.useState(props.actionType);
|
|
4645
4747
|
function changeProperty(property, value) {
|
|
4646
|
-
props.onChange(
|
|
4748
|
+
props.onChange({
|
|
4749
|
+
...action,
|
|
4750
|
+
[property]: value,
|
|
4751
|
+
});
|
|
4647
4752
|
}
|
|
4648
4753
|
return (React.createElement(core$1.Stack, { spacing: "xl" },
|
|
4649
4754
|
React.createElement(core$1.TextInput, { name: `actionTitle-${action.id}`, label: "Title", defaultValue: action.title, onChange: (e) => changeProperty('title', e.currentTarget.value) }),
|
|
@@ -4669,15 +4774,15 @@
|
|
|
4669
4774
|
}
|
|
4670
4775
|
function ActionResourceTypeBuilder(props) {
|
|
4671
4776
|
const { id, definitionCanonical } = props.action;
|
|
4672
|
-
const reference =
|
|
4777
|
+
const reference = definitionCanonical?.startsWith(props.resourceType + '/')
|
|
4673
4778
|
? { reference: definitionCanonical }
|
|
4674
4779
|
: undefined;
|
|
4675
4780
|
return (React.createElement(ResourceInput, { name: id, resourceType: props.resourceType, defaultValue: reference, loadOnFocus: true, onChange: (newValue) => {
|
|
4676
4781
|
if (newValue) {
|
|
4677
|
-
props.onChange(
|
|
4782
|
+
props.onChange({ ...props.action, definitionCanonical: core.getReferenceString(newValue) });
|
|
4678
4783
|
}
|
|
4679
4784
|
else {
|
|
4680
|
-
props.onChange(
|
|
4785
|
+
props.onChange({ ...props.action, definitionCanonical: undefined });
|
|
4681
4786
|
}
|
|
4682
4787
|
} }));
|
|
4683
4788
|
}
|
|
@@ -4686,18 +4791,17 @@
|
|
|
4686
4791
|
const key = 'timing';
|
|
4687
4792
|
const [propertyValue, propertyType] = getActionTiming(value);
|
|
4688
4793
|
return (React.createElement(ResourcePropertyInput, { property: timingProperty, name: "timing[x]", defaultValue: propertyValue, defaultPropertyType: propertyType, onChange: (newValue, propName) => {
|
|
4689
|
-
props.onChange(setPropertyValue(value, key, propName
|
|
4794
|
+
props.onChange(setPropertyValue(value, key, propName ?? key, timingProperty, newValue));
|
|
4690
4795
|
} }));
|
|
4691
4796
|
}
|
|
4692
4797
|
function getInitialActionType(action) {
|
|
4693
|
-
|
|
4694
|
-
if ((_a = action.definitionCanonical) === null || _a === void 0 ? void 0 : _a.startsWith('Schedule')) {
|
|
4798
|
+
if (action.definitionCanonical?.startsWith('Schedule')) {
|
|
4695
4799
|
return 'appointment';
|
|
4696
4800
|
}
|
|
4697
|
-
if (
|
|
4801
|
+
if (action.definitionCanonical?.startsWith('Questionnaire/')) {
|
|
4698
4802
|
return 'questionnaire';
|
|
4699
4803
|
}
|
|
4700
|
-
if (
|
|
4804
|
+
if (action.definitionCanonical?.startsWith('ActivityDefinition/')) {
|
|
4701
4805
|
return 'task';
|
|
4702
4806
|
}
|
|
4703
4807
|
return undefined;
|
|
@@ -4726,13 +4830,20 @@
|
|
|
4726
4830
|
return 'id-' + nextId$1++;
|
|
4727
4831
|
}
|
|
4728
4832
|
function ensurePlanDefinitionKeys(planDefinition) {
|
|
4729
|
-
return
|
|
4833
|
+
return {
|
|
4834
|
+
...planDefinition,
|
|
4835
|
+
action: ensurePlanDefinitionActionKeys(planDefinition.action),
|
|
4836
|
+
};
|
|
4730
4837
|
}
|
|
4731
4838
|
function ensurePlanDefinitionActionKeys(actions) {
|
|
4732
4839
|
if (!actions) {
|
|
4733
4840
|
return undefined;
|
|
4734
4841
|
}
|
|
4735
|
-
return actions.map((action) => (
|
|
4842
|
+
return actions.map((action) => ({
|
|
4843
|
+
...action,
|
|
4844
|
+
id: generateId$1(action.id),
|
|
4845
|
+
action: ensurePlanDefinitionActionKeys(action.action),
|
|
4846
|
+
}));
|
|
4736
4847
|
}
|
|
4737
4848
|
|
|
4738
4849
|
exports.QuestionnaireItemType = void 0;
|
|
@@ -4790,7 +4901,13 @@
|
|
|
4790
4901
|
}
|
|
4791
4902
|
return (React.createElement(Form, { testid: "questionnaire-form", onSubmit: () => {
|
|
4792
4903
|
if (props.onSubmit && response) {
|
|
4793
|
-
props.onSubmit(
|
|
4904
|
+
props.onSubmit({
|
|
4905
|
+
...response,
|
|
4906
|
+
questionnaire: core.getReferenceString(questionnaire),
|
|
4907
|
+
subject: props.subject,
|
|
4908
|
+
source: core.createReference(source),
|
|
4909
|
+
authored: new Date().toISOString(),
|
|
4910
|
+
});
|
|
4794
4911
|
}
|
|
4795
4912
|
} },
|
|
4796
4913
|
questionnaire.title && React.createElement(core$1.Title, null, questionnaire.title),
|
|
@@ -4819,7 +4936,7 @@
|
|
|
4819
4936
|
if (item.type === exports.QuestionnaireItemType.boolean) {
|
|
4820
4937
|
const initial = item.initial && item.initial.length > 0 ? item.initial[0] : undefined;
|
|
4821
4938
|
return (React.createElement(CheckboxFormSection, { key: item.linkId, title: item.text, htmlFor: item.linkId },
|
|
4822
|
-
React.createElement(core$1.Checkbox, { id: item.linkId, name: item.linkId, defaultChecked: initial
|
|
4939
|
+
React.createElement(core$1.Checkbox, { id: item.linkId, name: item.linkId, defaultChecked: initial?.valueBoolean, onChange: (e) => setResponseItem(index, {
|
|
4823
4940
|
linkId: item.linkId,
|
|
4824
4941
|
text: item.text,
|
|
4825
4942
|
answer: [{ valueBoolean: e.currentTarget.checked }],
|
|
@@ -4860,28 +4977,28 @@
|
|
|
4860
4977
|
React.createElement("h3", null, item.text),
|
|
4861
4978
|
item.item && (React.createElement(QuestionnaireFormItemArray, { items: item.item, answers: props.answers, onChange: onChangeItem }))));
|
|
4862
4979
|
case exports.QuestionnaireItemType.boolean:
|
|
4863
|
-
return (React.createElement(core$1.Checkbox, { id: name, name: name, defaultChecked: initial
|
|
4980
|
+
return (React.createElement(core$1.Checkbox, { id: name, name: name, defaultChecked: initial?.valueBoolean, onChange: (e) => onChangeAnswer({ valueBoolean: e.currentTarget.checked }) }));
|
|
4864
4981
|
case exports.QuestionnaireItemType.decimal:
|
|
4865
|
-
return (React.createElement(core$1.TextInput, { type: "number", step: "any", id: name, name: name, defaultValue: initial
|
|
4982
|
+
return (React.createElement(core$1.TextInput, { type: "number", step: "any", id: name, name: name, defaultValue: initial?.valueDecimal, onChange: (e) => onChangeAnswer({ valueDecimal: e.currentTarget.valueAsNumber }) }));
|
|
4866
4983
|
case exports.QuestionnaireItemType.integer:
|
|
4867
|
-
return (React.createElement(core$1.TextInput, { type: "number", step: 1, id: name, name: name, defaultValue: initial
|
|
4984
|
+
return (React.createElement(core$1.TextInput, { type: "number", step: 1, id: name, name: name, defaultValue: initial?.valueInteger, onChange: (e) => onChangeAnswer({ valueInteger: e.currentTarget.valueAsNumber }) }));
|
|
4868
4985
|
case exports.QuestionnaireItemType.date:
|
|
4869
|
-
return (React.createElement(core$1.TextInput, { type: "date", id: name, name: name, defaultValue: initial
|
|
4986
|
+
return (React.createElement(core$1.TextInput, { type: "date", id: name, name: name, defaultValue: initial?.valueDate, onChange: (e) => onChangeAnswer({ valueDate: e.currentTarget.value }) }));
|
|
4870
4987
|
case exports.QuestionnaireItemType.dateTime:
|
|
4871
|
-
return (React.createElement(DateTimeInput, { name: name, defaultValue: initial
|
|
4988
|
+
return (React.createElement(DateTimeInput, { name: name, defaultValue: initial?.valueDateTime, onChange: (newValue) => onChangeAnswer({ valueDateTime: newValue }) }));
|
|
4872
4989
|
case exports.QuestionnaireItemType.time:
|
|
4873
|
-
return (React.createElement(core$1.TextInput, { type: "time", id: name, name: name, defaultValue: initial
|
|
4990
|
+
return (React.createElement(core$1.TextInput, { type: "time", id: name, name: name, defaultValue: initial?.valueTime, onChange: (e) => onChangeAnswer({ valueTime: e.currentTarget.value }) }));
|
|
4874
4991
|
case exports.QuestionnaireItemType.string:
|
|
4875
4992
|
case exports.QuestionnaireItemType.url:
|
|
4876
|
-
return (React.createElement(core$1.TextInput, { id: name, name: name, defaultValue: initial
|
|
4993
|
+
return (React.createElement(core$1.TextInput, { id: name, name: name, defaultValue: initial?.valueString, onChange: (e) => onChangeAnswer({ valueString: e.currentTarget.value }) }));
|
|
4877
4994
|
case exports.QuestionnaireItemType.text:
|
|
4878
|
-
return (React.createElement(core$1.Textarea, { id: name, name: name, defaultValue: initial
|
|
4995
|
+
return (React.createElement(core$1.Textarea, { id: name, name: name, defaultValue: initial?.valueString, onChange: (e) => onChangeAnswer({ valueString: e.currentTarget.value }) }));
|
|
4879
4996
|
case exports.QuestionnaireItemType.attachment:
|
|
4880
|
-
return (React.createElement(AttachmentInput, { name: name, defaultValue: initial
|
|
4997
|
+
return (React.createElement(AttachmentInput, { name: name, defaultValue: initial?.valueAttachment, onChange: (newValue) => onChangeAnswer({ valueAttachment: newValue }) }));
|
|
4881
4998
|
case exports.QuestionnaireItemType.reference:
|
|
4882
|
-
return (React.createElement(ReferenceInput, { name: name, defaultValue: initial
|
|
4999
|
+
return (React.createElement(ReferenceInput, { name: name, defaultValue: initial?.valueReference, onChange: (newValue) => onChangeAnswer({ valueReference: newValue }) }));
|
|
4883
5000
|
case exports.QuestionnaireItemType.quantity:
|
|
4884
|
-
return (React.createElement(QuantityInput, { name: name, defaultValue: initial
|
|
5001
|
+
return (React.createElement(QuantityInput, { name: name, defaultValue: initial?.valueQuantity, onChange: (newValue) => onChangeAnswer({ valueQuantity: newValue }) }));
|
|
4885
5002
|
case exports.QuestionnaireItemType.choice:
|
|
4886
5003
|
case exports.QuestionnaireItemType.openChoice:
|
|
4887
5004
|
if (isDropDownChoice(item)) {
|
|
@@ -4962,30 +5079,24 @@
|
|
|
4962
5079
|
return response;
|
|
4963
5080
|
}
|
|
4964
5081
|
function buildInitialResponseItems(items) {
|
|
4965
|
-
|
|
4966
|
-
return (_a = items === null || items === void 0 ? void 0 : items.map(buildInitialResponseItem)) !== null && _a !== void 0 ? _a : [];
|
|
5082
|
+
return items?.map(buildInitialResponseItem) ?? [];
|
|
4967
5083
|
}
|
|
4968
5084
|
function buildInitialResponseItem(item) {
|
|
4969
|
-
var _a, _b;
|
|
4970
5085
|
return {
|
|
4971
5086
|
linkId: item.linkId,
|
|
4972
5087
|
text: item.text,
|
|
4973
5088
|
item: buildInitialResponseItems(item.item),
|
|
4974
|
-
answer:
|
|
5089
|
+
answer: item.initial?.map(buildInitialResponseAnswer) ?? [],
|
|
4975
5090
|
};
|
|
4976
5091
|
}
|
|
4977
5092
|
function buildInitialResponseAnswer(answer) {
|
|
4978
5093
|
// This works because QuestionnaireItemInitial and QuestionnaireResponseItemAnswer
|
|
4979
5094
|
// have the same properties.
|
|
4980
|
-
return
|
|
5095
|
+
return { ...answer };
|
|
4981
5096
|
}
|
|
4982
5097
|
function isDropDownChoice(item) {
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
var _a, _b, _c;
|
|
4986
|
-
return e.url === 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl' &&
|
|
4987
|
-
((_c = (_b = (_a = e.valueCodeableConcept) === null || _a === void 0 ? void 0 : _a.coding) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.code) === 'drop-down';
|
|
4988
|
-
}));
|
|
5098
|
+
return !!item.extension?.some((e) => e.url === 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl' &&
|
|
5099
|
+
e.valueCodeableConcept?.coding?.[0]?.code === 'drop-down');
|
|
4989
5100
|
}
|
|
4990
5101
|
function isQuestionEnabled(item, answers) {
|
|
4991
5102
|
if (!item.enableWhen) {
|
|
@@ -5078,7 +5189,7 @@
|
|
|
5078
5189
|
medplum.requestSchema('Questionnaire').then(setSchema).catch(console.log);
|
|
5079
5190
|
}, [medplum]);
|
|
5080
5191
|
React.useEffect(() => {
|
|
5081
|
-
setValue(ensureQuestionnaireKeys(defaultValue
|
|
5192
|
+
setValue(ensureQuestionnaireKeys(defaultValue ?? { resourceType: 'Questionnaire' }));
|
|
5082
5193
|
document.addEventListener('mouseover', handleDocumentMouseOver);
|
|
5083
5194
|
document.addEventListener('click', handleDocumentClick);
|
|
5084
5195
|
return () => {
|
|
@@ -5095,13 +5206,12 @@
|
|
|
5095
5206
|
React.createElement(core$1.Button, { type: "submit" }, "Save"))));
|
|
5096
5207
|
}
|
|
5097
5208
|
function ItemBuilder(props) {
|
|
5098
|
-
var _a;
|
|
5099
5209
|
const { classes, cx } = useStyles$4();
|
|
5100
5210
|
const resource = props.item;
|
|
5101
5211
|
const item = props.item;
|
|
5102
5212
|
const isResource = 'resourceType' in props.item;
|
|
5103
5213
|
const isContainer = isResource || item.type === exports.QuestionnaireItemType.group;
|
|
5104
|
-
const linkId =
|
|
5214
|
+
const linkId = item.linkId ?? '[untitled]';
|
|
5105
5215
|
const editing = props.selectedKey === props.item.id;
|
|
5106
5216
|
const hovering = props.hoverKey === props.item.id;
|
|
5107
5217
|
const itemRef = React.useRef();
|
|
@@ -5115,20 +5225,29 @@
|
|
|
5115
5225
|
props.setHoverKey(props.item.id);
|
|
5116
5226
|
}
|
|
5117
5227
|
function changeItem(changedItem) {
|
|
5118
|
-
var _a;
|
|
5119
5228
|
const curr = itemRef.current;
|
|
5120
|
-
props.onChange(
|
|
5229
|
+
props.onChange({
|
|
5230
|
+
...curr,
|
|
5231
|
+
item: curr.item?.map((i) => (i.id === changedItem.id ? changedItem : i)),
|
|
5232
|
+
});
|
|
5121
5233
|
}
|
|
5122
5234
|
function addItem(addedItem) {
|
|
5123
|
-
|
|
5124
|
-
|
|
5235
|
+
props.onChange({
|
|
5236
|
+
...props.item,
|
|
5237
|
+
item: [...(props.item?.item ?? []), addedItem],
|
|
5238
|
+
});
|
|
5125
5239
|
}
|
|
5126
5240
|
function removeItem(removedItem) {
|
|
5127
|
-
|
|
5128
|
-
|
|
5241
|
+
props.onChange({
|
|
5242
|
+
...props.item,
|
|
5243
|
+
item: props.item?.item?.filter((i) => i !== removedItem),
|
|
5244
|
+
});
|
|
5129
5245
|
}
|
|
5130
5246
|
function changeProperty(property, value) {
|
|
5131
|
-
props.onChange(
|
|
5247
|
+
props.onChange({
|
|
5248
|
+
...itemRef.current,
|
|
5249
|
+
[property]: value,
|
|
5250
|
+
});
|
|
5132
5251
|
}
|
|
5133
5252
|
const className = cx(classes.section, {
|
|
5134
5253
|
[classes.editing]: editing,
|
|
@@ -5192,9 +5311,8 @@
|
|
|
5192
5311
|
} }, "Remove")))));
|
|
5193
5312
|
}
|
|
5194
5313
|
function AnswerBuilder(props) {
|
|
5195
|
-
var _a;
|
|
5196
5314
|
const property = core.globalSchema.types['QuestionnaireItemAnswerOption'].properties['value[x]'];
|
|
5197
|
-
const options =
|
|
5315
|
+
const options = props.options ?? [];
|
|
5198
5316
|
return (React.createElement("div", null,
|
|
5199
5317
|
options.map((option) => {
|
|
5200
5318
|
const [propertyValue, propertyType] = getValueAndType({ type: 'QuestionnaireItemAnswerOption', value: option }, 'value');
|
|
@@ -5249,28 +5367,39 @@
|
|
|
5249
5367
|
return 'id-' + nextId++;
|
|
5250
5368
|
}
|
|
5251
5369
|
function ensureQuestionnaireKeys(questionnaire) {
|
|
5252
|
-
return
|
|
5370
|
+
return {
|
|
5371
|
+
...questionnaire,
|
|
5372
|
+
id: questionnaire.id || generateId(),
|
|
5373
|
+
item: ensureQuestionnaireItemKeys(questionnaire.item),
|
|
5374
|
+
};
|
|
5253
5375
|
}
|
|
5254
5376
|
function ensureQuestionnaireItemKeys(items) {
|
|
5255
5377
|
if (!items) {
|
|
5256
5378
|
return undefined;
|
|
5257
5379
|
}
|
|
5258
5380
|
items.forEach((item) => {
|
|
5259
|
-
|
|
5260
|
-
if ((_a = item.id) === null || _a === void 0 ? void 0 : _a.match(/^id-\d+$/)) {
|
|
5381
|
+
if (item.id?.match(/^id-\d+$/)) {
|
|
5261
5382
|
nextId = Math.max(nextId, parseInt(item.id.substring(3)) + 1);
|
|
5262
5383
|
}
|
|
5263
|
-
if (
|
|
5384
|
+
if (item.linkId?.match(/^q\d+$/)) {
|
|
5264
5385
|
nextLinkId = Math.max(nextLinkId, parseInt(item.linkId.substring(1)) + 1);
|
|
5265
5386
|
}
|
|
5266
5387
|
});
|
|
5267
|
-
return items.map((item) => (
|
|
5388
|
+
return items.map((item) => ({
|
|
5389
|
+
...item,
|
|
5390
|
+
id: item.id || generateId(),
|
|
5391
|
+
item: ensureQuestionnaireItemKeys(item.item),
|
|
5392
|
+
answerOption: ensureQuestionnaireOptionKeys(item.answerOption),
|
|
5393
|
+
}));
|
|
5268
5394
|
}
|
|
5269
5395
|
function ensureQuestionnaireOptionKeys(options) {
|
|
5270
5396
|
if (!options) {
|
|
5271
5397
|
return undefined;
|
|
5272
5398
|
}
|
|
5273
|
-
return options.map((option) => (
|
|
5399
|
+
return options.map((option) => ({
|
|
5400
|
+
...option,
|
|
5401
|
+
id: option.id || generateId(),
|
|
5402
|
+
}));
|
|
5274
5403
|
}
|
|
5275
5404
|
|
|
5276
5405
|
const useStyles$3 = core$1.createStyles((theme) => ({
|
|
@@ -5302,10 +5431,7 @@
|
|
|
5302
5431
|
setIntervalGroups(groupQualifiedIntervals(definition.qualifiedInterval || [], setGroupId));
|
|
5303
5432
|
}, [defaultDefinition]);
|
|
5304
5433
|
return (React.createElement(Form, { testid: "reference-range-editor", onSubmit: submitDefinition },
|
|
5305
|
-
React.createElement(core$1.Stack, null, intervalGroups.map((intervalGroup) => {
|
|
5306
|
-
var _a;
|
|
5307
|
-
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 }));
|
|
5308
|
-
})),
|
|
5434
|
+
React.createElement(core$1.Stack, null, intervalGroups.map((intervalGroup) => (React.createElement(ReferenceRangeGroupEditor, { unit: getUnitString(defaultDefinition.quantitativeDetails?.unit), onChange: changeInterval, onAdd: addInterval, onRemove: removeInterval, onRemoveGroup: removeGroup, key: `group-${intervalGroup.id}`, intervalGroup: intervalGroup })))),
|
|
5309
5435
|
React.createElement(core$1.ActionIcon, { title: "Add Group", size: "sm", onClick: (e) => {
|
|
5310
5436
|
killEvent(e);
|
|
5311
5437
|
addGroup({ id: `group-id-${groupId}`, filters: {}, intervals: [] });
|
|
@@ -5321,7 +5447,7 @@
|
|
|
5321
5447
|
const qualifiedInterval = intervalGroups
|
|
5322
5448
|
.flatMap((group) => group.intervals)
|
|
5323
5449
|
.filter((interval) => !isEmptyInterval(interval));
|
|
5324
|
-
props.onSubmit(
|
|
5450
|
+
props.onSubmit({ ...defaultDefinition, qualifiedInterval });
|
|
5325
5451
|
}
|
|
5326
5452
|
/**
|
|
5327
5453
|
* Add Remove Interval Groups
|
|
@@ -5337,11 +5463,10 @@
|
|
|
5337
5463
|
*/
|
|
5338
5464
|
function changeInterval(groupId, changedInterval) {
|
|
5339
5465
|
setIntervalGroups((groups) => {
|
|
5340
|
-
var _a, _b;
|
|
5341
5466
|
groups = [...groups];
|
|
5342
5467
|
const currentGroup = groups.find((g) => g.id === groupId);
|
|
5343
|
-
const index =
|
|
5344
|
-
if (index !== undefined &&
|
|
5468
|
+
const index = currentGroup?.intervals?.findIndex((interval) => interval.id === changedInterval.id);
|
|
5469
|
+
if (index !== undefined && currentGroup?.intervals?.[index]) {
|
|
5345
5470
|
currentGroup.intervals[index] = changedInterval;
|
|
5346
5471
|
}
|
|
5347
5472
|
return groups;
|
|
@@ -5356,8 +5481,8 @@
|
|
|
5356
5481
|
groups = [...groups];
|
|
5357
5482
|
const currentGroupIndex = groups.findIndex((g) => g.id === groupId);
|
|
5358
5483
|
if (currentGroupIndex != -1) {
|
|
5359
|
-
const currentGroup =
|
|
5360
|
-
addedInterval =
|
|
5484
|
+
const currentGroup = { ...groups[currentGroupIndex] };
|
|
5485
|
+
addedInterval = { ...addedInterval, ...currentGroup.filters };
|
|
5361
5486
|
currentGroup.intervals = [...currentGroup.intervals, addedInterval];
|
|
5362
5487
|
groups[currentGroupIndex] = currentGroup;
|
|
5363
5488
|
}
|
|
@@ -5392,7 +5517,7 @@
|
|
|
5392
5517
|
React.createElement(core$1.Group, null,
|
|
5393
5518
|
React.createElement(core$1.TextInput, { key: `condition-${interval.id}`, "data-testid": `condition-${interval.id}`, defaultValue: interval.condition, label: 'Condition: ', size: 'sm', onChange: (e) => {
|
|
5394
5519
|
killEvent(e);
|
|
5395
|
-
props.onChange(intervalGroup.id,
|
|
5520
|
+
props.onChange(intervalGroup.id, { ...interval, condition: e.currentTarget.value.trim() });
|
|
5396
5521
|
} }),
|
|
5397
5522
|
React.createElement(core$1.ActionIcon, { title: "Remove Interval", size: "sm", key: `remove-interval-${interval.id}`, "data-testid": `remove-interval-${interval.id}`, onClick: (e) => {
|
|
5398
5523
|
killEvent(e);
|
|
@@ -5400,7 +5525,7 @@
|
|
|
5400
5525
|
} },
|
|
5401
5526
|
React.createElement(icons.IconCircleMinus, null))),
|
|
5402
5527
|
React.createElement(RangeInput, { onChange: (range) => {
|
|
5403
|
-
props.onChange(intervalGroup.id,
|
|
5528
|
+
props.onChange(intervalGroup.id, { ...interval, range });
|
|
5404
5529
|
}, key: `range-${interval.id}`, name: `range-${interval.id}`, defaultValue: interval.range })))),
|
|
5405
5530
|
React.createElement(core$1.ActionIcon, { title: "Add Interval", size: "sm", onClick: (e) => {
|
|
5406
5531
|
killEvent(e);
|
|
@@ -5417,27 +5542,32 @@
|
|
|
5417
5542
|
* Render the "filters" section of the IntervalGroup. Also populates some initial
|
|
5418
5543
|
*/
|
|
5419
5544
|
function ReferenceRangeGroupFilters(props) {
|
|
5420
|
-
var _a, _b;
|
|
5421
5545
|
const { intervalGroup, onChange } = props;
|
|
5422
5546
|
// Pre-populate the units of the age filter
|
|
5423
5547
|
if (!intervalGroup.filters.age) {
|
|
5424
5548
|
intervalGroup.filters.age = {};
|
|
5425
5549
|
}
|
|
5426
5550
|
for (const key of ['low', 'high']) {
|
|
5427
|
-
if (!
|
|
5428
|
-
intervalGroup.filters.age[key] =
|
|
5551
|
+
if (!intervalGroup.filters.age[key]?.unit) {
|
|
5552
|
+
intervalGroup.filters.age[key] = {
|
|
5553
|
+
...intervalGroup.filters.age[key],
|
|
5554
|
+
unit: 'years',
|
|
5555
|
+
system: 'http://unitsofmeasure.org',
|
|
5556
|
+
};
|
|
5429
5557
|
}
|
|
5430
5558
|
}
|
|
5431
5559
|
return (React.createElement(core$1.Stack, { style: { maxWidth: '50%' } },
|
|
5432
5560
|
React.createElement(core$1.Group, null,
|
|
5433
5561
|
React.createElement(core$1.NativeSelect, { data: ['', 'male', 'female'], label: "Gender:", defaultValue: intervalGroup.filters.gender || '', onChange: (e) => {
|
|
5434
|
-
var _a;
|
|
5435
5562
|
for (const interval of intervalGroup.intervals) {
|
|
5436
|
-
let newGender =
|
|
5563
|
+
let newGender = e.currentTarget?.value;
|
|
5437
5564
|
if (newGender === '') {
|
|
5438
5565
|
newGender = undefined;
|
|
5439
5566
|
}
|
|
5440
|
-
onChange(intervalGroup.id,
|
|
5567
|
+
onChange(intervalGroup.id, {
|
|
5568
|
+
...interval,
|
|
5569
|
+
gender: newGender,
|
|
5570
|
+
});
|
|
5441
5571
|
}
|
|
5442
5572
|
} })),
|
|
5443
5573
|
React.createElement(core$1.Group, { spacing: 'xs' },
|
|
@@ -5445,24 +5575,26 @@
|
|
|
5445
5575
|
React.createElement("div", { id: `div-age-${intervalGroup.id}` },
|
|
5446
5576
|
React.createElement(RangeInput, { key: `age-${intervalGroup.id}`, name: `age-${intervalGroup.id}`, defaultValue: intervalGroup.filters['age'], onChange: (ageRange) => {
|
|
5447
5577
|
for (const interval of intervalGroup.intervals) {
|
|
5448
|
-
onChange(intervalGroup.id,
|
|
5578
|
+
onChange(intervalGroup.id, { ...interval, age: ageRange });
|
|
5449
5579
|
}
|
|
5450
5580
|
} }))),
|
|
5451
|
-
React.createElement(core$1.NativeSelect, { data: ['', 'pre-puberty', 'follicular', 'midcycle', 'luteal', 'postmenopausal'], label: "Endocrine:", defaultValue:
|
|
5452
|
-
var _a;
|
|
5581
|
+
React.createElement(core$1.NativeSelect, { data: ['', 'pre-puberty', 'follicular', 'midcycle', 'luteal', 'postmenopausal'], label: "Endocrine:", defaultValue: intervalGroup.filters.context?.text || '', onChange: (e) => {
|
|
5453
5582
|
for (const interval of intervalGroup.intervals) {
|
|
5454
|
-
let newEndocrine =
|
|
5583
|
+
let newEndocrine = e.currentTarget?.value;
|
|
5455
5584
|
if (newEndocrine === '') {
|
|
5456
5585
|
newEndocrine = undefined;
|
|
5457
|
-
onChange(intervalGroup.id,
|
|
5586
|
+
onChange(intervalGroup.id, { ...interval, context: undefined });
|
|
5458
5587
|
}
|
|
5459
5588
|
else {
|
|
5460
|
-
onChange(intervalGroup.id,
|
|
5589
|
+
onChange(intervalGroup.id, {
|
|
5590
|
+
...interval,
|
|
5591
|
+
context: {
|
|
5461
5592
|
text: newEndocrine,
|
|
5462
5593
|
coding: [
|
|
5463
5594
|
{ code: newEndocrine, system: 'http://terminology.hl7.org/CodeSystem/referencerange-meaning' },
|
|
5464
5595
|
],
|
|
5465
|
-
}
|
|
5596
|
+
},
|
|
5597
|
+
});
|
|
5466
5598
|
}
|
|
5467
5599
|
}
|
|
5468
5600
|
} })));
|
|
@@ -5477,15 +5609,20 @@
|
|
|
5477
5609
|
const intervals = definition.qualifiedInterval || [];
|
|
5478
5610
|
// Set the nextId to the max of any existing numeric id
|
|
5479
5611
|
let nextId = Math.max(...intervals.map((interval) => {
|
|
5480
|
-
|
|
5481
|
-
const existingNum = parseInt(((_a = interval.id) === null || _a === void 0 ? void 0 : _a.substring(3)) || '');
|
|
5612
|
+
const existingNum = parseInt(interval.id?.substring(3) || '');
|
|
5482
5613
|
return !isNaN(existingNum) ? existingNum : Number.NEGATIVE_INFINITY;
|
|
5483
5614
|
})) + 1;
|
|
5484
5615
|
if (!Number.isFinite(nextId)) {
|
|
5485
5616
|
nextId = 1;
|
|
5486
5617
|
}
|
|
5487
5618
|
// If an interval doesn't have an id, set it to the nextId
|
|
5488
|
-
definition =
|
|
5619
|
+
definition = {
|
|
5620
|
+
...definition,
|
|
5621
|
+
qualifiedInterval: intervals.map((interval) => ({
|
|
5622
|
+
...interval,
|
|
5623
|
+
id: interval.id || `id-${nextId++}`,
|
|
5624
|
+
})),
|
|
5625
|
+
};
|
|
5489
5626
|
setIntervalId(nextId);
|
|
5490
5627
|
return definition;
|
|
5491
5628
|
}
|
|
@@ -5515,13 +5652,12 @@
|
|
|
5515
5652
|
* @return A "group key" that corresponds to the value of the interval filter properties.
|
|
5516
5653
|
*/
|
|
5517
5654
|
function generateGroupKey(interval) {
|
|
5518
|
-
var _a, _b;
|
|
5519
5655
|
const results = [
|
|
5520
5656
|
`gender=${interval.gender}`,
|
|
5521
5657
|
`age=${core.formatRange(interval.age)}`,
|
|
5522
5658
|
`gestationalAge=${core.formatRange(interval.gestationalAge)}`,
|
|
5523
|
-
`context=${
|
|
5524
|
-
`appliesTo=${
|
|
5659
|
+
`context=${interval.context?.text}`,
|
|
5660
|
+
`appliesTo=${interval.appliesTo?.map((c) => c.text).join('+')}`,
|
|
5525
5661
|
];
|
|
5526
5662
|
return results.join(':');
|
|
5527
5663
|
}
|
|
@@ -5529,12 +5665,10 @@
|
|
|
5529
5665
|
return unit && (core.getCodeBySystem(unit, 'http://unitsofmeasure.org') || unit.text);
|
|
5530
5666
|
}
|
|
5531
5667
|
function isEmptyInterval(interval) {
|
|
5532
|
-
|
|
5533
|
-
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;
|
|
5668
|
+
return interval.range?.low?.value === undefined && interval.range?.high?.value === undefined;
|
|
5534
5669
|
}
|
|
5535
5670
|
|
|
5536
5671
|
function RequestGroupDisplay(props) {
|
|
5537
|
-
var _a;
|
|
5538
5672
|
const medplum = useMedplum();
|
|
5539
5673
|
const requestGroup = useResource(props.value);
|
|
5540
5674
|
const [startedLoading, setStartedLoading] = React.useState(false);
|
|
@@ -5548,34 +5682,32 @@
|
|
|
5548
5682
|
if (!requestGroup || !responseBundle) {
|
|
5549
5683
|
return null;
|
|
5550
5684
|
}
|
|
5551
|
-
return (React.createElement(core$1.Grid, null,
|
|
5552
|
-
var _a, _b, _c, _d, _e, _f;
|
|
5685
|
+
return (React.createElement(core$1.Grid, null, requestGroup.action?.map((action, index) => {
|
|
5553
5686
|
const task = action.resource && findBundleEntry(action.resource);
|
|
5554
|
-
const taskInput =
|
|
5555
|
-
const taskOutput =
|
|
5687
|
+
const taskInput = task?.input?.[0]?.valueReference;
|
|
5688
|
+
const taskOutput = task?.output?.[0]?.valueReference;
|
|
5556
5689
|
return (React.createElement(React.Fragment, { key: `action-${index}` },
|
|
5557
|
-
React.createElement(core$1.Grid.Col, { span: 1, p: "md" },
|
|
5690
|
+
React.createElement(core$1.Grid.Col, { span: 1, p: "md" }, task?.status === 'completed' ? React.createElement(icons.IconCheckbox, null) : React.createElement(icons.IconSquare, { color: "gray" })),
|
|
5558
5691
|
React.createElement(core$1.Grid.Col, { span: 9, p: "xs" },
|
|
5559
5692
|
React.createElement(core$1.Text, { weight: 500 }, action.title),
|
|
5560
5693
|
action.description && React.createElement("div", null, action.description),
|
|
5561
5694
|
React.createElement("div", null,
|
|
5562
5695
|
"Last edited by\u00A0",
|
|
5563
|
-
React.createElement(ResourceName, { value:
|
|
5696
|
+
React.createElement(ResourceName, { value: task?.meta?.author }),
|
|
5564
5697
|
"\u00A0on\u00A0",
|
|
5565
|
-
core.formatDateTime(
|
|
5698
|
+
core.formatDateTime(task?.meta?.lastUpdated)),
|
|
5566
5699
|
React.createElement("div", null,
|
|
5567
5700
|
"Status: ",
|
|
5568
|
-
React.createElement(StatusBadge, { status:
|
|
5701
|
+
React.createElement(StatusBadge, { status: task?.status || 'unknown' }))),
|
|
5569
5702
|
React.createElement(core$1.Grid.Col, { span: 2, p: "md" },
|
|
5570
5703
|
taskInput && !taskOutput && React.createElement(core$1.Button, { onClick: () => props.onStart(task, taskInput) }, "Start"),
|
|
5571
5704
|
taskInput && taskOutput && (React.createElement(core$1.Button, { onClick: () => props.onEdit(task, taskInput, taskOutput) }, "Edit")))));
|
|
5572
5705
|
})));
|
|
5573
5706
|
function buildBatchRequest(request) {
|
|
5574
|
-
var _a;
|
|
5575
5707
|
const batchEntries = [];
|
|
5576
5708
|
if (request.action) {
|
|
5577
5709
|
for (const action of request.action) {
|
|
5578
|
-
if (
|
|
5710
|
+
if (action.resource?.reference) {
|
|
5579
5711
|
batchEntries.push({ request: { method: 'GET', url: action.resource.reference } });
|
|
5580
5712
|
}
|
|
5581
5713
|
}
|
|
@@ -5587,7 +5719,7 @@
|
|
|
5587
5719
|
};
|
|
5588
5720
|
}
|
|
5589
5721
|
function findBundleEntry(reference) {
|
|
5590
|
-
for (const entry of responseBundle
|
|
5722
|
+
for (const entry of responseBundle?.entry) {
|
|
5591
5723
|
if (entry.resource && reference.reference === core.getReferenceString(entry.resource)) {
|
|
5592
5724
|
return entry.resource;
|
|
5593
5725
|
}
|
|
@@ -5716,13 +5848,10 @@
|
|
|
5716
5848
|
// Convert to array of array of lines
|
|
5717
5849
|
const versions = history.entry
|
|
5718
5850
|
.filter((entry) => !!entry.resource)
|
|
5719
|
-
.map((entry) => {
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
lines: core.stringify(entry.resource, true).match(/[^\r\n]+/g),
|
|
5724
|
-
});
|
|
5725
|
-
})
|
|
5851
|
+
.map((entry) => ({
|
|
5852
|
+
meta: entry.resource?.meta,
|
|
5853
|
+
lines: core.stringify(entry.resource, true).match(/[^\r\n]+/g),
|
|
5854
|
+
}))
|
|
5726
5855
|
.sort((a, b) => a.meta.lastUpdated.localeCompare(b.meta.lastUpdated));
|
|
5727
5856
|
// Start with array of lines from the first version
|
|
5728
5857
|
const table = versions[0].lines.map((line) => ({
|
|
@@ -5830,7 +5959,6 @@
|
|
|
5830
5959
|
},
|
|
5831
5960
|
}));
|
|
5832
5961
|
function ResourceBlame(props) {
|
|
5833
|
-
var _a, _b;
|
|
5834
5962
|
const { classes } = useStyles$2();
|
|
5835
5963
|
const medplum = useMedplum();
|
|
5836
5964
|
const [value, setValue] = React.useState(props.history);
|
|
@@ -5842,7 +5970,7 @@
|
|
|
5842
5970
|
if (!value) {
|
|
5843
5971
|
return React.createElement("div", null, "Loading...");
|
|
5844
5972
|
}
|
|
5845
|
-
const resource =
|
|
5973
|
+
const resource = value.entry?.[0]?.resource;
|
|
5846
5974
|
const table = blame(value);
|
|
5847
5975
|
return (React.createElement("div", { className: classes.container },
|
|
5848
5976
|
React.createElement("table", { className: classes.root },
|
|
@@ -5900,8 +6028,8 @@
|
|
|
5900
6028
|
let originalResource = props.original;
|
|
5901
6029
|
let revisedResource = props.revised;
|
|
5902
6030
|
if (props.ignoreMeta) {
|
|
5903
|
-
originalResource =
|
|
5904
|
-
revisedResource =
|
|
6031
|
+
originalResource = { ...originalResource, meta: undefined };
|
|
6032
|
+
revisedResource = { ...revisedResource, meta: undefined };
|
|
5905
6033
|
}
|
|
5906
6034
|
const original = core.stringify(originalResource, true).match(/[^\r\n]+/g);
|
|
5907
6035
|
const revised = core.stringify(revisedResource, true).match(/[^\r\n]+/g);
|
|
@@ -5920,7 +6048,6 @@
|
|
|
5920
6048
|
}
|
|
5921
6049
|
|
|
5922
6050
|
function ResourceHistoryTable(props) {
|
|
5923
|
-
var _a;
|
|
5924
6051
|
const medplum = useMedplum();
|
|
5925
6052
|
const [value, setValue] = React.useState(props.history);
|
|
5926
6053
|
React.useEffect(() => {
|
|
@@ -5940,27 +6067,25 @@
|
|
|
5940
6067
|
React.createElement("th", null, "Author"),
|
|
5941
6068
|
React.createElement("th", null, "Date"),
|
|
5942
6069
|
React.createElement("th", null, "Version"))),
|
|
5943
|
-
React.createElement("tbody", null,
|
|
6070
|
+
React.createElement("tbody", null, value.entry?.map((entry, index) => (React.createElement(HistoryRow, { key: 'entry-' + index, entry: entry }))))));
|
|
5944
6071
|
}
|
|
5945
6072
|
function HistoryRow(props) {
|
|
5946
|
-
var _a, _b, _c;
|
|
5947
6073
|
const { response, resource } = props.entry;
|
|
5948
6074
|
if (resource) {
|
|
5949
6075
|
return (React.createElement("tr", null,
|
|
5950
6076
|
React.createElement("td", null,
|
|
5951
|
-
React.createElement(ResourceBadge, { value:
|
|
5952
|
-
React.createElement("td", null, core.formatDateTime(
|
|
6077
|
+
React.createElement(ResourceBadge, { value: resource.meta?.author, link: true })),
|
|
6078
|
+
React.createElement("td", null, core.formatDateTime(resource.meta?.lastUpdated)),
|
|
5953
6079
|
React.createElement("td", null,
|
|
5954
|
-
React.createElement(MedplumLink, { to: getVersionUrl(resource) },
|
|
6080
|
+
React.createElement(MedplumLink, { to: getVersionUrl(resource) }, resource.meta?.versionId))));
|
|
5955
6081
|
}
|
|
5956
6082
|
else {
|
|
5957
6083
|
return (React.createElement("tr", null,
|
|
5958
|
-
React.createElement("td", { colSpan: 3 }, core.normalizeErrorString(response
|
|
6084
|
+
React.createElement("td", { colSpan: 3 }, core.normalizeErrorString(response?.outcome))));
|
|
5959
6085
|
}
|
|
5960
6086
|
}
|
|
5961
6087
|
function getVersionUrl(resource) {
|
|
5962
|
-
|
|
5963
|
-
return `/${resource.resourceType}/${resource.id}/_history/${(_a = resource.meta) === null || _a === void 0 ? void 0 : _a.versionId}`;
|
|
6088
|
+
return `/${resource.resourceType}/${resource.id}/_history/${resource.meta?.versionId}`;
|
|
5964
6089
|
}
|
|
5965
6090
|
|
|
5966
6091
|
const useStyles = core$1.createStyles((theme) => ({
|
|
@@ -5979,7 +6104,6 @@
|
|
|
5979
6104
|
},
|
|
5980
6105
|
}));
|
|
5981
6106
|
function Scheduler(props) {
|
|
5982
|
-
var _a;
|
|
5983
6107
|
const { classes } = useStyles();
|
|
5984
6108
|
const medplum = useMedplum();
|
|
5985
6109
|
const schedule = useResource(props.schedule);
|
|
@@ -6011,7 +6135,7 @@
|
|
|
6011
6135
|
if (!schedule || !slots || !questionnaire) {
|
|
6012
6136
|
return null;
|
|
6013
6137
|
}
|
|
6014
|
-
const actor =
|
|
6138
|
+
const actor = schedule.actor?.[0];
|
|
6015
6139
|
return (React.createElement("div", { className: classes.container, "data-testid": "scheduler" },
|
|
6016
6140
|
React.createElement("div", { className: classes.info },
|
|
6017
6141
|
actor && React.createElement(ResourceAvatar, { value: actor, size: "xl" }),
|
|
@@ -6144,6 +6268,8 @@
|
|
|
6144
6268
|
exports.MedplumProvider = MedplumProvider;
|
|
6145
6269
|
exports.MemoizedFhirPathTable = MemoizedFhirPathTable;
|
|
6146
6270
|
exports.MemoizedSearchControl = MemoizedSearchControl;
|
|
6271
|
+
exports.MoneyDisplay = MoneyDisplay;
|
|
6272
|
+
exports.MoneyInput = MoneyInput;
|
|
6147
6273
|
exports.ObservationTable = ObservationTable;
|
|
6148
6274
|
exports.Panel = Panel;
|
|
6149
6275
|
exports.PatientTimeline = PatientTimeline;
|
|
@@ -6235,4 +6361,4 @@
|
|
|
6235
6361
|
exports.useResource = useResource;
|
|
6236
6362
|
|
|
6237
6363
|
}));
|
|
6238
|
-
//# sourceMappingURL=index.
|
|
6364
|
+
//# sourceMappingURL=index.cjs.map
|