Skip to content

Commit e3fb854

Browse files
committed
feat(cdk): add dialog utilities
1 parent 8f776f0 commit e3fb854

3 files changed

Lines changed: 31 additions & 0 deletions

File tree

packages/cdk/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"peerDependencies": {
55
"@angular/core": "17.x.x",
66
"@angular/cdk": "17.x.x",
7+
"@angularity/core": "*",
78
"rxjs": "7.x.x"
89
},
910
"dependencies": {

packages/cdk/src/dialog.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { DialogConfig, DialogRef } from '@angular/cdk/dialog';
2+
3+
const TYPES = Symbol('TYPES');
4+
5+
export abstract class DialogIoTypes<Input, Output> {
6+
[TYPES]?: [Input, Output];
7+
}
8+
9+
export type DialogInputOf<T extends DialogIoTypes<any, any>> =
10+
T extends DialogIoTypes<infer Input, any> ? Input : never;
11+
12+
export type DialogOutputOf<T extends DialogIoTypes<any, any>> =
13+
T extends DialogIoTypes<any, infer Output> ? Output : never;
14+
15+
export type DialogRefOf<T extends DialogIoTypes<any, any>> = DialogRef<
16+
DialogOutputOf<T>,
17+
T
18+
>;
19+
20+
export type DialogConfigOf<T extends DialogIoTypes<any, any>> = DialogConfig<
21+
DialogInputOf<T>,
22+
DialogRefOf<T>
23+
>;
24+
25+
export function createDialogConfig<T extends DialogIoTypes<any, any>>(
26+
config: DialogConfigOf<T>,
27+
): typeof config {
28+
return config;
29+
}

packages/cdk/src/public-api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
export * from './dialog';
12
export * from './named-breakpoint-observer';

0 commit comments

Comments
 (0)