king
2022-03-21 fc241324087e605b145e8bbcc4ee3aece61dbf14
src/menu/components/table/edit-table/columns/index.jsx
@@ -43,7 +43,7 @@
      return true
    }
    if (!nextProps.column) return false
    if (!nextProps.column) return true
    return !is(fromJS(this.props.column), fromJS(nextProps.column)) ||
      !is(fromJS(this.props.fields), fromJS(nextProps.fields)) ||
@@ -53,17 +53,23 @@
  render() {
    const { connectDragSource, connectDropTarget, moveCol, addElement, updateCol, editColumn, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props
    if (!column) return (
      <th {...restProps} index={index}>
        {children}
      </th>
    )
    return connectDragSource(
      connectDropTarget(<th {...restProps} index={index} style={{ cursor: 'move', textAlign: align }} onDoubleClick={() => column && this.props.editColumn(column)}>
      connectDropTarget(<th {...restProps} index={index} style={{ cursor: 'move', textAlign: align }} onDoubleClick={() => this.props.editColumn(column)}>
        <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
          <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}>
            {column && ['custom', 'action'].includes(column.type) ?
            {['custom', 'action'].includes(column.type) ?
              <PlusOutlined className="plus" title="添加" onClick={() => this.props.addElement(column)} /> : null
            }
            <EditOutlined className="edit" title="编辑" onClick={() => this.props.editColumn(column)} />
            {column && column.type === 'custom' ? <FontColorsOutlined className="style" title="调整样式" onClick={() => this.props.changeStyle(column)}/> : null}
            {column.type === 'custom' ? <FontColorsOutlined className="style" title="调整样式" onClick={() => this.props.changeStyle(column)}/> : null}
            <DeleteOutlined className="close" title="删除" onClick={this.deleteCol} />
            {column && ['text', 'number', 'formula'].includes(column.type) ? <MarkColumn columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null }
            {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null }
          </div>
        } trigger="hover">
          {children}
@@ -516,6 +522,13 @@
      }
    }
    let rowSelection = null
    if (config.wrap.tableType) {
      rowSelection = {
        type: config.wrap.tableType === 'radio' ? 'radio' : 'checkbox',
      }
    }
    const columns = this.state.columns.map((col, index) => {
      let title = col.label
      if (col.editable === 'true') {
@@ -578,6 +591,7 @@
            rowClassName="editable-row"
            style={style}
            bordered={config.wrap.bordered !== 'false'}
            rowSelection={rowSelection}
            components={components}
            dataSource={this.state.data}
            columns={columns}