summaryrefslogtreecommitdiff
path: root/Pages/Component/Dialog.razor
diff options
context:
space:
mode:
Diffstat (limited to 'Pages/Component/Dialog.razor')
-rw-r--r--Pages/Component/Dialog.razor32
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};")}";
}