Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expand prop showLeafIcon for showLine in Tree Component #25067

Merged
merged 9 commits into from
Jun 28, 2020
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37001,7 +37001,7 @@ exports[`ConfigProvider components TreeSelect configProvider 1`] = `
style="display:flex;flex-direction:column"
>
<div
class="config-select-tree-treenode config-select-tree-treenode-switcher-close config-select-tree-treenode-leaf-last"
class="config-select-tree-treenode config-select-tree-treenode-switcher-close"
>
<span
class="config-select-tree-switcher config-select-tree-switcher-noop"
Expand Down Expand Up @@ -37114,7 +37114,7 @@ exports[`ConfigProvider components TreeSelect configProvider componentSize large
style="display:flex;flex-direction:column"
>
<div
class="config-select-tree-treenode config-select-tree-treenode-switcher-close config-select-tree-treenode-leaf-last"
class="config-select-tree-treenode config-select-tree-treenode-switcher-close"
>
<span
class="config-select-tree-switcher config-select-tree-switcher-noop"
Expand Down Expand Up @@ -37227,7 +37227,7 @@ exports[`ConfigProvider components TreeSelect configProvider componentSize middl
style="display:flex;flex-direction:column"
>
<div
class="config-select-tree-treenode config-select-tree-treenode-switcher-close config-select-tree-treenode-leaf-last"
class="config-select-tree-treenode config-select-tree-treenode-switcher-close"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不应该删这个。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该是跑snapshot更新的,是我这条分支上的rc-tree-select 没有更新到对应到版本。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已经更新了~

>
<span
class="config-select-tree-switcher config-select-tree-switcher-noop"
Expand Down Expand Up @@ -37340,7 +37340,7 @@ exports[`ConfigProvider components TreeSelect configProvider virtual and dropdow
style="display:flex;flex-direction:column"
>
<div
class="ant-select-tree-treenode ant-select-tree-treenode-switcher-close ant-select-tree-treenode-leaf-last"
class="ant-select-tree-treenode ant-select-tree-treenode-switcher-close"
>
<span
class="ant-select-tree-switcher ant-select-tree-switcher-noop"
Expand Down Expand Up @@ -37453,7 +37453,7 @@ exports[`ConfigProvider components TreeSelect normal 1`] = `
style="display:flex;flex-direction:column"
>
<div
class="ant-select-tree-treenode ant-select-tree-treenode-switcher-close ant-select-tree-treenode-leaf-last"
class="ant-select-tree-treenode ant-select-tree-treenode-switcher-close"
>
<span
class="ant-select-tree-switcher ant-select-tree-switcher-noop"
Expand Down Expand Up @@ -37566,7 +37566,7 @@ exports[`ConfigProvider components TreeSelect prefixCls 1`] = `
style="display:flex;flex-direction:column"
>
<div
class="prefix-TreeSelect-tree-treenode prefix-TreeSelect-tree-treenode-switcher-close prefix-TreeSelect-tree-treenode-leaf-last"
class="prefix-TreeSelect-tree-treenode prefix-TreeSelect-tree-treenode-switcher-close"
>
<span
class="prefix-TreeSelect-tree-switcher prefix-TreeSelect-tree-switcher-noop"
Expand Down
51 changes: 30 additions & 21 deletions components/tabs/__tests__/__snapshots__/demo.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -405,33 +405,42 @@ exports[`renders ./components/tabs/demo/centered.md correctly 1`] = `
class="ant-tabs-nav-list"
style="transform:translate(0px, 0px)"
>
<button
aria-selected="true"
<div
class="ant-tabs-tab ant-tabs-tab-active"
role="tab"
tabindex="0"
type="button"
>
Tab 1
</button>
<button
aria-selected="false"
<div
aria-selected="true"
class="ant-tabs-tab-btn"
role="tab"
tabindex="0"
>
Tab 1
</div>
</div>
<div
class="ant-tabs-tab"
role="tab"
tabindex="0"
type="button"
>
Tab 2
</button>
<button
aria-selected="false"
<div
aria-selected="false"
class="ant-tabs-tab-btn"
role="tab"
tabindex="0"
>
Tab 2
</div>
</div>
<div
class="ant-tabs-tab"
role="tab"
tabindex="0"
type="button"
>
Tab 3
</button>
<div
aria-selected="false"
class="ant-tabs-tab-btn"
role="tab"
tabindex="0"
>
Tab 3
</div>
</div>
<div
class="ant-tabs-ink-bar ant-tabs-ink-bar-animated"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ exports[`TreeSelect TreeSelect Custom Icons should \`treeIcon\` work 1`] = `
style="display: flex; flex-direction: column;"
>
<div
class="ant-select-tree-treenode ant-select-tree-treenode-switcher-close ant-select-tree-treenode-leaf-last"
class="ant-select-tree-treenode ant-select-tree-treenode-switcher-close"
>
<span
class="ant-select-tree-switcher ant-select-tree-switcher-noop"
Expand Down
10 changes: 7 additions & 3 deletions components/tree/Tree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ export interface AntTreeNodeDropEvent {
// [Legacy] Compatible for v3
export type TreeNodeNormal = DataNode;

export interface TreeProps extends Omit<RcTreeProps, 'prefixCls'> {
showLine?: boolean;
export interface TreeProps extends Omit<RcTreeProps, 'prefixCls' | 'showLine'> {
showLine?: boolean | { showLeafIcon: boolean };
className?: string;
/** 是否支持多选 */
multiple?: boolean;
Expand Down Expand Up @@ -153,13 +153,17 @@ const Tree = React.forwardRef<RcTree, TreeProps>((props, ref) => {
children,
checkable,
} = props;
const newProps = {
...props,
showLine: Boolean(showLine),
};
const prefixCls = getPrefixCls('tree', customizePrefixCls);
return (
<RcTree
itemHeight={20}
ref={ref}
virtual={virtual}
{...props}
{...newProps}
prefixCls={prefixCls}
className={classNames(className, {
[`${prefixCls}-icon-hide`]: !showIcon,
Expand Down
16 changes: 16 additions & 0 deletions components/tree/__tests__/__snapshots__/demo.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1804,6 +1804,22 @@ exports[`renders ./components/tree/demo/line.md correctly 1`] = `
class="ant-switch-inner"
/>
</button>
<br />
<br />
showLeafIcon:
<button
aria-checked="true"
class="ant-switch ant-switch-checked"
role="switch"
type="button"
>
<div
class="ant-switch-handle"
/>
<span
class="ant-switch-inner"
/>
</button>
</div>
<div
class="ant-tree ant-tree-icon-hide ant-tree-show-line"
Expand Down