@seniorsistemas/angular-components 15.0.2 → 15.0.4
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 +95 -70
- 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/table/table-column/table-columns.component.d.ts +10 -3
- package/esm2015/components/table/table-column/table-columns.component.js +97 -73
- package/esm2015/components/timeline/components/timeline-icon-item/timeline-icon-item.component.js +2 -2
- package/esm5/components/table/table-column/table-columns.component.js +97 -73
- package/esm5/components/timeline/components/timeline-icon-item/timeline-icon-item.component.js +2 -2
- package/fesm2015/seniorsistemas-angular-components.js +95 -70
- package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
- package/fesm5/seniorsistemas-angular-components.js +95 -70
- package/fesm5/seniorsistemas-angular-components.js.map +1 -1
- package/package.json +1 -1
- package/seniorsistemas-angular-components.metadata.json +1 -1
|
@@ -4151,12 +4151,15 @@ var TableColumnsComponent = /** @class */ (function () {
|
|
|
4151
4151
|
};
|
|
4152
4152
|
TableColumnsComponent.prototype.validateComponentAttributes = function (changes) {
|
|
4153
4153
|
var _a, _b, _c;
|
|
4154
|
-
if (!((_a = changes.columns) === null || _a === void 0 ? void 0 : _a.currentValue))
|
|
4154
|
+
if (!((_a = changes.columns) === null || _a === void 0 ? void 0 : _a.currentValue)) {
|
|
4155
4155
|
throw new Error("The 'columns' attribute must be informed!");
|
|
4156
|
-
|
|
4156
|
+
}
|
|
4157
|
+
if (!((_b = changes.rowValue) === null || _b === void 0 ? void 0 : _b.currentValue)) {
|
|
4157
4158
|
throw new Error("The 'rowValue' attribute must be informed!");
|
|
4158
|
-
|
|
4159
|
+
}
|
|
4160
|
+
if (!((_c = changes.locale) === null || _c === void 0 ? void 0 : _c.currentValue)) {
|
|
4159
4161
|
throw new Error("The 'locale' attribute must be informed!");
|
|
4162
|
+
}
|
|
4160
4163
|
};
|
|
4161
4164
|
TableColumnsComponent.prototype.createColumnsTemplate = function (changes) {
|
|
4162
4165
|
var _this = this;
|
|
@@ -4167,14 +4170,61 @@ var TableColumnsComponent = /** @class */ (function () {
|
|
|
4167
4170
|
columns.forEach(function (column) { return _this.formattedColumns.push(_this.getColumnValue(column, rowValue, locale)); });
|
|
4168
4171
|
this.viewContainerRef.createEmbeddedView(this.columnsTemplate);
|
|
4169
4172
|
};
|
|
4173
|
+
TableColumnsComponent.prototype.getColumnSeparator = function (column) {
|
|
4174
|
+
return column.separator ? column.separator : " - ";
|
|
4175
|
+
};
|
|
4176
|
+
TableColumnsComponent.prototype.getTranslationPrefix = function (column) {
|
|
4177
|
+
return column.prefix ? column.prefix : this.hostProjectConfigs.domain + "." + this.hostProjectConfigs.service + ".";
|
|
4178
|
+
};
|
|
4179
|
+
TableColumnsComponent.prototype.isAttributeValueInvalid = function (attributeValue) {
|
|
4180
|
+
return attributeValue === null || attributeValue === undefined || (this.isArray(attributeValue) && !attributeValue.length);
|
|
4181
|
+
};
|
|
4182
|
+
TableColumnsComponent.prototype.getFormattedColumnValue = function (column, columnValue, unifiedColumnValues, uninformedText, uninformedNumber) {
|
|
4183
|
+
if (uninformedNumber === column.attributes.length) {
|
|
4184
|
+
return uninformedText;
|
|
4185
|
+
}
|
|
4186
|
+
if (column.type === EnumColumnFieldType.TOKENS) {
|
|
4187
|
+
return [].concat.apply([], columnValue.filter(function (values) { return values !== uninformedText; }));
|
|
4188
|
+
}
|
|
4189
|
+
return unifiedColumnValues;
|
|
4190
|
+
};
|
|
4191
|
+
TableColumnsComponent.prototype.getAttributeValue = function (attribute, rowValue) {
|
|
4192
|
+
var attributeValue;
|
|
4193
|
+
attribute
|
|
4194
|
+
.split("/")
|
|
4195
|
+
.forEach(function (value) {
|
|
4196
|
+
if (!attributeValue) {
|
|
4197
|
+
value
|
|
4198
|
+
.split(".")
|
|
4199
|
+
.forEach(function (val, i) {
|
|
4200
|
+
if (!rowValue) {
|
|
4201
|
+
return;
|
|
4202
|
+
}
|
|
4203
|
+
if (i === 0) {
|
|
4204
|
+
attributeValue = rowValue[val];
|
|
4205
|
+
}
|
|
4206
|
+
else {
|
|
4207
|
+
if (attributeValue) {
|
|
4208
|
+
attributeValue = attributeValue[val];
|
|
4209
|
+
}
|
|
4210
|
+
}
|
|
4211
|
+
});
|
|
4212
|
+
}
|
|
4213
|
+
});
|
|
4214
|
+
return attributeValue;
|
|
4215
|
+
};
|
|
4216
|
+
TableColumnsComponent.prototype.getNumberConfigs = function (column, locale) {
|
|
4217
|
+
return __assign(__assign({}, locale.number), { scale: column.scale !== null && column.scale !== undefined
|
|
4218
|
+
? this.getColumnScale(column.scale)
|
|
4219
|
+
: locale.number.scale, prefix: locale.number.currencySymbol + " " });
|
|
4220
|
+
};
|
|
4221
|
+
TableColumnsComponent.prototype.getDateFormat = function (column, locale) {
|
|
4222
|
+
return column.dateFormat ? column.dateFormat : locale.calendar.dateFormat;
|
|
4223
|
+
};
|
|
4170
4224
|
TableColumnsComponent.prototype.getColumnValue = function (column, rowValue, locale) {
|
|
4171
4225
|
var _this = this;
|
|
4172
|
-
var prefix = column
|
|
4173
|
-
|
|
4174
|
-
: this.hostProjectConfigs.domain + "." + this.hostProjectConfigs.service + ".";
|
|
4175
|
-
var separator = column.separator
|
|
4176
|
-
? column.separator
|
|
4177
|
-
: " - ";
|
|
4226
|
+
var prefix = this.getTranslationPrefix(column);
|
|
4227
|
+
var separator = this.getColumnSeparator(column);
|
|
4178
4228
|
var uninformed = this.translate.instant(prefix + "empty_label");
|
|
4179
4229
|
var style = column.style;
|
|
4180
4230
|
var badgeClass = {
|
|
@@ -4182,69 +4232,40 @@ var TableColumnsComponent = /** @class */ (function () {
|
|
|
4182
4232
|
};
|
|
4183
4233
|
var columnValue = column.attributes
|
|
4184
4234
|
.map(function (attribute) {
|
|
4185
|
-
var
|
|
4186
|
-
attribute
|
|
4187
|
-
|
|
4188
|
-
.forEach(function (value) {
|
|
4189
|
-
if (!attributeValue) {
|
|
4190
|
-
value
|
|
4191
|
-
.split(".")
|
|
4192
|
-
.forEach(function (val, i) {
|
|
4193
|
-
if (rowValue) {
|
|
4194
|
-
if (i === 0) {
|
|
4195
|
-
attributeValue = rowValue[val];
|
|
4196
|
-
}
|
|
4197
|
-
else if (attributeValue) {
|
|
4198
|
-
attributeValue = attributeValue[val];
|
|
4199
|
-
}
|
|
4200
|
-
}
|
|
4201
|
-
});
|
|
4202
|
-
}
|
|
4203
|
-
});
|
|
4204
|
-
if (attributeValue === null || attributeValue === undefined || (_this.isArray(attributeValue) && !attributeValue.length)) {
|
|
4235
|
+
var _a;
|
|
4236
|
+
var attributeValue = _this.getAttributeValue(attribute, rowValue);
|
|
4237
|
+
if (_this.isAttributeValueInvalid(attributeValue)) {
|
|
4205
4238
|
return uninformed;
|
|
4206
4239
|
}
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
case EnumColumnFieldType.TOKENS:
|
|
4230
|
-
return _this.getTokens(attributeValue);
|
|
4231
|
-
}
|
|
4240
|
+
var numberConfigs = _this.getNumberConfigs(column, locale);
|
|
4241
|
+
switch (column.type) {
|
|
4242
|
+
case EnumColumnFieldType.ENUM:
|
|
4243
|
+
if ((_a = column.badgeConfigs) === null || _a === void 0 ? void 0 : _a.length) {
|
|
4244
|
+
badgeClass = _this.getBadgeClass(attributeValue, column.badgeConfigs);
|
|
4245
|
+
}
|
|
4246
|
+
return _this.translate.instant(column.enumPrefix + attributeValue.toString().toLowerCase());
|
|
4247
|
+
case EnumColumnFieldType.CURRENCY:
|
|
4248
|
+
return applyMask(attributeValue, numberConfigs, _this.isNumber(attributeValue));
|
|
4249
|
+
case EnumColumnFieldType.DATE:
|
|
4250
|
+
var dateFormat = _this.getDateFormat(column, locale);
|
|
4251
|
+
return moment_(attributeValue).format(dateFormat);
|
|
4252
|
+
case EnumColumnFieldType.BOOLEAN:
|
|
4253
|
+
var value = attributeValue ? "yes" : "no";
|
|
4254
|
+
return _this.translate.instant(prefix + value);
|
|
4255
|
+
case EnumColumnFieldType.NUMBER:
|
|
4256
|
+
numberConfigs.prefix = "";
|
|
4257
|
+
return applyMask(attributeValue, numberConfigs, _this.isNumber(attributeValue));
|
|
4258
|
+
case EnumColumnFieldType.TOKENS:
|
|
4259
|
+
return _this.getTokens(attributeValue);
|
|
4260
|
+
default:
|
|
4261
|
+
return attributeValue;
|
|
4232
4262
|
}
|
|
4233
4263
|
});
|
|
4234
4264
|
var unifiedColumnValues = columnValue.join(separator);
|
|
4235
4265
|
var uninformedNumber = unifiedColumnValues
|
|
4236
4266
|
.split(separator)
|
|
4237
4267
|
.filter(function (value) { return value === uninformed; }).length;
|
|
4238
|
-
var formattedColumnValue;
|
|
4239
|
-
if (uninformedNumber === column.attributes.length) {
|
|
4240
|
-
formattedColumnValue = uninformed;
|
|
4241
|
-
}
|
|
4242
|
-
else if (column.type === EnumColumnFieldType.TOKENS) {
|
|
4243
|
-
formattedColumnValue = [].concat.apply([], columnValue.filter(function (values) { return values !== uninformed; }));
|
|
4244
|
-
}
|
|
4245
|
-
else {
|
|
4246
|
-
formattedColumnValue = unifiedColumnValues;
|
|
4247
|
-
}
|
|
4268
|
+
var formattedColumnValue = this.getFormattedColumnValue(column, columnValue, unifiedColumnValues, uninformed, uninformedNumber);
|
|
4248
4269
|
return {
|
|
4249
4270
|
style: style,
|
|
4250
4271
|
columnValue: formattedColumnValue,
|
|
@@ -4279,18 +4300,21 @@ var TableColumnsComponent = /** @class */ (function () {
|
|
|
4279
4300
|
}
|
|
4280
4301
|
return tooltip;
|
|
4281
4302
|
}
|
|
4303
|
+
return "";
|
|
4282
4304
|
};
|
|
4283
4305
|
TableColumnsComponent.prototype.isNumber = function (value) {
|
|
4284
4306
|
return !(new BigNumber(value).isNaN());
|
|
4285
4307
|
};
|
|
4286
4308
|
TableColumnsComponent.prototype.getTokens = function (values) {
|
|
4287
|
-
if (!this.isArray(values))
|
|
4309
|
+
if (!this.isArray(values)) {
|
|
4288
4310
|
throw new Error("To use tokens an array must be informed");
|
|
4289
|
-
|
|
4290
|
-
if (!this.isValidTokenArray(values))
|
|
4291
|
-
throw new Error("Not a valid token array.
|
|
4292
|
-
|
|
4311
|
+
}
|
|
4312
|
+
if (!this.isValidTokenArray(values)) {
|
|
4313
|
+
throw new Error("Not a valid token array. Must be a primitive values array or an objects with label attribute array");
|
|
4314
|
+
}
|
|
4315
|
+
if (this.isLabelObjectArray(values)) {
|
|
4293
4316
|
return values;
|
|
4317
|
+
}
|
|
4294
4318
|
return values
|
|
4295
4319
|
.filter(function (value) { return value !== undefined && value !== null; })
|
|
4296
4320
|
.map(function (value) {
|
|
@@ -4325,6 +4349,7 @@ var TableColumnsComponent = /** @class */ (function () {
|
|
|
4325
4349
|
};
|
|
4326
4350
|
});
|
|
4327
4351
|
}
|
|
4352
|
+
return null;
|
|
4328
4353
|
};
|
|
4329
4354
|
TableColumnsComponent.ctorParameters = function () { return [
|
|
4330
4355
|
{ type: ViewContainerRef },
|
|
@@ -7457,7 +7482,7 @@ var TimelineIconItemComponent = /** @class */ (function () {
|
|
|
7457
7482
|
TimelineIconItemComponent = __decorate([
|
|
7458
7483
|
Component({
|
|
7459
7484
|
selector: "s-timeline-icon-item",
|
|
7460
|
-
template: "<ng-container *ngIf=\"item\">\n <div\n class=\"timeline__icon-item\"\n [ngClass]=\"{\n 'timeline__icon-item--small': item.testSize('small'),\n 'timeline__icon-item--normal': item.testSize('normal'),\n 'timeline__icon-item--warning': item.testSeverity('warning'),\n 'timeline__icon-item--error': item.testSeverity('error'),\n 'timeline__icon-item--completed': isComplete,\n 'timeline__icon-item--active': isActive\n }\">\n <div\n class=\"timeline__icon-item__icon\"\n [pTooltip]=\"item.tooltip\"\n tooltipPosition=\"top\">\n <ng-content *ngIf=\"item.icon; then icon_content; else label_text_content\"></ng-content>\n <ng-template #icon_content>\n <span
|
|
7485
|
+
template: "<ng-container *ngIf=\"item\">\n <div\n class=\"timeline__icon-item\"\n [ngClass]=\"{\n 'timeline__icon-item--small': item.testSize('small'),\n 'timeline__icon-item--normal': item.testSize('normal'),\n 'timeline__icon-item--warning': item.testSeverity('warning'),\n 'timeline__icon-item--error': item.testSeverity('error'),\n 'timeline__icon-item--completed': isComplete,\n 'timeline__icon-item--active': isActive\n }\">\n <div\n class=\"timeline__icon-item__icon\"\n [pTooltip]=\"item.tooltip\"\n tooltipPosition=\"top\">\n <ng-content *ngIf=\"item.icon; then icon_content; else label_text_content\"></ng-content>\n <ng-template #icon_content>\n <span [ngClass]=\"item.icon\"></span>\n </ng-template>\n <ng-template #label_text_content>\n <span class=\"timeline__icon-item__icon__label\">\n {{ item.label }}\n </span>\n </ng-template>\n </div>\n </div>\n</ng-container>\n",
|
|
7461
7486
|
styles: [".timeline__icon-item .timeline__icon-item__icon{-ms-flex-align:center;align-items:center;background-color:#697882;border-radius:50%;color:#fff;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;margin:4px;-webkit-user-select:none;-ms-user-select:none;user-select:none}.timeline__icon-item .timeline__icon-item__icon .timeline__icon-item__icon__label{font-family:\"Open Sans\",sans-serif}.timeline__icon-item.timeline__icon-item--small .timeline__icon-item__icon{font-size:0;height:16px;width:16px}.timeline__icon-item.timeline__icon-item--normal .timeline__icon-item__icon{font-size:10px;height:24px;padding:8px;width:24px}.timeline__icon-item.timeline__icon-item--normal .timeline__icon-item__icon .timeline__icon-item__icon__label{font-size:14px}.timeline__icon-item.timeline__icon-item--active .timeline__icon-item__icon{font-size:20px;height:40px;padding:10px;width:40px}.timeline__icon-item.timeline__icon-item--active .timeline__icon-item__icon .timeline__icon-item__icon__label{font-size:22px}.timeline__icon-item.timeline__icon-item--active .timeline__icon-item__icon,.timeline__icon-item.timeline__icon-item--completed .timeline__icon-item__icon{background-color:#0c9348}.timeline__icon-item.timeline__icon-item--warning.timeline__icon-item--active .timeline__icon-item__icon{background-color:#fcbf10;color:#333}.timeline__icon-item.timeline__icon-item--danger.timeline__icon-item--active .timeline__icon-item__icon{background-color:#f8931f;color:#333}.timeline__icon-item.timeline__icon-item--error.timeline__icon-item--active .timeline__icon-item__icon{background-color:#c13018}"]
|
|
7462
7487
|
})
|
|
7463
7488
|
], TimelineIconItemComponent);
|