UNPKG

ng2-bootstrap

Version:
51 lines (50 loc) 1.77 kB
"use strict"; var core_1 = require('@angular/core'); var accordion_config_1 = require('./accordion.config'); /** Displays collapsible content panels for presenting information in a limited amount of space. */ var AccordionComponent = (function () { function AccordionComponent(config) { this.groups = []; Object.assign(this, config); } AccordionComponent.prototype.closeOtherPanels = function (openGroup) { if (!this.closeOthers) { return; } this.groups.forEach(function (group) { if (group !== openGroup) { group.isOpen = false; } }); }; AccordionComponent.prototype.addGroup = function (group) { this.groups.push(group); }; AccordionComponent.prototype.removeGroup = function (group) { var index = this.groups.indexOf(group); if (index !== -1) { this.groups.splice(index, 1); } }; AccordionComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'accordion', template: "<ng-content></ng-content>", // tslint:disable-next-line host: { '[class.panel-group]': 'true', '[attr.aria-multiselectable]': 'closeOthers', role: 'tablist' } },] }, ]; /** @nocollapse */ AccordionComponent.ctorParameters = function () { return [ { type: accordion_config_1.AccordionConfig, }, ]; }; AccordionComponent.propDecorators = { 'closeOthers': [{ type: core_1.Input },], }; return AccordionComponent; }()); exports.AccordionComponent = AccordionComponent;