import { CheckboxColumnItem } from './checkbox-column-item';
export class CheckboxListColumn<T> extends Array<CheckboxColumnItem<T>> {
private constructor(list: T[]) {
super();
}
static create<T>(list: T[]): CheckboxListColumn<T> {
const cp = Object.create(CheckboxListColumn.prototype);
list.forEach(e => cp.push(new CheckboxColumnItem(e)));
return cp;
}
isAnySelected(): boolean {
return super.some((e: CheckboxColumnItem<T>) => e.selected);
}
getSelected(): Array<T> {
return super.filter(e => e.selected).map(e => e.value);
}
}