From 71a0e75ecb56ae643fe1e86188d45f93f48388c9 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 28 八月 2020 14:07:41 +0800
Subject: [PATCH] 2020-08-28

---
 src/templates/modalconfig/dragelement/card.jsx |   42 +++++++++++++++++++++++-------------------
 1 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/src/templates/modalconfig/dragelement/card.jsx b/src/templates/modalconfig/dragelement/card.jsx
index aaf80ec..21d7dec 100644
--- a/src/templates/modalconfig/dragelement/card.jsx
+++ b/src/templates/modalconfig/dragelement/card.jsx
@@ -1,8 +1,7 @@
 import React from 'react'
 import { useDrag, useDrop } from 'react-dnd'
-import { Icon, Select, DatePicker, Input, InputNumber, Button } from 'antd'
+import { Icon, Select, DatePicker, Input, InputNumber, Button, Popover } from 'antd'
 import moment from 'moment'
-import ItemTypes from './itemtypes'
 import './index.scss'
 
 const { MonthPicker } = DatePicker
@@ -11,13 +10,13 @@
 const Card = ({ id, card, cols, moveCard, findCard, editCard, closeCard, copyCard, hasDrop }) => {
   const originalIndex = findCard(id).index
   const [{ isDragging }, drag] = useDrag({
-    item: { type: ItemTypes.form, id, originalIndex },
+    item: { type: 'form', id, originalIndex },
     collect: monitor => ({
       isDragging: monitor.isDragging(),
     }),
   })
   const [, drop] = useDrop({
-    accept: ItemTypes.form,
+    accept: 'form',
     canDrop: () => true,
     drop: (item) => {
       if (!item.hasOwnProperty('originalIndex')) {
@@ -98,22 +97,27 @@
   }
 
   return (
-    <div className="page-card" style={{ opacity: opacity}}>
-      <div ref={node => drag(drop(node))}>
-        {<div className="ant-row ant-form-item">
-          <div className={'ant-col ant-form-item-label ant-col-xs-24 ' + labelCol}>
-            <label title={card.label}>{card.label}</label>
-            <Icon className="edit" type="edit" onClick={edit} />
-            <Icon className="edit close" type="close" onClick={close} />
-            <Icon className="edit copy" type="copy" onClick={copy} />
-          </div>
-          <div className={'ant-col ant-form-item-control-wrapper ant-col-xs-24 ' + wrapCol}>
-            {formItem}
-            <div className="input-mask"></div>
-          </div>
-        </div>}
+    <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
+      <div className="mk-popover-control">
+        <Icon className="edit" type="edit" onClick={edit} />
+        <Icon className="copy" type="copy" onClick={copy} />
+        <Icon className="close" type="close" onClick={close} />
       </div>
-    </div>
+    } trigger="hover">
+      <div className="page-card" style={{ opacity: opacity}}>
+        <div ref={node => drag(drop(node))}>
+          {<div className="ant-row ant-form-item">
+            <div className={'ant-col ant-form-item-label ant-col-xs-24 ' + labelCol}>
+              <label title={card.label}>{card.label}</label>
+            </div>
+            <div className={'ant-col ant-form-item-control-wrapper ant-col-xs-24 ' + wrapCol}>
+              {formItem}
+              <div className="input-mask"></div>
+            </div>
+          </div>}
+        </div>
+      </div>
+    </Popover>
   )
 }
 export default Card

--
Gitblit v1.8.0