source: trip-planner-front/node_modules/primeng/fesm2015/primeng-ripple.mjs@ 571e0df

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

adding photos

  • Property mode set to 100644
File size: 4.7 KB
Line 
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 () {
89 return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i1.PrimeNGConfig, decorators: [{
90 type: Optional
91 }] }];
92 } });
93class RippleModule {
94}
95RippleModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: RippleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
96RippleModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: RippleModule, declarations: [Ripple], imports: [CommonModule], exports: [Ripple] });
97RippleModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: RippleModule, imports: [[CommonModule]] });
98i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: RippleModule, decorators: [{
99 type: NgModule,
100 args: [{
101 imports: [CommonModule],
102 exports: [Ripple],
103 declarations: [Ripple]
104 }]
105 }] });
106
107/**
108 * Generated bundle index. Do not edit.
109 */
110
111export { Ripple, RippleModule };
Note: See TracBrowser for help on using the repository browser.