Skip to content

Commit 91c6a28

Browse files
committed
fix: dropdownMatchSelectWidth:false not close virtual scroll #5242
1 parent 2b0adaf commit 91c6a28

File tree

8 files changed

+15
-2
lines changed

8 files changed

+15
-2
lines changed

components/_util/hooks/useConfigInject.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,15 @@ export default (
4747
const getPopupContainer = computed(
4848
() => props.getPopupContainer || configProvider.getPopupContainer,
4949
);
50-
const virtual = computed(() => props.virtual ?? configProvider.virtual);
50+
5151
const dropdownMatchSelectWidth = computed<boolean | number>(
5252
() => props.dropdownMatchSelectWidth ?? configProvider.dropdownMatchSelectWidth,
5353
);
54+
const virtual = computed(
55+
() =>
56+
(props.virtual === undefined ? configProvider.virtual !== false : props.virtual !== false) &&
57+
dropdownMatchSelectWidth.value !== false,
58+
);
5459
const size = computed(() => props.size || configProvider.componentSize);
5560
const autocomplete = computed(() => props.autocomplete || configProvider.input?.autocomplete);
5661
const csp = computed(() => configProvider.csp);

components/config-provider/index.en-US.md

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Some components use dynamic style to support wave effect. You can config `csp` p
5555
| prefixCls | set prefix class | string | ant | |
5656
| pageHeader | Unify the ghost of pageHeader ,Ref [pageHeader](<(/components/page-header)> | { ghost:boolean } | 'true' | 1.5.0 |
5757
| transformCellText | Table data can be changed again before rendering. The default configuration of general user empty data. | Function({ text, column, record, index }) => any | - | 1.5.4 | |
58+
| virtual | Disable virtual scroll when set to false | boolean | true | 3.0 |
5859

5960
### ConfigProvider.config() `3.0.0+`
6061

components/config-provider/index.zh-CN.md

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ ConfigProvider 使用 Vue 的 [provide / inject](https://vuejs.org/v2/api/#provi
5656
| pageHeader | 统一设置 pageHeader 的 ghost,参考 [pageHeader](<(/components/page-header)>) | { ghost: boolean } | 'true' | 1.5.0 |
5757
| prefixCls | 设置统一样式前缀。注意:需要配合 `less` 变量 `@ant-prefix` 使用 | string | `ant` | |
5858
| transformCellText | Table 数据渲染前可以再次改变,一般用户空数据的默认配置 | Function({ text, column, record, index }) => any | - | 1.5.4 | |
59+
| virtual | 设置 `false` 时关闭虚拟滚动 | boolean | - | 3.0 |
5960

6061
### ConfigProvider.config() `3.0.0+`
6162

components/tree-select/index.en-US.md

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Tree selection control.
2626
| 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 | |
2727
| 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 | |
2828
| labelInValue | whether to embed label in value, turn the format of value from `string` to `{value: string, label: VNode, halfChecked: string[]}` | boolean | false | |
29+
| listHeight | Config popup height | number | 256 | |
2930
| loadData | Load data asynchronously. | function(node) | - | |
3031
| maxTagCount | Max tag count to show | number | - | |
3132
| maxTagPlaceholder | Placeholder for not showing tags | slot/function(omittedValues) | - | |
@@ -51,6 +52,7 @@ Tree selection control.
5152
| treeNodeFilterProp | Will be used for filtering if `filterTreeNode` returns true | string | 'value' | |
5253
| treeNodeLabelProp | Will render as content of select | string | 'title' | |
5354
| value(v-model) | To set the current selected treeNode(s). | string\|string\[] | - | |
55+
| virtual | Disable virtual scroll when set to false | boolean | true | 3.0 |
5456
| title | custom title | slot | | 3.0.0 |
5557

5658
### Events

components/tree-select/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ const TreeSelect = defineComponent({
229229
return (
230230
<VcTreeSelect
231231
{...attrs}
232+
{...selectProps}
232233
virtual={virtual.value}
233234
dropdownMatchSelectWidth={dropdownMatchSelectWidth.value}
234-
{...selectProps}
235235
id={id}
236236
fieldNames={fieldNames}
237237
ref={treeSelectRef}

components/tree-select/index.zh-CN.md

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/Ax4DA0njr/TreeSelect.svg
2727
| filterTreeNode | 是否根据输入项进行筛选,默认用 treeNodeFilterProp 的值作为要筛选的 TreeNode 的属性值 | boolean\|Function(inputValue: string, treeNode: TreeNode) (函数需要返回 bool 值) | Function | |
2828
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。 | Function(triggerNode) | () => document.body | |
2929
| labelInValue | 是否把每个选项的 label 包装到 value 中,会把 value 类型从 `string` 变为 `{value: string, label: VNode, halfChecked(treeCheckStrictly 时有效): string[] }` 的格式 | boolean | false | |
30+
| listHeight | 设置弹窗滚动高度 | number | 256 | |
3031
| loadData | 异步加载数据 | function(node) | - | |
3132
| maxTagCount | 最多显示多少个 tag | number | - | |
3233
| maxTagPlaceholder | 隐藏 tag 时显示的内容 | slot/function(omittedValues) | - | |
@@ -52,6 +53,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/Ax4DA0njr/TreeSelect.svg
5253
| treeNodeFilterProp | 输入项过滤对应的 treeNode 属性 | string | 'value' | |
5354
| treeNodeLabelProp | 作为显示的 prop 设置 | string | 'title' | |
5455
| value(v-model) | 指定当前选中的条目 | string/string\[] | - | |
56+
| virtual | 设置 false 时关闭虚拟滚动 | boolean | true | 3.0 |
5557
| title | 自定义标题 | slot | | 3.0.0 |
5658

5759
### 事件

components/tree/index.en-US.md

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Almost anything can be represented in a tree structure. Examples include directo
3838
| switcherIcon | customize collapse/expand icon of tree node | slot | - | |
3939
| showLine | Shows a connecting line | boolean \| {showLeafIcon: boolean}(3.0+) | false | |
4040
| title | custom title | slot | | 2.0.0 |
41+
| virtual | Disable virtual scroll when set to false | boolean | true | 3.0 |
4142

4243
### Events
4344

components/tree/index.zh-CN.md

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/Xh-oWqg9k/Tree.svg
3939
| switcherIcon | 自定义树节点的展开/折叠图标 | slot | - | |
4040
| showLine | 是否展示连接线 | boolean \| {showLeafIcon: boolean}(3.0+) | false | |
4141
| title | 自定义标题 | slot | | 2.0.0 |
42+
| virtual | 设置 false 时关闭虚拟滚动 | boolean | true | 3.0 |
4243

4344
### 事件
4445

0 commit comments

Comments
 (0)