@seniorsistemas/angular-components 17.3.10 → 17.3.12
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 +40 -35
- package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
- package/bundles/seniorsistemas-angular-components.umd.min.js +1 -1
- package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
- package/components/dynamic-form/configurations/fields/text-area-ia-field.d.ts +2 -0
- package/components/dynamic-form/services/IAssist/iassist.service.d.ts +1 -0
- package/components/dynamic-form/services/IAssist/models/iassist-input-data.d.ts +1 -0
- package/components/table/table-column/models/badge-configs.interface.d.ts +1 -1
- package/components/table/table-column/models/column-values.interface.d.ts +2 -2
- package/components/table/table-column/models/enum-badge-colors.d.ts +6 -6
- package/components/table/table-column/table-columns.component.d.ts +0 -1
- package/esm2015/components/badge/models/badge-colors.js +3 -1
- package/esm2015/components/dynamic-form/components/fields/text-area-ia/text-area-ia-field.component.js +4 -2
- package/esm2015/components/dynamic-form/configurations/fields/text-area-ia-field.js +2 -1
- package/esm2015/components/dynamic-form/services/IAssist/iassist.service.js +24 -10
- package/esm2015/components/dynamic-form/services/IAssist/models/iassist-input-data.js +1 -1
- package/esm2015/components/table/table-column/models/badge-configs.interface.js +1 -1
- package/esm2015/components/table/table-column/models/column-values.interface.js +1 -1
- package/esm2015/components/table/table-column/models/enum-badge-colors.js +7 -7
- package/esm2015/components/table/table-column/table-columns.component.js +6 -21
- package/esm2015/components/table/table.module.js +4 -2
- package/esm5/components/badge/models/badge-colors.js +3 -1
- package/esm5/components/dynamic-form/components/fields/text-area-ia/text-area-ia-field.component.js +4 -2
- package/esm5/components/dynamic-form/configurations/fields/text-area-ia-field.js +2 -1
- package/esm5/components/dynamic-form/services/IAssist/iassist.service.js +25 -11
- package/esm5/components/dynamic-form/services/IAssist/models/iassist-input-data.js +1 -1
- package/esm5/components/table/table-column/models/badge-configs.interface.js +1 -1
- package/esm5/components/table/table-column/models/column-values.interface.js +1 -1
- package/esm5/components/table/table-column/models/enum-badge-colors.js +7 -7
- package/esm5/components/table/table-column/table-columns.component.js +6 -21
- package/esm5/components/table/table.module.js +4 -2
- package/fesm2015/seniorsistemas-angular-components.js +40 -35
- package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
- package/fesm5/seniorsistemas-angular-components.js +40 -35
- package/fesm5/seniorsistemas-angular-components.js.map +1 -1
- package/package.json +2 -1
- package/seniorsistemas-angular-components.metadata.json +1 -1
|
@@ -927,6 +927,8 @@
|
|
|
927
927
|
return AccordionModule;
|
|
928
928
|
}());
|
|
929
929
|
|
|
930
|
+
// Lembrar que toda vez que for adicionada uma cor nova, ser criada a referência no `EnumBadgeColors`
|
|
931
|
+
// do s-table-columns.
|
|
930
932
|
|
|
931
933
|
(function (BadgeColors) {
|
|
932
934
|
BadgeColors["Red"] = "red";
|
|
@@ -5106,6 +5108,7 @@
|
|
|
5106
5108
|
_this.rows = config.rows;
|
|
5107
5109
|
_this.keyFilter = config.keyFilter;
|
|
5108
5110
|
_this.style = config.style;
|
|
5111
|
+
_this.prompt = config.prompt;
|
|
5109
5112
|
return _this;
|
|
5110
5113
|
}
|
|
5111
5114
|
return TextAreaIAField;
|
|
@@ -5956,15 +5959,18 @@
|
|
|
5956
5959
|
}
|
|
5957
5960
|
IAssistService.prototype.askIA = function (context, data) {
|
|
5958
5961
|
var _this = this;
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
"
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
"
|
|
5966
|
-
|
|
5967
|
-
|
|
5962
|
+
var prompt = data.prompt ? this._replacePlaceholder(context, data) : this._createPrompt(context, data);
|
|
5963
|
+
return this.http
|
|
5964
|
+
.post("platform/iassist/api/latest/completions", {
|
|
5965
|
+
prompt: prompt,
|
|
5966
|
+
provider: "OPEN_AI",
|
|
5967
|
+
parameters: {
|
|
5968
|
+
model: "gpt-3.5-turbo",
|
|
5969
|
+
max_tokens: 700,
|
|
5970
|
+
temperature: 1,
|
|
5971
|
+
},
|
|
5972
|
+
})
|
|
5973
|
+
.pipe(operators.catchError(function (err) {
|
|
5968
5974
|
_this._messageService.add({
|
|
5969
5975
|
severity: "error",
|
|
5970
5976
|
summary: err.status ? String(err.status) : "Error",
|
|
@@ -5973,6 +5979,17 @@
|
|
|
5973
5979
|
return rxjs.throwError(err);
|
|
5974
5980
|
}));
|
|
5975
5981
|
};
|
|
5982
|
+
IAssistService.prototype._replacePlaceholder = function (context, data) {
|
|
5983
|
+
var values = __assign(__assign({}, data), { context: context });
|
|
5984
|
+
delete values.prompt;
|
|
5985
|
+
var result = data.prompt;
|
|
5986
|
+
for (var key in __assign(__assign({}, values), { context: context })) {
|
|
5987
|
+
var placeholder = new RegExp("{{\\s*" + key + "\\s*}}", "g");
|
|
5988
|
+
result = result.replace(placeholder, values[key]);
|
|
5989
|
+
}
|
|
5990
|
+
console.log("prompt", result);
|
|
5991
|
+
return result;
|
|
5992
|
+
};
|
|
5976
5993
|
IAssistService.prototype._createPrompt = function (context, data) {
|
|
5977
5994
|
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";
|
|
5978
5995
|
};
|
|
@@ -7723,12 +7740,12 @@
|
|
|
7723
7740
|
|
|
7724
7741
|
|
|
7725
7742
|
(function (EnumBadgeColors) {
|
|
7726
|
-
EnumBadgeColors["RED"] = "
|
|
7727
|
-
EnumBadgeColors["ORANGE"] = "
|
|
7728
|
-
EnumBadgeColors["YELLOW"] = "
|
|
7729
|
-
EnumBadgeColors["GREEN"] = "
|
|
7730
|
-
EnumBadgeColors["BLUE"] = "
|
|
7731
|
-
EnumBadgeColors["GRAY"] = "
|
|
7743
|
+
EnumBadgeColors["RED"] = "red";
|
|
7744
|
+
EnumBadgeColors["ORANGE"] = "orange";
|
|
7745
|
+
EnumBadgeColors["YELLOW"] = "yellow";
|
|
7746
|
+
EnumBadgeColors["GREEN"] = "green";
|
|
7747
|
+
EnumBadgeColors["BLUE"] = "blue";
|
|
7748
|
+
EnumBadgeColors["GRAY"] = "gray";
|
|
7732
7749
|
})(exports.EnumBadgeColors || (exports.EnumBadgeColors = {}));
|
|
7733
7750
|
|
|
7734
7751
|
var moment$4 = moment_;
|
|
@@ -7817,16 +7834,13 @@
|
|
|
7817
7834
|
};
|
|
7818
7835
|
TableColumnsComponent.prototype.getColumnValue = function (column, rowValue, locale) {
|
|
7819
7836
|
var _this = this;
|
|
7837
|
+
var _a;
|
|
7820
7838
|
var prefix = this.getTranslationPrefix(column);
|
|
7821
7839
|
var separator = this.getColumnSeparator(column);
|
|
7822
7840
|
var uninformed = this.translate.instant(prefix + "empty_label");
|
|
7823
7841
|
var style = column.style;
|
|
7824
|
-
var badgeClass = {
|
|
7825
|
-
"sds-badge": false
|
|
7826
|
-
};
|
|
7827
7842
|
var columnValue = column.attributes
|
|
7828
7843
|
.map(function (attribute) {
|
|
7829
|
-
var _a;
|
|
7830
7844
|
var attributeValue = _this.getAttributeValue(attribute, rowValue);
|
|
7831
7845
|
if (_this.isAttributeValueInvalid(attributeValue)) {
|
|
7832
7846
|
return uninformed;
|
|
@@ -7834,9 +7848,6 @@
|
|
|
7834
7848
|
var numberConfigs = _this.getNumberConfigs(column, locale);
|
|
7835
7849
|
switch (column.type) {
|
|
7836
7850
|
case exports.EnumColumnFieldType.ENUM:
|
|
7837
|
-
if ((_a = column.badgeConfigs) === null || _a === void 0 ? void 0 : _a.length) {
|
|
7838
|
-
badgeClass = _this.getBadgeClass(attributeValue, column.badgeConfigs);
|
|
7839
|
-
}
|
|
7840
7851
|
return _this.translate.instant(column.enumPrefix + attributeValue.toString().toLowerCase());
|
|
7841
7852
|
case exports.EnumColumnFieldType.CURRENCY:
|
|
7842
7853
|
return ng2CurrencyMask.applyMask(attributeValue, numberConfigs, _this.isNumber(attributeValue));
|
|
@@ -7863,9 +7874,9 @@
|
|
|
7863
7874
|
return {
|
|
7864
7875
|
style: style,
|
|
7865
7876
|
columnValue: formattedColumnValue,
|
|
7866
|
-
badgeClass: badgeClass,
|
|
7867
7877
|
separator: separator,
|
|
7868
7878
|
uninformed: uninformed,
|
|
7879
|
+
badgeConfigs: (_a = column === null || column === void 0 ? void 0 : column.badgeConfigs) === null || _a === void 0 ? void 0 : _a.find(function (badgeConfig) { var _a; return badgeConfig.enumValue === rowValue[(_a = column.attributes[0]) !== null && _a !== void 0 ? _a : column.field]; }),
|
|
7869
7880
|
type: column.type,
|
|
7870
7881
|
tooltip: this.getColumnTooltip(column.tooltip),
|
|
7871
7882
|
infoSign: this.getColumnInfoSign(column.infoSign),
|
|
@@ -7873,15 +7884,6 @@
|
|
|
7873
7884
|
onColumnClick: column.onColumnClick
|
|
7874
7885
|
};
|
|
7875
7886
|
};
|
|
7876
|
-
TableColumnsComponent.prototype.getBadgeClass = function (value, badgeConfigs) {
|
|
7877
|
-
var _a;
|
|
7878
|
-
var badgeColumn = {
|
|
7879
|
-
"sds-badge": true
|
|
7880
|
-
};
|
|
7881
|
-
var color = (_a = badgeConfigs.find(function (badgeConfig) { return badgeConfig.enumValue === value; })) === null || _a === void 0 ? void 0 : _a.color.valueOf();
|
|
7882
|
-
badgeColumn[color] = true;
|
|
7883
|
-
return badgeColumn;
|
|
7884
|
-
};
|
|
7885
7887
|
TableColumnsComponent.prototype.getColumnScale = function (scale) {
|
|
7886
7888
|
if (typeof scale === "function") {
|
|
7887
7889
|
return scale(this.rowValue);
|
|
@@ -7974,7 +7976,7 @@
|
|
|
7974
7976
|
], TableColumnsComponent.prototype, "locale", void 0);
|
|
7975
7977
|
TableColumnsComponent = __decorate([
|
|
7976
7978
|
core.Component({
|
|
7977
|
-
template: "<ng-template #columnsTemplate>\n <td
|
|
7979
|
+
template: "<ng-template #columnsTemplate>\n <td\n *ngFor=\"let column of formattedColumns\"\n [ngStyle]=\"column.style\"\n (click)=\"column.onColumnClick ? column.onColumnClick(rowValue) : null\"\n >\n <div *ngIf=\"column.type !== 'TOKENS' || !isArray(column.columnValue); else tokensTemplate\">\n <span *ngIf=\"column.type !== 'LINK'\" [sTooltip]=\"column.tooltip\" [escape]=\"false\">\n <ng-container *ngTemplateOutlet=\"columnValueTemplate\"></ng-container>\n </span>\n\n <a\n *ngIf=\"column.type === 'LINK'\"\n [sTooltip]=\"column.tooltip\"\n [escape]=\"false\"\n (click)=\"column.onLinkClick ? column.onLinkClick(rowValue) : null\"\n >\n <ng-container *ngTemplateOutlet=\"columnValueTemplate\"></ng-container>\n </a>\n\n <ng-template #columnValueTemplate>\n <ng-container *ngFor=\"let value of getSplittedString(column)\">\n <span *ngIf=\"value.isUninformed; else isInformedTemplate\" class=\"sds-empty-value\">{{ value.value }}</span>\n\n <ng-template #isInformedTemplate>\n <s-badge\n *ngIf=\"column.badgeConfigs; else withoutBadgeTemplate\"\n [sTooltip]=\"column.tooltip\"\n [color]=\"column.badgeConfigs.color\"\n [text]=\"value.value\"\n ></s-badge>\n\n <ng-template #withoutBadgeTemplate>\n <span>{{ value.value }}</span>\n </ng-template>\n </ng-template>\n\n <span>{{ value.separator }}</span>\n </ng-container>\n\n <ng-container *ngIf=\"!!column.infoSign\">\n <span *sInfoSign=\"column.infoSign\"></span>\n </ng-container>\n </ng-template>\n </div>\n\n <ng-template #tokensTemplate>\n <s-token-list [tokens]=\"column.columnValue\" [hidePointerEvents]=\"true\"></s-token-list>\n\n <ng-container *ngIf=\"!!column.infoSign\">\n <span *sInfoSign=\"column.infoSign\"></span>\n </ng-container>\n </ng-template>\n </td>\n</ng-template>\n",
|
|
7978
7980
|
selector: "s-table-columns",
|
|
7979
7981
|
styles: [":host{display:none}"]
|
|
7980
7982
|
}),
|
|
@@ -8297,7 +8299,8 @@
|
|
|
8297
8299
|
TokenListModule,
|
|
8298
8300
|
core$1.TranslateModule,
|
|
8299
8301
|
ButtonModule,
|
|
8300
|
-
InfoSignModule
|
|
8302
|
+
InfoSignModule,
|
|
8303
|
+
BadgeModule
|
|
8301
8304
|
],
|
|
8302
8305
|
exports: [
|
|
8303
8306
|
RowTogllerDirective,
|
|
@@ -9208,10 +9211,12 @@
|
|
|
9208
9211
|
var _this = this;
|
|
9209
9212
|
var context = this.formGroup.get("context");
|
|
9210
9213
|
this.isLoading = true;
|
|
9211
|
-
this._iassistService
|
|
9214
|
+
this._iassistService
|
|
9215
|
+
.askIA(context.value, {
|
|
9212
9216
|
id: this.field.id,
|
|
9213
9217
|
label: this.field.label,
|
|
9214
9218
|
placeholder: this.field.placeholder,
|
|
9219
|
+
prompt: this.field.prompt,
|
|
9215
9220
|
})
|
|
9216
9221
|
.pipe(operators.catchError(function (err) {
|
|
9217
9222
|
_this.isLoading = false;
|