import Icon from "./Icon.js"; import type ListItemStandard from "./ListItemStandard.js"; import ListItemTemplate from "./ListItemTemplate.js"; import type { ListItemHooks } from "./ListItemTemplate.js"; import WrappingType from "./types/WrappingType.js"; const predefinedHooks: Partial = { imageBegin, iconBegin, iconEnd, listItemContent }; export default function ListItemStandardTemplate(this: ListItemStandard, hooks?: Partial) { const currentHooks = { ...predefinedHooks, ...hooks }; return ListItemTemplate.call(this, currentHooks); } function listItemContent(this: ListItemStandard) { return <>
{renderTitle.call(this)} {renderDescription.call(this)} {!this.typeActive && {this.type}}
{!this.description && renderAdditionalText.call(this)} ; } function renderTitle(this: ListItemStandard) { if (this.wrappingType === WrappingType.Normal) { return this.expandableTextTemplate?.call(this, { className: "ui5-li-title", text: this._textContent, maxCharacters: this._maxCharacters, part: "title", }); } return ( {this.text ? this.text : } ); } function renderDescription(this: ListItemStandard) { if (!this.description) { return null; } if (this.wrappingType === WrappingType.Normal) { return (
{this.expandableTextTemplate?.call(this, { className: "ui5-li-desc", text: this.description, maxCharacters: this._maxCharacters, part: "description", })} {renderAdditionalText.call(this)}
); } return (
{this.description} {renderAdditionalText.call(this)}
); } function renderAdditionalText(this: ListItemStandard) { if (!this.additionalText) { return null; } return {this.additionalText}; } function imageBegin(this: ListItemStandard) { if (this.hasImage) { return
; } } function iconBegin(this: ListItemStandard) { if (this.displayIconBegin) { return ; } } function iconEnd(this: ListItemStandard) { if (this.displayIconEnd) { return ; } }