Skip to content

Commit ab0392c

Browse files
Merge pull request #133 from issacimmanuvel-git/892646-connectorport
892646: Connector port support
2 parents be2fd7f + 8fbbd60 commit ab0392c

File tree

108 files changed

+4692
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+4692
-1
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@namespace ConnectorPortConnection
2+
<Router AppAssembly="@typeof(App).Assembly">
3+
<Found Context="routeData">
4+
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
5+
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
6+
</Found>
7+
<NotFound>
8+
<PageTitle>Not found</PageTitle>
9+
<LayoutView Layout="@typeof(MainLayout)">
10+
<p role="alert">Sorry, there's nothing at this address.</p>
11+
</LayoutView>
12+
</NotFound>
13+
</Router>
14+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project Sdk="Microsoft.NET.Sdk.Web">
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
<ItemGroup>
9+
<PackageReference Include="Syncfusion.Blazor.Diagram" Version="*" />
10+
<PackageReference Include="Syncfusion.Blazor.Themes" Version="*" />
11+
</ItemGroup>
12+
<ItemGroup>
13+
<Folder Include="wwwroot\" />
14+
</ItemGroup>
15+
</Project>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project Sdk="Microsoft.NET.Sdk.Web">
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
<ItemGroup>
9+
<PackageReference Include="Syncfusion.Blazor.Diagram" Version="*" />
10+
<PackageReference Include="Syncfusion.Blazor.Themes" Version="*" />
11+
</ItemGroup>
12+
<ItemGroup>
13+
<Folder Include="wwwroot\" />
14+
</ItemGroup>
15+
</Project>
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
@page "/"
2+
3+
@using Syncfusion.Blazor.Diagram
4+
5+
<SfDiagramComponent Height="600px" Connectors="@connectors">
6+
<SnapSettings Constraints="SnapConstraints.None"></SnapSettings>
7+
</SfDiagramComponent>
8+
9+
@code
10+
{
11+
// Initialize connector collection
12+
DiagramObjectCollection<Connector> connectors = new DiagramObjectCollection<Connector>();
13+
14+
protected override void OnInitialized()
15+
{
16+
Connector connector1 = new Connector()
17+
{
18+
ID = "connector1",
19+
SourcePoint = new DiagramPoint() { X = 200, Y = 100 },
20+
TargetPoint = new DiagramPoint() { X = 350, Y = 250 },
21+
Type = ConnectorSegmentType.Bezier,
22+
TargetDecorator = new DecoratorSettings()
23+
{
24+
Shape = DecoratorShape.Arrow,
25+
Style = new ShapeStyle()
26+
{
27+
Fill = "#6495ED",
28+
StrokeColor = "#6495ED",
29+
StrokeWidth = 2
30+
}
31+
},
32+
Ports = new DiagramObjectCollection<ConnectorPort>()
33+
{
34+
new ConnectorPort()
35+
{
36+
ID = "port",
37+
Visibility = PortVisibility.Visible,
38+
Shape = PortShapes.Square,
39+
Style = new ShapeStyle(){ Fill = "gray", StrokeColor = "gray" },
40+
}
41+
},
42+
Style = new ShapeStyle()
43+
{
44+
Fill = "#6495ED",
45+
StrokeColor = "#6495ED",
46+
StrokeWidth = 2
47+
}
48+
};
49+
50+
Connector connector2 = new Connector()
51+
{
52+
ID = "connector2",
53+
SourcePoint = new DiagramPoint() { X = 600, Y = 100 },
54+
TargetPoint = new DiagramPoint() { X = 750, Y = 250 },
55+
Type = ConnectorSegmentType.Bezier,
56+
TargetDecorator = new DecoratorSettings()
57+
{
58+
Shape = DecoratorShape.Arrow,
59+
Style = new ShapeStyle()
60+
{
61+
Fill = "#6495ED",
62+
StrokeColor = "#6495ED",
63+
StrokeWidth = 2
64+
}
65+
},
66+
Ports = new DiagramObjectCollection<ConnectorPort>()
67+
{
68+
new ConnectorPort()
69+
{
70+
ID = "port",
71+
Visibility = PortVisibility.Visible,
72+
Shape = PortShapes.Square,
73+
Style = new ShapeStyle(){ Fill = "gray", StrokeColor = "gray" },
74+
}
75+
},
76+
Style = new ShapeStyle()
77+
{
78+
Fill = "#6495ED",
79+
StrokeColor = "#6495ED",
80+
StrokeWidth = 2
81+
}
82+
};
83+
Connector connector3 = new Connector()
84+
{
85+
ID = "connector3",
86+
SourceID = "connector1",
87+
SourcePortID = "port",
88+
TargetID = "connector2",
89+
TargetPortID = "port",
90+
Type = ConnectorSegmentType.Straight,
91+
TargetDecorator = new DecoratorSettings()
92+
{
93+
Shape = DecoratorShape.Arrow,
94+
Style = new ShapeStyle()
95+
{
96+
Fill = "#6495ED",
97+
StrokeColor = "#6495ED",
98+
StrokeWidth = 2
99+
}
100+
},
101+
Style = new ShapeStyle()
102+
{
103+
Fill = "#6495ED",
104+
StrokeColor = "#6495ED",
105+
StrokeWidth = 2
106+
}
107+
};
108+
109+
connectors.Add(connector1);
110+
connectors.Add(connector2);
111+
connectors.Add(connector3);
112+
}
113+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@page "/"
2+
@namespace ConnectorPortConnection.Pages
3+
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
4+
@{
5+
Layout = "_Layout";
6+
}
7+
8+
<component type="typeof(App)" render-mode="ServerPrerendered" />
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@using Microsoft.AspNetCore.Components.Web
2+
@namespace ConnectorPortConnection.Pages
3+
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
4+
5+
<!DOCTYPE html>
6+
<html lang="en">
7+
<head>
8+
<meta charset="utf-8" />
9+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
10+
<base href="~/" />
11+
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
12+
<link href="css/site.css" rel="stylesheet" />
13+
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js" type="text/javascript"></script>
14+
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
15+
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
16+
</head>
17+
<body>
18+
@RenderBody()
19+
20+
21+
22+
<script src="_framework/blazor.server.js"></script>
23+
</body>
24+
</html>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
using Microsoft.AspNetCore.Components;
3+
using Microsoft.AspNetCore.Components.Web;
4+
using Syncfusion.Blazor;
5+
6+
var builder = WebApplication.CreateBuilder(args);
7+
8+
// Add services to the container.
9+
builder.Services.AddRazorPages();
10+
builder.Services.AddServerSideBlazor();
11+
builder.Services.AddSyncfusionBlazor();
12+
13+
var app = builder.Build();
14+
15+
// Configure the HTTP request pipeline.
16+
if (!app.Environment.IsDevelopment())
17+
{
18+
app.UseExceptionHandler("/Error");
19+
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
20+
app.UseHsts();
21+
}
22+
23+
app.UseHttpsRedirection();
24+
25+
app.UseStaticFiles();
26+
27+
app.UseRouting();
28+
29+
app.MapBlazorHub();
30+
app.MapFallbackToPage("/_Host");
31+
32+
app.Run();
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:11920",
7+
"sslPort": 44341
8+
}
9+
},
10+
"profiles": {
11+
"ConnectorPortConnection": {
12+
"commandName": "Project",
13+
"dotnetRunMessages": true,
14+
"launchBrowser": true,
15+
"applicationUrl": "https://localhost:7204;http://localhost:5236",
16+
"environmentVariables": {
17+
"ASPNETCORE_ENVIRONMENT": "Development"
18+
}
19+
},
20+
"IIS Express": {
21+
"commandName": "IISExpress",
22+
"launchBrowser": true,
23+
"environmentVariables": {
24+
"ASPNETCORE_ENVIRONMENT": "Development"
25+
}
26+
}
27+
}
28+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@namespace ConnectorPortConnection.Shared
2+
@inherits LayoutComponentBase
3+
4+
<PageTitle>ConnectorPortConnection</PageTitle>
5+
6+
<div class="page">
7+
<div class="sidebar">
8+
<NavMenu />
9+
</div>
10+
11+
12+
<main>
13+
14+
<article class="content px-4">
15+
@Body
16+
</article>
17+
</main>
18+
</div>
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
.page {
2+
position: relative;
3+
display: flex;
4+
flex-direction: column;
5+
}
6+
7+
main {
8+
flex: 1;
9+
}
10+
11+
.sidebar {
12+
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
13+
}
14+
15+
.top-row {
16+
background-color: #f7f7f7;
17+
border-bottom: 1px solid #d6d5d5;
18+
justify-content: flex-end;
19+
height: 3.5rem;
20+
display: flex;
21+
align-items: center;
22+
}
23+
24+
.top-row ::deep a, .top-row .btn-link {
25+
white-space: nowrap;
26+
margin-left: 1.5rem;
27+
}
28+
29+
.top-row a:first-child {
30+
overflow: hidden;
31+
text-overflow: ellipsis;
32+
}
33+
34+
@media (max-width: 640.98px) {
35+
.top-row:not(.auth) {
36+
display: none;
37+
}
38+
39+
.top-row.auth {
40+
justify-content: space-between;
41+
}
42+
43+
.top-row a, .top-row .btn-link {
44+
margin-left: 0;
45+
}
46+
}
47+
48+
@media (min-width: 641px) {
49+
.page {
50+
flex-direction: row;
51+
}
52+
53+
.sidebar {
54+
width: 250px;
55+
height: 100vh;
56+
position: sticky;
57+
top: 0;
58+
}
59+
60+
.top-row {
61+
position: sticky;
62+
top: 0;
63+
z-index: 1;
64+
}
65+
66+
.top-row, article {
67+
padding-left: 2rem !important;
68+
padding-right: 1.5rem !important;
69+
}
70+
}

0 commit comments

Comments
 (0)