File tree 5 files changed +68
-8
lines changed
5 files changed +68
-8
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ New-Alias -Name GridColumn -Value New-PgletGridColumn
21
21
New-Alias - Name Grid - Value New-PgletGrid
22
22
New-Alias - Name Html - Value New-PgletHtml
23
23
New-Alias - Name Icon - Value New-PgletIcon
24
+ New-Alias - Name IFrame - Value New-PgletIFrame
24
25
New-Alias - Name Image - Value New-PgletImage
25
26
New-Alias - Name LineChart - Value New-PgletLineChart
26
27
New-Alias - Name LineChartData - Value New-PgletLineChartData
Original file line number Diff line number Diff line change
1
+ using Pglet . Controls ;
2
+ using System . Management . Automation ;
3
+
4
+ namespace Pglet . PowerShell
5
+ {
6
+ [ Cmdlet ( VerbsCommon . New , "PgletIFrame" ) ]
7
+ [ OutputType ( typeof ( IFrame ) ) ]
8
+ public class NewPgletIFrameCommand : NewControlCmdletBase
9
+ {
10
+ [ Parameter ( Mandatory = false , Position = 0 ) ]
11
+ public string Src { get ; set ; }
12
+
13
+ [ Parameter ( Mandatory = false ) ]
14
+ public string Title { get ; set ; }
15
+
16
+ [ Parameter ( Mandatory = false ) ]
17
+ public string Border { get ; set ; }
18
+
19
+ protected override void ProcessRecord ( )
20
+ {
21
+ var control = new IFrame
22
+ {
23
+ Src = Src ,
24
+ Title = Title ,
25
+ Border = Border
26
+ } ;
27
+
28
+ SetControlProps ( control ) ;
29
+
30
+ WriteObject ( control ) ;
31
+ }
32
+ }
33
+ }
Original file line number Diff line number Diff line change
1
+ namespace Pglet . Controls
2
+ {
3
+ public class IFrame : Control
4
+ {
5
+ protected override string ControlName => "iframe" ;
6
+
7
+ public string Src
8
+ {
9
+ get { return GetAttr ( "src" ) ; }
10
+ set { SetAttr ( "src" , value ) ; }
11
+ }
12
+
13
+ public string Title
14
+ {
15
+ get { return GetAttr ( "title" ) ; }
16
+ set { SetAttr ( "title" , value ) ; }
17
+ }
18
+
19
+ public string Border
20
+ {
21
+ get { return GetAttr ( "border" ) ; }
22
+ set { SetAttr ( "border" , value ) ; }
23
+ }
24
+ }
25
+ }
Original file line number Diff line number Diff line change @@ -81,8 +81,8 @@ Connect-PgletApp -Name "pglet-buttons" -ScriptBlock {
81
81
82
82
Text " Split buttons" - Size Large
83
83
Button -Split - Text " Standard" - MenuItems @ (
84
- MenuItem - Text " Email message" - Icon " Mail"
85
- MenuItem - Text " Calendar event" - Icon " Calendar"
84
+ MenuItem - Text " Email message" - Icon " Mail" - OnClick { Write-Trace " Email message clicked! " }
85
+ MenuItem - Text " Calendar event" - Icon " Calendar" - OnClick { Write-Trace " Calendar clicked! " }
86
86
)
87
87
Button -Split - Primary - Text " Primary" - MenuItems @ (
88
88
MenuItem - Text " Email message" - Icon " Mail"
Original file line number Diff line number Diff line change 1
1
Remove-Module pglet - ErrorAction SilentlyContinue
2
2
Import-Module ([IO.Path ]::Combine((get-item $PSScriptRoot ).parent.FullName, ' pglet.psd1' ))
3
3
4
- Connect-PgletPage - Name " index" - NoWindow
4
+ Connect-PgletApp - ScriptBlock {
5
+ $page = $PGLET_PAGE
5
6
6
- Invoke-Pglet " clean page"
7
-
8
- Invoke-Pglet " add
9
- iframe src='https://pglet.io' width='100%' border1='2px solid red'
10
- "
7
+ $ page.title = " IFrame example "
8
+ $page .add (
9
+ (IFrame - Src ' https://pglet.io ' - Width ' 100% ' - Height 300 - Border ' 2px solid red ' )
10
+ )
11
+ }
You can’t perform that action at this time.
0 commit comments