Skip to content

Commit c6a1d15

Browse files
authored
feat(cdk/dialog): move experimental CDK dialog into stable (#24804)
Moves the `cdk-experimental/dialog` package into the CDK.
1 parent 25cf877 commit c6a1d15

23 files changed

+231
-16
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
/src/cdk/clipboard/** @andrewseguin @xkxx
7474
/src/cdk/coercion/** @andrewseguin
7575
/src/cdk/collections/** @crisbeto @andrewseguin
76+
/src/cdk/dialog/** @jelbourn @crisbeto
7677
/src/cdk/drag-drop/** @crisbeto
7778
/src/cdk/keycodes/** @andrewseguin
7879
/src/cdk/layout/** @andrewseguin
@@ -131,7 +132,6 @@
131132
/src/cdk-experimental/* @andrewseguin
132133
/src/cdk-experimental/column-resize/** @kseamon @andrewseguin
133134
/src/cdk-experimental/combobox/** @jelbourn
134-
/src/cdk-experimental/dialog/** @jelbourn @crisbeto
135135
/src/cdk-experimental/menu/** @jelbourn
136136
/src/cdk-experimental/popover-edit/** @kseamon @andrewseguin
137137
/src/cdk-experimental/scrolling/** @mmalerba

.ng-dev/commit-message.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export const commitMessage: CommitMessageConfig = {
1111
'multiple', // For when a commit applies to multiple components.
1212
'cdk-experimental/column-resize',
1313
'cdk-experimental/combobox',
14-
'cdk-experimental/dialog',
1514
'cdk-experimental/listbox',
1615
'cdk-experimental/menu',
1716
'cdk-experimental/popover-edit',
@@ -24,6 +23,7 @@ export const commitMessage: CommitMessageConfig = {
2423
'cdk/clipboard',
2524
'cdk/coercion',
2625
'cdk/collections',
26+
'cdk/dialog',
2727
'cdk/drag-drop',
2828
'cdk/keycodes',
2929
'cdk/layout',

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ If you would like to chat about the question in real-time, you can reach out via
3131

3232
## <a name="issue"></a> Found an Issue?
3333
If you find a bug in the source code or a mistake in the documentation, you can help us by
34-
[submitting an issue](#submit-issue) to our [GitHub Repository][github]. Including an issue
34+
[submitting an issue](#submit-issue) to our [GitHub Repository][github]. Including an issue
3535
reproduction (via CodePen, JsBin, Plunkr, etc.) is the absolute best way to help the team quickly
3636
diagnose the problem. Screenshots are also helpful.
3737

@@ -40,7 +40,7 @@ You can help the team even more and [submit a Pull Request](#submit-pr) with a f
4040
## <a name="feature"></a> Want a Feature?
4141
You can *request* a new feature by [submitting an issue](#submit-issue) to our [GitHub
4242
Repository][github]. If you would like to *implement* a new feature, please submit an issue with
43-
a proposal for your work first, to be sure that we can use it.
43+
a proposal for your work first, to be sure that we can use it.
4444
Please consider what kind of change it is:
4545

4646
* For a **Major Feature**, first open an issue and outline your proposal so that it can be
@@ -194,7 +194,7 @@ Fixes a bug in the Angular Material `button` component where buttons
194194
cannot be disabled through an binding. This is because the `disabled`
195195
input did not set the `.mat-button-disabled` class on the host element.
196196
197-
Fixes #1234
197+
Fixes #1234
198198
```
199199

200200
### Revert
@@ -221,7 +221,7 @@ The commit message should specify which package is affected by the change. For e
221221
222222
### Scope
223223
The scope specifies place of the commit change. For example
224-
`material/datepicker`, `cdk-experimental/dialog`, etc.
224+
`material/datepicker`, `cdk/dialog`, etc.
225225
See full list [here][commit-message-scopes].
226226
227227
### Subject

src/cdk-experimental/config.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
CDK_EXPERIMENTAL_ENTRYPOINTS = [
33
"column-resize",
44
"combobox",
5-
"dialog",
65
"menu",
76
"listbox",
87
"popover-edit",

src/cdk/config.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CDK_ENTRYPOINTS = [
66
"clipboard",
77
"coercion",
88
"collections",
9+
"dialog",
910
"drag-drop",
1011
"keycodes",
1112
"layout",

src/cdk-experimental/dialog/BUILD.bazel renamed to src/cdk/dialog/BUILD.bazel

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite")
1+
load(
2+
"//tools:defaults.bzl",
3+
"markdown_to_html",
4+
"ng_module",
5+
"ng_test_library",
6+
"ng_web_test_suite",
7+
)
28

39
package(default_visibility = ["//visibility:public"])
410

@@ -45,3 +51,13 @@ ng_web_test_suite(
4551
name = "unit_tests",
4652
deps = [":unit_test_sources"],
4753
)
54+
55+
markdown_to_html(
56+
name = "overview",
57+
srcs = [":dialog.md"],
58+
)
59+
60+
filegroup(
61+
name = "source-files",
62+
srcs = glob(["**/*.ts"]),
63+
)

