fix: retain pending Toast and Table fidelity corrections
This commit is contained in:
@@ -92,9 +92,10 @@ function generateUsers(count: number): User[] {
|
||||
}
|
||||
|
||||
const users = generateUsers(1000);
|
||||
const ITEM_HEIGHT = 48;
|
||||
// Matches the fixed upstream Virtualizer layoutOptions (rowHeight/headingHeight 42).
|
||||
const ITEM_HEIGHT = 42;
|
||||
const rowKeys = users.map((user) => user.id);
|
||||
const VIEWPORT = 320;
|
||||
const VIEWPORT = 300;
|
||||
const OVERSCAN = 8;
|
||||
const scrollTop = ref(0);
|
||||
const scrollEl = ref<HTMLElement | null>(null);
|
||||
@@ -117,8 +118,8 @@ function focusRow(_key: string | number, index: number) {
|
||||
if (!node) return;
|
||||
const top = index * ITEM_HEIGHT;
|
||||
if (top < node.scrollTop) node.scrollTop = top;
|
||||
else if (top + ITEM_HEIGHT > node.scrollTop + VIEWPORT - 44)
|
||||
node.scrollTop = top + ITEM_HEIGHT - VIEWPORT + 44;
|
||||
else if (top + ITEM_HEIGHT > node.scrollTop + VIEWPORT)
|
||||
node.scrollTop = top + ITEM_HEIGHT - VIEWPORT;
|
||||
scrollTop.value = node.scrollTop;
|
||||
}
|
||||
function onScroll(event: Event) {
|
||||
@@ -136,20 +137,22 @@ onUnmounted(() => {
|
||||
<Table>
|
||||
<div
|
||||
ref="scrollEl"
|
||||
class="h-[320px] w-full overflow-auto"
|
||||
class="h-[300px] w-full overflow-auto"
|
||||
data-slot="table-virtual-viewport"
|
||||
>
|
||||
<TableContent
|
||||
aria-label="虚拟化表格"
|
||||
class="min-w-[600px] table-fixed"
|
||||
aria-label="1000 行虚拟化表格"
|
||||
class="min-w-[700px] table-fixed"
|
||||
:row-keys="rowKeys"
|
||||
:aria-rowcount="users.length + 1"
|
||||
@focus-row="focusRow"
|
||||
>
|
||||
<TableHeader aria-rowindex="1">
|
||||
<TableColumn id="name" is-row-header>姓名</TableColumn>
|
||||
<TableColumn id="role">角色</TableColumn>
|
||||
<TableColumn id="email">邮箱</TableColumn>
|
||||
<TableHeader aria-rowindex="1" class="h-full w-full">
|
||||
<TableColumn id="name" is-row-header :min-width="160">
|
||||
姓名
|
||||
</TableColumn>
|
||||
<TableColumn id="role" :min-width="220">角色</TableColumn>
|
||||
<TableColumn id="email" :min-width="240">邮箱</TableColumn>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
<tr aria-hidden="true" :style="{ height: padTop + 'px' }" />
|
||||
@@ -161,17 +164,20 @@ onUnmounted(() => {
|
||||
:style="{ height: ITEM_HEIGHT + 'px' }"
|
||||
>
|
||||
<TableCell
|
||||
class="h-12 whitespace-nowrap overflow-hidden text-ellipsis"
|
||||
class="whitespace-nowrap overflow-hidden text-ellipsis"
|
||||
:style="{ height: ITEM_HEIGHT + 'px' }"
|
||||
>
|
||||
{{ user.name }}
|
||||
</TableCell>
|
||||
<TableCell
|
||||
class="h-12 whitespace-nowrap overflow-hidden text-ellipsis"
|
||||
class="whitespace-nowrap overflow-hidden text-ellipsis"
|
||||
:style="{ height: ITEM_HEIGHT + 'px' }"
|
||||
>
|
||||
{{ user.role }}
|
||||
</TableCell>
|
||||
<TableCell
|
||||
class="h-12 whitespace-nowrap overflow-hidden text-ellipsis"
|
||||
class="whitespace-nowrap overflow-hidden text-ellipsis"
|
||||
:style="{ height: ITEM_HEIGHT + 'px' }"
|
||||
>
|
||||
{{ user.email }}
|
||||
</TableCell>
|
||||
|
||||
Reference in New Issue
Block a user