UNPKG

5.79 kBJavaScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { Directionality } from '@angular/cdk/bidi';
9import { Directive, ElementRef, NgZone, Optional } from '@angular/core';
10import { ScrollDispatcher } from './scroll-dispatcher';
11import { CdkVirtualScrollable, VIRTUAL_SCROLLABLE } from './virtual-scrollable';
12import * as i0 from "@angular/core";
13import * as i1 from "./scroll-dispatcher";
14import * as i2 from "@angular/cdk/bidi";
15/**
16 * Provides a virtual scrollable for the element it is attached to.
17 */
18class CdkVirtualScrollableElement extends CdkVirtualScrollable {
19 constructor(elementRef, scrollDispatcher, ngZone, dir) {
20 super(elementRef, scrollDispatcher, ngZone, dir);
21 }
22 measureBoundingClientRectWithScrollOffset(from) {
23 return (this.getElementRef().nativeElement.getBoundingClientRect()[from] -
24 this.measureScrollOffset(from));
25 }
26 static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkVirtualScrollableElement, deps: [{ token: i0.ElementRef }, { token: i1.ScrollDispatcher }, { token: i0.NgZone }, { token: i2.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
27 static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: CdkVirtualScrollableElement, isStandalone: true, selector: "[cdkVirtualScrollingElement]", host: { classAttribute: "cdk-virtual-scrollable" }, providers: [{ provide: VIRTUAL_SCROLLABLE, useExisting: CdkVirtualScrollableElement }], usesInheritance: true, ngImport: i0 }); }
28}
29export { CdkVirtualScrollableElement };
30i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkVirtualScrollableElement, decorators: [{
31 type: Directive,
32 args: [{
33 selector: '[cdkVirtualScrollingElement]',
34 providers: [{ provide: VIRTUAL_SCROLLABLE, useExisting: CdkVirtualScrollableElement }],
35 standalone: true,
36 host: {
37 'class': 'cdk-virtual-scrollable',
38 },
39 }]
40 }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.ScrollDispatcher }, { type: i0.NgZone }, { type: i2.Directionality, decorators: [{
41 type: Optional
42 }] }]; } });
43//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmlydHVhbC1zY3JvbGxhYmxlLWVsZW1lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvY2RrL3Njcm9sbGluZy92aXJ0dWFsLXNjcm9sbGFibGUtZWxlbWVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFFSCxPQUFPLEVBQUMsY0FBYyxFQUFDLE1BQU0sbUJBQW1CLENBQUM7QUFDakQsT0FBTyxFQUFDLFNBQVMsRUFBRSxVQUFVLEVBQUUsTUFBTSxFQUFFLFFBQVEsRUFBQyxNQUFNLGVBQWUsQ0FBQztBQUN0RSxPQUFPLEVBQUMsZ0JBQWdCLEVBQUMsTUFBTSxxQkFBcUIsQ0FBQztBQUNyRCxPQUFPLEVBQUMsb0JBQW9CLEVBQUUsa0JBQWtCLEVBQUMsTUFBTSxzQkFBc0IsQ0FBQzs7OztBQUU5RTs7R0FFRztBQUNILE1BUWEsMkJBQTRCLFNBQVEsb0JBQW9CO0lBQ25FLFlBQ0UsVUFBc0IsRUFDdEIsZ0JBQWtDLEVBQ2xDLE1BQWMsRUFDRixHQUFtQjtRQUUvQixLQUFLLENBQUMsVUFBVSxFQUFFLGdCQUFnQixFQUFFLE1BQU0sRUFBRSxHQUFHLENBQUMsQ0FBQztJQUNuRCxDQUFDO0lBRVEseUNBQXlDLENBQ2hELElBQXlDO1FBRXpDLE9BQU8sQ0FDTCxJQUFJLENBQUMsYUFBYSxFQUFFLENBQUMsYUFBYSxDQUFDLHFCQUFxQixFQUFFLENBQU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