forked from angular-architects/ngrx-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dbd4152
commit c6334de
Showing
34 changed files
with
1,607 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"files.exclude": { | ||
"**/.git": true, | ||
"**/.svn": true, | ||
"**/.hg": true, | ||
"**/CVS": true, | ||
"**/.DS_Store": true, | ||
"**/Thumbs.db": true | ||
}, | ||
"hide-files.files": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
.actions{ | ||
display: flex; | ||
align-items: center; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,23 @@ | ||
<ul> | ||
<li><a routerLink="/todo">Todo - DevTools Showcase</a></li> | ||
<li><a routerLink="/flight-search">Flight Search - withRedux Showcase</a></li> | ||
</ul> | ||
<demo-sidebar-cmp> | ||
|
||
<router-outlet /> | ||
<div class="nav"> | ||
<mat-nav-list> | ||
<a mat-list-item routerLink="/todo">DevTools</a> | ||
<a mat-list-item routerLink="/flight-search">withRedux</a> | ||
<a mat-list-item routerLink="/flight-search-data-service-simple">withDataService (Simple)</a> | ||
<a mat-list-item routerLink="/flight-search-data-service-dynamic">withDataService (Dynamic)</a> | ||
|
||
</mat-nav-list> | ||
</div> | ||
|
||
<div class="content"> | ||
<mat-toolbar color="primary"> | ||
<span>NGRX Toolkit Demo</span> | ||
</mat-toolbar> | ||
|
||
<div class="app-container"> | ||
<router-outlet></router-outlet> | ||
</div> | ||
</div> | ||
|
||
</demo-sidebar-cmp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
import { ApplicationConfig } from '@angular/core'; | ||
import { provideRouter } from '@angular/router'; | ||
import { ApplicationConfig, importProvidersFrom } from '@angular/core'; | ||
import { provideRouter, withComponentInputBinding } from '@angular/router'; | ||
import { appRoutes } from './app.routes'; | ||
import { provideClientHydration } from '@angular/platform-browser'; | ||
import { provideAnimations } from '@angular/platform-browser/animations'; | ||
import { provideHttpClient } from '@angular/common/http'; | ||
import { LayoutModule } from '@angular/cdk/layout'; | ||
|
||
export const appConfig: ApplicationConfig = { | ||
providers: [ | ||
provideClientHydration(), | ||
provideRouter(appRoutes), | ||
provideRouter(appRoutes, | ||
withComponentInputBinding()), | ||
provideAnimations(), | ||
provideHttpClient(), | ||
importProvidersFrom(LayoutModule), | ||
|
||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
import { Route } from '@angular/router'; | ||
import { TodoComponent } from './todo/todo.component'; | ||
import { FlightSearchComponent } from './flight-search/flight-search.component'; | ||
import { FlightSearchSimpleComponent } from './flight-search-data-service-simple/flight-search-simple.component'; | ||
import { FlightEditSimpleComponent } from './flight-search-data-service-simple/flight-edit-simple.component'; | ||
import { FlightSearchDynamicComponent } from './flight-search-data-service-dynamic/flight-search.component'; | ||
import { FlightEditDynamicComponent } from './flight-search-data-service-dynamic/flight-edit.component'; | ||
|
||
export const appRoutes: Route[] = [ | ||
{ path: 'todo', component: TodoComponent }, | ||
{ path: 'flight-search', component: FlightSearchComponent }, | ||
{ path: 'flight-search-data-service-simple', component: FlightSearchSimpleComponent }, | ||
{ path: 'flight-edit-simple/:id', component: FlightEditSimpleComponent }, | ||
{ path: 'flight-search-data-service-dynamic', component: FlightSearchDynamicComponent }, | ||
{ path: 'flight-edit-dynamic/:id', component: FlightEditDynamicComponent }, | ||
|
||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.sidenav-container { | ||
height: 100%; | ||
} | ||
|
||
.sidenav { | ||
width: 300px; | ||
} | ||
|
||
.sidenav .mat-toolbar { | ||
background: inherit; | ||
} | ||
|
||
.mat-toolbar.mat-primary { | ||
position: sticky; | ||
top: 0; | ||
z-index: 1; | ||
} | ||
|
||
.app-container { | ||
padding: 20px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<mat-sidenav-container class="sidenav-container"> | ||
<mat-sidenav #drawer class="sidenav" fixedInViewport | ||
[attr.role]="(isHandset$ | async) ? 'dialog' : 'navigation'" | ||
[mode]="(isHandset$ | async) ? 'over' : 'side'" | ||
[opened]="(isHandset$ | async) === false"> | ||
<mat-toolbar>Menu</mat-toolbar> | ||
|
||
<ng-content select=".nav"></ng-content> | ||
|
||
</mat-sidenav> | ||
<mat-sidenav-content> | ||
|
||
<ng-content select=".content"></ng-content> | ||
|
||
</mat-sidenav-content> | ||
</mat-sidenav-container> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; | ||
import { CommonModule } from '@angular/common'; | ||
import { Component, Inject } from '@angular/core'; | ||
import { MatButtonModule } from '@angular/material/button'; | ||
import { MatIconModule } from '@angular/material/icon'; | ||
import { MatListModule } from '@angular/material/list'; | ||
import { MatSidenavModule } from '@angular/material/sidenav'; | ||
import { MatToolbarModule } from '@angular/material/toolbar'; | ||
import { RouterModule } from '@angular/router'; | ||
import { map, shareReplay } from 'rxjs'; | ||
|
||
@Component({ | ||
standalone: true, | ||
selector: 'demo-sidebar-cmp', | ||
imports: [ | ||
RouterModule, | ||
CommonModule, | ||
MatToolbarModule, | ||
MatButtonModule, | ||
MatSidenavModule, | ||
MatIconModule, | ||
MatListModule, | ||
], | ||
templateUrl: './sidebar.component.html', | ||
styleUrls: ['./sidebar.component.css'] | ||
}) | ||
export class SidebarComponent { | ||
isHandset$ = this.breakpointObserver.observe(Breakpoints.Handset) | ||
.pipe( | ||
map(result => result.matches), | ||
shareReplay() | ||
); | ||
|
||
constructor( | ||
@Inject(BreakpointObserver) private breakpointObserver: BreakpointObserver) { | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
apps/demo/src/app/flight-search-data-service-dynamic/flight-booking.store.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { FlightService } from '../shared/flight.service'; | ||
|
||
import { | ||
signalStore, type, | ||
} from '@ngrx/signals'; | ||
|
||
import { withEntities } from '@ngrx/signals/entities'; | ||
import { withCallState, withDataService, withUndoRedo } from 'ngrx-toolkit'; | ||
import { Flight } from '../shared/flight'; | ||
|
||
export const FlightBookingStore = signalStore( | ||
{ providedIn: 'root' }, | ||
withCallState({ | ||
collection: 'flight' | ||
}), | ||
withEntities({ | ||
entity: type<Flight>(), | ||
collection: 'flight' | ||
}), | ||
withDataService({ | ||
dataServiceType: FlightService, | ||
filter: { from: 'Paris', to: 'New York' }, | ||
collection: 'flight' | ||
}), | ||
withUndoRedo({ | ||
collections: ['flight'], | ||
}), | ||
); |
Oops, something went wrong.