编排UI新增输入框;调整了showInputBox接口,以方便可视化编排调用

This commit is contained in:
fofolee
2025-01-07 11:08:25 +08:00
parent b6bdb88fe9
commit 53a411c664
8 changed files with 167 additions and 33 deletions

View File

@@ -220,19 +220,19 @@ export const dataCommands = {
label: "整数",
type: "switch",
defaultValue: false,
width: 1,
width: 2,
},
{
label: "起始值",
icon: "last_page",
type: "numInput",
width: 10,
width: 5,
},
{
label: "结束值",
icon: "first_page",
type: "numInput",
width: 10,
width: 5,
},
],
outputVariable: "randomNumber",

View File

@@ -18,13 +18,13 @@ export const simulateCommands = {
label: "X坐标留空则原地点击",
icon: "drag_handle",
type: "numInput",
width: 8,
width: 6,
},
{
label: "Y坐标留空则原地点击",
icon: "drag_handle",
type: "numInput",
width: 8,
width: 6,
},
],
functionSelector: {
@@ -33,17 +33,19 @@ export const simulateCommands = {
{
label: "单击",
value: "utools.simulateMouseClick",
icon: "mouse",
},
{
label: "右击",
value: "utools.simulateMouseRightClick",
icon: "mouse",
},
{
label: "双击",
value: "utools.simulateMouseDoubleClick",
icon: "mouse",
},
],
width: 2,
allowEmptyArgv: true,
},
},
@@ -56,14 +58,14 @@ export const simulateCommands = {
icon: "drag_handle",
defaultValue: 0,
type: "numInput",
width: 8,
width: 6,
},
{
label: "Y坐标",
icon: "drag_handle",
defaultValue: 0,
type: "numInput",
width: 8,
width: 6,
},
],
},

View File

@@ -5,7 +5,7 @@ export const uiCommands = {
commands: [
{
value: "quickcommand.showButtonBox",
label: "按钮组弹窗",
label: "按钮组",
isAsync: true,
outputVariable: "{id,text}",
saveOutput: true,
@@ -15,12 +15,12 @@ export const uiCommands = {
type: "arrayEditor",
defaultValue: [
{
value: "按钮1",
value: "",
isString: true,
__varInputVal__: true,
},
{
value: "按钮2",
value: "",
isString: true,
__varInputVal__: true,
},
@@ -28,5 +28,45 @@ export const uiCommands = {
},
],
},
{
value: "quickcommand.showInputBox",
label: "输入框",
isAsync: true,
outputVariable: "[inputValue1]",
saveOutput: true,
config: [
{
label: "输入框",
type: "arrayEditor",
width: 12,
options: {
keys: [
{
label: "标签",
value: "label",
},
{
label: "默认值",
value: "value",
},
],
},
defaultValue: [
{
label: {
value: "请输入",
isString: true,
__varInputVal__: true,
},
value: {
value: "",
isString: true,
__varInputVal__: true,
},
},
],
},
],
},
],
};

View File

@@ -114,7 +114,7 @@ export function processVariable({ value, existingVars }) {
key,
processedName,
needsRename: processedName !== varName,
hasRename: parts.length > 1
hasRename: parts.length > 1,
};
});
@@ -135,9 +135,9 @@ export function processVariable({ value, existingVars }) {
const format =
destructured.format === "array"
? `[${processedVars.map((v) => v.key).join(", ")}]`
: `{${processedVars.map((v) =>
v.hasRename ? `${v.key}:${v.processedName}` : v.key
).join(", ")}}`;
: `{${processedVars
.map((v) => (v.hasRename ? `${v.key}:${v.processedName}` : v.key))
.join(", ")}}`;
return {
isValid: true,