@sd-angular/core 1.3.169 → 1.3.170

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.
@@ -1408,19 +1408,25 @@ class SdTable {
1408
1408
  }
1409
1409
  }));
1410
1410
  _format.set(this, (rawItems, columns) => __awaiter(this, void 0, void 0, function* () {
1411
- var _4, _5, _6;
1411
+ var _4, _5, _6, _7, _8;
1412
1412
  const items = rawItems.map(MapToSdTableItem);
1413
1413
  for (const column of columns) {
1414
1414
  // Clickable
1415
1415
  const { field, cellStyle, click, tooltip, htmlTemplate, transform } = column;
1416
- if (column.type === 'lazy-values') {
1416
+ if (!transform && !htmlTemplate && column.type === 'lazy-values' && typeof column.option.views === 'function') {
1417
+ const { option: { views, mapValue }, } = column;
1417
1418
  __classPrivateFieldGet(this, _cacheObjValues)[field] = __classPrivateFieldGet(this, _cacheObjValues)[field] || {};
1418
1419
  const values = items
1419
- .map(item => { var _a; return (_a = item.data) === null || _a === void 0 ? void 0 : _a[field]; })
1420
+ .map(item => {
1421
+ var _a, _b;
1422
+ if (typeof mapValue === 'function') {
1423
+ return mapValue((_a = item.data) === null || _a === void 0 ? void 0 : _a[field], item.data);
1424
+ }
1425
+ return (_b = item.data) === null || _b === void 0 ? void 0 : _b[field];
1426
+ })
1420
1427
  .filter(val => (!!val || val === 0) && !Object.keys(__classPrivateFieldGet(this, _cacheObjValues)[field]).includes(val))
1421
1428
  .union();
1422
- const { option: { views }, } = column;
1423
- if (views && values.length) {
1429
+ if (values.length) {
1424
1430
  const lazyItems = (yield views(values).catch(err => {
1425
1431
  console.error(err);
1426
1432
  return [];
@@ -1480,7 +1486,12 @@ class SdTable {
1480
1486
  }
1481
1487
  }
1482
1488
  if (column.type === 'values' || column.type === 'lazy-values') {
1483
- display.data = ((_5 = (_4 = __classPrivateFieldGet(this, _cacheObjValues)[field]) === null || _4 === void 0 ? void 0 : _4[value]) === null || _5 === void 0 ? void 0 : _5[column.option.displayField]) || value;
1489
+ 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;
1491
+ }
1492
+ 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;
1494
+ }
1484
1495
  }
1485
1496
  if (column.type === 'number' && Number.isNumber(value)) {
1486
1497
  display.data = Number.toVNCurrency(value);
@@ -1499,7 +1510,7 @@ class SdTable {
1499
1510
  display.badge = {
1500
1511
  type: !(column === null || column === void 0 ? void 0 : column.badgeType) ? 'icon' : column.badgeType,
1501
1512
  color: column.badge(value, rowData),
1502
- icon: (_6 = column.badgeIcon) === null || _6 === void 0 ? void 0 : _6.call(column, value, rowData),
1513
+ icon: (_8 = column.badgeIcon) === null || _8 === void 0 ? void 0 : _8.call(column, value, rowData),
1503
1514
  };
1504
1515
  }
1505
1516
  else if (column.type === 'bool') {