rewrite feed table

This commit is contained in:
pa
2026-01-05 23:58:02 +09:00
committed by Natsumi
parent 28488a6887
commit 2b4273b492
54 changed files with 1830 additions and 1054 deletions

View File

@@ -0,0 +1,55 @@
import { computed, onMounted, onUnmounted, ref } from 'vue';
export function useDataTableScrollHeight(containerRef, options = {}) {
const offset = options.offset ?? 127;
const toolbarHeight = options.toolbarHeight ?? 0;
const paginationHeight = options.paginationHeight ?? 0;
const maxHeight = ref(0);
let resizeObserver;
const recalc = () => {
const containerEl = containerRef?.value;
if (!containerEl) {
return;
}
const available =
containerEl.clientHeight -
offset -
toolbarHeight -
paginationHeight;
maxHeight.value = Math.max(0, available);
};
onMounted(() => {
recalc();
resizeObserver = new ResizeObserver(() => {
recalc();
});
if (containerRef?.value) {
resizeObserver.observe(containerRef.value);
}
});
onUnmounted(() => {
resizeObserver?.disconnect();
});
const tableStyle = computed(() => {
if (!Number.isFinite(maxHeight.value) || maxHeight.value <= 0) {
return undefined;
}
return {
maxHeight: `${maxHeight.value}px`
};
});
return {
tableStyle
};
}