From 8bdebb032e82b92ea6d76df0a6e477d48fbf9ecb Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Wed, 12 Mar 2025 08:52:45 +0800 Subject: [PATCH 1/6] =?UTF-8?q?refactor:=20=E6=96=87=E6=A1=A3=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E6=9B=B4=E6=94=B9=E4=B8=BA=E8=8B=B1=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/EditorForm/IEditorItem.cs | 52 ++++++------- .../Components/Table/ITableColumn.cs | 76 +++++++++---------- 2 files changed, 64 insertions(+), 64 deletions(-) diff --git a/src/BootstrapBlazor/Components/EditorForm/IEditorItem.cs b/src/BootstrapBlazor/Components/EditorForm/IEditorItem.cs index 6e42f58ddb3..8c6d790b509 100644 --- a/src/BootstrapBlazor/Components/EditorForm/IEditorItem.cs +++ b/src/BootstrapBlazor/Components/EditorForm/IEditorItem.cs @@ -6,128 +6,128 @@ namespace BootstrapBlazor.Components; /// -/// IEditorItem 接口 +/// IEditorItem interface /// public interface IEditorItem : ILookup { /// - /// 获得/设置 绑定列类型 + /// Gets or sets the type of the bound column. /// Type PropertyType { get; } /// - /// 获得/设置 当前编辑项是否可编辑 默认为 true + /// Gets or sets whether the current edit item is editable. Default is true. /// - [Obsolete("已弃用,是否显示使用 Visible 参数,新建时使用 IsVisibleWhenAdd 编辑时使用 IsVisibleWhenEdit 只读使用 Readonly 参数,新建时使用 IsReadonlyWhenAdd 编辑时使用 IsReadonlyWhenEdit 参数; Deprecated use Visible parameter. IsVisibleWhenAdd should be used when creating a new one, and IsVisibleWhenEdit should be used when editing")] + [Obsolete("Deprecated. Use the Visible parameter. IsVisibleWhenAdd should be used when creating a new one, and IsVisibleWhenEdit should be used when editing. Use the Readonly parameter for read-only. IsReadonlyWhenAdd should be used when creating a new one, and IsReadonlyWhenEdit should be used when editing.")] bool Editable { get; set; } /// - /// 获得/设置 当前编辑项是否只读 默认为 false + /// Gets or sets whether the current edit item is read-only. Default is false. /// bool? Readonly { get; set; } /// - /// 获得/设置 当前编辑项是否忽略 默认为 false 当设置为 true 时 UI 不生成此列 + /// Gets or sets whether the current edit item is ignored. Default is false. When set to true, the UI will not generate this column. /// bool? Ignore { get; set; } /// - /// 获得/设置 是否不进行验证 默认为 false + /// Gets or sets whether to skip validation. Default is false. /// bool SkipValidate { get; set; } /// - /// 获得/设置 表头显示文字 + /// Gets or sets the header display text. /// string? Text { get; set; } /// - /// 获得/设置 是否显示标签 Tooltip 多用于标签文字过长导致裁减时使用 默认 null + /// Gets or sets whether to show label tooltip. Mostly used when the label text is too long and gets truncated. Default is null. /// bool? ShowLabelTooltip { get; set; } /// - /// 获得/设置 placeholder 文本 默认为 null + /// Gets or sets the placeholder text. Default is null. /// string? PlaceHolder { get; set; } /// - /// 获得/设置 额外数据源一般用于 Select 或者 CheckboxList 这种需要额外配置数据源组件使用 + /// Gets or sets the additional data source, generally used for components like Select or CheckboxList that require additional configuration. /// IEnumerable? Items { get; set; } /// - /// 获得/设置 步长 默认为 null 设置 any 时忽略检查 + /// Gets or sets the step. Default is null. When set to "any", validation is ignored. /// string? Step { get; set; } /// - /// 获得/设置 Textarea 行数 默认为 0 + /// Gets or sets the number of rows for a Textarea. Default is 0. /// int Rows { get; set; } /// - /// 获得/设置 编辑模板 + /// Gets or sets the edit template. /// RenderFragment? EditTemplate { get; set; } /// - /// 获得/设置 组件类型 默认为 null + /// Gets or sets the component type. Default is null. /// Type? ComponentType { get; set; } /// - /// 获得/设置 组件自定义类型参数集合 默认为 null + /// Gets or sets the custom component parameters. Default is null. /// IEnumerable>? ComponentParameters { get; set; } /// - /// 获得/设置 字段数据源下拉框是否显示搜索栏 默认 false 不显示 + /// Gets or sets whether to show the search bar in the dropdown list. Default is false. /// bool ShowSearchWhenSelect { get; set; } /// - /// 获得/设置 是否使用 Popover 渲染下拉框 默认 false + /// Gets or sets whether to use Popover to render the dropdown list. Default is false. /// bool IsPopover { get; set; } /// - /// 获得/设置 自定义验证集合 + /// Gets or sets the custom validation rules. /// List? ValidateRules { get; set; } /// - /// 获取绑定字段显示名称方法 + /// Gets the display name of the bound field. /// string GetDisplayName(); /// - /// 获取绑定字段信息方法 + /// Gets the field information of the bound field. /// string GetFieldName(); /// - /// 获得/设置 顺序号 + /// Gets or sets the order number. /// int Order { get; set; } /// - /// 获得/设置 当前属性分组 + /// Gets or sets the group name of the current property. /// string? GroupName { get; set; } /// - /// 获得/设置 当前属性分组排序 默认 0 + /// Gets or sets the group order of the current property. Default is 0. /// int GroupOrder { get; set; } /// - /// 获得/设置 是否为必填项 默认为 null + /// Gets or sets whether the field is required. Default is null. /// bool? Required { get; set; } /// - /// 获得/设置 必填项缺失时错误提示文本 默认为 null + /// Gets or sets the error message when the required field is missing. Default is null. /// string? RequiredErrorMessage { get; set; } } diff --git a/src/BootstrapBlazor/Components/Table/ITableColumn.cs b/src/BootstrapBlazor/Components/Table/ITableColumn.cs index ab4eb4561eb..a91528f52fd 100644 --- a/src/BootstrapBlazor/Components/Table/ITableColumn.cs +++ b/src/BootstrapBlazor/Components/Table/ITableColumn.cs @@ -6,192 +6,192 @@ namespace BootstrapBlazor.Components; /// -/// ITableHeader 接口 +/// ITableHeader interface /// public interface ITableColumn : IEditorItem { /// - /// 获得/设置 是否允许排序 默认为 null + /// Gets or sets whether sorting is allowed. Default is null. /// bool? Sortable { get; set; } /// - /// 获得/设置 是否为默认排序列 默认为 false + /// Gets or sets whether it is the default sort column. Default is false. /// bool DefaultSort { get; set; } /// - /// 获得/设置 默认排序规则 默认为 SortOrder.Unset + /// Gets or sets the default sort order. Default is SortOrder.Unset. /// SortOrder DefaultSortOrder { get; set; } /// - /// 获得/设置 是否允许过滤数据 默认为 null + /// Gets or sets whether data filtering is allowed. Default is null. /// bool? Filterable { get; set; } /// - /// 获得/设置 是否参与搜索 默认为 null + /// Gets or sets whether the column participates in search. Default is null. /// bool? Searchable { get; set; } /// - /// 获得/设置 列宽 + /// Gets or sets the column width. /// int? Width { get; set; } /// - /// 获得/设置 是否固定本列 默认 false 不固定 + /// Gets or sets whether the column is fixed. Default is false. /// bool Fixed { get; set; } /// - /// 获得/设置 本列是否允许换行 默认为 null + /// Gets or sets whether text wrapping is allowed in this column. Default is null. /// bool? TextWrap { get; set; } /// - /// 获得/设置 本列文本超出省略 默认为 null + /// Gets or sets whether text overflow is ellipsis in this column. Default is null. /// bool? TextEllipsis { get; set; } /// - /// 获得/设置 是否表头允许折行 默认 false 不折行 + /// Gets or sets whether the header text is allowed to wrap. Default is false. /// bool HeaderTextWrap { get; set; } /// - /// 获得/设置 是否表头显示 Tooltip 默认 false 不显示 可配合 使用 设置 为 true 时本参数不生效 + /// Gets or sets whether the header shows a tooltip. Default is false. Can be used with . This parameter is not effective when is set to true. /// bool ShowHeaderTooltip { get; set; } /// - /// 获得/设置 是否表头 Tooltip 内容 + /// Gets or sets the header tooltip content. /// string? HeaderTextTooltip { get; set; } /// - /// 获得/设置 是否表头溢出时截断 默认 false 不截断 可配合 使用 设置 为 true 时本参数不生效 + /// Gets or sets whether the header text is truncated when overflowing. Default is false. Can be used with . This parameter is not effective when is set to true. /// bool HeaderTextEllipsis { get; set; } /// - /// 获得/设置 列 td 自定义样式 默认为 null 未设置 + /// Gets or sets the custom CSS class for the column td. Default is null. /// string? CssClass { get; set; } /// - /// 显示节点阈值 默认值 BreakPoint.None 未设置 + /// Gets or sets the breakpoint at which the column is shown. Default is BreakPoint.None. /// BreakPoint ShownWithBreakPoint { get; set; } /// - /// 获得/设置 是否可以拷贝列 默认 null 不可以 + /// Gets or sets whether the column can be copied. Default is null. /// bool? ShowCopyColumn { get; set; } /// - /// 获得/设置 显示模板 + /// Gets or sets the display template. /// RenderFragment? Template { get; set; } /// - /// 获得/设置 搜索模板 + /// Gets or sets the search template. /// RenderFragment? SearchTemplate { get; set; } /// - /// 获得/设置 过滤模板 + /// Gets or sets the filter template. /// RenderFragment? FilterTemplate { get; set; } /// - /// 获得/设置 表头模板 + /// Gets or sets the header template. /// RenderFragment? HeaderTemplate { get; set; } /// - /// 获得/设置 工具栏模板 默认 null + /// Gets or sets the toolbox template. Default is null. /// RenderFragment? ToolboxTemplate { get; set; } /// - /// 获得/设置 列过滤器 + /// Gets or sets the column filter. /// IFilter? Filter { get; set; } /// - /// 获得/设置 格式化字符串 如时间类型设置 yyyy-MM-dd + /// Gets or sets the format string, such as "yyyy-MM-dd" for date types. /// string? FormatString { get; set; } /// - /// 获得/设置 列格式化回调委托 + /// Gets or sets the column format callback delegate . /// Func>? Formatter { get; set; } /// - /// 获得/设置 文字对齐方式 默认为 null 使用 Alignment.None + /// Gets or sets the text alignment. Default is null, using Alignment.None. /// Alignment? Align { get; set; } /// - /// 获得/设置 字段鼠标悬停提示 默认为 null 使用 false 值 + /// Gets or sets whether to show tooltips on mouse hover. Default is null, using false value. /// bool? ShowTips { get; set; } /// - /// 获得/设置 鼠标悬停提示自定义内容回调委托 默认 null 使用当前值 + /// Gets or sets the custom tooltip content callback delegate. Default is null, using the current value. /// Func>? GetTooltipTextCallback { get; set; } /// - /// 获得/设置 单元格回调方法 + /// Gets or sets the cell render callback method. /// Action? OnCellRender { get; set; } /// - /// 获得/设置 是否为 MarkupString 默认 false + /// Gets or sets whether the column is a MarkupString. Default is false. /// bool IsMarkupString { get; set; } /// - /// 获得/设置 新建时是否为必填项 默认为 null + /// Gets or sets whether the column is required when adding a new item. Default is null. /// bool? IsRequiredWhenAdd { get; set; } /// - /// 获得/设置 编辑时是否为必填项 默认为 null + /// Gets or sets whether the column is required when editing an item. Default is null. /// bool? IsRequiredWhenEdit { get; set; } /// - /// 获得/设置 新建时此列只读 默认为 null 使用 值 + /// Gets or sets whether the column is read-only when adding a new item. Default is null, using the value. /// bool? IsReadonlyWhenAdd { get; set; } /// - /// 获得/设置 编辑时此列只读 默认为 null 使用 值 + /// Gets or sets whether the column is read-only when editing an item. Default is null, using the value. /// bool? IsReadonlyWhenEdit { get; set; } /// - /// 获得/设置 当前编辑项是否显示 默认为 null 未设置时为 true + /// Gets or sets whether the current edit item is visible. Default is null, using true value. /// bool? Visible { get; set; } /// - /// 获得/设置 新建时是否此列显示 默认为 null 使用 值 + /// Gets or sets whether the column is visible when adding a new item. Default is null, using the value. /// bool? IsVisibleWhenAdd { get; set; } /// - /// 获得/设置 编辑时是否此列显示 默认为 null 使用 值 + /// Gets or sets whether the column is visible when editing an item. Default is null, using the value. /// bool? IsVisibleWhenEdit { get; set; } /// - /// 获得/设置 自定义搜索逻辑 + /// Gets or sets the custom search logic. /// Func? CustomSearch { get; set; } } From 6c60d9a52248fa56c96b5c84296e773156b0f943 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Wed, 12 Mar 2025 08:53:06 +0800 Subject: [PATCH 2/6] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Attributes/AutoGenerateBaseAttribute.cs | 28 ++-- .../Attributes/AutoGenerateClassAttribute.cs | 2 +- .../Attributes/AutoGenerateColumnAttribute.cs | 128 ++++-------------- 3 files changed, 43 insertions(+), 115 deletions(-) diff --git a/src/BootstrapBlazor/Attributes/AutoGenerateBaseAttribute.cs b/src/BootstrapBlazor/Attributes/AutoGenerateBaseAttribute.cs index 6c6de1db127..c05bef4244d 100644 --- a/src/BootstrapBlazor/Attributes/AutoGenerateBaseAttribute.cs +++ b/src/BootstrapBlazor/Attributes/AutoGenerateBaseAttribute.cs @@ -6,69 +6,69 @@ namespace BootstrapBlazor.Components; /// -/// AutoGenerateColumn 标签基类,用于 标识自动生成列 +/// Base class for AutoGenerateColumn attribute, used to mark auto-generated columns in /// public abstract class AutoGenerateBaseAttribute : Attribute { /// - /// 获得/设置 当前列是否可编辑 默认为 true 当设置为 false 时自动生成编辑 UI 不生成此列 + /// Gets or sets whether the current column is editable. Default is true. When set to false, the auto-generated edit UI will not generate this column. /// - [Obsolete("已弃用,是否可编辑改用 Readonly 参数,是否可见改用 Ignore 参数; Deprecated If it is editable, use the Readonly parameter. If it is visible, use the Ignore parameter.")] + [Obsolete("Deprecated. If it is editable, use the Readonly parameter. If it is visible, use the Ignore parameter.")] [ExcludeFromCodeCoverage] public bool Editable { get; set; } = true; /// - /// 获得/设置 当前列是否渲染 默认为 false 当设置为 true 时 UI 不生成此列 + /// Gets or sets whether the current column is rendered. Default is false. When set to true, the UI will not generate this column. /// public bool Ignore { get; set; } /// - /// 获得/设置 当前编辑项是否只读 默认为 false + /// Gets or sets whether the current edit item is read-only. Default is false. /// public bool Readonly { get; set; } /// - /// 获得/设置 当前编辑项是否显示 默认为 true + /// Gets or sets whether the current edit item is visible. Default is true. /// public bool Visible { get; set; } = true; /// - /// 获得/设置 是否允许排序 默认为 false + /// Gets or sets whether sorting is allowed. Default is false. /// public bool Sortable { get; set; } /// - /// 获得/设置 是否允许过滤数据 默认为 false + /// Gets or sets whether data filtering is allowed. Default is false. /// public bool Filterable { get; set; } /// - /// 获得/设置 是否参与搜索 默认为 false + /// Gets or sets whether the column participates in search. Default is false. /// public bool Searchable { get; set; } /// - /// 获得/设置 本列是否允许换行 默认为 false + /// Gets or sets whether text wrapping is allowed in this column. Default is false. /// public bool TextWrap { get; set; } /// - /// 获得/设置 本列文本超出省略 默认为 false + /// Gets or sets whether text overflow is ellipsis in this column. Default is false. /// public bool TextEllipsis { get; set; } /// - /// 获得/设置 文字对齐方式 默认为 Alignment.None + /// Gets or sets the text alignment. Default is Alignment.None. /// public Alignment Align { get; set; } /// - /// 获得/设置 字段鼠标悬停提示 默认为 false + /// Gets or sets whether to show tooltips on mouse hover. Default is false. /// public bool ShowTips { get; set; } /// - /// 获得/设置 是否可以拷贝列 默认 false 不可以 + /// Gets or sets whether the column can be copied. Default is false. /// public bool ShowCopyColumn { get; set; } } diff --git a/src/BootstrapBlazor/Attributes/AutoGenerateClassAttribute.cs b/src/BootstrapBlazor/Attributes/AutoGenerateClassAttribute.cs index af7d2c4f83c..c5943dcb201 100644 --- a/src/BootstrapBlazor/Attributes/AutoGenerateClassAttribute.cs +++ b/src/BootstrapBlazor/Attributes/AutoGenerateClassAttribute.cs @@ -6,7 +6,7 @@ namespace BootstrapBlazor.Components; /// -/// AutoGenerateColumn 标签类,用于 标识自动生成列 +/// AutoGenerateColumn attribute class, used to mark auto-generated columns in /// [AttributeUsage(AttributeTargets.Class)] public class AutoGenerateClassAttribute : AutoGenerateBaseAttribute diff --git a/src/BootstrapBlazor/Attributes/AutoGenerateColumnAttribute.cs b/src/BootstrapBlazor/Attributes/AutoGenerateColumnAttribute.cs index 52914a76498..dc27489219f 100644 --- a/src/BootstrapBlazor/Attributes/AutoGenerateColumnAttribute.cs +++ b/src/BootstrapBlazor/Attributes/AutoGenerateColumnAttribute.cs @@ -6,34 +6,34 @@ namespace BootstrapBlazor.Components; /// -/// AutoGenerateColumn 标签类,用于 标识自动生成列 +/// AutoGenerateColumn attribute class, used to mark auto-generated columns in /// [AttributeUsage(AttributeTargets.Property)] public class AutoGenerateColumnAttribute : AutoGenerateBaseAttribute, ITableColumn { /// - /// 获得/设置 显示顺序 ,规则如下: + /// Gets or sets the display order. The rules are as follows: /// - /// >0时排前面,1,2,3... + /// >0 for the front, 1,2,3... /// - /// =0时排中间(默认) + /// =0 for the middle (default) /// - /// <0时排后面,...-3,-2,-1 + /// <0 for the back, ...-3,-2,-1 /// public int Order { get; set; } /// - /// 获得/设置 是否为默认排序列 默认为 false + /// /// public bool DefaultSort { get; set; } /// - /// 获得/设置 是否不进行验证 默认为 false + /// /// public bool SkipValidate { get; set; } /// - /// + /// Gets or sets whether the column is read-only when adding a new item. Default is null, using the value. /// public bool IsReadonlyWhenAdd { get; set; } @@ -44,7 +44,7 @@ public class AutoGenerateColumnAttribute : AutoGenerateBaseAttribute, ITableColu } /// - /// + /// Gets or sets whether the column is read-only when editing an item. Default is null, using the value. /// public bool IsReadonlyWhenEdit { get; set; } @@ -55,7 +55,7 @@ public class AutoGenerateColumnAttribute : AutoGenerateBaseAttribute, ITableColu } /// - /// + /// Gets or sets whether the column is visible when adding a new item. Default is null, using the value. /// public bool IsVisibleWhenAdd { get; set; } = true; @@ -66,13 +66,10 @@ public class AutoGenerateColumnAttribute : AutoGenerateBaseAttribute, ITableColu } /// - /// + /// Gets or sets whether the column is visible when editing an item. Default is null, using the value. /// public bool IsVisibleWhenEdit { get; set; } = true; - /// - /// 自定义搜索方法 - /// Func? ITableColumn.CustomSearch { get; set; } bool? ITableColumn.IsVisibleWhenEdit @@ -83,7 +80,6 @@ public class AutoGenerateColumnAttribute : AutoGenerateBaseAttribute, ITableColu bool? IEditorItem.Required { get; set; } - bool? ITableColumn.IsRequiredWhenAdd { get; set; } bool? ITableColumn.IsRequiredWhenEdit { get; set; } @@ -94,7 +90,7 @@ public class AutoGenerateColumnAttribute : AutoGenerateBaseAttribute, ITableColu public string? RequiredErrorMessage { get; set; } /// - /// 获得/设置 是否显示标签 Tooltip 多用于标签文字过长导致裁减时使用 默认 false + /// Gets or sets whether to show label tooltip. Mostly used when the label text is too long and gets truncated. Default is false. /// public bool ShowLabelTooltip { get; set; } @@ -105,14 +101,14 @@ public class AutoGenerateColumnAttribute : AutoGenerateBaseAttribute, ITableColu } /// - /// 获得/设置 是否为默认排序规则 默认为 SortOrder.Unset + /// Gets or sets the default sort order. Default is SortOrder.Unset. /// public SortOrder DefaultSortOrder { get; set; } IEnumerable? IEditorItem.Items { get; set; } /// - /// 获得/设置 列宽 + /// Gets or sets the column width. /// public int Width { get; set; } @@ -123,27 +119,27 @@ public class AutoGenerateColumnAttribute : AutoGenerateBaseAttribute, ITableColu } /// - /// 获得/设置 是否固定本列 默认 false 不固定 + /// /// public bool Fixed { get; set; } /// - /// 获得/设置 列 td 自定义样式 默认为 null 未设置 + /// /// public string? CssClass { get; set; } /// - /// 获得/设置 显示节点阈值 默认值 BreakPoint.None 未设置 + /// /// public BreakPoint ShownWithBreakPoint { get; set; } /// - /// 获得/设置 格式化字符串 如时间类型设置 yyyy-MM-dd + /// /// public string? FormatString { get; set; } /// - /// 获得/设置 placeholder 文本 默认为 null + /// /// public string? PlaceHolder { get; set; } @@ -152,104 +148,47 @@ public class AutoGenerateColumnAttribute : AutoGenerateBaseAttribute, ITableColu /// public Func>? Formatter { get; set; } - /// - /// 获得/设置 编辑模板 - /// RenderFragment? IEditorItem.EditTemplate { get; set; } - /// - /// 获得/设置 表头模板 - /// RenderFragment? ITableColumn.HeaderTemplate { get; set; } - /// - /// - /// RenderFragment? ITableColumn.ToolboxTemplate { get; set; } /// - /// 获得/设置 组件类型 默认为 null + /// /// public Type? ComponentType { get; set; } - /// - /// 获得/设置 组件自定义类型参数集合 默认为 null - /// IEnumerable>? IEditorItem.ComponentParameters { get; set; } - /// - /// 获得/设置 显示模板 - /// RenderFragment? ITableColumn.Template { get; set; } - /// - /// 获得/设置 搜索模板 - /// RenderFragment? ITableColumn.SearchTemplate { get; set; } - /// - /// 获得/设置 过滤模板 - /// RenderFragment? ITableColumn.FilterTemplate { get; set; } - /// - /// - /// Func>? ITableColumn.GetTooltipTextCallback { get; set; } - /// - /// - /// bool? ITableColumn.Searchable { get => Searchable; set => Searchable = value ?? false; } - /// - /// - /// bool? ITableColumn.Filterable { get => Filterable; set => Filterable = value ?? false; } - /// - /// - /// bool? ITableColumn.Sortable { get => Sortable; set => Sortable = value ?? false; } - /// - /// - /// bool? ITableColumn.TextWrap { get => TextWrap; set => TextWrap = value ?? false; } - /// - /// - /// bool? ITableColumn.TextEllipsis { get => TextEllipsis; set => TextEllipsis = value ?? false; } - /// - /// - /// bool? IEditorItem.Ignore { get => Ignore; set => Ignore = value ?? false; } - /// - /// - /// bool? IEditorItem.Readonly { get => Readonly; set => Readonly = value ?? false; } - /// - /// - /// bool? ITableColumn.Visible { get => Visible; set => Visible = value ?? true; } - /// - /// - /// bool? ITableColumn.ShowTips { get => ShowTips; set => ShowTips = value ?? false; } - /// - /// - /// bool? ITableColumn.ShowCopyColumn { get => ShowCopyColumn; set => ShowCopyColumn = value ?? false; } - /// - /// - /// Alignment? ITableColumn.Align { get => Align; set => Align = value ?? Alignment.None; } /// @@ -258,28 +197,25 @@ public class AutoGenerateColumnAttribute : AutoGenerateBaseAttribute, ITableColu public string? Step { get; set; } /// - /// 获得/设置 行数 + /// /// public int Rows { get; set; } /// - /// 获得/设置 控件的占列数值范围 1-12 + /// /// public int Cols { get; set; } - /// - /// 获得/设置 列过滤器 - /// IFilter? ITableColumn.Filter { get; set; } /// - /// 获得 属性类型 + /// /// [NotNull] public Type? PropertyType { get; internal set; } /// - /// 获得/设置 当前属性显示文字 列头或者标签名称 + /// /// public string? Text { get; set; } @@ -290,7 +226,7 @@ public class AutoGenerateColumnAttribute : AutoGenerateBaseAttribute, ITableColu internal string? FieldName { get; set; } /// - /// 获得/设置 字段数据源下拉框是否显示搜索栏 默认 false 不显示 + /// /// public bool ShowSearchWhenSelect { get; set; } @@ -324,35 +260,27 @@ public class AutoGenerateColumnAttribute : AutoGenerateBaseAttribute, ITableColu /// public StringComparison LookupStringComparison { get; set; } = StringComparison.OrdinalIgnoreCase; - /// - /// 获得/设置 单元格回调方法 - /// Action? ITableColumn.OnCellRender { get; set; } - /// - /// 获得/设置 自定义验证集合 - /// List? IEditorItem.ValidateRules { get; set; } /// - /// 获取绑定字段显示名称方法 + /// /// - /// public virtual string GetDisplayName() => Text ?? ""; /// /// /// - /// public string GetFieldName() => FieldName; /// - /// 获得/设置 当前属性分组 + /// /// public string? GroupName { get; set; } /// - /// 获得/设置 当前属性分组排序 默认 0 + /// /// public int GroupOrder { get; set; } From 4c74a3687fe201e72dcb8223c2056e3a7c5537fb Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Wed, 12 Mar 2025 09:03:32 +0800 Subject: [PATCH 3/6] =?UTF-8?q?doc:=20=E6=96=87=E6=A1=A3=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E4=B8=BA=E8=8B=B1=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BootstrapModuleAutoLoaderAttribute.cs | 4 ++-- .../Attributes/JSModuleAutoLoaderAttribute.cs | 10 +++++----- .../Attributes/NullableBoolItemsAttribute.cs | 8 ++++---- .../Attributes/PlaceHolderAttribute.cs | 18 +++++------------- .../Attributes/TabItemOptionAttribute.cs | 8 ++++---- .../Attributes/TableMetadataForAttribute.cs | 2 +- 6 files changed, 21 insertions(+), 29 deletions(-) diff --git a/src/BootstrapBlazor/Attributes/BootstrapModuleAutoLoaderAttribute.cs b/src/BootstrapBlazor/Attributes/BootstrapModuleAutoLoaderAttribute.cs index 9a67f191d19..620fac2a15f 100644 --- a/src/BootstrapBlazor/Attributes/BootstrapModuleAutoLoaderAttribute.cs +++ b/src/BootstrapBlazor/Attributes/BootstrapModuleAutoLoaderAttribute.cs @@ -6,13 +6,13 @@ namespace BootstrapBlazor.Components; /// -/// 构造函数 +/// Constructor /// /// class BootstrapModuleAutoLoaderAttribute(string? path = null) : JSModuleAutoLoaderAttribute(path) { /// - /// 获得/设置 模块名称 自动使用 modules 文件夹下脚本 + /// Gets or sets the module name. Automatically uses scripts from the modules folder. /// public string? ModuleName { get; set; } } diff --git a/src/BootstrapBlazor/Attributes/JSModuleAutoLoaderAttribute.cs b/src/BootstrapBlazor/Attributes/JSModuleAutoLoaderAttribute.cs index 66d194c9b88..b23753ae99c 100644 --- a/src/BootstrapBlazor/Attributes/JSModuleAutoLoaderAttribute.cs +++ b/src/BootstrapBlazor/Attributes/JSModuleAutoLoaderAttribute.cs @@ -8,27 +8,27 @@ namespace BootstrapBlazor.Components; /// /// JSModuleAutoLoaderAttribute class /// -/// +/// The path to the JavaScript module [AttributeUsage(AttributeTargets.Class)] public class JSModuleAutoLoaderAttribute(string? path = null) : Attribute { /// - /// 获得 Name 属性 + /// Gets the path property /// public string? Path { get; } = path; /// - /// Represents a reference to a JavaScript object Default value false + /// Represents a reference to a JavaScript object. Default value is false. /// public bool JSObjectReference { get; set; } /// - /// 获得/设置 是否自动调用 init 默认 true + /// Gets or sets whether to automatically invoke init. Default is true. /// public bool AutoInvokeInit { get; set; } = true; /// - /// 获得/设置 是否自动调用 dispose 默认 true + /// Gets or sets whether to automatically invoke dispose. Default is true. /// public bool AutoInvokeDispose { get; set; } = true; } diff --git a/src/BootstrapBlazor/Attributes/NullableBoolItemsAttribute.cs b/src/BootstrapBlazor/Attributes/NullableBoolItemsAttribute.cs index d4f169c42fa..19b21468b50 100644 --- a/src/BootstrapBlazor/Attributes/NullableBoolItemsAttribute.cs +++ b/src/BootstrapBlazor/Attributes/NullableBoolItemsAttribute.cs @@ -6,23 +6,23 @@ namespace BootstrapBlazor.Components; /// -/// 可为空布尔类型转换器 +/// Nullable boolean type converter /// [AttributeUsage(AttributeTargets.Property)] public class NullableBoolItemsAttribute : Attribute { /// - /// 获得/设置 空值显示文本 + /// Gets or sets the display text for null value /// public string? NullValueDisplayText { get; set; } /// - /// 获得/设置 True 值显示文本 + /// Gets or sets the display text for true value /// public string? TrueValueDisplayText { get; set; } /// - /// 获得/设置 False 值显示文本 + /// Gets or sets the display text for false value /// public string? FalseValueDisplayText { get; set; } } diff --git a/src/BootstrapBlazor/Attributes/PlaceHolderAttribute.cs b/src/BootstrapBlazor/Attributes/PlaceHolderAttribute.cs index c25ca3bf84b..435aac53fe8 100644 --- a/src/BootstrapBlazor/Attributes/PlaceHolderAttribute.cs +++ b/src/BootstrapBlazor/Attributes/PlaceHolderAttribute.cs @@ -6,22 +6,14 @@ namespace BootstrapBlazor.Components; /// -/// PlaceHolderAttribute 占位符标签类 +/// PlaceHolderAttribute class used to define a placeholder for a property. /// +/// The placeholder text. [AttributeUsage(AttributeTargets.Property)] -public class PlaceHolderAttribute : Attribute +public class PlaceHolderAttribute(string placeholder) : Attribute { /// - /// 获得 Text 属性 + /// Gets the placeholder text. /// - public string Text { get; } - - /// - /// 构造函数 - /// - /// - public PlaceHolderAttribute(string placeholder) - { - Text = placeholder; - } + public string Text { get; } = placeholder; } diff --git a/src/BootstrapBlazor/Attributes/TabItemOptionAttribute.cs b/src/BootstrapBlazor/Attributes/TabItemOptionAttribute.cs index ed68f9b42a1..25fc4d3ee13 100644 --- a/src/BootstrapBlazor/Attributes/TabItemOptionAttribute.cs +++ b/src/BootstrapBlazor/Attributes/TabItemOptionAttribute.cs @@ -6,23 +6,23 @@ namespace BootstrapBlazor.Components; /// -/// TabItem 标签页配置属性类 +/// TabItem configuration attribute class /// [AttributeUsage(AttributeTargets.Class)] public class TabItemOptionAttribute : Attribute { /// - /// 获得/设置 文本文字 + /// Gets or sets the text of the tab item. /// public string? Text { get; set; } /// - /// 获得/设置 当前 TabItem 是否可关闭 默认为 true 可关闭 + /// Gets or sets whether the current TabItem is closable. Default is true. /// public bool Closable { get; set; } = true; /// - /// 获得/设置 图标字符串 + /// Gets or sets the icon string. /// public string? Icon { get; set; } } diff --git a/src/BootstrapBlazor/Attributes/TableMetadataForAttribute.cs b/src/BootstrapBlazor/Attributes/TableMetadataForAttribute.cs index d73d3bd6ee7..0588f57a62e 100644 --- a/src/BootstrapBlazor/Attributes/TableMetadataForAttribute.cs +++ b/src/BootstrapBlazor/Attributes/TableMetadataForAttribute.cs @@ -56,7 +56,7 @@ namespace BootstrapBlazor.Components; public class TableMetadataForAttribute(Type dataType) : Attribute { /// - /// The target model/data type + /// Gets the target model/data type /// public Type DataType => dataType; } From 0e7947f4b3f7cf680c8127fa2f00cb056d51116b Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Wed, 12 Mar 2025 09:06:35 +0800 Subject: [PATCH 4/6] =?UTF-8?q?doc:=20=E6=96=87=E6=A1=A3=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E4=B8=BA=E8=8B=B1=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Converter/JsonDescriptionEnumConverter.cs | 21 ++++++++++--------- .../Converter/JsonEnumConverter.cs | 8 +++---- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/BootstrapBlazor/Converter/JsonDescriptionEnumConverter.cs b/src/BootstrapBlazor/Converter/JsonDescriptionEnumConverter.cs index df5694bbcae..31e500b7c26 100644 --- a/src/BootstrapBlazor/Converter/JsonDescriptionEnumConverter.cs +++ b/src/BootstrapBlazor/Converter/JsonDescriptionEnumConverter.cs @@ -9,17 +9,18 @@ namespace BootstrapBlazor.Components; /// -/// 枚举类型转换器 序列化时把枚举类型的 [Description] 标签内容序列化成字符串 推荐使用 转换器 +/// Enum type converter that serializes the [Description] attribute of enum values to strings. +/// It is recommended to use instead. /// public class JsonDescriptionEnumConverter : JsonConverter where T : struct, Enum { /// - /// + /// Reads and converts the JSON to the specified enum type. /// - /// - /// - /// - /// + /// The reader. + /// The type to convert. + /// The serializer options. + /// The converted enum value. public override T Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { T ret = default; @@ -36,11 +37,11 @@ public override T Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerial } /// - /// + /// Writes the specified enum value as a string using its [Description] attribute. /// - /// - /// - /// + /// The writer. + /// The value to write. + /// The serializer options. public override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options) { writer.WriteStringValue(value.ToDescriptionString()); diff --git a/src/BootstrapBlazor/Converter/JsonEnumConverter.cs b/src/BootstrapBlazor/Converter/JsonEnumConverter.cs index 18f18476db1..1c5f3df4aa3 100644 --- a/src/BootstrapBlazor/Converter/JsonEnumConverter.cs +++ b/src/BootstrapBlazor/Converter/JsonEnumConverter.cs @@ -9,17 +9,17 @@ namespace BootstrapBlazor.Components; /// -/// JsonEnumConverter 枚举转换器 +/// JsonEnumConverter is an enum converter that allows customization of enum serialization. /// /// Optional naming policy for writing enum values. /// True to allow undefined enum values. When true, if an enum value isn't defined it will output as a number rather than a string. public class JsonEnumConverter(bool camelCase = false, bool allowIntegerValues = true) : JsonConverterAttribute { /// - /// + /// Creates a JsonConverter for the specified type. /// - /// - /// + /// The type to convert. + /// A JsonConverter for the specified type. public override JsonConverter? CreateConverter(Type typeToConvert) { var converter = camelCase From 6a90a6bc018fbc9a1d563b09490b7bddef22f848 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Wed, 12 Mar 2025 09:59:44 +0800 Subject: [PATCH 5/6] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Attributes/AutoGenerateColumnAttribute.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor/Attributes/AutoGenerateColumnAttribute.cs b/src/BootstrapBlazor/Attributes/AutoGenerateColumnAttribute.cs index dc27489219f..2772a7e8234 100644 --- a/src/BootstrapBlazor/Attributes/AutoGenerateColumnAttribute.cs +++ b/src/BootstrapBlazor/Attributes/AutoGenerateColumnAttribute.cs @@ -55,7 +55,7 @@ public class AutoGenerateColumnAttribute : AutoGenerateBaseAttribute, ITableColu } /// - /// Gets or sets whether the column is visible when adding a new item. Default is null, using the value. + /// Gets or sets whether the column is visible when adding a new item. Default is null, using the value. /// public bool IsVisibleWhenAdd { get; set; } = true; @@ -66,7 +66,7 @@ public class AutoGenerateColumnAttribute : AutoGenerateBaseAttribute, ITableColu } /// - /// Gets or sets whether the column is visible when editing an item. Default is null, using the value. + /// Gets or sets whether the column is visible when editing an item. Default is null, using the value. /// public bool IsVisibleWhenEdit { get; set; } = true; From dfbb3558aad411412f73397a71732ddcc02b50be Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Wed, 12 Mar 2025 10:11:00 +0800 Subject: [PATCH 6/6] =?UTF-8?q?test:=20=E6=9B=B4=E6=96=B0=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/UnitTest/Components/TimerTest.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/UnitTest/Components/TimerTest.cs b/test/UnitTest/Components/TimerTest.cs index 1365f8d5655..bc79cecacc6 100644 --- a/test/UnitTest/Components/TimerTest.cs +++ b/test/UnitTest/Components/TimerTest.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. // Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone +using AngleSharp.Dom; using Timer = BootstrapBlazor.Components.Timer; namespace UnitTest.Components; @@ -135,16 +136,19 @@ public async Task OnCancel_Ok() var buttons = cut.FindAll(".timer-buttons button"); // pause Assert.True(buttons[1].ClassList.Contains("btn-warning")); + Assert.Equal("暂停", buttons[1].GetInnerText()); await cut.InvokeAsync(() => buttons[1].Click()); await Task.Delay(500); // resume buttons = cut.FindAll(".timer-buttons button"); Assert.True(buttons[1].ClassList.Contains("btn-success")); + Assert.Equal("继续", buttons[1].GetInnerText()); await cut.InvokeAsync(() => buttons[1].Click()); // cancel buttons = cut.FindAll(".timer-buttons button"); + Assert.Equal("取消", buttons[0].GetInnerText()); await cut.InvokeAsync(() => buttons[0].Click()); Assert.True(cancelled);