Sha256: a3de25db4d8d52508eec642dbdfef4e2c1e3f13c0e1f3db944601c8dee763913

Contents?: true

Size: 877 Bytes

Versions: 5

Compression:

Stored size: 877 Bytes

Contents

import React from 'react';

export class FakeNumberEvent {
    constructor(value) {
        value = _.isNull(value) ? 0 : value;
        this.target = {value};
    }
    isDefaultPrevented() { return false; }
}

export class NumberInput extends React.Component {
    static mixins = [
        Hippo.Components.Form.InputFieldMixin
    ];
    handleNumberChange(n) {
        return (
            this.fieldMixinSetValue( new FakeNumberEvent(n) )
        );
    }

    renderInputField(props, handlers) {

        if (!props.format) { props.format = '#,###.00'; }
        props = _.omit(props, 'label');

        return (

            <Hippo.Vendor.ReactWidgets.NumberPicker
                ref="select"
                {...handlers}
                {...props}
                onChange={this.handleNumberChange}
                value={Number(props.value)} />

        );
    }
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hippo-fw-0.9.5 client/hippo/components/shared/NumberInput.jsx
hippo-fw-0.9.4 client/hippo/components/shared/NumberInput.jsx
hippo-fw-0.9.3 client/hippo/components/shared/NumberInput.jsx
hippo-fw-0.9.2 client/hippo/components/shared/NumberInput.jsx
hippo-fw-0.9.1 client/hippo/components/shared/NumberInput.jsx