diff --git a/src/BootstrapBlazor.Shared/Samples/Dialogs.razor b/src/BootstrapBlazor.Shared/Samples/Dialogs.razor index 6923657242c6faba066628a8ada39946be4ed29d..ff8f6c17a141e6e9de95079c75d197dac00b82d5 100644 --- a/src/BootstrapBlazor.Shared/Samples/Dialogs.razor +++ b/src/BootstrapBlazor.Shared/Samples/Dialogs.razor @@ -100,6 +100,10 @@ + + + +

通过设置 @nameof(DialogOption.PrintButtonText) 更改 打印预览 按钮文字

diff --git a/src/BootstrapBlazor.Shared/Samples/Dialogs.razor.cs b/src/BootstrapBlazor.Shared/Samples/Dialogs.razor.cs index db273d3f1c457ec86f1fc00bda4eaf0ea5ed8d6f..373fc65b0a9e415593b8195aea24e4c6f36098b2 100644 --- a/src/BootstrapBlazor.Shared/Samples/Dialogs.razor.cs +++ b/src/BootstrapBlazor.Shared/Samples/Dialogs.razor.cs @@ -164,6 +164,13 @@ public sealed partial class Dialogs Trace.Log($"弹窗返回值为: {result} 组件返回值为: {DemoValue1}"); } + private Task OnSizeDialogClick() => DialogService.Show(new DialogOption() + { + Title = "全屏窗口", + FullScreenSize = FullScreenSize.ExtraLarge, + BodyTemplate = builder => builder.AddContent(0, "屏幕小于 1200px 时全屏显示") + }); + private async Task OnPrintDialogClick() { var op = new DialogOption() @@ -221,115 +228,119 @@ public sealed partial class Dialogs /// 获得属性方法 /// /// - private static IEnumerable GetAttributes() + private static IEnumerable GetAttributes() => new AttributeItem[] { - return new AttributeItem[] - { - new AttributeItem() { - Name = "Component", - Description = "对话框 Body 中引用的组件的参数", - Type = "DynamicComponent", - ValueList = " — ", - DefaultValue = " — " - }, - new AttributeItem() { - Name = "BodyContext", - Description = "弹窗传参", - Type = "object", - 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 = "FooterTemplate", - Description = "模态底部 ModalFooter 组件", - Type = "RenderFragment", - ValueList = " — ", - DefaultValue = " — " - }, - new AttributeItem() { - Name = "IsCentered", - Description = "是否垂直居中", - Type = "boolean", - ValueList = "true|false", - DefaultValue = "true" - }, - new AttributeItem() { - Name = "IsScrolling", - Description = "是否弹窗正文超长时滚动", - Type = "boolean", - ValueList = "true|false", - DefaultValue = "false" - }, - new AttributeItem() { - Name = "ShowCloseButton", - Description = "是否显示关闭按钮", - Type = "boolean", - ValueList = "true|false", - DefaultValue = "true" - }, - new AttributeItem() { - Name = "ShowHeaderCloseButton", - Description = "是否显示标题栏右侧关闭按钮", - Type = "boolean", - ValueList = "true|false", - DefaultValue = "true" - }, - new AttributeItem() { - Name = "ShowFooter", - Description = "是否显示 Footer", - Type = "boolean", - ValueList = "true|false", - DefaultValue = "true" - }, - new AttributeItem() { - Name = nameof(DialogOption.ShowPrintButton), - Description = "是否显示打印按钮", - Type = "boolean", - ValueList = "true|false", - DefaultValue = "false" - }, - new AttributeItem() { - Name = nameof(DialogOption.ShowPrintButtonInHeader), - Description = "打印按钮是否显示在 Header 中", - Type = "boolean", - ValueList = "true|false", - DefaultValue = "false" - }, - 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 = nameof(DialogOption.PrintButtonText), - Description = "打印按钮显示文字", - Type = "string", - ValueList = " — ", - DefaultValue = "资源文件中设定值" - } - }; - } + new AttributeItem() { + Name = "Component", + Description = "对话框 Body 中引用的组件的参数", + Type = "DynamicComponent", + ValueList = " — ", + DefaultValue = " — " + }, + new AttributeItem() { + Name = "BodyContext", + Description = "弹窗传参", + Type = "object", + 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 = "FooterTemplate", + Description = "模态底部 ModalFooter 组件", + Type = "RenderFragment", + ValueList = " — ", + DefaultValue = " — " + }, + new AttributeItem() { + Name = "IsCentered", + Description = "是否垂直居中", + Type = "boolean", + ValueList = "true|false", + DefaultValue = "true" + }, + new AttributeItem() { + Name = "IsScrolling", + Description = "是否弹窗正文超长时滚动", + Type = "boolean", + ValueList = "true|false", + DefaultValue = "false" + }, + new AttributeItem() { + Name = "ShowCloseButton", + Description = "是否显示关闭按钮", + Type = "boolean", + ValueList = "true|false", + DefaultValue = "true" + }, + new AttributeItem() { + Name = "ShowHeaderCloseButton", + Description = "是否显示标题栏右侧关闭按钮", + Type = "boolean", + ValueList = "true|false", + DefaultValue = "true" + }, + new AttributeItem() { + Name = "ShowFooter", + Description = "是否显示 Footer", + Type = "boolean", + ValueList = "true|false", + DefaultValue = "true" + }, + new AttributeItem() { + Name = nameof(DialogOption.ShowPrintButton), + Description = "是否显示打印按钮", + Type = "boolean", + ValueList = "true|false", + DefaultValue = "false" + }, + new AttributeItem() { + Name = nameof(DialogOption.ShowPrintButtonInHeader), + Description = "打印按钮是否显示在 Header 中", + Type = "boolean", + ValueList = "true|false", + DefaultValue = "false" + }, + new AttributeItem() { + Name = "Size", + Description = "尺寸", + Type = "Size", + ValueList = "None / ExtraSmall / Small / Medium / Large / ExtraLarge", + DefaultValue = "Large" + }, + new AttributeItem() { + Name = nameof(DialogOption.FullScreenSize), + Description = "小于特定尺寸时全屏", + Type = "Size", + ValueList = "None / Always / Small / Medium / Large / ExtraLarge", + DefaultValue = "None" + }, + new AttributeItem() { + Name = "Title", + Description = "弹窗标题", + Type = "string", + ValueList = " — ", + DefaultValue = " 未设置 " + }, + new AttributeItem() { + Name = nameof(DialogOption.PrintButtonText), + Description = "打印按钮显示文字", + Type = "string", + ValueList = " — ", + DefaultValue = "资源文件中设定值" + } + }; } diff --git a/src/BootstrapBlazor.Shared/Samples/Modals.razor.cs b/src/BootstrapBlazor.Shared/Samples/Modals.razor.cs index a1dc4f2f7987a3bf92fbf1e67968b7778b4f9225..75f29a5f2b31866926351951411d18bf3a17b17e 100644 --- a/src/BootstrapBlazor.Shared/Samples/Modals.razor.cs +++ b/src/BootstrapBlazor.Shared/Samples/Modals.razor.cs @@ -158,7 +158,7 @@ public sealed partial class Modals Name = nameof(ModalDialog.FullScreenSize), Description = "小于特定尺寸时全屏", Type = "Size", - ValueList = "None / Always / ExtraSmall / Small / Medium / Large / ExtraLarge", + ValueList = "None / Always / Small / Medium / Large / ExtraLarge", DefaultValue = "None" }, new AttributeItem() { diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index be41c7a41420c9a2d1fb26bb5b23f2d1cb8c6459..e6705b0b7f34ce3c769284a9fe70602d71a65d91 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@ - 6.2.7-beta08 + 6.2.7-beta09 diff --git a/src/BootstrapBlazor/Components/Dialog/DialogOption.cs b/src/BootstrapBlazor/Components/Dialog/DialogOption.cs index 025f1dfb769a1984408f3ed9b8a16152d778ff65..36e495ec34d29b7b16c7c64ec8e4176b1e3c512a 100644 --- a/src/BootstrapBlazor/Components/Dialog/DialogOption.cs +++ b/src/BootstrapBlazor/Components/Dialog/DialogOption.cs @@ -36,6 +36,11 @@ public class DialogOption /// public Size Size { get; set; } = Size.Large; + /// + /// 获得/设置 全屏弹窗 默认 None + /// + public FullScreenSize FullScreenSize { get; set; } = FullScreenSize.None; + /// /// 获得/设置 是否垂直居中 默认为 true /// @@ -140,6 +145,7 @@ public class DialogOption var ret = new Dictionary { [nameof(Size)] = Size, + [nameof(FullScreenSize)] = FullScreenSize, [nameof(IsCentered)] = IsCentered, [nameof(IsScrolling)] = IsScrolling, [nameof(ShowCloseButton)] = ShowCloseButton,