1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-09 05:57:40 +02:00
bitwarden-browser/src/app/vault/share.component.ts

50 lines
1.6 KiB
TypeScript
Raw Normal View History

2021-12-17 15:57:11 +01:00
import { Component, OnDestroy } from "@angular/core";
2018-06-12 17:46:11 +02:00
2021-12-17 15:57:11 +01:00
import { CipherService } from "jslib-common/abstractions/cipher.service";
import { CollectionService } from "jslib-common/abstractions/collection.service";
import { I18nService } from "jslib-common/abstractions/i18n.service";
import { OrganizationService } from "jslib-common/abstractions/organization.service";
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
2018-06-12 17:46:11 +02:00
2021-12-17 15:57:11 +01:00
import { CollectionView } from "jslib-common/models/view/collectionView";
2018-06-12 17:46:11 +02:00
2021-12-17 15:57:11 +01:00
import { ShareComponent as BaseShareComponent } from "jslib-angular/components/share.component";
import { LogService } from "jslib-common/abstractions/log.service";
2018-10-23 16:33:40 +02:00
2018-06-12 17:46:11 +02:00
@Component({
2021-12-17 15:57:11 +01:00
selector: "app-vault-share",
templateUrl: "share.component.html",
2018-06-12 17:46:11 +02:00
})
2018-10-23 16:33:40 +02:00
export class ShareComponent extends BaseShareComponent implements OnDestroy {
2021-12-17 15:57:11 +01:00
constructor(
collectionService: CollectionService,
platformUtilsService: PlatformUtilsService,
i18nService: I18nService,
cipherService: CipherService,
organizationService: OrganizationService,
logService: LogService
) {
super(
collectionService,
platformUtilsService,
i18nService,
cipherService,
logService,
organizationService
);
}
2018-06-12 17:46:11 +02:00
2021-12-17 15:57:11 +01:00
ngOnDestroy() {
this.selectAll(false);
}
2018-06-12 17:46:11 +02:00
2021-12-17 15:57:11 +01: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
2021-12-17 15:57:11 +01:00
selectAll(select: boolean) {
const collections = select ? this.collections : this.writeableCollections;
collections.forEach((c) => this.check(c, select));
}
2018-06-12 17:46:11 +02:00
}