1
- import { default as AntdCheckboxGroup } from 'antd/es/checkbox/Group' ;
2
- import { SelectInputOptionControl } from 'comps/controls/optionsControl' ;
3
- import { BoolCodeControl } from '../../controls/codeControl' ;
4
- import { arrayStringExposingStateControl } from '../../controls/codeStateControl' ;
5
- import { LabelControl } from '../../controls/labelControl' ;
6
- import { ChangeEventHandlerControl } from '../../controls/eventHandlerControl' ;
7
- import { UICompBuilder } from '../../generators' ;
8
- import {
9
- CommonNameConfig ,
10
- NameConfig ,
11
- withExposingConfigs ,
12
- } from '../../generators/withExposing' ;
13
- import styled , { css } from 'styled-components' ;
1
+ import { default as AntdCheckboxGroup } from "antd/es/checkbox/Group" ;
2
+ import { SelectInputOptionControl } from "comps/controls/optionsControl" ;
3
+ import { BoolCodeControl } from "../../controls/codeControl" ;
4
+ import { arrayStringExposingStateControl } from "../../controls/codeStateControl" ;
5
+ import { LabelControl } from "../../controls/labelControl" ;
6
+ import { ChangeEventHandlerControl } from "../../controls/eventHandlerControl" ;
7
+ import { UICompBuilder } from "../../generators" ;
8
+ import { CommonNameConfig , NameConfig , withExposingConfigs } from "../../generators/withExposing" ;
9
+ import styled , { css } from "styled-components" ;
14
10
import {
15
11
selectDivRefMethods ,
16
12
SelectInputInvalidConfig ,
17
13
SelectInputValidationChildren ,
18
14
useSelectInputValidate ,
19
- } from './selectInputConstants' ;
20
- import { formDataChildren } from '../formComp/formDataConstants' ;
21
- import { styleControl } from 'comps/controls/styleControl' ;
22
- import {
23
- AnimationStyle ,
24
- CheckboxStyle ,
25
- CheckboxStyleType ,
26
- InputFieldStyle ,
27
- LabelStyle ,
28
- } from 'comps/controls/styleControlConstants' ;
29
- import { RadioLayoutOptions , RadioPropertyView } from './radioCompConstants' ;
30
- import { dropdownControl } from '../../controls/dropdownControl' ;
31
- import { ValueFromOption } from 'lowcoder-design' ;
32
- import { EllipsisTextCss } from 'lowcoder-design' ;
33
- import { trans } from 'i18n' ;
34
- import { RefControl } from 'comps/controls/refControl' ;
35
- import { migrateOldData } from 'comps/generators/simpleGenerators' ;
36
- import { fixOldInputCompData } from '../textInputComp/textInputConstants' ;
15
+ } from "./selectInputConstants" ;
16
+ import { formDataChildren } from "../formComp/formDataConstants" ;
17
+ import { styleControl } from "comps/controls/styleControl" ;
18
+ import { AnimationStyle , CheckboxStyle , CheckboxStyleType , InputFieldStyle , LabelStyle } from "comps/controls/styleControlConstants" ;
19
+ import { RadioLayoutOptions , RadioPropertyView } from "./radioCompConstants" ;
20
+ import { dropdownControl } from "../../controls/dropdownControl" ;
21
+ import { ValueFromOption } from "lowcoder-design" ;
22
+ import { EllipsisTextCss } from "lowcoder-design" ;
23
+ import { trans } from "i18n" ;
24
+ import { RefControl } from "comps/controls/refControl" ;
25
+ import { migrateOldData } from "comps/generators/simpleGenerators" ;
26
+ import { fixOldInputCompData } from "../textInputComp/textInputConstants" ;
37
27
38
28
export const getStyle = ( style : CheckboxStyleType ) => {
39
29
return css `
@@ -50,7 +40,7 @@ export const getStyle = (style: CheckboxStyleType) => {
50
40
.ant-checkbox-inner {
51
41
background-color : ${ style . checkedBackground } ;
52
42
border-color : ${ style . checkedBackground } ;
53
- border-width : ${ ! ! style . borderWidth ? style . borderWidth : '2px' } ;
43
+ border-width : ${ ! ! style . borderWidth ? style . borderWidth : '2px' } ;
54
44
55
45
& ::after {
56
46
border-color : ${ style . checked } ;
@@ -59,49 +49,47 @@ export const getStyle = (style: CheckboxStyleType) => {
59
49
60
50
& ::after {
61
51
border-color : ${ style . checkedBackground } ;
62
- border-width : ${ ! ! style . borderWidth ? style . borderWidth : '2px' } ;
52
+ border-width : ${ ! ! style . borderWidth ? style . borderWidth : '2px' } ;
63
53
border-radius : ${ style . radius } ;
64
54
}
65
55
}
66
-
56
+
67
57
.ant-checkbox-inner {
68
58
border-radius : ${ style . radius } ;
69
59
background-color : ${ style . uncheckedBackground } ;
70
60
border-color : ${ style . uncheckedBorder } ;
71
- border-width : ${ ! ! style . borderWidth ? style . borderWidth : '2px' } ;
61
+ border-width : ${ ! ! style . borderWidth ? style . borderWidth : '2px' } ;
72
62
}
73
-
74
- & : hover .ant-checkbox-inner ,
63
+
64
+ & : hover .ant-checkbox-inner ,
75
65
.ant-checkbox : hover .ant-checkbox-inner ,
76
66
.ant-checkbox-input + ant-checkbox-inner {
77
- background-color : ${ style . hoverBackground
78
- ? style . hoverBackground
79
- : '#fff' } ;
67
+ background-color : ${ style . hoverBackground ? style . hoverBackground : '#fff' } ;
80
68
}
81
69
82
- & : hover .ant-checkbox-checked .ant-checkbox-inner ,
70
+ & : hover .ant-checkbox-checked .ant-checkbox-inner ,
83
71
.ant-checkbox : hover .ant-checkbox-inner ,
84
72
.ant-checkbox-input + ant-checkbox-inner {
85
- background-color : ${ style . hoverBackground
86
- ? style . hoverBackground
87
- : '#ffff' } ;
73
+ background-color : ${ style . hoverBackground ? style . hoverBackground : '#ffff' } ;
88
74
}
89
75
90
76
& : hover .ant-checkbox-inner ,
91
77
.ant-checkbox : hover .ant-checkbox-inner ,
92
78
.ant-checkbox-input : focus + .ant-checkbox-inner {
93
79
border-color : ${ style . checkedBackground } ;
94
- border-width : ${ ! ! style . borderWidth ? style . borderWidth : '2px' } ;
80
+ border-width : ${ ! ! style . borderWidth ? style . borderWidth : '2px' } ;
95
81
}
96
82
}
97
83
84
+
85
+
98
86
.ant-checkbox-group-item {
99
- font-family : ${ style . fontFamily } ;
100
- font-size : ${ style . textSize } ;
101
- font-weight : ${ style . textWeight } ;
102
- font-style : ${ style . fontStyle } ;
103
- text-transform : ${ style . textTransform } ;
104
- text-decoration : ${ style . textDecoration } ;
87
+ font-family : ${ style . fontFamily } ;
88
+ font-size : ${ style . textSize } ;
89
+ font-weight : ${ style . textWeight } ;
90
+ font-style : ${ style . fontStyle } ;
91
+ text-transform : ${ style . textTransform } ;
92
+ text-decoration : ${ style . textDecoration } ;
105
93
}
106
94
.ant-checkbox-wrapper {
107
95
padding : ${ style . padding } ;
@@ -113,25 +101,25 @@ export const getStyle = (style: CheckboxStyleType) => {
113
101
` ;
114
102
} ;
115
103
116
- const CheckboxGroup = styled ( AntdCheckboxGroup ) < {
104
+ const CheckboxGroup = styled ( AntdCheckboxGroup ) < {
117
105
$style : CheckboxStyleType ;
118
106
$layout : ValueFromOption < typeof RadioLayoutOptions > ;
119
107
} > `
120
108
min-height: 32px;
121
109
${ ( props ) => props . $style && getStyle ( props . $style ) }
122
110
${ ( props ) => {
123
- if ( props . $layout === ' horizontal' ) {
111
+ if ( props . $layout === " horizontal" ) {
124
112
return css `
125
113
display : flex;
126
114
align-items : center;
127
115
flex-wrap : wrap;
128
116
` ;
129
- } else if ( props . $layout === ' vertical' ) {
117
+ } else if ( props . $layout === " vertical" ) {
130
118
return css `
131
119
display : flex;
132
120
flex-direction : column;
133
121
` ;
134
- } else if ( props . $layout === ' auto_columns' ) {
122
+ } else if ( props . $layout === " auto_columns" ) {
135
123
return css `
136
124
break-inside : avoid;
137
125
columns : 160px ;
@@ -142,33 +130,32 @@ const CheckboxGroup = styled(AntdCheckboxGroup)<{
142
130
143
131
let CheckboxBasicComp = ( function ( ) {
144
132
const childrenMap = {
145
- defaultValue : arrayStringExposingStateControl ( ' defaultValue' ) ,
146
- value : arrayStringExposingStateControl ( ' value' ) ,
133
+ defaultValue : arrayStringExposingStateControl ( " defaultValue" ) ,
134
+ value : arrayStringExposingStateControl ( " value" ) ,
147
135
label : LabelControl ,
148
136
disabled : BoolCodeControl ,
149
137
onEvent : ChangeEventHandlerControl ,
150
138
options : SelectInputOptionControl ,
151
139
style : styleControl ( InputFieldStyle ) ,
152
- labelStyle : styleControl (
153
- LabelStyle . filter (
154
- ( style ) => [ 'accent' , 'validate' ] . includes ( style . name ) === false
155
- )
156
- ) ,
157
- layout : dropdownControl ( RadioLayoutOptions , 'horizontal' ) ,
140
+ labelStyle : styleControl ( LabelStyle . filter ( ( style ) => [ 'accent' , 'validate' ] . includes ( style . name ) === false ) ) ,
141
+ layout : dropdownControl ( RadioLayoutOptions , "horizontal" ) ,
158
142
viewRef : RefControl < HTMLDivElement > ,
159
- inputFieldStyle : styleControl ( CheckboxStyle ) ,
160
- animationStyle : styleControl ( AnimationStyle ) ,
143
+ inputFieldStyle :styleControl ( CheckboxStyle ) ,
144
+ animationStyle :styleControl ( AnimationStyle ) ,
161
145
...SelectInputValidationChildren ,
162
146
...formDataChildren ,
163
147
} ;
164
148
return new UICompBuilder ( childrenMap , ( props ) => {
165
- const [ validateState , handleChange ] = useSelectInputValidate ( props ) ;
149
+ const [
150
+ validateState ,
151
+ handleChange ,
152
+ ] = useSelectInputValidate ( props ) ;
166
153
return props . label ( {
167
154
required : props . required ,
168
155
style : props . style ,
169
156
labelStyle : props . labelStyle ,
170
- inputFieldStyle : props . inputFieldStyle ,
171
- animationStyle : props . animationStyle ,
157
+ inputFieldStyle :props . inputFieldStyle ,
158
+ animationStyle :props . animationStyle ,
172
159
children : (
173
160
< CheckboxGroup
174
161
ref = { props . viewRef }
@@ -199,7 +186,7 @@ let CheckboxBasicComp = (function () {
199
186
CheckboxBasicComp = migrateOldData ( CheckboxBasicComp , fixOldInputCompData ) ;
200
187
201
188
export const CheckboxComp = withExposingConfigs ( CheckboxBasicComp , [
202
- new NameConfig ( ' value' , trans ( ' selectInput.valueDesc' ) ) ,
189
+ new NameConfig ( " value" , trans ( " selectInput.valueDesc" ) ) ,
203
190
SelectInputInvalidConfig ,
204
191
...CommonNameConfig ,
205
192
] ) ;
0 commit comments