diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 0000000..ddde0df --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "App Builder for kintone", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/plugin/kintone-addins/src/actions/value-getter.ts b/plugin/kintone-addins/src/actions/value-getter.ts new file mode 100644 index 0000000..03fd8f5 --- /dev/null +++ b/plugin/kintone-addins/src/actions/value-getter.ts @@ -0,0 +1,68 @@ +import { actionAddins } from "."; +import { IAction,IActionResult, IActionNode, IActionProperty, IField, IContext} from "../types/ActionTypes"; +/** + * アクションの属性定義 + */ +interface IGetValueProps{ + field:IField;//チェックするフィールドの対象 + verName:string; +} +/** + * 正規表現チェックアクション + */ +export class GetValueAciton implements IAction{ + name: string; + actionProps: IActionProperty[]; + props:IGetValueProps; + constructor(){ + this.name="値を取得する"; + this.actionProps=[]; + this.props={ + field:{code:''}, + verName:'' + } + //アクションを登録する + 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) && !('verName' in actionNode.ActionValue)) { + return result + } + + this.props = actionNode.ActionValue as IGetValueProps; + //条件式の計算結果を取得 + const record = event.record; + const value = record[this.props.field.code].value; + context.variables[this.props.verName] = value; + result = { + canNext:true, + result:true + } + + return result; + }catch(error){ + event.error=error; + console.error(error); + result.canNext=false; + return result; + } + }; + register(): void { + actionAddins[this.name]=this; + } + +} +new GetValueAciton(); diff --git a/plugin/kintone-addins/src/types/action-process.ts b/plugin/kintone-addins/src/types/action-process.ts index 130e2a9..2f11c4b 100644 --- a/plugin/kintone-addins/src/types/action-process.ts +++ b/plugin/kintone-addins/src/types/action-process.ts @@ -11,6 +11,8 @@ import '../actions/mail-check'; import '../actions/counter-check'; import '../actions/datetime-getter'; import '../actions/insert-value'; +import '../actions/value-getter'; + import { ActionFlow,IActionFlow, IActionResult,IContext } from "./ActionTypes"; export class ActionProcess{ @@ -44,7 +46,7 @@ export class ActionProcess{ result = await action.process(nextAction,this.event,this.context); } let nextInput = ''; - //outputPoints一つ以上の場合、次のInputPointは戻り値を設定する + //outputPoints一㝤以上㝮場坈〝次㝮InputPoint㝯戻り値を設定㝙る if(nextAction.outputPoints && nextAction.outputPoints.length>1){ nextInput = result.result||''; }