2016-05-25 18:34:31 +03:00
|
|
|
'use strict';
|
|
|
|
|
2016-06-15 21:48:04 +03:00
|
|
|
import { Component, EventEmitter, Output, Input } from '@angular/core';
|
|
|
|
import { CORE_DIRECTIVES } from '@angular/common';
|
2016-05-25 18:34:31 +03:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'zippy',
|
|
|
|
templateUrl: './zippy.html',
|
|
|
|
styleUrls: ['./zippy.css'],
|
|
|
|
directives: [CORE_DIRECTIVES]
|
|
|
|
})
|
|
|
|
export class Zippy {
|
|
|
|
@Input() type = 'general';
|
|
|
|
@Input() visible = false;
|
|
|
|
@Input() empty = false;
|
|
|
|
@Input() title;
|
|
|
|
@Output() open = new EventEmitter();
|
|
|
|
@Output() close = new EventEmitter();
|
|
|
|
|
|
|
|
toggle() {
|
|
|
|
this.visible = !this.visible;
|
|
|
|
if (this.empty) return;
|
|
|
|
(this.visible) ? this.open.next({}) : this.close.next({});
|
|
|
|
}
|
|
|
|
}
|