4.0.0 • Published 7 years ago
react-fractal-field v4.0.0
react-fractal-field
$ npm install prop-types lodash react react-fractal-field --saveUsage
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 (nullby 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 ontriggerSubmitonly 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 oftriggerSubmitcallingsubmitErrors- 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
7 years ago
3.11.0
7 years ago
3.10.1
8 years ago
3.10.0
8 years ago
3.9.3
8 years ago
3.9.2
8 years ago
3.9.1
8 years ago
3.9.0
8 years ago
3.8.7
8 years ago
3.8.6
8 years ago
3.8.5
8 years ago
3.8.4
8 years ago
3.8.3
8 years ago
3.8.2
8 years ago
3.8.1
8 years ago
3.8.0
8 years ago
3.7.1
8 years ago
3.7.0
8 years ago
3.6.2
8 years ago
3.6.1
8 years ago
3.6.0
8 years ago
3.5.5
8 years ago
3.5.4
8 years ago
3.5.3
8 years ago
3.5.2
8 years ago
3.5.1
8 years ago
3.5.0
8 years ago
3.4.0
8 years ago
3.3.0
8 years ago
3.2.0
8 years ago
3.1.2
8 years ago
3.1.1
8 years ago
3.1.0
8 years ago
3.0.2
8 years ago
3.0.1
8 years ago
3.0.0
8 years ago
2.2.6
8 years ago
2.2.5
8 years ago
2.2.4
8 years ago
2.2.3
8 years ago
2.2.2
8 years ago
2.2.1
8 years ago
2.2.0
8 years ago
2.1.1
8 years ago
2.1.0
8 years ago
2.0.1
8 years ago
2.0.0
8 years ago
1.2.4
8 years ago
1.2.3
8 years ago
1.2.2
8 years ago
1.2.1
8 years ago
1.2.0
8 years ago
1.1.0
8 years ago
1.0.2
8 years ago
1.0.1
8 years ago