import { Directive } from '@angular/core'; import { Observable, fromEvent, merge, map, switchMap, takeUntil, tap } from 'rxjs'; import { stopPropagation } from './scrollbar/common'; import * as i0 from "@angular/core"; export class ScrollViewport { // Get viewport size, clientHeight or clientWidth get clientHeight() { return this.nativeElement.clientHeight; } get clientWidth() { return this.nativeElement.clientWidth; } get scrollHeight() { return this.nativeElement.scrollHeight; } get scrollWidth() { return this.nativeElement.scrollWidth; } // Get viewport scroll offset, scrollTop or scrollLeft get scrollTop() { return this.nativeElement.scrollTop; } get scrollLeft() { return this.nativeElement.scrollLeft; } // Get the available scrollable size get scrollMaxX() { return this.scrollWidth - this.clientWidth; } get scrollMaxY() { return this.scrollHeight - this.clientHeight; } get contentHeight() { return this.contentWrapperElement?.clientHeight || 0; } get contentWidth() { return this.contentWrapperElement?.clientWidth || 0; } constructor(viewPort) { this.viewPort = viewPort; this.nativeElement = viewPort.nativeElement; } /** * Activate viewport pointer events such as 'hovered' and 'clicked' events */ activatePointerEvents(propagate, destroyed) { this.hovered = new Observable((subscriber) => { // Stream that emits when pointer is moved over the viewport (used to set the hovered state) const mouseMoveStream = fromEvent(this.nativeElement, 'mousemove', { passive: true }); const mouseMove = propagate ? mouseMoveStream : mouseMoveStream.pipe(stopPropagation()); // Stream that emits when pointer leaves the viewport (used to remove the hovered state) const mouseLeave = fromEvent(this.nativeElement, 'mouseleave', { passive: true }).pipe(map(() => false)); merge(mouseMove, mouseLeave).pipe(tap((e) => subscriber.next(e)), takeUntil(destroyed)).subscribe(); }); this.clicked = new Observable((subscriber) => { const mouseDown = fromEvent(this.nativeElement, 'mousedown', { passive: true }).pipe(tap((e) => subscriber.next(e))); const mouseUp = fromEvent(this.nativeElement, 'mouseup', { passive: true }).pipe(tap(() => subscriber.next(false))); mouseDown.pipe(switchMap(() => mouseUp), takeUntil(destroyed)).subscribe(); }); } /** * Set this directive as a non-functional wrapper, called when a custom viewport is used */ setAsWrapper() { // In this case the default viewport and the default content wrapper will act as a mask this.nativeElement.className = 'ng-native-scrollbar-hider ng-scroll-layer'; if (this.nativeElement.firstElementChild) { this.nativeElement.firstElementChild.className = 'ng-scroll-layer'; } } /** * Set this directive as the viewport, called when no custom viewport is used */ setAsViewport(customClassName) { this.nativeElement.className += ` ng-native-scrollbar-hider ng-scroll-viewport ${customClassName}`; // Check if the custom viewport has only one child and set it as the content wrapper if (this.nativeElement.firstElementChild) { this.contentWrapperElement = this.nativeElement.firstElementChild; this.contentWrapperElement.classList.add('ng-scroll-content'); } } /** * Scroll viewport vertically */ scrollYTo(value) { this.nativeElement.scrollTop = value; } /** * Scroll viewport horizontally */ scrollXTo(value) { this.nativeElement.scrollLeft = value; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ScrollViewport, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); } static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.5", type: ScrollViewport, isStandalone: true, selector: "[scrollViewport]", ngImport: i0 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: ScrollViewport, decorators: [{ type: Directive, args: [{ selector: '[scrollViewport]', standalone: true }] }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Nyb2xsLXZpZXdwb3J0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvbmd4LXNjcm9sbGJhci9zcmMvbGliL3Njcm9sbC12aWV3cG9ydC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFjLE1BQU0sZUFBZSxDQUFDO0FBQ3RELE9BQU8sRUFBRSxVQUFVLEVBQWMsU0FBUyxFQUFFLEtBQUssRUFBRSxHQUFHLEVBQUUsU0FBUyxFQUF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