@@ -10,10 +10,18 @@ import {
1010 ViewChild ,
1111 inject ,
1212} from '@angular/core' ;
13- import { delay , filter , fromEvent , timer } from 'rxjs' ;
13+ import {
14+ combineLatestWith ,
15+ delay ,
16+ filter ,
17+ fromEvent ,
18+ map ,
19+ startWith ,
20+ timer ,
21+ } from 'rxjs' ;
1422import { takeUntilDestroyed , toSignal } from '@angular/core/rxjs-interop' ;
1523
16- import { HsConfig , HsConfigObject } from 'hslayers-ng/config' ;
24+ import { HsConfig , HsConfigObject , ToastPosition } from 'hslayers-ng/config' ;
1725import { HsEventBusService } from 'hslayers-ng/services/event-bus' ;
1826import { HsExternalService } from 'hslayers-ng/services/external' ;
1927import { HsLayoutService } from 'hslayers-ng/services/layout' ;
@@ -69,6 +77,7 @@ export class HslayersComponent implements AfterViewInit, OnInit {
6977 private panelSpace : HTMLElement ;
7078 private mapSpace : HTMLElement ;
7179
80+ toastPosition : Signal < ToastPosition > ;
7281 constructor (
7382 public hsConfig : HsConfig ,
7483 private elementRef : ElementRef ,
@@ -83,6 +92,20 @@ export class HslayersComponent implements AfterViewInit, OnInit {
8392 ) {
8493 this . sidebarPosition = toSignal ( this . HsLayoutService . sidebarPosition ) ;
8594 this . sidebarVisible = toSignal ( this . HsLayoutService . sidebarVisible ) ;
95+
96+ this . toastPosition = toSignal (
97+ this . HsLayoutService . sidebarPosition$ . pipe (
98+ combineLatestWith (
99+ this . hsConfig . configChanges . pipe ( startWith ( this . hsConfig ) ) ,
100+ ) ,
101+ map ( ( [ sidebarPosition , _ ] ) => {
102+ return (
103+ this . hsConfig . toastPosition ??
104+ ( sidebarPosition === 'left' ? 'bottom-right' : 'bottom-left' )
105+ ) ;
106+ } ) ,
107+ ) ,
108+ ) ;
86109 }
87110
88111 async ngOnInit ( ) : Promise < void > {
0 commit comments