Skip to content

Commit 00d6f83

Browse files
committed
Revert "fix(ITableColumn): add GetTooltipText method (#4889)"
This reverts commit 06ed5f0.
1 parent 06ed5f0 commit 00d6f83

File tree

13 files changed

+19
-48
lines changed

13 files changed

+19
-48
lines changed

src/BootstrapBlazor.Server/Components/Samples/Table/TablesWrap.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
<TableColumns>
7272
<TableColumn @bind-Field="@context.DateTime" Width="180" Text="@Localizer["TablesWrapDataResizingColumHeaderText_DateTime"]" />
7373
<TableColumn @bind-Field="@context.Name" Text="@Localizer["TablesWrapDataResizingColumHeaderText_Name"]" />
74-
<TableColumn @bind-Field="@context.Address" Text="@Localizer["TablesWrapDataResizingColumHeaderText_Address"]" Width="200" TextEllipsis="true" ShowTips="true" GetTooltipText="GetTooltipText" />
74+
<TableColumn @bind-Field="@context.Address" Text="@Localizer["TablesWrapDataResizingColumHeaderText_Address"]" Width="200" TextEllipsis="true" ShowTips="true" GetTooltipTextCallback="GetTooltipTextCallback" />
7575
<TableColumn @bind-Field="@context.Education" />
7676
<TableColumn @bind-Field="@context.Count" />
7777
<TableColumn @bind-Field="@context.Complete" />

src/BootstrapBlazor.Server/Components/Samples/Table/TablesWrap.razor.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@ private Task<QueryData<Foo>> OnQueryAsync(QueryPageOptions options)
3838
return Task.FromResult(new QueryData<Foo>() { Items = items, TotalCount = total, IsSorted = true, IsFiltered = true, IsSearch = true });
3939
}
4040

41-
private static string? GetTooltipText(object? v)
41+
private async Task<string?> GetTooltipTextCallback(object? v)
4242
{
43+
await Task.Delay(0);
44+
4345
var ret = string.Empty;
4446
if (v is Foo foo)
4547
{
46-
ret = $"{foo.Name}-{foo.Address}";
48+
ret = $"{foo.Name}-{DateTime.Now}";
4749
}
4850
return ret;
4951
}

src/BootstrapBlazor.Server/Locales/en-US.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5265,7 +5265,7 @@
52655265
"TablesWrapDataResizingTips1": "You can drag the window size, and the <b>address</b> column will be automatically omitted if the window is too small",
52665266
"TablesWrapDataResizingTips2": "Enable text ellipsis by setting <code>TextEllipsis</code>",
52675267
"TablesWrapDataResizingTips3": "<b>Note:</b> It is recommended to use <code>Width</code> to set the column width. If the column width is not set, it will automatically use 200px width inside",
5268-
"TablesWrapDataResizingTips4": "After the text in the cell is omitted, you can use the <code>ShowTips</code> property to control whether to display all the text on mouse hover, the default is <code>false</code>, You can customize the display content of <code>Tooltip</code> by setting the <code>GetTooltipText</code> callback method",
5268+
"TablesWrapDataResizingTips4": "After the text in the cell is omitted, you can use the <code>ShowTips</code> property to control whether to display all the text on mouse hover, the default is <code>false</code>, You can customize the display content of <code>Tooltip</code> by setting the <code>GetTooltipTextCallback</code> callback method",
52695269
"TablesWrapDataResizingTips5": "Drag the address column, the cell display content will automatically increase and decrease",
52705270
"TablesWrapCustomCellTitle": "Custom in-cell typography",
52715271
"TablesWrapCustomCellIntro": "Use templates for special layout of in-cell data",

