@@ -3,44 +3,44 @@ import 'igniteui-webcomponents/themes/light/bootstrap.css';
33import "igniteui-webcomponents-grids/grids/themes/light/bootstrap.css" ;
44
55import { IgcGridComponent } from 'igniteui-webcomponents-grids/grids' ;
6- import { defineComponents , IgcInputComponent , IgcChipComponent , IgcIconComponent , IgcIconButtonComponent , registerIconFromText } from 'igniteui-webcomponents' ;
6+ import { defineComponents , IgcInputComponent , IgcChipComponent , IgcIconComponent , IgcIconButtonComponent , registerIconFromText } from 'igniteui-webcomponents' ;
77import { MarketData } from './MarketData' ;
88
99defineComponents ( IgcInputComponent , IgcChipComponent , IgcIconComponent , IgcIconButtonComponent ) ;
1010
1111export class Sample {
1212
1313 private grid : IgcGridComponent ;
14-
1514 private searchBox : IgcInputComponent ;
16-
15+ private searchIcon : IgcIconComponent ;
1716 private clearIcon : IgcIconComponent ;
1817 private nextIconButton : IgcIconButtonComponent ;
1918 private prevIconButton : IgcIconButtonComponent ;
20-
2119 private caseSensitiveChip : IgcChipComponent ;
2220 private exactMatchChip : IgcChipComponent ;
23-
2421 private data : MarketData ;
25-
2622 private _bind : ( ) => void ;
2723
2824 constructor ( ) {
2925 var grid = this . grid = document . getElementById ( 'grid' ) as IgcGridComponent ;
30-
26+
3127 this . nextSearch = this . nextSearch . bind ( this ) ;
3228 this . prevSearch = this . prevSearch . bind ( this ) ;
3329 this . clearSearch = this . clearSearch . bind ( this ) ;
30+
3431
3532 const prevIconText = "<svg width='24' height='24' viewBox='0 0 24 24'><path d='M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z'></path></svg>" ;
3633 const nextIconText = "<svg width='24' height='24' viewBox='0 0 24 24'><path d='M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z'></path></svg>" ;
3734 const clearIconText = "<svg width='24' height='24' viewBox='0 0 24 24' title='Clear'><path d='M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'></path></svg>" ;
38-
35+ const searchIconText = "<svg width='24' height='24' viewBox='0 0 24 24'><path d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z' /></svg>" ;
36+
3937 registerIconFromText ( "prev" , prevIconText , "material" ) ;
4038 registerIconFromText ( "next" , nextIconText , "material" ) ;
4139 registerIconFromText ( "clear" , clearIconText , "material" ) ;
40+ registerIconFromText ( "search" , searchIconText , "material" ) ;
41+
42+ var searchIcon = this . searchIcon = document . getElementById ( 'searchIcon' ) as IgcIconComponent ;
4243
43- var clearIcon = this . clearIcon = document . getElementById ( 'clearIcon' ) as IgcIconComponent ;
4444
4545 var nextIconButton = this . nextIconButton = document . getElementById ( 'nextIconBtn' ) as IgcIconButtonComponent ;
4646 var prevIconButton = this . prevIconButton = document . getElementById ( 'prevIconBtn' ) as IgcIconButtonComponent ;
@@ -56,9 +56,13 @@ export class Sample {
5656 grid . data = this . data ;
5757
5858 searchBox . addEventListener ( "keydown" , ( evt ) => { this . onSearchKeydown ( evt ) ; } ) ;
59+ this . searchBox . addEventListener ( "igcInput" , ( evt ) => {
60+ this . searchIcon . name = evt . detail ? 'clear' : 'search' ;
61+ this . grid . findNext ( evt . detail , this . caseSensitiveChip . selected , this . exactMatchChip . selected ) ;
62+ } ) ;
5963 nextIconButton . addEventListener ( "click" , this . nextSearch ) ;
6064 prevIconButton . addEventListener ( "click" , this . prevSearch ) ;
61- clearIcon . addEventListener ( "click" , this . clearSearch ) ;
65+ searchIcon . addEventListener ( "click" , this . clearSearch ) ;
6266 }
6367 this . _bind ( ) ;
6468 }
@@ -83,7 +87,8 @@ export class Sample {
8387
8488 public clearSearch ( ) {
8589 this . searchBox . value = "" ;
86- this . grid . clearSearch ( ) ;
90+ this . grid . clearSearch ( ) ;
91+ this . searchIcon . name = 'search' ;
8792 }
8893}
8994
0 commit comments