1-
1+ import classNames from 'classnames'
22import TextArea from './TextArea'
33import omit from 'omit.js'
44import inputProps from './inputProps'
5- import { hasProp , getComponentFromProp } from '../_util/props-util'
5+ import { hasProp , getComponentFromProp , getStyle , getClass } from '../_util/props-util'
66
77function fixControlledValue ( value ) {
88 if ( typeof value === 'undefined' || value === null ) {
@@ -12,6 +12,7 @@ function fixControlledValue (value) {
1212}
1313
1414export default {
15+ inheritAttrs : false ,
1516 name : 'AInput' ,
1617 props : {
1718 ...inputProps ,
@@ -96,10 +97,15 @@ export default {
9697 [ wrapperClassName ] : ( addonBefore || addonAfter ) ,
9798 }
9899
100+ const groupClassName = classNames ( `${ props . prefixCls } -group-wrapper` , {
101+ [ `${ props . prefixCls } -group-wrapper-sm` ] : props . size === 'small' ,
102+ [ `${ props . prefixCls } -group-wrapper-lg` ] : props . size === 'large' ,
103+ } )
99104 if ( addonBefore || addonAfter ) {
100105 return (
101106 < span
102- class = { `${ props . prefixCls } -group-wrapper` }
107+ class = { groupClassName }
108+ style = { getStyle ( this ) }
103109 >
104110 < span class = { className } >
105111 { addonBefore }
@@ -118,7 +124,7 @@ export default {
118124 )
119125 } ,
120126 renderLabeledIcon ( children ) {
121- const { prefixCls } = this . $props
127+ const { prefixCls, size } = this . $props
122128 let prefix = getComponentFromProp ( this , 'prefix' )
123129 let suffix = getComponentFromProp ( this , 'suffix' )
124130 if ( ! prefix && ! suffix ) {
@@ -136,10 +142,14 @@ export default {
136142 { suffix }
137143 </ span >
138144 ) : null
139-
145+ const affixWrapperCls = classNames ( getClass ( this ) , `${ prefixCls } -affix-wrapper` , {
146+ [ `${ prefixCls } -affix-wrapper-sm` ] : size === 'small' ,
147+ [ `${ prefixCls } -affix-wrapper-lg` ] : size === 'large' ,
148+ } )
140149 return (
141150 < span
142- class = { `${ prefixCls } -affix-wrapper` }
151+ class = { affixWrapperCls }
152+ style = { getStyle ( this ) }
143153 >
144154 { prefix }
145155 { children }
@@ -167,7 +177,7 @@ export default {
167177 keydown : handleKeyDown ,
168178 input : handleChange ,
169179 } ,
170- class : getInputClassName ( ) ,
180+ class : classNames ( getInputClassName ( ) , getClass ( this ) ) ,
171181 ref : 'input' ,
172182 }
173183 return this . renderLabeledIcon (
0 commit comments