!3673 fix(#I65Z0J): can input Enter on textarea element on ValilidateFrom set DisableAutoSubmitFormByEnter to true

* chore: bump version 7.1.9-beta03
* feat: 增加动态脚本
* chore: 增加隔离脚本 validate-form.js
* chore: 移除禁用回车脚本准备使用脚本隔离
This commit is contained in:
Argo 2022-12-25 08:28:47 +00:00
parent e303ed5105
commit 521ac4e840
9 changed files with 29 additions and 28 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<Version>7.1.9-beta02</Version>
<Version>7.1.9-beta03</Version>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">

View File

@ -1,5 +1,5 @@
@namespace BootstrapBlazor.Components
@inherits IdComponentBase
@inherits BootstrapModuleComponentBase
@if (Model != null)
{

View File

@ -15,6 +15,7 @@ namespace BootstrapBlazor.Components;
/// <summary>
/// ValidateForm 组件类
/// </summary>
[JSModuleAutoLoader("validate-form")]
public partial class ValidateForm
{
/// <summary>

View File

@ -835,14 +835,6 @@
addLink: addLink,
removeLink: removeLink
};
$(function () {
$(document).on('keydown', 'form', function (e) {
if (e.keyCode == 13) {
return $(this).attr('data-bb-dissubmit') !== 'true';
}
});
});
})(jQuery);
(function ($) {

File diff suppressed because one or more lines are too long

View File

@ -18784,14 +18784,6 @@ return jQuery;
addLink: addLink,
removeLink: removeLink
};
$(function () {
$(document).on('keydown', 'form', function (e) {
if (e.keyCode == 13) {
return $(this).attr('data-bb-dissubmit') !== 'true';
}
});
});
})(jQuery);
(function ($) {

File diff suppressed because one or more lines are too long

View File

@ -235,12 +235,4 @@
addLink: addLink,
removeLink: removeLink
};
$(function () {
$(document).on('keydown', 'form', function (e) {
if (e.keyCode == 13) {
return $(this).attr('data-bb-dissubmit') !== 'true';
}
});
});
})(jQuery);

View File

@ -0,0 +1,24 @@
import BlazorComponent from "./base/blazor-component.js"
import EventHandler from "./base/event-handler.js"
export class ValidateForm extends BlazorComponent {
_init() {
this._setListeners()
}
_setListeners() {
EventHandler.on(this._element, 'keydown', e => {
if (e.target.nodeName !== 'TEXTAREA') {
const dissubmit = this._element.getAttribute('data-bb-dissubmit') === 'true'
if (e.keyCode === 13 && dissubmit) {
e.preventDefault()
e.stopPropagation()
}
}
})
}
_dispose() {
EventHandler.off(this._element, 'keydown')
}
}