@@ -44,7 +44,7 @@ import { NzTransferSearchComponent } from './transfer-search.component';
44
44
[nzChecked]="stat.checkAll"
45
45
(nzCheckedChange)="onItemSelectAll($event)"
46
46
[nzIndeterminate]="stat.checkHalf"
47
- [nzDisabled]="stat.shownCount === 0 || disabled"
47
+ [nzDisabled]="stat.availableCount === 0 || disabled"
48
48
></label>
49
49
}
50
50
<span class="ant-transfer-list-header-selected">
@@ -175,13 +175,19 @@ export class NzTransferListComponent implements AfterViewInit {
175
175
checkAll : false ,
176
176
checkHalf : false ,
177
177
checkCount : 0 ,
178
- shownCount : 0
178
+ shownCount : 0 ,
179
+ availableCount : 0
179
180
} ;
180
181
181
182
get validData ( ) : TransferItem [ ] {
182
183
return this . dataSource . filter ( w => ! w . hide ) ;
183
184
}
184
185
186
+ get availableData ( ) : TransferItem [ ] {
187
+ // filter disabled data
188
+ return this . validData . filter ( w => ! w . disabled ) ;
189
+ }
190
+
185
191
onItemSelect = ( item : TransferItem ) : void => {
186
192
if ( this . disabled || item . disabled ) {
187
193
return ;
@@ -206,6 +212,7 @@ export class NzTransferListComponent implements AfterViewInit {
206
212
const validCount = this . dataSource . filter ( w => ! w . disabled ) . length ;
207
213
this . stat . checkCount = this . dataSource . filter ( w => w . checked && ! w . disabled ) . length ;
208
214
this . stat . shownCount = this . validData . length ;
215
+ this . stat . availableCount = this . availableData . length ;
209
216
this . stat . checkAll = validCount > 0 && validCount === this . stat . checkCount ;
210
217
this . stat . checkHalf = this . stat . checkCount > 0 && ! this . stat . checkAll ;
211
218
// 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 {
233
240
item . hide = value . length > 0 && ! this . matchFilter ( value , item ) ;
234
241
} ) ;
235
242
this . stat . shownCount = this . validData . length ;
243
+ this . stat . availableCount = this . availableData . length ;
236
244
this . filterChange . emit ( { direction : this . direction , value } ) ;
237
245
}
238
246
0 commit comments