react-formalize
Advanced tools
Comparing version 0.3.0-alpha3 to 0.3.0-alpha4
@@ -37,10 +37,2 @@ 'use strict'; | ||
enumerable: true | ||
}, { | ||
key: 'defaultProps', | ||
value: { | ||
// Set empty string as default value | ||
// This will show up the placeholder option, when no value is set. | ||
value: '' | ||
}, | ||
enumerable: true | ||
}]); | ||
@@ -74,8 +66,6 @@ | ||
Select.prototype.renderOptions = function renderOptions(options, placeholder) { | ||
Select.prototype.renderOptions = function renderOptions(options, multiple, placeholder) { | ||
var children = []; | ||
if (placeholder) { | ||
// Placeholder implementation from stack overflow | ||
// See: http://stackoverflow.com/a/8442831/1818705 | ||
if (!multiple && placeholder) { | ||
children.push(_react2['default'].createElement( | ||
@@ -86,4 +76,3 @@ 'option', | ||
value: "", | ||
disabled: true, | ||
style: { display: 'none' } }, | ||
disabled: true }, | ||
placeholder | ||
@@ -110,9 +99,20 @@ )); | ||
var options = _props.options; | ||
var multiple = _props.multiple; | ||
var placeholder = _props.placeholder; | ||
var children = _props.children; | ||
var value = props.value; | ||
var restProps = _objectWithoutProperties(props, ['value']); | ||
var finalValue = value; | ||
if (placeholder && !value) { | ||
// Set empty string as default value. | ||
// This will show up the placeholder option, when no value is set. | ||
finalValue = ''; | ||
} | ||
return _react2['default'].createElement( | ||
'select', | ||
props, | ||
options ? this.renderOptions(options, placeholder) : children | ||
_extends({ value: finalValue }, restProps), | ||
options ? this.renderOptions(options, multiple, placeholder) : children | ||
); | ||
@@ -119,0 +119,0 @@ }; |
{ | ||
"name": "react-formalize", | ||
"version": "0.3.0-alpha3", | ||
"version": "0.3.0-alpha4", | ||
"description": "Serialize react forms", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
915185
19544