react-super-select
Advanced tools
Comparing version 0.1.13 to 0.1.14
@@ -85,2 +85,7 @@ // © Scotland Stephenson 2015 | ||
// **initialValue** (Array|Object) *optional* | ||
// The selected value the control will be initialized with | ||
// must be an array of option items or a single option item from your dataSource collection | ||
initialValue: React.PropTypes.oneOfType([React.PropTypes.arrayOf(React.PropTypes.object), React.PropTypes.object]), | ||
// **optionLabelKey** (String) (*optional - defaults to using 'name' as the key if undefined*) - This value represents the key in each option object (from the **dataSource** collection), which represents the value you would like displayed for each option. | ||
@@ -192,3 +197,3 @@ optionLabelKey: React.PropTypes.string, | ||
// **value** (Array) - An array that holds the current user-selected option(s) | ||
value: [], | ||
value: this._buildInitialValue(), | ||
@@ -319,2 +324,17 @@ // **valueKey** (String) - The option object key that will be used to identify the value used as an option's value property (values must be unique across data source) | ||
// calculate the initial value for the control from props | ||
_buildInitialValue: function _buildInitialValue() { | ||
var initialValue = []; | ||
if (!_.isUndefined(this.props.initialValue)) { | ||
initialValue = _.isArray(this.props.initialValue) ? this.props.initialValue : [this.props.initialValue]; | ||
if (!this._isMultiSelect()) { | ||
initialValue = [_.first(initialValue)]; | ||
} | ||
} | ||
return initialValue; | ||
}, | ||
// close the dropdown | ||
@@ -321,0 +341,0 @@ // resets focus to the main control trigger |
{ | ||
"name": "react-super-select", | ||
"version": "0.1.13", | ||
"description": "index.js", | ||
"main": "lib/react-super-select.js", | ||
"version": "0.1.14", | ||
"description": "A flexible replacement for the html select control built with React", | ||
"main": "./lib/react-super-select.js", | ||
"author": "Scotland Stephenson", | ||
@@ -17,5 +17,7 @@ "homepage": "https://github.com/alsoscotland/react-super-select", | ||
"classnames": "^1.1.4", | ||
"lodash": "^3.7.0", | ||
"react": ">=0.12.2" | ||
"lodash": "^3.7.0" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=0.12.0" | ||
}, | ||
"files": [ | ||
@@ -61,2 +63,3 @@ "lib/" | ||
"jshint-stylish": "^1.0.0", | ||
"react": "^0.13.3", | ||
"react-tools": ">=0.13.0", | ||
@@ -68,2 +71,5 @@ "reactify": "^1.1.1", | ||
}, | ||
"browserify-shim": { | ||
"react": "global:React" | ||
}, | ||
"scripts": { | ||
@@ -70,0 +76,0 @@ "test": "$(npm bin)/jest" |
@@ -55,3 +55,3 @@ # react-super-select | ||
You can also use the standalone build by including `dist/react-super-select.js` in your page. If you use this, make sure you have already included React, and it is available as a global variable. | ||
You can also use the standalone build by including `lib/react-super-select.js` in your page. If you use this, make sure you have already included React, and it is available as a global variable. | ||
@@ -78,4 +78,8 @@ via npm: | ||
```js | ||
var ReactSuperSelect = require('react-super-select'); | ||
``` | ||
### include css | ||
copy the css file from the dist/ folder of node_modules/react-super-select (react-super-select.css) into your app's css directory | ||
copy the css file from the lib/ folder of node_modules/react-super-select (react-super-select.css) into your app's css directory | ||
@@ -82,0 +86,0 @@ ### License |
Sorry, the diff of this file is not supported yet
67360
1367
90
33
- Removedreact@>=0.12.2