@medplum/react 2.0.7 → 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 +12 -9
- 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/FormSection/FormSection.mjs +1 -1
- package/dist/esm/FormSection/FormSection.mjs.map +1 -1
- package/dist/esm/ResourcePropertyInput/ResourcePropertyInput.mjs +5 -4
- package/dist/esm/ResourcePropertyInput/ResourcePropertyInput.mjs.map +1 -1
- package/dist/esm/SearchControl/SearchUtils.mjs +1 -0
- package/dist/esm/SearchControl/SearchUtils.mjs.map +1 -1
- package/dist/esm/index.min.mjs +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 +1 -1
|
@@ -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,CA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E,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,IAAA,QACE,KAAA,CAAA,aAAA,CAAC,SAAS,EAAA,EACR,EAAE,EAAE,KAAK,CAAC,IAAI,EACd,IAAI,EAAE,KAAK,CAAC,IAAI,EACH,aAAA,EAAA,KAAK,CAAC,IAAI,EACvB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,IAAI,EAAE,YAAY,EAAE,EACpB,YAAY,EAAE,iBAAiB,CAAC,KAAK,CAAC,YAAY,CAAC,EACnD,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,EACnD,QAAQ,EAAE,CAAC,CAAsC,KAAI;YACnD,IAAI,KAAK,CAAC,QAAQ,EAAE;AAClB,gBAAA,MAAM,QAAQ,GAAG,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC;gBACvC,KAAK,CAAC,QAAQ,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC7C,aAAA;SACF,EAAA,CACD,EACF;AACJ,CAAC;AAED;;;;AAIG;AACG,SAAU,iBAAiB,CAAC,SAA6B,EAAA;IAC7D,IAAI,CAAC,SAAS,EAAE;AACd,QAAA,OAAO,EAAE,CAAC;AACX,KAAA;;;;AAKD,IAAA,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC;AACjC,IAAA,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;;AAEtB,QAAA,OAAO,EAAE,CAAC;AACX,KAAA;AAED,IAAA,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAC7E,CAAC;AAED;;;;AAIG;AACG,SAAU,iBAAiB,CAAC,WAA+B,EAAA;IAC/D,IAAI,CAAC,WAAW,EAAE;AAChB,QAAA,OAAO,EAAE,CAAC;AACX,KAAA;;;;AAKD,IAAA,MAAM,IAAI,GAAG,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;;;;"}
|
|
@@ -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;;;;"}
|
|
@@ -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
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourcePropertyInput.mjs","sources":["../../../src/ResourcePropertyInput/ResourcePropertyInput.tsx"],"sourcesContent":["import { Checkbox, Group, NativeSelect, Textarea, TextInput } from '@mantine/core';\nimport { capitalize, getElementDefinitionTypeName, PropertyType } from '@medplum/core';\nimport { ElementDefinition, ElementDefinitionType, OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { AddressInput } from '../AddressInput/AddressInput';\nimport { AnnotationInput } from '../AnnotationInput/AnnotationInput';\nimport { AttachmentArrayInput } from '../AttachmentArrayInput/AttachmentArrayInput';\nimport { AttachmentInput } from '../AttachmentInput/AttachmentInput';\nimport { BackboneElementInput } from '../BackboneElementInput/BackboneElementInput';\nimport { CodeableConceptInput } from '../CodeableConceptInput/CodeableConceptInput';\nimport { CodeInput } from '../CodeInput/CodeInput';\nimport { CodingInput } from '../CodingInput/CodingInput';\nimport { ContactDetailInput } from '../ContactDetailInput/ContactDetailInput';\nimport { ContactPointInput } from '../ContactPointInput/ContactPointInput';\nimport { DateTimeInput } from '../DateTimeInput/DateTimeInput';\nimport { ExtensionInput } from '../ExtensionInput/ExtensionInput';\nimport { HumanNameInput } from '../HumanNameInput/HumanNameInput';\nimport { IdentifierInput } from '../IdentifierInput/IdentifierInput';\nimport { MoneyInput } from '../MoneyInput/MoneyInput';\nimport { PeriodInput } from '../PeriodInput/PeriodInput';\nimport { QuantityInput } from '../QuantityInput/QuantityInput';\nimport { RangeInput } from '../RangeInput/RangeInput';\nimport { RatioInput } from '../RatioInput/RatioInput';\nimport { ReferenceInput } from '../ReferenceInput/ReferenceInput';\nimport { ResourceArrayInput } from '../ResourceArrayInput/ResourceArrayInput';\nimport { TimingInput } from '../TimingInput/TimingInput';\nimport { getErrorsForInput } from '../utils/outcomes';\n\nexport interface ResourcePropertyInputProps {\n property: ElementDefinition;\n name: string;\n defaultPropertyType?: PropertyType;\n defaultValue?: any;\n arrayElement?: boolean;\n onChange?: (value: any, propName?: string) => void;\n outcome?: OperationOutcome;\n}\n\nexport function ResourcePropertyInput(props: ResourcePropertyInputProps): JSX.Element {\n const property = props.property;\n const propertyType = props.defaultPropertyType ?? (property.type?.[0]?.code as PropertyType);\n const name = props.name;\n const value = props.defaultValue;\n\n if (property.max === '*' && !props.arrayElement) {\n if (propertyType === 'Attachment') {\n return <AttachmentArrayInput name={name} defaultValue={value} onChange={props.onChange} />;\n }\n return <ResourceArrayInput property={property} name={name} defaultValue={value} onChange={props.onChange} />;\n }\n\n const propertyTypes = property.type as ElementDefinitionType[];\n if (propertyTypes.length > 1) {\n return <ElementDefinitionInputSelector elementDefinitionTypes={propertyTypes} {...props} />;\n } else {\n return <ElementDefinitionTypeInput elementDefinitionType={propertyTypes[0]} {...props} />;\n }\n}\n\nexport interface ElementDefinitionSelectorProps extends ResourcePropertyInputProps {\n elementDefinitionTypes: ElementDefinitionType[];\n}\n\nexport function ElementDefinitionInputSelector(props: ElementDefinitionSelectorProps): JSX.Element {\n const propertyTypes = props.elementDefinitionTypes;\n let initialPropertyType: ElementDefinitionType | undefined = undefined;\n if (props.defaultPropertyType) {\n initialPropertyType = propertyTypes.find((t) => t.code === props.defaultPropertyType) as ElementDefinitionType;\n }\n if (!initialPropertyType) {\n initialPropertyType = propertyTypes[0];\n }\n const [selectedType, setSelectedType] = useState(initialPropertyType);\n return (\n <Group spacing=\"xs\" grow noWrap>\n <NativeSelect\n style={{ width: '200px' }}\n defaultValue={selectedType?.code}\n onChange={(e) => {\n setSelectedType(\n propertyTypes.find(\n (type: ElementDefinitionType) => type.code === e.currentTarget.value\n ) as ElementDefinitionType\n );\n }}\n data={propertyTypes.map((type: ElementDefinitionType) => ({\n value: type.code as string,\n label: type.code as string,\n }))}\n />\n <ElementDefinitionTypeInput\n {...props}\n elementDefinitionType={selectedType}\n onChange={(newValue: any) => {\n if (props.onChange) {\n props.onChange(newValue, props.name.replace('[x]', capitalize(selectedType.code as string)));\n }\n }}\n />\n </Group>\n );\n}\n\nexport interface ElementDefinitionTypeInputProps extends ResourcePropertyInputProps {\n elementDefinitionType: ElementDefinitionType;\n}\n\nexport function ElementDefinitionTypeInput(props: ElementDefinitionTypeInputProps): JSX.Element {\n const property = props.property;\n const propertyType = props.elementDefinitionType.code as PropertyType;\n const name = props.name;\n const value = props.defaultValue;\n\n switch (propertyType) {\n // 2.24.0.1 Primitive Types\n // https://www.hl7.org/fhir/datatypes.html#primitive\n\n case PropertyType.SystemString:\n case PropertyType.canonical:\n case PropertyType.string:\n case PropertyType.time:\n case PropertyType.uri:\n case PropertyType.url:\n return (\n <TextInput\n id={name}\n name={name}\n data-testid={name}\n defaultValue={value}\n onChange={(e) => {\n if (props.onChange) {\n props.onChange(e.currentTarget.value);\n }\n }}\n error={getErrorsForInput(props.outcome, name)}\n />\n );\n case PropertyType.date:\n return (\n <TextInput\n type=\"date\"\n id={name}\n name={name}\n data-testid={name}\n defaultValue={value}\n onChange={(e) => {\n if (props.onChange) {\n props.onChange(e.currentTarget.value);\n }\n }}\n error={getErrorsForInput(props.outcome, name)}\n />\n );\n case PropertyType.dateTime:\n case PropertyType.instant:\n return <DateTimeInput name={name} defaultValue={value} onChange={props.onChange} outcome={props.outcome} />;\n case PropertyType.decimal:\n case PropertyType.integer:\n case PropertyType.positiveInt:\n case PropertyType.unsignedInt:\n return (\n <TextInput\n type=\"number\"\n step={propertyType === PropertyType.decimal ? 'any' : '1'}\n id={name}\n name={name}\n data-testid={name}\n defaultValue={value}\n onChange={(e) => {\n if (props.onChange) {\n props.onChange(e.currentTarget.valueAsNumber);\n }\n }}\n />\n );\n case PropertyType.code:\n return <CodeInput property={property} name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.boolean:\n return (\n <Checkbox\n id={name}\n name={name}\n data-testid={name}\n defaultChecked={!!value}\n onChange={(e) => {\n if (props.onChange) {\n props.onChange(e.currentTarget.checked);\n }\n }}\n />\n );\n case PropertyType.markdown:\n return (\n <Textarea\n id={name}\n name={name}\n data-testid={name}\n defaultValue={value}\n onChange={(e) => {\n if (props.onChange) {\n props.onChange(e.currentTarget.value);\n }\n }}\n />\n );\n\n // 2.24.0.2 Complex Types\n // https://www.hl7.org/fhir/datatypes.html#complex\n\n case PropertyType.Address:\n return <AddressInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Annotation:\n return <AnnotationInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Attachment:\n return <AttachmentInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.CodeableConcept:\n return <CodeableConceptInput property={property} name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Coding:\n return <CodingInput property={property} name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.ContactDetail:\n return <ContactDetailInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.ContactPoint:\n return <ContactPointInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Extension:\n return <ExtensionInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.HumanName:\n return <HumanNameInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Identifier:\n return <IdentifierInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Money:\n return <MoneyInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Period:\n return <PeriodInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Duration:\n case PropertyType.Quantity:\n return <QuantityInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Range:\n return <RangeInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Ratio:\n return <RatioInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Reference:\n return (\n <ReferenceInput\n name={name}\n defaultValue={value}\n targetTypes={getTargetTypes(property)}\n onChange={props.onChange}\n />\n );\n case PropertyType.Timing:\n return <TimingInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Dosage:\n case PropertyType.UsageContext:\n return (\n <BackboneElementInput\n typeName={propertyType}\n defaultValue={value}\n onChange={props.onChange}\n outcome={props.outcome}\n />\n );\n default:\n return (\n <BackboneElementInput\n typeName={getElementDefinitionTypeName(property)}\n defaultValue={value}\n onChange={props.onChange}\n outcome={props.outcome}\n />\n );\n }\n}\n\nfunction getTargetTypes(property?: ElementDefinition): string[] | undefined {\n return property?.type?.[0]?.targetProfile?.map((p) => p.split('/').pop() as string);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCM,SAAU,qBAAqB,CAAC,KAAiC,EAAA;AACrE,IAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;AAChC,IAAA,MAAM,YAAY,GAAG,KAAK,CAAC,mBAAmB,IAAK,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC,EAAE,IAAqB,CAAC;AAC7F,IAAA,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;AACxB,IAAA,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC;IA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AAC,QAAQ,EACxB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,CAAA,EACF;AACJ,QAAA;AACE,YAAA,QACE,KAAA,CAAA,aAAA,CAAC,oBAAoB,EAAA,EACnB,QAAQ,EAAE,4BAA4B,CAAC,QAAQ,CAAC,EAChD,YAAY,EAAE,KAAK,EACnB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,CAAA,EACF;AACL,KAAA;AACH,CAAC;AAED,SAAS,cAAc,CAAC,QAA4B,EAAA;IAClD,OAAO,QAAQ,EAAE,IAAI,GAAG,CAAC,CAAC,EAAE,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAY,CAAC,CAAC;AACtF;;;;"}
|
|
1
|
+
{"version":3,"file":"ResourcePropertyInput.mjs","sources":["../../../src/ResourcePropertyInput/ResourcePropertyInput.tsx"],"sourcesContent":["import { Checkbox, Group, NativeSelect, Textarea, TextInput } from '@mantine/core';\nimport { capitalize, getElementDefinitionTypeName, PropertyType } from '@medplum/core';\nimport { ElementDefinition, ElementDefinitionType, OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { AddressInput } from '../AddressInput/AddressInput';\nimport { AnnotationInput } from '../AnnotationInput/AnnotationInput';\nimport { AttachmentArrayInput } from '../AttachmentArrayInput/AttachmentArrayInput';\nimport { AttachmentInput } from '../AttachmentInput/AttachmentInput';\nimport { BackboneElementInput } from '../BackboneElementInput/BackboneElementInput';\nimport { CodeableConceptInput } from '../CodeableConceptInput/CodeableConceptInput';\nimport { CodeInput } from '../CodeInput/CodeInput';\nimport { CodingInput } from '../CodingInput/CodingInput';\nimport { ContactDetailInput } from '../ContactDetailInput/ContactDetailInput';\nimport { ContactPointInput } from '../ContactPointInput/ContactPointInput';\nimport { DateTimeInput } from '../DateTimeInput/DateTimeInput';\nimport { ExtensionInput } from '../ExtensionInput/ExtensionInput';\nimport { HumanNameInput } from '../HumanNameInput/HumanNameInput';\nimport { IdentifierInput } from '../IdentifierInput/IdentifierInput';\nimport { MoneyInput } from '../MoneyInput/MoneyInput';\nimport { PeriodInput } from '../PeriodInput/PeriodInput';\nimport { QuantityInput } from '../QuantityInput/QuantityInput';\nimport { RangeInput } from '../RangeInput/RangeInput';\nimport { RatioInput } from '../RatioInput/RatioInput';\nimport { ReferenceInput } from '../ReferenceInput/ReferenceInput';\nimport { ResourceArrayInput } from '../ResourceArrayInput/ResourceArrayInput';\nimport { TimingInput } from '../TimingInput/TimingInput';\nimport { getErrorsForInput } from '../utils/outcomes';\n\nexport interface ResourcePropertyInputProps {\n property: ElementDefinition;\n name: string;\n defaultPropertyType?: PropertyType;\n defaultValue?: any;\n arrayElement?: boolean;\n onChange?: (value: any, propName?: string) => void;\n outcome?: OperationOutcome;\n}\n\nexport function ResourcePropertyInput(props: ResourcePropertyInputProps): JSX.Element {\n const property = props.property;\n const propertyType = props.defaultPropertyType ?? (property.type?.[0]?.code as PropertyType);\n const name = props.name;\n const value = props.defaultValue;\n\n if (property.max === '*' && !props.arrayElement) {\n if (propertyType === 'Attachment') {\n return <AttachmentArrayInput name={name} defaultValue={value} onChange={props.onChange} />;\n }\n return <ResourceArrayInput property={property} name={name} defaultValue={value} onChange={props.onChange} />;\n }\n\n const propertyTypes = property.type as ElementDefinitionType[];\n if (propertyTypes.length > 1) {\n return <ElementDefinitionInputSelector elementDefinitionTypes={propertyTypes} {...props} />;\n } else {\n return <ElementDefinitionTypeInput elementDefinitionType={propertyTypes[0]} {...props} />;\n }\n}\n\nexport interface ElementDefinitionSelectorProps extends ResourcePropertyInputProps {\n elementDefinitionTypes: ElementDefinitionType[];\n}\n\nexport function ElementDefinitionInputSelector(props: ElementDefinitionSelectorProps): JSX.Element {\n const propertyTypes = props.elementDefinitionTypes;\n let initialPropertyType: ElementDefinitionType | undefined = undefined;\n if (props.defaultPropertyType) {\n initialPropertyType = propertyTypes.find((t) => t.code === props.defaultPropertyType) as ElementDefinitionType;\n }\n if (!initialPropertyType) {\n initialPropertyType = propertyTypes[0];\n }\n const [selectedType, setSelectedType] = useState(initialPropertyType);\n return (\n <Group spacing=\"xs\" grow noWrap>\n <NativeSelect\n style={{ width: '200px' }}\n defaultValue={selectedType?.code}\n onChange={(e) => {\n setSelectedType(\n propertyTypes.find(\n (type: ElementDefinitionType) => type.code === e.currentTarget.value\n ) as ElementDefinitionType\n );\n }}\n data={propertyTypes.map((type: ElementDefinitionType) => ({\n value: type.code as string,\n label: type.code as string,\n }))}\n />\n <ElementDefinitionTypeInput\n {...props}\n elementDefinitionType={selectedType}\n onChange={(newValue: any) => {\n if (props.onChange) {\n props.onChange(newValue, props.name.replace('[x]', capitalize(selectedType.code as string)));\n }\n }}\n />\n </Group>\n );\n}\n\nexport interface ElementDefinitionTypeInputProps extends ResourcePropertyInputProps {\n elementDefinitionType: ElementDefinitionType;\n}\n\nexport function ElementDefinitionTypeInput(props: ElementDefinitionTypeInputProps): JSX.Element {\n const property = props.property;\n const propertyType = props.elementDefinitionType.code as PropertyType;\n const name = props.name;\n const value = props.defaultValue;\n const required = property.min !== undefined && property.min > 0;\n\n switch (propertyType) {\n // 2.24.0.1 Primitive Types\n // https://www.hl7.org/fhir/datatypes.html#primitive\n\n case PropertyType.SystemString:\n case PropertyType.canonical:\n case PropertyType.string:\n case PropertyType.time:\n case PropertyType.uri:\n case PropertyType.url:\n return (\n <TextInput\n id={name}\n name={name}\n data-testid={name}\n defaultValue={value}\n required={required}\n onChange={(e) => {\n if (props.onChange) {\n props.onChange(e.currentTarget.value);\n }\n }}\n error={getErrorsForInput(props.outcome, name)}\n />\n );\n case PropertyType.date:\n return (\n <TextInput\n type=\"date\"\n id={name}\n name={name}\n data-testid={name}\n defaultValue={value}\n required={required}\n onChange={(e) => {\n if (props.onChange) {\n props.onChange(e.currentTarget.value);\n }\n }}\n error={getErrorsForInput(props.outcome, name)}\n />\n );\n case PropertyType.dateTime:\n case PropertyType.instant:\n return <DateTimeInput name={name} defaultValue={value} onChange={props.onChange} outcome={props.outcome} />;\n case PropertyType.decimal:\n case PropertyType.integer:\n case PropertyType.positiveInt:\n case PropertyType.unsignedInt:\n return (\n <TextInput\n type=\"number\"\n step={propertyType === PropertyType.decimal ? 'any' : '1'}\n id={name}\n name={name}\n data-testid={name}\n defaultValue={value}\n required={required}\n onChange={(e) => {\n if (props.onChange) {\n props.onChange(e.currentTarget.valueAsNumber);\n }\n }}\n />\n );\n case PropertyType.code:\n return <CodeInput property={property} name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.boolean:\n return (\n <Checkbox\n id={name}\n name={name}\n data-testid={name}\n defaultChecked={!!value}\n onChange={(e) => {\n if (props.onChange) {\n props.onChange(e.currentTarget.checked);\n }\n }}\n />\n );\n case PropertyType.markdown:\n return (\n <Textarea\n id={name}\n name={name}\n data-testid={name}\n defaultValue={value}\n required={required}\n onChange={(e) => {\n if (props.onChange) {\n props.onChange(e.currentTarget.value);\n }\n }}\n />\n );\n\n // 2.24.0.2 Complex Types\n // https://www.hl7.org/fhir/datatypes.html#complex\n\n case PropertyType.Address:\n return <AddressInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Annotation:\n return <AnnotationInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Attachment:\n return <AttachmentInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.CodeableConcept:\n return <CodeableConceptInput property={property} name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Coding:\n return <CodingInput property={property} name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.ContactDetail:\n return <ContactDetailInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.ContactPoint:\n return <ContactPointInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Extension:\n return <ExtensionInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.HumanName:\n return <HumanNameInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Identifier:\n return <IdentifierInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Money:\n return <MoneyInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Period:\n return <PeriodInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Duration:\n case PropertyType.Quantity:\n return <QuantityInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Range:\n return <RangeInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Ratio:\n return <RatioInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Reference:\n return (\n <ReferenceInput\n name={name}\n defaultValue={value}\n targetTypes={getTargetTypes(property)}\n onChange={props.onChange}\n />\n );\n case PropertyType.Timing:\n return <TimingInput name={name} defaultValue={value} onChange={props.onChange} />;\n case PropertyType.Dosage:\n case PropertyType.UsageContext:\n return (\n <BackboneElementInput\n typeName={propertyType}\n defaultValue={value}\n onChange={props.onChange}\n outcome={props.outcome}\n />\n );\n default:\n return (\n <BackboneElementInput\n typeName={getElementDefinitionTypeName(property)}\n defaultValue={value}\n onChange={props.onChange}\n outcome={props.outcome}\n />\n );\n }\n}\n\nfunction getTargetTypes(property?: ElementDefinition): string[] | undefined {\n return property?.type?.[0]?.targetProfile?.map((p) => p.split('/').pop() as string);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCM,SAAU,qBAAqB,CAAC,KAAiC,EAAA;AACrE,IAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;AAChC,IAAA,MAAM,YAAY,GAAG,KAAK,CAAC,mBAAmB,IAAK,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC,EAAE,IAAqB,CAAC;AAC7F,IAAA,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;AACxB,IAAA,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC;IAEjC,IAAI,QAAQ,CAAC,GAAG,K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,KAAK,CAAC,QAAQ,GAAI,CAAC;QACpF,KAAK,YAAY,CAAC,MAAM,CAAC;QACzB,KAAK,YAAY,CAAC,YAAY;YAC5B,QACE,KAAC,CAAA,aAAA,CAAA,oBAAoB,EACnB,EAAA,QAAQ,EAAE,YAAY,EACtB,YAAY,EAAE,KAAK,EACnB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,CAAA,EACF;AACJ,QAAA;AACE,YAAA,QACE,KAAA,CAAA,aAAA,CAAC,oBAAoB,EAAA,EACnB,QAAQ,EAAE,4BAA4B,CAAC,QAAQ,CAAC,EAChD,YAAY,EAAE,KAAK,EACnB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,CAAA,EACF;AACL,KAAA;AACH,CAAC;AAED,SAAS,cAAc,CAAC,QAA4B,EAAA;IAClD,OAAO,QAAQ,EAAE,IAAI,GAAG,CAAC,CAAC,EAAE,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAY,CAAC,CAAC;AACtF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchUtils.mjs","sources":["../../../src/SearchControl/SearchUtils.tsx"],"sourcesContent":["import {\n capitalize,\n DEFAULT_SEARCH_COUNT,\n evalFhirPathTyped,\n Filter,\n formatDateTime,\n Operator,\n PropertyType,\n SearchRequest,\n} from '@medplum/core';\nimport { ElementDefinition, Resource, SearchParameter } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { getValueAndType, ResourcePropertyDisplay } from '../ResourcePropertyDisplay/ResourcePropertyDisplay';\nimport { SearchControlField } from './SearchControlField';\n\nconst searchParamToOperators: Record<string, Operator[]> = {\n string: [Operator.EQUALS, Operator.NOT, Operator.CONTAINS, Operator.EXACT],\n fulltext: [Operator.EQUALS, Operator.NOT, Operator.CONTAINS, Operator.EXACT],\n token: [Operator.EQUALS, Operator.NOT],\n reference: [Operator.EQUALS, Operator.NOT],\n numeric: [\n Operator.EQUALS,\n Operator.NOT_EQUALS,\n Operator.GREATER_THAN,\n Operator.LESS_THAN,\n Operator.GREATER_THAN_OR_EQUALS,\n Operator.LESS_THAN_OR_EQUALS,\n ],\n quantity: [\n Operator.EQUALS,\n Operator.NOT_EQUALS,\n Operator.GREATER_THAN,\n Operator.LESS_THAN,\n Operator.GREATER_THAN_OR_EQUALS,\n Operator.LESS_THAN_OR_EQUALS,\n ],\n date: [\n Operator.EQUALS,\n Operator.NOT_EQUALS,\n Operator.GREATER_THAN,\n Operator.LESS_THAN,\n Operator.GREATER_THAN_OR_EQUALS,\n Operator.LESS_THAN_OR_EQUALS,\n Operator.STARTS_AFTER,\n Operator.ENDS_BEFORE,\n Operator.APPROXIMATELY,\n ],\n datetime: [\n Operator.EQUALS,\n Operator.NOT_EQUALS,\n Operator.GREATER_THAN,\n Operator.LESS_THAN,\n Operator.GREATER_THAN_OR_EQUALS,\n Operator.LESS_THAN_OR_EQUALS,\n Operator.STARTS_AFTER,\n Operator.ENDS_BEFORE,\n Operator.APPROXIMATELY,\n ],\n};\n\nconst operatorNames: Record<Operator, string> = {\n eq: 'equals',\n ne: 'not equals',\n gt: 'greater than',\n lt: 'less than',\n ge: 'greater than or equals',\n le: 'less than or equals',\n sa: 'starts after',\n eb: 'ends before',\n ap: 'approximately',\n contains: 'contains',\n exact: 'exact',\n text: 'text',\n not: 'not',\n above: 'above',\n below: 'below',\n in: 'in',\n 'not-in': 'not in',\n 'of-type': 'of type',\n missing: 'missing',\n};\n\n/**\n * Sets the array of filters.\n *\n * @param {Array} filters The new filters.\n */\nexport function setFilters(definition: SearchRequest, filters: Filter[]): SearchRequest {\n return {\n ...definition,\n filters: filters,\n offset: 0,\n name: undefined,\n };\n}\n\n/**\n * Clears all of the filters.\n */\nexport function clearFilters(definition: SearchRequest): SearchRequest {\n return setFilters(definition, []);\n}\n\n/**\n * Clears all of the filters on a certain field.\n *\n * @param {string} code The field key name to clear filters.\n */\nexport function clearFiltersOnField(definition: SearchRequest, code: string): SearchRequest {\n return setFilters(\n definition,\n (definition.filters || []).filter((f) => f.code !== code)\n );\n}\n\n/**\n * Adds a filter.\n *\n * @param {string} field The field key name.\n * @param {Operator} op The operation key name.\n * @param {?string} value The filter value.\n * @param {boolean=} opt_clear Optional flag to clear filters on the field.\n */\nexport function addFilter(\n definition: SearchRequest,\n field: string,\n op: Operator,\n value?: string,\n opt_clear?: boolean\n): SearchRequest {\n if (opt_clear) {\n definition = clearFiltersOnField(definition, field);\n }\n\n const nextFilters: Filter[] = [];\n if (definition.filters) {\n nextFilters.push(...definition.filters);\n }\n nextFilters.push({ code: field, operator: op, value: value || '' });\n\n return setFilters(definition, nextFilters);\n}\n\n/**\n * Adds a field.\n *\n * @param {string} field The field key name.\n */\nexport function addField(definition: SearchRequest, field: string): SearchRequest {\n if (definition.fields && definition.fields.includes(field)) {\n return definition;\n }\n const newFields = [];\n if (definition.fields) {\n newFields.push(...definition.fields);\n }\n newFields.push(field);\n return {\n ...definition,\n fields: newFields,\n name: undefined,\n };\n}\n\n/**\n * Deletes a filter at the specified index.\n *\n * @param {number} index The filter index.\n */\nexport function deleteFilter(definition: SearchRequest, index: number): SearchRequest {\n if (!definition.filters) {\n return definition;\n }\n const newFilters = [...definition.filters];\n newFilters.splice(index, 1);\n return {\n ...definition,\n filters: newFilters,\n name: undefined,\n };\n}\n\n/**\n * Adds a filter that constrains the specified field to \"yesterday\".\n *\n * @param {string} field The field key name.\n */\nexport function addYesterdayFilter(definition: SearchRequest, field: string): SearchRequest {\n return addDayFilter(definition, field, -1);\n}\n\n/**\n * Adds a filter that constrains the specified field to \"today\".\n *\n * @param {string} field The field key name.\n */\nexport function addTodayFilter(definition: SearchRequest, field: string): SearchRequest {\n return addDayFilter(definition, field, 0);\n}\n\n/**\n * Adds a filter that constrains the specified field to \"tomorrow\".\n *\n * @param {string} field The field key name.\n */\nexport function addTomorrowFilter(definition: SearchRequest, field: string): SearchRequest {\n return addDayFilter(definition, field, 1);\n}\n\n/**\n * Adds a filter that constrains the specified field to a day.\n * The day is specified as a delta from the current day.\n * \"Today\" would be 0.\n * \"Yesterday\" would be -1.\n * \"Tomorrow\" would be 1.\n *\n * @param {string} field The field key name.\n * @param {number} delta The number of days from this day.\n */\nfunction addDayFilter(definition: SearchRequest, field: string, delta: number): SearchRequest {\n const startTime = new Date();\n startTime.setDate(startTime.getDate() + delta);\n startTime.setHours(0, 0, 0, 0);\n\n const endTime = new Date(startTime.getTime());\n endTime.setDate(endTime.getDate() + 1);\n endTime.setTime(endTime.getTime() - 1);\n\n return addDateFilterBetween(definition, field, startTime, endTime);\n}\n\n/**\n * Adds a filter that constrains the specified field to \"last month\".\n *\n * @param {string} field The field key name.\n */\nexport function addLastMonthFilter(definition: SearchRequest, field: string): SearchRequest {\n return addMonthFilter(definition, field, -1);\n}\n\n/**\n * Adds a filter that constrains the specified field to \"this month\".\n *\n * @param {string} field The field key name.\n */\nexport function addThisMonthFilter(definition: SearchRequest, field: string): SearchRequest {\n return addMonthFilter(definition, field, 0);\n}\n\n/**\n * Adds a filter that constrains the specified field to \"next month\".\n *\n * @param {string} field The field key name.\n */\nexport function addNextMonthFilter(definition: SearchRequest, field: string): SearchRequest {\n return addMonthFilter(definition, field, 1);\n}\n\n/**\n * Adds a filter that constrains the specified field to a month.\n * The month is specified as a delta from the current month.\n * \"This month\" would be 0.\n * \"Last month\" would be -1.\n * \"Next month\" would be 1.\n *\n * @param {string} field The field key name.\n * @param {number} delta The number of months from this month.\n */\nfunction addMonthFilter(definition: SearchRequest, field: string, delta: number): SearchRequest {\n const startTime = new Date();\n startTime.setMonth(startTime.getMonth() + delta);\n startTime.setDate(1);\n startTime.setHours(0, 0, 0, 0);\n\n const endTime = new Date(startTime.getTime());\n endTime.setMonth(endTime.getMonth() + 1);\n endTime.setDate(1);\n endTime.setHours(0, 0, 0, 0);\n endTime.setTime(endTime.getTime() - 1);\n\n return addDateFilterBetween(definition, field, startTime, endTime);\n}\n\n/**\n * Adds a filter that constrains the specified field to the year to date.\n *\n * @param {string} field The field key name.\n */\nexport function addYearToDateFilter(definition: SearchRequest, field: string): SearchRequest {\n const startTime = new Date();\n startTime.setMonth(0);\n startTime.setDate(1);\n startTime.setHours(0, 0, 0, 0);\n\n const endTime = new Date();\n\n return addDateFilterBetween(definition, field, startTime, endTime);\n}\n\n/**\n * Adds a filter for a date between two dates (inclusive of both dates).\n *\n * @param {string} field The field key name.\n * @param {Date} d1 The start date.\n * @param {Date} d2 The end date.\n */\nexport function addDateFilterBetween(definition: SearchRequest, field: string, d1: Date, d2: Date): SearchRequest {\n definition = clearFiltersOnField(definition, field);\n definition = addDateFilterImpl(definition, field, Operator.GREATER_THAN_OR_EQUALS, d1);\n definition = addDateFilterImpl(definition, field, Operator.LESS_THAN_OR_EQUALS, d2);\n return definition;\n}\n\n/**\n * Adds a filter for a date before a certain date/time.\n *\n * @param {string} field The field key name.\n * @param {Operator} op The date/time operation.\n * @param {Date} value The date.\n */\nfunction addDateFilterImpl(definition: SearchRequest, field: string, op: Operator, value: Date): SearchRequest {\n return addFilter(definition, field, op, value.toISOString());\n}\n\n/**\n * Adds a filter that constrains the specified field to \"missing\".\n *\n * @param {string} field The field key name.\n */\nexport function addMissingFilter(definition: SearchRequest, field: string, value = true): SearchRequest {\n return addFilter(definition, field, Operator.MISSING, value.toString());\n}\n\n/**\n * Sets the offset (starting at zero).\n *\n * @param {number} offset The offset number.\n */\nexport function setOffset(definition: SearchRequest, offset: number): SearchRequest {\n if (definition.offset === offset) {\n return definition;\n }\n return {\n ...definition,\n offset,\n name: undefined,\n };\n}\n\n/**\n * Creates a new search request with the search offset at the specified page.\n * @param definition The search definition.\n * @param page The new page number\n * @return The new search definition.\n */\nexport function setPage(definition: SearchRequest, page: number): SearchRequest {\n const count = definition.count ?? DEFAULT_SEARCH_COUNT;\n const newOffset = (page - 1) * count;\n return setOffset(definition, newOffset);\n}\n\n/**\n * Sorts the search by the specified key, and optional direction.\n * Direction defaults to ascending ('asc') if not specified.\n *\n * @param {string} sortField The sort key.\n */\nexport function setSort(definition: SearchRequest, sort: string, desc?: boolean): SearchRequest {\n if (sort === getSortField(definition) && desc !== undefined && desc === isSortDescending(definition)) {\n return definition;\n }\n return {\n ...definition,\n sortRules: [\n {\n code: sort,\n descending: !!desc,\n },\n ],\n name: undefined,\n };\n}\n\n/**\n * Toggles the sort of the search by key.\n * If the search is already sorted by the key, reverses the direction.\n * If the search is not sorted by the key, sort in ascending order.\n *\n * @param {string} key The field key name.\n */\nexport function toggleSort(definition: SearchRequest, key: string): SearchRequest {\n let desc = false;\n if (getSortField(definition) === key) {\n desc = !isSortDescending(definition);\n }\n return setSort(definition, key, desc);\n}\n\nexport function getSortField(definition: SearchRequest): string | undefined {\n const sortRules = definition.sortRules;\n if (!sortRules || sortRules.length === 0) {\n return undefined;\n }\n const field = sortRules[0].code;\n return field.startsWith('-') ? field.substr(1) : field;\n}\n\nexport function isSortDescending(definition: SearchRequest): boolean {\n const sortRules = definition.sortRules;\n if (!sortRules || sortRules.length === 0) {\n return false;\n }\n return !!sortRules[0].descending;\n}\n\n/**\n * Returns a list of operators for a search parameter.\n * @param searchParam The search parameter.\n * @returns The list of operators that can be used for the search parameter.\n */\nexport function getSearchOperators(searchParam: SearchParameter): Operator[] | undefined {\n return searchParamToOperators[searchParam.type as string];\n}\n\n/**\n * Returns a string representing the operation.\n *\n * @param {string} op The operation code.\n * @return {string} A display string for the operation.\n */\nexport function getOpString(op: Operator): string {\n return operatorNames[op] ?? '';\n}\n\n/**\n * Returns a field display name.\n * @param key The field key.\n * @returns The field display name.\n */\nexport function buildFieldNameString(key: string): string {\n let tmp = key;\n\n // If dot separated, only the last part\n if (tmp.includes('.')) {\n tmp = tmp.split('.').pop() as string;\n }\n\n // Special case for ID\n if (tmp === 'id') {\n return 'ID';\n }\n\n // Special case for Version ID\n if (tmp === 'versionId') {\n return 'Version ID';\n }\n\n // Remove choice of type\n tmp = tmp.replace('[x]', '');\n\n // Convert camel case to space separated\n tmp = tmp.replace(/([A-Z])/g, ' $1');\n\n // Convert dashes and underscores to spaces\n tmp = tmp.replace(/[-_]/g, ' ');\n\n // Normalize whitespace to single space character\n tmp = tmp.replace(/\\s+/g, ' ');\n\n // Trim\n tmp = tmp.trim();\n\n // Capitalize the first letter of each word\n return tmp.split(/\\s/).map(capitalize).join(' ');\n}\n\n/**\n * Returns a fragment to be displayed in the search table for the value.\n * @param resource The parent resource.\n * @param key The search code or FHIRPath expression.\n * @returns The fragment to display.\n */\nexport function renderValue(resource: Resource, field: SearchControlField): string | JSX.Element | null | undefined {\n const key = field.name;\n if (key === 'id') {\n return resource.id;\n }\n\n if (key === 'meta.versionId') {\n return resource.meta?.versionId;\n }\n\n if (key === '_lastUpdated') {\n return formatDateTime(resource.meta?.lastUpdated);\n }\n\n // Priority 1: ElementDefinition by exact match\n if (field.elementDefinition && `${resource.resourceType}.${field.name}` === field.elementDefinition.path) {\n return renderPropertyValue(resource, field.elementDefinition);\n }\n\n // Priority 2: SearchParameter by exact match\n if (field.searchParams && field.searchParams.length === 1 && field.name === field.searchParams[0].code) {\n return renderSearchParameterValue(resource, field.searchParams[0], field.elementDefinition);\n }\n\n // We don't know how to render this field definition\n return null;\n}\n\n/**\n * Returns a fragment to be displayed in the search table for a resource property.\n * @param resource The parent resource.\n * @param elementDefinition The property element definition.\n * @returns A React element or null.\n */\nfunction renderPropertyValue(resource: Resource, elementDefinition: ElementDefinition): JSX.Element | null {\n const path = elementDefinition.path?.split('.')?.pop()?.replaceAll('[x]', '') || '';\n const [value, propertyType] = getValueAndType({ type: resource.resourceType, value: resource }, path);\n if (!value) {\n return null;\n }\n\n return (\n <ResourcePropertyDisplay\n property={elementDefinition}\n propertyType={propertyType}\n value={value}\n maxWidth={200}\n ignoreMissingValues={true}\n link={false}\n />\n );\n}\n\n/**\n * Returns a fragment to be displayed in the search table for a search parameter.\n * @param resource The parent resource.\n * @param searchParam The search parameter.\n * @param elementDefinition Optional element definition.\n * @returns A React element or null.\n */\nfunction renderSearchParameterValue(\n resource: Resource,\n searchParam: SearchParameter,\n elementDefinition: ElementDefinition | undefined\n): JSX.Element | null {\n const value = evalFhirPathTyped(searchParam.expression as string, [{ type: resource.resourceType, value: resource }]);\n if (!value || value.length === 0) {\n return null;\n }\n\n if (elementDefinition) {\n return (\n <ResourcePropertyDisplay\n propertyType={value[0].type as PropertyType}\n value={value[0].value}\n maxWidth={200}\n ignoreMissingValues={true}\n link={false}\n />\n );\n }\n\n return (\n <>\n {value.map((v, index) => (\n <span key={`${index}-${value.length}`}>\n {typeof v === 'object' ? JSON.stringify(v) : (v as string | number)}\n </span>\n ))}\n </>\n );\n}\n"],"names":[],"mappings":";;;;AAeA,MAAM,sBAAsB,GAA+B;AACzD,IAAA,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC;AAC1E,IAAA,QAAQ,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC;IAC5E,KAAK,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC;IACtC,SAAS,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC;AAC1C,IAAA,OAAO,EAAE;AACP,QAAA,QAAQ,CAAC,MAAM;AACf,QAAA,QAAQ,CAAC,UAAU;AACnB,QAAA,QAAQ,CAAC,YAAY;AACrB,QAAA,QAAQ,CAAC,SAAS;AAClB,QAAA,QAAQ,CAAC,sBAAsB;AAC/B,QAAA,QAAQ,CAAC,mBAAmB;AAC7B,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,QAAQ,CAAC,MAAM;AACf,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I,iBAAiB,EAAE;AACrB,QAAA,QACE,KAAA,CAAA,aAAA,CAAC,uBAAuB,EAAA,EACtB,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAoB,EAC3C,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,EACrB,QAAQ,EAAE,GAAG,EACb,mBAAmB,EAAE,IAAI,EACzB,IAAI,EAAE,KAAK,EAAA,CACX,EACF;AACH,KAAA;IAED,QACE,0CACG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,MAClB,KAAM,CAAA,aAAA,CAAA,MAAA,EAAA,EAAA,GAAG,EAAE,CAAG,EAAA,KAAK,CAAI,CAAA,EAAA,KAAK,CAAC,MAAM,EAAE,EAClC,EAAA,OAAO,CAAC,KAAK,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAI,CAAqB,CAC9D,CACR,CAAC,CACD,EACH;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"SearchUtils.mjs","sources":["../../../src/SearchControl/SearchUtils.tsx"],"sourcesContent":["import {\n capitalize,\n DEFAULT_SEARCH_COUNT,\n evalFhirPathTyped,\n Filter,\n formatDateTime,\n Operator,\n PropertyType,\n SearchRequest,\n} from '@medplum/core';\nimport { ElementDefinition, Resource, SearchParameter } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { getValueAndType, ResourcePropertyDisplay } from '../ResourcePropertyDisplay/ResourcePropertyDisplay';\nimport { SearchControlField } from './SearchControlField';\n\nconst searchParamToOperators: Record<string, Operator[]> = {\n string: [Operator.EQUALS, Operator.NOT, Operator.CONTAINS, Operator.EXACT],\n fulltext: [Operator.EQUALS, Operator.NOT, Operator.CONTAINS, Operator.EXACT],\n token: [Operator.EQUALS, Operator.NOT],\n reference: [Operator.EQUALS, Operator.NOT],\n numeric: [\n Operator.EQUALS,\n Operator.NOT_EQUALS,\n Operator.GREATER_THAN,\n Operator.LESS_THAN,\n Operator.GREATER_THAN_OR_EQUALS,\n Operator.LESS_THAN_OR_EQUALS,\n ],\n quantity: [\n Operator.EQUALS,\n Operator.NOT_EQUALS,\n Operator.GREATER_THAN,\n Operator.LESS_THAN,\n Operator.GREATER_THAN_OR_EQUALS,\n Operator.LESS_THAN_OR_EQUALS,\n ],\n date: [\n Operator.EQUALS,\n Operator.NOT_EQUALS,\n Operator.GREATER_THAN,\n Operator.LESS_THAN,\n Operator.GREATER_THAN_OR_EQUALS,\n Operator.LESS_THAN_OR_EQUALS,\n Operator.STARTS_AFTER,\n Operator.ENDS_BEFORE,\n Operator.APPROXIMATELY,\n ],\n datetime: [\n Operator.EQUALS,\n Operator.NOT_EQUALS,\n Operator.GREATER_THAN,\n Operator.LESS_THAN,\n Operator.GREATER_THAN_OR_EQUALS,\n Operator.LESS_THAN_OR_EQUALS,\n Operator.STARTS_AFTER,\n Operator.ENDS_BEFORE,\n Operator.APPROXIMATELY,\n ],\n};\n\nconst operatorNames: Record<Operator, string> = {\n eq: 'equals',\n ne: 'not equals',\n gt: 'greater than',\n lt: 'less than',\n ge: 'greater than or equals',\n le: 'less than or equals',\n sa: 'starts after',\n eb: 'ends before',\n ap: 'approximately',\n contains: 'contains',\n exact: 'exact',\n text: 'text',\n not: 'not',\n above: 'above',\n below: 'below',\n in: 'in',\n 'not-in': 'not in',\n 'of-type': 'of type',\n missing: 'missing',\n identifier: 'identifier',\n};\n\n/**\n * Sets the array of filters.\n *\n * @param {Array} filters The new filters.\n */\nexport function setFilters(definition: SearchRequest, filters: Filter[]): SearchRequest {\n return {\n ...definition,\n filters: filters,\n offset: 0,\n name: undefined,\n };\n}\n\n/**\n * Clears all of the filters.\n */\nexport function clearFilters(definition: SearchRequest): SearchRequest {\n return setFilters(definition, []);\n}\n\n/**\n * Clears all of the filters on a certain field.\n *\n * @param {string} code The field key name to clear filters.\n */\nexport function clearFiltersOnField(definition: SearchRequest, code: string): SearchRequest {\n return setFilters(\n definition,\n (definition.filters || []).filter((f) => f.code !== code)\n );\n}\n\n/**\n * Adds a filter.\n *\n * @param {string} field The field key name.\n * @param {Operator} op The operation key name.\n * @param {?string} value The filter value.\n * @param {boolean=} opt_clear Optional flag to clear filters on the field.\n */\nexport function addFilter(\n definition: SearchRequest,\n field: string,\n op: Operator,\n value?: string,\n opt_clear?: boolean\n): SearchRequest {\n if (opt_clear) {\n definition = clearFiltersOnField(definition, field);\n }\n\n const nextFilters: Filter[] = [];\n if (definition.filters) {\n nextFilters.push(...definition.filters);\n }\n nextFilters.push({ code: field, operator: op, value: value || '' });\n\n return setFilters(definition, nextFilters);\n}\n\n/**\n * Adds a field.\n *\n * @param {string} field The field key name.\n */\nexport function addField(definition: SearchRequest, field: string): SearchRequest {\n if (definition.fields && definition.fields.includes(field)) {\n return definition;\n }\n const newFields = [];\n if (definition.fields) {\n newFields.push(...definition.fields);\n }\n newFields.push(field);\n return {\n ...definition,\n fields: newFields,\n name: undefined,\n };\n}\n\n/**\n * Deletes a filter at the specified index.\n *\n * @param {number} index The filter index.\n */\nexport function deleteFilter(definition: SearchRequest, index: number): SearchRequest {\n if (!definition.filters) {\n return definition;\n }\n const newFilters = [...definition.filters];\n newFilters.splice(index, 1);\n return {\n ...definition,\n filters: newFilters,\n name: undefined,\n };\n}\n\n/**\n * Adds a filter that constrains the specified field to \"yesterday\".\n *\n * @param {string} field The field key name.\n */\nexport function addYesterdayFilter(definition: SearchRequest, field: string): SearchRequest {\n return addDayFilter(definition, field, -1);\n}\n\n/**\n * Adds a filter that constrains the specified field to \"today\".\n *\n * @param {string} field The field key name.\n */\nexport function addTodayFilter(definition: SearchRequest, field: string): SearchRequest {\n return addDayFilter(definition, field, 0);\n}\n\n/**\n * Adds a filter that constrains the specified field to \"tomorrow\".\n *\n * @param {string} field The field key name.\n */\nexport function addTomorrowFilter(definition: SearchRequest, field: string): SearchRequest {\n return addDayFilter(definition, field, 1);\n}\n\n/**\n * Adds a filter that constrains the specified field to a day.\n * The day is specified as a delta from the current day.\n * \"Today\" would be 0.\n * \"Yesterday\" would be -1.\n * \"Tomorrow\" would be 1.\n *\n * @param {string} field The field key name.\n * @param {number} delta The number of days from this day.\n */\nfunction addDayFilter(definition: SearchRequest, field: string, delta: number): SearchRequest {\n const startTime = new Date();\n startTime.setDate(startTime.getDate() + delta);\n startTime.setHours(0, 0, 0, 0);\n\n const endTime = new Date(startTime.getTime());\n endTime.setDate(endTime.getDate() + 1);\n endTime.setTime(endTime.getTime() - 1);\n\n return addDateFilterBetween(definition, field, startTime, endTime);\n}\n\n/**\n * Adds a filter that constrains the specified field to \"last month\".\n *\n * @param {string} field The field key name.\n */\nexport function addLastMonthFilter(definition: SearchRequest, field: string): SearchRequest {\n return addMonthFilter(definition, field, -1);\n}\n\n/**\n * Adds a filter that constrains the specified field to \"this month\".\n *\n * @param {string} field The field key name.\n */\nexport function addThisMonthFilter(definition: SearchRequest, field: string): SearchRequest {\n return addMonthFilter(definition, field, 0);\n}\n\n/**\n * Adds a filter that constrains the specified field to \"next month\".\n *\n * @param {string} field The field key name.\n */\nexport function addNextMonthFilter(definition: SearchRequest, field: string): SearchRequest {\n return addMonthFilter(definition, field, 1);\n}\n\n/**\n * Adds a filter that constrains the specified field to a month.\n * The month is specified as a delta from the current month.\n * \"This month\" would be 0.\n * \"Last month\" would be -1.\n * \"Next month\" would be 1.\n *\n * @param {string} field The field key name.\n * @param {number} delta The number of months from this month.\n */\nfunction addMonthFilter(definition: SearchRequest, field: string, delta: number): SearchRequest {\n const startTime = new Date();\n startTime.setMonth(startTime.getMonth() + delta);\n startTime.setDate(1);\n startTime.setHours(0, 0, 0, 0);\n\n const endTime = new Date(startTime.getTime());\n endTime.setMonth(endTime.getMonth() + 1);\n endTime.setDate(1);\n endTime.setHours(0, 0, 0, 0);\n endTime.setTime(endTime.getTime() - 1);\n\n return addDateFilterBetween(definition, field, startTime, endTime);\n}\n\n/**\n * Adds a filter that constrains the specified field to the year to date.\n *\n * @param {string} field The field key name.\n */\nexport function addYearToDateFilter(definition: SearchRequest, field: string): SearchRequest {\n const startTime = new Date();\n startTime.setMonth(0);\n startTime.setDate(1);\n startTime.setHours(0, 0, 0, 0);\n\n const endTime = new Date();\n\n return addDateFilterBetween(definition, field, startTime, endTime);\n}\n\n/**\n * Adds a filter for a date between two dates (inclusive of both dates).\n *\n * @param {string} field The field key name.\n * @param {Date} d1 The start date.\n * @param {Date} d2 The end date.\n */\nexport function addDateFilterBetween(definition: SearchRequest, field: string, d1: Date, d2: Date): SearchRequest {\n definition = clearFiltersOnField(definition, field);\n definition = addDateFilterImpl(definition, field, Operator.GREATER_THAN_OR_EQUALS, d1);\n definition = addDateFilterImpl(definition, field, Operator.LESS_THAN_OR_EQUALS, d2);\n return definition;\n}\n\n/**\n * Adds a filter for a date before a certain date/time.\n *\n * @param {string} field The field key name.\n * @param {Operator} op The date/time operation.\n * @param {Date} value The date.\n */\nfunction addDateFilterImpl(definition: SearchRequest, field: string, op: Operator, value: Date): SearchRequest {\n return addFilter(definition, field, op, value.toISOString());\n}\n\n/**\n * Adds a filter that constrains the specified field to \"missing\".\n *\n * @param {string} field The field key name.\n */\nexport function addMissingFilter(definition: SearchRequest, field: string, value = true): SearchRequest {\n return addFilter(definition, field, Operator.MISSING, value.toString());\n}\n\n/**\n * Sets the offset (starting at zero).\n *\n * @param {number} offset The offset number.\n */\nexport function setOffset(definition: SearchRequest, offset: number): SearchRequest {\n if (definition.offset === offset) {\n return definition;\n }\n return {\n ...definition,\n offset,\n name: undefined,\n };\n}\n\n/**\n * Creates a new search request with the search offset at the specified page.\n * @param definition The search definition.\n * @param page The new page number\n * @return The new search definition.\n */\nexport function setPage(definition: SearchRequest, page: number): SearchRequest {\n const count = definition.count ?? DEFAULT_SEARCH_COUNT;\n const newOffset = (page - 1) * count;\n return setOffset(definition, newOffset);\n}\n\n/**\n * Sorts the search by the specified key, and optional direction.\n * Direction defaults to ascending ('asc') if not specified.\n *\n * @param {string} sortField The sort key.\n */\nexport function setSort(definition: SearchRequest, sort: string, desc?: boolean): SearchRequest {\n if (sort === getSortField(definition) && desc !== undefined && desc === isSortDescending(definition)) {\n return definition;\n }\n return {\n ...definition,\n sortRules: [\n {\n code: sort,\n descending: !!desc,\n },\n ],\n name: undefined,\n };\n}\n\n/**\n * Toggles the sort of the search by key.\n * If the search is already sorted by the key, reverses the direction.\n * If the search is not sorted by the key, sort in ascending order.\n *\n * @param {string} key The field key name.\n */\nexport function toggleSort(definition: SearchRequest, key: string): SearchRequest {\n let desc = false;\n if (getSortField(definition) === key) {\n desc = !isSortDescending(definition);\n }\n return setSort(definition, key, desc);\n}\n\nexport function getSortField(definition: SearchRequest): string | undefined {\n const sortRules = definition.sortRules;\n if (!sortRules || sortRules.length === 0) {\n return undefined;\n }\n const field = sortRules[0].code;\n return field.startsWith('-') ? field.substr(1) : field;\n}\n\nexport function isSortDescending(definition: SearchRequest): boolean {\n const sortRules = definition.sortRules;\n if (!sortRules || sortRules.length === 0) {\n return false;\n }\n return !!sortRules[0].descending;\n}\n\n/**\n * Returns a list of operators for a search parameter.\n * @param searchParam The search parameter.\n * @returns The list of operators that can be used for the search parameter.\n */\nexport function getSearchOperators(searchParam: SearchParameter): Operator[] | undefined {\n return searchParamToOperators[searchParam.type as string];\n}\n\n/**\n * Returns a string representing the operation.\n *\n * @param {string} op The operation code.\n * @return {string} A display string for the operation.\n */\nexport function getOpString(op: Operator): string {\n return operatorNames[op] ?? '';\n}\n\n/**\n * Returns a field display name.\n * @param key The field key.\n * @returns The field display name.\n */\nexport function buildFieldNameString(key: string): string {\n let tmp = key;\n\n // If dot separated, only the last part\n if (tmp.includes('.')) {\n tmp = tmp.split('.').pop() as string;\n }\n\n // Special case for ID\n if (tmp === 'id') {\n return 'ID';\n }\n\n // Special case for Version ID\n if (tmp === 'versionId') {\n return 'Version ID';\n }\n\n // Remove choice of type\n tmp = tmp.replace('[x]', '');\n\n // Convert camel case to space separated\n tmp = tmp.replace(/([A-Z])/g, ' $1');\n\n // Convert dashes and underscores to spaces\n tmp = tmp.replace(/[-_]/g, ' ');\n\n // Normalize whitespace to single space character\n tmp = tmp.replace(/\\s+/g, ' ');\n\n // Trim\n tmp = tmp.trim();\n\n // Capitalize the first letter of each word\n return tmp.split(/\\s/).map(capitalize).join(' ');\n}\n\n/**\n * Returns a fragment to be displayed in the search table for the value.\n * @param resource The parent resource.\n * @param key The search code or FHIRPath expression.\n * @returns The fragment to display.\n */\nexport function renderValue(resource: Resource, field: SearchControlField): string | JSX.Element | null | undefined {\n const key = field.name;\n if (key === 'id') {\n return resource.id;\n }\n\n if (key === 'meta.versionId') {\n return resource.meta?.versionId;\n }\n\n if (key === '_lastUpdated') {\n return formatDateTime(resource.meta?.lastUpdated);\n }\n\n // Priority 1: ElementDefinition by exact match\n if (field.elementDefinition && `${resource.resourceType}.${field.name}` === field.elementDefinition.path) {\n return renderPropertyValue(resource, field.elementDefinition);\n }\n\n // Priority 2: SearchParameter by exact match\n if (field.searchParams && field.searchParams.length === 1 && field.name === field.searchParams[0].code) {\n return renderSearchParameterValue(resource, field.searchParams[0], field.elementDefinition);\n }\n\n // We don't know how to render this field definition\n return null;\n}\n\n/**\n * Returns a fragment to be displayed in the search table for a resource property.\n * @param resource The parent resource.\n * @param elementDefinition The property element definition.\n * @returns A React element or null.\n */\nfunction renderPropertyValue(resource: Resource, elementDefinition: ElementDefinition): JSX.Element | null {\n const path = elementDefinition.path?.split('.')?.pop()?.replaceAll('[x]', '') || '';\n const [value, propertyType] = getValueAndType({ type: resource.resourceType, value: resource }, path);\n if (!value) {\n return null;\n }\n\n return (\n <ResourcePropertyDisplay\n property={elementDefinition}\n propertyType={propertyType}\n value={value}\n maxWidth={200}\n ignoreMissingValues={true}\n link={false}\n />\n );\n}\n\n/**\n * Returns a fragment to be displayed in the search table for a search parameter.\n * @param resource The parent resource.\n * @param searchParam The search parameter.\n * @param elementDefinition Optional element definition.\n * @returns A React element or null.\n */\nfunction renderSearchParameterValue(\n resource: Resource,\n searchParam: SearchParameter,\n elementDefinition: ElementDefinition | undefined\n): JSX.Element | null {\n const value = evalFhirPathTyped(searchParam.expression as string, [{ type: resource.resourceType, value: resource }]);\n if (!value || value.length === 0) {\n return null;\n }\n\n if (elementDefinition) {\n return (\n <ResourcePropertyDisplay\n propertyType={value[0].type as PropertyType}\n value={value[0].value}\n maxWidth={200}\n ignoreMissingValues={true}\n link={false}\n />\n );\n }\n\n return (\n <>\n {value.map((v, index) => (\n <span key={`${index}-${value.length}`}>\n {typeof v === 'object' ? JSON.stringify(v) : (v as string | number)}\n </span>\n ))}\n </>\n );\n}\n"],"names":[],"mappings":";;;;AAeA,MAAM,sBAAsB,GAA+B;AACzD,IAAA,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC;AAC1E,IAAA,QAAQ,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC;IAC5E,KAAK,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC;IACtC,SAAS,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC;AAC1C,IAAA,OAAO,EAAE;AACP,QAAA,QAAQ,CAAC,MAAM;AACf,QAAA,QAAQ,CAAC,UAAU;AACnB,QAAA,QAAQ,CAAC,YAAY;AACrB,QAAA,QAAQ,CAAC,SAAS;AAClB,QAAA,QAAQ,CAAC,sBAAsB;AAC/B,QAAA,QAAQ,CAAC,mBAAmB;AAC7B,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,QAAQ,CAAC,MAAM;AACf,QAAA,QAAQ,CAAC,UAAU;AACnB,QAAA,QAAQ,CAAC,YAAY;AACrB,QAAA,QAAQ,CAAC,SAAS;AAClB,QAAA,QAAQ,CAAC,sBAAsB;AAC/B,QAAA,QAAQ,CAAC,mBAAmB;AA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