nuke-input
Advanced tools
Comparing version 0.3.12 to 0.3.13
@@ -81,3 +81,3 @@ # Input demo | ||
<View style={[styles.lineWithMargin,styles.textLine]}> | ||
<Text style={styles.text}>return key{this.state.returnKeyType} value:{this.state.returnValue}</Text> | ||
<Text style={styles.text}>return 类型: {this.state.returnKeyType} , 输入框值: {this.state.returnValue}</Text> | ||
</View> | ||
@@ -84,0 +84,0 @@ <View style={styles.lineWithMargin}><Input placeholder="next" returnKeyType="next" /></View> |
# Changelog | ||
## 0.3.13 / 2017-06-14 | ||
* [[390cf43](http://gitlab.alibaba-inc.com/nuke/input/commit/390cf43d1a4886db109c1a389845dee980f8bafd)] - `feat` add encrypted 参数 | ||
## 0.3.12 / 2017-06-07 | ||
@@ -5,0 +9,0 @@ |
@@ -124,2 +124,4 @@ /** @jsx createElement */ | ||
value: function render() { | ||
var _attrs; | ||
var _props = this.props, | ||
@@ -148,2 +150,4 @@ hasFeedback = _props.hasFeedback, | ||
multiple = _props.multiple, | ||
_props$encrypted = _props.encrypted, | ||
encrypted = _props$encrypted === undefined ? false : _props$encrypted, | ||
_props$inputStyle = _props.inputStyle, | ||
@@ -157,3 +161,3 @@ inputStyle = _props$inputStyle === undefined ? {} : _props$inputStyle, | ||
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', 'maxLength', 'multiple', 'inputStyle', 'returnKeyType', 'autoFocus', 'type']); | ||
others = _objectWithoutProperties(_props, ['hasFeedback', 'hasClear', 'prefix', 'ref', 'className', 'state', 'defaultValue', 'value', 'onChange', 'onFocus', 'onInput', 'onBlur', 'readOnly', 'size', 'disabled', 'style', 'addonBefore', 'addonAfter', 'maxLength', 'multiple', 'encrypted', 'inputStyle', 'returnKeyType', 'autoFocus', 'type']); | ||
@@ -172,3 +176,3 @@ // style.textAlign = this.getValueFromContextAndProp('align') || 'left'; | ||
); | ||
var attrs = { | ||
var attrs = (_attrs = { | ||
// style: style, | ||
@@ -179,11 +183,4 @@ onChange: this.changeHandler, | ||
onFocus: this.focusHandler, | ||
onBlur: this.blurHandler, | ||
disabled: disabled, | ||
readOnly: readOnly, | ||
returnKeyType: returnKeyType, | ||
value: this.state.value, | ||
maxlength: maxLength, | ||
autofocus: autoFocus, | ||
defaultValue: defaultValue | ||
}; | ||
onBlur: this.blurHandler | ||
}, _defineProperty(_attrs, 'qap-encrypted', encrypted), _defineProperty(_attrs, 'disabled', disabled), _defineProperty(_attrs, 'readOnly', readOnly), _defineProperty(_attrs, 'returnKeyType', returnKeyType), _defineProperty(_attrs, 'value', this.state.value), _defineProperty(_attrs, 'maxlength', maxLength), _defineProperty(_attrs, 'autofocus', autoFocus), _defineProperty(_attrs, 'defaultValue', defaultValue), _attrs); | ||
@@ -190,0 +187,0 @@ // 防止重复定义带来的warning |
{ | ||
"name": "nuke-input", | ||
"version": "0.3.12", | ||
"version": "0.3.13", | ||
"description": "输入框", | ||
@@ -35,7 +35,7 @@ "main": "lib/index", | ||
"nuke-var-loader": "^0.x.x", | ||
"nuke-components": "0.x.x", | ||
"nuke-core": "0.x.x", | ||
"nuke-env": "0.x.x", | ||
"nuke-icon": "0.x.x", | ||
"nuke-button": "0.x.x" | ||
"nuke-components": "^0.x.x", | ||
"nuke-core": "^0.x.x", | ||
"nuke-env": "^0.x.x", | ||
"nuke-icon": "^0.x.x", | ||
"nuke-button": "^0.x.x" | ||
}, | ||
@@ -42,0 +42,0 @@ "devDependencies": { |
@@ -5,3 +5,3 @@ | ||
- category: UI | ||
- chinese: 带UI的输入框 | ||
- chinese: 输入框 | ||
- type: UI组件 | ||
@@ -11,6 +11,3 @@ | ||
** breaking change** onInput 增加参数 value, function(value,e) | ||
** 新增特性 (weex > 0.11) ** 新增 returnKeyType 指定键盘 return key 类型,以及对应的 onReturn 事件。 | ||
## API | ||
@@ -20,26 +17,22 @@ | ||
| :------------- | :------------- |:------------- |:------------- | | ||
| type | 类型,可选为enclosed(有边线)/inset(空白) | string | enclosed | | ||
| type | 键盘类型,可选 `text` `url` `password` `tel` `date` `time` `email`| string|`text`| | ||
| autoFocus | 自动获得焦点| boolean|false | | ||
| maxLength | 最大长度 | number | undefined | | ||
| multiple | 是否为多行,不选则为单行 | bool | false | | ||
| state | 状态,可选为`''/success/error/warning` | string | '' | | ||
| value | 当前的value 值 | string | | | ||
| defaultValue| 初始化的value 值(**非受控用法**) | string | | | ||
| disabled | 状态 设置文本域禁用状态 | boolean | false | | ||
|defaultValue| 初始化的value 值(**非受控用法**) | string | | | ||
| onInput | 输入事件 | `function(value, e)` | false | | ||
| onInput | 输入事件 | `function(e)` | false | | ||
| onFocus | Focus事件 | `function` | false | | ||
| onBlur | Blur事件 | `function` | false | | ||
| onChange | change| `function(value, e)` | | | ||
| onReturn | **仅 native 有效**,return 事件,用户在手机上点击了 return 键触发(键盘右下角),返回值 e {returnKeyType:'类型',value:'输入框的值'} | `function(e)` | false | | ||
| returnKeyType | **仅 native 有效**,return 键展示类型(键盘右下角的那个键),可选 `default` `go` `next` `search` `send` `done` | string | `default` | | ||
| onChange | change| `function(value, e)` | | | ||
| 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` | ||
| autoFocus | 自动获得焦点| boolean|false | ||
| focus 实例方法| 让input获得焦点|`function`| | | ||
| blur 实例方法| 让input失去焦点|`function`| | | ||
| rows | 多行input中可同时显示的行数 | number | 2 | | ||
| encrypted | 是否加密 | boolean | false | | ||
### 关于 defaultValue 与 value (非受控与受控的差别) | ||
@@ -59,9 +52,9 @@ - defaultValue : 传入 value 默认值,用于 constructor 中计算使用,生命周期函数改变也不会再改变。 | ||
//在某些情况下需要让 myinput 强制失去焦点 | ||
focus=(e)=>{ | ||
focus = (e) => { | ||
this.refs.myinput.focus(); | ||
} | ||
blur = (e)=>{ | ||
blur = (e) => { | ||
this.refs.myinput.blur(); | ||
} | ||
change=(value,e)=>{ | ||
change = (value,e) => { | ||
console.log(value);//强制失去焦点后,会触发 onCchange | ||
@@ -68,0 +61,0 @@ } |
@@ -27,3 +27,3 @@ /** @jsx createElement */ | ||
<View style={styles.lineWithMargin}> | ||
<Input ref="myinput" defaultValue="春装 连衣裙" onChange={this.change} onInput={(value,e)=>{console.log('input==>',value)}} /> | ||
<Input ref="myinput" defaultValue="春装 连衣裙" onChange={this.change} onInput={(e)=>{console.log('input==>',value)}} /> | ||
</View> | ||
@@ -36,4 +36,8 @@ <View style={[styles.lineWithMargin,styles.textLine]}> | ||
<View style={styles.lineWithMargin}> | ||
<Input ref="myinput" onInput={(value,e)=>{console.log('input==>',value)}} maxLength={10}/> | ||
<Input onInput={(e)=>{console.log('input==>',value)}} maxLength={10}/> | ||
</View> | ||
<BizPage.Intro main="encrypted"></BizPage.Intro> | ||
<View style={styles.lineWithMargin}> | ||
<Input ref="encrypted" encrypted={true} onInput={(e)=>{console.log('encrypted input==>',e)}} maxLength={10}/> | ||
</View> | ||
@@ -40,0 +44,0 @@ <BizPage.Intro main="多行"></BizPage.Intro> |
78456
987
68
Updatednuke-button@^0.x.x
Updatednuke-components@^0.x.x
Updatednuke-core@^0.x.x
Updatednuke-env@^0.x.x
Updatednuke-icon@^0.x.x