mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-12 03:46:35 +03:00
38 lines
884 B
JavaScript
38 lines
884 B
JavaScript
|
'use strict';
|
||
|
|
||
|
import {Component, EventEmitter, ElementRef} from 'angular2/core';
|
||
|
import {CORE_DIRECTIVES} from 'angular2/common';
|
||
|
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],
|
||
|
styleUrls: ['./lib/common/components/DropDown/dropdown.css']
|
||
|
})
|
||
|
@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();
|
||
|
}
|
||
|
}
|