Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
93f6cf9
- Add enums
vnbaaij Jun 12, 2025
b255f69
- Add DataGrid component
vnbaaij Jun 12, 2025
96e40df
Add DataGridGeneratedHeaderType
vnbaaij Jun 12, 2025
f6d0fb1
Merge branch 'users/vnbaaij/dev-v5/datagrid-part1' into users/vnbaaij…
vnbaaij Jun 12, 2025
1059dbe
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/datagrid-part1
dvoituron Jun 12, 2025
595ff78
Fix analyzer errors
vnbaaij Jun 12, 2025
b1cf680
- Add Typical demo and flags
vnbaaij Jun 12, 2025
8393e35
Work on review comments
vnbaaij Jun 12, 2025
8cd48c6
Merge branch 'users/vnbaaij/dev-v5/datagrid-part1' of https://github.…
vnbaaij Jun 12, 2025
202c10a
Process review comments
vnbaaij Jun 12, 2025
5aa2c65
Add language resources
vnbaaij Jun 12, 2025
777e854
Add Unit Tests for Paginator
vnbaaij Jun 12, 2025
448c89e
More review comments
vnbaaij Jun 13, 2025
3146aeb
Update tests. Now 100% lc
vnbaaij Jun 13, 2025
69ffae6
- Add Typical demo and flags
vnbaaij Jun 13, 2025
35e0334
Replace tokens (WIP)
vnbaaij Jun 13, 2025
b92c83c
Remove flags. These will be added to sample data project in separate PR
vnbaaij Jun 17, 2025
430abd5
Remove DI abstractions package. Not needed
vnbaaij Jun 17, 2025
d0c1052
Merge dev-v5
vnbaaij Jun 17, 2025
33af462
Add IsFixed parameter
vnbaaij Jun 17, 2025
689fe43
merge dev-v5
vnbaaij Jun 17, 2025
44f7d0d
MAke example grid mor functional and look better
vnbaaij Jun 17, 2025
6fc0809
Add initial tests. They are not passing yet
vnbaaij Jun 18, 2025
5bcb9fa
Add surpression atribute, fix other analyzer warnings
vnbaaij Jun 18, 2025
a30dabf
Use localized strings
vnbaaij Jun 18, 2025
aadf080
Merg dev-v5
vnbaaij Jun 18, 2025
70c342b
Fix tests
vnbaaij Jun 18, 2025
b826128
Add Tests
vnbaaij Jun 19, 2025
d0979ea
Add tests for PaginatinState and TotalItemCountChangedEventArgs
vnbaaij Jun 19, 2025
a6aa6fc
Merge branch 'users/vnbaaij/dev-v5/pagination-tests' into users/vnbaa…
vnbaaij Jun 19, 2025
613cbd0
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/pagination-tests
vnbaaij Jun 19, 2025
af4f1e8
Add Row tests
vnbaaij Jun 19, 2025
89038a7
process review comments
vnbaaij Jun 19, 2025
bcdffd9
Merge branch 'users/vnbaaij/dev-v5/pagination-tests' into users/vnbaa…
vnbaaij Jun 19, 2025
ba9c0fb
More tests
vnbaaij Jun 19, 2025
924df75
More tests
vnbaaij Jun 19, 2025
726cf24
Merge branch 'users/vnbaaij/dev-v5/datagrid-part2' of https://github.…
vnbaaij Jun 20, 2025
8fe02c0
- Add typical demo
vnbaaij Jun 23, 2025
abb696c
More tests
vnbaaij Jun 29, 2025
4aae12f
- More tests
vnbaaij Jun 29, 2025
39dc140
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/datagrid-part2
vnbaaij Jul 1, 2025
f4b691a
Update file headers
vnbaaij Jul 1, 2025
1f50f07
Convert DataGrid JS to TS
vnbaaij Jul 1, 2025
097db2f
Implement fix for #3963
vnbaaij Jul 1, 2025
713d96b
Bring in changes made in v4 with #3949
vnbaaij Jul 1, 2025
2698837
- Update file headers
vnbaaij Jul 1, 2025
460a82f
Merge branch 'users/vnbaaij/dev-v5/datagrid-part2' into users/vnbaaij…
vnbaaij Jul 1, 2025
f9ce111
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/datagrid-part3
vnbaaij Jul 2, 2025
ab02f1c
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/datagrid-part2
vnbaaij Jul 2, 2025
088dd55
Process review comments:
vnbaaij Jul 2, 2025
ede49e6
Forgot to change the docs
vnbaaij Jul 2, 2025
87cb81a
Merge branch 'users/vnbaaij/dev-v5/datagrid-part2' into users/vnbaaij…
vnbaaij Jul 2, 2025
d47fc5e
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/datagrid-part2
vnbaaij Jul 2, 2025
f921191
- Use auto-generated constant
vnbaaij Jul 2, 2025
25e046e
Merge branch 'users/vnbaaij/dev-v5/datagrid-part2' of https://github.…
vnbaaij Jul 2, 2025
e6ec4a3
DataGrid docs and examples
vnbaaij Jul 2, 2025
07365bd
Merge branch 'users/vnbaaij/dev-v5/datagrid-part3' into users/vnbaaij…
vnbaaij Jul 2, 2025
5af4579
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/datagrid-part4
vnbaaij Jul 2, 2025
66af301
Merge branch 'users/vnbaaij/dev-v5/datagrid-part2' into users/vnbaaij…
vnbaaij Jul 3, 2025
9e89b82
Merge branch 'users/vnbaaij/dev-v5/datagrid-part3' into users/vnbaaij…
vnbaaij Jul 3, 2025
855fe34
Merge branch 'users/vnbaaij/dev-v5/datagrid-part4' of https://github.…
vnbaaij Jul 3, 2025
e3c942f
Process review comments
vnbaaij Jul 3, 2025
f6d458b
More review comments
vnbaaij Jul 3, 2025
64cf5bb
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/datagrid-part2
vnbaaij Jul 3, 2025
85154bf
- Undo make internal GridItemsProvider*
vnbaaij Jul 3, 2025
ed02449
Update test verified files
vnbaaij Jul 3, 2025
770c533
merge part 2
vnbaaij Jul 3, 2025
c6a2f1b
Merge branch 'users/vnbaaij/dev-v5/datagrid-part3' into users/vnbaaij…
vnbaaij Jul 3, 2025
d0246dd
Merge dev-v5
vnbaaij Jul 3, 2025
36dc27b
- Fix when to show header menu
vnbaaij Jul 3, 2025
150c1fd
- Rename getting started
vnbaaij Jul 3, 2025
567729b
WIP
vnbaaij Jul 18, 2025
61deb6a
Update samples and structure
vnbaaij Jul 21, 2025
e1932a6
Make all DataGrid samples work
vnbaaij Jul 21, 2025
62753d4
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/datagrid-part4
vnbaaij Jul 21, 2025
7c4f77b
Update DataGrid verified tests files
vnbaaij Jul 21, 2025
998b8c9
Merge branch 'users/vnbaaij/dev-v5/datagrid-part4' of https://github.…
vnbaaij Jul 21, 2025
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
Prev Previous commit
Next Next commit
Use localized strings
  • Loading branch information
