Skip to content

Commit

Permalink
Merge branch 'main' into find/cascader-op
Browse files Browse the repository at this point in the history
  • Loading branch information
pointhalo authored Jan 9, 2024
2 parents 59a6fb6 + 8d53f13 commit 3392772
Show file tree
Hide file tree
Showing 77 changed files with 1,975 additions and 936 deletions.
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Semi 团队会维护两个常驻分支:`main` 和 `release`,根据我们的[
Semi Design 团队会认真对待每一个 Pull Request。我们会 review 并合并你的代码。也有可能对你的代码提出一些修改意见。

要提交一个 Pull Request,请遵循以下步骤:
- Node.js > v16
- Fork 项目并克隆下来
```bash
git clone https://github.com/<your-username>/semi-design.git
Expand All @@ -26,7 +27,8 @@ git checkout -b <TOPIC_BRANCH_NAME>
```
>安装环境前确保本地有 `lerna``yarn` 的依赖,如果没有则运行:
```bash
npm install --global lerna yarn
corepack enable
npm install --global lerna
```
- 完成项目依赖安装
```bash
Expand Down
1 change: 1 addition & 0 deletions content/input/treeselect/index-en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -1450,6 +1450,7 @@ function Demo() {
| searchPosition | Set the position of the search box, one of: `dropdown``trigger` | string | `dropdown` | 1.29.0 |
| showClear | When the value is not empty, whether the trigger displays the clear button | boolean | false | |
| showFilteredOnly | Toggle whether to displayed filtered result only in search mode | boolean | false | 0.32.0 |
| showLine | The option in the options panel shows connecting lines | boolean | false | 2.50.0 |
| showRestTagsPopover | When the number of tags exceeds maxTagCount and hover reaches +N, whether to display the remaining content through Popover | boolean | false | 2.22.0 |
| showSearchClear | Toggle whether to support clear search box | boolean | true | 0.35.0 |
| size | Size for input box,one of `large``small``default` | string | `default` | - |
Expand Down
1 change: 1 addition & 0 deletions content/input/treeselect/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1431,6 +1431,7 @@ function Demo() {
| searchPosition | 设置搜索框的位置,可选: `dropdown``trigger` | string | `dropdown` | 1.29.0 |
| showClear | 当值不为空时,trigger 是否展示清除按钮 | boolean | false | |
| showFilteredOnly | 搜索状态下是否只展示过滤后的结果 | boolean | false | 0.32.0 |
| showLine | 选项面板中选项显示连接线 | boolean | false | 2.50.0 |
| showRestTagsPopover | 当超过 maxTagCount,hover 到 +N 时,是否通过 Popover 显示剩余内容 | boolean | false | 2.22.0 |
| showSearchClear | 是否显示搜索框的清除按钮 | boolean | true | 0.35.0 |
| size | 选择框大小,可选 `large``small``default` | string | `default` | - |
Expand Down
74 changes: 74 additions & 0 deletions content/navigation/tree/index-en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,79 @@ class Demo extends React.Component {
}
```

### Tree with line

Set the line between nodes through `showLine`, the default is false, supported starting from 2.50.0

```jsx live=true hideInDSM
import React, { useState, useCallback } from 'react';
import { Tree, Switch } from '@douyinfe/semi-ui';

() => {
const [show, setShow] = useState(true);
const onChange = useCallback((value) => {
setShow(value);
}, []);
const treeData = useMemo(() => {
return [
{
label: 'parent-0',
key: 'parent-0',
children: [
{
label: 'leaf-0-0',
key: 'leaf-0-0',
children: [
{
label: 'leaf-0-0-0',
key: 'leaf-0-0-0',
},
{
label: 'leaf-0-0-1',
key: 'leaf-0-0-1',
},
{
label: 'leaf-0-0-2',
key: 'leaf-0-0-2',
},
]
},
{
label: 'leaf-0-1',
key: 'leaf-0-1',
}
]
},
{
label: 'parent-1',
key: 'parent-1',
}
];
}, []);

const style = {
width: 260,
height: 420,
border: '1px solid var(--semi-color-border)'
};

return (
<>
<div style={{ display: 'flex', alignItems: 'center', columnGap: 5, marginBottom: 5 }}>
<strong>showLine </strong>
<Switch checked={show} onChange={onChange} />
</div>
<Tree
showLine={show}
defaultExpandAll
treeData={treeData}
style={style}
/>
</>
);
};
```

### Virtualized Tree
If you need to render large sets of tree structured data, you could use virtualized tree. In virtualized mode, animation / motion is disabled for better performance.

Expand Down Expand Up @@ -2232,6 +2305,7 @@ import { IconFixedStroked, IconSectionStroked, IconAbsoluteStroked, IconInnerSec
| searchStyle | Style for for search box | CSSProperties | - | - |
| showClear | Toggle whether to support clear input box | boolean | true | 0.35.0|
| showFilteredOnly | Toggle whether to displayed filtered result only in search mode | boolean | false | 0.32.0 |
| showLine | show line between tree nodes | boolean | false | 2.50.0 |
| style | Inline style | CSSProperties | - | - |
| treeData | Data for treeNodes | TreeNodeData[] | \[] | - |
| treeDataSimpleJson | Data for treeNodes in JSON format, return value in JSON format as well | TreeDataSimpleJson | \{} | - |
Expand Down
74 changes: 74 additions & 0 deletions content/navigation/tree/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,79 @@ class Demo extends React.Component {
}
```

### 连接线

通过 `showLine` 设置节点之间的连接线,默认为 false,从 2.50.0 开始支持

```jsx live=true hideInDSM
import React, { useState, useCallback } from 'react';
import { Tree, Switch } from '@douyinfe/semi-ui';

() => {
const [show, setShow] = useState(true);
const onChange = useCallback((value) => {
setShow(value);
}, []);
const treeData = useMemo(() => {
return [
{
label: 'parent-0',
key: 'parent-0',
children: [
{
label: 'leaf-0-0',
key: 'leaf-0-0',
children: [
{
label: 'leaf-0-0-0',
key: 'leaf-0-0-0',
},
{
label: 'leaf-0-0-1',
key: 'leaf-0-0-1',
},
{
label: 'leaf-0-0-2',
key: 'leaf-0-0-2',
},
]
},
{
label: 'leaf-0-1',
key: 'leaf-0-1',
}
]
},
{
label: 'parent-1',
key: 'parent-1',
}
];
}, []);

const style = {
width: 260,
height: 420,
border: '1px solid var(--semi-color-border)'
};

return (
<>
<div style={{ display: 'flex', alignItems: 'center', columnGap: 5, marginBottom: 5 }}>
<strong>showLine </strong>
<Switch checked={show} onChange={onChange} />
</div>
<Tree
showLine={show}
defaultExpandAll
treeData={treeData}
style={style}
/>
</>
);
};
```

### 虚拟化
列表虚拟化,用于大量树节点的情况。开启后,动画效果将被关闭。

Expand Down Expand Up @@ -2247,6 +2320,7 @@ import { IconFixedStroked, IconSectionStroked, IconAbsoluteStroked, IconInnerSec
| searchStyle | 搜索框的样式 | CSSProperties | - | - |
| showClear | 支持清除搜索框 | boolean | true | 0.35.0 |
| showFilteredOnly | 搜索状态下是否只展示过滤后的结果 | boolean | false | 0.32.0 |
| showLine | 显示连接线 | boolean | false | 2.50.0 |
| style | 样式 | CSSProperties | - | - |
| treeData | treeNodes 数据,如果设置则不需要手动构造 TreeNode 节点(key值在整个树范围内唯一) | TreeNodeData[] | \[] | - |
| treeDataSimpleJson | 简单 JSON 形式的 `TreeNodeData` 数据,如果设置则不需要手动构造 TreeNode 节点,返回值为包含选中节点的Json数据 | TreeDataSimpleJson | \{} | - |
Expand Down
53 changes: 31 additions & 22 deletions content/show/popover/index-en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,27 +474,36 @@ import { Popover, Tag } from '@douyinfe/semi-ui';

function Demo() {
return (
<Popover
content={
<article style={{ padding: 4 }}>
Hi ByteDancer, this is a popover.
<br /> We have 2 lines.
</article>
}
trigger="custom"
position='right'
visible
showArrow
style={{
backgroundColor: 'rgba(var(--semi-blue-4),1)',
borderColor: 'rgba(var(--semi-blue-4),1)',
color: 'var(--semi-color-white)',
borderWidth: 1,
borderStyle: 'solid',
}}
>
<Tag>Click here</Tag>
</Popover>
<div id='popup-parent' style={{ position: 'relative' }}>
<Popover
content={
<article style={{ padding: 4 }}>
Hi, Semi UI Popover.
</article>
}
getPopupContainer={() => document.querySelector('#popup-parent')}
trigger='custom'
visible
position='right'
showArrow
style={{
backgroundColor: 'rgba(var(--semi-blue-4),1)',
borderColor: 'rgba(var(--semi-blue-4),1)',
color: 'var(--semi-color-white)',
borderWidth: 1,
borderStyle: 'solid',
}}
>
<Tag
style={{
backgroundColor: 'rgba(var(--semi-blue-4),1)',
color: 'var(--semi-color-white)'
}}
>
Colorful Popover
</Tag>
</Popover>
</div>
);
}
```
Expand Down Expand Up @@ -549,7 +558,7 @@ Please refer to [Use with Tooltip/Popconfirm](/en-US/show/tooltip#%E6%90%AD%E9%8
| returnFocusOnClose | After pressing the Esc key, whether the focus returns to the trigger, it only takes effect when the trigger is set to hover, focus, click, etc | boolean | true | **2.8.0** |
| visible | Display popup or not | boolean | |
| position | Directions, optional values: `top`, `topLeft`, `topRight`, `left`, `leftTop`, `leftBottom`, `right`, `rightTop`, `rightBottom`, `bottom`, `bottomLeft`, `bottomRight` | string | "bottom" |
| spacing | The distance between the out layer and the children element, in px | number| <ApiType detail='{ x: number; y: number }'>SpacingObject</ApiType> | 4(while showArrow=false) 10(while showArrow=true) | |
| spacing | The distance between the out layer and the children element, in px. object type props supported after v2.45 | number| <ApiType detail='{ x: number; y: number }'>SpacingObject</ApiType> | 4(while showArrow=false) 10(while showArrow=true) | |
| showArrow | Display little arrow or not | boolean | |
| trigger | Trigger mode, optional value: `hover`, `focus`, `click`, `custom` | string | 'hover' |
| stopPropagation | Whether to prevent click events on the bomb layer from bubbling | boolean | false | **0.34.0** |
Expand Down
50 changes: 27 additions & 23 deletions content/show/popover/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -457,34 +457,38 @@ import { Popover, Tag } from '@douyinfe/semi-ui';

function Demo() {
return (
<Popover
content={
<article style={{ padding: 4 }}>
Hi ByteDancer, this is a popover.
</article>
}
position='right'
showArrow
style={{
backgroundColor: 'rgba(var(--semi-blue-4),1)',
borderColor: 'rgba(var(--semi-blue-4),1)',
color: 'var(--semi-color-white)',
borderWidth: 1,
borderStyle: 'solid',
}}
>
<Tag
<div id='popup-parent' style={{ position: 'relative' }}>
<Popover
content={
<article style={{ padding: 4 }}>
Hi, Semi UI Popover.
</article>
}
getPopupContainer={() => document.querySelector('#popup-parent')}
trigger='custom'
visible
position='right'
showArrow
style={{
backgroundColor: 'rgba(var(--semi-blue-4),1)',
color: 'var(--semi-color-white)'
borderColor: 'rgba(var(--semi-blue-4),1)',
color: 'var(--semi-color-white)',
borderWidth: 1,
borderStyle: 'solid',
}}
>
点击此处
</Tag>
</Popover>
<Tag
style={{
backgroundColor: 'rgba(var(--semi-blue-4),1)',
color: 'var(--semi-color-white)'
}}
>
Colorful Popover
</Tag>
</Popover>
</div>
);
}

```

### 初始化弹出层焦点位置
Expand Down Expand Up @@ -539,7 +543,7 @@ import { Button, Input, Popover, Space } from '@douyinfe/semi-ui';
| rePosKey | 可以更新该项值手动触发弹出层的重新定位 | string\|number | | |
| returnFocusOnClose | 按下 Esc 键后,焦点是否回到 trigger 上,设置 trigger 为 hover, focus, click 时生效 | boolean | true | **2.8.0** |
| position | 方向,可选值:`top`,`topLeft`,`topRight`,`left`,`leftTop`,`leftBottom`,`right`,`rightTop`,`rightBottom`,`bottom`,`bottomLeft`,`bottomRight` | string | "bottom" | |
| spacing | 弹出层与 children 元素的距离,单位 px | number| <ApiType detail='{ x: number; y: number }'>SpacingObject</ApiType> | 4(showArrow=false 时) 10(showArrow=true 时) | |
| spacing | 弹出层与 children 元素的距离,单位 px(object类型自 v2.45后支持) | number| <ApiType detail='{ x: number; y: number }'>SpacingObject</ApiType> | 4(showArrow=false 时) 10(showArrow=true 时) | |
| showArrow | 是否显示“小三角” | boolean | | |
| stopPropagation | 是否阻止弹出层上的点击事件冒泡 | boolean | false | **0.34.0** |
| trigger | 触发方式,可选值:`hover`, `focus`, `click`, `custom`, `contextMenu`(v2.42支持) | string | 'hover' | |
Expand Down
1 change: 1 addition & 0 deletions content/show/table/index-en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -5147,6 +5147,7 @@ import { Table } from '@douyinfe/semi-ui';
| sortChildrenRecord | Whether to sort child data locally | boolean | | **0.29.0** |
| sortOrder | The controlled property of the sorting, the sorting of this control column can be set to 'ascend'\|'descended '\|false | boolean | false |
| sorter | Sorting function, local sorting uses a function (refer to the compareFunction of Array.sort), requiring a server-side sorting can be set to true | boolean\|(r1: RecordType, r2: RecordType, sortOrder: 'ascend' \| 'descend') => number | true |
| sortIcon |Customize the sort icon. The returned node controls the entire sort button, including ascending and descending buttons. Need to control highlighting behavior based on sortOrder | (props: { sortOrder }) => ReactNode | | **2.50.0** |
| title | Column header displays text. When a function is passed in, title will use the return value of the function; when other types are passed in, they will be aggregated with sorter and filter. It needs to be used with useFullRender to obtain parameters such as filter in the function type | string \| ReactNode\|({ filter: ReactNode, sorter: ReactNode, selection: ReactNode }) => ReactNode. | | Function type requires **0.34.0** |
| useFullRender | Whether to completely customize the rendering, see [Full Custom Rendering](#Fully-custom-rendering) for usage details, enabling this feature will cause a certain performance loss | boolean | false | **0.34.0** |
| width | Column width | string \| number | |
Expand Down
Loading

0 comments on commit 3392772

Please sign in to comment.