From 0d6f781d5d49c492146c99755153d6b297d916b0 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Tue, 14 Nov 2023 16:13:23 +0800 Subject: [PATCH] fix(table): missing drag event when use dynamic data (#2369) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复 TH 时间丢失导致内存泄露问题 * chore: bump version 7.12.2-beta03 * test: 更新单元测试 --- src/BootstrapBlazor/BootstrapBlazor.csproj | 2 +- src/BootstrapBlazor/Components/Table/Table.razor.js | 13 +++++++++++++ test/UnitTest/Components/PaginationTest.cs | 4 ++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index 821ded98f53..e5b019a1b9a 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@ - 7.12.2-beta02 + 7.12.2-beta03 diff --git a/src/BootstrapBlazor/Components/Table/Table.razor.js b/src/BootstrapBlazor/Components/Table/Table.razor.js index bebc796a9af..bcc88532dfd 100644 --- a/src/BootstrapBlazor/Components/Table/Table.razor.js +++ b/src/BootstrapBlazor/Components/Table/Table.razor.js @@ -195,6 +195,19 @@ const resetTableWidth = table => { const setResizeListener = table => { const eff = (col, toggle) => { const th = col.closest('th') + if (th.parentNode === null) { + EventHandler.off(col, 'click') + EventHandler.off(col, 'mousedown') + EventHandler.off(col, 'touchstart') + + table.tables.forEach(t => { + const cells = t.querySelectorAll('.border-resize'); + cells.forEach(c => c.classList.remove('border-resize')) + }) + + return + } + if (toggle) th.classList.add('border-resize') else th.classList.remove('border-resize') diff --git a/test/UnitTest/Components/PaginationTest.cs b/test/UnitTest/Components/PaginationTest.cs index 207c677b16c..943d2c78a11 100644 --- a/test/UnitTest/Components/PaginationTest.cs +++ b/test/UnitTest/Components/PaginationTest.cs @@ -78,7 +78,7 @@ public void GotoTemplate_Ok() } [Fact] - public void GotoNavigator_Ok() + public async Task GotoNavigator_Ok() { var index = 0; var cut = Context.RenderComponent(pb => @@ -94,7 +94,7 @@ public void GotoNavigator_Ok() var navigator = cut.FindComponent(); var input = navigator.Find("input"); - cut.InvokeAsync(() => + await cut.InvokeAsync(() => { input.Change("5"); input.KeyUp("Enter");