@medplum/react 2.0.6 → 2.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +69 -66
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.min.cjs +1 -1
- package/dist/esm/BackboneElementInput/BackboneElementInput.mjs +3 -2
- package/dist/esm/BackboneElementInput/BackboneElementInput.mjs.map +1 -1
- package/dist/esm/CheckboxFormSection/CheckboxFormSection.mjs +1 -1
- package/dist/esm/CheckboxFormSection/CheckboxFormSection.mjs.map +1 -1
- package/dist/esm/DateTimeInput/DateTimeInput.mjs +1 -1
- package/dist/esm/DateTimeInput/DateTimeInput.mjs.map +1 -1
- package/dist/esm/DescriptionList/DescriptionList.mjs +2 -2
- package/dist/esm/DescriptionList/DescriptionList.mjs.map +1 -1
- package/dist/esm/FormSection/FormSection.mjs +1 -1
- package/dist/esm/FormSection/FormSection.mjs.map +1 -1
- package/dist/esm/Panel/Panel.mjs +1 -1
- package/dist/esm/Panel/Panel.mjs.map +1 -1
- package/dist/esm/QuestionnaireForm/QuestionnaireForm.mjs +1 -1
- package/dist/esm/QuestionnaireForm/QuestionnaireForm.mjs.map +1 -1
- package/dist/esm/ResourceBlame/ResourceBlame.mjs +2 -2
- package/dist/esm/ResourceBlame/ResourceBlame.mjs.map +1 -1
- package/dist/esm/ResourceDiffTable/ResourceDiffTable.mjs +1 -1
- package/dist/esm/ResourceDiffTable/ResourceDiffTable.mjs.map +1 -1
- package/dist/esm/ResourcePropertyInput/ResourcePropertyInput.mjs +5 -4
- package/dist/esm/ResourcePropertyInput/ResourcePropertyInput.mjs.map +1 -1
- package/dist/esm/ResourceTimeline/ResourceTimeline.mjs +2 -2
- package/dist/esm/ResourceTimeline/ResourceTimeline.mjs.map +1 -1
- package/dist/esm/SearchControl/SearchControl.mjs +7 -7
- package/dist/esm/SearchControl/SearchControl.mjs.map +1 -1
- package/dist/esm/SearchControl/SearchUtils.mjs +1 -0
- package/dist/esm/SearchControl/SearchUtils.mjs.map +1 -1
- package/dist/esm/SearchFieldEditor/SearchFieldEditor.mjs +1 -1
- package/dist/esm/SearchFieldEditor/SearchFieldEditor.mjs.map +1 -1
- package/dist/esm/SearchFilterEditor/SearchFilterEditor.mjs +1 -1
- package/dist/esm/SearchFilterEditor/SearchFilterEditor.mjs.map +1 -1
- package/dist/esm/TimingInput/TimingInput.mjs +1 -1
- package/dist/esm/TimingInput/TimingInput.mjs.map +1 -1
- package/dist/esm/index.min.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/createReactComponent.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/createReactComponent.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconAdjustmentsHorizontal.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconAdjustmentsHorizontal.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertCircle.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertCircle.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBleach.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBleach.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBleachOff.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBleachOff.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBoxMultiple.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBoxMultiple.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBracketsContain.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBracketsContain.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBucket.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBucket.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBucketOff.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBucketOff.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCalendar.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCalendar.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCheckbox.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCheckbox.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleMinus.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleMinus.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCirclePlus.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCirclePlus.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCloudUpload.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCloudUpload.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconColumns.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconColumns.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCurrencyDollar.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCurrencyDollar.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconDots.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconDots.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEdit.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEdit.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEqual.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEqual.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEqualNot.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEqualNot.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFileAlert.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFileAlert.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFilePlus.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFilePlus.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFilter.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFilter.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconListDetails.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconListDetails.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMathGreater.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMathGreater.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMathLower.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMathLower.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMessage.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMessage.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconPin.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconPin.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconPinnedOff.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconPinnedOff.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSettings.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSettings.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSortAscending.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSortAscending.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSortDescending.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSortDescending.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSquare.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSquare.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconTableExport.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconTableExport.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.mjs.map +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconX.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconX.mjs.map +1 -1
- package/dist/types/CheckboxFormSection/CheckboxFormSection.d.ts +1 -0
- package/dist/types/DateTimeInput/DateTimeInput.d.ts +1 -0
- package/dist/types/FormSection/FormSection.d.ts +1 -0
- package/package.json +10 -10
- package/tsconfig.build.json +0 -9
|
@@ -34,14 +34,15 @@ function BackboneElementInput(props) {
|
|
|
34
34
|
return null;
|
|
35
35
|
}
|
|
36
36
|
const [propertyValue, propertyType] = getValueAndType(typedValue, key);
|
|
37
|
+
const required = property.min !== undefined && property.min > 0;
|
|
37
38
|
if (property.type.length === 1 && property.type[0].code === 'boolean') {
|
|
38
39
|
return (React.createElement(CheckboxFormSection, { key: key, title: getPropertyDisplayName(key), description: property.definition, htmlFor: key },
|
|
39
40
|
React.createElement(ResourcePropertyInput, { property: property, name: key, defaultValue: propertyValue, defaultPropertyType: propertyType, outcome: props.outcome, onChange: (newValue, propName) => {
|
|
40
41
|
setValueWrapper(setPropertyValue(value, key, propName ?? key, entry[1], newValue));
|
|
41
42
|
} })));
|
|
42
43
|
}
|
|
43
|
-
return (React.createElement(FormSection, { key: key, title: getPropertyDisplayName(key), description: property.definition, htmlFor: key, outcome: props.outcome },
|
|
44
|
-
React.createElement(ResourcePropertyInput, { property: property, name: key, defaultValue: propertyValue, defaultPropertyType: propertyType,
|
|
44
|
+
return (React.createElement(FormSection, { key: key, title: getPropertyDisplayName(key), description: property.definition, withAsterisk: required, htmlFor: key, outcome: props.outcome },
|
|
45
|
+
React.createElement(ResourcePropertyInput, { property: property, name: key, defaultValue: propertyValue, defaultPropertyType: propertyType, onChange: (newValue, propName) => {
|
|
45
46
|
setValueWrapper(setPropertyValue(value, key, propName ?? key, entry[1], newValue));
|
|
46
47
|
} })));
|
|
47
48
|
})));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackboneElementInput.mjs","sources":["../../../src/BackboneElementInput/BackboneElementInput.tsx"],"sourcesContent":["import { Stack } from '@mantine/core';\nimport { getPropertyDisplayName, globalSchema } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { CheckboxFormSection } from '../CheckboxFormSection/CheckboxFormSection';\nimport { DEFAULT_IGNORED_PROPERTIES } from '../constants';\nimport { FormSection } from '../FormSection/FormSection';\nimport { setPropertyValue } from '../ResourceForm/ResourceForm';\nimport { getValueAndType } from '../ResourcePropertyDisplay/ResourcePropertyDisplay';\nimport { ResourcePropertyInput } from '../ResourcePropertyInput/ResourcePropertyInput';\n\nexport interface BackboneElementInputProps {\n typeName: string;\n defaultValue?: any;\n outcome?: OperationOutcome;\n onChange?: (value: any) => void;\n}\n\nexport function BackboneElementInput(props: BackboneElementInputProps): JSX.Element {\n const [value, setValue] = useState<any>(props.defaultValue ?? {});\n\n function setValueWrapper(newValue: any): void {\n setValue(newValue);\n if (props.onChange) {\n props.onChange(newValue);\n }\n }\n\n const typeName = props.typeName;\n const typeSchema = globalSchema.types[typeName];\n if (!typeSchema) {\n return <div>{typeName} not implemented</div>;\n }\n\n const typedValue = { type: typeName, value };\n\n return (\n <Stack>\n {Object.entries(typeSchema.properties).map((entry) => {\n const key = entry[0];\n if (key === 'id' || DEFAULT_IGNORED_PROPERTIES.indexOf(key) >= 0) {\n return null;\n }\n const property = entry[1];\n if (!property.type) {\n return null;\n }\n\n const [propertyValue, propertyType] = getValueAndType(typedValue, key);\n\n if (property.type.length === 1 && property.type[0].code === 'boolean') {\n return (\n <CheckboxFormSection\n key={key}\n title={getPropertyDisplayName(key)}\n description={property.definition}\n htmlFor={key}\n >\n <ResourcePropertyInput\n property={property}\n name={key}\n defaultValue={propertyValue}\n defaultPropertyType={propertyType}\n outcome={props.outcome}\n onChange={(newValue: any, propName?: string) => {\n setValueWrapper(setPropertyValue(value, key, propName ?? key, entry[1], newValue));\n }}\n />\n </CheckboxFormSection>\n );\n }\n\n return (\n <FormSection\n key={key}\n title={getPropertyDisplayName(key)}\n description={property.definition}\n htmlFor={key}\n outcome={props.outcome}\n >\n <ResourcePropertyInput\n property={property}\n name={key}\n defaultValue={propertyValue}\n defaultPropertyType={propertyType}\n
|
|
1
|
+
{"version":3,"file":"BackboneElementInput.mjs","sources":["../../../src/BackboneElementInput/BackboneElementInput.tsx"],"sourcesContent":["import { Stack } from '@mantine/core';\nimport { getPropertyDisplayName, globalSchema } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { CheckboxFormSection } from '../CheckboxFormSection/CheckboxFormSection';\nimport { DEFAULT_IGNORED_PROPERTIES } from '../constants';\nimport { FormSection } from '../FormSection/FormSection';\nimport { setPropertyValue } from '../ResourceForm/ResourceForm';\nimport { getValueAndType } from '../ResourcePropertyDisplay/ResourcePropertyDisplay';\nimport { ResourcePropertyInput } from '../ResourcePropertyInput/ResourcePropertyInput';\n\nexport interface BackboneElementInputProps {\n typeName: string;\n defaultValue?: any;\n outcome?: OperationOutcome;\n onChange?: (value: any) => void;\n}\n\nexport function BackboneElementInput(props: BackboneElementInputProps): JSX.Element {\n const [value, setValue] = useState<any>(props.defaultValue ?? {});\n\n function setValueWrapper(newValue: any): void {\n setValue(newValue);\n if (props.onChange) {\n props.onChange(newValue);\n }\n }\n\n const typeName = props.typeName;\n const typeSchema = globalSchema.types[typeName];\n if (!typeSchema) {\n return <div>{typeName} not implemented</div>;\n }\n\n const typedValue = { type: typeName, value };\n\n return (\n <Stack>\n {Object.entries(typeSchema.properties).map((entry) => {\n const key = entry[0];\n if (key === 'id' || DEFAULT_IGNORED_PROPERTIES.indexOf(key) >= 0) {\n return null;\n }\n const property = entry[1];\n if (!property.type) {\n return null;\n }\n\n const [propertyValue, propertyType] = getValueAndType(typedValue, key);\n const required = property.min !== undefined && property.min > 0;\n\n if (property.type.length === 1 && property.type[0].code === 'boolean') {\n return (\n <CheckboxFormSection\n key={key}\n title={getPropertyDisplayName(key)}\n description={property.definition}\n htmlFor={key}\n >\n <ResourcePropertyInput\n property={property}\n name={key}\n defaultValue={propertyValue}\n defaultPropertyType={propertyType}\n outcome={props.outcome}\n onChange={(newValue: any, propName?: string) => {\n setValueWrapper(setPropertyValue(value, key, propName ?? key, entry[1], newValue));\n }}\n />\n </CheckboxFormSection>\n );\n }\n\n return (\n <FormSection\n key={key}\n title={getPropertyDisplayName(key)}\n description={property.definition}\n withAsterisk={required}\n htmlFor={key}\n outcome={props.outcome}\n >\n <ResourcePropertyInput\n property={property}\n name={key}\n defaultValue={propertyValue}\n defaultPropertyType={propertyType}\n onChange={(newValue: any, propName?: string) => {\n setValueWrapper(setPropertyValue(value, key, propName ?? key, entry[1], newValue));\n }}\n />\n </FormSection>\n );\n })}\n </Stack>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;AAkBM,SAAU,oBAAoB,CAAC,KAAgC,EAAA;AACnE,IAAA,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAM,KAAK,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;IAElE,SAAS,eAAe,CAAC,QAAa,EAAA;QACpC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACnB,IAAI,KAAK,CAAC,QAAQ,EAAE;AAClB,YAAA,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC1B,SAAA;KACF;AAED,IAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;IAChC,MAAM,UAAU,GAAG,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAChD,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA;YAAM,QAAQ;oCAA4B,CAAC;AACnD,KAAA;IAED,MAAM,UAAU,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAE7C,IAAA,QACE,KAAC,CAAA,aAAA,CAAA,KAAK,QACH,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,KAAI;AACnD,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AC;qBACpF,EAAA,CACD,CACkB,EACtB;AACH,SAAA;AAED,QAAA,QACE,KAAA,CAAA,aAAA,CAAC,WAAW,EAAA,EACV,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,sBAAsB,CAAC,GAAG,CAAC,EAClC,WAAW,EAAE,QAAQ,CAAC,UAAU,EAChC,YAAY,EAAE,QAAQ,EACtB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,KAAK,CAAC,OAAO,EAAA;YAEtB,KAAC,CAAA,aAAA,CAAA,qBAAqB,EACpB,EAAA,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,GAAG,EACT,YAAY,EAAE,aAAa,EAC3B,mBAAmB,EAAE,YAAY,EACjC,QAAQ,EAAE,CAAC,QAAa,EAAE,QAAiB,KAAI;AAC7C,oBAAA,eAAe,CAAC,gBAAgB,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,IAAI,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;iBACpF,EAAA,CACD,CACU,EACd;KACH,CAAC,CACI,EACR;AACJ;;;;"}
|
|
@@ -5,7 +5,7 @@ function CheckboxFormSection(props) {
|
|
|
5
5
|
return (React.createElement(Group, { noWrap: true },
|
|
6
6
|
React.createElement("div", null, props.children),
|
|
7
7
|
React.createElement("div", null,
|
|
8
|
-
React.createElement(Input.Wrapper, { id: props.htmlFor, label: props.title, description: props.description }, (() => null)()))));
|
|
8
|
+
React.createElement(Input.Wrapper, { id: props.htmlFor, label: props.title, description: props.description, withAsterisk: props.withAsterisk }, (() => null)()))));
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export { CheckboxFormSection };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxFormSection.mjs","sources":["../../../src/CheckboxFormSection/CheckboxFormSection.tsx"],"sourcesContent":["import { Group, Input } from '@mantine/core';\nimport React from 'react';\n\nexport interface CheckboxFormSectionProps {\n htmlFor?: string;\n title?: string;\n description?: string;\n children?: React.ReactNode;\n}\n\nexport function CheckboxFormSection(props: CheckboxFormSectionProps): JSX.Element {\n return (\n <Group noWrap>\n <div>{props.children}</div>\n <div>\n <Input.Wrapper
|
|
1
|
+
{"version":3,"file":"CheckboxFormSection.mjs","sources":["../../../src/CheckboxFormSection/CheckboxFormSection.tsx"],"sourcesContent":["import { Group, Input } from '@mantine/core';\nimport React from 'react';\n\nexport interface CheckboxFormSectionProps {\n htmlFor?: string;\n title?: string;\n description?: string;\n withAsterisk?: boolean;\n children?: React.ReactNode;\n}\n\nexport function CheckboxFormSection(props: CheckboxFormSectionProps): JSX.Element {\n return (\n <Group noWrap>\n <div>{props.children}</div>\n <div>\n <Input.Wrapper\n id={props.htmlFor}\n label={props.title}\n description={props.description}\n withAsterisk={props.withAsterisk}\n >\n {(() => null)()}\n </Input.Wrapper>\n </div>\n </Group>\n );\n}\n"],"names":[],"mappings":";;;AAWM,SAAU,mBAAmB,CAAC,KAA+B,EAAA;AACjE,IAAA,QACE,KAAA,CAAA,aAAA,CAAC,KAAK,EAAA,EAAC,MAAM,EAAA,IAAA,EAAA;QACX,KAAM,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA,EAAA,KAAK,CAAC,QAAQ,CAAO;AAC3B,QAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA;AACE,YAAA,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,OAAO,EACZ,EAAA,EAAE,EAAE,KAAK,CAAC,OAAO,EACjB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,YAAY,EAAE,KAAK,CAAC,YAAY,IAE/B,CAAC,MAAM,IAAI,GAAG,CACD,CACZ,CACA,EACR;AACJ;;;;"}
|
|
@@ -12,7 +12,7 @@ import { getErrorsForInput } from '../utils/outcomes.mjs';
|
|
|
12
12
|
* @returns The JSX element to render.
|
|
13
13
|
*/
|
|
14
14
|
function DateTimeInput(props) {
|
|
15
|
-
return (React.createElement(TextInput, { id: props.name, name: props.name, "data-testid": props.name, placeholder: props.placeholder, type: getInputType(), defaultValue: convertIsoToLocal(props.defaultValue), error: getErrorsForInput(props.outcome, props.name), onChange: (e) => {
|
|
15
|
+
return (React.createElement(TextInput, { id: props.name, name: props.name, "data-testid": props.name, placeholder: props.placeholder, required: props.required, type: getInputType(), defaultValue: convertIsoToLocal(props.defaultValue), error: getErrorsForInput(props.outcome, props.name), onChange: (e) => {
|
|
16
16
|
if (props.onChange) {
|
|
17
17
|
const newValue = e.currentTarget.value;
|
|
18
18
|
props.onChange(convertLocalToIso(newValue));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeInput.mjs","sources":["../../../src/DateTimeInput/DateTimeInput.tsx"],"sourcesContent":["import { TextInput } from '@mantine/core';\nimport { isValidDate } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { getErrorsForInput } from '../utils/outcomes';\n\nexport interface DateTimeInputProps {\n name?: string;\n placeholder?: string;\n defaultValue?: string;\n outcome?: OperationOutcome;\n onChange?: (value: string) => void;\n}\n\n/**\n * The DateTimeInput component is a wrapper around the HTML5 input type=\"datetime-local\".\n * The main purpose is to reconcile time zones.\n * Most of our date/time values are in ISO-8601, which includes a time zone offset.\n * The datetime-local input does not support the time zone offset.\n * @param props The Input props.\n * @returns The JSX element to render.\n */\nexport function DateTimeInput(props: DateTimeInputProps): JSX.Element {\n return (\n <TextInput\n id={props.name}\n name={props.name}\n data-testid={props.name}\n placeholder={props.placeholder}\n type={getInputType()}\n defaultValue={convertIsoToLocal(props.defaultValue)}\n error={getErrorsForInput(props.outcome, props.name)}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => {\n if (props.onChange) {\n const newValue = e.currentTarget.value;\n props.onChange(convertLocalToIso(newValue));\n }\n }}\n />\n );\n}\n\n/**\n * Converts an ISO-8601 date/time string to a local date/time string.\n * @param isoString The ISO-8601 date/time string to convert.\n * @returns The local date/time string.\n */\nexport function convertIsoToLocal(isoString: string | undefined): string {\n if (!isoString) {\n return '';\n }\n\n // Convert the ISO-8601 date to a local datetime-local value.\n // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats#local_date_and_time_strings\n // See: https://stackoverflow.com/a/60368477\n const date = new Date(isoString);\n if (!isValidDate(date)) {\n // If the input string was malformed, return an empty string.\n return '';\n }\n\n return date.toLocaleDateString('sv') + 'T' + date.toLocaleTimeString('sv');\n}\n\n/**\n * Converts a local date/time string to an ISO-8601 date/time string.\n * @param localString The local date/time string to convert.\n * @returns The ISO-8601 date/time string.\n */\nexport function convertLocalToIso(localString: string | undefined): string {\n if (!localString) {\n return '';\n }\n\n // Try to parse the local string as a Date\n // JavaScript's Date() constructor defaults to the local time zone.\n // The Date() constructor will throw if the value is malformed.\n const date = new Date(localString);\n if (!isValidDate(date)) {\n // If the input string was malformed, return an empty string.\n return '';\n }\n\n return date.toISOString();\n}\n\n/**\n * Returns the input type for the requested type.\n * JSDOM does not support many of the valid <input> type attributes.\n * For example, it won't fire change events for <input type=\"datetime-local\">.\n */\nfunction getInputType(): string {\n return process.env.NODE_ENV === 'test' ? 'text' : 'datetime-local';\n}\n"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"DateTimeInput.mjs","sources":["../../../src/DateTimeInput/DateTimeInput.tsx"],"sourcesContent":["import { TextInput } from '@mantine/core';\nimport { isValidDate } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { getErrorsForInput } from '../utils/outcomes';\n\nexport interface DateTimeInputProps {\n name?: string;\n placeholder?: string;\n defaultValue?: string;\n required?: boolean;\n outcome?: OperationOutcome;\n onChange?: (value: string) => void;\n}\n\n/**\n * The DateTimeInput component is a wrapper around the HTML5 input type=\"datetime-local\".\n * The main purpose is to reconcile time zones.\n * Most of our date/time values are in ISO-8601, which includes a time zone offset.\n * The datetime-local input does not support the time zone offset.\n * @param props The Input props.\n * @returns The JSX element to render.\n */\nexport function DateTimeInput(props: DateTimeInputProps): JSX.Element {\n return (\n <TextInput\n id={props.name}\n name={props.name}\n data-testid={props.name}\n placeholder={props.placeholder}\n required={props.required}\n type={getInputType()}\n defaultValue={convertIsoToLocal(props.defaultValue)}\n error={getErrorsForInput(props.outcome, props.name)}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => {\n if (props.onChange) {\n const newValue = e.currentTarget.value;\n props.onChange(convertLocalToIso(newValue));\n }\n }}\n />\n );\n}\n\n/**\n * Converts an ISO-8601 date/time string to a local date/time string.\n * @param isoString The ISO-8601 date/time string to convert.\n * @returns The local date/time string.\n */\nexport function convertIsoToLocal(isoString: string | undefined): string {\n if (!isoString) {\n return '';\n }\n\n // Convert the ISO-8601 date to a local datetime-local value.\n // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats#local_date_and_time_strings\n // See: https://stackoverflow.com/a/60368477\n const date = new Date(isoString);\n if (!isValidDate(date)) {\n // If the input string was malformed, return an empty string.\n return '';\n }\n\n return date.toLocaleDateString('sv') + 'T' + date.toLocaleTimeString('sv');\n}\n\n/**\n * Converts a local date/time string to an ISO-8601 date/time string.\n * @param localString The local date/time string to convert.\n * @returns The ISO-8601 date/time string.\n */\nexport function convertLocalToIso(localString: string | undefined): string {\n if (!localString) {\n return '';\n }\n\n // Try to parse the local string as a Date\n // JavaScript's Date() constructor defaults to the local time zone.\n // The Date() constructor will throw if the value is malformed.\n const date = new Date(localString);\n if (!isValidDate(date)) {\n // If the input string was malformed, return an empty string.\n return '';\n }\n\n return date.toISOString();\n}\n\n/**\n * Returns the input type for the requested type.\n * JSDOM does not support many of the valid <input> type attributes.\n * For example, it won't fire change events for <input type=\"datetime-local\">.\n */\nfunction getInputType(): string {\n return process.env.NODE_ENV === 'test' ? 'text' : 'datetime-local';\n}\n"],"names":[],"mappings":";;;;;AAeA;;;;;;;AAOG;AACG,SAAU,aAAa,CAAC,KAAyB,EAAA;AACrD,IA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AG,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC;AACnC,IAAA,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;;AAEtB,QAAA,OAAO,EAAE,CAAC;AACX,KAAA;AAED,IAAA,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;AAC5B,CAAC;AAED;;;;AAIG;AACH,SAAS,YAAY,GAAA;AACnB,IAAA,OAAkD,gBAAgB,CAAC;AACrE;;;;"}
|
|
@@ -7,7 +7,7 @@ const useStyles = createStyles((theme) => ({
|
|
|
7
7
|
gridTemplateColumns: '30% 70%',
|
|
8
8
|
margin: 0,
|
|
9
9
|
'& > dt, & > dd': {
|
|
10
|
-
padding: `${theme.spacing.sm}
|
|
10
|
+
padding: `${theme.spacing.sm} ${theme.spacing.sm}`,
|
|
11
11
|
borderTop: `0.1px solid ${theme.colors.gray[3]}`,
|
|
12
12
|
margin: 0,
|
|
13
13
|
},
|
|
@@ -15,7 +15,7 @@ const useStyles = createStyles((theme) => ({
|
|
|
15
15
|
compact: {
|
|
16
16
|
gridTemplateColumns: '20% 80%',
|
|
17
17
|
'& > dt, & > dd': {
|
|
18
|
-
padding: `0 ${theme.spacing.xs}
|
|
18
|
+
padding: `0 ${theme.spacing.xs} ${theme.spacing.xs} 0`,
|
|
19
19
|
border: 0,
|
|
20
20
|
},
|
|
21
21
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DescriptionList.mjs","sources":["../../../src/DescriptionList/DescriptionList.tsx"],"sourcesContent":["import { createStyles } from '@mantine/core';\nimport React from 'react';\n\nconst useStyles = createStyles((theme) => ({\n root: {\n display: 'grid',\n gridTemplateColumns: '30% 70%',\n margin: 0,\n\n '& > dt, & > dd': {\n padding: `${theme.spacing.sm}
|
|
1
|
+
{"version":3,"file":"DescriptionList.mjs","sources":["../../../src/DescriptionList/DescriptionList.tsx"],"sourcesContent":["import { createStyles } from '@mantine/core';\nimport React from 'react';\n\nconst useStyles = createStyles((theme) => ({\n root: {\n display: 'grid',\n gridTemplateColumns: '30% 70%',\n margin: 0,\n\n '& > dt, & > dd': {\n padding: `${theme.spacing.sm} ${theme.spacing.sm}`,\n borderTop: `0.1px solid ${theme.colors.gray[3]}`,\n margin: 0,\n },\n },\n\n compact: {\n gridTemplateColumns: '20% 80%',\n\n '& > dt, & > dd': {\n padding: `0 ${theme.spacing.xs} ${theme.spacing.xs} 0`,\n border: 0,\n },\n },\n}));\n\nexport interface DescriptionListProps {\n children: React.ReactNode;\n compact?: boolean;\n}\n\nexport function DescriptionList(props: DescriptionListProps): JSX.Element {\n const { children, compact } = props;\n const { classes, cx } = useStyles();\n return <dl className={cx(classes.root, { [classes.compact]: compact })}>{children}</dl>;\n}\n\nexport interface DescriptionListEntryProps {\n term: string;\n children: React.ReactNode;\n}\n\nexport function DescriptionListEntry(props: DescriptionListEntryProps): JSX.Element {\n return (\n <>\n <dt>{props.term}</dt>\n <dd>{props.children}</dd>\n </>\n );\n}\n"],"names":[],"mappings":";;;AAGA,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,KAAK,MAAM;AACzC,IAAA,IAAI,EAAE;AACJ,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,mBAAmB,EAAE,SAAS;AAC9B,QAAA,MAAM,EAAE,CAAC;AAET,QAAA,gBAAgB,EAAE;AAChB,YAAA,OAAO,EAAE,CAAA,EAAG,KAAK,CAAC,OAAO,CAAC,EAAE,CAAA,CAAA,EAAI,KAAK,CAAC,OAAO,CAAC,EAAE,CAAE,CAAA;YAClD,SAAS,EAAE,CAAe,YAAA,EAAA,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAE,CAAA;AAChD,YAAA,MAAM,EAAE,CAAC;AACV,SAAA;AACF,KAAA;AAED,IAAA,OAAO,EAAE;AACP,QAAA,mBAAmB,EAAE,SAAS;AAE9B,QAAA,gBAAgB,EAAE;AAChB,YAAA,OAAO,EAAE,CAAA,EAAA,EAAK,KAAK,CAAC,OAAO,CAAC,EAAE,CAAA,CAAA,EAAI,KAAK,CAAC,OAAO,CAAC,EAAE,CAAI,EAAA,CAAA;AACtD,YAAA,MAAM,EAAE,CAAC;AACV,SAAA;AACF,KAAA;AACF,CAAA,CAAC,CAAC,CAAC;AAOE,SAAU,eAAe,CAAC,KAA2B,EAAA;AACzD,IAAA,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACpC,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,SAAS,EAAE,CAAC;IACpC,OAAO,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,GAAG,OAAO,EAAE,CAAC,EAAA,EAAG,QAAQ,CAAM,CAAC;AAC1F,CAAC;AAOK,SAAU,oBAAoB,CAAC,KAAgC,EAAA;AACnE,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA;QACE,KAAK,CAAA,aAAA,CAAA,IAAA,EAAA,IAAA,EAAA,KAAK,CAAC,IAAI,CAAM;AACrB,QAAA,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,IAAA,EAAK,KAAK,CAAC,QAAQ,CAAM,CACxB,EACH;AACJ;;;;"}
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { getErrorsForInput } from '../utils/outcomes.mjs';
|
|
4
4
|
|
|
5
5
|
function FormSection(props) {
|
|
6
|
-
return (React.createElement(Input.Wrapper, { id: props.htmlFor, label: props.title, description: props.description, error: getErrorsForInput(props.outcome, props.htmlFor) }, props.children));
|
|
6
|
+
return (React.createElement(Input.Wrapper, { id: props.htmlFor, label: props.title, description: props.description, withAsterisk: props.withAsterisk, error: getErrorsForInput(props.outcome, props.htmlFor) }, props.children));
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export { FormSection };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormSection.mjs","sources":["../../../src/FormSection/FormSection.tsx"],"sourcesContent":["import { Input } from '@mantine/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { getErrorsForInput } from '../utils/outcomes';\n\nexport interface FormSectionProps {\n title?: string;\n htmlFor?: string;\n description?: string;\n outcome?: OperationOutcome;\n children?: React.ReactNode;\n}\n\nexport function FormSection(props: FormSectionProps): JSX.Element {\n return (\n <Input.Wrapper\n id={props.htmlFor}\n label={props.title}\n description={props.description}\n error={getErrorsForInput(props.outcome, props.htmlFor)}\n >\n {props.children}\n </Input.Wrapper>\n );\n}\n"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"FormSection.mjs","sources":["../../../src/FormSection/FormSection.tsx"],"sourcesContent":["import { Input } from '@mantine/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { getErrorsForInput } from '../utils/outcomes';\n\nexport interface FormSectionProps {\n title?: string;\n htmlFor?: string;\n description?: string;\n withAsterisk?: boolean;\n outcome?: OperationOutcome;\n children?: React.ReactNode;\n}\n\nexport function FormSection(props: FormSectionProps): JSX.Element {\n return (\n <Input.Wrapper\n id={props.htmlFor}\n label={props.title}\n description={props.description}\n withAsterisk={props.withAsterisk}\n error={getErrorsForInput(props.outcome, props.htmlFor)}\n >\n {props.children}\n </Input.Wrapper>\n );\n}\n"],"names":[],"mappings":";;;;AAcM,SAAU,WAAW,CAAC,KAAuB,EAAA;IACjD,QACE,oBAAC,KAAK,CAAC,OAAO,EACZ,EAAA,EAAE,EAAE,KAAK,CAAC,OAAO,EACjB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,EAAA,EAErD,KAAK,CAAC,QAAQ,CACD,EAChB;AACJ;;;;"}
|
package/dist/esm/Panel/Panel.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import React from 'react';
|
|
|
4
4
|
const useStyles = createStyles((theme, { width, fill }) => ({
|
|
5
5
|
paper: {
|
|
6
6
|
maxWidth: width,
|
|
7
|
-
margin: `${theme.spacing.xl}
|
|
7
|
+
margin: `${theme.spacing.xl} auto`,
|
|
8
8
|
padding: fill ? 0 : theme.spacing.md,
|
|
9
9
|
'@media (max-width: 800px)': {
|
|
10
10
|
padding: fill ? 0 : 8,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Panel.mjs","sources":["../../../src/Panel/Panel.tsx"],"sourcesContent":["import { createStyles, Paper, PaperProps, useComponentDefaultProps } from '@mantine/core';\nimport React from 'react';\n\nexport interface PanelStylesParams {\n width?: number;\n fill?: boolean;\n}\n\nconst useStyles = createStyles((theme, { width, fill }: PanelStylesParams) => ({\n paper: {\n maxWidth: width,\n margin: `${theme.spacing.xl}
|
|
1
|
+
{"version":3,"file":"Panel.mjs","sources":["../../../src/Panel/Panel.tsx"],"sourcesContent":["import { createStyles, Paper, PaperProps, useComponentDefaultProps } from '@mantine/core';\nimport React from 'react';\n\nexport interface PanelStylesParams {\n width?: number;\n fill?: boolean;\n}\n\nconst useStyles = createStyles((theme, { width, fill }: PanelStylesParams) => ({\n paper: {\n maxWidth: width,\n margin: `${theme.spacing.xl} auto`,\n padding: fill ? 0 : theme.spacing.md,\n '@media (max-width: 800px)': {\n padding: fill ? 0 : 8,\n },\n '& img': {\n width: '100%',\n maxWidth: '100%',\n },\n '& video': {\n width: '100%',\n maxWidth: '100%',\n },\n },\n}));\n\nexport interface PanelProps extends PaperProps {\n width?: number;\n fill?: boolean;\n}\n\nconst defaultProps: Partial<PanelProps> = {\n shadow: 'xs',\n radius: 'md',\n withBorder: true,\n};\n\nexport function Panel(props: PanelProps): JSX.Element {\n const { className, children, width, fill, unstyled, ...others } = useComponentDefaultProps(\n 'Panel',\n defaultProps,\n props\n );\n const { classes, cx } = useStyles({ width, fill }, { name: 'Panel', unstyled });\n\n return (\n <Paper className={cx(classes.paper, className)} {...others}>\n {children}\n </Paper>\n );\n}\n"],"names":[],"mappings":";;;AAQA,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAqB,MAAM;AAC7E,IAAA,KAAK,EAAE;AACL,QAAA,QAAQ,EAAE,KAAK;AACf,QAAA,MAAM,EAAE,CAAG,EAAA,KAAK,CAAC,OAAO,CAAC,EAAE,CAAO,KAAA,CAAA;AAClC,QAAA,OAAO,EAAE,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,EAAE;AACpC,QAAA,2BAA2B,EAAE;YAC3B,OAAO,EAAE,IAAI,GAAG,CAAC,GAAG,CAAC;AACtB,SAAA;AACD,QAAA,OAAO,EAAE;AACP,YAAA,KAAK,EAAE,MAAM;AACb,YAAA,QAAQ,EAAE,MAAM;AACjB,SAAA;AACD,QAAA,SAAS,EAAE;AACT,YAAA,KAAK,EAAE,MAAM;AACb,YAAA,QAAQ,EAAE,MAAM;AACjB,SAAA;AACF,KAAA;AACF,CAAA,CAAC,CAAC,CAAC;AAOJ,MAAM,YAAY,GAAwB;AACxC,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,UAAU,EAAE,IAAI;CACjB,CAAC;AAEI,SAAU,KAAK,CAAC,KAAiB,EAAA;IACrC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,GAAG,wBAAwB,CACxF,OAAO,EACP,YAAY,EACZ,KAAK,CACN,CAAC;IACF,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;IAEhF,QACE,oBAAC,KAAK,EAAA,EAAC,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,EAAM,GAAA,MAAM,IACvD,QAAQ,CACH,EACR;AACJ;;;;"}
|
|
@@ -204,7 +204,7 @@ function QuestionnaireChoiceRadioInput(props) {
|
|
|
204
204
|
options.push([optionName, optionValue]);
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
return (React.createElement(Radio.Group, { name: name,
|
|
207
|
+
return (React.createElement(Radio.Group, { name: name, defaultValue: defaultValue, onChange: (newValue) => {
|
|
208
208
|
const option = options.find((option) => option[0] === newValue);
|
|
209
209
|
if (option) {
|
|
210
210
|
const optionValue = option[1];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuestionnaireForm.mjs","sources":["../../../src/QuestionnaireForm/QuestionnaireForm.tsx"],"sourcesContent":["import { Button, Checkbox, Group, NativeSelect, Radio, Stack, Textarea, TextInput, Title } from '@mantine/core';\nimport {\n capitalize,\n createReference,\n deepEquals,\n getQuestionnaireAnswers,\n getReferenceString,\n getTypedPropertyValue,\n globalSchema,\n IndexedStructureDefinition,\n ProfileResource,\n PropertyType,\n stringify,\n TypedValue,\n} from '@medplum/core';\nimport {\n Questionnaire,\n QuestionnaireItem,\n QuestionnaireItemAnswerOption,\n QuestionnaireItemInitial,\n QuestionnaireResponse,\n QuestionnaireResponseItem,\n QuestionnaireResponseItemAnswer,\n Reference,\n} from '@medplum/fhirtypes';\nimport React, { ChangeEvent, useEffect, useState } from 'react';\nimport { AttachmentInput } from '../AttachmentInput/AttachmentInput';\nimport { CheckboxFormSection } from '../CheckboxFormSection/CheckboxFormSection';\nimport { DateTimeInput } from '../DateTimeInput/DateTimeInput';\nimport { Form } from '../Form/Form';\nimport { FormSection } from '../FormSection/FormSection';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { QuantityInput } from '../QuantityInput/QuantityInput';\nimport { ReferenceInput } from '../ReferenceInput/ReferenceInput';\nimport { ResourcePropertyDisplay } from '../ResourcePropertyDisplay/ResourcePropertyDisplay';\nimport { useResource } from '../useResource/useResource';\nimport { QuestionnaireItemType } from '../utils/questionnaire';\n\nexport interface QuestionnaireFormProps {\n questionnaire: Questionnaire | Reference<Questionnaire>;\n subject?: Reference;\n submitButtonText?: string;\n onSubmit: (response: QuestionnaireResponse) => void;\n}\n\nexport function QuestionnaireForm(props: QuestionnaireFormProps): JSX.Element | null {\n const medplum = useMedplum();\n const source = medplum.getProfile();\n const [schema, setSchema] = useState<IndexedStructureDefinition | undefined>();\n const questionnaire = useResource(props.questionnaire);\n const [response, setResponse] = useState<QuestionnaireResponse | undefined>();\n const [answers, setAnswers] = useState<Record<string, QuestionnaireResponseItemAnswer>>({});\n\n useEffect(() => {\n medplum\n .requestSchema('Questionnaire')\n .then(() => medplum.requestSchema('QuestionnaireResponse'))\n .then(setSchema)\n .catch(console.log);\n }, [medplum]);\n\n useEffect(() => {\n setResponse(questionnaire ? buildInitialResponse(questionnaire) : undefined);\n }, [questionnaire]);\n\n function setItems(newResponseItems: QuestionnaireResponseItem[]): void {\n const newResponse: QuestionnaireResponse = {\n resourceType: 'QuestionnaireResponse',\n item: newResponseItems,\n };\n setResponse(newResponse);\n setAnswers(getQuestionnaireAnswers(newResponse));\n }\n\n if (!schema || !questionnaire) {\n return null;\n }\n\n return (\n <Form\n testid=\"questionnaire-form\"\n onSubmit={() => {\n if (props.onSubmit && response) {\n props.onSubmit({\n ...response,\n questionnaire: getReferenceString(questionnaire),\n subject: props.subject,\n source: createReference(source as ProfileResource),\n authored: new Date().toISOString(),\n status: 'completed',\n });\n }\n }}\n >\n {questionnaire.title && <Title>{questionnaire.title}</Title>}\n {questionnaire.item && (\n <QuestionnaireFormItemArray items={questionnaire.item} answers={answers} onChange={setItems} />\n )}\n <Group position=\"right\" mt=\"xl\">\n <Button type=\"submit\">{props.submitButtonText || 'OK'}</Button>\n </Group>\n </Form>\n );\n}\n\ninterface QuestionnaireFormItemArrayProps {\n items: QuestionnaireItem[];\n answers: Record<string, QuestionnaireResponseItemAnswer>;\n onChange: (newResponseItems: QuestionnaireResponseItem[]) => void;\n}\n\nfunction QuestionnaireFormItemArray(props: QuestionnaireFormItemArrayProps): JSX.Element {\n const [responseItems, setResponseItems] = useState<QuestionnaireResponseItem[]>(\n buildInitialResponseItems(props.items)\n );\n\n function setResponseItem(index: number, newResponseItem: QuestionnaireResponseItem): void {\n const newResponseItems = responseItems.slice();\n newResponseItems[index] = newResponseItem;\n setResponseItems(newResponseItems);\n props.onChange(newResponseItems);\n }\n\n return (\n <Stack>\n {props.items.map((item, index) => {\n if (!isQuestionEnabled(item, props.answers)) {\n return null;\n }\n if (item.type === QuestionnaireItemType.display) {\n return <p key={item.linkId}>{item.text}</p>;\n }\n if (item.type === QuestionnaireItemType.group) {\n return (\n <QuestionnaireFormItem\n key={item.linkId}\n item={item}\n answers={props.answers}\n onChange={(newResponseItem) => setResponseItem(index, newResponseItem)}\n />\n );\n }\n if (item.type === QuestionnaireItemType.boolean) {\n const initial = item.initial && item.initial.length > 0 ? item.initial[0] : undefined;\n return (\n <CheckboxFormSection key={item.linkId} title={item.text} htmlFor={item.linkId}>\n <Checkbox\n id={item.linkId}\n name={item.linkId}\n defaultChecked={initial?.valueBoolean}\n onChange={(e) =>\n setResponseItem(index, {\n linkId: item.linkId,\n text: item.text,\n answer: [{ valueBoolean: e.currentTarget.checked }],\n })\n }\n />\n </CheckboxFormSection>\n );\n }\n return (\n <FormSection key={item.linkId} htmlFor={item.linkId} title={item.text || ''}>\n <QuestionnaireFormItem\n item={item}\n answers={props.answers}\n onChange={(newResponseItem) => setResponseItem(index, newResponseItem)}\n />\n </FormSection>\n );\n })}\n </Stack>\n );\n}\n\nexport interface QuestionnaireFormItemProps {\n item: QuestionnaireItem;\n answers: Record<string, QuestionnaireResponseItemAnswer>;\n onChange: (newResponseItem: QuestionnaireResponseItem) => void;\n}\n\nexport function QuestionnaireFormItem(props: QuestionnaireFormItemProps): JSX.Element | null {\n const item = props.item;\n\n const type = item.type as QuestionnaireItemType;\n if (!type) {\n return null;\n }\n\n const name = item.linkId;\n if (!name) {\n return null;\n }\n\n const initial = item.initial && item.initial.length > 0 ? item.initial[0] : undefined;\n\n function onChangeItem(newResponseItems: QuestionnaireResponseItem[]): void {\n props.onChange({\n linkId: item.linkId,\n text: item.text,\n item: newResponseItems,\n });\n }\n\n function onChangeAnswer(newResponseAnswer: QuestionnaireResponseItemAnswer): void {\n props.onChange({\n linkId: item.linkId,\n text: item.text,\n answer: [newResponseAnswer],\n });\n }\n\n switch (type) {\n case QuestionnaireItemType.group:\n return (\n <div>\n <h3>{item.text}</h3>\n {item.item && (\n <QuestionnaireFormItemArray items={item.item} answers={props.answers} onChange={onChangeItem} />\n )}\n </div>\n );\n case QuestionnaireItemType.boolean:\n return (\n <Checkbox\n id={name}\n name={name}\n defaultChecked={initial?.valueBoolean}\n onChange={(e) => onChangeAnswer({ valueBoolean: e.currentTarget.checked })}\n />\n );\n case QuestionnaireItemType.decimal:\n return (\n <TextInput\n type=\"number\"\n step=\"any\"\n id={name}\n name={name}\n defaultValue={initial?.valueDecimal}\n onChange={(e) => onChangeAnswer({ valueDecimal: e.currentTarget.valueAsNumber })}\n />\n );\n case QuestionnaireItemType.integer:\n return (\n <TextInput\n type=\"number\"\n step={1}\n id={name}\n name={name}\n defaultValue={initial?.valueInteger}\n onChange={(e) => onChangeAnswer({ valueInteger: e.currentTarget.valueAsNumber })}\n />\n );\n case QuestionnaireItemType.date:\n return (\n <TextInput\n type=\"date\"\n id={name}\n name={name}\n defaultValue={initial?.valueDate}\n onChange={(e) => onChangeAnswer({ valueDate: e.currentTarget.value })}\n />\n );\n case QuestionnaireItemType.dateTime:\n return (\n <DateTimeInput\n name={name}\n defaultValue={initial?.valueDateTime}\n onChange={(newValue: string) => onChangeAnswer({ valueDateTime: newValue })}\n />\n );\n case QuestionnaireItemType.time:\n return (\n <TextInput\n type=\"time\"\n id={name}\n name={name}\n defaultValue={initial?.valueTime}\n onChange={(e) => onChangeAnswer({ valueTime: e.currentTarget.value })}\n />\n );\n case QuestionnaireItemType.string:\n case QuestionnaireItemType.url:\n return (\n <TextInput\n id={name}\n name={name}\n defaultValue={initial?.valueString}\n onChange={(e) => onChangeAnswer({ valueString: e.currentTarget.value })}\n />\n );\n case QuestionnaireItemType.text:\n return (\n <Textarea\n id={name}\n name={name}\n defaultValue={initial?.valueString}\n onChange={(e) => onChangeAnswer({ valueString: e.currentTarget.value })}\n />\n );\n case QuestionnaireItemType.attachment:\n return (\n <AttachmentInput\n name={name}\n defaultValue={initial?.valueAttachment}\n onChange={(newValue) => onChangeAnswer({ valueAttachment: newValue })}\n />\n );\n case QuestionnaireItemType.reference:\n return (\n <ReferenceInput\n name={name}\n defaultValue={initial?.valueReference}\n onChange={(newValue) => onChangeAnswer({ valueReference: newValue })}\n />\n );\n case QuestionnaireItemType.quantity:\n return (\n <QuantityInput\n name={name}\n defaultValue={initial?.valueQuantity}\n onChange={(newValue) => onChangeAnswer({ valueQuantity: newValue })}\n disableWheel\n />\n );\n case QuestionnaireItemType.choice:\n case QuestionnaireItemType.openChoice:\n if (isDropDownChoice(item)) {\n return (\n <QuestionnaireChoiceDropDownInput name={name} item={item} initial={initial} onChangeAnswer={onChangeAnswer} />\n );\n } else {\n return (\n <QuestionnaireChoiceRadioInput name={name} item={item} initial={initial} onChangeAnswer={onChangeAnswer} />\n );\n }\n }\n\n return null;\n}\n\ninterface QuestionnaireChoiceInputProps {\n name: string;\n item: QuestionnaireItem;\n initial: QuestionnaireItemInitial | undefined;\n onChangeAnswer: (newResponseAnswer: QuestionnaireResponseItemAnswer) => void;\n}\n\nfunction QuestionnaireChoiceDropDownInput(props: QuestionnaireChoiceInputProps): JSX.Element {\n const { name, item, initial } = props;\n const initialValue = getTypedPropertyValue({ type: 'QuestionnaireItemInitial', value: initial }, 'value') as\n | TypedValue\n | undefined;\n\n const data = [''];\n if (item.answerOption) {\n for (const option of item.answerOption) {\n const optionValue = getTypedPropertyValue(\n { type: 'QuestionnaireItemAnswerOption', value: option },\n 'value'\n ) as TypedValue;\n data.push(typedValueToString(optionValue) as string);\n }\n }\n\n return (\n <NativeSelect\n id={name}\n name={name}\n onChange={(e: ChangeEvent<HTMLSelectElement>) => {\n const index = e.currentTarget.selectedIndex;\n if (index === 0) {\n props.onChangeAnswer({});\n return;\n }\n const option = (item.answerOption as QuestionnaireItemAnswerOption[])[index - 1];\n const optionValue = getTypedPropertyValue(\n { type: 'QuestionnaireItemAnswerOption', value: option },\n 'value'\n ) as TypedValue;\n const propertyName = 'value' + capitalize(optionValue.type);\n props.onChangeAnswer({ [propertyName]: optionValue.value });\n }}\n defaultValue={typedValueToString(initialValue)}\n data={data}\n />\n );\n}\n\nfunction typedValueToString(typedValue: TypedValue | undefined): string | undefined {\n if (!typedValue) {\n return undefined;\n }\n if (typedValue.type === 'CodeableConcept') {\n return typedValue.value.coding[0].display;\n }\n if (typedValue.type === 'Coding') {\n return typedValue.value.display;\n }\n return typedValue.value.toString();\n}\n\nfunction QuestionnaireChoiceRadioInput(props: QuestionnaireChoiceInputProps): JSX.Element {\n const { name, item, initial, onChangeAnswer } = props;\n const valueElementDefinition = globalSchema.types['QuestionnaireItemAnswerOption'].properties['value[x]'];\n const initialValue = getTypedPropertyValue({ type: 'QuestionnaireItemInitial', value: initial }, 'value') as\n | TypedValue\n | undefined;\n\n const options: [string, TypedValue][] = [];\n let defaultValue = undefined;\n if (item.answerOption) {\n for (let i = 0; i < item.answerOption.length; i++) {\n const option = item.answerOption[i];\n const optionName = `${name}-option-${i}`;\n const optionValue = getTypedPropertyValue(\n { type: 'QuestionnaireItemAnswerOption', value: option },\n 'value'\n ) as TypedValue;\n if (initialValue && stringify(optionValue) === stringify(initialValue)) {\n defaultValue = optionName;\n }\n options.push([optionName, optionValue]);\n }\n }\n\n return (\n <Radio.Group\n name={name}\n orientation=\"vertical\"\n defaultValue={defaultValue}\n onChange={(newValue) => {\n const option = options.find((option) => option[0] === newValue);\n if (option) {\n const optionValue = option[1];\n const propertyName = 'value' + capitalize(optionValue.type);\n onChangeAnswer({ [propertyName]: optionValue.value });\n }\n }}\n >\n {options.map(([optionName, optionValue]) => (\n <Radio\n key={optionName}\n id={optionName}\n value={optionName}\n label={\n <ResourcePropertyDisplay\n property={valueElementDefinition}\n propertyType={optionValue.type as PropertyType}\n value={optionValue.value}\n />\n }\n />\n ))}\n </Radio.Group>\n );\n}\n\nfunction buildInitialResponse(questionnaire: Questionnaire): QuestionnaireResponse {\n const response: QuestionnaireResponse = {\n resourceType: 'QuestionnaireResponse',\n questionnaire: getReferenceString(questionnaire),\n item: buildInitialResponseItems(questionnaire.item),\n };\n\n return response;\n}\n\nfunction buildInitialResponseItems(items: QuestionnaireItem[] | undefined): QuestionnaireResponseItem[] {\n return items?.map(buildInitialResponseItem) ?? [];\n}\n\nfunction buildInitialResponseItem(item: QuestionnaireItem): QuestionnaireResponseItem {\n return {\n linkId: item.linkId,\n text: item.text,\n item: buildInitialResponseItems(item.item),\n answer: item.initial?.map(buildInitialResponseAnswer) ?? [],\n };\n}\n\nfunction buildInitialResponseAnswer(answer: QuestionnaireItemInitial): QuestionnaireResponseItemAnswer {\n // This works because QuestionnaireItemInitial and QuestionnaireResponseItemAnswer\n // have the same properties.\n return { ...answer };\n}\n\nfunction isDropDownChoice(item: QuestionnaireItem): boolean {\n return !!item.extension?.some(\n (e) =>\n e.url === 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl' &&\n e.valueCodeableConcept?.coding?.[0]?.code === 'drop-down'\n );\n}\n\nexport function isQuestionEnabled(\n item: QuestionnaireItem,\n answers: Record<string, QuestionnaireResponseItemAnswer>\n): boolean {\n if (!item.enableWhen) {\n return true;\n }\n const enableBehavior = item.enableBehavior || 'any';\n for (const enableWhen of item.enableWhen) {\n const expectedAnswer = getTypedPropertyValue(\n {\n type: 'QuestionnaireItemEnableWhen',\n value: enableWhen,\n },\n 'answer[x]'\n );\n const actualAnswer = getTypedPropertyValue(\n {\n type: 'QuestionnaireResponseItemAnswer',\n value: answers[enableWhen.question as string],\n },\n 'value[x]'\n );\n const match = deepEquals(expectedAnswer, actualAnswer);\n if (enableBehavior === 'any' && match) {\n return true;\n }\n if (enableBehavior === 'all' && !match) {\n return false;\n }\n }\n if (enableBehavior === 'any') {\n return false;\n } else {\n return true;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA6CM,SAAU,iBAAiB,CAAC,KAA6B,EAAA;AAC7D,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;AAC7B,IAAA,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IACpC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,EAA0C,CAAC;IAC/E,MAAM,aAAa,GAAG,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IACvD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,EAAqC,CAAC;IAC9E,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAkD,EAAE,CAAC,CAAC;IAE5F,SAAS,CAAC,MAAK;QACb,OAAO;aACJ,aAAa,CAAC,eAAe,CAAC;aAC9B,IAAI,CAAC,MAAM,OAAO,CAAC,aAAa,CAAC,uBAAuB,CAAC,CAAC;aAC1D,IAAI,CAAC,SAAS,CAAC;AACf,aAAA,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AACxB,KAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,SAAS,CAAC,MAAK;AACb,QAAA,WAAW,CAAC,aAAa,GAAG,oBAAoB,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC,CAAC;AAC/E,KAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,SAAS,QAAQ,CAAC,gBAA6C,EAAA;AAC7D,QAAA,MAAM,WAAW,GAA0B;AACzC,YAAA,YAAY,EAAE,uBA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AC;AACJ,CAAC;AAEe,SAAA,iBAAiB,CAC/B,IAAuB,EACvB,OAAwD,EAAA;AAExD,IAAA,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;AACpB,QAAA,OAAO,IAAI,CAAC;AACb,KAAA;AACD,IAAA,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,IAAI,KAAK,CAAC;AACpD,IAAA,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,UAAU,EAAE;QACxC,MAAM,cAAc,GAAG,qBAAqB,CAC1C;AACE,YAAA,IAAI,EAAE,6BAA6B;AACnC,YAAA,KAAK,EAAE,UAAU;SAClB,EACD,WAAW,CACZ,CAAC;QACF,MAAM,YAAY,GAAG,qBAAqB,CACxC;AACE,YAAA,IAAI,EAAE,iCAAiC;AACvC,YAAA,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,QAAkB,CAAC;SAC9C,EACD,UAAU,CACX,CAAC;QACF,MAAM,KAAK,GAAG,UAAU,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;AACvD,QAAA,IAAI,cAAc,KAAK,KAAK,IAAI,KAAK,EAAE;AACrC,YAAA,OAAO,IAAI,CAAC;AACb,SAAA;AACD,QAAA,IAAI,cAAc,KAAK,KAAK,IAAI,CAAC,KAAK,EAAE;AACtC,YAAA,OAAO,KAAK,CAAC;AACd,SAAA;AACF,KAAA;IACD,IAAI,cAAc,KAAK,KAAK,EAAE;AAC5B,QAAA,OAAO,KAAK,CAAC;AACd,KAAA;AAAM,SAAA;AACL,QAAA,OAAO,IAAI,CAAC;AACb,KAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"QuestionnaireForm.mjs","sources":["../../../src/QuestionnaireForm/QuestionnaireForm.tsx"],"sourcesContent":["import { Button, Checkbox, Group, NativeSelect, Radio, Stack, Textarea, TextInput, Title } from '@mantine/core';\nimport {\n capitalize,\n createReference,\n deepEquals,\n getQuestionnaireAnswers,\n getReferenceString,\n getTypedPropertyValue,\n globalSchema,\n IndexedStructureDefinition,\n ProfileResource,\n PropertyType,\n stringify,\n TypedValue,\n} from '@medplum/core';\nimport {\n Questionnaire,\n QuestionnaireItem,\n QuestionnaireItemAnswerOption,\n QuestionnaireItemInitial,\n QuestionnaireResponse,\n QuestionnaireResponseItem,\n QuestionnaireResponseItemAnswer,\n Reference,\n} from '@medplum/fhirtypes';\nimport React, { ChangeEvent, useEffect, useState } from 'react';\nimport { AttachmentInput } from '../AttachmentInput/AttachmentInput';\nimport { CheckboxFormSection } from '../CheckboxFormSection/CheckboxFormSection';\nimport { DateTimeInput } from '../DateTimeInput/DateTimeInput';\nimport { Form } from '../Form/Form';\nimport { FormSection } from '../FormSection/FormSection';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { QuantityInput } from '../QuantityInput/QuantityInput';\nimport { ReferenceInput } from '../ReferenceInput/ReferenceInput';\nimport { ResourcePropertyDisplay } from '../ResourcePropertyDisplay/ResourcePropertyDisplay';\nimport { useResource } from '../useResource/useResource';\nimport { QuestionnaireItemType } from '../utils/questionnaire';\n\nexport interface QuestionnaireFormProps {\n questionnaire: Questionnaire | Reference<Questionnaire>;\n subject?: Reference;\n submitButtonText?: string;\n onSubmit: (response: QuestionnaireResponse) => void;\n}\n\nexport function QuestionnaireForm(props: QuestionnaireFormProps): JSX.Element | null {\n const medplum = useMedplum();\n const source = medplum.getProfile();\n const [schema, setSchema] = useState<IndexedStructureDefinition | undefined>();\n const questionnaire = useResource(props.questionnaire);\n const [response, setResponse] = useState<QuestionnaireResponse | undefined>();\n const [answers, setAnswers] = useState<Record<string, QuestionnaireResponseItemAnswer>>({});\n\n useEffect(() => {\n medplum\n .requestSchema('Questionnaire')\n .then(() => medplum.requestSchema('QuestionnaireResponse'))\n .then(setSchema)\n .catch(console.log);\n }, [medplum]);\n\n useEffect(() => {\n setResponse(questionnaire ? buildInitialResponse(questionnaire) : undefined);\n }, [questionnaire]);\n\n function setItems(newResponseItems: QuestionnaireResponseItem[]): void {\n const newResponse: QuestionnaireResponse = {\n resourceType: 'QuestionnaireResponse',\n item: newResponseItems,\n };\n setResponse(newResponse);\n setAnswers(getQuestionnaireAnswers(newResponse));\n }\n\n if (!schema || !questionnaire) {\n return null;\n }\n\n return (\n <Form\n testid=\"questionnaire-form\"\n onSubmit={() => {\n if (props.onSubmit && response) {\n props.onSubmit({\n ...response,\n questionnaire: getReferenceString(questionnaire),\n subject: props.subject,\n source: createReference(source as ProfileResource),\n authored: new Date().toISOString(),\n status: 'completed',\n });\n }\n }}\n >\n {questionnaire.title && <Title>{questionnaire.title}</Title>}\n {questionnaire.item && (\n <QuestionnaireFormItemArray items={questionnaire.item} answers={answers} onChange={setItems} />\n )}\n <Group position=\"right\" mt=\"xl\">\n <Button type=\"submit\">{props.submitButtonText || 'OK'}</Button>\n </Group>\n </Form>\n );\n}\n\ninterface QuestionnaireFormItemArrayProps {\n items: QuestionnaireItem[];\n answers: Record<string, QuestionnaireResponseItemAnswer>;\n onChange: (newResponseItems: QuestionnaireResponseItem[]) => void;\n}\n\nfunction QuestionnaireFormItemArray(props: QuestionnaireFormItemArrayProps): JSX.Element {\n const [responseItems, setResponseItems] = useState<QuestionnaireResponseItem[]>(\n buildInitialResponseItems(props.items)\n );\n\n function setResponseItem(index: number, newResponseItem: QuestionnaireResponseItem): void {\n const newResponseItems = responseItems.slice();\n newResponseItems[index] = newResponseItem;\n setResponseItems(newResponseItems);\n props.onChange(newResponseItems);\n }\n\n return (\n <Stack>\n {props.items.map((item, index) => {\n if (!isQuestionEnabled(item, props.answers)) {\n return null;\n }\n if (item.type === QuestionnaireItemType.display) {\n return <p key={item.linkId}>{item.text}</p>;\n }\n if (item.type === QuestionnaireItemType.group) {\n return (\n <QuestionnaireFormItem\n key={item.linkId}\n item={item}\n answers={props.answers}\n onChange={(newResponseItem) => setResponseItem(index, newResponseItem)}\n />\n );\n }\n if (item.type === QuestionnaireItemType.boolean) {\n const initial = item.initial && item.initial.length > 0 ? item.initial[0] : undefined;\n return (\n <CheckboxFormSection key={item.linkId} title={item.text} htmlFor={item.linkId}>\n <Checkbox\n id={item.linkId}\n name={item.linkId}\n defaultChecked={initial?.valueBoolean}\n onChange={(e) =>\n setResponseItem(index, {\n linkId: item.linkId,\n text: item.text,\n answer: [{ valueBoolean: e.currentTarget.checked }],\n })\n }\n />\n </CheckboxFormSection>\n );\n }\n return (\n <FormSection key={item.linkId} htmlFor={item.linkId} title={item.text || ''}>\n <QuestionnaireFormItem\n item={item}\n answers={props.answers}\n onChange={(newResponseItem) => setResponseItem(index, newResponseItem)}\n />\n </FormSection>\n );\n })}\n </Stack>\n );\n}\n\nexport interface QuestionnaireFormItemProps {\n item: QuestionnaireItem;\n answers: Record<string, QuestionnaireResponseItemAnswer>;\n onChange: (newResponseItem: QuestionnaireResponseItem) => void;\n}\n\nexport function QuestionnaireFormItem(props: QuestionnaireFormItemProps): JSX.Element | null {\n const item = props.item;\n\n const type = item.type as QuestionnaireItemType;\n if (!type) {\n return null;\n }\n\n const name = item.linkId;\n if (!name) {\n return null;\n }\n\n const initial = item.initial && item.initial.length > 0 ? item.initial[0] : undefined;\n\n function onChangeItem(newResponseItems: QuestionnaireResponseItem[]): void {\n props.onChange({\n linkId: item.linkId,\n text: item.text,\n item: newResponseItems,\n });\n }\n\n function onChangeAnswer(newResponseAnswer: QuestionnaireResponseItemAnswer): void {\n props.onChange({\n linkId: item.linkId,\n text: item.text,\n answer: [newResponseAnswer],\n });\n }\n\n switch (type) {\n case QuestionnaireItemType.group:\n return (\n <div>\n <h3>{item.text}</h3>\n {item.item && (\n <QuestionnaireFormItemArray items={item.item} answers={props.answers} onChange={onChangeItem} />\n )}\n </div>\n );\n case QuestionnaireItemType.boolean:\n return (\n <Checkbox\n id={name}\n name={name}\n defaultChecked={initial?.valueBoolean}\n onChange={(e) => onChangeAnswer({ valueBoolean: e.currentTarget.checked })}\n />\n );\n case QuestionnaireItemType.decimal:\n return (\n <TextInput\n type=\"number\"\n step=\"any\"\n id={name}\n name={name}\n defaultValue={initial?.valueDecimal}\n onChange={(e) => onChangeAnswer({ valueDecimal: e.currentTarget.valueAsNumber })}\n />\n );\n case QuestionnaireItemType.integer:\n return (\n <TextInput\n type=\"number\"\n step={1}\n id={name}\n name={name}\n defaultValue={initial?.valueInteger}\n onChange={(e) => onChangeAnswer({ valueInteger: e.currentTarget.valueAsNumber })}\n />\n );\n case QuestionnaireItemType.date:\n return (\n <TextInput\n type=\"date\"\n id={name}\n name={name}\n defaultValue={initial?.valueDate}\n onChange={(e) => onChangeAnswer({ valueDate: e.currentTarget.value })}\n />\n );\n case QuestionnaireItemType.dateTime:\n return (\n <DateTimeInput\n name={name}\n defaultValue={initial?.valueDateTime}\n onChange={(newValue: string) => onChangeAnswer({ valueDateTime: newValue })}\n />\n );\n case QuestionnaireItemType.time:\n return (\n <TextInput\n type=\"time\"\n id={name}\n name={name}\n defaultValue={initial?.valueTime}\n onChange={(e) => onChangeAnswer({ valueTime: e.currentTarget.value })}\n />\n );\n case QuestionnaireItemType.string:\n case QuestionnaireItemType.url:\n return (\n <TextInput\n id={name}\n name={name}\n defaultValue={initial?.valueString}\n onChange={(e) => onChangeAnswer({ valueString: e.currentTarget.value })}\n />\n );\n case QuestionnaireItemType.text:\n return (\n <Textarea\n id={name}\n name={name}\n defaultValue={initial?.valueString}\n onChange={(e) => onChangeAnswer({ valueString: e.currentTarget.value })}\n />\n );\n case QuestionnaireItemType.attachment:\n return (\n <AttachmentInput\n name={name}\n defaultValue={initial?.valueAttachment}\n onChange={(newValue) => onChangeAnswer({ valueAttachment: newValue })}\n />\n );\n case QuestionnaireItemType.reference:\n return (\n <ReferenceInput\n name={name}\n defaultValue={initial?.valueReference}\n onChange={(newValue) => onChangeAnswer({ valueReference: newValue })}\n />\n );\n case QuestionnaireItemType.quantity:\n return (\n <QuantityInput\n name={name}\n defaultValue={initial?.valueQuantity}\n onChange={(newValue) => onChangeAnswer({ valueQuantity: newValue })}\n disableWheel\n />\n );\n case QuestionnaireItemType.choice:\n case QuestionnaireItemType.openChoice:\n if (isDropDownChoice(item)) {\n return (\n <QuestionnaireChoiceDropDownInput name={name} item={item} initial={initial} onChangeAnswer={onChangeAnswer} />\n );\n } else {\n return (\n <QuestionnaireChoiceRadioInput name={name} item={item} initial={initial} onChangeAnswer={onChangeAnswer} />\n );\n }\n }\n\n return null;\n}\n\ninterface QuestionnaireChoiceInputProps {\n name: string;\n item: QuestionnaireItem;\n initial: QuestionnaireItemInitial | undefined;\n onChangeAnswer: (newResponseAnswer: QuestionnaireResponseItemAnswer) => void;\n}\n\nfunction QuestionnaireChoiceDropDownInput(props: QuestionnaireChoiceInputProps): JSX.Element {\n const { name, item, initial } = props;\n const initialValue = getTypedPropertyValue({ type: 'QuestionnaireItemInitial', value: initial }, 'value') as\n | TypedValue\n | undefined;\n\n const data = [''];\n if (item.answerOption) {\n for (const option of item.answerOption) {\n const optionValue = getTypedPropertyValue(\n { type: 'QuestionnaireItemAnswerOption', value: option },\n 'value'\n ) as TypedValue;\n data.push(typedValueToString(optionValue) as string);\n }\n }\n\n return (\n <NativeSelect\n id={name}\n name={name}\n onChange={(e: ChangeEvent<HTMLSelectElement>) => {\n const index = e.currentTarget.selectedIndex;\n if (index === 0) {\n props.onChangeAnswer({});\n return;\n }\n const option = (item.answerOption as QuestionnaireItemAnswerOption[])[index - 1];\n const optionValue = getTypedPropertyValue(\n { type: 'QuestionnaireItemAnswerOption', value: option },\n 'value'\n ) as TypedValue;\n const propertyName = 'value' + capitalize(optionValue.type);\n props.onChangeAnswer({ [propertyName]: optionValue.value });\n }}\n defaultValue={typedValueToString(initialValue)}\n data={data}\n />\n );\n}\n\nfunction typedValueToString(typedValue: TypedValue | undefined): string | undefined {\n if (!typedValue) {\n return undefined;\n }\n if (typedValue.type === 'CodeableConcept') {\n return typedValue.value.coding[0].display;\n }\n if (typedValue.type === 'Coding') {\n return typedValue.value.display;\n }\n return typedValue.value.toString();\n}\n\nfunction QuestionnaireChoiceRadioInput(props: QuestionnaireChoiceInputProps): JSX.Element {\n const { name, item, initial, onChangeAnswer } = props;\n const valueElementDefinition = globalSchema.types['QuestionnaireItemAnswerOption'].properties['value[x]'];\n const initialValue = getTypedPropertyValue({ type: 'QuestionnaireItemInitial', value: initial }, 'value') as\n | TypedValue\n | undefined;\n\n const options: [string, TypedValue][] = [];\n let defaultValue = undefined;\n if (item.answerOption) {\n for (let i = 0; i < item.answerOption.length; i++) {\n const option = item.answerOption[i];\n const optionName = `${name}-option-${i}`;\n const optionValue = getTypedPropertyValue(\n { type: 'QuestionnaireItemAnswerOption', value: option },\n 'value'\n ) as TypedValue;\n if (initialValue && stringify(optionValue) === stringify(initialValue)) {\n defaultValue = optionName;\n }\n options.push([optionName, optionValue]);\n }\n }\n\n return (\n <Radio.Group\n name={name}\n defaultValue={defaultValue}\n onChange={(newValue) => {\n const option = options.find((option) => option[0] === newValue);\n if (option) {\n const optionValue = option[1];\n const propertyName = 'value' + capitalize(optionValue.type);\n onChangeAnswer({ [propertyName]: optionValue.value });\n }\n }}\n >\n {options.map(([optionName, optionValue]) => (\n <Radio\n key={optionName}\n id={optionName}\n value={optionName}\n label={\n <ResourcePropertyDisplay\n property={valueElementDefinition}\n propertyType={optionValue.type as PropertyType}\n value={optionValue.value}\n />\n }\n />\n ))}\n </Radio.Group>\n );\n}\n\nfunction buildInitialResponse(questionnaire: Questionnaire): QuestionnaireResponse {\n const response: QuestionnaireResponse = {\n resourceType: 'QuestionnaireResponse',\n questionnaire: getReferenceString(questionnaire),\n item: buildInitialResponseItems(questionnaire.item),\n };\n\n return response;\n}\n\nfunction buildInitialResponseItems(items: QuestionnaireItem[] | undefined): QuestionnaireResponseItem[] {\n return items?.map(buildInitialResponseItem) ?? [];\n}\n\nfunction buildInitialResponseItem(item: QuestionnaireItem): QuestionnaireResponseItem {\n return {\n linkId: item.linkId,\n text: item.text,\n item: buildInitialResponseItems(item.item),\n answer: item.initial?.map(buildInitialResponseAnswer) ?? [],\n };\n}\n\nfunction buildInitialResponseAnswer(answer: QuestionnaireItemInitial): QuestionnaireResponseItemAnswer {\n // This works because QuestionnaireItemInitial and QuestionnaireResponseItemAnswer\n // have the same properties.\n return { ...answer };\n}\n\nfunction isDropDownChoice(item: QuestionnaireItem): boolean {\n return !!item.extension?.some(\n (e) =>\n e.url === 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl' &&\n e.valueCodeableConcept?.coding?.[0]?.code === 'drop-down'\n );\n}\n\nexport function isQuestionEnabled(\n item: QuestionnaireItem,\n answers: Record<string, QuestionnaireResponseItemAnswer>\n): boolean {\n if (!item.enableWhen) {\n return true;\n }\n const enableBehavior = item.enableBehavior || 'any';\n for (const enableWhen of item.enableWhen) {\n const expectedAnswer = getTypedPropertyValue(\n {\n type: 'QuestionnaireItemEnableWhen',\n value: enableWhen,\n },\n 'answer[x]'\n );\n const actualAnswer = getTypedPropertyValue(\n {\n type: 'QuestionnaireResponseItemAnswer',\n value: answers[enableWhen.question as string],\n },\n 'value[x]'\n );\n const match = deepEquals(expectedAnswer, actualAnswer);\n if (enableBehavior === 'any' && match) {\n return true;\n }\n if (enableBehavior === 'all' && !match) {\n return false;\n }\n }\n if (enableBehavior === 'any') {\n return false;\n } else {\n return true;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA6CM,SAAU,iBAAiB,CAAC,KAA6B,EAAA;AAC7D,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;AAC7B,IAAA,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IACpC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,EAA0C,CAAC;IAC/E,MAAM,aAAa,GAAG,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IACvD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,EAAqC,CAAC;IAC9E,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAkD,EAAE,CAAC,CAAC;IAE5F,SAAS,CAAC,MAAK;QACb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ACD,QAAA,IAAI,cAAc,KAAK,KAAK,IAAI,CAAC,KAAK,EAAE;AACtC,YAAA,OAAO,KAAK,CAAC;AACd,SAAA;AACF,KAAA;IACD,IAAI,cAAc,KAAK,KAAK,EAAE;AAC5B,QAAA,OAAO,KAAK,CAAC;AACd,KAAA;AAAM,SAAA;AACL,QAAA,OAAO,IAAI,CAAC;AACb,KAAA;AACH;;;;"}
|
|
@@ -40,13 +40,13 @@ const useStyles = createStyles((theme) => ({
|
|
|
40
40
|
border: 0,
|
|
41
41
|
color: theme.colors.gray[5],
|
|
42
42
|
fontFamily: theme.fontFamilyMonospace,
|
|
43
|
-
padding: `${theme.spacing.xs}
|
|
43
|
+
padding: `${theme.spacing.xs} ${theme.spacing.sm}`,
|
|
44
44
|
textAlign: 'right',
|
|
45
45
|
},
|
|
46
46
|
line: {
|
|
47
47
|
fontFamily: theme.fontFamilyMonospace,
|
|
48
48
|
fontSize: theme.fontSizes.sm,
|
|
49
|
-
padding: `${theme.spacing.xs}
|
|
49
|
+
padding: `${theme.spacing.xs} ${theme.spacing.sm}`,
|
|
50
50
|
},
|
|
51
51
|
pre: {
|
|
52
52
|
margin: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceBlame.mjs","sources":["../../../src/ResourceBlame/ResourceBlame.tsx"],"sourcesContent":["import { createStyles } from '@mantine/core';\nimport { Bundle, Resource, ResourceType } from '@medplum/fhirtypes';\nimport React, { useEffect, useState } from 'react';\nimport { MedplumLink } from '../MedplumLink/MedplumLink';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { ResourceBadge } from '../ResourceBadge/ResourceBadge';\nimport { blame } from '../utils/blame';\n\nconst useStyles = createStyles((theme) => ({\n container: {\n overflowX: 'auto',\n },\n\n root: {\n border: `0.1px solid ${theme.colors.gray[3]}`,\n borderCollapse: 'collapse',\n borderRadius: theme.radius.sm,\n borderSpacing: 0,\n fontSize: theme.fontSizes.xs,\n width: '100%',\n\n '& td': {\n padding: '2px 4px 0 4px',\n verticalAlign: 'top',\n whiteSpace: 'nowrap',\n },\n },\n\n startRow: {\n borderTop: `0.1px solid ${theme.colors.gray[3]}`,\n },\n\n normalRow: {\n borderTop: 0,\n },\n\n author: {\n lineHeight: '10px',\n },\n\n dateTime: {\n borderRight: `0.1px solid ${theme.colors.gray[3]}`,\n lineHeight: '20px',\n },\n\n lineNumber: {\n backgroundColor: theme.colors.gray[1],\n border: 0,\n color: theme.colors.gray[5],\n fontFamily: theme.fontFamilyMonospace,\n padding: `${theme.spacing.xs}
|
|
1
|
+
{"version":3,"file":"ResourceBlame.mjs","sources":["../../../src/ResourceBlame/ResourceBlame.tsx"],"sourcesContent":["import { createStyles } from '@mantine/core';\nimport { Bundle, Resource, ResourceType } from '@medplum/fhirtypes';\nimport React, { useEffect, useState } from 'react';\nimport { MedplumLink } from '../MedplumLink/MedplumLink';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { ResourceBadge } from '../ResourceBadge/ResourceBadge';\nimport { blame } from '../utils/blame';\n\nconst useStyles = createStyles((theme) => ({\n container: {\n overflowX: 'auto',\n },\n\n root: {\n border: `0.1px solid ${theme.colors.gray[3]}`,\n borderCollapse: 'collapse',\n borderRadius: theme.radius.sm,\n borderSpacing: 0,\n fontSize: theme.fontSizes.xs,\n width: '100%',\n\n '& td': {\n padding: '2px 4px 0 4px',\n verticalAlign: 'top',\n whiteSpace: 'nowrap',\n },\n },\n\n startRow: {\n borderTop: `0.1px solid ${theme.colors.gray[3]}`,\n },\n\n normalRow: {\n borderTop: 0,\n },\n\n author: {\n lineHeight: '10px',\n },\n\n dateTime: {\n borderRight: `0.1px solid ${theme.colors.gray[3]}`,\n lineHeight: '20px',\n },\n\n lineNumber: {\n backgroundColor: theme.colors.gray[1],\n border: 0,\n color: theme.colors.gray[5],\n fontFamily: theme.fontFamilyMonospace,\n padding: `${theme.spacing.xs} ${theme.spacing.sm}`,\n textAlign: 'right',\n },\n\n line: {\n fontFamily: theme.fontFamilyMonospace,\n fontSize: theme.fontSizes.sm,\n padding: `${theme.spacing.xs} ${theme.spacing.sm}`,\n },\n\n pre: {\n margin: 0,\n },\n}));\n\nexport interface ResourceBlameProps {\n history?: Bundle;\n resourceType?: ResourceType;\n id?: string;\n}\n\nexport function ResourceBlame(props: ResourceBlameProps): JSX.Element {\n const { classes } = useStyles();\n const medplum = useMedplum();\n const [value, setValue] = useState<Bundle | undefined>(props.history);\n\n useEffect(() => {\n if (!props.history && props.resourceType && props.id) {\n medplum.readHistory(props.resourceType, props.id).then(setValue).catch(console.log);\n }\n }, [medplum, props.history, props.resourceType, props.id]);\n\n if (!value) {\n return <div>Loading...</div>;\n }\n\n const resource = value.entry?.[0]?.resource as Resource;\n const table = blame(value);\n return (\n <div className={classes.container}>\n <table className={classes.root}>\n <tbody>\n {table.map((row, index) => (\n <tr key={'row-' + index} className={row.span > 0 ? classes.startRow : classes.normalRow}>\n {row.span > 0 && (\n <>\n <td className={classes.author} rowSpan={row.span}>\n <ResourceBadge value={row.meta.author} link={true} />\n </td>\n <td className={classes.dateTime} rowSpan={row.span}>\n <MedplumLink to={getVersionUrl(resource, row.meta.versionId as string)}>\n {getTimeString(row.meta.lastUpdated as string)}\n </MedplumLink>\n </td>\n </>\n )}\n <td className={classes.lineNumber}>{index + 1}</td>\n <td className={classes.line}>\n <pre className={classes.pre}>{row.value}</pre>\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n\nfunction getVersionUrl(resource: Resource, versionId: string): string {\n return `/${resource.resourceType}/${resource.id}/_history/${versionId}`;\n}\n\nexport function getTimeString(lastUpdated: string): string {\n const seconds = Math.floor((Date.now() - Date.parse(lastUpdated)) / 1000);\n\n const years = Math.floor(seconds / 31536000);\n if (years > 0) {\n return pluralizeTime(years, 'year');\n }\n\n const months = Math.floor(seconds / 2592000);\n if (months > 0) {\n return pluralizeTime(months, 'month');\n }\n\n const days = Math.floor(seconds / 86400);\n if (days > 0) {\n return pluralizeTime(days, 'day');\n }\n\n const hours = Math.floor(seconds / 3600);\n if (hours > 0) {\n return pluralizeTime(hours, 'hour');\n }\n\n const minutes = Math.floor(seconds / 60);\n if (minutes > 0) {\n return pluralizeTime(minutes, 'minute');\n }\n\n return pluralizeTime(seconds, 'second');\n}\n\nfunction pluralizeTime(count: number, noun: string): string {\n return `${count} ${count === 1 ? noun : noun + 's'} ago`;\n}\n"],"names":[],"mappings":";;;;;;;AAQA,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,KAAK,MAAM;AACzC,IAAA,SAAS,EAAE;AACT,QAAA,SAAS,EAAE,MAAM;AAClB,KAAA;AAED,IAAA,IAAI,EAAE;QACJ,MAAM,EAAE,CAAe,YAAA,EAAA,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAE,CAAA;AAC7C,QAAA,cAAc,EAAE,UAAU;AAC1B,QAAA,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE;AAC7B,QAAA,aAAa,EAAE,CAAC;AAChB,QAAA,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE;AAC5B,QAAA,KAAK,EAAE,MAAM;AAEb,QAAA,MAAM,EAAE;AACN,YAAA,OAAO,EAAE,eAAe;AACxB,YAAA,aAAa,EAAE,KAAK;AACpB,YAAA,UAAU,EAAE,QAAQ;AACrB,SAAA;AACF,KAAA;AAED,IAAA,QAAQ,EAAE;QACR,SAAS,EAAE,CAAe,YAAA,EAAA,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAE,CAAA;AACjD,KAAA;AAED,IAAA,SAAS,EAAE;AACT,QAAA,SAAS,EAAE,CAAC;AACb,KAAA;AAED,IAAA,MAAM,EAAE;AACN,QAAA,UAAU,EAAE,MAAM;AACnB,KAAA;AAED,IAAA,QAAQ,EAAE;QACR,WAAW,EAAE,CAAe,YAAA,EAAA,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAE,CAAA;AAClD,QAA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AO,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AACrC,KAAA;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC;IAC7C,IAAI,MAAM,GAAG,CAAC,EAAE;AACd,QAAA,OAAO,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACvC,KAAA;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;IACzC,IAAI,IAAI,GAAG,CAAC,EAAE;AACZ,QAAA,OAAO,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACnC,KAAA;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IACzC,IAAI,KAAK,GAAG,CAAC,EAAE;AACb,QAAA,OAAO,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AACrC,KAAA;IAED,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;IACzC,IAAI,OAAO,GAAG,CAAC,EAAE;AACf,QAAA,OAAO,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AACzC,KAAA;AAED,IAAA,OAAO,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,aAAa,CAAC,KAAa,EAAE,IAAY,EAAA;AAChD,IAAA,OAAO,GAAG,KAAK,CAAA,CAAA,EAAI,KAAK,KAAK,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,MAAM,CAAC;AAC3D;;;;"}
|
|
@@ -12,7 +12,7 @@ const useStyles = createStyles((theme) => ({
|
|
|
12
12
|
borderTop: `0.1px solid ${theme.colors.gray[3]}`,
|
|
13
13
|
},
|
|
14
14
|
'& th, & td': {
|
|
15
|
-
padding: `${theme.spacing.sm}
|
|
15
|
+
padding: `${theme.spacing.sm} ${theme.spacing.sm}`,
|
|
16
16
|
verticalAlign: 'top',
|
|
17
17
|
},
|
|
18
18
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceDiffTable.mjs","sources":["../../../src/ResourceDiffTable/ResourceDiffTable.tsx"],"sourcesContent":["import { createStyles } from '@mantine/core';\nimport { getPropertyDisplayName, IndexedStructureDefinition, stringify, toTypedValue } from '@medplum/core';\nimport { Resource } from '@medplum/fhirtypes';\nimport React, { useEffect, useState } from 'react';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { getValueAndType, ResourcePropertyDisplay } from '../ResourcePropertyDisplay/ResourcePropertyDisplay';\n\nconst useStyles = createStyles((theme) => ({\n root: {\n borderCollapse: 'collapse',\n width: '100%',\n\n '& tr': {\n borderTop: `0.1px solid ${theme.colors.gray[3]}`,\n },\n\n '& th, & td': {\n padding: `${theme.spacing.sm}
|
|
1
|
+
{"version":3,"file":"ResourceDiffTable.mjs","sources":["../../../src/ResourceDiffTable/ResourceDiffTable.tsx"],"sourcesContent":["import { createStyles } from '@mantine/core';\nimport { getPropertyDisplayName, IndexedStructureDefinition, stringify, toTypedValue } from '@medplum/core';\nimport { Resource } from '@medplum/fhirtypes';\nimport React, { useEffect, useState } from 'react';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { getValueAndType, ResourcePropertyDisplay } from '../ResourcePropertyDisplay/ResourcePropertyDisplay';\n\nconst useStyles = createStyles((theme) => ({\n root: {\n borderCollapse: 'collapse',\n width: '100%',\n\n '& tr': {\n borderTop: `0.1px solid ${theme.colors.gray[3]}`,\n },\n\n '& th, & td': {\n padding: `${theme.spacing.sm} ${theme.spacing.sm}`,\n verticalAlign: 'top',\n },\n },\n\n removed: {\n color: theme.colors.red[7],\n textDecoration: 'line-through',\n },\n\n added: {\n color: theme.colors.green[7],\n },\n}));\n\nexport interface ResourceDiffTableProps {\n original: Resource;\n revised: Resource;\n}\n\nexport function ResourceDiffTable(props: ResourceDiffTableProps): JSX.Element | null {\n const { classes } = useStyles();\n const medplum = useMedplum();\n const [schema, setSchema] = useState<IndexedStructureDefinition | undefined>();\n\n useEffect(() => {\n medplum.requestSchema(props.original.resourceType).then(setSchema).catch(console.log);\n }, [medplum, props.original.resourceType]);\n\n if (!schema) {\n return null;\n }\n\n const typeSchema = schema.types[props.original.resourceType];\n if (!typeSchema) {\n return null;\n }\n\n return (\n <table className={classes.root}>\n <colgroup>\n <col style={{ width: '30%' }} />\n <col style={{ width: '35%' }} />\n <col style={{ width: '35%' }} />\n </colgroup>\n <thead>\n <tr>\n <th>Property</th>\n <th>Before</th>\n <th>After</th>\n </tr>\n </thead>\n <tbody>\n {Object.entries(typeSchema.properties).map((entry) => {\n const key = entry[0];\n if (key === 'id' || key === 'meta') {\n return null;\n }\n\n const property = entry[1];\n const [originalPropertyValue, originalPropertyType] = getValueAndType(toTypedValue(props.original), key);\n const [revisedPropertyValue, revisedPropertyType] = getValueAndType(toTypedValue(props.revised), key);\n if (isEmpty(originalPropertyValue) && isEmpty(revisedPropertyValue)) {\n return null;\n }\n\n if (stringify(originalPropertyValue) === stringify(revisedPropertyValue)) {\n return null;\n }\n\n return (\n <tr key={key}>\n <td>{getPropertyDisplayName(key)}</td>\n <td className={classes.removed}>\n <ResourcePropertyDisplay\n property={property}\n propertyType={originalPropertyType}\n value={originalPropertyValue}\n ignoreMissingValues={true}\n />\n </td>\n <td className={classes.added}>\n <ResourcePropertyDisplay\n property={property}\n propertyType={revisedPropertyType}\n value={revisedPropertyValue}\n ignoreMissingValues={true}\n />\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n );\n}\n\nfunction isEmpty(value: unknown): boolean {\n return (\n !value ||\n (Array.isArray(value) && value.length === 0) ||\n (typeof value === 'object' && Object.keys(value).length === 0)\n );\n}\n"],"names":[],"mappings":";;;;;;AAOA,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,KAAK,MAAM;AACzC,IAAA,IAAI,EAAE;AACJ,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zB,CAAA,CACC,CACF,EACL;AACJ,SAAC,CAAC,CACI,CACF,EACR;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,KAAc,EAAA;IAC7B,QACE,CAAC,KAAK;AACN,SAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;AAC5C,SAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,EAC9D;AACJ;;;;"}
|
|
@@ -72,6 +72,7 @@ function ElementDefinitionTypeInput(props) {
|
|
|
72
72
|
const propertyType = props.elementDefinitionType.code;
|
|
73
73
|
const name = props.name;
|
|
74
74
|
const value = props.defaultValue;
|
|
75
|
+
const required = property.min !== undefined && property.min > 0;
|
|
75
76
|
switch (propertyType) {
|
|
76
77
|
// 2.24.0.1 Primitive Types
|
|
77
78
|
// https://www.hl7.org/fhir/datatypes.html#primitive
|
|
@@ -81,13 +82,13 @@ function ElementDefinitionTypeInput(props) {
|
|
|
81
82
|
case PropertyType.time:
|
|
82
83
|
case PropertyType.uri:
|
|
83
84
|
case PropertyType.url:
|
|
84
|
-
return (React.createElement(TextInput, { id: name, name: name, "data-testid": name, defaultValue: value, onChange: (e) => {
|
|
85
|
+
return (React.createElement(TextInput, { id: name, name: name, "data-testid": name, defaultValue: value, required: required, onChange: (e) => {
|
|
85
86
|
if (props.onChange) {
|
|
86
87
|
props.onChange(e.currentTarget.value);
|
|
87
88
|
}
|
|
88
89
|
}, error: getErrorsForInput(props.outcome, name) }));
|
|
89
90
|
case PropertyType.date:
|
|
90
|
-
return (React.createElement(TextInput, { type: "date", id: name, name: name, "data-testid": name, defaultValue: value, onChange: (e) => {
|
|
91
|
+
return (React.createElement(TextInput, { type: "date", id: name, name: name, "data-testid": name, defaultValue: value, required: required, onChange: (e) => {
|
|
91
92
|
if (props.onChange) {
|
|
92
93
|
props.onChange(e.currentTarget.value);
|
|
93
94
|
}
|
|
@@ -99,7 +100,7 @@ function ElementDefinitionTypeInput(props) {
|
|
|
99
100
|
case PropertyType.integer:
|
|
100
101
|
case PropertyType.positiveInt:
|
|
101
102
|
case PropertyType.unsignedInt:
|
|
102
|
-
return (React.createElement(TextInput, { type: "number", step: propertyType === PropertyType.decimal ? 'any' : '1', id: name, name: name, "data-testid": name, defaultValue: value, onChange: (e) => {
|
|
103
|
+
return (React.createElement(TextInput, { type: "number", step: propertyType === PropertyType.decimal ? 'any' : '1', id: name, name: name, "data-testid": name, defaultValue: value, required: required, onChange: (e) => {
|
|
103
104
|
if (props.onChange) {
|
|
104
105
|
props.onChange(e.currentTarget.valueAsNumber);
|
|
105
106
|
}
|
|
@@ -113,7 +114,7 @@ function ElementDefinitionTypeInput(props) {
|
|
|
113
114
|
}
|
|
114
115
|
} }));
|
|
115
116
|
case PropertyType.markdown:
|
|
116
|
-
return (React.createElement(Textarea, { id: name, name: name, "data-testid": name, defaultValue: value, onChange: (e) => {
|
|
117
|
+
return (React.createElement(Textarea, { id: name, name: name, "data-testid": name, defaultValue: value, required: required, onChange: (e) => {
|
|
117
118
|
if (props.onChange) {
|
|
118
119
|
props.onChange(e.currentTarget.value);
|
|
119
120
|
}
|