@@ -93,9 +93,8 @@ var propTypes = {
9393 dropUp : _react2 [ 'default' ] . PropTypes . bool ,
9494 duration : _react2 [ 'default' ] . PropTypes . number , //popup
9595
96- disabled : _utilPropTypes2 [ 'default' ] . disabled ,
97-
98- readOnly : _utilPropTypes2 [ 'default' ] . readOnly ,
96+ disabled : _utilPropTypes2 [ 'default' ] . disabled . acceptsArray ,
97+ readOnly : _utilPropTypes2 [ 'default' ] . readOnly . acceptsArray ,
9998
10099 messages : _react2 [ 'default' ] . PropTypes . shape ( {
101100 open : _utilPropTypes2 [ 'default' ] . message ,
@@ -197,8 +196,6 @@ var DropdownList = _react2['default'].createClass(babelHelpers.createDecoratedOb
197196 var placeholder = _props2 . placeholder ;
198197 var value = _props2 . value ;
199198 var open = _props2 . open ;
200- var disabled = _props2 . disabled ;
201- var readOnly = _props2 . readOnly ;
202199 var ValueComponent = _props2 . valueComponent ;
203200 var List = _props2 . listComponent ;
204201
@@ -214,6 +211,8 @@ var DropdownList = _react2['default'].createClass(babelHelpers.createDecoratedOb
214211 var focused = _state . focused ;
215212
216213 var items = this . _data ( ) ,
214+ disabled = _utilInteraction . isDisabled ( this . props ) ,
215+ readOnly = _utilInteraction . isReadOnly ( this . props ) ,
217216 valueItem = _utilDataHelpers . dataItem ( data , value , valueField ) ,
218217 // take value from the raw data
219218 listID = _utilWidgetHelpers . instanceId ( this , '__listbox' ) ;
@@ -233,11 +232,11 @@ var DropdownList = _react2['default'].createClass(babelHelpers.createDecoratedOb
233232 'aria-owns' : listID ,
234233 'aria-busy' : ! ! busy ,
235234 'aria-live' : ! open && 'polite' ,
236- //aria-activedescendant={activeID}
237235 'aria-autocomplete' : 'list' ,
238236 'aria-disabled' : disabled ,
239237 'aria-readonly' : readOnly ,
240238 onKeyDown : this . _keyDown ,
239+ onKeyPress : this . _keyPress ,
241240 onClick : this . _click ,
242241 onFocus : this . _focus . bind ( null , true ) ,
243242 onBlur : this . _focus . bind ( null , false ) ,
@@ -280,8 +279,7 @@ var DropdownList = _react2['default'].createClass(babelHelpers.createDecoratedOb
280279 } ,
281280 onOpening : function ( ) {
282281 return _this . refs . list . forceUpdate ( ) ;
283- } ,
284- onRequestClose : this . close
282+ }
285283 } ) ,
286284 _react2 [ 'default' ] . createElement (
287285 'div' ,
@@ -398,19 +396,31 @@ var DropdownList = _react2['default'].createClass(babelHelpers.createDecoratedOb
398396 } else if ( key === 'ArrowUp' ) {
399397 if ( alt ) closeWithFocus ( ) ; else if ( isOpen ) this . setState ( { focusedItem : list . prev ( focusedItem ) } ) ; else change ( list . prev ( selectedItem ) ) ;
400398 e . preventDefault ( ) ;
401- } else if ( ! ( this . props . filter && isOpen ) ) this . search ( String . fromCharCode ( e . keyCode ) , function ( item ) {
402- isOpen ? _this4 . setState ( { focusedItem : item } ) : change ( item ) ;
403- } ) ;
399+ }
404400
405401 function change ( item , fromList ) {
406402 if ( ! item ) return ;
407403 fromList ? self . _onSelect ( item ) : self . change ( item ) ;
408404 }
409405 }
406+ } , {
407+ key : '_keyPress' ,
408+ decorators : [ _utilInteraction . widgetEditable ] ,
409+ value : function _keyPress ( e ) {
410+ var _this5 = this ;
411+
412+ _utilWidgetHelpers . notify ( this . props . onKeyPress , [ e ] ) ;
413+
414+ if ( e . defaultPrevented ) return ;
415+
416+ if ( ! ( this . props . filter && this . props . open ) ) this . search ( String . fromCharCode ( e . which ) , function ( item ) {
417+ _this5 . isMounted ( ) && _this5 . props . open ? _this5 . setState ( { focusedItem : item } ) : item && _this5 . change ( item ) ;
418+ } ) ;
419+ }
410420} , {
411421 key : 'change' ,
412422 value : function change ( data ) {
413- if ( ! _util_2 [ 'default' ] . isShallowEqual ( data , this . props . value ) ) {
423+ if ( ! _utilDataHelpers . valueMatcher ( data , this . props . value , this . props . valueField ) ) {
414424 _utilWidgetHelpers . notify ( this . props . onChange , data ) ;
415425 _utilWidgetHelpers . notify ( this . props . onSearch , '' ) ;
416426 this . close ( ) ;
@@ -431,18 +441,20 @@ var DropdownList = _react2['default'].createClass(babelHelpers.createDecoratedOb
431441} , {
432442 key : 'search' ,
433443 value : function search ( character , cb ) {
434- var _this5 = this ;
444+ var _this6 = this ;
435445
436446 var word = ( ( this . _searchTerm || '' ) + character ) . toLowerCase ( ) ;
437447
448+ if ( ! character ) return ;
449+
438450 this . _searchTerm = word ;
439451
440452 this . setTimeout ( 'search' , function ( ) {
441- var list = _this5 . refs . list ,
442- key = _this5 . props . open ? 'focusedItem' : 'selectedItem' ,
443- item = list . next ( _this5 . state [ key ] , word ) ;
453+ var list = _this6 . refs . list ,
454+ key = _this6 . props . open ? 'focusedItem' : 'selectedItem' ,
455+ item = list . next ( _this6 . state [ key ] , word ) ;
444456
445- _this5 . _searchTerm = '' ;
457+ _this6 . _searchTerm = '' ;
446458 if ( item ) cb ( item ) ;
447459 } , this . props . delay ) ;
448460 }
0 commit comments