forked from ant-design/ant-design
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
286 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { extendTest } from '../../../tests/shared/demoTest'; | ||
|
||
extendTest('tree-select'); | ||
extendTest('tree-select', { skip: ['component-token.tsx'] }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## zh-CN | ||
|
||
组件 Token | ||
|
||
## en-US | ||
|
||
Component Token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import React, { useState } from 'react'; | ||
import { ConfigProvider, TreeSelect } from 'antd'; | ||
|
||
const treeData = [ | ||
{ | ||
value: 'parent 1', | ||
title: 'parent 1', | ||
children: [ | ||
{ | ||
value: 'parent 1-0', | ||
title: 'parent 1-0', | ||
children: [ | ||
{ | ||
value: 'leaf1', | ||
title: 'leaf1', | ||
}, | ||
{ | ||
value: 'leaf2', | ||
title: 'leaf2', | ||
}, | ||
], | ||
}, | ||
{ | ||
value: 'parent 1-1', | ||
title: 'parent 1-1', | ||
children: [ | ||
{ | ||
value: 'leaf3', | ||
title: <b style={{ color: '#08c' }}>leaf3</b>, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
]; | ||
const App: React.FC = () => { | ||
const [value, setValue] = useState<string>(); | ||
|
||
const onChange = (newValue: string) => { | ||
setValue(newValue); | ||
}; | ||
|
||
return ( | ||
<ConfigProvider | ||
theme={{ | ||
components: { | ||
TreeSelect: { | ||
nodeHoverBg: '#fff2f0', | ||
nodeSelectedBg: '#ffa39e', | ||
}, | ||
}, | ||
}} | ||
> | ||
<TreeSelect | ||
showSearch | ||
style={{ width: '100%' }} | ||
value={value} | ||
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} | ||
placeholder="Please select" | ||
allowClear | ||
treeDefaultExpandAll | ||
onChange={onChange} | ||
treeData={treeData} | ||
/> | ||
</ConfigProvider> | ||
); | ||
}; | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { extendTest } from '../../../tests/shared/demoTest'; | ||
|
||
extendTest('tree', { skip: ['big-data.tsx', 'virtual-scroll.tsx'] }); | ||
extendTest('tree', { skip: ['big-data.tsx', 'virtual-scroll.tsx', 'component-token.tsx'] }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import demoTest from '../../../tests/shared/demoTest'; | ||
|
||
demoTest('tree', { skip: ['big-data.tsx', 'virtual-scroll.tsx'] }); | ||
demoTest('tree', { skip: ['big-data.tsx', 'virtual-scroll.tsx', 'component-token.tsx'] }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## zh-CN | ||
|
||
组件 Token | ||
|
||
## en-US | ||
|
||
Component Token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from 'react'; | ||
import { ConfigProvider, Tree } from 'antd'; | ||
import type { DataNode, TreeProps } from 'antd/es/tree'; | ||
|
||
const treeData: DataNode[] = [ | ||
{ | ||
title: 'parent 1', | ||
key: '0-0', | ||
children: [ | ||
{ | ||
title: 'parent 1-0', | ||
key: '0-0-0', | ||
disabled: true, | ||
children: [ | ||
{ | ||
title: 'leaf', | ||
key: '0-0-0-0', | ||
disableCheckbox: true, | ||
}, | ||
{ | ||
title: 'leaf', | ||
key: '0-0-0-1', | ||
}, | ||
], | ||
}, | ||
{ | ||
title: 'parent 1-1', | ||
key: '0-0-1', | ||
children: [{ title: <span style={{ color: '#1677ff' }}>sss</span>, key: '0-0-1-0' }], | ||
}, | ||
], | ||
}, | ||
]; | ||
|
||
const App: React.FC = () => { | ||
const onSelect: TreeProps['onSelect'] = (selectedKeys, info) => { | ||
console.log('selected', selectedKeys, info); | ||
}; | ||
|
||
const onCheck: TreeProps['onCheck'] = (checkedKeys, info) => { | ||
console.log('onCheck', checkedKeys, info); | ||
}; | ||
|
||
return ( | ||
<ConfigProvider | ||
theme={{ | ||
components: { | ||
Tree: { | ||
nodeHoverBg: '#fff2f0', | ||
nodeSelectedBg: '#ffa39e', | ||
}, | ||
}, | ||
}} | ||
> | ||
<Tree | ||
checkable | ||
defaultExpandedKeys={['0-0-0', '0-0-1']} | ||
defaultSelectedKeys={['0-0-0', '0-0-1']} | ||
defaultCheckedKeys={['0-0-0', '0-0-1']} | ||
onSelect={onSelect} | ||
onCheck={onCheck} | ||
treeData={treeData} | ||
/> | ||
</ConfigProvider> | ||
); | ||
}; | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.