Skip to content

Commit

Permalink
feat(forms): Finalize author form
Browse files Browse the repository at this point in the history
  • Loading branch information
bilalshaikh42 committed Mar 21, 2020
1 parent aee07c4 commit 3f4f86c
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 103 deletions.
120 changes: 66 additions & 54 deletions CRBM-Viz/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 13 additions & 12 deletions CRBM-Viz/package.json
Expand Up @@ -18,16 +18,17 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^9.0.0-rc.10",
"@angular/cdk": "^9.0.0",
"@angular/common": "^9.0.0-rc.10",
"@angular/compiler": "^9.0.0-rc.10",
"@angular/core": "^9.0.0-rc.10",
"@angular/forms": "^9.0.0-rc.10",
"@angular/material": "^9.0.0",
"@angular/platform-browser": "^9.0.0-rc.10",
"@angular/platform-browser-dynamic": "^9.0.0-rc.10",
"@angular/router": "^9.0.0-rc.10",
"@angular/animations": "^9.0.7",
"@angular/cdk": "^9.1.3",
"@angular/common": "^9.0.7",
"@angular/compiler": "^9.0.7",
"@angular/core": "^9.0.7",
"@angular/flex-layout": "^9.0.0-beta.29",
"@angular/forms": "^9.0.7",
"@angular/material": "^9.1.3",
"@angular/platform-browser": "^9.0.7",
"@angular/platform-browser-dynamic": "^9.0.7",
"@angular/router": "^9.0.7",
"@angular/service-worker": "^9.0.0-rc.10",
"@auth0/auth0-spa-js": "^1.6.2",
"@bruit/component": "^1.3.11",
Expand Down Expand Up @@ -58,8 +59,8 @@
"devDependencies": {
"@angular-devkit/build-angular": "~0.900.7",
"@angular/cli": "^9.0.7",
"@angular/compiler-cli": "^9.0.0-rc.10",
"@angular/language-service": "^9.0.0-rc.10",
"@angular/compiler-cli": "^9.0.7",
"@angular/language-service": "^9.0.7",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "^2.0.8",
"@types/node": "^12.11.1",
Expand Down
@@ -1,49 +1,53 @@
<div>
<div fxLayout="row" fxLayoutAlign="space-between flex-end">
<h3>Authors</h3>
<a (click)="this.addAuthor()">
<button mat-icon-button (click)="this.addAuthor()">
<fa-icon
aria-hidden="true"
aria-label="Add icon"
[icon]="['fas', 'plus']"
></fa-icon>
Add
</a>
</button>
</div>
<ng-container [formGroup]="control" *ngIf="control.controls.length > 0">
<div cdkDropList (cdkDropListDropped)="drop($event)">
<div
*ngFor="let group of control.controls; index as i"
cdkDrag
class="form-container"
[formGroupName]="i"
>
<mat-form-field class="authorField" appearance="fill">
<mat-label> First Name</mat-label>
<input matInput formControlName="firstName" />
</mat-form-field>
<mat-form-field class="authorField" appearance="fill">
<mat-label> Middle Name</mat-label>
<input matInput formControlName="middleName" />
</mat-form-field>
<mat-form-field class="authorField" appearance="fill">
<mat-label> Last Name</mat-label>
<input matInput formControlName="lastName" />
</mat-form-field>
<fa-icon
aria-hidden="true"
aria-label="Drag icon"
[icon]="['fas', 'grip-lines-vertical']"
class="drag"
></fa-icon>
<fa-icon
aria-hidden="true"
aria-label="Delete icon"
[icon]="['fas', 'trash-alt']"
(click)="this.removeControl(i)"
></fa-icon>
<div fxLayout="row wrap" fxLayoutAlign="space-around center">
<mat-form-field fxFlex="3 1 auto" appearance="fill">
<mat-label> First Name</mat-label>
<input matInput formControlName="firstName" />
</mat-form-field>
<div fxFlex="0 0 1em"></div>
<mat-form-field fxFlex="1 1 auto" appearance="fill">
<mat-label> Middle Name</mat-label>
<input matInput placeholder="c" formControlName="middleName" />
</mat-form-field>
<div fxFlex="0 0 1em"></div>
<mat-form-field fxFlex="3 1 auto" appearance="fill">
<mat-label> Last Name</mat-label>
<input matInput formControlName="lastName" />
</mat-form-field>
<div fxFlex="0 0 1em"></div>
<fa-icon
fxFlex="0 0 auto"
aria-hidden="true"
aria-label="Drag icon"
[icon]="['fas', 'grip-lines-vertical']"
class="drag"
></fa-icon>
<div fxFlex="0 0 0.5em"></div>
<fa-icon
fxFlex="0 0 auto"
aria-hidden="true"
aria-label="Delete icon"
[icon]="['fas', 'trash-alt']"
(click)="this.removeControl(i)"
></fa-icon>
</div>
</div>
</div>
</ng-container>
<button mat-raised-button color="primary" (click)="this.addAuthor()">
Add Author
</button>
@@ -1,5 +0,0 @@
.form-container
display: flex
flex-direction: row
align-items: center
width: 100%
2 changes: 2 additions & 0 deletions CRBM-Viz/src/app/Shared/shared.module.ts
Expand Up @@ -156,6 +156,7 @@ import { NameFormComponent } from './Forms/name-form/name-form.component';
import { IdentifiersFormComponent } from './Forms/identifiers-form/identifiers-form.component';
import { ModelFormComponent } from './Forms/model-form/model-form.component';
import { EditPreviewComponent } from './Components/edit-preview/edit-preview.component';
import { FlexLayoutModule } from '@angular/flex-layout';

@NgModule({
declarations: [
Expand Down Expand Up @@ -229,6 +230,7 @@ import { EditPreviewComponent } from './Components/edit-preview/edit-preview.com
ReactiveFormsModule,
DragDropModule,
NgxDnDModule,
FlexLayoutModule,
],
exports: [
MaterialFileInputModule,
Expand Down
6 changes: 5 additions & 1 deletion CRBM-Viz/src/app/app.module.ts
Expand Up @@ -11,6 +11,7 @@ import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
// Third party tools
import { NgxDnDModule } from '@swimlane/ngx-dnd';
import { LoggerModule, NgxLoggerLevel } from 'ngx-logger';

// Defined Modules in Imports

// Defined Modules in app
Expand Down Expand Up @@ -47,8 +48,11 @@ import { ServiceWorkerModule } from '@angular/service-worker';
HttpClientModule,
MaterialModule,
SharedModule,

LoggerModule.forRoot({ level: environment.logging.level }),
ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }),
ServiceWorkerModule.register('ngsw-worker.js', {
enabled: environment.production,
}),
],
providers: [
{
Expand Down

0 comments on commit 3f4f86c

Please sign in to comment.