rc-select
Advanced tools
Comparing version 4.6.2 to 4.6.3
@@ -29,4 +29,2 @@ 'use strict'; | ||
var _rcMenu2 = _interopRequireDefault(_rcMenu); | ||
var _OptGroup = require('./OptGroup'); | ||
@@ -36,7 +34,7 @@ | ||
var _objectAssign = require('object-assign'); | ||
var _rcUtil = require('rc-util'); | ||
var _objectAssign2 = _interopRequireDefault(_objectAssign); | ||
var _DropdownPanel = require('./DropdownPanel'); | ||
var _rcUtil = require('rc-util'); | ||
var _DropdownPanel2 = _interopRequireDefault(_DropdownPanel); | ||
@@ -63,2 +61,7 @@ var SelectDropdown = (function (_React$Component) { | ||
}, { | ||
key: 'getMenuComponent', | ||
value: function getMenuComponent() { | ||
return this.refs.panel.refs.menu; | ||
} | ||
}, { | ||
key: 'renderFilterOptionsFromChildren', | ||
@@ -144,34 +147,2 @@ value: function renderFilterOptionsFromChildren(children, showNotFound) { | ||
}, { | ||
key: 'renderMenu', | ||
value: function renderMenu(menuItems) { | ||
var props = this.props; | ||
var menuProps = {}; | ||
if (props.isMultipleOrTags) { | ||
menuProps.onDeselect = props.onMenuDeselect; | ||
} | ||
var value = props.value; | ||
var selectedKeys = (0, _util.getSelectKeys)(menuItems, value); | ||
var activeKey = undefined; | ||
if (!props.isMultipleOrTags) { | ||
if (!activeKey && selectedKeys.length === 1) { | ||
activeKey = selectedKeys[0]; | ||
} | ||
} | ||
return _react2['default'].createElement( | ||
_rcMenu2['default'], | ||
_extends({ | ||
ref: 'menu', | ||
style: props.dropdownMenuStyle, | ||
onSelect: props.onMenuSelect, | ||
defaultActiveFirst: true, | ||
activeKey: activeKey, | ||
multiple: props.isMultipleOrTags, | ||
focusable: false | ||
}, menuProps, { | ||
selectedKeys: selectedKeys, | ||
prefixCls: this.getDropdownPrefixCls() + '-menu' }), | ||
menuItems | ||
); | ||
} | ||
}, { | ||
key: 'render', | ||
@@ -185,3 +156,3 @@ value: function render() { | ||
var menuItems = this.renderFilterOptions(); | ||
var style = (0, _objectAssign2['default'])({}, props.dropdownStyle); | ||
var visible = props.visible; | ||
var search = props.isMultipleOrTagsOrCombobox || !props.showSearch ? null : _react2['default'].createElement( | ||
@@ -193,16 +164,15 @@ 'span', | ||
if (!search && !menuItems.length) { | ||
style.visibility = 'hidden'; | ||
visible = false; | ||
} | ||
var className = (_className = {}, _defineProperty(_className, dropdownPrefixCls, 1), _defineProperty(_className, dropdownPrefixCls + '--below', 1), _defineProperty(_className, dropdownPrefixCls + '-hidden', !props.visible), _className); | ||
var className = (_className = {}, _defineProperty(_className, dropdownPrefixCls, 1), _defineProperty(_className, dropdownPrefixCls + '--below', 1), _defineProperty(_className, dropdownPrefixCls + '-hidden', !visible), _className); | ||
// single and not combobox, input is inside dropdown | ||
return _react2['default'].createElement( | ||
'span', | ||
'div', | ||
{ key: 'dropdown', | ||
onFocus: props.onDropdownFocus, | ||
onBlur: props.onDropdownBlur, | ||
style: style, | ||
style: props.dropdownStyle, | ||
className: (0, _rcUtil.classSet)(className), | ||
tabIndex: '-1' }, | ||
search, | ||
this.renderMenu(menuItems) | ||
_react2['default'].createElement(_DropdownPanel2['default'], _extends({ ref: 'panel' }, props, { menuItems: menuItems, visible: visible, search: search })) | ||
); | ||
@@ -209,0 +179,0 @@ } |
@@ -207,3 +207,3 @@ 'use strict'; | ||
if (state.open) { | ||
var menu = this.dropdownInstance && this.dropdownInstance.refs.menu; | ||
var menu = this.dropdownInstance && this.dropdownInstance.getMenuComponent(); | ||
if (menu && menu.onKeyDown(e)) { | ||
@@ -237,6 +237,6 @@ e.preventDefault(); | ||
this.fireChange(value); | ||
this.setOpenState(false); | ||
this.setState({ | ||
inputValue: '' | ||
}); | ||
this.setOpenState(false); | ||
if ((0, _util.isCombobox)(props)) { | ||
@@ -250,10 +250,13 @@ this.setState({ | ||
key: 'onMenuDeselect', | ||
value: function onMenuDeselect(key, item, e) { | ||
if (e.type === 'click') { | ||
value: function onMenuDeselect(_ref2) { | ||
var item = _ref2.item; | ||
var domEvent = _ref2.domEvent; | ||
if (domEvent.type === 'click') { | ||
this.removeSelected((0, _util.getValuePropValue)(item)); | ||
} | ||
this.setOpenState(false); | ||
this.setState({ | ||
inputValue: '' | ||
}); | ||
this.setOpenState(false); | ||
} | ||
@@ -293,2 +296,3 @@ }, { | ||
this.fireChange([]); | ||
this.setOpenState(false); | ||
this.setState({ | ||
@@ -298,3 +302,2 @@ inputValue: '' | ||
} | ||
this.setOpenState(false); | ||
} | ||
@@ -301,0 +304,0 @@ }, { |
{ | ||
"name": "rc-select", | ||
"version": "4.6.2", | ||
"version": "4.6.3", | ||
"description": "select ui component for react", | ||
@@ -53,3 +53,2 @@ "keywords": [ | ||
"dependencies": { | ||
"object-assign": "3.x", | ||
"rc-align": "1.x", | ||
@@ -56,0 +55,0 @@ "rc-animate": "1.x", |
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
58724
4
11
1327
- Removedobject-assign@3.x
- Removedobject-assign@3.0.0(transitive)