vnbaaij committed Jun 18, 2025
commit a30dabf3ed35b33fa3a1725b07a7ed2599e1f84b
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
RowClass="@rowClass"
RowStyle="@rowStyle"
ShowHover="true"
HeaderCellAsButtonWithMenu="true"
ColumnResizeUISettings="@resizeLabels">
HeaderCellAsButtonWithMenu="true">
<TemplateColumn Tooltip="true" TooltipText="@(c => "Flag of " + c.Name)" Title="Rank" SortBy="@rankSort" Align="HorizontalAlignment.Center" InitialSortDirection="DataGridSortDirection.Ascending" IsDefaultSortColumn=true>
<img class="flag" src="@(context.Flag())" alt="Flag of @(context.Code)" />
</TemplateColumn>
Expand Down Expand Up @@ -57,12 +56,6 @@
int minMedals;
int maxMedals = 130;

ColumnResizeUISettings resizeLabels = ColumnResizeUISettings.Default with
{
DiscreteLabel = "Width (+/- 10px)",
ResetAriaLabel = "Restore"
};

GridSort<Country> rankSort = GridSort<Country>
.ByDescending(x => x.Medals.Gold)
.ThenDescending(x => x.Medals.Silver)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,22 @@ route: /DataGrid

Overview page and examples to follow

