-
-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: PivotGrid #3214
Draft
David-Moreira
wants to merge
1
commit into
master
Choose a base branch
from
PivotGrid
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
WIP: PivotGrid #3214
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,29 @@ | ||
@page "/" | ||
@inject IVersionProvider VersionProvider | ||
<Heading Size="HeadingSize.Is1" Margin="Margin.Is3.FromBottom">Blazorise</Heading> | ||
|
||
<Paragraph> | ||
Blazorise is a component library built on top of Blazor and CSS frameworks like <Anchor To="https://getbootstrap.com/" Target="Target.Blank">Bootstrap</Anchor>, <Anchor To="https://bulma.io/" Target="Target.Blank">Bulma</Anchor>, <Anchor To="https://ant.design/" Target="Target.Blank">Ant Design</Anchor>, and <Anchor To="http://daemonite.github.io/material/" Target="Target.Blank">Material</Anchor>. It can be used to build responsive, single-page web applications. | ||
</Paragraph> | ||
<PivotGrid TItem="Employee" Data="inMemoryData"> | ||
<PivotGridColumns> | ||
<PivotGridColumn Caption="Year"></PivotGridColumn> | ||
<PivotGridColumn Caption="Quarter"></PivotGridColumn> | ||
</PivotGridColumns> | ||
<PivotGridValues> | ||
<PivotGridValue Caption="Quantity"></PivotGridValue> | ||
<PivotGridValue Caption="Amount"></PivotGridValue> | ||
</PivotGridValues> | ||
<PivotGridRows> | ||
<PivotGridRow></PivotGridRow> | ||
<PivotGridRow></PivotGridRow> | ||
</PivotGridRows> | ||
|
||
<Alert Color="Color.Info" Visible="true"> | ||
<Heading Size="HeadingSize.Is4" TextColor="TextColor.Success"> | ||
Note: | ||
</Heading> | ||
<Paragraph> | ||
This is a demo application for Blazorise used to show basic example for most of the components and extensions. | ||
</Paragraph> | ||
<Paragraph> | ||
Full source code for this demo can be found on <Anchor To="https://github.com/Megabit/Blazorise/tree/master/Demos/Blazorise.Demo" Target="Target.Blank">GitHub</Anchor>. | ||
</Paragraph> | ||
<Paragraph> | ||
If you wish to learn more about Blazorise please go to the official <Anchor To="https://blazorise.com/docs/" Target="Target.Blank">documentation</Anchor>. | ||
</Paragraph> | ||
</Alert> | ||
</PivotGrid> | ||
@code { | ||
[Inject] EmployeeData EmployeeData { get; set; } | ||
|
||
<Paragraph> | ||
On the left sidebar you can see the Blazorise components and extensions in action. | ||
</Paragraph> | ||
<br /> | ||
<Paragraph> | ||
<Strong> Demo application for</Strong>: Blazorise @($"v{VersionProvider.MilestoneVersion}") | ||
</Paragraph> | ||
private IEnumerable<Employee> inMemoryData; | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
inMemoryData = (await EmployeeData.GetDataAsync().ConfigureAwait(false)).Take(25); | ||
await base.OnInitializedAsync(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
@layout MainLayout | ||
@using Blazorise.Shared.Data | ||
@using Blazorise.Shared.Models | ||
@using Blazorise.Shared.Models | ||
@using Blazorise.PivotGrid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
C:\Users\david\source\repos\_Work\Blazorise\Documentation\Blazorise.Docs\Pages\Docs\Extensions\DataGrid\Code\DataGridScrollToExampleCode.html | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
Source/Extensions/Blazorise.PivotGrid/Blazorise.PivotGrid.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Razor"> | ||
|
||
<Import Project="..\..\..\Build\Blazorise.props" /> | ||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<PackageTags>blazorise blazor components pivotgrid</PackageTags> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
<NoWarn>1591</NoWarn> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\Blazorise\Blazorise.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="..\..\..\LICENSE.md" Pack="true" Visible="false" PackagePath="" /> | ||
<None Include="..\..\..\NuGet\Blazorise.png" Pack="true" Visible="false" PackagePath="" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
@typeparam TItem | ||
@attribute [CascadingTypeParameter(nameof(TItem))] | ||
<CascadingValue Value="this" IsFixed> | ||
@PivotGridColumns | ||
@PivotGridRows | ||
@PivotGridValues | ||
</CascadingValue> | ||
|
||
@*Example: *@ | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>...</th> | ||
<th>(Col Year)2021 - click expands into more trs with detail</th> | ||
<th>(Col Year)2022 - click expands into more trs with detail</th> | ||
</tr> | ||
<tr> | ||
<th>...</th> | ||
<th>(Data)Amount</th> | ||
<th>(Data)Count</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>(row) Africa - click expands into more trs with detail</td> | ||
<td>100</td> | ||
<td>5</td> | ||
</tr> | ||
<tr> | ||
<td>(row) Asia - click expands into more trs with detail</td> | ||
<td>3000</td> | ||
<td>9</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<Table> | ||
<TableHeader> | ||
@*Cols*@ | ||
<TableRow> | ||
<TableHeaderCell></TableHeaderCell> | ||
@foreach (var colGroup in colGroups) | ||
{ | ||
<TableHeaderCell ColumnSpan="Values.Count"> | ||
@colGroup | ||
</TableHeaderCell> | ||
} | ||
</TableRow> | ||
|
||
@*Values*@ | ||
<TableRow> | ||
<TableHeaderCell></TableHeaderCell> | ||
@for (var i = 0; i < colGroups.Count; i++) | ||
{ | ||
@foreach (var value in Values) | ||
{ | ||
<TableHeaderCell> | ||
@value.Caption | ||
</TableHeaderCell> | ||
} | ||
} | ||
</TableRow> | ||
</TableHeader> | ||
<TableBody> | ||
@foreach (var rowGroup in rowGroups) | ||
{ | ||
<TableRow> | ||
<TableRowCell>@rowGroup</TableRowCell> | ||
@*Iterate data vs no. columns?*@ | ||
</TableRow> | ||
} | ||
|
||
</TableBody> | ||
<TableFooter> | ||
|
||
</TableFooter> | ||
</Table> | ||
@code { | ||
private List<string> rowGroups = new() { "Africa", "Asia" }; | ||
private List<string> colGroups = new() { "2021", "2022" }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Components; | ||
|
||
namespace Blazorise.PivotGrid | ||
{ | ||
public partial class PivotGrid<TItem> : ComponentBase | ||
{ | ||
|
||
[Parameter] | ||
public IEnumerable<TItem> Data { get; set; } | ||
|
||
|
||
protected List<PivotGridValue<TItem>> Values { get; set; } = new(); | ||
protected List<PivotGridColumn<TItem>> Columns { get; set; } = new(); | ||
protected List<PivotGridRow<TItem>> Rows { get; set; } = new(); | ||
|
||
|
||
[Parameter] | ||
public RenderFragment PivotGridColumns { get; set; } | ||
|
||
[Parameter] | ||
public RenderFragment PivotGridRows { get; set; } | ||
|
||
[Parameter] | ||
public RenderFragment PivotGridValues { get; set; } | ||
|
||
|
||
|
||
public void AddColumn( PivotGridColumn<TItem> column ) | ||
{ | ||
Columns.Add( column ); | ||
} | ||
|
||
public bool RemoveColumn( PivotGridColumn<TItem> column ) | ||
{ | ||
return Columns.Remove( column ); | ||
} | ||
|
||
public void AddRow( PivotGridRow<TItem> row ) | ||
{ | ||
Rows.Add( row ); | ||
} | ||
|
||
public bool RemoveRow( PivotGridRow<TItem> row ) | ||
{ | ||
return Rows.Remove( row ); | ||
} | ||
|
||
public void AddValue( PivotGridValue<TItem> value ) | ||
{ | ||
Values.Add( value ); | ||
} | ||
|
||
public bool RemoveValue( PivotGridValue<TItem> value ) | ||
{ | ||
return Values.Remove( value ); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@typeparam TItem |
28 changes: 28 additions & 0 deletions
28
Source/Extensions/Blazorise.PivotGrid/PivotGridColumn.razor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Components; | ||
|
||
namespace Blazorise.PivotGrid | ||
{ | ||
public partial class PivotGridColumn<TItem> : ComponentBase | ||
{ | ||
|
||
[CascadingParameter] | ||
public PivotGrid<TItem> ParentPivotGrid { get; set; } | ||
|
||
[Parameter] | ||
public string Field { get; set; } | ||
|
||
[Parameter] | ||
public string Caption { get; set; } | ||
|
||
protected override void OnInitialized() | ||
{ | ||
base.OnInitialized(); | ||
ParentPivotGrid?.AddColumn( this ); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@typeparam TItem |
25 changes: 25 additions & 0 deletions
25
Source/Extensions/Blazorise.PivotGrid/PivotGridRow.razor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Components; | ||
|
||
namespace Blazorise.PivotGrid | ||
{ | ||
public partial class PivotGridRow<TItem> : ComponentBase | ||
{ | ||
|
||
[CascadingParameter] | ||
public PivotGrid<TItem> ParentPivotGrid { get; set; } | ||
|
||
[Parameter] | ||
public string Field { get; set; } | ||
|
||
protected override void OnInitialized() | ||
{ | ||
base.OnInitialized(); | ||
ParentPivotGrid?.AddRow( this ); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@typeparam TItem |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the use-case for rows? Why do we need to define them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand now what you wanted to do. It has an API similar to the SF.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the same uses cases as this API
enum Area {
Row, // it will be shown in a row header and grouped by this => PivotGridRow
Column, // it will be shown as a regular column, just like DataGrid => PivotGridColumn
Data, // it will be used for the summary => PivotGridValue
}