diff --git a/src/BootstrapBlazor/Components/Table/Table.razor.Localization.cs b/src/BootstrapBlazor/Components/Table/Table.razor.Localization.cs index 1ebcc0cde..e28e2c106 100644 --- a/src/BootstrapBlazor/Components/Table/Table.razor.Localization.cs +++ b/src/BootstrapBlazor/Components/Table/Table.razor.Localization.cs @@ -325,5 +325,6 @@ public partial class Table SortAscText ??= Localizer[nameof(SortAscText)]; SortDescText ??= Localizer[nameof(SortDescText)]; EmptyText ??= Localizer[nameof(EmptyText)]; + LineNoText ??= Localizer[nameof(LineNoText)]; } } diff --git a/src/BootstrapBlazor/Components/Table/Table.razor.Pagination.cs b/src/BootstrapBlazor/Components/Table/Table.razor.Pagination.cs index 4108341b7..0f23d87aa 100644 --- a/src/BootstrapBlazor/Components/Table/Table.razor.Pagination.cs +++ b/src/BootstrapBlazor/Components/Table/Table.razor.Pagination.cs @@ -30,7 +30,8 @@ public partial class Table /// 获得/设置 行号列标题文字 默认为 行号 /// [Parameter] - public string LineNoText { get; set; } = "行号"; + [NotNull] + public string? LineNoText { get; set; } private bool PageItemsSourceChanged { get; set; } diff --git a/src/BootstrapBlazor/Locales/de.json b/src/BootstrapBlazor/Locales/de.json index 9ca3049a8..18cc8f96f 100644 --- a/src/BootstrapBlazor/Locales/de.json +++ b/src/BootstrapBlazor/Locales/de.json @@ -223,6 +223,7 @@ "CheckboxDisplayText": "Alle", "EditModalTitle": "Bearbeiten", "AddModalTitle": "Neu", + "LineNoText": "Zeilen", "ColumnButtonTemplateHeaderText": "", "SearchTooltip": "
Bitte eingeben ...
Enter Suche ESC Leeren
", "SearchModalTitle": "Suche", diff --git a/src/BootstrapBlazor/Locales/en.json b/src/BootstrapBlazor/Locales/en.json index 9e3cd3553..88d18fa6b 100644 --- a/src/BootstrapBlazor/Locales/en.json +++ b/src/BootstrapBlazor/Locales/en.json @@ -223,6 +223,7 @@ "CheckboxDisplayText": "All", "EditModalTitle": "Edit", "AddModalTitle": "New", + "LineNoText": "No.", "ColumnButtonTemplateHeaderText": "", "SearchTooltip": "
Please input ...
Enter Search ESC Clear
", "SearchModalTitle": "Searching", diff --git a/src/BootstrapBlazor/Locales/pt.json b/src/BootstrapBlazor/Locales/pt.json index 2a232bd2f..56fc0af25 100644 --- a/src/BootstrapBlazor/Locales/pt.json +++ b/src/BootstrapBlazor/Locales/pt.json @@ -223,6 +223,7 @@ "CheckboxDisplayText": "Todos", "EditModalTitle": "Editar Registro", "AddModalTitle": "Novo Registro", + "LineNoText": "Número", "ColumnButtonTemplateHeaderText": "", "SearchTooltip": "
Tecle ...
Enter Pesquisar ESC Limpar
", "SearchModalTitle": "Procurando", diff --git a/src/BootstrapBlazor/Locales/zh.json b/src/BootstrapBlazor/Locales/zh.json index 66c74bf73..fbf21e500 100644 --- a/src/BootstrapBlazor/Locales/zh.json +++ b/src/BootstrapBlazor/Locales/zh.json @@ -223,6 +223,7 @@ "CheckboxDisplayText": "选择", "EditModalTitle": "编辑窗口", "AddModalTitle": "新建窗口", + "LineNoText": "行号", "ColumnButtonTemplateHeaderText": "操作", "SearchTooltip": "
输入任意字符串全局搜索
Enter 搜索 ESC 清除搜索
", "SearchModalTitle": "搜索条件", diff --git a/test/UnitTest/Components/TableTest.cs b/test/UnitTest/Components/TableTest.cs index 8b26b469c..4f6a2bb0f 100644 --- a/test/UnitTest/Components/TableTest.cs +++ b/test/UnitTest/Components/TableTest.cs @@ -403,6 +403,38 @@ public class TableTest : TableTestBase } } + [Fact] + public async Task PageItemsSource_Ok() + { + var localizer = Context.Services.GetRequiredService>(); + var cut = Context.RenderComponent(pb => + { + pb.AddChildContent>(pb => + { + pb.Add(a => a.RenderMode, TableRenderMode.Table); + pb.Add(a => a.PageItemsSource, new int[] { 2, 4, 8 }); + pb.Add(a => a.IsPagination, true); + pb.Add(a => a.OnQueryAsync, OnQueryAsync(localizer)); + pb.Add(a => a.TableColumns, foo => builder => + { + builder.OpenComponent>(0); + builder.AddAttribute(1, "Field", "Name"); + builder.AddAttribute(2, "FieldExpression", Utility.GenerateValueExpression(foo, "Name", typeof(string))); + builder.CloseComponent(); + }); + }); + }); + + var pager = cut.FindComponent(); + await cut.InvokeAsync(() => pager.Instance.OnPageItemsChanged!.Invoke(2)); + var activePage = cut.Find(".page-item.active"); + Assert.Equal("1", activePage.TextContent); + + await cut.InvokeAsync(() => pager.Instance.OnPageClick!.Invoke(2, 2)); + activePage = cut.Find(".page-item.active"); + Assert.Equal("2", activePage.TextContent); + } + [Fact] public void IsFixedHeader_Ok() {