@medplum/react 2.0.22 → 2.0.24
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 +71 -70
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.min.cjs +1 -1
- package/dist/esm/AddressInput/AddressInput.mjs +3 -3
- package/dist/esm/AddressInput/AddressInput.mjs.map +1 -1
- package/dist/esm/AppShell/Header.mjs +4 -4
- package/dist/esm/AppShell/Header.mjs.map +1 -1
- package/dist/esm/AsyncAutocomplete/AsyncAutocomplete.mjs +9 -3
- package/dist/esm/AsyncAutocomplete/AsyncAutocomplete.mjs.map +1 -1
- package/dist/esm/AttachmentArrayDisplay/AttachmentArrayDisplay.mjs +2 -3
- package/dist/esm/AttachmentArrayDisplay/AttachmentArrayDisplay.mjs.map +1 -1
- package/dist/esm/AttachmentButton/AttachmentButton.mjs +1 -1
- package/dist/esm/AttachmentButton/AttachmentButton.mjs.map +1 -1
- package/dist/esm/BackboneElementDisplay/BackboneElementDisplay.mjs +1 -1
- package/dist/esm/BackboneElementDisplay/BackboneElementDisplay.mjs.map +1 -1
- package/dist/esm/BackboneElementInput/BackboneElementInput.mjs +1 -1
- package/dist/esm/BackboneElementInput/BackboneElementInput.mjs.map +1 -1
- package/dist/esm/BookmarkDialog/BookmarkDialog.mjs +2 -2
- package/dist/esm/BookmarkDialog/BookmarkDialog.mjs.map +1 -1
- package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.mjs +10 -12
- package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.mjs.map +1 -1
- package/dist/esm/FhirPathTable/FhirPathTable.mjs +7 -7
- package/dist/esm/FhirPathTable/FhirPathTable.mjs.map +1 -1
- package/dist/esm/GoogleButton/GoogleButton.mjs +2 -2
- package/dist/esm/GoogleButton/GoogleButton.mjs.map +1 -1
- package/dist/esm/PlanDefinitionBuilder/PlanDefinitionBuilder.mjs +1 -1
- package/dist/esm/PlanDefinitionBuilder/PlanDefinitionBuilder.mjs.map +1 -1
- package/dist/esm/QuestionnaireBuilder/QuestionnaireBuilder.mjs +6 -7
- package/dist/esm/QuestionnaireBuilder/QuestionnaireBuilder.mjs.map +1 -1
- package/dist/esm/QuestionnaireForm/QuestionnaireForm.mjs +2 -1
- package/dist/esm/QuestionnaireForm/QuestionnaireForm.mjs.map +1 -1
- package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.mjs +6 -6
- package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.mjs.map +1 -1
- package/dist/esm/ResourcePropertyDisplay/ResourcePropertyDisplay.mjs +2 -2
- package/dist/esm/ResourcePropertyDisplay/ResourcePropertyDisplay.mjs.map +1 -1
- package/dist/esm/ResourcePropertyInput/ResourcePropertyInput.mjs +3 -3
- package/dist/esm/ResourcePropertyInput/ResourcePropertyInput.mjs.map +1 -1
- package/dist/esm/ResourceTimeline/ResourceTimeline.mjs.map +1 -1
- package/dist/esm/SearchControl/SearchControl.mjs +2 -2
- package/dist/esm/SearchControl/SearchControl.mjs.map +1 -1
- package/dist/esm/SearchControl/SearchUtils.mjs +1 -1
- package/dist/esm/SearchControl/SearchUtils.mjs.map +1 -1
- package/dist/esm/SearchFieldEditor/SearchFieldEditor.mjs +1 -1
- package/dist/esm/SearchFieldEditor/SearchFieldEditor.mjs.map +1 -1
- package/dist/esm/SearchFilterValueDisplay/SearchFilterValueDisplay.mjs +1 -1
- package/dist/esm/SearchFilterValueDisplay/SearchFilterValueDisplay.mjs.map +1 -1
- package/dist/esm/SearchFilterValueInput/SearchFilterValueInput.mjs +1 -1
- package/dist/esm/SearchFilterValueInput/SearchFilterValueInput.mjs.map +1 -1
- package/dist/esm/TimingInput/TimingInput.mjs +3 -3
- package/dist/esm/TimingInput/TimingInput.mjs.map +1 -1
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.mjs +1 -1
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.mjs.map +1 -1
- package/dist/esm/auth/SignInForm.mjs +4 -2
- package/dist/esm/auth/SignInForm.mjs.map +1 -1
- package/dist/esm/index.min.mjs +1 -1
- package/dist/esm/utils/diff.mjs +1 -1
- package/dist/esm/utils/diff.mjs.map +1 -1
- package/package.json +16 -16
package/dist/cjs/index.cjs
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
function getLine(address, index) {
|
|
16
|
-
return address
|
|
16
|
+
return address.line && address.line.length > index ? address.line[index] : '';
|
|
17
17
|
}
|
|
18
18
|
function setLine(address, index, str) {
|
|
19
19
|
const line = address.line || [];
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
setValueWrapper({ ...valueRef.current, postalCode });
|
|
56
56
|
}
|
|
57
57
|
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
58
|
-
React.createElement(core$1.NativeSelect, { "data-testid": "address-use", defaultValue: value
|
|
59
|
-
React.createElement(core$1.NativeSelect, { "data-testid": "address-type", defaultValue: value
|
|
58
|
+
React.createElement(core$1.NativeSelect, { "data-testid": "address-use", defaultValue: value.use, onChange: (e) => setUse(e.currentTarget.value), data: ['', 'home', 'work', 'temp', 'old', 'billing'] }),
|
|
59
|
+
React.createElement(core$1.NativeSelect, { "data-testid": "address-type", defaultValue: value.type, onChange: (e) => setType(e.currentTarget.value), data: ['', 'postal', 'physical', 'both'] }),
|
|
60
60
|
React.createElement(core$1.TextInput, { placeholder: "Line 1", defaultValue: getLine(value, 0), onChange: (e) => setLine1(e.currentTarget.value) }),
|
|
61
61
|
React.createElement(core$1.TextInput, { placeholder: "Line 2", defaultValue: getLine(value, 1), onChange: (e) => setLine2(e.currentTarget.value) }),
|
|
62
62
|
React.createElement(core$1.TextInput, { placeholder: "City", defaultValue: value.city, onChange: (e) => setCity(e.currentTarget.value) }),
|
|
@@ -1059,7 +1059,7 @@
|
|
|
1059
1059
|
const [timer, setTimer] = React.useState();
|
|
1060
1060
|
const [abortController, setAbortController] = React.useState();
|
|
1061
1061
|
const [autoSubmit, setAutoSubmit] = React.useState();
|
|
1062
|
-
const [options, setOptions] = React.useState(defaultItems
|
|
1062
|
+
const [options, setOptions] = React.useState(defaultItems.map(toOption));
|
|
1063
1063
|
const lastValueRef = React.useRef();
|
|
1064
1064
|
lastValueRef.current = lastValue;
|
|
1065
1065
|
const timerRef = React.useRef();
|
|
@@ -1072,7 +1072,7 @@
|
|
|
1072
1072
|
optionsRef.current = options;
|
|
1073
1073
|
const handleTimer = React.useCallback(() => {
|
|
1074
1074
|
setTimer(undefined);
|
|
1075
|
-
const value = inputRef.current?.value
|
|
1075
|
+
const value = inputRef.current?.value.trim() || '';
|
|
1076
1076
|
if (value === lastValueRef.current) {
|
|
1077
1077
|
// Nothing has changed, move on
|
|
1078
1078
|
return;
|
|
@@ -1093,7 +1093,11 @@
|
|
|
1093
1093
|
}
|
|
1094
1094
|
}
|
|
1095
1095
|
})
|
|
1096
|
-
.catch(
|
|
1096
|
+
.catch((err) => {
|
|
1097
|
+
if (!(newAbortController.signal.aborted || err.message.includes('aborted'))) {
|
|
1098
|
+
notifications.showNotification({ color: 'red', message: core.normalizeErrorString(err) });
|
|
1099
|
+
}
|
|
1100
|
+
});
|
|
1097
1101
|
}, [loadOptions, onChange, toOption]);
|
|
1098
1102
|
const handleSearchChange = React.useCallback(() => {
|
|
1099
1103
|
if (abortControllerRef.current) {
|
|
@@ -1431,9 +1435,9 @@
|
|
|
1431
1435
|
React.createElement(core$1.Stack, { align: "center", p: "xl" },
|
|
1432
1436
|
React.createElement(ResourceAvatar, { size: "xl", radius: 100, value: context.profile }),
|
|
1433
1437
|
React.createElement(HumanNameDisplay, { value: context.profile?.name?.[0] }),
|
|
1434
|
-
React.createElement(core$1.Text, { color: "dimmed", size: "xs" }, medplum.getActiveLogin()?.project
|
|
1438
|
+
React.createElement(core$1.Text, { color: "dimmed", size: "xs" }, medplum.getActiveLogin()?.project.display)),
|
|
1435
1439
|
logins.length > 1 && React.createElement(core$1.Menu.Divider, null),
|
|
1436
|
-
logins.map((login) => login.profile
|
|
1440
|
+
logins.map((login) => login.profile.reference !== core.getReferenceString(context.profile) && (React.createElement(core$1.Menu.Item, { key: login.profile.reference, onClick: () => {
|
|
1437
1441
|
medplum
|
|
1438
1442
|
.setActiveLogin(login)
|
|
1439
1443
|
.then(() => window.location.reload())
|
|
@@ -1442,8 +1446,8 @@
|
|
|
1442
1446
|
React.createElement(core$1.Group, null,
|
|
1443
1447
|
React.createElement(core$1.Avatar, { radius: "xl" }),
|
|
1444
1448
|
React.createElement("div", { style: { flex: 1 } },
|
|
1445
|
-
React.createElement(core$1.Text, { size: "sm", weight: 500 }, login.profile
|
|
1446
|
-
React.createElement(core$1.Text, { color: "dimmed", size: "xs" }, login.project
|
|
1449
|
+
React.createElement(core$1.Text, { size: "sm", weight: 500 }, login.profile.display),
|
|
1450
|
+
React.createElement(core$1.Text, { color: "dimmed", size: "xs" }, login.project.display)))))),
|
|
1447
1451
|
React.createElement(core$1.Menu.Divider, null),
|
|
1448
1452
|
React.createElement(core$1.Menu.Item, { icon: React.createElement(IconSwitchHorizontal, { size: 14, stroke: 1.5 }), onClick: () => navigate('/signin') }, "Add another account"),
|
|
1449
1453
|
React.createElement(core$1.Menu.Item, { icon: React.createElement(IconSettings, { size: 14, stroke: 1.5 }), onClick: () => navigate(`/${core.getReferenceString(profile)}`) }, "Account settings"),
|
|
@@ -1519,7 +1523,7 @@
|
|
|
1519
1523
|
const { menuname, bookmarkname: name } = formData;
|
|
1520
1524
|
const target = `${props.pathname}?${props.searchParams.toString()}`;
|
|
1521
1525
|
const newConfig = core.deepClone(config);
|
|
1522
|
-
const menu = newConfig
|
|
1526
|
+
const menu = newConfig.menu?.find(({ title }) => title === menuname);
|
|
1523
1527
|
menu?.link?.push({ name, target });
|
|
1524
1528
|
medplum
|
|
1525
1529
|
.updateResource(newConfig)
|
|
@@ -1547,7 +1551,7 @@
|
|
|
1547
1551
|
return config?.menu?.map((menu) => menu.title);
|
|
1548
1552
|
}
|
|
1549
1553
|
const menus = userConfigToMenu(props.config);
|
|
1550
|
-
return (React.createElement(core$1.NativeSelect, { name: "menuname", defaultValue: menus
|
|
1554
|
+
return (React.createElement(core$1.NativeSelect, { name: "menuname", defaultValue: menus[0], label: "Select Menu Option", placeholder: "Menu", data: menus, withAsterisk: true }));
|
|
1551
1555
|
}
|
|
1552
1556
|
|
|
1553
1557
|
function toKey(element) {
|
|
@@ -1588,7 +1592,7 @@
|
|
|
1588
1592
|
if (!elementDefinition.binding) {
|
|
1589
1593
|
return [];
|
|
1590
1594
|
}
|
|
1591
|
-
const system = elementDefinition.binding
|
|
1595
|
+
const system = elementDefinition.binding.valueSet;
|
|
1592
1596
|
const valueSet = await medplum.searchValueSet(system, input, { signal });
|
|
1593
1597
|
const valueSetElements = valueSet.expansion?.contains;
|
|
1594
1598
|
const newData = [];
|
|
@@ -1824,9 +1828,8 @@
|
|
|
1824
1828
|
}
|
|
1825
1829
|
|
|
1826
1830
|
function AttachmentArrayDisplay(props) {
|
|
1827
|
-
return (React.createElement("div", null, props.values
|
|
1828
|
-
|
|
1829
|
-
React.createElement(AttachmentDisplay, { value: v, maxWidth: props.maxWidth }))))));
|
|
1831
|
+
return (React.createElement("div", null, props.values?.map((v, index) => (React.createElement("div", { key: 'attatchment-' + index },
|
|
1832
|
+
React.createElement(AttachmentDisplay, { value: v, maxWidth: props.maxWidth }))))));
|
|
1830
1833
|
}
|
|
1831
1834
|
|
|
1832
1835
|
function AttachmentButton(props) {
|
|
@@ -1870,7 +1873,7 @@
|
|
|
1870
1873
|
});
|
|
1871
1874
|
})
|
|
1872
1875
|
.catch((outcome) => {
|
|
1873
|
-
alert(outcome
|
|
1876
|
+
alert(outcome.issue?.[0]?.details?.text);
|
|
1874
1877
|
});
|
|
1875
1878
|
}
|
|
1876
1879
|
return (React.createElement(React.Fragment, null,
|
|
@@ -2077,7 +2080,7 @@
|
|
|
2077
2080
|
function ResourcePropertyDisplay(props) {
|
|
2078
2081
|
const { property, propertyType, value } = props;
|
|
2079
2082
|
if (property?.max === '*' && !props.arrayElement) {
|
|
2080
|
-
if (propertyType ===
|
|
2083
|
+
if (propertyType === core.PropertyType.Attachment) {
|
|
2081
2084
|
return React.createElement(AttachmentArrayDisplay, { values: value, maxWidth: props.maxWidth });
|
|
2082
2085
|
}
|
|
2083
2086
|
return (React.createElement(ResourceArrayDisplay, { property: property, values: value, ignoreMissingValues: props.ignoreMissingValues, link: props.link }));
|
|
@@ -2191,7 +2194,7 @@
|
|
|
2191
2194
|
}
|
|
2192
2195
|
return (React.createElement(DescriptionList, { compact: props.compact }, Object.entries(typeSchema.properties).map((entry) => {
|
|
2193
2196
|
const key = entry[0];
|
|
2194
|
-
if (DEFAULT_IGNORED_PROPERTIES.
|
|
2197
|
+
if (DEFAULT_IGNORED_PROPERTIES.includes(key)) {
|
|
2195
2198
|
return null;
|
|
2196
2199
|
}
|
|
2197
2200
|
const property = entry[1];
|
|
@@ -2887,8 +2890,8 @@
|
|
|
2887
2890
|
value.repeat && (React.createElement(React.Fragment, null,
|
|
2888
2891
|
React.createElement(FormSection, { title: "Repeat every", htmlFor: 'timing-dialog-period' },
|
|
2889
2892
|
React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
2890
|
-
React.createElement(core$1.TextInput, { type: "number", step: 1, id: "timing-dialog-period", name: "timing-dialog-period", defaultValue: value
|
|
2891
|
-
React.createElement(core$1.NativeSelect, { id: "timing-dialog-periodUnit", name: "timing-dialog-periodUnit", defaultValue: value
|
|
2893
|
+
React.createElement(core$1.TextInput, { type: "number", step: 1, id: "timing-dialog-period", name: "timing-dialog-period", defaultValue: value.repeat.period || 1, onChange: (e) => setPeriod(parseInt(e.currentTarget.value, 10) || 1) }),
|
|
2894
|
+
React.createElement(core$1.NativeSelect, { id: "timing-dialog-periodUnit", name: "timing-dialog-periodUnit", defaultValue: value.repeat.periodUnit, onChange: (e) => setPeriodUnit(e.currentTarget.value), data: [
|
|
2892
2895
|
{ label: 'second', value: 's' },
|
|
2893
2896
|
{ label: 'minute', value: 'min' },
|
|
2894
2897
|
{ label: 'hour', value: 'h' },
|
|
@@ -2897,7 +2900,7 @@
|
|
|
2897
2900
|
{ label: 'month', value: 'mo' },
|
|
2898
2901
|
{ label: 'year', value: 'a' },
|
|
2899
2902
|
] }))),
|
|
2900
|
-
value.repeat
|
|
2903
|
+
value.repeat.periodUnit === 'wk' && (React.createElement(FormSection, { title: "Repeat on" },
|
|
2901
2904
|
React.createElement(core$1.Chip.Group, { multiple: true, onChange: setDaysOfWeek },
|
|
2902
2905
|
React.createElement(core$1.Group, { position: "apart", mt: "md", spacing: "xs" }, daysOfWeek.map((day) => (React.createElement(core$1.Chip, { key: day, value: day, size: "xs", radius: "xl" }, day.charAt(0).toUpperCase()))))))))),
|
|
2903
2906
|
React.createElement(core$1.Group, { position: "right" },
|
|
@@ -2910,7 +2913,7 @@
|
|
|
2910
2913
|
const name = props.name;
|
|
2911
2914
|
const value = props.defaultValue;
|
|
2912
2915
|
if (property.max === '*' && !props.arrayElement) {
|
|
2913
|
-
if (propertyType ===
|
|
2916
|
+
if (propertyType === core.PropertyType.Attachment) {
|
|
2914
2917
|
return React.createElement(AttachmentArrayInput, { name: name, defaultValue: value, onChange: props.onChange });
|
|
2915
2918
|
}
|
|
2916
2919
|
return React.createElement(ResourceArrayInput, { property: property, name: name, defaultValue: value, onChange: props.onChange });
|
|
@@ -2934,7 +2937,7 @@
|
|
|
2934
2937
|
}
|
|
2935
2938
|
const [selectedType, setSelectedType] = React.useState(initialPropertyType);
|
|
2936
2939
|
return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
|
|
2937
|
-
React.createElement(core$1.NativeSelect, { style: { width: '200px' }, defaultValue: selectedType
|
|
2940
|
+
React.createElement(core$1.NativeSelect, { style: { width: '200px' }, defaultValue: selectedType.code, onChange: (e) => {
|
|
2938
2941
|
setSelectedType(propertyTypes.find((type) => type.code === e.currentTarget.value));
|
|
2939
2942
|
}, data: propertyTypes.map((type) => ({
|
|
2940
2943
|
value: type.code,
|
|
@@ -3064,7 +3067,7 @@
|
|
|
3064
3067
|
const typedValue = { type: typeName, value };
|
|
3065
3068
|
return (React.createElement(core$1.Stack, null, Object.entries(typeSchema.properties).map((entry) => {
|
|
3066
3069
|
const key = entry[0];
|
|
3067
|
-
if (key === 'id' || DEFAULT_IGNORED_PROPERTIES.
|
|
3070
|
+
if (key === 'id' || DEFAULT_IGNORED_PROPERTIES.includes(key)) {
|
|
3068
3071
|
return null;
|
|
3069
3072
|
}
|
|
3070
3073
|
const property = entry[1];
|
|
@@ -3385,16 +3388,14 @@
|
|
|
3385
3388
|
React.createElement(core$1.Text, { size: "xs", transform: "uppercase", color: "dimmed" }, "Subject"),
|
|
3386
3389
|
React.createElement(core$1.Text, null,
|
|
3387
3390
|
React.createElement(ResourceBadge, { value: value.subject, link: true })))),
|
|
3388
|
-
value.resultsInterpreter
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
React.createElement(
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
React.createElement(
|
|
3396
|
-
React.createElement(core$1.Text, null,
|
|
3397
|
-
React.createElement(ResourceBadge, { value: performer, link: true }))))),
|
|
3391
|
+
value.resultsInterpreter?.map((interpreter) => (React.createElement("div", { key: interpreter.reference },
|
|
3392
|
+
React.createElement(core$1.Text, { size: "xs", transform: "uppercase", color: "dimmed" }, "Interpreter"),
|
|
3393
|
+
React.createElement(core$1.Text, null,
|
|
3394
|
+
React.createElement(ResourceBadge, { value: interpreter, link: true }))))),
|
|
3395
|
+
value.performer?.map((performer) => (React.createElement("div", { key: performer.reference },
|
|
3396
|
+
React.createElement(core$1.Text, { size: "xs", transform: "uppercase", color: "dimmed" }, "Performer"),
|
|
3397
|
+
React.createElement(core$1.Text, null,
|
|
3398
|
+
React.createElement(ResourceBadge, { value: performer, link: true }))))),
|
|
3398
3399
|
value.issued && (React.createElement("div", null,
|
|
3399
3400
|
React.createElement(core$1.Text, { size: "xs", transform: "uppercase", color: "dimmed" }, "Issued"),
|
|
3400
3401
|
React.createElement(core$1.Text, null, core.formatDateTime(value.issued)))),
|
|
@@ -3436,7 +3437,7 @@
|
|
|
3436
3437
|
if (!observation) {
|
|
3437
3438
|
return null;
|
|
3438
3439
|
}
|
|
3439
|
-
const displayNotes = !props.hideObservationNotes && observation
|
|
3440
|
+
const displayNotes = !props.hideObservationNotes && observation.note;
|
|
3440
3441
|
const critical = isCritical(observation);
|
|
3441
3442
|
return (React.createElement(React.Fragment, null,
|
|
3442
3443
|
React.createElement("tr", { className: cx({ [classes.criticalRow]: critical }) },
|
|
@@ -3450,7 +3451,7 @@
|
|
|
3450
3451
|
React.createElement("td", null, observation.interpretation && observation.interpretation.length > 0 && (React.createElement(CodeableConceptDisplay, { value: observation.interpretation[0] }))),
|
|
3451
3452
|
React.createElement("td", null, observation.category && observation.category.length > 0 && (React.createElement("ul", null, observation.category.map((concept, index) => (React.createElement("li", { key: `category-${index}` },
|
|
3452
3453
|
React.createElement(CodeableConceptDisplay, { value: concept }))))))),
|
|
3453
|
-
React.createElement("td", null, observation.performer?.map((performer) => (React.createElement(ReferenceDisplay, { key: performer
|
|
3454
|
+
React.createElement("td", null, observation.performer?.map((performer) => (React.createElement(ReferenceDisplay, { key: performer.reference, value: performer })))),
|
|
3454
3455
|
React.createElement("td", null, observation.status && React.createElement(StatusBadge, { status: observation.status }))),
|
|
3455
3456
|
displayNotes && (React.createElement("tr", null,
|
|
3456
3457
|
React.createElement("td", { colSpan: 6 },
|
|
@@ -4161,7 +4162,7 @@
|
|
|
4161
4162
|
* @returns The updated search request.
|
|
4162
4163
|
*/
|
|
4163
4164
|
function addField(definition, field) {
|
|
4164
|
-
if (definition.fields
|
|
4165
|
+
if (definition.fields?.includes(field)) {
|
|
4165
4166
|
return definition;
|
|
4166
4167
|
}
|
|
4167
4168
|
const newFields = [];
|
|
@@ -4659,7 +4660,7 @@
|
|
|
4659
4660
|
const typeDef = core.globalSchema.types[resourceType];
|
|
4660
4661
|
const selected = state.search.fields ?? [];
|
|
4661
4662
|
const available = getFieldsList(typeDef)
|
|
4662
|
-
.filter((field) => !selected
|
|
4663
|
+
.filter((field) => !selected.includes(field))
|
|
4663
4664
|
.sort();
|
|
4664
4665
|
return (React.createElement(core$1.Modal, { title: "Fields", closeButtonProps: { 'aria-label': 'Close' }, opened: props.visible, onClose: props.onCancel },
|
|
4665
4666
|
React.createElement("div", null,
|
|
@@ -4718,7 +4719,7 @@
|
|
|
4718
4719
|
|
|
4719
4720
|
function SearchFilterValueDisplay(props) {
|
|
4720
4721
|
const { resourceType, filter } = props;
|
|
4721
|
-
const searchParam = core.globalSchema.types[resourceType]
|
|
4722
|
+
const searchParam = core.globalSchema.types[resourceType].searchParams?.[filter.code];
|
|
4722
4723
|
if (searchParam) {
|
|
4723
4724
|
if (searchParam.type === 'reference' &&
|
|
4724
4725
|
(filter.operator === core.Operator.EQUALS || filter.operator === core.Operator.NOT_EQUALS)) {
|
|
@@ -4737,7 +4738,7 @@
|
|
|
4737
4738
|
const name = 'filter-value';
|
|
4738
4739
|
switch (details.type) {
|
|
4739
4740
|
case core.SearchParameterType.REFERENCE:
|
|
4740
|
-
return (React.createElement(ReferenceInput, { name: name, defaultValue: { reference: props.defaultValue }, targetTypes: props.searchParam
|
|
4741
|
+
return (React.createElement(ReferenceInput, { name: name, defaultValue: { reference: props.defaultValue }, targetTypes: props.searchParam.target, onChange: (newReference) => {
|
|
4741
4742
|
if (newReference) {
|
|
4742
4743
|
props.onChange(newReference.reference);
|
|
4743
4744
|
}
|
|
@@ -5192,7 +5193,7 @@
|
|
|
5192
5193
|
const el = e.target;
|
|
5193
5194
|
const checked = el.checked;
|
|
5194
5195
|
const newSelected = {};
|
|
5195
|
-
const searchResponse = stateRef.current
|
|
5196
|
+
const searchResponse = stateRef.current.searchResponse;
|
|
5196
5197
|
if (checked && searchResponse?.entry) {
|
|
5197
5198
|
searchResponse.entry.forEach((entry) => {
|
|
5198
5199
|
if (entry.resource?.id) {
|
|
@@ -5255,7 +5256,7 @@
|
|
|
5255
5256
|
.then(() => setSchemaLoaded(true))
|
|
5256
5257
|
.catch(console.log);
|
|
5257
5258
|
}, [medplum, props.search.resourceType]);
|
|
5258
|
-
const typeSchema = schemaLoaded && core.globalSchema
|
|
5259
|
+
const typeSchema = schemaLoaded && core.globalSchema.types[props.search.resourceType];
|
|
5259
5260
|
if (!typeSchema) {
|
|
5260
5261
|
return (React.createElement(core$1.Center, { style: { width: '100%', height: '100%' } },
|
|
5261
5262
|
React.createElement(core$1.Loader, null)));
|
|
@@ -5441,10 +5442,10 @@
|
|
|
5441
5442
|
const el = e.target;
|
|
5442
5443
|
const checked = el.checked;
|
|
5443
5444
|
const newSelected = {};
|
|
5444
|
-
const resources = responseRef.current?.data
|
|
5445
|
+
const resources = responseRef.current?.data.ResourceList;
|
|
5445
5446
|
if (checked && resources) {
|
|
5446
5447
|
resources.forEach((resource) => {
|
|
5447
|
-
if (resource
|
|
5448
|
+
if (resource.id) {
|
|
5448
5449
|
newSelected[resource.id] = true;
|
|
5449
5450
|
}
|
|
5450
5451
|
});
|
|
@@ -5452,12 +5453,12 @@
|
|
|
5452
5453
|
setSelected(newSelected);
|
|
5453
5454
|
}
|
|
5454
5455
|
function isAllSelected() {
|
|
5455
|
-
const resources = responseRef.current?.data
|
|
5456
|
+
const resources = responseRef.current?.data.ResourceList;
|
|
5456
5457
|
if (!resources || resources.length === 0) {
|
|
5457
5458
|
return false;
|
|
5458
5459
|
}
|
|
5459
5460
|
for (const resource of resources) {
|
|
5460
|
-
if (resource
|
|
5461
|
+
if (resource.id && !selectedRef.current[resource.id]) {
|
|
5461
5462
|
return false;
|
|
5462
5463
|
}
|
|
5463
5464
|
}
|
|
@@ -5486,7 +5487,7 @@
|
|
|
5486
5487
|
})
|
|
5487
5488
|
.catch(console.log);
|
|
5488
5489
|
}, [medplum, props.resourceType]);
|
|
5489
|
-
const typeSchema = schema?.types
|
|
5490
|
+
const typeSchema = schema?.types[props.resourceType];
|
|
5490
5491
|
if (!typeSchema) {
|
|
5491
5492
|
return React.createElement(core$1.Loader, null);
|
|
5492
5493
|
}
|
|
@@ -5498,14 +5499,14 @@
|
|
|
5498
5499
|
checkboxColumn && (React.createElement("th", null,
|
|
5499
5500
|
React.createElement("input", { type: "checkbox", value: "checked", "aria-label": "all-checkbox", "data-testid": "all-checkbox", checked: isAllSelected(), onChange: (e) => handleAllCheckboxClick(e) }))),
|
|
5500
5501
|
fields.map((field) => (React.createElement("th", { key: field.name }, field.name))))),
|
|
5501
|
-
React.createElement("tbody", null, response?.data
|
|
5502
|
+
React.createElement("tbody", null, response?.data.ResourceList.map((resource) => resource && (React.createElement("tr", { key: resource.id, "data-testid": "search-control-row", onClick: (e) => handleRowClick(e, resource), onAuxClick: (e) => handleRowClick(e, resource) },
|
|
5502
5503
|
checkboxColumn && (React.createElement("td", null,
|
|
5503
5504
|
React.createElement("input", { type: "checkbox", value: "checked", "data-testid": "row-checkbox", "aria-label": `Checkbox for ${resource.id}`, checked: !!selected[resource.id], onChange: (e) => handleSingleCheckboxClick(e, resource.id) }))),
|
|
5504
5505
|
fields.map((field) => {
|
|
5505
5506
|
return (React.createElement("td", { key: field.name },
|
|
5506
5507
|
React.createElement(FhirPathDisplay, { propertyType: field.propertyType, path: field.fhirPath, resource: resource })));
|
|
5507
5508
|
})))))),
|
|
5508
|
-
response?.data
|
|
5509
|
+
response?.data.ResourceList.length === 0 && React.createElement("div", { "data-testid": "empty-search" }, "No results"),
|
|
5509
5510
|
outcome && (React.createElement("div", { "data-testid": "search-error" },
|
|
5510
5511
|
React.createElement("pre", { style: { textAlign: 'left' } }, JSON.stringify(outcome, undefined, 2)))),
|
|
5511
5512
|
props.onBulk && (React.createElement(core$1.Button, { onClick: () => props.onBulk(Object.keys(selectedRef.current)) }, "Bulk..."))));
|
|
@@ -5778,7 +5779,7 @@
|
|
|
5778
5779
|
function generateId$1(existing) {
|
|
5779
5780
|
if (existing) {
|
|
5780
5781
|
if (existing.startsWith('id-')) {
|
|
5781
|
-
const existingNum = parseInt(existing.substring(3));
|
|
5782
|
+
const existingNum = parseInt(existing.substring(3), 10);
|
|
5782
5783
|
if (!isNaN(existingNum)) {
|
|
5783
5784
|
nextId$1 = Math.max(nextId$1, existingNum + 1);
|
|
5784
5785
|
}
|
|
@@ -5965,8 +5966,9 @@
|
|
|
5965
5966
|
else {
|
|
5966
5967
|
return (React.createElement(QuestionnaireChoiceRadioInput, { name: name, item: item, initial: initial, onChangeAnswer: onChangeAnswer }));
|
|
5967
5968
|
}
|
|
5969
|
+
default:
|
|
5970
|
+
return null;
|
|
5968
5971
|
}
|
|
5969
|
-
return null;
|
|
5970
5972
|
}
|
|
5971
5973
|
function QuestionnaireChoiceDropDownInput(props) {
|
|
5972
5974
|
const { name, item, initial } = props;
|
|
@@ -6192,13 +6194,13 @@
|
|
|
6192
6194
|
function addItem(addedItem) {
|
|
6193
6195
|
props.onChange({
|
|
6194
6196
|
...props.item,
|
|
6195
|
-
item: [...(props.item
|
|
6197
|
+
item: [...(props.item.item ?? []), addedItem],
|
|
6196
6198
|
});
|
|
6197
6199
|
}
|
|
6198
6200
|
function removeItem(removedItem) {
|
|
6199
6201
|
props.onChange({
|
|
6200
6202
|
...props.item,
|
|
6201
|
-
item: props.item
|
|
6203
|
+
item: props.item.item?.filter((i) => i !== removedItem),
|
|
6202
6204
|
});
|
|
6203
6205
|
}
|
|
6204
6206
|
function changeProperty(property, value) {
|
|
@@ -6219,9 +6221,8 @@
|
|
|
6219
6221
|
resource.title && React.createElement(core$1.Title, null, resource.title),
|
|
6220
6222
|
item.text && React.createElement("div", null, item.text),
|
|
6221
6223
|
!isContainer && React.createElement(QuestionnaireFormItem, { item: item, answers: {}, onChange: () => undefined })))),
|
|
6222
|
-
item.item
|
|
6223
|
-
|
|
6224
|
-
React.createElement(ItemBuilder, { item: i, selectedKey: props.selectedKey, setSelectedKey: props.setSelectedKey, hoverKey: props.hoverKey, setHoverKey: props.setHoverKey, onChange: changeItem, onRemove: () => removeItem(i) })))),
|
|
6224
|
+
item.item?.map((i) => (React.createElement("div", { key: i.id },
|
|
6225
|
+
React.createElement(ItemBuilder, { item: i, selectedKey: props.selectedKey, setSelectedKey: props.setSelectedKey, hoverKey: props.hoverKey, setHoverKey: props.setHoverKey, onChange: changeItem, onRemove: () => removeItem(i) })))),
|
|
6225
6226
|
!isContainer && (React.createElement("div", { className: classes.topActions }, editing ? (React.createElement(React.Fragment, null,
|
|
6226
6227
|
React.createElement(core$1.TextInput, { size: "xs", className: classes.linkIdInput, defaultValue: item.linkId, onChange: (e) => changeProperty('linkId', e.currentTarget.value) }),
|
|
6227
6228
|
!isContainer && (React.createElement(core$1.NativeSelect, { size: "xs", className: classes.typeSelect, defaultValue: item.type, onChange: (e) => changeProperty('type', e.currentTarget.value), data: [
|
|
@@ -6338,10 +6339,10 @@
|
|
|
6338
6339
|
}
|
|
6339
6340
|
items.forEach((item) => {
|
|
6340
6341
|
if (item.id?.match(/^id-\d+$/)) {
|
|
6341
|
-
nextId = Math.max(nextId, parseInt(item.id.substring(3)) + 1);
|
|
6342
|
+
nextId = Math.max(nextId, parseInt(item.id.substring(3), 10) + 1);
|
|
6342
6343
|
}
|
|
6343
6344
|
if (item.linkId?.match(/^q\d+$/)) {
|
|
6344
|
-
nextLinkId = Math.max(nextLinkId, parseInt(item.linkId.substring(1)) + 1);
|
|
6345
|
+
nextLinkId = Math.max(nextLinkId, parseInt(item.linkId.substring(1), 10) + 1);
|
|
6345
6346
|
}
|
|
6346
6347
|
});
|
|
6347
6348
|
return items.map((item) => ({
|
|
@@ -6376,7 +6377,7 @@
|
|
|
6376
6377
|
const defaultProps = {
|
|
6377
6378
|
definition: { resourceType: 'ObservationDefinition' },
|
|
6378
6379
|
onSubmit: () => {
|
|
6379
|
-
return;
|
|
6380
|
+
return undefined;
|
|
6380
6381
|
},
|
|
6381
6382
|
};
|
|
6382
6383
|
function ReferenceRangeEditor(props) {
|
|
@@ -6426,8 +6427,8 @@
|
|
|
6426
6427
|
setIntervalGroups((groups) => {
|
|
6427
6428
|
groups = [...groups];
|
|
6428
6429
|
const currentGroup = groups.find((g) => g.id === groupId);
|
|
6429
|
-
const index = currentGroup?.intervals
|
|
6430
|
-
if (index !== undefined && currentGroup?.intervals
|
|
6430
|
+
const index = currentGroup?.intervals.findIndex((interval) => interval.id === changedInterval.id);
|
|
6431
|
+
if (index !== undefined && currentGroup?.intervals[index]) {
|
|
6431
6432
|
currentGroup.intervals[index] = changedInterval;
|
|
6432
6433
|
}
|
|
6433
6434
|
return groups;
|
|
@@ -6523,7 +6524,7 @@
|
|
|
6523
6524
|
React.createElement(core$1.Group, null,
|
|
6524
6525
|
React.createElement(core$1.NativeSelect, { data: ['', 'male', 'female'], label: "Gender:", defaultValue: intervalGroup.filters.gender || '', onChange: (e) => {
|
|
6525
6526
|
for (const interval of intervalGroup.intervals) {
|
|
6526
|
-
let newGender = e.currentTarget
|
|
6527
|
+
let newGender = e.currentTarget.value;
|
|
6527
6528
|
if (newGender === '') {
|
|
6528
6529
|
newGender = undefined;
|
|
6529
6530
|
}
|
|
@@ -6543,7 +6544,7 @@
|
|
|
6543
6544
|
} }))),
|
|
6544
6545
|
React.createElement(core$1.NativeSelect, { data: ['', 'pre-puberty', 'follicular', 'midcycle', 'luteal', 'postmenopausal'], label: "Endocrine:", defaultValue: intervalGroup.filters.context?.text || '', onChange: (e) => {
|
|
6545
6546
|
for (const interval of intervalGroup.intervals) {
|
|
6546
|
-
let newEndocrine = e.currentTarget
|
|
6547
|
+
let newEndocrine = e.currentTarget.value;
|
|
6547
6548
|
if (newEndocrine === '') {
|
|
6548
6549
|
newEndocrine = undefined;
|
|
6549
6550
|
onChange(intervalGroup.id, { ...interval, context: undefined });
|
|
@@ -6572,7 +6573,7 @@
|
|
|
6572
6573
|
const intervals = definition.qualifiedInterval || [];
|
|
6573
6574
|
// Set the nextId to the max of any existing numeric id
|
|
6574
6575
|
let nextId = Math.max(...intervals.map((interval) => {
|
|
6575
|
-
const existingNum = parseInt(interval.id?.substring(3) || '');
|
|
6576
|
+
const existingNum = parseInt(interval.id?.substring(3) || '', 10);
|
|
6576
6577
|
return !isNaN(existingNum) ? existingNum : Number.NEGATIVE_INFINITY;
|
|
6577
6578
|
})) + 1;
|
|
6578
6579
|
if (!Number.isFinite(nextId)) {
|
|
@@ -6773,7 +6774,7 @@
|
|
|
6773
6774
|
if (path.snake) {
|
|
6774
6775
|
path = path.prev;
|
|
6775
6776
|
}
|
|
6776
|
-
while (path
|
|
6777
|
+
while (path?.prev && path.prev.j >= 0) {
|
|
6777
6778
|
const i = path.i;
|
|
6778
6779
|
const j = path.j;
|
|
6779
6780
|
path = path.prev;
|
|
@@ -7250,9 +7251,9 @@
|
|
|
7250
7251
|
}
|
|
7251
7252
|
if (typeof window !== 'undefined') {
|
|
7252
7253
|
const origin = window.location.protocol + '//' + window.location.host;
|
|
7253
|
-
const authorizedOrigins = "
|
|
7254
|
+
const authorizedOrigins = "undefined"?.split(',') ?? [];
|
|
7254
7255
|
if (authorizedOrigins.includes(origin)) {
|
|
7255
|
-
return "
|
|
7256
|
+
return "undefined";
|
|
7256
7257
|
}
|
|
7257
7258
|
}
|
|
7258
7259
|
return undefined;
|
|
@@ -7566,7 +7567,7 @@
|
|
|
7566
7567
|
onSuccess();
|
|
7567
7568
|
}
|
|
7568
7569
|
})
|
|
7569
|
-
.catch(
|
|
7570
|
+
.catch((err) => notifications.showNotification({ color: 'red', message: core.normalizeErrorString(err) }));
|
|
7570
7571
|
}
|
|
7571
7572
|
}, [medplum, onCode, onSuccess]);
|
|
7572
7573
|
const handleAuthResponse = React.useCallback((response) => {
|
|
@@ -7598,7 +7599,7 @@
|
|
|
7598
7599
|
medplum
|
|
7599
7600
|
.get('auth/login/' + loginCode)
|
|
7600
7601
|
.then(handleAuthResponse)
|
|
7601
|
-
.catch(
|
|
7602
|
+
.catch((err) => notifications.showNotification({ color: 'red', message: core.normalizeErrorString(err) }));
|
|
7602
7603
|
}
|
|
7603
7604
|
}, [medplum, loginCode, login, handleAuthResponse]);
|
|
7604
7605
|
return (React.createElement(Document, { width: 450 }, (() => {
|