ngx-bootstrap
Version:
Native Angular Bootstrap Components
181 lines (173 loc) • 6.7 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core')) :
typeof define === 'function' && define.amd ? define('ngx-bootstrap/collapse', ['exports', '@angular/core'], factory) :
(factory((global['ngx-bootstrap'] = global['ngx-bootstrap'] || {}, global['ngx-bootstrap'].collapse = {}),global.ng.core));
}(this, (function (exports,core) { 'use strict';
/**
* @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 core.EventEmitter();
/**
* This event fires as soon as content becomes visible
*/
/* tslint:disable-next-line: no-any */
this.expanded = new core.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: core.Directive, args: [{
selector: '[collapse]',
exportAs: 'bs-collapse',
host: {
'[class.collapse]': 'true'
}
},] }
];
/** @nocollapse */
CollapseDirective.ctorParameters = function () {
return [
{ type: core.ElementRef },
{ type: core.Renderer2 }
];
};
CollapseDirective.propDecorators = {
collapsed: [{ type: core.Output }],
expanded: [{ type: core.Output }],
display: [{ type: core.HostBinding, args: ['style.display',] }],
isExpanded: [{ type: core.HostBinding, args: ['class.in',] }, { type: core.HostBinding, args: ['class.show',] }, { type: core.HostBinding, args: ['attr.aria-expanded',] }],
isCollapsed: [{ type: core.HostBinding, args: ['attr.aria-hidden',] }],
isCollapse: [{ type: core.HostBinding, args: ['class.collapse',] }],
isCollapsing: [{ type: core.HostBinding, args: ['class.collapsing',] }],
collapse: [{ type: core.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: core.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
*/
exports.CollapseDirective = CollapseDirective;
exports.CollapseModule = CollapseModule;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=ngx-bootstrap-collapse.umd.js.map