| | |
| | | import ItemTypes from './itemtypes' |
| | | import './index.scss' |
| | | |
| | | const Container = ({list, setting, type, placeholder, handleList, handleMenu }) => { |
| | | const Container = ({list, setting, type, placeholder, handleList, handleMenu, copyElement }) => { |
| | | let target = null |
| | | const [cards, setCards] = useState(list) |
| | | const moveCard = (id, atIndex) => { |
| | |
| | | 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++ |
| | | } |
| | | // 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 = label |
| | | copycard.label = copycard.label + '(copy)' |
| | | |
| | | let indexes = cards.map(car => { return car.id }) |
| | | let newid = 0 |
| | |
| | | } |
| | | copycard.id = newid |
| | | |
| | | const { index: overIndex } = findCard(`${card.id}`) |
| | | // const { index: overIndex } = findCard(`${card.id}`) |
| | | |
| | | const _cards = update(cards, { $splice: [[overIndex + 1, 0, copycard]] }) |
| | | setCards(_cards) |
| | | handleList({action: _cards}) |
| | | // const _cards = update(cards, { $splice: [[overIndex + 1, 0, copycard]] }) |
| | | // setCards(_cards) |
| | | // handleList({action: _cards}) |
| | | |
| | | copyElement(copycard) |
| | | } |
| | | |
| | | const hasDrop = (item) => { |
| | |
| | | newcard.label = 'button' |
| | | newcard.innerFunc = '' |
| | | newcard.outerFunc = '' |
| | | newcard.sql = '' |
| | | newcard.Ot = 'requiredSgl' |
| | | newcard.OpenType = item.subType |
| | | newcard.icon = '' |
| | | newcard.class = 'default' |
| | | newcard.intertype = 'inner' |
| | | newcard.interface = '' |
| | | newcard.method = 'POST' |
| | | newcard.position = 'toolbar' |
| | | newcard.execSuccess = 'grid' |
| | | newcard.execError = 'never' |