From 0bb4040395d66ebbbdf28af378e4e7fb2ac897b1 Mon Sep 17 00:00:00 2001 From: Kayvon-Martinez <142514475+Kayvon-Martinez@users.noreply.github.com> Date: Thu, 21 Dec 2023 03:30:14 +0000 Subject: [PATCH] Added asterisk to title when required and fixed validation errors (#829) * Fixed validation errors for numeric range field and added asterisk when field is required * Removed unused import --- .../NumericRangeField/NumericRangeField.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spiffworkflow-frontend/src/rjsf/custom_widgets/NumericRangeField/NumericRangeField.tsx b/spiffworkflow-frontend/src/rjsf/custom_widgets/NumericRangeField/NumericRangeField.tsx index 00a5e969..6152ac0e 100644 --- a/spiffworkflow-frontend/src/rjsf/custom_widgets/NumericRangeField/NumericRangeField.tsx +++ b/spiffworkflow-frontend/src/rjsf/custom_widgets/NumericRangeField/NumericRangeField.tsx @@ -40,6 +40,7 @@ export default function NumericRangeField({ rawErrors = [], formData, registry, + required, }: FieldProps) { const commonAttributes = getCommonAttributes( label, @@ -61,7 +62,7 @@ export default function NumericRangeField({ if (numberString) { return numberString.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); } - return '0'; + return ''; }; const parseNumberString = (numberString: string) => @@ -102,7 +103,9 @@ export default function NumericRangeField({ return (
-
{commonAttributes.label}
+
+ {required ? `${commonAttributes.label} *` : commonAttributes.label} +
{description && (
onChangeLocal('max', values)} - defaultValue="0" invalid={commonAttributes.invalid} />