1 | (function (global, factory) {
|
2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/cdk/collections'), require('@angular/cdk/coercion'), require('rxjs')) :
|
3 | typeof define === 'function' && define.amd ? define('@angular/cdk/accordion', ['exports', '@angular/core', '@angular/cdk/collections', '@angular/cdk/coercion', 'rxjs'], factory) :
|
4 | (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ng = global.ng || {}, global.ng.cdk = global.ng.cdk || {}, global.ng.cdk.accordion = {}), global.ng.core, global.ng.cdk.collections, global.ng.cdk.coercion, global.rxjs));
|
5 | }(this, (function (exports, core, collections, coercion, rxjs) { 'use strict';
|
6 |
|
7 | |
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | var nextId$1 = 0;
|
16 | |
17 |
|
18 |
|
19 |
|
20 |
|
21 | var CDK_ACCORDION = new core.InjectionToken('CdkAccordion');
|
22 | |
23 |
|
24 |
|
25 | var CdkAccordion = (function () {
|
26 | function CdkAccordion() {
|
27 |
|
28 | this._stateChanges = new rxjs.Subject();
|
29 |
|
30 | this._openCloseAllActions = new rxjs.Subject();
|
31 |
|
32 | this.id = "cdk-accordion-" + nextId$1++;
|
33 | this._multi = false;
|
34 | }
|
35 | Object.defineProperty(CdkAccordion.prototype, "multi", {
|
36 |
|
37 | get: function () { return this._multi; },
|
38 | set: function (multi) { this._multi = coercion.coerceBooleanProperty(multi); },
|
39 | enumerable: false,
|
40 | configurable: true
|
41 | });
|
42 |
|
43 | CdkAccordion.prototype.openAll = function () {
|
44 | if (this._multi) {
|
45 | this._openCloseAllActions.next(true);
|
46 | }
|
47 | };
|
48 |
|
49 | CdkAccordion.prototype.closeAll = function () {
|
50 | this._openCloseAllActions.next(false);
|
51 | };
|
52 | CdkAccordion.prototype.ngOnChanges = function (changes) {
|
53 | this._stateChanges.next(changes);
|
54 | };
|
55 | CdkAccordion.prototype.ngOnDestroy = function () {
|
56 | this._stateChanges.complete();
|
57 | this._openCloseAllActions.complete();
|
58 | };
|
59 | return CdkAccordion;
|
60 | }());
|
61 | CdkAccordion.decorators = [
|
62 | { type: core.Directive, args: [{
|
63 | selector: 'cdk-accordion, [cdkAccordion]',
|
64 | exportAs: 'cdkAccordion',
|
65 | providers: [{ provide: CDK_ACCORDION, useExisting: CdkAccordion }],
|
66 | },] }
|
67 | ];
|
68 | CdkAccordion.propDecorators = {
|
69 | multi: [{ type: core.Input }]
|
70 | };
|
71 |
|
72 | |
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 | var nextId = 0;
|
81 | var ɵ0 = undefined;
|
82 | |
83 |
|
84 |
|
85 |
|
86 | var CdkAccordionItem = (function () {
|
87 | function CdkAccordionItem(accordion, _changeDetectorRef, _expansionDispatcher) {
|
88 | var _this = this;
|
89 | this.accordion = accordion;
|
90 | this._changeDetectorRef = _changeDetectorRef;
|
91 | this._expansionDispatcher = _expansionDispatcher;
|
92 |
|
93 | this._openCloseAllSubscription = rxjs.Subscription.EMPTY;
|
94 |
|
95 | this.closed = new core.EventEmitter();
|
96 |
|
97 | this.opened = new core.EventEmitter();
|
98 |
|
99 | this.destroyed = new core.EventEmitter();
|
100 | |
101 |
|
102 |
|
103 |
|
104 |
|
105 | this.expandedChange = new core.EventEmitter();
|
106 |
|
107 | this.id = "cdk-accordion-child-" + nextId++;
|
108 | this._expanded = false;
|
109 | this._disabled = false;
|
110 |
|
111 | this._removeUniqueSelectionListener = function () { };
|
112 | this._removeUniqueSelectionListener =
|
113 | _expansionDispatcher.listen(function (id, accordionId) {
|
114 | if (_this.accordion && !_this.accordion.multi &&
|
115 | _this.accordion.id === accordionId && _this.id !== id) {
|
116 | _this.expanded = false;
|
117 | }
|
118 | });
|
119 |
|
120 | if (this.accordion) {
|
121 | this._openCloseAllSubscription = this._subscribeToOpenCloseAllActions();
|
122 | }
|
123 | }
|
124 | Object.defineProperty(CdkAccordionItem.prototype, "expanded", {
|
125 |
|
126 | get: function () { return this._expanded; },
|
127 | set: function (expanded) {
|
128 | expanded = coercion.coerceBooleanProperty(expanded);
|
129 |
|
130 | if (this._expanded !== expanded) {
|
131 | this._expanded = expanded;
|
132 | this.expandedChange.emit(expanded);
|
133 | if (expanded) {
|
134 | this.opened.emit();
|
135 | |
136 |
|
137 |
|
138 |
|
139 | var accordionId = this.accordion ? this.accordion.id : this.id;
|
140 | this._expansionDispatcher.notify(this.id, accordionId);
|
141 | }
|
142 | else {
|
143 | this.closed.emit();
|
144 | }
|
145 |
|
146 |
|
147 | this._changeDetectorRef.markForCheck();
|
148 | }
|
149 | },
|
150 | enumerable: false,
|
151 | configurable: true
|
152 | });
|
153 | Object.defineProperty(CdkAccordionItem.prototype, "disabled", {
|
154 |
|
155 | get: function () { return this._disabled; },
|
156 | set: function (disabled) { this._disabled = coercion.coerceBooleanProperty(disabled); },
|
157 | enumerable: false,
|
158 | configurable: true
|
159 | });
|
160 |
|
161 | CdkAccordionItem.prototype.ngOnDestroy = function () {
|
162 | this.opened.complete();
|
163 | this.closed.complete();
|
164 | this.destroyed.emit();
|
165 | this.destroyed.complete();
|
166 | this._removeUniqueSelectionListener();
|
167 | this._openCloseAllSubscription.unsubscribe();
|
168 | };
|
169 |
|
170 | CdkAccordionItem.prototype.toggle = function () {
|
171 | if (!this.disabled) {
|
172 | this.expanded = !this.expanded;
|
173 | }
|
174 | };
|
175 |
|
176 | CdkAccordionItem.prototype.close = function () {
|
177 | if (!this.disabled) {
|
178 | this.expanded = false;
|
179 | }
|
180 | };
|
181 |
|
182 | CdkAccordionItem.prototype.open = function () {
|
183 | if (!this.disabled) {
|
184 | this.expanded = true;
|
185 | }
|
186 | };
|
187 | CdkAccordionItem.prototype._subscribeToOpenCloseAllActions = function () {
|
188 | var _this = this;
|
189 | return this.accordion._openCloseAllActions.subscribe(function (expanded) {
|
190 |
|
191 | if (!_this.disabled) {
|
192 | _this.expanded = expanded;
|
193 | }
|
194 | });
|
195 | };
|
196 | return CdkAccordionItem;
|
197 | }());
|
198 | CdkAccordionItem.decorators = [
|
199 | { type: core.Directive, args: [{
|
200 | selector: 'cdk-accordion-item, [cdkAccordionItem]',
|
201 | exportAs: 'cdkAccordionItem',
|
202 | providers: [
|
203 |
|
204 |
|
205 | { provide: CDK_ACCORDION, useValue: ɵ0 },
|
206 | ],
|
207 | },] }
|
208 | ];
|
209 | CdkAccordionItem.ctorParameters = function () { return [
|
210 | { type: CdkAccordion, decorators: [{ type: core.Optional }, { type: core.Inject, args: [CDK_ACCORDION,] }, { type: core.SkipSelf }] },
|
211 | { type: core.ChangeDetectorRef },
|
212 | { type: collections.UniqueSelectionDispatcher }
|
213 | ]; };
|
214 | CdkAccordionItem.propDecorators = {
|
215 | closed: [{ type: core.Output }],
|
216 | opened: [{ type: core.Output }],
|
217 | destroyed: [{ type: core.Output }],
|
218 | expandedChange: [{ type: core.Output }],
|
219 | expanded: [{ type: core.Input }],
|
220 | disabled: [{ type: core.Input }]
|
221 | };
|
222 |
|
223 | |
224 |
|
225 |
|
226 |
|
227 |
|
228 |
|
229 |
|
230 | var CdkAccordionModule = (function () {
|
231 | function CdkAccordionModule() {
|
232 | }
|
233 | return CdkAccordionModule;
|
234 | }());
|
235 | CdkAccordionModule.decorators = [
|
236 | { type: core.NgModule, args: [{
|
237 | exports: [CdkAccordion, CdkAccordionItem],
|
238 | declarations: [CdkAccordion, CdkAccordionItem],
|
239 | },] }
|
240 | ];
|
241 |
|
242 | |
243 |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 |
|
249 |
|
250 | |
251 |
|
252 |
|
253 |
|
254 | exports.CdkAccordion = CdkAccordion;
|
255 | exports.CdkAccordionItem = CdkAccordionItem;
|
256 | exports.CdkAccordionModule = CdkAccordionModule;
|
257 | exports.ɵangular_material_src_cdk_accordion_accordion_a = CDK_ACCORDION;
|
258 |
|
259 | Object.defineProperty(exports, '__esModule', { value: true });
|
260 |
|
261 | })));
|
262 |
|