Skip to content

Commit

Permalink
Code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Oliveira committed Feb 1, 2018
1 parent 37d2a66 commit 47f8220
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/ng-xform/fields/index.ts
Expand Up @@ -6,4 +6,4 @@ export * from './select-option';
export * from './checkbox-field';
export * from './multiline-field';
export * from './autocomplete-field';
export * from './nested-object-field';
export * from './nested-form-group';
@@ -1,13 +1,13 @@
import { DynamicField } from './dynamic-field';

export class NestedObjectField extends DynamicField {
export class NestedFormGroup extends DynamicField {
public controlType ? = 'GROUP';
public key: string;
public label?: string;
public fields: DynamicField[];

constructor(
options: NestedObjectField
options: NestedFormGroup
) {
super(options);
this.key = options.key;
Expand Down
2 changes: 1 addition & 1 deletion src/ng-xform/form-group/form-group.component.ts
Expand Up @@ -3,7 +3,7 @@ import { Validators, FormGroup, FormControl } from '@angular/forms';
import { Component, OnInit, Input, EventEmitter, Output, OnChanges } from '@angular/core';

import { DynamicField } from '../fields/dynamic-field';
import { NestedObjectField } from '../fields/nested-object-field';
import { NestedFormGroup } from '../fields/nested-form-group';

/**
* This component builds a form with input components from fields list.
Expand Down
4 changes: 2 additions & 2 deletions src/ng-xform/ng-xform.component.spec.ts
Expand Up @@ -7,7 +7,7 @@ import { By } from '@angular/platform-browser';

import { OptionValue } from '../types';
import { MultilineField } from './fields/multiline-field';
import { NestedObjectField } from './fields/nested-object-field';
import { NestedFormGroup } from './fields/nested-form-group';
import {
AutocompleteField,
TextField,
Expand Down Expand Up @@ -70,7 +70,7 @@ describe('DynamicFormComponent', () => {
valueFormatter: 'name',
listFormatter: 'name'
}),
new NestedObjectField({
new NestedFormGroup({
key: 'address', label: 'Address',
fields: [
new TextField({ key: 'street', label: 'Street' }),
Expand Down
4 changes: 2 additions & 2 deletions src/ng-xform/ng-xform.component.ts
Expand Up @@ -2,7 +2,7 @@ import { Validators, FormGroup, FormControl } from '@angular/forms';
import { Component, OnInit, Input, EventEmitter, Output, OnChanges, SimpleChanges } from '@angular/core';

import { DynamicField } from './fields/dynamic-field';
import { NestedObjectField } from './fields/nested-object-field';
import { NestedFormGroup } from './fields/nested-form-group';

/**
* This component builds a form with input components from fields list.
Expand Down Expand Up @@ -57,7 +57,7 @@ export class NgXformComponent implements OnInit, OnChanges {
let group: any = {};

fields.forEach(field => {
if (field instanceof NestedObjectField) {
if (field instanceof NestedFormGroup) {
group[field.key] = this.createFormGroup(field.fields);
} else {
group[field.key] = field.validators
Expand Down

0 comments on commit 47f8220

Please sign in to comment.