@progress/kendo-angular-conversational-ui 21.1.1-develop.2 → 21.2.0-develop.10

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.
Files changed (27) hide show
  1. package/chat/chat.component.d.ts +2 -0
  2. package/chat/message-list.component.d.ts +2 -2
  3. package/codemods/utils.js +805 -394
  4. package/codemods/v20/chat-user.js +9 -12
  5. package/codemods/v21/chat-messagetoolbarvisibility.js +9 -13
  6. package/codemods/v21/chat-pinnedbyfield.js +1 -2
  7. package/esm2022/ai-prompt/aiprompt.component.mjs +155 -139
  8. package/esm2022/ai-prompt/common/output-card.component.mjs +81 -83
  9. package/esm2022/ai-prompt/common/toolbar-focusable.directive.mjs +2 -2
  10. package/esm2022/ai-prompt/views/output-view.component.mjs +27 -29
  11. package/esm2022/ai-prompt/views/prompt-view.component.mjs +150 -135
  12. package/esm2022/chat/attachment.component.mjs +53 -37
  13. package/esm2022/chat/cards/hero-card.component.mjs +48 -35
  14. package/esm2022/chat/chat-file.component.mjs +32 -29
  15. package/esm2022/chat/chat-view.mjs +2 -2
  16. package/esm2022/chat/chat.component.mjs +259 -242
  17. package/esm2022/chat/message-attachments.component.mjs +60 -55
  18. package/esm2022/chat/message-box.component.mjs +203 -183
  19. package/esm2022/chat/message-list.component.mjs +249 -209
  20. package/esm2022/chat/message-reference-content.component.mjs +30 -19
  21. package/esm2022/chat/message.component.mjs +301 -281
  22. package/esm2022/chat/suggested-actions.component.mjs +142 -134
  23. package/esm2022/inline-ai-prompt/inlineaiprompt-content.component.mjs +205 -179
  24. package/esm2022/package-metadata.mjs +2 -2
  25. package/fesm2022/progress-kendo-angular-conversational-ui.mjs +1988 -1777
  26. package/package.json +14 -14
  27. package/codemods/template-transformer/index.js +0 -93
@@ -5,10 +5,10 @@
5
5
  /* eslint-disable @typescript-eslint/no-explicit-any */
6
6
  /* eslint-disable @typescript-eslint/no-empty-function */
7
7
  import { Component, ElementRef, EventEmitter, forwardRef, HostBinding, Input, Output, QueryList, ViewChildren, ViewChild, NgZone, Renderer2 } from '@angular/core';
8
- import { NgFor, NgIf, NgTemplateOutlet } from '@angular/common';
8
+ import { NgTemplateOutlet } from '@angular/common';
9
9
  import { Subscription } from 'rxjs';
10
10
  import { take } from 'rxjs/operators';
11
- import { Keys, normalizeNumpadKeys } from '@progress/kendo-angular-common';
11
+ import { Keys, normalizeKeys } from '@progress/kendo-angular-common';
12
12
  import { ChatItem } from './chat-item';
13
13
  import { ChatSuggestionTemplateDirective } from './templates/suggestion-template.directive';
14
14
  import { ChatService } from './common/chat.service';
@@ -161,13 +161,13 @@ export class SuggestedActionsComponent extends ChatItem {
161
161
  this.activeIndex = apply ? index : -1;
162
162
  }
163
163
  actionKeydown(e, action) {
164
- const handler = this.actionKeyHandlers[normalizeNumpadKeys(e)];
164
+ const handler = this.actionKeyHandlers[normalizeKeys(e)];
165
165
  if (handler) {
166
166
  handler(e, action);
167
167
  }
168
168
  }
