Skip to content

Commit

Permalink
feat(select): collapsedItem add onclose param
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn committed Nov 7, 2023
1 parent 97b13d7 commit bff10c2
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 27 deletions.
Binary file modified db/TDesign.db
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/products/tdesign-react/src/select/select.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ autoWidth | Boolean | false | \- | N
autofocus | Boolean | false | \- | N
borderless | Boolean | false | \- | N
clearable | Boolean | false | \- | N
collapsedItems | TElement | - | Typescript:`TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number }>`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
collapsedItems | TElement | - | Typescript:`TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number, onClose: (index: number) => void }>`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
creatable | Boolean | false | \- | N
disabled | Boolean | - | \- | N
empty | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
Expand Down
2 changes: 1 addition & 1 deletion packages/products/tdesign-react/src/select/select.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ autoWidth | Boolean | false | 宽度随内容自适应 | N
autofocus | Boolean | false | 自动聚焦 | N
borderless | Boolean | false | 无边框模式 | N
clearable | Boolean | false | 是否可以清空选项 | N
collapsedItems | TElement | - | 多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedTags` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量。TS 类型:`TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number }>`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
collapsedItems | TElement | - | 多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedTags` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量, `onClose` 表示移除标签。TS 类型:`TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number, onClose: (index: number) => void }>`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
creatable | Boolean | false | 是否允许用户创建新条目,需配合 filterable 使用 | N
disabled | Boolean | - | 是否禁用组件 | N
empty | TNode | - | 当下拉列表为空时显示的内容。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
Expand Down
11 changes: 6 additions & 5 deletions packages/products/tdesign-react/src/select/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ export interface TdSelectProps<T extends SelectOption = SelectOption> {
*/
clearable?: boolean;
/**
* 多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedTags` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量
* 多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedTags` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量, `onClose` 表示移除标签
*/
collapsedItems?: TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number }>;
collapsedItems?: TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number; onClose: (index: number) => void }>;
/**
* 是否允许用户创建新条目,需配合 filterable 使用
* @default false
Expand Down Expand Up @@ -74,7 +74,7 @@ export interface TdSelectProps<T extends SelectOption = SelectOption> {
*/
defaultInputValue?: InputValue;
/**
* 用来定义 value / label 在 `options` 中对应的字段别名
* 用来定义 value / label / disabled 在 `options` 中对应的字段别名
*/
keys?: SelectKeysType;
/**
Expand Down Expand Up @@ -306,8 +306,9 @@ export interface TdOptionGroupProps {
}

export interface SelectKeysType {
value?: string;
label?: string;
value?: string | ((option: SelectOption) => string);
label?: string | ((option: SelectOption) => string);
disabled?: string;
}

export type SelectValue<T extends SelectOption = SelectOption> = string | number | boolean | T | Array<SelectValue<T>>;
Expand Down
4 changes: 2 additions & 2 deletions packages/products/tdesign-vue-next/src/select/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {
borderless: Boolean,
/** 是否可以清空选项 */
clearable: Boolean,
/** 多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedTags` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量 */
/** 多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedTags` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量, `onClose` 表示移除标签 */
collapsedItems: {
type: Function as PropType<TdSelectProps['collapsedItems']>,
},
Expand Down Expand Up @@ -47,7 +47,7 @@ export default {
defaultInputValue: {
type: [String, Number] as PropType<TdSelectProps['defaultInputValue']>,
},
/** 用来定义 value / label 在 `options` 中对应的字段别名 */
/** 用来定义 value / label / disabled 在 `options` 中对应的字段别名 */
keys: {
type: Object as PropType<TdSelectProps['keys']>,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ autoWidth | Boolean | false | \- | N
autofocus | Boolean | false | \- | N
borderless | Boolean | false | \- | N
clearable | Boolean | false | \- | N
collapsedItems | Slot / Function | - | Typescript:`TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number }>`[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
collapsedItems | Slot / Function | - | Typescript:`TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number, onClose: (index: number) => void }>`[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
creatable | Boolean | false | \- | N
disabled | Boolean | - | \- | N
empty | String / Slot / Function | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
Expand Down
2 changes: 1 addition & 1 deletion packages/products/tdesign-vue-next/src/select/select.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ autoWidth | Boolean | false | 宽度随内容自适应 | N
autofocus | Boolean | false | 自动聚焦 | N
borderless | Boolean | false | 无边框模式 | N
clearable | Boolean | false | 是否可以清空选项 | N
collapsedItems | Slot / Function | - | 多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedTags` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量。TS 类型:`TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number }>`[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
collapsedItems | Slot / Function | - | 多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedTags` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量, `onClose` 表示移除标签。TS 类型:`TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number, onClose: (index: number) => void }>`[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
creatable | Boolean | false | 是否允许用户创建新条目,需配合 filterable 使用 | N
disabled | Boolean | - | 是否禁用组件 | N
empty | String / Slot / Function | - | 当下拉列表为空时显示的内容。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
Expand Down
11 changes: 6 additions & 5 deletions packages/products/tdesign-vue-next/src/select/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ export interface TdSelectProps<T extends SelectOption = SelectOption> {
*/
clearable?: boolean;
/**
* 多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedTags` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量
* 多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedTags` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量, `onClose` 表示移除标签
*/
collapsedItems?: TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number }>;
collapsedItems?: TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number; onClose: (index: number) => void }>;
/**
* 是否允许用户创建新条目,需配合 filterable 使用
* @default false
Expand Down Expand Up @@ -73,7 +73,7 @@ export interface TdSelectProps<T extends SelectOption = SelectOption> {
*/
defaultInputValue?: InputValue;
/**
* 用来定义 value / label 在 `options` 中对应的字段别名
* 用来定义 value / label / disabled 在 `options` 中对应的字段别名
*/
keys?: SelectKeysType;
/**
Expand Down Expand Up @@ -304,8 +304,9 @@ export interface TdOptionGroupProps {
}

export interface SelectKeysType {
value?: string;
label?: string;
value?: string | ((option: SelectOption) => string);
label?: string | ((option: SelectOption) => string);
disabled?: string;
}

export type SelectValue<T extends SelectOption = SelectOption> = string | number | boolean | T | Array<SelectValue<T>>;
Expand Down
4 changes: 2 additions & 2 deletions packages/products/tdesign-vue/src/select/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {
borderless: Boolean,
/** 是否可以清空选项 */
clearable: Boolean,
/** 多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedTags` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量 */
/** 多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedTags` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量, `onClose` 表示移除标签 */
collapsedItems: {
type: Function as PropType<TdSelectProps['collapsedItems']>,
},
Expand Down Expand Up @@ -46,7 +46,7 @@ export default {
defaultInputValue: {
type: [String, Number] as PropType<TdSelectProps['defaultInputValue']>,
},
/** 用来定义 value / label 在 `options` 中对应的字段别名 */
/** 用来定义 value / label / disabled 在 `options` 中对应的字段别名 */
keys: {
type: Object as PropType<TdSelectProps['keys']>,
},
Expand Down
2 changes: 1 addition & 1 deletion packages/products/tdesign-vue/src/select/select.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ autoWidth | Boolean | false | \- | N
autofocus | Boolean | false | \- | N
borderless | Boolean | false | \- | N
clearable | Boolean | false | \- | N
collapsedItems | Slot / Function | - | Typescript:`TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number }>`[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
collapsedItems | Slot / Function | - | Typescript:`TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number, onClose: (index: number) => void }>`[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
creatable | Boolean | false | \- | N
disabled | Boolean | - | \- | N
empty | String / Slot / Function | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
Expand Down
2 changes: 1 addition & 1 deletion packages/products/tdesign-vue/src/select/select.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ autoWidth | Boolean | false | 宽度随内容自适应 | N
autofocus | Boolean | false | 自动聚焦 | N
borderless | Boolean | false | 无边框模式 | N
clearable | Boolean | false | 是否可以清空选项 | N
collapsedItems | Slot / Function | - | 多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedTags` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量。TS 类型:`TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number }>`[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
collapsedItems | Slot / Function | - | 多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedTags` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量, `onClose` 表示移除标签。TS 类型:`TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number, onClose: (index: number) => void }>`[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
creatable | Boolean | false | 是否允许用户创建新条目,需配合 filterable 使用 | N
disabled | Boolean | - | 是否禁用组件 | N
empty | String / Slot / Function | - | 当下拉列表为空时显示的内容。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
Expand Down
11 changes: 6 additions & 5 deletions packages/products/tdesign-vue/src/select/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ export interface TdSelectProps<T extends SelectOption = SelectOption> {
*/
clearable?: boolean;
/**
* 多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedTags` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量
* 多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedTags` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量, `onClose` 表示移除标签
*/
collapsedItems?: TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number }>;
collapsedItems?: TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number; onClose: (index: number) => void }>;
/**
* 是否允许用户创建新条目,需配合 filterable 使用
* @default false
Expand Down Expand Up @@ -73,7 +73,7 @@ export interface TdSelectProps<T extends SelectOption = SelectOption> {
*/
defaultInputValue?: InputValue;
/**
* 用来定义 value / label 在 `options` 中对应的字段别名
* 用来定义 value / label / disabled 在 `options` 中对应的字段别名
*/
keys?: SelectKeysType;
/**
Expand Down Expand Up @@ -300,8 +300,9 @@ export interface TdOptionGroupProps {
}

export interface SelectKeysType {
value?: string;
label?: string;
value?: string | ((option: SelectOption) => string);
label?: string | ((option: SelectOption) => string);
disabled?: string;
}

export type SelectValue<T extends SelectOption = SelectOption> = string | number | boolean | T | Array<SelectValue<T>>;
Expand Down
4 changes: 2 additions & 2 deletions packages/scripts/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -81757,14 +81757,14 @@
],
"field_default_value": "",
"field_enum": "",
"field_desc_zh": "多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedTags` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量",
"field_desc_zh": "多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedTags` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量, `onClose` 表示移除标签",
"field_desc_en": null,
"field_required": 0,
"event_input": "",
"create_time": "2021-09-28 05:17:31",
"update_time": "2021-11-20 05:13:40",
"event_output": null,
"custom_field_type": "TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number }>",
"custom_field_type": "TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number, onClose: (index: number) => void }>",
"syntactic_sugar": null,
"readonly": 1,
"html_attribute": 0,
Expand Down

0 comments on commit bff10c2

Please sign in to comment.