diff --git a/docs/demo/custom-indent-width.md b/docs/demo/custom-indent-width.md deleted file mode 100644 index 6f47a8e4..00000000 --- a/docs/demo/custom-indent-width.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: Custom Indent Width -nav: - title: Demo - path: /demo ---- - - diff --git a/docs/examples/custom-indent-width.jsx b/docs/examples/custom-indent-width.jsx deleted file mode 100644 index dd31a5cd..00000000 --- a/docs/examples/custom-indent-width.jsx +++ /dev/null @@ -1,70 +0,0 @@ -/* eslint-disable no-alert, no-console, react/no-find-dom-node */ -import React from 'react'; -import '../../assets/index.less'; -import './basic.less'; -import Tree from 'rc-tree'; - -const treeData = [ - { - key: '0-0', - title: 'parent 1', - children: [ - { key: '0-0-0', title: 'parent 1-1', children: [{ key: '0-0-0-0', title: 'parent 1-1-0' }] }, - { - key: '0-0-1', - title: 'parent 1-2', - children: [ - { key: '0-0-1-0', title: 'parent 1-2-0', disableCheckbox: true }, - { key: '0-0-1-1', title: 'parent 1-2-1' }, - { key: '0-0-1-2', title: 'parent 1-2-2' }, - { key: '0-0-1-3', title: 'parent 1-2-3' }, - { key: '0-0-1-4', title: 'parent 1-2-4' }, - { key: '0-0-1-5', title: 'parent 1-2-5' }, - { key: '0-0-1-6', title: 'parent 1-2-6' }, - { key: '0-0-1-7', title: 'parent 1-2-7' }, - { key: '0-0-1-8', title: 'parent 1-2-8' }, - { key: '0-0-1-9', title: 'parent 1-2-9' }, - { key: 1128, title: 1128 }, - ], - }, - ], - }, -]; - -const Demo = ()=> { - return ( -
-

default width

- - -

indent width 8

- -

indent width 20

- - -

indent width 40

- -
- ); -} - -export default Demo; diff --git a/src/Indent.tsx b/src/Indent.tsx index 80534689..41aac59d 100644 --- a/src/Indent.tsx +++ b/src/Indent.tsx @@ -1,19 +1,14 @@ -import * as React from 'react'; import classNames from 'classnames'; +import * as React from 'react'; interface IndentProps { prefixCls: string; level: number; isStart: boolean[]; isEnd: boolean[]; - width?: number } -const Indent: React.FC = ({ prefixCls, level, isStart, isEnd, width }) => { - const widthStyle: React.CSSProperties = width >= 0 ? { - width: width - } : {} - +const Indent: React.FC = ({ prefixCls, level, isStart, isEnd }) => { const baseClassName = `${prefixCls}-indent-unit`; const list: React.ReactElement[] = []; for (let i = 0; i < level; i += 1) { @@ -24,7 +19,6 @@ const Indent: React.FC = ({ prefixCls, level, isStart, isEnd, width [`${baseClassName}-start`]: isStart[i], [`${baseClassName}-end`]: isEnd[i], })} - style={widthStyle} />, ); } diff --git a/src/NodeList.tsx b/src/NodeList.tsx index 3712e84c..65bb9391 100644 --- a/src/NodeList.tsx +++ b/src/NodeList.tsx @@ -75,7 +75,6 @@ interface NodeListProps { checkable?: boolean; selectable?: boolean; disabled?: boolean; - indentWidth?: number; expandedKeys: Key[]; selectedKeys: Key[]; @@ -150,7 +149,6 @@ const NodeList = React.forwardRef>((props, ref) halfCheckedKeys, keyEntities, disabled, - indentWidth, dragging, dragOverNodeKey, @@ -364,7 +362,6 @@ const NodeList = React.forwardRef>((props, ref) isStart={isStart} isEnd={isEnd} motion={motion} - indentWidth={indentWidth} motionNodes={key === MOTION_KEY ? transitionRange : null} motionType={motionType} onMotionStart={onListChangeStart} diff --git a/src/Tree.tsx b/src/Tree.tsx index 4cd0fb82..690566e9 100644 --- a/src/Tree.tsx +++ b/src/Tree.tsx @@ -95,7 +95,6 @@ export interface TreeProps { showLine?: boolean; showIcon?: boolean; icon?: IconType; - indentWidth?: number; selectable?: boolean; expandAction?: ExpandAction; disabled?: boolean; @@ -1373,7 +1372,6 @@ class Tree extends Rea selectable, showIcon, icon, - indentWidth, switcherIcon, draggable, checkable, @@ -1432,7 +1430,6 @@ class Tree extends Rea dropPosition, dragOverNodeKey, indent, - indentWidth, direction, dropIndicatorRender, @@ -1475,7 +1472,6 @@ class Tree extends Rea disabled={disabled} selectable={selectable} checkable={!!checkable} - indentWidth={indentWidth} motion={motion} dragging={draggingNodeKey !== null} height={height} diff --git a/src/TreeNode.tsx b/src/TreeNode.tsx index db9c68b8..3a51f2cb 100644 --- a/src/TreeNode.tsx +++ b/src/TreeNode.tsx @@ -519,7 +519,6 @@ class InternalTreeNode extends React.Component {this.renderDragHandler()} {this.renderSwitcher()} diff --git a/src/contextTypes.ts b/src/contextTypes.ts index d9e4db22..2132ff26 100644 --- a/src/contextTypes.ts +++ b/src/contextTypes.ts @@ -57,7 +57,6 @@ export interface TreeContextProps dropTargetKey: Key | null; dropPosition: -1 | 0 | 1 | null; indent: number | null; - indentWidth?: number; dropIndicatorRender: (props: { dropPosition: -1 | 0 | 1; dropLevelOffset: number; diff --git a/src/interface.tsx b/src/interface.tsx index 1ceef23c..6c5e5ef4 100644 --- a/src/interface.tsx +++ b/src/interface.tsx @@ -27,7 +27,6 @@ export interface TreeNodeProps { isEnd?: boolean[]; active?: boolean; onMouseMove?: React.MouseEventHandler; - indentWidth?: number // By user isLeaf?: boolean; diff --git a/tests/TreeProps.spec.tsx b/tests/TreeProps.spec.tsx index 3a00bb1e..d6b1038f 100644 --- a/tests/TreeProps.spec.tsx +++ b/tests/TreeProps.spec.tsx @@ -657,7 +657,7 @@ describe('Tree Props', () => { // https://github.com/ant-design/ant-design/issues/48796 it('skip load if has children', () => { - const loadData = jest.fn(async (info) => { + const loadData = jest.fn(async info => { console.log('->', info.key); }); @@ -722,20 +722,6 @@ describe('Tree Props', () => { ); }); - it('indentWidth', () => { - const { container } = render( - - - - - , - ); - - expect(getComputedStyle(container.querySelector('.rc-tree-indent-unit-start')).width).toBe( - '200px', - ); - }); - it('onDoubleClick', () => { const onClick = jest.fn(); const onDoubleClick = jest.fn();