@seniorsistemas/angular-components 17.17.6 → 17.17.8

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.
@@ -9530,10 +9530,10 @@
9530
9530
  var TableFrozenPositionDirective = /** @class */ (function () {
9531
9531
  function TableFrozenPositionDirective(el, host) {
9532
9532
  this.el = el;
9533
- this.host = host;
9534
9533
  this.sTableFrozenPosition = "left";
9535
9534
  this.isTableVisible = false;
9536
9535
  this.onColumnsChanged = new core.EventEmitter();
9536
+ this.TABLE_SCROLLABLE_WRAPPER_CLASS = ".ui-table-scrollable-wrapper";
9537
9537
  this.table = host;
9538
9538
  this.table.styleClass = (this.table.styleClass || "") + " s-table-frozen-position";
9539
9539
  this.setUpTableEvents();
@@ -9577,6 +9577,9 @@
9577
9577
  if (this.rowExpandedObserver) {
9578
9578
  this.rowExpandedObserver.disconnect();
9579
9579
  }
9580
+ if (this.tableWrapperObserver) {
9581
+ this.tableWrapperObserver.disconnect();
9582
+ }
9580
9583
  };
9581
9584
  TableFrozenPositionDirective.prototype.setUpTableEvents = function () {
9582
9585
  var _this = this;
@@ -9621,6 +9624,17 @@
9621
9624
  childList: true
9622
9625
  });
9623
9626
  });
9627
+ var tableWraper = this.el.nativeElement.querySelector(this.TABLE_SCROLLABLE_WRAPPER_CLASS);
9628
+ if (tableWraper) {
9629
+ var mutationObserver = new MutationObserver(function () {
9630
+ _this.synchronizeRowHeight();
9631
+ });
9632
+ mutationObserver.observe(tableWraper, {
9633
+ subtree: true,
9634
+ childList: true
9635
+ });
9636
+ this.tableWrapperObserver = mutationObserver;
9637
+ }
9624
9638
  };
9625
9639
  TableFrozenPositionDirective.prototype.applyHeightForExpandedRows = function () {
9626
9640
  var frozenTDsToAdjust = this.el.nativeElement.querySelectorAll(".ui-table-frozen-view .sds-expanded-row > td");
@@ -9636,7 +9650,7 @@
9636
9650
  });
9637
9651
  };
9638
9652
  TableFrozenPositionDirective.prototype.applyStylesForTable = function () {
9639
- var scrollWrapper = this.el.nativeElement.querySelector(".ui-table-scrollable-wrapper");
9653
+ var scrollWrapper = this.el.nativeElement.querySelector(this.TABLE_SCROLLABLE_WRAPPER_CLASS);
9640
9654
  if (!scrollWrapper) {
9641
9655
  console.warn("Unable to find scroll-wrapper element from table. Is the table configured with frozen template?");
9642
9656
  return;
@@ -9920,7 +9934,11 @@
9920
9934
  return ((_a = attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.options) === null || _a === void 0 ? void 0 : _a.numberFormatOptions) ? _this.numericService.instant(attributeValue.value, {
9921
9935
  numberFormatOptions: attributeValue.options.numberFormatOptions,
9922
9936
  })
9923
- : ng2CurrencyMask.applyMask(attributeValue, numberConfigs, _this.isNumber(attributeValue));
9937
+ : column.numberFormatOptions
9938
+ ? _this.numericService.instant(attributeValue, {
9939
+ numberFormatOptions: column.numberFormatOptions,
9940
+ })
9941
+ : ng2CurrencyMask.applyMask(attributeValue, numberConfigs, _this.isNumber(attributeValue));
9924
9942
  case exports.EnumColumnFieldType.DATE:
9925
9943
  var dateFormat = _this.getDateFormat(column, locale);
9926
9944
  return moment$4(attributeValue).format(dateFormat);
@@ -10120,7 +10138,7 @@
10120
10138
  var _a;
10121
10139
  if ((_a = changes.totalRecords) === null || _a === void 0 ? void 0 : _a.currentValue) {
10122
10140
  this.totalRecordsText = this.translate.instant(this.getTranslatePrefix() + "total_records", {
10123
- value: changes.totalRecords.currentValue
10141
+ value: changes.totalRecords.currentValue,
10124
10142
  });
10125
10143
  }
10126
10144
  };
@@ -10137,28 +10155,28 @@
10137
10155
  {
10138
10156
  id: "exportCurrentPage",
10139
10157
  label: this.translate.instant(this.getTranslatePrefix() + "export_current_page"),
10140
- command: function () { return _this.exportCurrentPage(); }
10141
- }
10158
+ command: function () { return _this.exportCurrentPage(); },
10159
+ },
10142
10160
  ];
10143
10161
  if (this.enableExportSelectedRecords) {
10144
10162
  actions.push({
10145
10163
  id: "exportSelected",
10146
10164
  label: this.translate.instant(this.getTranslatePrefix() + "export_selected_records"),
10147
- command: function () { return _this.exportSelectedRecords(); }
10165
+ command: function () { return _this.exportSelectedRecords(); },
10148
10166
  });
10149
10167
  }
