web: components: fix FilterInput
This commit is contained in:
parent
050bb3ca56
commit
d59742fbfa
@ -273,9 +273,12 @@ class FilterInput extends React.Component {
|
||||
if (this.isResizeUpdate) {
|
||||
this.isResizeUpdate = false;
|
||||
}
|
||||
const fullWidth = this.searchWrapper.current.getBoundingClientRect().width;
|
||||
const filterWidth = this.filterWrapper.current.getBoundingClientRect().width;
|
||||
if (fullWidth <= this.minWidth || filterWidth > fullWidth / 2) this.updateFilter();
|
||||
|
||||
if(this.searchWrapper.current && this.filterWrapper.current){
|
||||
const fullWidth = this.searchWrapper.current.getBoundingClientRect().width;
|
||||
const filterWidth = this.filterWrapper.current.getBoundingClientRect().width;
|
||||
if (fullWidth <= this.minWidth || filterWidth > fullWidth / 2) this.updateFilter();
|
||||
}
|
||||
}
|
||||
onClickFilterItem(event, filterItem) {
|
||||
const currentFilterItems = cloneObjectsArray(this.state.filterValues);
|
||||
@ -365,6 +368,7 @@ class FilterInput extends React.Component {
|
||||
|
||||
componentDidMount() {
|
||||
window.addEventListener('resize', this.throttledResize);
|
||||
if(this.state.filterValues.length > 0) this.updateFilter();
|
||||
}
|
||||
componentWillUnmount() {
|
||||
window.removeEventListener('resize', this.throttledResize);
|
||||
|
@ -39,7 +39,10 @@ class FilterStory extends React.Component {
|
||||
super(props);
|
||||
this.state = {
|
||||
selectedFilterData: {
|
||||
inputValue: "text"
|
||||
inputValue: "text",
|
||||
filterValues: [
|
||||
{key: "1", group: "filter-status"}
|
||||
]
|
||||
}
|
||||
};
|
||||
this.buttonClick = this.buttonClick.bind(this);
|
||||
|
Loading…
Reference in New Issue
Block a user