mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 06:43:51 +02:00
rewrite friendlist table
This commit is contained in:
@@ -7,7 +7,7 @@ import {
|
||||
isFunction,
|
||||
useVueTable
|
||||
} from '@tanstack/vue-table';
|
||||
import { ref, unref, watch } from 'vue';
|
||||
import { computed, ref, unref, watch } from 'vue';
|
||||
|
||||
function safeJsonParse(str) {
|
||||
if (!str) {
|
||||
@@ -233,12 +233,13 @@ export function useVrcxVueTable(options) {
|
||||
});
|
||||
}
|
||||
|
||||
const dataSource = computed(() => resolveMaybeGetter(options.data));
|
||||
const columnsSource = computed(() => resolveMaybeGetter(options.columns));
|
||||
|
||||
const table = useVueTable({
|
||||
get data() {
|
||||
return resolveMaybeGetter(options.data);
|
||||
},
|
||||
data: dataSource,
|
||||
get columns() {
|
||||
const cols = resolveMaybeGetter(options.columns);
|
||||
const cols = columnsSource.value;
|
||||
|
||||
const stretchAfterId = findStretchColumnId(cols);
|
||||
|
||||
@@ -261,6 +262,23 @@ export function useVrcxVueTable(options) {
|
||||
...tableOptions
|
||||
});
|
||||
|
||||
watch(
|
||||
columnsSource,
|
||||
(next) => {
|
||||
table.setOptions((prev) => ({
|
||||
...prev,
|
||||
columns: withSpacerColumn(
|
||||
next,
|
||||
fillRemainingSpace,
|
||||
spacerColumnId,
|
||||
findStretchColumnId(next)
|
||||
)
|
||||
}));
|
||||
table.setState((prev) => ({ ...prev }));
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
const persistWrite = debounce(
|
||||
(payload) => writePersisted(payload),
|
||||
persistDebounceMs
|
||||
|
||||
Reference in New Issue
Block a user