-
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #328 from MurhafSousli/v7.4.2
V7.4.2
- Loading branch information
Showing
32 changed files
with
167 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,9 @@ ng-scrollbar { | |
bottom: 2em; | ||
right: 2em; | ||
} | ||
|
||
.mat-fab { | ||
position: fixed; | ||
bottom: 2em; | ||
left: 2em; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,45 @@ | ||
import { ChangeDetectionStrategy, Component } from '@angular/core'; | ||
import { ChangeDetectionStrategy, Component, AfterViewInit, ViewChild } from '@angular/core'; | ||
import { BreakpointObserver, Breakpoints, BreakpointState } from '@angular/cdk/layout'; | ||
import { Observable } from 'rxjs'; | ||
import { map } from 'rxjs/operators'; | ||
import { NgScrollbar } from 'ngx-scrollbar'; | ||
import { BehaviorSubject, Observable } from 'rxjs'; | ||
import { auditTime, map, tap } from 'rxjs/operators'; | ||
|
||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: './app.component.html', | ||
styleUrls: ['./app.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class AppComponent { | ||
showGoToTopButton = false; | ||
largeScreen: Observable<boolean>; | ||
export class AppComponent implements AfterViewInit { | ||
|
||
@ViewChild(NgScrollbar) scrollable: NgScrollbar; | ||
|
||
largeScreen$: Observable<boolean>; | ||
|
||
scrollToIcon$ = new BehaviorSubject<string>('bottom'); | ||
|
||
constructor(breakpointObserver: BreakpointObserver) { | ||
this.largeScreen = breakpointObserver.observe(Breakpoints.HandsetPortrait).pipe(map((state: BreakpointState) => !state.matches)); | ||
this.largeScreen$ = breakpointObserver.observe(Breakpoints.HandsetPortrait).pipe(map((state: BreakpointState) => !state.matches)); | ||
} | ||
|
||
ngAfterViewInit() { | ||
this.scrollable.verticalScrolled.pipe( | ||
auditTime(200), | ||
tap(() => { | ||
const center = this.scrollable.viewport.clientHeight / 2; | ||
const scrollHeight = this.scrollable.viewport.scrollHeight; | ||
const scrollTop = this.scrollable.viewport.scrollTop; | ||
this.scrollToIcon$.next(scrollTop + center > scrollHeight / 2 ? 'top' : 'bottom'); | ||
}) | ||
).subscribe(); | ||
} | ||
|
||
scrollToEdge(icon: string) { | ||
if (icon === 'top') { | ||
this.scrollable.scrollTo({ top: 0 }); | ||
} else { | ||
this.scrollable.scrollTo({ bottom: 0 }); | ||
} | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...ngx-scrollbar-demo/src/app/example-infinite-scroll/example-infinite-scroll.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...r-demo/src/app/example-nested-virtual-scroll/example-nested-virtual-scroll.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 18 additions & 11 deletions
29
...x-scrollbar-demo/src/app/example-scrollto-element/example-scrollto-element.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,27 @@ | ||
<mat-card class="example"> | ||
<mat-card class="example mat-elevation-z16"> | ||
<mat-card-header> | ||
<mat-card-title> | ||
ScrollToElement | ||
</mat-card-title> | ||
</mat-card-header> | ||
<mat-card-content> | ||
<div class="scrolltoExample"> | ||
<ng-scrollbar appearance="compact"> | ||
<ul> | ||
<li class="example-item" | ||
*ngFor="let item of [].constructor(20); index as i" | ||
(click)="scrollToItem(itemEl)" #itemEl> | ||
item {{i}} | ||
</li> | ||
</ul> | ||
</ng-scrollbar> | ||
<div class="center-pointer"> | ||
<mat-icon>play_arrow</mat-icon> | ||
</div> | ||
|
||
<div class="scroll-to-example"> | ||
<ng-scrollbar pointerEventsMethod="scrollbar" | ||
appearance="compact" | ||
autoHeightDisabled="true"> | ||
<ul> | ||
<li class="example-item" | ||
*ngFor="let item of [].constructor(20); index as i" | ||
#itemEl | ||
(click)="scrollToItem(itemEl)"> | ||
item {{i}} | ||
</li> | ||
</ul> | ||
</ng-scrollbar> | ||
</div> | ||
</mat-card-content> | ||
</mat-card> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/ngx-scrollbar-demo/src/app/example-virutal-scroll/example-virtual-scroll.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
projects/ngx-scrollbar-demo/src/app/example-x/example-x.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
projects/ngx-scrollbar-demo/src/app/example2/example2.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
projects/ngx-scrollbar-demo/src/app/example3/example3.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
projects/ngx-scrollbar-demo/src/app/example4/example4.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
projects/ngx-scrollbar-demo/src/app/example5/example5.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
projects/ngx-scrollbar-demo/src/app/example5/example5.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 1 addition & 20 deletions
21
projects/ngx-scrollbar-demo/src/app/shared/author/author.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,3 @@ | ||
<h3>Author</h3> | ||
<div class="author"> | ||
<div class="author-photo"> | ||
<img src="https://www.gravatar.com/avatar/7261d414a78ed3118aa86a5e0c8a93d1?s=328&d=identicon&r=PG" alt="author-photo"> | ||
</div> | ||
<div class="author-info"> | ||
<p>Murhaf Sousli</p> | ||
<p><span>Software Engineer</span></p> | ||
<div class="author-twitter"> | ||
<a href="https://twitter.com/murhafsousli?ref_src=twsrc%5Etfw" aria-label="Follow @murhafsousli on Twitter"> | ||
<i class="fa fa-twitter"></i> | ||
<span>twitter.com/murhafsousli</span> | ||
</a> | ||
</div> | ||
<div class="author-twitter"> | ||
<a class="github-button" href="https://github.com/murhafsousli" aria-label="Follow @murhafsousli on GitHub"> | ||
<i class="fa fa-github"></i> | ||
<span>github.com/murhafsousli</span> | ||
</a> | ||
</div> | ||
</div> | ||
<p>Made with ❤️ by Murhaf Sousli</p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
projects/ngx-scrollbar-demo/src/app/shared/header/header.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.