@progress/kendo-angular-conversational-ui 19.3.0-develop.14 → 19.3.0-develop.16

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.
@@ -5,10 +5,10 @@
5
5
  import { Component, ContentChild, ContentChildren, EventEmitter, HostBinding, Input, NgZone, Output, QueryList } from "@angular/core";
6
6
  import { NgFor, NgIf, NgTemplateOutlet } from "@angular/common";
7
7
  import { Subscription } from "rxjs";
8
- import { sparklesIcon, commentIcon } from "@progress/kendo-svg-icons";
8
+ import { sparklesIcon, commentIcon, stopSmIcon } from "@progress/kendo-svg-icons";
9
9
  import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
10
10
  import { validatePackage } from "@progress/kendo-licensing";
11
- import { ButtonComponent } from "@progress/kendo-angular-buttons";
11
+ import { ButtonComponent, FloatingActionButtonComponent } from "@progress/kendo-angular-buttons";
12
12
  import { BaseView } from "./views/base-view";
13
13
  import { packageMetadata } from "../package-metadata";
14
14
  import { AIPromptService } from "./common/aiprompt.service";
@@ -16,6 +16,8 @@ import { AIPromptToolbarActionsDirective } from "./templates/toolbar-actions.tem
16
16
  import { ToolbarNavigationService } from "./common/toolbar-navigation.service";
17
17
  import { AIPromptToolbarFocusableDirective } from "./common/toolbar-focusable.directive";
18
18
  import { LocalizedMessagesDirective } from "./localization/localized-messages.directive";
19
+ import { AIPromptOutputTemplateDirective } from "./templates/aiprompt-output-template.directive";
20
+ import { AIPromptOutputBodyTemplateDirective } from "./templates/aiprompt-output-body-template.directive";
19
21
  import * as i0 from "@angular/core";
20
22
  import * as i1 from "@progress/kendo-angular-l10n";
21
23
  import * as i2 from "./common/aiprompt.service";
