用户交互分类添加系统级弹窗

This commit is contained in:
fofolee 2025-01-12 23:05:56 +08:00
parent 90e8ec7ff1
commit 4053f7a9c2
2 changed files with 174 additions and 67 deletions

View File

@ -470,9 +470,10 @@ const showSystemSelectList = async function (items, title = "") {
}; };
// 系统级按钮组弹窗 // 系统级按钮组弹窗
const showSystemButtonBox = async function (buttons, content, title = "") { const showSystemButtonBox = async function (buttons, content = "", title = "") {
const iconPath = getQuickcommandIconPath(); const iconPath = getQuickcommandIconPath();
if (window.utools.isMacOs()) { if (window.utools.isMacOs()) {
try {
let iconParam = "note"; let iconParam = "note";
if (iconPath) { if (iconPath) {
const posixPath = iconPath.replace(/\\/g, "/"); const posixPath = iconPath.replace(/\\/g, "/");
@ -488,6 +489,10 @@ const showSystemButtonBox = async function (buttons, content, title = "") {
return { id, text }; return { id, text };
} }
return null; return null;
} catch (error) {
window.utools.showNotification(error);
throw error;
}
} else if (window.utools.isWindows()) { } else if (window.utools.isWindows()) {
const escapedIconPath = iconPath ? iconPath.replace(/\\/g, "\\\\") : null; const escapedIconPath = iconPath ? iconPath.replace(/\\/g, "\\\\") : null;
const csharpScript = ` const csharpScript = `

View File

@ -79,7 +79,6 @@ const DIALOG_CONFIG = {
extensions: { extensions: {
label: "扩展名", label: "扩展名",
noIcon: true, noIcon: true,
width: 7,
disableToggleType: true, disableToggleType: true,
options: { options: {
items: ["*", "jpg", "png", "gif", "txt", "json", "exe"], items: ["*", "jpg", "png", "gif", "txt", "json", "exe"],
@ -126,6 +125,24 @@ export const uiCommands = {
], ],
defaultRowValue: newVarInputVal("str"), defaultRowValue: newVarInputVal("str"),
}, },
{
label: "标题",
component: "VariableInput",
defaultValue: newVarInputVal("str", "请选择"),
width: 12,
},
],
subCommands: [
{
value: "quickcommand.showButtonBox",
icon: "call_to_action",
label: "插件内弹窗",
},
{
value: "quickcommand.showSystemButtonBox",
icon: "report",
label: "系统弹窗",
},
], ],
}, },
{ {
@ -134,7 +151,11 @@ export const uiCommands = {
isAsync: true, isAsync: true,
outputVariable: "[inputValue1]", outputVariable: "[inputValue1]",
saveOutput: true, saveOutput: true,
width: 12, subCommands: [
{
value: "quickcommand.showInputBox",
icon: "call_to_action",
label: "插件内弹窗",
config: [ config: [
{ {
label: "输入框", label: "输入框",
@ -155,21 +176,54 @@ export const uiCommands = {
}, },
], ],
}, },
],
},
{
value: "quickcommand.showSystemInputBox",
icon: "report",
label: "系统弹窗",
config: [
{
label: "提示信息",
component: "ArrayEditor",
width: 12,
},
{ {
label: "标题", label: "标题",
component: "VariableInput", component: "VariableInput",
defaultValue: newVarInputVal("str"), defaultValue: newVarInputVal("str", "请输入"),
width: 12, width: 12,
}, },
], ],
}, },
],
},
{ {
value: "quickcommand.showSelectList", value: "quickcommand.showSelectList",
label: "选择列表", label: "uTools选择列表",
desc: "显示一个支持搜索的选项列表,可以动态更新选项", desc: "显示一个支持搜索的选项列表,可以动态更新选项",
component: "SelectListEditor", component: "SelectListEditor",
isAsync: true, isAsync: true,
}, },
{
value: "quickcommand.showSystemSelectList",
label: "系统选择列表",
desc: "选择列表(系统)",
isAsync: true,
config: [
{
label: "选项",
component: "ArrayEditor",
width: 12,
},
{
label: "标题",
component: "VariableInput",
defaultValue: newVarInputVal("str", "请选择"),
width: 12,
},
],
},
{ {
value: "quickcommand.showTextArea", value: "quickcommand.showTextArea",
label: "文本框", label: "文本框",
@ -191,6 +245,18 @@ export const uiCommands = {
width: 6, width: 6,
}, },
], ],
subCommands: [
{
value: "quickcommand.showTextArea",
icon: "call_to_action",
label: "插件内弹窗",
},
{
value: "quickcommand.showSystemTextArea",
icon: "report",
label: "系统弹窗(Mac不支持)",
},
],
}, },
{ {
value: "quickcommand.showMessageBox", value: "quickcommand.showMessageBox",
@ -205,6 +271,13 @@ export const uiCommands = {
defaultValue: newVarInputVal("str", "这是一条提示消息"), defaultValue: newVarInputVal("str", "这是一条提示消息"),
width: 12, width: 12,
}, },
],
subCommands: [
{
value: "quickcommand.showMessageBox",
icon: "call_to_action",
label: "插件内弹窗",
config: [
{ {
label: "图标类型", label: "图标类型",
component: "q-select", component: "q-select",
@ -228,6 +301,21 @@ export const uiCommands = {
}, },
], ],
}, },
{
value: "quickcommand.showSystemMessageBox",
icon: "report",
label: "系统弹窗",
config: [
{
label: "标题",
component: "VariableInput",
defaultValue: newVarInputVal("str", "提示"),
width: 12,
},
],
},
],
},
{ {
value: "quickcommand.showConfirmBox", value: "quickcommand.showConfirmBox",
label: "确认框", label: "确认框",
@ -246,13 +334,20 @@ export const uiCommands = {
label: "标题", label: "标题",
component: "VariableInput", component: "VariableInput",
defaultValue: newVarInputVal("str", "提示"), defaultValue: newVarInputVal("str", "提示"),
width: 7, width: 12,
}, },
],
subCommands: [
{
value: "quickcommand.showConfirmBox",
icon: "call_to_action",
label: "插件内弹窗",
config: [
{ {
label: "支持HTML", label: "支持HTML",
component: "q-toggle", component: "CheckButton",
defaultValue: false, defaultValue: false,
width: 2, width: 6,
}, },
{ {
label: "宽度", label: "宽度",
@ -260,11 +355,18 @@ export const uiCommands = {
min: 0, min: 0,
step: 100, step: 100,
defaultValue: 450, defaultValue: 450,
width: 3, width: 6,
placeholder: "对话框宽度", placeholder: "对话框宽度",
}, },
], ],
}, },
{
value: "quickcommand.showSystemConfirmBox",
icon: "report",
label: "系统弹窗",
},
],
},
{ {
value: "utools.showOpenDialog", value: "utools.showOpenDialog",
label: "文件选择框", label: "文件选择框",