Kintone plugin 実装
This commit is contained in:
2
plugin/kintone-addins/src/actions/index.ts
Normal file
2
plugin/kintone-addins/src/actions/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { IAction } from "../types/ActionTypes";
|
||||
export const actionAddins :Record<string,IAction>={};
|
||||
53
plugin/kintone-addins/src/actions/must-input.ts
Normal file
53
plugin/kintone-addins/src/actions/must-input.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
|
||||
import { actionAddins } from ".";
|
||||
import { IAction,IActionResult, IActionNode, IActionProperty } from "../types/ActionTypes";
|
||||
|
||||
interface IMustInputProps{
|
||||
field:string;
|
||||
message:string;
|
||||
}
|
||||
|
||||
export class MustInputAction implements IAction{
|
||||
name: string;
|
||||
actionProps: IActionProperty[];
|
||||
props:IMustInputProps;
|
||||
constructor(){
|
||||
this.name="必須チェック";
|
||||
this.actionProps=[];
|
||||
this.register();
|
||||
this.props={
|
||||
field:'',
|
||||
message:''
|
||||
}
|
||||
this.register();
|
||||
}
|
||||
|
||||
process(actionNode:IActionNode,event:any):IActionResult {
|
||||
let result={
|
||||
canNext:true,
|
||||
result:false
|
||||
};
|
||||
this.actionProps=actionNode.actionProps;
|
||||
if (!('field' in actionNode.ActionValue) && !('message' in actionNode.ActionValue)) {
|
||||
return result
|
||||
}
|
||||
this.props = actionNode.ActionValue as IMustInputProps;
|
||||
const record = event.record;
|
||||
const value = record[this.props.field]?.value;
|
||||
if(value===undefined || value===''){
|
||||
record[this.props.field].error=this.props.message;
|
||||
return result;
|
||||
}
|
||||
result= {
|
||||
canNext:true,
|
||||
result:true
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
register(): void {
|
||||
actionAddins[this.name]=this;
|
||||
}
|
||||
|
||||
}
|
||||
new MustInputAction();
|
||||
Reference in New Issue
Block a user