@progress/kendo-angular-conversational-ui 14.4.0-develop.19 → 14.4.0-develop.20
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/ai-prompt/aiprompt.component.d.ts +120 -0
- package/ai-prompt/aiprompt.module.d.ts +25 -0
- package/ai-prompt/common/aiprompt.service.d.ts +26 -0
- package/ai-prompt/common/output-card.component.d.ts +36 -0
- package/ai-prompt/common/toolbar-focusable.directive.d.ts +24 -0
- package/ai-prompt/common/toolbar-navigation.service.d.ts +24 -0
- package/ai-prompt/localization/custom-messages.component.d.ts +17 -0
- package/ai-prompt/localization/localized-messages.directive.d.ts +16 -0
- package/ai-prompt/localization/messages.d.ts +49 -0
- package/ai-prompt/models/command-execute-event.d.ts +23 -0
- package/ai-prompt/models/command.interface.d.ts +30 -0
- package/ai-prompt/models/index.d.ts +10 -0
- package/ai-prompt/models/output-rating-change-event.d.ts +18 -0
- package/ai-prompt/models/prompt-output.interface.d.ts +41 -0
- package/ai-prompt/models/prompt-request-event.d.ts +22 -0
- package/ai-prompt/models/view-type.d.ts +8 -0
- package/ai-prompt/templates/toolbar-actions.template.d.ts +18 -0
- package/ai-prompt/utils.d.ts +19 -0
- package/ai-prompt/views/base-view.d.ts +46 -0
- package/ai-prompt/views/command-view.component.d.ts +23 -0
- package/ai-prompt/views/custom-view.component.d.ts +20 -0
- package/ai-prompt/views/index.d.ts +8 -0
- package/ai-prompt/views/output-view.component.d.ts +22 -0
- package/ai-prompt/views/prompt-view.component.d.ts +47 -0
- package/conversational-ui.module.d.ts +43 -0
- package/esm2020/ai-prompt/aiprompt.component.mjs +348 -0
- package/esm2020/ai-prompt/aiprompt.module.mjs +79 -0
- package/esm2020/ai-prompt/common/aiprompt.service.mjs +38 -0
- package/esm2020/ai-prompt/common/output-card.component.mjs +199 -0
- package/esm2020/ai-prompt/common/toolbar-focusable.directive.mjs +67 -0
- package/esm2020/ai-prompt/common/toolbar-navigation.service.mjs +55 -0
- package/esm2020/ai-prompt/localization/custom-messages.component.mjs +41 -0
- package/esm2020/ai-prompt/localization/localized-messages.directive.mjs +37 -0
- package/esm2020/ai-prompt/localization/messages.mjs +35 -0
- package/esm2020/ai-prompt/models/command-execute-event.mjs +5 -0
- package/esm2020/ai-prompt/models/command.interface.mjs +5 -0
- package/esm2020/ai-prompt/models/index.mjs +5 -0
- package/esm2020/ai-prompt/models/output-rating-change-event.mjs +5 -0
- package/esm2020/ai-prompt/models/prompt-output.interface.mjs +5 -0
- package/esm2020/ai-prompt/models/prompt-request-event.mjs +5 -0
- package/esm2020/ai-prompt/models/view-type.mjs +5 -0
- package/esm2020/ai-prompt/templates/toolbar-actions.template.mjs +27 -0
- package/esm2020/ai-prompt/utils.mjs +26 -0
- package/esm2020/ai-prompt/views/base-view.mjs +89 -0
- package/esm2020/ai-prompt/views/command-view.component.mjs +82 -0
- package/esm2020/ai-prompt/views/custom-view.component.mjs +35 -0
- package/esm2020/ai-prompt/views/index.mjs +8 -0
- package/esm2020/ai-prompt/views/output-view.component.mjs +66 -0
- package/esm2020/ai-prompt/views/prompt-view.component.mjs +146 -0
- package/esm2020/conversational-ui.module.mjs +50 -0
- package/esm2020/index.mjs +8 -0
- package/esm2020/package-metadata.mjs +2 -2
- package/fesm2015/progress-kendo-angular-conversational-ui.mjs +1411 -149
- package/fesm2020/progress-kendo-angular-conversational-ui.mjs +1299 -43
- package/index.d.ts +8 -0
- package/package.json +9 -7
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2024 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, HostBinding, Input } from '@angular/core';
|
|
6
|
+
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
7
|
+
import { guid, isPresent } from '@progress/kendo-angular-common';
|
|
8
|
+
import { arrowRotateCwIcon, copyIcon, thumbDownIcon, thumbDownOutlineIcon, thumbUpIcon, thumbUpOutlineIcon } from '@progress/kendo-svg-icons';
|
|
9
|
+
import { AIPromptService } from './aiprompt.service';
|
|
10
|
+
import * as i0 from "@angular/core";
|
|
11
|
+
import * as i1 from "@progress/kendo-angular-l10n";
|
|
12
|
+
import * as i2 from "./aiprompt.service";
|
|
13
|
+
import * as i3 from "@progress/kendo-angular-buttons";
|
|
14
|
+
import * as i4 from "@angular/common";
|
|
15
|
+
/**
|
|
16
|
+
* @hidden
|
|
17
|
+
*/
|
|
18
|
+
export class AIPromptOutputCardComponent {
|
|
19
|
+
constructor(localization, service) {
|
|
20
|
+
this.localization = localization;
|
|
21
|
+
this.service = service;
|
|
22
|
+
this.hostClass = true;
|
|
23
|
+
this.listItemRole = 'listitem';
|
|
24
|
+
this.tabIndex = 0;
|
|
25
|
+
this.ariaKeyShortcuts = 'Enter';
|
|
26
|
+
this.copyIcon = copyIcon;
|
|
27
|
+
this.retryIcon = arrowRotateCwIcon;
|
|
28
|
+
this.positiveRatingIcon = thumbUpOutlineIcon;
|
|
29
|
+
this.negativeRatingIcon = thumbDownOutlineIcon;
|
|
30
|
+
this.titleId = `k-output-card-${guid()}`;
|
|
31
|
+
}
|
|
32
|
+
get ariaDescribedBy() {
|
|
33
|
+
return this.titleId;
|
|
34
|
+
}
|
|
35
|
+
messageFor(text) {
|
|
36
|
+
return this.localization.get(text);
|
|
37
|
+
}
|
|
38
|
+
get showRating() {
|
|
39
|
+
return this.service.showOutputRating;
|
|
40
|
+
}
|
|
41
|
+
get outputTitle() {
|
|
42
|
+
if (isPresent(this.promptOutput.title)) {
|
|
43
|
+
return this.promptOutput.title;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
const titleMessage = this.promptOutput.isRetry ? 'outputRetryTitle' : 'outputTitle';
|
|
47
|
+
return this.messageFor(titleMessage);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
handleRetry() {
|
|
51
|
+
if (this.promptOutput.commandId) {
|
|
52
|
+
const eventArgs = {
|
|
53
|
+
command: this.service.getFlattenPromptCommands().find(c => c.id === this.promptOutput.commandId),
|
|
54
|
+
sender: this.service.aiPrompt,
|
|
55
|
+
isRetry: true
|
|
56
|
+
};
|
|
57
|
+
this.service.executeEvent.next(eventArgs);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
const eventArgs = {
|
|
61
|
+
prompt: this.promptOutput.prompt,
|
|
62
|
+
sender: this.service.aiPrompt,
|
|
63
|
+
isRetry: true
|
|
64
|
+
};
|
|
65
|
+
this.service.requestEvent.next(eventArgs);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
handleCopy() {
|
|
69
|
+
navigator.clipboard.writeText(this.promptOutput.output);
|
|
70
|
+
this.service.outputCopyEvent.next(this.promptOutput);
|
|
71
|
+
}
|
|
72
|
+
handleRating(ratingType) {
|
|
73
|
+
const eventArgs = {
|
|
74
|
+
promptOutput: this.promptOutput,
|
|
75
|
+
rating: ratingType
|
|
76
|
+
};
|
|
77
|
+
this.service.outputRatingChangeEvent.next(eventArgs);
|
|
78
|
+
if (ratingType === 'positive') {
|
|
79
|
+
this.positiveRatingIcon = thumbUpIcon;
|
|
80
|
+
this.negativeRatingIcon = thumbDownOutlineIcon;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
this.negativeRatingIcon = thumbDownIcon;
|
|
84
|
+
this.positiveRatingIcon = thumbUpOutlineIcon;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
AIPromptOutputCardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptOutputCardComponent, deps: [{ token: i1.LocalizationService }, { token: i2.AIPromptService }], target: i0.ɵɵFactoryTarget.Component });
|
|
89
|
+
AIPromptOutputCardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: AIPromptOutputCardComponent, selector: "[kendoAIPromptOutputCard]", inputs: { promptOutput: "promptOutput" }, host: { properties: { "class.k-card": "this.hostClass", "attr.role": "this.listItemRole", "attr.tabindex": "this.tabIndex", "attr.aria-describedby": "this.ariaDescribedBy", "attr.aria-keyshortcuts": "this.ariaKeyShortcuts" } }, ngImport: i0, template: `
|
|
90
|
+
<div class="k-card-header">
|
|
91
|
+
<div
|
|
92
|
+
class="k-card-title"
|
|
93
|
+
[attr.id]="titleId">{{outputTitle}}
|
|
94
|
+
</div>
|
|
95
|
+
<div class="k-card-subtitle">{{promptOutput.prompt}}</div>
|
|
96
|
+
</div>
|
|
97
|
+
<div class="k-card-body">
|
|
98
|
+
<p>{{promptOutput.output}}</p>
|
|
99
|
+
</div>
|
|
100
|
+
<div class="k-actions k-actions-start k-actions-horizontal k-card-actions">
|
|
101
|
+
<button kendoButton
|
|
102
|
+
fillMode="flat"
|
|
103
|
+
themeColor="primary"
|
|
104
|
+
rounded="full"
|
|
105
|
+
icon="copy"
|
|
106
|
+
[svgIcon]="copyIcon"
|
|
107
|
+
(click)="handleCopy()"
|
|
108
|
+
>{{messageFor('copyOutput')}}</button>
|
|
109
|
+
<button kendoButton
|
|
110
|
+
fillMode="flat"
|
|
111
|
+
rounded="full"
|
|
112
|
+
icon="arrow-rotate-cw"
|
|
113
|
+
[svgIcon]="retryIcon"
|
|
114
|
+
(click)="handleRetry()"
|
|
115
|
+
>{{messageFor('retryGeneration')}}</button>
|
|
116
|
+
<ng-container *ngIf="showRating">
|
|
117
|
+
<span class="k-spacer"></span>
|
|
118
|
+
<button kendoButton
|
|
119
|
+
fillMode="flat"
|
|
120
|
+
icon="thumb-up-outline"
|
|
121
|
+
[svgIcon]="positiveRatingIcon"
|
|
122
|
+
(click)="handleRating('positive')">
|
|
123
|
+
</button>
|
|
124
|
+
<button kendoButton
|
|
125
|
+
fillMode="flat"
|
|
126
|
+
icon="thumb-down-outline"
|
|
127
|
+
[svgIcon]="negativeRatingIcon"
|
|
128
|
+
(click)="handleRating('negative')">
|
|
129
|
+
</button>
|
|
130
|
+
</ng-container>
|
|
131
|
+
</div>
|
|
132
|
+
`, isInline: true, components: [{ type: i3.ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
133
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptOutputCardComponent, decorators: [{
|
|
134
|
+
type: Component,
|
|
135
|
+
args: [{
|
|
136
|
+
selector: '[kendoAIPromptOutputCard]',
|
|
137
|
+
template: `
|
|
138
|
+
<div class="k-card-header">
|
|
139
|
+
<div
|
|
140
|
+
class="k-card-title"
|
|
141
|
+
[attr.id]="titleId">{{outputTitle}}
|
|
142
|
+
</div>
|
|
143
|
+
<div class="k-card-subtitle">{{promptOutput.prompt}}</div>
|
|
144
|
+
</div>
|
|
145
|
+
<div class="k-card-body">
|
|
146
|
+
<p>{{promptOutput.output}}</p>
|
|
147
|
+
</div>
|
|
148
|
+
<div class="k-actions k-actions-start k-actions-horizontal k-card-actions">
|
|
149
|
+
<button kendoButton
|
|
150
|
+
fillMode="flat"
|
|
151
|
+
themeColor="primary"
|
|
152
|
+
rounded="full"
|
|
153
|
+
icon="copy"
|
|
154
|
+
[svgIcon]="copyIcon"
|
|
155
|
+
(click)="handleCopy()"
|
|
156
|
+
>{{messageFor('copyOutput')}}</button>
|
|
157
|
+
<button kendoButton
|
|
158
|
+
fillMode="flat"
|
|
159
|
+
rounded="full"
|
|
160
|
+
icon="arrow-rotate-cw"
|
|
161
|
+
[svgIcon]="retryIcon"
|
|
162
|
+
(click)="handleRetry()"
|
|
163
|
+
>{{messageFor('retryGeneration')}}</button>
|
|
164
|
+
<ng-container *ngIf="showRating">
|
|
165
|
+
<span class="k-spacer"></span>
|
|
166
|
+
<button kendoButton
|
|
167
|
+
fillMode="flat"
|
|
168
|
+
icon="thumb-up-outline"
|
|
169
|
+
[svgIcon]="positiveRatingIcon"
|
|
170
|
+
(click)="handleRating('positive')">
|
|
171
|
+
</button>
|
|
172
|
+
<button kendoButton
|
|
173
|
+
fillMode="flat"
|
|
174
|
+
icon="thumb-down-outline"
|
|
175
|
+
[svgIcon]="negativeRatingIcon"
|
|
176
|
+
(click)="handleRating('negative')">
|
|
177
|
+
</button>
|
|
178
|
+
</ng-container>
|
|
179
|
+
</div>
|
|
180
|
+
`
|
|
181
|
+
}]
|
|
182
|
+
}], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i2.AIPromptService }]; }, propDecorators: { hostClass: [{
|
|
183
|
+
type: HostBinding,
|
|
184
|
+
args: ['class.k-card']
|
|
185
|
+
}], listItemRole: [{
|
|
186
|
+
type: HostBinding,
|
|
187
|
+
args: ['attr.role']
|
|
188
|
+
}], tabIndex: [{
|
|
189
|
+
type: HostBinding,
|
|
190
|
+
args: ['attr.tabindex']
|
|
191
|
+
}], ariaDescribedBy: [{
|
|
192
|
+
type: HostBinding,
|
|
193
|
+
args: ['attr.aria-describedby']
|
|
194
|
+
}], ariaKeyShortcuts: [{
|
|
195
|
+
type: HostBinding,
|
|
196
|
+
args: ['attr.aria-keyshortcuts']
|
|
197
|
+
}], promptOutput: [{
|
|
198
|
+
type: Input
|
|
199
|
+
}] } });
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2024 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, ElementRef, Renderer2 } from '@angular/core';
|
|
6
|
+
import { ToolbarNavigationService } from './toolbar-navigation.service';
|
|
7
|
+
import { Keys, focusableSelector } from '@progress/kendo-angular-common';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
import * as i1 from "./toolbar-navigation.service";
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
export class AIPromptToolbarFocusableDirective {
|
|
14
|
+
constructor(host, navigationService, renderer) {
|
|
15
|
+
this.host = host;
|
|
16
|
+
this.navigationService = navigationService;
|
|
17
|
+
this.renderer = renderer;
|
|
18
|
+
this.keyDownHandler = (e) => {
|
|
19
|
+
const targetsSelf = e.target === this.element;
|
|
20
|
+
const isLeftArrow = e.keyCode === Keys.ArrowLeft;
|
|
21
|
+
const isRightArrow = e.keyCode === Keys.ArrowRight;
|
|
22
|
+
const isArrow = isLeftArrow || isRightArrow;
|
|
23
|
+
if (!targetsSelf || !isArrow) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
this.renderer.setAttribute(this.element, 'tabindex', '-1');
|
|
27
|
+
this.element.querySelectorAll(focusableSelector).forEach(el => {
|
|
28
|
+
this.renderer.setAttribute(el, 'tabindex', '-1');
|
|
29
|
+
});
|
|
30
|
+
if (isRightArrow) {
|
|
31
|
+
this.navigationService.move('right');
|
|
32
|
+
}
|
|
33
|
+
else if (isLeftArrow) {
|
|
34
|
+
this.navigationService.move('left');
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
this.clickHandler = () => {
|
|
38
|
+
this.navigationService.setActiveIndex(this);
|
|
39
|
+
};
|
|
40
|
+
navigationService.register(this);
|
|
41
|
+
}
|
|
42
|
+
get element() {
|
|
43
|
+
return this.host.nativeElement;
|
|
44
|
+
}
|
|
45
|
+
ngAfterViewInit() {
|
|
46
|
+
this.renderer.setAttribute(this.element, 'tabindex', this.navigationService.isActive(this) ? '0' : '-1');
|
|
47
|
+
this.element.addEventListener('keydown', this.keyDownHandler, { capture: true });
|
|
48
|
+
this.element.addEventListener('click', this.clickHandler, { capture: true });
|
|
49
|
+
}
|
|
50
|
+
ngOnDestroy() {
|
|
51
|
+
this.navigationService.unregister(this);
|
|
52
|
+
this.element.removeEventListener('keydown', this.keyDownHandler, { capture: true });
|
|
53
|
+
this.element.removeEventListener('click', this.clickHandler, { capture: true });
|
|
54
|
+
}
|
|
55
|
+
activate() {
|
|
56
|
+
this.renderer.setAttribute(this.element, 'tabindex', '0');
|
|
57
|
+
this.element.focus();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
AIPromptToolbarFocusableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptToolbarFocusableDirective, deps: [{ token: i0.ElementRef }, { token: i1.ToolbarNavigationService }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
|
61
|
+
AIPromptToolbarFocusableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: AIPromptToolbarFocusableDirective, selector: "[kendoAIPromptToolbarFocusable]", ngImport: i0 });
|
|
62
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptToolbarFocusableDirective, decorators: [{
|
|
63
|
+
type: Directive,
|
|
64
|
+
args: [{
|
|
65
|
+
selector: '[kendoAIPromptToolbarFocusable]'
|
|
66
|
+
}]
|
|
67
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.ToolbarNavigationService }, { type: i0.Renderer2 }]; } });
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2024 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 } from '@angular/core';
|
|
6
|
+
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
import * as i1 from "@progress/kendo-angular-l10n";
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
export class ToolbarNavigationService {
|
|
13
|
+
constructor(localizationService) {
|
|
14
|
+
this.localizationService = localizationService;
|
|
15
|
+
this.focusableElements = [];
|
|
16
|
+
this.currentFocusedIndex = 0;
|
|
17
|
+
}
|
|
18
|
+
register(tool) {
|
|
19
|
+
if (!this.focusableElements.some(el => el === tool)) {
|
|
20
|
+
this.focusableElements.push(tool);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
unregister(tool) {
|
|
24
|
+
this.currentFocusedIndex = 0;
|
|
25
|
+
this.focusableElements = this.focusableElements.filter(el => el !== tool);
|
|
26
|
+
}
|
|
27
|
+
isActive(focusable) {
|
|
28
|
+
return this.focusableElements[this.currentFocusedIndex] === focusable;
|
|
29
|
+
}
|
|
30
|
+
setActiveIndex(tool) {
|
|
31
|
+
this.currentFocusedIndex = Math.max(this.focusableElements.indexOf(tool), 0);
|
|
32
|
+
}
|
|
33
|
+
move(direction) {
|
|
34
|
+
let delta = direction === 'right' ? 1 : -1;
|
|
35
|
+
if (this.localizationService.rtl) {
|
|
36
|
+
delta = -delta;
|
|
37
|
+
}
|
|
38
|
+
this.currentFocusedIndex += delta;
|
|
39
|
+
if (this.currentFocusedIndex < 0) {
|
|
40
|
+
this.currentFocusedIndex = this.focusableElements.length - 1;
|
|
41
|
+
}
|
|
42
|
+
else if (this.currentFocusedIndex >= this.focusableElements.length) {
|
|
43
|
+
this.currentFocusedIndex = 0;
|
|
44
|
+
}
|
|
45
|
+
this.focusableElements[this.currentFocusedIndex].activate();
|
|
46
|
+
}
|
|
47
|
+
focusFirst() {
|
|
48
|
+
this.focusableElements[this.currentFocusedIndex].activate();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
ToolbarNavigationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ToolbarNavigationService, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
52
|
+
ToolbarNavigationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ToolbarNavigationService });
|
|
53
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ToolbarNavigationService, decorators: [{
|
|
54
|
+
type: Injectable
|
|
55
|
+
}], ctorParameters: function () { return [{ type: i1.LocalizationService }]; } });
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2024 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
|
+
* Custom component messages override default component messages.
|
|
12
|
+
*/
|
|
13
|
+
export class AIPromptCustomMessagesComponent extends Messages {
|
|
14
|
+
constructor(service) {
|
|
15
|
+
super();
|
|
16
|
+
this.service = service;
|
|
17
|
+
}
|
|
18
|
+
get override() {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
AIPromptCustomMessagesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptCustomMessagesComponent, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
23
|
+
AIPromptCustomMessagesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: AIPromptCustomMessagesComponent, selector: "kendo-aiprompt-messages", providers: [
|
|
24
|
+
{
|
|
25
|
+
provide: Messages,
|
|
26
|
+
useExisting: forwardRef(() => AIPromptCustomMessagesComponent)
|
|
27
|
+
}
|
|
28
|
+
], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
|
|
29
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptCustomMessagesComponent, decorators: [{
|
|
30
|
+
type: Component,
|
|
31
|
+
args: [{
|
|
32
|
+
providers: [
|
|
33
|
+
{
|
|
34
|
+
provide: Messages,
|
|
35
|
+
useExisting: forwardRef(() => AIPromptCustomMessagesComponent)
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
selector: 'kendo-aiprompt-messages',
|
|
39
|
+
template: ``
|
|
40
|
+
}]
|
|
41
|
+
}], ctorParameters: function () { return [{ type: i1.LocalizationService }]; } });
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2024 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
|
+
constructor(service) {
|
|
15
|
+
super();
|
|
16
|
+
this.service = service;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
LocalizedMessagesDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: LocalizedMessagesDirective, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
20
|
+
LocalizedMessagesDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: LocalizedMessagesDirective, selector: "[kendoAIPromptLocalizedMessages]", providers: [
|
|
21
|
+
{
|
|
22
|
+
provide: Messages,
|
|
23
|
+
useExisting: forwardRef(() => LocalizedMessagesDirective)
|
|
24
|
+
}
|
|
25
|
+
], usesInheritance: true, ngImport: i0 });
|
|
26
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: LocalizedMessagesDirective, decorators: [{
|
|
27
|
+
type: Directive,
|
|
28
|
+
args: [{
|
|
29
|
+
providers: [
|
|
30
|
+
{
|
|
31
|
+
provide: Messages,
|
|
32
|
+
useExisting: forwardRef(() => LocalizedMessagesDirective)
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
selector: '[kendoAIPromptLocalizedMessages]'
|
|
36
|
+
}]
|
|
37
|
+
}], ctorParameters: function () { return [{ type: i1.LocalizationService }]; } });
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2024 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
|
+
Messages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
14
|
+
Messages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: Messages, inputs: { promptView: "promptView", outputView: "outputView", generateOutput: "generateOutput", promptPlaceholder: "promptPlaceholder", copyOutput: "copyOutput", retryGeneration: "retryGeneration", outputTitle: "outputTitle", outputRetryTitle: "outputRetryTitle", promptSuggestions: "promptSuggestions" }, usesInheritance: true, ngImport: i0 });
|
|
15
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: Messages, decorators: [{
|
|
16
|
+
type: Directive
|
|
17
|
+
}], propDecorators: { promptView: [{
|
|
18
|
+
type: Input
|
|
19
|
+
}], outputView: [{
|
|
20
|
+
type: Input
|
|
21
|
+
}], generateOutput: [{
|
|
22
|
+
type: Input
|
|
23
|
+
}], promptPlaceholder: [{
|
|
24
|
+
type: Input
|
|
25
|
+
}], copyOutput: [{
|
|
26
|
+
type: Input
|
|
27
|
+
}], retryGeneration: [{
|
|
28
|
+
type: Input
|
|
29
|
+
}], outputTitle: [{
|
|
30
|
+
type: Input
|
|
31
|
+
}], outputRetryTitle: [{
|
|
32
|
+
type: Input
|
|
33
|
+
}], promptSuggestions: [{
|
|
34
|
+
type: Input
|
|
35
|
+
}] } });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2024 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 © 2024 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 © 2024 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 © 2024 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 © 2024 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 © 2024 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 © 2024 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,27 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2024 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, Optional, TemplateRef } from '@angular/core';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* Represents a template that allows you to define additional ToolBar actions.
|
|
9
|
+
* The actions will be rendered right after all views' ToolBar buttons.
|
|
10
|
+
* To define the template, nest an `<ng-template>` tag
|
|
11
|
+
* with the `kendoAIPromptToolbarActionsTemplate` directive inside the `<kendo-aiprompt>` tag.
|
|
12
|
+
*/
|
|
13
|
+
export class AIPromptToolbarActionsDirective {
|
|
14
|
+
constructor(templateRef) {
|
|
15
|
+
this.templateRef = templateRef;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
AIPromptToolbarActionsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptToolbarActionsDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
19
|
+
AIPromptToolbarActionsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: AIPromptToolbarActionsDirective, selector: "[kendoAIPromptToolbarActionsTemplate]", ngImport: i0 });
|
|
20
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptToolbarActionsDirective, decorators: [{
|
|
21
|
+
type: Directive,
|
|
22
|
+
args: [{
|
|
23
|
+
selector: '[kendoAIPromptToolbarActionsTemplate]'
|
|
24
|
+
}]
|
|
25
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
|
|
26
|
+
type: Optional
|
|
27
|
+
}] }]; } });
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { InjectionToken } from "@angular/core";
|
|
6
|
+
import { commentIcon, moreHorizontalIcon, sparklesIcon } from "@progress/kendo-svg-icons";
|
|
7
|
+
/**
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
export const MY_TOKEN = new InjectionToken('COMMAND_TOKEN');
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
export const DEFAULT_SVG_ICONS = {
|
|
15
|
+
prompt: sparklesIcon,
|
|
16
|
+
output: commentIcon,
|
|
17
|
+
command: moreHorizontalIcon
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
export const DEFAULT_ICONS = {
|
|
23
|
+
prompt: 'sparkles',
|
|
24
|
+
output: 'comment',
|
|
25
|
+
command: 'more-horizontal'
|
|
26
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { Input, TemplateRef, Directive, HostBinding, Inject, ViewChild } from '@angular/core';
|
|
6
|
+
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
7
|
+
import { isPresent } from '@progress/kendo-angular-common';
|
|
8
|
+
import { DEFAULT_ICONS, DEFAULT_SVG_ICONS, MY_TOKEN } from '../utils';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
import * as i1 from "@progress/kendo-angular-l10n";
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
export class BaseView {
|
|
15
|
+
constructor(viewType, localization) {
|
|
16
|
+
this.viewType = viewType;
|
|
17
|
+
this.localization = localization;
|
|
18
|
+
this.hostClasses = true;
|
|
19
|
+
if (this.viewType !== 'custom') {
|
|
20
|
+
this.icon = DEFAULT_ICONS[this.viewType];
|
|
21
|
+
this.svgIcon = DEFAULT_SVG_ICONS[this.viewType];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The text of the ToolBar button corresponding to the view.
|
|
26
|
+
*/
|
|
27
|
+
set buttonText(value) {
|
|
28
|
+
this._buttonText = value;
|
|
29
|
+
}
|
|
30
|
+
get buttonText() {
|
|
31
|
+
return isPresent(this._buttonText) ?
|
|
32
|
+
this._buttonText :
|
|
33
|
+
this.messageFor(`${this.viewType}View`);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The font icon of the ToolBar button corresponding to the view.
|
|
37
|
+
*/
|
|
38
|
+
set icon(value) {
|
|
39
|
+
if (isPresent(value)) {
|
|
40
|
+
this._icon = value;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
this.icon = DEFAULT_ICONS[this.viewType];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
get icon() {
|
|
47
|
+
return this._icon;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The SVG icon of the ToolBar button corresponding to the view.
|
|
51
|
+
*/
|
|
52
|
+
set svgIcon(value) {
|
|
53
|
+
if (isPresent(value)) {
|
|
54
|
+
this._svgIcon = value;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.svgIcon = DEFAULT_SVG_ICONS[this.viewType];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
get svgIcon() {
|
|
61
|
+
return this._svgIcon;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @hidden
|
|
65
|
+
*/
|
|
66
|
+
messageFor(text) {
|
|
67
|
+
return this.localization.get(text);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
BaseView.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: BaseView, deps: [{ token: MY_TOKEN }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
71
|
+
BaseView.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: BaseView, inputs: { buttonText: "buttonText", icon: "icon", svgIcon: "svgIcon" }, host: { properties: { "class.k-prompt-view": "this.hostClasses" } }, viewQueries: [{ propertyName: "template", first: true, predicate: ["content"], descendants: true, static: true }], ngImport: i0 });
|
|
72
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: BaseView, decorators: [{
|
|
73
|
+
type: Directive
|
|
74
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
75
|
+
type: Inject,
|
|
76
|
+
args: [MY_TOKEN]
|
|
77
|
+
}] }, { type: i1.LocalizationService }]; }, propDecorators: { hostClasses: [{
|
|
78
|
+
type: HostBinding,
|
|
79
|
+
args: ['class.k-prompt-view']
|
|
80
|
+
}], template: [{
|
|
81
|
+
type: ViewChild,
|
|
82
|
+
args: ['content', { static: true }]
|
|
83
|
+
}], buttonText: [{
|
|
84
|
+
type: Input
|
|
85
|
+
}], icon: [{
|
|
86
|
+
type: Input
|
|
87
|
+
}], svgIcon: [{
|
|
88
|
+
type: Input
|
|
89
|
+
}] } });
|