jordium-gantt-vue3
Version:
A Vue 3 Gantt chart component for project management, task scheduling, resource planning, calendar, resource usage and timeline visualization.
35 lines (34 loc) • 1.52 kB
TypeScript
import { Ref } from 'vue';
import { CalendarSelectionDraft, CalendarSelectionRange, CalendarSelectionCancelReason } from '../models/types/CalendarTypes';
export interface UseCalendarSelectionOptions {
/** 禁用后不响应任何拖拽事件(对应 disabled prop / 禁用态) */
disabled?: Ref<boolean>;
/**
* 将鼠标事件解析为选区草稿,由调用方(具体子视图)实现像素->日期的换算,
* 返回 null 表示当前事件不应产生选区(如落在非法区域)
*/
resolveDraft: (event: MouseEvent) => CalendarSelectionDraft | null;
onBeforeSelect?: (draft: CalendarSelectionDraft) => boolean | Promise<boolean>;
onSelectionComplete?: (range: CalendarSelectionRange) => void;
onSelectionCancel?: (reason: CalendarSelectionCancelReason) => void;
}
export declare function useCalendarSelection(options: UseCalendarSelectionOptions): {
isDragging: Ref<boolean, boolean>;
isPending: Ref<boolean, boolean>;
isRejected: Ref<boolean, boolean>;
isConfirmed: Ref<boolean, boolean>;
draft: Ref<{
startDate: Date;
endDate: Date;
resourceId?: string | number | undefined;
scale: import('..').CalendarScale;
} | null, CalendarSelectionDraft | {
startDate: Date;
endDate: Date;
resourceId?: string | number | undefined;
scale: import('..').CalendarScale;
} | null>;
handleMouseDown: (event: MouseEvent) => void;
cancel: () => void;
clear: () => void;
};