File tree 12 files changed +355
-284
lines changed
sap/ui/webcomponents/main
12 files changed +355
-284
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ class UI5Element extends HTMLElement {
39
39
}
40
40
41
41
onThemeChanged ( ) {
42
- if ( window . ShadyDOM ) {
42
+ if ( window . ShadyDOM || this . constructor . getMetadata ( ) . getNoShadowDOM ( ) ) {
43
43
// polyfill theme handling is in head styles directly
44
44
return ;
45
45
}
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import Popover from "./dist/Popover.js";
26
26
import Panel from "./dist/Panel.js" ;
27
27
import RadioButton from "./dist/RadioButton.js" ;
28
28
import Select from "./dist/Select.js" ;
29
+ import Option from "./dist/Option.js" ;
29
30
import ShellBar from "./dist/ShellBar.js" ;
30
31
import ShellBarItem from "./dist/ShellBarItem.js" ;
31
32
import Switch from "./dist/Switch.js" ;
Original file line number Diff line number Diff line change @@ -80,8 +80,14 @@ class ListItem extends ListItemBase {
80
80
return [ styles , ListItemBase . styles ] ;
81
81
}
82
82
83
- constructor ( ) {
84
- super ( ) ;
83
+ constructor ( props ) {
84
+ super ( props ) ;
85
+
86
+ this . deactivateByKey = event => {
87
+ if ( isEnter ( event ) ) {
88
+ this . deactivate ( ) ;
89
+ }
90
+ } ;
85
91
86
92
this . deactivate = ( ) => {
87
93
if ( this . _active ) {
@@ -94,10 +100,12 @@ class ListItem extends ListItemBase {
94
100
95
101
onEnterDOM ( ) {
96
102
document . addEventListener ( "mouseup" , this . deactivate ) ;
103
+ document . addEventListener ( "keyup" , this . deactivateByKey ) ;
97
104
}
98
105
99
106
onExitDOM ( ) {
100
107
document . removeEventListener ( "mouseup" , this . deactivate ) ;
108
+ document . removeEventListener ( "keyup" , this . deactivateByKey ) ;
101
109
}
102
110
103
111
onkeydown ( event ) {
Original file line number Diff line number Diff line change
1
+ import UI5Element from "@ui5/webcomponents-base/src/UI5Element.js" ;
2
+ import Bootstrap from "@ui5/webcomponents-base/src/Bootstrap.js" ;
3
+
4
+ /**
5
+ * @public
6
+ */
7
+ const metadata = {
8
+ tag : "ui5-option" ,
9
+ noShadowDOM : true ,
10
+ properties : /** @lends sap.ui.webcomponents.main.Option.prototype */ {
11
+
12
+ /**
13
+ * Defines the selected state of the <code>ui5-option</code>.
14
+ * @type {boolean }
15
+ * @defaultvalue false
16
+ * @public
17
+ */
18
+ selected : {
19
+ type : Boolean ,
20
+ } ,
21
+
22
+ /**
23
+ * Defines the <code>icon</code> source URI.
24
+ * </br></br>
25
+ * <b>Note:</b>
26
+ * SAP-icons font provides numerous buil-in icons. To find all the available icons, see the
27
+ * <ui5-link target="_blank" href="https://openui5.hana.ondemand.com/test-resources/sap/m/demokit/iconExplorer/webapp/index.html" class="api-table-content-cell-link">Icon Explorer</ui5-link>.
28
+ *
29
+ * @type {string }
30
+ * @public
31
+ */
32
+ icon : {
33
+ type : String ,
34
+ defaultValue : null ,
35
+ } ,
36
+ } ,
37
+
38
+ events : /** @lends sap.ui.webcomponents.main.Option.prototype */ { } ,
39
+ } ;
40
+
41
+ /**
42
+ * @class
43
+ *
44
+ * <h3 class="comment-api-title">Overview</h3>
45
+ *
46
+ * The <code>ui5-option</code> component defines the content of an opton in the <code>ui5-select</code>.
47
+ *
48
+ * @constructor
49
+ * @author SAP SE
50
+ * @alias sap.ui.webcomponents.main.Option
51
+ * @extends sap.ui.webcomponents.base.UI5Element
52
+ * @tagname ui5-option
53
+ * @public
54
+ */
55
+ class Option extends UI5Element {
56
+ static get metadata ( ) {
57
+ return metadata ;
58
+ }
59
+ }
60
+
61
+ Bootstrap . boot ( ) . then ( _ => {
62
+ Option . define ( ) ;
63
+ } ) ;
64
+
65
+ export default Option ;
Original file line number Diff line number Diff line change 2
2
class =" {{ classes.main }} "
3
3
tabindex =" {{ tabIndex }} "
4
4
dir =" {{ rtl }} "
5
+ @keydown =" {{ _keydown }} "
6
+ @keyup =" {{ _keyup }} "
5
7
>
6
8
<div
7
9
class =" sapWCSelectLabel"
8
- @click =" {{ toggleList }} " >
10
+ @click =" {{ _togglePopover }} " >
9
11
<ui5-label >{{ _text }} </ui5-label >
10
12
</div >
11
13
12
- {{ #if items }}
14
+ {{ #if options }}
13
15
<ui5-popover
16
+ id =" ui5-select--popover"
14
17
placement-type =" Bottom"
15
18
no-header
16
19
no-arrow
17
- horizontal-align =" Stretch" >
18
- <ui5-list separators =" None" >
19
- <slot ></slot >
20
+ horizontal-align =" Stretch"
21
+ @ui5-afterOpen =" {{ _applyFocusAfterOpen }} "
22
+ @ui5-beforeOpen =" {{ _beforeOpen }} "
23
+ @ui5-afterClose =" {{ _afterClose }} "
24
+ >
25
+ <ui5-list mode =" SingleSelect" separators =" None" @keydown =" {{ _handlePickerKeydown }} " @ui5-itemPress =" {{ _selectionChange }} " >
26
+ {{ #each _syncedOptions }}
27
+ <ui5-li ?selected =" {{ this.selected }} " icon =" {{ this.icon }} " id =" {{ this.id }} -li" >
28
+ {{ this.textContent }}
29
+ </ui5-li >
30
+ {{ /each }}
20
31
</ui5-list >
21
32
</ui5-popover >
22
33
{{ /if }}
23
34
24
35
<ui5-icon
25
36
src =" sap-icon://slim-arrow-down"
26
37
class =" sapWCSelectDropDownIcon"
27
- @ui5-press =" {{ toggleList }} "
38
+ @ui5-press =" {{ _togglePopover }} "
28
39
></ui5-icon >
29
40
</div >
You can’t perform that action at this time.
0 commit comments