调整编排数组处理,补充基本功能,去除不常用功能

This commit is contained in:
fofolee
2025-02-25 20:47:33 +08:00
parent b9005cbe88
commit 15ab522738
3 changed files with 227 additions and 365 deletions

View File

@@ -226,31 +226,6 @@ export const dataCommands = {
typeName: "字符串",
},
},
{
value: "quickcomposer.data.string.join",
label: "数组合并",
icon: "merge",
config: [
{
label: "字符串数组",
component: "VariableInput",
icon: "view_list",
width: 8,
},
{
label: "连接符",
component: "VariableInput",
icon: "space_bar",
width: 4,
defaultValue: newVarInputVal("str", ","),
},
],
outputs: {
label: "合并结果",
suggestName: "joinedString",
typeName: "字符串",
},
},
{
value: "quickcomposer.data.string.repeat",
label: "字符串重复",
@@ -909,197 +884,158 @@ export const dataCommands = {
],
},
{
value: "quickcomposer.data.array.filter",
value: "Array.from",
label: "数组处理",
icon: "view_list",
subCommands: [
{
value: "quickcomposer.data.array.filter",
label: "数组过滤",
icon: "filter_alt",
value: "Array.from",
label: "创建数组",
config: [
{
component: "ArrayEditor",
icon: "view_list",
width: 12,
},
],
outputs: [
{
label: "创建的数组",
suggestName: "newArray",
},
],
},
{
value: "quickcomposer.data.array.push",
label: "添加元素",
icon: "add",
config: [
{
label: "原始数组",
component: "VariableInput",
icon: "view_list",
width: 12,
defaultValue: newVarInputVal("var"),
disableToggleType: true,
placeholder:
'[{"id":1,"name":"张三","age":20},{"id":2,"name":"李四","age":18}]',
width: 4,
placeholder: "[1,2,3]",
},
{
label: "过滤条件",
label: "要添加的元素",
component: "VariableInput",
icon: "code",
width: 12,
placeholder: "age > 18",
icon: "input",
width: 4,
placeholder: "4",
},
{
label: "位置(可选)",
component: "VariableInput",
icon: "first_page",
disableToggleType: true,
defaultValue: newVarInputVal("var"),
width: 4,
placeholder: "留空则添加到末尾",
},
],
},
{
value: "quickcomposer.data.array.map",
label: "数组映射",
icon: "transform",
value: "quickcomposer.data.array.splice",
label: "删除元素",
icon: "delete",
config: [
{
label: "原始数组",
component: "VariableInput",
icon: "view_list",
width: 12,
placeholder:
'[{"id":1,"name":"张三","age":20},{"id":2,"name":"李四","age":18}]',
placeholder: "[1,2,3,4,5]",
defaultValue: newVarInputVal("var"),
disableToggleType: true,
},
{
label: "转换函数",
label: "起始位置",
component: "VariableInput",
icon: "code",
placeholder: "name",
width: 12,
icon: "first_page",
disableToggleType: true,
defaultValue: newVarInputVal("var"),
width: 6,
placeholder: "1",
},
{
label: "删除数量",
component: "VariableInput",
disableToggleType: true,
defaultValue: newVarInputVal("var"),
icon: "delete",
width: 6,
placeholder: "1",
},
],
},
{
value: "quickcomposer.data.array.sort",
label: "数组排序",
icon: "sort",
config: [
{
label: "原始数组",
component: "VariableInput",
icon: "view_list",
width: 12,
placeholder:
'[{"id":1,"name":"张三","age":20},{"id":2,"name":"李四","age":18}]',
},
{
label: "排序字段",
component: "VariableInput",
icon: "key",
width: 6,
placeholder: "age",
},
{
label: "排序方式",
component: "QSelect",
icon: "sort",
options: [
{ label: "升序", value: "asc" },
{ label: "降序", value: "desc" },
],
defaultValue: "asc",
width: 6,
},
],
},
{
value: "quickcomposer.data.array.group",
label: "数组分组",
icon: "group_work",
value: "quickcomposer.data.array.join",
label: "连接数组(join)",
icon: "join_right",
config: [
{
label: "原始数组",
component: "VariableInput",
icon: "view_list",
width: 8,
placeholder:
'[{"id":1,"name":"张三","dept":"技术"},{"id":2,"name":"李四","dept":"技术"}]',
placeholder: "[1,2,3,4,5]",
defaultValue: newVarInputVal("var"),
disableToggleType: true,
},
{
label: "分组字段",
label: "连接符",
component: "VariableInput",
icon: "key",
icon: "swap_horiz",
width: 4,
placeholder: "dept",
defaultValue: newVarInputVal("str", ","),
},
],
},
{
value: "quickcomposer.data.array.unique",
label: "数组去重",
icon: "filter_1",
value: "quickcomposer.data.array.set",
label: "设置元素",
icon: "edit",
config: [
{
label: "原始数组",
component: "VariableInput",
icon: "view_list",
width: 8,
placeholder: '[{"id":1,"dept":"技术"},{"id":2,"dept":"技术"}]',
},
{
label: "去重字段",
component: "VariableInput",
icon: "key",
defaultValue: newVarInputVal("var"),
disableToggleType: true,
width: 4,
placeholder: "dept",
},
],
},
{
value: "quickcomposer.data.array.find",
label: "查找元素",
icon: "search",
config: [
{
label: "原始数组",
label: "位置",
component: "VariableInput",
icon: "view_list",
width: 12,
placeholder: '[{"id":1,"name":"张三"},{"id":2,"name":"李四"}]',
icon: "first_page",
disableToggleType: true,
defaultValue: newVarInputVal("var"),
width: 4,
placeholder: "1",
},
{
label: "查找条件",
label: "",
component: "VariableInput",
icon: "code",
width: 12,
placeholder: "id === 1",
},
],
},
{
value: "quickcomposer.data.array.aggregate",
label: "数组聚合",
icon: "functions",
config: [
{
label: "原始数组",
component: "VariableInput",
icon: "view_list",
width: 12,
placeholder: '[{"id":1,"amount":100},{"id":2,"amount":200}]',
},
{
label: "聚合操作",
component: "QSelect",
icon: "functions",
options: [
{ label: "求和", value: "sum" },
{ label: "平均值", value: "avg" },
{ label: "最大值", value: "max" },
{ label: "最小值", value: "min" },
{ label: "计数", value: "count" },
],
defaultValue: "sum",
width: 6,
},
{
label: "聚合字段",
component: "VariableInput",
icon: "key",
width: 6,
placeholder: "amount",
icon: "input",
width: 4,
placeholder: "4",
},
],
},
{
value: "quickcomposer.data.array.slice",
label: "数组切片",
label: "切片(slice)",
icon: "content_cut",
config: [
{
label: "原始数组",
component: "VariableInput",
icon: "view_list",
defaultValue: newVarInputVal("var"),
disableToggleType: true,
width: 12,
placeholder: "[1,2,3,4,5]",
},
@@ -1123,15 +1059,88 @@ export const dataCommands = {
},
],
},
{
value: "quickcomposer.data.array.filter",
label: "过滤(filter)",
icon: "filter_alt",
config: [
{
label: "原始数组",
component: "VariableInput",
icon: "view_list",
width: 12,
defaultValue: newVarInputVal("var"),
disableToggleType: true,
placeholder:
'[{"id":1,"name":"张三","age":20},{"id":2,"name":"李四","age":18}]',
},
{
label: "过滤条件",
component: "VariableInput",
icon: "code",
width: 12,
placeholder: "age > 18",
},
],
},
{
value: "quickcomposer.data.array.map",
label: "映射(map)",
icon: "transform",
config: [
{
label: "原始数组",
component: "VariableInput",
icon: "view_list",
defaultValue: newVarInputVal("var"),
disableToggleType: true,
width: 12,
placeholder:
'[{"id":1,"name":"张三","age":20},{"id":2,"name":"李四","age":18}]',
},
{
label: "转换函数",
component: "VariableInput",
icon: "code",
placeholder: "name",
width: 12,
},
],
},
{
value: "quickcomposer.data.array.find",
label: "查找元素(find)",
icon: "search",
config: [
{
label: "原始数组",
component: "VariableInput",
icon: "view_list",
defaultValue: newVarInputVal("var"),
disableToggleType: true,
width: 12,
placeholder: '[{"id":1,"name":"张三"},{"id":2,"name":"李四"}]',
},
{
label: "查找条件",
component: "VariableInput",
icon: "code",
width: 12,
placeholder: "id === 1",
},
],
},
{
value: "quickcomposer.data.array.flatten",
label: "数组扁平化",
label: "扁平化(flat)",
icon: "unfold_less",
config: [
{
label: "原始数组",
component: "VariableInput",
icon: "view_list",
defaultValue: newVarInputVal("var"),
disableToggleType: true,
width: 8,
placeholder: "[[1,2],[3,4],[[5,6]]]",
},
@@ -1146,123 +1155,54 @@ export const dataCommands = {
],
},
{
value: "quickcomposer.data.array.diff",
label: "数组差集",
icon: "difference",
config: [
{
label: "数组1",
component: "VariableInput",
icon: "view_list",
width: 6,
placeholder: "[1,2,3,4]",
},
{
label: "数组2",
component: "VariableInput",
icon: "view_list",
width: 6,
placeholder: "[3,4,5,6]",
},
{
label: "比较字段",
component: "VariableInput",
icon: "key",
width: 12,
placeholder: "对象数组时使用,如: id",
},
],
},
{
value: "quickcomposer.data.array.intersect",
label: "数组交集",
icon: "join_full",
config: [
{
label: "数组1",
component: "VariableInput",
icon: "view_list",
width: 6,
placeholder: "[1,2,3,4]",
},
{
label: "数组2",
component: "VariableInput",
icon: "view_list",
width: 6,
placeholder: "[3,4,5,6]",
},
{
label: "比较字段",
component: "VariableInput",
icon: "key",
width: 12,
placeholder: "对象数组时使用,如: id",
},
],
},
{
value: "quickcomposer.data.array.union",
label: "数组并集",
icon: "join_inner",
config: [
{
label: "数组1",
component: "VariableInput",
icon: "view_list",
width: 6,
placeholder: "[1,2,3,4]",
},
{
label: "数组2",
component: "VariableInput",
icon: "view_list",
width: 6,
placeholder: "[3,4,5,6]",
},
{
label: "比较字段",
component: "VariableInput",
icon: "key",
width: 12,
placeholder: "对象数组时使用,如: id",
},
],
},
{
value: "quickcomposer.data.array.chunk",
label: "数组分块",
icon: "grid_view",
value: "quickcomposer.data.array.unique",
label: "去重",
icon: "filter_1",
config: [
{
label: "原始数组",
component: "VariableInput",
icon: "view_list",
width: 8,
placeholder: "[1,2,3,4,5,6]",
},
{
label: "块大小",
component: "VariableInput",
icon: "straighten",
disableToggleType: true,
defaultValue: newVarInputVal("var"),
width: 4,
disableToggleType: true,
width: 12,
placeholder: "[1,2,3,1,2]",
},
],
},
{
value: "quickcomposer.data.array.shuffle",
label: "数组随机排序",
icon: "shuffle",
value: "quickcomposer.data.array.sort",
label: "排序",
icon: "sort",
config: [
{
label: "原始数组",
component: "VariableInput",
icon: "view_list",
width: 12,
defaultValue: newVarInputVal("var"),
disableToggleType: true,
width: 4,
placeholder: "[1,2,3,4,5]",
},
{
label: "排序方向",
component: "QSelect",
icon: "swap_vert",
width: 4,
options: [
{ label: "升序", value: "asc" },
{ label: "降序", value: "desc" },
{ label: "乱序", value: "shuffle" },
],
defaultValue: "asc",
},
{
label: "排序字段(可选)",
component: "VariableInput",
icon: "key",
width: 4,
placeholder: "dept",
},
],
},
],