@@ -3,7 +3,15 @@ import { Box } from '@mui/system';
3
3
import { ConditionDropdown } from './ConditionDropdown' ;
4
4
import { Button as DagshubButton , ButtonVariant } from '../../../elements' ;
5
5
import { Icon } from '../../../icons' ;
6
- import { IconButton , Menu , MenuItem , ThemeProvider , Tooltip , Typography } from '@mui/material' ;
6
+ import {
7
+ Divider ,
8
+ IconButton ,
9
+ Menu ,
10
+ MenuItem ,
11
+ ThemeProvider ,
12
+ Tooltip ,
13
+ Typography
14
+ } from '@mui/material' ;
7
15
import theme from '../../../../theme' ;
8
16
import Condition from './Condition' ;
9
17
import AddIcon from '@mui/icons-material/Add' ;
@@ -69,36 +77,44 @@ export function GroupCondition({
69
77
} }
70
78
>
71
79
{ level == 0 && (
72
- < Box
73
- sx = { {
74
- position : 'absolute' ,
75
- top : '-1px' ,
76
- right : '-1px' ,
77
- borderRadius : '0px 0px 0px 14px' ,
78
- border : '1px solid rgba(226, 232, 240, 1)' ,
79
- display : 'flex' ,
80
- justifyContent : 'center' ,
81
- borderRight : 'none' ,
82
- borderTop : 'none' ,
83
- alignItems : 'center' ,
84
- '& .MuiSwitch-switchBase' : {
85
- '&.Mui-checked' : {
86
- '& + .MuiSwitch-track' : {
87
- backgroundColor : 'rgba(84, 103, 222, 1)!important'
80
+ < Tooltip
81
+ title = {
82
+ ! isDisplayableInSimpleMode ? 'Simplified query cannot contain groups, OR, NOT' : ''
83
+ }
84
+ placement = { 'top-start' }
85
+ arrow = { true }
86
+ >
87
+ < Box
88
+ sx = { {
89
+ position : 'absolute' ,
90
+ top : '-1px' ,
91
+ right : '-1px' ,
92
+ borderRadius : '0px 0px 0px 14px' ,
93
+ border : '1px solid rgba(226, 232, 240, 1)' ,
94
+ display : 'flex' ,
95
+ justifyContent : 'center' ,
96
+ borderRight : 'none' ,
97
+ borderTop : 'none' ,
98
+ alignItems : 'center' ,
99
+ '& .MuiSwitch-switchBase' : {
100
+ '&.Mui-checked' : {
101
+ '& + .MuiSwitch-track' : {
102
+ backgroundColor : 'rgba(84, 103, 222, 1)!important'
103
+ }
88
104
}
89
105
}
90
- }
91
- } }
92
- >
93
- < LabeledSwitch
94
- label = { 'Advanced query builder ' }
95
- labelPlacement = { 'end ' }
96
- padding = { '8px' }
97
- checked = { ! isSimpleMode }
98
- disabled = { ! isDisplayableInSimpleMode }
99
- onChange = { onToggleQueryMode }
100
- / >
101
- </ Box >
106
+ } }
107
+ >
108
+ < LabeledSwitch
109
+ label = { 'Advanced query builder' }
110
+ labelPlacement = { 'end ' }
111
+ padding = { '8px ' }
112
+ checked = { ! isSimpleMode }
113
+ disabled = { ! isDisplayableInSimpleMode }
114
+ onChange = { onToggleQueryMode }
115
+ />
116
+ </ Box >
117
+ </ Tooltip >
102
118
) }
103
119
< Box
104
120
style = { {
@@ -238,7 +254,9 @@ export function GroupCondition({
238
254
'& .MuiPaper-root' : {
239
255
borderRadius : '12px'
240
256
} ,
241
- padding : '8px'
257
+ '.MuiList-root' : {
258
+ padding : '8px!important'
259
+ }
242
260
} }
243
261
id = "basic-menu"
244
262
anchorEl = { addMenuAnchorEl }
@@ -248,6 +266,29 @@ export function GroupCondition({
248
266
'aria-labelledby' : 'basic-button'
249
267
} }
250
268
>
269
+ < MenuItem
270
+ onClick = { ( ) => {
271
+ const newConditions = condition . and || condition . or || [ ] ;
272
+ newConditions . push ( { and : [ ] } ) ; // is it ok or should it be [{}]
273
+ onChangeHandler ( newConditions ) ;
274
+ setIsAddMenuOpen ( false ) ;
275
+ } }
276
+ sx = { {
277
+ display : 'flex' ,
278
+ flexDirection : 'row' ,
279
+ gap : '8px' ,
280
+ alignItems : 'center' ,
281
+ padding : '8px!important'
282
+ } }
283
+ >
284
+ < Icon
285
+ icon = { 'outline-group' }
286
+ width = { 11.83 }
287
+ height = { 13.95 }
288
+ fill = { 'rgba(71, 85, 105, 1)' }
289
+ />
290
+ < Typography variant = { 'medium' } > Add condition group</ Typography >
291
+ </ MenuItem >
251
292
{ ! areThereSimpleFilters && (
252
293
< MenuItem
253
294
onClick = { ( ) => {
@@ -263,29 +304,55 @@ export function GroupCondition({
263
304
onChangeHandler ( newConditions ) ;
264
305
setIsAddMenuOpen ( false ) ;
265
306
} }
307
+ sx = { {
308
+ display : 'flex' ,
309
+ flexDirection : 'row' ,
310
+ gap : '8px' ,
311
+ alignItems : 'center' ,
312
+ padding : '8px!important'
313
+ } }
266
314
>
315
+ < Icon
316
+ icon = { 'solid-plus' }
317
+ width = { 11.2 }
318
+ height = { 11.2 }
319
+ fill = { 'rgba(71, 85, 105, 1)' }
320
+ />
267
321
< Typography variant = { 'medium' } > Add condition</ Typography >
268
322
</ MenuItem >
269
323
) }
270
- < MenuItem
271
- onClick = { ( ) => {
272
- const newConditions = condition . and || condition . or || [ ] ;
273
- newConditions . push ( { and : [ ] } ) ; // is it ok or should it be [{}]
274
- onChangeHandler ( newConditions ) ;
275
- setIsAddMenuOpen ( false ) ;
276
- } }
277
- >
278
- < Typography variant = { 'medium' } > Add condition group</ Typography >
279
- </ MenuItem >
280
324
{ ! condition . not && (
281
- < MenuItem
282
- onClick = { ( ) => {
283
- onChange ( { ...condition , not : ! condition . not } ) ;
284
- setIsAddMenuOpen ( false ) ;
285
- } }
286
- >
287
- < Typography variant = { 'medium' } > Add NOT to group</ Typography >
288
- </ MenuItem >
325
+ < >
326
+ < Divider
327
+ sx = { {
328
+ height : '2px' ,
329
+ backgroundColor : 'rgba(226, 232, 240, 1)' ,
330
+ border : '0px' ,
331
+ margin : '0px!important'
332
+ } }
333
+ />
334
+ < MenuItem
335
+ onClick = { ( ) => {
336
+ onChange ( { ...condition , not : ! condition . not } ) ;
337
+ setIsAddMenuOpen ( false ) ;
338
+ } }
339
+ sx = { {
340
+ display : 'flex' ,
341
+ flexDirection : 'row' ,
342
+ gap : '8px' ,
343
+ alignItems : 'center' ,
344
+ padding : '8px!important'
345
+ } }
346
+ >
347
+ < Icon
348
+ icon = { 'outline-not' }
349
+ width = { 14 }
350
+ height = { 14 }
351
+ fill = { 'rgba(71, 85, 105, 1)' }
352
+ />
353
+ < Typography variant = { 'medium' } > Add NOT to group</ Typography >
354
+ </ MenuItem >
355
+ </ >
289
356
) }
290
357
</ Menu >
291
358
</ Box >
0 commit comments