UNPKG

vue-gantt-3

Version:

A gantt component for Vue 3

454 lines (453 loc) 25.2 kB
import { RowData, ColDef, DefaultColDef, GanttRowNode, GanttStyleOption, TimeScale, GanttHeaderUnit } from './types'; import { default as dayjs } from 'dayjs'; export interface GanttOption { getRowId: (rowData: RowData) => string; columns?: ColDef[]; rows?: RowData[]; getEmptyRows?: (count: number) => RowData[]; headerTextRender?: (date: dayjs.Dayjs, unit: GanttHeaderUnit) => string | number; headerTipRender?: (date: dayjs.Dayjs, unit: GanttHeaderUnit) => string; defaultCol?: DefaultColDef; rowHeight?: number; headerHeight?: number; rowBuffer?: number; rowSelection?: 'single' | 'multiple' | 'none'; defaultTableViewWidth?: number; maxTableViewWidth?: number; styleOption?: GanttStyleOption; timePointComp?: any; defaultPerHourSpacing?: number; defaultTimeScale?: TimeScale; locale?: string; defaultShowFirstLevel?: boolean; timeLineRender?: any; timeLineRenderParams?: Record<string, any>; } declare const _default: import('vue').DefineComponent<GanttOption, { getRowNode: (id: string) => GanttRowNode<RowData> | undefined; getRowNodeChildren: (parentId?: string) => GanttRowNode<RowData>[]; getRowDataList: () => RowData[]; freshRowNodes: (rows: RowData[]) => void; refreshCells: (ids: string[], force?: boolean) => void; getDisplayRows: () => RowData[] | null; expandAll: () => void; freshTimeLines: (rowIds: string[]) => void; selectRows: (ids: string[]) => void; }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, { [x: string]: any; } & { [x: string]: any; }, string, import('vue').PublicProps, Readonly<GanttOption> & Readonly<{ [x: `on${Capitalize<any>}`]: ((...args: any) => any) | undefined; }>, { columns: ColDef[]; rows: RowData[]; rowHeight: number; headerHeight: number; rowBuffer: number; rowSelection: "single" | "multiple" | "none"; defaultTableViewWidth: number; maxTableViewWidth: number; defaultShowFirstLevel: boolean; }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, { vGanttRef: HTMLDivElement; tableViewRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('./components/tableView/TableView.vue').Props> & Readonly<{ onViewPortChanged?: ((data: RowData[]) => any) | undefined; onSelectionChanged?: ((data: import('ag-grid-community').SelectionChangedEvent<RowData, any>) => any) | undefined; onCellContextMenu?: ((data: import('ag-grid-community').CellContextMenuEvent<RowData, any>) => any) | undefined; onTriggerGanttViewScroll?: ((options: ScrollToOptions) => any) | undefined; onCellDoubleClicked?: ((rowData: RowData | undefined, columnData?: ColDef | undefined) => any) | undefined; }>, { scrollTo: (options: ScrollToOptions, onWheel?: boolean) => void; refreshCells: (rowIds: string[], force?: boolean) => void; onFilterChanged: () => void; handleEmptyRowChanged: (target?: HTMLDivElement) => boolean; getFirstDisplayedRow: () => number | undefined; getLastDisplayedRow: () => number | undefined; }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & { viewPortChanged: (data: RowData[]) => any; selectionChanged: (data: import('ag-grid-community').SelectionChangedEvent<RowData, any>) => any; cellContextMenu: (data: import('ag-grid-community').CellContextMenuEvent<RowData, any>) => any; triggerGanttViewScroll: (options: ScrollToOptions) => any; cellDoubleClicked: (rowData: RowData | undefined, columnData?: ColDef | undefined) => any; }, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, { tableViewRef: HTMLDivElement; }, HTMLDivElement, import('vue').ComponentProvideOptions, { P: {}; B: {}; D: {}; C: {}; M: {}; Defaults: {}; }, Readonly<import('./components/tableView/TableView.vue').Props> & Readonly<{ onViewPortChanged?: ((data: RowData[]) => any) | undefined; onSelectionChanged?: ((data: import('ag-grid-community').SelectionChangedEvent<RowData, any>) => any) | undefined; onCellContextMenu?: ((data: import('ag-grid-community').CellContextMenuEvent<RowData, any>) => any) | undefined; onTriggerGanttViewScroll?: ((options: ScrollToOptions) => any) | undefined; onCellDoubleClicked?: ((rowData: RowData | undefined, columnData?: ColDef | undefined) => any) | undefined; }>, { scrollTo: (options: ScrollToOptions, onWheel?: boolean) => void; refreshCells: (rowIds: string[], force?: boolean) => void; onFilterChanged: () => void; handleEmptyRowChanged: (target?: HTMLDivElement) => boolean; getFirstDisplayedRow: () => number | undefined; getLastDisplayedRow: () => number | undefined; }, {}, {}, {}, {}> | null; ganttViewRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('./components/ganttView/GanttView.vue').Props> & Readonly<{ onPerHourSpacingChange?: ((perHourSpacing: number) => any) | undefined; onGanttBodyResize?: ((target: HTMLDivElement) => any) | undefined; onTriggerTableViewScroll?: ((options: ScrollToOptions, onWheel?: boolean | undefined) => any) | undefined; }>, { scrollTo: (options: ScrollToOptions) => void; updateMinAndMaxDateByChangeRowNode: ({ addedRowNodes, deletedRowNodes, updatedRowNodes }: { addedRowNodes?: GanttRowNode[]; deletedRowNodes?: GanttRowNode[]; updatedRowNodes?: GanttRowNode[]; }, freshRowNodes: GanttRowNode[]) => void; freshTimeLines: (rowNodes: GanttRowNode[]) => void; }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & { perHourSpacingChange: (perHourSpacing: number) => any; ganttBodyResize: (target: HTMLDivElement) => any; triggerTableViewScroll: (options: ScrollToOptions, onWheel?: boolean | undefined) => any; }, import('vue').PublicProps, { defaultPerHourSpacing: number; }, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, { ganttGanttView: HTMLDivElement; ganttHeaderRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('./components/ganttView/ganttHeader/GanttHeader.vue').Props> & Readonly<{}>, { onScroll: ({ scrollLeft }: { scrollLeft: number; }) => void; updateGanttHeaderWidth: (show: boolean, scrollbarWidth: number) => void; onResize: () => void; }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, { ganttHeaderRef: HTMLDivElement; }, HTMLDivElement, import('vue').ComponentProvideOptions, { P: {}; B: {}; D: {}; C: {}; M: {}; Defaults: {}; }, Readonly<import('./components/ganttView/ganttHeader/GanttHeader.vue').Props> & Readonly<{}>, { onScroll: ({ scrollLeft }: { scrollLeft: number; }) => void; updateGanttHeaderWidth: (show: boolean, scrollbarWidth: number) => void; onResize: () => void; }, {}, {}, {}, {}> | null; scrollBarRef: ({ $: import('vue').ComponentInternalInstance; $data: {}; $props: { readonly tag?: string | undefined; readonly viewClass?: string | undefined; readonly wrapClass?: string | undefined; readonly viewStyle?: import('vue').StyleValue; readonly wrapStyle?: import('vue').StyleValue; readonly interceptShiftScroll?: boolean | undefined; readonly alwayHorizontal?: boolean | undefined; readonly alwayVertical?: boolean | undefined; readonly onResize?: ((target: HTMLDivElement) => any) | undefined; readonly onScroll?: ((args_0: { scrollTop: number; scrollLeft: number; }) => any) | undefined; readonly onWheel?: ((e: WheelEvent) => any) | undefined; readonly onWrapResize?: ((target: HTMLDivElement) => any) | undefined; readonly onShiftScroll?: ((e: WheelEvent) => any) | undefined; readonly onVerticalScrollBarShow?: ((args_0: { show: boolean; scrollbarWidth: number; }) => any) | undefined; } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps; $attrs: { [x: string]: unknown; }; $refs: { [x: string]: unknown; } & { wrapRef: HTMLDivElement; resizeRef: unknown; barRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('./components/scrollbar/Bar.vue').Props> & Readonly<{ onTriggerScrollFromThumb?: ((options: ScrollToOptions) => any) | undefined; }>, { handleScroll: (wrap: HTMLDivElement) => void; }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & { triggerScrollFromThumb: (options: ScrollToOptions) => any; }, import('vue').PublicProps, { scrollbarHeight: number; scrollbarWidth: number; }, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, { horizontalThumbRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('./components/scrollbar/Thumb.vue').Props> & Readonly<{ onTriggerScrollFromThumb?: ((options: ScrollToOptions) => any) | undefined; }>, { handleScroll: (option: { left: number; top: number; }) => void; }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & { triggerScrollFromThumb: (options: ScrollToOptions) => any; }, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, { thumbRef: HTMLDivElement; }, HTMLDivElement, import('vue').ComponentProvideOptions, { P: {}; B: {}; D: {}; C: {}; M: {}; Defaults: {}; }, Readonly<import('./components/scrollbar/Thumb.vue').Props> & Readonly<{ onTriggerScrollFromThumb?: ((options: ScrollToOptions) => any) | undefined; }>, { handleScroll: (option: { left: number; top: number; }) => void; }, {}, {}, {}, {}> | null; verticalThumbRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('./components/scrollbar/Thumb.vue').Props> & Readonly<{ onTriggerScrollFromThumb?: ((options: ScrollToOptions) => any) | undefined; }>, { handleScroll: (option: { left: number; top: number; }) => void; }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & { triggerScrollFromThumb: (options: ScrollToOptions) => any; }, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, { thumbRef: HTMLDivElement; }, HTMLDivElement, import('vue').ComponentProvideOptions, { P: {}; B: {}; D: {}; C: {}; M: {}; Defaults: {}; }, Readonly<import('./components/scrollbar/Thumb.vue').Props> & Readonly<{ onTriggerScrollFromThumb?: ((options: ScrollToOptions) => any) | undefined; }>, { handleScroll: (option: { left: number; top: number; }) => void; }, {}, {}, {}, {}> | null; }, any, import('vue').ComponentProvideOptions, { P: {}; B: {}; D: {}; C: {}; M: {}; Defaults: {}; }, Readonly<import('./components/scrollbar/Bar.vue').Props> & Readonly<{ onTriggerScrollFromThumb?: ((options: ScrollToOptions) => any) | undefined; }>, { handleScroll: (wrap: HTMLDivElement) => void; }, {}, {}, {}, { scrollbarHeight: number; scrollbarWidth: number; }> | null; }; $slots: Readonly<{ [name: string]: import('vue').Slot<any> | undefined; }>; $root: import('vue').ComponentPublicInstance | null; $parent: import('vue').ComponentPublicInstance | null; $host: Element | null; $emit: ((event: "resize", target: HTMLDivElement) => void) & ((event: "scroll", args_0: { scrollTop: number; scrollLeft: number; }) => void) & ((event: "wheel", e: WheelEvent) => void) & ((event: "wrapResize", target: HTMLDivElement) => void) & ((event: "shiftScroll", e: WheelEvent) => void) & ((event: "verticalScrollBarShow", args_0: { show: boolean; scrollbarWidth: number; }) => void); $el: HTMLDivElement; $options: import('vue').ComponentOptionsBase<Readonly<import('./components/scrollbar/ScrollBar.vue').Props> & Readonly<{ onResize?: ((target: HTMLDivElement) => any) | undefined; onScroll?: ((args_0: { scrollTop: number; scrollLeft: number; }) => any) | undefined; onWheel?: ((e: WheelEvent) => any) | undefined; onWrapResize?: ((target: HTMLDivElement) => any) | undefined; onShiftScroll?: ((e: WheelEvent) => any) | undefined; onVerticalScrollBarShow?: ((args_0: { show: boolean; scrollbarWidth: number; }) => any) | undefined; }>, { onResize: () => void; scrollTo: (options: ScrollToOptions) => void; handleScroll: () => void; triggerScrollFromOutSide: (options: ScrollToOptions) => void; }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & { resize: (target: HTMLDivElement) => any; scroll: (args_0: { scrollTop: number; scrollLeft: number; }) => any; wheel: (e: WheelEvent) => any; wrapResize: (target: HTMLDivElement) => any; shiftScroll: (e: WheelEvent) => any; verticalScrollBarShow: (args_0: { show: boolean; scrollbarWidth: number; }) => any; }, string, { tag: string; interceptShiftScroll: boolean; alwayHorizontal: boolean; alwayVertical: boolean; }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & { beforeCreate?: (() => void) | (() => void)[]; created?: (() => void) | (() => void)[]; beforeMount?: (() => void) | (() => void)[]; mounted?: (() => void) | (() => void)[]; beforeUpdate?: (() => void) | (() => void)[]; updated?: (() => void) | (() => void)[]; activated?: (() => void) | (() => void)[]; deactivated?: (() => void) | (() => void)[]; beforeDestroy?: (() => void) | (() => void)[]; beforeUnmount?: (() => void) | (() => void)[]; destroyed?: (() => void) | (() => void)[]; unmounted?: (() => void) | (() => void)[]; renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[]; renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[]; errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[]; }; $forceUpdate: () => void; $nextTick: typeof import('vue').nextTick; $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle; } & Readonly<{ tag: string; interceptShiftScroll: boolean; alwayHorizontal: boolean; alwayVertical: boolean; }> & Omit<Readonly<import('./components/scrollbar/ScrollBar.vue').Props> & Readonly<{ onResize?: ((target: HTMLDivElement) => any) | undefined; onScroll?: ((args_0: { scrollTop: number; scrollLeft: number; }) => any) | undefined; onWheel?: ((e: WheelEvent) => any) | undefined; onWrapResize?: ((target: HTMLDivElement) => any) | undefined; onShiftScroll?: ((e: WheelEvent) => any) | undefined; onVerticalScrollBarShow?: ((args_0: { show: boolean; scrollbarWidth: number; }) => any) | undefined; }>, "scrollTo" | "onResize" | "handleScroll" | ("tag" | "interceptShiftScroll" | "alwayHorizontal" | "alwayVertical") | "triggerScrollFromOutSide"> & import('vue').ShallowUnwrapRef<{ onResize: () => void; scrollTo: (options: ScrollToOptions) => void; handleScroll: () => void; triggerScrollFromOutSide: (options: ScrollToOptions) => void; }> & {} & import('vue').ComponentCustomProperties & {} & { $slots: { default?(_: {}): any; }; }) | null; ganttBodyRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('./components/ganttView/ganttBody/GanttBody.vue').Props> & Readonly<{ onUpdateMinDate?: ((date: dayjs.Dayjs) => any) | undefined; onUpdateMaxDate?: ((date: dayjs.Dayjs) => any) | undefined; }>, { onResize: () => void; onScroll: ({ scrollTop, scrollLeft }: { scrollTop: number; scrollLeft: number; }) => void; freshTimeLines: (rowNodes: GanttRowNode[]) => void; }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & { updateMinDate: (date: dayjs.Dayjs) => any; updateMaxDate: (date: dayjs.Dayjs) => any; }, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, { ganttGridRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('./components/ganttView/ganttBody/ganttGrid/GanttGrid.vue').Props> & Readonly<{}>, { onScroll: ({ scrollTop, scrollLeft }: { scrollTop: number; scrollLeft: number; }) => void; onResize: () => void; }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, SVGSVGElement, import('vue').ComponentProvideOptions, { P: {}; B: {}; D: {}; C: {}; M: {}; Defaults: {}; }, Readonly<import('./components/ganttView/ganttBody/ganttGrid/GanttGrid.vue').Props> & Readonly<{}>, { onScroll: ({ scrollTop, scrollLeft }: { scrollTop: number; scrollLeft: number; }) => void; onResize: () => void; }, {}, {}, {}, {}> | null; ganttTimeLineViewRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('./components/ganttView/ganttBody/ganttTimeLineView/GanttTimeLineView.vue').Props> & Readonly<{ onUpdateMinDate?: ((date: dayjs.Dayjs) => any) | undefined; onUpdateMaxDate?: ((date: dayjs.Dayjs) => any) | undefined; }>, { onScroll: ({ scrollTop, scrollLeft }: { scrollTop: number; scrollLeft: number; }) => void; onResize: () => void; freshTimeLines: (rowNodes: GanttRowNode[]) => void; }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & { updateMinDate: (date: dayjs.Dayjs) => any; updateMaxDate: (date: dayjs.Dayjs) => any; }, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, { P: {}; B: {}; D: {}; C: {}; M: {}; Defaults: {}; }, Readonly<import('./components/ganttView/ganttBody/ganttTimeLineView/GanttTimeLineView.vue').Props> & Readonly<{ onUpdateMinDate?: ((date: dayjs.Dayjs) => any) | undefined; onUpdateMaxDate?: ((date: dayjs.Dayjs) => any) | undefined; }>, { onScroll: ({ scrollTop, scrollLeft }: { scrollTop: number; scrollLeft: number; }) => void; onResize: () => void; freshTimeLines: (rowNodes: GanttRowNode[]) => void; }, {}, {}, {}, {}> | null; }, HTMLDivElement, import('vue').ComponentProvideOptions, { P: {}; B: {}; D: {}; C: {}; M: {}; Defaults: {}; }, Readonly<import('./components/ganttView/ganttBody/GanttBody.vue').Props> & Readonly<{ onUpdateMinDate?: ((date: dayjs.Dayjs) => any) | undefined; onUpdateMaxDate?: ((date: dayjs.Dayjs) => any) | undefined; }>, { onResize: () => void; onScroll: ({ scrollTop, scrollLeft }: { scrollTop: number; scrollLeft: number; }) => void; freshTimeLines: (rowNodes: GanttRowNode[]) => void; }, {}, {}, {}, {}> | null; }, HTMLDivElement, import('vue').ComponentProvideOptions, { P: {}; B: {}; D: {}; C: {}; M: {}; Defaults: {}; }, Readonly<import('./components/ganttView/GanttView.vue').Props> & Readonly<{ onPerHourSpacingChange?: ((perHourSpacing: number) => any) | undefined; onGanttBodyResize?: ((target: HTMLDivElement) => any) | undefined; onTriggerTableViewScroll?: ((options: ScrollToOptions, onWheel?: boolean | undefined) => any) | undefined; }>, { scrollTo: (options: ScrollToOptions) => void; updateMinAndMaxDateByChangeRowNode: ({ addedRowNodes, deletedRowNodes, updatedRowNodes }: { addedRowNodes?: GanttRowNode[]; deletedRowNodes?: GanttRowNode[]; updatedRowNodes?: GanttRowNode[]; }, freshRowNodes: GanttRowNode[]) => void; freshTimeLines: (rowNodes: GanttRowNode[]) => void; }, {}, {}, {}, { defaultPerHourSpacing: number; }> | null; }, HTMLDivElement>; export default _default;