mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 02:59:58 +08:00
feat(Tree): disable Tree when Form is disabled
This commit is contained in:
parent
b34259ca1c
commit
881b056c87
@ -6,6 +6,7 @@ import type { CSSMotionProps } from 'rc-motion';
|
||||
import type { BasicDataNode, TreeProps as RcTreeProps } from 'rc-tree';
|
||||
import RcTree from 'rc-tree';
|
||||
import type { DataNode, Key } from 'rc-tree/lib/interface';
|
||||
import DisabledContext from '../config-provider/DisabledContext';
|
||||
|
||||
import initCollapseMotion from '../_util/motion';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
@ -172,11 +173,16 @@ const Tree = React.forwardRef<RcTree, TreeProps>((props, ref) => {
|
||||
draggable,
|
||||
motion: customMotion,
|
||||
style,
|
||||
disabled: customDisabled,
|
||||
} = props;
|
||||
|
||||
const prefixCls = getPrefixCls('tree', customizePrefixCls);
|
||||
const rootPrefixCls = getPrefixCls();
|
||||
|
||||
// ===================== Disabled =====================
|
||||
const disabled = React.useContext(DisabledContext);
|
||||
const mergedDisabled = customDisabled ?? disabled;
|
||||
|
||||
const motion: CSSMotionProps = customMotion ?? {
|
||||
...initCollapseMotion(rootPrefixCls),
|
||||
motionAppear: false,
|
||||
@ -191,6 +197,7 @@ const Tree = React.forwardRef<RcTree, TreeProps>((props, ref) => {
|
||||
blockNode,
|
||||
showLine: Boolean(showLine),
|
||||
dropIndicatorRender,
|
||||
disabled: mergedDisabled,
|
||||
};
|
||||
|
||||
const [wrapSSR, hashId] = useStyle(prefixCls);
|
||||
|
Loading…
Reference in New Issue
Block a user