@angular/cdk 19.2.1 → 19.2.3

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.
Files changed (85) hide show
  1. package/a11y/index.d.ts +926 -999
  2. package/accordion/index.d.ts +8 -27
  3. package/bidi/index.d.ts +38 -48
  4. package/clipboard/index.d.ts +61 -75
  5. package/coercion/index.d.ts +22 -32
  6. package/coercion/private/index.d.ts +2 -2
  7. package/collections/index.d.ts +139 -158
  8. package/dialog/index.d.ts +210 -246
  9. package/drag-drop/index.d.ts +1084 -1160
  10. package/fesm2022/a11y.mjs +62 -54
  11. package/fesm2022/a11y.mjs.map +1 -1
  12. package/fesm2022/accordion.mjs +10 -14
  13. package/fesm2022/accordion.mjs.map +1 -1
  14. package/fesm2022/bidi.mjs +15 -15
  15. package/fesm2022/bidi.mjs.map +1 -1
  16. package/fesm2022/cdk.mjs +1 -1
  17. package/fesm2022/cdk.mjs.map +1 -1
  18. package/fesm2022/clipboard.mjs +10 -14
  19. package/fesm2022/clipboard.mjs.map +1 -1
  20. package/fesm2022/coercion/private.mjs +0 -4
  21. package/fesm2022/coercion/private.mjs.map +1 -1
  22. package/fesm2022/coercion.mjs.map +1 -1
  23. package/fesm2022/collections.mjs +4 -8
  24. package/fesm2022/collections.mjs.map +1 -1
  25. package/fesm2022/dialog.mjs +10 -14
  26. package/fesm2022/dialog.mjs.map +1 -1
  27. package/fesm2022/drag-drop.mjs +31 -35
  28. package/fesm2022/drag-drop.mjs.map +1 -1
  29. package/fesm2022/keycodes.mjs +0 -4
  30. package/fesm2022/keycodes.mjs.map +1 -1
  31. package/fesm2022/layout.mjs +10 -14
  32. package/fesm2022/layout.mjs.map +1 -1
  33. package/fesm2022/listbox.mjs +10 -14
  34. package/fesm2022/listbox.mjs.map +1 -1
  35. package/fesm2022/menu.mjs +49 -53
  36. package/fesm2022/menu.mjs.map +1 -1
  37. package/fesm2022/observers/private.mjs +3 -7
  38. package/fesm2022/observers/private.mjs.map +1 -1
  39. package/fesm2022/observers.mjs +13 -17
  40. package/fesm2022/observers.mjs.map +1 -1
  41. package/fesm2022/overlay.mjs +54 -50
  42. package/fesm2022/overlay.mjs.map +1 -1
  43. package/fesm2022/platform.mjs +7 -11
  44. package/fesm2022/platform.mjs.map +1 -1
  45. package/fesm2022/portal.mjs +25 -26
  46. package/fesm2022/portal.mjs.map +1 -1
  47. package/fesm2022/private.mjs +6 -10
  48. package/fesm2022/private.mjs.map +1 -1
  49. package/fesm2022/scrolling.mjs +36 -40
  50. package/fesm2022/scrolling.mjs.map +1 -1
  51. package/fesm2022/stepper.mjs +29 -32
  52. package/fesm2022/stepper.mjs.map +1 -1
  53. package/fesm2022/table.mjs +78 -88
  54. package/fesm2022/table.mjs.map +1 -1
  55. package/fesm2022/testing/selenium-webdriver.mjs.map +1 -1
  56. package/fesm2022/testing/testbed.mjs +1 -41
  57. package/fesm2022/testing/testbed.mjs.map +1 -1
  58. package/fesm2022/testing.mjs.map +1 -1
  59. package/fesm2022/text-field.mjs +16 -20
  60. package/fesm2022/text-field.mjs.map +1 -1
  61. package/fesm2022/tree.mjs +25 -29
  62. package/fesm2022/tree.mjs.map +1 -1
  63. package/index.d.ts +2 -2
  64. package/keycodes/index.d.ts +123 -244
  65. package/layout/index.d.ts +23 -25
  66. package/listbox/index.d.ts +90 -107
  67. package/menu/index.d.ts +593 -687
  68. package/observers/index.d.ts +38 -44
  69. package/observers/private/index.d.ts +3 -3
  70. package/overlay/index.d.ts +921 -986
  71. package/package.json +1 -1
  72. package/platform/index.d.ts +50 -62
  73. package/portal/index.d.ts +172 -195
  74. package/private/index.d.ts +3 -3
  75. package/schematics/ng-add/index.js +1 -1
  76. package/schematics/ng-add/index.mjs +1 -1
  77. package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.spec.ts.template +1 -1
  78. package/scrolling/index.d.ts +268 -351
  79. package/stepper/index.d.ts +72 -124
  80. package/table/index.d.ts +336 -449
  81. package/testing/index.d.ts +490 -517
  82. package/testing/selenium-webdriver/index.d.ts +30 -20
  83. package/testing/testbed/index.d.ts +9 -19
  84. package/text-field/index.d.ts +9 -30
  85. package/tree/index.d.ts +204 -271
@@ -1,60 +1,115 @@
1
- import { CollectionViewer } from '@angular/cdk/collections';
2
- import { DataSource } from '@angular/cdk/collections';
3
- import { Directionality } from '@angular/cdk/bidi';
4
- import { DoCheck } from '@angular/core';
5
- import { ElementRef } from '@angular/core';
1
+ import { NumberInput } from '@angular/cdk/coercion';
6
2
  import * as i0 from '@angular/core';
