diff --git a/components/autocomplete/index.cjsx b/components/autocomplete/index.cjsx index a85888be..9424ca5a 100644 --- a/components/autocomplete/index.cjsx +++ b/components/autocomplete/index.cjsx @@ -19,12 +19,12 @@ module.exports = React.createClass value : React.PropTypes.any getDefaultProps: -> - className : "" + className : '' colors : {} dataSource : {} exact : true multiple : true - type : "text" + type : 'text' getInitialState: -> focus : false @@ -57,12 +57,12 @@ module.exports = React.createClass if @state.focus children = @refs.suggestions.getDOMNode().children - for child, index in children when child.classList.contains "active" - child.classList.remove "active" - query = child.getAttribute "id" + for child, index in children when child.classList.contains 'active' + child.classList.remove 'active' + query = child.getAttribute 'id' break - if key_ascii is 13 and query isnt "" + if key_ascii is 13 and query isnt '' for key, label of @state.suggestions when query.toLowerCase() is label.toLowerCase() suggestion = {"#{key}": label} break @@ -76,23 +76,23 @@ module.exports = React.createClass index = if index >= children.length - 1 then 0 else index + 1 else index = if index is 0 then children.length - 1 else index - 1 - children[index].classList.add "active" + children[index].classList.add 'active' onBlur: (event) -> setTimeout (=> @setState focus: false, suggestions: {}), 300 onSelect: (event) -> - key = event.target.getAttribute "id" + key = event.target.getAttribute 'id' @_addValue {"#{key}": @state.suggestions[key]} onRefreshSelection: (event) -> children = @refs.suggestions.getDOMNode().children - for child, index in children when child.classList.contains "active" - child.classList.remove "active" + for child, index in children when child.classList.contains 'active' + child.classList.remove 'active' break onDelete: (event) -> - delete @state.values[event.target.getAttribute "id"] + delete @state.values[event.target.getAttribute 'id'] @setState focus: false, values: @state.values @props.onChange? @ @@ -100,12 +100,12 @@ module.exports = React.createClass render: -> className = "#{localCSS.root} #{@props.className}" className += " #{@props.type}" if @props.type - className += " focus" if @state.focus + className += ' focus' if @state.focus
if @props.label } { if @props.multiple - } - - @@ -154,7 +154,7 @@ module.exports = React.createClass values = value setTimeout (=> @props.onChange? @), 10 @setState focus: false, values: values - @refs.input.setValue if @props.multiple then "" else value[key] + @refs.input.setValue if @props.multiple then '' else value[key] _getSuggestions: (query) -> suggestions = {}