Skip to content

Commit

Permalink
adding conditional assignment of min/max props to number component
Browse files Browse the repository at this point in the history
  • Loading branch information
arodidev committed Nov 14, 2023
1 parent 54d039c commit d2eb248
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/inputs/number/ohri-number.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const OHRINumber: React.FC<OHRIFormFieldProps> = ({ question, onChange, handler
}
}, [question['submission']]);

field.onBlur = event => {
field.onBlur = (event) => {
if (event && event.target.value != field.value) {
// testing purposes only
field.value = event.target.value;
Expand Down Expand Up @@ -58,7 +58,7 @@ const OHRINumber: React.FC<OHRIFormFieldProps> = ({ question, onChange, handler
}, [encounterContext?.previousEncounter]);

useEffect(() => {
getConceptNameAndUUID(question.questionOptions.concept).then(conceptTooltip => {
getConceptNameAndUUID(question.questionOptions.concept).then((conceptTooltip) => {
setConceptName(conceptTooltip);
});
}, [conceptName]);
Expand Down Expand Up @@ -89,15 +89,15 @@ const OHRINumber: React.FC<OHRIFormFieldProps> = ({ question, onChange, handler
invalid={!isFieldRequiredError && errors.length > 0}
invalidText={errors[0]?.message}
label={question.label}
max={question.questionOptions.max || undefined}
min={question.questionOptions.min || undefined}
max={question.unspecified ? undefined : question.questionOptions.max}
min={question.unspecified ? undefined : question.questionOptions.min}
name={question.id}
value={field.value || ''}
onFocus={() => setPreviousValue(field.value)}
allowEmpty={true}
size="lg"
hideSteppers={true}
onWheel={e => e.target.blur()}
onWheel={(e) => e.target.blur()}
disabled={question.disabled}
readOnly={question.readonly}
className={isFieldRequiredError ? styles.errorLabel : ''}
Expand Down

0 comments on commit d2eb248

Please sign in to comment.