4.0.0 • Published 6 years ago
react-fractal-field v4.0.0
react-fractal-field
$ npm install prop-types lodash react react-fractal-field --save
Usage
import { Field, FieldSet } from 'react-fractal-field';
const MyComponent = ({ onSubmit }) => (
<FieldSet onSubmit={onSubmit} isolated>
{({ triggerSubmit }) => (
<div>
<Field name="value">
{({ control }) => (
<div>
<input {...control} type="text" />
</div>
)}
</Field>
<button onClick={triggerSubmit}>Submit</button>
</div>
)}
</FieldSet>
)
API
common FieldSet/FieldList/Field props
:
id
: String, Number - ID used for remote controlling this field/form (null
by default)softTypes
: Boolean - disable type checking. HIGHLY NOT RECOMMENDED!isolated
: Boolean - if true meta/value stopped from sharing between parentname
: String, Number - need for value bindingvalue
: String, Boolean, Number, Array, Object, NullinitialValue
: String, Boolean, Number, Array, Object, Null - values that will be provided for child fields (useful only for forms)onChange
: Function - handler that will be called on every field value changesonValueChange
: Function - handler that will be called on every field changesvalidate
: Function - validation function/array . if error it need to return the error-message stringonChangeValidity
: FunctionpostponeInvalid
: Booleanform
: BooleanonSubmit
: Function - handler that will be called ontriggerSubmit
only in valid form stateexceptionMessage
: Any - error message in case validate/normalize/format throws the errorchildren
: Function - obviously, content of field/formautoClean
: Booleandebug
: Boolean
Field props
:
normalize
: Function - filter value before call onChange/onSubmit/validate callbackformat
: Function - filter value before rendering (or set value to child field). from outer format to inner format
Common FieldSet/FieldList/Field children function params
:
triggerChange
: Function - call when you want to trigger change field by some casetriggerReset
: Function - call when you want to trigger submit, obviousvalue
: Anytouched
: Boolean - true when field or some child field was changed oncepristine
: Boolean - true when field or some child field was not changed oncesubmitted
: Boolean - when this form/field of parent was submitted oncevalid
: Boolean - true if children and this field has no errorsinvalid
: Boolean - true if children and this field/children has errorshasException
: Boolean - true if children and this field/children has exceptionserror
: Any - first error are not false, that returned from validate functioninvalidChildren
: Array - ids of closest children with errorsactive
: Boolean - true if field/children is focusing right nowactivated
: Boolean - true if field/children was focused onceform
: Object - Props of closest isolated form (or field itself)
Common FieldSet/FieldList/Field children function params
when props.form
is true:
triggerSubmit
: Function - call when you want to trigger submit, obvioussubmitSuccess
: Boolean - state of submittingsubmitFailed
: Boolean - state of submittingsubmitting
: Boolean - state of submit processing. in pending (if onSubmit returns the Promise object)submitted
: Boolean - true if form was submitted oncesubmittedTimes
: Number - count oftriggerSubmit
callingsubmitErrors
- Any - payload of submitting
Field children function params
control: { value, onChange, onBlur, onFocus }
- shortcut for putting it into control component (only for components without children fractal-fields)
FieldList children function params
:
Remote api
triggerSubmit(id)
triggerChange(id)
onError(callback)
4.0.0
6 years ago
3.11.0
6 years ago
3.10.1
6 years ago
3.10.0
6 years ago
3.9.3
6 years ago
3.9.2
6 years ago
3.9.1
6 years ago
3.9.0
6 years ago
3.8.7
6 years ago
3.8.6
6 years ago
3.8.5
6 years ago
3.8.4
6 years ago
3.8.3
6 years ago
3.8.2
6 years ago
3.8.1
6 years ago
3.8.0
6 years ago
3.7.1
6 years ago
3.7.0
6 years ago
3.6.2
6 years ago
3.6.1
6 years ago
3.6.0
6 years ago
3.5.5
6 years ago
3.5.4
6 years ago
3.5.3
6 years ago
3.5.2
6 years ago
3.5.1
6 years ago
3.5.0
6 years ago
3.4.0
6 years ago
3.3.0
6 years ago
3.2.0
6 years ago
3.1.2
6 years ago
3.1.1
6 years ago
3.1.0
6 years ago
3.0.2
6 years ago
3.0.1
6 years ago
3.0.0
6 years ago
2.2.6
6 years ago
2.2.5
7 years ago
2.2.4
7 years ago
2.2.3
7 years ago
2.2.2
7 years ago
2.2.1
7 years ago
2.2.0
7 years ago
2.1.1
7 years ago
2.1.0
7 years ago
2.0.1
7 years ago
2.0.0
7 years ago
1.2.4
7 years ago
1.2.3
7 years ago
1.2.2
7 years ago
1.2.1
7 years ago
1.2.0
7 years ago
1.1.0
7 years ago
1.0.2
7 years ago
1.0.1
7 years ago