refractor(web): 优化选择节点的选择器

This commit is contained in:
2025-07-16 23:08:25 +08:00
parent 72a9d58f4c
commit fbc6144d82
6 changed files with 13 additions and 10 deletions

View File

@@ -109,6 +109,7 @@ function FlowEditor(props: FlowEditorProps) {
onNodeDrag={onNodeDrag}
onNodeDragStop={onNodeDragEnd}
onEdgesDelete={() => console.info('delete')}
fitView
>
<Panel position="top-right">
<Space className="toolbar">

View File

@@ -103,11 +103,8 @@ export const generateAllIncomerOutputVariablesFormOptions: (id: string, inputSch
type ConditionOperator = string | { label: string, value: string }
const textOperators: ConditionOperator[] = ['equal', 'not_equal', 'is_empty', 'is_not_empty', 'like', 'not_like', 'starts_with', 'ends_with']
const textDefaultOperator: string = 'equal'
const booleanOperators: ConditionOperator[] = [
{label: '为真', value: 'is_true'},
{label: '为假', value: 'is_false'},
]
const booleanDefaultOperator: string = 'is_true'
const booleanOperators: ConditionOperator[] = ['equal', 'not_equal']
const booleanDefaultOperator: string = 'equal'
const numberOperators: ConditionOperator[] = [
'equal',
'not_equal',
@@ -139,8 +136,13 @@ export const generateAllIncomerOutputVariablesConditions: (id: string, inputSche
} : {}),
...(item.type === 'boolean' ? {
value: {
type: 'wrapper',
size: 'none',
type: 'select',
required: true,
selectFirst: true,
options: [
{label: '真', value: true},
{label: '假', value: false},
]
},
defaultOp: booleanDefaultOperator,
operators: booleanOperators,

View File

@@ -31,6 +31,8 @@ const SwitchNode = (props: NodeProps) => {
name: 'condition',
label: '条件',
required: true,
builderMode: 'simple',
showANDOR: true,
fields: generateAllIncomerOutputVariablesConditions(
props.id,
getInputSchema(),