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 = () => {
3535 < Form
3636 divider
3737 labelPosition = "left"
38+ starPosition = "right"
3839 onFinish = { ( values ) => submitSucceed ( values ) }
3940 onFinishFailed = { ( values , errors ) => submitFailed ( errors ) }
4041 footer = {
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ const Demo2 = () => {
3535 < Form
3636 divider
3737 labelPosition = "left"
38+ starPosition = "right"
3839 onFinish = { ( values ) => submitSucceed ( values ) }
3940 onFinishFailed = { ( values , errors ) => submitFailed ( errors ) }
4041 footer = {
Original file line number Diff line number Diff line change 1818 word-wrap : break-word ;
1919 text-align : $form-item-label-text-align ;
2020 line-height : unset ;
21- }
2221
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+ }
2935 }
3036
3137 .nut-form-item-labeltxt {
136142 white-space : nowrap ;
137143}
138144
139- .nut-form-item-label-left-required {
140- display : block ;
141- line-height : 1.5 ;
142- position : absolute ;
143- left : 0.1em ;
144- }
145-
146145.nut-form-item-top {
147146 flex-direction : column ;
148147 align-items : flex-start ;
Original file line number Diff line number Diff line change @@ -189,15 +189,17 @@ export class FormItem extends React.Component<
189189
190190 const { starPosition } = this . context . formInstance
191191 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 >
193195 )
194196 const renderLabel = (
195197 < >
196198 < Text className = "nut-form-item-labeltxt" >
197199 { starPosition === 'left' ? renderStar : null }
198200 { label }
201+ { starPosition === 'right' ? renderStar : null }
199202 </ Text >
200- { starPosition === 'right' ? renderStar : null }
201203 </ >
202204 )
203205 return (
Original file line number Diff line number Diff line change @@ -197,15 +197,17 @@ export class FormItem extends React.Component<
197197
198198 const { starPosition } = this . context . formInstance
199199 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 >
201203 )
202204 const renderLabel = (
203205 < >
204206 < span className = "nut-form-item-labeltxt" >
205207 { starPosition === 'left' ? renderStar : null }
206208 { label }
209+ { starPosition === 'right' ? renderStar : null }
207210 </ span >
208- { starPosition === 'right' ? renderStar : null }
209211 </ >
210212 )
211213 return (
You can’t perform that action at this time.
0 commit comments