bee-form-control
Advanced tools
Comparing version 2.0.14 to 2.0.15
@@ -138,3 +138,5 @@ 'use strict'; | ||
this.clearValue = function () { | ||
var onChange = _this2.props.onChange; | ||
var _props = _this2.props, | ||
onChange = _props.onChange, | ||
showClose = _props.showClose; | ||
@@ -149,4 +151,6 @@ _this2.setState({ | ||
} | ||
_this2.blurTime && clearTimeout(_this2.blurTime); | ||
_this2.blurTime = null; | ||
if (showClose) { | ||
_this2.blurTime && clearTimeout(_this2.blurTime); | ||
_this2.blurTime = null; | ||
} | ||
_this2.input.focus(); | ||
@@ -156,6 +160,6 @@ }; | ||
this.handleKeyDown = function (e) { | ||
var _props = _this2.props, | ||
onSearch = _props.onSearch, | ||
type = _props.type, | ||
onKeyDown = _props.onKeyDown; | ||
var _props2 = _this2.props, | ||
onSearch = _props2.onSearch, | ||
type = _props2.type, | ||
onKeyDown = _props2.onKeyDown; | ||
@@ -178,3 +182,5 @@ if (e.keyCode === 13 && type === "search") { | ||
var value = _this2.state.value; | ||
var onBlur = _this2.props.onBlur; | ||
var _props3 = _this2.props, | ||
onBlur = _props3.onBlur, | ||
showClose = _props3.showClose; | ||
@@ -184,6 +190,10 @@ var _e = _extends({}, e); | ||
if (onBlur) { | ||
_this2.blurTime && clearTimeout(_this2.blurTime); | ||
_this2.blurTime = setTimeout(function () { | ||
if (showClose) { | ||
_this2.blurTime && clearTimeout(_this2.blurTime); | ||
_this2.blurTime = setTimeout(function () { | ||
onBlur(value, _e); | ||
}, 100); | ||
} else { | ||
onBlur(value, _e); | ||
}, 100); | ||
} | ||
} | ||
@@ -205,16 +215,16 @@ }; | ||
this.renderInput = function () { | ||
var _props2 = _this2.props, | ||
Component = _props2.componentClass, | ||
type = _props2.type, | ||
className = _props2.className, | ||
size = _props2.size, | ||
clsPrefix = _props2.clsPrefix, | ||
onChange = _props2.onChange, | ||
onSearch = _props2.onSearch, | ||
onBlur = _props2.onBlur, | ||
showClose = _props2.showClose, | ||
focusSelect = _props2.focusSelect, | ||
prefix = _props2.prefix, | ||
suffix = _props2.suffix, | ||
others = _objectWithoutProperties(_props2, ['componentClass', 'type', 'className', 'size', 'clsPrefix', 'onChange', 'onSearch', 'onBlur', 'showClose', 'focusSelect', 'prefix', 'suffix']); | ||
var _props4 = _this2.props, | ||
Component = _props4.componentClass, | ||
type = _props4.type, | ||
className = _props4.className, | ||
size = _props4.size, | ||
clsPrefix = _props4.clsPrefix, | ||
onChange = _props4.onChange, | ||
onSearch = _props4.onSearch, | ||
onBlur = _props4.onBlur, | ||
showClose = _props4.showClose, | ||
focusSelect = _props4.focusSelect, | ||
prefix = _props4.prefix, | ||
suffix = _props4.suffix, | ||
others = _objectWithoutProperties(_props4, ['componentClass', 'type', 'className', 'size', 'clsPrefix', 'onChange', 'onSearch', 'onBlur', 'showClose', 'focusSelect', 'prefix', 'suffix']); | ||
// input[type="file"] 不应该有类名 .form-control. | ||
@@ -284,12 +294,12 @@ | ||
this.renderSearch = function () { | ||
var _props3 = _this2.props, | ||
Component = _props3.componentClass, | ||
type = _props3.type, | ||
className = _props3.className, | ||
size = _props3.size, | ||
clsPrefix = _props3.clsPrefix, | ||
onChange = _props3.onChange, | ||
onSearch = _props3.onSearch, | ||
onBlur = _props3.onBlur, | ||
others = _objectWithoutProperties(_props3, ['componentClass', 'type', 'className', 'size', 'clsPrefix', 'onChange', 'onSearch', 'onBlur']); | ||
var _props5 = _this2.props, | ||
Component = _props5.componentClass, | ||
type = _props5.type, | ||
className = _props5.className, | ||
size = _props5.size, | ||
clsPrefix = _props5.clsPrefix, | ||
onChange = _props5.onChange, | ||
onSearch = _props5.onSearch, | ||
onBlur = _props5.onBlur, | ||
others = _objectWithoutProperties(_props5, ['componentClass', 'type', 'className', 'size', 'clsPrefix', 'onChange', 'onSearch', 'onBlur']); | ||
// input[type="file"] 不应该有类名 .form-control. | ||
@@ -296,0 +306,0 @@ |
@@ -0,1 +1,11 @@ | ||
<a name="2.0.15"></a> | ||
## [2.0.15](https://github.com/tinper-bee/form-control/compare/v2.0.14...v2.0.15) (2020-03-26) | ||
### Features | ||
* **bee-form-control:** 在showClose时候加onBlur的延迟 ([c42dbd6](https://github.com/tinper-bee/form-control/commit/c42dbd6)) | ||
<a name="2.0.14"></a> | ||
@@ -2,0 +12,0 @@ ## [2.0.14](https://github.com/tinper-bee/form-control/compare/v2.0.13...v2.0.14) (2020-03-23) |
{ | ||
"name": "bee-form-control", | ||
"version": "2.0.14", | ||
"version": "2.0.15", | ||
"description": "form-control ui component for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -83,3 +83,3 @@ import React, {Component} from 'react'; | ||
clearValue = () => { | ||
const {onChange} = this.props; | ||
const { onChange,showClose } = this.props; | ||
this.setState({ | ||
@@ -93,4 +93,6 @@ showSearch: true, | ||
} | ||
this.blurTime&&clearTimeout(this.blurTime); | ||
this.blurTime=null; | ||
if(showClose){ | ||
this.blurTime&&clearTimeout(this.blurTime); | ||
this.blurTime=null; | ||
} | ||
this.input.focus(); | ||
@@ -114,10 +116,14 @@ } | ||
const { value } = this.state; | ||
const { onBlur } = this.props; | ||
const { onBlur,showClose } = this.props; | ||
let _e = Object.assign({}, e); | ||
this.e = _e; | ||
if(onBlur){ | ||
this.blurTime&&clearTimeout(this.blurTime); | ||
this.blurTime = setTimeout(() => { | ||
onBlur(value, _e); | ||
}, 100); | ||
if(showClose){ | ||
this.blurTime&&clearTimeout(this.blurTime); | ||
this.blurTime = setTimeout(() => { | ||
onBlur(value, _e); | ||
}, 100); | ||
}else{ | ||
onBlur(value, _e); | ||
} | ||
} | ||
@@ -124,0 +130,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
2847921
33983