Skip to content

Commit db83b02

Browse files
danielsoglihadeed
authored andcommitted
feat: Angular 5 support (#324)
* chore(package): bump deps and add lint rules * WIP * WIP * WIP * chore: refactor build and readme (#325) * chore(build): add basic travis script (#326) * fix(lib): prevent TypeError "Cannot read property 'getActiveChildNavs' of undefined" (#323) * Remove package-lock.json * 4.3.1 * chore(): update changelog
1 parent 71da40a commit db83b02

11 files changed

+443
-259
lines changed

package.json

+14-11
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
"main": "dist/index.js",
66
"typings": "dist/index.d.ts",
77
"scripts": {
8-
"prebuild": "rimraf -rf aot dist",
8+
"prebuild": "rimraf dist aot",
99
"build": "ngc",
1010
"postbuild": "npm run copy:scss",
1111
"copy:scss": "cp src/components/super-tabs.scss dist/components/",
12+
"lint": "tslint \"src/**/*.ts\"",
1213
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
1314
"postchangelog": "git commit -am \"chore(): update changelog\"",
1415
"shipit": "npm run build && npm publish"
@@ -17,21 +18,23 @@
1718
"license": "MIT",
1819
"repository": "https://github.com/zyra/ionic2-super-tabs",
1920
"devDependencies": {
20-
"@angular/common": "4.4.3",
21-
"@angular/compiler": "4.4.3",
22-
"@angular/compiler-cli": "4.4.3",
23-
"@angular/core": "4.4.3",
24-
"@angular/forms": "4.4.3",
25-
"@angular/http": "4.4.3",
26-
"@angular/platform-browser": "4.4.3",
27-
"@angular/platform-browser-dynamic": "4.4.3",
28-
"conventional-changelog-cli": "^1.3.22",
21+
"@angular/common": "5.2.11",
22+
"@angular/compiler": "5.2.11",
23+
"@angular/compiler-cli": "5.2.11",
24+
"@angular/core": "5.2.11",
25+
"@angular/forms": "5.2.11",
26+
"@angular/http": "5.2.11",
27+
"@angular/platform-browser": "5.2.11",
28+
"@angular/platform-browser-dynamic": "5.2.11",
29+
"codelyzer": "^4.4.2",
30+
"conventional-changelog-cli": "^2.0.1",
2931
"ionic-angular": "3.9.2",
3032
"ionicons": "3.0.0",
3133
"rimraf": "^2.6.2",
3234
"rxjs": "^5.5.11",
35+
"tslint": "^5.11.0",
3336
"typescript": "2.4.2",
34-
"zone.js": "0.8.20"
37+
"zone.js": "^0.8.26"
3538
},
3639
"peerDependencies": {
3740
"ionic-angular": "^3.9.2"

src/components/super-tab-button.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
EventEmitter,
66
Input,
77
Output,
8-
ViewEncapsulation
8+
ViewEncapsulation,
99
} from '@angular/core';
1010

1111
@Component({
@@ -28,10 +28,10 @@ import {
2828
changeDetection: ChangeDetectionStrategy.OnPush,
2929
encapsulation: ViewEncapsulation.None
3030
})
31-
export class SuperTabButton {
31+
export class SuperTabButtonComponent {
3232

3333
@Input()
34-
selected: boolean = false;
34+
selected = false;
3535

3636
@Input()
3737
title: string;
@@ -49,17 +49,17 @@ export class SuperTabButton {
4949
color: string;
5050

5151
@Output()
52-
select: EventEmitter<SuperTabButton> = new EventEmitter<SuperTabButton>();
52+
select: EventEmitter<SuperTabButtonComponent> = new EventEmitter<SuperTabButtonComponent>();
5353

5454
onClick() {
5555
this.select.emit(this);
5656
}
5757

58-
constructor(private _el: ElementRef) {
58+
constructor(private eRef: ElementRef) {
5959
}
6060

6161
getNativeElement(): HTMLElement {
62-
return this._el.nativeElement;
62+
return this.eRef.nativeElement;
6363
}
6464

6565
}

src/components/super-tab.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
Renderer,
1414
ViewChild,
1515
ViewContainerRef,
16-
ViewEncapsulation
16+
ViewEncapsulation,
1717
} from '@angular/core';
1818
import {
1919
App,
@@ -24,17 +24,18 @@ import {
2424
NavControllerBase,
2525
NavOptions,
2626
Platform,
27-
ViewController
27+
ViewController,
2828
} from 'ionic-angular';
2929
import { TransitionController } from 'ionic-angular/transitions/transition-controller';
30-
import { SuperTabs } from './super-tabs';
30+
31+
import { SuperTabsComponent } from './super-tabs';
3132

3233
@Component({
3334
selector: 'super-tab',
3435
template: '<div #viewport></div><div class="nav-decor"></div>',
3536
encapsulation: ViewEncapsulation.None
3637
})
37-
export class SuperTab extends NavControllerBase implements OnInit, AfterViewInit, OnDestroy {
38+
export class SuperTabComponent extends NavControllerBase implements OnInit, AfterViewInit, OnDestroy {
3839

3940
/**
4041
* Title of the tab
@@ -121,7 +122,7 @@ export class SuperTab extends NavControllerBase implements OnInit, AfterViewInit
121122
* Indicates whether the tab has been loaded
122123
* @type {boolean}
123124
*/
124-
private loaded: boolean = false;
125+
private loaded = false;
125126

126127
/**
127128
* A promise that resolves when the component has initialized
@@ -133,7 +134,7 @@ export class SuperTab extends NavControllerBase implements OnInit, AfterViewInit
133134
*/
134135
private initResolve: Function;
135136

136-
constructor(parent: SuperTabs,
137+
constructor(parent: SuperTabsComponent,
137138
app: App,
138139
config: Config,
139140
plt: Platform,

src/components/super-tabs-container.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ import {
99
Output,
1010
Renderer2,
1111
ViewChild,
12-
ViewEncapsulation
12+
ViewEncapsulation,
1313
} from '@angular/core';
1414
import { Platform } from 'ionic-angular';
15+
1516
import { SuperTabsPanGesture } from '../super-tabs-pan-gesture';
1617
import { SuperTabsConfig } from './super-tabs';
1718

@@ -34,7 +35,7 @@ export class SuperTabsContainer implements AfterViewInit, OnDestroy {
3435
* @type {number}
3536
*/
3637
@Input()
37-
tabsCount: number = 0;
38+
tabsCount = 0;
3839

3940
/**
4041
* Selected tab index
@@ -63,7 +64,7 @@ export class SuperTabsContainer implements AfterViewInit, OnDestroy {
6364
* Container position
6465
* @type {number}
6566
*/
66-
containerPosition: number = 0;
67+
containerPosition = 0;
6768

6869
// View children
6970

@@ -77,13 +78,13 @@ export class SuperTabsContainer implements AfterViewInit, OnDestroy {
7778
* Single tab width
7879
* @type {number}
7980
*/
80-
tabWidth: number = 0;
81+
tabWidth = 0;
8182

8283
/**
8384
* Container width (sum of tab widths)
8485
* @type {number}
8586
*/
86-
containerWidth: number = 0;
87+
containerWidth = 0;
8788

8889

8990
// Animation stuff
@@ -160,7 +161,7 @@ export class SuperTabsContainer implements AfterViewInit, OnDestroy {
160161

161162
this.refreshDimensions();
162163

163-
this.gesture = new SuperTabsPanGesture(this.plt, this.container.nativeElement, this.config, this.rnd);
164+
this.gesture = new SuperTabsPanGesture(this.plt, this.config, this.container.nativeElement, this.rnd);
164165

165166
this.gesture.onMove = (delta: number) => {
166167
if (this.globalSwipeEnabled === false) return;

0 commit comments

Comments
 (0)