|
7 | 7 | */
|
8 | 8 |
|
9 | 9 | import {
|
10 |
| - TemplateRef, |
| 10 | + ComponentRef, |
| 11 | + EventEmitter, |
11 | 12 | Injectable,
|
12 | 13 | Injector,
|
13 | 14 | OnDestroy,
|
14 |
| - Type, |
15 | 15 | StaticProvider,
|
16 |
| - ComponentRef, |
| 16 | + TemplateRef, |
| 17 | + Type, |
17 | 18 | inject,
|
| 19 | + signal, |
18 | 20 | } from '@angular/core';
|
| 21 | +import {Observable, Subject, defer} from 'rxjs'; |
| 22 | +import {startWith} from 'rxjs/operators'; |
| 23 | +import {_IdGenerator} from '../a11y'; |
| 24 | +import {Direction, Directionality} from '../bidi'; |
| 25 | +import {ComponentType, Overlay, OverlayConfig, OverlayContainer, OverlayRef} from '../overlay'; |
19 | 26 | import {BasePortalOutlet, ComponentPortal, TemplatePortal} from '../portal';
|
20 |
| -import {of as observableOf, Observable, Subject, defer} from 'rxjs'; |
21 |
| -import {DialogRef} from './dialog-ref'; |
22 | 27 | import {DialogConfig} from './dialog-config';
|
23 |
| -import {Directionality} from '../bidi'; |
24 |
| -import {_IdGenerator} from '../a11y'; |
25 |
| -import {ComponentType, Overlay, OverlayRef, OverlayConfig, OverlayContainer} from '../overlay'; |
26 |
| -import {startWith} from 'rxjs/operators'; |
| 28 | +import {DialogRef} from './dialog-ref'; |
27 | 29 |
|
28 |
| -import {DEFAULT_DIALOG_CONFIG, DIALOG_DATA, DIALOG_SCROLL_STRATEGY} from './dialog-injectors'; |
29 | 30 | import {CdkDialogContainer} from './dialog-container';
|
| 31 | +import {DEFAULT_DIALOG_CONFIG, DIALOG_DATA, DIALOG_SCROLL_STRATEGY} from './dialog-injectors'; |
| 32 | + |
| 33 | +function getDirectionality(value: Direction): Directionality { |
| 34 | + const valueSignal = signal(value); |
| 35 | + const change = new EventEmitter<Direction>(); |
| 36 | + return { |
| 37 | + valueSignal, |
| 38 | + get value() { |
| 39 | + return valueSignal(); |
| 40 | + }, |
| 41 | + change, |
| 42 | + ngOnDestroy() { |
| 43 | + change.complete(); |
| 44 | + }, |
| 45 | + }; |
| 46 | +} |
30 | 47 |
|
31 | 48 | @Injectable({providedIn: 'root'})
|
32 | 49 | export class Dialog implements OnDestroy {
|
@@ -317,7 +334,7 @@ export class Dialog implements OnDestroy {
|
317 | 334 | ) {
|
318 | 335 | providers.push({
|
319 | 336 | provide: Directionality,
|
320 |
| - useValue: {value: config.direction, change: observableOf()}, |
| 337 | + useValue: getDirectionality(config.direction), |
321 | 338 | });
|
322 | 339 | }
|
323 | 340 |
|
|
0 commit comments