Skip to content

Commit e8ab47d

Browse files
feat(Cascader): support virtual scroll api (#737)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 228fb31 commit e8ab47d

File tree

18 files changed

+89
-5
lines changed

18 files changed

+89
-5
lines changed

db/TDesign.db

0 Bytes
Binary file not shown.

packages/products/tdesign-mobile-react/src/cascader/cascader.en-US.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ header | TElement | - | Typescript:`TNode`。[see more ts definition](https://
1414
keys | Object | - | Typescript:`CascaderKeysType` `type CascaderKeysType = TreeKeysType`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts)[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/cascader/type.ts) | N
1515
lazy | Boolean | false | \- | N
1616
loadCompleted | Boolean | false | \- | N
17+
middleContent | TElement | - | Typescript:`TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
1718
options | Array | [] | Typescript:`Array<CascaderOption>` | N
19+
overlayProps | Object | {} | Typescript:`OverlayProps`[Overlay API Documents](./overlay?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/cascader/type.ts) | N
1820
placeholder | String | 选择选项 | \- | N
21+
scroll | \- | - | Lazy loading and virtual scrolling. To maximize the benefits of the component, when the amount of data is less than the threshold `scroll.threshold`, regardless of whether the virtual scrolling configuration exists, virtual scrolling will not be enabled within the component. `scroll.threshold` defaults to `100`。Typescript:`TScroll`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
1922
subTitles | Array | [] | Typescript:`Array<string>` | N
2023
theme | String | step | options: step/tab | N
2124
title | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N

packages/products/tdesign-mobile-react/src/cascader/cascader.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ header | TElement | - | 头部。TS 类型:`TNode`。[通用类型定义](http
1414
keys | Object | - | 用来定义 value / label / children / disabled 在 `options` 中对应的字段别名。TS 类型:`CascaderKeysType` `type CascaderKeysType = TreeKeysType`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts)[详细类型定义](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/cascader/type.ts) | N
1515
lazy | Boolean | false | 是否异步加载 | N
1616
loadCompleted | Boolean | false | 是否完成异步加载 | N
17+
middleContent | TElement | - | 中间内容。TS 类型:`TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
1718
options | Array | [] | 可选项数据源。TS 类型:`Array<CascaderOption>` | N
19+
overlayProps | Object | {} | 遮罩层的属性,透传至 overlay。TS 类型:`OverlayProps`[Overlay API Documents](./overlay?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/cascader/type.ts) | N
1820
placeholder | String | 选择选项 | 未选中时的提示文案 | N
21+
scroll | \- | - | 懒加载和虚拟滚动。为保证组件收益最大化,当数据量小于阈值 `scroll.threshold` 时,无论虚拟滚动的配置是否存在,组件内部都不会开启虚拟滚动,`scroll.threshold` 默认为 `100`。TS 类型:`TScroll`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
1922
subTitles | Array | [] | 每级展示的次标题。TS 类型:`Array<string>` | N
2023
theme | String | step | 展示风格。可选项:step/tab | N
2124
title | TNode | - | 标题。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N

packages/products/tdesign-mobile-react/src/cascader/defaultProps.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const cascaderDefaultProps: TdCascaderProps = {
1010
lazy: false,
1111
loadCompleted: false,
1212
options: [],
13+
overlayProps: {},
1314
placeholder: '选择选项',
1415
subTitles: [],
1516
theme: 'step',

packages/products/tdesign-mobile-react/src/cascader/type.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
55
* */
66

7-
import { TNode, TElement, TreeOptionData, TreeKeysType } from '../common';
7+
import { OverlayProps } from '../overlay';
8+
import { TNode, TElement, TreeOptionData, TreeKeysType, TScroll } from '../common';
89

910
export interface TdCascaderProps<CascaderOption extends TreeOptionData = TreeOptionData> {
1011
/**
@@ -35,16 +36,29 @@ export interface TdCascaderProps<CascaderOption extends TreeOptionData = TreeOpt
3536
* @default false
3637
*/
3738
loadCompleted?: boolean;
39+
/**
40+
* 中间内容
41+
*/
42+
middleContent?: TElement;
3843
/**
3944
* 可选项数据源
4045
* @default []
4146
*/
4247
options?: Array<CascaderOption>;
48+
/**
49+
* 遮罩层的属性,透传至 overlay
50+
* @default {}
51+
*/
52+
overlayProps?: OverlayProps;
4353
/**
4454
* 未选中时的提示文案
4555
* @default 选择选项
4656
*/
4757
placeholder?: string;
58+
/**
59+
* 懒加载和虚拟滚动。为保证组件收益最大化,当数据量小于阈值 `scroll.threshold` 时,无论虚拟滚动的配置是否存在,组件内部都不会开启虚拟滚动,`scroll.threshold` 默认为 `100`
60+
*/
61+
scroll?: TScroll;
4862
/**
4963
* 每级展示的次标题
5064
* @default []

packages/products/tdesign-mobile-vue/src/cascader/cascader.en-US.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ middleContent | Slot / Function | - | Typescript:`TNode`。[see more ts defini
1414
options | Array | [] | Typescript:`Array<CascaderOption>` | N
1515
overlayProps | Object | {} | Typescript:`OverlayProps`[Overlay API Documents](./overlay?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/cascader/type.ts) | N
1616
placeholder | String / Slot / Function | '选择选项' | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
17+
scroll | \- | - | Lazy loading and virtual scrolling. To maximize the benefits of the component, when the amount of data is less than the threshold `scroll.threshold`, regardless of whether the virtual scrolling configuration exists, virtual scrolling will not be enabled within the component. `scroll.threshold` defaults to `100`。Typescript:`TScroll`[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
1718
subTitles | Array | [] | Typescript:`Array<string>` | N
1819
theme | String | step | options: step/tab | N
1920
title | String / Slot / Function | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N

packages/products/tdesign-mobile-vue/src/cascader/cascader.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ middleContent | Slot / Function | - | 中间内容。TS 类型:`TNode`。[通
1414
options | Array | [] | 可选项数据源。TS 类型:`Array<CascaderOption>` | N
1515
overlayProps | Object | {} | 遮罩层的属性,透传至 overlay。TS 类型:`OverlayProps`[Overlay API Documents](./overlay?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/cascader/type.ts) | N
1616
placeholder | String / Slot / Function | '选择选项' | 未选中时的提示文案。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
17+
scroll | \- | - | 懒加载和虚拟滚动。为保证组件收益最大化,当数据量小于阈值 `scroll.threshold` 时,无论虚拟滚动的配置是否存在,组件内部都不会开启虚拟滚动,`scroll.threshold` 默认为 `100`。TS 类型:`TScroll`[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
1718
subTitles | Array | [] | 每级展示的次标题。TS 类型:`Array<string>` | N
1819
theme | String | step | 展示风格。可选项:step/tab | N
1920
title | String / Slot / Function | - | 标题。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N

packages/products/tdesign-mobile-vue/src/cascader/type.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* */
66

77
import { OverlayProps } from '../overlay';
8-
import { TNode, TreeOptionData, TreeKeysType } from '../common';
8+
import { TNode, TreeOptionData, TreeKeysType, TScroll } from '../common';
99

1010
export interface TdCascaderProps<CascaderOption extends TreeOptionData = TreeOptionData> {
1111
/**
@@ -45,6 +45,10 @@ export interface TdCascaderProps<CascaderOption extends TreeOptionData = TreeOpt
4545
* @default '选择选项'
4646
*/
4747
placeholder?: string | TNode;
48+
/**
49+
* 懒加载和虚拟滚动。为保证组件收益最大化,当数据量小于阈值 `scroll.threshold` 时,无论虚拟滚动的配置是否存在,组件内部都不会开启虚拟滚动,`scroll.threshold` 默认为 `100`
50+
*/
51+
scroll?: TScroll;
4852
/**
4953
* 每级展示的次标题
5054
* @default []

packages/products/tdesign-react/packages/components/cascader/cascader.en-US.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ defaultPopupVisible | Boolean | - | uncontrolled property | N
3939
prefixIcon | TElement | - | Typescript:`TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
4040
readonly | Boolean | undefined | \- | N
4141
reserveKeyword | Boolean | false | \- | N
42+
scroll | \- | - | Lazy loading and virtual scrolling. To maximize the benefits of the component, when the amount of data is less than the threshold `scroll.threshold`, regardless of whether the virtual scrolling configuration exists, virtual scrolling will not be enabled within the component. `scroll.threshold` defaults to `100`。Typescript:`TScroll`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
4243
selectInputProps | Object | - | Typescript:`SelectInputProps`[SelectInput API Documents](./select-input?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/cascader/type.ts) | N
4344
showAllLevels | Boolean | true | \- | N
4445
size | String | medium | options: large/medium/small。Typescript:`SizeEnum`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N

packages/products/tdesign-react/packages/components/cascader/cascader.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ defaultPopupVisible | Boolean | - | 是否显示下拉框。非受控属性 | N
3939
prefixIcon | TElement | - | 组件前置图标。TS 类型:`TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
4040
readonly | Boolean | undefined | 只读状态,值为真会隐藏输入框,且无法打开下拉框 | N
4141
reserveKeyword | Boolean | false | 多选且可搜索时,是否在选中一个选项后保留当前的搜索关键词 | N
42+
scroll | \- | - | 懒加载和虚拟滚动。为保证组件收益最大化,当数据量小于阈值 `scroll.threshold` 时,无论虚拟滚动的配置是否存在,组件内部都不会开启虚拟滚动,`scroll.threshold` 默认为 `100`。TS 类型:`TScroll`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
4243
selectInputProps | Object | - | 透传 SelectInput 筛选器输入框组件的全部属性。TS 类型:`SelectInputProps`[SelectInput API Documents](./select-input?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/cascader/type.ts) | N
4344
showAllLevels | Boolean | true | 选中值使用完整路径,输入框在单选时也显示完整路径 | N
4445
size | String | medium | 组件尺寸。可选项:large/medium/small。TS 类型:`SizeEnum`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N

0 commit comments

Comments
 (0)