Skip to content

Commit

Permalink
feat(Radio): radio-group support theme api
Browse files Browse the repository at this point in the history
  • Loading branch information
HaixingOoO committed Dec 28, 2024
1 parent 8f746ac commit 9698c26
Show file tree
Hide file tree
Showing 14 changed files with 90 additions and 9 deletions.
Binary file modified db/TDesign.db
Binary file not shown.
11 changes: 2 additions & 9 deletions packages/products/tdesign-react/src/radio/defaultProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,13 @@
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdRadioProps, TdRadioGroupProps } from './type';

export const radioDefaultProps: TdRadioProps = {
allowUncheck: false,
defaultChecked: false,
disabled: undefined,
readonly: undefined,
value: undefined,
};
import { TdRadioGroupProps } from './type';

export const radioGroupDefaultProps: TdRadioGroupProps = {
allowUncheck: false,
disabled: undefined,
readonly: undefined,
size: 'medium',
theme: 'radio',
variant: 'outline',
};
1 change: 1 addition & 0 deletions packages/products/tdesign-react/src/radio/radio.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ name | String | - | \- | N
options | Array | - | Typescript:`Array<RadioOption>` `type RadioOption = string \| number \| RadioOptionObj` `interface RadioOptionObj { label?: string \| TNode; value?: string \| number \| boolean; disabled?: boolean }`[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/radio/type.ts) | N
readonly | Boolean | undefined | \- | N
size | String | medium | options: small/medium/large。Typescript:`SizeEnum`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
theme | String | radio | component Style。options: radio/button | N
value | String / Number / Boolean | - | Typescript:`T` `type RadioValue = string \| number \| boolean`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/radio/type.ts) | N
defaultValue | String / Number / Boolean | - | uncontrolled property。Typescript:`T` `type RadioValue = string \| number \| boolean`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/radio/type.ts) | N
variant | String | outline | options: outline/primary-filled/default-filled | N
Expand Down
1 change: 1 addition & 0 deletions packages/products/tdesign-react/src/radio/radio.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ name | String | - | HTML 元素原生属性 | N
options | Array | - | 单选组件按钮形式。RadioOption 数据类型为 string 或 number 时,表示 label 和 value 值相同。TS 类型:`Array<RadioOption>` `type RadioOption = string \| number \| RadioOptionObj` `interface RadioOptionObj { label?: string \| TNode; value?: string \| number \| boolean; disabled?: boolean }`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/radio/type.ts) | N
readonly | Boolean | undefined | 只读状态 | N
size | String | medium | 组件尺寸【讨论中】。可选项:small/medium/large。TS 类型:`SizeEnum`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
theme | String | radio | 组件风格。可选项:radio/button | N
value | String / Number / Boolean | - | 选中的值。TS 类型:`T` `type RadioValue = string \| number \| boolean`[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/radio/type.ts) | N
defaultValue | String / Number / Boolean | - | 选中的值。非受控属性。TS 类型:`T` `type RadioValue = string \| number \| boolean`[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/radio/type.ts) | N
variant | String | outline | 单选组件按钮形式。可选项:outline/primary-filled/default-filled | N
Expand Down
5 changes: 5 additions & 0 deletions packages/products/tdesign-react/src/radio/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ export interface TdRadioGroupProps<T = RadioValue> {
* @default medium
*/
size?: SizeEnum;
/**
* 组件风格
* @default radio
*/
theme?: 'radio' | 'button';
/**
* 选中的值
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ export default {
return ['small', 'medium', 'large'].includes(val);
},
},
/** 组件风格 */
theme: {
type: String as PropType<TdRadioGroupProps['theme']>,
default: 'radio' as TdRadioGroupProps['theme'],
validator(val: TdRadioGroupProps['theme']): boolean {
if (!val) return true;
return ['radio', 'button'].includes(val);
},
},
/** 选中的值 */
value: {
type: [String, Number, Boolean] as PropType<TdRadioGroupProps['value']>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ name | String | - | \- | N
options | Array | - | Typescript:`Array<RadioOption>` `type RadioOption = string \| number \| RadioOptionObj` `interface RadioOptionObj { label?: string \| TNode; value?: string \| number \| boolean; disabled?: boolean }`[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts)[see more ts definition](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/radio/type.ts) | N
readonly | Boolean | undefined | \- | N
size | String | medium | options: small/medium/large。Typescript:`SizeEnum`[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
theme | String | radio | component Style。options: radio/button | N
value | String / Number / Boolean | - | `v-model` and `v-model:value` is supported。Typescript:`T` `type RadioValue = string \| number \| boolean`[see more ts definition](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/radio/type.ts) | N
defaultValue | String / Number / Boolean | - | uncontrolled property。Typescript:`T` `type RadioValue = string \| number \| boolean`[see more ts definition](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/radio/type.ts) | N
variant | String | outline | options: outline/primary-filled/default-filled | N
Expand Down
1 change: 1 addition & 0 deletions packages/products/tdesign-vue-next/src/radio/radio.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ name | String | - | HTML 元素原生属性 | N
options | Array | - | 单选组件按钮形式。RadioOption 数据类型为 string 或 number 时,表示 label 和 value 值相同。TS 类型:`Array<RadioOption>` `type RadioOption = string \| number \| RadioOptionObj` `interface RadioOptionObj { label?: string \| TNode; value?: string \| number \| boolean; disabled?: boolean }`[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts)[详细类型定义](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/radio/type.ts) | N
readonly | Boolean | undefined | 只读状态 | N
size | String | medium | 组件尺寸【讨论中】。可选项:small/medium/large。TS 类型:`SizeEnum`[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
theme | String | radio | 组件风格。可选项:radio/button | N
value | String / Number / Boolean | - | 选中的值。支持语法糖 `v-model``v-model:value`。TS 类型:`T` `type RadioValue = string \| number \| boolean`[详细类型定义](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/radio/type.ts) | N
defaultValue | String / Number / Boolean | - | 选中的值。非受控属性。TS 类型:`T` `type RadioValue = string \| number \| boolean`[详细类型定义](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/radio/type.ts) | N
variant | String | outline | 单选组件按钮形式。可选项:outline/primary-filled/default-filled | N
Expand Down
5 changes: 5 additions & 0 deletions packages/products/tdesign-vue-next/src/radio/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ export interface TdRadioGroupProps<T = RadioValue> {
* @default medium
*/
size?: SizeEnum;
/**
* 组件风格
* @default radio
*/
theme?: 'radio' | 'button';
/**
* 选中的值
*/
Expand Down
9 changes: 9 additions & 0 deletions packages/products/tdesign-vue/src/radio/radio-group-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ export default {
return ['small', 'medium', 'large'].includes(val);
},
},
/** 组件风格 */
theme: {
type: String as PropType<TdRadioGroupProps['theme']>,
default: 'radio' as TdRadioGroupProps['theme'],
validator(val: TdRadioGroupProps['theme']): boolean {
if (!val) return true;
return ['radio', 'button'].includes(val);
},
},
/** 选中的值 */
value: {
type: [String, Number, Boolean] as PropType<TdRadioGroupProps['value']>,
Expand Down
1 change: 1 addition & 0 deletions packages/products/tdesign-vue/src/radio/radio.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ name | String | - | \- | N
options | Array | - | Typescript:`Array<RadioOption>` `type RadioOption = string \| number \| RadioOptionObj` `interface RadioOptionObj { label?: string \| TNode; value?: string \| number \| boolean; disabled?: boolean }`[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts)[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/radio/type.ts) | N
readonly | Boolean | undefined | \- | N
size | String | medium | options: small/medium/large。Typescript:`SizeEnum`[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
theme | String | radio | component Style。options: radio/button | N
value | String / Number / Boolean | - | `v-model` is supported。Typescript:`T` `type RadioValue = string \| number \| boolean`[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/radio/type.ts) | N
defaultValue | String / Number / Boolean | - | uncontrolled property。Typescript:`T` `type RadioValue = string \| number \| boolean`[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/radio/type.ts) | N
variant | String | outline | options: outline/primary-filled/default-filled | N
Expand Down
1 change: 1 addition & 0 deletions packages/products/tdesign-vue/src/radio/radio.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ name | String | - | HTML 元素原生属性 | N
options | Array | - | 单选组件按钮形式。RadioOption 数据类型为 string 或 number 时,表示 label 和 value 值相同。TS 类型:`Array<RadioOption>` `type RadioOption = string \| number \| RadioOptionObj` `interface RadioOptionObj { label?: string \| TNode; value?: string \| number \| boolean; disabled?: boolean }`[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts)[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/radio/type.ts) | N
readonly | Boolean | undefined | 只读状态 | N
size | String | medium | 组件尺寸【讨论中】。可选项:small/medium/large。TS 类型:`SizeEnum`[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
theme | String | radio | 组件风格。可选项:radio/button | N
value | String / Number / Boolean | - | 选中的值。支持语法糖 `v-model`。TS 类型:`T` `type RadioValue = string \| number \| boolean`[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/radio/type.ts) | N
defaultValue | String / Number / Boolean | - | 选中的值。非受控属性。TS 类型:`T` `type RadioValue = string \| number \| boolean`[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/radio/type.ts) | N
variant | String | outline | 单选组件按钮形式。可选项:outline/primary-filled/default-filled | N
Expand Down
5 changes: 5 additions & 0 deletions packages/products/tdesign-vue/src/radio/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ export interface TdRadioGroupProps<T = RadioValue> {
* @default medium
*/
size?: SizeEnum;
/**
* 组件风格
* @default radio
*/
theme?: 'radio' | 'button';
/**
* 选中的值
*/
Expand Down
49 changes: 49 additions & 0 deletions packages/scripts/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -90352,6 +90352,55 @@
"String"
]
},
{
"id": 1735405582,
"platform_framework": [
"1",
"2",
"4",
"8",
"16",
"32",
"64"
],
"component": "RadioGroup",
"field_category": 1,
"field_name": "theme",
"field_type": [
"1"
],
"field_default_value": "radio",
"field_enum": "radio/button",
"field_desc_zh": "组件风格",
"field_desc_en": "component Style",
"field_required": 0,
"event_input": "",
"create_time": "2024-12-28 17:06:22",
"update_time": "2024-12-28 17:06:22",
"event_output": null,
"custom_field_type": "",
"syntactic_sugar": null,
"readonly": 1,
"html_attribute": 0,
"trigger_elements": "",
"deprecated": 0,
"version": "",
"test_description": null,
"support_default_value": 0,
"field_category_text": "Props",
"platform_framework_text": [
"Vue(PC)",
"React(PC)",
"Angular(PC)",
"Vue(Mobile)",
"React(Mobile)",
"Angular(Mobile)",
"Miniprogram"
],
"field_type_text": [
"String"
]
},
{
"id": 495,
"platform_framework": [
Expand Down

0 comments on commit 9698c26

Please sign in to comment.