@seniorsistemas/angular-components 17.30.1 → 17.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/seniorsistemas-angular-components.umd.js +53 -31
- package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
- package/bundles/seniorsistemas-angular-components.umd.min.js +1 -1
- package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
- package/components/accordion/accordion.component.d.ts +13 -11
- package/esm2015/components/accordion/accordion.component.js +41 -31
- package/esm5/components/accordion/accordion.component.js +55 -33
- package/fesm2015/seniorsistemas-angular-components.js +40 -30
- package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
- package/fesm5/seniorsistemas-angular-components.js +54 -32
- package/fesm5/seniorsistemas-angular-components.js.map +1 -1
- package/package.json +1 -1
- package/seniorsistemas-angular-components.metadata.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate, __assign, __extends, __read, __spread, __awaiter, __generator, __param,
|
|
1
|
+
import { __decorate, __values, __assign, __extends, __read, __spread, __awaiter, __generator, __param, __rest } from 'tslib';
|
|
2
2
|
import { EventEmitter, Input, Output, Component, ContentChildren, ViewChild, HostListener, forwardRef, NgModule, ɵɵdefineInjectable, Injectable, ElementRef, ApplicationRef, ComponentFactoryResolver, Injector, Renderer2, Directive, TemplateRef, ViewContainerRef, Pipe, ɵɵinject, HostBinding, ChangeDetectorRef, ViewChildren, InjectionToken, Inject, PLATFORM_ID, KeyValueDiffers, ViewEncapsulation, INJECTOR, NgZone, ContentChild, Optional } from '@angular/core';
|
|
3
3
|
import { trigger, transition, style as style$7, animate, state, group, query, animateChild, stagger } from '@angular/animations';
|
|
4
4
|
import { Subject, of, from, ReplaySubject, throwError, fromEvent, forkJoin, pipe } from 'rxjs';
|
|
@@ -182,68 +182,90 @@ var AccordionPanelComponent = /** @class */ (function () {
|
|
|
182
182
|
var AccordionComponent = /** @class */ (function () {
|
|
183
183
|
function AccordionComponent() {
|
|
184
184
|
this.multiple = false;
|
|
185
|
-
this.
|
|
186
|
-
this.
|
|
185
|
+
this.unsubscribe$ = new Subject();
|
|
186
|
+
this.panels = [];
|
|
187
187
|
}
|
|
188
|
+
AccordionComponent.prototype.ngOnInit = function () {
|
|
189
|
+
this.validateInputs();
|
|
190
|
+
};
|
|
188
191
|
AccordionComponent.prototype.ngAfterContentInit = function () {
|
|
189
|
-
this.
|
|
190
|
-
this.
|
|
191
|
-
this.
|
|
192
|
-
this.
|
|
192
|
+
this.panels = this.panelsComponents.toArray();
|
|
193
|
+
this.openSubs = new Array(this.panels.length);
|
|
194
|
+
this.setBehavior(this.multiple);
|
|
195
|
+
this.setupTabs();
|
|
193
196
|
};
|
|
194
197
|
AccordionComponent.prototype.ngOnChanges = function (changes) {
|
|
195
198
|
if (changes.multiple) {
|
|
196
|
-
this.
|
|
199
|
+
this.setBehavior(changes.multiple.currentValue);
|
|
197
200
|
}
|
|
198
201
|
};
|
|
199
202
|
AccordionComponent.prototype.ngOnDestroy = function () {
|
|
200
|
-
this.
|
|
201
|
-
this.
|
|
203
|
+
this.unsubscribe$.next();
|
|
204
|
+
this.unsubscribe$.complete();
|
|
202
205
|
};
|
|
203
|
-
AccordionComponent.prototype.
|
|
204
|
-
|
|
205
|
-
|
|
206
|
+
AccordionComponent.prototype.validateInputs = function () {
|
|
207
|
+
if (!this.multiple && Array.isArray(this.activeIndex)) {
|
|
208
|
+
throw new Error("The activeIndex should not be an array when multiple is set to false.");
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
AccordionComponent.prototype.setupTabs = function () {
|
|
212
|
+
var e_1, _a;
|
|
213
|
+
var _this = this;
|
|
214
|
+
var _b;
|
|
215
|
+
if ((_b = this.panels) === null || _b === void 0 ? void 0 : _b.length) {
|
|
206
216
|
if (this.activeIndex !== undefined && this.activeIndex !== null) {
|
|
207
|
-
var
|
|
208
|
-
|
|
217
|
+
var activeTabs = Array.isArray(this.activeIndex)
|
|
218
|
+
? this.panels.filter(function (_, index) { return _this.activeIndex.includes(index); })
|
|
219
|
+
: [this.panels[this.activeIndex]];
|
|
220
|
+
if (activeTabs.length === 0) {
|
|
209
221
|
throw new Error("activeIndex does not represent any panel.");
|
|
210
222
|
}
|
|
211
|
-
|
|
212
|
-
|
|
223
|
+
try {
|
|
224
|
+
for (var activeTabs_1 = __values(activeTabs), activeTabs_1_1 = activeTabs_1.next(); !activeTabs_1_1.done; activeTabs_1_1 = activeTabs_1.next()) {
|
|
225
|
+
var activeTab = activeTabs_1_1.value;
|
|
226
|
+
if (!activeTab.disabled) {
|
|
227
|
+
activeTab.isOpen = true;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
232
|
+
finally {
|
|
233
|
+
try {
|
|
234
|
+
if (activeTabs_1_1 && !activeTabs_1_1.done && (_a = activeTabs_1.return)) _a.call(activeTabs_1);
|
|
235
|
+
}
|
|
236
|
+
finally { if (e_1) throw e_1.error; }
|
|
213
237
|
}
|
|
214
238
|
}
|
|
215
239
|
}
|
|
216
240
|
};
|
|
217
|
-
AccordionComponent.prototype.
|
|
218
|
-
this.
|
|
241
|
+
AccordionComponent.prototype.closeOtherTabs = function (exception) {
|
|
242
|
+
this.panels.forEach(function (panel, index) {
|
|
219
243
|
if (index !== exception) {
|
|
220
244
|
panel.isOpen = false;
|
|
221
245
|
}
|
|
222
246
|
});
|
|
223
247
|
};
|
|
224
|
-
AccordionComponent.prototype.
|
|
248
|
+
AccordionComponent.prototype.setBehavior = function (multiple) {
|
|
225
249
|
if (multiple) {
|
|
226
|
-
this.
|
|
250
|
+
this.enableMultiplePanelBehavior();
|
|
227
251
|
}
|
|
228
252
|
else {
|
|
229
|
-
this.
|
|
253
|
+
this.enableSinglePanelBehavior();
|
|
230
254
|
}
|
|
231
255
|
};
|
|
232
|
-
AccordionComponent.prototype.
|
|
256
|
+
AccordionComponent.prototype.enableSinglePanelBehavior = function () {
|
|
233
257
|
var _this = this;
|
|
234
|
-
this.
|
|
235
|
-
_this.
|
|
236
|
-
.
|
|
237
|
-
.subscribe(function () {
|
|
238
|
-
_this._closeOtherTabs(index);
|
|
258
|
+
this.panels.forEach(function (panel, index) {
|
|
259
|
+
_this.openSubs[index] = panel.panelOpened.pipe(takeUntil(_this.unsubscribe$)).subscribe(function () {
|
|
260
|
+
_this.closeOtherTabs(index);
|
|
239
261
|
});
|
|
240
262
|
});
|
|
241
263
|
};
|
|
242
|
-
AccordionComponent.prototype.
|
|
264
|
+
AccordionComponent.prototype.enableMultiplePanelBehavior = function () {
|
|
243
265
|
var _this = this;
|
|
244
|
-
this.
|
|
245
|
-
if (_this.
|
|
246
|
-
_this.
|
|
266
|
+
this.panels.forEach(function (_, index) {
|
|
267
|
+
if (_this.openSubs[index]) {
|
|
268
|
+
_this.openSubs[index].unsubscribe();
|
|
247
269
|
}
|
|
248
270
|
});
|
|
249
271
|
};
|