From daef39b02ab294469ab276a28ff72574254eeaae Mon Sep 17 00:00:00 2001 From: fofolee Date: Mon, 17 Feb 2025 12:14:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=83=A8=E5=88=86NumberInput?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E4=B8=BAVariableInput=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/js/composer/commands/browserCommands.js | 25 ++-- src/js/composer/commands/dataCommands.js | 121 +++++++++++-------- src/js/composer/commands/imageCommands.js | 40 +++--- src/js/composer/commands/macosCommands.js | 8 +- src/js/composer/commands/mathCommands.js | 34 ++++-- src/js/composer/commands/simulateCommands.js | 26 ++-- src/js/composer/commands/systemCommands.js | 5 +- src/js/composer/commands/uiCommands.js | 19 +-- src/js/composer/commands/utoolsCommand.js | 8 +- src/js/composer/commands/windowsCommands.js | 49 ++++---- 10 files changed, 181 insertions(+), 154 deletions(-) diff --git a/src/js/composer/commands/browserCommands.js b/src/js/composer/commands/browserCommands.js index d4ed53e..79e7655 100644 --- a/src/js/composer/commands/browserCommands.js +++ b/src/js/composer/commands/browserCommands.js @@ -135,12 +135,11 @@ export const browserCommands = { config: [ { label: "浏览器实例端口", - component: "NumberInput", + component: "VariableInput", + disableToggleType: true, + defaultValue: newVarInputVal("var"), icon: "label", width: 12, - min: 9222, - max: 9322, - step: 1, placeholder: "留空关闭当前操控的实例", }, ], @@ -176,13 +175,11 @@ export const browserCommands = { config: [ { label: "浏览器实例端口", - component: "NumberInput", + component: "VariableInput", icon: "label", width: 12, - defaultValue: 9222, - min: 9222, - max: 9322, - step: 1, + defaultValue: newVarInputVal("var"), + disableToggleType: true, }, ], }, @@ -701,17 +698,19 @@ export const browserCommands = { config: [ { label: "X坐标", - component: "NumberInput", + component: "VariableInput", icon: "arrow_right", width: 12, - defaultValue: 0, + defaultValue: newVarInputVal("var", "0"), + disableToggleType: true, }, { label: "Y坐标", - component: "NumberInput", + component: "VariableInput", icon: "arrow_drop_down", width: 12, - defaultValue: 0, + defaultValue: newVarInputVal("var", "0"), + disableToggleType: true, }, ], }, diff --git a/src/js/composer/commands/dataCommands.js b/src/js/composer/commands/dataCommands.js index 8675ec8..647708f 100644 --- a/src/js/composer/commands/dataCommands.js +++ b/src/js/composer/commands/dataCommands.js @@ -71,18 +71,18 @@ export const dataCommands = { }, { label: "起始位置", - component: "NumberInput", - min: 0, - step: 1, + component: "VariableInput", + disableToggleType: true, + defaultValue: newVarInputVal("var"), icon: "first_page", width: 6, }, { label: "结束位置", - component: "NumberInput", + component: "VariableInput", + disableToggleType: true, + defaultValue: newVarInputVal("var"), icon: "last_page", - min: 0, - step: 1, width: 6, }, ], @@ -169,9 +169,9 @@ export const dataCommands = { }, { label: "目标长度", - component: "NumberInput", - min: 0, - step: 1, + component: "VariableInput", + disableToggleType: true, + defaultValue: newVarInputVal("var"), icon: "straighten", width: 4, }, @@ -264,9 +264,9 @@ export const dataCommands = { }, { label: "重复次数", - component: "NumberInput", - min: 0, - step: 1, + component: "VariableInput", + disableToggleType: true, + defaultValue: newVarInputVal("var"), icon: "repeat", width: 4, defaultValue: 1, @@ -357,9 +357,9 @@ export const dataCommands = { }, { label: "每行字符数", - component: "NumberInput", - min: 1, - step: 1, + component: "VariableInput", + disableToggleType: true, + defaultValue: newVarInputVal("var"), icon: "straighten", width: 4, defaultValue: 80, @@ -397,9 +397,9 @@ export const dataCommands = { }, { label: "总宽度", - component: "NumberInput", - min: 1, - step: 1, + component: "VariableInput", + disableToggleType: true, + defaultValue: newVarInputVal("var"), icon: "straighten", width: 6, defaultValue: 80, @@ -487,16 +487,18 @@ export const dataCommands = { }, { label: "起始位置", - component: "NumberInput", - step: 1, + component: "VariableInput", + disableToggleType: true, + defaultValue: newVarInputVal("var"), icon: "first_page", width: 4, }, { label: "结束位置", - component: "NumberInput", + component: "VariableInput", + disableToggleType: true, + defaultValue: newVarInputVal("var"), icon: "last_page", - step: 1, width: 4, }, ], @@ -520,13 +522,17 @@ export const dataCommands = { }, { label: "偏移量", - component: "NumberInput", + component: "VariableInput", + disableToggleType: true, + defaultValue: newVarInputVal("var"), icon: "first_page", width: 4, }, { label: "长度", - component: "NumberInput", + component: "VariableInput", + disableToggleType: true, + defaultValue: newVarInputVal("var"), icon: "straighten", width: 4, }, @@ -568,13 +574,17 @@ export const dataCommands = { }, { label: "起始位置", - component: "NumberInput", + component: "VariableInput", + disableToggleType: true, + defaultValue: newVarInputVal("var"), icon: "first_page", width: 4, }, { label: "结束位置", - component: "NumberInput", + component: "VariableInput", + disableToggleType: true, + defaultValue: newVarInputVal("var"), icon: "last_page", width: 4, }, @@ -616,19 +626,25 @@ export const dataCommands = { }, { label: "目标起始位置", - component: "NumberInput", + component: "VariableInput", + disableToggleType: true, + defaultValue: newVarInputVal("var"), icon: "first_page", width: 4, }, { label: "源起始位置", - component: "NumberInput", + component: "VariableInput", + disableToggleType: true, + defaultValue: newVarInputVal("var"), icon: "first_page", width: 4, }, { label: "源结束位置", - component: "NumberInput", + component: "VariableInput", + disableToggleType: true, + defaultValue: newVarInputVal("var"), icon: "last_page", width: 4, }, @@ -669,7 +685,9 @@ export const dataCommands = { }, { label: "总长度(可选)", - component: "NumberInput", + component: "VariableInput", + disableToggleType: true, + defaultValue: newVarInputVal("var"), icon: "straighten", width: 12, }, @@ -688,13 +706,17 @@ export const dataCommands = { }, { label: "起始位置", - component: "NumberInput", + component: "VariableInput", + disableToggleType: true, + defaultValue: newVarInputVal("var"), icon: "first_page", width: 6, }, { label: "结束位置", - component: "NumberInput", + component: "VariableInput", + disableToggleType: true, + defaultValue: newVarInputVal("var"), icon: "last_page", width: 6, }, @@ -719,7 +741,9 @@ export const dataCommands = { }, { label: "起始位置", - component: "NumberInput", + component: "VariableInput", + disableToggleType: true, + defaultValue: newVarInputVal("var"), icon: "first_page", width: 4, }, @@ -1062,19 +1086,19 @@ export const dataCommands = { }, { label: "起始位置", - component: "NumberInput", + component: "VariableInput", icon: "first_page", - min: 0, - step: 1, + disableToggleType: true, + defaultValue: newVarInputVal("var"), width: 6, placeholder: "1", }, { label: "结束位置", - component: "NumberInput", + component: "VariableInput", icon: "last_page", - min: 0, - step: 1, + disableToggleType: true, + defaultValue: newVarInputVal("var"), width: 6, placeholder: "3", }, @@ -1094,11 +1118,10 @@ export const dataCommands = { }, { label: "扁平化深度", - component: "NumberInput", + component: "VariableInput", icon: "format_indent_decrease", - min: 1, - step: 1, - defaultValue: 1, + disableToggleType: true, + defaultValue: newVarInputVal("var"), width: 4, }, ], @@ -1201,11 +1224,10 @@ export const dataCommands = { }, { label: "块大小", - component: "NumberInput", + component: "VariableInput", icon: "straighten", - min: 1, - step: 1, - defaultValue: 2, + disableToggleType: true, + defaultValue: newVarInputVal("var"), width: 4, }, ], @@ -1344,10 +1366,11 @@ export const dataCommands = { }, { label: "数值", - component: "NumberInput", + component: "VariableInput", + disableToggleType: true, + defaultValue: newVarInputVal("var", "1"), icon: "exposure", width: 6, - defaultValue: 1, }, { label: "单位", diff --git a/src/js/composer/commands/imageCommands.js b/src/js/composer/commands/imageCommands.js index ce4e35a..74e5e1a 100644 --- a/src/js/composer/commands/imageCommands.js +++ b/src/js/composer/commands/imageCommands.js @@ -140,19 +140,19 @@ export const imageCommands = { }, { label: "宽度(像素)", - component: "NumberInput", + component: "VariableInput", icon: "compare_arrows", width: 6, - min: 1, - step: 10, + disableToggleType: true, + defaultValue: newVarInputVal("var", "100"), }, { label: "高度(像素)", - component: "NumberInput", + component: "VariableInput", icon: "height", width: 6, - min: 1, - step: 10, + disableToggleType: true, + defaultValue: newVarInputVal("var", "100"), }, { label: "保持宽高比", @@ -293,39 +293,35 @@ export const imageCommands = { }, { label: "起始X坐标", - component: "NumberInput", + component: "VariableInput", icon: "arrow_right", width: 6, - min: 0, - step: 10, - defaultValue: 0, + disableToggleType: true, + defaultValue: newVarInputVal("var", "0"), }, { label: "起始Y坐标", - component: "NumberInput", + component: "VariableInput", icon: "arrow_downward", width: 6, - min: 0, - step: 10, - defaultValue: 0, + disableToggleType: true, + defaultValue: newVarInputVal("var", "0"), }, { label: "裁剪宽度", - component: "NumberInput", + component: "VariableInput", icon: "compare_arrows", width: 6, - min: 1, - step: 10, - defaultValue: "", + disableToggleType: true, + defaultValue: newVarInputVal("var"), }, { label: "裁剪高度", - component: "NumberInput", + component: "VariableInput", icon: "height", width: 6, - min: 1, - step: 10, - defaultValue: "", + disableToggleType: true, + defaultValue: newVarInputVal("var"), }, { label: "图片质量(0-1)", diff --git a/src/js/composer/commands/macosCommands.js b/src/js/composer/commands/macosCommands.js index bd63f25..f550d60 100644 --- a/src/js/composer/commands/macosCommands.js +++ b/src/js/composer/commands/macosCommands.js @@ -1,3 +1,5 @@ +import { newVarInputVal } from "js/composer/varInputValManager"; + const windowOutputStructure = { name: { label: "应用名称", suggestName: "appName" }, displayedName: { @@ -432,10 +434,10 @@ export const macosCommands = { config: [ { label: "窗口索引", - component: "NumberInput", + component: "VariableInput", icon: "window", - min: 1, - defaultValue: 1, + disableToggleType: true, + defaultValue: newVarInputVal("var", "1"), width: 12, }, ], diff --git a/src/js/composer/commands/mathCommands.js b/src/js/composer/commands/mathCommands.js index 00a29ee..c1236af 100644 --- a/src/js/composer/commands/mathCommands.js +++ b/src/js/composer/commands/mathCommands.js @@ -201,10 +201,11 @@ export const mathCommands = { config: [ { label: "半径", - component: "NumberInput", + component: "VariableInput", icon: "radio_button_checked", width: 12, - min: 0, + disableToggleType: true, + defaultValue: newVarInputVal("var"), }, ], }, @@ -215,17 +216,19 @@ export const mathCommands = { config: [ { label: "宽度", - component: "NumberInput", + component: "VariableInput", icon: "swap_horiz", width: 6, - min: 0, + disableToggleType: true, + defaultValue: newVarInputVal("var"), }, { label: "高度", - component: "NumberInput", + component: "VariableInput", icon: "height", width: 6, - min: 0, + disableToggleType: true, + defaultValue: newVarInputVal("var"), }, ], }, @@ -236,24 +239,27 @@ export const mathCommands = { config: [ { label: "边长a", - component: "NumberInput", + component: "VariableInput", icon: "straighten", width: 4, - min: 0, + disableToggleType: true, + defaultValue: newVarInputVal("var"), }, { label: "边长b", - component: "NumberInput", + component: "VariableInput", icon: "straighten", width: 4, - min: 0, + disableToggleType: true, + defaultValue: newVarInputVal("var"), }, { label: "边长c", - component: "NumberInput", + component: "VariableInput", icon: "straighten", width: 4, - min: 0, + disableToggleType: true, + defaultValue: newVarInputVal("var"), }, ], }, @@ -266,9 +272,11 @@ export const mathCommands = { config: [ { label: "角度值", - component: "NumberInput", + component: "VariableInput", icon: "rotate_right", width: 12, + disableToggleType: true, + defaultValue: newVarInputVal("var"), }, ], subCommands: [ diff --git a/src/js/composer/commands/simulateCommands.js b/src/js/composer/commands/simulateCommands.js index 53c57c3..146128e 100644 --- a/src/js/composer/commands/simulateCommands.js +++ b/src/js/composer/commands/simulateCommands.js @@ -152,18 +152,16 @@ export const simulateCommands = { x: { label: "X坐标", icon: "drag_handle", - component: "NumberInput", - min: 0, - step: 10, + component: "VariableInput", + disableToggleType: true, width: 6, placeholder: "XY任意留空原地点击", }, y: { label: "Y坐标", icon: "drag_handle", - component: "NumberInput", - min: 0, - step: 10, + component: "VariableInput", + disableToggleType: true, width: 6, placeholder: "XY任意留空原地点击", }, @@ -185,6 +183,8 @@ export const simulateCommands = { }, defaultValue: { count: 1, + x: newVarInputVal("var"), + y: newVarInputVal("var"), }, }, ], @@ -201,19 +201,17 @@ export const simulateCommands = { { label: "X坐标", icon: "drag_handle", - defaultValue: 0, - component: "NumberInput", - min: 0, - step: 10, + defaultValue: newVarInputVal("var", "0"), + component: "VariableInput", + disableToggleType: true, width: 6, }, { label: "Y坐标", icon: "drag_handle", - defaultValue: 0, - component: "NumberInput", - min: 0, - step: 10, + defaultValue: newVarInputVal("var", "0"), + component: "VariableInput", + disableToggleType: true, width: 6, }, ], diff --git a/src/js/composer/commands/systemCommands.js b/src/js/composer/commands/systemCommands.js index 16296d1..aaf5480 100644 --- a/src/js/composer/commands/systemCommands.js +++ b/src/js/composer/commands/systemCommands.js @@ -549,9 +549,8 @@ export const systemCommands = { config: [ { label: "进程ID", - component: "NumberInput", - min: 0, - step: 100, + component: "VariableInput", + disableToggleType: true, icon: "developer_board", width: 7, }, diff --git a/src/js/composer/commands/uiCommands.js b/src/js/composer/commands/uiCommands.js index 69a3310..f90e857 100644 --- a/src/js/composer/commands/uiCommands.js +++ b/src/js/composer/commands/uiCommands.js @@ -444,21 +444,17 @@ export const uiCommands = { label: "标题", component: "VariableInput", width: 6, - defaultValue: newVarInputVal("str", "进度"), }, text: { label: "文本", component: "VariableInput", width: 6, - defaultValue: newVarInputVal("str", "处理中..."), }, value: { label: "初始进度值", - component: "NumberInput", + component: "VariableInput", + disableToggleType: true, width: 3, - min: 0, - max: 100, - defaultValue: 0, }, position: { label: "位置", @@ -470,7 +466,6 @@ export const uiCommands = { { label: "屏幕左下角", value: "bottom-left" }, { label: "屏幕右下角", value: "bottom-right" }, ], - defaultValue: "bottom-right", }, onClose: { label: "关闭按钮回调函数", @@ -496,7 +491,7 @@ export const uiCommands = { defaultValue: { title: newVarInputVal("str", "进度"), text: newVarInputVal("str", "处理中..."), - value: 0, + value: newVarInputVal("var", "0"), position: "bottom-right", onClose: newVarInputVal("var"), onPause: newVarInputVal("var"), @@ -515,11 +510,9 @@ export const uiCommands = { options: { value: { label: "进度值", - component: "NumberInput", + component: "VariableInput", width: 4, - min: 0, - max: 100, - defaultValue: 0, + disableToggleType: true, }, text: { label: "文本", @@ -534,7 +527,7 @@ export const uiCommands = { }, }, defaultValue: { - value: 0, + value: newVarInputVal("var", "0"), text: newVarInputVal("str"), complete: false, }, diff --git a/src/js/composer/commands/utoolsCommand.js b/src/js/composer/commands/utoolsCommand.js index 88374f0..cdc9f9d 100644 --- a/src/js/composer/commands/utoolsCommand.js +++ b/src/js/composer/commands/utoolsCommand.js @@ -1,3 +1,5 @@ +import { newVarInputVal } from "js/composer/varInputValManager"; + export const utoolsCommands = { label: "uTools功能", icon: "insights", @@ -49,9 +51,9 @@ export const utoolsCommands = { config: [ { label: "高度", - component: "NumberInput", - min: 0, - step: 100, + component: "VariableInput", + disableToggleType: true, + defaultValue: newVarInputVal("var", "100"), icon: "straighten", width: 12, }, diff --git a/src/js/composer/commands/windowsCommands.js b/src/js/composer/commands/windowsCommands.js index cb10a0b..c9acd11 100644 --- a/src/js/composer/commands/windowsCommands.js +++ b/src/js/composer/commands/windowsCommands.js @@ -293,19 +293,27 @@ export const windowsCommands = { options: { x: { label: "X坐标", - component: "NumberInput", + component: "VariableInput", + disableToggleType: true, icon: "arrow_right", placeholder: "留空使用当前鼠标位置", width: 6, + disableToggleType: true, }, y: { label: "Y坐标", - component: "NumberInput", + component: "VariableInput", + disableToggleType: true, icon: "arrow_drop_down", placeholder: "留空使用当前鼠标位置", width: 6, + disableToggleType: true, }, }, + defaultValue: { + x: newVarInputVal("var"), + y: newVarInputVal("var"), + }, }, ], outputs: { @@ -352,12 +360,11 @@ export const windowsCommands = { config: [ { label: "透明度", - component: "NumberInput", + component: "VariableInput", icon: "opacity", width: 12, - min: 0, - max: 100, - defaultValue: 80, + disableToggleType: true, + defaultValue: newVarInputVal("var", "80"), }, ], }, @@ -368,33 +375,35 @@ export const windowsCommands = { config: [ { label: "X坐标", - component: "NumberInput", + component: "VariableInput", icon: "arrow_right", width: 6, - defaultValue: 0, + disableToggleType: true, + defaultValue: newVarInputVal("var"), }, { label: "Y坐标", - component: "NumberInput", + component: "VariableInput", icon: "arrow_drop_down", width: 6, - defaultValue: 0, + disableToggleType: true, + defaultValue: newVarInputVal("var"), }, { label: "宽度", - component: "NumberInput", + component: "VariableInput", icon: "swap_horiz", width: 6, - min: 0, - defaultValue: 800, + disableToggleType: true, + defaultValue: newVarInputVal("var", "800"), }, { label: "高度", - component: "NumberInput", + component: "VariableInput", icon: "height", width: 6, - min: 0, - defaultValue: 600, + disableToggleType: true, + defaultValue: newVarInputVal("var", "600"), }, ], }, @@ -629,17 +638,15 @@ export const windowsCommands = { }, amount: { label: "位置", - component: "NumberInput", + component: "VariableInput", icon: "straighten", width: 6, - min: 0, - max: 100, - step: 10, + disableToggleType: true, }, }, defaultValue: { direction: "vertical", - amount: 0, + amount: newVarInputVal("var"), }, }, ],