@medplum/react 2.0.7 → 2.0.10
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 +29 -15
- 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/ExtensionInput/ExtensionInput.mjs +1 -1
- package/dist/esm/ExtensionInput/ExtensionInput.mjs.map +1 -1
- package/dist/esm/FormSection/FormSection.mjs +1 -1
- package/dist/esm/FormSection/FormSection.mjs.map +1 -1
- package/dist/esm/HumanNameInput/HumanNameInput.mjs +5 -5
- package/dist/esm/HumanNameInput/HumanNameInput.mjs.map +1 -1
- package/dist/esm/ResourceName/ResourceName.mjs +5 -0
- package/dist/esm/ResourceName/ResourceName.mjs.map +1 -1
- package/dist/esm/ResourcePropertyDisplay/ResourcePropertyDisplay.mjs +3 -0
- package/dist/esm/ResourcePropertyDisplay/ResourcePropertyDisplay.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/ValueSetAutocomplete/ValueSetAutocomplete.mjs +3 -0
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.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/dist/types/ResourceName/ResourceName.d.ts +5 -0
- package/dist/types/ResourcePropertyDisplay/ResourcePropertyDisplay.d.ts +3 -0
- package/dist/types/ValueSetAutocomplete/ValueSetAutocomplete.d.ts +3 -0
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -1792,6 +1792,9 @@
|
|
|
1792
1792
|
React.createElement(ResourcePropertyDisplay, { arrayElement: true, property: property, propertyType: propertyType, value: v, ignoreMissingValues: props.ignoreMissingValues, link: props.link }))))));
|
|
1793
1793
|
}
|
|
1794
1794
|
|
|
1795
|
+
/**
|
|
1796
|
+
* Low-level component that renders a property from a given resource, given type information
|
|
1797
|
+
*/
|
|
1795
1798
|
function ResourcePropertyDisplay(props) {
|
|
1796
1799
|
const { property, propertyType, value } = props;
|
|
1797
1800
|
if (property?.max === '*' && !props.arrayElement) {
|
|
@@ -1929,11 +1932,11 @@
|
|
|
1929
1932
|
return (React.createElement(core$1.Group, { noWrap: true },
|
|
1930
1933
|
React.createElement("div", null, props.children),
|
|
1931
1934
|
React.createElement("div", null,
|
|
1932
|
-
React.createElement(core$1.Input.Wrapper, { id: props.htmlFor, label: props.title, description: props.description }, (() => null)()))));
|
|
1935
|
+
React.createElement(core$1.Input.Wrapper, { id: props.htmlFor, label: props.title, description: props.description, withAsterisk: props.withAsterisk }, (() => null)()))));
|
|
1933
1936
|
}
|
|
1934
1937
|
|
|
1935
1938
|
function FormSection(props) {
|
|
1936
|
-
return (React.createElement(core$1.Input.Wrapper, { id: props.htmlFor, label: props.title, description: props.description, error: getErrorsForInput(props.outcome, props.htmlFor) }, props.children));
|
|
1939
|
+
return (React.createElement(core$1.Input.Wrapper, { id: props.htmlFor, label: props.title, description: props.description, withAsterisk: props.withAsterisk, error: getErrorsForInput(props.outcome, props.htmlFor) }, props.children));
|
|
1937
1940
|
}
|
|
1938
1941
|
|
|
1939
1942
|
/**
|
|
@@ -2059,6 +2062,9 @@
|
|
|
2059
2062
|
display: input,
|
|
2060
2063
|
};
|
|
2061
2064
|
}
|
|
2065
|
+
/**
|
|
2066
|
+
* A low-level component to autocomplete based on a FHIR Valueset.
|
|
2067
|
+
*/
|
|
2062
2068
|
function ValueSetAutocomplete(props) {
|
|
2063
2069
|
const medplum = useMedplum();
|
|
2064
2070
|
const { elementDefinition, ...rest } = props;
|
|
@@ -2235,7 +2241,7 @@
|
|
|
2235
2241
|
* @returns The JSX element to render.
|
|
2236
2242
|
*/
|
|
2237
2243
|
function DateTimeInput(props) {
|
|
2238
|
-
return (React.createElement(core$1.TextInput, { id: props.name, name: props.name, "data-testid": props.name, placeholder: props.placeholder, type: getInputType(), defaultValue: convertIsoToLocal(props.defaultValue), error: getErrorsForInput(props.outcome, props.name), onChange: (e) => {
|
|
2244
|
+
return (React.createElement(core$1.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) => {
|
|
2239
2245
|
if (props.onChange) {
|
|
2240
2246
|
const newValue = e.currentTarget.value;
|
|
2241
2247
|
props.onChange(convertLocalToIso(newValue));
|
|
@@ -2290,7 +2296,7 @@
|
|
|
2290
2296
|
}
|
|
2291
2297
|
|
|
2292
2298
|
function ExtensionInput(props) {
|
|
2293
|
-
return (React.createElement(core$1.JsonInput, { id: props.name, name: props.name, "data-testid": "extension-input", defaultValue: core.stringify(props.defaultValue), onChange: (newValue) => {
|
|
2299
|
+
return (React.createElement(core$1.JsonInput, { id: props.name, name: props.name, "data-testid": "extension-input", defaultValue: core.stringify(props.defaultValue), deserialize: JSON.parse, onChange: (newValue) => {
|
|
2294
2300
|
if (props.onChange) {
|
|
2295
2301
|
props.onChange(JSON.parse(newValue));
|
|
2296
2302
|
}
|
|
@@ -2335,11 +2341,11 @@
|
|
|
2335
2341
|
});
|
|
2336
2342
|
}
|
|
2337
2343
|
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
2338
|
-
React.createElement(core$1.NativeSelect, { defaultValue: value?.use, "data-testid": "use", onChange: (e) => setUse(e.currentTarget.value), data: ['', 'temp', 'old', 'usual', 'official', 'nickname', 'anonymous', 'maiden'] }),
|
|
2339
|
-
React.createElement(core$1.TextInput, { placeholder: "Prefix", defaultValue: value?.prefix?.join(' '), onChange: (e) => setPrefix(e.currentTarget.value) }),
|
|
2340
|
-
React.createElement(core$1.TextInput, { placeholder: "Given", defaultValue: value?.given?.join(' '), onChange: (e) => setGiven(e.currentTarget.value) }),
|
|
2341
|
-
React.createElement(core$1.TextInput, { placeholder: "Family", defaultValue: value?.family, onChange: (e) => setFamily(e.currentTarget.value) }),
|
|
2342
|
-
React.createElement(core$1.TextInput, { placeholder: "Suffix", defaultValue: value?.suffix?.join(' '), onChange: (e) => setSuffix(e.currentTarget.value) })));
|
|
2344
|
+
React.createElement(core$1.NativeSelect, { defaultValue: value?.use, name: props.name + '-use', "data-testid": "use", onChange: (e) => setUse(e.currentTarget.value), data: ['', 'temp', 'old', 'usual', 'official', 'nickname', 'anonymous', 'maiden'] }),
|
|
2345
|
+
React.createElement(core$1.TextInput, { placeholder: "Prefix", name: props.name + '-prefix', defaultValue: value?.prefix?.join(' '), onChange: (e) => setPrefix(e.currentTarget.value) }),
|
|
2346
|
+
React.createElement(core$1.TextInput, { placeholder: "Given", name: props.name + '-given', defaultValue: value?.given?.join(' '), onChange: (e) => setGiven(e.currentTarget.value) }),
|
|
2347
|
+
React.createElement(core$1.TextInput, { name: props.name + '-family', placeholder: "Family", defaultValue: value?.family, onChange: (e) => setFamily(e.currentTarget.value) }),
|
|
2348
|
+
React.createElement(core$1.TextInput, { placeholder: "Suffix", name: props.name + '-suffix', defaultValue: value?.suffix?.join(' '), onChange: (e) => setSuffix(e.currentTarget.value) })));
|
|
2343
2349
|
}
|
|
2344
2350
|
|
|
2345
2351
|
function IdentifierInput(props) {
|
|
@@ -2777,6 +2783,7 @@
|
|
|
2777
2783
|
const propertyType = props.elementDefinitionType.code;
|
|
2778
2784
|
const name = props.name;
|
|
2779
2785
|
const value = props.defaultValue;
|
|
2786
|
+
const required = property.min !== undefined && property.min > 0;
|
|
2780
2787
|
switch (propertyType) {
|
|
2781
2788
|
// 2.24.0.1 Primitive Types
|
|
2782
2789
|
// https://www.hl7.org/fhir/datatypes.html#primitive
|
|
@@ -2786,13 +2793,13 @@
|
|
|
2786
2793
|
case core.PropertyType.time:
|
|
2787
2794
|
case core.PropertyType.uri:
|
|
2788
2795
|
case core.PropertyType.url:
|
|
2789
|
-
return (React.createElement(core$1.TextInput, { id: name, name: name, "data-testid": name, defaultValue: value, onChange: (e) => {
|
|
2796
|
+
return (React.createElement(core$1.TextInput, { id: name, name: name, "data-testid": name, defaultValue: value, required: required, onChange: (e) => {
|
|
2790
2797
|
if (props.onChange) {
|
|
2791
2798
|
props.onChange(e.currentTarget.value);
|
|
2792
2799
|
}
|
|
2793
2800
|
}, error: getErrorsForInput(props.outcome, name) }));
|
|
2794
2801
|
case core.PropertyType.date:
|
|
2795
|
-
return (React.createElement(core$1.TextInput, { type: "date", id: name, name: name, "data-testid": name, defaultValue: value, onChange: (e) => {
|
|
2802
|
+
return (React.createElement(core$1.TextInput, { type: "date", id: name, name: name, "data-testid": name, defaultValue: value, required: required, onChange: (e) => {
|
|
2796
2803
|
if (props.onChange) {
|
|
2797
2804
|
props.onChange(e.currentTarget.value);
|
|
2798
2805
|
}
|
|
@@ -2804,7 +2811,7 @@
|
|
|
2804
2811
|
case core.PropertyType.integer:
|
|
2805
2812
|
case core.PropertyType.positiveInt:
|
|
2806
2813
|
case core.PropertyType.unsignedInt:
|
|
2807
|
-
return (React.createElement(core$1.TextInput, { type: "number", step: propertyType === core.PropertyType.decimal ? 'any' : '1', id: name, name: name, "data-testid": name, defaultValue: value, onChange: (e) => {
|
|
2814
|
+
return (React.createElement(core$1.TextInput, { type: "number", step: propertyType === core.PropertyType.decimal ? 'any' : '1', id: name, name: name, "data-testid": name, defaultValue: value, required: required, onChange: (e) => {
|
|
2808
2815
|
if (props.onChange) {
|
|
2809
2816
|
props.onChange(e.currentTarget.valueAsNumber);
|
|
2810
2817
|
}
|
|
@@ -2818,7 +2825,7 @@
|
|
|
2818
2825
|
}
|
|
2819
2826
|
} }));
|
|
2820
2827
|
case core.PropertyType.markdown:
|
|
2821
|
-
return (React.createElement(core$1.Textarea, { id: name, name: name, "data-testid": name, defaultValue: value, onChange: (e) => {
|
|
2828
|
+
return (React.createElement(core$1.Textarea, { id: name, name: name, "data-testid": name, defaultValue: value, required: required, onChange: (e) => {
|
|
2822
2829
|
if (props.onChange) {
|
|
2823
2830
|
props.onChange(e.currentTarget.value);
|
|
2824
2831
|
}
|
|
@@ -2897,14 +2904,15 @@
|
|
|
2897
2904
|
return null;
|
|
2898
2905
|
}
|
|
2899
2906
|
const [propertyValue, propertyType] = getValueAndType(typedValue, key);
|
|
2907
|
+
const required = property.min !== undefined && property.min > 0;
|
|
2900
2908
|
if (property.type.length === 1 && property.type[0].code === 'boolean') {
|
|
2901
2909
|
return (React.createElement(CheckboxFormSection, { key: key, title: core.getPropertyDisplayName(key), description: property.definition, htmlFor: key },
|
|
2902
2910
|
React.createElement(ResourcePropertyInput, { property: property, name: key, defaultValue: propertyValue, defaultPropertyType: propertyType, outcome: props.outcome, onChange: (newValue, propName) => {
|
|
2903
2911
|
setValueWrapper(setPropertyValue(value, key, propName ?? key, entry[1], newValue));
|
|
2904
2912
|
} })));
|
|
2905
2913
|
}
|
|
2906
|
-
return (React.createElement(FormSection, { key: key, title: core.getPropertyDisplayName(key), description: property.definition, htmlFor: key, outcome: props.outcome },
|
|
2907
|
-
React.createElement(ResourcePropertyInput, { property: property, name: key, defaultValue: propertyValue, defaultPropertyType: propertyType,
|
|
2914
|
+
return (React.createElement(FormSection, { key: key, title: core.getPropertyDisplayName(key), description: property.definition, withAsterisk: required, htmlFor: key, outcome: props.outcome },
|
|
2915
|
+
React.createElement(ResourcePropertyInput, { property: property, name: key, defaultValue: propertyValue, defaultPropertyType: propertyType, onChange: (newValue, propName) => {
|
|
2908
2916
|
setValueWrapper(setPropertyValue(value, key, propName ?? key, entry[1], newValue));
|
|
2909
2917
|
} })));
|
|
2910
2918
|
})));
|
|
@@ -3051,6 +3059,11 @@
|
|
|
3051
3059
|
return (React.createElement(core$1.Stack, { justify: "flex-start", spacing: "xs" }, value.map((note, index) => note.text && (React.createElement(core$1.Blockquote, { key: `note-${index}`, classNames: { cite: classes.noteCite, body: classes.noteBody, root: classes.noteRoot }, cite: note.authorReference?.display || note.authorString, icon: null }, note.text)))));
|
|
3052
3060
|
}
|
|
3053
3061
|
|
|
3062
|
+
/**
|
|
3063
|
+
* Renders the name of a resource, given either the resource itself or a reference to the resource.
|
|
3064
|
+
* @param props
|
|
3065
|
+
* @returns
|
|
3066
|
+
*/
|
|
3054
3067
|
function ResourceName(props) {
|
|
3055
3068
|
const { value, link, ...rest } = props;
|
|
3056
3069
|
const [outcome, setOutcome] = React.useState();
|
|
@@ -3875,6 +3888,7 @@
|
|
|
3875
3888
|
'not-in': 'not in',
|
|
3876
3889
|
'of-type': 'of type',
|
|
3877
3890
|
missing: 'missing',
|
|
3891
|
+
identifier: 'identifier',
|
|
3878
3892
|
};
|
|
3879
3893
|
/**
|
|
3880
3894
|
* Sets the array of filters.
|