only add isDisabled when needed otherwise (#289)
as before it would override an existing isDisabled
This commit is contained in:
parent
853fd2c220
commit
be2268df2f
2 changed files with 5 additions and 7 deletions
|
@ -99,19 +99,18 @@ export const FormAccess = ({
|
||||||
return child;
|
return child;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isDisabled = !hasAccess(role) && !fineGrainedAccess;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{!unWrap && (
|
{!unWrap && (
|
||||||
<Form {...rest}>
|
<Form {...rest}>
|
||||||
{recursiveCloneChildren(children, {
|
{recursiveCloneChildren(children, isDisabled ? { isDisabled } : {})}
|
||||||
isDisabled: !hasAccess(role) && !fineGrainedAccess,
|
|
||||||
})}
|
|
||||||
</Form>
|
</Form>
|
||||||
)}
|
)}
|
||||||
{unWrap &&
|
{unWrap &&
|
||||||
recursiveCloneChildren(children, {
|
recursiveCloneChildren(children, isDisabled ? { isDisabled } : {})}
|
||||||
isDisabled: !hasAccess(role) && !fineGrainedAccess,
|
|
||||||
})}
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,7 +41,6 @@ exports[`<FormAccess /> render normal form 1`] = `
|
||||||
>
|
>
|
||||||
<TextInput
|
<TextInput
|
||||||
id="field"
|
id="field"
|
||||||
isDisabled={false}
|
|
||||||
key=".0"
|
key=".0"
|
||||||
name="fieldName"
|
name="fieldName"
|
||||||
type="text"
|
type="text"
|
||||||
|
|
Loading…
Reference in a new issue