UNPKG

@progress/kendo-angular-conversational-ui

Version:

Kendo UI for Angular Conversational UI components

87 lines (86 loc) 4.26 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ /* eslint-disable @typescript-eslint/no-empty-function */ import { Component, forwardRef, Input, HostBinding } from '@angular/core'; import { ChatItem } from './chat-item'; import { ChatFileComponent } from './chat-file.component'; import { ChatService } from './common/chat.service'; import { LocalizationService } from '@progress/kendo-angular-l10n'; import { isAuthor } from './chat-view'; import * as i0 from "@angular/core"; import * as i1 from "@progress/kendo-angular-l10n"; import * as i2 from "./common/chat.service"; /** * @hidden */ export class MessageReferenceComponent extends ChatItem { localization; chatService; hostClass = true; message; constructor(localization, chatService) { super(); this.localization = localization; this.chatService = chatService; } isOwnMessage(msg) { return isAuthor(this.chatService.authorId, msg); } textFor(key) { return this.localization.get(key); } focus() { } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: MessageReferenceComponent, deps: [{ token: i1.LocalizationService }, { token: i2.ChatService }], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: MessageReferenceComponent, isStandalone: true, selector: "chat-message-reference-content", inputs: { message: "message" }, host: { properties: { "class.k-message-reference-content": "this.hostClass" } }, providers: [{ provide: ChatItem, useExisting: forwardRef(() => MessageReferenceComponent) }], usesInheritance: true, ngImport: i0, template: ` @if (message.text && !message.isDeleted) { {{message.text}} } @if (!message.text && !message.isDeleted && message.files && message.files.length > 0) { <li class="k-chat-file" [chatFile]="message.files[0]"> </li> } @if (message.isDeleted && isOwnMessage(message)) { {{ textFor('deletedMessageSenderText') }} } @if (message.isDeleted && !isOwnMessage(message)) { {{ textFor('deletedMessageReceiverText') }} } `, isInline: true, dependencies: [{ kind: "component", type: ChatFileComponent, selector: "li[chatFile]", inputs: ["chatFile", "removable", "fileActions"], outputs: ["remove", "actionClick", "actionsToggle", "actionButtonClick"] }] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: MessageReferenceComponent, decorators: [{ type: Component, args: [{ selector: 'chat-message-reference-content', providers: [{ provide: ChatItem, useExisting: forwardRef(() => MessageReferenceComponent) }], template: ` @if (message.text && !message.isDeleted) { {{message.text}} } @if (!message.text && !message.isDeleted && message.files && message.files.length > 0) { <li class="k-chat-file" [chatFile]="message.files[0]"> </li> } @if (message.isDeleted && isOwnMessage(message)) { {{ textFor('deletedMessageSenderText') }} } @if (message.isDeleted && !isOwnMessage(message)) { {{ textFor('deletedMessageReceiverText') }} } `, standalone: true, imports: [ChatFileComponent] }] }], ctorParameters: () => [{ type: i1.LocalizationService }, { type: i2.ChatService }], propDecorators: { hostClass: [{ type: HostBinding, args: ['class.k-message-reference-content'] }], message: [{ type: Input }] } });