diff options
author | afc163 <afc163@gmail.com> | 2017-03-09 15:01:53 +0800 |
---|---|---|
committer | afc163 <afc163@gmail.com> | 2017-03-09 15:01:53 +0800 |
commit | 886ce0a181b50c024fe5c4c35064750c816dd316 (patch) | |
tree | 2ded81c352786f2e0c08b0fb55d777e8463bbd39 /examples/common.js | |
parent | 8132e1ff3c6ea408e1dbd040971f0d13f2064123 (diff) | |
download | time-picker-886ce0a181b50c024fe5c4c35064750c816dd316.tar.gz time-picker-886ce0a181b50c024fe5c4c35064750c816dd316.tar.zst time-picker-886ce0a181b50c024fe5c4c35064750c816dd316.zip |
Updates
Diffstat (limited to 'examples/common.js')
-rw-r--r-- | examples/common.js | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/examples/common.js b/examples/common.js index 5208dde..ac8765b 100644 --- a/examples/common.js +++ b/examples/common.js | |||
@@ -30959,9 +30959,9 @@ | |||
30959 | 30959 | ||
30960 | var _reactDom2 = _interopRequireDefault(_reactDom); | 30960 | var _reactDom2 = _interopRequireDefault(_reactDom); |
30961 | 30961 | ||
30962 | var _classnames2 = __webpack_require__(264); | 30962 | var _classnames3 = __webpack_require__(264); |
30963 | 30963 | ||
30964 | var _classnames3 = _interopRequireDefault(_classnames2); | 30964 | var _classnames4 = _interopRequireDefault(_classnames3); |
30965 | 30965 | ||
30966 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | 30966 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
30967 | 30967 | ||
@@ -30996,6 +30996,11 @@ | |||
30996 | onMouseEnter: _react.PropTypes.func | 30996 | onMouseEnter: _react.PropTypes.func |
30997 | }, | 30997 | }, |
30998 | 30998 | ||
30999 | getInitialState: function getInitialState() { | ||
31000 | return { | ||
31001 | active: false | ||
31002 | }; | ||
31003 | }, | ||
30999 | componentDidMount: function componentDidMount() { | 31004 | componentDidMount: function componentDidMount() { |
31000 | // jump to selected option | 31005 | // jump to selected option |
31001 | this.scrollToSelected(0); | 31006 | this.scrollToSelected(0); |
@@ -31024,7 +31029,7 @@ | |||
31024 | return options.map(function (item, index) { | 31029 | return options.map(function (item, index) { |
31025 | var _classnames; | 31030 | var _classnames; |
31026 | 31031 | ||
31027 | var cls = (0, _classnames3.default)((_classnames = {}, (0, _defineProperty3.default)(_classnames, prefixCls + '-select-option-selected', selectedIndex === index), (0, _defineProperty3.default)(_classnames, prefixCls + '-select-option-disabled', item.disabled), _classnames)); | 31032 | var cls = (0, _classnames4.default)((_classnames = {}, (0, _defineProperty3.default)(_classnames, prefixCls + '-select-option-selected', selectedIndex === index), (0, _defineProperty3.default)(_classnames, prefixCls + '-select-option-disabled', item.disabled), _classnames)); |
31028 | var onclick = null; | 31033 | var onclick = null; |
31029 | if (!item.disabled) { | 31034 | if (!item.disabled) { |
31030 | onclick = _this.onSelect.bind(_this, item.value); | 31035 | onclick = _this.onSelect.bind(_this, item.value); |
@@ -31056,19 +31061,30 @@ | |||
31056 | var to = topOption.offsetTop; | 31061 | var to = topOption.offsetTop; |
31057 | scrollTo(select, to, duration); | 31062 | scrollTo(select, to, duration); |
31058 | }, | 31063 | }, |
31064 | handleMouseEnter: function handleMouseEnter(e) { | ||
31065 | this.setState({ active: true }); | ||
31066 | this.props.onMouseEnter(e); | ||
31067 | }, | ||
31068 | handleMouseLeave: function handleMouseLeave() { | ||
31069 | this.setState({ active: false }); | ||
31070 | }, | ||
31059 | render: function render() { | 31071 | render: function render() { |
31072 | var _classnames2; | ||
31073 | |||
31060 | if (this.props.options.length === 0) { | 31074 | if (this.props.options.length === 0) { |
31061 | return null; | 31075 | return null; |
31062 | } | 31076 | } |
31063 | 31077 | ||
31064 | var prefixCls = this.props.prefixCls; | 31078 | var prefixCls = this.props.prefixCls; |
31065 | 31079 | ||
31080 | var cls = (0, _classnames4.default)((_classnames2 = {}, (0, _defineProperty3.default)(_classnames2, prefixCls + '-select', 1), (0, _defineProperty3.default)(_classnames2, prefixCls + '-select-active', this.state.active), _classnames2)); | ||
31066 | 31081 | ||
31067 | return _react2.default.createElement( | 31082 | return _react2.default.createElement( |
31068 | 'div', | 31083 | 'div', |
31069 | { | 31084 | { |
31070 | className: prefixCls + '-select', | 31085 | className: cls, |
31071 | onMouseEnter: this.props.onMouseEnter | 31086 | onMouseEnter: this.handleMouseEnter, |
31087 | onMouseLeave: this.handleMouseLeave | ||
31072 | }, | 31088 | }, |
31073 | _react2.default.createElement( | 31089 | _react2.default.createElement( |
31074 | 'ul', | 31090 | 'ul', |