logitude-dashboard-library 3.1.90 → 3.1.92

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.
@@ -1,3 +1,3 @@
1
1
  import { SeriesMeasure } from "../../../../types/SeriesMeasure";
2
2
  import { ReactWidgetPM } from "../../../../types/widget";
3
- export declare function buildToolTip(widget: ReactWidgetPM, value: any, seriesName: SeriesMeasure, label: any, index: number): string;
3
+ export declare function buildToolTip(widget: ReactWidgetPM, value: any, seriesMeasure: SeriesMeasure, label: any, index: number, groupbyId?: string | null, secGroupbyId?: string | null): string;
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ declare type DashboardProps = {
11
11
  userId: string;
12
12
  numberFormatCode?: string | null;
13
13
  isPreviewMode: boolean;
14
+ isMasterNumberClickable?: any;
14
15
  widgetData: ReactWidgetPM | undefined;
15
16
  dataBinding: DashboardDataBinding;
16
17
  onChangeLayouts: (layouts: {
package/dist/index.js CHANGED
@@ -1562,15 +1562,33 @@ var TableChart = function TableChart(props) {
1562
1562
  return "unset";
1563
1563
  };
1564
1564
 
1565
- var isClickableCell = function isClickableCell(fieldCode) {
1566
- 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" || fieldCode == "TaskNumber" && objectTableName == "Task" || fieldCode == "TicketNumber" && objectTableName == "Ticket";
1565
+ var isClickableCell = function isClickableCell(fieldCode, rowDate) {
1566
+ if (rowDate === void 0) {
1567
+ rowDate = null;
1568
+ }
1569
+
1570
+ return fieldCode == "ShipmentNumber" && objectTableName == "Shipment" || IsShipmentMasterFieldClickable(fieldCode, rowDate) || fieldCode == "InvoiceNumber" && objectTableName == "APInvoice" || fieldCode == "InvoiceNumber" && objectTableName == "ARInvoice" || fieldCode == "ContainerNumber" && objectTableName == "Container" || fieldCode == "QuoteNumber" && objectTableName == "Quote" || fieldCode == "Subject" && objectTableName == "Opportunity" || fieldCode == "EnglishName" && objectTableName == "Customer" || fieldCode == "TaskNumber" && objectTableName == "Task" || fieldCode == "TicketNumber" && objectTableName == "Ticket";
1571
+ };
1572
+
1573
+ var IsShipmentMasterFieldClickable = function IsShipmentMasterFieldClickable(fieldCode, rowData) {
1574
+ if (rowData === void 0) {
1575
+ rowData = null;
1576
+ }
1577
+
1578
+ if (Session.isMasterNumberClickable && objectTableName === "Shipment" && fieldCode === "Master" && Session.isMasterNumberClickable(rowData)) {
1579
+ return true;
1580
+ }
1581
+
1582
+ return false;
1567
1583
  };
1568
1584
 
1569
1585
  var tableCellClicked = function tableCellClicked(data, fieldCode) {
1570
- if (!data || !data.Id || !isClickableCell(fieldCode) || props.customChartProps.isInEditMode) return;
1586
+ if (!data || !data.Id || !isClickableCell(fieldCode, data) || props.customChartProps.isInEditMode) return;
1571
1587
  props.customChartProps.onSelectDataPoint({
1572
1588
  ObjectTableName: objectTableName,
1573
- TableRowEntityId: data.Id
1589
+ TableRowEntityId: data.Id,
1590
+ RowData: data,
1591
+ FieldCode: fieldCode
1574
1592
  });
1575
1593
  };
1576
1594
 
@@ -1625,7 +1643,7 @@ var TableChart = function TableChart(props) {
1625
1643
  return tableCellClicked(data, column.FieldCode);
1626
1644
  },
1627
1645
  title: getCellValue(data, column),
1628
- className: "table-cell " + (isClickableCell(column.FieldCode) ? 'table-link-cell' : ''),
1646
+ className: "table-cell " + (isClickableCell(column.FieldCode, data) ? 'table-link-cell' : ''),
1629
1647
  style: {
1630
1648
  color: getTableFormattingPropertyValue("TableCellFontColor"),
1631
1649
  backgroundColor: getCellPropertyByRule(column, data[column.FieldCode], 'RuleBackgroundColor'),
@@ -2078,9 +2096,67 @@ var CustomChart = function CustomChart(props) {
2078
2096
  }, project()));
2079
2097
  };
2080
2098
 
2081
- function buildToolTip(widget, value, seriesName, label, index) {
2099
+ function buildToolTip(widget, value, seriesMeasure, label, index, groupbyId, secGroupbyId) {
2100
+ if (groupbyId === void 0) {
2101
+ groupbyId = null;
2102
+ }
2103
+
2104
+ if (secGroupbyId === void 0) {
2105
+ secGroupbyId = null;
2106
+ }
2107
+
2082
2108
  var padding = widget.TypeCode == 'line' && index > 0 ? 'padding-top: 3px' : '';
2083
- return "\n <div style=\"min-width: 108px;" + padding + "\">\n <div style=\"display: flex;align-items: center;margin-bottom: 6px;\">\n <span style=\"margin: 0; min-height: 10px; min-width: 10px; height: 10px; width: 10px; background-color: transparent; border-radius: 50%; display: inline-block;\"></span>\n <p style=\" margin: 0; margin-left: 4px; white-space: pre-line; font-family: 'Manrope'; font-style: normal;font-weight: 400; font-size: 11px; line-height: 100%; color: #323232;\"> " + getTooltiplabel(label, seriesName) + "</p>\n </div>\n <hr style=\"margin: 0;border-top: 1px solid #F0F0F0;\">\n <div style=\"display: flex;align-items: center;margin:0;margin-top: 6px;\">\n <p style=\"margin: 0;font-family: 'Manrope'; white-space: pre-line; font-style: normal;font-weight: 400; font-size: 11px;line-height: 100%;color: #A4A4A4;\"> " + getMeasureType(seriesName) + "</p>\n <p style=\"margin: 0;margin-left: 6px; white-space: pre-line; font-family: 'Manrope';font-style: normal;font-weight: 500;font-size: 11px;line-height: 100%; color: #323232;\">" + getTooltipValue(value, seriesName) + "</p>\n " + getTooltipPercentage(widget) + " </div>\n </div>\n ";
2109
+ var customToolTip = "\n <div style=\"min-width: 108px;" + padding + "\">\n\n <div style=\"display: flex;align-items: center;margin-bottom: 6px;\">\n <span style=\"margin: 0; min-height: 10px; min-width: 10px; height: 10px; width: 10px; background-color: transparent; border-radius: 50%; display: inline-block;\"></span>\n <p style=\" margin: 0; margin-left: 4px; white-space: pre-line; font-family: 'Manrope'; font-style: normal;font-weight: 400; font-size: 11px; line-height: 100%; color: #323232;\"> " + getTooltiplabel(label, seriesMeasure) + "</p>\n </div>\n\n <hr style=\"margin: 0;border-top: 1px solid #F0F0F0;\">\n\n <div style=\"display: flex;align-items: center;margin:0;margin-top: 6px;\">\n <p style=\"margin: 0;font-family: 'Manrope'; white-space: pre-line; font-style: normal;font-weight: 400; font-size: 11px;line-height: 100%;color: #A4A4A4;\"> " + getMeasureType(seriesMeasure) + "</p>\n <p style=\"margin: 0;margin-left: 6px; white-space: pre-line; font-family: 'Manrope';font-style: normal;font-weight: 500;font-size: 11px;line-height: 100%; color: #A4A4A4;\">" + getTooltipValue(value, seriesMeasure) + "</p>\n " + getTooltipPercentage(widget) + " </div> ";
2110
+
2111
+ if (widget.IsStacked) {
2112
+ customToolTip += "<div>\n\n <hr style=\"margin-top: 6px;border-top: 1px solid #F0F0F0;\">\n\n <div style=\"display: flex; flex-direction: column; gap: 6px; flex-d align-items: center;margin:0;margin-top: 6px;\">\n <p style=\"margin: 0;font-family: 'Manrope'; white-space: pre-line; font-style: normal;font-weight: 400; font-size: 11px;line-height: 100%;color: #A4A4A4;\"> " + getGroupValuePercentage(seriesMeasure, groupbyId, secGroupbyId) + "</p>\n <p style=\"margin: 0;white-space: pre-line; font-family: 'Manrope';font-style: normal;font-weight: 500;font-size: 11px;line-height: 100%; color: #A4A4A4;\">" + getSumOfGroupValues(seriesMeasure, groupbyId) + "</p>\n </div>\n\n </div>";
2113
+ }
2114
+
2115
+ customToolTip += "</div>";
2116
+ return customToolTip;
2117
+ }
2118
+
2119
+ function getGroupValuePercentage(seriesMeasures, groupbyId, secGroupbyId) {
2120
+ var _seriesMeasures$Value;
2121
+
2122
+ if (!groupbyId || !secGroupbyId || !seriesMeasures) {
2123
+ return;
2124
+ }
2125
+
2126
+ var total = getSumOfGroupValuesAsNumber(seriesMeasures, groupbyId);
2127
+ var value = (_seriesMeasures$Value = seriesMeasures.Values.filter(function (v) {
2128
+ return v.GroupById === groupbyId && v.GroupByIdSec === secGroupbyId;
2129
+ })[0]) === null || _seriesMeasures$Value === void 0 ? void 0 : _seriesMeasures$Value.Value;
2130
+ var percentageValueInLocalFormat = "0";
2131
+
2132
+ if (total !== 0 && value) {
2133
+ percentageValueInLocalFormat = getNumberInSystemLocalFormat(value / total * 100, 2);
2134
+ }
2135
+
2136
+ return "<span style=\"margin-right:6px;\">Percentage:</span>" + percentageValueInLocalFormat + "%";
2137
+ }
2138
+
2139
+ function getSumOfGroupValues(seriesMeasure, groupbyId) {
2140
+ if (!groupbyId || !seriesMeasure) {
2141
+ return "";
2142
+ }
2143
+
2144
+ var total = getSumOfGroupValuesAsNumber(seriesMeasure, groupbyId);
2145
+ return "<span style=\"margin-right:6px;\">Total:</span>" + getNumberInSystemLocalFormat(total, 2);
2146
+ }
2147
+
2148
+ function getSumOfGroupValuesAsNumber(seriesMeasure, groupbyId) {
2149
+ if (!groupbyId || !seriesMeasure) {
2150
+ return 0;
2151
+ }
2152
+
2153
+ var total = 0;
2154
+ seriesMeasure.Values.filter(function (v) {
2155
+ return v.GroupById === groupbyId;
2156
+ }).forEach(function (v) {
2157
+ total += v.Value;
2158
+ });
2159
+ return total;
2084
2160
  }
2085
2161
 
2086
2162
  function getTooltipPercentage(widget) {
@@ -2290,7 +2366,7 @@ function buildStackedGroupData(secGroup, series, widget) {
2290
2366
  MeasureCode: series.MeasureCode,
2291
2367
  Formula: series.Formula
2292
2368
  },
2293
- tooltext: buildToolTip(widget, null, series, group.label + " - " + secGroup.label, 0)
2369
+ tooltext: buildToolTip(widget, null, series, group.label + " - " + secGroup.label, 0, group.code, secGroup.code)
2294
2370
  });
2295
2371
  });
2296
2372
  return data;
@@ -4029,6 +4105,7 @@ var Dashboard = function Dashboard(props) {
4029
4105
  Session.Tenant = props.tenant;
4030
4106
  Session.Token = props === null || props === void 0 ? void 0 : props.token;
4031
4107
  Session.NumberFormatCode = props === null || props === void 0 ? void 0 : props.numberFormatCode;
4108
+ Session.isMasterNumberClickable = props === null || props === void 0 ? void 0 : props.isMasterNumberClickable;
4032
4109
  setIsPreviewModeActive(props.isPreviewMode);
4033
4110
  props.dataBinding.onGetLayouts.subscribe(function (layouts) {
4034
4111
  Widgetlayouts.current = layouts;