@progress/kendo-angular-conversational-ui 19.3.0-develop.24 → 19.3.0-develop.26
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.
- package/conversational-ui.module.d.ts +4 -1
- package/directives.d.ts +5 -1
- package/esm2022/ai-prompt/views/prompt-view.component.mjs +1 -1
- package/esm2022/chat/message-box.component.mjs +1 -1
- package/esm2022/conversational-ui.module.mjs +5 -2
- package/esm2022/directives.mjs +10 -1
- package/esm2022/index.mjs +5 -0
- package/esm2022/inline-ai-prompt/inlineaiprompt-content.component.mjs +549 -0
- package/esm2022/inline-ai-prompt/inlineaiprompt.component.mjs +342 -0
- package/esm2022/inline-ai-prompt/inlineaiprompt.service.mjs +85 -0
- package/esm2022/inline-ai-prompt/localization/custom-messages.component.mjs +53 -0
- package/esm2022/inline-ai-prompt/localization/localized-messages.directive.mjs +39 -0
- package/esm2022/inline-ai-prompt/localization/messages.mjs +35 -0
- package/esm2022/inline-ai-prompt/models/command.interface.mjs +5 -0
- package/esm2022/inline-ai-prompt/models/index.mjs +5 -0
- package/esm2022/inline-ai-prompt/models/inlineaiprompt-popupsettings.mjs +5 -0
- package/esm2022/inline-ai-prompt/models/inlineaiprompt-settings.mjs +59 -0
- package/esm2022/inline-ai-prompt/models/messages.mjs +8 -0
- package/esm2022/inline-ai-prompt/models/output-action-click-event.mjs +5 -0
- package/esm2022/inline-ai-prompt/models/output-action.interface.mjs +5 -0
- package/esm2022/inline-ai-prompt/models/prompt-output.interface.mjs +5 -0
- package/esm2022/inline-ai-prompt/models/prompt-request-event.mjs +5 -0
- package/esm2022/inline-ai-prompt/output-template.directive.mjs +38 -0
- package/esm2022/inline-ai-prompt/utils.mjs +22 -0
- package/esm2022/package-metadata.mjs +2 -2
- package/fesm2022/progress-kendo-angular-conversational-ui.mjs +1195 -42
- package/index.d.ts +5 -0
- package/inline-ai-prompt/inlineaiprompt-content.component.d.ts +82 -0
- package/inline-ai-prompt/inlineaiprompt.component.d.ts +150 -0
- package/inline-ai-prompt/inlineaiprompt.service.d.ts +41 -0
- package/inline-ai-prompt/localization/custom-messages.component.d.ts +27 -0
- package/inline-ai-prompt/localization/localized-messages.directive.d.ts +16 -0
- package/inline-ai-prompt/localization/messages.d.ts +25 -0
- package/inline-ai-prompt/models/command.interface.d.ts +38 -0
- package/inline-ai-prompt/models/index.d.ts +12 -0
- package/inline-ai-prompt/models/inlineaiprompt-popupsettings.d.ts +10 -0
- package/inline-ai-prompt/models/inlineaiprompt-settings.d.ts +66 -0
- package/inline-ai-prompt/models/messages.d.ts +21 -0
- package/inline-ai-prompt/models/output-action-click-event.d.ts +19 -0
- package/inline-ai-prompt/models/output-action.interface.d.ts +52 -0
- package/inline-ai-prompt/models/prompt-output.interface.d.ts +25 -0
- package/inline-ai-prompt/models/prompt-request-event.d.ts +17 -0
- package/inline-ai-prompt/output-template.directive.d.ts +27 -0
- package/inline-ai-prompt/utils.d.ts +13 -0
- package/package.json +12 -11
@@ -3,22 +3,28 @@
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
5
5
|
import * as i0 from '@angular/core';
|
6
|
-
import { Directive, Optional, EventEmitter, Component, HostBinding, ViewChild, Input, Output, isDevMode, forwardRef, ViewChildren, ElementRef, ContentChild, InjectionToken, Inject, Injectable, ContentChildren, NgModule } from '@angular/core';
|
6
|
+
import { Directive, Optional, EventEmitter, Component, HostBinding, ViewChild, Input, Output, isDevMode, forwardRef, ViewChildren, ElementRef, ContentChild, InjectionToken, Inject, Injectable, ContentChildren, inject, SkipSelf, HostListener, ViewContainerRef, NgModule } from '@angular/core';
|
7
7
|
import * as i1$1 from '@progress/kendo-angular-l10n';
|
8
8
|
import { ComponentMessages, LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
9
9
|
import { validatePackage } from '@progress/kendo-licensing';
|
10
|
-
import { NgIf, NgTemplateOutlet, NgFor, NgSwitch, NgSwitchCase } from '@angular/common';
|
11
|
-
import { Keys, ResizeSensorComponent, isPresent, focusableSelector, guid, ResizeBatchService } from '@progress/kendo-angular-common';
|
12
|
-
import { paperPlaneIcon, chevronLeftIcon, chevronRightIcon, sparklesIcon, commentIcon, moreHorizontalIcon, stopSmIcon, thumbUpIcon, thumbDownOutlineIcon, thumbDownIcon, thumbUpOutlineIcon, copyIcon, arrowRotateCwIcon, chevronUpIcon, chevronDownIcon } from '@progress/kendo-svg-icons';
|
13
|
-
import
|
14
|
-
import {
|
10
|
+
import { NgIf, NgTemplateOutlet, NgFor, NgSwitch, NgSwitchCase, NgClass } from '@angular/common';
|
11
|
+
import { Keys, ResizeSensorComponent, isPresent, focusableSelector, guid, isDocumentAvailable, ResizeBatchService } from '@progress/kendo-angular-common';
|
12
|
+
import { paperPlaneIcon, chevronLeftIcon, chevronRightIcon, sparklesIcon, commentIcon, moreHorizontalIcon, stopSmIcon, thumbUpIcon, thumbDownOutlineIcon, thumbDownIcon, thumbUpOutlineIcon, copyIcon, arrowRotateCwIcon, chevronUpIcon, chevronDownIcon, cancelOutlineIcon, menuIcon } from '@progress/kendo-svg-icons';
|
13
|
+
import * as i2 from '@progress/kendo-angular-buttons';
|
14
|
+
import { ButtonComponent, FloatingActionButtonComponent, SpeechToTextButtonComponent, KENDO_BUTTONS } from '@progress/kendo-angular-buttons';
|
15
|
+
import * as i3 from '@progress/kendo-angular-inputs';
|
16
|
+
import { TextBoxComponent, TextAreaComponent, InputSeparatorComponent, TextBoxSuffixTemplateDirective, TextAreaSuffixComponent, KENDO_TEXTAREA } from '@progress/kendo-angular-inputs';
|
15
17
|
import * as i1 from '@progress/kendo-angular-intl';
|
16
18
|
import { fromEvent, Subscription, Subject } from 'rxjs';
|
17
19
|
import { debounceTime, take } from 'rxjs/operators';
|
18
20
|
import { IconsService } from '@progress/kendo-angular-icons';
|
19
|
-
import
|
21
|
+
import * as i1$2 from '@progress/kendo-angular-popup';
|
22
|
+
import { PopupComponent, KENDO_POPUP, PopupService } from '@progress/kendo-angular-popup';
|
20
23
|
import { DialogContainerService, DialogService, WindowService, WindowContainerService } from '@progress/kendo-angular-dialog';
|
21
|
-
import
|
24
|
+
import * as i5 from '@progress/kendo-angular-layout';
|
25
|
+
import { PanelBarComponent, KENDO_CARD } from '@progress/kendo-angular-layout';
|
26
|
+
import * as i4 from '@progress/kendo-angular-menu';
|
27
|
+
import { KENDO_CONTEXTMENU } from '@progress/kendo-angular-menu';
|
22
28
|
|
23
29
|
/**
|
24
30
|
* Defines a template for displaying message attachments.
|
@@ -136,8 +142,8 @@ const packageMetadata = {
|
|
136
142
|
productName: 'Kendo UI for Angular',
|
137
143
|
productCode: 'KENDOUIANGULAR',
|
138
144
|
productCodes: ['KENDOUIANGULAR'],
|
139
|
-
publishDate:
|
140
|
-
version: '19.3.0-develop.
|
145
|
+
publishDate: 1754555245,
|
146
|
+
version: '19.3.0-develop.26',
|
141
147
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
|
142
148
|
};
|
143
149
|
|
@@ -298,7 +304,7 @@ class MessageBoxComponent {
|
|
298
304
|
</ng-container>
|
299
305
|
|
300
306
|
<ng-template *ngIf="messageBoxTemplate" [ngTemplateOutlet]="messageBoxTemplate?.templateRef"></ng-template>
|
301
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TextBoxComponent, selector: "kendo-textbox", inputs: ["focusableId", "title", "type", "disabled", "readonly", "tabindex", "value", "selectOnFocus", "showSuccessIcon", "showErrorIcon", "clearButton", "successIcon", "successSvgIcon", "errorIcon", "errorSvgIcon", "clearButtonIcon", "clearButtonSvgIcon", "size", "rounded", "fillMode", "tabIndex", "placeholder", "maxlength", "inputAttributes"], outputs: ["valueChange", "inputFocus", "inputBlur", "focus", "blur"], exportAs: ["kendoTextBox"] }, { kind: "component", type: TextAreaComponent, selector: "kendo-textarea", inputs: ["focusableId", "flow", "inputAttributes", "adornmentsOrientation", "rows", "cols", "maxlength", "tabindex", "tabIndex", "resizable", "size", "rounded", "fillMode", "showPrefixSeparator", "showSuffixSeparator"], outputs: ["focus", "blur", "valueChange"], exportAs: ["kendoTextArea"] }, { kind: "component", type: InputSeparatorComponent, selector: "kendo-input-separator, kendo-textbox-separator", inputs: ["orientation"] }, { kind: "directive", type: TextBoxSuffixTemplateDirective, selector: "[kendoTextBoxSuffixTemplate]", inputs: ["showSeparator"] }, { kind: "component", type: TextAreaSuffixComponent, selector: "kendo-textarea-suffix", inputs: ["flow", "orientation"], exportAs: ["kendoTextAreaSuffix"] }] });
|
307
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TextBoxComponent, selector: "kendo-textbox", inputs: ["focusableId", "title", "type", "disabled", "readonly", "tabindex", "value", "selectOnFocus", "showSuccessIcon", "showErrorIcon", "clearButton", "successIcon", "successSvgIcon", "errorIcon", "errorSvgIcon", "clearButtonIcon", "clearButtonSvgIcon", "size", "rounded", "fillMode", "tabIndex", "placeholder", "maxlength", "inputAttributes"], outputs: ["valueChange", "inputFocus", "inputBlur", "focus", "blur"], exportAs: ["kendoTextBox"] }, { kind: "component", type: TextAreaComponent, selector: "kendo-textarea", inputs: ["focusableId", "flow", "inputAttributes", "adornmentsOrientation", "rows", "cols", "maxlength", "maxResizableRows", "tabindex", "tabIndex", "resizable", "size", "rounded", "fillMode", "showPrefixSeparator", "showSuffixSeparator"], outputs: ["focus", "blur", "valueChange"], exportAs: ["kendoTextArea"] }, { kind: "component", type: InputSeparatorComponent, selector: "kendo-input-separator, kendo-textbox-separator", inputs: ["orientation"] }, { kind: "directive", type: TextBoxSuffixTemplateDirective, selector: "[kendoTextBoxSuffixTemplate]", inputs: ["showSeparator"] }, { kind: "component", type: TextAreaSuffixComponent, selector: "kendo-textarea-suffix", inputs: ["flow", "orientation"], exportAs: ["kendoTextAreaSuffix"] }] });
|
302
308
|
}
|
303
309
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageBoxComponent, decorators: [{
|
304
310
|
type: Component,
|
@@ -1511,7 +1517,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
1511
1517
|
/**
|
1512
1518
|
* @hidden
|
1513
1519
|
*/
|
1514
|
-
let Messages$
|
1520
|
+
let Messages$2 = class Messages extends ComponentMessages {
|
1515
1521
|
/**
|
1516
1522
|
* Sets the placeholder text for the message text input.
|
1517
1523
|
*/
|
@@ -1543,7 +1549,7 @@ let Messages$1 = class Messages extends ComponentMessages {
|
|
1543
1549
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
1544
1550
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: Messages, selector: "kendoConversationalUIMessages", inputs: { messagePlaceholder: "messagePlaceholder", send: "send", messageListLabel: "messageListLabel", messageBoxInputLabel: "messageBoxInputLabel", messageAttachmentLeftArrow: "messageAttachmentLeftArrow", messageAttachmentRightArrow: "messageAttachmentRightArrow", messageAvatarAlt: "messageAvatarAlt" }, usesInheritance: true, ngImport: i0 });
|
1545
1551
|
};
|
1546
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Messages$
|
1552
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Messages$2, decorators: [{
|
1547
1553
|
type: Directive,
|
1548
1554
|
args: [{
|
1549
1555
|
// eslint-disable-next-line @angular-eslint/directive-selector
|
@@ -1569,7 +1575,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
1569
1575
|
/**
|
1570
1576
|
* @hidden
|
1571
1577
|
*/
|
1572
|
-
let LocalizedMessagesDirective$
|
1578
|
+
let LocalizedMessagesDirective$2 = class LocalizedMessagesDirective extends Messages$2 {
|
1573
1579
|
service;
|
1574
1580
|
constructor(service) {
|
1575
1581
|
super();
|
@@ -1578,18 +1584,18 @@ let LocalizedMessagesDirective$1 = class LocalizedMessagesDirective extends Mess
|
|
1578
1584
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedMessagesDirective, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
|
1579
1585
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: LocalizedMessagesDirective, isStandalone: true, selector: "[kendoChatLocalizedMessages]", providers: [
|
1580
1586
|
{
|
1581
|
-
provide: Messages$
|
1587
|
+
provide: Messages$2,
|
1582
1588
|
useExisting: forwardRef(() => LocalizedMessagesDirective)
|
1583
1589
|
}
|
1584
1590
|
], usesInheritance: true, ngImport: i0 });
|
1585
1591
|
};
|
1586
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedMessagesDirective$
|
1592
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedMessagesDirective$2, decorators: [{
|
1587
1593
|
type: Directive,
|
1588
1594
|
args: [{
|
1589
1595
|
providers: [
|
1590
1596
|
{
|
1591
|
-
provide: Messages$
|
1592
|
-
useExisting: forwardRef(() => LocalizedMessagesDirective$
|
1597
|
+
provide: Messages$2,
|
1598
|
+
useExisting: forwardRef(() => LocalizedMessagesDirective$2)
|
1593
1599
|
}
|
1594
1600
|
],
|
1595
1601
|
selector: '[kendoChatLocalizedMessages]',
|
@@ -1786,7 +1792,7 @@ class ChatComponent {
|
|
1786
1792
|
(sendMessage)="sendMessage.emit($event)"
|
1787
1793
|
>
|
1788
1794
|
</kendo-message-box>
|
1789
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: LocalizedMessagesDirective$
|
1795
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: LocalizedMessagesDirective$2, selector: "[kendoChatLocalizedMessages]" }, { kind: "directive", type: ScrollAnchorDirective, selector: "[kendoChatScrollAnchor]", inputs: ["autoScroll"], outputs: ["autoScrollChange"], exportAs: ["scrollAnchor"] }, { kind: "component", type: MessageListComponent, selector: "kendo-chat-message-list", inputs: ["messages", "attachmentTemplate", "messageTemplate", "localization", "user"], outputs: ["executeAction", "navigate", "resize"] }, { kind: "component", type: MessageBoxComponent, selector: "kendo-message-box", inputs: ["user", "autoScroll", "type", "localization", "messageBoxTemplate"], outputs: ["sendMessage"] }] });
|
1790
1796
|
}
|
1791
1797
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ChatComponent, decorators: [{
|
1792
1798
|
type: Component,
|
@@ -1858,7 +1864,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
1858
1864
|
</kendo-message-box>
|
1859
1865
|
`,
|
1860
1866
|
standalone: true,
|
1861
|
-
imports: [LocalizedMessagesDirective$
|
1867
|
+
imports: [LocalizedMessagesDirective$2, ScrollAnchorDirective, MessageListComponent, MessageBoxComponent]
|
1862
1868
|
}]
|
1863
1869
|
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: i0.NgZone }]; }, propDecorators: { messages: [{
|
1864
1870
|
type: Input
|
@@ -2221,7 +2227,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
2221
2227
|
/**
|
2222
2228
|
* @hidden
|
2223
2229
|
*/
|
2224
|
-
class Messages extends ComponentMessages {
|
2230
|
+
let Messages$1 = class Messages extends ComponentMessages {
|
2225
2231
|
/**
|
2226
2232
|
* Sets the Toolbar button text for the **Prompt** view.
|
2227
2233
|
*/
|
@@ -2264,8 +2270,8 @@ class Messages extends ComponentMessages {
|
|
2264
2270
|
speechToTextButton;
|
2265
2271
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
2266
2272
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: Messages, inputs: { promptView: "promptView", outputView: "outputView", generateOutput: "generateOutput", promptPlaceholder: "promptPlaceholder", copyOutput: "copyOutput", retryGeneration: "retryGeneration", outputTitle: "outputTitle", outputRetryTitle: "outputRetryTitle", promptSuggestions: "promptSuggestions", speechToTextButton: "speechToTextButton" }, usesInheritance: true, ngImport: i0 });
|
2267
|
-
}
|
2268
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Messages, decorators: [{
|
2273
|
+
};
|
2274
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Messages$1, decorators: [{
|
2269
2275
|
type: Directive
|
2270
2276
|
}], propDecorators: { promptView: [{
|
2271
2277
|
type: Input
|
@@ -2292,7 +2298,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
2292
2298
|
/**
|
2293
2299
|
* @hidden
|
2294
2300
|
*/
|
2295
|
-
class LocalizedMessagesDirective extends Messages {
|
2301
|
+
let LocalizedMessagesDirective$1 = class LocalizedMessagesDirective extends Messages$1 {
|
2296
2302
|
service;
|
2297
2303
|
constructor(service) {
|
2298
2304
|
super();
|
@@ -2301,18 +2307,18 @@ class LocalizedMessagesDirective extends Messages {
|
|
2301
2307
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedMessagesDirective, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
|
2302
2308
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: LocalizedMessagesDirective, isStandalone: true, selector: "[kendoAIPromptLocalizedMessages]", providers: [
|
2303
2309
|
{
|
2304
|
-
provide: Messages,
|
2310
|
+
provide: Messages$1,
|
2305
2311
|
useExisting: forwardRef(() => LocalizedMessagesDirective)
|
2306
2312
|
}
|
2307
2313
|
], usesInheritance: true, ngImport: i0 });
|
2308
|
-
}
|
2309
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedMessagesDirective, decorators: [{
|
2314
|
+
};
|
2315
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedMessagesDirective$1, decorators: [{
|
2310
2316
|
type: Directive,
|
2311
2317
|
args: [{
|
2312
2318
|
providers: [
|
2313
2319
|
{
|
2314
|
-
provide: Messages,
|
2315
|
-
useExisting: forwardRef(() => LocalizedMessagesDirective)
|
2320
|
+
provide: Messages$1,
|
2321
|
+
useExisting: forwardRef(() => LocalizedMessagesDirective$1)
|
2316
2322
|
}
|
2317
2323
|
],
|
2318
2324
|
selector: '[kendoAIPromptLocalizedMessages]',
|
@@ -2736,7 +2742,7 @@ class AIPromptComponent {
|
|
2736
2742
|
(click)="handleGenerateOutput()">{{messageFor('generateOutput')}}</button>
|
2737
2743
|
</div>
|
2738
2744
|
</div>
|
2739
|
-
`, 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"] }] });
|
2745
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: LocalizedMessagesDirective$1, 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"] }] });
|
2740
2746
|
}
|
2741
2747
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptComponent, decorators: [{
|
2742
2748
|
type: Component,
|
@@ -2831,7 +2837,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
2831
2837
|
</div>
|
2832
2838
|
`,
|
2833
2839
|
standalone: true,
|
2834
|
-
imports: [LocalizedMessagesDirective, NgFor, ButtonComponent, AIPromptToolbarFocusableDirective, NgIf, NgTemplateOutlet, FloatingActionButtonComponent]
|
2840
|
+
imports: [LocalizedMessagesDirective$1, NgFor, ButtonComponent, AIPromptToolbarFocusableDirective, NgIf, NgTemplateOutlet, FloatingActionButtonComponent]
|
2835
2841
|
}]
|
2836
2842
|
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: AIPromptService }, { type: ToolbarNavigationService }, { type: i0.NgZone }, { type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { hostClasses: [{
|
2837
2843
|
type: HostBinding,
|
@@ -2993,7 +2999,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
2993
2999
|
* </kendo-aiprompt-messages>
|
2994
3000
|
* ```
|
2995
3001
|
*/
|
2996
|
-
class AIPromptCustomMessagesComponent extends Messages {
|
3002
|
+
class AIPromptCustomMessagesComponent extends Messages$1 {
|
2997
3003
|
service;
|
2998
3004
|
constructor(service) {
|
2999
3005
|
super();
|
@@ -3005,7 +3011,7 @@ class AIPromptCustomMessagesComponent extends Messages {
|
|
3005
3011
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptCustomMessagesComponent, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
3006
3012
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AIPromptCustomMessagesComponent, isStandalone: true, selector: "kendo-aiprompt-messages", providers: [
|
3007
3013
|
{
|
3008
|
-
provide: Messages,
|
3014
|
+
provide: Messages$1,
|
3009
3015
|
useExisting: forwardRef(() => AIPromptCustomMessagesComponent)
|
3010
3016
|
}
|
3011
3017
|
], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
|
@@ -3015,7 +3021,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
3015
3021
|
args: [{
|
3016
3022
|
providers: [
|
3017
3023
|
{
|
3018
|
-
provide: Messages,
|
3024
|
+
provide: Messages$1,
|
3019
3025
|
useExisting: forwardRef(() => AIPromptCustomMessagesComponent)
|
3020
3026
|
}
|
3021
3027
|
],
|
@@ -3535,7 +3541,7 @@ class PromptViewComponent extends BaseView {
|
|
3535
3541
|
</div>
|
3536
3542
|
</div>
|
3537
3543
|
</ng-template>
|
3538
|
-
`, isInline: true, dependencies: [{ kind: "component", type: TextAreaComponent, selector: "kendo-textarea", inputs: ["focusableId", "flow", "inputAttributes", "adornmentsOrientation", "rows", "cols", "maxlength", "tabindex", "tabIndex", "resizable", "size", "rounded", "fillMode", "showPrefixSeparator", "showSuffixSeparator"], outputs: ["focus", "blur", "valueChange"], exportAs: ["kendoTextArea"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: TextAreaSuffixComponent, selector: "kendo-textarea-suffix", inputs: ["flow", "orientation"], exportAs: ["kendoTextAreaSuffix"] }, { kind: "component", type: SpeechToTextButtonComponent, selector: "button[kendoSpeechToTextButton]", inputs: ["disabled", "size", "rounded", "fillMode", "themeColor", "integrationMode", "lang", "continuous", "interimResults", "maxAlternatives"], outputs: ["start", "end", "result", "error", "click"], exportAs: ["kendoSpeechToTextButton"] }] });
|
3544
|
+
`, isInline: true, dependencies: [{ kind: "component", type: TextAreaComponent, selector: "kendo-textarea", inputs: ["focusableId", "flow", "inputAttributes", "adornmentsOrientation", "rows", "cols", "maxlength", "maxResizableRows", "tabindex", "tabIndex", "resizable", "size", "rounded", "fillMode", "showPrefixSeparator", "showSuffixSeparator"], outputs: ["focus", "blur", "valueChange"], exportAs: ["kendoTextArea"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: TextAreaSuffixComponent, selector: "kendo-textarea-suffix", inputs: ["flow", "orientation"], exportAs: ["kendoTextAreaSuffix"] }, { kind: "component", type: SpeechToTextButtonComponent, selector: "button[kendoSpeechToTextButton]", inputs: ["disabled", "size", "rounded", "fillMode", "themeColor", "integrationMode", "lang", "continuous", "interimResults", "maxAlternatives"], outputs: ["start", "end", "result", "error", "click"], exportAs: ["kendoSpeechToTextButton"] }] });
|
3539
3545
|
}
|
3540
3546
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PromptViewComponent, decorators: [{
|
3541
3547
|
type: Component,
|
@@ -3641,7 +3647,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
3641
3647
|
* </kendo-chat-messages>
|
3642
3648
|
* ```
|
3643
3649
|
*/
|
3644
|
-
class CustomMessagesComponent extends Messages$
|
3650
|
+
class CustomMessagesComponent extends Messages$2 {
|
3645
3651
|
service;
|
3646
3652
|
constructor(service) {
|
3647
3653
|
super();
|
@@ -3653,7 +3659,7 @@ class CustomMessagesComponent extends Messages$1 {
|
|
3653
3659
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomMessagesComponent, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
3654
3660
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: CustomMessagesComponent, isStandalone: true, selector: "kendo-chat-messages", providers: [
|
3655
3661
|
{
|
3656
|
-
provide: Messages$
|
3662
|
+
provide: Messages$2,
|
3657
3663
|
useExisting: forwardRef(() => CustomMessagesComponent)
|
3658
3664
|
}
|
3659
3665
|
], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
|
@@ -3663,7 +3669,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
3663
3669
|
args: [{
|
3664
3670
|
providers: [
|
3665
3671
|
{
|
3666
|
-
provide: Messages$
|
3672
|
+
provide: Messages$2,
|
3667
3673
|
useExisting: forwardRef(() => CustomMessagesComponent)
|
3668
3674
|
}
|
3669
3675
|
],
|
@@ -3784,6 +3790,1015 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
3784
3790
|
type: Output
|
3785
3791
|
}] } });
|
3786
3792
|
|
3793
|
+
/**
|
3794
|
+
* @hidden
|
3795
|
+
*/
|
3796
|
+
class Messages extends ComponentMessages {
|
3797
|
+
/**
|
3798
|
+
* Sets the Commands button title.
|
3799
|
+
*/
|
3800
|
+
commandsButtonTitle;
|
3801
|
+
/**
|
3802
|
+
* Sets the Generate button title.
|
3803
|
+
*/
|
3804
|
+
generateButtonTitle;
|
3805
|
+
/**
|
3806
|
+
* Sets the Speech to Text button title.
|
3807
|
+
*/
|
3808
|
+
speechToTextButtonTitle;
|
3809
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
3810
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: Messages, inputs: { commandsButtonTitle: "commandsButtonTitle", generateButtonTitle: "generateButtonTitle", speechToTextButtonTitle: "speechToTextButtonTitle" }, usesInheritance: true, ngImport: i0 });
|
3811
|
+
}
|
3812
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Messages, decorators: [{
|
3813
|
+
type: Directive
|
3814
|
+
}], propDecorators: { commandsButtonTitle: [{
|
3815
|
+
type: Input
|
3816
|
+
}], generateButtonTitle: [{
|
3817
|
+
type: Input
|
3818
|
+
}], speechToTextButtonTitle: [{
|
3819
|
+
type: Input
|
3820
|
+
}] } });
|
3821
|
+
|
3822
|
+
/**
|
3823
|
+
* @hidden
|
3824
|
+
*/
|
3825
|
+
class LocalizedMessagesDirective extends Messages {
|
3826
|
+
service;
|
3827
|
+
constructor(service) {
|
3828
|
+
super();
|
3829
|
+
this.service = service;
|
3830
|
+
}
|
3831
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedMessagesDirective, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
|
3832
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: LocalizedMessagesDirective, isStandalone: true, selector: "[kendoInlineAIPromptLocalizedMessages]", providers: [
|
3833
|
+
{
|
3834
|
+
provide: Messages,
|
3835
|
+
useExisting: forwardRef(() => LocalizedMessagesDirective)
|
3836
|
+
}
|
3837
|
+
], usesInheritance: true, ngImport: i0 });
|
3838
|
+
}
|
3839
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedMessagesDirective, decorators: [{
|
3840
|
+
type: Directive,
|
3841
|
+
args: [{
|
3842
|
+
providers: [
|
3843
|
+
{
|
3844
|
+
provide: Messages,
|
3845
|
+
useExisting: forwardRef(() => LocalizedMessagesDirective)
|
3846
|
+
}
|
3847
|
+
],
|
3848
|
+
selector: '[kendoInlineAIPromptLocalizedMessages]',
|
3849
|
+
standalone: true
|
3850
|
+
}]
|
3851
|
+
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; } });
|
3852
|
+
|
3853
|
+
/**
|
3854
|
+
* @hidden
|
3855
|
+
*/
|
3856
|
+
const defaultPopupSettings = {
|
3857
|
+
popupAlign: { vertical: 'top', horizontal: 'left' },
|
3858
|
+
anchorAlign: { horizontal: "left", vertical: "bottom" },
|
3859
|
+
positionMode: 'absolute',
|
3860
|
+
collision: { horizontal: 'fit', vertical: 'flip' },
|
3861
|
+
animate: true,
|
3862
|
+
offset: { top: 0, left: 0 },
|
3863
|
+
margin: { horizontal: 0, vertical: 0 },
|
3864
|
+
};
|
3865
|
+
/**
|
3866
|
+
* @hidden
|
3867
|
+
*/
|
3868
|
+
const calculateMeasurement = (value) => {
|
3869
|
+
return value + (typeof value === 'number' ? 'px' : '');
|
3870
|
+
};
|
3871
|
+
|
3872
|
+
const TEXTAREA_MAX_ROWS = 5;
|
3873
|
+
const TEXTAREA_INITIAL_ROWS = 1;
|
3874
|
+
/**
|
3875
|
+
* @hidden
|
3876
|
+
*/
|
3877
|
+
class InlineAIPromptContentComponent {
|
3878
|
+
ngZone;
|
3879
|
+
renderer;
|
3880
|
+
element;
|
3881
|
+
localization;
|
3882
|
+
className = true;
|
3883
|
+
get dirAttr() {
|
3884
|
+
return this.direction;
|
3885
|
+
}
|
3886
|
+
get maxHeightStyle() {
|
3887
|
+
return this.calculateMeasurement(this.maxHeight);
|
3888
|
+
}
|
3889
|
+
get widthStyle() {
|
3890
|
+
return this.calculateMeasurement(this.width);
|
3891
|
+
}
|
3892
|
+
popupElement;
|
3893
|
+
promptValue;
|
3894
|
+
placeholder;
|
3895
|
+
promptOutput;
|
3896
|
+
enableTextToSpeech = true;
|
3897
|
+
streaming = false;
|
3898
|
+
width = 550;
|
3899
|
+
maxHeight;
|
3900
|
+
appendTo;
|
3901
|
+
defaultOutputActions = [{
|
3902
|
+
name: 'copy',
|
3903
|
+
type: 'button',
|
3904
|
+
icon: 'copy',
|
3905
|
+
svgIcon: copyIcon,
|
3906
|
+
text: 'Copy',
|
3907
|
+
fillMode: 'flat',
|
3908
|
+
themeColor: 'primary',
|
3909
|
+
rounded: 'medium',
|
3910
|
+
},
|
3911
|
+
{
|
3912
|
+
name: 'retry',
|
3913
|
+
type: 'button',
|
3914
|
+
icon: 'arrow-rotate-cw',
|
3915
|
+
svgIcon: arrowRotateCwIcon,
|
3916
|
+
text: 'Retry',
|
3917
|
+
fillMode: 'flat',
|
3918
|
+
themeColor: 'primary',
|
3919
|
+
rounded: 'medium',
|
3920
|
+
},
|
3921
|
+
{
|
3922
|
+
name: 'discard',
|
3923
|
+
type: 'button',
|
3924
|
+
icon: 'cancel-outline',
|
3925
|
+
svgIcon: cancelOutlineIcon,
|
3926
|
+
text: 'Discard',
|
3927
|
+
fillMode: 'flat',
|
3928
|
+
themeColor: 'base',
|
3929
|
+
rounded: 'medium',
|
3930
|
+
}
|
3931
|
+
];
|
3932
|
+
set outputActions(actions) {
|
3933
|
+
this._outputActions = this.mergeWithDefaultActions(actions);
|
3934
|
+
}
|
3935
|
+
get outputActions() {
|
3936
|
+
return this._outputActions;
|
3937
|
+
}
|
3938
|
+
set promptCommands(commands) {
|
3939
|
+
this._promptCommands = commands || [];
|
3940
|
+
this.commandMenuItems = this.transformCommands(commands || []);
|
3941
|
+
}
|
3942
|
+
get promptCommands() {
|
3943
|
+
return this._promptCommands;
|
3944
|
+
}
|
3945
|
+
outputTemplate;
|
3946
|
+
promptRequest = new EventEmitter();
|
3947
|
+
executeCommand = new EventEmitter();
|
3948
|
+
outputActionClick = new EventEmitter();
|
3949
|
+
promptRequestCancel = new EventEmitter();
|
3950
|
+
close = new EventEmitter();
|
3951
|
+
promptValueChange = new EventEmitter();
|
3952
|
+
onEscapeKey(event) {
|
3953
|
+
if (event.key === 'Escape') {
|
3954
|
+
if (this.streaming) {
|
3955
|
+
event.stopPropagation();
|
3956
|
+
this.promptRequestCancel.emit();
|
3957
|
+
}
|
3958
|
+
else {
|
3959
|
+
this.close.emit();
|
3960
|
+
}
|
3961
|
+
}
|
3962
|
+
}
|
3963
|
+
textArea;
|
3964
|
+
contextMenu;
|
3965
|
+
calculateMeasurement = calculateMeasurement;
|
3966
|
+
commandMenuIcon = menuIcon;
|
3967
|
+
sendIcon = paperPlaneIcon;
|
3968
|
+
stopGenerationIcon = stopSmIcon;
|
3969
|
+
isListening = false;
|
3970
|
+
commandMenuItems = [];
|
3971
|
+
messages = {};
|
3972
|
+
maxRows = TEXTAREA_MAX_ROWS;
|
3973
|
+
initialRows = TEXTAREA_INITIAL_ROWS;
|
3974
|
+
_outputActions = this.defaultOutputActions;
|
3975
|
+
_promptCommands = [];
|
3976
|
+
direction;
|
3977
|
+
localizationSubs = new Subscription();
|
3978
|
+
subs = new Subscription();
|
3979
|
+
constructor(ngZone, renderer, element, localization) {
|
3980
|
+
this.ngZone = ngZone;
|
3981
|
+
this.renderer = renderer;
|
3982
|
+
this.element = element;
|
3983
|
+
this.localization = localization;
|
3984
|
+
validatePackage(packageMetadata);
|
3985
|
+
if (!this.localization) {
|
3986
|
+
this.localization = inject(LocalizationService);
|
3987
|
+
}
|
3988
|
+
this.direction = this.localization?.rtl ? 'rtl' : 'ltr';
|
3989
|
+
this.localizationSubs.add(this.localization.changes.subscribe(({ rtl }) => {
|
3990
|
+
this.direction = rtl ? 'rtl' : 'ltr';
|
3991
|
+
}));
|
3992
|
+
}
|
3993
|
+
ngAfterViewInit() {
|
3994
|
+
this.ngZone.runOutsideAngular(() => {
|
3995
|
+
if (!isDocumentAvailable()) {
|
3996
|
+
return;
|
3997
|
+
}
|
3998
|
+
// add a delay to avoid catching the same click event that triggered the component opening
|
3999
|
+
setTimeout(() => {
|
4000
|
+
this.subs.add(this.renderer.listen('document', 'click', (e) => {
|
4001
|
+
this.outsideClickClose(e);
|
4002
|
+
}));
|
4003
|
+
});
|
4004
|
+
});
|
4005
|
+
}
|
4006
|
+
ngOnDestroy() {
|
4007
|
+
this.subs.unsubscribe();
|
4008
|
+
this.localizationSubs.unsubscribe();
|
4009
|
+
this.contextMenu?.hide();
|
4010
|
+
}
|
4011
|
+
focus() {
|
4012
|
+
if (this.textArea) {
|
4013
|
+
this.textArea.focus();
|
4014
|
+
}
|
4015
|
+
}
|
4016
|
+
onActionClick(event) {
|
4017
|
+
const eventArgs = {
|
4018
|
+
action: event,
|
4019
|
+
output: this.promptOutput,
|
4020
|
+
};
|
4021
|
+
this.outputActionClick.emit(eventArgs);
|
4022
|
+
this.handleDefaultActions(event);
|
4023
|
+
}
|
4024
|
+
handleDefaultActions(event) {
|
4025
|
+
switch (event.name) {
|
4026
|
+
case 'copy':
|
4027
|
+
navigator.clipboard.writeText(this.promptOutput.output);
|
4028
|
+
break;
|
4029
|
+
case 'retry':
|
4030
|
+
this.promptRequest.emit({
|
4031
|
+
prompt: this.promptOutput?.prompt,
|
4032
|
+
isRetry: true
|
4033
|
+
});
|
4034
|
+
break;
|
4035
|
+
case 'discard':
|
4036
|
+
this.close.emit();
|
4037
|
+
break;
|
4038
|
+
}
|
4039
|
+
}
|
4040
|
+
handleSpeechResult(event) {
|
4041
|
+
if (event.alternatives && event.alternatives.length > 0) {
|
4042
|
+
this.promptValue += event.alternatives[0].transcript + ' ';
|
4043
|
+
}
|
4044
|
+
}
|
4045
|
+
onClick(action) {
|
4046
|
+
this.executeCommand.next(action);
|
4047
|
+
}
|
4048
|
+
handlePromptValueChange(value) {
|
4049
|
+
this.promptValue = value;
|
4050
|
+
this.promptValueChange.emit(value);
|
4051
|
+
}
|
4052
|
+
handleTextAreaKeydown(event) {
|
4053
|
+
if (event.key === 'Enter' && !event.shiftKey && !this.streaming) {
|
4054
|
+
event.preventDefault();
|
4055
|
+
this.handlePromptRequest();
|
4056
|
+
}
|
4057
|
+
}
|
4058
|
+
onCommandButtonClick(event) {
|
4059
|
+
event.preventDefault();
|
4060
|
+
event.stopPropagation();
|
4061
|
+
if (this.contextMenu) {
|
4062
|
+
this.contextMenu.show(this.popupElement);
|
4063
|
+
}
|
4064
|
+
}
|
4065
|
+
onCommandClick(event) {
|
4066
|
+
// avoid triggering the document click listener to keep the popup open
|
4067
|
+
if (event.originalEvent) {
|
4068
|
+
event.originalEvent.stopPropagation();
|
4069
|
+
event.originalEvent.preventDefault();
|
4070
|
+
}
|
4071
|
+
const eventArgs = {
|
4072
|
+
...event.item.originalCommand
|
4073
|
+
};
|
4074
|
+
this.executeCommand.emit(eventArgs);
|
4075
|
+
}
|
4076
|
+
messageFor(text) {
|
4077
|
+
if (this.messages?.[text]) {
|
4078
|
+
return this.messages[text];
|
4079
|
+
}
|
4080
|
+
return this.localization?.get(text);
|
4081
|
+
}
|
4082
|
+
handlePromptRequest() {
|
4083
|
+
if (this.streaming) {
|
4084
|
+
this.promptRequestCancel.emit();
|
4085
|
+
return;
|
4086
|
+
}
|
4087
|
+
if (!this.promptValue) {
|
4088
|
+
return;
|
4089
|
+
}
|
4090
|
+
const eventArgs = {
|
4091
|
+
prompt: this.promptValue
|
4092
|
+
};
|
4093
|
+
this.promptRequest.emit(eventArgs);
|
4094
|
+
}
|
4095
|
+
mergeWithDefaultActions(userActions) {
|
4096
|
+
if (!userActions || userActions.length === 0) {
|
4097
|
+
return [];
|
4098
|
+
}
|
4099
|
+
return userActions.map(userAction => {
|
4100
|
+
const defaultAction = this.defaultOutputActions.find(action => action.name === userAction?.name);
|
4101
|
+
if (defaultAction) {
|
4102
|
+
return { ...defaultAction, ...userAction };
|
4103
|
+
}
|
4104
|
+
return userAction;
|
4105
|
+
});
|
4106
|
+
}
|
4107
|
+
transformCommands = (commands) => commands.map(command => ({
|
4108
|
+
text: command.text,
|
4109
|
+
icon: command.icon,
|
4110
|
+
svgIcon: command.svgIcon,
|
4111
|
+
disabled: command.disabled,
|
4112
|
+
originalCommand: command,
|
4113
|
+
items: command.children ? this.transformCommands(command.children) : undefined
|
4114
|
+
}));
|
4115
|
+
outsideClickClose(e) {
|
4116
|
+
if (!this.element.nativeElement.contains(e.target)) {
|
4117
|
+
this.ngZone.run(() => {
|
4118
|
+
this.close.emit();
|
4119
|
+
});
|
4120
|
+
}
|
4121
|
+
}
|
4122
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptContentComponent, deps: [{ token: i0.NgZone }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i1$1.LocalizationService, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Component });
|
4123
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: InlineAIPromptContentComponent, isStandalone: true, selector: "kendo-inlineaiprompt-content", inputs: { popupElement: "popupElement", promptValue: "promptValue", placeholder: "placeholder", promptOutput: "promptOutput", enableTextToSpeech: "enableTextToSpeech", streaming: "streaming", width: "width", maxHeight: "maxHeight", appendTo: "appendTo", outputActions: "outputActions", promptCommands: "promptCommands", outputTemplate: "outputTemplate" }, outputs: { promptRequest: "promptRequest", executeCommand: "executeCommand", outputActionClick: "outputActionClick", promptRequestCancel: "promptRequestCancel", close: "close", promptValueChange: "promptValueChange" }, host: { listeners: { "keydown": "onEscapeKey($event)" }, properties: { "class.k-prompt": "this.className", "attr.dir": "this.dirAttr", "style.max-height": "this.maxHeightStyle", "style.width": "this.widthStyle" } }, providers: [
|
4124
|
+
LocalizationService,
|
4125
|
+
{
|
4126
|
+
provide: L10N_PREFIX,
|
4127
|
+
useValue: 'kendo.inlineaiprompt',
|
4128
|
+
},
|
4129
|
+
], viewQueries: [{ propertyName: "textArea", first: true, predicate: TextAreaComponent, descendants: true }, { propertyName: "contextMenu", first: true, predicate: ["kendoContextMenu"], descendants: true }], exportAs: ["kendoInlineAIPromptContent"], ngImport: i0, template: `
|
4130
|
+
<ng-container kendoInlineAIPromptLocalizedMessages
|
4131
|
+
i18n-commandsButtonTitle="kendo.inlineaiprompt.commandsButtonTitle|Sets the Commands button title."
|
4132
|
+
commandsButtonTitle="Command Menu"
|
4133
|
+
i18n-generateButtonTitle="kendo.inlineaiprompt.generateButtonTitle|Sets the Generate button title."
|
4134
|
+
generateButtonTitle="Generate"
|
4135
|
+
i18n-speechToTextButtonTitle="kendo.inlineaiprompt.speechToTextButtonTitle|Sets the Speech to Text button title."
|
4136
|
+
speechToTextButtonTitle="Speech to Text"
|
4137
|
+
>
|
4138
|
+
</ng-container>
|
4139
|
+
<div class="k-prompt-content">
|
4140
|
+
<div class="k-prompt-view">
|
4141
|
+
<kendo-card *ngIf="promptOutput" width="100%">
|
4142
|
+
<kendo-card-body>
|
4143
|
+
<ng-container
|
4144
|
+
*ngIf="outputTemplate"
|
4145
|
+
[ngTemplateOutlet]="outputTemplate"
|
4146
|
+
[ngTemplateOutletContext]="{ $implicit: promptOutput }"
|
4147
|
+
>
|
4148
|
+
</ng-container>
|
4149
|
+
<ng-container *ngIf="!outputTemplate">{{promptOutput.output}}</ng-container>
|
4150
|
+
</kendo-card-body>
|
4151
|
+
<kendo-card-actions *ngIf="outputActions && outputActions.length > 0">
|
4152
|
+
<ng-container *ngFor="let action of outputActions">
|
4153
|
+
<button kendoButton *ngIf="action.type === 'button'"
|
4154
|
+
[attr.title]="action?.title"
|
4155
|
+
[fillMode]="action?.fillMode"
|
4156
|
+
[themeColor]="action?.themeColor"
|
4157
|
+
[rounded]="action?.rounded"
|
4158
|
+
[icon]="action?.icon"
|
4159
|
+
[svgIcon]="action?.svgIcon"
|
4160
|
+
(click)="onActionClick(action)"
|
4161
|
+
>{{action?.text}}</button>
|
4162
|
+
<div *ngIf="action.type === 'spacer'" class="k-spacer"></div>
|
4163
|
+
</ng-container>
|
4164
|
+
</kendo-card-actions>
|
4165
|
+
</kendo-card>
|
4166
|
+
<kendo-textarea
|
4167
|
+
[value]="promptValue ? promptValue : null"
|
4168
|
+
(valueChange)="handlePromptValueChange($event)"
|
4169
|
+
[rows]="initialRows"
|
4170
|
+
resizable="auto"
|
4171
|
+
flow="horizontal"
|
4172
|
+
[placeholder]="placeholder"
|
4173
|
+
[showPrefixSeparator]="true"
|
4174
|
+
[selectOnFocus]="true"
|
4175
|
+
[maxResizableRows]="maxRows"
|
4176
|
+
(keydown)="handleTextAreaKeydown($event)"
|
4177
|
+
>
|
4178
|
+
<kendo-textarea-prefix>
|
4179
|
+
<button
|
4180
|
+
kendoButton
|
4181
|
+
#commandMenuButton
|
4182
|
+
*ngIf="promptCommands && promptCommands.length > 0"
|
4183
|
+
[attr.title]="messageFor('commandsButtonTitle')"
|
4184
|
+
fillMode="flat"
|
4185
|
+
icon="menu"
|
4186
|
+
[svgIcon]="commandMenuIcon"
|
4187
|
+
(click)="onCommandButtonClick($event)"
|
4188
|
+
></button>
|
4189
|
+
<button
|
4190
|
+
kendoSpeechToTextButton
|
4191
|
+
*ngIf="enableTextToSpeech"
|
4192
|
+
[attr.title]="messageFor('speechToTextButtonTitle')"
|
4193
|
+
fillMode="flat"
|
4194
|
+
(result)="handleSpeechResult($event)"
|
4195
|
+
(start)="isListening = true"
|
4196
|
+
(end)="isListening = false"
|
4197
|
+
></button>
|
4198
|
+
</kendo-textarea-prefix>
|
4199
|
+
<kendo-textarea-suffix>
|
4200
|
+
<button
|
4201
|
+
kendoButton
|
4202
|
+
[attr.title]="messageFor('generateButtonTitle')"
|
4203
|
+
fillMode="flat"
|
4204
|
+
class="k-prompt-send"
|
4205
|
+
[ngClass]="{ 'k-generating': streaming, 'k-active': streaming }"
|
4206
|
+
(click)="handlePromptRequest()"
|
4207
|
+
[disabled]="!streaming && (!promptValue?.trim() || isListening)"
|
4208
|
+
[svgIcon]="streaming ? stopGenerationIcon : sendIcon"
|
4209
|
+
[icon]="streaming ? 'stop-sm' : 'paper-plane'"
|
4210
|
+
></button>
|
4211
|
+
</kendo-textarea-suffix>
|
4212
|
+
</kendo-textarea>
|
4213
|
+
</div>
|
4214
|
+
</div>
|
4215
|
+
<kendo-contextmenu
|
4216
|
+
#kendoContextMenu
|
4217
|
+
[alignToAnchor]="true"
|
4218
|
+
[items]="commandMenuItems"
|
4219
|
+
[appendTo]="appendTo"
|
4220
|
+
class="k-hidden"
|
4221
|
+
(select)="onCommandClick($event)">
|
4222
|
+
</kendo-contextmenu>
|
4223
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: LocalizedMessagesDirective, selector: "[kendoInlineAIPromptLocalizedMessages]" }, { kind: "component", type: i2.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: "component", type: i2.SpeechToTextButtonComponent, selector: "button[kendoSpeechToTextButton]", inputs: ["disabled", "size", "rounded", "fillMode", "themeColor", "integrationMode", "lang", "continuous", "interimResults", "maxAlternatives"], outputs: ["start", "end", "result", "error", "click"], exportAs: ["kendoSpeechToTextButton"] }, { kind: "component", type: i3.TextAreaComponent, selector: "kendo-textarea", inputs: ["focusableId", "flow", "inputAttributes", "adornmentsOrientation", "rows", "cols", "maxlength", "maxResizableRows", "tabindex", "tabIndex", "resizable", "size", "rounded", "fillMode", "showPrefixSeparator", "showSuffixSeparator"], outputs: ["focus", "blur", "valueChange"], exportAs: ["kendoTextArea"] }, { kind: "component", type: i3.TextAreaPrefixComponent, selector: "kendo-textarea-prefix", inputs: ["flow", "orientation"], exportAs: ["kendoTextAreaPrefix"] }, { kind: "component", type: i3.TextAreaSuffixComponent, selector: "kendo-textarea-suffix", inputs: ["flow", "orientation"], exportAs: ["kendoTextAreaSuffix"] }, { kind: "component", type: i4.ContextMenuComponent, selector: "kendo-contextmenu", inputs: ["showOn", "target", "filter", "alignToAnchor", "vertical", "popupAnimate", "popupAlign", "anchorAlign", "collision", "appendTo", "ariaLabel"], outputs: ["popupOpen", "popupClose", "select", "open", "close"], exportAs: ["kendoContextMenu"] }, { kind: "component", type: i5.CardComponent, selector: "kendo-card", inputs: ["orientation", "width"] }, { kind: "component", type: i5.CardActionsComponent, selector: "kendo-card-actions", inputs: ["orientation", "layout", "actions"], outputs: ["action"] }, { kind: "component", type: i5.CardBodyComponent, selector: "kendo-card-body" }] });
|
4224
|
+
}
|
4225
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptContentComponent, decorators: [{
|
4226
|
+
type: Component,
|
4227
|
+
args: [{
|
4228
|
+
exportAs: 'kendoInlineAIPromptContent',
|
4229
|
+
selector: 'kendo-inlineaiprompt-content',
|
4230
|
+
providers: [
|
4231
|
+
LocalizationService,
|
4232
|
+
{
|
4233
|
+
provide: L10N_PREFIX,
|
4234
|
+
useValue: 'kendo.inlineaiprompt',
|
4235
|
+
},
|
4236
|
+
],
|
4237
|
+
template: `
|
4238
|
+
<ng-container kendoInlineAIPromptLocalizedMessages
|
4239
|
+
i18n-commandsButtonTitle="kendo.inlineaiprompt.commandsButtonTitle|Sets the Commands button title."
|
4240
|
+
commandsButtonTitle="Command Menu"
|
4241
|
+
i18n-generateButtonTitle="kendo.inlineaiprompt.generateButtonTitle|Sets the Generate button title."
|
4242
|
+
generateButtonTitle="Generate"
|
4243
|
+
i18n-speechToTextButtonTitle="kendo.inlineaiprompt.speechToTextButtonTitle|Sets the Speech to Text button title."
|
4244
|
+
speechToTextButtonTitle="Speech to Text"
|
4245
|
+
>
|
4246
|
+
</ng-container>
|
4247
|
+
<div class="k-prompt-content">
|
4248
|
+
<div class="k-prompt-view">
|
4249
|
+
<kendo-card *ngIf="promptOutput" width="100%">
|
4250
|
+
<kendo-card-body>
|
4251
|
+
<ng-container
|
4252
|
+
*ngIf="outputTemplate"
|
4253
|
+
[ngTemplateOutlet]="outputTemplate"
|
4254
|
+
[ngTemplateOutletContext]="{ $implicit: promptOutput }"
|
4255
|
+
>
|
4256
|
+
</ng-container>
|
4257
|
+
<ng-container *ngIf="!outputTemplate">{{promptOutput.output}}</ng-container>
|
4258
|
+
</kendo-card-body>
|
4259
|
+
<kendo-card-actions *ngIf="outputActions && outputActions.length > 0">
|
4260
|
+
<ng-container *ngFor="let action of outputActions">
|
4261
|
+
<button kendoButton *ngIf="action.type === 'button'"
|
4262
|
+
[attr.title]="action?.title"
|
4263
|
+
[fillMode]="action?.fillMode"
|
4264
|
+
[themeColor]="action?.themeColor"
|
4265
|
+
[rounded]="action?.rounded"
|
4266
|
+
[icon]="action?.icon"
|
4267
|
+
[svgIcon]="action?.svgIcon"
|
4268
|
+
(click)="onActionClick(action)"
|
4269
|
+
>{{action?.text}}</button>
|
4270
|
+
<div *ngIf="action.type === 'spacer'" class="k-spacer"></div>
|
4271
|
+
</ng-container>
|
4272
|
+
</kendo-card-actions>
|
4273
|
+
</kendo-card>
|
4274
|
+
<kendo-textarea
|
4275
|
+
[value]="promptValue ? promptValue : null"
|
4276
|
+
(valueChange)="handlePromptValueChange($event)"
|
4277
|
+
[rows]="initialRows"
|
4278
|
+
resizable="auto"
|
4279
|
+
flow="horizontal"
|
4280
|
+
[placeholder]="placeholder"
|
4281
|
+
[showPrefixSeparator]="true"
|
4282
|
+
[selectOnFocus]="true"
|
4283
|
+
[maxResizableRows]="maxRows"
|
4284
|
+
(keydown)="handleTextAreaKeydown($event)"
|
4285
|
+
>
|
4286
|
+
<kendo-textarea-prefix>
|
4287
|
+
<button
|
4288
|
+
kendoButton
|
4289
|
+
#commandMenuButton
|
4290
|
+
*ngIf="promptCommands && promptCommands.length > 0"
|
4291
|
+
[attr.title]="messageFor('commandsButtonTitle')"
|
4292
|
+
fillMode="flat"
|
4293
|
+
icon="menu"
|
4294
|
+
[svgIcon]="commandMenuIcon"
|
4295
|
+
(click)="onCommandButtonClick($event)"
|
4296
|
+
></button>
|
4297
|
+
<button
|
4298
|
+
kendoSpeechToTextButton
|
4299
|
+
*ngIf="enableTextToSpeech"
|
4300
|
+
[attr.title]="messageFor('speechToTextButtonTitle')"
|
4301
|
+
fillMode="flat"
|
4302
|
+
(result)="handleSpeechResult($event)"
|
4303
|
+
(start)="isListening = true"
|
4304
|
+
(end)="isListening = false"
|
4305
|
+
></button>
|
4306
|
+
</kendo-textarea-prefix>
|
4307
|
+
<kendo-textarea-suffix>
|
4308
|
+
<button
|
4309
|
+
kendoButton
|
4310
|
+
[attr.title]="messageFor('generateButtonTitle')"
|
4311
|
+
fillMode="flat"
|
4312
|
+
class="k-prompt-send"
|
4313
|
+
[ngClass]="{ 'k-generating': streaming, 'k-active': streaming }"
|
4314
|
+
(click)="handlePromptRequest()"
|
4315
|
+
[disabled]="!streaming && (!promptValue?.trim() || isListening)"
|
4316
|
+
[svgIcon]="streaming ? stopGenerationIcon : sendIcon"
|
4317
|
+
[icon]="streaming ? 'stop-sm' : 'paper-plane'"
|
4318
|
+
></button>
|
4319
|
+
</kendo-textarea-suffix>
|
4320
|
+
</kendo-textarea>
|
4321
|
+
</div>
|
4322
|
+
</div>
|
4323
|
+
<kendo-contextmenu
|
4324
|
+
#kendoContextMenu
|
4325
|
+
[alignToAnchor]="true"
|
4326
|
+
[items]="commandMenuItems"
|
4327
|
+
[appendTo]="appendTo"
|
4328
|
+
class="k-hidden"
|
4329
|
+
(select)="onCommandClick($event)">
|
4330
|
+
</kendo-contextmenu>
|
4331
|
+
`,
|
4332
|
+
standalone: true,
|
4333
|
+
imports: [NgClass, NgIf, NgFor, NgTemplateOutlet, LocalizedMessagesDirective, KENDO_BUTTONS, KENDO_TEXTAREA, KENDO_CONTEXTMENU, KENDO_CARD],
|
4334
|
+
}]
|
4335
|
+
}], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i1$1.LocalizationService, decorators: [{
|
4336
|
+
type: Optional
|
4337
|
+
}, {
|
4338
|
+
type: SkipSelf
|
4339
|
+
}] }]; }, propDecorators: { className: [{
|
4340
|
+
type: HostBinding,
|
4341
|
+
args: ['class.k-prompt']
|
4342
|
+
}], dirAttr: [{
|
4343
|
+
type: HostBinding,
|
4344
|
+
args: ['attr.dir']
|
4345
|
+
}], maxHeightStyle: [{
|
4346
|
+
type: HostBinding,
|
4347
|
+
args: ['style.max-height']
|
4348
|
+
}], widthStyle: [{
|
4349
|
+
type: HostBinding,
|
4350
|
+
args: ['style.width']
|
4351
|
+
}], popupElement: [{
|
4352
|
+
type: Input
|
4353
|
+
}], promptValue: [{
|
4354
|
+
type: Input
|
4355
|
+
}], placeholder: [{
|
4356
|
+
type: Input
|
4357
|
+
}], promptOutput: [{
|
4358
|
+
type: Input
|
4359
|
+
}], enableTextToSpeech: [{
|
4360
|
+
type: Input
|
4361
|
+
}], streaming: [{
|
4362
|
+
type: Input
|
4363
|
+
}], width: [{
|
4364
|
+
type: Input
|
4365
|
+
}], maxHeight: [{
|
4366
|
+
type: Input
|
4367
|
+
}], appendTo: [{
|
4368
|
+
type: Input
|
4369
|
+
}], outputActions: [{
|
4370
|
+
type: Input
|
4371
|
+
}], promptCommands: [{
|
4372
|
+
type: Input
|
4373
|
+
}], outputTemplate: [{
|
4374
|
+
type: Input
|
4375
|
+
}], promptRequest: [{
|
4376
|
+
type: Output
|
4377
|
+
}], executeCommand: [{
|
4378
|
+
type: Output
|
4379
|
+
}], outputActionClick: [{
|
4380
|
+
type: Output
|
4381
|
+
}], promptRequestCancel: [{
|
4382
|
+
type: Output
|
4383
|
+
}], close: [{
|
4384
|
+
type: Output
|
4385
|
+
}], promptValueChange: [{
|
4386
|
+
type: Output
|
4387
|
+
}], onEscapeKey: [{
|
4388
|
+
type: HostListener,
|
4389
|
+
args: ['keydown', ['$event']]
|
4390
|
+
}], textArea: [{
|
4391
|
+
type: ViewChild,
|
4392
|
+
args: [TextAreaComponent]
|
4393
|
+
}], contextMenu: [{
|
4394
|
+
type: ViewChild,
|
4395
|
+
args: ['kendoContextMenu']
|
4396
|
+
}] } });
|
4397
|
+
|
4398
|
+
/**
|
4399
|
+
* Defines a template for displaying the output of the Inline AI Prompt.
|
4400
|
+
*
|
4401
|
+
* @example
|
4402
|
+
* ```html
|
4403
|
+
* <kendo-inlineaiprompt>
|
4404
|
+
* <ng-template kendoInlineAIPromptOutputTemplate let-output>
|
4405
|
+
* <div class="custom-output">
|
4406
|
+
* <h4>AI Response:</h4>
|
4407
|
+
* <p>{{ output.output }}</p>
|
4408
|
+
* </div>
|
4409
|
+
* </ng-template>
|
4410
|
+
* </kendo-inlineaiprompt>
|
4411
|
+
* ```
|
4412
|
+
*/
|
4413
|
+
class InlineAIPromptOutputTemplateDirective {
|
4414
|
+
templateRef;
|
4415
|
+
constructor(templateRef) {
|
4416
|
+
this.templateRef = templateRef;
|
4417
|
+
}
|
4418
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptOutputTemplateDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
4419
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: InlineAIPromptOutputTemplateDirective, isStandalone: true, selector: "[kendoInlineAIPromptOutputTemplate]", ngImport: i0 });
|
4420
|
+
}
|
4421
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptOutputTemplateDirective, decorators: [{
|
4422
|
+
type: Directive,
|
4423
|
+
args: [{
|
4424
|
+
selector: '[kendoInlineAIPromptOutputTemplate]',
|
4425
|
+
standalone: true
|
4426
|
+
}]
|
4427
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
|
4428
|
+
type: Optional
|
4429
|
+
}] }]; } });
|
4430
|
+
|
4431
|
+
/**
|
4432
|
+
* Represents the Kendo UI InlineAIPrompt component for Angular.
|
4433
|
+
*
|
4434
|
+
* @remarks
|
4435
|
+
* Supported children components are: {@link InlineAIPromptCustomMessagesComponent}
|
4436
|
+
*
|
4437
|
+
* @example
|
4438
|
+
* ```html
|
4439
|
+
* <kendo-inlineaiprompt
|
4440
|
+
* placeholder="Enter your prompt..."
|
4441
|
+
* [promptOutput]="promptOutput"
|
4442
|
+
* (promptRequest)="onPromptRequest($event)">
|
4443
|
+
* </kendo-inlineaiprompt>
|
4444
|
+
* ```
|
4445
|
+
*/
|
4446
|
+
class InlineAIPromptComponent {
|
4447
|
+
ngZone;
|
4448
|
+
element;
|
4449
|
+
/**
|
4450
|
+
* Sets the text of the TextArea.
|
4451
|
+
*/
|
4452
|
+
promptValue;
|
4453
|
+
/**
|
4454
|
+
* Sets the placeholder text that appears in the text area when it is empty.
|
4455
|
+
*/
|
4456
|
+
placeholder;
|
4457
|
+
/**
|
4458
|
+
* Sets the output data for the prompt.
|
4459
|
+
* The output displays as a card above the text area.
|
4460
|
+
*/
|
4461
|
+
promptOutput;
|
4462
|
+
/**
|
4463
|
+
* Controls the visibility and settings of the Speech to Text button.
|
4464
|
+
*
|
4465
|
+
* @default true
|
4466
|
+
*/
|
4467
|
+
enableTextToSpeech = true;
|
4468
|
+
/**
|
4469
|
+
* Sets the streaming state of the component.
|
4470
|
+
* When set to `true`, the send button displays a generating state and the component emits a `promptRequestCancel` event when you click it.
|
4471
|
+
*
|
4472
|
+
* @default false
|
4473
|
+
*/
|
4474
|
+
streaming = false;
|
4475
|
+
/**
|
4476
|
+
* Sets the width of the component.
|
4477
|
+
* Accepts a number for pixels or a string for other units.
|
4478
|
+
*
|
4479
|
+
* @default 550
|
4480
|
+
*/
|
4481
|
+
width = 550;
|
4482
|
+
/**
|
4483
|
+
* Sets the maximum height of the component.
|
4484
|
+
* Accepts a number for pixels or a string for other units.
|
4485
|
+
*/
|
4486
|
+
maxHeight;
|
4487
|
+
/**
|
4488
|
+
* Sets the output actions that display in the output card.
|
4489
|
+
* The default actions are `copy`, `retry`, and `discard`.
|
4490
|
+
* To customize the appearance and order of the default actions, define them with the same `name`.
|
4491
|
+
*/
|
4492
|
+
outputActions;
|
4493
|
+
/**
|
4494
|
+
* Sets the available prompt commands.
|
4495
|
+
*/
|
4496
|
+
promptCommands;
|
4497
|
+
/**
|
4498
|
+
* Sets the popup settings for the component.
|
4499
|
+
*/
|
4500
|
+
set popupSettings(settings) {
|
4501
|
+
this._popupSettings = { ...defaultPopupSettings, ...settings };
|
4502
|
+
}
|
4503
|
+
get popupSettings() {
|
4504
|
+
return this._popupSettings;
|
4505
|
+
}
|
4506
|
+
/**
|
4507
|
+
* Fires when you click the send button.
|
4508
|
+
*/
|
4509
|
+
promptRequest = new EventEmitter();
|
4510
|
+
/**
|
4511
|
+
* Fires when you click a command.
|
4512
|
+
*/
|
4513
|
+
executeCommand = new EventEmitter();
|
4514
|
+
/**
|
4515
|
+
* Fires when you click an output action button.
|
4516
|
+
*/
|
4517
|
+
outputActionClick = new EventEmitter();
|
4518
|
+
/**
|
4519
|
+
* Fires when you cancel the prompt request by clicking the stop button.
|
4520
|
+
*/
|
4521
|
+
promptRequestCancel = new EventEmitter();
|
4522
|
+
/**
|
4523
|
+
* Fires when the component closes, either by clicking outside the popup or by clicking the Discard action.
|
4524
|
+
*/
|
4525
|
+
close = new EventEmitter();
|
4526
|
+
/**
|
4527
|
+
* Fires when the value of the TextArea changes.
|
4528
|
+
*/
|
4529
|
+
promptValueChange = new EventEmitter();
|
4530
|
+
popupElement;
|
4531
|
+
popupViewContainer;
|
4532
|
+
contentComponent;
|
4533
|
+
outputTemplate;
|
4534
|
+
/**
|
4535
|
+
* @hidden
|
4536
|
+
*/
|
4537
|
+
calculateMeasurement = calculateMeasurement;
|
4538
|
+
_popupSettings = defaultPopupSettings;
|
4539
|
+
subs = new Subscription();
|
4540
|
+
constructor(ngZone, element) {
|
4541
|
+
this.ngZone = ngZone;
|
4542
|
+
this.element = element;
|
4543
|
+
validatePackage(packageMetadata);
|
4544
|
+
}
|
4545
|
+
ngAfterViewInit() {
|
4546
|
+
if (this.contentComponent && this.popupElement) {
|
4547
|
+
this.contentComponent.popupElement = this.popupElement;
|
4548
|
+
}
|
4549
|
+
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
4550
|
+
if (this.contentComponent && this.popupViewContainer) {
|
4551
|
+
this.contentComponent.appendTo = this.popupViewContainer;
|
4552
|
+
}
|
4553
|
+
});
|
4554
|
+
}
|
4555
|
+
ngOnDestroy() {
|
4556
|
+
this.subs.unsubscribe();
|
4557
|
+
}
|
4558
|
+
/**
|
4559
|
+
* Focuses the TextArea of the Inline AI Prompt.
|
4560
|
+
*/
|
4561
|
+
focus() {
|
4562
|
+
if (this.contentComponent?.textArea) {
|
4563
|
+
this.contentComponent.textArea.focus();
|
4564
|
+
}
|
4565
|
+
}
|
4566
|
+
/**
|
4567
|
+
* @hidden
|
4568
|
+
*/
|
4569
|
+
onPromptRequest(event) {
|
4570
|
+
this.promptRequest.emit(event);
|
4571
|
+
}
|
4572
|
+
/**
|
4573
|
+
* @hidden
|
4574
|
+
*/
|
4575
|
+
onExecuteCommand(event) {
|
4576
|
+
this.executeCommand.emit(event);
|
4577
|
+
}
|
4578
|
+
/**
|
4579
|
+
* @hidden
|
4580
|
+
*/
|
4581
|
+
onOutputActionClick(event) {
|
4582
|
+
this.outputActionClick.emit(event);
|
4583
|
+
}
|
4584
|
+
/**
|
4585
|
+
* @hidden
|
4586
|
+
*/
|
4587
|
+
onPromptRequestCancel() {
|
4588
|
+
this.promptRequestCancel.emit();
|
4589
|
+
}
|
4590
|
+
/**
|
4591
|
+
* @hidden
|
4592
|
+
*/
|
4593
|
+
onClose() {
|
4594
|
+
this.close.emit();
|
4595
|
+
}
|
4596
|
+
/**
|
4597
|
+
* @hidden
|
4598
|
+
*/
|
4599
|
+
onPromptValueChange(value) {
|
4600
|
+
this.promptValueChange.emit(value);
|
4601
|
+
}
|
4602
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptComponent, deps: [{ token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
4603
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: InlineAIPromptComponent, isStandalone: true, selector: "kendo-inlineaiprompt", inputs: { promptValue: "promptValue", placeholder: "placeholder", promptOutput: "promptOutput", enableTextToSpeech: "enableTextToSpeech", streaming: "streaming", width: "width", maxHeight: "maxHeight", outputActions: "outputActions", promptCommands: "promptCommands", popupSettings: "popupSettings" }, outputs: { promptRequest: "promptRequest", executeCommand: "executeCommand", outputActionClick: "outputActionClick", promptRequestCancel: "promptRequestCancel", close: "close", promptValueChange: "promptValueChange" }, providers: [
|
4604
|
+
LocalizationService,
|
4605
|
+
{
|
4606
|
+
provide: L10N_PREFIX,
|
4607
|
+
useValue: 'kendo.inlineaiprompt',
|
4608
|
+
},
|
4609
|
+
], queries: [{ propertyName: "outputTemplate", first: true, predicate: InlineAIPromptOutputTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "popupElement", first: true, predicate: PopupComponent, descendants: true, read: ElementRef }, { propertyName: "popupViewContainer", first: true, predicate: PopupComponent, descendants: true, read: ViewContainerRef }, { propertyName: "contentComponent", first: true, predicate: InlineAIPromptContentComponent, descendants: true }], exportAs: ["kendoInlineAIPrompt"], ngImport: i0, template: `
|
4610
|
+
<ng-container kendoInlineAIPromptLocalizedMessages
|
4611
|
+
i18n-commandsButtonTitle="kendo.inlineaiprompt.commandsButtonTitle|Sets the Commands button title."
|
4612
|
+
commandsButtonTitle="Command Menu"
|
4613
|
+
i18n-generateButtonTitle="kendo.inlineaiprompt.generateButtonTitle|Sets the Generate button title."
|
4614
|
+
generateButtonTitle="Generate"
|
4615
|
+
i18n-speechToTextButtonTitle="kendo.inlineaiprompt.speechToTextButtonTitle|Sets the Speech to Text button title."
|
4616
|
+
speechToTextButtonTitle="Speech to Text"
|
4617
|
+
>
|
4618
|
+
</ng-container>
|
4619
|
+
<kendo-popup
|
4620
|
+
[style.width]="calculateMeasurement(width)"
|
4621
|
+
[anchor]="popupSettings?.anchor"
|
4622
|
+
[anchorAlign]="popupSettings?.anchorAlign"
|
4623
|
+
[offset]="popupSettings?.offset"
|
4624
|
+
[popupAlign]="popupSettings?.popupAlign"
|
4625
|
+
[animate]="popupSettings?.animate"
|
4626
|
+
[collision]="popupSettings?.collision"
|
4627
|
+
[positionMode]="popupSettings?.positionMode"
|
4628
|
+
[margin]="popupSettings?.margin"
|
4629
|
+
[popupClass]="popupSettings?.popupClass || 'k-prompt-popup'"
|
4630
|
+
>
|
4631
|
+
<kendo-inlineaiprompt-content
|
4632
|
+
[style.width]="width"
|
4633
|
+
[promptValue]="promptValue"
|
4634
|
+
[placeholder]="placeholder"
|
4635
|
+
[promptOutput]="promptOutput"
|
4636
|
+
[enableTextToSpeech]="enableTextToSpeech"
|
4637
|
+
[streaming]="streaming"
|
4638
|
+
[maxHeight]="maxHeight"
|
4639
|
+
[outputActions]="outputActions"
|
4640
|
+
[promptCommands]="promptCommands"
|
4641
|
+
[outputTemplate]="outputTemplate?.templateRef"
|
4642
|
+
(promptRequest)="onPromptRequest($event)"
|
4643
|
+
(executeCommand)="onExecuteCommand($event)"
|
4644
|
+
(outputActionClick)="onOutputActionClick($event)"
|
4645
|
+
(promptRequestCancel)="onPromptRequestCancel()"
|
4646
|
+
(close)="onClose()"
|
4647
|
+
(promptValueChange)="onPromptValueChange($event)"
|
4648
|
+
>
|
4649
|
+
</kendo-inlineaiprompt-content>
|
4650
|
+
</kendo-popup>
|
4651
|
+
`, isInline: true, dependencies: [{ kind: "component", type: i1$2.PopupComponent, selector: "kendo-popup", inputs: ["animate", "anchor", "anchorAlign", "collision", "popupAlign", "copyAnchorStyles", "popupClass", "positionMode", "offset", "margin"], outputs: ["anchorViewportLeave", "close", "open", "positionChange"], exportAs: ["kendo-popup"] }, { kind: "component", type: InlineAIPromptContentComponent, selector: "kendo-inlineaiprompt-content", inputs: ["popupElement", "promptValue", "placeholder", "promptOutput", "enableTextToSpeech", "streaming", "width", "maxHeight", "appendTo", "outputActions", "promptCommands", "outputTemplate"], outputs: ["promptRequest", "executeCommand", "outputActionClick", "promptRequestCancel", "close", "promptValueChange"], exportAs: ["kendoInlineAIPromptContent"] }, { kind: "directive", type: LocalizedMessagesDirective, selector: "[kendoInlineAIPromptLocalizedMessages]" }] });
|
4652
|
+
}
|
4653
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptComponent, decorators: [{
|
4654
|
+
type: Component,
|
4655
|
+
args: [{
|
4656
|
+
exportAs: 'kendoInlineAIPrompt',
|
4657
|
+
selector: 'kendo-inlineaiprompt',
|
4658
|
+
providers: [
|
4659
|
+
LocalizationService,
|
4660
|
+
{
|
4661
|
+
provide: L10N_PREFIX,
|
4662
|
+
useValue: 'kendo.inlineaiprompt',
|
4663
|
+
},
|
4664
|
+
],
|
4665
|
+
template: `
|
4666
|
+
<ng-container kendoInlineAIPromptLocalizedMessages
|
4667
|
+
i18n-commandsButtonTitle="kendo.inlineaiprompt.commandsButtonTitle|Sets the Commands button title."
|
4668
|
+
commandsButtonTitle="Command Menu"
|
4669
|
+
i18n-generateButtonTitle="kendo.inlineaiprompt.generateButtonTitle|Sets the Generate button title."
|
4670
|
+
generateButtonTitle="Generate"
|
4671
|
+
i18n-speechToTextButtonTitle="kendo.inlineaiprompt.speechToTextButtonTitle|Sets the Speech to Text button title."
|
4672
|
+
speechToTextButtonTitle="Speech to Text"
|
4673
|
+
>
|
4674
|
+
</ng-container>
|
4675
|
+
<kendo-popup
|
4676
|
+
[style.width]="calculateMeasurement(width)"
|
4677
|
+
[anchor]="popupSettings?.anchor"
|
4678
|
+
[anchorAlign]="popupSettings?.anchorAlign"
|
4679
|
+
[offset]="popupSettings?.offset"
|
4680
|
+
[popupAlign]="popupSettings?.popupAlign"
|
4681
|
+
[animate]="popupSettings?.animate"
|
4682
|
+
[collision]="popupSettings?.collision"
|
4683
|
+
[positionMode]="popupSettings?.positionMode"
|
4684
|
+
[margin]="popupSettings?.margin"
|
4685
|
+
[popupClass]="popupSettings?.popupClass || 'k-prompt-popup'"
|
4686
|
+
>
|
4687
|
+
<kendo-inlineaiprompt-content
|
4688
|
+
[style.width]="width"
|
4689
|
+
[promptValue]="promptValue"
|
4690
|
+
[placeholder]="placeholder"
|
4691
|
+
[promptOutput]="promptOutput"
|
4692
|
+
[enableTextToSpeech]="enableTextToSpeech"
|
4693
|
+
[streaming]="streaming"
|
4694
|
+
[maxHeight]="maxHeight"
|
4695
|
+
[outputActions]="outputActions"
|
4696
|
+
[promptCommands]="promptCommands"
|
4697
|
+
[outputTemplate]="outputTemplate?.templateRef"
|
4698
|
+
(promptRequest)="onPromptRequest($event)"
|
4699
|
+
(executeCommand)="onExecuteCommand($event)"
|
4700
|
+
(outputActionClick)="onOutputActionClick($event)"
|
4701
|
+
(promptRequestCancel)="onPromptRequestCancel()"
|
4702
|
+
(close)="onClose()"
|
4703
|
+
(promptValueChange)="onPromptValueChange($event)"
|
4704
|
+
>
|
4705
|
+
</kendo-inlineaiprompt-content>
|
4706
|
+
</kendo-popup>
|
4707
|
+
`,
|
4708
|
+
standalone: true,
|
4709
|
+
imports: [KENDO_POPUP, InlineAIPromptContentComponent, LocalizedMessagesDirective],
|
4710
|
+
}]
|
4711
|
+
}], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.ElementRef }]; }, propDecorators: { promptValue: [{
|
4712
|
+
type: Input
|
4713
|
+
}], placeholder: [{
|
4714
|
+
type: Input
|
4715
|
+
}], promptOutput: [{
|
4716
|
+
type: Input
|
4717
|
+
}], enableTextToSpeech: [{
|
4718
|
+
type: Input
|
4719
|
+
}], streaming: [{
|
4720
|
+
type: Input
|
4721
|
+
}], width: [{
|
4722
|
+
type: Input
|
4723
|
+
}], maxHeight: [{
|
4724
|
+
type: Input
|
4725
|
+
}], outputActions: [{
|
4726
|
+
type: Input
|
4727
|
+
}], promptCommands: [{
|
4728
|
+
type: Input
|
4729
|
+
}], popupSettings: [{
|
4730
|
+
type: Input
|
4731
|
+
}], promptRequest: [{
|
4732
|
+
type: Output
|
4733
|
+
}], executeCommand: [{
|
4734
|
+
type: Output
|
4735
|
+
}], outputActionClick: [{
|
4736
|
+
type: Output
|
4737
|
+
}], promptRequestCancel: [{
|
4738
|
+
type: Output
|
4739
|
+
}], close: [{
|
4740
|
+
type: Output
|
4741
|
+
}], promptValueChange: [{
|
4742
|
+
type: Output
|
4743
|
+
}], popupElement: [{
|
4744
|
+
type: ViewChild,
|
4745
|
+
args: [PopupComponent, { read: ElementRef }]
|
4746
|
+
}], popupViewContainer: [{
|
4747
|
+
type: ViewChild,
|
4748
|
+
args: [PopupComponent, { read: ViewContainerRef }]
|
4749
|
+
}], contentComponent: [{
|
4750
|
+
type: ViewChild,
|
4751
|
+
args: [InlineAIPromptContentComponent]
|
4752
|
+
}], outputTemplate: [{
|
4753
|
+
type: ContentChild,
|
4754
|
+
args: [InlineAIPromptOutputTemplateDirective]
|
4755
|
+
}] } });
|
4756
|
+
|
4757
|
+
/**
|
4758
|
+
* Represents the custom messages component of the Inline AI Prompt.
|
4759
|
+
*
|
4760
|
+
* Use this component to override default messages for the Inline AI Prompt.
|
4761
|
+
*
|
4762
|
+
* @example
|
4763
|
+
* ```html
|
4764
|
+
* <kendo-inlineaiprompt-messages
|
4765
|
+
* commandsButtonTitle="Commands Menu"
|
4766
|
+
* generateButtonTitle="Generate">
|
4767
|
+
* </kendo-inlineaiprompt-messages>
|
4768
|
+
* ```
|
4769
|
+
*/
|
4770
|
+
class InlineAIPromptCustomMessagesComponent extends Messages {
|
4771
|
+
service;
|
4772
|
+
constructor(service) {
|
4773
|
+
super();
|
4774
|
+
this.service = service;
|
4775
|
+
}
|
4776
|
+
get override() {
|
4777
|
+
return true;
|
4778
|
+
}
|
4779
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptCustomMessagesComponent, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
4780
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: InlineAIPromptCustomMessagesComponent, isStandalone: true, selector: "kendo-inlineaiprompt-messages", providers: [
|
4781
|
+
{
|
4782
|
+
provide: Messages,
|
4783
|
+
useExisting: forwardRef(() => InlineAIPromptCustomMessagesComponent)
|
4784
|
+
}
|
4785
|
+
], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
|
4786
|
+
}
|
4787
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptCustomMessagesComponent, decorators: [{
|
4788
|
+
type: Component,
|
4789
|
+
args: [{
|
4790
|
+
providers: [
|
4791
|
+
{
|
4792
|
+
provide: Messages,
|
4793
|
+
useExisting: forwardRef(() => InlineAIPromptCustomMessagesComponent)
|
4794
|
+
}
|
4795
|
+
],
|
4796
|
+
selector: 'kendo-inlineaiprompt-messages',
|
4797
|
+
template: ``,
|
4798
|
+
standalone: true
|
4799
|
+
}]
|
4800
|
+
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; } });
|
4801
|
+
|
3787
4802
|
/**
|
3788
4803
|
* Utility array that contains all AIPrompt related components and directives.
|
3789
4804
|
*
|
@@ -3838,6 +4853,11 @@ const KENDO_CHAT = [
|
|
3838
4853
|
HeroCardComponent,
|
3839
4854
|
ChatMessageBoxTemplateDirective
|
3840
4855
|
];
|
4856
|
+
const KENDO_INLINEAIPROMPT = [
|
4857
|
+
InlineAIPromptComponent,
|
4858
|
+
InlineAIPromptOutputTemplateDirective,
|
4859
|
+
InlineAIPromptCustomMessagesComponent
|
4860
|
+
];
|
3841
4861
|
/**
|
3842
4862
|
* Utility array that contains all `@progress/kendo-angular-conversational-ui` related components and directives.
|
3843
4863
|
*
|
@@ -3860,7 +4880,8 @@ const KENDO_CHAT = [
|
|
3860
4880
|
*/
|
3861
4881
|
const KENDO_CONVERSATIONALUI = [
|
3862
4882
|
...KENDO_AIPROMPT,
|
3863
|
-
...KENDO_CHAT
|
4883
|
+
...KENDO_CHAT,
|
4884
|
+
...KENDO_INLINEAIPROMPT
|
3864
4885
|
];
|
3865
4886
|
|
3866
4887
|
// IMPORTANT: NgModule export kept for backwards compatibility
|
@@ -3953,8 +4974,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
3953
4974
|
*/
|
3954
4975
|
class ConversationalUIModule {
|
3955
4976
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConversationalUIModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
3956
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: ConversationalUIModule, imports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent, CustomViewComponent, AIPromptCustomMessagesComponent, AIPromptToolbarActionsDirective, AIPromptToolbarFocusableDirective, AIPromptOutputTemplateDirective, AIPromptOutputBodyTemplateDirective, ChatComponent, CustomMessagesComponent, AttachmentTemplateDirective, MessageTemplateDirective, HeroCardComponent, ChatMessageBoxTemplateDirective], exports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent, CustomViewComponent, AIPromptCustomMessagesComponent, AIPromptToolbarActionsDirective, AIPromptToolbarFocusableDirective, AIPromptOutputTemplateDirective, AIPromptOutputBodyTemplateDirective, ChatComponent, CustomMessagesComponent, AttachmentTemplateDirective, MessageTemplateDirective, HeroCardComponent, ChatMessageBoxTemplateDirective] });
|
3957
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConversationalUIModule, providers: [IconsService, PopupService, ResizeBatchService, DialogContainerService, DialogService, WindowService, WindowContainerService], imports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent, ChatComponent, HeroCardComponent] });
|
4977
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: ConversationalUIModule, imports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent, CustomViewComponent, AIPromptCustomMessagesComponent, AIPromptToolbarActionsDirective, AIPromptToolbarFocusableDirective, AIPromptOutputTemplateDirective, AIPromptOutputBodyTemplateDirective, ChatComponent, CustomMessagesComponent, AttachmentTemplateDirective, MessageTemplateDirective, HeroCardComponent, ChatMessageBoxTemplateDirective, InlineAIPromptComponent, InlineAIPromptOutputTemplateDirective, InlineAIPromptCustomMessagesComponent], exports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent, CustomViewComponent, AIPromptCustomMessagesComponent, AIPromptToolbarActionsDirective, AIPromptToolbarFocusableDirective, AIPromptOutputTemplateDirective, AIPromptOutputBodyTemplateDirective, ChatComponent, CustomMessagesComponent, AttachmentTemplateDirective, MessageTemplateDirective, HeroCardComponent, ChatMessageBoxTemplateDirective, InlineAIPromptComponent, InlineAIPromptOutputTemplateDirective, InlineAIPromptCustomMessagesComponent] });
|
4978
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConversationalUIModule, providers: [IconsService, PopupService, ResizeBatchService, DialogContainerService, DialogService, WindowService, WindowContainerService], imports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent, ChatComponent, HeroCardComponent, InlineAIPromptComponent] });
|
3958
4979
|
}
|
3959
4980
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConversationalUIModule, decorators: [{
|
3960
4981
|
type: NgModule,
|
@@ -3965,9 +4986,141 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
3965
4986
|
}]
|
3966
4987
|
}] });
|
3967
4988
|
|
4989
|
+
/**
|
4990
|
+
* Provides a service for opening Inline AI Prompt components dynamically.
|
4991
|
+
*
|
4992
|
+
* @example
|
4993
|
+
* ```ts
|
4994
|
+
* import { InlineAIPromptService } from '@progress/kendo-angular-conversational-ui';
|
4995
|
+
*
|
4996
|
+
* constructor(private inlineAIPromptService: InlineAIPromptService) {}
|
4997
|
+
*
|
4998
|
+
* openPrompt(anchor: ElementRef) {
|
4999
|
+
* const promptRef = this.inlineAIPromptService.open({
|
5000
|
+
* anchor: anchor,
|
5001
|
+
* placeholder: 'Enter your prompt...'
|
5002
|
+
* });
|
5003
|
+
* }
|
5004
|
+
* ```
|
5005
|
+
*/
|
5006
|
+
class InlineAIPromptService {
|
5007
|
+
popupService;
|
5008
|
+
constructor(popupService) {
|
5009
|
+
this.popupService = popupService;
|
5010
|
+
}
|
5011
|
+
/**
|
5012
|
+
* Opens an Inline AI Prompt component in a popup. The popup appears near the specified anchor element or at the provided offset coordinates.
|
5013
|
+
*
|
5014
|
+
* @param {InlineAIPromptSettings} options - The options for the InlineAIPromptComponent.
|
5015
|
+
* @returns {PopupRef} A reference to the popup.
|
5016
|
+
*/
|
5017
|
+
open(options) {
|
5018
|
+
const popupSettings = { ...defaultPopupSettings, ...options?.popupSettings };
|
5019
|
+
const popupRef = this.popupService.open({
|
5020
|
+
...(options?.popupSettings?.anchor && { anchor: options.popupSettings.anchor }),
|
5021
|
+
popupClass: 'k-prompt-popup',
|
5022
|
+
...popupSettings,
|
5023
|
+
content: InlineAIPromptContentComponent,
|
5024
|
+
});
|
5025
|
+
const promptInstance = popupRef.content?.instance;
|
5026
|
+
if (promptInstance) {
|
5027
|
+
const popupViewContainer = popupRef.popup.injector.get(ViewContainerRef);
|
5028
|
+
promptInstance.appendTo = popupViewContainer;
|
5029
|
+
promptInstance.popupElement = popupRef.popupElement;
|
5030
|
+
this.projectComponentInputs(promptInstance, options);
|
5031
|
+
if (promptInstance.close) {
|
5032
|
+
promptInstance.close.subscribe(() => {
|
5033
|
+
popupRef.close();
|
5034
|
+
});
|
5035
|
+
}
|
5036
|
+
if (popupRef.content.changeDetectorRef) {
|
5037
|
+
popupRef.content.changeDetectorRef.detectChanges();
|
5038
|
+
}
|
5039
|
+
}
|
5040
|
+
return popupRef;
|
5041
|
+
}
|
5042
|
+
/**
|
5043
|
+
* Projects the input options onto the component instance.
|
5044
|
+
*/
|
5045
|
+
projectComponentInputs(component, options) {
|
5046
|
+
if (!options) {
|
5047
|
+
return component;
|
5048
|
+
}
|
5049
|
+
Object.getOwnPropertyNames(options)
|
5050
|
+
.forEach((prop) => {
|
5051
|
+
component[prop] = options[prop];
|
5052
|
+
});
|
5053
|
+
return component;
|
5054
|
+
}
|
5055
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptService, deps: [{ token: i1$2.PopupService }], target: i0.ɵɵFactoryTarget.Injectable });
|
5056
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptService, providedIn: 'root' });
|
5057
|
+
}
|
5058
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptService, decorators: [{
|
5059
|
+
type: Injectable,
|
5060
|
+
args: [{
|
5061
|
+
providedIn: 'root'
|
5062
|
+
}]
|
5063
|
+
}], ctorParameters: function () { return [{ type: i1$2.PopupService }]; } });
|
5064
|
+
|
5065
|
+
/**
|
5066
|
+
* Defines the settings for opening an Inline AI Prompt through the `InlineAIPromptService`.
|
5067
|
+
*/
|
5068
|
+
class InlineAIPromptSettings {
|
5069
|
+
/**
|
5070
|
+
* Specifies the settings for the Inline AI Prompt Popup.
|
5071
|
+
*/
|
5072
|
+
popupSettings;
|
5073
|
+
/**
|
5074
|
+
* Sets the width of the component.
|
5075
|
+
* Accepts a number for pixels or a string for other units, for example, `50%`.
|
5076
|
+
*/
|
5077
|
+
width;
|
5078
|
+
/**
|
5079
|
+
* Sets the maximum height of the component.
|
5080
|
+
* Accepts a number for pixels or a string for other units, for example, `50%`.
|
5081
|
+
*/
|
5082
|
+
maxHeight;
|
5083
|
+
/**
|
5084
|
+
* Sets the value of the Inline AI Prompt TextArea.
|
5085
|
+
*/
|
5086
|
+
promptValue;
|
5087
|
+
/**
|
5088
|
+
* Sets the placeholder of the Inline AI Prompt TextArea.
|
5089
|
+
*/
|
5090
|
+
placeholder;
|
5091
|
+
/**
|
5092
|
+
* Sets the action buttons for the output card.
|
5093
|
+
*/
|
5094
|
+
outputActions;
|
5095
|
+
/**
|
5096
|
+
* Sets the commands for the Inline AI Prompt TextArea prefix.
|
5097
|
+
*/
|
5098
|
+
promptCommands;
|
5099
|
+
/**
|
5100
|
+
* Sets the prompt output to display.
|
5101
|
+
*/
|
5102
|
+
promptOutput;
|
5103
|
+
/**
|
5104
|
+
* Sets the visibility and configuration of the Speech to Text button.
|
5105
|
+
*/
|
5106
|
+
enableSpeechToTextButton;
|
5107
|
+
/**
|
5108
|
+
* Sets the template for the output content. If not provided, the default output template is used.
|
5109
|
+
*/
|
5110
|
+
outputTemplate;
|
5111
|
+
/**
|
5112
|
+
* Sets whether the send button turns into a stop button.
|
5113
|
+
*/
|
5114
|
+
streaming;
|
5115
|
+
/**
|
5116
|
+
* Sets the titles of the buttons shown in the Inline AI Prompt. Use for localization.
|
5117
|
+
*/
|
5118
|
+
messages;
|
5119
|
+
}
|
5120
|
+
|
3968
5121
|
/**
|
3969
5122
|
* Generated bundle index. Do not edit.
|
3970
5123
|
*/
|
3971
5124
|
|
3972
|
-
export { AIPromptComponent, AIPromptCustomMessagesComponent, AIPromptModule, AIPromptOutputBodyTemplateDirective, AIPromptOutputTemplateDirective, AIPromptToolbarActionsDirective, AIPromptToolbarFocusableDirective, AttachmentTemplateDirective, ChatComponent, ChatMessageBoxTemplateDirective, ChatModule, CommandViewComponent, ConversationalUIModule, CustomMessagesComponent, CustomViewComponent, ExecuteActionEvent, HeroCardComponent, KENDO_AIPROMPT, KENDO_CHAT, KENDO_CONVERSATIONALUI, MessageTemplateDirective, OutputViewComponent, PromptViewComponent, SendMessageEvent };
|
5125
|
+
export { AIPromptComponent, AIPromptCustomMessagesComponent, AIPromptModule, AIPromptOutputBodyTemplateDirective, AIPromptOutputTemplateDirective, AIPromptToolbarActionsDirective, AIPromptToolbarFocusableDirective, AttachmentTemplateDirective, ChatComponent, ChatMessageBoxTemplateDirective, ChatModule, CommandViewComponent, ConversationalUIModule, CustomMessagesComponent, CustomViewComponent, ExecuteActionEvent, HeroCardComponent, InlineAIPromptComponent, InlineAIPromptCustomMessagesComponent, InlineAIPromptOutputTemplateDirective, InlineAIPromptService, InlineAIPromptSettings, KENDO_AIPROMPT, KENDO_CHAT, KENDO_CONVERSATIONALUI, KENDO_INLINEAIPROMPT, MessageTemplateDirective, OutputViewComponent, PromptViewComponent, SendMessageEvent };
|
3973
5126
|
|