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
|
@@ -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
|
@@ -570,21 +570,34 @@ var TableChart = function TableChart(props) {
|
|
|
570
570
|
isLoading = _useState[0],
|
|
571
571
|
setIsLoading = _useState[1];
|
|
572
572
|
|
|
573
|
-
var _useState2 = React.useState(),
|
|
574
|
-
|
|
575
|
-
|
|
573
|
+
var _useState2 = React.useState(false),
|
|
574
|
+
isTableLoading = _useState2[0],
|
|
575
|
+
setIsTableLoading = _useState2[1];
|
|
576
576
|
|
|
577
577
|
var _useState3 = React.useState(),
|
|
578
|
-
|
|
578
|
+
error = _useState3[0],
|
|
579
|
+
setError = _useState3[1];
|
|
579
580
|
|
|
580
|
-
var _useState4 = React.useState(
|
|
581
|
-
|
|
582
|
-
setTableData = _useState4[1];
|
|
581
|
+
var _useState4 = React.useState(),
|
|
582
|
+
setWidget = _useState4[1];
|
|
583
583
|
|
|
584
584
|
var _useState5 = React.useState([]),
|
|
585
|
-
|
|
586
|
-
|
|
585
|
+
tableData = _useState5[0],
|
|
586
|
+
setTableData = _useState5[1];
|
|
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];
|
|
587
595
|
|
|
596
|
+
var _useState8 = React.useState(null),
|
|
597
|
+
sortOrder = _useState8[0],
|
|
598
|
+
setSortOrder = _useState8[1];
|
|
599
|
+
|
|
600
|
+
var isDefaultSortOptionsUsed = React.useRef(false);
|
|
588
601
|
React.useEffect(function () {
|
|
589
602
|
if (props.customChartProps && props.customChartProps.widget) {
|
|
590
603
|
setWidget(props.customChartProps.widget);
|
|
@@ -640,6 +653,7 @@ var TableChart = function TableChart(props) {
|
|
|
640
653
|
|
|
641
654
|
if (tableData.Fields && tableData.Fields.length) {
|
|
642
655
|
setTableColumns([].concat(tableData.Fields));
|
|
656
|
+
setDefaultSortOptions(tableData.Fields);
|
|
643
657
|
}
|
|
644
658
|
|
|
645
659
|
if (tableData.Result && tableData.Result.length) {
|
|
@@ -661,6 +675,80 @@ var TableChart = function TableChart(props) {
|
|
|
661
675
|
setTableData([].concat(tableRecords));
|
|
662
676
|
};
|
|
663
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
|
+
|
|
664
752
|
return isLoading ? React__default.createElement("div", {
|
|
665
753
|
className: 'dl-full-hight dl-flex-content-center spinner-custome'
|
|
666
754
|
}, React__default.createElement(progressspinner.ProgressSpinner, {
|
|
@@ -682,10 +770,15 @@ var TableChart = function TableChart(props) {
|
|
|
682
770
|
}), React__default.createElement("span", {
|
|
683
771
|
className: "dl-tooltiptext"
|
|
684
772
|
}, error))) : React__default.createElement(datatable.DataTable, {
|
|
773
|
+
loading: isTableLoading,
|
|
774
|
+
sortField: sortField,
|
|
775
|
+
sortOrder: sortOrder,
|
|
776
|
+
onSort: sortTableData,
|
|
685
777
|
value: tableData,
|
|
686
778
|
responsiveLayout: "scroll"
|
|
687
779
|
}, tableColumns.map(function (column$1, index) {
|
|
688
780
|
return React__default.createElement(column.Column, {
|
|
781
|
+
sortable: canSort(),
|
|
689
782
|
key: column$1.FieldCode + "_" + index,
|
|
690
783
|
field: column$1.FieldCode,
|
|
691
784
|
header: column$1.DisplayName
|
|
@@ -715,9 +808,25 @@ var CustomChart = function CustomChart(props) {
|
|
|
715
808
|
}
|
|
716
809
|
};
|
|
717
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
|
+
|
|
718
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", {
|
|
719
825
|
className: "table-rows-number-indicator"
|
|
720
|
-
}, "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", {
|
|
721
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"
|
|
722
831
|
}, project()));
|
|
723
832
|
};
|
|
@@ -1871,6 +1980,7 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
|
|
|
1871
1980
|
|
|
1872
1981
|
if (isLoading || !((_widget$current4 = widget.current) !== null && _widget$current4 !== void 0 && _widget$current4.TypeCode)) return "";
|
|
1873
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,
|
|
1874
1984
|
isPreviewModeActive: props.isPreviewModeActive,
|
|
1875
1985
|
dataBinding: props.dataBinding,
|
|
1876
1986
|
widget: widget.current,
|