ywana-core8 0.0.211 → 0.0.215

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.
@@ -1331,9 +1331,10 @@ var DataTable = function DataTable(props) {
1331
1331
  var id = _ref.id,
1332
1332
  label = _ref.label,
1333
1333
  type = _ref.type,
1334
+ item = _ref.item,
1334
1335
  sortable = _ref.sortable;
1335
1336
 
1336
- var _ref2 = type === TYPES.ENTITY ? [1, 3] : [2, 1],
1337
+ var _ref2 = type === TYPES.ENTITY ? [1, Object.keys(item).length] : [2, 1],
1337
1338
  rowspan = _ref2[0],
1338
1339
  colspan = _ref2[1];
1339
1340
 
@@ -1356,10 +1357,11 @@ var DataTable = function DataTable(props) {
1356
1357
  var type = _ref3.type;
1357
1358
  return type === TYPES.ENTITY;
1358
1359
  }).map(function (column) {
1359
- var _column$item = column.item,
1360
- item = _column$item === void 0 ? [] : _column$item;
1361
- console.log("subheader", column, item);
1362
- return item.map(function (field) {
1360
+ var item = column.item;
1361
+ var fields = item ? Object.values(item) : [];
1362
+ return fields.filter(function (field) {
1363
+ return field.column === true;
1364
+ }).map(function (field) {
1363
1365
  return /*#__PURE__*/React.createElement("th", null, field.label);
1364
1366
  });
1365
1367
  }))), /*#__PURE__*/React.createElement("tbody", null, multiSort(rows, sortDir).map(function (row) {
@@ -1555,36 +1557,39 @@ var DataTableCell = function DataTableCell(_ref4) {
1555
1557
  options: options
1556
1558
  });
1557
1559
 
1558
- case TYPES.ENTITY:
1559
- return /*#__PURE__*/React.createElement(EntityCellViewer, {
1560
- id: id,
1561
- value: cell
1562
- });
1563
-
1564
1560
  default:
1565
1561
  return cell;
1566
1562
  }
1567
1563
  }
1568
1564
  };
1569
1565
 
1570
- return /*#__PURE__*/React.createElement("td", {
1566
+ return column.type === TYPES.ENTITY ? /*#__PURE__*/React.createElement(EntityCellViewer, {
1567
+ id: id,
1568
+ item: item,
1569
+ value: cell
1570
+ }) : /*#__PURE__*/React.createElement("td", {
1571
1571
  key: column.id,
1572
1572
  className: column.id
1573
1573
  }, render(column.type));
1574
1574
  };
1575
+ /**
1576
+ * Entity Cell Viewer
1577
+ * @param {*} param0
1578
+ * @returns
1579
+ */
1580
+
1575
1581
 
1576
1582
  var EntityCellViewer = function EntityCellViewer(_ref5) {
1577
1583
  var id = _ref5.id,
1584
+ item = _ref5.item,
1578
1585
  value = _ref5.value;
1579
- console.log(id, value);
1580
- var subcells = value ? Object.values(value) : [1, 2, 3];
1581
- return /*#__PURE__*/React.createElement("div", {
1582
- className: "entity-cell-viewer"
1583
- }, subcells.filter(function (v) {
1584
- return !v;
1585
- }).map(function (v) {
1586
- return /*#__PURE__*/React.createElement("div", null, v);
1587
- }));
1586
+ console.log(id, item, value);
1587
+ var fields = Object.values(item).filter(function (field) {
1588
+ return field.column === true;
1589
+ });
1590
+ return fields.map(function (field) {
1591
+ return /*#__PURE__*/React.createElement("td", null, value[field.id]);
1592
+ });
1588
1593
  };
1589
1594
  /**
1590
1595
  * Boolean Cell Viewer