From 81531f39bf26be459c55d83c6689bcfee8aba0db Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Thu, 30 Jul 2026 13:19:43 +0800 Subject: [PATCH] test(vtable-plugins): add filter popup position regression demo --- .../issue-4625-filter-popup-position.ts | 61 +++++++++++++++++++ packages/vtable-plugins/demo/menu.ts | 4 ++ 2 files changed, 65 insertions(+) create mode 100644 packages/vtable-plugins/demo/filter/issue-4625-filter-popup-position.ts diff --git a/packages/vtable-plugins/demo/filter/issue-4625-filter-popup-position.ts b/packages/vtable-plugins/demo/filter/issue-4625-filter-popup-position.ts new file mode 100644 index 0000000000..dc1658e3d0 --- /dev/null +++ b/packages/vtable-plugins/demo/filter/issue-4625-filter-popup-position.ts @@ -0,0 +1,61 @@ +import * as VTable from '@visactor/vtable'; +import { FilterPlugin } from '../../src/filter'; + +const CONTAINER_ID = 'vTable'; + +const generateDemoData = (count: number) => { + const departments = ['研发部', '市场部', '销售部', '人事部', '财务部']; + const statuses = ['在职', '请假', '离职']; + + return Array.from(new Array(count)).map((_, i) => ({ + id: i + 1, + name: `员工${i + 1}`, + age: 22 + (i % 20), + department: departments[i % departments.length], + salary: 5000 + i * 300, + status: statuses[i % statuses.length], + isFullTime: i % 3 !== 0, + status1: statuses[(i + 1) % statuses.length], + status2: statuses[(i + 2) % statuses.length], + status3: statuses[i % statuses.length], + status4: statuses[(i + 1) % statuses.length], + status5: statuses[(i + 2) % statuses.length] + })); +}; + +export function createTable() { + const container = document.getElementById(CONTAINER_ID)!; + container.style.width = '800px'; + container.style.height = '500px'; + + const filterPlugin = new FilterPlugin({ + filterModes: ['byValue', 'byCondition'] + }); + + const tableInstance = new VTable.ListTable({ + container, + records: generateDemoData(50), + columns: [ + { field: 'id', title: 'ID', width: 60 }, + { field: 'name', title: '姓名', width: 120 }, + { field: 'age', title: '年龄', width: 100 }, + { field: 'department', title: '部门', width: 120 }, + { + field: 'salary', + title: '薪资', + width: 120, + fieldFormat: record => `¥${record.salary}` + }, + { field: 'status', title: '状态', width: 100 }, + { field: 'isFullTime', title: '全职', width: 80, cellType: 'checkbox' }, + { field: 'status1', title: '状态1', width: 100 }, + { field: 'status2', title: '状态2', width: 100 }, + { field: 'status3', title: '状态3', width: 100 }, + { field: 'status4', title: '状态4', width: 100 }, + { field: 'status5', title: '状态5', width: 100 } + ], + plugins: [filterPlugin] + }); + + window.tableInstance = tableInstance; +} diff --git a/packages/vtable-plugins/demo/menu.ts b/packages/vtable-plugins/demo/menu.ts index b252dd55ad..f110a5cb4b 100644 --- a/packages/vtable-plugins/demo/menu.ts +++ b/packages/vtable-plugins/demo/menu.ts @@ -27,6 +27,10 @@ export const menus = [ path: 'filter', name: 'issue-5137' }, + { + path: 'filter', + name: 'issue-4625-filter-popup-position' + }, { path: 'filter', name: 'value-filter'