Skip to content

Commit

Permalink
feat: add transfer and tree-select keys.disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
PengYYYYY committed Aug 16, 2023
1 parent 96a5015 commit 774dfce
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
9 changes: 4 additions & 5 deletions src/transfer/transfer.en-US.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
:: BASE_DOC ::

## API

### Transfer Props

name | type | default | description | required
Expand All @@ -12,16 +11,16 @@ checkboxProps | Object | - | Typescript:`CheckboxProps`,[Checkbox API Docume
checked | Array | [] | Typescript:`Array<TransferValue>` | N
defaultChecked | Array | [] | uncontrolled property。Typescript:`Array<TransferValue>` | N
data | Array | [] | Typescript:`Array<T>` | N
direction | String | both | optionsleft/right/both | N
disabled | Boolean / Array | false | Typescript:`boolean \| Array<boolean>` | N
direction | String | both | options: left/right/both | N
disabled | Boolean / Array | - | Typescript:`boolean \| Array<boolean>` | N
empty | TNode | '' | Typescript:`EmptyType \| Array<EmptyType> \| TNode` `type EmptyType = string \| TNode `[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/transfer/type.ts) | N
footer | TNode | - | Typescript:`Array<string \| TNode> \| TNode<{ type: TransferListType }>`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
keys | Object | - | Typescript:`KeysType`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
keys | Object | - | alias field name in data。Typescript:`KeysType`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
operation | TNode | - | Typescript:`Array<string \| TNode> \| TNode<{ direction: 'left' \| 'right' }>`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
pagination | Object / Array | - | Typescript:`PaginationProps \| Array<PaginationProps>`[Pagination API Documents](./pagination?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/transfer/type.ts) | N
search | Boolean / Object / Array | false | Typescript:`SearchOption \| Array<SearchOption>` `type SearchOption = boolean \| InputProps`[Input API Documents](./input?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/transfer/type.ts) | N
showCheckAll | Boolean / Array | true | Typescript:`boolean \| Array<boolean>` | N
targetSort | String | original | optionsoriginal/push/unshift | N
targetSort | String | original | options: original/push/unshift | N
title | TNode | [] | Typescript:`Array<TitleType> \| TNode<{ type: TransferListType }>` `type TitleType = string \| TNode` `type TransferListType = 'source' \| 'target'`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/transfer/type.ts) | N
transferItem | TElement | - | Typescript:`TNode<TransferItem<T>>` `interface TransferItem<T extends DataOption = DataOption> { data: T; index: number; type: TransferListType}`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/transfer/type.ts) | N
tree | TElement | 传入 Tree 组件定义树形结构 | Typescript:`(tree: TreeProps) => TNode`[Tree API Documents](./tree?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/transfer/type.ts) | N
Expand Down
4 changes: 2 additions & 2 deletions src/transfer/transfer.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ checked | Array | [] | 数据列表选中项。TS 类型:`Array<TransferValue>
defaultChecked | Array | [] | 数据列表选中项。非受控属性。TS 类型:`Array<TransferValue>` | N
data | Array | [] | 全量数据。TS 类型:`Array<T>` | N
direction | String | both | 穿梭框可操作方向。可选项:left/right/both | N
disabled | Boolean / Array | false | 禁用全部操作:搜索、选中、移动、分页等。[源列表, 目标列表],示例:[true, false] 或者 true。TS 类型:`boolean \| Array<boolean>` | N
disabled | Boolean / Array | - | 禁用全部操作:搜索、选中、移动、分页等。[源列表, 目标列表],示例:[true, false] 或者 true。TS 类型:`boolean \| Array<boolean>` | N
empty | TNode | '' | 列表为空时呈现的内容。值类型为数组,则表示分别控制源列表和目标列表数据为空的呈现内容。TS 类型:`EmptyType \| Array<EmptyType> \| TNode` `type EmptyType = string \| TNode `[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/transfer/type.ts) | N
footer | TNode | - | 穿梭框底部内容。TS 类型:`Array<string \| TNode> \| TNode<{ type: TransferListType }>`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
keys | Object | - | 用来定义选项文本和选项值字段,示例:`{ label: 'text', value: 'id' }`,表示选项文本取 `text` 字段,选项值取 `id` 字段。TS 类型:`KeysType`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
keys | Object | - | 用来定义 value / label / disabled 在 `data` 中对应的字段别名,示例:`{ label: 'text', value: 'id' }`,表示选项文本取 `text` 字段,选项值取 `id` 字段。TS 类型:`KeysType`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
operation | TNode | - | 方向操作按钮。默认显示组件内置操作图标。自定义操作图标示例:['向左', '向右'] 或者 `[() => <i class='left' />, () => <i class='left' />]` 或者 `(h, direction) => direction === 'left' ? '《' : '》'`。TS 类型:`Array<string \| TNode> \| TNode<{ direction: 'left' \| 'right' }>`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
pagination | Object / Array | - | 分页配置,值为空则不显示。具体 API 参考分页组件。值类型为数组,表示可分别控制源列表和目标列表分页组件。TS 类型:`PaginationProps \| Array<PaginationProps>`[Pagination API Documents](./pagination?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/transfer/type.ts) | N
search | Boolean / Object / Array | false | 搜索框配置,值为 false 表示不显示搜索框;值为 true 表示显示默认搜索框;值类型为对象,用于透传 Props 到 Input 组件;值类型为数组,则分别表示控制两侧搜索框。TS 类型:`SearchOption \| Array<SearchOption>` `type SearchOption = boolean \| InputProps`[Input API Documents](./input?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/transfer/type.ts) | N
Expand Down
5 changes: 2 additions & 3 deletions src/transfer/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export interface TdTransferProps<T extends DataOption = DataOption> {
direction?: 'left' | 'right' | 'both';
/**
* 禁用全部操作:搜索、选中、移动、分页等。[源列表, 目标列表],示例:[true, false] 或者 true
* @default false
*/
disabled?: boolean | Array<boolean>;
/**
Expand All @@ -51,7 +50,7 @@ export interface TdTransferProps<T extends DataOption = DataOption> {
*/
footer?: Array<string | TNode> | TNode<{ type: TransferListType }>;
/**
* 用来定义选项文本和选项值字段,示例:`{ label: 'text', value: 'id' }`,表示选项文本取 `text` 字段,选项值取 `id` 字段
* 用来定义 value / label / disabled 在 `data` 中对应的字段别名,示例:`{ label: 'text', value: 'id' }`,表示选项文本取 `text` 字段,选项值取 `id` 字段
*/
keys?: KeysType;
/**
Expand Down Expand Up @@ -153,7 +152,7 @@ export interface SearchContext {
query: string;
type: TransferListType;
trigger: 'input' | 'enter';
e: FormEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>;
e: FormEvent<HTMLInputElement> | KeyboardEvent<HTMLDivElement>;
}

export type DataOption = { label?: string; value?: TransferValue; disabled?: boolean } & Record<string, any>;
Expand Down
2 changes: 1 addition & 1 deletion src/tree-select/tree-select.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ filterable | Boolean | false | 是否可搜索 | N
inputProps | Object | - | 透传给 输入框 Input 组件的全部属性。TS 类型:`InputProps`[Input API Documents](./input?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/tree-select/type.ts) | N
inputValue | String / Number | - | 输入框的值。TS 类型:`InputValue`[Input API Documents](./input?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/tree-select/type.ts) | N
defaultInputValue | String / Number | - | 输入框的值。非受控属性。TS 类型:`InputValue`[Input API Documents](./input?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/tree-select/type.ts) | N
keys | Object | - | 用来定义 `value / label / disabled / children``data` 数据中对应的字段别名,示例:`{ value: 'key', label: 'name', children: 'list' }`。TS 类型:`TreeKeysType`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
keys | Object | - | 用来定义 `value / label / disabled / children``data` 数据中对应的字段别名,示例:`{ value: 'key', label 'name', children: 'list' }`。TS 类型:`TreeKeysType`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
label | TNode | - | 左侧文本。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
loading | Boolean | false | 是否正在加载数据 | N
loadingText | TNode | - | 远程加载时显示的文字,支持自定义。如加上超链接。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
Expand Down
6 changes: 3 additions & 3 deletions src/tree-select/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { InputValue } from '../input';
import { PopupProps } from '../popup';
import { SelectInputProps, SelectInputBlurContext, SelectInputValueChangeContext } from '../select-input';
import { TagProps } from '../tag';
import { TreeProps, TreeNodeModel, TreeKeysType } from '../tree';
import { TreeProps, TreeNodeModel } from '../tree';
import { PopupTriggerEvent, PopupTriggerSource } from '../popup';
import { TNode, TElement, TreeOptionData } from '../common';
import { TNode, TElement, TreeOptionData, TreeKeysType } from '../common';
import { MouseEvent, KeyboardEvent, FocusEvent } from 'react';

export interface TdTreeSelectProps<
Expand Down Expand Up @@ -77,7 +77,7 @@ export interface TdTreeSelectProps<
*/
defaultInputValue?: InputValue;
/**
* 用来定义 `value / label / disabled / children` 在 `data` 数据中对应的字段别名,示例:`{ value: 'key', label: 'name', children: 'list' }`
* 用来定义 `value / label / disabled / children` 在 `data` 数据中对应的字段别名,示例:`{ value: 'key', label 'name', children: 'list' }`
*/
keys?: TreeKeysType;
/**
Expand Down

0 comments on commit 774dfce

Please sign in to comment.