10150
10168
  if (this.loadAllRecords) {
10151
10169
  actions.push({
10152
10170
  id: "exportAll",
10153
10171
  label: this.translate.instant(this.getTranslatePrefix() + "export_all_records"),
10154
- command: function () { return _this.exportAllRecords(); }
10172
+ command: function () { return _this.exportAllRecords(); },
10155
10173
  });
10156
10174
  }
10157
10175
  if ((_a = this.customActions) === null || _a === void 0 ? void 0 : _a.length) {
10158
10176
  var customMenus = this.customActions.map(function (p, index) { return ({
10159
10177
  id: "customAction_" + index,
10160
10178
  label: p.label,
10161
- command: p.command
10179
+ command: p.command,
10162
10180
  }); });
10163
10181
  actions.push.apply(actions, __spread(customMenus));
10164
10182
  }
@@ -10178,7 +10196,7 @@
10178
10196
  field: column.field,
10179
10197
  separator: (_a = column.separator) !== null && _a !== void 0 ? _a : " - ",
10180
10198
  enumPrefix: column.enumPrefix,
10181
- customExport: column.customExport
10199
+ customExport: column.customExport,
10182
10200
  };
10183
10201
  if (column.exportable === false) {
10184
10202
  exportColumn.exportable = false;
@@ -10200,6 +10218,7 @@
10200
10218
  tableData = this.loadCurrentPageRecords();
10201
10219
  }
10202
10220
  tableData = this.mapCustomExport(columns, tableData);
10221
+ tableData = this.mapNumberFormatOptionsExport(columns, tableData);
10203
10222
  return this.mapColumnsTranslations(columns, tableData);
10204
10223
  };
10205
10224
  TablePagingComponent.prototype.getSelectedRowsToExport = function (columns) {
@@ -10208,6 +10227,7 @@
10208
10227
  tableData = this.loadSelectedRecords();
10209
10228
  }
10210
10229
  tableData = this.mapCustomExport(columns, tableData);
10230
+ tableData = this.mapNumberFormatOptionsExport(columns, tableData);
10211
10231
  return this.mapColumnsTranslations(columns, tableData);
10212
10232
  };
10213
10233
  TablePagingComponent.prototype.getPropertyValue = function (obj, path) {
@@ -10222,7 +10242,7 @@
10222
10242
  obj[key] = value;
10223
10243
  return obj;
10224
10244
  }
10225
- obj[key] = (this.recursionSetValue((obj === null || obj === void 0 ? void 0 : obj[key]) || {}, keysList.slice(1), value));
10245
+ obj[key] = this.recursionSetValue((obj === null || obj === void 0 ? void 0 : obj[key]) || {}, keysList.slice(1), value);
10226
10246
  return obj;
10227
10247
  };
10228
10248
  TablePagingComponent.prototype.mapColumnsTranslations = function (columns, rows) {
@@ -10247,6 +10267,88 @@
10247
10267
  return newRow;
10248
10268
  });
10249
10269
  };
