Skip to content

Commit

Permalink
876894: Sample Added
Browse files Browse the repository at this point in the history
  • Loading branch information
SumathiSumi committed Jun 14, 2024
1 parent 600f0c0 commit 12c4fea
Show file tree
Hide file tree
Showing 64 changed files with 1,304 additions and 0 deletions.
13 changes: 13 additions & 0 deletions KB-Samples/FamilyTreeStructure/App.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<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>

13 changes: 13 additions & 0 deletions KB-Samples/FamilyTreeStructure/ComplexHierarchicalTree.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.Blazor.Diagram" Version="*" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions KB-Samples/FamilyTreeStructure/ComplexHierarchicalTree.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33122.133
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComplexHierarchicalTree", "ComplexHierarchicalTree.csproj", "{BD607AD5-F5CD-4426-B6CF-BCF6EE5E38A5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BD607AD5-F5CD-4426-B6CF-BCF6EE5E38A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BD607AD5-F5CD-4426-B6CF-BCF6EE5E38A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BD607AD5-F5CD-4426-B6CF-BCF6EE5E38A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BD607AD5-F5CD-4426-B6CF-BCF6EE5E38A5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E54284AF-9797-4860-9EED-6ECF085DCDBF}
EndGlobalSection
EndGlobal
209 changes: 209 additions & 0 deletions KB-Samples/FamilyTreeStructure/Pages/Index.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
@page "/"

@using Syncfusion.Blazor.Diagram
<style>
#diagram {
display: block;
}
.image-pattern-style {
background-color: white;
background-size: contain;
background-repeat: no-repeat;
width: 140px;
height: 180px;
cursor: pointer;
border: 1px solid #D5D5D5;
background-position: center;
float: left;
}
.image-pattern-style:hover {
border-color: gray;
border-width: 2px;
}
.row {
margin-left: 0px;
margin-right: 0px;
display: block;
}
.property-panel-header {
padding-top: 15px;
padding-bottom: 5px;
font-weight: 600;
font-size: 15px;
}
.row-header {
font-size: 13px;
font-weight: 600;
}
.row-header1 {
font-size: 12px;
padding-left: 2px;
font-weight: 400;
}
.e-selected-orientation-style {
border-color: #006CE6;
border-width: 2px;
}
.e-selected-pattern-style {
border-color: #006CE6;
border-width: 2px;
}
.textboxstyle {
padding-left: 0px;
padding-right: 0px;
float: left;
width: 120px;
}
.e-checkbox-wrapper .e-label {
font-size: 12px;
}
.col-xs-6 {
padding-left: 0px;
padding-right: 0px;
}
.sb-property-border {
border-right: 1px solid #D7D7D7;
}
.e-orgchart-template-div-style {
position: absolute;
border: 1px solid black;
width: 140px;
height: 200px;
box-sizing: border-box;
border-radius: 5px;
}
.e-orgchart-template-image-style {
width: 140px;
height: 180px;
left: 552px;
top: 154px;
float: left;
background-size: 100% 100%;
}
.e-orgchart-template-name-style {
font-family: Roboto;
font-style: normal;
font-weight: 500;
font-size: 14px;
line-height: 14px;
letter-spacing: 0.1px;
color: #363636;
margin-top: 8px;
height: 8px
}
.e-orgchart-template-role-style {
font-family: Roboto;
font-style: normal;
font-weight: 400;
font-size: 10px;
line-height: 14px;
letter-spacing: 0.1px;
color: #7A7A7A;
}
</style>
<SfDiagramComponent @ref="diagram" Height="1000px" NodeCreating="@OnNodeCreating" ConnectorCreating="@OnConnectorCreating">
<DiagramTemplates>
<NodeTemplate>
@{
Node node1 = (context as Node);
string Name = (node1.Data as ComplexHierarchical).RelationShip;
string Imageurl = (node1.Data as ComplexHierarchical).ImagePath;
<div class="e-orgchart-template-div-style">
<div id="image" class="e-orgchart-template-image-style" style="background-image: url(@(@Imageurl));">
<p style="margin-top:180px;margin-left:40px;font-weight: 500;
font-size: 14px;
line-height: 14px;"><b>@Name</b></p>
</div>

</div>
}
</NodeTemplate>
</DiagramTemplates>
<DataSourceSettings ID="Id" ParentID="ReportingPerson" DataSource="@DataSource"></DataSourceSettings>
<Layout Type="LayoutType.ComplexHierarchicalTree" LinearArrangement="true" @bind-HorizontalSpacing="@HorizontalSpacing" @bind-VerticalSpacing="@VerticalSpacing">
</Layout>
</SfDiagramComponent>

