-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(forms): enable access form component
- Loading branch information
1 parent
d2e35e8
commit 741afa3
Showing
4 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
CRBM-Viz/src/app/Shared/Forms/access-form/access-form.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<mat-select | ||
[formControl]="control" | ||
required | ||
class="form-input" | ||
disableRipple="true" | ||
panelClass="form-select-input-panel" | ||
> | ||
<mat-option *ngFor="let option of accessLevels" [value]="option.value">{{ | ||
option.name | ||
}}</mat-option> | ||
</mat-select> |
Empty file.
25 changes: 25 additions & 0 deletions
25
CRBM-Viz/src/app/Shared/Forms/access-form/access-form.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { AccessFormComponent } from './access-form.component'; | ||
|
||
describe('AccessFormComponent', () => { | ||
let component: AccessFormComponent; | ||
let fixture: ComponentFixture<AccessFormComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ AccessFormComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(AccessFormComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
31 changes: 31 additions & 0 deletions
31
CRBM-Viz/src/app/Shared/Forms/access-form/access-form.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Component, OnInit, forwardRef } from '@angular/core'; | ||
import { ValueSubForm } from '../value-sub-form'; | ||
import { accessLevels, AccessLevel } from '../../Enums/access-level'; | ||
import { NG_VALIDATORS, NG_VALUE_ACCESSOR } from '@angular/forms'; | ||
|
||
@Component({ | ||
selector: 'app-access-form', | ||
templateUrl: './access-form.component.html', | ||
styleUrls: ['./access-form.component.sass'], | ||
providers: [ | ||
{ | ||
provide: NG_VALUE_ACCESSOR, | ||
useExisting: forwardRef(() => AccessFormComponent), | ||
multi: true, | ||
}, | ||
{ | ||
provide: NG_VALIDATORS, | ||
useExisting: forwardRef(() => AccessFormComponent), | ||
multi: true, | ||
}, | ||
], | ||
}) | ||
export class AccessFormComponent extends ValueSubForm implements OnInit { | ||
accessLevels: { value: AccessLevel; name: string }[]; | ||
constructor() { | ||
super(); | ||
this.accessLevels = accessLevels; | ||
} | ||
|
||
ngOnInit(): void {} | ||
} |