mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-04 09:01:01 +01:00
forward/back animations for nested cipher folders/cols
This commit is contained in:
parent
69e664a154
commit
0cdc343ce0
2
jslib
2
jslib
@ -1 +1 @@
|
|||||||
Subproject commit d4b3a16fd1196abd3134c23a9fa0b6c002790458
|
Subproject commit aa0b274f8fd80db620abd4a85c3086f511e19c88
|
@ -103,17 +103,17 @@ export const routerTransition = trigger('routerTransition', [
|
|||||||
transition('2fa => tabs', inSlideLeft),
|
transition('2fa => tabs', inSlideLeft),
|
||||||
|
|
||||||
transition((fromState, toState) => {
|
transition((fromState, toState) => {
|
||||||
if (fromState == null || toState === null || toState.indexOf('ciphers_') !== 0) {
|
if (fromState == null || toState === null || toState.indexOf('ciphers_') === -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return fromState.indexOf('ciphers_direction=f') === 0 || fromState === 'tabs';
|
return (fromState.indexOf('ciphers_') === 0 && fromState.indexOf('ciphers_direction=b') === -1) ||
|
||||||
|
fromState === 'tabs';
|
||||||
}, inSlideLeft),
|
}, inSlideLeft),
|
||||||
transition((fromState, toState) => {
|
transition((fromState, toState) => {
|
||||||
if (fromState == null || toState === null || fromState.indexOf('ciphers_') !== 0) {
|
if (fromState == null || toState === null || fromState.indexOf('ciphers_') === -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return (fromState.indexOf('ciphers_') === 0 && fromState.indexOf('ciphers_direction=f') === -1) ||
|
return toState.indexOf('ciphers_direction=b') === 0 || toState === 'tabs';
|
||||||
toState === 'tabs';
|
|
||||||
}, outSlideRight),
|
}, outSlideRight),
|
||||||
|
|
||||||
transition((fromState, toState) => {
|
transition((fromState, toState) => {
|
||||||
|
@ -132,6 +132,13 @@ export class AppComponent implements OnInit {
|
|||||||
this.stateService.remove('addEditCipher');
|
this.stateService.remove('addEditCipher');
|
||||||
}
|
}
|
||||||
this.previousUrl = url;
|
this.previousUrl = url;
|
||||||
|
|
||||||
|
// Clear route direction after animation (400ms)
|
||||||
|
if ((window as any).routeDirection != null) {
|
||||||
|
window.setTimeout(() => {
|
||||||
|
(window as any).routeDirection = null;
|
||||||
|
}, 400);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -140,7 +147,8 @@ export class AppComponent implements OnInit {
|
|||||||
if (BrowserApi.isEdge18) {
|
if (BrowserApi.isEdge18) {
|
||||||
return null;
|
return null;
|
||||||
} else if (outlet.activatedRouteData.state === 'ciphers') {
|
} else if (outlet.activatedRouteData.state === 'ciphers') {
|
||||||
return 'ciphers_direction=' + (outlet.activatedRoute.queryParams as any).value.direction + '_' +
|
const routeDirection = (window as any).routeDirection != null ? (window as any).routeDirection : '';
|
||||||
|
return 'ciphers_direction=' + routeDirection + '_' +
|
||||||
(outlet.activatedRoute.queryParams as any).value.folderId + '_' +
|
(outlet.activatedRoute.queryParams as any).value.folderId + '_' +
|
||||||
(outlet.activatedRoute.queryParams as any).value.collectionId;
|
(outlet.activatedRoute.queryParams as any).value.collectionId;
|
||||||
} else {
|
} else {
|
||||||
|
@ -125,16 +125,6 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
|
|||||||
this.searchText = this.state.searchText;
|
this.searchText = this.state.searchText;
|
||||||
}
|
}
|
||||||
window.setTimeout(() => this.popupUtils.setContentScrollY(window, this.state.scrollY), 0);
|
window.setTimeout(() => this.popupUtils.setContentScrollY(window, this.state.scrollY), 0);
|
||||||
|
|
||||||
// TODO: This is pushing a new page onto the browser navigation history. Figure out how to now do that
|
|
||||||
// so that we don't have to hit back button twice
|
|
||||||
const newUrl = this.router.createUrlTree([], {
|
|
||||||
queryParams: { direction: null },
|
|
||||||
queryParamsHandling: 'merge',
|
|
||||||
preserveFragment: true,
|
|
||||||
replaceUrl: true,
|
|
||||||
}).toString();
|
|
||||||
this.location.go(newUrl);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.broadcasterService.subscribe(ComponentId, (message: any) => {
|
this.broadcasterService.subscribe(ComponentId, (message: any) => {
|
||||||
@ -173,12 +163,12 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
|
|||||||
|
|
||||||
selectFolder(folder: FolderView) {
|
selectFolder(folder: FolderView) {
|
||||||
if (folder.id != null) {
|
if (folder.id != null) {
|
||||||
this.router.navigate(['/ciphers'], { queryParams: { folderId: folder.id, direction: 'f' } });
|
this.router.navigate(['/ciphers'], { queryParams: { folderId: folder.id } });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
selectCollection(collection: CollectionView) {
|
selectCollection(collection: CollectionView) {
|
||||||
this.router.navigate(['/ciphers'], { queryParams: { collectionId: collection.id, direction: 'f' } });
|
this.router.navigate(['/ciphers'], { queryParams: { collectionId: collection.id } });
|
||||||
}
|
}
|
||||||
|
|
||||||
async launchCipher(cipher: CipherView) {
|
async launchCipher(cipher: CipherView) {
|
||||||
@ -203,6 +193,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
|
|||||||
}
|
}
|
||||||
|
|
||||||
back() {
|
back() {
|
||||||
|
(window as any).routeDirection = 'b';
|
||||||
this.location.back();
|
this.location.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,10 +221,6 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
|
|||||||
return !searching && this.ciphers.length > this.pageSize;
|
return !searching && this.ciphers.length > this.pageSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
routerCanReuse() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
async resetPaging() {
|
async resetPaging() {
|
||||||
this.pagedCiphers = [];
|
this.pagedCiphers = [];
|
||||||
this.loadMore();
|
this.loadMore();
|
||||||
|
@ -242,12 +242,12 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit
|
|||||||
|
|
||||||
async selectFolder(folder: FolderView) {
|
async selectFolder(folder: FolderView) {
|
||||||
super.selectFolder(folder);
|
super.selectFolder(folder);
|
||||||
this.router.navigate(['/ciphers'], { queryParams: { folderId: folder.id || 'none', direction: 'f' } });
|
this.router.navigate(['/ciphers'], { queryParams: { folderId: folder.id || 'none' } });
|
||||||
}
|
}
|
||||||
|
|
||||||
async selectCollection(collection: CollectionView) {
|
async selectCollection(collection: CollectionView) {
|
||||||
super.selectCollection(collection);
|
super.selectCollection(collection);
|
||||||
this.router.navigate(['/ciphers'], { queryParams: { collectionId: collection.id, direction: 'f' } });
|
this.router.navigate(['/ciphers'], { queryParams: { collectionId: collection.id } });
|
||||||
}
|
}
|
||||||
|
|
||||||
async selectCipher(cipher: CipherView) {
|
async selectCipher(cipher: CipherView) {
|
||||||
|
Loading…
Reference in New Issue
Block a user