pace-table-lib 1.0.16 → 1.0.18
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.
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
}
|
|
12
12
|
})();
|
|
13
13
|
import * as React from "react";
|
|
14
|
-
import React__default, { cloneElement, useRef, useMemo } from "react";
|
|
14
|
+
import React__default, { cloneElement, useRef, useMemo, useEffect } from "react";
|
|
15
15
|
function getDefaultExportFromCjs(x) {
|
|
16
16
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
17
17
|
}
|
|
@@ -8299,6 +8299,8 @@ function StaticTable({
|
|
|
8299
8299
|
const rowColors = getBgColor(RowHeader, "row");
|
|
8300
8300
|
const colColors = getBgColor(ColumnHeader, "column");
|
|
8301
8301
|
const dataColors = getBgColor(DataField, "dataField");
|
|
8302
|
+
const isColHeaderVisible = !ColumnHeader?.HideColumnHeader;
|
|
8303
|
+
const isRowHeaderVisible = !RowHeader?.HideRowHeader;
|
|
8302
8304
|
const rowHeaderFont = useMemo(() => ({
|
|
8303
8305
|
color: RowHeader.RowHeaderColor,
|
|
8304
8306
|
fontFamily: RowHeader.RowHeaderFontFamily,
|
|
@@ -8327,10 +8329,16 @@ function StaticTable({
|
|
|
8327
8329
|
HeatMapMaxColor
|
|
8328
8330
|
} = HeatMap || {};
|
|
8329
8331
|
const fixedRowCount = useMemo(() => {
|
|
8332
|
+
if (!isColHeaderVisible) {
|
|
8333
|
+
return headerAtStart && isColTotalOn ? 1 : 0;
|
|
8334
|
+
}
|
|
8330
8335
|
const base = Math.max(...dimensionMarks.map((d) => d.length));
|
|
8331
8336
|
return base + (headerAtStart && isColTotalOn ? 1 : 0);
|
|
8332
8337
|
}, [dimensionMarks, headerAtStart, isColTotalOn]);
|
|
8333
8338
|
const fixedColCount = useMemo(() => {
|
|
8339
|
+
if (!isRowHeaderVisible) {
|
|
8340
|
+
return headerAtStart && isRowTotalOn ? 1 : 0;
|
|
8341
|
+
}
|
|
8334
8342
|
const base = leftFixedCellNameList ? leftFixedCellNameList.length : 1;
|
|
8335
8343
|
return base + (headerAtStart && isRowTotalOn ? 1 : 0);
|
|
8336
8344
|
}, [leftFixedCellNameList, headerAtStart, isRowTotalOn]);
|
|
@@ -8361,6 +8369,15 @@ function StaticTable({
|
|
|
8361
8369
|
return { cellHeight: Number(dynHeight), cellWidth: Number(dWidth), fixedColWidth: Number(fWidth) };
|
|
8362
8370
|
}, [isFitTableOn, columnCount, rowCount, fixedColCount, tableWidth, tableHeight]);
|
|
8363
8371
|
const gridRef = useRef(null);
|
|
8372
|
+
useEffect(() => {
|
|
8373
|
+
const t = setTimeout(() => {
|
|
8374
|
+
if (gridRef.current) {
|
|
8375
|
+
gridRef.current.recomputeGridSize();
|
|
8376
|
+
gridRef.current.forceUpdateGrids();
|
|
8377
|
+
}
|
|
8378
|
+
}, 0);
|
|
8379
|
+
return () => clearTimeout(t);
|
|
8380
|
+
}, [tableWidth, tableHeight, tableData, isFitTableOn]);
|
|
8364
8381
|
const conditionalFormatsByType = useMemo(() => {
|
|
8365
8382
|
const map = { value: [], "row header": [], "column header": [] };
|
|
8366
8383
|
conditionalFormatArr?.forEach((format) => {
|
|
@@ -8441,35 +8458,43 @@ function StaticTable({
|
|
|
8441
8458
|
borderTop: "none",
|
|
8442
8459
|
fontWeight: "bold"
|
|
8443
8460
|
};
|
|
8444
|
-
if (
|
|
8445
|
-
leftFixedCellNameList.
|
|
8446
|
-
|
|
8447
|
-
|
|
8461
|
+
if (isColHeaderVisible && isRowHeaderVisible) {
|
|
8462
|
+
if (leftFixedCellNameList && leftFixedCellNameList.length > 0) {
|
|
8463
|
+
leftFixedCellNameList.forEach((label, col) => {
|
|
8464
|
+
baseStyle.background = getBgColorForCell(col, colColors);
|
|
8465
|
+
const finalStyleForColumn = getFinalStyleObj(STYLE_FOR.COLUMN, baseStyle, label, col);
|
|
8466
|
+
cells.push({
|
|
8467
|
+
label,
|
|
8468
|
+
style: {
|
|
8469
|
+
...finalStyleForColumn,
|
|
8470
|
+
borderLeft: col === 0 ? BORDER_STYLE : "none",
|
|
8471
|
+
left: col * fixedColWidth
|
|
8472
|
+
},
|
|
8473
|
+
childClassName: "left_fixed_data_cell"
|
|
8474
|
+
});
|
|
8475
|
+
});
|
|
8476
|
+
} else {
|
|
8448
8477
|
cells.push({
|
|
8449
|
-
label,
|
|
8478
|
+
label: "",
|
|
8450
8479
|
style: {
|
|
8451
|
-
...
|
|
8452
|
-
borderLeft:
|
|
8453
|
-
left:
|
|
8480
|
+
...baseStyle,
|
|
8481
|
+
borderLeft: BORDER_STYLE,
|
|
8482
|
+
left: 0,
|
|
8483
|
+
background: getBgColorForCell(1, colColors)
|
|
8484
|
+
// or keep a default color
|
|
8454
8485
|
},
|
|
8455
8486
|
childClassName: "left_fixed_data_cell"
|
|
8456
8487
|
});
|
|
8457
|
-
}
|
|
8458
|
-
} else {
|
|
8459
|
-
cells.push({
|
|
8460
|
-
label: "",
|
|
8461
|
-
style: {
|
|
8462
|
-
...baseStyle,
|
|
8463
|
-
borderLeft: BORDER_STYLE,
|
|
8464
|
-
left: 0,
|
|
8465
|
-
background: getBgColorForCell(1, colColors)
|
|
8466
|
-
// or keep a default color
|
|
8467
|
-
},
|
|
8468
|
-
childClassName: "left_fixed_data_cell"
|
|
8469
|
-
});
|
|
8488
|
+
}
|
|
8470
8489
|
}
|
|
8471
8490
|
if (headerAtStart && isRowTotalOn) {
|
|
8472
|
-
|
|
8491
|
+
let colIndex = 1;
|
|
8492
|
+
if (leftFixedCellNameList) {
|
|
8493
|
+
colIndex = leftFixedCellNameList.length;
|
|
8494
|
+
}
|
|
8495
|
+
if (!isRowHeaderVisible) {
|
|
8496
|
+
colIndex = 0;
|
|
8497
|
+
}
|
|
8473
8498
|
baseStyle.background = getBgColorForCell(colIndex, colColors);
|
|
8474
8499
|
const finalStyleForColumn = getFinalStyleObj(STYLE_FOR.COLUMN, baseStyle, TOTAL, colIndex);
|
|
8475
8500
|
cells.push({
|
|
@@ -8478,7 +8503,7 @@ function StaticTable({
|
|
|
8478
8503
|
...finalStyleForColumn,
|
|
8479
8504
|
left: colIndex * fixedColWidth,
|
|
8480
8505
|
fontWeight: "bold",
|
|
8481
|
-
borderLeft: "none"
|
|
8506
|
+
borderLeft: !isRowHeaderVisible ? BORDER_STYLE : "none"
|
|
8482
8507
|
},
|
|
8483
8508
|
childClassName: "left_fixed_data_cell_total"
|
|
8484
8509
|
});
|
|
@@ -8486,7 +8511,7 @@ function StaticTable({
|
|
|
8486
8511
|
if (headerAtStart && isColTotalOn) {
|
|
8487
8512
|
cells.push({
|
|
8488
8513
|
label: TOTAL,
|
|
8489
|
-
style: bottomRowStyle,
|
|
8514
|
+
style: { ...bottomRowStyle, borderTop: !isColHeaderVisible ? BORDER_STYLE : "none" },
|
|
8490
8515
|
childClassName: "left_fixed_data_cell_total"
|
|
8491
8516
|
});
|
|
8492
8517
|
}
|
|
@@ -8519,8 +8544,8 @@ function StaticTable({
|
|
|
8519
8544
|
left: (fixedColCount - 1) * fixedColWidth,
|
|
8520
8545
|
background: outerBg,
|
|
8521
8546
|
border: BORDER_STYLE,
|
|
8522
|
-
borderTop: "none",
|
|
8523
|
-
borderLeft: "none",
|
|
8547
|
+
borderTop: !isColHeaderVisible ? BORDER_STYLE : "none",
|
|
8548
|
+
borderLeft: !isRowHeaderVisible ? BORDER_STYLE : "none",
|
|
8524
8549
|
fontWeight: "bold"
|
|
8525
8550
|
},
|
|
8526
8551
|
childClassName: "left_fixed_data_cell_grand_total",
|
|
@@ -8554,7 +8579,7 @@ function StaticTable({
|
|
|
8554
8579
|
DisplayUnits
|
|
8555
8580
|
]);
|
|
8556
8581
|
const renderLeftFixedHeaders = useMemo(
|
|
8557
|
-
() => cornerCells
|
|
8582
|
+
() => cornerCells?.map((c) => renderDataCell(c.label, c.style, "left_fixed_div", c.childClassName, void 0, c.dataBarColor)),
|
|
8558
8583
|
[cornerCells]
|
|
8559
8584
|
);
|
|
8560
8585
|
const colHeadersBase = useMemo(() => {
|
|
@@ -8598,6 +8623,7 @@ function StaticTable({
|
|
|
8598
8623
|
width: cellWidth * span,
|
|
8599
8624
|
height: cellHeight,
|
|
8600
8625
|
borderTop: level === 0 ? BORDER_STYLE : "none",
|
|
8626
|
+
borderLeft: i === 0 && !isRowHeaderVisible && !(headerAtStart && isRowTotalOn) ? BORDER_STYLE : "none",
|
|
8601
8627
|
childClassName: "col_header_data_cell"
|
|
8602
8628
|
});
|
|
8603
8629
|
}
|
|
@@ -8615,6 +8641,7 @@ function StaticTable({
|
|
|
8615
8641
|
label,
|
|
8616
8642
|
left: offsetLeft,
|
|
8617
8643
|
top: level * cellHeight,
|
|
8644
|
+
borderTop: !isColHeaderVisible && (headerAtStart && isColTotalOn) ? BORDER_STYLE : "none",
|
|
8618
8645
|
width: cellWidth,
|
|
8619
8646
|
height: cellHeight,
|
|
8620
8647
|
background: ShowHeatMap ? getBgColorForHetMap(0, idx) : getBgColorForCell(rowCount, dataColors),
|
|
@@ -8626,7 +8653,7 @@ function StaticTable({
|
|
|
8626
8653
|
});
|
|
8627
8654
|
}
|
|
8628
8655
|
}
|
|
8629
|
-
if (isRowTotalOn && !headerAtStart) {
|
|
8656
|
+
if (isRowTotalOn && !headerAtStart && isColHeaderVisible) {
|
|
8630
8657
|
headers.push({
|
|
8631
8658
|
...colHeaderFont,
|
|
8632
8659
|
label: TOTAL,
|
|
@@ -8689,6 +8716,8 @@ function StaticTable({
|
|
|
8689
8716
|
left: level * fixedColWidth,
|
|
8690
8717
|
width: fixedColWidth,
|
|
8691
8718
|
height: cellHeight * span,
|
|
8719
|
+
//Border condition for the col header visibility with total
|
|
8720
|
+
borderTop: i === 0 && !isColHeaderVisible && !(headerAtStart && isColTotalOn) ? BORDER_STYLE : "none",
|
|
8692
8721
|
borderLeft: level === 0 ? BORDER_STYLE : "none"
|
|
8693
8722
|
});
|
|
8694
8723
|
}
|
|
@@ -8718,13 +8747,14 @@ function StaticTable({
|
|
|
8718
8747
|
fontWeight: "bold",
|
|
8719
8748
|
rowIdxHeat: i,
|
|
8720
8749
|
colIdxHeat: level,
|
|
8750
|
+
borderLeft: !isRowHeaderVisible ? BORDER_STYLE : "none",
|
|
8721
8751
|
dataBarColor: innerBg
|
|
8722
8752
|
});
|
|
8723
8753
|
offsetTop += cellHeight;
|
|
8724
8754
|
}
|
|
8725
8755
|
}
|
|
8726
8756
|
}
|
|
8727
|
-
if (isColTotalOn && !headerAtStart) {
|
|
8757
|
+
if (isColTotalOn && !headerAtStart && isRowHeaderVisible) {
|
|
8728
8758
|
headers.push({
|
|
8729
8759
|
...rowHeaderFont,
|
|
8730
8760
|
label: TOTAL,
|
|
@@ -8840,6 +8870,12 @@ function StaticTable({
|
|
|
8840
8870
|
if (conditionalFormatObj.backgroundColor) finalStyle.background = conditionalFormatObj.backgroundColor;
|
|
8841
8871
|
if (conditionalFormatObj.color) finalStyle.color = conditionalFormatObj.color;
|
|
8842
8872
|
}
|
|
8873
|
+
if (rowIdxHeat === 0 && !isColHeaderVisible && !(headerAtStart && isColTotalOn)) {
|
|
8874
|
+
finalStyle.borderTop = BORDER_STYLE;
|
|
8875
|
+
}
|
|
8876
|
+
if (colIdxHeat === 0 && !isRowHeaderVisible && !(isRowTotalOn && headerAtStart)) {
|
|
8877
|
+
finalStyle.borderLeft = BORDER_STYLE;
|
|
8878
|
+
}
|
|
8843
8879
|
return renderDataCell(
|
|
8844
8880
|
formattedValue,
|
|
8845
8881
|
finalStyle,
|