diff --git a/README.md b/README.md
index 3bb61be8e..9f05feaad 100644
--- a/README.md
+++ b/README.md
@@ -78,6 +78,8 @@ This is the container component that encapsulates the lanes and cards
| handleDragEnd | function | Callback function triggered when card drag ends: `handleDragEnd(cardId, sourceLaneId, targetLaneId)` |
| onLaneScroll | function | Called when a lane is scrolled to the end: `onLaneScroll(requestedPage, laneId)` |
| onCardClick | function | Called when a card is clicked: `onCardClick(cardId, metadata, laneId) ` |
+| onCardAdd | function | Called when a new card is added: `onCardAdd(card, laneId) ` |
+| onCardDelete | function | Called when a card is deleted: `onCardDelete(cardId, laneId) ` |
| onLaneClick | function | Called when a lane is clicked: `onLaneClick(laneId) `. Card clicks are not propagated to lane click event |
| laneSortFunction | function | Used to specify the logic to sort cards on a lane: `laneSortFunction(card1, card2)` |
| eventBusHandle | function | This is a special function that providers a publishHook to pass new events to the board. See details in Publish Events section |
diff --git a/package.json b/package.json
index 995bbbad0..9c85d4a31 100644
--- a/package.json
+++ b/package.json
@@ -103,7 +103,8 @@
"redux": "^3.6.0",
"redux-actions": "^1.2.2",
"redux-logger": "^3.0.6",
- "styled-components": "^2.1.1"
+ "styled-components": "^2.1.1",
+ "uuid": "^3.1.0"
},
"peerDependencies": {
"react": ">= 0.14.0 < 17.0.0-0",
diff --git a/src/components/BoardContainer.js b/src/components/BoardContainer.js
index 82f48d08c..cc28041d4 100644
--- a/src/components/BoardContainer.js
+++ b/src/components/BoardContainer.js
@@ -60,6 +60,8 @@ class BoardContainer extends Component {
const passthroughProps = pick(this.props, [
'onLaneScroll',
'onCardClick',
+ 'onCardDelete',
+ 'onCardAdd',
'onLaneClick',
'laneSortFunction',
'draggable',
@@ -84,6 +86,8 @@ BoardContainer.propTypes = {
eventBusHandle: PropTypes.func,
onLaneScroll: PropTypes.func,
onCardClick: PropTypes.func,
+ onCardDelete: PropTypes.func,
+ onCardAdd: PropTypes.func,
onLaneClick: PropTypes.func,
laneSortFunction: PropTypes.func,
draggable: PropTypes.bool,
diff --git a/src/components/Card.js b/src/components/Card.js
index 019f3bd0f..2ed6be64d 100644
--- a/src/components/Card.js
+++ b/src/components/Card.js
@@ -1,51 +1,36 @@
-import React, {Component} from 'react';
-import PropTypes from 'prop-types';
-import {
- CardHeader, CardRightContent, CardTitle, Detail, Footer,
- MovableCardWrapper,
-} from '../styles/Base';
-import {DragType} from '../helpers/DragType';
-import {DragSource, DropTarget} from 'react-dnd';
-import {findDOMNode} from 'react-dom';
-import Tag from './Tag';
-import flow from 'lodash/flow';
-import DeleteButton from './widgets/DeleteButton';
+import React, {Component} from 'react'
+import PropTypes from 'prop-types'
+import {CardHeader, CardRightContent, CardTitle, Detail, Footer, MovableCardWrapper} from '../styles/Base'
+import {DragType} from '../helpers/DragType'
+import {DragSource, DropTarget} from 'react-dnd'
+import {findDOMNode} from 'react-dom'
+import Tag from './Tag'
+import flow from 'lodash/flow'
+import DeleteButton from './widgets/DeleteButton'
class Card extends Component {
-
- removeCard = () => {
- const {id, laneId} = this.props
- this.props.removeCard(laneId, id)
+ removeCard = e => {
+ const {id, laneId, removeCard, onDelete} = this.props
+ removeCard(laneId, id)
+ onDelete(id, laneId)
+ e.stopPropagation()
}
renderBody = () => {
if (this.props.customCardLayout) {
const {customCard, ...otherProps} = this.props
const customCardWithProps = React.cloneElement(customCard, {...otherProps})
- return (
-
- {customCardWithProps}
-
- )
+ return {customCardWithProps}
} else {
const {title, description, label, tags} = this.props
return (