From 9698c26194107b366d370489ec0e89661b98903c Mon Sep 17 00:00:00 2001 From: HaixingOoO <974758671@qq.com> Date: Sun, 29 Dec 2024 01:30:44 +0800 Subject: [PATCH] feat(Radio): radio-group support theme api --- db/TDesign.db | Bin 1007616 -> 1007616 bytes .../tdesign-react/src/radio/defaultProps.ts | 11 +--- .../tdesign-react/src/radio/radio.en-US.md | 1 + .../products/tdesign-react/src/radio/radio.md | 1 + .../products/tdesign-react/src/radio/type.ts | 5 ++ .../src/radio/radio-group-props.ts | 9 ++++ .../tdesign-vue-next/src/radio/radio.en-US.md | 1 + .../tdesign-vue-next/src/radio/radio.md | 1 + .../tdesign-vue-next/src/radio/type.ts | 5 ++ .../src/radio/radio-group-props.ts | 9 ++++ .../tdesign-vue/src/radio/radio.en-US.md | 1 + .../products/tdesign-vue/src/radio/radio.md | 1 + .../products/tdesign-vue/src/radio/type.ts | 5 ++ packages/scripts/api.json | 49 ++++++++++++++++++ 14 files changed, 90 insertions(+), 9 deletions(-) diff --git a/db/TDesign.db b/db/TDesign.db index 0edd9c7fce6353f23bc48d627bc3234788829792..db1685378d307fe8663d97f3330cb34b265b9c1d 100644 GIT binary patch delta 267 zcmZoTVB2uOc7inHvxzd!jL#YqS`!#s6PQ{Pm|GKAS`%1X6WCf4*jp1gS`#>16S!Iv zxLXr=S`&D;Ch#qZXY|?5n!q=UiBW0$f+RkBPDZ!s53>2(*wPCO`1m$$*U90#@tBL5 zua1Ggh@XM4Zo8rZ*96Y(1{*l8veY+n&NXUeoogh?!dMR`6*j)dwY}WahgU<(C$eWTfV%7J;~6LO-drq$EG@`R3;1BGA&gWd){R4*{4)CXN6A diff --git a/packages/products/tdesign-react/src/radio/defaultProps.ts b/packages/products/tdesign-react/src/radio/defaultProps.ts index ff466903..60db7f47 100644 --- a/packages/products/tdesign-react/src/radio/defaultProps.ts +++ b/packages/products/tdesign-react/src/radio/defaultProps.ts @@ -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', }; diff --git a/packages/products/tdesign-react/src/radio/radio.en-US.md b/packages/products/tdesign-react/src/radio/radio.en-US.md index 4fbc440d..7b6aecc8 100644 --- a/packages/products/tdesign-react/src/radio/radio.en-US.md +++ b/packages/products/tdesign-react/src/radio/radio.en-US.md @@ -33,6 +33,7 @@ name | String | - | \- | N options | Array | - | Typescript:`Array` `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 diff --git a/packages/products/tdesign-react/src/radio/radio.md b/packages/products/tdesign-react/src/radio/radio.md index f9b5cbbf..6d03e6c3 100644 --- a/packages/products/tdesign-react/src/radio/radio.md +++ b/packages/products/tdesign-react/src/radio/radio.md @@ -33,6 +33,7 @@ name | String | - | HTML 元素原生属性 | N options | Array | - | 单选组件按钮形式。RadioOption 数据类型为 string 或 number 时,表示 label 和 value 值相同。TS 类型:`Array` `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 diff --git a/packages/products/tdesign-react/src/radio/type.ts b/packages/products/tdesign-react/src/radio/type.ts index 1dc3c428..b09c3528 100644 --- a/packages/products/tdesign-react/src/radio/type.ts +++ b/packages/products/tdesign-react/src/radio/type.ts @@ -86,6 +86,11 @@ export interface TdRadioGroupProps { * @default medium */ size?: SizeEnum; + /** + * 组件风格 + * @default radio + */ + theme?: 'radio' | 'button'; /** * 选中的值 */ diff --git a/packages/products/tdesign-vue-next/src/radio/radio-group-props.ts b/packages/products/tdesign-vue-next/src/radio/radio-group-props.ts index 69cf1f9b..d297e60c 100644 --- a/packages/products/tdesign-vue-next/src/radio/radio-group-props.ts +++ b/packages/products/tdesign-vue-next/src/radio/radio-group-props.ts @@ -38,6 +38,15 @@ export default { return ['small', 'medium', 'large'].includes(val); }, }, + /** 组件风格 */ + theme: { + type: String as PropType, + 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, diff --git a/packages/products/tdesign-vue-next/src/radio/radio.en-US.md b/packages/products/tdesign-vue-next/src/radio/radio.en-US.md index 96367977..09163b71 100644 --- a/packages/products/tdesign-vue-next/src/radio/radio.en-US.md +++ b/packages/products/tdesign-vue-next/src/radio/radio.en-US.md @@ -36,6 +36,7 @@ name | String | - | \- | N options | Array | - | Typescript:`Array` `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 diff --git a/packages/products/tdesign-vue-next/src/radio/radio.md b/packages/products/tdesign-vue-next/src/radio/radio.md index 107e0ade..698743da 100644 --- a/packages/products/tdesign-vue-next/src/radio/radio.md +++ b/packages/products/tdesign-vue-next/src/radio/radio.md @@ -36,6 +36,7 @@ name | String | - | HTML 元素原生属性 | N options | Array | - | 单选组件按钮形式。RadioOption 数据类型为 string 或 number 时,表示 label 和 value 值相同。TS 类型:`Array` `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 diff --git a/packages/products/tdesign-vue-next/src/radio/type.ts b/packages/products/tdesign-vue-next/src/radio/type.ts index 5d70a552..bac6a816 100644 --- a/packages/products/tdesign-vue-next/src/radio/type.ts +++ b/packages/products/tdesign-vue-next/src/radio/type.ts @@ -90,6 +90,11 @@ export interface TdRadioGroupProps { * @default medium */ size?: SizeEnum; + /** + * 组件风格 + * @default radio + */ + theme?: 'radio' | 'button'; /** * 选中的值 */ diff --git a/packages/products/tdesign-vue/src/radio/radio-group-props.ts b/packages/products/tdesign-vue/src/radio/radio-group-props.ts index e6b42c09..f0745c4e 100644 --- a/packages/products/tdesign-vue/src/radio/radio-group-props.ts +++ b/packages/products/tdesign-vue/src/radio/radio-group-props.ts @@ -38,6 +38,15 @@ export default { return ['small', 'medium', 'large'].includes(val); }, }, + /** 组件风格 */ + theme: { + type: String as PropType, + 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, diff --git a/packages/products/tdesign-vue/src/radio/radio.en-US.md b/packages/products/tdesign-vue/src/radio/radio.en-US.md index 477283f6..62ffaeac 100644 --- a/packages/products/tdesign-vue/src/radio/radio.en-US.md +++ b/packages/products/tdesign-vue/src/radio/radio.en-US.md @@ -36,6 +36,7 @@ name | String | - | \- | N options | Array | - | Typescript:`Array` `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 diff --git a/packages/products/tdesign-vue/src/radio/radio.md b/packages/products/tdesign-vue/src/radio/radio.md index 10a6444b..4a6163af 100644 --- a/packages/products/tdesign-vue/src/radio/radio.md +++ b/packages/products/tdesign-vue/src/radio/radio.md @@ -36,6 +36,7 @@ name | String | - | HTML 元素原生属性 | N options | Array | - | 单选组件按钮形式。RadioOption 数据类型为 string 或 number 时,表示 label 和 value 值相同。TS 类型:`Array` `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 diff --git a/packages/products/tdesign-vue/src/radio/type.ts b/packages/products/tdesign-vue/src/radio/type.ts index 1e3594e1..b985787d 100644 --- a/packages/products/tdesign-vue/src/radio/type.ts +++ b/packages/products/tdesign-vue/src/radio/type.ts @@ -85,6 +85,11 @@ export interface TdRadioGroupProps { * @default medium */ size?: SizeEnum; + /** + * 组件风格 + * @default radio + */ + theme?: 'radio' | 'button'; /** * 选中的值 */ diff --git a/packages/scripts/api.json b/packages/scripts/api.json index 30018f8d..e430a90e 100644 --- a/packages/scripts/api.json +++ b/packages/scripts/api.json @@ -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": [