All files / src/components/zd-iterable iterable-controller.ts

100% Statements 8/8
100% Branches 6/6
100% Functions 4/4
100% Lines 8/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28    93x     206x     206x       21x     62x 57x   62x           1x      
import { Iterable } from './iterable';
 
export class IterableController {
	private iterable: Iterable;
 
	private searchInValue?: string[] = undefined;
 
	constructor(iterable: Iterable) {
		this.iterable = iterable;
	}
 
	public get searchIn() {
		return (
			this.searchInValue ||
			this.iterable.columns.reduce((result: string[], column) => {
				if (column.type !== 'action' && (!this.iterable.searchVisibleOnly || column.isVisible))
					result.push(column.name);
 
				return result;
			}, [])
		);
	}
 
	public set searchIn(value: string[] | undefined) {
		this.searchInValue = value;
	}
}