Skip to content

Commit

Permalink
feat: add Tree component
Browse files Browse the repository at this point in the history
  • Loading branch information
Jandiasnow committed Jan 2, 2024
1 parent 3ebd072 commit 614e778
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 7 deletions.
10 changes: 4 additions & 6 deletions .dumirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const themeConfig = {
};

export default defineConfig({
apiParser: isProduction ? {} : false,
apiParser: {},
base: '/',
define: {
'process.env': process.env,
Expand All @@ -97,11 +97,9 @@ export default defineConfig({
mfsu: isWin ? undefined : {},
npmClient: 'pnpm',
publicPath: '/',
resolve: isProduction
? {
entryFile: './src/index.ts',
}
: undefined,
resolve: {
entryFile: './src/index.ts',
},
styles: [
`html, body { background: transparent; }
Expand Down
59 changes: 59 additions & 0 deletions src/Tree/demos/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { StoryBook, useControls, useCreateStore } from '@lobehub/ui';
import { Tree, TreeDataNode, TreeProps } from '@yuntijs/ui';

const treeData: TreeDataNode[] = [
{
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' }],
},
],
},
];

export default () => {
const store = useCreateStore();
const control: TreeProps | any = useControls(
{
showLine: false,
multiple: false,
checkable: false,
disabled: false,
selectable: true,
blockNode: false,
draggable: false,
checkStrictly: false,
autoExpandParent: false,
defaultExpandAll: true,
defaultExpandParent: true,
showIcon: false,
icon: 'icon ',
},
{ store }
);
return (
<StoryBook levaStore={store}>
<Tree {...control} treeData={treeData}></Tree>
</StoryBook>
);
};
16 changes: 16 additions & 0 deletions src/Tree/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
nav: Components
group: 数据展示
title: Tree
description: The Tree component is a list of multi-level structures.
---

## [Antd Document](https://ant.design/components/tree-cn/)

## Default

<code src="./demos/index.tsx" nopadding></code>

## APIs

<API></API>
1 change: 1 addition & 0 deletions src/Tree/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Tree, TreeDataNode, TreeProps } from 'antd';
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from 'antd';
export * from './Tree';

0 comments on commit 614e778

Please sign in to comment.