pace-table-lib 1.0.10 → 1.0.12
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.
|
@@ -8762,27 +8762,48 @@ function StaticTable({
|
|
|
8762
8762
|
if (rowIndex < fixedRowCount || columnIndex < fixedColCount) return null;
|
|
8763
8763
|
const rowIdxHeat = rowIndex - fixedRowCount;
|
|
8764
8764
|
const colIdxHeat = columnIndex - fixedColCount;
|
|
8765
|
-
|
|
8765
|
+
let pct;
|
|
8766
|
+
let innerDivBg = "none";
|
|
8767
|
+
if (isDataBarOn) {
|
|
8768
|
+
if (showDataBarValOnTooltip) {
|
|
8769
|
+
const val = dataBarMatrix[rowIdxHeat]?.[colIdxHeat];
|
|
8770
|
+
if (val !== void 0) pct = `${(val * 100).toFixed(2)}%`;
|
|
8771
|
+
}
|
|
8772
|
+
innerDivBg = getBgColorForDataBar(rowIdxHeat, colIdxHeat);
|
|
8773
|
+
}
|
|
8774
|
+
const parent = measuresBySlice[rowIdxHeat]?.sliceMark?.[0];
|
|
8775
|
+
const parentBg = parent ? parentBandColorMap[parent] : void 0;
|
|
8776
|
+
let outerDivBg = "none";
|
|
8777
|
+
if (ShowHeatMap) {
|
|
8778
|
+
outerDivBg = getBgColorForHetMap(rowIdxHeat, colIdxHeat);
|
|
8779
|
+
} else {
|
|
8780
|
+
outerDivBg = parentBg ?? dataColors.evenColor;
|
|
8781
|
+
}
|
|
8782
|
+
const baseStyle = {
|
|
8783
|
+
...style,
|
|
8784
|
+
...dataCellFont,
|
|
8785
|
+
background: outerDivBg
|
|
8786
|
+
};
|
|
8766
8787
|
const isLastRow = rowIndex === rowCount - 1;
|
|
8767
8788
|
const isLastCol = columnIndex === columnCount - 1;
|
|
8768
|
-
const val = dataBarMatrix[rowIdxHeat]?.[colIdxHeat];
|
|
8769
|
-
const pct = isDataBarOn && showDataBarValOnTooltip && val !== void 0 ? `${(val * 100).toFixed(2)}%` : void 0;
|
|
8770
|
-
const innerDivBg = isDataBarOn ? getBgColorForDataBar(rowIdxHeat, colIdxHeat) : "none";
|
|
8771
|
-
const parent = measuresBySlice[rowIdxHeat]?.sliceMark?.[0];
|
|
8772
|
-
const outerDivBg = ShowHeatMap ? getBgColorForHetMap(rowIdxHeat, colIdxHeat) : parent ? parentBandColorMap[parent] : dataColors.evenColor;
|
|
8773
|
-
const baseStyle = { ...style, ...dataCellFont, background: outerDivBg };
|
|
8774
8789
|
let rawValue;
|
|
8775
8790
|
let isBold = true;
|
|
8776
8791
|
const bgColorForTotals = getBgColorForCell(rowCount - fixedRowCount, dataColors);
|
|
8777
8792
|
if (isColTotalOn && isRowTotalOn && !headerAtStart && isLastRow && isLastCol) {
|
|
8778
8793
|
baseStyle.background = bgColorForTotals;
|
|
8779
|
-
rawValue =
|
|
8794
|
+
rawValue = grandTotal;
|
|
8795
|
+
if (DataField.hasOwnProperty("percentageBy") && DataField.percentageBy && DataField.percentageBy?.toLowerCase() !== "absolute") {
|
|
8796
|
+
rawValue = 1;
|
|
8797
|
+
}
|
|
8780
8798
|
} else if (isColTotalOn && !headerAtStart && isLastRow) {
|
|
8781
8799
|
baseStyle.background = bgColorForTotals;
|
|
8782
|
-
rawValue =
|
|
8800
|
+
rawValue = columnTotalRow[colIdxHeat]?.columnTotal;
|
|
8801
|
+
if (DataField.hasOwnProperty("percentageBy") && DataField.percentageBy && DataField.percentageBy?.toLowerCase() !== "absolute") {
|
|
8802
|
+
rawValue = 1;
|
|
8803
|
+
}
|
|
8783
8804
|
} else if (isRowTotalOn && !headerAtStart && isLastCol) {
|
|
8784
8805
|
rawValue = 1;
|
|
8785
|
-
} else if (
|
|
8806
|
+
} else if (DataField.hasOwnProperty("percentageBy") && DataField?.percentageBy && DataField.percentageBy?.toLowerCase() !== "absolute") {
|
|
8786
8807
|
if (DataField?.percentageBy === "Row-wise") {
|
|
8787
8808
|
rawValue = getPercentageBy(measuresBySlice[rowIdxHeat]?.measures?.[colIdxHeat], measuresBySlice[rowIdxHeat].rowTotal);
|
|
8788
8809
|
} else {
|
|
@@ -8794,23 +8815,39 @@ function StaticTable({
|
|
|
8794
8815
|
isBold = false;
|
|
8795
8816
|
}
|
|
8796
8817
|
if (rawValue === void 0) return null;
|
|
8797
|
-
const dimName = dimensionMarks[colIdxHeat]?.[fixedRowCount - 1];
|
|
8818
|
+
const dimName = dimensionMarks[colIdxHeat]?.[fixedRowCount - 1] ?? void 0;
|
|
8798
8819
|
const formattingObj = getMeasureFormattingObj(dimName);
|
|
8799
8820
|
const conditionalFormatObj = getConditionalFormat(rawValue, CONDITIONAL_FORMAT_FOR.VALUE);
|
|
8800
8821
|
const numberFormat = conditionalFormatObj?.numberFormat ?? formattingObj.numberFormat;
|
|
8801
8822
|
const decimalPrecision = conditionalFormatObj?.decimalPrecision ?? formattingObj.decimalPrecision;
|
|
8802
8823
|
const displayUnits = conditionalFormatObj?.displayUnits ?? formattingObj.displayUnits;
|
|
8803
|
-
let formattedValue = formatValue(
|
|
8804
|
-
|
|
8805
|
-
|
|
8824
|
+
let formattedValue = formatValue(
|
|
8825
|
+
rawValue,
|
|
8826
|
+
numberFormat,
|
|
8827
|
+
decimalPrecision,
|
|
8828
|
+
displayUnits
|
|
8829
|
+
);
|
|
8830
|
+
if (DataField.hasOwnProperty("percentageBy") && DataField?.percentageBy && DataField.percentageBy?.toLowerCase() !== "absolute") {
|
|
8831
|
+
formattedValue = formatValue(rawValue, VALUE_FORMAT_OBJ.PERCENT_SHORT);
|
|
8832
|
+
}
|
|
8833
|
+
let finalStyle = {
|
|
8806
8834
|
...baseStyle,
|
|
8807
|
-
fontWeight: isBold ? "bold" : "normal"
|
|
8808
|
-
...conditionalFormatObj?.fontFamily && { fontFamily: conditionalFormatObj.fontFamily },
|
|
8809
|
-
...conditionalFormatObj?.fontSize && { fontSize: conditionalFormatObj.fontSize },
|
|
8810
|
-
...conditionalFormatObj?.backgroundColor && { background: conditionalFormatObj.backgroundColor },
|
|
8811
|
-
...conditionalFormatObj?.color && { color: conditionalFormatObj.color }
|
|
8835
|
+
fontWeight: isBold ? "bold" : "normal"
|
|
8812
8836
|
};
|
|
8813
|
-
|
|
8837
|
+
if (conditionalFormatObj) {
|
|
8838
|
+
if (conditionalFormatObj.fontFamily) finalStyle.fontFamily = conditionalFormatObj.fontFamily;
|
|
8839
|
+
if (conditionalFormatObj.fontSize) finalStyle.fontSize = conditionalFormatObj.fontSize;
|
|
8840
|
+
if (conditionalFormatObj.backgroundColor) finalStyle.background = conditionalFormatObj.backgroundColor;
|
|
8841
|
+
if (conditionalFormatObj.color) finalStyle.color = conditionalFormatObj.color;
|
|
8842
|
+
}
|
|
8843
|
+
return renderDataCell(
|
|
8844
|
+
formattedValue,
|
|
8845
|
+
finalStyle,
|
|
8846
|
+
"data_div",
|
|
8847
|
+
"data_label_div",
|
|
8848
|
+
pct,
|
|
8849
|
+
innerDivBg
|
|
8850
|
+
);
|
|
8814
8851
|
};
|
|
8815
8852
|
function getBgColorForHetMap(rowIdx, colIdx) {
|
|
8816
8853
|
return heatColorMatrix[rowIdx][colIdx];
|