logitude-dashboard-library 3.1.39 → 3.1.41

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.
@@ -1004,4 +1004,10 @@ $dark-grey: #717585;
1004
1004
 
1005
1005
  .padding-left-12 {
1006
1006
  padding-left: 12px !important;
1007
+ }
1008
+
1009
+ .table-link-cell {
1010
+ color: #1E4AC4 !important;
1011
+ cursor: pointer;
1012
+ text-decoration: underline;
1007
1013
  }
package/dist/index.js CHANGED
@@ -228,6 +228,10 @@ var DashboardAnalyticsService = /*#__PURE__*/function () {
228
228
  return this._ApiServices.post("/api/" + this.controller + "/PostGetGaugeData", widget, signal);
229
229
  };
230
230
 
231
+ _proto.getObjectTableNameByWidgetEntityId = function getObjectTableNameByWidgetEntityId(entityId) {
232
+ return this._ApiServices.get("/api/analyticsfactsmetadatas/getsingle?id=" + entityId);
233
+ };
234
+
231
235
  return DashboardAnalyticsService;
232
236
  }();
233
237
 
@@ -1073,13 +1077,18 @@ var TableChart = function TableChart(props) {
1073
1077
 
1074
1078
  var isDefaultSortOptionsUsed = React.useRef(false);
1075
1079
  var widgetRefData = React.useRef(null);
1080
+
1081
+ var _useState9 = React.useState(null),
1082
+ objectTableName = _useState9[0],
1083
+ setObjectTableName = _useState9[1];
1084
+
1076
1085
  React.useEffect(function () {
1077
1086
  var _props$customChartPro;
1078
1087
 
1079
1088
  if (props.customChartProps && props.customChartProps.widget) {
1080
1089
  setWidget(props.customChartProps.widget);
1081
1090
  widgetRefData.current = props.customChartProps.widget;
1082
- getTableData(props.customChartProps.widget);
1091
+ getObjectTableName(props.customChartProps.widget);
1083
1092
  }
1084
1093
 
1085
1094
  (_props$customChartPro = props.customChartProps.dataBinding) === null || _props$customChartPro === void 0 ? void 0 : _props$customChartPro.widgetUpdated.subscribe(function (updatedWidget) {
@@ -1090,6 +1099,22 @@ var TableChart = function TableChart(props) {
1090
1099
  });
1091
1100
  }, []);
1092
1101
 
1102
+ var getObjectTableName = function getObjectTableName(widget) {
1103
+ var dashboardAnalyticsService = new DashboardAnalyticsService();
1104
+ dashboardAnalyticsService.getObjectTableNameByWidgetEntityId(widget === null || widget === void 0 ? void 0 : widget.EntityId).then(function (res) {
1105
+ if (res && res.data && res.data.ObjectTableName) {
1106
+ setObjectTableName(res.data.ObjectTableName);
1107
+ getTableData(widget);
1108
+ } else {
1109
+ setError("Erorr: No object table name match this widget entity id");
1110
+ setIsLoading(false);
1111
+ }
1112
+ })["catch"](function () {
1113
+ setError("Erorr: No object table name match this widget entity id");
1114
+ setIsLoading(false);
1115
+ });
1116
+ };
1117
+
1093
1118
  var getTableData = function getTableData(widget) {
1094
1119
  if (Session.Tenant == 0) {
1095
1120
  setTableData([]);
@@ -1333,6 +1358,18 @@ var TableChart = function TableChart(props) {
1333
1358
  return "unset";
1334
1359
  };
1335
1360
 
1361
+ var isClickableCell = function isClickableCell(fieldCode) {
1362
+ return fieldCode == "ShipmentNumber" && objectTableName == "Shipment" || fieldCode == "InvoiceNumber" && objectTableName == "APInvoice" || fieldCode == "InvoiceNumber" && objectTableName == "ARInvoice" || fieldCode == "ContainerNumber" && objectTableName == "Container" || fieldCode == "QuoteNumber" && objectTableName == "Quote" || fieldCode == "Subject" && objectTableName == "Opportunity" || fieldCode == "EnglishName" && objectTableName == "Customer";
1363
+ };
1364
+
1365
+ var tableCellClicked = function tableCellClicked(data, fieldCode) {
1366
+ if (!data || !data.Id || !data.Id.Label || !isClickableCell(fieldCode) || props.customChartProps.isInEditMode) return;
1367
+ props.customChartProps.onSelectDataPoint({
1368
+ ObjectTableName: objectTableName,
1369
+ TableRowEntityId: data.Id.Label
1370
+ });
1371
+ };
1372
+
1336
1373
  var cellTemplateBody = function cellTemplateBody(data, column) {
1337
1374
  var _data$column$FieldCod, _data$column$FieldCod2, _data$column$FieldCod3, _data$column$FieldCod4, _data$column$FieldCod5, _data$column$FieldCod6, _data$column$FieldCod7;
1338
1375
 
@@ -1345,8 +1382,11 @@ var TableChart = function TableChart(props) {
1345
1382
  fontSize: getTableFormattingPropertyValue("TableCellFontSize", "px")
1346
1383
  }
1347
1384
  }, getDateTimeValue((_data$column$FieldCod2 = data[column.FieldCode]) === null || _data$column$FieldCod2 === void 0 ? void 0 : _data$column$FieldCod2.Label)) : React__default.createElement("span", {
1385
+ onClick: function onClick() {
1386
+ return tableCellClicked(data, column.FieldCode);
1387
+ },
1348
1388
  title: (_data$column$FieldCod3 = data[column.FieldCode]) === null || _data$column$FieldCod3 === void 0 ? void 0 : _data$column$FieldCod3.Label,
1349
- className: "table-cell",
1389
+ className: "table-cell " + (isClickableCell(column.FieldCode) ? 'table-link-cell' : ''),
1350
1390
  style: {
1351
1391
  color: getTableFormattingPropertyValue("TableCellFontColor"),
1352
1392
  backgroundColor: getCellPropertyByRule(column, (_data$column$FieldCod4 = data[column.FieldCode]) === null || _data$column$FieldCod4 === void 0 ? void 0 : _data$column$FieldCod4.Value, 'RuleBackgroundColor'),
@@ -1787,11 +1827,11 @@ var getGaugeObject = function getGaugeObject(data, widget) {
1787
1827
  fusionObject.dataSource = {
1788
1828
  "chart": chartInfo,
1789
1829
  "colorRange": {
1790
- "color": getWidgetRanges(widget, data === null || data === void 0 ? void 0 : data.Value)
1830
+ "color": getWidgetRanges(widget, !isNullOrUndefined(data) && !isNullOrUndefined(data === null || data === void 0 ? void 0 : data.Value) ? data === null || data === void 0 ? void 0 : data.Value : 0)
1791
1831
  },
1792
1832
  "dials": {
1793
1833
  "dial": [{
1794
- "value": data.Value
1834
+ "value": !isNullOrUndefined(data) && !isNullOrUndefined(data === null || data === void 0 ? void 0 : data.Value) ? data === null || data === void 0 ? void 0 : data.Value : 0
1795
1835
  }]
1796
1836
  }
1797
1837
  };