@coreui/angular 5.7.13 → 5.7.15
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/fesm2022/coreui-angular.mjs +207 -168
- package/fesm2022/coreui-angular.mjs.map +1 -1
- package/package.json +2 -2
- package/types/coreui-angular.d.ts +29 -19
|
@@ -6,11 +6,11 @@ import { fromEvent, Subject, BehaviorSubject, merge, takeWhile, skipWhile } from
|
|
|
6
6
|
import * as i1 from '@angular/router';
|
|
7
7
|
import { RouterModule, Router, ActivatedRoute, NavigationEnd, RouterLink } from '@angular/router';
|
|
8
8
|
import { filter, tap, finalize, zipWith, withLatestFrom, debounceTime } from 'rxjs/operators';
|
|
9
|
-
import { animation, group, query, animate, style, trigger, state, transition, useAnimation, animateChild } from '@angular/animations';
|
|
10
9
|
import { createPopper } from '@popperjs/core';
|
|
11
10
|
import * as i1$1 from '@angular/cdk/a11y';
|
|
12
11
|
import { FocusKeyManager, FocusMonitor, A11yModule } from '@angular/cdk/a11y';
|
|
13
12
|
import { BreakpointObserver } from '@angular/cdk/layout';
|
|
13
|
+
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
14
14
|
import { IconDirective } from '@coreui/icons-angular';
|
|
15
15
|
|
|
16
16
|
var BreakpointInfix;
|
|
@@ -2298,15 +2298,8 @@ class CarouselService {
|
|
|
2298
2298
|
setIndex(index) {
|
|
2299
2299
|
this.#carouselIndex.next(index);
|
|
2300
2300
|
}
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
}
|
|
2304
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselService, decorators: [{
|
|
2305
|
-
type: Injectable
|
|
2306
|
-
}] });
|
|
2307
|
-
|
|
2308
|
-
class CarouselState {
|
|
2309
|
-
#carouselService = inject(CarouselService);
|
|
2301
|
+
animating = signal(false, /* @ts-ignore */
|
|
2302
|
+
...(ngDevMode ? [{ debugName: "animating" }] : /* istanbul ignore next */ []));
|
|
2310
2303
|
#state = {
|
|
2311
2304
|
activeItemIndex: -1,
|
|
2312
2305
|
animate: true,
|
|
@@ -2325,7 +2318,7 @@ class CarouselState {
|
|
|
2325
2318
|
if (prevState.activeItemIndex !== nextState.activeItemIndex) {
|
|
2326
2319
|
const activeItemIndex = this.state.activeItemIndex || 0;
|
|
2327
2320
|
const itemInterval = (this.state.items && this.state.items[activeItemIndex]?.interval()) || -1;
|
|
2328
|
-
this
|
|
2321
|
+
this.setIndex({
|
|
2329
2322
|
active: nextState.activeItemIndex,
|
|
2330
2323
|
interval: itemInterval,
|
|
2331
2324
|
lastItemIndex: (nextState.items?.length ?? 0) - 1
|
|
@@ -2347,7 +2340,7 @@ class CarouselState {
|
|
|
2347
2340
|
}
|
|
2348
2341
|
}
|
|
2349
2342
|
setNextIndex(nextIndex) {
|
|
2350
|
-
this
|
|
2343
|
+
this.setIndex(nextIndex);
|
|
2351
2344
|
}
|
|
2352
2345
|
direction(direction = 'next') {
|
|
2353
2346
|
this.state = { direction };
|
|
@@ -2376,10 +2369,10 @@ class CarouselState {
|
|
|
2376
2369
|
interval: 0
|
|
2377
2370
|
};
|
|
2378
2371
|
}
|
|
2379
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type:
|
|
2380
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type:
|
|
2372
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2373
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselService });
|
|
2381
2374
|
}
|
|
2382
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type:
|
|
2375
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselService, decorators: [{
|
|
2383
2376
|
type: Injectable
|
|
2384
2377
|
}] });
|
|
2385
2378
|
|
|
@@ -2388,9 +2381,9 @@ class CarouselConfig {
|
|
|
2388
2381
|
activeIndex = 0;
|
|
2389
2382
|
/* Animate transition of slides */
|
|
2390
2383
|
animate = true;
|
|
2391
|
-
/* Default direction of auto
|
|
2384
|
+
/* Default direction of auto-changing of slides */
|
|
2392
2385
|
direction = 'next';
|
|
2393
|
-
/* Default interval of auto
|
|
2386
|
+
/* Default interval of auto-changing of slides */
|
|
2394
2387
|
interval;
|
|
2395
2388
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2396
2389
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselConfig, providedIn: 'root' });
|
|
@@ -2404,7 +2397,6 @@ class CarouselComponent {
|
|
|
2404
2397
|
config = inject(CarouselConfig);
|
|
2405
2398
|
#hostElement = inject(ElementRef);
|
|
2406
2399
|
#carouselService = inject(CarouselService);
|
|
2407
|
-
#carouselState = inject(CarouselState);
|
|
2408
2400
|
#intersectionService = inject(IntersectionService);
|
|
2409
2401
|
#listenersService = inject(ListenersService);
|
|
2410
2402
|
constructor() {
|
|
@@ -2412,7 +2404,7 @@ class CarouselComponent {
|
|
|
2412
2404
|
}
|
|
2413
2405
|
loadConfig() {
|
|
2414
2406
|
this.activeIndex.update((activeIndex) => this.config?.activeIndex ?? activeIndex);
|
|
2415
|
-
this.animate.update((animate) => this.config?.animate ?? animate);
|
|
2407
|
+
this.animate.update((animate) => (animate === false ? animate : (this.config?.animate ?? animate)));
|
|
2416
2408
|
this.direction.update((direction) => this.config?.direction ?? direction);
|
|
2417
2409
|
this.interval.update((interval) => this.config?.interval ?? interval);
|
|
2418
2410
|
}
|
|
@@ -2428,8 +2420,8 @@ class CarouselComponent {
|
|
|
2428
2420
|
* @return boolean
|
|
2429
2421
|
*/
|
|
2430
2422
|
animateInput = input(true, { ...(ngDevMode ? { debugName: "animateInput" } : /* istanbul ignore next */ {}), alias: 'animate' });
|
|
2431
|
-
animate = linkedSignal(
|
|
2432
|
-
|
|
2423
|
+
animate = linkedSignal(this.animateInput, /* @ts-ignore */
|
|
2424
|
+
...(ngDevMode ? [{ debugName: "animate" }] : /* istanbul ignore next */ []));
|
|
2433
2425
|
/**
|
|
2434
2426
|
* Carousel direction. [docs]
|
|
2435
2427
|
* @return {'next' | 'prev'}
|
|
@@ -2447,7 +2439,7 @@ class CarouselComponent {
|
|
|
2447
2439
|
computation: (value) => value });
|
|
2448
2440
|
#intervalEffect = effect(() => {
|
|
2449
2441
|
const interval = this.interval();
|
|
2450
|
-
this.#
|
|
2442
|
+
this.#carouselService.state = { interval: interval };
|
|
2451
2443
|
interval ? this.setTimer() : this.resetTimer();
|
|
2452
2444
|
}, /* @ts-ignore */
|
|
2453
2445
|
...(ngDevMode ? [{ debugName: "#intervalEffect" }] : /* istanbul ignore next */ []));
|
|
@@ -2465,7 +2457,7 @@ class CarouselComponent {
|
|
|
2465
2457
|
touch = input(true, /* @ts-ignore */
|
|
2466
2458
|
...(ngDevMode ? [{ debugName: "touch" }] : /* istanbul ignore next */ []));
|
|
2467
2459
|
/**
|
|
2468
|
-
* Set type of the transition.
|
|
2460
|
+
* Set the type of the transition.
|
|
2469
2461
|
* @return {'slide' | 'crossfade'}
|
|
2470
2462
|
* @default 'slide'
|
|
2471
2463
|
*/
|
|
@@ -2488,16 +2480,18 @@ class CarouselComponent {
|
|
|
2488
2480
|
swipeSubscription;
|
|
2489
2481
|
#destroyRef = inject(DestroyRef);
|
|
2490
2482
|
ngOnInit() {
|
|
2491
|
-
this.
|
|
2483
|
+
this.carouselServiceSubscribe();
|
|
2492
2484
|
}
|
|
2493
2485
|
ngOnDestroy() {
|
|
2494
2486
|
this.resetTimer();
|
|
2495
2487
|
this.clearListeners();
|
|
2496
2488
|
this.swipeSubscribe(false);
|
|
2489
|
+
// Ensure IntersectionObserver is cleaned up
|
|
2490
|
+
this.#intersectionService?.unobserve(this.#hostElement);
|
|
2497
2491
|
}
|
|
2498
2492
|
ngAfterContentInit() {
|
|
2499
2493
|
this.intersectionServiceSubscribe();
|
|
2500
|
-
this.#
|
|
2494
|
+
this.#carouselService.state = {
|
|
2501
2495
|
activeItemIndex: this.activeIndex(),
|
|
2502
2496
|
animate: this.animate(),
|
|
2503
2497
|
interval: this.interval(),
|
|
@@ -2535,8 +2529,8 @@ class CarouselComponent {
|
|
|
2535
2529
|
this.resetTimer();
|
|
2536
2530
|
if (interval > 0) {
|
|
2537
2531
|
this.timerId = setTimeout(() => {
|
|
2538
|
-
const nextIndex = this.#
|
|
2539
|
-
this.#
|
|
2532
|
+
const nextIndex = this.#carouselService.direction(direction);
|
|
2533
|
+
this.#carouselService.state = { activeItemIndex: nextIndex };
|
|
2540
2534
|
}, interval);
|
|
2541
2535
|
}
|
|
2542
2536
|
}
|
|
@@ -2544,7 +2538,7 @@ class CarouselComponent {
|
|
|
2544
2538
|
clearTimeout(this.timerId);
|
|
2545
2539
|
this.timerId = undefined;
|
|
2546
2540
|
}
|
|
2547
|
-
|
|
2541
|
+
carouselServiceSubscribe() {
|
|
2548
2542
|
this.#carouselService.carouselIndex$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((nextItem) => {
|
|
2549
2543
|
if ('active' in nextItem && typeof nextItem.active === 'number') {
|
|
2550
2544
|
this.itemChange?.emit(nextItem.active);
|
|
@@ -2561,7 +2555,7 @@ class CarouselComponent {
|
|
|
2561
2555
|
this.#intersectionService.createIntersectionObserver(this.#hostElement);
|
|
2562
2556
|
this.#intersectionService.intersecting$
|
|
2563
2557
|
.pipe(filter((next) => next.hostElement === this.#hostElement), finalize(() => {
|
|
2564
|
-
this.#intersectionService
|
|
2558
|
+
this.#intersectionService?.unobserve(this.#hostElement);
|
|
2565
2559
|
}), takeUntilDestroyed(this.#destroyRef))
|
|
2566
2560
|
.subscribe((next) => {
|
|
2567
2561
|
this.visible = next.isIntersecting;
|
|
@@ -2579,10 +2573,13 @@ class CarouselComponent {
|
|
|
2579
2573
|
.subscribe(([touchstart, [touchend, touchmove]]) => {
|
|
2580
2574
|
touchstart.stopPropagation();
|
|
2581
2575
|
touchmove.stopPropagation();
|
|
2576
|
+
if (this.#carouselService.animating()) {
|
|
2577
|
+
return;
|
|
2578
|
+
}
|
|
2582
2579
|
const distanceX = touchstart.touches[0]?.clientX - touchmove.touches[0]?.clientX || 0;
|
|
2583
2580
|
if (Math.abs(distanceX) > 0.3 * carouselElement.clientWidth && touchstart.timeStamp <= touchmove.timeStamp) {
|
|
2584
|
-
const nextIndex = this.#
|
|
2585
|
-
this.#
|
|
2581
|
+
const nextIndex = this.#carouselService.direction(distanceX > 0 ? 'next' : 'prev');
|
|
2582
|
+
this.#carouselService.state = { activeItemIndex: nextIndex };
|
|
2586
2583
|
}
|
|
2587
2584
|
});
|
|
2588
2585
|
}
|
|
@@ -2591,11 +2588,11 @@ class CarouselComponent {
|
|
|
2591
2588
|
}
|
|
2592
2589
|
}
|
|
2593
2590
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2594
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.0", type: CarouselComponent, isStandalone: true, selector: "c-carousel", inputs: { activeIndexInput: { classPropertyName: "activeIndexInput", publicName: "activeIndex", isSignal: true, isRequired: false, transformFunction: null }, animateInput: { classPropertyName: "animateInput", publicName: "animate", isSignal: true, isRequired: false, transformFunction: null }, directionInput: { classPropertyName: "directionInput", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, intervalInput: { classPropertyName: "intervalInput", publicName: "interval", isSignal: true, isRequired: false, transformFunction: null }, pause: { classPropertyName: "pause", publicName: "pause", isSignal: true, isRequired: false, transformFunction: null }, touch: { classPropertyName: "touch", publicName: "touch", isSignal: true, isRequired: false, transformFunction: null }, transition: { classPropertyName: "transition", publicName: "transition", isSignal: true, isRequired: false, transformFunction: null }, wrap: { classPropertyName: "wrap", publicName: "wrap", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemChange: "itemChange" }, host: { properties: { "class.carousel-fade": "transition() === \"crossfade\" && animate()" }, classAttribute: "carousel slide" }, providers: [CarouselService,
|
|
2591
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.0", type: CarouselComponent, isStandalone: true, selector: "c-carousel", inputs: { activeIndexInput: { classPropertyName: "activeIndexInput", publicName: "activeIndex", isSignal: true, isRequired: false, transformFunction: null }, animateInput: { classPropertyName: "animateInput", publicName: "animate", isSignal: true, isRequired: false, transformFunction: null }, directionInput: { classPropertyName: "directionInput", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, intervalInput: { classPropertyName: "intervalInput", publicName: "interval", isSignal: true, isRequired: false, transformFunction: null }, pause: { classPropertyName: "pause", publicName: "pause", isSignal: true, isRequired: false, transformFunction: null }, touch: { classPropertyName: "touch", publicName: "touch", isSignal: true, isRequired: false, transformFunction: null }, transition: { classPropertyName: "transition", publicName: "transition", isSignal: true, isRequired: false, transformFunction: null }, wrap: { classPropertyName: "wrap", publicName: "wrap", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemChange: "itemChange" }, host: { properties: { "class.carousel-fade": "transition() === \"crossfade\" && animate()" }, classAttribute: "carousel slide" }, providers: [CarouselService, ListenersService], exportAs: ["cCarousel"], hostDirectives: [{ directive: ThemeDirective, inputs: ["dark", "dark"] }], ngImport: i0, template: '<ng-content />', isInline: true, styles: [":host{display:block}\n"] });
|
|
2595
2592
|
}
|
|
2596
2593
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselComponent, decorators: [{
|
|
2597
2594
|
type: Component,
|
|
2598
|
-
args: [{ selector: 'c-carousel', template: '<ng-content />', providers: [CarouselService,
|
|
2595
|
+
args: [{ selector: 'c-carousel', template: '<ng-content />', providers: [CarouselService, ListenersService], hostDirectives: [{ directive: ThemeDirective, inputs: ['dark'] }], exportAs: 'cCarousel', host: {
|
|
2599
2596
|
class: 'carousel slide',
|
|
2600
2597
|
'[class.carousel-fade]': 'transition() === "crossfade" && animate()'
|
|
2601
2598
|
}, styles: [":host{display:block}\n"] }]
|
|
@@ -2613,7 +2610,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
2613
2610
|
}] });
|
|
2614
2611
|
|
|
2615
2612
|
class CarouselControlComponent {
|
|
2616
|
-
#
|
|
2613
|
+
#carouselService = inject(CarouselService);
|
|
2617
2614
|
/**
|
|
2618
2615
|
* Carousel control caption. [docs]
|
|
2619
2616
|
* @return string
|
|
@@ -2655,11 +2652,14 @@ class CarouselControlComponent {
|
|
|
2655
2652
|
}
|
|
2656
2653
|
}
|
|
2657
2654
|
onClick($event) {
|
|
2655
|
+
if (this.#carouselService.animating()) {
|
|
2656
|
+
return;
|
|
2657
|
+
}
|
|
2658
2658
|
this.#play();
|
|
2659
2659
|
}
|
|
2660
2660
|
#play(direction = this.direction()) {
|
|
2661
|
-
const nextIndex = this.#
|
|
2662
|
-
this.#
|
|
2661
|
+
const nextIndex = this.#carouselService.direction(direction);
|
|
2662
|
+
this.#carouselService.state = { activeItemIndex: nextIndex };
|
|
2663
2663
|
}
|
|
2664
2664
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2665
2665
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.0", type: CarouselControlComponent, isStandalone: true, selector: "c-carousel-control", inputs: { captionInput: { classPropertyName: "captionInput", publicName: "caption", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keyup": "onKeyUp($event)", "click": "onClick($event)" }, properties: { "attr.role": "role()", "class": "hostClasses()" } }, exportAs: ["cCarouselControl"], ngImport: i0, template: "<ng-content>\n <span [attr.aria-hidden]=\"true\" [class]=\"carouselControlIconClass()\"></span>\n <span class=\"visually-hidden\">{{ caption() }}</span>\n</ng-content>\n" });
|
|
@@ -2677,7 +2677,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
2677
2677
|
class CarouselIndicatorsComponent {
|
|
2678
2678
|
#destroyRef = inject(DestroyRef);
|
|
2679
2679
|
#carouselService = inject(CarouselService);
|
|
2680
|
-
#carouselState = inject(CarouselState);
|
|
2681
2680
|
items = [];
|
|
2682
2681
|
active = signal(0, /* @ts-ignore */
|
|
2683
2682
|
...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
@@ -2691,16 +2690,19 @@ class CarouselIndicatorsComponent {
|
|
|
2691
2690
|
...(ngDevMode ? [{ debugName: "templates" }] : /* istanbul ignore next */ []));
|
|
2692
2691
|
ngOnInit() {
|
|
2693
2692
|
this.#carouselService.carouselIndex$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((nextIndex) => {
|
|
2694
|
-
this.items = this.#
|
|
2693
|
+
this.items = this.#carouselService?.state?.items?.map((item) => item.index) ?? [];
|
|
2695
2694
|
if ('active' in nextIndex) {
|
|
2696
2695
|
this.active.set(nextIndex.active ?? 0);
|
|
2697
2696
|
}
|
|
2698
2697
|
});
|
|
2699
2698
|
}
|
|
2700
2699
|
onClick(index) {
|
|
2700
|
+
if (this.#carouselService.animating()) {
|
|
2701
|
+
return;
|
|
2702
|
+
}
|
|
2701
2703
|
if (index !== this.active()) {
|
|
2702
2704
|
const direction = index < this.active() ? 'prev' : 'next';
|
|
2703
|
-
this.#
|
|
2705
|
+
this.#carouselService.state = { direction, activeItemIndex: index };
|
|
2704
2706
|
}
|
|
2705
2707
|
}
|
|
2706
2708
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselIndicatorsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -2712,19 +2714,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
2712
2714
|
}], propDecorators: { contentTemplates: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => TemplateIdDirective), { ...{ descendants: true }, isSignal: true }] }] } });
|
|
2713
2715
|
|
|
2714
2716
|
class CarouselItemComponent {
|
|
2717
|
+
#elementRef = inject((ElementRef));
|
|
2715
2718
|
#destroyRef = inject(DestroyRef);
|
|
2716
2719
|
#carouselService = inject(CarouselService);
|
|
2720
|
+
#timeoutId;
|
|
2721
|
+
#rafId;
|
|
2717
2722
|
index;
|
|
2718
2723
|
/**
|
|
2719
2724
|
* @ignore
|
|
2720
2725
|
*/
|
|
2721
2726
|
activeInput = input(false, { ...(ngDevMode ? { debugName: "activeInput" } : /* istanbul ignore next */ {}), transform: booleanAttribute, alias: 'active' });
|
|
2722
|
-
active = linkedSignal(
|
|
2723
|
-
|
|
2724
|
-
return value;
|
|
2725
|
-
} });
|
|
2727
|
+
active = linkedSignal(this.activeInput, /* @ts-ignore */
|
|
2728
|
+
...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
2726
2729
|
/**
|
|
2727
|
-
* Time delay before cycling to next item. If -1, uses carousel interval value.
|
|
2730
|
+
* Time delay before cycling to the next item. If -1, uses carousel interval value.
|
|
2728
2731
|
* @return number
|
|
2729
2732
|
* @default -1
|
|
2730
2733
|
*/
|
|
@@ -2738,102 +2741,119 @@ class CarouselItemComponent {
|
|
|
2738
2741
|
role = input('group', /* @ts-ignore */
|
|
2739
2742
|
...(ngDevMode ? [{ debugName: "role" }] : /* istanbul ignore next */ []));
|
|
2740
2743
|
constructor() {
|
|
2744
|
+
this.#elementRef.nativeElement.style.transition = '1ms';
|
|
2745
|
+
}
|
|
2746
|
+
ngOnInit() {
|
|
2747
|
+
console.log('OnInit', this.#carouselService.state.animate);
|
|
2741
2748
|
this.#carouselService.carouselIndex$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((nextIndex) => {
|
|
2742
2749
|
if ('active' in nextIndex) {
|
|
2750
|
+
console.log('#carouselService', this.#carouselService.state.animate, this.#elementRef.nativeElement.style.transition);
|
|
2751
|
+
if (this.#carouselService.state.animate && this.#elementRef.nativeElement.style.transition !== '') {
|
|
2752
|
+
this.#timeoutId = setTimeout(() => {
|
|
2753
|
+
this.#elementRef.nativeElement.style.transition = '';
|
|
2754
|
+
this.#timeoutId = undefined;
|
|
2755
|
+
}, 500);
|
|
2756
|
+
}
|
|
2757
|
+
this.prevActive.set(this.active());
|
|
2743
2758
|
this.active.set(nextIndex.active === this.index);
|
|
2744
2759
|
}
|
|
2745
2760
|
});
|
|
2761
|
+
// Clean up timeout on destroy
|
|
2762
|
+
this.#destroyRef.onDestroy(() => {
|
|
2763
|
+
if (this.#timeoutId !== undefined) {
|
|
2764
|
+
clearTimeout(this.#timeoutId);
|
|
2765
|
+
}
|
|
2766
|
+
if (this.#rafId !== undefined) {
|
|
2767
|
+
cancelAnimationFrame(this.#rafId);
|
|
2768
|
+
}
|
|
2769
|
+
});
|
|
2746
2770
|
}
|
|
2771
|
+
hostClasses = computed(() => {
|
|
2772
|
+
const order = this.orderClassName();
|
|
2773
|
+
const direction = this.directionClassName();
|
|
2774
|
+
return {
|
|
2775
|
+
active: this.activeClass(),
|
|
2776
|
+
[`${order}`]: !!order,
|
|
2777
|
+
[`${direction}`]: !!direction,
|
|
2778
|
+
'd-none': !this.activeClass() && !order && !direction
|
|
2779
|
+
};
|
|
2780
|
+
}, /* @ts-ignore */
|
|
2781
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
2782
|
+
prevActive = signal(false, /* @ts-ignore */
|
|
2783
|
+
...(ngDevMode ? [{ debugName: "prevActive" }] : /* istanbul ignore next */ []));
|
|
2784
|
+
activeClass = signal(false, /* @ts-ignore */
|
|
2785
|
+
...(ngDevMode ? [{ debugName: "activeClass" }] : /* istanbul ignore next */ []));
|
|
2786
|
+
orderClassName = signal('', /* @ts-ignore */
|
|
2787
|
+
...(ngDevMode ? [{ debugName: "orderClassName" }] : /* istanbul ignore next */ []));
|
|
2788
|
+
directionClassName = signal('', /* @ts-ignore */
|
|
2789
|
+
...(ngDevMode ? [{ debugName: "directionClassName" }] : /* istanbul ignore next */ []));
|
|
2790
|
+
#activeEffect = effect((OnCleanup) => {
|
|
2791
|
+
const active = this.active();
|
|
2792
|
+
const prevActive = untracked(this.prevActive);
|
|
2793
|
+
const direction = this.#carouselService.state?.direction;
|
|
2794
|
+
this.activeClass.set(prevActive);
|
|
2795
|
+
if (active) {
|
|
2796
|
+
this.orderClassName.set(`carousel-item-${direction}`);
|
|
2797
|
+
}
|
|
2798
|
+
if (prevActive || active) {
|
|
2799
|
+
if (this.#rafId) {
|
|
2800
|
+
cancelAnimationFrame(this.#rafId);
|
|
2801
|
+
}
|
|
2802
|
+
this.#rafId = requestAnimationFrame(() => {
|
|
2803
|
+
// reflow is necessary to proper transition
|
|
2804
|
+
void this.#elementRef.nativeElement.offsetHeight;
|
|
2805
|
+
this.directionClassName.set(`carousel-item-${direction === 'next' ? 'start' : 'end'}`);
|
|
2806
|
+
this.#rafId = undefined;
|
|
2807
|
+
});
|
|
2808
|
+
}
|
|
2809
|
+
const handleTransitionStart = () => {
|
|
2810
|
+
if (active) {
|
|
2811
|
+
this.#carouselService.animating.set(true);
|
|
2812
|
+
}
|
|
2813
|
+
};
|
|
2814
|
+
const handleTransitionEnd = () => {
|
|
2815
|
+
if (active) {
|
|
2816
|
+
this.#carouselService.animating.set(false);
|
|
2817
|
+
}
|
|
2818
|
+
this.directionClassName.set('');
|
|
2819
|
+
this.orderClassName.set('');
|
|
2820
|
+
this.activeClass.set(active);
|
|
2821
|
+
};
|
|
2822
|
+
this.#elementRef.nativeElement.addEventListener('transitionstart', handleTransitionStart);
|
|
2823
|
+
this.#elementRef.nativeElement.addEventListener('transitionend', handleTransitionEnd);
|
|
2824
|
+
OnCleanup(() => {
|
|
2825
|
+
this.#elementRef.nativeElement.removeEventListener('transitionstart', handleTransitionStart);
|
|
2826
|
+
this.#elementRef.nativeElement.removeEventListener('transitionend', handleTransitionEnd);
|
|
2827
|
+
});
|
|
2828
|
+
}, /* @ts-ignore */
|
|
2829
|
+
...(ngDevMode ? [{ debugName: "#activeEffect" }] : /* istanbul ignore next */ []));
|
|
2747
2830
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2748
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
2831
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.0", type: CarouselItemComponent, isStandalone: true, selector: "c-carousel-item", inputs: { activeInput: { classPropertyName: "activeInput", publicName: "active", isSignal: true, isRequired: false, transformFunction: null }, interval: { classPropertyName: "interval", publicName: "interval", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()", "attr.role": "role()" }, classAttribute: "carousel-item" }, exportAs: ["cCarouselItem"], ngImport: i0, template: `
|
|
2832
|
+
<!-- @if (this.activeClass() || (this.orderClassName() && this.directionClassName())) {-->
|
|
2833
|
+
<ng-content />
|
|
2834
|
+
<!-- }-->
|
|
2835
|
+
`, isInline: true });
|
|
2749
2836
|
}
|
|
2750
2837
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselItemComponent, decorators: [{
|
|
2751
2838
|
type: Component,
|
|
2752
|
-
args: [{
|
|
2839
|
+
args: [{
|
|
2840
|
+
selector: 'c-carousel-item',
|
|
2841
|
+
template: `
|
|
2842
|
+
<!-- @if (this.activeClass() || (this.orderClassName() && this.directionClassName())) {-->
|
|
2843
|
+
<ng-content />
|
|
2844
|
+
<!-- }-->
|
|
2845
|
+
`,
|
|
2846
|
+
exportAs: 'cCarouselItem',
|
|
2847
|
+
host: {
|
|
2753
2848
|
class: 'carousel-item',
|
|
2754
|
-
'[class
|
|
2849
|
+
'[class]': 'hostClasses()',
|
|
2755
2850
|
'[attr.role]': 'role()'
|
|
2756
|
-
}
|
|
2851
|
+
}
|
|
2852
|
+
}]
|
|
2757
2853
|
}], ctorParameters: () => [], propDecorators: { activeInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "active", required: false }] }], interval: [{ type: i0.Input, args: [{ isSignal: true, alias: "interval", required: false }] }], role: [{ type: i0.Input, args: [{ isSignal: true, alias: "role", required: false }] }] } });
|
|
2758
2854
|
|
|
2759
|
-
function toSlideLeft(fromState, toState) {
|
|
2760
|
-
return toState.left === true && toState.type === 'slide';
|
|
2761
|
-
}
|
|
2762
|
-
function toSlideRight(fromState, toState) {
|
|
2763
|
-
return toState.left === false && toState.type === 'slide';
|
|
2764
|
-
}
|
|
2765
|
-
function toFadeLeft(fromState, toState) {
|
|
2766
|
-
return toState.left === true && toState.type !== 'slide';
|
|
2767
|
-
}
|
|
2768
|
-
function toFadeRight(fromState, toState) {
|
|
2769
|
-
return toState.left === false && toState.type !== 'slide';
|
|
2770
|
-
}
|
|
2771
|
-
const slideAnimationLeft = animation(group([
|
|
2772
|
-
query(':leave', [
|
|
2773
|
-
animate('0.6s ease-in-out', style({
|
|
2774
|
-
transform: 'translateX(-100%)'
|
|
2775
|
-
}))
|
|
2776
|
-
], { optional: true }),
|
|
2777
|
-
query(':enter', [
|
|
2778
|
-
style({
|
|
2779
|
-
transform: 'translateX(100%)'
|
|
2780
|
-
}),
|
|
2781
|
-
animate('0.6s ease-in-out', style('*'))
|
|
2782
|
-
], { optional: true })
|
|
2783
|
-
]));
|
|
2784
|
-
const slideAnimationRight = animation(group([
|
|
2785
|
-
query(':enter', [
|
|
2786
|
-
style({
|
|
2787
|
-
transform: 'translateX(-100%)'
|
|
2788
|
-
}),
|
|
2789
|
-
animate('0.6s ease-in-out', style('*'))
|
|
2790
|
-
], { optional: true }),
|
|
2791
|
-
query(':leave', [
|
|
2792
|
-
animate('0.6s ease-in-out', style({
|
|
2793
|
-
transform: 'translateX(100%)'
|
|
2794
|
-
}))
|
|
2795
|
-
], { optional: true })
|
|
2796
|
-
]));
|
|
2797
|
-
const fadeAnimationLeft = animation(group([
|
|
2798
|
-
query(':leave', [
|
|
2799
|
-
animate('0.9s ease-in-out', style({
|
|
2800
|
-
zIndex: 0,
|
|
2801
|
-
opacity: 0
|
|
2802
|
-
}))
|
|
2803
|
-
], { optional: true }),
|
|
2804
|
-
query(':enter', [
|
|
2805
|
-
style({
|
|
2806
|
-
zIndex: 1,
|
|
2807
|
-
opacity: 1
|
|
2808
|
-
}),
|
|
2809
|
-
animate('0.6s ease-in-out', style('*'))
|
|
2810
|
-
], { optional: true })
|
|
2811
|
-
]));
|
|
2812
|
-
const fadeAnimationRight = animation(group([
|
|
2813
|
-
query(':enter', [
|
|
2814
|
-
style({
|
|
2815
|
-
zIndex: 1,
|
|
2816
|
-
opacity: 1
|
|
2817
|
-
}),
|
|
2818
|
-
animate('0.6s ease-in-out', style('*'))
|
|
2819
|
-
], { optional: true }),
|
|
2820
|
-
query(':leave', [
|
|
2821
|
-
animate('0.9s ease-in-out', style({
|
|
2822
|
-
zIndex: 0,
|
|
2823
|
-
opacity: 0
|
|
2824
|
-
}))
|
|
2825
|
-
], { optional: true })
|
|
2826
|
-
]));
|
|
2827
|
-
const carouselPlay = trigger('carouselPlay', [
|
|
2828
|
-
state('*', style({ transform: 'translateX(0)', display: 'block', opacity: 1 })),
|
|
2829
|
-
transition(toFadeLeft, useAnimation(fadeAnimationLeft)),
|
|
2830
|
-
transition(toFadeRight, useAnimation(fadeAnimationRight)),
|
|
2831
|
-
transition(toSlideLeft, useAnimation(slideAnimationLeft)),
|
|
2832
|
-
transition(toSlideRight, useAnimation(slideAnimationRight))
|
|
2833
|
-
]);
|
|
2834
|
-
|
|
2835
2855
|
class CarouselInnerComponent {
|
|
2836
|
-
#
|
|
2856
|
+
#carouselService = inject(CarouselService);
|
|
2837
2857
|
activeIndex = signal(undefined, /* @ts-ignore */
|
|
2838
2858
|
...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
|
|
2839
2859
|
animate = signal(true, /* @ts-ignore */
|
|
@@ -2861,7 +2881,7 @@ class CarouselInnerComponent {
|
|
|
2861
2881
|
}
|
|
2862
2882
|
ngAfterContentChecked() {
|
|
2863
2883
|
this.setItems();
|
|
2864
|
-
const state = this.#
|
|
2884
|
+
const state = this.#carouselService?.state;
|
|
2865
2885
|
const nextIndex = state?.activeItemIndex;
|
|
2866
2886
|
const nextDirection = state?.direction;
|
|
2867
2887
|
if (this.activeIndex() !== nextIndex) {
|
|
@@ -2876,18 +2896,16 @@ class CarouselInnerComponent {
|
|
|
2876
2896
|
const contentItems = this.contentItems();
|
|
2877
2897
|
if (this.#prevContentItems() !== contentItems) {
|
|
2878
2898
|
this.#prevContentItems.set([...contentItems]);
|
|
2879
|
-
this.#
|
|
2899
|
+
this.#carouselService.setItems(contentItems);
|
|
2880
2900
|
}
|
|
2881
2901
|
}
|
|
2882
2902
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselInnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2883
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.0", type: CarouselInnerComponent, isStandalone: true, selector: "c-carousel-inner", host: { properties: { "
|
|
2903
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.0", type: CarouselInnerComponent, isStandalone: true, selector: "c-carousel-inner", host: { properties: { "attr.aria-live": "ariaLive()" }, classAttribute: "carousel-inner" }, queries: [{ propertyName: "contentItems", predicate: CarouselItemComponent, isSignal: true }], ngImport: i0, template: '<ng-content />', isInline: true, styles: [":host{display:block}\n"] });
|
|
2884
2904
|
}
|
|
2885
2905
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselInnerComponent, decorators: [{
|
|
2886
2906
|
type: Component,
|
|
2887
|
-
args: [{ selector: 'c-carousel-inner',
|
|
2907
|
+
args: [{ selector: 'c-carousel-inner', template: '<ng-content />', host: {
|
|
2888
2908
|
class: 'carousel-inner',
|
|
2889
|
-
'[@carouselPlay]': 'slideType()',
|
|
2890
|
-
'[@.disabled]': '!animate()',
|
|
2891
2909
|
'[attr.aria-live]': 'ariaLive()'
|
|
2892
2910
|
}, styles: [":host{display:block}\n"] }]
|
|
2893
2911
|
}], propDecorators: { contentItems: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CarouselItemComponent), { isSignal: true }] }] } });
|
|
@@ -2908,7 +2926,7 @@ class CarouselModule {
|
|
|
2908
2926
|
CarouselIndicatorsComponent,
|
|
2909
2927
|
CarouselInnerComponent,
|
|
2910
2928
|
CarouselItemComponent] });
|
|
2911
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselModule, providers: [CarouselService,
|
|
2929
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselModule, providers: [CarouselService, CarouselConfig] });
|
|
2912
2930
|
}
|
|
2913
2931
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselModule, decorators: [{
|
|
2914
2932
|
type: NgModule,
|
|
@@ -2921,7 +2939,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
2921
2939
|
CarouselInnerComponent,
|
|
2922
2940
|
CarouselItemComponent
|
|
2923
2941
|
],
|
|
2924
|
-
providers: [CarouselService,
|
|
2942
|
+
providers: [CarouselService, CarouselConfig],
|
|
2925
2943
|
exports: [
|
|
2926
2944
|
CarouselComponent,
|
|
2927
2945
|
CarouselCaptionComponent,
|
|
@@ -8842,85 +8860,116 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
8842
8860
|
}]
|
|
8843
8861
|
}] });
|
|
8844
8862
|
|
|
8863
|
+
const getTransitionDurationFromElement = (element) => {
|
|
8864
|
+
if (!element) {
|
|
8865
|
+
return 0;
|
|
8866
|
+
}
|
|
8867
|
+
// Get transition-duration of the element
|
|
8868
|
+
let { transitionDuration, transitionDelay } = window.getComputedStyle(element);
|
|
8869
|
+
const floatTransitionDuration = Number.parseFloat(transitionDuration);
|
|
8870
|
+
const floatTransitionDelay = Number.parseFloat(transitionDelay);
|
|
8871
|
+
// Return 0 if element or transition duration is not found
|
|
8872
|
+
if (!floatTransitionDuration && !floatTransitionDelay) {
|
|
8873
|
+
return 0;
|
|
8874
|
+
}
|
|
8875
|
+
// If multiple durations are defined, take the first
|
|
8876
|
+
transitionDuration = transitionDuration.split(',')[0];
|
|
8877
|
+
transitionDelay = transitionDelay.split(',')[0];
|
|
8878
|
+
return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * 1000;
|
|
8879
|
+
};
|
|
8880
|
+
|
|
8845
8881
|
class TabPanelComponent {
|
|
8846
|
-
tabsService = inject(TabsService);
|
|
8882
|
+
#tabsService = inject(TabsService);
|
|
8883
|
+
#elementRef = inject(ElementRef);
|
|
8847
8884
|
/**
|
|
8848
8885
|
* aria-labelledby attribute
|
|
8849
|
-
* @
|
|
8886
|
+
* @return string
|
|
8850
8887
|
* @default undefined
|
|
8851
8888
|
*/
|
|
8852
8889
|
ariaLabelledBy = input(undefined, { ...(ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {}), alias: 'aria-labelledby' });
|
|
8853
8890
|
/**
|
|
8854
8891
|
* Element id attribute
|
|
8855
|
-
* @
|
|
8892
|
+
* @return string
|
|
8856
8893
|
* @default undefined
|
|
8857
8894
|
*/
|
|
8858
8895
|
id = input(/* @ts-ignore */
|
|
8859
8896
|
...(ngDevMode ? [undefined, { debugName: "id" }] : /* istanbul ignore next */ []));
|
|
8860
8897
|
/**
|
|
8861
8898
|
* Item key.
|
|
8862
|
-
* @
|
|
8899
|
+
* @return string | number
|
|
8863
8900
|
* @required
|
|
8864
8901
|
*/
|
|
8865
8902
|
itemKey = input.required(/* @ts-ignore */
|
|
8866
8903
|
...(ngDevMode ? [{ debugName: "itemKey" }] : /* istanbul ignore next */ []));
|
|
8867
8904
|
/**
|
|
8868
8905
|
* Element role.
|
|
8869
|
-
* @
|
|
8906
|
+
* @return string
|
|
8870
8907
|
* @default 'tabpanel'
|
|
8871
8908
|
*/
|
|
8872
8909
|
role = input('tabpanel', /* @ts-ignore */
|
|
8873
8910
|
...(ngDevMode ? [{ debugName: "role" }] : /* istanbul ignore next */ []));
|
|
8874
8911
|
/**
|
|
8875
8912
|
* tabindex attribute.
|
|
8876
|
-
* @
|
|
8913
|
+
* @return number
|
|
8877
8914
|
* @default 0
|
|
8878
8915
|
*/
|
|
8879
8916
|
tabindex = input(0, { ...(ngDevMode ? { debugName: "tabindex" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
8880
8917
|
/**
|
|
8881
8918
|
* Enable fade in transition.
|
|
8882
|
-
* @
|
|
8919
|
+
* @return boolean
|
|
8883
8920
|
* @default true
|
|
8884
8921
|
*/
|
|
8885
8922
|
transition = input(true, /* @ts-ignore */
|
|
8886
8923
|
...(ngDevMode ? [{ debugName: "transition" }] : /* istanbul ignore next */ []));
|
|
8887
8924
|
/**
|
|
8888
8925
|
* visible change output
|
|
8889
|
-
* @
|
|
8926
|
+
* @return VisibleChangeEvent
|
|
8890
8927
|
*/
|
|
8891
8928
|
visibleChange = output();
|
|
8892
8929
|
show = signal(false, /* @ts-ignore */
|
|
8893
8930
|
...(ngDevMode ? [{ debugName: "show" }] : /* istanbul ignore next */ []));
|
|
8894
8931
|
visible = computed(() => {
|
|
8895
|
-
const visible = this
|
|
8932
|
+
const visible = this.#tabsService.activeItemKey() === this.itemKey() && !this.#tabsService.activeItem()?.disabled;
|
|
8896
8933
|
this.visibleChange?.emit({ itemKey: this.itemKey(), visible });
|
|
8897
8934
|
return visible;
|
|
8898
8935
|
}, /* @ts-ignore */
|
|
8899
8936
|
...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
8900
|
-
|
|
8937
|
+
#transitionDuration = 0;
|
|
8938
|
+
#visibleEffect = effect(() => {
|
|
8939
|
+
const isVisible = this.visible();
|
|
8940
|
+
const hasTransition = this.transition();
|
|
8941
|
+
if (!hasTransition) {
|
|
8942
|
+
this.show.set(isVisible);
|
|
8943
|
+
}
|
|
8944
|
+
else {
|
|
8945
|
+
requestAnimationFrame(() => {
|
|
8946
|
+
if (this.#transitionDuration === 0) {
|
|
8947
|
+
this.#transitionDuration = getTransitionDurationFromElement(this.#elementRef.nativeElement);
|
|
8948
|
+
}
|
|
8949
|
+
setTimeout(() => this.show.set(isVisible), this.#transitionDuration || 0);
|
|
8950
|
+
});
|
|
8951
|
+
}
|
|
8952
|
+
}, /* @ts-ignore */
|
|
8953
|
+
...(ngDevMode ? [{ debugName: "#visibleEffect" }] : /* istanbul ignore next */ []));
|
|
8954
|
+
propId = computed(() => this.id() ?? `${this.#tabsService.id()}-panel-${this.itemKey()}`, /* @ts-ignore */
|
|
8901
8955
|
...(ngDevMode ? [{ debugName: "propId" }] : /* istanbul ignore next */ []));
|
|
8902
|
-
attrAriaLabelledBy = computed(() => this.ariaLabelledBy() ?? `${this
|
|
8956
|
+
attrAriaLabelledBy = computed(() => this.ariaLabelledBy() ?? `${this.#tabsService.id()}-tab-${this.itemKey()}`, /* @ts-ignore */
|
|
8903
8957
|
...(ngDevMode ? [{ debugName: "attrAriaLabelledBy" }] : /* istanbul ignore next */ []));
|
|
8904
8958
|
hostClasses = computed(() => ({
|
|
8905
8959
|
'tab-pane': true,
|
|
8906
|
-
active: this.
|
|
8960
|
+
active: this.visible(),
|
|
8907
8961
|
fade: this.transition(),
|
|
8908
8962
|
show: this.show(),
|
|
8909
|
-
invisible: this
|
|
8963
|
+
invisible: this.#tabsService.activeItem()?.disabled
|
|
8910
8964
|
}), /* @ts-ignore */
|
|
8911
8965
|
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
8912
|
-
|
|
8913
|
-
|
|
8966
|
+
onTransitionEnd($event) {
|
|
8967
|
+
if ($event.propertyName === 'opacity' && $event.target === this.#elementRef.nativeElement) {
|
|
8968
|
+
this.show.set(this.visible());
|
|
8969
|
+
}
|
|
8914
8970
|
}
|
|
8915
8971
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: TabPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
8916
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.0", type: TabPanelComponent, isStandalone: true, selector: "c-tab-panel", inputs: { ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, itemKey: { classPropertyName: "itemKey", publicName: "itemKey", isSignal: true, isRequired: true, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null }, transition: { classPropertyName: "transition", publicName: "transition", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visibleChange: "visibleChange" }, host: { listeners: { "
|
|
8917
|
-
trigger('fadeInOut', [
|
|
8918
|
-
state('show', style({ opacity: 1 })),
|
|
8919
|
-
state('hide', style({ opacity: 0 })),
|
|
8920
|
-
state('void', style({ opacity: 1 })),
|
|
8921
|
-
transition('* => *', [query('@*', [animateChild()], { optional: true }), animate('150ms linear')])
|
|
8922
|
-
])
|
|
8923
|
-
] });
|
|
8972
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.0", type: TabPanelComponent, isStandalone: true, selector: "c-tab-panel", inputs: { ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, itemKey: { classPropertyName: "itemKey", publicName: "itemKey", isSignal: true, isRequired: true, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null }, transition: { classPropertyName: "transition", publicName: "transition", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visibleChange: "visibleChange" }, host: { listeners: { "transitionend": "onTransitionEnd($event)" }, properties: { "class": "hostClasses()", "tabindex": "visible() ? tabindex() : -1", "attr.aria-labelledby": "attrAriaLabelledBy()", "id": "propId()", "attr.role": "role()" } }, exportAs: ["cTabPanel"], ngImport: i0, template: '<ng-content />', isInline: true });
|
|
8924
8973
|
}
|
|
8925
8974
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: TabPanelComponent, decorators: [{
|
|
8926
8975
|
type: Component,
|
|
@@ -8934,18 +8983,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
8934
8983
|
'[attr.aria-labelledby]': 'attrAriaLabelledBy()',
|
|
8935
8984
|
'[id]': 'propId()',
|
|
8936
8985
|
'[attr.role]': 'role()',
|
|
8937
|
-
'
|
|
8938
|
-
|
|
8939
|
-
'(@fadeInOut.done)': 'onAnimationDone($event)'
|
|
8940
|
-
},
|
|
8941
|
-
animations: [
|
|
8942
|
-
trigger('fadeInOut', [
|
|
8943
|
-
state('show', style({ opacity: 1 })),
|
|
8944
|
-
state('hide', style({ opacity: 0 })),
|
|
8945
|
-
state('void', style({ opacity: 1 })),
|
|
8946
|
-
transition('* => *', [query('@*', [animateChild()], { optional: true }), animate('150ms linear')])
|
|
8947
|
-
])
|
|
8948
|
-
]
|
|
8986
|
+
'(transitionend)': 'onTransitionEnd($event)'
|
|
8987
|
+
}
|
|
8949
8988
|
}]
|
|
8950
8989
|
}], propDecorators: { ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], itemKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemKey", required: true }] }], role: [{ type: i0.Input, args: [{ isSignal: true, alias: "role", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }], transition: [{ type: i0.Input, args: [{ isSignal: true, alias: "transition", required: false }] }], visibleChange: [{ type: i0.Output, args: ["visibleChange"] }] } });
|
|
8951
8990
|
|