UNPKG

ngx-bootstrap

Version:
172 lines (166 loc) 5.37 kB
import { Directive, ElementRef, EventEmitter, HostBinding, Input, Output, Renderer2, NgModule } from '@angular/core'; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var CollapseDirective = /** @class */ (function () { function CollapseDirective(_el, _renderer) { this._el = _el; this._renderer = _renderer; /** * This event fires as soon as content collapses */ /* tslint:disable-next-line: no-any */ this.collapsed = new EventEmitter(); /** * This event fires as soon as content becomes visible */ /* tslint:disable-next-line: no-any */ this.expanded = new EventEmitter(); // shown this.isExpanded = true; // hidden this.isCollapsed = false; // stale state this.isCollapse = true; // animation state this.isCollapsing = false; } Object.defineProperty(CollapseDirective.prototype, "collapse", { get: /** * @return {?} */ function () { return this.isExpanded; }, /** A flag indicating visibility of content (shown or hidden) */ set: /** * A flag indicating visibility of content (shown or hidden) * @param {?} value * @return {?} */ function (value) { this.isExpanded = value; this.toggle(); }, enumerable: true, configurable: true }); /** allows to manually toggle content visibility */ /** * allows to manually toggle content visibility * @return {?} */ CollapseDirective.prototype.toggle = /** * allows to manually toggle content visibility * @return {?} */ function () { if (this.isExpanded) { this.hide(); } else { this.show(); } }; /** allows to manually hide content */ /** * allows to manually hide content * @return {?} */ CollapseDirective.prototype.hide = /** * allows to manually hide content * @return {?} */ function () { this.isCollapse = false; this.isCollapsing = true; this.isExpanded = false; this.isCollapsed = true; this.isCollapse = true; this.isCollapsing = false; this.display = 'none'; this.collapsed.emit(this); }; /** allows to manually show collapsed content */ /** * allows to manually show collapsed content * @return {?} */ CollapseDirective.prototype.show = /** * allows to manually show collapsed content * @return {?} */ function () { this.isCollapse = false; this.isCollapsing = true; this.isExpanded = true; this.isCollapsed = false; this.display = 'block'; // this.height = 'auto'; this.isCollapse = true; this.isCollapsing = false; this._renderer.setStyle(this._el.nativeElement, 'overflow', 'visible'); this._renderer.setStyle(this._el.nativeElement, 'height', 'auto'); this.expanded.emit(this); }; CollapseDirective.decorators = [ { type: Directive, args: [{ selector: '[collapse]', exportAs: 'bs-collapse', host: { '[class.collapse]': 'true' } },] } ]; /** @nocollapse */ CollapseDirective.ctorParameters = function () { return [ { type: ElementRef }, { type: Renderer2 } ]; }; CollapseDirective.propDecorators = { collapsed: [{ type: Output }], expanded: [{ type: Output }], display: [{ type: HostBinding, args: ['style.display',] }], isExpanded: [{ type: HostBinding, args: ['class.in',] }, { type: HostBinding, args: ['class.show',] }, { type: HostBinding, args: ['attr.aria-expanded',] }], isCollapsed: [{ type: HostBinding, args: ['attr.aria-hidden',] }], isCollapse: [{ type: HostBinding, args: ['class.collapse',] }], isCollapsing: [{ type: HostBinding, args: ['class.collapsing',] }], collapse: [{ type: Input }] }; return CollapseDirective; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var CollapseModule = /** @class */ (function () { function CollapseModule() { } /** * @return {?} */ CollapseModule.forRoot = /** * @return {?} */ function () { return { ngModule: CollapseModule, providers: [] }; }; CollapseModule.decorators = [ { type: NgModule, args: [{ declarations: [CollapseDirective], exports: [CollapseDirective] },] } ]; return CollapseModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ export { CollapseDirective, CollapseModule }; //# sourceMappingURL=ngx-bootstrap-collapse.js.map