2018-06-12 17:46:11 +02:00
|
|
|
import {
|
|
|
|
Component,
|
|
|
|
OnDestroy,
|
|
|
|
} from '@angular/core';
|
|
|
|
|
|
|
|
import { CipherService } from 'jslib/abstractions/cipher.service';
|
|
|
|
import { CollectionService } from 'jslib/abstractions/collection.service';
|
|
|
|
import { I18nService } from 'jslib/abstractions/i18n.service';
|
2018-10-23 16:33:40 +02:00
|
|
|
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
2018-06-12 17:46:11 +02:00
|
|
|
import { UserService } from 'jslib/abstractions/user.service';
|
|
|
|
|
|
|
|
import { CollectionView } from 'jslib/models/view/collectionView';
|
|
|
|
|
2018-10-23 16:33:40 +02:00
|
|
|
import { ShareComponent as BaseShareComponent } from 'jslib/angular/components/share.component';
|
|
|
|
|
2018-06-12 17:46:11 +02:00
|
|
|
@Component({
|
|
|
|
selector: 'app-vault-share',
|
|
|
|
templateUrl: 'share.component.html',
|
|
|
|
})
|
2018-10-23 16:33:40 +02:00
|
|
|
export class ShareComponent extends BaseShareComponent implements OnDestroy {
|
|
|
|
constructor(collectionService: CollectionService, platformUtilsService: PlatformUtilsService,
|
|
|
|
i18nService: I18nService, userService: UserService,
|
|
|
|
cipherService: CipherService) {
|
|
|
|
super(collectionService, platformUtilsService, i18nService, userService, cipherService);
|
2018-06-12 17:46:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ngOnDestroy() {
|
2018-06-13 06:03:48 +02:00
|
|
|
this.selectAll(false);
|
2018-06-12 17:46:11 +02:00
|
|
|
}
|
|
|
|
|
2018-07-09 22:27:54 +02:00
|
|
|
check(c: CollectionView, select?: boolean) {
|
|
|
|
(c as any).checked = select == null ? !(c as any).checked : select;
|
2018-06-12 17:46:11 +02:00
|
|
|
}
|
|
|
|
|
2018-07-09 23:07:13 +02:00
|
|
|
selectAll(select: boolean) {
|
2018-06-13 06:03:48 +02:00
|
|
|
const collections = select ? this.collections : this.writeableCollections;
|
2018-07-09 22:27:54 +02:00
|
|
|
collections.forEach((c) => this.check(c, select));
|
2018-06-12 17:46:11 +02:00
|
|
|
}
|
|
|
|
}
|