@angular/cdk 14.0.3 → 14.1.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@ import { Directionality } from '@angular/cdk/bidi';
6
6
  import { DoCheck } from '@angular/core';
7
7
  import { ElementRef } from '@angular/core';
8
8
  import * as i0 from '@angular/core';
9
- import * as i5 from '@angular/cdk/bidi';
9
+ import * as i7 from '@angular/cdk/bidi';
10
10
  import { InjectionToken } from '@angular/core';
11
11
  import { IterableDiffers } from '@angular/core';
12
12
  import { ListRange } from '@angular/cdk/collections';
@@ -65,8 +65,8 @@ export declare class CdkScrollable implements OnInit, OnDestroy {
65
65
  protected scrollDispatcher: ScrollDispatcher;
66
66
  protected ngZone: NgZone;
67
67
  protected dir?: Directionality | undefined;
68
- private readonly _destroyed;
69
- private _elementScrolled;
68
+ protected readonly _destroyed: Subject<void>;
69
+ protected _elementScrolled: Observable<Event>;
70
70
  constructor(elementRef: ElementRef<HTMLElement>, scrollDispatcher: ScrollDispatcher, ngZone: NgZone, dir?: Directionality | undefined);
71
71
  ngOnInit(): void;
72
72
  ngOnDestroy(): void;
@@ -209,6 +209,48 @@ export declare type CdkVirtualForOfContext<T> = {
209
209
  odd: boolean;
210
210
  };
211
211
 
212
+ /**
213
+ * Extending the {@link CdkScrollable} to be used as scrolling container for virtual scrolling.
214
+ */
215
+ export declare abstract class CdkVirtualScrollable extends CdkScrollable {
216
+ constructor(elementRef: ElementRef<HTMLElement>, scrollDispatcher: ScrollDispatcher, ngZone: NgZone, dir?: Directionality);
217
+ /**
218
+ * Measure the viewport size for the provided orientation.
219
+ *
220
+ * @param orientation The orientation to measure the size from.
221
+ */
222
+ measureViewportSize(orientation: 'horizontal' | 'vertical'): number;
223
+ /**
224
+ * Measure the bounding ClientRect size including the scroll offset.
225
+ *
226
+ * @param from The edge to measure from.
227
+ */
228
+ abstract measureBoundingClientRectWithScrollOffset(from: 'left' | 'top' | 'right' | 'bottom'): number;
229
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkVirtualScrollable, [null, null, null, { optional: true; }]>;
230
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkVirtualScrollable, never, never, {}, {}, never, never, false>;
231
+ }
232
+
233
+ /**
234
+ * Provides a virtual scrollable for the element it is attached to.
235
+ */
236
+ export declare class CdkVirtualScrollableElement extends CdkVirtualScrollable {
237
+ constructor(elementRef: ElementRef, scrollDispatcher: ScrollDispatcher, ngZone: NgZone, dir: Directionality);
238
+ measureBoundingClientRectWithScrollOffset(from: 'left' | 'top' | 'right' | 'bottom'): number;
239
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkVirtualScrollableElement, [null, null, null, { optional: true; }]>;
240
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkVirtualScrollableElement, "[cdkVirtualScrollingElement]", never, {}, {}, never, never, false>;
241
+ }
242
+
243
+ /**
244
+ * Provides as virtual scrollable for the global / window scrollbar.
245
+ */
246
+ export declare class CdkVirtualScrollableWindow extends CdkVirtualScrollable {
247
+ protected _elementScrolled: Observable<Event>;
248
+ constructor(scrollDispatcher: ScrollDispatcher, ngZone: NgZone, dir: Directionality);
249
+ measureBoundingClientRectWithScrollOffset(from: 'left' | 'top' | 'right' | 'bottom'): number;
250
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkVirtualScrollableWindow, [null, null, { optional: true; }]>;
251
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkVirtualScrollableWindow, "cdk-virtual-scroll-viewport[scrollWindow]", never, {}, {}, never, never, false>;
252
+ }
253
+
212
254
  /**
213
255
  * An item to be repeated by the VirtualScrollViewport
214
256
  */
@@ -218,10 +260,11 @@ export declare interface CdkVirtualScrollRepeater<T> {
218
260
  }
219
261
 
220
262
  /** A viewport that virtualizes its scrolling with the help of `CdkVirtualForOf`. */
221
- export declare class CdkVirtualScrollViewport extends CdkScrollable implements OnInit, OnDestroy {
263
+ export declare class CdkVirtualScrollViewport extends CdkVirtualScrollable implements OnInit, OnDestroy {
222
264
  elementRef: ElementRef<HTMLElement>;
223
265
  private _changeDetectorRef;
224
266
  private _scrollStrategy;
267
+ scrollable: CdkVirtualScrollable;
225
268
  /** Emits when the viewport is detached from a CdkVirtualForOf. */
226
269
  private readonly _detachedSubject;
227
270
  /** Emits when the rendered range changes. */
@@ -277,7 +320,7 @@ export declare class CdkVirtualScrollViewport extends CdkScrollable implements O
277
320
  private _runAfterChangeDetection;
278
321
  /** Subscription to changes in the viewport size. */
279
322
  private _viewportChanges;
280
- constructor(elementRef: ElementRef<HTMLElement>, _changeDetectorRef: ChangeDetectorRef, ngZone: NgZone, _scrollStrategy: VirtualScrollStrategy, dir: Directionality, scrollDispatcher: ScrollDispatcher, viewportRuler: ViewportRuler);
323
+ constructor(elementRef: ElementRef<HTMLElement>, _changeDetectorRef: ChangeDetectorRef, ngZone: NgZone, _scrollStrategy: VirtualScrollStrategy, dir: Directionality, scrollDispatcher: ScrollDispatcher, viewportRuler: ViewportRuler, scrollable: CdkVirtualScrollable);
281
324
  ngOnInit(): void;
282
325
  ngOnDestroy(): void;
283
326
  /** Attaches a `CdkVirtualScrollRepeater` to this viewport. */
@@ -290,6 +333,7 @@ export declare class CdkVirtualScrollViewport extends CdkScrollable implements O
290
333
  getViewportSize(): number;
291
334
  /** Get the current rendered range of items. */
292
335
  getRenderedRange(): ListRange;
336
+ measureBoundingClientRectWithScrollOffset(from: 'left' | 'top' | 'right' | 'bottom'): number;
293
337
  /**
294
338
  * Sets the total size of all content (in pixels), including content that is not currently
295
339
  * rendered.
@@ -321,11 +365,16 @@ export declare class CdkVirtualScrollViewport extends CdkScrollable implements O
321
365
  */
322
366
  scrollToIndex(index: number, behavior?: ScrollBehavior): void;
323
367
  /**
324
- * Gets the current scroll offset from the start of the viewport (in pixels).
368
+ * Gets the current scroll offset from the start of the scrollable (in pixels).
325
369
  * @param from The edge to measure the offset from. Defaults to 'top' in vertical mode and 'start'
326
370
  * in horizontal mode.
327
371
  */
328
372
  measureScrollOffset(from?: 'top' | 'left' | 'right' | 'bottom' | 'start' | 'end'): number;
373
+ /**
374
+ * Measures the offset of the viewport from the scrolling container
375
+ * @param from The edge to measure from.
376
+ */
377
+ measureViewportOffset(from?: 'top' | 'left' | 'right' | 'bottom' | 'start' | 'end'): number;
329
378
  /** Measure the combined size of all of the rendered items. */
330
379
  measureRenderedContentSize(): number;
331
380
  /**
@@ -343,7 +392,7 @@ export declare class CdkVirtualScrollViewport extends CdkScrollable implements O
343
392
  private _doChangeDetection;
344
393
  /** Calculates the `style.width` and `style.height` for the spacer element. */
345
394
  private _calculateSpacerSize;
346
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkVirtualScrollViewport, [null, null, null, { optional: true; }, { optional: true; }, null, null]>;
395
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkVirtualScrollViewport, [null, null, null, { optional: true; }, { optional: true; }, null, null, { optional: true; }]>;
347
396
  static ɵcmp: i0.ɵɵComponentDeclaration<CdkVirtualScrollViewport, "cdk-virtual-scroll-viewport", never, { "orientation": "orientation"; "appendOnly": "appendOnly"; }, { "scrolledIndexChange": "scrolledIndexChange"; }, never, ["*"], false>;
348
397
  }
349
398
 
@@ -464,6 +513,18 @@ declare namespace i4 {
464
513
  }
465
514
  }
466
515
 
516
+ declare namespace i5 {
517
+ export {
518
+ CdkVirtualScrollableWindow
519
+ }
520
+ }
521
+
522
+ declare namespace i6 {
523
+ export {
524
+ CdkVirtualScrollableElement
525
+ }
526
+ }
527
+
467
528
  export declare type _Left = {
468
529
  left?: number;
469
530
  };
@@ -542,7 +603,7 @@ export declare class ScrollDispatcher implements OnDestroy {
542
603
  */
543
604
  export declare class ScrollingModule {
544
605
  static ɵfac: i0.ɵɵFactoryDeclaration<ScrollingModule, never>;
545
- static ɵmod: i0.ɵɵNgModuleDeclaration<ScrollingModule, [typeof i2.CdkFixedSizeVirtualScroll, typeof i3.CdkVirtualForOf, typeof i4.CdkVirtualScrollViewport], [typeof i5.BidiModule, typeof CdkScrollableModule], [typeof i5.BidiModule, typeof CdkScrollableModule, typeof i2.CdkFixedSizeVirtualScroll, typeof i3.CdkVirtualForOf, typeof i4.CdkVirtualScrollViewport]>;
606
+ static ɵmod: i0.ɵɵNgModuleDeclaration<ScrollingModule, [typeof i2.CdkFixedSizeVirtualScroll, typeof i3.CdkVirtualForOf, typeof i4.CdkVirtualScrollViewport, typeof i5.CdkVirtualScrollableWindow, typeof i6.CdkVirtualScrollableElement], [typeof i7.BidiModule, typeof CdkScrollableModule], [typeof i7.BidiModule, typeof CdkScrollableModule, typeof i2.CdkFixedSizeVirtualScroll, typeof i3.CdkVirtualForOf, typeof i4.CdkVirtualScrollViewport, typeof i5.CdkVirtualScrollableWindow, typeof i6.CdkVirtualScrollableElement]>;
546
607
  static ɵinj: i0.ɵɵInjectorDeclaration<ScrollingModule>;
547
608
  }
548
609
 
@@ -609,6 +670,8 @@ export declare interface ViewportScrollPosition {
609
670
  /** The injection token used to specify the virtual scrolling strategy. */
610
671
  export declare const VIRTUAL_SCROLL_STRATEGY: InjectionToken<VirtualScrollStrategy>;
611
672
 
673
+ export declare const VIRTUAL_SCROLLABLE: InjectionToken<CdkVirtualScrollable>;
674
+
612
675
  /** A strategy that dictates which items should be rendered in the viewport. */
613
676
  export declare interface VirtualScrollStrategy {
614
677
  /** Emits when the index of the first element visible in the viewport changes. */