File tree 1 file changed +20
-9
lines changed
packages/form/src/components/Rate
1 file changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import type { RateProps } from 'antd';
2
2
import React from 'react' ;
3
3
import type { ProFormFieldItemProps } from '../../typing' ;
4
4
import ProField from '../Field' ;
5
+ import { ProConfigProvider } from '@ant-design/pro-provider' ;
6
+ import { FieldRate } from '@ant-design/pro-field' ;
5
7
/**
6
8
* 评分组件
7
9
*
@@ -12,16 +14,25 @@ const ProFormRate: React.ForwardRefRenderFunction<
12
14
ProFormFieldItemProps < RateProps >
13
15
> = ( { fieldProps, proFieldProps, ...rest } , ref ) => {
14
16
return (
15
- < ProField
16
- valueType = "rate"
17
- fieldProps = { fieldProps }
18
- ref = { ref }
19
- proFieldProps = { proFieldProps }
20
- filedConfig = { {
21
- ignoreWidth : true ,
17
+ < ProConfigProvider
18
+ valueTypeMap = { {
19
+ rate : {
20
+ render : ( text , props ) => < FieldRate { ...props } text = { text } /> ,
21
+ formItemRender : ( text , props ) => < FieldRate { ...props } text = { text } /> ,
22
+ } ,
22
23
} }
23
- { ...rest }
24
- />
24
+ >
25
+ < ProField
26
+ valueType = "rate"
27
+ fieldProps = { fieldProps }
28
+ ref = { ref }
29
+ proFieldProps = { proFieldProps }
30
+ filedConfig = { {
31
+ ignoreWidth : true ,
32
+ } }
33
+ { ...rest }
34
+ />
35
+ </ ProConfigProvider >
25
36
) ;
26
37
} ;
27
38
You can’t perform that action at this time.
0 commit comments