Skip to content

Commit

Permalink
feat(cdk/dialog): move experimental CDK dialog into stable (#24804)
Browse files Browse the repository at this point in the history
Moves the `cdk-experimental/dialog` package into the CDK.
  • Loading branch information
crisbeto authored Apr 20, 2022
1 parent 25cf877 commit c6a1d15
Show file tree
Hide file tree
Showing 23 changed files with 231 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
/src/cdk/clipboard/** @andrewseguin @xkxx
/src/cdk/coercion/** @andrewseguin
/src/cdk/collections/** @crisbeto @andrewseguin
/src/cdk/dialog/** @jelbourn @crisbeto
/src/cdk/drag-drop/** @crisbeto
/src/cdk/keycodes/** @andrewseguin
/src/cdk/layout/** @andrewseguin
Expand Down Expand Up @@ -131,7 +132,6 @@
/src/cdk-experimental/* @andrewseguin
/src/cdk-experimental/column-resize/** @kseamon @andrewseguin
/src/cdk-experimental/combobox/** @jelbourn
/src/cdk-experimental/dialog/** @jelbourn @crisbeto
/src/cdk-experimental/menu/** @jelbourn
/src/cdk-experimental/popover-edit/** @kseamon @andrewseguin
/src/cdk-experimental/scrolling/** @mmalerba
Expand Down
2 changes: 1 addition & 1 deletion .ng-dev/commit-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export const commitMessage: CommitMessageConfig = {
'multiple', // For when a commit applies to multiple components.
'cdk-experimental/column-resize',
'cdk-experimental/combobox',
'cdk-experimental/dialog',
'cdk-experimental/listbox',
'cdk-experimental/menu',
'cdk-experimental/popover-edit',
Expand All @@ -24,6 +23,7 @@ export const commitMessage: CommitMessageConfig = {
'cdk/clipboard',
'cdk/coercion',
'cdk/collections',
'cdk/dialog',
'cdk/drag-drop',
'cdk/keycodes',
'cdk/layout',
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ If you would like to chat about the question in real-time, you can reach out via

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

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

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

### Revert
Expand All @@ -221,7 +221,7 @@ The commit message should specify which package is affected by the change. For e
### Scope
The scope specifies place of the commit change. For example
`material/datepicker`, `cdk-experimental/dialog`, etc.
`material/datepicker`, `cdk/dialog`, etc.
See full list [here][commit-message-scopes].
### Subject
Expand Down
1 change: 0 additions & 1 deletion src/cdk-experimental/config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
CDK_EXPERIMENTAL_ENTRYPOINTS = [
"column-resize",
"combobox",
"dialog",
"menu",
"listbox",
"popover-edit",
Expand Down
1 change: 1 addition & 0 deletions src/cdk/config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CDK_ENTRYPOINTS = [
"clipboard",
"coercion",
"collections",
"dialog",
"drag-drop",
"keycodes",
"layout",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite")
load(
"//tools:defaults.bzl",
"markdown_to_html",
"ng_module",
"ng_test_library",
"ng_web_test_suite",
)

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

Expand Down Expand Up @@ -45,3 +51,13 @@ ng_web_test_suite(
name = "unit_tests",
deps = [":unit_test_sources"],
)

markdown_to_html(
name = "overview",
srcs = [":dialog.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions src/cdk/dialog/dialog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- TODO -->
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/dev-app/cdk-dialog/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ng_module(
":dialog_demo_scss",
],
deps = [
"//src/cdk-experimental/dialog",
"//src/cdk/dialog",
"@npm//@angular/forms",
"@npm//@angular/router",
],
Expand Down
2 changes: 1 addition & 1 deletion src/dev-app/cdk-dialog/dialog-demo-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import {DialogModule} from '@angular/cdk-experimental/dialog';
import {DialogModule} from '@angular/cdk/dialog';
import {NgModule} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {RouterModule} from '@angular/router';
Expand Down
2 changes: 1 addition & 1 deletion src/dev-app/cdk-dialog/dialog-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

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

const defaultDialogConfig = new DialogConfig();

Expand Down
8 changes: 4 additions & 4 deletions src/dev-app/dev-app/dev-app-layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ export class DevAppLayout {
{name: 'Button Toggle', route: '/button-toggle'},
{name: 'Button', route: '/button'},
{name: 'Card', route: '/card'},
{name: 'Cdk Dialog', route: '/cdk-dialog'},
{name: 'Cdk Experimental Combobox', route: '/cdk-experimental-combobox'},
{name: 'Cdk Experimental Listbox', route: '/cdk-experimental-listbox'},
{name: 'Cdk Experimental Menu', route: '/cdk-experimental-menu'},
{name: 'CDK Dialog', route: '/cdk-dialog'},
{name: 'CDK Experimental Combobox', route: '/cdk-experimental-combobox'},
{name: 'CDK Experimental Listbox', route: '/cdk-experimental-listbox'},
{name: 'CDK Experimental Menu', route: '/cdk-experimental-menu'},
{name: 'Checkbox', route: '/checkbox'},
{name: 'Chips', route: '/chips'},
{name: 'Clipboard', route: '/clipboard'},
Expand Down
2 changes: 1 addition & 1 deletion src/e2e-app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ ng_module(
exclude = ["index.html"],
),
deps = [
"//src/cdk-experimental/dialog",
"//src/cdk-experimental/scrolling",
"//src/cdk/dialog",
"//src/cdk/drag-drop",
"//src/cdk/overlay",
"//src/cdk/scrolling",
Expand Down
198 changes: 198 additions & 0 deletions tools/public_api_guard/cdk/dialog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
## API Report File for "components-srcs"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts

import { AfterViewInit } from '@angular/core';
import { BasePortalOutlet } from '@angular/cdk/portal';
import { CdkPortalOutlet } from '@angular/cdk/portal';
import { ComponentFactoryResolver } from '@angular/core';
import { ComponentPortal } from '@angular/cdk/portal';
import { ComponentRef } from '@angular/core';
import { ComponentType } from '@angular/cdk/overlay';
import { Direction } from '@angular/cdk/bidi';
import { DomPortal } from '@angular/cdk/portal';
import { ElementRef } from '@angular/core';
import { EmbeddedViewRef } from '@angular/core';
import { FocusMonitor } from '@angular/cdk/a11y';
import { FocusOrigin } from '@angular/cdk/a11y';
import { FocusTrapFactory } from '@angular/cdk/a11y';
import * as i0 from '@angular/core';
import * as i2 from '@angular/cdk/overlay';
import * as i3 from '@angular/cdk/portal';
import * as i4 from '@angular/cdk/a11y';
import { InjectionToken } from '@angular/core';
import { Injector } from '@angular/core';
import { InteractivityChecker } from '@angular/cdk/a11y';
import { NgZone } from '@angular/core';
import { Observable } from 'rxjs';
import { OnDestroy } from '@angular/core';
import { Overlay } from '@angular/cdk/overlay';
import { OverlayContainer } from '@angular/cdk/overlay';
import { OverlayRef } from '@angular/cdk/overlay';
import { PositionStrategy } from '@angular/cdk/overlay';
import { ScrollStrategy } from '@angular/cdk/overlay';
import { StaticProvider } from '@angular/core';
import { Subject } from 'rxjs';
import { TemplatePortal } from '@angular/cdk/portal';
import { TemplateRef } from '@angular/core';
import { Type } from '@angular/core';
import { ViewContainerRef } from '@angular/core';

// @public
export type AutoFocusTarget = 'dialog' | 'first-tabbable' | 'first-heading';

// @public
export class CdkDialogContainer<C extends DialogConfig = DialogConfig> extends BasePortalOutlet implements AfterViewInit, OnDestroy {
constructor(_elementRef: ElementRef, _focusTrapFactory: FocusTrapFactory, _document: any, _config: C, _interactivityChecker: InteractivityChecker, _ngZone: NgZone, _overlayRef: OverlayRef, _focusMonitor?: FocusMonitor | undefined);
_ariaLabelledBy: string | null;
attachComponentPortal<T>(portal: ComponentPortal<T>): ComponentRef<T>;
// @deprecated
attachDomPortal: (portal: DomPortal) => void;
attachTemplatePortal<T>(portal: TemplatePortal<T>): EmbeddedViewRef<T>;
protected _captureInitialFocus(): void;
_closeInteractionType: FocusOrigin | null;
// (undocumented)
readonly _config: C;
// (undocumented)
protected _document: Document;
// (undocumented)
protected _elementRef: ElementRef;
// (undocumented)
protected _focusTrapFactory: FocusTrapFactory;
// (undocumented)
ngAfterViewInit(): void;
// (undocumented)
ngOnDestroy(): void;
_portalOutlet: CdkPortalOutlet;
protected _trapFocus(): void;
// (undocumented)
static ɵcmp: i0.ɵɵComponentDeclaration<CdkDialogContainer<any>, "cdk-dialog-container", never, {}, {}, never, never>;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<CdkDialogContainer<any>, [null, null, { optional: true; }, null, null, null, null, null]>;
}

// @public
export const DEFAULT_DIALOG_CONFIG: InjectionToken<DialogConfig<unknown, unknown, BasePortalOutlet>>;

// @public (undocumented)
export class Dialog implements OnDestroy {
constructor(_overlay: Overlay, _injector: Injector, _defaultOptions: DialogConfig, _parentDialog: Dialog, _overlayContainer: OverlayContainer, scrollStrategy: any);
readonly afterAllClosed: Observable<void>;
get afterOpened(): Subject<DialogRef<any, any>>;
closeAll(): void;
getDialogById<R, C>(id: string): DialogRef<R, C> | undefined;
// (undocumented)
ngOnDestroy(): void;
open<R = unknown, D = unknown, C = unknown>(component: ComponentType<C>, config?: DialogConfig<D, DialogRef<R, C>>): DialogRef<R, C>;
open<R = unknown, D = unknown, C = unknown>(template: TemplateRef<C>, config?: DialogConfig<D, DialogRef<R, C>>): DialogRef<R, C>;
// (undocumented)
open<R = unknown, D = unknown, C = unknown>(componentOrTemplateRef: ComponentType<C> | TemplateRef<C>, config?: DialogConfig<D, DialogRef<R, C>>): DialogRef<R, C>;
get openDialogs(): DialogRef<any, any>[];
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<Dialog, [null, null, { optional: true; }, { optional: true; skipSelf: true; }, null, null]>;
// (undocumented)
static ɵprov: i0.ɵɵInjectableDeclaration<Dialog>;
}

// @public
export const DIALOG_DATA: InjectionToken<any>;

// @public
export const DIALOG_SCROLL_STRATEGY: InjectionToken<() => ScrollStrategy>;

// @public
export const DIALOG_SCROLL_STRATEGY_PROVIDER: {
provide: InjectionToken<() => ScrollStrategy>;
deps: (typeof Overlay)[];
useFactory: typeof DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY;
};

// @public
export function DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay): () => ScrollStrategy;

// @public
export interface DialogCloseOptions {
focusOrigin?: FocusOrigin;
}

// @public
export class DialogConfig<D = unknown, R = unknown, C extends BasePortalOutlet = BasePortalOutlet> {
ariaDescribedBy?: string | null;
ariaLabel?: string | null;
ariaLabelledBy?: string | null;
ariaModal?: boolean;
autoFocus?: AutoFocusTarget | string | boolean;
backdropClass?: string | string[];
closeOnNavigation?: boolean;
componentFactoryResolver?: ComponentFactoryResolver;
container?: Type<C> | {
type: Type<C>;
providers: (config: DialogConfig<D, R, C>) => StaticProvider[];
};
data?: D | null;
direction?: Direction;
disableClose?: boolean;
hasBackdrop?: boolean;
height?: string;
id?: string;
injector?: Injector;
maxHeight?: number | string;
maxWidth?: number | string;
minHeight?: number | string;
minWidth?: number | string;
panelClass?: string | string[];
positionStrategy?: PositionStrategy;
providers?: StaticProvider[] | ((dialogRef: R, config: DialogConfig<D, R, C>, container: C) => StaticProvider[]);
restoreFocus?: boolean;
role?: DialogRole;
scrollStrategy?: ScrollStrategy;
templateContext?: Record<string, any> | (() => Record<string, any>);
viewContainerRef?: ViewContainerRef;
width?: string;
}

// @public (undocumented)
export class DialogModule {
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<DialogModule, never>;
// (undocumented)
static ɵinj: i0.ɵɵInjectorDeclaration<DialogModule>;
// (undocumented)
static ɵmod: i0.ɵɵNgModuleDeclaration<DialogModule, [typeof i1.CdkDialogContainer], [typeof i2.OverlayModule, typeof i3.PortalModule, typeof i4.A11yModule], [typeof i3.PortalModule, typeof i1.CdkDialogContainer]>;
}

// @public
export class DialogRef<R = unknown, C = unknown> {
constructor(overlayRef: OverlayRef, config: DialogConfig<any, DialogRef<R, C>, BasePortalOutlet>);
addPanelClass(classes: string | string[]): this;
readonly backdropClick: Observable<MouseEvent>;
close(result?: R, options?: DialogCloseOptions): void;
readonly closed: Observable<R | undefined>;
componentInstance: C | null;
// (undocumented)
readonly config: DialogConfig<any, DialogRef<R, C>, BasePortalOutlet>;
containerInstance: BasePortalOutlet & {
_closeInteractionType?: FocusOrigin;
};
disableClose: boolean | undefined;
readonly id: string;
readonly keydownEvents: Observable<KeyboardEvent>;
readonly outsidePointerEvents: Observable<MouseEvent>;
// (undocumented)
readonly overlayRef: OverlayRef;
removePanelClass(classes: string | string[]): this;
updatePosition(): this;
updateSize(width?: string, height?: string): this;
}

// @public
export type DialogRole = 'dialog' | 'alertdialog';

// @public (undocumented)
export function throwDialogContentAlreadyAttachedError(): void;

// (No @packageDocumentation comment for this package)

```

0 comments on commit c6a1d15

Please sign in to comment.