-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #115 from SuganthiK963/master
912131: Sample for flowchart layout.
- Loading branch information
Showing
27 changed files
with
1,218 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
UG-Samples/Layout/FlowchartLayout/FlowchartLayoutForGmail/FlowchartLayout/App.razor
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,14 @@ | ||
@namespace FlowchartLayout | ||
<Router AppAssembly="@typeof(App).Assembly"> | ||
<Found Context="routeData"> | ||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" /> | ||
<FocusOnNavigate RouteData="@routeData" Selector="h1" /> | ||
</Found> | ||
<NotFound> | ||
<PageTitle>Not found</PageTitle> | ||
<LayoutView Layout="@typeof(MainLayout)"> | ||
<p role="alert">Sorry, there's nothing at this address.</p> | ||
</LayoutView> | ||
</NotFound> | ||
</Router> | ||
|
12 changes: 12 additions & 0 deletions
12
...ayout/FlowchartLayout/FlowchartLayoutForGmail/FlowchartLayout/FlowchartLayout_NET6.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,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.Blazor.Themes" Version="*" /> | ||
<PackageReference Include="Syncfusion.Blazor" Version="*" /> | ||
</ItemGroup> | ||
</Project> |
12 changes: 12 additions & 0 deletions
12
...ayout/FlowchartLayout/FlowchartLayoutForGmail/FlowchartLayout/FlowchartLayout_NET8.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,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.Blazor.Themes" Version="*" /> | ||
<PackageReference Include="Syncfusion.Blazor" Version="*" /> | ||
</ItemGroup> | ||
</Project> |
119 changes: 119 additions & 0 deletions
119
UG-Samples/Layout/FlowchartLayout/FlowchartLayoutForGmail/FlowchartLayout/Pages/Index.razor
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,119 @@ | ||
@page "/" | ||
|
||
@using Syncfusion.Blazor.Diagram | ||
@using System.Collections.ObjectModel | ||
|
||
<SfDiagramComponent @ref="Diagram" Width="100%" Height="900px" ConnectorCreating="@OnConnectorCreating" NodeCreating="@OnNodeCreating" DataLoaded="@OnDataLoaded"> | ||
<DataSourceSettings ID="Id" ParentID="ParentId" DataSource="DataSource"> </DataSourceSettings> | ||
<Layout @bind-Type="@Type" @bind-HorizontalSpacing="@HorizontalSpacing" @bind-Orientation="@OrientationType" @bind-VerticalSpacing="@VerticalSpacing" FlowchartLayoutSettings="@flowchartSettings"> | ||
</Layout> | ||
<SnapSettings Constraints="SnapConstraints.None"></SnapSettings> | ||
</SfDiagramComponent> | ||
|
||
@code { | ||
FlowchartLayoutSettings flowchartSettings = new FlowchartLayoutSettings() | ||
{ | ||
//Set the decision yes branch direction | ||
YesBranchDirection = BranchDirection.LeftInFlow, | ||
//Set the decision no branch direction | ||
NoBranchDirection = BranchDirection.RightInFlow, | ||
//Set the custom yes branch values | ||
YesBranchValues = new List<string> { "Yes", "Existing" }, | ||
//Set the custom no branch values | ||
NoBranchValues = new List<string> { "No", "New" }, | ||
}; | ||
public SfDiagramComponent Diagram; | ||
public int? HValue { get; set; } = 60; | ||
public int? VValue { get; set; } = 40; | ||
public LayoutType Type = LayoutType.Flowchart; | ||
public LayoutOrientation OrientationType = LayoutOrientation.TopToBottom; | ||
public int HorizontalSpacing = 50; | ||
public int VerticalSpacing = 50; | ||
private void OnDataLoaded(object obj) | ||
{ | ||
for (int i = 0; i < Diagram.Connectors.Count; i++) | ||
{ | ||
var connector = Diagram.Connectors[i]; | ||
var node = Diagram.GetObject(connector.TargetID) as Node; | ||
var srcNode = Diagram.GetObject(connector.SourceID) as Node; | ||
if (node.Data != null && node.Data is NodeInfo NodeInfo) | ||
{ | ||
if (NodeInfo.LineText != null && NodeInfo.LineText.Count > 0) | ||
{ | ||
if (NodeInfo.ParentId.IndexOf((srcNode.Data as NodeInfo).Id) != -1) | ||
{ | ||
var parentIndex = NodeInfo.ParentId.IndexOf((srcNode.Data as NodeInfo).Id); | ||
if (NodeInfo.LineText.Count > parentIndex) | ||
{ | ||
connector.Annotations = new DiagramObjectCollection<PathAnnotation>() | ||
{ | ||
new PathAnnotation() { Content = NodeInfo.LineText[parentIndex], Style=new TextStyle(){Fill="White" } } | ||
}; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
private void OnConnectorCreating(IDiagramObject obj) | ||
{ | ||
if (obj is Connector connector) | ||
{ | ||
connector.Type = ConnectorSegmentType.Orthogonal; | ||
} | ||
} | ||
private void OnNodeCreating(IDiagramObject obj) | ||
{ | ||
Node node = obj as Node; | ||
if (node.Data != null && node.Data is NodeInfo) | ||
{ | ||
NodeInfo employeeDetails = node.Data as NodeInfo; | ||
node.Width = employeeDetails.Width; | ||
node.Height = employeeDetails.Height; | ||
if (employeeDetails.Shape == "Rectangle") | ||
{ | ||
node.Shape = new FlowShape() { Shape = NodeFlowShapes.Process }; | ||
} | ||
else if (employeeDetails.Shape == "StartOrEnd") | ||
{ | ||
node.Shape = new FlowShape() { Shape = NodeFlowShapes.Terminator }; | ||
} | ||
else | ||
node.Shape = new FlowShape() { Shape = (NodeFlowShapes)Enum.Parse(typeof(NodeFlowShapes), employeeDetails.Shape.ToString()) }; | ||
node.Style.Fill = employeeDetails.Color; | ||
node.Style.StrokeColor = employeeDetails.Color; | ||
node.Annotations = new DiagramObjectCollection<ShapeAnnotation>() | ||
{ | ||
new ShapeAnnotation(){ Content = employeeDetails.Description, Style = new TextStyle(){ Color="white"} } | ||
}; | ||
} | ||
} | ||
public List<NodeInfo> DataSource = new List<NodeInfo>() | ||
{ | ||
new NodeInfo() { Id = "1", Description = "Start", Shape = "StartOrEnd", Width = 100, Height = 30, Color = "#8E44CC" }, | ||
new NodeInfo() { Id = "2", Description = "Open Gmail site in browser", ParentId = new List<string> { "1" }, Shape = "Rectangle", Width = 120, Height = 50, Color = "#1759B7" }, | ||
new NodeInfo() { Id = "3", Description = "Existing \nor \nnew user?", ParentId = new List<string> { "2" }, Shape = "Decision", Width = 130, Height = 80, Color = "#2F95D8" }, | ||
new NodeInfo() { Id = "4", LineText = new List<string> { "New" }, Description = "Create an account", ParentId = new List<string> { "3" }, Shape = "Rectangle", Width = 120, Height = 50, Color = "#1759B7" }, | ||
new NodeInfo() { Id = "5", Description = "Sign in", LineText = new List<string> { "Existing" }, ParentId = new List<string> { "3" }, Shape = "Rectangle", Width = 120, Height = 50, Color = "#1759B7" }, | ||
new NodeInfo() { Id = "6", Description = "Enter username \nand password", LineText = new List<string> { "", "No" }, ParentId = new List<string> { "5", "7" }, Shape = "Data", Width = 150, Height = 50, Color = "#70AF16" }, | ||
new NodeInfo() { Id = "7", Description = "Authorized?", ParentId = new List<string> { "6" }, Shape = "Decision", Width = 120, Height = 70, Color = "#2F95D8" }, | ||
new NodeInfo() { Id = "8", Description = "Login successful!!", LineText = new List<string> { "Yes" }, ParentId = new List<string> { "7" }, Shape = "Rectangle", Width = 120, Height = 50, Color = "#1759B7" }, | ||
new NodeInfo() { Id = "9", Description = "Enter first name \nand last name", ParentId = new List<string> { "4" }, Shape = "Data", Width = 150, Height = 50, Color = "#70AF16" }, | ||
new NodeInfo() { Id = "10", Description = "Enter username \nand password", LineText = new List<string> { "", "Yes" }, ParentId = new List<string> { "9", "11" }, Shape = "Data", Width = 150, Height = 50, Color = "#70AF16" }, | ||
new NodeInfo() { Id = "11", Description = "Username \nalready\n exists?", ParentId = new List<string> { "10" }, Shape = "Decision", Width = 130, Height = 80, Color = "#2F95D8" }, | ||
new NodeInfo() { Id = "12", Description = "Registration Successful!!", LineText = new List<string> { "No" }, ParentId = new List<string> { "11" }, Shape = "Process", Width = 120, Height = 50, Color = "#1759B7" }, | ||
new NodeInfo() { Id = "13", Description = "Open inbox", ParentId = new List<string> { "8", "12" }, Shape = "Process", Width = 120, Height = 50, Color = "#1759B7" }, | ||
new NodeInfo() { Id = "14", Description = "End", ParentId = new List<string> { "13" }, Shape = "StartOrEnd", Width = 100, Height = 30, Color = "#8E44CC" }, | ||
}; | ||
public class NodeInfo | ||
{ | ||
public string Id { get; set; } | ||
public string Description { get; set; } | ||
public List<string> ParentId { get; set; } | ||
public List<string> LineText { get; set; } | ||
public string Shape { get; set; } | ||
public double Width { get; set; } | ||
public double Height { get; set; } | ||
public string Color { get; set; } | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
UG-Samples/Layout/FlowchartLayout/FlowchartLayoutForGmail/FlowchartLayout/Pages/_Host.cshtml
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,8 @@ | ||
@page "/" | ||
@namespace FlowchartLayout.Pages | ||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers | ||
@{ | ||
Layout = "_Layout"; | ||
} | ||
|
||
<component type="typeof(App)" render-mode="ServerPrerendered" /> |
24 changes: 24 additions & 0 deletions
24
...mples/Layout/FlowchartLayout/FlowchartLayoutForGmail/FlowchartLayout/Pages/_Layout.cshtml
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,24 @@ | ||
@using Microsoft.AspNetCore.Components.Web | ||
@namespace FlowchartLayout.Pages | ||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<base href="~/" /> | ||
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" /> | ||
<link href="css/site.css" rel="stylesheet" /> | ||
<script src="_content/Syncfusion.Blazor/scripts/syncfusion-blazor.min.js" type="text/javascript"></script> | ||
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" /> | ||
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" /> | ||
</head> | ||
<body> | ||
@RenderBody() | ||
|
||
|
||
|
||
<script src="_framework/blazor.server.js"></script> | ||
</body> | ||
</html> |
32 changes: 32 additions & 0 deletions
32
UG-Samples/Layout/FlowchartLayout/FlowchartLayoutForGmail/FlowchartLayout/Program.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,32 @@ | ||
|
||
using Microsoft.AspNetCore.Components; | ||
using Microsoft.AspNetCore.Components.Web; | ||
using Syncfusion.Blazor; | ||
|
||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
// Add services to the container. | ||
builder.Services.AddRazorPages(); | ||
builder.Services.AddServerSideBlazor(); | ||
builder.Services.AddSyncfusionBlazor(); | ||
|
||
var app = builder.Build(); | ||
|
||
// Configure the HTTP request pipeline. | ||
if (!app.Environment.IsDevelopment()) | ||
{ | ||
app.UseExceptionHandler("/Error"); | ||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. | ||
app.UseHsts(); | ||
} | ||
|
||
app.UseHttpsRedirection(); | ||
|
||
app.UseStaticFiles(); | ||
|
||
app.UseRouting(); | ||
|
||
app.MapBlazorHub(); | ||
app.MapFallbackToPage("/_Host"); | ||
|
||
app.Run(); |
28 changes: 28 additions & 0 deletions
28
...ut/FlowchartLayout/FlowchartLayoutForGmail/FlowchartLayout/Properties/launchSettings.json
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 @@ | ||
{ | ||
"iisSettings": { | ||
"windowsAuthentication": false, | ||
"anonymousAuthentication": true, | ||
"iisExpress": { | ||
"applicationUrl": "http://localhost:11920", | ||
"sslPort": 44341 | ||
} | ||
}, | ||
"profiles": { | ||
"FlowchartLayout": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"launchBrowser": true, | ||
"applicationUrl": "https://localhost:7204;http://localhost:5236", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
}, | ||
"IIS Express": { | ||
"commandName": "IISExpress", | ||
"launchBrowser": true, | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...es/Layout/FlowchartLayout/FlowchartLayoutForGmail/FlowchartLayout/Shared/MainLayout.razor
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,18 @@ | ||
@namespace FlowchartLayout.Shared | ||
@inherits LayoutComponentBase | ||
|
||
<PageTitle>FlowchartLayout</PageTitle> | ||
|
||
<div class="page"> | ||
<div class="sidebar"> | ||
<NavMenu /> | ||
</div> | ||
|
||
|
||
<main> | ||
|
||
<article class="content px-4"> | ||
@Body | ||
</article> | ||
</main> | ||
</div> |
70 changes: 70 additions & 0 deletions
70
...ayout/FlowchartLayout/FlowchartLayoutForGmail/FlowchartLayout/Shared/MainLayout.razor.css
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,70 @@ | ||
.page { | ||
position: relative; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
main { | ||
flex: 1; | ||
} | ||
|
||
.sidebar { | ||
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); | ||
} | ||
|
||
.top-row { | ||
background-color: #f7f7f7; | ||
border-bottom: 1px solid #d6d5d5; | ||
justify-content: flex-end; | ||
height: 3.5rem; | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.top-row ::deep a, .top-row .btn-link { | ||
white-space: nowrap; | ||
margin-left: 1.5rem; | ||
} | ||
|
||
.top-row a:first-child { | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
} | ||
|
||
@media (max-width: 640.98px) { | ||
.top-row:not(.auth) { | ||
display: none; | ||
} | ||
|
||
.top-row.auth { | ||
justify-content: space-between; | ||
} | ||
|
||
.top-row a, .top-row .btn-link { | ||
margin-left: 0; | ||
} | ||
} | ||
|
||
@media (min-width: 641px) { | ||
.page { | ||
flex-direction: row; | ||
} | ||
|
||
.sidebar { | ||
width: 250px; | ||
height: 100vh; | ||
position: sticky; | ||
top: 0; | ||
} | ||
|
||
.top-row { | ||
position: sticky; | ||
top: 0; | ||
z-index: 1; | ||
} | ||
|
||
.top-row, article { | ||
padding-left: 2rem !important; | ||
padding-right: 1.5rem !important; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
UG-Samples/Layout/FlowchartLayout/FlowchartLayoutForGmail/FlowchartLayout/_Imports.razor
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,10 @@ | ||
@using System.Net.Http | ||
@using Microsoft.AspNetCore.Authorization | ||
@using Microsoft.AspNetCore.Components.Authorization | ||
@using Microsoft.AspNetCore.Components.Forms | ||
@using Microsoft.AspNetCore.Components.Routing | ||
@using Microsoft.AspNetCore.Components.Web | ||
@using Microsoft.AspNetCore.Components.Web.Virtualization | ||
@using Microsoft.JSInterop | ||
@using FlowchartLayout | ||
@using FlowchartLayout.Shared |
9 changes: 9 additions & 0 deletions
9
...yout/FlowchartLayout/FlowchartLayoutForGmail/FlowchartLayout/appsettings.Development.json
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,9 @@ | ||
{ | ||
"DetailedErrors": true, | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
UG-Samples/Layout/FlowchartLayout/FlowchartLayoutForGmail/FlowchartLayout/appsettings.json
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,9 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
}, | ||
"AllowedHosts": "*" | ||
} |
7 changes: 7 additions & 0 deletions
7
...artLayout/FlowchartLayoutForGmail/FlowchartLayout/wwwroot/css/bootstrap/bootstrap.min.css
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...ayout/FlowchartLayoutForGmail/FlowchartLayout/wwwroot/css/bootstrap/bootstrap.min.css.map
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.