File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed
Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,11 @@ import { ItemClickEvent } from "./context-menu.types";
3333 ` ,
3434 styles : [ `
3535 :host {
36- grid-template-columns: 1rem 1fr max-content;
36+ grid-template-columns: 1fr max-content;
37+
38+ &[icon], &[type="checkbox"], &[type="radio"] {
39+ grid-template-columns: 1rem 1fr max-content;
40+ }
3741 }
3842 ` ]
3943} )
Original file line number Diff line number Diff line change @@ -47,11 +47,6 @@ export class ContextMenuComponent implements OnChanges, AfterViewInit {
4747 @HostBinding ( "attr.tabindex" ) tabindex = "-1" ;
4848 @HostBinding ( "style.left.px" ) get leftPosition ( ) { return this . position . left ; }
4949 @HostBinding ( "style.top.px" ) get topPosition ( ) { return this . position . top ; }
50-
51- /**
52- * @todo - convert to getter in v6, should resolve expression has changed
53- * after switching to on OnPush Change Detection Strategy
54- */
5550 @HostBinding ( "class.cds--menu--with-icons" ) iconClass = false ;
5651
5752 constructor ( protected elementRef : ElementRef ) { }
@@ -66,8 +61,8 @@ export class ContextMenuComponent implements OnChanges, AfterViewInit {
6661 setTimeout ( ( ) => {
6762 const nativeElement = this . elementRef . nativeElement ;
6863 if ( nativeElement ) {
69- this . iconClass = ! ! nativeElement
70- . querySelector ( ".cds--menu-item .cds--menu-item__icon svg" ) ;
64+ this . iconClass = ! ! this . elementRef . nativeElement
65+ . querySelectorAll ( ".cds--menu-item[icon], .cds--menu-item[type='checkbox'], .cds--menu-item[type='radio']" ) . length ;
7166 }
7267 } ) ;
7368 }
You can’t perform that action at this time.
0 commit comments