{"version":3,"file":"accordion.mjs","sources":["../../../../../../src/cdk/accordion/accordion.ts","../../../../../../src/cdk/accordion/accordion-item.ts","../../../../../../src/cdk/accordion/accordion-module.ts","../../../../../../src/cdk/accordion/accordion_public_index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {BooleanInput, coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {Directive, InjectionToken, Input, OnChanges, OnDestroy, SimpleChanges} from '@angular/core';\nimport {Subject} from 'rxjs';\n\n/** Used to generate unique ID for each accordion. */\nlet nextId = 0;\n\n/**\n * Injection token that can be used to reference instances of `CdkAccordion`. It serves\n * as alternative token to the actual `CdkAccordion` class which could cause unnecessary\n * retention of the class and its directive metadata.\n */\nexport const CDK_ACCORDION = new InjectionToken('CdkAccordion');\n\n/**\n * Directive whose purpose is to manage the expanded state of CdkAccordionItem children.\n */\n@Directive({\n selector: 'cdk-accordion, [cdkAccordion]',\n exportAs: 'cdkAccordion',\n providers: [{provide: CDK_ACCORDION, useExisting: CdkAccordion}],\n})\nexport class CdkAccordion implements OnDestroy, OnChanges {\n /** Emits when the state of the accordion changes */\n readonly _stateChanges = new Subject();\n\n /** Stream that emits true/false when openAll/closeAll is triggered. */\n readonly _openCloseAllActions: Subject = new Subject();\n\n /** A readonly id value to use for unique selection coordination. */\n readonly id: string = `cdk-accordion-${nextId++}`;\n\n /** Whether the accordion should allow multiple expanded accordion items simultaneously. */\n @Input()\n get multi(): boolean {\n return this._multi;\n }\n set multi(multi: BooleanInput) {\n this._multi = coerceBooleanProperty(multi);\n }\n private _multi: boolean = false;\n\n /** Opens all enabled accordion items in an accordion where multi is enabled. */\n openAll(): void {\n if (this._multi) {\n this._openCloseAllActions.next(true);\n }\n }\n\n /** Closes all enabled accordion items. */\n closeAll(): void {\n this._openCloseAllActions.next(false);\n }\n\n ngOnChanges(changes: SimpleChanges) {\n this._stateChanges.next(changes);\n }\n\n ngOnDestroy() {\n this._stateChanges.complete();\n this._openCloseAllActions.complete();\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n Output,\n Directive,\n EventEmitter,\n Input,\n OnDestroy,\n Optional,\n ChangeDetectorRef,\n SkipSelf,\n Inject,\n} from '@angular/core';\nimport {UniqueSelectionDispatcher} from '@angular/cdk/collections';\nimport {CDK_ACCORDION, CdkAccordion} from './accordion';\nimport {BooleanInput, coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {Subscription} from 'rxjs';\n\n/** Used to generate unique ID for each accordion item. */\nlet nextId = 0;\n\n/**\n * An basic directive expected to be extended and decorated as a component. Sets up all\n * events and attributes needed to be managed by a CdkAccordion parent.\n */\n@Directive({\n selector: 'cdk-accordion-item, [cdkAccordionItem]',\n exportAs: 'cdkAccordionItem',\n providers: [\n // Provide `CDK_ACCORDION` as undefined to prevent nested accordion items from\n // registering to the same accordion.\n {provide: CDK_ACCORDION, useValue: undefined},\n ],\n})\nexport class CdkAccordionItem implements OnDestroy {\n /** Subscription to openAll/closeAll events. */\n private _openCloseAllSubscription = Subscription.EMPTY;\n /** Event emitted every time the AccordionItem is closed. */\n @Output() readonly closed: EventEmitter = new EventEmitter();\n /** Event emitted every time the AccordionItem is opened. */\n @Output() readonly opened: EventEmitter = new EventEmitter();\n /** Event emitted when the AccordionItem is destroyed. */\n @Output() readonly destroyed: EventEmitter = new EventEmitter();\n\n /**\n * Emits whenever the expanded state of the accordion changes.\n * Primarily used to facilitate two-way binding.\n * @docs-private\n */\n @Output() readonly expandedChange: EventEmitter = new EventEmitter();\n\n /** The unique AccordionItem id. */\n readonly id: string = `cdk-accordion-child-${nextId++}`;\n\n /** Whether the AccordionItem is expanded. */\n @Input()\n get expanded(): boolean {\n return this._expanded;\n }\n set expanded(expanded: BooleanInput) {\n expanded = coerceBooleanProperty(expanded);\n\n // Only emit events and update the internal value if the value changes.\n if (this._expanded !== expanded) {\n this._expanded = expanded;\n this.expandedChange.emit(expanded);\n\n if (expanded) {\n this.opened.emit();\n /**\n * In the unique selection dispatcher, the id parameter is the id of the CdkAccordionItem,\n * the name value is the id of the accordion.\n */\n const accordionId = this.accordion ? this.accordion.id : this.id;\n this._expansionDispatcher.notify(this.id, accordionId);\n } else {\n this.closed.emit();\n }\n\n // Ensures that the animation will run when the value is set outside of an `@Input`.\n // This includes cases like the open, close and toggle methods.\n this._changeDetectorRef.markForCheck();\n }\n }\n private _expanded = false;\n\n /** Whether the AccordionItem is disabled. */\n @Input()\n get disabled(): boolean {\n return this._disabled;\n }\n set disabled(disabled: BooleanInput) {\n this._disabled = coerceBooleanProperty(disabled);\n }\n private _disabled = false;\n\n /** Unregister function for _expansionDispatcher. */\n private _removeUniqueSelectionListener: () => void = () => {};\n\n constructor(\n @Optional() @Inject(CDK_ACCORDION) @SkipSelf() public accordion: CdkAccordion,\n private _changeDetectorRef: ChangeDetectorRef,\n protected _expansionDispatcher: UniqueSelectionDispatcher,\n ) {\n this._removeUniqueSelectionListener = _expansionDispatcher.listen(\n (id: string, accordionId: string) => {\n if (\n this.accordion &&\n !this.accordion.multi &&\n this.accordion.id === accordionId &&\n this.id !== id\n ) {\n this.expanded = false;\n }\n },\n );\n\n // When an accordion item is hosted in an accordion, subscribe to open/close events.\n if (this.accordion) {\n this._openCloseAllSubscription = this._subscribeToOpenCloseAllActions();\n }\n }\n\n /** Emits an event for the accordion item being destroyed. */\n ngOnDestroy() {\n this.opened.complete();\n this.closed.complete();\n this.destroyed.emit();\n this.destroyed.complete();\n this._removeUniqueSelectionListener();\n this._openCloseAllSubscription.unsubscribe();\n }\n\n /** Toggles the expanded state of the accordion item. */\n toggle(): void {\n if (!this.disabled) {\n this.expanded = !this.expanded;\n }\n }\n\n /** Sets the expanded state of the accordion item to false. */\n close(): void {\n if (!this.disabled) {\n this.expanded = false;\n }\n }\n\n /** Sets the expanded state of the accordion item to true. */\n open(): void {\n if (!this.disabled) {\n this.expanded = true;\n }\n }\n\n private _subscribeToOpenCloseAllActions(): Subscription {\n return this.accordion._openCloseAllActions.subscribe(expanded => {\n // Only change expanded state if item is enabled\n if (!this.disabled) {\n this.expanded = expanded;\n }\n });\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {NgModule} from '@angular/core';\nimport {CdkAccordion} from './accordion';\nimport {CdkAccordionItem} from './accordion-item';\n\n@NgModule({\n exports: [CdkAccordion, CdkAccordionItem],\n declarations: [CdkAccordion, CdkAccordionItem],\n})\nexport class CdkAccordionModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["nextId"],"mappings":";;;;;;AAYA;AACA,IAAIA,QAAM,GAAG,CAAC,CAAC;AAEf;;;;AAIG;MACU,aAAa,GAAG,IAAI,cAAc,CAAe,cAAc,EAAE;AAE9E;;AAEG;MAMU,YAAY,CAAA;AALzB,IAAA,WAAA,GAAA;;AAOW,QAAA,IAAA,CAAA,aAAa,GAAG,IAAI,OAAO,EAAiB,CAAC;;AAG7C,QAAA,IAAA,CAAA,oBAAoB,GAAqB,IAAI,OAAO,EAAW,CAAC;;AAGhE,QAAA,IAAA,CAAA,EAAE,GAAW,CAAA,cAAA,EAAiBA,QAAM,EAAE,EAAE,CAAC;QAU1C,IAAM,CAAA,MAAA,GAAY,KAAK,CAAC;AAsBjC,KAAA;;AA7BC,IAAA,IACI,KAAK,GAAA;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;KACpB;IACD,IAAI,KAAK,CAAC,KAAmB,EAAA;AAC3B,QAAA,IAAI,CAAC,MAAM,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;KAC5C;;IAID,OAAO,GAAA;QACL,IAAI,IAAI,CAAC,MAAM,EAAE;AACf,YAAA,IAAI,CAAC,oBAAoB,CA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