From 2acf800b43bfbb21fbd5a54cece3044ef1cdf7bc Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Fri, 14 May 2021 12:50:55 +0300 Subject: [PATCH] Fixed #931 - Customizing the line of Timeline component --- api-generator/components/timeline.js | 4 ++++ src/components/timeline/Timeline.d.ts | 1 + src/components/timeline/Timeline.vue | 4 +++- src/views/timeline/TimelineDoc.vue | 32 ++++++++++++++++++++++----- 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/api-generator/components/timeline.js b/api-generator/components/timeline.js index 843d0f5f5f..3443c78a62 100644 --- a/api-generator/components/timeline.js +++ b/api-generator/components/timeline.js @@ -37,6 +37,10 @@ const TimelineSlots = [ { name: "content", description: "Custom content" + }, + { + name: "connector", + description: "Connector element" } ]; diff --git a/src/components/timeline/Timeline.d.ts b/src/components/timeline/Timeline.d.ts index 8d1a0c9e8a..c76e133c01 100644 --- a/src/components/timeline/Timeline.d.ts +++ b/src/components/timeline/Timeline.d.ts @@ -13,6 +13,7 @@ declare class Timeline { content: VNode[]; opposite: VNode[]; marker: VNode[]; + connector: VNode[]; } } diff --git a/src/components/timeline/Timeline.vue b/src/components/timeline/Timeline.vue index 25a1836844..a534daec9e 100644 --- a/src/components/timeline/Timeline.vue +++ b/src/components/timeline/Timeline.vue @@ -8,7 +8,9 @@
-
+ +
+
diff --git a/src/views/timeline/TimelineDoc.vue b/src/views/timeline/TimelineDoc.vue index 9b723ba569..62ec0b1676 100644 --- a/src/views/timeline/TimelineDoc.vue +++ b/src/views/timeline/TimelineDoc.vue @@ -110,6 +110,21 @@ export default { </template> </Timeline> + + +
Custom Connectors
+

Connector is an element that binds two events together, use the connector slot to use your own element instead of the default one. If you just require to customize simple properties like the + color and width, apply the "p-timeline-event-connector" class to your element to use the built-in positioning.

+

 
Properties
@@ -164,18 +179,23 @@ export default { opposite - item: Position of the component
- index: Index of the item + item: Position of the event
+ index: Index of the event marker - item: Custom marker of the component
- index: Index of the item + item: Custom marker of the event
+ index: Index of the event content - item: Content of the component
- index: Index of the item + item: Content of the event
+ index: Index of the event + + + connector + item: Content of the event
+ index: Index of the event