Skip to content

Commit a492f00

Browse files
Merge pull request #134 from Jawin-SF4519/master
954569: ToggleSidebar
2 parents d92bf39 + b085646 commit a492f00

File tree

85 files changed

+2812
-0
lines changed

Some content is hidden

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

85 files changed

+2812
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@namespace BeyondPageBreak
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>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Syncfusion.Blazor.Diagram" Version="*" />
11+
<PackageReference Include="Syncfusion.Blazor.Themes" Version="*" />
12+
</ItemGroup>
13+
14+
</Project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<ActiveDebugProfile>https</ActiveDebugProfile>
5+
</PropertyGroup>
6+
</Project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Syncfusion.Blazor.Diagram" Version="*" />
11+
<PackageReference Include="Syncfusion.Blazor.Themes" Version="*" />
12+
</ItemGroup>
13+
14+
</Project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<ActiveDebugProfile>https</ActiveDebugProfile>
5+
</PropertyGroup>
6+
</Project>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@inherits LayoutComponentBase
2+
@namespace BeyondPageBreak
3+
<main> @Body </main>
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
@page "/"
2+
3+
@using Syncfusion.Blazor.Diagram
4+
@using System.Text.Json;
5+
@using System.Text.Json.Serialization;
6+
@inject IJSRuntime jsRuntime;
7+
8+
<style>
9+
10+
.e-diagram-page-break {
11+
stroke: blue;
12+
stroke-width: 3;
13+
stroke-dasharray: 20,20;
14+
}
15+
</style>
16+
17+
<SfDiagramComponent ID="diagram" @ref="@diagram" Height="600px" Nodes="@nodes" Created="@OnCreated">
18+
<SnapSettings></SnapSettings>
19+
<PageSettings Height="@pageHeight" Width="@pageHeight" ShowPageBreaks="true" MultiplePage="true">
20+
<PageMargin Left="@mLeft" Right="@mRight" Top="@mTop" Bottom="@mBottom">
21+
22+
</PageMargin>
23+
</PageSettings>
24+
</SfDiagramComponent>
25+
<button onclick="@OnCreated">Check Nodes</button>
26+
27+
@code
28+
{
29+
double mLeft = 50;
30+
double mRight = 50;
31+
double mTop = 50;
32+
double mBottom = 50;
33+
double pageHeight = 500;
34+
double pageWidth = 500;
35+
SfDiagramComponent diagram;
36+
DiagramObjectCollection<Node> nodes;
37+
protected override void OnInitialized()
38+
{
39+
nodes = new DiagramObjectCollection<Node>();
40+
Node node = new Node()
41+
{
42+
ID = "node",
43+
OffsetX = 250,
44+
OffsetY = 250,
45+
Width = 100,
46+
Height = 100,
47+
Style = new ShapeStyle() { Fill = "#6495ED", StrokeColor = "white" }
48+
};
49+
nodes.Add(node);
50+
Node node1 = new Node()
51+
{
52+
ID = "node1",
53+
OffsetX = 50,
54+
OffsetY = 100,
55+
Width = 100,
56+
Height = 100,
57+
Style = new ShapeStyle() { Fill = "#6495ED", StrokeColor = "white" }
58+
};
59+
nodes.Add(node1);
60+
Node node2 = new Node()
61+
{
62+
ID = "node2",
63+
OffsetX = 50,
64+
OffsetY = 300,
65+
Width = 100,
66+
Height = 100,
67+
Style = new ShapeStyle() { Fill = "#6495ED", StrokeColor = "white" }
68+
};
69+
nodes.Add(node2);
70+
Node node3 = new Node()
71+
{
72+
ID = "node3",
73+
OffsetX = 400,
74+
OffsetY = 200,
75+
Width = 100,
76+
Height = 100,
77+
Style = new ShapeStyle() { Fill = "#6495ED", StrokeColor = "white" }
78+
};
79+
nodes.Add(node3);
80+
Node node4 = new Node()
81+
{
82+
ID = "node4",
83+
OffsetX = 300,
84+
OffsetY = 50,
85+
Width = 100,
86+
Height = 100,
87+
Style = new ShapeStyle() { Fill = "#6495ED", StrokeColor = "white" }
88+
};
89+
nodes.Add(node4);
90+
Node node5 = new Node()
91+
{
92+
ID = "node5",
93+
OffsetX = 300,
94+
OffsetY = 400,
95+
Width = 100,
96+
Height = 100,
97+
Style = new ShapeStyle() { Fill = "#6495ED", StrokeColor = "white" }
98+
};
99+
nodes.Add(node5);
100+
Node node6 = new Node()
101+
{
102+
ID = "node6",
103+
OffsetX = 600,
104+
OffsetY = 400,
105+
Width = 100,
106+
Height = 100,
107+
Style = new ShapeStyle() { Fill = "#6495ED", StrokeColor = "white" }
108+
};
109+
nodes.Add(node6);
110+
}
111+
112+
object bounds;
113+
114+
private async Task OnCreated()
115+
{
116+
await Task.Delay(1000);
117+
bounds = await jsRuntime.InvokeAsync<object>("getViewportBounds").ConfigureAwait(true);
118+
List<string> outOfBoundsNodes = new List<string>();
119+
120+
if (bounds != null)
121+
{
122+
JsonSerializerOptions options = new JsonSerializerOptions
123+
{
124+
WriteIndented = true,
125+
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
126+
};
127+
DiagramRect dataObj = System.Text.Json.JsonSerializer.Deserialize<DiagramRect>(bounds.ToString(), options);
128+
if (dataObj != null)
129+
{
130+
foreach (Node node in diagram.Nodes)
131+
{
132+
double? nodeLeft = node.OffsetX - (node.Width / 2);
133+
double? nodeRight = node.OffsetX + (node.Width / 2);
134+
double? nodeTop = node.OffsetY - (node.Height / 2);
135+
double? nodeBottom = node.OffsetY + (node.Height / 2);
136+
if (nodeRight > dataObj.Width - mRight || nodeBottom > dataObj.Height - mBottom || nodeLeft < dataObj.X + mLeft || nodeTop < dataObj.Y + mTop)
137+
{
138+
outOfBoundsNodes.Add(node.ID);
139+
}
140+
}
141+
}
142+
}
143+
}
144+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@page "/"
2+
@using Microsoft.AspNetCore.Components.Web
3+
@namespace BeyondPageBreak.Pages
4+
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
5+
6+
<!DOCTYPE html>
7+
<html lang="en">
8+
<head>
9+
<meta charset="utf-8" />
10+
<base href="~/" />
11+
<link href="css/site.css" rel="stylesheet" />
12+
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.3.css" rel="stylesheet" />
13+
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js" type="text/javascript"></script>
14+
<script src="~/interop.js"></script>
15+
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
16+
</head>
17+
<body>
18+
<component type="typeof(App)" render-mode="ServerPrerendered" />
19+
20+
<div id="blazor-error-ui">
21+
<environment include="Staging,Production">
22+
An error has occurred. This application may no longer respond until reloaded.
23+
</environment>
24+
<environment include="Development">
25+
An unhandled exception has occurred. See browser dev tools for details.
26+
</environment>
27+
<a href="" class="reload">Reload</a>
28+
<a class="dismiss">🗙</a>
29+
</div>
30+
31+
<script src="_framework/blazor.server.js"></script>
32+
</body>
33+
</html>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using Microsoft.AspNetCore.Components;
2+
using Microsoft.AspNetCore.Components.Web;
3+
using Syncfusion.Blazor;
4+
var builder = WebApplication.CreateBuilder(args);
5+
builder.Services.AddRazorPages();
6+
builder.Services.AddServerSideBlazor();
7+
builder.Services.AddSyncfusionBlazor();
8+
builder.Services.AddSignalR(e => {
9+
e.MaximumReceiveMessageSize = 102400000;
10+
});
11+
var app = builder.Build();
12+
13+
if (!app.Environment.IsDevelopment())
14+
{
15+
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
16+
app.UseHsts();
17+
}
18+
19+
app.UseHttpsRedirection();
20+
21+
app.UseStaticFiles();
22+
23+
app.UseRouting();
24+
25+
app.MapBlazorHub();
26+
app.MapFallbackToPage("/_Host");
27+
28+
app.Run();
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"iisSettings": {
3+
"iisExpress": {
4+
"applicationUrl": "http://localhost:18318",
5+
"sslPort": 44368
6+
}
7+
},
8+
"profiles": {
9+
"http": {
10+
"commandName": "Project",
11+
"dotnetRunMessages": true,
12+
"launchBrowser": true,
13+
"applicationUrl": "http://localhost:5048",
14+
"environmentVariables": {
15+
"ASPNETCORE_ENVIRONMENT": "Development"
16+
}
17+
},
18+
"https": {
19+
"commandName": "Project",
20+
"dotnetRunMessages": true,
21+
"launchBrowser": true,
22+
"applicationUrl": "https://localhost:7088;http://localhost:5048",
23+
"environmentVariables": {
24+
"ASPNETCORE_ENVIRONMENT": "Development"
25+
}
26+
},
27+
"IIS Express": {
28+
"commandName": "IISExpress",
29+
"launchBrowser": true,
30+
"environmentVariables": {
31+
"ASPNETCORE_ENVIRONMENT": "Development"
32+
}
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)