logitude-dashboard-library 3.1.23 → 3.1.25
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 +31 -8
- package/dist/index.js +143 -6
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +143 -6
- package/dist/index.modern.js.map +1 -1
- package/dist/styles/dl-dashboard.scss +31 -8
- package/dist/types/widget.d.ts +2 -0
- package/package.json +1 -1
|
@@ -667,16 +667,32 @@ $dark-grey: #717585;
|
|
|
667
667
|
color: #292D30;
|
|
668
668
|
}
|
|
669
669
|
|
|
670
|
-
.dl-kpi-unit {
|
|
670
|
+
.dl-kpi-unit, .comparison-value-dl-kpi-unit {
|
|
671
671
|
font-family: 'Manrope';
|
|
672
672
|
font-style: normal;
|
|
673
673
|
font-weight: 600;
|
|
674
|
-
font-size: 20px;
|
|
675
674
|
line-height: 125%;
|
|
676
675
|
color: #292D30;
|
|
677
676
|
margin-left: 5px;
|
|
678
677
|
}
|
|
679
678
|
|
|
679
|
+
.dl-kpi-unit {
|
|
680
|
+
font-size: 20px;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
.comparison-value-dl-kpi-unit {
|
|
684
|
+
font-size: 12px;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
.table-cell {
|
|
688
|
+
display: flex;
|
|
689
|
+
width: 100%;
|
|
690
|
+
height: 100%;
|
|
691
|
+
padding: 0.5rem 1rem;
|
|
692
|
+
white-space: normal;
|
|
693
|
+
align-items: center;
|
|
694
|
+
}
|
|
695
|
+
|
|
680
696
|
.dl-kpi-abbreviationSymbol {
|
|
681
697
|
font-family: 'Manrope';
|
|
682
698
|
font-style: normal;
|
|
@@ -778,26 +794,29 @@ $dark-grey: #717585;
|
|
|
778
794
|
font-weight: bold;
|
|
779
795
|
font-size: 14px;
|
|
780
796
|
white-space: nowrap;
|
|
797
|
+
padding: 0px !important;
|
|
798
|
+
|
|
799
|
+
.p-column-header-content {
|
|
800
|
+
padding: 0;
|
|
801
|
+
}
|
|
781
802
|
|
|
782
803
|
.p-column-title {
|
|
783
804
|
font-weight: bold !important;
|
|
784
|
-
font-size: 14px
|
|
785
|
-
|
|
786
|
-
.pi {
|
|
787
|
-
font-size: 14px !important;
|
|
788
|
-
}
|
|
805
|
+
font-size: 14px;
|
|
806
|
+
flex: 1;
|
|
789
807
|
}
|
|
790
808
|
|
|
791
809
|
.header-content {
|
|
792
810
|
display: flex;
|
|
793
811
|
align-items: center;
|
|
794
812
|
cursor: pointer;
|
|
813
|
+
padding: 1rem 1rem;
|
|
795
814
|
}
|
|
796
815
|
}
|
|
797
816
|
|
|
798
817
|
td {
|
|
799
818
|
border: 1px solid #ddd;
|
|
800
|
-
padding:
|
|
819
|
+
padding: 0px !important;
|
|
801
820
|
max-width: 1px;
|
|
802
821
|
height: 36px;
|
|
803
822
|
min-width: 140px;
|
|
@@ -836,6 +855,10 @@ $dark-grey: #717585;
|
|
|
836
855
|
}
|
|
837
856
|
}
|
|
838
857
|
|
|
858
|
+
.header-content > .p-column-title > .pi::before {
|
|
859
|
+
font-size: inherit !important;
|
|
860
|
+
}
|
|
861
|
+
|
|
839
862
|
.margin-auto {
|
|
840
863
|
margin: auto;
|
|
841
864
|
}
|
package/dist/index.js
CHANGED
|
@@ -441,7 +441,7 @@ var KpiChart = function KpiChart(props) {
|
|
|
441
441
|
color: getKPIFormattingPropertyValue("ComparisonValueFontColor"),
|
|
442
442
|
fontSize: getKPIFormattingPropertyValue("ComparisonValueFontSize", "px")
|
|
443
443
|
},
|
|
444
|
-
className: "dl-kpi-unit"
|
|
444
|
+
className: "comparison-value-dl-kpi-unit"
|
|
445
445
|
}, data === null || data === void 0 ? void 0 : data.Unit));
|
|
446
446
|
}
|
|
447
447
|
|
|
@@ -580,6 +580,7 @@ var TableChart = function TableChart(props) {
|
|
|
580
580
|
setError = _useState3[1];
|
|
581
581
|
|
|
582
582
|
var _useState4 = React.useState(),
|
|
583
|
+
widget = _useState4[0],
|
|
583
584
|
setWidget = _useState4[1];
|
|
584
585
|
|
|
585
586
|
var _useState5 = React.useState([]),
|
|
@@ -599,11 +600,22 @@ var TableChart = function TableChart(props) {
|
|
|
599
600
|
setSortOrder = _useState8[1];
|
|
600
601
|
|
|
601
602
|
var isDefaultSortOptionsUsed = React.useRef(false);
|
|
603
|
+
var widgetRefData = React.useRef(null);
|
|
602
604
|
React.useEffect(function () {
|
|
605
|
+
var _props$customChartPro;
|
|
606
|
+
|
|
603
607
|
if (props.customChartProps && props.customChartProps.widget) {
|
|
604
608
|
setWidget(props.customChartProps.widget);
|
|
609
|
+
widgetRefData.current = props.customChartProps.widget;
|
|
605
610
|
getTableData(props.customChartProps.widget);
|
|
606
611
|
}
|
|
612
|
+
|
|
613
|
+
(_props$customChartPro = props.customChartProps.dataBinding) === null || _props$customChartPro === void 0 ? void 0 : _props$customChartPro.widgetUpdated.subscribe(function (updatedWidget) {
|
|
614
|
+
var _widgetRefData$curren;
|
|
615
|
+
|
|
616
|
+
if ((updatedWidget === null || updatedWidget === void 0 ? void 0 : updatedWidget.key) != ((_widgetRefData$curren = widgetRefData.current) === null || _widgetRefData$curren === void 0 ? void 0 : _widgetRefData$curren.key)) return;
|
|
617
|
+
setWidget(_extends({}, updatedWidget));
|
|
618
|
+
});
|
|
607
619
|
}, []);
|
|
608
620
|
|
|
609
621
|
var getTableData = function getTableData(widget) {
|
|
@@ -753,9 +765,110 @@ var TableChart = function TableChart(props) {
|
|
|
753
765
|
return false;
|
|
754
766
|
};
|
|
755
767
|
|
|
768
|
+
var getTableFormattingData = function getTableFormattingData() {
|
|
769
|
+
return widget && isNullOrUndefinedOrEmpty(widget.TableFormatSettings) ? {} : JSON.parse(widget === null || widget === void 0 ? void 0 : widget.TableFormatSettings);
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
var getTableFormattingPropertyValue = function getTableFormattingPropertyValue(propertyName, unit) {
|
|
773
|
+
if (unit === void 0) {
|
|
774
|
+
unit = "";
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
var tableFormattingData = getTableFormattingData();
|
|
778
|
+
return tableFormattingData && tableFormattingData[propertyName] ? tableFormattingData[propertyName] + unit : undefined;
|
|
779
|
+
};
|
|
780
|
+
|
|
781
|
+
var getTableConditionalRulesData = function getTableConditionalRulesData() {
|
|
782
|
+
return widget && isNullOrUndefinedOrEmpty(widget.TableConditionalRules) ? [] : JSON.parse(widget === null || widget === void 0 ? void 0 : widget.TableConditionalRules);
|
|
783
|
+
};
|
|
784
|
+
|
|
785
|
+
var isValueEmpty = function isValueEmpty(val) {
|
|
786
|
+
return val === null || val === undefined || val === "";
|
|
787
|
+
};
|
|
788
|
+
|
|
789
|
+
var IsValidRule = function IsValidRule(rule, value) {
|
|
790
|
+
var operator = rule && rule.RuleOperator ? rule.RuleOperator.Code : null;
|
|
791
|
+
if (!operator) return null;
|
|
792
|
+
var ruleValue1 = rule.RuleValue1;
|
|
793
|
+
var ruleValue2 = rule.RuleValue2;
|
|
794
|
+
|
|
795
|
+
switch (operator) {
|
|
796
|
+
case "Equal":
|
|
797
|
+
return ruleValue1 == value;
|
|
798
|
+
|
|
799
|
+
case "NotEqual":
|
|
800
|
+
return ruleValue1 != value;
|
|
801
|
+
|
|
802
|
+
case "Between":
|
|
803
|
+
return !isValueEmpty(ruleValue1) && !isValueEmpty(ruleValue2) && ruleValue1 <= value && value <= ruleValue2;
|
|
804
|
+
|
|
805
|
+
case "GreaterThan":
|
|
806
|
+
return !isValueEmpty(ruleValue1) && value > ruleValue1;
|
|
807
|
+
|
|
808
|
+
case "GreaterThanOrEqual":
|
|
809
|
+
return !isValueEmpty(ruleValue1) && value >= ruleValue1;
|
|
810
|
+
|
|
811
|
+
case "LessThan":
|
|
812
|
+
return !isValueEmpty(ruleValue1) && value < ruleValue1;
|
|
813
|
+
|
|
814
|
+
case "LessThanOrEqual":
|
|
815
|
+
return !isValueEmpty(ruleValue1) && value <= ruleValue1;
|
|
816
|
+
|
|
817
|
+
case "IsEmpty":
|
|
818
|
+
return isValueEmpty(value);
|
|
819
|
+
|
|
820
|
+
case "IsNotEmpty":
|
|
821
|
+
return !isValueEmpty(value);
|
|
822
|
+
|
|
823
|
+
default:
|
|
824
|
+
return null;
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
|
|
828
|
+
var getCellPropertyByRule = function getCellPropertyByRule(column, cellValue, propertyName, defaultValue) {
|
|
829
|
+
if (propertyName === void 0) {
|
|
830
|
+
propertyName = 'RuleFontColor';
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
if (defaultValue === void 0) {
|
|
834
|
+
defaultValue = null;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
var tableFormattingData = getTableConditionalRulesData();
|
|
838
|
+
var columnData = tableFormattingData.find(function (el) {
|
|
839
|
+
return el.FieldId == column.Id;
|
|
840
|
+
});
|
|
841
|
+
|
|
842
|
+
if (!columnData || !columnData.FieldRules || columnData.FieldRules.length == 0) {
|
|
843
|
+
return defaultValue ? getTableFormattingPropertyValue(defaultValue) : undefined;
|
|
844
|
+
}
|
|
845
|
+
var firstValidRule = columnData.FieldRules.find(function (rule) {
|
|
846
|
+
return IsValidRule(rule, cellValue);
|
|
847
|
+
});
|
|
848
|
+
|
|
849
|
+
if (!firstValidRule) {
|
|
850
|
+
return defaultValue ? getTableFormattingPropertyValue(defaultValue) : undefined;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
return !isNullOrUndefinedOrEmpty(firstValidRule[propertyName]) ? firstValidRule[propertyName] : defaultValue ? getTableFormattingPropertyValue(defaultValue) : undefined;
|
|
854
|
+
};
|
|
855
|
+
|
|
756
856
|
var cellTemplateBody = function cellTemplateBody(data, column) {
|
|
757
857
|
if (!column || !column.FieldCode) return "";
|
|
758
|
-
return column.DataTypeCode == "DateTime" || column.DataTypeCode == "Date" ?
|
|
858
|
+
return column.DataTypeCode == "DateTime" || column.DataTypeCode == "Date" ? React__default.createElement("span", {
|
|
859
|
+
className: "table-cell",
|
|
860
|
+
style: {
|
|
861
|
+
color: getTableFormattingPropertyValue("TableCellFontColor"),
|
|
862
|
+
fontSize: getTableFormattingPropertyValue("TableCellFontSize", "px")
|
|
863
|
+
}
|
|
864
|
+
}, getDateTimeValue(data[column.FieldCode])) : React__default.createElement("span", {
|
|
865
|
+
className: "table-cell",
|
|
866
|
+
style: {
|
|
867
|
+
color: getCellPropertyByRule(column, data[column.FieldCode], 'RuleFontColor', 'TableCellFontColor'),
|
|
868
|
+
backgroundColor: getCellPropertyByRule(column, data[column.FieldCode], 'RuleBackgroundColor'),
|
|
869
|
+
fontSize: getTableFormattingPropertyValue("TableCellFontSize", "px")
|
|
870
|
+
}
|
|
871
|
+
}, data[column.FieldCode]);
|
|
759
872
|
};
|
|
760
873
|
|
|
761
874
|
var headerTemplate = function headerTemplate(column) {
|
|
@@ -763,15 +876,27 @@ var TableChart = function TableChart(props) {
|
|
|
763
876
|
|
|
764
877
|
if (sortField != column.FieldCode) {
|
|
765
878
|
return React__default.createElement("div", {
|
|
879
|
+
style: {
|
|
880
|
+
backgroundColor: getTableFormattingPropertyValue("TableHeaderBackgroundColor")
|
|
881
|
+
},
|
|
766
882
|
onClick: function onClick() {
|
|
767
883
|
return sortTableData(column.FieldCode);
|
|
768
884
|
},
|
|
769
885
|
className: "header-content"
|
|
770
886
|
}, React__default.createElement("span", {
|
|
887
|
+
style: {
|
|
888
|
+
color: getTableFormattingPropertyValue("TableHeaderFontColor"),
|
|
889
|
+
fontSize: getTableFormattingPropertyValue("TableHeaderFontSize", "px")
|
|
890
|
+
},
|
|
771
891
|
className: "p-column-title"
|
|
772
|
-
}, column.DisplayName
|
|
892
|
+
}, column.DisplayName, canSort() && React__default.createElement("span", {
|
|
893
|
+
style: {
|
|
894
|
+
fontSize: getTableFormattingPropertyValue("TableHeaderFontSize", "px"),
|
|
895
|
+
width: getTableFormattingPropertyValue("TableHeaderFontSize", "px"),
|
|
896
|
+
height: getTableFormattingPropertyValue("TableHeaderFontSize", "px")
|
|
897
|
+
},
|
|
773
898
|
className: "p-sortable-column-icon p-ml-2 pi pi-fw pi-sort-alt"
|
|
774
|
-
}));
|
|
899
|
+
})));
|
|
775
900
|
}
|
|
776
901
|
|
|
777
902
|
if (sortOrder == 1) {
|
|
@@ -783,15 +908,27 @@ var TableChart = function TableChart(props) {
|
|
|
783
908
|
}
|
|
784
909
|
|
|
785
910
|
return React__default.createElement("div", {
|
|
911
|
+
style: {
|
|
912
|
+
backgroundColor: getTableFormattingPropertyValue("TableHeaderBackgroundColor")
|
|
913
|
+
},
|
|
786
914
|
onClick: function onClick() {
|
|
787
915
|
return sortTableData(column.FieldCode);
|
|
788
916
|
},
|
|
789
917
|
className: "header-content"
|
|
790
918
|
}, React__default.createElement("span", {
|
|
919
|
+
style: {
|
|
920
|
+
color: getTableFormattingPropertyValue("TableHeaderFontColor"),
|
|
921
|
+
fontSize: getTableFormattingPropertyValue("TableHeaderFontSize", "px")
|
|
922
|
+
},
|
|
791
923
|
className: "p-column-title"
|
|
792
|
-
}, column.DisplayName
|
|
924
|
+
}, column.DisplayName, canSort() && React__default.createElement("span", {
|
|
925
|
+
style: {
|
|
926
|
+
fontSize: getTableFormattingPropertyValue("TableHeaderFontSize", "px"),
|
|
927
|
+
width: getTableFormattingPropertyValue("TableHeaderFontSize", "px"),
|
|
928
|
+
height: getTableFormattingPropertyValue("TableHeaderFontSize", "px")
|
|
929
|
+
},
|
|
793
930
|
className: sortClassIcon
|
|
794
|
-
}));
|
|
931
|
+
})));
|
|
795
932
|
};
|
|
796
933
|
|
|
797
934
|
return isLoading ? React__default.createElement("div", {
|