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