UNPKG

@progress/kendo-angular-conversational-ui

Version:

Kendo UI for Angular Conversational UI components

93 lines (92 loc) 4.75 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { Component, forwardRef } from '@angular/core'; import { LocalizationService } from '@progress/kendo-angular-l10n'; import { BaseView } from './base-view'; import { AIPromptService } from '../common/aiprompt.service'; import { AIPromptOutputCardComponent } from '../common/output-card.component'; import { NgFor, NgIf, NgTemplateOutlet } from '@angular/common'; import * as i0 from "@angular/core"; import * as i1 from "@progress/kendo-angular-l10n"; import * as i2 from "../common/aiprompt.service"; /** * Represents the component that renders the **Output** view of the AIPrompt. * * @example * ```html * <kendo-aiprompt-output-view * buttonText="My output view"> * </kendo-aiprompt-output-view> * ``` */ export class OutputViewComponent extends BaseView { service; constructor(localization, service) { super('output', localization); this.service = service; } /** * @hidden */ get promptOutputs() { return this.service.promptOutputs; } /** * @hidden */ get customTemplate() { return this.service.outputTemplate?.templateRef; } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OutputViewComponent, deps: [{ token: i1.LocalizationService }, { token: i2.AIPromptService }], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: OutputViewComponent, isStandalone: true, selector: "kendo-aiprompt-output-view", providers: [{ provide: BaseView, useExisting: forwardRef(() => OutputViewComponent) }], usesInheritance: true, ngImport: i0, template: ` <ng-template #content> <div class="k-card-list" role="list"> <ng-container *ngFor="let output of promptOutputs"> <ng-container *ngIf="customTemplate; else defaultTemplate"> <ng-container *ngTemplateOutlet="customTemplate; context: { $implicit: output }"> </ng-container> </ng-container> <ng-template #defaultTemplate> <div kendoAIPromptOutputCard [promptOutput]="output"></div> </ng-template> </ng-container> </div> </ng-template> `, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: AIPromptOutputCardComponent, selector: "[kendoAIPromptOutputCard]", inputs: ["promptOutput"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OutputViewComponent, decorators: [{ type: Component, args: [{ selector: 'kendo-aiprompt-output-view', providers: [{ provide: BaseView, useExisting: forwardRef(() => OutputViewComponent) }], template: ` <ng-template #content> <div class="k-card-list" role="list"> <ng-container *ngFor="let output of promptOutputs"> <ng-container *ngIf="customTemplate; else defaultTemplate"> <ng-container *ngTemplateOutlet="customTemplate; context: { $implicit: output }"> </ng-container> </ng-container> <ng-template #defaultTemplate> <div kendoAIPromptOutputCard [promptOutput]="output"></div> </ng-template> </ng-container> </div> </ng-template> `, standalone: true, imports: [NgFor, AIPromptOutputCardComponent, NgIf, NgTemplateOutlet] }] }], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i2.AIPromptService }]; } });