add filter service and enable chart states to filter lists
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FilterService } from './filter.service';
|
||||
|
||||
describe('FilterService', () => {
|
||||
let service: FilterService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(FilterService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { StType } from '../type';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
|
||||
export interface FilterInput {
|
||||
type: StType;
|
||||
text: string
|
||||
}
|
||||
|
||||
export class FilterService {
|
||||
|
||||
constructor() { }
|
||||
|
||||
private filterChangeSource = new BehaviorSubject<FilterInput>({ type: StType.Folder, text: "" });
|
||||
|
||||
filterChanged$ = this.filterChangeSource.asObservable();
|
||||
|
||||
changeFilter(input: FilterInput) {
|
||||
this.filterChangeSource.next(input);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user