@sd-angular/core 1.3.181 → 1.3.183

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.
@@ -288,7 +288,7 @@ class SdTableConfigurationService {
288
288
  SELECTION: 'sdSelection',
289
289
  GROUP: 'sdGroup',
290
290
  });
291
- _prefix.set(this, 'bd364e28-fe67-48b9-a537-1a306f7d195c');
291
+ _prefix.set(this, 'c9e94836-6ace-4aeb-b148-4f0be63589ee');
292
292
  _getSetting.set(this, (gridOption) => {
293
293
  if (!(gridOption === null || gridOption === void 0 ? void 0 : gridOption.key)) {
294
294
  return null;
@@ -1127,7 +1127,7 @@ class SdTable {
1127
1127
  for (const item of exportItems) {
1128
1128
  const obj = {};
1129
1129
  const handle = (exportColumn) => __awaiter(this, void 0, void 0, function* () {
1130
- var _v, _w, _x, _y;
1130
+ var _v, _w, _x, _y, _z;
1131
1131
  obj[exportColumn.field] = item[exportColumn.field];
1132
1132
  const column = allColumns.find(e => e.field === exportColumn.field);
1133
1133
  const exportedColumn = allExportedColumns.find(e => e.field === exportColumn.field);
@@ -1188,9 +1188,10 @@ class SdTable {
1188
1188
  // Nếu là time thì convert theo đúng format
1189
1189
  obj[column.field] = Date.toFormat(date, 'HH:mm');
1190
1190
  }
1191
- else if (column.type === 'values') {
1191
+ else if (column.type === 'values' || column.type === 'lazy-values') {
1192
1192
  // Nếu là values thì lấy giá trị của value được chọn
1193
- obj[column.field] = ((_y = __classPrivateFieldGet(this, _cacheObjValues)[column.field]) === null || _y === void 0 ? void 0 : _y[item[column.field]]) || item[column.field];
1193
+ obj[column.field] =
1194
+ ((_z = (_y = __classPrivateFieldGet(this, _cacheObjValues)[column.field]) === null || _y === void 0 ? void 0 : _y[item[column.field]]) === null || _z === void 0 ? void 0 : _z[column.option.displayField]) || item[column.field];
1194
1195
  }
1195
1196
  else {
1196
1197
  obj[column.field] = item[column.field];
@@ -1259,11 +1260,39 @@ class SdTable {
1259
1260
  }));
1260
1261
  _getExportColumns.set(this, () => {
1261
1262
  var _a, _b;
1262
- const columns = [
1263
- ...this.tableOption.columns.filter(e => { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); }),
1264
- ...(((_b = (_a = this.tableOption.export) === null || _a === void 0 ? void 0 : _a.columns) === null || _b === void 0 ? void 0 : _b.filter(e => { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); })) || []),
1265
- ];
1266
- return columns;
1263
+ let gridColumns = [];
1264
+ this.tableOption.columns
1265
+ .filter(e => { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); })
1266
+ .forEach(column => {
1267
+ var _a;
1268
+ if (column.type === 'children') {
1269
+ (_a = column.children) === null || _a === void 0 ? void 0 : _a.filter(e => { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); }).forEach(childColumn => {
1270
+ gridColumns.push(childColumn);
1271
+ });
1272
+ return;
1273
+ }
1274
+ gridColumns.push(column);
1275
+ });
1276
+ if (this.configuration) {
1277
+ const columns = [...gridColumns];
1278
+ const { firstColumns, secondColumns } = this.configuration;
1279
+ const displayColumns = [...firstColumns, ...secondColumns].reduce((first, next) => {
1280
+ const column = this.tableOption.columns.find(e => e.field === next.field);
1281
+ if (!column) {
1282
+ return first;
1283
+ }
1284
+ if (column.type !== 'children') {
1285
+ return [...first, column];
1286
+ }
1287
+ const children = column.children;
1288
+ return [...first, ...children];
1289
+ }, []);
1290
+ gridColumns = displayColumns
1291
+ .map(e => (Object.assign(Object.assign({}, e), { data: columns.find(e1 => e1.field === e.field) })))
1292
+ .filter(e => !!e.data)
1293
+ .map(e => e.data);
1294
+ }
1295
+ return [...gridColumns, ...(((_b = (_a = this.tableOption.export) === null || _a === void 0 ? void 0 : _a.columns) === null || _b === void 0 ? void 0 : _b.filter(e => { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); })) || [])];
1267
1296
  });
1268
1297
  this.exportExcel = () => {
1269
1298
  __classPrivateFieldGet(this, _onExport).call(this);
@@ -1280,8 +1309,8 @@ class SdTable {
1280
1309
  });
1281
1310
  };
1282
1311
  this.onExpand = (rowData) => __awaiter(this, void 0, void 0, function* () {
1283
- var _z, _0, _1, _2, _3;
1284
- if ((_z = this.tableOption.expand) === null || _z === void 0 ? void 0 : _z.always) {
1312
+ var _0, _1, _2, _3, _4;
1313
+ if ((_0 = this.tableOption.expand) === null || _0 === void 0 ? void 0 : _0.always) {
1285
1314
  return;
1286
1315
  }
1287
1316
  if (rowData.meta.expand.isExpanding) {
@@ -1291,8 +1320,8 @@ class SdTable {
1291
1320
  rowData.meta.expand.isExpanded = false;
1292
1321
  return;
1293
1322
  }
1294
- const data = (_2 = (_1 = (_0 = this.tableOption) === null || _0 === void 0 ? void 0 : _0.expand) === null || _1 === void 0 ? void 0 : _1.onExpand) === null || _2 === void 0 ? void 0 : _2.call(_1, rowData.data);
1295
- if (!((_3 = this.tableOption.expand) === null || _3 === void 0 ? void 0 : _3.multiple)) {
1323
+ const data = (_3 = (_2 = (_1 = this.tableOption) === null || _1 === void 0 ? void 0 : _1.expand) === null || _2 === void 0 ? void 0 : _2.onExpand) === null || _3 === void 0 ? void 0 : _3.call(_2, rowData.data);
1324
+ if (!((_4 = this.tableOption.expand) === null || _4 === void 0 ? void 0 : _4.multiple)) {
1296
1325
  this.items.forEach(item => (item.meta.expand.isExpanding = item.meta.expand.isExpanded = false));
1297
1326
  }
1298
1327
  if (data instanceof Promise) {
@@ -1408,7 +1437,7 @@ class SdTable {
1408
1437
  }
1409
1438
  }));
1410
1439
  _format.set(this, (rawItems, columns) => __awaiter(this, void 0, void 0, function* () {
1411
- var _4, _5, _6, _7, _8;
1440
+ var _5, _6, _7, _8, _9;
1412
1441
  const items = rawItems.map(MapToSdTableItem);
1413
1442
  for (const column of columns) {
1414
1443
  // Clickable
@@ -1487,10 +1516,10 @@ class SdTable {
1487
1516
  }
1488
1517
  if (column.type === 'values' || column.type === 'lazy-values') {
1489
1518
  if (column.type === 'lazy-values' && typeof column.option.mapValue === 'function') {
1490
- display.data = ((_5 = (_4 = __classPrivateFieldGet(this, _cacheObjValues)[field]) === null || _4 === void 0 ? void 0 : _4[column.option.mapValue(value, rowData)]) === null || _5 === void 0 ? void 0 : _5[column.option.displayField]) || value;
1519
+ display.data = ((_6 = (_5 = __classPrivateFieldGet(this, _cacheObjValues)[field]) === null || _5 === void 0 ? void 0 : _5[column.option.mapValue(value, rowData)]) === null || _6 === void 0 ? void 0 : _6[column.option.displayField]) || value;
1491
1520
  }
1492
1521
  else {
1493
- display.data = ((_7 = (_6 = __classPrivateFieldGet(this, _cacheObjValues)[field]) === null || _6 === void 0 ? void 0 : _6[value]) === null || _7 === void 0 ? void 0 : _7[column.option.displayField]) || value;
1522
+ display.data = ((_8 = (_7 = __classPrivateFieldGet(this, _cacheObjValues)[field]) === null || _7 === void 0 ? void 0 : _7[value]) === null || _8 === void 0 ? void 0 : _8[column.option.displayField]) || value;
1494
1523
  }
1495
1524
  }
1496
1525
  if (column.type === 'number' && Number.isNumber(value)) {
@@ -1510,7 +1539,7 @@ class SdTable {
1510
1539
  display.badge = {
1511
1540
  type: !(column === null || column === void 0 ? void 0 : column.badgeType) ? 'icon' : column.badgeType,
1512
1541
  color: column.badge(value, rowData),
1513
- icon: (_8 = column.badgeIcon) === null || _8 === void 0 ? void 0 : _8.call(column, value, rowData),
1542
+ icon: (_9 = column.badgeIcon) === null || _9 === void 0 ? void 0 : _9.call(column, value, rowData),
1514
1543
  };
1515
1544
  }
1516
1545
  else if (column.type === 'bool') {