@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
@@ -0,0 +1,342 @@
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
5
|
+
import { Component, ContentChild, ElementRef, EventEmitter, Input, NgZone, Output, ViewChild, ViewContainerRef, } from '@angular/core';
|
6
|
+
import { Subscription } from 'rxjs';
|
7
|
+
import { validatePackage } from '@progress/kendo-licensing';
|
8
|
+
import { packageMetadata } from '../package-metadata';
|
9
|
+
import { InlineAIPromptContentComponent } from './inlineaiprompt-content.component';
|
10
|
+
import { KENDO_POPUP, PopupComponent } from '@progress/kendo-angular-popup';
|
11
|
+
import { take } from 'rxjs/operators';
|
12
|
+
import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
|
13
|
+
import { defaultPopupSettings, calculateMeasurement } from './utils';
|
14
|
+
import { LocalizedMessagesDirective } from './localization/localized-messages.directive';
|
15
|
+
import { InlineAIPromptOutputTemplateDirective } from './output-template.directive';
|
16
|
+
import * as i0 from "@angular/core";
|
17
|
+
import * as i1 from "@progress/kendo-angular-popup";
|
18
|
+
/**
|
19
|
+
* Represents the Kendo UI InlineAIPrompt component for Angular.
|
20
|
+
*
|
21
|
+
* @remarks
|
22
|
+
* Supported children components are: {@link InlineAIPromptCustomMessagesComponent}
|
23
|
+
*
|
24
|
+
* @example
|
25
|
+
* ```html
|
26
|
+
* <kendo-inlineaiprompt
|
27
|
+
* placeholder="Enter your prompt..."
|
28
|
+
* [promptOutput]="promptOutput"
|
29
|
+
* (promptRequest)="onPromptRequest($event)">
|
30
|
+
* </kendo-inlineaiprompt>
|
31
|
+
* ```
|
32
|
+
*/
|
33
|
+
export class InlineAIPromptComponent {
|
34
|
+
ngZone;
|
35
|
+
element;
|
36
|
+
/**
|
37
|
+
* Sets the text of the TextArea.
|
38
|
+
*/
|
39
|
+
promptValue;
|
40
|
+
/**
|
41
|
+
* Sets the placeholder text that appears in the text area when it is empty.
|
42
|
+
*/
|
43
|
+
placeholder;
|
44
|
+
/**
|
45
|
+
* Sets the output data for the prompt.
|
46
|
+
* The output displays as a card above the text area.
|
47
|
+
*/
|
48
|
+
promptOutput;
|
49
|
+
/**
|
50
|
+
* Controls the visibility and settings of the Speech to Text button.
|
51
|
+
*
|
52
|
+
* @default true
|
53
|
+
*/
|
54
|
+
enableTextToSpeech = true;
|
55
|
+
/**
|
56
|
+
* Sets the streaming state of the component.
|
57
|
+
* When set to `true`, the send button displays a generating state and the component emits a `promptRequestCancel` event when you click it.
|
58
|
+
*
|
59
|
+
* @default false
|
60
|
+
*/
|
61
|
+
streaming = false;
|
62
|
+
/**
|
63
|
+
* Sets the width of the component.
|
64
|
+
* Accepts a number for pixels or a string for other units.
|
65
|
+
*
|
66
|
+
* @default 550
|
67
|
+
*/
|
68
|
+
width = 550;
|
69
|
+
/**
|
70
|
+
* Sets the maximum height of the component.
|
71
|
+
* Accepts a number for pixels or a string for other units.
|
72
|
+
*/
|
73
|
+
maxHeight;
|
74
|
+
/**
|
75
|
+
* Sets the output actions that display in the output card.
|
76
|
+
* The default actions are `copy`, `retry`, and `discard`.
|
77
|
+
* To customize the appearance and order of the default actions, define them with the same `name`.
|
78
|
+
*/
|
79
|
+
outputActions;
|
80
|
+
/**
|
81
|
+
* Sets the available prompt commands.
|
82
|
+
*/
|
83
|
+
promptCommands;
|
84
|
+
/**
|
85
|
+
* Sets the popup settings for the component.
|
86
|
+
*/
|
87
|
+
set popupSettings(settings) {
|
88
|
+
this._popupSettings = { ...defaultPopupSettings, ...settings };
|
89
|
+
}
|
90
|
+
get popupSettings() {
|
91
|
+
return this._popupSettings;
|
92
|
+
}
|
93
|
+
/**
|
94
|
+
* Fires when you click the send button.
|
95
|
+
*/
|
96
|
+
promptRequest = new EventEmitter();
|
97
|
+
/**
|
98
|
+
* Fires when you click a command.
|
99
|
+
*/
|
100
|
+
executeCommand = new EventEmitter();
|
101
|
+
/**
|
102
|
+
* Fires when you click an output action button.
|
103
|
+
*/
|
104
|
+
outputActionClick = new EventEmitter();
|
105
|
+
/**
|
106
|
+
* Fires when you cancel the prompt request by clicking the stop button.
|
107
|
+
*/
|
108
|
+
promptRequestCancel = new EventEmitter();
|
109
|
+
/**
|
110
|
+
* Fires when the component closes, either by clicking outside the popup or by clicking the Discard action.
|
111
|
+
*/
|
112
|
+
close = new EventEmitter();
|
113
|
+
/**
|
114
|
+
* Fires when the value of the TextArea changes.
|
115
|
+
*/
|
116
|
+
promptValueChange = new EventEmitter();
|
117
|
+
popupElement;
|
118
|
+
popupViewContainer;
|
119
|
+
contentComponent;
|
120
|
+
outputTemplate;
|
121
|
+
/**
|
122
|
+
* @hidden
|
123
|
+
*/
|
124
|
+
calculateMeasurement = calculateMeasurement;
|
125
|
+
_popupSettings = defaultPopupSettings;
|
126
|
+
subs = new Subscription();
|
127
|
+
constructor(ngZone, element) {
|
128
|
+
this.ngZone = ngZone;
|
129
|
+
this.element = element;
|
130
|
+
validatePackage(packageMetadata);
|
131
|
+
}
|
132
|
+
ngAfterViewInit() {
|
133
|
+
if (this.contentComponent && this.popupElement) {
|
134
|
+
this.contentComponent.popupElement = this.popupElement;
|
135
|
+
}
|
136
|
+
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
137
|
+
if (this.contentComponent && this.popupViewContainer) {
|
138
|
+
this.contentComponent.appendTo = this.popupViewContainer;
|
139
|
+
}
|
140
|
+
});
|
141
|
+
}
|
142
|
+
ngOnDestroy() {
|
143
|
+
this.subs.unsubscribe();
|
144
|
+
}
|
145
|
+
/**
|
146
|
+
* Focuses the TextArea of the Inline AI Prompt.
|
147
|
+
*/
|
148
|
+
focus() {
|
149
|
+
if (this.contentComponent?.textArea) {
|
150
|
+
this.contentComponent.textArea.focus();
|
151
|
+
}
|
152
|
+
}
|
153
|
+
/**
|
154
|
+
* @hidden
|
155
|
+
*/
|
156
|
+
onPromptRequest(event) {
|
157
|
+
this.promptRequest.emit(event);
|
158
|
+
}
|
159
|
+
/**
|
160
|
+
* @hidden
|
161
|
+
*/
|
162
|
+
onExecuteCommand(event) {
|
163
|
+
this.executeCommand.emit(event);
|
164
|
+
}
|
165
|
+
/**
|
166
|
+
* @hidden
|
167
|
+
*/
|
168
|
+
onOutputActionClick(event) {
|
169
|
+
this.outputActionClick.emit(event);
|
170
|
+
}
|
171
|
+
/**
|
172
|
+
* @hidden
|
173
|
+
*/
|
174
|
+
onPromptRequestCancel() {
|
175
|
+
this.promptRequestCancel.emit();
|
176
|
+
}
|
177
|
+
/**
|
178
|
+
* @hidden
|
179
|
+
*/
|
180
|
+
onClose() {
|
181
|
+
this.close.emit();
|
182
|
+
}
|
183
|
+
/**
|
184
|
+
* @hidden
|
185
|
+
*/
|
186
|
+
onPromptValueChange(value) {
|
187
|
+
this.promptValueChange.emit(value);
|
188
|
+
}
|
189
|
+
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 });
|
190
|
+
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: [
|
191
|
+
LocalizationService,
|
192
|
+
{
|
193
|
+
provide: L10N_PREFIX,
|
194
|
+
useValue: 'kendo.inlineaiprompt',
|
195
|
+
},
|
196
|
+
], 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: `
|
197
|
+
<ng-container kendoInlineAIPromptLocalizedMessages
|
198
|
+
i18n-commandsButtonTitle="kendo.inlineaiprompt.commandsButtonTitle|Sets the Commands button title."
|
199
|
+
commandsButtonTitle="Command Menu"
|
200
|
+
i18n-generateButtonTitle="kendo.inlineaiprompt.generateButtonTitle|Sets the Generate button title."
|
201
|
+
generateButtonTitle="Generate"
|
202
|
+
i18n-speechToTextButtonTitle="kendo.inlineaiprompt.speechToTextButtonTitle|Sets the Speech to Text button title."
|
203
|
+
speechToTextButtonTitle="Speech to Text"
|
204
|
+
>
|
205
|
+
</ng-container>
|
206
|
+
<kendo-popup
|
207
|
+
[style.width]="calculateMeasurement(width)"
|
208
|
+
[anchor]="popupSettings?.anchor"
|
209
|
+
[anchorAlign]="popupSettings?.anchorAlign"
|
210
|
+
[offset]="popupSettings?.offset"
|
211
|
+
[popupAlign]="popupSettings?.popupAlign"
|
212
|
+
[animate]="popupSettings?.animate"
|
213
|
+
[collision]="popupSettings?.collision"
|
214
|
+
[positionMode]="popupSettings?.positionMode"
|
215
|
+
[margin]="popupSettings?.margin"
|
216
|
+
[popupClass]="popupSettings?.popupClass || 'k-prompt-popup'"
|
217
|
+
>
|
218
|
+
<kendo-inlineaiprompt-content
|
219
|
+
[style.width]="width"
|
220
|
+
[promptValue]="promptValue"
|
221
|
+
[placeholder]="placeholder"
|
222
|
+
[promptOutput]="promptOutput"
|
223
|
+
[enableTextToSpeech]="enableTextToSpeech"
|
224
|
+
[streaming]="streaming"
|
225
|
+
[maxHeight]="maxHeight"
|
226
|
+
[outputActions]="outputActions"
|
227
|
+
[promptCommands]="promptCommands"
|
228
|
+
[outputTemplate]="outputTemplate?.templateRef"
|
229
|
+
(promptRequest)="onPromptRequest($event)"
|
230
|
+
(executeCommand)="onExecuteCommand($event)"
|
231
|
+
(outputActionClick)="onOutputActionClick($event)"
|
232
|
+
(promptRequestCancel)="onPromptRequestCancel()"
|
233
|
+
(close)="onClose()"
|
234
|
+
(promptValueChange)="onPromptValueChange($event)"
|
235
|
+
>
|
236
|
+
</kendo-inlineaiprompt-content>
|
237
|
+
</kendo-popup>
|
238
|
+
`, isInline: true, dependencies: [{ kind: "component", type: i1.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]" }] });
|
239
|
+
}
|
240
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptComponent, decorators: [{
|
241
|
+
type: Component,
|
242
|
+
args: [{
|
243
|
+
exportAs: 'kendoInlineAIPrompt',
|
244
|
+
selector: 'kendo-inlineaiprompt',
|
245
|
+
providers: [
|
246
|
+
LocalizationService,
|
247
|
+
{
|
248
|
+
provide: L10N_PREFIX,
|
249
|
+
useValue: 'kendo.inlineaiprompt',
|
250
|
+
},
|
251
|
+
],
|
252
|
+
template: `
|
253
|
+
<ng-container kendoInlineAIPromptLocalizedMessages
|
254
|
+
i18n-commandsButtonTitle="kendo.inlineaiprompt.commandsButtonTitle|Sets the Commands button title."
|
255
|
+
commandsButtonTitle="Command Menu"
|
256
|
+
i18n-generateButtonTitle="kendo.inlineaiprompt.generateButtonTitle|Sets the Generate button title."
|
257
|
+
generateButtonTitle="Generate"
|
258
|
+
i18n-speechToTextButtonTitle="kendo.inlineaiprompt.speechToTextButtonTitle|Sets the Speech to Text button title."
|
259
|
+
speechToTextButtonTitle="Speech to Text"
|
260
|
+
>
|
261
|
+
</ng-container>
|
262
|
+
<kendo-popup
|
263
|
+
[style.width]="calculateMeasurement(width)"
|
264
|
+
[anchor]="popupSettings?.anchor"
|
265
|
+
[anchorAlign]="popupSettings?.anchorAlign"
|
266
|
+
[offset]="popupSettings?.offset"
|
267
|
+
[popupAlign]="popupSettings?.popupAlign"
|
268
|
+
[animate]="popupSettings?.animate"
|
269
|
+
[collision]="popupSettings?.collision"
|
270
|
+
[positionMode]="popupSettings?.positionMode"
|
271
|
+
[margin]="popupSettings?.margin"
|
272
|
+
[popupClass]="popupSettings?.popupClass || 'k-prompt-popup'"
|
273
|
+
>
|
274
|
+
<kendo-inlineaiprompt-content
|
275
|
+
[style.width]="width"
|
276
|
+
[promptValue]="promptValue"
|
277
|
+
[placeholder]="placeholder"
|
278
|
+
[promptOutput]="promptOutput"
|
279
|
+
[enableTextToSpeech]="enableTextToSpeech"
|
280
|
+
[streaming]="streaming"
|
281
|
+
[maxHeight]="maxHeight"
|
282
|
+
[outputActions]="outputActions"
|
283
|
+
[promptCommands]="promptCommands"
|
284
|
+
[outputTemplate]="outputTemplate?.templateRef"
|
285
|
+
(promptRequest)="onPromptRequest($event)"
|
286
|
+
(executeCommand)="onExecuteCommand($event)"
|
287
|
+
(outputActionClick)="onOutputActionClick($event)"
|
288
|
+
(promptRequestCancel)="onPromptRequestCancel()"
|
289
|
+
(close)="onClose()"
|
290
|
+
(promptValueChange)="onPromptValueChange($event)"
|
291
|
+
>
|
292
|
+
</kendo-inlineaiprompt-content>
|
293
|
+
</kendo-popup>
|
294
|
+
`,
|
295
|
+
standalone: true,
|
296
|
+
imports: [KENDO_POPUP, InlineAIPromptContentComponent, LocalizedMessagesDirective],
|
297
|
+
}]
|
298
|
+
}], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.ElementRef }]; }, propDecorators: { promptValue: [{
|
299
|
+
type: Input
|
300
|
+
}], placeholder: [{
|
301
|
+
type: Input
|
302
|
+
}], promptOutput: [{
|
303
|
+
type: Input
|
304
|
+
}], enableTextToSpeech: [{
|
305
|
+
type: Input
|
306
|
+
}], streaming: [{
|
307
|
+
type: Input
|
308
|
+
}], width: [{
|
309
|
+
type: Input
|
310
|
+
}], maxHeight: [{
|
311
|
+
type: Input
|
312
|
+
}], outputActions: [{
|
313
|
+
type: Input
|
314
|
+
}], promptCommands: [{
|
315
|
+
type: Input
|
316
|
+
}], popupSettings: [{
|
317
|
+
type: Input
|
318
|
+
}], promptRequest: [{
|
319
|
+
type: Output
|
320
|
+
}], executeCommand: [{
|
321
|
+
type: Output
|
322
|
+
}], outputActionClick: [{
|
323
|
+
type: Output
|
324
|
+
}], promptRequestCancel: [{
|
325
|
+
type: Output
|
326
|
+
}], close: [{
|
327
|
+
type: Output
|
328
|
+
}], promptValueChange: [{
|
329
|
+
type: Output
|
330
|
+
}], popupElement: [{
|
331
|
+
type: ViewChild,
|
332
|
+
args: [PopupComponent, { read: ElementRef }]
|
333
|
+
}], popupViewContainer: [{
|
334
|
+
type: ViewChild,
|
335
|
+
args: [PopupComponent, { read: ViewContainerRef }]
|
336
|
+
}], contentComponent: [{
|
337
|
+
type: ViewChild,
|
338
|
+
args: [InlineAIPromptContentComponent]
|
339
|
+
}], outputTemplate: [{
|
340
|
+
type: ContentChild,
|
341
|
+
args: [InlineAIPromptOutputTemplateDirective]
|
342
|
+
}] } });
|
@@ -0,0 +1,85 @@
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
5
|
+
import { Injectable, ViewContainerRef } from '@angular/core';
|
6
|
+
import { PopupService } from '@progress/kendo-angular-popup';
|
7
|
+
import { InlineAIPromptContentComponent } from './inlineaiprompt-content.component';
|
8
|
+
import { defaultPopupSettings } from './utils';
|
9
|
+
import * as i0 from "@angular/core";
|
10
|
+
import * as i1 from "@progress/kendo-angular-popup";
|
11
|
+
/**
|
12
|
+
* Provides a service for opening Inline AI Prompt components dynamically.
|
13
|
+
*
|
14
|
+
* @example
|
15
|
+
* ```ts
|
16
|
+
* import { InlineAIPromptService } from '@progress/kendo-angular-conversational-ui';
|
17
|
+
*
|
18
|
+
* constructor(private inlineAIPromptService: InlineAIPromptService) {}
|
19
|
+
*
|
20
|
+
* openPrompt(anchor: ElementRef) {
|
21
|
+
* const promptRef = this.inlineAIPromptService.open({
|
22
|
+
* anchor: anchor,
|
23
|
+
* placeholder: 'Enter your prompt...'
|
24
|
+
* });
|
25
|
+
* }
|
26
|
+
* ```
|
27
|
+
*/
|
28
|
+
export class InlineAIPromptService {
|
29
|
+
popupService;
|
30
|
+
constructor(popupService) {
|
31
|
+
this.popupService = popupService;
|
32
|
+
}
|
33
|
+
/**
|
34
|
+
* Opens an Inline AI Prompt component in a popup. The popup appears near the specified anchor element or at the provided offset coordinates.
|
35
|
+
*
|
36
|
+
* @param {InlineAIPromptSettings} options - The options for the InlineAIPromptComponent.
|
37
|
+
* @returns {PopupRef} A reference to the popup.
|
38
|
+
*/
|
39
|
+
open(options) {
|
40
|
+
const popupSettings = { ...defaultPopupSettings, ...options?.popupSettings };
|
41
|
+
const popupRef = this.popupService.open({
|
42
|
+
...(options?.popupSettings?.anchor && { anchor: options.popupSettings.anchor }),
|
43
|
+
popupClass: 'k-prompt-popup',
|
44
|
+
...popupSettings,
|
45
|
+
content: InlineAIPromptContentComponent,
|
46
|
+
});
|
47
|
+
const promptInstance = popupRef.content?.instance;
|
48
|
+
if (promptInstance) {
|
49
|
+
const popupViewContainer = popupRef.popup.injector.get(ViewContainerRef);
|
50
|
+
promptInstance.appendTo = popupViewContainer;
|
51
|
+
promptInstance.popupElement = popupRef.popupElement;
|
52
|
+
this.projectComponentInputs(promptInstance, options);
|
53
|
+
if (promptInstance.close) {
|
54
|
+
promptInstance.close.subscribe(() => {
|
55
|
+
popupRef.close();
|
56
|
+
});
|
57
|
+
}
|
58
|
+
if (popupRef.content.changeDetectorRef) {
|
59
|
+
popupRef.content.changeDetectorRef.detectChanges();
|
60
|
+
}
|
61
|
+
}
|
62
|
+
return popupRef;
|
63
|
+
}
|
64
|
+
/**
|
65
|
+
* Projects the input options onto the component instance.
|
66
|
+
*/
|
67
|
+
projectComponentInputs(component, options) {
|
68
|
+
if (!options) {
|
69
|
+
return component;
|
70
|
+
}
|
71
|
+
Object.getOwnPropertyNames(options)
|
72
|
+
.forEach((prop) => {
|
73
|
+
component[prop] = options[prop];
|
74
|
+
});
|
75
|
+
return component;
|
76
|
+
}
|
77
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptService, deps: [{ token: i1.PopupService }], target: i0.ɵɵFactoryTarget.Injectable });
|
78
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptService, providedIn: 'root' });
|
79
|
+
}
|
80
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptService, decorators: [{
|
81
|
+
type: Injectable,
|
82
|
+
args: [{
|
83
|
+
providedIn: 'root'
|
84
|
+
}]
|
85
|
+
}], ctorParameters: function () { return [{ type: i1.PopupService }]; } });
|
@@ -0,0 +1,53 @@
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
5
|
+
import { Component, forwardRef } from '@angular/core';
|
6
|
+
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
7
|
+
import { Messages } from './messages';
|
8
|
+
import * as i0 from "@angular/core";
|
9
|
+
import * as i1 from "@progress/kendo-angular-l10n";
|
10
|
+
/**
|
11
|
+
* Represents the custom messages component of the Inline AI Prompt.
|
12
|
+
*
|
13
|
+
* Use this component to override default messages for the Inline AI Prompt.
|
14
|
+
*
|
15
|
+
* @example
|
16
|
+
* ```html
|
17
|
+
* <kendo-inlineaiprompt-messages
|
18
|
+
* commandsButtonTitle="Commands Menu"
|
19
|
+
* generateButtonTitle="Generate">
|
20
|
+
* </kendo-inlineaiprompt-messages>
|
21
|
+
* ```
|
22
|
+
*/
|
23
|
+
export class InlineAIPromptCustomMessagesComponent extends Messages {
|
24
|
+
service;
|
25
|
+
constructor(service) {
|
26
|
+
super();
|
27
|
+
this.service = service;
|
28
|
+
}
|
29
|
+
get override() {
|
30
|
+
return true;
|
31
|
+
}
|
32
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptCustomMessagesComponent, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
33
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: InlineAIPromptCustomMessagesComponent, isStandalone: true, selector: "kendo-inlineaiprompt-messages", providers: [
|
34
|
+
{
|
35
|
+
provide: Messages,
|
36
|
+
useExisting: forwardRef(() => InlineAIPromptCustomMessagesComponent)
|
37
|
+
}
|
38
|
+
], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
|
39
|
+
}
|
40
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptCustomMessagesComponent, decorators: [{
|
41
|
+
type: Component,
|
42
|
+
args: [{
|
43
|
+
providers: [
|
44
|
+
{
|
45
|
+
provide: Messages,
|
46
|
+
useExisting: forwardRef(() => InlineAIPromptCustomMessagesComponent)
|
47
|
+
}
|
48
|
+
],
|
49
|
+
selector: 'kendo-inlineaiprompt-messages',
|
50
|
+
template: ``,
|
51
|
+
standalone: true
|
52
|
+
}]
|
53
|
+
}], ctorParameters: function () { return [{ type: i1.LocalizationService }]; } });
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
5
|
+
import { Directive, forwardRef } from '@angular/core';
|
6
|
+
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
7
|
+
import { Messages } from './messages';
|
8
|
+
import * as i0 from "@angular/core";
|
9
|
+
import * as i1 from "@progress/kendo-angular-l10n";
|
10
|
+
/**
|
11
|
+
* @hidden
|
12
|
+
*/
|
13
|
+
export class LocalizedMessagesDirective extends Messages {
|
14
|
+
service;
|
15
|
+
constructor(service) {
|
16
|
+
super();
|
17
|
+
this.service = service;
|
18
|
+
}
|
19
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedMessagesDirective, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
|
20
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: LocalizedMessagesDirective, isStandalone: true, selector: "[kendoInlineAIPromptLocalizedMessages]", providers: [
|
21
|
+
{
|
22
|
+
provide: Messages,
|
23
|
+
useExisting: forwardRef(() => LocalizedMessagesDirective)
|
24
|
+
}
|
25
|
+
], usesInheritance: true, ngImport: i0 });
|
26
|
+
}
|
27
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedMessagesDirective, decorators: [{
|
28
|
+
type: Directive,
|
29
|
+
args: [{
|
30
|
+
providers: [
|
31
|
+
{
|
32
|
+
provide: Messages,
|
33
|
+
useExisting: forwardRef(() => LocalizedMessagesDirective)
|
34
|
+
}
|
35
|
+
],
|
36
|
+
selector: '[kendoInlineAIPromptLocalizedMessages]',
|
37
|
+
standalone: true
|
38
|
+
}]
|
39
|
+
}], ctorParameters: function () { return [{ type: i1.LocalizationService }]; } });
|
@@ -0,0 +1,35 @@
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
5
|
+
import { Directive, Input } from '@angular/core';
|
6
|
+
import { ComponentMessages } from '@progress/kendo-angular-l10n';
|
7
|
+
import * as i0 from "@angular/core";
|
8
|
+
/**
|
9
|
+
* @hidden
|
10
|
+
*/
|
11
|
+
export class Messages extends ComponentMessages {
|
12
|
+
/**
|
13
|
+
* Sets the Commands button title.
|
14
|
+
*/
|
15
|
+
commandsButtonTitle;
|
16
|
+
/**
|
17
|
+
* Sets the Generate button title.
|
18
|
+
*/
|
19
|
+
generateButtonTitle;
|
20
|
+
/**
|
21
|
+
* Sets the Speech to Text button title.
|
22
|
+
*/
|
23
|
+
speechToTextButtonTitle;
|
24
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
25
|
+
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 });
|
26
|
+
}
|
27
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Messages, decorators: [{
|
28
|
+
type: Directive
|
29
|
+
}], propDecorators: { commandsButtonTitle: [{
|
30
|
+
type: Input
|
31
|
+
}], generateButtonTitle: [{
|
32
|
+
type: Input
|
33
|
+
}], speechToTextButtonTitle: [{
|
34
|
+
type: Input
|
35
|
+
}] } });
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
5
|
+
export {};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
5
|
+
export { InlineAIPromptSettings } from './inlineaiprompt-settings';
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
5
|
+
export {};
|
@@ -0,0 +1,59 @@
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
5
|
+
/**
|
6
|
+
* Defines the settings for opening an Inline AI Prompt through the `InlineAIPromptService`.
|
7
|
+
*/
|
8
|
+
export class InlineAIPromptSettings {
|
9
|
+
/**
|
10
|
+
* Specifies the settings for the Inline AI Prompt Popup.
|
11
|
+
*/
|
12
|
+
popupSettings;
|
13
|
+
/**
|
14
|
+
* Sets the width of the component.
|
15
|
+
* Accepts a number for pixels or a string for other units, for example, `50%`.
|
16
|
+
*/
|
17
|
+
width;
|
18
|
+
/**
|
19
|
+
* Sets the maximum height of the component.
|
20
|
+
* Accepts a number for pixels or a string for other units, for example, `50%`.
|
21
|
+
*/
|
22
|
+
maxHeight;
|
23
|
+
/**
|
24
|
+
* Sets the value of the Inline AI Prompt TextArea.
|
25
|
+
*/
|
26
|
+
promptValue;
|
27
|
+
/**
|
28
|
+
* Sets the placeholder of the Inline AI Prompt TextArea.
|
29
|
+
*/
|
30
|
+
placeholder;
|
31
|
+
/**
|
32
|
+
* Sets the action buttons for the output card.
|
33
|
+
*/
|
34
|
+
outputActions;
|
35
|
+
/**
|
36
|
+
* Sets the commands for the Inline AI Prompt TextArea prefix.
|
37
|
+
*/
|
38
|
+
promptCommands;
|
39
|
+
/**
|
40
|
+
* Sets the prompt output to display.
|
41
|
+
*/
|
42
|
+
promptOutput;
|
43
|
+
/**
|
44
|
+
* Sets the visibility and configuration of the Speech to Text button.
|
45
|
+
*/
|
46
|
+
enableSpeechToTextButton;
|
47
|
+
/**
|
48
|
+
* Sets the template for the output content. If not provided, the default output template is used.
|
49
|
+
*/
|
50
|
+
outputTemplate;
|
51
|
+
/**
|
52
|
+
* Sets whether the send button turns into a stop button.
|
53
|
+
*/
|
54
|
+
streaming;
|
55
|
+
/**
|
56
|
+
* Sets the titles of the buttons shown in the Inline AI Prompt. Use for localization.
|
57
|
+
*/
|
58
|
+
messages;
|
59
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
5
|
+
/**
|
6
|
+
* Defines the titles that appear in the Inline AI Prompt. Use for localization.
|
7
|
+
*/
|
8
|
+
export {};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
5
|
+
export {};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
5
|
+
export {};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
5
|
+
export {};
|