From eaa37cbec0fb0a3cbbafd52ba74a37337d82e814 Mon Sep 17 00:00:00 2001 From: TAKAHASHI Shuuji Date: Sun, 24 Mar 2024 19:03:39 +0900 Subject: [PATCH] TMP: sort list items --- components/common/CommonPaginator.vue | 9 ++++++++- pages/[[server]]/lists.vue | 28 ++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/components/common/CommonPaginator.vue b/components/common/CommonPaginator.vue index 46276eab..b8f28dd7 100644 --- a/components/common/CommonPaginator.vue +++ b/components/common/CommonPaginator.vue @@ -4,6 +4,8 @@ import { DynamicScroller } from 'vue-virtual-scroller' import 'vue-virtual-scroller/dist/vue-virtual-scroller.css' import type { mastodon } from 'masto' import type { UnwrapRef } from 'vue' +// eslint-disable-next-line vue/prefer-import-from-vue +import type { UnwrapRefSimple } from '@vue/reactivity' const { paginator, @@ -66,7 +68,12 @@ function removeEntry(entryId: any) { items.value = items.value.filter(i => (i as any)[keyProp] !== entryId) } -defineExpose({ createEntry, removeEntry, updateEntry }) +function sortEntries() { + if (preprocess) + items.value = (preprocess([...items.value as U[]])) as UnwrapRefSimple[] +} + +defineExpose({ createEntry, removeEntry, updateEntry, sortEntries }) + - +