ant-design/components/tree/demo/directory-debug.tsx
EmilyyyLiu 2a21f7ba88
Some checks are pending
Publish Any Commit / build (push) Waiting to run
🔀 Sync mirror to Gitee / mirror (push) Waiting to run
✅ test / lint (push) Waiting to run
✅ test / test-react-legacy (16, 1/2) (push) Waiting to run
✅ test / test-react-legacy (16, 2/2) (push) Waiting to run
✅ test / test-react-legacy (17, 1/2) (push) Waiting to run
✅ test / test-react-legacy (17, 2/2) (push) Waiting to run
✅ test / test-node (push) Waiting to run
✅ test / test-react-latest (dom, 1/2) (push) Waiting to run
✅ test / test-react-latest (dom, 2/2) (push) Waiting to run
✅ test / test-react-latest-dist (dist, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist, 2/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 2/2) (push) Blocked by required conditions
✅ test / test-coverage (push) Blocked by required conditions
✅ test / build (push) Waiting to run
✅ test / test lib/es module (es, 1/2) (push) Waiting to run
✅ test / test lib/es module (es, 2/2) (push) Waiting to run
✅ test / test lib/es module (lib, 1/2) (push) Waiting to run
✅ test / test lib/es module (lib, 2/2) (push) Waiting to run
👁️ Visual Regression Persist Start / test image (push) Waiting to run
feat:[Tree] selected background color is gray when the node is disabled (#52173)
* feat:[Tree]对不可check的文本,select时候背景色改为灰色

* feat:[Tree] 修改disabled 选中的文本背景颜色

* feat: 对整行disable 的文本调整select背景色

* fix:恢复误改内容

* feat:删除不需要的多增加的注释内容

* feat:合并css选择器

* feat:更新 Tree snapshot

* feat:删除不需要的提交

---------

Co-authored-by: 刘欢 <lh01217311@antgroup.com>
Co-authored-by: afc163 <afc163@gmail.com>
2025-01-02 11:06:35 +08:00

66 lines
1.7 KiB
TypeScript

import React from 'react';
import { Flex, Tree } from 'antd';
import type { GetProps, TreeDataNode } from 'antd';
const { DirectoryTree } = Tree;
const treeData: TreeDataNode[] = [
{
title: 'parent 0',
key: '0-0',
children: [
{ title: 'leaf 0-0', key: '0-0-0', isLeaf: true, disabled: true },
{ title: 'leaf 0-1', key: '0-0-1', isLeaf: true, disableCheckbox: true },
],
},
{
title: 'parent 1',
key: '0-1',
children: [
{ title: 'leaf 1-0', key: '0-1-0', isLeaf: true },
{ title: 'leaf 1-1', key: '0-1-1', isLeaf: true },
],
},
];
const sharedProps: GetProps<typeof DirectoryTree> = {
treeData,
defaultExpandAll: true,
onSelect: (keys, info) => {
console.log('Trigger Select', keys, info);
},
onExpand: (keys, info) => {
console.log('Trigger Expand', keys, info);
},
};
const DemoOne = () => <DirectoryTree draggable defaultSelectedKeys={['0-0-0']} />;
const DemoTwo = () => <DirectoryTree {...sharedProps} checkable defaultSelectedKeys={['0-1-0']} />;
const DemoThree = () => (
<DirectoryTree {...sharedProps} draggable checkable defaultSelectedKeys={['0-1']} />
);
const BasicDemo = () => <DirectoryTree {...sharedProps} multiple treeData={treeData} />;
const NormalDemo = () => <Tree {...sharedProps} defaultSelectedKeys={['0-1']} />;
const NormalCheckDemo = () => <Tree {...sharedProps} checkable defaultSelectedKeys={['0-1','0-0-0', '0-0-1','0-1-1']} />;
const NormalDragDemo = () => <Tree {...sharedProps} draggable defaultSelectedKeys={['0-1-0']} />;
const App = () => (
<Flex wrap gap="large">
<DemoOne />
<DemoTwo />
<DemoThree />
<BasicDemo />
<NormalDemo />
<NormalCheckDemo />
<NormalDragDemo />
</Flex>
);
export default App;