Sha256: 7320f27615ab72d7b8e6ff9a9f2c198c873823ac080becb1415755d378aa0e75

Contents?: true

Size: 938 Bytes

Versions: 3

Compression:

Stored size: 938 Bytes

Contents

class FakeInputEvent
    constructor: (value) ->
        @target = {value}
    isDefaultPrevented: -> false


class Lanes.Components.Checkbox extends Lanes.React.Component

    propTypes:
        supportIndeterminate: React.PropTypes.bool

    componentDidMount:  -> @updateIndeterminate()
    componentDidUpdate: -> @updateIndeterminate()

    mixins: [
        Lanes.Components.Form.InputFieldMixin
    ]

    updateIndeterminate: ->
        return unless @props.supportIndeterminate
        _.dom(@).el.indeterminate =
            @props.checked isnt true and @props.checked isnt false

    handleCheckboxChange: (ev) ->
        if ev.target.checked
            @fieldMixinSetValue( new FakeInputEvent(@props.value) )

    renderInputField: (props, handlers) ->
        <input type="checkbox"
            {...handlers}
            {...props}
            checked={@props.checked}
            onChange={@handleCheckboxChange}
        />

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lanes-0.7.0 client/lanes/components/shared/Checkbox.cjsx
lanes-0.6.1 client/lanes/components/shared/Checkbox.cjsx
lanes-0.6.0 client/lanes/components/shared/Checkbox.cjsx