@seniorsistemas/angular-components 14.13.1 → 14.13.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.
@@ -1963,17 +1963,6 @@ var LookupComponent = /** @class */ (function () {
1963
1963
  this.searchFields = this.searchFields.map(function (value) { return new FormField(__assign(__assign({}, value), { size: { sm: 12, md: 12, lg: 12, xl: 12 } })); });
1964
1964
  this.searchGridFields = (this.searchGridFields || this.searchFields).map(function (gridField) {
1965
1965
  gridField["width"] = _this.getColWidth(gridField.label);
1966
- var calendarOptions = gridField.calendarLocaleOptions;
1967
- if (calendarOptions === null || calendarOptions === void 0 ? void 0 : calendarOptions.dateFormat) {
1968
- switch (gridField.type) {
1969
- case FieldType.Date:
1970
- calendarOptions.dateFormat = _this._convertToMomentDateFormat(calendarOptions.dateFormat);
1971
- break;
1972
- case FieldType.Time:
1973
- calendarOptions.dateFormat = _this._convertToMomentHourFormat(calendarOptions.hourFormat, calendarOptions.dateFormat);
1974
- break;
1975
- }
1976
- }
1977
1966
  return gridField;
1978
1967
  });
1979
1968
  var formGroup = this.searchFields.reduce(function (result, field) {
@@ -1999,36 +1988,6 @@ var LookupComponent = /** @class */ (function () {
1999
1988
  _this.onChange(newValue);
2000
1989
  });
2001
1990
  };
2002
- LookupComponent.prototype._convertToMomentHourFormat = function (hourFormat, format) {
2003
- if (format === "dd/mm/yy") { // valor padrão para o format.
2004
- return "LTS";
2005
- }
2006
- if (hourFormat === "12") {
2007
- return format
2008
- .replace(/\bH\b/, "h") // hour (12 hour time) (no leading zero)
2009
- .replace(/\bHH\b/, "hh"); // hour (12 hour time)
2010
- }
2011
- if (hourFormat === "24") {
2012
- return format
2013
- .replace(/\bh\b/, "H") // hour (24 hour time) (no leading zero)
2014
- .replace(/\bhh\b/, "HH"); // hour (24 hour time)
2015
- }
2016
- return format;
2017
- };
2018
- LookupComponent.prototype._convertToMomentDateFormat = function (format) {
2019
- // A ordem dos replaces é importante.
2020
- return format
2021
- .replace(/\bd\b/, "D") // day of month (no leading zero)
2022
- .replace(/\bdd\b/, "DD") // day of month
2023
- .replace(/\bo\b/, "DDD") // day of the year (no leading zero)
2024
- .replace(/\boo\b/, "DDDD") // day of the year
2025
- .replace(/\bM\b/, "MMM") // month name short
2026
- .replace(/\bMM\b/, "MMMM") // month name long
2027
- .replace(/\bm\b/, "M") // month of year (no leading)
2028
- .replace(/\bmm\b/, "MM") // month of year
2029
- .replace(/\by\b/, "YY") // year (two digits)
2030
- .replace(/\byy\b/, "YYYY"); // year (four digits)
2031
- };
2032
1991
  LookupComponent.prototype.ngAfterViewInit = function () {
2033
1992
  this.autocomplete.onOverlayAnimationDone = function (event) { };
2034
1993
  };
@@ -2620,7 +2579,14 @@ var ExportUtils = /** @class */ (function () {
2620
2579
  data.forEach(function (record) {
2621
2580
  csv += "\n";
2622
2581
  columns.filter(function (column) { return column.exportable && column.field; }).forEach(function (column, i) {
2623
- var cellData = _this.resolveFieldData(record, column.field);
2582
+ var cellData;
2583
+ if (Array.isArray(column.field)) {
2584
+ var fieldValues = column.field.map(function (col) { return _this.resolveFieldData(record, col); });
2585
+ cellData = fieldValues.flat().join(column.separator);
2586
+ }
2587
+ else {
2588
+ cellData = _this.resolveFieldData(record, column.field);
2589
+ }
2624
2590
  if (cellData != null)
2625
2591
  cellData = String(cellData).replace(/"/g, "\"\"");
2626
2592
  else
@@ -4229,21 +4195,50 @@ var TablePagingComponent = /** @class */ (function () {
4229
4195
  };
4230
4196
  TablePagingComponent.prototype.getColumnsToExport = function () {
4231
4197
  return __spread(this.table.columns).map(function (column) {
4232
- if (column.exportable === null || column.exportable === undefined) {
4233
- column.exportable = true;
4198
+ var _a;
4199
+ var exportColumn = {
4200
+ header: column.header,
4201
+ exportable: true,
4202
+ field: column.field,
4203
+ separator: (_a = column.separator) !== null && _a !== void 0 ? _a : " - "
4204
+ };
4205
+ if (column.exportable === false) {
4206
+ exportColumn.exportable = false;
4234
4207
  }
4235
- return column;
4208
+ if (column.attributes && column.attributes.length) {
4209
+ if (column.attributes.length === 1) {
4210
+ exportColumn.field = column.attributes[0];
4211
+ }
4212
+ else {
4213
+ exportColumn.field = column.attributes;
4214
+ }
4215
+ }
4216
+ return exportColumn;
4236
4217
  });
4237
4218
  };
4238
4219
  TablePagingComponent.prototype.getRowsToExport = function () {
4239
- return this.table.value;
4220
+ var _this = this;
4221
+ var enumColumns = this.table.columns.filter(function (p) { return p.enumPrefix; });
4222
+ if (!enumColumns.length)
4223
+ return this.table.value;
4224
+ return __spread(this.table.value).map(function (row) {
4225
+ for (var i = 0; i <= enumColumns.length - 1; i++) {
4226
+ var column = enumColumns[i];
4227
+ var fieldName = column.field;
4228
+ var columnData = row[fieldName];
4229
+ row[fieldName] = _this.translate.instant(column.enumPrefix + columnData.toString().toLowerCase());
4230
+ }
4231
+ return row;
4232
+ });
4240
4233
  };
4241
4234
  TablePagingComponent.prototype.getSelectedRowsToExport = function () {
4242
4235
  return this.table.selection;
4243
4236
  };
4244
4237
  TablePagingComponent.prototype.getExportFileName = function () {
4245
4238
  var _a;
4246
- return (_a = this.exportFileName) !== null && _a !== void 0 ? _a : "download";
4239
+ var fileName = (_a = this.exportFileName) !== null && _a !== void 0 ? _a : "download";
4240
+ var currentDate = moment_(new Date()).format("DD-MM-YYYY[_]HH:mm");
4241
+ return fileName + "_" + currentDate;
4247
4242
  };
4248
4243
  TablePagingComponent.prototype.exportCurrentPage = function () {
4249
4244
  this.validateComponent();