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 1
1
import { FocusKeyManager } from '@angular/cdk/a11y' ;
2
2
import {
3
+ afterEveryRender ,
3
4
Component ,
4
5
computed ,
5
6
contentChildren ,
6
7
DestroyRef ,
7
8
effect ,
9
+ ElementRef ,
8
10
inject ,
9
11
input ,
10
12
InputSignal ,
13
+ signal ,
11
14
untracked
12
15
} from '@angular/core' ;
13
16
import { takeUntilDestroyed } from '@angular/core/rxjs-interop' ;
14
17
import { tap } from 'rxjs/operators' ;
15
18
import { TabDirective } from '../tab/tab.directive' ;
16
19
import { TabsService } from '../tabs.service' ;
20
+ import { RtlService } from '../../services' ;
17
21
18
22
@Component ( {
19
23
exportAs : 'cTabsList' ,
@@ -27,7 +31,18 @@ import { TabsService } from '../tabs.service';
27
31
} )
28
32
export class TabsListComponent {
29
33
readonly #destroyRef = inject ( DestroyRef ) ;
34
+ readonly #elementRef = inject ( ElementRef ) ;
30
35
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
+ }
31
46
32
47
/**
33
48
* Specify a layout type for component.
@@ -66,9 +81,12 @@ export class TabsListComponent {
66
81
if ( tabs . length === 0 ) {
67
82
return ;
68
83
}
84
+
85
+ const isRtl = this . #isRtl( ) ;
86
+
69
87
this . #focusKeyManager = new FocusKeyManager ( tabs )
70
88
. skipPredicate ( ( tab ) => tab . disabled === true )
71
- . withHorizontalOrientation ( 'ltr' )
89
+ . withHorizontalOrientation ( isRtl ? 'rtl' : 'ltr' )
72
90
. withHomeAndEnd ( )
73
91
. withWrap ( ) ;
74
92
You can’t perform that action at this time.
0 commit comments