|
|
|
@ -3,9 +3,9 @@ import {
|
|
|
|
|
Component,
|
|
|
|
|
ElementRef,
|
|
|
|
|
EventEmitter,
|
|
|
|
|
Input,
|
|
|
|
|
Input, OnChanges,
|
|
|
|
|
OnInit,
|
|
|
|
|
Output,
|
|
|
|
|
Output, SimpleChanges,
|
|
|
|
|
ViewChild
|
|
|
|
|
} from "@angular/core";
|
|
|
|
|
import {FileService} from "../../../../services/file/file.service";
|
|
|
|
@ -20,6 +20,7 @@ import {
|
|
|
|
|
} from "../../../../models/FilterExpression";
|
|
|
|
|
import {FilterDialogComponent} from "./filter-dialog/filter-dialog.component";
|
|
|
|
|
import {Tag} from "../../../../models/Tag";
|
|
|
|
|
import {clipboard} from "@tauri-apps/api";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
@ -33,12 +34,15 @@ export class FileSearchComponent implements AfterViewChecked, OnInit {
|
|
|
|
|
public filters: FilterExpression[] = [];
|
|
|
|
|
|
|
|
|
|
@Input() availableTags: Tag[] = [];
|
|
|
|
|
@Input() contextTags: Tag[] = [];
|
|
|
|
|
@Output() searchStartEvent = new EventEmitter<void>();
|
|
|
|
|
@Output() searchEndEvent = new EventEmitter<void>();
|
|
|
|
|
|
|
|
|
|
@ViewChild("tagInput") tagInput!: ElementRef<HTMLInputElement>;
|
|
|
|
|
@ViewChild("tagInputList") inputList!: ElementRef;
|
|
|
|
|
|
|
|
|
|
public contextMenuTag: Tag | undefined;
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
private errorBroker: ErrorBrokerService,
|
|
|
|
|
private fileService: FileService,
|
|
|
|
@ -74,6 +78,11 @@ export class FileSearchComponent implements AfterViewChecked, OnInit {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async addSearchTagAndSearch(tag: string) {
|
|
|
|
|
this.addSearchTag(tag);
|
|
|
|
|
await this.searchForFiles();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getValidSearchTags(): Tag[] {
|
|
|
|
|
return this.availableTags.filter(t => this.filters.findIndex(
|
|
|
|
|
f => f.partiallyEq(t.getNormalizedOutput())) < 0);
|
|
|
|
@ -130,4 +139,8 @@ export class FileSearchComponent implements AfterViewChecked, OnInit {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async copyToClipboard(text: string) {
|
|
|
|
|
await clipboard.writeText(text);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|