@@ -2864,15 +2864,9 @@ export abstract class IgxGridBaseDirective implements GridType,
28642864 /**
28652865 * Represents the last search information.
28662866 */
2867- public lastSearchInfo : ISearchInfo = {
2868- searchText : '' ,
2869- caseSensitive : false ,
2870- exactMatch : false ,
2871- activeMatchIndex : 0 ,
2872- matchInfoCache : [ ] ,
2873- matchCount : 0 ,
2874- content : ''
2875- } ;
2867+ public get lastSearchInfo ( ) : ISearchInfo {
2868+ return this . _lastSearchInfo ;
2869+ }
28762870
28772871 /**
28782872 * @hidden @internal
@@ -3040,6 +3034,15 @@ export abstract class IgxGridBaseDirective implements GridType,
30403034 protected _filterStrategy : IFilteringStrategy = new FilteringStrategy ( ) ;
30413035 protected _autoGeneratedCols = [ ] ;
30423036 protected _dataView = [ ] ;
3037+ protected _lastSearchInfo : ISearchInfo = {
3038+ searchText : '' ,
3039+ caseSensitive : false ,
3040+ exactMatch : false ,
3041+ activeMatchIndex : 0 ,
3042+ matchInfoCache : [ ] ,
3043+ matchCount : 0 ,
3044+ content : ''
3045+ } ;
30433046 protected gridComputedStyles ;
30443047
30453048 /** @hidden @internal */
@@ -5097,25 +5100,25 @@ export abstract class IgxGridBaseDirective implements GridType,
50975100 * @param updateActiveInfo
50985101 */
50995102 public refreshSearch ( updateActiveInfo ?: boolean , endEdit = true ) : number {
5100- if ( this . lastSearchInfo . searchText ) {
5103+ if ( this . _lastSearchInfo . searchText ) {
51015104 this . rebuildMatchCache ( ) ;
51025105
51035106 if ( updateActiveInfo ) {
51045107 const activeInfo = this . textHighlightService . highlightGroupsMap . get ( this . id ) ;
5105- this . lastSearchInfo . matchInfoCache . forEach ( ( match , i ) => {
5108+ this . _lastSearchInfo . matchInfoCache . forEach ( ( match , i ) => {
51065109 if ( match . column === activeInfo . column &&
51075110 match . row === activeInfo . row &&
51085111 match . index === activeInfo . index &&
51095112 compareMaps ( match . metadata , activeInfo . metadata ) ) {
5110- this . lastSearchInfo . activeMatchIndex = i ;
5113+ this . _lastSearchInfo . activeMatchIndex = i ;
51115114 }
51125115 } ) ;
51135116 }
51145117
5115- return this . find ( this . lastSearchInfo . searchText ,
5118+ return this . find ( this . _lastSearchInfo . searchText ,
51165119 0 ,
5117- this . lastSearchInfo . caseSensitive ,
5118- this . lastSearchInfo . exactMatch ,
5120+ this . _lastSearchInfo . caseSensitive ,
5121+ this . _lastSearchInfo . exactMatch ,
51195122 false ,
51205123 endEdit ) ;
51215124 } else {
@@ -5132,7 +5135,7 @@ export abstract class IgxGridBaseDirective implements GridType,
51325135 * ```
51335136 */
51345137 public clearSearch ( ) {
5135- this . lastSearchInfo = {
5138+ this . _lastSearchInfo = {
51365139 searchText : '' ,
51375140 caseSensitive : false ,
51385141 exactMatch : false ,
@@ -7524,10 +7527,10 @@ export abstract class IgxGridBaseDirective implements GridType,
75247527 const exactMatchResolved = exactMatch ? true : false ;
75257528 let rebuildCache = false ;
75267529
7527- if ( this . lastSearchInfo . searchText !== text ||
7528- this . lastSearchInfo . caseSensitive !== caseSensitiveResolved ||
7529- this . lastSearchInfo . exactMatch !== exactMatchResolved ) {
7530- this . lastSearchInfo = {
7530+ if ( this . _lastSearchInfo . searchText !== text ||
7531+ this . _lastSearchInfo . caseSensitive !== caseSensitiveResolved ||
7532+ this . _lastSearchInfo . exactMatch !== exactMatchResolved ) {
7533+ this . _lastSearchInfo = {
75317534 searchText : text ,
75327535 activeMatchIndex : 0 ,
75337536 caseSensitive : caseSensitiveResolved ,
@@ -7539,7 +7542,7 @@ export abstract class IgxGridBaseDirective implements GridType,
75397542
75407543 rebuildCache = true ;
75417544 } else {
7542- this . lastSearchInfo . activeMatchIndex += increment ;
7545+ this . _lastSearchInfo . activeMatchIndex += increment ;
75437546 }
75447547
75457548 if ( rebuildCache ) {
@@ -7554,15 +7557,15 @@ export abstract class IgxGridBaseDirective implements GridType,
75547557 this . rebuildMatchCache ( ) ;
75557558 }
75567559
7557- if ( this . lastSearchInfo . activeMatchIndex >= this . lastSearchInfo . matchCount ) {
7558- this . lastSearchInfo . activeMatchIndex = 0 ;
7559- } else if ( this . lastSearchInfo . activeMatchIndex < 0 ) {
7560- this . lastSearchInfo . activeMatchIndex = this . lastSearchInfo . matchCount - 1 ;
7560+ if ( this . _lastSearchInfo . activeMatchIndex >= this . _lastSearchInfo . matchCount ) {
7561+ this . _lastSearchInfo . activeMatchIndex = 0 ;
7562+ } else if ( this . _lastSearchInfo . activeMatchIndex < 0 ) {
7563+ this . _lastSearchInfo . activeMatchIndex = this . _lastSearchInfo . matchCount - 1 ;
75617564 }
75627565
7563- if ( this . lastSearchInfo . matchCount > 0 ) {
7564- const matchInfo = this . lastSearchInfo . matchInfoCache [ this . lastSearchInfo . activeMatchIndex ] ;
7565- this . lastSearchInfo = { ...this . lastSearchInfo } ;
7566+ if ( this . _lastSearchInfo . matchCount > 0 ) {
7567+ const matchInfo = this . _lastSearchInfo . matchInfoCache [ this . _lastSearchInfo . activeMatchIndex ] ;
7568+ this . _lastSearchInfo = { ...this . _lastSearchInfo } ;
75667569
75677570 if ( scroll !== false ) {
75687571 this . scrollTo ( matchInfo . row , matchInfo . column ) ;
@@ -7579,15 +7582,15 @@ export abstract class IgxGridBaseDirective implements GridType,
75797582 this . textHighlightService . clearActiveHighlight ( this . id ) ;
75807583 }
75817584
7582- return this . lastSearchInfo . matchCount ;
7585+ return this . _lastSearchInfo . matchCount ;
75837586 }
75847587
75857588 private rebuildMatchCache ( ) {
7586- this . lastSearchInfo . matchInfoCache = [ ] ;
7589+ this . _lastSearchInfo . matchInfoCache = [ ] ;
75877590
7588- const caseSensitive = this . lastSearchInfo . caseSensitive ;
7589- const exactMatch = this . lastSearchInfo . exactMatch ;
7590- const searchText = caseSensitive ? this . lastSearchInfo . searchText : this . lastSearchInfo . searchText . toLowerCase ( ) ;
7591+ const caseSensitive = this . _lastSearchInfo . caseSensitive ;
7592+ const exactMatch = this . _lastSearchInfo . exactMatch ;
7593+ const searchText = caseSensitive ? this . _lastSearchInfo . searchText : this . _lastSearchInfo . searchText . toLowerCase ( ) ;
75917594 const data = this . filteredSortedData ;
75927595 const columnItems = this . visibleColumns . filter ( ( c ) => ! c . columnGroup ) . sort ( ( c1 , c2 ) => c1 . visibleIndex - c2 . visibleIndex ) ;
75937596
@@ -7611,7 +7614,7 @@ export abstract class IgxGridBaseDirective implements GridType,
76117614 metadata : new Map < string , boolean > ( [ [ 'pinned' , this . isRecordPinnedByIndex ( rowIndex ) ] ] )
76127615 } ;
76137616
7614- this . lastSearchInfo . matchInfoCache . push ( mic ) ;
7617+ this . _lastSearchInfo . matchInfoCache . push ( mic ) ;
76157618 }
76167619 } else {
76177620 let occurrenceIndex = 0 ;
@@ -7625,7 +7628,7 @@ export abstract class IgxGridBaseDirective implements GridType,
76257628 metadata : new Map < string , boolean > ( [ [ 'pinned' , this . isRecordPinnedByIndex ( rowIndex ) ] ] )
76267629 } ;
76277630
7628- this . lastSearchInfo . matchInfoCache . push ( mic ) ;
7631+ this . _lastSearchInfo . matchInfoCache . push ( mic ) ;
76297632
76307633 searchValue = searchValue . substring ( searchIndex + searchText . length ) ;
76317634 searchIndex = searchValue . indexOf ( searchText ) ;
@@ -7635,7 +7638,7 @@ export abstract class IgxGridBaseDirective implements GridType,
76357638 } ) ;
76367639 } ) ;
76377640
7638- this . lastSearchInfo . matchCount = this . lastSearchInfo . matchInfoCache . length ;
7641+ this . _lastSearchInfo . matchCount = this . _lastSearchInfo . matchInfoCache . length ;
76397642 }
76407643
76417644 private updateDefaultRowHeight ( ) {
0 commit comments