| | |
| | | import React from 'react' |
| | | import { fromJS } from 'immutable' |
| | | import { useDrag, useDrop } from 'react-dnd' |
| | | import { Icon, Popover } from 'antd' |
| | | import { Popover } from 'antd' |
| | | import { CloseOutlined, EditOutlined } from '@ant-design/icons' |
| | | |
| | | import getForm from './options' |
| | | import asyncIconComponent from '@/utils/asyncIconComponent' |
| | | import './index.scss' |
| | | |
| | | const NormalForm = asyncIconComponent(() => import('@/components/normalform')) |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | | |
| | | const Card = ({ id, card, active, moveCard, findCard, closeCard, selectCard, updateGroup }) => { |
| | | const Card = ({ id, card, sort, active, moveCard, findCard, closeCard, selectCard, updateGroup }) => { |
| | | const originalIndex = findCard(id).index |
| | | const [{ isDragging }, drag] = useDrag({ |
| | | item: { type: 'form', id, originalIndex }, |
| | |
| | | } |
| | | } |
| | | }) |
| | | const opacity = isDragging ? 0 : 1 |
| | | const opacity = isDragging ? 0.5 : 1 |
| | | |
| | | const close = () => { |
| | | closeCard(id) |
| | |
| | | selectCard(id) |
| | | } |
| | | |
| | | const getForms = () =>{ |
| | | const getForms = () => { |
| | | return getForm(card) |
| | | } |
| | | |
| | |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <NormalForm title="分组编辑" width={850} update={updateSetting} getForms={getForms}> |
| | | <Icon type="edit" style={{color: '#1890ff'}} title="编辑"/> |
| | | <EditOutlined style={{color: '#1890ff'}} title="编辑"/> |
| | | </NormalForm> |
| | | <Icon className="close" type="close" onClick={close} /> |
| | | <CopyComponent type="formgroup" card={card}/> |
| | | <CloseOutlined className="close" type="close" onClick={close} /> |
| | | </div> |
| | | } trigger="hover"> |
| | | <div className={'page-card ' + (active ? 'active' : '')} onClick={select} style={{ opacity: opacity}}> |
| | | <div ref={node => drag(drop(node))}> |
| | | <span className="form-sort">{card.sort}</span> |
| | | <span className="form-sort">{sort}</span> |
| | | {card.setting.title} |
| | | </div> |
| | | </div> |