From f3167f8371d19d0ea8fe7d0e7af5517ff0b08cd2 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 07 四月 2021 23:25:29 +0800
Subject: [PATCH] 2021-04-07

---
 src/templates/modalconfig/dragelement/index.jsx |   39 ++++++---------------------------------
 1 files changed, 6 insertions(+), 33 deletions(-)

diff --git a/src/templates/modalconfig/dragelement/index.jsx b/src/templates/modalconfig/dragelement/index.jsx
index bcfe294..42ded36 100644
--- a/src/templates/modalconfig/dragelement/index.jsx
+++ b/src/templates/modalconfig/dragelement/index.jsx
@@ -7,7 +7,7 @@
 import Card from './card'
 import './index.scss'
 
-const Container = ({list, group, setting, placeholder, handleList, handleForm, closeForm, showField }) => {
+const Container = ({list, setting, placeholder, handleList, handleForm, closeForm, showField }) => {
   const [cards, setCards] = useState(list)
   const moveCard = (id, atIndex) => {
     const { card, index } = findCard(id)
@@ -16,11 +16,7 @@
 
     const _cards = update(cards, { $splice: [[index, 1], [atIndex, 0, card]] })
 
-    if (!group) {
-      handleList(_cards)
-    } else {
-      handleList(_cards, group)
-    }
+    handleList(_cards)
   }
 
   if (!is(fromJS(cards), fromJS(list))) {
@@ -69,22 +65,12 @@
 
     setCards(_cards)
 
-    if (!group) {
-      handleList(_cards, null, null, _card)
-    } else {
-      handleList(_cards, group, null, _card)
-    }
+    handleList(_cards, _card)
   }
 
   const [, drop] = useDrop({
     accept: 'form',
     drop(item) {
-      if (item.hasOwnProperty('originalIndex') && group) {
-        const { card } = findCard(item.id)
-        if (!card) {
-          handleList(cards, group, item.id)
-        }
-      }
       if (item.hasOwnProperty('originalIndex')) {
         return
       }
@@ -113,29 +99,16 @@
 
       setCards(_cards)
 
-      if (!group) {
-        handleList(_cards, null, null, newcard)
-      } else {
-        handleList(_cards, group, null, newcard)
-      }
+      handleList(_cards, newcard)
     }
   })
 
-  let _cols = 24 / (setting.cols || 2)
-  
   return (
-    <div ref={drop} className="ant-row modal-fields-row">
+    <div ref={drop} className={'ant-row modal-fields-row ' + (setting.align || 'left_right')} >
       {cards.map(card => {
-        let isEntireLine = false
-
-        if (card.entireLine === 'true' || ['textarea', 'hint', 'checkcard', 'brafteditor'].includes(card.type)) {
-          isEntireLine = true
-        }
-        
-        return <Col key={card.uuid} className={isEntireLine ? 'textarea' + setting.cols : ''} span={isEntireLine ? 24 : _cols}>
+        return <Col key={card.uuid} span={card.span || 24}>
           <Card
             id={card.uuid}
-            cols={setting.cols}
             card={card}
             showField={showField}
             moveCard={moveCard}

--
Gitblit v1.8.0