/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { Directionality } from '@angular/cdk/bidi'; import { Directive, ElementRef, InjectionToken, NgZone, Optional } from '@angular/core'; import { ScrollDispatcher } from './scroll-dispatcher'; import { CdkScrollable } from './scrollable'; import * as i0 from "@angular/core"; import * as i1 from "./scroll-dispatcher"; import * as i2 from "@angular/cdk/bidi"; export const VIRTUAL_SCROLLABLE = new InjectionToken('VIRTUAL_SCROLLABLE'); /** * Extending the {@link CdkScrollable} to be used as scrolling container for virtual scrolling. */ export class CdkVirtualScrollable extends CdkScrollable { constructor(elementRef, scrollDispatcher, ngZone, dir) { super(elementRef, scrollDispatcher, ngZone, dir); } /** * Measure the viewport size for the provided orientation. * * @param orientation The orientation to measure the size from. */ measureViewportSize(orientation) { const viewportEl = this.elementRef.nativeElement; return orientation === 'horizontal' ? viewportEl.clientWidth : viewportEl.clientHeight; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: CdkVirtualScrollable, deps: [{ token: i0.ElementRef }, { token: i1.ScrollDispatcher }, { token: i0.NgZone }, { token: i2.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); } static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.1", type: CdkVirtualScrollable, usesInheritance: true, ngImport: i0 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: CdkVirtualScrollable, decorators: [{ type: Directive }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.ScrollDispatcher }, { type: i0.NgZone }, { type: i2.Directionality, decorators: [{ type: Optional }] }]; } }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmlydHVhbC1zY3JvbGxhYmxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4v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