From 13fac376888a71f9fd06f9fafb3301137e9b6f11 Mon Sep 17 00:00:00 2001 From: Confusedfish Date: Mon, 26 Sep 2016 11:41:43 +0100 Subject: [PATCH] feat(tabs): added custom class option fixes #766, fixes #842 * chore(package): update typescript to version 2.0.3 https://greenkeeper.io/ * Add customClass property to the Tab directive to make it easy to add class names to the outputted nav-items * tslint fix * Clicking on some tabs would sometime result in reloading the application (tested in Chrome). This will probably fix issue #842 which sounds exactly like the scenario this fixes for me. --- components/tabs/readme.md | 1 + components/tabs/tab.directive.ts | 1 + components/tabs/tabset.component.ts | 4 ++-- demo/assets/css/style.css | 7 +++++++ demo/components/tabs/tabs-demo.html | 3 ++- demo/components/tabs/tabs-demo.ts | 3 ++- package.json | 2 +- 7 files changed, 16 insertions(+), 5 deletions(-) diff --git a/components/tabs/readme.md b/components/tabs/readme.md index 06bfc6456f..4d4181e758 100644 --- a/components/tabs/readme.md +++ b/components/tabs/readme.md @@ -58,6 +58,7 @@ export class TabHeadingDirective {} - `active` (`?boolean=false`) - if tab is active equals true, or set `true` to activate tab - `disabled` (`?boolean=false`) - if `true` tab can not be activated - `removable` (`?boolean=false`) - if `true` tab can be removable, additional button will appear + - `customClass` (`?string`) - if set, will be added to the tab's class atribute ### Tab events - `select` - fired when `tab` became active, `$event:Tab` equals to selected instance of `Tab` component diff --git a/components/tabs/tab.directive.ts b/components/tabs/tab.directive.ts index b20530b21a..5e73c2db06 100644 --- a/components/tabs/tab.directive.ts +++ b/components/tabs/tab.directive.ts @@ -11,6 +11,7 @@ export class TabDirective implements OnDestroy { @Input() public heading:string; @Input() public disabled:boolean; @Input() public removable:boolean; + @Input() public customClass:string; /** tab active state toggle */ @HostBinding('class.active') diff --git a/components/tabs/tabset.component.ts b/components/tabs/tabset.component.ts index e79301a307..36e228260e 100644 --- a/components/tabs/tabset.component.ts +++ b/components/tabs/tabset.component.ts @@ -7,9 +7,9 @@ import { TabDirective } from './tab.directive'; selector: 'tabset', template: `