@seniorsistemas/angular-components 16.3.9 → 16.3.10
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 +23 -18
- 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-paging/table-paging.component.d.ts +4 -3
- package/esm2015/components/table/table-paging/table-paging.component.js +25 -17
- package/esm5/components/table/table-paging/table-paging.component.js +24 -19
- package/fesm2015/seniorsistemas-angular-components.js +24 -16
- package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
- package/fesm5/seniorsistemas-angular-components.js +23 -18
- package/fesm5/seniorsistemas-angular-components.js.map +1 -1
- package/package.json +1 -1
- package/seniorsistemas-angular-components.metadata.json +1 -1
|
@@ -4966,19 +4966,19 @@ var TablePagingComponent = /** @class */ (function () {
|
|
|
4966
4966
|
TablePagingComponent.prototype.getSelectedRowsToExport = function (columns) {
|
|
4967
4967
|
return this.mapColumnsTranslations(columns, this.table.selection);
|
|
4968
4968
|
};
|
|
4969
|
-
TablePagingComponent.prototype.
|
|
4969
|
+
TablePagingComponent.prototype.getPropertyValue = function (obj, path) {
|
|
4970
4970
|
return path.split(".").reduce(function (result, prop) { return (result[prop] === undefined ? undefined : result[prop]); }, obj);
|
|
4971
4971
|
};
|
|
4972
|
-
TablePagingComponent.prototype.
|
|
4973
|
-
this.
|
|
4972
|
+
TablePagingComponent.prototype.setPropertyValue = function (obj, path, value) {
|
|
4973
|
+
this.recursionSetValue(obj, path.split("."), value);
|
|
4974
4974
|
};
|
|
4975
|
-
TablePagingComponent.prototype.
|
|
4975
|
+
TablePagingComponent.prototype.recursionSetValue = function (obj, keysList, value) {
|
|
4976
4976
|
var key = keysList[0];
|
|
4977
4977
|
if (keysList.length === 1) {
|
|
4978
4978
|
obj[key] = value;
|
|
4979
4979
|
return obj;
|
|
4980
4980
|
}
|
|
4981
|
-
obj[key] = (this.
|
|
4981
|
+
obj[key] = (this.recursionSetValue((obj === null || obj === void 0 ? void 0 : obj[key]) || {}, keysList.slice(1), value));
|
|
4982
4982
|
return obj;
|
|
4983
4983
|
};
|
|
4984
4984
|
TablePagingComponent.prototype.mapColumnsTranslations = function (columns, rows) {
|
|
@@ -4989,37 +4989,42 @@ var TablePagingComponent = /** @class */ (function () {
|
|
|
4989
4989
|
}
|
|
4990
4990
|
return __spread(rows).map(function (row) {
|
|
4991
4991
|
var newRow = __assign({}, row);
|
|
4992
|
-
|
|
4993
|
-
var
|
|
4994
|
-
var fields = column.field;
|
|
4995
|
-
if (!Array.isArray(fields)) {
|
|
4996
|
-
fields = [fields];
|
|
4997
|
-
}
|
|
4992
|
+
enumColumns.forEach(function (column) {
|
|
4993
|
+
var fields = !Array.isArray(column.field) ? [column.field] : column.field;
|
|
4998
4994
|
fields.forEach(function (fieldName) {
|
|
4999
|
-
var columnData = _this.
|
|
4995
|
+
var columnData = _this.getPropertyValue(row, fieldName);
|
|
5000
4996
|
if (columnData === null || columnData === undefined) {
|
|
5001
4997
|
return;
|
|
5002
4998
|
}
|
|
5003
4999
|
var newValue = _this.translateValue(column, columnData);
|
|
5004
|
-
_this.
|
|
5000
|
+
_this.setPropertyValue(newRow, fieldName, newValue);
|
|
5005
5001
|
});
|
|
5006
|
-
};
|
|
5007
|
-
for (var i = 0; i <= enumColumns.length - 1; i++) {
|
|
5008
|
-
_loop_1(i);
|
|
5009
|
-
}
|
|
5002
|
+
});
|
|
5010
5003
|
return newRow;
|
|
5011
5004
|
});
|
|
5012
5005
|
};
|
|
5013
5006
|
TablePagingComponent.prototype.translateValue = function (column, columnData) {
|
|
5007
|
+
// Default usage: ENUM_VALUE -> domain.service.enum_value
|
|
5014
5008
|
var enumValue = columnData.toString().toLowerCase();
|
|
5015
5009
|
var translationKey = column.enumPrefix + enumValue;
|
|
5016
5010
|
var translatedValue = this.translate.instant(translationKey);
|
|
5011
|
+
// Custom usage 1: V9 -> domain.service.v_9
|
|
5017
5012
|
if (translationKey === translatedValue && enumValue.length > 1) {
|
|
5018
5013
|
translationKey = "" + column.enumPrefix + enumValue.substring(0, 1) + "_" + enumValue.substr(1);
|
|
5019
|
-
|
|
5014
|
+
translatedValue = this.translate.instant(translationKey);
|
|
5015
|
+
}
|
|
5016
|
+
// Custom usage 2: EnumValue -> domain.service.enum_value
|
|
5017
|
+
if (translationKey === translatedValue) {
|
|
5018
|
+
var enumKey = this.convertToSnakeCase(columnData.toString());
|
|
5019
|
+
translationKey = "" + column.enumPrefix + enumKey;
|
|
5020
|
+
translatedValue = this.translate.instant(translationKey);
|
|
5020
5021
|
}
|
|
5021
5022
|
return translatedValue;
|
|
5022
5023
|
};
|
|
5024
|
+
TablePagingComponent.prototype.convertToSnakeCase = function (str) {
|
|
5025
|
+
return str.replace(/([A-Z])/g, function (match, group) { return "_" + group.toLowerCase(); })
|
|
5026
|
+
.replace(/^_/, '');
|
|
5027
|
+
};
|
|
5023
5028
|
TablePagingComponent.prototype.getExportFileName = function () {
|
|
5024
5029
|
var _a;
|
|
5025
5030
|
var fileName = (_a = this.exportFileName) !== null && _a !== void 0 ? _a : "download";
|