Skip to content

Commit 5d38ff7

Browse files
committed
style(Table): add ColumnListSelectExtension i18n cfg
1 parent 6e214a7 commit 5d38ff7

4 files changed

Lines changed: 28 additions & 4 deletions

File tree

src/BootstrapBlazor/Components/Table/Table.razor.Checkbox.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,9 @@ private async Task InverseSelected()
219219

220220
if (VisibleColumnsCurrentSelectedResult == CheckboxState.UnChecked && _visibleColumns.Any())
221221
{
222-
await ShowToastAsync("提示", "表格需要至少有一列显示,全不选时默认第一列维持显示状态", ToastCategory.Warning);
222+
await ShowToastAsync(
223+
ColumnGroupSelectButtonWarnToastTitle,
224+
ColumnGroupSelectButtonWarnToastContent, ToastCategory.Warning);
223225
_visibleColumns[0].Visible = true;
224226
}
225227
await InvokeAsync(StateHasChanged);
@@ -235,7 +237,9 @@ private async Task OnToggleAllColumnsVisibleState(CheckboxState state, string _)
235237
}
236238
else if (state == CheckboxState.UnChecked)
237239
{
238-
await ShowToastAsync("提示", "表格需要至少有一列显示,全不选时默认第一列维持显示状态", ToastCategory.Warning);
240+
await ShowToastAsync(
241+
ColumnGroupSelectButtonWarnToastTitle,
242+
ColumnGroupSelectButtonWarnToastContent, ToastCategory.Warning);
239243
foreach (var column in _visibleColumns.Skip(1).ToList())
240244
{
241245
column.Visible = false;

src/BootstrapBlazor/Components/Table/Table.razor.Localization.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,20 @@ public partial class Table<TItem>
364364
[NotNull]
365365
public string? AdvancedSortModalTitle { get; set; }
366366

367+
/// <summary>
368+
/// 获得/设置 编辑按钮 Toast 提示 Title 文字
369+
/// </summary>
370+
[Parameter]
371+
[NotNull]
372+
public string? ColumnGroupSelectButtonWarnToastTitle { get; set; }
373+
374+
/// <summary>
375+
/// 获得/设置 编辑按钮 Toast 未选择时提示 Content 文字
376+
/// </summary>
377+
[Parameter]
378+
[NotNull]
379+
public string? ColumnGroupSelectButtonWarnToastContent { get; set; }
380+
367381
[Inject]
368382
[NotNull]
369383
private IStringLocalizer<Table<TItem>>? Localizer { get; set; }
@@ -438,5 +452,7 @@ private void OnInitLocalization()
438452
AlignCenterTooltipText ??= Localizer[nameof(AlignCenterTooltipText)];
439453
AlignRightText ??= Localizer[nameof(AlignRightText)];
440454
AlignRightTooltipText ??= Localizer[nameof(AlignRightTooltipText)];
455+
ColumnGroupSelectButtonWarnToastTitle ??= Localizer[nameof(ColumnGroupSelectButtonWarnToastTitle)];
456+
ColumnGroupSelectButtonWarnToastContent ??= Localizer[nameof(ColumnGroupSelectButtonWarnToastContent)];
441457
}
442458
}

src/BootstrapBlazor/Locales/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,9 @@
254254
"AlignCenterText": "Center",
255255
"AlignCenterTooltipText": "Click to align text in this column to the center",
256256
"AlignRightText": "Right",
257-
"AlignRightTooltipText": "Click to align text in this column to the right"
257+
"AlignRightTooltipText": "Click to align text in this column to the right",
258+
"ColumnGroupSelectButtonWarnToastTitle": "Warning",
259+
"ColumnGroupSelectButtonWarnToastContent": "Table must have at least one column displayed. When none are selected, the first column will remain visible by default."
258260
},
259261
"BootstrapBlazor.Components.EditDialog": {
260262
"CloseButtonText": "Close",

src/BootstrapBlazor/Locales/zh.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,9 @@
254254
"AlignCenterText": "居中",
255255
"AlignCenterTooltipText": "点击后本列文本居中对齐",
256256
"AlignRightText": "右对齐",
257-
"AlignRightTooltipText": "点击后本列文本右对齐"
257+
"AlignRightTooltipText": "点击后本列文本右对齐",
258+
"ColumnGroupSelectButtonWarnToastTitle": "提示",
259+
"ColumnGroupSelectButtonWarnToastContent": "表格需要至少有一列显示,全不选时默认第一列维持显示状态"
258260
},
259261
"BootstrapBlazor.Components.EditDialog": {
260262
"CloseButtonText": "关闭",

0 commit comments

Comments
 (0)