Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(cdk/scrolling): switch directives to standalone #26236

Merged
merged 1 commit into from Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/cdk/scrolling/fixed-size-virtual-scroll.ts
Expand Up @@ -192,6 +192,7 @@ export function _fixedSizeVirtualScrollStrategyFactory(fixedSizeDir: CdkFixedSiz
/** A virtual scroll strategy that supports fixed-size items. */
@Directive({
selector: 'cdk-virtual-scroll-viewport[itemSize]',
standalone: true,
providers: [
{
provide: VIRTUAL_SCROLL_STRATEGY,
Expand Down
1 change: 1 addition & 0 deletions src/cdk/scrolling/scrollable.ts
Expand Up @@ -43,6 +43,7 @@ export type ExtendedScrollToOptions = _XAxis & _YAxis & ScrollOptions;
*/
@Directive({
selector: '[cdk-scrollable], [cdkScrollable]',
standalone: true,
})
export class CdkScrollable implements OnInit, OnDestroy {
protected readonly _destroyed = new Subject<void>();
Expand Down
11 changes: 6 additions & 5 deletions src/cdk/scrolling/scrolling-module.ts
Expand Up @@ -17,25 +17,26 @@ import {CdkVirtualScrollableWindow} from './virtual-scrollable-window';

@NgModule({
exports: [CdkScrollable],
declarations: [CdkScrollable],
imports: [CdkScrollable],
})
export class CdkScrollableModule {}

/**
* @docs-primary-export
*/
@NgModule({
imports: [BidiModule, CdkScrollableModule],
exports: [
imports: [
BidiModule,
CdkScrollableModule,
CdkVirtualScrollViewport,
CdkFixedSizeVirtualScroll,
CdkVirtualForOf,
CdkVirtualScrollViewport,
CdkVirtualScrollableWindow,
CdkVirtualScrollableElement,
],
declarations: [
exports: [
BidiModule,
CdkScrollableModule,
CdkFixedSizeVirtualScroll,
CdkVirtualForOf,
CdkVirtualScrollViewport,
Expand Down
1 change: 1 addition & 0 deletions src/cdk/scrolling/virtual-for-of.ts
Expand Up @@ -82,6 +82,7 @@ function getOffset(orientation: 'horizontal' | 'vertical', direction: 'start' |
@Directive({
selector: '[cdkVirtualFor][cdkVirtualForOf]',
providers: [{provide: _VIEW_REPEATER_STRATEGY, useClass: _RecycleViewRepeaterStrategy}],
standalone: true,
})
export class CdkVirtualForOf<T>
implements CdkVirtualScrollRepeater<T>, CollectionViewer, DoCheck, OnDestroy
Expand Down
1 change: 1 addition & 0 deletions src/cdk/scrolling/virtual-scroll-viewport.ts
Expand Up @@ -67,6 +67,7 @@ const SCROLL_SCHEDULER =
},
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
providers: [
{
provide: CdkScrollable,
Expand Down
1 change: 1 addition & 0 deletions src/cdk/scrolling/virtual-scrollable-element.ts
Expand Up @@ -17,6 +17,7 @@ import {CdkVirtualScrollable, VIRTUAL_SCROLLABLE} from './virtual-scrollable';
@Directive({
selector: '[cdkVirtualScrollingElement]',
providers: [{provide: VIRTUAL_SCROLLABLE, useExisting: CdkVirtualScrollableElement}],
standalone: true,
host: {
'class': 'cdk-virtual-scrollable',
},
Expand Down
1 change: 1 addition & 0 deletions src/cdk/scrolling/virtual-scrollable-window.ts
Expand Up @@ -19,6 +19,7 @@ import {CdkVirtualScrollable, VIRTUAL_SCROLLABLE} from './virtual-scrollable';
@Directive({
selector: 'cdk-virtual-scroll-viewport[scrollWindow]',
providers: [{provide: VIRTUAL_SCROLLABLE, useExisting: CdkVirtualScrollableWindow}],
standalone: true,
})
export class CdkVirtualScrollableWindow extends CdkVirtualScrollable {
protected override _elementScrolled: Observable<Event> = new Observable(
Expand Down
18 changes: 9 additions & 9 deletions tools/public_api_guard/cdk/scrolling.md
Expand Up @@ -12,7 +12,7 @@ import { Directionality } from '@angular/cdk/bidi';
import { DoCheck } from '@angular/core';
import { ElementRef } from '@angular/core';
import * as i0 from '@angular/core';
import * as i7 from '@angular/cdk/bidi';
import * as i2 from '@angular/cdk/bidi';
import { InjectionToken } from '@angular/core';
import { IterableDiffers } from '@angular/core';
import { ListRange } from '@angular/cdk/collections';
Expand Down Expand Up @@ -54,7 +54,7 @@ export class CdkFixedSizeVirtualScroll implements OnChanges {
ngOnChanges(): void;
_scrollStrategy: FixedSizeVirtualScrollStrategy;
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<CdkFixedSizeVirtualScroll, "cdk-virtual-scroll-viewport[itemSize]", never, { "itemSize": "itemSize"; "minBufferPx": "minBufferPx"; "maxBufferPx": "maxBufferPx"; }, {}, never, never, false, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<CdkFixedSizeVirtualScroll, "cdk-virtual-scroll-viewport[itemSize]", never, { "itemSize": "itemSize"; "minBufferPx": "minBufferPx"; "maxBufferPx": "maxBufferPx"; }, {}, never, never, true, never>;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<CdkFixedSizeVirtualScroll, never>;
}
Expand Down Expand Up @@ -83,7 +83,7 @@ export class CdkScrollable implements OnInit, OnDestroy {
protected scrollDispatcher: ScrollDispatcher;
scrollTo(options: ExtendedScrollToOptions): void;
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<CdkScrollable, "[cdk-scrollable], [cdkScrollable]", never, {}, {}, never, never, false, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<CdkScrollable, "[cdk-scrollable], [cdkScrollable]", never, {}, {}, never, never, true, never>;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<CdkScrollable, [null, null, null, { optional: true; }]>;
}
Expand All @@ -95,7 +95,7 @@ export class CdkScrollableModule {
// (undocumented)
static ɵinj: i0.ɵɵInjectorDeclaration<CdkScrollableModule>;
// (undocumented)
static ɵmod: i0.ɵɵNgModuleDeclaration<CdkScrollableModule, [typeof i1.CdkScrollable], never, [typeof i1.CdkScrollable]>;
static ɵmod: i0.ɵɵNgModuleDeclaration<CdkScrollableModule, never, [typeof i1.CdkScrollable], [typeof i1.CdkScrollable]>;
}

// @public
Expand Down Expand Up @@ -123,7 +123,7 @@ export class CdkVirtualForOf<T> implements CdkVirtualScrollRepeater<T>, Collecti
ngOnDestroy(): void;
readonly viewChange: Subject<ListRange>;
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<CdkVirtualForOf<any>, "[cdkVirtualFor][cdkVirtualForOf]", never, { "cdkVirtualForOf": "cdkVirtualForOf"; "cdkVirtualForTrackBy": "cdkVirtualForTrackBy"; "cdkVirtualForTemplate": "cdkVirtualForTemplate"; "cdkVirtualForTemplateCacheSize": "cdkVirtualForTemplateCacheSize"; }, {}, never, never, false, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<CdkVirtualForOf<any>, "[cdkVirtualFor][cdkVirtualForOf]", never, { "cdkVirtualForOf": "cdkVirtualForOf"; "cdkVirtualForTrackBy": "cdkVirtualForTrackBy"; "cdkVirtualForTemplate": "cdkVirtualForTemplate"; "cdkVirtualForTemplateCacheSize": "cdkVirtualForTemplateCacheSize"; }, {}, never, never, true, never>;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<CdkVirtualForOf<any>, [null, null, null, null, { skipSelf: true; }, null]>;
}
Expand Down Expand Up @@ -157,7 +157,7 @@ export class CdkVirtualScrollableElement extends CdkVirtualScrollable {
// (undocumented)
measureBoundingClientRectWithScrollOffset(from: 'left' | 'top' | 'right' | 'bottom'): number;
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<CdkVirtualScrollableElement, "[cdkVirtualScrollingElement]", never, {}, {}, never, never, false, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<CdkVirtualScrollableElement, "[cdkVirtualScrollingElement]", never, {}, {}, never, never, true, never>;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<CdkVirtualScrollableElement, [null, null, null, { optional: true; }]>;
}
Expand All @@ -170,7 +170,7 @@ export class CdkVirtualScrollableWindow extends CdkVirtualScrollable {
// (undocumented)
measureBoundingClientRectWithScrollOffset(from: 'left' | 'top' | 'right' | 'bottom'): number;
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<CdkVirtualScrollableWindow, "cdk-virtual-scroll-viewport[scrollWindow]", never, {}, {}, never, never, false, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<CdkVirtualScrollableWindow, "cdk-virtual-scroll-viewport[scrollWindow]", never, {}, {}, never, never, true, never>;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<CdkVirtualScrollableWindow, [null, null, { optional: true; }]>;
}
Expand Down Expand Up @@ -222,7 +222,7 @@ export class CdkVirtualScrollViewport extends CdkVirtualScrollable implements On
_totalContentHeight: string;
_totalContentWidth: string;
// (undocumented)
static ɵcmp: i0.ɵɵComponentDeclaration<CdkVirtualScrollViewport, "cdk-virtual-scroll-viewport", never, { "orientation": "orientation"; "appendOnly": "appendOnly"; }, { "scrolledIndexChange": "scrolledIndexChange"; }, never, ["*"], false, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<CdkVirtualScrollViewport, "cdk-virtual-scroll-viewport", never, { "orientation": "orientation"; "appendOnly": "appendOnly"; }, { "scrolledIndexChange": "scrolledIndexChange"; }, never, ["*"], true, never>;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<CdkVirtualScrollViewport, [null, null, null, { optional: true; }, { optional: true; }, null, null, { optional: true; }]>;
}
Expand Down Expand Up @@ -294,7 +294,7 @@ export class ScrollingModule {
// (undocumented)
static ɵinj: i0.ɵɵInjectorDeclaration<ScrollingModule>;
// (undocumented)
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]>;
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]>;
}

// @public (undocumented)
Expand Down