source: trip-planner-front/node_modules/primeng/fesm2020/primeng-ripple.mjs@ 1ad8e64

Last change on this file since 1ad8e64 was 59329aa, checked in by Ema <ema_spirova@…>, 3 years ago

adding photos

  • Property mode set to 100644
File size: 4.6 KB
RevLine 
[59329aa]1import * as i0 from '@angular/core';
2import { Directive, Optional, NgModule } from '@angular/core';
3import { CommonModule } from '@angular/common';
4import { DomHandler } from 'primeng/dom';
5import * as i1 from 'primeng/api';
6
7class Ripple {
8 constructor(el, zone, config) {
9 this.el = el;
10 this.zone = zone;
11 this.config = config;
12 }
13 ngAfterViewInit() {
14 if (this.config && this.config.ripple) {
15 this.zone.runOutsideAngular(() => {
16 this.create();
17 this.mouseDownListener = this.onMouseDown.bind(this);
18 this.el.nativeElement.addEventListener('mousedown', this.mouseDownListener);
19 });
20 }
21 }
22 onMouseDown(event) {
23 let ink = this.getInk();
24 if (!ink || getComputedStyle(ink, null).display === 'none') {
25 return;
26 }
27 DomHandler.removeClass(ink, 'p-ink-active');
28 if (!DomHandler.getHeight(ink) && !DomHandler.getWidth(ink)) {
29 let d = Math.max(DomHandler.getOuterWidth(this.el.nativeElement), DomHandler.getOuterHeight(this.el.nativeElement));
30 ink.style.height = d + 'px';
31 ink.style.width = d + 'px';
32 }
33 let offset = DomHandler.getOffset(this.el.nativeElement);
34 let x = event.pageX - offset.left + document.body.scrollTop - DomHandler.getWidth(ink) / 2;
35 let y = event.pageY - offset.top + document.body.scrollLeft - DomHandler.getHeight(ink) / 2;
36 ink.style.top = y + 'px';
37 ink.style.left = x + 'px';
38 DomHandler.addClass(ink, 'p-ink-active');
39 }
40 getInk() {
41 for (let i = 0; i < this.el.nativeElement.children.length; i++) {
42 if (this.el.nativeElement.children[i].className.indexOf('p-ink') !== -1) {
43 return this.el.nativeElement.children[i];
44 }
45 }
46 return null;
47 }
48 resetInk() {
49 let ink = this.getInk();
50 if (ink) {
51 DomHandler.removeClass(ink, 'p-ink-active');
52 }
53 }
54 onAnimationEnd(event) {
55 DomHandler.removeClass(event.currentTarget, 'p-ink-active');
56 }
57 create() {
58 let ink = document.createElement('span');
59 ink.className = 'p-ink';
60 this.el.nativeElement.appendChild(ink);
61 this.animationListener = this.onAnimationEnd.bind(this);
62 ink.addEventListener('animationend', this.animationListener);
63 }
64 remove() {
65 let ink = this.getInk();
66 if (ink) {
67 this.el.nativeElement.removeEventListener('mousedown', this.mouseDownListener);
68 ink.removeEventListener('animationend', this.animationListener);
69 DomHandler.removeElement(ink);
70 }
71 }
72 ngOnDestroy() {
73 if (this.config && this.config.ripple) {
74 this.remove();
75 }
76 }
77}
78Ripple.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Ripple, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i1.PrimeNGConfig, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
79Ripple.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.0", type: Ripple, selector: "[pRipple]", host: { classAttribute: "p-ripple p-element" }, ngImport: i0 });
80i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Ripple, decorators: [{
81 type: Directive,
82 args: [{
83 selector: '[pRipple]',
84 host: {
85 'class': 'p-ripple p-element'
86 }
87 }]
88 }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i1.PrimeNGConfig, decorators: [{
89 type: Optional
90 }] }]; } });
91class RippleModule {
92}
93RippleModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: RippleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
94RippleModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: RippleModule, declarations: [Ripple], imports: [CommonModule], exports: [Ripple] });
95RippleModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: RippleModule, imports: [[CommonModule]] });
96i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: RippleModule, decorators: [{
97 type: NgModule,
98 args: [{
99 imports: [CommonModule],
100 exports: [Ripple],
101 declarations: [Ripple]
102 }]
103 }] });
104
105/**
106 * Generated bundle index. Do not edit.
107 */
108
109export { Ripple, RippleModule };
Note: See TracBrowser for help on using the repository browser.