File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
client/src/components/subjects Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 11<template >
22 <ul >
33 <label :class =" subject.$type" >
4- <input type =" checkbox" v-model =" isChecked" />
4+ <input
5+ type =" checkbox"
6+ v-model =" isChecked"
7+ :intermediate =" containsSelected"
8+ />
59 <span >{{ subject.name }}</span >
610 <badge v-if =" subject.$type == 'group'" >{{ selectedUsers }}</badge >
711 </label >
@@ -61,6 +65,22 @@ export default {
6165 this .emitChanged (this .subject .id , value);
6266 },
6367 },
68+ containsSelected () {
69+ if (this .isChecked ) return false ;
70+ if (this .subject .$type == " user" ) return false ;
71+
72+ const compute = (s ) => {
73+ if (s .$type == " user" ) return [s .id ];
74+ return this .getChildren (s)
75+ .map ((x ) => compute (x))
76+ .reduce ((x , y ) => x .concat (y), []);
77+ };
78+ const allUsersIds = compute (this .subject ).reduce (
79+ (x , y ) => x .concat (y),
80+ []
81+ );
82+ return allUsersIds .some ((x ) => this .selected .includes (x));
83+ },
6484 },
6585
6686 methods: {
You can’t perform that action at this time.
0 commit comments