|
| 1 | +// Copyright (c) CodeBeam 2021 |
| 2 | +// CodeBeam.MudExtensions licenses this file to you under the MIT license. |
| 3 | +// See the LICENSE file in the project root for more information. |
| 4 | + |
| 5 | +using System; |
| 6 | +using System.Threading.Tasks; |
| 7 | +using Microsoft.AspNetCore.Components; |
| 8 | +using Microsoft.AspNetCore.Components.Web; |
| 9 | +using MudBlazor; |
| 10 | +using MudBlazor.Extensions; |
| 11 | +using MudBlazor.Utilities; |
| 12 | + |
| 13 | +namespace MudExtensions |
| 14 | +{ |
| 15 | + public partial class MudPage : MudComponentBase |
| 16 | + { |
| 17 | + protected string Classname => |
| 18 | + new CssBuilder("mud-page") |
| 19 | + .AddClass($"mud-page-column-{Column.ToString()}") |
| 20 | + .AddClass($"mud-page-row-{Row.ToString()}") |
| 21 | + .AddClass($"mud-page-height-{FullScreen.ToDescriptionString()}") |
| 22 | + .AddClass(Class) |
| 23 | + .Build(); |
| 24 | + |
| 25 | + protected string Stylename => |
| 26 | + new StyleBuilder() |
| 27 | + .AddStyle("height", $"{Height}", !String.IsNullOrEmpty(Height)) |
| 28 | + .AddStyle(Style) |
| 29 | + .Build(); |
| 30 | + |
| 31 | + [Parameter] |
| 32 | + [Category(CategoryTypes.Item.Appearance)] |
| 33 | + public RenderFragment ChildContent { get; set; } |
| 34 | + |
| 35 | + [Parameter] |
| 36 | + [Category(CategoryTypes.Item.Appearance)] |
| 37 | + public int Column { get; set; } = 4; |
| 38 | + |
| 39 | + [Parameter] |
| 40 | + [Category(CategoryTypes.Item.Appearance)] |
| 41 | + public int Row { get; set; } = 4; |
| 42 | + |
| 43 | + [Parameter] |
| 44 | + [Category(CategoryTypes.Item.Appearance)] |
| 45 | + public FullScreen FullScreen { get; set; } = FullScreen.None; |
| 46 | + |
| 47 | + [Parameter] |
| 48 | + [Category(CategoryTypes.Item.Appearance)] |
| 49 | + public string Height { get; set; } |
| 50 | + |
| 51 | + [Parameter] |
| 52 | + [Category(CategoryTypes.Item.Behavior)] |
| 53 | + public EventCallback<MouseEventArgs> OnClick { get; set; } |
| 54 | + |
| 55 | + [Parameter] |
| 56 | + [Category(CategoryTypes.Item.Behavior)] |
| 57 | + public bool OnClickStopPropagation { get; set; } |
| 58 | + |
| 59 | + [Parameter] |
| 60 | + [Category(CategoryTypes.Item.Behavior)] |
| 61 | + public EventCallback OnContextMenu { get; set; } |
| 62 | + |
| 63 | + [Parameter] |
| 64 | + [Category(CategoryTypes.Item.Behavior)] |
| 65 | + public bool OnContextMenuPreventDefault { get; set; } |
| 66 | + |
| 67 | + [Parameter] |
| 68 | + [Category(CategoryTypes.Item.Behavior)] |
| 69 | + public bool OnContextMenuStopPropagation { get; set; } |
| 70 | + |
| 71 | + protected async Task OnClickHandler(MouseEventArgs ev) |
| 72 | + { |
| 73 | + await OnClick.InvokeAsync(ev); |
| 74 | + } |
| 75 | + } |
| 76 | +} |
0 commit comments