File tree Expand file tree Collapse file tree 4 files changed +58
-1
lines changed Expand file tree Collapse file tree 4 files changed +58
-1
lines changed Original file line number Diff line number Diff line change 1
1
<div
2
- class =" ui5-bar- root"
2
+ class =" {{ classes. root}} "
3
3
aria-label =" {{ accInfo.label }} "
4
4
role =" toolbar"
5
5
part =" bar"
Original file line number Diff line number Diff line change 1
1
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js" ;
2
2
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js" ;
3
+ import ResizeHandler from "@ui5/webcomponents-base/dist/delegate/ResizeHandler.js" ;
3
4
import BarTemplate from "./generated/templates/BarTemplate.lit.js" ;
4
5
import BarDesign from "./types/BarDesign.js" ;
5
6
@@ -34,6 +35,15 @@ const metadata = {
34
35
type : BarDesign ,
35
36
defaultValue : BarDesign . Header ,
36
37
} ,
38
+
39
+ /**
40
+ * Defines if the component middle area needs to be centered between start and end area
41
+ * @type {Boolean }
42
+ * @private
43
+ */
44
+ _shrinked : {
45
+ type : Boolean ,
46
+ } ,
37
47
} ,
38
48
slots : /** @lends sap.ui.webcomponents.fiori.Bar.prototype */ {
39
49
/**
@@ -133,6 +143,38 @@ class Bar extends UI5Element {
133
143
"label" : this . design ,
134
144
} ;
135
145
}
146
+
147
+ constructor ( ) {
148
+ super ( ) ;
149
+
150
+ this . _handleResizeBound = this . handleResize . bind ( this ) ;
151
+ }
152
+
153
+ handleResize ( ) {
154
+ const bar = this . getDomRef ( ) ;
155
+ const barWidth = bar . offsetWidth ;
156
+
157
+ this . _shrinked = Array . from ( bar . children ) . some ( element => {
158
+ return barWidth / 3 < element . offsetWidth ;
159
+ } ) ;
160
+ }
161
+
162
+ get classes ( ) {
163
+ return {
164
+ root : {
165
+ "ui5-bar-root" : true ,
166
+ "ui5-bar-root-shrinked" : this . _shrinked ,
167
+ } ,
168
+ } ;
169
+ }
170
+
171
+ onEnterDOM ( ) {
172
+ ResizeHandler . register ( this , this . _handleResizeBound ) ;
173
+ }
174
+
175
+ onExitDOM ( ) {
176
+ ResizeHandler . deregister ( this , this . _handleResizeBound ) ;
177
+ }
136
178
}
137
179
138
180
Bar . define ( ) ;
Original file line number Diff line number Diff line change 22
22
display : flex;
23
23
flex-direction : row;
24
24
align-items : center;
25
+ justify-content : flex-start;
26
+ }
27
+
28
+ .ui5-bar-root .ui5-bar-content-container {
29
+ min-width : 30% ;
30
+ }
31
+
32
+ .ui5-bar-root .ui5-bar-root-shrinked .ui5-bar-content-container {
33
+ min-width : 0px ;
34
+ overflow : hidden;
25
35
}
26
36
27
37
.ui5-bar-root .ui5-bar-endcontent-container {
28
38
padding-right : 0.5rem ;
29
39
display : flex;
30
40
flex-direction : row;
31
41
align-items : center;
42
+ justify-content : flex-end;
32
43
}
33
44
.ui5-bar-root .ui5-bar-midcontent-container {
34
45
padding-left : 0.5rem ;
35
46
padding-right : 0.5rem ;
36
47
display : flex;
37
48
flex-direction : row;
38
49
align-items : center;
50
+ justify-content : center;
39
51
}
40
52
41
53
: host ([design = "Footer" ]){
Original file line number Diff line number Diff line change 43
43
44
44
< ui5-label slot ="endContent "> Basic Label</ ui5-label >
45
45
< ui5-button slot ="endContent "> End Button</ ui5-button >
46
+ < ui5-button design ="Positive " slot ="endContent "> Agree</ ui5-button >
47
+ < ui5-button design ="Negative " slot ="endContent "> Decline</ ui5-button >
48
+ < ui5-button design ="Transparent " slot ="endContent "> Cancel</ ui5-button >
46
49
</ ui5-bar >
47
50
48
51
< br >
You can’t perform that action at this time.
0 commit comments