Fix scrollbar behaviour in filesearch

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/4/head
trivernis 2 years ago
parent 918f4b3bb8
commit 981e23a192

@ -17,16 +17,6 @@ export type TagQuery = {
tag: string,
};
export type PropertyKeys =
"Status"
| "FileSize"
| "ImportedTime"
| "ChangedTime"
| "CreatedTime"
| "TagCount"
| "Cd"
| "Id";
export type PropertyQuery = PropertyQueryStatus
| PropertyQueryFileSize
| PropertyQueryImportedTime

@ -1,25 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import {ComponentFixture, TestBed} from "@angular/core/testing";
import { SelectableComponent } from './selectable.component';
import {SelectableComponent} from "./selectable.component";
describe('SelectableComponent', () => {
let component: SelectableComponent;
let fixture: ComponentFixture<SelectableComponent>;
describe("SelectableComponent", () => {
let component: SelectableComponent;
let fixture: ComponentFixture<SelectableComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ SelectableComponent ]
})
.compileComponents();
});
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [SelectableComponent]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(SelectableComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
beforeEach(() => {
fixture = TestBed.createComponent(SelectableComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it("should create", () => {
expect(component).toBeTruthy();
});
});

@ -1,25 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import {ComponentFixture, TestBed} from "@angular/core/testing";
import { FilterInputComponent } from './filter-input.component';
import {FilterInputComponent} from "./filter-input.component";
describe('FilterInputComponent', () => {
let component: FilterInputComponent;
let fixture: ComponentFixture<FilterInputComponent>;
describe("FilterInputComponent", () => {
let component: FilterInputComponent;
let fixture: ComponentFixture<FilterInputComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ FilterInputComponent ]
})
.compileComponents();
});
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [FilterInputComponent]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(FilterInputComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
beforeEach(() => {
fixture = TestBed.createComponent(FilterInputComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it("should create", () => {
expect(component).toBeTruthy();
});
});

@ -54,11 +54,13 @@ export class FileSearchComponent implements AfterViewChecked, OnInit {
this.state.sortKeys.subscribe(s => this.sortExpression = s);
this.applyStatusFromFilters();
await this.searchForFiles();
this.needsScroll = true;
}
public ngAfterViewChecked(): void {
if (this.needsScroll) {
this.inputList.nativeElement.scrollLeft = this.inputList.nativeElement.scrollWidth;
this.needsScroll = false;
}
}

@ -1,25 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import {ComponentFixture, TestBed} from "@angular/core/testing";
import { FilterExpressionListItemComponent } from './filter-expression-list-item.component';
import {FilterExpressionListItemComponent} from "./filter-expression-list-item.component";
describe('FilterExpressionListItemComponent', () => {
let component: FilterExpressionListItemComponent;
let fixture: ComponentFixture<FilterExpressionListItemComponent>;
describe("FilterExpressionListItemComponent", () => {
let component: FilterExpressionListItemComponent;
let fixture: ComponentFixture<FilterExpressionListItemComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ FilterExpressionListItemComponent ]
})
.compileComponents();
});
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [FilterExpressionListItemComponent]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(FilterExpressionListItemComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
beforeEach(() => {
fixture = TestBed.createComponent(FilterExpressionListItemComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it("should create", () => {
expect(component).toBeTruthy();
});
});

@ -43,7 +43,9 @@ import {TagQueryItemComponent} from "./file-search/filter-expression-item/tag-qu
import {
PropertyQueryItemComponent
} from "./file-search/filter-expression-item/property-query-item/property-query-item.component";
import { FilterExpressionListItemComponent } from './file-search/filter-dialog/filter-expression-list-item/filter-expression-list-item.component';
import {
FilterExpressionListItemComponent
} from "./file-search/filter-dialog/filter-expression-list-item/filter-expression-list-item.component";
@NgModule({

@ -1,105 +0,0 @@
import {TagQuery} from "./TagQuery";
import {createRustEnum} from "./rust-types";
import {FilterExpression} from "../../api/api-types/files";
export interface GenericFilter {
filter_type: "OrExpression" | "Query";
filter: TagQuery[] | TagQuery;
eq(value: any): boolean;
partiallyEq(value: any): boolean;
getDisplayName(): string;
clone(): GenericFilter;
queryList(): TagQuery[];
toBackendType(): FilterExpression;
}
export class OrFilterExpression implements GenericFilter {
public filter_type: "OrExpression" = "OrExpression";
public filter: TagQuery[] = [];
constructor(tags: TagQuery[]) {
this.filter = tags;
}
public eq(value: any): boolean {
return this == value;
}
public partiallyEq(value: any): boolean {
return this == value;
}
public getDisplayName(): string {
return this.filter.map(t => t.getNormalizedTag()).join(" OR ");
}
public clone(): OrFilterExpression {
let tags = this.filter.map(
(t: TagQuery) => new TagQuery(t.tag, t.negate));
return new OrFilterExpression(tags);
}
public queryList(): TagQuery[] {
return this.filter;
}
public removeQueryEntry(index: number) {
this.filter.splice(index, 1);
}
public removeDuplicates() {
const filters = this.filter.reverse();
let newEntries: TagQuery[] = [];
for (const entry of filters) {
if (newEntries.findIndex(f => f.tag === entry.tag) < 0) {
newEntries.push(entry);
}
}
this.filter = newEntries.reverse();
}
public toBackendType(): FilterExpression {
return createRustEnum(this.filter_type, createRustEnum("Tag", this.filter)) as unknown as FilterExpression;
}
}
export class SingleFilterExpression implements GenericFilter {
public filter_type: "Query" = "Query";
public filter: TagQuery;
constructor(tag: TagQuery) {
this.filter = tag;
}
public eq(value: any): boolean {
return (this.filter.tag === value?.name && this.filter.negate === value?.negate) || this.filter.getNormalizedTag() === value;
}
public partiallyEq(value: any): boolean {
return this.filter.tag === value || this.filter.tag === value?.name;
}
public getDisplayName(): string {
return this.filter.getNormalizedTag();
}
public clone(): GenericFilter {
return new SingleFilterExpression(
new TagQuery(this.filter.tag, this.filter.negate));
}
public queryList(): TagQuery[] {
return [this.filter];
}
public toBackendType(): FilterExpression {
return createRustEnum(this.filter_type, createRustEnum("Tag", this.filter)) as unknown as FilterExpression;
}
}
Loading…
Cancel
Save