diff --git a/src/popup/app.module.ts b/src/popup/app.module.ts index 884ddcd88b..8862faf9be 100644 --- a/src/popup/app.module.ts +++ b/src/popup/app.module.ts @@ -69,6 +69,7 @@ import { I18nPipe } from 'jslib/angular/pipes/i18n.pipe'; import { SearchCiphersPipe } from 'jslib/angular/pipes/search-ciphers.pipe'; import { ActionButtonsComponent } from './components/action-buttons.component'; +import { CipherRowComponent } from './components/cipher-row.component'; import { CiphersListComponent } from './components/ciphers-list.component'; import { PopOutComponent } from './components/pop-out.component'; import { SendListComponent } from './components/send-list.component'; @@ -186,6 +187,7 @@ registerLocaleData(localeZhTw, 'zh-TW'); BlurClickDirective, BoxRowDirective, CalloutComponent, + CipherRowComponent, CiphersComponent, CiphersListComponent, CollectionsComponent, diff --git a/src/popup/components/cipher-row.component.html b/src/popup/components/cipher-row.component.html new file mode 100644 index 0000000000..8d482fcae5 --- /dev/null +++ b/src/popup/components/cipher-row.component.html @@ -0,0 +1,24 @@ + + + + + + + {{cipher.name}} + + + {{'shared' | i18n}} + + + + {{'attachments' | i18n}} + + + {{cipher.subTitle}} + + + + + diff --git a/src/popup/components/cipher-row.component.ts b/src/popup/components/cipher-row.component.ts new file mode 100644 index 0000000000..d5d59d1b51 --- /dev/null +++ b/src/popup/components/cipher-row.component.ts @@ -0,0 +1,33 @@ +import { + Component, + EventEmitter, + Input, + Output, +} from '@angular/core'; + +import { CipherView } from 'jslib/models/view/cipherView'; + +@Component({ + selector: 'app-cipher-row', + templateUrl: 'cipher-row.component.html', +}) +export class CipherRowComponent { + @Output() onSelected = new EventEmitter(); + @Output() launchEvent = new EventEmitter(); + @Output() onView = new EventEmitter(); + @Input() cipher: CipherView; + @Input() showView = false; + @Input() title: string; + + selectCipher(c: CipherView) { + this.onSelected.emit(c); + } + + launchCipher(c: CipherView) { + this.launchEvent.emit(c); + } + + viewCipher(c: CipherView) { + this.onView.emit(c); + } +} diff --git a/src/popup/scss/misc.scss b/src/popup/scss/misc.scss index ae02ec6eab..05ec0c0d9f 100644 --- a/src/popup/scss/misc.scss +++ b/src/popup/scss/misc.scss @@ -361,35 +361,23 @@ select option { cdk-virtual-scroll-viewport { height: 500px; width: 375px; - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; overflow-y: auto !important; overflow-x: hidden !important; - - &.flex { - display: flex; - flex-flow: column; - - &.tab-page { - height: calc(100% - 99px); - } - } } // cribbed directly from base.scss -cdk-virtual-scroll-viewport::-webkit-scrollbar, cdk-virtual-scroll-viewport::-webkit-scrollbar { +cdk-virtual-scroll-viewport::-webkit-scrollbar { width: 10px; height: 10px; } -cdk-virtual-scroll-viewport::-webkit-scrollbar-track, cdk-virtual-scroll-viewport::-webkit-scrollbar { - background-color: transparent; +cdk-virtual-scroll-viewport::-webkit-scrollbar-track { + @include themify($themes) { + background-color: themed('backgroundColor'); + } } -cdk-virtual-scroll-viewport::-webkit-scrollbar-thumb, cdk-virtual-scroll-viewport::-webkit-scrollbar { +cdk-virtual-scroll-viewport::-webkit-scrollbar-thumb { border-radius: 10px; margin-right: 1px; diff --git a/src/popup/services/popup-utils.service.ts b/src/popup/services/popup-utils.service.ts index a02ba61c8e..dcd06c2f53 100644 --- a/src/popup/services/popup-utils.service.ts +++ b/src/popup/services/popup-utils.service.ts @@ -25,14 +25,14 @@ export class PopupUtilsService { win.location.search.indexOf('uilocation=popup') > -1; } - getContentScrollY(win: Window): number { - const content = win.document.getElementsByTagName('content')[0]; + getContentScrollY(win: Window, scrollingContainer: string = 'content'): number { + const content = win.document.getElementsByTagName(scrollingContainer)[0]; return content.scrollTop; } - setContentScrollY(win: Window, scrollY: number): void { + setContentScrollY(win: Window, scrollY: number, scrollingContainer: string = 'content'): void { if (scrollY != null) { - const content = win.document.getElementsByTagName('content')[0]; + const content = win.document.getElementsByTagName(scrollingContainer)[0]; content.scrollTop = scrollY; } } diff --git a/src/popup/vault/ciphers.component.html b/src/popup/vault/ciphers.component.html index b61aef58e9..67cb8b398e 100644 --- a/src/popup/vault/ciphers.component.html +++ b/src/popup/vault/ciphers.component.html @@ -63,15 +63,17 @@ - - - {{groupingTitle}} - {{isSearching() ? ciphers.length : ciphers.length}} + + + + {{groupingTitle}} + {{isSearching() ? ciphers.length : ciphers.length}} + + + + - - - - + diff --git a/src/popup/vault/ciphers.component.ts b/src/popup/vault/ciphers.component.ts index 02a07e6467..e9ee0a9894 100644 --- a/src/popup/vault/ciphers.component.ts +++ b/src/popup/vault/ciphers.component.ts @@ -54,6 +54,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On private selectedTimeout: number; private preventSelected = false; private applySavedState = true; + private scrollingContainer = 'cdk-virtual-scroll-viewport'; constructor(searchService: SearchService, private route: ActivatedRoute, private router: Router, private location: Location, @@ -132,7 +133,8 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On } if (this.applySavedState && this.state != null) { - window.setTimeout(() => this.popupUtils.setContentScrollY(window, this.state.scrollY), 0); + window.setTimeout(() => this.popupUtils.setContentScrollY(window, this.state.scrollY, + this.scrollingContainer), 0); } this.stateService.remove(ComponentId); if (queryParamsSub != null) { @@ -227,7 +229,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On private async saveState() { this.state = { - scrollY: this.popupUtils.getContentScrollY(window), + scrollY: this.popupUtils.getContentScrollY(window, this.scrollingContainer), searchText: this.searchText, }; await this.stateService.save(ComponentId, this.state);