diff options
| author | Jake Mannens <jake@asger.xyz> | 2023-10-05 16:47:49 +1100 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2023-10-05 16:47:49 +1100 |
| commit | 2c6e3aa4456811a3d6412fc10019012a900eb6a0 (patch) | |
| tree | d0616bbe573a4abe5aaf9f80e7960a40352967b8 /Pages/Component/Dialog.razor | |
| parent | 035d2e3858dd55580c294031573c3be9e1999449 (diff) | |
| parent | 3d5f6e47bd74ce77d5ec253f51b7cef1b42099ef (diff) | |
Merged security
Diffstat (limited to 'Pages/Component/Dialog.razor')
| -rw-r--r-- | Pages/Component/Dialog.razor | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/Pages/Component/Dialog.razor b/Pages/Component/Dialog.razor index 673ec2f..ac05515 100644 --- a/Pages/Component/Dialog.razor +++ b/Pages/Component/Dialog.razor @@ -4,7 +4,7 @@ <div class="dialog" onmousedown="dialogMouseDown(event)" - style="opacity:0;visibility:hidden;@(heightStyle)" + style="opacity:0;visibility:hidden;@(sizeStyle)" @ref=dialogDiv> @if(Title is not null) { <div class="titlebar" onmousedown="dialogTitleMouseDown(event)"> @@ -25,9 +25,19 @@ public RenderFragment ChildContent { get; set; } [Parameter] + public int WidthPixels { set => width = $"{value}px"; } + [Parameter] public int HeightPixels { set => height = $"{value}px"; } [Parameter] public int HeightPercent { set => height = $"{value}%"; } + [Parameter] + public int MinHeightPixels { set => minHeight = $"{value}px"; } + [Parameter] + public int MinHeightPercent { set => minHeight = $"{value}%"; } + [Parameter] + public int MaxHeightPixels { set => maxHeight = $"{value}px"; } + [Parameter] + public int MaxHeightPercent { set => maxHeight = $"{value}%"; } public bool Visible { get => visible; @@ -41,7 +51,10 @@ private bool visible = false; + private string? width; private string? height; + private string? minHeight; + private string? maxHeight; private ElementReference dialogDiv; @@ -53,7 +66,7 @@ await jsRuntime.InvokeVoidAsync("dialogAddObjectReference", new object[] { dialogDiv, DotNetObjectReference.Create(this) - }); + }); } } @@ -65,6 +78,19 @@ } } + private string sizeStyle => string.Join("", new[] { + widthStyle, heightStyle, minHeightStyle, maxHeightStyle + }); + + private string widthStyle => + $"{(width is null ? "" : $"width:{width};")}"; + private string heightStyle => - $"{(height is null ? "" : $"max-height:{height};")}"; + $"{(height is null ? "" : $"height:{height};")}"; + + private string minHeightStyle => + $"{(minHeight is null ? "" : $"min-height:{minHeight};")}"; + + private string maxHeightStyle => + $"{(maxHeight is null ? "" : $"max-height:{maxHeight};")}"; } |
