@@ -376,7 +376,7 @@ export class MultipleSelectInstance {
376
376
const saInputElm = createDomElement ( 'input' , { type : 'checkbox' , checked : this . allSelected } ) ;
377
377
saInputElm . dataset . name = 'selectAll' ;
378
378
saLabelElm . appendChild ( saInputElm ) ;
379
- saLabelElm . appendChild ( createDomElement ( 'span' , { textContent : this . options . formatSelectAll ( ) } ) ) ;
379
+ saLabelElm . appendChild ( createDomElement ( 'span' , { textContent : this . formatSelectAll ( ) } ) ) ;
380
380
this . selectAllParentElm . appendChild ( saLabelElm ) ;
381
381
this . dropElm . appendChild ( this . selectAllParentElm ) ;
382
382
}
@@ -388,7 +388,7 @@ export class MultipleSelectInstance {
388
388
this . okButtonElm = createDomElement ( 'button' , {
389
389
className : 'ms-ok-button' ,
390
390
type : 'button' ,
391
- textContent : this . options . formatOkButton ( ) ,
391
+ textContent : this . formatOkButton ( ) ,
392
392
} ) ;
393
393
this . dropElm . appendChild ( this . okButtonElm ) ;
394
394
}
@@ -464,7 +464,7 @@ export class MultipleSelectInstance {
464
464
rows . push ( ...this . initListItem ( row ) ) ;
465
465
} ) ;
466
466
467
- rows . push ( `<li class="ms-no-results">${ this . options . formatNoMatchesFound ( ) } </li>` ) ;
467
+ rows . push ( `<li class="ms-no-results">${ this . formatNoMatchesFound ( ) } </li>` ) ;
468
468
469
469
return rows ;
470
470
}
@@ -904,12 +904,12 @@ export class MultipleSelectInstance {
904
904
spanElm . innerHTML = this . options . sanitizer ? this . options . sanitizer ( placeholder ) : placeholder ;
905
905
} else if ( sl < this . options . minimumCountSelected ) {
906
906
html = getSelectOptionHtml ( ) ;
907
- } else if ( this . options . formatAllSelected ( ) && sl === this . dataTotal ) {
908
- html = this . options . formatAllSelected ( ) ;
907
+ } else if ( this . formatAllSelected ( ) && sl === this . dataTotal ) {
908
+ html = this . formatAllSelected ( ) ;
909
909
} else if ( this . options . ellipsis && sl > this . options . minimumCountSelected ) {
910
910
html = `${ textSelects . slice ( 0 , this . options . minimumCountSelected ) . join ( this . options . displayDelimiter ) } ...` ;
911
- } else if ( this . options . formatCountSelected ( sl , this . dataTotal ) && sl > this . options . minimumCountSelected ) {
912
- html = this . options . formatCountSelected ( sl , this . dataTotal ) ;
911
+ } else if ( this . formatCountSelected ( sl , this . dataTotal ) && sl > this . options . minimumCountSelected ) {
912
+ html = this . formatCountSelected ( sl , this . dataTotal ) ;
913
913
} else {
914
914
html = getSelectOptionHtml ( ) ;
915
915
}
@@ -1397,4 +1397,29 @@ export class MultipleSelectInstance {
1397
1397
1398
1398
return widthNoScroll - widthWithScroll ;
1399
1399
}
1400
+
1401
+ // five text formatters, it could be string patterns or formatter callback functions
1402
+
1403
+ formatAllSelected ( ) {
1404
+ return this . options . allSelectedText || this . options . formatAllSelected ( ) ;
1405
+ }
1406
+
1407
+ formatCountSelected ( selectedCount : number , totalCount : number ) {
1408
+ if ( this . options . countSelectedText ) {
1409
+ return this . options . countSelectedText . replace ( '#' , `${ selectedCount } ` ) . replace ( '%' , `${ totalCount } ` ) ;
1410
+ }
1411
+ return this . options . formatCountSelected ( selectedCount , totalCount ) ;
1412
+ }
1413
+
1414
+ formatNoMatchesFound ( ) {
1415
+ return this . options . noMatchesFoundText || this . options . formatNoMatchesFound ( ) ;
1416
+ }
1417
+
1418
+ formatOkButton ( ) {
1419
+ return this . options . okButtonText || this . options . formatOkButton ( ) ;
1420
+ }
1421
+
1422
+ formatSelectAll ( ) {
1423
+ return this . options . selectAllText || this . options . formatSelectAll ( ) ;
1424
+ }
1400
1425
}
0 commit comments