10270
+ /**
10271
+ * The purpose of this method is to map values
10272
+ * from the TableColumnsComponent, which uses the numberFormatOptions
10273
+ * field, along with rows that have a custom numberFormatOptions,
10274
+ * to ensure the correct values are exported by the TablePagingComponent.
10275
+ *
10276
+ * @returns Returns the correctly mapped tableData.
10277
+ */
10278
+ TablePagingComponent.prototype.mapNumberFormatOptionsExport = function (columns, tableData) {
10279
+ var hasNumberFormatOptionsColumns = columns.some(function (column) { return column.numberFormatOptions; });
10280
+ var hasNumberFormatOptionsRows = tableData.some(function (rowData) {
10281
+ return Object.keys(rowData).some(function (key) { var _a; return (_a = rowData[key].options) === null || _a === void 0 ? void 0 : _a.numberFormatOptions; });
10282
+ });
10283
+ if (!hasNumberFormatOptionsColumns && !hasNumberFormatOptionsRows)
10284
+ return tableData;
10285
+ var mappedTableData = __spread(tableData);
10286
+ if (hasNumberFormatOptionsColumns) {
10287
+ mappedTableData = mappedTableData.map(function (rowData) {
10288
+ var e_1, _a, e_2, _b;
10289
+ var _c;
10290
+ var row = __assign({}, rowData);
10291
+ var columnsWithNumberFormatOptions = columns.filter(function (column) { return column.numberFormatOptions; });
10292
+ try {
10293
+ for (var columnsWithNumberFormatOptions_1 = __values(columnsWithNumberFormatOptions), columnsWithNumberFormatOptions_1_1 = columnsWithNumberFormatOptions_1.next(); !columnsWithNumberFormatOptions_1_1.done; columnsWithNumberFormatOptions_1_1 = columnsWithNumberFormatOptions_1.next()) {
10294
+ var _d = columnsWithNumberFormatOptions_1_1.value, attributes = _d.attributes, numberFormatOptions = _d.numberFormatOptions;
10295
+ try {
10296
+ for (var attributes_1 = (e_2 = void 0, __values(attributes)), attributes_1_1 = attributes_1.next(); !attributes_1_1.done; attributes_1_1 = attributes_1.next()) {
10297
+ var attribute = attributes_1_1.value;
10298
+ if ((_c = row[attribute].options) === null || _c === void 0 ? void 0 : _c.numberFormatOptions)
10299
+ continue;
10300
+ var value = row[attribute];
10301
+ var mappedValue = numberFormatOptions.style === "percent" ? new BigNumber__default(value).times(100) : new BigNumber__default(value);
10302
+ var numberFormat = new Intl.NumberFormat("en-US", __assign(__assign({}, numberFormatOptions), { style: "decimal", useGrouping: false }));
10303
+ row[attribute] = numberFormat.format(mappedValue.toNumber());
10304
+ }
10305
+ }
10306
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
10307
+ finally {
10308
+ try {
10309
+ if (attributes_1_1 && !attributes_1_1.done && (_b = attributes_1.return)) _b.call(attributes_1);
10310
+ }
10311
+ finally { if (e_2) throw e_2.error; }
10312
+ }
10313
+ }
10314
+ }
10315
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
10316
+ finally {
10317
+ try {
10318
+ if (columnsWithNumberFormatOptions_1_1 && !columnsWithNumberFormatOptions_1_1.done && (_a = columnsWithNumberFormatOptions_1.return)) _a.call(columnsWithNumberFormatOptions_1);
10319
+ }
10320
+ finally { if (e_1) throw e_1.error; }
10321
+ }
10322
+ return row;
10323
+ });
10324
+ }
10325
+ if (hasNumberFormatOptionsRows) {
10326
+ mappedTableData = tableData.map(function (rowData) {
10327
+ var e_3, _a;
10328
+ var row = __assign({}, rowData);
10329
+ var keysWithNumberFormatOptions = Object.keys(row).filter(function (key) { var _a; return (_a = row[key].options) === null || _a === void 0 ? void 0 : _a.numberFormatOptions; });
10330
+ try {
10331
+ for (var keysWithNumberFormatOptions_1 = __values(keysWithNumberFormatOptions), keysWithNumberFormatOptions_1_1 = keysWithNumberFormatOptions_1.next(); !keysWithNumberFormatOptions_1_1.done; keysWithNumberFormatOptions_1_1 = keysWithNumberFormatOptions_1.next()) {
10332
+ var key = keysWithNumberFormatOptions_1_1.value;
10333
+ var value = rowData[key].value;
10334
+ var numberFormatOptions = rowData[key].options.numberFormatOptions;
10335
+ var mappedValue = numberFormatOptions.style === "percent" ? new BigNumber__default(value).times(100) : new BigNumber__default(value);
10336
+ var numberFormat = new Intl.NumberFormat("en-US", __assign(__assign({}, numberFormatOptions), { style: "decimal", useGrouping: false }));
10337
+ row[key] = numberFormat.format(mappedValue.toNumber());
10338
+ }
10339
+ }
10340
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
10341
+ finally {
10342
+ try {
10343
+ if (keysWithNumberFormatOptions_1_1 && !keysWithNumberFormatOptions_1_1.done && (_a = keysWithNumberFormatOptions_1.return)) _a.call(keysWithNumberFormatOptions_1);
10344
+ }
10345
+ finally { if (e_3) throw e_3.error; }
10346
+ }
10347
+ return row;
10348
+ });
10349
+ }
10350
+ return mappedTableData;
10351
+ };
10250
10352
  TablePagingComponent.prototype.mapCustomExport = function (columns, rows) {
10251
10353
  var _this = this;
10252
10354
  var customColumns = columns.filter(function (p) { return p.customExport; });
@@ -10288,8 +10390,7 @@
10288
10390
  return translatedValue;
10289
10391
  };
10290
10392
  TablePagingComponent.prototype.convertToSnakeCase = function (str) {
10291
- return str.replace(/([A-Z])/g, function (match, group) { return "_" + group.toLowerCase(); })
10292
- .replace(/^_/, '');
10393
+ return str.replace(/([A-Z])/g, function (match, group) { return "_" + group.toLowerCase(); }).replace(/^_/, "");
10293
10394
  };
10294
10395
  TablePagingComponent.prototype.getExportFileName = function () {
10295
10396
  var _a, _b;
@@ -10324,6 +10425,7 @@
10324
10425
  serverData = _a.sent();
10325
10426
  columns = this.getColumnsToExport();
10326
10427
  serverData = this.mapCustomExport(columns, serverData);
10428
+ serverData = this.mapNumberFormatOptionsExport(columns, serverData);
10327
10429
  dataToExport = this.mapColumnsTranslations(columns, serverData);
10328
10430
  ExportUtils.exportCSV(columns, dataToExport, undefined, this.getExportFileName());
10329
10431
  return [2 /*return*/];
@@ -17945,6 +18047,7 @@
17945
18047
  style: "decimal",
17946
18048
  minimumFractionDigits: 0,
17947
18049
  maximumFractionDigits: 2,
18050
+ roundingMode: "trunc",
17948
18051
  };
17949
18052
  this.showValue = true;
17950
18053
  this.mode = ProgressBarMode.Determinate;