Skip to content

Commit 30cd80e

Browse files
author
Jonatan Salas
committed
Delete helper module.
Added a method called setBaseComponents that register all fields.
1 parent 94af562 commit 30cd80e

File tree

2 files changed

+29
-34
lines changed

2 files changed

+29
-34
lines changed

src/factory/BootstrapFactory.js

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,42 @@
1-
import { ComponentFactory } from 'redux-autoform-utils';
2-
import { registerBaseComponents } from './helper/BootstrapComponentFactoryHelper';
1+
import ComponentFactory from 'redux-autoform-utils/lib/factory/ComponentFactory';
2+
import TextBox from '../components/fieldComponents/TextBox';
3+
import Select from '../components/fieldComponents/Select';
4+
import TextArea from '../components/fieldComponents/TextArea';
5+
import Group from '../components/groupComponents/Group';
6+
import ArrayContainer from '../components/fieldComponents/ArrayContainer';
7+
import DateTimePicker from '../components/fieldComponents/DateTimePicker';
8+
import Lookup from '../components/fieldComponents/Lookup';
9+
import Static from '../components/fieldComponents/Static';
10+
import FieldGroup from '../components/fieldComponents/FieldGroup';
11+
import Checkbox from '../components/fieldComponents/CheckBox';
12+
import Radio from '../components/fieldComponents/Radio';
313

414
class BootstrapFactory extends ComponentFactory {
5-
615
constructor(config) {
716
super();
8-
registerBaseComponents(this);
17+
this.setBaseComponents();
918
this.setDefaultConfiguration(config);
10-
1119
}
20+
21+
setBaseComponents = () => {
22+
this.registerFieldComponent('TextBox', ['string', 'int', 'float', 'datetime', 'date', 'time'], TextBox);
23+
this.registerFieldComponent('Select', ['string'], Select);
24+
this.registerFieldComponent('Radio', ['string'], Radio);
25+
this.registerFieldComponent('Lookup', ['string'], Lookup);
26+
this.registerFieldComponent('TextArea', ['string'], TextArea);
27+
this.registerFieldComponent('ArrayContainer', ['array'], ArrayContainer);
28+
this.registerFieldComponent('DateTimePicker', ['datetime', 'date', 'time'], DateTimePicker);
29+
this.registerFieldComponent('Checkbox', ['bool'], Checkbox);
30+
this.registerFieldComponent('Static', ['string', 'int', 'float', 'datetime', 'date', 'time', 'bool'], Static);
31+
this.registerFieldComponent('FieldGroup', ['group'], FieldGroup);
1232

33+
this.registerGroupComponent('Group', Group);
34+
};
35+
1336
setDefaultConfiguration = (config) => {
1437
this.setDefaultFieldComponents(config);
1538
this.setDefaultGroupComponent('Group');
16-
}
39+
};
1740

1841
static createComponentFactory(type) {
1942
switch (type) {

src/factory/helper/BootstrapComponentFactoryHelper.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)