Browse Source
			
			
			Bugfix/fix issue in activities filter component with typing (#910)
			
				* Handle filter (selecting) or search term (typing)
* Update changelog
			
			
				pull/911/head^2
			
			
		 
		
			
				
					
						 Thomas Kaul
					
					4 years ago
						Thomas Kaul
					
					4 years ago
					
						
							committed by
							
								 GitHub
								GitHub
							
						 
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: 4AEE18F83AFDEB23
						
					
				
			
		
		
		
	
		
			
				 2 changed files with 
15 additions and 
3 deletions
			 
			
		 
		
			
				- 
					
					
					 
					CHANGELOG.md
				
- 
					
					
					 
					libs/ui/src/lib/activities-filter/activities-filter.component.ts
				
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. | 
			
		
	
		
			
				
					|  |  |  | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | 
			
		
	
		
			
				
					|  |  |  | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | ## Unreleased | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | ### Fixed | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | - Fixed an issue in the activities filter component (typing a search term) | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | ## 1.147.0 - 10.05.2022 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | ### Changed | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -48,8 +48,8 @@ export class ActivitiesFilterComponent implements OnChanges, OnDestroy { | 
			
		
	
		
			
				
					|  |  |  |   public constructor() { | 
			
		
	
		
			
				
					|  |  |  |     this.searchControl.valueChanges | 
			
		
	
		
			
				
					|  |  |  |       .pipe(takeUntil(this.unsubscribeSubject)) | 
			
		
	
		
			
				
					|  |  |  |       .subscribe((currentFilter: Filter) => { | 
			
		
	
		
			
				
					|  |  |  |         if (currentFilter) { | 
			
		
	
		
			
				
					|  |  |  |       .subscribe((filterOrSearchTerm: Filter | string) => { | 
			
		
	
		
			
				
					|  |  |  |         if (filterOrSearchTerm) { | 
			
		
	
		
			
				
					|  |  |  |           this.filters$.next( | 
			
		
	
		
			
				
					|  |  |  |             this.allFilters | 
			
		
	
		
			
				
					|  |  |  |               .filter((filter) => { | 
			
		
	
	
		
			
				
					|  |  | @ -59,9 +59,15 @@ export class ActivitiesFilterComponent implements OnChanges, OnDestroy { | 
			
		
	
		
			
				
					|  |  |  |                 }); | 
			
		
	
		
			
				
					|  |  |  |               }) | 
			
		
	
		
			
				
					|  |  |  |               .filter((filter) => { | 
			
		
	
		
			
				
					|  |  |  |                 if (typeof filterOrSearchTerm === 'string') { | 
			
		
	
		
			
				
					|  |  |  |                   return filter.label | 
			
		
	
		
			
				
					|  |  |  |                     .toLowerCase() | 
			
		
	
		
			
				
					|  |  |  |                     .startsWith(filterOrSearchTerm.toLowerCase()); | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                 return filter.label | 
			
		
	
		
			
				
					|  |  |  |                   .toLowerCase() | 
			
		
	
		
			
				
					|  |  |  |                   .startsWith(currentFilter.label.toLowerCase()); | 
			
		
	
		
			
				
					|  |  |  |                   .startsWith(filterOrSearchTerm?.label?.toLowerCase()); | 
			
		
	
		
			
				
					|  |  |  |               }) | 
			
		
	
		
			
				
					|  |  |  |               .sort((a, b) => a.label.localeCompare(b.label)) | 
			
		
	
		
			
				
					|  |  |  |           ); | 
			
		
	
	
		
			
				
					|  |  | 
 |