src/BootstrapBlazor.Server/Locales/zh-CN.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5265,7 +5265,7 @@
52655265
"TablesWrapDataResizingTips1": "可以拖动窗口大小,窗口过小时 <b>地址</b> 列自动进行省略处理",
52665266
"TablesWrapDataResizingTips2": "通过设置 <code>TextEllipsis</code> 来开启文本超长省略功能",
52675267
"TablesWrapDataResizingTips3": "<b>注意:</b>推荐使用 <code>Width</code> 对列宽度进行设置,如未设置列宽内部自动使用 200px 宽度",
5268-
"TablesWrapDataResizingTips4": "单元格内文本被省略后,可以通过 <code>ShowTips</code> 属性来控制鼠标悬停是否显示全部文本,默认为 <code>false</code>,通过设置 <code>GetTooltipText</code> 回调方法可以自定义 <code>Tooltip</code> 显示内容;注意异步方法 <code>GetTooltipTextCallback</code> 已弃用请勿使用",
5268+
"TablesWrapDataResizingTips4": "单元格内文本被省略后,可以通过 <code>ShowTips</code> 属性来控制鼠标悬停是否显示全部文本,默认为 <code>false</code>,通过设置 <code>GetTooltipTextCallback</code> 回调方法可以自定义 <code>Tooltip</code> 显示内容",
52695269
"TablesWrapDataResizingTips5": "拖动地址列,单元格显示内容自动增加与减少",
52705270
"TablesWrapCustomCellTitle": "自定义单元格内排版",
52715271
"TablesWrapCustomCellIntro": "使用模板对单元格内数据进行特殊布局",

src/BootstrapBlazor/Attributes/AutoGenerateColumnAttribute.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,8 @@ public class AutoGenerateColumnAttribute : AutoGenerateBaseAttribute, ITableColu
203203
/// <summary>
204204
/// <inheritdoc/>
205205
/// </summary>
206-
[Obsolete("已弃用,请使用同步方法 GetTooltipText;Deprecated, please use the synchronous method GetTooltipText")]
207-
[ExcludeFromCodeCoverage]
208206
Func<object?, Task<string?>>? ITableColumn.GetTooltipTextCallback { get; set; }
209207

210-
/// <summary>
211-
/// <inheritdoc/>
212-
/// </summary>
213-
Func<object?, string?>? ITableColumn.GetTooltipText { get; set; }
214-
215208
/// <summary>
216209
/// <inheritdoc/>
217210
/// </summary>

src/BootstrapBlazor/Components/Table/ITableColumn.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,8 @@ public interface ITableColumn : IEditorItem
143143
/// <summary>
144144
/// 获得/设置 鼠标悬停提示自定义内容回调委托 默认 null 使用当前值
145145
/// </summary>
146-
[Obsolete("已弃用,请使用同步方法 GetTooltipText;Deprecated, please use the synchronous method GetTooltipText")]
147-
[ExcludeFromCodeCoverage]
148146
Func<object?, Task<string?>>? GetTooltipTextCallback { get; set; }
149147

150-
/// <summary>
151-
/// 获得/设置 鼠标悬停提示自定义内容回调委托 默认 null 使用当前值
152-
/// </summary>
153-
Func<object?, string?>? GetTooltipText { get; set; }
154-
155148
/// <summary>
156149
/// 获得/设置 单元格回调方法
157150
/// </summary>

