UNPKG

jordium-gantt-vue3

Version:

A Vue 3 Gantt chart component for project management, task scheduling, resource planning, calendar, resource usage and timeline visualization.

31 lines (30 loc) 1.61 kB
import { PositionCache } from './positionCache'; import { TimelineScale } from '../models/types/TimelineScale'; export interface LogicalBarPosition { left: number; top: number; width: number; height: number; } /** * 解析日期字符串 / Date 为本地 Date 对象。 * 与 TaskBar.vue 中的 createLocalDate() 逻辑完全一致,确保坐标一致性。 */ export declare function parseTaskDate(dateString: string | Date | undefined | null): Date | null; /** * 计算任务视图中单个任务条的逻辑坐标。 * 与 TaskBar.vue 的 taskBarStyle computed 算法保持一致,确保像素值吻合。 * * @param task 任务对象(只需 startDate / endDate) * @param cumulativeTop 任务行在时间线中的累计顶部位置(px),替代 rowIndex * rowHeight * @param timeScale 当前时间刻度 * @param cache positionCache 实例(Timeline.vue provide) * @param dayWidth 当前刻度下每天的像素宽度(用于 cache miss 时的估算) * @param baseStartDate 时间线基准开始日期(HOUR 视图必须传入,其他视图可省略) * @param rowHeight 路行高度(px),默认51 * @returns 逻辑坐标,若无法计算(日期缺失或范围外)则返回 null */ export declare function computeTaskViewLogicalPosition(task: { startDate?: string | Date | null; endDate?: string | Date | null; }, cumulativeTop: number, timeScale: TimelineScale, cache: PositionCache | null, dayWidth: number, baseStartDate?: Date | null, rowHeight?: number): LogicalBarPosition | null;