fix: Radios组件labelClassName => optionClassName (#4665)

This commit is contained in:
RUNZE LU 2022-06-20 21:14:46 +08:00 committed by GitHub
parent 41d98c8772
commit 55e56be85e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 10 deletions

View File

@ -45,11 +45,12 @@ order: 36
当做选择器表单项使用时,除了支持 [普通表单项属性表](./formitem#%E5%B1%9E%E6%80%A7%E8%A1%A8) 中的配置以外,还支持下面一些配置
| 属性名 | 类型 | 默认值 | 说明 |
| ------------ | ----------------------------------------- | --------- | ------------------------------------------------------------------------------------------- |
| options | `Array<object>`或`Array<string>` | | [选项组](./options#%E9%9D%99%E6%80%81%E9%80%89%E9%A1%B9%E7%BB%84-options) |
| source | `string`或 [API](../../../docs/types/api) | | [动态选项组](./options#%E5%8A%A8%E6%80%81%E9%80%89%E9%A1%B9%E7%BB%84-source) |
| labelField | `boolean` | `"label"` | [选项标签字段](./options#%E9%80%89%E9%A1%B9%E6%A0%87%E7%AD%BE%E5%AD%97%E6%AE%B5-labelfield) |
| valueField | `boolean` | `"value"` | [选项值字段](./options#%E9%80%89%E9%A1%B9%E5%80%BC%E5%AD%97%E6%AE%B5-valuefield) |
| columnsCount | `number` | `1` | 选项按几列显示,默认为一列 |
| autoFill | `object` | | [自动填充](./options#%E8%87%AA%E5%8A%A8%E5%A1%AB%E5%85%85-autofill) |
| 属性名 | 类型 | 默认值 | 说明 |
| --------------- | ----------------------------------------- | --------- | ------------------------------------------------------------------------------------------- |
| options | `Array<object>`或`Array<string>` | | [选项组](./options#%E9%9D%99%E6%80%81%E9%80%89%E9%A1%B9%E7%BB%84-options) |
| source | `string`或 [API](../../../docs/types/api) | | [动态选项组](./options#%E5%8A%A8%E6%80%81%E9%80%89%E9%A1%B9%E7%BB%84-source) |
| labelField | `boolean` | `"label"` | [选项标签字段](./options#%E9%80%89%E9%A1%B9%E6%A0%87%E7%AD%BE%E5%AD%97%E6%AE%B5-labelfield) |
| valueField | `boolean` | `"value"` | [选项值字段](./options#%E9%80%89%E9%A1%B9%E5%80%BC%E5%AD%97%E6%AE%B5-valuefield) |
| columnsCount | `number` | `1` | 选项按几列显示,默认为一列 |
| autoFill | `object` | | [自动填充](./options#%E8%87%AA%E5%8A%A8%E5%A1%AB%E5%85%85-autofill) |
| optionClassName | `string` | | 选项 CSS 类名 |

View File

@ -27,8 +27,13 @@ export interface RadiosControlSchema extends FormOptionsSchema {
export interface RadiosProps extends OptionsControlProps {
placeholder?: any;
columnsCount?: number;
labelClassName?: string;
labelField?: string;
/**
* @deprecated checkbox的labelClassName有冲突optionClassName代替
*/
labelClassName?: string;
/** 选项CSS类名 */
optionClassName?: string;
}
export default class RadiosControl extends React.Component<RadiosProps, any> {
@ -100,6 +105,7 @@ export default class RadiosControl extends React.Component<RadiosProps, any> {
classPrefix,
itemClassName,
labelClassName,
optionClassName,
labelField,
valueField,
translate: __,
@ -117,7 +123,8 @@ export default class RadiosControl extends React.Component<RadiosProps, any> {
joinValues={joinValues}
extractValue={extractValue!}
delimiter={delimiter!}
labelClassName={labelClassName}
/** 兼容一下错误的用法 */
labelClassName={optionClassName ?? labelClassName}
labelField={labelField}
valueField={valueField}
placeholder={__(placeholder)}