diff --git a/src/components/inputs/date/ohri-date.component.tsx b/src/components/inputs/date/ohri-date.component.tsx index e03f203bf..c2c8cfa4c 100644 --- a/src/components/inputs/date/ohri-date.component.tsx +++ b/src/components/inputs/date/ohri-date.component.tsx @@ -132,7 +132,7 @@ const OHRIDate: React.FC = ({ question, onChange, handler }) } }, [field.value, time]); - return encounterContext.sessionMode == 'view' || isTrue(question.readonly) ? ( + return encounterContext.sessionMode == 'view' ? ( = ({ question, onChange, handler }) invalidText={errors[0]?.message} warn={warnings.length > 0} warnText={warnings[0]?.message} + readOnly={question.readonly} /> diff --git a/src/components/inputs/location/ohri-encounter-location.component.tsx b/src/components/inputs/location/ohri-encounter-location.component.tsx index 3b4ab467c..c2ac0b404 100644 --- a/src/components/inputs/location/ohri-encounter-location.component.tsx +++ b/src/components/inputs/location/ohri-encounter-location.component.tsx @@ -36,7 +36,7 @@ export const OHRIEncounterLocationPicker: React.FC<{ question: OHRIFormField; on }); }, [conceptName]); - return encounterContext.sessionMode == 'view' || isTrue(question.readonly) ? ( + return encounterContext.sessionMode == 'view' ? (
diff --git a/src/components/inputs/multi-select/ohri-multi-select.component.tsx b/src/components/inputs/multi-select/ohri-multi-select.component.tsx index b4c9c485b..51a8577ac 100644 --- a/src/components/inputs/multi-select/ohri-multi-select.component.tsx +++ b/src/components/inputs/multi-select/ohri-multi-select.component.tsx @@ -78,7 +78,7 @@ export const OHRIMultiSelect: React.FC = ({ question, onChan return false; }, [encounterContext.sessionMode, question.readonly, question.inlineRendering, layoutType, workspaceLayout]); - return encounterContext.sessionMode == 'view' || isTrue(question.readonly) ? ( + return encounterContext.sessionMode == 'view' ? (
= ({ question, onChan invalidText={errors[0]?.message} warn={warnings.length > 0} warnText={warnings[0]?.message} + readOnly={question.readonly} />
diff --git a/src/components/inputs/number/ohri-number.component.tsx b/src/components/inputs/number/ohri-number.component.tsx index 5c15dcd29..c2ced088e 100644 --- a/src/components/inputs/number/ohri-number.component.tsx +++ b/src/components/inputs/number/ohri-number.component.tsx @@ -70,7 +70,7 @@ const OHRINumber: React.FC = ({ question, onChange, handler return false; }, [encounterContext.sessionMode, question.readonly, question.inlineRendering, layoutType, workspaceLayout]); - return encounterContext.sessionMode == 'view' || isTrue(question.readonly) ? ( + return encounterContext.sessionMode == 'view' ? (
= ({ question, onChange, handler hideSteppers={true} onWheel={e => e.target.blur()} disabled={question.disabled} + readOnly={question.readonly} className={isFieldRequiredError ? styles.errorLabel : ''} warn={warnings.length > 0} warnText={warnings[0]?.message} diff --git a/src/components/inputs/select/ohri-dropdown.component.tsx b/src/components/inputs/select/ohri-dropdown.component.tsx index 7369f802b..023dfa28c 100644 --- a/src/components/inputs/select/ohri-dropdown.component.tsx +++ b/src/components/inputs/select/ohri-dropdown.component.tsx @@ -65,7 +65,7 @@ const OHRIDropdown: React.FC = ({ question, onChange, handle return false; }, [encounterContext.sessionMode, question.readonly, question.inlineRendering, layoutType, workspaceLayout]); - return encounterContext.sessionMode == 'view' || isTrue(question.readonly) ? ( + return encounterContext.sessionMode == 'view' ? ( = ({ question, onChange, handle selectedItem={field.value} onChange={({ selectedItem }) => handleChange(selectedItem)} disabled={question.disabled} + readOnly={question.readonly} invalid={!isFieldRequiredError && errors.length > 0} invalidText={errors.length && errors[0].message} warn={warnings.length > 0} diff --git a/src/components/inputs/text-area/ohri-text-area.component.tsx b/src/components/inputs/text-area/ohri-text-area.component.tsx index 5aea8bf3e..efda69c36 100644 --- a/src/components/inputs/text-area/ohri-text-area.component.tsx +++ b/src/components/inputs/text-area/ohri-text-area.component.tsx @@ -48,7 +48,7 @@ const OHRITextArea: React.FC = ({ question, onChange, handle return false; }, [encounterContext.sessionMode, question.readonly, question.inlineRendering, layoutType, workspaceLayout]); - return encounterContext.sessionMode == 'view' || isTrue(question.readonly) ? ( + return encounterContext.sessionMode == 'view' ? (
@@ -68,6 +68,7 @@ const OHRITextArea: React.FC = ({ question, onChange, handle onFocus={() => setPreviousValue(field.value)} rows={question.questionOptions.rows || 4} disabled={question.disabled} + readOnly={question.readonly} invalid={!isFieldRequiredError && errors.length > 0} invalidText={errors.length && errors[0].message} warn={warnings.length > 0} diff --git a/src/components/inputs/text/ohri-text.component.tsx b/src/components/inputs/text/ohri-text.component.tsx index d44987bf0..6c8e440ea 100644 --- a/src/components/inputs/text/ohri-text.component.tsx +++ b/src/components/inputs/text/ohri-text.component.tsx @@ -66,7 +66,7 @@ const OHRIText: React.FC = ({ question, onChange, handler }) return false; }, [encounterContext.sessionMode, question.readonly, question.inlineRendering, layoutType, workspaceLayout]); - return encounterContext.sessionMode == 'view' || isTrue(question.readonly) ? ( + return encounterContext.sessionMode == 'view' ? (
@@ -86,6 +86,7 @@ const OHRIText: React.FC = ({ question, onChange, handler }) value={field.value || ''} onFocus={() => setPreviousValue(field.value)} disabled={question.disabled} + readOnly={question.readonly} invalid={!isFieldRequiredError && errors.length > 0} invalidText={errors.length && errors[0].message} warn={warnings.length > 0} diff --git a/src/components/inputs/toggle/ohri-toggle.component.tsx b/src/components/inputs/toggle/ohri-toggle.component.tsx index 833812821..fd16c91ba 100644 --- a/src/components/inputs/toggle/ohri-toggle.component.tsx +++ b/src/components/inputs/toggle/ohri-toggle.component.tsx @@ -40,7 +40,7 @@ const OHRIToggle: React.FC = ({ question, onChange, handler return false; }, [encounterContext.sessionMode, question.readonly, question.inlineRendering, layoutType, workspaceLayout]); - return encounterContext.sessionMode == 'view' || isTrue(question.readonly) ? ( + return encounterContext.sessionMode == 'view' ? (
= ({ question, onChange, handler onToggle={handleChange} toggled={!!field.value} disabled={question.disabled} + readOnly={question.readonly} />
) diff --git a/src/components/inputs/ui-select-extended/ui-select-extended.tsx b/src/components/inputs/ui-select-extended/ui-select-extended.tsx index c0d668ed0..06b37effd 100644 --- a/src/components/inputs/ui-select-extended/ui-select-extended.tsx +++ b/src/components/inputs/ui-select-extended/ui-select-extended.tsx @@ -90,7 +90,7 @@ export const UISelectExtended: React.FC = ({ question, handl } return changes; }; - return encounterContext.sessionMode == 'view' || isTrue(question.readonly) ? ( + return encounterContext.sessionMode == 'view' ? (
= ({ question, handl }} onChange={({ selectedItem }) => handleChange(selectedItem?.uuid)} disabled={question.disabled} + readOnly={question.readonly} onInputChange={value => { inputValue.current = value; if (question.questionOptions['isSearchable']) {