Skip to content

Commit

Permalink
feat(next/antd): change ArrayBase.Addition disabled UI (#2251)
Browse files Browse the repository at this point in the history
  • Loading branch information
ifblooms authored Sep 28, 2021
1 parent 731ddc0 commit bfd832a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion packages/antd/src/array-base/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,17 @@ ArrayBase.Addition = (props) => {
const array = useArray()
const prefixCls = usePrefixCls('formily-array-base')
if (!array) return null
if (array.field?.pattern !== 'editable') return null
if (
array.field?.pattern !== 'editable' &&
array.field?.pattern !== 'disabled'
)
return null
return (
<Button
type="dashed"
block
{...props}
disabled={array.field?.disabled}
className={cls(`${prefixCls}-addition`, props.className)}
onClick={(e) => {
if (array.props?.disabled) return
Expand Down
7 changes: 6 additions & 1 deletion packages/next/src/array-base/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,15 @@ ArrayBase.Addition = (props) => {
const array = useArray()
const prefixCls = usePrefixCls('formily-array-base')
if (!array) return null
if (array.field?.pattern !== 'editable') return null
if (
array.field?.pattern !== 'editable' &&
array.field?.pattern !== 'disabled'
)
return null
return (
<Button
{...props}
disabled={array.field?.disabled}
className={cls(`${prefixCls}-addition`, props.className)}
style={{ display: 'block', width: '100%', ...props.style }}
onClick={(e) => {
Expand Down

0 comments on commit bfd832a

Please sign in to comment.