From 7fa1cf06e0a029c6680b9f4a43bfa9f1fe2c137c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20=C3=87etin?= <92744169+mehmetcetin01140@users.noreply.github.com> Date: Mon, 9 Oct 2023 22:49:33 +0300 Subject: [PATCH 1/2] code format --- src/app/components/carousel/carousel.ts | 43 ++++++++++++------------- src/app/components/galleria/galleria.ts | 6 ++-- src/app/components/image/image.ts | 2 +- 3 files changed, 25 insertions(+), 26 deletions(-) diff --git a/src/app/components/carousel/carousel.ts b/src/app/components/carousel/carousel.ts index 758f9de07d2..aa23696c196 100755 --- a/src/app/components/carousel/carousel.ts +++ b/src/app/components/carousel/carousel.ts @@ -358,7 +358,7 @@ export class Carousel implements AfterContentInit { } ngOnChanges(simpleChange: SimpleChanges) { - if(isPlatformBrowser(this.platformId)) { + if (isPlatformBrowser(this.platformId)) { if (simpleChange.value) { if (this.circular && this._value) { this.setCloneItems(); @@ -370,42 +370,41 @@ export class Carousel implements AfterContentInit { if (this.responsiveOptions) { this.defaultNumVisible = this.numVisible; } - + if (this.isCircular()) { this.setCloneItems(); } - + this.createStyle(); this.calculatePosition(); } - + if (simpleChange.numScroll) { if (this.responsiveOptions) { this.defaultNumScroll = this.numScroll; } } } - } } ngAfterContentInit() { this.id = UniqueComponentId(); - if(isPlatformBrowser(this.platformId)) { + if (isPlatformBrowser(this.platformId)) { this.allowAutoplay = !!this.autoplayInterval; if (this.circular) { this.setCloneItems(); } - + if (this.responsiveOptions) { this.defaultNumScroll = this._numScroll; this.defaultNumVisible = this._numVisible; } - + this.createStyle(); this.calculatePosition(); - + if (this.responsiveOptions) { this.bindDocumentListeners(); } @@ -441,17 +440,17 @@ export class Carousel implements AfterContentInit { } ngAfterContentChecked() { - if(isPlatformBrowser(this.platformId)) { + if (isPlatformBrowser(this.platformId)) { const isCircular = this.isCircular(); let totalShiftedItems = this.totalShiftedItems; - + if (this.value && this.itemsContainer && (this.prevState.numScroll !== this._numScroll || this.prevState.numVisible !== this._numVisible || this.prevState.value.length !== this.value.length)) { if (this.autoplayInterval) { this.stopAutoplay(false); } - + this.remainingItems = (this.value.length - this._numVisible) % this._numScroll; - + let page = this._page; if (this.totalDots() !== 0 && page >= this.totalDots()) { page = this.totalDots() - 1; @@ -460,39 +459,39 @@ export class Carousel implements AfterContentInit { page: this.page }); } - + totalShiftedItems = page * this._numScroll * -1; if (isCircular) { totalShiftedItems -= this._numVisible; } - + if (page === this.totalDots() - 1 && this.remainingItems > 0) { totalShiftedItems += -1 * this.remainingItems + this._numScroll; this.isRemainingItemsAdded = true; } else { this.isRemainingItemsAdded = false; } - + if (totalShiftedItems !== this.totalShiftedItems) { this.totalShiftedItems = totalShiftedItems; } - + this._oldNumScroll = this._numScroll; this.prevState.numScroll = this._numScroll; this.prevState.numVisible = this._numVisible; this.prevState.value = [...(this._value as any[])]; - + if (this.totalDots() > 0 && this.itemsContainer.nativeElement) { this.itemsContainer.nativeElement.style.transform = this.isVertical() ? `translate3d(0, ${totalShiftedItems * (100 / this._numVisible)}%, 0)` : `translate3d(${totalShiftedItems * (100 / this._numVisible)}%, 0, 0)`; } - + this.isCreated = true; - + if (this.autoplayInterval && this.isAutoplay()) { this.startAutoplay(); } } - + if (isCircular) { if (this.page === 0) { totalShiftedItems = -1 * this._numVisible; @@ -502,7 +501,7 @@ export class Carousel implements AfterContentInit { this.isRemainingItemsAdded = true; } } - + if (totalShiftedItems !== this.totalShiftedItems) { this.totalShiftedItems = totalShiftedItems; } diff --git a/src/app/components/galleria/galleria.ts b/src/app/components/galleria/galleria.ts index db83227e6c5..a8c5952a65c 100755 --- a/src/app/components/galleria/galleria.ts +++ b/src/app/components/galleria/galleria.ts @@ -280,7 +280,7 @@ export class Galleria implements OnChanges, OnDestroy { maskVisible: boolean = false; - constructor(@Inject(DOCUMENT) private document: Document, @Inject(PLATFORM_ID) public platformId: any, public element: ElementRef, public cd: ChangeDetectorRef, public config: PrimeNGConfig) {} + constructor(@Inject(DOCUMENT) private document: Document, @Inject(PLATFORM_ID) public platformId: any, public element: ElementRef, public cd: ChangeDetectorRef, public config: PrimeNGConfig) {} ngAfterContentInit() { this.templates?.forEach((item) => { @@ -518,13 +518,13 @@ export class GalleriaContent implements DoCheck { } startSlideShow() { - if(isPlatformBrowser(this.galleria.platformId)) { + if (isPlatformBrowser(this.galleria.platformId)) { this.interval = setInterval(() => { let activeIndex = this.galleria.circular && this.value.length - 1 === this.activeIndex ? 0 : this.activeIndex + 1; this.onActiveIndexChange(activeIndex); this.activeIndex = activeIndex; }, this.galleria.transitionInterval); - + this.slideShowActive = true; } } diff --git a/src/app/components/image/image.ts b/src/app/components/image/image.ts index e6733ebc114..a482c37b4a8 100755 --- a/src/app/components/image/image.ts +++ b/src/app/components/image/image.ts @@ -23,7 +23,7 @@ import { FocusTrapModule } from 'primeng/focustrap'; template: ` -