@@ -28,7 +28,9 @@ import {
2828 TemplateRef ,
2929 ViewChild ,
3030 ViewEncapsulation ,
31- booleanAttribute
31+ booleanAttribute ,
32+ computed ,
33+ input
3234} from '@angular/core' ;
3335import { Subject , animationFrameScheduler , asapScheduler , merge , of } from 'rxjs' ;
3436import { auditTime , takeUntil } from 'rxjs/operators' ;
@@ -39,6 +41,7 @@ import { NzSafeAny } from 'ng-zorro-antd/core/types';
3941
4042import { NzTabPositionMode , NzTabScrollEvent , NzTabScrollListOffsetEvent } from './interfaces' ;
4143import { NzTabAddButtonComponent } from './tab-add-button.component' ;
44+ import { NzTabBarExtraContentDirective } from './tab-bar-extra-content.directive' ;
4245import { NzTabNavItemDirective } from './tab-nav-item.directive' ;
4346import { NzTabNavOperationComponent } from './tab-nav-operation.component' ;
4447import { NzTabScrollListDirective } from './tab-scroll-list.directive' ;
@@ -54,6 +57,11 @@ const CSS_TRANSFORM_TIME = 150;
5457 changeDetection : ChangeDetectionStrategy . OnPush ,
5558 encapsulation : ViewEncapsulation . None ,
5659 template : `
60+ @if (startExtraContent()) {
61+ <div class="ant-tabs-extra-content">
62+ <ng-template [ngTemplateOutlet]="startExtraContent()!.templateRef"></ng-template>
63+ </div>
64+ }
5765 <div
5866 class="ant-tabs-nav-wrap"
5967 [class.ant-tabs-nav-wrap-ping-left]="pingLeft"
@@ -90,7 +98,11 @@ const CSS_TRANSFORM_TIME = 150;
9098 [addable]="addable"
9199 [items]="hiddenItems"
92100 ></nz-tab-nav-operation>
93- @if (extraTemplate) {
101+ @if (endExtraContent()) {
102+ <div class="ant-tabs-extra-content">
103+ <ng-template [ngTemplateOutlet]="endExtraContent()!.templateRef"></ng-template>
104+ </div>
105+ } @else if (extraTemplate) {
94106 <div class="ant-tabs-extra-content">
95107 <ng-template [ngTemplateOutlet]="extraTemplate"></ng-template>
96108 </div>
@@ -121,6 +133,11 @@ export class NzTabNavBarComponent implements AfterViewInit, AfterContentChecked,
121133 @Input ( ) inkBarAnimated = true ;
122134 @Input ( ) extraTemplate ?: TemplateRef < void > ;
123135
136+ readonly extraContents = input . required < readonly NzTabBarExtraContentDirective [ ] > ( ) ;
137+
138+ readonly startExtraContent = computed ( ( ) => this . extraContents ( ) . find ( item => item . position ( ) === 'start' ) ) ;
139+ readonly endExtraContent = computed ( ( ) => this . extraContents ( ) . find ( item => item . position ( ) === 'end' ) ) ;
140+
124141 @Input ( )
125142 get selectedIndex ( ) : number {
126143 return this . _selectedIndex ;
0 commit comments