import * as React from 'react'; import { Input, Checkbox, Icon, Select, Tooltip } from 'component/antd'; import { IFilter } from 'types/base-type'; import { cluster } from 'store/cluster'; import { expert } from 'store/expert'; import { app } from 'store/app'; import 'styles/search-filter.less'; import { urlPrefix } from 'constants/left-menu'; import { searchProps } from 'constants/table'; const Search = Input.Search; const Option = Select.Option; interface IFilterParams { filters: IFilter[]; setSelectedKeys: (selectedKeys: string[]) => void; confirm?: () => void; } interface ISearchAndFilterState { [filter: string]: boolean | string | number | any[]; } export class SearchAndFilterContainer extends React.Component { public timer: number; public urlPrefix: string = urlPrefix; public renderApp(text?: string) { return (
  • {text}
  • ); } public renderCluster(text?: string) { return (
  • {text}
  • ); } public renderAllCluster(text?: string) { return (
  • {text}
  • ); } public renderPhysical(text?: string) { return (
  • {text}
  • ); } public renderSearch(text?: string, placeholder?: string, keyName: string = 'searchKey') { const value = this.state[keyName] as string; return (
  • {text}
  • ); } public onSearchChange = (keyName: string, e: React.ChangeEvent) => { const searchKey = e.target.value.trim(); this.setState({ [keyName]: searchKey, }); } public handleChange(params: IFilterParams, e: []) { const { setSelectedKeys, confirm } = params; setSelectedKeys(e); confirm(); } public handleVisble = (type: string) => { if (this.timer) window.clearTimeout(this.timer); window.setTimeout(() => { this.setState({ [type]: true }); }); } public handleUnVisble = (type: string) => { this.timer = window.setTimeout(() => { this.setState({ [type]: false }); }, 100); } public renderFilter = (type: string, params: IFilterParams) => { const { filters } = params; return filters !== undefined ? ( ) :
    ; } public renderFilterIcon = (type: string) => { return ( ); } public renderColumnsFilter = (type: string, params?: any) => { return { filterIcon: this.renderFilterIcon.bind(null, type), filterDropdownVisible: this.state[type] as boolean, filterDropdown: this.renderFilter.bind(null, type), }; } }