- fixed issue with number form field;
- fixed issue with datepicker form field; - updated tables displaying submitted calls;
This commit is contained in:
@@ -28,18 +28,17 @@ const Datepicker = ({
|
||||
control={control}
|
||||
defaultValue={defaultValue}
|
||||
rules={config}
|
||||
render={({ field, fieldState }) => (
|
||||
<Calendar id={field.name}
|
||||
disabled={disabled}
|
||||
value={is(Date, field.value) ? field.value : null}
|
||||
onChange={(e) => field.onChange(e.value)}
|
||||
dateFormat="dd/mm/yy"
|
||||
hourFormat="24"
|
||||
timeOnly={timeOnly}
|
||||
showIcon
|
||||
minDate={minDate}
|
||||
maxDate={maxDate}
|
||||
className={classNames({ 'p-invalid': fieldState.invalid })}/>
|
||||
render={({ field, fieldState }) => (<Calendar id={field.name}
|
||||
disabled={disabled}
|
||||
value={is(String, field.value) ? new Date(field.value) : field.value}
|
||||
onChange={(e) => field.onChange(e.value)}
|
||||
dateFormat="dd/mm/yy"
|
||||
hourFormat="24"
|
||||
timeOnly={timeOnly}
|
||||
showIcon
|
||||
minDate={minDate}
|
||||
maxDate={maxDate}
|
||||
className={classNames({ 'p-invalid': fieldState.invalid })}/>
|
||||
)}/>
|
||||
{infoText ? <small>{infoText}</small> : null}
|
||||
</>)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { classNames } from 'primereact/utils';
|
||||
import { Controller } from 'react-hook-form';
|
||||
import { is } from 'ramda';
|
||||
import { is, isEmpty } from 'ramda';
|
||||
|
||||
import { InputNumber } from 'primereact/inputnumber';
|
||||
|
||||
@@ -23,6 +23,8 @@ const NumberInput = ({
|
||||
disabled = false,
|
||||
useGrouping = true
|
||||
}) => {
|
||||
const minAttr = config.min ? config.min : min;
|
||||
const maxAttr = config.max ? config.max : max;
|
||||
const input = <Controller
|
||||
name={fieldName}
|
||||
control={control}
|
||||
@@ -33,8 +35,8 @@ const NumberInput = ({
|
||||
disabled={disabled}
|
||||
value={field.value}
|
||||
onValueChange={(e) => field.onChange(e.value)}
|
||||
min={min}
|
||||
max={max}
|
||||
min={minAttr}
|
||||
max={maxAttr}
|
||||
locale={locale}
|
||||
useGrouping={useGrouping}
|
||||
maxFractionDigits={!isNaN(parseInt(maxFractionDigits)) ? parseInt(maxFractionDigits) : 0}
|
||||
@@ -45,6 +47,8 @@ const NumberInput = ({
|
||||
<>
|
||||
<label htmlFor={fieldName} className={classNames({ 'p-error': errors[fieldName] })}>
|
||||
{label}{config.required || config.isRequired ? <span className="appForm__field--required">*</span> : null}
|
||||
{!isEmpty(minAttr) ? <span>(min. {minAttr})</span> : null}
|
||||
{!isEmpty(maxAttr) ? <span>(max. {maxAttr})</span> : null}
|
||||
</label>
|
||||
{inputgroup
|
||||
? <div className="p-inputgroup">
|
||||
|
||||
Reference in New Issue
Block a user