logitude-dashboard-library 3.2.4 → 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/assets/styles/dl-dashboard.scss +28 -5
- package/dist/features/Dashboard/ChartsComponents/CustomCharts/CustomChart.d.ts +1 -0
- package/dist/index.js +120 -10
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +120 -10
- package/dist/index.modern.js.map +1 -1
- package/dist/styles/dl-dashboard.scss +28 -5
- package/dist/types/widget.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -567,21 +567,34 @@ var TableChart = function TableChart(props) {
|
|
|
567
567
|
isLoading = _useState[0],
|
|
568
568
|
setIsLoading = _useState[1];
|
|
569
569
|
|
|
570
|
-
var _useState2 = useState(),
|
|
571
|
-
|
|
572
|
-
|
|
570
|
+
var _useState2 = useState(false),
|
|
571
|
+
isTableLoading = _useState2[0],
|
|
572
|
+
setIsTableLoading = _useState2[1];
|
|
573
573
|
|
|
574
574
|
var _useState3 = useState(),
|
|
575
|
-
|
|
575
|
+
error = _useState3[0],
|
|
576
|
+
setError = _useState3[1];
|
|
576
577
|
|
|
577
|
-
var _useState4 = useState(
|
|
578
|
-
|
|
579
|
-
setTableData = _useState4[1];
|
|
578
|
+
var _useState4 = useState(),
|
|
579
|
+
setWidget = _useState4[1];
|
|
580
580
|
|
|
581
581
|
var _useState5 = useState([]),
|
|
582
|
-
|
|
583
|
-
|
|
582
|
+
tableData = _useState5[0],
|
|
583
|
+
setTableData = _useState5[1];
|
|
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];
|
|
584
592
|
|
|
593
|
+
var _useState8 = useState(null),
|
|
594
|
+
sortOrder = _useState8[0],
|
|
595
|
+
setSortOrder = _useState8[1];
|
|
596
|
+
|
|
597
|
+
var isDefaultSortOptionsUsed = useRef(false);
|
|
585
598
|
useEffect(function () {
|
|
586
599
|
if (props.customChartProps && props.customChartProps.widget) {
|
|
587
600
|
setWidget(props.customChartProps.widget);
|
|
@@ -637,6 +650,7 @@ var TableChart = function TableChart(props) {
|
|
|
637
650
|
|
|
638
651
|
if (tableData.Fields && tableData.Fields.length) {
|
|
639
652
|
setTableColumns([].concat(tableData.Fields));
|
|
653
|
+
setDefaultSortOptions(tableData.Fields);
|
|
640
654
|
}
|
|
641
655
|
|
|
642
656
|
if (tableData.Result && tableData.Result.length) {
|
|
@@ -658,6 +672,80 @@ var TableChart = function TableChart(props) {
|
|
|
658
672
|
setTableData([].concat(tableRecords));
|
|
659
673
|
};
|
|
660
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
|
+
|
|
661
749
|
return isLoading ? React__default.createElement("div", {
|
|
662
750
|
className: 'dl-full-hight dl-flex-content-center spinner-custome'
|
|
663
751
|
}, React__default.createElement(ProgressSpinner, {
|
|
@@ -679,10 +767,15 @@ var TableChart = function TableChart(props) {
|
|
|
679
767
|
}), React__default.createElement("span", {
|
|
680
768
|
className: "dl-tooltiptext"
|
|
681
769
|
}, error))) : React__default.createElement(DataTable, {
|
|
770
|
+
loading: isTableLoading,
|
|
771
|
+
sortField: sortField,
|
|
772
|
+
sortOrder: sortOrder,
|
|
773
|
+
onSort: sortTableData,
|
|
682
774
|
value: tableData,
|
|
683
775
|
responsiveLayout: "scroll"
|
|
684
776
|
}, tableColumns.map(function (column, index) {
|
|
685
777
|
return React__default.createElement(Column, {
|
|
778
|
+
sortable: canSort(),
|
|
686
779
|
key: column.FieldCode + "_" + index,
|
|
687
780
|
field: column.FieldCode,
|
|
688
781
|
header: column.DisplayName
|
|
@@ -712,9 +805,25 @@ var CustomChart = function CustomChart(props) {
|
|
|
712
805
|
}
|
|
713
806
|
};
|
|
714
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
|
+
|
|
715
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", {
|
|
716
822
|
className: "table-rows-number-indicator"
|
|
717
|
-
}, "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", {
|
|
718
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"
|
|
719
828
|
}, project()));
|
|
720
829
|
};
|
|
@@ -1868,6 +1977,7 @@ var WidgetCard = forwardRef(function (props, comRef) {
|
|
|
1868
1977
|
|
|
1869
1978
|
if (isLoading || !((_widget$current4 = widget.current) !== null && _widget$current4 !== void 0 && _widget$current4.TypeCode)) return "";
|
|
1870
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,
|
|
1871
1981
|
isPreviewModeActive: props.isPreviewModeActive,
|
|
1872
1982
|
dataBinding: props.dataBinding,
|
|
1873
1983
|
widget: widget.current,
|