diff --git a/src/BootstrapBlazor.Shared/Samples/Modals.razor b/src/BootstrapBlazor.Shared/Samples/Modals.razor index fc23a365a6002ebc5a1d9a3400a29bce2c50e257..5c4bb443ad9fb8f497169a91befcf61d4347bbd0 100644 --- a/src/BootstrapBlazor.Shared/Samples/Modals.razor +++ b/src/BootstrapBlazor.Shared/Samples/Modals.razor @@ -78,6 +78,41 @@ + +
+
+ + + + +
我是弹窗内正文
+
+
+
+
+
+ + + + +
我是弹窗内正文
+
+
+
+
+
+ + + + +
我是弹窗内正文
+
+
+
+
+
+
+ diff --git a/src/BootstrapBlazor.Shared/Samples/Modals.razor.cs b/src/BootstrapBlazor.Shared/Samples/Modals.razor.cs index 0df250b971fd1489ada490659d59a4c8c9da76e2..a1dc4f2f7987a3bf92fbf1e67968b7778b4f9225 100644 --- a/src/BootstrapBlazor.Shared/Samples/Modals.razor.cs +++ b/src/BootstrapBlazor.Shared/Samples/Modals.razor.cs @@ -29,6 +29,15 @@ public sealed partial class Modals [NotNull] private Modal? ExtraLargeModal { get; set; } + [NotNull] + private Modal? SmailFullScreenModal { get; set; } + + [NotNull] + private Modal? LargeFullScreenModal { get; set; } + + [NotNull] + private Modal? ExtraLargeFullScreenModal { get; set; } + [NotNull] private Modal? CenterModal { get; set; } @@ -52,108 +61,112 @@ public sealed partial class Modals /// /// /// - private static IEnumerable GetAttributes() + private static IEnumerable GetAttributes() => new AttributeItem[] { - return new AttributeItem[] - { - new AttributeItem() { - Name = "HeaderTemplate", - Description = "模态主体 ModalHeader 模板", - Type = "RenderFragment", - ValueList = " — ", - DefaultValue = " — " - }, - new AttributeItem() { - Name = "BodyTemplate", - Description = "模态主体 ModalBody 组件", - Type = "RenderFragment", - ValueList = " — ", - DefaultValue = " — " - }, - new AttributeItem() { - Name = "ChildContent", - Description = "内容", - Type = "RenderFragment", - ValueList = " — ", - DefaultValue = " — " - }, - new AttributeItem() { - Name = "FooterTemplate", - Description = "模态底部 ModalFooter 组件", - Type = "RenderFragment", - ValueList = " — ", - DefaultValue = " — " - }, - new AttributeItem() { - Name = "IsBackdrop", - Description = "是否后台关闭弹窗", - Type = "boolean", - ValueList = " — ", - DefaultValue = "false" - }, - new AttributeItem() { - Name = "IsKeyboard", - Description = "是否响应 ESC 键盘", - Type = "boolean", - ValueList = " — ", - DefaultValue = "true" - }, - new AttributeItem() { - Name = "IsCentered", - Description = "是否垂直居中", - Type = "boolean", - ValueList = " — ", - DefaultValue = "true" - }, - new AttributeItem() { - Name = "IsScrolling", - Description = "是否弹窗正文超长时滚动", - Type = "boolean", - ValueList = " — ", - DefaultValue = "false" - }, - new AttributeItem() { - Name = "IsFade", - Description = "是否开启淡入淡出动画效果", - Type = "boolean", - ValueList = " — ", - DefaultValue = "true" - }, - new AttributeItem() { - Name = "IsDraggable", - Description = "是否开启可拖拽效果", - Type = "boolean", - ValueList = " — ", - DefaultValue = "false" - }, - new AttributeItem() { - Name = "ShowCloseButton", - Description = "是否显示关闭按钮", - Type = "boolean", - ValueList = " — ", - DefaultValue = "true" - }, - new AttributeItem() { - Name = "ShowFooter", - Description = "是否显示 Footer", - Type = "boolean", - ValueList = " — ", - DefaultValue = "true" - }, - new AttributeItem() { - Name = "Size", - Description = "尺寸", - Type = "Size", - ValueList = "None / ExtraSmall / Small / Medium / Large / ExtraLarge", - DefaultValue = "Large" - }, - new AttributeItem() { - Name = "Title", - Description = "弹窗标题", - Type = "string", - ValueList = " — ", - DefaultValue = " 未设置 " - }, - }; - } + new AttributeItem() { + Name = "HeaderTemplate", + Description = "模态主体 ModalHeader 模板", + Type = "RenderFragment", + ValueList = " — ", + DefaultValue = " — " + }, + new AttributeItem() { + Name = "BodyTemplate", + Description = "模态主体 ModalBody 组件", + Type = "RenderFragment", + ValueList = " — ", + DefaultValue = " — " + }, + new AttributeItem() { + Name = "ChildContent", + Description = "内容", + Type = "RenderFragment", + ValueList = " — ", + DefaultValue = " — " + }, + new AttributeItem() { + Name = "FooterTemplate", + Description = "模态底部 ModalFooter 组件", + Type = "RenderFragment", + ValueList = " — ", + DefaultValue = " — " + }, + new AttributeItem() { + Name = "IsBackdrop", + Description = "是否后台关闭弹窗", + Type = "boolean", + ValueList = " — ", + DefaultValue = "false" + }, + new AttributeItem() { + Name = "IsKeyboard", + Description = "是否响应 ESC 键盘", + Type = "boolean", + ValueList = " — ", + DefaultValue = "true" + }, + new AttributeItem() { + Name = "IsCentered", + Description = "是否垂直居中", + Type = "boolean", + ValueList = " — ", + DefaultValue = "true" + }, + new AttributeItem() { + Name = "IsScrolling", + Description = "是否弹窗正文超长时滚动", + Type = "boolean", + ValueList = " — ", + DefaultValue = "false" + }, + new AttributeItem() { + Name = "IsFade", + Description = "是否开启淡入淡出动画效果", + Type = "boolean", + ValueList = " — ", + DefaultValue = "true" + }, + new AttributeItem() { + Name = "IsDraggable", + Description = "是否开启可拖拽效果", + Type = "boolean", + ValueList = " — ", + DefaultValue = "false" + }, + new AttributeItem() { + Name = "ShowCloseButton", + Description = "是否显示关闭按钮", + Type = "boolean", + ValueList = " — ", + DefaultValue = "true" + }, + new AttributeItem() { + Name = "ShowFooter", + Description = "是否显示 Footer", + Type = "boolean", + ValueList = " — ", + DefaultValue = "true" + }, + new AttributeItem() { + Name = "Size", + Description = "尺寸", + Type = "Size", + ValueList = "None / ExtraSmall / Small / Medium / Large / ExtraLarge", + DefaultValue = "Large" + }, + new AttributeItem() { + Name = nameof(ModalDialog.FullScreenSize), + Description = "小于特定尺寸时全屏", + Type = "Size", + ValueList = "None / Always / ExtraSmall / Small / Medium / Large / ExtraLarge", + DefaultValue = "None" + }, + new AttributeItem() { + Name = "Title", + Description = "弹窗标题", + Type = "string", + ValueList = " — ", + DefaultValue = " 未设置 " + }, + }; } diff --git a/src/BootstrapBlazor/Components/Modal/ModalDialog.razor.cs b/src/BootstrapBlazor/Components/Modal/ModalDialog.razor.cs index 95f182eeb0ae873cf8b4fa25041de45d179f8336..404b286a125ab922d4ba7ffd57e251aba8b79897 100644 --- a/src/BootstrapBlazor/Components/Modal/ModalDialog.razor.cs +++ b/src/BootstrapBlazor/Components/Modal/ModalDialog.razor.cs @@ -27,6 +27,7 @@ public partial class ModalDialog : IDisposable private string? ClassName => CssBuilder.Default("modal-dialog") .AddClass("modal-dialog-centered", IsCentered) .AddClass($"modal-{Size.ToDescriptionString()}", Size != Size.None) + .AddClass($"modal-{FullScreenSize.ToDescriptionString()}", FullScreenSize != FullScreenSize.None) .AddClass("modal-dialog-scrollable", IsScrolling) .AddClass("is-draggable", IsDraggable) .AddClass("d-none", !IsShown) @@ -56,6 +57,12 @@ public partial class ModalDialog : IDisposable [Parameter] public Size Size { get; set; } = Size.Large; + /// + /// 获得/设置 弹窗大小 + /// + [Parameter] + public FullScreenSize FullScreenSize { get; set; } = FullScreenSize.Large; + /// /// 获得/设置 是否垂直居中 默认为 true /// diff --git a/src/BootstrapBlazor/Enums/FullScreenSize.cs b/src/BootstrapBlazor/Enums/FullScreenSize.cs new file mode 100644 index 0000000000000000000000000000000000000000..5a30a50ecac4a6fdfb9087a13b94097648ef8fc0 --- /dev/null +++ b/src/BootstrapBlazor/Enums/FullScreenSize.cs @@ -0,0 +1,54 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Website: https://www.blazor.zone or https://argozhang.github.io/ + +using System.ComponentModel; + +namespace BootstrapBlazor.Components; + +/// +/// Size 枚举类型 +/// +public enum FullScreenSize +{ + /// + /// 无设置 + /// + None, + + /// + /// 始终全屏 + /// + [Description("fullscreen")] + Always, + + /// + /// sm 小设置小于 576px + /// + [Description("ssm-down")] + Small, + + /// + /// md 中等设置小于 768px + /// + [Description("fullscreen-md-down")] + Medium, + + /// + /// lg 大设置小于 992px + /// + [Description("fullscreen-lg-down")] + Large, + + /// + /// xl 超大设置小于 1200px + /// + [Description("fullscreen-xl-down")] + ExtraLarge, + + /// + /// xl 超大设置小于 1400px + /// + [Description("fullscreen-xxl-down")] + ExtraExtraLarge +}