From 89d6334aed037ae23100132fefddec5c4b7300bd Mon Sep 17 00:00:00 2001 From: Jonathan Petitcolas Date: Thu, 28 May 2015 19:15:56 +0200 Subject: [PATCH] Add float type --- lib/Factory.js | 2 ++ lib/Field/FloatField.js | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100644 lib/Field/FloatField.js diff --git a/lib/Factory.js b/lib/Factory.js index 5bf0e19..83f4565 100644 --- a/lib/Factory.js +++ b/lib/Factory.js @@ -13,6 +13,7 @@ import ChoicesField from "./Field/ChoicesField"; import DateField from "./Field/DateField"; import DateTimeField from "./Field/DateTimeField"; import EmailField from "./Field/EmailField"; +import FloatField from "./Field/FloatField.js"; import FileField from "./Field/FileField"; import JsonField from "./Field/JsonField"; import NumberField from "./Field/NumberField"; @@ -89,6 +90,7 @@ class Factory { this.registerFieldType('date', DateField); this.registerFieldType('datetime', DateTimeField); this.registerFieldType('email', EmailField); + this.registerFieldType('float', FloatField); this.registerFieldType('string', Field); this.registerFieldType('file', FileField); this.registerFieldType('json', JsonField); diff --git a/lib/Field/FloatField.js b/lib/Field/FloatField.js new file mode 100644 index 0000000..4436f06 --- /dev/null +++ b/lib/Field/FloatField.js @@ -0,0 +1,11 @@ +import NumberField from "./NumberField"; + +class FloatField extends NumberField { + constructor(name) { + super(name); + this._type = 'float'; + this._format = '0.000'; + } +} + +export default FloatField;