tcomb-form v0.7.8 Release Notes
-
โ Warning.
uvdom
dependency is deprecated and will be removed in the next releases. If you are using custom templates based onuvdom
, please add a static functiontoReactElement
before upgrading to v0.8:const Type = t.struct({ name: t.String }) import { compile } from 'uvdom/react' function myTemplate(locals) { return {tag: 'input', attrs: { value: locals.value }} } myTemplate.toReactElement = compile // <= here const options = { fields: { name: { template: myTemplate } } }
๐ New Feature
complete refactoring of bootstrap templates, fix #254
- add a type property to button locals
- one file for each template
- every template own a series of render* function that can be overridden
Example
const Type = t.struct({ name: t.String }) const myTemplate = t.form.Form.templates.textbox.clone({ // override default implementation renderInput: (locals) => { return <input value={locals.value} /> } }) const options = { fields: { name: { template: myTemplate } } }
- more style classes for styling purposes, fix #171
Example
const Type = t.struct({ name: t.String, rememberMe: t.Boolean })
outputs
<!-- fieldset fieldset-depth-<path depth> --> <fieldset class="fieldset fieldset-depth-0" data-reactid=".0.0"> <!-- form-group form-group-depth-<path depth> form-group-<field name> --> <div class="form-group form-group-depth-1 form-group-name" data-reactid=".0.0.$name"> ... </div> <div class="form-group form-group-depth-1 form-group-rememberMe" data-reactid=".0.0.$rememberMe"> ... </div> </fieldset>
complete refactoring of semantic templates
- add a type property to button locals
- one file for each template
- every template own a series of render* function that can be overridden
- more style classes for styling purposes, fix #171
add
context
prop to templatelocals
๐ Bug Fix
- Incosistent calling of tcomb-validation
validate
function ingetTypeInfo
and components for struct and list types, fix #253 - avoid useless re-renderings of Datetime when the value is undefined
- Incosistent calling of tcomb-validation
Experimental
- if a type owns a
getTcombFormFactory(options)
static function, it will be used to retrieve the suitable factory
Example
// instead of const Country = t.enums.of(['IT', 'US'], 'Country'); const Type = t.struct({ country: Country }); const options = { fields: { country: { factory: t.form.Radio } } }; // you can write const Country = t.enums.of(['IT', 'US'], 'Country'); Country.getTcombFormFactory = function (/*options*/) { return t.form.Radio; }; const Type = t.struct({ country: Country }); const options = {};
- if a type owns a
Internal
- remove
raw
param ingetValue
API (usevalidate()
API instead) - remove deprecated types short alias from tests
- factor out UIDGenerator from
Form
render method - optimize
getError()
return an error message only ifhasError === true
- remove