diff --git a/src/BootstrapBlazor.Server/Locales/en-US.json b/src/BootstrapBlazor.Server/Locales/en-US.json index 2a2af746a92..c0a3000adce 100644 --- a/src/BootstrapBlazor.Server/Locales/en-US.json +++ b/src/BootstrapBlazor.Server/Locales/en-US.json @@ -5584,7 +5584,7 @@ "TablesExportShowExportCsvButtonTitle": "Export Csv/Pdf Button", "TablesExportShowExportCsvButtonIntro": "Show/hide Csv/Pdf button by set ShowExportCsvButton=\"true\" ShowExportPdfButton=\"true\"", "TablesExportOnExportAsyncTitle": "Custom export method", - "TablesExportOnExportAsyncIntro": "You can customize the export method by setting the OnExportAsync callback delegate method. If you don't set it, the built-in export function of the component will be used.", + "TablesExportOnExportAsyncIntro": "You can customize the export method by setting the OnExportAsync callback delegate method. If you don't set it, the built-in export function of the component will be used. You can set the column property IgnoreWhenExport=\"true\" to ignore this column when exporting", "TablesExportButtonDropdownTemplateTitle": "Custom export dropdown button", "TablesExportButtonDropdownTemplateIntro": "Customize the content of the export button dropdown box by setting the ExportButtonDropdownTemplate template", "TablesExportButtonExcelText": "Export Page data - Excel", diff --git a/src/BootstrapBlazor.Server/Locales/zh-CN.json b/src/BootstrapBlazor.Server/Locales/zh-CN.json index 1bdee0a05a2..d32ba236160 100644 --- a/src/BootstrapBlazor.Server/Locales/zh-CN.json +++ b/src/BootstrapBlazor.Server/Locales/zh-CN.json @@ -5584,7 +5584,7 @@ "TablesExportShowExportCsvButtonTitle": "导出 Csv/Pdf", "TablesExportShowExportCsvButtonIntro": "通过设置 ShowExportCsvButton=\"true\" ShowExportPdfButton=\"true\" 控制 Csv/Pdf 导出按钮", "TablesExportOnExportAsyncTitle": "自定义导出方法", - "TablesExportOnExportAsyncIntro": "通过设置 OnExportAsync 回调委托方法可自定义导出方法,不设置将使用组件内置导出函数", + "TablesExportOnExportAsyncIntro": "通过设置 OnExportAsync 回调委托方法可自定义导出方法,不设置将使用组件内置导出函数,可通过设置列属性 IgnoreWhenExport=\"true\" 导出时忽略此列", "TablesExportButtonDropdownTemplateTitle": "自定义导出下拉框按钮", "TablesExportButtonDropdownTemplateIntro": "通过设置 ExportButtonDropdownTemplate 模板自定义导出按钮下拉框内容", "TablesExportButtonExcelText": "导出当前页数据 Excel", diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index fe343632130..6fb59027408 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@  - 9.6.2-beta02 + 9.6.2-beta03 diff --git a/src/BootstrapBlazor/Components/Table/Table.razor.cs b/src/BootstrapBlazor/Components/Table/Table.razor.cs index 3484cf9c646..48e88a059e3 100644 --- a/src/BootstrapBlazor/Components/Table/Table.razor.cs +++ b/src/BootstrapBlazor/Components/Table/Table.razor.cs @@ -250,6 +250,12 @@ private string GetSortTooltip(ITableColumn col) => SortName != col.GetFieldName( [Parameter] public bool IsExcel { get; set; } + /// + /// 获得/设置 是否启用 Excel 模式下的键盘导航功能 默认 true + /// + [Parameter] + public bool EnableKeyboardNavigationCell { get; set; } = true; + /// /// 获得/设置 是否显示明细行 默认为 null 为空时使用 进行逻辑判断 /// @@ -1054,7 +1060,8 @@ private async Task OnTableRenderAsync(bool firstRender) Text = Localizer["AlignRightText"].Value, Tooltip = Localizer["AlignRightTooltipText"].Value } - } + }, + EnableKeyboardNavigationCell }); } diff --git a/src/BootstrapBlazor/Components/Table/Table.razor.js b/src/BootstrapBlazor/Components/Table/Table.razor.js index 0998ac3afe6..c2b494acfe5 100644 --- a/src/BootstrapBlazor/Components/Table/Table.razor.js +++ b/src/BootstrapBlazor/Components/Table/Table.razor.js @@ -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) } @@ -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') } diff --git a/test/UnitTest/Components/TableTest.cs b/test/UnitTest/Components/TableTest.cs index 17e862a42bd..878c8391b06 100644 --- a/test/UnitTest/Components/TableTest.cs +++ b/test/UnitTest/Components/TableTest.cs @@ -11,7 +11,6 @@ using System.ComponentModel.DataAnnotations; using System.Data; using System.Reflection; -using System.Runtime.CompilerServices; namespace UnitTest.Components; @@ -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) => {