1
- import { CommonModule } from '@angular/common' ;
2
1
import {
3
2
AfterContentInit ,
4
3
AfterViewChecked ,
5
4
Component ,
6
5
ContentChild ,
7
- Directive ,
8
6
ElementRef ,
9
7
forwardRef ,
10
8
HostBinding ,
11
9
Inject ,
12
10
Input ,
13
- TemplateRef
11
+ TemplateRef ,
12
+ HostListener
14
13
} from '@angular/core' ;
15
14
16
15
import { IgxTabItemComponent } from './tab-item.component' ;
@@ -23,10 +22,6 @@ import { IgxTabItemTemplateDirective } from './tabs.directives';
23
22
} )
24
23
25
24
export class IgxTabsGroupComponent implements AfterContentInit , AfterViewChecked {
26
- private _itemStyle = 'igx-tabs-group' ;
27
- /**
28
- * @hidden
29
- */
30
25
public isSelected = false ;
31
26
32
27
/**
@@ -71,13 +66,6 @@ export class IgxTabsGroupComponent implements AfterContentInit, AfterViewChecked
71
66
return 'igx-tabs__group' ;
72
67
}
73
68
74
- /**
75
- *@hidden
76
- */
77
- public get itemStyle ( ) : string {
78
- return this . _itemStyle ;
79
- }
80
-
81
69
/**
82
70
* An accessor that returns the `IgxTabItemComponent` component.
83
71
* ```typescript
@@ -138,6 +126,16 @@ export class IgxTabsGroupComponent implements AfterContentInit, AfterViewChecked
138
126
private _element : ElementRef ) {
139
127
}
140
128
129
+
130
+ @HostListener ( 'window:resize' , [ '$event' ] )
131
+ public onResize ( event ) {
132
+ if ( this . isSelected ) {
133
+ const contentOffset = this . _tabs . tabsContainer . nativeElement . offsetWidth * this . index ;
134
+ this . _tabs . contentsContainer . nativeElement . style . transitionDuration = `0s` ;
135
+ this . _tabs . contentsContainer . nativeElement . style . transform = `translate(${ - contentOffset } px)` ;
136
+ }
137
+ }
138
+
141
139
/**
142
140
* @hidden
143
141
*/
@@ -163,7 +161,6 @@ export class IgxTabsGroupComponent implements AfterContentInit, AfterViewChecked
163
161
*public tab : IgxTabsGroupComponent;
164
162
*ngAfterViewInit(){
165
163
* this.tab.select();
166
- * this.cdr.detectChanges();
167
164
*}
168
165
*```
169
166
* @param focusDelay A number representing the expected delay.
@@ -196,6 +193,7 @@ export class IgxTabsGroupComponent implements AfterContentInit, AfterViewChecked
196
193
}
197
194
198
195
const contentOffset = this . _tabs . tabsContainer . nativeElement . offsetWidth * this . index ;
196
+ this . _tabs . contentsContainer . nativeElement . style . transitionDuration = `0.2s` ;
199
197
this . _tabs . contentsContainer . nativeElement . style . transform = `translate(${ - contentOffset } px)` ;
200
198
201
199
this . _tabs . selectedIndicator . nativeElement . style . width = `${ tabElement . offsetWidth } px` ;
0 commit comments