Skip to content

Commit a38bbab

Browse files
feat(ui5-tabcontainer): implement overflow functionality (#4403)
Part of #2540 Co-authored-by: Teodor Taushanov <teodor.taushanov@sap.com>
1 parent 80bbc22 commit a38bbab

22 files changed

+902
-248
lines changed

packages/fiori/test/pages/FCL.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@
603603
</div>
604604
<br><br>
605605

606-
<ui5-tabcontainer id="tabContainer1" fixed collapsed show-overflow>
606+
<ui5-tabcontainer id="tabContainer1" fixed collapsed>
607607
<ui5-tab text="Products" additional-text="125">
608608
</ui5-tab>
609609
<ui5-tab-separator></ui5-tab-separator>

packages/fiori/test/pages/FCLApp.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<div class="separator"></div>
6565
<ui5-button design="Transparent" icon="decline"></ui5-button>
6666
</div>
67-
<ui5-tabcontainer show-overflow>
67+
<ui5-tabcontainer>
6868
<ui5-tab text="Product info" additional-text="200EUR">
6969
This is the best product
7070
</ui5-tab>

packages/fiori/test/samples/FlexibleColumnLayout.sample.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ <h3>FlexibleColumnLayout - One Initial Column</h3>
167167
</div>
168168
<br><br>
169169

170-
<ui5-tabcontainer id="tabContainer1" fixed collapsed show-overflow>
170+
<ui5-tabcontainer id="tabContainer1" fixed collapsed>
171171
<ui5-tab text="Products" additional-text="125">
172172
</ui5-tab>
173173
<ui5-tab-separator></ui5-tab-separator>

packages/main/src/Tab.js

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,25 @@ const metadata = {
118118
defaultValue: "-1",
119119
noAttribute: true,
120120
},
121+
122+
hideInStartOverflow: {
123+
type: Boolean,
124+
noAttribute: true,
125+
},
126+
127+
hideInEndOverflow: {
128+
type: Boolean,
129+
noAttribute: true,
130+
},
131+
132+
isInEndOverflow: {
133+
type: Boolean,
134+
noAttribute: true,
135+
},
136+
137+
_selected: {
138+
type: Boolean,
139+
},
121140
},
122141
events: /** @lends sap.ui.webcomponents.main.Tab.prototype */ {
123142
},
@@ -234,11 +253,11 @@ class Tab extends UI5Element {
234253
}
235254

236255
get effectiveSelected() {
237-
return this.selected || false;
256+
return this.selected || this._selected;
238257
}
239258

240259
get effectiveHidden() {
241-
return !this.selected;
260+
return !this.effectiveSelected;
242261
}
243262

244263
get ariaLabelledBy() {
@@ -262,7 +281,7 @@ class Tab extends UI5Element {
262281
get headerClasses() {
263282
const classes = ["ui5-tab-strip-item"];
264283

265-
if (this.selected) {
284+
if (this.effectiveSelected) {
266285
classes.push("ui5-tab-strip-item--selected");
267286
}
268287

@@ -324,6 +343,14 @@ class Tab extends UI5Element {
324343
get overflowState() {
325344
return this.disabled ? "Inactive" : "Active";
326345
}
346+
347+
get hideInOverflow() {
348+
if (this.isInEndOverflow) {
349+
return this.hideInEndOverflow;
350+
}
351+
352+
return this.hideInStartOverflow;
353+
}
327354
}
328355

329356
Tab.define();

packages/main/src/TabContainer.hbs

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,26 @@
77
{{/if}}
88

99
<div class="{{classes.header}}" id="{{_id}}-header">
10+
<div
11+
class="ui5-tc__overflowButton ui5-tc__startOverflowButton"
12+
@click="{{_onOverflowButtonClick}}"
13+
hidden
14+
>
15+
{{#if startOverflowButton.length}}
16+
<slot name="startOverflowButton"></slot>
17+
{{else}}
18+
<ui5-button
19+
icon="{{overflowMenuIcon}}"
20+
data-ui5-stable="tabs-overflow-start"
21+
tabindex="-1"
22+
title="{{overflowMenuTitle}}"
23+
aria-haspopup="true"
24+
icon-end>{{this._startOverflowText}}</ui5-button>
25+
{{/if}}
26+
</div>
1027
<div class="{{classes.headerInnerContainer}}">
11-
<div class="{{classes.headerBackArrow}}">
12-
<ui5-button @click="{{_onHeaderBackArrowClick}}"
13-
icon="slim-arrow-left"
14-
data-ui5-stable="tabs-left"
15-
design="Transparent"
16-
tabindex="-1"
17-
title="{{previousIconACCName}}"></ui5-button>
18-
</div>
1928
<!-- tab items -->
20-
<div class="{{classes.headerScrollContainer}}" id="{{_id}}-headerScrollContainer">
29+
<div class="{{classes.tabsInStripContainer}}" id="{{_id}}-tabsInStripContainer">
2130
<ul
2231
role="tablist"
2332
@focusin={{_onTablistFocusin}}
@@ -41,34 +50,24 @@
4150
{{/each}}
4251
</ul>
4352
</div>
44-
<div class="{{classes.headerForwardArrow}}">
45-
<ui5-button @click="{{_onHeaderForwardArrowClick}}"
46-
icon="slim-arrow-right"
47-
data-ui5-stable="tabs-right"
48-
design="Transparent"
49-
tabindex="-1"
50-
title="{{nextIconACCName}}"></ui5-button>
5153
</div>
54+
<div
55+
class="ui5-tc__overflowButton ui5-tc__endOverflowButton"
56+
@click="{{_onOverflowButtonClick}}"
57+
hidden
58+
>
59+
{{#if overflowButton.length}}
60+
<slot name="overflowButton"></slot>
61+
{{else}}
62+
<ui5-button
63+
icon="{{overflowMenuIcon}}"
64+
data-ui5-stable="tabs-overflow-end"
65+
tabindex="-1"
66+
title="{{overflowMenuTitle}}"
67+
aria-haspopup="true"
68+
icon-end>{{this._endOverflowText}}</ui5-button>
69+
{{/if}}
5270
</div>
53-
<!-- overflow button -->
54-
{{#if shouldShowOverflow}}
55-
<div
56-
class="ui-tc__overflowButton"
57-
@click="{{_onOverflowButtonClick}}"
58-
>
59-
{{#if overflowButton.length}}
60-
<slot name="overflowButton"></slot>
61-
{{else}}
62-
<ui5-button
63-
icon="{{overflowMenuIcon}}"
64-
data-ui5-stable="tabs-overflow"
65-
design="Transparent"
66-
tabindex="-1"
67-
title="{{overflowMenuTitle}}"
68-
aria-haspopup="true"></ui5-button>
69-
{{/if}}
70-
</div>
71-
{{/if}}
7271
</div>
7372

7473
{{#unless tabsAtTheBottom}}

0 commit comments

Comments
 (0)