Browse Source

docs: add dropdownMargin

pointhalo 2 years ago
parent
commit
a51beb8c0e

+ 2 - 1
content/input/cascader/index.md

@@ -1519,6 +1519,7 @@ function Demo() {
 | disabled           | 是否禁用                                                                             | boolean                                                                        | false                            | -                                |
 | displayProp        | 设置回填选项显示的属性值                                                                 | string                                                                         | `label`                          | -                                |
 | displayRender      | 设置回填格式                                                                 | (selected: string[] \| Entity, idx?: number) => ReactNode                                                        | selected => selected.join(' / ') | -      |
+| dropdownMargin     | 下拉菜单计算溢出时的增加的冗余值,详见[issue#549](https://github.com/DouyinFE/semi-design/issues/549),作用同 Tooltip margin      | object\|number                           |                                   | 2.25.0
 | dropdownClassName  | 下拉菜单的 className 属性                                                            | string                                                                         | -                                | -                                |
 | dropdownStyle      | 下拉菜单的样式                                                                       | object                                                                         | -                                | -                                |
 | emptyContent       | 当搜索无结果时展示的内容                                                             | ReactNode                                                                      | `暂无数据`                       | -                                |
@@ -1535,7 +1536,7 @@ function Demo() {
 | mouseLeaveDelay | 鼠标移出后,延迟消失下拉框的时间,单位毫秒 | number | 50 | -                                |
 | multiple | 设置多选 | boolean | false | 1.28.0                           |
 | placeholder        | 选择框默认文字                                                                       | string                                                                         | -                                | -                                |
-| position           | 方向,可选值:`top`,`topLeft`,`topRight`,`left`,`leftTop`,`leftBottom`,`right`,`rightTop`,`rightBottom`,`bottom`,`bottomLeft`,`bottomRight` | string                   | "bottom"                                    | 2.16.0-beta.0                    |
+| position           | 方向,可选值:`top`,`topLeft`,`topRight`,`left`,`leftTop`,`leftBottom`,`right`,`rightTop`,`rightBottom`,`bottom`,`bottomLeft`,`bottomRight` | string                   | "bottom"                                    | 2.16.0                    |
 | prefix             | 前缀标签                                                                             | ReactNode                                                                      | -                                | 0.28.0                           |
 | preventScroll | 指示浏览器是否应滚动文档以显示新聚焦的元素,作用于组件内的 focus 方法 | boolean |  |                                  |
 |restTagsPopoverProps |Popover 的配置属性,可以控制 position、zIndex、trigger 等,具体参考[Popover](/zh-CN/show/popover#API%20%E5%8F%82%E8%80%83)           |PopoverProps   | {}        | 1.28.0                           |

+ 1 - 0
content/input/datepicker/index.md

@@ -845,6 +845,7 @@ function Demo() {
 | disabledTimePicker | 是否禁止时间选择 | boolean |  | **0.32.0** |
 | dropdownClassName | 下拉列表的 CSS 类名 | string |  | **1.13.0** |
 | dropdownStyle | 下拉列表的内联样式 | object |  | **1.13.0** |
+| dropdownMargin | 下拉列表算溢出时的增加的冗余值,详见[issue#549](https://github.com/DouyinFE/semi-design/issues/549),作用同 Tooltip margin      | object\|number  |  | **2.25.0**
 | endDateOffset | type 为 dateRange 时,设置单击选择范围的结束日期 | (selectedDate?: Date) => Date; | - | **1.10.0** |
 | format | 在输入框内展现的日期串格式 | string | 与 type 对应:详见[日期时间格式](#日期时间格式) |  |
 | getPopupContainer | 指定父级 DOM,弹层将会渲染至该 DOM 中,自定义需要设置 `position: relative` | function():HTMLElement | () => document.body |  |

+ 4 - 3
content/input/select/index.md

@@ -1312,9 +1312,9 @@ import { Select, Checkbox } from '@douyinfe/semi-ui';
 | 属性    | 说明     | 类型      | 默认值     |  版本     |
 | -------| -------- | ---------| --------- |--------- |
 | allowCreate              | 是否允许用户创建新条目,需配合 filter 使用                                                                                                                                                                | boolean                               | false                             |
-| arrowIcon            | 自定义右侧下拉箭头Icon,当showClear开关打开且当前有选中值时,hover会优先显示clear icon <br/>**v1.15.0 后提供**                                                                                                                                                                 | ReactNode     |                             |
+| arrowIcon            | 自定义右侧下拉箭头Icon,当showClear开关打开且当前有选中值时,hover会优先显示clear icon                                                                                                                                                            | ReactNode     |                             | 1.15.0
 | autoAdjustOverflow       | 浮层被遮挡时是否自动调整方向(暂时仅支持竖直方向,且插入的父级为 body)                                                                                                            | boolean                               | true                              |
-| autoClearSearchValue     | 选中选项后,是否自动清空搜索关键字,当mutilple、filter都开启时生效<br/>**v2.3.0 后提供**                                                                                          | boolean                               | true                              |
+| autoClearSearchValue     | 选中选项后,是否自动清空搜索关键字,当mutilple、filter都开启时生效                                                                                      | boolean                               | true                              | 2.3.0
 | autoFocus                | 初始渲染时是否自动 focus                                                                                                                                                                                  | boolean                               | false                             |
 | className                | 类名                                                                                                                                                                                                      | string                                |                                   |
 | clickToHide              | 已展开时,点击选择框是否自动收起下拉列表                                                                                                                                          | boolean                               | false                             |
@@ -1325,10 +1325,11 @@ import { Select, Checkbox } from '@douyinfe/semi-ui';
 | dropdownClassName        | 弹出层的 className                                                                                                                                                                                        | string                                |                                   |
 | dropdownMatchSelectWidth | 下拉菜单最小宽度是否等于 Select                                                                                                                                                                           | boolean                               | true                              |
 | dropdownStyle            | 弹出层的样式                                                                                                                                                                                              | object                                |                                   |
+| dropdownMargin           | 弹出层计算溢出时的增加的冗余值,详见[issue#549](https://github.com/DouyinFE/semi-design/issues/549),作用同 Tooltip margin                                                                                   | object\|number                           |                                   | 2.25.0
 | emptyContent             | 无结果时展示的内容。设为 null 时,下拉列表将不展示                                                                                                                                                        | string\|ReactNode                     |                                   |
 | filter                   | 是否可搜索,默认为 false。传入 true 时,代表开启搜索并采用默认过滤策略(label 是否与 sugInput 匹配),传入值为函数时,会接收 sugInput, option 两个参数,当 option 符合筛选条件应返回 true,否则返回 false | boolean \|function(sugInput, option)                    | false                             |
 | getPopupContainer        | 指定父级 DOM,弹层将会渲染至该 DOM 中,自定义需要设置 `position: relative`                                                                                                                                                                     | function():HTMLElement                | () => document.body               |
-| inputProps               | filter为true时, input输入框的额外配置参数,具体可配置属性请参考Input组件(注意:请不要传入value、ref、onChange、onFocus,否则会覆盖Select相关回调,影响组件行为) <br/>**v2.2.0 后提供**   | object   |               |
+| inputProps               | filter为true时, input输入框的额外配置参数,具体可配置属性请参考Input组件(注意:请不要传入value、ref、onChange、onFocus,否则会覆盖Select相关回调,影响组件行为)   | object   |               | 2.2.0
 | innerTopSlot             | 渲染在弹出层顶部,在 optionList 内部的自定义 slot                                                                                                                     | ReactNode                             |                                   |
 | innerBottomSlot          | 渲染在弹出层底部,在 optionList 内部的自定义 slot                                                                                                                                                         | ReactNode                             |                                   |
 | insetLabel               | 同上,与 prefix 区别是 fontWeight 更大                                                                                                                                             | ReactNode                             |                                   |

+ 1 - 0
content/input/timepicker/index.md

@@ -282,6 +282,7 @@ function Demo(props = {}) {
 | disabledHours       | 禁止选择部分小时选项                                   | Function(): number[]                                                              |                                                                   |                    |
 | disabledMinutes     | 禁止选择部分分钟选项                                   | Function(selectedHour: number): number[]                                          |                                                                   |                    |
 | disabledSeconds     | 禁止选择部分秒选项                                     | Function(selectedHour: number, selectedMinute: number): number[]                  |                                                                   |                    |
+| dropdownMargin      | 浮层算溢出时的增加的冗余值,详见[issue#549](https://github.com/DouyinFE/semi-design/issues/549),作用同 Tooltip margin      | object\|number  |  | **2.25.0**
 | focusOnOpen         | 挂载时是否打开面板并focus输入框                         | boolean                                                                            | false                                                     |                    |
 | format              | 展示的时间格式                                         | string                                                                            | "HH:mm:ss"                                                        |                    |
 | getPopupContainer   | 指定容器,浮层将会渲染至该元素内,自定义需要设置 `position: relative`                       | Function(): HTMLElement                                                           | () => document.body                                               |                    |

+ 10 - 9
content/input/treeselect/index.md

@@ -1371,20 +1371,21 @@ function Demo() {
 | defaultExpandAll | 设置在初始化时是否展开所有节点。而如果后续数据(`treeData`)发生改变,这个 api 是无法影响节点的展开情况的,如果有这个需要可以使用 `expandAll` | boolean | false | 0.32.0 |
 | defaultExpandedKeys | 默认展开的节点,显示其直接子级 | string\[] | - | 0.32.0 |
 | defaultOpen | 默认展开下拉菜单 | boolean | false | 0.32.0 |
-| defaultValue | 指定默认选中的条目 | string \| number \| TreeNode \| (string \| number \| TreeNode)[] | - | - |
+| defaultValue | 指定默认选中的条目 | <ApiType detail='string \| number \| TreeNode \| (string \| number \| TreeNode)[]'>ValueType</ApiType> | - | - |
 | disabled | 是否禁用 | boolean | false | - |
 | disableStrictly | 是否严格禁用 | boolean | false | 1.30.0 |
 | dropdownClassName | 下拉菜单的 `className` 属性 | string | - | - |
 | dropdownMatchSelectWidth | 下拉菜单最小宽度是否等于Select |    boolean        | true | - |
+| dropdownMargin | 下拉菜单计算溢出时的增加的冗余值,详见[issue#549](https://github.com/DouyinFE/semi-design/issues/549),作用同 Tooltip margin      | object\|number  |  | 2.25.0
 | dropdownStyle | 下拉菜单的样式 | CSSProperties | - | - |
 | emptyContent | 当搜索无结果时展示的内容 | ReactNode | `暂无数据` | - |
 | expandAction             | 展开逻辑,可选 false, 'click', 'doubleClick'。默认值为 false,即仅当点击展开按钮时才会展开  | boolean \| string   | false | 1.4.0      |
 | expandAll | 设置是否默认展开所有节点,若后续数据(`treeData`)发生改变,默认的展开情况也是会受到这个 api 影响的 | boolean | false | 1.30.0 |
 | expandedKeys | (受控)展开的节点,默认展开节点显示其直接子级 | string[] | - | 0.32.0 |
-| filterTreeNode | 是否根据输入项进行筛选,默认用 `treeNodeFilterProp` 的值作为要筛选的 `TreeNode` 的属性值 | boolean\|(inputValue: string, treeNodeString: string) => boolean | false | - |
+| filterTreeNode | 是否根据输入项进行筛选,默认用 `treeNodeFilterProp` 的值作为要筛选的 `TreeNode` 的属性值 | boolean\| <ApiType detail='(inputValue: string, treeNodeString: string => boolean'>Function</ApiType> | false | - |
 | getPopupContainer  | 指定父级 DOM,弹层将会渲染至该 DOM 中,自定义需要设置 `position: relative`     | function():HTMLElement | - | - |
 | insetLabel | 前缀标签别名,主要用于 Form | ReactNode | - |0.28.0 |
-| labelEllipsis | 是否开启label的超出省略,默认虚拟化状态下开启 | boolean | false\|true(virtualized) | 1.8.0 | 
+| labelEllipsis | 是否开启label的超出省略,默认虚拟化状态下开启 | boolean | false\|true | 1.8.0 | 
 | leafOnly | 多选模式下是否开启 onChange 回调入参及展示标签只有叶子节点 | boolean | false |0.32.0 |
 | loadData | 异步加载数据,需要返回一个Promise | (treeNode: TreeNode) => Promise |- |  1.32.0|
 | loadedKeys | (受控)已经加载的节点,配合 loadData 使用 | Set< string > | - | 1.32.0|
@@ -1398,7 +1399,7 @@ function Demo() {
 | prefix | 前缀标签 | ReactNode | - |0.28.0 |
 | preventScroll | 指示浏览器是否应滚动文档以显示新聚焦的元素,作用于组件内的 focus 方法 | boolean |  |  |
 | renderFullLabel | 完全自定义label的渲染函数,[入参及用法详见](/zh-CN/navigation/tree#高级定制) | (obj) => ReactNode | - | 1.7.0 | 
-| renderLabel | 自定义label的渲染函数,[入参及用法详见](/zh-CN/navigation/tree#自定义节点内容)  | (label:ReactNode, data:TreeNode) => ReactNode | - | 1.6.0 | 
+| renderLabel | 自定义label的渲染函数,[入参及用法详见](/zh-CN/navigation/tree#自定义节点内容)  | <ApiType detail='(label:ReactNode, data:TreeNode) => ReactNode'>(label, data) => ReactNode</ApiType> | - | 1.6.0 | 
 | renderSelectedItem | 自定义渲染已选项 | Function | - | 1.26.0 | 
 | restTagsPopoverProps | Popover 的配置属性,可以控制 position、zIndex、trigger 等,具体参考[Popover](/zh-CN/show/popover#API%20%E5%8F%82%E8%80%83) | PopoverProps     | {} | 2.22.0 |
 | searchAutoFocus | 搜索框自动聚焦 | boolean | false | 1.27.0 |
@@ -1416,17 +1417,17 @@ function Demo() {
 | treeNodeLabelProp | 作为显示的 `prop` 设置 | string | `label` | - |
 | triggerRender | 自定义触发器渲染方法  | ({ placeholder: string }) => ReactNode | - | 0.34.0 |
 | validateStatus | 校验结果,可选 `warning`、`error`、 `default`(只影响样式背景色) | string | - | 0.32.0 |
-| value | 当前选中的节点的value值,传入该值时将作为受控组件 | string \| number \| TreeNode \| (string \| number \| TreeNode)[] | - | - |
+| value | 当前选中的节点的value值,传入该值时将作为受控组件 | <ApiType detail='string \| number \| TreeNode \| (string \| number \| TreeNode)[]'>ValueType</ApiType>| - | - |
 | virtualize | 列表虚拟化,用于大量树节点的情况,由 height, width, itemSize 组成,参考 Tree - Virtualize Object。开启后将关闭动画效果。 | object | - | 0.32.0 |
 | zIndex | treeSelect下拉菜单的zIndex | number | 1030 | 0.30.0 |
 | onBlur | 失去焦点时的回调 | function(event) | - | - |
 | onChange | 选中树节点时调用此函数,默认返回值为当前所有选中项的value值及节点属性;如果是通过tag关闭,event参数为null | Function | - | - |
 | onChangeWithObject | 是否将选中项 option 的其他属性作为回调。设为 true 时,onChange 的入参类型Function(node\|node[], e) 此时如果是受控,也需要把 value 设置成 object,且必须含有 value 的键值;defaultValue同理。 | boolean | false | 1.0.0 |
-| onExpand | 展示节点时调用 | function(expandedKeys:array, {expanded: bool, node}) | - | - |
+| onExpand | 展示节点时调用 | <ApiType detail='(expandedKeys:array, {expanded: bool, node}) => void'>(expandedKeys, object) => void</ApiType> | - | - |
 | onFocus | 聚焦时的回调 | function(event) | - | - |
-| onLoad | 节点加载完毕时触发的回调 | (loadedKeys: Set<string\>, treeNode: TreeNode) => void |- |  1.32.0|
-| onSearch | 文本框值变化时回调。 入参 filteredExpandedKeys 表示因为搜索或 value/defaultValue 而展开的节点的 key, 可以配合 expandedKeys 受控时使用 | function(sugInput: string, filteredExpandedKeys: string[]) | - | filteredExpandedKeys 在 2.6.0 中新增 |
-| onSelect | 被选中时调用,返回值为当前事件选项的key值 | function(selectedKey:string, selected: bool, selectedNode: TreeNode) | - | - |
+| onLoad | 节点加载完毕时触发的回调 | <ApiType detail='(loadedKeys: Set<string\>, treeNode: TreeNode) => void'>(loadedKeys, treeNode) => void</ApiType> |- |  1.32.0|
+| onSearch | 文本框值变化时回调。 入参 filteredExpandedKeys 表示因为搜索或 value / defaultValue 而展开的节点的 key, <br/>可以配合 expandedKeys 受控时使用。filteredExpandedKeys 在 2.6.0 中新增 |  <ApiType detail='function(sugInput: string, filteredExpandedKeys: string[])'>(sugInput, filteredExpandedKeys)=>void</ApiType>  |  |  |
+| onSelect | 被选中时调用,返回值为当前事件选项的key值 | <ApiType detail='(selectedKey:string, selected: bool, selectedNode: TreeNode) => void'>(selectedKey, selected, selectedNode)=>void</ApiType> | - | - |
 | onVisibleChange     | 弹出层展示/隐藏时触发的回调   | function(isVisible:boolean) |     |   1.4.0  |
 
 ### TreeNode

+ 1 - 0
content/show/dropdown/index.md

@@ -432,6 +432,7 @@ function DropdownEvents() {
 | clickToHide | 在弹出层内点击时是否自动关闭弹出层 | boolean |  | **0.24.0** |
 | contentClassName | 下拉菜单根元素类名 | string |  |  |
 | getPopupContainer | 指定父级 DOM,弹层将会渲染至该 DOM 中,自定义需要设置 `position: relative` | function():HTMLElement | () => document.body |  |
+| margin| 弹出层计算溢出时的增加的冗余值,详见[issue#549](https://github.com/DouyinFE/semi-design/issues/549),作用同 Tooltip margin  | number\|object  |  |  **2.25.0**   |
 | mouseEnterDelay | 鼠标移入 Trigger 后,延迟显示的时间,单位毫秒(仅当 trigger 为 hover/focus 时生效) | number | 50 |  |
 | mouseLeaveDelay | 鼠标移出弹出层后,延迟消失的时间,单位毫秒(仅当 trigger 为 hover/focus 时生效) | number | 50 |  |
 | menu | 通过传入 JSON Array 来快速配置 Dropdown 内容 | Array<DropdownMenuItem\> | [] | **1.12.0** |

+ 2 - 1
content/show/popover/index.md

@@ -528,7 +528,7 @@ import { Button, Input, Popover, Space } from '@douyinfe/semi-ui';
 
 ## API 参考
 
-| 属性               | 说明                                                                                                                                        | 类型                       | 默认值                                      | 版本       |
+| 属性               | 说明                      | 类型                       | 默认值                                      | 版本       |
 | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- | ------------------------------------------- | ---------- |
 | autoAdjustOverflow | 是否自动调整弹出层展开方向,用于边缘遮挡时自动调整展开方向                                                                                  | boolean                    | true                                        |            |
 | arrowPointAtCenter | “小三角”是否指向元素中心,需要同时传入"showArrow=true"                                                                                      | boolean                    | true                                        | **0.34.0** |
@@ -538,6 +538,7 @@ import { Button, Input, Popover, Space } from '@douyinfe/semi-ui';
 | disableFocusListener | trigger为`hover`时,不响应键盘聚焦弹出浮层事件,详见[issue#977](https://github.com/DouyinFE/semi-design/issues/977) | boolean | true | **2.17.0** |
 | getPopupContainer  | 指定父级 DOM,弹层将会渲染至该 DOM 中,自定义需要设置 `position: relative`                                                                  | function():HTMLElement     | () => document.body                         |            |
 | guardFocus         | 当焦点处于弹出层内时,切换 Tab 是否让焦点在弹出层内循环 | boolean | true | **2.8.0** |
+| margin     |  弹出层计算溢出时的增加的冗余值,详见[issue#549](https://github.com/DouyinFE/semi-design/issues/549),作用同 Tooltip margin                        | number\|object                     |                                          |  **2.25.0**   |
 | mouseEnterDelay    | 鼠标移入后,延迟显示的时间,单位毫秒(仅当 trigger 为 hover/focus 时生效)                                                                  | number                     | 50                                          |            |
 | mouseLeaveDelay    | 鼠标移出后,延迟消失的时间,单位毫秒(仅当 trigger 为 hover/focus 时生效)                                                                  | number                     | 50                                          |            |
 | rePosKey           | 可以更新该项值手动触发弹出层的重新定位                                                                                                         | string\|number             |                                            |             |