UNPKG

k15t-aui-ng2

Version:

aui-ng2 is a set of angular 2 components, directives and services to simplify the integration with Atlassian products based on AUI/ADG. The library is still under development and is considered in an experimental state. So be aware that things will change

29 lines (21 loc) 707 B
import {SelectionStrategy} from './selection-strategy'; export class SingleSelectionStrategy implements SelectionStrategy { public selection: any; private idGetter: (item: any) => string; private labelGetter: (item: any) => string; constructor(idGetter, lableGetter, selection) { this.idGetter = idGetter; this.labelGetter = lableGetter; this.selection = selection; } selectItem(item): any { this.selection = item; } deSelectItem(id): any { this.selection = null; } getSelection(): [string, any] { let value = this.selection == null ? null : this.idGetter(this.selection); return ['val', value]; } }