条件エディタ追加

This commit is contained in:
2024-01-22 10:52:55 +09:00
parent 276e5e9122
commit 5cd6d02f6e
29 changed files with 1209 additions and 382 deletions

View File

@@ -0,0 +1,69 @@
import { actionAddins } from ".";
import { IAction,IActionResult, IActionNode, IActionProperty, IField } from "../types/ActionTypes";
/**
* アクションの属性定義
*/
interface IShownProps{
field:IField;
show:string;
}
/**
* 表示/非表示アクション
*/
export class FieldShownAction implements IAction{
name: string;
actionProps: IActionProperty[];
props:IShownProps;
constructor(){
this.name="表示/非表示";
this.actionProps=[];
this.register();
this.props={
field:{code:''},
show:''
}
this.register();
}
/**
* アクションの実行を呼び出す
* @param actionNode
* @param event
* @returns
*/
async process(actionNode:IActionNode,event:any):Promise<IActionResult> {
let result={
canNext:true,
result:false
};
try{
this.actionProps=actionNode.actionProps;
if (!('field' in actionNode.ActionValue) && !('show' in actionNode.ActionValue)) {
return result
}
this.props = actionNode.ActionValue as IShownProps;
if(this.props.show==='表示'){
kintone.app.record.setFieldShown(this.props.field.code,true);
}else if (this.props.show==='非表示'){
kintone.app.record.setFieldShown(this.props.field.code,false);
}
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 FieldShownAction();

View File

@@ -2,6 +2,7 @@
import { actionAddins } from "../actions";
import '../actions/must-input';
import '../actions/auto-numbering';
import '../actions/field-shown';
import { ActionFlow,IActionFlow, IActionResult } from "./ActionTypes";
export class ActionProcess{