@@ -92,16 +92,9 @@ export class AdvancedFilter extends React.Component<AdvancedFilterProps, {}> {
92
92
return tags ;
93
93
}
94
94
95
- render ( ) {
96
- const { disabled , label, helpText } = this . props ;
95
+ renderHeader ( ) {
96
+ const { helpText , label } = this . props ;
97
97
const text = helpText ? < p > { helpText } </ p > : undefined ;
98
- // replace "-" with spaces, replace "." with nothing.
99
- const id = label . replace ( / \ / g, "-" ) . replace ( / \. / g, "" ) ;
100
- if ( disabled ) {
101
- // tslint:disable-next-line:no-null-keyword
102
- return null ;
103
- }
104
-
105
98
const tooltip = generateTooltip ( {
106
99
helpText : text ,
107
100
displayIcon : text !== undefined ,
@@ -112,21 +105,49 @@ export class AdvancedFilter extends React.Component<AdvancedFilterProps, {}> {
112
105
)
113
106
} ) ;
114
107
108
+ return (
109
+ < div className = "filter-container-header" >
110
+ < label > { tooltip } </ label >
111
+ </ div >
112
+ ) ;
113
+ }
114
+
115
+ renderBody ( ) {
116
+ const { displayAllButton, isMultiSelect } = this . props ;
117
+ const orientationVertical =
118
+ displayAllButton === true || isMultiSelect === true ;
119
+
120
+ return (
121
+ < div
122
+ className = { `${
123
+ orientationVertical ? "nested-btn-group" : ""
124
+ } btn-group-sm toggle-group ${
125
+ orientationVertical ? "vertical" : "horizontal"
126
+ } `}
127
+ data-toggle = "buttons"
128
+ >
129
+ { this . renderAllBtnContainer ( ) }
130
+ < div className = "btn-group filter-btn-group" > { this . renderTags ( ) } </ div >
131
+ </ div >
132
+ ) ;
133
+ }
134
+
135
+ render ( ) {
136
+ const { disabled, label, helpText } = this . props ;
137
+ // replace "-" with spaces, replace "." with nothing.
138
+ const id = label . replace ( / \ / g, "-" ) . replace ( / \. / g, "" ) ;
139
+ if ( disabled ) {
140
+ // tslint:disable-next-line:no-null-keyword
141
+ return null ;
142
+ }
143
+
115
144
return (
116
145
< div
117
146
id = { `${ id } -filter` . toLocaleLowerCase ( ) }
118
147
className = { "filter-selection" }
119
148
>
120
- < div className = "filter-container-header" >
121
- < label > { tooltip } </ label >
122
- </ div >
123
- < div
124
- className = "nested-btn-group btn-group-sm toggle-group vertical"
125
- data-toggle = "buttons"
126
- >
127
- { this . renderAllBtnContainer ( ) }
128
- < div className = "btn-group filter-btn-group" > { this . renderTags ( ) } </ div >
129
- </ div >
149
+ { this . renderHeader ( ) }
150
+ { this . renderBody ( ) }
130
151
</ div >
131
152
) ;
132
153
}
0 commit comments