- saving progress;
This commit is contained in:
@@ -21,12 +21,14 @@ const RepeaterFields = ({ sourceId, sourceName }) => {
|
||||
setValue,
|
||||
register,
|
||||
trigger,
|
||||
getValues
|
||||
getValues,
|
||||
watch
|
||||
} = useForm({
|
||||
defaultValues: useMemo(() => {
|
||||
return formInitialData;
|
||||
}, [formInitialData]), mode: 'onChange'
|
||||
});
|
||||
const watchName = watch('name');
|
||||
|
||||
const onSubmit = () => {
|
||||
};
|
||||
@@ -49,19 +51,20 @@ const RepeaterFields = ({ sourceId, sourceName }) => {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
trigger();
|
||||
}, [chosen]);
|
||||
|
||||
}, [chosen])
|
||||
console.log('items', items);
|
||||
return (
|
||||
<div className="fieldsRepeater">
|
||||
<form className="appForm" onSubmit={handleSubmit(onSubmit)}>
|
||||
{items
|
||||
? items.map(o => <div key={o.fieldId}>
|
||||
<div className="fieldsRepeater__Heading">
|
||||
<span>{o.name}</span>
|
||||
? items.map(o => <div key={o.fieldId} className="fieldsRepeater__panel p-panel p-component">
|
||||
<div className="fieldsRepeater__heading p-panel p-panel-header">
|
||||
<span>{chosen.fieldId === o.fieldId ? watchName : o.name}</span>
|
||||
</div>
|
||||
{chosen.fieldId === o.fieldId
|
||||
? <div className="fieldsRepeater__fields">
|
||||
? <div className="fieldsRepeater__fields p-panel-content">
|
||||
<FormField
|
||||
type="textinput"
|
||||
fieldName="name"
|
||||
@@ -91,6 +94,7 @@ const RepeaterFields = ({ sourceId, sourceName }) => {
|
||||
) : null}
|
||||
</form>
|
||||
<Button
|
||||
className="fieldsRepeater__addNew"
|
||||
type="button"
|
||||
disabled={false}
|
||||
onClick={addNew}
|
||||
|
||||
Reference in New Issue
Block a user