## Typical usage
Here is an example of a data grid that uses in-memory data and enables features including pagination, sorting, filtering, column options, row highlighting and column resizing.

All columns, except 'Bronze', have a `Tooltip` parameter value of `true`.

- When using this for a `TemplateColumn` (like 'Rank' here), you need to also supply a value for the `TooltipText` parameter. **No value given equals no tooltip shown**.
- When using this for a `PropertyColumn`, a value for the `TooltipText` is **not** required. By default, the value given for `Property`
will be re-used for the tooltip. If you do supply a value for `TooltipText` its outcome will be used instead.

`TooltipText` is a lambda function that takes the current item as input and returns the text to show in the tooltip (and `aria-label`).
Look at the Razor tab to see how this is done and how it can be customized.

The Country filter option can be used to quickly filter the list of countries shown. Pressing the ESC key just closes the option popup without changing the filtering currently being used.
Pressing enter finishes the filter action by the current input to filter on and closes the option popup.

The resize options UI is using a customized string for the label ('Width (+/- 10px)' instead of the normal 'Column width'). This is done through
the custom localizer which is registered in the Server project's `Program.cs` file.

{{ DataGridTypical }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- `ColumnResizeLabels` has been renamed to `ColumnResizeUISettings`
- `ColumnSortLabels` has been renamed to `ColumnSortUISettings`

These `...UISettings` parameters are now only used to set a custom icon and icon position. All labels that could be set in earlier versions
have now been replaced with our standard Localization capabilities. You can use a custom localizer to set custom labels for these UI settings.
An example of this can be found in the `Server` project of the demo application, where a custom localizer is registered in the `Program.cs` file.

### Enum changes
- `Align` has been renamed to `HorizontalAlignment`
- `GenerateHeaderOption` has been renamed to `DataGridGeneratedHeaderType`
Expand Down
9 changes: 7 additions & 2 deletions examples/Demo/FluentUI.Demo/MyLocalizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@ internal class MyLocalizer : IFluentLocalizer
_ => IFluentLocalizer.GetDefault(key, arguments),
};
}
// Provide custom translations based on the key
return key switch
{
"DataGrid_ResizeDiscrete" => "Width (+/- 10px)",

// By default, returns the English version of the string
return IFluentLocalizer.GetDefault(key, arguments);
// Fallback to the Default/English if no translation is found
_ => IFluentLocalizer.GetDefault(key, arguments),
};
}
}
}
1 change: 1 addition & 0 deletions spelling.dic
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,4 @@ gipr
gridcell
Voituron
beforetoggle
resx
14 changes: 7 additions & 7 deletions src/Core/Components/DataGrid/Columns/ColumnBase.razor
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
{
<FluentMenuItem OnClick="@(async () => await Grid.SortByColumnAsync(this))" @onkeydown="HandleSortMenuKeyDownAsync"
IconStart="@(Grid.ColumnSortUISettings.Icon is not null && Grid.ColumnSortUISettings.IconPositionStart ? Grid.ColumnSortUISettings.Icon : null)"
IconEnd="@(Grid.ColumnSortUISettings.Icon is not null && !Grid.ColumnSortUISettings.IconPositionStart? Grid.ColumnSortUISettings.Icon : null)">
IconEnd="@(Grid.ColumnSortUISettings.Icon is not null && !Grid.ColumnSortUISettings.IconPositionStart ? Grid.ColumnSortUISettings.Icon : null)">
@GetSortOptionText()

</FluentMenuItem>
Expand All @@ -78,16 +78,16 @@
{
<FluentMenuItem OnClick="@(async () => await Grid.ShowColumnResizeAsync(this))" @onkeydown="HandleResizeMenuKeyDownAsync"
IconStart="@(Grid.ColumnResizeUISettings.Icon is not null && Grid.ColumnResizeUISettings.IconPositionStart ? Grid.ColumnResizeUISettings.Icon : null)"
IconEnd="@(Grid.ColumnResizeUISettings.Icon is not null && !Grid.ColumnResizeUISettings.IconPositionStart? Grid.ColumnResizeUISettings.Icon : null)">
@Grid.ColumnResizeUISettings.ResizeMenu
IconEnd="@(Grid.ColumnResizeUISettings.Icon is not null && !Grid.ColumnResizeUISettings.IconPositionStart ? Grid.ColumnResizeUISettings.Icon : null)">
@Localizer[Localization.LanguageResource.DataGrid_ResizeMenu]
</FluentMenuItem>
}
@if (ColumnOptions is not null)
{
<FluentMenuItem OnClick="@(async () => await Grid.ShowColumnOptionsAsync(this))" @onkeydown="HandleOptionsMenuKeyDownAsync"
IconStart="@(Grid.ColumnOptionsUISettings.Icon is not null && Grid.ColumnOptionsUISettings.IconPositionStart ? Grid.ColumnOptionsUISettings.Icon : null)"
IconEnd="@(Grid.ColumnOptionsUISettings.Icon is not null && !Grid.ColumnOptionsUISettings.IconPositionStart? Grid.ColumnOptionsUISettings.Icon : null)">
@Grid.ColumnOptionsUISettings.OptionsMenu
IconEnd="@(Grid.ColumnOptionsUISettings.Icon is not null && !Grid.ColumnOptionsUISettings.IconPositionStart ? Grid.ColumnOptionsUISettings.Icon : null)">
@Localizer[Localization.LanguageResource.DataGrid_OptionsMenu]
</FluentMenuItem>
}
</FluentMenuList>
Expand Down Expand Up @@ -197,15 +197,15 @@
private RenderFragment OptionsButton()
{
return
@<FluentButton Appearance="ButtonAppearance.Subtle" class="col-options-button" @onclick="@(() => Grid.ShowColumnOptionsAsync(this))" aria-label="Filter this column">
@<FluentButton Appearance="ButtonAppearance.Subtle" class="col-options-button" @onclick="@(() => Grid.ShowColumnOptionsAsync(this))" aria-label="@Localizer[Localization.LanguageResource.DataGrid_OptionsMenu]">
<FluentIcon Value="@(new CoreIcons.Regular.Size20.ChevronDown())" Color="Color.Default" Width="20px" Style="opacity: var(--fluent-data-grid-header-opacity);" />
</FluentButton>;
}

private RenderFragment FilterButton()
{
return
@<FluentButton Appearance="ButtonAppearance.Subtle" class="col-options-button" @onclick="@(() => Grid.ShowColumnOptionsAsync(this))" aria-label="Filter this column">
@<FluentButton Appearance="ButtonAppearance.Subtle" class="col-options-button" @onclick="@(() => Grid.ShowColumnOptionsAsync(this))" aria-label="@Localizer[Localization.LanguageResource.DataGrid_OptionsMenu]">
<FluentIcon Value="@(Grid.ColumnOptionsUISettings.Icon)" />
</FluentButton>;
}
Expand Down
9 changes: 6 additions & 3 deletions src/Core/Components/DataGrid/Columns/ColumnBase.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ public abstract partial class ColumnBase<TGridItem>
private readonly string _columnId = Identifier.NewId();
private FluentMenu? _menu;

[Inject]
private IFluentLocalizer Localizer { get; set; } = default!;

[CascadingParameter]
internal InternalGridContext<TGridItem> InternalGridContext { get; set; } = default!;

Expand Down Expand Up @@ -347,12 +350,12 @@ private string GetSortOptionText()
{
if (Grid.SortByAscending is true)
{
return Grid.ColumnSortUISettings.SortMenuAscendingLabel;
return Localizer[Localization.LanguageResource.DataGrid_SortMenuAscending];
}

return Grid.ColumnSortUISettings.SortMenuDescendingLabel;
return Localizer[Localization.LanguageResource.DataGrid_SortMenuDescending];
}

return Grid.ColumnSortUISettings.SortMenu;
return Localizer[Localization.LanguageResource.DataGrid_SortMenu];
}
}
11 changes: 3 additions & 8 deletions src/Core/Components/DataGrid/Columns/ColumnOptionsUISettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@
namespace Microsoft.FluentUI.AspNetCore.Components;

