1 | import { Component, Input } from '@angular/core';
|
2 | import { AccordionConfig } from './accordion.config';
|
3 |
|
4 | export var AccordionComponent = (function () {
|
5 | function AccordionComponent(config) {
|
6 | this.groups = [];
|
7 | Object.assign(this, config);
|
8 | }
|
9 | AccordionComponent.prototype.closeOtherPanels = function (openGroup) {
|
10 | if (!this.closeOthers) {
|
11 | return;
|
12 | }
|
13 | this.groups.forEach(function (group) {
|
14 | if (group !== openGroup) {
|
15 | group.isOpen = false;
|
16 | }
|
17 | });
|
18 | };
|
19 | AccordionComponent.prototype.addGroup = function (group) {
|
20 | this.groups.push(group);
|
21 | };
|
22 | AccordionComponent.prototype.removeGroup = function (group) {
|
23 | var index = this.groups.indexOf(group);
|
24 | if (index !== -1) {
|
25 | this.groups.splice(index, 1);
|
26 | }
|
27 | };
|
28 | AccordionComponent.decorators = [
|
29 | { type: Component, args: [{
|
30 | selector: 'accordion',
|
31 | template: "<ng-content></ng-content>",
|
32 |
|
33 | host: {
|
34 | '[class.panel-group]': 'true',
|
35 | '[attr.aria-multiselectable]': 'closeOthers',
|
36 | role: 'tablist'
|
37 | }
|
38 | },] },
|
39 | ];
|
40 |
|
41 | AccordionComponent.ctorParameters = function () { return [
|
42 | { type: AccordionConfig, },
|
43 | ]; };
|
44 | AccordionComponent.propDecorators = {
|
45 | 'closeOthers': [{ type: Input },],
|
46 | };
|
47 | return AccordionComponent;
|
48 | }());
|
49 |
|
\ | No newline at end of file |