Merged PR 39: feat 236(全角チェック),284(半角チェック)

コンポーネントの改修

Related work items: #236, #284
This commit is contained in:
Kanaru Tsuda
2024-06-13 06:32:02 +00:00
committed by Takuto Yoshida(タクト)
2 changed files with 6 additions and 9 deletions

View File

@@ -79,7 +79,7 @@ export class FullWidthAction implements IAction{
containsFullWidthChars(text: string): boolean { containsFullWidthChars(text: string): boolean {
// 半角英数字カナ記号を除外 // 半角英数字カナ記号を除外
const checkRegex="[^\x01-\x7E\uFF61-\uFF9F]"; const checkRegex="^[^\x01-\x7E\uFF61-\uFF9F]+$";
//正規表現オブジェクト生成 //正規表現オブジェクト生成
const fullWidthRegex = new RegExp(checkRegex); const fullWidthRegex = new RegExp(checkRegex);

View File

@@ -18,7 +18,6 @@ export class HalfWidthAction implements IAction{
this.name="半角チェック"; /* pgadminのnameと同様 */ this.name="半角チェック"; /* pgadminのnameと同様 */
this.actionProps=[]; this.actionProps=[];
this.props={ this.props={
//checkOption:[],
field:{code:''} field:{code:''}
} }
//アクションを登録する //アクションを登録する
@@ -51,7 +50,7 @@ export class HalfWidthAction implements IAction{
return result; return result;
} }
//全角が含まれていた場合保存処理中止(エラー処理) //全角が含まれていた場合保存処理中止(エラー処理)
if(this.containsHalfWidthChars(value)){ if(!this.containsHalfWidthChars(value)){
//エラー時に出力される文字設定 //エラー時に出力される文字設定
record[this.props.field.code].error="全角が含まれています"; record[this.props.field.code].error="全角が含まれています";
//次の処理を中止する値設定 //次の処理を中止する値設定
@@ -76,9 +75,7 @@ export class HalfWidthAction implements IAction{
// 全て全角の文字列の場合はtrue、そうでない場合はfalse // 全て全角の文字列の場合はtrue、そうでない場合はfalse
containsHalfWidthChars(text: string): boolean { containsHalfWidthChars(text: string): boolean {
//半角英数字カナ記号を除外、対象フィールドすべてに適応 const checkRegex = "^[\x01-\x7E\uFF61-\uFF9F]+$";
// 全角文字 ^\x01-\x7E
const checkRegex="^[^\x01-\x7E\uFF61-\uFF9F]+$";
//正規表現オブジェクト生成 //正規表現オブジェクト生成
const halfWidthRegex = new RegExp(checkRegex); const halfWidthRegex = new RegExp(checkRegex);