@@ -4,17 +4,20 @@ import {
44 ViewChild ,
55 HostBinding ,
66 inject ,
7- signal
7+ signal ,
8+ computed ,
89} from '@angular/core' ;
910import { Router , NavigationStart , NavigationEnd , RouterLinkActive , RouterLink , RouterOutlet } from '@angular/router' ;
1011import { filter } from 'rxjs/operators' ;
1112import { DocumentDirection , PageHeaderComponent } from './pageHeading/pageHeading.component' ;
1213import { CommonModule , registerLocaleData } from '@angular/common' ;
14+ import { FormsModule } from '@angular/forms' ;
1315import { PropertiesPanelComponent } from './properties-panel/properties-panel.component' ;
1416import { PropertyChangeService } from './properties-panel/property-change.service' ;
1517import { IGX_NAVIGATION_DRAWER_DIRECTIVES , IgxNavigationDrawerComponent } from 'igniteui-angular/navigation-drawer' ;
1618import { IgxIconComponent , IgxIconService } from 'igniteui-angular/icon' ;
1719import { IgxRippleDirective } from 'igniteui-angular/directives' ;
20+ import { IgxInputGroupComponent , IgxInputDirective , IgxPrefixDirective , IgxSuffixDirective } from 'igniteui-angular/input-group' ;
1821
1922// I18n
2023import { registerI18n } from 'igniteui-angular' ;
@@ -38,12 +41,17 @@ import localeHant from '@angular/common/locales/zh-Hant';
3841 IgxNavigationDrawerComponent ,
3942 IGX_NAVIGATION_DRAWER_DIRECTIVES ,
4043 CommonModule ,
44+ FormsModule ,
4145 RouterLinkActive ,
4246 RouterLink ,
4347 IgxIconComponent ,
4448 PageHeaderComponent ,
4549 RouterOutlet ,
4650 IgxRippleDirective ,
51+ IgxInputGroupComponent ,
52+ IgxInputDirective ,
53+ IgxPrefixDirective ,
54+ IgxSuffixDirective ,
4755 PropertiesPanelComponent ,
4856 ]
4957} )
@@ -56,6 +64,9 @@ export class AppComponent implements OnInit {
5664
5765 public dirMode = signal < 'ltr' | 'rtl' > ( 'ltr' ) ;
5866
67+ // Filter for navigation items
68+ public filterText = signal ( '' ) ;
69+
5970 // This method will be triggered by PageHeaderComponent's toggleDirection event
6071 public onDirectionToggle ( dir : DocumentDirection ) : void {
6172 this . dirMode . set ( dir ) ;
@@ -777,6 +788,31 @@ export class AppComponent implements OnInit {
777788 }
778789 ] . sort ( ( componentLink1 , componentLink2 ) => componentLink1 . name > componentLink2 . name ? 1 : - 1 ) ;
779790
791+ // Computed filtered arrays
792+ public filteredComponentLinks = computed ( ( ) => {
793+ const filterValue = this . filterText ( ) . toLowerCase ( ) ;
794+ if ( ! filterValue ) {
795+ return this . componentLinks ;
796+ }
797+ return this . componentLinks . filter ( item => item . name . toLowerCase ( ) . includes ( filterValue ) ) ;
798+ } ) ;
799+
800+ public filteredDirectiveLinks = computed ( ( ) => {
801+ const filterValue = this . filterText ( ) . toLowerCase ( ) ;
802+ if ( ! filterValue ) {
803+ return this . directiveLinks ;
804+ }
805+ return this . directiveLinks . filter ( item => item . name . toLowerCase ( ) . includes ( filterValue ) ) ;
806+ } ) ;
807+
808+ public filteredStyleLinks = computed ( ( ) => {
809+ const filterValue = this . filterText ( ) . toLowerCase ( ) ;
810+ if ( ! filterValue ) {
811+ return this . styleLinks ;
812+ }
813+ return this . styleLinks . filter ( item => item . name . toLowerCase ( ) . includes ( filterValue ) ) ;
814+ } ) ;
815+
780816 constructor ( private router : Router , private iconService : IgxIconService ) {
781817 iconService . setFamily ( 'fa-solid' , { className : 'fa' , type : 'font' , prefix : 'fa-' } ) ;
782818 iconService . setFamily ( 'fa-brands' , { className : 'fab' , type : 'font' } ) ;
0 commit comments