169
169
  suggestionKeydown(e, suggestion) {
170
- const handler = this.suggestionKeyHandlers[normalizeNumpadKeys(e)];
170
+ const handler = this.suggestionKeyHandlers[normalizeKeys(e)];
171
171
  if (handler) {
172
172
  handler(e, suggestion);
173
173
  }
@@ -206,96 +206,100 @@ export class SuggestedActionsComponent extends ChatItem {
206
206
  this.selectedIndex = Math.max(0, Math.min(prevIndex + offset, this.items.length - 1));
207
207
  }
208
208
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SuggestedActionsComponent, deps: [{ token: i1.ChatService }, { token: i2.LocalizationService }, { token: i3.SuggestionsScrollService }, { token: i0.NgZone }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
209
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: SuggestedActionsComponent, isStandalone: true, selector: "kendo-chat-suggested-actions", inputs: { actions: "actions", suggestions: "suggestions", tabbable: "tabbable", type: "type", suggestionTemplate: "suggestionTemplate" }, outputs: { dispatchAction: "dispatchAction", dispatchSuggestion: "dispatchSuggestion" }, host: { properties: { "class.k-suggestion-group": "this.defaultClass", "class.k-suggestion-group-scrollable": "this.scrollableClass", "class.k-suggestion-scrollwrap": "this.scrollButtonsClass", "attr.role": "this.role" } }, providers: [{
209
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: SuggestedActionsComponent, isStandalone: true, selector: "kendo-chat-suggested-actions", inputs: { actions: "actions", suggestions: "suggestions", tabbable: "tabbable", type: "type", suggestionTemplate: "suggestionTemplate" }, outputs: { dispatchAction: "dispatchAction", dispatchSuggestion: "dispatchSuggestion" }, host: { properties: { "class.k-suggestion-group": "this.defaultClass", "class.k-suggestion-group-scrollable": "this.scrollableClass", "class.k-suggestion-scrollwrap": "this.scrollButtonsClass", "attr.role": "this.role" } }, providers: [{
210
210
  provide: ChatItem,
211
211
  useExisting: forwardRef(() => SuggestedActionsComponent)
212
212
  },
213
213
  SuggestionsScrollService
214
214
  ], viewQueries: [{ propertyName: "suggestionsContainer", first: true, predicate: ["suggestionsContainer"], descendants: true, read: ElementRef }, { propertyName: "prevScrollButton", first: true, predicate: ["prevScrollButton"], descendants: true, read: ElementRef }, { propertyName: "nextScrollButton", first: true, predicate: ["nextScrollButton"], descendants: true, read: ElementRef }, { propertyName: "items", predicate: ["item"], descendants: true }], usesInheritance: true, ngImport: i0, template: `
215
- <span
216
- *ngIf="hasScrollButtons"
215
+ @if (hasScrollButtons) {
216
+ <span
217
217
  #prevScrollButton
218
218
  kendoChatScrollableButton
219
219
  [prev]="true"
220
220
  [title]="getScrollButtonTitle('prev')"
221
221
  class="k-button k-button-md k-button-solid k-button-solid-base k-rounded-md k-icon-button"
222
222
  (onClick)="scrollSuggestions($event)"
223
- >
224
- </span>
225
- <div class="k-suggestion-group" *ngIf="hasScrollButtons; else noScrollButtons"
223
+ >
224
+ </span>
225
+ }
226
+ @if (hasScrollButtons) {
227
+ <div class="k-suggestion-group"
226
228
  #suggestionsContainer
227
229
  role="group"
228
230
  (scroll)="onScroll($event)">
229
231
  <ng-container *ngTemplateOutlet="suggestionsContent"></ng-container>
230
- </div>
231
-
232
- <ng-template #noScrollButtons>
233
- <ng-container *ngTemplateOutlet="suggestionsContent"></ng-container>
234
- </ng-template>
235
-
232
+ </div>
233
+ } @else {
234
+ <ng-container *ngTemplateOutlet="suggestionsContent"></ng-container>
235
+ }
236
+
237
+
236
238
  <ng-template #suggestionsContent>
237
- <ng-container *ngIf="actions">
238
- <span
239
- #item
240
- *ngFor="let action of actions; index as index; first as first; last as last"
241
- class="k-suggestion k-suggestion-primary"
242
- role="button"
243
- [class.k-selected]="isSelected(index)"
244
- [class.k-focus]="isSelected(index)"
245
- [class.k-active]="isActive(index)"
246
- [attr.tabindex]="0"
247
- (click)="actionClick(action, index)"
248
- (keydown)="actionKeydown($event, action)"
249
- (mousedown)="toggleActiveState(true, index)"
250
- (mouseup)="toggleActiveState(false, index)"
239
+ @if (actions) {
240
+ @for (action of actions; track action; let index = $index; let first = $first; let last = $last) {
241
+ <span
242
+ #item
243
+ class="k-suggestion k-suggestion-primary"
244
+ role="button"
245
+ [class.k-selected]="isSelected(index)"
246
+ [class.k-focus]="isSelected(index)"
247
+ [class.k-active]="isActive(index)"
248
+ [attr.tabindex]="0"
249
+ (click)="actionClick(action, index)"
250
+ (keydown)="actionKeydown($event, action)"
251
+ (mousedown)="toggleActiveState(true, index)"
252
+ (mouseup)="toggleActiveState(false, index)"
251
253
  >
252
- {{ action.title || action.value }}
254
+ {{ action.title || action.value }}
255
+ </span>
256
+ }
257
+ }
258
+
259
+ @if (suggestions) {
260
+ @if (!suggestionTemplate?.templateRef) {
261
+ @for (suggestion of suggestions; track suggestion; let index = $index; let first = $first; let last = $last) {
262
+ <span
263
+ #item
264
+ class="k-suggestion"
265
+ role="button"
266
+ [class.k-selected]="isSelected(index)"
267
+ [class.k-focus]="isSelected(index)"
268
+ [class.k-active]="isActive(index)"
269
+ [attr.tabindex]="0"
270
+ (click)="suggestionClick(suggestion, index)"
271
+ (keydown)="suggestionKeydown($event, suggestion)"
272
+ (mousedown)="toggleActiveState(true, index)"
273
+ (mouseup)="toggleActiveState(false, index)"
274
+ >
275
+ {{ suggestion.text }}
253
276
  </span>
254
- </ng-container>
255
-
256
- <ng-container *ngIf="suggestions">
257
- <ng-container *ngIf="!suggestionTemplate?.templateRef">
258
- <span
259
- #item
260
- *ngFor="let suggestion of suggestions; index as index; first as first; last as last"
261
- class="k-suggestion"
262
- role="button"
263
- [class.k-selected]="isSelected(index)"
264
- [class.k-focus]="isSelected(index)"
265
- [class.k-active]="isActive(index)"
266
- [attr.tabindex]="0"
267
- (click)="suggestionClick(suggestion, index)"
268
- (keydown)="suggestionKeydown($event, suggestion)"
269
- (mousedown)="toggleActiveState(true, index)"
270
- (mouseup)="toggleActiveState(false, index)"
271
- >
272
- {{ suggestion.text }}
273
- </span>
274
- </ng-container>
275
-
276
- <ng-container *ngIf="suggestionTemplate?.templateRef">
277
- <ng-container *ngFor="let suggestion of suggestions">
278
- <ng-template
279
- [ngTemplateOutlet]="suggestionTemplate.templateRef"
280
- [ngTemplateOutletContext]="{ $implicit: suggestion }"
281
- >
282
- </ng-template>
283
- </ng-container>
284
- </ng-container>
285
- </ng-container>
277
+ }
278
+ }
279
+ @if (suggestionTemplate?.templateRef) {
280
+ @for (suggestion of suggestions; track suggestion) {
281
+ <ng-template
282
+ [ngTemplateOutlet]="suggestionTemplate.templateRef"
283
+ [ngTemplateOutletContext]="{ $implicit: suggestion }"
284
+ >
285
+ </ng-template>
286
+ }
287
+ }
288
+ }
286
289
  </ng-template>
287
-
288
- <span
289
- *ngIf="hasScrollButtons"
290
+
291
+ @if (hasScrollButtons) {
292
+ <span
290
293
  #nextScrollButton
291
294
  kendoChatScrollableButton
292
295
  [prev]="false"
293
296
  [title]="getScrollButtonTitle('next')"
294
297
  class="k-button k-button-md k-button-solid k-button-solid-base k-rounded-md k-icon-button"
295
298
  (onClick)="scrollSuggestions($event)"
296
- >
297
- </span>
298
- `, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ChatScrollableButtonComponent, selector: "[kendoChatScrollableButton]", inputs: ["prev"], outputs: ["onClick"] }] });
299
+ >
300
+ </span>
301
+ }
302
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ChatScrollableButtonComponent, selector: "[kendoChatScrollableButton]", inputs: ["prev"], outputs: ["onClick"] }] });
299
303
  }
