|
|
@ -1,4 +1,5 @@ |
|
|
|
import { ReactElement } from 'react'; |
|
|
|
import { debounce } from 'lodash'; |
|
|
|
|
|
|
|
import { ReactElement, useMemo } from 'react'; |
|
|
|
|
|
|
|
|
|
|
|
import Grid from '../Grid'; |
|
|
|
import Grid from '../Grid'; |
|
|
|
import InputWithRef from '../InputWithRef'; |
|
|
|
import InputWithRef from '../InputWithRef'; |
|
|
@ -26,109 +27,123 @@ const AnIdInputGroup = < |
|
|
|
| typeof INPUT_ID_AI_SEQUENCE]: string; |
|
|
|
| typeof INPUT_ID_AI_SEQUENCE]: string; |
|
|
|
}, |
|
|
|
}, |
|
|
|
>({ |
|
|
|
>({ |
|
|
|
|
|
|
|
debounceWait = 500, |
|
|
|
formUtils: { |
|
|
|
formUtils: { |
|
|
|
buildFinishInputTestBatchFunction, |
|
|
|
buildFinishInputTestBatchFunction, |
|
|
|
buildInputFirstRenderFunction, |
|
|
|
buildInputFirstRenderFunction, |
|
|
|
setMessage, |
|
|
|
setMessage, |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
onSequenceChange, |
|
|
|
previous: { |
|
|
|
previous: { |
|
|
|
domain: previousDomain, |
|
|
|
domain: previousDomain, |
|
|
|
prefix: previousPrefix, |
|
|
|
prefix: previousPrefix, |
|
|
|
sequence: previousSequence, |
|
|
|
sequence: previousSequence, |
|
|
|
} = {}, |
|
|
|
} = {}, |
|
|
|
}: AnIdInputGroupProps<M>): ReactElement => ( |
|
|
|
}: AnIdInputGroupProps<M>): ReactElement => { |
|
|
|
<Grid |
|
|
|
const debounceSequenceChangeHandler = useMemo( |
|
|
|
columns={{ xs: 1, sm: 2, md: 3 }} |
|
|
|
() => onSequenceChange && debounce(onSequenceChange, debounceWait), |
|
|
|
layout={{ |
|
|
|
[debounceWait, onSequenceChange], |
|
|
|
'an-id-input-cell-prefix': { |
|
|
|
); |
|
|
|
children: ( |
|
|
|
|
|
|
|
<InputWithRef |
|
|
|
return ( |
|
|
|
input={ |
|
|
|
<Grid |
|
|
|
<OutlinedInputWithLabel |
|
|
|
columns={{ xs: 1, sm: 2, md: 3 }} |
|
|
|
id={INPUT_ID_AI_PREFIX} |
|
|
|
layout={{ |
|
|
|
label={INPUT_LABEL_AI_PREFIX} |
|
|
|
'an-id-input-cell-prefix': { |
|
|
|
value={previousPrefix} |
|
|
|
children: ( |
|
|
|
/> |
|
|
|
<InputWithRef |
|
|
|
} |
|
|
|
input={ |
|
|
|
inputTestBatch={buildPeacefulStringTestBatch( |
|
|
|
<OutlinedInputWithLabel |
|
|
|
INPUT_LABEL_AI_PREFIX, |
|
|
|
id={INPUT_ID_AI_PREFIX} |
|
|
|
() => { |
|
|
|
label={INPUT_LABEL_AI_PREFIX} |
|
|
|
setMessage(INPUT_ID_AI_PREFIX); |
|
|
|
value={previousPrefix} |
|
|
|
}, |
|
|
|
/> |
|
|
|
{ |
|
|
|
} |
|
|
|
onFinishBatch: |
|
|
|
inputTestBatch={buildPeacefulStringTestBatch( |
|
|
|
buildFinishInputTestBatchFunction(INPUT_ID_AI_PREFIX), |
|
|
|
INPUT_LABEL_AI_PREFIX, |
|
|
|
}, |
|
|
|
() => { |
|
|
|
(message) => { |
|
|
|
setMessage(INPUT_ID_AI_PREFIX); |
|
|
|
setMessage(INPUT_ID_AI_PREFIX, { children: message }); |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
)} |
|
|
|
onFinishBatch: |
|
|
|
onFirstRender={buildInputFirstRenderFunction(INPUT_ID_AI_PREFIX)} |
|
|
|
buildFinishInputTestBatchFunction(INPUT_ID_AI_PREFIX), |
|
|
|
required |
|
|
|
}, |
|
|
|
/> |
|
|
|
(message) => { |
|
|
|
), |
|
|
|
setMessage(INPUT_ID_AI_PREFIX, { children: message }); |
|
|
|
}, |
|
|
|
}, |
|
|
|
'an-id-input-cell-domain': { |
|
|
|
)} |
|
|
|
children: ( |
|
|
|
onFirstRender={buildInputFirstRenderFunction(INPUT_ID_AI_PREFIX)} |
|
|
|
<InputWithRef |
|
|
|
required |
|
|
|
input={ |
|
|
|
/> |
|
|
|
<OutlinedInputWithLabel |
|
|
|
), |
|
|
|
id={INPUT_ID_AI_DOMAIN} |
|
|
|
}, |
|
|
|
label={INPUT_LABEL_AI_DOMAIN} |
|
|
|
'an-id-input-cell-domain': { |
|
|
|
value={previousDomain} |
|
|
|
children: ( |
|
|
|
/> |
|
|
|
<InputWithRef |
|
|
|
} |
|
|
|
input={ |
|
|
|
inputTestBatch={buildPeacefulStringTestBatch( |
|
|
|
<OutlinedInputWithLabel |
|
|
|
INPUT_LABEL_AI_DOMAIN, |
|
|
|
id={INPUT_ID_AI_DOMAIN} |
|
|
|
() => { |
|
|
|
label={INPUT_LABEL_AI_DOMAIN} |
|
|
|
setMessage(INPUT_ID_AI_DOMAIN); |
|
|
|
value={previousDomain} |
|
|
|
}, |
|
|
|
/> |
|
|
|
{ |
|
|
|
} |
|
|
|
onFinishBatch: |
|
|
|
inputTestBatch={buildPeacefulStringTestBatch( |
|
|
|
buildFinishInputTestBatchFunction(INPUT_ID_AI_DOMAIN), |
|
|
|
INPUT_LABEL_AI_DOMAIN, |
|
|
|
}, |
|
|
|
() => { |
|
|
|
(message) => { |
|
|
|
setMessage(INPUT_ID_AI_DOMAIN); |
|
|
|
setMessage(INPUT_ID_AI_DOMAIN, { children: message }); |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
)} |
|
|
|
onFinishBatch: |
|
|
|
onFirstRender={buildInputFirstRenderFunction(INPUT_ID_AI_DOMAIN)} |
|
|
|
buildFinishInputTestBatchFunction(INPUT_ID_AI_DOMAIN), |
|
|
|
required |
|
|
|
}, |
|
|
|
/> |
|
|
|
(message) => { |
|
|
|
), |
|
|
|
setMessage(INPUT_ID_AI_DOMAIN, { children: message }); |
|
|
|
}, |
|
|
|
}, |
|
|
|
'an-id-input-cell-sequence': { |
|
|
|
)} |
|
|
|
children: ( |
|
|
|
onFirstRender={buildInputFirstRenderFunction(INPUT_ID_AI_DOMAIN)} |
|
|
|
<InputWithRef |
|
|
|
required |
|
|
|
input={ |
|
|
|
/> |
|
|
|
<OutlinedInputWithLabel |
|
|
|
), |
|
|
|
id={INPUT_ID_AI_SEQUENCE} |
|
|
|
}, |
|
|
|
label={INPUT_LABEL_AI_SEQUENCE} |
|
|
|
'an-id-input-cell-sequence': { |
|
|
|
value={previousSequence} |
|
|
|
children: ( |
|
|
|
/> |
|
|
|
<InputWithRef |
|
|
|
} |
|
|
|
createInputOnChangeHandlerOptions={{ |
|
|
|
inputTestBatch={buildNumberTestBatch( |
|
|
|
postSet: debounceSequenceChangeHandler, |
|
|
|
INPUT_LABEL_AI_SEQUENCE, |
|
|
|
}} |
|
|
|
() => { |
|
|
|
input={ |
|
|
|
setMessage(INPUT_ID_AI_SEQUENCE); |
|
|
|
<OutlinedInputWithLabel |
|
|
|
}, |
|
|
|
id={INPUT_ID_AI_SEQUENCE} |
|
|
|
{ |
|
|
|
label={INPUT_LABEL_AI_SEQUENCE} |
|
|
|
onFinishBatch: |
|
|
|
value={previousSequence} |
|
|
|
buildFinishInputTestBatchFunction(INPUT_ID_AI_SEQUENCE), |
|
|
|
/> |
|
|
|
}, |
|
|
|
} |
|
|
|
(message) => { |
|
|
|
inputTestBatch={buildNumberTestBatch( |
|
|
|
setMessage(INPUT_ID_AI_SEQUENCE, { children: message }); |
|
|
|
INPUT_LABEL_AI_SEQUENCE, |
|
|
|
}, |
|
|
|
() => { |
|
|
|
)} |
|
|
|
setMessage(INPUT_ID_AI_SEQUENCE); |
|
|
|
onFirstRender={buildInputFirstRenderFunction(INPUT_ID_AI_SEQUENCE)} |
|
|
|
}, |
|
|
|
required |
|
|
|
{ |
|
|
|
valueType="number" |
|
|
|
onFinishBatch: |
|
|
|
/> |
|
|
|
buildFinishInputTestBatchFunction(INPUT_ID_AI_SEQUENCE), |
|
|
|
), |
|
|
|
}, |
|
|
|
}, |
|
|
|
(message) => { |
|
|
|
}} |
|
|
|
setMessage(INPUT_ID_AI_SEQUENCE, { children: message }); |
|
|
|
spacing="1em" |
|
|
|
}, |
|
|
|
/> |
|
|
|
)} |
|
|
|
); |
|
|
|
onFirstRender={buildInputFirstRenderFunction( |
|
|
|
|
|
|
|
INPUT_ID_AI_SEQUENCE, |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
required |
|
|
|
|
|
|
|
valueType="number" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
spacing="1em" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export { INPUT_ID_AI_DOMAIN, INPUT_ID_AI_PREFIX, INPUT_ID_AI_SEQUENCE }; |
|
|
|
export { INPUT_ID_AI_DOMAIN, INPUT_ID_AI_PREFIX, INPUT_ID_AI_SEQUENCE }; |
|
|
|
|
|
|
|
|
|
|
|