diff --git a/src/components/timeline/Timeline.d.ts b/src/components/timeline/Timeline.d.ts index 4a5ee2874..619237033 100644 --- a/src/components/timeline/Timeline.d.ts +++ b/src/components/timeline/Timeline.d.ts @@ -1,25 +1,104 @@ import { VNode } from 'vue'; +import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; -interface TimelineProps { - value?: any[]; - align?: string; - layout?: string; - dataKey?: string; +type TimelineVerticalAlignType = 'left' | 'right'; + +type TimelineHorizontalAlignType = 'top' | 'bottom'; + +type TimelineAlignType = TimelineVerticalAlignType | TimelineHorizontalAlignType; + +type TimelineLayoutType = 'vertical' | 'horizontal'; + +export interface TimelineProps { + /** + * An array of events to display. + */ + value?: any[] | undefined; + /** + * Position of the timeline bar relative to the content. + * @see TimelineAlignType + * Default value is 'left'. + */ + align?: TimelineAlignType; + /** + * Orientation of the timeline. + * @see TimelineLayoutType + * Default value is 'horizontal'. + */ + layout?: TimelineLayoutType; + /** + * Name of the field that uniquely identifies the a record in the data. + */ + dataKey?: string | undefined; } -interface TimelineSlotInterface { - item: any; - index: number; +export interface TimelineSlots { + /** + * Custom content template + * @param {Object} scope - content slot's params. + */ + content: (scope: { + /** + * Item data + */ + item: any; + /** + * Index of item + */ + index: number; + }) => VNode[]; + /** + * Custom opposite template. + * @param {Object} scope - opposite slot's params. + */ + opposite: (scope: { + /** + * Item data + */ + item: any; + /** + * Index of item + */ + index: number; + }) => VNode[]; + /** + * Custom marker template. + * @param {Object} scope - marker slot's params. + */ + marker: (scope: { + /** + * Item data + */ + item: any; + /** + * Index of item + */ + index: number; + }) => VNode[]; + /** + * Custom connector template. + */ + connector: () => VNode[]; } -declare class Timeline { - $props: TimelineProps; - $slots: { - content: TimelineSlotInterface; - opposite: TimelineSlotInterface; - marker: TimelineSlotInterface; - connector: VNode[]; +export declare type TimelineEmits = { +} + +declare class Timeline extends ClassComponent { } + +declare module '@vue/runtime-core' { + interface GlobalComponents { + Timeline: GlobalComponentConstructor } } +/** + * + * Timeline visualizes a series of chained events. + * + * Demos: + * + * - [Timeline](https://www.primefaces.org/primevue/showcase/#/timeline) + * + */ export default Timeline;