From 371ec3a13314383e2b1b5126481feca183f2272f Mon Sep 17 00:00:00 2001 From: wtl Date: Thu, 30 May 2024 15:14:54 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=A1=E3=83=BC=E3=83=AB=E3=83=81=E3=82=A7?= =?UTF-8?q?=E3=83=83=E3=82=AF=E3=82=A4=E3=83=B3=E3=82=BF=E3=83=BC=E3=83=95?= =?UTF-8?q?=E3=82=A7=E3=83=BC=E3=82=B9=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/kintone-addins/src/actions/mail-check.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/plugin/kintone-addins/src/actions/mail-check.ts b/plugin/kintone-addins/src/actions/mail-check.ts index 02e063f..b1ed8cc 100644 --- a/plugin/kintone-addins/src/actions/mail-check.ts +++ b/plugin/kintone-addins/src/actions/mail-check.ts @@ -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; }