src/cdk/dialog/dialog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!-- TODO -->
File renamed without changes.
File renamed without changes.

src/dev-app/cdk-dialog/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ng_module(
1010
":dialog_demo_scss",
1111
],
1212
deps = [
13-
"//src/cdk-experimental/dialog",
13+
"//src/cdk/dialog",
1414
"@npm//@angular/forms",
1515
"@npm//@angular/router",
1616
],

src/dev-app/cdk-dialog/dialog-demo-module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {DialogModule} from '@angular/cdk-experimental/dialog';
9+
import {DialogModule} from '@angular/cdk/dialog';
1010
import {NgModule} from '@angular/core';
1111
import {FormsModule} from '@angular/forms';
1212
import {RouterModule} from '@angular/router';

src/dev-app/cdk-dialog/dialog-demo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import {Component, Inject, TemplateRef, ViewChild, ViewEncapsulation} from '@angular/core';
10-
import {DIALOG_DATA, Dialog, DialogConfig, DialogRef} from '@angular/cdk-experimental/dialog';
10+
import {DIALOG_DATA, Dialog, DialogConfig, DialogRef} from '@angular/cdk/dialog';
1111

1212
const defaultDialogConfig = new DialogConfig();
1313

src/dev-app/dev-app/dev-app-layout.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ export class DevAppLayout {
3636
{name: 'Button Toggle', route: '/button-toggle'},
3737
{name: 'Button', route: '/button'},
3838
{name: 'Card', route: '/card'},
39-
{name: 'Cdk Dialog', route: '/cdk-dialog'},
40-
{name: 'Cdk Experimental Combobox', route: '/cdk-experimental-combobox'},
41-
{name: 'Cdk Experimental Listbox', route: '/cdk-experimental-listbox'},
42-
{name: 'Cdk Experimental Menu', route: '/cdk-experimental-menu'},
39+
{name: 'CDK Dialog', route: '/cdk-dialog'},
40+
{name: 'CDK Experimental Combobox', route: '/cdk-experimental-combobox'},
41+
{name: 'CDK Experimental Listbox', route: '/cdk-experimental-listbox'},
42+
{name: 'CDK Experimental Menu', route: '/cdk-experimental-menu'},
4343
{name: 'Checkbox', route: '/checkbox'},
4444
{name: 'Chips', route: '/chips'},
4545
{name: 'Clipboard', route: '/clipboard'},

src/e2e-app/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ ng_module(
3434
exclude = ["index.html"],
3535
),
3636
deps = [
37-
"//src/cdk-experimental/dialog",
3837
"//src/cdk-experimental/scrolling",
38+
"//src/cdk/dialog",
3939
"//src/cdk/drag-drop",
4040
"//src/cdk/overlay",
4141
"//src/cdk/scrolling",

tools/public_api_guard/cdk/dialog.md

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
## API Report File for "components-srcs"
2+
3+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4+
5+
```ts
6+
7+
import { AfterViewInit } from '@angular/core';
8+
import { BasePortalOutlet } from '@angular/cdk/portal';
9+
import { CdkPortalOutlet } from '@angular/cdk/portal';
10+
import { ComponentFactoryResolver } from '@angular/core';
11+
import { ComponentPortal } from '@angular/cdk/portal';
12+
import { ComponentRef } from '@angular/core';
13+
import { ComponentType } from '@angular/cdk/overlay';
14+
import { Direction } from '@angular/cdk/bidi';
15+
import { DomPortal } from '@angular/cdk/portal';
16+
import { ElementRef } from '@angular/core';
17+
import { EmbeddedViewRef } from '@angular/core';
18+
import { FocusMonitor } from '@angular/cdk/a11y';
19+
import { FocusOrigin } from '@angular/cdk/a11y';
20+
import { FocusTrapFactory } from '@angular/cdk/a11y';
21+
import * as i0 from '@angular/core';
22+
import * as i2 from '@angular/cdk/overlay';
23+
import * as i3 from '@angular/cdk/portal';
24+
import * as i4 from '@angular/cdk/a11y';
25+
import { InjectionToken } from '@angular/core';
26+
import { Injector } from '@angular/core';
27+
import { InteractivityChecker } from '@angular/cdk/a11y';
28+
import { NgZone } from '@angular/core';
29+
import { Observable } from 'rxjs';
30+
import { OnDestroy } from '@angular/core';
31+
import { Overlay } from '@angular/cdk/overlay';
32+
import { OverlayContainer } from '@angular/cdk/overlay';
33+
import { OverlayRef } from '@angular/cdk/overlay';
34+
import { PositionStrategy } from '@angular/cdk/overlay';
35+
import { ScrollStrategy } from '@angular/cdk/overlay';
36+
import { StaticProvider } from '@angular/core';
37+
import { Subject } from 'rxjs';
38+
import { TemplatePortal } from '@angular/cdk/portal';
39+
import { TemplateRef } from '@angular/core';
40+
import { Type } from '@angular/core';
41+
import { ViewContainerRef } from '@angular/core';
42+
43+
// @public
44+
export type AutoFocusTarget = 'dialog' | 'first-tabbable' | 'first-heading';
45+
46+
// @public
47+
export class CdkDialogContainer<C extends DialogConfig = DialogConfig> extends BasePortalOutlet implements AfterViewInit, OnDestroy {
48+
constructor(_elementRef: ElementRef, _focusTrapFactory: FocusTrapFactory, _document: any, _config: C, _interactivityChecker: InteractivityChecker, _ngZone: NgZone, _overlayRef: OverlayRef, _focusMonitor?: FocusMonitor | undefined);
49+
_ariaLabelledBy: string | null;
50+
attachComponentPortal<T>(portal: ComponentPortal<T>): ComponentRef<T>;
51+
// @deprecated
52+
attachDomPortal: (portal: DomPortal) => void;
53+
attachTemplatePortal<T>(portal: TemplatePortal<T>): EmbeddedViewRef<T>;
54+
protected _captureInitialFocus(): void;
55+
_closeInteractionType: FocusOrigin | null;
56+
// (undocumented)
57+
readonly _config: C;
58+
// (undocumented)
59+
protected _document: Document;
60+
// (undocumented)
61+
protected _elementRef: ElementRef;
62+
// (undocumented)
63+
protected _focusTrapFactory: FocusTrapFactory;
64+
// (undocumented)
65+
ngAfterViewInit(): void;
66+
// (undocumented)
67+
ngOnDestroy(): void;
68+
_portalOutlet: CdkPortalOutlet;
69+
protected _trapFocus(): void;
70+
// (undocumented)
71+
static ɵcmp: i0.ɵɵComponentDeclaration<CdkDialogContainer<any>, "cdk-dialog-container", never, {}, {}, never, never>;
72+
// (undocumented)
73+
static ɵfac: i0.ɵɵFactoryDeclaration<CdkDialogContainer<any>, [null, null, { optional: true; }, null, null, null, null, null]>;
74+
}
75+
76+
// @public
77+
export const DEFAULT_DIALOG_CONFIG: InjectionToken<DialogConfig<unknown, unknown, BasePortalOutlet>>;
78+
79+
// @public (undocumented)
80+
export class Dialog implements OnDestroy {
81+
constructor(_overlay: Overlay, _injector: Injector, _defaultOptions: DialogConfig, _parentDialog: Dialog, _overlayContainer: OverlayContainer, scrollStrategy: any);
82+
readonly afterAllClosed: Observable<void>;
83+
get afterOpened(): Subject<DialogRef<any, any>>;
84+
closeAll(): void;
85+
getDialogById<R, C>(id: string): DialogRef<R, C> | undefined;
86+
// (undocumented)
87+
ngOnDestroy(): void;
88+
open<R = unknown, D = unknown, C = unknown>(component: ComponentType<C>, config?: DialogConfig<D, DialogRef<R, C>>): DialogRef<R, C>;
89+
open<R = unknown, D = unknown, C = unknown>(template: TemplateRef<C>, config?: DialogConfig<D, DialogRef<R, C>>): DialogRef<R, C>;
90+
// (undocumented)
91+
open<R = unknown, D = unknown, C = unknown>(componentOrTemplateRef: ComponentType<C> | TemplateRef<C>, config?: DialogConfig<D, DialogRef<R, C>>): DialogRef<R, C>;
92+
get openDialogs(): DialogRef<any, any>[];
93+
// (undocumented)
94+
static ɵfac: i0.ɵɵFactoryDeclaration<Dialog, [null, null, { optional: true; }, { optional: true; skipSelf: true; }, null, null]>;
95+
// (undocumented)
96+
static ɵprov: i0.ɵɵInjectableDeclaration<Dialog>;
97+
}
98+
99+
// @public
100+
export const DIALOG_DATA: InjectionToken<any>;
101+
102+
// @public
103+
export const DIALOG_SCROLL_STRATEGY: InjectionToken<() => ScrollStrategy>;
104+
105+
// @public
106+
export const DIALOG_SCROLL_STRATEGY_PROVIDER: {
107+
provide: InjectionToken<() => ScrollStrategy>;
108+
deps: (typeof Overlay)[];
109+
useFactory: typeof DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY;
110+
};
111+
112+
// @public
113+
export function DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay): () => ScrollStrategy;
114+
115+
// @public
116+
export interface DialogCloseOptions {
117+
focusOrigin?: FocusOrigin;
118+
}
119+
120+
// @public
121+
export class DialogConfig<D = unknown, R = unknown, C extends BasePortalOutlet = BasePortalOutlet> {
122+
ariaDescribedBy?: string | null;
123+
ariaLabel?: string | null;
124+
ariaLabelledBy?: string | null;
125+
ariaModal?: boolean;
126+
autoFocus?: AutoFocusTarget | string | boolean;
127+
backdropClass?: string | string[];
128+
closeOnNavigation?: boolean;
129+
componentFactoryResolver?: ComponentFactoryResolver;
130+
container?: Type<C> | {
131+
type: Type<C>;
132+
providers: (config: DialogConfig<D, R, C>) => StaticProvider[];
133+
};
134+
data?: D | null;
135+
direction?: Direction;
136+
disableClose?: boolean;
137+
hasBackdrop?: boolean;
138+
height?: string;
139+
id?: string;
140+
injector?: Injector;
141+
maxHeight?: number | string;
142+
maxWidth?: number | string;
143+
minHeight?: number | string;
144+
minWidth?: number | string;
145+
panelClass?: string | string[];
146+
positionStrategy?: PositionStrategy;
147+
providers?: StaticProvider[] | ((dialogRef: R, config: DialogConfig<D, R, C>, container: C) => StaticProvider[]);
148+
restoreFocus?: boolean;
149+
role?: DialogRole;
150+
scrollStrategy?: ScrollStrategy;
151+
templateContext?: Record<string, any> | (() => Record<string, any>);
152+
viewContainerRef?: ViewContainerRef;
153+
width?: string;
154+
}
155+
156+
// @public (undocumented)
157+
export class DialogModule {
158+
// (undocumented)
159+
static ɵfac: i0.ɵɵFactoryDeclaration<DialogModule, never>;
160+
// (undocumented)
161+
static ɵinj: i0.ɵɵInjectorDeclaration<DialogModule>;
162+
// (undocumented)
163+
static ɵmod: i0.ɵɵNgModuleDeclaration<DialogModule, [typeof i1.CdkDialogContainer], [typeof i2.OverlayModule, typeof i3.PortalModule, typeof i4.A11yModule], [typeof i3.PortalModule, typeof i1.CdkDialogContainer]>;
164+
}
165+
166+
// @public
167+
export class DialogRef<R = unknown, C = unknown> {
168+
constructor(overlayRef: OverlayRef, config: DialogConfig<any, DialogRef<R, C>, BasePortalOutlet>);
169+
addPanelClass(classes: string | string[]): this;
170+
readonly backdropClick: Observable<MouseEvent>;
171+
close(result?: R, options?: DialogCloseOptions): void;
172+
readonly closed: Observable<R | undefined>;
173+
componentInstance: C | null;
174+
// (undocumented)
175+
readonly config: DialogConfig<any, DialogRef<R, C>, BasePortalOutlet>;
176+
containerInstance: BasePortalOutlet & {
177+
_closeInteractionType?: FocusOrigin;
178+
};
179+
disableClose: boolean | undefined;
180+
readonly id: string;
181+
readonly keydownEvents: Observable<KeyboardEvent>;
182+
readonly outsidePointerEvents: Observable<MouseEvent>;
183+
// (undocumented)
184+
readonly overlayRef: OverlayRef;
185+
removePanelClass(classes: string | string[]): this;
186+
updatePosition(): this;
187+
updateSize(width?: string, height?: string): this;
188+
}
189+
190+
// @public
191+
export type DialogRole = 'dialog' | 'alertdialog';
192+
193+
// @public (undocumented)
194+
export function throwDialogContentAlreadyAttachedError(): void;
195+
196+
// (No @packageDocumentation comment for this package)
197+
198+
```

0 commit comments

Comments
 (0)