king
2019-11-13 8b9effb98612ee8a00d76d639a5733d12e9ecce6
src/components/sidemenu/comtableconfig/dragelement/card.jsx
@@ -5,7 +5,7 @@
import ItemTypes from './itemtypes'
import './index.scss'
const Card = ({ id, type, card, moveCard, findCard, editCard }) => {
const Card = ({ id, type, card, moveCard, findCard, editCard, hasDrop }) => {
  const originalIndex = findCard(id).index
  const [{ isDragging }, drag] = useDrag({
    item: { type: ItemTypes[type], id, originalIndex },
@@ -15,8 +15,14 @@
  })
  const [, drop] = useDrop({
    accept: ItemTypes[type],
    canDrop: () => false,
    canDrop: () => true,
    drop: (item) => {
      if (!item.hasOwnProperty('originalIndex')) {
        hasDrop(card)
      }
    },
    hover({ id: draggedId }) {
      if (!draggedId) return
      if (draggedId !== id) {
        const { index: overIndex } = findCard(id)
        moveCard(draggedId, overIndex)
@@ -28,7 +34,6 @@
  const edit = () => {
    editCard(id)
  }
  return (
    <div className="page-card" style={type === 'columns' ? { flex: card.Width, opacity: opacity} : { opacity: opacity}}>
      <div ref={node => drag(drop(node))}>