Skip to content
Permalink
Browse files

feat(module:tabs): add router exact active parameter (#3862)

close #3858
  • Loading branch information...
wendzhue committed Aug 9, 2019
1 parent 583eb77 commit 6b13faf5c25ed52cf47283e41ede14c7faf0b296
@@ -39,7 +39,8 @@ import { NzTabsModule } from 'ng-zorro-antd/tabs';
| `[nzTabBarGutter]` | The gap between tabs | `number` | - |
| `[nzHideAll]` | Whether hide all tabs | `boolean` | `false` |
| `[nzShowPagination]` | Whether show pre or next button when exceed display area | `boolean` | `true` |
| `[nzLinkRouter]` | Link with Angular router. It supports child mode and query param mode | `boolean` | `false` ||
| `[nzLinkRouter]` | Link with Angular router. It supports child mode and query param mode | `boolean` | `false` |
| `[nzLinkExact]` | Use exact routing matching | `boolean` | `true` |
| `(nzSelectedIndexChange)` | Current tab's index change callback | `EventEmitter<number>` | - |
| `(nzSelectChange)` | Current tab's change callback | `EventEmitter<{nzSelectedIndex: number,tab: NzTabComponent}>` | - |
| `(nzOnNextClick)` | Callback executed when next button is clicked | `EventEmitter<void>` | - |
@@ -42,7 +42,8 @@ import { NzTabsModule } from 'ng-zorro-antd/tabs';
| `[nzTabBarGutter]` | tabs 之间的间隙 | `number` | - |
| `[nzHideAll]` | 是否隐藏所有tab内容 | `boolean` | `false` |
| `[nzShowPagination]` | 是否超出范围时显示pre和next按钮 | `boolean` | `true` |
| `[nzLinkRouter]` | 与 Angular 路由联动 | `boolean` | `false` ||
| `[nzLinkRouter]` | 与 Angular 路由联动 | `boolean` | `false` |
| `[nzLinkExact]` | 以严格匹配模式确定联动的路由 | `boolean` | `true` |
| `(nzSelectedIndexChange)` | 当前激活 tab 面板的 序列号变更回调函数 | `EventEmitter<number>` | - |
| `(nzSelectChange)` | 当前激活 tab 面板变更回调函数 | `EventEmitter<{nzSelectedIndex: number,tab: NzTabComponent}>` | - |
| `(nzOnNextClick)` | next 按钮被点击的回调 | `EventEmitter<void>` | - |
@@ -86,6 +86,7 @@ export class NzTabSetComponent
@ContentChildren(NzTabComponent) listOfNzTabComponent: QueryList<NzTabComponent>;
@ViewChild(NzTabsNavComponent, { static: false }) nzTabsNavComponent: NzTabsNavComponent;
@ViewChild('tabContent', { static: false }) tabContent: ElementRef;

@Input() nzTabBarExtraContent: TemplateRef<void>;
@Input() nzShowPagination = true;
@Input() nzAnimated: NzAnimatedInterface | boolean = true;
@@ -97,7 +98,7 @@ export class NzTabSetComponent
@Input() nzType: NzTabType = 'line';

@Input() @InputBoolean() nzLinkRouter = false;
@Input() nzQueryParam: string;
@Input() @InputBoolean() nzLinkExact = true;

@Output() readonly nzOnNextClick = new EventEmitter<void>();
@Output() readonly nzOnPrevClick = new EventEmitter<void>();
@@ -340,6 +341,6 @@ export class NzTabSetComponent
}

private isLinkActive(router: Router): (link?: RouterLink | RouterLinkWithHref) => boolean {
return (link?: RouterLink | RouterLinkWithHref) => (link ? router.isActive(link.urlTree, true) : false);
return (link?: RouterLink | RouterLinkWithHref) => (link ? router.isActive(link.urlTree, this.nzLinkExact) : false);
}
}

0 comments on commit 6b13faf

Please sign in to comment.
You can’t perform that action at this time.