3
+ import { OnDestroy, ElementRef, OnInit, NgZone, InjectionToken, OnChanges, NgIterable, DoCheck, TrackByFunction, TemplateRef } from '@angular/core';
4
+ import { Observable, Subscription, Subject } from 'rxjs';
5
+ import { ListRange, DataSource, CollectionViewer } from '@angular/cdk/collections';
7
6
  import * as i2 from '@angular/cdk/bidi';
8
- import { InjectionToken } from '@angular/core';
9
- import { ListRange } from '@angular/cdk/collections';
10
- import { NgIterable } from '@angular/core';
11
- import { NgZone } from '@angular/core';
12
- import { NumberInput } from '@angular/cdk/coercion';
13
- import { Observable } from 'rxjs';
14
- import { OnChanges } from '@angular/core';
15
- import { OnDestroy } from '@angular/core';
16
- import { OnInit } from '@angular/core';
17
- import { Subject } from 'rxjs';
18
- import { Subscription } from 'rxjs';
19
- import { TemplateRef } from '@angular/core';
20
- import { TrackByFunction } from '@angular/core';
7
+ import { Directionality } from '@angular/cdk/bidi';
21
8
 
22
- export declare type _Bottom = {
23
- bottom?: number;
24
- };
9
+ /**
10
+ * An item to be repeated by the VirtualScrollViewport
11
+ */
12
+ interface CdkVirtualScrollRepeater<T> {
13
+ readonly dataStream: Observable<readonly T[]>;
14
+ measureRangeSize(range: ListRange, orientation: 'horizontal' | 'vertical'): number;
15
+ }
25
16
 
