diff --git a/samples/react-kanban-board/src/kanban/KanbanBucket.tsx b/samples/react-kanban-board/src/kanban/KanbanBucket.tsx index b4669485e..a3112077d 100644 --- a/samples/react-kanban-board/src/kanban/KanbanBucket.tsx +++ b/samples/react-kanban-board/src/kanban/KanbanBucket.tsx @@ -52,10 +52,10 @@ export default class KanbanBucket extends React.Component this.props.onDragOver(event, bucket)} onDragLeave={(event) => this.props.onDragLeave(event, bucket)} - onDrop={(event) => this.props.onDragLeave(event, bucket)} + onDrop={(event) => this.props.onDrop(event, bucket)} >
{bucketheadline} diff --git a/samples/react-kanban-board/src/kanban/KanbanComponent.tsx b/samples/react-kanban-board/src/kanban/KanbanComponent.tsx index 0cbe570cc..ee1d23043 100644 --- a/samples/react-kanban-board/src/kanban/KanbanComponent.tsx +++ b/samples/react-kanban-board/src/kanban/KanbanComponent.tsx @@ -125,9 +125,23 @@ export default class KanbanComponent extends React.Components.bucket == sourcebucket)[0]; + const target = this.props.buckets.filter(s=>s.bucket == targetbucket)[0]; + const taskId = event.dataTransfer.getData("taskId"); + if(this.props.taskactions) { + let allowMove= true; + if(this.props.taskactions.allowMove) { + allowMove= this.props.taskactions.allowMove(taskId, + source, + target + ); + } + if(allowMove && this.props.taskactions.moved) { + this.props.taskactions.moved(taskId,target); + } + } } - this.dragelement = null; this.setState({ leavingTaskId: null, diff --git a/samples/react-kanban-board/src/kanban/MockKanban.tsx b/samples/react-kanban-board/src/kanban/MockKanban.tsx index 6911e8d3d..d00bb3512 100644 --- a/samples/react-kanban-board/src/kanban/MockKanban.tsx +++ b/samples/react-kanban-board/src/kanban/MockKanban.tsx @@ -2,6 +2,7 @@ import * as React from 'react'; import KanbanComponent from './KanbanComponent'; import { IKanbanBucket } from './IKanbanBucket'; import { IKanbanTask } from './IKanbanTask'; +import { findIndex } from "lodash"; export interface IMockKanbanProps { } @@ -58,16 +59,24 @@ export class MockKanban extends React.Component element.taskId == taskId ); + let newArray = [...this.state.tasks]; + newArray[elementsIndex].bucket = targetBucket.bucket; + this.setState({tasks:newArray}); } }