| | |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('plusSearch', this.plusSearch) |
| | | // MKEmitter.addListener('revert', this.revert) |
| | | MKEmitter.addListener('revert', this.revert) |
| | | } |
| | | |
| | | // revert = () => { |
| | | // this.setState({searchlist: fromJS(this.props.config.search).toJS()}) |
| | | // } |
| | | // dms-trans |
| | | revert = (id, type) => { |
| | | if (id !== this.props.config.uuid || type !== 'search') return |
| | | |
| | | this.setState({searchlist: fromJS(this.props.config.search).toJS()}) |
| | | } |
| | | |
| | | plusSearch = (MenuId, item, type) => { |
| | | const { config } = this.props |
| | |
| | | if (type === 'simple') { |
| | | this.setState({ |
| | | searchlist: [...searchlist, item], |
| | | }, () => { |
| | | this.handleSearch(item) |
| | | }) |
| | | } else if (type === 'replace') { |
| | | delete item.focus |
| | | this.setState({ |
| | | searchlist: searchlist.map(cell => { |
| | | if (cell.field && cell.field.toLowerCase() === item.field.toLowerCase()) { |
| | | return item |
| | | } |
| | | return cell |
| | | }), |
| | | }, () => { |
| | | this.handleSearch(item) |
| | | }) |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | // MKEmitter.removeListener('revert', this.revert) |
| | | MKEmitter.removeListener('revert', this.revert) |
| | | MKEmitter.removeListener('plusSearch', this.plusSearch) |
| | | } |
| | | |
| | |
| | | |
| | | let size = '' |
| | | if (config.wrap && config.wrap.searchSize) { |
| | | size = ' mk-size-' + config.wrap.searchSize |
| | | size = ' mk-order-' + config.wrap.searchSize |
| | | } |
| | | |
| | | return ( |