UNPKG

jordium-gantt-vue3

Version:

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

47 lines (46 loc) 1.49 kB
import { TimelineMonth, TimelineYear, TimelineDay } from '../models/types/TimelineDataTypes'; type TimelineData = TimelineMonth | TimelineYear | TimelineDay; export declare class PositionCache { private cache; private timelineDataHash; /** * 构建缓存key */ private getCacheKey; /** * 计算timelineData的hash值 * 包含时间刻度、日期范围、数据长度以及当前视图的cellWidth, * 确保修改 SCALE_CONFIGS 后(例如热更新)能正确重建缓存。 */ private computeHash; /** * 预计算所有日期的位置映射表 * 在Timeline层调用,所有TaskBar共享缓存 * * @param timelineData 时间轴数据数组 * @param timeScale 当前时间刻度 * @param cellWidths 各刻度实际 cellWidth(effectiveScaleConfigs),覆盖内置默认值 */ buildCache(timelineData: TimelineData[], timeScale: string, cellWidths?: Partial<Record<string, number>>): void; /** * O(1)查找日期对应的位置 * * @param date 目标日期 * @param timeScale 当前时间刻度 * @returns 位置(px),如果未找到返回null */ getPosition(date: Date, timeScale: string): number | null; /** * 清空缓存 */ clear(): void; /** * 获取缓存统计信息 */ getStats(): { size: number; hash: string; }; } export declare const positionCache: PositionCache; export {};