282 lines
30 KiB
JavaScript
282 lines
30 KiB
JavaScript
import { animate, state, style, transition, trigger } from '@angular/animations';
|
|
import { CommonModule, DOCUMENT, isPlatformBrowser } from '@angular/common';
|
|
import { ChangeDetectionStrategy, Component, ContentChildren, Inject, Input, NgModule, PLATFORM_ID, ViewEncapsulation, numberAttribute } from '@angular/core';
|
|
import { PrimeTemplate, SharedModule } from 'primeng/api';
|
|
import { DomHandler } from 'primeng/dom';
|
|
import { ChevronUpIcon } from 'primeng/icons/chevronup';
|
|
import { ZIndexUtils } from 'primeng/utils';
|
|
import * as i0 from "@angular/core";
|
|
import * as i1 from "primeng/api";
|
|
import * as i2 from "@angular/common";
|
|
/**
|
|
* ScrollTop gets displayed after a certain scroll position and used to navigates to the top of the page quickly.
|
|
* @group Components
|
|
*/
|
|
export class ScrollTop {
|
|
document;
|
|
platformId;
|
|
renderer;
|
|
el;
|
|
cd;
|
|
config;
|
|
/**
|
|
* Class of the element.
|
|
* @group Props
|
|
*/
|
|
styleClass;
|
|
/**
|
|
* Inline style of the element.
|
|
* @group Props
|
|
*/
|
|
style;
|
|
/**
|
|
* Target of the ScrollTop.
|
|
* @group Props
|
|
*/
|
|
target = 'window';
|
|
/**
|
|
* Defines the threshold value of the vertical scroll position of the target to toggle the visibility.
|
|
* @group Props
|
|
*/
|
|
threshold = 400;
|
|
/**
|
|
* Name of the icon or JSX.Element for icon.
|
|
* @group Props
|
|
*/
|
|
icon;
|
|
/**
|
|
* Defines the scrolling behavior, "smooth" adds an animation and "auto" scrolls with a jump.
|
|
* @group Props
|
|
*/
|
|
behavior = 'smooth';
|
|
/**
|
|
* A string value used to determine the display transition options.
|
|
* @group Props
|
|
*/
|
|
showTransitionOptions = '.15s';
|
|
/**
|
|
* A string value used to determine the hiding transition options.
|
|
* @group Props
|
|
*/
|
|
hideTransitionOptions = '.15s';
|
|
/**
|
|
* Establishes a string value that labels the scroll-top button.
|
|
* @group Props
|
|
*/
|
|
buttonAriaLabel;
|
|
templates;
|
|
iconTemplate;
|
|
documentScrollListener;
|
|
parentScrollListener;
|
|
visible = false;
|
|
overlay;
|
|
window;
|
|
constructor(document, platformId, renderer, el, cd, config) {
|
|
this.document = document;
|
|
this.platformId = platformId;
|
|
this.renderer = renderer;
|
|
this.el = el;
|
|
this.cd = cd;
|
|
this.config = config;
|
|
this.window = this.document.defaultView;
|
|
}
|
|
ngOnInit() {
|
|
if (this.target === 'window')
|
|
this.bindDocumentScrollListener();
|
|
else if (this.target === 'parent')
|
|
this.bindParentScrollListener();
|
|
}
|
|
ngAfterContentInit() {
|
|
this.templates.forEach((item) => {
|
|
switch (item.getType()) {
|
|
case 'icon':
|
|
this.iconTemplate = item.template;
|
|
break;
|
|
}
|
|
});
|
|
}
|
|
onClick() {
|
|
let scrollElement = this.target === 'window' ? this.window : this.el.nativeElement.parentElement;
|
|
scrollElement.scroll({
|
|
top: 0,
|
|
behavior: this.behavior
|
|
});
|
|
}
|
|
onEnter(event) {
|
|
switch (event.toState) {
|
|
case 'open':
|
|
this.overlay = event.element;
|
|
ZIndexUtils.set('overlay', this.overlay, this.config.zIndex.overlay);
|
|
break;
|
|
case 'void':
|
|
this.overlay = null;
|
|
break;
|
|
}
|
|
}
|
|
onLeave(event) {
|
|
switch (event.toState) {
|
|
case 'void':
|
|
ZIndexUtils.clear(event.element);
|
|
break;
|
|
}
|
|
}
|
|
checkVisibility(scrollY) {
|
|
if (scrollY > this.threshold)
|
|
this.visible = true;
|
|
else
|
|
this.visible = false;
|
|
this.cd.markForCheck();
|
|
}
|
|
bindParentScrollListener() {
|
|
if (isPlatformBrowser(this.platformId)) {
|
|
this.parentScrollListener = this.renderer.listen(this.el.nativeElement.parentElement, 'scroll', () => {
|
|
this.checkVisibility(this.el.nativeElement.parentElement.scrollTop);
|
|
});
|
|
}
|
|
}
|
|
bindDocumentScrollListener() {
|
|
if (isPlatformBrowser(this.platformId)) {
|
|
this.documentScrollListener = this.renderer.listen(this.window, 'scroll', () => {
|
|
this.checkVisibility(DomHandler.getWindowScrollTop());
|
|
});
|
|
}
|
|
}
|
|
unbindParentScrollListener() {
|
|
if (this.parentScrollListener) {
|
|
this.parentScrollListener();
|
|
this.parentScrollListener = null;
|
|
}
|
|
}
|
|
unbindDocumentScrollListener() {
|
|
if (this.documentScrollListener) {
|
|
this.documentScrollListener();
|
|
this.documentScrollListener = null;
|
|
}
|
|
}
|
|
containerClass() {
|
|
return {
|
|
'p-scrolltop p-link p-component': true,
|
|
'p-scrolltop-sticky': this.target !== 'window'
|
|
};
|
|
}
|
|
ngOnDestroy() {
|
|
if (this.target === 'window')
|
|
this.unbindDocumentScrollListener();
|
|
else if (this.target === 'parent')
|
|
this.unbindParentScrollListener();
|
|
if (this.overlay) {
|
|
ZIndexUtils.clear(this.overlay);
|
|
this.overlay = null;
|
|
}
|
|
}
|
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ScrollTop, deps: [{ token: DOCUMENT }, { token: PLATFORM_ID }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1.PrimeNGConfig }], target: i0.ɵɵFactoryTarget.Component });
|
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "17.3.7", type: ScrollTop, selector: "p-scrollTop", inputs: { styleClass: "styleClass", style: "style", target: "target", threshold: ["threshold", "threshold", numberAttribute], icon: "icon", behavior: "behavior", showTransitionOptions: "showTransitionOptions", hideTransitionOptions: "hideTransitionOptions", buttonAriaLabel: "buttonAriaLabel" }, host: { classAttribute: "p-element" }, queries: [{ propertyName: "templates", predicate: PrimeTemplate }], ngImport: i0, template: `
|
|
<button
|
|
*ngIf="visible"
|
|
[@animation]="{ value: 'open', params: { showTransitionParams: showTransitionOptions, hideTransitionParams: hideTransitionOptions } }"
|
|
(@animation.start)="onEnter($event)"
|
|
(@animation.done)="onLeave($event)"
|
|
[attr.aria-label]="buttonAriaLabel"
|
|
[ngClass]="containerClass()"
|
|
(click)="onClick()"
|
|
[class]="styleClass"
|
|
[ngStyle]="style"
|
|
type="button"
|
|
>
|
|
<ng-container *ngIf="!iconTemplate">
|
|
<span *ngIf="icon" [class]="icon" [ngClass]="'p-scrolltop-icon'"></span>
|
|
<ChevronUpIcon *ngIf="!icon" [styleClass]="'p-scrolltop-icon'" [ngStyle]="{ 'font-size': '1rem', scale: '1.5' }" />
|
|
</ng-container>
|
|
<ng-template [ngIf]="!icon" *ngTemplateOutlet="iconTemplate; context: { styleClass: 'p-scrolltop-icon' }"></ng-template>
|
|
</button>
|
|
`, isInline: true, styles: ["@layer primeng{.p-scrolltop{position:fixed;bottom:20px;right:20px;display:flex;align-items:center;justify-content:center}.p-scrolltop-sticky{position:sticky}.p-scrolltop-sticky.p-link{margin-left:auto}}\n"], dependencies: [{ kind: "directive", type: i0.forwardRef(() => i2.NgClass), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(() => i2.NgIf), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i0.forwardRef(() => i2.NgTemplateOutlet), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i0.forwardRef(() => i2.NgStyle), selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i0.forwardRef(() => ChevronUpIcon), selector: "ChevronUpIcon" }], animations: [
|
|
trigger('animation', [
|
|
state('void', style({
|
|
opacity: 0
|
|
})),
|
|
state('open', style({
|
|
opacity: 1
|
|
})),
|
|
transition('void => open', animate('{{showTransitionParams}}')),
|
|
transition('open => void', animate('{{hideTransitionParams}}'))
|
|
])
|
|
], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
}
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ScrollTop, decorators: [{
|
|
type: Component,
|
|
args: [{ selector: 'p-scrollTop', template: `
|
|
<button
|
|
*ngIf="visible"
|
|
[@animation]="{ value: 'open', params: { showTransitionParams: showTransitionOptions, hideTransitionParams: hideTransitionOptions } }"
|
|
(@animation.start)="onEnter($event)"
|
|
(@animation.done)="onLeave($event)"
|
|
[attr.aria-label]="buttonAriaLabel"
|
|
[ngClass]="containerClass()"
|
|
(click)="onClick()"
|
|
[class]="styleClass"
|
|
[ngStyle]="style"
|
|
type="button"
|
|
>
|
|
<ng-container *ngIf="!iconTemplate">
|
|
<span *ngIf="icon" [class]="icon" [ngClass]="'p-scrolltop-icon'"></span>
|
|
<ChevronUpIcon *ngIf="!icon" [styleClass]="'p-scrolltop-icon'" [ngStyle]="{ 'font-size': '1rem', scale: '1.5' }" />
|
|
</ng-container>
|
|
<ng-template [ngIf]="!icon" *ngTemplateOutlet="iconTemplate; context: { styleClass: 'p-scrolltop-icon' }"></ng-template>
|
|
</button>
|
|
`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, animations: [
|
|
trigger('animation', [
|
|
state('void', style({
|
|
opacity: 0
|
|
})),
|
|
state('open', style({
|
|
opacity: 1
|
|
})),
|
|
transition('void => open', animate('{{showTransitionParams}}')),
|
|
transition('open => void', animate('{{hideTransitionParams}}'))
|
|
])
|
|
], host: {
|
|
class: 'p-element'
|
|
}, styles: ["@layer primeng{.p-scrolltop{position:fixed;bottom:20px;right:20px;display:flex;align-items:center;justify-content:center}.p-scrolltop-sticky{position:sticky}.p-scrolltop-sticky.p-link{margin-left:auto}}\n"] }]
|
|
}], ctorParameters: () => [{ type: Document, decorators: [{
|
|
type: Inject,
|
|
args: [DOCUMENT]
|
|
}] }, { type: undefined, decorators: [{
|
|
type: Inject,
|
|
args: [PLATFORM_ID]
|
|
}] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1.PrimeNGConfig }], propDecorators: { styleClass: [{
|
|
type: Input
|
|
}], style: [{
|
|
type: Input
|
|
}], target: [{
|
|
type: Input
|
|
}], threshold: [{
|
|
type: Input,
|
|
args: [{ transform: numberAttribute }]
|
|
}], icon: [{
|
|
type: Input
|
|
}], behavior: [{
|
|
type: Input
|
|
}], showTransitionOptions: [{
|
|
type: Input
|
|
}], hideTransitionOptions: [{
|
|
type: Input
|
|
}], buttonAriaLabel: [{
|
|
type: Input
|
|
}], templates: [{
|
|
type: ContentChildren,
|
|
args: [PrimeTemplate]
|
|
}] } });
|
|
export class ScrollTopModule {
|
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ScrollTopModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.7", ngImport: i0, type: ScrollTopModule, declarations: [ScrollTop], imports: [CommonModule, ChevronUpIcon, SharedModule], exports: [ScrollTop, SharedModule] });
|
|
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ScrollTopModule, imports: [CommonModule, ChevronUpIcon, SharedModule, SharedModule] });
|
|
}
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ScrollTopModule, decorators: [{
|
|
type: NgModule,
|
|
args: [{
|
|
imports: [CommonModule, ChevronUpIcon, SharedModule],
|
|
exports: [ScrollTop, SharedModule],
|
|
declarations: [ScrollTop]
|
|
}]
|
|
}] });
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Nyb2xsdG9wLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2FwcC9jb21wb25lbnRzL3Njcm9sbHRvcC9zY3JvbGx0b3AudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFrQixPQUFPLEVBQUUsS0FBSyxFQUFFLEt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5Lk9uUHVzaCxcbiAgICBlbmNhcHN1bGF0aW9uOiBWaWV3RW5jYXBzdWxhdGlvbi5Ob25lLFxuICAgIHN0eWxlVXJsczogWycuL3Njcm9sbHRvcC5jc3MnXSxcbiAgICBhbmltYXRpb25zOiBbXG4gICAgICAgIHRyaWdnZXIoJ2FuaW1hdGlvbicsIFtcbiAgICAgICAgICAgIHN0YXRlKFxuICAgICAgICAgICAgICAgICd2b2lkJyxcbiAgICAgICAgICAgICAgICBzdHlsZSh7XG4gICAgICAgICAgICAgICAgICAgIG9wYWNpdHk6IDBcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgKSxcbiAgICAgICAgICAgIHN0YXRlKFxuICAgICAgICAgICAgICAgICdvcGVuJyxcbiAgICAgICAgICAgICAgICBzdHlsZSh7XG4gICAgICAgICAgICAgICAgICAgIG9wYWNpdHk6IDFcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgKSxcbiAgICAgICAgICAgIHRyYW5zaXRpb24oJ3ZvaWQgPT4gb3BlbicsIGFuaW1hdGUoJ3t7c2hvd1RyYW5zaXRpb25QYXJhbXN9fScpKSxcbiAgICAgICAgICAgIHRyYW5zaXRpb24oJ29wZW4gPT4gdm9pZCcsIGFuaW1hdGUoJ3t7aGlkZVRyYW5zaXRpb25QYXJhbXN9fScpKVxuICAgICAgICBdKVxuICAgIF0sXG4gICAgaG9zdDoge1xuICAgICAgICBjbGFzczogJ3AtZWxlbWVudCdcbiAgICB9XG59KVxuZXhwb3J0IGNsYXNzIFNjcm9sbFRvcCBpbXBsZW1lbnRzIE9uSW5pdCwgT25EZXN0cm95IHtcbiAgICAvKipcbiAgICAgKiBDbGFzcyBvZiB0aGUgZWxlbWVudC5cbiAgICAgKiBAZ3JvdXAgUHJvcHNcbiAgICAgKi9cbiAgICBASW5wdXQoKSBzdHlsZUNsYXNzOiBzdHJpbmcgfCB1bmRlZmluZWQ7XG4gICAgLyoqXG4gICAgICogSW5saW5lIHN0eWxlIG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zLndpbmRvdyA6IHRoaXMuZWwubmF0aXZlRWxlbWVudC5wYXJlbnRFbGVtZW50O1xuICAgICAgICBzY3JvbGxFbGVtZW50LnNjcm9sbCh7XG4gICAgICAgICAgICB0b3A6IDAsXG4gICAgICAgICAgICBiZWhhdmlvcjogdGhpcy5iZWhhdmlvclxuICAgICAgICB9KTtcbiAgICB9XG5cbiAgICBvbkVudGVyKGV2ZW50OiBBbmltYXRpb25FdmVudCkge1xuICAgICAgICBzd2l0Y2ggKGV2ZW50LnRvU3RhdGUpIHtcbiAgICAgICAgICAgIGNhc2UgJ29wZW4nOlxuICAgICAgICAgICAgICAgIHRoaXMub3ZlcmxheSA9IGV2ZW50LmVsZW1lbnQ7XG4gICAgICAgICAgICAgICAgWkluZGV4VXRpbHMuc2V0KCdvdmVybGF5JywgdGhpcy5vdmVybGF5LCB0aGlzLmNvbmZpZy56SW5kZXgub3ZlcmxheSk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlICd2b2lkJzpcbiAgICAgICAgICAgICAgICB0aGlzLm92ZXJsYXkgPSBudWxsO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgb25MZWF2ZShldmVudDogQW5pbWF0aW9uRXZlbnQpIHtcbiAgICAgICAgc3dpdGNoIChldmVudC50b1N0YXRlKSB7XG4gICAgICAgICAgICBjYXNlICd2b2lkJzpcbiAgICAgICAgICAgICAgICBaSW5kZXhVdGlscy5jbGVhcihldmVudC5lbGVtZW50KTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGNoZWNrVmlzaWJpbGl0eShzY3JvbGxZOiBudW1iZXIpIHtcbiAgICAgICAgaWYgKHNjcm9sbFkgPiB0aGlzLnRocmVzaG9sZCkgdGhpcy52aXNpYmxlID0gdHJ1ZTtcbiAgICAgICAgZWxzZSB0aGlzLnZpc2libGUgPSBmYWxzZTtcblxuICAgICA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