File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
projects/coreui-angular/src/lib/tabs-2/tabs-list Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 11import { FocusKeyManager } from '@angular/cdk/a11y' ;
22import {
3+ afterEveryRender ,
34 Component ,
45 computed ,
56 contentChildren ,
67 DestroyRef ,
78 effect ,
9+ ElementRef ,
810 inject ,
911 input ,
1012 InputSignal ,
13+ signal ,
1114 untracked
1215} from '@angular/core' ;
1316import { takeUntilDestroyed } from '@angular/core/rxjs-interop' ;
1417import { tap } from 'rxjs/operators' ;
1518import { TabDirective } from '../tab/tab.directive' ;
1619import { TabsService } from '../tabs.service' ;
20+ import { RtlService } from '../../services' ;
1721
1822@Component ( {
1923 exportAs : 'cTabsList' ,
@@ -27,7 +31,18 @@ import { TabsService } from '../tabs.service';
2731} )
2832export class TabsListComponent {
2933 readonly #destroyRef = inject ( DestroyRef ) ;
34+ readonly #elementRef = inject ( ElementRef ) ;
3035 readonly tabsService = inject ( TabsService ) ;
36+ readonly #rtlService = inject ( RtlService ) ;
37+ readonly #isRtl = signal ( false ) ;
38+
39+ constructor ( ) {
40+ afterEveryRender ( {
41+ read : ( ) => {
42+ this . #isRtl. set ( this . #rtlService. isRTL ( this . #elementRef. nativeElement ) ) ;
43+ }
44+ } ) ;
45+ }
3146
3247 /**
3348 * Specify a layout type for component.
@@ -66,9 +81,12 @@ export class TabsListComponent {
6681 if ( tabs . length === 0 ) {
6782 return ;
6883 }
84+
85+ const isRtl = this . #isRtl( ) ;
86+
6987 this . #focusKeyManager = new FocusKeyManager ( tabs )
7088 . skipPredicate ( ( tab ) => tab . disabled === true )
71- . withHorizontalOrientation ( 'ltr' )
89+ . withHorizontalOrientation ( isRtl ? 'rtl' : 'ltr' )
7290 . withHomeAndEnd ( )
7391 . withWrap ( ) ;
7492
You can’t perform that action at this time.
0 commit comments