Consolidate keys and values with proptype.any

old
Javi Jimenez Villar 2015-07-13 21:15:03 +07:00
parent 5775ab405b
commit d227181cc5
4 changed files with 9 additions and 9 deletions

View File

@ -83,14 +83,14 @@ module.exports = React.createClass
<ul data-role="values" data-flex="horizontal wrap" onClick={@onDelete}>
{
for key, label of @state.values
<li ref={key} id={key} style={backgroundColor: @props.colors[key]}>{label}</li>
<li key={key} id={key} style={backgroundColor: @props.colors[key]}>{label}</li>
}
</ul>
}
<Input {...@props} value="" ref="input" onFocus={@onFocus}
onChange={@onChange} onKeyPress={@onKeyPress} onBlur={@onBlur}/>
<ul ref="suggestions" data-role="suggestions" onClick={@onSelect}>
{<li ref={key} id={key}>{label}</li> for key, label of @state.suggestions}
{<li key={key} id={key}>{label}</li> for key, label of @state.suggestions}
</ul>
</div>

View File

@ -71,7 +71,7 @@ module.exports = React.createClass
<ul ref="values" style={stylesheet} onClick={@onItem}>
{
for item, index in @props.dataSource
<li id={item.value} ref={index} className={"selected" if item.value is @state.selected.value}>
<li id={item.value} key={index} className={"selected" if item.value is @state.selected.value}>
{ if @props.template then @props.template item else item.label }
{ <Ripple origin={@state.ripple}/> if item.value is @state.selected.value }
</li>

View File

@ -59,15 +59,15 @@ module.exports = React.createClass
{
for attribute, index in @state.attributes
if attribute.type is "submit"
<Button {...attribute} type="square" ref="submit" onClick={@onSubmit}/>
<Button key={index} {...attribute} type="square" ref="submit" onClick={@onSubmit}/>
else if attribute.type is "autocomplete"
<Autocomplete {...attribute} onChange={@onChange}/>
<Autocomplete key={index} {...attribute} onChange={@onChange}/>
else if attribute.type is "dropdown"
<Dropdown {...attribute} onChange={@onChange}/>
<Dropdown key={index} {...attribute} onChange={@onChange}/>
else if attribute.type is "switch"
<Switch {...attribute} onChange={@onChange}/>
<Switch key={index} {...attribute} onChange={@onChange}/>
else
<Input {...attribute} />
<Input key={index} {...attribute} />
}
{ @props.children }
</form>

View File

@ -16,7 +16,7 @@ module.exports = React.createClass
onBlur : React.PropTypes.func
required : React.PropTypes.bool
type : React.PropTypes.string
value : React.PropTypes.string
value : React.PropTypes.any
getDefaultProps: ->
className : ''