wwf
3 天以前 a430284aa21e3ae1f0d5654e55b2ad2852519cc2
app/components/workflow/nodes/if-else/components/condition-wrap.tsx
@@ -12,13 +12,12 @@
import type { Node, NodeOutPutVar, Var } from '../../../types'
import { VarType } from '../../../types'
import { useGetAvailableVars } from '../../variable-assigner/hooks'
import { SUB_VARIABLES } from '../../constants'
import { SUB_VARIABLES } from '../default'
import ConditionList from './condition-list'
import ConditionAdd from './condition-add'
import cn from '@/utils/classnames'
import Button from '@/app/components/base/button'
import { PortalSelect as Select } from '@/app/components/base/select'
import { noop } from 'lodash-es'
type Props = {
  isSubVariable?: boolean
@@ -50,7 +49,7 @@
  nodeId: id = '',
  cases = [],
  readOnly,
  handleSortCase = noop,
  handleSortCase = () => { },
  handleRemoveCase,
  handleUpdateCondition,
  handleAddCondition,
@@ -98,18 +97,18 @@
                className={cn(
                  'group relative rounded-[10px] bg-components-panel-bg',
                  willDeleteCaseId === item.case_id && 'bg-state-destructive-hover',
                  !isSubVariable && 'min-h-[40px] px-3 py-1 ',
                  !isSubVariable && 'py-1 px-3 min-h-[40px] ',
                  isSubVariable && 'px-1 py-2',
                )}
              >
                {!isSubVariable && (
                  <>
                    <RiDraggable className={cn(
                      'handle absolute left-1 top-2 hidden h-3 w-3 cursor-pointer text-text-quaternary',
                      'hidden handle absolute top-2 left-1 w-3 h-3 text-text-quaternary cursor-pointer',
                      casesLength > 1 && 'group-hover:block',
                    )} />
                    <div className={cn(
                      'absolute left-4 text-[13px] font-semibold leading-4 text-text-secondary',
                      'absolute left-4 leading-4 text-[13px] font-semibold text-text-secondary',
                      casesLength === 1 ? 'top-2.5' : 'top-1',
                    )}>
                      {
@@ -117,7 +116,7 @@
                      }
                      {
                        casesLength > 1 && (
                          <div className='text-[10px] font-medium text-text-tertiary'>CASE {index + 1}</div>
                          <div className='text-[10px] text-text-tertiary font-medium'>CASE {index + 1}</div>
                        )
                      }
                    </div>
@@ -169,7 +168,7 @@
                            size='small'
                            disabled={readOnly}
                          >
                            <RiAddLine className='mr-1 h-3.5 w-3.5' />
                            <RiAddLine className='mr-1 w-3.5 h-3.5' />
                            {t('workflow.nodes.ifElse.addSubVariable')}
                          </Button>
                        )}
@@ -188,7 +187,7 @@
                  {
                    ((index === 0 && casesLength > 1) || (index > 0)) && (
                      <Button
                        className='hover:bg-components-button-destructive-ghost-bg-hover hover:text-components-button-destructive-ghost-text'
                        className='hover:text-components-button-destructive-ghost-text hover:bg-components-button-destructive-ghost-bg-hover'
                        size='small'
                        variant='ghost'
                        disabled={readOnly}
@@ -196,7 +195,7 @@
                        onMouseEnter={() => setWillDeleteCaseId(item.case_id)}
                        onMouseLeave={() => setWillDeleteCaseId('')}
                      >
                        <RiDeleteBinLine className='mr-1 h-3.5 w-3.5' />
                        <RiDeleteBinLine className='mr-1 w-3.5 h-3.5' />
                        {t('common.operation.remove')}
                      </Button>
                    )
@@ -204,7 +203,7 @@
                </div>
              </div>
              {!isSubVariable && (
                <div className='mx-3 my-2 h-[1px] bg-divider-subtle'></div>
                <div className='my-2 mx-3 h-[1px] bg-divider-subtle'></div>
              )}
            </div>
          ))
@@ -216,7 +215,7 @@
          disabled={readOnly}
          onClick={() => handleAddSubVariableCondition?.(caseId!, conditionId!)}
        >
          <RiAddLine className='mr-1 h-3.5 w-3.5' />
          <RiAddLine className='mr-1 w-3.5 h-3.5' />
          {t('workflow.nodes.ifElse.addSubVariable')}
        </Button>
      )}