implement drag&drop for kanban

This commit is contained in:
marlon-erler
2024-07-25 16:20:43 +02:00
parent 0ed71600c6
commit 01ef0ac09c
8 changed files with 228 additions and 143 deletions
+6 -1
View File
@@ -6,6 +6,7 @@ import { PropertyValueList } from "../Components/propertyList";
import { TaskCategoryBulkChangeViewModel } from "../../ViewModel/Utility/taskPropertyBulkChangeViewModel";
import TaskViewModel from "../../ViewModel/Pages/taskViewModel";
import { TaskViewModelToEntry } from "../Components/taskEntry";
import { allowDrop } from "../utility";
import { translations } from "../translations";
export function BoardKanbanPage(boardViewModel: BoardViewModel) {
@@ -39,8 +40,12 @@ function KanbanBoard(categoryName: string, boardViewModel: BoardViewModel) {
const viewModel: TaskCategoryBulkChangeViewModel =
new TaskCategoryBulkChangeViewModel(taskViewModels, categoryName);
function drop() {
boardViewModel.handleDrop(categoryName);
}
return (
<div class="flex-column flex-no">
<div class="flex-column flex-no" on:dragover={allowDrop} on:drop={drop}>
<div class="flex-row width-input">
<input
placeholder={
+1 -1
View File
@@ -5,8 +5,8 @@ import ChatViewModel from "../../ViewModel/Chat/chatViewModel";
export function ChatEntry(chatViewModel: ChatViewModel) {
const view = (
<button
set:color={chatViewModel.settingsPageViewModel.color}
class="tile colored-tile"
set:color={chatViewModel.settingsPageViewModel.color}
style="height: 8rem"
on:click={chatViewModel.open}
>
+2
View File
@@ -14,8 +14,10 @@ export function TaskEntry(taskViewModel: TaskViewModel) {
const view = (
<button
draggable="true"
class="tile flex-no"
on:click={taskViewModel.open}
on:dragstart={taskViewModel.dragStart}
>
<div>
<b subscribe:innerText={taskViewModel.name}></b>
+3
View File
@@ -0,0 +1,3 @@
export function allowDrop(event: DragEvent) {
event.preventDefault();
}