nuke-input
Advanced tools
Comparing version 2.2.29 to 2.3.0
@@ -6,2 +6,18 @@ # Change Log | ||
# [2.3.0](https://gitlab.alibaba-inc.com/nuke/input/compare/v2.2.29...v2.3.0) (2018-11-14) | ||
### Bug Fixes | ||
* liscene fix ([ff9b7fd](https://gitlab.alibaba-inc.com/nuke/input/commit/ff9b7fd)) | ||
### Features | ||
* 将UI组件与功能库拆分 ([f5d0a2c](https://gitlab.alibaba-inc.com/nuke/input/commit/f5d0a2c)) | ||
## [2.2.29](https://gitlab.alibaba-inc.com/nuke/input/compare/v2.2.28...v2.2.29) (2018-10-09) | ||
@@ -8,0 +24,0 @@ |
@@ -1,7 +0,17 @@ | ||
# Input demo | ||
# 包含单行和多行文本输入,return key 等 | ||
- order: 0 | ||
- title_en: Input usage | ||
包含单行和多行文本输入,return key 等 | ||
--- | ||
```js | ||
<NukePlayGround> | ||
// single | ||
<Input defaultValue="hello nuke" style={{ height: 60 }} /> | ||
// multiple | ||
<Input style={{ height: 300, marginBottom: 20 }} rows={20} multiple={true} placeholder="multiple" /> | ||
</NukePlayGround> | ||
``` | ||
--- | ||
@@ -8,0 +18,0 @@ |
# Input Demo | ||
* order: 4 | ||
- order: 4 | ||
@@ -66,3 +66,4 @@ 单行文本 md 定制 | ||
value: '111', | ||
disabled: true | ||
disabled: true, | ||
getval: '' | ||
}; | ||
@@ -73,2 +74,3 @@ this.checkLength = this.checkLength.bind(this); | ||
this.onIconPress = this.onIconPress.bind(this); | ||
this.getvalue = this.getvalue.bind(this); | ||
} | ||
@@ -87,2 +89,7 @@ change() { | ||
} | ||
getvalue() { | ||
this.setState({ | ||
getVal: this.refs.test.getValue() | ||
}); | ||
} | ||
checkLengthOnInput(e) { | ||
@@ -102,13 +109,14 @@ let text = e.value; | ||
commonConfigs={{ fixedFont: true, optimizeLineHeight: true }} | ||
androidConfigs={{ materialDesign: true }} | ||
> | ||
androidConfigs={{ materialDesign: true }}> | ||
<Page title="single md"> | ||
<Page.Intro main=" float placeholder" /> | ||
<Page.Intro main=" placeholder" /> | ||
<View style={styles.demoBlock}> | ||
<Input | ||
type="text" | ||
placeholder="ยังไมีนี้ให้ลูอื่ห็" | ||
floatPlaceholder={true} | ||
/> | ||
<Input type="text" ref="test" placeholder="ยังไมีนี้ให้ลูอื่ห็" floatPlaceholder={true} /> | ||
</View> | ||
<Text>get Value: {this.state.getVal}</Text> | ||
<View x="buttons" style={styles.btns}> | ||
<Button block type="primary" onPress={this.getvalue}> | ||
获得值 | ||
</Button> | ||
</View> | ||
<Page.Intro main="static placeholder" /> | ||
@@ -120,8 +128,3 @@ <View style={styles.demoBlock}> | ||
<View style={styles.demoBlock}> | ||
<Input | ||
disabled={this.state.disabled} | ||
maxLength={10} | ||
type="text" | ||
placeholder="Disabled TextField" | ||
/> | ||
<Input disabled={this.state.disabled} maxLength={10} type="text" placeholder="Disabled TextField" /> | ||
</View> | ||
@@ -132,4 +135,3 @@ <Button | ||
}} | ||
type="primary" | ||
> | ||
type="primary"> | ||
switch | ||
@@ -145,6 +147,6 @@ </Button> | ||
type="text" | ||
onChange={text => { | ||
onChange={(text) => { | ||
console.log('change', text); | ||
}} | ||
onClear={text => { | ||
onClear={(text) => { | ||
console.log('clear==>', text); | ||
@@ -180,6 +182,6 @@ }} | ||
type="text" | ||
onChange={text => { | ||
onChange={(text) => { | ||
console.log('change', text); | ||
}} | ||
onClear={text => { | ||
onClear={(text) => { | ||
console.log('clear==>', text); | ||
@@ -194,4 +196,3 @@ }} | ||
alert('error !!!!'); | ||
}} | ||
> | ||
}}> | ||
error here,click me to see more | ||
@@ -218,4 +219,3 @@ </Text> | ||
}} | ||
type="primary" | ||
> | ||
type="primary"> | ||
set number to 888888 | ||
@@ -237,4 +237,3 @@ </Button> | ||
}} | ||
type="primary" | ||
> | ||
type="primary"> | ||
set number to 888888 | ||
@@ -251,4 +250,3 @@ </Button> | ||
icon={{ | ||
uri: | ||
'https://img.alicdn.com/tfs/TB1P2ogh4rI8KJjy0FpXXb5hVXa-12-12.png', | ||
uri: 'https://img.alicdn.com/tfs/TB1P2ogh4rI8KJjy0FpXXb5hVXa-12-12.png', | ||
style: {}, | ||
@@ -255,0 +253,0 @@ onPress: () => { |
{ | ||
"name": "nuke-input", | ||
"version": "2.2.29", | ||
"version": "2.3.0", | ||
"description": "输入框", | ||
@@ -28,10 +28,10 @@ "main": "lib/index", | ||
"dependencies": { | ||
"nuke-base-input": "^2.2.29", | ||
"nuke-core": "^2.2.29", | ||
"nuke-env": "^2.2.29", | ||
"nuke-helper": "^2.2.29", | ||
"nuke-image": "^2.2.29", | ||
"nuke-text": "^2.2.29", | ||
"nuke-theme-provider": "^2.2.29", | ||
"nuke-view": "^2.2.29" | ||
"nuke-base-input": "^2.3.0", | ||
"nuke-core": "^2.3.0", | ||
"nuke-env": "^2.3.0", | ||
"nuke-helper": "^2.3.0", | ||
"nuke-image": "^2.3.0", | ||
"nuke-text": "^2.3.0", | ||
"nuke-theme-provider": "^2.3.0", | ||
"nuke-view": "^2.3.0" | ||
}, | ||
@@ -50,5 +50,5 @@ "devDependencies": { | ||
"mocha": "^3.4.2", | ||
"nuke-button": "^2.2.29", | ||
"nuke-icon": "^2.2.29", | ||
"nuke-page": "^2.2.29", | ||
"nuke-button": "^2.3.0", | ||
"nuke-icon": "^2.3.0", | ||
"nuke-page": "^2.3.0", | ||
"resemblejs-node": "^1.0.0", | ||
@@ -60,4 +60,4 @@ "webdriver-keycode": "^1.0.3" | ||
}, | ||
"license": "Apache", | ||
"gitHead": "0375bb11b20b155440e12aa572843944be7d8760" | ||
"license": "Apache-2.0", | ||
"gitHead": "454e1430a04b6e345edb1d2632b1e051408d070d" | ||
} |
@@ -10,40 +10,52 @@ | ||
## Design | ||
Nuke Input is the implement of input box, can be multiple mode or single line mode. | ||
Type props determine keyboard mode when inputing. | ||
Nuke Input also implements material design mode by materialDesign=true props. | ||
## API | ||
| Attribute | Explanation | Type | Default | | ||
| :------------- | :------------- |:------------- |:------------- | | ||
| type | Keyboard type. Optional: `text` `url` `password` `tel` `date` `time` `email`| string|`text`| | ||
| autoFocus | Auto focus| boolean|false | | ||
| multiple | Whether it is multi line. Default: single row | bool | false | | ||
| value | Current values | string | | | ||
| defaultValue| Initialized values(**uncontrolled usage**) | string | | | ||
| disabled | Setting text field disabled state | boolean | false | | ||
| onInput | Input event | `function(e)` | false | | ||
| onFocus | Focus event | `function` | false | | ||
| onBlur | Blur event | `function` | false | | ||
| onChange | change| `function(value, e)` | | | ||
| onReturn | **Only native is effective**, return event, The user clicks on the return button to trigger the phone (the lower right corner of the keyboard), callback value is `e` {returnKeyType: 'type', value: 'The value of the input box'} | `function(e)` | false | | ||
| returnKeyType | **Only native is effective**, `return` key display type (the key in the lower right corner of the keyboard). Option:`default` `go` `next` `search` `send` `done` | string | `default` | | ||
| focus case method| Let `input` get focus|`function`| | | ||
| blur case method| Let `input` lose focus|`function`| | | ||
| rows | The number of rows that can be displayed simultaneously in multiline input | number | 2 | | ||
|placeholder|placeholder text|string|null| | ||
|placeholderColor|color of the placeholder, only native is effective|string|'#999999'| | ||
| Props | Description | Type | Default | | ||
| :---------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------- | :-------- | | ||
| type | Keyboard type. Optional: `text` `url` `password` `tel` `date` `time` `email` | string | `text` | | ||
| autoFocus | Auto focus | boolean | false | | ||
| multiple | Whether it is multi line. Default: single row | bool | false | | ||
| value | Current values | string | | | ||
| defaultValue | Initialized values(**uncontrolled usage**) | string | | | ||
| disabled | Setting text field disabled state | boolean | false | | ||
| onInput | Input event | `function(e)` | false | | ||
| onFocus | Focus event | `function` | false | | ||
| onBlur | Blur event | `function` | false | | ||
| onChange | change | `function(value, e)` | | | ||
| onReturn | **Only native is effective**, return event, The user clicks on the return button to trigger the phone (the lower right corner of the keyboard), callback value is `e` {returnKeyType: 'type', value: 'The value of the input box'} | `function(e)` | false | | ||
| returnKeyType | **Only native is effective**, `return` key display type (the key in the lower right corner of the keyboard). Option:`default` `go` `next` `search` `send` `done` | string | `default` | | ||
| focus case method | Let `input` get focus | `function` | | | ||
| blur case method | Let `input` lose focus | `function` | | | ||
| rows | The number of rows that can be displayed simultaneously in multiline input | number | 2 | | ||
| placeholder | placeholder text | string | null | | ||
| placeholderColor | color of the placeholder, only native is effective | string | '#999999' | | ||
### On the difference between defaultValue and value (uncontrolled and controlled) | ||
- DefaultValue: It is passed to value, used for computation in constructor, and the life cycle function changes will not be changed. | ||
````js | ||
<Input defaultValue="羊绒大衣" onChange={(value,e)=>{console.log(value)}} /> | ||
```` | ||
- The controlled usage of value: changes with the change of the life cycle function. | ||
````js | ||
### Difference between defaultValue and value (uncontrolled and controlled) | ||
- defaultValue: uncontrolled usage, value will be initialized in constructor, will not be changed ever since. | ||
```js | ||
<Input defaultValue="some default value" onChange={(value,e)=>{console.log(value)}} /> | ||
``` | ||
- value: controlled usage , controlled by parent state value | ||
```js | ||
<Input value={this.state.value} onChange={(value,e)=>{console.log(value)}}/> | ||
```` | ||
``` | ||
### Case method `focus` and `blur` | ||
````js | ||
```js | ||
//In some cases, myinput needs to be forced to lose focus. | ||
@@ -57,3 +69,3 @@ focus = (e) => { | ||
change = (value,e) => { | ||
console.log(value);//After losing the focus, it triggers onCchange. | ||
console.log(value);//After losing focus, it triggers onChange. | ||
} | ||
@@ -64,16 +76,8 @@ render(){ | ||
<Input ref="myinput" onChange={this.change}/> | ||
<Button type="primary" onPress={this.focus}>点我让input获得焦点</Button> | ||
<Button type="primary" onPress={this.blur}>失去焦点,获取输入内容</Button> | ||
<Button type="primary" onPress={this.focus}>focus it</Button> | ||
<Button type="primary" onPress={this.blur}>blur it</Button> | ||
</View> | ||
) | ||
} | ||
```` | ||
``` | ||
## The Other | ||
- Chat with <a href="dingtalk://dingtalkclient/action/sendmsg?dingtalk_id=kjwo3w5">@翊晨[yichen]</a> in Dingtalk desktop App <a href='https://tms.dingtalk.com/markets/dingtalk/download'>Download</a> | ||
- DingTalk Group | ||
<img src="https://img.alicdn.com/tfs/TB101EESpXXXXXFXpXXXXXXXXXX-1122-1362.jpg" width="260" /> | ||
@@ -9,2 +9,10 @@ # Input | ||
## 设计思路 | ||
Input 是页面输入框的封装,其中 multiple = true 时为多行文本,类似 web 端的 textarea 组件。 | ||
Input type 不同,在端内有不同类型的键盘表现。 | ||
Nuke 的 Input 组件可以通过 materialDesign = true 开启 android material design 模式。 | ||
## API | ||
@@ -150,1 +158,7 @@ | ||
``` | ||
## 其他 | ||
- bug、建议联系 <a href="dingtalk://dingtalkclient/action/sendmsg?dingtalk_id=kjwo3w5">@翊晨</a> | ||
- 钉钉交流群 | ||
<img src="https://img.alicdn.com/tfs/TB101EESpXXXXXFXpXXXXXXXXXX-1122-1362.jpg" width="260" /> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
262659
0
163
Updatednuke-base-input@^2.3.0
Updatednuke-core@^2.3.0
Updatednuke-env@^2.3.0
Updatednuke-helper@^2.3.0
Updatednuke-image@^2.3.0
Updatednuke-text@^2.3.0
Updatednuke-theme-provider@^2.3.0
Updatednuke-view@^2.3.0