From 34e790592d7e63c19879e0a6f268998ed9c1341f Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Fri, 24 Sep 2021 09:45:03 +0800 Subject: [PATCH] doc: update --- components/_util/hooks/useConfigInject.ts | 4 ++-- components/auto-complete/index.en-US.md | 1 + components/auto-complete/index.tsx | 2 +- components/auto-complete/index.zh-CN.md | 1 + components/config-provider/index.tsx | 4 ++-- components/select/index.en-US.md | 2 +- components/select/index.zh-CN.md | 2 +- components/tree-select/index.en-US.md | 4 ++-- components/tree-select/index.zh-CN.md | 4 ++-- 9 files changed, 13 insertions(+), 11 deletions(-) diff --git a/components/_util/hooks/useConfigInject.ts b/components/_util/hooks/useConfigInject.ts index 097e90429..7bde67632 100644 --- a/components/_util/hooks/useConfigInject.ts +++ b/components/_util/hooks/useConfigInject.ts @@ -22,7 +22,7 @@ export default ( autoInsertSpaceInButton: ComputedRef; renderEmpty?: ComputedRef<(componentName?: string) => VNodeChild | JSX.Element>; virtual: ComputedRef; - dropdownMatchSelectWidth: ComputedRef; + dropdownMatchSelectWidth: ComputedRef; getPopupContainer: ComputedRef; } => { const configProvider = inject>( @@ -44,7 +44,7 @@ export default ( () => props.getPopupContainer || configProvider.getPopupContainer, ); const virtual = computed(() => props.virtual ?? configProvider.virtual); - const dropdownMatchSelectWidth = computed( + const dropdownMatchSelectWidth = computed( () => props.dropdownMatchSelectWidth ?? configProvider.dropdownMatchSelectWidth, ); const size = computed(() => props.size || configProvider.componentSize); diff --git a/components/auto-complete/index.en-US.md b/components/auto-complete/index.en-US.md index f8c421511..a214505fd 100644 --- a/components/auto-complete/index.en-US.md +++ b/components/auto-complete/index.en-US.md @@ -29,6 +29,7 @@ When there is a need for autocomplete functionality. | dropdownMenuStyle | additional style applied to dropdown menu | object | | 1.5.0 | | defaultActiveFirstOption | Whether active first option by default | boolean | true | | | disabled | Whether disabled select | boolean | false | | +| dropdownMatchSelectWidth | Determine whether the dropdown menu and the select input are the same width. Default set `min-width` same as input. Will ignore when value less than select width. `false` will disable virtual scroll | boolean \| number | true | | | filterOption | If true, filter options by input, if function, filter options against it. The function will receive two arguments, `inputValue` and `option`, if the function returns `true`, the option will be included in the filtered set; Otherwise, it will be excluded. | boolean or function(inputValue, option) | true | | | optionLabelProp | Which prop value of option will render as content of select. | string | `children` | | | placeholder | placeholder of input | string | - | | diff --git a/components/auto-complete/index.tsx b/components/auto-complete/index.tsx index a6dfb1ac3..e9998420b 100644 --- a/components/auto-complete/index.tsx +++ b/components/auto-complete/index.tsx @@ -18,7 +18,7 @@ const autoCompleteProps = { dataSource: PropTypes.array, dropdownMenuStyle: PropTypes.style, optionLabelProp: PropTypes.string, - dropdownMatchSelectWidth: PropTypes.looseBool, + dropdownMatchSelectWidth: { type: [Number, Boolean], default: true }, }; export type AutoCompleteProps = Partial>; diff --git a/components/auto-complete/index.zh-CN.md b/components/auto-complete/index.zh-CN.md index 36c420d3a..53d0c6265 100644 --- a/components/auto-complete/index.zh-CN.md +++ b/components/auto-complete/index.zh-CN.md @@ -36,6 +36,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/qtJm4yt45/AutoComplete.svg | dropdownMenuStyle | dropdown 菜单自定义样式 | object | | 1.5.0 | | defaultActiveFirstOption | 是否默认高亮第一个选项。 | boolean | true | | | disabled | 是否禁用 | boolean | false | | +| dropdownMatchSelectWidth | 下拉菜单和选择器同宽。默认将设置 `min-width`,当值小于选择框宽度时会被忽略。false 时会关闭虚拟滚动 | boolean \| number | true | | | filterOption | 是否根据输入项进行筛选。当其为一个函数时,会接收 `inputValue` `option` 两个参数,当 `option` 符合筛选条件时,应返回 `true`,反之则返回 `false`。 | boolean or function(inputValue, option) | true | | | optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`。 | string | `children` | | | placeholder | 输入框提示 | string \| slot | - | | diff --git a/components/config-provider/index.tsx b/components/config-provider/index.tsx index 03b93b28b..5e804cf91 100644 --- a/components/config-provider/index.tsx +++ b/components/config-provider/index.tsx @@ -42,7 +42,7 @@ export interface ConfigConsumerProps { size?: SizeType | number; }; virtual?: boolean; - dropdownMatchSelectWidth?: boolean; + dropdownMatchSelectWidth?: boolean | number; } export const configConsumerProps = [ @@ -144,7 +144,7 @@ export const configProviderProps = { type: Object as PropType<{ size: SizeType | number }>, }, virtual: PropTypes.looseBool, - dropdownMatchSelectWidth: PropTypes.looseBool, + dropdownMatchSelectWidth: { type: [Number, Boolean], default: true }, form: { type: Object as PropType<{ requiredMark?: RequiredMark }>, }, diff --git a/components/select/index.en-US.md b/components/select/index.en-US.md index 463acbba8..7b5f80bc2 100644 --- a/components/select/index.en-US.md +++ b/components/select/index.en-US.md @@ -31,7 +31,7 @@ Select component to select value from options. | defaultActiveFirstOption | Whether active first option by default | boolean | true | | | disabled | Whether disabled select | boolean | false | | | dropdownClassName | className of dropdown menu | string | - | | -| dropdownMatchSelectWidth | Whether dropdown's width is same with select. | boolean | true | | +| dropdownMatchSelectWidth | Determine whether the dropdown menu and the select input are the same width. Default set `min-width` same as input. Will ignore when value less than select width. `false` will disable virtual scroll | boolean \| number | true | | | dropdownRender | Customize dropdown content | ({menuNode: VNode, props}) => VNode \| v-slot | - | | | dropdownStyle | style of dropdown menu | object | - | | | dropdownMenuStyle | additional style applied to dropdown menu | object | - | | diff --git a/components/select/index.zh-CN.md b/components/select/index.zh-CN.md index a6ba8de0e..067095757 100644 --- a/components/select/index.zh-CN.md +++ b/components/select/index.zh-CN.md @@ -32,7 +32,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/_0XzgOis7/Select.svg | defaultActiveFirstOption | 是否默认高亮第一个选项。 | boolean | true | | | disabled | 是否禁用 | boolean | false | | | dropdownClassName | 下拉菜单的 className 属性 | string | - | | -| dropdownMatchSelectWidth | 下拉菜单和选择器同宽 | boolean | true | 」 | +| dropdownMatchSelectWidth | 下拉菜单和选择器同宽。默认将设置 `min-width`,当值小于选择框宽度时会被忽略。false 时会关闭虚拟滚动 | boolean \| number | true | | | dropdownRender | 自定义下拉框内容 | ({menuNode: VNode, props}) => VNode \| v-slot | - | | | dropdownStyle | 下拉菜单的 style 属性 | object | - | | | dropdownMenuStyle | dropdown 菜单自定义样式 | object | - | | diff --git a/components/tree-select/index.en-US.md b/components/tree-select/index.en-US.md index 6a385780e..fca54e54b 100644 --- a/components/tree-select/index.en-US.md +++ b/components/tree-select/index.en-US.md @@ -16,12 +16,12 @@ Tree selection control. ### Tree props | Property | Description | Type | Default | Version | -| --- | --- | --- | --- | --- | +| --- | --- | --- | --- | --- | --- | | allowClear | Whether allow clear | boolean | false | | | defaultValue | To set the initial selected treeNode(s). | string\|string\[] | - | | | disabled | Disabled or not | boolean | false | | | dropdownClassName | className of dropdown menu | string | - | | -| dropdownMatchSelectWidth | Determine whether the dropdown menu and the select input are the same width | boolean | true | | +| dropdownMatchSelectWidth | Determine whether the dropdown menu and the select input are the same width. Default set `min-width` same as input. Will ignore when value less than select width. `false` will disable virtual scroll | boolean \| number | true | | | dropdownStyle | To set the style of the dropdown menu | object | - | | | filterTreeNode | Whether to filter treeNodes by input value. The value of `treeNodeFilterProp` is used for filtering by default. | boolean\|Function(inputValue: string, treeNode: TreeNode) (should return boolean) | Function | | | getPopupContainer | To set the container of the dropdown menu. The default is to create a `div` element in `body`, you can reset it to the scrolling area and make a relative reposition. | Function(triggerNode) | () => document.body | | diff --git a/components/tree-select/index.zh-CN.md b/components/tree-select/index.zh-CN.md index 630591142..db693c6c8 100644 --- a/components/tree-select/index.zh-CN.md +++ b/components/tree-select/index.zh-CN.md @@ -17,12 +17,12 @@ cover: https://gw.alipayobjects.com/zos/alicdn/Ax4DA0njr/TreeSelect.svg ### Tree props | 参数 | 说明 | 类型 | 默认值 | 版本 | -| --- | --- | --- | --- | --- | +| --- | --- | --- | --- | --- | --- | | allowClear | 显示清除按钮 | boolean | false | | | defaultValue | 指定默认选中的条目 | string/string\[] | - | | | disabled | 是否禁用 | boolean | false | | | dropdownClassName | 下拉菜单的 className 属性 | string | - | | -| dropdownMatchSelectWidth | 下拉菜单和选择器同宽 | boolean | true | | +| dropdownMatchSelectWidth | 下拉菜单和选择器同宽。默认将设置 `min-width`,当值小于选择框宽度时会被忽略。false 时会关闭虚拟滚动 | boolean \| number | true | | | dropdownStyle | 下拉菜单的样式 | object | - | | | filterTreeNode | 是否根据输入项进行筛选,默认用 treeNodeFilterProp 的值作为要筛选的 TreeNode 的属性值 | boolean\|Function(inputValue: string, treeNode: TreeNode) (函数需要返回 bool 值) | Function | | | getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。 | Function(triggerNode) | () => document.body | |