@f1studio/form-spec 5.0.0-alpha.139 → 5.0.0-alpha.141
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/FormSpec.FS/FormSpec.d.ts +5 -4
- package/FormSpec.FS/FormSpec.d.ts.map +1 -1
- package/FormSpec.FS/FormSpecValues.d.ts +0 -5
- package/FormSpec.FS/FormSpecValues.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.d.ts +3 -2
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.d.ts +1 -1
- package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.d.ts +74 -0
- package/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.d.ts.map +1 -0
- package/FormSpec.FS/Interop/Facade/BlueprintFilledForm.d.ts +106 -0
- package/FormSpec.FS/Interop/Facade/BlueprintFilledForm.d.ts.map +1 -0
- package/FormSpec.FS/Interop/Facade/FormAnswersGate.d.ts +105 -0
- package/FormSpec.FS/Interop/Facade/FormAnswersGate.d.ts.map +1 -0
- package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts +26 -13
- package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts.map +1 -1
- package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts +1 -2
- package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts.map +1 -1
- package/FormSpec.FS/Interop/FormSpec.Values.Api.Option.d.ts +5 -3
- package/FormSpec.FS/Interop/FormSpec.Values.Api.Option.d.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/BlueprintValidation.js +1 -1
- package/FormSpec.TS/FormSpec.FS/BlueprintValidation.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/BlueprintValidation.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Designer.js +1 -1
- package/FormSpec.TS/FormSpec.FS/Designer.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Designer.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpec.js +13 -8
- package/FormSpec.TS/FormSpec.FS/FormSpec.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpec.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.js +5 -5
- package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpecValues.js +2 -21
- package/FormSpec.TS/FormSpec.FS/FormSpecValues.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpecValues.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Helpers.js +12 -12
- package/FormSpec.TS/FormSpec.FS/Helpers.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Helpers.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.js +36 -30
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js +5 -20
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.js +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js +24 -10
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.js +2 -2
- package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.js +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.js +282 -0
- package/FormSpec.TS/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.js.map +1 -0
- package/FormSpec.TS/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.ts.map +1 -0
- package/FormSpec.TS/FormSpec.FS/Interop/Facade/BlueprintFilledForm.js +184 -0
- package/FormSpec.TS/FormSpec.FS/Interop/Facade/BlueprintFilledForm.js.map +1 -0
- package/FormSpec.TS/FormSpec.FS/Interop/Facade/BlueprintFilledForm.ts.map +1 -0
- package/FormSpec.TS/FormSpec.FS/Interop/Facade/FormAnswersGate.js +752 -0
- package/FormSpec.TS/FormSpec.FS/Interop/Facade/FormAnswersGate.js.map +1 -0
- package/FormSpec.TS/FormSpec.FS/Interop/Facade/FormAnswersGate.ts.map +1 -0
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js +317 -81
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.js +5 -10
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Values.Api.Option.js +20 -10
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Values.Api.Option.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Values.Api.Option.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Migrator.js +1 -1
- package/FormSpec.TS/FormSpec.FS/Migrator.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Migrator.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/PathwayExecutor.js +3 -3
- package/FormSpec.TS/FormSpec.FS/PathwayExecutor.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/PathwayExecutor.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/PathwayValidator.js +1 -1
- package/FormSpec.TS/FormSpec.FS/PathwayValidator.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/PathwayValidator.ts.map +1 -1
- package/FormSpec.TS/PluginRegistration.js +2 -0
- package/FormSpec.TS/PluginRegistration.js.map +1 -1
- package/FormSpec.TS/PluginRegistration.ts.map +1 -1
- package/FormSpec.TS/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Decode.js +63 -69
- package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Decode.js.map +1 -0
- package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Decode.ts.map +1 -0
- package/FormSpec.TS/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Encode.js +6 -10
- package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Encode.js.map +1 -0
- package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Encode.ts.map +1 -0
- package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Extra.js.map +1 -0
- package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Extra.ts.map +1 -0
- package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Types.js.map +1 -0
- package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Types.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs +57 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.js +119 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Fable.Promise.fableproj +20 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Promise.fs +766 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Promise.fs.js +165 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Promise.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Promise.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs +31 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js +32 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.8.0/DateParsing.fs.js.map +1 -1
- package/FormSpec.TS/fable_modules/Feliz.2.8.0/DateParsing.fs.ts.map +1 -1
- package/FormSpec.TS/fable_modules/project_cracked.json +1 -1
- package/FormSpec.TS/plugins/allergyfinder/src/AllergyFinderField.js +2431 -0
- package/FormSpec.TS/plugins/allergyfinder/src/AllergyFinderField.js.map +1 -0
- package/FormSpec.TS/plugins/allergyfinder/src/AllergyFinderField.ts.map +1 -0
- package/FormSpec.TS/plugins/allergyfinder/src/OpenFdaClient.js +107 -0
- package/FormSpec.TS/plugins/allergyfinder/src/OpenFdaClient.js.map +1 -0
- package/FormSpec.TS/plugins/allergyfinder/src/OpenFdaClient.ts.map +1 -0
- package/FormSpec.TS/plugins/signature/src/SignatureField.js +1 -1
- package/FormSpec.TS/plugins/signature/src/SignatureField.js.map +1 -1
- package/FormSpec.TS/plugins/signature/src/SignatureField.ts.map +1 -1
- package/FormSpec.TS/plugins/vitals/src/VitalsField.js +29 -312
- package/FormSpec.TS/plugins/vitals/src/VitalsField.js.map +1 -1
- package/FormSpec.TS/plugins/vitals/src/VitalsField.ts.map +1 -1
- package/FormSpec.TS/plugins/vitals/src/VitalsLogic.js +506 -0
- package/FormSpec.TS/plugins/vitals/src/VitalsLogic.js.map +1 -0
- package/FormSpec.TS/plugins/vitals/src/VitalsLogic.ts.map +1 -0
- package/README.md +7 -7
- package/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Decode.d.ts +2 -2
- package/Thoth.Json/packages/Thoth.Json/Decode.d.ts.map +1 -0
- package/Thoth.Json/packages/Thoth.Json/Encode.d.ts.map +1 -0
- package/Thoth.Json/packages/Thoth.Json/Extra.d.ts.map +1 -0
- package/Thoth.Json/packages/Thoth.Json/Types.d.ts.map +1 -0
- package/fable_modules/Fable.Promise.3.2.0/Promise.fs.d.ts +112 -0
- package/fable_modules/Fable.Promise.3.2.0/Promise.fs.d.ts.map +1 -0
- package/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.d.ts +8 -0
- package/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.d.ts.map +1 -0
- package/package.json +9 -1
- package/plugins/allergyfinder/src/AllergyFinderField.d.ts +116 -0
- package/plugins/allergyfinder/src/AllergyFinderField.d.ts.map +1 -0
- package/plugins/allergyfinder/src/OpenFdaClient.d.ts +5 -0
- package/plugins/allergyfinder/src/OpenFdaClient.d.ts.map +1 -0
- package/plugins/vitals/src/VitalsField.d.ts +4 -43
- package/plugins/vitals/src/VitalsField.d.ts.map +1 -1
- package/plugins/vitals/src/VitalsLogic.d.ts +72 -0
- package/plugins/vitals/src/VitalsLogic.d.ts.map +1 -0
- package/src/FormSpec.FS/BlueprintValidation.ts +1 -1
- package/src/FormSpec.FS/Designer.ts +1 -1
- package/src/FormSpec.FS/FormSpec.ts +10 -8
- package/src/FormSpec.FS/FormSpecHelpers.ts +5 -5
- package/src/FormSpec.FS/FormSpecValues.ts +2 -25
- package/src/FormSpec.FS/Helpers.ts +12 -12
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.ts +35 -32
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.ts +6 -23
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.ts +1 -1
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts +1 -1
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts +27 -11
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts +1 -1
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.ts +3 -3
- package/src/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.ts +3 -3
- package/src/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.ts +160 -0
- package/src/FormSpec.FS/Interop/Facade/BlueprintFilledForm.ts +244 -0
- package/src/FormSpec.FS/Interop/Facade/FormAnswersGate.ts +508 -0
- package/src/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts +376 -128
- package/src/FormSpec.FS/Interop/FormSpec.Api.Option.ts +6 -8
- package/src/FormSpec.FS/Interop/FormSpec.Values.Api.Option.ts +17 -13
- package/src/FormSpec.FS/Migrator.ts +1 -1
- package/src/FormSpec.FS/PathwayExecutor.ts +3 -3
- package/src/FormSpec.FS/PathwayValidator.ts +1 -1
- package/src/PluginRegistration.ts +2 -0
- package/src/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Decode.ts +38 -55
- package/src/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Encode.ts +10 -16
- package/src/plugins/allergyfinder/src/AllergyFinderField.ts +1341 -0
- package/src/plugins/allergyfinder/src/OpenFdaClient.ts +103 -0
- package/src/plugins/signature/src/SignatureField.ts +1 -1
- package/src/plugins/vitals/src/VitalsField.ts +35 -244
- package/src/plugins/vitals/src/VitalsLogic.ts +360 -0
- package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Decode.js.map +0 -1
- package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Decode.ts.map +0 -1
- package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Encode.js.map +0 -1
- package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Encode.ts.map +0 -1
- package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Extra.js.map +0 -1
- package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Extra.ts.map +0 -1
- package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Types.js.map +0 -1
- package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Types.ts.map +0 -1
- package/libs/Thoth.Json/packages/Thoth.Json/Decode.d.ts.map +0 -1
- package/libs/Thoth.Json/packages/Thoth.Json/Encode.d.ts.map +0 -1
- package/libs/Thoth.Json/packages/Thoth.Json/Extra.d.ts.map +0 -1
- package/libs/Thoth.Json/packages/Thoth.Json/Types.d.ts.map +0 -1
- /package/FormSpec.TS/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Extra.js +0 -0
- /package/FormSpec.TS/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Types.js +0 -0
- /package/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Encode.d.ts +0 -0
- /package/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Extra.d.ts +0 -0
- /package/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Types.d.ts +0 -0
- /package/src/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Extra.ts +0 -0
- /package/src/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Types.ts +0 -0
|
@@ -0,0 +1,2431 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get AllergyFinderField_AllergyCard () {
|
|
13
|
+
return AllergyFinderField_AllergyCard;
|
|
14
|
+
},
|
|
15
|
+
get AllergyFinderField_AllergyDetailModal () {
|
|
16
|
+
return AllergyFinderField_AllergyDetailModal;
|
|
17
|
+
},
|
|
18
|
+
get AllergyFinderField_AllergyEntry () {
|
|
19
|
+
return AllergyFinderField_AllergyEntry;
|
|
20
|
+
},
|
|
21
|
+
get AllergyFinderField_AllergyEntry_$reflection () {
|
|
22
|
+
return AllergyFinderField_AllergyEntry_$reflection;
|
|
23
|
+
},
|
|
24
|
+
get AllergyFinderField_AllergyFinderFieldComponent () {
|
|
25
|
+
return AllergyFinderField_AllergyFinderFieldComponent;
|
|
26
|
+
},
|
|
27
|
+
get AllergyFinderField_AllergySearchPopover () {
|
|
28
|
+
return AllergyFinderField_AllergySearchPopover;
|
|
29
|
+
},
|
|
30
|
+
get AllergyFinderField_AllergySeverity () {
|
|
31
|
+
return AllergyFinderField_AllergySeverity;
|
|
32
|
+
},
|
|
33
|
+
get AllergyFinderField_AllergySeverity_$reflection () {
|
|
34
|
+
return AllergyFinderField_AllergySeverity_$reflection;
|
|
35
|
+
},
|
|
36
|
+
get AllergyFinderField_AllergySeverity_LifeThreatening () {
|
|
37
|
+
return AllergyFinderField_AllergySeverity_LifeThreatening;
|
|
38
|
+
},
|
|
39
|
+
get AllergyFinderField_AllergySeverity_Mild () {
|
|
40
|
+
return AllergyFinderField_AllergySeverity_Mild;
|
|
41
|
+
},
|
|
42
|
+
get AllergyFinderField_AllergySeverity_Moderate () {
|
|
43
|
+
return AllergyFinderField_AllergySeverity_Moderate;
|
|
44
|
+
},
|
|
45
|
+
get AllergyFinderField_AllergySeverity_Severe () {
|
|
46
|
+
return AllergyFinderField_AllergySeverity_Severe;
|
|
47
|
+
},
|
|
48
|
+
get AllergyFinderField_AllergySeverity_Unknown () {
|
|
49
|
+
return AllergyFinderField_AllergySeverity_Unknown;
|
|
50
|
+
},
|
|
51
|
+
get AllergyFinderField_Attributes () {
|
|
52
|
+
return AllergyFinderField_Attributes;
|
|
53
|
+
},
|
|
54
|
+
get AllergyFinderField_Attributes_$reflection () {
|
|
55
|
+
return AllergyFinderField_Attributes_$reflection;
|
|
56
|
+
},
|
|
57
|
+
get AllergyFinderField_CategoryBadge () {
|
|
58
|
+
return AllergyFinderField_CategoryBadge;
|
|
59
|
+
},
|
|
60
|
+
get AllergyFinderField_DetailModalState () {
|
|
61
|
+
return AllergyFinderField_DetailModalState;
|
|
62
|
+
},
|
|
63
|
+
get AllergyFinderField_DetailModalState_$reflection () {
|
|
64
|
+
return AllergyFinderField_DetailModalState_$reflection;
|
|
65
|
+
},
|
|
66
|
+
get AllergyFinderField_DetailModalState_Adding () {
|
|
67
|
+
return AllergyFinderField_DetailModalState_Adding;
|
|
68
|
+
},
|
|
69
|
+
get AllergyFinderField_DetailModalState_Closed () {
|
|
70
|
+
return AllergyFinderField_DetailModalState_Closed;
|
|
71
|
+
},
|
|
72
|
+
get AllergyFinderField_DetailModalState_Editing () {
|
|
73
|
+
return AllergyFinderField_DetailModalState_Editing;
|
|
74
|
+
},
|
|
75
|
+
get AllergyFinderField_FdaInsightsPanel () {
|
|
76
|
+
return AllergyFinderField_FdaInsightsPanel;
|
|
77
|
+
},
|
|
78
|
+
get AllergyFinderField_Field$1 () {
|
|
79
|
+
return AllergyFinderField_Field$1;
|
|
80
|
+
},
|
|
81
|
+
get AllergyFinderField_Field$1_$ctor_2F8EC839 () {
|
|
82
|
+
return AllergyFinderField_Field$1_$ctor_2F8EC839;
|
|
83
|
+
},
|
|
84
|
+
get AllergyFinderField_Field$1_$reflection () {
|
|
85
|
+
return AllergyFinderField_Field$1_$reflection;
|
|
86
|
+
},
|
|
87
|
+
get AllergyFinderField_ReactionCheckboxes () {
|
|
88
|
+
return AllergyFinderField_ReactionCheckboxes;
|
|
89
|
+
},
|
|
90
|
+
get AllergyFinderField_SeverityBadge () {
|
|
91
|
+
return AllergyFinderField_SeverityBadge;
|
|
92
|
+
},
|
|
93
|
+
get AllergyFinderField_categoryFromString () {
|
|
94
|
+
return AllergyFinderField_categoryFromString;
|
|
95
|
+
},
|
|
96
|
+
get AllergyFinderField_categoryLabel () {
|
|
97
|
+
return AllergyFinderField_categoryLabel;
|
|
98
|
+
},
|
|
99
|
+
get AllergyFinderField_categoryToString () {
|
|
100
|
+
return AllergyFinderField_categoryToString;
|
|
101
|
+
},
|
|
102
|
+
get AllergyFinderField_commonReactions () {
|
|
103
|
+
return AllergyFinderField_commonReactions;
|
|
104
|
+
},
|
|
105
|
+
get AllergyFinderField_form () {
|
|
106
|
+
return AllergyFinderField_form;
|
|
107
|
+
},
|
|
108
|
+
get AllergyFinderField_parseAllergies () {
|
|
109
|
+
return AllergyFinderField_parseAllergies;
|
|
110
|
+
},
|
|
111
|
+
get AllergyFinderField_serializeAllergies () {
|
|
112
|
+
return AllergyFinderField_serializeAllergies;
|
|
113
|
+
},
|
|
114
|
+
get AllergyFinderField_severityBorderColor () {
|
|
115
|
+
return AllergyFinderField_severityBorderColor;
|
|
116
|
+
},
|
|
117
|
+
get AllergyFinderField_severityColor () {
|
|
118
|
+
return AllergyFinderField_severityColor;
|
|
119
|
+
},
|
|
120
|
+
get AllergyFinderField_severityFromString () {
|
|
121
|
+
return AllergyFinderField_severityFromString;
|
|
122
|
+
},
|
|
123
|
+
get AllergyFinderField_severityLabel () {
|
|
124
|
+
return AllergyFinderField_severityLabel;
|
|
125
|
+
},
|
|
126
|
+
get AllergyFinderField_severityToString () {
|
|
127
|
+
return AllergyFinderField_severityToString;
|
|
128
|
+
},
|
|
129
|
+
get Form_PropertyKeys_AllergiesJson () {
|
|
130
|
+
return Form_PropertyKeys_AllergiesJson;
|
|
131
|
+
},
|
|
132
|
+
get Form_PropertyKeys_AllergyCount () {
|
|
133
|
+
return Form_PropertyKeys_AllergyCount;
|
|
134
|
+
},
|
|
135
|
+
get Form_PropertyKeys_HasSevereAllergy () {
|
|
136
|
+
return Form_PropertyKeys_HasSevereAllergy;
|
|
137
|
+
},
|
|
138
|
+
get Form_allergyFinderField () {
|
|
139
|
+
return Form_allergyFinderField;
|
|
140
|
+
},
|
|
141
|
+
get Form_designerPreview () {
|
|
142
|
+
return Form_designerPreview;
|
|
143
|
+
},
|
|
144
|
+
get Form_enhancedAllergyConverter () {
|
|
145
|
+
return Form_enhancedAllergyConverter;
|
|
146
|
+
},
|
|
147
|
+
get Form_markdownRenderer () {
|
|
148
|
+
return Form_markdownRenderer;
|
|
149
|
+
},
|
|
150
|
+
get Form_pluginConfig () {
|
|
151
|
+
return Form_pluginConfig;
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
const _Types = require("@fable-org/fable-library-js/Types.js");
|
|
155
|
+
const _Reflection = require("@fable-org/fable-library-js/Reflection.js");
|
|
156
|
+
const _OpenFdaTypes = require("../../../FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.js");
|
|
157
|
+
const _Option = require("@fable-org/fable-library-js/Option.js");
|
|
158
|
+
const _List = require("@fable-org/fable-library-js/List.js");
|
|
159
|
+
const _Util = require("@fable-org/fable-library-js/Util.js");
|
|
160
|
+
const _Encode = require("../../../Thoth.Json/packages/Thoth.Json/Encode.js");
|
|
161
|
+
const _Decode = require("../../../Thoth.Json/packages/Thoth.Json/Decode.js");
|
|
162
|
+
const _Result = require("@fable-org/fable-library-js/Result.js");
|
|
163
|
+
const _Guid = require("@fable-org/fable-library-js/Guid.js");
|
|
164
|
+
const _String = require("@fable-org/fable-library-js/String.js");
|
|
165
|
+
const _Fieldfs = require("../../../fable_modules/Fable.Form.3.0.0/Field.fs.js");
|
|
166
|
+
const _Basefs = require("../../../fable_modules/Fable.Form.3.0.0/Base.fs.js");
|
|
167
|
+
const _react = require("react");
|
|
168
|
+
const _Interopfs = require("../../../fable_modules/Feliz.2.8.0/Interop.fs.js");
|
|
169
|
+
const _Promisefs = require("../../../fable_modules/Fable.Promise.3.2.0/Promise.fs.js");
|
|
170
|
+
const _PromiseImplfs = require("../../../fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js");
|
|
171
|
+
const _OpenFdaClient = require("./OpenFdaClient.js");
|
|
172
|
+
const _Seq = require("@fable-org/fable-library-js/Seq.js");
|
|
173
|
+
const _Int32 = require("@fable-org/fable-library-js/Int32.js");
|
|
174
|
+
const _Typesfs = require("../../../fable_modules/Fable.Form.Simple.Bulma.5.0.1/Types.fs.js");
|
|
175
|
+
const _FormSpec = require("../../../FormSpec.FS/FormSpec.js");
|
|
176
|
+
const _PluginInterface = require("../../../FormSpec.FS/PluginInterface.js");
|
|
177
|
+
const _ElementBuildersfs = require("../../../fable_modules/Feliz.Bulma.3.0.0/ElementBuilders.fs.js");
|
|
178
|
+
function AllergyFinderField_AllergySeverity_Unknown() {
|
|
179
|
+
return new AllergyFinderField_AllergySeverity(0, []);
|
|
180
|
+
}
|
|
181
|
+
function AllergyFinderField_AllergySeverity_Mild() {
|
|
182
|
+
return new AllergyFinderField_AllergySeverity(1, []);
|
|
183
|
+
}
|
|
184
|
+
function AllergyFinderField_AllergySeverity_Moderate() {
|
|
185
|
+
return new AllergyFinderField_AllergySeverity(2, []);
|
|
186
|
+
}
|
|
187
|
+
function AllergyFinderField_AllergySeverity_Severe() {
|
|
188
|
+
return new AllergyFinderField_AllergySeverity(3, []);
|
|
189
|
+
}
|
|
190
|
+
function AllergyFinderField_AllergySeverity_LifeThreatening() {
|
|
191
|
+
return new AllergyFinderField_AllergySeverity(4, []);
|
|
192
|
+
}
|
|
193
|
+
class AllergyFinderField_AllergySeverity extends _Types.Union {
|
|
194
|
+
cases() {
|
|
195
|
+
return [
|
|
196
|
+
"Unknown",
|
|
197
|
+
"Mild",
|
|
198
|
+
"Moderate",
|
|
199
|
+
"Severe",
|
|
200
|
+
"LifeThreatening"
|
|
201
|
+
];
|
|
202
|
+
}
|
|
203
|
+
constructor(tag, fields){
|
|
204
|
+
super(), this.tag = tag, this.fields = fields;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function AllergyFinderField_AllergySeverity_$reflection() {
|
|
208
|
+
return (0, _Reflection.union_type)("Fable.Form.Simple.Bulma.Fields.AllergyFinderField.AllergyFinderField.AllergySeverity", [], AllergyFinderField_AllergySeverity, ()=>[
|
|
209
|
+
[],
|
|
210
|
+
[],
|
|
211
|
+
[],
|
|
212
|
+
[],
|
|
213
|
+
[]
|
|
214
|
+
]);
|
|
215
|
+
}
|
|
216
|
+
function AllergyFinderField_severityToString(_arg) {
|
|
217
|
+
switch(_arg.tag){
|
|
218
|
+
case /* Mild */ 1:
|
|
219
|
+
return "mild";
|
|
220
|
+
case /* Moderate */ 2:
|
|
221
|
+
return "moderate";
|
|
222
|
+
case /* Severe */ 3:
|
|
223
|
+
return "severe";
|
|
224
|
+
case /* LifeThreatening */ 4:
|
|
225
|
+
return "life_threatening";
|
|
226
|
+
default:
|
|
227
|
+
return "unknown";
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
function AllergyFinderField_severityFromString(_arg) {
|
|
231
|
+
switch(_arg){
|
|
232
|
+
case "mild":
|
|
233
|
+
return AllergyFinderField_AllergySeverity_Mild();
|
|
234
|
+
case "moderate":
|
|
235
|
+
return AllergyFinderField_AllergySeverity_Moderate();
|
|
236
|
+
case "severe":
|
|
237
|
+
return AllergyFinderField_AllergySeverity_Severe();
|
|
238
|
+
case "life_threatening":
|
|
239
|
+
return AllergyFinderField_AllergySeverity_LifeThreatening();
|
|
240
|
+
default:
|
|
241
|
+
return AllergyFinderField_AllergySeverity_Unknown();
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function AllergyFinderField_severityLabel(_arg) {
|
|
245
|
+
switch(_arg.tag){
|
|
246
|
+
case /* Mild */ 1:
|
|
247
|
+
return "Mild";
|
|
248
|
+
case /* Moderate */ 2:
|
|
249
|
+
return "Moderate";
|
|
250
|
+
case /* Severe */ 3:
|
|
251
|
+
return "Severe";
|
|
252
|
+
case /* LifeThreatening */ 4:
|
|
253
|
+
return "Life-threatening";
|
|
254
|
+
default:
|
|
255
|
+
return "Unknown";
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
function AllergyFinderField_severityColor(_arg) {
|
|
259
|
+
switch(_arg.tag){
|
|
260
|
+
case /* Mild */ 1:
|
|
261
|
+
return "bg-emerald-100 text-emerald-700 border-emerald-200";
|
|
262
|
+
case /* Moderate */ 2:
|
|
263
|
+
return "bg-amber-100 text-amber-700 border-amber-200";
|
|
264
|
+
case /* Severe */ 3:
|
|
265
|
+
return "bg-orange-100 text-orange-700 border-orange-200";
|
|
266
|
+
case /* LifeThreatening */ 4:
|
|
267
|
+
return "bg-red-100 text-red-700 border-red-200";
|
|
268
|
+
default:
|
|
269
|
+
return "bg-slate-100 text-slate-600 border-slate-200";
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function AllergyFinderField_severityBorderColor(_arg) {
|
|
273
|
+
switch(_arg.tag){
|
|
274
|
+
case /* Mild */ 1:
|
|
275
|
+
return "border-l-emerald-400";
|
|
276
|
+
case /* Moderate */ 2:
|
|
277
|
+
return "border-l-amber-400";
|
|
278
|
+
case /* Severe */ 3:
|
|
279
|
+
return "border-l-orange-500";
|
|
280
|
+
case /* LifeThreatening */ 4:
|
|
281
|
+
return "border-l-red-500";
|
|
282
|
+
default:
|
|
283
|
+
return "border-l-slate-400";
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
function AllergyFinderField_categoryToString(cat) {
|
|
287
|
+
switch(cat.tag){
|
|
288
|
+
case /* Food */ 1:
|
|
289
|
+
return "food";
|
|
290
|
+
case /* Environmental */ 2:
|
|
291
|
+
return "environmental";
|
|
292
|
+
case /* Custom */ 3:
|
|
293
|
+
return "custom";
|
|
294
|
+
default:
|
|
295
|
+
return "drug";
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
function AllergyFinderField_categoryFromString(_arg) {
|
|
299
|
+
switch(_arg){
|
|
300
|
+
case "drug":
|
|
301
|
+
return (0, _OpenFdaTypes.AllergyCategory_Drug)();
|
|
302
|
+
case "food":
|
|
303
|
+
return (0, _OpenFdaTypes.AllergyCategory_Food)();
|
|
304
|
+
case "environmental":
|
|
305
|
+
return (0, _OpenFdaTypes.AllergyCategory_Environmental)();
|
|
306
|
+
default:
|
|
307
|
+
return (0, _OpenFdaTypes.AllergyCategory_Custom)();
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
function AllergyFinderField_categoryLabel(cat) {
|
|
311
|
+
switch(cat.tag){
|
|
312
|
+
case /* Food */ 1:
|
|
313
|
+
return "Food";
|
|
314
|
+
case /* Environmental */ 2:
|
|
315
|
+
return "Environmental";
|
|
316
|
+
case /* Custom */ 3:
|
|
317
|
+
return "Other";
|
|
318
|
+
default:
|
|
319
|
+
return "Drug";
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
class AllergyFinderField_AllergyEntry extends _Types.Record {
|
|
323
|
+
constructor(Id, Name, SubstanceName, NdcCode, Category, Severity, Reactions, Remedy, OnsetTiming, StaffOnly, Notes){
|
|
324
|
+
super();
|
|
325
|
+
this.Id = Id;
|
|
326
|
+
this.Name = Name;
|
|
327
|
+
this.SubstanceName = SubstanceName;
|
|
328
|
+
this.NdcCode = NdcCode;
|
|
329
|
+
this.Category = Category;
|
|
330
|
+
this.Severity = Severity;
|
|
331
|
+
this.Reactions = Reactions;
|
|
332
|
+
this.Remedy = Remedy;
|
|
333
|
+
this.OnsetTiming = OnsetTiming;
|
|
334
|
+
this.StaffOnly = StaffOnly;
|
|
335
|
+
this.Notes = Notes;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
function AllergyFinderField_AllergyEntry_$reflection() {
|
|
339
|
+
return (0, _Reflection.record_type)("Fable.Form.Simple.Bulma.Fields.AllergyFinderField.AllergyFinderField.AllergyEntry", [], AllergyFinderField_AllergyEntry, ()=>[
|
|
340
|
+
[
|
|
341
|
+
"Id",
|
|
342
|
+
_Reflection.string_type
|
|
343
|
+
],
|
|
344
|
+
[
|
|
345
|
+
"Name",
|
|
346
|
+
_Reflection.string_type
|
|
347
|
+
],
|
|
348
|
+
[
|
|
349
|
+
"SubstanceName",
|
|
350
|
+
_Reflection.string_type
|
|
351
|
+
],
|
|
352
|
+
[
|
|
353
|
+
"NdcCode",
|
|
354
|
+
(0, _Reflection.option_type)(_Reflection.string_type)
|
|
355
|
+
],
|
|
356
|
+
[
|
|
357
|
+
"Category",
|
|
358
|
+
(0, _OpenFdaTypes.AllergyCategory_$reflection)()
|
|
359
|
+
],
|
|
360
|
+
[
|
|
361
|
+
"Severity",
|
|
362
|
+
AllergyFinderField_AllergySeverity_$reflection()
|
|
363
|
+
],
|
|
364
|
+
[
|
|
365
|
+
"Reactions",
|
|
366
|
+
(0, _Reflection.list_type)(_Reflection.string_type)
|
|
367
|
+
],
|
|
368
|
+
[
|
|
369
|
+
"Remedy",
|
|
370
|
+
(0, _Reflection.option_type)(_Reflection.string_type)
|
|
371
|
+
],
|
|
372
|
+
[
|
|
373
|
+
"OnsetTiming",
|
|
374
|
+
(0, _Reflection.option_type)(_Reflection.string_type)
|
|
375
|
+
],
|
|
376
|
+
[
|
|
377
|
+
"StaffOnly",
|
|
378
|
+
_Reflection.bool_type
|
|
379
|
+
],
|
|
380
|
+
[
|
|
381
|
+
"Notes",
|
|
382
|
+
(0, _Reflection.option_type)(_Reflection.string_type)
|
|
383
|
+
]
|
|
384
|
+
]);
|
|
385
|
+
}
|
|
386
|
+
const AllergyFinderField_commonReactions = [
|
|
387
|
+
"Rash",
|
|
388
|
+
"Hives",
|
|
389
|
+
"Itching",
|
|
390
|
+
"Swelling",
|
|
391
|
+
"Nausea",
|
|
392
|
+
"Vomiting",
|
|
393
|
+
"Diarrhea",
|
|
394
|
+
"Difficulty Breathing",
|
|
395
|
+
"Wheezing",
|
|
396
|
+
"Anaphylaxis",
|
|
397
|
+
"Dizziness",
|
|
398
|
+
"Headache",
|
|
399
|
+
"Fever",
|
|
400
|
+
"Joint Pain",
|
|
401
|
+
"Congestion",
|
|
402
|
+
"Sneezing",
|
|
403
|
+
"Watery Eyes"
|
|
404
|
+
];
|
|
405
|
+
function AllergyFinderField_allergyEncoder(a) {
|
|
406
|
+
return (0, _Encode.object)([
|
|
407
|
+
[
|
|
408
|
+
"id",
|
|
409
|
+
a.Id
|
|
410
|
+
],
|
|
411
|
+
[
|
|
412
|
+
"name",
|
|
413
|
+
a.Name
|
|
414
|
+
],
|
|
415
|
+
[
|
|
416
|
+
"substanceName",
|
|
417
|
+
a.SubstanceName
|
|
418
|
+
],
|
|
419
|
+
[
|
|
420
|
+
"ndcCode",
|
|
421
|
+
(0, _Encode.option)((value_3)=>value_3)(a.NdcCode)
|
|
422
|
+
],
|
|
423
|
+
[
|
|
424
|
+
"category",
|
|
425
|
+
AllergyFinderField_categoryToString(a.Category)
|
|
426
|
+
],
|
|
427
|
+
[
|
|
428
|
+
"severity",
|
|
429
|
+
AllergyFinderField_severityToString(a.Severity)
|
|
430
|
+
],
|
|
431
|
+
[
|
|
432
|
+
"reactions",
|
|
433
|
+
(0, _Encode.list)((0, _List.map)((value_7)=>value_7, a.Reactions))
|
|
434
|
+
],
|
|
435
|
+
[
|
|
436
|
+
"remedy",
|
|
437
|
+
(0, _Encode.option)((value_9)=>value_9)(a.Remedy)
|
|
438
|
+
],
|
|
439
|
+
[
|
|
440
|
+
"onsetTiming",
|
|
441
|
+
(0, _Encode.option)((value_11)=>value_11)(a.OnsetTiming)
|
|
442
|
+
],
|
|
443
|
+
[
|
|
444
|
+
"staffOnly",
|
|
445
|
+
a.StaffOnly
|
|
446
|
+
],
|
|
447
|
+
[
|
|
448
|
+
"notes",
|
|
449
|
+
(0, _Encode.option)((value_14)=>value_14)(a.Notes)
|
|
450
|
+
]
|
|
451
|
+
]);
|
|
452
|
+
}
|
|
453
|
+
const AllergyFinderField_allergyDecoder = (path_13)=>(v)=>(0, _Decode.object)((get$)=>{
|
|
454
|
+
let objectArg, copyOfStruct, objectArg_1, objectArg_2, objectArg_4, objectArg_5, objectArg_6, objectArg_7, objectArg_8, objectArg_9, objectArg_10, objectArg_11;
|
|
455
|
+
return new AllergyFinderField_AllergyEntry((0, _Option.defaultArg)((objectArg = get$.Optional, objectArg.Field("id", _Decode.string)), (copyOfStruct = (0, _Guid.newGuid)(), copyOfStruct)), (objectArg_1 = get$.Required, objectArg_1.Field("name", _Decode.string)), (0, _Option.defaultArgWith)((objectArg_2 = get$.Optional, objectArg_2.Field("substanceName", _Decode.string)), ()=>{
|
|
456
|
+
const objectArg_3 = get$.Required;
|
|
457
|
+
return objectArg_3.Field("name", _Decode.string);
|
|
458
|
+
}), (objectArg_4 = get$.Optional, objectArg_4.Field("ndcCode", _Decode.string)), AllergyFinderField_categoryFromString((0, _Option.defaultArg)((objectArg_5 = get$.Optional, objectArg_5.Field("category", _Decode.string)), "drug")), AllergyFinderField_severityFromString((0, _Option.defaultArg)((objectArg_6 = get$.Optional, objectArg_6.Field("severity", _Decode.string)), "unknown")), (0, _Option.defaultArg)((objectArg_7 = get$.Optional, objectArg_7.Field("reactions", (path_8, value_11)=>(0, _Decode.list)(_Decode.string, path_8, value_11))), (0, _List.empty)()), (objectArg_8 = get$.Optional, objectArg_8.Field("remedy", _Decode.string)), (objectArg_9 = get$.Optional, objectArg_9.Field("onsetTiming", _Decode.string)), (0, _Option.defaultArg)((objectArg_10 = get$.Optional, objectArg_10.Field("staffOnly", _Decode.bool)), false), (objectArg_11 = get$.Optional, objectArg_11.Field("notes", _Decode.string)));
|
|
459
|
+
}, path_13, v);
|
|
460
|
+
function AllergyFinderField_serializeAllergies(allergies) {
|
|
461
|
+
return (0, _Encode.toString)(0, (0, _Encode.list)((0, _List.map)(AllergyFinderField_allergyEncoder, allergies)));
|
|
462
|
+
}
|
|
463
|
+
function AllergyFinderField_parseAllergies(value) {
|
|
464
|
+
if ((0, _String.isNullOrWhiteSpace)(value) ? true : value === "[]") {
|
|
465
|
+
return (0, _List.empty)();
|
|
466
|
+
} else {
|
|
467
|
+
const matchValue = (0, _Decode.fromString)((path, value_1)=>(0, _Decode.list)((0, _Util.uncurry2)(AllergyFinderField_allergyDecoder), path, value_1), value);
|
|
468
|
+
if (matchValue.tag === /* Error */ 1) {
|
|
469
|
+
const err = matchValue.fields[0];
|
|
470
|
+
console.warn((0, _Option.some)("AllergyFinder: failed to decode allergies:"), err);
|
|
471
|
+
return (0, _List.empty)();
|
|
472
|
+
} else {
|
|
473
|
+
return matchValue.fields[0];
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
class AllergyFinderField_Attributes extends _Types.Record {
|
|
478
|
+
GetFieldId() {
|
|
479
|
+
const this$ = this;
|
|
480
|
+
return this$.FieldId;
|
|
481
|
+
}
|
|
482
|
+
constructor(FieldId, Label, ApiFetch){
|
|
483
|
+
super();
|
|
484
|
+
this.FieldId = FieldId;
|
|
485
|
+
this.Label = Label;
|
|
486
|
+
this.ApiFetch = ApiFetch;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
function AllergyFinderField_Attributes_$reflection() {
|
|
490
|
+
return (0, _Reflection.record_type)("Fable.Form.Simple.Bulma.Fields.AllergyFinderField.AllergyFinderField.Attributes", [], AllergyFinderField_Attributes, ()=>[
|
|
491
|
+
[
|
|
492
|
+
"FieldId",
|
|
493
|
+
_Reflection.string_type
|
|
494
|
+
],
|
|
495
|
+
[
|
|
496
|
+
"Label",
|
|
497
|
+
_Reflection.string_type
|
|
498
|
+
],
|
|
499
|
+
[
|
|
500
|
+
"ApiFetch",
|
|
501
|
+
(0, _Reflection.lambda_type)(_Reflection.string_type, (0, _Reflection.class_type)("Fable.Core.JS.Promise`1", [
|
|
502
|
+
_Reflection.string_type
|
|
503
|
+
]))
|
|
504
|
+
]
|
|
505
|
+
]);
|
|
506
|
+
}
|
|
507
|
+
function AllergyFinderField_form() {
|
|
508
|
+
return (build)=>(config)=>(0, _Basefs.field)((v)=>{
|
|
509
|
+
if ((0, _String.isNullOrEmpty)(v)) {
|
|
510
|
+
return true;
|
|
511
|
+
} else {
|
|
512
|
+
return v === "[]";
|
|
513
|
+
}
|
|
514
|
+
}, build, config);
|
|
515
|
+
}
|
|
516
|
+
function AllergyFinderField_DetailModalState_Closed() {
|
|
517
|
+
return new AllergyFinderField_DetailModalState(0, []);
|
|
518
|
+
}
|
|
519
|
+
function AllergyFinderField_DetailModalState_Adding(Item) {
|
|
520
|
+
return new AllergyFinderField_DetailModalState(1, [
|
|
521
|
+
Item
|
|
522
|
+
]);
|
|
523
|
+
}
|
|
524
|
+
function AllergyFinderField_DetailModalState_Editing(Item) {
|
|
525
|
+
return new AllergyFinderField_DetailModalState(2, [
|
|
526
|
+
Item
|
|
527
|
+
]);
|
|
528
|
+
}
|
|
529
|
+
class AllergyFinderField_DetailModalState extends _Types.Union {
|
|
530
|
+
cases() {
|
|
531
|
+
return [
|
|
532
|
+
"Closed",
|
|
533
|
+
"Adding",
|
|
534
|
+
"Editing"
|
|
535
|
+
];
|
|
536
|
+
}
|
|
537
|
+
constructor(tag, fields){
|
|
538
|
+
super(), this.tag = tag, this.fields = fields;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
function AllergyFinderField_DetailModalState_$reflection() {
|
|
542
|
+
return (0, _Reflection.union_type)("Fable.Form.Simple.Bulma.Fields.AllergyFinderField.AllergyFinderField.DetailModalState", [], AllergyFinderField_DetailModalState, ()=>[
|
|
543
|
+
[],
|
|
544
|
+
[
|
|
545
|
+
[
|
|
546
|
+
"Item",
|
|
547
|
+
(0, _Reflection.option_type)((0, _OpenFdaTypes.OpenFdaSearchResult_$reflection)())
|
|
548
|
+
]
|
|
549
|
+
],
|
|
550
|
+
[
|
|
551
|
+
[
|
|
552
|
+
"Item",
|
|
553
|
+
AllergyFinderField_AllergyEntry_$reflection()
|
|
554
|
+
]
|
|
555
|
+
]
|
|
556
|
+
]);
|
|
557
|
+
}
|
|
558
|
+
function AllergyFinderField_SeverityBadge(allergyFinderField_SeverityBadgeInputProps) {
|
|
559
|
+
const severity = allergyFinderField_SeverityBadgeInputProps.severity;
|
|
560
|
+
return (0, _react.createElement)("span", {
|
|
561
|
+
className: `inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium border ${AllergyFinderField_severityColor(severity)}`,
|
|
562
|
+
children: AllergyFinderField_severityLabel(severity)
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
function AllergyFinderField_CategoryBadge(allergyFinderField_CategoryBadgeInputProps) {
|
|
566
|
+
let value;
|
|
567
|
+
const category = allergyFinderField_CategoryBadgeInputProps.category;
|
|
568
|
+
return (0, _react.createElement)("span", (0, _Util.createObj)((0, _List.ofArray)([
|
|
569
|
+
(value = "inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-blue-50 text-blue-700 border border-blue-200", [
|
|
570
|
+
"className",
|
|
571
|
+
value
|
|
572
|
+
]),
|
|
573
|
+
[
|
|
574
|
+
"children",
|
|
575
|
+
AllergyFinderField_categoryLabel(category)
|
|
576
|
+
]
|
|
577
|
+
])));
|
|
578
|
+
}
|
|
579
|
+
function AllergyFinderField_FdaInsightsPanel(allergyFinderField_FdaInsightsPanelInputProps) {
|
|
580
|
+
let ins, elems_5;
|
|
581
|
+
const substanceName = allergyFinderField_FdaInsightsPanelInputProps.substanceName;
|
|
582
|
+
const apiFetch = allergyFinderField_FdaInsightsPanelInputProps.apiFetch;
|
|
583
|
+
const patternInput = _Interopfs.reactApi.useState(undefined);
|
|
584
|
+
const insights = patternInput[0];
|
|
585
|
+
const patternInput_1 = _Interopfs.reactApi.useState(true);
|
|
586
|
+
const setLoading = patternInput_1[1];
|
|
587
|
+
const dependencies = [
|
|
588
|
+
substanceName
|
|
589
|
+
];
|
|
590
|
+
_Interopfs.reactApi.useEffect(()=>{
|
|
591
|
+
setLoading(true);
|
|
592
|
+
const pr = (0, _Promisefs.PromiseBuilder__Run_212F1D4B)(_PromiseImplfs.promise, (0, _Promisefs.PromiseBuilder__Delay_62FBFDE1)(_PromiseImplfs.promise, ()=>(0, _OpenFdaClient.getAllergenInsights)(apiFetch, substanceName).then((_arg)=>{
|
|
593
|
+
patternInput[1](_arg);
|
|
594
|
+
setLoading(false);
|
|
595
|
+
return Promise.resolve();
|
|
596
|
+
})));
|
|
597
|
+
void pr;
|
|
598
|
+
}, dependencies);
|
|
599
|
+
if (patternInput_1[0]) {
|
|
600
|
+
return (0, _react.createElement)("div", {
|
|
601
|
+
className: "rounded-lg border border-slate-200 bg-slate-50 p-3 text-sm text-slate-500",
|
|
602
|
+
children: "Loading FDA insights..."
|
|
603
|
+
});
|
|
604
|
+
} else if (insights != null) {
|
|
605
|
+
if (ins = (0, _Option.value)(insights), (0, _List.isEmpty)(ins.Reactions) && ins.LabelWarnings == null) {
|
|
606
|
+
const ins_1 = (0, _Option.value)(insights);
|
|
607
|
+
return (0, _Util.defaultOf)();
|
|
608
|
+
} else {
|
|
609
|
+
const ins_2 = (0, _Option.value)(insights);
|
|
610
|
+
return (0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
611
|
+
[
|
|
612
|
+
"className",
|
|
613
|
+
"rounded-lg border border-slate-200 bg-slate-50 p-3 space-y-3"
|
|
614
|
+
],
|
|
615
|
+
(elems_5 = (0, _Seq.toList)((0, _Seq.delay)(()=>(0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("div", {
|
|
616
|
+
className: "text-xs font-semibold uppercase tracking-wide text-slate-500",
|
|
617
|
+
children: "FDA Insights"
|
|
618
|
+
})), (0, _Seq.delay)(()=>{
|
|
619
|
+
let top5, maxCount, elems_2;
|
|
620
|
+
return (0, _Seq.append)(!(0, _List.isEmpty)(ins_2.Reactions) ? (top5 = (0, _List.truncate)(5, ins_2.Reactions), maxCount = (0, _List.max)((0, _List.map)((r)=>r.Count, top5), {
|
|
621
|
+
Compare: _Util.comparePrimitives
|
|
622
|
+
}), (0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
623
|
+
[
|
|
624
|
+
"className",
|
|
625
|
+
"space-y-1"
|
|
626
|
+
],
|
|
627
|
+
(elems_2 = (0, _Seq.toList)((0, _Seq.delay)(()=>(0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("div", {
|
|
628
|
+
className: "text-xs font-medium text-slate-600 mb-1",
|
|
629
|
+
children: `Top Adverse Reactions (FAERS) — ${ins_2.TotalEvents} total reports`
|
|
630
|
+
})), (0, _Seq.delay)(()=>(0, _Seq.map)((r_1)=>{
|
|
631
|
+
let elems_1, elems;
|
|
632
|
+
return (0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
633
|
+
[
|
|
634
|
+
"className",
|
|
635
|
+
"flex items-center gap-2"
|
|
636
|
+
],
|
|
637
|
+
(elems_1 = [
|
|
638
|
+
(0, _react.createElement)("div", {
|
|
639
|
+
className: "w-28 text-xs text-slate-600 truncate",
|
|
640
|
+
children: r_1.Term
|
|
641
|
+
}),
|
|
642
|
+
(0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
643
|
+
[
|
|
644
|
+
"className",
|
|
645
|
+
"flex-1 bg-slate-200 rounded-full h-2"
|
|
646
|
+
],
|
|
647
|
+
(elems = [
|
|
648
|
+
(0, _react.createElement)("div", {
|
|
649
|
+
className: "bg-blue-500 rounded-full h-2",
|
|
650
|
+
style: {
|
|
651
|
+
width: r_1.Count / maxCount * 100 + "%"
|
|
652
|
+
}
|
|
653
|
+
})
|
|
654
|
+
], [
|
|
655
|
+
"children",
|
|
656
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems))
|
|
657
|
+
])
|
|
658
|
+
]))),
|
|
659
|
+
(0, _react.createElement)("div", {
|
|
660
|
+
className: "w-12 text-xs text-slate-500 text-right",
|
|
661
|
+
children: (0, _Util.int32ToString)(r_1.Count)
|
|
662
|
+
})
|
|
663
|
+
], [
|
|
664
|
+
"children",
|
|
665
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_1))
|
|
666
|
+
])
|
|
667
|
+
])));
|
|
668
|
+
}, top5))))), [
|
|
669
|
+
"children",
|
|
670
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_2))
|
|
671
|
+
])
|
|
672
|
+
]))))) : (0, _Seq.empty)(), (0, _Seq.delay)(()=>{
|
|
673
|
+
let matchValue_2, c, c_1, elems_3;
|
|
674
|
+
const matchValue_1 = ins_2.LabelWarnings;
|
|
675
|
+
if (matchValue_1 == null) {
|
|
676
|
+
return (0, _Seq.empty)();
|
|
677
|
+
} else {
|
|
678
|
+
const warnings = (0, _Option.value)(matchValue_1);
|
|
679
|
+
return (0, _Seq.append)((matchValue_2 = warnings.Contraindications, matchValue_2 != null ? (c = (0, _Option.value)(matchValue_2), c.length > 0) ? (c_1 = (0, _Option.value)(matchValue_2), (0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
680
|
+
[
|
|
681
|
+
"className",
|
|
682
|
+
"text-xs space-y-1"
|
|
683
|
+
],
|
|
684
|
+
(elems_3 = [
|
|
685
|
+
(0, _react.createElement)("div", {
|
|
686
|
+
className: "font-semibold text-slate-600",
|
|
687
|
+
children: "Contraindications"
|
|
688
|
+
}),
|
|
689
|
+
(0, _react.createElement)("div", {
|
|
690
|
+
className: "text-slate-500 line-clamp-3",
|
|
691
|
+
children: c_1
|
|
692
|
+
})
|
|
693
|
+
], [
|
|
694
|
+
"children",
|
|
695
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_3))
|
|
696
|
+
])
|
|
697
|
+
]))))) : (0, _Seq.empty)() : (0, _Seq.empty)()), (0, _Seq.delay)(()=>{
|
|
698
|
+
let elems_4, w;
|
|
699
|
+
const matchValue_3 = warnings.Warnings;
|
|
700
|
+
let matchResult, w_1;
|
|
701
|
+
if (matchValue_3 != null) {
|
|
702
|
+
if (w = (0, _Option.value)(matchValue_3), w.length > 0) {
|
|
703
|
+
matchResult = 0;
|
|
704
|
+
w_1 = (0, _Option.value)(matchValue_3);
|
|
705
|
+
} else {
|
|
706
|
+
matchResult = 1;
|
|
707
|
+
}
|
|
708
|
+
} else {
|
|
709
|
+
matchResult = 1;
|
|
710
|
+
}
|
|
711
|
+
switch(matchResult){
|
|
712
|
+
case 0:
|
|
713
|
+
return (0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
714
|
+
[
|
|
715
|
+
"className",
|
|
716
|
+
"text-xs space-y-1"
|
|
717
|
+
],
|
|
718
|
+
(elems_4 = [
|
|
719
|
+
(0, _react.createElement)("div", {
|
|
720
|
+
className: "font-semibold text-slate-600",
|
|
721
|
+
children: "Warnings"
|
|
722
|
+
}),
|
|
723
|
+
(0, _react.createElement)("div", {
|
|
724
|
+
className: "text-slate-500 line-clamp-3",
|
|
725
|
+
children: w_1
|
|
726
|
+
})
|
|
727
|
+
], [
|
|
728
|
+
"children",
|
|
729
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_4))
|
|
730
|
+
])
|
|
731
|
+
]))));
|
|
732
|
+
default:
|
|
733
|
+
{
|
|
734
|
+
return (0, _Seq.empty)();
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
}));
|
|
738
|
+
}
|
|
739
|
+
}));
|
|
740
|
+
})))), [
|
|
741
|
+
"children",
|
|
742
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_5))
|
|
743
|
+
])
|
|
744
|
+
])));
|
|
745
|
+
}
|
|
746
|
+
} else {
|
|
747
|
+
return (0, _Util.defaultOf)();
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
function AllergyFinderField_ReactionCheckboxes(allergyFinderField_ReactionCheckboxesInputProps) {
|
|
751
|
+
let elems_3, elems_1, elems_2, value_16;
|
|
752
|
+
const onChange = allergyFinderField_ReactionCheckboxesInputProps.onChange;
|
|
753
|
+
const selected = allergyFinderField_ReactionCheckboxesInputProps.selected;
|
|
754
|
+
const substanceName = allergyFinderField_ReactionCheckboxesInputProps.substanceName;
|
|
755
|
+
const apiFetch = allergyFinderField_ReactionCheckboxesInputProps.apiFetch;
|
|
756
|
+
const patternInput = _Interopfs.reactApi.useState((0, _List.empty)());
|
|
757
|
+
const fdaReactions = patternInput[0];
|
|
758
|
+
const patternInput_1 = _Interopfs.reactApi.useState("");
|
|
759
|
+
const setCustomReaction = patternInput_1[1];
|
|
760
|
+
const customReaction = patternInput_1[0];
|
|
761
|
+
const dependencies = [
|
|
762
|
+
substanceName
|
|
763
|
+
];
|
|
764
|
+
_Interopfs.reactApi.useEffect(()=>{
|
|
765
|
+
let sub;
|
|
766
|
+
let matchResult, sub_1;
|
|
767
|
+
if (substanceName != null) {
|
|
768
|
+
if (sub = (0, _Option.value)(substanceName), sub.length > 0) {
|
|
769
|
+
matchResult = 0;
|
|
770
|
+
sub_1 = (0, _Option.value)(substanceName);
|
|
771
|
+
} else {
|
|
772
|
+
matchResult = 1;
|
|
773
|
+
}
|
|
774
|
+
} else {
|
|
775
|
+
matchResult = 1;
|
|
776
|
+
}
|
|
777
|
+
switch(matchResult){
|
|
778
|
+
case 0:
|
|
779
|
+
{
|
|
780
|
+
const pr = (0, _Promisefs.PromiseBuilder__Run_212F1D4B)(_PromiseImplfs.promise, (0, _Promisefs.PromiseBuilder__Delay_62FBFDE1)(_PromiseImplfs.promise, ()=>(0, _OpenFdaClient.getAllergenInsights)(apiFetch, sub_1).then((_arg)=>{
|
|
781
|
+
patternInput[1]((0, _List.map)((r)=>r.Term, (0, _List.truncate)(8, _arg.Reactions)));
|
|
782
|
+
return Promise.resolve();
|
|
783
|
+
})));
|
|
784
|
+
void pr;
|
|
785
|
+
break;
|
|
786
|
+
}
|
|
787
|
+
case 1:
|
|
788
|
+
{
|
|
789
|
+
break;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
}, dependencies);
|
|
793
|
+
const allReactions = (0, _List.append)((0, _List.map)((r_1)=>[
|
|
794
|
+
r_1,
|
|
795
|
+
true
|
|
796
|
+
], fdaReactions), (0, _List.map)((r_2)=>[
|
|
797
|
+
r_2,
|
|
798
|
+
false
|
|
799
|
+
], (0, _List.filter)((c)=>!(0, _List.exists)((f)=>(0, _String.compare)(f, c, 5) === 0, fdaReactions), (0, _List.ofArray)(AllergyFinderField_commonReactions))));
|
|
800
|
+
const addCustomReaction = ()=>{
|
|
801
|
+
const trimmed = customReaction.trim();
|
|
802
|
+
if (trimmed.length > 0 && !(0, _List.contains)(trimmed, selected, {
|
|
803
|
+
Equals: (x_1, y_1)=>x_1 === y_1,
|
|
804
|
+
GetHashCode: _Util.stringHash
|
|
805
|
+
})) {
|
|
806
|
+
onChange((0, _List.append)(selected, (0, _List.singleton)(trimmed)));
|
|
807
|
+
setCustomReaction("");
|
|
808
|
+
}
|
|
809
|
+
};
|
|
810
|
+
return (0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
811
|
+
[
|
|
812
|
+
"className",
|
|
813
|
+
"space-y-2"
|
|
814
|
+
],
|
|
815
|
+
(elems_3 = [
|
|
816
|
+
(0, _react.createElement)("label", {
|
|
817
|
+
className: "text-xs font-semibold uppercase tracking-wide text-slate-700",
|
|
818
|
+
children: "Reactions"
|
|
819
|
+
}),
|
|
820
|
+
(0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
821
|
+
[
|
|
822
|
+
"className",
|
|
823
|
+
"flex flex-wrap gap-2"
|
|
824
|
+
],
|
|
825
|
+
(elems_1 = (0, _Seq.toList)((0, _Seq.delay)(()=>(0, _Seq.collect)((matchValue)=>{
|
|
826
|
+
let elems;
|
|
827
|
+
const reaction_1 = matchValue[0];
|
|
828
|
+
const isChecked = (0, _List.contains)(reaction_1, selected, {
|
|
829
|
+
Equals: (x_2, y_2)=>x_2 === y_2,
|
|
830
|
+
GetHashCode: _Util.stringHash
|
|
831
|
+
});
|
|
832
|
+
return (0, _Seq.singleton)((0, _react.createElement)("button", (0, _Util.createObj)((0, _List.ofArray)([
|
|
833
|
+
[
|
|
834
|
+
"className",
|
|
835
|
+
isChecked ? "rounded-full px-2.5 py-1 text-xs font-medium border bg-blue-100 text-blue-700 border-blue-300" : "rounded-full px-2.5 py-1 text-xs font-medium border bg-white text-slate-600 border-slate-200 hover:bg-slate-50"
|
|
836
|
+
],
|
|
837
|
+
[
|
|
838
|
+
"onClick",
|
|
839
|
+
(_arg_1)=>{
|
|
840
|
+
const reaction = reaction_1;
|
|
841
|
+
if ((0, _List.contains)(reaction, selected, {
|
|
842
|
+
Equals: (x, y)=>x === y,
|
|
843
|
+
GetHashCode: _Util.stringHash
|
|
844
|
+
})) {
|
|
845
|
+
onChange((0, _List.filter)((r_3)=>r_3 !== reaction, selected));
|
|
846
|
+
} else {
|
|
847
|
+
onChange((0, _List.append)(selected, (0, _List.singleton)(reaction)));
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
],
|
|
851
|
+
(elems = [
|
|
852
|
+
matchValue[1] && !isChecked ? `* ${reaction_1}` : reaction_1
|
|
853
|
+
], [
|
|
854
|
+
"children",
|
|
855
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems))
|
|
856
|
+
])
|
|
857
|
+
]))));
|
|
858
|
+
}, allReactions))), [
|
|
859
|
+
"children",
|
|
860
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_1))
|
|
861
|
+
])
|
|
862
|
+
]))),
|
|
863
|
+
(0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
864
|
+
[
|
|
865
|
+
"className",
|
|
866
|
+
"flex gap-2"
|
|
867
|
+
],
|
|
868
|
+
(elems_2 = [
|
|
869
|
+
(0, _react.createElement)("input", (0, _Util.createObj)((0, _List.ofArray)([
|
|
870
|
+
(value_16 = "flex-1 rounded-md border border-slate-300 px-2.5 py-1.5 text-sm placeholder:text-slate-400 focus:border-sky-500 focus:outline-none focus:ring-2 focus:ring-sky-500/30", [
|
|
871
|
+
"className",
|
|
872
|
+
value_16
|
|
873
|
+
]),
|
|
874
|
+
[
|
|
875
|
+
"placeholder",
|
|
876
|
+
"Add custom reaction..."
|
|
877
|
+
],
|
|
878
|
+
[
|
|
879
|
+
"value",
|
|
880
|
+
customReaction
|
|
881
|
+
],
|
|
882
|
+
[
|
|
883
|
+
"onChange",
|
|
884
|
+
(ev)=>{
|
|
885
|
+
setCustomReaction(ev.target.value);
|
|
886
|
+
}
|
|
887
|
+
],
|
|
888
|
+
[
|
|
889
|
+
"onKeyDown",
|
|
890
|
+
(e)=>{
|
|
891
|
+
if (e.key === "Enter") {
|
|
892
|
+
e.preventDefault();
|
|
893
|
+
addCustomReaction();
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
]
|
|
897
|
+
]))),
|
|
898
|
+
(0, _react.createElement)("button", {
|
|
899
|
+
className: "rounded-md bg-slate-100 px-3 py-1.5 text-sm font-medium text-slate-600 hover:bg-slate-200",
|
|
900
|
+
children: "Add",
|
|
901
|
+
onClick: (_arg_2)=>{
|
|
902
|
+
addCustomReaction();
|
|
903
|
+
}
|
|
904
|
+
})
|
|
905
|
+
], [
|
|
906
|
+
"children",
|
|
907
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_2))
|
|
908
|
+
])
|
|
909
|
+
])))
|
|
910
|
+
], [
|
|
911
|
+
"children",
|
|
912
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_3))
|
|
913
|
+
])
|
|
914
|
+
])));
|
|
915
|
+
}
|
|
916
|
+
function AllergyFinderField_AllergyDetailModal(allergyFinderField_AllergyDetailModalInputProps) {
|
|
917
|
+
let elems_14, elems_13, elems_28, elems_27;
|
|
918
|
+
const onSave = allergyFinderField_AllergyDetailModalInputProps.onSave;
|
|
919
|
+
const onClose = allergyFinderField_AllergyDetailModalInputProps.onClose;
|
|
920
|
+
const modalState = allergyFinderField_AllergyDetailModalInputProps.modalState;
|
|
921
|
+
const apiFetch = allergyFinderField_AllergyDetailModalInputProps.apiFetch;
|
|
922
|
+
switch(modalState.tag){
|
|
923
|
+
case /* Adding */ 1:
|
|
924
|
+
{
|
|
925
|
+
const fdaResult = modalState.fields[0];
|
|
926
|
+
const initialName = (0, _Option.defaultArg)((0, _Option.map)((r)=>r.Name, fdaResult), "");
|
|
927
|
+
const initialSubstance = (0, _Option.defaultArg)((0, _Option.map)((r_1)=>r_1.SubstanceName, fdaResult), "");
|
|
928
|
+
const initialCategory = (0, _Option.defaultArg)((0, _Option.map)((r_2)=>r_2.Category, fdaResult), (0, _OpenFdaTypes.AllergyCategory_Drug)());
|
|
929
|
+
const initialNdc = (0, _Option.bind)((r_3)=>r_3.NdcCode, fdaResult);
|
|
930
|
+
const patternInput = _Interopfs.reactApi.useState(initialName);
|
|
931
|
+
const name = patternInput[0];
|
|
932
|
+
const patternInput_1 = _Interopfs.reactApi.useState(AllergyFinderField_AllergySeverity_Moderate());
|
|
933
|
+
const severity = patternInput_1[0];
|
|
934
|
+
const patternInput_2 = _Interopfs.reactApi.useState((0, _List.empty)());
|
|
935
|
+
const reactions = patternInput_2[0];
|
|
936
|
+
const patternInput_3 = _Interopfs.reactApi.useState("");
|
|
937
|
+
const remedy = patternInput_3[0];
|
|
938
|
+
const patternInput_4 = _Interopfs.reactApi.useState("unknown");
|
|
939
|
+
const onset = patternInput_4[0];
|
|
940
|
+
const patternInput_5 = _Interopfs.reactApi.useState(false);
|
|
941
|
+
const staffOnly = patternInput_5[0];
|
|
942
|
+
const patternInput_6 = _Interopfs.reactApi.useState("");
|
|
943
|
+
const notes = patternInput_6[0];
|
|
944
|
+
const meta = (0, _Option.defaultArg)((0, _Option.map)((r_4)=>(0, _String.join)(" · ", (0, _List.choose)((x)=>x, (0, _List.ofArray)([
|
|
945
|
+
r_4.DosageForm,
|
|
946
|
+
r_4.Route,
|
|
947
|
+
r_4.Strength
|
|
948
|
+
]))), fdaResult), "");
|
|
949
|
+
const provenance = (0, _Option.defaultArg)((0, _Option.map)((r_5)=>(0, _String.join)(" · ", (0, _List.choose)((x_1)=>x_1, (0, _List.ofArray)([
|
|
950
|
+
r_5.Manufacturer,
|
|
951
|
+
(0, _Option.map)((n)=>`NDC ${n}`, r_5.NdcCode)
|
|
952
|
+
]))), fdaResult), "");
|
|
953
|
+
return (0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
954
|
+
[
|
|
955
|
+
"className",
|
|
956
|
+
"fixed inset-0 z-50 flex items-center justify-center bg-black/50"
|
|
957
|
+
],
|
|
958
|
+
[
|
|
959
|
+
"onClick",
|
|
960
|
+
(e)=>{
|
|
961
|
+
if ((0, _Util.equals)(e.target, e.currentTarget)) {
|
|
962
|
+
onClose();
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
],
|
|
966
|
+
(elems_14 = [
|
|
967
|
+
(0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
968
|
+
[
|
|
969
|
+
"className",
|
|
970
|
+
"bg-white rounded-xl shadow-xl max-w-lg w-full max-h-[90vh] overflow-y-auto mx-4 p-5 space-y-4"
|
|
971
|
+
],
|
|
972
|
+
[
|
|
973
|
+
"onClick",
|
|
974
|
+
(e_1)=>{
|
|
975
|
+
e_1.stopPropagation();
|
|
976
|
+
}
|
|
977
|
+
],
|
|
978
|
+
(elems_13 = (0, _Seq.toList)((0, _Seq.delay)(()=>{
|
|
979
|
+
let elems;
|
|
980
|
+
return (0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
981
|
+
[
|
|
982
|
+
"className",
|
|
983
|
+
"flex items-center justify-between"
|
|
984
|
+
],
|
|
985
|
+
(elems = [
|
|
986
|
+
(0, _react.createElement)("h3", {
|
|
987
|
+
className: "text-lg font-semibold text-slate-900",
|
|
988
|
+
children: "Add Allergy"
|
|
989
|
+
}),
|
|
990
|
+
(0, _react.createElement)("button", {
|
|
991
|
+
className: "text-slate-400 hover:text-slate-600 text-xl",
|
|
992
|
+
dangerouslySetInnerHTML: {
|
|
993
|
+
__html: "×"
|
|
994
|
+
},
|
|
995
|
+
onClick: (_arg)=>{
|
|
996
|
+
onClose();
|
|
997
|
+
}
|
|
998
|
+
})
|
|
999
|
+
], [
|
|
1000
|
+
"children",
|
|
1001
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems))
|
|
1002
|
+
])
|
|
1003
|
+
])))), (0, _Seq.delay)(()=>{
|
|
1004
|
+
let matchValue, elems_3, value_50, r_6, elems_2;
|
|
1005
|
+
return (0, _Seq.append)((matchValue = fdaResult, matchValue == null ? (0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1006
|
+
[
|
|
1007
|
+
"className",
|
|
1008
|
+
"space-y-1"
|
|
1009
|
+
],
|
|
1010
|
+
(elems_3 = [
|
|
1011
|
+
(0, _react.createElement)("label", {
|
|
1012
|
+
className: "text-xs font-semibold uppercase tracking-wide text-slate-700",
|
|
1013
|
+
children: "Allergen Name"
|
|
1014
|
+
}),
|
|
1015
|
+
(0, _react.createElement)("input", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1016
|
+
(value_50 = "w-full rounded-md border border-slate-300 px-2.5 py-1.5 text-sm placeholder:text-slate-400 focus:border-sky-500 focus:outline-none focus:ring-2 focus:ring-sky-500/30", [
|
|
1017
|
+
"className",
|
|
1018
|
+
value_50
|
|
1019
|
+
]),
|
|
1020
|
+
[
|
|
1021
|
+
"value",
|
|
1022
|
+
name
|
|
1023
|
+
],
|
|
1024
|
+
[
|
|
1025
|
+
"onChange",
|
|
1026
|
+
(ev)=>{
|
|
1027
|
+
patternInput[1](ev.target.value);
|
|
1028
|
+
}
|
|
1029
|
+
],
|
|
1030
|
+
[
|
|
1031
|
+
"placeholder",
|
|
1032
|
+
"Enter allergen name"
|
|
1033
|
+
]
|
|
1034
|
+
])))
|
|
1035
|
+
], [
|
|
1036
|
+
"children",
|
|
1037
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_3))
|
|
1038
|
+
])
|
|
1039
|
+
])))) : (r_6 = (0, _Option.value)(matchValue), (0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1040
|
+
[
|
|
1041
|
+
"className",
|
|
1042
|
+
"rounded-lg border border-slate-200 bg-slate-50 p-3 space-y-1"
|
|
1043
|
+
],
|
|
1044
|
+
(elems_2 = (0, _Seq.toList)((0, _Seq.delay)(()=>{
|
|
1045
|
+
let elems_1;
|
|
1046
|
+
return (0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1047
|
+
[
|
|
1048
|
+
"className",
|
|
1049
|
+
"flex items-start justify-between gap-2"
|
|
1050
|
+
],
|
|
1051
|
+
(elems_1 = [
|
|
1052
|
+
(0, _react.createElement)("span", {
|
|
1053
|
+
className: "font-semibold text-sm text-slate-900",
|
|
1054
|
+
children: name
|
|
1055
|
+
}),
|
|
1056
|
+
(0, _react.createElement)(AllergyFinderField_CategoryBadge, {
|
|
1057
|
+
category: initialCategory
|
|
1058
|
+
})
|
|
1059
|
+
], [
|
|
1060
|
+
"children",
|
|
1061
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_1))
|
|
1062
|
+
])
|
|
1063
|
+
])))), (0, _Seq.delay)(()=>(0, _Seq.append)(initialSubstance !== name ? (0, _Seq.singleton)((0, _react.createElement)("p", {
|
|
1064
|
+
className: "text-xs text-slate-500",
|
|
1065
|
+
children: initialSubstance
|
|
1066
|
+
})) : (0, _Seq.empty)(), (0, _Seq.delay)(()=>(0, _Seq.append)(meta.length > 0 ? (0, _Seq.singleton)((0, _react.createElement)("p", {
|
|
1067
|
+
className: "text-[11px] text-slate-400",
|
|
1068
|
+
children: meta
|
|
1069
|
+
})) : (0, _Seq.empty)(), (0, _Seq.delay)(()=>provenance.length > 0 ? (0, _Seq.singleton)((0, _react.createElement)("p", {
|
|
1070
|
+
className: "text-[11px] text-slate-400",
|
|
1071
|
+
children: provenance
|
|
1072
|
+
})) : (0, _Seq.empty)()))))));
|
|
1073
|
+
})), [
|
|
1074
|
+
"children",
|
|
1075
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_2))
|
|
1076
|
+
])
|
|
1077
|
+
])))))), (0, _Seq.delay)(()=>{
|
|
1078
|
+
let elems_4;
|
|
1079
|
+
return (0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("label", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1080
|
+
[
|
|
1081
|
+
"className",
|
|
1082
|
+
"flex items-center gap-2 text-sm cursor-pointer"
|
|
1083
|
+
],
|
|
1084
|
+
(elems_4 = [
|
|
1085
|
+
(0, _react.createElement)("input", {
|
|
1086
|
+
type: "checkbox",
|
|
1087
|
+
checked: staffOnly,
|
|
1088
|
+
onChange: (ev_1)=>{
|
|
1089
|
+
const _arg_1 = ev_1.target.checked;
|
|
1090
|
+
patternInput_5[1](!staffOnly);
|
|
1091
|
+
},
|
|
1092
|
+
className: "rounded border-slate-300"
|
|
1093
|
+
}),
|
|
1094
|
+
"Medical Staff Only"
|
|
1095
|
+
], [
|
|
1096
|
+
"children",
|
|
1097
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_4))
|
|
1098
|
+
])
|
|
1099
|
+
])))), (0, _Seq.delay)(()=>{
|
|
1100
|
+
let elems_6, elems_5;
|
|
1101
|
+
return (0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1102
|
+
[
|
|
1103
|
+
"className",
|
|
1104
|
+
"space-y-2"
|
|
1105
|
+
],
|
|
1106
|
+
(elems_6 = [
|
|
1107
|
+
(0, _react.createElement)("label", {
|
|
1108
|
+
className: "text-xs font-semibold uppercase tracking-wide text-slate-700",
|
|
1109
|
+
children: "Severity"
|
|
1110
|
+
}),
|
|
1111
|
+
(0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1112
|
+
[
|
|
1113
|
+
"className",
|
|
1114
|
+
"flex flex-wrap gap-2"
|
|
1115
|
+
],
|
|
1116
|
+
(elems_5 = (0, _Seq.toList)((0, _Seq.delay)(()=>(0, _Seq.collect)((sev)=>(0, _Seq.singleton)((0, _react.createElement)("button", {
|
|
1117
|
+
className: (0, _Util.equals)(severity, sev) ? `rounded-full px-3 py-1 text-xs font-medium border-2 ${AllergyFinderField_severityColor(sev)}` : "rounded-full px-3 py-1 text-xs font-medium border border-slate-200 bg-white text-slate-600 hover:bg-slate-50",
|
|
1118
|
+
onClick: (_arg_2)=>{
|
|
1119
|
+
patternInput_1[1](sev);
|
|
1120
|
+
},
|
|
1121
|
+
children: AllergyFinderField_severityLabel(sev)
|
|
1122
|
+
})), [
|
|
1123
|
+
AllergyFinderField_AllergySeverity_Unknown(),
|
|
1124
|
+
AllergyFinderField_AllergySeverity_Mild(),
|
|
1125
|
+
AllergyFinderField_AllergySeverity_Moderate(),
|
|
1126
|
+
AllergyFinderField_AllergySeverity_Severe(),
|
|
1127
|
+
AllergyFinderField_AllergySeverity_LifeThreatening()
|
|
1128
|
+
]))), [
|
|
1129
|
+
"children",
|
|
1130
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_5))
|
|
1131
|
+
])
|
|
1132
|
+
])))
|
|
1133
|
+
], [
|
|
1134
|
+
"children",
|
|
1135
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_6))
|
|
1136
|
+
])
|
|
1137
|
+
])))), (0, _Seq.delay)(()=>{
|
|
1138
|
+
const substanceForInsights = initialCategory.tag === /* Drug */ 0 ? initialSubstance.length > 0 ? initialSubstance : undefined : initialCategory.tag === /* Environmental */ 2 ? initialSubstance.length > 0 ? initialSubstance : undefined : undefined;
|
|
1139
|
+
return (0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)(AllergyFinderField_ReactionCheckboxes, {
|
|
1140
|
+
apiFetch: apiFetch,
|
|
1141
|
+
substanceName: (0, _Option.unwrap)(substanceForInsights),
|
|
1142
|
+
selected: reactions,
|
|
1143
|
+
onChange: patternInput_2[1]
|
|
1144
|
+
})), (0, _Seq.delay)(()=>{
|
|
1145
|
+
let elems_7, value_89;
|
|
1146
|
+
return (0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1147
|
+
[
|
|
1148
|
+
"className",
|
|
1149
|
+
"space-y-1"
|
|
1150
|
+
],
|
|
1151
|
+
(elems_7 = [
|
|
1152
|
+
(0, _react.createElement)("label", {
|
|
1153
|
+
className: "text-xs font-semibold uppercase tracking-wide text-slate-700",
|
|
1154
|
+
children: "Remedy"
|
|
1155
|
+
}),
|
|
1156
|
+
(0, _react.createElement)("textarea", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1157
|
+
(value_89 = "w-full rounded-md border border-slate-300 px-2.5 py-1.5 text-sm placeholder:text-slate-400 focus:border-sky-500 focus:outline-none focus:ring-2 focus:ring-sky-500/30", [
|
|
1158
|
+
"className",
|
|
1159
|
+
value_89
|
|
1160
|
+
]),
|
|
1161
|
+
[
|
|
1162
|
+
"value",
|
|
1163
|
+
remedy
|
|
1164
|
+
],
|
|
1165
|
+
[
|
|
1166
|
+
"onChange",
|
|
1167
|
+
(ev_2)=>{
|
|
1168
|
+
patternInput_3[1](ev_2.target.value);
|
|
1169
|
+
}
|
|
1170
|
+
],
|
|
1171
|
+
[
|
|
1172
|
+
"placeholder",
|
|
1173
|
+
"e.g., Epipen, Benadryl 50mg, avoid exposure..."
|
|
1174
|
+
],
|
|
1175
|
+
[
|
|
1176
|
+
"rows",
|
|
1177
|
+
2
|
|
1178
|
+
]
|
|
1179
|
+
])))
|
|
1180
|
+
], [
|
|
1181
|
+
"children",
|
|
1182
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_7))
|
|
1183
|
+
])
|
|
1184
|
+
])))), (0, _Seq.delay)(()=>{
|
|
1185
|
+
let elems_10, elems_9;
|
|
1186
|
+
return (0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1187
|
+
[
|
|
1188
|
+
"className",
|
|
1189
|
+
"space-y-2"
|
|
1190
|
+
],
|
|
1191
|
+
(elems_10 = [
|
|
1192
|
+
(0, _react.createElement)("label", {
|
|
1193
|
+
className: "text-xs font-semibold uppercase tracking-wide text-slate-700",
|
|
1194
|
+
children: "Onset Timing"
|
|
1195
|
+
}),
|
|
1196
|
+
(0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1197
|
+
[
|
|
1198
|
+
"className",
|
|
1199
|
+
"flex flex-wrap gap-3"
|
|
1200
|
+
],
|
|
1201
|
+
(elems_9 = (0, _Seq.toList)((0, _Seq.delay)(()=>(0, _Seq.collect)((matchValue_1)=>{
|
|
1202
|
+
let elems_8;
|
|
1203
|
+
const value_107 = matchValue_1[0];
|
|
1204
|
+
return (0, _Seq.singleton)((0, _react.createElement)("label", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1205
|
+
[
|
|
1206
|
+
"className",
|
|
1207
|
+
"flex items-center gap-1.5 text-sm cursor-pointer"
|
|
1208
|
+
],
|
|
1209
|
+
(elems_8 = [
|
|
1210
|
+
(0, _react.createElement)("input", {
|
|
1211
|
+
type: "radio",
|
|
1212
|
+
name: "onset",
|
|
1213
|
+
value: value_107,
|
|
1214
|
+
checked: onset === value_107,
|
|
1215
|
+
onChange: (ev_3)=>{
|
|
1216
|
+
const _arg_3 = ev_3.target.value;
|
|
1217
|
+
patternInput_4[1](value_107);
|
|
1218
|
+
}
|
|
1219
|
+
}),
|
|
1220
|
+
matchValue_1[1]
|
|
1221
|
+
], [
|
|
1222
|
+
"children",
|
|
1223
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_8))
|
|
1224
|
+
])
|
|
1225
|
+
]))));
|
|
1226
|
+
}, [
|
|
1227
|
+
[
|
|
1228
|
+
"immediate",
|
|
1229
|
+
"Immediate (<1hr)"
|
|
1230
|
+
],
|
|
1231
|
+
[
|
|
1232
|
+
"delayed",
|
|
1233
|
+
"Delayed (1-72hr)"
|
|
1234
|
+
],
|
|
1235
|
+
[
|
|
1236
|
+
"unknown",
|
|
1237
|
+
"Unknown"
|
|
1238
|
+
]
|
|
1239
|
+
]))), [
|
|
1240
|
+
"children",
|
|
1241
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_9))
|
|
1242
|
+
])
|
|
1243
|
+
])))
|
|
1244
|
+
], [
|
|
1245
|
+
"children",
|
|
1246
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_10))
|
|
1247
|
+
])
|
|
1248
|
+
])))), (0, _Seq.delay)(()=>{
|
|
1249
|
+
let elems_11, value_128;
|
|
1250
|
+
return (0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1251
|
+
[
|
|
1252
|
+
"className",
|
|
1253
|
+
"space-y-1"
|
|
1254
|
+
],
|
|
1255
|
+
(elems_11 = [
|
|
1256
|
+
(0, _react.createElement)("label", {
|
|
1257
|
+
className: "text-xs font-semibold uppercase tracking-wide text-slate-700",
|
|
1258
|
+
children: "Notes (optional)"
|
|
1259
|
+
}),
|
|
1260
|
+
(0, _react.createElement)("textarea", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1261
|
+
(value_128 = "w-full rounded-md border border-slate-300 px-2.5 py-1.5 text-sm placeholder:text-slate-400 focus:border-sky-500 focus:outline-none focus:ring-2 focus:ring-sky-500/30", [
|
|
1262
|
+
"className",
|
|
1263
|
+
value_128
|
|
1264
|
+
]),
|
|
1265
|
+
[
|
|
1266
|
+
"value",
|
|
1267
|
+
notes
|
|
1268
|
+
],
|
|
1269
|
+
[
|
|
1270
|
+
"onChange",
|
|
1271
|
+
(ev_4)=>{
|
|
1272
|
+
patternInput_6[1](ev_4.target.value);
|
|
1273
|
+
}
|
|
1274
|
+
],
|
|
1275
|
+
[
|
|
1276
|
+
"placeholder",
|
|
1277
|
+
"e.g., Diagnosed at age 12, confirmed by allergist..."
|
|
1278
|
+
],
|
|
1279
|
+
[
|
|
1280
|
+
"rows",
|
|
1281
|
+
2
|
|
1282
|
+
]
|
|
1283
|
+
])))
|
|
1284
|
+
], [
|
|
1285
|
+
"children",
|
|
1286
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_11))
|
|
1287
|
+
])
|
|
1288
|
+
])))), (0, _Seq.delay)(()=>(0, _Seq.append)(((0, _Util.equals)(initialCategory, (0, _OpenFdaTypes.AllergyCategory_Drug)()) ? true : (0, _Util.equals)(initialCategory, (0, _OpenFdaTypes.AllergyCategory_Environmental)())) && initialSubstance.length > 0 ? (0, _Seq.singleton)((0, _react.createElement)(AllergyFinderField_FdaInsightsPanel, {
|
|
1289
|
+
apiFetch: apiFetch,
|
|
1290
|
+
substanceName: initialSubstance
|
|
1291
|
+
})) : (0, _Seq.empty)(), (0, _Seq.delay)(()=>{
|
|
1292
|
+
let elems_12;
|
|
1293
|
+
return (0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1294
|
+
[
|
|
1295
|
+
"className",
|
|
1296
|
+
"flex justify-end gap-2 pt-2"
|
|
1297
|
+
],
|
|
1298
|
+
(elems_12 = [
|
|
1299
|
+
(0, _react.createElement)("button", {
|
|
1300
|
+
className: "rounded-md border border-slate-200 px-4 py-2 text-sm font-medium text-slate-600 hover:bg-slate-50",
|
|
1301
|
+
children: "Cancel",
|
|
1302
|
+
onClick: (_arg_4)=>{
|
|
1303
|
+
onClose();
|
|
1304
|
+
}
|
|
1305
|
+
}),
|
|
1306
|
+
(0, _react.createElement)("button", {
|
|
1307
|
+
className: "rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700",
|
|
1308
|
+
children: "Save Allergy",
|
|
1309
|
+
onClick: (_arg_5)=>{
|
|
1310
|
+
let copyOfStruct;
|
|
1311
|
+
onSave(new AllergyFinderField_AllergyEntry((copyOfStruct = (0, _Guid.newGuid)(), copyOfStruct), (0, _String.isNullOrWhiteSpace)(name) ? "Unknown Allergen" : name, (0, _String.isNullOrWhiteSpace)(initialSubstance) ? name : initialSubstance, initialNdc, initialCategory, severity, reactions, (0, _String.isNullOrWhiteSpace)(remedy) ? undefined : remedy, onset, staffOnly, (0, _String.isNullOrWhiteSpace)(notes) ? undefined : notes));
|
|
1312
|
+
}
|
|
1313
|
+
})
|
|
1314
|
+
], [
|
|
1315
|
+
"children",
|
|
1316
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_12))
|
|
1317
|
+
])
|
|
1318
|
+
]))));
|
|
1319
|
+
}))));
|
|
1320
|
+
}));
|
|
1321
|
+
}));
|
|
1322
|
+
}));
|
|
1323
|
+
}));
|
|
1324
|
+
}));
|
|
1325
|
+
}));
|
|
1326
|
+
}));
|
|
1327
|
+
})), [
|
|
1328
|
+
"children",
|
|
1329
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_13))
|
|
1330
|
+
])
|
|
1331
|
+
])))
|
|
1332
|
+
], [
|
|
1333
|
+
"children",
|
|
1334
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_14))
|
|
1335
|
+
])
|
|
1336
|
+
])));
|
|
1337
|
+
}
|
|
1338
|
+
case /* Editing */ 2:
|
|
1339
|
+
{
|
|
1340
|
+
const existingEntry = modalState.fields[0];
|
|
1341
|
+
const name_69 = _Interopfs.reactApi.useState(existingEntry.Name)[0];
|
|
1342
|
+
const patternInput_8 = _Interopfs.reactApi.useState(existingEntry.Severity);
|
|
1343
|
+
const severity_1 = patternInput_8[0];
|
|
1344
|
+
const patternInput_9 = _Interopfs.reactApi.useState(existingEntry.Reactions);
|
|
1345
|
+
const reactions_1 = patternInput_9[0];
|
|
1346
|
+
let patternInput_10;
|
|
1347
|
+
const initial_10 = (0, _Option.defaultArg)(existingEntry.Remedy, "");
|
|
1348
|
+
patternInput_10 = _Interopfs.reactApi.useState(initial_10);
|
|
1349
|
+
const remedy_1 = patternInput_10[0];
|
|
1350
|
+
let patternInput_11;
|
|
1351
|
+
const initial_11 = (0, _Option.defaultArg)(existingEntry.OnsetTiming, "unknown");
|
|
1352
|
+
patternInput_11 = _Interopfs.reactApi.useState(initial_11);
|
|
1353
|
+
const onset_1 = patternInput_11[0];
|
|
1354
|
+
const patternInput_12 = _Interopfs.reactApi.useState(existingEntry.StaffOnly);
|
|
1355
|
+
const staffOnly_1 = patternInput_12[0];
|
|
1356
|
+
let patternInput_13;
|
|
1357
|
+
const initial_13 = (0, _Option.defaultArg)(existingEntry.Notes, "");
|
|
1358
|
+
patternInput_13 = _Interopfs.reactApi.useState(initial_13);
|
|
1359
|
+
const notes_1 = patternInput_13[0];
|
|
1360
|
+
return (0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1361
|
+
[
|
|
1362
|
+
"className",
|
|
1363
|
+
"fixed inset-0 z-50 flex items-center justify-center bg-black/50"
|
|
1364
|
+
],
|
|
1365
|
+
[
|
|
1366
|
+
"onClick",
|
|
1367
|
+
(e_2)=>{
|
|
1368
|
+
if ((0, _Util.equals)(e_2.target, e_2.currentTarget)) {
|
|
1369
|
+
onClose();
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
],
|
|
1373
|
+
(elems_28 = [
|
|
1374
|
+
(0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1375
|
+
[
|
|
1376
|
+
"className",
|
|
1377
|
+
"bg-white rounded-xl shadow-xl max-w-lg w-full max-h-[90vh] overflow-y-auto mx-4 p-5 space-y-4"
|
|
1378
|
+
],
|
|
1379
|
+
[
|
|
1380
|
+
"onClick",
|
|
1381
|
+
(e_3)=>{
|
|
1382
|
+
e_3.stopPropagation();
|
|
1383
|
+
}
|
|
1384
|
+
],
|
|
1385
|
+
(elems_27 = (0, _Seq.toList)((0, _Seq.delay)(()=>{
|
|
1386
|
+
let elems_15;
|
|
1387
|
+
return (0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1388
|
+
[
|
|
1389
|
+
"className",
|
|
1390
|
+
"flex items-center justify-between"
|
|
1391
|
+
],
|
|
1392
|
+
(elems_15 = [
|
|
1393
|
+
(0, _react.createElement)("h3", {
|
|
1394
|
+
className: "text-lg font-semibold text-slate-900",
|
|
1395
|
+
children: "Edit Allergy"
|
|
1396
|
+
}),
|
|
1397
|
+
(0, _react.createElement)("button", {
|
|
1398
|
+
className: "text-slate-400 hover:text-slate-600 text-xl",
|
|
1399
|
+
dangerouslySetInnerHTML: {
|
|
1400
|
+
__html: "×"
|
|
1401
|
+
},
|
|
1402
|
+
onClick: (_arg_6)=>{
|
|
1403
|
+
onClose();
|
|
1404
|
+
}
|
|
1405
|
+
})
|
|
1406
|
+
], [
|
|
1407
|
+
"children",
|
|
1408
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_15))
|
|
1409
|
+
])
|
|
1410
|
+
])))), (0, _Seq.delay)(()=>{
|
|
1411
|
+
let elems_17;
|
|
1412
|
+
return (0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1413
|
+
[
|
|
1414
|
+
"className",
|
|
1415
|
+
"rounded-lg border border-slate-200 bg-slate-50 p-3 space-y-1"
|
|
1416
|
+
],
|
|
1417
|
+
(elems_17 = (0, _Seq.toList)((0, _Seq.delay)(()=>{
|
|
1418
|
+
let elems_16;
|
|
1419
|
+
return (0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1420
|
+
[
|
|
1421
|
+
"className",
|
|
1422
|
+
"flex items-start justify-between gap-2"
|
|
1423
|
+
],
|
|
1424
|
+
(elems_16 = [
|
|
1425
|
+
(0, _react.createElement)("span", {
|
|
1426
|
+
className: "font-semibold text-sm text-slate-900",
|
|
1427
|
+
children: existingEntry.Name
|
|
1428
|
+
}),
|
|
1429
|
+
(0, _react.createElement)(AllergyFinderField_CategoryBadge, {
|
|
1430
|
+
category: existingEntry.Category
|
|
1431
|
+
})
|
|
1432
|
+
], [
|
|
1433
|
+
"children",
|
|
1434
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_16))
|
|
1435
|
+
])
|
|
1436
|
+
])))), (0, _Seq.delay)(()=>(0, _Seq.append)(existingEntry.SubstanceName !== existingEntry.Name ? (0, _Seq.singleton)((0, _react.createElement)("p", {
|
|
1437
|
+
className: "text-xs text-slate-500",
|
|
1438
|
+
children: existingEntry.SubstanceName
|
|
1439
|
+
})) : (0, _Seq.empty)(), (0, _Seq.delay)(()=>{
|
|
1440
|
+
const matchValue_2 = existingEntry.NdcCode;
|
|
1441
|
+
if (matchValue_2 == null) {
|
|
1442
|
+
return (0, _Seq.empty)();
|
|
1443
|
+
} else {
|
|
1444
|
+
return (0, _Seq.singleton)((0, _react.createElement)("p", {
|
|
1445
|
+
className: "text-[11px] text-slate-400",
|
|
1446
|
+
children: `NDC ${(0, _Option.value)(matchValue_2)}`
|
|
1447
|
+
}));
|
|
1448
|
+
}
|
|
1449
|
+
}))));
|
|
1450
|
+
})), [
|
|
1451
|
+
"children",
|
|
1452
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_17))
|
|
1453
|
+
])
|
|
1454
|
+
])))), (0, _Seq.delay)(()=>{
|
|
1455
|
+
let elems_18;
|
|
1456
|
+
return (0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("label", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1457
|
+
[
|
|
1458
|
+
"className",
|
|
1459
|
+
"flex items-center gap-2 text-sm cursor-pointer"
|
|
1460
|
+
],
|
|
1461
|
+
(elems_18 = [
|
|
1462
|
+
(0, _react.createElement)("input", {
|
|
1463
|
+
type: "checkbox",
|
|
1464
|
+
checked: staffOnly_1,
|
|
1465
|
+
onChange: (ev_5)=>{
|
|
1466
|
+
const _arg_7 = ev_5.target.checked;
|
|
1467
|
+
patternInput_12[1](!staffOnly_1);
|
|
1468
|
+
},
|
|
1469
|
+
className: "rounded border-slate-300"
|
|
1470
|
+
}),
|
|
1471
|
+
"Medical Staff Only"
|
|
1472
|
+
], [
|
|
1473
|
+
"children",
|
|
1474
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_18))
|
|
1475
|
+
])
|
|
1476
|
+
])))), (0, _Seq.delay)(()=>{
|
|
1477
|
+
let elems_20, elems_19;
|
|
1478
|
+
return (0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1479
|
+
[
|
|
1480
|
+
"className",
|
|
1481
|
+
"space-y-2"
|
|
1482
|
+
],
|
|
1483
|
+
(elems_20 = [
|
|
1484
|
+
(0, _react.createElement)("label", {
|
|
1485
|
+
className: "text-xs font-semibold uppercase tracking-wide text-slate-700",
|
|
1486
|
+
children: "Severity"
|
|
1487
|
+
}),
|
|
1488
|
+
(0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1489
|
+
[
|
|
1490
|
+
"className",
|
|
1491
|
+
"flex flex-wrap gap-2"
|
|
1492
|
+
],
|
|
1493
|
+
(elems_19 = (0, _Seq.toList)((0, _Seq.delay)(()=>(0, _Seq.collect)((sev_1)=>(0, _Seq.singleton)((0, _react.createElement)("button", {
|
|
1494
|
+
className: (0, _Util.equals)(severity_1, sev_1) ? `rounded-full px-3 py-1 text-xs font-medium border-2 ${AllergyFinderField_severityColor(sev_1)}` : "rounded-full px-3 py-1 text-xs font-medium border border-slate-200 bg-white text-slate-600 hover:bg-slate-50",
|
|
1495
|
+
onClick: (_arg_8)=>{
|
|
1496
|
+
patternInput_8[1](sev_1);
|
|
1497
|
+
},
|
|
1498
|
+
children: AllergyFinderField_severityLabel(sev_1)
|
|
1499
|
+
})), [
|
|
1500
|
+
AllergyFinderField_AllergySeverity_Unknown(),
|
|
1501
|
+
AllergyFinderField_AllergySeverity_Mild(),
|
|
1502
|
+
AllergyFinderField_AllergySeverity_Moderate(),
|
|
1503
|
+
AllergyFinderField_AllergySeverity_Severe(),
|
|
1504
|
+
AllergyFinderField_AllergySeverity_LifeThreatening()
|
|
1505
|
+
]))), [
|
|
1506
|
+
"children",
|
|
1507
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_19))
|
|
1508
|
+
])
|
|
1509
|
+
])))
|
|
1510
|
+
], [
|
|
1511
|
+
"children",
|
|
1512
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_20))
|
|
1513
|
+
])
|
|
1514
|
+
])))), (0, _Seq.delay)(()=>{
|
|
1515
|
+
let substanceForInsights_1;
|
|
1516
|
+
const matchValue_3 = existingEntry.Category;
|
|
1517
|
+
switch(matchValue_3.tag){
|
|
1518
|
+
case /* Drug */ 0:
|
|
1519
|
+
case /* Environmental */ 2:
|
|
1520
|
+
{
|
|
1521
|
+
substanceForInsights_1 = existingEntry.SubstanceName.length > 0 ? existingEntry.SubstanceName : undefined;
|
|
1522
|
+
break;
|
|
1523
|
+
}
|
|
1524
|
+
default:
|
|
1525
|
+
substanceForInsights_1 = undefined;
|
|
1526
|
+
}
|
|
1527
|
+
return (0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)(AllergyFinderField_ReactionCheckboxes, {
|
|
1528
|
+
apiFetch: apiFetch,
|
|
1529
|
+
substanceName: (0, _Option.unwrap)(substanceForInsights_1),
|
|
1530
|
+
selected: reactions_1,
|
|
1531
|
+
onChange: patternInput_9[1]
|
|
1532
|
+
})), (0, _Seq.delay)(()=>{
|
|
1533
|
+
let elems_21, value_222;
|
|
1534
|
+
return (0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1535
|
+
[
|
|
1536
|
+
"className",
|
|
1537
|
+
"space-y-1"
|
|
1538
|
+
],
|
|
1539
|
+
(elems_21 = [
|
|
1540
|
+
(0, _react.createElement)("label", {
|
|
1541
|
+
className: "text-xs font-semibold uppercase tracking-wide text-slate-700",
|
|
1542
|
+
children: "Remedy"
|
|
1543
|
+
}),
|
|
1544
|
+
(0, _react.createElement)("textarea", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1545
|
+
(value_222 = "w-full rounded-md border border-slate-300 px-2.5 py-1.5 text-sm placeholder:text-slate-400 focus:border-sky-500 focus:outline-none focus:ring-2 focus:ring-sky-500/30", [
|
|
1546
|
+
"className",
|
|
1547
|
+
value_222
|
|
1548
|
+
]),
|
|
1549
|
+
[
|
|
1550
|
+
"value",
|
|
1551
|
+
remedy_1
|
|
1552
|
+
],
|
|
1553
|
+
[
|
|
1554
|
+
"onChange",
|
|
1555
|
+
(ev_6)=>{
|
|
1556
|
+
patternInput_10[1](ev_6.target.value);
|
|
1557
|
+
}
|
|
1558
|
+
],
|
|
1559
|
+
[
|
|
1560
|
+
"placeholder",
|
|
1561
|
+
"e.g., Epipen, Benadryl 50mg..."
|
|
1562
|
+
],
|
|
1563
|
+
[
|
|
1564
|
+
"rows",
|
|
1565
|
+
2
|
|
1566
|
+
]
|
|
1567
|
+
])))
|
|
1568
|
+
], [
|
|
1569
|
+
"children",
|
|
1570
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_21))
|
|
1571
|
+
])
|
|
1572
|
+
])))), (0, _Seq.delay)(()=>{
|
|
1573
|
+
let elems_24, elems_23;
|
|
1574
|
+
return (0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1575
|
+
[
|
|
1576
|
+
"className",
|
|
1577
|
+
"space-y-2"
|
|
1578
|
+
],
|
|
1579
|
+
(elems_24 = [
|
|
1580
|
+
(0, _react.createElement)("label", {
|
|
1581
|
+
className: "text-xs font-semibold uppercase tracking-wide text-slate-700",
|
|
1582
|
+
children: "Onset Timing"
|
|
1583
|
+
}),
|
|
1584
|
+
(0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1585
|
+
[
|
|
1586
|
+
"className",
|
|
1587
|
+
"flex flex-wrap gap-3"
|
|
1588
|
+
],
|
|
1589
|
+
(elems_23 = (0, _Seq.toList)((0, _Seq.delay)(()=>(0, _Seq.collect)((matchValue_4)=>{
|
|
1590
|
+
let elems_22;
|
|
1591
|
+
const value_240 = matchValue_4[0];
|
|
1592
|
+
return (0, _Seq.singleton)((0, _react.createElement)("label", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1593
|
+
[
|
|
1594
|
+
"className",
|
|
1595
|
+
"flex items-center gap-1.5 text-sm cursor-pointer"
|
|
1596
|
+
],
|
|
1597
|
+
(elems_22 = [
|
|
1598
|
+
(0, _react.createElement)("input", (0, _Util.createObj)((0, _Seq.toList)((0, _Seq.delay)(()=>(0, _Seq.append)((0, _Seq.singleton)([
|
|
1599
|
+
"type",
|
|
1600
|
+
"radio"
|
|
1601
|
+
]), (0, _Seq.delay)(()=>(0, _Seq.append)((0, _Seq.singleton)([
|
|
1602
|
+
"name",
|
|
1603
|
+
"onset-edit"
|
|
1604
|
+
]), (0, _Seq.delay)(()=>(0, _Seq.append)((0, _Seq.singleton)([
|
|
1605
|
+
"value",
|
|
1606
|
+
value_240
|
|
1607
|
+
]), (0, _Seq.delay)(()=>(0, _Seq.append)((0, _Seq.singleton)([
|
|
1608
|
+
"checked",
|
|
1609
|
+
onset_1 === value_240
|
|
1610
|
+
]), (0, _Seq.delay)(()=>(0, _Seq.singleton)([
|
|
1611
|
+
"onChange",
|
|
1612
|
+
(ev_7)=>{
|
|
1613
|
+
const _arg_9 = ev_7.target.value;
|
|
1614
|
+
patternInput_11[1](value_240);
|
|
1615
|
+
}
|
|
1616
|
+
]))))))))))))),
|
|
1617
|
+
matchValue_4[1]
|
|
1618
|
+
], [
|
|
1619
|
+
"children",
|
|
1620
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_22))
|
|
1621
|
+
])
|
|
1622
|
+
]))));
|
|
1623
|
+
}, [
|
|
1624
|
+
[
|
|
1625
|
+
"immediate",
|
|
1626
|
+
"Immediate (<1hr)"
|
|
1627
|
+
],
|
|
1628
|
+
[
|
|
1629
|
+
"delayed",
|
|
1630
|
+
"Delayed (1-72hr)"
|
|
1631
|
+
],
|
|
1632
|
+
[
|
|
1633
|
+
"unknown",
|
|
1634
|
+
"Unknown"
|
|
1635
|
+
]
|
|
1636
|
+
]))), [
|
|
1637
|
+
"children",
|
|
1638
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_23))
|
|
1639
|
+
])
|
|
1640
|
+
])))
|
|
1641
|
+
], [
|
|
1642
|
+
"children",
|
|
1643
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_24))
|
|
1644
|
+
])
|
|
1645
|
+
])))), (0, _Seq.delay)(()=>{
|
|
1646
|
+
let elems_25, value_261;
|
|
1647
|
+
return (0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1648
|
+
[
|
|
1649
|
+
"className",
|
|
1650
|
+
"space-y-1"
|
|
1651
|
+
],
|
|
1652
|
+
(elems_25 = [
|
|
1653
|
+
(0, _react.createElement)("label", {
|
|
1654
|
+
className: "text-xs font-semibold uppercase tracking-wide text-slate-700",
|
|
1655
|
+
children: "Notes (optional)"
|
|
1656
|
+
}),
|
|
1657
|
+
(0, _react.createElement)("textarea", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1658
|
+
(value_261 = "w-full rounded-md border border-slate-300 px-2.5 py-1.5 text-sm placeholder:text-slate-400 focus:border-sky-500 focus:outline-none focus:ring-2 focus:ring-sky-500/30", [
|
|
1659
|
+
"className",
|
|
1660
|
+
value_261
|
|
1661
|
+
]),
|
|
1662
|
+
[
|
|
1663
|
+
"value",
|
|
1664
|
+
notes_1
|
|
1665
|
+
],
|
|
1666
|
+
[
|
|
1667
|
+
"onChange",
|
|
1668
|
+
(ev_8)=>{
|
|
1669
|
+
patternInput_13[1](ev_8.target.value);
|
|
1670
|
+
}
|
|
1671
|
+
],
|
|
1672
|
+
[
|
|
1673
|
+
"rows",
|
|
1674
|
+
2
|
|
1675
|
+
]
|
|
1676
|
+
])))
|
|
1677
|
+
], [
|
|
1678
|
+
"children",
|
|
1679
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_25))
|
|
1680
|
+
])
|
|
1681
|
+
])))), (0, _Seq.delay)(()=>(0, _Seq.append)(((0, _Util.equals)(existingEntry.Category, (0, _OpenFdaTypes.AllergyCategory_Drug)()) ? true : (0, _Util.equals)(existingEntry.Category, (0, _OpenFdaTypes.AllergyCategory_Environmental)())) && existingEntry.SubstanceName.length > 0 ? (0, _Seq.singleton)((0, _react.createElement)(AllergyFinderField_FdaInsightsPanel, {
|
|
1682
|
+
apiFetch: apiFetch,
|
|
1683
|
+
substanceName: existingEntry.SubstanceName
|
|
1684
|
+
})) : (0, _Seq.empty)(), (0, _Seq.delay)(()=>{
|
|
1685
|
+
let elems_26;
|
|
1686
|
+
return (0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1687
|
+
[
|
|
1688
|
+
"className",
|
|
1689
|
+
"flex justify-end gap-2 pt-2"
|
|
1690
|
+
],
|
|
1691
|
+
(elems_26 = [
|
|
1692
|
+
(0, _react.createElement)("button", {
|
|
1693
|
+
className: "rounded-md border border-slate-200 px-4 py-2 text-sm font-medium text-slate-600 hover:bg-slate-50",
|
|
1694
|
+
children: "Cancel",
|
|
1695
|
+
onClick: (_arg_10)=>{
|
|
1696
|
+
onClose();
|
|
1697
|
+
}
|
|
1698
|
+
}),
|
|
1699
|
+
(0, _react.createElement)("button", {
|
|
1700
|
+
className: "rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700",
|
|
1701
|
+
children: "Update",
|
|
1702
|
+
onClick: (_arg_11)=>{
|
|
1703
|
+
onSave(new AllergyFinderField_AllergyEntry(existingEntry.Id, (0, _String.isNullOrWhiteSpace)(name_69) ? existingEntry.Name : name_69, existingEntry.SubstanceName, existingEntry.NdcCode, existingEntry.Category, severity_1, reactions_1, (0, _String.isNullOrWhiteSpace)(remedy_1) ? undefined : remedy_1, onset_1, staffOnly_1, (0, _String.isNullOrWhiteSpace)(notes_1) ? undefined : notes_1));
|
|
1704
|
+
}
|
|
1705
|
+
})
|
|
1706
|
+
], [
|
|
1707
|
+
"children",
|
|
1708
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_26))
|
|
1709
|
+
])
|
|
1710
|
+
]))));
|
|
1711
|
+
}))));
|
|
1712
|
+
}));
|
|
1713
|
+
}));
|
|
1714
|
+
}));
|
|
1715
|
+
}));
|
|
1716
|
+
}));
|
|
1717
|
+
}));
|
|
1718
|
+
}));
|
|
1719
|
+
})), [
|
|
1720
|
+
"children",
|
|
1721
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_27))
|
|
1722
|
+
])
|
|
1723
|
+
])))
|
|
1724
|
+
], [
|
|
1725
|
+
"children",
|
|
1726
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_28))
|
|
1727
|
+
])
|
|
1728
|
+
])));
|
|
1729
|
+
}
|
|
1730
|
+
default:
|
|
1731
|
+
return (0, _Util.defaultOf)();
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
function AllergyFinderField_AllergySearchPopover(allergyFinderField_AllergySearchPopoverInputProps) {
|
|
1735
|
+
let elems_6, elems_5, elems_2, elems_3, elems_4;
|
|
1736
|
+
const onClose = allergyFinderField_AllergySearchPopoverInputProps.onClose;
|
|
1737
|
+
const onSelect = allergyFinderField_AllergySearchPopoverInputProps.onSelect;
|
|
1738
|
+
const apiFetch = allergyFinderField_AllergySearchPopoverInputProps.apiFetch;
|
|
1739
|
+
const patternInput = _Interopfs.reactApi.useState("");
|
|
1740
|
+
const query = patternInput[0];
|
|
1741
|
+
const patternInput_1 = _Interopfs.reactApi.useState((0, _List.empty)());
|
|
1742
|
+
const setResults = patternInput_1[1];
|
|
1743
|
+
const results = patternInput_1[0];
|
|
1744
|
+
const patternInput_2 = _Interopfs.reactApi.useState(false);
|
|
1745
|
+
const setIsSearching = patternInput_2[1];
|
|
1746
|
+
const isSearching = patternInput_2[0];
|
|
1747
|
+
const searchIdRef = _Interopfs.reactApi.useRef(0);
|
|
1748
|
+
const cleanupRef = _Interopfs.reactApi.useRef(undefined);
|
|
1749
|
+
const dependencies = [
|
|
1750
|
+
query
|
|
1751
|
+
];
|
|
1752
|
+
_Interopfs.reactApi.useEffect(()=>{
|
|
1753
|
+
const matchValue = cleanupRef.current;
|
|
1754
|
+
if (matchValue == null) {} else {
|
|
1755
|
+
(0, _Option.value)(matchValue)();
|
|
1756
|
+
}
|
|
1757
|
+
cleanupRef.current = undefined;
|
|
1758
|
+
if (query.trim().length < 2) {
|
|
1759
|
+
setResults((0, _List.empty)());
|
|
1760
|
+
setIsSearching(false);
|
|
1761
|
+
} else {
|
|
1762
|
+
setIsSearching(true);
|
|
1763
|
+
searchIdRef.current = searchIdRef.current + 1;
|
|
1764
|
+
const thisSearchId = searchIdRef.current | 0;
|
|
1765
|
+
const timerId = setTimeout(()=>{
|
|
1766
|
+
const pr = (0, _Promisefs.PromiseBuilder__Run_212F1D4B)(_PromiseImplfs.promise, (0, _Promisefs.PromiseBuilder__Delay_62FBFDE1)(_PromiseImplfs.promise, ()=>(0, _OpenFdaClient.searchAllergens)(apiFetch, query).then((_arg)=>{
|
|
1767
|
+
if (searchIdRef.current === thisSearchId) {
|
|
1768
|
+
setResults(_arg);
|
|
1769
|
+
setIsSearching(false);
|
|
1770
|
+
return Promise.resolve();
|
|
1771
|
+
} else {
|
|
1772
|
+
return Promise.resolve();
|
|
1773
|
+
}
|
|
1774
|
+
})));
|
|
1775
|
+
void pr;
|
|
1776
|
+
}, 300) | 0;
|
|
1777
|
+
cleanupRef.current = ()=>{
|
|
1778
|
+
clearTimeout(timerId);
|
|
1779
|
+
};
|
|
1780
|
+
}
|
|
1781
|
+
}, dependencies);
|
|
1782
|
+
const drugResults = (0, _List.filter)((r)=>(0, _Util.equals)(r.Category, (0, _OpenFdaTypes.AllergyCategory_Drug)()), results);
|
|
1783
|
+
const foodResults = (0, _List.filter)((r_1)=>(0, _Util.equals)(r_1.Category, (0, _OpenFdaTypes.AllergyCategory_Food)()), results);
|
|
1784
|
+
const envResults = (0, _List.filter)((r_2)=>(0, _Util.equals)(r_2.Category, (0, _OpenFdaTypes.AllergyCategory_Environmental)()), results);
|
|
1785
|
+
const renderGroup = (label, items)=>{
|
|
1786
|
+
let elems_1;
|
|
1787
|
+
if ((0, _List.isEmpty)(items)) {
|
|
1788
|
+
return (0, _Util.defaultOf)();
|
|
1789
|
+
} else {
|
|
1790
|
+
return (0, _react.createElement)("div", (0, _Util.createObj)((0, _List.singleton)((elems_1 = (0, _Seq.toList)((0, _Seq.delay)(()=>(0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("div", {
|
|
1791
|
+
className: "px-3 py-1.5 text-[11px] font-semibold uppercase tracking-wider text-slate-400 bg-slate-50",
|
|
1792
|
+
children: label
|
|
1793
|
+
})), (0, _Seq.delay)(()=>(0, _Seq.map)((r_4)=>{
|
|
1794
|
+
let elems;
|
|
1795
|
+
const r_3 = r_4;
|
|
1796
|
+
const meta = (0, _String.join)(" · ", (0, _List.choose)((x)=>x, (0, _List.ofArray)([
|
|
1797
|
+
r_3.DosageForm,
|
|
1798
|
+
r_3.Route,
|
|
1799
|
+
r_3.Strength
|
|
1800
|
+
])));
|
|
1801
|
+
const provenance = (0, _String.join)(" · ", (0, _List.choose)((x_1)=>x_1, (0, _List.ofArray)([
|
|
1802
|
+
r_3.Manufacturer,
|
|
1803
|
+
(0, _Option.map)((n)=>`NDC ${n}`, r_3.NdcCode),
|
|
1804
|
+
(0, _Option.map)((c)=>`${c} reports`, r_3.ReportCount)
|
|
1805
|
+
])));
|
|
1806
|
+
return (0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1807
|
+
[
|
|
1808
|
+
"className",
|
|
1809
|
+
"px-3 py-2 cursor-pointer hover:bg-blue-50 border-b border-slate-100 last:border-0"
|
|
1810
|
+
],
|
|
1811
|
+
[
|
|
1812
|
+
"onClick",
|
|
1813
|
+
(_arg_1)=>{
|
|
1814
|
+
onSelect(r_3);
|
|
1815
|
+
}
|
|
1816
|
+
],
|
|
1817
|
+
(elems = (0, _Seq.toList)((0, _Seq.delay)(()=>(0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("div", {
|
|
1818
|
+
className: "text-sm font-medium text-slate-900",
|
|
1819
|
+
children: r_3.Name
|
|
1820
|
+
})), (0, _Seq.delay)(()=>(0, _Seq.append)(r_3.SubstanceName !== r_3.Name ? (0, _Seq.singleton)((0, _react.createElement)("div", {
|
|
1821
|
+
className: "text-xs text-slate-500",
|
|
1822
|
+
children: r_3.SubstanceName
|
|
1823
|
+
})) : (0, _Seq.empty)(), (0, _Seq.delay)(()=>(0, _Seq.append)(meta.length > 0 ? (0, _Seq.singleton)((0, _react.createElement)("div", {
|
|
1824
|
+
className: "text-[11px] text-slate-400",
|
|
1825
|
+
children: meta
|
|
1826
|
+
})) : (0, _Seq.empty)(), (0, _Seq.delay)(()=>provenance.length > 0 ? (0, _Seq.singleton)((0, _react.createElement)("div", {
|
|
1827
|
+
className: "text-[11px] text-slate-400",
|
|
1828
|
+
children: provenance
|
|
1829
|
+
})) : (0, _Seq.empty)())))))))), [
|
|
1830
|
+
"children",
|
|
1831
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems))
|
|
1832
|
+
])
|
|
1833
|
+
])));
|
|
1834
|
+
}, items))))), [
|
|
1835
|
+
"children",
|
|
1836
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_1))
|
|
1837
|
+
]))));
|
|
1838
|
+
}
|
|
1839
|
+
};
|
|
1840
|
+
return (0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1841
|
+
[
|
|
1842
|
+
"className",
|
|
1843
|
+
"fixed inset-0 z-50 flex items-start justify-center pt-[15vh] bg-black/50"
|
|
1844
|
+
],
|
|
1845
|
+
[
|
|
1846
|
+
"onClick",
|
|
1847
|
+
(e)=>{
|
|
1848
|
+
if ((0, _Util.equals)(e.target, e.currentTarget)) {
|
|
1849
|
+
onClose();
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
],
|
|
1853
|
+
(elems_6 = [
|
|
1854
|
+
(0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1855
|
+
[
|
|
1856
|
+
"className",
|
|
1857
|
+
"bg-white rounded-xl shadow-xl max-w-md w-full mx-4 overflow-hidden"
|
|
1858
|
+
],
|
|
1859
|
+
[
|
|
1860
|
+
"onClick",
|
|
1861
|
+
(e_1)=>{
|
|
1862
|
+
e_1.stopPropagation();
|
|
1863
|
+
}
|
|
1864
|
+
],
|
|
1865
|
+
(elems_5 = [
|
|
1866
|
+
(0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1867
|
+
[
|
|
1868
|
+
"className",
|
|
1869
|
+
"flex items-center gap-2 border-b border-slate-200 px-3 py-2"
|
|
1870
|
+
],
|
|
1871
|
+
(elems_2 = (0, _Seq.toList)((0, _Seq.delay)(()=>(0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("span", {
|
|
1872
|
+
className: "text-slate-400 text-sm",
|
|
1873
|
+
children: "Search"
|
|
1874
|
+
})), (0, _Seq.delay)(()=>(0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("input", {
|
|
1875
|
+
className: "flex-1 border-0 bg-transparent text-sm focus:outline-none placeholder:text-slate-400",
|
|
1876
|
+
value: query,
|
|
1877
|
+
onChange: (ev)=>{
|
|
1878
|
+
patternInput[1](ev.target.value);
|
|
1879
|
+
},
|
|
1880
|
+
placeholder: "Search allergies...",
|
|
1881
|
+
autoFocus: true
|
|
1882
|
+
})), (0, _Seq.delay)(()=>isSearching ? (0, _Seq.singleton)((0, _react.createElement)("span", {
|
|
1883
|
+
className: "text-xs text-slate-400 animate-pulse",
|
|
1884
|
+
children: "..."
|
|
1885
|
+
})) : (0, _Seq.empty)())))))), [
|
|
1886
|
+
"children",
|
|
1887
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_2))
|
|
1888
|
+
])
|
|
1889
|
+
]))),
|
|
1890
|
+
(0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1891
|
+
[
|
|
1892
|
+
"className",
|
|
1893
|
+
"max-h-[50vh] overflow-y-auto"
|
|
1894
|
+
],
|
|
1895
|
+
(elems_3 = (0, _Seq.toList)((0, _Seq.delay)(()=>query.trim().length >= 2 && !isSearching && (0, _List.isEmpty)(results) ? (0, _Seq.singleton)((0, _react.createElement)("div", {
|
|
1896
|
+
className: "px-3 py-4 text-sm text-slate-500 text-center",
|
|
1897
|
+
children: `No allergies found for "${query}"`
|
|
1898
|
+
})) : (0, _Seq.append)((0, _Seq.singleton)(renderGroup("Drugs", drugResults)), (0, _Seq.delay)(()=>(0, _Seq.append)((0, _Seq.singleton)(renderGroup("Environmental", envResults)), (0, _Seq.delay)(()=>(0, _Seq.singleton)(renderGroup("Foods", foodResults)))))))), [
|
|
1899
|
+
"children",
|
|
1900
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_3))
|
|
1901
|
+
])
|
|
1902
|
+
]))),
|
|
1903
|
+
(0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1904
|
+
[
|
|
1905
|
+
"className",
|
|
1906
|
+
"border-t border-slate-200 px-3 py-2"
|
|
1907
|
+
],
|
|
1908
|
+
(elems_4 = [
|
|
1909
|
+
(0, _react.createElement)("button", {
|
|
1910
|
+
className: "w-full text-left text-sm text-blue-600 hover:text-blue-700 font-medium",
|
|
1911
|
+
children: "+ Add custom allergen",
|
|
1912
|
+
onClick: (_arg_2)=>{
|
|
1913
|
+
onSelect(undefined);
|
|
1914
|
+
}
|
|
1915
|
+
})
|
|
1916
|
+
], [
|
|
1917
|
+
"children",
|
|
1918
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_4))
|
|
1919
|
+
])
|
|
1920
|
+
])))
|
|
1921
|
+
], [
|
|
1922
|
+
"children",
|
|
1923
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_5))
|
|
1924
|
+
])
|
|
1925
|
+
])))
|
|
1926
|
+
], [
|
|
1927
|
+
"children",
|
|
1928
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_6))
|
|
1929
|
+
])
|
|
1930
|
+
])));
|
|
1931
|
+
}
|
|
1932
|
+
function AllergyFinderField_AllergyCard(allergyFinderField_AllergyCardInputProps) {
|
|
1933
|
+
let elems_3;
|
|
1934
|
+
const onRemove = allergyFinderField_AllergyCardInputProps.onRemove;
|
|
1935
|
+
const onEdit = allergyFinderField_AllergyCardInputProps.onEdit;
|
|
1936
|
+
const readOnly = allergyFinderField_AllergyCardInputProps.readOnly;
|
|
1937
|
+
const entry = allergyFinderField_AllergyCardInputProps.entry;
|
|
1938
|
+
let reactionsPreview;
|
|
1939
|
+
if ((0, _List.isEmpty)(entry.Reactions)) {
|
|
1940
|
+
reactionsPreview = "";
|
|
1941
|
+
} else {
|
|
1942
|
+
const shown = (0, _String.join)(", ", (0, _List.truncate)(3, entry.Reactions));
|
|
1943
|
+
const overflow = (0, _List.length)(entry.Reactions) - 3 | 0;
|
|
1944
|
+
reactionsPreview = overflow > 0 ? `${shown} and ${overflow} more` : shown;
|
|
1945
|
+
}
|
|
1946
|
+
return (0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1947
|
+
[
|
|
1948
|
+
"className",
|
|
1949
|
+
`rounded-lg border border-slate-200 bg-white p-3 shadow-sm border-l-4 ${AllergyFinderField_severityBorderColor(entry.Severity)}`
|
|
1950
|
+
],
|
|
1951
|
+
(elems_3 = (0, _Seq.toList)((0, _Seq.delay)(()=>{
|
|
1952
|
+
let elems_1, elems;
|
|
1953
|
+
return (0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1954
|
+
[
|
|
1955
|
+
"className",
|
|
1956
|
+
"flex items-start justify-between gap-2 mb-1"
|
|
1957
|
+
],
|
|
1958
|
+
(elems_1 = [
|
|
1959
|
+
(0, _react.createElement)("span", {
|
|
1960
|
+
className: "font-semibold text-sm text-slate-900",
|
|
1961
|
+
children: entry.Name
|
|
1962
|
+
}),
|
|
1963
|
+
(0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1964
|
+
[
|
|
1965
|
+
"className",
|
|
1966
|
+
"flex gap-1.5 shrink-0"
|
|
1967
|
+
],
|
|
1968
|
+
(elems = [
|
|
1969
|
+
(0, _react.createElement)(AllergyFinderField_SeverityBadge, {
|
|
1970
|
+
severity: entry.Severity
|
|
1971
|
+
}),
|
|
1972
|
+
(0, _react.createElement)(AllergyFinderField_CategoryBadge, {
|
|
1973
|
+
category: entry.Category
|
|
1974
|
+
})
|
|
1975
|
+
], [
|
|
1976
|
+
"children",
|
|
1977
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems))
|
|
1978
|
+
])
|
|
1979
|
+
])))
|
|
1980
|
+
], [
|
|
1981
|
+
"children",
|
|
1982
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_1))
|
|
1983
|
+
])
|
|
1984
|
+
])))), (0, _Seq.delay)(()=>(0, _Seq.append)(entry.SubstanceName !== entry.Name ? (0, _Seq.singleton)((0, _react.createElement)("p", {
|
|
1985
|
+
className: "text-xs text-slate-500 mb-1",
|
|
1986
|
+
children: entry.SubstanceName
|
|
1987
|
+
})) : (0, _Seq.empty)(), (0, _Seq.delay)(()=>(0, _Seq.append)(reactionsPreview.length > 0 ? (0, _Seq.singleton)((0, _react.createElement)("p", {
|
|
1988
|
+
className: "text-xs text-slate-600",
|
|
1989
|
+
children: `Reactions: ${reactionsPreview}`
|
|
1990
|
+
})) : (0, _Seq.empty)(), (0, _Seq.delay)(()=>{
|
|
1991
|
+
let matchValue;
|
|
1992
|
+
return (0, _Seq.append)((matchValue = entry.Remedy, matchValue == null ? (0, _Seq.empty)() : (0, _Seq.singleton)((0, _react.createElement)("p", {
|
|
1993
|
+
className: "text-xs text-slate-600",
|
|
1994
|
+
children: `Remedy: ${(0, _Option.value)(matchValue)}`
|
|
1995
|
+
}))), (0, _Seq.delay)(()=>{
|
|
1996
|
+
let value_24;
|
|
1997
|
+
return (0, _Seq.append)(entry.StaffOnly ? (0, _Seq.singleton)((0, _react.createElement)("span", (0, _Util.createObj)((0, _List.ofArray)([
|
|
1998
|
+
(value_24 = "inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium bg-purple-50 text-purple-700 border border-purple-200 mt-1", [
|
|
1999
|
+
"className",
|
|
2000
|
+
value_24
|
|
2001
|
+
]),
|
|
2002
|
+
[
|
|
2003
|
+
"children",
|
|
2004
|
+
"Staff Only"
|
|
2005
|
+
]
|
|
2006
|
+
])))) : (0, _Seq.empty)(), (0, _Seq.delay)(()=>{
|
|
2007
|
+
let elems_2;
|
|
2008
|
+
return !readOnly ? (0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
2009
|
+
[
|
|
2010
|
+
"className",
|
|
2011
|
+
"flex justify-end gap-2 mt-2 pt-2 border-t border-slate-100"
|
|
2012
|
+
],
|
|
2013
|
+
(elems_2 = [
|
|
2014
|
+
(0, _react.createElement)("button", {
|
|
2015
|
+
className: "text-xs font-medium text-blue-600 hover:text-blue-700",
|
|
2016
|
+
children: "Edit",
|
|
2017
|
+
onClick: (_arg)=>{
|
|
2018
|
+
onEdit();
|
|
2019
|
+
}
|
|
2020
|
+
}),
|
|
2021
|
+
(0, _react.createElement)("button", {
|
|
2022
|
+
className: "text-xs font-medium text-red-500 hover:text-red-600",
|
|
2023
|
+
children: "Remove",
|
|
2024
|
+
onClick: (_arg_1)=>{
|
|
2025
|
+
onRemove();
|
|
2026
|
+
}
|
|
2027
|
+
})
|
|
2028
|
+
], [
|
|
2029
|
+
"children",
|
|
2030
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_2))
|
|
2031
|
+
])
|
|
2032
|
+
])))) : (0, _Seq.empty)();
|
|
2033
|
+
}));
|
|
2034
|
+
}));
|
|
2035
|
+
}))))));
|
|
2036
|
+
})), [
|
|
2037
|
+
"children",
|
|
2038
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_3))
|
|
2039
|
+
])
|
|
2040
|
+
])));
|
|
2041
|
+
}
|
|
2042
|
+
function AllergyFinderField_AllergyFinderFieldComponent(config) {
|
|
2043
|
+
let elems_1;
|
|
2044
|
+
const patternInput = _Interopfs.reactApi.useState(()=>AllergyFinderField_parseAllergies(config.Value));
|
|
2045
|
+
const allergies = patternInput[0];
|
|
2046
|
+
const patternInput_1 = _Interopfs.reactApi.useState(false);
|
|
2047
|
+
const setShowSearch = patternInput_1[1];
|
|
2048
|
+
const patternInput_2 = _Interopfs.reactApi.useState(AllergyFinderField_DetailModalState_Closed());
|
|
2049
|
+
const setDetailModal = patternInput_2[1];
|
|
2050
|
+
const detailModal = patternInput_2[0];
|
|
2051
|
+
const updateAndNotify = (newAllergies)=>{
|
|
2052
|
+
patternInput[1](newAllergies);
|
|
2053
|
+
config.OnChange(AllergyFinderField_serializeAllergies(newAllergies));
|
|
2054
|
+
};
|
|
2055
|
+
const readOnly = config.Disabled ? true : config.IsReadOnly;
|
|
2056
|
+
return (0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
2057
|
+
[
|
|
2058
|
+
"className",
|
|
2059
|
+
"space-y-2"
|
|
2060
|
+
],
|
|
2061
|
+
(elems_1 = (0, _Seq.toList)((0, _Seq.delay)(()=>(0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)("label", {
|
|
2062
|
+
className: "text-xs font-semibold uppercase tracking-wide text-slate-700",
|
|
2063
|
+
children: config.Attributes.Label
|
|
2064
|
+
})), (0, _Seq.delay)(()=>{
|
|
2065
|
+
let elems;
|
|
2066
|
+
return (0, _Seq.append)((0, _List.isEmpty)(allergies) ? (0, _Seq.singleton)((0, _react.createElement)("div", {
|
|
2067
|
+
className: "rounded-lg border border-dashed border-slate-300 bg-slate-50 p-4 text-center text-sm text-slate-500",
|
|
2068
|
+
children: "No allergies added"
|
|
2069
|
+
})) : (0, _Seq.singleton)((0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
2070
|
+
[
|
|
2071
|
+
"className",
|
|
2072
|
+
"space-y-2"
|
|
2073
|
+
],
|
|
2074
|
+
(elems = (0, _Seq.toList)((0, _Seq.delay)(()=>(0, _Seq.map)((entry_1)=>(0, _react.createElement)(AllergyFinderField_AllergyCard, {
|
|
2075
|
+
entry: entry_1,
|
|
2076
|
+
readOnly: readOnly,
|
|
2077
|
+
onEdit: ()=>{
|
|
2078
|
+
setDetailModal(AllergyFinderField_DetailModalState_Editing(entry_1));
|
|
2079
|
+
},
|
|
2080
|
+
onRemove: ()=>{
|
|
2081
|
+
updateAndNotify((0, _List.filter)((a_2)=>a_2.Id !== entry_1.Id, allergies));
|
|
2082
|
+
}
|
|
2083
|
+
}), allergies))), [
|
|
2084
|
+
"children",
|
|
2085
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems))
|
|
2086
|
+
])
|
|
2087
|
+
])))), (0, _Seq.delay)(()=>{
|
|
2088
|
+
let value_13;
|
|
2089
|
+
return (0, _Seq.append)(!readOnly ? (0, _Seq.singleton)((0, _react.createElement)("button", (0, _Util.createObj)((0, _List.ofArray)([
|
|
2090
|
+
(value_13 = "inline-flex items-center gap-1.5 rounded-md bg-blue-50 px-3 py-1.5 text-sm font-medium text-blue-600 hover:bg-blue-100 border border-blue-200", [
|
|
2091
|
+
"className",
|
|
2092
|
+
value_13
|
|
2093
|
+
]),
|
|
2094
|
+
[
|
|
2095
|
+
"children",
|
|
2096
|
+
"+ Add Allergy"
|
|
2097
|
+
],
|
|
2098
|
+
[
|
|
2099
|
+
"onClick",
|
|
2100
|
+
(_arg)=>{
|
|
2101
|
+
setShowSearch(true);
|
|
2102
|
+
}
|
|
2103
|
+
]
|
|
2104
|
+
])))) : (0, _Seq.empty)(), (0, _Seq.delay)(()=>(0, _Seq.append)(patternInput_1[0] ? (0, _Seq.singleton)((0, _react.createElement)(AllergyFinderField_AllergySearchPopover, {
|
|
2105
|
+
apiFetch: config.Attributes.ApiFetch,
|
|
2106
|
+
onSelect: (fdaResult)=>{
|
|
2107
|
+
setShowSearch(false);
|
|
2108
|
+
setDetailModal(AllergyFinderField_DetailModalState_Adding(fdaResult));
|
|
2109
|
+
},
|
|
2110
|
+
onClose: ()=>{
|
|
2111
|
+
setShowSearch(false);
|
|
2112
|
+
}
|
|
2113
|
+
})) : (0, _Seq.empty)(), (0, _Seq.delay)(()=>(0, _Seq.append)((0, _Seq.singleton)((0, _react.createElement)(AllergyFinderField_AllergyDetailModal, {
|
|
2114
|
+
apiFetch: config.Attributes.ApiFetch,
|
|
2115
|
+
modalState: detailModal,
|
|
2116
|
+
onClose: ()=>{
|
|
2117
|
+
setDetailModal(AllergyFinderField_DetailModalState_Closed());
|
|
2118
|
+
},
|
|
2119
|
+
onSave: (entry)=>{
|
|
2120
|
+
switch(detailModal.tag){
|
|
2121
|
+
case /* Adding */ 1:
|
|
2122
|
+
{
|
|
2123
|
+
if (!(0, _List.exists)((a_1)=>(0, _String.compare)(a_1.SubstanceName, entry.SubstanceName, 5) === 0, allergies)) {
|
|
2124
|
+
updateAndNotify((0, _List.append)(allergies, (0, _List.singleton)(entry)));
|
|
2125
|
+
}
|
|
2126
|
+
break;
|
|
2127
|
+
}
|
|
2128
|
+
case /* Closed */ 0:
|
|
2129
|
+
{
|
|
2130
|
+
break;
|
|
2131
|
+
}
|
|
2132
|
+
default:
|
|
2133
|
+
{
|
|
2134
|
+
const existing = detailModal.fields[0];
|
|
2135
|
+
updateAndNotify((0, _List.map)((a)=>{
|
|
2136
|
+
if (a.Id === existing.Id) {
|
|
2137
|
+
return entry;
|
|
2138
|
+
} else {
|
|
2139
|
+
return a;
|
|
2140
|
+
}
|
|
2141
|
+
}, allergies));
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
setDetailModal(AllergyFinderField_DetailModalState_Closed());
|
|
2145
|
+
}
|
|
2146
|
+
})), (0, _Seq.delay)(()=>config.ShowError && config.Error != null ? (0, _Seq.singleton)((0, _react.createElement)("p", {
|
|
2147
|
+
className: "text-xs text-red-600 mt-1",
|
|
2148
|
+
children: (0, _Types.toString)((0, _Option.value)(config.Error))
|
|
2149
|
+
})) : (0, _Seq.empty)()))))));
|
|
2150
|
+
}));
|
|
2151
|
+
})))), [
|
|
2152
|
+
"children",
|
|
2153
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_1))
|
|
2154
|
+
])
|
|
2155
|
+
])));
|
|
2156
|
+
}
|
|
2157
|
+
class AllergyFinderField_Field$1 extends _Typesfs.IStandardField$3 {
|
|
2158
|
+
"Fable.Form.Simple.Bulma.IStandardField`3.RenderFieldZ43FEF6DC"(config) {
|
|
2159
|
+
return (0, _react.createElement)(AllergyFinderField_AllergyFinderFieldComponent, config);
|
|
2160
|
+
}
|
|
2161
|
+
MapFieldValues(update) {
|
|
2162
|
+
const _ = this;
|
|
2163
|
+
return AllergyFinderField_Field$1_$ctor_2F8EC839((0, _Fieldfs.mapValues)(update, _.innerField_1));
|
|
2164
|
+
}
|
|
2165
|
+
constructor(innerField){
|
|
2166
|
+
super(innerField);
|
|
2167
|
+
this.innerField_1 = innerField;
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
function AllergyFinderField_Field$1_$reflection(gen0) {
|
|
2171
|
+
return (0, _Reflection.class_type)("Fable.Form.Simple.Bulma.Fields.AllergyFinderField.AllergyFinderField.Field`1", [
|
|
2172
|
+
gen0
|
|
2173
|
+
], AllergyFinderField_Field$1, (0, _Typesfs.IStandardField$3_$reflection)(gen0, _Reflection.string_type, AllergyFinderField_Attributes_$reflection()));
|
|
2174
|
+
}
|
|
2175
|
+
function AllergyFinderField_Field$1_$ctor_2F8EC839(innerField) {
|
|
2176
|
+
return new AllergyFinderField_Field$1(innerField);
|
|
2177
|
+
}
|
|
2178
|
+
function Form_allergyFinderField(config) {
|
|
2179
|
+
return AllergyFinderField_form()(AllergyFinderField_Field$1_$ctor_2F8EC839)(config);
|
|
2180
|
+
}
|
|
2181
|
+
const Form_pluginConfig = new _FormSpec.Spec_PluginFieldConfig("Fable.Form.Simple.Bulma.Fields.AllergyFinderField", undefined, undefined);
|
|
2182
|
+
const Form_PropertyKeys_AllergyCount = new _FormSpec.Shared_PluginPropertyKey("af100001-af10-af10-af10-af10af10af10");
|
|
2183
|
+
const Form_PropertyKeys_HasSevereAllergy = new _FormSpec.Shared_PluginPropertyKey("af100002-af10-af10-af10-af10af10af10");
|
|
2184
|
+
const Form_PropertyKeys_AllergiesJson = new _FormSpec.Shared_PluginPropertyKey("af100003-af10-af10-af10-af10af10af10");
|
|
2185
|
+
const Form_enhancedAllergyConverter = new _PluginInterface.IPluginValueConverter((fieldKey, pluginValue)=>{
|
|
2186
|
+
const json = (0, _Types.toString)(pluginValue);
|
|
2187
|
+
const allergies = AllergyFinderField_parseAllergies(json);
|
|
2188
|
+
return (0, _FormSpec.Shared_FieldValue_PluginData)((0, _List.ofArray)([
|
|
2189
|
+
new _FormSpec.Shared_PluginDataProperty(Form_PropertyKeys_AllergyCount, "allergy_count", "int", (0, _Util.int32ToString)((0, _List.length)(allergies)), "Allergy Count", undefined, "Number of recorded allergies"),
|
|
2190
|
+
new _FormSpec.Shared_PluginDataProperty(Form_PropertyKeys_HasSevereAllergy, "has_severe_allergy", "bool", (0, _Types.toString)((0, _List.exists)((a)=>{
|
|
2191
|
+
if ((0, _Util.equals)(a.Severity, AllergyFinderField_AllergySeverity_Severe())) {
|
|
2192
|
+
return true;
|
|
2193
|
+
} else {
|
|
2194
|
+
return (0, _Util.equals)(a.Severity, AllergyFinderField_AllergySeverity_LifeThreatening());
|
|
2195
|
+
}
|
|
2196
|
+
}, allergies)), "Has Severe Allergy", undefined, "Whether patient has any severe or life-threatening allergies"),
|
|
2197
|
+
new _FormSpec.Shared_PluginDataProperty(Form_PropertyKeys_AllergiesJson, "allergies_json", "json", json, "Allergies Data", undefined, "Full allergy data as JSON")
|
|
2198
|
+
]));
|
|
2199
|
+
}, (fieldValue)=>fieldValue.tag === /* PluginData */ 3 ? (0, _Option.orElseWith)((0, _Option.map)((p_1)=>p_1.Value, (0, _List.tryFind)((p)=>p.Name === "allergies_json", fieldValue.fields[0])), ()=>(0, _Option.some)("[]")) : fieldValue.tag === /* Single */ 0 ? (0, _Option.some)(fieldValue.fields[0].Value) : (0, _Option.some)("[]"), ()=>undefined, ()=>(0, _List.ofArray)([
|
|
2200
|
+
"allergy_count",
|
|
2201
|
+
"has_severe_allergy",
|
|
2202
|
+
"allergies_json"
|
|
2203
|
+
]), (propertyName)=>propertyName === "allergy_count" ? new _FormSpec.Shared_PluginDataProperty(Form_PropertyKeys_AllergyCount, "allergy_count", "int", "0", "Allergy Count", undefined, "Number of recorded allergies") : propertyName === "has_severe_allergy" ? new _FormSpec.Shared_PluginDataProperty(Form_PropertyKeys_HasSevereAllergy, "has_severe_allergy", "bool", "false", "Has Severe Allergy", undefined, "Whether patient has any severe or life-threatening allergies") : propertyName === "allergies_json" ? new _FormSpec.Shared_PluginDataProperty(Form_PropertyKeys_AllergiesJson, "allergies_json", "json", "[]", "Allergies Data", undefined, "Full allergy data as JSON") : undefined, (propertyKey)=>(0, _Util.equals)(propertyKey, Form_PropertyKeys_AllergyCount) ? new _FormSpec.Shared_PluginDataProperty(Form_PropertyKeys_AllergyCount, "allergy_count", "int", "0", "Allergy Count", undefined, "Number of recorded allergies") : (0, _Util.equals)(propertyKey, Form_PropertyKeys_HasSevereAllergy) ? new _FormSpec.Shared_PluginDataProperty(Form_PropertyKeys_HasSevereAllergy, "has_severe_allergy", "bool", "false", "Has Severe Allergy", undefined, "Whether patient has any severe or life-threatening allergies") : (0, _Util.equals)(propertyKey, Form_PropertyKeys_AllergiesJson) ? new _FormSpec.Shared_PluginDataProperty(Form_PropertyKeys_AllergiesJson, "allergies_json", "json", "[]", "Allergies Data", undefined, "Full allergy data as JSON") : undefined, (propertyName_1, fieldValue_1)=>{
|
|
2204
|
+
switch(fieldValue_1.tag){
|
|
2205
|
+
case /* PluginData */ 3:
|
|
2206
|
+
return (0, _List.tryFind)((p_2)=>p_2.Name === propertyName_1, fieldValue_1.fields[0]);
|
|
2207
|
+
case /* Single */ 0:
|
|
2208
|
+
{
|
|
2209
|
+
const answer_1 = fieldValue_1.fields[0];
|
|
2210
|
+
const allergies_1 = AllergyFinderField_parseAllergies(answer_1.Value);
|
|
2211
|
+
return propertyName_1 === "allergy_count" ? new _FormSpec.Shared_PluginDataProperty(Form_PropertyKeys_AllergyCount, "allergy_count", "int", (0, _Util.int32ToString)((0, _List.length)(allergies_1)), "Allergy Count", undefined, "Number of recorded allergies") : propertyName_1 === "has_severe_allergy" ? new _FormSpec.Shared_PluginDataProperty(Form_PropertyKeys_HasSevereAllergy, "has_severe_allergy", "bool", (0, _Types.toString)((0, _List.exists)((a_1)=>{
|
|
2212
|
+
if ((0, _Util.equals)(a_1.Severity, AllergyFinderField_AllergySeverity_Severe())) {
|
|
2213
|
+
return true;
|
|
2214
|
+
} else {
|
|
2215
|
+
return (0, _Util.equals)(a_1.Severity, AllergyFinderField_AllergySeverity_LifeThreatening());
|
|
2216
|
+
}
|
|
2217
|
+
}, allergies_1)), "Has Severe Allergy", undefined, "Whether patient has any severe or life-threatening allergies") : propertyName_1 === "allergies_json" ? new _FormSpec.Shared_PluginDataProperty(Form_PropertyKeys_AllergiesJson, "allergies_json", "json", answer_1.Value, "Allergies Data", undefined, "Full allergy data as JSON") : undefined;
|
|
2218
|
+
}
|
|
2219
|
+
default:
|
|
2220
|
+
return undefined;
|
|
2221
|
+
}
|
|
2222
|
+
}, (propertyKey_1, fieldValue_2)=>fieldValue_2.tag === /* PluginData */ 3 ? (0, _List.tryFind)((p_3)=>(0, _Util.equals)(p_3.PropertyKey, propertyKey_1), fieldValue_2.fields[0]) : undefined, (propertyName_2, value)=>{
|
|
2223
|
+
switch(propertyName_2){
|
|
2224
|
+
case "allergy_count":
|
|
2225
|
+
{
|
|
2226
|
+
let matchValue;
|
|
2227
|
+
let outArg = 0;
|
|
2228
|
+
matchValue = [
|
|
2229
|
+
(0, _Int32.tryParse)(value, 511, false, 32, new _Types.FSharpRef(()=>outArg, (v)=>{
|
|
2230
|
+
outArg = v | 0;
|
|
2231
|
+
})),
|
|
2232
|
+
outArg
|
|
2233
|
+
];
|
|
2234
|
+
let matchResult;
|
|
2235
|
+
if (matchValue[0]) {
|
|
2236
|
+
if (matchValue[1] >= 0) {
|
|
2237
|
+
matchResult = 0;
|
|
2238
|
+
} else {
|
|
2239
|
+
matchResult = 1;
|
|
2240
|
+
}
|
|
2241
|
+
} else {
|
|
2242
|
+
matchResult = 1;
|
|
2243
|
+
}
|
|
2244
|
+
switch(matchResult){
|
|
2245
|
+
case 0:
|
|
2246
|
+
return (0, _Result.FSharpResult$2_Ok)(undefined);
|
|
2247
|
+
default:
|
|
2248
|
+
return (0, _Result.FSharpResult$2_Error)("Allergy count must be a non-negative integer");
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
case "has_severe_allergy":
|
|
2252
|
+
{
|
|
2253
|
+
const matchValue_1 = value.toLowerCase();
|
|
2254
|
+
switch(matchValue_1){
|
|
2255
|
+
case "true":
|
|
2256
|
+
case "false":
|
|
2257
|
+
return (0, _Result.FSharpResult$2_Ok)(undefined);
|
|
2258
|
+
default:
|
|
2259
|
+
return (0, _Result.FSharpResult$2_Error)("Must be true or false");
|
|
2260
|
+
}
|
|
2261
|
+
}
|
|
2262
|
+
case "allergies_json":
|
|
2263
|
+
return (0, _Result.FSharpResult$2_Ok)(undefined);
|
|
2264
|
+
default:
|
|
2265
|
+
return (0, _Result.FSharpResult$2_Error)(`Unknown property: ${propertyName_2}`);
|
|
2266
|
+
}
|
|
2267
|
+
}, (fieldValue_3)=>{
|
|
2268
|
+
switch(fieldValue_3.tag){
|
|
2269
|
+
case /* PluginData */ 3:
|
|
2270
|
+
return fieldValue_3.fields[0];
|
|
2271
|
+
case /* Single */ 0:
|
|
2272
|
+
{
|
|
2273
|
+
const answer_2 = fieldValue_3.fields[0];
|
|
2274
|
+
const allergies_2 = AllergyFinderField_parseAllergies(answer_2.Value);
|
|
2275
|
+
const hasSevere_2 = (0, _List.exists)((a_2)=>{
|
|
2276
|
+
if ((0, _Util.equals)(a_2.Severity, AllergyFinderField_AllergySeverity_Severe())) {
|
|
2277
|
+
return true;
|
|
2278
|
+
} else {
|
|
2279
|
+
return (0, _Util.equals)(a_2.Severity, AllergyFinderField_AllergySeverity_LifeThreatening());
|
|
2280
|
+
}
|
|
2281
|
+
}, allergies_2);
|
|
2282
|
+
return (0, _List.ofArray)([
|
|
2283
|
+
new _FormSpec.Shared_PluginDataProperty(Form_PropertyKeys_AllergyCount, "allergy_count", "int", (0, _Util.int32ToString)((0, _List.length)(allergies_2)), "Allergy Count", undefined, "Number of recorded allergies"),
|
|
2284
|
+
new _FormSpec.Shared_PluginDataProperty(Form_PropertyKeys_HasSevereAllergy, "has_severe_allergy", "bool", (0, _Types.toString)(hasSevere_2), "Has Severe Allergy", undefined, "Whether patient has any severe or life-threatening allergies"),
|
|
2285
|
+
new _FormSpec.Shared_PluginDataProperty(Form_PropertyKeys_AllergiesJson, "allergies_json", "json", answer_2.Value, "Allergies Data", undefined, "Full allergy data as JSON")
|
|
2286
|
+
]);
|
|
2287
|
+
}
|
|
2288
|
+
default:
|
|
2289
|
+
return (0, _List.empty)();
|
|
2290
|
+
}
|
|
2291
|
+
});
|
|
2292
|
+
function Form_designerPreview(props) {
|
|
2293
|
+
let elems_3, elems_2, elems, elems_1;
|
|
2294
|
+
const children = [
|
|
2295
|
+
(0, _react.createElement)("div", (0, _Util.createObj)((0, _ElementBuildersfs.Helpers_combineClasses)("box", (0, _List.ofArray)([
|
|
2296
|
+
[
|
|
2297
|
+
"style",
|
|
2298
|
+
{
|
|
2299
|
+
border: 1 + "px " + "dashed" + " " + "hsl(0, 0%, 86%)",
|
|
2300
|
+
backgroundColor: "hsl(0, 0%, 98%)",
|
|
2301
|
+
padding: 16
|
|
2302
|
+
}
|
|
2303
|
+
],
|
|
2304
|
+
(elems_3 = [
|
|
2305
|
+
(0, _react.createElement)("div", {
|
|
2306
|
+
className: "has-text-weight-bold",
|
|
2307
|
+
children: "Allergy Finder",
|
|
2308
|
+
style: {
|
|
2309
|
+
marginBottom: 8
|
|
2310
|
+
}
|
|
2311
|
+
}),
|
|
2312
|
+
(0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
2313
|
+
[
|
|
2314
|
+
"style",
|
|
2315
|
+
{
|
|
2316
|
+
fontSize: 11 + "px",
|
|
2317
|
+
color: "hsl(0, 0%, 50%)"
|
|
2318
|
+
}
|
|
2319
|
+
],
|
|
2320
|
+
(elems_2 = [
|
|
2321
|
+
(0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
2322
|
+
[
|
|
2323
|
+
"style",
|
|
2324
|
+
{
|
|
2325
|
+
borderLeft: 3 + "px " + "solid" + " " + "#ef4444",
|
|
2326
|
+
paddingLeft: 8,
|
|
2327
|
+
marginBottom: 6
|
|
2328
|
+
}
|
|
2329
|
+
],
|
|
2330
|
+
(elems = [
|
|
2331
|
+
(0, _react.createElement)("div", {
|
|
2332
|
+
children: "Penicillin — Severe"
|
|
2333
|
+
}),
|
|
2334
|
+
(0, _react.createElement)("div", {
|
|
2335
|
+
style: {
|
|
2336
|
+
fontSize: 9 + "px"
|
|
2337
|
+
},
|
|
2338
|
+
children: "Reactions: Rash, Hives, Anaphylaxis"
|
|
2339
|
+
})
|
|
2340
|
+
], [
|
|
2341
|
+
"children",
|
|
2342
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems))
|
|
2343
|
+
])
|
|
2344
|
+
]))),
|
|
2345
|
+
(0, _react.createElement)("div", (0, _Util.createObj)((0, _List.ofArray)([
|
|
2346
|
+
[
|
|
2347
|
+
"style",
|
|
2348
|
+
{
|
|
2349
|
+
borderLeft: 3 + "px " + "solid" + " " + "#f59e0b",
|
|
2350
|
+
paddingLeft: 8,
|
|
2351
|
+
marginBottom: 6
|
|
2352
|
+
}
|
|
2353
|
+
],
|
|
2354
|
+
(elems_1 = [
|
|
2355
|
+
(0, _react.createElement)("div", {
|
|
2356
|
+
children: "Pollen — Moderate"
|
|
2357
|
+
}),
|
|
2358
|
+
(0, _react.createElement)("div", {
|
|
2359
|
+
style: {
|
|
2360
|
+
fontSize: 9 + "px"
|
|
2361
|
+
},
|
|
2362
|
+
children: "Reactions: Sneezing, Congestion"
|
|
2363
|
+
})
|
|
2364
|
+
], [
|
|
2365
|
+
"children",
|
|
2366
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_1))
|
|
2367
|
+
])
|
|
2368
|
+
]))),
|
|
2369
|
+
(0, _react.createElement)("div", {
|
|
2370
|
+
style: {
|
|
2371
|
+
marginTop: 8,
|
|
2372
|
+
color: "hsl(217, 91%, 60%)",
|
|
2373
|
+
fontWeight: 600
|
|
2374
|
+
},
|
|
2375
|
+
children: "+ Add Allergy"
|
|
2376
|
+
})
|
|
2377
|
+
], [
|
|
2378
|
+
"children",
|
|
2379
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_2))
|
|
2380
|
+
])
|
|
2381
|
+
]))),
|
|
2382
|
+
(0, _react.createElement)("div", {
|
|
2383
|
+
style: {
|
|
2384
|
+
fontSize: 10 + "px",
|
|
2385
|
+
color: "hsl(0, 0%, 60%)",
|
|
2386
|
+
marginTop: 8
|
|
2387
|
+
},
|
|
2388
|
+
children: "OpenFDA-powered allergy search with detailed profiles"
|
|
2389
|
+
})
|
|
2390
|
+
], [
|
|
2391
|
+
"children",
|
|
2392
|
+
_Interopfs.reactApi.Children.toArray(Array.from(elems_3))
|
|
2393
|
+
])
|
|
2394
|
+
]))))
|
|
2395
|
+
];
|
|
2396
|
+
return (0, _react.createElement)("div", {
|
|
2397
|
+
className: "control",
|
|
2398
|
+
children: _Interopfs.reactApi.Children.toArray(Array.from(children))
|
|
2399
|
+
});
|
|
2400
|
+
}
|
|
2401
|
+
function Form_markdownRenderer(field, fieldDetails) {
|
|
2402
|
+
let matchValue;
|
|
2403
|
+
const allergies = AllergyFinderField_parseAllergies((matchValue = fieldDetails.FieldValue, matchValue.tag === /* Single */ 0 ? matchValue.fields[0].Value : matchValue.tag === /* PluginData */ 3 ? (0, _Option.defaultArg)((0, _Option.map)((p_1)=>p_1.Value, (0, _List.tryFind)((p)=>p.Name === "allergies_json", matchValue.fields[0])), "[]") : "[]"));
|
|
2404
|
+
if ((0, _List.isEmpty)(allergies)) {
|
|
2405
|
+
return `**${field.Label}:** *[No allergies recorded]*`;
|
|
2406
|
+
} else {
|
|
2407
|
+
let rows = (0, _List.ofArray)([
|
|
2408
|
+
`**${field.Label}**`,
|
|
2409
|
+
"",
|
|
2410
|
+
"| Allergen | Severity | Category | Reactions | Remedy |",
|
|
2411
|
+
"|----------|----------|----------|-----------|--------|"
|
|
2412
|
+
]);
|
|
2413
|
+
const enumerator = (0, _Util.getEnumerator)(allergies);
|
|
2414
|
+
try {
|
|
2415
|
+
while(enumerator["System.Collections.IEnumerator.MoveNext"]()){
|
|
2416
|
+
const a = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
2417
|
+
let sevEmoji;
|
|
2418
|
+
const matchValue_1 = a.Severity;
|
|
2419
|
+
sevEmoji = matchValue_1.tag === /* Severe */ 3 ? "🟠" : matchValue_1.tag === /* Moderate */ 2 ? "🟡" : matchValue_1.tag === /* Mild */ 1 ? "🟢" : matchValue_1.tag === /* Unknown */ 0 ? "⚪" : "🔴";
|
|
2420
|
+
const reactions = (0, _List.isEmpty)(a.Reactions) ? "--" : (0, _String.join)(", ", (0, _List.truncate)(3, a.Reactions));
|
|
2421
|
+
const remedy = (0, _Option.defaultArg)(a.Remedy, "--");
|
|
2422
|
+
rows = (0, _List.append)(rows, (0, _List.singleton)(`| **${a.Name}** | ${sevEmoji} ${AllergyFinderField_severityLabel(a.Severity)} | ${AllergyFinderField_categoryLabel(a.Category)} | ${reactions} | ${remedy} |`));
|
|
2423
|
+
}
|
|
2424
|
+
} finally{
|
|
2425
|
+
(0, _Util.disposeSafe)(enumerator);
|
|
2426
|
+
}
|
|
2427
|
+
return (0, _String.join)("\n", rows);
|
|
2428
|
+
}
|
|
2429
|
+
} //# sourceMappingURL=AllergyFinderField.ts.map
|
|
2430
|
+
|
|
2431
|
+
//# sourceMappingURL=AllergyFinderField.js.map
|