优化windows下系统弹窗在高分屏下的显示,修复多处bug,去掉showsystemselectlist接口,调整runSharp接口,支持传参

This commit is contained in:
fofolee
2025-01-13 18:04:29 +08:00
parent 0a8c24374a
commit 877d13958a
6 changed files with 954 additions and 634 deletions

View File

@@ -200,30 +200,11 @@ export const uiCommands = {
},
{
value: "quickcommand.showSelectList",
label: "uTools选择列表",
label: "选择列表",
desc: "显示一个支持搜索的选项列表,可以动态更新选项",
component: "SelectListEditor",
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",
label: "文本框",
@@ -231,30 +212,44 @@ export const uiCommands = {
isAsync: true,
outputVariable: "textareaValue",
saveOutput: true,
config: [
{
label: "文本框占位符",
component: "VariableInput",
defaultValue: newVarInputVal("str", "请输入"),
width: 6,
},
{
label: "文本框默认值",
component: "VariableInput",
defaultValue: newVarInputVal("str"),
width: 6,
},
],
subCommands: [
{
value: "quickcommand.showTextArea",
icon: "call_to_action",
label: "插件内弹窗",
config: [
{
label: "文本框占位符",
component: "VariableInput",
defaultValue: newVarInputVal("str", "请输入"),
width: 6,
},
{
label: "文本框默认值",
component: "VariableInput",
defaultValue: newVarInputVal("str"),
width: 6,
},
],
},
{
value: "quickcommand.showSystemTextArea",
icon: "report",
label: "系统弹窗(Mac不支持)",
config: [
{
label: "文本框默认值",
component: "VariableInput",
defaultValue: newVarInputVal("str"),
width: 6,
},
{
label: "标题",
component: "VariableInput",
defaultValue: newVarInputVal("str", "请输入"),
width: 6,
},
],
},
],
},

View File

@@ -549,30 +549,12 @@ interface quickcommandApi {
*/
showSystemConfirmBox(content: string, title?: string): Promise<boolean>;
/**
* 显示一个系统级选择列表返回选择的项的索引和文本不支持Linux
*
* ```js
* quickcommand.showSystemSelectList(["选项1", "选项2", "选项3"], "请选择").then(result => {
* if (result) {
* console.log(`选择了第${result.id + 1}个选项:${result.text}`)
* }
* })
* ```
*
* @param items 选项列表
* @param title 标题,默认为空
*/
showSystemSelectList(
items: string[],
title?: string
): Promise<{ id: number; text: string } | null>;
/**
* 显示一个系统级按钮组对话框返回点击的按钮的索引和文本不支持Linux
*
* ```js
* quickcommand.showSystemButtonBox(["保存", "不保存", "取消"], "是否保存更改?", "保存确认").then(result => {
* quickcommand.showSystemButtonBox(["保存", "不保存", "取消"], "保存确认").then(result => {
* if (result) {
* console.log(`点击了第${result.id + 1}个按钮:${result.text}`)
* }
@@ -580,12 +562,10 @@ interface quickcommandApi {
* ```
*
* @param buttons 按钮文本数组
* @param content 对话框内容
* @param title 标题,默认为空
*/
showSystemButtonBox(
buttons: string[],
content: string,
title?: string
): Promise<{ id: number; text: string } | null>;
@@ -593,19 +573,17 @@ interface quickcommandApi {
* 显示一个系统级多行文本输入框仅Windows支持
*
* ```js
* quickcommand.showSystemTextArea("请输入多行文本:", "默认内容", "文本编辑").then(text => {
* quickcommand.showSystemTextArea("默认内容", "文本编辑").then(text => {
* if (text) {
* console.log("输入的文本:", text)
* }
* })
* ```
*
* @param placeholder 提示文本,默认为空
* @param defaultText 默认文本,默认为空
* @param defaultText 默认文本,默认为空
* @param title 标题,默认为空
*/
showSystemTextArea(
placeholder?: string,
defaultText?: string,
title?: string
): Promise<string | null>;