Skip to content

Commit

Permalink
fix(table): when checkable=false, no render all select boxs
Browse files Browse the repository at this point in the history
close #7356
  • Loading branch information
chenshuai2144 committed Jul 16, 2023
1 parent 5b746b3 commit 5421e41
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
5 changes: 3 additions & 2 deletions packages/card/src/components/StatisticCard/demos/basic.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { EllipsisOutlined, RightOutlined } from '@ant-design/icons';
import { StatisticCard } from '@ant-design/pro-components';
import { Space } from 'antd';
import { Space, theme } from 'antd';

const { Statistic } = StatisticCard;

export default () => {
const { token } = theme.useToken();
return (
<StatisticCard
title={
<Space>
<span>部门一</span>
<RightOutlined style={{ color: 'rgba(0,0,0,0.65)' }} />
<RightOutlined style={{ color: token.colorTextHeading }} />
</Space>
}
extra={<EllipsisOutlined />}
Expand Down
29 changes: 17 additions & 12 deletions packages/table/src/components/ColumnSetting/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ const CheckboxList: React.FC<{
if (!show) {
return null;
}

const listDom = (
<Tree
itemHeight={24}
Expand Down Expand Up @@ -446,18 +447,22 @@ function ColumnSetting<T>(props: ColumnSettingProps<T>) {
arrow={false}
title={
<div className={`${className}-title ${hashId}`.trim()}>
<Checkbox
indeterminate={indeterminate}
checked={
unCheckedKeys.length === 0 &&
unCheckedKeys.length !== localColumns.length
}
onChange={(e) => {
checkedAll(e);
}}
>
{intl.getMessage('tableToolBar.columnDisplay', '列展示')}
</Checkbox>
{props.checkable === false ? (
<div />
) : (
<Checkbox
indeterminate={indeterminate}
checked={
unCheckedKeys.length === 0 &&
unCheckedKeys.length !== localColumns.length
}
onChange={(e) => {
checkedAll(e);
}}
>
{intl.getMessage('tableToolBar.columnDisplay', '列展示')}
</Checkbox>
)}
{checkedReset ? (
<a
onClick={clearClick}
Expand Down
2 changes: 1 addition & 1 deletion tests/card/__snapshots__/demo.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2767,7 +2767,7 @@ exports[`card demos 📸 renders ./packages/card/src/components/StatisticCard/de
aria-label="right"
class="anticon anticon-right"
role="img"
style="color: rgba(0, 0, 0, 0.65);"
style="color: rgba(0, 0, 0, 0.88);"
>
<svg
aria-hidden="true"
Expand Down

0 comments on commit 5421e41

Please sign in to comment.