File tree 3 files changed +38
-2
lines changed
packages/data-grid/src/quickFilter
3 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -30,11 +30,28 @@ const propTypes = {
30
30
} ;
31
31
32
32
function QuickFilter ( { filters, onFilterSelect } ) {
33
+ /** Used for the options array when there is no items to filter by */
34
+ const emptyFilterOption = [
35
+ {
36
+ label : 'No items to filter by' ,
37
+ disabled : true ,
38
+ } ,
39
+ ] ;
40
+
33
41
return (
34
42
< div className = "dg-quick-filter-container" >
35
43
< div className = "dg-quick-filter-filters" >
36
44
{ filters . map ( ( filter , idx ) => {
37
- return (
45
+ return ! filter . options ? (
46
+ < ButtonSelect
47
+ className = "dg-quick-filter-empty"
48
+ id = { `quick-filter-${ filter . field } -${ idx } ` }
49
+ key = { `${ idx + 1 } ` }
50
+ type = "tertiary"
51
+ options = { emptyFilterOption }
52
+ placeholder = { filter . fieldLabel }
53
+ />
54
+ ) : (
38
55
< ButtonSelect
39
56
className = "dg-quick-filter"
40
57
id = { `quick-filter-${ filter . field } -${ idx } ` }
Original file line number Diff line number Diff line change @@ -49,6 +49,10 @@ const filters = [
49
49
},
50
50
],
51
51
},
52
+ {
53
+ fieldLabel: ' Empty filter' ,
54
+ field: ' Empty-array' ,
55
+ },
52
56
];
53
57
54
58
Original file line number Diff line number Diff line change
1
+ @import ' @puppet/sass-variables/_index' ;
2
+
1
3
.dg-quick-filter-container {
2
4
3
5
.dg-quick-filter-filters {
7
9
padding-right : 8px ;
8
10
padding-bottom : 16px ;
9
11
}
12
+ .dg-quick-filter-empty {
13
+ padding-right : 8px ;
14
+ padding-bottom : 16px ;
15
+ font-style : italic ;
16
+
17
+ .rc-menu-list-item-focused {
18
+ cursor : not-allowed ;
19
+ }
20
+ .rc-menu-list-item-disabled {
21
+ .rc-menu-list-item-content {
22
+ color : $puppet-n700 ;
23
+ }
24
+ }
25
+ }
10
26
}
11
-
12
27
}
You can’t perform that action at this time.
0 commit comments