@@ -2,12 +2,17 @@ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
2
2
import { fetchI18nBundle , getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js" ;
3
3
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js" ;
4
4
import ItemNavigation from "@ui5/webcomponents-base/dist/delegate/ItemNavigation.js" ;
5
+ import NavigationMode from "@ui5/webcomponents-base/dist/types/NavigationMode.js" ;
5
6
import TimelineTemplate from "./generated/templates/TimelineTemplate.lit.js" ;
6
7
import { TIMELINE_ARIA_LABEL } from "./generated/i18n/i18n-defaults.js" ;
7
8
import TimelineItem from "./TimelineItem.js" ;
8
9
9
10
// Styles
10
11
import styles from "./generated/themes/Timeline.css.js" ;
12
+ import TimelineLayout from "./types/TimelineLayout.js" ;
13
+
14
+ const SHORT_LINE_WIDTH = "ShortLineWidth" ;
15
+ const LARGE_LINE_WIDTH = "LargeLineWidth" ;
11
16
12
17
/**
13
18
* @public
@@ -16,6 +21,28 @@ const metadata = {
16
21
tag : "ui5-timeline" ,
17
22
languageAware : true ,
18
23
managedSlots : true ,
24
+ properties : /** @lends sap.ui.webcomponents.fiori.Timeline.prototype */ {
25
+ /**
26
+ * Defines the items orientation.
27
+ *
28
+ * <br><br>
29
+ * <b>Note:</b>
30
+ * Available options are:
31
+ * <ul>
32
+ * <li><code>Vertical</code></li>
33
+ * <li><code>Horizontal</code></li>
34
+ * </ul>
35
+ *
36
+ * @type {TimelineLayout }
37
+ * @defaultvalue "Vertical"
38
+ * @since 1.0.0-rc.15
39
+ * @public
40
+ */
41
+ layout : {
42
+ type : TimelineLayout ,
43
+ defaultValue : TimelineLayout . Vertical ,
44
+ } ,
45
+ } ,
19
46
slots : /** @lends sap.ui.webcomponents.fiori.Timeline.prototype */ {
20
47
/**
21
48
* Determines the content of the <code>ui5-timeline</code>.
@@ -30,6 +57,7 @@ const metadata = {
30
57
individualSlots : true ,
31
58
} ,
32
59
} ,
60
+
33
61
} ;
34
62
35
63
/**
@@ -75,7 +103,6 @@ class Timeline extends UI5Element {
75
103
this . _itemNavigation = new ItemNavigation ( this , {
76
104
getItemsCallback : ( ) => this . items ,
77
105
} ) ;
78
-
79
106
this . i18nBundle = getI18nBundle ( "@ui5/webcomponents-fiori" ) ;
80
107
}
81
108
@@ -96,6 +123,19 @@ class Timeline extends UI5Element {
96
123
97
124
this . _itemNavigation . setCurrentItem ( target ) ;
98
125
}
126
+
127
+ onBeforeRendering ( ) {
128
+ this . _itemNavigation . navigationMode = this . layout === TimelineLayout . Horizontal ? NavigationMode . Horizontal : NavigationMode . Vertical ;
129
+
130
+ for ( let i = 0 ; i < this . items . length ; i ++ ) {
131
+ this . items [ i ] . layout = this . layout ;
132
+ if ( this . items [ i + 1 ] && ! ! this . items [ i + 1 ] . icon ) {
133
+ this . items [ i ] . _lineWidth = SHORT_LINE_WIDTH ;
134
+ } else if ( this . items [ i ] . icon && this . items [ i + 1 ] && ! this . items [ i + 1 ] . icon ) {
135
+ this . items [ i ] . _lineWidth = LARGE_LINE_WIDTH ;
136
+ }
137
+ }
138
+ }
99
139
}
100
140
101
141
Timeline . define ( ) ;
0 commit comments