From f6081ef8d717a9b91d318f573467c02d13c14e5a Mon Sep 17 00:00:00 2001 From: liangyi <994302767@qq.com> Date: Sat, 18 May 2024 14:58:29 +0800 Subject: [PATCH] feat(action-block): support custom process name Closes #90 --- src/types/pages/home.d.ts | 1 + src/types/store/subsStore.d.ts | 1 + src/utils/actionsOperate.ts | 1 + src/utils/actionsToPorcess.ts | 6 +- src/views/SubEditor.vue | 20 +++- src/views/editor/ActionBlock.vue | 172 ++++++++++++++++++++++++++++--- 6 files changed, 184 insertions(+), 17 deletions(-) diff --git a/src/types/pages/home.d.ts b/src/types/pages/home.d.ts index 631257880..ae77a519c 100644 --- a/src/types/pages/home.d.ts +++ b/src/types/pages/home.d.ts @@ -1,5 +1,6 @@ type ActionModuleProps = { id: string; + customName: string; type: string; component: any; tipsDes: string; diff --git a/src/types/store/subsStore.d.ts b/src/types/store/subsStore.d.ts index 96ad9f8c2..52377cebe 100644 --- a/src/types/store/subsStore.d.ts +++ b/src/types/store/subsStore.d.ts @@ -24,6 +24,7 @@ type ProcessArg = any; interface Process { type: string; id?: string; + customName?: string; args?: ProcessArg; } diff --git a/src/utils/actionsOperate.ts b/src/utils/actionsOperate.ts index 2a8e33cd2..4bee9ddb4 100644 --- a/src/utils/actionsOperate.ts +++ b/src/utils/actionsOperate.ts @@ -17,6 +17,7 @@ export const addItem = ( const args = selectedOptions[0].args; const obj = { id, + customName: "", type, tipsDes: t(`editorPage.subConfig.nodeActions['${type}'].tipsDes`), component: null, diff --git a/src/utils/actionsToPorcess.ts b/src/utils/actionsToPorcess.ts index bc33ac2a8..57fca4aee 100644 --- a/src/utils/actionsToPorcess.ts +++ b/src/utils/actionsToPorcess.ts @@ -3,8 +3,7 @@ export const actionsToProcess = ( actionsList: ActionModuleProps[], ignoreList: string[] ): Process[] => { - const getArgs = (id: string) => process.find((item) => item.id === id).args; - + const findProcess = (id: string) => process.find((item) => item.id === id); const newProcess = process.filter((item) => { if (ignoreList.includes(item.type)) return item; }); @@ -12,7 +11,8 @@ export const actionsToProcess = ( actionsList.forEach((item) => { newProcess.push({ type: item.type, - args: getArgs(item.id), + args: findProcess(item.id).args, + customName: findProcess(item.id).customName, id: item.id, }); }); diff --git a/src/views/SubEditor.vue b/src/views/SubEditor.vue index b661354b8..22d90c48a 100644 --- a/src/views/SubEditor.vue +++ b/src/views/SubEditor.vue @@ -1,6 +1,6 @@