From ba2acae7e168a43a66723bf661916e740e49c36e Mon Sep 17 00:00:00 2001 From: Wanpan Date: Thu, 25 Apr 2024 18:26:47 +0800 Subject: [PATCH 1/5] docs: tree-select supports onPopupScroll props --- components/tree-select/index.en-US.md | 1 + components/tree-select/index.zh-CN.md | 1 + package.json | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/components/tree-select/index.en-US.md b/components/tree-select/index.en-US.md index a8d0804d5440..2fb31bc9bb57 100644 --- a/components/tree-select/index.en-US.md +++ b/components/tree-select/index.en-US.md @@ -86,6 +86,7 @@ Common props ref:[Common props](/docs/react/common-props) | onSearch | A callback function, can be executed when the search input changes | function(value: string) | - | | | onSelect | A callback function, can be executed when you select a treeNode | function(value, node, extra) | - | | | onTreeExpand | A callback function, can be executed when treeNode expanded | function(expandedKeys) | - | | +| onPopupScroll | Called when dropdown scrolls | (event: MouseEvent) => void | - | 5.16.5 | ### Tree Methods diff --git a/components/tree-select/index.zh-CN.md b/components/tree-select/index.zh-CN.md index c33960329e9d..834493382665 100644 --- a/components/tree-select/index.zh-CN.md +++ b/components/tree-select/index.zh-CN.md @@ -87,6 +87,7 @@ demo: | onSearch | 文本框值变化时的回调 | function(value: string) | - | | | onSelect | 被选中时调用 | function(value, node, extra) | - | | | onTreeExpand | 展示节点时调用 | function(expandedKeys) | - | | +| onPopupScroll | 下拉列表滚动时的回调 | (event: MouseEvent) => void | - | 5.16.5 | ### Tree 方法 diff --git a/package.json b/package.json index 364443ca0479..4dacc647f892 100644 --- a/package.json +++ b/package.json @@ -159,7 +159,7 @@ "rc-textarea": "~1.6.3", "rc-tooltip": "~6.2.0", "rc-tree": "~5.8.5", - "rc-tree-select": "~5.19.0", + "rc-tree-select": "~5.20.0", "rc-upload": "~4.5.2", "rc-util": "^5.39.1", "scroll-into-view-if-needed": "^3.1.0", From 16dbca5275286216268e5213810860cf3b4eab2f Mon Sep 17 00:00:00 2001 From: Wanpan Date: Thu, 25 Apr 2024 23:39:11 +0800 Subject: [PATCH 2/5] docs: update demo --- components/tree-select/demo/basic.tsx | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/components/tree-select/demo/basic.tsx b/components/tree-select/demo/basic.tsx index 009d49f7fb10..4bc00f76f400 100644 --- a/components/tree-select/demo/basic.tsx +++ b/components/tree-select/demo/basic.tsx @@ -18,6 +18,22 @@ const treeData = [ value: 'leaf2', title: 'leaf2', }, + { + value: 'leaf3', + title: 'leaf3', + }, + { + value: 'leaf4', + title: 'leaf4', + }, + { + value: 'leaf5', + title: 'leaf5', + }, + { + value: 'leaf6', + title: 'leaf6', + }, ], }, { @@ -25,8 +41,8 @@ const treeData = [ title: 'parent 1-1', children: [ { - value: 'leaf3', - title: leaf3, + value: 'leaf11', + title: leaf11, }, ], }, @@ -51,6 +67,9 @@ const App: React.FC = () => { treeDefaultExpandAll onChange={onChange} treeData={treeData} + onPopupScroll={(e) => { + console.log('onPopupScroll', e); + }} /> ); }; From 9efc0e11d52b6855b7ef5b6742a08d1ea4ab7ff2 Mon Sep 17 00:00:00 2001 From: Wanpan Date: Fri, 26 Apr 2024 00:12:21 +0800 Subject: [PATCH 3/5] docs: update version --- components/tree-select/index.en-US.md | 2 +- components/tree-select/index.zh-CN.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/tree-select/index.en-US.md b/components/tree-select/index.en-US.md index 2fb31bc9bb57..e0d7bef5ba8f 100644 --- a/components/tree-select/index.en-US.md +++ b/components/tree-select/index.en-US.md @@ -86,7 +86,7 @@ Common props ref:[Common props](/docs/react/common-props) | onSearch | A callback function, can be executed when the search input changes | function(value: string) | - | | | onSelect | A callback function, can be executed when you select a treeNode | function(value, node, extra) | - | | | onTreeExpand | A callback function, can be executed when treeNode expanded | function(expandedKeys) | - | | -| onPopupScroll | Called when dropdown scrolls | (event: MouseEvent) => void | - | 5.16.5 | +| onPopupScroll | Called when dropdown scrolls | (event: MouseEvent) => void | - | 5.17.0 | ### Tree Methods diff --git a/components/tree-select/index.zh-CN.md b/components/tree-select/index.zh-CN.md index 834493382665..f7cd874adae4 100644 --- a/components/tree-select/index.zh-CN.md +++ b/components/tree-select/index.zh-CN.md @@ -87,7 +87,7 @@ demo: | onSearch | 文本框值变化时的回调 | function(value: string) | - | | | onSelect | 被选中时调用 | function(value, node, extra) | - | | | onTreeExpand | 展示节点时调用 | function(expandedKeys) | - | | -| onPopupScroll | 下拉列表滚动时的回调 | (event: MouseEvent) => void | - | 5.16.5 | +| onPopupScroll | 下拉列表滚动时的回调 | (event: MouseEvent) => void | - | 5.17.0 | ### Tree 方法 From 167a8024e5c3f48f324edec4a0f7aca6e2e42ef3 Mon Sep 17 00:00:00 2001 From: Wanpan Date: Fri, 26 Apr 2024 01:10:34 +0800 Subject: [PATCH 4/5] test: update snapshots --- .../__snapshots__/demo-extend.test.ts.snap | 124 +++++++++++++++++- 1 file changed, 122 insertions(+), 2 deletions(-) diff --git a/components/tree-select/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/tree-select/__tests__/__snapshots__/demo-extend.test.ts.snap index f4faf82bf490..ed9fccb6b08f 100644 --- a/components/tree-select/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/tree-select/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -423,7 +423,7 @@ exports[`renders components/tree-select/demo/basic.tsx extend context correctly
+
+
+
+
+
+
+
+
- leaf3 + leaf11 From b4aebe95a77bc482a6adf7b6fd01f5aeef9d3834 Mon Sep 17 00:00:00 2001 From: Wanpan Date: Sun, 28 Apr 2024 12:37:06 +0800 Subject: [PATCH 5/5] fix: update demo --- components/tree-select/demo/basic.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/components/tree-select/demo/basic.tsx b/components/tree-select/demo/basic.tsx index 4bc00f76f400..0cd1c3599857 100644 --- a/components/tree-select/demo/basic.tsx +++ b/components/tree-select/demo/basic.tsx @@ -1,3 +1,4 @@ +import type { SyntheticEvent } from 'react'; import React, { useState } from 'react'; import { TreeSelect } from 'antd'; @@ -56,6 +57,10 @@ const App: React.FC = () => { setValue(newValue); }; + const onPopupScroll = (e: SyntheticEvent) => { + console.log('onPopupScroll', e); + }; + return ( { treeDefaultExpandAll onChange={onChange} treeData={treeData} - onPopupScroll={(e) => { - console.log('onPopupScroll', e); - }} + onPopupScroll={onPopupScroll} /> ); };