|
7 | 7 | */ |
8 | 8 |
|
9 | 9 | import { |
10 | | - TemplateRef, |
| 10 | + ComponentRef, |
11 | 11 | Injectable, |
12 | 12 | Injector, |
13 | 13 | OnDestroy, |
14 | | - Type, |
15 | 14 | StaticProvider, |
16 | | - ComponentRef, |
| 15 | + TemplateRef, |
| 16 | + Type, |
17 | 17 | inject, |
| 18 | + signal, |
18 | 19 | } from '@angular/core'; |
| 20 | +import {Observable, Subject, defer, of as observableOf} from 'rxjs'; |
| 21 | +import {startWith} from 'rxjs/operators'; |
| 22 | +import {_IdGenerator} from '../a11y'; |
| 23 | +import {Directionality} from '../bidi'; |
| 24 | +import {ComponentType, Overlay, OverlayConfig, OverlayContainer, OverlayRef} from '../overlay'; |
19 | 25 | import {BasePortalOutlet, ComponentPortal, TemplatePortal} from '../portal'; |
20 | | -import {of as observableOf, Observable, Subject, defer} from 'rxjs'; |
21 | | -import {DialogRef} from './dialog-ref'; |
22 | 26 | 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'; |
| 27 | +import {DialogRef} from './dialog-ref'; |
27 | 28 |
|
28 | | -import {DEFAULT_DIALOG_CONFIG, DIALOG_DATA, DIALOG_SCROLL_STRATEGY} from './dialog-injectors'; |
29 | 29 | import {CdkDialogContainer} from './dialog-container'; |
| 30 | +import {DEFAULT_DIALOG_CONFIG, DIALOG_DATA, DIALOG_SCROLL_STRATEGY} from './dialog-injectors'; |
30 | 31 |
|
31 | 32 | @Injectable({providedIn: 'root'}) |
32 | 33 | export class Dialog implements OnDestroy { |
@@ -315,9 +316,16 @@ export class Dialog implements OnDestroy { |
315 | 316 | (!userInjector || |
316 | 317 | !userInjector.get<Directionality | null>(Directionality, null, {optional: true})) |
317 | 318 | ) { |
| 319 | + const valueSignal = signal(config.direction); |
318 | 320 | providers.push({ |
319 | 321 | provide: Directionality, |
320 | | - useValue: {value: config.direction, change: observableOf()}, |
| 322 | + useValue: { |
| 323 | + valueSignal, |
| 324 | + get value() { |
| 325 | + return valueSignal(); |
| 326 | + }, |
| 327 | + change: observableOf(), |
| 328 | + }, |
321 | 329 | }); |
322 | 330 | } |
323 | 331 |
|
|
0 commit comments