From 53b9fb93d0376eb02bb996935f1720b4e95cd897 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 12 十月 2022 14:41:06 +0800 Subject: [PATCH] 2022-10-12 --- src/menu/components/share/searchcomponent/dragsearch/card.jsx | 33 ++++++++++++++++++++++----------- 1 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/menu/components/share/searchcomponent/dragsearch/card.jsx b/src/menu/components/share/searchcomponent/dragsearch/card.jsx index 650c5b6..2b6bbe1 100644 --- a/src/menu/components/share/searchcomponent/dragsearch/card.jsx +++ b/src/menu/components/share/searchcomponent/dragsearch/card.jsx @@ -21,17 +21,23 @@ const [, drop] = useDrop({ accept: 'search', canDrop: () => true, - drop: ({ id: draggedId }) => { - if (!draggedId || draggedId === id) return - - const { index: originIndex } = findCard(draggedId) - if (originIndex === -1) return - - const { index: overIndex } = findCard(id) - moveCard(draggedId, overIndex) + drop: (item) => { + const { id: draggedId, originalIndex } = item + + if (originalIndex === undefined) { + item.dropTargetId = id + } else { + if (!draggedId || draggedId === id) return + + const { index: originIndex } = findCard(draggedId) + if (originIndex === -1) return + + const { index: overIndex } = findCard(id) + moveCard(draggedId, overIndex) + } } }) - const opacity = isDragging ? 0 : 1 + const opacity = isDragging ? 0.5 : 1 let _defaultValue = '' // 涓嬫媺鎼滅储銆佹椂闂磋寖鍥寸被鍨嬶紝鍒濆鍊奸渶瑕侀澶勭悊 @@ -103,6 +109,11 @@ formItem = <DateGroup card={card} /> } + let labelwidth = card.labelwidth || 33.3 + if (card.labelShow === 'false') { + labelwidth = 0 + } + return ( <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> @@ -114,8 +125,8 @@ <div className={'page-card ' + (card.labelShow || '')} style={{ opacity: opacity}}> <div ref={node => drag(drop(node))}> <Form.Item - labelCol={{xs: { span: 24 }, sm: { span: 8 }}} - wrapperCol = {{xs: { span: 24 }, sm: { span: 16 }}} + labelCol={{style: {width: labelwidth + '%'}}} + wrapperCol={{style: {width: (100 - labelwidth) + '%'}}} label={card.labelShow !== 'false' ? card.label : ''} required={card.required === 'true'} > -- Gitblit v1.8.0