|
25 | 25 |
|
26 | 26 | <div style="flex: 1; height: 0; display: flex"> |
27 | 27 | <div style="flex: 1"> |
28 | | - <q-list |
| 28 | + <Checklist |
| 29 | + :item-ids="memberGroupsIds" |
| 30 | + :selected-item-ids="baseSelectedGroupIds" |
| 31 | + @select="(pageId) => baseSelectedGroupIds.add(pageId)" |
| 32 | + @unselect="(pageId) => baseSelectedGroupIds.delete(pageId)" |
29 | 33 | style=" |
30 | 34 | border-radius: 10px; |
31 | 35 | padding: 0; |
32 | 36 | overflow-y: auto; |
33 | 37 | max-height: 100%; |
| 38 | + background-color: #383838; |
34 | 39 | " |
35 | 40 | > |
36 | | - <template |
37 | | - v-for="groupId in memberGroupsIds" |
38 | | - :key="groupId" |
39 | | - > |
40 | | - <q-item |
41 | | - v-if=" |
42 | | - realtimeCtx.hget('group', groupId, 'permanent-deletion-date') == |
43 | | - null |
44 | | - " |
45 | | - class="text-grey-1" |
46 | | - style="background-color: #424242" |
47 | | - clickable |
48 | | - v-ripple |
49 | | - active-class="bg-grey-7" |
50 | | - :active="baseSelectedGroupIds.has(groupId)" |
51 | | - @click="select(groupId, $event as MouseEvent)" |
52 | | - > |
53 | | - <q-item-section> |
54 | | - <q-item-label> |
55 | | - {{ groupNames()(groupId).get().text }} |
56 | | - </q-item-label> |
57 | | - <q-item-label caption> |
58 | | - {{ |
59 | | - rolesMap()[ |
60 | | - realtimeCtx.hget( |
61 | | - 'group-member', |
62 | | - `${groupId}:${authStore().userId}`, |
63 | | - 'role', |
64 | | - )! |
65 | | - ]?.name |
66 | | - }} |
67 | | - </q-item-label> |
68 | | - </q-item-section> |
69 | | - </q-item> |
| 41 | + <template #item="{ itemId: groupId }"> |
| 42 | + <q-item-section> |
| 43 | + <q-item-label> |
| 44 | + {{ groupNames()(groupId).get().text }} |
| 45 | + </q-item-label> |
| 46 | + <q-item-label caption> |
| 47 | + {{ |
| 48 | + rolesMap()[ |
| 49 | + realtimeCtx.hget( |
| 50 | + 'group-member', |
| 51 | + `${groupId}:${authStore().userId}`, |
| 52 | + 'role', |
| 53 | + )! |
| 54 | + ]?.name |
| 55 | + }} |
| 56 | + </q-item-label> |
| 57 | + </q-item-section> |
70 | 58 | </template> |
71 | | - </q-list> |
| 59 | + </Checklist> |
72 | 60 | </div> |
73 | 61 |
|
74 | 62 | <Gap style="width: 16px" /> |
@@ -110,12 +98,14 @@ const groupIds = inject<Ref<string[]>>('groupIds')!; |
110 | 98 | const realtimeCtx = inject<RealtimeContext>('realtimeCtx')!; |
111 | 99 |
|
112 | 100 | const memberGroupsIds = computed(() => |
113 | | - groupIds.value.filter((groupId) => |
114 | | - realtimeCtx.hget( |
115 | | - 'group-member', |
116 | | - `${groupId}:${authStore().userId}`, |
117 | | - 'exists', |
118 | | - ), |
| 101 | + groupIds.value.filter( |
| 102 | + (groupId) => |
| 103 | + realtimeCtx.hget('group', groupId, 'permanent-deletion-date') == null && |
| 104 | + realtimeCtx.hget( |
| 105 | + 'group-member', |
| 106 | + `${groupId}:${authStore().userId}`, |
| 107 | + 'exists', |
| 108 | + ), |
119 | 109 | ), |
120 | 110 | ); |
121 | 111 |
|
@@ -146,18 +136,6 @@ function deselectAll() { |
146 | 136 | } |
147 | 137 | } |
148 | 138 |
|
149 | | -function select(groupId: string, event: MouseEvent) { |
150 | | - if (!isCtrlDown(event)) { |
151 | | - baseSelectedGroupIds.value.clear(); |
152 | | - } |
153 | | -
|
154 | | - if (baseSelectedGroupIds.value.has(groupId)) { |
155 | | - baseSelectedGroupIds.value.delete(groupId); |
156 | | - } else { |
157 | | - baseSelectedGroupIds.value.add(groupId); |
158 | | - } |
159 | | -} |
160 | | -
|
161 | 139 | async function leaveSelectedGroups() { |
162 | 140 | try { |
163 | 141 | await asyncDialog({ |
|
0 commit comments