1 line
9.9 KiB
Plaintext
1 line
9.9 KiB
Plaintext
{"version":3,"file":"primeng-ripple.mjs","sources":["../../src/app/components/ripple/ripple.ts","../../src/app/components/ripple/primeng-ripple.ts"],"sourcesContent":["import { CommonModule, DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { AfterViewInit, Directive, ElementRef, Inject, NgModule, NgZone, OnDestroy, Optional, PLATFORM_ID, Renderer2 } from '@angular/core';\nimport { PrimeNGConfig } from 'primeng/api';\nimport { DomHandler } from 'primeng/dom';\nimport { VoidListener } from 'primeng/ts-helpers';\n/**\n * Ripple directive adds ripple effect to the host element.\n * @group Components\n */\n@Directive({\n selector: '[pRipple]',\n host: {\n class: 'p-ripple p-element'\n }\n})\nexport class Ripple implements AfterViewInit, OnDestroy {\n constructor(@Inject(DOCUMENT) private document: Document, @Inject(PLATFORM_ID) private platformId: any, private renderer: Renderer2, public el: ElementRef, public zone: NgZone, @Optional() public config: PrimeNGConfig) {}\n\n animationListener: VoidListener;\n\n mouseDownListener: VoidListener;\n\n timeout: any;\n\n ngAfterViewInit() {\n if (isPlatformBrowser(this.platformId)) {\n if (this.config && this.config.ripple) {\n this.zone.runOutsideAngular(() => {\n this.create();\n this.mouseDownListener = this.renderer.listen(this.el.nativeElement, 'mousedown', this.onMouseDown.bind(this));\n });\n }\n }\n }\n\n onMouseDown(event: MouseEvent) {\n let ink = this.getInk();\n if (!ink || this.document.defaultView?.getComputedStyle(ink, null).display === 'none') {\n return;\n }\n\n DomHandler.removeClass(ink, 'p-ink-active');\n if (!DomHandler.getHeight(ink) && !DomHandler.getWidth(ink)) {\n let d = Math.max(DomHandler.getOuterWidth(this.el.nativeElement), DomHandler.getOuterHeight(this.el.nativeElement));\n ink.style.height = d + 'px';\n ink.style.width = d + 'px';\n }\n\n let offset = DomHandler.getOffset(this.el.nativeElement);\n let x = event.pageX - offset.left + this.document.body.scrollTop - DomHandler.getWidth(ink) / 2;\n let y = event.pageY - offset.top + this.document.body.scrollLeft - DomHandler.getHeight(ink) / 2;\n\n this.renderer.setStyle(ink, 'top', y + 'px');\n this.renderer.setStyle(ink, 'left', x + 'px');\n DomHandler.addClass(ink, 'p-ink-active');\n\n this.timeout = setTimeout(() => {\n let ink = this.getInk();\n if (ink) {\n DomHandler.removeClass(ink, 'p-ink-active');\n }\n }, 401);\n }\n\n getInk() {\n const children = this.el.nativeElement.children;\n for (let i = 0; i < children.length; i++) {\n if (typeof children[i].className === 'string' && children[i].className.indexOf('p-ink') !== -1) {\n return children[i];\n }\n }\n return null;\n }\n\n resetInk() {\n let ink = this.getInk();\n if (ink) {\n DomHandler.removeClass(ink, 'p-ink-active');\n }\n }\n\n onAnimationEnd(event: Event) {\n if (this.timeout) {\n clearTimeout(this.timeout);\n }\n DomHandler.removeClass(event.currentTarget, 'p-ink-active');\n }\n\n create() {\n let ink = this.renderer.createElement('span');\n this.renderer.addClass(ink, 'p-ink');\n this.renderer.appendChild(this.el.nativeElement, ink);\n this.renderer.setAttribute(ink, 'aria-hidden', 'true');\n this.renderer.setAttribute(ink, 'role', 'presentation');\n\n if (!this.animationListener) {\n this.animationListener = this.renderer.listen(ink, 'animationend', this.onAnimationEnd.bind(this));\n }\n }\n\n remove() {\n let ink = this.getInk();\n if (ink) {\n this.mouseDownListener && this.mouseDownListener();\n this.animationListener && this.animationListener();\n this.mouseDownListener = null;\n this.animationListener = null;\n\n DomHandler.removeElement(ink);\n }\n }\n\n ngOnDestroy() {\n if (this.config && this.config.ripple) {\n this.remove();\n }\n }\n}\n\n@NgModule({\n imports: [CommonModule],\n exports: [Ripple],\n declarations: [Ripple]\n})\nexport class RippleModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;AAKA;;;AAGG;MAOU,MAAM,CAAA;AACuB,IAAA,QAAA,CAAA;AAAiD,IAAA,UAAA,CAAA;AAAyB,IAAA,QAAA,CAAA;AAA4B,IAAA,EAAA,CAAA;AAAuB,IAAA,IAAA,CAAA;AAAi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