react-select-checked
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -85,4 +85,2 @@ 'use strict'; | ||
this._options = options; | ||
if (this.props.value.length) { | ||
@@ -186,6 +184,4 @@ currentValue = this.props.value; | ||
}, { | ||
key: 'renderMenu', | ||
value: function renderMenu(_ref) { | ||
var _this6 = this; | ||
key: 'renderOptions', | ||
value: function renderOptions(_ref) { | ||
var focusedOption = _ref.focusedOption, | ||
@@ -200,6 +196,3 @@ onFocus = _ref.onFocus, | ||
var props = this.props; | ||
var Option = optionComponent; | ||
return options.map(function (option, i) { | ||
@@ -216,21 +209,3 @@ var isSelected = valueArray.some(function (selectedOption) { | ||
}); | ||
if (i === 0) { | ||
return _react2.default.createElement( | ||
'div', | ||
{ key: 'option-' + i + '-' + option[valueKey] }, | ||
_react2.default.createElement(_OptionTools2.default, { | ||
onAddAll: _this6.handleAddAll, | ||
onClearAll: _this6.handleClearAll, | ||
addAllTitle: props.addAllTitle, | ||
clearAllTitle: props.clearAllTitle | ||
}), | ||
_react2.default.createElement(Option, { | ||
className: optionClass, | ||
option: option, | ||
onFocus: onFocus, | ||
onSelect: onSelect, | ||
isSelected: isSelected | ||
}) | ||
); | ||
} | ||
return _react2.default.createElement( | ||
@@ -250,2 +225,33 @@ 'div', | ||
}, { | ||
key: 'renderMenu', | ||
value: function renderMenu(params) { | ||
var props = this.props; | ||
var filteredOptions = params.options ? params.options.filter(function (option) { | ||
return !option.disabled; | ||
}).length : 0; | ||
var optsContainerStyle = { | ||
maxHeight: '150px', | ||
overflow: 'scroll' | ||
}; | ||
var optionItems = this.renderOptions(params); | ||
return _react2.default.createElement( | ||
'div', | ||
null, | ||
_react2.default.createElement(_OptionTools2.default, { | ||
onAddAll: this.handleAddAll, | ||
onClearAll: this.handleClearAll, | ||
addAllTitle: props.addAllTitle, | ||
clearAllTitle: props.clearAllTitle, | ||
filteredOptions: filteredOptions | ||
}), | ||
_react2.default.createElement( | ||
'div', | ||
{ style: optsContainerStyle }, | ||
optionItems | ||
) | ||
); | ||
} | ||
}, { | ||
key: 'getSelectComponent', | ||
@@ -252,0 +258,0 @@ value: function getSelectComponent() { |
@@ -62,3 +62,3 @@ 'use strict'; | ||
textAlign: 'center', | ||
padding: '1em', | ||
padding: '.5em', | ||
borderBottom: '1px solid #ccc' | ||
@@ -84,3 +84,6 @@ }; | ||
{ onClick: this.addAll, style: toolButtonStyle }, | ||
this.props.addAllTitle | ||
this.props.addAllTitle, | ||
' (', | ||
this.props.filteredOptions, | ||
')' | ||
), | ||
@@ -100,2 +103,3 @@ _react2.default.createElement( | ||
OptionTools.propTypes = { | ||
filteredOptions: _propTypes2.default.number, | ||
onAddAll: _propTypes2.default.func, | ||
@@ -102,0 +106,0 @@ onClearAll: _propTypes2.default.func, |
{ | ||
"name": "react-select-checked", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "A React select based on JedWatson/React-Select with checkmarks on selected options.", | ||
@@ -13,3 +13,3 @@ "main": "build/index.js", | ||
"react-input-autosize": "^2.0.1", | ||
"react-select": "^1.0.0" | ||
"react-select": "^1.2.1" | ||
}, | ||
@@ -16,0 +16,0 @@ "author": "Riza Nugraha <rnugraha@gmail.com> (https://about.me/riza.nugraha)", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
0
219269
17
610
Updatedreact-select@^1.2.1