@@ -503,47 +503,47 @@ export class MultipleSelectInstance {
503
503
protected getListRows ( ) : HtmlStruct [ ] {
504
504
const rows : HtmlStruct [ ] = [ ] ;
505
505
this . updateData = [ ] ;
506
- this . data ?. forEach ( ( row ) => rows . push ( ...this . initListItem ( row ) ) ) ;
506
+ this . data ?. forEach ( ( dataRow ) => rows . push ( ...this . initListItem ( dataRow ) ) ) ;
507
507
rows . push ( { tagName : 'li' , props : { className : 'ms-no-results' , textContent : this . formatNoMatchesFound ( ) , tabIndex : 0 } } ) ;
508
508
509
509
return rows ;
510
510
}
511
511
512
- protected initListItem ( row : OptionRowData | OptGroupRowData , level = 0 ) : HtmlStruct [ ] {
513
- const title = row ?. title || '' ;
512
+ protected initListItem ( dataRow : OptionRowData | OptGroupRowData , level = 0 ) : HtmlStruct [ ] {
513
+ const title = dataRow ?. title || '' ;
514
514
const multiple = this . options . multiple ? 'multiple' : '' ;
515
515
const type = this . options . single ? 'radio' : 'checkbox' ;
516
516
let classes = '' ;
517
517
518
- if ( ! row ?. visible ) {
518
+ if ( ! dataRow ?. visible ) {
519
519
return [ ] ;
520
520
}
521
521
522
- this . updateData . push ( row ) ;
522
+ this . updateData . push ( dataRow ) ;
523
523
524
524
if ( this . options . single && ! this . options . singleRadio ) {
525
525
classes = 'hide-radio ' ;
526
526
}
527
527
528
- if ( row . selected ) {
528
+ if ( dataRow . selected ) {
529
529
classes += 'selected ' ;
530
530
}
531
531
532
- if ( row . type === 'optgroup' ) {
532
+ if ( dataRow . type === 'optgroup' ) {
533
533
// - group option row -
534
534
const htmlBlocks : HtmlStruct [ ] = [ ] ;
535
535
536
536
const itemOrGroupBlock : HtmlStruct =
537
537
this . options . hideOptgroupCheckboxes || this . options . single
538
- ? { tagName : 'span' , props : { dataset : { name : this . selectGroupName , key : row . _key } } }
538
+ ? { tagName : 'span' , props : { dataset : { name : this . selectGroupName , key : dataRow . _key } } }
539
539
: {
540
540
tagName : 'input' ,
541
541
props : {
542
542
type : 'checkbox' ,
543
- dataset : { name : this . selectGroupName , key : row . _key } ,
544
- ariaChecked : String ( row . selected || false ) ,
545
- checked : ! ! row . selected ,
546
- disabled : row . disabled ,
543
+ dataset : { name : this . selectGroupName , key : dataRow . _key } ,
544
+ ariaChecked : String ( dataRow . selected || false ) ,
545
+ checked : ! ! dataRow . selected ,
546
+ disabled : dataRow . disabled ,
547
547
tabIndex : - 1 ,
548
548
} ,
549
549
} ;
@@ -553,25 +553,24 @@ export class MultipleSelectInstance {
553
553
}
554
554
555
555
const spanLabelBlock : HtmlStruct = { tagName : 'span' , props : { } } ;
556
- this . applyAsTextOrHtmlWhenEnabled ( spanLabelBlock . props , ( row as OptGroupRowData ) . label ) ;
557
-
556
+ this . applyAsTextOrHtmlWhenEnabled ( spanLabelBlock . props , ( dataRow as OptGroupRowData ) . label ) ;
558
557
const liBlock : HtmlStruct = {
559
558
tagName : 'li' ,
560
559
props : {
561
560
className : `group ${ classes } ` . trim ( ) ,
562
- tabIndex : classes . includes ( 'hide-radio' ) || row . disabled ? - 1 : 0 ,
561
+ tabIndex : classes . includes ( 'hide-radio' ) || dataRow . disabled ? - 1 : 0 ,
563
562
} ,
564
563
children : [
565
564
{
566
565
tagName : 'label' ,
567
- props : { className : `optgroup${ this . options . single || row . disabled ? ' disabled' : '' } ` } ,
566
+ props : { className : `optgroup${ this . options . single || dataRow . disabled ? ' disabled' : '' } ` } ,
568
567
children : [ itemOrGroupBlock , spanLabelBlock ] ,
569
568
} ,
570
569
] ,
571
570
} ;
572
571
573
- const customStyleRules = this . options . cssStyler ( row ) ;
574
- const customStylerStr = String ( this . options . styler ( row ) || '' ) ; // deprecated
572
+ const customStyleRules = this . options . cssStyler ( dataRow ) ;
573
+ const customStylerStr = String ( this . options . styler ( dataRow ) || '' ) ; // deprecated
575
574
if ( customStylerStr ) {
576
575
liBlock . props . style = convertStringStyleToElementStyle ( customStylerStr ) ;
577
576
}
@@ -580,52 +579,51 @@ export class MultipleSelectInstance {
580
579
}
581
580
htmlBlocks . push ( liBlock ) ;
582
581
583
- ( row as OptGroupRowData ) . children . forEach ( ( child ) => htmlBlocks . push ( ...this . initListItem ( child , 1 ) ) ) ;
582
+ ( dataRow as OptGroupRowData ) . children . forEach ( ( child ) => htmlBlocks . push ( ...this . initListItem ( child , 1 ) ) ) ;
584
583
585
584
return htmlBlocks ;
586
585
}
587
586
588
587
// - regular row -
589
- classes += row . classes || '' ;
588
+ classes += dataRow . classes || '' ;
590
589
591
590
if ( level && this . options . single ) {
592
591
classes += `option-level-${ level } ` ;
593
592
}
594
593
595
- if ( row . divider ) {
594
+ if ( dataRow . divider ) {
596
595
return [ { tagName : 'li' , props : { className : 'option-divider' } } as HtmlStruct ] ;
597
596
}
598
597
599
598
const liClasses = multiple || classes ? ( multiple + classes ) . trim ( ) : '' ;
600
- const labelClasses = `${ row . disabled ? 'disabled' : '' } ` ;
599
+ const labelClasses = `${ dataRow . disabled ? 'disabled' : '' } ` ;
601
600
const spanLabelBlock : HtmlStruct = { tagName : 'span' , props : { } } ;
602
- this . applyAsTextOrHtmlWhenEnabled ( spanLabelBlock . props , ( row as OptionRowData ) . text ) ;
603
-
601
+ this . applyAsTextOrHtmlWhenEnabled ( spanLabelBlock . props , ( dataRow as OptionRowData ) . text ) ;
604
602
const inputBlock : HtmlStruct = {
605
603
tagName : 'input' ,
606
604
props : {
607
605
type,
608
- value : encodeURI ( row . value as string ) ,
609
- dataset : { key : row . _key , name : this . selectItemName } ,
610
- ariaChecked : String ( row . selected || false ) ,
611
- checked : ! ! row . selected ,
612
- disabled : ! ! row . disabled ,
606
+ value : encodeURI ( dataRow . value as string ) ,
607
+ dataset : { key : dataRow . _key , name : this . selectItemName } ,
608
+ ariaChecked : String ( dataRow . selected || false ) ,
609
+ checked : ! ! dataRow . selected ,
610
+ disabled : ! ! dataRow . disabled ,
613
611
tabIndex : - 1 ,
614
612
} ,
615
613
} ;
616
614
617
- if ( row . selected ) {
615
+ if ( dataRow . selected ) {
618
616
inputBlock . attrs = { checked : 'checked' } ;
619
617
}
620
618
621
619
const liBlock : HtmlStruct = {
622
620
tagName : 'li' ,
623
- props : { className : liClasses , title, tabIndex : row . disabled ? - 1 : 0 , dataset : { key : row . _key } } ,
621
+ props : { className : liClasses , title, tabIndex : dataRow . disabled ? - 1 : 0 , dataset : { key : dataRow . _key } } ,
624
622
children : [ { tagName : 'label' , props : { className : labelClasses } , children : [ inputBlock , spanLabelBlock ] } ] ,
625
623
} ;
626
624
627
- const customStyleRules = this . options . cssStyler ( row ) ;
628
- const customStylerStr = String ( this . options . styler ( row ) || '' ) ; // deprecated
625
+ const customStyleRules = this . options . cssStyler ( dataRow ) ;
626
+ const customStylerStr = String ( this . options . styler ( dataRow ) || '' ) ; // deprecated
629
627
if ( customStylerStr ) {
630
628
liBlock . props . style = convertStringStyleToElementStyle ( customStylerStr ) ;
631
629
}
0 commit comments