1
- import { default as AntdRadioGroup } from 'antd/es/radio/group' ;
2
- import { RadioStyleType } from 'comps/controls/styleControlConstants' ;
3
- import styled , { css } from 'styled-components' ;
4
- import { UICompBuilder } from '../../generators' ;
5
- import {
6
- CommonNameConfig ,
7
- NameConfig ,
8
- withExposingConfigs ,
9
- } from '../../generators/withExposing' ;
10
- import {
11
- RadioChildrenMap ,
12
- RadioLayoutOptions ,
13
- RadioPropertyView ,
14
- } from './radioCompConstants' ;
1
+ import { default as AntdRadioGroup } from "antd/es/radio/group" ;
2
+ import { RadioStyleType } from "comps/controls/styleControlConstants" ;
3
+ import styled , { css } from "styled-components" ;
4
+ import { UICompBuilder } from "../../generators" ;
5
+ import { CommonNameConfig , NameConfig , withExposingConfigs } from "../../generators/withExposing" ;
6
+ import { RadioChildrenMap , RadioLayoutOptions , RadioPropertyView } from "./radioCompConstants" ;
15
7
import {
16
8
selectDivRefMethods ,
17
9
SelectInputInvalidConfig ,
18
10
useSelectInputValidate ,
19
- } from ' ./selectInputConstants' ;
20
- import { EllipsisTextCss , ValueFromOption } from ' lowcoder-design' ;
21
- import { trans } from ' i18n' ;
22
- import { fixOldInputCompData } from ' ../textInputComp/textInputConstants' ;
23
- import { migrateOldData } from ' comps/generators/simpleGenerators' ;
11
+ } from " ./selectInputConstants" ;
12
+ import { EllipsisTextCss , ValueFromOption } from " lowcoder-design" ;
13
+ import { trans } from " i18n" ;
14
+ import { fixOldInputCompData } from " ../textInputComp/textInputConstants" ;
15
+ import { migrateOldData } from " comps/generators/simpleGenerators" ;
24
16
25
17
const getStyle = ( style : RadioStyleType ) => {
26
18
return css `
@@ -31,12 +23,12 @@ const getStyle = (style: RadioStyleType) => {
31
23
padding : ${ style . padding } ;
32
24
span : not (.ant-radio ) {
33
25
${ EllipsisTextCss } ;
34
- font- family: ${ style . fontFamily } ;
35
- font- size: ${ style . textSize } ;
36
- font- weight: ${ style . textWeight } ;
37
- font- style: ${ style . fontStyle } ;
38
- text- transfor m: ${ style . textTransform } ;
39
- text- decor ation: ${ style . textDecoration } ;
26
+ font- family: ${ style . fontFamily } ;
27
+ font- size: ${ style . textSize } ;
28
+ font- weight: ${ style . textWeight } ;
29
+ font- style: ${ style . fontStyle } ;
30
+ text- transfor m: ${ style . textTransform } ;
31
+ text- decor ation: ${ style . textDecoration } ;
40
32
}
41
33
42
34
.ant-radio-checked {
@@ -53,18 +45,16 @@ const getStyle = (style: RadioStyleType) => {
53
45
.ant-radio-inner {
54
46
background-color : ${ style . uncheckedBackground } ;
55
47
border-color : ${ style . uncheckedBorder } ;
56
- border-width : ${ style . borderWidth } ;
48
+ border-width : ${ style . borderWidth } ;
57
49
& ::after {
58
50
background-color : ${ style . checked } ;
59
51
}
60
52
}
61
53
62
- & : hover .ant-radio-inner ,
54
+ & : hover .ant-radio-inner ,
63
55
.ant-radio : hover .ant-radio-inner ,
64
56
.ant-radio-input + ant-radio-inner {
65
- background-color : ${ style . hoverBackground
66
- ? style . hoverBackground
67
- : '#ffff' } ;
57
+ background-color : ${ style . hoverBackground ? style . hoverBackground :'#ffff' } ;
68
58
}
69
59
70
60
& : hover .ant-radio-inner ,
@@ -85,18 +75,18 @@ const Radio = styled(AntdRadioGroup)<{
85
75
86
76
${ ( props ) => props . $style && getStyle ( props . $style ) }
87
77
${ ( props ) => {
88
- if ( props . $layout === ' horizontal' ) {
78
+ if ( props . $layout === " horizontal" ) {
89
79
return css `
90
80
display : flex;
91
81
align-items : center;
92
82
flex-wrap : wrap;
93
83
` ;
94
- } else if ( props . $layout === ' vertical' ) {
84
+ } else if ( props . $layout === " vertical" ) {
95
85
return css `
96
86
display : flex;
97
87
flex-direction : column;
98
88
` ;
99
- } else if ( props . $layout === ' auto_columns' ) {
89
+ } else if ( props . $layout === " auto_columns" ) {
100
90
return css `
101
91
break-inside : avoid;
102
92
columns : 160px ;
@@ -107,13 +97,16 @@ const Radio = styled(AntdRadioGroup)<{
107
97
108
98
let RadioBasicComp = ( function ( ) {
109
99
return new UICompBuilder ( RadioChildrenMap , ( props ) => {
110
- const [ validateState , handleChange ] = useSelectInputValidate ( props ) ;
100
+ const [
101
+ validateState ,
102
+ handleChange ,
103
+ ] = useSelectInputValidate ( props ) ;
111
104
return props . label ( {
112
105
required : props . required ,
113
106
style : props . style ,
114
107
labelStyle : props . labelStyle ,
115
- inputFieldStyle : props . inputFieldStyle ,
116
- animationStyle : props . animationStyle ,
108
+ inputFieldStyle :props . inputFieldStyle ,
109
+ animationStyle :props . animationStyle ,
117
110
children : (
118
111
< Radio
119
112
ref = { props . viewRef }
@@ -144,7 +137,7 @@ let RadioBasicComp = (function () {
144
137
RadioBasicComp = migrateOldData ( RadioBasicComp , fixOldInputCompData ) ;
145
138
146
139
export const RadioComp = withExposingConfigs ( RadioBasicComp , [
147
- new NameConfig ( ' value' , trans ( ' selectInput.valueDesc' ) ) ,
140
+ new NameConfig ( " value" , trans ( " selectInput.valueDesc" ) ) ,
148
141
SelectInputInvalidConfig ,
149
142
...CommonNameConfig ,
150
143
] ) ;
0 commit comments