@medplum/react 1.0.5 → 1.0.6
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/{index.js → index.cjs} +598 -518
- 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/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.js → AuthenticationForm.mjs} +21 -19
- 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} +15 -19
- 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.js → SignInForm.mjs} +10 -11
- 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.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,12 +619,11 @@
|
|
|
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
|
}
|
|
@@ -683,14 +647,14 @@
|
|
|
683
647
|
*/
|
|
684
648
|
function getRecaptcha(siteKey) {
|
|
685
649
|
return new Promise((resolve, reject) => {
|
|
686
|
-
grecaptcha.ready(() =>
|
|
650
|
+
grecaptcha.ready(async () => {
|
|
687
651
|
try {
|
|
688
|
-
resolve(
|
|
652
|
+
resolve(await grecaptcha.execute(siteKey, { action: 'submit' }));
|
|
689
653
|
}
|
|
690
654
|
catch (err) {
|
|
691
655
|
reject(err);
|
|
692
656
|
}
|
|
693
|
-
})
|
|
657
|
+
});
|
|
694
658
|
});
|
|
695
659
|
}
|
|
696
660
|
|
|
@@ -701,10 +665,10 @@
|
|
|
701
665
|
const [outcome, setOutcome] = React.useState();
|
|
702
666
|
const issues = getIssuesForExpression(outcome, undefined);
|
|
703
667
|
React.useEffect(() => initRecaptcha(recaptchaSiteKey), [recaptchaSiteKey]);
|
|
704
|
-
return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: (formData) =>
|
|
668
|
+
return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: async (formData) => {
|
|
705
669
|
try {
|
|
706
|
-
const recaptchaToken =
|
|
707
|
-
props.handleAuthResponse(
|
|
670
|
+
const recaptchaToken = await getRecaptcha(recaptchaSiteKey);
|
|
671
|
+
props.handleAuthResponse(await medplum.startNewUser({
|
|
708
672
|
projectId: props.projectId,
|
|
709
673
|
firstName: formData.firstName,
|
|
710
674
|
lastName: formData.lastName,
|
|
@@ -718,18 +682,15 @@
|
|
|
718
682
|
catch (err) {
|
|
719
683
|
setOutcome(err);
|
|
720
684
|
}
|
|
721
|
-
}
|
|
685
|
+
} },
|
|
722
686
|
React.createElement(core$1.Center, { sx: { flexDirection: 'column' } }, props.children),
|
|
723
|
-
issues && (React.createElement(core$1.Alert, { icon: React.createElement(icons.IconAlertCircle, { size: 16 }), color: "red" }, issues.map((issue) => {
|
|
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
|
-
}))),
|
|
687
|
+
issues && (React.createElement(core$1.Alert, { icon: React.createElement(icons.IconAlertCircle, { size: 16 }), color: "red" }, issues.map((issue) => (React.createElement("div", { "data-testid": "text-field-error", key: issue.details?.text }, issue.details?.text))))),
|
|
727
688
|
googleClientId && (React.createElement(React.Fragment, null,
|
|
728
689
|
React.createElement(core$1.Group, { position: "center", p: "xl", style: { height: 70 } },
|
|
729
|
-
React.createElement(GoogleButton, { googleClientId: googleClientId, handleGoogleCredential: (response) =>
|
|
690
|
+
React.createElement(GoogleButton, { googleClientId: googleClientId, handleGoogleCredential: async (response) => {
|
|
730
691
|
try {
|
|
731
|
-
|
|
732
|
-
props.handleAuthResponse(
|
|
692
|
+
await medplum.startPkce();
|
|
693
|
+
props.handleAuthResponse(await medplum.startGoogleLogin({
|
|
733
694
|
googleClientId: response.clientId,
|
|
734
695
|
googleCredential: response.credential,
|
|
735
696
|
createUser: true,
|
|
@@ -738,7 +699,7 @@
|
|
|
738
699
|
catch (err) {
|
|
739
700
|
setOutcome(err);
|
|
740
701
|
}
|
|
741
|
-
}
|
|
702
|
+
} })),
|
|
742
703
|
React.createElement(core$1.Divider, { label: "or", labelPosition: "center", my: "lg" }))),
|
|
743
704
|
React.createElement(core$1.Stack, { spacing: "xl" },
|
|
744
705
|
React.createElement(core$1.TextInput, { name: "firstName", type: "text", label: "First name", placeholder: "First name", required: true, autoFocus: true, error: getErrorsForInput(outcome, 'firstName') }),
|
|
@@ -796,34 +757,37 @@
|
|
|
796
757
|
}
|
|
797
758
|
|
|
798
759
|
function AuthenticationForm(props) {
|
|
799
|
-
const { generatePkce, onForgotPassword, onRegister, handleAuthResponse, children
|
|
760
|
+
const { generatePkce, onForgotPassword, onRegister, handleAuthResponse, children, ...baseLoginRequest } = props;
|
|
800
761
|
const medplum = useMedplum();
|
|
801
762
|
const googleClientId = getGoogleClientId(props.googleClientId);
|
|
802
763
|
const [outcome, setOutcome] = React.useState();
|
|
803
764
|
const issues = getIssuesForExpression(outcome, undefined);
|
|
804
|
-
function startPkce() {
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
}
|
|
809
|
-
});
|
|
765
|
+
async function startPkce() {
|
|
766
|
+
if (generatePkce) {
|
|
767
|
+
await medplum.startPkce();
|
|
768
|
+
}
|
|
810
769
|
}
|
|
811
770
|
return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: (formData) => {
|
|
812
771
|
startPkce()
|
|
813
|
-
.then(() => medplum.startLogin(
|
|
772
|
+
.then(() => medplum.startLogin({
|
|
773
|
+
...baseLoginRequest,
|
|
774
|
+
email: formData.email,
|
|
775
|
+
password: formData.password,
|
|
776
|
+
remember: formData.remember === 'on',
|
|
777
|
+
}))
|
|
814
778
|
.then(handleAuthResponse)
|
|
815
779
|
.catch(setOutcome);
|
|
816
780
|
} },
|
|
817
781
|
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
|
-
}))),
|
|
782
|
+
issues && (React.createElement(core$1.Alert, { icon: React.createElement(icons.IconAlertCircle, { size: 16 }), color: "red" }, issues.map((issue) => (React.createElement("div", { "data-testid": "text-field-error", key: issue.details?.text }, issue.details?.text))))),
|
|
822
783
|
googleClientId && (React.createElement(React.Fragment, null,
|
|
823
784
|
React.createElement(core$1.Group, { position: "center", p: "xl", style: { height: 70 } },
|
|
824
785
|
React.createElement(GoogleButton, { googleClientId: googleClientId, handleGoogleCredential: (response) => {
|
|
825
786
|
startPkce()
|
|
826
|
-
.then(() => medplum.startGoogleLogin(
|
|
787
|
+
.then(() => medplum.startGoogleLogin({
|
|
788
|
+
...baseLoginRequest,
|
|
789
|
+
googleCredential: response.credential,
|
|
790
|
+
}))
|
|
827
791
|
.then(props.handleAuthResponse)
|
|
828
792
|
.catch(setOutcome);
|
|
829
793
|
} })),
|
|
@@ -844,23 +808,20 @@
|
|
|
844
808
|
React.createElement(core$1.Center, { sx: { flexDirection: 'column' } },
|
|
845
809
|
React.createElement(Logo, { size: 32 }),
|
|
846
810
|
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
|
-
})));
|
|
811
|
+
props.memberships.map((membership) => (React.createElement(core$1.UnstyledButton, { key: membership.id, onClick: () => {
|
|
812
|
+
medplum
|
|
813
|
+
.post('auth/profile', {
|
|
814
|
+
login: props.login,
|
|
815
|
+
profile: membership.id,
|
|
816
|
+
})
|
|
817
|
+
.then(props.handleAuthResponse)
|
|
818
|
+
.catch(console.log);
|
|
819
|
+
} },
|
|
820
|
+
React.createElement(core$1.Group, null,
|
|
821
|
+
React.createElement(core$1.Avatar, { radius: "xl" }),
|
|
822
|
+
React.createElement("div", { style: { flex: 1 } },
|
|
823
|
+
React.createElement(core$1.Text, { size: "sm", weight: 500 }, membership.profile?.display),
|
|
824
|
+
React.createElement(core$1.Text, { color: "dimmed", size: "xs" }, membership.project?.display))))))));
|
|
864
825
|
}
|
|
865
826
|
|
|
866
827
|
function ChooseScopeForm(props) {
|
|
@@ -918,7 +879,7 @@
|
|
|
918
879
|
* 5) Success - Return to the caller with either a code or a redirect
|
|
919
880
|
*/
|
|
920
881
|
function SignInForm(props) {
|
|
921
|
-
const { chooseScopes, onSuccess, onForgotPassword, onRegister, onCode
|
|
882
|
+
const { chooseScopes, onSuccess, onForgotPassword, onRegister, onCode, ...baseLoginRequest } = props;
|
|
922
883
|
const medplum = useMedplum();
|
|
923
884
|
const [login, setLogin] = React.useState(undefined);
|
|
924
885
|
const [mfaRequired, setAuthenticatorRequired] = React.useState(false);
|
|
@@ -960,7 +921,7 @@
|
|
|
960
921
|
}
|
|
961
922
|
return (React.createElement(Document, { width: 450 }, (() => {
|
|
962
923
|
if (!login) {
|
|
963
|
-
return (React.createElement(AuthenticationForm,
|
|
924
|
+
return (React.createElement(AuthenticationForm, { generatePkce: !onCode, onForgotPassword: onForgotPassword, onRegister: onRegister, handleAuthResponse: handleAuthResponse, ...baseLoginRequest }, props.children));
|
|
964
925
|
}
|
|
965
926
|
else if (mfaRequired) {
|
|
966
927
|
return React.createElement(MfaForm, { login: login, handleAuthResponse: handleAuthResponse });
|
|
@@ -1054,15 +1015,14 @@
|
|
|
1054
1015
|
}
|
|
1055
1016
|
|
|
1056
1017
|
function ContactDetailDisplay(props) {
|
|
1057
|
-
var _a;
|
|
1058
1018
|
const contactDetail = props.value;
|
|
1059
1019
|
if (!contactDetail) {
|
|
1060
1020
|
return null;
|
|
1061
1021
|
}
|
|
1062
1022
|
return (React.createElement(React.Fragment, null,
|
|
1063
1023
|
contactDetail.name,
|
|
1064
|
-
contactDetail.name && ': ',
|
|
1065
|
-
|
|
1024
|
+
contactDetail.name && ': ',
|
|
1025
|
+
contactDetail.telecom?.map((telecom, index) => (React.createElement(ContactPointDisplay, { key: 'telecom-' + index, value: telecom })))));
|
|
1066
1026
|
}
|
|
1067
1027
|
|
|
1068
1028
|
function HumanNameDisplay(props) {
|
|
@@ -1074,11 +1034,14 @@
|
|
|
1074
1034
|
}
|
|
1075
1035
|
|
|
1076
1036
|
function IdentifierDisplay(props) {
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1037
|
+
return (React.createElement("div", null,
|
|
1038
|
+
props.value?.system,
|
|
1039
|
+
": ",
|
|
1040
|
+
props.value?.value));
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
function MoneyDisplay(props) {
|
|
1044
|
+
return React.createElement(React.Fragment, null, core.formatMoney(props.value));
|
|
1082
1045
|
}
|
|
1083
1046
|
|
|
1084
1047
|
function QuantityDisplay(props) {
|
|
@@ -1102,12 +1065,12 @@
|
|
|
1102
1065
|
|
|
1103
1066
|
function MedplumLink(props) {
|
|
1104
1067
|
const navigate = reactRouterDom.useNavigate();
|
|
1105
|
-
const { to, suffix, label, onClick, children
|
|
1068
|
+
const { to, suffix, label, onClick, children, ...rest } = props;
|
|
1106
1069
|
let href = getHref(to);
|
|
1107
1070
|
if (suffix) {
|
|
1108
1071
|
href += '/' + suffix;
|
|
1109
1072
|
}
|
|
1110
|
-
return (React.createElement(core$1.Anchor,
|
|
1073
|
+
return (React.createElement(core$1.Anchor, { href: href, "aria-label": label, onClick: (e) => {
|
|
1111
1074
|
killEvent(e);
|
|
1112
1075
|
if (onClick) {
|
|
1113
1076
|
onClick();
|
|
@@ -1115,7 +1078,7 @@
|
|
|
1115
1078
|
else if (to) {
|
|
1116
1079
|
navigate(href);
|
|
1117
1080
|
}
|
|
1118
|
-
}
|
|
1081
|
+
}, ...rest }, children));
|
|
1119
1082
|
}
|
|
1120
1083
|
function getHref(to) {
|
|
1121
1084
|
if (to) {
|
|
@@ -1160,18 +1123,16 @@
|
|
|
1160
1123
|
}
|
|
1161
1124
|
|
|
1162
1125
|
function ResourceArrayDisplay(props) {
|
|
1163
|
-
var _a, _b, _c;
|
|
1164
1126
|
const property = props.property;
|
|
1165
|
-
const values =
|
|
1166
|
-
const propertyType =
|
|
1127
|
+
const values = props.values ?? [];
|
|
1128
|
+
const propertyType = property.type?.[0]?.code;
|
|
1167
1129
|
return (React.createElement(React.Fragment, null, values.map((v, index) => (React.createElement("div", { key: `${index}-${values.length}` },
|
|
1168
1130
|
React.createElement(ResourcePropertyDisplay, { arrayElement: true, property: property, propertyType: propertyType, value: v, ignoreMissingValues: props.ignoreMissingValues, link: props.link }))))));
|
|
1169
1131
|
}
|
|
1170
1132
|
|
|
1171
1133
|
function ResourcePropertyDisplay(props) {
|
|
1172
|
-
var _a;
|
|
1173
1134
|
const { property, propertyType, value } = props;
|
|
1174
|
-
if (
|
|
1135
|
+
if (property?.max === '*' && !props.arrayElement) {
|
|
1175
1136
|
if (propertyType === 'Attachment') {
|
|
1176
1137
|
return React.createElement(AttachmentArrayDisplay, { values: value, maxWidth: props.maxWidth });
|
|
1177
1138
|
}
|
|
@@ -1200,7 +1161,7 @@
|
|
|
1200
1161
|
case core.PropertyType.Address:
|
|
1201
1162
|
return React.createElement(AddressDisplay, { value: value });
|
|
1202
1163
|
case core.PropertyType.Annotation:
|
|
1203
|
-
return React.createElement(React.Fragment, null, value
|
|
1164
|
+
return React.createElement(React.Fragment, null, value?.text);
|
|
1204
1165
|
case core.PropertyType.Attachment:
|
|
1205
1166
|
return React.createElement(AttachmentDisplay, { value: value, maxWidth: props.maxWidth });
|
|
1206
1167
|
case core.PropertyType.CodeableConcept:
|
|
@@ -1215,6 +1176,8 @@
|
|
|
1215
1176
|
return React.createElement(HumanNameDisplay, { value: value });
|
|
1216
1177
|
case core.PropertyType.Identifier:
|
|
1217
1178
|
return React.createElement(IdentifierDisplay, { value: value });
|
|
1179
|
+
case core.PropertyType.Money:
|
|
1180
|
+
return React.createElement(MoneyDisplay, { value: value });
|
|
1218
1181
|
case core.PropertyType.Period:
|
|
1219
1182
|
return React.createElement(React.Fragment, null, core.formatPeriod(value));
|
|
1220
1183
|
case core.PropertyType.Quantity:
|
|
@@ -1232,10 +1195,10 @@
|
|
|
1232
1195
|
case core.PropertyType.UsageContext:
|
|
1233
1196
|
return (React.createElement(BackboneElementDisplay, { value: { type: propertyType, value }, compact: true, ignoreMissingValues: props.ignoreMissingValues }));
|
|
1234
1197
|
default:
|
|
1235
|
-
if (!
|
|
1198
|
+
if (!property?.path) {
|
|
1236
1199
|
throw Error(`Displaying property of type ${props.propertyType} requires element definition path`);
|
|
1237
1200
|
}
|
|
1238
|
-
return (React.createElement(BackboneElementDisplay, { value: { type: core.buildTypeName(
|
|
1201
|
+
return (React.createElement(BackboneElementDisplay, { value: { type: core.buildTypeName(property?.path?.split('.')), value }, compact: true, ignoreMissingValues: props.ignoreMissingValues }));
|
|
1239
1202
|
}
|
|
1240
1203
|
}
|
|
1241
1204
|
/**
|
|
@@ -1435,12 +1398,11 @@
|
|
|
1435
1398
|
}
|
|
1436
1399
|
function ValueSetAutocomplete(props) {
|
|
1437
1400
|
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;
|
|
1401
|
+
const { elementDefinition, ...rest } = props;
|
|
1402
|
+
const loadValues = React.useCallback(async (input, signal) => {
|
|
1403
|
+
const system = elementDefinition.binding?.valueSet;
|
|
1404
|
+
const valueSet = await medplum.searchValueSet(system, input, { signal });
|
|
1405
|
+
const valueSetElements = valueSet.expansion?.contains;
|
|
1444
1406
|
const newData = [];
|
|
1445
1407
|
for (const valueSetElement of valueSetElements) {
|
|
1446
1408
|
if (valueSetElement.code && !newData.some((item) => item.code === valueSetElement.code)) {
|
|
@@ -1448,8 +1410,8 @@
|
|
|
1448
1410
|
}
|
|
1449
1411
|
}
|
|
1450
1412
|
return newData;
|
|
1451
|
-
}
|
|
1452
|
-
return (React.createElement(AsyncAutocomplete,
|
|
1413
|
+
}, [medplum, elementDefinition]);
|
|
1414
|
+
return (React.createElement(AsyncAutocomplete, { ...rest, creatable: true, clearable: true, toKey: toKey, toOption: toOption, loadOptions: loadValues, getCreateLabel: (query) => `+ Create ${query}`, onCreate: createValue }));
|
|
1453
1415
|
}
|
|
1454
1416
|
function getDisplay(item) {
|
|
1455
1417
|
return item.display || item.code || '';
|
|
@@ -1467,8 +1429,7 @@
|
|
|
1467
1429
|
return (React.createElement(ValueSetAutocomplete, { elementDefinition: props.property, name: props.name, placeholder: props.placeholder, defaultValue: value && codeableConceptToValueSetElement(value), onChange: handleChange }));
|
|
1468
1430
|
}
|
|
1469
1431
|
function codeableConceptToValueSetElement(concept) {
|
|
1470
|
-
|
|
1471
|
-
return (_a = concept.coding) === null || _a === void 0 ? void 0 : _a.map((c) => ({
|
|
1432
|
+
return concept.coding?.map((c) => ({
|
|
1472
1433
|
system: c.system,
|
|
1473
1434
|
code: c.code,
|
|
1474
1435
|
display: c.display,
|
|
@@ -1503,7 +1464,7 @@
|
|
|
1503
1464
|
return code ? { code } : undefined;
|
|
1504
1465
|
}
|
|
1505
1466
|
function valueSetElementToCode(element) {
|
|
1506
|
-
return element
|
|
1467
|
+
return element?.code;
|
|
1507
1468
|
}
|
|
1508
1469
|
|
|
1509
1470
|
function CodingInput(props) {
|
|
@@ -1547,34 +1508,33 @@
|
|
|
1547
1508
|
}
|
|
1548
1509
|
}
|
|
1549
1510
|
function setSystem(system) {
|
|
1550
|
-
const newValue =
|
|
1511
|
+
const newValue = { ...ref.current, system };
|
|
1551
1512
|
if (!system) {
|
|
1552
1513
|
delete newValue.system;
|
|
1553
1514
|
}
|
|
1554
1515
|
setContactPointWrapper(newValue);
|
|
1555
1516
|
}
|
|
1556
1517
|
function setUse(use) {
|
|
1557
|
-
const newValue =
|
|
1518
|
+
const newValue = { ...ref.current, use };
|
|
1558
1519
|
if (!use) {
|
|
1559
1520
|
delete newValue.use;
|
|
1560
1521
|
}
|
|
1561
1522
|
setContactPointWrapper(newValue);
|
|
1562
1523
|
}
|
|
1563
1524
|
function setValue(value) {
|
|
1564
|
-
const newValue =
|
|
1525
|
+
const newValue = { ...ref.current, value };
|
|
1565
1526
|
if (!value) {
|
|
1566
1527
|
delete newValue.value;
|
|
1567
1528
|
}
|
|
1568
1529
|
setContactPointWrapper(newValue);
|
|
1569
1530
|
}
|
|
1570
1531
|
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
|
|
1532
|
+
React.createElement(core$1.NativeSelect, { "data-testid": "system", defaultValue: contactPoint?.system, onChange: (e) => setSystem(e.currentTarget.value), data: ['', 'email', 'phone', 'fax', 'pager', 'sms', 'other'] }),
|
|
1533
|
+
React.createElement(core$1.NativeSelect, { "data-testid": "use", defaultValue: contactPoint?.use, onChange: (e) => setUse(e.currentTarget.value), data: ['', 'home', 'work', 'temp', 'old', 'mobile'] }),
|
|
1534
|
+
React.createElement(core$1.TextInput, { placeholder: "Value", defaultValue: contactPoint?.value, onChange: (e) => setValue(e.currentTarget.value) })));
|
|
1574
1535
|
}
|
|
1575
1536
|
|
|
1576
1537
|
function ContactDetailInput(props) {
|
|
1577
|
-
var _a;
|
|
1578
1538
|
const [contactPoint, setContactDetail] = React.useState(props.defaultValue);
|
|
1579
1539
|
const ref = React.useRef();
|
|
1580
1540
|
ref.current = contactPoint;
|
|
@@ -1585,22 +1545,22 @@
|
|
|
1585
1545
|
}
|
|
1586
1546
|
}
|
|
1587
1547
|
function setName(name) {
|
|
1588
|
-
const newValue =
|
|
1548
|
+
const newValue = { ...ref.current, name };
|
|
1589
1549
|
if (!name) {
|
|
1590
1550
|
delete newValue.name;
|
|
1591
1551
|
}
|
|
1592
1552
|
setContactDetailWrapper(newValue);
|
|
1593
1553
|
}
|
|
1594
1554
|
function setTelecom(telecom) {
|
|
1595
|
-
const newValue =
|
|
1555
|
+
const newValue = { ...ref.current, telecom: telecom && [telecom] };
|
|
1596
1556
|
if (!telecom) {
|
|
1597
1557
|
delete newValue.telecom;
|
|
1598
1558
|
}
|
|
1599
1559
|
setContactDetailWrapper(newValue);
|
|
1600
1560
|
}
|
|
1601
1561
|
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:
|
|
1562
|
+
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) }),
|
|
1563
|
+
React.createElement(ContactPointInput, { name: props.name + '-telecom', defaultValue: contactPoint?.telecom?.[0], onChange: setTelecom })));
|
|
1604
1564
|
}
|
|
1605
1565
|
|
|
1606
1566
|
/**
|
|
@@ -1675,7 +1635,6 @@
|
|
|
1675
1635
|
}
|
|
1676
1636
|
|
|
1677
1637
|
function HumanNameInput(props) {
|
|
1678
|
-
var _a, _b, _c;
|
|
1679
1638
|
const [value, setValue] = React.useState(props.defaultValue);
|
|
1680
1639
|
const valueRef = React.useRef();
|
|
1681
1640
|
valueRef.current = value;
|
|
@@ -1686,26 +1645,38 @@
|
|
|
1686
1645
|
}
|
|
1687
1646
|
}
|
|
1688
1647
|
function setUse(use) {
|
|
1689
|
-
setValueWrapper(
|
|
1648
|
+
setValueWrapper({ ...valueRef.current, use: use ? use : undefined });
|
|
1690
1649
|
}
|
|
1691
1650
|
function setPrefix(prefix) {
|
|
1692
|
-
setValueWrapper(
|
|
1651
|
+
setValueWrapper({
|
|
1652
|
+
...valueRef.current,
|
|
1653
|
+
prefix: prefix ? prefix.split(' ') : undefined,
|
|
1654
|
+
});
|
|
1693
1655
|
}
|
|
1694
1656
|
function setGiven(given) {
|
|
1695
|
-
setValueWrapper(
|
|
1657
|
+
setValueWrapper({
|
|
1658
|
+
...valueRef.current,
|
|
1659
|
+
given: given ? given.split(' ') : undefined,
|
|
1660
|
+
});
|
|
1696
1661
|
}
|
|
1697
1662
|
function setFamily(family) {
|
|
1698
|
-
setValueWrapper(
|
|
1663
|
+
setValueWrapper({
|
|
1664
|
+
...valueRef.current,
|
|
1665
|
+
family: family ? family : undefined,
|
|
1666
|
+
});
|
|
1699
1667
|
}
|
|
1700
1668
|
function setSuffix(suffix) {
|
|
1701
|
-
setValueWrapper(
|
|
1669
|
+
setValueWrapper({
|
|
1670
|
+
...valueRef.current,
|
|
1671
|
+
suffix: suffix ? suffix.split(' ') : undefined,
|
|
1672
|
+
});
|
|
1702
1673
|
}
|
|
1703
1674
|
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:
|
|
1675
|
+
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'] }),
|
|
1676
|
+
React.createElement(core$1.TextInput, { placeholder: "Prefix", defaultValue: value?.prefix?.join(' '), onChange: (e) => setPrefix(e.currentTarget.value) }),
|
|
1677
|
+
React.createElement(core$1.TextInput, { placeholder: "Given", defaultValue: value?.given?.join(' '), onChange: (e) => setGiven(e.currentTarget.value) }),
|
|
1678
|
+
React.createElement(core$1.TextInput, { placeholder: "Family", defaultValue: value?.family, onChange: (e) => setFamily(e.currentTarget.value) }),
|
|
1679
|
+
React.createElement(core$1.TextInput, { placeholder: "Suffix", defaultValue: value?.suffix?.join(' '), onChange: (e) => setSuffix(e.currentTarget.value) })));
|
|
1709
1680
|
}
|
|
1710
1681
|
|
|
1711
1682
|
function IdentifierInput(props) {
|
|
@@ -1717,8 +1688,55 @@
|
|
|
1717
1688
|
}
|
|
1718
1689
|
}
|
|
1719
1690
|
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
|
|
1691
|
+
React.createElement(core$1.TextInput, { placeholder: "System", defaultValue: value?.system, onChange: (e) => setValueWrapper({ ...value, system: e.currentTarget.value }) }),
|
|
1692
|
+
React.createElement(core$1.TextInput, { placeholder: "Value", defaultValue: value?.value, onChange: (e) => setValueWrapper({ ...value, value: e.currentTarget.value }) })));
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
/*
|
|
1696
|
+
* Based on: https://github.com/mantinedev/ui.mantine.dev/blob/master/components/CurrencyInput/CurrencyInput.tsx
|
|
1697
|
+
*/
|
|
1698
|
+
/**
|
|
1699
|
+
* List of currencies.
|
|
1700
|
+
*
|
|
1701
|
+
* Full list of currencies:
|
|
1702
|
+
* https://www.hl7.org/fhir/valueset-currencies.html
|
|
1703
|
+
*
|
|
1704
|
+
* Latest browsers can report list of supported currencies, but it's not widely supported:
|
|
1705
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf
|
|
1706
|
+
*
|
|
1707
|
+
* Using a short list for simplicity for now.
|
|
1708
|
+
*/
|
|
1709
|
+
const data = ['USD', 'EUR', 'CAD', 'GBP', 'AUD'];
|
|
1710
|
+
function MoneyInput(props) {
|
|
1711
|
+
const { onChange } = props;
|
|
1712
|
+
const [value, setValue] = React.useState(props.defaultValue);
|
|
1713
|
+
const setValueWrapper = React.useCallback((newValue) => {
|
|
1714
|
+
setValue(newValue);
|
|
1715
|
+
if (onChange) {
|
|
1716
|
+
onChange(newValue);
|
|
1717
|
+
}
|
|
1718
|
+
}, [onChange]);
|
|
1719
|
+
const handleCurrencyChange = React.useCallback((e) => {
|
|
1720
|
+
setValueWrapper({
|
|
1721
|
+
...value,
|
|
1722
|
+
currency: e.currentTarget.value,
|
|
1723
|
+
});
|
|
1724
|
+
}, [value, setValueWrapper]);
|
|
1725
|
+
const handleValueChange = React.useCallback((e) => {
|
|
1726
|
+
setValueWrapper({
|
|
1727
|
+
...value,
|
|
1728
|
+
value: e.currentTarget.valueAsNumber,
|
|
1729
|
+
});
|
|
1730
|
+
}, [value, setValueWrapper]);
|
|
1731
|
+
const select = (React.createElement(core$1.NativeSelect, { defaultValue: value?.currency, data: data, styles: {
|
|
1732
|
+
input: {
|
|
1733
|
+
fontWeight: 500,
|
|
1734
|
+
borderTopLeftRadius: 0,
|
|
1735
|
+
borderBottomLeftRadius: 0,
|
|
1736
|
+
width: 92,
|
|
1737
|
+
},
|
|
1738
|
+
}, onChange: handleCurrencyChange }));
|
|
1739
|
+
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
1740
|
}
|
|
1723
1741
|
|
|
1724
1742
|
function PeriodInput(props) {
|
|
@@ -1730,12 +1748,11 @@
|
|
|
1730
1748
|
}
|
|
1731
1749
|
}
|
|
1732
1750
|
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
|
|
1751
|
+
React.createElement(DateTimeInput, { name: props.name + '.start', placeholder: "Start", defaultValue: value?.start, onChange: (newValue) => setValueWrapper({ ...value, start: newValue }) }),
|
|
1752
|
+
React.createElement(DateTimeInput, { name: props.name + '.end', placeholder: "End", defaultValue: value?.end, onChange: (newValue) => setValueWrapper({ ...value, end: newValue }) })));
|
|
1735
1753
|
}
|
|
1736
1754
|
|
|
1737
1755
|
function QuantityInput(props) {
|
|
1738
|
-
var _a;
|
|
1739
1756
|
const [value, setValue] = React.useState(props.defaultValue);
|
|
1740
1757
|
function setValueWrapper(newValue) {
|
|
1741
1758
|
setValue(newValue);
|
|
@@ -1744,9 +1761,18 @@
|
|
|
1744
1761
|
}
|
|
1745
1762
|
}
|
|
1746
1763
|
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
|
-
|
|
1764
|
+
React.createElement(core$1.NativeSelect, { style: { width: 80 }, "data-testid": props.name + '-comparator', defaultValue: value?.comparator, data: ['', '<', '<=', '>=', '>'], onChange: (e) => setValueWrapper({
|
|
1765
|
+
...value,
|
|
1766
|
+
comparator: e.currentTarget.value,
|
|
1767
|
+
}) }),
|
|
1768
|
+
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({
|
|
1769
|
+
...value,
|
|
1770
|
+
value: tryParseNumber(e.currentTarget.value),
|
|
1771
|
+
}) }),
|
|
1772
|
+
React.createElement(core$1.TextInput, { placeholder: "Unit", "data-testid": props.name + '-unit', defaultValue: value?.unit, onChange: (e) => setValueWrapper({
|
|
1773
|
+
...value,
|
|
1774
|
+
unit: e.currentTarget.value,
|
|
1775
|
+
}) })));
|
|
1750
1776
|
}
|
|
1751
1777
|
function tryParseNumber(str) {
|
|
1752
1778
|
if (!str) {
|
|
@@ -1770,8 +1796,14 @@
|
|
|
1770
1796
|
}
|
|
1771
1797
|
}
|
|
1772
1798
|
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
1773
|
-
React.createElement(QuantityInput, { name: props.name + '-low', defaultValue: value
|
|
1774
|
-
|
|
1799
|
+
React.createElement(QuantityInput, { name: props.name + '-low', defaultValue: value?.low, onChange: (v) => setValueWrapper({
|
|
1800
|
+
...value,
|
|
1801
|
+
low: v,
|
|
1802
|
+
}) }),
|
|
1803
|
+
React.createElement(QuantityInput, { name: props.name + '-high', defaultValue: value?.high, onChange: (v) => setValueWrapper({
|
|
1804
|
+
...value,
|
|
1805
|
+
high: v,
|
|
1806
|
+
}) })));
|
|
1775
1807
|
}
|
|
1776
1808
|
|
|
1777
1809
|
/**
|
|
@@ -1789,24 +1821,29 @@
|
|
|
1789
1821
|
}
|
|
1790
1822
|
}
|
|
1791
1823
|
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
1792
|
-
React.createElement(QuantityInput, { name: props.name + '-numerator', defaultValue: value
|
|
1793
|
-
|
|
1824
|
+
React.createElement(QuantityInput, { name: props.name + '-numerator', defaultValue: value?.numerator, onChange: (v) => setValueWrapper({
|
|
1825
|
+
...value,
|
|
1826
|
+
numerator: v,
|
|
1827
|
+
}) }),
|
|
1828
|
+
React.createElement(QuantityInput, { name: props.name + '-denominator', defaultValue: value?.denominator, onChange: (v) => setValueWrapper({
|
|
1829
|
+
...value,
|
|
1830
|
+
denominator: v,
|
|
1831
|
+
}) })));
|
|
1794
1832
|
}
|
|
1795
1833
|
|
|
1796
1834
|
function ResourceAvatar(props) {
|
|
1797
|
-
var _a, _b, _c;
|
|
1798
1835
|
const resource = useResource(props.value);
|
|
1799
|
-
const text = resource ? core.getDisplayString(resource) :
|
|
1800
|
-
const imageUrl = (
|
|
1801
|
-
const radius =
|
|
1802
|
-
const avatarProps =
|
|
1836
|
+
const text = resource ? core.getDisplayString(resource) : props.alt ?? '';
|
|
1837
|
+
const imageUrl = (resource && core.getImageSrc(resource)) ?? props.src;
|
|
1838
|
+
const radius = props.radius ?? 'xl';
|
|
1839
|
+
const avatarProps = { ...props };
|
|
1803
1840
|
delete avatarProps.value;
|
|
1804
1841
|
delete avatarProps.link;
|
|
1805
1842
|
if (props.link) {
|
|
1806
1843
|
return (React.createElement(MedplumLink, { to: resource },
|
|
1807
|
-
React.createElement(core$1.Avatar,
|
|
1844
|
+
React.createElement(core$1.Avatar, { src: imageUrl, alt: text, radius: radius, ...avatarProps })));
|
|
1808
1845
|
}
|
|
1809
|
-
return React.createElement(core$1.Avatar,
|
|
1846
|
+
return React.createElement(core$1.Avatar, { src: imageUrl, alt: text, radius: radius, ...avatarProps });
|
|
1810
1847
|
}
|
|
1811
1848
|
|
|
1812
1849
|
/**
|
|
@@ -1837,24 +1874,20 @@
|
|
|
1837
1874
|
setValue(core.getDisplayString(defaultValue));
|
|
1838
1875
|
}
|
|
1839
1876
|
}, [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);
|
|
1877
|
+
async function loadValues(input) {
|
|
1878
|
+
setLoading(true);
|
|
1879
|
+
const searchCode = SEARCH_CODES[props.resourceType] || 'name';
|
|
1880
|
+
const searchParams = new URLSearchParams({
|
|
1881
|
+
[searchCode]: input,
|
|
1882
|
+
_count: '10',
|
|
1851
1883
|
});
|
|
1884
|
+
const resources = await medplum.searchResources(props.resourceType, searchParams);
|
|
1885
|
+
setData(resources.map((resource) => ({ value: core.getDisplayString(resource), resource })));
|
|
1886
|
+
setLoading(false);
|
|
1852
1887
|
}
|
|
1853
|
-
function handleChange(val) {
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
return loadValues(val);
|
|
1857
|
-
});
|
|
1888
|
+
async function handleChange(val) {
|
|
1889
|
+
setValue(val);
|
|
1890
|
+
return loadValues(val);
|
|
1858
1891
|
}
|
|
1859
1892
|
function handleSelect(item) {
|
|
1860
1893
|
setValue(item.value);
|
|
@@ -1865,9 +1898,8 @@
|
|
|
1865
1898
|
}
|
|
1866
1899
|
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
1900
|
}
|
|
1868
|
-
const ItemComponent = React.forwardRef((
|
|
1869
|
-
|
|
1870
|
-
return (React.createElement("div", Object.assign({ ref: ref }, others),
|
|
1901
|
+
const ItemComponent = React.forwardRef(({ value, resource, ...others }, ref) => {
|
|
1902
|
+
return (React.createElement("div", { ref: ref, ...others },
|
|
1871
1903
|
React.createElement(core$1.Group, { noWrap: true },
|
|
1872
1904
|
React.createElement(ResourceAvatar, { value: resource }),
|
|
1873
1905
|
React.createElement("div", null,
|
|
@@ -1876,7 +1908,7 @@
|
|
|
1876
1908
|
});
|
|
1877
1909
|
|
|
1878
1910
|
function ReferenceInput(props) {
|
|
1879
|
-
const targetTypes = props.targetTypes;
|
|
1911
|
+
const targetTypes = getTargetTypes$1(props.targetTypes);
|
|
1880
1912
|
const initialResourceType = getInitialResourceType(props.defaultValue, targetTypes);
|
|
1881
1913
|
const [value, setValue] = React.useState(props.defaultValue);
|
|
1882
1914
|
const [resourceType, setResourceType] = React.useState(initialResourceType);
|
|
@@ -1896,9 +1928,14 @@
|
|
|
1896
1928
|
setValueHelper(item ? core.createReference(item) : undefined);
|
|
1897
1929
|
} })));
|
|
1898
1930
|
}
|
|
1931
|
+
function getTargetTypes$1(targetTypes) {
|
|
1932
|
+
if (!targetTypes || targetTypes.length === 0 || (targetTypes.length === 1 && targetTypes[0] === 'Resource')) {
|
|
1933
|
+
return undefined;
|
|
1934
|
+
}
|
|
1935
|
+
return targetTypes;
|
|
1936
|
+
}
|
|
1899
1937
|
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];
|
|
1938
|
+
const defaultValueResourceType = defaultValue?.reference?.split('/')[0];
|
|
1902
1939
|
if (defaultValueResourceType) {
|
|
1903
1940
|
return defaultValueResourceType;
|
|
1904
1941
|
}
|
|
@@ -1969,23 +2006,20 @@
|
|
|
1969
2006
|
}, onCancel: () => setOpen(false) })));
|
|
1970
2007
|
}
|
|
1971
2008
|
function TimingEditorDialog(props) {
|
|
1972
|
-
var _a, _b;
|
|
1973
2009
|
const [value, setValue] = React.useState(props.defaultValue || {});
|
|
1974
2010
|
const valueRef = React.useRef();
|
|
1975
2011
|
valueRef.current = value;
|
|
1976
2012
|
function setStart(newStart) {
|
|
1977
|
-
setValue(
|
|
2013
|
+
setValue({ ...valueRef.current, event: [newStart] });
|
|
1978
2014
|
}
|
|
1979
2015
|
function setRepeat(repeat) {
|
|
1980
|
-
setValue(
|
|
2016
|
+
setValue({ ...valueRef.current, repeat });
|
|
1981
2017
|
}
|
|
1982
2018
|
function setPeriod(newPeriod) {
|
|
1983
|
-
|
|
1984
|
-
setRepeat(Object.assign(Object.assign({}, (_a = valueRef.current) === null || _a === void 0 ? void 0 : _a.repeat), { period: newPeriod }));
|
|
2019
|
+
setRepeat({ ...valueRef.current?.repeat, period: newPeriod });
|
|
1985
2020
|
}
|
|
1986
2021
|
function setPeriodUnit(newPeriodUnit) {
|
|
1987
|
-
|
|
1988
|
-
setRepeat(Object.assign(Object.assign({}, (_a = valueRef.current) === null || _a === void 0 ? void 0 : _a.repeat), { periodUnit: newPeriodUnit }));
|
|
2022
|
+
setRepeat({ ...valueRef.current?.repeat, periodUnit: newPeriodUnit });
|
|
1989
2023
|
}
|
|
1990
2024
|
function setDayOfWeek(day, enabled) {
|
|
1991
2025
|
if (enabled) {
|
|
@@ -1996,17 +2030,15 @@
|
|
|
1996
2030
|
}
|
|
1997
2031
|
}
|
|
1998
2032
|
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) || [];
|
|
2033
|
+
const existing = valueRef.current?.repeat?.dayOfWeek || [];
|
|
2001
2034
|
if (!existing.includes(day)) {
|
|
2002
|
-
setRepeat(
|
|
2035
|
+
setRepeat({ ...valueRef.current?.repeat, dayOfWeek: [...existing, day] });
|
|
2003
2036
|
}
|
|
2004
2037
|
}
|
|
2005
2038
|
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) || [];
|
|
2039
|
+
const existing = valueRef.current?.repeat?.dayOfWeek || [];
|
|
2008
2040
|
if (existing.includes(day)) {
|
|
2009
|
-
setRepeat(
|
|
2041
|
+
setRepeat({ ...valueRef.current?.repeat, dayOfWeek: existing.filter((d) => d !== day) });
|
|
2010
2042
|
}
|
|
2011
2043
|
}
|
|
2012
2044
|
return (React.createElement(core$1.Modal, { title: "Timing", closeButtonLabel: "Close", opened: props.visible, onClose: () => props.onCancel() },
|
|
@@ -2015,8 +2047,8 @@
|
|
|
2015
2047
|
React.createElement(DateTimeInput, { name: 'timing-dialog-start', onChange: (newValue) => setStart(newValue) })),
|
|
2016
2048
|
React.createElement(FormSection, { title: "Repeat every", htmlFor: 'timing-dialog-period' },
|
|
2017
2049
|
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:
|
|
2050
|
+
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)) }),
|
|
2051
|
+
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
2052
|
{ label: 'day', value: 'd' },
|
|
2021
2053
|
{ label: 'week', value: 'wk' },
|
|
2022
2054
|
{ label: 'month', value: 'mo' },
|
|
@@ -2030,9 +2062,8 @@
|
|
|
2030
2062
|
}
|
|
2031
2063
|
|
|
2032
2064
|
function ResourcePropertyInput(props) {
|
|
2033
|
-
var _a, _b, _c;
|
|
2034
2065
|
const property = props.property;
|
|
2035
|
-
const propertyType =
|
|
2066
|
+
const propertyType = props.defaultPropertyType ?? property.type?.[0]?.code;
|
|
2036
2067
|
const name = props.name;
|
|
2037
2068
|
const value = props.defaultValue;
|
|
2038
2069
|
if (property.max === '*' && !props.arrayElement) {
|
|
@@ -2043,10 +2074,10 @@
|
|
|
2043
2074
|
}
|
|
2044
2075
|
const propertyTypes = property.type;
|
|
2045
2076
|
if (propertyTypes.length > 1) {
|
|
2046
|
-
return React.createElement(ElementDefinitionInputSelector,
|
|
2077
|
+
return React.createElement(ElementDefinitionInputSelector, { elementDefinitionTypes: propertyTypes, ...props });
|
|
2047
2078
|
}
|
|
2048
2079
|
else {
|
|
2049
|
-
return React.createElement(ElementDefinitionTypeInput,
|
|
2080
|
+
return React.createElement(ElementDefinitionTypeInput, { elementDefinitionType: propertyTypes[0], ...props });
|
|
2050
2081
|
}
|
|
2051
2082
|
}
|
|
2052
2083
|
function ElementDefinitionInputSelector(props) {
|
|
@@ -2060,20 +2091,19 @@
|
|
|
2060
2091
|
}
|
|
2061
2092
|
const [selectedType, setSelectedType] = React.useState(initialPropertyType);
|
|
2062
2093
|
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
2063
|
-
React.createElement(core$1.NativeSelect, { style: { width: '200px' }, defaultValue: selectedType
|
|
2094
|
+
React.createElement(core$1.NativeSelect, { style: { width: '200px' }, defaultValue: selectedType?.code, onChange: (e) => {
|
|
2064
2095
|
setSelectedType(propertyTypes.find((type) => type.code === e.currentTarget.value));
|
|
2065
2096
|
}, data: propertyTypes.map((type) => ({
|
|
2066
2097
|
value: type.code,
|
|
2067
2098
|
label: type.code,
|
|
2068
2099
|
})) }),
|
|
2069
|
-
React.createElement(ElementDefinitionTypeInput,
|
|
2100
|
+
React.createElement(ElementDefinitionTypeInput, { ...props, elementDefinitionType: selectedType, onChange: (newValue) => {
|
|
2070
2101
|
if (props.onChange) {
|
|
2071
2102
|
props.onChange(newValue, props.name.replace('[x]', core.capitalize(selectedType.code)));
|
|
2072
2103
|
}
|
|
2073
|
-
} })))
|
|
2104
|
+
} })));
|
|
2074
2105
|
}
|
|
2075
2106
|
function ElementDefinitionTypeInput(props) {
|
|
2076
|
-
var _a;
|
|
2077
2107
|
const property = props.property;
|
|
2078
2108
|
const propertyType = props.elementDefinitionType.code;
|
|
2079
2109
|
const name = props.name;
|
|
@@ -2146,6 +2176,8 @@
|
|
|
2146
2176
|
return React.createElement(HumanNameInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
2147
2177
|
case core.PropertyType.Identifier:
|
|
2148
2178
|
return React.createElement(IdentifierInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
2179
|
+
case core.PropertyType.Money:
|
|
2180
|
+
return React.createElement(MoneyInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
2149
2181
|
case core.PropertyType.Period:
|
|
2150
2182
|
return React.createElement(PeriodInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
2151
2183
|
case core.PropertyType.Duration:
|
|
@@ -2163,17 +2195,15 @@
|
|
|
2163
2195
|
case core.PropertyType.UsageContext:
|
|
2164
2196
|
return (React.createElement(BackboneElementInput, { typeName: propertyType, defaultValue: value, onChange: props.onChange, outcome: props.outcome }));
|
|
2165
2197
|
default:
|
|
2166
|
-
return (React.createElement(BackboneElementInput, { typeName: core.buildTypeName(
|
|
2198
|
+
return (React.createElement(BackboneElementInput, { typeName: core.buildTypeName(property.path?.split('.')), defaultValue: value, onChange: props.onChange, outcome: props.outcome }));
|
|
2167
2199
|
}
|
|
2168
2200
|
}
|
|
2169
2201
|
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());
|
|
2202
|
+
return property?.type?.[0]?.targetProfile?.map((p) => p.split('/').pop());
|
|
2172
2203
|
}
|
|
2173
2204
|
|
|
2174
2205
|
function BackboneElementInput(props) {
|
|
2175
|
-
|
|
2176
|
-
const [value, setValue] = React.useState((_a = props.defaultValue) !== null && _a !== void 0 ? _a : {});
|
|
2206
|
+
const [value, setValue] = React.useState(props.defaultValue ?? {});
|
|
2177
2207
|
function setValueWrapper(newValue) {
|
|
2178
2208
|
setValue(newValue);
|
|
2179
2209
|
if (props.onChange) {
|
|
@@ -2201,12 +2231,12 @@
|
|
|
2201
2231
|
if (property.type.length === 1 && property.type[0].code === 'boolean') {
|
|
2202
2232
|
return (React.createElement(CheckboxFormSection, { key: key, title: core.getPropertyDisplayName(key), description: property.definition, htmlFor: key },
|
|
2203
2233
|
React.createElement(ResourcePropertyInput, { property: property, name: key, defaultValue: propertyValue, defaultPropertyType: propertyType, outcome: props.outcome, onChange: (newValue, propName) => {
|
|
2204
|
-
setValueWrapper(setPropertyValue(value, key, propName
|
|
2234
|
+
setValueWrapper(setPropertyValue(value, key, propName ?? key, entry[1], newValue));
|
|
2205
2235
|
} })));
|
|
2206
2236
|
}
|
|
2207
2237
|
return (React.createElement(FormSection, { key: key, title: core.getPropertyDisplayName(key), description: property.definition, htmlFor: key, outcome: props.outcome },
|
|
2208
2238
|
React.createElement(ResourcePropertyInput, { property: property, name: key, defaultValue: propertyValue, defaultPropertyType: propertyType, outcome: props.outcome, onChange: (newValue, propName) => {
|
|
2209
|
-
setValueWrapper(setPropertyValue(value, key, propName
|
|
2239
|
+
setValueWrapper(setPropertyValue(value, key, propName ?? key, entry[1], newValue));
|
|
2210
2240
|
} })));
|
|
2211
2241
|
})));
|
|
2212
2242
|
}
|
|
@@ -2340,13 +2370,13 @@
|
|
|
2340
2370
|
}
|
|
2341
2371
|
|
|
2342
2372
|
function ResourceName(props) {
|
|
2343
|
-
const { value, link
|
|
2373
|
+
const { value, link, ...rest } = props;
|
|
2344
2374
|
const resource = useResource(value);
|
|
2345
2375
|
if (!resource) {
|
|
2346
2376
|
return null;
|
|
2347
2377
|
}
|
|
2348
2378
|
const text = core.getDisplayString(resource);
|
|
2349
|
-
return link ? (React.createElement(MedplumLink,
|
|
2379
|
+
return link ? (React.createElement(MedplumLink, { to: resource, ...rest }, text)) : (React.createElement(core$1.Text, { component: "span", ...rest }, text));
|
|
2350
2380
|
}
|
|
2351
2381
|
|
|
2352
2382
|
function ResourceBadge(props) {
|
|
@@ -2433,20 +2463,19 @@
|
|
|
2433
2463
|
},
|
|
2434
2464
|
}));
|
|
2435
2465
|
function DiagnosticReportDisplay(props) {
|
|
2436
|
-
var _a, _b;
|
|
2437
2466
|
const diagnosticReport = useResource(props.value);
|
|
2438
|
-
const specimen = useResource(
|
|
2467
|
+
const specimen = useResource(diagnosticReport?.specimen?.[0]);
|
|
2439
2468
|
if (!diagnosticReport) {
|
|
2440
2469
|
return null;
|
|
2441
2470
|
}
|
|
2442
2471
|
let textContent = '';
|
|
2443
2472
|
if (diagnosticReport.presentedForm && diagnosticReport.presentedForm.length > 0) {
|
|
2444
2473
|
const pf = diagnosticReport.presentedForm[0];
|
|
2445
|
-
if (
|
|
2474
|
+
if (pf.contentType?.startsWith('text/plain') && pf.data) {
|
|
2446
2475
|
textContent = window.atob(pf.data);
|
|
2447
2476
|
}
|
|
2448
2477
|
}
|
|
2449
|
-
if (specimen
|
|
2478
|
+
if (specimen?.note) {
|
|
2450
2479
|
for (const note of specimen.note) {
|
|
2451
2480
|
textContent += note.text + '\n\n';
|
|
2452
2481
|
}
|
|
@@ -2473,7 +2502,6 @@
|
|
|
2473
2502
|
textContent && React.createElement("pre", null, textContent.trim())));
|
|
2474
2503
|
}
|
|
2475
2504
|
function ObservationTable(props) {
|
|
2476
|
-
var _a;
|
|
2477
2505
|
const { classes } = useStyles$9();
|
|
2478
2506
|
return (React.createElement("table", { className: classes.table },
|
|
2479
2507
|
React.createElement("thead", null,
|
|
@@ -2484,7 +2512,7 @@
|
|
|
2484
2512
|
React.createElement("th", null, "Interpretation"),
|
|
2485
2513
|
React.createElement("th", null, "Category"),
|
|
2486
2514
|
React.createElement("th", null, "Status"))),
|
|
2487
|
-
React.createElement("tbody", null,
|
|
2515
|
+
React.createElement("tbody", null, props.value?.map((observation, index) => (React.createElement(ObservationRow, { key: 'obs-' + index, value: observation }))))));
|
|
2488
2516
|
}
|
|
2489
2517
|
function ObservationRow(props) {
|
|
2490
2518
|
const { classes, cx } = useStyles$9();
|
|
@@ -2502,7 +2530,7 @@
|
|
|
2502
2530
|
React.createElement("td", null,
|
|
2503
2531
|
React.createElement(ReferenceRangeDisplay, { value: observation.referenceRange })),
|
|
2504
2532
|
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",
|
|
2533
|
+
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
2534
|
React.createElement(CodeableConceptDisplay, { value: concept }))))))),
|
|
2507
2535
|
React.createElement("td", null, observation.status && React.createElement(StatusBadge, { status: observation.status }))));
|
|
2508
2536
|
}
|
|
@@ -2527,8 +2555,7 @@
|
|
|
2527
2555
|
* @returns True if the FHIR observation is a critical value.
|
|
2528
2556
|
*/
|
|
2529
2557
|
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;
|
|
2558
|
+
const code = observation.interpretation?.[0]?.coding?.[0]?.code;
|
|
2532
2559
|
return code === 'AA' || code === 'LL' || code === 'HH' || code === 'A';
|
|
2533
2560
|
}
|
|
2534
2561
|
|
|
@@ -2646,17 +2673,16 @@
|
|
|
2646
2673
|
return React.createElement(Container, null, props.children);
|
|
2647
2674
|
}
|
|
2648
2675
|
function TimelineItem(props) {
|
|
2649
|
-
|
|
2650
|
-
const
|
|
2651
|
-
|
|
2652
|
-
return (React.createElement(Panel, Object.assign({ "data-testid": "timeline-item", fill: true }, others),
|
|
2676
|
+
const { resource, profile, padding, popupMenuItems, ...others } = props;
|
|
2677
|
+
const author = profile ?? resource.meta?.author;
|
|
2678
|
+
return (React.createElement(Panel, { "data-testid": "timeline-item", fill: true, ...others },
|
|
2653
2679
|
React.createElement(core$1.Group, { position: "apart", spacing: 8, mx: "xs", my: "sm" },
|
|
2654
2680
|
React.createElement(ResourceAvatar, { value: author, link: true, size: "md" }),
|
|
2655
2681
|
React.createElement("div", { style: { flex: 1 } },
|
|
2656
2682
|
React.createElement(core$1.Text, { size: "sm" },
|
|
2657
2683
|
React.createElement(ResourceName, { color: "dark", weight: 500, value: author, link: true })),
|
|
2658
2684
|
React.createElement(core$1.Text, { size: "xs" },
|
|
2659
|
-
React.createElement(MedplumLink, { color: "dimmed", to: props.resource }, core.formatDateTime(
|
|
2685
|
+
React.createElement(MedplumLink, { color: "dimmed", to: props.resource }, core.formatDateTime(props.resource.meta?.lastUpdated)),
|
|
2660
2686
|
React.createElement(core$1.Text, { component: "span", color: "dimmed", mx: 8 }, "\u00B7"),
|
|
2661
2687
|
React.createElement(MedplumLink, { color: "dimmed", to: props.resource }, props.resource.resourceType))),
|
|
2662
2688
|
popupMenuItems && (React.createElement(core$1.Menu, { position: "bottom-end", shadow: "md", width: 200 },
|
|
@@ -2695,7 +2721,6 @@
|
|
|
2695
2721
|
return 0;
|
|
2696
2722
|
}
|
|
2697
2723
|
function getTime(resource) {
|
|
2698
|
-
var _a;
|
|
2699
2724
|
if (resource.resourceType === 'Communication' && resource.sent) {
|
|
2700
2725
|
return new Date(resource.sent).getTime();
|
|
2701
2726
|
}
|
|
@@ -2708,7 +2733,7 @@
|
|
|
2708
2733
|
if (resource.resourceType === 'DocumentReference' && resource.date) {
|
|
2709
2734
|
return new Date(resource.date).getTime();
|
|
2710
2735
|
}
|
|
2711
|
-
const dateTime =
|
|
2736
|
+
const dateTime = resource.meta?.lastUpdated;
|
|
2712
2737
|
if (!dateTime) {
|
|
2713
2738
|
return 0;
|
|
2714
2739
|
}
|
|
@@ -2827,7 +2852,7 @@
|
|
|
2827
2852
|
}));
|
|
2828
2853
|
}
|
|
2829
2854
|
function setPriority(communication, priority) {
|
|
2830
|
-
return medplum.updateResource(
|
|
2855
|
+
return medplum.updateResource({ ...communication, priority });
|
|
2831
2856
|
}
|
|
2832
2857
|
function onPin(communication) {
|
|
2833
2858
|
setPriority(communication, 'stat').then(loadTimeline).catch(console.log);
|
|
@@ -2845,8 +2870,7 @@
|
|
|
2845
2870
|
navigate(`/${timelineItem.resourceType}/${timelineItem.id}/delete`);
|
|
2846
2871
|
}
|
|
2847
2872
|
function onVersionDetails(version) {
|
|
2848
|
-
|
|
2849
|
-
navigate(`/${version.resourceType}/${version.id}/_history/${(_a = version.meta) === null || _a === void 0 ? void 0 : _a.versionId}`);
|
|
2873
|
+
navigate(`/${version.resourceType}/${version.id}/_history/${version.meta?.versionId}`);
|
|
2850
2874
|
}
|
|
2851
2875
|
function onUploadStart() {
|
|
2852
2876
|
notifications.showNotification({
|
|
@@ -2887,12 +2911,11 @@
|
|
|
2887
2911
|
React.createElement(core$1.TextInput, { name: "text", ref: inputRef, placeholder: "Add comment", style: { width: '100%', maxWidth: 300 } }),
|
|
2888
2912
|
React.createElement(core$1.ActionIcon, { type: "submit", radius: "xl", color: "blue", variant: "filled" },
|
|
2889
2913
|
React.createElement(icons.IconMessage, { size: 16 })),
|
|
2890
|
-
React.createElement(AttachmentButton, { onUpload: createMedia, onUploadStart: onUploadStart, onUploadProgress: onUploadProgress }, (props) => (React.createElement(core$1.ActionIcon,
|
|
2914
|
+
React.createElement(AttachmentButton, { onUpload: createMedia, onUploadStart: onUploadStart, onUploadProgress: onUploadProgress }, (props) => (React.createElement(core$1.ActionIcon, { ...props, radius: "xl", color: "blue", variant: "filled" },
|
|
2891
2915
|
React.createElement(icons.IconCloudUpload, { size: 16 })))))))),
|
|
2892
2916
|
items.map((item) => {
|
|
2893
|
-
var _a;
|
|
2894
2917
|
if (item.resourceType === resource.resourceType && item.id === resource.id) {
|
|
2895
|
-
return (React.createElement(HistoryTimelineItem, { key:
|
|
2918
|
+
return (React.createElement(HistoryTimelineItem, { key: item.meta?.versionId, history: history, resource: item, onDetails: onVersionDetails }));
|
|
2896
2919
|
}
|
|
2897
2920
|
const key = `${item.resourceType}/${item.id}`;
|
|
2898
2921
|
switch (item.resourceType) {
|
|
@@ -2925,48 +2948,46 @@
|
|
|
2925
2948
|
function HistoryTimelineItem(props) {
|
|
2926
2949
|
const previous = getPrevious(props.history, props.resource);
|
|
2927
2950
|
if (previous) {
|
|
2928
|
-
return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu,
|
|
2951
|
+
return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu, { ...props }) },
|
|
2929
2952
|
React.createElement(ResourceDiffTable, { original: previous, revised: props.resource })));
|
|
2930
2953
|
}
|
|
2931
2954
|
else {
|
|
2932
|
-
return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu,
|
|
2955
|
+
return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu, { ...props }) },
|
|
2933
2956
|
React.createElement("h3", null, "Created"),
|
|
2934
2957
|
React.createElement(ResourceTable, { value: props.resource, ignoreMissingValues: true })));
|
|
2935
2958
|
}
|
|
2936
2959
|
}
|
|
2937
2960
|
function getPrevious(history, version) {
|
|
2938
2961
|
const entries = history.entry;
|
|
2939
|
-
const index = entries.findIndex((entry) =>
|
|
2962
|
+
const index = entries.findIndex((entry) => entry.resource?.meta?.versionId === version.meta?.versionId);
|
|
2940
2963
|
if (index >= entries.length - 1) {
|
|
2941
2964
|
return undefined;
|
|
2942
2965
|
}
|
|
2943
2966
|
return entries[index + 1].resource;
|
|
2944
2967
|
}
|
|
2945
2968
|
function CommunicationTimelineItem(props) {
|
|
2946
|
-
var _a, _b;
|
|
2947
2969
|
const { classes } = useStyles$7();
|
|
2948
2970
|
const routine = !props.resource.priority || props.resource.priority === 'routine';
|
|
2949
2971
|
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,
|
|
2972
|
+
return (React.createElement(TimelineItem, { resource: props.resource, profile: props.resource.sender, padding: true, className: className, popupMenuItems: React.createElement(TimelineItemPopupMenu, { ...props }) },
|
|
2973
|
+
React.createElement("p", null, props.resource.payload?.[0]?.contentString)));
|
|
2952
2974
|
}
|
|
2953
2975
|
function MediaTimelineItem(props) {
|
|
2954
|
-
|
|
2955
|
-
const contentType = (_a = props.resource.content) === null || _a === void 0 ? void 0 : _a.contentType;
|
|
2976
|
+
const contentType = props.resource.content?.contentType;
|
|
2956
2977
|
const padding = contentType &&
|
|
2957
2978
|
!contentType.startsWith('image/') &&
|
|
2958
2979
|
!contentType.startsWith('video/') &&
|
|
2959
2980
|
contentType !== 'application/pdf';
|
|
2960
|
-
return (React.createElement(TimelineItem, { resource: props.resource, padding: !!padding, popupMenuItems: React.createElement(TimelineItemPopupMenu,
|
|
2981
|
+
return (React.createElement(TimelineItem, { resource: props.resource, padding: !!padding, popupMenuItems: React.createElement(TimelineItemPopupMenu, { ...props }) },
|
|
2961
2982
|
React.createElement(AttachmentDisplay, { value: props.resource.content })));
|
|
2962
2983
|
}
|
|
2963
2984
|
function AuditEventTimelineItem(props) {
|
|
2964
|
-
return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu,
|
|
2985
|
+
return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu, { ...props }) },
|
|
2965
2986
|
React.createElement(core$1.ScrollArea, null,
|
|
2966
2987
|
React.createElement("pre", null, props.resource.outcomeDesc))));
|
|
2967
2988
|
}
|
|
2968
2989
|
function DiagnosticReportTimelineItem(props) {
|
|
2969
|
-
return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu,
|
|
2990
|
+
return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu, { ...props }) },
|
|
2970
2991
|
React.createElement(DiagnosticReportDisplay, { value: props.resource })));
|
|
2971
2992
|
}
|
|
2972
2993
|
function getProgressMessage(e) {
|
|
@@ -3136,7 +3157,12 @@
|
|
|
3136
3157
|
* @param {Array} filters The new filters.
|
|
3137
3158
|
*/
|
|
3138
3159
|
function setFilters(definition, filters) {
|
|
3139
|
-
return
|
|
3160
|
+
return {
|
|
3161
|
+
...definition,
|
|
3162
|
+
filters: filters,
|
|
3163
|
+
offset: 0,
|
|
3164
|
+
name: undefined,
|
|
3165
|
+
};
|
|
3140
3166
|
}
|
|
3141
3167
|
/**
|
|
3142
3168
|
* Clears all of the filters.
|
|
@@ -3185,7 +3211,11 @@
|
|
|
3185
3211
|
newFields.push(...definition.fields);
|
|
3186
3212
|
}
|
|
3187
3213
|
newFields.push(field);
|
|
3188
|
-
return
|
|
3214
|
+
return {
|
|
3215
|
+
...definition,
|
|
3216
|
+
fields: newFields,
|
|
3217
|
+
name: undefined,
|
|
3218
|
+
};
|
|
3189
3219
|
}
|
|
3190
3220
|
/**
|
|
3191
3221
|
* Deletes a filter at the specified index.
|
|
@@ -3198,7 +3228,11 @@
|
|
|
3198
3228
|
}
|
|
3199
3229
|
const newFilters = [...definition.filters];
|
|
3200
3230
|
newFilters.splice(index, 1);
|
|
3201
|
-
return
|
|
3231
|
+
return {
|
|
3232
|
+
...definition,
|
|
3233
|
+
filters: newFilters,
|
|
3234
|
+
name: undefined,
|
|
3235
|
+
};
|
|
3202
3236
|
}
|
|
3203
3237
|
/**
|
|
3204
3238
|
* Adds a filter that constrains the specified field to "yesterday".
|
|
@@ -3342,7 +3376,11 @@
|
|
|
3342
3376
|
if (definition.offset === offset) {
|
|
3343
3377
|
return definition;
|
|
3344
3378
|
}
|
|
3345
|
-
return
|
|
3379
|
+
return {
|
|
3380
|
+
...definition,
|
|
3381
|
+
offset,
|
|
3382
|
+
name: undefined,
|
|
3383
|
+
};
|
|
3346
3384
|
}
|
|
3347
3385
|
/**
|
|
3348
3386
|
* Creates a new search request with the search offset at the specified page.
|
|
@@ -3351,8 +3389,7 @@
|
|
|
3351
3389
|
* @return The new search definition.
|
|
3352
3390
|
*/
|
|
3353
3391
|
function setPage(definition, page) {
|
|
3354
|
-
|
|
3355
|
-
const count = (_a = definition.count) !== null && _a !== void 0 ? _a : core.DEFAULT_SEARCH_COUNT;
|
|
3392
|
+
const count = definition.count ?? core.DEFAULT_SEARCH_COUNT;
|
|
3356
3393
|
const newOffset = (page - 1) * count;
|
|
3357
3394
|
return setOffset(definition, newOffset);
|
|
3358
3395
|
}
|
|
@@ -3366,12 +3403,16 @@
|
|
|
3366
3403
|
if (sort === getSortField(definition) && desc !== undefined && desc === isSortDescending(definition)) {
|
|
3367
3404
|
return definition;
|
|
3368
3405
|
}
|
|
3369
|
-
return
|
|
3406
|
+
return {
|
|
3407
|
+
...definition,
|
|
3408
|
+
sortRules: [
|
|
3370
3409
|
{
|
|
3371
3410
|
code: sort,
|
|
3372
3411
|
descending: !!desc,
|
|
3373
3412
|
},
|
|
3374
|
-
],
|
|
3413
|
+
],
|
|
3414
|
+
name: undefined,
|
|
3415
|
+
};
|
|
3375
3416
|
}
|
|
3376
3417
|
/**
|
|
3377
3418
|
* Toggles the sort of the search by key.
|
|
@@ -3417,8 +3458,7 @@
|
|
|
3417
3458
|
* @return {string} A display string for the operation.
|
|
3418
3459
|
*/
|
|
3419
3460
|
function getOpString(op) {
|
|
3420
|
-
|
|
3421
|
-
return (_a = operatorNames[op]) !== null && _a !== void 0 ? _a : '';
|
|
3461
|
+
return operatorNames[op] ?? '';
|
|
3422
3462
|
}
|
|
3423
3463
|
/**
|
|
3424
3464
|
* Returns a field display name.
|
|
@@ -3459,16 +3499,15 @@
|
|
|
3459
3499
|
* @returns The fragment to display.
|
|
3460
3500
|
*/
|
|
3461
3501
|
function renderValue(resource, field) {
|
|
3462
|
-
var _a, _b;
|
|
3463
3502
|
const key = field.name;
|
|
3464
3503
|
if (key === 'id') {
|
|
3465
3504
|
return resource.id;
|
|
3466
3505
|
}
|
|
3467
3506
|
if (key === 'meta.versionId') {
|
|
3468
|
-
return
|
|
3507
|
+
return resource.meta?.versionId;
|
|
3469
3508
|
}
|
|
3470
3509
|
if (key === '_lastUpdated') {
|
|
3471
|
-
return core.formatDateTime(
|
|
3510
|
+
return core.formatDateTime(resource.meta?.lastUpdated);
|
|
3472
3511
|
}
|
|
3473
3512
|
// Priority 1: ElementDefinition by exact match
|
|
3474
3513
|
if (field.elementDefinition && `${resource.resourceType}.${field.name}` === field.elementDefinition.path) {
|
|
@@ -3488,8 +3527,7 @@
|
|
|
3488
3527
|
* @returns A React element or null.
|
|
3489
3528
|
*/
|
|
3490
3529
|
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]', '')) || '';
|
|
3530
|
+
const path = elementDefinition.path?.split('.')?.pop()?.replaceAll('[x]', '') || '';
|
|
3493
3531
|
const [value, propertyType] = getValueAndType({ type: resource.resourceType, value: resource }, path);
|
|
3494
3532
|
if (!value) {
|
|
3495
3533
|
return null;
|
|
@@ -3515,7 +3553,6 @@
|
|
|
3515
3553
|
}
|
|
3516
3554
|
|
|
3517
3555
|
function SearchFieldEditor(props) {
|
|
3518
|
-
var _a;
|
|
3519
3556
|
const [state, setState] = React.useState({
|
|
3520
3557
|
search: JSON.parse(core.stringify(props.search)),
|
|
3521
3558
|
});
|
|
@@ -3565,13 +3602,15 @@
|
|
|
3565
3602
|
* Moves the "available" selection into the "selected" list.
|
|
3566
3603
|
*/
|
|
3567
3604
|
function onAddField() {
|
|
3568
|
-
|
|
3569
|
-
const
|
|
3570
|
-
const key = (_b = availableRef.current) === null || _b === void 0 ? void 0 : _b.value;
|
|
3605
|
+
const currentField = state.search.fields ?? [];
|
|
3606
|
+
const key = availableRef.current?.value;
|
|
3571
3607
|
if (key) {
|
|
3572
3608
|
const newFields = [...currentField, key];
|
|
3573
3609
|
setState({
|
|
3574
|
-
search:
|
|
3610
|
+
search: {
|
|
3611
|
+
...state.search,
|
|
3612
|
+
fields: newFields,
|
|
3613
|
+
},
|
|
3575
3614
|
});
|
|
3576
3615
|
}
|
|
3577
3616
|
}
|
|
@@ -3580,14 +3619,16 @@
|
|
|
3580
3619
|
* Moves the "selected" selection into the "available" list.
|
|
3581
3620
|
*/
|
|
3582
3621
|
function onRemoveField() {
|
|
3583
|
-
|
|
3584
|
-
const
|
|
3585
|
-
const key = (_b = selectedRef.current) === null || _b === void 0 ? void 0 : _b.value;
|
|
3622
|
+
const currentField = state.search.fields ?? [];
|
|
3623
|
+
const key = selectedRef.current?.value;
|
|
3586
3624
|
if (key) {
|
|
3587
3625
|
const newFields = [...currentField];
|
|
3588
3626
|
newFields.splice(newFields.indexOf(key), 1);
|
|
3589
3627
|
setState({
|
|
3590
|
-
search:
|
|
3628
|
+
search: {
|
|
3629
|
+
...state.search,
|
|
3630
|
+
fields: newFields,
|
|
3631
|
+
},
|
|
3591
3632
|
});
|
|
3592
3633
|
}
|
|
3593
3634
|
}
|
|
@@ -3596,15 +3637,17 @@
|
|
|
3596
3637
|
* Moves the selection up one position in the list.
|
|
3597
3638
|
*/
|
|
3598
3639
|
function onMoveUp() {
|
|
3599
|
-
|
|
3600
|
-
const
|
|
3601
|
-
const field = (_b = selectedRef.current) === null || _b === void 0 ? void 0 : _b.value;
|
|
3640
|
+
const currentField = state.search.fields ?? [];
|
|
3641
|
+
const field = selectedRef.current?.value;
|
|
3602
3642
|
if (field) {
|
|
3603
3643
|
const newFields = [...currentField];
|
|
3604
3644
|
const index = newFields.indexOf(field);
|
|
3605
3645
|
swapFields(newFields, index, index - 1);
|
|
3606
3646
|
setState({
|
|
3607
|
-
search:
|
|
3647
|
+
search: {
|
|
3648
|
+
...state.search,
|
|
3649
|
+
fields: newFields,
|
|
3650
|
+
},
|
|
3608
3651
|
});
|
|
3609
3652
|
}
|
|
3610
3653
|
}
|
|
@@ -3613,15 +3656,17 @@
|
|
|
3613
3656
|
* Moves the selection down one position in the list.
|
|
3614
3657
|
*/
|
|
3615
3658
|
function onMoveDown() {
|
|
3616
|
-
|
|
3617
|
-
const
|
|
3618
|
-
const field = (_b = selectedRef.current) === null || _b === void 0 ? void 0 : _b.value;
|
|
3659
|
+
const currentField = state.search.fields ?? [];
|
|
3660
|
+
const field = selectedRef.current?.value;
|
|
3619
3661
|
if (field) {
|
|
3620
3662
|
const newFields = [...currentField];
|
|
3621
3663
|
const index = newFields.indexOf(field);
|
|
3622
3664
|
swapFields(newFields, index, index + 1);
|
|
3623
3665
|
setState({
|
|
3624
|
-
search:
|
|
3666
|
+
search: {
|
|
3667
|
+
...state.search,
|
|
3668
|
+
fields: newFields,
|
|
3669
|
+
},
|
|
3625
3670
|
});
|
|
3626
3671
|
}
|
|
3627
3672
|
}
|
|
@@ -3641,9 +3686,9 @@
|
|
|
3641
3686
|
}
|
|
3642
3687
|
const resourceType = props.search.resourceType;
|
|
3643
3688
|
const typeDef = core.globalSchema.types[resourceType];
|
|
3644
|
-
const selected =
|
|
3689
|
+
const selected = state.search.fields ?? [];
|
|
3645
3690
|
const available = getFieldsList(typeDef)
|
|
3646
|
-
.filter((field) => !
|
|
3691
|
+
.filter((field) => !selected?.includes(field))
|
|
3647
3692
|
.sort();
|
|
3648
3693
|
return (React.createElement(core$1.Modal, { title: "Fields", closeButtonLabel: "Close", opened: props.visible, onClose: props.onCancel },
|
|
3649
3694
|
React.createElement("div", null,
|
|
@@ -3700,9 +3745,8 @@
|
|
|
3700
3745
|
}
|
|
3701
3746
|
|
|
3702
3747
|
function SearchFilterValueDisplay(props) {
|
|
3703
|
-
var _a, _b;
|
|
3704
3748
|
const { resourceType, filter } = props;
|
|
3705
|
-
const searchParam =
|
|
3749
|
+
const searchParam = core.globalSchema.types[resourceType]?.searchParams?.[filter.code];
|
|
3706
3750
|
if (searchParam) {
|
|
3707
3751
|
if (searchParam.type === 'reference') {
|
|
3708
3752
|
return React.createElement(ResourceName, { value: { reference: filter.value } });
|
|
@@ -3716,12 +3760,11 @@
|
|
|
3716
3760
|
}
|
|
3717
3761
|
|
|
3718
3762
|
function SearchFilterValueInput(props) {
|
|
3719
|
-
var _a;
|
|
3720
3763
|
const details = core.getSearchParameterDetails(props.resourceType, props.searchParam);
|
|
3721
3764
|
const name = 'filter-value';
|
|
3722
3765
|
switch (details.type) {
|
|
3723
3766
|
case core.SearchParameterType.REFERENCE:
|
|
3724
|
-
return (React.createElement(ReferenceInput, { name: name, defaultValue: { reference: props.defaultValue }, targetTypes:
|
|
3767
|
+
return (React.createElement(ReferenceInput, { name: name, defaultValue: { reference: props.defaultValue }, targetTypes: props.searchParam?.target, onChange: (newReference) => {
|
|
3725
3768
|
if (newReference) {
|
|
3726
3769
|
props.onChange(newReference.reference);
|
|
3727
3770
|
}
|
|
@@ -3825,18 +3868,17 @@
|
|
|
3825
3868
|
React.createElement(core$1.Button, { compact: true, variant: "outline", onClick: props.onDelete }, "Delete"))));
|
|
3826
3869
|
}
|
|
3827
3870
|
function FilterRowInput(props) {
|
|
3828
|
-
|
|
3829
|
-
const [value, setValue] = React.useState((_a = props.defaultValue) !== null && _a !== void 0 ? _a : {});
|
|
3871
|
+
const [value, setValue] = React.useState(props.defaultValue ?? {});
|
|
3830
3872
|
const valueRef = React.useRef(value);
|
|
3831
3873
|
valueRef.current = value;
|
|
3832
3874
|
function setFilterCode(newCode) {
|
|
3833
|
-
setValue(
|
|
3875
|
+
setValue({ ...valueRef.current, code: newCode });
|
|
3834
3876
|
}
|
|
3835
3877
|
function setFilterOperator(newOperator) {
|
|
3836
|
-
setValue(
|
|
3878
|
+
setValue({ ...valueRef.current, operator: newOperator });
|
|
3837
3879
|
}
|
|
3838
3880
|
function setFilterValue(newFilterValue) {
|
|
3839
|
-
setValue(
|
|
3881
|
+
setValue({ ...valueRef.current, value: newFilterValue });
|
|
3840
3882
|
}
|
|
3841
3883
|
const searchParam = props.searchParams[value.code];
|
|
3842
3884
|
const operators = searchParam && getSearchOperators(searchParam);
|
|
@@ -3854,13 +3896,12 @@
|
|
|
3854
3896
|
}
|
|
3855
3897
|
|
|
3856
3898
|
function SearchFilterValueDialog(props) {
|
|
3857
|
-
|
|
3858
|
-
const [value, setValue] = React.useState((_a = props.defaultValue) !== null && _a !== void 0 ? _a : '');
|
|
3899
|
+
const [value, setValue] = React.useState(props.defaultValue ?? '');
|
|
3859
3900
|
if (!props.visible || !props.searchParam || !props.filter) {
|
|
3860
3901
|
return null;
|
|
3861
3902
|
}
|
|
3862
3903
|
function onOk() {
|
|
3863
|
-
props.onOk(
|
|
3904
|
+
props.onOk({ ...props.filter, value });
|
|
3864
3905
|
}
|
|
3865
3906
|
return (React.createElement(core$1.Modal, { title: props.title, size: "xl", opened: props.visible, onClose: props.onCancel },
|
|
3866
3907
|
React.createElement("div", { style: { width: 500 } },
|
|
@@ -3895,16 +3936,16 @@
|
|
|
3895
3936
|
function SearchParameterSubMenu(props) {
|
|
3896
3937
|
switch (props.searchParam.type) {
|
|
3897
3938
|
case 'date':
|
|
3898
|
-
return React.createElement(DateFilterSubMenu,
|
|
3939
|
+
return React.createElement(DateFilterSubMenu, { ...props });
|
|
3899
3940
|
case 'number':
|
|
3900
3941
|
case 'quantity':
|
|
3901
|
-
return React.createElement(NumericFilterSubMenu,
|
|
3942
|
+
return React.createElement(NumericFilterSubMenu, { ...props });
|
|
3902
3943
|
case 'reference':
|
|
3903
|
-
return React.createElement(ReferenceFilterSubMenu,
|
|
3944
|
+
return React.createElement(ReferenceFilterSubMenu, { ...props });
|
|
3904
3945
|
case 'string':
|
|
3905
3946
|
case 'token':
|
|
3906
3947
|
case 'uri':
|
|
3907
|
-
return React.createElement(TextFilterSubMenu,
|
|
3948
|
+
return React.createElement(TextFilterSubMenu, { ...props });
|
|
3908
3949
|
default:
|
|
3909
3950
|
return React.createElement(React.Fragment, null,
|
|
3910
3951
|
"Unknown search param type: ",
|
|
@@ -3934,7 +3975,7 @@
|
|
|
3934
3975
|
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconCalendar, { size: 14 }), onClick: () => props.onChange(addLastMonthFilter(props.search, code)) }, "Last Month"),
|
|
3935
3976
|
React.createElement(core$1.Menu.Divider, null),
|
|
3936
3977
|
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,
|
|
3978
|
+
React.createElement(CommonMenuItems, { ...props })));
|
|
3938
3979
|
}
|
|
3939
3980
|
function NumericFilterSubMenu(props) {
|
|
3940
3981
|
const { searchParam } = props;
|
|
@@ -3949,14 +3990,14 @@
|
|
|
3949
3990
|
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
3991
|
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconMathLower, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.LESS_THAN) }, "Less than..."),
|
|
3951
3992
|
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,
|
|
3993
|
+
React.createElement(CommonMenuItems, { ...props })));
|
|
3953
3994
|
}
|
|
3954
3995
|
function ReferenceFilterSubMenu(props) {
|
|
3955
3996
|
const { searchParam } = props;
|
|
3956
3997
|
return (React.createElement(core$1.Menu.Dropdown, null,
|
|
3957
3998
|
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconEqual, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.EQUALS) }, "Equals..."),
|
|
3958
3999
|
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,
|
|
4000
|
+
React.createElement(CommonMenuItems, { ...props })));
|
|
3960
4001
|
}
|
|
3961
4002
|
function TextFilterSubMenu(props) {
|
|
3962
4003
|
const { searchParam } = props;
|
|
@@ -3969,7 +4010,7 @@
|
|
|
3969
4010
|
React.createElement(core$1.Menu.Divider, null),
|
|
3970
4011
|
React.createElement(core$1.Menu.Item, { icon: React.createElement(icons.IconBucket, { size: 14 }), onClick: () => props.onPrompt(searchParam, core.Operator.CONTAINS) }, "Contains..."),
|
|
3971
4012
|
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,
|
|
4013
|
+
React.createElement(CommonMenuItems, { ...props })));
|
|
3973
4014
|
}
|
|
3974
4015
|
function CommonMenuItems(props) {
|
|
3975
4016
|
const { searchParam } = props;
|
|
@@ -4003,7 +4044,6 @@
|
|
|
4003
4044
|
* @returns The field definition.
|
|
4004
4045
|
*/
|
|
4005
4046
|
function getFieldDefinition(resourceType, name) {
|
|
4006
|
-
var _a;
|
|
4007
4047
|
if (name === '_lastUpdated') {
|
|
4008
4048
|
return {
|
|
4009
4049
|
name: '_lastUpdated',
|
|
@@ -4036,7 +4076,7 @@
|
|
|
4036
4076
|
}
|
|
4037
4077
|
const typeSchema = core.globalSchema.types[resourceType];
|
|
4038
4078
|
const exactElementDefinition = typeSchema.properties[name];
|
|
4039
|
-
const exactSearchParam =
|
|
4079
|
+
const exactSearchParam = typeSchema.searchParams?.[name.toLowerCase()];
|
|
4040
4080
|
// Best case: Exact match of element definition or search parameter.
|
|
4041
4081
|
// Examples: ServiceRequest.subject, Patient.name, Patient.birthDate
|
|
4042
4082
|
// In this case, we only show the one search parameter.
|
|
@@ -4051,7 +4091,7 @@
|
|
|
4051
4091
|
let searchParams = undefined;
|
|
4052
4092
|
if (typeSchema.searchParams) {
|
|
4053
4093
|
const path = `${resourceType}.${name.replaceAll('[x]', '')}`;
|
|
4054
|
-
searchParams = Object.values(typeSchema.searchParams).filter((p) =>
|
|
4094
|
+
searchParams = Object.values(typeSchema.searchParams).filter((p) => p.expression?.includes(path));
|
|
4055
4095
|
if (searchParams.length === 0) {
|
|
4056
4096
|
searchParams = undefined;
|
|
4057
4097
|
}
|
|
@@ -4130,7 +4170,6 @@
|
|
|
4130
4170
|
* It does not include the field editor, filter editor, pagination buttons.
|
|
4131
4171
|
*/
|
|
4132
4172
|
function SearchControl(props) {
|
|
4133
|
-
var _a, _b, _c;
|
|
4134
4173
|
const { classes } = useStyles$6();
|
|
4135
4174
|
const medplum = useMedplum();
|
|
4136
4175
|
const [schemaLoaded, setSchemaLoaded] = React.useState(false);
|
|
@@ -4147,15 +4186,15 @@
|
|
|
4147
4186
|
React.useEffect(() => {
|
|
4148
4187
|
setOutcome(undefined);
|
|
4149
4188
|
medplum
|
|
4150
|
-
.search(search.resourceType, core.formatSearchQuery(
|
|
4189
|
+
.search(search.resourceType, core.formatSearchQuery({ ...search, total: 'accurate', fields: undefined }))
|
|
4151
4190
|
.then((response) => {
|
|
4152
|
-
setState(
|
|
4191
|
+
setState({ ...stateRef.current, searchResponse: response });
|
|
4153
4192
|
if (onLoad) {
|
|
4154
4193
|
onLoad(new SearchLoadEvent(response));
|
|
4155
4194
|
}
|
|
4156
4195
|
})
|
|
4157
4196
|
.catch((reason) => {
|
|
4158
|
-
setState(
|
|
4197
|
+
setState({ ...stateRef.current, searchResponse: undefined });
|
|
4159
4198
|
setOutcome(reason);
|
|
4160
4199
|
});
|
|
4161
4200
|
}, [medplum, search, onLoad]);
|
|
@@ -4163,40 +4202,37 @@
|
|
|
4163
4202
|
e.stopPropagation();
|
|
4164
4203
|
const el = e.target;
|
|
4165
4204
|
const checked = el.checked;
|
|
4166
|
-
const newSelected =
|
|
4205
|
+
const newSelected = { ...stateRef.current.selected };
|
|
4167
4206
|
if (checked) {
|
|
4168
4207
|
newSelected[id] = true;
|
|
4169
4208
|
}
|
|
4170
4209
|
else {
|
|
4171
4210
|
delete newSelected[id];
|
|
4172
4211
|
}
|
|
4173
|
-
setState(
|
|
4212
|
+
setState({ ...stateRef.current, selected: newSelected });
|
|
4174
4213
|
}
|
|
4175
4214
|
function handleAllCheckboxClick(e) {
|
|
4176
|
-
var _a;
|
|
4177
4215
|
e.stopPropagation();
|
|
4178
4216
|
const el = e.target;
|
|
4179
4217
|
const checked = el.checked;
|
|
4180
4218
|
const newSelected = {};
|
|
4181
|
-
const searchResponse =
|
|
4182
|
-
if (checked &&
|
|
4219
|
+
const searchResponse = stateRef.current?.searchResponse;
|
|
4220
|
+
if (checked && searchResponse?.entry) {
|
|
4183
4221
|
searchResponse.entry.forEach((entry) => {
|
|
4184
|
-
|
|
4185
|
-
if ((_a = entry.resource) === null || _a === void 0 ? void 0 : _a.id) {
|
|
4222
|
+
if (entry.resource?.id) {
|
|
4186
4223
|
newSelected[entry.resource.id] = true;
|
|
4187
4224
|
}
|
|
4188
4225
|
});
|
|
4189
4226
|
}
|
|
4190
|
-
setState(
|
|
4227
|
+
setState({ ...stateRef.current, selected: newSelected });
|
|
4191
4228
|
}
|
|
4192
4229
|
function isAllSelected() {
|
|
4193
|
-
var _a, _b;
|
|
4194
4230
|
const state = stateRef.current;
|
|
4195
|
-
if (!
|
|
4231
|
+
if (!state.searchResponse?.entry || state.searchResponse.entry.length === 0) {
|
|
4196
4232
|
return false;
|
|
4197
4233
|
}
|
|
4198
4234
|
for (const e of state.searchResponse.entry) {
|
|
4199
|
-
if (
|
|
4235
|
+
if (e.resource?.id && !state.selected[e.resource.id]) {
|
|
4200
4236
|
return false;
|
|
4201
4237
|
}
|
|
4202
4238
|
}
|
|
@@ -4241,7 +4277,7 @@
|
|
|
4241
4277
|
.then(() => setSchemaLoaded(true))
|
|
4242
4278
|
.catch(console.log);
|
|
4243
4279
|
}, [medplum, props.search.resourceType]);
|
|
4244
|
-
const typeSchema = schemaLoaded &&
|
|
4280
|
+
const typeSchema = schemaLoaded && core.globalSchema?.types?.[props.search.resourceType];
|
|
4245
4281
|
if (!typeSchema) {
|
|
4246
4282
|
return (React.createElement(core$1.Center, { style: { width: '100%', height: '100%' } },
|
|
4247
4283
|
React.createElement(core$1.Loader, null)));
|
|
@@ -4250,8 +4286,8 @@
|
|
|
4250
4286
|
const fields = getFieldDefinitions(search);
|
|
4251
4287
|
const resourceType = search.resourceType;
|
|
4252
4288
|
const lastResult = state.searchResponse;
|
|
4253
|
-
const entries = lastResult
|
|
4254
|
-
const resources = entries
|
|
4289
|
+
const entries = lastResult?.entry;
|
|
4290
|
+
const resources = entries?.map((e) => e.resource);
|
|
4255
4291
|
const buttonVariant = 'subtle';
|
|
4256
4292
|
const buttonColor = 'gray';
|
|
4257
4293
|
const iconSize = 16;
|
|
@@ -4259,8 +4295,8 @@
|
|
|
4259
4295
|
return (React.createElement("div", { className: classes.root, "data-testid": "search-control" },
|
|
4260
4296
|
!props.hideToolbar && (React.createElement(core$1.Group, { position: "apart", mb: "xl" },
|
|
4261
4297
|
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(
|
|
4298
|
+
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"),
|
|
4299
|
+
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
4300
|
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
4301
|
!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
4302
|
!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 +4306,8 @@
|
|
|
4270
4306
|
"-",
|
|
4271
4307
|
getEnd$1(search, lastResult.total),
|
|
4272
4308
|
" of",
|
|
4273
|
-
' ',
|
|
4274
|
-
|
|
4309
|
+
' ',
|
|
4310
|
+
lastResult.total?.toLocaleString())))),
|
|
4275
4311
|
React.createElement(core$1.Table, { className: classes.table },
|
|
4276
4312
|
React.createElement("thead", null,
|
|
4277
4313
|
React.createElement("tr", null,
|
|
@@ -4286,21 +4322,26 @@
|
|
|
4286
4322
|
React.createElement(core$1.Center, { className: classes.icon },
|
|
4287
4323
|
React.createElement(icons.IconAdjustmentsHorizontal, { size: 14, stroke: 1.5 }))))),
|
|
4288
4324
|
React.createElement(SearchPopupMenu, { search: props.search, searchParams: field.searchParams, onPrompt: (searchParam, filter) => {
|
|
4289
|
-
setState(
|
|
4325
|
+
setState({
|
|
4326
|
+
...stateRef.current,
|
|
4327
|
+
filterDialogVisible: true,
|
|
4328
|
+
filterDialogSearchParam: searchParam,
|
|
4329
|
+
filterDialogFilter: filter,
|
|
4330
|
+
});
|
|
4290
4331
|
}, onChange: (result) => {
|
|
4291
4332
|
emitSearchChange(result);
|
|
4292
4333
|
} })))))),
|
|
4293
4334
|
!props.hideFilters && (React.createElement("tr", null,
|
|
4294
4335
|
checkboxColumn && React.createElement("th", null),
|
|
4295
4336
|
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
|
|
4337
|
+
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
4338
|
checkboxColumn && (React.createElement("td", null,
|
|
4298
4339
|
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
4340
|
fields.map((field) => (React.createElement("td", { key: field.name }, renderValue(resource, field))))))))),
|
|
4300
|
-
|
|
4341
|
+
resources?.length === 0 && (React.createElement(Container, null,
|
|
4301
4342
|
React.createElement(core$1.Center, null,
|
|
4302
4343
|
React.createElement(core$1.Text, { size: "xl", color: "dimmed" }, "No results")))),
|
|
4303
|
-
|
|
4344
|
+
lastResult?.total !== undefined && lastResult.total > 0 && (React.createElement(core$1.Center, { m: "md", p: "md" },
|
|
4304
4345
|
React.createElement(core$1.Pagination, { page: getPage(search), total: getTotalPages(search, lastResult.total), onChange: (newPage) => emitSearchChange(setPage(search, newPage)), getItemAriaLabel: (page) => {
|
|
4305
4346
|
switch (page) {
|
|
4306
4347
|
case 'prev':
|
|
@@ -4315,27 +4356,44 @@
|
|
|
4315
4356
|
React.createElement("pre", { style: { textAlign: 'left' } }, JSON.stringify(outcome, undefined, 2)))),
|
|
4316
4357
|
React.createElement(SearchFieldEditor, { search: props.search, visible: stateRef.current.fieldEditorVisible, onOk: (result) => {
|
|
4317
4358
|
emitSearchChange(result);
|
|
4318
|
-
setState(
|
|
4359
|
+
setState({
|
|
4360
|
+
...stateRef.current,
|
|
4361
|
+
fieldEditorVisible: false,
|
|
4362
|
+
});
|
|
4319
4363
|
}, onCancel: () => {
|
|
4320
|
-
setState(
|
|
4364
|
+
setState({
|
|
4365
|
+
...stateRef.current,
|
|
4366
|
+
fieldEditorVisible: false,
|
|
4367
|
+
});
|
|
4321
4368
|
} }),
|
|
4322
4369
|
React.createElement(SearchFilterEditor, { search: props.search, visible: stateRef.current.filterEditorVisible, onOk: (result) => {
|
|
4323
4370
|
emitSearchChange(result);
|
|
4324
|
-
setState(
|
|
4371
|
+
setState({
|
|
4372
|
+
...stateRef.current,
|
|
4373
|
+
filterEditorVisible: false,
|
|
4374
|
+
});
|
|
4325
4375
|
}, onCancel: () => {
|
|
4326
|
-
setState(
|
|
4376
|
+
setState({
|
|
4377
|
+
...stateRef.current,
|
|
4378
|
+
filterEditorVisible: false,
|
|
4379
|
+
});
|
|
4327
4380
|
} }),
|
|
4328
|
-
React.createElement(SearchFilterValueDialog, { key:
|
|
4381
|
+
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
4382
|
emitSearchChange(addFilter(props.search, filter.code, filter.operator, filter.value));
|
|
4330
|
-
setState(
|
|
4383
|
+
setState({
|
|
4384
|
+
...stateRef.current,
|
|
4385
|
+
filterDialogVisible: false,
|
|
4386
|
+
});
|
|
4331
4387
|
}, onCancel: () => {
|
|
4332
|
-
setState(
|
|
4388
|
+
setState({
|
|
4389
|
+
...stateRef.current,
|
|
4390
|
+
filterDialogVisible: false,
|
|
4391
|
+
});
|
|
4333
4392
|
} })));
|
|
4334
4393
|
}
|
|
4335
4394
|
const MemoizedSearchControl = React.memo(SearchControl);
|
|
4336
4395
|
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));
|
|
4396
|
+
const filters = (props.filters ?? []).filter((f) => props.searchParams.find((p) => p.code === f.code));
|
|
4339
4397
|
if (filters.length === 0) {
|
|
4340
4398
|
return React.createElement("span", null, "no filters");
|
|
4341
4399
|
}
|
|
@@ -4352,19 +4410,16 @@
|
|
|
4352
4410
|
return Math.ceil(total / pageSize);
|
|
4353
4411
|
}
|
|
4354
4412
|
function getStart$1(search, total) {
|
|
4355
|
-
|
|
4356
|
-
return Math.min(total, ((_a = search.offset) !== null && _a !== void 0 ? _a : 0) + 1);
|
|
4413
|
+
return Math.min(total, (search.offset ?? 0) + 1);
|
|
4357
4414
|
}
|
|
4358
4415
|
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));
|
|
4416
|
+
return Math.min(total, ((search.offset ?? 0) + 1) * (search.count ?? core.DEFAULT_SEARCH_COUNT));
|
|
4361
4417
|
}
|
|
4362
4418
|
|
|
4363
4419
|
/**
|
|
4364
4420
|
* The FhirPathTable component represents the embeddable search table control.
|
|
4365
4421
|
*/
|
|
4366
4422
|
function FhirPathTable(props) {
|
|
4367
|
-
var _a, _b, _c, _d, _e;
|
|
4368
4423
|
const medplum = useMedplum();
|
|
4369
4424
|
const [schema, setSchema] = React.useState();
|
|
4370
4425
|
const [outcome, setOutcome] = React.useState();
|
|
@@ -4383,7 +4438,7 @@
|
|
|
4383
4438
|
e.stopPropagation();
|
|
4384
4439
|
const el = e.target;
|
|
4385
4440
|
const checked = el.checked;
|
|
4386
|
-
const newSelected =
|
|
4441
|
+
const newSelected = { ...selectedRef.current };
|
|
4387
4442
|
if (checked) {
|
|
4388
4443
|
newSelected[id] = true;
|
|
4389
4444
|
}
|
|
@@ -4393,15 +4448,14 @@
|
|
|
4393
4448
|
setSelected(newSelected);
|
|
4394
4449
|
}
|
|
4395
4450
|
function handleAllCheckboxClick(e) {
|
|
4396
|
-
var _a, _b;
|
|
4397
4451
|
e.stopPropagation();
|
|
4398
4452
|
const el = e.target;
|
|
4399
4453
|
const checked = el.checked;
|
|
4400
4454
|
const newSelected = {};
|
|
4401
|
-
const resources =
|
|
4455
|
+
const resources = responseRef.current?.data?.ResourceList;
|
|
4402
4456
|
if (checked && resources) {
|
|
4403
4457
|
resources.forEach((resource) => {
|
|
4404
|
-
if (resource
|
|
4458
|
+
if (resource?.id) {
|
|
4405
4459
|
newSelected[resource.id] = true;
|
|
4406
4460
|
}
|
|
4407
4461
|
});
|
|
@@ -4409,13 +4463,12 @@
|
|
|
4409
4463
|
setSelected(newSelected);
|
|
4410
4464
|
}
|
|
4411
4465
|
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;
|
|
4466
|
+
const resources = responseRef.current?.data?.ResourceList;
|
|
4414
4467
|
if (!resources || resources.length === 0) {
|
|
4415
4468
|
return false;
|
|
4416
4469
|
}
|
|
4417
4470
|
for (const resource of resources) {
|
|
4418
|
-
if (
|
|
4471
|
+
if (resource?.id && !selectedRef.current[resource.id]) {
|
|
4419
4472
|
return false;
|
|
4420
4473
|
}
|
|
4421
4474
|
}
|
|
@@ -4440,11 +4493,11 @@
|
|
|
4440
4493
|
.then((newSchema) => {
|
|
4441
4494
|
// The schema could have the same object identity,
|
|
4442
4495
|
// so need to use the spread operator to kick React re-render.
|
|
4443
|
-
setSchema(
|
|
4496
|
+
setSchema({ ...newSchema });
|
|
4444
4497
|
})
|
|
4445
4498
|
.catch(console.log);
|
|
4446
4499
|
}, [medplum, props.resourceType]);
|
|
4447
|
-
const typeSchema =
|
|
4500
|
+
const typeSchema = schema?.types?.[props.resourceType];
|
|
4448
4501
|
if (!typeSchema) {
|
|
4449
4502
|
return React.createElement(core$1.Loader, null);
|
|
4450
4503
|
}
|
|
@@ -4456,14 +4509,14 @@
|
|
|
4456
4509
|
checkboxColumn && (React.createElement("th", null,
|
|
4457
4510
|
React.createElement("input", { type: "checkbox", value: "checked", "aria-label": "all-checkbox", "data-testid": "all-checkbox", checked: isAllSelected(), onChange: (e) => handleAllCheckboxClick(e) }))),
|
|
4458
4511
|
fields.map((field) => (React.createElement("th", { key: field.name }, field.name))))),
|
|
4459
|
-
React.createElement("tbody", null,
|
|
4512
|
+
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
4513
|
checkboxColumn && (React.createElement("td", null,
|
|
4461
4514
|
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
4515
|
fields.map((field) => {
|
|
4463
4516
|
return (React.createElement("td", { key: field.name },
|
|
4464
4517
|
React.createElement(FhirPathDisplay, { propertyType: field.propertyType, path: field.fhirPath, resource: resource })));
|
|
4465
4518
|
})))))),
|
|
4466
|
-
|
|
4519
|
+
response?.data?.ResourceList?.length === 0 && React.createElement("div", { "data-testid": "empty-search" }, "No results"),
|
|
4467
4520
|
outcome && (React.createElement("div", { "data-testid": "search-error" },
|
|
4468
4521
|
React.createElement("pre", { style: { textAlign: 'left' } }, JSON.stringify(outcome, undefined, 2)))),
|
|
4469
4522
|
props.onBulk && (React.createElement(core$1.Button, { onClick: () => props.onBulk(Object.keys(selectedRef.current)) }, "Bulk..."))));
|
|
@@ -4551,7 +4604,7 @@
|
|
|
4551
4604
|
medplum.requestSchema('PlanDefinition').then(setSchema).catch(console.log);
|
|
4552
4605
|
}, [medplum]);
|
|
4553
4606
|
React.useEffect(() => {
|
|
4554
|
-
setValue(ensurePlanDefinitionKeys(defaultValue
|
|
4607
|
+
setValue(ensurePlanDefinitionKeys(defaultValue ?? { resourceType: 'PlanDefinition' }));
|
|
4555
4608
|
document.addEventListener('mouseover', handleDocumentMouseOver);
|
|
4556
4609
|
document.addEventListener('click', handleDocumentClick);
|
|
4557
4610
|
return () => {
|
|
@@ -4563,7 +4616,10 @@
|
|
|
4563
4616
|
return null;
|
|
4564
4617
|
}
|
|
4565
4618
|
function changeProperty(property, newValue) {
|
|
4566
|
-
setValue(
|
|
4619
|
+
setValue({
|
|
4620
|
+
...valueRef.current,
|
|
4621
|
+
[property]: newValue,
|
|
4622
|
+
});
|
|
4567
4623
|
}
|
|
4568
4624
|
return (React.createElement("div", null,
|
|
4569
4625
|
React.createElement(Form, { testid: "questionnaire-form", onSubmit: () => props.onSubmit(value) },
|
|
@@ -4643,7 +4699,10 @@
|
|
|
4643
4699
|
const { action } = props;
|
|
4644
4700
|
const [actionType, setActionType] = React.useState(props.actionType);
|
|
4645
4701
|
function changeProperty(property, value) {
|
|
4646
|
-
props.onChange(
|
|
4702
|
+
props.onChange({
|
|
4703
|
+
...action,
|
|
4704
|
+
[property]: value,
|
|
4705
|
+
});
|
|
4647
4706
|
}
|
|
4648
4707
|
return (React.createElement(core$1.Stack, { spacing: "xl" },
|
|
4649
4708
|
React.createElement(core$1.TextInput, { name: `actionTitle-${action.id}`, label: "Title", defaultValue: action.title, onChange: (e) => changeProperty('title', e.currentTarget.value) }),
|
|
@@ -4669,15 +4728,15 @@
|
|
|
4669
4728
|
}
|
|
4670
4729
|
function ActionResourceTypeBuilder(props) {
|
|
4671
4730
|
const { id, definitionCanonical } = props.action;
|
|
4672
|
-
const reference =
|
|
4731
|
+
const reference = definitionCanonical?.startsWith(props.resourceType + '/')
|
|
4673
4732
|
? { reference: definitionCanonical }
|
|
4674
4733
|
: undefined;
|
|
4675
4734
|
return (React.createElement(ResourceInput, { name: id, resourceType: props.resourceType, defaultValue: reference, loadOnFocus: true, onChange: (newValue) => {
|
|
4676
4735
|
if (newValue) {
|
|
4677
|
-
props.onChange(
|
|
4736
|
+
props.onChange({ ...props.action, definitionCanonical: core.getReferenceString(newValue) });
|
|
4678
4737
|
}
|
|
4679
4738
|
else {
|
|
4680
|
-
props.onChange(
|
|
4739
|
+
props.onChange({ ...props.action, definitionCanonical: undefined });
|
|
4681
4740
|
}
|
|
4682
4741
|
} }));
|
|
4683
4742
|
}
|
|
@@ -4686,18 +4745,17 @@
|
|
|
4686
4745
|
const key = 'timing';
|
|
4687
4746
|
const [propertyValue, propertyType] = getActionTiming(value);
|
|
4688
4747
|
return (React.createElement(ResourcePropertyInput, { property: timingProperty, name: "timing[x]", defaultValue: propertyValue, defaultPropertyType: propertyType, onChange: (newValue, propName) => {
|
|
4689
|
-
props.onChange(setPropertyValue(value, key, propName
|
|
4748
|
+
props.onChange(setPropertyValue(value, key, propName ?? key, timingProperty, newValue));
|
|
4690
4749
|
} }));
|
|
4691
4750
|
}
|
|
4692
4751
|
function getInitialActionType(action) {
|
|
4693
|
-
|
|
4694
|
-
if ((_a = action.definitionCanonical) === null || _a === void 0 ? void 0 : _a.startsWith('Schedule')) {
|
|
4752
|
+
if (action.definitionCanonical?.startsWith('Schedule')) {
|
|
4695
4753
|
return 'appointment';
|
|
4696
4754
|
}
|
|
4697
|
-
if (
|
|
4755
|
+
if (action.definitionCanonical?.startsWith('Questionnaire/')) {
|
|
4698
4756
|
return 'questionnaire';
|
|
4699
4757
|
}
|
|
4700
|
-
if (
|
|
4758
|
+
if (action.definitionCanonical?.startsWith('ActivityDefinition/')) {
|
|
4701
4759
|
return 'task';
|
|
4702
4760
|
}
|
|
4703
4761
|
return undefined;
|
|
@@ -4726,13 +4784,20 @@
|
|
|
4726
4784
|
return 'id-' + nextId$1++;
|
|
4727
4785
|
}
|
|
4728
4786
|
function ensurePlanDefinitionKeys(planDefinition) {
|
|
4729
|
-
return
|
|
4787
|
+
return {
|
|
4788
|
+
...planDefinition,
|
|
4789
|
+
action: ensurePlanDefinitionActionKeys(planDefinition.action),
|
|
4790
|
+
};
|
|
4730
4791
|
}
|
|
4731
4792
|
function ensurePlanDefinitionActionKeys(actions) {
|
|
4732
4793
|
if (!actions) {
|
|
4733
4794
|
return undefined;
|
|
4734
4795
|
}
|
|
4735
|
-
return actions.map((action) => (
|
|
4796
|
+
return actions.map((action) => ({
|
|
4797
|
+
...action,
|
|
4798
|
+
id: generateId$1(action.id),
|
|
4799
|
+
action: ensurePlanDefinitionActionKeys(action.action),
|
|
4800
|
+
}));
|
|
4736
4801
|
}
|
|
4737
4802
|
|
|
4738
4803
|
exports.QuestionnaireItemType = void 0;
|
|
@@ -4790,7 +4855,13 @@
|
|
|
4790
4855
|
}
|
|
4791
4856
|
return (React.createElement(Form, { testid: "questionnaire-form", onSubmit: () => {
|
|
4792
4857
|
if (props.onSubmit && response) {
|
|
4793
|
-
props.onSubmit(
|
|
4858
|
+
props.onSubmit({
|
|
4859
|
+
...response,
|
|
4860
|
+
questionnaire: core.getReferenceString(questionnaire),
|
|
4861
|
+
subject: props.subject,
|
|
4862
|
+
source: core.createReference(source),
|
|
4863
|
+
authored: new Date().toISOString(),
|
|
4864
|
+
});
|
|
4794
4865
|
}
|
|
4795
4866
|
} },
|
|
4796
4867
|
questionnaire.title && React.createElement(core$1.Title, null, questionnaire.title),
|
|
@@ -4819,7 +4890,7 @@
|
|
|
4819
4890
|
if (item.type === exports.QuestionnaireItemType.boolean) {
|
|
4820
4891
|
const initial = item.initial && item.initial.length > 0 ? item.initial[0] : undefined;
|
|
4821
4892
|
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
|
|
4893
|
+
React.createElement(core$1.Checkbox, { id: item.linkId, name: item.linkId, defaultChecked: initial?.valueBoolean, onChange: (e) => setResponseItem(index, {
|
|
4823
4894
|
linkId: item.linkId,
|
|
4824
4895
|
text: item.text,
|
|
4825
4896
|
answer: [{ valueBoolean: e.currentTarget.checked }],
|
|
@@ -4860,28 +4931,28 @@
|
|
|
4860
4931
|
React.createElement("h3", null, item.text),
|
|
4861
4932
|
item.item && (React.createElement(QuestionnaireFormItemArray, { items: item.item, answers: props.answers, onChange: onChangeItem }))));
|
|
4862
4933
|
case exports.QuestionnaireItemType.boolean:
|
|
4863
|
-
return (React.createElement(core$1.Checkbox, { id: name, name: name, defaultChecked: initial
|
|
4934
|
+
return (React.createElement(core$1.Checkbox, { id: name, name: name, defaultChecked: initial?.valueBoolean, onChange: (e) => onChangeAnswer({ valueBoolean: e.currentTarget.checked }) }));
|
|
4864
4935
|
case exports.QuestionnaireItemType.decimal:
|
|
4865
|
-
return (React.createElement(core$1.TextInput, { type: "number", step: "any", id: name, name: name, defaultValue: initial
|
|
4936
|
+
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
4937
|
case exports.QuestionnaireItemType.integer:
|
|
4867
|
-
return (React.createElement(core$1.TextInput, { type: "number", step: 1, id: name, name: name, defaultValue: initial
|
|
4938
|
+
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
4939
|
case exports.QuestionnaireItemType.date:
|
|
4869
|
-
return (React.createElement(core$1.TextInput, { type: "date", id: name, name: name, defaultValue: initial
|
|
4940
|
+
return (React.createElement(core$1.TextInput, { type: "date", id: name, name: name, defaultValue: initial?.valueDate, onChange: (e) => onChangeAnswer({ valueDate: e.currentTarget.value }) }));
|
|
4870
4941
|
case exports.QuestionnaireItemType.dateTime:
|
|
4871
|
-
return (React.createElement(DateTimeInput, { name: name, defaultValue: initial
|
|
4942
|
+
return (React.createElement(DateTimeInput, { name: name, defaultValue: initial?.valueDateTime, onChange: (newValue) => onChangeAnswer({ valueDateTime: newValue }) }));
|
|
4872
4943
|
case exports.QuestionnaireItemType.time:
|
|
4873
|
-
return (React.createElement(core$1.TextInput, { type: "time", id: name, name: name, defaultValue: initial
|
|
4944
|
+
return (React.createElement(core$1.TextInput, { type: "time", id: name, name: name, defaultValue: initial?.valueTime, onChange: (e) => onChangeAnswer({ valueTime: e.currentTarget.value }) }));
|
|
4874
4945
|
case exports.QuestionnaireItemType.string:
|
|
4875
4946
|
case exports.QuestionnaireItemType.url:
|
|
4876
|
-
return (React.createElement(core$1.TextInput, { id: name, name: name, defaultValue: initial
|
|
4947
|
+
return (React.createElement(core$1.TextInput, { id: name, name: name, defaultValue: initial?.valueString, onChange: (e) => onChangeAnswer({ valueString: e.currentTarget.value }) }));
|
|
4877
4948
|
case exports.QuestionnaireItemType.text:
|
|
4878
|
-
return (React.createElement(core$1.Textarea, { id: name, name: name, defaultValue: initial
|
|
4949
|
+
return (React.createElement(core$1.Textarea, { id: name, name: name, defaultValue: initial?.valueString, onChange: (e) => onChangeAnswer({ valueString: e.currentTarget.value }) }));
|
|
4879
4950
|
case exports.QuestionnaireItemType.attachment:
|
|
4880
|
-
return (React.createElement(AttachmentInput, { name: name, defaultValue: initial
|
|
4951
|
+
return (React.createElement(AttachmentInput, { name: name, defaultValue: initial?.valueAttachment, onChange: (newValue) => onChangeAnswer({ valueAttachment: newValue }) }));
|
|
4881
4952
|
case exports.QuestionnaireItemType.reference:
|
|
4882
|
-
return (React.createElement(ReferenceInput, { name: name, defaultValue: initial
|
|
4953
|
+
return (React.createElement(ReferenceInput, { name: name, defaultValue: initial?.valueReference, onChange: (newValue) => onChangeAnswer({ valueReference: newValue }) }));
|
|
4883
4954
|
case exports.QuestionnaireItemType.quantity:
|
|
4884
|
-
return (React.createElement(QuantityInput, { name: name, defaultValue: initial
|
|
4955
|
+
return (React.createElement(QuantityInput, { name: name, defaultValue: initial?.valueQuantity, onChange: (newValue) => onChangeAnswer({ valueQuantity: newValue }) }));
|
|
4885
4956
|
case exports.QuestionnaireItemType.choice:
|
|
4886
4957
|
case exports.QuestionnaireItemType.openChoice:
|
|
4887
4958
|
if (isDropDownChoice(item)) {
|
|
@@ -4962,30 +5033,24 @@
|
|
|
4962
5033
|
return response;
|
|
4963
5034
|
}
|
|
4964
5035
|
function buildInitialResponseItems(items) {
|
|
4965
|
-
|
|
4966
|
-
return (_a = items === null || items === void 0 ? void 0 : items.map(buildInitialResponseItem)) !== null && _a !== void 0 ? _a : [];
|
|
5036
|
+
return items?.map(buildInitialResponseItem) ?? [];
|
|
4967
5037
|
}
|
|
4968
5038
|
function buildInitialResponseItem(item) {
|
|
4969
|
-
var _a, _b;
|
|
4970
5039
|
return {
|
|
4971
5040
|
linkId: item.linkId,
|
|
4972
5041
|
text: item.text,
|
|
4973
5042
|
item: buildInitialResponseItems(item.item),
|
|
4974
|
-
answer:
|
|
5043
|
+
answer: item.initial?.map(buildInitialResponseAnswer) ?? [],
|
|
4975
5044
|
};
|
|
4976
5045
|
}
|
|
4977
5046
|
function buildInitialResponseAnswer(answer) {
|
|
4978
5047
|
// This works because QuestionnaireItemInitial and QuestionnaireResponseItemAnswer
|
|
4979
5048
|
// have the same properties.
|
|
4980
|
-
return
|
|
5049
|
+
return { ...answer };
|
|
4981
5050
|
}
|
|
4982
5051
|
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
|
-
}));
|
|
5052
|
+
return !!item.extension?.some((e) => e.url === 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl' &&
|
|
5053
|
+
e.valueCodeableConcept?.coding?.[0]?.code === 'drop-down');
|
|
4989
5054
|
}
|
|
4990
5055
|
function isQuestionEnabled(item, answers) {
|
|
4991
5056
|
if (!item.enableWhen) {
|
|
@@ -5078,7 +5143,7 @@
|
|
|
5078
5143
|
medplum.requestSchema('Questionnaire').then(setSchema).catch(console.log);
|
|
5079
5144
|
}, [medplum]);
|
|
5080
5145
|
React.useEffect(() => {
|
|
5081
|
-
setValue(ensureQuestionnaireKeys(defaultValue
|
|
5146
|
+
setValue(ensureQuestionnaireKeys(defaultValue ?? { resourceType: 'Questionnaire' }));
|
|
5082
5147
|
document.addEventListener('mouseover', handleDocumentMouseOver);
|
|
5083
5148
|
document.addEventListener('click', handleDocumentClick);
|
|
5084
5149
|
return () => {
|
|
@@ -5095,13 +5160,12 @@
|
|
|
5095
5160
|
React.createElement(core$1.Button, { type: "submit" }, "Save"))));
|
|
5096
5161
|
}
|
|
5097
5162
|
function ItemBuilder(props) {
|
|
5098
|
-
var _a;
|
|
5099
5163
|
const { classes, cx } = useStyles$4();
|
|
5100
5164
|
const resource = props.item;
|
|
5101
5165
|
const item = props.item;
|
|
5102
5166
|
const isResource = 'resourceType' in props.item;
|
|
5103
5167
|
const isContainer = isResource || item.type === exports.QuestionnaireItemType.group;
|
|
5104
|
-
const linkId =
|
|
5168
|
+
const linkId = item.linkId ?? '[untitled]';
|
|
5105
5169
|
const editing = props.selectedKey === props.item.id;
|
|
5106
5170
|
const hovering = props.hoverKey === props.item.id;
|
|
5107
5171
|
const itemRef = React.useRef();
|
|
@@ -5115,20 +5179,29 @@
|
|
|
5115
5179
|
props.setHoverKey(props.item.id);
|
|
5116
5180
|
}
|
|
5117
5181
|
function changeItem(changedItem) {
|
|
5118
|
-
var _a;
|
|
5119
5182
|
const curr = itemRef.current;
|
|
5120
|
-
props.onChange(
|
|
5183
|
+
props.onChange({
|
|
5184
|
+
...curr,
|
|
5185
|
+
item: curr.item?.map((i) => (i.id === changedItem.id ? changedItem : i)),
|
|
5186
|
+
});
|
|
5121
5187
|
}
|
|
5122
5188
|
function addItem(addedItem) {
|
|
5123
|
-
|
|
5124
|
-
|
|
5189
|
+
props.onChange({
|
|
5190
|
+
...props.item,
|
|
5191
|
+
item: [...(props.item?.item ?? []), addedItem],
|
|
5192
|
+
});
|
|
5125
5193
|
}
|
|
5126
5194
|
function removeItem(removedItem) {
|
|
5127
|
-
|
|
5128
|
-
|
|
5195
|
+
props.onChange({
|
|
5196
|
+
...props.item,
|
|
5197
|
+
item: props.item?.item?.filter((i) => i !== removedItem),
|
|
5198
|
+
});
|
|
5129
5199
|
}
|
|
5130
5200
|
function changeProperty(property, value) {
|
|
5131
|
-
props.onChange(
|
|
5201
|
+
props.onChange({
|
|
5202
|
+
...itemRef.current,
|
|
5203
|
+
[property]: value,
|
|
5204
|
+
});
|
|
5132
5205
|
}
|
|
5133
5206
|
const className = cx(classes.section, {
|
|
5134
5207
|
[classes.editing]: editing,
|
|
@@ -5192,9 +5265,8 @@
|
|
|
5192
5265
|
} }, "Remove")))));
|
|
5193
5266
|
}
|
|
5194
5267
|
function AnswerBuilder(props) {
|
|
5195
|
-
var _a;
|
|
5196
5268
|
const property = core.globalSchema.types['QuestionnaireItemAnswerOption'].properties['value[x]'];
|
|
5197
|
-
const options =
|
|
5269
|
+
const options = props.options ?? [];
|
|
5198
5270
|
return (React.createElement("div", null,
|
|
5199
5271
|
options.map((option) => {
|
|
5200
5272
|
const [propertyValue, propertyType] = getValueAndType({ type: 'QuestionnaireItemAnswerOption', value: option }, 'value');
|
|
@@ -5249,28 +5321,39 @@
|
|
|
5249
5321
|
return 'id-' + nextId++;
|
|
5250
5322
|
}
|
|
5251
5323
|
function ensureQuestionnaireKeys(questionnaire) {
|
|
5252
|
-
return
|
|
5324
|
+
return {
|
|
5325
|
+
...questionnaire,
|
|
5326
|
+
id: questionnaire.id || generateId(),
|
|
5327
|
+
item: ensureQuestionnaireItemKeys(questionnaire.item),
|
|
5328
|
+
};
|
|
5253
5329
|
}
|
|
5254
5330
|
function ensureQuestionnaireItemKeys(items) {
|
|
5255
5331
|
if (!items) {
|
|
5256
5332
|
return undefined;
|
|
5257
5333
|
}
|
|
5258
5334
|
items.forEach((item) => {
|
|
5259
|
-
|
|
5260
|
-
if ((_a = item.id) === null || _a === void 0 ? void 0 : _a.match(/^id-\d+$/)) {
|
|
5335
|
+
if (item.id?.match(/^id-\d+$/)) {
|
|
5261
5336
|
nextId = Math.max(nextId, parseInt(item.id.substring(3)) + 1);
|
|
5262
5337
|
}
|
|
5263
|
-
if (
|
|
5338
|
+
if (item.linkId?.match(/^q\d+$/)) {
|
|
5264
5339
|
nextLinkId = Math.max(nextLinkId, parseInt(item.linkId.substring(1)) + 1);
|
|
5265
5340
|
}
|
|
5266
5341
|
});
|
|
5267
|
-
return items.map((item) => (
|
|
5342
|
+
return items.map((item) => ({
|
|
5343
|
+
...item,
|
|
5344
|
+
id: item.id || generateId(),
|
|
5345
|
+
item: ensureQuestionnaireItemKeys(item.item),
|
|
5346
|
+
answerOption: ensureQuestionnaireOptionKeys(item.answerOption),
|
|
5347
|
+
}));
|
|
5268
5348
|
}
|
|
5269
5349
|
function ensureQuestionnaireOptionKeys(options) {
|
|
5270
5350
|
if (!options) {
|
|
5271
5351
|
return undefined;
|
|
5272
5352
|
}
|
|
5273
|
-
return options.map((option) => (
|
|
5353
|
+
return options.map((option) => ({
|
|
5354
|
+
...option,
|
|
5355
|
+
id: option.id || generateId(),
|
|
5356
|
+
}));
|
|
5274
5357
|
}
|
|
5275
5358
|
|
|
5276
5359
|
const useStyles$3 = core$1.createStyles((theme) => ({
|
|
@@ -5302,10 +5385,7 @@
|
|
|
5302
5385
|
setIntervalGroups(groupQualifiedIntervals(definition.qualifiedInterval || [], setGroupId));
|
|
5303
5386
|
}, [defaultDefinition]);
|
|
5304
5387
|
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
|
-
})),
|
|
5388
|
+
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
5389
|
React.createElement(core$1.ActionIcon, { title: "Add Group", size: "sm", onClick: (e) => {
|
|
5310
5390
|
killEvent(e);
|
|
5311
5391
|
addGroup({ id: `group-id-${groupId}`, filters: {}, intervals: [] });
|
|
@@ -5321,7 +5401,7 @@
|
|
|
5321
5401
|
const qualifiedInterval = intervalGroups
|
|
5322
5402
|
.flatMap((group) => group.intervals)
|
|
5323
5403
|
.filter((interval) => !isEmptyInterval(interval));
|
|
5324
|
-
props.onSubmit(
|
|
5404
|
+
props.onSubmit({ ...defaultDefinition, qualifiedInterval });
|
|
5325
5405
|
}
|
|
5326
5406
|
/**
|
|
5327
5407
|
* Add Remove Interval Groups
|
|
@@ -5337,11 +5417,10 @@
|
|
|
5337
5417
|
*/
|
|
5338
5418
|
function changeInterval(groupId, changedInterval) {
|
|
5339
5419
|
setIntervalGroups((groups) => {
|
|
5340
|
-
var _a, _b;
|
|
5341
5420
|
groups = [...groups];
|
|
5342
5421
|
const currentGroup = groups.find((g) => g.id === groupId);
|
|
5343
|
-
const index =
|
|
5344
|
-
if (index !== undefined &&
|
|
5422
|
+
const index = currentGroup?.intervals?.findIndex((interval) => interval.id === changedInterval.id);
|
|
5423
|
+
if (index !== undefined && currentGroup?.intervals?.[index]) {
|
|
5345
5424
|
currentGroup.intervals[index] = changedInterval;
|
|
5346
5425
|
}
|
|
5347
5426
|
return groups;
|
|
@@ -5356,8 +5435,8 @@
|
|
|
5356
5435
|
groups = [...groups];
|
|
5357
5436
|
const currentGroupIndex = groups.findIndex((g) => g.id === groupId);
|
|
5358
5437
|
if (currentGroupIndex != -1) {
|
|
5359
|
-
const currentGroup =
|
|
5360
|
-
addedInterval =
|
|
5438
|
+
const currentGroup = { ...groups[currentGroupIndex] };
|
|
5439
|
+
addedInterval = { ...addedInterval, ...currentGroup.filters };
|
|
5361
5440
|
currentGroup.intervals = [...currentGroup.intervals, addedInterval];
|
|
5362
5441
|
groups[currentGroupIndex] = currentGroup;
|
|
5363
5442
|
}
|
|
@@ -5392,7 +5471,7 @@
|
|
|
5392
5471
|
React.createElement(core$1.Group, null,
|
|
5393
5472
|
React.createElement(core$1.TextInput, { key: `condition-${interval.id}`, "data-testid": `condition-${interval.id}`, defaultValue: interval.condition, label: 'Condition: ', size: 'sm', onChange: (e) => {
|
|
5394
5473
|
killEvent(e);
|
|
5395
|
-
props.onChange(intervalGroup.id,
|
|
5474
|
+
props.onChange(intervalGroup.id, { ...interval, condition: e.currentTarget.value.trim() });
|
|
5396
5475
|
} }),
|
|
5397
5476
|
React.createElement(core$1.ActionIcon, { title: "Remove Interval", size: "sm", key: `remove-interval-${interval.id}`, "data-testid": `remove-interval-${interval.id}`, onClick: (e) => {
|
|
5398
5477
|
killEvent(e);
|
|
@@ -5400,7 +5479,7 @@
|
|
|
5400
5479
|
} },
|
|
5401
5480
|
React.createElement(icons.IconCircleMinus, null))),
|
|
5402
5481
|
React.createElement(RangeInput, { onChange: (range) => {
|
|
5403
|
-
props.onChange(intervalGroup.id,
|
|
5482
|
+
props.onChange(intervalGroup.id, { ...interval, range });
|
|
5404
5483
|
}, key: `range-${interval.id}`, name: `range-${interval.id}`, defaultValue: interval.range })))),
|
|
5405
5484
|
React.createElement(core$1.ActionIcon, { title: "Add Interval", size: "sm", onClick: (e) => {
|
|
5406
5485
|
killEvent(e);
|
|
@@ -5417,27 +5496,32 @@
|
|
|
5417
5496
|
* Render the "filters" section of the IntervalGroup. Also populates some initial
|
|
5418
5497
|
*/
|
|
5419
5498
|
function ReferenceRangeGroupFilters(props) {
|
|
5420
|
-
var _a, _b;
|
|
5421
5499
|
const { intervalGroup, onChange } = props;
|
|
5422
5500
|
// Pre-populate the units of the age filter
|
|
5423
5501
|
if (!intervalGroup.filters.age) {
|
|
5424
5502
|
intervalGroup.filters.age = {};
|
|
5425
5503
|
}
|
|
5426
5504
|
for (const key of ['low', 'high']) {
|
|
5427
|
-
if (!
|
|
5428
|
-
intervalGroup.filters.age[key] =
|
|
5505
|
+
if (!intervalGroup.filters.age[key]?.unit) {
|
|
5506
|
+
intervalGroup.filters.age[key] = {
|
|
5507
|
+
...intervalGroup.filters.age[key],
|
|
5508
|
+
unit: 'years',
|
|
5509
|
+
system: 'http://unitsofmeasure.org',
|
|
5510
|
+
};
|
|
5429
5511
|
}
|
|
5430
5512
|
}
|
|
5431
5513
|
return (React.createElement(core$1.Stack, { style: { maxWidth: '50%' } },
|
|
5432
5514
|
React.createElement(core$1.Group, null,
|
|
5433
5515
|
React.createElement(core$1.NativeSelect, { data: ['', 'male', 'female'], label: "Gender:", defaultValue: intervalGroup.filters.gender || '', onChange: (e) => {
|
|
5434
|
-
var _a;
|
|
5435
5516
|
for (const interval of intervalGroup.intervals) {
|
|
5436
|
-
let newGender =
|
|
5517
|
+
let newGender = e.currentTarget?.value;
|
|
5437
5518
|
if (newGender === '') {
|
|
5438
5519
|
newGender = undefined;
|
|
5439
5520
|
}
|
|
5440
|
-
onChange(intervalGroup.id,
|
|
5521
|
+
onChange(intervalGroup.id, {
|
|
5522
|
+
...interval,
|
|
5523
|
+
gender: newGender,
|
|
5524
|
+
});
|
|
5441
5525
|
}
|
|
5442
5526
|
} })),
|
|
5443
5527
|
React.createElement(core$1.Group, { spacing: 'xs' },
|
|
@@ -5445,24 +5529,26 @@
|
|
|
5445
5529
|
React.createElement("div", { id: `div-age-${intervalGroup.id}` },
|
|
5446
5530
|
React.createElement(RangeInput, { key: `age-${intervalGroup.id}`, name: `age-${intervalGroup.id}`, defaultValue: intervalGroup.filters['age'], onChange: (ageRange) => {
|
|
5447
5531
|
for (const interval of intervalGroup.intervals) {
|
|
5448
|
-
onChange(intervalGroup.id,
|
|
5532
|
+
onChange(intervalGroup.id, { ...interval, age: ageRange });
|
|
5449
5533
|
}
|
|
5450
5534
|
} }))),
|
|
5451
|
-
React.createElement(core$1.NativeSelect, { data: ['', 'pre-puberty', 'follicular', 'midcycle', 'luteal', 'postmenopausal'], label: "Endocrine:", defaultValue:
|
|
5452
|
-
var _a;
|
|
5535
|
+
React.createElement(core$1.NativeSelect, { data: ['', 'pre-puberty', 'follicular', 'midcycle', 'luteal', 'postmenopausal'], label: "Endocrine:", defaultValue: intervalGroup.filters.context?.text || '', onChange: (e) => {
|
|
5453
5536
|
for (const interval of intervalGroup.intervals) {
|
|
5454
|
-
let newEndocrine =
|
|
5537
|
+
let newEndocrine = e.currentTarget?.value;
|
|
5455
5538
|
if (newEndocrine === '') {
|
|
5456
5539
|
newEndocrine = undefined;
|
|
5457
|
-
onChange(intervalGroup.id,
|
|
5540
|
+
onChange(intervalGroup.id, { ...interval, context: undefined });
|
|
5458
5541
|
}
|
|
5459
5542
|
else {
|
|
5460
|
-
onChange(intervalGroup.id,
|
|
5543
|
+
onChange(intervalGroup.id, {
|
|
5544
|
+
...interval,
|
|
5545
|
+
context: {
|
|
5461
5546
|
text: newEndocrine,
|
|
5462
5547
|
coding: [
|
|
5463
5548
|
{ code: newEndocrine, system: 'http://terminology.hl7.org/CodeSystem/referencerange-meaning' },
|
|
5464
5549
|
],
|
|
5465
|
-
}
|
|
5550
|
+
},
|
|
5551
|
+
});
|
|
5466
5552
|
}
|
|
5467
5553
|
}
|
|
5468
5554
|
} })));
|
|
@@ -5477,15 +5563,20 @@
|
|
|
5477
5563
|
const intervals = definition.qualifiedInterval || [];
|
|
5478
5564
|
// Set the nextId to the max of any existing numeric id
|
|
5479
5565
|
let nextId = Math.max(...intervals.map((interval) => {
|
|
5480
|
-
|
|
5481
|
-
const existingNum = parseInt(((_a = interval.id) === null || _a === void 0 ? void 0 : _a.substring(3)) || '');
|
|
5566
|
+
const existingNum = parseInt(interval.id?.substring(3) || '');
|
|
5482
5567
|
return !isNaN(existingNum) ? existingNum : Number.NEGATIVE_INFINITY;
|
|
5483
5568
|
})) + 1;
|
|
5484
5569
|
if (!Number.isFinite(nextId)) {
|
|
5485
5570
|
nextId = 1;
|
|
5486
5571
|
}
|
|
5487
5572
|
// If an interval doesn't have an id, set it to the nextId
|
|
5488
|
-
definition =
|
|
5573
|
+
definition = {
|
|
5574
|
+
...definition,
|
|
5575
|
+
qualifiedInterval: intervals.map((interval) => ({
|
|
5576
|
+
...interval,
|
|
5577
|
+
id: interval.id || `id-${nextId++}`,
|
|
5578
|
+
})),
|
|
5579
|
+
};
|
|
5489
5580
|
setIntervalId(nextId);
|
|
5490
5581
|
return definition;
|
|
5491
5582
|
}
|
|
@@ -5515,13 +5606,12 @@
|
|
|
5515
5606
|
* @return A "group key" that corresponds to the value of the interval filter properties.
|
|
5516
5607
|
*/
|
|
5517
5608
|
function generateGroupKey(interval) {
|
|
5518
|
-
var _a, _b;
|
|
5519
5609
|
const results = [
|
|
5520
5610
|
`gender=${interval.gender}`,
|
|
5521
5611
|
`age=${core.formatRange(interval.age)}`,
|
|
5522
5612
|
`gestationalAge=${core.formatRange(interval.gestationalAge)}`,
|
|
5523
|
-
`context=${
|
|
5524
|
-
`appliesTo=${
|
|
5613
|
+
`context=${interval.context?.text}`,
|
|
5614
|
+
`appliesTo=${interval.appliesTo?.map((c) => c.text).join('+')}`,
|
|
5525
5615
|
];
|
|
5526
5616
|
return results.join(':');
|
|
5527
5617
|
}
|
|
@@ -5529,12 +5619,10 @@
|
|
|
5529
5619
|
return unit && (core.getCodeBySystem(unit, 'http://unitsofmeasure.org') || unit.text);
|
|
5530
5620
|
}
|
|
5531
5621
|
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;
|
|
5622
|
+
return interval.range?.low?.value === undefined && interval.range?.high?.value === undefined;
|
|
5534
5623
|
}
|
|
5535
5624
|
|
|
5536
5625
|
function RequestGroupDisplay(props) {
|
|
5537
|
-
var _a;
|
|
5538
5626
|
const medplum = useMedplum();
|
|
5539
5627
|
const requestGroup = useResource(props.value);
|
|
5540
5628
|
const [startedLoading, setStartedLoading] = React.useState(false);
|
|
@@ -5548,34 +5636,32 @@
|
|
|
5548
5636
|
if (!requestGroup || !responseBundle) {
|
|
5549
5637
|
return null;
|
|
5550
5638
|
}
|
|
5551
|
-
return (React.createElement(core$1.Grid, null,
|
|
5552
|
-
var _a, _b, _c, _d, _e, _f;
|
|
5639
|
+
return (React.createElement(core$1.Grid, null, requestGroup.action?.map((action, index) => {
|
|
5553
5640
|
const task = action.resource && findBundleEntry(action.resource);
|
|
5554
|
-
const taskInput =
|
|
5555
|
-
const taskOutput =
|
|
5641
|
+
const taskInput = task?.input?.[0]?.valueReference;
|
|
5642
|
+
const taskOutput = task?.output?.[0]?.valueReference;
|
|
5556
5643
|
return (React.createElement(React.Fragment, { key: `action-${index}` },
|
|
5557
|
-
React.createElement(core$1.Grid.Col, { span: 1, p: "md" },
|
|
5644
|
+
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
5645
|
React.createElement(core$1.Grid.Col, { span: 9, p: "xs" },
|
|
5559
5646
|
React.createElement(core$1.Text, { weight: 500 }, action.title),
|
|
5560
5647
|
action.description && React.createElement("div", null, action.description),
|
|
5561
5648
|
React.createElement("div", null,
|
|
5562
5649
|
"Last edited by\u00A0",
|
|
5563
|
-
React.createElement(ResourceName, { value:
|
|
5650
|
+
React.createElement(ResourceName, { value: task?.meta?.author }),
|
|
5564
5651
|
"\u00A0on\u00A0",
|
|
5565
|
-
core.formatDateTime(
|
|
5652
|
+
core.formatDateTime(task?.meta?.lastUpdated)),
|
|
5566
5653
|
React.createElement("div", null,
|
|
5567
5654
|
"Status: ",
|
|
5568
|
-
React.createElement(StatusBadge, { status:
|
|
5655
|
+
React.createElement(StatusBadge, { status: task?.status || 'unknown' }))),
|
|
5569
5656
|
React.createElement(core$1.Grid.Col, { span: 2, p: "md" },
|
|
5570
5657
|
taskInput && !taskOutput && React.createElement(core$1.Button, { onClick: () => props.onStart(task, taskInput) }, "Start"),
|
|
5571
5658
|
taskInput && taskOutput && (React.createElement(core$1.Button, { onClick: () => props.onEdit(task, taskInput, taskOutput) }, "Edit")))));
|
|
5572
5659
|
})));
|
|
5573
5660
|
function buildBatchRequest(request) {
|
|
5574
|
-
var _a;
|
|
5575
5661
|
const batchEntries = [];
|
|
5576
5662
|
if (request.action) {
|
|
5577
5663
|
for (const action of request.action) {
|
|
5578
|
-
if (
|
|
5664
|
+
if (action.resource?.reference) {
|
|
5579
5665
|
batchEntries.push({ request: { method: 'GET', url: action.resource.reference } });
|
|
5580
5666
|
}
|
|
5581
5667
|
}
|
|
@@ -5587,7 +5673,7 @@
|
|
|
5587
5673
|
};
|
|
5588
5674
|
}
|
|
5589
5675
|
function findBundleEntry(reference) {
|
|
5590
|
-
for (const entry of responseBundle
|
|
5676
|
+
for (const entry of responseBundle?.entry) {
|
|
5591
5677
|
if (entry.resource && reference.reference === core.getReferenceString(entry.resource)) {
|
|
5592
5678
|
return entry.resource;
|
|
5593
5679
|
}
|
|
@@ -5716,13 +5802,10 @@
|
|
|
5716
5802
|
// Convert to array of array of lines
|
|
5717
5803
|
const versions = history.entry
|
|
5718
5804
|
.filter((entry) => !!entry.resource)
|
|
5719
|
-
.map((entry) => {
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
lines: core.stringify(entry.resource, true).match(/[^\r\n]+/g),
|
|
5724
|
-
});
|
|
5725
|
-
})
|
|
5805
|
+
.map((entry) => ({
|
|
5806
|
+
meta: entry.resource?.meta,
|
|
5807
|
+
lines: core.stringify(entry.resource, true).match(/[^\r\n]+/g),
|
|
5808
|
+
}))
|
|
5726
5809
|
.sort((a, b) => a.meta.lastUpdated.localeCompare(b.meta.lastUpdated));
|
|
5727
5810
|
// Start with array of lines from the first version
|
|
5728
5811
|
const table = versions[0].lines.map((line) => ({
|
|
@@ -5830,7 +5913,6 @@
|
|
|
5830
5913
|
},
|
|
5831
5914
|
}));
|
|
5832
5915
|
function ResourceBlame(props) {
|
|
5833
|
-
var _a, _b;
|
|
5834
5916
|
const { classes } = useStyles$2();
|
|
5835
5917
|
const medplum = useMedplum();
|
|
5836
5918
|
const [value, setValue] = React.useState(props.history);
|
|
@@ -5842,7 +5924,7 @@
|
|
|
5842
5924
|
if (!value) {
|
|
5843
5925
|
return React.createElement("div", null, "Loading...");
|
|
5844
5926
|
}
|
|
5845
|
-
const resource =
|
|
5927
|
+
const resource = value.entry?.[0]?.resource;
|
|
5846
5928
|
const table = blame(value);
|
|
5847
5929
|
return (React.createElement("div", { className: classes.container },
|
|
5848
5930
|
React.createElement("table", { className: classes.root },
|
|
@@ -5900,8 +5982,8 @@
|
|
|
5900
5982
|
let originalResource = props.original;
|
|
5901
5983
|
let revisedResource = props.revised;
|
|
5902
5984
|
if (props.ignoreMeta) {
|
|
5903
|
-
originalResource =
|
|
5904
|
-
revisedResource =
|
|
5985
|
+
originalResource = { ...originalResource, meta: undefined };
|
|
5986
|
+
revisedResource = { ...revisedResource, meta: undefined };
|
|
5905
5987
|
}
|
|
5906
5988
|
const original = core.stringify(originalResource, true).match(/[^\r\n]+/g);
|
|
5907
5989
|
const revised = core.stringify(revisedResource, true).match(/[^\r\n]+/g);
|
|
@@ -5920,7 +6002,6 @@
|
|
|
5920
6002
|
}
|
|
5921
6003
|
|
|
5922
6004
|
function ResourceHistoryTable(props) {
|
|
5923
|
-
var _a;
|
|
5924
6005
|
const medplum = useMedplum();
|
|
5925
6006
|
const [value, setValue] = React.useState(props.history);
|
|
5926
6007
|
React.useEffect(() => {
|
|
@@ -5940,27 +6021,25 @@
|
|
|
5940
6021
|
React.createElement("th", null, "Author"),
|
|
5941
6022
|
React.createElement("th", null, "Date"),
|
|
5942
6023
|
React.createElement("th", null, "Version"))),
|
|
5943
|
-
React.createElement("tbody", null,
|
|
6024
|
+
React.createElement("tbody", null, value.entry?.map((entry, index) => (React.createElement(HistoryRow, { key: 'entry-' + index, entry: entry }))))));
|
|
5944
6025
|
}
|
|
5945
6026
|
function HistoryRow(props) {
|
|
5946
|
-
var _a, _b, _c;
|
|
5947
6027
|
const { response, resource } = props.entry;
|
|
5948
6028
|
if (resource) {
|
|
5949
6029
|
return (React.createElement("tr", null,
|
|
5950
6030
|
React.createElement("td", null,
|
|
5951
|
-
React.createElement(ResourceBadge, { value:
|
|
5952
|
-
React.createElement("td", null, core.formatDateTime(
|
|
6031
|
+
React.createElement(ResourceBadge, { value: resource.meta?.author, link: true })),
|
|
6032
|
+
React.createElement("td", null, core.formatDateTime(resource.meta?.lastUpdated)),
|
|
5953
6033
|
React.createElement("td", null,
|
|
5954
|
-
React.createElement(MedplumLink, { to: getVersionUrl(resource) },
|
|
6034
|
+
React.createElement(MedplumLink, { to: getVersionUrl(resource) }, resource.meta?.versionId))));
|
|
5955
6035
|
}
|
|
5956
6036
|
else {
|
|
5957
6037
|
return (React.createElement("tr", null,
|
|
5958
|
-
React.createElement("td", { colSpan: 3 }, core.normalizeErrorString(response
|
|
6038
|
+
React.createElement("td", { colSpan: 3 }, core.normalizeErrorString(response?.outcome))));
|
|
5959
6039
|
}
|
|
5960
6040
|
}
|
|
5961
6041
|
function getVersionUrl(resource) {
|
|
5962
|
-
|
|
5963
|
-
return `/${resource.resourceType}/${resource.id}/_history/${(_a = resource.meta) === null || _a === void 0 ? void 0 : _a.versionId}`;
|
|
6042
|
+
return `/${resource.resourceType}/${resource.id}/_history/${resource.meta?.versionId}`;
|
|
5964
6043
|
}
|
|
5965
6044
|
|
|
5966
6045
|
const useStyles = core$1.createStyles((theme) => ({
|
|
@@ -5979,7 +6058,6 @@
|
|
|
5979
6058
|
},
|
|
5980
6059
|
}));
|
|
5981
6060
|
function Scheduler(props) {
|
|
5982
|
-
var _a;
|
|
5983
6061
|
const { classes } = useStyles();
|
|
5984
6062
|
const medplum = useMedplum();
|
|
5985
6063
|
const schedule = useResource(props.schedule);
|
|
@@ -6011,7 +6089,7 @@
|
|
|
6011
6089
|
if (!schedule || !slots || !questionnaire) {
|
|
6012
6090
|
return null;
|
|
6013
6091
|
}
|
|
6014
|
-
const actor =
|
|
6092
|
+
const actor = schedule.actor?.[0];
|
|
6015
6093
|
return (React.createElement("div", { className: classes.container, "data-testid": "scheduler" },
|
|
6016
6094
|
React.createElement("div", { className: classes.info },
|
|
6017
6095
|
actor && React.createElement(ResourceAvatar, { value: actor, size: "xl" }),
|
|
@@ -6144,6 +6222,8 @@
|
|
|
6144
6222
|
exports.MedplumProvider = MedplumProvider;
|
|
6145
6223
|
exports.MemoizedFhirPathTable = MemoizedFhirPathTable;
|
|
6146
6224
|
exports.MemoizedSearchControl = MemoizedSearchControl;
|
|
6225
|
+
exports.MoneyDisplay = MoneyDisplay;
|
|
6226
|
+
exports.MoneyInput = MoneyInput;
|
|
6147
6227
|
exports.ObservationTable = ObservationTable;
|
|
6148
6228
|
exports.Panel = Panel;
|
|
6149
6229
|
exports.PatientTimeline = PatientTimeline;
|
|
@@ -6235,4 +6315,4 @@
|
|
|
6235
6315
|
exports.useResource = useResource;
|
|
6236
6316
|
|
|
6237
6317
|
}));
|
|
6238
|
-
//# sourceMappingURL=index.
|
|
6318
|
+
//# sourceMappingURL=index.cjs.map
|