| | |
| | | const { card, index } = findCard(id) |
| | | const _cards = update(cards, { $splice: [[index, 1], [atIndex, 0, card]] }) |
| | | setCards(_cards) |
| | | handleList({[type]: _cards}) |
| | | handleList(type, _cards) |
| | | // handleList({[type]: _cards}) |
| | | } |
| | | |
| | | const findCard = id => { |
| | |
| | | let copycard = JSON.parse(JSON.stringify(card)) |
| | | copycard.uuid = Utils.getuuid() |
| | | copycard.origin = false |
| | | // let names = cards.map(car => { return car.label }) |
| | | // let index = 1 |
| | | // let origin = copycard.label.split('(copy')[0] || 'button' |
| | | // let label = origin + '(copy)' |
| | | // while (names.includes(label)) { |
| | | // label = origin + `(copy${index})` |
| | | // index++ |
| | | // } |
| | | |
| | | copycard.label = copycard.label + '(copy)' |
| | | |
| | | let indexes = cards.map(car => { return car.id }) |
| | |
| | | newid++ |
| | | } |
| | | copycard.id = newid |
| | | |
| | | // const { index: overIndex } = findCard(`${card.id}`) |
| | | |
| | | // const _cards = update(cards, { $splice: [[overIndex + 1, 0, copycard]] }) |
| | | // setCards(_cards) |
| | | // handleList({action: _cards}) |
| | | |
| | | copyElement(copycard) |
| | | } |
| | |
| | | newcard.innerFunc = '' |
| | | newcard.outerFunc = '' |
| | | newcard.sql = '' |
| | | newcard.sqlType = '' |
| | | newcard.Ot = 'requiredSgl' |
| | | newcard.OpenType = item.subType |
| | | newcard.icon = '' |
| | |
| | | |
| | | const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] }) |
| | | setCards(_cards) |
| | | handleList({[type]: _cards}) |
| | | handleList(type, _cards, newcard) |
| | | target = null |
| | | } |
| | | }) |