@code
{
SfDiagramComponent diagram;
//Initializing layout.
int HorizontalSpacing = 80;
int VerticalSpacing = 80;

//Creates node with some default values.
private void OnNodeCreating(IDiagramObject obj)
{
Node node = obj as Node;
node.Height = 200;
node.Width = 140;
ComplexHierarchical data = (node.Data as ComplexHierarchical);

node.Shape = new Shape()
{
Type = NodeShapes.HTML,
};
}

//Creates connectors with some default values.
private void OnConnectorCreating(IDiagramObject connector)
{
Connector connector1 = (connector as Connector);
connector1.Type = ConnectorSegmentType.Orthogonal;
(connector as Connector).Style.StrokeWidth = 1;
(connector as Connector).TargetDecorator.Height = 7;
(connector as Connector).TargetDecorator.Width = 7;
Node SourceNode = diagram.GetObject(connector1.SourceID) as Node;
Node TargetNode = diagram.GetObject(connector1.TargetID) as Node;

if (TargetNode != null)
{
ComplexHierarchical complexHierarchical = TargetNode.Data as ComplexHierarchical;
if (complexHierarchical.RelationShip.Contains("InLaw"))
{
connector1.IsVisible = false;
}

}
}

public class ComplexHierarchical
{
public string Id { get; set; }
public string RelationShip { get; set; }
public List<string> ReportingPerson { get; set; }
public string ImagePath { get; set; }
}
public object DataSource = new List<object>()
{
new ComplexHierarchical() { Id= "1",RelationShip="Dad",ImagePath="/diagram/images/people-circle26.png" },
new ComplexHierarchical() { Id= "2",RelationShip="Mom",ImagePath="/diagram/images/people-circle0.png"},
new ComplexHierarchical() { Id= "3",RelationShip="Brother",ImagePath="/diagram/images/people-circle23.png", ReportingPerson=new List<string>() {"1","2" }},
new ComplexHierarchical() { Id= "4",RelationShip="SisterInLaw",ImagePath="/diagram/images/people-circle21.png",ReportingPerson=new List<string>() {"1","2" }},
new ComplexHierarchical() { Id= "5",RelationShip="Sister",ImagePath="/diagram/images/people-circle16.png", ReportingPerson=new List<string>() {"1","2" }},
new ComplexHierarchical() { Id= "6",RelationShip="BrotherInLaw",ImagePath="/diagram/images/people-circle33.png",ReportingPerson=new List<string>() {"1","2" }},
new ComplexHierarchical() { Id= "7",RelationShip="Sister",ImagePath="/diagram/images/people-circle11.png", ReportingPerson=new List<string>() {"1","2" }},
new ComplexHierarchical() { Id= "8",RelationShip="BrotherInLaw",ImagePath="/diagram/images/people-circle31.png", ReportingPerson=new List<string>() {"1","2" }},
new ComplexHierarchical() { Id= "9",RelationShip="Sister",ImagePath="/diagram/images/people-circle1.png", ReportingPerson=new List<string>() {"1","2" }},
new ComplexHierarchical() { Id= "10",RelationShip="Nephew",ImagePath="/diagram/images/people-circle4.png", ReportingPerson=new List<string>() {"3","4" }},
new ComplexHierarchical() { Id= "11",RelationShip="Niece",ImagePath="/diagram/images/people-circle4.png", ReportingPerson=new List<string>() {"5","6" }},
new ComplexHierarchical() { Id= "12",RelationShip="Niece",ImagePath="/diagram/images/people-circle4.png", ReportingPerson=new List<string>() {"7","8" }},
};
}
8 changes: 8 additions & 0 deletions KB-Samples/FamilyTreeStructure/Pages/_Host.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@page "/"
@namespace ComplexHierarchicalTree.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = "_Layout";
}

<component type="typeof(App)" render-mode="ServerPrerendered" />
24 changes: 24 additions & 0 deletions KB-Samples/FamilyTreeStructure/Pages/_Layout.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@using Microsoft.AspNetCore.Components.Web
@namespace ComplexHierarchicalTree.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.Core/scripts/syncfusion-blazor.min.js" type="text/javascript"></script>
<link href="ComplexHierarchicalTree.styles.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 KB-Samples/FamilyTreeStructure/Program.cs
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 KB-Samples/FamilyTreeStructure/Properties/launchSettings.json
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": {
"ComplexHierarchicalTree": {
"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"
}
}
}
}
17 changes: 17 additions & 0 deletions KB-Samples/FamilyTreeStructure/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@inherits LayoutComponentBase

<PageTitle>ComplexHierarchicalTree</PageTitle>

<div class="page">
<div class="sidebar">
<NavMenu />
</div>


<main>

<article class="content px-4">
@Body
</article>
</main>
</div>
Loading

0 comments on commit 12c4fea

Please sign in to comment.