@@ -65,6 +67,14 @@ export class AIPromptComponent {
65
67
  * @hidden
66
68
  */
67
69
  toolbarActionsTemplate;
70
+ /**
71
+ * @hidden
72
+ */
73
+ outputTemplate;
74
+ /**
75
+ * @hidden
76
+ */
77
+ outputBodyTemplate;
68
78
  /**
69
79
  * The active view index of the AIPrompt component.
70
80
  */
@@ -78,54 +88,100 @@ export class AIPromptComponent {
78
88
  return this._activeView;
79
89
  }
80
90
  /**
81
- * Sets the collection of commands to render in the **Command** view.
91
+ * Sets the collection of commands to render in the Command view.
82
92
  */
83
93
  set promptCommands(value) {
84
94
  this.service.promptCommands = value;
85
95
  }
86
96
  /**
87
- * Sets the collection of suggestions to render in the **Prompt** view.
97
+ * Sets the collection of suggestions to render in the Prompt view.
88
98
  */
89
99
  set promptSuggestions(value) {
90
100
  this.service.promptSuggestions = value;
91
101
  }
92
102
  /**
93
- * Sets the collection of generated prompt outputs to render in the **Output** view.
103
+ * Sets the collection of generated prompt outputs to render in the Output view.
94
104
  */
95
105
  set promptOutputs(value) {
96
106
  this.service.promptOutputs = value;
97
107
  }
98
108
  /**
99
- * Specifies if the rating buttons appear in each **Output** view card.
100
- * By default, the rating buttons do not appear.
109
+ * Specifies whether the rating buttons appear in each Output view card.
110
+ * The rating buttons do not appear by default.
101
111
  * @default false
102
112
  */
103
113
  set showOutputRating(value) {
104
114
  this.service.showOutputRating = value;
105
115
  }
116
+ /**
117
+ * Specifies whether the Stop generation button appears in the Output view.
118
+ * The Stop generation button does not appear by default.
119
+ * @default false
120
+ */
121
+ streaming = false;
122
+ /**
123
+ * Sets the settings for the Speech to Text button in the Prompt view.
124
+ */
125
+ set speechToTextButton(settings) {
126
+ if (settings) {
127
+ this.service.speechToTextButton = settings;
128
+ }
129
+ else {
130
+ this.service.speechToTextButton = false;
131
+ }
132
+ }
133
+ /**
134
+ * Sets the settings for the TextArea in the Prompt view.
135
+ * Use this property to customize the TextArea appearance.
136
+ */
137
+ set textAreaSettings(settings) {
138
+ this.service.textAreaSettings = settings;
139
+ }
140
+ /**
141
+ * Sets the SVG icon for the Generate button in the Prompt view.
142
+ */
143
+ generateButtonSVGIcon = sparklesIcon;
144
+ /**
145
+ * Sets the icon for the Generate button in the Prompt view.
146
+ * @default 'sparkles'
147
+ */
148
+ generateButtonIcon = 'sparkles';
149
+ /**
150
+ * Sets the disabled state for the Generate button in the Prompt view.
151
+ * @default false
152
+ */
153
+ disabledGenerateButton = false;
106
154
  /**
107
155
  * Fires when the `activeView` property is updated.
108
156
  * Use this event for two-way binding of the `activeView` property.
109
157
  */
110
158
  activeViewChange = new EventEmitter();
111
159
  /**
112
- * Fires when the user clicks the **Generate** button in the **Prompt** view or the **Retry** button in the **Output** view.
160
+ * Fires when you click the Generate button in the Prompt view or the Retry button in the Output view.
113
161
  * Use the event's `isRetry` field to determine the source element.
114
162
  */
115
163
  promptRequest = new EventEmitter();
116
164
  /**
117
- * Fires when the user clicks a **Command** view command.
165
+ * Fires when you click a Command view command.
118
166
  * The event data contains the selected command.
119
167
  */
120
168
  commandExecute = new EventEmitter();
121
169
  /**
122
- * Fires when the user clicks a **Copy** button in any **Output** view card.
170
+ * Fires when you click a Copy button in any Output view card.
123
171
  */
124
172
  outputCopy = new EventEmitter();
125
173
  /**
126
- * Fires when the user clicks a rating button in any **Output** view card.
174
+ * Fires when you click a rating button in any Output view card.
127
175
  */
128
176
  outputRatingChange = new EventEmitter();
177
+ /**
178
+ * Fires when you click the Stop Generation button in the Output view.
179
+ */
180
+ promptRequestCancel = new EventEmitter();
181
+ ngAfterContentInit() {
182
+ this.service.outputTemplate = this.outputTemplate;
183
+ this.service.outputBodyTemplate = this.outputBodyTemplate;
184
+ }
129
185
  ngAfterViewInit() {
130
186
  this.ngZone.runOutsideAngular(() => {
131
187
  this.service.aiPrompt = this;
@@ -159,12 +215,24 @@ export class AIPromptComponent {
159
215
  * @hidden
160
216
  */
161
217
  outputIcon = commentIcon;
218
+ /**
219
+ * @hidden
220
+ */
221
+ fabStopGenerationSVGIcon = stopSmIcon;
162
222
  /**
163
223
  * @hidden
164
224
  */
165
225
  get viewsArray() {
166
226
  return this.views?.toArray();
167
227
  }
228
+ /**
229
+ * @hidden
230
+ */
231
+ fabPositionMode = 'absolute';
232
+ /**
233
+ * @hidden
234
+ */
235
+ fabAlignment = { vertical: 'bottom', horizontal: 'end' };
168
236
  direction;
169
237
  _activeView = 0;
170
238
  /**
@@ -201,7 +269,7 @@ export class AIPromptComponent {
201
269
  this.promptRequest.emit(eventArgs);
202
270
  }
203
271
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptComponent, deps: [{ token: i1.LocalizationService }, { token: i2.AIPromptService }, { token: i3.ToolbarNavigationService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
204
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AIPromptComponent, isStandalone: true, selector: "kendo-aiprompt", inputs: { activeView: "activeView", promptCommands: "promptCommands", promptSuggestions: "promptSuggestions", promptOutputs: "promptOutputs", showOutputRating: "showOutputRating" }, outputs: { activeViewChange: "activeViewChange", promptRequest: "promptRequest", commandExecute: "commandExecute", outputCopy: "outputCopy", outputRatingChange: "outputRatingChange" }, host: { properties: { "class.k-prompt": "this.hostClasses", "attr.dir": "this.dirAttr" } }, providers: [
272
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AIPromptComponent, isStandalone: true, selector: "kendo-aiprompt", inputs: { activeView: "activeView", promptCommands: "promptCommands", promptSuggestions: "promptSuggestions", promptOutputs: "promptOutputs", showOutputRating: "showOutputRating", streaming: "streaming", speechToTextButton: "speechToTextButton", textAreaSettings: "textAreaSettings", generateButtonSVGIcon: "generateButtonSVGIcon", generateButtonIcon: "generateButtonIcon", disabledGenerateButton: "disabledGenerateButton" }, outputs: { activeViewChange: "activeViewChange", promptRequest: "promptRequest", commandExecute: "commandExecute", outputCopy: "outputCopy", outputRatingChange: "outputRatingChange", promptRequestCancel: "promptRequestCancel" }, host: { properties: { "class.k-prompt": "this.hostClasses", "attr.dir": "this.dirAttr" } }, providers: [
205
273
  LocalizationService,
206
274
  AIPromptService,
207
275
  ToolbarNavigationService,
@@ -209,7 +277,7 @@ export class AIPromptComponent {
209
277
  provide: L10N_PREFIX,
210
278
  useValue: 'kendo.aiprompt'
211
279
  }
212
- ], queries: [{ propertyName: "toolbarActionsTemplate", first: true, predicate: AIPromptToolbarActionsDirective, descendants: true }, { propertyName: "views", predicate: BaseView }], exportAs: ["kendoAIPrompt"], ngImport: i0, template: `
280
+ ], queries: [{ propertyName: "toolbarActionsTemplate", first: true, predicate: AIPromptToolbarActionsDirective, descendants: true }, { propertyName: "outputTemplate", first: true, predicate: AIPromptOutputTemplateDirective, descendants: true }, { propertyName: "outputBodyTemplate", first: true, predicate: AIPromptOutputBodyTemplateDirective, descendants: true }, { propertyName: "views", predicate: BaseView }], exportAs: ["kendoAIPrompt"], ngImport: i0, template: `
213
281
  <ng-container kendoAIPromptLocalizedMessages
214
282
  i18n-promptView="kendo.aiprompt.promptView|The Toolbar button text for the Prompt view."
215
283
  promptView="Ask AI"
@@ -253,6 +321,16 @@ export class AIPromptComponent {
253
321
  </div>
254
322
  </div>
255
323
  <div class="k-prompt-content">
324
+ <kendo-floatingactionbutton *ngIf="streaming && selectedView?.viewType === 'output'"
325
+ class="k-prompt-stop-fab"
326
+ buttonClass="k-generating k-active"
327
+ [positionMode]="fabPositionMode"
328
+ [align]="fabAlignment"
329
+ [svgIcon]="fabStopGenerationSVGIcon"
330
+ icon="stop"
331
+ (click)="promptRequestCancel.emit()"
332
+ >
333
+ </kendo-floatingactionbutton>
256
334
  <div class="k-prompt-view">
257
335
  <ng-container *ngTemplateOutlet="viewTemplate">
258
336
  </ng-container>
@@ -265,12 +343,14 @@ export class AIPromptComponent {
265
343
  type="button"
266
344
  themeColor="primary"
267
345
  rounded="full"
268
- [svgIcon]="sparklesIcon"
269
- icon="sparkles"
346
+ [attr.title]="messageFor('generateOutput')"
347
+ [svgIcon]="generateButtonSVGIcon"
348
+ [icon]="generateButtonIcon"
349
+ [disabled]="disabledGenerateButton"
270
350
  (click)="handleGenerateOutput()">{{messageFor('generateOutput')}}</button>
271
351
  </div>
272
352
  </div>
273
- `, isInline: true, dependencies: [{ kind: "directive", type: LocalizedMessagesDirective, selector: "[kendoAIPromptLocalizedMessages]" }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: AIPromptToolbarFocusableDirective, selector: "[kendoAIPromptToolbarFocusable]" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
353
+ `, isInline: true, dependencies: [{ kind: "directive", type: LocalizedMessagesDirective, selector: "[kendoAIPromptLocalizedMessages]" }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: AIPromptToolbarFocusableDirective, selector: "[kendoAIPromptToolbarFocusable]" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: FloatingActionButtonComponent, selector: "kendo-floatingactionbutton", inputs: ["themeColor", "size", "rounded", "disabled", "align", "offset", "positionMode", "icon", "svgIcon", "iconClass", "buttonClass", "dialClass", "text", "dialItemAnimation", "tabIndex", "dialItems"], outputs: ["blur", "focus", "dialItemClick", "open", "close"] }] });
274
354
  }
275
355
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptComponent, decorators: [{
276
356
  type: Component,
@@ -330,6 +410,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
330
410
  </div>
331
411
  </div>
332
412
  <div class="k-prompt-content">
413
+ <kendo-floatingactionbutton *ngIf="streaming && selectedView?.viewType === 'output'"
414
+ class="k-prompt-stop-fab"
415
+ buttonClass="k-generating k-active"
416
+ [positionMode]="fabPositionMode"
417
+ [align]="fabAlignment"
418
+ [svgIcon]="fabStopGenerationSVGIcon"
419
+ icon="stop"
420
+ (click)="promptRequestCancel.emit()"
421
+ >
422
+ </kendo-floatingactionbutton>
333
423
  <div class="k-prompt-view">
334
424
  <ng-container *ngTemplateOutlet="viewTemplate">
335
425
  </ng-container>
@@ -342,14 +432,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
342
432
  type="button"
343
433
  themeColor="primary"
344
434
  rounded="full"
345
- [svgIcon]="sparklesIcon"
346
- icon="sparkles"
435
+ [attr.title]="messageFor('generateOutput')"
436
+ [svgIcon]="generateButtonSVGIcon"
437
+ [icon]="generateButtonIcon"
438
+ [disabled]="disabledGenerateButton"
347
439
  (click)="handleGenerateOutput()">{{messageFor('generateOutput')}}</button>
348
440
  </div>
349
441
  </div>
350
442
  `,
351
443
  standalone: true,
352
- imports: [LocalizedMessagesDirective, NgFor, ButtonComponent, AIPromptToolbarFocusableDirective, NgIf, NgTemplateOutlet]
444
+ imports: [LocalizedMessagesDirective, NgFor, ButtonComponent, AIPromptToolbarFocusableDirective, NgIf, NgTemplateOutlet, FloatingActionButtonComponent]
353
445
  }]
354
446
  }], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i2.AIPromptService }, { type: i3.ToolbarNavigationService }, { type: i0.NgZone }]; }, propDecorators: { hostClasses: [{
355
447
  type: HostBinding,
@@ -363,6 +455,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
363
455
  }], toolbarActionsTemplate: [{
364
456
  type: ContentChild,
365
457
  args: [AIPromptToolbarActionsDirective]
458
+ }], outputTemplate: [{
459
+ type: ContentChild,
460
+ args: [AIPromptOutputTemplateDirective]
461
+ }], outputBodyTemplate: [{
462
+ type: ContentChild,
463
+ args: [AIPromptOutputBodyTemplateDirective]
366
464
  }], activeView: [{
367
465
  type: Input
368
466
  }], promptCommands: [{
@@ -373,6 +471,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
373
471
  type: Input
374
472
  }], showOutputRating: [{
375
473
  type: Input
474
+ }], streaming: [{
475
+ type: Input
476
+ }], speechToTextButton: [{
477
+ type: Input
478
+ }], textAreaSettings: [{
479
+ type: Input
480
+ }], generateButtonSVGIcon: [{
481
+ type: Input
482
+ }], generateButtonIcon: [{
483
+ type: Input
484
+ }], disabledGenerateButton: [{
485
+ type: Input
376
486
  }], activeViewChange: [{
377
487
  type: Output
378
488
  }], promptRequest: [{
@@ -383,4 +493,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
383
493
  type: Output
384
494
  }], outputRatingChange: [{
385
495
  type: Output
496
+ }], promptRequestCancel: [{
497
+ type: Output
386
498
  }] } });
@@ -17,6 +17,8 @@ import * as i5 from "./views/custom-view.component";
17
17
  import * as i6 from "./localization/custom-messages.component";
18
18
  import * as i7 from "./templates/toolbar-actions.template";
19
19
  import * as i8 from "./common/toolbar-focusable.directive";
20
+ import * as i9 from "./templates/aiprompt-output-template.directive";
21
+ import * as i10 from "./templates/aiprompt-output-body-template.directive";
20
22
  // IMPORTANT: NgModule export kept for backwards compatibility
21
23
  /**
22
24
  * Represents the [`NgModule`](link:site.data.urls.angular['ngmodules']) for the AIPrompt component.
@@ -38,7 +40,7 @@ import * as i8 from "./common/toolbar-focusable.directive";
38
40
  */
39
41
  export class AIPromptModule {
40
42
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
41
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: AIPromptModule, imports: [i1.AIPromptComponent, i2.PromptViewComponent, i3.OutputViewComponent, i4.CommandViewComponent, i5.CustomViewComponent, i6.AIPromptCustomMessagesComponent, i7.AIPromptToolbarActionsDirective, i8.AIPromptToolbarFocusableDirective], exports: [i1.AIPromptComponent, i2.PromptViewComponent, i3.OutputViewComponent, i4.CommandViewComponent, i5.CustomViewComponent, i6.AIPromptCustomMessagesComponent, i7.AIPromptToolbarActionsDirective, i8.AIPromptToolbarFocusableDirective] });
43
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: AIPromptModule, imports: [i1.AIPromptComponent, i2.PromptViewComponent, i3.OutputViewComponent, i4.CommandViewComponent, i5.CustomViewComponent, i6.AIPromptCustomMessagesComponent, i7.AIPromptToolbarActionsDirective, i8.AIPromptToolbarFocusableDirective, i9.AIPromptOutputTemplateDirective, i10.AIPromptOutputBodyTemplateDirective], exports: [i1.AIPromptComponent, i2.PromptViewComponent, i3.OutputViewComponent, i4.CommandViewComponent, i5.CustomViewComponent, i6.AIPromptCustomMessagesComponent, i7.AIPromptToolbarActionsDirective, i8.AIPromptToolbarFocusableDirective, i9.AIPromptOutputTemplateDirective, i10.AIPromptOutputBodyTemplateDirective] });
42
44
  static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptModule, providers: [IconsService, PopupService, ResizeBatchService, DialogContainerService, DialogService, WindowService, WindowContainerService], imports: [i1.AIPromptComponent, i2.PromptViewComponent, i3.OutputViewComponent, i4.CommandViewComponent] });
