import * as React from 'react'; import { Select, Input, Checkbox, Icon } from 'component/antd'; import { cluster } from 'store/cluster'; import { IFiler } from 'types/base-type'; const Option = Select.Option; const Search = Input.Search; interface IParams { filters: IFiler[]; setSelectedKeys: (selectedKeys: string[]) => void; confirm?: () => void; } interface IState { [filter: string]: boolean | string; } export class SearchAndFilter extends React.Component { public timer: number; public renderCluster() { return (
  • ); } public renderSearch(placeholder?: string, keyName: string = 'searchKey') { return (
  • ); } public onSearchChange = (keyName: string, e: React.ChangeEvent) => { const searchKey = e.target.value.trim(); this.setState({ [keyName]: searchKey, }); } public handleChange(params: IParams, 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: IParams) => { const { filters } = params; return filters !== undefined ? ( ) :
    ; } public renderFilterIcon = (type: string) => { return ( ); } public renderColumnsFilter = (type: string) => { return { filterIcon: this.renderFilterIcon.bind(null, type), filterDropdownVisible: this.state[type], filterDropdown: this.renderFilter.bind(null, type), }; } }