Comparing version 0.0.28 to 0.0.29
@@ -94,3 +94,5 @@ 'use strict'; | ||
key: 'handleInput', | ||
value: function handleInput(e) { | ||
value: function handleInput(onChange, e) { | ||
if (onChange) onChange(e); | ||
var item = e.target; | ||
@@ -114,3 +116,3 @@ var formItems = this.state.formItems; | ||
if (_onSubmit) _onSubmit(); | ||
if (_onSubmit) _onSubmit(e); | ||
@@ -290,3 +292,4 @@ var formItems = this.state.formItems; | ||
className = _props2.className, | ||
otherProps = _objectWithoutProperties(_props2, ['store', 'validations', 'className']); | ||
onChange = _props2.onChange, | ||
otherProps = _objectWithoutProperties(_props2, ['store', 'validations', 'className', 'onChange']); | ||
@@ -299,3 +302,3 @@ var thisItem = store.state.formItems[this.props.name]; | ||
_react2.default.createElement('input', _extends({}, otherProps, { | ||
onChange: store.handleInput, | ||
onChange: store.handleInput.bind(this, onChange), | ||
className: '' + (className || '') + thisItem.className, | ||
@@ -334,3 +337,4 @@ value: thisItem.value })), | ||
className = _props3.className, | ||
otherProps = _objectWithoutProperties(_props3, ['store', 'validations', 'className']); | ||
onChange = _props3.onChange, | ||
otherProps = _objectWithoutProperties(_props3, ['store', 'validations', 'className', 'onChange']); | ||
@@ -345,3 +349,3 @@ var thisItem = store.state.formItems[this.props.name]; | ||
_extends({}, otherProps, { | ||
onChange: store.handleInput, | ||
onChange: store.handleInput.bind(this, onChange), | ||
className: '' + (className || '') + thisItem.className, | ||
@@ -384,3 +388,4 @@ value: thisItem.value }), | ||
className = _props4.className, | ||
otherProps = _objectWithoutProperties(_props4, ['store', 'validations', 'children', 'className']); | ||
onChange = _props4.onChange, | ||
otherProps = _objectWithoutProperties(_props4, ['store', 'validations', 'children', 'className', 'onChange']); | ||
@@ -395,3 +400,3 @@ var thisItem = store.state.formItems[this.props.name]; | ||
_extends({}, otherProps, { | ||
onChange: store.handleInput, | ||
onChange: store.handleInput.bind(this, onChange), | ||
className: '' + (className || '') + thisItem.className }), | ||
@@ -398,0 +403,0 @@ children |
{ | ||
"name": "recassfov", | ||
"version": "0.0.28", | ||
"version": "0.0.29", | ||
"description": "React client and server side form validation", | ||
@@ -5,0 +5,0 @@ "main": "./build/Recassfov.js", |
@@ -53,3 +53,5 @@ import React from 'react' | ||
handleInput (e) { | ||
handleInput (onChange, e) { | ||
if (onChange) onChange(e) | ||
const item = e.target | ||
@@ -79,3 +81,3 @@ const formItems = this.state.formItems | ||
if (onSubmit) onSubmit() | ||
if (onSubmit) onSubmit(e) | ||
@@ -243,3 +245,3 @@ const formItems = this.state.formItems | ||
render () { | ||
const { store, validations, className, ...otherProps } = this.props | ||
const { store, validations, className, onChange, ...otherProps } = this.props | ||
const thisItem = store.state.formItems[this.props.name] | ||
@@ -251,3 +253,3 @@ | ||
{...otherProps} | ||
onChange={store.handleInput} | ||
onChange={store.handleInput.bind(this, onChange)} | ||
className={`${className || ''}${thisItem.className}`} | ||
@@ -269,3 +271,3 @@ value={thisItem.value} /> | ||
render () { | ||
const { store, validations, className, ...otherProps } = this.props | ||
const { store, validations, className, onChange, ...otherProps } = this.props | ||
const thisItem = store.state.formItems[this.props.name] | ||
@@ -277,3 +279,3 @@ | ||
{...otherProps} | ||
onChange={store.handleInput} | ||
onChange={store.handleInput.bind(this, onChange)} | ||
className={`${className || ''}${thisItem.className}`} | ||
@@ -298,3 +300,3 @@ value={thisItem.value}> | ||
render () { | ||
const { store, validations, children, className, ...otherProps } = this.props | ||
const { store, validations, children, className, onChange, ...otherProps } = this.props | ||
const thisItem = store.state.formItems[this.props.name] | ||
@@ -306,3 +308,3 @@ | ||
{...otherProps} | ||
onChange={store.handleInput} | ||
onChange={store.handleInput.bind(this, onChange)} | ||
className={`${className || ''}${thisItem.className}`}> | ||
@@ -309,0 +311,0 @@ {children} |
174342
830