Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/BootstrapBlazor.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>10.3.1-beta04</Version>
<Version>10.3.1-beta05</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
90 changes: 44 additions & 46 deletions src/BootstrapBlazor/Components/Dialog/DialogOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,244 +6,242 @@
namespace BootstrapBlazor.Components;

/// <summary>
/// <para lang="zh">Configuration class for the Dialog component</para>
/// <para lang="en">Configuration class for the Dialog component</para>
/// <para lang="zh">Dialog 对话框组件</para>
/// <para lang="en">Dialog component</para>
/// </summary>
public class DialogOption
{
/// <summary>
/// <para lang="zh">获得/设置 the related modal 实例</para>
/// <para lang="zh">获得/设置 关联的 Modal 实例</para>
/// <para lang="en">Gets or sets the related modal instance</para>
/// </summary>
internal Modal? Modal { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 the dialog title</para>
/// <para lang="zh">获得/设置 对话框标题</para>
/// <para lang="en">Gets or sets the dialog title</para>
/// </summary>
public string? Title { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 the custom 样式 of the dialog</para>
/// <para lang="zh">获得/设置 对话框自定义样式</para>
/// <para lang="en">Gets or sets the custom style of the dialog</para>
/// </summary>
public string? Class { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 the size of the dialog</para>
/// <para lang="zh">获得/设置 对话框尺寸</para>
/// <para lang="en">Gets or sets the size of the dialog</para>
/// </summary>
public Size Size { get; set; } = Size.ExtraExtraLarge;

/// <summary>
/// <para lang="zh">获得/设置 the full screen size of the dialog, default is None</para>
/// <para lang="zh">获得/设置 对话框全屏尺寸 默认值为 None</para>
/// <para lang="en">Gets or sets the full screen size of the dialog, default is None</para>
/// </summary>
/// <remarks>To ensure functionality, when this value is set, <see cref="ShowMaximizeButton"/>, <seealso cref="ShowResize"/>, and <seealso cref="IsDraggable"/> are not available</remarks>
public FullScreenSize FullScreenSize { get; set; } = FullScreenSize.None;

/// <summary>
/// <para lang="zh">获得/设置 是否 to show the maximize 按钮, default is false</para>
/// <para lang="zh">获得/设置 是否显示最大化按钮 默认值为 false</para>
/// <para lang="en">Gets or sets whether to show the maximize button, default is false</para>
/// </summary>
/// <remarks>To ensure functionality, when this value is set to true, <seealso cref="ShowResize"/> and <seealso cref="IsDraggable"/> are not available</remarks>
public bool ShowMaximizeButton { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 是否 the dialog is vertically centered, default is true</para>
/// <para lang="zh">获得/设置 是否垂直居中 默认值为 true</para>
/// <para lang="en">Gets or sets whether the dialog is vertically centered, default is true</para>
/// </summary>
public bool IsCentered { get; set; } = true;

/// <summary>
/// <para lang="zh">获得/设置 是否 the dialog 内容 scrolls when it is too long, default is false</para>
/// <para lang="zh">获得/设置 内容过长时是否滚动 默认值为 false</para>
/// <para lang="en">Gets or sets whether the dialog content scrolls when it is too long, default is false</para>
/// </summary>
public bool IsScrolling { get; set; } = false;

/// <summary>
/// <para lang="zh">获得/设置 是否 to show the resize 按钮, default is false</para>
/// <para lang="zh">获得/设置 是否显示调整大小按钮 默认值为 false</para>
/// <para lang="en">Gets or sets whether to show the resize button, default is false</para>
/// </summary>
public bool ShowResize { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 是否 to show the close 按钮, default is true</para>
/// <para lang="zh">获得/设置 是否显示关闭按钮 默认值为 true</para>
/// <para lang="en">Gets or sets whether to show the close button, default is true</para>
/// </summary>
public bool ShowCloseButton { get; set; } = true;

/// <summary>
/// <para lang="zh">获得/设置 是否 to show the header close 按钮, default is true</para>
/// <para lang="zh">获得/设置 是否显示标题栏关闭按钮 默认值为 true</para>
/// <para lang="en">Gets or sets whether to show the header close button, default is true</para>
/// </summary>
public bool ShowHeaderCloseButton { get; set; } = true;

/// <summary>
/// <para lang="zh">获得/设置 是否 to enable fade animation, default is null</para>
/// <para lang="zh">获得/设置 是否启用渐显动画 默认值为 null</para>
/// <para lang="en">Gets or sets whether to enable fade animation, default is null</para>
/// </summary>
public bool? IsFade { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 是否 to support closing the dialog with the ESC key, default is true</para>
/// <para lang="zh">获得/设置 是否支持通过 ESC 关闭对话框 默认值为 true</para>
/// <para lang="en">Gets or sets whether to support closing the dialog with the ESC key, default is true</para>
/// </summary>
public bool IsKeyboard { get; set; } = true;

/// <summary>
/// <para lang="zh">获得/设置 是否 to support closing the dialog by clicking the backdrop, default is false</para>
/// <para lang="zh">获得/设置 是否支持点击背景关闭对话框 默认值为 false</para>
/// <para lang="en">Gets or sets whether to support closing the dialog by clicking the backdrop, default is false</para>
/// </summary>
public bool IsBackdrop { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 是否 to show the footer, default is true</para>
/// <para lang="zh">获得/设置 是否显示页脚 默认值为 true</para>
/// <para lang="en">Gets or sets whether to show the footer, default is true</para>
/// </summary>
public bool ShowFooter { get; set; } = true;

/// <summary>
/// <para lang="zh">获得/设置 是否 to show the print 按钮, default is false</para>
/// <para lang="zh">获得/设置 是否显示打印按钮 默认值为 false</para>
/// <para lang="en">Gets or sets whether to show the print button, default is false</para>
/// </summary>
public bool ShowPrintButton { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 是否 to show the save 按钮, default is false</para>
/// <para lang="zh">获得/设置 是否显示保存按钮 默认值为 false</para>
/// <para lang="en">Gets or sets whether to show the save button, default is false</para>
/// </summary>
public bool ShowSaveButton { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 是否 to show the print 按钮 in the header, default is false</para>
/// <para lang="zh">获得/设置 是否在标题栏显示打印按钮 默认值为 false</para>
/// <para lang="en">Gets or sets whether to show the print button in the header, default is false</para>
/// </summary>
public bool ShowPrintButtonInHeader { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 the text of the print 按钮 in the header, default is "Print" from the resource file</para>
/// <para lang="zh">获得/设置 标题栏打印按钮文本 默认值为资源文件中的 "Print"</para>
/// <para lang="en">Gets or sets the text of the print button in the header, default is "Print" from the resource file</para>
/// </summary>
public string? PrintButtonText { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 the related 数据, mostly used for passing values</para>
/// <para lang="zh">获得/设置 关联数据多用于传值</para>
/// <para lang="en">Gets or sets the related data, mostly used for passing values</para>
/// </summary>
public object? BodyContext { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 the ModalBody component</para>
/// <para lang="zh">获得/设置 ModalBody 组件</para>
/// <para lang="en">Gets or sets the ModalBody component</para>
/// </summary>
public RenderFragment? BodyTemplate { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 the ModalFooter component</para>
/// <para lang="zh">获得/设置 ModalFooter 组件</para>
/// <para lang="en">Gets or sets the ModalFooter component</para>
/// </summary>
public RenderFragment? FooterTemplate { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 the ModalHeader component 模板</para>
/// <para lang="zh">获得/设置 ModalHeader 组件模板</para>
/// <para lang="en">Gets or sets the ModalHeader component template</para>
/// </summary>
public RenderFragment? HeaderTemplate { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 the custom 按钮s in the ModalHeader component</para>
/// <para lang="zh">获得/设置 ModalHeader 组件自定义按钮</para>
/// <para lang="en">Gets or sets the custom buttons in the ModalHeader component</para>
/// </summary>
public RenderFragment? HeaderToolbarTemplate { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 the custom component</para>
/// <para lang="zh">获得/设置 自定义组件</para>
/// <para lang="en">Gets or sets the custom component</para>
/// </summary>
public BootstrapDynamicComponent? Component { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 the 图标 of the save 按钮, default is null and uses the current theme 图标</para>
/// <para lang="zh">获得/设置 保存按钮图标 默认值为 null 且使用当前主题图标</para>
/// <para lang="en">Gets or sets the icon of the save button, default is null and uses the current theme icon</para>
/// </summary>
public string? SaveButtonIcon { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 the text of the save 按钮</para>
/// <para lang="zh">获得/设置 保存按钮文本</para>
/// <para lang="en">Gets or sets the text of the save button</para>
/// </summary>
public string? SaveButtonText { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 the 回调方法 for the save 按钮</para>
/// <para lang="zh">获得/设置 保存按钮回调方法</para>
/// <para lang="en">Gets or sets the callback method for the save button</para>
/// </summary>
public Func<Task<bool>>? OnSaveAsync { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 the 图标 of the close 按钮, default is null and uses the current theme 图标</para>
/// <para lang="zh">获得/设置 关闭按钮图标 默认值为 null 且使用当前主题图标</para>
/// <para lang="en">Gets or sets the icon of the close button, default is null and uses the current theme icon</para>
/// </summary>
public string? CloseButtonIcon { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 the text of the close 按钮</para>
/// <para lang="zh">获得/设置 关闭按钮文本</para>
/// <para lang="en">Gets or sets the text of the close button</para>
/// </summary>
public string? CloseButtonText { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 the 回调方法 for closing the dialog</para>
/// <para lang="zh">获得/设置 关闭对话框回调方法</para>
/// <para lang="en">Gets or sets the callback method for closing the dialog</para>
/// </summary>
public Func<Task>? OnCloseAsync { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 是否 to automatically close the dialog after saving successfully, default is true</para>
/// <para lang="zh">获得/设置 是否自动关闭对话框(保存成功后) 默认值为 true</para>
/// <para lang="en">Gets or sets whether to automatically close the dialog after saving successfully, default is true</para>
/// </summary>
public bool IsAutoCloseAfterSave { get; set; } = true;

/// <summary>
/// <para lang="zh">获得/设置 是否 the dialog can be dragged, default is false</para>
/// <para lang="zh">获得/设置 是否允许拖拽对话框 默认值为 false</para>
/// <para lang="en">Gets or sets whether the dialog can be dragged, default is false</para>
/// </summary>
public bool IsDraggable { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 the 回调方法 when the dialog is shown</para>
/// <para lang="zh">获得/设置 对话框显示回调方法</para>
/// <para lang="en">Gets or sets the callback method when the dialog is shown</para>
/// </summary>
public Func<Task>? OnShownAsync { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 是否 to show the export PDF 按钮, default is false</para>
/// <para lang="zh">获得/设置 是否显示导出 PDF 按钮 默认值为 false</para>
/// <para lang="en">Gets or sets whether to show the export PDF button, default is false</para>
/// </summary>
public bool ShowExportPdfButton { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 是否 to show the export PDF 按钮 in the header, default is false</para>
/// <para lang="zh">获得/设置 是否在标题栏显示导出 PDF 按钮 默认值为 false</para>
/// <para lang="en">Gets or sets whether to show the export PDF button in the header, default is false</para>
/// </summary>
public bool ShowExportPdfButtonInHeader { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 the configuration options for the export PDF 按钮</para>
/// <para lang="zh">获得/设置 导出 PDF 按钮配置</para>
/// <para lang="en">Gets or sets the configuration options for the export PDF button</para>
/// </summary>
public ExportPdfButtonOptions? ExportPdfButtonOptions { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 是否 to hide the previous dialog when opening a new one, default is false</para>
/// <para lang="zh">获得/设置 是否隐藏上一个对话框 默认值为 false</para>
/// <para lang="en">Gets or sets whether to hide the previous dialog when opening a new one, default is false</para>
/// </summary>
public bool IsHidePreviousDialog { get; set; }

/// <summary>
/// <para lang="zh">Method to close the dialog</para>
/// <para lang="en">Method to close the dialog</para>
/// <para lang="zh">关闭对话框方法</para>
/// <para lang="en">Closes the dialog</para>
/// </summary>
public async Task CloseDialogAsync()
{
Expand All @@ -254,8 +252,8 @@ public async Task CloseDialogAsync()
}

/// <summary>
/// <para lang="zh">Method to convert parameters to component attributes</para>
/// <para lang="en">Method to convert parameters to component attributes</para>
/// <para lang="zh">将参数转换为组件特性</para>
/// <para lang="en">Converts parameters to component attributes</para>
/// </summary>
public Dictionary<string, object> ToAttributes()
{
Expand Down
10 changes: 6 additions & 4 deletions src/BootstrapBlazor/Components/Dialog/EditDialog.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
@inherits DialogBase<TModel>
@attribute [BootstrapModuleAutoLoader("Dialog/EditDialog.razor.js", AutoInvokeInit = false, AutoInvokeDispose = false)]

<ValidateForm Model="@Model" OnValidSubmit="@OnValidSubmitAsync" DisableAutoSubmitFormByEnter="@DisableAutoSubmitFormByEnter">
<ValidateForm Model="@Model" OnValidSubmit="@OnValidSubmitAsync" LabelWidth="@LabelWidth"
DisableAutoSubmitFormByEnter="@DisableAutoSubmitFormByEnter">
<CascadingValue Value="ItemChangedType" IsFixed="true">
@if (BodyTemplate != null)
{
Expand All @@ -16,9 +17,10 @@
}
else
{
<EditorForm TModel="TModel" Items="Items" ItemChangedType="ItemChangedType" ItemsPerRow="ItemsPerRow" RowType="RowType"
LabelAlign="LabelAlign" ShowLabel="ShowLabel" ShowUnsetGroupItemsOnTop="ShowUnsetGroupItemsOnTop"
IsRenderWhenValueChanged="true">
<EditorForm TModel="TModel" Items="Items" ItemChangedType="ItemChangedType"
ItemsPerRow="ItemsPerRow" RowType="RowType"
LabelAlign="LabelAlign" ShowLabel="ShowLabel"
ShowUnsetGroupItemsOnTop="ShowUnsetGroupItemsOnTop" IsRenderWhenValueChanged="true">
<Buttons>
@RenderFooter
</Buttons>
Expand Down
9 changes: 7 additions & 2 deletions src/BootstrapBlazor/Components/Dialog/EditDialog.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ public partial class EditDialog<TModel>
/// <para lang="en">Gets or sets Save Callback Delegate. Return false to keep edit dialog, true to close it</para>
/// </summary>
[Parameter]
#if NET6_0_OR_GREATER
[EditorRequired]
#endif
public Func<EditContext, Task<bool>>? OnSaveAsync { get; set; }

/// <summary>
Expand Down Expand Up @@ -87,6 +85,13 @@ public partial class EditDialog<TModel>
[Parameter]
public bool? DisableAutoSubmitFormByEnter { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 标签宽度 默认为 120 </para>
/// <para lang="en">Gets or sets Label Width. Default is 120</para>
/// </summary>
[Parameter]
public int? LabelWidth { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 DialogFooterTemplate 实例</para>
/// <para lang="en">Gets or sets DialogFooterTemplate Instance</para>
Expand Down
Loading