mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	refactoring
This commit is contained in:
		@@ -2,9 +2,9 @@
 | 
			
		||||
  <button class="btn btn-outline-primary btn-sm" id="dropdown{{title}}" ngbDropdownToggle>{{title}}</button>
 | 
			
		||||
  <div class="dropdown-menu quick-filter shadow" ngbDropdownMenu attr.aria-labelledby="dropdown{{title}}">
 | 
			
		||||
    <div class="list-group list-group-flush">
 | 
			
		||||
      <input class="list-group-item form-control form-control-sm" type="text" [(ngModel)]="filterText" placeholder="Filter {{title}}" #filterTextInput>
 | 
			
		||||
      <ng-container *ngIf="(items | filter: filterText).length > 0">
 | 
			
		||||
        <button class="list-group-item list-group-item-action d-flex align-items-center" role="menuitem" *ngFor="let item of items | filter: filterText; let i = index" (click)="toggleItem(item)">
 | 
			
		||||
      <input class="list-group-item form-control form-control-sm" type="text" [(ngModel)]="listFilterText" placeholder="Filter {{title}}" #listFilterTextInput>
 | 
			
		||||
      <ng-container *ngIf="(items | filter: listFilterText).length > 0">
 | 
			
		||||
        <button class="list-group-item list-group-item-action d-flex align-items-center" role="menuitem" *ngFor="let item of items | filter: listFilterText; let i = index" (click)="toggleItem(item)">
 | 
			
		||||
          <div class="selected-icon mr-1">
 | 
			
		||||
            <svg *ngIf="itemsActive.includes(item)" width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-check" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
 | 
			
		||||
              <path fill-rule="evenodd" d="M10.97 4.97a.75.75 0 0 1 1.071 1.05l-3.992 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425a.236.236 0 0 1 .02-.022z"/>
 | 
			
		||||
 
 | 
			
		||||
@@ -17,12 +17,12 @@ export class FilterDropdownComponent implements OnInit {
 | 
			
		||||
  @Output()
 | 
			
		||||
  toggle = new EventEmitter()
 | 
			
		||||
 | 
			
		||||
  @ViewChild('filterTextInput') filterTextInput: ElementRef
 | 
			
		||||
  @ViewChild('listFilterTextInput') listFilterTextInput: ElementRef
 | 
			
		||||
 | 
			
		||||
  items: ObjectWithId[] = []
 | 
			
		||||
  itemsActive: ObjectWithId[] = []
 | 
			
		||||
  title: string
 | 
			
		||||
  filterText: string
 | 
			
		||||
  listFilterText: string
 | 
			
		||||
  display: string
 | 
			
		||||
 | 
			
		||||
  ngOnInit(): void {
 | 
			
		||||
@@ -38,7 +38,7 @@ export class FilterDropdownComponent implements OnInit {
 | 
			
		||||
  dropdownOpenChange(open: boolean): void {
 | 
			
		||||
    if (open) {
 | 
			
		||||
      setTimeout(() => {
 | 
			
		||||
        this.filterTextInput.nativeElement.focus();
 | 
			
		||||
        this.listFilterTextInput.nativeElement.focus();
 | 
			
		||||
      }, 0);
 | 
			
		||||
    } else {
 | 
			
		||||
      this.filterText = ''
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user