|
21 | 21 |
|
22 | 22 | <div style="flex: 1; height: 0; display: flex"> |
23 | 23 | <div style="flex: 1"> |
24 | | - <q-list |
25 | | - style="max-height: 100%; border-radius: 10px; background-color: #303030" |
| 24 | + <Checklist |
| 25 | + :item-ids="finalPageIds" |
| 26 | + :items-wrapper="CustomInfiniteScroll" |
| 27 | + :wrapper-events="{ load: onLoad }" |
| 28 | + :wrapper-props="{ disable: !hasMorePages }" |
| 29 | + :selected-item-ids="baseSelectedPageIds" |
| 30 | + @select="(pageId) => baseSelectedPageIds.add(pageId)" |
| 31 | + @unselect="(pageId) => baseSelectedPageIds.delete(pageId)" |
| 32 | + style="max-height: 100%; border-radius: 10px; background-color: #383838" |
26 | 33 | class="overflow-auto" |
27 | 34 | > |
28 | | - <q-infinite-scroll |
29 | | - @load="onLoad" |
30 | | - :disable="!hasMorePages" |
31 | | - > |
32 | | - <q-item |
33 | | - v-for="groupPageId in finalPageIds" |
34 | | - :key="groupPageId" |
35 | | - class="text-grey-1" |
36 | | - style="background-color: #424242" |
37 | | - clickable |
38 | | - v-ripple |
39 | | - active-class="bg-grey-7" |
40 | | - :active="baseSelectedPageIds.has(groupPageId)" |
41 | | - @click="select(groupPageId, $event as MouseEvent)" |
42 | | - > |
43 | | - <q-item-section> |
44 | | - <q-item-label> |
45 | | - {{ getPageTitle(groupPageId, { prefer: 'absolute' }).text }} |
46 | | - </q-item-label> |
47 | | - </q-item-section> |
48 | | - </q-item> |
49 | | - |
50 | | - <template v-slot:loading> |
51 | | - <div class="row justify-center q-my-md"> |
52 | | - <q-circular-progress |
53 | | - indeterminate |
54 | | - size="md" |
55 | | - /> |
56 | | - </div> |
57 | | - </template> |
58 | | - </q-infinite-scroll> |
59 | | - </q-list> |
| 35 | + <template #item="{ itemId: groupPageId }"> |
| 36 | + <q-item-section> |
| 37 | + <q-item-label> |
| 38 | + {{ getPageTitle(groupPageId, { prefer: 'absolute' }).text }} |
| 39 | + </q-item-label> |
| 40 | + </q-item-section> |
| 41 | + </template> |
| 42 | + </Checklist> |
60 | 43 | </div> |
61 | 44 |
|
62 | 45 | <Gap style="width: 16px" /> |
@@ -116,7 +99,8 @@ import { deletePage } from 'src/code/api-interface/pages/deletion/delete'; |
116 | 99 | import { movePage } from 'src/code/api-interface/pages/move'; |
117 | 100 | import { getPageTitle } from 'src/code/pages/utils'; |
118 | 101 | import type { RealtimeContext } from 'src/code/realtime/context'; |
119 | | -import { asyncDialog, handleError, isCtrlDown } from 'src/code/utils/misc'; |
| 102 | +import { asyncDialog, handleError } from 'src/code/utils/misc'; |
| 103 | +import CustomInfiniteScroll from 'src/components/CustomInfiniteScroll.vue'; |
120 | 104 | import type { Ref } from 'vue'; |
121 | 105 |
|
122 | 106 | import MovePageDialog from '../../MovePageDialog.vue'; |
@@ -154,18 +138,6 @@ function deselectAll() { |
154 | 138 | } |
155 | 139 | } |
156 | 140 |
|
157 | | -function select(id: string, event: MouseEvent) { |
158 | | - if (!isCtrlDown(event)) { |
159 | | - baseSelectedPageIds.value.clear(); |
160 | | - } |
161 | | -
|
162 | | - if (baseSelectedPageIds.value.has(id)) { |
163 | | - baseSelectedPageIds.value.delete(id); |
164 | | - } else { |
165 | | - baseSelectedPageIds.value.add(id); |
166 | | - } |
167 | | -} |
168 | | -
|
169 | 141 | async function onLoad(index: number, done: (stop?: boolean) => void) { |
170 | 142 | try { |
171 | 143 | const response = await trpcClient.groups.getPages.query({ |
|
0 commit comments