Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions src/Core/Components/DataGrid/FluentDataGrid.razor
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
return;
}

<FluentDataGridRow TGridItem="TGridItem">
<FluentDataGridRow Class="@EMPTY_CONTENT_ROW_CLASS" TGridItem="TGridItem">
<FluentDataGridCell Class="empty-content-cell" Style="@($"grid-column: 1 / {_columns.Count + 1}")">
@if (EmptyContent is null)
{
Expand All @@ -222,7 +222,7 @@

private void RenderLoadingContent(RenderTreeBuilder __builder)
{
<FluentDataGridRow TGridItem="TGridItem">
<FluentDataGridRow Class="@LOADING_CONTENT_ROW_CLASS" TGridItem="TGridItem">
<FluentDataGridCell Class="loading-content-cell" Style="@($"grid-column: 1 / {_columns.Count + 1}")">
@if (LoadingContent is null)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Core/Components/DataGrid/FluentDataGrid.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ namespace Microsoft.FluentUI.AspNetCore.Components;
public partial class FluentDataGrid<TGridItem> : FluentComponentBase, IHandleEvent, IAsyncDisposable
{
private const string JAVASCRIPT_FILE = "./_content/Microsoft.FluentUI.AspNetCore.Components/Components/DataGrid/FluentDataGrid.razor.js";
public const string EMPTY_CONTENT_ROW_CLASS = "empty-content-row";
public const string LOADING_CONTENT_ROW_CLASS = "loading-content-row";

/// <summary />
[Inject]
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Components/DataGrid/FluentDataGridCell.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public partial class FluentDataGridCell<TGridItem> : FluentComponentBase
.AddStyle("width", Column?.Width, !string.IsNullOrEmpty(Column?.Width) && Grid.DisplayMode == DataGridDisplayMode.Table)
.AddStyle("height", $"{Grid.ItemSize:0}px", () => !Grid.EffectiveLoadingValue && Grid.Virtualize && Owner.RowType == DataGridRowType.Default && CellType == DataGridCellType.ColumnHeader)
.AddStyle("height", $"{(int)Grid.RowSize}px", () => !Grid.EffectiveLoadingValue && !Grid.Virtualize && Grid.Items is not null && !Grid.MultiLine)
.AddStyle("height", "100%", InternalGridContext.TotalItemCount == 0 || (Grid.EffectiveLoadingValue && Grid.Items is null) || Grid.MultiLine)
.AddStyle("height", "100%", Grid.MultiLine)
.AddStyle("min-height", "44px", Owner.RowType != DataGridRowType.Default)
.AddStyle("display", "flex", CellType == DataGridCellType.ColumnHeader && !Grid.HeaderCellAsButtonWithMenu && !Grid.ResizableColumns && (Column is null || (Column!.Sortable.HasValue && !Column!.Sortable.Value)))
.AddStyle(Owner.Style)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ td {
font-weight: 600;
text-align: center;
height: 100%;
user-select: none;
}

.multiline-text {
Expand Down
5 changes: 5 additions & 0 deletions src/Core/Components/DataGrid/FluentDataGridRow.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ internal async Task HandleOnRowClickAsync(string rowId)
{
var row = GetRow(rowId);

if (row is not null && !string.IsNullOrWhiteSpace(row.Class) && (row.Class.Contains(FluentDataGrid<TGridItem>.EMPTY_CONTENT_ROW_CLASS) || row.Class.Contains(FluentDataGrid<TGridItem>.LOADING_CONTENT_ROW_CLASS)))
{
return;
}

if (row != null && Grid.OnRowClick.HasDelegate)
{
await Grid.OnRowClick.InvokeAsync(row);
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Components/DataGrid/FluentDataGridRow.razor.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
z-index: 3;
}

.hover:not([row-type='header'],[row-type='sticky-header'],.loading-content-row):hover ::deep td {
.hover:not([row-type='header'],[row-type='sticky-header'],.loading-content-row):hover ::deep td:not(.empty-content-cell) {
cursor: pointer;
background-color: var(--datagrid-hover-color, var(--neutral-fill-stealth-hover));
}
Expand Down
Loading