300
304
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SuggestedActionsComponent, decorators: [{
301
305
  type: Component,
@@ -307,92 +311,96 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
307
311
  },
308
312
  SuggestionsScrollService],
309
313
  template: `
310
- <span
311
- *ngIf="hasScrollButtons"
314
+ @if (hasScrollButtons) {
315
+ <span
312
316
  #prevScrollButton
313
317
  kendoChatScrollableButton
314
318
  [prev]="true"
315
319
  [title]="getScrollButtonTitle('prev')"
316
320
  class="k-button k-button-md k-button-solid k-button-solid-base k-rounded-md k-icon-button"
317
321
  (onClick)="scrollSuggestions($event)"
318
- >
319
- </span>
320
- <div class="k-suggestion-group" *ngIf="hasScrollButtons; else noScrollButtons"
322
+ >
323
+ </span>
324
+ }
325
+ @if (hasScrollButtons) {
326
+ <div class="k-suggestion-group"
321
327
  #suggestionsContainer
322
328
  role="group"
323
329
  (scroll)="onScroll($event)">
324
330
  <ng-container *ngTemplateOutlet="suggestionsContent"></ng-container>
325
- </div>
326
-
327
- <ng-template #noScrollButtons>
328
- <ng-container *ngTemplateOutlet="suggestionsContent"></ng-container>
329
- </ng-template>
330
-
331
+ </div>
332
+ } @else {
333
+ <ng-container *ngTemplateOutlet="suggestionsContent"></ng-container>
334
+ }
335
+
336
+
331
337
  <ng-template #suggestionsContent>
332
- <ng-container *ngIf="actions">
333
- <span
334
- #item
335
- *ngFor="let action of actions; index as index; first as first; last as last"
336
- class="k-suggestion k-suggestion-primary"
337
- role="button"
338
- [class.k-selected]="isSelected(index)"
339
- [class.k-focus]="isSelected(index)"
340
- [class.k-active]="isActive(index)"
341
- [attr.tabindex]="0"
342
- (click)="actionClick(action, index)"
343
- (keydown)="actionKeydown($event, action)"
344
- (mousedown)="toggleActiveState(true, index)"
345
- (mouseup)="toggleActiveState(false, index)"
338
+ @if (actions) {
339
+ @for (action of actions; track action; let index = $index; let first = $first; let last = $last) {
340
+ <span
341
+ #item
342
+ class="k-suggestion k-suggestion-primary"
343
+ role="button"
344
+ [class.k-selected]="isSelected(index)"
345
+ [class.k-focus]="isSelected(index)"
346
+ [class.k-active]="isActive(index)"
347
+ [attr.tabindex]="0"
348
+ (click)="actionClick(action, index)"
349
+ (keydown)="actionKeydown($event, action)"
350
+ (mousedown)="toggleActiveState(true, index)"
351
+ (mouseup)="toggleActiveState(false, index)"
346
352
  >
347
- {{ action.title || action.value }}
353
+ {{ action.title || action.value }}
354
+ </span>
355
+ }
356
+ }
357
+
358
+ @if (suggestions) {
359
+ @if (!suggestionTemplate?.templateRef) {
360
+ @for (suggestion of suggestions; track suggestion; let index = $index; let first = $first; let last = $last) {
361
+ <span
362
+ #item
363
+ class="k-suggestion"
364
+ role="button"
365
+ [class.k-selected]="isSelected(index)"
366
+ [class.k-focus]="isSelected(index)"
367
+ [class.k-active]="isActive(index)"
368
+ [attr.tabindex]="0"
369
+ (click)="suggestionClick(suggestion, index)"
370
+ (keydown)="suggestionKeydown($event, suggestion)"
371
+ (mousedown)="toggleActiveState(true, index)"
372
+ (mouseup)="toggleActiveState(false, index)"
373
+ >
374
+ {{ suggestion.text }}
348
375
  </span>
349
- </ng-container>
350
-
351
- <ng-container *ngIf="suggestions">
352
- <ng-container *ngIf="!suggestionTemplate?.templateRef">
353
- <span
354
- #item
355
- *ngFor="let suggestion of suggestions; index as index; first as first; last as last"
356
- class="k-suggestion"
357
- role="button"
358
- [class.k-selected]="isSelected(index)"
359
- [class.k-focus]="isSelected(index)"
360
- [class.k-active]="isActive(index)"
361
- [attr.tabindex]="0"
362
- (click)="suggestionClick(suggestion, index)"
363
- (keydown)="suggestionKeydown($event, suggestion)"
364
- (mousedown)="toggleActiveState(true, index)"
365
- (mouseup)="toggleActiveState(false, index)"
366
- >
367
- {{ suggestion.text }}
368
- </span>
369
- </ng-container>
370
-
371
- <ng-container *ngIf="suggestionTemplate?.templateRef">
372
- <ng-container *ngFor="let suggestion of suggestions">
373
- <ng-template
374
- [ngTemplateOutlet]="suggestionTemplate.templateRef"
375
- [ngTemplateOutletContext]="{ $implicit: suggestion }"
376
- >
377
- </ng-template>
378
- </ng-container>
379
- </ng-container>
380
- </ng-container>
376
+ }
377
+ }
378
+ @if (suggestionTemplate?.templateRef) {
379
+ @for (suggestion of suggestions; track suggestion) {
380
+ <ng-template
381
+ [ngTemplateOutlet]="suggestionTemplate.templateRef"
382
+ [ngTemplateOutletContext]="{ $implicit: suggestion }"
383
+ >
384
+ </ng-template>
385
+ }
386
+ }
387
+ }
381
388
  </ng-template>
382
-
383
- <span
384
- *ngIf="hasScrollButtons"
389
+
390
+ @if (hasScrollButtons) {
391
+ <span
385
392
  #nextScrollButton
386
393
  kendoChatScrollableButton
387
394
  [prev]="false"
388
395
  [title]="getScrollButtonTitle('next')"
389
396
  class="k-button k-button-md k-button-solid k-button-solid-base k-rounded-md k-icon-button"
390
397
  (onClick)="scrollSuggestions($event)"
391
- >
392
- </span>
393
- `,
398
+ >
399
+ </span>
400
+ }
401
+ `,
394
402
  standalone: true,
395
- imports: [NgFor, NgIf, NgTemplateOutlet, ChatScrollableButtonComponent]
403
+ imports: [NgTemplateOutlet, ChatScrollableButtonComponent]
396
404
  }]
397
405
  }], ctorParameters: () => [{ type: i1.ChatService }, { type: i2.LocalizationService }, { type: i3.SuggestionsScrollService }, { type: i0.NgZone }, { type: i0.Renderer2 }], propDecorators: { defaultClass: [{
398
406
  type: HostBinding,