@ui5/webcomponents 1.9.1 → 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/List.js +9 -5
- package/dist/ListItemBase.js +2 -2
- package/dist/TabContainer.js +29 -2
- package/dist/Table.js +3 -1
- package/dist/TextArea.js +15 -22
- package/dist/Tree.js +61 -45
- package/dist/TreeItem.js +30 -127
- package/dist/{TreeListItem.js → TreeItemBase.js} +141 -67
- package/dist/TreeItemCustom.js +102 -0
- package/dist/TreeList.js +43 -0
- package/dist/api.json +1 -1
- package/dist/assets/parameters-bundle.css.06e5f6af.js +1 -0
- package/dist/assets/parameters-bundle.css.1024d408.js +1 -0
- package/dist/assets/parameters-bundle.css.12ef5553.js +1 -0
- package/dist/assets/parameters-bundle.css.1f15a001.js +1 -0
- package/dist/assets/parameters-bundle.css.2c92b83f.js +1 -0
- package/dist/assets/parameters-bundle.css.2ff57cb9.js +1 -0
- package/dist/assets/parameters-bundle.css.37d45e6a.js +1 -0
- package/dist/assets/parameters-bundle.css.43cfec9f.js +1 -0
- package/dist/assets/parameters-bundle.css.50f83b44.js +1 -0
- package/dist/assets/parameters-bundle.css.6ac2a3ec.js +1 -0
- package/dist/assets/parameters-bundle.css.76ee50df.js +1 -0
- package/dist/assets/parameters-bundle.css.8156fdfe.js +1 -0
- package/dist/assets/parameters-bundle.css.828caf0e.js +1 -0
- package/dist/assets/parameters-bundle.css.89d7ea85.js +1 -0
- package/dist/assets/parameters-bundle.css.9ff9d4cd.js +1 -0
- package/dist/assets/parameters-bundle.css.a1f2b381.js +1 -0
- package/dist/assets/parameters-bundle.css.a9042929.js +1 -0
- package/dist/assets/parameters-bundle.css.abcd1057.js +1 -0
- package/dist/assets/parameters-bundle.css.b58e1801.js +1 -0
- package/dist/assets/parameters-bundle.css.c3acfe91.js +1 -0
- package/dist/assets/parameters-bundle.css.d4817fb4.js +1 -0
- package/dist/assets/parameters-bundle.css.dd8f8072.js +1 -0
- package/dist/assets/parameters-bundle.css.fe4c8069.js +1 -0
- package/dist/assets/parameters-bundle.css.feee54fa.js +1 -0
- package/dist/css/themes/TabContainer.css +1 -1
- package/dist/css/themes/TextArea.css +1 -1
- package/dist/css/themes/TreeItem.css +1 -0
- package/dist/css/themes/ValueStateMessage.css +1 -1
- package/dist/css/themes/sap_belize/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_belize_hcb/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_belize_hcw/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_fiori_3/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_fiori_3_dark/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_fiori_3_hcb/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_fiori_3_hcw/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_horizon/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_horizon_dark/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_horizon_exp/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_horizon_hcb/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_horizon_hcw/parameters-bundle.css +1 -1
- package/dist/generated/assets/themes/sap_belize/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_belize_hcb/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_belize_hcw/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_fiori_3/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_fiori_3_dark/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_fiori_3_hcb/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_fiori_3_hcw/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_horizon/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_horizon_dark/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_horizon_exp/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_horizon_hcb/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_horizon_hcw/parameters-bundle.css.json +1 -1
- package/dist/generated/templates/CustomListItemTemplate.lit.js +1 -1
- package/dist/generated/templates/ListItemTemplate.lit.js +1 -1
- package/dist/generated/templates/StandardListItemTemplate.lit.js +1 -1
- package/dist/generated/templates/SuggestionListItemTemplate.lit.js +1 -1
- package/dist/generated/templates/TableRowTemplate.lit.js +2 -2
- package/dist/generated/templates/TableTemplate.lit.js +1 -1
- package/dist/generated/templates/TextAreaTemplate.lit.js +2 -2
- package/dist/generated/templates/TreeItemBaseTemplate.lit.js +24 -0
- package/dist/generated/templates/TreeItemCustomTemplate.lit.js +24 -0
- package/dist/generated/templates/{TreeListItemTemplate.lit.js → TreeItemTemplate.lit.js} +3 -2
- package/dist/generated/templates/TreeTemplate.lit.js +1 -2
- package/dist/generated/themes/TabContainer.css.js +1 -1
- package/dist/generated/themes/TextArea.css.js +1 -1
- package/dist/generated/themes/TreeItem.css.js +8 -0
- package/dist/generated/themes/ValueStateMessage.css.js +1 -1
- package/dist/generated/themes/sap_belize/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_belize_hcb/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_belize_hcw/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_fiori_3/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_fiori_3_dark/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_fiori_3_hcb/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_fiori_3_hcw/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_horizon/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_horizon_exp/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.js +1 -1
- package/dist/types/TabContainerBackgroundDesign.js +48 -0
- package/package.json +6 -6
- package/src/List.js +9 -5
- package/src/ListItem.hbs +5 -0
- package/src/ListItemBase.js +2 -2
- package/src/TabContainer.js +29 -2
- package/src/Table.hbs +1 -1
- package/src/Table.js +3 -1
- package/src/TableRow.hbs +2 -2
- package/src/TextArea.hbs +29 -28
- package/src/TextArea.js +15 -22
- package/src/Tree.hbs +8 -33
- package/src/Tree.js +61 -45
- package/src/TreeItem.hbs +13 -0
- package/src/TreeItem.js +30 -127
- package/src/{TreeListItem.hbs → TreeItemBase.hbs} +17 -10
- package/src/{TreeListItem.js → TreeItemBase.js} +141 -67
- package/src/TreeItemCustom.hbs +7 -0
- package/src/TreeItemCustom.js +102 -0
- package/src/TreeList.js +43 -0
- package/src/themes/TabContainer.css +19 -3
- package/src/themes/TextArea.css +236 -140
- package/src/themes/{TreeListItem.css → TreeItem.css} +49 -2
- package/src/themes/ValueStateMessage.css +1 -0
- package/src/themes/base/TabContainer-parameters.css +4 -0
- package/src/themes/base/TextArea-parameters.css +35 -17
- package/src/themes/base/ValueStateMessage-parameters.css +2 -1
- package/src/themes/base/sizes-parameters.css +8 -2
- package/src/themes/sap_belize/TabContainer-parameters.css +4 -0
- package/src/themes/sap_belize/TextArea-parameters.css +15 -0
- package/src/themes/sap_belize/parameters-bundle.css +2 -2
- package/src/themes/sap_belize/sizes-parameters.css +2 -0
- package/src/themes/sap_belize_hcb/TextArea-parameters.css +22 -4
- package/src/themes/sap_belize_hcw/TextArea-parameters.css +22 -4
- package/src/themes/sap_fiori_3_hcb/TextArea-parameters.css +18 -8
- package/src/themes/sap_fiori_3_hcw/TextArea-parameters.css +18 -8
- package/src/themes/sap_horizon/TextArea-parameters.css +31 -12
- package/src/themes/sap_horizon/ValueStateMessage-parameters.css +1 -0
- package/src/themes/sap_horizon/sizes-parameters.css +4 -0
- package/src/themes/sap_horizon_dark/TextArea-parameters.css +31 -12
- package/src/themes/sap_horizon_dark/ValueStateMessage-parameters.css +1 -0
- package/src/themes/sap_horizon_dark/sizes-parameters.css +6 -0
- package/src/themes/sap_horizon_hcb/TextArea-parameters.css +24 -10
- package/src/themes/sap_horizon_hcw/TextArea-parameters.css +25 -11
- package/src/types/TabContainerBackgroundDesign.js +48 -0
- package/dist/assets/parameters-bundle.css.04aa71c9.js +0 -1
- package/dist/assets/parameters-bundle.css.0e0c347c.js +0 -1
- package/dist/assets/parameters-bundle.css.13aed676.js +0 -1
- package/dist/assets/parameters-bundle.css.157592af.js +0 -1
- package/dist/assets/parameters-bundle.css.19703c05.js +0 -1
- package/dist/assets/parameters-bundle.css.25017933.js +0 -1
- package/dist/assets/parameters-bundle.css.39c4c6e3.js +0 -1
- package/dist/assets/parameters-bundle.css.5550ceb2.js +0 -1
- package/dist/assets/parameters-bundle.css.5abf669c.js +0 -1
- package/dist/assets/parameters-bundle.css.60956972.js +0 -1
- package/dist/assets/parameters-bundle.css.61a5fde8.js +0 -1
- package/dist/assets/parameters-bundle.css.a0a54b12.js +0 -1
- package/dist/assets/parameters-bundle.css.a9e84ff6.js +0 -1
- package/dist/assets/parameters-bundle.css.adc7c452.js +0 -1
- package/dist/assets/parameters-bundle.css.b0b8ad26.js +0 -1
- package/dist/assets/parameters-bundle.css.b6916ba6.js +0 -1
- package/dist/assets/parameters-bundle.css.b9f623cd.js +0 -1
- package/dist/assets/parameters-bundle.css.ba38c500.js +0 -1
- package/dist/assets/parameters-bundle.css.c64ba63b.js +0 -1
- package/dist/assets/parameters-bundle.css.cac9f3de.js +0 -1
- package/dist/assets/parameters-bundle.css.d5d27adb.js +0 -1
- package/dist/assets/parameters-bundle.css.ec7f0d6e.js +0 -1
- package/dist/assets/parameters-bundle.css.f280686f.js +0 -1
- package/dist/assets/parameters-bundle.css.fbd8d2ab.js +0 -1
- package/dist/css/themes/TreeListItem.css +0 -1
- package/dist/generated/themes/TreeListItem.css.js +0 -8
package/src/TreeItem.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
|
|
2
1
|
import ValueState from "@ui5/webcomponents-base/dist/types/ValueState.js";
|
|
2
|
+
import TreeItemBase from "./TreeItemBase.js";
|
|
3
|
+
// Template
|
|
4
|
+
import TreeItemTemplate from "./generated/templates/TreeItemTemplate.lit.js";
|
|
5
|
+
|
|
6
|
+
// Styles
|
|
7
|
+
import treeItemCss from "./generated/themes/TreeItem.css.js";
|
|
3
8
|
|
|
4
9
|
/**
|
|
5
10
|
* @public
|
|
@@ -19,76 +24,6 @@ const metadata = {
|
|
|
19
24
|
type: String,
|
|
20
25
|
},
|
|
21
26
|
|
|
22
|
-
/**
|
|
23
|
-
* Defines whether the tree node is expanded or collapsed. Only has visual effect for tree nodes with children.
|
|
24
|
-
*
|
|
25
|
-
* @type {boolean}
|
|
26
|
-
* @defaultvalue false
|
|
27
|
-
* @public
|
|
28
|
-
*/
|
|
29
|
-
expanded: {
|
|
30
|
-
type: Boolean,
|
|
31
|
-
},
|
|
32
|
-
/**
|
|
33
|
-
* Defines whether the selection of a tree node is displayed as partially selected.
|
|
34
|
-
* <br><br>
|
|
35
|
-
* <b>Note:</b> The indeterminate state can be set only programmatically and can’t be achieved by user
|
|
36
|
-
* interaction, meaning that the resulting visual state depends on the values of the <code>indeterminate</code>
|
|
37
|
-
* and <code>selected</code> properties:
|
|
38
|
-
* <ul>
|
|
39
|
-
* <li> If a tree node has both <code>selected</code> and <code>indeterminate</code> set to <code>true</code>, it is displayed as partially selected.
|
|
40
|
-
* <li> If a tree node has <code>selected</code> set to <code>true</code> and <code>indeterminate</code> set to <code>false</code>, it is displayed as selected.
|
|
41
|
-
* <li> If a tree node has <code>selected</code> set to <code>false</code>, it is displayed as not selected regardless of the value of the <code>indeterminate</code> property.
|
|
42
|
-
* </ul>
|
|
43
|
-
* <br>
|
|
44
|
-
* <b>Note:</b> This property takes effect only when the <code>ui5-tree</code> is in <code>MultiSelect</code> mode.
|
|
45
|
-
* @type {boolean}
|
|
46
|
-
* @defaultvalue false
|
|
47
|
-
* @public
|
|
48
|
-
* @since 1.1.0
|
|
49
|
-
*/
|
|
50
|
-
indeterminate: {
|
|
51
|
-
type: Boolean,
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Defines whether the tree node has children, even if currently no other tree nodes are slotted inside.
|
|
56
|
-
* <br>
|
|
57
|
-
* <i>Note:</i> This property is useful for showing big tree structures where not all nodes are initially loaded due to performance reasons.
|
|
58
|
-
* Set this to <code>true</code> for nodes you intend to load lazily, when the user clicks the expand button.
|
|
59
|
-
* It is not necessary to set this property otherwise. If a tree item has children, the expand button will be displayed anyway.
|
|
60
|
-
*
|
|
61
|
-
* @type {boolean}
|
|
62
|
-
* @defaultvalue false
|
|
63
|
-
* @public
|
|
64
|
-
*/
|
|
65
|
-
hasChildren: {
|
|
66
|
-
type: Boolean,
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Defines whether the tree node is selected by the user. Only has effect if the <code>ui5-tree</code> is in one of the
|
|
71
|
-
* following modes: in <code>SingleSelect</code>, <code>SingleSelectBegin</code>, <code>SingleSelectEnd</code> and <code>MultiSelect</code>.
|
|
72
|
-
*
|
|
73
|
-
* @type {boolean}
|
|
74
|
-
* @defaultvalue false
|
|
75
|
-
* @public
|
|
76
|
-
*/
|
|
77
|
-
selected: {
|
|
78
|
-
type: Boolean,
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* If set, an icon will be displayed before the text, representing the tree item.
|
|
83
|
-
*
|
|
84
|
-
* @public
|
|
85
|
-
* @type {string}
|
|
86
|
-
* @defaultValue ""
|
|
87
|
-
*/
|
|
88
|
-
icon: {
|
|
89
|
-
type: String,
|
|
90
|
-
},
|
|
91
|
-
|
|
92
27
|
/**
|
|
93
28
|
* Defines the <code>additionalText</code>, displayed in the end of the tree item.
|
|
94
29
|
* @type {string}
|
|
@@ -112,59 +47,27 @@ const metadata = {
|
|
|
112
47
|
type: ValueState,
|
|
113
48
|
defaultValue: ValueState.None,
|
|
114
49
|
},
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Defines the accessible name of the component.
|
|
118
|
-
*
|
|
119
|
-
* @type {string}
|
|
120
|
-
* @defaultvalue: ""
|
|
121
|
-
* @public
|
|
122
|
-
* @since 1.8.0
|
|
123
|
-
*/
|
|
124
|
-
accessibleName: {
|
|
125
|
-
type: String,
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Defines the tooltip of the component.
|
|
130
|
-
* @type {string}
|
|
131
|
-
* @defaultvalue ""
|
|
132
|
-
* @private
|
|
133
|
-
* @since 1.0.0-rc.15
|
|
134
|
-
*/
|
|
135
|
-
title: {
|
|
136
|
-
type: String,
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
managedSlots: true,
|
|
140
|
-
slots: /** @lends sap.ui.webcomponents.main.TreeItem.prototype */ {
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Defines the items of this component.
|
|
144
|
-
*
|
|
145
|
-
* @type {sap.ui.webcomponents.main.ITreeItem[]}
|
|
146
|
-
* @slot items
|
|
147
|
-
* @public
|
|
148
|
-
*/
|
|
149
|
-
"default": {
|
|
150
|
-
propertyName: "items",
|
|
151
|
-
type: HTMLElement,
|
|
152
|
-
invalidateOnChildChange: true,
|
|
153
|
-
},
|
|
154
50
|
},
|
|
155
51
|
};
|
|
156
52
|
|
|
157
53
|
/**
|
|
158
54
|
* @class
|
|
159
|
-
*
|
|
160
55
|
* <h3 class="comment-api-title">Overview</h3>
|
|
56
|
+
* The <code>ui5-tree-item</code> represents a node in a tree structure, shown as a <code>ui5-list</code>.
|
|
57
|
+
* <br>
|
|
161
58
|
* This is the item to use inside a <code>ui5-tree</code>.
|
|
162
59
|
* You can represent an arbitrary tree structure by recursively nesting tree items.
|
|
163
60
|
*
|
|
164
|
-
* <h3>
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
* <
|
|
61
|
+
* <h3>CSS Shadow Parts</h3>
|
|
62
|
+
*
|
|
63
|
+
* <ui5-link target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/CSS/::part">CSS Shadow Parts</ui5-link> allow developers to style elements inside the Shadow DOM.
|
|
64
|
+
* <br>
|
|
65
|
+
* The <code>ui5-tree-item</code> exposes the following CSS Shadow Parts:
|
|
66
|
+
* <ul>
|
|
67
|
+
* <li>title - Used to style the title of the tree list item</li>
|
|
68
|
+
* <li>additionalText - Used to style the additionalText of the tree list item</li>
|
|
69
|
+
* <li>icon - Used to style the icon of the tree list item</li>
|
|
70
|
+
* </ul>
|
|
168
71
|
*
|
|
169
72
|
* <h3>ES6 Module Import</h3>
|
|
170
73
|
* <code>import "@ui5/webcomponents/dist/TreeItem.js";</code>
|
|
@@ -172,27 +75,27 @@ const metadata = {
|
|
|
172
75
|
* @constructor
|
|
173
76
|
* @author SAP SE
|
|
174
77
|
* @alias sap.ui.webcomponents.main.TreeItem
|
|
175
|
-
* @extends sap.ui.webcomponents.
|
|
78
|
+
* @extends sap.ui.webcomponents.main.TreeItemBase
|
|
176
79
|
* @tagname ui5-tree-item
|
|
177
80
|
* @public
|
|
178
81
|
* @implements sap.ui.webcomponents.main.ITreeItem
|
|
179
82
|
* @since 1.0.0-rc.8
|
|
180
83
|
*/
|
|
181
|
-
class TreeItem extends
|
|
182
|
-
static get
|
|
183
|
-
return
|
|
84
|
+
class TreeItem extends TreeItemBase {
|
|
85
|
+
static get template() {
|
|
86
|
+
return TreeItemTemplate;
|
|
184
87
|
}
|
|
185
88
|
|
|
186
|
-
get
|
|
187
|
-
return
|
|
89
|
+
static get styles() {
|
|
90
|
+
return [...super.styles, treeItemCss];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
static get metadata() {
|
|
94
|
+
return metadata;
|
|
188
95
|
}
|
|
189
96
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
* @public
|
|
193
|
-
*/
|
|
194
|
-
toggle() {
|
|
195
|
-
this.expanded = !this.expanded;
|
|
97
|
+
get _showTitle() {
|
|
98
|
+
return this.text.length && !this._minimal;
|
|
196
99
|
}
|
|
197
100
|
}
|
|
198
101
|
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
<div>
|
|
2
|
+
{{>include "./ListItem.hbs"}}
|
|
3
|
+
|
|
4
|
+
{{> listItemPostContent}}
|
|
5
|
+
</div>
|
|
2
6
|
|
|
3
7
|
{{#*inline "listItemPreContent"}}
|
|
4
8
|
<div
|
|
@@ -19,15 +23,6 @@
|
|
|
19
23
|
{{/inline}}
|
|
20
24
|
|
|
21
25
|
{{#*inline "listItemContent"}}
|
|
22
|
-
<div class="ui5-li-tree-text-wrapper">
|
|
23
|
-
{{#if _showTitle}}
|
|
24
|
-
<div part="title" class="ui5-li-title"><slot></slot></div>
|
|
25
|
-
{{/if}}
|
|
26
|
-
|
|
27
|
-
{{#if additionalText}}
|
|
28
|
-
<span part="additional-text" class="ui5-li-additional-text">{{additionalText}}</span>
|
|
29
|
-
{{/if}}
|
|
30
|
-
</div>
|
|
31
26
|
{{/inline}}
|
|
32
27
|
|
|
33
28
|
{{#*inline "imageBegin"}}{{/inline}}
|
|
@@ -48,3 +43,15 @@
|
|
|
48
43
|
></ui5-icon>
|
|
49
44
|
{{/if}}
|
|
50
45
|
{{/inline}}
|
|
46
|
+
|
|
47
|
+
{{#*inline "listItemPostContent"}}
|
|
48
|
+
{{#if expanded}}
|
|
49
|
+
<ul
|
|
50
|
+
role="group"
|
|
51
|
+
id="{{_id}}-subtree"
|
|
52
|
+
class="ui5-tree-li-subtree"
|
|
53
|
+
>
|
|
54
|
+
<slot></slot>
|
|
55
|
+
</ul>
|
|
56
|
+
{{/if}}
|
|
57
|
+
{{/inline}}
|
|
@@ -13,24 +13,26 @@ import {
|
|
|
13
13
|
} from "./generated/i18n/i18n-defaults.js";
|
|
14
14
|
|
|
15
15
|
// Template
|
|
16
|
-
import
|
|
16
|
+
import TreeItemBaseTemplate from "./generated/templates/TreeItemBaseTemplate.lit.js";
|
|
17
17
|
|
|
18
18
|
// Styles
|
|
19
|
-
import
|
|
19
|
+
import treeItemCss from "./generated/themes/TreeItem.css.js";
|
|
20
|
+
|
|
21
|
+
import HasPopup from "./types/HasPopup.js";
|
|
20
22
|
|
|
21
23
|
/**
|
|
22
24
|
* @public
|
|
23
25
|
*/
|
|
24
26
|
const metadata = {
|
|
25
|
-
tag: "ui5-li-tree",
|
|
26
27
|
languageAware: true,
|
|
27
|
-
|
|
28
|
+
managedSlots: true,
|
|
29
|
+
properties: /** @lends sap.ui.webcomponents.main.TreeItemBase.prototype */ {
|
|
28
30
|
|
|
29
31
|
/**
|
|
30
32
|
* Defines the indentation of the tree list item. Use level 1 for tree list items, representing top-level tree nodes.
|
|
31
33
|
*
|
|
32
34
|
* @type {sap.ui.webcomponents.base.types.Integer}
|
|
33
|
-
* @
|
|
35
|
+
* @protected
|
|
34
36
|
* @defaultValue 1
|
|
35
37
|
*/
|
|
36
38
|
level: {
|
|
@@ -54,7 +56,7 @@ const metadata = {
|
|
|
54
56
|
*
|
|
55
57
|
* @type {boolean}
|
|
56
58
|
* @defaultvalue false
|
|
57
|
-
* @
|
|
59
|
+
* @protected
|
|
58
60
|
*/
|
|
59
61
|
showToggleButton: {
|
|
60
62
|
type: Boolean,
|
|
@@ -72,21 +74,40 @@ const metadata = {
|
|
|
72
74
|
},
|
|
73
75
|
|
|
74
76
|
/**
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
* Defines whether the selection of a tree node is displayed as partially selected.
|
|
78
|
+
* <br><br>
|
|
79
|
+
* <b>Note:</b> The indeterminate state can be set only programmatically and can’t be achieved by user
|
|
80
|
+
* interaction, meaning that the resulting visual state depends on the values of the <code>indeterminate</code>
|
|
81
|
+
* and <code>selected</code> properties:
|
|
82
|
+
* <ul>
|
|
83
|
+
* <li> If a tree node has both <code>selected</code> and <code>indeterminate</code> set to <code>true</code>, it is displayed as partially selected.
|
|
84
|
+
* <li> If a tree node has <code>selected</code> set to <code>true</code> and <code>indeterminate</code> set to <code>false</code>, it is displayed as selected.
|
|
85
|
+
* <li> If a tree node has <code>selected</code> set to <code>false</code>, it is displayed as not selected regardless of the value of the <code>indeterminate</code> property.
|
|
86
|
+
* </ul>
|
|
87
|
+
* <br>
|
|
88
|
+
* <b>Note:</b> This property takes effect only when the <code>ui5-tree</code> is in <code>MultiSelect</code> mode.
|
|
89
|
+
* @type {boolean}
|
|
90
|
+
* @defaultvalue false
|
|
91
|
+
* @public
|
|
92
|
+
* @since 1.1.0
|
|
93
|
+
*/
|
|
78
94
|
indeterminate: {
|
|
79
95
|
type: Boolean,
|
|
80
96
|
},
|
|
81
97
|
|
|
82
98
|
/**
|
|
83
|
-
* Defines the
|
|
84
|
-
*
|
|
99
|
+
* Defines whether the tree node has children, even if currently no other tree nodes are slotted inside.
|
|
100
|
+
* <br>
|
|
101
|
+
* <i>Note:</i> This property is useful for showing big tree structures where not all nodes are initially loaded due to performance reasons.
|
|
102
|
+
* Set this to <code>true</code> for nodes you intend to load lazily, when the user clicks the expand button.
|
|
103
|
+
* It is not necessary to set this property otherwise. If a tree item has children, the expand button will be displayed anyway.
|
|
104
|
+
*
|
|
105
|
+
* @type {boolean}
|
|
106
|
+
* @defaultvalue false
|
|
85
107
|
* @public
|
|
86
|
-
* @since 1.0.0-rc.15
|
|
87
108
|
*/
|
|
88
|
-
|
|
89
|
-
type:
|
|
109
|
+
hasChildren: {
|
|
110
|
+
type: Boolean,
|
|
90
111
|
},
|
|
91
112
|
|
|
92
113
|
/**
|
|
@@ -111,7 +132,7 @@ const metadata = {
|
|
|
111
132
|
* @public
|
|
112
133
|
* @since 1.8.0
|
|
113
134
|
*/
|
|
114
|
-
|
|
135
|
+
accessibleName: {
|
|
115
136
|
type: String,
|
|
116
137
|
},
|
|
117
138
|
|
|
@@ -155,28 +176,65 @@ const metadata = {
|
|
|
155
176
|
noAttribute: true,
|
|
156
177
|
},
|
|
157
178
|
|
|
179
|
+
/**
|
|
180
|
+
* Defines the description for the accessible role of the component.
|
|
181
|
+
* @protected
|
|
182
|
+
* @type {string}
|
|
183
|
+
* @defaultvalue undefined
|
|
184
|
+
* @since 1.10.0
|
|
185
|
+
*/
|
|
186
|
+
accessibleRoleDescription: {
|
|
187
|
+
type: String,
|
|
188
|
+
defaultValue: undefined,
|
|
189
|
+
noAttribute: true,
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Defines if the item should be collapsible or not.
|
|
194
|
+
* It is true, for example, for the items inside the Popover of the Side Navigation
|
|
195
|
+
* @private
|
|
196
|
+
* @type {boolean}
|
|
197
|
+
* @defaultvalue false
|
|
198
|
+
* @since 1.10.0
|
|
199
|
+
*/
|
|
200
|
+
_fixed: {
|
|
201
|
+
type: Boolean,
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Defines the availability and type of interactive popup element that can be triggered by the component on which the property is set.
|
|
206
|
+
* @type {sap.ui.webcomponents.main.types.HasPopup}
|
|
207
|
+
* @since 1.10.0
|
|
208
|
+
* @private
|
|
209
|
+
*/
|
|
210
|
+
ariaHaspopup: {
|
|
211
|
+
type: HasPopup,
|
|
212
|
+
noAttribute: true,
|
|
213
|
+
},
|
|
158
214
|
},
|
|
159
|
-
slots: /** @lends sap.ui.webcomponents.main.
|
|
215
|
+
slots: /** @lends sap.ui.webcomponents.main.TreeItemBase.prototype */ {
|
|
160
216
|
/**
|
|
161
|
-
* Defines the
|
|
162
|
-
* <br
|
|
163
|
-
* <
|
|
217
|
+
* Defines the items of the component.
|
|
218
|
+
* <br />
|
|
219
|
+
* <br />
|
|
220
|
+
* <b>Note:</b> Use <code>ui5-tree-item</code> or <code>ui5-tree-item-custom</code>
|
|
164
221
|
*
|
|
165
|
-
* @type {
|
|
166
|
-
* @slot
|
|
222
|
+
* @type {sap.ui.webcomponents.main.ITreeItem}
|
|
223
|
+
* @slot items
|
|
167
224
|
* @public
|
|
168
225
|
*/
|
|
169
226
|
"default": {
|
|
170
|
-
type:
|
|
227
|
+
type: HTMLElement,
|
|
228
|
+
propertyName: "items",
|
|
171
229
|
},
|
|
172
230
|
},
|
|
173
|
-
events: /** @lends sap.ui.webcomponents.main.
|
|
231
|
+
events: /** @lends sap.ui.webcomponents.main.TreeItemBase.prototype */ {
|
|
174
232
|
|
|
175
233
|
/**
|
|
176
234
|
* Fired when the user interacts with the expand/collapse button of the tree list item.
|
|
177
235
|
* @event
|
|
178
236
|
* @param {HTMLElement} item the toggled item.
|
|
179
|
-
* @
|
|
237
|
+
* @protected
|
|
180
238
|
*/
|
|
181
239
|
toggle: {
|
|
182
240
|
detail: {
|
|
@@ -187,9 +245,9 @@ const metadata = {
|
|
|
187
245
|
/**
|
|
188
246
|
* Fired when the user drills down into the tree hierarchy by pressing the right arrow on the tree node.
|
|
189
247
|
*
|
|
190
|
-
* @event sap.ui.webcomponents.main.
|
|
248
|
+
* @event sap.ui.webcomponents.main.TreeItemBase#step-in
|
|
191
249
|
* @param {HTMLElement} item the item on which right arrow was pressed.
|
|
192
|
-
* @
|
|
250
|
+
* @protected
|
|
193
251
|
*/
|
|
194
252
|
"step-in": {
|
|
195
253
|
detail: {
|
|
@@ -200,9 +258,9 @@ const metadata = {
|
|
|
200
258
|
/**
|
|
201
259
|
* Fired when the user goes up the tree hierarchy by pressing the left arrow on the tree node.
|
|
202
260
|
*
|
|
203
|
-
* @event sap.ui.webcomponents.main.
|
|
261
|
+
* @event sap.ui.webcomponents.main.TreeItemBase#step-out
|
|
204
262
|
* @param {HTMLElement} item the item on which left arrow was pressed.
|
|
205
|
-
* @
|
|
263
|
+
* @protected
|
|
206
264
|
*/
|
|
207
265
|
"step-out": {
|
|
208
266
|
detail: {
|
|
@@ -213,38 +271,23 @@ const metadata = {
|
|
|
213
271
|
};
|
|
214
272
|
|
|
215
273
|
/**
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
* <br>
|
|
219
|
-
* <i>Note:</i> Do not use <code>ui5-li-tree</code> directly in your apps. Use <code>ui5-tree-item</code> instead, as it can be nested inside a <code>ui5-tree</code>.
|
|
220
|
-
* On the other hand, <code>ui5-li-tree</code> can only be slotted inside a <code>ui5-list</code>, being a list item. It may be useful if you want to build a custom tree component, for example.
|
|
221
|
-
*
|
|
222
|
-
* <h3>CSS Shadow Parts</h3>
|
|
223
|
-
*
|
|
224
|
-
* <ui5-link target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/CSS/::part">CSS Shadow Parts</ui5-link> allow developers to style elements inside the Shadow DOM.
|
|
225
|
-
* <br>
|
|
226
|
-
* The <code>ui5-li-tree</code> exposes the following CSS Shadow Parts:
|
|
227
|
-
* <ul>
|
|
228
|
-
* <li>title - Used to style the title of the tree list item</li>
|
|
229
|
-
* <li>additionalText - Used to style the additionalText of the tree list item</li>
|
|
230
|
-
* <li>icon - Used to style the icon of the tree list item</li>
|
|
231
|
-
* </ul>
|
|
274
|
+
* A class to serve as a foundation
|
|
275
|
+
* for the <code>TreeItem</code> and <code>TreeItemCustom</code> classes.
|
|
232
276
|
*
|
|
277
|
+
* @abstract
|
|
233
278
|
* @constructor
|
|
234
279
|
* @author SAP SE
|
|
235
|
-
* @alias sap.ui.webcomponents.main.
|
|
280
|
+
* @alias sap.ui.webcomponents.main.TreeItemBase
|
|
236
281
|
* @extends sap.ui.webcomponents.main.ListItem
|
|
237
|
-
* @tagname ui5-li-tree
|
|
238
282
|
* @public
|
|
239
|
-
* @since 1.0.0-rc.8
|
|
240
283
|
*/
|
|
241
|
-
class
|
|
284
|
+
class TreeItemBase extends ListItem {
|
|
242
285
|
static get template() {
|
|
243
|
-
return
|
|
286
|
+
return TreeItemBaseTemplate;
|
|
244
287
|
}
|
|
245
288
|
|
|
246
289
|
static get styles() {
|
|
247
|
-
return [
|
|
290
|
+
return [...super.styles, treeItemCss];
|
|
248
291
|
}
|
|
249
292
|
|
|
250
293
|
static get metadata() {
|
|
@@ -253,13 +296,14 @@ class TreeListItem extends ListItem {
|
|
|
253
296
|
|
|
254
297
|
static get dependencies() {
|
|
255
298
|
return [
|
|
256
|
-
...
|
|
299
|
+
...super.dependencies,
|
|
257
300
|
Icon,
|
|
258
301
|
];
|
|
259
302
|
}
|
|
260
303
|
|
|
261
304
|
onBeforeRendering() {
|
|
262
305
|
this.actionable = false;
|
|
306
|
+
this.showToggleButton = this.requiresToggleButton;
|
|
263
307
|
}
|
|
264
308
|
|
|
265
309
|
get classes() {
|
|
@@ -276,6 +320,10 @@ class TreeListItem extends ListItem {
|
|
|
276
320
|
};
|
|
277
321
|
}
|
|
278
322
|
|
|
323
|
+
get requiresToggleButton() {
|
|
324
|
+
return !this._fixed ? (this.hasChildren || this.items.length > 0) : false;
|
|
325
|
+
}
|
|
326
|
+
|
|
279
327
|
get effectiveLevel() {
|
|
280
328
|
return this.level - 1;
|
|
281
329
|
}
|
|
@@ -284,6 +332,10 @@ class TreeListItem extends ListItem {
|
|
|
284
332
|
return this.level > 1;
|
|
285
333
|
}
|
|
286
334
|
|
|
335
|
+
get hasContent() {
|
|
336
|
+
return this.content.length > 0;
|
|
337
|
+
}
|
|
338
|
+
|
|
287
339
|
get _toggleIconName() {
|
|
288
340
|
return this.expanded ? "navigation-down-arrow" : "navigation-right-arrow";
|
|
289
341
|
}
|
|
@@ -296,24 +348,48 @@ class TreeListItem extends ListItem {
|
|
|
296
348
|
return this.showToggleButton && !this._minimal && this._toggleButtonEnd;
|
|
297
349
|
}
|
|
298
350
|
|
|
299
|
-
get _showTitle() {
|
|
300
|
-
return this.textContent.length && !this._minimal;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
351
|
get _ariaLabel() {
|
|
304
|
-
return
|
|
352
|
+
return this.accessibleRoleDescription ? undefined : TreeItemBase.i18nBundle.getText(TREE_ITEM_ARIA_LABEL);
|
|
305
353
|
}
|
|
306
354
|
|
|
307
355
|
get _accInfo() {
|
|
308
|
-
|
|
309
|
-
role: "treeitem",
|
|
310
|
-
ariaExpanded: this.showToggleButton ? this.expanded : undefined,
|
|
311
|
-
ariaLevel: this.level,
|
|
356
|
+
const accInfoSettings = {
|
|
357
|
+
role: this._minimal ? "menuitemradio" : "treeitem",
|
|
358
|
+
ariaExpanded: this.showToggleButton && !this._minimal ? this.expanded : undefined,
|
|
359
|
+
ariaLevel: this._minimal ? undefined : this.level,
|
|
312
360
|
posinset: this._posinset,
|
|
313
361
|
setsize: this._setsize,
|
|
314
362
|
ariaSelectedText: this.ariaSelectedText,
|
|
315
363
|
listItemAriaLabel: !this.accessibleName ? this._ariaLabel : undefined,
|
|
364
|
+
ariaOwns: this.expanded ? `${this._id}-subtree` : undefined,
|
|
365
|
+
ariaHaspopup: this.ariaHaspopup || undefined,
|
|
316
366
|
};
|
|
367
|
+
|
|
368
|
+
if (this._minimal) {
|
|
369
|
+
accInfoSettings.ariaChecked = this.selected;
|
|
370
|
+
} else {
|
|
371
|
+
accInfoSettings.ariaSelected = this.selected;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
return accInfoSettings;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Used to duck-type TreeItem elements without using instanceof
|
|
379
|
+
* @returns {boolean}
|
|
380
|
+
* @type { boolean }
|
|
381
|
+
* @public
|
|
382
|
+
*/
|
|
383
|
+
get isTreeItem() {
|
|
384
|
+
return true;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Call this method to manually switch the <code>expanded</code> state of a tree item.
|
|
389
|
+
* @public
|
|
390
|
+
*/
|
|
391
|
+
toggle() {
|
|
392
|
+
this.expanded = !this.expanded;
|
|
317
393
|
}
|
|
318
394
|
|
|
319
395
|
_toggleClick(event) {
|
|
@@ -324,7 +400,7 @@ class TreeListItem extends ListItem {
|
|
|
324
400
|
_onkeydown(event) {
|
|
325
401
|
super._onkeydown(event);
|
|
326
402
|
|
|
327
|
-
if (this.showToggleButton && isRight(event)) {
|
|
403
|
+
if (!this._fixed && this.showToggleButton && isRight(event)) {
|
|
328
404
|
if (!this.expanded) {
|
|
329
405
|
this.fireEvent("toggle", { item: this });
|
|
330
406
|
} else {
|
|
@@ -332,7 +408,7 @@ class TreeListItem extends ListItem {
|
|
|
332
408
|
}
|
|
333
409
|
}
|
|
334
410
|
|
|
335
|
-
if (isLeft(event)) {
|
|
411
|
+
if (!this._fixed && isLeft(event)) {
|
|
336
412
|
if (this.expanded) {
|
|
337
413
|
this.fireEvent("toggle", { item: this });
|
|
338
414
|
} else if (this.hasParent) {
|
|
@@ -342,17 +418,15 @@ class TreeListItem extends ListItem {
|
|
|
342
418
|
}
|
|
343
419
|
|
|
344
420
|
get iconAccessibleName() {
|
|
345
|
-
return this.expanded ?
|
|
421
|
+
return this.expanded ? TreeItemBase.i18nBundle.getText(TREE_ITEM_COLLAPSE_NODE) : TreeItemBase.i18nBundle.getText(TREE_ITEM_EXPAND_NODE);
|
|
346
422
|
}
|
|
347
423
|
|
|
348
424
|
static async onDefine() {
|
|
349
|
-
[
|
|
425
|
+
[TreeItemBase.i18nBundle] = await Promise.all([
|
|
350
426
|
getI18nBundle("@ui5/webcomponents"),
|
|
351
427
|
super.onDefine(),
|
|
352
428
|
]);
|
|
353
429
|
}
|
|
354
430
|
}
|
|
355
431
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
export default TreeListItem;
|
|
432
|
+
export default TreeItemBase;
|