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/Utils/General.d.ts
CHANGED
|
@@ -388,12 +388,25 @@ $dark-grey: #717585;
|
|
|
388
388
|
align-items: flex-start;
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
.table-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
391
|
+
.table-hint-container {
|
|
392
|
+
display: flex;
|
|
393
|
+
align-items: center;
|
|
394
|
+
justify-content: flex-start;
|
|
395
|
+
|
|
396
|
+
.table-rows-number-indicator {
|
|
397
|
+
margin: 4px 0px 2px 0px;
|
|
398
|
+
color: #939393;
|
|
399
|
+
font-size: 11px;
|
|
400
|
+
padding-left: 12px;
|
|
401
|
+
}
|
|
402
|
+
.show-more-records {
|
|
403
|
+
font-size: 11px;
|
|
404
|
+
color: #1967d2;
|
|
405
|
+
cursor: pointer;
|
|
406
|
+
margin: 3px 0px 2px 4px;
|
|
407
|
+
}
|
|
396
408
|
}
|
|
409
|
+
|
|
397
410
|
.filter-label {
|
|
398
411
|
font-size: 12px;
|
|
399
412
|
color: $dark-grey;
|
|
@@ -805,6 +818,16 @@ $dark-grey: #717585;
|
|
|
805
818
|
tr:hover {
|
|
806
819
|
background-color: #ddd;
|
|
807
820
|
}
|
|
821
|
+
|
|
822
|
+
.p-datatable .p-sortable-column.p-highlight:not(.p-sortable-disabled):hover,
|
|
823
|
+
.p-datatable .p-sortable-column.p-highlight {
|
|
824
|
+
background: #f8f9fa !important;
|
|
825
|
+
color: #343a40 !important;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
.p-datatable .p-sortable-column.p-highlight .p-sortable-column-icon::before {
|
|
829
|
+
color: #343a40 !important;
|
|
830
|
+
}
|
|
808
831
|
}
|
|
809
832
|
|
|
810
833
|
.margin-auto {
|
|
@@ -7,6 +7,7 @@ export declare type CustomChartProps = {
|
|
|
7
7
|
widgetRef: ReactWidgetPM | undefined;
|
|
8
8
|
dataBinding: DashboardDataBinding;
|
|
9
9
|
isPreviewModeActive?: boolean;
|
|
10
|
+
isInEditMode?: boolean;
|
|
10
11
|
onSelectDataPoint: (dataPointSelection: DataPointSelection) => void;
|
|
11
12
|
};
|
|
12
13
|
declare const CustomChart: (props: CustomChartProps) => React.JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -321,6 +321,10 @@ var isNullOrUndefined = function isNullOrUndefined(val) {
|
|
|
321
321
|
return val == null || val == undefined;
|
|
322
322
|
};
|
|
323
323
|
|
|
324
|
+
var isNullOrUndefinedOrEmpty = function isNullOrUndefinedOrEmpty(val) {
|
|
325
|
+
return val == null || val == undefined || val == "";
|
|
326
|
+
};
|
|
327
|
+
|
|
324
328
|
var KpiChart = function KpiChart(props) {
|
|
325
329
|
var _widget$current18;
|
|
326
330
|
|
|
@@ -386,6 +390,7 @@ var KpiChart = function KpiChart(props) {
|
|
|
386
390
|
var postWidget = _extends({}, widget.current);
|
|
387
391
|
|
|
388
392
|
postWidget.onChange = undefined;
|
|
393
|
+
postWidget.EntityId = !isNullOrUndefinedOrEmpty(postWidget.RelatedToEntityId) ? postWidget.RelatedToEntityId : postWidget.EntityId;
|
|
389
394
|
dashboardAnalyticsService.getKpiData(postWidget).then(function (result) {
|
|
390
395
|
setData(result.data);
|
|
391
396
|
setIsLoading(false);
|
|
@@ -565,21 +570,34 @@ var TableChart = function TableChart(props) {
|
|
|
565
570
|
isLoading = _useState[0],
|
|
566
571
|
setIsLoading = _useState[1];
|
|
567
572
|
|
|
568
|
-
var _useState2 = React.useState(),
|
|
569
|
-
|
|
570
|
-
|
|
573
|
+
var _useState2 = React.useState(false),
|
|
574
|
+
isTableLoading = _useState2[0],
|
|
575
|
+
setIsTableLoading = _useState2[1];
|
|
571
576
|
|
|
572
577
|
var _useState3 = React.useState(),
|
|
573
|
-
|
|
578
|
+
error = _useState3[0],
|
|
579
|
+
setError = _useState3[1];
|
|
574
580
|
|
|
575
|
-
var _useState4 = React.useState(
|
|
576
|
-
|
|
577
|
-
setTableData = _useState4[1];
|
|
581
|
+
var _useState4 = React.useState(),
|
|
582
|
+
setWidget = _useState4[1];
|
|
578
583
|
|
|
579
584
|
var _useState5 = React.useState([]),
|
|
580
|
-
|
|
581
|
-
|
|
585
|
+
tableData = _useState5[0],
|
|
586
|
+
setTableData = _useState5[1];
|
|
582
587
|
|
|
588
|
+
var _useState6 = React.useState([]),
|
|
589
|
+
tableColumns = _useState6[0],
|
|
590
|
+
setTableColumns = _useState6[1];
|
|
591
|
+
|
|
592
|
+
var _useState7 = React.useState(null),
|
|
593
|
+
sortField = _useState7[0],
|
|
594
|
+
setSortField = _useState7[1];
|
|
595
|
+
|
|
596
|
+
var _useState8 = React.useState(null),
|
|
597
|
+
sortOrder = _useState8[0],
|
|
598
|
+
setSortOrder = _useState8[1];
|
|
599
|
+
|
|
600
|
+
var isDefaultSortOptionsUsed = React.useRef(false);
|
|
583
601
|
React.useEffect(function () {
|
|
584
602
|
if (props.customChartProps && props.customChartProps.widget) {
|
|
585
603
|
setWidget(props.customChartProps.widget);
|
|
@@ -598,6 +616,7 @@ var TableChart = function TableChart(props) {
|
|
|
598
616
|
widget.onChange = undefined;
|
|
599
617
|
widget.PageIndex = 0;
|
|
600
618
|
widget.PageSize = 100;
|
|
619
|
+
widget.EntityId = !isNullOrUndefinedOrEmpty(widget.RelatedToEntityId) ? widget.RelatedToEntityId : widget.EntityId;
|
|
601
620
|
dashboardAnalyticsService.getTableData(widget).then(function (res) {
|
|
602
621
|
if (res && res.data) {
|
|
603
622
|
fillTableData(res.data);
|
|
@@ -634,6 +653,7 @@ var TableChart = function TableChart(props) {
|
|
|
634
653
|
|
|
635
654
|
if (tableData.Fields && tableData.Fields.length) {
|
|
636
655
|
setTableColumns([].concat(tableData.Fields));
|
|
656
|
+
setDefaultSortOptions(tableData.Fields);
|
|
637
657
|
}
|
|
638
658
|
|
|
639
659
|
if (tableData.Result && tableData.Result.length) {
|
|
@@ -655,6 +675,80 @@ var TableChart = function TableChart(props) {
|
|
|
655
675
|
setTableData([].concat(tableRecords));
|
|
656
676
|
};
|
|
657
677
|
|
|
678
|
+
var setDefaultSortOptions = function setDefaultSortOptions(tableCols) {
|
|
679
|
+
if (tableCols === void 0) {
|
|
680
|
+
tableCols = [];
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
if (isDefaultSortOptionsUsed && isDefaultSortOptionsUsed.current) return;
|
|
684
|
+
isDefaultSortOptionsUsed.current = true;
|
|
685
|
+
|
|
686
|
+
var _widget = props.customChartProps ? props.customChartProps.widget : null;
|
|
687
|
+
|
|
688
|
+
if (!_widget) return;
|
|
689
|
+
|
|
690
|
+
var _sortFieldCode = getSortFieldCodeBySortFieldId(_widget.DefaultSortBy, tableCols);
|
|
691
|
+
|
|
692
|
+
var _sortDirection = _widget.DefaultSortDirection ? _widget.DefaultSortDirection == 'asc' ? 1 : _widget.DefaultSortDirection == 'desc' ? -1 : 0 : null;
|
|
693
|
+
|
|
694
|
+
setSortField(_sortFieldCode);
|
|
695
|
+
setSortOrder(_sortDirection);
|
|
696
|
+
};
|
|
697
|
+
|
|
698
|
+
var getSortFieldCodeBySortFieldId = function getSortFieldCodeBySortFieldId(sortFieldId, tableCols) {
|
|
699
|
+
if (tableCols === void 0) {
|
|
700
|
+
tableCols = [];
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
if (!sortFieldId) return null;
|
|
704
|
+
var field = tableCols.find(function (col) {
|
|
705
|
+
return col.Id == sortFieldId;
|
|
706
|
+
});
|
|
707
|
+
return field ? field.FieldCode : null;
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
var getSortFieldIdBySortFieldCode = function getSortFieldIdBySortFieldCode(sortFieldCode) {
|
|
711
|
+
if (!sortFieldCode) return null;
|
|
712
|
+
var field = tableColumns.find(function (col) {
|
|
713
|
+
return col.FieldCode == sortFieldCode;
|
|
714
|
+
});
|
|
715
|
+
return field ? field.Id : null;
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
var sortTableData = function sortTableData(e) {
|
|
719
|
+
setSortField(e.sortField);
|
|
720
|
+
setSortOrder(e.sortOrder);
|
|
721
|
+
var _widget = props.customChartProps.widget;
|
|
722
|
+
var dashboardAnalyticsService = new DashboardAnalyticsService();
|
|
723
|
+
_widget.onChange = undefined;
|
|
724
|
+
_widget.PageIndex = 0;
|
|
725
|
+
_widget.PageSize = 100;
|
|
726
|
+
_widget.ScreenSortBy = getSortFieldIdBySortFieldCode(e.sortField);
|
|
727
|
+
_widget.ScreenSortDirection = e.sortOrder == 1 ? 'asc' : e.sortOrder == -1 ? 'desc' : null;
|
|
728
|
+
_widget.EntityId = !isNullOrUndefinedOrEmpty(_widget.RelatedToEntityId) ? _widget.RelatedToEntityId : _widget.EntityId;
|
|
729
|
+
setIsTableLoading(true);
|
|
730
|
+
dashboardAnalyticsService.getTableData(_widget).then(function (res) {
|
|
731
|
+
if (res && res.data) {
|
|
732
|
+
fillTableData(res.data);
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
setIsTableLoading(false);
|
|
736
|
+
})["catch"](function (error) {
|
|
737
|
+
var _error$response3, _error$response3$data, _error$response4, _error$response4$data;
|
|
738
|
+
|
|
739
|
+
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);
|
|
740
|
+
setIsTableLoading(false);
|
|
741
|
+
});
|
|
742
|
+
};
|
|
743
|
+
|
|
744
|
+
var canSort = function canSort() {
|
|
745
|
+
if (props.customChartProps) {
|
|
746
|
+
return !props.customChartProps.isInEditMode && !props.customChartProps.isPreviewModeActive;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
return false;
|
|
750
|
+
};
|
|
751
|
+
|
|
658
752
|
return isLoading ? React__default.createElement("div", {
|
|
659
753
|
className: 'dl-full-hight dl-flex-content-center spinner-custome'
|
|
660
754
|
}, React__default.createElement(progressspinner.ProgressSpinner, {
|
|
@@ -676,10 +770,15 @@ var TableChart = function TableChart(props) {
|
|
|
676
770
|
}), React__default.createElement("span", {
|
|
677
771
|
className: "dl-tooltiptext"
|
|
678
772
|
}, error))) : React__default.createElement(datatable.DataTable, {
|
|
773
|
+
loading: isTableLoading,
|
|
774
|
+
sortField: sortField,
|
|
775
|
+
sortOrder: sortOrder,
|
|
776
|
+
onSort: sortTableData,
|
|
679
777
|
value: tableData,
|
|
680
778
|
responsiveLayout: "scroll"
|
|
681
779
|
}, tableColumns.map(function (column$1, index) {
|
|
682
780
|
return React__default.createElement(column.Column, {
|
|
781
|
+
sortable: canSort(),
|
|
683
782
|
key: column$1.FieldCode + "_" + index,
|
|
684
783
|
field: column$1.FieldCode,
|
|
685
784
|
header: column$1.DisplayName
|
|
@@ -709,9 +808,25 @@ var CustomChart = function CustomChart(props) {
|
|
|
709
808
|
}
|
|
710
809
|
};
|
|
711
810
|
|
|
811
|
+
var drilldownToTableData = function drilldownToTableData() {
|
|
812
|
+
props.onSelectDataPoint({
|
|
813
|
+
GroupById: undefined,
|
|
814
|
+
MeasureFieldId: undefined,
|
|
815
|
+
MeasureCode: undefined,
|
|
816
|
+
Formula: undefined,
|
|
817
|
+
Widget: props.widget,
|
|
818
|
+
GroupByIdSec: undefined
|
|
819
|
+
});
|
|
820
|
+
};
|
|
821
|
+
|
|
712
822
|
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", {
|
|
823
|
+
className: "table-hint-container"
|
|
824
|
+
}, React__default.createElement("div", {
|
|
713
825
|
className: "table-rows-number-indicator"
|
|
714
|
-
}, "Showing the first 100 rows"), React__default.createElement("div", {
|
|
826
|
+
}, "Showing the first 100 rows"), !props.isInEditMode && !props.isPreviewModeActive && React__default.createElement("div", {
|
|
827
|
+
onClick: drilldownToTableData,
|
|
828
|
+
className: "show-more-records"
|
|
829
|
+
}, "( Show More Records )")), React__default.createElement("div", {
|
|
715
830
|
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"
|
|
716
831
|
}, project()));
|
|
717
832
|
};
|
|
@@ -1566,6 +1681,7 @@ var FusionChart = React.forwardRef(function (props, comRef) {
|
|
|
1566
1681
|
signal = updatedAxiosController === null || updatedAxiosController === void 0 ? void 0 : updatedAxiosController.signal;
|
|
1567
1682
|
}
|
|
1568
1683
|
|
|
1684
|
+
postWidget.EntityId = !isNullOrUndefinedOrEmpty(postWidget.RelatedToEntityId) ? postWidget.RelatedToEntityId : postWidget.EntityId;
|
|
1569
1685
|
dashboardAnalyticsService.getData(postWidget, signal).then(function (result) {
|
|
1570
1686
|
handleData(result === null || result === void 0 ? void 0 : result.data);
|
|
1571
1687
|
chartData.current = result === null || result === void 0 ? void 0 : result.data;
|
|
@@ -1864,6 +1980,7 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
|
|
|
1864
1980
|
|
|
1865
1981
|
if (isLoading || !((_widget$current4 = widget.current) !== null && _widget$current4 !== void 0 && _widget$current4.TypeCode)) return "";
|
|
1866
1982
|
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, {
|
|
1983
|
+
isInEditMode: props.isInEditMode,
|
|
1867
1984
|
isPreviewModeActive: props.isPreviewModeActive,
|
|
1868
1985
|
dataBinding: props.dataBinding,
|
|
1869
1986
|
widget: widget.current,
|