|
1 | 1 | import Bootstrap from "@ui5/webcomponents-base/src/Bootstrap.js";
|
2 | 2 | import litRender from "@ui5/webcomponents-base/src/renderer/LitRenderer.js";
|
| 3 | +import ValueState from "@ui5/webcomponents-base/src/types/ValueState.js"; |
3 | 4 | import ListItem from "./ListItem.js";
|
4 | 5 | import Icon from "./Icon.js";
|
5 | 6 | import StandardListItemTemplate from "./build/compiled/StandardListItemTemplate.lit.js";
|
6 | 7 |
|
7 |
| -// Styles |
8 |
| - |
9 | 8 | // all themes should work via the convenience import (inlined now, switch to json when elements can be imported individyally)
|
10 | 9 | import "./ThemePropertiesProvider.js";
|
11 | 10 |
|
@@ -65,6 +64,29 @@ const metadata = {
|
65 | 64 | image: {
|
66 | 65 | type: String,
|
67 | 66 | },
|
| 67 | + |
| 68 | + /** |
| 69 | + * Defines the <code>info</code>, displayed in the end of the list item. |
| 70 | + * @type {string} |
| 71 | + * @public |
| 72 | + * @since 0.13.0 |
| 73 | + */ |
| 74 | + info: { |
| 75 | + type: String, |
| 76 | + }, |
| 77 | + |
| 78 | + /** |
| 79 | + * Defines the state of the <code>info</code>. |
| 80 | + * <br> |
| 81 | + * Available options are: <code>"None"</code< (by default), <code>"Success"</code>, <code>"Warning"</code> and <code>"Erorr"</code>. |
| 82 | + * @type {string} |
| 83 | + * @public |
| 84 | + * @since 0.13.0 |
| 85 | + */ |
| 86 | + infoState: { |
| 87 | + type: ValueState, |
| 88 | + defaultValue: ValueState.None, |
| 89 | + }, |
68 | 90 | },
|
69 | 91 | slots: /** @lends sap.ui.webcomponents.main.StandardListItem.prototype */ {
|
70 | 92 | /**
|
@@ -131,10 +153,17 @@ class StandardListItem extends ListItem {
|
131 | 153 | const result = super.classes;
|
132 | 154 | const hasDesc = this.description && !!this.description.length;
|
133 | 155 | const hasTitle = this.textContent;
|
| 156 | + const infoState = this.infoState.toLowerCase(); |
134 | 157 |
|
135 | 158 | // Modify main classes
|
136 | 159 | result.main.sapMSLIWithTitleAndDescription = hasDesc && hasTitle;
|
137 | 160 |
|
| 161 | + // Add "info" classes |
| 162 | + result.info = { |
| 163 | + "sapMSLI-info": true, |
| 164 | + [`sapMSLI-info--${infoState}`]: true, |
| 165 | + }; |
| 166 | + |
138 | 167 | return result;
|
139 | 168 | }
|
140 | 169 |
|
|
0 commit comments