2018-01-12 12:25:07 +00:00
|
|
|
const control_classes = {
|
|
|
|
Data: require('./data'),
|
|
|
|
Text: require('./text'),
|
2018-01-23 12:26:40 +00:00
|
|
|
Select: require('./select'),
|
2018-01-25 10:04:48 +00:00
|
|
|
Link: require('./link'),
|
|
|
|
Float: require('./float'),
|
2018-02-02 09:21:20 +00:00
|
|
|
Currency: require('./currency'),
|
2018-02-06 17:14:07 +00:00
|
|
|
Password: require('./password'),
|
|
|
|
Table: require('./table')
|
2018-01-12 12:25:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
get_control_class(fieldtype) {
|
|
|
|
return control_classes[fieldtype];
|
|
|
|
},
|
2018-02-06 17:14:07 +00:00
|
|
|
make_control({field, form, parent}) {
|
2018-01-12 12:25:07 +00:00
|
|
|
const control_class = this.get_control_class(field.fieldtype);
|
2018-02-06 17:14:07 +00:00
|
|
|
let control = new control_class({field:field, form:form, parent:parent});
|
2018-01-12 12:25:07 +00:00
|
|
|
control.make();
|
|
|
|
return control;
|
|
|
|
}
|
|
|
|
}
|