logitude-dashboard-library 3.2.3 → 3.2.5
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/Utils/General.d.ts +2 -1
- package/dist/assets/styles/dl-dashboard.scss +28 -5
- package/dist/features/Dashboard/ChartsComponents/CustomCharts/CustomChart.d.ts +1 -0
- package/dist/index.js +127 -10
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +127 -10
- package/dist/index.modern.js.map +1 -1
- package/dist/styles/dl-dashboard.scss +28 -5
- package/dist/types/widget.d.ts +5 -0
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -318,6 +318,10 @@ var isNullOrUndefined = function isNullOrUndefined(val) {
|
|
|
318
318
|
return val == null || val == undefined;
|
|
319
319
|
};
|
|
320
320
|
|
|
321
|
+
var isNullOrUndefinedOrEmpty = function isNullOrUndefinedOrEmpty(val) {
|
|
322
|
+
return val == null || val == undefined || val == "";
|
|
323
|
+
};
|
|
324
|
+
|
|
321
325
|
var KpiChart = function KpiChart(props) {
|
|
322
326
|
var _widget$current18;
|
|
323
327
|
|
|
@@ -383,6 +387,7 @@ var KpiChart = function KpiChart(props) {
|
|
|
383
387
|
var postWidget = _extends({}, widget.current);
|
|
384
388
|
|
|
385
389
|
postWidget.onChange = undefined;
|
|
390
|
+
postWidget.EntityId = !isNullOrUndefinedOrEmpty(postWidget.RelatedToEntityId) ? postWidget.RelatedToEntityId : postWidget.EntityId;
|
|
386
391
|
dashboardAnalyticsService.getKpiData(postWidget).then(function (result) {
|
|
387
392
|
setData(result.data);
|
|
388
393
|
setIsLoading(false);
|
|
@@ -562,21 +567,34 @@ var TableChart = function TableChart(props) {
|
|
|
562
567
|
isLoading = _useState[0],
|
|
563
568
|
setIsLoading = _useState[1];
|
|
564
569
|
|
|
565
|
-
var _useState2 = useState(),
|
|
566
|
-
|
|
567
|
-
|
|
570
|
+
var _useState2 = useState(false),
|
|
571
|
+
isTableLoading = _useState2[0],
|
|
572
|
+
setIsTableLoading = _useState2[1];
|
|
568
573
|
|
|
569
574
|
var _useState3 = useState(),
|
|
570
|
-
|
|
575
|
+
error = _useState3[0],
|
|
576
|
+
setError = _useState3[1];
|
|
571
577
|
|
|
572
|
-
var _useState4 = useState(
|
|
573
|
-
|
|
574
|
-
setTableData = _useState4[1];
|
|
578
|
+
var _useState4 = useState(),
|
|
579
|
+
setWidget = _useState4[1];
|
|
575
580
|
|
|
576
581
|
var _useState5 = useState([]),
|
|
577
|
-
|
|
578
|
-
|
|
582
|
+
tableData = _useState5[0],
|
|
583
|
+
setTableData = _useState5[1];
|
|
579
584
|
|
|
585
|
+
var _useState6 = useState([]),
|
|
586
|
+
tableColumns = _useState6[0],
|
|
587
|
+
setTableColumns = _useState6[1];
|
|
588
|
+
|
|
589
|
+
var _useState7 = useState(null),
|
|
590
|
+
sortField = _useState7[0],
|
|
591
|
+
setSortField = _useState7[1];
|
|
592
|
+
|
|
593
|
+
var _useState8 = useState(null),
|
|
594
|
+
sortOrder = _useState8[0],
|
|
595
|
+
setSortOrder = _useState8[1];
|
|
596
|
+
|
|
597
|
+
var isDefaultSortOptionsUsed = useRef(false);
|
|
580
598
|
useEffect(function () {
|
|
581
599
|
if (props.customChartProps && props.customChartProps.widget) {
|
|
582
600
|
setWidget(props.customChartProps.widget);
|
|
@@ -595,6 +613,7 @@ var TableChart = function TableChart(props) {
|
|
|
595
613
|
widget.onChange = undefined;
|
|
596
614
|
widget.PageIndex = 0;
|
|
597
615
|
widget.PageSize = 100;
|
|
616
|
+
widget.EntityId = !isNullOrUndefinedOrEmpty(widget.RelatedToEntityId) ? widget.RelatedToEntityId : widget.EntityId;
|
|
598
617
|
dashboardAnalyticsService.getTableData(widget).then(function (res) {
|
|
599
618
|
if (res && res.data) {
|
|
600
619
|
fillTableData(res.data);
|
|
@@ -631,6 +650,7 @@ var TableChart = function TableChart(props) {
|
|
|
631
650
|
|
|
632
651
|
if (tableData.Fields && tableData.Fields.length) {
|
|
633
652
|
setTableColumns([].concat(tableData.Fields));
|
|
653
|
+
setDefaultSortOptions(tableData.Fields);
|
|
634
654
|
}
|
|
635
655
|
|
|
636
656
|
if (tableData.Result && tableData.Result.length) {
|
|
@@ -652,6 +672,80 @@ var TableChart = function TableChart(props) {
|
|
|
652
672
|
setTableData([].concat(tableRecords));
|
|
653
673
|
};
|
|
654
674
|
|
|
675
|
+
var setDefaultSortOptions = function setDefaultSortOptions(tableCols) {
|
|
676
|
+
if (tableCols === void 0) {
|
|
677
|
+
tableCols = [];
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
if (isDefaultSortOptionsUsed && isDefaultSortOptionsUsed.current) return;
|
|
681
|
+
isDefaultSortOptionsUsed.current = true;
|
|
682
|
+
|
|
683
|
+
var _widget = props.customChartProps ? props.customChartProps.widget : null;
|
|
684
|
+
|
|
685
|
+
if (!_widget) return;
|
|
686
|
+
|
|
687
|
+
var _sortFieldCode = getSortFieldCodeBySortFieldId(_widget.DefaultSortBy, tableCols);
|
|
688
|
+
|
|
689
|
+
var _sortDirection = _widget.DefaultSortDirection ? _widget.DefaultSortDirection == 'asc' ? 1 : _widget.DefaultSortDirection == 'desc' ? -1 : 0 : null;
|
|
690
|
+
|
|
691
|
+
setSortField(_sortFieldCode);
|
|
692
|
+
setSortOrder(_sortDirection);
|
|
693
|
+
};
|
|
694
|
+
|
|
695
|
+
var getSortFieldCodeBySortFieldId = function getSortFieldCodeBySortFieldId(sortFieldId, tableCols) {
|
|
696
|
+
if (tableCols === void 0) {
|
|
697
|
+
tableCols = [];
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
if (!sortFieldId) return null;
|
|
701
|
+
var field = tableCols.find(function (col) {
|
|
702
|
+
return col.Id == sortFieldId;
|
|
703
|
+
});
|
|
704
|
+
return field ? field.FieldCode : null;
|
|
705
|
+
};
|
|
706
|
+
|
|
707
|
+
var getSortFieldIdBySortFieldCode = function getSortFieldIdBySortFieldCode(sortFieldCode) {
|
|
708
|
+
if (!sortFieldCode) return null;
|
|
709
|
+
var field = tableColumns.find(function (col) {
|
|
710
|
+
return col.FieldCode == sortFieldCode;
|
|
711
|
+
});
|
|
712
|
+
return field ? field.Id : null;
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
var sortTableData = function sortTableData(e) {
|
|
716
|
+
setSortField(e.sortField);
|
|
717
|
+
setSortOrder(e.sortOrder);
|
|
718
|
+
var _widget = props.customChartProps.widget;
|
|
719
|
+
var dashboardAnalyticsService = new DashboardAnalyticsService();
|
|
720
|
+
_widget.onChange = undefined;
|
|
721
|
+
_widget.PageIndex = 0;
|
|
722
|
+
_widget.PageSize = 100;
|
|
723
|
+
_widget.ScreenSortBy = getSortFieldIdBySortFieldCode(e.sortField);
|
|
724
|
+
_widget.ScreenSortDirection = e.sortOrder == 1 ? 'asc' : e.sortOrder == -1 ? 'desc' : null;
|
|
725
|
+
_widget.EntityId = !isNullOrUndefinedOrEmpty(_widget.RelatedToEntityId) ? _widget.RelatedToEntityId : _widget.EntityId;
|
|
726
|
+
setIsTableLoading(true);
|
|
727
|
+
dashboardAnalyticsService.getTableData(_widget).then(function (res) {
|
|
728
|
+
if (res && res.data) {
|
|
729
|
+
fillTableData(res.data);
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
setIsTableLoading(false);
|
|
733
|
+
})["catch"](function (error) {
|
|
734
|
+
var _error$response3, _error$response3$data, _error$response4, _error$response4$data;
|
|
735
|
+
|
|
736
|
+
if (error !== null && error !== void 0 && (_error$response3 = error.response) !== null && _error$response3 !== void 0 && (_error$response3$data = _error$response3.data) !== null && _error$response3$data !== void 0 && _error$response3$data.ErrorMessage) setError(error === null || error === void 0 ? void 0 : (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : (_error$response4$data = _error$response4.data) === null || _error$response4$data === void 0 ? void 0 : _error$response4$data.ErrorMessage);else setError(error.message);
|
|
737
|
+
setIsTableLoading(false);
|
|
738
|
+
});
|
|
739
|
+
};
|
|
740
|
+
|
|
741
|
+
var canSort = function canSort() {
|
|
742
|
+
if (props.customChartProps) {
|
|
743
|
+
return !props.customChartProps.isInEditMode && !props.customChartProps.isPreviewModeActive;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
return false;
|
|
747
|
+
};
|
|
748
|
+
|
|
655
749
|
return isLoading ? React__default.createElement("div", {
|
|
656
750
|
className: 'dl-full-hight dl-flex-content-center spinner-custome'
|
|
657
751
|
}, React__default.createElement(ProgressSpinner, {
|
|
@@ -673,10 +767,15 @@ var TableChart = function TableChart(props) {
|
|
|
673
767
|
}), React__default.createElement("span", {
|
|
674
768
|
className: "dl-tooltiptext"
|
|
675
769
|
}, error))) : React__default.createElement(DataTable, {
|
|
770
|
+
loading: isTableLoading,
|
|
771
|
+
sortField: sortField,
|
|
772
|
+
sortOrder: sortOrder,
|
|
773
|
+
onSort: sortTableData,
|
|
676
774
|
value: tableData,
|
|
677
775
|
responsiveLayout: "scroll"
|
|
678
776
|
}, tableColumns.map(function (column, index) {
|
|
679
777
|
return React__default.createElement(Column, {
|
|
778
|
+
sortable: canSort(),
|
|
680
779
|
key: column.FieldCode + "_" + index,
|
|
681
780
|
field: column.FieldCode,
|
|
682
781
|
header: column.DisplayName
|
|
@@ -706,9 +805,25 @@ var CustomChart = function CustomChart(props) {
|
|
|
706
805
|
}
|
|
707
806
|
};
|
|
708
807
|
|
|
808
|
+
var drilldownToTableData = function drilldownToTableData() {
|
|
809
|
+
props.onSelectDataPoint({
|
|
810
|
+
GroupById: undefined,
|
|
811
|
+
MeasureFieldId: undefined,
|
|
812
|
+
MeasureCode: undefined,
|
|
813
|
+
Formula: undefined,
|
|
814
|
+
Widget: props.widget,
|
|
815
|
+
GroupByIdSec: undefined
|
|
816
|
+
});
|
|
817
|
+
};
|
|
818
|
+
|
|
709
819
|
return React__default.createElement(React__default.Fragment, null, ((_props$widget2 = props.widget) === null || _props$widget2 === void 0 ? void 0 : _props$widget2.TypeCode) && ((_props$widget3 = props.widget) === null || _props$widget3 === void 0 ? void 0 : _props$widget3.TypeCode) == 'table' && React__default.createElement("div", {
|
|
820
|
+
className: "table-hint-container"
|
|
821
|
+
}, React__default.createElement("div", {
|
|
710
822
|
className: "table-rows-number-indicator"
|
|
711
|
-
}, "Showing the first 100 rows"), React__default.createElement("div", {
|
|
823
|
+
}, "Showing the first 100 rows"), !props.isInEditMode && !props.isPreviewModeActive && React__default.createElement("div", {
|
|
824
|
+
onClick: drilldownToTableData,
|
|
825
|
+
className: "show-more-records"
|
|
826
|
+
}, "( Show More Records )")), React__default.createElement("div", {
|
|
712
827
|
className: props.widget && ((_props$widget4 = props.widget) === null || _props$widget4 === void 0 ? void 0 : _props$widget4.TypeCode) == 'table' ? "dl-custom-chart-container dl-table-chart-container" : "dl-custom-chart-container"
|
|
713
828
|
}, project()));
|
|
714
829
|
};
|
|
@@ -1563,6 +1678,7 @@ var FusionChart = forwardRef(function (props, comRef) {
|
|
|
1563
1678
|
signal = updatedAxiosController === null || updatedAxiosController === void 0 ? void 0 : updatedAxiosController.signal;
|
|
1564
1679
|
}
|
|
1565
1680
|
|
|
1681
|
+
postWidget.EntityId = !isNullOrUndefinedOrEmpty(postWidget.RelatedToEntityId) ? postWidget.RelatedToEntityId : postWidget.EntityId;
|
|
1566
1682
|
dashboardAnalyticsService.getData(postWidget, signal).then(function (result) {
|
|
1567
1683
|
handleData(result === null || result === void 0 ? void 0 : result.data);
|
|
1568
1684
|
chartData.current = result === null || result === void 0 ? void 0 : result.data;
|
|
@@ -1861,6 +1977,7 @@ var WidgetCard = forwardRef(function (props, comRef) {
|
|
|
1861
1977
|
|
|
1862
1978
|
if (isLoading || !((_widget$current4 = widget.current) !== null && _widget$current4 !== void 0 && _widget$current4.TypeCode)) return "";
|
|
1863
1979
|
if (((_widget$current5 = widget.current) === null || _widget$current5 === void 0 ? void 0 : _widget$current5.TypeCode) == "kpi" || ((_widget$current6 = widget.current) === null || _widget$current6 === void 0 ? void 0 : _widget$current6.TypeCode) == "table") return React__default.createElement(CustomChart, {
|
|
1980
|
+
isInEditMode: props.isInEditMode,
|
|
1864
1981
|
isPreviewModeActive: props.isPreviewModeActive,
|
|
1865
1982
|
dataBinding: props.dataBinding,
|
|
1866
1983
|
widget: widget.current,
|