66namespace BootstrapBlazor . Components ;
77
88/// <summary>
9- /// BootstrapInputBase 组件基类
9+ /// Base class for BootstrapInput components
1010/// </summary>
1111[ BootstrapModuleAutoLoader ( "Input/BootstrapInput.razor.js" , JSObjectReference = true , AutoInvokeInit = false ) ]
1212public abstract class BootstrapInputBase < TValue > : ValidateBase < TValue >
1313{
1414 /// <summary>
15- /// 获得 class 样式集合
15+ /// Gets the class attribute value
1616 /// </summary>
1717 protected virtual string ? ClassName => CssBuilder . Default ( "form-control" )
1818 . AddClass ( $ "border-{ Color . ToDescriptionString ( ) } ", Color != Color . None && ! IsDisabled && ! IsValid . HasValue )
1919 . AddClass ( CssClass ) . AddClass ( ValidCss )
2020 . Build ( ) ;
2121
2222 /// <summary>
23- /// 元素实例引用
23+ /// Gets or sets Element reference instance
2424 /// </summary>
2525 protected ElementReference FocusElement { get ; set ; }
2626
2727 /// <summary>
28- /// 获得/设置 input 类型 placeholder 属性
28+ /// Gets or sets the placeholder attribute value
2929 /// </summary>
3030 [ Parameter ]
3131 public string ? PlaceHolder { get ; set ; }
3232
3333 /// <summary>
34- /// 获得/设置 文本框 Enter 键回调委托方法 默认为 null
34+ /// Gets or sets the callback method for Enter key press, default is null
3535 /// </summary>
3636 [ Parameter ]
3737 public Func < TValue , Task > ? OnEnterAsync { get ; set ; }
3838
3939 /// <summary>
40- /// 获得/设置 文本框 Esc 键回调委托方法 默认为 null
40+ /// Gets or sets the callback method for Esc key press, default is null
4141 /// </summary>
4242 [ Parameter ]
4343 public Func < TValue , Task > ? OnEscAsync { get ; set ; }
4444
4545 /// <summary>
46- /// 获得/设置 按钮颜色
46+ /// Gets or sets the button color
4747 /// </summary>
4848 [ Parameter ]
4949 public Color Color { get ; set ; } = Color . None ;
5050
5151 /// <summary>
52- /// 获得/设置 格式化字符串
52+ /// Gets or sets the formatter function
5353 /// </summary>
5454 [ Parameter ]
5555 public Func < TValue ? , string > ? Formatter { get ; set ; }
5656
5757 /// <summary>
58- /// 获得/设置 格式化字符串 如时间类型设置 yyyy-MM-dd
58+ /// Gets or sets the format string, e.g., " yyyy-MM-dd" for date types
5959 /// </summary>
6060 [ Parameter ]
6161 public string ? FormatString { get ; set ; }
6262
6363 /// <summary>
64- /// 获得/设置 是否自动获取焦点 默认 false 不自动获取焦点
64+ /// Gets or sets whether to automatically focus, default is false
6565 /// </summary>
6666 [ Parameter ]
6767 public bool IsAutoFocus { get ; set ; }
6868
6969 /// <summary>
70- /// 获得/设置 获得焦点后自动选择输入框内所有字符串 默认 false 未启用
70+ /// Gets or sets whether to automatically select all text on focus, default is false
7171 /// </summary>
7272 [ Parameter ]
7373 public bool IsSelectAllTextOnFocus { get ; set ; }
7474
7575 /// <summary>
76- /// 获得/设置 Enter 键自动选择输入框内所有字符串 默认 false 未启用
76+ /// Gets or sets whether to automatically select all text on Enter key press, default is false
7777 /// </summary>
7878 [ Parameter ]
7979 public bool IsSelectAllTextOnEnter { get ; set ; }
8080
8181 /// <summary>
82- /// 获得/设置 是否自动修剪空白 默认 false 未启用
82+ /// Gets or sets whether to automatically trim whitespace, default is false
8383 /// </summary>
8484 [ Parameter ]
8585 public bool IsTrim { get ; set ; }
8686
8787 /// <summary>
88- /// 获得/设置 失去焦点回调方法 默认 null
88+ /// Gets or sets the callback method for blur event, default is null
8989 /// </summary>
9090 [ Parameter ]
9191 public Func < TValue , Task > ? OnBlurAsync { get ; set ; }
@@ -94,24 +94,24 @@ public abstract class BootstrapInputBase<TValue> : ValidateBase<TValue>
9494 private Modal ? Modal { get ; set ; }
9595
9696 /// <summary>
97- /// 获得 input 组件类型 默认 text
97+ /// Gets the input type, default is " text"
9898 /// </summary>
9999 protected string Type { get ; set ; } = "text" ;
100100
101101 /// <summary>
102- /// 自动获得焦点方法
102+ /// Method to focus the element
103103 /// </summary>
104104 /// <returns></returns>
105105 public async Task FocusAsync ( ) => await FocusElement . FocusAsync ( ) ;
106106
107107 /// <summary>
108- /// 全选文字
108+ /// Method to select all text
109109 /// </summary>
110110 /// <returns></returns>
111111 public async ValueTask SelectAllTextAsync ( ) => await InvokeVoidAsync ( "select" , Id ) ;
112112
113113 /// <summary>
114- /// 获得/设置 是否不注册 js 脚本处理 Enter/ESC 键盘处理函数 默认 false
114+ /// Gets or sets whether to skip JS script registration for Enter/Esc key handling, default is false
115115 /// </summary>
116116 protected bool SkipRegisterEnterEscJSInvoke { get ; set ; }
117117
@@ -173,12 +173,12 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
173173 }
174174
175175 /// <summary>
176- /// 获得输入框 Id
176+ /// Gets the input element Id
177177 /// </summary>
178178 protected virtual string ? GetInputId ( ) => Id ;
179179
180180 /// <summary>
181- /// 数值格式化委托方法
181+ /// Value formatting delegate method
182182 /// </summary>
183183 /// <param name="value"></param>
184184 /// <returns></returns>
@@ -198,7 +198,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
198198 protected override bool TryParseValueFromString ( string value , [ MaybeNullWhen ( false ) ] out TValue result , out string ? validationErrorMessage ) => base . TryParseValueFromString ( IsTrim ? value . Trim ( ) : value , out result , out validationErrorMessage ) ;
199199
200200 /// <summary>
201- /// OnBlur 方法
201+ /// OnBlur method
202202 /// </summary>
203203 protected virtual async Task OnBlur ( )
204204 {
@@ -209,7 +209,7 @@ protected virtual async Task OnBlur()
209209 }
210210
211211 /// <summary>
212- /// 客户端 EnterCallback 回调方法
212+ /// Client-side EnterCallback method
213213 /// </summary>
214214 /// <returns></returns>
215215 [ JSInvokable ]
@@ -223,7 +223,7 @@ public async Task EnterCallback(string val)
223223 }
224224
225225 /// <summary>
226- /// 客户端 EscCallback 回调方法
226+ /// Client-side EscCallback method
227227 /// </summary>
228228 /// <returns></returns>
229229 [ JSInvokable ]
0 commit comments