logitude-dashboard-library 1.4.77 → 1.4.78
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.
- package/dist/assets/styles/dl-dashboard.scss +66 -0
- package/dist/features/Dashboard/ChartsComponents/CustomCharts/TableChart.d.ts +7 -0
- package/dist/index.js +153 -9
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +153 -9
- package/dist/index.modern.js.map +1 -1
- package/dist/services/DashboardAnalyticsService.d.ts +1 -0
- package/dist/types/widget.d.ts +1 -0
- package/package.json +1 -1
|
@@ -713,6 +713,72 @@ $dark-grey: #717585;
|
|
|
713
713
|
place-content: flex-start;
|
|
714
714
|
align-items: flex-start;
|
|
715
715
|
}
|
|
716
|
+
|
|
717
|
+
.dl-table-chart-container {
|
|
718
|
+
overflow: auto;
|
|
719
|
+
position: absolute;
|
|
720
|
+
top: 0;
|
|
721
|
+
right: 0;
|
|
722
|
+
left: 0;
|
|
723
|
+
bottom: 0;
|
|
724
|
+
height: calc(100% - 15px);
|
|
725
|
+
width: calc(100% - 25px);
|
|
726
|
+
margin: 0 auto;
|
|
727
|
+
|
|
728
|
+
table {
|
|
729
|
+
border-collapse: collapse;
|
|
730
|
+
width: 100%;
|
|
731
|
+
height: auto;
|
|
732
|
+
max-height: 100%;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
td,
|
|
736
|
+
th {
|
|
737
|
+
border: 1px solid #ddd;
|
|
738
|
+
padding: 8px;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
th {
|
|
742
|
+
text-align: left;
|
|
743
|
+
font-weight: bold;
|
|
744
|
+
font-size: 14px;
|
|
745
|
+
white-space: nowrap;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
td {
|
|
749
|
+
border: 1px solid #ddd;
|
|
750
|
+
padding: 8px;
|
|
751
|
+
max-width: 1px;
|
|
752
|
+
min-width: 140px;
|
|
753
|
+
line-height: normal;
|
|
754
|
+
word-break: break-all;
|
|
755
|
+
white-space: normal;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
tr {
|
|
759
|
+
width: auto;
|
|
760
|
+
min-width: 150px;
|
|
761
|
+
height: 1px;
|
|
762
|
+
line-height: 10px;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
tbody tr td{
|
|
766
|
+
font-size: 14px;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
tr:nth-child(even) {
|
|
770
|
+
background-color: #f2f2f2;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
tr:hover {
|
|
774
|
+
background-color: #ddd;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
.margin-auto {
|
|
779
|
+
margin: auto;
|
|
780
|
+
}
|
|
781
|
+
|
|
716
782
|
.dl-kpi-prev-container {
|
|
717
783
|
display: flex;
|
|
718
784
|
align-content: flex-start;
|
package/dist/index.js
CHANGED
|
@@ -203,6 +203,10 @@ var DashboardAnalyticsService = /*#__PURE__*/function () {
|
|
|
203
203
|
return this._ApiServices.post("/api/" + this.controller + "/PostGetKpiData", widget);
|
|
204
204
|
};
|
|
205
205
|
|
|
206
|
+
_proto.getTableData = function getTableData(widget) {
|
|
207
|
+
return this._ApiServices.post("/api/" + this.controller + "/PostGetTableData", widget);
|
|
208
|
+
};
|
|
209
|
+
|
|
206
210
|
return DashboardAnalyticsService;
|
|
207
211
|
}();
|
|
208
212
|
|
|
@@ -517,7 +521,142 @@ var KpiChart = function KpiChart(props) {
|
|
|
517
521
|
}, error)));
|
|
518
522
|
};
|
|
519
523
|
|
|
524
|
+
var TableChart = function TableChart(props) {
|
|
525
|
+
var _useState = React.useState(true),
|
|
526
|
+
isLoading = _useState[0],
|
|
527
|
+
setIsLoading = _useState[1];
|
|
528
|
+
|
|
529
|
+
var _useState2 = React.useState(),
|
|
530
|
+
error = _useState2[0],
|
|
531
|
+
setError = _useState2[1];
|
|
532
|
+
|
|
533
|
+
var _useState3 = React.useState(),
|
|
534
|
+
setWidget = _useState3[1];
|
|
535
|
+
|
|
536
|
+
var _useState4 = React.useState([]),
|
|
537
|
+
tableData = _useState4[0],
|
|
538
|
+
setTableData = _useState4[1];
|
|
539
|
+
|
|
540
|
+
React.useEffect(function () {
|
|
541
|
+
if (props.customChartProps && props.customChartProps.widget) {
|
|
542
|
+
setWidget(props.customChartProps.widget);
|
|
543
|
+
getTableData(props.customChartProps.widget);
|
|
544
|
+
}
|
|
545
|
+
}, []);
|
|
546
|
+
|
|
547
|
+
var getTableData = function getTableData(widget) {
|
|
548
|
+
if (Session.Tenant == 0) {
|
|
549
|
+
setTableData([]);
|
|
550
|
+
setIsLoading(false);
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
var dashboardAnalyticsService = new DashboardAnalyticsService();
|
|
555
|
+
widget.onChange = undefined;
|
|
556
|
+
widget.PageIndex = 0;
|
|
557
|
+
widget.PageSize = 50;
|
|
558
|
+
dashboardAnalyticsService.getTableData(widget).then(function (res) {
|
|
559
|
+
if (res && res.data) {
|
|
560
|
+
fillTableData(res.data);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
setIsLoading(false);
|
|
564
|
+
})["catch"](function (error) {
|
|
565
|
+
var _error$response, _error$response$data, _error$response2, _error$response2$data;
|
|
566
|
+
|
|
567
|
+
if (error !== null && error !== void 0 && (_error$response = error.response) !== null && _error$response !== void 0 && (_error$response$data = _error$response.data) !== null && _error$response$data !== void 0 && _error$response$data.ErrorMessage) setError(error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : _error$response2$data.ErrorMessage);else setError(error.message);
|
|
568
|
+
setIsLoading(false);
|
|
569
|
+
});
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
var getDateTimeValue = function getDateTimeValue(value) {
|
|
573
|
+
if (!value) return value;
|
|
574
|
+
|
|
575
|
+
var _date = moment(value);
|
|
576
|
+
|
|
577
|
+
if (!_date || !_date.isValid()) return value;
|
|
578
|
+
return _date.format("DD MMM YYYY");
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
var fillTableData = function fillTableData(tableData) {
|
|
582
|
+
var tableRecoreds = [];
|
|
583
|
+
var tableRow = [];
|
|
584
|
+
|
|
585
|
+
if (tableData.Fields) {
|
|
586
|
+
tableData.Fields.forEach(function (item) {
|
|
587
|
+
tableRow.push(_extends({}, item, {
|
|
588
|
+
value: item.DisplayName ? item.DisplayName : "",
|
|
589
|
+
isHeader: true
|
|
590
|
+
}));
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
tableRecoreds.push(tableRow);
|
|
595
|
+
|
|
596
|
+
if (tableData.Result) {
|
|
597
|
+
tableData.Result.forEach(function (item) {
|
|
598
|
+
var _tableRow = [];
|
|
599
|
+
tableData.Fields.forEach(function (field) {
|
|
600
|
+
var key = field.FieldCode;
|
|
601
|
+
var valueType = field.DataTypeCode;
|
|
602
|
+
|
|
603
|
+
var _value = valueType && (valueType == "Date" || valueType == "DateTime") ? getDateTimeValue(item[key]) : item[key];
|
|
604
|
+
|
|
605
|
+
_tableRow.push({
|
|
606
|
+
value: _value
|
|
607
|
+
});
|
|
608
|
+
});
|
|
609
|
+
tableRecoreds.push(_tableRow);
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
setTableData([].concat(tableRecoreds));
|
|
614
|
+
};
|
|
615
|
+
|
|
616
|
+
var getTableTemplate = function getTableTemplate() {
|
|
617
|
+
return tableData.length == 0 ? React__default.createElement("div", {
|
|
618
|
+
className: "dl-kpi-no-data margin-auto"
|
|
619
|
+
}, "No data to display.") : React__default.createElement("table", null, React__default.createElement("thead", null, React__default.createElement("tr", null, tableData[0].map(function (el) {
|
|
620
|
+
return React__default.createElement("th", {
|
|
621
|
+
key: el.value
|
|
622
|
+
}, el.value ? el.value : '');
|
|
623
|
+
}))), React__default.createElement("tbody", null, tableData.map(function (el, index) {
|
|
624
|
+
return index == 0 ? null : React__default.createElement("tr", {
|
|
625
|
+
key: index
|
|
626
|
+
}, el.map(function (item, index2) {
|
|
627
|
+
return React__default.createElement("td", {
|
|
628
|
+
key: index2 + "_" + el.value
|
|
629
|
+
}, item.value ? item.value : '');
|
|
630
|
+
}));
|
|
631
|
+
})));
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
return isLoading ? React__default.createElement("div", {
|
|
635
|
+
className: 'dl-full-hight dl-flex-content-center spinner-custome'
|
|
636
|
+
}, React__default.createElement(progressspinner.ProgressSpinner, {
|
|
637
|
+
style: {
|
|
638
|
+
width: '40px',
|
|
639
|
+
height: '40px'
|
|
640
|
+
},
|
|
641
|
+
strokeWidth: "4",
|
|
642
|
+
animationDuration: "2s"
|
|
643
|
+
})) : error ? React__default.createElement("div", {
|
|
644
|
+
className: "dl-flex-content-center dl-full-hight",
|
|
645
|
+
style: {
|
|
646
|
+
width: '100%'
|
|
647
|
+
}
|
|
648
|
+
}, React__default.createElement("div", {
|
|
649
|
+
className: "dl-tooltip"
|
|
650
|
+
}, React__default.createElement(SvgRedWarning, {
|
|
651
|
+
className: "red-warning-icon"
|
|
652
|
+
}), React__default.createElement("span", {
|
|
653
|
+
className: "dl-tooltiptext"
|
|
654
|
+
}, error))) : getTableTemplate();
|
|
655
|
+
};
|
|
656
|
+
|
|
520
657
|
var CustomChart = function CustomChart(props) {
|
|
658
|
+
var _props$widget2;
|
|
659
|
+
|
|
521
660
|
var project = function project() {
|
|
522
661
|
var _props$widget;
|
|
523
662
|
|
|
@@ -527,13 +666,18 @@ var CustomChart = function CustomChart(props) {
|
|
|
527
666
|
customChartProps: props
|
|
528
667
|
});
|
|
529
668
|
|
|
669
|
+
case "table":
|
|
670
|
+
return React__default.createElement(TableChart, {
|
|
671
|
+
customChartProps: props
|
|
672
|
+
});
|
|
673
|
+
|
|
530
674
|
default:
|
|
531
675
|
return React__default.createElement("div", null, "Invalid Type");
|
|
532
676
|
}
|
|
533
677
|
};
|
|
534
678
|
|
|
535
679
|
return React__default.createElement("div", {
|
|
536
|
-
className: "dl-custom-chart-container"
|
|
680
|
+
className: props.widget && ((_props$widget2 = props.widget) === null || _props$widget2 === void 0 ? void 0 : _props$widget2.TypeCode) == 'table' ? "dl-custom-chart-container dl-table-chart-container" : "dl-custom-chart-container"
|
|
537
681
|
}, project());
|
|
538
682
|
};
|
|
539
683
|
|
|
@@ -1485,7 +1629,7 @@ function SvgCopyIcon(props) {
|
|
|
1485
1629
|
}
|
|
1486
1630
|
|
|
1487
1631
|
var WidgetCard = React.forwardRef(function (props, comRef) {
|
|
1488
|
-
var _widget$
|
|
1632
|
+
var _widget$current6, _widget$current7, _widget$current8, _widget$current9, _widget$current10, _widget$current11, _widget$current12;
|
|
1489
1633
|
|
|
1490
1634
|
var widget = React.useRef();
|
|
1491
1635
|
|
|
@@ -1547,10 +1691,10 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
|
|
|
1547
1691
|
};
|
|
1548
1692
|
|
|
1549
1693
|
var GetChartComponent = function GetChartComponent() {
|
|
1550
|
-
var _widget$current3, _widget$current4;
|
|
1694
|
+
var _widget$current3, _widget$current4, _widget$current5;
|
|
1551
1695
|
|
|
1552
1696
|
if (isLoading || !((_widget$current3 = widget.current) !== null && _widget$current3 !== void 0 && _widget$current3.TypeCode)) return "";
|
|
1553
|
-
if (((_widget$current4 = widget.current) === null || _widget$current4 === void 0 ? void 0 : _widget$current4.TypeCode) == "kpi") return React__default.createElement(CustomChart, {
|
|
1697
|
+
if (((_widget$current4 = widget.current) === null || _widget$current4 === void 0 ? void 0 : _widget$current4.TypeCode) == "kpi" || ((_widget$current5 = widget.current) === null || _widget$current5 === void 0 ? void 0 : _widget$current5.TypeCode) == "table") return React__default.createElement(CustomChart, {
|
|
1554
1698
|
isPreviewModeActive: props.isPreviewModeActive,
|
|
1555
1699
|
dataBinding: props.dataBinding,
|
|
1556
1700
|
widget: widget.current,
|
|
@@ -1598,7 +1742,7 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
|
|
|
1598
1742
|
color: getCSSPropertyValue(widget.current, 'TitleFontColor', ''),
|
|
1599
1743
|
textAlign: getCSSPropertyValue(widget === null || widget === void 0 ? void 0 : widget.current, 'TitleAlignment', '', undefined)
|
|
1600
1744
|
}
|
|
1601
|
-
}, (_widget$
|
|
1745
|
+
}, (_widget$current6 = widget.current) === null || _widget$current6 === void 0 ? void 0 : _widget$current6.Title),
|
|
1602
1746
|
position: ['top center'],
|
|
1603
1747
|
arrowStyle: {
|
|
1604
1748
|
color: '#262626'
|
|
@@ -1607,15 +1751,15 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
|
|
|
1607
1751
|
on: ['hover', 'focus']
|
|
1608
1752
|
}, React__default.createElement("span", {
|
|
1609
1753
|
className: "widget-title-tooltip-text"
|
|
1610
|
-
}, (_widget$
|
|
1611
|
-
className: (_widget$
|
|
1754
|
+
}, (_widget$current7 = widget.current) === null || _widget$current7 === void 0 ? void 0 : _widget$current7.Title))), React__default.createElement("div", {
|
|
1755
|
+
className: (_widget$current8 = widget.current) !== null && _widget$current8 !== void 0 && _widget$current8.Subtitle && ((_widget$current9 = widget.current) === null || _widget$current9 === void 0 ? void 0 : _widget$current9.Subtitle.length) > 0 ? "subtitle" : "subtitle margin-top-4",
|
|
1612
1756
|
style: {
|
|
1613
1757
|
fontSize: getCSSPropertyValue(widget.current, 'SubtitleFontSize', 'px'),
|
|
1614
1758
|
textAlign: getCSSPropertyValue(widget === null || widget === void 0 ? void 0 : widget.current, 'TitleAlignment', '', undefined),
|
|
1615
1759
|
color: getCSSPropertyValue(widget.current, 'SubtitleFontColor', '')
|
|
1616
1760
|
}
|
|
1617
|
-
}, (_widget$
|
|
1618
|
-
className: (_widget$
|
|
1761
|
+
}, (_widget$current10 = widget.current) === null || _widget$current10 === void 0 ? void 0 : _widget$current10.Subtitle)), React__default.createElement("div", {
|
|
1762
|
+
className: (_widget$current11 = widget.current) !== null && _widget$current11 !== void 0 && _widget$current11.Title && ((_widget$current12 = widget.current) === null || _widget$current12 === void 0 ? void 0 : _widget$current12.Title.length) > 0 ? "widget-options-container" : "widget-options-container margin-top-6"
|
|
1619
1763
|
}, props.isInEditMode && isWidgetHovered ? React__default.createElement(React__default.Fragment, null, React__default.createElement(SvgEditIcon, {
|
|
1620
1764
|
onClick: function onClick() {
|
|
1621
1765
|
return editWidget();
|