aefis-core-ui 2.3.0-rc52 → 2.3.0-rc54

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.
@@ -3412,8 +3412,8 @@ const colorPalette$2 = {
3412
3412
  const termConfiguration = {
3413
3413
  palette: colorPalette$2,
3414
3414
  Icon: PersonOutlined,
3415
- primaryTextAttribute: "name",
3416
- secondaryTextAttribute: "email"
3415
+ primaryTextAttribute: "user.name",
3416
+ secondaryTextAttribute: "roleName"
3417
3417
  };
3418
3418
 
3419
3419
  const fixData = data => {
@@ -3477,9 +3477,24 @@ const BusinessObject = props => {
3477
3477
  return null;
3478
3478
  }
3479
3479
  };
3480
+ const getPropByString = (obj, propString) => {
3481
+ if (!propString) return obj;
3482
+ var prp,
3483
+ prps = propString.split(".");
3484
+ for (var i = 0, iLen = prps.length - 1; i < iLen; i++) {
3485
+ prp = prps[i];
3486
+ var candidate = obj[prp];
3487
+ if (candidate !== undefined) {
3488
+ obj = candidate;
3489
+ } else {
3490
+ break;
3491
+ }
3492
+ }
3493
+ return obj[prps[i]];
3494
+ };
3480
3495
  const data = fixData(props.data);
3481
3496
  // Adding template support to primary text. This should be extended to make it more flexible.
3482
- data.primaryText = props.template ? template.render(props.template, data) : configuration.primaryTextAttribute ? data[configuration.primaryTextAttribute] : data.name;
3497
+ data.primaryText = props.template ? template.render(props.template, data) : configuration.primaryTextAttribute ? getPropByString(data, configuration.primaryTextAttribute) : data.name;
3483
3498
  data.secondaryText = configuration.secondaryTextAttribute ? data[configuration.secondaryTextAttribute] : data.code;
3484
3499
  data.tooltipText = configuration.tooltipTextAttribute ? data[configuration.tooltipTextAttribute] : data.name;
3485
3500
  const DisplayComponent = selectComponent(props.displayType, configuration);