mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-23 16:53:50 +02:00
custom col widths
This commit is contained in:
@@ -70,13 +70,6 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
getCoreRowModel,
|
||||
getFilteredRowModel,
|
||||
getPaginationRowModel,
|
||||
getSortedRowModel,
|
||||
useVueTable
|
||||
} from '@tanstack/vue-table';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { ElMessageBox } from 'element-plus';
|
||||
import { Refresh } from '@element-plus/icons-vue';
|
||||
@@ -103,7 +96,7 @@
|
||||
import { createColumns } from './columns.jsx';
|
||||
import { database } from '../../service/database';
|
||||
import { useDataTableScrollHeight } from '../../composables/useDataTableScrollHeight';
|
||||
import { valueUpdater } from '../../components/ui/table/utils';
|
||||
import { useVrcxVueTable } from '../../lib/table/useVrcxVueTable';
|
||||
|
||||
import SendInviteRequestResponseDialog from './dialogs/SendInviteRequestResponseDialog.vue';
|
||||
import SendInviteResponseDialog from './dialogs/SendInviteResponseDialog.vue';
|
||||
@@ -219,29 +212,14 @@
|
||||
: notificationTable.value.pageSize
|
||||
);
|
||||
|
||||
const sorting = ref([{ id: 'created_at', desc: true }]);
|
||||
const pagination = ref({
|
||||
pageIndex: 0,
|
||||
pageSize: pageSize.value
|
||||
});
|
||||
|
||||
const table = useVueTable({
|
||||
const { table, pagination } = useVrcxVueTable({
|
||||
data: notificationDisplayData,
|
||||
columns,
|
||||
getRowId: (row) => row.id ?? `${row.type}:${row.senderUserId ?? ''}:${row.created_at ?? ''}`,
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
getPaginationRowModel: getPaginationRowModel(),
|
||||
getSortedRowModel: getSortedRowModel(),
|
||||
getFilteredRowModel: getFilteredRowModel(),
|
||||
onSortingChange: (updaterOrValue) => valueUpdater(updaterOrValue, sorting),
|
||||
onPaginationChange: (updaterOrValue) => valueUpdater(updaterOrValue, pagination),
|
||||
state: {
|
||||
get sorting() {
|
||||
return sorting.value;
|
||||
},
|
||||
get pagination() {
|
||||
return pagination.value;
|
||||
}
|
||||
initialSorting: [{ id: 'created_at', desc: true }],
|
||||
initialPagination: {
|
||||
pageIndex: 0,
|
||||
pageSize: pageSize.value
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -84,9 +84,7 @@ export const createColumns = ({
|
||||
{
|
||||
accessorFn: (row) => getNotificationCreatedAtTs(row),
|
||||
id: 'created_at',
|
||||
meta: {
|
||||
class: 'w-[120px]'
|
||||
},
|
||||
size: 120,
|
||||
header: ({ column }) => (
|
||||
<Button
|
||||
variant="ghost"
|
||||
@@ -136,9 +134,7 @@ export const createColumns = ({
|
||||
},
|
||||
{
|
||||
accessorKey: 'type',
|
||||
meta: {
|
||||
class: 'w-[180px]'
|
||||
},
|
||||
size: 180,
|
||||
header: () => t('table.notification.type'),
|
||||
cell: ({ row }) => {
|
||||
const original = row.original;
|
||||
@@ -224,8 +220,9 @@ export const createColumns = ({
|
||||
{
|
||||
accessorKey: 'senderUsername',
|
||||
meta: {
|
||||
class: 'w-[150px] min-w-0 overflow-hidden'
|
||||
class: 'overflow-hidden'
|
||||
},
|
||||
size: 150,
|
||||
header: () => t('table.notification.user'),
|
||||
cell: ({ row }) => {
|
||||
const original = row.original;
|
||||
@@ -279,8 +276,9 @@ export const createColumns = ({
|
||||
{
|
||||
accessorKey: 'groupName',
|
||||
meta: {
|
||||
class: 'w-[150px] min-w-0 overflow-hidden'
|
||||
class: 'overflow-hidden'
|
||||
},
|
||||
size: 150,
|
||||
header: () => t('table.notification.group'),
|
||||
cell: ({ row }) => {
|
||||
const original = row.original;
|
||||
@@ -382,9 +380,8 @@ export const createColumns = ({
|
||||
},
|
||||
{
|
||||
accessorKey: 'photo',
|
||||
meta: {
|
||||
class: 'w-[80px]'
|
||||
},
|
||||
enableResizing: false,
|
||||
size: 80,
|
||||
header: () => t('table.notification.photo'),
|
||||
cell: ({ row }) => {
|
||||
const original = row.original;
|
||||
@@ -441,8 +438,10 @@ export const createColumns = ({
|
||||
header: () => t('table.notification.message'),
|
||||
enableSorting: false,
|
||||
meta: {
|
||||
class: 'min-w-0 overflow-hidden'
|
||||
class: 'min-w-0 overflow-hidden',
|
||||
stretch: true
|
||||
},
|
||||
minSize: 100,
|
||||
cell: ({ row }) => {
|
||||
const original = row.original;
|
||||
return (
|
||||
@@ -489,8 +488,12 @@ export const createColumns = ({
|
||||
{
|
||||
id: 'action',
|
||||
meta: {
|
||||
class: 'w-[120px] max-w-[120px] text-right'
|
||||
class: 'text-right'
|
||||
},
|
||||
size: 120,
|
||||
minSize: 120,
|
||||
maxSize: 120,
|
||||
enableResizing: false,
|
||||
header: () => t('table.notification.action'),
|
||||
enableSorting: false,
|
||||
cell: ({ row }) => {
|
||||
@@ -781,9 +784,8 @@ export const createColumns = ({
|
||||
id: 'trailing',
|
||||
header: () => null,
|
||||
enableSorting: false,
|
||||
meta: {
|
||||
class: 'w-[5px]'
|
||||
},
|
||||
enableResizing: false,
|
||||
size: 5,
|
||||
cell: () => null
|
||||
}
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user