| | |
| | | }))(HeaderCol), |
| | | ) |
| | | |
| | | class HeaderEmptyCol extends Component { |
| | | render() { |
| | | const { connectDragSource, connectDropTarget } = this.props |
| | | |
| | | return connectDragSource( |
| | | connectDropTarget(<div style={{border: '1px solid #e8e8e8', textAlign: 'center', height: '100px', lineHeight: '100px', color: '#bcbcbc'}}>请添加显示列</div>) |
| | | ) |
| | | } |
| | | } |
| | | |
| | | const ColEmptyTarget = { |
| | | drop(props, monitor) { |
| | | const item = monitor.getItem() |
| | | |
| | | if (item.$init) { |
| | | props.dropCol(item, 0) |
| | | } |
| | | } |
| | | } |
| | | |
| | | const DragableEmptyCol = DropTarget('col', ColEmptyTarget, connect => ({ |
| | | connectDropTarget: connect.dropTarget() |
| | | }))( |
| | | DragSource('col', rowSource, connect => ({ |
| | | connectDragSource: connect.dragSource(), |
| | | }))(HeaderEmptyCol) |
| | | ) |
| | | |
| | | class EditableColumnCell extends Component { |
| | | updateCard = (vals, btn) => { |
| | | const { column } = this.props |
| | |
| | | } : false} |
| | | /> |
| | | }) : |
| | | <Table |
| | | (columns.length === 0 ? <DragableEmptyCol dropCol={this.dropCol}/> : <Table |
| | | rowKey="uuid" |
| | | size={config.wrap.size || 'middle'} |
| | | bordered={config.wrap.bordered !== 'false'} |
| | |
| | | total: 58, |
| | | showTotal: (total, range) => `${range[0]}-${range[1]} 共 ${total} 条` |
| | | }} |
| | | />} |
| | | />)} |
| | | </DndProvider> |
| | | <EditColumn column={card} fields={fields} submitCol={this.submitCol} cancelCol={this.cancelCol}/> |
| | | </div> |