Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/BootstrapBlazor/Components/Table/Table.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ private string GetSortTooltip(ITableColumn col) => SortName != col.GetFieldName(
[Parameter]
public bool IsExcel { get; set; }

/// <summary>
/// 获得/设置 是否启用 Excel 模式下的键盘导航功能 默认 true
/// </summary>
[Parameter]
public bool EnableKeyboardNavigationCell { get; set; } = true;

/// <summary>
/// 获得/设置 是否显示明细行 默认为 null 为空时使用 <see cref="DetailRowTemplate" /> 进行逻辑判断
/// </summary>
Expand Down Expand Up @@ -1054,7 +1060,8 @@ private async Task OnTableRenderAsync(bool firstRender)
Text = Localizer["AlignRightText"].Value,
Tooltip = Localizer["AlignRightTooltipText"].Value
}
}
},
EnableKeyboardNavigationCell
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/BootstrapBlazor/Components/Table/Table.razor.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function reset(id) {
table.tables.push(shim.firstChild)
}

if (table.isExcel) {
if (table.options.enableKeyboardNavigationCell === true && table.isExcel) {
setExcelKeyboardListener(table)
}

Expand Down Expand Up @@ -232,7 +232,7 @@ const destroyTable = table => {
EventHandler.off(table.body, 'scroll')
}

if (table.isExcel) {
if (table.options.enableKeyboardNavigationCell === true && table.isExcel) {
EventHandler.off(table.element, 'keydown')
}

Expand Down
2 changes: 1 addition & 1 deletion test/UnitTest/Components/TableTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using System.ComponentModel.DataAnnotations;
using System.Data;
using System.Reflection;
using System.Runtime.CompilerServices;

namespace UnitTest.Components;

Expand Down Expand Up @@ -581,6 +580,7 @@ public async Task ShowToolbar_IsExcel_Ok()
{
pb.Add(a => a.RenderMode, TableRenderMode.Table);
pb.Add(a => a.IsExcel, true);
pb.Add(a => a.EnableKeyboardNavigationCell, true);
pb.Add(a => a.Items, items);
pb.Add(a => a.OnSaveAsync, (foo, changedItem) =>
{
Expand Down