diff --git a/src/app/components/main/main.component.css b/src/app/components/main/main.component.css index 61b27b4..d9c238f 100644 --- a/src/app/components/main/main.component.css +++ b/src/app/components/main/main.component.css @@ -103,8 +103,23 @@ as-split>as-split-area>div>button { color: darkblue; } +.search { + width: 100%; + border: 0; + border-bottom: 1px solid rgba(0, 0, 0, 0.12); + height: 30px; + padding-inline-start: 10px; + font-size: 15px; +} + +.search:focus { + outline-offset: -2px; +} + + @media (prefers-color-scheme: dark) { - .mat-table { + .mat-table, + .search { background: 0; } @@ -150,4 +165,8 @@ as-split>as-split-area>div>button { .header_key { color: lightblue; } -} \ No newline at end of file + + .search { + border-bottom: 1px solid rgba(255, 255, 255, 0.12); + } +} diff --git a/src/app/components/main/main.component.html b/src/app/components/main/main.component.html index 759c6a3..35c38db 100644 --- a/src/app/components/main/main.component.html +++ b/src/app/components/main/main.component.html @@ -1,5 +1,6 @@ + @@ -112,4 +113,4 @@ - \ No newline at end of file + diff --git a/src/app/components/main/main.component.ts b/src/app/components/main/main.component.ts index d96f3ff..d37cdd9 100644 --- a/src/app/components/main/main.component.ts +++ b/src/app/components/main/main.component.ts @@ -118,14 +118,24 @@ export class MainComponent implements OnInit { const titleRegex = /(.*?)<\/title>/i; const match = response.match(titleRegex); if (match && match.length > 1) { - return match[1]; - } - return ''; + return match[1]; + } + return ''; + } + + applyFilter(event: Event) { + const filterValue = (event.target as HTMLInputElement).value ? (event.target as HTMLInputElement).value : ""; + this.dataSource.filter = filterValue.trim(); } @HostListener('window:keydown.esc', ['$event']) clearclickedRow(event: KeyboardEvent) { event.preventDefault(); - this.clickedRow = undefined + if (this.clickedRow) { + this.clickedRow = undefined; + } else { + (document.getElementById('search') as HTMLInputElement).value = ""; + this.applyFilter(event) + } } }