Skip to content

Commit

Permalink
Merge branch 'master' into dev/serialization-objects-for-jsinterop
Browse files Browse the repository at this point in the history
  • Loading branch information
stsrki committed Nov 12, 2024
2 parents 85b79e8 + ff95a92 commit ff35474
Show file tree
Hide file tree
Showing 42 changed files with 827 additions and 103 deletions.
17 changes: 12 additions & 5 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,24 @@ body:
attributes:
label: Link to minimal reproduction or a simple code snippet
description: |
The easiest way to provide a reproduction is to provide a link to a public GitHub repository or a tool like [Telerik Repl](https://blazorrepl.telerik.com/).
The reproduction should be **minimal**. This means it should contain only the bare minimum amount of code needed
to run the bug, including all the class definitions, models, services, etc.
Provide a public GitHub repository (or code snippet). For easy setup, you can use the Blazorise Bug Report Template for each provider:
[Bootstrap4](https://github.com/Blazorise/BugReportBootstrap4),
[Bootstrap5](https://github.com/Blazorise/BugReportBootstrap5),
[Tailwind](https://github.com/Blazorise/BugReportTailwind),
[Material](https://github.com/Blazorise/BugReportMaterial),
[AntDesign](https://github.com/Blazorise/BugReportAntDesign),
[Bulma](https://github.com/Blazorise/BugReportBulma), or
[FluentUI2](https://github.com/Blazorise/BugReportFluentUI2).
The reproduction should be **minimal**, containing only the essential code needed to demonstrate the bug.
placeholder: Reproduction Link
validations:
required: true

- type: textarea
id: steps-to-reproduce
attributes:
label: Steps to reproduce
label: Steps to reproduce & bug description
description: |
What must we do after opening your repro to make the bug happen? Clear and concise reproduction instructions are important for us to be able to triage your issue in a timely manner. Note that you can use [Markdown](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#quoting-code) to format lists and code.
placeholder: Steps to reproduce
Expand Down
6 changes: 5 additions & 1 deletion .github/label-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@
"Status: Repro Missing":
comment: >
Hello @{issue-author},
thank you for your submission. The issue was labeled "Status: Repro Missing", as you have not provided a way to reproduce the issue quickly. Most problems already solve themselves when isolated, but we would like you to provide us with a reproducible code to make it easier to investigate a possible bug.
thank you for your submission. The issue was labeled "Status: Repro Missing" because you have not provided a way to reproduce the issue quickly. Most problems can be solved when isolated, but we would like you to provide a reproducible code sample to help us investigate a possible bug more effectively.
For your convenience, you can use our pre-configured [Bug Report Template repositories](https://github.com/Blazorise/BugReportTemplate) to quickly set up a reproducible environment.
Once you've provided a minimal reproduction, we can proceed with the investigation. Thank you for helping us improve Blazorise!
76 changes: 63 additions & 13 deletions Documentation/Blazorise.Docs/Models/Snippets.generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8047,28 +8047,30 @@ protected override async Task OnInitializedAsync()
<DataGridColumn Field=""@nameof( Employee.FirstName )"" Caption=""First Name"" Editable=""false"" FilterMethod=""DataGridColumnFilterMethod.StartsWith""></DataGridColumn>
<DataGridColumn Field=""@nameof( Employee.LastName )"" Caption=""Last Name"" Editable=""false""></DataGridColumn>
<DataGridSelectColumn TItem=""Employee"" Field=""@nameof( Employee.Gender )"" Caption=""Gender"" Editable Data=""EmployeeData.Genders"" ValueField=""(x) => ((Gender)x).Code"" TextField=""(x) => ((Gender)x).Description"" />
<DataGridNumericColumn Field=""@nameof(Employee.Childrens)"" Caption=""Children"" Editable />
</DataGrid>

@code{
private DataGrid<Employee> dataGrid;
private List<Employee> employeeList = new() { new() { FirstName = ""David"", LastName = ""Moreira"", Gender = ""M"" }, new() { FirstName = ""MLaden"", LastName = ""Macanovic"", Gender=""M"" }, new() { FirstName = ""John"", LastName = ""Doe"", Gender = ""M"" }, new() { FirstName = ""Ana"", LastName = ""Chamberlain"", Gender = ""F"" }, new() { FirstName = ""Jessica"", LastName = ""Winston"", Gender=""F"" } };
private List<Employee> employeeList = new() { new() { FirstName = ""David"", LastName = ""Moreira"", Gender = ""M"", Childrens = 0 }, new() { FirstName = ""MLaden"", LastName = ""Macanovic"", Gender = ""M"", Childrens = 1 }, new() { FirstName = ""John"", LastName = ""Doe"", Gender = ""M"", Childrens = 2 }, new() { FirstName = ""Ana"", LastName = ""Chamberlain"", Gender = ""F"", Childrens = 5 }, new() { FirstName = ""Jessica"", LastName = ""Winston"", Gender = ""F"", Childrens = 2 } };
}";

public const string DataGridFilterModeColumnTemplateFilteringExample = @"<DataGrid @ref=""dataGrid""
TItem=""Employee""
Data=""@employeeList""
Responsive
Filterable
FilterMode=""DataGridFilterMode.Menu"">
<DataGridColumns>
<DataGridColumn Field=""@nameof( Employee.FirstName )"" Caption=""First Name"" Editable=""false"" FilterMethod=""DataGridColumnFilterMethod.StartsWith""></DataGridColumn>
<DataGridColumn Field=""@nameof( Employee.LastName )"" Caption=""Last Name"" Editable=""false""></DataGridColumn>
<DataGridSelectColumn TItem=""Employee"" Field=""@nameof( Employee.Gender )"" Caption=""Gender"" Editable Data=""EmployeeData.Genders"" ValueField=""(x) => ((Gender)x).Code"" TextField=""(x) => ((Gender)x).Description"" />
</DataGridColumns>
<FilterMenuTemplate>
<Row>
<Column ColumnSize=""ColumnSize.Is4"">
<Select TValue=""DataGridColumnFilterMethod"" SelectedValue=""@context.GetFilterMethod()"" SelectedValueChanged=""e => { context.FilterMethodChanged.InvokeAsync(e); }"">
FilterMode=""DataGridFilterMode.Menu"">
<DataGridColumns>
<DataGridColumn Field=""@nameof( Employee.FirstName )"" Caption=""First Name"" Editable=""false"" FilterMethod=""DataGridColumnFilterMethod.StartsWith""></DataGridColumn>
<DataGridColumn Field=""@nameof( Employee.LastName )"" Caption=""Last Name"" Editable=""false""></DataGridColumn>
<DataGridSelectColumn TItem=""Employee"" Field=""@nameof( Employee.Gender )"" Caption=""Gender"" Editable Data=""EmployeeData.Genders"" ValueField=""(x) => ((Gender)x).Code"" TextField=""(x) => ((Gender)x).Description"" />
<DataGridNumericColumn Field=""@nameof(Employee.Childrens)"" Caption=""Children"" Editable />
</DataGridColumns>
<FilterMenuTemplate>
<Row>
<Column ColumnSize=""ColumnSize.Is4"">
<Select TValue=""DataGridColumnFilterMethod"" SelectedValue=""@context.GetFilterMethod()"" SelectedValueChanged=""e => { context.FilterMethodChanged.InvokeAsync(e); }"">
@{
var isNumericOrDate = context.Column.ColumnType == DataGridColumnType.Numeric || context.Column.ColumnType == DataGridColumnType.Date;
}
Expand All @@ -8087,12 +8089,23 @@ protected override async Task OnInitializedAsync()
<SelectItem TValue=""DataGridColumnFilterMethod"" Value=""@DataGridColumnFilterMethod.GreaterThanOrEqual"">Greater Than Or Equal</SelectItem>
<SelectItem TValue=""DataGridColumnFilterMethod"" Value=""@DataGridColumnFilterMethod.LessThan"">Less Than</SelectItem>
<SelectItem TValue=""DataGridColumnFilterMethod"" Value=""@DataGridColumnFilterMethod.LessThanOrEqual"">Less Than Or Equal</SelectItem>
<SelectItem TValue=""DataGridColumnFilterMethod"" Value=""@DataGridColumnFilterMethod.Between"">Between</SelectItem>
}
</Select>
</Column>

<Column ColumnSize=""ColumnSize.Is4"">
<TextEdit Text=""@context.GetSearchValue()?.ToString()"" TextChanged=""@((newValue) => context.Column.Filter.SearchValue = newValue)"" />
<Field @key=context.GetFilterMethod()>
@if ( context.GetFilterMethod() == DataGridColumnFilterMethod.Between )
{
<TextEdit Text=""@GetFilterValue1(context)"" TextChanged=""@((newValue) => SetFilterValue1(context.Column.Filter, newValue))"" />
<TextEdit Text=""@GetFilterValue2(context)"" TextChanged=""@((newValue) => SetFilterValue2(context.Column.Filter, newValue))"" />
}
else
{
<TextEdit Text=""@context.GetSearchValue()?.ToString()"" TextChanged=""@((newValue) => context.Column.Filter.SearchValue = newValue)"" />
}
</Field>
</Column>

<Column ColumnSize=""ColumnSize.Is4"">
Expand All @@ -8105,7 +8118,44 @@ protected override async Task OnInitializedAsync()

@code {
private DataGrid<Employee> dataGrid;
private List<Employee> employeeList = new() { new() { FirstName = ""David"", LastName = ""Moreira"", Gender = ""M"" }, new() { FirstName = ""MLaden"", LastName = ""Macanovic"", Gender = ""M"" }, new() { FirstName = ""John"", LastName = ""Doe"", Gender = ""M"" }, new() { FirstName = ""Ana"", LastName = ""Chamberlain"", Gender = ""F"" }, new() { FirstName = ""Jessica"", LastName = ""Winston"", Gender = ""F"" } };
private List<Employee> employeeList = new()
{
new() { FirstName = ""Liam"", LastName = ""Smith"", Gender = ""M"", Childrens = 0 },
new() { FirstName = ""Noah"", LastName = ""Johnson"", Gender = ""M"", Childrens = 1 },
new() { FirstName = ""Ethan"", LastName = ""Brown"", Gender = ""M"", Childrens = 2 },
new() { FirstName = ""Olivia"", LastName = ""Davis"", Gender = ""F"", Childrens = 5 },
new() { FirstName = ""Emma"", LastName = ""Wilson"", Gender = ""F"", Childrens = 2 },
};

private string GetFilterValue1( FilterColumnContext<Employee> context )
{
return ( context.GetSearchValue() as object[] )?[0]?.ToString();
}

private string GetFilterValue2( FilterColumnContext<Employee> context )
{
return ( context.GetSearchValue() as object[] )?[1]?.ToString();
}

private void SetFilterValue1( FilterContext<Employee> context, object value1 )
{
if ( context.SearchValue is not object[] )
{
context.SearchValue = new object[2];
}

( context.SearchValue as object[] )[0] = value1;
}

private void SetFilterValue2( FilterContext<Employee> context, object value2 )
{
if ( context.SearchValue is not object[] )
{
context.SearchValue = new object[2];
}

( context.SearchValue as object[] )[1] = value2;
}
}";

public const string DataGridFixedColumnsExample = @"<DataGrid TItem=""Employee""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,14 @@
<DocsAttributesItem Name="ResponsiveMode" Type="TableResponsiveMode" Default="Default">
Gets or sets the Table's responsive mode.
</DocsAttributesItem>
<DocsAttributesItem Name="FixedColumnsPositionSync" Type="bool" Default="false">
<Paragraph>
Gets or sets whether the <Code>FixedColumns</Code> feature automatically resynchronizes the columns positions when they are added or removed.
</Paragraph>
<Paragraph>
Enabling this feature may impact performance due to constant recalculations of fixed column positions.
</Paragraph>
</DocsAttributesItem>
</DocsAttributes>

<DocsAttributes Title="TableRowGroup">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">DataGridColumn</span> <span class="htmlAttributeName">Field</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue"><span class="atSign">&#64;</span>nameof( Employee.FirstName )</span><span class="quot">&quot;</span> <span class="htmlAttributeName">Caption</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue">First Name</span><span class="quot">&quot;</span> <span class="htmlAttributeName">Editable</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="keyword">false</span><span class="quot">&quot;</span> <span class="htmlAttributeName">FilterMethod</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="enum">DataGridColumnFilterMethod</span><span class="enumValue">.StartsWith</span><span class="quot">&quot;</span><span class="htmlTagDelimiter">&gt;</span><span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">DataGridColumn</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">DataGridColumn</span> <span class="htmlAttributeName">Field</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue"><span class="atSign">&#64;</span>nameof( Employee.LastName )</span><span class="quot">&quot;</span> <span class="htmlAttributeName">Caption</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue">Last Name</span><span class="quot">&quot;</span> <span class="htmlAttributeName">Editable</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="keyword">false</span><span class="quot">&quot;</span><span class="htmlTagDelimiter">&gt;</span><span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">DataGridColumn</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">DataGridSelectColumn</span> <span class="htmlAttributeName">TItem</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue">Employee</span><span class="quot">&quot;</span> <span class="htmlAttributeName">Field</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue"><span class="atSign">&#64;</span>nameof( Employee.Gender )</span><span class="quot">&quot;</span> <span class="htmlAttributeName">Caption</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue">Gender</span><span class="quot">&quot;</span> <span class="htmlAttributeName">Editable</span> <span class="htmlAttributeName">Data</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="enum">EmployeeData</span><span class="enumValue">.Genders</span><span class="quot">&quot;</span> <span class="htmlAttributeName">ValueField</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue">(x) =&gt; ((Gender)x).Code</span><span class="quot">&quot;</span> <span class="htmlAttributeName">TextField</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue">(x) =&gt; ((Gender)x).Description</span><span class="quot">&quot;</span> <span class="htmlTagDelimiter">/&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">DataGridNumericColumn</span> <span class="htmlAttributeName">Field</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue"><span class="atSign">&#64;</span>nameof(Employee.Childrens)</span><span class="quot">&quot;</span> <span class="htmlAttributeName">Caption</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue">Children</span><span class="quot">&quot;</span> <span class="htmlAttributeName">Editable</span> <span class="htmlTagDelimiter">/&gt;</span>
<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">DataGrid</span><span class="htmlTagDelimiter">&gt;</span>
</pre></div>
<div class="csharp"><pre>
<span class="atSign">&#64;</span>code{
<span class="keyword">private</span> DataGrid&lt;Employee&gt; dataGrid;
<span class="keyword">private</span> List&lt;Employee&gt; employeeList = <span class="keyword">new</span>() { <span class="keyword">new</span>() { FirstName = <span class="string">&quot;David&quot;</span>, LastName = <span class="string">&quot;Moreira&quot;</span>, Gender = <span class="string">&quot;M&quot;</span> }, <span class="keyword">new</span>() { FirstName = <span class="string">&quot;MLaden&quot;</span>, LastName = <span class="string">&quot;Macanovic&quot;</span>, Gender=<span class="string">&quot;M&quot;</span> }, <span class="keyword">new</span>() { FirstName = <span class="string">&quot;John&quot;</span>, LastName = <span class="string">&quot;Doe&quot;</span>, Gender = <span class="string">&quot;M&quot;</span> }, <span class="keyword">new</span>() { FirstName = <span class="string">&quot;Ana&quot;</span>, LastName = <span class="string">&quot;Chamberlain&quot;</span>, Gender = <span class="string">&quot;F&quot;</span> }, <span class="keyword">new</span>() { FirstName = <span class="string">&quot;Jessica&quot;</span>, LastName = <span class="string">&quot;Winston&quot;</span>, Gender=<span class="string">&quot;F&quot;</span> } };
<span class="keyword">private</span> List&lt;Employee&gt; employeeList = <span class="keyword">new</span>() { <span class="keyword">new</span>() { FirstName = <span class="string">&quot;David&quot;</span>, LastName = <span class="string">&quot;Moreira&quot;</span>, Gender = <span class="string">&quot;M&quot;</span>, Childrens = <span class="number">0</span> }, <span class="keyword">new</span>() { FirstName = <span class="string">&quot;MLaden&quot;</span>, LastName = <span class="string">&quot;Macanovic&quot;</span>, Gender = <span class="string">&quot;M&quot;</span>, Childrens = <span class="number">1</span> }, <span class="keyword">new</span>() { FirstName = <span class="string">&quot;John&quot;</span>, LastName = <span class="string">&quot;Doe&quot;</span>, Gender = <span class="string">&quot;M&quot;</span>, Childrens = <span class="number">2</span> }, <span class="keyword">new</span>() { FirstName = <span class="string">&quot;Ana&quot;</span>, LastName = <span class="string">&quot;Chamberlain&quot;</span>, Gender = <span class="string">&quot;F&quot;</span>, Childrens = <span class="number">5</span> }, <span class="keyword">new</span>() { FirstName = <span class="string">&quot;Jessica&quot;</span>, LastName = <span class="string">&quot;Winston&quot;</span>, Gender = <span class="string">&quot;F&quot;</span>, Childrens = <span class="number">2</span> } };
}
</pre></div>
</div>
Loading

0 comments on commit ff35474

Please sign in to comment.