/// <summary>
/// Represents the UI settings for column options (usually filtering), including labels, aria attributes, and menu options in the <see cref="FluentDataGrid{TGridItem}"/>.
/// Represents the UI settings for column options (usually filtering).
/// </summary>
/// <remarks>This type provides customizable settings for the column options menu, including the menu text, icon,
/// <remarks>This type provides customizable settings for the column options menu icon,
/// and icon positioning. It also includes a default configuration that can be used as a baseline.</remarks>
public record ColumnOptionsUISettings
public record ColumnOptionsUISettings()
{
/// <summary>
/// Gets or sets the text shown in the column menu
/// </summary>
public string OptionsMenu { get; set; } = "Filter";

/// <summary>
/// Gets or sets the icon to show in the column menu
/// </summary>
Expand Down
17 changes: 8 additions & 9 deletions src/Core/Components/DataGrid/Columns/ColumnResizeOptions.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<FluentStack Class="resize-options" VerticalAlignment="VerticalAlignment.Center" HorizontalGap="4">
@if (ResizeType == DataGridResizeType.Discrete)
{
<FluentLabel>@Grid.ColumnResizeUISettings.DiscreteLabel</FluentLabel>
<FluentLabel>@Localizer[Localization.LanguageResource.DataGrid_ResizeDiscrete]</FluentLabel>

<FluentSpacer />
<FluentButton OnClick="@HandleShrinkAsync" IconStart="@(new CoreIcons.Regular.Size20.Subtract())" aria-label="@(Grid.ColumnResizeUISettings.ShrinkAriaLabel)" />
<FluentButton OnClick="@HandleGrowAsync" IconStart="@(new CoreIcons.Regular.Size20.Add())" aria-label="@(Grid.ColumnResizeUISettings.GrowAriaLabel)" />
<FluentButton OnClick="@HandleResetAsync" IconStart="@(new CoreIcons.Regular.Size20.ArrowReset())" aria-label="@(Grid.ColumnResizeUISettings.ResetAriaLabel)" />
<FluentButton OnClick="@HandleShrinkAsync" IconStart="@(new CoreIcons.Regular.Size20.Subtract())" aria-label="@Localizer[Localization.LanguageResource.DataGrid_ResizeShrink]" />
<FluentButton OnClick="@HandleGrowAsync" IconStart="@(new CoreIcons.Regular.Size20.Add())" aria-label="@Localizer[Localization.LanguageResource.DataGrid_ResizeGrow]" />
<FluentButton OnClick="@HandleResetAsync" IconStart="@(new CoreIcons.Regular.Size20.ArrowReset())" aria-label="@Localizer[Localization.LanguageResource.DataGrid_ResizeReset]" />
}
else
{
Expand All @@ -22,14 +22,13 @@
InputMode="TextInputMode.Numeric"
Immediate="true"
ImmediateDelay="200"
Label="@Grid.ColumnResizeUISettings.ExactLabel"
Label="@Localizer[Localization.LanguageResource.DataGrid_ResizeDiscrete]"
AutoComplete="off"
Autofocus="true"
@onkeydown="@HandleColumnWidthKeyDownAsync"
/>
@onkeydown="@HandleColumnWidthKeyDownAsync" />
</div>
<FluentButton Style="height: 30px;" OnClick="@HandleColumnWidthAsync" IconStart="@(new CoreIcons.Regular.Size20.Checkmark())" Appearance="@ButtonAppearance.Primary" aria-label="@(Grid.ColumnResizeUISettings.SubmitAriaLabel)" />
<FluentButton Style="height: 30px;" OnClick="@HandleResetAsync" IconStart="@(new CoreIcons.Regular.Size20.ArrowReset())" aria-label="@(Grid.ColumnResizeUISettings.ResetAriaLabel)" />
<FluentButton Style="height: 30px;" OnClick="@HandleColumnWidthAsync" IconStart="@(new CoreIcons.Regular.Size20.Checkmark())" Appearance="@ButtonAppearance.Primary" aria-label="@Localizer[Localization.LanguageResource.DataGrid_ResizeSubmit]" />
<FluentButton Style="height: 30px;" OnClick="@HandleResetAsync" IconStart="@(new CoreIcons.Regular.Size20.ArrowReset())" aria-label="@Localizer[Localization.LanguageResource.DataGrid_ResizeReset]" />
</FluentStack>
}
</FluentStack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ public partial class ColumnResizeOptions<TGridItem>
{
private string? _width;

/// <summary />
[Inject]
public IFluentLocalizer Localizer { get; set; } = default!;

[CascadingParameter]
internal InternalGridContext<TGridItem> InternalGridContext { get; set; } = default!;

Expand Down
40 changes: 2 additions & 38 deletions src/Core/Components/DataGrid/Columns/ColumnResizeUISettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,12 @@
namespace Microsoft.FluentUI.AspNetCore.Components;

/// <summary>
/// Represents the UI settings for column resizing, including labels, aria attributes, and menu options in the <see cref="FluentDataGrid{TGridItem}"/>.
/// Represents the UI settings for column resizing.
/// </summary>
/// <remarks>This record provides customizable settings for the column resize UI, such as menu text, labels for
/// different resize modes, aria labels for accessibility, and icon configuration. Use this type to configure the
/// <remarks>This record provides customizable settings for the column resize UI, such as icon configuration. Use this type to configure the
/// appearance and behavior of the column resize functionality in your application.</remarks>
public record ColumnResizeUISettings
{
/// <summary>
/// Gets or sets the text shown in the column menu
/// </summary>
public string ResizeMenu { get; set; } = "Resize";

/// <summary>
/// Gets or sets the label in the discrete mode resize UI
/// </summary>
public string DiscreteLabel { get; set; } = "Column width";

/// <summary>
/// Gets or sets the label in the exact mode resize UI
/// </summary>
public string ExactLabel { get; set; } = "Column width (in pixels)";

/// <summary>
/// Gets or sets the aria label for the grow button in the discrete resize UI
/// </summary>
public string? GrowAriaLabel { get; set; } = "Grow column width";

/// <summary>
/// Gets or sets the aria label for the shrink button in the discrete resize UI
/// </summary>
public string? ShrinkAriaLabel { get; set; } = "Shrink column width";

/// <summary>
/// Gets or sets the aria label for the reset button in the resize UI
/// </summary>
public string? ResetAriaLabel { get; set; } = "Reset column widths";

/// <summary>
/// Gets or sets the aria label for the submit button in the resize UI
/// </summary>
public string? SubmitAriaLabel { get; set; } = "Set column widths";

/// <summary>
/// Gets or sets the icon to show in the column menu
/// </summary>
Expand Down
22 changes: 3 additions & 19 deletions src/Core/Components/DataGrid/Columns/ColumnSortUISettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,11 @@
namespace Microsoft.FluentUI.AspNetCore.Components;

/// <summary>
/// Represents the UI settings for column sorting, including labels, aria attributes, and menu options in the <see cref="FluentDataGrid{TGridItem}"/>.
/// Represents the UI settings for column sorting.
/// </summary>
/// <remarks>This type provides customizable options for the text and icons displayed in the column sorting menu,
/// including labels for ascending and descending sort orders, and the position of the sort icon.</remarks>
/// <remarks>This type provides customizable options for the icon displayed in the column sorting menu</remarks>
public record ColumnSortUISettings
{
/// <summary>
/// Gets or sets the text shown in the column menu
/// </summary>
public string SortMenu { get; set; } = "Sort";

/// <summary>
/// Gets or sets the text shown in the column menu when in ascending order
/// </summary>
public string SortMenuAscendingLabel { get; set; } = "Sort (ascending)";

/// <summary>
/// Gets or sets the text shown in the column menu when in descending order
/// </summary>
public string SortMenuDescendingLabel { get; set; } = "Sort (descending)";

/// <summary>
/// Gets or sets the icon to show in the column menu
/// </summary>
Expand All @@ -37,7 +21,7 @@ public record ColumnSortUISettings
public bool IconPositionStart { get; set; } = true;

/// <summary>
/// Gets the default labels for the sort UI.
/// Gets the default settings for the sort UI.
/// </summary>
public static ColumnSortUISettings Default => new();

Expand Down
9 changes: 6 additions & 3 deletions src/Core/Components/DataGrid/FluentDataGrid.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,19 +176,22 @@ public FluentDataGrid(LibraryConfiguration configuration) : base(configuration)
public DataGridResizeType? ResizeType { get; set; }

/// <summary>
/// (Aria) Labels used in the column resize UI.
/// Settings (icon, icon position) used in the column resize UI.
/// (aria) labels are controlled through <see cref="IFluentLocalizer"/>
/// </summary>
[Parameter]
public ColumnResizeUISettings ColumnResizeUISettings { get; set; } = ColumnResizeUISettings.Default;

/// <summary>
/// Labels used in the column sort UI.
/// Settings (icon, icon position) used in the column sorting UI.
/// (aria) labels are controlled through <see cref="IFluentLocalizer"/>
/// </summary>
[Parameter]
public ColumnSortUISettings ColumnSortUISettings { get; set; } = ColumnSortUISettings.Default;

/// <summary>
/// Labels used in the column options UI.
/// Settings (icon, icon position) used in the column options UI.
/// (aria) labels are controlled through <see cref="IFluentLocalizer"/>
/// </summary>
[Parameter]
public ColumnOptionsUISettings ColumnOptionsUISettings { get; set; } = ColumnOptionsUISettings.Default;
Expand Down
33 changes: 33 additions & 0 deletions src/Core/Localization/LanguageResource.resx
Original file line number Diff line number Diff line change
Expand Up @@ -243,4 +243,37 @@
<data name="Paginator_Status" xml:space="preserve">
<value>Page {0} of {1}</value>
</data>
<data name="DataGrid_SortMenuAscending" xml:space="preserve">
<value>Sort (ascending)</value>
</data>
<data name="DataGrid_SortMenuDescending" xml:space="preserve">
<value>Sort (descending)</value>
</data>
<data name="DataGrid_SortMenu" xml:space="preserve">
<value>Sort</value>
</data>
<data name="DataGrid_ResizeMenu" xml:space="preserve">
<value>Resize</value>
</data>
<data name="DataGrid_OptionsMenu" xml:space="preserve">
<value>Filter</value>
</data>
<data name="DataGrid_ResizeDiscrete" xml:space="preserve">
<value>Column width</value>
</data>
<data name="DataGrid_ResizeExact" xml:space="preserve">
<value>Column width (in pixels)</value>
</data>
<data name="DataGrid_ResizeGrow" xml:space="preserve">
<value>Grow column width</value>
</data>
<data name="DataGrid_ResizeShrink" xml:space="preserve">
<value>Shrink column width</value>
</data>
<data name="DataGrid_ResizeReset" xml:space="preserve">
<value>Reset column widths</value>
</data>
<data name="DataGrid_ResizeSubmit" xml:space="preserve">
<value>Set column widths</value>
</data>
</root>
Loading