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