Skip to content

Commit

Permalink
feat: Angular 5 support (#324)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
danielsogl authored and ihadeed committed Oct 23, 2018
1 parent 71da40a commit db83b02
Show file tree
Hide file tree
Showing 11 changed files with 443 additions and 259 deletions.
25 changes: 14 additions & 11 deletions package.json
Expand Up @@ -5,10 +5,11 @@
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"prebuild": "rimraf -rf aot dist",
"prebuild": "rimraf dist aot",
"build": "ngc",
"postbuild": "npm run copy:scss",
"copy:scss": "cp src/components/super-tabs.scss dist/components/",
"lint": "tslint \"src/**/*.ts\"",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
"postchangelog": "git commit -am \"chore(): update changelog\"",
"shipit": "npm run build && npm publish"
Expand All @@ -17,21 +18,23 @@
"license": "MIT",
"repository": "https://github.com/zyra/ionic2-super-tabs",
"devDependencies": {
"@angular/common": "4.4.3",
"@angular/compiler": "4.4.3",
"@angular/compiler-cli": "4.4.3",
"@angular/core": "4.4.3",
"@angular/forms": "4.4.3",
"@angular/http": "4.4.3",
"@angular/platform-browser": "4.4.3",
"@angular/platform-browser-dynamic": "4.4.3",
"conventional-changelog-cli": "^1.3.22",
"@angular/common": "5.2.11",
"@angular/compiler": "5.2.11",
"@angular/compiler-cli": "5.2.11",
"@angular/core": "5.2.11",
"@angular/forms": "5.2.11",
"@angular/http": "5.2.11",
"@angular/platform-browser": "5.2.11",
"@angular/platform-browser-dynamic": "5.2.11",
"codelyzer": "^4.4.2",
"conventional-changelog-cli": "^2.0.1",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"rimraf": "^2.6.2",
"rxjs": "^5.5.11",
"tslint": "^5.11.0",
"typescript": "2.4.2",
"zone.js": "0.8.20"
"zone.js": "^0.8.26"
},
"peerDependencies": {
"ionic-angular": "^3.9.2"
Expand Down
12 changes: 6 additions & 6 deletions src/components/super-tab-button.ts
Expand Up @@ -5,7 +5,7 @@ import {
EventEmitter,
Input,
Output,
ViewEncapsulation
ViewEncapsulation,
} from '@angular/core';

@Component({
Expand All @@ -28,10 +28,10 @@ import {
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None
})
export class SuperTabButton {
export class SuperTabButtonComponent {

@Input()
selected: boolean = false;
selected = false;

@Input()
title: string;
Expand All @@ -49,17 +49,17 @@ export class SuperTabButton {
color: string;

@Output()
select: EventEmitter<SuperTabButton> = new EventEmitter<SuperTabButton>();
select: EventEmitter<SuperTabButtonComponent> = new EventEmitter<SuperTabButtonComponent>();

onClick() {
this.select.emit(this);
}

constructor(private _el: ElementRef) {
constructor(private eRef: ElementRef) {
}

getNativeElement(): HTMLElement {
return this._el.nativeElement;
return this.eRef.nativeElement;
}

}
13 changes: 7 additions & 6 deletions src/components/super-tab.ts
Expand Up @@ -13,7 +13,7 @@ import {
Renderer,
ViewChild,
ViewContainerRef,
ViewEncapsulation
ViewEncapsulation,
} from '@angular/core';
import {
App,
Expand All @@ -24,17 +24,18 @@ import {
NavControllerBase,
NavOptions,
Platform,
ViewController
ViewController,
} from 'ionic-angular';
import { TransitionController } from 'ionic-angular/transitions/transition-controller';
import { SuperTabs } from './super-tabs';

import { SuperTabsComponent } from './super-tabs';

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

/**
* Title of the tab
Expand Down Expand Up @@ -121,7 +122,7 @@ export class SuperTab extends NavControllerBase implements OnInit, AfterViewInit
* Indicates whether the tab has been loaded
* @type {boolean}
*/
private loaded: boolean = false;
private loaded = false;

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

constructor(parent: SuperTabs,
constructor(parent: SuperTabsComponent,
app: App,
config: Config,
plt: Platform,
Expand Down
13 changes: 7 additions & 6 deletions src/components/super-tabs-container.ts
Expand Up @@ -9,9 +9,10 @@ import {
Output,
Renderer2,
ViewChild,
ViewEncapsulation
ViewEncapsulation,
} from '@angular/core';
import { Platform } from 'ionic-angular';

import { SuperTabsPanGesture } from '../super-tabs-pan-gesture';
import { SuperTabsConfig } from './super-tabs';

Expand All @@ -34,7 +35,7 @@ export class SuperTabsContainer implements AfterViewInit, OnDestroy {
* @type {number}
*/
@Input()
tabsCount: number = 0;
tabsCount = 0;

/**
* Selected tab index
Expand Down Expand Up @@ -63,7 +64,7 @@ export class SuperTabsContainer implements AfterViewInit, OnDestroy {
* Container position
* @type {number}
*/
containerPosition: number = 0;
containerPosition = 0;

// View children

Expand All @@ -77,13 +78,13 @@ export class SuperTabsContainer implements AfterViewInit, OnDestroy {
* Single tab width
* @type {number}
*/
tabWidth: number = 0;
tabWidth = 0;

/**
* Container width (sum of tab widths)
* @type {number}
*/
containerWidth: number = 0;
containerWidth = 0;


// Animation stuff
Expand Down Expand Up @@ -160,7 +161,7 @@ export class SuperTabsContainer implements AfterViewInit, OnDestroy {

this.refreshDimensions();

this.gesture = new SuperTabsPanGesture(this.plt, this.container.nativeElement, this.config, this.rnd);
this.gesture = new SuperTabsPanGesture(this.plt, this.config, this.container.nativeElement, this.rnd);

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

0 comments on commit db83b02

Please sign in to comment.