メールチェックインターフェース更新
This commit is contained in:
@@ -6,6 +6,7 @@ import { IAction, IActionResult, IActionNode, IActionProperty, IField } from "..
|
||||
interface IMailCheckProps {
|
||||
field: IField;//チェックするフィールドの対象
|
||||
message: string;//エラーメッセージ
|
||||
emailCheck:string;
|
||||
}
|
||||
/**
|
||||
* メールアドレスチェックアクション
|
||||
@@ -20,7 +21,7 @@ export class MailCheckAction implements IAction {
|
||||
this.props = {
|
||||
field: { code: '' },
|
||||
message: '',
|
||||
|
||||
emailCheck:''
|
||||
}
|
||||
//アクションを登録する
|
||||
this.register();
|
||||
@@ -37,14 +38,11 @@ export class MailCheckAction implements IAction {
|
||||
result: false
|
||||
};
|
||||
|
||||
|
||||
try {
|
||||
//属性設定を取得する
|
||||
this.actionProps = actionNode.actionProps;
|
||||
|
||||
const emailAction = this.actionProps.find(obj => obj.props.name === 'emailcheck')
|
||||
|
||||
if (!('field' in actionNode.ActionValue) && !('message' in actionNode.ActionValue) && !!!emailAction) {
|
||||
if (!('field' in actionNode.ActionValue) && !('message' in actionNode.ActionValue) && !('emailCheck' in actionNode.ActionValue)) {
|
||||
return result
|
||||
}
|
||||
this.props = actionNode.ActionValue as IMailCheckProps;
|
||||
@@ -52,11 +50,11 @@ export class MailCheckAction implements IAction {
|
||||
const record = event.record;
|
||||
const value = record[this.props.field.code].value;
|
||||
|
||||
if (emailAction?.props.modelValue === '厳格') {
|
||||
if (this.props.emailCheck === '厳格') {
|
||||
if (!/^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/.test(value)) {
|
||||
record[this.props.field.code].error = this.props.message;
|
||||
}
|
||||
} else if (emailAction?.props.modelValue === 'ゆるめ') {
|
||||
} else if (this.props.emailCheck === 'ゆるめ') {
|
||||
if (!/^[^@]+@[^@]+$/.test(value)) {
|
||||
record[this.props.field.code].error = this.props.message;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user