| | |
| | | MKEmitter.addListener('submitStyle', this.getStyle) |
| | | MKEmitter.addListener('submitModal', this.handleSave) |
| | | MKEmitter.addListener('logButton', this.logButton) |
| | | MKEmitter.addListener('completeSave', this.completeSave) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | MKEmitter.removeListener('submitStyle', this.getStyle) |
| | | MKEmitter.removeListener('submitModal', this.handleSave) |
| | | MKEmitter.removeListener('logButton', this.logButton) |
| | | MKEmitter.removeListener('completeSave', this.completeSave) |
| | | } |
| | | |
| | | completeSave = () => { |
| | | const { card } = this.state |
| | | |
| | | if (card.isNew) { |
| | | let item = fromJS(card).toJS() |
| | | item.search = item.search.filter(a => !a.origin) |
| | | item.action = item.action.filter(a => !a.origin) |
| | | item.cols = item.cols.filter(a => !a.origin) |
| | | |
| | | delete item.isNew |
| | | |
| | | this.setState({card: item}, () => { MKEmitter.emit('revert') }) |
| | | } |
| | | } |
| | | |
| | | loopCol = (col) => { |
| | |
| | | } |
| | | |
| | | getWrapForms = () => { |
| | | const { wrap, action, columns } = this.state.card |
| | | const { wrap, action, columns, cols } = this.state.card |
| | | |
| | | return getWrapForm(wrap, action, columns) |
| | | let _actions = [...action] |
| | | |
| | | cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | _actions.push(...col.elements) |
| | | }) |
| | | |
| | | return getWrapForm(wrap, _actions, columns) |
| | | } |
| | | |
| | | updateWrap = (res) => { |