0.2.6 • Published 4 years ago

kanban-board-dl v0.2.6

Weekly downloads
45
License
-
Repository
-
Last release
4 years ago

This is a VUE Kanban board component that you can use in your projects.

Use

in your .vue file import the component

<scrip>
import { KanBoard, KanColumn } from 'kanban-board-dl';

export default {
    name: 'my-app',
    components: {
        KanBoard,
        KanColumn,
    },
};
</script>

in the template section:

    <KanBoard
			class="board"
			task-page-name="kan-task-detail"
			:columns="columns"
			@update-columns="updateColumns"
		>
			<template v-slot:column="{ column, indexColumn }">
				<KanColumn
					class="column"
					column-title="name"
					:column="column"
					:columns="columns"
					:index-column="indexColumn"
					:default-task="{}"
					@new-task="updateTasks"
					@update-tasks="updateTasks"
					@update-column-name="updateColumnName"
					@show-task="showTask"
				>
					<template v-slot:task="{ task }">
                        <button
                            type="button"
							class="task hover:shadow-lg hover:scale-105"
							@click="showTask(task)"
						>
							{{task.name}}
						</button>
					</template>
				</KanColumn>
			</template>
		</KanBoard>

in the style section (lang="scss")

.board {
	.board-container {
		@apply flex overflow-x-auto h-full;

		.column-item {
			height: max-content;
			min-width: 31rem;
			@apply bg-gray-300 p-6 mx-4 text-left rounded-lg text-3xl;
		}
	}

	.modal-task-container {
		background-color: #2d3748b3;
		@apply absolute top-0 left-0 w-screen h-screen z-10;
	}
}

.column {
	&.column-item-container {
		.add-task-input {
			font-family: Avenir, Helvetica, Arial, sans-serif;
			@apply w-full bg-transparent border-0 font-medium;
		}
	}
}

.task {
	transition: all 100ms ease-in-out;
	@apply bg-white p-4 rounded-lg my-4 text-xl transform scale-100;
}

.add-column-input {
	@apply  bg-blue-600 border-0 p-2 px-4 py-4 text-white rounded-lg mx-4;
}

.add-column-input::placeholder {
	@apply text-white;
}
.add-column-input:hover {
	filter: brightness(1.1);
}

KanBoard component

props:

itemproptypedescription
1columnsArrayArray of columns. Each column has tasks
2task-page-namestringYou need a new route or page in your app for showing task's details. The new route's name goes in this prop. With this, the component can show and hide de task's details.

events:

itemeventargsdescription
1update-columnscolumnsThe component emits this event with the columns updated. This event can occurs when one task is created or is dragged and droped into another column or when you drag and drop a column.

slots:

itemnamepropsdescription
1column{ columns, indexColumn }In this slot you have to put the KanColumn component

KanColum component

props:

itemproptypedescription
1columnsArrayArray of columns. Each column has tasks
2columnObjectEach column in columns
3index-columnnumberEach column's index
4default-taskObjectThis object is used when the you need to create a new task
5column-titlestringProp to use for column's title
6add-task-fieldbooleanThis prop is used to show or hide the add task field. Is true by default.

events:

itemeventargsdescription
1new-task{ tasks, indexColumn }The component emit this event when the user create a new task. The arguments are the tasks updated (width the new task included) and indexColumn for update the column.
2update-task{ tasks, indexColumn }idem
3update-column-namecolumn, indexColumnThe component emits this event when the user changes the column's name. The arguments are column (updated) and indexColumn for update columns
4show-tasktaskThe component emits this event when any task is clicked and is used for show task's details

slots:

itemnamepropsdescription
1task{ task }This slot is for each task.