Skip to content

Commit cc7b1a2

Browse files
authored
Merge pull request #134 from 0x41head/angular-ui
Added minor bug fixes
2 parents 3bad7da + a3b994f commit cc7b1a2

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

src/app/component/mapping/mapping.component.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
.mat-form-field{
77
margin: 20px;
8-
width: 90%;
8+
width: 50%;
99
}
1010

1111
.matrix-table{

src/app/component/mapping/mapping.component.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class MappingComponent implements OnInit {
3838
separatorKeysCodes: number[] = [ENTER, COMMA];
3939
chipCtrl = new FormControl('');
4040
filteredChips: Observable<string[]>;
41-
currentChip: string[] = ['Performed Activities','Planned Activities'];
41+
currentChip: string[] = [];
4242
allChips: string[] = ['Performed Activities','Planned Activities'];
4343

4444
@ViewChild('chipInput') chipInput!: ElementRef<HTMLInputElement>;
@@ -97,10 +97,21 @@ export class MappingComponent implements OnInit {
9797
if (index >= 0) {
9898
this.currentChip.splice(index, 1);
9999
}
100+
this.changeTableBasedOnCurrentFilter()
100101
}
101102

102103
selected(event: MatAutocompleteSelectedEvent): void {
103104
this.currentChip.push(event.option.viewValue);
105+
this.changeTableBasedOnCurrentFilter()
106+
}
107+
108+
private _filter(value: string): string[] {
109+
const filterValue = value.toLowerCase();
110+
111+
return this.allChips.filter(chip => chip.toLowerCase().includes(filterValue));
112+
}
113+
114+
changeTableBasedOnCurrentFilter(){
104115
if((this.currentChip.length>1)||(this.currentChip.length==0)){ // both planned and performed actvities are selected
105116
this.dataSource._data.next(this.allMappingData);
106117
}
@@ -118,10 +129,4 @@ export class MappingComponent implements OnInit {
118129
this.chipInput.nativeElement.value = '';
119130
this.chipCtrl.setValue(null);
120131
}
121-
122-
private _filter(value: string): string[] {
123-
const filterValue = value.toLowerCase();
124-
125-
return this.allChips.filter(chip => chip.toLowerCase().includes(filterValue));
126-
}
127132
}

0 commit comments

Comments
 (0)