Skip to content

Commit

Permalink
feat(next/antd): support disabled props from field in ArrayBase.Addit…
Browse files Browse the repository at this point in the history
…ion (#2746)
  • Loading branch information
ifblooms committed Jan 11, 2022
1 parent 129cd69 commit 29624ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/antd/src/array-base/index.tsx
Expand Up @@ -11,7 +11,7 @@ import { AntdIconProps } from '@ant-design/icons/lib/components/AntdIcon'
import { ButtonProps } from 'antd/lib/button'
import { ArrayField } from '@formily/core'
import { useField, useFieldSchema, Schema, JSXComponent } from '@formily/react'
import { isValid, clone } from '@formily/shared'
import { isValid, clone, isBool } from '@formily/shared'
import { SortableHandle } from 'react-sortable-hoc'
import { usePrefixCls } from '../__builtins__'
import cls from 'classnames'
Expand Down Expand Up @@ -148,7 +148,7 @@ ArrayBase.Addition = (props) => {
type="dashed"
block
{...props}
disabled={array.field?.disabled}
disabled={isBool(self?.disabled) ? self?.disabled : array.field?.disabled}
className={cls(`${prefixCls}-addition`, props.className)}
onClick={(e) => {
if (array.props?.disabled) return
Expand Down
4 changes: 2 additions & 2 deletions packages/next/src/array-base/index.tsx
@@ -1,6 +1,6 @@
import React, { createContext, useContext } from 'react'
import { Button } from '@alifd/next'
import { isValid, clone } from '@formily/shared'
import { isValid, clone, isBool } from '@formily/shared'
import { ButtonProps } from '@alifd/next/lib/button'
import { ArrayField } from '@formily/core'
import { useField, useFieldSchema, Schema, JSXComponent } from '@formily/react'
Expand Down Expand Up @@ -146,7 +146,7 @@ ArrayBase.Addition = (props) => {
return (
<Button
{...props}
disabled={array.field?.disabled}
disabled={isBool(self?.disabled) ? self?.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 29624ca

Please sign in to comment.