src/BootstrapBlazor/Components/Table/InternalTableColumn.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,8 @@ class InternalTableColumn(string fieldName, Type fieldType, string? fieldText =
133133

134134
public bool? ShowTips { get; set; }
135135

136-
/// <summary>
137-
/// <inheritdoc/>
138-
/// </summary>
139-
[Obsolete("已弃用,请使用同步方法 GetTooltipText;Deprecated, please use the synchronous method GetTooltipText")]
140-
[ExcludeFromCodeCoverage]
141136
public Func<object?, Task<string?>>? GetTooltipTextCallback { get; set; }
142137

143-
/// <summary>
144-
/// <inheritdoc/>
145-
/// </summary>
146-
public Func<object?, string?>? GetTooltipText { get; set; }
147-
148138
public Type PropertyType { get; } = fieldType;
149139

150140
[ExcludeFromCodeCoverage]

src/BootstrapBlazor/Components/Table/TableColumn.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,16 +269,8 @@ public class TableColumn<TItem, TType> : BootstrapComponentBase, ITableColumn
269269
/// <inheritdoc/>
270270
/// </summary>
271271
[Parameter]
272-
[Obsolete("已弃用,请使用同步方法 GetTooltipText;Deprecated, please use the synchronous method GetTooltipText")]
273-
[ExcludeFromCodeCoverage]
274272
public Func<object?, Task<string?>>? GetTooltipTextCallback { get; set; }
275273

276-
/// <summary>
277-
/// <inheritdoc/>
278-
/// </summary>
279-
[Parameter]
280-
public Func<object?, string?>? GetTooltipText { get; set; }
281-
282274
/// <summary>
283275
/// 获得/设置 列 td 自定义样式 默认为 null 未设置
284276
/// </summary>

src/BootstrapBlazor/Extensions/ITableColumnExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private static void CopyValue(this ITableColumn col, ITableColumn dest)
105105
if (col.IsVisibleWhenEdit.HasValue) dest.IsVisibleWhenEdit = col.IsVisibleWhenEdit;
106106
if (col.IsReadonlyWhenAdd.HasValue) dest.IsReadonlyWhenAdd = col.IsReadonlyWhenAdd;
107107
if (col.IsReadonlyWhenEdit.HasValue) dest.IsReadonlyWhenEdit = col.IsReadonlyWhenEdit;
108-
if (col.GetTooltipText != null) dest.GetTooltipText = col.GetTooltipText;
108+
if (col.GetTooltipTextCallback != null) dest.GetTooltipTextCallback = col.GetTooltipTextCallback;
109109
if (col.CustomSearch != null) dest.CustomSearch = col.CustomSearch;
110110
if (col.ToolboxTemplate != null) dest.ToolboxTemplate = col.ToolboxTemplate;
111111
if (col.IsRequiredWhenAdd.HasValue) dest.IsRequiredWhenAdd = col.IsRequiredWhenAdd;
@@ -238,14 +238,14 @@ internal static RenderFragment RenderColor<TItem>(this ITableColumn col, TItem i
238238
builder.CloseElement();
239239
};
240240

241-
private static RenderFragment RenderTooltip<TItem>(this ITableColumn col, string? text, TItem item) => pb =>
241+
private static RenderFragment RenderTooltip<TItem>(this ITableColumn col, string? text, TItem item) => async pb =>
242242
{
243243
if (col.GetShowTips())
244244
{
245245
var tooltipText = text;
246-
if (col.GetTooltipText != null)
246+
if (col.GetTooltipTextCallback != null)
247247
{
248-
tooltipText = col.GetTooltipText(item);
248+
tooltipText = await col.GetTooltipTextCallback(item);
249249
}
250250
pb.OpenComponent<Tooltip>(0);
251251
pb.AddAttribute(1, nameof(Tooltip.Title), tooltipText);

test/UnitTest/Attributes/AutoGenerateClassTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ public void AutoGenerateColumn_Ok()
156156
attrInterface.IsReadonlyWhenEdit = true;
157157
Assert.True(attrInterface.IsReadonlyWhenEdit);
158158

159-
attrInterface.GetTooltipText = _ => "Test";
160-
Assert.NotNull(attrInterface.GetTooltipText);
159+
attrInterface.GetTooltipTextCallback = _ => Task.FromResult((string?)"Test");
160+
Assert.NotNull(attrInterface.GetTooltipTextCallback);
161161

162162
attrInterface.CustomSearch = (_, _) => new SearchFilterAction("test", "test");
163163
Assert.NotNull(attrInterface.CustomSearch);

0 commit comments

Comments
 (0)