mirror of
https://github.com/bitwarden/web
synced 2025-12-12 14:23:18 +00:00
Feature/split manage collections permission (#1211)
* Update guard services and routing * Add depenent checkbox to handle sub permissions * Present new collections premissions * Use new split permissions * Rename to nested-checkbox.component * Clarify css class name * update jslib
This commit is contained in:
37
src/app/components/nested-checkbox.component.ts
Normal file
37
src/app/components/nested-checkbox.component.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import {
|
||||
Component,
|
||||
EventEmitter,
|
||||
Input,
|
||||
Output,
|
||||
} from '@angular/core';
|
||||
import { Utils } from 'jslib-common/misc/utils';
|
||||
|
||||
@Component({
|
||||
selector: 'app-nested-checkbox',
|
||||
templateUrl: 'nested-checkbox.component.html',
|
||||
})
|
||||
export class NestedCheckboxComponent {
|
||||
@Input() parentId: string;
|
||||
@Input() checkboxes: { id: string, get: () => boolean, set: (v: boolean) => void; }[];
|
||||
@Output() onSavedUser = new EventEmitter();
|
||||
@Output() onDeletedUser = new EventEmitter();
|
||||
|
||||
get parentIndeterminate() {
|
||||
return !this.parentChecked &&
|
||||
this.checkboxes.some(c => c.get());
|
||||
}
|
||||
|
||||
get parentChecked() {
|
||||
return this.checkboxes.every(c => c.get());
|
||||
}
|
||||
|
||||
set parentChecked(value: boolean) {
|
||||
this.checkboxes.forEach(c => {
|
||||
c.set(value);
|
||||
});
|
||||
}
|
||||
|
||||
pascalize(s: string) {
|
||||
return Utils.camelToPascalCase(s);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user