43
45
  }
44
46
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptModule, decorators: [{
@@ -5,6 +5,23 @@
5
5
  import { Injectable } from '@angular/core';
6
6
  import { Subject } from 'rxjs';
7
7
  import * as i0 from "@angular/core";
8
+ /**
9
+ * @hidden
10
+ * Default settings for the Speech to Text button.
11
+ * These settings can be overridden by the user.
12
+ */
13
+ const STB_DEFAULT_SETTINGS = {
14
+ continuous: false,
15
+ disabled: false,
16
+ fillMode: 'flat',
17
+ integrationMode: 'webSpeech',
18
+ interimResults: false,
19
+ lang: 'en-US',
20
+ maxAlternatives: 1,
21
+ rounded: 'medium',
22
+ size: 'medium',
23
+ themeColor: 'base'
24
+ };
8
25
  /**
9
26
  * @hidden
10
27
  */
@@ -19,6 +36,24 @@ export class AIPromptService {
19
36
  promptCommands;
20
37
  promptOutputs;
21
38
  promptSuggestions;
39
+ textAreaSettings;
40
+ outputTemplate;
41
+ outputBodyTemplate;
42
+ _speechToTextButton;
43
+ get speechToTextButton() {
44
+ return this._speechToTextButton;
45
+ }
46
+ set speechToTextButton(settings) {
47
+ if (settings === true) {
48
+ this._speechToTextButton = STB_DEFAULT_SETTINGS;
49
+ }
50
+ else if (settings === false) {
51
+ this._speechToTextButton = null;
52
+ }
53
+ else {
54
+ this._speechToTextButton = { ...settings };
55
+ }
56
+ }
22
57
  getFlattenPromptCommands(commands = this.promptCommands) {
23
58
  let newArr = [];
24
59
  commands.forEach(c => {
@@ -3,7 +3,7 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { Component, HostBinding, Input } from '@angular/core';
6
- import { NgIf } from '@angular/common';
6
+ import { NgIf, NgTemplateOutlet } from '@angular/common';
7
7
  import { LocalizationService } from '@progress/kendo-angular-l10n';
8
8
  import { guid, isPresent } from '@progress/kendo-angular-common';
9
9
  import { ButtonComponent } from "@progress/kendo-angular-buttons";
@@ -97,6 +97,12 @@ export class AIPromptOutputCardComponent {
97
97
  this.positiveRatingIcon = thumbUpOutlineIcon;
98
98
  }
99
99
  }
100
+ /**
101
+ * @hidden
102
+ */
103
+ get customBodyTemplate() {
104
+ return this.service.outputBodyTemplate?.templateRef;
105
+ }
100
106
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptOutputCardComponent, deps: [{ token: i1.LocalizationService }, { token: i2.AIPromptService }], target: i0.ɵɵFactoryTarget.Component });
101
107
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AIPromptOutputCardComponent, isStandalone: true, selector: "[kendoAIPromptOutputCard]", inputs: { promptOutput: "promptOutput" }, host: { properties: { "class.k-card": "this.hostClass", "attr.role": "this.listItemRole", "attr.tabindex": "this.tabIndex", "attr.aria-describedby": "this.ariaDescribedBy", "attr.aria-keyshortcuts": "this.ariaKeyShortcuts" } }, ngImport: i0, template: `
102
108
  <div class="k-card-header">
@@ -107,7 +113,13 @@ export class AIPromptOutputCardComponent {
107
113
  <div class="k-card-subtitle">{{promptOutput.prompt}}</div>
108
114
  </div>
109
115
  <div class="k-card-body">
110
- <p>{{promptOutput.output}}</p>
116
+ <ng-container *ngIf="customBodyTemplate; else defaultTemplate">
117
+ <ng-container *ngTemplateOutlet="customBodyTemplate; context: { $implicit: promptOutput }">
118
+ </ng-container>
119
+ </ng-container>
120
+ <ng-template #defaultTemplate>
121
+ <p>{{promptOutput.output}}</p>
122
+ </ng-template>
111
123
  </div>
112
124
  <div class="k-actions k-actions-start k-actions-horizontal k-card-actions">
113
125
  <button kendoButton
@@ -141,7 +153,7 @@ export class AIPromptOutputCardComponent {
141
153
  </button>
142
154
  </ng-container>
143
155
  </div>
144
- `, isInline: true, dependencies: [{ kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
156
+ `, isInline: true, dependencies: [{ kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
145
157
  }
146
158
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptOutputCardComponent, decorators: [{
147
159
  type: Component,
@@ -156,7 +168,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
156
168
  <div class="k-card-subtitle">{{promptOutput.prompt}}</div>
157
169
  </div>
158
170
  <div class="k-card-body">
159
- <p>{{promptOutput.output}}</p>
171
+ <ng-container *ngIf="customBodyTemplate; else defaultTemplate">
172
+ <ng-container *ngTemplateOutlet="customBodyTemplate; context: { $implicit: promptOutput }">
173
+ </ng-container>
174
+ </ng-container>
175
+ <ng-template #defaultTemplate>
176
+ <p>{{promptOutput.output}}</p>
177
+ </ng-template>
160
178
  </div>
161
179
  <div class="k-actions k-actions-start k-actions-horizontal k-card-actions">
162
180
  <button kendoButton
@@ -192,7 +210,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
192
210
  </div>
193
211
  `,
194
212
  standalone: true,
195
- imports: [ButtonComponent, NgIf]
213
+ imports: [ButtonComponent, NgIf, NgTemplateOutlet]
196
214
  }]
197
215
  }], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i2.AIPromptService }]; }, propDecorators: { hostClass: [{
198
216
  type: HostBinding,
@@ -0,0 +1,33 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Directive, TemplateRef } from '@angular/core';
6
+ import * as i0 from "@angular/core";
7
+ /**
8
+ * Represents the template for the body of the response in the AIPrompt component. The template context is set to the current output object.
9
+ *
10
+ * @example
11
+ * ```html
12
+ * <kendo-aiprompt>
13
+ * <ng-template kendoAIPromptOutputBodyTemplate let-output>
14
+ * <div>{{output.prompt}}</div>
15
+ * </ng-template>
16
+ * </kendo-aiprompt>
17
+ * ```
18
+ */
19
+ export class AIPromptOutputBodyTemplateDirective {
20
+ templateRef;
21
+ constructor(templateRef) {
22
+ this.templateRef = templateRef;
23
+ }
24
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptOutputBodyTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
25
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: AIPromptOutputBodyTemplateDirective, isStandalone: true, selector: "[kendoAIPromptOutputBodyTemplate]", ngImport: i0 });
26
+ }
27
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptOutputBodyTemplateDirective, decorators: [{
28
+ type: Directive,
29
+ args: [{
30
+ selector: '[kendoAIPromptOutputBodyTemplate]',
31
+ standalone: true
32
+ }]
33
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
@@ -0,0 +1,33 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Directive, TemplateRef } from '@angular/core';
6
+ import * as i0 from "@angular/core";
7
+ /**
8
+ * Represents the template for the response in the AIPrompt component. The template context is set to the current output object.
9
+ *
10
+ * @example
11
+ * ```html
12
+ * <kendo-aiprompt>
13
+ * <ng-template kendoAIPromptOutputTemplate let-output>
14
+ * <div>{{output.prompt}}</div>
15
+ * </ng-template>
16
+ * </kendo-aiprompt>
17
+ * ```
18
+ */
19
+ export class AIPromptOutputTemplateDirective {
20
+ templateRef;
21
+ constructor(templateRef) {
22
+ this.templateRef = templateRef;
23
+ }
24
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptOutputTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
25
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: AIPromptOutputTemplateDirective, isStandalone: true, selector: "[kendoAIPromptOutputTemplate]", ngImport: i0 });
26
+ }
27
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptOutputTemplateDirective, decorators: [{
28
+ type: Directive,
29
+ args: [{
30
+ selector: '[kendoAIPromptOutputTemplate]',
31
+ standalone: true
32
+ }]
33
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
@@ -7,7 +7,7 @@ import { LocalizationService } from '@progress/kendo-angular-l10n';
7
7
  import { BaseView } from './base-view';
8
8
  import { AIPromptService } from '../common/aiprompt.service';
9
9
  import { AIPromptOutputCardComponent } from '../common/output-card.component';
10
- import { NgFor } from '@angular/common';
10
+ import { NgFor, NgIf, NgTemplateOutlet } from '@angular/common';
11
11
  import * as i0 from "@angular/core";
12
12
  import * as i1 from "@progress/kendo-angular-l10n";
13
13
  import * as i2 from "../common/aiprompt.service";
@@ -33,6 +33,12 @@ export class OutputViewComponent extends BaseView {
33
33
  get promptOutputs() {
34
34
  return this.service.promptOutputs;
35
35
  }
36
+ /**
37
+ * @hidden
38
+ */
39
+ get customTemplate() {
40
+ return this.service.outputTemplate?.templateRef;
41
+ }
36
42
  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 });
37
43
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: OutputViewComponent, isStandalone: true, selector: "kendo-aiprompt-output-view", providers: [{
38
44
  provide: BaseView,
@@ -42,13 +48,18 @@ export class OutputViewComponent extends BaseView {
42
48
  <div
43
49
  class="k-card-list"
44
50
  role="list">
45
- <div *ngFor="let output of promptOutputs"
46
- kendoAIPromptOutputCard
47
- [promptOutput]="output">
48
- </div>
51
+ <ng-container *ngFor="let output of promptOutputs">
52
+ <ng-container *ngIf="customTemplate; else defaultTemplate">
53
+ <ng-container *ngTemplateOutlet="customTemplate; context: { $implicit: output }">
54
+ </ng-container>
55
+ </ng-container>
56
+ <ng-template #defaultTemplate>
57
+ <div kendoAIPromptOutputCard [promptOutput]="output"></div>
58
+ </ng-template>
59
+ </ng-container>
49
60
  </div>
50
61
  </ng-template>
51
- `, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: AIPromptOutputCardComponent, selector: "[kendoAIPromptOutputCard]", inputs: ["promptOutput"] }] });
62
+ `, 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"] }] });
52
63
  }
53
64
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OutputViewComponent, decorators: [{
54
65
  type: Component,
@@ -63,14 +74,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
63
74
  <div
64
75
  class="k-card-list"
65
76
  role="list">
66
- <div *ngFor="let output of promptOutputs"
67
- kendoAIPromptOutputCard
68
- [promptOutput]="output">
69
- </div>
77
+ <ng-container *ngFor="let output of promptOutputs">
78
+ <ng-container *ngIf="customTemplate; else defaultTemplate">
79
+ <ng-container *ngTemplateOutlet="customTemplate; context: { $implicit: output }">
80
+ </ng-container>
81
+ </ng-container>
82
+ <ng-template #defaultTemplate>
83
+ <div kendoAIPromptOutputCard [promptOutput]="output"></div>
84
+ </ng-template>
85
+ </ng-container>
70
86
  </div>
71
87
  </ng-template>
72
88
  `,
73
89
  standalone: true,
74
- imports: [NgFor, AIPromptOutputCardComponent]
90
+ imports: [NgFor, AIPromptOutputCardComponent, NgIf, NgTemplateOutlet]
75
91
  }]
76
92
  }], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i2.AIPromptService }]; } });