2016-04-19 18:50:01 +03:00
|
|
|
'use strict';
|
|
|
|
|
2016-05-05 11:05:02 +03:00
|
|
|
import {Component, EventEmitter, ElementRef} from '@angular/core';
|
|
|
|
import {CORE_DIRECTIVES} from '@angular/common';
|
2016-04-19 18:50:01 +03:00
|
|
|
import DropKick from 'Robdel12/DropKick';
|
|
|
|
import 'Robdel12/DropKick/build/css/dropkick.css!css';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'dropdown',
|
|
|
|
events: ['change'],
|
|
|
|
template: `
|
|
|
|
<select (change)=onChange($event.target.value)>
|
|
|
|
<ng-content></ng-content>
|
|
|
|
</select>
|
|
|
|
`,
|
|
|
|
directives: [CORE_DIRECTIVES],
|
2016-05-06 00:48:41 +03:00
|
|
|
styleUrls: ['./lib/shared/components/DropDown/drop-down.css']
|
2016-04-19 18:50:01 +03:00
|
|
|
})
|
|
|
|
@Reflect.metadata('parameters', [[ElementRef]])
|
|
|
|
export class DropDown {
|
|
|
|
constructor(elem) {
|
|
|
|
this.change = new EventEmitter();
|
|
|
|
this.elem = elem.nativeElement;
|
|
|
|
}
|
|
|
|
|
|
|
|
ngAfterContentInit() {
|
|
|
|
this.inst = new DropKick(this.elem.firstElementChild, {autoWidth: true});
|
|
|
|
}
|
|
|
|
|
|
|
|
onChange(value) {
|
|
|
|
this.change.next(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
destroy() {
|
|
|
|
this.inst.dispose();
|
|
|
|
}
|
|
|
|
}
|