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;