nuke-input
Advanced tools
Comparing version 0.3.7 to 0.4.0
@@ -18,2 +18,3 @@ # 各种类型的input | ||
let App = class NukeDemoIndex extends Component { | ||
@@ -25,2 +26,3 @@ constructor() { | ||
} | ||
} | ||
@@ -37,3 +39,3 @@ change = (value, e)=>{ | ||
<View style={styles.lineWithMargin}> | ||
<Input ref="myinput" onChange={this.change} onInput={(e)=>{console.log('input==>',e)}}/> | ||
<Input ref="myinput" defaultValue="春装 连衣裙" onChange={this.change} onInput={(value,e)=>{console.log('input==>',value)}}/> | ||
</View> | ||
@@ -44,9 +46,10 @@ <View style={[styles.lineWithMargin,styles.textLine]}> | ||
<BizPage.Intro main="只能输入10个字符"></BizPage.Intro> | ||
<View style={styles.lineWithMargin}> | ||
<Input ref="myinput" onInput={(value,e)=>{console.log('input==>',value)}} maxLength={10}/> | ||
</View> | ||
<BizPage.Intro main="多行"></BizPage.Intro> | ||
<View style={styles.lineWithMargin}><Input style={{height:'300rem',marginBottom:'20rem'}} autoFocus={true} multiple={true} placeholder="介绍一下" onFocus={(e) => console.log('onFocus',e)} onBlur={(e) => console.log('onBlur',e)}/></View> | ||
<BizPage.Intro main="自定义样式"></BizPage.Intro> | ||
<View style={styles.lineWithMargin}> | ||
<Input style={{borderWidth:0,backgroundColor:'#3089dc',color:'#ffffff'}} /> | ||
<Input style={{height:'300rem',marginBottom:'20rem'}} multiple={true} placeholder="介绍一下" onFocus={(e) => console.log('onFocus',e)} onBlur={(e) => console.log('onBlur',e)} /> | ||
</View> | ||
@@ -53,0 +56,0 @@ |
# Changelog | ||
## 0.4.0 / 2017-05-24 | ||
* [[bc6d813](http://gitlab.alibaba-inc.com/nuke/input/commit/bc6d813eb93be59033f3c4e22b8ece737d0eba36)] - `feat` onInput 添加 value 作为第一个参数, 添加maxLength 删除无关用法,删除无用嵌套 | ||
## 0.3.7 / 2017-05-15 | ||
@@ -5,0 +9,0 @@ |
150
lib/index.js
@@ -142,5 +142,4 @@ /** @jsx createElement */ | ||
style = _props$style === undefined ? {} : _props$style, | ||
addonBefore = _props.addonBefore, | ||
addonAfter = _props.addonAfter, | ||
multiple = _props.multiple, | ||
maxLength = _props.maxLength, | ||
_props$inputStyle = _props.inputStyle, | ||
@@ -151,19 +150,7 @@ inputStyle = _props$inputStyle === undefined ? {} : _props$inputStyle, | ||
_props$type = _props.type, | ||
type = _props$type === undefined ? 'enclosed' : _props$type, | ||
others = _objectWithoutProperties(_props, ['hasFeedback', 'hasClear', 'prefix', 'ref', 'className', 'state', 'defaultValue', 'value', 'onChange', 'onFocus', 'onInput', 'onBlur', 'readOnly', 'size', 'disabled', 'style', 'addonBefore', 'addonAfter', 'multiple', 'inputStyle', 'autoFocus', 'type']); | ||
type = _props$type === undefined ? 'text' : _props$type, | ||
others = _objectWithoutProperties(_props, ['hasFeedback', 'hasClear', 'prefix', 'ref', 'className', 'state', 'defaultValue', 'value', 'onChange', 'onFocus', 'onInput', 'onBlur', 'readOnly', 'size', 'disabled', 'style', 'multiple', 'maxLength', 'inputStyle', 'autoFocus', 'type']); | ||
// style.textAlign = this.getValueFromContextAndProp('align') || 'left'; | ||
// const type = this.getValueFromContextAndProp('type') || 'enclosed'; | ||
//如果当前的没有设置, 则取上下文的state | ||
if (state === undefined) state = this.context.state; | ||
var baseClass = 'input'; | ||
var inputWrapperStyle = Object.assign({}, _styles2.default['input'], _styles2.default[size], _styles2.default['' + type], _styles2.default['' + (multiple ? 'multiple' : 'single')], _styles2.default[type + '-' + (multiple ? 'multiple' : 'single')], this.state.focus ? _styles2.default['focus'] : {}, readOnly ? _styles2.default[(multiple ? 'multiple' : 'single') + '-readonly'] : {}, disabled ? _styles2.default[type + '-' + (multiple ? 'multiple' : 'single') + '-disabled'] : {}, _styles2.default[type + '-' + (multiple ? 'multiple' : 'single') + '-' + state], style | ||
// { | ||
// [state]: state | ||
); | ||
var inputWrapperStyle = Object.assign({}, _styles2.default['input-wrap'], _styles2.default[size], _styles2.default['' + (multiple ? 'multiple' : 'single')], this.state.focus ? _styles2.default['focus'] : {}, readOnly ? _styles2.default[(multiple ? 'multiple' : 'single') + '-readonly'] : {}, disabled ? _styles2.default[(multiple ? 'multiple' : 'single') + '-disabled'] : {}, _styles2.default[(multiple ? 'multiple' : 'single') + '-' + state], style); | ||
var attrs = { | ||
// style: style, | ||
onChange: this.changeHandler, | ||
@@ -175,2 +162,3 @@ onInput: this.inputHandler, | ||
readOnly: readOnly, | ||
maxlength: maxLength, | ||
value: this.state.value, | ||
@@ -195,15 +183,10 @@ autofocus: autoFocus, | ||
var inputElement = void 0; | ||
var flexVal = 'flex-' + (10 - (addonBefore ? 1 : 0) - (addonAfter ? 1 : 0)); | ||
var isAddonMode = (addonBefore || addonAfter) && !multiple; | ||
var customStyleFilter = {}; | ||
['color', 'fontSize', 'fontStyle', 'fontWeight', 'lineHeight', 'textAlign', 'textDecoration'].forEach(function (item) { | ||
if (style[item]) { | ||
// debugger; | ||
customStyleFilter[item] = style[item]; | ||
} | ||
}); | ||
var elementStyle = Object.assign({}, _styles2.default['input-inner'], _styles2.default[size], _styles2.default[type + '-' + (multiple ? 'multiple' : 'single') + '-input'], _styles2.default[(multiple ? 'multiple' : 'single') + '-input'], hasFeedback ? _styles2.default['has-feedback-input'] : {}, hasClear && this.state.focus ? _styles2.default['has-clear-input'] : {}, this.state.focus ? _styles2.default['focus-input'] : {}, readOnly ? _styles2.default[(multiple ? 'multiple' : 'single') + '-readonly-input'] : {}, disabled ? _styles2.default[type + '-' + (multiple ? 'multiple' : 'single') + '-disabled-input'] : {}, customStyleFilter, inputStyle); | ||
// | ||
var elementStyle = Object.assign({}, _styles2.default['input-inner'], _styles2.default[size], _styles2.default[(multiple ? 'multiple' : 'single') + '-input'], this.state.focus ? _styles2.default['focus-input'] : {}, readOnly ? _styles2.default[(multiple ? 'multiple' : 'single') + '-readonly-input'] : {}, disabled ? _styles2.default[(multiple ? 'multiple' : 'single') + '-disabled-input'] : {}, customStyleFilter, inputStyle); | ||
if (multiple) { | ||
@@ -217,3 +200,2 @@ if (_nukeEnv.isWeb) { | ||
} else { | ||
//console.log('elementStyle',elementStyle); | ||
inputElement = (0, _rax.createElement)('textarea', _extends({ ref: 'input', style: [elementStyle, { paddingTop: '4rem' }] }, attrs, this.pickAttrs(others))); | ||
@@ -228,3 +210,3 @@ } | ||
}, attrs, this.pickAttrs(others), { | ||
type: this.props.htmlType, | ||
type: type, | ||
style: x | ||
@@ -236,15 +218,5 @@ })); | ||
_nukeComponents.View, | ||
_extends({ x: 'input-wrap', style: inputWrapperStyle }, classNameForBorder), | ||
(0, _rax.createElement)( | ||
_nukeComponents.View, | ||
{ x: 'innner-flex', style: _styles2.default['inner-flex'] }, | ||
(0, _rax.createElement)( | ||
_nukeComponents.View, | ||
{ x: 'innner-input-box', style: [_styles2.default['inner-input-box'], _styles2.default[flexVal]] }, | ||
inputElement, | ||
this.renderClear(baseClass), | ||
this.renderFeedback(baseClass), | ||
this.renderCounter(baseClass) | ||
) | ||
) | ||
_extends({ 'nuke-class': 'input-wrap', style: inputWrapperStyle }, classNameForBorder), | ||
inputElement, | ||
this.renderCounter() | ||
); | ||
@@ -261,11 +233,2 @@ } | ||
}, { | ||
key: 'getValueFromContextAndProp', | ||
value: function getValueFromContextAndProp(key) { | ||
var value = this.context[key]; | ||
if (this.props.hasOwnProperty(key)) { | ||
value = this.props[key]; | ||
} | ||
return value; | ||
} | ||
}, { | ||
key: 'pickAttrs', | ||
@@ -302,3 +265,3 @@ value: function pickAttrs(props) { | ||
if (!(multiple && maxLength && hasLimitHint)) return; | ||
var counterStyle = Object.assign({}, _styles2.default['input-counter'], _styles2.default[type + '-' + (multiple ? 'multiple' : 'single') + '-counter']); | ||
var counterStyle = Object.assign({}, _styles2.default['input-counter'], _styles2.default[(multiple ? 'multiple' : 'single') + '-counter']); | ||
return (0, _rax.createElement)( | ||
@@ -317,70 +280,5 @@ _nukeComponents.View, | ||
}, { | ||
key: 'renderClear', | ||
value: function renderClear(baseClass) { | ||
//如果已经设置了feedback, 则不出现clear | ||
var _props3 = this.props, | ||
hasClear = _props3.hasClear, | ||
multiple = _props3.multiple, | ||
inMatrix = _props3.inMatrix, | ||
readOnly = _props3.readOnly, | ||
hasFeedback = _props3.hasFeedback, | ||
htmlType = _props3.htmlType, | ||
_props3$type = _props3.type, | ||
type = _props3$type === undefined ? 'enclosed' : _props3$type; | ||
var _state = this.state, | ||
focus = _state.focus, | ||
value = _state.value; | ||
//hasClear与hasFeedback互斥 | ||
if (typeof hasFeedback === 'boolean' && hasFeedback === true) { | ||
hasClear = false; | ||
} | ||
if (!hasClear || multiple || !value || readOnly || hasFeedback) return null; | ||
//不在配置平台或者focus的情况下, 不处理 | ||
// if(!(inMatrix || focus)) return null; | ||
// 这里的button是一个清空按钮 | ||
// 如果input在表单里需要处理回车事件 | ||
// 但是这里又没有指定htmlType为button | ||
// 则会直接触发清空操作 | ||
var clearStyle = Object.assign({}, _styles2.default['clear'], _styles2.default['single-clear'], _styles2.default[type + '-single-clear']); | ||
return (0, _rax.createElement)(_nukeIcon2.default, { x: 'clear-icon', onPress: this.clearHandler, size: 'medium', name: 'deleteFilling', style: clearStyle }); | ||
} | ||
}, { | ||
key: 'renderFeedback', | ||
value: function renderFeedback() { | ||
var _props4 = this.props, | ||
_props4$type = _props4.type, | ||
type = _props4$type === undefined ? 'enclosed' : _props4$type, | ||
multiple = _props4.multiple, | ||
hasFeedback = _props4.hasFeedback; | ||
//多行不出现反馈 | ||
if (multiple || !hasFeedback) return null; | ||
var iconType = ''; | ||
var state = this.props.state; | ||
//如果没有设置state, 则从context中取state | ||
if (state === undefined) state = this.context.state; | ||
// switch(state){ | ||
// case 'success': | ||
// iconType = 'success-filling'; | ||
// break; | ||
// case 'error': | ||
// iconType = 'error-filling'; | ||
// break; | ||
// } | ||
// debugger; | ||
var feedbackStyle = Object.assign({}, _styles2.default['feedback'], _styles2.default['single-feedback'], _styles2.default[type + '-single-feedback'], _styles2.default['single-' + state + '-feedback']); | ||
return (0, _rax.createElement)(_nukeIcon2.default, { x: 'feedback-icon', name: state + 'Filling', size: 'medium', style: feedbackStyle }); | ||
} | ||
}, { | ||
key: 'changeHandler', | ||
value: function changeHandler(e) { | ||
var value = void 0, | ||
event = void 0; | ||
var value = void 0; | ||
if (_nukeEnv.isWeb) { | ||
@@ -403,7 +301,11 @@ value = e.target.value; | ||
value: function inputHandler(e) { | ||
if (_nukeEnv.isWeex) { | ||
e.target['value'] = e.value; | ||
var value = void 0; | ||
if (_nukeEnv.isWeb) { | ||
value = e.target.value; | ||
} else { | ||
value = e.value; | ||
e.target['value'] = value; | ||
} | ||
this.trigger('onInput', e); | ||
this.trigger('onInput', value, e); | ||
} | ||
@@ -494,7 +396,4 @@ }, { | ||
readOnly: _rax.PropTypes.bool, | ||
inMatrix: _rax.PropTypes.bool, | ||
align: _rax.PropTypes.oneOf(['left', 'right', 'center']), | ||
multiple: _rax.PropTypes.bool, | ||
hasFeedback: _rax.PropTypes.bool, | ||
hasClear: _rax.PropTypes.bool, | ||
type: _rax.PropTypes.oneOf(['enclosed', 'inset']), | ||
@@ -511,13 +410,5 @@ state: _rax.PropTypes.oneOf(['', 'success', 'error', 'warning']), | ||
// 文本域前后附加内容 | ||
addonBefore: _rax.PropTypes.string, | ||
addonAfter: _rax.PropTypes.string, | ||
// 增加htmlType枚举检查 | ||
// mext-input用于文本输入型场景 | ||
htmlType: _rax.PropTypes.oneOf(['search', 'text', 'tel', 'email', 'url', 'password', 'number']) | ||
htmlType: _rax.PropTypes.oneOf(['search', 'text', 'tel', 'date', 'time', 'email', 'url', 'password', 'number']) | ||
}; | ||
Input.defaultProps = { | ||
hasClear: false, | ||
hasFeedback: false, | ||
multiple: false, | ||
@@ -530,3 +421,2 @@ size: 'medium', | ||
align: _rax.PropTypes.string, | ||
type: _rax.PropTypes.string, | ||
form: _rax.PropTypes.object, | ||
@@ -533,0 +423,0 @@ state: _rax.PropTypes.string |
@@ -23,8 +23,4 @@ 'use strict'; | ||
module.exports = (_module$exports = { | ||
input: { | ||
//flex: 1, | ||
} | ||
}, _defineProperty(_module$exports, 'input-input', { | ||
//flex: 1 | ||
module.exports = (_module$exports = {}, _defineProperty(_module$exports, 'input-wrap', { | ||
//flex: 1, | ||
}), _defineProperty(_module$exports, 'input-counter', { | ||
@@ -42,164 +38,60 @@ position: 'absolute', | ||
textAlign: 'right' | ||
}), _defineProperty(_module$exports, 'enclosed-single', { | ||
}), _defineProperty(_module$exports, 'single', { | ||
borderRadius: _variable2.default['input-single-enclosed-radius'], | ||
borderColor: _variable2.default['input-single-enclosed-line-color'], | ||
borderWidth: parseFloat(_variable2.default['input-line-width'], 10) + 'rem', | ||
borderStyle: _variable2.default['input-border-style'] | ||
}), _defineProperty(_module$exports, 'enclosed-single-disabled', { | ||
borderStyle: _variable2.default['input-border-style'], | ||
backgroundColor: _variable2.default['input-bg-color'], | ||
height: _variable2.default['input-single-height'] + 'rem' | ||
}), _defineProperty(_module$exports, 'single-disabled', { | ||
borderColor: _variable2.default['input-disabled-line-color'], | ||
backgroundColor: _variable2.default['input-disabled-bg-color'] | ||
}), _defineProperty(_module$exports, 'enclosed-single-disabled-input', { | ||
}), _defineProperty(_module$exports, 'single-disabled-input', { | ||
color: _variable2.default['input-disabled-color'] | ||
}), _defineProperty(_module$exports, 'enclosed-single-input', _extends({}, _nukeCore2.default.padding(0, _variable2.default['input-single-enclosed-padding-left-right']))), _defineProperty(_module$exports, 'enclosed-single-has-feedback-error-input', { | ||
paddingRight: _variable2.default['input-single-feedback-right-margin'] + _variable2.default['input-single-feedback-size'] + _variable2.default['input-single-enclosed-padding-left-right'] | ||
}), _defineProperty(_module$exports, 'enclosed-single-has-feedback-success-input', { | ||
paddingRight: _variable2.default['input-single-feedback-right-margin'] + _variable2.default['input-single-feedback-size'] + _variable2.default['input-single-enclosed-padding-left-right'] | ||
}), _defineProperty(_module$exports, 'enclosed-single-has-clear-input', { | ||
paddingRight: _variable2.default['input-single-clear-right-margin'] + _variable2.default['input-single-clear-size'] + _variable2.default['input-single-enclosed-padding-left-right'] | ||
}), _defineProperty(_module$exports, 'enclosed-single-clear', { | ||
right: _variable2.default['input-single-clear-right-margin'] + _variable2.default['input-single-enclosed-padding-left-right'] | ||
}), _defineProperty(_module$exports, 'enclosed-single-feedback', { | ||
right: _variable2.default['input-single-feedback-right-margin'] + _variable2.default['input-single-enclosed-padding-left-right'] | ||
}), _defineProperty(_module$exports, 'enclosed-single-error', { | ||
borderColor: _variable2.default['input-single-enclosed-error-line-color'] | ||
}), _defineProperty(_module$exports, 'enclosed-single-error-input', { | ||
color: _variable2.default['input-single-enclosed-error-color'] | ||
}), _defineProperty(_module$exports, 'enclosed-single-success', { | ||
borderColor: _variable2.default['input-single-enclosed-success-line-color'] | ||
}), _defineProperty(_module$exports, 'enclosed-single-success-input', { | ||
color: _variable2.default['input-single-enclosed-success-color'] | ||
}), _defineProperty(_module$exports, 'enclosed-single-notice', { | ||
borderColor: _variable2.default['input-single-enclosed-notice-line-color'] | ||
}), _defineProperty(_module$exports, 'enclosed-single-notice-input', { | ||
color: _variable2.default['input-single-enclosed-notice-color'] | ||
}), _defineProperty(_module$exports, 'inset-single', { | ||
backgroundColor: _variable2.default['input-bg-color'], | ||
borderRadius: _variable2.default['input-single-inset-radius'], | ||
border: 'none' | ||
}), _defineProperty(_module$exports, 'inset-single-disabled', { | ||
backgroundColor: _variable2.default['input-disabled-bg-color'] | ||
}), _defineProperty(_module$exports, 'inset-single-disabled-input', { | ||
color: _variable2.default['input-disabled-color'] | ||
}), _defineProperty(_module$exports, 'inset-single-input', _extends({}, _nukeCore2.default.padding(0, _variable2.default['input-single-inset-padding-left-right']))), _defineProperty(_module$exports, 'inset-single-has-feedback-input', { | ||
paddingRight: _variable2.default['input-single-feedback-right-margin'] + _variable2.default['input-single-feedback-size'] + _variable2.default['input-single-inset-padding-left-right'] | ||
}), _defineProperty(_module$exports, 'inset-single-has-clear-input', { | ||
paddingRight: _variable2.default['input-single-clear-right-margin'] + _variable2.default['input-single-clear-size'] + _variable2.default['input-single-inset-padding-left-right'] | ||
}), _defineProperty(_module$exports, 'inset-single-clear', { | ||
right: _variable2.default['input-single-clear-right-margin'] + _variable2.default['input-single-inset-padding-left-right'] | ||
}), _defineProperty(_module$exports, 'inset-single-feedback', { | ||
right: _variable2.default['input-single-feedback-right-margin'] + _variable2.default['input-single-inset-padding-left-right'] | ||
}), _defineProperty(_module$exports, 'inset-single-error-input', { | ||
color: _variable2.default['input-single-inset-error-color'] | ||
}), _defineProperty(_module$exports, 'inset-single-success-input', { | ||
color: _variable2.default['input-single-inset-success-color'] | ||
}), _defineProperty(_module$exports, 'inset-single-notice-input', { | ||
color: _variable2.default['input-single-inset-notice-color'] | ||
}), _defineProperty(_module$exports, 'enclosed-multiple', _extends({}, _nukeCore2.default.border(_variable2.default['input-line-width'], _variable2.default['input-borderStyle'], _variable2.default['input-multiple-enclosed-borderColor']), { | ||
}), _defineProperty(_module$exports, 'single-input', _extends({ | ||
backgroundColor: 'transparent', | ||
color: _variable2.default['input-single-enclosed-color'], | ||
height: _variable2.default['input-single-height'] + 'rem', | ||
fontSize: _variable2.default['input-single-font-size'] | ||
}, _nukeCore2.default.padding(0, _variable2.default['input-single-enclosed-padding-left-right']))), _defineProperty(_module$exports, 'multiple', _extends({}, _nukeCore2.default.border(_variable2.default['input-line-width'], _variable2.default['input-borderStyle'], _variable2.default['input-multiple-enclosed-borderColor']), { | ||
borderRadius: _variable2.default['input-multiple-enclosed-radius'], | ||
backgroundColor: _variable2.default['input-bg-color'] | ||
})), _defineProperty(_module$exports, 'enclosed-multiple-textarea', { | ||
})), _defineProperty(_module$exports, 'multiple-textarea', { | ||
height: _variable2.default['input-multiple-height'] + 'rem', | ||
padding: _variable2.default['input-multiple-enclosed-padding'], | ||
marginBottom: _variable2.default['input-multiple-enclosed-padding'] + _variable2.default['input-multiple-counter-fontSize'] | ||
}), _defineProperty(_module$exports, 'enclosed-multiple-counter', { | ||
}), _defineProperty(_module$exports, 'multiple-counter', { | ||
right: _variable2.default['input-multiple-enclosed-padding'], | ||
bottom: _variable2.default['input-multiple-enclosed-padding'] | ||
}), _defineProperty(_module$exports, 'enclosed-multiple-disabled', { | ||
}), _defineProperty(_module$exports, 'multiple-disabled', { | ||
backgroundColor: _variable2.default['input-disabled-bg-color'] | ||
}), _defineProperty(_module$exports, 'enclosed-multiple-disabled-input', { | ||
}), _defineProperty(_module$exports, 'multiple-disabled-input', { | ||
backgroundColor: _variable2.default['input-disabled-bg-color'], | ||
color: _variable2.default['input-disabled-color'] | ||
}), _defineProperty(_module$exports, 'enclosed-multiple-error', { | ||
}), _defineProperty(_module$exports, 'multiple-error', { | ||
borderColor: _variable2.default['input-multiple-enclosed-border-error-color'], | ||
backgroundColor: _variable2.default['input-multiple-enclosed-error-bg-color'] | ||
}), _defineProperty(_module$exports, 'enclosed-multiple-error-textarea', { | ||
}), _defineProperty(_module$exports, 'multiple-error-textarea', { | ||
color: _variable2.default['input-multiple-enclosed-error-color'], | ||
backgroundColor: _variable2.default['input-multiple-enclosed-error-bg-color'] | ||
}), _defineProperty(_module$exports, 'enclosed-multiple-success', { | ||
}), _defineProperty(_module$exports, 'multiple-success', { | ||
borderColor: _variable2.default['input-multiple-enclosed-border-success-color'], | ||
backgroundColor: _variable2.default['input-multiple-enclosed-success-bg-color'] | ||
}), _defineProperty(_module$exports, 'enclosed-multiple-success-textarea', { | ||
}), _defineProperty(_module$exports, 'multiple-success-textarea', { | ||
color: _variable2.default['input-multiple-enclosed-success-color'], | ||
backgroundColor: _variable2.default['input-multiple-enclosed-success-bg-color'] | ||
}), _defineProperty(_module$exports, 'enclosed-multiple-notice', { | ||
}), _defineProperty(_module$exports, 'multiple-notice', { | ||
borderColor: _variable2.default['input-multiple-enclosed-border-notice-color'], | ||
backgroundColor: _variable2.default['input-multiple-enclosed-notice-bg-color'] | ||
}), _defineProperty(_module$exports, 'enclosed-multiple-notice-textarea', { | ||
}), _defineProperty(_module$exports, 'multiple-notice-textarea', { | ||
color: _variable2.default['input-multiple-enclosed-notice-color'], | ||
backgroundColor: _variable2.default['input-multiple-enclosed-notice-bg-color'] | ||
}), _defineProperty(_module$exports, 'inset-multiple', { | ||
border: 'none', | ||
backgroundColor: _variable2.default['input-bg-color'] | ||
}), _defineProperty(_module$exports, 'inset-multiple-textarea', { | ||
height: _variable2.default['input-multiple-height'] + 'rem', | ||
fontSize: _variable2.default['input-multiple-fontSize'], | ||
padding: _variable2.default['input-multiple-inset-padding'], | ||
backgroundColor: _variable2.default['input-bg-color'], | ||
marginBottom: _variable2.default['input-multiple-inset-padding'] + _variable2.default['input-multiple-counter-font-Size'] | ||
}), _defineProperty(_module$exports, 'inset-multiple-counter', { | ||
right: _variable2.default['input-multiple-inset-padding'], | ||
bottom: _variable2.default['input-multiple-inset-padding'] | ||
}), _defineProperty(_module$exports, 'inset-multiple-disabled', { | ||
backgroundColor: _variable2.default['input-disabled-bg-color'] | ||
}), _defineProperty(_module$exports, 'inset-multiple-disabled-input', { | ||
backgroundColor: _variable2.default['input-disabled-bg-color'], | ||
color: _variable2.default['input-disabled-color'] | ||
}), _defineProperty(_module$exports, 'inset-multiple-error', { | ||
backgroundColor: _variable2.default['input-multiple-inset-error-bg-color'] | ||
}), _defineProperty(_module$exports, 'inset-multiple-error-textarea', { | ||
color: _variable2.default['input-multiple-inset-error-color'], | ||
backgroundColor: _variable2.default['input-multiple-inset-error-bg-color'] | ||
}), _defineProperty(_module$exports, 'inset-multiple-success', { | ||
backgroundColor: _variable2.default['input-multiple-inset-success-bg-color'] | ||
}), _defineProperty(_module$exports, 'inset-multiple-success-textarea', { | ||
color: _variable2.default['input-multiple-inset-success-color'], | ||
backgroundColor: _variable2.default['input-multiple-inset-success-bg-color'] | ||
}), _defineProperty(_module$exports, 'inset-multiple-notice', { | ||
backgroundColor: _variable2.default['input-multiple-inset-notice-bg-color'] | ||
}), _defineProperty(_module$exports, 'inset-multiple-notice-textarea', { | ||
color: _variable2.default['input-multiple-inset-notice-color'], | ||
backgroundColor: _variable2.default['input-multiple-inset-notice-bg-color'] | ||
}), _defineProperty(_module$exports, 'inset-multiple-notice-textarea', { | ||
color: _variable2.default['input-multiple-inset-notice-color'], | ||
backgroundColor: _variable2.default['input-multiple-inset-notice-bg-color'] | ||
}), _defineProperty(_module$exports, 'inner-flex', { | ||
flex: 1, | ||
// height: (Variables[`input-single-height`]-2)+'rem', | ||
flexDirection: 'column' | ||
}), _defineProperty(_module$exports, 'inner-input-box', { | ||
flex: 1, | ||
flexDirection: 'column' | ||
}), _defineProperty(_module$exports, 'input-single', { | ||
backgroundColor: _variable2.default['input-bg-color'], | ||
height: _variable2.default['input-single-height'] - 2 + 'rem' | ||
}), _defineProperty(_module$exports, 'single-input', { | ||
backgroundColor: 'transparent', | ||
color: _variable2.default['input-single-enclosed-color'], | ||
height: _variable2.default['input-single-height'] + 'rem', | ||
fontSize: _variable2.default['input-single-font-size'] | ||
}), _defineProperty(_module$exports, 'flex-8', _defineProperty({ | ||
flex: 8 | ||
}, '-webkit-box-flex', 8)), _defineProperty(_module$exports, 'flex-9', _defineProperty({ | ||
flex: 9 | ||
}, '-webkit-box-flex', 9)), _defineProperty(_module$exports, 'flex-10', _defineProperty({ | ||
flex: 10 | ||
}, '-webkit-box-flex', 10)), _defineProperty(_module$exports, 'single', { | ||
backgroundColor: _variable2.default['input-bg-color'], | ||
height: _variable2.default['input-single-height'] + 'rem' | ||
}), _defineProperty(_module$exports, 'single-readonly-input', { | ||
color: _variable2.default['input-single-readonly-color'] | ||
}), _defineProperty(_module$exports, 'single-clear', { | ||
position: 'absolute', | ||
top: (_variable2.default['input-single-height'] - 2 - _variable2.default['input-single-clear-size']) / 2, | ||
color: _variable2.default['input-single-clear-color'], | ||
fontSize: _variable2.default['input-single-clear-size'] | ||
}), _defineProperty(_module$exports, 'single-feedback', { | ||
fontSize: _variable2.default['input-single-feedback-size'], | ||
position: 'absolute', | ||
top: (_variable2.default['input-single-height'] - 2 - _variable2.default['input-single-feedback-size']) / 2 | ||
}), _defineProperty(_module$exports, 'single-success-feedback', { | ||
color: _variable2.default['input-single-feedback-success-color'] | ||
}), _defineProperty(_module$exports, 'single-error-feedback', { | ||
color: _variable2.default['input-single-feedback-error-color'] | ||
}), _defineProperty(_module$exports, 'input-inner', { | ||
@@ -206,0 +98,0 @@ flex: 1, |
{ | ||
"name": "nuke-input", | ||
"version": "0.3.7", | ||
"version": "0.4.0", | ||
"description": "输入框", | ||
@@ -5,0 +5,0 @@ "main": "lib/index", |
@@ -27,7 +27,3 @@ | ||
| maxLength | 最大长度 | number | undefined | | ||
| hasFeedback| 是否出现反馈| boolean | false | | ||
| hasClear| 是否是否出现clear按钮,与hasFeedback互斥| boolean | false | | ||
| hasLimitHint | 是否显示最大长度的提示, 仅对multiple有效 | boolean | false | | ||
| addonBefore | 前置附加文本域, multiple无效 | string | '' | | ||
| addonAfter | 后置附加文本域, multiple无效 | string | '' | | ||
| htmlType | 键盘类型,可选 `text` `url` `password` `tel` `date` `time` `email`| string|`text` | ||
@@ -34,0 +30,0 @@ | autoFocus | 自动获得焦点| boolean|false |
@@ -27,3 +27,3 @@ /** @jsx createElement */ | ||
<View style={styles.lineWithMargin}> | ||
<Input ref="myinput" defaultValue="春装 连衣裙" onChange={this.change} onInput={(e)=>{console.log('input==>',e.target.value)}}/> | ||
<Input ref="myinput" defaultValue="春装 连衣裙" onChange={this.change} onInput={(value,e)=>{console.log('input==>',value)}} /> | ||
</View> | ||
@@ -34,9 +34,10 @@ <View style={[styles.lineWithMargin,styles.textLine]}> | ||
<BizPage.Intro main="只能输入10个字符"></BizPage.Intro> | ||
<View style={styles.lineWithMargin}> | ||
<Input ref="myinput" onInput={(value,e)=>{console.log('input==>',value)}} maxLength={10}/> | ||
</View> | ||
<BizPage.Intro main="多行"></BizPage.Intro> | ||
<View style={styles.lineWithMargin}><Input style={{height:'300rem',marginBottom:'20rem'}} multiple={true} placeholder="介绍一下" onFocus={(e) => console.log('onFocus',e)} onBlur={(e) => console.log('onBlur',e)}/></View> | ||
<BizPage.Intro main="自定义样式"></BizPage.Intro> | ||
<View style={styles.lineWithMargin}> | ||
<Input style={{borderWidth:0,backgroundColor:'#3089dc',color:'#ffffff'}} /> | ||
<Input style={{height:'300rem',marginBottom:'20rem'}} multiple={true} placeholder="介绍一下" onFocus={(e) => console.log('onFocus',e)} onBlur={(e) => console.log('onBlur',e)} /> | ||
</View> | ||
@@ -43,0 +44,0 @@ |
62407
770
67