| | |
| | | import React from 'react' |
| | | import { useDrag, useDrop } from 'react-dnd' |
| | | import { Icon, Select, DatePicker, Input, Popover } from 'antd' |
| | | import { Icon, Select, DatePicker, Input, Popover, Form } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import DateGroup from '../dategroup' |
| | |
| | | const [, drop] = useDrop({ |
| | | accept: 'search', |
| | | canDrop: () => true, |
| | | drop: () => {}, |
| | | hover({ id: draggedId }) { |
| | | drop: ({ id: draggedId }) => { |
| | | if (!draggedId || draggedId === id) return |
| | | |
| | | const { index: originIndex } = findCard(draggedId) |
| | |
| | | |
| | | const { index: overIndex } = findCard(id) |
| | | moveCard(draggedId, overIndex) |
| | | }, |
| | | } |
| | | }) |
| | | const opacity = isDragging ? 0 : 1 |
| | | |
| | |
| | | <Icon className="close" title="delete" type="close" onClick={() => delCard(id)} /> |
| | | </div> |
| | | } trigger="hover"> |
| | | <div className="page-card" style={{ opacity: opacity}}> |
| | | <div className={'page-card ' + (card.labelShow || '')} style={{ opacity: opacity}}> |
| | | <div ref={node => drag(drop(node))}> |
| | | <div className="ant-form-item"> |
| | | <Form.Item |
| | | labelCol={{xs: { span: 24 }, sm: { span: 8 }}} |
| | | wrapperCol = {{xs: { span: 24 }, sm: { span: 16 }}} |
| | | label={card.labelShow !== 'false' ? card.label : ''} |
| | | required={card.required === 'true'} |
| | | > |
| | | {card.type === 'text' ? |
| | | <Input placeholder={card.label} value={card.initval} /> : null |
| | | } |
| | |
| | | /> : null |
| | | } |
| | | {card.type === 'group' ? <DateGroup card={card} /> : null } |
| | | </div> |
| | | </Form.Item> |
| | | </div> |
| | | </div> |
| | | </Popover> |