From ef47912c372c3cc15b1f0324eb5ac695902ee925 Mon Sep 17 00:00:00 2001 From: kanarutsuda <–Kanaru.Tsuda@jp.ricoh.com> Date: Wed, 12 Jun 2024 15:25:50 +0900 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20#380=20=E5=8D=8A=E8=A7=92=E3=83=81?= =?UTF-8?q?=E3=82=A7=E3=83=83=E3=82=AF=20=E6=8C=87=E5=AE=9A=E3=81=97?= =?UTF-8?q?=E3=81=9F=E3=83=95=E3=82=A3=E3=83=BC=E3=83=AB=E3=83=89=E3=81=8C?= =?UTF-8?q?=E5=8D=8A=E8=A7=92=E3=81=8B=E3=81=A9=E3=81=86=E3=81=8B=E5=88=A4?= =?UTF-8?q?=E5=AE=9A=E3=81=99=E3=82=8B(=E5=85=A8=E8=A7=92=E3=81=8C1?= =?UTF-8?q?=E6=96=87=E5=AD=97=E3=81=A7=E3=82=82=E5=90=AB=E3=81=BE=E3=82=8C?= =?UTF-8?q?=E3=81=A6=E3=81=84=E3=81=9F=E3=82=89=E3=82=A8=E3=83=A9=E3=83=BC?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/core/config.py | 2 +- .../src/actions/validation fullwidth.ts | 20 ++-- .../src/actions/validation halfwidth.ts | 93 +++++++++++++++++++ .../src/types/action-process.ts | 2 + 4 files changed, 103 insertions(+), 14 deletions(-) create mode 100644 plugin/kintone-addins/src/actions/validation halfwidth.ts diff --git a/backend/app/core/config.py b/backend/app/core/config.py index c398f6b..c1e3db8 100644 --- a/backend/app/core/config.py +++ b/backend/app/core/config.py @@ -13,7 +13,7 @@ API_V1_AUTH_KEY = "X-Cybozu-Authorization" DEPLOY_MODE = "DEV" #DEV,PROD DEPLOY_JS_URL = "https://ka-addin.azurewebsites.net/alc_runtime.js" -#DEPLOY_JS_URL = "https://e84c-133-139-70-142.ngrok-free.app/alc_runtime.js" +#DEPLOY_JS_URL = "https://ce1c-133-139-70-194.ngrok-free.app/alc_runtime.js" KINTONE_FIELD_TYPE=["GROUP","GROUP_SELECT","CHECK_BOX","SUBTABLE","DROP_DOWN","USER_SELECT","RADIO_BUTTON","RICH_TEXT","LINK","REFERENCE_TABLE","CALC","TIME","NUMBER","ORGANIZATION_SELECT","FILE","DATETIME","DATE","MULTI_SELECT","SINGLE_LINE_TEXT","MULTI_LINE_TEXT"] diff --git a/plugin/kintone-addins/src/actions/validation fullwidth.ts b/plugin/kintone-addins/src/actions/validation fullwidth.ts index 98a8f80..0b83d38 100644 --- a/plugin/kintone-addins/src/actions/validation fullwidth.ts +++ b/plugin/kintone-addins/src/actions/validation fullwidth.ts @@ -66,6 +66,7 @@ export class FullWidthAction implements IAction{ result:true } return result; + //例外処理 }catch(error){ event.error=error; @@ -76,24 +77,17 @@ export class FullWidthAction implements IAction{ } //全て全角の文字列の場合はtrue、そうでない場合はfalse containsFullWidthChars(text: string): boolean { - //半角英数字カナを除外 - const checkRegex="^[^\x01-\x7E\uFF61-\uFF9F]+$"; + + //半角英数字カナ記号を除外 + const checkRegex="[^\x01-\x7E\uFF61-\uFF9F]"; + //正規表現オブジェクト生成 const fullWidthRegex = new RegExp(checkRegex); - + //正規表現チェック return fullWidthRegex.test(text); - - //全角を表すUnicodeの全角正規表現(参照先URL) - // \u3000-\u303F:句読点・記号 - // \u3040-\u309F:すべてのひらがな - // \u30A0-\u30FF:すべてのカタカナ - // \u4E00-\u9FAF:すべての漢字 - // \uFF00-\uFFEF:全角英数字と半角カタカナ - // \u3400-\u4DBF:CJK統合漢字拡張 - //const fullWidthRegex = /[/^[\u3000-\u303F\u3040-\u309F\u30A0-\u30FF\uFF00-\uFFEF\u4E00-\u9FAF\u3400-\u4DBF]+$/g; - } + //戻り値を持たないためvoid型 register(): void { actionAddins[this.name]=this; diff --git a/plugin/kintone-addins/src/actions/validation halfwidth.ts b/plugin/kintone-addins/src/actions/validation halfwidth.ts new file mode 100644 index 0000000..1ddc7dc --- /dev/null +++ b/plugin/kintone-addins/src/actions/validation halfwidth.ts @@ -0,0 +1,93 @@ +import { actionAddins } from "."; +import { IAction,IActionResult, IActionNode, IActionProperty, IField, IContext } from "../types/ActionTypes"; + +/** + * アクションの属性定義 + */ + interface HalfWidthProps{ + field:IField + } +/** + * 半角チェックアクション + */ +export class HalfWidthAction implements IAction{ + name: string; + actionProps: IActionProperty[]; + props:HalfWidthProps; + constructor(){ + this.name="半角チェック"; /* pgadminのnameと同様 */ + this.actionProps=[]; + this.props={ + //checkOption:[], + field:{code:''} + } + //アクションを登録する + this.register(); + } + /** + * アクションの実行を呼び出す + * @param actionNode + * @param event + * @returns + */ + async process(actionNode:IActionNode,event:any,context:IContext):Promise { + let result={ + canNext:true, + result:false + }; + try{ + //属性設定を取得する + this.actionProps=actionNode.actionProps; + if (!('field' in actionNode.ActionValue) ) { + return result + } + this.props = actionNode.ActionValue as HalfWidthProps; + //条件式の計算結果を取得 + const record = event.record; + const value = record[this.props.field.code]?.value; + //条件分岐 + //未入力時は何も処理をせず終了 + if(value===undefined || value===''){ + return result; + } + //全角が含まれていた場合保存処理中止(エラー処理) + if(this.containsHalfWidthChars(value)){ + //エラー時に出力される文字設定 + record[this.props.field.code].error="全角が含まれています"; + //次の処理を中止する値設定 + result.canNext=false; + return result; + } + //半角の場合問題なく実行 + //resultプロパティ指定 + result= { + canNext:true, + result:true + } + return result; + //例外処理 + }catch(error){ + event.error=error; + console.error(error); + result.canNext=false; + return result; + } + } + //全て全角の文字列の場合はtrue、そうでない場合はfalse + containsHalfWidthChars(text: string): boolean { + + //半角英数字カナ記号を除外、対象フィールドすべてに適応 + // 全角文字 ^\x01-\x7E + const checkRegex="^[^\x01-\x7E\uFF61-\uFF9F]+$"; + //正規表現オブジェクト生成 + const halfWidthRegex = new RegExp(checkRegex); + + //正規表現チェック + return halfWidthRegex.test(text); + } + //戻り値を持たないためvoid型 + register(): void { + actionAddins[this.name]=this; + } +} +new HalfWidthAction(); \ No newline at end of file diff --git a/plugin/kintone-addins/src/types/action-process.ts b/plugin/kintone-addins/src/types/action-process.ts index 7f40fd8..5a2b9dd 100644 --- a/plugin/kintone-addins/src/types/action-process.ts +++ b/plugin/kintone-addins/src/types/action-process.ts @@ -14,6 +14,8 @@ import '../actions/insert-value'; import '../actions/value-getter'; import '../actions/string-join'; import '../actions/validation fullwidth'; +import '../actions/validation halfwidth'; + import { ActionFlow,IActionFlow, IActionResult,IContext } from "./ActionTypes"; export class ActionProcess{ From 7b1daaab33573dd2f7637043aecfd6a09c945212 Mon Sep 17 00:00:00 2001 From: kanarutsuda <–Kanaru.Tsuda@jp.ricoh.com> Date: Wed, 12 Jun 2024 15:55:38 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E5=90=8D=E3=81=AE=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/actions/validation-fullwidth.ts | 96 +++++++++++++++++++ .../src/actions/validation-halfwidth.ts | 93 ++++++++++++++++++ 2 files changed, 189 insertions(+) create mode 100644 plugin/kintone-addins/src/actions/validation-fullwidth.ts create mode 100644 plugin/kintone-addins/src/actions/validation-halfwidth.ts diff --git a/plugin/kintone-addins/src/actions/validation-fullwidth.ts b/plugin/kintone-addins/src/actions/validation-fullwidth.ts new file mode 100644 index 0000000..0b83d38 --- /dev/null +++ b/plugin/kintone-addins/src/actions/validation-fullwidth.ts @@ -0,0 +1,96 @@ +import { actionAddins } from "."; +import { IAction,IActionResult, IActionNode, IActionProperty, IField, IContext } from "../types/ActionTypes"; + +//クラス名を設計書に揃える +/** + * アクションの属性定義 + */ + interface FullWidthProps{ + //checkOption:Array, + field:IField + } +/** + * 全角チェックアクション + */ +export class FullWidthAction implements IAction{ + name: string; + actionProps: IActionProperty[]; + props:FullWidthProps; + constructor(){ + this.name="全角チェック"; /* pgadminのnameと同様 */ + this.actionProps=[]; + this.props={ + //checkOption:[], + field:{code:''} + } + //アクションを登録する + this.register(); + } + /** + * アクションの実行を呼び出す + * @param actionNode + * @param event + * @returns + */ + async process(actionNode:IActionNode,event:any,context:IContext):Promise { + let result={ + canNext:true, + result:false + }; + try{ + //属性設定を取得する + this.actionProps=actionNode.actionProps; + if (!('field' in actionNode.ActionValue) ) { + return result + } + this.props = actionNode.ActionValue as FullWidthProps; + //条件式の計算結果を取得 + const record = event.record; + const value = record[this.props.field.code]?.value; + //条件分岐 + //未入力時は何も処理をせず終了 + if(value===undefined || value===''){ + return result; + } + //半角が含まれていた場合resultがfalse + if(!this.containsFullWidthChars(value)){ + //エラー時に出力される文字設定 + record[this.props.field.code].error="半角が含まれています"; + //次の処理を中止する値設定 + result.canNext=false; + return result; + } + //resultプロパティ指定 + result= { + canNext:true, + result:true + } + return result; + + //例外処理 + }catch(error){ + event.error=error; + console.error(error); + result.canNext=false; + return result; + } + } + //全て全角の文字列の場合はtrue、そうでない場合はfalse + containsFullWidthChars(text: string): boolean { + + //半角英数字カナ記号を除外 + const checkRegex="[^\x01-\x7E\uFF61-\uFF9F]"; + + //正規表現オブジェクト生成 + const fullWidthRegex = new RegExp(checkRegex); + + //正規表現チェック + return fullWidthRegex.test(text); + } + + //戻り値を持たないためvoid型 + register(): void { + actionAddins[this.name]=this; + } +} +new FullWidthAction(); \ No newline at end of file diff --git a/plugin/kintone-addins/src/actions/validation-halfwidth.ts b/plugin/kintone-addins/src/actions/validation-halfwidth.ts new file mode 100644 index 0000000..1ddc7dc --- /dev/null +++ b/plugin/kintone-addins/src/actions/validation-halfwidth.ts @@ -0,0 +1,93 @@ +import { actionAddins } from "."; +import { IAction,IActionResult, IActionNode, IActionProperty, IField, IContext } from "../types/ActionTypes"; + +/** + * アクションの属性定義 + */ + interface HalfWidthProps{ + field:IField + } +/** + * 半角チェックアクション + */ +export class HalfWidthAction implements IAction{ + name: string; + actionProps: IActionProperty[]; + props:HalfWidthProps; + constructor(){ + this.name="半角チェック"; /* pgadminのnameと同様 */ + this.actionProps=[]; + this.props={ + //checkOption:[], + field:{code:''} + } + //アクションを登録する + this.register(); + } + /** + * アクションの実行を呼び出す + * @param actionNode + * @param event + * @returns + */ + async process(actionNode:IActionNode,event:any,context:IContext):Promise { + let result={ + canNext:true, + result:false + }; + try{ + //属性設定を取得する + this.actionProps=actionNode.actionProps; + if (!('field' in actionNode.ActionValue) ) { + return result + } + this.props = actionNode.ActionValue as HalfWidthProps; + //条件式の計算結果を取得 + const record = event.record; + const value = record[this.props.field.code]?.value; + //条件分岐 + //未入力時は何も処理をせず終了 + if(value===undefined || value===''){ + return result; + } + //全角が含まれていた場合保存処理中止(エラー処理) + if(this.containsHalfWidthChars(value)){ + //エラー時に出力される文字設定 + record[this.props.field.code].error="全角が含まれています"; + //次の処理を中止する値設定 + result.canNext=false; + return result; + } + //半角の場合問題なく実行 + //resultプロパティ指定 + result= { + canNext:true, + result:true + } + return result; + //例外処理 + }catch(error){ + event.error=error; + console.error(error); + result.canNext=false; + return result; + } + } + //全て全角の文字列の場合はtrue、そうでない場合はfalse + containsHalfWidthChars(text: string): boolean { + + //半角英数字カナ記号を除外、対象フィールドすべてに適応 + // 全角文字 ^\x01-\x7E + const checkRegex="^[^\x01-\x7E\uFF61-\uFF9F]+$"; + //正規表現オブジェクト生成 + const halfWidthRegex = new RegExp(checkRegex); + + //正規表現チェック + return halfWidthRegex.test(text); + } + //戻り値を持たないためvoid型 + register(): void { + actionAddins[this.name]=this; + } +} +new HalfWidthAction(); \ No newline at end of file From 6ab668f86a3ccfebdc240fadc4964a5dca1067e8 Mon Sep 17 00:00:00 2001 From: kanarutsuda <–Kanaru.Tsuda@jp.ricoh.com> Date: Wed, 12 Jun 2024 16:13:32 +0900 Subject: [PATCH 3/4] =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E5=90=8D=E3=81=AE=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/kintone-addins/src/types/action-process.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/kintone-addins/src/types/action-process.ts b/plugin/kintone-addins/src/types/action-process.ts index 5a2b9dd..26e7afb 100644 --- a/plugin/kintone-addins/src/types/action-process.ts +++ b/plugin/kintone-addins/src/types/action-process.ts @@ -13,8 +13,8 @@ import '../actions/datetime-getter'; import '../actions/insert-value'; import '../actions/value-getter'; import '../actions/string-join'; -import '../actions/validation fullwidth'; -import '../actions/validation halfwidth'; +import '../actions/validation-fullwidth'; +import '../actions/validation-halfwidth'; import { ActionFlow,IActionFlow, IActionResult,IContext } from "./ActionTypes"; From 3b56c78bf191fc19e46695b6f38cb526e5568d22 Mon Sep 17 00:00:00 2001 From: kanarutsuda <–Kanaru.Tsuda@jp.ricoh.com> Date: Wed, 12 Jun 2024 16:37:14 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E5=90=8D=E5=A4=89=E6=9B=B4(=E5=89=8A=E9=99=A4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/actions/validation fullwidth.ts | 96 ------------------- .../src/actions/validation halfwidth.ts | 93 ------------------ 2 files changed, 189 deletions(-) delete mode 100644 plugin/kintone-addins/src/actions/validation fullwidth.ts delete mode 100644 plugin/kintone-addins/src/actions/validation halfwidth.ts diff --git a/plugin/kintone-addins/src/actions/validation fullwidth.ts b/plugin/kintone-addins/src/actions/validation fullwidth.ts deleted file mode 100644 index 0b83d38..0000000 --- a/plugin/kintone-addins/src/actions/validation fullwidth.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { actionAddins } from "."; -import { IAction,IActionResult, IActionNode, IActionProperty, IField, IContext } from "../types/ActionTypes"; - -//クラス名を設計書に揃える -/** - * アクションの属性定義 - */ - interface FullWidthProps{ - //checkOption:Array, - field:IField - } -/** - * 全角チェックアクション - */ -export class FullWidthAction implements IAction{ - name: string; - actionProps: IActionProperty[]; - props:FullWidthProps; - constructor(){ - this.name="全角チェック"; /* pgadminのnameと同様 */ - this.actionProps=[]; - this.props={ - //checkOption:[], - field:{code:''} - } - //アクションを登録する - this.register(); - } - /** - * アクションの実行を呼び出す - * @param actionNode - * @param event - * @returns - */ - async process(actionNode:IActionNode,event:any,context:IContext):Promise { - let result={ - canNext:true, - result:false - }; - try{ - //属性設定を取得する - this.actionProps=actionNode.actionProps; - if (!('field' in actionNode.ActionValue) ) { - return result - } - this.props = actionNode.ActionValue as FullWidthProps; - //条件式の計算結果を取得 - const record = event.record; - const value = record[this.props.field.code]?.value; - //条件分岐 - //未入力時は何も処理をせず終了 - if(value===undefined || value===''){ - return result; - } - //半角が含まれていた場合resultがfalse - if(!this.containsFullWidthChars(value)){ - //エラー時に出力される文字設定 - record[this.props.field.code].error="半角が含まれています"; - //次の処理を中止する値設定 - result.canNext=false; - return result; - } - //resultプロパティ指定 - result= { - canNext:true, - result:true - } - return result; - - //例外処理 - }catch(error){ - event.error=error; - console.error(error); - result.canNext=false; - return result; - } - } - //全て全角の文字列の場合はtrue、そうでない場合はfalse - containsFullWidthChars(text: string): boolean { - - //半角英数字カナ記号を除外 - const checkRegex="[^\x01-\x7E\uFF61-\uFF9F]"; - - //正規表現オブジェクト生成 - const fullWidthRegex = new RegExp(checkRegex); - - //正規表現チェック - return fullWidthRegex.test(text); - } - - //戻り値を持たないためvoid型 - register(): void { - actionAddins[this.name]=this; - } -} -new FullWidthAction(); \ No newline at end of file diff --git a/plugin/kintone-addins/src/actions/validation halfwidth.ts b/plugin/kintone-addins/src/actions/validation halfwidth.ts deleted file mode 100644 index 1ddc7dc..0000000 --- a/plugin/kintone-addins/src/actions/validation halfwidth.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { actionAddins } from "."; -import { IAction,IActionResult, IActionNode, IActionProperty, IField, IContext } from "../types/ActionTypes"; - -/** - * アクションの属性定義 - */ - interface HalfWidthProps{ - field:IField - } -/** - * 半角チェックアクション - */ -export class HalfWidthAction implements IAction{ - name: string; - actionProps: IActionProperty[]; - props:HalfWidthProps; - constructor(){ - this.name="半角チェック"; /* pgadminのnameと同様 */ - this.actionProps=[]; - this.props={ - //checkOption:[], - field:{code:''} - } - //アクションを登録する - this.register(); - } - /** - * アクションの実行を呼び出す - * @param actionNode - * @param event - * @returns - */ - async process(actionNode:IActionNode,event:any,context:IContext):Promise { - let result={ - canNext:true, - result:false - }; - try{ - //属性設定を取得する - this.actionProps=actionNode.actionProps; - if (!('field' in actionNode.ActionValue) ) { - return result - } - this.props = actionNode.ActionValue as HalfWidthProps; - //条件式の計算結果を取得 - const record = event.record; - const value = record[this.props.field.code]?.value; - //条件分岐 - //未入力時は何も処理をせず終了 - if(value===undefined || value===''){ - return result; - } - //全角が含まれていた場合保存処理中止(エラー処理) - if(this.containsHalfWidthChars(value)){ - //エラー時に出力される文字設定 - record[this.props.field.code].error="全角が含まれています"; - //次の処理を中止する値設定 - result.canNext=false; - return result; - } - //半角の場合問題なく実行 - //resultプロパティ指定 - result= { - canNext:true, - result:true - } - return result; - //例外処理 - }catch(error){ - event.error=error; - console.error(error); - result.canNext=false; - return result; - } - } - //全て全角の文字列の場合はtrue、そうでない場合はfalse - containsHalfWidthChars(text: string): boolean { - - //半角英数字カナ記号を除外、対象フィールドすべてに適応 - // 全角文字 ^\x01-\x7E - const checkRegex="^[^\x01-\x7E\uFF61-\uFF9F]+$"; - //正規表現オブジェクト生成 - const halfWidthRegex = new RegExp(checkRegex); - - //正規表現チェック - return halfWidthRegex.test(text); - } - //戻り値を持たないためvoid型 - register(): void { - actionAddins[this.name]=this; - } -} -new HalfWidthAction(); \ No newline at end of file