Skip to content

Commit b36fdff

Browse files
committed
feat: add frame control, general improvements and minor bugs
1 parent 7e38b74 commit b36fdff

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

src/WebUI/WWW/Controls/Frame.cs

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
using WebExpress.Tutorial.WebUI.Model;
2+
using WebExpress.Tutorial.WebUI.WebFragment.ControlPage;
3+
using WebExpress.Tutorial.WebUI.WebPage;
4+
using WebExpress.Tutorial.WebUI.WebScope;
5+
using WebExpress.WebApp.WebScope;
6+
using WebExpress.WebCore.WebAttribute;
7+
using WebExpress.WebCore.WebPage;
8+
using WebExpress.WebCore.WebSitemap;
9+
using WebExpress.WebUI.WebControl;
10+
11+
namespace WebExpress.Tutorial.WebUI.WWW.Controls
12+
{
13+
/// <summary>
14+
/// Represents the frame control for the tutorial.
15+
/// </summary>
16+
[Title("Frame")]
17+
[Scope<IScopeGeneral>]
18+
[Scope<IScopeControl>]
19+
[Scope<IScopeControlWebUI>]
20+
public sealed class Frame : PageControl
21+
{
22+
/// <summary>
23+
/// Initializes a new instance of the class.
24+
/// </summary>
25+
/// <param name="pageContext">The context of the page where the tree control is used.</param>
26+
/// <param name="sitemapManager">The sitemap manager for managing site navigation.</param>
27+
public Frame(IPageContext pageContext, ISitemapManager sitemapManager)
28+
{
29+
Stage.Description = @"The `Frame` control is used to embed external HTML content into the current page. It behaves similarly to an iframe, but allows for fine-grained integration such as targeting specific fragments by ID or selector.";
30+
31+
Stage.Control = new ControlFrame()
32+
{
33+
Uri = pageContext.ApplicationContext.Route.ToUri()
34+
};
35+
36+
Stage.Code = @"
37+
new ControlFrame()
38+
{
39+
Uri = pageContext.ApplicationContext.Route.ToUri()
40+
};";
41+
42+
Stage.AddProperty
43+
(
44+
"Uri",
45+
"The `Uri` property defines the source of the external HTML content to be embedded. It can point to a full HTML page or a partial fragment that will be integrated into the current view—similar to an iframe, but with DOM-level control.",
46+
"Uri = sitemapManager.GetUri<Info>(pageContext.ApplicationContext)",
47+
new ControlFrame()
48+
{
49+
Uri = sitemapManager.GetUri<Info>(pageContext.ApplicationContext)
50+
}
51+
);
52+
53+
Stage.AddProperty
54+
(
55+
"Selector",
56+
"The `Selector` property allows you to specify a CSS selector—such as an `id` or `class`—to extract only a specific fragment from the loaded HTML content. This enables precise embedding of partial views rather than full pages.",
57+
"Selector = \"#wx-content-main\"",
58+
new ControlFrame()
59+
{
60+
Uri = sitemapManager.GetUri<Info>(pageContext.ApplicationContext),
61+
Selector = "#wx-content-main"
62+
}
63+
);
64+
}
65+
}
66+
}

0 commit comments

Comments
 (0)