@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.
@@ -2137,17 +2137,6 @@
2137
2137
  this.searchFields = this.searchFields.map(function (value) { return new FormField(__assign(__assign({}, value), { size: { sm: 12, md: 12, lg: 12, xl: 12 } })); });
2138
2138
  this.searchGridFields = (this.searchGridFields || this.searchFields).map(function (gridField) {
2139
2139
  gridField["width"] = _this.getColWidth(gridField.label);
2140
- var calendarOptions = gridField.calendarLocaleOptions;
2141
- if (calendarOptions === null || calendarOptions === void 0 ? void 0 : calendarOptions.dateFormat) {
2142
- switch (gridField.type) {
2143
- case exports.FieldType.Date:
2144
- calendarOptions.dateFormat = _this._convertToMomentDateFormat(calendarOptions.dateFormat);
2145
- break;
2146
- case exports.FieldType.Time:
2147
- calendarOptions.dateFormat = _this._convertToMomentHourFormat(calendarOptions.hourFormat, calendarOptions.dateFormat);
2148
- break;
2149
- }
2150
- }
2151
2140
  return gridField;
2152
2141
  });
2153
2142
  var formGroup = this.searchFields.reduce(function (result, field) {
@@ -2173,36 +2162,6 @@
2173
2162
  _this.onChange(newValue);
2174
2163
  });
2175
2164
  };
2176
- LookupComponent.prototype._convertToMomentHourFormat = function (hourFormat, format) {
2177
- if (format === "dd/mm/yy") { // valor padrão para o format.
2178
- return "LTS";
2179
- }
2180
- if (hourFormat === "12") {
2181
- return format
2182
- .replace(/\bH\b/, "h") // hour (12 hour time) (no leading zero)
2183
- .replace(/\bHH\b/, "hh"); // hour (12 hour time)
2184
- }
2185
- if (hourFormat === "24") {
2186
- return format
2187
- .replace(/\bh\b/, "H") // hour (24 hour time) (no leading zero)
2188
- .replace(/\bhh\b/, "HH"); // hour (24 hour time)
2189
- }
2190
- return format;
2191
- };
2192
- LookupComponent.prototype._convertToMomentDateFormat = function (format) {
2193
- // A ordem dos replaces é importante.
2194
- return format
2195
- .replace(/\bd\b/, "D") // day of month (no leading zero)
2196
- .replace(/\bdd\b/, "DD") // day of month
2197
- .replace(/\bo\b/, "DDD") // day of the year (no leading zero)
2198
- .replace(/\boo\b/, "DDDD") // day of the year
2199
- .replace(/\bM\b/, "MMM") // month name short
2200
- .replace(/\bMM\b/, "MMMM") // month name long
2201
- .replace(/\bm\b/, "M") // month of year (no leading)
2202
- .replace(/\bmm\b/, "MM") // month of year
2203
- .replace(/\by\b/, "YY") // year (two digits)
2204
- .replace(/\byy\b/, "YYYY"); // year (four digits)
2205
- };
2206
2165
  LookupComponent.prototype.ngAfterViewInit = function () {
2207
2166
  this.autocomplete.onOverlayAnimationDone = function (event) { };
2208
2167
  };
@@ -2794,7 +2753,14 @@
2794
2753
  data.forEach(function (record) {
2795
2754
  csv += "\n";
2796
2755
  columns.filter(function (column) { return column.exportable && column.field; }).forEach(function (column, i) {
2797
- var cellData = _this.resolveFieldData(record, column.field);
2756
+ var cellData;
2757
+ if (Array.isArray(column.field)) {
2758
+ var fieldValues = column.field.map(function (col) { return _this.resolveFieldData(record, col); });
2759
+ cellData = fieldValues.flat().join(column.separator);
2760
+ }
2761
+ else {
2762
+ cellData = _this.resolveFieldData(record, column.field);
2763
+ }
2798
2764
  if (cellData != null)
2799
2765
  cellData = String(cellData).replace(/"/g, "\"\"");
2800
2766
  else
@@ -4403,21 +4369,50 @@
4403
4369
  };
4404
4370
  TablePagingComponent.prototype.getColumnsToExport = function () {
4405
4371
  return __spread(this.table.columns).map(function (column) {
4406
- if (column.exportable === null || column.exportable === undefined) {
4407
- column.exportable = true;
4372
+ var _a;
4373
+ var exportColumn = {
4374
+ header: column.header,
4375
+ exportable: true,
4376
+ field: column.field,
4377
+ separator: (_a = column.separator) !== null && _a !== void 0 ? _a : " - "
4378
+ };
4379
+ if (column.exportable === false) {
4380
+ exportColumn.exportable = false;
4408
4381
  }
4409
- return column;
4382
+ if (column.attributes && column.attributes.length) {
4383
+ if (column.attributes.length === 1) {
4384
+ exportColumn.field = column.attributes[0];
4385
+ }
4386
+ else {
4387
+ exportColumn.field = column.attributes;
4388
+ }
4389
+ }
4390
+ return exportColumn;
4410
4391
  });
4411
4392
  };
4412
4393
  TablePagingComponent.prototype.getRowsToExport = function () {
4413
- return this.table.value;
4394
+ var _this = this;
4395
+ var enumColumns = this.table.columns.filter(function (p) { return p.enumPrefix; });
4396
+ if (!enumColumns.length)
4397
+ return this.table.value;
4398
+ return __spread(this.table.value).map(function (row) {
4399
+ for (var i = 0; i <= enumColumns.length - 1; i++) {
4400
+ var column = enumColumns[i];
4401
+ var fieldName = column.field;
4402
+ var columnData = row[fieldName];
4403
+ row[fieldName] = _this.translate.instant(column.enumPrefix + columnData.toString().toLowerCase());
4404
+ }
4405
+ return row;
4406
+ });
4414
4407
  };
4415
4408
  TablePagingComponent.prototype.getSelectedRowsToExport = function () {
4416
4409
  return this.table.selection;
4417
4410
  };
4418
4411
  TablePagingComponent.prototype.getExportFileName = function () {
4419
4412
  var _a;
4420
- return (_a = this.exportFileName) !== null && _a !== void 0 ? _a : "download";
4413
+ var fileName = (_a = this.exportFileName) !== null && _a !== void 0 ? _a : "download";
4414
+ var currentDate = moment_(new Date()).format("DD-MM-YYYY[_]HH:mm");
4415
+ return fileName + "_" + currentDate;
4421
4416
  };
4422
4417
  TablePagingComponent.prototype.exportCurrentPage = function () {
4423
4418
  this.validateComponent();