tnx-shared 5.3.289 → 5.3.290

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.
@@ -27810,36 +27810,33 @@
27810
27810
  ListBase.prototype._exportAllData = function (event) {
27811
27811
  var _a;
27812
27812
  return __awaiter(this, void 0, void 0, function () {
27813
- var lstData, lstVisibleField, lstHeader, printData;
27814
- var _this = this;
27813
+ var lstData, lstVisibleField, lstHeader, fieldSchemaMap, printData;
27815
27814
  return __generator(this, function (_b) {
27816
27815
  switch (_b.label) {
27817
27816
  case 0: return [4 /*yield*/, this.setting.baseService.getDataCustomRoute(this.plusUrl, this.currentGridInfo.filters, this.currentGridInfo.fields, this.currentGridInfo.sorts, -1, 1)];
27818
27817
  case 1:
27819
27818
  lstData = (_a = (_b.sent()).data) !== null && _a !== void 0 ? _a : [];
27820
- return [4 /*yield*/, this.beforeExportAllData(lstData)];
27819
+ lstVisibleField = this.setting.cols
27820
+ .filter(function (item) { return item.visible && item.dataType !== 'trangThaiV5'; })
27821
+ .map(function (item) { return item.field; });
27822
+ return [4 /*yield*/, this.beforeExportAllData(lstData, lstVisibleField)];
27821
27823
  case 2:
27822
27824
  _b.sent();
27823
27825
  return [4 /*yield*/, this._crudService.getRefDataInDatasource(lstData, this.setting.fieldNeedGetRef)];
27824
27826
  case 3:
27825
27827
  _b.sent();
27826
- lstVisibleField = this.setting.cols.filter(function (item) { return item.visible && item.dataType != 'trangThaiV5'; }).map(function (item) {
27827
- if (item.controlType == 'dropdown' && item.field.startsWith('str')) {
27828
- return item.field.slice(3);
27829
- }
27830
- return item.field;
27831
- });
27832
27828
  lstHeader = ['TT'];
27833
- lstVisibleField.forEach(function (item) {
27834
- var schema = _this.setting.modelSchemas.find(function (x) { return x.field == item; });
27835
- lstHeader.push((schema === null || schema === void 0 ? void 0 : schema.name) || "");
27829
+ fieldSchemaMap = new Map(this.setting.modelSchemas.map(function (schema) { return [schema.field, schema.name]; }));
27830
+ lstVisibleField.forEach(function (field) {
27831
+ var schemaName = fieldSchemaMap.get(field) || fieldSchemaMap.get(field.slice(3)) || "";
27832
+ lstHeader.push(schemaName);
27836
27833
  });
27837
27834
  printData = __spreadArray([
27838
27835
  lstHeader
27839
27836
  ], __read(lstData.map(function (item, index) {
27840
27837
  var row = [index + 1];
27841
- _this.setting.cols.filter(function (col) { return col.visible && col.dataType != 'trangThaiV5'; }).forEach(function (col) {
27842
- row.push(item[col.field]);
27838
+ lstVisibleField.forEach(function (field) {
27839
+ row.push(item[field]);
27843
27840
  });
27844
27841
  return row;
27845
27842
  })));
@@ -27849,7 +27846,7 @@
27849
27846
  });
27850
27847
  });
27851
27848
  };
27852
- ListBase.prototype.beforeExportAllData = function (dataSource) {
27849
+ ListBase.prototype.beforeExportAllData = function (dataSource, lstVisibleField) {
27853
27850
  return __awaiter(this, void 0, void 0, function () {
27854
27851
  return __generator(this, function (_b) {
27855
27852
  return [2 /*return*/];