|
|
@ -5,7 +5,6 @@ import { |
|
|
|
forwardRef, |
|
|
|
forwardRef, |
|
|
|
ReactElement, |
|
|
|
ReactElement, |
|
|
|
useCallback, |
|
|
|
useCallback, |
|
|
|
useEffect, |
|
|
|
|
|
|
|
useImperativeHandle, |
|
|
|
useImperativeHandle, |
|
|
|
useMemo, |
|
|
|
useMemo, |
|
|
|
useState, |
|
|
|
useState, |
|
|
@ -26,7 +25,7 @@ type InputWithRefOptionalPropsWithoutDefault< |
|
|
|
TypeName extends keyof MapToInputType, |
|
|
|
TypeName extends keyof MapToInputType, |
|
|
|
> = { |
|
|
|
> = { |
|
|
|
inputTestBatch?: InputTestBatch; |
|
|
|
inputTestBatch?: InputTestBatch; |
|
|
|
onFirstRender?: (args: { isRequired: boolean }) => void; |
|
|
|
onFirstRender?: InputFirstRenderFunction; |
|
|
|
valueKey?: CreateInputOnChangeHandlerOptions<TypeName>['valueKey']; |
|
|
|
valueKey?: CreateInputOnChangeHandlerOptions<TypeName>['valueKey']; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -167,11 +166,15 @@ const InputWithRef = forwardRef( |
|
|
|
[initOnFocus, inputTestBatch], |
|
|
|
[initOnFocus, inputTestBatch], |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
if (isFirstRender) { |
|
|
|
if (isFirstRender) { |
|
|
|
onFirstRender?.call(null, { isRequired }); |
|
|
|
const isValid = |
|
|
|
|
|
|
|
testInput?.call(null, { |
|
|
|
|
|
|
|
inputs: { [INPUT_TEST_ID]: { value: inputValue } }, |
|
|
|
|
|
|
|
isIgnoreOnCallbacks: true, |
|
|
|
|
|
|
|
}) ?? false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onFirstRender?.call(null, { isValid }); |
|
|
|
} |
|
|
|
} |
|
|
|
}, [isFirstRender, isRequired, onFirstRender]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useImperativeHandle( |
|
|
|
useImperativeHandle( |
|
|
|
ref, |
|
|
|
ref, |
|
|
|