| | |
| | | MKEmitter.removeListener('addSearch', this.addSearch) |
| | | } |
| | | |
| | | addSearch = (cardId, element) => { |
| | | addSearch = (cardId, element, type) => { |
| | | if (cardId !== this.props.config.uuid) return |
| | | |
| | | const { searchlist } = this.state |
| | | |
| | | if (type === 'replace') { |
| | | delete element.focus |
| | | this.setState({ |
| | | searchlist: searchlist.map(cell => { |
| | | if (cell.field && cell.field.toLowerCase() === element.field.toLowerCase()) { |
| | | return element |
| | | } |
| | | return cell |
| | | }), |
| | | }) |
| | | } else { |
| | | this.setState({searchlist: [...searchlist, element]}) |
| | | } |
| | | this.handleSearch(element) |
| | | } |
| | | |