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 | */
|
---|
8 | import { Directionality } from '@angular/cdk/bidi';
|
---|
9 | import { ElementRef, NgZone, OnDestroy, OnInit } from '@angular/core';
|
---|
10 | import { Observable } from 'rxjs';
|
---|
11 | import { ScrollDispatcher } from './scroll-dispatcher';
|
---|
12 | export declare type _Without<T> = {
|
---|
13 | [P in keyof T]?: never;
|
---|
14 | };
|
---|
15 | export declare type _XOR<T, U> = (_Without<T> & U) | (_Without<U> & T);
|
---|
16 | export declare type _Top = {
|
---|
17 | top?: number;
|
---|
18 | };
|
---|
19 | export declare type _Bottom = {
|
---|
20 | bottom?: number;
|
---|
21 | };
|
---|
22 | export declare type _Left = {
|
---|
23 | left?: number;
|
---|
24 | };
|
---|
25 | export declare type _Right = {
|
---|
26 | right?: number;
|
---|
27 | };
|
---|
28 | export declare type _Start = {
|
---|
29 | start?: number;
|
---|
30 | };
|
---|
31 | export declare type _End = {
|
---|
32 | end?: number;
|
---|
33 | };
|
---|
34 | export declare type _XAxis = _XOR<_XOR<_Left, _Right>, _XOR<_Start, _End>>;
|
---|
35 | export declare type _YAxis = _XOR<_Top, _Bottom>;
|
---|
36 | /**
|
---|
37 | * An extended version of ScrollToOptions that allows expressing scroll offsets relative to the
|
---|
38 | * top, bottom, left, right, start, or end of the viewport rather than just the top and left.
|
---|
39 | * Please note: the top and bottom properties are mutually exclusive, as are the left, right,
|
---|
40 | * start, and end properties.
|
---|
41 | */
|
---|
42 | export declare type ExtendedScrollToOptions = _XAxis & _YAxis & ScrollOptions;
|
---|
43 | /**
|
---|
44 | * Sends an event when the directive's element is scrolled. Registers itself with the
|
---|
45 | * ScrollDispatcher service to include itself as part of its collection of scrolling events that it
|
---|
46 | * can be listened to through the service.
|
---|
47 | */
|
---|
48 | export declare class CdkScrollable implements OnInit, OnDestroy {
|
---|
49 | protected elementRef: ElementRef<HTMLElement>;
|
---|
50 | protected scrollDispatcher: ScrollDispatcher;
|
---|
51 | protected ngZone: NgZone;
|
---|
52 | protected dir?: Directionality | undefined;
|
---|
53 | private readonly _destroyed;
|
---|
54 | private _elementScrolled;
|
---|
55 | constructor(elementRef: ElementRef<HTMLElement>, scrollDispatcher: ScrollDispatcher, ngZone: NgZone, dir?: Directionality | undefined);
|
---|
56 | ngOnInit(): void;
|
---|
57 | ngOnDestroy(): void;
|
---|
58 | /** Returns observable that emits when a scroll event is fired on the host element. */
|
---|
59 | elementScrolled(): Observable<Event>;
|
---|
60 | /** Gets the ElementRef for the viewport. */
|
---|
61 | getElementRef(): ElementRef<HTMLElement>;
|
---|
62 | /**
|
---|
63 | * Scrolls to the specified offsets. This is a normalized version of the browser's native scrollTo
|
---|
64 | * method, since browsers are not consistent about what scrollLeft means in RTL. For this method
|
---|
65 | * left and right always refer to the left and right side of the scrolling container irrespective
|
---|
66 | * of the layout direction. start and end refer to left and right in an LTR context and vice-versa
|
---|
67 | * in an RTL context.
|
---|
68 | * @param options specified the offsets to scroll to.
|
---|
69 | */
|
---|
70 | scrollTo(options: ExtendedScrollToOptions): void;
|
---|
71 | private _applyScrollToOptions;
|
---|
72 | /**
|
---|
73 | * Measures the scroll offset relative to the specified edge of the viewport. This method can be
|
---|
74 | * used instead of directly checking scrollLeft or scrollTop, since browsers are not consistent
|
---|
75 | * about what scrollLeft means in RTL. The values returned by this method are normalized such that
|
---|
76 | * left and right always refer to the left and right side of the scrolling container irrespective
|
---|
77 | * of the layout direction. start and end refer to left and right in an LTR context and vice-versa
|
---|
78 | * in an RTL context.
|
---|
79 | * @param from The edge to measure from.
|
---|
80 | */
|
---|
81 | measureScrollOffset(from: 'top' | 'left' | 'right' | 'bottom' | 'start' | 'end'): number;
|
---|
82 | }
|
---|