File tree Expand file tree Collapse file tree 5 files changed +23
-18
lines changed Expand file tree Collapse file tree 5 files changed +23
-18
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ const Demo2 = () => {
35
35
< Form
36
36
divider
37
37
labelPosition = "left"
38
+ starPosition = "right"
38
39
onFinish = { ( values ) => submitSucceed ( values ) }
39
40
onFinishFailed = { ( values , errors ) => submitFailed ( errors ) }
40
41
footer = {
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ const Demo2 = () => {
35
35
< Form
36
36
divider
37
37
labelPosition = "left"
38
+ starPosition = "right"
38
39
onFinish = { ( values ) => submitSucceed ( values ) }
39
40
onFinishFailed = { ( values , errors ) => submitFailed ( errors ) }
40
41
footer = {
Original file line number Diff line number Diff line change 18
18
word-wrap : break-word ;
19
19
text-align : $form-item-label-text-align ;
20
20
line-height : unset ;
21
- }
22
21
23
- & -label-required {
24
- color : $form-item-required-color ;
25
- margin-right : $form-item-required-margin-right ;
26
- display : block ;
27
- position : absolute ;
28
- left : -10px ;
22
+ & -left-required {
23
+ color : $form-item-required-color ;
24
+ margin-right : $form-item-required-margin-right ;
25
+ position : absolute ;
26
+ left : -10px ;
27
+ }
28
+
29
+ & -right-required {
30
+ color : $form-item-required-color ;
31
+ margin-left : $form-item-required-margin-right ;
32
+ position : absolute ;
33
+ right : -10px ;
34
+ }
29
35
}
30
36
31
37
.nut-form-item-labeltxt {
136
142
white-space : nowrap ;
137
143
}
138
144
139
- .nut-form-item-label-left-required {
140
- display : block ;
141
- line-height : 1.5 ;
142
- position : absolute ;
143
- left : 0.1em ;
144
- }
145
-
146
145
.nut-form-item-top {
147
146
flex-direction : column ;
148
147
align-items : flex-start ;
Original file line number Diff line number Diff line change @@ -189,15 +189,17 @@ export class FormItem extends React.Component<
189
189
190
190
const { starPosition } = this . context . formInstance
191
191
const renderStar = ( required || requiredInRules ) && (
192
- < Text className = "nut-form-item-label-required required" > *</ Text >
192
+ < Text className = { `nut-form-item-label-${ starPosition } -required required` } >
193
+ *
194
+ </ Text >
193
195
)
194
196
const renderLabel = (
195
197
< >
196
198
< Text className = "nut-form-item-labeltxt" >
197
199
{ starPosition === 'left' ? renderStar : null }
198
200
{ label }
201
+ { starPosition === 'right' ? renderStar : null }
199
202
</ Text >
200
- { starPosition === 'right' ? renderStar : null }
201
203
</ >
202
204
)
203
205
return (
Original file line number Diff line number Diff line change @@ -197,15 +197,17 @@ export class FormItem extends React.Component<
197
197
198
198
const { starPosition } = this . context . formInstance
199
199
const renderStar = ( required || requiredInRules ) && (
200
- < div className = "nut-form-item-label-required required" > *</ div >
200
+ < span className = { `nut-form-item-label-${ starPosition } -required required` } >
201
+ *
202
+ </ span >
201
203
)
202
204
const renderLabel = (
203
205
< >
204
206
< span className = "nut-form-item-labeltxt" >
205
207
{ starPosition === 'left' ? renderStar : null }
206
208
{ label }
209
+ { starPosition === 'right' ? renderStar : null }
207
210
</ span >
208
- { starPosition === 'right' ? renderStar : null }
209
211
</ >
210
212
)
211
213
return (
You can’t perform that action at this time.
0 commit comments