@@ -2864,15 +2864,9 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
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 extends DisplayDensityBase implements
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
30443047 /** @hidden @internal */
30453048 public get paginator ( ) {
@@ -5089,25 +5092,25 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
50895092 * @param updateActiveInfo
50905093 */
50915094 public refreshSearch ( updateActiveInfo ?: boolean , endEdit = true ) : number {
5092- if ( this . lastSearchInfo . searchText ) {
5095+ if ( this . _lastSearchInfo . searchText ) {
50935096 this . rebuildMatchCache ( ) ;
50945097
50955098 if ( updateActiveInfo ) {
50965099 const activeInfo = this . textHighlightService . highlightGroupsMap . get ( this . id ) ;
5097- this . lastSearchInfo . matchInfoCache . forEach ( ( match , i ) => {
5100+ this . _lastSearchInfo . matchInfoCache . forEach ( ( match , i ) => {
50985101 if ( match . column === activeInfo . column &&
50995102 match . row === activeInfo . row &&
51005103 match . index === activeInfo . index &&
51015104 compareMaps ( match . metadata , activeInfo . metadata ) ) {
5102- this . lastSearchInfo . activeMatchIndex = i ;
5105+ this . _lastSearchInfo . activeMatchIndex = i ;
51035106 }
51045107 } ) ;
51055108 }
51065109
5107- return this . find ( this . lastSearchInfo . searchText ,
5110+ return this . find ( this . _lastSearchInfo . searchText ,
51085111 0 ,
5109- this . lastSearchInfo . caseSensitive ,
5110- this . lastSearchInfo . exactMatch ,
5112+ this . _lastSearchInfo . caseSensitive ,
5113+ this . _lastSearchInfo . exactMatch ,
51115114 false ,
51125115 endEdit ) ;
51135116 } else {
@@ -5124,7 +5127,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
51245127 * ```
51255128 */
51265129 public clearSearch ( ) {
5127- this . lastSearchInfo = {
5130+ this . _lastSearchInfo = {
51285131 searchText : '' ,
51295132 caseSensitive : false ,
51305133 exactMatch : false ,
@@ -7509,10 +7512,10 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
75097512 const exactMatchResolved = exactMatch ? true : false ;
75107513 let rebuildCache = false ;
75117514
7512- if ( this . lastSearchInfo . searchText !== text ||
7513- this . lastSearchInfo . caseSensitive !== caseSensitiveResolved ||
7514- this . lastSearchInfo . exactMatch !== exactMatchResolved ) {
7515- this . lastSearchInfo = {
7515+ if ( this . _lastSearchInfo . searchText !== text ||
7516+ this . _lastSearchInfo . caseSensitive !== caseSensitiveResolved ||
7517+ this . _lastSearchInfo . exactMatch !== exactMatchResolved ) {
7518+ this . _lastSearchInfo = {
75167519 searchText : text ,
75177520 activeMatchIndex : 0 ,
75187521 caseSensitive : caseSensitiveResolved ,
@@ -7524,7 +7527,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
75247527
75257528 rebuildCache = true ;
75267529 } else {
7527- this . lastSearchInfo . activeMatchIndex += increment ;
7530+ this . _lastSearchInfo . activeMatchIndex += increment ;
75287531 }
75297532
75307533 if ( rebuildCache ) {
@@ -7539,15 +7542,15 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
75397542 this . rebuildMatchCache ( ) ;
75407543 }
75417544
7542- if ( this . lastSearchInfo . activeMatchIndex >= this . lastSearchInfo . matchCount ) {
7543- this . lastSearchInfo . activeMatchIndex = 0 ;
7544- } else if ( this . lastSearchInfo . activeMatchIndex < 0 ) {
7545- this . lastSearchInfo . activeMatchIndex = this . lastSearchInfo . matchCount - 1 ;
7545+ if ( this . _lastSearchInfo . activeMatchIndex >= this . _lastSearchInfo . matchCount ) {
7546+ this . _lastSearchInfo . activeMatchIndex = 0 ;
7547+ } else if ( this . _lastSearchInfo . activeMatchIndex < 0 ) {
7548+ this . _lastSearchInfo . activeMatchIndex = this . _lastSearchInfo . matchCount - 1 ;
75467549 }
75477550
7548- if ( this . lastSearchInfo . matchCount > 0 ) {
7549- const matchInfo = this . lastSearchInfo . matchInfoCache [ this . lastSearchInfo . activeMatchIndex ] ;
7550- this . lastSearchInfo = { ...this . lastSearchInfo } ;
7551+ if ( this . _lastSearchInfo . matchCount > 0 ) {
7552+ const matchInfo = this . _lastSearchInfo . matchInfoCache [ this . _lastSearchInfo . activeMatchIndex ] ;
7553+ this . _lastSearchInfo = { ...this . _lastSearchInfo } ;
75517554
75527555 if ( scroll !== false ) {
75537556 this . scrollTo ( matchInfo . row , matchInfo . column ) ;
@@ -7564,15 +7567,15 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
75647567 this . textHighlightService . clearActiveHighlight ( this . id ) ;
75657568 }
75667569
7567- return this . lastSearchInfo . matchCount ;
7570+ return this . _lastSearchInfo . matchCount ;
75687571 }
75697572
75707573 private rebuildMatchCache ( ) {
7571- this . lastSearchInfo . matchInfoCache = [ ] ;
7574+ this . _lastSearchInfo . matchInfoCache = [ ] ;
75727575
7573- const caseSensitive = this . lastSearchInfo . caseSensitive ;
7574- const exactMatch = this . lastSearchInfo . exactMatch ;
7575- const searchText = caseSensitive ? this . lastSearchInfo . searchText : this . lastSearchInfo . searchText . toLowerCase ( ) ;
7576+ const caseSensitive = this . _lastSearchInfo . caseSensitive ;
7577+ const exactMatch = this . _lastSearchInfo . exactMatch ;
7578+ const searchText = caseSensitive ? this . _lastSearchInfo . searchText : this . _lastSearchInfo . searchText . toLowerCase ( ) ;
75767579 const data = this . filteredSortedData ;
75777580 const columnItems = this . visibleColumns . filter ( ( c ) => ! c . columnGroup ) . sort ( ( c1 , c2 ) => c1 . visibleIndex - c2 . visibleIndex ) ;
75787581
@@ -7596,7 +7599,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
75967599 metadata : new Map < string , boolean > ( [ [ 'pinned' , this . isRecordPinnedByIndex ( rowIndex ) ] ] )
75977600 } ;
75987601
7599- this . lastSearchInfo . matchInfoCache . push ( mic ) ;
7602+ this . _lastSearchInfo . matchInfoCache . push ( mic ) ;
76007603 }
76017604 } else {
76027605 let occurrenceIndex = 0 ;
@@ -7610,7 +7613,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
76107613 metadata : new Map < string , boolean > ( [ [ 'pinned' , this . isRecordPinnedByIndex ( rowIndex ) ] ] )
76117614 } ;
76127615
7613- this . lastSearchInfo . matchInfoCache . push ( mic ) ;
7616+ this . _lastSearchInfo . matchInfoCache . push ( mic ) ;
76147617
76157618 searchValue = searchValue . substring ( searchIndex + searchText . length ) ;
76167619 searchIndex = searchValue . indexOf ( searchText ) ;
@@ -7620,7 +7623,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
76207623 } ) ;
76217624 } ) ;
76227625
7623- this . lastSearchInfo . matchCount = this . lastSearchInfo . matchInfoCache . length ;
7626+ this . _lastSearchInfo . matchCount = this . _lastSearchInfo . matchInfoCache . length ;
76247627 }
76257628
76267629 // TODO: About to Move to CRUD
0 commit comments