1
1
import { memo , useState } from "react"
2
- import { Form , Input , Select } from "antd"
2
+ import { Button , Form , Input , Select , Space } from "antd"
3
3
import { useTranslate } from "../../workflow-editor/react-locales"
4
4
import { styled } from "styled-components"
5
+ import { CheckCircleFilled , CloseCircleFilled , MinusOutlined , PlusOutlined } from "@ant-design/icons" ;
5
6
6
7
const itemHeight = 48 ;
7
8
8
9
const ExpressionGroup = styled . div `
9
10
display: flex;
10
11
align-items: stretch;
11
12
`
12
- const Operator = styled . div `
13
+ const GroupOperator = styled . div `
13
14
position: relative;
14
15
width: 80px;
15
16
//border: solid 1px;
@@ -18,7 +19,7 @@ const Operator = styled.div`
18
19
padding-right: 16px;
19
20
`
20
21
21
- const OperatorLine = styled . div `
22
+ const GroupOperatorLine = styled . div `
22
23
position: absolute;
23
24
left: calc(50% - 8px);
24
25
width: 20px;
@@ -60,7 +61,38 @@ export const Item = styled.div`
60
61
display: flex;
61
62
align-items: center;
62
63
min-height: 48px;
64
+ .actions-space{
65
+ display: none;
66
+ }
67
+ &:hover{
68
+ .actions-space{
69
+ display: flex;
70
+ }
71
+ }
72
+ `
73
+
74
+ export const ExpressionContent = styled ( Space ) `
75
+ flex: 1;
76
+ `
77
+
78
+ export const Actions = styled . div `
79
+ width: 60px;
80
+ display: flex;
81
+ justify-content: flex-end;
82
+ align-items: center;
63
83
`
84
+ export const AddIcon = styled ( PlusOutlined ) `
85
+ font-size:12px;
86
+ `
87
+ export const RemoveIcon = styled ( MinusOutlined ) `
88
+ font-size:12px;
89
+ `
90
+ // const SuccessIcon = styled(CheckCircleFilled)`
91
+ // color:${props => props.theme.token?.colorSuccess};
92
+ // `
93
+ // const ErrorIcon = styled(CloseCircleFilled)`
94
+ // color:${props => props.theme.token?.colorError};
95
+ // `
64
96
65
97
export interface IConditionSettings {
66
98
@@ -78,19 +110,41 @@ export const ConditionPanel = memo((
78
110
return (
79
111
< Form layout = "vertical" colon = { false } >
80
112
< ExpressionGroup className = "expression-group" >
81
- < Operator className = "operator" >
82
- < OperatorLine className = "operator-line" />
113
+ < GroupOperator className = "group- operator" >
114
+ < GroupOperatorLine className = "group- operator-line" />
83
115
< Select
84
116
defaultValue = "and"
85
117
options = { [
86
118
{ value : 'and' , label : '且' } ,
87
119
{ value : 'or' , label : '或' } ,
88
120
] }
89
121
/>
90
- </ Operator >
122
+ </ GroupOperator >
91
123
< ExpressionItems className = "expression-items-container" >
92
124
< Item >
93
- < Input />
125
+ < ExpressionContent >
126
+ < Select
127
+ defaultValue = "and"
128
+ options = { [
129
+ { value : 'and' , label : '物料' } ,
130
+ { value : 'or' , label : '或' } ,
131
+ ] }
132
+ />
133
+ < Select
134
+ defaultValue = "and"
135
+ options = { [
136
+ { value : 'and' , label : '大于等于' } ,
137
+ { value : 'or' , label : '或' } ,
138
+ ] }
139
+ />
140
+ < Input />
141
+ </ ExpressionContent >
142
+ < Actions className = "actions" >
143
+ < Space className = "actions-space" >
144
+ < Button size = "small" type = "text" icon = { < RemoveIcon className = "remove-icon" /> } />
145
+ < Button size = "small" type = "text" icon = { < AddIcon className = "add-icon" /> } />
146
+ </ Space >
147
+ </ Actions >
94
148
</ Item >
95
149
< Item >
96
150
< Input />
0 commit comments