26
- /** A virtual scroll strategy that supports fixed-size items. */
27
- export declare class CdkFixedSizeVirtualScroll implements OnChanges {
28
- /** The size of the items in the list (in pixels). */
29
- get itemSize(): number;
30
- set itemSize(value: NumberInput);
31
- _itemSize: number;
17
+ /** Time in ms to throttle the scrolling events by default. */
18
+ declare const DEFAULT_SCROLL_TIME = 20;
19
+ /**
20
+ * Service contained all registered Scrollable references and emits an event when any one of the
21
+ * Scrollable references emit a scrolled event.
22
+ */
23
+ declare class ScrollDispatcher implements OnDestroy {
24
+ private _ngZone;
25
+ private _platform;
26
+ private _renderer;
27
+ private _cleanupGlobalListener;
28
+ constructor(...args: unknown[]);
29
+ /** Subject for notifying that a registered scrollable reference element has been scrolled. */
30
+ private readonly _scrolled;
31
+ /** Keeps track of the amount of subscriptions to `scrolled`. Used for cleaning up afterwards. */
32
+ private _scrolledCount;
32
33
  /**
33
- * The minimum amount of buffer rendered beyond the viewport (in pixels).
34
- * If the amount of buffer dips below this number, more items will be rendered. Defaults to 100px.
34
+ * Map of all the scrollable references that are registered with the service and their
35
+ * scroll event subscriptions.
35
36
  */
36
- get minBufferPx(): number;
37
- set minBufferPx(value: NumberInput);
38
- _minBufferPx: number;
37
+ scrollContainers: Map<CdkScrollable, Subscription>;
39
38
  /**
40
- * The number of pixels worth of buffer to render for when rendering new items. Defaults to 200px.
39
+ * Registers a scrollable instance with the service and listens for its scrolled events. When the
40
+ * scrollable is scrolled, the service emits the event to its scrolled observable.
41
+ * @param scrollable Scrollable instance to be registered.
41
42
  */
42
- get maxBufferPx(): number;
43
- set maxBufferPx(value: NumberInput);
44
- _maxBufferPx: number;
45
- /** The scroll strategy used by this directive. */
46
- _scrollStrategy: FixedSizeVirtualScrollStrategy;
47
- ngOnChanges(): void;
48
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkFixedSizeVirtualScroll, never>;
49
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkFixedSizeVirtualScroll, "cdk-virtual-scroll-viewport[itemSize]", never, { "itemSize": { "alias": "itemSize"; "required": false; }; "minBufferPx": { "alias": "minBufferPx"; "required": false; }; "maxBufferPx": { "alias": "maxBufferPx"; "required": false; }; }, {}, never, never, true, never>;
43
+ register(scrollable: CdkScrollable): void;
44
+ /**
45
+ * De-registers a Scrollable reference and unsubscribes from its scroll event observable.
46
+ * @param scrollable Scrollable instance to be deregistered.
47
+ */
48
+ deregister(scrollable: CdkScrollable): void;
49
+ /**
50
+ * Returns an observable that emits an event whenever any of the registered Scrollable
51
+ * references (or window, document, or body) fire a scrolled event. Can provide a time in ms
52
+ * to override the default "throttle" time.
53
+ *
54
+ * **Note:** in order to avoid hitting change detection for every scroll event,
55
+ * all of the events emitted from this stream will be run outside the Angular zone.
56
+ * If you need to update any data bindings as a result of a scroll event, you have
57
+ * to run the callback using `NgZone.run`.
58
+ */
59
+ scrolled(auditTimeInMs?: number): Observable<CdkScrollable | void>;
60
+ ngOnDestroy(): void;
61
+ /**
62
+ * Returns an observable that emits whenever any of the
63
+ * scrollable ancestors of an element are scrolled.
64
+ * @param elementOrElementRef Element whose ancestors to listen for.
65
+ * @param auditTimeInMs Time to throttle the scroll events.
66
+ */
67
+ ancestorScrolled(elementOrElementRef: ElementRef | HTMLElement, auditTimeInMs?: number): Observable<CdkScrollable | void>;
68
+ /** Returns all registered Scrollables that contain the provided element. */
69
+ getAncestorScrollContainers(elementOrElementRef: ElementRef | HTMLElement): CdkScrollable[];
70
+ /** Returns true if the element is contained within the provided Scrollable. */
71
+ private _scrollableContainsElement;
72
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScrollDispatcher, never>;
73
+ static ɵprov: i0.ɵɵInjectableDeclaration<ScrollDispatcher>;
50
74
  }
51
75
 
76
+ type _Without<T> = {
77
+ [P in keyof T]?: never;
78
+ };
79
+ type _XOR<T, U> = (_Without<T> & U) | (_Without<U> & T);
80
+ type _Top = {
81
+ top?: number;
82
+ };
83
+ type _Bottom = {
84
+ bottom?: number;
85
+ };
86
+ type _Left = {
87
+ left?: number;
88
+ };
89
+ type _Right = {
90
+ right?: number;
91
+ };
92
+ type _Start = {
93
+ start?: number;
94
+ };
95
+ type _End = {
96
+ end?: number;
97
+ };
98
+ type _XAxis = _XOR<_XOR<_Left, _Right>, _XOR<_Start, _End>>;
99
+ type _YAxis = _XOR<_Top, _Bottom>;
100
+ /**
101
+ * An extended version of ScrollToOptions that allows expressing scroll offsets relative to the
102
+ * top, bottom, left, right, start, or end of the viewport rather than just the top and left.
103
+ * Please note: the top and bottom properties are mutually exclusive, as are the left, right,
104
+ * start, and end properties.
105
+ */
106
+ type ExtendedScrollToOptions = _XAxis & _YAxis & ScrollOptions;
52
107
  /**
53
108
  * Sends an event when the directive's element is scrolled. Registers itself with the
54
109
  * ScrollDispatcher service to include itself as part of its collection of scrolling events that it
55
110
  * can be listened to through the service.
56
111
  */
57
- export declare class CdkScrollable implements OnInit, OnDestroy {
112
+ declare class CdkScrollable implements OnInit, OnDestroy {
58
113
  protected elementRef: ElementRef<HTMLElement>;
59
114
  protected scrollDispatcher: ScrollDispatcher;
60
115
  protected ngZone: NgZone;
@@ -95,107 +150,11 @@ export declare class CdkScrollable implements OnInit, OnDestroy {
95
150
  static ɵdir: i0.ɵɵDirectiveDeclaration<CdkScrollable, "[cdk-scrollable], [cdkScrollable]", never, {}, {}, never, never, true, never>;
96
151
  }
97
152
 
98
- export declare class CdkScrollableModule {
99
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkScrollableModule, never>;
100
- static ɵmod: i0.ɵɵNgModuleDeclaration<CdkScrollableModule, never, [typeof i1.CdkScrollable], [typeof i1.CdkScrollable]>;
101
- static ɵinj: i0.ɵɵInjectorDeclaration<CdkScrollableModule>;
102
- }
103
-
104
- /**
105
- * A directive similar to `ngForOf` to be used for rendering data inside a virtual scrolling
106
- * container.
107
- */
108
- export declare class CdkVirtualForOf<T> implements CdkVirtualScrollRepeater<T>, CollectionViewer, DoCheck, OnDestroy {
109
- private _viewContainerRef;
110
- private _template;
111
- private _differs;
112
- private _viewRepeater;
113
- private _viewport;
114
- /** Emits when the rendered view of the data changes. */
115
- readonly viewChange: Subject<ListRange>;
116
- /** Subject that emits when a new DataSource instance is given. */
117
- private readonly _dataSourceChanges;
118
- /** The DataSource to display. */
119
- get cdkVirtualForOf(): DataSource<T> | Observable<T[]> | NgIterable<T> | null | undefined;
120
- set cdkVirtualForOf(value: DataSource<T> | Observable<T[]> | NgIterable<T> | null | undefined);
121
- _cdkVirtualForOf: DataSource<T> | Observable<T[]> | NgIterable<T> | null | undefined;
122
- /**
123
- * The `TrackByFunction` to use for tracking changes. The `TrackByFunction` takes the index and
124
- * the item and produces a value to be used as the item's identity when tracking changes.
125
- */
126
- get cdkVirtualForTrackBy(): TrackByFunction<T> | undefined;
127
- set cdkVirtualForTrackBy(fn: TrackByFunction<T> | undefined);
128
- private _cdkVirtualForTrackBy;
129
- /** The template used to stamp out new elements. */
130
- set cdkVirtualForTemplate(value: TemplateRef<CdkVirtualForOfContext<T>>);
131
- /**
132
- * The size of the cache used to store templates that are not being used for re-use later.
133
- * Setting the cache size to `0` will disable caching. Defaults to 20 templates.
134
- */
135
- get cdkVirtualForTemplateCacheSize(): number;
136
- set cdkVirtualForTemplateCacheSize(size: NumberInput);
137
- /** Emits whenever the data in the current DataSource changes. */
138
- readonly dataStream: Observable<readonly T[]>;
139
- /** The differ used to calculate changes to the data. */
140
- private _differ;
141
- /** The most recent data emitted from the DataSource. */
142
- private _data;
143
- /** The currently rendered items. */
144
- private _renderedItems;
145
- /** The currently rendered range of indices. */
146
- private _renderedRange;
147
- /** Whether the rendered data should be updated during the next ngDoCheck cycle. */
148
- private _needsUpdate;
149
- private readonly _destroyed;
150
- constructor(...args: unknown[]);
151
- /**
152
- * Measures the combined size (width for horizontal orientation, height for vertical) of all items
153
- * in the specified range. Throws an error if the range includes items that are not currently
154
- * rendered.
155
- */
156
- measureRangeSize(range: ListRange, orientation: 'horizontal' | 'vertical'): number;
157
- ngDoCheck(): void;
158
- ngOnDestroy(): void;
159
- /** React to scroll state changes in the viewport. */
160
- private _onRenderedDataChange;
161
- /** Swap out one `DataSource` for another. */
162
- private _changeDataSource;
163
- /** Update the `CdkVirtualForOfContext` for all views. */
164
- private _updateContext;
165
- /** Apply changes to the DOM. */
166
- private _applyChanges;
167
- /** Update the computed properties on the `CdkVirtualForOfContext`. */
168
- private _updateComputedContextProperties;
169
- private _getEmbeddedViewArgs;
170
- static ngTemplateContextGuard<T>(directive: CdkVirtualForOf<T>, context: unknown): context is CdkVirtualForOfContext<T>;
171
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkVirtualForOf<any>, never>;
172
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkVirtualForOf<any>, "[cdkVirtualFor][cdkVirtualForOf]", never, { "cdkVirtualForOf": { "alias": "cdkVirtualForOf"; "required": false; }; "cdkVirtualForTrackBy": { "alias": "cdkVirtualForTrackBy"; "required": false; }; "cdkVirtualForTemplate": { "alias": "cdkVirtualForTemplate"; "required": false; }; "cdkVirtualForTemplateCacheSize": { "alias": "cdkVirtualForTemplateCacheSize"; "required": false; }; }, {}, never, never, true, never>;
173
- }
174
-
175
- /** The context for an item rendered by `CdkVirtualForOf` */
176
- export declare type CdkVirtualForOfContext<T> = {
177
- /** The item value. */
178
- $implicit: T;
179
- /** The DataSource, Observable, or NgIterable that was passed to *cdkVirtualFor. */
180
- cdkVirtualForOf: DataSource<T> | Observable<T[]> | NgIterable<T>;
181
- /** The index of the item in the DataSource. */
182
- index: number;
183
- /** The number of items in the DataSource. */
184
- count: number;
185
- /** Whether this is the first item in the DataSource. */
186
- first: boolean;
187
- /** Whether this is the last item in the DataSource. */
188
- last: boolean;
189
- /** Whether the index is even. */
190
- even: boolean;
191
- /** Whether the index is odd. */
192
- odd: boolean;
193
- };
194
-
153
+ declare const VIRTUAL_SCROLLABLE: InjectionToken<CdkVirtualScrollable>;
195
154
  /**
196
155
  * Extending the {@link CdkScrollable} to be used as scrolling container for virtual scrolling.
197
156
  */
198
- export declare abstract class CdkVirtualScrollable extends CdkScrollable {
157
+ declare abstract class CdkVirtualScrollable extends CdkScrollable {
199
158
  constructor(...args: unknown[]);
200
159
  /**
201
160
  * Measure the viewport size for the provided orientation.
@@ -213,36 +172,8 @@ export declare abstract class CdkVirtualScrollable extends CdkScrollable {
213
172
  static ɵdir: i0.ɵɵDirectiveDeclaration<CdkVirtualScrollable, never, never, {}, {}, never, never, true, never>;
214
173
  }
215
174
 
216
- /**
217
- * Provides a virtual scrollable for the element it is attached to.
218
- */
219
- export declare class CdkVirtualScrollableElement extends CdkVirtualScrollable {
220
- constructor(...args: unknown[]);
221
- measureBoundingClientRectWithScrollOffset(from: 'left' | 'top' | 'right' | 'bottom'): number;
222
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkVirtualScrollableElement, never>;
223
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkVirtualScrollableElement, "[cdkVirtualScrollingElement]", never, {}, {}, never, never, true, never>;
224
- }
225
-
226
- /**
227
- * Provides as virtual scrollable for the global / window scrollbar.
228
- */
229
- export declare class CdkVirtualScrollableWindow extends CdkVirtualScrollable {
230
- constructor(...args: unknown[]);
231
- measureBoundingClientRectWithScrollOffset(from: 'left' | 'top' | 'right' | 'bottom'): number;
232
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkVirtualScrollableWindow, never>;
233
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkVirtualScrollableWindow, "cdk-virtual-scroll-viewport[scrollWindow]", never, {}, {}, never, never, true, never>;
234
- }
235
-
236
- /**
237
- * An item to be repeated by the VirtualScrollViewport
238
- */
239
- export declare interface CdkVirtualScrollRepeater<T> {
240
- readonly dataStream: Observable<readonly T[]>;
241
- measureRangeSize(range: ListRange, orientation: 'horizontal' | 'vertical'): number;
242
- }
243
-
244
175
  /** A viewport that virtualizes its scrolling with the help of `CdkVirtualForOf`. */
245
- export declare class CdkVirtualScrollViewport extends CdkVirtualScrollable implements OnInit, OnDestroy {
176
+ declare class CdkVirtualScrollViewport extends CdkVirtualScrollable implements OnInit, OnDestroy {
246
177
  elementRef: ElementRef<HTMLElement>;
247
178
  private _changeDetectorRef;
248
179
  private _scrollStrategy;
@@ -380,26 +311,37 @@ export declare class CdkVirtualScrollViewport extends CdkVirtualScrollable imple
380
311
  static ngAcceptInputType_appendOnly: unknown;
381
312
  }
382
313
 
383
- /** Time in ms to throttle the resize events by default. */
384
- export declare const DEFAULT_RESIZE_TIME = 20;
385
-
386
- /** Time in ms to throttle the scrolling events by default. */
387
- export declare const DEFAULT_SCROLL_TIME = 20;
388
-
389
- export declare type _End = {
390
- end?: number;
391
- };
392
-
393
- /**
394
- * An extended version of ScrollToOptions that allows expressing scroll offsets relative to the
395
- * top, bottom, left, right, start, or end of the viewport rather than just the top and left.
396
- * Please note: the top and bottom properties are mutually exclusive, as are the left, right,
397
- * start, and end properties.
398
- */
399
- export declare type ExtendedScrollToOptions = _XAxis & _YAxis & ScrollOptions;
314
+ /** The injection token used to specify the virtual scrolling strategy. */
315
+ declare const VIRTUAL_SCROLL_STRATEGY: InjectionToken<VirtualScrollStrategy>;
316
+ /** A strategy that dictates which items should be rendered in the viewport. */
317
+ interface VirtualScrollStrategy {
318
+ /** Emits when the index of the first element visible in the viewport changes. */
319
+ scrolledIndexChange: Observable<number>;
320
+ /**
321
+ * Attaches this scroll strategy to a viewport.
322
+ * @param viewport The viewport to attach this strategy to.
323
+ */
324
+ attach(viewport: CdkVirtualScrollViewport): void;
325
+ /** Detaches this scroll strategy from the currently attached viewport. */
326
+ detach(): void;
327
+ /** Called when the viewport is scrolled (debounced using requestAnimationFrame). */
328
+ onContentScrolled(): void;
329
+ /** Called when the length of the data changes. */
330
+ onDataLengthChanged(): void;
331
+ /** Called when the range of items rendered in the DOM has changed. */
332
+ onContentRendered(): void;
333
+ /** Called when the offset of the rendered items changed. */
334
+ onRenderedOffsetChanged(): void;
335
+ /**
336
+ * Scroll to the offset for the given index.
337
+ * @param index The index of the element to scroll to.
338
+ * @param behavior The ScrollBehavior to use when scrolling.
339
+ */
340
+ scrollToIndex(index: number, behavior: ScrollBehavior): void;
341
+ }
400
342
 
401
343
  /** Virtual scrolling strategy for lists with items of known fixed size. */
402
- export declare class FixedSizeVirtualScrollStrategy implements VirtualScrollStrategy {
344
+ declare class FixedSizeVirtualScrollStrategy implements VirtualScrollStrategy {
403
345
  private readonly _scrolledIndexChange;
404
346
  /** @docs-private Implemented as part of VirtualScrollStrategy. */
405
347
  scrolledIndexChange: Observable<number>;
@@ -450,152 +392,175 @@ export declare class FixedSizeVirtualScrollStrategy implements VirtualScrollStra
450
392
  /** Update the viewport's rendered range. */
451
393
  private _updateRenderedRange;
452
394
  }
453
-
454
395
  /**
455
396
  * Provider factory for `FixedSizeVirtualScrollStrategy` that simply extracts the already created
456
397
  * `FixedSizeVirtualScrollStrategy` from the given directive.
457
398
  * @param fixedSizeDir The instance of `CdkFixedSizeVirtualScroll` to extract the
458
399
  * `FixedSizeVirtualScrollStrategy` from.
459
400
  */
460
- export declare function _fixedSizeVirtualScrollStrategyFactory(fixedSizeDir: CdkFixedSizeVirtualScroll): FixedSizeVirtualScrollStrategy;
461
-
462
- declare namespace i1 {
463
- export {
464
- _Without,
465
- _XOR,
466
- _Top,
467
- _Bottom,
468
- _Left,
469
- _Right,
470
- _Start,
471
- _End,
472
- _XAxis,
473
- _YAxis,
474
- ExtendedScrollToOptions,
475
- CdkScrollable
476
- }
477
- }
478
-
479
- declare namespace i3 {
480
- export {
481
- CdkVirtualScrollViewport
482
- }
483
- }
484
-
485
- declare namespace i4 {
486
- export {
487
- _fixedSizeVirtualScrollStrategyFactory,
488
- FixedSizeVirtualScrollStrategy,
489
- CdkFixedSizeVirtualScroll
490
- }
491
- }
492
-
493
- declare namespace i5 {
494
- export {
495
- CdkVirtualForOfContext,
496
- CdkVirtualForOf
497
- }
498
- }
499
-
500
- declare namespace i6 {
501
- export {
502
- CdkVirtualScrollableWindow
503
- }
504
- }
505
-
506
- declare namespace i7 {
507
- export {
508
- CdkVirtualScrollableElement
509
- }
401
+ declare function _fixedSizeVirtualScrollStrategyFactory(fixedSizeDir: CdkFixedSizeVirtualScroll): FixedSizeVirtualScrollStrategy;
402
+ /** A virtual scroll strategy that supports fixed-size items. */
403
+ declare class CdkFixedSizeVirtualScroll implements OnChanges {
404
+ /** The size of the items in the list (in pixels). */
405
+ get itemSize(): number;
406
+ set itemSize(value: NumberInput);
407
+ _itemSize: number;
408
+ /**
409
+ * The minimum amount of buffer rendered beyond the viewport (in pixels).
410
+ * If the amount of buffer dips below this number, more items will be rendered. Defaults to 100px.
411
+ */
412
+ get minBufferPx(): number;
413
+ set minBufferPx(value: NumberInput);
414
+ _minBufferPx: number;
415
+ /**
416
+ * The number of pixels worth of buffer to render for when rendering new items. Defaults to 200px.
417
+ */
418
+ get maxBufferPx(): number;
419
+ set maxBufferPx(value: NumberInput);
420
+ _maxBufferPx: number;
421
+ /** The scroll strategy used by this directive. */
422
+ _scrollStrategy: FixedSizeVirtualScrollStrategy;
423
+ ngOnChanges(): void;
424
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkFixedSizeVirtualScroll, never>;
425
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkFixedSizeVirtualScroll, "cdk-virtual-scroll-viewport[itemSize]", never, { "itemSize": { "alias": "itemSize"; "required": false; }; "minBufferPx": { "alias": "minBufferPx"; "required": false; }; "maxBufferPx": { "alias": "maxBufferPx"; "required": false; }; }, {}, never, never, true, never>;
510
426
  }
511
427
 
512
- export declare type _Left = {
513
- left?: number;
514
- };
515
-
516
- export declare type _Right = {
517
- right?: number;
428
+ /** The context for an item rendered by `CdkVirtualForOf` */
429
+ type CdkVirtualForOfContext<T> = {
430
+ /** The item value. */
431
+ $implicit: T;
432
+ /** The DataSource, Observable, or NgIterable that was passed to *cdkVirtualFor. */
433
+ cdkVirtualForOf: DataSource<T> | Observable<T[]> | NgIterable<T>;
434
+ /** The index of the item in the DataSource. */
435
+ index: number;
436
+ /** The number of items in the DataSource. */
437
+ count: number;
438
+ /** Whether this is the first item in the DataSource. */
439
+ first: boolean;
440
+ /** Whether this is the last item in the DataSource. */
441
+ last: boolean;
442
+ /** Whether the index is even. */
443
+ even: boolean;
444
+ /** Whether the index is odd. */
445
+ odd: boolean;
518
446
  };
519
-
520
447
  /**
521
- * Service contained all registered Scrollable references and emits an event when any one of the
522
- * Scrollable references emit a scrolled event.
448
+ * A directive similar to `ngForOf` to be used for rendering data inside a virtual scrolling
449
+ * container.
523
450
  */
524
- export declare class ScrollDispatcher implements OnDestroy {
525
- private _ngZone;
526
- private _platform;
527
- private _renderer;
528
- private _cleanupGlobalListener;
529
- constructor(...args: unknown[]);
530
- /** Subject for notifying that a registered scrollable reference element has been scrolled. */
531
- private readonly _scrolled;
532
- /** Keeps track of the amount of subscriptions to `scrolled`. Used for cleaning up afterwards. */
533
- private _scrolledCount;
534
- /**
535
- * Map of all the scrollable references that are registered with the service and their
536
- * scroll event subscriptions.
537
- */
538
- scrollContainers: Map<CdkScrollable, Subscription>;
451
+ declare class CdkVirtualForOf<T> implements CdkVirtualScrollRepeater<T>, CollectionViewer, DoCheck, OnDestroy {
452
+ private _viewContainerRef;
453
+ private _template;
454
+ private _differs;
455
+ private _viewRepeater;
456
+ private _viewport;
457
+ /** Emits when the rendered view of the data changes. */
458
+ readonly viewChange: Subject<ListRange>;
459
+ /** Subject that emits when a new DataSource instance is given. */
460
+ private readonly _dataSourceChanges;
461
+ /** The DataSource to display. */
462
+ get cdkVirtualForOf(): DataSource<T> | Observable<T[]> | NgIterable<T> | null | undefined;
463
+ set cdkVirtualForOf(value: DataSource<T> | Observable<T[]> | NgIterable<T> | null | undefined);
464
+ _cdkVirtualForOf: DataSource<T> | Observable<T[]> | NgIterable<T> | null | undefined;
539
465
  /**
540
- * Registers a scrollable instance with the service and listens for its scrolled events. When the
541
- * scrollable is scrolled, the service emits the event to its scrolled observable.
542
- * @param scrollable Scrollable instance to be registered.
466
+ * The `TrackByFunction` to use for tracking changes. The `TrackByFunction` takes the index and
467
+ * the item and produces a value to be used as the item's identity when tracking changes.
543
468
  */
544
- register(scrollable: CdkScrollable): void;
469
+ get cdkVirtualForTrackBy(): TrackByFunction<T> | undefined;
470
+ set cdkVirtualForTrackBy(fn: TrackByFunction<T> | undefined);
471
+ private _cdkVirtualForTrackBy;
472
+ /** The template used to stamp out new elements. */
473
+ set cdkVirtualForTemplate(value: TemplateRef<CdkVirtualForOfContext<T>>);
545
474
  /**
546
- * De-registers a Scrollable reference and unsubscribes from its scroll event observable.
547
- * @param scrollable Scrollable instance to be deregistered.
475
+ * The size of the cache used to store templates that are not being used for re-use later.
476
+ * Setting the cache size to `0` will disable caching. Defaults to 20 templates.
548
477
  */
549
- deregister(scrollable: CdkScrollable): void;
478
+ get cdkVirtualForTemplateCacheSize(): number;
479
+ set cdkVirtualForTemplateCacheSize(size: NumberInput);
480
+ /** Emits whenever the data in the current DataSource changes. */
481
+ readonly dataStream: Observable<readonly T[]>;
482
+ /** The differ used to calculate changes to the data. */
483
+ private _differ;
484
+ /** The most recent data emitted from the DataSource. */
485
+ private _data;
486
+ /** The currently rendered items. */
487
+ private _renderedItems;
488
+ /** The currently rendered range of indices. */
489
+ private _renderedRange;
490
+ /** Whether the rendered data should be updated during the next ngDoCheck cycle. */
491
+ private _needsUpdate;
492
+ private readonly _destroyed;
493
+ constructor(...args: unknown[]);
550
494
  /**
551
- * Returns an observable that emits an event whenever any of the registered Scrollable
552
- * references (or window, document, or body) fire a scrolled event. Can provide a time in ms
553
- * to override the default "throttle" time.
554
- *
555
- * **Note:** in order to avoid hitting change detection for every scroll event,
556
- * all of the events emitted from this stream will be run outside the Angular zone.
557
- * If you need to update any data bindings as a result of a scroll event, you have
558
- * to run the callback using `NgZone.run`.
495
+ * Measures the combined size (width for horizontal orientation, height for vertical) of all items
496
+ * in the specified range. Throws an error if the range includes items that are not currently
497
+ * rendered.
559
498
  */
560
- scrolled(auditTimeInMs?: number): Observable<CdkScrollable | void>;
499
+ measureRangeSize(range: ListRange, orientation: 'horizontal' | 'vertical'): number;
500
+ ngDoCheck(): void;
561
501
  ngOnDestroy(): void;
562
- /**
563
- * Returns an observable that emits whenever any of the
564
- * scrollable ancestors of an element are scrolled.
565
- * @param elementOrElementRef Element whose ancestors to listen for.
566
- * @param auditTimeInMs Time to throttle the scroll events.
567
- */
568
- ancestorScrolled(elementOrElementRef: ElementRef | HTMLElement, auditTimeInMs?: number): Observable<CdkScrollable | void>;
569
- /** Returns all registered Scrollables that contain the provided element. */
570
- getAncestorScrollContainers(elementOrElementRef: ElementRef | HTMLElement): CdkScrollable[];
571
- /** Returns true if the element is contained within the provided Scrollable. */
572
- private _scrollableContainsElement;
573
- static ɵfac: i0.ɵɵFactoryDeclaration<ScrollDispatcher, never>;
574
- static ɵprov: i0.ɵɵInjectableDeclaration<ScrollDispatcher>;
502
+ /** React to scroll state changes in the viewport. */
503
+ private _onRenderedDataChange;
504
+ /** Swap out one `DataSource` for another. */
505
+ private _changeDataSource;
506
+ /** Update the `CdkVirtualForOfContext` for all views. */
507
+ private _updateContext;
508
+ /** Apply changes to the DOM. */
509
+ private _applyChanges;
510
+ /** Update the computed properties on the `CdkVirtualForOfContext`. */
511
+ private _updateComputedContextProperties;
512
+ private _getEmbeddedViewArgs;
513
+ static ngTemplateContextGuard<T>(directive: CdkVirtualForOf<T>, context: unknown): context is CdkVirtualForOfContext<T>;
514
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkVirtualForOf<any>, never>;
515
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkVirtualForOf<any>, "[cdkVirtualFor][cdkVirtualForOf]", never, { "cdkVirtualForOf": { "alias": "cdkVirtualForOf"; "required": false; }; "cdkVirtualForTrackBy": { "alias": "cdkVirtualForTrackBy"; "required": false; }; "cdkVirtualForTemplate": { "alias": "cdkVirtualForTemplate"; "required": false; }; "cdkVirtualForTemplateCacheSize": { "alias": "cdkVirtualForTemplateCacheSize"; "required": false; }; }, {}, never, never, true, never>;
575
516
  }
576
517
 
518
+ /**
519
+ * Provides as virtual scrollable for the global / window scrollbar.
520
+ */
521
+ declare class CdkVirtualScrollableWindow extends CdkVirtualScrollable {
522
+ constructor(...args: unknown[]);
523
+ measureBoundingClientRectWithScrollOffset(from: 'left' | 'top' | 'right' | 'bottom'): number;
524
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkVirtualScrollableWindow, never>;
525
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkVirtualScrollableWindow, "cdk-virtual-scroll-viewport[scrollWindow]", never, {}, {}, never, never, true, never>;
526
+ }
527
+
528
+ /**
529
+ * Provides a virtual scrollable for the element it is attached to.
530
+ */
531
+ declare class CdkVirtualScrollableElement extends CdkVirtualScrollable {
532
+ constructor(...args: unknown[]);
533
+ measureBoundingClientRectWithScrollOffset(from: 'left' | 'top' | 'right' | 'bottom'): number;
534
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkVirtualScrollableElement, never>;
535
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkVirtualScrollableElement, "[cdkVirtualScrollingElement]", never, {}, {}, never, never, true, never>;
536
+ }
537
+
538
+ declare class CdkScrollableModule {
539
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkScrollableModule, never>;
540
+ static ɵmod: i0.ɵɵNgModuleDeclaration<CdkScrollableModule, never, [typeof CdkScrollable], [typeof CdkScrollable]>;
541
+ static ɵinj: i0.ɵɵInjectorDeclaration<CdkScrollableModule>;
542
+ }
577
543
  /**
578
544
  * @docs-primary-export
579
545
  */
580
- export declare class ScrollingModule {
546
+ declare class ScrollingModule {
581
547
  static ɵfac: i0.ɵɵFactoryDeclaration<ScrollingModule, never>;
582
- static ɵmod: i0.ɵɵNgModuleDeclaration<ScrollingModule, never, [typeof i2.BidiModule, typeof CdkScrollableModule, typeof i3.CdkVirtualScrollViewport, typeof i4.CdkFixedSizeVirtualScroll, typeof i5.CdkVirtualForOf, typeof i6.CdkVirtualScrollableWindow, typeof i7.CdkVirtualScrollableElement], [typeof i2.BidiModule, typeof CdkScrollableModule, typeof i4.CdkFixedSizeVirtualScroll, typeof i5.CdkVirtualForOf, typeof i3.CdkVirtualScrollViewport, typeof i6.CdkVirtualScrollableWindow, typeof i7.CdkVirtualScrollableElement]>;
548
+ static ɵmod: i0.ɵɵNgModuleDeclaration<ScrollingModule, never, [typeof i2.BidiModule, typeof CdkScrollableModule, typeof CdkVirtualScrollViewport, typeof CdkFixedSizeVirtualScroll, typeof CdkVirtualForOf, typeof CdkVirtualScrollableWindow, typeof CdkVirtualScrollableElement], [typeof i2.BidiModule, typeof CdkScrollableModule, typeof CdkFixedSizeVirtualScroll, typeof CdkVirtualForOf, typeof CdkVirtualScrollViewport, typeof CdkVirtualScrollableWindow, typeof CdkVirtualScrollableElement]>;
583
549
  static ɵinj: i0.ɵɵInjectorDeclaration<ScrollingModule>;
584
550
  }
585
551
 
586
- export declare type _Start = {
587
- start?: number;
588
- };
589
-
590
- export declare type _Top = {
591
- top?: number;
592
- };
593
-
552
+ /** Time in ms to throttle the resize events by default. */
553
+ declare const DEFAULT_RESIZE_TIME = 20;
554
+ /** Object that holds the scroll position of the viewport in each direction. */
555
+ interface ViewportScrollPosition {
556
+ top: number;
557
+ left: number;
558
+ }
594
559
  /**
595
560
  * Simple utility for getting the bounds of the browser viewport.
596
561
  * @docs-private
597
562
  */
598
- export declare class ViewportRuler implements OnDestroy {
563
+ declare class ViewportRuler implements OnDestroy {
599
564
  private _platform;
600
565
  private _listeners;
601
566
  /** Cached viewport dimensions. */
@@ -636,52 +601,4 @@ export declare class ViewportRuler implements OnDestroy {
636
601
  static ɵprov: i0.ɵɵInjectableDeclaration<ViewportRuler>;
637
602
  }
638
603
 
639
- /** Object that holds the scroll position of the viewport in each direction. */
640
- export declare interface ViewportScrollPosition {
641
- top: number;
642
- left: number;
643
- }
644
-
645
- /** The injection token used to specify the virtual scrolling strategy. */
646
- export declare const VIRTUAL_SCROLL_STRATEGY: InjectionToken<VirtualScrollStrategy>;
647
-
648
- export declare const VIRTUAL_SCROLLABLE: InjectionToken<CdkVirtualScrollable>;
649
-
650
- /** A strategy that dictates which items should be rendered in the viewport. */
651
- export declare interface VirtualScrollStrategy {
652
- /** Emits when the index of the first element visible in the viewport changes. */
653
- scrolledIndexChange: Observable<number>;
654
- /**
655
- * Attaches this scroll strategy to a viewport.
656
- * @param viewport The viewport to attach this strategy to.
657
- */
658
- attach(viewport: CdkVirtualScrollViewport): void;
659
- /** Detaches this scroll strategy from the currently attached viewport. */
660
- detach(): void;
661
- /** Called when the viewport is scrolled (debounced using requestAnimationFrame). */
662
- onContentScrolled(): void;
663
- /** Called when the length of the data changes. */
664
- onDataLengthChanged(): void;
665
- /** Called when the range of items rendered in the DOM has changed. */
666
- onContentRendered(): void;
667
- /** Called when the offset of the rendered items changed. */
668
- onRenderedOffsetChanged(): void;
669
- /**
670
- * Scroll to the offset for the given index.
671
- * @param index The index of the element to scroll to.
672
- * @param behavior The ScrollBehavior to use when scrolling.
673
- */
674
- scrollToIndex(index: number, behavior: ScrollBehavior): void;
675
- }
676
-
677
- export declare type _Without<T> = {
678
- [P in keyof T]?: never;
679
- };
680
-
681
- export declare type _XAxis = _XOR<_XOR<_Left, _Right>, _XOR<_Start, _End>>;
682
-
683
- export declare type _XOR<T, U> = (_Without<T> & U) | (_Without<U> & T);
684
-
685
- export declare type _YAxis = _XOR<_Top, _Bottom>;
686
-
687
- export { }
604
+ export { CdkFixedSizeVirtualScroll, CdkScrollable, CdkScrollableModule, CdkVirtualForOf, type CdkVirtualForOfContext, type CdkVirtualScrollRepeater, CdkVirtualScrollViewport, CdkVirtualScrollable, CdkVirtualScrollableElement, CdkVirtualScrollableWindow, DEFAULT_RESIZE_TIME, DEFAULT_SCROLL_TIME, type ExtendedScrollToOptions, FixedSizeVirtualScrollStrategy, ScrollDispatcher, ScrollingModule, VIRTUAL_SCROLLABLE, VIRTUAL_SCROLL_STRATEGY, ViewportRuler, type ViewportScrollPosition, type VirtualScrollStrategy, type _Bottom, type _End, type _Left, type _Right, type _Start, type _Top, type _Without, type _XAxis, type _XOR, type _YAxis, _fixedSizeVirtualScrollStrategyFactory };