2018-01-12 12:25:07 +00:00
|
|
|
const control_classes = {
|
|
|
|
Data: require('./data'),
|
2018-02-14 12:50:56 +00:00
|
|
|
Date: require('./date'),
|
|
|
|
Currency: require('./currency'),
|
2018-01-25 10:04:48 +00:00
|
|
|
Float: require('./float'),
|
2018-02-12 12:24:53 +00:00
|
|
|
Int: require('./int'),
|
2018-02-14 12:50:56 +00:00
|
|
|
Link: require('./link'),
|
2018-02-06 17:14:07 +00:00
|
|
|
Password: require('./password'),
|
2018-02-14 12:50:56 +00:00
|
|
|
Select: require('./select'),
|
|
|
|
Table: require('./table'),
|
|
|
|
Text: require('./text')
|
2018-01-12 12:25:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
2018-02-08 09:38:47 +00:00
|
|
|
getControlClass(fieldtype) {
|
2018-01-12 12:25:07 +00:00
|
|
|
return control_classes[fieldtype];
|
|
|
|
},
|
2018-02-08 09:38:47 +00:00
|
|
|
makeControl({field, form, parent}) {
|
|
|
|
const control_class = this.getControlClass(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;
|
|
|
|
}
|
|
|
|
}
|