Merged PR 49: Bug 518,519 feat 236,284 全半角チェックのバグ修正の為のコード再構築
Bug 518,519 feat 236,284 全半角チェックのバグ修正の為のコード再構築 エラーメッセージの正常時に表示されていたバグの解消 Related work items: #236, #284, #518, #519
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
import { actionAddins } from ".";
|
||||
import { IAction,IActionResult, IActionNode, IActionProperty, IField, IContext } from "../types/ActionTypes";
|
||||
|
||||
//クラス名を設計書に揃える
|
||||
/**
|
||||
* アクションの属性定義
|
||||
*/
|
||||
interface FullWidthProps{
|
||||
//checkOption:Array<string>,
|
||||
field:IField
|
||||
}
|
||||
/**
|
||||
@@ -20,7 +18,6 @@ export class FullWidthAction implements IAction{
|
||||
this.name="全角チェック"; /* pgadminのnameと同様 */
|
||||
this.actionProps=[];
|
||||
this.props={
|
||||
//checkOption:[],
|
||||
field:{code:''}
|
||||
}
|
||||
//アクションを登録する
|
||||
@@ -50,15 +47,17 @@ export class FullWidthAction implements IAction{
|
||||
//条件分岐
|
||||
//未入力時は何も処理をせず終了
|
||||
if(value===undefined || value===''){
|
||||
return result;
|
||||
record[this.props.field.code].error=null;
|
||||
}
|
||||
//半角が含まれていた場合resultがfalse
|
||||
if(!this.containsFullWidthChars(value)){
|
||||
if(!this.containsFullWidthChars(value) && !(value === undefined || value ==='')){
|
||||
//エラー時に出力される文字設定
|
||||
record[this.props.field.code].error="半角が含まれています";
|
||||
//次の処理を中止する値設定
|
||||
result.canNext=false;
|
||||
return result;
|
||||
}
|
||||
else{
|
||||
record[this.props.field.code].error=null;
|
||||
}
|
||||
//resultプロパティ指定
|
||||
result= {
|
||||
@@ -79,6 +78,7 @@ export class FullWidthAction implements IAction{
|
||||
containsFullWidthChars(text: string): boolean {
|
||||
|
||||
// 半角英数字カナ記号を除外
|
||||
//全角かどうか
|
||||
const checkRegex="^[^\x01-\x7E\uFF61-\uFF9F]+$";
|
||||
|
||||
//正規表現オブジェクト生成
|
||||
|
||||
@@ -47,7 +47,7 @@ export class HalfWidthAction implements IAction{
|
||||
//条件分岐
|
||||
//未入力時は何も処理をせず終了
|
||||
if(value===undefined || value===''){
|
||||
return result;
|
||||
record[this.props.field.code].error=null;
|
||||
}
|
||||
//全角が含まれていた場合保存処理中止(エラー処理)
|
||||
if(!this.containsHalfWidthChars(value)){
|
||||
@@ -55,7 +55,9 @@ export class HalfWidthAction implements IAction{
|
||||
record[this.props.field.code].error="全角が含まれています";
|
||||
//次の処理を中止する値設定
|
||||
result.canNext=false;
|
||||
return result;
|
||||
}
|
||||
else{
|
||||
record[this.props.field.code].error=null;
|
||||
}
|
||||
//半角の場合問題なく実行
|
||||
//resultプロパティ指定
|
||||
|
||||
Reference in New Issue
Block a user