| | |
| | | import './index.scss' |
| | | |
| | | const Container = ({list, setting, gridBtn, showfield, placeholder, handleList, handleMenu, handleGridBtn, deleteMenu, markMenu }) => { |
| | | let target = null |
| | | |
| | | const [cards, setCards] = useState(list) |
| | | const moveCard = (id, atIndex) => { |
| | | const { card, index } = findCard(id) |
| | |
| | | |
| | | const editCard = id => { |
| | | const { card } = findCard(id) |
| | | |
| | | delete card.focus // 兼容早期的合并列 |
| | | |
| | | handleMenu(card) |
| | |
| | | const markCard = id => { |
| | | const { card } = findCard(id) |
| | | markMenu(card) |
| | | } |
| | | |
| | | const hasDrop = (item) => { |
| | | target = item |
| | | } |
| | | |
| | | const [, drop] = useDrop({ |
| | |
| | | newcard.order = 'vertical' |
| | | } |
| | | |
| | | let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0 |
| | | if (target) { |
| | | targetId = target.uuid |
| | | let targetId = '' |
| | | |
| | | if (item.dropTargetId) { |
| | | targetId = item.dropTargetId |
| | | delete item.dropTargetId |
| | | } else if (cards.length > 0) { |
| | | targetId = cards[cards.length - 1].uuid |
| | | } |
| | | |
| | | const { index: overIndex } = findCard(`${targetId}`) |
| | | let targetIndex = overIndex |
| | | |
| | | targetIndex++ |
| | | |
| | | const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] }) |
| | | const _cards = update(cards, { $splice: [[overIndex + 1, 0, newcard]] }) |
| | | |
| | | handleList(_cards, newcard) |
| | | target = null |
| | | } |
| | | }) |
| | | |
| | |
| | | delCard={delCard} |
| | | markCard={markCard} |
| | | findCard={findCard} |
| | | hasDrop={hasDrop} |
| | | /> |
| | | ))} |
| | | {i === (columns.length - 1) && gridBtn && gridBtn.display ? |