| 
									
										
										
										
											2015-12-07 09:58:04 -07:00
										 |  |  | // #docplaster
 | 
					
						
							|  |  |  | // #docregion full
 | 
					
						
							| 
									
										
										
										
											2016-03-25 16:03:53 -07:00
										 |  |  | import 'package:angular2/core.dart'; | 
					
						
							| 
									
										
										
										
											2015-12-07 09:58:04 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-28 13:15:51 -07:00
										 |  |  | @Directive(selector: '[myHighlight]') | 
					
						
							|  |  |  | // #docregion class
 | 
					
						
							| 
									
										
										
										
											2016-05-06 07:42:01 -07:00
										 |  |  | class HighlightDirective { | 
					
						
							| 
									
										
										
										
											2015-12-07 09:58:04 -07:00
										 |  |  |   String _defaultColor = 'red'; | 
					
						
							| 
									
										
										
										
											2016-05-06 07:42:01 -07:00
										 |  |  |   final dynamic _el; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   HighlightDirective(ElementRef elRef) : _el = elRef.nativeElement; | 
					
						
							| 
									
										
										
										
											2016-06-28 13:15:51 -07:00
										 |  |  |   // #enddocregion class
 | 
					
						
							| 
									
										
										
										
											2016-05-06 07:42:01 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-07 09:58:04 -07:00
										 |  |  |   // #docregion defaultColor
 | 
					
						
							| 
									
										
										
										
											2016-06-28 13:15:51 -07:00
										 |  |  |   @Input() | 
					
						
							|  |  |  |   set defaultColor(String colorName) { | 
					
						
							| 
									
										
										
										
											2015-12-07 09:58:04 -07:00
										 |  |  |     _defaultColor = (colorName ?? _defaultColor); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   // #enddocregion defaultColor
 | 
					
						
							| 
									
										
										
										
											2016-06-28 13:15:51 -07:00
										 |  |  |   // #docregion class
 | 
					
						
							| 
									
										
										
										
											2015-12-07 09:58:04 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-06 07:42:01 -07:00
										 |  |  |   // #docregion color
 | 
					
						
							| 
									
										
										
										
											2016-06-28 13:15:51 -07:00
										 |  |  |   @Input('myHighlight') | 
					
						
							|  |  |  |   String highlightColor; | 
					
						
							| 
									
										
										
										
											2016-05-06 07:42:01 -07:00
										 |  |  |   // #enddocregion color
 | 
					
						
							| 
									
										
										
										
											2016-06-28 13:15:51 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-06 07:42:01 -07:00
										 |  |  |   // #docregion mouse-enter
 | 
					
						
							| 
									
										
										
										
											2016-06-28 13:15:51 -07:00
										 |  |  |   @HostListener('mouseenter') | 
					
						
							|  |  |  |   void onMouseEnter() => _highlight(highlightColor ?? _defaultColor); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-06 07:42:01 -07:00
										 |  |  |   // #enddocregion mouse-enter
 | 
					
						
							| 
									
										
										
										
											2016-06-28 13:15:51 -07:00
										 |  |  |   @HostListener('mouseleave') | 
					
						
							|  |  |  |   void onMouseLeave() => _highlight(); | 
					
						
							| 
									
										
										
										
											2015-12-07 09:58:04 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-06 07:42:01 -07:00
										 |  |  |   void _highlight([String color]) { | 
					
						
							| 
									
										
										
										
											2016-06-28 13:15:51 -07:00
										 |  |  |     if (_el != null) _el.style.backgroundColor = color; | 
					
						
							| 
									
										
										
										
											2015-12-07 09:58:04 -07:00
										 |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2016-06-28 13:15:51 -07:00
										 |  |  | // #enddocregion class
 | 
					
						
							| 
									
										
										
										
											2015-12-07 09:58:04 -07:00
										 |  |  | // #enddocregion full
 | 
					
						
							| 
									
										
										
										
											2016-05-06 07:42:01 -07:00
										 |  |  | /* | 
					
						
							|  |  |  | // #docregion highlight
 | 
					
						
							|  |  |  | @Input() String myHighlight; | 
					
						
							|  |  |  | // #enddocregion highlight
 | 
					
						
							|  |  |  | */ |