Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

Releases: gcanti/tcomb-form

v0.9.1

22 Mar 15:04
Compare
Choose a tag to compare

v0.9.0

07 Mar 11:38
Compare
Choose a tag to compare

Warning. If you don't rely in your codebase on the property maybe(MyType)(undefined) === null this is not a breaking change for you.

  • Breaking Change
    • upgrade to tcomb-validation v3.0.0
  • Polish
    • remove evt.preventDefault() calls

v0.8.2

22 Feb 16:11
Compare
Choose a tag to compare
  • New Feature
    • now options can also be a function (value: any) -> object
    • support for unions, fix #297
    • add new isPristine field to templates locals
  • Documentation
    • add issue template (new GitHub feature)

v0.8.1

21 Jan 12:09
Compare
Choose a tag to compare
  • New Feature
    • add dist configuration for npmcdn

v0.8.0

06 Jan 12:05
Compare
Choose a tag to compare

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

09 Dec 16:36
Compare
Choose a tag to compare
  • Bug Fix
    • IE8 issue, 'this.refs.input' is null or not and object, fix #268

v0.7.9

09 Dec 07:14
Compare
Choose a tag to compare
  • Bug Fix
    • use keys returned from getTypeProps as refs, #269

v0.7.8

26 Nov 23:39
Compare
Choose a tag to compare

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 template locals

  • Bug Fix

    • Incosistent calling of tcomb-validation validate function in getTypeInfo and components for struct and list types, fix #253
    • avoid useless re-renderings of Datetime when the value is undefined
  • 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 = {};
  • Internal

    • remove raw param in getValue API (use validate() API instead)
    • remove deprecated types short alias from tests
    • factor out UIDGenerator from Form render method
    • optimize getError() return an error message only if hasError === true

v0.7.7

25 Nov 10:20
Compare
Choose a tag to compare

v0.7.6

02 Nov 13:36
Compare
Choose a tag to compare
  • Bug Fix
    • de-optimise structs / lists onChange, fix #235
  • Experimental
    • add support for maybe structs and maybe lists, fix #236