From a8e0fe9e8f191442f30171e6b4bff8ab46ab95a9 Mon Sep 17 00:00:00 2001 From: fofolee Date: Sat, 18 Jan 2025 13:39:54 +0800 Subject: [PATCH] =?UTF-8?q?Varinput=E7=BB=84=E4=BB=B6=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E7=AA=97=E5=8F=A3=E6=8C=89=E9=92=AE=EF=BC=8C?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E5=BF=AB=E9=80=9F=E5=A1=AB=E5=85=A5=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E5=8F=8A=E5=85=83=E7=B4=A0=E7=9A=84=E5=8F=A5=E6=9F=84?= =?UTF-8?q?=E3=80=81=E6=A0=87=E9=A2=98=E7=AD=89=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../composer/common/VariableInput.vue | 397 +++--------------- .../composer/common/varinput/FileSelector.vue | 39 ++ .../composer/common/varinput/ItemList.vue | 174 ++++++++ .../composer/common/varinput/VariableList.vue | 150 +++++++ .../common/varinput/WindowSelector.vue | 38 ++ src/js/composer/commands/windowsCommands.js | 92 ++-- 6 files changed, 490 insertions(+), 400 deletions(-) create mode 100644 src/components/composer/common/varinput/FileSelector.vue create mode 100644 src/components/composer/common/varinput/ItemList.vue create mode 100644 src/components/composer/common/varinput/VariableList.vue create mode 100644 src/components/composer/common/varinput/WindowSelector.vue diff --git a/src/components/composer/common/VariableInput.vue b/src/components/composer/common/VariableInput.vue index 9fd9b8c..bb5b605 100644 --- a/src/components/composer/common/VariableInput.vue +++ b/src/components/composer/common/VariableInput.vue @@ -9,154 +9,39 @@ > @@ -427,106 +228,4 @@ export default defineComponent({ margin-left: 5px; transition: all 0.6s ease; } - -.variable-dropdown.prepend-btn { - background-color: rgba(0, 0, 0, 0.02); -} - -.body--dark .variable-dropdown.prepend-btn { - background-color: rgba(255, 255, 255, 0.02); -} - -.clear-btn:hover { - color: var(--q-negative); -} - -/* 变量列表样式 */ -.variable-list { - min-width: 200px; - padding: 4px; -} - -.variable-item { - border-radius: 4px; - padding: 0px 16px; - transition: all 0.3s ease; - min-height: 40px; -} - -.variable-item:hover { - background-color: var(--q-primary-opacity-10); -} - -.variable-label { - padding: 4px 8px; - display: flex; - align-items: center; - gap: 4px; -} - -.variable-name { - font-size: 12px; - font-weight: 500; -} - -.variable-source { - font-size: 11px; - opacity: 0.7; -} - -/* 暗色模式适配 */ -.body--dark .variable-item:hover { - background: rgba(255, 255, 255, 0.1); -} - -.options-item-list { - min-width: 120px; - padding: 4px; -} - -.option-item { - border-radius: 4px; - padding: 0px 16px; - transition: all 0.3s ease; - min-height: 40px; - font-size: 12px; - display: flex; - align-items: center; -} - -.option-item:hover { - background-color: var(--q-primary-opacity-10); -} - -.option-item-label { - text-align: center; - flex: 1; -} - -/* 暗色模式适配 */ -.body--dark .option-item:hover { - background-color: rgba(255, 255, 255, 0.1); -} - -.empty-variables-tip { - text-align: center; - font-size: 13px; - opacity: 0.9; - transition: opacity 0.3s ease; -} - -.empty-variables-tip:hover { - opacity: 1; -} - -/* 多选确认按钮样式 */ -.option-item.text-primary { - justify-content: center; - font-weight: 500; -} - -/* 多选项样式 */ -.option-item .q-checkbox { - margin-right: 4px; -} diff --git a/src/components/composer/common/varinput/FileSelector.vue b/src/components/composer/common/varinput/FileSelector.vue new file mode 100644 index 0000000..eca8635 --- /dev/null +++ b/src/components/composer/common/varinput/FileSelector.vue @@ -0,0 +1,39 @@ + + + diff --git a/src/components/composer/common/varinput/ItemList.vue b/src/components/composer/common/varinput/ItemList.vue new file mode 100644 index 0000000..5e53edf --- /dev/null +++ b/src/components/composer/common/varinput/ItemList.vue @@ -0,0 +1,174 @@ + + + + + diff --git a/src/components/composer/common/varinput/VariableList.vue b/src/components/composer/common/varinput/VariableList.vue new file mode 100644 index 0000000..90b2292 --- /dev/null +++ b/src/components/composer/common/varinput/VariableList.vue @@ -0,0 +1,150 @@ + + + + + diff --git a/src/components/composer/common/varinput/WindowSelector.vue b/src/components/composer/common/varinput/WindowSelector.vue new file mode 100644 index 0000000..89d3d46 --- /dev/null +++ b/src/components/composer/common/varinput/WindowSelector.vue @@ -0,0 +1,38 @@ + + + diff --git a/src/js/composer/commands/windowsCommands.js b/src/js/composer/commands/windowsCommands.js index 904dfd0..502d176 100644 --- a/src/js/composer/commands/windowsCommands.js +++ b/src/js/composer/commands/windowsCommands.js @@ -1,52 +1,5 @@ import { newVarInputVal } from "js/composer/varInputValManager.js"; -const controlClass = [ - // 基础控件 - { value: "Button", label: "按钮 (Button)" }, - { value: "Edit", label: "编辑框 (Edit)" }, - { value: "Static", label: "静态文本 (Static)" }, - { value: "ComboBox", label: "下拉框 (ComboBox)" }, - { value: "ListBox", label: "列表框 (ListBox)" }, - { value: "CheckBox", label: "复选框 (CheckBox)" }, - { value: "RadioButton", label: "单选框 (RadioButton)" }, - - // 常见对话框控件 - { value: "SysListView32", label: "列表视图 (SysListView32)" }, - { value: "SysTreeView32", label: "树形视图 (SysTreeView32)" }, - { value: "SysTabControl32", label: "选项卡 (SysTabControl32)" }, - { value: "msctls_progress32", label: "进度条 (msctls_progress32)" }, - { value: "msctls_trackbar32", label: "滑块 (msctls_trackbar32)" }, - { value: "msctls_updown32", label: "数字调节器 (msctls_updown32)" }, - - // 文件对话框相关 - { value: "DirectUIHWND", label: "文件浏览器 (DirectUIHWND)" }, - { value: "ToolbarWindow32", label: "工具栏 (ToolbarWindow32)" }, - { value: "ComboBoxEx32", label: "扩展下拉框 (ComboBoxEx32)" }, - - // 常见应用程序控件 - { value: "RICHEDIT50W", label: "富文本编辑框 (RICHEDIT50W)" }, - { value: "Scintilla", label: "代码编辑器 (Scintilla)" }, - { value: "WebView2", label: "Edge浏览器 (WebView2)" }, - { - value: "Chrome_RenderWidgetHostHWND", - label: "Chrome渲染 (Chrome_RenderWidgetHostHWND)", - }, - - // 系统控件 - { value: "Shell_TrayWnd", label: "任务栏 (Shell_TrayWnd)" }, - { value: "TrayNotifyWnd", label: "通知区域 (TrayNotifyWnd)" }, - { value: "ReBarWindow32", label: "工具条容器 (ReBarWindow32)" }, - { value: "TaskListThumbnailWnd", label: "任务预览 (TaskListThumbnailWnd)" }, - - // 通用容器 - { value: "Window", label: "窗口 (Window)" }, - { value: "Dialog", label: "对话框 (Dialog)" }, - { value: "#32770", label: "标准对话框 (#32770)" }, - { value: "MDIClient", label: "MDI客户区 (MDIClient)" }, - { value: "ScrollBar", label: "滚动条 (ScrollBar)" }, - { value: "GroupBox", label: "分组框 (GroupBox)" }, -]; - const sendKeys = [ // 特殊按键 { value: "{ENTER}", label: "回车键 (Enter)" }, @@ -174,6 +127,16 @@ const searchWindowConfig = [ icon: "title", width: 9, placeholder: "标题、类名支持模糊匹配,选择活动窗口无需输入", + options: { + window: { + props: [ + { label: "标题", value: "title" }, + { label: "类名", value: "class" }, + { label: "句柄", value: "handle" }, + { label: "进程名", value: "processName" }, + ], + }, + }, }, ]; @@ -185,6 +148,11 @@ const windowHandleConfig = [ width: 12, placeholder: "可从搜索/选择窗口获取,留空则使用当前活动窗口", defaultValue: newVarInputVal("str", ""), + options: { + window: { + props: "handle", + }, + }, }, ]; @@ -207,6 +175,15 @@ const searchElementConfig = [ label: "查找值", component: "VariableInput", icon: "account_tree", + options: { + window: { + props: [ + { label: "XPath", value: "element.xpath" }, + { label: "AutomationId", value: "element.automationId" }, + { label: "Name", value: "element.name" }, + ], + }, + }, width: 8, placeholder: "XPath: /Pane[3]/Edit[2], 组合条件: name=按钮&type=Button", }, @@ -656,7 +633,9 @@ export const windowsCommands = { component: "VariableInput", icon: "filter_alt", options: { - items: controlClass, + window: { + props: "element.type", + }, }, width: 8, placeholder: "可选,输入要过滤的控件类型或文本", @@ -698,7 +677,9 @@ export const windowsCommands = { component: "VariableInput", icon: "class", options: { - items: controlClass, + window: { + props: "element.type", + }, }, width: 6, placeholder: "可选,和文本至少输入一个", @@ -707,6 +688,11 @@ export const windowsCommands = { label: "控件文本", component: "VariableInput", icon: "text_fields", + options: { + window: { + props: "element.name", + }, + }, width: 6, placeholder: "可选,和控件类型至少输入一个", }, @@ -750,7 +736,9 @@ export const windowsCommands = { label: "目标控件", component: "VariableInput", options: { - items: controlClass, + window: { + props: "element.type", + }, }, icon: "class", width: 8, @@ -793,7 +781,9 @@ export const windowsCommands = { label: "目标控件", component: "VariableInput", options: { - items: controlClass, + window: { + props: "element.type", + }, }, icon: "class", width: 8,