From 28661221147ed54e6949a8e9f73a48265d6941d7 Mon Sep 17 00:00:00 2001 From: insanity Date: Thu, 17 May 2018 17:30:23 +0900 Subject: [PATCH] test --- src/app/pages/home/home-page.component.html | 10 ++++---- src/app/pages/pages-animation.ts | 23 +++++++++++++++++++ src/app/pages/pages-routing.module.ts | 4 ++-- src/app/pages/pages.component.html | 4 ++-- src/app/pages/pages.component.ts | 14 +++++++---- .../component/detail/detail.component.ts | 3 +-- .../probe/component/list/list.component.ts | 3 --- 7 files changed, 43 insertions(+), 18 deletions(-) create mode 100644 src/app/pages/pages-animation.ts diff --git a/src/app/pages/home/home-page.component.html b/src/app/pages/home/home-page.component.html index 274a118..d0c3bd2 100644 --- a/src/app/pages/home/home-page.component.html +++ b/src/app/pages/home/home-page.component.html @@ -1,9 +1,9 @@
-
-
-
-

Home works

-
+
+
+
+

Home works

+
\ No newline at end of file diff --git a/src/app/pages/pages-animation.ts b/src/app/pages/pages-animation.ts new file mode 100644 index 0000000..feffd96 --- /dev/null +++ b/src/app/pages/pages-animation.ts @@ -0,0 +1,23 @@ +import { + trigger, + animate, + transition, + style, + query, + stagger, + keyframes +} from '@angular/animations'; + +export const fadeAnimation = trigger('fadeAnimation', [ + transition('* => *', [ + + query(':enter', style({ opacity: 0 }), {optional: true}), + + query(':enter', stagger('300ms', [ + animate('.6s ease-in', keyframes([ + style({opacity: 0, transform: 'translateY(-75%)', offset: 0}), + style({opacity: .5, transform: 'translateY(35px)', offset: 0.3}), + style({opacity: 1, transform: 'translateY(0)', offset: 1.0}), + ]))]), {optional: true}) + ]) +]); diff --git a/src/app/pages/pages-routing.module.ts b/src/app/pages/pages-routing.module.ts index 32c8f83..dac7098 100644 --- a/src/app/pages/pages-routing.module.ts +++ b/src/app/pages/pages-routing.module.ts @@ -8,8 +8,8 @@ const routes: Routes = [ component: PagesComponent, children: [ { path: '', redirectTo: 'home' }, - { path: 'home', loadChildren: './home/home-page.module#HomePageModule' }, - { path: 'probe', loadChildren: './probe/probe-page.module#ProbePageModule' }, + { path: 'home', loadChildren: './home/home-page.module#HomePageModule', data: { animation: 'home'} }, + { path: 'probe', loadChildren: './probe/probe-page.module#ProbePageModule', data: { animation: 'probe'} }, // { path: 'sensors', loadChildren: './sensors/sensors-page.module#SensorsPageModule' }, // { path: 'sensor', loadChildren: './sensor/sensor-page.module#SensorPageModule' }, // { path: 'map', loadChildren: './infra/infra-page.module#InfraPageModule' }, diff --git a/src/app/pages/pages.component.html b/src/app/pages/pages.component.html index 01e5012..085fe45 100644 --- a/src/app/pages/pages.component.html +++ b/src/app/pages/pages.component.html @@ -20,8 +20,8 @@
-
- +
+
diff --git a/src/app/pages/pages.component.ts b/src/app/pages/pages.component.ts index 95c2f20..b809fef 100644 --- a/src/app/pages/pages.component.ts +++ b/src/app/pages/pages.component.ts @@ -1,7 +1,7 @@ import { Component, AfterViewInit, ElementRef, Renderer, ViewChild, OnDestroy, OnInit, NgZone } from '@angular/core'; import { ScrollPanel } from 'primeng/primeng'; import { Router } from '@angular/router'; - +import { fadeAnimation } from './pages-animation'; enum MenuOrientation { STATIC, OVERLAY, @@ -12,7 +12,8 @@ enum MenuOrientation { @Component({ selector: 'of-pages', templateUrl: './pages.component.html', - styleUrls: ['./pages.component.scss'] + styleUrls: ['./pages.component.scss'], + animations: [ fadeAnimation ] }) export class PagesComponent implements AfterViewInit, OnDestroy, OnInit { layoutCompact = true; @@ -59,7 +60,8 @@ export class PagesComponent implements AfterViewInit, OnDestroy, OnInit { rippleMouseDownListener: any; - constructor(public renderer: Renderer, public zone: NgZone, private router: Router) { } + constructor(public renderer: Renderer, public zone: NgZone, private router: Router) { + } ngOnInit() { if (this.isAuthRouteActivated()) { @@ -323,6 +325,10 @@ export class PagesComponent implements AfterViewInit, OnDestroy, OnInit { themeLink.href = 'assets/theme/theme-' + theme + '.css'; layoutLink.href = 'assets/layout/css/layout-' + theme + '.css'; -} + } + + prepRouteState(outlet: any) { + return outlet.activatedRouteData['animation'] || 'firstPage'; + } } diff --git a/src/packages/probe/component/detail/detail.component.ts b/src/packages/probe/component/detail/detail.component.ts index 2fcb6af..fb1c165 100644 --- a/src/packages/probe/component/detail/detail.component.ts +++ b/src/packages/probe/component/detail/detail.component.ts @@ -30,7 +30,6 @@ export class DetailComponent implements OnInit, AfterContentInit, OnDestroy { constructor( private route: ActivatedRoute, - private router: Router, private detailStore: Store, private modifyStore: Store, private confirmationService: ConfirmationService, @@ -88,7 +87,7 @@ export class DetailComponent implements OnInit, AfterContentInit, OnDestroy { icon: 'fa fa-trash', message: 'Are you sure to remove this Probe?', accept: () => { - this.router.navigate(['probes/list']); + // this.router.navigate(['probes/list']); }, reject: () => { } diff --git a/src/packages/probe/component/list/list.component.ts b/src/packages/probe/component/list/list.component.ts index 7fcf0e7..6dbc58a 100644 --- a/src/packages/probe/component/list/list.component.ts +++ b/src/packages/probe/component/list/list.component.ts @@ -1,6 +1,4 @@ import { Component, OnInit, AfterViewInit, AfterContentInit, ViewChild, OnDestroy, Output, EventEmitter } from '@angular/core'; -import { Router } from '@angular/router'; - import { Store, select } from '@ngrx/store'; import { RPCClientError } from '@loafer/ng-rpc/protocol'; @@ -24,7 +22,6 @@ export class ListComponent implements OnInit, AfterContentInit, OnDestroy { @Output() select = new EventEmitter(); constructor( - private router: Router, private store: Store ) { }