ron-react-autocomplete
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -118,3 +118,4 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
show: this.state.showResults, | ||
renderer: this.props.resultRenderer })); | ||
renderer: this.props.resultRenderer, | ||
label: this.props.label })); | ||
}, | ||
@@ -284,3 +285,4 @@ | ||
onMouseEnter: this.onMouseEnterResult, | ||
onClick: this.props.onSelect | ||
onClick: this.props.onSelect, | ||
label: this.props.label | ||
}); | ||
@@ -351,2 +353,18 @@ }, | ||
getDefaultProps: function () { | ||
return { | ||
label: function (result) { | ||
return result.title; | ||
} | ||
}; | ||
}, | ||
getLabel: function (result) { | ||
if (typeof this.props.label === "function") { | ||
return this.props.label(result); | ||
} else if (typeof this.props.label === "string") { | ||
return result[this.props.label]; | ||
} | ||
}, | ||
render: function () { | ||
@@ -362,3 +380,3 @@ var className = cx({ | ||
onClick: this.onClick, | ||
onMouseEnter: this.onMouseEnter }, React.createElement("a", null, this.props.result.title)); | ||
onMouseEnter: this.onMouseEnter }, React.createElement("a", null, this.getLabel(this.props.result))); | ||
}, | ||
@@ -365,0 +383,0 @@ |
{ | ||
"name": "ron-react-autocomplete", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Autocomplete component for React", | ||
@@ -5,0 +5,0 @@ "main": "./lib/reactAutoComplete.js", |
19683
583