|
@@ -57,7 +57,7 @@ export abstract class DefaultListable<T> implements IListable<T> {
|
|
|
*/
|
|
|
remove(T: any): void {
|
|
|
let index = this.elements.indexOf(T);
|
|
|
-
|
|
|
+
|
|
|
this._elements.splice(index, 1);
|
|
|
this._visibleElements.splice(index, 1);
|
|
|
}
|
|
@@ -82,9 +82,8 @@ export abstract class DefaultListable<T> implements IListable<T> {
|
|
|
*/
|
|
|
search(event: any): void {
|
|
|
let value: string = event.target.value;
|
|
|
- this._elements = this._elementsAux;
|
|
|
|
|
|
- this.elements = this.elements.filter(item => {
|
|
|
+ this.visibleElements = this.elements.filter(item => {
|
|
|
return (item as any).name.toLowerCase().indexOf(value.toLowerCase()) > -1;
|
|
|
});
|
|
|
}
|
|
@@ -96,9 +95,9 @@ export abstract class DefaultListable<T> implements IListable<T> {
|
|
|
this.isForSearch = !this.isForSearch;
|
|
|
|
|
|
if (this.isForSearch) {
|
|
|
- this._elementsAux = this.elements;
|
|
|
+ this._elementsAux = this.visibleElements;
|
|
|
} else {
|
|
|
- this._elements = this._elementsAux;
|
|
|
+ this.visibleElements = this._elementsAux;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -119,7 +118,23 @@ export abstract class DefaultListable<T> implements IListable<T> {
|
|
|
this._visibleElements = this._visibleElements.concat(this._elements.slice(this._visibleRange[0], this._visibleRange[1]));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ */
|
|
|
isToSeek(): boolean {
|
|
|
return this._visibleRange[1] >= this.elements.length;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ */
|
|
|
+ seek(event: any) {
|
|
|
+ this.seekRange();
|
|
|
+
|
|
|
+ if (this.isToSeek()) {
|
|
|
+ event.enable(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ event.complete();
|
|
|
+ }
|
|
|
}
|