@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,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/animations'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@seniorsistemas/angular-components', ['exports', '@angular/core', '@angular/animations', '
|
|
4
|
-
(global = global || self, factory((global.seniorsistemas = global.seniorsistemas || {}, global.seniorsistemas['angular-components'] = {}), global.ng.core, global.ng.animations, global.
|
|
5
|
-
}(this, (function (exports, core, animations, common, forms,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/animations'), require('rxjs'), require('rxjs/operators'), require('@angular/common'), require('@angular/forms'), require('@angular/router'), require('primeng/breadcrumb'), require('primeng/tieredmenu'), require('primeng/tooltip'), require('primeng/dom'), require('primeng/calendar'), require('@ngx-translate/core'), require('ngx-mask'), require('@angular/common/http'), require('angular2-hotkeys'), require('bignumber.js'), require('primeng/autocomplete'), require('primeng/dialog'), require('primeng/table'), require('@seniorsistemas/ng2-currency-mask'), require('@seniorsistemas/senior-platform-data'), require('moment'), require('ngx-cookie-service'), require('ng2-currency-mask'), require('primeng/button'), require('primeng/checkbox'), require('primeng/chips'), require('primeng/dropdown'), require('primeng/fieldset'), require('primeng/inputmask'), require('primeng/inputtext'), require('primeng/inputtextarea'), require('primeng/keyfilter'), require('primeng/multiselect'), require('primeng/panel'), require('primeng/radiobutton'), require('primeng/slider'), require('primeng/progressbar'), require('@angular/platform-browser'), require('primeng/api'), require('cropperjs'), require('element-resize-detector'), require('@angular/cdk/a11y'), require('primeng/scrollpanel'), require('primeng/sidebar'), require('primeng/confirmdialog'), require('@codemirror/view'), require('@codemirror/state'), require('@codemirror/lint'), require('@codemirror/language'), require('@lezer/generator'), require('@codemirror/highlight'), require('@codemirror/autocomplete'), require('@codemirror/tooltip'), require('@codemirror/gutter')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@seniorsistemas/angular-components', ['exports', '@angular/core', '@angular/animations', 'rxjs', 'rxjs/operators', '@angular/common', '@angular/forms', '@angular/router', 'primeng/breadcrumb', 'primeng/tieredmenu', 'primeng/tooltip', 'primeng/dom', 'primeng/calendar', '@ngx-translate/core', 'ngx-mask', '@angular/common/http', 'angular2-hotkeys', 'bignumber.js', 'primeng/autocomplete', 'primeng/dialog', 'primeng/table', '@seniorsistemas/ng2-currency-mask', '@seniorsistemas/senior-platform-data', 'moment', 'ngx-cookie-service', 'ng2-currency-mask', 'primeng/button', 'primeng/checkbox', 'primeng/chips', 'primeng/dropdown', 'primeng/fieldset', 'primeng/inputmask', 'primeng/inputtext', 'primeng/inputtextarea', 'primeng/keyfilter', 'primeng/multiselect', 'primeng/panel', 'primeng/radiobutton', 'primeng/slider', 'primeng/progressbar', '@angular/platform-browser', 'primeng/api', 'cropperjs', 'element-resize-detector', '@angular/cdk/a11y', 'primeng/scrollpanel', 'primeng/sidebar', 'primeng/confirmdialog', '@codemirror/view', '@codemirror/state', '@codemirror/lint', '@codemirror/language', '@lezer/generator', '@codemirror/highlight', '@codemirror/autocomplete', '@codemirror/tooltip', '@codemirror/gutter'], factory) :
|
|
4
|
+
(global = global || self, factory((global.seniorsistemas = global.seniorsistemas || {}, global.seniorsistemas['angular-components'] = {}), global.ng.core, global.ng.animations, global.rxjs, global.rxjs.operators, global.ng.common, global.ng.forms, global.ng.router, global.breadcrumb, global.tieredmenu, global.tooltip, global.dom, global.calendar, global.core$1, global.ngxMask, global.ng.common.http, global.angular2Hotkeys, global.BigNumber, global.autocomplete$1, global.dialog, global.table, global.ng2CurrencyMask, global.seniorPlatformData, global.moment_, global.ngxCookieService, global.ng2CurrencyMask$1, global.button, global.checkbox, global.chips, global.dropdown, global.fieldset, global.inputmask, global.inputtext, global.inputtextarea, global.keyfilter, global.multiselect, global.panel, global.radiobutton, global.slider, global.progressbar, global.ng.platformBrowser, global.api, global.Cropper, global.elementResizeDetectorMaker_, global.ng.cdk.a11y, global.scrollpanel, global.sidebar, global.confirmdialog, global.view, global.state, global.lint, global.language, global.generator, global.highlight, global.autocomplete$2, global.tooltip$1, global.gutter));
|
|
5
|
+
}(this, (function (exports, core, animations, rxjs, operators, common, forms, router, breadcrumb, tieredmenu, tooltip, dom, calendar, core$1, ngxMask, http, angular2Hotkeys, BigNumber, autocomplete$1, dialog, table, ng2CurrencyMask, seniorPlatformData, moment_, ngxCookieService, ng2CurrencyMask$1, button, checkbox, chips, dropdown, fieldset, inputmask, inputtext, inputtextarea, keyfilter, multiselect, panel, radiobutton, slider, progressbar, platformBrowser, api, Cropper, elementResizeDetectorMaker_, a11y, scrollpanel, sidebar, confirmdialog, view, state, lint, language, generator, highlight, autocomplete$2, tooltip$1, gutter) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var BigNumber__default = 'default' in BigNumber ? BigNumber['default'] : BigNumber;
|
|
8
8
|
Cropper = Cropper && Cropper.hasOwnProperty('default') ? Cropper['default'] : Cropper;
|
|
@@ -309,23 +309,24 @@
|
|
|
309
309
|
var AccordionComponent = /** @class */ (function () {
|
|
310
310
|
function AccordionComponent() {
|
|
311
311
|
this.multiple = false;
|
|
312
|
+
this._unsubscribe$ = new rxjs.Subject();
|
|
312
313
|
this._panels = [];
|
|
313
314
|
}
|
|
314
315
|
AccordionComponent.prototype.ngAfterContentInit = function () {
|
|
315
316
|
this._panels = this.panelsComponents.toArray();
|
|
316
317
|
this._openSubs = new Array(this._panels.length);
|
|
318
|
+
this._setBehavior(this.multiple);
|
|
317
319
|
this._setupTabs();
|
|
318
320
|
};
|
|
319
321
|
AccordionComponent.prototype.ngOnChanges = function (changes) {
|
|
320
322
|
if (changes.multiple) {
|
|
321
|
-
|
|
322
|
-
this._enableMultiplePanelBehavior();
|
|
323
|
-
}
|
|
324
|
-
else {
|
|
325
|
-
this._enableSinglePanelBehavior();
|
|
326
|
-
}
|
|
323
|
+
this._setBehavior(changes.multiple.currentValue);
|
|
327
324
|
}
|
|
328
325
|
};
|
|
326
|
+
AccordionComponent.prototype.ngOnDestroy = function () {
|
|
327
|
+
this._unsubscribe$.next();
|
|
328
|
+
this._unsubscribe$.complete();
|
|
329
|
+
};
|
|
329
330
|
AccordionComponent.prototype._setupTabs = function () {
|
|
330
331
|
var _a;
|
|
331
332
|
if ((_a = this._panels) === null || _a === void 0 ? void 0 : _a.length) {
|
|
@@ -347,10 +348,20 @@
|
|
|
347
348
|
}
|
|
348
349
|
});
|
|
349
350
|
};
|
|
351
|
+
AccordionComponent.prototype._setBehavior = function (multiple) {
|
|
352
|
+
if (multiple) {
|
|
353
|
+
this._enableMultiplePanelBehavior();
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
this._enableSinglePanelBehavior();
|
|
357
|
+
}
|
|
358
|
+
};
|
|
350
359
|
AccordionComponent.prototype._enableSinglePanelBehavior = function () {
|
|
351
360
|
var _this = this;
|
|
352
361
|
this._panels.forEach(function (panel, index) {
|
|
353
|
-
_this._openSubs[index] = panel.panelOpened
|
|
362
|
+
_this._openSubs[index] = panel.panelOpened
|
|
363
|
+
.pipe(operators.takeUntil(_this._unsubscribe$))
|
|
364
|
+
.subscribe(function () {
|
|
354
365
|
_this._closeOtherTabs(index);
|
|
355
366
|
});
|
|
356
367
|
});
|
|
@@ -886,7 +897,6 @@
|
|
|
886
897
|
imports: [
|
|
887
898
|
common.CommonModule,
|
|
888
899
|
forms.FormsModule,
|
|
889
|
-
animations$1.BrowserAnimationsModule,
|
|
890
900
|
TooltipModule,
|
|
891
901
|
SwitchModule,
|
|
892
902
|
],
|
|
@@ -6975,25 +6985,21 @@
|
|
|
6975
6985
|
}());
|
|
6976
6986
|
|
|
6977
6987
|
var IAssistService = /** @class */ (function () {
|
|
6978
|
-
function IAssistService(http, _messageService
|
|
6988
|
+
function IAssistService(http, _messageService) {
|
|
6979
6989
|
this.http = http;
|
|
6980
6990
|
this._messageService = _messageService;
|
|
6981
|
-
this._hostProjectConfigs = _hostProjectConfigs;
|
|
6982
6991
|
}
|
|
6983
6992
|
IAssistService.prototype.askIA = function (context, data) {
|
|
6984
6993
|
var _this = this;
|
|
6985
|
-
|
|
6994
|
+
return this.http.post("platform/iassist/api/latest/completions", {
|
|
6986
6995
|
"prompt": this._createPrompt(context, data),
|
|
6987
6996
|
"provider": "OPEN_AI",
|
|
6988
6997
|
"parameters": {
|
|
6989
6998
|
"model": "gpt-3.5-turbo",
|
|
6990
6999
|
"max_tokens": 700,
|
|
6991
|
-
"temperature": 1
|
|
7000
|
+
"temperature": 1
|
|
6992
7001
|
}
|
|
6993
|
-
}
|
|
6994
|
-
var url = this._endpointFactory().build("completions", prompt);
|
|
6995
|
-
return this.http.get(url)
|
|
6996
|
-
.pipe(operators.catchError(function (err) {
|
|
7002
|
+
}).pipe(operators.catchError(function (err) {
|
|
6997
7003
|
_this._messageService.add({
|
|
6998
7004
|
severity: "error",
|
|
6999
7005
|
summary: err.status ? String(err.status) : "Error",
|
|
@@ -7002,47 +7008,15 @@
|
|
|
7002
7008
|
return rxjs.throwError(err);
|
|
7003
7009
|
}));
|
|
7004
7010
|
};
|
|
7005
|
-
IAssistService.prototype._endpointFactory = function () {
|
|
7006
|
-
var _this = this;
|
|
7007
|
-
return {
|
|
7008
|
-
build: function (endpoint, params) {
|
|
7009
|
-
var e_1, _a;
|
|
7010
|
-
var base = _this._hostProjectConfigs.domain + "/" + _this._hostProjectConfigs.service + "/api/latest/" + endpoint;
|
|
7011
|
-
if (params) {
|
|
7012
|
-
var query = new URLSearchParams();
|
|
7013
|
-
try {
|
|
7014
|
-
for (var _b = __values(Object.keys(params)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
7015
|
-
var key = _c.value;
|
|
7016
|
-
var value = params[key];
|
|
7017
|
-
if (value) {
|
|
7018
|
-
query.append(key, value);
|
|
7019
|
-
}
|
|
7020
|
-
}
|
|
7021
|
-
}
|
|
7022
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
7023
|
-
finally {
|
|
7024
|
-
try {
|
|
7025
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
7026
|
-
}
|
|
7027
|
-
finally { if (e_1) throw e_1.error; }
|
|
7028
|
-
}
|
|
7029
|
-
return base + "?" + query;
|
|
7030
|
-
}
|
|
7031
|
-
return base;
|
|
7032
|
-
},
|
|
7033
|
-
};
|
|
7034
|
-
};
|
|
7035
7011
|
IAssistService.prototype._createPrompt = function (context, data) {
|
|
7036
|
-
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 + "'
|
|
7012
|
+
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";
|
|
7037
7013
|
};
|
|
7038
7014
|
IAssistService.ctorParameters = function () { return [
|
|
7039
7015
|
{ type: http.HttpClient },
|
|
7040
|
-
{ type: api.MessageService }
|
|
7041
|
-
{ type: undefined, decorators: [{ type: core.Inject, args: [HostProjectConfigsInjectionToken,] }] }
|
|
7016
|
+
{ type: api.MessageService }
|
|
7042
7017
|
]; };
|
|
7043
7018
|
IAssistService = __decorate([
|
|
7044
|
-
core.Injectable()
|
|
7045
|
-
__param(2, core.Inject(HostProjectConfigsInjectionToken))
|
|
7019
|
+
core.Injectable()
|
|
7046
7020
|
], IAssistService);
|
|
7047
7021
|
return IAssistService;
|
|
7048
7022
|
}());
|
|
@@ -7052,32 +7026,40 @@
|
|
|
7052
7026
|
this._iassistService = _iassistService;
|
|
7053
7027
|
this._formBuilder = _formBuilder;
|
|
7054
7028
|
this._translateService = _translateService;
|
|
7055
|
-
this.
|
|
7029
|
+
this.isVisible = false;
|
|
7030
|
+
this.isLoading = false;
|
|
7056
7031
|
}
|
|
7057
7032
|
TextAreaIAFieldComponent.prototype.ngOnInit = function () {
|
|
7058
7033
|
this._createDialogFields();
|
|
7059
7034
|
this._createDialogFormGroup();
|
|
7060
7035
|
};
|
|
7061
7036
|
TextAreaIAFieldComponent.prototype.showDialog = function () {
|
|
7062
|
-
this.
|
|
7037
|
+
this.isVisible = true;
|
|
7063
7038
|
};
|
|
7064
7039
|
TextAreaIAFieldComponent.prototype.onHideDialog = function () {
|
|
7065
7040
|
this.formGroup.get("context").setValue("");
|
|
7066
7041
|
};
|
|
7067
7042
|
TextAreaIAFieldComponent.prototype.hideDialog = function () {
|
|
7068
|
-
this.
|
|
7043
|
+
this.isVisible = false;
|
|
7069
7044
|
};
|
|
7070
7045
|
TextAreaIAFieldComponent.prototype.submitContext = function () {
|
|
7071
7046
|
var _this = this;
|
|
7072
7047
|
var context = this.formGroup.get("context");
|
|
7048
|
+
this.isLoading = true;
|
|
7073
7049
|
this._iassistService.askIA(context.value, {
|
|
7074
7050
|
id: this.field.id,
|
|
7075
7051
|
label: this.field.label,
|
|
7076
7052
|
placeholder: this.field.placeholder,
|
|
7077
|
-
})
|
|
7053
|
+
})
|
|
7054
|
+
.pipe(operators.catchError(function (err) {
|
|
7055
|
+
_this.isLoading = false;
|
|
7056
|
+
return rxjs.throwError(err);
|
|
7057
|
+
}))
|
|
7058
|
+
.subscribe(function (res) {
|
|
7078
7059
|
_this.formControl.setValue(res.text);
|
|
7060
|
+
_this.isLoading = false;
|
|
7079
7061
|
});
|
|
7080
|
-
this.
|
|
7062
|
+
this.hideDialog();
|
|
7081
7063
|
};
|
|
7082
7064
|
TextAreaIAFieldComponent.prototype._createDialogFields = function () {
|
|
7083
7065
|
this.fields = [
|
|
@@ -7107,7 +7089,7 @@
|
|
|
7107
7089
|
], TextAreaIAFieldComponent.prototype, "formControl", void 0);
|
|
7108
7090
|
TextAreaIAFieldComponent = __decorate([
|
|
7109
7091
|
core.Component({
|
|
7110
|
-
template: "<p-dialog\n [header]=\"'platform.angular_components.ia_text_generator' | translate\"\n [(visible)]=\"
|
|
7092
|
+
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>",
|
|
7111
7093
|
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}"]
|
|
7112
7094
|
})
|
|
7113
7095
|
], TextAreaIAFieldComponent);
|
|
@@ -11929,10 +11911,7 @@
|
|
|
11929
11911
|
}
|
|
11930
11912
|
SlidePanelModule = __decorate([
|
|
11931
11913
|
core.NgModule({
|
|
11932
|
-
imports: [
|
|
11933
|
-
common.CommonModule,
|
|
11934
|
-
animations$1.BrowserAnimationsModule,
|
|
11935
|
-
],
|
|
11914
|
+
imports: [common.CommonModule],
|
|
11936
11915
|
declarations: [SlidePanelComponent],
|
|
11937
11916
|
exports: [SlidePanelComponent],
|
|
11938
11917
|
})
|