Releases: gcanti/tcomb-form
v0.9.1
- Bug Fix
- upgrade to
tcomb-form-templates-bootstrap
v0.2, ref gcanti/tcomb-json-schema#22
- upgrade to
v0.9.0
v0.8.2
v0.8.1
v0.8.0
- Breaking Change
- drop
uvdom
,uvdom-bootstrap
dependencies - bootstrap templates in its own repo tcomb-form-templates-bootstrap
- semantic templates in its own repo tcomb-form-templates-semantic
- drop
Migration guide
tcomb-form
follows semver and technically this is a breaking change (hence the minor version bump).
However, if you are using the default bootstrap templates, the default language (english) and you are not relying on the uvdom
and uvdom-bootstrap
modules, this is not a breaking change for you.
How to
I'm using the default bootstrap templates and the default language (english)
This is easy: nothing changed for you.
I'm using the default bootstrap templates but I override the language
var t = require('tcomb-form/lib');
-var templates = require('tcomb-form/lib/templates/bootstrap');
+var templates = require('tcomb-form/node_modules/tcomb-form-templates-bootstrap');
t.form.Form.templates = templates;
t.form.Form.i18n = {
...
};
(contributions to src/i18n
folder welcome!)
I'm using the default language (english) but I override the templates
npm install tcomb-form-templates-semantic --save
var t = require('tcomb-form/lib');
var i18n = require('tcomb-form/lib/i18n/en');
-var templates = require('tcomb-form/lib/templates/semantic');
+var templates = require('tcomb-form-templates-semantic');
t.form.Form.i18n = i18n;
t.form.Form.templates = templates;
0.7.10
v0.7.9
v0.7.8
Warning. uvdom
dependency is deprecated and will be removed in the next releases. If you are using custom templates based on uvdom
, please add a static function toReactElement
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