mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-27 02:53:43 +03:00
30 lines
654 B
TypeScript
30 lines
654 B
TypeScript
'use strict';
|
|
|
|
import { Component, EventEmitter, Output, Input, OnChanges } from '@angular/core';
|
|
@Component({
|
|
selector: 'zippy',
|
|
templateUrl: './zippy.html',
|
|
styleUrls: ['./zippy.css']
|
|
})
|
|
export class Zippy implements OnChanges {
|
|
@Input() type = 'general';
|
|
@Input() empty = false;
|
|
@Input() title;
|
|
@Input() headless: boolean = false;
|
|
@Input() open = false;
|
|
@Output() openChange = new EventEmitter();
|
|
|
|
|
|
toggle() {
|
|
this.open = !this.open;
|
|
if (this.empty) return;
|
|
this.openChange.emit(this.open);
|
|
}
|
|
|
|
ngOnChanges(ch) {
|
|
if (ch.open.currentValue === true) {
|
|
this.openChange.emit(ch.open.currentValue);
|
|
}
|
|
}
|
|
}
|