Icard/angular-clarity-master(work.../node_modules/primeng/esm2022/animate/animate.mjs

101 lines
11 KiB
JavaScript

import { CommonModule } from '@angular/common';
import { Directive, Input, NgModule } from '@angular/core';
import { DomHandler } from 'primeng/dom';
import * as i0 from "@angular/core";
/**
* Animate manages PrimeFlex CSS classes declaratively to during enter/leave animations on scroll or on page load.
* @group Components
*/
export class Animate {
host;
el;
renderer;
/**
* Selector to define the CSS class for enter animation.
* @group Props
*/
enterClass;
/**
* Selector to define the CSS class for leave animation.
* @group Props
*/
leaveClass;
observer;
timeout;
constructor(host, el, renderer) {
this.host = host;
this.el = el;
this.renderer = renderer;
}
ngOnInit() {
console.log('pAnimate directive is deprecated in 16.7.0 and will be removed in the future. Use pAnimateOnScroll directive instead');
}
ngAfterViewInit() {
this.bindIntersectionObserver();
}
bindIntersectionObserver() {
const options = {
root: null,
rootMargin: '0px',
threshold: 1.0
};
this.observer = new IntersectionObserver((el) => this.isVisible(el), options);
this.observer.observe(this.host.nativeElement);
}
isVisible(element) {
const [intersectionObserverEntry] = element;
intersectionObserverEntry.isIntersecting ? this.enter() : this.leave();
}
enter() {
this.host.nativeElement.style.visibility = 'visible';
DomHandler.addClass(this.host.nativeElement, this.enterClass);
}
leave() {
DomHandler.removeClass(this.host.nativeElement, this.enterClass);
if (this.leaveClass) {
DomHandler.addClass(this.host.nativeElement, this.leaveClass);
}
const animationDuration = this.host.nativeElement.style.animationDuration || 500;
this.timeout = setTimeout(() => {
this.host.nativeElement.style.visibility = 'hidden';
}, animationDuration);
}
unbindIntersectionObserver() {
if (this.observer) {
this.observer.unobserve(this.host.nativeElement);
}
}
ngOnDestroy() {
this.unbindIntersectionObserver();
clearTimeout(this.timeout);
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: Animate, deps: [{ token: i0.ElementRef }, { token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.7", type: Animate, selector: "[pAnimate]", inputs: { enterClass: "enterClass", leaveClass: "leaveClass" }, host: { properties: { "class.p-animate": "true" } }, ngImport: i0 });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: Animate, decorators: [{
type: Directive,
args: [{
selector: '[pAnimate]',
host: {
'[class.p-animate]': 'true'
}
}]
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { enterClass: [{
type: Input
}], leaveClass: [{
type: Input
}] } });
export class AnimateModule {
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: AnimateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.7", ngImport: i0, type: AnimateModule, declarations: [Animate], imports: [CommonModule], exports: [Animate] });
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: AnimateModule, imports: [CommonModule] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: AnimateModule, decorators: [{
type: NgModule,
args: [{
imports: [CommonModule],
exports: [Animate],
declarations: [Animate]
}]
}] });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5pbWF0ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hcHAvY29tcG9uZW50cy9hbmltYXRlL2FuaW1hdGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQy9DLE9BQU8sRUFBaUIsU0FBUyxFQUFjLEtBQUssRUFBRSxRQUFRLEVBQXFCLE1BQU0sZUFBZSxDQ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