-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BRS-283: Add "Historical" tag to Subarea filters on Review Data page (#…
…332) * create historic pill comp, update enter-data and review-data * dereference array in func call
- Loading branch information
1 parent
6b7b902
commit 6404099
Showing
14 changed files
with
177 additions
and
106 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
@@ -1,27 +0,0 @@ | ||
.historical-pill { | ||
background-color: #2464A4 !important; | ||
} | ||
|
||
.custom-list-group { | ||
max-height: 300px; | ||
padding-left: 0; | ||
margin: 0; | ||
list-style: none; | ||
overflow-y: scroll; | ||
overflow-x: hidden; | ||
} | ||
|
||
.custom-list-group-item { | ||
padding-left: 0.5rem; | ||
padding-right: 0.5rem; | ||
padding-top: 0.35rem; | ||
padding-bottom: 0.35rem; | ||
|
||
&:hover { | ||
background-color: var(--bs-gray-200); | ||
} | ||
} | ||
|
||
.custom-highlight { | ||
font-weight: bold; | ||
} | ||
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
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
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
20 changes: 20 additions & 0 deletions
20
src/app/shared/components/historical-pill/historical-pill.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,20 @@ | ||
<ul class="custom-list-group"> | ||
<li | ||
class="custom-list-group-item" | ||
*ngFor="let match of matches" | ||
[class.active]="typeaheadTemplateMethods.isActive(match)" | ||
(click)="typeaheadTemplateMethods.selectMatch(match, $event)" | ||
(mouseenter)="typeaheadTemplateMethods.selectActive(match)" | ||
> | ||
<span [innerHtml]="getHighlightedMatch(match, query).left"></span> | ||
<span | ||
class="custom-highlight" | ||
[innerHtml]="getHighlightedMatch(match, query).highlight" | ||
></span> | ||
<span [innerHtml]="getHighlightedMatch(match, query).right"></span> | ||
<div | ||
*ngIf="match?.item?.value?.isLegacy" | ||
class="mx-2 badge bg-primary historical-pill" | ||
>historical</div> | ||
</li> | ||
</ul> |
27 changes: 27 additions & 0 deletions
27
src/app/shared/components/historical-pill/historical-pill.component.scss
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,27 @@ | ||
.historical-pill { | ||
background-color: #2464A4 !important; | ||
} | ||
|
||
.custom-list-group { | ||
max-height: 300px; | ||
padding-left: 0; | ||
margin: 0; | ||
list-style: none; | ||
overflow-y: scroll; | ||
overflow-x: hidden; | ||
} | ||
|
||
.custom-list-group-item { | ||
padding-left: 0.5rem; | ||
padding-right: 0.5rem; | ||
padding-top: 0.35rem; | ||
padding-bottom: 0.35rem; | ||
|
||
&:hover { | ||
background-color: var(--bs-gray-200); | ||
} | ||
} | ||
|
||
.custom-highlight { | ||
font-weight: bold; | ||
} |
28 changes: 28 additions & 0 deletions
28
src/app/shared/components/historical-pill/historical-pill.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,28 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { HistoricalPillComponent } from './historical-pill.component'; | ||
|
||
describe('HistoricalPillComponent', () => { | ||
let component: HistoricalPillComponent; | ||
let fixture: ComponentFixture<HistoricalPillComponent>; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [HistoricalPillComponent] | ||
}); | ||
fixture = TestBed.createComponent(HistoricalPillComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should highlight typeahead properly', async() => { | ||
expect(component.getHighlightedMatch({value:'string'}, ['str'])).toEqual({ | ||
left: '<span></span>', | ||
highlight: '<span>str</span>', | ||
right: '<span>ing</span>'} | ||
) | ||
}) | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
38 changes: 38 additions & 0 deletions
38
src/app/shared/components/historical-pill/historical-pill.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,38 @@ | ||
import { Component, Input } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-historical-pill', | ||
templateUrl: './historical-pill.component.html', | ||
styleUrls: ['./historical-pill.component.scss'] | ||
}) | ||
export class HistoricalPillComponent { | ||
@Input() matches: any; | ||
@Input() query: any; | ||
@Input() typeaheadTemplateMethods: any; | ||
|
||
// Custom typeahead formatter so that we can put 'historical' badges on subareas. | ||
getHighlightedMatch(item, query) { | ||
query = query.join(' '); | ||
let display = item.value; | ||
let result = { | ||
left: '', | ||
highlight: '', | ||
right: '', | ||
} | ||
|
||
if (display.toLocaleLowerCase().indexOf(query) > -1) { | ||
const left_str = display.substring(0, display.toLocaleLowerCase().indexOf(query)); | ||
const highlight_str = display.substring(display.toLocaleLowerCase().indexOf(query), display.toLocaleLowerCase().indexOf(query) + query.length); | ||
const right_str = display.substring(display.toLocaleLowerCase().indexOf(query) + query.length); | ||
return { | ||
left: '<span>' + left_str + '</span>', | ||
highlight: '<span>' + highlight_str + '</span>', | ||
right: '<span>' + right_str + '</span>' | ||
}; | ||
} else { | ||
result.left = '<span>' + display + '</span>' | ||
} | ||
|
||
return result; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/app/shared/components/historical-pill/historical-pill.module.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,10 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { HistoricalPillComponent } from './historical-pill.component'; | ||
|
||
@NgModule({ | ||
declarations: [HistoricalPillComponent], | ||
imports: [CommonModule], | ||
exports: [HistoricalPillComponent], | ||
}) | ||
export class HistoricalPillModule {} |
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
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 |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
|
||
.bg-filter { | ||
background-color: $calc-blue; | ||
} | ||
} |
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