@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
|
@@ -781,6 +781,8 @@ var AccordionModule = /** @class */ (function () {
|
|
|
781
781
|
return AccordionModule;
|
|
782
782
|
}());
|
|
783
783
|
|
|
784
|
+
// Lembrar que toda vez que for adicionada uma cor nova, ser criada a referência no `EnumBadgeColors`
|
|
785
|
+
// do s-table-columns.
|
|
784
786
|
var BadgeColors;
|
|
785
787
|
(function (BadgeColors) {
|
|
786
788
|
BadgeColors["Red"] = "red";
|
|
@@ -4960,6 +4962,7 @@ var TextAreaIAField = /** @class */ (function (_super) {
|
|
|
4960
4962
|
_this.rows = config.rows;
|
|
4961
4963
|
_this.keyFilter = config.keyFilter;
|
|
4962
4964
|
_this.style = config.style;
|
|
4965
|
+
_this.prompt = config.prompt;
|
|
4963
4966
|
return _this;
|
|
4964
4967
|
}
|
|
4965
4968
|
return TextAreaIAField;
|
|
@@ -5810,15 +5813,18 @@ var IAssistService = /** @class */ (function () {
|
|
|
5810
5813
|
}
|
|
5811
5814
|
IAssistService.prototype.askIA = function (context, data) {
|
|
5812
5815
|
var _this = this;
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
"
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
"
|
|
5820
|
-
|
|
5821
|
-
|
|
5816
|
+
var prompt = data.prompt ? this._replacePlaceholder(context, data) : this._createPrompt(context, data);
|
|
5817
|
+
return this.http
|
|
5818
|
+
.post("platform/iassist/api/latest/completions", {
|
|
5819
|
+
prompt: prompt,
|
|
5820
|
+
provider: "OPEN_AI",
|
|
5821
|
+
parameters: {
|
|
5822
|
+
model: "gpt-3.5-turbo",
|
|
5823
|
+
max_tokens: 700,
|
|
5824
|
+
temperature: 1,
|
|
5825
|
+
},
|
|
5826
|
+
})
|
|
5827
|
+
.pipe(catchError(function (err) {
|
|
5822
5828
|
_this._messageService.add({
|
|
5823
5829
|
severity: "error",
|
|
5824
5830
|
summary: err.status ? String(err.status) : "Error",
|
|
@@ -5827,6 +5833,17 @@ var IAssistService = /** @class */ (function () {
|
|
|
5827
5833
|
return throwError(err);
|
|
5828
5834
|
}));
|
|
5829
5835
|
};
|
|
5836
|
+
IAssistService.prototype._replacePlaceholder = function (context, data) {
|
|
5837
|
+
var values = __assign(__assign({}, data), { context: context });
|
|
5838
|
+
delete values.prompt;
|
|
5839
|
+
var result = data.prompt;
|
|
5840
|
+
for (var key in __assign(__assign({}, values), { context: context })) {
|
|
5841
|
+
var placeholder = new RegExp("{{\\s*" + key + "\\s*}}", "g");
|
|
5842
|
+
result = result.replace(placeholder, values[key]);
|
|
5843
|
+
}
|
|
5844
|
+
console.log("prompt", result);
|
|
5845
|
+
return result;
|
|
5846
|
+
};
|
|
5830
5847
|
IAssistService.prototype._createPrompt = function (context, data) {
|
|
5831
5848
|
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";
|
|
5832
5849
|
};
|
|
@@ -7577,12 +7594,12 @@ var EnumColumnFieldType;
|
|
|
7577
7594
|
|
|
7578
7595
|
var EnumBadgeColors;
|
|
7579
7596
|
(function (EnumBadgeColors) {
|
|
7580
|
-
EnumBadgeColors["RED"] = "
|
|
7581
|
-
EnumBadgeColors["ORANGE"] = "
|
|
7582
|
-
EnumBadgeColors["YELLOW"] = "
|
|
7583
|
-
EnumBadgeColors["GREEN"] = "
|
|
7584
|
-
EnumBadgeColors["BLUE"] = "
|
|
7585
|
-
EnumBadgeColors["GRAY"] = "
|
|
7597
|
+
EnumBadgeColors["RED"] = "red";
|
|
7598
|
+
EnumBadgeColors["ORANGE"] = "orange";
|
|
7599
|
+
EnumBadgeColors["YELLOW"] = "yellow";
|
|
7600
|
+
EnumBadgeColors["GREEN"] = "green";
|
|
7601
|
+
EnumBadgeColors["BLUE"] = "blue";
|
|
7602
|
+
EnumBadgeColors["GRAY"] = "gray";
|
|
7586
7603
|
})(EnumBadgeColors || (EnumBadgeColors = {}));
|
|
7587
7604
|
|
|
7588
7605
|
var moment$4 = moment_;
|
|
@@ -7671,16 +7688,13 @@ var TableColumnsComponent = /** @class */ (function () {
|
|
|
7671
7688
|
};
|
|
7672
7689
|
TableColumnsComponent.prototype.getColumnValue = function (column, rowValue, locale) {
|
|
7673
7690
|
var _this = this;
|
|
7691
|
+
var _a;
|
|
7674
7692
|
var prefix = this.getTranslationPrefix(column);
|
|
7675
7693
|
var separator = this.getColumnSeparator(column);
|
|
7676
7694
|
var uninformed = this.translate.instant(prefix + "empty_label");
|
|
7677
7695
|
var style = column.style;
|
|
7678
|
-
var badgeClass = {
|
|
7679
|
-
"sds-badge": false
|
|
7680
|
-
};
|
|
7681
7696
|
var columnValue = column.attributes
|
|
7682
7697
|
.map(function (attribute) {
|
|
7683
|
-
var _a;
|
|
7684
7698
|
var attributeValue = _this.getAttributeValue(attribute, rowValue);
|
|
7685
7699
|
if (_this.isAttributeValueInvalid(attributeValue)) {
|
|
7686
7700
|
return uninformed;
|
|
@@ -7688,9 +7702,6 @@ var TableColumnsComponent = /** @class */ (function () {
|
|
|
7688
7702
|
var numberConfigs = _this.getNumberConfigs(column, locale);
|
|
7689
7703
|
switch (column.type) {
|
|
7690
7704
|
case EnumColumnFieldType.ENUM:
|
|
7691
|
-
if ((_a = column.badgeConfigs) === null || _a === void 0 ? void 0 : _a.length) {
|
|
7692
|
-
badgeClass = _this.getBadgeClass(attributeValue, column.badgeConfigs);
|
|
7693
|
-
}
|
|
7694
7705
|
return _this.translate.instant(column.enumPrefix + attributeValue.toString().toLowerCase());
|
|
7695
7706
|
case EnumColumnFieldType.CURRENCY:
|
|
7696
7707
|
return applyMask(attributeValue, numberConfigs, _this.isNumber(attributeValue));
|
|
@@ -7717,9 +7728,9 @@ var TableColumnsComponent = /** @class */ (function () {
|
|
|
7717
7728
|
return {
|
|
7718
7729
|
style: style,
|
|
7719
7730
|
columnValue: formattedColumnValue,
|
|
7720
|
-
badgeClass: badgeClass,
|
|
7721
7731
|
separator: separator,
|
|
7722
7732
|
uninformed: uninformed,
|
|
7733
|
+
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]; }),
|
|
7723
7734
|
type: column.type,
|
|
7724
7735
|
tooltip: this.getColumnTooltip(column.tooltip),
|
|
7725
7736
|
infoSign: this.getColumnInfoSign(column.infoSign),
|
|
@@ -7727,15 +7738,6 @@ var TableColumnsComponent = /** @class */ (function () {
|
|
|
7727
7738
|
onColumnClick: column.onColumnClick
|
|
7728
7739
|
};
|
|
7729
7740
|
};
|
|
7730
|
-
TableColumnsComponent.prototype.getBadgeClass = function (value, badgeConfigs) {
|
|
7731
|
-
var _a;
|
|
7732
|
-
var badgeColumn = {
|
|
7733
|
-
"sds-badge": true
|
|
7734
|
-
};
|
|
7735
|
-
var color = (_a = badgeConfigs.find(function (badgeConfig) { return badgeConfig.enumValue === value; })) === null || _a === void 0 ? void 0 : _a.color.valueOf();
|
|
7736
|
-
badgeColumn[color] = true;
|
|
7737
|
-
return badgeColumn;
|
|
7738
|
-
};
|
|
7739
7741
|
TableColumnsComponent.prototype.getColumnScale = function (scale) {
|
|
7740
7742
|
if (typeof scale === "function") {
|
|
7741
7743
|
return scale(this.rowValue);
|
|
@@ -7828,7 +7830,7 @@ var TableColumnsComponent = /** @class */ (function () {
|
|
|
7828
7830
|
], TableColumnsComponent.prototype, "locale", void 0);
|
|
7829
7831
|
TableColumnsComponent = __decorate([
|
|
7830
7832
|
Component({
|
|
7831
|
-
template: "<ng-template #columnsTemplate>\n <td
|
|
7833
|
+
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",
|
|
7832
7834
|
selector: "s-table-columns",
|
|
7833
7835
|
styles: [":host{display:none}"]
|
|
7834
7836
|
}),
|
|
@@ -8151,7 +8153,8 @@ var TableModule = /** @class */ (function () {
|
|
|
8151
8153
|
TokenListModule,
|
|
8152
8154
|
TranslateModule,
|
|
8153
8155
|
ButtonModule,
|
|
8154
|
-
InfoSignModule
|
|
8156
|
+
InfoSignModule,
|
|
8157
|
+
BadgeModule
|
|
8155
8158
|
],
|
|
8156
8159
|
exports: [
|
|
8157
8160
|
RowTogllerDirective,
|
|
@@ -9062,10 +9065,12 @@ var TextAreaIAFieldComponent = /** @class */ (function () {
|
|
|
9062
9065
|
var _this = this;
|
|
9063
9066
|
var context = this.formGroup.get("context");
|
|
9064
9067
|
this.isLoading = true;
|
|
9065
|
-
this._iassistService
|
|
9068
|
+
this._iassistService
|
|
9069
|
+
.askIA(context.value, {
|
|
9066
9070
|
id: this.field.id,
|
|
9067
9071
|
label: this.field.label,
|
|
9068
9072
|
placeholder: this.field.placeholder,
|
|
9073
|
+
prompt: this.field.prompt,
|
|
9069
9074
|
})
|
|
9070
9075
|
.pipe(catchError(function (err) {
|
|
9071
9076
|
_this.isLoading = false;
|