mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Scene Filter sidebar (#5714)
* Add Sidebar component * Add PerformerQuickFilter to Scene filter sidebar * Add other quick filters * Add confirmVariant field to AlertModal * Add SidebarSavedFilterList * Add sidebar toggle button * Add data-type attr for criterion option * Refactor LabeledIdFilter * Move search input into sidebar * Save sidebar state in local forage * Add sidebar rating filter * Add organised filter * Open sidebar to / key. Focus search input on sidebar open * Blur clearable input on escape key
This commit is contained in:
@@ -463,6 +463,19 @@ export class ListFilterModel {
|
||||
};
|
||||
}
|
||||
|
||||
public criteriaFor(type: CriterionType) {
|
||||
return this.criteria.filter((c) => c.criterionOption.type === type);
|
||||
}
|
||||
|
||||
public replaceCriteria(type: CriterionType, newCriteria: Criterion[]) {
|
||||
const criteria = [
|
||||
...this.criteria.filter((c) => c.criterionOption.type !== type),
|
||||
...newCriteria,
|
||||
];
|
||||
|
||||
return this.setCriteria(criteria);
|
||||
}
|
||||
|
||||
public clearCriteria() {
|
||||
const ret = this.clone();
|
||||
ret.criteria = [];
|
||||
@@ -470,6 +483,12 @@ export class ListFilterModel {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public setCriteria(criteria: Criterion[]) {
|
||||
const ret = this.clone();
|
||||
ret.criteria = criteria;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public removeCriterion(type: CriterionType) {
|
||||
const ret = this.clone();
|
||||
const c = ret.criteria.find((cc) => cc.criterionOption.type === type);
|
||||
|
||||
Reference in New Issue
Block a user