Merged PR 40: 変数定義の型はstring->IVarNameへ変更
変数定義の型を変更しました。 今後変数はオブジェクト型を対応可能のため、インターフェースを変更しました 下記のアクションを対応しました。 ・auto-numbering.ts ・datetime-getter.ts ・value-getter.ts ・condition-action.ts
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
import { actionAddins } from ".";
|
import { actionAddins } from ".";
|
||||||
import { IField, IAction,IActionResult, IActionNode, IActionProperty, IContext } from "../types/ActionTypes";
|
import { IField, IAction,IActionResult, IActionNode, IActionProperty, IContext, IVarName } from "../types/ActionTypes";
|
||||||
import { Formatter } from "../util/format";
|
import { Formatter } from "../util/format";
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
@@ -13,7 +13,7 @@ interface IAutoNumberingProps{
|
|||||||
format:string;
|
format:string;
|
||||||
prefix:string;
|
prefix:string;
|
||||||
suffix:string;
|
suffix:string;
|
||||||
verName:string;
|
verName:IVarName;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AutoNumbering implements IAction{
|
export class AutoNumbering implements IAction{
|
||||||
@@ -29,7 +29,7 @@ export class AutoNumbering implements IAction{
|
|||||||
format:'',
|
format:'',
|
||||||
prefix:'',
|
prefix:'',
|
||||||
suffix:'',
|
suffix:'',
|
||||||
verName:''
|
verName:{name:''}
|
||||||
}
|
}
|
||||||
globalThis.window.$format=this.format;
|
globalThis.window.$format=this.format;
|
||||||
this.register();
|
this.register();
|
||||||
@@ -56,8 +56,8 @@ export class AutoNumbering implements IAction{
|
|||||||
const docNum = await this.createNumber(this.props);
|
const docNum = await this.createNumber(this.props);
|
||||||
record[this.props.field.code].value=docNum;
|
record[this.props.field.code].value=docNum;
|
||||||
//変数設定
|
//変数設定
|
||||||
if(this.props.verName){
|
if(this.props.verName && this.props.verName.name!==''){
|
||||||
context.variables[this.props.verName]=docNum;
|
context.variables[this.props.verName.name]=docNum;
|
||||||
}
|
}
|
||||||
result= {
|
result= {
|
||||||
canNext:true,
|
canNext:true,
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
|
|
||||||
import { actionAddins } from ".";
|
import { actionAddins } from ".";
|
||||||
import { IAction,IActionResult, IActionNode, IActionProperty, IContext } from "../types/ActionTypes";
|
import { IAction,IActionResult, IActionNode, IActionProperty, IContext, IVarName } from "../types/ActionTypes";
|
||||||
import { ConditionTree } from '../types/Conditions';
|
import { ConditionTree } from '../types/Conditions';
|
||||||
/**
|
/**
|
||||||
* アクションの属性定義
|
* アクションの属性定義
|
||||||
*/
|
*/
|
||||||
interface ICondition{
|
interface ICondition{
|
||||||
condition:string;
|
condition:string;
|
||||||
verName:string;
|
verName:IVarName;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 条件分岐アクション
|
* 条件分岐アクション
|
||||||
@@ -21,7 +21,7 @@ export class ConditionAction implements IAction{
|
|||||||
this.actionProps=[];
|
this.actionProps=[];
|
||||||
this.props={
|
this.props={
|
||||||
condition:'',
|
condition:'',
|
||||||
verName:''
|
verName:{name:''}
|
||||||
}
|
}
|
||||||
//アクションを登録する
|
//アクションを登録する
|
||||||
this.register();
|
this.register();
|
||||||
@@ -58,8 +58,8 @@ export class ConditionAction implements IAction{
|
|||||||
result:'いいえ'
|
result:'いいえ'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(this.props.verName){
|
if(this.props.verName && this.props.verName.name!==''){
|
||||||
context.variables[this.props.verName]=result.result;
|
context.variables[this.props.verName.name]=result.result;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}catch(error){
|
}catch(error){
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { actionAddins } from ".";
|
import { actionAddins } from ".";
|
||||||
import { IAction, IActionResult, IActionNode, IActionProperty, IField ,IContext} from "../types/ActionTypes";
|
import { IAction, IActionResult, IActionNode, IActionProperty, IField ,IContext, IVarName} from "../types/ActionTypes";
|
||||||
/**
|
/**
|
||||||
* アクションの属性定義
|
* アクションの属性定義
|
||||||
*/
|
*/
|
||||||
interface IDatetimeGetterProps {
|
interface IDatetimeGetterProps {
|
||||||
/**変数の名前 */
|
/**変数の名前 */
|
||||||
verName:string;
|
verName:IVarName;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 現在日時を取得するアクション
|
* 現在日時を取得するアクション
|
||||||
@@ -18,7 +18,7 @@ export class DatetimeGetterAction implements IAction {
|
|||||||
this.name = "現在日時";
|
this.name = "現在日時";
|
||||||
this.actionProps = [];
|
this.actionProps = [];
|
||||||
this.props = {
|
this.props = {
|
||||||
verName:''
|
verName:{name:''}
|
||||||
}
|
}
|
||||||
this.register();
|
this.register();
|
||||||
}
|
}
|
||||||
@@ -45,8 +45,8 @@ export class DatetimeGetterAction implements IAction {
|
|||||||
|
|
||||||
let today = new Date();
|
let today = new Date();
|
||||||
|
|
||||||
if(this.props.verName){
|
if(this.props.verName && this.props.verName.name!==''){
|
||||||
context.variables[this.props.verName]=today.toISOString();
|
context.variables[this.props.verName.name]=today.toISOString();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export class StringJoinAction implements IAction{
|
|||||||
* @param context コンテキスト(レコード、変数情報を持っている)
|
* @param context コンテキスト(レコード、変数情報を持っている)
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
//非同期処理ある関数下のある属性:
|
//非同期処理ある関数下のある属性:
|
||||||
async process(actionNode:IActionNode,event:any):Promise<IActionResult> {
|
async process(actionNode:IActionNode,event:any):Promise<IActionResult> {
|
||||||
let result={
|
let result={
|
||||||
//後継処理不可:
|
//後継処理不可:
|
||||||
@@ -107,7 +107,7 @@ export class StringJoinAction implements IAction{
|
|||||||
for(let i=0;i<mototext.length;i++){
|
for(let i=0;i<mototext.length;i++){
|
||||||
arr.push(mototext[i].name);
|
arr.push(mototext[i].name);
|
||||||
}
|
}
|
||||||
//配列要素を,で連結して文字列を作成:
|
//配列要素を,で連結して文字列を作成:
|
||||||
value=arr.join();
|
value=arr.join();
|
||||||
}
|
}
|
||||||
//カテゴリー、チェックボックス、複数選択:
|
//カテゴリー、チェックボックス、複数選択:
|
||||||
@@ -120,7 +120,7 @@ export class StringJoinAction implements IAction{
|
|||||||
for(let i=0;i<mototext.length;i++){
|
for(let i=0;i<mototext.length;i++){
|
||||||
arr.push(mototext[i]);
|
arr.push(mototext[i]);
|
||||||
}
|
}
|
||||||
//配列要素を,で連結して文字列を作成:
|
//配列要素を,で連結して文字列を作成:
|
||||||
value=arr.join();
|
value=arr.join();
|
||||||
}
|
}
|
||||||
//詳細画面プロセス実行後のステータス:
|
//詳細画面プロセス実行後のステータス:
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { actionAddins } from ".";
|
import { actionAddins } from ".";
|
||||||
import { IAction,IActionResult, IActionNode, IActionProperty, IField, IContext} from "../types/ActionTypes";
|
import { IAction,IActionResult, IActionNode, IActionProperty, IField, IContext, IVarName} from "../types/ActionTypes";
|
||||||
/**
|
/**
|
||||||
* アクションの属性定義
|
* アクションの属性定義
|
||||||
*/
|
*/
|
||||||
interface IGetValueProps{
|
interface IGetValueProps{
|
||||||
field:IField;//チェックするフィールドの対象
|
field:IField;//チェックするフィールドの対象
|
||||||
verName:string;
|
verName:IVarName;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 正規表現チェックアクション
|
* 正規表現チェックアクション
|
||||||
@@ -19,7 +19,7 @@ export class GetValueAciton implements IAction{
|
|||||||
this.actionProps=[];
|
this.actionProps=[];
|
||||||
this.props={
|
this.props={
|
||||||
field:{code:''},
|
field:{code:''},
|
||||||
verName:''
|
verName:{name:''}
|
||||||
}
|
}
|
||||||
//アクションを登録する
|
//アクションを登録する
|
||||||
this.register();
|
this.register();
|
||||||
@@ -46,7 +46,9 @@ export class GetValueAciton implements IAction{
|
|||||||
//条件式の計算結果を取得
|
//条件式の計算結果を取得
|
||||||
const record = event.record;
|
const record = event.record;
|
||||||
const value = record[this.props.field.code].value;
|
const value = record[this.props.field.code].value;
|
||||||
context.variables[this.props.verName] = value;
|
if(this.props.verName && this.props.verName.name!==''){
|
||||||
|
context.variables[this.props.verName.name] = value;
|
||||||
|
}
|
||||||
result = {
|
result = {
|
||||||
canNext:true,
|
canNext:true,
|
||||||
result:true
|
result:true
|
||||||
|
|||||||
@@ -92,6 +92,11 @@ export interface IField{
|
|||||||
required?:boolean;
|
required?:boolean;
|
||||||
options?:string;
|
options?:string;
|
||||||
}
|
}
|
||||||
|
//変数のインターフェース
|
||||||
|
export interface IVarName{
|
||||||
|
name:string;
|
||||||
|
fields?:IVarName[];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* アクションのプロパティ定義に基づいたクラス
|
* アクションのプロパティ定義に基づいたクラス
|
||||||
|
|||||||
Reference in New Issue
Block a user