@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
|
@@ -4324,12 +4324,15 @@
|
|
|
4324
4324
|
};
|
|
4325
4325
|
TableColumnsComponent.prototype.validateComponentAttributes = function (changes) {
|
|
4326
4326
|
var _a, _b, _c;
|
|
4327
|
-
if (!((_a = changes.columns) === null || _a === void 0 ? void 0 : _a.currentValue))
|
|
4327
|
+
if (!((_a = changes.columns) === null || _a === void 0 ? void 0 : _a.currentValue)) {
|
|
4328
4328
|
throw new Error("The 'columns' attribute must be informed!");
|
|
4329
|
-
|
|
4329
|
+
}
|
|
4330
|
+
if (!((_b = changes.rowValue) === null || _b === void 0 ? void 0 : _b.currentValue)) {
|
|
4330
4331
|
throw new Error("The 'rowValue' attribute must be informed!");
|
|
4331
|
-
|
|
4332
|
+
}
|
|
4333
|
+
if (!((_c = changes.locale) === null || _c === void 0 ? void 0 : _c.currentValue)) {
|
|
4332
4334
|
throw new Error("The 'locale' attribute must be informed!");
|
|
4335
|
+
}
|
|
4333
4336
|
};
|
|
4334
4337
|
TableColumnsComponent.prototype.createColumnsTemplate = function (changes) {
|
|
4335
4338
|
var _this = this;
|
|
@@ -4340,14 +4343,61 @@
|
|
|
4340
4343
|
columns.forEach(function (column) { return _this.formattedColumns.push(_this.getColumnValue(column, rowValue, locale)); });
|
|
4341
4344
|
this.viewContainerRef.createEmbeddedView(this.columnsTemplate);
|
|
4342
4345
|
};
|
|
4346
|
+
TableColumnsComponent.prototype.getColumnSeparator = function (column) {
|
|
4347
|
+
return column.separator ? column.separator : " - ";
|
|
4348
|
+
};
|
|
4349
|
+
TableColumnsComponent.prototype.getTranslationPrefix = function (column) {
|
|
4350
|
+
return column.prefix ? column.prefix : this.hostProjectConfigs.domain + "." + this.hostProjectConfigs.service + ".";
|
|
4351
|
+
};
|
|
4352
|
+
TableColumnsComponent.prototype.isAttributeValueInvalid = function (attributeValue) {
|
|
4353
|
+
return attributeValue === null || attributeValue === undefined || (this.isArray(attributeValue) && !attributeValue.length);
|
|
4354
|
+
};
|
|
4355
|
+
TableColumnsComponent.prototype.getFormattedColumnValue = function (column, columnValue, unifiedColumnValues, uninformedText, uninformedNumber) {
|
|
4356
|
+
if (uninformedNumber === column.attributes.length) {
|
|
4357
|
+
return uninformedText;
|
|
4358
|
+
}
|
|
4359
|
+
if (column.type === exports.EnumColumnFieldType.TOKENS) {
|
|
4360
|
+
return [].concat.apply([], columnValue.filter(function (values) { return values !== uninformedText; }));
|
|
4361
|
+
}
|
|
4362
|
+
return unifiedColumnValues;
|
|
4363
|
+
};
|
|
4364
|
+
TableColumnsComponent.prototype.getAttributeValue = function (attribute, rowValue) {
|
|
4365
|
+
var attributeValue;
|
|
4366
|
+
attribute
|
|
4367
|
+
.split("/")
|
|
4368
|
+
.forEach(function (value) {
|
|
4369
|
+
if (!attributeValue) {
|
|
4370
|
+
value
|
|
4371
|
+
.split(".")
|
|
4372
|
+
.forEach(function (val, i) {
|
|
4373
|
+
if (!rowValue) {
|
|
4374
|
+
return;
|
|
4375
|
+
}
|
|
4376
|
+
if (i === 0) {
|
|
4377
|
+
attributeValue = rowValue[val];
|
|
4378
|
+
}
|
|
4379
|
+
else {
|
|
4380
|
+
if (attributeValue) {
|
|
4381
|
+
attributeValue = attributeValue[val];
|
|
4382
|
+
}
|
|
4383
|
+
}
|
|
4384
|
+
});
|
|
4385
|
+
}
|
|
4386
|
+
});
|
|
4387
|
+
return attributeValue;
|
|
4388
|
+
};
|
|
4389
|
+
TableColumnsComponent.prototype.getNumberConfigs = function (column, locale) {
|
|
4390
|
+
return __assign(__assign({}, locale.number), { scale: column.scale !== null && column.scale !== undefined
|
|
4391
|
+
? this.getColumnScale(column.scale)
|
|
4392
|
+
: locale.number.scale, prefix: locale.number.currencySymbol + " " });
|
|
4393
|
+
};
|
|
4394
|
+
TableColumnsComponent.prototype.getDateFormat = function (column, locale) {
|
|
4395
|
+
return column.dateFormat ? column.dateFormat : locale.calendar.dateFormat;
|
|
4396
|
+
};
|
|
4343
4397
|
TableColumnsComponent.prototype.getColumnValue = function (column, rowValue, locale) {
|
|
4344
4398
|
var _this = this;
|
|
4345
|
-
var prefix = column
|
|
4346
|
-
|
|
4347
|
-
: this.hostProjectConfigs.domain + "." + this.hostProjectConfigs.service + ".";
|
|
4348
|
-
var separator = column.separator
|
|
4349
|
-
? column.separator
|
|
4350
|
-
: " - ";
|
|
4399
|
+
var prefix = this.getTranslationPrefix(column);
|
|
4400
|
+
var separator = this.getColumnSeparator(column);
|
|
4351
4401
|
var uninformed = this.translate.instant(prefix + "empty_label");
|
|
4352
4402
|
var style = column.style;
|
|
4353
4403
|
var badgeClass = {
|
|
@@ -4355,69 +4405,40 @@
|
|
|
4355
4405
|
};
|
|
4356
4406
|
var columnValue = column.attributes
|
|
4357
4407
|
.map(function (attribute) {
|
|
4358
|
-
var
|
|
4359
|
-
attribute
|
|
4360
|
-
|
|
4361
|
-
.forEach(function (value) {
|
|
4362
|
-
if (!attributeValue) {
|
|
4363
|
-
value
|
|
4364
|
-
.split(".")
|
|
4365
|
-
.forEach(function (val, i) {
|
|
4366
|
-
if (rowValue) {
|
|
4367
|
-
if (i === 0) {
|
|
4368
|
-
attributeValue = rowValue[val];
|
|
4369
|
-
}
|
|
4370
|
-
else if (attributeValue) {
|
|
4371
|
-
attributeValue = attributeValue[val];
|
|
4372
|
-
}
|
|
4373
|
-
}
|
|
4374
|
-
});
|
|
4375
|
-
}
|
|
4376
|
-
});
|
|
4377
|
-
if (attributeValue === null || attributeValue === undefined || (_this.isArray(attributeValue) && !attributeValue.length)) {
|
|
4408
|
+
var _a;
|
|
4409
|
+
var attributeValue = _this.getAttributeValue(attribute, rowValue);
|
|
4410
|
+
if (_this.isAttributeValueInvalid(attributeValue)) {
|
|
4378
4411
|
return uninformed;
|
|
4379
4412
|
}
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
case exports.EnumColumnFieldType.TOKENS:
|
|
4403
|
-
return _this.getTokens(attributeValue);
|
|
4404
|
-
}
|
|
4413
|
+
var numberConfigs = _this.getNumberConfigs(column, locale);
|
|
4414
|
+
switch (column.type) {
|
|
4415
|
+
case exports.EnumColumnFieldType.ENUM:
|
|
4416
|
+
if ((_a = column.badgeConfigs) === null || _a === void 0 ? void 0 : _a.length) {
|
|
4417
|
+
badgeClass = _this.getBadgeClass(attributeValue, column.badgeConfigs);
|
|
4418
|
+
}
|
|
4419
|
+
return _this.translate.instant(column.enumPrefix + attributeValue.toString().toLowerCase());
|
|
4420
|
+
case exports.EnumColumnFieldType.CURRENCY:
|
|
4421
|
+
return ng2CurrencyMask.applyMask(attributeValue, numberConfigs, _this.isNumber(attributeValue));
|
|
4422
|
+
case exports.EnumColumnFieldType.DATE:
|
|
4423
|
+
var dateFormat = _this.getDateFormat(column, locale);
|
|
4424
|
+
return moment_(attributeValue).format(dateFormat);
|
|
4425
|
+
case exports.EnumColumnFieldType.BOOLEAN:
|
|
4426
|
+
var value = attributeValue ? "yes" : "no";
|
|
4427
|
+
return _this.translate.instant(prefix + value);
|
|
4428
|
+
case exports.EnumColumnFieldType.NUMBER:
|
|
4429
|
+
numberConfigs.prefix = "";
|
|
4430
|
+
return ng2CurrencyMask.applyMask(attributeValue, numberConfigs, _this.isNumber(attributeValue));
|
|
4431
|
+
case exports.EnumColumnFieldType.TOKENS:
|
|
4432
|
+
return _this.getTokens(attributeValue);
|
|
4433
|
+
default:
|
|
4434
|
+
return attributeValue;
|
|
4405
4435
|
}
|
|
4406
4436
|
});
|
|
4407
4437
|
var unifiedColumnValues = columnValue.join(separator);
|
|
4408
4438
|
var uninformedNumber = unifiedColumnValues
|
|
4409
4439
|
.split(separator)
|
|
4410
4440
|
.filter(function (value) { return value === uninformed; }).length;
|
|
4411
|
-
var formattedColumnValue;
|
|
4412
|
-
if (uninformedNumber === column.attributes.length) {
|
|
4413
|
-
formattedColumnValue = uninformed;
|
|
4414
|
-
}
|
|
4415
|
-
else if (column.type === exports.EnumColumnFieldType.TOKENS) {
|
|
4416
|
-
formattedColumnValue = [].concat.apply([], columnValue.filter(function (values) { return values !== uninformed; }));
|
|
4417
|
-
}
|
|
4418
|
-
else {
|
|
4419
|
-
formattedColumnValue = unifiedColumnValues;
|
|
4420
|
-
}
|
|
4441
|
+
var formattedColumnValue = this.getFormattedColumnValue(column, columnValue, unifiedColumnValues, uninformed, uninformedNumber);
|
|
4421
4442
|
return {
|
|
4422
4443
|
style: style,
|
|
4423
4444
|
columnValue: formattedColumnValue,
|
|
@@ -4452,18 +4473,21 @@
|
|
|
4452
4473
|
}
|
|
4453
4474
|
return tooltip;
|
|
4454
4475
|
}
|
|
4476
|
+
return "";
|
|
4455
4477
|
};
|
|
4456
4478
|
TableColumnsComponent.prototype.isNumber = function (value) {
|
|
4457
4479
|
return !(new BigNumber__default(value).isNaN());
|
|
4458
4480
|
};
|
|
4459
4481
|
TableColumnsComponent.prototype.getTokens = function (values) {
|
|
4460
|
-
if (!this.isArray(values))
|
|
4482
|
+
if (!this.isArray(values)) {
|
|
4461
4483
|
throw new Error("To use tokens an array must be informed");
|
|
4462
|
-
|
|
4463
|
-
if (!this.isValidTokenArray(values))
|
|
4464
|
-
throw new Error("Not a valid token array.
|
|
4465
|
-
|
|
4484
|
+
}
|
|
4485
|
+
if (!this.isValidTokenArray(values)) {
|
|
4486
|
+
throw new Error("Not a valid token array. Must be a primitive values array or an objects with label attribute array");
|
|
4487
|
+
}
|
|
4488
|
+
if (this.isLabelObjectArray(values)) {
|
|
4466
4489
|
return values;
|
|
4490
|
+
}
|
|
4467
4491
|
return values
|
|
4468
4492
|
.filter(function (value) { return value !== undefined && value !== null; })
|
|
4469
4493
|
.map(function (value) {
|
|
@@ -4498,6 +4522,7 @@
|
|
|
4498
4522
|
};
|
|
4499
4523
|
});
|
|
4500
4524
|
}
|
|
4525
|
+
return null;
|
|
4501
4526
|
};
|
|
4502
4527
|
TableColumnsComponent.ctorParameters = function () { return [
|
|
4503
4528
|
{ type: core.ViewContainerRef },
|
|
@@ -7630,7 +7655,7 @@
|
|
|
7630
7655
|
TimelineIconItemComponent = __decorate([
|
|
7631
7656
|
core.Component({
|
|
7632
7657
|
selector: "s-timeline-icon-item",
|
|
7633
|
-
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
|
|
7658
|
+
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",
|
|
7634
7659
|
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}"]
|
|
7635
7660
|
})
|
|
7636
7661
|
], TimelineIconItemComponent);
|