diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index e14bd286f3d..d4e6cd0bbda 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@  - 9.4.9-beta03 + 9.4.9-beta04 diff --git a/src/BootstrapBlazor/Components/Input/BootstrapInput.razor.js b/src/BootstrapBlazor/Components/Input/BootstrapInput.razor.js index 08468520762..70c3ba2701b 100644 --- a/src/BootstrapBlazor/Components/Input/BootstrapInput.razor.js +++ b/src/BootstrapBlazor/Components/Input/BootstrapInput.razor.js @@ -12,6 +12,10 @@ export function handleKeyUp(id, invoke, enter, enterCallbackMethod, esc, escCall if (el) { EventHandler.on(el, 'keyup', e => { if (enter && (e.key === 'Enter' || e.key === 'NumpadEnter')) { + const useShiftEnter = el.getAttribute('data-bb-shift-enter') === 'true'; + if (!e.shiftKey && useShiftEnter) { + return; + } invoke.invokeMethodAsync(enterCallbackMethod, el.value) } else if (esc && e.key === 'Escape') { diff --git a/src/BootstrapBlazor/Components/Input/BootstrapInputBase.cs b/src/BootstrapBlazor/Components/Input/BootstrapInputBase.cs index 7ee33031957..c613c12cdce 100644 --- a/src/BootstrapBlazor/Components/Input/BootstrapInputBase.cs +++ b/src/BootstrapBlazor/Components/Input/BootstrapInputBase.cs @@ -6,13 +6,13 @@ namespace BootstrapBlazor.Components; /// -/// BootstrapInputBase 组件基类 +/// Base class for BootstrapInput components /// [BootstrapModuleAutoLoader("Input/BootstrapInput.razor.js", JSObjectReference = true, AutoInvokeInit = false)] public abstract class BootstrapInputBase : ValidateBase { /// - /// 获得 class 样式集合 + /// Gets the class attribute value /// protected virtual string? ClassName => CssBuilder.Default("form-control") .AddClass($"border-{Color.ToDescriptionString()}", Color != Color.None && !IsDisabled && !IsValid.HasValue) @@ -20,72 +20,72 @@ public abstract class BootstrapInputBase : ValidateBase .Build(); /// - /// 元素实例引用 + /// Gets or sets Element reference instance /// protected ElementReference FocusElement { get; set; } /// - /// 获得/设置 input 类型 placeholder 属性 + /// Gets or sets the placeholder attribute value /// [Parameter] public string? PlaceHolder { get; set; } /// - /// 获得/设置 文本框 Enter 键回调委托方法 默认为 null + /// Gets or sets the callback method for Enter key press, default is null /// [Parameter] public Func? OnEnterAsync { get; set; } /// - /// 获得/设置 文本框 Esc 键回调委托方法 默认为 null + /// Gets or sets the callback method for Esc key press, default is null /// [Parameter] public Func? OnEscAsync { get; set; } /// - /// 获得/设置 按钮颜色 + /// Gets or sets the button color /// [Parameter] public Color Color { get; set; } = Color.None; /// - /// 获得/设置 格式化字符串 + /// Gets or sets the formatter function /// [Parameter] public Func? Formatter { get; set; } /// - /// 获得/设置 格式化字符串 如时间类型设置 yyyy-MM-dd + /// Gets or sets the format string, e.g., "yyyy-MM-dd" for date types /// [Parameter] public string? FormatString { get; set; } /// - /// 获得/设置 是否自动获取焦点 默认 false 不自动获取焦点 + /// Gets or sets whether to automatically focus, default is false /// [Parameter] public bool IsAutoFocus { get; set; } /// - /// 获得/设置 获得焦点后自动选择输入框内所有字符串 默认 false 未启用 + /// Gets or sets whether to automatically select all text on focus, default is false /// [Parameter] public bool IsSelectAllTextOnFocus { get; set; } /// - /// 获得/设置 Enter 键自动选择输入框内所有字符串 默认 false 未启用 + /// Gets or sets whether to automatically select all text on Enter key press, default is false /// [Parameter] public bool IsSelectAllTextOnEnter { get; set; } /// - /// 获得/设置 是否自动修剪空白 默认 false 未启用 + /// Gets or sets whether to automatically trim whitespace, default is false /// [Parameter] public bool IsTrim { get; set; } /// - /// 获得/设置 失去焦点回调方法 默认 null + /// Gets or sets the callback method for blur event, default is null /// [Parameter] public Func? OnBlurAsync { get; set; } @@ -94,24 +94,24 @@ public abstract class BootstrapInputBase : ValidateBase private Modal? Modal { get; set; } /// - /// 获得 input 组件类型 默认 text + /// Gets the input type, default is "text" /// protected string Type { get; set; } = "text"; /// - /// 自动获得焦点方法 + /// Method to focus the element /// /// public async Task FocusAsync() => await FocusElement.FocusAsync(); /// - /// 全选文字 + /// Method to select all text /// /// public async ValueTask SelectAllTextAsync() => await InvokeVoidAsync("select", Id); /// - /// 获得/设置 是否不注册 js 脚本处理 Enter/ESC 键盘处理函数 默认 false + /// Gets or sets whether to skip JS script registration for Enter/Esc key handling, default is false /// protected bool SkipRegisterEnterEscJSInvoke { get; set; } @@ -173,12 +173,12 @@ protected override async Task OnAfterRenderAsync(bool firstRender) } /// - /// 获得输入框 Id + /// Gets the input element Id /// protected virtual string? GetInputId() => Id; /// - /// 数值格式化委托方法 + /// Value formatting delegate method /// /// /// @@ -198,7 +198,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender) protected override bool TryParseValueFromString(string value, [MaybeNullWhen(false)] out TValue result, out string? validationErrorMessage) => base.TryParseValueFromString(IsTrim ? value.Trim() : value, out result, out validationErrorMessage); /// - /// OnBlur 方法 + /// OnBlur method /// protected virtual async Task OnBlur() { @@ -209,7 +209,7 @@ protected virtual async Task OnBlur() } /// - /// 客户端 EnterCallback 回调方法 + /// Client-side EnterCallback method /// /// [JSInvokable] @@ -223,7 +223,7 @@ public async Task EnterCallback(string val) } /// - /// 客户端 EscCallback 回调方法 + /// Client-side EscCallback method /// /// [JSInvokable] diff --git a/src/BootstrapBlazor/Components/Textarea/Textarea.razor.cs b/src/BootstrapBlazor/Components/Textarea/Textarea.razor.cs index 0a0f4380f51..54d8be133cc 100644 --- a/src/BootstrapBlazor/Components/Textarea/Textarea.razor.cs +++ b/src/BootstrapBlazor/Components/Textarea/Textarea.razor.cs @@ -6,42 +6,42 @@ namespace BootstrapBlazor.Components; /// -/// Textarea 组件 +/// Textarea component /// public partial class Textarea { /// - /// 滚动到顶部 + /// Scroll to the top /// /// public Task ScrollToTop() => InvokeVoidAsync("execute", Id, "toTop"); /// - /// 滚动到数值 + /// Scroll to a specific value /// /// public Task ScrollTo(int value) => InvokeVoidAsync("execute", Id, "to", value); /// - /// 滚动到底部 + /// Scroll to the bottom /// /// public Task ScrollToBottom() => InvokeVoidAsync("execute", Id, "toBottom"); /// - /// 获得/设置 是否自动滚屏 默认 false + /// Gets or sets whether auto-scroll is enabled. Default is false. /// [Parameter] public bool IsAutoScroll { get; set; } /// - /// 获得/设置 是否使用 Shift + Enter 代替原回车按键行为 默认为 false + /// Gets or sets whether Shift + Enter replaces the default Enter key behavior. Default is false. /// [Parameter] public bool UseShiftEnter { get; set; } /// - /// 获得 客户端是否自动滚屏标识 + /// Gets the client-side auto-scroll identifier. /// private string? AutoScrollString => IsAutoScroll ? "auto" : null;