pace-table-lib 1.0.70 → 1.0.72
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.
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { MeasureFormatObj, TableStyleConfig } from "../StaticTable/StaticTableTypeDec.types";
|
|
2
2
|
import { BgColorPair, ParsedMeasureInfo } from "./PivotTable.types";
|
|
3
|
-
export declare const NO_ENTRY_TOKENS: string[];
|
|
4
3
|
/** Linearly interpolates between two hex colors by factor [0,1] */
|
|
5
4
|
export declare const interpolateColor: (minColor: string, maxColor: string, factor: number) => string;
|
|
6
5
|
/** Maps a value in [minValue, maxValue] to an interpolated RGB color string */
|
|
@@ -8172,8 +8172,8 @@ function formatValue(value, format, decimalValues = 2, displayUnit = DISPLAY_UNI
|
|
|
8172
8172
|
[VALUE_FORMAT_OBJ.CURRENCY_EUR_SHORT]: { currency: "EUR", locale: "en-US" },
|
|
8173
8173
|
[VALUE_FORMAT_OBJ.CURRENCY_CAD]: { currency: "CAD", locale: "en-US" },
|
|
8174
8174
|
[VALUE_FORMAT_OBJ.CURRENCY_CAD_SHORT]: { currency: "CAD", locale: "en-US" },
|
|
8175
|
-
[VALUE_FORMAT_OBJ.CURRENCY_CHF]: { currency: "CHF", locale: "
|
|
8176
|
-
[VALUE_FORMAT_OBJ.CURRENCY_CHF_SHORT]: { currency: "CHF", locale: "
|
|
8175
|
+
[VALUE_FORMAT_OBJ.CURRENCY_CHF]: { currency: "CHF", locale: "en-IN" },
|
|
8176
|
+
[VALUE_FORMAT_OBJ.CURRENCY_CHF_SHORT]: { currency: "CHF", locale: "en-IN" }
|
|
8177
8177
|
};
|
|
8178
8178
|
if (currencyMap[format]) {
|
|
8179
8179
|
const { currency, locale } = currencyMap[format];
|
|
@@ -18819,7 +18819,6 @@ function StaticTable({
|
|
|
18819
18819
|
)
|
|
18820
18820
|
] });
|
|
18821
18821
|
}
|
|
18822
|
-
const NO_ENTRY_TOKENS = ["nolegendentryrow", "nocolentry"];
|
|
18823
18822
|
function hexToRgb(hex) {
|
|
18824
18823
|
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
18825
18824
|
return result ? {
|
|
@@ -18868,7 +18867,6 @@ function getRowDisplayName(segments, measureValue) {
|
|
|
18868
18867
|
for (let i = segments.length - 1; i >= 0; i--) {
|
|
18869
18868
|
const seg = segments[i];
|
|
18870
18869
|
if (seg && seg !== "!subtotal") {
|
|
18871
|
-
if (NO_ENTRY_TOKENS.includes(seg.toLowerCase())) return measureValue;
|
|
18872
18870
|
if (seg.includes("~$~")) {
|
|
18873
18871
|
return seg.split("~$~")[1]?.trim() ?? seg;
|
|
18874
18872
|
}
|
|
@@ -19036,7 +19034,7 @@ const PivotTable = ({
|
|
|
19036
19034
|
const isRowTotalOn = tableStyleProps?.DataField?.RowTotal;
|
|
19037
19035
|
const isRowHeaderVisible = !RowHeader?.HideRowHeader;
|
|
19038
19036
|
const isColHeaderVisible = !ColumnHeader?.HideColumnHeader;
|
|
19039
|
-
|
|
19037
|
+
Table2?.colOrRowHeaderName;
|
|
19040
19038
|
const isConditionalFormatOn = Table2?.ConditionalformattingOnOff;
|
|
19041
19039
|
const conditionalFormatArr = Table2?.Conditionalformatting;
|
|
19042
19040
|
const conditionalFormatsByType = useMemo(() => {
|
|
@@ -19086,10 +19084,7 @@ const PivotTable = ({
|
|
|
19086
19084
|
}
|
|
19087
19085
|
}
|
|
19088
19086
|
return rh?.map((rowPath, i) => {
|
|
19089
|
-
const
|
|
19090
|
-
(t) => rowPath.toLowerCase().includes(t)
|
|
19091
|
-
);
|
|
19092
|
-
const segments = isNoEntry ? [measureValue] : parseRowPath(rowPath);
|
|
19087
|
+
const segments = parseRowPath(rowPath);
|
|
19093
19088
|
const isSubtotal = segments.includes("!subtotal");
|
|
19094
19089
|
const nonSubSegs = segments?.filter((s) => s !== "!subtotal");
|
|
19095
19090
|
const lastSeg = nonSubSegs[nonSubSegs.length - 1] ?? "";
|
|
@@ -19105,7 +19100,7 @@ const PivotTable = ({
|
|
|
19105
19100
|
rowPath,
|
|
19106
19101
|
segments,
|
|
19107
19102
|
depth: 0,
|
|
19108
|
-
name:
|
|
19103
|
+
name: getRowDisplayName(segments),
|
|
19109
19104
|
measureIndex,
|
|
19110
19105
|
measureName,
|
|
19111
19106
|
isSubtotal,
|
|
@@ -19127,10 +19122,7 @@ const PivotTable = ({
|
|
|
19127
19122
|
const isSubtotal = parts[parts.length - 1] === "!subtotal";
|
|
19128
19123
|
const cleanedParts = parts?.filter((p) => p !== "!subtotal")?.map((p) => {
|
|
19129
19124
|
if (p.includes("~$~")) return p.split("~$~")[1]?.trim() ?? p;
|
|
19130
|
-
|
|
19131
|
-
(t) => p.toLowerCase().includes(t)
|
|
19132
|
-
);
|
|
19133
|
-
return isNoEntry ? "" : p;
|
|
19125
|
+
return p;
|
|
19134
19126
|
});
|
|
19135
19127
|
const year = cleanedParts[0] ?? `__col_${i}__`;
|
|
19136
19128
|
const measureDisplay = (cleanedParts && cleanedParts[cleanedParts.length - 1]) ?? year;
|
|
@@ -19390,88 +19382,42 @@ const PivotTable = ({
|
|
|
19390
19382
|
[isSparkLineActive, isFitTableOn, colCellWidth, Table2.FixHeaderWidth]
|
|
19391
19383
|
);
|
|
19392
19384
|
const getSparkLineStyleObj = useCallback(
|
|
19393
|
-
(
|
|
19385
|
+
() => {
|
|
19394
19386
|
const slStyle = structuredClone(DEFAULT_SL_STYLE);
|
|
19395
|
-
|
|
19396
|
-
|
|
19397
|
-
|
|
19398
|
-
|
|
19399
|
-
|
|
19400
|
-
|
|
19401
|
-
|
|
19402
|
-
|
|
19403
|
-
|
|
19404
|
-
|
|
19405
|
-
|
|
19406
|
-
|
|
19407
|
-
|
|
19408
|
-
|
|
19409
|
-
|
|
19410
|
-
|
|
19411
|
-
|
|
19412
|
-
|
|
19413
|
-
|
|
19414
|
-
|
|
19415
|
-
|
|
19416
|
-
|
|
19417
|
-
|
|
19418
|
-
|
|
19419
|
-
|
|
19420
|
-
|
|
19421
|
-
|
|
19422
|
-
|
|
19423
|
-
|
|
19424
|
-
|
|
19425
|
-
if (SparkLine?.BoxFillColor)
|
|
19426
|
-
slStyle.boxFillColor = SparkLine.BoxFillColor;
|
|
19427
|
-
if (SparkLine?.BoxBorderColor)
|
|
19428
|
-
slStyle.boxLineColor = SparkLine.BoxBorderColor;
|
|
19429
|
-
if (SparkLine?.MinMaxLineColor)
|
|
19430
|
-
slStyle.whiskerColor = SparkLine.MinMaxLineColor;
|
|
19431
|
-
break;
|
|
19432
|
-
case SL_TYPE.TRISTATE:
|
|
19433
|
-
if (SparkLine?.PositiveBarChartColor)
|
|
19434
|
-
slStyle.posBarColor = SparkLine.PositiveBarChartColor;
|
|
19435
|
-
if (SparkLine?.NegativeBarChartColor)
|
|
19436
|
-
slStyle.negBarColor = SparkLine.NegativeBarChartColor;
|
|
19437
|
-
if (SparkLine?.ZeroBarChartColor)
|
|
19438
|
-
slStyle.zeroBarColor = SparkLine.ZeroBarChartColor;
|
|
19439
|
-
if (SparkLine?.BarWidth) slStyle.barWidth = SparkLine.BarWidth;
|
|
19440
|
-
if (SparkLine?.BarSpacing) slStyle.barSpacing = SparkLine.BarSpacing;
|
|
19441
|
-
break;
|
|
19442
|
-
case SL_TYPE.PIE:
|
|
19443
|
-
if (SparkLine?.SparkLineColor)
|
|
19444
|
-
slStyle.lineColor = SparkLine.SparkLineColor;
|
|
19445
|
-
if (SparkLine?.SparkLineWidth)
|
|
19446
|
-
slStyle.lineWidth = SparkLine.SparkLineWidth;
|
|
19447
|
-
if (SparkLine?.SparkLineMarkerColor)
|
|
19448
|
-
slStyle.spotColor = SparkLine.SparkLineMarkerColor;
|
|
19449
|
-
break;
|
|
19450
|
-
}
|
|
19387
|
+
if (SparkLine?.SparkLineColor)
|
|
19388
|
+
slStyle.lineColor = SparkLine.SparkLineColor;
|
|
19389
|
+
if (SparkLine?.SparkLineWidth)
|
|
19390
|
+
slStyle.lineWidth = SparkLine.SparkLineWidth;
|
|
19391
|
+
if (SparkLine?.HideMarkerButton !== void 0)
|
|
19392
|
+
slStyle.hideMarkerButton = SparkLine.HideMarkerButton;
|
|
19393
|
+
if (SparkLine?.SparkLineMarkerColor)
|
|
19394
|
+
slStyle.spotColor = SparkLine.SparkLineMarkerColor;
|
|
19395
|
+
if (SparkLine?.PositiveBarChartColor)
|
|
19396
|
+
slStyle.posBarColor = SparkLine.PositiveBarChartColor;
|
|
19397
|
+
if (SparkLine?.NegativeBarChartColor)
|
|
19398
|
+
slStyle.negBarColor = SparkLine.NegativeBarChartColor;
|
|
19399
|
+
if (SparkLine?.ZeroBarChartColor)
|
|
19400
|
+
slStyle.zeroColor = SparkLine.ZeroBarChartColor;
|
|
19401
|
+
if (SparkLine?.BarWidth)
|
|
19402
|
+
slStyle.barWidth = SparkLine.BarWidth;
|
|
19403
|
+
if (SparkLine?.BarSpacing)
|
|
19404
|
+
slStyle.barSpacing = SparkLine.BarSpacing;
|
|
19405
|
+
if (SparkLine?.ThresholdValue !== void 0)
|
|
19406
|
+
slStyle.thresholdValue = SparkLine.ThresholdValue;
|
|
19407
|
+
if (SparkLine?.ThresholdColor)
|
|
19408
|
+
slStyle.thresholdColor = SparkLine.ThresholdColor;
|
|
19409
|
+
if (SparkLine?.MedianColor)
|
|
19410
|
+
slStyle.medianColor = SparkLine.MedianColor;
|
|
19411
|
+
if (SparkLine?.BoxFillColor)
|
|
19412
|
+
slStyle.boxFillColor = SparkLine.BoxFillColor;
|
|
19413
|
+
if (SparkLine?.BoxBorderColor)
|
|
19414
|
+
slStyle.boxLineColor = SparkLine.BoxBorderColor;
|
|
19415
|
+
if (SparkLine?.MinMaxLineColor)
|
|
19416
|
+
slStyle.whiskerColor = SparkLine.MinMaxLineColor;
|
|
19451
19417
|
return slStyle;
|
|
19452
19418
|
},
|
|
19453
19419
|
[SparkLine]
|
|
19454
19420
|
);
|
|
19455
|
-
useCallback(
|
|
19456
|
-
(dataArr, containerStyle) => {
|
|
19457
|
-
if (!isSparkLineActive) return null;
|
|
19458
|
-
const lineType = SPARK_LINE_TYPE_MAPPING[SparkLine.SparkLineType];
|
|
19459
|
-
const slPropData = {
|
|
19460
|
-
dataArr,
|
|
19461
|
-
slStyle: getSparkLineStyleObj(lineType),
|
|
19462
|
-
slType: lineType
|
|
19463
|
-
};
|
|
19464
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "spark_line_div", style: { ...containerStyle }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
19465
|
-
JQuerySparkLine,
|
|
19466
|
-
{
|
|
19467
|
-
width: Number(containerStyle.width) - 4,
|
|
19468
|
-
height: Number(containerStyle.height) - 4,
|
|
19469
|
-
slPropData
|
|
19470
|
-
}
|
|
19471
|
-
) });
|
|
19472
|
-
},
|
|
19473
|
-
[isSparkLineActive, SparkLine, getSparkLineStyleObj]
|
|
19474
|
-
);
|
|
19475
19421
|
const renderSparkLineDataCell = useCallback(
|
|
19476
19422
|
(row, rowIdx) => {
|
|
19477
19423
|
if (!isSparkLineActive) return null;
|
|
@@ -19491,7 +19437,7 @@ const PivotTable = ({
|
|
|
19491
19437
|
const lineType = SPARK_LINE_TYPE_MAPPING[SparkLine.SparkLineType];
|
|
19492
19438
|
const slPropData = {
|
|
19493
19439
|
dataArr,
|
|
19494
|
-
slStyle: getSparkLineStyleObj(
|
|
19440
|
+
slStyle: getSparkLineStyleObj(),
|
|
19495
19441
|
slType: lineType
|
|
19496
19442
|
};
|
|
19497
19443
|
const isLastRow = rowIdx === visibleRows.length - 1;
|
|
@@ -19647,11 +19593,7 @@ const PivotTable = ({
|
|
|
19647
19593
|
"column header"
|
|
19648
19594
|
);
|
|
19649
19595
|
let displayLabel = col.isSubtotal ? col.levels[col.levels.length - 1] ?? "" : col.levels?.[col.levels.length - 1] ?? col.measureDisplay;
|
|
19650
|
-
if (
|
|
19651
|
-
(t) => tableData?.rowHeaders?.[0]?.toLowerCase().includes(t)
|
|
19652
|
-
) && measureFormatConfigs?.[0]?.measureName) {
|
|
19653
|
-
displayLabel = measureFormatConfigs[0].measureName;
|
|
19654
|
-
} else if (tableStyleProps?.ColumnDateFormat) {
|
|
19596
|
+
if (tableStyleProps?.ColumnDateFormat) {
|
|
19655
19597
|
const parts = col.path.split("`");
|
|
19656
19598
|
const lastPart = parts[parts.length - 1];
|
|
19657
19599
|
if (tableStyleProps?.ColumnDateFormat?.[0] && (col.path == col.measureDisplay || col.isSubtotal)) {
|
|
@@ -19753,11 +19695,7 @@ const PivotTable = ({
|
|
|
19753
19695
|
const shouldWrap = Table2?.RowWrapText;
|
|
19754
19696
|
const rowConFormat = getConditionalFormat(row.name, "row header");
|
|
19755
19697
|
let displayLabel = row.name;
|
|
19756
|
-
if (
|
|
19757
|
-
(t) => tableData?.columnHeaders?.[0]?.toLowerCase().includes(t)
|
|
19758
|
-
) && measureFormatConfigs?.[0]?.measureName) {
|
|
19759
|
-
displayLabel = measureFormatConfigs[0].measureName;
|
|
19760
|
-
} else if (tableStyleProps?.RowDateFormat) {
|
|
19698
|
+
if (tableStyleProps?.RowDateFormat) {
|
|
19761
19699
|
if (tableStyleProps?.RowDateFormat?.[0] && (row.name === row.segments[0] || row.isSubtotal)) {
|
|
19762
19700
|
displayLabel = applyDateFormat(
|
|
19763
19701
|
row.name,
|