@@ -44,7 +44,7 @@ import { NzTransferSearchComponent } from './transfer-search.component';
4444 [nzChecked]="stat.checkAll"
4545 (nzCheckedChange)="onItemSelectAll($event)"
4646 [nzIndeterminate]="stat.checkHalf"
47- [nzDisabled]="stat.shownCount === 0 || disabled"
47+ [nzDisabled]="stat.availableCount === 0 || disabled"
4848 ></label>
4949 }
5050 <span class="ant-transfer-list-header-selected">
@@ -175,13 +175,19 @@ export class NzTransferListComponent implements AfterViewInit {
175175 checkAll : false ,
176176 checkHalf : false ,
177177 checkCount : 0 ,
178- shownCount : 0
178+ shownCount : 0 ,
179+ availableCount : 0
179180 } ;
180181
181182 get validData ( ) : TransferItem [ ] {
182183 return this . dataSource . filter ( w => ! w . hide ) ;
183184 }
184185
186+ get availableData ( ) : TransferItem [ ] {
187+ // filter disabled data
188+ return this . validData . filter ( w => ! w . disabled ) ;
189+ }
190+
185191 onItemSelect = ( item : TransferItem ) : void => {
186192 if ( this . disabled || item . disabled ) {
187193 return ;
@@ -206,6 +212,7 @@ export class NzTransferListComponent implements AfterViewInit {
206212 const validCount = this . dataSource . filter ( w => ! w . disabled ) . length ;
207213 this . stat . checkCount = this . dataSource . filter ( w => w . checked && ! w . disabled ) . length ;
208214 this . stat . shownCount = this . validData . length ;
215+ this . stat . availableCount = this . availableData . length ;
209216 this . stat . checkAll = validCount > 0 && validCount === this . stat . checkCount ;
210217 this . stat . checkHalf = this . stat . checkCount > 0 && ! this . stat . checkAll ;
211218 // Note: this is done explicitly since the internal `nzChecked` value may not be updated in edge cases.
@@ -233,6 +240,7 @@ export class NzTransferListComponent implements AfterViewInit {
233240 item . hide = value . length > 0 && ! this . matchFilter ( value , item ) ;
234241 } ) ;
235242 this . stat . shownCount = this . validData . length ;
243+ this . stat . availableCount = this . availableData . length ;
236244 this . filterChange . emit ( { direction : this . direction , value } ) ;
237245 }
238246
0 commit comments