2026-09-05 00:18:39 +03:30
|
|
|
<script setup lang="ts">
|
2026-09-10 01:22:24 +03:30
|
|
|
import { nextTick, ref } from 'vue';
|
|
|
|
|
import UiIcon from '@/components/UiIcon.vue';
|
2026-09-05 00:18:39 +03:30
|
|
|
import PipelineColumn from './PipelineColumn.vue';
|
2026-09-15 19:13:30 +03:30
|
|
|
import type { PipelineDeal, PipelineStage, PipelineUiCopy } from '@/lib/pipeline-board';
|
|
|
|
|
import { DEAL_BOARD_COPY } from '@/lib/pipeline-board';
|
2026-09-05 00:18:39 +03:30
|
|
|
|
2026-09-15 19:13:30 +03:30
|
|
|
withDefaults(
|
|
|
|
|
defineProps<{
|
|
|
|
|
stages: PipelineStage[];
|
|
|
|
|
draggingId: string | null;
|
|
|
|
|
dropStageId: string | null;
|
|
|
|
|
canManage?: boolean;
|
|
|
|
|
copy?: PipelineUiCopy;
|
|
|
|
|
}>(),
|
|
|
|
|
{ copy: () => DEAL_BOARD_COPY },
|
|
|
|
|
);
|
2026-09-05 00:18:39 +03:30
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
|
dragStart: [deal: PipelineDeal, event: DragEvent];
|
|
|
|
|
dragEnd: [];
|
|
|
|
|
dragOver: [stageId: string, event: DragEvent];
|
|
|
|
|
drop: [stageId: string, event: DragEvent, index?: number];
|
|
|
|
|
addDeal: [stageId: string];
|
|
|
|
|
openDeal: [dealId: string];
|
|
|
|
|
menuDeal: [dealId: string];
|
2026-09-10 01:22:24 +03:30
|
|
|
renameStage: [stageId: string, title: string];
|
|
|
|
|
deleteStage: [stageId: string];
|
|
|
|
|
moveStage: [stageId: string, dir: -1 | 1];
|
|
|
|
|
columnDragStart: [stageId: string, event: DragEvent];
|
|
|
|
|
columnDragEnd: [];
|
|
|
|
|
addStage: [name: string];
|
2026-09-05 00:18:39 +03:30
|
|
|
}>();
|
2026-09-10 01:22:24 +03:30
|
|
|
|
|
|
|
|
const adding = ref(false);
|
|
|
|
|
const newName = ref('');
|
|
|
|
|
const addInput = ref<HTMLInputElement | null>(null);
|
|
|
|
|
|
|
|
|
|
async function startAdd() {
|
|
|
|
|
adding.value = true;
|
|
|
|
|
newName.value = '';
|
|
|
|
|
await nextTick();
|
|
|
|
|
addInput.value?.focus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function cancelAdd() {
|
|
|
|
|
adding.value = false;
|
|
|
|
|
newName.value = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function submitAdd() {
|
|
|
|
|
const name = newName.value.trim();
|
|
|
|
|
if (!name) return;
|
|
|
|
|
emit('addStage', name);
|
|
|
|
|
adding.value = false;
|
|
|
|
|
newName.value = '';
|
|
|
|
|
}
|
2026-09-05 00:18:39 +03:30
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2026-09-10 01:22:24 +03:30
|
|
|
<div class="board-shell" dir="rtl">
|
|
|
|
|
<div class="board">
|
2026-09-05 00:18:39 +03:30
|
|
|
<PipelineColumn
|
2026-09-10 01:22:24 +03:30
|
|
|
v-for="(stage, index) in stages"
|
2026-09-05 00:18:39 +03:30
|
|
|
:key="stage.id"
|
|
|
|
|
:stage="stage"
|
|
|
|
|
:dragging-id="draggingId"
|
|
|
|
|
:drop-active="dropStageId === stage.id"
|
2026-09-10 01:22:24 +03:30
|
|
|
:can-manage="canManage"
|
2026-09-15 19:13:30 +03:30
|
|
|
:copy="copy"
|
2026-09-10 01:22:24 +03:30
|
|
|
:is-first="index === 0"
|
|
|
|
|
:is-last="index === stages.length - 1"
|
2026-09-05 00:18:39 +03:30
|
|
|
@drag-start="(d, e) => emit('dragStart', d, e)"
|
|
|
|
|
@drag-end="emit('dragEnd')"
|
|
|
|
|
@drag-over="(id, e) => emit('dragOver', id, e)"
|
|
|
|
|
@drop="(id, e, index) => emit('drop', id, e, index)"
|
|
|
|
|
@add-deal="emit('addDeal', $event)"
|
|
|
|
|
@open-deal="emit('openDeal', $event)"
|
|
|
|
|
@menu-deal="emit('menuDeal', $event)"
|
2026-09-10 01:22:24 +03:30
|
|
|
@rename="(id, title) => emit('renameStage', id, title)"
|
|
|
|
|
@delete="emit('deleteStage', $event)"
|
|
|
|
|
@move="(id, dir) => emit('moveStage', id, dir)"
|
|
|
|
|
@column-drag-start="(id, e) => emit('columnDragStart', id, e)"
|
|
|
|
|
@column-drag-end="emit('columnDragEnd')"
|
2026-09-05 00:18:39 +03:30
|
|
|
/>
|
2026-09-10 01:22:24 +03:30
|
|
|
|
|
|
|
|
<section v-if="canManage" class="add-col">
|
|
|
|
|
<form v-if="adding" class="add-form" @submit.prevent="submitAdd">
|
|
|
|
|
<input
|
|
|
|
|
ref="addInput"
|
|
|
|
|
v-model="newName"
|
|
|
|
|
maxlength="80"
|
|
|
|
|
placeholder="نام ستون جدید…"
|
|
|
|
|
aria-label="نام ستون جدید"
|
|
|
|
|
@keydown.esc.prevent="cancelAdd"
|
|
|
|
|
/>
|
|
|
|
|
<div class="add-actions">
|
|
|
|
|
<button class="ok" type="submit" :disabled="newName.trim().length < 1">
|
|
|
|
|
افزودن
|
|
|
|
|
</button>
|
|
|
|
|
<button class="cancel" type="button" @click="cancelAdd">انصراف</button>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
<button v-else type="button" class="add-btn" @click="startAdd">
|
|
|
|
|
<UiIcon name="plus" :size="18" />
|
|
|
|
|
افزودن ستون
|
|
|
|
|
</button>
|
|
|
|
|
</section>
|
|
|
|
|
</div>
|
2026-09-05 00:18:39 +03:30
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2026-09-10 01:22:24 +03:30
|
|
|
.board-shell {
|
|
|
|
|
background: #fff;
|
|
|
|
|
border: 1px solid var(--line);
|
|
|
|
|
border-radius: var(--radius);
|
|
|
|
|
padding: var(--pad-modal);
|
|
|
|
|
min-width: 0;
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-05 00:18:39 +03:30
|
|
|
.board {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: row;
|
|
|
|
|
gap: 16px;
|
|
|
|
|
width: 100%;
|
|
|
|
|
min-width: 0;
|
2026-09-09 13:12:13 +03:30
|
|
|
max-width: 100%;
|
2026-09-05 00:18:39 +03:30
|
|
|
align-items: stretch;
|
2026-09-09 13:12:13 +03:30
|
|
|
overflow-x: auto;
|
|
|
|
|
overflow-y: hidden;
|
|
|
|
|
padding: 0.1rem 0.05rem 0.5rem;
|
|
|
|
|
touch-action: pan-x pan-y;
|
|
|
|
|
overscroll-behavior-x: contain;
|
|
|
|
|
-webkit-overflow-scrolling: touch;
|
|
|
|
|
scrollbar-width: thin;
|
|
|
|
|
scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent;
|
2026-09-05 00:18:39 +03:30
|
|
|
}
|
|
|
|
|
|
2026-09-09 13:12:13 +03:30
|
|
|
.board::-webkit-scrollbar {
|
|
|
|
|
height: 8px;
|
|
|
|
|
}
|
2026-09-05 00:18:39 +03:30
|
|
|
|
2026-09-09 13:12:13 +03:30
|
|
|
.board::-webkit-scrollbar-thumb {
|
|
|
|
|
background: color-mix(in srgb, var(--muted) 38%, transparent);
|
|
|
|
|
border-radius: 999px;
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-10 01:22:24 +03:30
|
|
|
.add-col {
|
|
|
|
|
flex: 0 0 17.5rem;
|
|
|
|
|
min-width: 17.5rem;
|
|
|
|
|
min-height: 420px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: flex-start;
|
|
|
|
|
padding-top: 0.15rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.add-btn {
|
|
|
|
|
width: 100%;
|
|
|
|
|
min-height: 3.2rem;
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
gap: 0.4rem;
|
|
|
|
|
border: 1.5px dashed var(--line);
|
|
|
|
|
border-radius: var(--radius);
|
|
|
|
|
background: #f8fafc;
|
|
|
|
|
color: var(--muted);
|
|
|
|
|
font: inherit;
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.add-btn:hover {
|
|
|
|
|
border-color: var(--accent);
|
|
|
|
|
color: var(--accent-deep, #0f766e);
|
|
|
|
|
background: color-mix(in srgb, var(--accent) 6%, #fff);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.add-form {
|
|
|
|
|
width: 100%;
|
|
|
|
|
display: grid;
|
|
|
|
|
gap: 0.55rem;
|
|
|
|
|
padding: 0.75rem;
|
|
|
|
|
border: 1px solid var(--line);
|
|
|
|
|
border-radius: var(--radius);
|
|
|
|
|
background: #fff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.add-form input {
|
|
|
|
|
width: 100%;
|
|
|
|
|
min-height: var(--control-h);
|
|
|
|
|
padding: 0 0.75rem;
|
|
|
|
|
border: 1px solid var(--line);
|
|
|
|
|
border-radius: var(--radius);
|
|
|
|
|
font: inherit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.add-actions {
|
|
|
|
|
display: flex;
|
|
|
|
|
gap: 0.4rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.add-actions .ok,
|
|
|
|
|
.add-actions .cancel {
|
|
|
|
|
min-height: var(--control-h);
|
|
|
|
|
padding: 0 0.85rem;
|
|
|
|
|
border-radius: var(--radius);
|
|
|
|
|
font: inherit;
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.add-actions .ok {
|
|
|
|
|
border: 0;
|
|
|
|
|
background: var(--accent);
|
|
|
|
|
color: #fff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.add-actions .ok:disabled {
|
|
|
|
|
opacity: 0.5;
|
|
|
|
|
cursor: default;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.add-actions .cancel {
|
|
|
|
|
border: 1px solid var(--line);
|
|
|
|
|
background: #fff;
|
|
|
|
|
color: var(--ink);
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-09 13:12:13 +03:30
|
|
|
@container pipeline (max-width: 720px) {
|
|
|
|
|
.board {
|
|
|
|
|
scroll-snap-type: x mandatory;
|
|
|
|
|
scroll-padding-inline: 0.25rem;
|
2026-09-05 00:18:39 +03:30
|
|
|
}
|
2026-09-10 01:22:24 +03:30
|
|
|
|
|
|
|
|
.add-col {
|
|
|
|
|
flex: 0 0 min(20rem, 86cqi);
|
|
|
|
|
width: min(20rem, 86cqi);
|
|
|
|
|
min-width: min(20rem, 86cqi);
|
|
|
|
|
min-height: 360px;
|
|
|
|
|
scroll-snap-align: start;
|
|
|
|
|
}
|
2026-09-05 00:18:39 +03:30
|
|
|
}
|
|
|
|
|
</style>
|