From b138d72fb6b2207535080fda77bb5a4542a44a8b Mon Sep 17 00:00:00 2001 From: Kunal Dubey Date: Fri, 13 Sep 2024 16:41:43 +0530 Subject: [PATCH 1/2] RadioFormField: changed optionDisplay to optionLabel in RadioFormField --- package-lock.json | 25 +++++++++++-------- .../ExternalResult/ResultUpdate.tsx | 2 +- src/Components/Facility/FacilityCreate.tsx | 2 +- .../Form/FormFields/RadioFormField.tsx | 4 +-- .../LogUpdate/Sections/BloodSugar.tsx | 2 +- .../Sections/NeurologicalMonitoring.tsx | 12 ++++----- .../RespiratorySupport/OxygenSupport.tsx | 2 +- .../Sections/RespiratorySupport/index.tsx | 4 +-- src/Components/LogUpdate/Sections/Vitals.tsx | 2 +- src/Components/Patient/DailyRounds.tsx | 2 +- src/Components/Patient/PatientRegister.tsx | 10 ++++---- src/Components/Resource/ResourceCreate.tsx | 2 +- .../Resource/ResourceDetailsUpdate.tsx | 2 +- .../Shifting/ShiftDetailsUpdate.tsx | 6 ++--- 14 files changed, 41 insertions(+), 36 deletions(-) diff --git a/package-lock.json b/package-lock.json index dec462f006f..6df3e154645 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5937,12 +5937,13 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, + "license": "MIT", "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -8377,10 +8378,11 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, + "license": "MIT", "dependencies": { "to-regex-range": "^5.0.1" }, @@ -9956,6 +9958,7 @@ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.12.0" } @@ -15652,10 +15655,11 @@ } }, "node_modules/requirejs": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.6.tgz", - "integrity": "sha512-ipEzlWQe6RK3jkzikgCupiTbTvm4S0/CAU5GlgptkN5SO6F3u0UD0K18wy6ErDqiCyP4J4YYe1HuAShvsxePLg==", + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.7.tgz", + "integrity": "sha512-DouTG8T1WanGok6Qjg2SXuCMzszOo0eHeH9hDZ5Y4x8Je+9JB38HdTLT4/VA8OaUhBa0JPVHJ0pyBkM1z+pDsw==", "dev": true, + "license": "MIT", "bin": { "r_js": "bin/r.js", "r.js": "bin/r.js" @@ -17090,6 +17094,7 @@ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, + "license": "MIT", "dependencies": { "is-number": "^7.0.0" }, diff --git a/src/Components/ExternalResult/ResultUpdate.tsx b/src/Components/ExternalResult/ResultUpdate.tsx index 482c320457e..3e892940ac8 100644 --- a/src/Components/ExternalResult/ResultUpdate.tsx +++ b/src/Components/ExternalResult/ResultUpdate.tsx @@ -289,7 +289,7 @@ export default function UpdateResult(props: any) { ]} value={state.form.patient_created} onChange={handleChange} - optionDisplay={(option) => option.label} + optionLabel={(option) => option.label} optionValue={(option) => option.value} error={state.errors.patient_created} /> diff --git a/src/Components/Facility/FacilityCreate.tsx b/src/Components/Facility/FacilityCreate.tsx index a2ef08b7679..73d108dd216 100644 --- a/src/Components/Facility/FacilityCreate.tsx +++ b/src/Components/Facility/FacilityCreate.tsx @@ -929,7 +929,7 @@ export const FacilityCreate = (props: FacilityProps) => { {...field("kasp_empanelled")} label={`Is this facility ${careConfig.kasp.string} empanelled?`} options={[true, false]} - optionDisplay={(o) => (o ? "Yes" : "No")} + optionLabel={(o) => (o ? "Yes" : "No")} optionValue={(o) => String(o)} /> )} diff --git a/src/Components/Form/FormFields/RadioFormField.tsx b/src/Components/Form/FormFields/RadioFormField.tsx index c881bc66f94..ddb9178c6e9 100644 --- a/src/Components/Form/FormFields/RadioFormField.tsx +++ b/src/Components/Form/FormFields/RadioFormField.tsx @@ -5,7 +5,7 @@ import { FormFieldBaseProps, useFormFieldPropsResolver } from "./Utils"; type Props = FormFieldBaseProps & { options: readonly T[]; - optionDisplay: (option: T) => React.ReactNode; + optionLabel: (option: T) => React.ReactNode; optionValue: (option: T) => V; containerClassName?: string; unselectLabel?: string; @@ -47,7 +47,7 @@ const RadioFormField = (props: Props) => { { label="Frequency" name="insulin_intake_frequency" options={INSULIN_INTAKE_FREQUENCY_OPTIONS} - optionDisplay={(c) => t(`INSULIN_INTAKE_FREQUENCY__${c}`)} + optionLabel={(c) => t(`INSULIN_INTAKE_FREQUENCY__${c}`)} optionValue={(c) => c} value={log.insulin_intake_frequency} onChange={(c) => diff --git a/src/Components/LogUpdate/Sections/NeurologicalMonitoring.tsx b/src/Components/LogUpdate/Sections/NeurologicalMonitoring.tsx index 0d237aafd49..7ef98c4010b 100644 --- a/src/Components/LogUpdate/Sections/NeurologicalMonitoring.tsx +++ b/src/Components/LogUpdate/Sections/NeurologicalMonitoring.tsx @@ -31,7 +31,7 @@ const NeurologicalMonitoring = ({ log, onChange }: LogUpdateSectionProps) => { t(`CONSCIOUSNESS_LEVEL__${c.value}`)} + optionLabel={(c) => t(`CONSCIOUSNESS_LEVEL__${c.value}`)} optionValue={(c) => c.value} value={log.consciousness_level} onChange={(c) => @@ -60,7 +60,7 @@ const NeurologicalMonitoring = ({ log, onChange }: LogUpdateSectionProps) => { (o) => o.value !== "UNKNOWN", )} id={`${d}_reaction`} - optionDisplay={(c) => t(`PUPIL_REACTION__${c.value}`)} + optionLabel={(c) => t(`PUPIL_REACTION__${c.value}`)} optionValue={(c) => c.value} name={`${d}_pupil_light_reaction`} value={log[`${d}_pupil_light_reaction`]} @@ -98,7 +98,7 @@ const NeurologicalMonitoring = ({ log, onChange }: LogUpdateSectionProps) => { Eye Opening Response} options={EYE_OPEN_SCALE} - optionDisplay={(c) => c.value + " - " + c.text} + optionLabel={(c) => c.value + " - " + c.text} optionValue={(c) => `${c.value}`} name="eye_opening_response" value={`${log.glasgow_eye_open}`} @@ -110,7 +110,7 @@ const NeurologicalMonitoring = ({ log, onChange }: LogUpdateSectionProps) => { Verbal Response} options={VERBAL_RESPONSE_SCALE} - optionDisplay={(c) => c.value + " - " + c.text} + optionLabel={(c) => c.value + " - " + c.text} optionValue={(c) => `${c.value}`} name="verbal_response" value={`${log.glasgow_verbal_response}`} @@ -124,7 +124,7 @@ const NeurologicalMonitoring = ({ log, onChange }: LogUpdateSectionProps) => { Motor Response} options={MOTOR_RESPONSE_SCALE} - optionDisplay={(c) => c.value + " - " + c.text} + optionLabel={(c) => c.value + " - " + c.text} optionValue={(c) => `${c.value}`} name="motor_response" value={`${log.glasgow_motor_response}`} @@ -164,7 +164,7 @@ const NeurologicalMonitoring = ({ log, onChange }: LogUpdateSectionProps) => { } options={LIMB_RESPONSE_OPTIONS.filter((o) => o.value !== "UNKNOWN")} - optionDisplay={(c) => t(`LIMB_RESPONSE__${c.value}`)} + optionLabel={(c) => t(`LIMB_RESPONSE__${c.value}`)} optionValue={(c) => c.value} name={key} value={log[key]} diff --git a/src/Components/LogUpdate/Sections/RespiratorySupport/OxygenSupport.tsx b/src/Components/LogUpdate/Sections/RespiratorySupport/OxygenSupport.tsx index cefcf2ddb0e..758b49613ce 100644 --- a/src/Components/LogUpdate/Sections/RespiratorySupport/OxygenSupport.tsx +++ b/src/Components/LogUpdate/Sections/RespiratorySupport/OxygenSupport.tsx @@ -13,7 +13,7 @@ const OxygenRespiratorySupport = ({ log, onChange }: LogUpdateSectionProps) => { Oxygen Modality} options={OXYGEN_MODALITY_OPTIONS} - optionDisplay={(c) => t(`OXYGEN_MODALITY__${c.value}`)} + optionLabel={(c) => t(`OXYGEN_MODALITY__${c.value}`)} optionValue={(c) => c.value} name="ventilator_oxygen_modality" value={log.ventilator_oxygen_modality} diff --git a/src/Components/LogUpdate/Sections/RespiratorySupport/index.tsx b/src/Components/LogUpdate/Sections/RespiratorySupport/index.tsx index 8d558820843..6c58d0bfa72 100644 --- a/src/Components/LogUpdate/Sections/RespiratorySupport/index.tsx +++ b/src/Components/LogUpdate/Sections/RespiratorySupport/index.tsx @@ -57,7 +57,7 @@ const RespiratorySupport = ({ log, onChange }: LogUpdateSectionProps) => { label="Bilateral Air Entry" labelClassName="text-lg sm:font-bold" options={[true, false]} - optionDisplay={(c) => (c ? "Yes" : "No")} + optionLabel={(c) => (c ? "Yes" : "No")} optionValue={(c) => JSON.stringify(c)} name="bilateral_air_entry" value={ @@ -90,7 +90,7 @@ const RespiratorySupport = ({ log, onChange }: LogUpdateSectionProps) => { Respiratory Support} options={RESPIRATORY_SUPPORT} - optionDisplay={(c) => t(`RESPIRATORY_SUPPORT__${c.value}`)} + optionLabel={(c) => t(`RESPIRATORY_SUPPORT__${c.value}`)} optionValue={(c) => c.value} name="respiratory_support" value={log.ventilator_interface} diff --git a/src/Components/LogUpdate/Sections/Vitals.tsx b/src/Components/LogUpdate/Sections/Vitals.tsx index 1fa4b3f3aac..8592f004370 100644 --- a/src/Components/LogUpdate/Sections/Vitals.tsx +++ b/src/Components/LogUpdate/Sections/Vitals.tsx @@ -140,7 +140,7 @@ const Vitals = ({ log, onChange }: LogUpdateSectionProps) => { label={t("heartbeat_rhythm")} name="heartbeat-rythm" options={HEARTBEAT_RHYTHM_CHOICES} - optionDisplay={(c) => t(`HEARTBEAT_RHYTHM__${c}`)} + optionLabel={(c) => t(`HEARTBEAT_RHYTHM__${c}`)} optionValue={(c) => c} value={log.rhythm} onChange={(c) => onChange({ rhythm: c.value ?? undefined })} diff --git a/src/Components/Patient/DailyRounds.tsx b/src/Components/Patient/DailyRounds.tsx index 0f0c7396f5e..7335e5c6983 100644 --- a/src/Components/Patient/DailyRounds.tsx +++ b/src/Components/Patient/DailyRounds.tsx @@ -770,7 +770,7 @@ export const DailyRounds = (props: any) => { label: t(`CONSCIOUSNESS_LEVEL__${level.value}`), value: level.value, }))} - optionDisplay={(option) => option.label} + optionLabel={(option) => option.label} optionValue={(option) => option.value} unselectLabel="Unknown" layout="vertical" diff --git a/src/Components/Patient/PatientRegister.tsx b/src/Components/Patient/PatientRegister.tsx index c25a6365e70..4472baae39c 100644 --- a/src/Components/Patient/PatientRegister.tsx +++ b/src/Components/Patient/PatientRegister.tsx @@ -1468,7 +1468,7 @@ export const PatientRegister = (props: PatientRegisterProps) => { { label: "Yes", value: "true" }, { label: "No", value: "false" }, ]} - optionDisplay={(option) => option.label} + optionLabel={(option) => option.label} optionValue={(option) => option.value} /> @@ -1501,7 +1501,7 @@ export const PatientRegister = (props: PatientRegisterProps) => { { label: "Yes", value: "true" }, { label: "No", value: "false" }, ]} - optionDisplay={(option) => option.label} + optionLabel={(option) => option.label} optionValue={(option) => option.value} /> @@ -1781,7 +1781,7 @@ export const PatientRegister = (props: PatientRegisterProps) => { { label: "Yes", value: "true" }, { label: "No", value: "false" }, ]} - optionDisplay={(option) => option.label} + optionLabel={(option) => option.label} optionValue={(option) => option.value} /> @@ -1815,7 +1815,7 @@ export const PatientRegister = (props: PatientRegisterProps) => { value: "3", }, ]} - optionDisplay={(option) => option.label} + optionLabel={(option) => option.label} optionValue={(option) => option.value} /> @@ -1850,7 +1850,7 @@ export const PatientRegister = (props: PatientRegisterProps) => { { label: "Yes", value: "true" }, { label: "No", value: "false" }, ]} - optionDisplay={(option) => option.label} + optionLabel={(option) => option.label} optionValue={(option) => option.value} /> (o ? t("yes") : t("no"))} + optionLabel={(o) => (o ? t("yes") : t("no"))} optionValue={(o) => String(o)} value={state.form.emergency} onChange={handleChange} diff --git a/src/Components/Resource/ResourceDetailsUpdate.tsx b/src/Components/Resource/ResourceDetailsUpdate.tsx index 178ab596148..6d293f05df5 100644 --- a/src/Components/Resource/ResourceDetailsUpdate.tsx +++ b/src/Components/Resource/ResourceDetailsUpdate.tsx @@ -298,7 +298,7 @@ export const ResourceDetailsUpdate = (props: resourceProps) => { onChange={handleChange} label={"Is this an emergency?"} options={[true, false]} - optionDisplay={(o) => (o ? "Yes" : "No")} + optionLabel={(o) => (o ? "Yes" : "No")} optionValue={(o) => String(o)} value={String(state.form.emergency)} error={state.errors.emergency} diff --git a/src/Components/Shifting/ShiftDetailsUpdate.tsx b/src/Components/Shifting/ShiftDetailsUpdate.tsx index 8e6fb582906..ccf808ecda9 100644 --- a/src/Components/Shifting/ShiftDetailsUpdate.tsx +++ b/src/Components/Shifting/ShiftDetailsUpdate.tsx @@ -420,7 +420,7 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => { { label: t("yes"), value: "true" }, { label: t("no"), value: "false" }, ]} - optionDisplay={(option) => option.label} + optionLabel={(option) => option.label} optionValue={(option) => option.value} /> @@ -434,7 +434,7 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => { { label: t("no"), value: "false" }, ]} optionValue={(option) => option.value} - optionDisplay={(option) => option.label} + optionLabel={(option) => option.label} onChange={handleFormFieldChange} /> )} @@ -448,7 +448,7 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => { { label: t("no"), value: "false" }, ]} optionValue={(option) => option.value} - optionDisplay={(option) => option.label} + optionLabel={(option) => option.label} onChange={handleFormFieldChange} /> From 20421402a5f614fe933e34335388ad98ac272b23 Mon Sep 17 00:00:00 2001 From: Kunal Dubey Date: Fri, 13 Sep 2024 23:27:21 +0530 Subject: [PATCH 2/2] RadioFormField: reverted changes made to package-lock.json --- package-lock.json | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6df3e154645..14fd0262607 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5937,13 +5937,12 @@ } }, "node_modules/braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "dev": true, - "license": "MIT", "dependencies": { - "fill-range": "^7.1.1" + "fill-range": "^7.0.1" }, "engines": { "node": ">=8" @@ -8378,11 +8377,10 @@ } }, "node_modules/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "dev": true, - "license": "MIT", "dependencies": { "to-regex-range": "^5.0.1" }, @@ -9958,7 +9956,6 @@ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.12.0" } @@ -15655,11 +15652,10 @@ } }, "node_modules/requirejs": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.7.tgz", - "integrity": "sha512-DouTG8T1WanGok6Qjg2SXuCMzszOo0eHeH9hDZ5Y4x8Je+9JB38HdTLT4/VA8OaUhBa0JPVHJ0pyBkM1z+pDsw==", + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.6.tgz", + "integrity": "sha512-ipEzlWQe6RK3jkzikgCupiTbTvm4S0/CAU5GlgptkN5SO6F3u0UD0K18wy6ErDqiCyP4J4YYe1HuAShvsxePLg==", "dev": true, - "license": "MIT", "bin": { "r_js": "bin/r.js", "r.js": "bin/r.js" @@ -17094,7 +17090,6 @@ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, - "license": "MIT", "dependencies": { "is-number": "^7.0.0" }, @@ -19263,4 +19258,4 @@ } } } -} +} \ No newline at end of file