-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(module: tabs&tabbar): tabs&tabbar refactor (#399)
- Loading branch information
Showing
37 changed files
with
866 additions
and
826 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * from './tab-bar.module'; | ||
export * from './tab-bar.component'; | ||
export * from './tab-bar-tab.component'; | ||
export * from './tab-bar-item.component'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<ng-template #content> | ||
<ng-content></ng-content> | ||
</ng-template> | ||
|
||
<ng-template #tabBarTab> | ||
<div class="{{prefixCls}}-icon" | ||
[style.color]="selected ? tintColor : unselectedTintColor"> | ||
<Badge *ngIf="badge" className="{{prefixCls}}-badge tab-badge" [text]="badge"> | ||
<ng-container *ngIf="isTemplateRef(selected ? selectedIcon : icon); then domTemplate; else imgTemplate"> | ||
</ng-container> | ||
</Badge> | ||
<Badge className="{{prefixCls}}-badge tab-badge" [dot]="dot" *ngIf="dot"> | ||
<ng-container *ngIf="isTemplateRef(selected ? selectedIcon : icon); then domTemplate; else imgTemplate"> | ||
</ng-container> | ||
</Badge> | ||
<ng-container *ngIf="!badge && !dot" > | ||
<ng-container *ngIf="isTemplateRef(selected ? selectedIcon : icon); then domTemplate; else imgTemplate"> | ||
</ng-container> | ||
</ng-container> | ||
</div> | ||
<p class="{{prefixCls}}-title" [style.color]="selected ? tintColor : unselectedTintColor"> | ||
{{title}} | ||
</p> | ||
</ng-template> | ||
|
||
<ng-template #domTemplate> | ||
<ng-template [ngTemplateOutlet]="(selected ? selectedIcon : icon)"></ng-template> | ||
</ng-template> | ||
|
||
<ng-template #imgTemplate > | ||
<img src="{{selected ? selectedIcon : icon}}" alt="{{title}}"> | ||
</ng-template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { | ||
Component, | ||
Input, | ||
ViewChild, | ||
TemplateRef | ||
} from '@angular/core'; | ||
import { TabPane } from '../tabs/tab-pane.component'; | ||
|
||
@Component({ | ||
selector: 'TabBarItem, nzm-tab-bar-item', | ||
templateUrl: './tab-bar-item.component.html' | ||
}) | ||
export class TabBarItem extends TabPane { | ||
prefixCls: string = 'am-tab-bar-tab'; | ||
selected: boolean = false; | ||
tintColor: string = '#108ee9'; | ||
unselectedTintColor: string = '#888'; | ||
|
||
@ViewChild('tabBarTab') | ||
tabBarTab: TemplateRef<void>; | ||
|
||
@Input() | ||
key: string = ''; | ||
@Input() | ||
title: string = ''; | ||
@Input() | ||
dot: boolean = false; | ||
@Input() | ||
badge: number | string = null; | ||
@Input() | ||
icon: string | TemplateRef<void> = null; | ||
@Input() | ||
selectedIcon: string | TemplateRef<void> = null; | ||
|
||
constructor() { | ||
super(); | ||
} | ||
|
||
isTemplateRef(value) { | ||
return value instanceof TemplateRef; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.