@medplum/react 0.9.18 → 0.9.19
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/defaulttheme.css +9 -7
- package/dist/cjs/index.js +135 -102
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.min.js +1 -1
- package/dist/cjs/index.min.js.map +1 -1
- package/dist/cjs/styles.css +75 -59
- package/dist/esm/defaulttheme.css +9 -7
- package/dist/esm/index.js +135 -104
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +1 -1
- package/dist/esm/index.min.js.map +1 -1
- package/dist/esm/styles.css +75 -59
- package/dist/types/BackboneElementInput.d.ts +2 -3
- package/dist/types/Checkbox.d.ts +12 -0
- package/dist/types/CheckboxFormSection.d.ts +9 -0
- package/dist/types/TextArea.d.ts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +5 -5
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { formatAddress, getDisplayString, getImageSrc, globalSchema, getPropertyDisplayName, formatHumanName, stringify, buildTypeName, PropertyType, getTypedPropertyValue, createReference,
|
|
1
|
+
import { formatAddress, getDisplayString, getImageSrc, capitalize, globalSchema, getPropertyDisplayName, formatHumanName, stringify, buildTypeName, PropertyType, getTypedPropertyValue, createReference, toTypedValue, getReferenceString, evalFhirPath, getSearchParameterDetails, Operator, evalFhirPathTyped, SearchParameterType, formatSearchQuery, parseSearchDefinition, DEFAULT_SEARCH_COUNT, isUUID } from '@medplum/core';
|
|
2
2
|
import React, { useState, useRef, createContext, useEffect, useContext, useCallback } from 'react';
|
|
3
3
|
import { useNavigate, useLocation } from 'react-router-dom';
|
|
4
4
|
|
|
@@ -16,7 +16,7 @@ function getIssuesForExpression(outcome, expression) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
function Input(props) {
|
|
19
|
-
const className = 'medplum-input';
|
|
19
|
+
const className = 'medplum-input';
|
|
20
20
|
const issues = getIssuesForExpression(props.outcome, props.name);
|
|
21
21
|
const invalid = issues && issues.length > 0;
|
|
22
22
|
return (React.createElement("input", { id: props.name, name: props.name, type: getInputType(props.type), size: props.size, step: props.step, className: className, defaultValue: props.defaultValue || '', required: props.required, autoCapitalize: props.autoCapitalize, autoComplete: props.autoComplete, autoFocus: props.autoFocus, ref: props.inputRef, "aria-invalid": invalid, "aria-describedby": invalid ? props.name + '-errors' : '', placeholder: props.placeholder, "data-testid": props.testid, disabled: props.disabled, onChange: (e) => {
|
|
@@ -281,7 +281,7 @@ function AttachmentArrayInput(props) {
|
|
|
281
281
|
props.onChange(newValues);
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
|
-
return (React.createElement("table",
|
|
284
|
+
return (React.createElement("table", { style: { width: '100%' } },
|
|
285
285
|
React.createElement("colgroup", null,
|
|
286
286
|
React.createElement("col", { width: "90%" }),
|
|
287
287
|
React.createElement("col", { width: "10%" })),
|
|
@@ -707,6 +707,14 @@ function getInitials(text) {
|
|
|
707
707
|
.join('');
|
|
708
708
|
}
|
|
709
709
|
|
|
710
|
+
function CheckboxFormSection(props) {
|
|
711
|
+
return (React.createElement("div", { className: "medplum-checkbox-form-section" },
|
|
712
|
+
React.createElement("div", { className: "medplum-checkbox-form-section-checkbox-container" }, props.children),
|
|
713
|
+
React.createElement("div", { className: "medplum-checkbox-form-section-details-container" },
|
|
714
|
+
React.createElement("label", { htmlFor: props.htmlFor }, props.title),
|
|
715
|
+
React.createElement("p", null, props.description))));
|
|
716
|
+
}
|
|
717
|
+
|
|
710
718
|
const DEFAULT_IGNORED_PROPERTIES = [
|
|
711
719
|
'meta',
|
|
712
720
|
'implicitRules',
|
|
@@ -720,9 +728,9 @@ const DEFAULT_IGNORED_PROPERTIES = [
|
|
|
720
728
|
function FormSection(props) {
|
|
721
729
|
const issues = getIssuesForExpression(props.outcome, props.htmlFor);
|
|
722
730
|
const invalid = issues && issues.length > 0;
|
|
723
|
-
return (React.createElement("fieldset",
|
|
731
|
+
return (React.createElement("fieldset", { className: "medplum-form-section" },
|
|
724
732
|
props.title && React.createElement("label", { htmlFor: props.htmlFor }, props.title),
|
|
725
|
-
props.description && React.createElement("
|
|
733
|
+
props.description && React.createElement("p", null, props.description),
|
|
726
734
|
props.children,
|
|
727
735
|
invalid && (React.createElement("div", { id: props.htmlFor + '-errors', className: "medplum-input-error" }, issues === null || issues === void 0 ? void 0 : issues.map((issue) => {
|
|
728
736
|
var _a, _b;
|
|
@@ -730,6 +738,50 @@ function FormSection(props) {
|
|
|
730
738
|
})))));
|
|
731
739
|
}
|
|
732
740
|
|
|
741
|
+
function ResourceForm(props) {
|
|
742
|
+
const medplum = useMedplum();
|
|
743
|
+
const defaultValue = useResource(props.defaultValue);
|
|
744
|
+
const [schema, setSchema] = useState();
|
|
745
|
+
const [value, setValue] = useState();
|
|
746
|
+
useEffect(() => {
|
|
747
|
+
if (defaultValue) {
|
|
748
|
+
setValue(JSON.parse(JSON.stringify(defaultValue)));
|
|
749
|
+
medplum.requestSchema(defaultValue.resourceType).then(setSchema);
|
|
750
|
+
}
|
|
751
|
+
}, [medplum, defaultValue]);
|
|
752
|
+
if (!schema || !value) {
|
|
753
|
+
return React.createElement("div", null, "Loading...");
|
|
754
|
+
}
|
|
755
|
+
return (React.createElement("form", { noValidate: true, autoComplete: "off", onSubmit: (e) => {
|
|
756
|
+
e.preventDefault();
|
|
757
|
+
if (props.onSubmit) {
|
|
758
|
+
props.onSubmit(value);
|
|
759
|
+
}
|
|
760
|
+
} },
|
|
761
|
+
React.createElement(FormSection, { title: "Resource Type" },
|
|
762
|
+
React.createElement(Input, { name: "resourceType", defaultValue: value.resourceType, disabled: true })),
|
|
763
|
+
React.createElement(FormSection, { title: "ID" },
|
|
764
|
+
React.createElement(Input, { name: "id", defaultValue: value.id, disabled: true })),
|
|
765
|
+
React.createElement(BackboneElementInput, { typeName: value.resourceType, defaultValue: value, outcome: props.outcome, onChange: setValue }),
|
|
766
|
+
React.createElement(Button, { type: "submit", size: "large" }, "OK"),
|
|
767
|
+
props.onDelete && (React.createElement(Button, { type: "button", size: "large", onClick: () => {
|
|
768
|
+
props.onDelete(value);
|
|
769
|
+
} }, "Delete"))));
|
|
770
|
+
}
|
|
771
|
+
function setPropertyValue(obj, key, propName, elementDefinition, value) {
|
|
772
|
+
const types = elementDefinition.type;
|
|
773
|
+
if (types.length > 1) {
|
|
774
|
+
for (const type of types) {
|
|
775
|
+
const compoundKey = key.replace('[x]', capitalize(type.code));
|
|
776
|
+
if (compoundKey in obj) {
|
|
777
|
+
delete obj[compoundKey];
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
obj[propName] = value;
|
|
782
|
+
return obj;
|
|
783
|
+
}
|
|
784
|
+
|
|
733
785
|
function DescriptionList(props) {
|
|
734
786
|
return React.createElement("dl", { className: 'medplum-description-list' + (props.compact ? ' compact' : '') }, props.children);
|
|
735
787
|
}
|
|
@@ -1031,6 +1083,15 @@ function AnnotationInput(props) {
|
|
|
1031
1083
|
return (React.createElement(Input, { name: props.name, type: "text", placeholder: "Annotation text", defaultValue: value.text, onChange: setText }));
|
|
1032
1084
|
}
|
|
1033
1085
|
|
|
1086
|
+
function Checkbox(props) {
|
|
1087
|
+
const className = 'medplum-checkbox';
|
|
1088
|
+
return (React.createElement("input", { id: props.name, name: props.name, className: className, type: "checkbox", value: "true", defaultChecked: !!props.defaultValue, required: props.required, ref: props.inputRef, "data-testid": props.testid, disabled: props.disabled, onChange: (e) => {
|
|
1089
|
+
if (props.onChange) {
|
|
1090
|
+
props.onChange(e.currentTarget.checked);
|
|
1091
|
+
}
|
|
1092
|
+
} }));
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1034
1095
|
function CodeableConceptInput(props) {
|
|
1035
1096
|
const medplum = useMedplum();
|
|
1036
1097
|
let defaultValue = undefined;
|
|
@@ -1217,7 +1278,7 @@ function isValidDate(date) {
|
|
|
1217
1278
|
}
|
|
1218
1279
|
|
|
1219
1280
|
function TextArea(props) {
|
|
1220
|
-
const className = 'medplum-textarea';
|
|
1281
|
+
const className = 'medplum-textarea' + (props.monospace ? ' monospace' : '');
|
|
1221
1282
|
const issues = getIssuesForExpression(props.outcome, props.name);
|
|
1222
1283
|
const invalid = issues && issues.length > 0;
|
|
1223
1284
|
return (React.createElement("textarea", { id: props.name, name: props.name, className: className, defaultValue: props.defaultValue || '', required: props.required, autoComplete: props.autoComplete, autoFocus: props.autoFocus, ref: props.inputRef, "aria-invalid": invalid, "aria-describedby": invalid ? props.name + '-errors' : '', placeholder: props.placeholder, "data-testid": props.testid, style: props.style, onChange: (e) => {
|
|
@@ -1228,7 +1289,7 @@ function TextArea(props) {
|
|
|
1228
1289
|
}
|
|
1229
1290
|
|
|
1230
1291
|
function ExtensionInput(props) {
|
|
1231
|
-
return (React.createElement(TextArea, { testid: "extension-input", name: props.name, defaultValue: stringify(props.defaultValue), onChange: (newValue) => {
|
|
1292
|
+
return (React.createElement(TextArea, { testid: "extension-input", name: props.name, defaultValue: stringify(props.defaultValue), monospace: true, onChange: (newValue) => {
|
|
1232
1293
|
if (props.onChange) {
|
|
1233
1294
|
props.onChange(JSON.parse(newValue));
|
|
1234
1295
|
}
|
|
@@ -1451,35 +1512,34 @@ function ResourceArrayInput(props) {
|
|
|
1451
1512
|
props.onChange(newValues);
|
|
1452
1513
|
}
|
|
1453
1514
|
}
|
|
1454
|
-
return (React.createElement("
|
|
1455
|
-
React.createElement("
|
|
1456
|
-
React.createElement("
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
React.createElement("
|
|
1460
|
-
|
|
1461
|
-
React.createElement(
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
React.createElement(
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
React.createElement("
|
|
1475
|
-
|
|
1476
|
-
React.createElement(
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
} }, "Add")))))));
|
|
1515
|
+
return (React.createElement("table", { style: { width: '100%', borderCollapse: 'collapse' } },
|
|
1516
|
+
React.createElement("colgroup", null,
|
|
1517
|
+
React.createElement("col", { width: "90%" }),
|
|
1518
|
+
React.createElement("col", { width: "10%" })),
|
|
1519
|
+
React.createElement("tbody", null,
|
|
1520
|
+
values.map((v, index) => (React.createElement("tr", { key: `${index}-${values.length}` },
|
|
1521
|
+
React.createElement("td", null,
|
|
1522
|
+
React.createElement(ResourcePropertyInput, { arrayElement: true, property: props.property, name: props.name + '.' + index, defaultValue: v, onChange: (newValue) => {
|
|
1523
|
+
const copy = [...valuesRef.current];
|
|
1524
|
+
copy[index] = newValue;
|
|
1525
|
+
setValuesWrapper(copy);
|
|
1526
|
+
} })),
|
|
1527
|
+
React.createElement("td", { style: { textAlign: 'right' } },
|
|
1528
|
+
React.createElement(Button, { onClick: (e) => {
|
|
1529
|
+
killEvent(e);
|
|
1530
|
+
const copy = [...valuesRef.current];
|
|
1531
|
+
copy.splice(index, 1);
|
|
1532
|
+
setValuesWrapper(copy);
|
|
1533
|
+
} }, "Remove"))))),
|
|
1534
|
+
React.createElement("tr", null,
|
|
1535
|
+
React.createElement("td", null),
|
|
1536
|
+
React.createElement("td", { style: { textAlign: 'right' } },
|
|
1537
|
+
React.createElement(Button, { onClick: (e) => {
|
|
1538
|
+
killEvent(e);
|
|
1539
|
+
const copy = [...valuesRef.current];
|
|
1540
|
+
copy.push(undefined);
|
|
1541
|
+
setValuesWrapper(copy);
|
|
1542
|
+
} }, "Add"))))));
|
|
1483
1543
|
}
|
|
1484
1544
|
|
|
1485
1545
|
function ResourcePropertyInput(props) {
|
|
@@ -1523,6 +1583,7 @@ function ElementDefinitionInputSelector(props) {
|
|
|
1523
1583
|
} }))));
|
|
1524
1584
|
}
|
|
1525
1585
|
function ElementDefinitionTypeInput(props) {
|
|
1586
|
+
var _a;
|
|
1526
1587
|
const property = props.property;
|
|
1527
1588
|
const propertyType = props.elementDefinitionType.code;
|
|
1528
1589
|
const name = props.name;
|
|
@@ -1554,7 +1615,11 @@ function ElementDefinitionTypeInput(props) {
|
|
|
1554
1615
|
case PropertyType.code:
|
|
1555
1616
|
return React.createElement(CodeInput, { property: property, name: name, defaultValue: value, onChange: props.onChange });
|
|
1556
1617
|
case PropertyType.boolean:
|
|
1557
|
-
return (React.createElement(
|
|
1618
|
+
return (React.createElement(Checkbox, { name: name, testid: name, defaultValue: !!value, onChange: (newValue) => {
|
|
1619
|
+
if (props.onChange) {
|
|
1620
|
+
props.onChange(newValue);
|
|
1621
|
+
}
|
|
1622
|
+
} }));
|
|
1558
1623
|
case PropertyType.markdown:
|
|
1559
1624
|
return React.createElement(TextArea, { name: name, testid: name, defaultValue: value, onChange: props.onChange });
|
|
1560
1625
|
// 2.24.0.2 Complex Types
|
|
@@ -1588,7 +1653,7 @@ function ElementDefinitionTypeInput(props) {
|
|
|
1588
1653
|
case PropertyType.Reference:
|
|
1589
1654
|
return (React.createElement(ReferenceInput, { name: name, defaultValue: value, targetTypes: getTargetTypes(property), onChange: props.onChange }));
|
|
1590
1655
|
default:
|
|
1591
|
-
return (React.createElement(BackboneElementInput, {
|
|
1656
|
+
return (React.createElement(BackboneElementInput, { typeName: buildTypeName((_a = property.path) === null || _a === void 0 ? void 0 : _a.split('.')), defaultValue: value, onChange: props.onChange, outcome: props.outcome }));
|
|
1592
1657
|
}
|
|
1593
1658
|
}
|
|
1594
1659
|
function getTargetTypes(property) {
|
|
@@ -1596,65 +1661,8 @@ function getTargetTypes(property) {
|
|
|
1596
1661
|
return (_c = (_b = (_a = property === null || property === void 0 ? void 0 : property.type) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.targetProfile) === null || _c === void 0 ? void 0 : _c.map((p) => p.split('/').pop());
|
|
1597
1662
|
}
|
|
1598
1663
|
|
|
1599
|
-
function ResourceForm(props) {
|
|
1600
|
-
const medplum = useMedplum();
|
|
1601
|
-
const defaultValue = useResource(props.defaultValue);
|
|
1602
|
-
const [schema, setSchema] = useState();
|
|
1603
|
-
const [value, setValue] = useState();
|
|
1604
|
-
useEffect(() => {
|
|
1605
|
-
if (defaultValue) {
|
|
1606
|
-
setValue(JSON.parse(JSON.stringify(defaultValue)));
|
|
1607
|
-
medplum.requestSchema(defaultValue.resourceType).then(setSchema);
|
|
1608
|
-
}
|
|
1609
|
-
}, [medplum, defaultValue]);
|
|
1610
|
-
if (!schema || !value) {
|
|
1611
|
-
return React.createElement("div", null, "Loading...");
|
|
1612
|
-
}
|
|
1613
|
-
const typeSchema = schema.types[value.resourceType];
|
|
1614
|
-
const typedValue = { type: value.resourceType, value };
|
|
1615
|
-
return (React.createElement("form", { noValidate: true, autoComplete: "off", onSubmit: (e) => {
|
|
1616
|
-
e.preventDefault();
|
|
1617
|
-
if (props.onSubmit) {
|
|
1618
|
-
props.onSubmit(value);
|
|
1619
|
-
}
|
|
1620
|
-
} },
|
|
1621
|
-
React.createElement(FormSection, { title: "Resource Type" },
|
|
1622
|
-
React.createElement(Input, { name: "resourceType", defaultValue: value.resourceType, disabled: true })),
|
|
1623
|
-
React.createElement(FormSection, { title: "ID" },
|
|
1624
|
-
React.createElement(Input, { name: "id", defaultValue: value.id, disabled: true })),
|
|
1625
|
-
Object.entries(typeSchema.properties).map((entry) => {
|
|
1626
|
-
const key = entry[0];
|
|
1627
|
-
if (key === 'id' || DEFAULT_IGNORED_PROPERTIES.indexOf(key) >= 0) {
|
|
1628
|
-
return null;
|
|
1629
|
-
}
|
|
1630
|
-
const property = entry[1];
|
|
1631
|
-
const [propertyValue, propertyType] = getValueAndType(typedValue, key);
|
|
1632
|
-
return (React.createElement(FormSection, { key: key, title: getPropertyDisplayName(key), description: property.definition, htmlFor: key, outcome: props.outcome },
|
|
1633
|
-
React.createElement(ResourcePropertyInput, { property: property, name: key, defaultValue: propertyValue, defaultPropertyType: propertyType, outcome: props.outcome, onChange: (newValue, propName) => {
|
|
1634
|
-
setValue(setPropertyValue(value, key, propName !== null && propName !== void 0 ? propName : key, entry[1], newValue));
|
|
1635
|
-
} })));
|
|
1636
|
-
}),
|
|
1637
|
-
React.createElement(Button, { type: "submit", size: "large" }, "OK"),
|
|
1638
|
-
props.onDelete && (React.createElement(Button, { type: "button", size: "large", onClick: () => {
|
|
1639
|
-
props.onDelete(value);
|
|
1640
|
-
} }, "Delete"))));
|
|
1641
|
-
}
|
|
1642
|
-
function setPropertyValue(obj, key, propName, elementDefinition, value) {
|
|
1643
|
-
const types = elementDefinition.type;
|
|
1644
|
-
if (types.length > 1) {
|
|
1645
|
-
for (const type of types) {
|
|
1646
|
-
const compoundKey = key.replace('[x]', capitalize(type.code));
|
|
1647
|
-
if (compoundKey in obj) {
|
|
1648
|
-
delete obj[compoundKey];
|
|
1649
|
-
}
|
|
1650
|
-
}
|
|
1651
|
-
}
|
|
1652
|
-
obj[propName] = value;
|
|
1653
|
-
return obj;
|
|
1654
|
-
}
|
|
1655
|
-
|
|
1656
1664
|
function BackboneElementInput(props) {
|
|
1657
|
-
var _a
|
|
1665
|
+
var _a;
|
|
1658
1666
|
const [value, setValue] = useState((_a = props.defaultValue) !== null && _a !== void 0 ? _a : {});
|
|
1659
1667
|
function setValueWrapper(newValue) {
|
|
1660
1668
|
setValue(newValue);
|
|
@@ -1662,13 +1670,14 @@ function BackboneElementInput(props) {
|
|
|
1662
1670
|
props.onChange(newValue);
|
|
1663
1671
|
}
|
|
1664
1672
|
}
|
|
1665
|
-
const typeName =
|
|
1673
|
+
const typeName = props.typeName;
|
|
1666
1674
|
const typeSchema = globalSchema.types[typeName];
|
|
1667
1675
|
if (!typeSchema) {
|
|
1668
1676
|
return React.createElement("div", null,
|
|
1669
1677
|
typeName,
|
|
1670
1678
|
"\u00A0not implemented");
|
|
1671
1679
|
}
|
|
1680
|
+
const typedValue = { type: typeName, value };
|
|
1672
1681
|
return (React.createElement(React.Fragment, null, Object.entries(typeSchema.properties).map((entry) => {
|
|
1673
1682
|
const key = entry[0];
|
|
1674
1683
|
if (key === 'id' || DEFAULT_IGNORED_PROPERTIES.indexOf(key) >= 0) {
|
|
@@ -1678,7 +1687,13 @@ function BackboneElementInput(props) {
|
|
|
1678
1687
|
if (!property.type) {
|
|
1679
1688
|
return null;
|
|
1680
1689
|
}
|
|
1681
|
-
const [propertyValue, propertyType] = getValueAndType(
|
|
1690
|
+
const [propertyValue, propertyType] = getValueAndType(typedValue, key);
|
|
1691
|
+
if (property.type.length === 1 && property.type[0].code === 'boolean') {
|
|
1692
|
+
return (React.createElement(CheckboxFormSection, { key: key, title: getPropertyDisplayName(key), description: property.definition, htmlFor: key },
|
|
1693
|
+
React.createElement(ResourcePropertyInput, { property: property, name: key, defaultValue: propertyValue, defaultPropertyType: propertyType, outcome: props.outcome, onChange: (newValue, propName) => {
|
|
1694
|
+
setValueWrapper(setPropertyValue(value, key, propName !== null && propName !== void 0 ? propName : key, entry[1], newValue));
|
|
1695
|
+
} })));
|
|
1696
|
+
}
|
|
1682
1697
|
return (React.createElement(FormSection, { key: key, title: getPropertyDisplayName(key), description: property.definition, htmlFor: key, outcome: props.outcome },
|
|
1683
1698
|
React.createElement(ResourcePropertyInput, { property: property, name: key, defaultValue: propertyValue, defaultPropertyType: propertyType, outcome: props.outcome, onChange: (newValue, propName) => {
|
|
1684
1699
|
setValueWrapper(setPropertyValue(value, key, propName !== null && propName !== void 0 ? propName : key, entry[1], newValue));
|
|
@@ -3196,7 +3211,7 @@ function SearchFilterValueInput(props) {
|
|
|
3196
3211
|
}
|
|
3197
3212
|
} }));
|
|
3198
3213
|
case SearchParameterType.BOOLEAN:
|
|
3199
|
-
return (React.createElement(
|
|
3214
|
+
return (React.createElement(Checkbox, { name: name, testid: name, defaultValue: props.defaultValue === 'true', onChange: (newValue) => props.onChange(newValue.toString()) }));
|
|
3200
3215
|
case SearchParameterType.DATE:
|
|
3201
3216
|
return React.createElement(Input, { type: "date", testid: name, defaultValue: props.defaultValue, onChange: props.onChange });
|
|
3202
3217
|
case SearchParameterType.DATETIME:
|
|
@@ -3892,7 +3907,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
3892
3907
|
function HeaderSearchInput(props) {
|
|
3893
3908
|
const medplum = useMedplum();
|
|
3894
3909
|
return (React.createElement(Autocomplete, { loadOptions: (input, signal) => __awaiter(this, void 0, void 0, function* () {
|
|
3895
|
-
return getResourcesFromResponse((yield medplum.graphql(buildGraphQLQuery(input), { signal })), input);
|
|
3910
|
+
return getResourcesFromResponse((yield medplum.graphql(buildGraphQLQuery(input), undefined, undefined, { signal })), input);
|
|
3896
3911
|
}), getId: (item) => {
|
|
3897
3912
|
return item.id;
|
|
3898
3913
|
}, getIcon: (item) => React.createElement(Avatar, { value: item }), getDisplay: (item) => React.createElement(ResourceName, { value: item }), getHelpText: (item) => {
|
|
@@ -4466,8 +4481,24 @@ function QuestionnaireFormItemArray(props) {
|
|
|
4466
4481
|
setResponseItems(newResponseItems);
|
|
4467
4482
|
props.onChange(newResponseItems);
|
|
4468
4483
|
}
|
|
4469
|
-
return (React.createElement(React.Fragment, null, props.items.map((item, index) =>
|
|
4470
|
-
|
|
4484
|
+
return (React.createElement(React.Fragment, null, props.items.map((item, index) => {
|
|
4485
|
+
if (item.type === QuestionnaireItemType.display) {
|
|
4486
|
+
return React.createElement("p", { key: item.linkId }, item.text);
|
|
4487
|
+
}
|
|
4488
|
+
if (item.type === QuestionnaireItemType.group) {
|
|
4489
|
+
return (React.createElement(QuestionnaireFormItem, { key: item.linkId, item: item, onChange: (newResponseItem) => setResponseItem(index, newResponseItem) }));
|
|
4490
|
+
}
|
|
4491
|
+
if (item.type === QuestionnaireItemType.boolean) {
|
|
4492
|
+
const initial = item.initial && item.initial.length > 0 ? item.initial[0] : undefined;
|
|
4493
|
+
return (React.createElement(CheckboxFormSection, { key: item.linkId, title: item.text, htmlFor: item.linkId },
|
|
4494
|
+
React.createElement(Checkbox, { name: item.linkId, defaultValue: initial === null || initial === void 0 ? void 0 : initial.valueBoolean, onChange: (newValue) => setResponseItem(index, {
|
|
4495
|
+
linkId: item.linkId,
|
|
4496
|
+
answer: [{ valueBoolean: newValue }],
|
|
4497
|
+
}) })));
|
|
4498
|
+
}
|
|
4499
|
+
return (React.createElement(FormSection, { key: item.linkId, htmlFor: item.linkId, title: item.text || '' },
|
|
4500
|
+
React.createElement(QuestionnaireFormItem, { item: item, onChange: (newResponseItem) => setResponseItem(index, newResponseItem) })));
|
|
4501
|
+
})));
|
|
4471
4502
|
}
|
|
4472
4503
|
function QuestionnaireFormItem(props) {
|
|
4473
4504
|
const item = props.item;
|
|
@@ -4498,7 +4529,7 @@ function QuestionnaireFormItem(props) {
|
|
|
4498
4529
|
React.createElement("h3", null, item.text),
|
|
4499
4530
|
item.item && React.createElement(QuestionnaireFormItemArray, { items: item.item, onChange: onChangeItem })));
|
|
4500
4531
|
case QuestionnaireItemType.boolean:
|
|
4501
|
-
return (React.createElement(
|
|
4532
|
+
return (React.createElement(Checkbox, { name: name, defaultValue: initial === null || initial === void 0 ? void 0 : initial.valueBoolean, onChange: (newValue) => onChangeAnswer({ valueBoolean: newValue }) }));
|
|
4502
4533
|
case QuestionnaireItemType.decimal:
|
|
4503
4534
|
return (React.createElement(Input, { type: "number", step: "any", name: name, defaultValue: initial === null || initial === void 0 ? void 0 : initial.valueDecimal, onChange: (newValue) => onChangeAnswer({ valueDecimal: parseFloat(newValue) }) }));
|
|
4504
4535
|
case QuestionnaireItemType.integer:
|
|
@@ -5375,5 +5406,5 @@ function TabSwitch(props) {
|
|
|
5375
5406
|
})));
|
|
5376
5407
|
}
|
|
5377
5408
|
|
|
5378
|
-
export { AddressDisplay, AddressInput, AttachmentArrayDisplay, AttachmentArrayInput, AttachmentInput, Autocomplete, Avatar, BackboneElementInput, Button, CodeInput, CodeableConceptDisplay, CodeableConceptInput, ContactPointDisplay, ContactPointInput, DateTimeDisplay, DateTimeInput, DefaultResourceTimeline, DiagnosticReportDisplay, Document, ElementDefinitionInputSelector, ElementDefinitionTypeInput, EncounterTimeline, ErrorBoundary, FhirPathTable, FooterLinks, Form, FormSection, Header, HumanNameDisplay, HumanNameInput, IdentifierInput, Input, Loading, Logo, MedplumLink, MedplumProvider, MemoizedFhirPathTable, MemoizedSearchControl, MenuItem, ObservationTable, PatientTimeline, PlanDefinitionBuilder, Popup, QuestionnaireBuilder, QuestionnaireForm, QuestionnaireFormItem, QuestionnaireItemType, RangeDisplay, RangeInput, ReferenceInput, RequestGroupDisplay, ResourceArrayDisplay, ResourceArrayInput, ResourceBadge, ResourceBlame, ResourceDiff, ResourceForm, ResourceHistoryTable, ResourceInput, ResourceName, ResourcePropertyDisplay, ResourcePropertyInput, ResourceTable, ResourceTimeline, Scrollable, SearchChangeEvent, SearchClickEvent, SearchControl, SearchFieldEditor, SearchFilterEditor, SearchLoadEvent, Select, ServiceRequestTimeline, SignInForm, StatusBadge, Tab, TabList, TabPanel, TabSwitch, TextArea, Timeline, TimelineItem, TitleBar, UploadButton, addDateEqualsFilter, addDateFilter, addDateFilterBetween, addField, addFilter, addLastMonthFilter, addMissingFilter, addNextMonthFilter, addQuestionnaireInitialValues, addThisMonthFilter, addTodayFilter, addTomorrowFilter, addYearToDateFilter, addYesterdayFilter, buildFieldNameString, clearFilters, clearFiltersOnField, convertIsoToLocal, convertLocalToIso, createScriptTag, deleteFilter, formatRangeString, getOpString, getSearchOperators, getSortField, getTimeString, getValueAndType, hasFilterOnField, isChoiceQuestion, isSortDescending, movePage, parseForm, renderValue, setFilters, setOffset, setPropertyValue, setSort, sortByDateAndPriority, toggleSort, useMedplum, useMedplumContext, useMedplumProfile, useResource };
|
|
5409
|
+
export { AddressDisplay, AddressInput, AttachmentArrayDisplay, AttachmentArrayInput, AttachmentInput, Autocomplete, Avatar, BackboneElementInput, Button, Checkbox, CheckboxFormSection, CodeInput, CodeableConceptDisplay, CodeableConceptInput, ContactPointDisplay, ContactPointInput, DateTimeDisplay, DateTimeInput, DefaultResourceTimeline, DiagnosticReportDisplay, Document, ElementDefinitionInputSelector, ElementDefinitionTypeInput, EncounterTimeline, ErrorBoundary, FhirPathTable, FooterLinks, Form, FormSection, Header, HumanNameDisplay, HumanNameInput, IdentifierInput, Input, Loading, Logo, MedplumLink, MedplumProvider, MemoizedFhirPathTable, MemoizedSearchControl, MenuItem, ObservationTable, PatientTimeline, PlanDefinitionBuilder, Popup, QuestionnaireBuilder, QuestionnaireForm, QuestionnaireFormItem, QuestionnaireItemType, RangeDisplay, RangeInput, ReferenceInput, RequestGroupDisplay, ResourceArrayDisplay, ResourceArrayInput, ResourceBadge, ResourceBlame, ResourceDiff, ResourceForm, ResourceHistoryTable, ResourceInput, ResourceName, ResourcePropertyDisplay, ResourcePropertyInput, ResourceTable, ResourceTimeline, Scrollable, SearchChangeEvent, SearchClickEvent, SearchControl, SearchFieldEditor, SearchFilterEditor, SearchLoadEvent, Select, ServiceRequestTimeline, SignInForm, StatusBadge, Tab, TabList, TabPanel, TabSwitch, TextArea, Timeline, TimelineItem, TitleBar, UploadButton, addDateEqualsFilter, addDateFilter, addDateFilterBetween, addField, addFilter, addLastMonthFilter, addMissingFilter, addNextMonthFilter, addQuestionnaireInitialValues, addThisMonthFilter, addTodayFilter, addTomorrowFilter, addYearToDateFilter, addYesterdayFilter, buildFieldNameString, clearFilters, clearFiltersOnField, convertIsoToLocal, convertLocalToIso, createScriptTag, deleteFilter, formatRangeString, getOpString, getSearchOperators, getSortField, getTimeString, getValueAndType, hasFilterOnField, isChoiceQuestion, isSortDescending, movePage, parseForm, renderValue, setFilters, setOffset, setPropertyValue, setSort, sortByDateAndPriority, toggleSort, useMedplum, useMedplumContext, useMedplumProfile, useResource };
|
|
5379
5410
|
//# sourceMappingURL=index.js.map
|