| | |
| | | import Action from './action' |
| | | import './index.scss' |
| | | |
| | | const Container = ({list, handleList, handleMenu, deleteMenu, profileAction, handleStyle, handleSubConfig }) => { |
| | | const Container = ({list, parent, fields, handleList, handleMenu, deleteMenu, profileAction, handleStyle, updateMarks, dropButton, handleSubConfig }) => { |
| | | const [cards, setCards] = useState(list) |
| | | const moveCard = (id, atIndex) => { |
| | | const { card, index } = findCard(id) |
| | |
| | | } |
| | | |
| | | const copyCard = id => { |
| | | const { card, index: overIndex } = findCard(id) |
| | | const { card } = findCard(id) |
| | | let copycard = fromJS(card).toJS() |
| | | let _cards = fromJS(cards).toJS() |
| | | |
| | | copycard.uuid = Utils.getuuid() |
| | | copycard.copyType = 'customCardElement' |
| | | if (card.eleType === 'button') { |
| | | copycard.copyType = 'action' |
| | | } else { |
| | | copycard.copyType = 'customCardElement' |
| | | } |
| | | copycard.focus = true |
| | | |
| | | let _val = '' |
| | | let _val = fromJS(copycard).toJS() |
| | | |
| | | copycard.uuid = Utils.getuuid() |
| | | copycard.originCard = card |
| | | |
| | | try { |
| | | _val = window.btoa(window.encodeURIComponent(JSON.stringify(copycard))) |
| | | } catch { |
| | | _val = window.btoa(window.encodeURIComponent(JSON.stringify(_val))) |
| | | } catch (e) { |
| | | console.warn('Stringify Failure') |
| | | _val = '' |
| | | } |
| | |
| | | document.body.removeChild(oInput) |
| | | } |
| | | |
| | | const _cards = update(cards, { $splice: [[overIndex + 1, 0, copycard]] }) |
| | | _cards.push(copycard) |
| | | |
| | | handleList(_cards) |
| | | handleMenu(copycard) |
| | |
| | | |
| | | const doubleClickCard = id => { |
| | | const { card } = findCard(id) |
| | | if (card.OpenType === 'pop') { |
| | | handleSubConfig(card) |
| | | |
| | | if (card.eleType !== 'button') { |
| | | return |
| | | } |
| | | |
| | | handleSubConfig(card) |
| | | } |
| | | |
| | | const delCard = id => { |
| | |
| | | deleteMenu(card) |
| | | } |
| | | |
| | | let cardIds = cards.map(card => card.uuid) |
| | | |
| | | const [, drop] = useDrop({ |
| | | accept: 'action', |
| | | drop() {} |
| | | drop(item) { |
| | | const { index } = findCard(item.id) |
| | | if (index > -1) return |
| | | dropButton(item.id) |
| | | } |
| | | }) |
| | | |
| | | return ( |
| | |
| | | <Action |
| | | id={card.uuid} |
| | | key={card.uuid} |
| | | cardIds={cardIds} |
| | | card={card} |
| | | parent={parent} |
| | | copyCard={copyCard} |
| | | moveCard={moveCard} |
| | | editCard={editCard} |
| | | changeStyle={changeStyle} |
| | |
| | | <Card |
| | | id={card.uuid} |
| | | key={card.uuid} |
| | | cardIds={cardIds} |
| | | card={card} |
| | | parent={parent} |
| | | fields={fields} |
| | | moveCard={moveCard} |
| | | copyCard={copyCard} |
| | | editCard={editCard} |
| | | updateMarks={updateMarks} |
| | | changeStyle={changeStyle} |
| | | delCard={delCard} |
| | | findCard={findCard} |