@seniorsistemas/angular-components 17.2.3 → 17.2.5
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/bundles/seniorsistemas-angular-components.umd.js +44 -65
- package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
- package/bundles/seniorsistemas-angular-components.umd.min.js +2 -2
- package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
- package/components/accordion/accordion.component.d.ts +5 -2
- package/components/dynamic-form/components/fields/text-area-ia/text-area-ia-field.component.d.ts +2 -1
- package/components/dynamic-form/services/IAssist/iassist.service.d.ts +1 -4
- package/esm2015/components/accordion/accordion.component.js +21 -8
- package/esm2015/components/accordion/accordion.module.js +1 -3
- package/esm2015/components/dynamic-form/components/fields/text-area-ia/text-area-ia-field.component.js +17 -7
- package/esm2015/components/dynamic-form/services/IAssist/iassist.service.js +10 -35
- package/esm2015/components/slide-panel/slide-panel.module.js +2 -6
- package/esm5/components/accordion/accordion.component.js +21 -8
- package/esm5/components/accordion/accordion.module.js +1 -3
- package/esm5/components/dynamic-form/components/fields/text-area-ia/text-area-ia-field.component.js +17 -7
- package/esm5/components/dynamic-form/services/IAssist/iassist.service.js +10 -47
- package/esm5/components/slide-panel/slide-panel.module.js +2 -6
- package/fesm2015/seniorsistemas-angular-components.js +42 -52
- package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
- package/fesm5/seniorsistemas-angular-components.js +42 -64
- package/fesm5/seniorsistemas-angular-components.js.map +1 -1
- package/package.json +1 -1
- package/seniorsistemas-angular-components.metadata.json +1 -1
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { __decorate, __spread, __assign, __values, __extends, __rest, __awaiter, __generator, __param, __read } from 'tslib';
|
|
2
2
|
import { EventEmitter, Input, Output, Component, ContentChildren, ViewChild, HostListener, forwardRef, NgModule, ɵɵdefineInjectable, Injectable, ElementRef, ApplicationRef, ComponentFactoryResolver, Injector, Directive, HostBinding, Renderer2, Pipe, ViewEncapsulation, InjectionToken, Inject, TemplateRef, ViewContainerRef, ChangeDetectorRef, Optional, ContentChild } from '@angular/core';
|
|
3
3
|
import { trigger, transition, style as style$7, animate, state, group, query, animateChild } from '@angular/animations';
|
|
4
|
+
import { Subject, of, from, throwError, forkJoin, ReplaySubject } from 'rxjs';
|
|
5
|
+
import { takeUntil, filter, tap, map, switchMap, catchError, delay, debounceTime, repeat, finalize, take } from 'rxjs/operators';
|
|
4
6
|
import { CommonModule } from '@angular/common';
|
|
5
7
|
import { NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule, FormControl, FormGroup, NG_VALIDATORS, FormBuilder, Validators, FormArray, ControlContainer } from '@angular/forms';
|
|
6
|
-
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
7
8
|
import { RouterModule, NavigationEnd, PRIMARY_OUTLET, ActivatedRoute, Router } from '@angular/router';
|
|
8
9
|
import { BreadcrumbModule as BreadcrumbModule$1 } from 'primeng/breadcrumb';
|
|
9
|
-
import { Subject, of, from, throwError, forkJoin, ReplaySubject } from 'rxjs';
|
|
10
|
-
import { takeUntil, filter, tap, map, switchMap, catchError, delay, debounceTime, repeat, finalize, take } from 'rxjs/operators';
|
|
11
10
|
import { TieredMenu, TieredMenuModule as TieredMenuModule$1 } from 'primeng/tieredmenu';
|
|
12
11
|
import { TooltipModule as TooltipModule$1 } from 'primeng/tooltip';
|
|
13
12
|
import { DomHandler } from 'primeng/dom';
|
|
@@ -162,23 +161,24 @@ var AccordionPanelComponent = /** @class */ (function () {
|
|
|
162
161
|
var AccordionComponent = /** @class */ (function () {
|
|
163
162
|
function AccordionComponent() {
|
|
164
163
|
this.multiple = false;
|
|
164
|
+
this._unsubscribe$ = new Subject();
|
|
165
165
|
this._panels = [];
|
|
166
166
|
}
|
|
167
167
|
AccordionComponent.prototype.ngAfterContentInit = function () {
|
|
168
168
|
this._panels = this.panelsComponents.toArray();
|
|
169
169
|
this._openSubs = new Array(this._panels.length);
|
|
170
|
+
this._setBehavior(this.multiple);
|
|
170
171
|
this._setupTabs();
|
|
171
172
|
};
|
|
172
173
|
AccordionComponent.prototype.ngOnChanges = function (changes) {
|
|
173
174
|
if (changes.multiple) {
|
|
174
|
-
|
|
175
|
-
this._enableMultiplePanelBehavior();
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
this._enableSinglePanelBehavior();
|
|
179
|
-
}
|
|
175
|
+
this._setBehavior(changes.multiple.currentValue);
|
|
180
176
|
}
|
|
181
177
|
};
|
|
178
|
+
AccordionComponent.prototype.ngOnDestroy = function () {
|
|
179
|
+
this._unsubscribe$.next();
|
|
180
|
+
this._unsubscribe$.complete();
|
|
181
|
+
};
|
|
182
182
|
AccordionComponent.prototype._setupTabs = function () {
|
|
183
183
|
var _a;
|
|
184
184
|
if ((_a = this._panels) === null || _a === void 0 ? void 0 : _a.length) {
|
|
@@ -200,10 +200,20 @@ var AccordionComponent = /** @class */ (function () {
|
|
|
200
200
|
}
|
|
201
201
|
});
|
|
202
202
|
};
|
|
203
|
+
AccordionComponent.prototype._setBehavior = function (multiple) {
|
|
204
|
+
if (multiple) {
|
|
205
|
+
this._enableMultiplePanelBehavior();
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
this._enableSinglePanelBehavior();
|
|
209
|
+
}
|
|
210
|
+
};
|
|
203
211
|
AccordionComponent.prototype._enableSinglePanelBehavior = function () {
|
|
204
212
|
var _this = this;
|
|
205
213
|
this._panels.forEach(function (panel, index) {
|
|
206
|
-
_this._openSubs[index] = panel.panelOpened
|
|
214
|
+
_this._openSubs[index] = panel.panelOpened
|
|
215
|
+
.pipe(takeUntil(_this._unsubscribe$))
|
|
216
|
+
.subscribe(function () {
|
|
207
217
|
_this._closeOtherTabs(index);
|
|
208
218
|
});
|
|
209
219
|
});
|
|
@@ -739,7 +749,6 @@ var AccordionModule = /** @class */ (function () {
|
|
|
739
749
|
imports: [
|
|
740
750
|
CommonModule,
|
|
741
751
|
FormsModule,
|
|
742
|
-
BrowserAnimationsModule,
|
|
743
752
|
TooltipModule,
|
|
744
753
|
SwitchModule,
|
|
745
754
|
],
|
|
@@ -6828,25 +6837,21 @@ var TextAreaFieldComponent = /** @class */ (function () {
|
|
|
6828
6837
|
}());
|
|
6829
6838
|
|
|
6830
6839
|
var IAssistService = /** @class */ (function () {
|
|
6831
|
-
function IAssistService(http, _messageService
|
|
6840
|
+
function IAssistService(http, _messageService) {
|
|
6832
6841
|
this.http = http;
|
|
6833
6842
|
this._messageService = _messageService;
|
|
6834
|
-
this._hostProjectConfigs = _hostProjectConfigs;
|
|
6835
6843
|
}
|
|
6836
6844
|
IAssistService.prototype.askIA = function (context, data) {
|
|
6837
6845
|
var _this = this;
|
|
6838
|
-
|
|
6846
|
+
return this.http.post("platform/iassist/api/latest/completions", {
|
|
6839
6847
|
"prompt": this._createPrompt(context, data),
|
|
6840
6848
|
"provider": "OPEN_AI",
|
|
6841
6849
|
"parameters": {
|
|
6842
6850
|
"model": "gpt-3.5-turbo",
|
|
6843
6851
|
"max_tokens": 700,
|
|
6844
|
-
"temperature": 1
|
|
6852
|
+
"temperature": 1
|
|
6845
6853
|
}
|
|
6846
|
-
}
|
|
6847
|
-
var url = this._endpointFactory().build("completions", prompt);
|
|
6848
|
-
return this.http.get(url)
|
|
6849
|
-
.pipe(catchError(function (err) {
|
|
6854
|
+
}).pipe(catchError(function (err) {
|
|
6850
6855
|
_this._messageService.add({
|
|
6851
6856
|
severity: "error",
|
|
6852
6857
|
summary: err.status ? String(err.status) : "Error",
|
|
@@ -6855,47 +6860,15 @@ var IAssistService = /** @class */ (function () {
|
|
|
6855
6860
|
return throwError(err);
|
|
6856
6861
|
}));
|
|
6857
6862
|
};
|
|
6858
|
-
IAssistService.prototype._endpointFactory = function () {
|
|
6859
|
-
var _this = this;
|
|
6860
|
-
return {
|
|
6861
|
-
build: function (endpoint, params) {
|
|
6862
|
-
var e_1, _a;
|
|
6863
|
-
var base = _this._hostProjectConfigs.domain + "/" + _this._hostProjectConfigs.service + "/api/latest/" + endpoint;
|
|
6864
|
-
if (params) {
|
|
6865
|
-
var query = new URLSearchParams();
|
|
6866
|
-
try {
|
|
6867
|
-
for (var _b = __values(Object.keys(params)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
6868
|
-
var key = _c.value;
|
|
6869
|
-
var value = params[key];
|
|
6870
|
-
if (value) {
|
|
6871
|
-
query.append(key, value);
|
|
6872
|
-
}
|
|
6873
|
-
}
|
|
6874
|
-
}
|
|
6875
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
6876
|
-
finally {
|
|
6877
|
-
try {
|
|
6878
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
6879
|
-
}
|
|
6880
|
-
finally { if (e_1) throw e_1.error; }
|
|
6881
|
-
}
|
|
6882
|
-
return base + "?" + query;
|
|
6883
|
-
}
|
|
6884
|
-
return base;
|
|
6885
|
-
},
|
|
6886
|
-
};
|
|
6887
|
-
};
|
|
6888
6863
|
IAssistService.prototype._createPrompt = function (context, data) {
|
|
6889
|
-
return "Crie um texto gen\u00E9rico para preencher o campo de textarea.\n " + (data.label ? "O campo tem o label " + data.label + "." : "") + "\n " + (data.id ? "O campo tem o id " + data.id + "." : "") + "\n " + (data.placeholder ? "Considere as instru\u00E7\u00F5es/sugest\u00F5es do placeholder: " + data.placeholder + "." : "") + "\n Baseie-se no contexto informado pelo usu\u00E1rio: '" + context + "'
|
|
6864
|
+
return "Crie um texto gen\u00E9rico para preencher o campo de textarea.\n " + (data.label ? "O campo tem o label " + data.label + "." : "") + "\n " + (data.id ? "O campo tem o id " + data.id + "." : "") + "\n " + (data.placeholder ? "Considere as instru\u00E7\u00F5es/sugest\u00F5es do placeholder: " + data.placeholder + "." : "") + "\n Baseie-se no contexto informado pelo usu\u00E1rio: '" + context + "'.\n O texto deve ser formal e conter informa\u00E7\u00F5es pertinentes a um campo como este, como se um usu\u00E1rio real tivesse preenchido com as informa\u00E7\u00F5es necess\u00E1rias. \n O texto deve ser neutro com rela\u00E7\u00E3o a generos, ra\u00E7as, religi\u00F5es, etc.\n O texto deve ser impessoal e n\u00E3o deve conter informa\u00E7\u00F5es pessoais do usu\u00E1rio.\n N\u00E3o direcione o texto a ningu\u00E9m, n\u00E3o use express\u00F5es como: caro, atenciosamente. gostaria, agrade\u00E7o. O texto deve ser gen\u00E9rico.\n \n Exemplos de texto:\n Um campo de descri\u00E7\u00E3o de usu\u00E1rio: \"Usu\u00E1rio com 20 anos, estudante de engenharia, gosta de jogar futebol e assistir filmes.\"\n Outro exemplo de descri\u00E7\u00E3o de usu\u00E1rio: \"Usu\u00E1rio administrador, com acesso total ao sistema, respons\u00E1vel por gerenciar os usu\u00E1rios e os produtos.\"\n Um campo de descri\u00E7\u00E3o de um produto: \"O produto \u00E9 um celular, com tela de 6 polegadas, 128GB de armazenamento, 4GB de mem\u00F3ria RAM, c\u00E2mera de 12MP e bateria de 4000mAh.\"\n Outro exemplo de descri\u00E7\u00E3o de produto: \"O produto \u00E9 uma geladeira, com capacidade de 500 litros, 2 portas, cor branca, com freezer e gaveta de legumes.\"\n Outro exemplo de descri\u00E7\u00E3o de produto: \"O produto \u00E9 uma camiseta, tamanho M, cor azul, 100% algod\u00E3o, com estampa de um gato.\"\n \n Em caso de contexto incompleto crie um texto gen\u00E9rico, como se fosse um exemplo de preenchimento do campo.\n O texto \u00E9 para um campo de textarea, ent\u00E3o escreva um texto sucinto.\n Exiba apenas o texto do output";
|
|
6890
6865
|
};
|
|
6891
6866
|
IAssistService.ctorParameters = function () { return [
|
|
6892
6867
|
{ type: HttpClient },
|
|
6893
|
-
{ type: MessageService }
|
|
6894
|
-
{ type: undefined, decorators: [{ type: Inject, args: [HostProjectConfigsInjectionToken,] }] }
|
|
6868
|
+
{ type: MessageService }
|
|
6895
6869
|
]; };
|
|
6896
6870
|
IAssistService = __decorate([
|
|
6897
|
-
Injectable()
|
|
6898
|
-
__param(2, Inject(HostProjectConfigsInjectionToken))
|
|
6871
|
+
Injectable()
|
|
6899
6872
|
], IAssistService);
|
|
6900
6873
|
return IAssistService;
|
|
6901
6874
|
}());
|
|
@@ -6905,32 +6878,40 @@ var TextAreaIAFieldComponent = /** @class */ (function () {
|
|
|
6905
6878
|
this._iassistService = _iassistService;
|
|
6906
6879
|
this._formBuilder = _formBuilder;
|
|
6907
6880
|
this._translateService = _translateService;
|
|
6908
|
-
this.
|
|
6881
|
+
this.isVisible = false;
|
|
6882
|
+
this.isLoading = false;
|
|
6909
6883
|
}
|
|
6910
6884
|
TextAreaIAFieldComponent.prototype.ngOnInit = function () {
|
|
6911
6885
|
this._createDialogFields();
|
|
6912
6886
|
this._createDialogFormGroup();
|
|
6913
6887
|
};
|
|
6914
6888
|
TextAreaIAFieldComponent.prototype.showDialog = function () {
|
|
6915
|
-
this.
|
|
6889
|
+
this.isVisible = true;
|
|
6916
6890
|
};
|
|
6917
6891
|
TextAreaIAFieldComponent.prototype.onHideDialog = function () {
|
|
6918
6892
|
this.formGroup.get("context").setValue("");
|
|
6919
6893
|
};
|
|
6920
6894
|
TextAreaIAFieldComponent.prototype.hideDialog = function () {
|
|
6921
|
-
this.
|
|
6895
|
+
this.isVisible = false;
|
|
6922
6896
|
};
|
|
6923
6897
|
TextAreaIAFieldComponent.prototype.submitContext = function () {
|
|
6924
6898
|
var _this = this;
|
|
6925
6899
|
var context = this.formGroup.get("context");
|
|
6900
|
+
this.isLoading = true;
|
|
6926
6901
|
this._iassistService.askIA(context.value, {
|
|
6927
6902
|
id: this.field.id,
|
|
6928
6903
|
label: this.field.label,
|
|
6929
6904
|
placeholder: this.field.placeholder,
|
|
6930
|
-
})
|
|
6905
|
+
})
|
|
6906
|
+
.pipe(catchError(function (err) {
|
|
6907
|
+
_this.isLoading = false;
|
|
6908
|
+
return throwError(err);
|
|
6909
|
+
}))
|
|
6910
|
+
.subscribe(function (res) {
|
|
6931
6911
|
_this.formControl.setValue(res.text);
|
|
6912
|
+
_this.isLoading = false;
|
|
6932
6913
|
});
|
|
6933
|
-
this.
|
|
6914
|
+
this.hideDialog();
|
|
6934
6915
|
};
|
|
6935
6916
|
TextAreaIAFieldComponent.prototype._createDialogFields = function () {
|
|
6936
6917
|
this.fields = [
|
|
@@ -6960,7 +6941,7 @@ var TextAreaIAFieldComponent = /** @class */ (function () {
|
|
|
6960
6941
|
], TextAreaIAFieldComponent.prototype, "formControl", void 0);
|
|
6961
6942
|
TextAreaIAFieldComponent = __decorate([
|
|
6962
6943
|
Component({
|
|
6963
|
-
template: "<p-dialog\n [header]=\"'platform.angular_components.ia_text_generator' | translate\"\n [(visible)]=\"
|
|
6944
|
+
template: "<s-loading-state\n [loading]=\"isLoading\"\n [blockWindow]=\"true\"> \n</s-loading-state>\n\n<p-dialog\n [header]=\"'platform.angular_components.ia_text_generator' | translate\"\n [(visible)]=\"isVisible\"\n [modal]=\"true\"\n [style]=\"{ width: '50vw' }\"\n [draggable]=\"false\"\n [resizable]=\"false\"\n (onHide)=\"onHideDialog()\">\n <s-dynamic-form\n [fields]=\"fields\"\n [form]=\"formGroup\">\n </s-dynamic-form>\n <p-footer>\n <div class=\"footer-content\">\n <s-button\n id=\"-submit-button\"\n type=\"button\"\n [label]=\"'platform.angular_components.generate_text' | translate\"\n (onClick)=\"submitContext()\"\n sTooltip=\"(ALT + SHIFT + S)\"\n showDelay=\"500\">\n </s-button>\n <s-button\n id=\"-cancel-button\"\n type=\"button\"\n priority=\"link\"\n [label]=\"'platform.angular_components.cancel' | translate\"\n (onClick)=\"hideDialog()\"\n sTooltip=\"(ALT + SHIFT + C)\"\n showDelay=\"500\">\n </s-button>\n </div>\n </p-footer>\n</p-dialog>\n\n<div class=\"textarea-ia\">\n <textarea\n [id]=\"(field.id || field.name)\"\n pInputTextarea\n [rows]=\"field.rows\"\n [cols]=\"field.cols\"\n [formControl]=\"formControl\"\n style=\"resize: vertical;\"\n [ngStyle]=\"field.style\">\n </textarea>\n <s-button\n priority=\"default\"\n (onClick)=\"showDialog()\"\n iconClass=\"far fa-lightbulb-on\"\n [auxiliary]=\"true\"\n [tooltip]=\"'platform.angular_components.ia_text_generator' | translate\">\n </s-button>\n</div>",
|
|
6964
6945
|
styles: [".footer-content{display:-ms-flexbox;display:flex;-ms-flex-positive:0;flex-grow:0}.textarea-ia{display:-ms-flexbox;display:flex;-ms-flex-align:end;align-items:flex-end;gap:8px}"]
|
|
6965
6946
|
})
|
|
6966
6947
|
], TextAreaIAFieldComponent);
|
|
@@ -11782,10 +11763,7 @@ var SlidePanelModule = /** @class */ (function () {
|
|
|
11782
11763
|
}
|
|
11783
11764
|
SlidePanelModule = __decorate([
|
|
11784
11765
|
NgModule({
|
|
11785
|
-
imports: [
|
|
11786
|
-
CommonModule,
|
|
11787
|
-
BrowserAnimationsModule,
|
|
11788
|
-
],
|
|
11766
|
+
imports: [CommonModule],
|
|
11789
11767
|
declarations: [SlidePanelComponent],
|
|
11790
11768
|
exports: [SlidePanelComponent],
|
|
11791
11769
|
})
|